blob: e66cd5a08cde417516fc4e15fb77145977c77adf [file] [log] [blame]
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001/**
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
Jian Li83d87a72016-04-20 15:38:24 -07003 * @version v2.1.4
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004 * @link http://swagger.io
Jian Li83d87a72016-04-20 15:38:24 -07005 * @license Apache-2.0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006 */
7(function(){this["Handlebars"] = this["Handlebars"] || {};
8this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
9this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
10 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
11 return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'><label for='input_apiKey_entry'>"
12 + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -070013 + "</label></div>\n <input placeholder='api_key' class='auth_input' id='input_apiKey_entry' name='apiKey' type='text'/>\n <div class='auth_submit'><a class='auth_submit_button' id='apply_api_key' href='#' data-sw-translate>apply</a></div>\n </div>\n</div>\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014},"useData":true});
15this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -070016 return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\"><label for=\"input_username\" data-sw-translate>Username</label></div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\"><label for=\"password\" data-sw-translate>Password</label></div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017 },"useData":true});
18this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
19 var stack1, buffer = "";
20 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
21 if (stack1 != null) { buffer += stack1; }
22 return buffer;
23},"2":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -070024 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <option value=\""
25 + escapeExpression(lambda(depth0, depth0))
26 + "\">";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070027 stack1 = lambda(depth0, depth0);
28 if (stack1 != null) { buffer += stack1; }
29 return buffer + "</option>\n";
30},"4":function(depth0,helpers,partials,data) {
31 return " <option value=\"application/json\">application/json</option>\n";
32 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -070033 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070034 + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
35 + "\">Response Content Type</label>\n<select name=\"contentType\" id=\""
36 + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0 != null ? depth0.contentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"contentTypeId","hash":{},"data":data}) : helper)))
37 + "\">\n";
38 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
39 if (stack1 != null) { buffer += stack1; }
40 return buffer + "</select>\n";
41},"useData":true});
42'use strict';
43
44
45$(function() {
46
47 // Helper function for vertically aligning DOM elements
48 // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
49 $.fn.vAlign = function() {
50 return this.each(function(){
51 var ah = $(this).height();
52 var ph = $(this).parent().height();
53 var mh = (ph - ah) / 2;
54 $(this).css('margin-top', mh);
55 });
56 };
57
58 $.fn.stretchFormtasticInputWidthToParent = function() {
59 return this.each(function(){
60 var p_width = $(this).closest("form").innerWidth();
61 var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10);
62 var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
63 $(this).css('width', p_width - p_padding - this_padding);
64 });
65 };
66
67 $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
68
69 // Vertically center these paragraphs
70 // Parent may need a min-height for this to work..
71 $('ul.downplayed li div.content p').vAlign();
72
73 // When a sandbox form is submitted..
74 $("form.sandbox").submit(function(){
75
76 var error_free = true;
77
78 // Cycle through the forms required inputs
79 $(this).find("input.required").each(function() {
80
81 // Remove any existing error styles from the input
82 $(this).removeClass('error');
83
84 // Tack the error style on if the input is empty..
85 if ($(this).val() === '') {
86 $(this).addClass('error');
87 $(this).wiggle();
88 error_free = false;
89 }
90
91 });
92
93 return error_free;
94 });
95
96});
97
98function clippyCopiedCallback() {
99 $('#api_key_copied').fadeIn().delay(1000).fadeOut();
100
101 // var b = $("#clippy_tooltip_" + a);
102 // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
103 // b.attr("title", "copy to clipboard")
104 // },
105 // 500))
106}
107
108// Logging function that accounts for browsers that don't have window.console
109function log(){
110 log.history = log.history || [];
111 log.history.push(arguments);
112 if(this.console){
113 console.log( Array.prototype.slice.call(arguments)[0] );
114 }
115}
116
117// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
118if (Function.prototype.bind && console && typeof console.log === "object") {
119 [
120 "log","info","warn","error","assert","dir","clear","profile","profileEnd"
121 ].forEach(function (method) {
122 console[method] = this.bind(console[method], console);
123 }, Function.prototype.call);
124}
125
126window.Docs = {
127
128 shebang: function() {
129
130 // If shebang has an operation nickname in it..
131 // e.g. /docs/#!/words/get_search
132 var fragments = $.param.fragment().split('/');
133 fragments.shift(); // get rid of the bang
134
135 switch (fragments.length) {
136 case 1:
137 if (fragments[0].length > 0) { // prevent matching "#/"
138 // Expand all operations for the resource and scroll to it
139 var dom_id = 'resource_' + fragments[0];
140
141 Docs.expandEndpointListForResource(fragments[0]);
142 $("#"+dom_id).slideto({highlight: false});
143 }
144 break;
145 case 2:
146 // Refer to the endpoint DOM element, e.g. #words_get_search
147
148 // Expand Resource
149 Docs.expandEndpointListForResource(fragments[0]);
150 $("#"+dom_id).slideto({highlight: false});
151
Jian Li83d87a72016-04-20 15:38:24 -0700152 // Expand operation
153 var li_dom_id = fragments.join('_');
154 var li_content_dom_id = li_dom_id + "_content";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700155
156
Jian Li83d87a72016-04-20 15:38:24 -0700157 Docs.expandOperation($('#'+li_content_dom_id));
158 $('#'+li_dom_id).slideto({highlight: false});
159 break;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700160 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700161 },
162
163 toggleEndpointListForResource: function(resource) {
164 var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
165 if (elem.is(':visible')) {
Jian Li83d87a72016-04-20 15:38:24 -0700166 $.bbq.pushState('#/', 2);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700167 Docs.collapseEndpointListForResource(resource);
168 } else {
Jian Li83d87a72016-04-20 15:38:24 -0700169 $.bbq.pushState('#/' + resource, 2);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700170 Docs.expandEndpointListForResource(resource);
171 }
172 },
173
174 // Expand resource
175 expandEndpointListForResource: function(resource) {
176 var resource = Docs.escapeResourceName(resource);
177 if (resource == '') {
178 $('.resource ul.endpoints').slideDown();
179 return;
180 }
181
182 $('li#resource_' + resource).addClass('active');
183
184 var elem = $('li#resource_' + resource + ' ul.endpoints');
185 elem.slideDown();
186 },
187
188 // Collapse resource and mark as explicitly closed
189 collapseEndpointListForResource: function(resource) {
190 var resource = Docs.escapeResourceName(resource);
191 if (resource == '') {
192 $('.resource ul.endpoints').slideUp();
193 return;
194 }
195
196 $('li#resource_' + resource).removeClass('active');
197
198 var elem = $('li#resource_' + resource + ' ul.endpoints');
199 elem.slideUp();
200 },
201
202 expandOperationsForResource: function(resource) {
203 // Make sure the resource container is open..
204 Docs.expandEndpointListForResource(resource);
205
206 if (resource == '') {
207 $('.resource ul.endpoints li.operation div.content').slideDown();
208 return;
209 }
210
211 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
212 Docs.expandOperation($(this));
213 });
214 },
215
216 collapseOperationsForResource: function(resource) {
217 // Make sure the resource container is open..
218 Docs.expandEndpointListForResource(resource);
219
220 if (resource == '') {
221 $('.resource ul.endpoints li.operation div.content').slideUp();
222 return;
223 }
224
225 $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
226 Docs.collapseOperation($(this));
227 });
228 },
229
230 escapeResourceName: function(resource) {
231 return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
232 },
233
234 expandOperation: function(elem) {
235 elem.slideDown();
236 },
237
238 collapseOperation: function(elem) {
239 elem.slideUp();
240 }
241};
242
243'use strict';
244
245Handlebars.registerHelper('sanitize', function(html) {
246 // Strip the script tags from the html, and return it as a Handlebars.SafeString
247 html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
248 return new Handlebars.SafeString(html);
249});
250
251Handlebars.registerHelper('renderTextParam', function(param) {
252 var result, type = 'text', idAtt = '';
Jian Li83d87a72016-04-20 15:38:24 -0700253 var paramType = param.type || param.schema.type || '';
254 var isArray = paramType.toLowerCase() === 'array' || param.allowMultiple;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700255 var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default;
256
Jian Li83d87a72016-04-20 15:38:24 -0700257 var dataVendorExtensions = Object.keys(param).filter(function(property) {
258 // filter X-data- properties
259 return property.match(/^X-data-/i) !== null;
260 }).reduce(function(result, property) {
261 // remove X- from property name, so it results in html attributes like data-foo='bar'
262 return result += ' ' + property.substring(2, property.length) + '=\'' + param[property] + '\'';
263 }, '');
264
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700265 if (typeof defaultValue === 'undefined') {
266 defaultValue = '';
267 }
268
269 if(param.format && param.format === 'password') {
270 type = 'password';
271 }
272
273 if(param.valueId) {
274 idAtt = ' id=\'' + param.valueId + '\'';
275 }
276
Jian Li83d87a72016-04-20 15:38:24 -0700277 if (typeof defaultValue === 'string' || defaultValue instanceof String) {
278 defaultValue = defaultValue.replace(/'/g,'&apos;');
279 }
280
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700281 if(isArray) {
Jian Li83d87a72016-04-20 15:38:24 -0700282 result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt + dataVendorExtensions;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700283 result += ' placeholder=\'Provide multiple values in new lines' + (param.required ? ' (at least one required).' : '.') + '\'>';
284 result += defaultValue + '</textarea>';
285 } else {
286 var parameterClass = 'parameter';
287 if(param.required) {
288 parameterClass += ' required';
289 }
290 result = '<input class=\'' + parameterClass + '\' minlength=\'' + (param.required ? 1 : 0) + '\'';
Jian Li83d87a72016-04-20 15:38:24 -0700291 result += ' name=\'' + param.name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700292 result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
293 }
294 return new Handlebars.SafeString(result);
295});
296
297this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
298 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
299 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
300 + "</div>\n <div class=\"info_description markdown\">";
301 stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
302 if (stack1 != null) { buffer += stack1; }
303 buffer += "</div>\n";
304 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
305 if (stack1 != null) { buffer += stack1; }
306 buffer += " ";
307 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
308 if (stack1 != null) { buffer += stack1; }
309 buffer += "\n ";
310 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
311 if (stack1 != null) { buffer += stack1; }
312 buffer += "\n ";
313 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
314 if (stack1 != null) { buffer += stack1; }
315 buffer += "\n ";
316 stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
317 if (stack1 != null) { buffer += stack1; }
318 buffer += "\n ";
319 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
320 if (stack1 != null) { buffer += stack1; }
321 return buffer + "\n";
322},"2":function(depth0,helpers,partials,data) {
323 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
324 return " <p>"
325 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.description : stack1), depth0))
326 + "</p>\n <a href=\""
327 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
328 + "\" target=\"_blank\">"
329 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.externalDocs : depth0)) != null ? stack1.url : stack1), depth0))
330 + "</a>\n";
331},"4":function(depth0,helpers,partials,data) {
332 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
333 return "<div class=\"info_tos\"><a href=\""
334 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
Jian Li83d87a72016-04-20 15:38:24 -0700335 + "\" data-sw-translate>Terms of service</a></div>";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700336},"6":function(depth0,helpers,partials,data) {
337 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
Jian Li83d87a72016-04-20 15:38:24 -0700338 return "<div class='info_name' data-sw-translate>Created by "
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700339 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
340 + "</div>";
341},"8":function(depth0,helpers,partials,data) {
342 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
Jian Li83d87a72016-04-20 15:38:24 -0700343 return "<div class='info_url' data-sw-translate>See more at <a href=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700344 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
345 + "\">"
346 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
347 + "</a></div>";
348},"10":function(depth0,helpers,partials,data) {
349 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
350 return "<div class='info_email'><a href=\"mailto:"
351 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
352 + "?subject="
353 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
Jian Li83d87a72016-04-20 15:38:24 -0700354 + "\" data-sw-translate>Contact the developer</a></div>";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700355},"12":function(depth0,helpers,partials,data) {
356 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
357 return "<div class='info_license'><a href='"
358 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
359 + "'>"
360 + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
361 + "</a></div>";
362},"14":function(depth0,helpers,partials,data) {
363 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
Jian Li83d87a72016-04-20 15:38:24 -0700364 return " , <span style=\"font-variant: small-caps\" data-sw-translate>api version</span>: "
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700365 + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
366 + "\n ";
367},"16":function(depth0,helpers,partials,data) {
368 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
369 return " <span style=\"float:right\"><a href=\""
370 + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
371 + "/debug?url="
372 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
373 + "\"><img id=\"validator\" src=\""
374 + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
375 + "?url="
376 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
377 + "\"></a>\n </span>\n";
378},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
379 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
380 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
381 if (stack1 != null) { buffer += stack1; }
382 buffer += "</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
383 + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
384 + "\n";
385 stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
386 if (stack1 != null) { buffer += stack1; }
387 buffer += "]\n";
388 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
389 if (stack1 != null) { buffer += stack1; }
390 return buffer + " </h4>\n </div>\n</div>\n";
391},"useData":true});
392this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
393 return "deprecated";
394 },"3":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700395 return " <h4><span data-sw-translate>Warning: Deprecated</span></h4>\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700396 },"5":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700397 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4><span data-sw-translate>Implementation Notes</span></h4>\n <div class=\"markdown\">";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700398 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
399 if (stack1 != null) { buffer += stack1; }
400 return buffer + "</div>\n";
401},"7":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700402 return " <div class=\"auth\">\n <span class=\"api-ic ic-error\">";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700403 },"9":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700404 var stack1, buffer = " <div class=\"api_information_panel\">\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700405 stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
406 if (stack1 != null) { buffer += stack1; }
407 return buffer + " </div>\n";
408},"10":function(depth0,helpers,partials,data) {
409 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
410 stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
411 if (stack1 != null) { buffer += stack1; }
412 return buffer + "'>"
413 + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
414 + "</div>\n";
415},"12":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700416 return "</span></div>";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700417 },"14":function(depth0,helpers,partials,data) {
418 return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
419 },"16":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700420 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = " <h4><span data-sw-translate>Response Class</span> (<span data-sw-translate>Status</span> "
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700421 + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700422 + ")</h4>\n ";
423 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.successDescription : depth0), {"name":"if","hash":{},"fn":this.program(17, data),"inverse":this.noop,"data":data});
424 if (stack1 != null) { buffer += stack1; }
425 return buffer + "\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n\n";
426},"17":function(depth0,helpers,partials,data) {
427 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = "<div class=\"markdown\">";
428 stack1 = ((helper = (helper = helpers.successDescription || (depth0 != null ? depth0.successDescription : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successDescription","hash":{},"data":data}) : helper));
429 if (stack1 != null) { buffer += stack1; }
430 return buffer + "</div>";
431},"19":function(depth0,helpers,partials,data) {
432 var stack1, buffer = " <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";
433 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"each","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
434 if (stack1 != null) { buffer += stack1; }
435 return buffer + " </tbody>\n </table>\n";
436},"20":function(depth0,helpers,partials,data) {
437 var lambda=this.lambda, escapeExpression=this.escapeExpression;
438 return " <tr>\n <td>"
439 + escapeExpression(lambda((data && data.key), depth0))
440 + "</td>\n <td>"
441 + escapeExpression(lambda((depth0 != null ? depth0.description : depth0), depth0))
442 + "</td>\n <td>"
443 + escapeExpression(lambda((depth0 != null ? depth0.type : depth0), depth0))
444 + "</td>\n <td>"
445 + escapeExpression(lambda((depth0 != null ? depth0.other : depth0), depth0))
446 + "</td>\n </tr>\n";
447},"22":function(depth0,helpers,partials,data) {
448 return " <h4 data-sw-translate>Parameters</h4>\n <table class='fullwidth'>\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";
449 },"24":function(depth0,helpers,partials,data) {
450 return " <div style='margin:0;padding:0;display:inline'></div>\n <h4 data-sw-translate>Response Messages</h4>\n <table class='fullwidth'>\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";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700451 },"26":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700452 return "";
453},"28":function(depth0,helpers,partials,data) {
454 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";
455 },"30":function(depth0,helpers,partials,data) {
456 return " <h4 data-sw-translate>Request Headers</h4>\n <div class='block request_headers'></div>\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700457 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
458 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
459 + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
460 + " operation' id='"
461 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
462 + "_"
463 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
464 + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
465 + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
466 + "/"
467 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
468 + "' class=\"toggleOperation\">"
469 + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
470 + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
471 + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
472 + "/"
473 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
474 + "' class=\"toggleOperation ";
475 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
476 if (stack1 != null) { buffer += stack1; }
477 buffer += "\">"
478 + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
479 + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
480 + escapeExpression(((helper = (helper = helpers.encodedParentId || (depth0 != null ? depth0.encodedParentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"encodedParentId","hash":{},"data":data}) : helper)))
481 + "/"
482 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
483 + "' class=\"toggleOperation\">";
484 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
485 if (stack1 != null) { buffer += stack1; }
486 buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
487 + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
488 + "_"
489 + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
490 + "_content' style='display:none'>\n";
491 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
492 if (stack1 != null) { buffer += stack1; }
493 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
494 if (stack1 != null) { buffer += stack1; }
495 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
496 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
497 if (stack1 != null) { buffer += stack1; }
498 buffer += "\n";
499 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
500 if (stack1 != null) { buffer += stack1; }
501 buffer += " ";
502 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
503 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
504 if (stack1 != null) { buffer += stack1; }
505 buffer += "\n";
506 stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
507 if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
508 if (stack1 != null) { buffer += stack1; }
509 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
510 if (stack1 != null) { buffer += stack1; }
Jian Li83d87a72016-04-20 15:38:24 -0700511 buffer += "\n";
512 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"if","hash":{},"fn":this.program(19, data),"inverse":this.noop,"data":data});
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700513 if (stack1 != null) { buffer += stack1; }
Jian Li83d87a72016-04-20 15:38:24 -0700514 buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
515 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.noop,"data":data});
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700516 if (stack1 != null) { buffer += stack1; }
Jian Li83d87a72016-04-20 15:38:24 -0700517 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(24, data),"inverse":this.noop,"data":data});
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700518 if (stack1 != null) { buffer += stack1; }
Jian Li83d87a72016-04-20 15:38:24 -0700519 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(26, data),"inverse":this.program(28, data),"data":data});
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700520 if (stack1 != null) { buffer += stack1; }
Jian Li83d87a72016-04-20 15:38:24 -0700521 buffer += " </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";
522 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showRequestHeaders : depth0), {"name":"if","hash":{},"fn":this.program(30, data),"inverse":this.noop,"data":data});
523 if (stack1 != null) { buffer += stack1; }
524 return buffer + " <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";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700525},"useData":true});
526this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
527 return " required";
528 },"3":function(depth0,helpers,partials,data) {
529 return " multiple=\"multiple\"";
530 },"5":function(depth0,helpers,partials,data) {
531 return " required ";
532 },"7":function(depth0,helpers,partials,data) {
533 var stack1, buffer = " <option ";
534 stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.hasDefault : depth0), {"name":"unless","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
535 if (stack1 != null) { buffer += stack1; }
536 return buffer + " value=''></option>\n";
537},"8":function(depth0,helpers,partials,data) {
538 return " selected=\"\" ";
539 },"10":function(depth0,helpers,partials,data) {
540 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "\n <option ";
541 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data});
542 if (stack1 != null) { buffer += stack1; }
543 buffer += " value='"
544 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
545 + "'> "
546 + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
547 + " ";
548 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data});
549 if (stack1 != null) { buffer += stack1; }
550 return buffer + " </option>\n\n";
551},"11":function(depth0,helpers,partials,data) {
552 return " selected=\"\" ";
553 },"13":function(depth0,helpers,partials,data) {
554 return " (default) ";
555 },"15":function(depth0,helpers,partials,data) {
556 return "<strong>";
557 },"17":function(depth0,helpers,partials,data) {
558 return "</strong>";
559 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
560 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code";
561 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
562 if (stack1 != null) { buffer += stack1; }
563 buffer += "'><label for='"
564 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
565 + "'>"
566 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700567 + "</label></td>\n<td>\n <select ";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700568 stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}));
569 if (stack1 != null) { buffer += stack1; }
570 buffer += " class=\"parameter ";
571 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
572 if (stack1 != null) { buffer += stack1; }
573 buffer += "\" name=\""
574 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
575 + "\" id=\""
576 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
577 + "\">\n\n";
578 stack1 = helpers.unless.call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"unless","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data});
579 if (stack1 != null) { buffer += stack1; }
580 buffer += "\n";
581 stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
582 if (stack1 != null) { buffer += stack1; }
583 buffer += "\n </select>\n</td>\n<td class=\"markdown\">";
584 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(15, data),"inverse":this.noop,"data":data});
585 if (stack1 != null) { buffer += stack1; }
586 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
587 if (stack1 != null) { buffer += stack1; }
588 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(17, data),"inverse":this.noop,"data":data});
589 if (stack1 != null) { buffer += stack1; }
590 buffer += "</td>\n<td>";
591 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
592 if (stack1 != null) { buffer += stack1; }
593 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
594},"useData":true});
595this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
596 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
597 return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
598 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
599 + "' id='"
600 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
601 + "'>"
602 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
603 + "</textarea>\n";
604},"3":function(depth0,helpers,partials,data) {
605 var stack1, buffer = "";
606 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
607 if (stack1 != null) { buffer += stack1; }
608 return buffer;
609},"4":function(depth0,helpers,partials,data) {
610 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
611 return " "
612 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
613 + "\n";
614},"6":function(depth0,helpers,partials,data) {
615 return " (empty)\n";
616 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
617 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
618 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
619 + "'>"
620 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
621 + "</label></td>\n<td>\n";
622 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
623 if (stack1 != null) { buffer += stack1; }
624 buffer += "</td>\n<td class=\"markdown\">";
625 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
626 if (stack1 != null) { buffer += stack1; }
627 buffer += "</td>\n<td>";
628 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
629 if (stack1 != null) { buffer += stack1; }
630 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
631},"useData":true});
632this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
633 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
634 return " <textarea class='body-textarea' readonly='readonly' name='"
635 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
636 + "' id='"
637 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
638 + "'>"
639 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700640 + "</textarea>\n <div class=\"parameter-content-type\" />\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700641},"3":function(depth0,helpers,partials,data) {
642 var stack1, buffer = "";
643 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
644 if (stack1 != null) { buffer += stack1; }
645 return buffer;
646},"4":function(depth0,helpers,partials,data) {
647 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
648 return " "
649 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
650 + "\n";
651},"6":function(depth0,helpers,partials,data) {
652 return " (empty)\n";
653 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
654 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
655 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
656 + "'>"
657 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
658 + "</label></td>\n<td>\n";
659 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
660 if (stack1 != null) { buffer += stack1; }
661 buffer += "</td>\n<td class=\"markdown\">";
662 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
663 if (stack1 != null) { buffer += stack1; }
664 buffer += "</td>\n<td>";
665 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
666 if (stack1 != null) { buffer += stack1; }
667 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
668},"useData":true});
669this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
670 var stack1, buffer = "";
671 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
672 if (stack1 != null) { buffer += stack1; }
673 return buffer;
674},"2":function(depth0,helpers,partials,data) {
675 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
676 return " <input type=\"file\" name='"
677 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
678 + "' id='"
679 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
680 + "'/>\n";
681},"4":function(depth0,helpers,partials,data) {
682 var stack1, buffer = "";
683 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
684 if (stack1 != null) { buffer += stack1; }
685 return buffer;
686},"5":function(depth0,helpers,partials,data) {
687 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
Jian Li83d87a72016-04-20 15:38:24 -0700688 return " <div class=\"editor_holder\"></div>\n <textarea class='body-textarea required' placeholder='(required)' name='"
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700689 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
690 + "' id=\""
691 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
692 + "\">"
693 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
694 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
695},"7":function(depth0,helpers,partials,data) {
696 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
697 return " <textarea class='body-textarea required' placeholder='(required)' name='"
698 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
699 + "' id='"
700 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700701 + "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700702},"9":function(depth0,helpers,partials,data) {
703 var stack1, buffer = "";
704 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
705 if (stack1 != null) { buffer += stack1; }
706 return buffer;
707},"10":function(depth0,helpers,partials,data) {
708 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
709 return " <input class='parameter' class='required' type='file' name='"
710 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
711 + "' id='"
712 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
713 + "'/>\n";
714},"12":function(depth0,helpers,partials,data) {
715 var stack1, helperMissing=helpers.helperMissing, buffer = "";
716 stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(13, data),"inverse":this.noop,"data":data}));
717 if (stack1 != null) { buffer += stack1; }
718 return buffer;
719},"13":function(depth0,helpers,partials,data) {
720 return "";
721},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
722 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'><label for='"
723 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
724 + "'>"
725 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
726 + "</label></td>\n<td>\n";
727 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
728 if (stack1 != null) { buffer += stack1; }
729 buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
730 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
731 if (stack1 != null) { buffer += stack1; }
732 buffer += "</span></strong>\n</td>\n<td>";
733 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
734 if (stack1 != null) { buffer += stack1; }
735 return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
736},"useData":true});
737this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
738 var stack1, buffer = "";
739 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
740 if (stack1 != null) { buffer += stack1; }
741 return buffer;
742},"2":function(depth0,helpers,partials,data) {
743 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
744 return " <input type=\"file\" name='"
745 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
746 + "' id='"
747 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
748 + "'/>\n <div class=\"parameter-content-type\" />\n";
749},"4":function(depth0,helpers,partials,data) {
750 var stack1, buffer = "";
751 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
752 if (stack1 != null) { buffer += stack1; }
753 return buffer;
754},"5":function(depth0,helpers,partials,data) {
755 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
Jian Li83d87a72016-04-20 15:38:24 -0700756 return " <div class=\"editor_holder\"></div>\n <textarea class='body-textarea' name='"
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700757 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
758 + "' id='"
759 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
760 + "'>"
761 + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
762 + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
763},"7":function(depth0,helpers,partials,data) {
764 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
765 return " <textarea class='body-textarea' name='"
766 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
767 + "' id='"
768 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700769 + "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700770},"9":function(depth0,helpers,partials,data) {
771 var stack1, buffer = "";
772 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
773 if (stack1 != null) { buffer += stack1; }
774 return buffer;
775},"10":function(depth0,helpers,partials,data) {
776 var stack1, helperMissing=helpers.helperMissing, buffer = "";
777 stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) || helperMissing).call(depth0, depth0, {"name":"renderTextParam","hash":{},"fn":this.program(11, data),"inverse":this.noop,"data":data}));
778 if (stack1 != null) { buffer += stack1; }
779 return buffer;
780},"11":function(depth0,helpers,partials,data) {
781 return "";
782},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
783 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'><label for='"
784 + escapeExpression(((helper = (helper = helpers.valueId || (depth0 != null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"valueId","hash":{},"data":data}) : helper)))
785 + "'>"
786 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
787 + "</label></td>\n<td>\n\n";
788 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
789 if (stack1 != null) { buffer += stack1; }
790 buffer += "\n</td>\n<td class=\"markdown\">";
791 stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
792 if (stack1 != null) { buffer += stack1; }
793 buffer += "</td>\n<td>";
794 stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
795 if (stack1 != null) { buffer += stack1; }
796 return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
797},"useData":true});
798this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
799 var stack1, buffer = "";
800 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
801 if (stack1 != null) { buffer += stack1; }
802 return buffer;
803},"2":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700804 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <option value=\""
805 + escapeExpression(lambda(depth0, depth0))
806 + "\">";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700807 stack1 = lambda(depth0, depth0);
808 if (stack1 != null) { buffer += stack1; }
809 return buffer + "</option>\n";
810},"4":function(depth0,helpers,partials,data) {
811 return " <option value=\"application/json\">application/json</option>\n";
812 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
813 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label for=\""
814 + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700815 + "\" data-sw-translate>Parameter content type:</label>\n<select name=\"parameterContentType\" id=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700816 + escapeExpression(((helper = (helper = helpers.parameterContentTypeId || (depth0 != null ? depth0.parameterContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parameterContentTypeId","hash":{},"data":data}) : helper)))
817 + "\">\n";
818 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
819 if (stack1 != null) { buffer += stack1; }
820 return buffer + "</select>\n";
821},"useData":true});
822this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
823 return " : ";
824 },"3":function(depth0,helpers,partials,data) {
825 var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
826 return " <li>\n <a href='"
827 + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700828 + "' data-sw-translate>Raw</a>\n </li>\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700829},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
830 var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
831 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
832 + "' class=\"toggleEndpointList\" data-id=\""
833 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
834 + "\">"
835 + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
836 + "</a> ";
837 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
838 if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
839 if (stack1 != null) { buffer += stack1; }
840 stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
841 if (stack1 != null) { buffer += stack1; }
842 buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
843 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
844 + "' id='endpointListTogger_"
845 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
846 + "' class=\"toggleEndpointList\" data-id=\""
847 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700848 + "\" data-sw-translate>Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700849 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700850 + "\" data-sw-translate>\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700851 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700852 + "\" data-sw-translate>\n Expand Operations\n </a>\n </li>\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700853 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.url : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
854 if (stack1 != null) { buffer += stack1; }
855 return buffer + " </ul>\n</div>\n<ul class='endpoints' id='"
856 + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
857 + "_endpoint_list' style='display:none'>\n\n</ul>\n";
858},"useData":true});
859this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
860 var stack1, buffer = "";
861 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
862 if (stack1 != null) { buffer += stack1; }
863 return buffer;
864},"2":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700865 var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <option value=\""
866 + escapeExpression(lambda(depth0, depth0))
867 + "\">";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700868 stack1 = lambda(depth0, depth0);
869 if (stack1 != null) { buffer += stack1; }
870 return buffer + "</option>\n";
871},"4":function(depth0,helpers,partials,data) {
872 return " <option value=\"application/json\">application/json</option>\n";
873 },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700874 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<label data-sw-translate for=\""
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700875 + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
876 + "\">Response Content Type</label>\n<select name=\"responseContentType\" id=\""
877 + escapeExpression(((helper = (helper = helpers.responseContentTypeId || (depth0 != null ? depth0.responseContentTypeId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"responseContentTypeId","hash":{},"data":data}) : helper)))
878 + "\">\n";
879 stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
880 if (stack1 != null) { buffer += stack1; }
881 return buffer + "</select>\n";
882},"useData":true});
883this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
Jian Li83d87a72016-04-20 15:38:24 -0700884 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<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>Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700885 stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
886 if (stack1 != null) { buffer += stack1; }
887 return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
888 + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
Jian Li83d87a72016-04-20 15:38:24 -0700889 + "</code></pre>\n <small class=\"notice\" data-sw-translate></small>\n </div>\n</div>\n\n";
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700890},"useData":true});
891this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
892 var lambda=this.lambda, escapeExpression=this.escapeExpression;
893 return " <tr>\n <td>"
894 + escapeExpression(lambda((data && data.key), depth0))
895 + "</td>\n <td>"
896 + escapeExpression(lambda((depth0 != null ? depth0.description : depth0), depth0))
897 + "</td>\n <td>"
898 + escapeExpression(lambda((depth0 != null ? depth0.type : depth0), depth0))
899 + "</td>\n </tr>\n";
900},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
901 var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
902 + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
903 + "</td>\n<td class=\"markdown\">";
904 stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
905 if (stack1 != null) { buffer += stack1; }
906 buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>\n<td class=\"headers\">\n <table>\n <tbody>\n";
907 stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.headers : depth0), {"name":"each","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
908 if (stack1 != null) { buffer += stack1; }
909 return buffer + " </tbody>\n </table>\n</td>";
910},"useData":true});
911/**
912 * swagger-client - swagger-client is a javascript client for use with swaggering APIs.
Jian Li83d87a72016-04-20 15:38:24 -0700913 * @version v2.1.10
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700914 * @link http://swagger.io
Jian Li83d87a72016-04-20 15:38:24 -0700915 * @license Apache-2.0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700916 */
917(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){
918'use strict';
919
920var auth = require('./lib/auth');
921var helpers = require('./lib/helpers');
922var SwaggerClient = require('./lib/client');
923var deprecationWrapper = function (url, options) {
924 helpers.log('This is deprecated, use "new SwaggerClient" instead.');
925
926 return new SwaggerClient(url, options);
927};
928
929/* Here for IE8 Support */
930if (!Array.prototype.indexOf) {
931 Array.prototype.indexOf = function(obj, start) {
932 for (var i = (start || 0), j = this.length; i < j; i++) {
933 if (this[i] === obj) { return i; }
934 }
935 return -1;
936 };
937}
938
939/* Here for IE8 Support */
940if (!String.prototype.trim) {
941 String.prototype.trim = function () {
942 return this.replace(/^\s+|\s+$/g, '');
943 };
944}
945
946/* Here for node 10.x support */
947if (!String.prototype.endsWith) {
948 String.prototype.endsWith = function(suffix) {
949 return this.indexOf(suffix, this.length - suffix.length) !== -1;
950 };
951}
952
953module.exports = SwaggerClient;
954
955SwaggerClient.ApiKeyAuthorization = auth.ApiKeyAuthorization;
956SwaggerClient.PasswordAuthorization = auth.PasswordAuthorization;
957SwaggerClient.CookieAuthorization = auth.CookieAuthorization;
958SwaggerClient.SwaggerApi = deprecationWrapper;
959SwaggerClient.SwaggerClient = deprecationWrapper;
Jian Li83d87a72016-04-20 15:38:24 -0700960SwaggerClient.SchemaMarkup = require('./lib/schema-markup');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700961
Jian Li83d87a72016-04-20 15:38:24 -0700962},{"./lib/auth":2,"./lib/client":3,"./lib/helpers":4,"./lib/schema-markup":7}],2:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700963'use strict';
964
Jian Li83d87a72016-04-20 15:38:24 -0700965var helpers = require('./helpers');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700966var btoa = require('btoa'); // jshint ignore:line
Jian Li83d87a72016-04-20 15:38:24 -0700967var CookieJar = require('cookiejar').CookieJar;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700968var _ = {
969 each: require('lodash-compat/collection/each'),
970 includes: require('lodash-compat/collection/includes'),
971 isObject: require('lodash-compat/lang/isObject'),
972 isArray: require('lodash-compat/lang/isArray')
973};
974
975/**
976 * SwaggerAuthorizations applys the correct authorization to an operation being executed
977 */
978var SwaggerAuthorizations = module.exports.SwaggerAuthorizations = function (authz) {
979 this.authz = authz || {};
980};
981
982/**
983 * Add auths to the hash
984 * Will overwrite any existing
985 *
986 */
987SwaggerAuthorizations.prototype.add = function (name, auth) {
Jian Li83d87a72016-04-20 15:38:24 -0700988 if(_.isObject(name)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -0700989 for (var key in name) {
990 this.authz[key] = name[key];
991 }
992 } else if(typeof name === 'string' ){
993 this.authz[name] = auth;
994 }
995
996 return auth;
997};
998
999SwaggerAuthorizations.prototype.remove = function (name) {
1000 return delete this.authz[name];
1001};
1002
1003SwaggerAuthorizations.prototype.apply = function (obj, securities) {
Jian Li83d87a72016-04-20 15:38:24 -07001004 var status = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001005 var applyAll = !securities;
1006 var flattenedSecurities = [];
1007
1008 // Securities could be [ {} ]
1009 _.each(securities, function (obj, key) {
1010
1011 // Make sure we account for securities being [ str ]
1012 if(typeof key === 'string') {
1013 flattenedSecurities.push(key);
1014 }
1015
1016 // Flatten keys in to our array
1017 _.each(obj, function (val, key) {
1018 flattenedSecurities.push(key);
1019 });
1020 });
1021
1022 _.each(this.authz, function (auth, authName) {
1023 if(applyAll || _.includes(flattenedSecurities, authName)) {
Jian Li83d87a72016-04-20 15:38:24 -07001024 var newStatus = auth.apply(obj);
1025 status = status && !!newStatus; // logical ORs regarding status
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001026 }
1027 });
1028
1029 return status;
1030};
1031
1032/**
1033 * ApiKeyAuthorization allows a query param or header to be injected
1034 */
1035var ApiKeyAuthorization = module.exports.ApiKeyAuthorization = function (name, value, type) {
1036 this.name = name;
1037 this.value = value;
1038 this.type = type;
1039};
1040
1041ApiKeyAuthorization.prototype.apply = function (obj) {
1042 if (this.type === 'query') {
Jian Li83d87a72016-04-20 15:38:24 -07001043 // see if already applied. If so, don't do it again
1044
1045 var qp;
1046 if (obj.url.indexOf('?') > 0) {
1047 qp = obj.url.substring(obj.url.indexOf('?') + 1);
1048 var parts = qp.split('&');
1049 if(parts && parts.length > 0) {
1050 for(var i = 0; i < parts.length; i++) {
1051 var kv = parts[i].split('=');
1052 if(kv && kv.length > 0) {
1053 if (kv[0] === this.name) {
1054 // skip it
1055 return false;
1056 }
1057 }
1058 }
1059 }
1060 }
1061
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001062 if (obj.url.indexOf('?') > 0) {
1063 obj.url = obj.url + '&' + this.name + '=' + this.value;
1064 } else {
1065 obj.url = obj.url + '?' + this.name + '=' + this.value;
1066 }
1067
1068 return true;
1069 } else if (this.type === 'header') {
Jian Li83d87a72016-04-20 15:38:24 -07001070 if(typeof obj.headers[this.name] === 'undefined') {
1071 obj.headers[this.name] = this.value;
1072 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001073
1074 return true;
1075 }
1076};
1077
1078var CookieAuthorization = module.exports.CookieAuthorization = function (cookie) {
1079 this.cookie = cookie;
1080};
1081
1082CookieAuthorization.prototype.apply = function (obj) {
1083 obj.cookieJar = obj.cookieJar || new CookieJar();
1084 obj.cookieJar.setCookie(this.cookie);
1085
1086 return true;
1087};
1088
1089/**
1090 * Password Authorization is a basic auth implementation
1091 */
Jian Li83d87a72016-04-20 15:38:24 -07001092var PasswordAuthorization = module.exports.PasswordAuthorization = function (username, password) {
1093 if (arguments.length === 3) {
1094 helpers.log('PasswordAuthorization: the \'name\' argument has been removed, pass only username and password');
1095 username = arguments[1];
1096 password = arguments[2];
1097 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001098 this.username = username;
1099 this.password = password;
1100};
1101
1102PasswordAuthorization.prototype.apply = function (obj) {
Jian Li83d87a72016-04-20 15:38:24 -07001103 if(typeof obj.headers.Authorization === 'undefined') {
1104 obj.headers.Authorization = 'Basic ' + btoa(this.username + ':' + this.password);
1105 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001106
1107 return true;
1108};
1109
Jian Li83d87a72016-04-20 15:38:24 -07001110},{"./helpers":4,"btoa":14,"cookiejar":19,"lodash-compat/collection/each":56,"lodash-compat/collection/includes":59,"lodash-compat/lang/isArray":144,"lodash-compat/lang/isObject":148}],3:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001111'use strict';
1112
1113var _ = {
1114 bind: require('lodash-compat/function/bind'),
1115 cloneDeep: require('lodash-compat/lang/cloneDeep'),
1116 find: require('lodash-compat/collection/find'),
1117 forEach: require('lodash-compat/collection/forEach'),
1118 indexOf: require('lodash-compat/array/indexOf'),
1119 isArray: require('lodash-compat/lang/isArray'),
Jian Li83d87a72016-04-20 15:38:24 -07001120 isObject: require('lodash-compat/lang/isObject'),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001121 isFunction: require('lodash-compat/lang/isFunction'),
1122 isPlainObject: require('lodash-compat/lang/isPlainObject'),
1123 isUndefined: require('lodash-compat/lang/isUndefined')
1124};
1125var auth = require('./auth');
1126var helpers = require('./helpers');
1127var Model = require('./types/model');
1128var Operation = require('./types/operation');
1129var OperationGroup = require('./types/operationGroup');
1130var Resolver = require('./resolver');
1131var SwaggerHttp = require('./http');
1132var SwaggerSpecConverter = require('./spec-converter');
Jian Li83d87a72016-04-20 15:38:24 -07001133var Q = require('q');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001134
1135// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1136// following usage: 'client.{tagName}'
1137var reservedClientTags = [
1138 'apis',
1139 'authorizationScheme',
1140 'authorizations',
1141 'basePath',
1142 'build',
1143 'buildFrom1_1Spec',
1144 'buildFrom1_2Spec',
1145 'buildFromSpec',
1146 'clientAuthorizations',
1147 'convertInfo',
1148 'debug',
1149 'defaultErrorCallback',
1150 'defaultSuccessCallback',
Jian Li83d87a72016-04-20 15:38:24 -07001151 'enableCookies',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001152 'fail',
1153 'failure',
1154 'finish',
1155 'help',
1156 'idFromOp',
1157 'info',
1158 'initialize',
1159 'isBuilt',
1160 'isValid',
1161 'modelPropertyMacro',
1162 'models',
1163 'modelsArray',
1164 'options',
1165 'parameterMacro',
1166 'parseUri',
1167 'progress',
1168 'resourceCount',
1169 'sampleModels',
1170 'selfReflect',
1171 'setConsolidatedModels',
1172 'spec',
1173 'supportedSubmitMethods',
1174 'swaggerRequestHeaders',
1175 'tagFromLabel',
Jian Li83d87a72016-04-20 15:38:24 -07001176 'title',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001177 'url',
1178 'useJQuery'
1179];
1180// We have to keep track of the function/property names to avoid collisions for tag names which are used to allow the
1181// following usage: 'client.apis.{tagName}'
1182var reservedApiTags = [
1183 'apis',
1184 'asCurl',
1185 'description',
1186 'externalDocs',
1187 'help',
1188 'label',
1189 'name',
1190 'operation',
1191 'operations',
1192 'operationsArray',
1193 'path',
1194 'tag'
1195];
1196var supportedOperationMethods = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put'];
1197var SwaggerClient = module.exports = function (url, options) {
1198 this.authorizations = null;
1199 this.authorizationScheme = null;
1200 this.basePath = null;
1201 this.debug = false;
Jian Li83d87a72016-04-20 15:38:24 -07001202 this.enableCookies = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001203 this.info = null;
1204 this.isBuilt = false;
1205 this.isValid = false;
1206 this.modelsArray = [];
1207 this.resourceCount = 0;
1208 this.url = null;
1209 this.useJQuery = false;
Jian Li83d87a72016-04-20 15:38:24 -07001210 this.swaggerObject = {};
1211 this.deferredClient = Q.defer();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001212
1213 this.clientAuthorizations = new auth.SwaggerAuthorizations();
1214
1215 if (typeof url !== 'undefined') {
1216 return this.initialize(url, options);
1217 } else {
1218 return this;
1219 }
1220};
1221
1222SwaggerClient.prototype.initialize = function (url, options) {
1223 this.models = {};
1224 this.sampleModels = {};
1225
1226 if (typeof url === 'string') {
1227 this.url = url;
Jian Li83d87a72016-04-20 15:38:24 -07001228 } else if (_.isObject(url)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001229 options = url;
1230 this.url = options.url;
1231 }
1232
1233 options = options || {};
1234 this.clientAuthorizations.add(options.authorizations);
1235 this.swaggerRequestHeaders = options.swaggerRequestHeaders || 'application/json;charset=utf-8,*/*';
1236 this.defaultSuccessCallback = options.defaultSuccessCallback || null;
1237 this.defaultErrorCallback = options.defaultErrorCallback || null;
1238 this.modelPropertyMacro = options.modelPropertyMacro || null;
Jian Li83d87a72016-04-20 15:38:24 -07001239 this.parameterMacro = options.parameterMacro || null;
1240 this.usePromise = options.usePromise || null;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001241
1242 if (typeof options.success === 'function') {
1243 this.success = options.success;
1244 }
1245
1246 if (options.useJQuery) {
1247 this.useJQuery = options.useJQuery;
1248 }
1249
Jian Li83d87a72016-04-20 15:38:24 -07001250 if (options.enableCookies) {
1251 this.enableCookies = options.enableCookies;
1252 }
1253
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001254 this.options = options || {};
1255
1256 this.supportedSubmitMethods = options.supportedSubmitMethods || [];
Jian Li83d87a72016-04-20 15:38:24 -07001257 this.failure = options.failure || function (err) { throw err; };
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001258 this.progress = options.progress || function () {};
1259 this.spec = _.cloneDeep(options.spec); // Clone so we do not alter the provided document
1260
Jian Li83d87a72016-04-20 15:38:24 -07001261 if (options.scheme) {
1262 this.scheme = options.scheme;
1263 }
1264
1265 if (this.usePromise || typeof options.success === 'function') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001266 this.ready = true;
Jian Li83d87a72016-04-20 15:38:24 -07001267 return this.build();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001268 }
1269};
1270
1271SwaggerClient.prototype.build = function (mock) {
1272 if (this.isBuilt) {
1273 return this;
1274 }
1275
1276 var self = this;
1277
Jian Li83d87a72016-04-20 15:38:24 -07001278 this.progress('fetching resource list: ' + this.url + '; Please wait.');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001279
1280 var obj = {
1281 useJQuery: this.useJQuery,
1282 url: this.url,
1283 method: 'get',
1284 headers: {
1285 accept: this.swaggerRequestHeaders
1286 },
1287 on: {
1288 error: function (response) {
1289 if (self.url.substring(0, 4) !== 'http') {
1290 return self.fail('Please specify the protocol for ' + self.url);
1291 } else if (response.status === 0) {
1292 return self.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.');
1293 } else if (response.status === 404) {
1294 return self.fail('Can\'t read swagger JSON from ' + self.url);
1295 } else {
1296 return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
1297 }
1298 },
1299 response: function (resp) {
1300
1301 var responseObj = resp.obj;
1302 if(!responseObj) {
1303 return self.fail('failed to parse JSON/YAML response');
1304 }
1305
1306 self.swaggerVersion = responseObj.swaggerVersion;
Jian Li83d87a72016-04-20 15:38:24 -07001307 self.swaggerObject = responseObj;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001308
1309 if (responseObj.swagger && parseInt(responseObj.swagger) === 2) {
1310 self.swaggerVersion = responseObj.swagger;
1311
1312 new Resolver().resolve(responseObj, self.url, self.buildFromSpec, self);
1313
1314 self.isValid = true;
1315 } else {
1316 var converter = new SwaggerSpecConverter();
Jian Li83d87a72016-04-20 15:38:24 -07001317 self.oldSwaggerObject = self.swaggerObject;
1318
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001319 converter.setDocumentationLocation(self.url);
Jian Li83d87a72016-04-20 15:38:24 -07001320 converter.convert(responseObj, self.clientAuthorizations, self.options, function(spec) {
1321 self.swaggerObject = spec;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001322 new Resolver().resolve(spec, self.url, self.buildFromSpec, self);
1323 self.isValid = true;
1324 });
1325 }
1326 }
1327 }
1328 };
1329
1330 if (this.spec) {
Jian Li83d87a72016-04-20 15:38:24 -07001331 self.swaggerObject = this.spec;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001332 setTimeout(function () {
1333 new Resolver().resolve(self.spec, self.buildFromSpec, self);
Jian Li83d87a72016-04-20 15:38:24 -07001334 }, 10);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001335 } else {
1336 this.clientAuthorizations.apply(obj);
1337
1338 if (mock) {
1339 return obj;
1340 }
1341
1342 new SwaggerHttp().execute(obj, this.options);
1343 }
1344
Jian Li83d87a72016-04-20 15:38:24 -07001345 return (this.usePromise) ? this.deferredClient.promise : this;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001346};
1347
1348SwaggerClient.prototype.buildFromSpec = function (response) {
1349 if (this.isBuilt) {
1350 return this;
1351 }
1352
1353 this.apis = {};
1354 this.apisArray = [];
1355 this.basePath = response.basePath || '';
1356 this.consumes = response.consumes;
1357 this.host = response.host || '';
1358 this.info = response.info || {};
1359 this.produces = response.produces;
1360 this.schemes = response.schemes || [];
1361 this.securityDefinitions = response.securityDefinitions;
1362 this.title = response.title || '';
1363
1364 if (response.externalDocs) {
1365 this.externalDocs = response.externalDocs;
1366 }
1367
1368 // legacy support
1369 this.authSchemes = response.securityDefinitions;
1370
1371 var definedTags = {};
1372 var k;
1373
1374 if (Array.isArray(response.tags)) {
1375 definedTags = {};
1376
1377 for (k = 0; k < response.tags.length; k++) {
1378 var t = response.tags[k];
1379 definedTags[t.name] = t;
1380 }
1381 }
1382
1383 var location;
1384
1385 if (typeof this.url === 'string') {
1386 location = this.parseUri(this.url);
Jian Li83d87a72016-04-20 15:38:24 -07001387 if (typeof this.scheme === 'undefined' && typeof this.schemes === 'undefined' || this.schemes.length === 0) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001388 this.scheme = location.scheme || 'http';
Jian Li83d87a72016-04-20 15:38:24 -07001389 } else if (typeof this.scheme === 'undefined') {
1390 this.scheme = this.schemes[0] || location.scheme;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001391 }
1392
1393 if (typeof this.host === 'undefined' || this.host === '') {
1394 this.host = location.host;
1395
1396 if (location.port) {
1397 this.host = this.host + ':' + location.port;
1398 }
1399 }
1400 }
1401 else {
1402 if (typeof this.schemes === 'undefined' || this.schemes.length === 0) {
1403 this.scheme = 'http';
1404 }
Jian Li83d87a72016-04-20 15:38:24 -07001405 else if (typeof this.scheme === 'undefined') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001406 this.scheme = this.schemes[0];
1407 }
1408 }
1409
1410 this.definitions = response.definitions;
1411
1412 var key;
1413
1414 for (key in this.definitions) {
1415 var model = new Model(key, this.definitions[key], this.models, this.modelPropertyMacro);
1416
1417 if (model) {
1418 this.models[key] = model;
1419 }
1420 }
1421
1422 // get paths, create functions for each operationId
1423 var self = this;
1424
1425 // Bind help to 'client.apis'
1426 self.apis.help = _.bind(self.help, self);
1427
1428 _.forEach(response.paths, function (pathObj, path) {
1429 // Only process a path if it's an object
1430 if (!_.isPlainObject(pathObj)) {
1431 return;
1432 }
1433
1434 _.forEach(supportedOperationMethods, function (method) {
1435 var operation = pathObj[method];
1436
1437 if (_.isUndefined(operation)) {
1438 // Operation does not exist
1439 return;
1440 } else if (!_.isPlainObject(operation)) {
1441 // Operation exists but it is not an Operation Object. Since this is invalid, log it.
1442 helpers.log('The \'' + method + '\' operation for \'' + path + '\' path is not an Operation Object');
1443
1444 return;
1445 }
1446
1447 var tags = operation.tags;
1448
1449 if (_.isUndefined(tags) || !_.isArray(tags) || tags.length === 0) {
1450 tags = operation.tags = [ 'default' ];
1451 }
1452
1453 var operationId = self.idFromOp(path, method, operation);
Jian Li83d87a72016-04-20 15:38:24 -07001454
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001455 var operationObject = new Operation(self,
1456 operation.scheme,
1457 operationId,
1458 method,
1459 path,
1460 operation,
1461 self.definitions,
1462 self.models,
1463 self.clientAuthorizations);
1464
1465 // bind self operation's execute command to the api
1466 _.forEach(tags, function (tag) {
1467 var clientProperty = _.indexOf(reservedClientTags, tag) > -1 ? '_' + tag : tag;
1468 var apiProperty = _.indexOf(reservedApiTags, tag) > -1 ? '_' + tag : tag;
1469 var operationGroup = self[clientProperty];
1470
1471 if (clientProperty !== tag) {
1472 helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient function/property name. Use \'client.' +
1473 clientProperty + '\' or \'client.apis.' + tag + '\' instead of \'client.' + tag + '\'.');
1474 }
1475
1476 if (apiProperty !== tag) {
1477 helpers.log('The \'' + tag + '\' tag conflicts with a SwaggerClient operation function/property name. Use ' +
1478 '\'client.apis.' + apiProperty + '\' instead of \'client.apis.' + tag + '\'.');
1479 }
1480
1481 if (_.indexOf(reservedApiTags, operationId) > -1) {
1482 helpers.log('The \'' + operationId + '\' operationId conflicts with a SwaggerClient operation ' +
1483 'function/property name. Use \'client.apis.' + apiProperty + '._' + operationId +
1484 '\' instead of \'client.apis.' + apiProperty + '.' + operationId + '\'.');
1485
1486 operationId = '_' + operationId;
1487 operationObject.nickname = operationId; // So 'client.apis.[tag].operationId.help() works properly
1488 }
1489
1490 if (_.isUndefined(operationGroup)) {
1491 operationGroup = self[clientProperty] = self.apis[apiProperty] = {};
1492
1493 operationGroup.operations = {};
1494 operationGroup.label = apiProperty;
1495 operationGroup.apis = {};
1496
1497 var tagDef = definedTags[tag];
1498
1499 if (!_.isUndefined(tagDef)) {
1500 operationGroup.description = tagDef.description;
1501 operationGroup.externalDocs = tagDef.externalDocs;
1502 }
1503
1504 self[clientProperty].help = _.bind(self.help, operationGroup);
1505 self.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
1506 }
1507
Jian Li83d87a72016-04-20 15:38:24 -07001508 operationId = self.makeUniqueOperationId(operationId, self.apis[apiProperty]);
1509
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001510 // Bind tag help
1511 if (!_.isFunction(operationGroup.help)) {
1512 operationGroup.help = _.bind(self.help, operationGroup);
1513 }
1514
1515 // bind to the apis object
1516 self.apis[apiProperty][operationId] = operationGroup[operationId] = _.bind(operationObject.execute,
1517 operationObject);
1518 self.apis[apiProperty][operationId].help = operationGroup[operationId].help = _.bind(operationObject.help,
1519 operationObject);
1520 self.apis[apiProperty][operationId].asCurl = operationGroup[operationId].asCurl = _.bind(operationObject.asCurl,
1521 operationObject);
1522
1523 operationGroup.apis[operationId] = operationGroup.operations[operationId] = operationObject;
1524
1525 // legacy UI feature
1526 var api = _.find(self.apisArray, function (api) {
1527 return api.tag === tag;
1528 });
1529
1530 if (api) {
1531 api.operationsArray.push(operationObject);
1532 }
1533 });
1534 });
1535 });
1536
1537 this.isBuilt = true;
1538
Jian Li83d87a72016-04-20 15:38:24 -07001539 if (this.usePromise) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001540 this.isValid = true;
1541 this.isBuilt = true;
Jian Li83d87a72016-04-20 15:38:24 -07001542 this.deferredClient.resolve(this);
1543
1544 return this.deferredClient.promise;
1545 }
1546
1547 if (this.success) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001548 this.success();
1549 }
1550
1551 return this;
1552};
1553
Jian Li83d87a72016-04-20 15:38:24 -07001554SwaggerClient.prototype.makeUniqueOperationId = function(operationId, api) {
1555 var count = 0;
1556 var name = operationId;
1557
1558 // make unique across this operation group
1559 while(true) {
1560 var matched = false;
1561 _.forEach(api.operations, function (operation) {
1562 if(operation.nickname === name) {
1563 matched = true;
1564 }
1565 });
1566 if(!matched) {
1567 return name;
1568 }
1569 name = operationId + '_' + count;
1570 count ++;
1571 }
1572
1573 return operationId;
1574};
1575
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001576SwaggerClient.prototype.parseUri = function (uri) {
1577 var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
1578 var parts = urlParseRE.exec(uri);
1579
1580 return {
Jian Li83d87a72016-04-20 15:38:24 -07001581 scheme: parts[4] ? parts[4].replace(':','') : undefined,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001582 host: parts[11],
1583 port: parts[12],
1584 path: parts[15]
1585 };
1586};
1587
1588SwaggerClient.prototype.help = function (dontPrint) {
1589 var output = '';
1590
1591 if (this instanceof SwaggerClient) {
1592 _.forEach(this.apis, function (api, name) {
1593 if (_.isPlainObject(api)) {
1594 output += 'operations for the \'' + name + '\' tag\n';
1595
1596 _.forEach(api.operations, function (operation, name) {
1597 output += ' * ' + name + ': ' + operation.summary + '\n';
1598 });
1599 }
1600 });
1601 } else if (this instanceof OperationGroup || _.isPlainObject(this)) {
1602 output += 'operations for the \'' + this.label + '\' tag\n';
1603
1604 _.forEach(this.apis, function (operation, name) {
1605 output += ' * ' + name + ': ' + operation.summary + '\n';
1606 });
1607 }
1608
1609 if (dontPrint) {
1610 return output;
1611 } else {
1612 helpers.log(output);
1613
1614 return output;
1615 }
1616};
1617
1618SwaggerClient.prototype.tagFromLabel = function (label) {
1619 return label;
1620};
1621
1622SwaggerClient.prototype.idFromOp = function (path, httpMethod, op) {
1623 if(!op || !op.operationId) {
1624 op = op || {};
1625 op.operationId = httpMethod + '_' + path;
1626 }
1627 var opId = op.operationId.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_') || (path.substring(1) + '_' + httpMethod);
1628
1629 opId = opId.replace(/((_){2,})/g, '_');
1630 opId = opId.replace(/^(_)*/g, '');
1631 opId = opId.replace(/([_])*$/g, '');
Jian Li83d87a72016-04-20 15:38:24 -07001632
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001633 return opId;
1634};
1635
Jian Li83d87a72016-04-20 15:38:24 -07001636SwaggerClient.prototype.setHost = function (host) {
1637 this.host = host;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001638
Jian Li83d87a72016-04-20 15:38:24 -07001639 if(this.apis) {
1640 _.forEach(this.apis, function(api) {
1641 if(api.operations) {
1642 _.forEach(api.operations, function(operation) {
1643 operation.host = host;
1644 });
1645 }
1646 });
1647 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001648};
1649
Jian Li83d87a72016-04-20 15:38:24 -07001650SwaggerClient.prototype.setBasePath = function (basePath) {
1651 this.basePath = basePath;
1652
1653 if(this.apis) {
1654 _.forEach(this.apis, function(api) {
1655 if(api.operations) {
1656 _.forEach(api.operations, function(operation) {
1657 operation.basePath = basePath;
1658 });
1659 }
1660 });
1661 }
1662};
1663
1664SwaggerClient.prototype.fail = function (message) {
1665 if (this.usePromise) {
1666 this.deferredClient.reject(message);
1667 return this.deferredClient.promise;
1668 } else {
1669 if (this.failure) {
1670 this.failure(message);
1671 }
1672 else {
1673 this.failure(message);
1674 }
1675 }
1676};
1677
1678},{"./auth":2,"./helpers":4,"./http":5,"./resolver":6,"./spec-converter":8,"./types/model":9,"./types/operation":10,"./types/operationGroup":11,"lodash-compat/array/indexOf":53,"lodash-compat/collection/find":57,"lodash-compat/collection/forEach":58,"lodash-compat/function/bind":62,"lodash-compat/lang/cloneDeep":142,"lodash-compat/lang/isArray":144,"lodash-compat/lang/isFunction":146,"lodash-compat/lang/isObject":148,"lodash-compat/lang/isPlainObject":149,"lodash-compat/lang/isUndefined":152,"q":161}],4:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001679(function (process){
1680'use strict';
1681
1682var _ = {
Jian Li83d87a72016-04-20 15:38:24 -07001683 isPlainObject: require('lodash-compat/lang/isPlainObject'),
1684 indexOf: require('lodash-compat/array/indexOf')
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001685};
1686
1687module.exports.__bind = function (fn, me) {
1688 return function(){
1689 return fn.apply(me, arguments);
1690 };
1691};
1692
1693var log = module.exports.log = function() {
1694 // Only log if available and we're not testing
1695 if (console && process.env.NODE_ENV !== 'test') {
1696 console.log(Array.prototype.slice.call(arguments)[0]);
1697 }
1698};
1699
1700module.exports.fail = function (message) {
1701 log(message);
1702};
1703
Jian Li83d87a72016-04-20 15:38:24 -07001704var optionHtml = module.exports.optionHtml = function (label, value) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001705 return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
1706};
1707
1708var resolveSchema = module.exports.resolveSchema = function (schema) {
1709 if (_.isPlainObject(schema.schema)) {
1710 schema = resolveSchema(schema.schema);
1711 }
1712
1713 return schema;
1714};
1715
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001716var simpleRef = module.exports.simpleRef = function (name) {
1717 if (typeof name === 'undefined') {
1718 return null;
1719 }
1720
1721 if (name.indexOf('#/definitions/') === 0) {
1722 return name.substring('#/definitions/'.length);
1723 } else {
1724 return name;
1725 }
1726};
1727
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001728
1729}).call(this,require('_process'))
Jian Li83d87a72016-04-20 15:38:24 -07001730//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9oZWxwZXJzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJp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YS5zY2hlbWEpKSB7XG4gICAgc2NoZW1hID0gcmVzb2x2ZVNjaGVtYShzY2hlbWEuc2NoZW1hKTtcbiAgfVxuXG4gIHJldHVybiBzY2hlbWE7XG59O1xuXG52YXIgc2ltcGxlUmVmID0gbW9kdWxlLmV4cG9ydHMuc2ltcGxlUmVmID0gZnVuY3Rpb24gKG5hbWUpIHtcbiAgaWYgKHR5cGVvZiBuYW1lID09PSAndW5kZWZpbmVkJykge1xuICAgIHJldHVybiBudWxsO1xuICB9XG5cbiAgaWYgKG5hbWUuaW5kZXhPZignIy9kZWZpbml0aW9ucy8nKSA9PT0gMCkge1xuICAgIHJldHVybiBuYW1lLnN1YnN0cmluZygnIy9kZWZpbml0aW9ucy8nLmxlbmd0aCk7XG4gIH0gZWxzZSB7XG4gICAgcmV0dXJuIG5hbWU7XG4gIH1cbn07XG5cbiJdfQ==
1731},{"_process":13,"lodash-compat/array/indexOf":53,"lodash-compat/lang/isPlainObject":149}],5:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001732'use strict';
1733
1734var helpers = require('./helpers');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001735var request = require('superagent');
1736var jsyaml = require('js-yaml');
Jian Li83d87a72016-04-20 15:38:24 -07001737var _ = {
1738 isObject: require('lodash-compat/lang/isObject')
1739};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001740
1741/*
1742 * JQueryHttpClient is a light-weight, node or browser HTTP client
1743 */
1744var JQueryHttpClient = function () {};
1745
1746/*
1747 * SuperagentHttpClient is a light-weight, node or browser HTTP client
1748 */
1749var SuperagentHttpClient = function () {};
1750
1751/**
1752 * SwaggerHttp is a wrapper for executing requests
1753 */
1754var SwaggerHttp = module.exports = function () {};
1755
1756SwaggerHttp.prototype.execute = function (obj, opts) {
1757 var client;
1758
1759 if(opts && opts.client) {
1760 client = opts.client;
1761 }
1762 else {
1763 client = new SuperagentHttpClient(opts);
1764 }
Jian Li83d87a72016-04-20 15:38:24 -07001765 client.opts = opts || {};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001766
1767 // legacy support
Jian Li83d87a72016-04-20 15:38:24 -07001768 var hasJQuery = false;
1769 if(typeof window !== 'undefined') {
1770 if(typeof window.jQuery !== 'undefined') {
1771 hasJQuery = true;
1772 }
1773 }
1774 if(this.isInternetExplorer() && (obj.useJQuery === false || !hasJQuery )) {
1775 throw new Error('Unsupported configuration! JQuery is required but not available');
1776 }
1777 if ((obj && obj.useJQuery === true) || this.isInternetExplorer() && hasJQuery) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001778 client = new JQueryHttpClient(opts);
1779 }
1780
1781 var success = obj.on.response;
1782
Jian Li83d87a72016-04-20 15:38:24 -07001783 var requestInterceptor = function(data) {
1784 if(opts && opts.requestInterceptor) {
1785 data = opts.requestInterceptor.apply(data);
1786 }
1787 return data;
1788 };
1789
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001790 var responseInterceptor = function(data) {
1791 if(opts && opts.responseInterceptor) {
1792 data = opts.responseInterceptor.apply(data);
1793 }
Jian Li83d87a72016-04-20 15:38:24 -07001794 return success(data);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001795 };
1796
1797 obj.on.response = function(data) {
1798 responseInterceptor(data);
1799 };
1800
1801
Jian Li83d87a72016-04-20 15:38:24 -07001802 if (_.isObject(obj) && _.isObject(obj.body)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001803 // special processing for file uploads via jquery
1804 if (obj.body.type && obj.body.type === 'formData'){
1805 obj.contentType = false;
1806 obj.processData = false;
1807
1808 delete obj.headers['Content-Type'];
1809 } else {
1810 obj.body = JSON.stringify(obj.body);
1811 }
1812 }
Jian Li83d87a72016-04-20 15:38:24 -07001813
1814 client.execute(requestInterceptor(obj));
1815
1816 return (obj.deferred) ? obj.deferred.promise : obj;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001817};
1818
1819SwaggerHttp.prototype.isInternetExplorer = function () {
1820 var detectedIE = false;
1821
1822 if (typeof navigator !== 'undefined' && navigator.userAgent) {
1823 var nav = navigator.userAgent.toLowerCase();
1824
1825 if (nav.indexOf('msie') !== -1) {
1826 var version = parseInt(nav.split('msie')[1]);
1827
1828 if (version <= 8) {
1829 detectedIE = true;
1830 }
1831 }
1832 }
1833
1834 return detectedIE;
1835};
1836
1837JQueryHttpClient.prototype.execute = function (obj) {
Jian Li83d87a72016-04-20 15:38:24 -07001838 var jq = this.jQuery || window.jQuery;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001839 var cb = obj.on;
1840 var request = obj;
1841
1842 obj.type = obj.method;
1843 obj.cache = false;
1844 delete obj.useJQuery;
1845
1846 /*
1847 obj.beforeSend = function (xhr) {
1848 var key, results;
1849 if (obj.headers) {
1850 results = [];
1851 for (key in obj.headers) {
1852 if (key.toLowerCase() === 'content-type') {
1853 results.push(obj.contentType = obj.headers[key]);
1854 } else if (key.toLowerCase() === 'accept') {
1855 results.push(obj.accepts = obj.headers[key]);
1856 } else {
1857 results.push(xhr.setRequestHeader(key, obj.headers[key]));
1858 }
1859 }
1860 return results;
1861 }
1862 };*/
1863
1864 obj.data = obj.body;
1865
1866 delete obj.body;
1867
1868 obj.complete = function (response) {
1869 var headers = {};
1870 var headerArray = response.getAllResponseHeaders().split('\n');
1871
1872 for (var i = 0; i < headerArray.length; i++) {
1873 var toSplit = headerArray[i].trim();
1874
1875 if (toSplit.length === 0) {
1876 continue;
1877 }
1878
1879 var separator = toSplit.indexOf(':');
1880
1881 if (separator === -1) {
1882 // Name but no value in the header
1883 headers[toSplit] = null;
1884
1885 continue;
1886 }
1887
1888 var name = toSplit.substring(0, separator).trim();
1889 var value = toSplit.substring(separator + 1).trim();
1890
1891 headers[name] = value;
1892 }
1893
1894 var out = {
1895 url: request.url,
1896 method: request.method,
1897 status: response.status,
1898 statusText: response.statusText,
1899 data: response.responseText,
1900 headers: headers
1901 };
1902
1903 try {
1904 var possibleObj = response.responseJSON || jsyaml.safeLoad(response.responseText);
1905 out.obj = (typeof possibleObj === 'string') ? {} : possibleObj;
1906 } catch (ex) {
1907 // do not set out.obj
1908 helpers.log('unable to parse JSON/YAML content');
1909 }
1910
1911 // I can throw, or parse null?
1912 out.obj = out.obj || null;
1913
1914 if (response.status >= 200 && response.status < 300) {
1915 cb.response(out);
1916 } else if (response.status === 0 || (response.status >= 400 && response.status < 599)) {
1917 cb.error(out);
1918 } else {
1919 return cb.response(out);
1920 }
1921 };
1922
Jian Li83d87a72016-04-20 15:38:24 -07001923 jq.support.cors = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001924
Jian Li83d87a72016-04-20 15:38:24 -07001925 return jq.ajax(obj);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001926};
1927
1928SuperagentHttpClient.prototype.execute = function (obj) {
1929 var method = obj.method.toLowerCase();
1930
1931 if (method === 'delete') {
1932 method = 'del';
1933 }
1934 var headers = obj.headers || {};
1935 var r = request[method](obj.url);
1936 var name;
1937 for (name in headers) {
1938 r.set(name, headers[name]);
1939 }
1940
Jian Li83d87a72016-04-20 15:38:24 -07001941 if (obj.enableCookies) {
1942 r.withCredentials();
1943 }
1944
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001945 if (obj.body) {
1946 r.send(obj.body);
1947 }
1948
1949 if(typeof r.buffer === 'function') {
1950 r.buffer(); // force superagent to populate res.text with the raw response data
1951 }
1952
1953 r.end(function (err, res) {
1954 res = res || {
1955 status: 0,
1956 headers: {error: 'no response from server'}
1957 };
1958 var response = {
1959 url: obj.url,
1960 method: obj.method,
1961 headers: res.headers
1962 };
1963 var cb;
1964
1965 if (!err && res.error) {
1966 err = res.error;
1967 }
1968
1969 if (err && obj.on && obj.on.error) {
Jian Li83d87a72016-04-20 15:38:24 -07001970 response.errObj = err;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001971 response.status = res ? res.status : 500;
1972 response.statusText = res ? res.text : err.message;
Jian Li83d87a72016-04-20 15:38:24 -07001973 if(res.headers && res.headers['content-type']) {
1974 if(res.headers['content-type'].indexOf('application/json') >= 0) {
1975 try {
1976 response.obj = JSON.parse(response.statusText);
1977 }
1978 catch (e) {
1979 response.obj = null;
1980 }
1981 }
1982 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07001983 cb = obj.on.error;
1984 } else if (res && obj.on && obj.on.response) {
1985 var possibleObj;
1986
1987 // Already parsed by by superagent?
1988 if(res.body && Object.keys(res.body).length > 0) {
1989 possibleObj = res.body;
1990 } else {
1991 try {
1992 possibleObj = jsyaml.safeLoad(res.text);
1993 // can parse into a string... which we don't need running around in the system
1994 possibleObj = (typeof possibleObj === 'string') ? null : possibleObj;
1995 } catch(e) {
1996 helpers.log('cannot parse JSON/YAML content');
1997 }
1998 }
1999
2000 // null means we can't parse into object
Jian Li83d87a72016-04-20 15:38:24 -07002001 response.obj = (typeof possibleObj === 'object') ? possibleObj : null;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002002
2003 response.status = res.status;
2004 response.statusText = res.text;
2005 cb = obj.on.response;
2006 }
2007 response.data = response.statusText;
2008
2009 if (cb) {
2010 cb(response);
2011 }
2012 });
2013};
2014
Jian Li83d87a72016-04-20 15:38:24 -07002015},{"./helpers":4,"js-yaml":20,"lodash-compat/lang/isObject":148,"superagent":162}],6:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002016'use strict';
2017
2018var SwaggerHttp = require('./http');
Jian Li83d87a72016-04-20 15:38:24 -07002019var _ = {
2020 isObject: require('lodash-compat/lang/isObject'),
2021 cloneDeep: require('lodash-compat/lang/cloneDeep'),
2022 isArray: require('lodash-compat/lang/isArray')
2023};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002024
Jian Li83d87a72016-04-20 15:38:24 -07002025
2026/**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002027 * Resolves a spec's remote references
2028 */
2029var Resolver = module.exports = function () {};
2030
Jian Li83d87a72016-04-20 15:38:24 -07002031Resolver.prototype.processAllOf = function(root, name, definition, resolutionTable, unresolvedRefs, spec) {
2032 var i, location, property;
2033
2034 definition['x-resolved-from'] = [ '#/definitions/' + name ];
2035 var allOf = definition.allOf;
2036 // the refs go first
2037 allOf.sort(function(a, b) {
2038 if(a.$ref && b.$ref) { return 0; }
2039 else if(a.$ref) { return -1; }
2040 else { return 1; }
2041 });
2042 for (i = 0; i < allOf.length; i++) {
2043 property = allOf[i];
2044 location = '/definitions/' + name + '/allOf';
2045 this.resolveInline(root, spec, property, resolutionTable, unresolvedRefs, location);
2046 }
2047};
2048
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002049Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
Jian Li83d87a72016-04-20 15:38:24 -07002050 this.spec = spec;
2051 var root = arg1, callback = arg2, scope = arg3, opts = {}, location, i;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002052 if(typeof arg1 === 'function') {
2053 root = null;
2054 callback = arg1;
2055 scope = arg2;
2056 }
2057 var _root = root;
2058 this.scope = (scope || this);
2059 this.iteration = this.iteration || 0;
2060
Jian Li83d87a72016-04-20 15:38:24 -07002061 if(this.scope.options && this.scope.options.requestInterceptor){
2062 opts.requestInterceptor = this.scope.options.requestInterceptor;
2063 }
2064
2065 if(this.scope.options && this.scope.options.responseInterceptor){
2066 opts.responseInterceptor = this.scope.options.responseInterceptor;
2067 }
2068
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002069 var name, path, property, propertyName;
2070 var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {};
2071 var resolutionTable = []; // store objects for dereferencing
2072
Jian Li83d87a72016-04-20 15:38:24 -07002073 spec.definitions = spec.definitions || {};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002074 // definitions
2075 for (name in spec.definitions) {
2076 var definition = spec.definitions[name];
2077 for (propertyName in definition.properties) {
2078 property = definition.properties[propertyName];
Jian Li83d87a72016-04-20 15:38:24 -07002079 if(_.isArray(property.allOf)) {
2080 this.processAllOf(root, name, property, resolutionTable, unresolvedRefs, spec);
2081 }
2082 else {
2083 this.resolveTo(root, property, resolutionTable, '/definitions');
2084 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002085 }
2086
2087 if(definition.allOf) {
Jian Li83d87a72016-04-20 15:38:24 -07002088 this.processAllOf(root, name, definition, resolutionTable, unresolvedRefs, spec);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002089 }
2090 }
2091
2092 // operations
2093 for (name in spec.paths) {
2094 var method, operation, responseCode;
2095 path = spec.paths[name];
2096
2097 for (method in path) {
2098 // operation reference
2099 if(method === '$ref') {
2100 // location = path[method];
2101 location = '/paths' + name;
2102 this.resolveInline(root, spec, path, resolutionTable, unresolvedRefs, location);
2103 }
2104 else {
2105 operation = path[method];
Jian Li83d87a72016-04-20 15:38:24 -07002106 var sharedParameters = path.parameters || [];
2107 var parameters = operation.parameters || [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002108
Jian Li83d87a72016-04-20 15:38:24 -07002109 for (i in sharedParameters) {
2110 var parameter = sharedParameters[i];
2111 parameters.unshift(parameter);
2112 }
2113 if(method !== 'parameters' && _.isObject(operation)) {
2114 operation.parameters = operation.parameters || parameters;
2115 }
2116
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002117 for (i in parameters) {
2118 var parameter = parameters[i];
2119 location = '/paths' + name + '/' + method + '/parameters';
2120
2121 if (parameter.in === 'body' && parameter.schema) {
Jian Li83d87a72016-04-20 15:38:24 -07002122 if(_.isArray(parameter.schema.allOf)) {
2123 // move to a definition
2124 var modelName = 'inline_model';
2125 var name = modelName;
2126 var done = false; var counter = 0;
2127 while(!done) {
2128 if(typeof spec.definitions[name] === 'undefined') {
2129 done = true;
2130 break;
2131 }
2132 name = modelName + '_' + counter;
2133 counter ++;
2134 }
2135 spec.definitions[name] = { allOf: parameter.schema.allOf };
2136 delete parameter.schema.allOf;
2137 parameter.schema.$ref = '#/definitions/' + name;
2138 this.processAllOf(root, name, spec.definitions[name], resolutionTable, unresolvedRefs, spec);
2139 }
2140 else {
2141 this.resolveTo(root, parameter.schema, resolutionTable, location);
2142 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002143 }
2144
2145 if (parameter.$ref) {
2146 // parameter reference
2147 this.resolveInline(root, spec, parameter, resolutionTable, unresolvedRefs, parameter.$ref);
2148 }
2149 }
2150
2151 for (responseCode in operation.responses) {
2152 var response = operation.responses[responseCode];
2153 location = '/paths' + name + '/' + method + '/responses/' + responseCode;
2154
Jian Li83d87a72016-04-20 15:38:24 -07002155 if(_.isObject(response)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002156 if(response.$ref) {
2157 // response reference
2158 this.resolveInline(root, spec, response, resolutionTable, unresolvedRefs, location);
2159 }
2160 if (response.schema) {
2161 this.resolveTo(root, response.schema, resolutionTable, location);
2162 }
2163 }
2164 }
2165 }
2166 }
Jian Li83d87a72016-04-20 15:38:24 -07002167 // clear them out to avoid multiple resolutions
2168 path.parameters = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002169 }
2170
2171 var expectedCalls = 0, toResolve = [];
2172 // if the root is same as obj[i].root we can resolve locally
2173 var all = resolutionTable;
2174
Jian Li83d87a72016-04-20 15:38:24 -07002175 var parts;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002176 for(i = 0; i < all.length; i++) {
2177 var a = all[i];
2178 if(root === a.root) {
2179 if(a.resolveAs === 'ref') {
2180 // resolve any path walking
2181 var joined = ((a.root || '') + '/' + a.key).split('/');
2182 var normalized = [];
2183 var url = '';
2184 var k;
2185
2186 if(a.key.indexOf('../') >= 0) {
2187 for(var j = 0; j < joined.length; j++) {
2188 if(joined[j] === '..') {
2189 normalized = normalized.slice(0, normalized.length-1);
2190 }
2191 else {
2192 normalized.push(joined[j]);
2193 }
2194 }
2195 for(k = 0; k < normalized.length; k ++) {
2196 if(k > 0) {
2197 url += '/';
2198 }
2199 url += normalized[k];
2200 }
2201 // we now have to remote resolve this because the path has changed
2202 a.root = url;
2203 toResolve.push(a);
2204 }
2205 else {
Jian Li83d87a72016-04-20 15:38:24 -07002206 parts = a.key.split('#');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002207 if(parts.length === 2) {
2208 if(parts[0].indexOf('http://') === 0 || parts[0].indexOf('https://') === 0) {
2209 a.root = parts[0];
2210 }
2211 location = parts[1].split('/');
2212 var r;
2213 var s = spec;
2214 for(k = 0; k < location.length; k++) {
2215 var part = location[k];
2216 if(part !== '') {
2217 s = s[part];
2218 if(typeof s !== 'undefined') {
2219 r = s;
2220 }
2221 else {
2222 r = null;
2223 break;
2224 }
2225 }
2226 }
2227 if(r === null) {
2228 // must resolve this too
2229 toResolve.push(a);
2230 }
2231 }
2232 }
2233 }
2234 else {
2235 if (a.resolveAs === 'inline') {
Jian Li83d87a72016-04-20 15:38:24 -07002236 if(a.key && a.key.indexOf('#') === -1 && a.key.charAt(0) !== '/') {
2237 // handle relative schema
2238 parts = a.root.split('/');
2239 location = '';
2240 for(i = 0; i < parts.length - 1; i++) {
2241 location += parts[i] + '/';
2242 }
2243 location += a.key;
2244 a.root = location;
2245 a.location = '';
2246 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002247 toResolve.push(a);
2248 }
2249 }
2250 }
2251 else {
2252 toResolve.push(a);
2253 }
2254 }
2255 expectedCalls = toResolve.length;
2256
2257 // resolve anything that is local
2258 for(var ii = 0; ii < toResolve.length; ii++) {
Jian Li83d87a72016-04-20 15:38:24 -07002259 (function(item, spec, self) {
2260 if(item.root === null || item.root === root) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002261 // local resolve
2262 self.resolveItem(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, item);
2263 processedCalls += 1;
2264
2265 if(processedCalls === expectedCalls) {
Jian Li83d87a72016-04-20 15:38:24 -07002266 self.finish(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback, true);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002267 }
2268 }
2269 else {
2270 var obj = {
2271 useJQuery: false, // TODO
2272 url: item.root,
2273 method: 'get',
2274 headers: {
2275 accept: self.scope.swaggerRequestHeaders || 'application/json'
2276 },
2277 on: {
Jian Li83d87a72016-04-20 15:38:24 -07002278 error: function (error) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002279 processedCalls += 1;
Jian Li83d87a72016-04-20 15:38:24 -07002280 unresolvedRefs[item.key] = {
2281 root: item.root,
2282 location: item.location
2283 };
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002284
2285 if (processedCalls === expectedCalls) {
2286 self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2287 }
2288 }, // jshint ignore:line
2289 response: function (response) {
2290 var swagger = response.obj;
Jian Li83d87a72016-04-20 15:38:24 -07002291 self.resolveItem(swagger, item.root, resolutionTable, resolvedRefs, unresolvedRefs, item);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002292 processedCalls += 1;
2293
2294 if (processedCalls === expectedCalls) {
2295 self.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2296 }
2297 }
2298 } // jshint ignore:line
2299 };
2300
2301 if (scope && scope.clientAuthorizations) {
2302 scope.clientAuthorizations.apply(obj);
2303 }
Jian Li83d87a72016-04-20 15:38:24 -07002304
2305 new SwaggerHttp().execute(obj, opts);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002306 }
Jian Li83d87a72016-04-20 15:38:24 -07002307 }(toResolve[ii], spec, this));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002308 }
2309
2310 if (Object.keys(toResolve).length === 0) {
2311 this.finish(spec, _root, resolutionTable, resolvedRefs, unresolvedRefs, callback);
2312 }
2313};
2314
2315Resolver.prototype.resolveItem = function(spec, root, resolutionTable, resolvedRefs, unresolvedRefs, item) {
2316 var path = item.location;
2317 var location = spec, parts = path.split('/');
Jian Li83d87a72016-04-20 15:38:24 -07002318 if(path !== '') {
2319 for (var j = 0; j < parts.length; j++) {
2320 var segment = parts[j];
2321 if (segment.indexOf('~1') !== -1) {
2322 segment = parts[j].replace(/~0/g, '~').replace(/~1/g, '/');
2323 if (segment.charAt(0) !== '/') {
2324 segment = '/' + segment;
2325 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002326 }
Jian Li83d87a72016-04-20 15:38:24 -07002327 if (typeof location === 'undefined' || location === null) {
2328 break;
2329 }
2330 if (segment === '' && j === (parts.length - 1) && parts.length > 1) {
2331 location = null;
2332 break;
2333 }
2334 if (segment.length > 0) {
2335 location = location[segment];
2336 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002337 }
2338 }
2339 var resolved = item.key;
2340 parts = item.key.split('/');
2341 var resolvedName = parts[parts.length-1];
2342
2343 if(resolvedName.indexOf('#') >= 0) {
2344 resolvedName = resolvedName.split('#')[1];
2345 }
2346
2347 if (location !== null && typeof location !== 'undefined') {
2348 resolvedRefs[resolved] = {
2349 name: resolvedName,
2350 obj: location,
2351 key: item.key,
2352 root: item.root
2353 };
2354 } else {
2355 unresolvedRefs[resolved] = {
2356 root: item.root,
2357 location: item.location
2358 };
2359 }
2360};
2361
Jian Li83d87a72016-04-20 15:38:24 -07002362Resolver.prototype.finish = function (spec, root, resolutionTable, resolvedRefs, unresolvedRefs, callback, localResolve) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002363 // walk resolution table and replace with resolved refs
2364 var ref;
2365 for (ref in resolutionTable) {
2366 var item = resolutionTable[ref];
2367
2368 var key = item.key;
2369 var resolvedTo = resolvedRefs[key];
2370 if (resolvedTo) {
2371 spec.definitions = spec.definitions || {};
2372 if (item.resolveAs === 'ref') {
Jian Li83d87a72016-04-20 15:38:24 -07002373 if (localResolve !== true) {
2374 // don't retain root for local definitions
2375 for (key in resolvedTo.obj) {
2376 var abs = this.retainRoot(resolvedTo.obj[key], item.root);
2377 }
2378 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002379 spec.definitions[resolvedTo.name] = resolvedTo.obj;
2380 item.obj.$ref = '#/definitions/' + resolvedTo.name;
2381 } else if (item.resolveAs === 'inline') {
2382 var targetObj = item.obj;
2383 targetObj['x-resolved-from'] = [ item.key ];
2384 delete targetObj.$ref;
2385
2386 for (key in resolvedTo.obj) {
Jian Li83d87a72016-04-20 15:38:24 -07002387 var abs = resolvedTo.obj[key];
2388
2389 if (localResolve !== true) {
2390 // don't retain root for local definitions
2391 abs = this.retainRoot(resolvedTo.obj[key], item.root);
2392 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002393 targetObj[key] = abs;
2394 }
2395 }
2396 }
2397 }
2398 var existingUnresolved = this.countUnresolvedRefs(spec);
2399
Jian Li83d87a72016-04-20 15:38:24 -07002400 if(existingUnresolved === 0 || this.iteration > 5) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002401 this.resolveAllOf(spec.definitions);
2402 callback.call(this.scope, spec, unresolvedRefs);
2403 }
2404 else {
2405 this.iteration += 1;
2406 this.resolve(spec, root, callback, this.scope);
2407 }
2408};
2409
2410Resolver.prototype.countUnresolvedRefs = function(spec) {
2411 var i;
2412 var refs = this.getRefs(spec);
2413 var keys = [];
2414 var unresolvedKeys = [];
2415 for(i in refs) {
2416 if(i.indexOf('#') === 0) {
2417 keys.push(i.substring(1));
2418 }
2419 else {
2420 unresolvedKeys.push(i);
2421 }
2422 }
2423
2424 // verify possible keys
Jian Li83d87a72016-04-20 15:38:24 -07002425 for (i = 0; i < keys.length; i++) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002426 var part = keys[i];
2427 var parts = part.split('/');
2428 var obj = spec;
2429
Jian Li83d87a72016-04-20 15:38:24 -07002430 for (var k = 0; k < parts.length; k++) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002431 var key = parts[k];
2432 if(key !== '') {
2433 obj = obj[key];
2434 if(typeof obj === 'undefined') {
2435 unresolvedKeys.push(part);
2436 break;
2437 }
2438 }
2439 }
2440 }
2441 return unresolvedKeys.length;
2442};
2443
2444Resolver.prototype.getRefs = function(spec, obj) {
2445 obj = obj || spec;
2446 var output = {};
2447 for(var key in obj) {
Jian Li83d87a72016-04-20 15:38:24 -07002448 if (!obj.hasOwnProperty(key)) {
2449 continue;
2450 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002451 var item = obj[key];
2452 if(key === '$ref' && typeof item === 'string') {
2453 output[item] = null;
2454 }
Jian Li83d87a72016-04-20 15:38:24 -07002455 else if(_.isObject(item)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002456 var o = this.getRefs(item);
2457 for(var k in o) {
2458 output[k] = null;
2459 }
2460 }
2461 }
2462 return output;
2463};
2464
2465Resolver.prototype.retainRoot = function(obj, root) {
2466 // walk object and look for relative $refs
2467 for(var key in obj) {
2468 var item = obj[key];
2469 if(key === '$ref' && typeof item === 'string') {
2470 // stop and inspect
2471 if(item.indexOf('http://') !== 0 && item.indexOf('https://') !== 0) {
2472 if(item.indexOf('#') !== 0) {
2473 item = '#' + item;
2474 }
2475 item = (root || '') + item;
2476 obj[key] = item;
2477 }
2478 }
Jian Li83d87a72016-04-20 15:38:24 -07002479 else if(_.isObject(item)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002480 this.retainRoot(item, root);
2481 }
2482 }
2483 return obj;
2484};
2485
2486/**
2487 * immediately in-lines local refs, queues remote refs
2488 * for inline resolution
2489 */
2490Resolver.prototype.resolveInline = function (root, spec, property, resolutionTable, unresolvedRefs, location) {
2491 var key = property.$ref, ref = property.$ref, i, p, p2, rs;
2492 var rootTrimmed = false;
2493 if (ref) {
2494 if(ref.indexOf('../') === 0) {
2495 // reset root
2496 p = ref.split('../');
2497 p2 = root.split('/');
2498 ref = '';
2499 for(i = 0; i < p.length; i++) {
2500 if(p[i] === '') {
2501 p2 = p2.slice(0, p2.length-1);
2502 }
2503 else {
2504 ref += p[i];
2505 }
2506 }
2507 root = '';
2508 for(i = 0; i < p2.length - 1; i++) {
2509 if(i > 0) { root += '/'; }
2510 root += p2[i];
2511 }
2512 rootTrimmed = true;
2513 }
2514 if(ref.indexOf('#') >= 0) {
2515 if(ref.indexOf('/') === 0) {
2516 rs = ref.split('#');
2517 p = root.split('//');
2518 p2 = p[1].split('/');
2519 root = p[0] + '//' + p2[0] + rs[0];
2520 location = rs[1];
2521 }
2522 else {
2523 rs = ref.split('#');
2524 if(rs[0] !== '') {
2525 p2 = root.split('/');
2526 p2 = p2.slice(0, p2.length - 1);
2527 if(!rootTrimmed) {
2528 root = '';
2529 for (var k = 0; k < p2.length; k++) {
2530 if(k > 0) { root += '/'; }
2531 root += p2[k];
2532 }
2533 }
2534 root += '/' + ref.split('#')[0];
2535 }
2536 location = rs[1];
2537 }
2538 }
2539 if (ref.indexOf('http') === 0) {
2540 if(ref.indexOf('#') >= 0) {
2541 root = ref.split('#')[0];
2542 location = ref.split('#')[1];
2543 }
2544 else {
2545 root = ref;
2546 location = '';
2547 }
2548 resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2549 } else if (ref.indexOf('#') === 0) {
2550 location = ref.split('#')[1];
2551 resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2552 }
2553 else {
2554 resolutionTable.push({obj: property, resolveAs: 'inline', root: root, key: key, location: location});
2555 }
Jian Li83d87a72016-04-20 15:38:24 -07002556 }
2557 else if (property.type === 'array') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002558 this.resolveTo(root, property.items, resolutionTable, location);
2559 }
2560};
2561
2562Resolver.prototype.resolveTo = function (root, property, resolutionTable, location) {
Jian Li83d87a72016-04-20 15:38:24 -07002563 var sp, i;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002564 var ref = property.$ref;
Jian Li83d87a72016-04-20 15:38:24 -07002565 var lroot = root;
2566 if (typeof ref !== 'undefined') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002567 if(ref.indexOf('#') >= 0) {
Jian Li83d87a72016-04-20 15:38:24 -07002568 var parts = ref.split('#');
2569
2570 // #/definitions/foo
2571 // foo.json#/bar
2572 if(parts[0] && ref.indexOf('/') === 0) {
2573
2574 }
2575 else if(parts[0] && parts[0].indexOf('http') === 0) {
2576 lroot = parts[0];
2577 ref = parts[1];
2578 }
2579 else if(parts[0] && parts[0].length > 0) {
2580 // relative file
2581 sp = root.split('/');
2582 lroot = '';
2583 for(i = 0; i < sp.length - 1; i++) {
2584 lroot += sp[i] + '/';
2585 }
2586 lroot += parts[0];
2587 }
2588 else {
2589
2590 }
2591
2592 location = parts[1];
2593 }
2594 else if (ref.indexOf('http://') === 0 || ref.indexOf('https://') === 0) {
2595 lroot = ref;
2596 location = '';
2597 }
2598 else {
2599 // relative file
2600 sp = root.split('/');
2601 lroot = '';
2602 for(i = 0; i < sp.length - 1; i++) {
2603 lroot += sp[i] + '/';
2604 }
2605 lroot += ref;
2606 location = '';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002607 }
2608 resolutionTable.push({
Jian Li83d87a72016-04-20 15:38:24 -07002609 obj: property, resolveAs: 'ref', root: lroot, key: ref, location: location
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002610 });
2611 } else if (property.type === 'array') {
2612 var items = property.items;
2613 this.resolveTo(root, items, resolutionTable, location);
Jian Li83d87a72016-04-20 15:38:24 -07002614 } else {
2615 if(property && property.properties) {
2616 var name = this.uniqueName('inline_model');
2617 this.spec.definitions[name] = _.cloneDeep(property);
2618 property['$ref'] = '#/definitions/' + name;
2619 delete property.type;
2620 delete property.properties;
2621 }
2622 }
2623};
2624
2625Resolver.prototype.uniqueName = function(base) {
2626 var name = base;
2627 var count = 0;
2628 while(true) {
2629 if(!_.isObject(this.spec.definitions[name])) {
2630 return name;
2631 }
2632 name = base + '_' + count;
2633 count++;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002634 }
2635};
2636
2637Resolver.prototype.resolveAllOf = function(spec, obj, depth) {
2638 depth = depth || 0;
2639 obj = obj || spec;
2640 var name;
2641 for(var key in obj) {
Jian Li83d87a72016-04-20 15:38:24 -07002642 if (!obj.hasOwnProperty(key)) {
2643 continue;
2644 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002645 var item = obj[key];
Jian Li83d87a72016-04-20 15:38:24 -07002646 if(item === null) {
2647 throw new TypeError('Swagger 2.0 does not support null types (' + obj + '). See https://github.com/swagger-api/swagger-spec/issues/229.');
2648 }
2649 if(typeof item === 'object') {
2650 this.resolveAllOf(spec, item, depth + 1);
2651 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002652 if(item && typeof item.allOf !== 'undefined') {
2653 var allOf = item.allOf;
Jian Li83d87a72016-04-20 15:38:24 -07002654 if(_.isArray(allOf)) {
2655 var output = _.cloneDeep(item);
2656 delete output.allOf;
2657
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002658 output['x-composed'] = true;
Jian Li83d87a72016-04-20 15:38:24 -07002659 if (typeof item['x-resolved-from'] !== 'undefined') {
2660 output['x-resolved-from'] = item['x-resolved-from'];
2661 }
2662
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002663 for(var i = 0; i < allOf.length; i++) {
2664 var component = allOf[i];
2665 var source = 'self';
2666 if(typeof component['x-resolved-from'] !== 'undefined') {
2667 source = component['x-resolved-from'][0];
2668 }
2669
2670 for(var part in component) {
2671 if(!output.hasOwnProperty(part)) {
Jian Li83d87a72016-04-20 15:38:24 -07002672 output[part] = _.cloneDeep(component[part]);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002673 if(part === 'properties') {
2674 for(name in output[part]) {
2675 output[part][name]['x-resolved-from'] = source;
2676 }
2677 }
2678 }
2679 else {
2680 if(part === 'properties') {
2681 var properties = component[part];
2682 for(name in properties) {
Jian Li83d87a72016-04-20 15:38:24 -07002683 output.properties[name] = _.cloneDeep(properties[name]);
2684 var resolvedFrom = properties[name]['x-resolved-from'];
2685 if (typeof resolvedFrom === 'undefined' || resolvedFrom === 'self') {
2686 resolvedFrom = source;
2687 }
2688 output.properties[name]['x-resolved-from'] = resolvedFrom;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002689 }
2690 }
2691 else if(part === 'required') {
2692 // merge & dedup the required array
2693 var a = output.required.concat(component[part]);
2694 for(var k = 0; k < a.length; ++k) {
2695 for(var j = k + 1; j < a.length; ++j) {
2696 if(a[k] === a[j]) { a.splice(j--, 1); }
2697 }
2698 }
2699 output.required = a;
2700 }
2701 else if(part === 'x-resolved-from') {
2702 output['x-resolved-from'].push(source);
2703 }
2704 else {
2705 // TODO: need to merge this property
2706 // console.log('what to do with ' + part)
2707 }
2708 }
2709 }
2710 }
2711 obj[key] = output;
2712 }
2713 }
Jian Li83d87a72016-04-20 15:38:24 -07002714 if(_.isObject(item)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07002715 this.resolveAllOf(spec, item, depth + 1);
2716 }
2717 }
2718};
2719
Jian Li83d87a72016-04-20 15:38:24 -07002720},{"./http":5,"lodash-compat/lang/cloneDeep":142,"lodash-compat/lang/isArray":144,"lodash-compat/lang/isObject":148}],7:[function(require,module,exports){
2721'use strict';
2722
2723var Helpers = require('./helpers');
2724
2725var _ = {
2726 isPlainObject: require('lodash-compat/lang/isPlainObject'),
2727 isUndefined: require('lodash-compat/lang/isUndefined'),
2728 isArray: require('lodash-compat/lang/isArray'),
2729 isObject: require('lodash-compat/lang/isObject'),
2730 isEmpty: require('lodash-compat/lang/isEmpty'),
2731 map: require('lodash-compat/collection/map'),
2732 indexOf: require('lodash-compat/array/indexOf'),
2733 cloneDeep: require('lodash-compat/lang/cloneDeep'),
2734 keys: require('lodash-compat/object/keys'),
2735 forEach: require('lodash-compat/collection/forEach')
2736};
2737
2738module.exports.optionHtml = optionHtml;
2739module.exports.typeFromJsonSchema = typeFromJsonSchema;
2740module.exports.getStringSignature = getStringSignature;
2741module.exports.schemaToHTML = schemaToHTML;
2742module.exports.schemaToJSON = schemaToJSON;
2743
2744function optionHtml(label, value) {
2745 return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
2746}
2747
2748function typeFromJsonSchema(type, format) {
2749 var str;
2750
2751 if (type === 'integer' && format === 'int32') {
2752 str = 'integer';
2753 } else if (type === 'integer' && format === 'int64') {
2754 str = 'long';
2755 } else if (type === 'integer' && typeof format === 'undefined') {
2756 str = 'long';
2757 } else if (type === 'string' && format === 'date-time') {
2758 str = 'date-time';
2759 } else if (type === 'string' && format === 'date') {
2760 str = 'date';
2761 } else if (type === 'number' && format === 'float') {
2762 str = 'float';
2763 } else if (type === 'number' && format === 'double') {
2764 str = 'double';
2765 } else if (type === 'number' && typeof format === 'undefined') {
2766 str = 'double';
2767 } else if (type === 'boolean') {
2768 str = 'boolean';
2769 } else if (type === 'string') {
2770 str = 'string';
2771 }
2772
2773 return str;
2774}
2775
2776function getStringSignature(obj, baseComponent) {
2777 var str = '';
2778
2779 if (typeof obj.$ref !== 'undefined') {
2780 str += Helpers.simpleRef(obj.$ref);
2781 } else if (typeof obj.type === 'undefined') {
2782 str += 'object';
2783 } else if (obj.type === 'array') {
2784 if (baseComponent) {
2785 str += getStringSignature((obj.items || obj.$ref || {}));
2786 } else {
2787 str += 'Array[';
2788 str += getStringSignature((obj.items || obj.$ref || {}));
2789 str += ']';
2790 }
2791 } else if (obj.type === 'integer' && obj.format === 'int32') {
2792 str += 'integer';
2793 } else if (obj.type === 'integer' && obj.format === 'int64') {
2794 str += 'long';
2795 } else if (obj.type === 'integer' && typeof obj.format === 'undefined') {
2796 str += 'long';
2797 } else if (obj.type === 'string' && obj.format === 'date-time') {
2798 str += 'date-time';
2799 } else if (obj.type === 'string' && obj.format === 'date') {
2800 str += 'date';
2801 } else if (obj.type === 'string' && typeof obj.format === 'undefined') {
2802 str += 'string';
2803 } else if (obj.type === 'number' && obj.format === 'float') {
2804 str += 'float';
2805 } else if (obj.type === 'number' && obj.format === 'double') {
2806 str += 'double';
2807 } else if (obj.type === 'number' && typeof obj.format === 'undefined') {
2808 str += 'double';
2809 } else if (obj.type === 'boolean') {
2810 str += 'boolean';
2811 } else if (obj.$ref) {
2812 str += Helpers.simpleRef(obj.$ref);
2813 } else {
2814 str += obj.type;
2815 }
2816
2817 return str;
2818}
2819
2820function schemaToJSON(schema, models, modelsToIgnore, modelPropertyMacro) {
2821 // Resolve the schema (Handle nested schemas)
2822 schema = Helpers.resolveSchema(schema);
2823
2824 if(typeof modelPropertyMacro !== 'function') {
2825 modelPropertyMacro = function(prop){
2826 return (prop || {}).default;
2827 };
2828 }
2829
2830 modelsToIgnore= modelsToIgnore || {};
2831
2832 var type = schema.type || 'object';
2833 var format = schema.format;
2834 var model;
2835 var output;
2836
2837 if (!_.isUndefined(schema.example)) {
2838 output = schema.example;
2839 } else if (_.isUndefined(schema.items) && _.isArray(schema.enum)) {
2840 output = schema.enum[0];
2841 }
2842
2843 if (_.isUndefined(output)) {
2844 if (schema.$ref) {
2845 model = models[Helpers.simpleRef(schema.$ref)];
2846
2847 if (!_.isUndefined(model)) {
2848 if (_.isUndefined(modelsToIgnore[model.name])) {
2849 modelsToIgnore[model.name] = model;
2850 output = schemaToJSON(model.definition, models, modelsToIgnore, modelPropertyMacro);
2851 delete modelsToIgnore[model.name];
2852 } else {
2853 if (model.type === 'array') {
2854 output = [];
2855 } else {
2856 output = {};
2857 }
2858 }
2859 }
2860 } else if (!_.isUndefined(schema.default)) {
2861 output = schema.default;
2862 } else if (type === 'string') {
2863 if (format === 'date-time') {
2864 output = new Date().toISOString();
2865 } else if (format === 'date') {
2866 output = new Date().toISOString().split('T')[0];
2867 } else {
2868 output = 'string';
2869 }
2870 } else if (type === 'integer') {
2871 output = 0;
2872 } else if (type === 'number') {
2873 output = 0.0;
2874 } else if (type === 'boolean') {
2875 output = true;
2876 } else if (type === 'object') {
2877 output = {};
2878
2879 _.forEach(schema.properties, function (property, name) {
2880 var cProperty = _.cloneDeep(property);
2881
2882 // Allow macro to set the default value
2883 cProperty.default = modelPropertyMacro(property);
2884
2885 output[name] = schemaToJSON(cProperty, models, modelsToIgnore, modelPropertyMacro);
2886 });
2887 } else if (type === 'array') {
2888 output = [];
2889
2890 if (_.isArray(schema.items)) {
2891 _.forEach(schema.items, function (item) {
2892 output.push(schemaToJSON(item, models, modelsToIgnore, modelPropertyMacro));
2893 });
2894 } else if (_.isPlainObject(schema.items)) {
2895 output.push(schemaToJSON(schema.items, models, modelsToIgnore, modelPropertyMacro));
2896 } else if (_.isUndefined(schema.items)) {
2897 output.push({});
2898 } else {
2899 Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
2900 }
2901 }
2902 }
2903
2904 return output;
2905}
2906
2907function schemaToHTML(name, schema, models, modelPropertyMacro) {
2908
2909 var strongOpen = '<span class="strong">';
2910 var strongClose = '</span>';
2911
2912 // Allow for ignoring the 'name' argument.... shifting the rest
2913 if(_.isObject(arguments[0])) {
2914 name = void 0;
2915 schema = arguments[0];
2916 models = arguments[1];
2917 modelPropertyMacro = arguments[2];
2918 }
2919
2920 models = models || {};
2921
2922 // Resolve the schema (Handle nested schemas)
2923 schema = Helpers.resolveSchema(schema);
2924
2925 // Return for empty object
2926 if(_.isEmpty(schema)) {
2927 return strongOpen + 'Empty' + strongClose;
2928 }
2929
2930 // Dereference $ref from 'models'
2931 if(typeof schema.$ref === 'string') {
2932 name = Helpers.simpleRef(schema.$ref);
2933 schema = models[name];
2934 if(typeof schema === 'undefined')
2935 {
2936 return strongOpen + name + ' is not defined!' + strongClose;
2937 }
2938 }
2939
2940 if(typeof name !== 'string') {
2941 name = schema.title || 'Inline Model';
2942 }
2943
2944 // If we are a Model object... adjust accordingly
2945 if(schema.definition) {
2946 schema = schema.definition;
2947 }
2948
2949 if(typeof modelPropertyMacro !== 'function') {
2950 modelPropertyMacro = function(prop){
2951 return (prop || {}).default;
2952 };
2953 }
2954
2955 var references = {};
2956 var seenModels = [];
2957 var inlineModels = 0;
2958
2959
2960
2961 // Generate current HTML
2962 var html = processModel(schema, name);
2963
2964 // Generate references HTML
2965 while (_.keys(references).length > 0) {
2966 /* jshint ignore:start */
2967 _.forEach(references, function (schema, name) {
2968 var seenModel = _.indexOf(seenModels, name) > -1;
2969
2970 delete references[name];
2971
2972 if (!seenModel) {
2973 seenModels.push(name);
2974
2975 html += '<br />' + processModel(schema, name);
2976 }
2977 });
2978 /* jshint ignore:end */
2979 }
2980
2981 return html;
2982
2983 /////////////////////////////////
2984
2985 function addReference(schema, name, skipRef) {
2986 var modelName = name;
2987 var model;
2988
2989 if (schema.$ref) {
2990 modelName = schema.title || Helpers.simpleRef(schema.$ref);
Andrea Campanellac99d4302016-04-21 14:04:26 -07002991 model = models[Helpers.simpleRef(schema.$ref)];
Jian Li83d87a72016-04-20 15:38:24 -07002992 } else if (_.isUndefined(name)) {
2993 modelName = schema.title || 'Inline Model ' + (++inlineModels);
2994 model = {definition: schema};
2995 }
2996
2997 if (skipRef !== true) {
2998 references[modelName] = _.isUndefined(model) ? {} : model.definition;
2999 }
3000
3001 return modelName;
3002 }
3003
3004 function primitiveToHTML(schema) {
3005 var html = '<span class="propType">';
3006 var type = schema.type || 'object';
3007
3008 if (schema.$ref) {
3009 html += addReference(schema, Helpers.simpleRef(schema.$ref));
3010 } else if (type === 'object') {
3011 if (!_.isUndefined(schema.properties)) {
3012 html += addReference(schema);
3013 } else {
3014 html += 'object';
3015 }
3016 } else if (type === 'array') {
3017 html += 'Array[';
3018
3019 if (_.isArray(schema.items)) {
3020 html += _.map(schema.items, addReference).join(',');
3021 } else if (_.isPlainObject(schema.items)) {
3022 if (_.isUndefined(schema.items.$ref)) {
3023 if (!_.isUndefined(schema.items.type) && _.indexOf(['array', 'object'], schema.items.type) === -1) {
3024 html += schema.items.type;
3025 } else {
3026 html += addReference(schema.items);
3027 }
3028 } else {
3029 html += addReference(schema.items, Helpers.simpleRef(schema.items.$ref));
3030 }
3031 } else {
3032 Helpers.log('Array type\'s \'items\' schema is not an array or an object, cannot process');
3033 html += 'object';
3034 }
3035
3036 html += ']';
3037 } else {
3038 html += schema.type;
3039 }
3040
3041 html += '</span>';
3042
3043 return html;
3044 }
3045
3046 function primitiveToOptionsHTML(schema, html) {
3047 var options = '';
3048 var type = schema.type || 'object';
3049 var isArray = type === 'array';
3050
3051 if (isArray) {
3052 if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) {
3053 type = schema.items.type;
3054 } else {
3055 type = 'object';
3056 }
3057 }
3058
3059 if (!_.isUndefined(schema.default)) {
3060 options += optionHtml('Default', schema.default);
3061 }
3062
3063 switch (type) {
3064 case 'string':
3065 if (schema.minLength) {
3066 options += optionHtml('Min. Length', schema.minLength);
3067 }
3068
3069 if (schema.maxLength) {
3070 options += optionHtml('Max. Length', schema.maxLength);
3071 }
3072
3073 if (schema.pattern) {
3074 options += optionHtml('Reg. Exp.', schema.pattern);
3075 }
3076 break;
3077 case 'integer':
3078 case 'number':
3079 if (schema.minimum) {
3080 options += optionHtml('Min. Value', schema.minimum);
3081 }
3082
3083 if (schema.exclusiveMinimum) {
3084 options += optionHtml('Exclusive Min.', 'true');
3085 }
3086
3087 if (schema.maximum) {
3088 options += optionHtml('Max. Value', schema.maximum);
3089 }
3090
3091 if (schema.exclusiveMaximum) {
3092 options += optionHtml('Exclusive Max.', 'true');
3093 }
3094
3095 if (schema.multipleOf) {
3096 options += optionHtml('Multiple Of', schema.multipleOf);
3097 }
3098
3099 break;
3100 }
3101
3102 if (isArray) {
3103 if (schema.minItems) {
3104 options += optionHtml('Min. Items', schema.minItems);
3105 }
3106
3107 if (schema.maxItems) {
3108 options += optionHtml('Max. Items', schema.maxItems);
3109 }
3110
3111 if (schema.uniqueItems) {
3112 options += optionHtml('Unique Items', 'true');
3113 }
3114
3115 if (schema.collectionFormat) {
3116 options += optionHtml('Coll. Format', schema.collectionFormat);
3117 }
3118 }
3119
3120 if (_.isUndefined(schema.items)) {
3121 if (_.isArray(schema.enum)) {
3122 var enumString;
3123
3124 if (type === 'number' || type === 'integer') {
3125 enumString = schema.enum.join(', ');
3126 } else {
3127 enumString = '"' + schema.enum.join('", "') + '"';
3128 }
3129
3130 options += optionHtml('Enum', enumString);
3131 }
3132 }
3133
3134 if (options.length > 0) {
3135 html = '<span class="propWrap">' + html + '<table class="optionsWrapper"><tr><th colspan="2">' + type + '</th></tr>' + options + '</table></span>';
3136 }
3137
3138 return html;
3139 }
3140
3141 function processModel(schema, name) {
3142 var type = schema.type || 'object';
3143 var isArray = schema.type === 'array';
3144 var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose;
3145
3146 if (name) {
3147 seenModels.push(name);
3148 }
3149
3150 if (isArray) {
3151 if (_.isArray(schema.items)) {
3152 html += '<div>' + _.map(schema.items, function (item) {
3153 var type = item.type || 'object';
3154
3155 if (_.isUndefined(item.$ref)) {
3156 if (_.indexOf(['array', 'object'], type) > -1) {
3157 if (type === 'object' && _.isUndefined(item.properties)) {
3158 return 'object';
3159 } else {
3160 return addReference(item);
3161 }
3162 } else {
3163 return primitiveToOptionsHTML(item, type);
3164 }
3165 } else {
3166 return addReference(item, Helpers.simpleRef(item.$ref));
3167 }
3168 }).join(',</div><div>');
3169 } else if (_.isPlainObject(schema.items)) {
3170 if (_.isUndefined(schema.items.$ref)) {
3171 if (_.indexOf(['array', 'object'], schema.items.type || 'object') > -1) {
3172 if ((_.isUndefined(schema.items.type) || schema.items.type === 'object') && _.isUndefined(schema.items.properties)) {
3173 html += '<div>object</div>';
3174 } else {
3175 html += '<div>' + addReference(schema.items) + '</div>';
3176 }
3177 } else {
3178 html += '<div>' + primitiveToOptionsHTML(schema.items, schema.items.type) + '</div>';
3179 }
3180 } else {
3181 html += '<div>' + addReference(schema.items, Helpers.simpleRef(schema.items.$ref)) + '</div>';
3182 }
3183 } else {
3184 Helpers.log('Array type\'s \'items\' property is not an array or an object, cannot process');
3185 html += '<div>object</div>';
3186 }
3187 } else {
3188 if (schema.$ref) {
3189 html += '<div>' + addReference(schema, name) + '</div>';
3190 } else if (type === 'object') {
3191 if (_.isPlainObject(schema.properties)) {
3192 var contents = _.map(schema.properties, function (property, name) {
3193 var propertyIsRequired = (_.indexOf(schema.required, name) >= 0);
3194 var cProperty = _.cloneDeep(property);
3195
3196 var requiredClass = propertyIsRequired ? 'required' : '';
3197 var html = '<div' + (property.readOnly ? ' class="readOnly"' : '') + '><span class="propName ' + requiredClass + '">' + name + '</span> (';
3198 var model;
3199 var propDescription;
3200
3201 // Allow macro to set the default value
3202 cProperty.default = modelPropertyMacro(cProperty);
3203
3204 // Resolve the schema (Handle nested schemas)
3205 cProperty = Helpers.resolveSchema(cProperty);
3206
3207 propDescription = property.description || cProperty.description;
3208
3209 // We need to handle property references to primitives (Issue 339)
3210 if (!_.isUndefined(cProperty.$ref)) {
3211 model = models[Helpers.simpleRef(cProperty.$ref)];
3212
3213 if (!_.isUndefined(model) && _.indexOf([undefined, 'array', 'object'], model.definition.type) === -1) {
3214 // Use referenced schema
3215 cProperty = Helpers.resolveSchema(model.definition);
3216 }
3217 }
3218
3219 html += primitiveToHTML(cProperty);
3220
3221 if(!propertyIsRequired) {
3222 html += ', <span class="propOptKey">optional</span>';
3223 }
3224
3225 if(property.readOnly) {
3226 html += ', <span class="propReadOnly">read only</span>';
3227 }
3228
3229 html += ')';
3230
3231 if (!_.isUndefined(propDescription)) {
3232 html += ': ' + '<span class="propDesc">' + propDescription + '</span>';
3233 }
3234
3235 if (cProperty.enum) {
3236 html += ' = <span class="propVals">[\'' + cProperty.enum.join('\', \'') + '\']</span>';
3237 }
3238
3239 return primitiveToOptionsHTML(cProperty, html);
3240 }).join(',</div>');
3241 }
3242
3243 if (contents) {
3244 html += contents + '</div>';
3245 }
3246 } else {
3247 html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>';
3248 }
3249 }
3250
3251 return html + strongOpen + (isArray ? ']' : '}') + strongClose;
3252 }
3253}
3254
3255},{"./helpers":4,"lodash-compat/array/indexOf":53,"lodash-compat/collection/forEach":58,"lodash-compat/collection/map":60,"lodash-compat/lang/cloneDeep":142,"lodash-compat/lang/isArray":144,"lodash-compat/lang/isEmpty":145,"lodash-compat/lang/isObject":148,"lodash-compat/lang/isPlainObject":149,"lodash-compat/lang/isUndefined":152,"lodash-compat/object/keys":153}],8:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003256'use strict';
3257
3258var SwaggerHttp = require('./http');
Jian Li83d87a72016-04-20 15:38:24 -07003259var _ = {
3260 isObject: require('lodash-compat/lang/isObject')
3261};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003262
3263var SwaggerSpecConverter = module.exports = function () {
3264 this.errors = [];
3265 this.warnings = [];
3266 this.modelMap = {};
3267};
3268
3269SwaggerSpecConverter.prototype.setDocumentationLocation = function (location) {
3270 this.docLocation = location;
3271};
3272
3273/**
3274 * converts a resource listing OR api declaration
3275 **/
Jian Li83d87a72016-04-20 15:38:24 -07003276SwaggerSpecConverter.prototype.convert = function (obj, clientAuthorizations, opts, callback) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003277 // not a valid spec
3278 if(!obj || !Array.isArray(obj.apis)) {
3279 return this.finish(callback, null);
3280 }
3281 this.clientAuthorizations = clientAuthorizations;
3282
3283 // create a new swagger object to return
3284 var swagger = { swagger: '2.0' };
3285
3286 swagger.originalVersion = obj.swaggerVersion;
3287
3288 // add the info
3289 this.apiInfo(obj, swagger);
3290
3291 // add security definitions
3292 this.securityDefinitions(obj, swagger);
3293
3294 // take basePath into account
3295 if (obj.basePath) {
3296 this.setDocumentationLocation(obj.basePath);
3297 }
3298
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003299 // see if this is a single-file swagger definition
3300 var isSingleFileSwagger = false;
3301 var i;
3302 for(i = 0; i < obj.apis.length; i++) {
3303 var api = obj.apis[i];
3304 if(Array.isArray(api.operations)) {
3305 isSingleFileSwagger = true;
3306 }
3307 }
3308 if(isSingleFileSwagger) {
3309 this.declaration(obj, swagger);
3310 this.finish(callback, swagger);
3311 }
3312 else {
Jian Li83d87a72016-04-20 15:38:24 -07003313 this.resourceListing(obj, swagger, opts, callback);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003314 }
3315};
3316
3317SwaggerSpecConverter.prototype.declaration = function(obj, swagger) {
3318 var name, i, p, pos;
3319 if(!obj.apis) {
3320 return;
3321 }
3322
3323 if (obj.basePath.indexOf('http://') === 0) {
3324 p = obj.basePath.substring('http://'.length);
3325 pos = p.indexOf('/');
3326 if (pos > 0) {
3327 swagger.host = p.substring(0, pos);
3328 swagger.basePath = p.substring(pos);
3329 }
3330 else {
3331 swagger.host = p;
3332 swagger.basePath = '/';
3333 }
3334 } else if (obj.basePath.indexOf('https://') === 0) {
3335 p = obj.basePath.substring('https://'.length);
3336 pos = p.indexOf('/');
3337 if (pos > 0) {
3338 swagger.host = p.substring(0, pos);
3339 swagger.basePath = p.substring(pos);
3340 }
3341 else {
3342 swagger.host = p;
3343 swagger.basePath = '/';
3344 }
3345 } else {
3346 swagger.basePath = obj.basePath;
3347 }
3348
3349 var resourceLevelAuth;
3350 if(obj.authorizations) {
3351 resourceLevelAuth = obj.authorizations;
3352 }
3353 if(obj.consumes) {
3354 swagger.consumes = obj.consumes;
3355 }
3356 if(obj.produces) {
3357 swagger.produces = obj.produces;
3358 }
3359
3360 // build a mapping of id to name for 1.0 model resolutions
Jian Li83d87a72016-04-20 15:38:24 -07003361 if(_.isObject(obj)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003362 for(name in obj.models) {
3363 var existingModel = obj.models[name];
3364 var key = (existingModel.id || name);
3365 this.modelMap[key] = name;
3366 }
3367 }
3368
3369 for(i = 0; i < obj.apis.length; i++) {
3370 var api = obj.apis[i];
3371 var path = api.path;
3372 var operations = api.operations;
3373 this.operations(path, obj.resourcePath, operations, resourceLevelAuth, swagger);
3374 }
3375
3376 var models = obj.models || {};
3377 this.models(models, swagger);
3378};
3379
3380SwaggerSpecConverter.prototype.models = function(obj, swagger) {
Jian Li83d87a72016-04-20 15:38:24 -07003381 if(!_.isObject(obj)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003382 return;
3383 }
3384 var name;
3385
3386 swagger.definitions = swagger.definitions || {};
3387 for(name in obj) {
3388 var existingModel = obj[name];
3389 var _enum = [];
3390 var schema = { properties: {}};
3391 var propertyName;
3392 for(propertyName in existingModel.properties) {
3393 var existingProperty = existingModel.properties[propertyName];
3394 var property = {};
3395 this.dataType(existingProperty, property);
3396 if(existingProperty.description) {
3397 property.description = existingProperty.description;
3398 }
3399 if(existingProperty['enum']) {
3400 property['enum'] = existingProperty['enum'];
3401 }
3402 if(typeof existingProperty.required === 'boolean' && existingProperty.required === true) {
3403 _enum.push(propertyName);
3404 }
3405 if(typeof existingProperty.required === 'string' && existingProperty.required === 'true') {
3406 _enum.push(propertyName);
3407 }
3408 schema.properties[propertyName] = property;
3409 }
3410 if(_enum.length > 0) {
3411 schema['enum'] = _enum;
3412 }
3413
3414 schema.required = existingModel.required;
3415 swagger.definitions[name] = schema;
3416 }
3417};
3418
3419SwaggerSpecConverter.prototype.extractTag = function(resourcePath) {
3420 var pathString = resourcePath || 'default';
3421 if(pathString.indexOf('http:') === 0 || pathString.indexOf('https:') === 0) {
3422 pathString = pathString.split(['/']);
3423 pathString = pathString[pathString.length -1].substring();
3424 }
3425 if(pathString.endsWith('.json')) {
3426 pathString = pathString.substring(0, pathString.length - '.json'.length);
3427 }
3428 return pathString.replace('/','');
3429};
3430
3431SwaggerSpecConverter.prototype.operations = function(path, resourcePath, obj, resourceLevelAuth, swagger) {
3432 if(!Array.isArray(obj)) {
3433 return;
3434 }
3435 var i;
3436
3437 if(!swagger.paths) {
3438 swagger.paths = {};
3439 }
3440
3441 var pathObj = swagger.paths[path] || {};
3442 var tag = this.extractTag(resourcePath);
3443 swagger.tags = swagger.tags || [];
3444 var matched = false;
3445 for(i = 0; i < swagger.tags.length; i++) {
3446 var tagObject = swagger.tags[i];
3447 if(tagObject.name === tag) {
3448 matched = true;
3449 }
3450 }
3451 if(!matched) {
3452 swagger.tags.push({name: tag});
3453 }
3454
3455 for(i = 0; i < obj.length; i++) {
3456 var existingOperation = obj[i];
3457 var method = (existingOperation.method || existingOperation.httpMethod).toLowerCase();
3458 var operation = {tags: [tag]};
3459 var existingAuthorizations = existingOperation.authorizations;
3460
3461 if(existingAuthorizations && Object.keys(existingAuthorizations).length === 0) {
3462 existingAuthorizations = resourceLevelAuth;
3463 }
3464
3465 if(typeof existingAuthorizations !== 'undefined') {
3466 var scopesObject;
3467 for(var key in existingAuthorizations) {
3468 operation.security = operation.security || [];
3469 var scopes = existingAuthorizations[key];
3470 if(scopes) {
3471 var securityScopes = [];
3472 for(var j in scopes) {
3473 securityScopes.push(scopes[j].scope);
3474 }
3475 scopesObject = {};
3476 scopesObject[key] = securityScopes;
3477 operation.security.push(scopesObject);
3478 }
3479 else {
3480 scopesObject = {};
3481 scopesObject[key] = [];
3482 operation.security.push(scopesObject);
3483 }
3484 }
3485 }
3486
3487 if(existingOperation.consumes) {
3488 operation.consumes = existingOperation.consumes;
3489 }
3490 else if(swagger.consumes) {
3491 operation.consumes = swagger.consumes;
3492 }
3493 if(existingOperation.produces) {
3494 operation.produces = existingOperation.produces;
3495 }
3496 else if(swagger.produces) {
3497 operation.produces = swagger.produces;
3498 }
3499 if(existingOperation.summary) {
3500 operation.summary = existingOperation.summary;
3501 }
3502 if(existingOperation.notes) {
3503 operation.description = existingOperation.notes;
3504 }
3505 if(existingOperation.nickname) {
3506 operation.operationId = existingOperation.nickname;
3507 }
3508 if(existingOperation.deprecated) {
3509 operation.deprecated = existingOperation.deprecated;
3510 }
3511
3512 this.authorizations(existingAuthorizations, swagger);
3513 this.parameters(operation, existingOperation.parameters, swagger);
3514 this.responseMessages(operation, existingOperation, swagger);
3515
3516 pathObj[method] = operation;
3517 }
3518
3519 swagger.paths[path] = pathObj;
3520};
3521
3522SwaggerSpecConverter.prototype.responseMessages = function(operation, existingOperation) {
Jian Li83d87a72016-04-20 15:38:24 -07003523 if(!_.isObject(existingOperation)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003524 return;
3525 }
3526 // build default response from the operation (1.x)
3527 var defaultResponse = {};
3528 this.dataType(existingOperation, defaultResponse);
3529 // TODO: look into the real problem of rendering responses in swagger-ui
3530 // ....should reponseType have an implicit schema?
3531 if(!defaultResponse.schema && defaultResponse.type) {
3532 defaultResponse = {schema: defaultResponse};
3533 }
3534
3535 operation.responses = operation.responses || {};
3536
3537 // grab from responseMessages (1.2)
3538 var has200 = false;
3539 if(Array.isArray(existingOperation.responseMessages)) {
3540 var i;
3541 var existingResponses = existingOperation.responseMessages;
3542 for(i = 0; i < existingResponses.length; i++) {
3543 var existingResponse = existingResponses[i];
3544 var response = { description: existingResponse.message };
3545 if(existingResponse.code === 200) {
3546 has200 = true;
3547 }
3548 // Convert responseModel -> schema{$ref: responseModel}
3549 if(existingResponse.responseModel) {
Jian Li83d87a72016-04-20 15:38:24 -07003550 response.schema = {'$ref': '#/definitions/' + existingResponse.responseModel};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003551 }
3552 operation.responses['' + existingResponse.code] = response;
3553 }
3554 }
3555
3556 if(has200) {
3557 operation.responses['default'] = defaultResponse;
3558 }
3559 else {
3560 operation.responses['200'] = defaultResponse;
3561 }
3562};
3563
3564SwaggerSpecConverter.prototype.authorizations = function(obj) {
3565 // TODO
Jian Li83d87a72016-04-20 15:38:24 -07003566 if(!_.isObject(obj)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003567 return;
3568 }
3569};
3570
3571SwaggerSpecConverter.prototype.parameters = function(operation, obj) {
3572 if(!Array.isArray(obj)) {
3573 return;
3574 }
3575 var i;
3576 for(i = 0; i < obj.length; i++) {
3577 var existingParameter = obj[i];
3578 var parameter = {};
3579 parameter.name = existingParameter.name;
3580 parameter.description = existingParameter.description;
3581 parameter.required = existingParameter.required;
3582 parameter.in = existingParameter.paramType;
3583
3584 // per #168
3585 if(parameter.in === 'body') {
3586 parameter.name = 'body';
3587 }
3588 if(parameter.in === 'form') {
3589 parameter.in = 'formData';
3590 }
3591
3592 if(existingParameter.enum) {
3593 parameter.enum = existingParameter.enum;
3594 }
3595
3596 if(existingParameter.allowMultiple === true || existingParameter.allowMultiple === 'true') {
3597 var innerType = {};
3598 this.dataType(existingParameter, innerType);
3599 parameter.type = 'array';
3600 parameter.items = innerType;
3601
3602 if(existingParameter.allowableValues) {
3603 var av = existingParameter.allowableValues;
3604 if(av.valueType === 'LIST') {
3605 parameter['enum'] = av.values;
3606 }
3607 }
3608 }
3609 else {
3610 this.dataType(existingParameter, parameter);
3611 }
Jian Li83d87a72016-04-20 15:38:24 -07003612 if(typeof existingParameter.defaultValue !== 'undefined') {
3613 parameter.default = existingParameter.defaultValue;
3614 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003615
3616 operation.parameters = operation.parameters || [];
3617 operation.parameters.push(parameter);
3618 }
3619};
3620
3621SwaggerSpecConverter.prototype.dataType = function(source, target) {
Jian Li83d87a72016-04-20 15:38:24 -07003622 if(!_.isObject(source)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003623 return;
3624 }
3625
3626 if(source.minimum) {
3627 target.minimum = source.minimum;
3628 }
3629 if(source.maximum) {
3630 target.maximum = source.maximum;
3631 }
Jian Li83d87a72016-04-20 15:38:24 -07003632 if (source.format) {
3633 target.format = source.format;
3634 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003635
3636 // default can be 'false'
3637 if(typeof source.defaultValue !== 'undefined') {
3638 target.default = source.defaultValue;
3639 }
3640
3641 var jsonSchemaType = this.toJsonSchema(source);
3642 if(jsonSchemaType) {
3643 target = target || {};
3644 if(jsonSchemaType.type) {
3645 target.type = jsonSchemaType.type;
3646 }
3647 if(jsonSchemaType.format) {
3648 target.format = jsonSchemaType.format;
3649 }
3650 if(jsonSchemaType.$ref) {
3651 target.schema = {$ref: jsonSchemaType.$ref};
3652 }
3653 if(jsonSchemaType.items) {
3654 target.items = jsonSchemaType.items;
3655 }
3656 }
3657};
3658
3659SwaggerSpecConverter.prototype.toJsonSchema = function(source) {
3660 if(!source) {
3661 return 'object';
3662 }
3663 var detectedType = (source.type || source.dataType || source.responseClass || '');
3664 var lcType = detectedType.toLowerCase();
3665 var format = (source.format || '').toLowerCase();
3666
3667 if(lcType.indexOf('list[') === 0) {
3668 var innerType = detectedType.substring(5, detectedType.length - 1);
3669 var jsonType = this.toJsonSchema({type: innerType});
3670 return {type: 'array', items: jsonType};
Jian Li83d87a72016-04-20 15:38:24 -07003671 } else if(lcType === 'int' || (lcType === 'integer' && format === 'int32')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003672 {return {type: 'integer', format: 'int32'};}
Jian Li83d87a72016-04-20 15:38:24 -07003673 } else if(lcType === 'long' || (lcType === 'integer' && format === 'int64')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003674 {return {type: 'integer', format: 'int64'};}
Jian Li83d87a72016-04-20 15:38:24 -07003675 } else if(lcType === 'integer') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003676 {return {type: 'integer', format: 'int64'};}
Jian Li83d87a72016-04-20 15:38:24 -07003677 } else if(lcType === 'float' || (lcType === 'number' && format === 'float')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003678 {return {type: 'number', format: 'float'};}
Jian Li83d87a72016-04-20 15:38:24 -07003679 } else if(lcType === 'double' || (lcType === 'number' && format === 'double')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003680 {return {type: 'number', format: 'double'};}
Jian Li83d87a72016-04-20 15:38:24 -07003681 } else if((lcType === 'string' && format === 'date-time') || (lcType === 'date')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003682 {return {type: 'string', format: 'date-time'};}
Jian Li83d87a72016-04-20 15:38:24 -07003683 } else if(lcType === 'string') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003684 {return {type: 'string'};}
Jian Li83d87a72016-04-20 15:38:24 -07003685 } else if(lcType === 'file') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003686 {return {type: 'file'};}
Jian Li83d87a72016-04-20 15:38:24 -07003687 } else if(lcType === 'boolean') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003688 {return {type: 'boolean'};}
Jian Li83d87a72016-04-20 15:38:24 -07003689 } else if(lcType === 'boolean') {
3690 {return {type: 'boolean'};}
3691 } else if(lcType === 'array' || lcType === 'list') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003692 if(source.items) {
3693 var it = this.toJsonSchema(source.items);
3694 return {type: 'array', items: it};
3695 }
3696 else {
3697 return {type: 'array', items: {type: 'object'}};
3698 }
Jian Li83d87a72016-04-20 15:38:24 -07003699 } else if(source.$ref) {
3700 return {$ref: this.modelMap[source.$ref] ? '#/definitions/' + this.modelMap[source.$ref] : source.$ref};
3701 } else if(lcType === 'void' || lcType === '') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003702 {return {};}
Jian Li83d87a72016-04-20 15:38:24 -07003703 } else if (this.modelMap[source.type]) {
3704 // If this a model using `type` instead of `$ref`, that's fine.
3705 return {$ref: '#/definitions/' + this.modelMap[source.type]};
3706 } else {
3707 // Unknown model type or 'object', pass it along.
3708 return {type: source.type};
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003709 }
3710};
3711
Jian Li83d87a72016-04-20 15:38:24 -07003712SwaggerSpecConverter.prototype.resourceListing = function(obj, swagger, opts, callback) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003713 var i;
3714 var processedCount = 0; // jshint ignore:line
3715 var self = this; // jshint ignore:line
3716 var expectedCount = obj.apis.length;
3717 var _swagger = swagger; // jshint ignore:line
Jian Li83d87a72016-04-20 15:38:24 -07003718 var _opts = {};
3719
3720 if(opts && opts.requestInterceptor){
3721 _opts.requestInterceptor = opts.requestInterceptor;
3722 }
3723
3724 if(opts && opts.responseInterceptor){
3725 _opts.responseInterceptor = opts.responseInterceptor;
3726 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003727
3728 if(expectedCount === 0) {
3729 this.finish(callback, swagger);
3730 }
3731
3732 for(i = 0; i < expectedCount; i++) {
3733 var api = obj.apis[i];
3734 var path = api.path;
3735 var absolutePath = this.getAbsolutePath(obj.swaggerVersion, this.docLocation, path);
3736
3737 if(api.description) {
3738 swagger.tags = swagger.tags || [];
3739 swagger.tags.push({
3740 name : this.extractTag(api.path),
3741 description : api.description || ''
3742 });
3743 }
3744 var http = {
3745 url: absolutePath,
3746 headers: {accept: 'application/json'},
3747 on: {},
3748 method: 'get'
3749 };
3750 /* jshint ignore:start */
3751 http.on.response = function(data) {
3752 processedCount += 1;
3753 var obj = data.obj;
3754 if(obj) {
3755 self.declaration(obj, _swagger);
3756 }
3757 if(processedCount === expectedCount) {
3758 self.finish(callback, _swagger);
3759 }
3760 };
3761 http.on.error = function(data) {
3762 console.error(data);
3763 processedCount += 1;
3764 if(processedCount === expectedCount) {
3765 self.finish(callback, _swagger);
3766 }
3767 };
3768 /* jshint ignore:end */
3769
3770 if(this.clientAuthorizations && typeof this.clientAuthorizations.apply === 'function') {
3771 this.clientAuthorizations.apply(http);
3772 }
3773
Jian Li83d87a72016-04-20 15:38:24 -07003774 new SwaggerHttp().execute(http, _opts);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003775 }
3776};
3777
3778SwaggerSpecConverter.prototype.getAbsolutePath = function(version, docLocation, path) {
3779 if(version === '1.0') {
3780 if(docLocation.endsWith('.json')) {
3781 // get root path
3782 var pos = docLocation.lastIndexOf('/');
3783 if(pos > 0) {
3784 docLocation = docLocation.substring(0, pos);
3785 }
3786 }
3787 }
3788
3789 var location = docLocation;
3790 if(path.indexOf('http://') === 0 || path.indexOf('https://') === 0) {
3791 location = path;
3792 }
3793 else {
3794 if(docLocation.endsWith('/')) {
3795 location = docLocation.substring(0, docLocation.length - 1);
3796 }
3797 location += path;
3798 }
3799 location = location.replace('{format}', 'json');
3800 return location;
3801};
3802
3803SwaggerSpecConverter.prototype.securityDefinitions = function(obj, swagger) {
3804 if(obj.authorizations) {
3805 var name;
3806 for(name in obj.authorizations) {
3807 var isValid = false;
3808 var securityDefinition = {};
3809 var definition = obj.authorizations[name];
3810 if(definition.type === 'apiKey') {
3811 securityDefinition.type = 'apiKey';
3812 securityDefinition.in = definition.passAs;
3813 securityDefinition.name = definition.keyname || name;
3814 isValid = true;
3815 }
Jian Li83d87a72016-04-20 15:38:24 -07003816 else if(definition.type === 'basicAuth') {
3817 securityDefinition.type = 'basicAuth';
3818 isValid = true;
3819 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003820 else if(definition.type === 'oauth2') {
3821 var existingScopes = definition.scopes || [];
3822 var scopes = {};
3823 var i;
3824 for(i in existingScopes) {
3825 var scope = existingScopes[i];
3826 scopes[scope.scope] = scope.description;
3827 }
3828 securityDefinition.type = 'oauth2';
3829 if(i > 0) {
3830 securityDefinition.scopes = scopes;
3831 }
3832 if(definition.grantTypes) {
3833 if(definition.grantTypes.implicit) {
3834 var implicit = definition.grantTypes.implicit;
3835 securityDefinition.flow = 'implicit';
3836 securityDefinition.authorizationUrl = implicit.loginEndpoint;
3837 isValid = true;
3838 }
3839 /* jshint ignore:start */
3840 if(definition.grantTypes['authorization_code']) {
3841 if(!securityDefinition.flow) {
3842 // cannot set if flow is already defined
3843 var authCode = definition.grantTypes['authorization_code'];
3844 securityDefinition.flow = 'accessCode';
3845 securityDefinition.authorizationUrl = authCode.tokenRequestEndpoint.url;
3846 securityDefinition.tokenUrl = authCode.tokenEndpoint.url;
3847 isValid = true;
3848 }
3849 }
3850 /* jshint ignore:end */
3851 }
3852 }
3853 if(isValid) {
3854 swagger.securityDefinitions = swagger.securityDefinitions || {};
3855 swagger.securityDefinitions[name] = securityDefinition;
3856 }
3857 }
3858 }
3859};
3860
3861SwaggerSpecConverter.prototype.apiInfo = function(obj, swagger) {
3862 // info section
3863 if(obj.info) {
3864 var info = obj.info;
3865 swagger.info = {};
3866
3867 if(info.contact) {
3868 swagger.info.contact = {};
3869 swagger.info.contact.email = info.contact;
3870 }
3871 if(info.description) {
3872 swagger.info.description = info.description;
3873 }
3874 if(info.title) {
3875 swagger.info.title = info.title;
3876 }
3877 if(info.termsOfServiceUrl) {
3878 swagger.info.termsOfService = info.termsOfServiceUrl;
3879 }
3880 if(info.license || info.licenseUrl) {
3881 swagger.license = {};
3882 if(info.license) {
3883 swagger.license.name = info.license;
3884 }
3885 if(info.licenseUrl) {
3886 swagger.license.url = info.licenseUrl;
3887 }
3888 }
3889 }
3890 else {
3891 this.warnings.push('missing info section');
3892 }
3893};
3894
3895SwaggerSpecConverter.prototype.finish = function (callback, obj) {
3896 callback(obj);
3897};
3898
Jian Li83d87a72016-04-20 15:38:24 -07003899},{"./http":5,"lodash-compat/lang/isObject":148}],9:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003900'use strict';
3901
3902var _ = {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003903 isPlainObject: require('lodash-compat/lang/isPlainObject'),
3904 isString: require('lodash-compat/lang/isString'),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003905};
Jian Li83d87a72016-04-20 15:38:24 -07003906
3907var SchemaMarkup = require('../schema-markup.js');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003908var jsyaml = require('js-yaml');
3909
3910var Model = module.exports = function (name, definition, models, modelPropertyMacro) {
3911 this.definition = definition || {};
3912 this.isArray = definition.type === 'array';
3913 this.models = models || {};
3914 this.name = definition.title || name || 'Inline Model';
3915 this.modelPropertyMacro = modelPropertyMacro || function (property) {
3916 return property.default;
3917 };
3918
3919 return this;
3920};
3921
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003922Model.prototype.createJSONSample = Model.prototype.getSampleValue = function (modelsToIgnore) {
3923 modelsToIgnore = modelsToIgnore || {};
3924
3925 modelsToIgnore[this.name] = this;
3926
3927 // Response support
3928 if (this.examples && _.isPlainObject(this.examples) && this.examples['application/json']) {
3929 this.definition.example = this.examples['application/json'];
3930
3931 if (_.isString(this.definition.example)) {
3932 this.definition.example = jsyaml.safeLoad(this.definition.example);
3933 }
3934 } else if (!this.definition.example) {
3935 this.definition.example = this.examples;
3936 }
3937
Jian Li83d87a72016-04-20 15:38:24 -07003938 return SchemaMarkup.schemaToJSON(this.definition, this.models, modelsToIgnore, this.modelPropertyMacro);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003939};
3940
3941Model.prototype.getMockSignature = function () {
Jian Li83d87a72016-04-20 15:38:24 -07003942 return SchemaMarkup.schemaToHTML(this.name, this.definition, this.models, this.modelPropertyMacro);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003943};
3944
Jian Li83d87a72016-04-20 15:38:24 -07003945},{"../schema-markup.js":7,"js-yaml":20,"lodash-compat/lang/isPlainObject":149,"lodash-compat/lang/isString":150}],10:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003946'use strict';
3947
3948var _ = {
3949 cloneDeep: require('lodash-compat/lang/cloneDeep'),
3950 isUndefined: require('lodash-compat/lang/isUndefined'),
Jian Li83d87a72016-04-20 15:38:24 -07003951 isEmpty: require('lodash-compat/lang/isEmpty'),
3952 isObject: require('lodash-compat/lang/isObject')
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003953};
3954var helpers = require('../helpers');
3955var Model = require('./model');
3956var SwaggerHttp = require('../http');
Jian Li83d87a72016-04-20 15:38:24 -07003957var Q = require('q');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003958
3959var Operation = module.exports = function (parent, scheme, operationId, httpMethod, path, args, definitions, models, clientAuthorizations) {
3960 var errors = [];
3961
3962 parent = parent || {};
3963 args = args || {};
3964
3965 if(parent && parent.options) {
3966 this.client = parent.options.client || null;
Jian Li83d87a72016-04-20 15:38:24 -07003967 this.requestInterceptor = parent.options.requestInterceptor || null;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003968 this.responseInterceptor = parent.options.responseInterceptor || null;
3969 }
3970 this.authorizations = args.security;
3971 this.basePath = parent.basePath || '/';
3972 this.clientAuthorizations = clientAuthorizations;
3973 this.consumes = args.consumes || parent.consumes || ['application/json'];
3974 this.produces = args.produces || parent.produces || ['application/json'];
3975 this.deprecated = args.deprecated;
3976 this.description = args.description;
3977 this.host = parent.host || 'localhost';
3978 this.method = (httpMethod || errors.push('Operation ' + operationId + ' is missing method.'));
3979 this.models = models || {};
3980 this.nickname = (operationId || errors.push('Operations must have a nickname.'));
3981 this.operation = args;
3982 this.operations = {};
3983 this.parameters = args !== null ? (args.parameters || []) : {};
3984 this.parent = parent;
3985 this.path = (path || errors.push('Operation ' + this.nickname + ' is missing path.'));
3986 this.responses = (args.responses || {});
3987 this.scheme = scheme || parent.scheme || 'http';
Jian Li83d87a72016-04-20 15:38:24 -07003988 this.schemes = args.schemes || parent.schemes;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003989 this.security = args.security;
3990 this.summary = args.summary || '';
3991 this.type = null;
3992 this.useJQuery = parent.useJQuery;
Jian Li83d87a72016-04-20 15:38:24 -07003993 this.enableCookies = parent.enableCookies;
3994 this.parameterMacro = parent.parameterMacro || function (operation, parameter) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07003995 return parameter.default;
3996 };
3997
3998 this.inlineModels = [];
3999
4000 if (typeof this.deprecated === 'string') {
4001 switch(this.deprecated.toLowerCase()) {
4002 case 'true': case 'yes': case '1': {
4003 this.deprecated = true;
4004 break;
4005 }
4006
4007 case 'false': case 'no': case '0': case null: {
4008 this.deprecated = false;
4009 break;
4010 }
4011
4012 default: this.deprecated = Boolean(this.deprecated);
4013 }
4014 }
4015
4016 var i, model;
4017
4018 if (definitions) {
4019 // add to global models
4020 var key;
4021
4022 for (key in definitions) {
4023 model = new Model(key, definitions[key], this.models, parent.modelPropertyMacro);
4024
4025 if (model) {
4026 this.models[key] = model;
4027 }
4028 }
4029 }
Jian Li83d87a72016-04-20 15:38:24 -07004030 else {
4031 definitions = {};
4032 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004033
4034 for (i = 0; i < this.parameters.length; i++) {
4035 var param = this.parameters[i];
4036
4037 // Allow macro to set the default value
Jian Li83d87a72016-04-20 15:38:24 -07004038 param.default = this.parameterMacro(this, param);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004039
4040 if (param.type === 'array') {
4041 param.isList = true;
4042 param.allowMultiple = true;
4043 // the enum can be defined at the items level
Jian Li83d87a72016-04-20 15:38:24 -07004044 //if (param.items && param.items.enum) {
4045 // param['enum'] = param.items.enum;
4046 //}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004047 }
4048
4049 var innerType = this.getType(param);
4050
4051 if (innerType && innerType.toString().toLowerCase() === 'boolean') {
4052 param.allowableValues = {};
4053 param.isList = true;
4054 param['enum'] = [true, false]; // use actual primitives
4055 }
4056
Jian Li83d87a72016-04-20 15:38:24 -07004057 if(typeof param['x-example'] !== 'undefined') {
4058 var d = param['x-example'];
4059 param.default = d;
4060 }
4061 if(param['x-examples']) {
4062 var d = param['x-examples'].default;
4063 if(typeof d !== 'undefined') {
4064 param.default = d;
4065 }
4066 }
4067
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004068 if (typeof param['enum'] !== 'undefined') {
4069 var id;
4070
4071 param.allowableValues = {};
4072 param.allowableValues.values = [];
4073 param.allowableValues.descriptiveValues = [];
4074
4075 for (id = 0; id < param['enum'].length; id++) {
4076 var value = param['enum'][id];
4077 var isDefault = (value === param.default || value+'' === param.default);
4078
4079 param.allowableValues.values.push(value);
4080 // Always have string for descriptive values....
4081 param.allowableValues.descriptiveValues.push({value : value+'', isDefault: isDefault});
4082 }
4083 }
4084
4085 if (param.type === 'array') {
4086 innerType = [innerType];
4087
4088 if (typeof param.allowableValues === 'undefined') {
4089 // can't show as a list if no values to select from
4090 delete param.isList;
4091 delete param.allowMultiple;
4092 }
4093 }
4094
4095 param.signature = this.getModelSignature(innerType, this.models).toString();
4096 param.sampleJSON = this.getModelSampleJSON(innerType, this.models);
4097 param.responseClassSignature = param.signature;
4098 }
4099
4100 var defaultResponseCode, response, responses = this.responses;
4101
4102 if (responses['200']) {
4103 response = responses['200'];
4104 defaultResponseCode = '200';
4105 } else if (responses['201']) {
4106 response = responses['201'];
4107 defaultResponseCode = '201';
4108 } else if (responses['202']) {
4109 response = responses['202'];
4110 defaultResponseCode = '202';
4111 } else if (responses['203']) {
4112 response = responses['203'];
4113 defaultResponseCode = '203';
4114 } else if (responses['204']) {
4115 response = responses['204'];
4116 defaultResponseCode = '204';
4117 } else if (responses['205']) {
4118 response = responses['205'];
4119 defaultResponseCode = '205';
4120 } else if (responses['206']) {
4121 response = responses['206'];
4122 defaultResponseCode = '206';
4123 } else if (responses['default']) {
4124 response = responses['default'];
4125 defaultResponseCode = 'default';
4126 }
4127
4128 if (response && response.schema) {
4129 var resolvedModel = this.resolveModel(response.schema, definitions);
4130 var successResponse;
4131
4132 delete responses[defaultResponseCode];
4133
4134 if (resolvedModel) {
4135 this.successResponse = {};
4136 successResponse = this.successResponse[defaultResponseCode] = resolvedModel;
4137 } else if (!response.schema.type || response.schema.type === 'object' || response.schema.type === 'array') {
4138 // Inline model
4139 this.successResponse = {};
4140 successResponse = this.successResponse[defaultResponseCode] = new Model(undefined, response.schema || {}, this.models, parent.modelPropertyMacro);
4141 } else {
4142 // Primitive
4143 this.successResponse = {};
4144 successResponse = this.successResponse[defaultResponseCode] = response.schema;
4145 }
4146
4147 if (successResponse) {
4148 // Attach response properties
4149 if (response.description) {
4150 successResponse.description = response.description;
4151 }
4152
4153 if (response.examples) {
4154 successResponse.examples = response.examples;
4155 }
4156
4157 if (response.headers) {
4158 successResponse.headers = response.headers;
4159 }
4160 }
4161
4162 this.type = response;
4163 }
4164
4165 if (errors.length > 0) {
4166 if (this.resource && this.resource.api && this.resource.api.fail) {
4167 this.resource.api.fail(errors);
4168 }
4169 }
4170
4171 return this;
4172};
4173
4174Operation.prototype.isDefaultArrayItemValue = function(value, param) {
4175 if (param.default && Array.isArray(param.default)) {
4176 return param.default.indexOf(value) !== -1;
4177 }
4178 return value === param.default;
4179};
4180
4181Operation.prototype.getType = function (param) {
4182 var type = param.type;
4183 var format = param.format;
4184 var isArray = false;
4185 var str;
4186
4187 if (type === 'integer' && format === 'int32') {
4188 str = 'integer';
4189 } else if (type === 'integer' && format === 'int64') {
4190 str = 'long';
4191 } else if (type === 'integer') {
4192 str = 'integer';
4193 } else if (type === 'string') {
4194 if (format === 'date-time') {
4195 str = 'date-time';
4196 } else if (format === 'date') {
4197 str = 'date';
4198 } else {
4199 str = 'string';
4200 }
4201 } else if (type === 'number' && format === 'float') {
4202 str = 'float';
4203 } else if (type === 'number' && format === 'double') {
4204 str = 'double';
4205 } else if (type === 'number') {
4206 str = 'double';
4207 } else if (type === 'boolean') {
4208 str = 'boolean';
4209 } else if (type === 'array') {
4210 isArray = true;
4211
4212 if (param.items) {
4213 str = this.getType(param.items);
4214 }
Jian Li83d87a72016-04-20 15:38:24 -07004215 } else if (type === 'file') {
4216 str = 'file';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004217 }
4218
4219 if (param.$ref) {
4220 str = helpers.simpleRef(param.$ref);
4221 }
4222
4223 var schema = param.schema;
4224
4225 if (schema) {
4226 var ref = schema.$ref;
4227
4228 if (ref) {
4229 ref = helpers.simpleRef(ref);
4230
4231 if (isArray) {
4232 return [ ref ];
4233 } else {
4234 return ref;
4235 }
4236 } else {
4237 // If inline schema, we add it our interal hash -> which gives us it's ID (int)
4238 if(schema.type === 'object') {
4239 return this.addInlineModel(schema);
4240 }
4241 return this.getType(schema);
4242 }
4243 }
4244 if (isArray) {
4245 return [ str ];
4246 } else {
4247 return str;
4248 }
4249};
4250
4251/**
4252 * adds an inline schema (model) to a hash, where we can ref it later
4253 * @param {object} schema a schema
4254 * @return {number} the ID of the schema being added, or null
4255 **/
4256Operation.prototype.addInlineModel = function (schema) {
4257 var len = this.inlineModels.length;
4258 var model = this.resolveModel(schema, {});
4259 if(model) {
4260 this.inlineModels.push(model);
4261 return 'Inline Model '+len; // return string ref of the inline model (used with #getInlineModel)
4262 }
4263 return null; // report errors?
4264};
4265
4266/**
4267 * gets the internal ref to an inline model
4268 * @param {string} inline_str a string reference to an inline model
4269 * @return {Model} the model being referenced. Or null
4270 **/
4271Operation.prototype.getInlineModel = function(inlineStr) {
4272 if(/^Inline Model \d+$/.test(inlineStr)) {
4273 var id = parseInt(inlineStr.substr('Inline Model'.length).trim(),10); //
4274 var model = this.inlineModels[id];
4275 return model;
4276 }
4277 // I'm returning null here, should I rather throw an error?
4278 return null;
4279};
4280
4281Operation.prototype.resolveModel = function (schema, definitions) {
4282 if (typeof schema.$ref !== 'undefined') {
4283 var ref = schema.$ref;
4284
4285 if (ref.indexOf('#/definitions/') === 0) {
4286 ref = ref.substring('#/definitions/'.length);
4287 }
4288
4289 if (definitions[ref]) {
4290 return new Model(ref, definitions[ref], this.models, this.parent.modelPropertyMacro);
4291 }
4292 // schema must at least be an object to get resolved to an inline Model
4293 } else if (schema && typeof schema === 'object' &&
4294 (schema.type === 'object' || _.isUndefined(schema.type))) {
4295 return new Model(undefined, schema, this.models, this.parent.modelPropertyMacro);
4296 }
4297
4298 return null;
4299};
4300
4301Operation.prototype.help = function (dontPrint) {
4302 var out = this.nickname + ': ' + this.summary + '\n';
4303
4304 for (var i = 0; i < this.parameters.length; i++) {
4305 var param = this.parameters[i];
4306 var typeInfo = param.signature;
4307
4308 out += '\n * ' + param.name + ' (' + typeInfo + '): ' + param.description;
4309 }
4310
4311 if (typeof dontPrint === 'undefined') {
4312 helpers.log(out);
4313 }
4314
4315 return out;
4316};
4317
4318Operation.prototype.getModelSignature = function (type, definitions) {
4319 var isPrimitive, listType;
4320
4321 if (type instanceof Array) {
4322 listType = true;
4323 type = type[0];
4324 }
4325
4326 // Convert undefined to string of 'undefined'
4327 if (typeof type === 'undefined') {
4328 type = 'undefined';
4329 isPrimitive = true;
4330
4331 } else if (definitions[type]){
4332 // a model def exists?
4333 type = definitions[type]; /* Model */
4334 isPrimitive = false;
4335
4336 } else if (this.getInlineModel(type)) {
4337 type = this.getInlineModel(type); /* Model */
4338 isPrimitive = false;
4339
4340 } else {
4341 // We default to primitive
4342 isPrimitive = true;
4343 }
4344
4345 if (isPrimitive) {
4346 if (listType) {
4347 return 'Array[' + type + ']';
4348 } else {
4349 return type.toString();
4350 }
4351 } else {
4352 if (listType) {
4353 return 'Array[' + type.getMockSignature() + ']';
4354 } else {
4355 return type.getMockSignature();
4356 }
4357 }
4358};
4359
4360Operation.prototype.supportHeaderParams = function () {
4361 return true;
4362};
4363
4364Operation.prototype.supportedSubmitMethods = function () {
4365 return this.parent.supportedSubmitMethods;
4366};
4367
4368Operation.prototype.getHeaderParams = function (args) {
4369 var headers = this.setContentTypes(args, {});
4370
4371 for (var i = 0; i < this.parameters.length; i++) {
4372 var param = this.parameters[i];
4373
4374 if (typeof args[param.name] !== 'undefined') {
4375 if (param.in === 'header') {
4376 var value = args[param.name];
4377
4378 if (Array.isArray(value)) {
4379 value = value.toString();
4380 }
4381
4382 headers[param.name] = value;
4383 }
4384 }
4385 }
4386
4387 return headers;
4388};
4389
4390Operation.prototype.urlify = function (args) {
4391 var formParams = {};
4392 var requestUrl = this.path;
4393 var querystring = ''; // grab params from the args, build the querystring along the way
4394
4395 for (var i = 0; i < this.parameters.length; i++) {
4396 var param = this.parameters[i];
4397
4398 if (typeof args[param.name] !== 'undefined') {
4399 if (param.in === 'path') {
4400 var reg = new RegExp('\{' + param.name + '\}', 'gi');
4401 var value = args[param.name];
4402
4403 if (Array.isArray(value)) {
4404 value = this.encodePathCollection(param.collectionFormat, param.name, value);
4405 } else {
4406 value = this.encodePathParam(value);
4407 }
4408
4409 requestUrl = requestUrl.replace(reg, value);
4410 } else if (param.in === 'query' && typeof args[param.name] !== 'undefined') {
4411 if (querystring === '') {
4412 querystring += '?';
4413 } else {
4414 querystring += '&';
4415 }
4416
4417 if (typeof param.collectionFormat !== 'undefined') {
4418 var qp = args[param.name];
4419
4420 if (Array.isArray(qp)) {
4421 querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp);
4422 } else {
4423 querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4424 }
4425 } else {
4426 querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
4427 }
4428 } else if (param.in === 'formData') {
4429 formParams[param.name] = args[param.name];
4430 }
4431 }
4432 }
4433 var url = this.scheme + '://' + this.host;
4434
4435 if (this.basePath !== '/') {
4436 url += this.basePath;
4437 }
4438 return url + requestUrl + querystring;
4439};
4440
4441Operation.prototype.getMissingParams = function (args) {
4442 var missingParams = []; // check required params, track the ones that are missing
4443 var i;
4444
4445 for (i = 0; i < this.parameters.length; i++) {
4446 var param = this.parameters[i];
4447
4448 if (param.required === true) {
4449 if (typeof args[param.name] === 'undefined') {
4450 missingParams = param.name;
4451 }
4452 }
4453 }
4454
4455 return missingParams;
4456};
4457
4458Operation.prototype.getBody = function (headers, args, opts) {
Jian Li83d87a72016-04-20 15:38:24 -07004459 var formParams = {}, hasFormParams, body, key, value, hasBody = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004460
Jian Li83d87a72016-04-20 15:38:24 -07004461 // look at each param and put form params in an object
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004462 for (var i = 0; i < this.parameters.length; i++) {
4463 var param = this.parameters[i];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004464 if (typeof args[param.name] !== 'undefined') {
4465 if (param.in === 'body') {
4466 body = args[param.name];
4467 } else if (param.in === 'formData') {
4468 formParams[param.name] = args[param.name];
Jian Li83d87a72016-04-20 15:38:24 -07004469 hasFormParams = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004470 }
4471 }
4472 else {
4473 if(param.in === 'body') {
4474 hasBody = true;
4475 }
4476 }
4477 }
4478
4479 // if body is null and hasBody is true, AND a JSON body is requested, send empty {}
4480 if(hasBody && typeof body === 'undefined') {
4481 var contentType = headers['Content-Type'];
4482 if(contentType && contentType.indexOf('application/json') === 0) {
4483 body = '{}';
4484 }
4485 }
4486
Jian Li83d87a72016-04-20 15:38:24 -07004487 var isMultiPart = false;
4488 if(headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
4489 isMultiPart = true;
4490 }
4491
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004492 // handle form params
Jian Li83d87a72016-04-20 15:38:24 -07004493 if (hasFormParams && !isMultiPart) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004494 var encoded = '';
4495
4496 for (key in formParams) {
4497 value = formParams[key];
4498
4499 if (typeof value !== 'undefined') {
4500 if (encoded !== '') {
4501 encoded += '&';
4502 }
4503
4504 encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
4505 }
4506 }
4507
4508 body = encoded;
Jian Li83d87a72016-04-20 15:38:24 -07004509 } else if (isMultiPart) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004510 if (opts.useJQuery) {
4511 var bodyParam = new FormData();
4512
4513 bodyParam.type = 'formData';
4514
4515 for (key in formParams) {
4516 value = args[key];
4517
4518 if (typeof value !== 'undefined') {
4519 // required for jquery file upload
4520 if (value.type === 'file' && value.value) {
4521 delete headers['Content-Type'];
4522
4523 bodyParam.append(key, value.value);
4524 } else {
4525 bodyParam.append(key, value);
4526 }
4527 }
4528 }
4529
4530 body = bodyParam;
4531 }
4532 }
4533
4534 return body;
4535};
4536
4537/**
4538 * gets sample response for a single operation
4539 **/
4540Operation.prototype.getModelSampleJSON = function (type, models) {
4541 var listType, sampleJson, innerType;
4542 models = models || {};
4543
4544 listType = (type instanceof Array);
4545 innerType = listType ? type[0] : type;
4546
4547 if(models[innerType]) {
4548 sampleJson = models[innerType].createJSONSample();
4549 } else if (this.getInlineModel(innerType)){
4550 sampleJson = this.getInlineModel(innerType).createJSONSample(); // may return null, if type isn't correct
4551 }
4552
4553
4554 if (sampleJson) {
4555 sampleJson = listType ? [sampleJson] : sampleJson;
4556
4557 if (typeof sampleJson === 'string') {
4558 return sampleJson;
Jian Li83d87a72016-04-20 15:38:24 -07004559 } else if (_.isObject(sampleJson)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004560 var t = sampleJson;
4561
4562 if (sampleJson instanceof Array && sampleJson.length > 0) {
4563 t = sampleJson[0];
4564 }
4565
Jian Li83d87a72016-04-20 15:38:24 -07004566 if (t.nodeName && typeof t === 'Node') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004567 var xmlString = new XMLSerializer().serializeToString(t);
4568
4569 return this.formatXml(xmlString);
4570 } else {
4571 return JSON.stringify(sampleJson, null, 2);
4572 }
4573 } else {
4574 return sampleJson;
4575 }
4576 }
4577};
4578
4579/**
4580 * legacy binding
4581 **/
4582Operation.prototype.do = function (args, opts, callback, error, parent) {
4583 return this.execute(args, opts, callback, error, parent);
4584};
4585
4586/**
4587 * executes an operation
4588 **/
4589Operation.prototype.execute = function (arg1, arg2, arg3, arg4, parent) {
4590 var args = arg1 || {};
Jian Li83d87a72016-04-20 15:38:24 -07004591 var opts = {}, success, error, deferred;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004592
Jian Li83d87a72016-04-20 15:38:24 -07004593 if (_.isObject(arg2)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004594 opts = arg2;
4595 success = arg3;
4596 error = arg4;
4597 }
4598
4599 if(this.client) {
4600 opts.client = this.client;
4601 }
Jian Li83d87a72016-04-20 15:38:24 -07004602
4603 // add the request interceptor from parent, if none sent from client
4604 if(!opts.requestInterceptor && this.requestInterceptor ) {
4605 opts.requestInterceptor = this.requestInterceptor ;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004606 }
4607
Jian Li83d87a72016-04-20 15:38:24 -07004608 if(!opts.responseInterceptor && this.responseInterceptor) {
4609 opts.responseInterceptor = this.responseInterceptor;
4610 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004611
4612 if (typeof arg2 === 'function') {
4613 success = arg2;
4614 error = arg3;
4615 }
4616
Jian Li83d87a72016-04-20 15:38:24 -07004617 if (this.parent.usePromise) {
4618 deferred = Q.defer();
4619 } else {
4620 success = (success || this.parent.defaultSuccessCallback || helpers.log);
4621 error = (error || this.parent.defaultErrorCallback || helpers.log);
4622 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004623
4624
4625 if (typeof opts.useJQuery === 'undefined') {
4626 opts.useJQuery = this.useJQuery;
4627 }
Jian Li83d87a72016-04-20 15:38:24 -07004628
4629 if (typeof opts.enableCookies === 'undefined') {
4630 opts.enableCookies = this.enableCookies;
4631 }
4632
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004633 var missingParams = this.getMissingParams(args);
4634
4635 if (missingParams.length > 0) {
4636 var message = 'missing required params: ' + missingParams;
4637
4638 helpers.fail(message);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004639
Jian Li83d87a72016-04-20 15:38:24 -07004640 if (this.parent.usePromise) {
4641 deferred.reject(message);
4642 return deferred.promise;
4643 } else {
4644 error(message, parent);
4645 return {};
4646 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004647 }
4648
4649 var allHeaders = this.getHeaderParams(args);
4650 var contentTypeHeaders = this.setContentTypes(args, opts);
4651 var headers = {}, attrname;
4652
4653 for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
4654 for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
4655
4656 var body = this.getBody(contentTypeHeaders, args, opts);
4657 var url = this.urlify(args);
4658
4659 if(url.indexOf('.{format}') > 0) {
4660 if(headers) {
4661 var format = headers.Accept || headers.accept;
4662 if(format && format.indexOf('json') > 0) {
4663 url = url.replace('.{format}', '.json');
4664 }
4665 else if(format && format.indexOf('xml') > 0) {
4666 url = url.replace('.{format}', '.xml');
4667 }
4668 }
4669 }
4670
4671 var obj = {
4672 url: url,
4673 method: this.method.toUpperCase(),
4674 body: body,
Jian Li83d87a72016-04-20 15:38:24 -07004675 enableCookies: opts.enableCookies,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004676 useJQuery: opts.useJQuery,
Jian Li83d87a72016-04-20 15:38:24 -07004677 deferred: deferred,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004678 headers: headers,
4679 on: {
4680 response: function (response) {
Jian Li83d87a72016-04-20 15:38:24 -07004681 if (deferred) {
4682 deferred.resolve(response);
4683 return deferred.promise;
4684 } else {
4685 return success(response, parent);
4686 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004687 },
4688 error: function (response) {
Jian Li83d87a72016-04-20 15:38:24 -07004689 if (deferred) {
4690 deferred.reject(response);
4691 return deferred.promise;
4692 } else {
4693 return error(response, parent);
4694 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004695 }
4696 }
4697 };
4698
4699 this.clientAuthorizations.apply(obj, this.operation.security);
4700 if (opts.mock === true) {
4701 return obj;
4702 } else {
Jian Li83d87a72016-04-20 15:38:24 -07004703 return new SwaggerHttp().execute(obj, opts);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004704 }
4705};
4706
4707function itemByPriority(col, itemPriority) {
4708
4709 // No priorities? return first...
4710 if(_.isEmpty(itemPriority)) {
4711 return col[0];
4712 }
4713
4714 for (var i = 0, len = itemPriority.length; i < len; i++) {
4715 if(col.indexOf(itemPriority[i]) > -1) {
4716 return itemPriority[i];
4717 }
4718 }
4719
4720 // Otherwise return first
4721 return col[0];
4722}
4723
4724Operation.prototype.setContentTypes = function (args, opts) {
4725 // default type
4726 var allDefinedParams = this.parameters;
4727 var body;
4728 var consumes = args.parameterContentType || itemByPriority(this.consumes, ['application/json', 'application/yaml']);
4729 var accepts = opts.responseContentType || itemByPriority(this.produces, ['application/json', 'application/yaml']);
4730 var definedFileParams = [];
4731 var definedFormParams = [];
4732 var headers = {};
4733 var i;
4734
4735 // get params from the operation and set them in definedFileParams, definedFormParams, headers
4736 for (i = 0; i < allDefinedParams.length; i++) {
4737 var param = allDefinedParams[i];
4738
4739 if (param.in === 'formData') {
4740 if (param.type === 'file') {
4741 definedFileParams.push(param);
4742 } else {
4743 definedFormParams.push(param);
4744 }
4745 } else if (param.in === 'header' && opts) {
4746 var key = param.name;
4747 var headerValue = opts[param.name];
4748
4749 if (typeof opts[param.name] !== 'undefined') {
4750 headers[key] = headerValue;
4751 }
4752 } else if (param.in === 'body' && typeof args[param.name] !== 'undefined') {
4753 body = args[param.name];
4754 }
4755 }
4756
4757 // if there's a body, need to set the consumes header via requestContentType
Jian Li83d87a72016-04-20 15:38:24 -07004758 if (this.method === 'post' || this.method === 'put' || this.method === 'patch' ||
4759 ((this.method === 'delete' || this.method === 'get') && body) ) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004760 if (opts.requestContentType) {
4761 consumes = opts.requestContentType;
4762 }
4763 // if any form params, content type must be set
4764 if (definedFormParams.length > 0) {
4765 if (opts.requestContentType) { // override if set
4766 consumes = opts.requestContentType;
4767 } else if (definedFileParams.length > 0) { // if a file, must be multipart/form-data
4768 consumes = 'multipart/form-data';
4769 } else { // default to x-www-from-urlencoded
4770 consumes = 'application/x-www-form-urlencoded';
4771 }
4772 }
4773 }
4774 else {
4775 consumes = null;
4776 }
4777
4778 if (consumes && this.consumes) {
4779 if (this.consumes.indexOf(consumes) === -1) {
4780 helpers.log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes));
4781 }
4782 }
4783
4784 if (!this.matchesAccept(accepts)) {
4785 helpers.log('server can\'t produce ' + accepts);
4786 }
4787
4788 if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded')) {
4789 headers['Content-Type'] = consumes;
4790 }
4791
4792 if (accepts) {
4793 headers.Accept = accepts;
4794 }
4795
4796 return headers;
4797};
4798
4799/**
4800 * Returns true if the request accepts header matches anything in this.produces.
Jian Li83d87a72016-04-20 15:38:24 -07004801 * If this.produces contains * / *, ignore the accept header.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004802 * @param {string=} accepts The client request accept header.
4803 * @return {boolean}
4804 */
4805Operation.prototype.matchesAccept = function(accepts) {
4806 // no accepts or produces, no problem!
4807 if (!accepts || !this.produces) {
4808 return true;
4809 }
4810 return this.produces.indexOf(accepts) !== -1 || this.produces.indexOf('*/*') !== -1;
4811};
4812
Jian Li83d87a72016-04-20 15:38:24 -07004813Operation.prototype.asCurl = function (args1, args2) {
4814 var opts = {mock: true};
4815 if (typeof args2 === 'object') {
4816 for (var argKey in args2) {
4817 opts[argKey] = args2[argKey];
4818 }
4819 }
4820 var obj = this.execute(args1, opts);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004821
Jian Li83d87a72016-04-20 15:38:24 -07004822 this.clientAuthorizations.apply(obj, this.operation.security);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004823
4824 var results = [];
4825
4826 results.push('-X ' + this.method.toUpperCase());
4827
Jian Li83d87a72016-04-20 15:38:24 -07004828 if (typeof obj.headers !== 'undefined') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004829 var key;
4830
4831 for (key in obj.headers) {
Jian Li83d87a72016-04-20 15:38:24 -07004832 var value = obj.headers[key];
4833 if(typeof value === 'string'){
4834 value = value.replace(/\'/g, '\\u0027');
4835 }
4836 results.push('--header \'' + key + ': ' + value + '\'');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004837 }
4838 }
4839
4840 if (obj.body) {
4841 var body;
4842
Jian Li83d87a72016-04-20 15:38:24 -07004843 if (_.isObject(obj.body)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004844 body = JSON.stringify(obj.body);
4845 } else {
4846 body = obj.body;
4847 }
4848
Jian Li83d87a72016-04-20 15:38:24 -07004849 results.push('-d \'' + body.replace(/\'/g, '\\u0027') + '\'');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004850 }
4851
Jian Li83d87a72016-04-20 15:38:24 -07004852 return 'curl ' + (results.join(' ')) + ' \'' + obj.url + '\'';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004853};
4854
4855Operation.prototype.encodePathCollection = function (type, name, value) {
4856 var encoded = '';
4857 var i;
4858 var separator = '';
4859
4860 if (type === 'ssv') {
4861 separator = '%20';
4862 } else if (type === 'tsv') {
4863 separator = '\\t';
4864 } else if (type === 'pipes') {
4865 separator = '|';
4866 } else {
4867 separator = ',';
4868 }
4869
4870 for (i = 0; i < value.length; i++) {
4871 if (i === 0) {
4872 encoded = this.encodeQueryParam(value[i]);
4873 } else {
4874 encoded += separator + this.encodeQueryParam(value[i]);
4875 }
4876 }
4877
4878 return encoded;
4879};
4880
4881Operation.prototype.encodeQueryCollection = function (type, name, value) {
4882 var encoded = '';
4883 var i;
4884
4885 if (type === 'default' || type === 'multi') {
4886 for (i = 0; i < value.length; i++) {
4887 if (i > 0) {encoded += '&';}
4888
4889 encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4890 }
4891 } else {
4892 var separator = '';
4893
4894 if (type === 'csv') {
4895 separator = ',';
4896 } else if (type === 'ssv') {
4897 separator = '%20';
4898 } else if (type === 'tsv') {
4899 separator = '\\t';
4900 } else if (type === 'pipes') {
4901 separator = '|';
4902 } else if (type === 'brackets') {
4903 for (i = 0; i < value.length; i++) {
4904 if (i !== 0) {
4905 encoded += '&';
4906 }
4907
4908 encoded += this.encodeQueryParam(name) + '[]=' + this.encodeQueryParam(value[i]);
4909 }
4910 }
4911
4912 if (separator !== '') {
4913 for (i = 0; i < value.length; i++) {
4914 if (i === 0) {
4915 encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
4916 } else {
4917 encoded += separator + this.encodeQueryParam(value[i]);
4918 }
4919 }
4920 }
4921 }
4922
4923 return encoded;
4924};
4925
4926Operation.prototype.encodeQueryParam = function (arg) {
4927 return encodeURIComponent(arg);
4928};
4929
4930/**
4931 * TODO revisit, might not want to leave '/'
4932 **/
4933Operation.prototype.encodePathParam = function (pathParam) {
4934 return encodeURIComponent(pathParam);
4935};
4936
Jian Li83d87a72016-04-20 15:38:24 -07004937},{"../helpers":4,"../http":5,"./model":9,"lodash-compat/lang/cloneDeep":142,"lodash-compat/lang/isEmpty":145,"lodash-compat/lang/isObject":148,"lodash-compat/lang/isUndefined":152,"q":161}],11:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004938'use strict';
4939
4940var OperationGroup = module.exports = function (tag, description, externalDocs, operation) {
4941 this.description = description;
4942 this.externalDocs = externalDocs;
4943 this.name = tag;
4944 this.operation = operation;
4945 this.operationsArray = [];
4946 this.path = tag;
4947 this.tag = tag;
4948};
4949
4950OperationGroup.prototype.sort = function () {
4951
4952};
4953
4954
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07004955},{}],12:[function(require,module,exports){
Jian Li83d87a72016-04-20 15:38:24 -07004956
4957},{}],13:[function(require,module,exports){
4958// shim for using process in browser
4959
4960var process = module.exports = {};
4961var queue = [];
4962var draining = false;
4963
4964function drainQueue() {
4965 if (draining) {
4966 return;
4967 }
4968 draining = true;
4969 var currentQueue;
4970 var len = queue.length;
4971 while(len) {
4972 currentQueue = queue;
4973 queue = [];
4974 var i = -1;
4975 while (++i < len) {
4976 currentQueue[i]();
4977 }
4978 len = queue.length;
4979 }
4980 draining = false;
4981}
4982process.nextTick = function (fun) {
4983 queue.push(fun);
4984 if (!draining) {
4985 setTimeout(drainQueue, 0);
4986 }
4987};
4988
4989process.title = 'browser';
4990process.browser = true;
4991process.env = {};
4992process.argv = [];
4993process.version = ''; // empty string to avoid regexp issues
4994process.versions = {};
4995
4996function noop() {}
4997
4998process.on = noop;
4999process.addListener = noop;
5000process.once = noop;
5001process.off = noop;
5002process.removeListener = noop;
5003process.removeAllListeners = noop;
5004process.emit = noop;
5005
5006process.binding = function (name) {
5007 throw new Error('process.binding is not supported');
5008};
5009
5010// TODO(shtylman)
5011process.cwd = function () { return '/' };
5012process.chdir = function (dir) {
5013 throw new Error('process.chdir is not supported');
5014};
5015process.umask = function() { return 0; };
5016
5017},{}],14:[function(require,module,exports){
5018(function (Buffer){
5019(function () {
5020 "use strict";
5021
5022 function btoa(str) {
5023 var buffer
5024 ;
5025
5026 if (str instanceof Buffer) {
5027 buffer = str;
5028 } else {
5029 buffer = new Buffer(str.toString(), 'binary');
5030 }
5031
5032 return buffer.toString('base64');
5033 }
5034
5035 module.exports = btoa;
5036}());
5037
5038}).call(this,require("buffer").Buffer)
5039//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9idG9hL2luZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uICgpIHtcbiAgXCJ1c2Ugc3RyaWN0XCI7XG5cbiAgZnVuY3Rpb24gYnRvYShzdHIpIHtcbiAgICB2YXIgYnVmZmVyXG4gICAgICA7XG5cbiAgICBpZiAoc3RyIGluc3RhbmNlb2YgQnVmZmVyKSB7XG4gICAgICBidWZmZXIgPSBzdHI7XG4gICAgfSBlbHNlIHtcbiAgICAgIGJ1ZmZlciA9IG5ldyBCdWZmZXIoc3RyLnRvU3RyaW5nKCksICdiaW5hcnknKTtcbiAgICB9XG5cbiAgICByZXR1cm4gYnVmZmVyLnRvU3RyaW5nKCdiYXNlNjQnKTtcbiAgfVxuXG4gIG1vZHVsZS5leHBvcnRzID0gYnRvYTtcbn0oKSk7XG4iXX0=
5040},{"buffer":15}],15:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005041/*!
5042 * The buffer module from node.js, for the browser.
5043 *
5044 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
5045 * @license MIT
5046 */
5047
5048var base64 = require('base64-js')
5049var ieee754 = require('ieee754')
5050var isArray = require('is-array')
5051
5052exports.Buffer = Buffer
5053exports.SlowBuffer = SlowBuffer
5054exports.INSPECT_MAX_BYTES = 50
5055Buffer.poolSize = 8192 // not used by this implementation
5056
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005057var rootParent = {}
5058
5059/**
5060 * If `Buffer.TYPED_ARRAY_SUPPORT`:
5061 * === true Use Uint8Array implementation (fastest)
5062 * === false Use Object implementation (most compatible, even IE6)
5063 *
5064 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
5065 * Opera 11.6+, iOS 4.2+.
5066 *
Jian Li83d87a72016-04-20 15:38:24 -07005067 * Due to various browser bugs, sometimes the Object implementation will be used even
5068 * when the browser supports typed arrays.
5069 *
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005070 * Note:
5071 *
Jian Li83d87a72016-04-20 15:38:24 -07005072 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
5073 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005074 *
Jian Li83d87a72016-04-20 15:38:24 -07005075 * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property
5076 * on objects.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005077 *
Jian Li83d87a72016-04-20 15:38:24 -07005078 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005079 *
Jian Li83d87a72016-04-20 15:38:24 -07005080 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
5081 * incorrect length in some situations.
5082
5083 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
5084 * get the Object implementation, which is slower but behaves correctly.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005085 */
5086Buffer.TYPED_ARRAY_SUPPORT = (function () {
Jian Li83d87a72016-04-20 15:38:24 -07005087 function Bar () {}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005088 try {
Jian Li83d87a72016-04-20 15:38:24 -07005089 var arr = new Uint8Array(1)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005090 arr.foo = function () { return 42 }
Jian Li83d87a72016-04-20 15:38:24 -07005091 arr.constructor = Bar
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005092 return arr.foo() === 42 && // typed array instances can be augmented
Jian Li83d87a72016-04-20 15:38:24 -07005093 arr.constructor === Bar && // constructor can be set
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005094 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
Jian Li83d87a72016-04-20 15:38:24 -07005095 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005096 } catch (e) {
5097 return false
5098 }
5099})()
5100
Jian Li83d87a72016-04-20 15:38:24 -07005101function kMaxLength () {
5102 return Buffer.TYPED_ARRAY_SUPPORT
5103 ? 0x7fffffff
5104 : 0x3fffffff
5105}
5106
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005107/**
5108 * Class: Buffer
5109 * =============
5110 *
5111 * The Buffer constructor returns instances of `Uint8Array` that are augmented
5112 * with function properties for all the node `Buffer` API functions. We use
5113 * `Uint8Array` so that square bracket notation works as expected -- it returns
5114 * a single octet.
5115 *
5116 * By augmenting the instances, we can avoid modifying the `Uint8Array`
5117 * prototype.
5118 */
Jian Li83d87a72016-04-20 15:38:24 -07005119function Buffer (arg) {
5120 if (!(this instanceof Buffer)) {
5121 // Avoid going through an ArgumentsAdaptorTrampoline in the common case.
5122 if (arguments.length > 1) return new Buffer(arg, arguments[1])
5123 return new Buffer(arg)
5124 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005125
Jian Li83d87a72016-04-20 15:38:24 -07005126 this.length = 0
5127 this.parent = undefined
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005128
Jian Li83d87a72016-04-20 15:38:24 -07005129 // Common case.
5130 if (typeof arg === 'number') {
5131 return fromNumber(this, arg)
5132 }
5133
5134 // Slightly less common case.
5135 if (typeof arg === 'string') {
5136 return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
5137 }
5138
5139 // Unusual.
5140 return fromObject(this, arg)
5141}
5142
5143function fromNumber (that, length) {
5144 that = allocate(that, length < 0 ? 0 : checked(length) | 0)
5145 if (!Buffer.TYPED_ARRAY_SUPPORT) {
5146 for (var i = 0; i < length; i++) {
5147 that[i] = 0
5148 }
5149 }
5150 return that
5151}
5152
5153function fromString (that, string, encoding) {
5154 if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
5155
5156 // Assumption: byteLength() return value is always < kMaxLength.
5157 var length = byteLength(string, encoding) | 0
5158 that = allocate(that, length)
5159
5160 that.write(string, encoding)
5161 return that
5162}
5163
5164function fromObject (that, object) {
5165 if (Buffer.isBuffer(object)) return fromBuffer(that, object)
5166
5167 if (isArray(object)) return fromArray(that, object)
5168
5169 if (object == null) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005170 throw new TypeError('must start with number, buffer, array or string')
5171 }
5172
Jian Li83d87a72016-04-20 15:38:24 -07005173 if (typeof ArrayBuffer !== 'undefined') {
5174 if (object.buffer instanceof ArrayBuffer) {
5175 return fromTypedArray(that, object)
5176 }
5177 if (object instanceof ArrayBuffer) {
5178 return fromArrayBuffer(that, object)
5179 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005180 }
5181
Jian Li83d87a72016-04-20 15:38:24 -07005182 if (object.length) return fromArrayLike(that, object)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005183
Jian Li83d87a72016-04-20 15:38:24 -07005184 return fromJsonObject(that, object)
5185}
5186
5187function fromBuffer (that, buffer) {
5188 var length = checked(buffer.length) | 0
5189 that = allocate(that, length)
5190 buffer.copy(that, 0, 0, length)
5191 return that
5192}
5193
5194function fromArray (that, array) {
5195 var length = checked(array.length) | 0
5196 that = allocate(that, length)
5197 for (var i = 0; i < length; i += 1) {
5198 that[i] = array[i] & 255
5199 }
5200 return that
5201}
5202
5203// Duplicate of fromArray() to keep fromArray() monomorphic.
5204function fromTypedArray (that, array) {
5205 var length = checked(array.length) | 0
5206 that = allocate(that, length)
5207 // Truncating the elements is probably not what people expect from typed
5208 // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
5209 // of the old Buffer constructor.
5210 for (var i = 0; i < length; i += 1) {
5211 that[i] = array[i] & 255
5212 }
5213 return that
5214}
5215
5216function fromArrayBuffer (that, array) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005217 if (Buffer.TYPED_ARRAY_SUPPORT) {
Jian Li83d87a72016-04-20 15:38:24 -07005218 // Return an augmented `Uint8Array` instance, for best performance
5219 array.byteLength
5220 that = Buffer._augment(new Uint8Array(array))
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005221 } else {
Jian Li83d87a72016-04-20 15:38:24 -07005222 // Fallback: Return an object instance of the Buffer class
5223 that = fromTypedArray(that, new Uint8Array(array))
5224 }
5225 return that
5226}
5227
5228function fromArrayLike (that, array) {
5229 var length = checked(array.length) | 0
5230 that = allocate(that, length)
5231 for (var i = 0; i < length; i += 1) {
5232 that[i] = array[i] & 255
5233 }
5234 return that
5235}
5236
5237// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
5238// Returns a zero-length buffer for inputs that don't conform to the spec.
5239function fromJsonObject (that, object) {
5240 var array
5241 var length = 0
5242
5243 if (object.type === 'Buffer' && isArray(object.data)) {
5244 array = object.data
5245 length = checked(array.length) | 0
5246 }
5247 that = allocate(that, length)
5248
5249 for (var i = 0; i < length; i += 1) {
5250 that[i] = array[i] & 255
5251 }
5252 return that
5253}
5254
5255function allocate (that, length) {
5256 if (Buffer.TYPED_ARRAY_SUPPORT) {
5257 // Return an augmented `Uint8Array` instance, for best performance
5258 that = Buffer._augment(new Uint8Array(length))
5259 } else {
5260 // Fallback: Return an object instance of the Buffer class
5261 that.length = length
5262 that._isBuffer = true
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005263 }
5264
Jian Li83d87a72016-04-20 15:38:24 -07005265 var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
5266 if (fromPool) that.parent = rootParent
5267
5268 return that
5269}
5270
5271function checked (length) {
5272 // Note: cannot use `length < kMaxLength` here because that fails when
5273 // length is NaN (which is otherwise coerced to zero.)
5274 if (length >= kMaxLength()) {
5275 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
5276 'size: 0x' + kMaxLength().toString(16) + ' bytes')
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005277 }
Jian Li83d87a72016-04-20 15:38:24 -07005278 return length | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005279}
5280
5281function SlowBuffer (subject, encoding) {
5282 if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
5283
5284 var buf = new Buffer(subject, encoding)
5285 delete buf.parent
5286 return buf
5287}
5288
5289Buffer.isBuffer = function isBuffer (b) {
5290 return !!(b != null && b._isBuffer)
5291}
5292
5293Buffer.compare = function compare (a, b) {
5294 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
5295 throw new TypeError('Arguments must be Buffers')
5296 }
5297
5298 if (a === b) return 0
5299
5300 var x = a.length
5301 var y = b.length
Jian Li83d87a72016-04-20 15:38:24 -07005302
5303 var i = 0
5304 var len = Math.min(x, y)
5305 while (i < len) {
5306 if (a[i] !== b[i]) break
5307
5308 ++i
5309 }
5310
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005311 if (i !== len) {
5312 x = a[i]
5313 y = b[i]
5314 }
Jian Li83d87a72016-04-20 15:38:24 -07005315
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005316 if (x < y) return -1
5317 if (y < x) return 1
5318 return 0
5319}
5320
5321Buffer.isEncoding = function isEncoding (encoding) {
5322 switch (String(encoding).toLowerCase()) {
5323 case 'hex':
5324 case 'utf8':
5325 case 'utf-8':
5326 case 'ascii':
5327 case 'binary':
5328 case 'base64':
5329 case 'raw':
5330 case 'ucs2':
5331 case 'ucs-2':
5332 case 'utf16le':
5333 case 'utf-16le':
5334 return true
5335 default:
5336 return false
5337 }
5338}
5339
Jian Li83d87a72016-04-20 15:38:24 -07005340Buffer.concat = function concat (list, length) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005341 if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
5342
5343 if (list.length === 0) {
5344 return new Buffer(0)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005345 }
5346
5347 var i
Jian Li83d87a72016-04-20 15:38:24 -07005348 if (length === undefined) {
5349 length = 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005350 for (i = 0; i < list.length; i++) {
Jian Li83d87a72016-04-20 15:38:24 -07005351 length += list[i].length
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005352 }
5353 }
5354
Jian Li83d87a72016-04-20 15:38:24 -07005355 var buf = new Buffer(length)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005356 var pos = 0
5357 for (i = 0; i < list.length; i++) {
5358 var item = list[i]
5359 item.copy(buf, pos)
5360 pos += item.length
5361 }
5362 return buf
5363}
5364
Jian Li83d87a72016-04-20 15:38:24 -07005365function byteLength (string, encoding) {
5366 if (typeof string !== 'string') string = '' + string
5367
5368 var len = string.length
5369 if (len === 0) return 0
5370
5371 // Use a for loop to avoid recursion
5372 var loweredCase = false
5373 for (;;) {
5374 switch (encoding) {
5375 case 'ascii':
5376 case 'binary':
5377 // Deprecated
5378 case 'raw':
5379 case 'raws':
5380 return len
5381 case 'utf8':
5382 case 'utf-8':
5383 return utf8ToBytes(string).length
5384 case 'ucs2':
5385 case 'ucs-2':
5386 case 'utf16le':
5387 case 'utf-16le':
5388 return len * 2
5389 case 'hex':
5390 return len >>> 1
5391 case 'base64':
5392 return base64ToBytes(string).length
5393 default:
5394 if (loweredCase) return utf8ToBytes(string).length // assume utf8
5395 encoding = ('' + encoding).toLowerCase()
5396 loweredCase = true
5397 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005398 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005399}
Jian Li83d87a72016-04-20 15:38:24 -07005400Buffer.byteLength = byteLength
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005401
5402// pre-set for values that may exist in the future
5403Buffer.prototype.length = undefined
5404Buffer.prototype.parent = undefined
5405
Jian Li83d87a72016-04-20 15:38:24 -07005406function slowToString (encoding, start, end) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005407 var loweredCase = false
5408
Jian Li83d87a72016-04-20 15:38:24 -07005409 start = start | 0
5410 end = end === undefined || end === Infinity ? this.length : end | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005411
5412 if (!encoding) encoding = 'utf8'
5413 if (start < 0) start = 0
5414 if (end > this.length) end = this.length
5415 if (end <= start) return ''
5416
5417 while (true) {
5418 switch (encoding) {
5419 case 'hex':
5420 return hexSlice(this, start, end)
5421
5422 case 'utf8':
5423 case 'utf-8':
5424 return utf8Slice(this, start, end)
5425
5426 case 'ascii':
5427 return asciiSlice(this, start, end)
5428
5429 case 'binary':
5430 return binarySlice(this, start, end)
5431
5432 case 'base64':
5433 return base64Slice(this, start, end)
5434
5435 case 'ucs2':
5436 case 'ucs-2':
5437 case 'utf16le':
5438 case 'utf-16le':
5439 return utf16leSlice(this, start, end)
5440
5441 default:
5442 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5443 encoding = (encoding + '').toLowerCase()
5444 loweredCase = true
5445 }
5446 }
5447}
5448
Jian Li83d87a72016-04-20 15:38:24 -07005449Buffer.prototype.toString = function toString () {
5450 var length = this.length | 0
5451 if (length === 0) return ''
5452 if (arguments.length === 0) return utf8Slice(this, 0, length)
5453 return slowToString.apply(this, arguments)
5454}
5455
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005456Buffer.prototype.equals = function equals (b) {
5457 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
5458 if (this === b) return true
5459 return Buffer.compare(this, b) === 0
5460}
5461
5462Buffer.prototype.inspect = function inspect () {
5463 var str = ''
5464 var max = exports.INSPECT_MAX_BYTES
5465 if (this.length > 0) {
5466 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
5467 if (this.length > max) str += ' ... '
5468 }
5469 return '<Buffer ' + str + '>'
5470}
5471
5472Buffer.prototype.compare = function compare (b) {
5473 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
5474 if (this === b) return 0
5475 return Buffer.compare(this, b)
5476}
5477
5478Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
5479 if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
5480 else if (byteOffset < -0x80000000) byteOffset = -0x80000000
5481 byteOffset >>= 0
5482
5483 if (this.length === 0) return -1
5484 if (byteOffset >= this.length) return -1
5485
5486 // Negative offsets start from the end of the buffer
5487 if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
5488
5489 if (typeof val === 'string') {
5490 if (val.length === 0) return -1 // special case: looking for empty string always fails
5491 return String.prototype.indexOf.call(this, val, byteOffset)
5492 }
5493 if (Buffer.isBuffer(val)) {
5494 return arrayIndexOf(this, val, byteOffset)
5495 }
5496 if (typeof val === 'number') {
5497 if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
5498 return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
5499 }
5500 return arrayIndexOf(this, [ val ], byteOffset)
5501 }
5502
5503 function arrayIndexOf (arr, val, byteOffset) {
5504 var foundIndex = -1
5505 for (var i = 0; byteOffset + i < arr.length; i++) {
5506 if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
5507 if (foundIndex === -1) foundIndex = i
5508 if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
5509 } else {
5510 foundIndex = -1
5511 }
5512 }
5513 return -1
5514 }
5515
5516 throw new TypeError('val must be string, number or Buffer')
5517}
5518
Jian Li83d87a72016-04-20 15:38:24 -07005519// `get` is deprecated
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005520Buffer.prototype.get = function get (offset) {
5521 console.log('.get() is deprecated. Access using array indexes instead.')
5522 return this.readUInt8(offset)
5523}
5524
Jian Li83d87a72016-04-20 15:38:24 -07005525// `set` is deprecated
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005526Buffer.prototype.set = function set (v, offset) {
5527 console.log('.set() is deprecated. Access using array indexes instead.')
5528 return this.writeUInt8(v, offset)
5529}
5530
5531function hexWrite (buf, string, offset, length) {
5532 offset = Number(offset) || 0
5533 var remaining = buf.length - offset
5534 if (!length) {
5535 length = remaining
5536 } else {
5537 length = Number(length)
5538 if (length > remaining) {
5539 length = remaining
5540 }
5541 }
5542
5543 // must be an even number of digits
5544 var strLen = string.length
5545 if (strLen % 2 !== 0) throw new Error('Invalid hex string')
5546
5547 if (length > strLen / 2) {
5548 length = strLen / 2
5549 }
5550 for (var i = 0; i < length; i++) {
5551 var parsed = parseInt(string.substr(i * 2, 2), 16)
5552 if (isNaN(parsed)) throw new Error('Invalid hex string')
5553 buf[offset + i] = parsed
5554 }
5555 return i
5556}
5557
5558function utf8Write (buf, string, offset, length) {
Jian Li83d87a72016-04-20 15:38:24 -07005559 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005560}
5561
5562function asciiWrite (buf, string, offset, length) {
Jian Li83d87a72016-04-20 15:38:24 -07005563 return blitBuffer(asciiToBytes(string), buf, offset, length)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005564}
5565
5566function binaryWrite (buf, string, offset, length) {
5567 return asciiWrite(buf, string, offset, length)
5568}
5569
5570function base64Write (buf, string, offset, length) {
Jian Li83d87a72016-04-20 15:38:24 -07005571 return blitBuffer(base64ToBytes(string), buf, offset, length)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005572}
5573
Jian Li83d87a72016-04-20 15:38:24 -07005574function ucs2Write (buf, string, offset, length) {
5575 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005576}
5577
5578Buffer.prototype.write = function write (string, offset, length, encoding) {
Jian Li83d87a72016-04-20 15:38:24 -07005579 // Buffer#write(string)
5580 if (offset === undefined) {
5581 encoding = 'utf8'
5582 length = this.length
5583 offset = 0
5584 // Buffer#write(string, encoding)
5585 } else if (length === undefined && typeof offset === 'string') {
5586 encoding = offset
5587 length = this.length
5588 offset = 0
5589 // Buffer#write(string, offset[, length][, encoding])
5590 } else if (isFinite(offset)) {
5591 offset = offset | 0
5592 if (isFinite(length)) {
5593 length = length | 0
5594 if (encoding === undefined) encoding = 'utf8'
5595 } else {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005596 encoding = length
5597 length = undefined
5598 }
Jian Li83d87a72016-04-20 15:38:24 -07005599 // legacy write(string, encoding, offset, length) - remove in v0.13
5600 } else {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005601 var swap = encoding
5602 encoding = offset
Jian Li83d87a72016-04-20 15:38:24 -07005603 offset = length | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005604 length = swap
5605 }
5606
Jian Li83d87a72016-04-20 15:38:24 -07005607 var remaining = this.length - offset
5608 if (length === undefined || length > remaining) length = remaining
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005609
Jian Li83d87a72016-04-20 15:38:24 -07005610 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005611 throw new RangeError('attempt to write outside buffer bounds')
5612 }
5613
Jian Li83d87a72016-04-20 15:38:24 -07005614 if (!encoding) encoding = 'utf8'
5615
5616 var loweredCase = false
5617 for (;;) {
5618 switch (encoding) {
5619 case 'hex':
5620 return hexWrite(this, string, offset, length)
5621
5622 case 'utf8':
5623 case 'utf-8':
5624 return utf8Write(this, string, offset, length)
5625
5626 case 'ascii':
5627 return asciiWrite(this, string, offset, length)
5628
5629 case 'binary':
5630 return binaryWrite(this, string, offset, length)
5631
5632 case 'base64':
5633 // Warning: maxLength not taken into account in base64Write
5634 return base64Write(this, string, offset, length)
5635
5636 case 'ucs2':
5637 case 'ucs-2':
5638 case 'utf16le':
5639 case 'utf-16le':
5640 return ucs2Write(this, string, offset, length)
5641
5642 default:
5643 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5644 encoding = ('' + encoding).toLowerCase()
5645 loweredCase = true
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005646 }
5647 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005648}
5649
5650Buffer.prototype.toJSON = function toJSON () {
5651 return {
5652 type: 'Buffer',
5653 data: Array.prototype.slice.call(this._arr || this, 0)
5654 }
5655}
5656
5657function base64Slice (buf, start, end) {
5658 if (start === 0 && end === buf.length) {
5659 return base64.fromByteArray(buf)
5660 } else {
5661 return base64.fromByteArray(buf.slice(start, end))
5662 }
5663}
5664
5665function utf8Slice (buf, start, end) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005666 end = Math.min(buf.length, end)
Jian Li83d87a72016-04-20 15:38:24 -07005667 var res = []
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005668
Jian Li83d87a72016-04-20 15:38:24 -07005669 var i = start
5670 while (i < end) {
5671 var firstByte = buf[i]
5672 var codePoint = null
5673 var bytesPerSequence = (firstByte > 0xEF) ? 4
5674 : (firstByte > 0xDF) ? 3
5675 : (firstByte > 0xBF) ? 2
5676 : 1
5677
5678 if (i + bytesPerSequence <= end) {
5679 var secondByte, thirdByte, fourthByte, tempCodePoint
5680
5681 switch (bytesPerSequence) {
5682 case 1:
5683 if (firstByte < 0x80) {
5684 codePoint = firstByte
5685 }
5686 break
5687 case 2:
5688 secondByte = buf[i + 1]
5689 if ((secondByte & 0xC0) === 0x80) {
5690 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
5691 if (tempCodePoint > 0x7F) {
5692 codePoint = tempCodePoint
5693 }
5694 }
5695 break
5696 case 3:
5697 secondByte = buf[i + 1]
5698 thirdByte = buf[i + 2]
5699 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
5700 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
5701 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
5702 codePoint = tempCodePoint
5703 }
5704 }
5705 break
5706 case 4:
5707 secondByte = buf[i + 1]
5708 thirdByte = buf[i + 2]
5709 fourthByte = buf[i + 3]
5710 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
5711 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
5712 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
5713 codePoint = tempCodePoint
5714 }
5715 }
5716 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005717 }
Jian Li83d87a72016-04-20 15:38:24 -07005718
5719 if (codePoint === null) {
5720 // we did not generate a valid codePoint so insert a
5721 // replacement char (U+FFFD) and advance only 1 byte
5722 codePoint = 0xFFFD
5723 bytesPerSequence = 1
5724 } else if (codePoint > 0xFFFF) {
5725 // encode to utf16 (surrogate pair dance)
5726 codePoint -= 0x10000
5727 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
5728 codePoint = 0xDC00 | codePoint & 0x3FF
5729 }
5730
5731 res.push(codePoint)
5732 i += bytesPerSequence
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005733 }
5734
Jian Li83d87a72016-04-20 15:38:24 -07005735 return decodeCodePointsArray(res)
5736}
5737
5738// Based on http://stackoverflow.com/a/22747272/680742, the browser with
5739// the lowest limit is Chrome, with 0x10000 args.
5740// We go 1 magnitude less, for safety
5741var MAX_ARGUMENTS_LENGTH = 0x1000
5742
5743function decodeCodePointsArray (codePoints) {
5744 var len = codePoints.length
5745 if (len <= MAX_ARGUMENTS_LENGTH) {
5746 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
5747 }
5748
5749 // Decode in chunks to avoid "call stack size exceeded".
5750 var res = ''
5751 var i = 0
5752 while (i < len) {
5753 res += String.fromCharCode.apply(
5754 String,
5755 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
5756 )
5757 }
5758 return res
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005759}
5760
5761function asciiSlice (buf, start, end) {
5762 var ret = ''
5763 end = Math.min(buf.length, end)
5764
5765 for (var i = start; i < end; i++) {
5766 ret += String.fromCharCode(buf[i] & 0x7F)
5767 }
5768 return ret
5769}
5770
5771function binarySlice (buf, start, end) {
5772 var ret = ''
5773 end = Math.min(buf.length, end)
5774
5775 for (var i = start; i < end; i++) {
5776 ret += String.fromCharCode(buf[i])
5777 }
5778 return ret
5779}
5780
5781function hexSlice (buf, start, end) {
5782 var len = buf.length
5783
5784 if (!start || start < 0) start = 0
5785 if (!end || end < 0 || end > len) end = len
5786
5787 var out = ''
5788 for (var i = start; i < end; i++) {
5789 out += toHex(buf[i])
5790 }
5791 return out
5792}
5793
5794function utf16leSlice (buf, start, end) {
5795 var bytes = buf.slice(start, end)
5796 var res = ''
5797 for (var i = 0; i < bytes.length; i += 2) {
5798 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
5799 }
5800 return res
5801}
5802
5803Buffer.prototype.slice = function slice (start, end) {
5804 var len = this.length
5805 start = ~~start
5806 end = end === undefined ? len : ~~end
5807
5808 if (start < 0) {
5809 start += len
5810 if (start < 0) start = 0
5811 } else if (start > len) {
5812 start = len
5813 }
5814
5815 if (end < 0) {
5816 end += len
5817 if (end < 0) end = 0
5818 } else if (end > len) {
5819 end = len
5820 }
5821
5822 if (end < start) end = start
5823
5824 var newBuf
5825 if (Buffer.TYPED_ARRAY_SUPPORT) {
5826 newBuf = Buffer._augment(this.subarray(start, end))
5827 } else {
5828 var sliceLen = end - start
5829 newBuf = new Buffer(sliceLen, undefined)
5830 for (var i = 0; i < sliceLen; i++) {
5831 newBuf[i] = this[i + start]
5832 }
5833 }
5834
5835 if (newBuf.length) newBuf.parent = this.parent || this
5836
5837 return newBuf
5838}
5839
5840/*
5841 * Need to make sure that buffer isn't trying to write out of bounds.
5842 */
5843function checkOffset (offset, ext, length) {
5844 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
5845 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
5846}
5847
5848Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07005849 offset = offset | 0
5850 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005851 if (!noAssert) checkOffset(offset, byteLength, this.length)
5852
5853 var val = this[offset]
5854 var mul = 1
5855 var i = 0
5856 while (++i < byteLength && (mul *= 0x100)) {
5857 val += this[offset + i] * mul
5858 }
5859
5860 return val
5861}
5862
5863Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07005864 offset = offset | 0
5865 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005866 if (!noAssert) {
5867 checkOffset(offset, byteLength, this.length)
5868 }
5869
5870 var val = this[offset + --byteLength]
5871 var mul = 1
5872 while (byteLength > 0 && (mul *= 0x100)) {
5873 val += this[offset + --byteLength] * mul
5874 }
5875
5876 return val
5877}
5878
5879Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
5880 if (!noAssert) checkOffset(offset, 1, this.length)
5881 return this[offset]
5882}
5883
5884Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
5885 if (!noAssert) checkOffset(offset, 2, this.length)
5886 return this[offset] | (this[offset + 1] << 8)
5887}
5888
5889Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
5890 if (!noAssert) checkOffset(offset, 2, this.length)
5891 return (this[offset] << 8) | this[offset + 1]
5892}
5893
5894Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
5895 if (!noAssert) checkOffset(offset, 4, this.length)
5896
5897 return ((this[offset]) |
5898 (this[offset + 1] << 8) |
5899 (this[offset + 2] << 16)) +
5900 (this[offset + 3] * 0x1000000)
5901}
5902
5903Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
5904 if (!noAssert) checkOffset(offset, 4, this.length)
5905
5906 return (this[offset] * 0x1000000) +
5907 ((this[offset + 1] << 16) |
5908 (this[offset + 2] << 8) |
5909 this[offset + 3])
5910}
5911
5912Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07005913 offset = offset | 0
5914 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005915 if (!noAssert) checkOffset(offset, byteLength, this.length)
5916
5917 var val = this[offset]
5918 var mul = 1
5919 var i = 0
5920 while (++i < byteLength && (mul *= 0x100)) {
5921 val += this[offset + i] * mul
5922 }
5923 mul *= 0x80
5924
5925 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5926
5927 return val
5928}
5929
5930Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07005931 offset = offset | 0
5932 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07005933 if (!noAssert) checkOffset(offset, byteLength, this.length)
5934
5935 var i = byteLength
5936 var mul = 1
5937 var val = this[offset + --i]
5938 while (i > 0 && (mul *= 0x100)) {
5939 val += this[offset + --i] * mul
5940 }
5941 mul *= 0x80
5942
5943 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5944
5945 return val
5946}
5947
5948Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
5949 if (!noAssert) checkOffset(offset, 1, this.length)
5950 if (!(this[offset] & 0x80)) return (this[offset])
5951 return ((0xff - this[offset] + 1) * -1)
5952}
5953
5954Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
5955 if (!noAssert) checkOffset(offset, 2, this.length)
5956 var val = this[offset] | (this[offset + 1] << 8)
5957 return (val & 0x8000) ? val | 0xFFFF0000 : val
5958}
5959
5960Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
5961 if (!noAssert) checkOffset(offset, 2, this.length)
5962 var val = this[offset + 1] | (this[offset] << 8)
5963 return (val & 0x8000) ? val | 0xFFFF0000 : val
5964}
5965
5966Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
5967 if (!noAssert) checkOffset(offset, 4, this.length)
5968
5969 return (this[offset]) |
5970 (this[offset + 1] << 8) |
5971 (this[offset + 2] << 16) |
5972 (this[offset + 3] << 24)
5973}
5974
5975Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
5976 if (!noAssert) checkOffset(offset, 4, this.length)
5977
5978 return (this[offset] << 24) |
5979 (this[offset + 1] << 16) |
5980 (this[offset + 2] << 8) |
5981 (this[offset + 3])
5982}
5983
5984Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
5985 if (!noAssert) checkOffset(offset, 4, this.length)
5986 return ieee754.read(this, offset, true, 23, 4)
5987}
5988
5989Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
5990 if (!noAssert) checkOffset(offset, 4, this.length)
5991 return ieee754.read(this, offset, false, 23, 4)
5992}
5993
5994Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
5995 if (!noAssert) checkOffset(offset, 8, this.length)
5996 return ieee754.read(this, offset, true, 52, 8)
5997}
5998
5999Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
6000 if (!noAssert) checkOffset(offset, 8, this.length)
6001 return ieee754.read(this, offset, false, 52, 8)
6002}
6003
6004function checkInt (buf, value, offset, ext, max, min) {
6005 if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
6006 if (value > max || value < min) throw new RangeError('value is out of bounds')
6007 if (offset + ext > buf.length) throw new RangeError('index out of range')
6008}
6009
6010Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
6011 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006012 offset = offset | 0
6013 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006014 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
6015
6016 var mul = 1
6017 var i = 0
6018 this[offset] = value & 0xFF
6019 while (++i < byteLength && (mul *= 0x100)) {
Jian Li83d87a72016-04-20 15:38:24 -07006020 this[offset + i] = (value / mul) & 0xFF
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006021 }
6022
6023 return offset + byteLength
6024}
6025
6026Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
6027 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006028 offset = offset | 0
6029 byteLength = byteLength | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006030 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
6031
6032 var i = byteLength - 1
6033 var mul = 1
6034 this[offset + i] = value & 0xFF
6035 while (--i >= 0 && (mul *= 0x100)) {
Jian Li83d87a72016-04-20 15:38:24 -07006036 this[offset + i] = (value / mul) & 0xFF
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006037 }
6038
6039 return offset + byteLength
6040}
6041
6042Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
6043 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006044 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006045 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
6046 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
6047 this[offset] = value
6048 return offset + 1
6049}
6050
6051function objectWriteUInt16 (buf, value, offset, littleEndian) {
6052 if (value < 0) value = 0xffff + value + 1
6053 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
6054 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
6055 (littleEndian ? i : 1 - i) * 8
6056 }
6057}
6058
6059Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
6060 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006061 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006062 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
6063 if (Buffer.TYPED_ARRAY_SUPPORT) {
6064 this[offset] = value
6065 this[offset + 1] = (value >>> 8)
6066 } else {
6067 objectWriteUInt16(this, value, offset, true)
6068 }
6069 return offset + 2
6070}
6071
6072Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
6073 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006074 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006075 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
6076 if (Buffer.TYPED_ARRAY_SUPPORT) {
6077 this[offset] = (value >>> 8)
6078 this[offset + 1] = value
6079 } else {
6080 objectWriteUInt16(this, value, offset, false)
6081 }
6082 return offset + 2
6083}
6084
6085function objectWriteUInt32 (buf, value, offset, littleEndian) {
6086 if (value < 0) value = 0xffffffff + value + 1
6087 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
6088 buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
6089 }
6090}
6091
6092Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
6093 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006094 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006095 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
6096 if (Buffer.TYPED_ARRAY_SUPPORT) {
6097 this[offset + 3] = (value >>> 24)
6098 this[offset + 2] = (value >>> 16)
6099 this[offset + 1] = (value >>> 8)
6100 this[offset] = value
6101 } else {
6102 objectWriteUInt32(this, value, offset, true)
6103 }
6104 return offset + 4
6105}
6106
6107Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
6108 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006109 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006110 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
6111 if (Buffer.TYPED_ARRAY_SUPPORT) {
6112 this[offset] = (value >>> 24)
6113 this[offset + 1] = (value >>> 16)
6114 this[offset + 2] = (value >>> 8)
6115 this[offset + 3] = value
6116 } else {
6117 objectWriteUInt32(this, value, offset, false)
6118 }
6119 return offset + 4
6120}
6121
6122Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
6123 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006124 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006125 if (!noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07006126 var limit = Math.pow(2, 8 * byteLength - 1)
6127
6128 checkInt(this, value, offset, byteLength, limit - 1, -limit)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006129 }
6130
6131 var i = 0
6132 var mul = 1
6133 var sub = value < 0 ? 1 : 0
6134 this[offset] = value & 0xFF
6135 while (++i < byteLength && (mul *= 0x100)) {
6136 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
6137 }
6138
6139 return offset + byteLength
6140}
6141
6142Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
6143 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006144 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006145 if (!noAssert) {
Jian Li83d87a72016-04-20 15:38:24 -07006146 var limit = Math.pow(2, 8 * byteLength - 1)
6147
6148 checkInt(this, value, offset, byteLength, limit - 1, -limit)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006149 }
6150
6151 var i = byteLength - 1
6152 var mul = 1
6153 var sub = value < 0 ? 1 : 0
6154 this[offset + i] = value & 0xFF
6155 while (--i >= 0 && (mul *= 0x100)) {
6156 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
6157 }
6158
6159 return offset + byteLength
6160}
6161
6162Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
6163 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006164 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006165 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
6166 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
6167 if (value < 0) value = 0xff + value + 1
6168 this[offset] = value
6169 return offset + 1
6170}
6171
6172Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
6173 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006174 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006175 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
6176 if (Buffer.TYPED_ARRAY_SUPPORT) {
6177 this[offset] = value
6178 this[offset + 1] = (value >>> 8)
6179 } else {
6180 objectWriteUInt16(this, value, offset, true)
6181 }
6182 return offset + 2
6183}
6184
6185Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
6186 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006187 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006188 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
6189 if (Buffer.TYPED_ARRAY_SUPPORT) {
6190 this[offset] = (value >>> 8)
6191 this[offset + 1] = value
6192 } else {
6193 objectWriteUInt16(this, value, offset, false)
6194 }
6195 return offset + 2
6196}
6197
6198Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
6199 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006200 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006201 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
6202 if (Buffer.TYPED_ARRAY_SUPPORT) {
6203 this[offset] = value
6204 this[offset + 1] = (value >>> 8)
6205 this[offset + 2] = (value >>> 16)
6206 this[offset + 3] = (value >>> 24)
6207 } else {
6208 objectWriteUInt32(this, value, offset, true)
6209 }
6210 return offset + 4
6211}
6212
6213Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
6214 value = +value
Jian Li83d87a72016-04-20 15:38:24 -07006215 offset = offset | 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006216 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
6217 if (value < 0) value = 0xffffffff + value + 1
6218 if (Buffer.TYPED_ARRAY_SUPPORT) {
6219 this[offset] = (value >>> 24)
6220 this[offset + 1] = (value >>> 16)
6221 this[offset + 2] = (value >>> 8)
6222 this[offset + 3] = value
6223 } else {
6224 objectWriteUInt32(this, value, offset, false)
6225 }
6226 return offset + 4
6227}
6228
6229function checkIEEE754 (buf, value, offset, ext, max, min) {
6230 if (value > max || value < min) throw new RangeError('value is out of bounds')
6231 if (offset + ext > buf.length) throw new RangeError('index out of range')
6232 if (offset < 0) throw new RangeError('index out of range')
6233}
6234
6235function writeFloat (buf, value, offset, littleEndian, noAssert) {
6236 if (!noAssert) {
6237 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
6238 }
6239 ieee754.write(buf, value, offset, littleEndian, 23, 4)
6240 return offset + 4
6241}
6242
6243Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
6244 return writeFloat(this, value, offset, true, noAssert)
6245}
6246
6247Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
6248 return writeFloat(this, value, offset, false, noAssert)
6249}
6250
6251function writeDouble (buf, value, offset, littleEndian, noAssert) {
6252 if (!noAssert) {
6253 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
6254 }
6255 ieee754.write(buf, value, offset, littleEndian, 52, 8)
6256 return offset + 8
6257}
6258
6259Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
6260 return writeDouble(this, value, offset, true, noAssert)
6261}
6262
6263Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
6264 return writeDouble(this, value, offset, false, noAssert)
6265}
6266
6267// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Jian Li83d87a72016-04-20 15:38:24 -07006268Buffer.prototype.copy = function copy (target, targetStart, start, end) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006269 if (!start) start = 0
6270 if (!end && end !== 0) end = this.length
Jian Li83d87a72016-04-20 15:38:24 -07006271 if (targetStart >= target.length) targetStart = target.length
6272 if (!targetStart) targetStart = 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006273 if (end > 0 && end < start) end = start
6274
6275 // Copy 0 bytes; we're done
6276 if (end === start) return 0
6277 if (target.length === 0 || this.length === 0) return 0
6278
6279 // Fatal error conditions
Jian Li83d87a72016-04-20 15:38:24 -07006280 if (targetStart < 0) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006281 throw new RangeError('targetStart out of bounds')
6282 }
6283 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
6284 if (end < 0) throw new RangeError('sourceEnd out of bounds')
6285
6286 // Are we oob?
6287 if (end > this.length) end = this.length
Jian Li83d87a72016-04-20 15:38:24 -07006288 if (target.length - targetStart < end - start) {
6289 end = target.length - targetStart + start
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006290 }
6291
6292 var len = end - start
Jian Li83d87a72016-04-20 15:38:24 -07006293 var i
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006294
Jian Li83d87a72016-04-20 15:38:24 -07006295 if (this === target && start < targetStart && targetStart < end) {
6296 // descending copy from end
6297 for (i = len - 1; i >= 0; i--) {
6298 target[i + targetStart] = this[i + start]
6299 }
6300 } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
6301 // ascending copy from start
6302 for (i = 0; i < len; i++) {
6303 target[i + targetStart] = this[i + start]
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006304 }
6305 } else {
Jian Li83d87a72016-04-20 15:38:24 -07006306 target._set(this.subarray(start, start + len), targetStart)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006307 }
6308
6309 return len
6310}
6311
6312// fill(value, start=0, end=buffer.length)
6313Buffer.prototype.fill = function fill (value, start, end) {
6314 if (!value) value = 0
6315 if (!start) start = 0
6316 if (!end) end = this.length
6317
6318 if (end < start) throw new RangeError('end < start')
6319
6320 // Fill 0 bytes; we're done
6321 if (end === start) return
6322 if (this.length === 0) return
6323
6324 if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
6325 if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
6326
6327 var i
6328 if (typeof value === 'number') {
6329 for (i = start; i < end; i++) {
6330 this[i] = value
6331 }
6332 } else {
6333 var bytes = utf8ToBytes(value.toString())
6334 var len = bytes.length
6335 for (i = start; i < end; i++) {
6336 this[i] = bytes[i % len]
6337 }
6338 }
6339
6340 return this
6341}
6342
6343/**
6344 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
6345 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
6346 */
6347Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
6348 if (typeof Uint8Array !== 'undefined') {
6349 if (Buffer.TYPED_ARRAY_SUPPORT) {
6350 return (new Buffer(this)).buffer
6351 } else {
6352 var buf = new Uint8Array(this.length)
6353 for (var i = 0, len = buf.length; i < len; i += 1) {
6354 buf[i] = this[i]
6355 }
6356 return buf.buffer
6357 }
6358 } else {
6359 throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
6360 }
6361}
6362
6363// HELPER FUNCTIONS
6364// ================
6365
6366var BP = Buffer.prototype
6367
6368/**
6369 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
6370 */
6371Buffer._augment = function _augment (arr) {
6372 arr.constructor = Buffer
6373 arr._isBuffer = true
6374
6375 // save reference to original Uint8Array set method before overwriting
6376 arr._set = arr.set
6377
Jian Li83d87a72016-04-20 15:38:24 -07006378 // deprecated
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006379 arr.get = BP.get
6380 arr.set = BP.set
6381
6382 arr.write = BP.write
6383 arr.toString = BP.toString
6384 arr.toLocaleString = BP.toString
6385 arr.toJSON = BP.toJSON
6386 arr.equals = BP.equals
6387 arr.compare = BP.compare
6388 arr.indexOf = BP.indexOf
6389 arr.copy = BP.copy
6390 arr.slice = BP.slice
6391 arr.readUIntLE = BP.readUIntLE
6392 arr.readUIntBE = BP.readUIntBE
6393 arr.readUInt8 = BP.readUInt8
6394 arr.readUInt16LE = BP.readUInt16LE
6395 arr.readUInt16BE = BP.readUInt16BE
6396 arr.readUInt32LE = BP.readUInt32LE
6397 arr.readUInt32BE = BP.readUInt32BE
6398 arr.readIntLE = BP.readIntLE
6399 arr.readIntBE = BP.readIntBE
6400 arr.readInt8 = BP.readInt8
6401 arr.readInt16LE = BP.readInt16LE
6402 arr.readInt16BE = BP.readInt16BE
6403 arr.readInt32LE = BP.readInt32LE
6404 arr.readInt32BE = BP.readInt32BE
6405 arr.readFloatLE = BP.readFloatLE
6406 arr.readFloatBE = BP.readFloatBE
6407 arr.readDoubleLE = BP.readDoubleLE
6408 arr.readDoubleBE = BP.readDoubleBE
6409 arr.writeUInt8 = BP.writeUInt8
6410 arr.writeUIntLE = BP.writeUIntLE
6411 arr.writeUIntBE = BP.writeUIntBE
6412 arr.writeUInt16LE = BP.writeUInt16LE
6413 arr.writeUInt16BE = BP.writeUInt16BE
6414 arr.writeUInt32LE = BP.writeUInt32LE
6415 arr.writeUInt32BE = BP.writeUInt32BE
6416 arr.writeIntLE = BP.writeIntLE
6417 arr.writeIntBE = BP.writeIntBE
6418 arr.writeInt8 = BP.writeInt8
6419 arr.writeInt16LE = BP.writeInt16LE
6420 arr.writeInt16BE = BP.writeInt16BE
6421 arr.writeInt32LE = BP.writeInt32LE
6422 arr.writeInt32BE = BP.writeInt32BE
6423 arr.writeFloatLE = BP.writeFloatLE
6424 arr.writeFloatBE = BP.writeFloatBE
6425 arr.writeDoubleLE = BP.writeDoubleLE
6426 arr.writeDoubleBE = BP.writeDoubleBE
6427 arr.fill = BP.fill
6428 arr.inspect = BP.inspect
6429 arr.toArrayBuffer = BP.toArrayBuffer
6430
6431 return arr
6432}
6433
Jian Li83d87a72016-04-20 15:38:24 -07006434var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006435
6436function base64clean (str) {
6437 // Node strips out invalid characters like \n and \t from the string, base64-js does not
6438 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
6439 // Node converts strings with length < 2 to ''
6440 if (str.length < 2) return ''
6441 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
6442 while (str.length % 4 !== 0) {
6443 str = str + '='
6444 }
6445 return str
6446}
6447
6448function stringtrim (str) {
6449 if (str.trim) return str.trim()
6450 return str.replace(/^\s+|\s+$/g, '')
6451}
6452
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006453function toHex (n) {
6454 if (n < 16) return '0' + n.toString(16)
6455 return n.toString(16)
6456}
6457
6458function utf8ToBytes (string, units) {
6459 units = units || Infinity
6460 var codePoint
6461 var length = string.length
6462 var leadSurrogate = null
6463 var bytes = []
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006464
Jian Li83d87a72016-04-20 15:38:24 -07006465 for (var i = 0; i < length; i++) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006466 codePoint = string.charCodeAt(i)
6467
6468 // is surrogate component
6469 if (codePoint > 0xD7FF && codePoint < 0xE000) {
6470 // last char was a lead
Jian Li83d87a72016-04-20 15:38:24 -07006471 if (!leadSurrogate) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006472 // no lead yet
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006473 if (codePoint > 0xDBFF) {
6474 // unexpected trail
6475 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6476 continue
6477 } else if (i + 1 === length) {
6478 // unpaired lead
6479 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6480 continue
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006481 }
Jian Li83d87a72016-04-20 15:38:24 -07006482
6483 // valid lead
6484 leadSurrogate = codePoint
6485
6486 continue
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006487 }
Jian Li83d87a72016-04-20 15:38:24 -07006488
6489 // 2 leads in a row
6490 if (codePoint < 0xDC00) {
6491 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6492 leadSurrogate = codePoint
6493 continue
6494 }
6495
6496 // valid surrogate pair
6497 codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006498 } else if (leadSurrogate) {
6499 // valid bmp char, but last char was a lead
6500 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006501 }
6502
Jian Li83d87a72016-04-20 15:38:24 -07006503 leadSurrogate = null
6504
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006505 // encode utf8
6506 if (codePoint < 0x80) {
6507 if ((units -= 1) < 0) break
6508 bytes.push(codePoint)
6509 } else if (codePoint < 0x800) {
6510 if ((units -= 2) < 0) break
6511 bytes.push(
6512 codePoint >> 0x6 | 0xC0,
6513 codePoint & 0x3F | 0x80
6514 )
6515 } else if (codePoint < 0x10000) {
6516 if ((units -= 3) < 0) break
6517 bytes.push(
6518 codePoint >> 0xC | 0xE0,
6519 codePoint >> 0x6 & 0x3F | 0x80,
6520 codePoint & 0x3F | 0x80
6521 )
Jian Li83d87a72016-04-20 15:38:24 -07006522 } else if (codePoint < 0x110000) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006523 if ((units -= 4) < 0) break
6524 bytes.push(
6525 codePoint >> 0x12 | 0xF0,
6526 codePoint >> 0xC & 0x3F | 0x80,
6527 codePoint >> 0x6 & 0x3F | 0x80,
6528 codePoint & 0x3F | 0x80
6529 )
6530 } else {
6531 throw new Error('Invalid code point')
6532 }
6533 }
6534
6535 return bytes
6536}
6537
6538function asciiToBytes (str) {
6539 var byteArray = []
6540 for (var i = 0; i < str.length; i++) {
6541 // Node's code seems to be doing this and not & 0x7F..
6542 byteArray.push(str.charCodeAt(i) & 0xFF)
6543 }
6544 return byteArray
6545}
6546
6547function utf16leToBytes (str, units) {
6548 var c, hi, lo
6549 var byteArray = []
6550 for (var i = 0; i < str.length; i++) {
6551 if ((units -= 2) < 0) break
6552
6553 c = str.charCodeAt(i)
6554 hi = c >> 8
6555 lo = c % 256
6556 byteArray.push(lo)
6557 byteArray.push(hi)
6558 }
6559
6560 return byteArray
6561}
6562
6563function base64ToBytes (str) {
6564 return base64.toByteArray(base64clean(str))
6565}
6566
6567function blitBuffer (src, dst, offset, length) {
6568 for (var i = 0; i < length; i++) {
6569 if ((i + offset >= dst.length) || (i >= src.length)) break
6570 dst[i + offset] = src[i]
6571 }
6572 return i
6573}
6574
Jian Li83d87a72016-04-20 15:38:24 -07006575},{"base64-js":16,"ieee754":17,"is-array":18}],16:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006576var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6577
6578;(function (exports) {
6579 'use strict';
6580
6581 var Arr = (typeof Uint8Array !== 'undefined')
6582 ? Uint8Array
6583 : Array
6584
6585 var PLUS = '+'.charCodeAt(0)
6586 var SLASH = '/'.charCodeAt(0)
6587 var NUMBER = '0'.charCodeAt(0)
6588 var LOWER = 'a'.charCodeAt(0)
6589 var UPPER = 'A'.charCodeAt(0)
6590 var PLUS_URL_SAFE = '-'.charCodeAt(0)
6591 var SLASH_URL_SAFE = '_'.charCodeAt(0)
6592
6593 function decode (elt) {
6594 var code = elt.charCodeAt(0)
6595 if (code === PLUS ||
6596 code === PLUS_URL_SAFE)
6597 return 62 // '+'
6598 if (code === SLASH ||
6599 code === SLASH_URL_SAFE)
6600 return 63 // '/'
6601 if (code < NUMBER)
6602 return -1 //no match
6603 if (code < NUMBER + 10)
6604 return code - NUMBER + 26 + 26
6605 if (code < UPPER + 26)
6606 return code - UPPER
6607 if (code < LOWER + 26)
6608 return code - LOWER + 26
6609 }
6610
6611 function b64ToByteArray (b64) {
6612 var i, j, l, tmp, placeHolders, arr
6613
6614 if (b64.length % 4 > 0) {
6615 throw new Error('Invalid string. Length must be a multiple of 4')
6616 }
6617
6618 // the number of equal signs (place holders)
6619 // if there are two placeholders, than the two characters before it
6620 // represent one byte
6621 // if there is only one, then the three characters before it represent 2 bytes
6622 // this is just a cheap hack to not do indexOf twice
6623 var len = b64.length
6624 placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
6625
6626 // base64 is 4/3 + up to two characters of the original data
6627 arr = new Arr(b64.length * 3 / 4 - placeHolders)
6628
6629 // if there are placeholders, only get up to the last complete 4 chars
6630 l = placeHolders > 0 ? b64.length - 4 : b64.length
6631
6632 var L = 0
6633
6634 function push (v) {
6635 arr[L++] = v
6636 }
6637
6638 for (i = 0, j = 0; i < l; i += 4, j += 3) {
6639 tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
6640 push((tmp & 0xFF0000) >> 16)
6641 push((tmp & 0xFF00) >> 8)
6642 push(tmp & 0xFF)
6643 }
6644
6645 if (placeHolders === 2) {
6646 tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
6647 push(tmp & 0xFF)
6648 } else if (placeHolders === 1) {
6649 tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
6650 push((tmp >> 8) & 0xFF)
6651 push(tmp & 0xFF)
6652 }
6653
6654 return arr
6655 }
6656
6657 function uint8ToBase64 (uint8) {
6658 var i,
6659 extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
6660 output = "",
6661 temp, length
6662
6663 function encode (num) {
6664 return lookup.charAt(num)
6665 }
6666
6667 function tripletToBase64 (num) {
6668 return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
6669 }
6670
6671 // go through the array every three bytes, we'll deal with trailing stuff later
6672 for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
6673 temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
6674 output += tripletToBase64(temp)
6675 }
6676
6677 // pad the end with zeros, but make sure to not forget the extra bytes
6678 switch (extraBytes) {
6679 case 1:
6680 temp = uint8[uint8.length - 1]
6681 output += encode(temp >> 2)
6682 output += encode((temp << 4) & 0x3F)
6683 output += '=='
6684 break
6685 case 2:
6686 temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
6687 output += encode(temp >> 10)
6688 output += encode((temp >> 4) & 0x3F)
6689 output += encode((temp << 2) & 0x3F)
6690 output += '='
6691 break
6692 }
6693
6694 return output
6695 }
6696
6697 exports.toByteArray = b64ToByteArray
6698 exports.fromByteArray = uint8ToBase64
6699}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
6700
Jian Li83d87a72016-04-20 15:38:24 -07006701},{}],17:[function(require,module,exports){
6702exports.read = function (buffer, offset, isLE, mLen, nBytes) {
6703 var e, m
6704 var eLen = nBytes * 8 - mLen - 1
6705 var eMax = (1 << eLen) - 1
6706 var eBias = eMax >> 1
6707 var nBits = -7
6708 var i = isLE ? (nBytes - 1) : 0
6709 var d = isLE ? -1 : 1
6710 var s = buffer[offset + i]
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006711
Jian Li83d87a72016-04-20 15:38:24 -07006712 i += d
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006713
Jian Li83d87a72016-04-20 15:38:24 -07006714 e = s & ((1 << (-nBits)) - 1)
6715 s >>= (-nBits)
6716 nBits += eLen
6717 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006718
Jian Li83d87a72016-04-20 15:38:24 -07006719 m = e & ((1 << (-nBits)) - 1)
6720 e >>= (-nBits)
6721 nBits += mLen
6722 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006723
6724 if (e === 0) {
Jian Li83d87a72016-04-20 15:38:24 -07006725 e = 1 - eBias
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006726 } else if (e === eMax) {
Jian Li83d87a72016-04-20 15:38:24 -07006727 return m ? NaN : ((s ? -1 : 1) * Infinity)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006728 } else {
Jian Li83d87a72016-04-20 15:38:24 -07006729 m = m + Math.pow(2, mLen)
6730 e = e - eBias
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006731 }
Jian Li83d87a72016-04-20 15:38:24 -07006732 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
6733}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006734
Jian Li83d87a72016-04-20 15:38:24 -07006735exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6736 var e, m, c
6737 var eLen = nBytes * 8 - mLen - 1
6738 var eMax = (1 << eLen) - 1
6739 var eBias = eMax >> 1
6740 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
6741 var i = isLE ? 0 : (nBytes - 1)
6742 var d = isLE ? 1 : -1
6743 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006744
Jian Li83d87a72016-04-20 15:38:24 -07006745 value = Math.abs(value)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006746
6747 if (isNaN(value) || value === Infinity) {
Jian Li83d87a72016-04-20 15:38:24 -07006748 m = isNaN(value) ? 1 : 0
6749 e = eMax
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006750 } else {
Jian Li83d87a72016-04-20 15:38:24 -07006751 e = Math.floor(Math.log(value) / Math.LN2)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006752 if (value * (c = Math.pow(2, -e)) < 1) {
Jian Li83d87a72016-04-20 15:38:24 -07006753 e--
6754 c *= 2
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006755 }
6756 if (e + eBias >= 1) {
Jian Li83d87a72016-04-20 15:38:24 -07006757 value += rt / c
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006758 } else {
Jian Li83d87a72016-04-20 15:38:24 -07006759 value += rt * Math.pow(2, 1 - eBias)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006760 }
6761 if (value * c >= 2) {
Jian Li83d87a72016-04-20 15:38:24 -07006762 e++
6763 c /= 2
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006764 }
6765
6766 if (e + eBias >= eMax) {
Jian Li83d87a72016-04-20 15:38:24 -07006767 m = 0
6768 e = eMax
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006769 } else if (e + eBias >= 1) {
Jian Li83d87a72016-04-20 15:38:24 -07006770 m = (value * c - 1) * Math.pow(2, mLen)
6771 e = e + eBias
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006772 } else {
Jian Li83d87a72016-04-20 15:38:24 -07006773 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
6774 e = 0
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006775 }
6776 }
6777
Jian Li83d87a72016-04-20 15:38:24 -07006778 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006779
Jian Li83d87a72016-04-20 15:38:24 -07006780 e = (e << mLen) | m
6781 eLen += mLen
6782 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006783
Jian Li83d87a72016-04-20 15:38:24 -07006784 buffer[offset + i - d] |= s * 128
6785}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006786
Jian Li83d87a72016-04-20 15:38:24 -07006787},{}],18:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006788
6789/**
6790 * isArray
6791 */
6792
6793var isArray = Array.isArray;
6794
6795/**
6796 * toString
6797 */
6798
6799var str = Object.prototype.toString;
6800
6801/**
6802 * Whether or not the given `val`
6803 * is an array.
6804 *
6805 * example:
6806 *
6807 * isArray([]);
6808 * // > true
6809 * isArray(arguments);
6810 * // > false
6811 * isArray('');
6812 * // > false
6813 *
6814 * @param {mixed} val
6815 * @return {bool}
6816 */
6817
6818module.exports = isArray || function (val) {
6819 return !! val && '[object Array]' == str.call(val);
6820};
6821
Jian Li83d87a72016-04-20 15:38:24 -07006822},{}],19:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006823/* jshint node: true */
6824(function () {
6825 "use strict";
6826
6827 function CookieAccessInfo(domain, path, secure, script) {
6828 if (this instanceof CookieAccessInfo) {
6829 this.domain = domain || undefined;
6830 this.path = path || "/";
6831 this.secure = !!secure;
6832 this.script = !!script;
6833 return this;
6834 }
6835 return new CookieAccessInfo(domain, path, secure, script);
6836 }
6837 exports.CookieAccessInfo = CookieAccessInfo;
6838
6839 function Cookie(cookiestr, request_domain, request_path) {
6840 if (cookiestr instanceof Cookie) {
6841 return cookiestr;
6842 }
6843 if (this instanceof Cookie) {
6844 this.name = null;
6845 this.value = null;
6846 this.expiration_date = Infinity;
6847 this.path = String(request_path || "/");
6848 this.explicit_path = false;
6849 this.domain = request_domain || null;
6850 this.explicit_domain = false;
6851 this.secure = false; //how to define default?
6852 this.noscript = false; //httponly
6853 if (cookiestr) {
6854 this.parse(cookiestr, request_domain, request_path);
6855 }
6856 return this;
6857 }
Jian Li83d87a72016-04-20 15:38:24 -07006858 return new Cookie(cookiestr, request_domain, request_path);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006859 }
6860 exports.Cookie = Cookie;
6861
6862 Cookie.prototype.toString = function toString() {
6863 var str = [this.name + "=" + this.value];
6864 if (this.expiration_date !== Infinity) {
6865 str.push("expires=" + (new Date(this.expiration_date)).toGMTString());
6866 }
6867 if (this.domain) {
6868 str.push("domain=" + this.domain);
6869 }
6870 if (this.path) {
6871 str.push("path=" + this.path);
6872 }
6873 if (this.secure) {
6874 str.push("secure");
6875 }
6876 if (this.noscript) {
6877 str.push("httponly");
6878 }
6879 return str.join("; ");
6880 };
6881
6882 Cookie.prototype.toValueString = function toValueString() {
6883 return this.name + "=" + this.value;
6884 };
6885
6886 var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;
6887 Cookie.prototype.parse = function parse(str, request_domain, request_path) {
6888 if (this instanceof Cookie) {
6889 var parts = str.split(";").filter(function (value) {
6890 return !!value;
6891 }),
6892 pair = parts[0].match(/([^=]+)=([\s\S]*)/),
6893 key = pair[1],
6894 value = pair[2],
6895 i;
6896 this.name = key;
6897 this.value = value;
6898
6899 for (i = 1; i < parts.length; i += 1) {
6900 pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/);
6901 key = pair[1].trim().toLowerCase();
6902 value = pair[2];
6903 switch (key) {
6904 case "httponly":
6905 this.noscript = true;
6906 break;
6907 case "expires":
6908 this.expiration_date = value ?
6909 Number(Date.parse(value)) :
6910 Infinity;
6911 break;
6912 case "path":
6913 this.path = value ?
6914 value.trim() :
6915 "";
6916 this.explicit_path = true;
6917 break;
6918 case "domain":
6919 this.domain = value ?
6920 value.trim() :
6921 "";
6922 this.explicit_domain = !!this.domain;
6923 break;
6924 case "secure":
6925 this.secure = true;
6926 break;
6927 }
6928 }
6929
6930 if (!this.explicit_path) {
6931 this.path = request_path || "/";
6932 }
6933 if (!this.explicit_domain) {
6934 this.domain = request_domain;
6935 }
6936
6937 return this;
6938 }
6939 return new Cookie().parse(str, request_domain, request_path);
6940 };
6941
6942 Cookie.prototype.matches = function matches(access_info) {
6943 if (this.noscript && access_info.script ||
6944 this.secure && !access_info.secure ||
6945 !this.collidesWith(access_info)) {
6946 return false;
6947 }
6948 return true;
6949 };
6950
6951 Cookie.prototype.collidesWith = function collidesWith(access_info) {
6952 if ((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
6953 return false;
6954 }
6955 if (this.path && access_info.path.indexOf(this.path) !== 0) {
6956 return false;
6957 }
Jian Li83d87a72016-04-20 15:38:24 -07006958 if (this.explicit_path && access_info.path.indexOf( this.path ) !== 0) {
6959 return false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07006960 }
6961 var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
6962 var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
6963 if (cookie_domain === access_domain) {
6964 return true;
6965 }
6966 if (cookie_domain) {
6967 if (!this.explicit_domain) {
6968 return false; // we already checked if the domains were exactly the same
6969 }
6970 var wildcard = access_domain.indexOf(cookie_domain);
6971 if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) {
6972 return false;
6973 }
6974 return true;
6975 }
6976 return true;
6977 };
6978
6979 function CookieJar() {
6980 var cookies, cookies_list, collidable_cookie;
6981 if (this instanceof CookieJar) {
6982 cookies = Object.create(null); //name: [Cookie]
6983
6984 this.setCookie = function setCookie(cookie, request_domain, request_path) {
6985 var remove, i;
6986 cookie = new Cookie(cookie, request_domain, request_path);
6987 //Delete the cookie if the set is past the current time
6988 remove = cookie.expiration_date <= Date.now();
6989 if (cookies[cookie.name] !== undefined) {
6990 cookies_list = cookies[cookie.name];
6991 for (i = 0; i < cookies_list.length; i += 1) {
6992 collidable_cookie = cookies_list[i];
6993 if (collidable_cookie.collidesWith(cookie)) {
6994 if (remove) {
6995 cookies_list.splice(i, 1);
6996 if (cookies_list.length === 0) {
6997 delete cookies[cookie.name];
6998 }
6999 return false;
7000 }
7001 cookies_list[i] = cookie;
7002 return cookie;
7003 }
7004 }
7005 if (remove) {
7006 return false;
7007 }
7008 cookies_list.push(cookie);
7009 return cookie;
7010 }
7011 if (remove) {
7012 return false;
7013 }
7014 cookies[cookie.name] = [cookie];
7015 return cookies[cookie.name];
7016 };
7017 //returns a cookie
7018 this.getCookie = function getCookie(cookie_name, access_info) {
7019 var cookie, i;
7020 cookies_list = cookies[cookie_name];
7021 if (!cookies_list) {
7022 return;
7023 }
7024 for (i = 0; i < cookies_list.length; i += 1) {
7025 cookie = cookies_list[i];
7026 if (cookie.expiration_date <= Date.now()) {
7027 if (cookies_list.length === 0) {
7028 delete cookies[cookie.name];
7029 }
7030 continue;
7031 }
Jian Li83d87a72016-04-20 15:38:24 -07007032
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007033 if (cookie.matches(access_info)) {
7034 return cookie;
7035 }
7036 }
7037 };
7038 //returns a list of cookies
7039 this.getCookies = function getCookies(access_info) {
7040 var matches = [], cookie_name, cookie;
7041 for (cookie_name in cookies) {
7042 cookie = this.getCookie(cookie_name, access_info);
7043 if (cookie) {
7044 matches.push(cookie);
7045 }
7046 }
7047 matches.toString = function toString() {
7048 return matches.join(":");
7049 };
7050 matches.toValueString = function toValueString() {
7051 return matches.map(function (c) {
7052 return c.toValueString();
7053 }).join(';');
7054 };
7055 return matches;
7056 };
7057
7058 return this;
7059 }
7060 return new CookieJar();
7061 }
7062 exports.CookieJar = CookieJar;
7063
7064 //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned.
7065 CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) {
7066 cookies = Array.isArray(cookies) ?
7067 cookies :
7068 cookies.split(cookie_str_splitter);
7069 var successful = [],
7070 i,
7071 cookie;
Jian Li83d87a72016-04-20 15:38:24 -07007072 cookies = cookies.map(function(item){
7073 return new Cookie(item, request_domain, request_path);
7074 });
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007075 for (i = 0; i < cookies.length; i += 1) {
7076 cookie = cookies[i];
7077 if (this.setCookie(cookie, request_domain, request_path)) {
7078 successful.push(cookie);
7079 }
7080 }
7081 return successful;
7082 };
7083}());
7084
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007085},{}],20:[function(require,module,exports){
7086'use strict';
7087
7088
7089var yaml = require('./lib/js-yaml.js');
7090
7091
7092module.exports = yaml;
7093
7094},{"./lib/js-yaml.js":21}],21:[function(require,module,exports){
7095'use strict';
7096
7097
7098var loader = require('./js-yaml/loader');
7099var dumper = require('./js-yaml/dumper');
7100
7101
7102function deprecated(name) {
7103 return function () {
7104 throw new Error('Function ' + name + ' is deprecated and cannot be used.');
7105 };
7106}
7107
7108
7109module.exports.Type = require('./js-yaml/type');
7110module.exports.Schema = require('./js-yaml/schema');
7111module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
7112module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
7113module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
7114module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
7115module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
7116module.exports.load = loader.load;
7117module.exports.loadAll = loader.loadAll;
7118module.exports.safeLoad = loader.safeLoad;
7119module.exports.safeLoadAll = loader.safeLoadAll;
7120module.exports.dump = dumper.dump;
7121module.exports.safeDump = dumper.safeDump;
7122module.exports.YAMLException = require('./js-yaml/exception');
7123
Jian Li83d87a72016-04-20 15:38:24 -07007124// Deprecated schema names from JS-YAML 2.0.x
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007125module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
7126module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
7127module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
7128
7129// Deprecated functions from JS-YAML 1.x.x
7130module.exports.scan = deprecated('scan');
7131module.exports.parse = deprecated('parse');
7132module.exports.compose = deprecated('compose');
7133module.exports.addConstructor = deprecated('addConstructor');
7134
7135},{"./js-yaml/dumper":23,"./js-yaml/exception":24,"./js-yaml/loader":25,"./js-yaml/schema":27,"./js-yaml/schema/core":28,"./js-yaml/schema/default_full":29,"./js-yaml/schema/default_safe":30,"./js-yaml/schema/failsafe":31,"./js-yaml/schema/json":32,"./js-yaml/type":33}],22:[function(require,module,exports){
7136'use strict';
7137
7138
7139function isNothing(subject) {
7140 return (typeof subject === 'undefined') || (null === subject);
7141}
7142
7143
7144function isObject(subject) {
7145 return (typeof subject === 'object') && (null !== subject);
7146}
7147
7148
7149function toArray(sequence) {
7150 if (Array.isArray(sequence)) {
7151 return sequence;
7152 } else if (isNothing(sequence)) {
7153 return [];
7154 }
7155 return [ sequence ];
7156}
7157
7158
7159function extend(target, source) {
7160 var index, length, key, sourceKeys;
7161
7162 if (source) {
7163 sourceKeys = Object.keys(source);
7164
7165 for (index = 0, length = sourceKeys.length; index < length; index += 1) {
7166 key = sourceKeys[index];
7167 target[key] = source[key];
7168 }
7169 }
7170
7171 return target;
7172}
7173
7174
7175function repeat(string, count) {
7176 var result = '', cycle;
7177
7178 for (cycle = 0; cycle < count; cycle += 1) {
7179 result += string;
7180 }
7181
7182 return result;
7183}
7184
7185
7186function isNegativeZero(number) {
7187 return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
7188}
7189
7190
7191module.exports.isNothing = isNothing;
7192module.exports.isObject = isObject;
7193module.exports.toArray = toArray;
7194module.exports.repeat = repeat;
7195module.exports.isNegativeZero = isNegativeZero;
7196module.exports.extend = extend;
7197
7198},{}],23:[function(require,module,exports){
7199'use strict';
7200
7201/*eslint-disable no-use-before-define*/
7202
7203var common = require('./common');
7204var YAMLException = require('./exception');
7205var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
7206var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
7207
7208var _toString = Object.prototype.toString;
7209var _hasOwnProperty = Object.prototype.hasOwnProperty;
7210
7211var CHAR_TAB = 0x09; /* Tab */
7212var CHAR_LINE_FEED = 0x0A; /* LF */
7213var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
7214var CHAR_SPACE = 0x20; /* Space */
7215var CHAR_EXCLAMATION = 0x21; /* ! */
7216var CHAR_DOUBLE_QUOTE = 0x22; /* " */
7217var CHAR_SHARP = 0x23; /* # */
7218var CHAR_PERCENT = 0x25; /* % */
7219var CHAR_AMPERSAND = 0x26; /* & */
7220var CHAR_SINGLE_QUOTE = 0x27; /* ' */
7221var CHAR_ASTERISK = 0x2A; /* * */
7222var CHAR_COMMA = 0x2C; /* , */
7223var CHAR_MINUS = 0x2D; /* - */
7224var CHAR_COLON = 0x3A; /* : */
7225var CHAR_GREATER_THAN = 0x3E; /* > */
7226var CHAR_QUESTION = 0x3F; /* ? */
7227var CHAR_COMMERCIAL_AT = 0x40; /* @ */
7228var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
7229var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
7230var CHAR_GRAVE_ACCENT = 0x60; /* ` */
7231var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
7232var CHAR_VERTICAL_LINE = 0x7C; /* | */
7233var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
7234
7235var ESCAPE_SEQUENCES = {};
7236
7237ESCAPE_SEQUENCES[0x00] = '\\0';
7238ESCAPE_SEQUENCES[0x07] = '\\a';
7239ESCAPE_SEQUENCES[0x08] = '\\b';
7240ESCAPE_SEQUENCES[0x09] = '\\t';
7241ESCAPE_SEQUENCES[0x0A] = '\\n';
7242ESCAPE_SEQUENCES[0x0B] = '\\v';
7243ESCAPE_SEQUENCES[0x0C] = '\\f';
7244ESCAPE_SEQUENCES[0x0D] = '\\r';
7245ESCAPE_SEQUENCES[0x1B] = '\\e';
7246ESCAPE_SEQUENCES[0x22] = '\\"';
7247ESCAPE_SEQUENCES[0x5C] = '\\\\';
7248ESCAPE_SEQUENCES[0x85] = '\\N';
7249ESCAPE_SEQUENCES[0xA0] = '\\_';
7250ESCAPE_SEQUENCES[0x2028] = '\\L';
7251ESCAPE_SEQUENCES[0x2029] = '\\P';
7252
7253var DEPRECATED_BOOLEANS_SYNTAX = [
7254 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
7255 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
7256];
7257
7258function compileStyleMap(schema, map) {
7259 var result, keys, index, length, tag, style, type;
7260
7261 if (null === map) {
7262 return {};
7263 }
7264
7265 result = {};
7266 keys = Object.keys(map);
7267
7268 for (index = 0, length = keys.length; index < length; index += 1) {
7269 tag = keys[index];
7270 style = String(map[tag]);
7271
7272 if ('!!' === tag.slice(0, 2)) {
7273 tag = 'tag:yaml.org,2002:' + tag.slice(2);
7274 }
7275
7276 type = schema.compiledTypeMap[tag];
7277
7278 if (type && _hasOwnProperty.call(type.styleAliases, style)) {
7279 style = type.styleAliases[style];
7280 }
7281
7282 result[tag] = style;
7283 }
7284
7285 return result;
7286}
7287
7288function encodeHex(character) {
7289 var string, handle, length;
7290
7291 string = character.toString(16).toUpperCase();
7292
7293 if (character <= 0xFF) {
7294 handle = 'x';
7295 length = 2;
7296 } else if (character <= 0xFFFF) {
7297 handle = 'u';
7298 length = 4;
7299 } else if (character <= 0xFFFFFFFF) {
7300 handle = 'U';
7301 length = 8;
7302 } else {
7303 throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
7304 }
7305
7306 return '\\' + handle + common.repeat('0', length - string.length) + string;
7307}
7308
7309function State(options) {
7310 this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
7311 this.indent = Math.max(1, (options['indent'] || 2));
7312 this.skipInvalid = options['skipInvalid'] || false;
7313 this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
7314 this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
7315 this.sortKeys = options['sortKeys'] || false;
Jian Li83d87a72016-04-20 15:38:24 -07007316 this.lineWidth = options['lineWidth'] || 80;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007317
7318 this.implicitTypes = this.schema.compiledImplicit;
7319 this.explicitTypes = this.schema.compiledExplicit;
7320
7321 this.tag = null;
7322 this.result = '';
7323
7324 this.duplicates = [];
7325 this.usedDuplicates = null;
7326}
7327
7328function indentString(string, spaces) {
7329 var ind = common.repeat(' ', spaces),
7330 position = 0,
7331 next = -1,
7332 result = '',
7333 line,
7334 length = string.length;
7335
7336 while (position < length) {
7337 next = string.indexOf('\n', position);
7338 if (next === -1) {
7339 line = string.slice(position);
7340 position = length;
7341 } else {
7342 line = string.slice(position, next + 1);
7343 position = next + 1;
7344 }
7345 if (line.length && line !== '\n') {
7346 result += ind;
7347 }
7348 result += line;
7349 }
7350
7351 return result;
7352}
7353
7354function generateNextLine(state, level) {
7355 return '\n' + common.repeat(' ', state.indent * level);
7356}
7357
7358function testImplicitResolving(state, str) {
7359 var index, length, type;
7360
7361 for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
7362 type = state.implicitTypes[index];
7363
7364 if (type.resolve(str)) {
7365 return true;
7366 }
7367 }
7368
7369 return false;
7370}
7371
7372function StringBuilder(source) {
7373 this.source = source;
7374 this.result = '';
7375 this.checkpoint = 0;
7376}
7377
7378StringBuilder.prototype.takeUpTo = function (position) {
7379 var er;
7380
7381 if (position < this.checkpoint) {
7382 er = new Error('position should be > checkpoint');
7383 er.position = position;
7384 er.checkpoint = this.checkpoint;
7385 throw er;
7386 }
7387
7388 this.result += this.source.slice(this.checkpoint, position);
7389 this.checkpoint = position;
7390 return this;
7391};
7392
7393StringBuilder.prototype.escapeChar = function () {
7394 var character, esc;
7395
7396 character = this.source.charCodeAt(this.checkpoint);
7397 esc = ESCAPE_SEQUENCES[character] || encodeHex(character);
7398 this.result += esc;
7399 this.checkpoint += 1;
7400
7401 return this;
7402};
7403
7404StringBuilder.prototype.finish = function () {
7405 if (this.source.length > this.checkpoint) {
7406 this.takeUpTo(this.source.length);
7407 }
7408};
7409
Jian Li83d87a72016-04-20 15:38:24 -07007410function writeScalar(state, object, level, iskey) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007411 var simple, first, spaceWrap, folded, literal, single, double,
7412 sawLineFeed, linePosition, longestLine, indent, max, character,
7413 position, escapeSeq, hexEsc, previous, lineLength, modifier,
7414 trailingLineBreaks, result;
7415
7416 if (0 === object.length) {
7417 state.dump = "''";
7418 return;
7419 }
7420
7421 if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
7422 state.dump = "'" + object + "'";
7423 return;
7424 }
7425
7426 simple = true;
7427 first = object.length ? object.charCodeAt(0) : 0;
7428 spaceWrap = (CHAR_SPACE === first ||
7429 CHAR_SPACE === object.charCodeAt(object.length - 1));
7430
7431 // Simplified check for restricted first characters
7432 // http://www.yaml.org/spec/1.2/spec.html#ns-plain-first%28c%29
7433 if (CHAR_MINUS === first ||
7434 CHAR_QUESTION === first ||
7435 CHAR_COMMERCIAL_AT === first ||
7436 CHAR_GRAVE_ACCENT === first) {
7437 simple = false;
7438 }
7439
Jian Li83d87a72016-04-20 15:38:24 -07007440 // can only use > and | if not wrapped in spaces or is not a key.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007441 if (spaceWrap) {
7442 simple = false;
7443 folded = false;
7444 literal = false;
7445 } else {
Jian Li83d87a72016-04-20 15:38:24 -07007446 folded = !iskey;
7447 literal = !iskey;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007448 }
7449
7450 single = true;
7451 double = new StringBuilder(object);
7452
7453 sawLineFeed = false;
7454 linePosition = 0;
7455 longestLine = 0;
7456
7457 indent = state.indent * level;
Jian Li83d87a72016-04-20 15:38:24 -07007458 max = state.lineWidth;
7459 if (max === -1) {
7460 // Replace -1 with biggest ingeger number according to
7461 // http://ecma262-5.com/ELS5_HTML.htm#Section_8.5
7462 max = 9007199254740991;
7463 }
7464
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007465 if (indent < 40) {
7466 max -= indent;
7467 } else {
7468 max = 40;
7469 }
7470
7471 for (position = 0; position < object.length; position++) {
7472 character = object.charCodeAt(position);
7473 if (simple) {
7474 // Characters that can never appear in the simple scalar
7475 if (!simpleChar(character)) {
7476 simple = false;
7477 } else {
7478 // Still simple. If we make it all the way through like
7479 // this, then we can just dump the string as-is.
7480 continue;
7481 }
7482 }
7483
7484 if (single && character === CHAR_SINGLE_QUOTE) {
7485 single = false;
7486 }
7487
7488 escapeSeq = ESCAPE_SEQUENCES[character];
7489 hexEsc = needsHexEscape(character);
7490
7491 if (!escapeSeq && !hexEsc) {
7492 continue;
7493 }
7494
7495 if (character !== CHAR_LINE_FEED &&
7496 character !== CHAR_DOUBLE_QUOTE &&
7497 character !== CHAR_SINGLE_QUOTE) {
7498 folded = false;
7499 literal = false;
7500 } else if (character === CHAR_LINE_FEED) {
7501 sawLineFeed = true;
7502 single = false;
7503 if (position > 0) {
7504 previous = object.charCodeAt(position - 1);
7505 if (previous === CHAR_SPACE) {
7506 literal = false;
7507 folded = false;
7508 }
7509 }
7510 if (folded) {
7511 lineLength = position - linePosition;
7512 linePosition = position;
7513 if (lineLength > longestLine) {
7514 longestLine = lineLength;
7515 }
7516 }
7517 }
7518
7519 if (character !== CHAR_DOUBLE_QUOTE) {
7520 single = false;
7521 }
7522
7523 double.takeUpTo(position);
7524 double.escapeChar();
7525 }
7526
7527 if (simple && testImplicitResolving(state, object)) {
7528 simple = false;
7529 }
7530
7531 modifier = '';
7532 if (folded || literal) {
7533 trailingLineBreaks = 0;
7534 if (object.charCodeAt(object.length - 1) === CHAR_LINE_FEED) {
7535 trailingLineBreaks += 1;
7536 if (object.charCodeAt(object.length - 2) === CHAR_LINE_FEED) {
7537 trailingLineBreaks += 1;
7538 }
7539 }
7540
7541 if (trailingLineBreaks === 0) {
7542 modifier = '-';
7543 } else if (trailingLineBreaks === 2) {
7544 modifier = '+';
7545 }
7546 }
7547
7548 if (literal && longestLine < max) {
7549 folded = false;
7550 }
7551
7552 // If it's literally one line, then don't bother with the literal.
7553 // We may still want to do a fold, though, if it's a super long line.
7554 if (!sawLineFeed) {
7555 literal = false;
7556 }
7557
7558 if (simple) {
7559 state.dump = object;
7560 } else if (single) {
7561 state.dump = '\'' + object + '\'';
7562 } else if (folded) {
7563 result = fold(object, max);
7564 state.dump = '>' + modifier + '\n' + indentString(result, indent);
7565 } else if (literal) {
7566 if (!modifier) {
7567 object = object.replace(/\n$/, '');
7568 }
7569 state.dump = '|' + modifier + '\n' + indentString(object, indent);
7570 } else if (double) {
7571 double.finish();
7572 state.dump = '"' + double.result + '"';
7573 } else {
7574 throw new Error('Failed to dump scalar value');
7575 }
7576
7577 return;
7578}
7579
7580// The `trailing` var is a regexp match of any trailing `\n` characters.
7581//
7582// There are three cases we care about:
7583//
7584// 1. One trailing `\n` on the string. Just use `|` or `>`.
7585// This is the assumed default. (trailing = null)
7586// 2. No trailing `\n` on the string. Use `|-` or `>-` to "chomp" the end.
7587// 3. More than one trailing `\n` on the string. Use `|+` or `>+`.
7588//
7589// In the case of `>+`, these line breaks are *not* doubled (like the line
7590// breaks within the string), so it's important to only end with the exact
7591// same number as we started.
7592function fold(object, max) {
7593 var result = '',
7594 position = 0,
7595 length = object.length,
7596 trailing = /\n+$/.exec(object),
7597 newLine;
7598
7599 if (trailing) {
7600 length = trailing.index + 1;
7601 }
7602
7603 while (position < length) {
7604 newLine = object.indexOf('\n', position);
7605 if (newLine > length || newLine === -1) {
7606 if (result) {
7607 result += '\n\n';
7608 }
7609 result += foldLine(object.slice(position, length), max);
7610 position = length;
7611 } else {
7612 if (result) {
7613 result += '\n\n';
7614 }
7615 result += foldLine(object.slice(position, newLine), max);
7616 position = newLine + 1;
7617 }
7618 }
7619 if (trailing && trailing[0] !== '\n') {
7620 result += trailing[0];
7621 }
7622
7623 return result;
7624}
7625
7626function foldLine(line, max) {
7627 if (line === '') {
7628 return line;
7629 }
7630
7631 var foldRe = /[^\s] [^\s]/g,
7632 result = '',
7633 prevMatch = 0,
7634 foldStart = 0,
7635 match = foldRe.exec(line),
7636 index,
7637 foldEnd,
7638 folded;
7639
7640 while (match) {
7641 index = match.index;
7642
7643 // when we cross the max len, if the previous match would've
7644 // been ok, use that one, and carry on. If there was no previous
7645 // match on this fold section, then just have a long line.
7646 if (index - foldStart > max) {
7647 if (prevMatch !== foldStart) {
7648 foldEnd = prevMatch;
7649 } else {
7650 foldEnd = index;
7651 }
7652
7653 if (result) {
7654 result += '\n';
7655 }
7656 folded = line.slice(foldStart, foldEnd);
7657 result += folded;
7658 foldStart = foldEnd + 1;
7659 }
7660 prevMatch = index + 1;
7661 match = foldRe.exec(line);
7662 }
7663
7664 if (result) {
7665 result += '\n';
7666 }
7667
7668 // if we end up with one last word at the end, then the last bit might
7669 // be slightly bigger than we wanted, because we exited out of the loop.
7670 if (foldStart !== prevMatch && line.length - foldStart > max) {
7671 result += line.slice(foldStart, prevMatch) + '\n' +
7672 line.slice(prevMatch + 1);
7673 } else {
7674 result += line.slice(foldStart);
7675 }
7676
7677 return result;
7678}
7679
7680// Returns true if character can be found in a simple scalar
7681function simpleChar(character) {
7682 return CHAR_TAB !== character &&
7683 CHAR_LINE_FEED !== character &&
7684 CHAR_CARRIAGE_RETURN !== character &&
7685 CHAR_COMMA !== character &&
7686 CHAR_LEFT_SQUARE_BRACKET !== character &&
7687 CHAR_RIGHT_SQUARE_BRACKET !== character &&
7688 CHAR_LEFT_CURLY_BRACKET !== character &&
7689 CHAR_RIGHT_CURLY_BRACKET !== character &&
7690 CHAR_SHARP !== character &&
7691 CHAR_AMPERSAND !== character &&
7692 CHAR_ASTERISK !== character &&
7693 CHAR_EXCLAMATION !== character &&
7694 CHAR_VERTICAL_LINE !== character &&
7695 CHAR_GREATER_THAN !== character &&
7696 CHAR_SINGLE_QUOTE !== character &&
7697 CHAR_DOUBLE_QUOTE !== character &&
7698 CHAR_PERCENT !== character &&
7699 CHAR_COLON !== character &&
7700 !ESCAPE_SEQUENCES[character] &&
7701 !needsHexEscape(character);
7702}
7703
7704// Returns true if the character code needs to be escaped.
7705function needsHexEscape(character) {
7706 return !((0x00020 <= character && character <= 0x00007E) ||
7707 (0x00085 === character) ||
7708 (0x000A0 <= character && character <= 0x00D7FF) ||
7709 (0x0E000 <= character && character <= 0x00FFFD) ||
7710 (0x10000 <= character && character <= 0x10FFFF));
7711}
7712
7713function writeFlowSequence(state, level, object) {
7714 var _result = '',
7715 _tag = state.tag,
7716 index,
7717 length;
7718
7719 for (index = 0, length = object.length; index < length; index += 1) {
7720 // Write only valid elements.
7721 if (writeNode(state, level, object[index], false, false)) {
7722 if (0 !== index) {
7723 _result += ', ';
7724 }
7725 _result += state.dump;
7726 }
7727 }
7728
7729 state.tag = _tag;
7730 state.dump = '[' + _result + ']';
7731}
7732
7733function writeBlockSequence(state, level, object, compact) {
7734 var _result = '',
7735 _tag = state.tag,
7736 index,
7737 length;
7738
7739 for (index = 0, length = object.length; index < length; index += 1) {
7740 // Write only valid elements.
7741 if (writeNode(state, level + 1, object[index], true, true)) {
7742 if (!compact || 0 !== index) {
7743 _result += generateNextLine(state, level);
7744 }
7745 _result += '- ' + state.dump;
7746 }
7747 }
7748
7749 state.tag = _tag;
7750 state.dump = _result || '[]'; // Empty sequence if no valid values.
7751}
7752
7753function writeFlowMapping(state, level, object) {
7754 var _result = '',
7755 _tag = state.tag,
7756 objectKeyList = Object.keys(object),
7757 index,
7758 length,
7759 objectKey,
7760 objectValue,
7761 pairBuffer;
7762
7763 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
7764 pairBuffer = '';
7765
7766 if (0 !== index) {
7767 pairBuffer += ', ';
7768 }
7769
7770 objectKey = objectKeyList[index];
7771 objectValue = object[objectKey];
7772
7773 if (!writeNode(state, level, objectKey, false, false)) {
7774 continue; // Skip this pair because of invalid key;
7775 }
7776
7777 if (state.dump.length > 1024) {
7778 pairBuffer += '? ';
7779 }
7780
7781 pairBuffer += state.dump + ': ';
7782
7783 if (!writeNode(state, level, objectValue, false, false)) {
7784 continue; // Skip this pair because of invalid value.
7785 }
7786
7787 pairBuffer += state.dump;
7788
7789 // Both key and value are valid.
7790 _result += pairBuffer;
7791 }
7792
7793 state.tag = _tag;
7794 state.dump = '{' + _result + '}';
7795}
7796
7797function writeBlockMapping(state, level, object, compact) {
7798 var _result = '',
7799 _tag = state.tag,
7800 objectKeyList = Object.keys(object),
7801 index,
7802 length,
7803 objectKey,
7804 objectValue,
7805 explicitPair,
7806 pairBuffer;
7807
7808 // Allow sorting keys so that the output file is deterministic
7809 if (state.sortKeys === true) {
7810 // Default sorting
7811 objectKeyList.sort();
7812 } else if (typeof state.sortKeys === 'function') {
7813 // Custom sort function
7814 objectKeyList.sort(state.sortKeys);
7815 } else if (state.sortKeys) {
7816 // Something is wrong
7817 throw new YAMLException('sortKeys must be a boolean or a function');
7818 }
7819
7820 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
7821 pairBuffer = '';
7822
7823 if (!compact || 0 !== index) {
7824 pairBuffer += generateNextLine(state, level);
7825 }
7826
7827 objectKey = objectKeyList[index];
7828 objectValue = object[objectKey];
7829
Jian Li83d87a72016-04-20 15:38:24 -07007830 if (!writeNode(state, level + 1, objectKey, true, true, true)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007831 continue; // Skip this pair because of invalid key.
7832 }
7833
7834 explicitPair = (null !== state.tag && '?' !== state.tag) ||
7835 (state.dump && state.dump.length > 1024);
7836
7837 if (explicitPair) {
7838 if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
7839 pairBuffer += '?';
7840 } else {
7841 pairBuffer += '? ';
7842 }
7843 }
7844
7845 pairBuffer += state.dump;
7846
7847 if (explicitPair) {
7848 pairBuffer += generateNextLine(state, level);
7849 }
7850
7851 if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
7852 continue; // Skip this pair because of invalid value.
7853 }
7854
7855 if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
7856 pairBuffer += ':';
7857 } else {
7858 pairBuffer += ': ';
7859 }
7860
7861 pairBuffer += state.dump;
7862
7863 // Both key and value are valid.
7864 _result += pairBuffer;
7865 }
7866
7867 state.tag = _tag;
7868 state.dump = _result || '{}'; // Empty mapping if no valid pairs.
7869}
7870
7871function detectType(state, object, explicit) {
7872 var _result, typeList, index, length, type, style;
7873
7874 typeList = explicit ? state.explicitTypes : state.implicitTypes;
7875
7876 for (index = 0, length = typeList.length; index < length; index += 1) {
7877 type = typeList[index];
7878
7879 if ((type.instanceOf || type.predicate) &&
7880 (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
7881 (!type.predicate || type.predicate(object))) {
7882
7883 state.tag = explicit ? type.tag : '?';
7884
7885 if (type.represent) {
7886 style = state.styleMap[type.tag] || type.defaultStyle;
7887
7888 if ('[object Function]' === _toString.call(type.represent)) {
7889 _result = type.represent(object, style);
7890 } else if (_hasOwnProperty.call(type.represent, style)) {
7891 _result = type.represent[style](object, style);
7892 } else {
7893 throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
7894 }
7895
7896 state.dump = _result;
7897 }
7898
7899 return true;
7900 }
7901 }
7902
7903 return false;
7904}
7905
7906// Serializes `object` and writes it to global `result`.
7907// Returns true on success, or false on invalid object.
7908//
Jian Li83d87a72016-04-20 15:38:24 -07007909function writeNode(state, level, object, block, compact, iskey) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007910 state.tag = null;
7911 state.dump = object;
7912
7913 if (!detectType(state, object, false)) {
7914 detectType(state, object, true);
7915 }
7916
7917 var type = _toString.call(state.dump);
7918
7919 if (block) {
7920 block = (0 > state.flowLevel || state.flowLevel > level);
7921 }
7922
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007923 var objectOrArray = '[object Object]' === type || '[object Array]' === type,
7924 duplicateIndex,
7925 duplicate;
7926
7927 if (objectOrArray) {
7928 duplicateIndex = state.duplicates.indexOf(object);
7929 duplicate = duplicateIndex !== -1;
7930 }
7931
Jian Li83d87a72016-04-20 15:38:24 -07007932 if ((null !== state.tag && '?' !== state.tag) || duplicate || (2 !== state.indent && level > 0)) {
7933 compact = false;
7934 }
7935
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007936 if (duplicate && state.usedDuplicates[duplicateIndex]) {
7937 state.dump = '*ref_' + duplicateIndex;
7938 } else {
7939 if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
7940 state.usedDuplicates[duplicateIndex] = true;
7941 }
7942 if ('[object Object]' === type) {
7943 if (block && (0 !== Object.keys(state.dump).length)) {
7944 writeBlockMapping(state, level, state.dump, compact);
7945 if (duplicate) {
Jian Li83d87a72016-04-20 15:38:24 -07007946 state.dump = '&ref_' + duplicateIndex + state.dump;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007947 }
7948 } else {
7949 writeFlowMapping(state, level, state.dump);
7950 if (duplicate) {
7951 state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
7952 }
7953 }
7954 } else if ('[object Array]' === type) {
7955 if (block && (0 !== state.dump.length)) {
7956 writeBlockSequence(state, level, state.dump, compact);
7957 if (duplicate) {
Jian Li83d87a72016-04-20 15:38:24 -07007958 state.dump = '&ref_' + duplicateIndex + state.dump;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007959 }
7960 } else {
7961 writeFlowSequence(state, level, state.dump);
7962 if (duplicate) {
7963 state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
7964 }
7965 }
7966 } else if ('[object String]' === type) {
7967 if ('?' !== state.tag) {
Jian Li83d87a72016-04-20 15:38:24 -07007968 writeScalar(state, state.dump, level, iskey);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07007969 }
7970 } else {
7971 if (state.skipInvalid) {
7972 return false;
7973 }
7974 throw new YAMLException('unacceptable kind of an object to dump ' + type);
7975 }
7976
7977 if (null !== state.tag && '?' !== state.tag) {
7978 state.dump = '!<' + state.tag + '> ' + state.dump;
7979 }
7980 }
7981
7982 return true;
7983}
7984
7985function getDuplicateReferences(object, state) {
7986 var objects = [],
7987 duplicatesIndexes = [],
7988 index,
7989 length;
7990
7991 inspectNode(object, objects, duplicatesIndexes);
7992
7993 for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
7994 state.duplicates.push(objects[duplicatesIndexes[index]]);
7995 }
7996 state.usedDuplicates = new Array(length);
7997}
7998
7999function inspectNode(object, objects, duplicatesIndexes) {
Jian Li83d87a72016-04-20 15:38:24 -07008000 var objectKeyList,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008001 index,
8002 length;
8003
8004 if (null !== object && 'object' === typeof object) {
8005 index = objects.indexOf(object);
8006 if (-1 !== index) {
8007 if (-1 === duplicatesIndexes.indexOf(index)) {
8008 duplicatesIndexes.push(index);
8009 }
8010 } else {
8011 objects.push(object);
8012
8013 if (Array.isArray(object)) {
8014 for (index = 0, length = object.length; index < length; index += 1) {
8015 inspectNode(object[index], objects, duplicatesIndexes);
8016 }
8017 } else {
8018 objectKeyList = Object.keys(object);
8019
8020 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
8021 inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
8022 }
8023 }
8024 }
8025 }
8026}
8027
8028function dump(input, options) {
8029 options = options || {};
8030
8031 var state = new State(options);
8032
8033 getDuplicateReferences(input, state);
8034
8035 if (writeNode(state, 0, input, true, true)) {
8036 return state.dump + '\n';
8037 }
8038 return '';
8039}
8040
8041function safeDump(input, options) {
8042 return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
8043}
8044
8045module.exports.dump = dump;
8046module.exports.safeDump = safeDump;
8047
8048},{"./common":22,"./exception":24,"./schema/default_full":29,"./schema/default_safe":30}],24:[function(require,module,exports){
Jian Li83d87a72016-04-20 15:38:24 -07008049// YAML error class. http://stackoverflow.com/questions/8458984
8050//
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008051'use strict';
8052
8053
Jian Li83d87a72016-04-20 15:38:24 -07008054var inherits = require('inherit');
8055
8056
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008057function YAMLException(reason, mark) {
Jian Li83d87a72016-04-20 15:38:24 -07008058 // Super constructor
8059 Error.call(this);
8060
8061 // Include stack trace in error object
8062 if (Error.captureStackTrace) {
8063 // Chrome and NodeJS
8064 Error.captureStackTrace(this, this.constructor);
8065 } else {
8066 // FF, IE 10+ and Safari 6+. Fallback for others
8067 this.stack = (new Error()).stack || '';
8068 }
8069
8070 this.name = 'YAMLException';
8071 this.reason = reason;
8072 this.mark = mark;
8073 this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008074}
8075
8076
Jian Li83d87a72016-04-20 15:38:24 -07008077// Inherit from Error
8078inherits(YAMLException, Error);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008079
Jian Li83d87a72016-04-20 15:38:24 -07008080
8081YAMLException.prototype.toString = function toString(compact) {
8082 var result = this.name + ': ';
8083
8084 result += this.reason || '(unknown reason)';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008085
8086 if (!compact && this.mark) {
8087 result += ' ' + this.mark.toString();
8088 }
8089
8090 return result;
8091};
8092
8093
8094module.exports = YAMLException;
8095
Jian Li83d87a72016-04-20 15:38:24 -07008096},{"inherit":51}],25:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008097'use strict';
8098
8099/*eslint-disable max-len,no-use-before-define*/
8100
8101var common = require('./common');
8102var YAMLException = require('./exception');
8103var Mark = require('./mark');
8104var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
8105var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
8106
8107
8108var _hasOwnProperty = Object.prototype.hasOwnProperty;
8109
8110
8111var CONTEXT_FLOW_IN = 1;
8112var CONTEXT_FLOW_OUT = 2;
8113var CONTEXT_BLOCK_IN = 3;
8114var CONTEXT_BLOCK_OUT = 4;
8115
8116
8117var CHOMPING_CLIP = 1;
8118var CHOMPING_STRIP = 2;
8119var CHOMPING_KEEP = 3;
8120
8121
8122var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
8123var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
8124var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
8125var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
8126var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
8127
8128
8129function is_EOL(c) {
8130 return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
8131}
8132
8133function is_WHITE_SPACE(c) {
8134 return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
8135}
8136
8137function is_WS_OR_EOL(c) {
8138 return (c === 0x09/* Tab */) ||
8139 (c === 0x20/* Space */) ||
8140 (c === 0x0A/* LF */) ||
8141 (c === 0x0D/* CR */);
8142}
8143
8144function is_FLOW_INDICATOR(c) {
8145 return 0x2C/* , */ === c ||
8146 0x5B/* [ */ === c ||
8147 0x5D/* ] */ === c ||
8148 0x7B/* { */ === c ||
8149 0x7D/* } */ === c;
8150}
8151
8152function fromHexCode(c) {
8153 var lc;
8154
8155 if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
8156 return c - 0x30;
8157 }
8158
8159 /*eslint-disable no-bitwise*/
8160 lc = c | 0x20;
8161
8162 if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
8163 return lc - 0x61 + 10;
8164 }
8165
8166 return -1;
8167}
8168
8169function escapedHexLen(c) {
8170 if (c === 0x78/* x */) { return 2; }
8171 if (c === 0x75/* u */) { return 4; }
8172 if (c === 0x55/* U */) { return 8; }
8173 return 0;
8174}
8175
8176function fromDecimalCode(c) {
8177 if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
8178 return c - 0x30;
8179 }
8180
8181 return -1;
8182}
8183
8184function simpleEscapeSequence(c) {
8185 return (c === 0x30/* 0 */) ? '\x00' :
8186 (c === 0x61/* a */) ? '\x07' :
8187 (c === 0x62/* b */) ? '\x08' :
8188 (c === 0x74/* t */) ? '\x09' :
8189 (c === 0x09/* Tab */) ? '\x09' :
8190 (c === 0x6E/* n */) ? '\x0A' :
8191 (c === 0x76/* v */) ? '\x0B' :
8192 (c === 0x66/* f */) ? '\x0C' :
8193 (c === 0x72/* r */) ? '\x0D' :
8194 (c === 0x65/* e */) ? '\x1B' :
8195 (c === 0x20/* Space */) ? ' ' :
8196 (c === 0x22/* " */) ? '\x22' :
8197 (c === 0x2F/* / */) ? '/' :
8198 (c === 0x5C/* \ */) ? '\x5C' :
8199 (c === 0x4E/* N */) ? '\x85' :
8200 (c === 0x5F/* _ */) ? '\xA0' :
8201 (c === 0x4C/* L */) ? '\u2028' :
8202 (c === 0x50/* P */) ? '\u2029' : '';
8203}
8204
8205function charFromCodepoint(c) {
8206 if (c <= 0xFFFF) {
8207 return String.fromCharCode(c);
8208 }
8209 // Encode UTF-16 surrogate pair
8210 // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
8211 return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
8212 ((c - 0x010000) & 0x03FF) + 0xDC00);
8213}
8214
8215var simpleEscapeCheck = new Array(256); // integer, for fast access
8216var simpleEscapeMap = new Array(256);
8217for (var i = 0; i < 256; i++) {
8218 simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
8219 simpleEscapeMap[i] = simpleEscapeSequence(i);
8220}
8221
8222
8223function State(input, options) {
8224 this.input = input;
8225
8226 this.filename = options['filename'] || null;
8227 this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
8228 this.onWarning = options['onWarning'] || null;
8229 this.legacy = options['legacy'] || false;
8230
8231 this.implicitTypes = this.schema.compiledImplicit;
8232 this.typeMap = this.schema.compiledTypeMap;
8233
8234 this.length = input.length;
8235 this.position = 0;
8236 this.line = 0;
8237 this.lineStart = 0;
8238 this.lineIndent = 0;
8239
8240 this.documents = [];
8241
8242 /*
8243 this.version;
8244 this.checkLineBreaks;
8245 this.tagMap;
8246 this.anchorMap;
8247 this.tag;
8248 this.anchor;
8249 this.kind;
8250 this.result;*/
8251
8252}
8253
8254
8255function generateError(state, message) {
8256 return new YAMLException(
8257 message,
8258 new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
8259}
8260
8261function throwError(state, message) {
8262 throw generateError(state, message);
8263}
8264
8265function throwWarning(state, message) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008266 if (state.onWarning) {
Jian Li83d87a72016-04-20 15:38:24 -07008267 state.onWarning.call(null, generateError(state, message));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008268 }
8269}
8270
8271
8272var directiveHandlers = {
8273
8274 YAML: function handleYamlDirective(state, name, args) {
8275
8276 var match, major, minor;
8277
8278 if (null !== state.version) {
8279 throwError(state, 'duplication of %YAML directive');
8280 }
8281
8282 if (1 !== args.length) {
8283 throwError(state, 'YAML directive accepts exactly one argument');
8284 }
8285
8286 match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
8287
8288 if (null === match) {
8289 throwError(state, 'ill-formed argument of the YAML directive');
8290 }
8291
8292 major = parseInt(match[1], 10);
8293 minor = parseInt(match[2], 10);
8294
8295 if (1 !== major) {
8296 throwError(state, 'unacceptable YAML version of the document');
8297 }
8298
8299 state.version = args[0];
8300 state.checkLineBreaks = (minor < 2);
8301
8302 if (1 !== minor && 2 !== minor) {
8303 throwWarning(state, 'unsupported YAML version of the document');
8304 }
8305 },
8306
8307 TAG: function handleTagDirective(state, name, args) {
8308
8309 var handle, prefix;
8310
8311 if (2 !== args.length) {
8312 throwError(state, 'TAG directive accepts exactly two arguments');
8313 }
8314
8315 handle = args[0];
8316 prefix = args[1];
8317
8318 if (!PATTERN_TAG_HANDLE.test(handle)) {
8319 throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
8320 }
8321
8322 if (_hasOwnProperty.call(state.tagMap, handle)) {
8323 throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
8324 }
8325
8326 if (!PATTERN_TAG_URI.test(prefix)) {
8327 throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
8328 }
8329
8330 state.tagMap[handle] = prefix;
8331 }
8332};
8333
8334
8335function captureSegment(state, start, end, checkJson) {
8336 var _position, _length, _character, _result;
8337
8338 if (start < end) {
8339 _result = state.input.slice(start, end);
8340
8341 if (checkJson) {
8342 for (_position = 0, _length = _result.length;
8343 _position < _length;
8344 _position += 1) {
8345 _character = _result.charCodeAt(_position);
8346 if (!(0x09 === _character ||
8347 0x20 <= _character && _character <= 0x10FFFF)) {
8348 throwError(state, 'expected valid JSON character');
8349 }
8350 }
Jian Li83d87a72016-04-20 15:38:24 -07008351 } else if (PATTERN_NON_PRINTABLE.test(_result)) {
8352 throwError(state, 'the stream contains non-printable characters');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008353 }
8354
8355 state.result += _result;
8356 }
8357}
8358
8359function mergeMappings(state, destination, source) {
8360 var sourceKeys, key, index, quantity;
8361
8362 if (!common.isObject(source)) {
8363 throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
8364 }
8365
8366 sourceKeys = Object.keys(source);
8367
8368 for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
8369 key = sourceKeys[index];
8370
8371 if (!_hasOwnProperty.call(destination, key)) {
8372 destination[key] = source[key];
8373 }
8374 }
8375}
8376
8377function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
8378 var index, quantity;
8379
8380 keyNode = String(keyNode);
8381
8382 if (null === _result) {
8383 _result = {};
8384 }
8385
8386 if ('tag:yaml.org,2002:merge' === keyTag) {
8387 if (Array.isArray(valueNode)) {
8388 for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
8389 mergeMappings(state, _result, valueNode[index]);
8390 }
8391 } else {
8392 mergeMappings(state, _result, valueNode);
8393 }
8394 } else {
8395 _result[keyNode] = valueNode;
8396 }
8397
8398 return _result;
8399}
8400
8401function readLineBreak(state) {
8402 var ch;
8403
8404 ch = state.input.charCodeAt(state.position);
8405
8406 if (0x0A/* LF */ === ch) {
8407 state.position++;
8408 } else if (0x0D/* CR */ === ch) {
8409 state.position++;
8410 if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {
8411 state.position++;
8412 }
8413 } else {
8414 throwError(state, 'a line break is expected');
8415 }
8416
8417 state.line += 1;
8418 state.lineStart = state.position;
8419}
8420
8421function skipSeparationSpace(state, allowComments, checkIndent) {
8422 var lineBreaks = 0,
8423 ch = state.input.charCodeAt(state.position);
8424
8425 while (0 !== ch) {
8426 while (is_WHITE_SPACE(ch)) {
8427 ch = state.input.charCodeAt(++state.position);
8428 }
8429
8430 if (allowComments && 0x23/* # */ === ch) {
8431 do {
8432 ch = state.input.charCodeAt(++state.position);
8433 } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);
8434 }
8435
8436 if (is_EOL(ch)) {
8437 readLineBreak(state);
8438
8439 ch = state.input.charCodeAt(state.position);
8440 lineBreaks++;
8441 state.lineIndent = 0;
8442
8443 while (0x20/* Space */ === ch) {
8444 state.lineIndent++;
8445 ch = state.input.charCodeAt(++state.position);
8446 }
8447 } else {
8448 break;
8449 }
8450 }
8451
8452 if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {
8453 throwWarning(state, 'deficient indentation');
8454 }
8455
8456 return lineBreaks;
8457}
8458
8459function testDocumentSeparator(state) {
8460 var _position = state.position,
8461 ch;
8462
8463 ch = state.input.charCodeAt(_position);
8464
8465 // Condition state.position === state.lineStart is tested
8466 // in parent on each call, for efficiency. No needs to test here again.
8467 if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&
8468 state.input.charCodeAt(_position + 1) === ch &&
8469 state.input.charCodeAt(_position + 2) === ch) {
8470
8471 _position += 3;
8472
8473 ch = state.input.charCodeAt(_position);
8474
8475 if (ch === 0 || is_WS_OR_EOL(ch)) {
8476 return true;
8477 }
8478 }
8479
8480 return false;
8481}
8482
8483function writeFoldedLines(state, count) {
8484 if (1 === count) {
8485 state.result += ' ';
8486 } else if (count > 1) {
8487 state.result += common.repeat('\n', count - 1);
8488 }
8489}
8490
8491
8492function readPlainScalar(state, nodeIndent, withinFlowCollection) {
8493 var preceding,
8494 following,
8495 captureStart,
8496 captureEnd,
8497 hasPendingContent,
8498 _line,
8499 _lineStart,
8500 _lineIndent,
8501 _kind = state.kind,
8502 _result = state.result,
8503 ch;
8504
8505 ch = state.input.charCodeAt(state.position);
8506
8507 if (is_WS_OR_EOL(ch) ||
8508 is_FLOW_INDICATOR(ch) ||
8509 0x23/* # */ === ch ||
8510 0x26/* & */ === ch ||
8511 0x2A/* * */ === ch ||
8512 0x21/* ! */ === ch ||
8513 0x7C/* | */ === ch ||
8514 0x3E/* > */ === ch ||
8515 0x27/* ' */ === ch ||
8516 0x22/* " */ === ch ||
8517 0x25/* % */ === ch ||
8518 0x40/* @ */ === ch ||
8519 0x60/* ` */ === ch) {
8520 return false;
8521 }
8522
8523 if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {
8524 following = state.input.charCodeAt(state.position + 1);
8525
8526 if (is_WS_OR_EOL(following) ||
8527 withinFlowCollection && is_FLOW_INDICATOR(following)) {
8528 return false;
8529 }
8530 }
8531
8532 state.kind = 'scalar';
8533 state.result = '';
8534 captureStart = captureEnd = state.position;
8535 hasPendingContent = false;
8536
8537 while (0 !== ch) {
8538 if (0x3A/* : */ === ch) {
8539 following = state.input.charCodeAt(state.position + 1);
8540
8541 if (is_WS_OR_EOL(following) ||
8542 withinFlowCollection && is_FLOW_INDICATOR(following)) {
8543 break;
8544 }
8545
8546 } else if (0x23/* # */ === ch) {
8547 preceding = state.input.charCodeAt(state.position - 1);
8548
8549 if (is_WS_OR_EOL(preceding)) {
8550 break;
8551 }
8552
8553 } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
8554 withinFlowCollection && is_FLOW_INDICATOR(ch)) {
8555 break;
8556
8557 } else if (is_EOL(ch)) {
8558 _line = state.line;
8559 _lineStart = state.lineStart;
8560 _lineIndent = state.lineIndent;
8561 skipSeparationSpace(state, false, -1);
8562
8563 if (state.lineIndent >= nodeIndent) {
8564 hasPendingContent = true;
8565 ch = state.input.charCodeAt(state.position);
8566 continue;
8567 } else {
8568 state.position = captureEnd;
8569 state.line = _line;
8570 state.lineStart = _lineStart;
8571 state.lineIndent = _lineIndent;
8572 break;
8573 }
8574 }
8575
8576 if (hasPendingContent) {
8577 captureSegment(state, captureStart, captureEnd, false);
8578 writeFoldedLines(state, state.line - _line);
8579 captureStart = captureEnd = state.position;
8580 hasPendingContent = false;
8581 }
8582
8583 if (!is_WHITE_SPACE(ch)) {
8584 captureEnd = state.position + 1;
8585 }
8586
8587 ch = state.input.charCodeAt(++state.position);
8588 }
8589
8590 captureSegment(state, captureStart, captureEnd, false);
8591
8592 if (state.result) {
8593 return true;
8594 }
8595
8596 state.kind = _kind;
8597 state.result = _result;
8598 return false;
8599}
8600
8601function readSingleQuotedScalar(state, nodeIndent) {
8602 var ch,
8603 captureStart, captureEnd;
8604
8605 ch = state.input.charCodeAt(state.position);
8606
8607 if (0x27/* ' */ !== ch) {
8608 return false;
8609 }
8610
8611 state.kind = 'scalar';
8612 state.result = '';
8613 state.position++;
8614 captureStart = captureEnd = state.position;
8615
8616 while (0 !== (ch = state.input.charCodeAt(state.position))) {
8617 if (0x27/* ' */ === ch) {
8618 captureSegment(state, captureStart, state.position, true);
8619 ch = state.input.charCodeAt(++state.position);
8620
8621 if (0x27/* ' */ === ch) {
8622 captureStart = captureEnd = state.position;
8623 state.position++;
8624 } else {
8625 return true;
8626 }
8627
8628 } else if (is_EOL(ch)) {
8629 captureSegment(state, captureStart, captureEnd, true);
8630 writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8631 captureStart = captureEnd = state.position;
8632
8633 } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8634 throwError(state, 'unexpected end of the document within a single quoted scalar');
8635
8636 } else {
8637 state.position++;
8638 captureEnd = state.position;
8639 }
8640 }
8641
8642 throwError(state, 'unexpected end of the stream within a single quoted scalar');
8643}
8644
8645function readDoubleQuotedScalar(state, nodeIndent) {
8646 var captureStart,
8647 captureEnd,
8648 hexLength,
8649 hexResult,
Jian Li83d87a72016-04-20 15:38:24 -07008650 tmp,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008651 ch;
8652
8653 ch = state.input.charCodeAt(state.position);
8654
8655 if (0x22/* " */ !== ch) {
8656 return false;
8657 }
8658
8659 state.kind = 'scalar';
8660 state.result = '';
8661 state.position++;
8662 captureStart = captureEnd = state.position;
8663
8664 while (0 !== (ch = state.input.charCodeAt(state.position))) {
8665 if (0x22/* " */ === ch) {
8666 captureSegment(state, captureStart, state.position, true);
8667 state.position++;
8668 return true;
8669
8670 } else if (0x5C/* \ */ === ch) {
8671 captureSegment(state, captureStart, state.position, true);
8672 ch = state.input.charCodeAt(++state.position);
8673
8674 if (is_EOL(ch)) {
8675 skipSeparationSpace(state, false, nodeIndent);
8676
8677 // TODO: rework to inline fn with no type cast?
8678 } else if (ch < 256 && simpleEscapeCheck[ch]) {
8679 state.result += simpleEscapeMap[ch];
8680 state.position++;
8681
8682 } else if ((tmp = escapedHexLen(ch)) > 0) {
8683 hexLength = tmp;
8684 hexResult = 0;
8685
8686 for (; hexLength > 0; hexLength--) {
8687 ch = state.input.charCodeAt(++state.position);
8688
8689 if ((tmp = fromHexCode(ch)) >= 0) {
8690 hexResult = (hexResult << 4) + tmp;
8691
8692 } else {
8693 throwError(state, 'expected hexadecimal character');
8694 }
8695 }
8696
8697 state.result += charFromCodepoint(hexResult);
8698
8699 state.position++;
8700
8701 } else {
8702 throwError(state, 'unknown escape sequence');
8703 }
8704
8705 captureStart = captureEnd = state.position;
8706
8707 } else if (is_EOL(ch)) {
8708 captureSegment(state, captureStart, captureEnd, true);
8709 writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
8710 captureStart = captureEnd = state.position;
8711
8712 } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
8713 throwError(state, 'unexpected end of the document within a double quoted scalar');
8714
8715 } else {
8716 state.position++;
8717 captureEnd = state.position;
8718 }
8719 }
8720
8721 throwError(state, 'unexpected end of the stream within a double quoted scalar');
8722}
8723
8724function readFlowCollection(state, nodeIndent) {
8725 var readNext = true,
8726 _line,
8727 _tag = state.tag,
8728 _result,
8729 _anchor = state.anchor,
8730 following,
8731 terminator,
8732 isPair,
8733 isExplicitPair,
8734 isMapping,
8735 keyNode,
8736 keyTag,
8737 valueNode,
8738 ch;
8739
8740 ch = state.input.charCodeAt(state.position);
8741
8742 if (ch === 0x5B/* [ */) {
8743 terminator = 0x5D;/* ] */
8744 isMapping = false;
8745 _result = [];
8746 } else if (ch === 0x7B/* { */) {
8747 terminator = 0x7D;/* } */
8748 isMapping = true;
8749 _result = {};
8750 } else {
8751 return false;
8752 }
8753
8754 if (null !== state.anchor) {
8755 state.anchorMap[state.anchor] = _result;
8756 }
8757
8758 ch = state.input.charCodeAt(++state.position);
8759
8760 while (0 !== ch) {
8761 skipSeparationSpace(state, true, nodeIndent);
8762
8763 ch = state.input.charCodeAt(state.position);
8764
8765 if (ch === terminator) {
8766 state.position++;
8767 state.tag = _tag;
8768 state.anchor = _anchor;
8769 state.kind = isMapping ? 'mapping' : 'sequence';
8770 state.result = _result;
8771 return true;
8772 } else if (!readNext) {
8773 throwError(state, 'missed comma between flow collection entries');
8774 }
8775
8776 keyTag = keyNode = valueNode = null;
8777 isPair = isExplicitPair = false;
8778
8779 if (0x3F/* ? */ === ch) {
8780 following = state.input.charCodeAt(state.position + 1);
8781
8782 if (is_WS_OR_EOL(following)) {
8783 isPair = isExplicitPair = true;
8784 state.position++;
8785 skipSeparationSpace(state, true, nodeIndent);
8786 }
8787 }
8788
8789 _line = state.line;
8790 composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8791 keyTag = state.tag;
8792 keyNode = state.result;
8793 skipSeparationSpace(state, true, nodeIndent);
8794
8795 ch = state.input.charCodeAt(state.position);
8796
8797 if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {
8798 isPair = true;
8799 ch = state.input.charCodeAt(++state.position);
8800 skipSeparationSpace(state, true, nodeIndent);
8801 composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
8802 valueNode = state.result;
8803 }
8804
8805 if (isMapping) {
8806 storeMappingPair(state, _result, keyTag, keyNode, valueNode);
8807 } else if (isPair) {
8808 _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));
8809 } else {
8810 _result.push(keyNode);
8811 }
8812
8813 skipSeparationSpace(state, true, nodeIndent);
8814
8815 ch = state.input.charCodeAt(state.position);
8816
8817 if (0x2C/* , */ === ch) {
8818 readNext = true;
8819 ch = state.input.charCodeAt(++state.position);
8820 } else {
8821 readNext = false;
8822 }
8823 }
8824
8825 throwError(state, 'unexpected end of the stream within a flow collection');
8826}
8827
8828function readBlockScalar(state, nodeIndent) {
8829 var captureStart,
8830 folding,
8831 chomping = CHOMPING_CLIP,
8832 detectedIndent = false,
8833 textIndent = nodeIndent,
8834 emptyLines = 0,
8835 atMoreIndented = false,
8836 tmp,
8837 ch;
8838
8839 ch = state.input.charCodeAt(state.position);
8840
8841 if (ch === 0x7C/* | */) {
8842 folding = false;
8843 } else if (ch === 0x3E/* > */) {
8844 folding = true;
8845 } else {
8846 return false;
8847 }
8848
8849 state.kind = 'scalar';
8850 state.result = '';
8851
8852 while (0 !== ch) {
8853 ch = state.input.charCodeAt(++state.position);
8854
8855 if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {
8856 if (CHOMPING_CLIP === chomping) {
8857 chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;
8858 } else {
8859 throwError(state, 'repeat of a chomping mode identifier');
8860 }
8861
8862 } else if ((tmp = fromDecimalCode(ch)) >= 0) {
8863 if (tmp === 0) {
8864 throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
8865 } else if (!detectedIndent) {
8866 textIndent = nodeIndent + tmp - 1;
8867 detectedIndent = true;
8868 } else {
8869 throwError(state, 'repeat of an indentation width identifier');
8870 }
8871
8872 } else {
8873 break;
8874 }
8875 }
8876
8877 if (is_WHITE_SPACE(ch)) {
8878 do { ch = state.input.charCodeAt(++state.position); }
8879 while (is_WHITE_SPACE(ch));
8880
8881 if (0x23/* # */ === ch) {
8882 do { ch = state.input.charCodeAt(++state.position); }
8883 while (!is_EOL(ch) && (0 !== ch));
8884 }
8885 }
8886
8887 while (0 !== ch) {
8888 readLineBreak(state);
8889 state.lineIndent = 0;
8890
8891 ch = state.input.charCodeAt(state.position);
8892
8893 while ((!detectedIndent || state.lineIndent < textIndent) &&
8894 (0x20/* Space */ === ch)) {
8895 state.lineIndent++;
8896 ch = state.input.charCodeAt(++state.position);
8897 }
8898
8899 if (!detectedIndent && state.lineIndent > textIndent) {
8900 textIndent = state.lineIndent;
8901 }
8902
8903 if (is_EOL(ch)) {
8904 emptyLines++;
8905 continue;
8906 }
8907
8908 // End of the scalar.
8909 if (state.lineIndent < textIndent) {
8910
8911 // Perform the chomping.
8912 if (chomping === CHOMPING_KEEP) {
8913 state.result += common.repeat('\n', emptyLines);
8914 } else if (chomping === CHOMPING_CLIP) {
8915 if (detectedIndent) { // i.e. only if the scalar is not empty.
8916 state.result += '\n';
8917 }
8918 }
8919
8920 // Break this `while` cycle and go to the funciton's epilogue.
8921 break;
8922 }
8923
8924 // Folded style: use fancy rules to handle line breaks.
8925 if (folding) {
8926
8927 // Lines starting with white space characters (more-indented lines) are not folded.
8928 if (is_WHITE_SPACE(ch)) {
8929 atMoreIndented = true;
8930 state.result += common.repeat('\n', emptyLines + 1);
8931
8932 // End of more-indented block.
8933 } else if (atMoreIndented) {
8934 atMoreIndented = false;
8935 state.result += common.repeat('\n', emptyLines + 1);
8936
8937 // Just one line break - perceive as the same line.
8938 } else if (0 === emptyLines) {
8939 if (detectedIndent) { // i.e. only if we have already read some scalar content.
8940 state.result += ' ';
8941 }
8942
8943 // Several line breaks - perceive as different lines.
8944 } else {
8945 state.result += common.repeat('\n', emptyLines);
8946 }
8947
8948 // Literal style: just add exact number of line breaks between content lines.
8949 } else if (detectedIndent) {
8950 // If current line isn't the first one - count line break from the last content line.
8951 state.result += common.repeat('\n', emptyLines + 1);
8952 } else {
8953 // In case of the first content line - count only empty lines.
Jian Li83d87a72016-04-20 15:38:24 -07008954 state.result += common.repeat('\n', emptyLines);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07008955 }
8956
8957 detectedIndent = true;
8958 emptyLines = 0;
8959 captureStart = state.position;
8960
8961 while (!is_EOL(ch) && (0 !== ch)) {
8962 ch = state.input.charCodeAt(++state.position);
8963 }
8964
8965 captureSegment(state, captureStart, state.position, false);
8966 }
8967
8968 return true;
8969}
8970
8971function readBlockSequence(state, nodeIndent) {
8972 var _line,
8973 _tag = state.tag,
8974 _anchor = state.anchor,
8975 _result = [],
8976 following,
8977 detected = false,
8978 ch;
8979
8980 if (null !== state.anchor) {
8981 state.anchorMap[state.anchor] = _result;
8982 }
8983
8984 ch = state.input.charCodeAt(state.position);
8985
8986 while (0 !== ch) {
8987
8988 if (0x2D/* - */ !== ch) {
8989 break;
8990 }
8991
8992 following = state.input.charCodeAt(state.position + 1);
8993
8994 if (!is_WS_OR_EOL(following)) {
8995 break;
8996 }
8997
8998 detected = true;
8999 state.position++;
9000
9001 if (skipSeparationSpace(state, true, -1)) {
9002 if (state.lineIndent <= nodeIndent) {
9003 _result.push(null);
9004 ch = state.input.charCodeAt(state.position);
9005 continue;
9006 }
9007 }
9008
9009 _line = state.line;
9010 composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
9011 _result.push(state.result);
9012 skipSeparationSpace(state, true, -1);
9013
9014 ch = state.input.charCodeAt(state.position);
9015
9016 if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {
9017 throwError(state, 'bad indentation of a sequence entry');
9018 } else if (state.lineIndent < nodeIndent) {
9019 break;
9020 }
9021 }
9022
9023 if (detected) {
9024 state.tag = _tag;
9025 state.anchor = _anchor;
9026 state.kind = 'sequence';
9027 state.result = _result;
9028 return true;
9029 }
9030 return false;
9031}
9032
9033function readBlockMapping(state, nodeIndent, flowIndent) {
9034 var following,
9035 allowCompact,
9036 _line,
9037 _tag = state.tag,
9038 _anchor = state.anchor,
9039 _result = {},
9040 keyTag = null,
9041 keyNode = null,
9042 valueNode = null,
9043 atExplicitKey = false,
9044 detected = false,
9045 ch;
9046
9047 if (null !== state.anchor) {
9048 state.anchorMap[state.anchor] = _result;
9049 }
9050
9051 ch = state.input.charCodeAt(state.position);
9052
9053 while (0 !== ch) {
9054 following = state.input.charCodeAt(state.position + 1);
9055 _line = state.line; // Save the current line.
9056
9057 //
9058 // Explicit notation case. There are two separate blocks:
9059 // first for the key (denoted by "?") and second for the value (denoted by ":")
9060 //
9061 if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) {
9062
9063 if (0x3F/* ? */ === ch) {
9064 if (atExplicitKey) {
9065 storeMappingPair(state, _result, keyTag, keyNode, null);
9066 keyTag = keyNode = valueNode = null;
9067 }
9068
9069 detected = true;
9070 atExplicitKey = true;
9071 allowCompact = true;
9072
9073 } else if (atExplicitKey) {
9074 // i.e. 0x3A/* : */ === character after the explicit key.
9075 atExplicitKey = false;
9076 allowCompact = true;
9077
9078 } else {
9079 throwError(state, 'incomplete explicit mapping pair; a key node is missed');
9080 }
9081
9082 state.position += 1;
9083 ch = following;
9084
9085 //
9086 // Implicit notation case. Flow-style node as the key first, then ":", and the value.
9087 //
9088 } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
9089
9090 if (state.line === _line) {
9091 ch = state.input.charCodeAt(state.position);
9092
9093 while (is_WHITE_SPACE(ch)) {
9094 ch = state.input.charCodeAt(++state.position);
9095 }
9096
9097 if (0x3A/* : */ === ch) {
9098 ch = state.input.charCodeAt(++state.position);
9099
9100 if (!is_WS_OR_EOL(ch)) {
9101 throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
9102 }
9103
9104 if (atExplicitKey) {
9105 storeMappingPair(state, _result, keyTag, keyNode, null);
9106 keyTag = keyNode = valueNode = null;
9107 }
9108
9109 detected = true;
9110 atExplicitKey = false;
9111 allowCompact = false;
9112 keyTag = state.tag;
9113 keyNode = state.result;
9114
9115 } else if (detected) {
9116 throwError(state, 'can not read an implicit mapping pair; a colon is missed');
9117
9118 } else {
9119 state.tag = _tag;
9120 state.anchor = _anchor;
9121 return true; // Keep the result of `composeNode`.
9122 }
9123
9124 } else if (detected) {
9125 throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
9126
9127 } else {
9128 state.tag = _tag;
9129 state.anchor = _anchor;
9130 return true; // Keep the result of `composeNode`.
9131 }
9132
9133 } else {
9134 break; // Reading is done. Go to the epilogue.
9135 }
9136
9137 //
9138 // Common reading code for both explicit and implicit notations.
9139 //
9140 if (state.line === _line || state.lineIndent > nodeIndent) {
9141 if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
9142 if (atExplicitKey) {
9143 keyNode = state.result;
9144 } else {
9145 valueNode = state.result;
9146 }
9147 }
9148
9149 if (!atExplicitKey) {
9150 storeMappingPair(state, _result, keyTag, keyNode, valueNode);
9151 keyTag = keyNode = valueNode = null;
9152 }
9153
9154 skipSeparationSpace(state, true, -1);
9155 ch = state.input.charCodeAt(state.position);
9156 }
9157
9158 if (state.lineIndent > nodeIndent && (0 !== ch)) {
9159 throwError(state, 'bad indentation of a mapping entry');
9160 } else if (state.lineIndent < nodeIndent) {
9161 break;
9162 }
9163 }
9164
9165 //
9166 // Epilogue.
9167 //
9168
9169 // Special case: last mapping's node contains only the key in explicit notation.
9170 if (atExplicitKey) {
9171 storeMappingPair(state, _result, keyTag, keyNode, null);
9172 }
9173
9174 // Expose the resulting mapping.
9175 if (detected) {
9176 state.tag = _tag;
9177 state.anchor = _anchor;
9178 state.kind = 'mapping';
9179 state.result = _result;
9180 }
9181
9182 return detected;
9183}
9184
9185function readTagProperty(state) {
9186 var _position,
9187 isVerbatim = false,
9188 isNamed = false,
9189 tagHandle,
9190 tagName,
9191 ch;
9192
9193 ch = state.input.charCodeAt(state.position);
9194
9195 if (0x21/* ! */ !== ch) {
9196 return false;
9197 }
9198
9199 if (null !== state.tag) {
9200 throwError(state, 'duplication of a tag property');
9201 }
9202
9203 ch = state.input.charCodeAt(++state.position);
9204
9205 if (0x3C/* < */ === ch) {
9206 isVerbatim = true;
9207 ch = state.input.charCodeAt(++state.position);
9208
9209 } else if (0x21/* ! */ === ch) {
9210 isNamed = true;
9211 tagHandle = '!!';
9212 ch = state.input.charCodeAt(++state.position);
9213
9214 } else {
9215 tagHandle = '!';
9216 }
9217
9218 _position = state.position;
9219
9220 if (isVerbatim) {
9221 do { ch = state.input.charCodeAt(++state.position); }
9222 while (0 !== ch && 0x3E/* > */ !== ch);
9223
9224 if (state.position < state.length) {
9225 tagName = state.input.slice(_position, state.position);
9226 ch = state.input.charCodeAt(++state.position);
9227 } else {
9228 throwError(state, 'unexpected end of the stream within a verbatim tag');
9229 }
9230 } else {
9231 while (0 !== ch && !is_WS_OR_EOL(ch)) {
9232
9233 if (0x21/* ! */ === ch) {
9234 if (!isNamed) {
9235 tagHandle = state.input.slice(_position - 1, state.position + 1);
9236
9237 if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
9238 throwError(state, 'named tag handle cannot contain such characters');
9239 }
9240
9241 isNamed = true;
9242 _position = state.position + 1;
9243 } else {
9244 throwError(state, 'tag suffix cannot contain exclamation marks');
9245 }
9246 }
9247
9248 ch = state.input.charCodeAt(++state.position);
9249 }
9250
9251 tagName = state.input.slice(_position, state.position);
9252
9253 if (PATTERN_FLOW_INDICATORS.test(tagName)) {
9254 throwError(state, 'tag suffix cannot contain flow indicator characters');
9255 }
9256 }
9257
9258 if (tagName && !PATTERN_TAG_URI.test(tagName)) {
9259 throwError(state, 'tag name cannot contain such characters: ' + tagName);
9260 }
9261
9262 if (isVerbatim) {
9263 state.tag = tagName;
9264
9265 } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
9266 state.tag = state.tagMap[tagHandle] + tagName;
9267
9268 } else if ('!' === tagHandle) {
9269 state.tag = '!' + tagName;
9270
9271 } else if ('!!' === tagHandle) {
9272 state.tag = 'tag:yaml.org,2002:' + tagName;
9273
9274 } else {
9275 throwError(state, 'undeclared tag handle "' + tagHandle + '"');
9276 }
9277
9278 return true;
9279}
9280
9281function readAnchorProperty(state) {
9282 var _position,
9283 ch;
9284
9285 ch = state.input.charCodeAt(state.position);
9286
9287 if (0x26/* & */ !== ch) {
9288 return false;
9289 }
9290
9291 if (null !== state.anchor) {
9292 throwError(state, 'duplication of an anchor property');
9293 }
9294
9295 ch = state.input.charCodeAt(++state.position);
9296 _position = state.position;
9297
9298 while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
9299 ch = state.input.charCodeAt(++state.position);
9300 }
9301
9302 if (state.position === _position) {
9303 throwError(state, 'name of an anchor node must contain at least one character');
9304 }
9305
9306 state.anchor = state.input.slice(_position, state.position);
9307 return true;
9308}
9309
9310function readAlias(state) {
9311 var _position, alias,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07009312 ch;
9313
9314 ch = state.input.charCodeAt(state.position);
9315
9316 if (0x2A/* * */ !== ch) {
9317 return false;
9318 }
9319
9320 ch = state.input.charCodeAt(++state.position);
9321 _position = state.position;
9322
9323 while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
9324 ch = state.input.charCodeAt(++state.position);
9325 }
9326
9327 if (state.position === _position) {
9328 throwError(state, 'name of an alias node must contain at least one character');
9329 }
9330
9331 alias = state.input.slice(_position, state.position);
9332
9333 if (!state.anchorMap.hasOwnProperty(alias)) {
9334 throwError(state, 'unidentified alias "' + alias + '"');
9335 }
9336
9337 state.result = state.anchorMap[alias];
9338 skipSeparationSpace(state, true, -1);
9339 return true;
9340}
9341
9342function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
9343 var allowBlockStyles,
9344 allowBlockScalars,
9345 allowBlockCollections,
9346 indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
9347 atNewLine = false,
9348 hasContent = false,
9349 typeIndex,
9350 typeQuantity,
9351 type,
9352 flowIndent,
Jian Li83d87a72016-04-20 15:38:24 -07009353 blockIndent;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07009354
9355 state.tag = null;
9356 state.anchor = null;
9357 state.kind = null;
9358 state.result = null;
9359
9360 allowBlockStyles = allowBlockScalars = allowBlockCollections =
9361 CONTEXT_BLOCK_OUT === nodeContext ||
9362 CONTEXT_BLOCK_IN === nodeContext;
9363
9364 if (allowToSeek) {
9365 if (skipSeparationSpace(state, true, -1)) {
9366 atNewLine = true;
9367
9368 if (state.lineIndent > parentIndent) {
9369 indentStatus = 1;
9370 } else if (state.lineIndent === parentIndent) {
9371 indentStatus = 0;
9372 } else if (state.lineIndent < parentIndent) {
9373 indentStatus = -1;
9374 }
9375 }
9376 }
9377
9378 if (1 === indentStatus) {
9379 while (readTagProperty(state) || readAnchorProperty(state)) {
9380 if (skipSeparationSpace(state, true, -1)) {
9381 atNewLine = true;
9382 allowBlockCollections = allowBlockStyles;
9383
9384 if (state.lineIndent > parentIndent) {
9385 indentStatus = 1;
9386 } else if (state.lineIndent === parentIndent) {
9387 indentStatus = 0;
9388 } else if (state.lineIndent < parentIndent) {
9389 indentStatus = -1;
9390 }
9391 } else {
9392 allowBlockCollections = false;
9393 }
9394 }
9395 }
9396
9397 if (allowBlockCollections) {
9398 allowBlockCollections = atNewLine || allowCompact;
9399 }
9400
9401 if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
9402 if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
9403 flowIndent = parentIndent;
9404 } else {
9405 flowIndent = parentIndent + 1;
9406 }
9407
9408 blockIndent = state.position - state.lineStart;
9409
9410 if (1 === indentStatus) {
9411 if (allowBlockCollections &&
9412 (readBlockSequence(state, blockIndent) ||
9413 readBlockMapping(state, blockIndent, flowIndent)) ||
9414 readFlowCollection(state, flowIndent)) {
9415 hasContent = true;
9416 } else {
9417 if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
9418 readSingleQuotedScalar(state, flowIndent) ||
9419 readDoubleQuotedScalar(state, flowIndent)) {
9420 hasContent = true;
9421
9422 } else if (readAlias(state)) {
9423 hasContent = true;
9424
9425 if (null !== state.tag || null !== state.anchor) {
9426 throwError(state, 'alias node should not have any properties');
9427 }
9428
9429 } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
9430 hasContent = true;
9431
9432 if (null === state.tag) {
9433 state.tag = '?';
9434 }
9435 }
9436
9437 if (null !== state.anchor) {
9438 state.anchorMap[state.anchor] = state.result;
9439 }
9440 }
9441 } else if (0 === indentStatus) {
9442 // Special case: block sequences are allowed to have same indentation level as the parent.
9443 // http://www.yaml.org/spec/1.2/spec.html#id2799784
9444 hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
9445 }
9446 }
9447
9448 if (null !== state.tag && '!' !== state.tag) {
9449 if ('?' === state.tag) {
9450 for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
9451 typeIndex < typeQuantity;
9452 typeIndex += 1) {
9453 type = state.implicitTypes[typeIndex];
9454
9455 // Implicit resolving is not allowed for non-scalar types, and '?'
9456 // non-specific tag is only assigned to plain scalars. So, it isn't
9457 // needed to check for 'kind' conformity.
9458
9459 if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
9460 state.result = type.construct(state.result);
9461 state.tag = type.tag;
9462 if (null !== state.anchor) {
9463 state.anchorMap[state.anchor] = state.result;
9464 }
9465 break;
9466 }
9467 }
9468 } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
9469 type = state.typeMap[state.tag];
9470
9471 if (null !== state.result && type.kind !== state.kind) {
9472 throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
9473 }
9474
9475 if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
9476 throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
9477 } else {
9478 state.result = type.construct(state.result);
9479 if (null !== state.anchor) {
9480 state.anchorMap[state.anchor] = state.result;
9481 }
9482 }
9483 } else {
Jian Li83d87a72016-04-20 15:38:24 -07009484 throwError(state, 'unknown tag !<' + state.tag + '>');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07009485 }
9486 }
9487
9488 return null !== state.tag || null !== state.anchor || hasContent;
9489}
9490
9491function readDocument(state) {
9492 var documentStart = state.position,
9493 _position,
9494 directiveName,
9495 directiveArgs,
9496 hasDirectives = false,
9497 ch;
9498
9499 state.version = null;
9500 state.checkLineBreaks = state.legacy;
9501 state.tagMap = {};
9502 state.anchorMap = {};
9503
9504 while (0 !== (ch = state.input.charCodeAt(state.position))) {
9505 skipSeparationSpace(state, true, -1);
9506
9507 ch = state.input.charCodeAt(state.position);
9508
9509 if (state.lineIndent > 0 || 0x25/* % */ !== ch) {
9510 break;
9511 }
9512
9513 hasDirectives = true;
9514 ch = state.input.charCodeAt(++state.position);
9515 _position = state.position;
9516
9517 while (0 !== ch && !is_WS_OR_EOL(ch)) {
9518 ch = state.input.charCodeAt(++state.position);
9519 }
9520
9521 directiveName = state.input.slice(_position, state.position);
9522 directiveArgs = [];
9523
9524 if (directiveName.length < 1) {
9525 throwError(state, 'directive name must not be less than one character in length');
9526 }
9527
9528 while (0 !== ch) {
9529 while (is_WHITE_SPACE(ch)) {
9530 ch = state.input.charCodeAt(++state.position);
9531 }
9532
9533 if (0x23/* # */ === ch) {
9534 do { ch = state.input.charCodeAt(++state.position); }
9535 while (0 !== ch && !is_EOL(ch));
9536 break;
9537 }
9538
9539 if (is_EOL(ch)) {
9540 break;
9541 }
9542
9543 _position = state.position;
9544
9545 while (0 !== ch && !is_WS_OR_EOL(ch)) {
9546 ch = state.input.charCodeAt(++state.position);
9547 }
9548
9549 directiveArgs.push(state.input.slice(_position, state.position));
9550 }
9551
9552 if (0 !== ch) {
9553 readLineBreak(state);
9554 }
9555
9556 if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
9557 directiveHandlers[directiveName](state, directiveName, directiveArgs);
9558 } else {
9559 throwWarning(state, 'unknown document directive "' + directiveName + '"');
9560 }
9561 }
9562
9563 skipSeparationSpace(state, true, -1);
9564
9565 if (0 === state.lineIndent &&
9566 0x2D/* - */ === state.input.charCodeAt(state.position) &&
9567 0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&
9568 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {
9569 state.position += 3;
9570 skipSeparationSpace(state, true, -1);
9571
9572 } else if (hasDirectives) {
9573 throwError(state, 'directives end mark is expected');
9574 }
9575
9576 composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
9577 skipSeparationSpace(state, true, -1);
9578
9579 if (state.checkLineBreaks &&
9580 PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
9581 throwWarning(state, 'non-ASCII line breaks are interpreted as content');
9582 }
9583
9584 state.documents.push(state.result);
9585
9586 if (state.position === state.lineStart && testDocumentSeparator(state)) {
9587
9588 if (0x2E/* . */ === state.input.charCodeAt(state.position)) {
9589 state.position += 3;
9590 skipSeparationSpace(state, true, -1);
9591 }
9592 return;
9593 }
9594
9595 if (state.position < (state.length - 1)) {
9596 throwError(state, 'end of the stream or a document separator is expected');
9597 } else {
9598 return;
9599 }
9600}
9601
9602
9603function loadDocuments(input, options) {
9604 input = String(input);
9605 options = options || {};
9606
9607 if (input.length !== 0) {
9608
9609 // Add tailing `\n` if not exists
9610 if (0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
9611 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
9612 input += '\n';
9613 }
9614
9615 // Strip BOM
9616 if (input.charCodeAt(0) === 0xFEFF) {
9617 input = input.slice(1);
9618 }
9619 }
9620
9621 var state = new State(input, options);
9622
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07009623 // Use 0 as string terminator. That significantly simplifies bounds check.
9624 state.input += '\0';
9625
9626 while (0x20/* Space */ === state.input.charCodeAt(state.position)) {
9627 state.lineIndent += 1;
9628 state.position += 1;
9629 }
9630
9631 while (state.position < (state.length - 1)) {
9632 readDocument(state);
9633 }
9634
9635 return state.documents;
9636}
9637
9638
9639function loadAll(input, iterator, options) {
9640 var documents = loadDocuments(input, options), index, length;
9641
9642 for (index = 0, length = documents.length; index < length; index += 1) {
9643 iterator(documents[index]);
9644 }
9645}
9646
9647
9648function load(input, options) {
Jian Li83d87a72016-04-20 15:38:24 -07009649 var documents = loadDocuments(input, options);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -07009650
9651 if (0 === documents.length) {
9652 /*eslint-disable no-undefined*/
9653 return undefined;
9654 } else if (1 === documents.length) {
9655 return documents[0];
9656 }
9657 throw new YAMLException('expected a single document in the stream, but found more');
9658}
9659
9660
9661function safeLoadAll(input, output, options) {
9662 loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
9663}
9664
9665
9666function safeLoad(input, options) {
9667 return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
9668}
9669
9670
9671module.exports.loadAll = loadAll;
9672module.exports.load = load;
9673module.exports.safeLoadAll = safeLoadAll;
9674module.exports.safeLoad = safeLoad;
9675
9676},{"./common":22,"./exception":24,"./mark":26,"./schema/default_full":29,"./schema/default_safe":30}],26:[function(require,module,exports){
9677'use strict';
9678
9679
9680var common = require('./common');
9681
9682
9683function Mark(name, buffer, position, line, column) {
9684 this.name = name;
9685 this.buffer = buffer;
9686 this.position = position;
9687 this.line = line;
9688 this.column = column;
9689}
9690
9691
9692Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
9693 var head, start, tail, end, snippet;
9694
9695 if (!this.buffer) {
9696 return null;
9697 }
9698
9699 indent = indent || 4;
9700 maxLength = maxLength || 75;
9701
9702 head = '';
9703 start = this.position;
9704
9705 while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
9706 start -= 1;
9707 if (this.position - start > (maxLength / 2 - 1)) {
9708 head = ' ... ';
9709 start += 5;
9710 break;
9711 }
9712 }
9713
9714 tail = '';
9715 end = this.position;
9716
9717 while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
9718 end += 1;
9719 if (end - this.position > (maxLength / 2 - 1)) {
9720 tail = ' ... ';
9721 end -= 5;
9722 break;
9723 }
9724 }
9725
9726 snippet = this.buffer.slice(start, end);
9727
9728 return common.repeat(' ', indent) + head + snippet + tail + '\n' +
9729 common.repeat(' ', indent + this.position - start + head.length) + '^';
9730};
9731
9732
9733Mark.prototype.toString = function toString(compact) {
9734 var snippet, where = '';
9735
9736 if (this.name) {
9737 where += 'in "' + this.name + '" ';
9738 }
9739
9740 where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
9741
9742 if (!compact) {
9743 snippet = this.getSnippet();
9744
9745 if (snippet) {
9746 where += ':\n' + snippet;
9747 }
9748 }
9749
9750 return where;
9751};
9752
9753
9754module.exports = Mark;
9755
9756},{"./common":22}],27:[function(require,module,exports){
9757'use strict';
9758
9759/*eslint-disable max-len*/
9760
9761var common = require('./common');
9762var YAMLException = require('./exception');
9763var Type = require('./type');
9764
9765
9766function compileList(schema, name, result) {
9767 var exclude = [];
9768
9769 schema.include.forEach(function (includedSchema) {
9770 result = compileList(includedSchema, name, result);
9771 });
9772
9773 schema[name].forEach(function (currentType) {
9774 result.forEach(function (previousType, previousIndex) {
9775 if (previousType.tag === currentType.tag) {
9776 exclude.push(previousIndex);
9777 }
9778 });
9779
9780 result.push(currentType);
9781 });
9782
9783 return result.filter(function (type, index) {
9784 return -1 === exclude.indexOf(index);
9785 });
9786}
9787
9788
9789function compileMap(/* lists... */) {
9790 var result = {}, index, length;
9791
9792 function collectType(type) {
9793 result[type.tag] = type;
9794 }
9795
9796 for (index = 0, length = arguments.length; index < length; index += 1) {
9797 arguments[index].forEach(collectType);
9798 }
9799
9800 return result;
9801}
9802
9803
9804function Schema(definition) {
9805 this.include = definition.include || [];
9806 this.implicit = definition.implicit || [];
9807 this.explicit = definition.explicit || [];
9808
9809 this.implicit.forEach(function (type) {
9810 if (type.loadKind && 'scalar' !== type.loadKind) {
9811 throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
9812 }
9813 });
9814
9815 this.compiledImplicit = compileList(this, 'implicit', []);
9816 this.compiledExplicit = compileList(this, 'explicit', []);
9817 this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
9818}
9819
9820
9821Schema.DEFAULT = null;
9822
9823
9824Schema.create = function createSchema() {
9825 var schemas, types;
9826
9827 switch (arguments.length) {
9828 case 1:
9829 schemas = Schema.DEFAULT;
9830 types = arguments[0];
9831 break;
9832
9833 case 2:
9834 schemas = arguments[0];
9835 types = arguments[1];
9836 break;
9837
9838 default:
9839 throw new YAMLException('Wrong number of arguments for Schema.create function');
9840 }
9841
9842 schemas = common.toArray(schemas);
9843 types = common.toArray(types);
9844
9845 if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
9846 throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
9847 }
9848
9849 if (!types.every(function (type) { return type instanceof Type; })) {
9850 throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
9851 }
9852
9853 return new Schema({
9854 include: schemas,
9855 explicit: types
9856 });
9857};
9858
9859
9860module.exports = Schema;
9861
9862},{"./common":22,"./exception":24,"./type":33}],28:[function(require,module,exports){
9863// Standard YAML's Core schema.
9864// http://www.yaml.org/spec/1.2/spec.html#id2804923
9865//
9866// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
9867// So, Core schema has no distinctions from JSON schema is JS-YAML.
9868
9869
9870'use strict';
9871
9872
9873var Schema = require('../schema');
9874
9875
9876module.exports = new Schema({
9877 include: [
9878 require('./json')
9879 ]
9880});
9881
9882},{"../schema":27,"./json":32}],29:[function(require,module,exports){
9883// JS-YAML's default schema for `load` function.
9884// It is not described in the YAML specification.
9885//
9886// This schema is based on JS-YAML's default safe schema and includes
9887// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
9888//
9889// Also this schema is used as default base schema at `Schema.create` function.
9890
9891
9892'use strict';
9893
9894
9895var Schema = require('../schema');
9896
9897
9898module.exports = Schema.DEFAULT = new Schema({
9899 include: [
9900 require('./default_safe')
9901 ],
9902 explicit: [
9903 require('../type/js/undefined'),
9904 require('../type/js/regexp'),
9905 require('../type/js/function')
9906 ]
9907});
9908
9909},{"../schema":27,"../type/js/function":38,"../type/js/regexp":39,"../type/js/undefined":40,"./default_safe":30}],30:[function(require,module,exports){
9910// JS-YAML's default schema for `safeLoad` function.
9911// It is not described in the YAML specification.
9912//
9913// This schema is based on standard YAML's Core schema and includes most of
9914// extra types described at YAML tag repository. (http://yaml.org/type/)
9915
9916
9917'use strict';
9918
9919
9920var Schema = require('../schema');
9921
9922
9923module.exports = new Schema({
9924 include: [
9925 require('./core')
9926 ],
9927 implicit: [
9928 require('../type/timestamp'),
9929 require('../type/merge')
9930 ],
9931 explicit: [
9932 require('../type/binary'),
9933 require('../type/omap'),
9934 require('../type/pairs'),
9935 require('../type/set')
9936 ]
9937});
9938
9939},{"../schema":27,"../type/binary":34,"../type/merge":42,"../type/omap":44,"../type/pairs":45,"../type/set":47,"../type/timestamp":49,"./core":28}],31:[function(require,module,exports){
9940// Standard YAML's Failsafe schema.
9941// http://www.yaml.org/spec/1.2/spec.html#id2802346
9942
9943
9944'use strict';
9945
9946
9947var Schema = require('../schema');
9948
9949
9950module.exports = new Schema({
9951 explicit: [
9952 require('../type/str'),
9953 require('../type/seq'),
9954 require('../type/map')
9955 ]
9956});
9957
9958},{"../schema":27,"../type/map":41,"../type/seq":46,"../type/str":48}],32:[function(require,module,exports){
9959// Standard YAML's JSON schema.
9960// http://www.yaml.org/spec/1.2/spec.html#id2803231
9961//
9962// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
9963// So, this schema is not such strict as defined in the YAML specification.
9964// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
9965
9966
9967'use strict';
9968
9969
9970var Schema = require('../schema');
9971
9972
9973module.exports = new Schema({
9974 include: [
9975 require('./failsafe')
9976 ],
9977 implicit: [
9978 require('../type/null'),
9979 require('../type/bool'),
9980 require('../type/int'),
9981 require('../type/float')
9982 ]
9983});
9984
9985},{"../schema":27,"../type/bool":35,"../type/float":36,"../type/int":37,"../type/null":43,"./failsafe":31}],33:[function(require,module,exports){
9986'use strict';
9987
9988var YAMLException = require('./exception');
9989
9990var TYPE_CONSTRUCTOR_OPTIONS = [
9991 'kind',
9992 'resolve',
9993 'construct',
9994 'instanceOf',
9995 'predicate',
9996 'represent',
9997 'defaultStyle',
9998 'styleAliases'
9999];
10000
10001var YAML_NODE_KINDS = [
10002 'scalar',
10003 'sequence',
10004 'mapping'
10005];
10006
10007function compileStyleAliases(map) {
10008 var result = {};
10009
10010 if (null !== map) {
10011 Object.keys(map).forEach(function (style) {
10012 map[style].forEach(function (alias) {
10013 result[String(alias)] = style;
10014 });
10015 });
10016 }
10017
10018 return result;
10019}
10020
10021function Type(tag, options) {
10022 options = options || {};
10023
10024 Object.keys(options).forEach(function (name) {
10025 if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
10026 throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
10027 }
10028 });
10029
10030 // TODO: Add tag format check.
10031 this.tag = tag;
10032 this.kind = options['kind'] || null;
10033 this.resolve = options['resolve'] || function () { return true; };
10034 this.construct = options['construct'] || function (data) { return data; };
10035 this.instanceOf = options['instanceOf'] || null;
10036 this.predicate = options['predicate'] || null;
10037 this.represent = options['represent'] || null;
10038 this.defaultStyle = options['defaultStyle'] || null;
10039 this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
10040
10041 if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
10042 throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
10043 }
10044}
10045
10046module.exports = Type;
10047
10048},{"./exception":24}],34:[function(require,module,exports){
10049'use strict';
10050
10051/*eslint-disable no-bitwise*/
10052
10053// A trick for browserified version.
10054// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
10055var NodeBuffer = require('buffer').Buffer;
10056var Type = require('../type');
10057
10058
10059// [ 64, 65, 66 ] -> [ padding, CR, LF ]
10060var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
10061
10062
10063function resolveYamlBinary(data) {
10064 if (null === data) {
10065 return false;
10066 }
10067
Jian Li83d87a72016-04-20 15:38:24 -070010068 var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010069
10070 // Convert one by one.
10071 for (idx = 0; idx < max; idx++) {
10072 code = map.indexOf(data.charAt(idx));
10073
10074 // Skip CR/LF
10075 if (code > 64) { continue; }
10076
10077 // Fail on illegal characters
10078 if (code < 0) { return false; }
10079
10080 bitlen += 6;
10081 }
10082
10083 // If there are any bits left, source was corrupted
10084 return (bitlen % 8) === 0;
10085}
10086
10087function constructYamlBinary(data) {
Jian Li83d87a72016-04-20 15:38:24 -070010088 var idx, tailbits,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010089 input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
10090 max = input.length,
10091 map = BASE64_MAP,
10092 bits = 0,
10093 result = [];
10094
10095 // Collect by 6*4 bits (3 bytes)
10096
10097 for (idx = 0; idx < max; idx++) {
10098 if ((idx % 4 === 0) && idx) {
10099 result.push((bits >> 16) & 0xFF);
10100 result.push((bits >> 8) & 0xFF);
10101 result.push(bits & 0xFF);
10102 }
10103
10104 bits = (bits << 6) | map.indexOf(input.charAt(idx));
10105 }
10106
10107 // Dump tail
10108
10109 tailbits = (max % 4) * 6;
10110
10111 if (tailbits === 0) {
10112 result.push((bits >> 16) & 0xFF);
10113 result.push((bits >> 8) & 0xFF);
10114 result.push(bits & 0xFF);
10115 } else if (tailbits === 18) {
10116 result.push((bits >> 10) & 0xFF);
10117 result.push((bits >> 2) & 0xFF);
10118 } else if (tailbits === 12) {
10119 result.push((bits >> 4) & 0xFF);
10120 }
10121
10122 // Wrap into Buffer for NodeJS and leave Array for browser
10123 if (NodeBuffer) {
10124 return new NodeBuffer(result);
10125 }
10126
10127 return result;
10128}
10129
10130function representYamlBinary(object /*, style*/) {
10131 var result = '', bits = 0, idx, tail,
10132 max = object.length,
10133 map = BASE64_MAP;
10134
10135 // Convert every three bytes to 4 ASCII characters.
10136
10137 for (idx = 0; idx < max; idx++) {
10138 if ((idx % 3 === 0) && idx) {
10139 result += map[(bits >> 18) & 0x3F];
10140 result += map[(bits >> 12) & 0x3F];
10141 result += map[(bits >> 6) & 0x3F];
10142 result += map[bits & 0x3F];
10143 }
10144
10145 bits = (bits << 8) + object[idx];
10146 }
10147
10148 // Dump tail
10149
10150 tail = max % 3;
10151
10152 if (tail === 0) {
10153 result += map[(bits >> 18) & 0x3F];
10154 result += map[(bits >> 12) & 0x3F];
10155 result += map[(bits >> 6) & 0x3F];
10156 result += map[bits & 0x3F];
10157 } else if (tail === 2) {
10158 result += map[(bits >> 10) & 0x3F];
10159 result += map[(bits >> 4) & 0x3F];
10160 result += map[(bits << 2) & 0x3F];
10161 result += map[64];
10162 } else if (tail === 1) {
10163 result += map[(bits >> 2) & 0x3F];
10164 result += map[(bits << 4) & 0x3F];
10165 result += map[64];
10166 result += map[64];
10167 }
10168
10169 return result;
10170}
10171
10172function isBinary(object) {
10173 return NodeBuffer && NodeBuffer.isBuffer(object);
10174}
10175
10176module.exports = new Type('tag:yaml.org,2002:binary', {
10177 kind: 'scalar',
10178 resolve: resolveYamlBinary,
10179 construct: constructYamlBinary,
10180 predicate: isBinary,
10181 represent: representYamlBinary
10182});
10183
Jian Li83d87a72016-04-20 15:38:24 -070010184},{"../type":33,"buffer":12}],35:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010185'use strict';
10186
10187var Type = require('../type');
10188
10189function resolveYamlBoolean(data) {
10190 if (null === data) {
10191 return false;
10192 }
10193
10194 var max = data.length;
10195
10196 return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
10197 (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
10198}
10199
10200function constructYamlBoolean(data) {
10201 return data === 'true' ||
10202 data === 'True' ||
10203 data === 'TRUE';
10204}
10205
10206function isBoolean(object) {
10207 return '[object Boolean]' === Object.prototype.toString.call(object);
10208}
10209
10210module.exports = new Type('tag:yaml.org,2002:bool', {
10211 kind: 'scalar',
10212 resolve: resolveYamlBoolean,
10213 construct: constructYamlBoolean,
10214 predicate: isBoolean,
10215 represent: {
10216 lowercase: function (object) { return object ? 'true' : 'false'; },
10217 uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
10218 camelcase: function (object) { return object ? 'True' : 'False'; }
10219 },
10220 defaultStyle: 'lowercase'
10221});
10222
10223},{"../type":33}],36:[function(require,module,exports){
10224'use strict';
10225
10226var common = require('../common');
10227var Type = require('../type');
10228
10229var YAML_FLOAT_PATTERN = new RegExp(
10230 '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
10231 '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
10232 '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
10233 '|[-+]?\\.(?:inf|Inf|INF)' +
10234 '|\\.(?:nan|NaN|NAN))$');
10235
10236function resolveYamlFloat(data) {
10237 if (null === data) {
10238 return false;
10239 }
10240
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010241 if (!YAML_FLOAT_PATTERN.test(data)) {
10242 return false;
10243 }
10244 return true;
10245}
10246
10247function constructYamlFloat(data) {
10248 var value, sign, base, digits;
10249
10250 value = data.replace(/_/g, '').toLowerCase();
10251 sign = '-' === value[0] ? -1 : 1;
10252 digits = [];
10253
10254 if (0 <= '+-'.indexOf(value[0])) {
10255 value = value.slice(1);
10256 }
10257
10258 if ('.inf' === value) {
10259 return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
10260
10261 } else if ('.nan' === value) {
10262 return NaN;
10263
10264 } else if (0 <= value.indexOf(':')) {
10265 value.split(':').forEach(function (v) {
10266 digits.unshift(parseFloat(v, 10));
10267 });
10268
10269 value = 0.0;
10270 base = 1;
10271
10272 digits.forEach(function (d) {
10273 value += d * base;
10274 base *= 60;
10275 });
10276
10277 return sign * value;
10278
10279 }
10280 return sign * parseFloat(value, 10);
10281}
10282
Jian Li83d87a72016-04-20 15:38:24 -070010283
10284var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
10285
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010286function representYamlFloat(object, style) {
Jian Li83d87a72016-04-20 15:38:24 -070010287 var res;
10288
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010289 if (isNaN(object)) {
10290 switch (style) {
10291 case 'lowercase':
10292 return '.nan';
10293 case 'uppercase':
10294 return '.NAN';
10295 case 'camelcase':
10296 return '.NaN';
10297 }
10298 } else if (Number.POSITIVE_INFINITY === object) {
10299 switch (style) {
10300 case 'lowercase':
10301 return '.inf';
10302 case 'uppercase':
10303 return '.INF';
10304 case 'camelcase':
10305 return '.Inf';
10306 }
10307 } else if (Number.NEGATIVE_INFINITY === object) {
10308 switch (style) {
10309 case 'lowercase':
10310 return '-.inf';
10311 case 'uppercase':
10312 return '-.INF';
10313 case 'camelcase':
10314 return '-.Inf';
10315 }
10316 } else if (common.isNegativeZero(object)) {
10317 return '-0.0';
10318 }
Jian Li83d87a72016-04-20 15:38:24 -070010319
10320 res = object.toString(10);
10321
10322 // JS stringifier can build scientific format without dots: 5e-100,
10323 // while YAML requres dot: 5.e-100. Fix it with simple hack
10324
10325 return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010326}
10327
10328function isFloat(object) {
10329 return ('[object Number]' === Object.prototype.toString.call(object)) &&
10330 (0 !== object % 1 || common.isNegativeZero(object));
10331}
10332
10333module.exports = new Type('tag:yaml.org,2002:float', {
10334 kind: 'scalar',
10335 resolve: resolveYamlFloat,
10336 construct: constructYamlFloat,
10337 predicate: isFloat,
10338 represent: representYamlFloat,
10339 defaultStyle: 'lowercase'
10340});
10341
10342},{"../common":22,"../type":33}],37:[function(require,module,exports){
10343'use strict';
10344
10345var common = require('../common');
10346var Type = require('../type');
10347
10348function isHexCode(c) {
10349 return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
10350 ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
10351 ((0x61/* a */ <= c) && (c <= 0x66/* f */));
10352}
10353
10354function isOctCode(c) {
10355 return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
10356}
10357
10358function isDecCode(c) {
10359 return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
10360}
10361
10362function resolveYamlInteger(data) {
10363 if (null === data) {
10364 return false;
10365 }
10366
10367 var max = data.length,
10368 index = 0,
10369 hasDigits = false,
10370 ch;
10371
10372 if (!max) { return false; }
10373
10374 ch = data[index];
10375
10376 // sign
10377 if (ch === '-' || ch === '+') {
10378 ch = data[++index];
10379 }
10380
10381 if (ch === '0') {
10382 // 0
10383 if (index + 1 === max) { return true; }
10384 ch = data[++index];
10385
10386 // base 2, base 8, base 16
10387
10388 if (ch === 'b') {
10389 // base 2
10390 index++;
10391
10392 for (; index < max; index++) {
10393 ch = data[index];
10394 if (ch === '_') { continue; }
10395 if (ch !== '0' && ch !== '1') {
10396 return false;
10397 }
10398 hasDigits = true;
10399 }
10400 return hasDigits;
10401 }
10402
10403
10404 if (ch === 'x') {
10405 // base 16
10406 index++;
10407
10408 for (; index < max; index++) {
10409 ch = data[index];
10410 if (ch === '_') { continue; }
10411 if (!isHexCode(data.charCodeAt(index))) {
10412 return false;
10413 }
10414 hasDigits = true;
10415 }
10416 return hasDigits;
10417 }
10418
10419 // base 8
10420 for (; index < max; index++) {
10421 ch = data[index];
10422 if (ch === '_') { continue; }
10423 if (!isOctCode(data.charCodeAt(index))) {
10424 return false;
10425 }
10426 hasDigits = true;
10427 }
10428 return hasDigits;
10429 }
10430
10431 // base 10 (except 0) or base 60
10432
10433 for (; index < max; index++) {
10434 ch = data[index];
10435 if (ch === '_') { continue; }
10436 if (ch === ':') { break; }
10437 if (!isDecCode(data.charCodeAt(index))) {
10438 return false;
10439 }
10440 hasDigits = true;
10441 }
10442
10443 if (!hasDigits) { return false; }
10444
10445 // if !base60 - done;
10446 if (ch !== ':') { return true; }
10447
10448 // base60 almost not used, no needs to optimize
10449 return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
10450}
10451
10452function constructYamlInteger(data) {
10453 var value = data, sign = 1, ch, base, digits = [];
10454
10455 if (value.indexOf('_') !== -1) {
10456 value = value.replace(/_/g, '');
10457 }
10458
10459 ch = value[0];
10460
10461 if (ch === '-' || ch === '+') {
10462 if (ch === '-') { sign = -1; }
10463 value = value.slice(1);
10464 ch = value[0];
10465 }
10466
10467 if ('0' === value) {
10468 return 0;
10469 }
10470
10471 if (ch === '0') {
10472 if (value[1] === 'b') {
10473 return sign * parseInt(value.slice(2), 2);
10474 }
10475 if (value[1] === 'x') {
10476 return sign * parseInt(value, 16);
10477 }
10478 return sign * parseInt(value, 8);
10479
10480 }
10481
10482 if (value.indexOf(':') !== -1) {
10483 value.split(':').forEach(function (v) {
10484 digits.unshift(parseInt(v, 10));
10485 });
10486
10487 value = 0;
10488 base = 1;
10489
10490 digits.forEach(function (d) {
10491 value += (d * base);
10492 base *= 60;
10493 });
10494
10495 return sign * value;
10496
10497 }
10498
10499 return sign * parseInt(value, 10);
10500}
10501
10502function isInteger(object) {
10503 return ('[object Number]' === Object.prototype.toString.call(object)) &&
10504 (0 === object % 1 && !common.isNegativeZero(object));
10505}
10506
10507module.exports = new Type('tag:yaml.org,2002:int', {
10508 kind: 'scalar',
10509 resolve: resolveYamlInteger,
10510 construct: constructYamlInteger,
10511 predicate: isInteger,
10512 represent: {
10513 binary: function (object) { return '0b' + object.toString(2); },
10514 octal: function (object) { return '0' + object.toString(8); },
10515 decimal: function (object) { return object.toString(10); },
10516 hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
10517 },
10518 defaultStyle: 'decimal',
10519 styleAliases: {
10520 binary: [ 2, 'bin' ],
10521 octal: [ 8, 'oct' ],
10522 decimal: [ 10, 'dec' ],
10523 hexadecimal: [ 16, 'hex' ]
10524 }
10525});
10526
10527},{"../common":22,"../type":33}],38:[function(require,module,exports){
10528'use strict';
10529
10530var esprima;
10531
10532// Browserified version does not have esprima
10533//
10534// 1. For node.js just require module as deps
10535// 2. For browser try to require mudule via external AMD system.
10536// If not found - try to fallback to window.esprima. If not
10537// found too - then fail to parse.
10538//
10539try {
10540 esprima = require('esprima');
10541} catch (_) {
10542 /*global window */
10543 if (typeof window !== 'undefined') { esprima = window.esprima; }
10544}
10545
10546var Type = require('../../type');
10547
10548function resolveJavascriptFunction(data) {
10549 if (null === data) {
10550 return false;
10551 }
10552
10553 try {
10554 var source = '(' + data + ')',
Jian Li83d87a72016-04-20 15:38:24 -070010555 ast = esprima.parse(source, { range: true });
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010556
10557 if ('Program' !== ast.type ||
10558 1 !== ast.body.length ||
10559 'ExpressionStatement' !== ast.body[0].type ||
10560 'FunctionExpression' !== ast.body[0].expression.type) {
10561 return false;
10562 }
10563
10564 return true;
10565 } catch (err) {
10566 return false;
10567 }
10568}
10569
10570function constructJavascriptFunction(data) {
10571 /*jslint evil:true*/
10572
10573 var source = '(' + data + ')',
10574 ast = esprima.parse(source, { range: true }),
10575 params = [],
10576 body;
10577
10578 if ('Program' !== ast.type ||
10579 1 !== ast.body.length ||
10580 'ExpressionStatement' !== ast.body[0].type ||
10581 'FunctionExpression' !== ast.body[0].expression.type) {
10582 throw new Error('Failed to resolve function');
10583 }
10584
10585 ast.body[0].expression.params.forEach(function (param) {
10586 params.push(param.name);
10587 });
10588
10589 body = ast.body[0].expression.body.range;
10590
10591 // Esprima's ranges include the first '{' and the last '}' characters on
10592 // function expressions. So cut them out.
10593 /*eslint-disable no-new-func*/
10594 return new Function(params, source.slice(body[0] + 1, body[1] - 1));
10595}
10596
10597function representJavascriptFunction(object /*, style*/) {
10598 return object.toString();
10599}
10600
10601function isFunction(object) {
10602 return '[object Function]' === Object.prototype.toString.call(object);
10603}
10604
10605module.exports = new Type('tag:yaml.org,2002:js/function', {
10606 kind: 'scalar',
10607 resolve: resolveJavascriptFunction,
10608 construct: constructJavascriptFunction,
10609 predicate: isFunction,
10610 represent: representJavascriptFunction
10611});
10612
10613},{"../../type":33,"esprima":50}],39:[function(require,module,exports){
10614'use strict';
10615
10616var Type = require('../../type');
10617
10618function resolveJavascriptRegExp(data) {
10619 if (null === data) {
10620 return false;
10621 }
10622
10623 if (0 === data.length) {
10624 return false;
10625 }
10626
10627 var regexp = data,
10628 tail = /\/([gim]*)$/.exec(data),
10629 modifiers = '';
10630
10631 // if regexp starts with '/' it can have modifiers and must be properly closed
10632 // `/foo/gim` - modifiers tail can be maximum 3 chars
10633 if ('/' === regexp[0]) {
10634 if (tail) {
10635 modifiers = tail[1];
10636 }
10637
10638 if (modifiers.length > 3) { return false; }
10639 // if expression starts with /, is should be properly terminated
10640 if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
10641
10642 regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
10643 }
10644
10645 try {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010646 return true;
10647 } catch (error) {
10648 return false;
10649 }
10650}
10651
10652function constructJavascriptRegExp(data) {
10653 var regexp = data,
10654 tail = /\/([gim]*)$/.exec(data),
10655 modifiers = '';
10656
10657 // `/foo/gim` - tail can be maximum 4 chars
10658 if ('/' === regexp[0]) {
10659 if (tail) {
10660 modifiers = tail[1];
10661 }
10662 regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
10663 }
10664
10665 return new RegExp(regexp, modifiers);
10666}
10667
10668function representJavascriptRegExp(object /*, style*/) {
10669 var result = '/' + object.source + '/';
10670
10671 if (object.global) {
10672 result += 'g';
10673 }
10674
10675 if (object.multiline) {
10676 result += 'm';
10677 }
10678
10679 if (object.ignoreCase) {
10680 result += 'i';
10681 }
10682
10683 return result;
10684}
10685
10686function isRegExp(object) {
10687 return '[object RegExp]' === Object.prototype.toString.call(object);
10688}
10689
10690module.exports = new Type('tag:yaml.org,2002:js/regexp', {
10691 kind: 'scalar',
10692 resolve: resolveJavascriptRegExp,
10693 construct: constructJavascriptRegExp,
10694 predicate: isRegExp,
10695 represent: representJavascriptRegExp
10696});
10697
10698},{"../../type":33}],40:[function(require,module,exports){
10699'use strict';
10700
10701var Type = require('../../type');
10702
10703function resolveJavascriptUndefined() {
10704 return true;
10705}
10706
10707function constructJavascriptUndefined() {
10708 /*eslint-disable no-undefined*/
10709 return undefined;
10710}
10711
10712function representJavascriptUndefined() {
10713 return '';
10714}
10715
10716function isUndefined(object) {
10717 return 'undefined' === typeof object;
10718}
10719
10720module.exports = new Type('tag:yaml.org,2002:js/undefined', {
10721 kind: 'scalar',
10722 resolve: resolveJavascriptUndefined,
10723 construct: constructJavascriptUndefined,
10724 predicate: isUndefined,
10725 represent: representJavascriptUndefined
10726});
10727
10728},{"../../type":33}],41:[function(require,module,exports){
10729'use strict';
10730
10731var Type = require('../type');
10732
10733module.exports = new Type('tag:yaml.org,2002:map', {
10734 kind: 'mapping',
10735 construct: function (data) { return null !== data ? data : {}; }
10736});
10737
10738},{"../type":33}],42:[function(require,module,exports){
10739'use strict';
10740
10741var Type = require('../type');
10742
10743function resolveYamlMerge(data) {
10744 return '<<' === data || null === data;
10745}
10746
10747module.exports = new Type('tag:yaml.org,2002:merge', {
10748 kind: 'scalar',
10749 resolve: resolveYamlMerge
10750});
10751
10752},{"../type":33}],43:[function(require,module,exports){
10753'use strict';
10754
10755var Type = require('../type');
10756
10757function resolveYamlNull(data) {
10758 if (null === data) {
10759 return true;
10760 }
10761
10762 var max = data.length;
10763
10764 return (max === 1 && data === '~') ||
10765 (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
10766}
10767
10768function constructYamlNull() {
10769 return null;
10770}
10771
10772function isNull(object) {
10773 return null === object;
10774}
10775
10776module.exports = new Type('tag:yaml.org,2002:null', {
10777 kind: 'scalar',
10778 resolve: resolveYamlNull,
10779 construct: constructYamlNull,
10780 predicate: isNull,
10781 represent: {
10782 canonical: function () { return '~'; },
10783 lowercase: function () { return 'null'; },
10784 uppercase: function () { return 'NULL'; },
10785 camelcase: function () { return 'Null'; }
10786 },
10787 defaultStyle: 'lowercase'
10788});
10789
10790},{"../type":33}],44:[function(require,module,exports){
10791'use strict';
10792
10793var Type = require('../type');
10794
10795var _hasOwnProperty = Object.prototype.hasOwnProperty;
10796var _toString = Object.prototype.toString;
10797
10798function resolveYamlOmap(data) {
10799 if (null === data) {
10800 return true;
10801 }
10802
10803 var objectKeys = [], index, length, pair, pairKey, pairHasKey,
10804 object = data;
10805
10806 for (index = 0, length = object.length; index < length; index += 1) {
10807 pair = object[index];
10808 pairHasKey = false;
10809
10810 if ('[object Object]' !== _toString.call(pair)) {
10811 return false;
10812 }
10813
10814 for (pairKey in pair) {
10815 if (_hasOwnProperty.call(pair, pairKey)) {
10816 if (!pairHasKey) {
10817 pairHasKey = true;
10818 } else {
10819 return false;
10820 }
10821 }
10822 }
10823
10824 if (!pairHasKey) {
10825 return false;
10826 }
10827
10828 if (-1 === objectKeys.indexOf(pairKey)) {
10829 objectKeys.push(pairKey);
10830 } else {
10831 return false;
10832 }
10833 }
10834
10835 return true;
10836}
10837
10838function constructYamlOmap(data) {
10839 return null !== data ? data : [];
10840}
10841
10842module.exports = new Type('tag:yaml.org,2002:omap', {
10843 kind: 'sequence',
10844 resolve: resolveYamlOmap,
10845 construct: constructYamlOmap
10846});
10847
10848},{"../type":33}],45:[function(require,module,exports){
10849'use strict';
10850
10851var Type = require('../type');
10852
10853var _toString = Object.prototype.toString;
10854
10855function resolveYamlPairs(data) {
10856 if (null === data) {
10857 return true;
10858 }
10859
10860 var index, length, pair, keys, result,
10861 object = data;
10862
10863 result = new Array(object.length);
10864
10865 for (index = 0, length = object.length; index < length; index += 1) {
10866 pair = object[index];
10867
10868 if ('[object Object]' !== _toString.call(pair)) {
10869 return false;
10870 }
10871
10872 keys = Object.keys(pair);
10873
10874 if (1 !== keys.length) {
10875 return false;
10876 }
10877
10878 result[index] = [ keys[0], pair[keys[0]] ];
10879 }
10880
10881 return true;
10882}
10883
10884function constructYamlPairs(data) {
10885 if (null === data) {
10886 return [];
10887 }
10888
10889 var index, length, pair, keys, result,
10890 object = data;
10891
10892 result = new Array(object.length);
10893
10894 for (index = 0, length = object.length; index < length; index += 1) {
10895 pair = object[index];
10896
10897 keys = Object.keys(pair);
10898
10899 result[index] = [ keys[0], pair[keys[0]] ];
10900 }
10901
10902 return result;
10903}
10904
10905module.exports = new Type('tag:yaml.org,2002:pairs', {
10906 kind: 'sequence',
10907 resolve: resolveYamlPairs,
10908 construct: constructYamlPairs
10909});
10910
10911},{"../type":33}],46:[function(require,module,exports){
10912'use strict';
10913
10914var Type = require('../type');
10915
10916module.exports = new Type('tag:yaml.org,2002:seq', {
10917 kind: 'sequence',
10918 construct: function (data) { return null !== data ? data : []; }
10919});
10920
10921},{"../type":33}],47:[function(require,module,exports){
10922'use strict';
10923
10924var Type = require('../type');
10925
10926var _hasOwnProperty = Object.prototype.hasOwnProperty;
10927
10928function resolveYamlSet(data) {
10929 if (null === data) {
10930 return true;
10931 }
10932
10933 var key, object = data;
10934
10935 for (key in object) {
10936 if (_hasOwnProperty.call(object, key)) {
10937 if (null !== object[key]) {
10938 return false;
10939 }
10940 }
10941 }
10942
10943 return true;
10944}
10945
10946function constructYamlSet(data) {
10947 return null !== data ? data : {};
10948}
10949
10950module.exports = new Type('tag:yaml.org,2002:set', {
10951 kind: 'mapping',
10952 resolve: resolveYamlSet,
10953 construct: constructYamlSet
10954});
10955
10956},{"../type":33}],48:[function(require,module,exports){
10957'use strict';
10958
10959var Type = require('../type');
10960
10961module.exports = new Type('tag:yaml.org,2002:str', {
10962 kind: 'scalar',
10963 construct: function (data) { return null !== data ? data : ''; }
10964});
10965
10966},{"../type":33}],49:[function(require,module,exports){
10967'use strict';
10968
10969var Type = require('../type');
10970
10971var YAML_TIMESTAMP_REGEXP = new RegExp(
10972 '^([0-9][0-9][0-9][0-9])' + // [1] year
10973 '-([0-9][0-9]?)' + // [2] month
10974 '-([0-9][0-9]?)' + // [3] day
10975 '(?:(?:[Tt]|[ \\t]+)' + // ...
10976 '([0-9][0-9]?)' + // [4] hour
10977 ':([0-9][0-9])' + // [5] minute
10978 ':([0-9][0-9])' + // [6] second
10979 '(?:\\.([0-9]*))?' + // [7] fraction
10980 '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
10981 '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute
10982
10983function resolveYamlTimestamp(data) {
10984 if (null === data) {
10985 return false;
10986 }
10987
Jian Li83d87a72016-04-20 15:38:24 -070010988 if (YAML_TIMESTAMP_REGEXP.exec(data) === null) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070010989 return false;
10990 }
10991
10992 return true;
10993}
10994
10995function constructYamlTimestamp(data) {
10996 var match, year, month, day, hour, minute, second, fraction = 0,
10997 delta = null, tz_hour, tz_minute, date;
10998
10999 match = YAML_TIMESTAMP_REGEXP.exec(data);
11000
11001 if (null === match) {
11002 throw new Error('Date resolve error');
11003 }
11004
11005 // match: [1] year [2] month [3] day
11006
11007 year = +(match[1]);
11008 month = +(match[2]) - 1; // JS month starts with 0
11009 day = +(match[3]);
11010
11011 if (!match[4]) { // no hour
11012 return new Date(Date.UTC(year, month, day));
11013 }
11014
11015 // match: [4] hour [5] minute [6] second [7] fraction
11016
11017 hour = +(match[4]);
11018 minute = +(match[5]);
11019 second = +(match[6]);
11020
11021 if (match[7]) {
11022 fraction = match[7].slice(0, 3);
11023 while (fraction.length < 3) { // milli-seconds
11024 fraction += '0';
11025 }
11026 fraction = +fraction;
11027 }
11028
11029 // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
11030
11031 if (match[9]) {
11032 tz_hour = +(match[10]);
11033 tz_minute = +(match[11] || 0);
11034 delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
11035 if ('-' === match[9]) {
11036 delta = -delta;
11037 }
11038 }
11039
11040 date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
11041
11042 if (delta) {
11043 date.setTime(date.getTime() - delta);
11044 }
11045
11046 return date;
11047}
11048
11049function representYamlTimestamp(object /*, style*/) {
11050 return object.toISOString();
11051}
11052
11053module.exports = new Type('tag:yaml.org,2002:timestamp', {
11054 kind: 'scalar',
11055 resolve: resolveYamlTimestamp,
11056 construct: constructYamlTimestamp,
11057 instanceOf: Date,
11058 represent: representYamlTimestamp
11059});
11060
11061},{"../type":33}],50:[function(require,module,exports){
11062/*
Jian Li83d87a72016-04-20 15:38:24 -070011063 Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011064
11065 Redistribution and use in source and binary forms, with or without
11066 modification, are permitted provided that the following conditions are met:
11067
11068 * Redistributions of source code must retain the above copyright
11069 notice, this list of conditions and the following disclaimer.
11070 * Redistributions in binary form must reproduce the above copyright
11071 notice, this list of conditions and the following disclaimer in the
11072 documentation and/or other materials provided with the distribution.
11073
11074 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11075 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11076 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11077 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11078 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11079 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11080 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11081 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11082 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11083 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11084*/
11085
11086(function (root, factory) {
11087 'use strict';
11088
11089 // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
11090 // Rhino, and plain browser loading.
11091
11092 /* istanbul ignore next */
11093 if (typeof define === 'function' && define.amd) {
11094 define(['exports'], factory);
11095 } else if (typeof exports !== 'undefined') {
11096 factory(exports);
11097 } else {
11098 factory((root.esprima = {}));
11099 }
11100}(this, function (exports) {
11101 'use strict';
11102
11103 var Token,
11104 TokenName,
11105 FnExprTokens,
11106 Syntax,
11107 PlaceHolders,
11108 Messages,
11109 Regex,
11110 source,
11111 strict,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011112 index,
11113 lineNumber,
11114 lineStart,
11115 hasLineTerminator,
11116 lastIndex,
11117 lastLineNumber,
11118 lastLineStart,
11119 startIndex,
11120 startLineNumber,
11121 startLineStart,
11122 scanning,
11123 length,
11124 lookahead,
11125 state,
11126 extra,
11127 isBindingElement,
11128 isAssignmentTarget,
11129 firstCoverInitializedNameError;
11130
11131 Token = {
11132 BooleanLiteral: 1,
11133 EOF: 2,
11134 Identifier: 3,
11135 Keyword: 4,
11136 NullLiteral: 5,
11137 NumericLiteral: 6,
11138 Punctuator: 7,
11139 StringLiteral: 8,
11140 RegularExpression: 9,
11141 Template: 10
11142 };
11143
11144 TokenName = {};
11145 TokenName[Token.BooleanLiteral] = 'Boolean';
11146 TokenName[Token.EOF] = '<end>';
11147 TokenName[Token.Identifier] = 'Identifier';
11148 TokenName[Token.Keyword] = 'Keyword';
11149 TokenName[Token.NullLiteral] = 'Null';
11150 TokenName[Token.NumericLiteral] = 'Numeric';
11151 TokenName[Token.Punctuator] = 'Punctuator';
11152 TokenName[Token.StringLiteral] = 'String';
11153 TokenName[Token.RegularExpression] = 'RegularExpression';
11154 TokenName[Token.Template] = 'Template';
11155
11156 // A function following one of those tokens is an expression.
11157 FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
11158 'return', 'case', 'delete', 'throw', 'void',
11159 // assignment operators
11160 '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
11161 '&=', '|=', '^=', ',',
11162 // binary/unary operators
11163 '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
11164 '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
11165 '<=', '<', '>', '!=', '!=='];
11166
11167 Syntax = {
11168 AssignmentExpression: 'AssignmentExpression',
11169 AssignmentPattern: 'AssignmentPattern',
11170 ArrayExpression: 'ArrayExpression',
11171 ArrayPattern: 'ArrayPattern',
11172 ArrowFunctionExpression: 'ArrowFunctionExpression',
11173 BlockStatement: 'BlockStatement',
11174 BinaryExpression: 'BinaryExpression',
11175 BreakStatement: 'BreakStatement',
11176 CallExpression: 'CallExpression',
11177 CatchClause: 'CatchClause',
11178 ClassBody: 'ClassBody',
11179 ClassDeclaration: 'ClassDeclaration',
11180 ClassExpression: 'ClassExpression',
11181 ConditionalExpression: 'ConditionalExpression',
11182 ContinueStatement: 'ContinueStatement',
11183 DoWhileStatement: 'DoWhileStatement',
11184 DebuggerStatement: 'DebuggerStatement',
11185 EmptyStatement: 'EmptyStatement',
11186 ExportAllDeclaration: 'ExportAllDeclaration',
11187 ExportDefaultDeclaration: 'ExportDefaultDeclaration',
11188 ExportNamedDeclaration: 'ExportNamedDeclaration',
11189 ExportSpecifier: 'ExportSpecifier',
11190 ExpressionStatement: 'ExpressionStatement',
11191 ForStatement: 'ForStatement',
Jian Li83d87a72016-04-20 15:38:24 -070011192 ForOfStatement: 'ForOfStatement',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011193 ForInStatement: 'ForInStatement',
11194 FunctionDeclaration: 'FunctionDeclaration',
11195 FunctionExpression: 'FunctionExpression',
11196 Identifier: 'Identifier',
11197 IfStatement: 'IfStatement',
11198 ImportDeclaration: 'ImportDeclaration',
11199 ImportDefaultSpecifier: 'ImportDefaultSpecifier',
11200 ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
11201 ImportSpecifier: 'ImportSpecifier',
11202 Literal: 'Literal',
11203 LabeledStatement: 'LabeledStatement',
11204 LogicalExpression: 'LogicalExpression',
11205 MemberExpression: 'MemberExpression',
Jian Li83d87a72016-04-20 15:38:24 -070011206 MetaProperty: 'MetaProperty',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011207 MethodDefinition: 'MethodDefinition',
11208 NewExpression: 'NewExpression',
11209 ObjectExpression: 'ObjectExpression',
11210 ObjectPattern: 'ObjectPattern',
11211 Program: 'Program',
11212 Property: 'Property',
11213 RestElement: 'RestElement',
11214 ReturnStatement: 'ReturnStatement',
11215 SequenceExpression: 'SequenceExpression',
11216 SpreadElement: 'SpreadElement',
11217 Super: 'Super',
11218 SwitchCase: 'SwitchCase',
11219 SwitchStatement: 'SwitchStatement',
11220 TaggedTemplateExpression: 'TaggedTemplateExpression',
11221 TemplateElement: 'TemplateElement',
11222 TemplateLiteral: 'TemplateLiteral',
11223 ThisExpression: 'ThisExpression',
11224 ThrowStatement: 'ThrowStatement',
11225 TryStatement: 'TryStatement',
11226 UnaryExpression: 'UnaryExpression',
11227 UpdateExpression: 'UpdateExpression',
11228 VariableDeclaration: 'VariableDeclaration',
11229 VariableDeclarator: 'VariableDeclarator',
11230 WhileStatement: 'WhileStatement',
Jian Li83d87a72016-04-20 15:38:24 -070011231 WithStatement: 'WithStatement',
11232 YieldExpression: 'YieldExpression'
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011233 };
11234
11235 PlaceHolders = {
11236 ArrowParameterPlaceHolder: 'ArrowParameterPlaceHolder'
11237 };
11238
11239 // Error messages should be identical to V8.
11240 Messages = {
11241 UnexpectedToken: 'Unexpected token %0',
11242 UnexpectedNumber: 'Unexpected number',
11243 UnexpectedString: 'Unexpected string',
11244 UnexpectedIdentifier: 'Unexpected identifier',
11245 UnexpectedReserved: 'Unexpected reserved word',
11246 UnexpectedTemplate: 'Unexpected quasi %0',
11247 UnexpectedEOS: 'Unexpected end of input',
11248 NewlineAfterThrow: 'Illegal newline after throw',
11249 InvalidRegExp: 'Invalid regular expression',
11250 UnterminatedRegExp: 'Invalid regular expression: missing /',
11251 InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
11252 InvalidLHSInForIn: 'Invalid left-hand side in for-in',
Jian Li83d87a72016-04-20 15:38:24 -070011253 InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011254 MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
11255 NoCatchOrFinally: 'Missing catch or finally after try',
11256 UnknownLabel: 'Undefined label \'%0\'',
11257 Redeclaration: '%0 \'%1\' has already been declared',
11258 IllegalContinue: 'Illegal continue statement',
11259 IllegalBreak: 'Illegal break statement',
11260 IllegalReturn: 'Illegal return statement',
11261 StrictModeWith: 'Strict mode code may not include a with statement',
11262 StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
11263 StrictVarName: 'Variable name may not be eval or arguments in strict mode',
11264 StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
11265 StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
11266 StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
11267 StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
11268 StrictDelete: 'Delete of an unqualified identifier in strict mode.',
11269 StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
11270 StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
11271 StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
11272 StrictReservedWord: 'Use of future reserved word in strict mode',
11273 TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
11274 ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
11275 DefaultRestParameter: 'Unexpected token =',
11276 ObjectPatternAsRestParameter: 'Unexpected token {',
11277 DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
11278 ConstructorSpecialMethod: 'Class constructor may not be an accessor',
11279 DuplicateConstructor: 'A class may only have one constructor',
11280 StaticPrototype: 'Classes may not have static property named prototype',
11281 MissingFromClause: 'Unexpected token',
11282 NoAsAfterImportNamespace: 'Unexpected token',
11283 InvalidModuleSpecifier: 'Unexpected token',
11284 IllegalImportDeclaration: 'Unexpected token',
Jian Li83d87a72016-04-20 15:38:24 -070011285 IllegalExportDeclaration: 'Unexpected token',
11286 DuplicateBinding: 'Duplicate binding %0'
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011287 };
11288
Jian Li83d87a72016-04-20 15:38:24 -070011289 // See also tools/generate-unicode-regex.js.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011290 Regex = {
Jian Li83d87a72016-04-20 15:38:24 -070011291 // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
11292 NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
11293
11294 // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
11295 NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\u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FF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011296 };
11297
11298 // Ensure the condition is true, otherwise throw an error.
11299 // This is only to have a better contract semantic, i.e. another safety net
11300 // to catch a logic error. The condition shall be fulfilled in normal case.
11301 // Do NOT use this to enforce a certain condition on any user input.
11302
11303 function assert(condition, message) {
11304 /* istanbul ignore if */
11305 if (!condition) {
11306 throw new Error('ASSERT: ' + message);
11307 }
11308 }
11309
11310 function isDecimalDigit(ch) {
11311 return (ch >= 0x30 && ch <= 0x39); // 0..9
11312 }
11313
11314 function isHexDigit(ch) {
11315 return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
11316 }
11317
11318 function isOctalDigit(ch) {
11319 return '01234567'.indexOf(ch) >= 0;
11320 }
11321
11322 function octalToDecimal(ch) {
11323 // \0 is not octal escape sequence
11324 var octal = (ch !== '0'), code = '01234567'.indexOf(ch);
11325
11326 if (index < length && isOctalDigit(source[index])) {
11327 octal = true;
11328 code = code * 8 + '01234567'.indexOf(source[index++]);
11329
11330 // 3 digits are only allowed when string starts
11331 // with 0, 1, 2, 3
11332 if ('0123'.indexOf(ch) >= 0 &&
11333 index < length &&
11334 isOctalDigit(source[index])) {
11335 code = code * 8 + '01234567'.indexOf(source[index++]);
11336 }
11337 }
11338
11339 return {
11340 code: code,
11341 octal: octal
11342 };
11343 }
11344
Jian Li83d87a72016-04-20 15:38:24 -070011345 // ECMA-262 11.2 White Space
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011346
11347 function isWhiteSpace(ch) {
11348 return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||
11349 (ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);
11350 }
11351
Jian Li83d87a72016-04-20 15:38:24 -070011352 // ECMA-262 11.3 Line Terminators
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011353
11354 function isLineTerminator(ch) {
11355 return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);
11356 }
11357
Jian Li83d87a72016-04-20 15:38:24 -070011358 // ECMA-262 11.6 Identifier Names and Identifiers
11359
11360 function fromCodePoint(cp) {
11361 return (cp < 0x10000) ? String.fromCharCode(cp) :
11362 String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
11363 String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
11364 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011365
11366 function isIdentifierStart(ch) {
11367 return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)
11368 (ch >= 0x41 && ch <= 0x5A) || // A..Z
11369 (ch >= 0x61 && ch <= 0x7A) || // a..z
11370 (ch === 0x5C) || // \ (backslash)
Jian Li83d87a72016-04-20 15:38:24 -070011371 ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011372 }
11373
11374 function isIdentifierPart(ch) {
11375 return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)
11376 (ch >= 0x41 && ch <= 0x5A) || // A..Z
11377 (ch >= 0x61 && ch <= 0x7A) || // a..z
11378 (ch >= 0x30 && ch <= 0x39) || // 0..9
11379 (ch === 0x5C) || // \ (backslash)
Jian Li83d87a72016-04-20 15:38:24 -070011380 ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011381 }
11382
Jian Li83d87a72016-04-20 15:38:24 -070011383 // ECMA-262 11.6.2.2 Future Reserved Words
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011384
11385 function isFutureReservedWord(id) {
11386 switch (id) {
11387 case 'enum':
11388 case 'export':
11389 case 'import':
11390 case 'super':
11391 return true;
11392 default:
11393 return false;
11394 }
11395 }
11396
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011397 function isStrictModeReservedWord(id) {
11398 switch (id) {
11399 case 'implements':
11400 case 'interface':
11401 case 'package':
11402 case 'private':
11403 case 'protected':
11404 case 'public':
11405 case 'static':
11406 case 'yield':
11407 case 'let':
11408 return true;
11409 default:
11410 return false;
11411 }
11412 }
11413
11414 function isRestrictedWord(id) {
11415 return id === 'eval' || id === 'arguments';
11416 }
11417
Jian Li83d87a72016-04-20 15:38:24 -070011418 // ECMA-262 11.6.2.1 Keywords
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011419
11420 function isKeyword(id) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011421 switch (id.length) {
11422 case 2:
11423 return (id === 'if') || (id === 'in') || (id === 'do');
11424 case 3:
11425 return (id === 'var') || (id === 'for') || (id === 'new') ||
11426 (id === 'try') || (id === 'let');
11427 case 4:
11428 return (id === 'this') || (id === 'else') || (id === 'case') ||
11429 (id === 'void') || (id === 'with') || (id === 'enum');
11430 case 5:
11431 return (id === 'while') || (id === 'break') || (id === 'catch') ||
11432 (id === 'throw') || (id === 'const') || (id === 'yield') ||
11433 (id === 'class') || (id === 'super');
11434 case 6:
11435 return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
11436 (id === 'switch') || (id === 'export') || (id === 'import');
11437 case 7:
11438 return (id === 'default') || (id === 'finally') || (id === 'extends');
11439 case 8:
11440 return (id === 'function') || (id === 'continue') || (id === 'debugger');
11441 case 10:
11442 return (id === 'instanceof');
11443 default:
11444 return false;
11445 }
11446 }
11447
Jian Li83d87a72016-04-20 15:38:24 -070011448 // ECMA-262 11.4 Comments
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011449
11450 function addComment(type, value, start, end, loc) {
11451 var comment;
11452
11453 assert(typeof start === 'number', 'Comment must have valid position');
11454
11455 state.lastCommentStart = start;
11456
11457 comment = {
11458 type: type,
11459 value: value
11460 };
11461 if (extra.range) {
11462 comment.range = [start, end];
11463 }
11464 if (extra.loc) {
11465 comment.loc = loc;
11466 }
11467 extra.comments.push(comment);
11468 if (extra.attachComment) {
11469 extra.leadingComments.push(comment);
11470 extra.trailingComments.push(comment);
11471 }
Jian Li83d87a72016-04-20 15:38:24 -070011472 if (extra.tokenize) {
11473 comment.type = comment.type + 'Comment';
11474 if (extra.delegate) {
11475 comment = extra.delegate(comment);
11476 }
11477 extra.tokens.push(comment);
11478 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011479 }
11480
11481 function skipSingleLineComment(offset) {
11482 var start, loc, ch, comment;
11483
11484 start = index - offset;
11485 loc = {
11486 start: {
11487 line: lineNumber,
11488 column: index - lineStart - offset
11489 }
11490 };
11491
11492 while (index < length) {
11493 ch = source.charCodeAt(index);
11494 ++index;
11495 if (isLineTerminator(ch)) {
11496 hasLineTerminator = true;
11497 if (extra.comments) {
11498 comment = source.slice(start + offset, index - 1);
11499 loc.end = {
11500 line: lineNumber,
11501 column: index - lineStart - 1
11502 };
11503 addComment('Line', comment, start, index - 1, loc);
11504 }
11505 if (ch === 13 && source.charCodeAt(index) === 10) {
11506 ++index;
11507 }
11508 ++lineNumber;
11509 lineStart = index;
11510 return;
11511 }
11512 }
11513
11514 if (extra.comments) {
11515 comment = source.slice(start + offset, index);
11516 loc.end = {
11517 line: lineNumber,
11518 column: index - lineStart
11519 };
11520 addComment('Line', comment, start, index, loc);
11521 }
11522 }
11523
11524 function skipMultiLineComment() {
11525 var start, loc, ch, comment;
11526
11527 if (extra.comments) {
11528 start = index - 2;
11529 loc = {
11530 start: {
11531 line: lineNumber,
11532 column: index - lineStart - 2
11533 }
11534 };
11535 }
11536
11537 while (index < length) {
11538 ch = source.charCodeAt(index);
11539 if (isLineTerminator(ch)) {
11540 if (ch === 0x0D && source.charCodeAt(index + 1) === 0x0A) {
11541 ++index;
11542 }
11543 hasLineTerminator = true;
11544 ++lineNumber;
11545 ++index;
11546 lineStart = index;
11547 } else if (ch === 0x2A) {
11548 // Block comment ends with '*/'.
11549 if (source.charCodeAt(index + 1) === 0x2F) {
11550 ++index;
11551 ++index;
11552 if (extra.comments) {
11553 comment = source.slice(start + 2, index - 2);
11554 loc.end = {
11555 line: lineNumber,
11556 column: index - lineStart
11557 };
11558 addComment('Block', comment, start, index, loc);
11559 }
11560 return;
11561 }
11562 ++index;
11563 } else {
11564 ++index;
11565 }
11566 }
11567
11568 // Ran off the end of the file - the whole thing is a comment
11569 if (extra.comments) {
11570 loc.end = {
11571 line: lineNumber,
11572 column: index - lineStart
11573 };
11574 comment = source.slice(start + 2, index);
11575 addComment('Block', comment, start, index, loc);
11576 }
11577 tolerateUnexpectedToken();
11578 }
11579
11580 function skipComment() {
11581 var ch, start;
11582 hasLineTerminator = false;
11583
11584 start = (index === 0);
11585 while (index < length) {
11586 ch = source.charCodeAt(index);
11587
11588 if (isWhiteSpace(ch)) {
11589 ++index;
11590 } else if (isLineTerminator(ch)) {
11591 hasLineTerminator = true;
11592 ++index;
11593 if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {
11594 ++index;
11595 }
11596 ++lineNumber;
11597 lineStart = index;
11598 start = true;
11599 } else if (ch === 0x2F) { // U+002F is '/'
11600 ch = source.charCodeAt(index + 1);
11601 if (ch === 0x2F) {
11602 ++index;
11603 ++index;
11604 skipSingleLineComment(2);
11605 start = true;
11606 } else if (ch === 0x2A) { // U+002A is '*'
11607 ++index;
11608 ++index;
11609 skipMultiLineComment();
11610 } else {
11611 break;
11612 }
11613 } else if (start && ch === 0x2D) { // U+002D is '-'
11614 // U+003E is '>'
11615 if ((source.charCodeAt(index + 1) === 0x2D) && (source.charCodeAt(index + 2) === 0x3E)) {
11616 // '-->' is a single-line comment
11617 index += 3;
11618 skipSingleLineComment(3);
11619 } else {
11620 break;
11621 }
11622 } else if (ch === 0x3C) { // U+003C is '<'
11623 if (source.slice(index + 1, index + 4) === '!--') {
11624 ++index; // `<`
11625 ++index; // `!`
11626 ++index; // `-`
11627 ++index; // `-`
11628 skipSingleLineComment(4);
11629 } else {
11630 break;
11631 }
11632 } else {
11633 break;
11634 }
11635 }
11636 }
11637
11638 function scanHexEscape(prefix) {
11639 var i, len, ch, code = 0;
11640
11641 len = (prefix === 'u') ? 4 : 2;
11642 for (i = 0; i < len; ++i) {
11643 if (index < length && isHexDigit(source[index])) {
11644 ch = source[index++];
11645 code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
11646 } else {
11647 return '';
11648 }
11649 }
11650 return String.fromCharCode(code);
11651 }
11652
11653 function scanUnicodeCodePointEscape() {
Jian Li83d87a72016-04-20 15:38:24 -070011654 var ch, code;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011655
11656 ch = source[index];
11657 code = 0;
11658
11659 // At least, one hex digit is required.
11660 if (ch === '}') {
11661 throwUnexpectedToken();
11662 }
11663
11664 while (index < length) {
11665 ch = source[index++];
11666 if (!isHexDigit(ch)) {
11667 break;
11668 }
11669 code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
11670 }
11671
11672 if (code > 0x10FFFF || ch !== '}') {
11673 throwUnexpectedToken();
11674 }
11675
Jian Li83d87a72016-04-20 15:38:24 -070011676 return fromCodePoint(code);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011677 }
11678
Jian Li83d87a72016-04-20 15:38:24 -070011679 function codePointAt(i) {
11680 var cp, first, second;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011681
Jian Li83d87a72016-04-20 15:38:24 -070011682 cp = source.charCodeAt(i);
11683 if (cp >= 0xD800 && cp <= 0xDBFF) {
11684 second = source.charCodeAt(i + 1);
11685 if (second >= 0xDC00 && second <= 0xDFFF) {
11686 first = cp;
11687 cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
11688 }
11689 }
11690
11691 return cp;
11692 }
11693
11694 function getComplexIdentifier() {
11695 var cp, ch, id;
11696
11697 cp = codePointAt(index);
11698 id = fromCodePoint(cp);
11699 index += id.length;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011700
11701 // '\u' (U+005C, U+0075) denotes an escaped character.
Jian Li83d87a72016-04-20 15:38:24 -070011702 if (cp === 0x5C) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011703 if (source.charCodeAt(index) !== 0x75) {
11704 throwUnexpectedToken();
11705 }
11706 ++index;
Jian Li83d87a72016-04-20 15:38:24 -070011707 if (source[index] === '{') {
11708 ++index;
11709 ch = scanUnicodeCodePointEscape();
11710 } else {
11711 ch = scanHexEscape('u');
11712 cp = ch.charCodeAt(0);
11713 if (!ch || ch === '\\' || !isIdentifierStart(cp)) {
11714 throwUnexpectedToken();
11715 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011716 }
11717 id = ch;
11718 }
11719
11720 while (index < length) {
Jian Li83d87a72016-04-20 15:38:24 -070011721 cp = codePointAt(index);
11722 if (!isIdentifierPart(cp)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011723 break;
11724 }
Jian Li83d87a72016-04-20 15:38:24 -070011725 ch = fromCodePoint(cp);
11726 id += ch;
11727 index += ch.length;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011728
11729 // '\u' (U+005C, U+0075) denotes an escaped character.
Jian Li83d87a72016-04-20 15:38:24 -070011730 if (cp === 0x5C) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011731 id = id.substr(0, id.length - 1);
11732 if (source.charCodeAt(index) !== 0x75) {
11733 throwUnexpectedToken();
11734 }
11735 ++index;
Jian Li83d87a72016-04-20 15:38:24 -070011736 if (source[index] === '{') {
11737 ++index;
11738 ch = scanUnicodeCodePointEscape();
11739 } else {
11740 ch = scanHexEscape('u');
11741 cp = ch.charCodeAt(0);
11742 if (!ch || ch === '\\' || !isIdentifierPart(cp)) {
11743 throwUnexpectedToken();
11744 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011745 }
11746 id += ch;
11747 }
11748 }
11749
11750 return id;
11751 }
11752
11753 function getIdentifier() {
11754 var start, ch;
11755
11756 start = index++;
11757 while (index < length) {
11758 ch = source.charCodeAt(index);
11759 if (ch === 0x5C) {
11760 // Blackslash (U+005C) marks Unicode escape sequence.
11761 index = start;
Jian Li83d87a72016-04-20 15:38:24 -070011762 return getComplexIdentifier();
11763 } else if (ch >= 0xD800 && ch < 0xDFFF) {
11764 // Need to handle surrogate pairs.
11765 index = start;
11766 return getComplexIdentifier();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011767 }
11768 if (isIdentifierPart(ch)) {
11769 ++index;
11770 } else {
11771 break;
11772 }
11773 }
11774
11775 return source.slice(start, index);
11776 }
11777
11778 function scanIdentifier() {
11779 var start, id, type;
11780
11781 start = index;
11782
11783 // Backslash (U+005C) starts an escaped character.
Jian Li83d87a72016-04-20 15:38:24 -070011784 id = (source.charCodeAt(index) === 0x5C) ? getComplexIdentifier() : getIdentifier();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011785
11786 // There is no keyword or literal with only one character.
11787 // Thus, it must be an identifier.
11788 if (id.length === 1) {
11789 type = Token.Identifier;
11790 } else if (isKeyword(id)) {
11791 type = Token.Keyword;
11792 } else if (id === 'null') {
11793 type = Token.NullLiteral;
11794 } else if (id === 'true' || id === 'false') {
11795 type = Token.BooleanLiteral;
11796 } else {
11797 type = Token.Identifier;
11798 }
11799
11800 return {
11801 type: type,
11802 value: id,
11803 lineNumber: lineNumber,
11804 lineStart: lineStart,
11805 start: start,
11806 end: index
11807 };
11808 }
11809
11810
Jian Li83d87a72016-04-20 15:38:24 -070011811 // ECMA-262 11.7 Punctuators
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011812
11813 function scanPunctuator() {
11814 var token, str;
11815
11816 token = {
11817 type: Token.Punctuator,
11818 value: '',
11819 lineNumber: lineNumber,
11820 lineStart: lineStart,
11821 start: index,
11822 end: index
11823 };
11824
11825 // Check for most common single-character punctuators.
11826 str = source[index];
11827 switch (str) {
11828
11829 case '(':
11830 if (extra.tokenize) {
Jian Li83d87a72016-04-20 15:38:24 -070011831 extra.openParenToken = extra.tokenValues.length;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011832 }
11833 ++index;
11834 break;
11835
11836 case '{':
11837 if (extra.tokenize) {
Jian Li83d87a72016-04-20 15:38:24 -070011838 extra.openCurlyToken = extra.tokenValues.length;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011839 }
11840 state.curlyStack.push('{');
11841 ++index;
11842 break;
11843
11844 case '.':
11845 ++index;
11846 if (source[index] === '.' && source[index + 1] === '.') {
11847 // Spread operator: ...
11848 index += 2;
11849 str = '...';
11850 }
11851 break;
11852
11853 case '}':
11854 ++index;
11855 state.curlyStack.pop();
11856 break;
11857 case ')':
11858 case ';':
11859 case ',':
11860 case '[':
11861 case ']':
11862 case ':':
11863 case '?':
11864 case '~':
11865 ++index;
11866 break;
11867
11868 default:
11869 // 4-character punctuator.
11870 str = source.substr(index, 4);
11871 if (str === '>>>=') {
11872 index += 4;
11873 } else {
11874
11875 // 3-character punctuators.
11876 str = str.substr(0, 3);
11877 if (str === '===' || str === '!==' || str === '>>>' ||
11878 str === '<<=' || str === '>>=') {
11879 index += 3;
11880 } else {
11881
11882 // 2-character punctuators.
11883 str = str.substr(0, 2);
11884 if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
11885 str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
11886 str === '++' || str === '--' || str === '<<' || str === '>>' ||
11887 str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
11888 str === '<=' || str === '>=' || str === '=>') {
11889 index += 2;
11890 } else {
11891
11892 // 1-character punctuators.
11893 str = source[index];
11894 if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
11895 ++index;
11896 }
11897 }
11898 }
11899 }
11900 }
11901
11902 if (index === token.start) {
11903 throwUnexpectedToken();
11904 }
11905
11906 token.end = index;
11907 token.value = str;
11908 return token;
11909 }
11910
Jian Li83d87a72016-04-20 15:38:24 -070011911 // ECMA-262 11.8.3 Numeric Literals
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070011912
11913 function scanHexLiteral(start) {
11914 var number = '';
11915
11916 while (index < length) {
11917 if (!isHexDigit(source[index])) {
11918 break;
11919 }
11920 number += source[index++];
11921 }
11922
11923 if (number.length === 0) {
11924 throwUnexpectedToken();
11925 }
11926
11927 if (isIdentifierStart(source.charCodeAt(index))) {
11928 throwUnexpectedToken();
11929 }
11930
11931 return {
11932 type: Token.NumericLiteral,
11933 value: parseInt('0x' + number, 16),
11934 lineNumber: lineNumber,
11935 lineStart: lineStart,
11936 start: start,
11937 end: index
11938 };
11939 }
11940
11941 function scanBinaryLiteral(start) {
11942 var ch, number;
11943
11944 number = '';
11945
11946 while (index < length) {
11947 ch = source[index];
11948 if (ch !== '0' && ch !== '1') {
11949 break;
11950 }
11951 number += source[index++];
11952 }
11953
11954 if (number.length === 0) {
11955 // only 0b or 0B
11956 throwUnexpectedToken();
11957 }
11958
11959 if (index < length) {
11960 ch = source.charCodeAt(index);
11961 /* istanbul ignore else */
11962 if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
11963 throwUnexpectedToken();
11964 }
11965 }
11966
11967 return {
11968 type: Token.NumericLiteral,
11969 value: parseInt(number, 2),
11970 lineNumber: lineNumber,
11971 lineStart: lineStart,
11972 start: start,
11973 end: index
11974 };
11975 }
11976
11977 function scanOctalLiteral(prefix, start) {
11978 var number, octal;
11979
11980 if (isOctalDigit(prefix)) {
11981 octal = true;
11982 number = '0' + source[index++];
11983 } else {
11984 octal = false;
11985 ++index;
11986 number = '';
11987 }
11988
11989 while (index < length) {
11990 if (!isOctalDigit(source[index])) {
11991 break;
11992 }
11993 number += source[index++];
11994 }
11995
11996 if (!octal && number.length === 0) {
11997 // only 0o or 0O
11998 throwUnexpectedToken();
11999 }
12000
12001 if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
12002 throwUnexpectedToken();
12003 }
12004
12005 return {
12006 type: Token.NumericLiteral,
12007 value: parseInt(number, 8),
12008 octal: octal,
12009 lineNumber: lineNumber,
12010 lineStart: lineStart,
12011 start: start,
12012 end: index
12013 };
12014 }
12015
12016 function isImplicitOctalLiteral() {
12017 var i, ch;
12018
12019 // Implicit octal, unless there is a non-octal digit.
12020 // (Annex B.1.1 on Numeric Literals)
12021 for (i = index + 1; i < length; ++i) {
12022 ch = source[i];
12023 if (ch === '8' || ch === '9') {
12024 return false;
12025 }
12026 if (!isOctalDigit(ch)) {
12027 return true;
12028 }
12029 }
12030
12031 return true;
12032 }
12033
12034 function scanNumericLiteral() {
12035 var number, start, ch;
12036
12037 ch = source[index];
12038 assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
12039 'Numeric literal must start with a decimal digit or a decimal point');
12040
12041 start = index;
12042 number = '';
12043 if (ch !== '.') {
12044 number = source[index++];
12045 ch = source[index];
12046
12047 // Hex number starts with '0x'.
12048 // Octal number starts with '0'.
12049 // Octal number in ES6 starts with '0o'.
12050 // Binary number in ES6 starts with '0b'.
12051 if (number === '0') {
12052 if (ch === 'x' || ch === 'X') {
12053 ++index;
12054 return scanHexLiteral(start);
12055 }
12056 if (ch === 'b' || ch === 'B') {
12057 ++index;
12058 return scanBinaryLiteral(start);
12059 }
12060 if (ch === 'o' || ch === 'O') {
12061 return scanOctalLiteral(ch, start);
12062 }
12063
12064 if (isOctalDigit(ch)) {
12065 if (isImplicitOctalLiteral()) {
12066 return scanOctalLiteral(ch, start);
12067 }
12068 }
12069 }
12070
12071 while (isDecimalDigit(source.charCodeAt(index))) {
12072 number += source[index++];
12073 }
12074 ch = source[index];
12075 }
12076
12077 if (ch === '.') {
12078 number += source[index++];
12079 while (isDecimalDigit(source.charCodeAt(index))) {
12080 number += source[index++];
12081 }
12082 ch = source[index];
12083 }
12084
12085 if (ch === 'e' || ch === 'E') {
12086 number += source[index++];
12087
12088 ch = source[index];
12089 if (ch === '+' || ch === '-') {
12090 number += source[index++];
12091 }
12092 if (isDecimalDigit(source.charCodeAt(index))) {
12093 while (isDecimalDigit(source.charCodeAt(index))) {
12094 number += source[index++];
12095 }
12096 } else {
12097 throwUnexpectedToken();
12098 }
12099 }
12100
12101 if (isIdentifierStart(source.charCodeAt(index))) {
12102 throwUnexpectedToken();
12103 }
12104
12105 return {
12106 type: Token.NumericLiteral,
12107 value: parseFloat(number),
12108 lineNumber: lineNumber,
12109 lineStart: lineStart,
12110 start: start,
12111 end: index
12112 };
12113 }
12114
Jian Li83d87a72016-04-20 15:38:24 -070012115 // ECMA-262 11.8.4 String Literals
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012116
12117 function scanStringLiteral() {
12118 var str = '', quote, start, ch, unescaped, octToDec, octal = false;
12119
12120 quote = source[index];
12121 assert((quote === '\'' || quote === '"'),
12122 'String literal must starts with a quote');
12123
12124 start = index;
12125 ++index;
12126
12127 while (index < length) {
12128 ch = source[index++];
12129
12130 if (ch === quote) {
12131 quote = '';
12132 break;
12133 } else if (ch === '\\') {
12134 ch = source[index++];
12135 if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
12136 switch (ch) {
12137 case 'u':
12138 case 'x':
12139 if (source[index] === '{') {
12140 ++index;
12141 str += scanUnicodeCodePointEscape();
12142 } else {
12143 unescaped = scanHexEscape(ch);
12144 if (!unescaped) {
12145 throw throwUnexpectedToken();
12146 }
12147 str += unescaped;
12148 }
12149 break;
12150 case 'n':
12151 str += '\n';
12152 break;
12153 case 'r':
12154 str += '\r';
12155 break;
12156 case 't':
12157 str += '\t';
12158 break;
12159 case 'b':
12160 str += '\b';
12161 break;
12162 case 'f':
12163 str += '\f';
12164 break;
12165 case 'v':
12166 str += '\x0B';
12167 break;
12168 case '8':
12169 case '9':
Jian Li83d87a72016-04-20 15:38:24 -070012170 str += ch;
12171 tolerateUnexpectedToken();
12172 break;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012173
12174 default:
12175 if (isOctalDigit(ch)) {
12176 octToDec = octalToDecimal(ch);
12177
12178 octal = octToDec.octal || octal;
12179 str += String.fromCharCode(octToDec.code);
12180 } else {
12181 str += ch;
12182 }
12183 break;
12184 }
12185 } else {
12186 ++lineNumber;
12187 if (ch === '\r' && source[index] === '\n') {
12188 ++index;
12189 }
12190 lineStart = index;
12191 }
12192 } else if (isLineTerminator(ch.charCodeAt(0))) {
12193 break;
12194 } else {
12195 str += ch;
12196 }
12197 }
12198
12199 if (quote !== '') {
12200 throwUnexpectedToken();
12201 }
12202
12203 return {
12204 type: Token.StringLiteral,
12205 value: str,
12206 octal: octal,
12207 lineNumber: startLineNumber,
12208 lineStart: startLineStart,
12209 start: start,
12210 end: index
12211 };
12212 }
12213
Jian Li83d87a72016-04-20 15:38:24 -070012214 // ECMA-262 11.8.6 Template Literal Lexical Components
12215
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012216 function scanTemplate() {
12217 var cooked = '', ch, start, rawOffset, terminated, head, tail, restore, unescaped;
12218
12219 terminated = false;
12220 tail = false;
12221 start = index;
12222 head = (source[index] === '`');
12223 rawOffset = 2;
12224
12225 ++index;
12226
12227 while (index < length) {
12228 ch = source[index++];
12229 if (ch === '`') {
12230 rawOffset = 1;
12231 tail = true;
12232 terminated = true;
12233 break;
12234 } else if (ch === '$') {
12235 if (source[index] === '{') {
12236 state.curlyStack.push('${');
12237 ++index;
12238 terminated = true;
12239 break;
12240 }
12241 cooked += ch;
12242 } else if (ch === '\\') {
12243 ch = source[index++];
12244 if (!isLineTerminator(ch.charCodeAt(0))) {
12245 switch (ch) {
12246 case 'n':
12247 cooked += '\n';
12248 break;
12249 case 'r':
12250 cooked += '\r';
12251 break;
12252 case 't':
12253 cooked += '\t';
12254 break;
12255 case 'u':
12256 case 'x':
12257 if (source[index] === '{') {
12258 ++index;
12259 cooked += scanUnicodeCodePointEscape();
12260 } else {
12261 restore = index;
12262 unescaped = scanHexEscape(ch);
12263 if (unescaped) {
12264 cooked += unescaped;
12265 } else {
12266 index = restore;
12267 cooked += ch;
12268 }
12269 }
12270 break;
12271 case 'b':
12272 cooked += '\b';
12273 break;
12274 case 'f':
12275 cooked += '\f';
12276 break;
12277 case 'v':
12278 cooked += '\v';
12279 break;
12280
12281 default:
12282 if (ch === '0') {
12283 if (isDecimalDigit(source.charCodeAt(index))) {
12284 // Illegal: \01 \02 and so on
12285 throwError(Messages.TemplateOctalLiteral);
12286 }
12287 cooked += '\0';
12288 } else if (isOctalDigit(ch)) {
12289 // Illegal: \1 \2
12290 throwError(Messages.TemplateOctalLiteral);
12291 } else {
12292 cooked += ch;
12293 }
12294 break;
12295 }
12296 } else {
12297 ++lineNumber;
12298 if (ch === '\r' && source[index] === '\n') {
12299 ++index;
12300 }
12301 lineStart = index;
12302 }
12303 } else if (isLineTerminator(ch.charCodeAt(0))) {
12304 ++lineNumber;
12305 if (ch === '\r' && source[index] === '\n') {
12306 ++index;
12307 }
12308 lineStart = index;
12309 cooked += '\n';
12310 } else {
12311 cooked += ch;
12312 }
12313 }
12314
12315 if (!terminated) {
12316 throwUnexpectedToken();
12317 }
12318
12319 if (!head) {
12320 state.curlyStack.pop();
12321 }
12322
12323 return {
12324 type: Token.Template,
12325 value: {
12326 cooked: cooked,
12327 raw: source.slice(start + 1, index - rawOffset)
12328 },
12329 head: head,
12330 tail: tail,
12331 lineNumber: lineNumber,
12332 lineStart: lineStart,
12333 start: start,
12334 end: index
12335 };
12336 }
12337
Jian Li83d87a72016-04-20 15:38:24 -070012338 // ECMA-262 11.8.5 Regular Expression Literals
12339
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012340 function testRegExp(pattern, flags) {
Jian Li83d87a72016-04-20 15:38:24 -070012341 // The BMP character to use as a replacement for astral symbols when
12342 // translating an ES6 "u"-flagged pattern to an ES5-compatible
12343 // approximation.
12344 // Note: replacing with '\uFFFF' enables false positives in unlikely
12345 // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
12346 // pattern that would not be detected by this substitution.
12347 var astralSubstitute = '\uFFFF',
12348 tmp = pattern;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012349
12350 if (flags.indexOf('u') >= 0) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012351 tmp = tmp
Jian Li83d87a72016-04-20 15:38:24 -070012352 // Replace every Unicode escape sequence with the equivalent
12353 // BMP character or a constant ASCII code point in the case of
12354 // astral symbols. (See the above note on `astralSubstitute`
12355 // for more information.)
12356 .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
12357 var codePoint = parseInt($1 || $2, 16);
12358 if (codePoint > 0x10FFFF) {
12359 throwUnexpectedToken(null, Messages.InvalidRegExp);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012360 }
Jian Li83d87a72016-04-20 15:38:24 -070012361 if (codePoint <= 0xFFFF) {
12362 return String.fromCharCode(codePoint);
12363 }
12364 return astralSubstitute;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012365 })
Jian Li83d87a72016-04-20 15:38:24 -070012366 // Replace each paired surrogate with a single ASCII symbol to
12367 // avoid throwing on regular expressions that are only valid in
12368 // combination with the "u" flag.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012369 .replace(
Jian Li83d87a72016-04-20 15:38:24 -070012370 /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
12371 astralSubstitute
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012372 );
12373 }
12374
12375 // First, detect invalid regular expressions.
12376 try {
12377 RegExp(tmp);
12378 } catch (e) {
12379 throwUnexpectedToken(null, Messages.InvalidRegExp);
12380 }
12381
12382 // Return a regular expression object for this pattern-flag pair, or
12383 // `null` in case the current environment doesn't support the flags it
12384 // uses.
12385 try {
12386 return new RegExp(pattern, flags);
12387 } catch (exception) {
12388 return null;
12389 }
12390 }
12391
12392 function scanRegExpBody() {
12393 var ch, str, classMarker, terminated, body;
12394
12395 ch = source[index];
12396 assert(ch === '/', 'Regular expression literal must start with a slash');
12397 str = source[index++];
12398
12399 classMarker = false;
12400 terminated = false;
12401 while (index < length) {
12402 ch = source[index++];
12403 str += ch;
12404 if (ch === '\\') {
12405 ch = source[index++];
12406 // ECMA-262 7.8.5
12407 if (isLineTerminator(ch.charCodeAt(0))) {
12408 throwUnexpectedToken(null, Messages.UnterminatedRegExp);
12409 }
12410 str += ch;
12411 } else if (isLineTerminator(ch.charCodeAt(0))) {
12412 throwUnexpectedToken(null, Messages.UnterminatedRegExp);
12413 } else if (classMarker) {
12414 if (ch === ']') {
12415 classMarker = false;
12416 }
12417 } else {
12418 if (ch === '/') {
12419 terminated = true;
12420 break;
12421 } else if (ch === '[') {
12422 classMarker = true;
12423 }
12424 }
12425 }
12426
12427 if (!terminated) {
12428 throwUnexpectedToken(null, Messages.UnterminatedRegExp);
12429 }
12430
12431 // Exclude leading and trailing slash.
12432 body = str.substr(1, str.length - 2);
12433 return {
12434 value: body,
12435 literal: str
12436 };
12437 }
12438
12439 function scanRegExpFlags() {
12440 var ch, str, flags, restore;
12441
12442 str = '';
12443 flags = '';
12444 while (index < length) {
12445 ch = source[index];
12446 if (!isIdentifierPart(ch.charCodeAt(0))) {
12447 break;
12448 }
12449
12450 ++index;
12451 if (ch === '\\' && index < length) {
12452 ch = source[index];
12453 if (ch === 'u') {
12454 ++index;
12455 restore = index;
12456 ch = scanHexEscape('u');
12457 if (ch) {
12458 flags += ch;
12459 for (str += '\\u'; restore < index; ++restore) {
12460 str += source[restore];
12461 }
12462 } else {
12463 index = restore;
12464 flags += 'u';
12465 str += '\\u';
12466 }
12467 tolerateUnexpectedToken();
12468 } else {
12469 str += '\\';
12470 tolerateUnexpectedToken();
12471 }
12472 } else {
12473 flags += ch;
12474 str += ch;
12475 }
12476 }
12477
12478 return {
12479 value: flags,
12480 literal: str
12481 };
12482 }
12483
12484 function scanRegExp() {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012485 var start, body, flags, value;
Jian Li83d87a72016-04-20 15:38:24 -070012486 scanning = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012487
12488 lookahead = null;
12489 skipComment();
12490 start = index;
12491
12492 body = scanRegExpBody();
12493 flags = scanRegExpFlags();
12494 value = testRegExp(body.value, flags.value);
12495 scanning = false;
12496 if (extra.tokenize) {
12497 return {
12498 type: Token.RegularExpression,
12499 value: value,
12500 regex: {
12501 pattern: body.value,
12502 flags: flags.value
12503 },
12504 lineNumber: lineNumber,
12505 lineStart: lineStart,
12506 start: start,
12507 end: index
12508 };
12509 }
12510
12511 return {
12512 literal: body.literal + flags.literal,
12513 value: value,
12514 regex: {
12515 pattern: body.value,
12516 flags: flags.value
12517 },
12518 start: start,
12519 end: index
12520 };
12521 }
12522
12523 function collectRegex() {
12524 var pos, loc, regex, token;
12525
12526 skipComment();
12527
12528 pos = index;
12529 loc = {
12530 start: {
12531 line: lineNumber,
12532 column: index - lineStart
12533 }
12534 };
12535
12536 regex = scanRegExp();
12537
12538 loc.end = {
12539 line: lineNumber,
12540 column: index - lineStart
12541 };
12542
12543 /* istanbul ignore next */
12544 if (!extra.tokenize) {
12545 // Pop the previous token, which is likely '/' or '/='
12546 if (extra.tokens.length > 0) {
12547 token = extra.tokens[extra.tokens.length - 1];
12548 if (token.range[0] === pos && token.type === 'Punctuator') {
12549 if (token.value === '/' || token.value === '/=') {
12550 extra.tokens.pop();
12551 }
12552 }
12553 }
12554
12555 extra.tokens.push({
12556 type: 'RegularExpression',
12557 value: regex.literal,
12558 regex: regex.regex,
12559 range: [pos, index],
12560 loc: loc
12561 });
12562 }
12563
12564 return regex;
12565 }
12566
12567 function isIdentifierName(token) {
12568 return token.type === Token.Identifier ||
12569 token.type === Token.Keyword ||
12570 token.type === Token.BooleanLiteral ||
12571 token.type === Token.NullLiteral;
12572 }
12573
Jian Li83d87a72016-04-20 15:38:24 -070012574 // Using the following algorithm:
12575 // https://github.com/mozilla/sweet.js/wiki/design
12576
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012577 function advanceSlash() {
Jian Li83d87a72016-04-20 15:38:24 -070012578 var regex, previous, check;
12579
12580 function testKeyword(value) {
12581 return value && (value.length > 1) && (value[0] >= 'a') && (value[0] <= 'z');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012582 }
Jian Li83d87a72016-04-20 15:38:24 -070012583
12584 previous = extra.tokenValues[extra.tokens.length - 1];
12585 regex = (previous !== null);
12586
12587 switch (previous) {
12588 case 'this':
12589 case ']':
12590 regex = false;
12591 break;
12592
12593 case ')':
12594 check = extra.tokenValues[extra.openParenToken - 1];
12595 regex = (check === 'if' || check === 'while' || check === 'for' || check === 'with');
12596 break;
12597
12598 case '}':
12599 // Dividing a function by anything makes little sense,
12600 // but we have to check for that.
12601 regex = false;
12602 if (testKeyword(extra.tokenValues[extra.openCurlyToken - 3])) {
12603 // Anonymous function, e.g. function(){} /42
12604 check = extra.tokenValues[extra.openCurlyToken - 4];
12605 regex = check ? (FnExprTokens.indexOf(check) < 0) : false;
12606 } else if (testKeyword(extra.tokenValues[extra.openCurlyToken - 4])) {
12607 // Named function, e.g. function f(){} /42/
12608 check = extra.tokenValues[extra.openCurlyToken - 5];
12609 regex = check ? (FnExprTokens.indexOf(check) < 0) : true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012610 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012611 }
Jian Li83d87a72016-04-20 15:38:24 -070012612
12613 return regex ? collectRegex() : scanPunctuator();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012614 }
12615
12616 function advance() {
Jian Li83d87a72016-04-20 15:38:24 -070012617 var cp, token;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012618
12619 if (index >= length) {
12620 return {
12621 type: Token.EOF,
12622 lineNumber: lineNumber,
12623 lineStart: lineStart,
12624 start: index,
12625 end: index
12626 };
12627 }
12628
Jian Li83d87a72016-04-20 15:38:24 -070012629 cp = source.charCodeAt(index);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012630
Jian Li83d87a72016-04-20 15:38:24 -070012631 if (isIdentifierStart(cp)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012632 token = scanIdentifier();
12633 if (strict && isStrictModeReservedWord(token.value)) {
12634 token.type = Token.Keyword;
12635 }
12636 return token;
12637 }
12638
12639 // Very common: ( and ) and ;
Jian Li83d87a72016-04-20 15:38:24 -070012640 if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012641 return scanPunctuator();
12642 }
12643
12644 // String literal starts with single quote (U+0027) or double quote (U+0022).
Jian Li83d87a72016-04-20 15:38:24 -070012645 if (cp === 0x27 || cp === 0x22) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012646 return scanStringLiteral();
12647 }
12648
12649 // Dot (.) U+002E can also start a floating-point number, hence the need
12650 // to check the next character.
Jian Li83d87a72016-04-20 15:38:24 -070012651 if (cp === 0x2E) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012652 if (isDecimalDigit(source.charCodeAt(index + 1))) {
12653 return scanNumericLiteral();
12654 }
12655 return scanPunctuator();
12656 }
12657
Jian Li83d87a72016-04-20 15:38:24 -070012658 if (isDecimalDigit(cp)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012659 return scanNumericLiteral();
12660 }
12661
12662 // Slash (/) U+002F can also start a regex.
Jian Li83d87a72016-04-20 15:38:24 -070012663 if (extra.tokenize && cp === 0x2F) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012664 return advanceSlash();
12665 }
12666
12667 // Template literals start with ` (U+0060) for template head
12668 // or } (U+007D) for template middle or template tail.
Jian Li83d87a72016-04-20 15:38:24 -070012669 if (cp === 0x60 || (cp === 0x7D && state.curlyStack[state.curlyStack.length - 1] === '${')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012670 return scanTemplate();
12671 }
12672
Jian Li83d87a72016-04-20 15:38:24 -070012673 // Possible identifier start in a surrogate pair.
12674 if (cp >= 0xD800 && cp < 0xDFFF) {
12675 cp = codePointAt(index);
12676 if (isIdentifierStart(cp)) {
12677 return scanIdentifier();
12678 }
12679 }
12680
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012681 return scanPunctuator();
12682 }
12683
12684 function collectToken() {
12685 var loc, token, value, entry;
12686
12687 loc = {
12688 start: {
12689 line: lineNumber,
12690 column: index - lineStart
12691 }
12692 };
12693
12694 token = advance();
12695 loc.end = {
12696 line: lineNumber,
12697 column: index - lineStart
12698 };
12699
12700 if (token.type !== Token.EOF) {
12701 value = source.slice(token.start, token.end);
12702 entry = {
12703 type: TokenName[token.type],
12704 value: value,
12705 range: [token.start, token.end],
12706 loc: loc
12707 };
12708 if (token.regex) {
12709 entry.regex = {
12710 pattern: token.regex.pattern,
12711 flags: token.regex.flags
12712 };
12713 }
Jian Li83d87a72016-04-20 15:38:24 -070012714 if (extra.tokenValues) {
12715 extra.tokenValues.push((entry.type === 'Punctuator' || entry.type === 'Keyword') ? entry.value : null);
12716 }
12717 if (extra.tokenize) {
12718 if (!extra.range) {
12719 delete entry.range;
12720 }
12721 if (!extra.loc) {
12722 delete entry.loc;
12723 }
12724 if (extra.delegate) {
12725 entry = extra.delegate(entry);
12726 }
12727 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012728 extra.tokens.push(entry);
12729 }
12730
12731 return token;
12732 }
12733
12734 function lex() {
12735 var token;
12736 scanning = true;
12737
12738 lastIndex = index;
12739 lastLineNumber = lineNumber;
12740 lastLineStart = lineStart;
12741
12742 skipComment();
12743
12744 token = lookahead;
12745
12746 startIndex = index;
12747 startLineNumber = lineNumber;
12748 startLineStart = lineStart;
12749
12750 lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
12751 scanning = false;
12752 return token;
12753 }
12754
12755 function peek() {
12756 scanning = true;
12757
12758 skipComment();
12759
12760 lastIndex = index;
12761 lastLineNumber = lineNumber;
12762 lastLineStart = lineStart;
12763
12764 startIndex = index;
12765 startLineNumber = lineNumber;
12766 startLineStart = lineStart;
12767
12768 lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();
12769 scanning = false;
12770 }
12771
12772 function Position() {
12773 this.line = startLineNumber;
12774 this.column = startIndex - startLineStart;
12775 }
12776
12777 function SourceLocation() {
12778 this.start = new Position();
12779 this.end = null;
12780 }
12781
12782 function WrappingSourceLocation(startToken) {
12783 this.start = {
12784 line: startToken.lineNumber,
12785 column: startToken.start - startToken.lineStart
12786 };
12787 this.end = null;
12788 }
12789
12790 function Node() {
12791 if (extra.range) {
12792 this.range = [startIndex, 0];
12793 }
12794 if (extra.loc) {
12795 this.loc = new SourceLocation();
12796 }
12797 }
12798
12799 function WrappingNode(startToken) {
12800 if (extra.range) {
12801 this.range = [startToken.start, 0];
12802 }
12803 if (extra.loc) {
12804 this.loc = new WrappingSourceLocation(startToken);
12805 }
12806 }
12807
12808 WrappingNode.prototype = Node.prototype = {
12809
12810 processComment: function () {
12811 var lastChild,
Jian Li83d87a72016-04-20 15:38:24 -070012812 innerComments,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012813 leadingComments,
12814 trailingComments,
12815 bottomRight = extra.bottomRightStack,
12816 i,
12817 comment,
12818 last = bottomRight[bottomRight.length - 1];
12819
12820 if (this.type === Syntax.Program) {
12821 if (this.body.length > 0) {
12822 return;
12823 }
12824 }
Jian Li83d87a72016-04-20 15:38:24 -070012825 /**
12826 * patch innnerComments for properties empty block
12827 * `function a() {/** comments **\/}`
12828 */
12829
12830 if (this.type === Syntax.BlockStatement && this.body.length === 0) {
12831 innerComments = [];
12832 for (i = extra.leadingComments.length - 1; i >= 0; --i) {
12833 comment = extra.leadingComments[i];
12834 if (this.range[1] >= comment.range[1]) {
12835 innerComments.unshift(comment);
12836 extra.leadingComments.splice(i, 1);
12837 extra.trailingComments.splice(i, 1);
12838 }
12839 }
12840 if (innerComments.length) {
12841 this.innerComments = innerComments;
12842 //bottomRight.push(this);
12843 return;
12844 }
12845 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012846
12847 if (extra.trailingComments.length > 0) {
12848 trailingComments = [];
12849 for (i = extra.trailingComments.length - 1; i >= 0; --i) {
12850 comment = extra.trailingComments[i];
12851 if (comment.range[0] >= this.range[1]) {
12852 trailingComments.unshift(comment);
12853 extra.trailingComments.splice(i, 1);
12854 }
12855 }
12856 extra.trailingComments = [];
12857 } else {
12858 if (last && last.trailingComments && last.trailingComments[0].range[0] >= this.range[1]) {
12859 trailingComments = last.trailingComments;
12860 delete last.trailingComments;
12861 }
12862 }
12863
12864 // Eating the stack.
Jian Li83d87a72016-04-20 15:38:24 -070012865 while (last && last.range[0] >= this.range[0]) {
12866 lastChild = bottomRight.pop();
12867 last = bottomRight[bottomRight.length - 1];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012868 }
12869
12870 if (lastChild) {
Jian Li83d87a72016-04-20 15:38:24 -070012871 if (lastChild.leadingComments) {
12872 leadingComments = [];
12873 for (i = lastChild.leadingComments.length - 1; i >= 0; --i) {
12874 comment = lastChild.leadingComments[i];
12875 if (comment.range[1] <= this.range[0]) {
12876 leadingComments.unshift(comment);
12877 lastChild.leadingComments.splice(i, 1);
12878 }
12879 }
12880
12881 if (!lastChild.leadingComments.length) {
12882 lastChild.leadingComments = undefined;
12883 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070012884 }
12885 } else if (extra.leadingComments.length > 0) {
12886 leadingComments = [];
12887 for (i = extra.leadingComments.length - 1; i >= 0; --i) {
12888 comment = extra.leadingComments[i];
12889 if (comment.range[1] <= this.range[0]) {
12890 leadingComments.unshift(comment);
12891 extra.leadingComments.splice(i, 1);
12892 }
12893 }
12894 }
12895
12896
12897 if (leadingComments && leadingComments.length > 0) {
12898 this.leadingComments = leadingComments;
12899 }
12900 if (trailingComments && trailingComments.length > 0) {
12901 this.trailingComments = trailingComments;
12902 }
12903
12904 bottomRight.push(this);
12905 },
12906
12907 finish: function () {
12908 if (extra.range) {
12909 this.range[1] = lastIndex;
12910 }
12911 if (extra.loc) {
12912 this.loc.end = {
12913 line: lastLineNumber,
12914 column: lastIndex - lastLineStart
12915 };
12916 if (extra.source) {
12917 this.loc.source = extra.source;
12918 }
12919 }
12920
12921 if (extra.attachComment) {
12922 this.processComment();
12923 }
12924 },
12925
12926 finishArrayExpression: function (elements) {
12927 this.type = Syntax.ArrayExpression;
12928 this.elements = elements;
12929 this.finish();
12930 return this;
12931 },
12932
12933 finishArrayPattern: function (elements) {
12934 this.type = Syntax.ArrayPattern;
12935 this.elements = elements;
12936 this.finish();
12937 return this;
12938 },
12939
12940 finishArrowFunctionExpression: function (params, defaults, body, expression) {
12941 this.type = Syntax.ArrowFunctionExpression;
12942 this.id = null;
12943 this.params = params;
12944 this.defaults = defaults;
12945 this.body = body;
12946 this.generator = false;
12947 this.expression = expression;
12948 this.finish();
12949 return this;
12950 },
12951
12952 finishAssignmentExpression: function (operator, left, right) {
12953 this.type = Syntax.AssignmentExpression;
12954 this.operator = operator;
12955 this.left = left;
12956 this.right = right;
12957 this.finish();
12958 return this;
12959 },
12960
12961 finishAssignmentPattern: function (left, right) {
12962 this.type = Syntax.AssignmentPattern;
12963 this.left = left;
12964 this.right = right;
12965 this.finish();
12966 return this;
12967 },
12968
12969 finishBinaryExpression: function (operator, left, right) {
12970 this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;
12971 this.operator = operator;
12972 this.left = left;
12973 this.right = right;
12974 this.finish();
12975 return this;
12976 },
12977
12978 finishBlockStatement: function (body) {
12979 this.type = Syntax.BlockStatement;
12980 this.body = body;
12981 this.finish();
12982 return this;
12983 },
12984
12985 finishBreakStatement: function (label) {
12986 this.type = Syntax.BreakStatement;
12987 this.label = label;
12988 this.finish();
12989 return this;
12990 },
12991
12992 finishCallExpression: function (callee, args) {
12993 this.type = Syntax.CallExpression;
12994 this.callee = callee;
12995 this.arguments = args;
12996 this.finish();
12997 return this;
12998 },
12999
13000 finishCatchClause: function (param, body) {
13001 this.type = Syntax.CatchClause;
13002 this.param = param;
13003 this.body = body;
13004 this.finish();
13005 return this;
13006 },
13007
13008 finishClassBody: function (body) {
13009 this.type = Syntax.ClassBody;
13010 this.body = body;
13011 this.finish();
13012 return this;
13013 },
13014
13015 finishClassDeclaration: function (id, superClass, body) {
13016 this.type = Syntax.ClassDeclaration;
13017 this.id = id;
13018 this.superClass = superClass;
13019 this.body = body;
13020 this.finish();
13021 return this;
13022 },
13023
13024 finishClassExpression: function (id, superClass, body) {
13025 this.type = Syntax.ClassExpression;
13026 this.id = id;
13027 this.superClass = superClass;
13028 this.body = body;
13029 this.finish();
13030 return this;
13031 },
13032
13033 finishConditionalExpression: function (test, consequent, alternate) {
13034 this.type = Syntax.ConditionalExpression;
13035 this.test = test;
13036 this.consequent = consequent;
13037 this.alternate = alternate;
13038 this.finish();
13039 return this;
13040 },
13041
13042 finishContinueStatement: function (label) {
13043 this.type = Syntax.ContinueStatement;
13044 this.label = label;
13045 this.finish();
13046 return this;
13047 },
13048
13049 finishDebuggerStatement: function () {
13050 this.type = Syntax.DebuggerStatement;
13051 this.finish();
13052 return this;
13053 },
13054
13055 finishDoWhileStatement: function (body, test) {
13056 this.type = Syntax.DoWhileStatement;
13057 this.body = body;
13058 this.test = test;
13059 this.finish();
13060 return this;
13061 },
13062
13063 finishEmptyStatement: function () {
13064 this.type = Syntax.EmptyStatement;
13065 this.finish();
13066 return this;
13067 },
13068
13069 finishExpressionStatement: function (expression) {
13070 this.type = Syntax.ExpressionStatement;
13071 this.expression = expression;
13072 this.finish();
13073 return this;
13074 },
13075
13076 finishForStatement: function (init, test, update, body) {
13077 this.type = Syntax.ForStatement;
13078 this.init = init;
13079 this.test = test;
13080 this.update = update;
13081 this.body = body;
13082 this.finish();
13083 return this;
13084 },
13085
Jian Li83d87a72016-04-20 15:38:24 -070013086 finishForOfStatement: function (left, right, body) {
13087 this.type = Syntax.ForOfStatement;
13088 this.left = left;
13089 this.right = right;
13090 this.body = body;
13091 this.finish();
13092 return this;
13093 },
13094
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013095 finishForInStatement: function (left, right, body) {
13096 this.type = Syntax.ForInStatement;
13097 this.left = left;
13098 this.right = right;
13099 this.body = body;
13100 this.each = false;
13101 this.finish();
13102 return this;
13103 },
13104
Jian Li83d87a72016-04-20 15:38:24 -070013105 finishFunctionDeclaration: function (id, params, defaults, body, generator) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013106 this.type = Syntax.FunctionDeclaration;
13107 this.id = id;
13108 this.params = params;
13109 this.defaults = defaults;
13110 this.body = body;
Jian Li83d87a72016-04-20 15:38:24 -070013111 this.generator = generator;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013112 this.expression = false;
13113 this.finish();
13114 return this;
13115 },
13116
Jian Li83d87a72016-04-20 15:38:24 -070013117 finishFunctionExpression: function (id, params, defaults, body, generator) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013118 this.type = Syntax.FunctionExpression;
13119 this.id = id;
13120 this.params = params;
13121 this.defaults = defaults;
13122 this.body = body;
Jian Li83d87a72016-04-20 15:38:24 -070013123 this.generator = generator;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013124 this.expression = false;
13125 this.finish();
13126 return this;
13127 },
13128
13129 finishIdentifier: function (name) {
13130 this.type = Syntax.Identifier;
13131 this.name = name;
13132 this.finish();
13133 return this;
13134 },
13135
13136 finishIfStatement: function (test, consequent, alternate) {
13137 this.type = Syntax.IfStatement;
13138 this.test = test;
13139 this.consequent = consequent;
13140 this.alternate = alternate;
13141 this.finish();
13142 return this;
13143 },
13144
13145 finishLabeledStatement: function (label, body) {
13146 this.type = Syntax.LabeledStatement;
13147 this.label = label;
13148 this.body = body;
13149 this.finish();
13150 return this;
13151 },
13152
13153 finishLiteral: function (token) {
13154 this.type = Syntax.Literal;
13155 this.value = token.value;
13156 this.raw = source.slice(token.start, token.end);
13157 if (token.regex) {
13158 this.regex = token.regex;
13159 }
13160 this.finish();
13161 return this;
13162 },
13163
13164 finishMemberExpression: function (accessor, object, property) {
13165 this.type = Syntax.MemberExpression;
13166 this.computed = accessor === '[';
13167 this.object = object;
13168 this.property = property;
13169 this.finish();
13170 return this;
13171 },
13172
Jian Li83d87a72016-04-20 15:38:24 -070013173 finishMetaProperty: function (meta, property) {
13174 this.type = Syntax.MetaProperty;
13175 this.meta = meta;
13176 this.property = property;
13177 this.finish();
13178 return this;
13179 },
13180
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013181 finishNewExpression: function (callee, args) {
13182 this.type = Syntax.NewExpression;
13183 this.callee = callee;
13184 this.arguments = args;
13185 this.finish();
13186 return this;
13187 },
13188
13189 finishObjectExpression: function (properties) {
13190 this.type = Syntax.ObjectExpression;
13191 this.properties = properties;
13192 this.finish();
13193 return this;
13194 },
13195
13196 finishObjectPattern: function (properties) {
13197 this.type = Syntax.ObjectPattern;
13198 this.properties = properties;
13199 this.finish();
13200 return this;
13201 },
13202
13203 finishPostfixExpression: function (operator, argument) {
13204 this.type = Syntax.UpdateExpression;
13205 this.operator = operator;
13206 this.argument = argument;
13207 this.prefix = false;
13208 this.finish();
13209 return this;
13210 },
13211
Jian Li83d87a72016-04-20 15:38:24 -070013212 finishProgram: function (body, sourceType) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013213 this.type = Syntax.Program;
13214 this.body = body;
Jian Li83d87a72016-04-20 15:38:24 -070013215 this.sourceType = sourceType;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013216 this.finish();
13217 return this;
13218 },
13219
13220 finishProperty: function (kind, key, computed, value, method, shorthand) {
13221 this.type = Syntax.Property;
13222 this.key = key;
13223 this.computed = computed;
13224 this.value = value;
13225 this.kind = kind;
13226 this.method = method;
13227 this.shorthand = shorthand;
13228 this.finish();
13229 return this;
13230 },
13231
13232 finishRestElement: function (argument) {
13233 this.type = Syntax.RestElement;
13234 this.argument = argument;
13235 this.finish();
13236 return this;
13237 },
13238
13239 finishReturnStatement: function (argument) {
13240 this.type = Syntax.ReturnStatement;
13241 this.argument = argument;
13242 this.finish();
13243 return this;
13244 },
13245
13246 finishSequenceExpression: function (expressions) {
13247 this.type = Syntax.SequenceExpression;
13248 this.expressions = expressions;
13249 this.finish();
13250 return this;
13251 },
13252
13253 finishSpreadElement: function (argument) {
13254 this.type = Syntax.SpreadElement;
13255 this.argument = argument;
13256 this.finish();
13257 return this;
13258 },
13259
13260 finishSwitchCase: function (test, consequent) {
13261 this.type = Syntax.SwitchCase;
13262 this.test = test;
13263 this.consequent = consequent;
13264 this.finish();
13265 return this;
13266 },
13267
13268 finishSuper: function () {
13269 this.type = Syntax.Super;
13270 this.finish();
13271 return this;
13272 },
13273
13274 finishSwitchStatement: function (discriminant, cases) {
13275 this.type = Syntax.SwitchStatement;
13276 this.discriminant = discriminant;
13277 this.cases = cases;
13278 this.finish();
13279 return this;
13280 },
13281
13282 finishTaggedTemplateExpression: function (tag, quasi) {
13283 this.type = Syntax.TaggedTemplateExpression;
13284 this.tag = tag;
13285 this.quasi = quasi;
13286 this.finish();
13287 return this;
13288 },
13289
13290 finishTemplateElement: function (value, tail) {
13291 this.type = Syntax.TemplateElement;
13292 this.value = value;
13293 this.tail = tail;
13294 this.finish();
13295 return this;
13296 },
13297
13298 finishTemplateLiteral: function (quasis, expressions) {
13299 this.type = Syntax.TemplateLiteral;
13300 this.quasis = quasis;
13301 this.expressions = expressions;
13302 this.finish();
13303 return this;
13304 },
13305
13306 finishThisExpression: function () {
13307 this.type = Syntax.ThisExpression;
13308 this.finish();
13309 return this;
13310 },
13311
13312 finishThrowStatement: function (argument) {
13313 this.type = Syntax.ThrowStatement;
13314 this.argument = argument;
13315 this.finish();
13316 return this;
13317 },
13318
13319 finishTryStatement: function (block, handler, finalizer) {
13320 this.type = Syntax.TryStatement;
13321 this.block = block;
13322 this.guardedHandlers = [];
Jian Li83d87a72016-04-20 15:38:24 -070013323 this.handlers = handler ? [handler] : [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013324 this.handler = handler;
13325 this.finalizer = finalizer;
13326 this.finish();
13327 return this;
13328 },
13329
13330 finishUnaryExpression: function (operator, argument) {
13331 this.type = (operator === '++' || operator === '--') ? Syntax.UpdateExpression : Syntax.UnaryExpression;
13332 this.operator = operator;
13333 this.argument = argument;
13334 this.prefix = true;
13335 this.finish();
13336 return this;
13337 },
13338
13339 finishVariableDeclaration: function (declarations) {
13340 this.type = Syntax.VariableDeclaration;
13341 this.declarations = declarations;
13342 this.kind = 'var';
13343 this.finish();
13344 return this;
13345 },
13346
13347 finishLexicalDeclaration: function (declarations, kind) {
13348 this.type = Syntax.VariableDeclaration;
13349 this.declarations = declarations;
13350 this.kind = kind;
13351 this.finish();
13352 return this;
13353 },
13354
13355 finishVariableDeclarator: function (id, init) {
13356 this.type = Syntax.VariableDeclarator;
13357 this.id = id;
13358 this.init = init;
13359 this.finish();
13360 return this;
13361 },
13362
13363 finishWhileStatement: function (test, body) {
13364 this.type = Syntax.WhileStatement;
13365 this.test = test;
13366 this.body = body;
13367 this.finish();
13368 return this;
13369 },
13370
13371 finishWithStatement: function (object, body) {
13372 this.type = Syntax.WithStatement;
13373 this.object = object;
13374 this.body = body;
13375 this.finish();
13376 return this;
13377 },
13378
13379 finishExportSpecifier: function (local, exported) {
13380 this.type = Syntax.ExportSpecifier;
13381 this.exported = exported || local;
13382 this.local = local;
13383 this.finish();
13384 return this;
13385 },
13386
13387 finishImportDefaultSpecifier: function (local) {
13388 this.type = Syntax.ImportDefaultSpecifier;
13389 this.local = local;
13390 this.finish();
13391 return this;
13392 },
13393
13394 finishImportNamespaceSpecifier: function (local) {
13395 this.type = Syntax.ImportNamespaceSpecifier;
13396 this.local = local;
13397 this.finish();
13398 return this;
13399 },
13400
13401 finishExportNamedDeclaration: function (declaration, specifiers, src) {
13402 this.type = Syntax.ExportNamedDeclaration;
13403 this.declaration = declaration;
13404 this.specifiers = specifiers;
13405 this.source = src;
13406 this.finish();
13407 return this;
13408 },
13409
13410 finishExportDefaultDeclaration: function (declaration) {
13411 this.type = Syntax.ExportDefaultDeclaration;
13412 this.declaration = declaration;
13413 this.finish();
13414 return this;
13415 },
13416
13417 finishExportAllDeclaration: function (src) {
13418 this.type = Syntax.ExportAllDeclaration;
13419 this.source = src;
13420 this.finish();
13421 return this;
13422 },
13423
13424 finishImportSpecifier: function (local, imported) {
13425 this.type = Syntax.ImportSpecifier;
13426 this.local = local || imported;
13427 this.imported = imported;
13428 this.finish();
13429 return this;
13430 },
13431
13432 finishImportDeclaration: function (specifiers, src) {
13433 this.type = Syntax.ImportDeclaration;
13434 this.specifiers = specifiers;
13435 this.source = src;
13436 this.finish();
13437 return this;
Jian Li83d87a72016-04-20 15:38:24 -070013438 },
13439
13440 finishYieldExpression: function (argument, delegate) {
13441 this.type = Syntax.YieldExpression;
13442 this.argument = argument;
13443 this.delegate = delegate;
13444 this.finish();
13445 return this;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013446 }
13447 };
13448
13449
13450 function recordError(error) {
13451 var e, existing;
13452
13453 for (e = 0; e < extra.errors.length; e++) {
13454 existing = extra.errors[e];
13455 // Prevent duplicated error.
13456 /* istanbul ignore next */
13457 if (existing.index === error.index && existing.message === error.message) {
13458 return;
13459 }
13460 }
13461
13462 extra.errors.push(error);
13463 }
13464
Jian Li83d87a72016-04-20 15:38:24 -070013465 function constructError(msg, column) {
13466 var error = new Error(msg);
13467 try {
13468 throw error;
13469 } catch (base) {
13470 /* istanbul ignore else */
13471 if (Object.create && Object.defineProperty) {
13472 error = Object.create(base);
13473 Object.defineProperty(error, 'column', { value: column });
13474 }
13475 } finally {
13476 return error;
13477 }
13478 }
13479
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013480 function createError(line, pos, description) {
Jian Li83d87a72016-04-20 15:38:24 -070013481 var msg, column, error;
13482
13483 msg = 'Line ' + line + ': ' + description;
13484 column = pos - (scanning ? lineStart : lastLineStart) + 1;
13485 error = constructError(msg, column);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013486 error.lineNumber = line;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013487 error.description = description;
Jian Li83d87a72016-04-20 15:38:24 -070013488 error.index = pos;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013489 return error;
13490 }
13491
13492 // Throw an exception
13493
13494 function throwError(messageFormat) {
13495 var args, msg;
13496
13497 args = Array.prototype.slice.call(arguments, 1);
13498 msg = messageFormat.replace(/%(\d)/g,
13499 function (whole, idx) {
13500 assert(idx < args.length, 'Message reference must be in range');
13501 return args[idx];
13502 }
13503 );
13504
13505 throw createError(lastLineNumber, lastIndex, msg);
13506 }
13507
13508 function tolerateError(messageFormat) {
13509 var args, msg, error;
13510
13511 args = Array.prototype.slice.call(arguments, 1);
13512 /* istanbul ignore next */
13513 msg = messageFormat.replace(/%(\d)/g,
13514 function (whole, idx) {
13515 assert(idx < args.length, 'Message reference must be in range');
13516 return args[idx];
13517 }
13518 );
13519
13520 error = createError(lineNumber, lastIndex, msg);
13521 if (extra.errors) {
13522 recordError(error);
13523 } else {
13524 throw error;
13525 }
13526 }
13527
13528 // Throw an exception because of the token.
13529
13530 function unexpectedTokenError(token, message) {
13531 var value, msg = message || Messages.UnexpectedToken;
13532
13533 if (token) {
13534 if (!message) {
13535 msg = (token.type === Token.EOF) ? Messages.UnexpectedEOS :
13536 (token.type === Token.Identifier) ? Messages.UnexpectedIdentifier :
13537 (token.type === Token.NumericLiteral) ? Messages.UnexpectedNumber :
13538 (token.type === Token.StringLiteral) ? Messages.UnexpectedString :
13539 (token.type === Token.Template) ? Messages.UnexpectedTemplate :
13540 Messages.UnexpectedToken;
13541
13542 if (token.type === Token.Keyword) {
13543 if (isFutureReservedWord(token.value)) {
13544 msg = Messages.UnexpectedReserved;
13545 } else if (strict && isStrictModeReservedWord(token.value)) {
13546 msg = Messages.StrictReservedWord;
13547 }
13548 }
13549 }
13550
13551 value = (token.type === Token.Template) ? token.value.raw : token.value;
13552 } else {
13553 value = 'ILLEGAL';
13554 }
13555
13556 msg = msg.replace('%0', value);
13557
13558 return (token && typeof token.lineNumber === 'number') ?
13559 createError(token.lineNumber, token.start, msg) :
13560 createError(scanning ? lineNumber : lastLineNumber, scanning ? index : lastIndex, msg);
13561 }
13562
13563 function throwUnexpectedToken(token, message) {
13564 throw unexpectedTokenError(token, message);
13565 }
13566
13567 function tolerateUnexpectedToken(token, message) {
13568 var error = unexpectedTokenError(token, message);
13569 if (extra.errors) {
13570 recordError(error);
13571 } else {
13572 throw error;
13573 }
13574 }
13575
13576 // Expect the next token to match the specified punctuator.
13577 // If not, an exception will be thrown.
13578
13579 function expect(value) {
13580 var token = lex();
13581 if (token.type !== Token.Punctuator || token.value !== value) {
13582 throwUnexpectedToken(token);
13583 }
13584 }
13585
13586 /**
13587 * @name expectCommaSeparator
13588 * @description Quietly expect a comma when in tolerant mode, otherwise delegates
13589 * to <code>expect(value)</code>
13590 * @since 2.0
13591 */
13592 function expectCommaSeparator() {
13593 var token;
13594
13595 if (extra.errors) {
13596 token = lookahead;
13597 if (token.type === Token.Punctuator && token.value === ',') {
13598 lex();
13599 } else if (token.type === Token.Punctuator && token.value === ';') {
13600 lex();
13601 tolerateUnexpectedToken(token);
13602 } else {
13603 tolerateUnexpectedToken(token, Messages.UnexpectedToken);
13604 }
13605 } else {
13606 expect(',');
13607 }
13608 }
13609
13610 // Expect the next token to match the specified keyword.
13611 // If not, an exception will be thrown.
13612
13613 function expectKeyword(keyword) {
13614 var token = lex();
13615 if (token.type !== Token.Keyword || token.value !== keyword) {
13616 throwUnexpectedToken(token);
13617 }
13618 }
13619
13620 // Return true if the next token matches the specified punctuator.
13621
13622 function match(value) {
13623 return lookahead.type === Token.Punctuator && lookahead.value === value;
13624 }
13625
13626 // Return true if the next token matches the specified keyword
13627
13628 function matchKeyword(keyword) {
13629 return lookahead.type === Token.Keyword && lookahead.value === keyword;
13630 }
13631
13632 // Return true if the next token matches the specified contextual keyword
13633 // (where an identifier is sometimes a keyword depending on the context)
13634
13635 function matchContextualKeyword(keyword) {
13636 return lookahead.type === Token.Identifier && lookahead.value === keyword;
13637 }
13638
13639 // Return true if the next token is an assignment operator
13640
13641 function matchAssign() {
13642 var op;
13643
13644 if (lookahead.type !== Token.Punctuator) {
13645 return false;
13646 }
13647 op = lookahead.value;
13648 return op === '=' ||
13649 op === '*=' ||
13650 op === '/=' ||
13651 op === '%=' ||
13652 op === '+=' ||
13653 op === '-=' ||
13654 op === '<<=' ||
13655 op === '>>=' ||
13656 op === '>>>=' ||
13657 op === '&=' ||
13658 op === '^=' ||
13659 op === '|=';
13660 }
13661
13662 function consumeSemicolon() {
13663 // Catch the very common case first: immediately a semicolon (U+003B).
13664 if (source.charCodeAt(startIndex) === 0x3B || match(';')) {
13665 lex();
13666 return;
13667 }
13668
13669 if (hasLineTerminator) {
13670 return;
13671 }
13672
13673 // FIXME(ikarienator): this is seemingly an issue in the previous location info convention.
13674 lastIndex = startIndex;
13675 lastLineNumber = startLineNumber;
13676 lastLineStart = startLineStart;
13677
13678 if (lookahead.type !== Token.EOF && !match('}')) {
13679 throwUnexpectedToken(lookahead);
13680 }
13681 }
13682
13683 // Cover grammar support.
13684 //
13685 // When an assignment expression position starts with an left parenthesis, the determination of the type
13686 // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
13687 // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
13688 //
13689 // There are three productions that can be parsed in a parentheses pair that needs to be determined
13690 // after the outermost pair is closed. They are:
13691 //
13692 // 1. AssignmentExpression
13693 // 2. BindingElements
13694 // 3. AssignmentTargets
13695 //
13696 // In order to avoid exponential backtracking, we use two flags to denote if the production can be
13697 // binding element or assignment target.
13698 //
13699 // The three productions have the relationship:
13700 //
13701 // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
13702 //
13703 // with a single exception that CoverInitializedName when used directly in an Expression, generates
13704 // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
13705 // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
13706 //
13707 // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
13708 // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
13709 // the CoverInitializedName check is conducted.
13710 //
13711 // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
13712 // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
13713 // pattern. The CoverInitializedName check is deferred.
13714 function isolateCoverGrammar(parser) {
13715 var oldIsBindingElement = isBindingElement,
13716 oldIsAssignmentTarget = isAssignmentTarget,
13717 oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
13718 result;
13719 isBindingElement = true;
13720 isAssignmentTarget = true;
13721 firstCoverInitializedNameError = null;
13722 result = parser();
13723 if (firstCoverInitializedNameError !== null) {
13724 throwUnexpectedToken(firstCoverInitializedNameError);
13725 }
13726 isBindingElement = oldIsBindingElement;
13727 isAssignmentTarget = oldIsAssignmentTarget;
13728 firstCoverInitializedNameError = oldFirstCoverInitializedNameError;
13729 return result;
13730 }
13731
13732 function inheritCoverGrammar(parser) {
13733 var oldIsBindingElement = isBindingElement,
13734 oldIsAssignmentTarget = isAssignmentTarget,
13735 oldFirstCoverInitializedNameError = firstCoverInitializedNameError,
13736 result;
13737 isBindingElement = true;
13738 isAssignmentTarget = true;
13739 firstCoverInitializedNameError = null;
13740 result = parser();
13741 isBindingElement = isBindingElement && oldIsBindingElement;
13742 isAssignmentTarget = isAssignmentTarget && oldIsAssignmentTarget;
13743 firstCoverInitializedNameError = oldFirstCoverInitializedNameError || firstCoverInitializedNameError;
13744 return result;
13745 }
13746
Jian Li83d87a72016-04-20 15:38:24 -070013747 // ECMA-262 13.3.3 Destructuring Binding Patterns
13748
13749 function parseArrayPattern(params, kind) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013750 var node = new Node(), elements = [], rest, restNode;
13751 expect('[');
13752
13753 while (!match(']')) {
13754 if (match(',')) {
13755 lex();
13756 elements.push(null);
13757 } else {
13758 if (match('...')) {
13759 restNode = new Node();
13760 lex();
Jian Li83d87a72016-04-20 15:38:24 -070013761 params.push(lookahead);
13762 rest = parseVariableIdentifier(kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013763 elements.push(restNode.finishRestElement(rest));
13764 break;
13765 } else {
Jian Li83d87a72016-04-20 15:38:24 -070013766 elements.push(parsePatternWithDefault(params, kind));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013767 }
13768 if (!match(']')) {
13769 expect(',');
13770 }
13771 }
13772
13773 }
13774
13775 expect(']');
13776
13777 return node.finishArrayPattern(elements);
13778 }
13779
Jian Li83d87a72016-04-20 15:38:24 -070013780 function parsePropertyPattern(params, kind) {
13781 var node = new Node(), key, keyToken, computed = match('['), init;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013782 if (lookahead.type === Token.Identifier) {
Jian Li83d87a72016-04-20 15:38:24 -070013783 keyToken = lookahead;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013784 key = parseVariableIdentifier();
13785 if (match('=')) {
Jian Li83d87a72016-04-20 15:38:24 -070013786 params.push(keyToken);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013787 lex();
13788 init = parseAssignmentExpression();
Jian Li83d87a72016-04-20 15:38:24 -070013789
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013790 return node.finishProperty(
13791 'init', key, false,
Jian Li83d87a72016-04-20 15:38:24 -070013792 new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, false);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013793 } else if (!match(':')) {
Jian Li83d87a72016-04-20 15:38:24 -070013794 params.push(keyToken);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013795 return node.finishProperty('init', key, false, key, false, true);
13796 }
13797 } else {
13798 key = parseObjectPropertyKey();
13799 }
13800 expect(':');
Jian Li83d87a72016-04-20 15:38:24 -070013801 init = parsePatternWithDefault(params, kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013802 return node.finishProperty('init', key, computed, init, false, false);
13803 }
13804
Jian Li83d87a72016-04-20 15:38:24 -070013805 function parseObjectPattern(params, kind) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013806 var node = new Node(), properties = [];
13807
13808 expect('{');
13809
13810 while (!match('}')) {
Jian Li83d87a72016-04-20 15:38:24 -070013811 properties.push(parsePropertyPattern(params, kind));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013812 if (!match('}')) {
13813 expect(',');
13814 }
13815 }
13816
13817 lex();
13818
13819 return node.finishObjectPattern(properties);
13820 }
13821
Jian Li83d87a72016-04-20 15:38:24 -070013822 function parsePattern(params, kind) {
13823 if (match('[')) {
13824 return parseArrayPattern(params, kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013825 } else if (match('{')) {
Jian Li83d87a72016-04-20 15:38:24 -070013826 return parseObjectPattern(params, kind);
13827 } else if (matchKeyword('let')) {
13828 if (kind === 'const' || kind === 'let') {
13829 tolerateUnexpectedToken(lookahead, Messages.UnexpectedToken);
13830 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013831 }
Jian Li83d87a72016-04-20 15:38:24 -070013832
13833 params.push(lookahead);
13834 return parseVariableIdentifier(kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013835 }
13836
Jian Li83d87a72016-04-20 15:38:24 -070013837 function parsePatternWithDefault(params, kind) {
13838 var startToken = lookahead, pattern, previousAllowYield, right;
13839 pattern = parsePattern(params, kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013840 if (match('=')) {
13841 lex();
Jian Li83d87a72016-04-20 15:38:24 -070013842 previousAllowYield = state.allowYield;
13843 state.allowYield = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013844 right = isolateCoverGrammar(parseAssignmentExpression);
Jian Li83d87a72016-04-20 15:38:24 -070013845 state.allowYield = previousAllowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013846 pattern = new WrappingNode(startToken).finishAssignmentPattern(pattern, right);
13847 }
13848 return pattern;
13849 }
13850
Jian Li83d87a72016-04-20 15:38:24 -070013851 // ECMA-262 12.2.5 Array Initializer
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013852
Jian Li83d87a72016-04-20 15:38:24 -070013853 function parseArrayInitializer() {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013854 var elements = [], node = new Node(), restSpread;
13855
13856 expect('[');
13857
13858 while (!match(']')) {
13859 if (match(',')) {
13860 lex();
13861 elements.push(null);
13862 } else if (match('...')) {
13863 restSpread = new Node();
13864 lex();
13865 restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));
13866
13867 if (!match(']')) {
13868 isAssignmentTarget = isBindingElement = false;
13869 expect(',');
13870 }
13871 elements.push(restSpread);
13872 } else {
13873 elements.push(inheritCoverGrammar(parseAssignmentExpression));
13874
13875 if (!match(']')) {
13876 expect(',');
13877 }
13878 }
13879 }
13880
13881 lex();
13882
13883 return node.finishArrayExpression(elements);
13884 }
13885
Jian Li83d87a72016-04-20 15:38:24 -070013886 // ECMA-262 12.2.6 Object Initializer
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013887
Jian Li83d87a72016-04-20 15:38:24 -070013888 function parsePropertyFunction(node, paramInfo, isGenerator) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013889 var previousStrict, body;
13890
13891 isAssignmentTarget = isBindingElement = false;
13892
13893 previousStrict = strict;
13894 body = isolateCoverGrammar(parseFunctionSourceElements);
13895
13896 if (strict && paramInfo.firstRestricted) {
13897 tolerateUnexpectedToken(paramInfo.firstRestricted, paramInfo.message);
13898 }
13899 if (strict && paramInfo.stricted) {
13900 tolerateUnexpectedToken(paramInfo.stricted, paramInfo.message);
13901 }
13902
13903 strict = previousStrict;
Jian Li83d87a72016-04-20 15:38:24 -070013904 return node.finishFunctionExpression(null, paramInfo.params, paramInfo.defaults, body, isGenerator);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013905 }
13906
13907 function parsePropertyMethodFunction() {
Jian Li83d87a72016-04-20 15:38:24 -070013908 var params, method, node = new Node(),
13909 previousAllowYield = state.allowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013910
Jian Li83d87a72016-04-20 15:38:24 -070013911 state.allowYield = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013912 params = parseParams();
Jian Li83d87a72016-04-20 15:38:24 -070013913 state.allowYield = previousAllowYield;
13914
13915 state.allowYield = false;
13916 method = parsePropertyFunction(node, params, false);
13917 state.allowYield = previousAllowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013918
13919 return method;
13920 }
13921
13922 function parseObjectPropertyKey() {
13923 var token, node = new Node(), expr;
13924
13925 token = lex();
13926
13927 // Note: This function is called only from parseObjectProperty(), where
13928 // EOF and Punctuator tokens are already filtered out.
13929
13930 switch (token.type) {
13931 case Token.StringLiteral:
13932 case Token.NumericLiteral:
13933 if (strict && token.octal) {
13934 tolerateUnexpectedToken(token, Messages.StrictOctalLiteral);
13935 }
13936 return node.finishLiteral(token);
13937 case Token.Identifier:
13938 case Token.BooleanLiteral:
13939 case Token.NullLiteral:
13940 case Token.Keyword:
13941 return node.finishIdentifier(token.value);
13942 case Token.Punctuator:
13943 if (token.value === '[') {
13944 expr = isolateCoverGrammar(parseAssignmentExpression);
13945 expect(']');
13946 return expr;
13947 }
13948 break;
13949 }
13950 throwUnexpectedToken(token);
13951 }
13952
13953 function lookaheadPropertyName() {
13954 switch (lookahead.type) {
13955 case Token.Identifier:
13956 case Token.StringLiteral:
13957 case Token.BooleanLiteral:
13958 case Token.NullLiteral:
13959 case Token.NumericLiteral:
13960 case Token.Keyword:
13961 return true;
13962 case Token.Punctuator:
13963 return lookahead.value === '[';
13964 }
13965 return false;
13966 }
13967
13968 // This function is to try to parse a MethodDefinition as defined in 14.3. But in the case of object literals,
13969 // it might be called at a position where there is in fact a short hand identifier pattern or a data property.
13970 // This can only be determined after we consumed up to the left parentheses.
13971 //
13972 // In order to avoid back tracking, it returns `null` if the position is not a MethodDefinition and the caller
13973 // is responsible to visit other options.
13974 function tryParseMethodDefinition(token, key, computed, node) {
Jian Li83d87a72016-04-20 15:38:24 -070013975 var value, options, methodNode, params,
13976 previousAllowYield = state.allowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013977
13978 if (token.type === Token.Identifier) {
13979 // check for `get` and `set`;
13980
13981 if (token.value === 'get' && lookaheadPropertyName()) {
13982 computed = match('[');
13983 key = parseObjectPropertyKey();
13984 methodNode = new Node();
13985 expect('(');
13986 expect(')');
Jian Li83d87a72016-04-20 15:38:24 -070013987
13988 state.allowYield = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013989 value = parsePropertyFunction(methodNode, {
13990 params: [],
13991 defaults: [],
13992 stricted: null,
13993 firstRestricted: null,
13994 message: null
Jian Li83d87a72016-04-20 15:38:24 -070013995 }, false);
13996 state.allowYield = previousAllowYield;
13997
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070013998 return node.finishProperty('get', key, computed, value, false, false);
13999 } else if (token.value === 'set' && lookaheadPropertyName()) {
14000 computed = match('[');
14001 key = parseObjectPropertyKey();
14002 methodNode = new Node();
14003 expect('(');
14004
14005 options = {
14006 params: [],
14007 defaultCount: 0,
14008 defaults: [],
14009 firstRestricted: null,
14010 paramSet: {}
14011 };
14012 if (match(')')) {
14013 tolerateUnexpectedToken(lookahead);
14014 } else {
Jian Li83d87a72016-04-20 15:38:24 -070014015 state.allowYield = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014016 parseParam(options);
Jian Li83d87a72016-04-20 15:38:24 -070014017 state.allowYield = previousAllowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014018 if (options.defaultCount === 0) {
14019 options.defaults = [];
14020 }
14021 }
14022 expect(')');
14023
Jian Li83d87a72016-04-20 15:38:24 -070014024 state.allowYield = false;
14025 value = parsePropertyFunction(methodNode, options, false);
14026 state.allowYield = previousAllowYield;
14027
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014028 return node.finishProperty('set', key, computed, value, false, false);
14029 }
Jian Li83d87a72016-04-20 15:38:24 -070014030 } else if (token.type === Token.Punctuator && token.value === '*' && lookaheadPropertyName()) {
14031 computed = match('[');
14032 key = parseObjectPropertyKey();
14033 methodNode = new Node();
14034
14035 state.allowYield = true;
14036 params = parseParams();
14037 state.allowYield = previousAllowYield;
14038
14039 state.allowYield = false;
14040 value = parsePropertyFunction(methodNode, params, true);
14041 state.allowYield = previousAllowYield;
14042
14043 return node.finishProperty('init', key, computed, value, true, false);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014044 }
14045
Jian Li83d87a72016-04-20 15:38:24 -070014046 if (key && match('(')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014047 value = parsePropertyMethodFunction();
14048 return node.finishProperty('init', key, computed, value, true, false);
14049 }
14050
14051 // Not a MethodDefinition.
14052 return null;
14053 }
14054
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014055 function parseObjectProperty(hasProto) {
Jian Li83d87a72016-04-20 15:38:24 -070014056 var token = lookahead, node = new Node(), computed, key, maybeMethod, proto, value;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014057
14058 computed = match('[');
Jian Li83d87a72016-04-20 15:38:24 -070014059 if (match('*')) {
14060 lex();
14061 } else {
14062 key = parseObjectPropertyKey();
14063 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014064 maybeMethod = tryParseMethodDefinition(token, key, computed, node);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014065 if (maybeMethod) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014066 return maybeMethod;
14067 }
14068
Jian Li83d87a72016-04-20 15:38:24 -070014069 if (!key) {
14070 throwUnexpectedToken(lookahead);
14071 }
14072
14073 // Check for duplicated __proto__
14074 if (!computed) {
14075 proto = (key.type === Syntax.Identifier && key.name === '__proto__') ||
14076 (key.type === Syntax.Literal && key.value === '__proto__');
14077 if (hasProto.value && proto) {
14078 tolerateError(Messages.DuplicateProtoProperty);
14079 }
14080 hasProto.value |= proto;
14081 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014082
14083 if (match(':')) {
14084 lex();
14085 value = inheritCoverGrammar(parseAssignmentExpression);
14086 return node.finishProperty('init', key, computed, value, false, false);
14087 }
14088
14089 if (token.type === Token.Identifier) {
14090 if (match('=')) {
14091 firstCoverInitializedNameError = lookahead;
14092 lex();
14093 value = isolateCoverGrammar(parseAssignmentExpression);
14094 return node.finishProperty('init', key, computed,
14095 new WrappingNode(token).finishAssignmentPattern(key, value), false, true);
14096 }
14097 return node.finishProperty('init', key, computed, key, false, true);
14098 }
14099
14100 throwUnexpectedToken(lookahead);
14101 }
14102
Jian Li83d87a72016-04-20 15:38:24 -070014103 function parseObjectInitializer() {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014104 var properties = [], hasProto = {value: false}, node = new Node();
14105
14106 expect('{');
14107
14108 while (!match('}')) {
14109 properties.push(parseObjectProperty(hasProto));
14110
14111 if (!match('}')) {
14112 expectCommaSeparator();
14113 }
14114 }
14115
14116 expect('}');
14117
14118 return node.finishObjectExpression(properties);
14119 }
14120
14121 function reinterpretExpressionAsPattern(expr) {
14122 var i;
14123 switch (expr.type) {
14124 case Syntax.Identifier:
14125 case Syntax.MemberExpression:
14126 case Syntax.RestElement:
14127 case Syntax.AssignmentPattern:
14128 break;
14129 case Syntax.SpreadElement:
14130 expr.type = Syntax.RestElement;
14131 reinterpretExpressionAsPattern(expr.argument);
14132 break;
14133 case Syntax.ArrayExpression:
14134 expr.type = Syntax.ArrayPattern;
14135 for (i = 0; i < expr.elements.length; i++) {
14136 if (expr.elements[i] !== null) {
14137 reinterpretExpressionAsPattern(expr.elements[i]);
14138 }
14139 }
14140 break;
14141 case Syntax.ObjectExpression:
14142 expr.type = Syntax.ObjectPattern;
14143 for (i = 0; i < expr.properties.length; i++) {
14144 reinterpretExpressionAsPattern(expr.properties[i].value);
14145 }
14146 break;
14147 case Syntax.AssignmentExpression:
14148 expr.type = Syntax.AssignmentPattern;
14149 reinterpretExpressionAsPattern(expr.left);
14150 break;
14151 default:
14152 // Allow other node type for tolerant parsing.
14153 break;
14154 }
14155 }
14156
Jian Li83d87a72016-04-20 15:38:24 -070014157 // ECMA-262 12.2.9 Template Literals
14158
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014159 function parseTemplateElement(option) {
14160 var node, token;
14161
14162 if (lookahead.type !== Token.Template || (option.head && !lookahead.head)) {
14163 throwUnexpectedToken();
14164 }
14165
14166 node = new Node();
14167 token = lex();
14168
14169 return node.finishTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail);
14170 }
14171
14172 function parseTemplateLiteral() {
14173 var quasi, quasis, expressions, node = new Node();
14174
14175 quasi = parseTemplateElement({ head: true });
Jian Li83d87a72016-04-20 15:38:24 -070014176 quasis = [quasi];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014177 expressions = [];
14178
14179 while (!quasi.tail) {
14180 expressions.push(parseExpression());
14181 quasi = parseTemplateElement({ head: false });
14182 quasis.push(quasi);
14183 }
14184
14185 return node.finishTemplateLiteral(quasis, expressions);
14186 }
14187
Jian Li83d87a72016-04-20 15:38:24 -070014188 // ECMA-262 12.2.10 The Grouping Operator
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014189
14190 function parseGroupExpression() {
Jian Li83d87a72016-04-20 15:38:24 -070014191 var expr, expressions, startToken, i, params = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014192
14193 expect('(');
14194
14195 if (match(')')) {
14196 lex();
14197 if (!match('=>')) {
14198 expect('=>');
14199 }
14200 return {
14201 type: PlaceHolders.ArrowParameterPlaceHolder,
Jian Li83d87a72016-04-20 15:38:24 -070014202 params: [],
14203 rawParams: []
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014204 };
14205 }
14206
14207 startToken = lookahead;
14208 if (match('...')) {
Jian Li83d87a72016-04-20 15:38:24 -070014209 expr = parseRestElement(params);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014210 expect(')');
14211 if (!match('=>')) {
14212 expect('=>');
14213 }
14214 return {
14215 type: PlaceHolders.ArrowParameterPlaceHolder,
14216 params: [expr]
14217 };
14218 }
14219
14220 isBindingElement = true;
14221 expr = inheritCoverGrammar(parseAssignmentExpression);
14222
14223 if (match(',')) {
14224 isAssignmentTarget = false;
14225 expressions = [expr];
14226
14227 while (startIndex < length) {
14228 if (!match(',')) {
14229 break;
14230 }
14231 lex();
14232
14233 if (match('...')) {
14234 if (!isBindingElement) {
14235 throwUnexpectedToken(lookahead);
14236 }
Jian Li83d87a72016-04-20 15:38:24 -070014237 expressions.push(parseRestElement(params));
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014238 expect(')');
14239 if (!match('=>')) {
14240 expect('=>');
14241 }
14242 isBindingElement = false;
14243 for (i = 0; i < expressions.length; i++) {
14244 reinterpretExpressionAsPattern(expressions[i]);
14245 }
14246 return {
14247 type: PlaceHolders.ArrowParameterPlaceHolder,
14248 params: expressions
14249 };
14250 }
14251
14252 expressions.push(inheritCoverGrammar(parseAssignmentExpression));
14253 }
14254
14255 expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
14256 }
14257
14258
14259 expect(')');
14260
14261 if (match('=>')) {
Jian Li83d87a72016-04-20 15:38:24 -070014262 if (expr.type === Syntax.Identifier && expr.name === 'yield') {
14263 return {
14264 type: PlaceHolders.ArrowParameterPlaceHolder,
14265 params: [expr]
14266 };
14267 }
14268
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014269 if (!isBindingElement) {
14270 throwUnexpectedToken(lookahead);
14271 }
14272
14273 if (expr.type === Syntax.SequenceExpression) {
14274 for (i = 0; i < expr.expressions.length; i++) {
14275 reinterpretExpressionAsPattern(expr.expressions[i]);
14276 }
14277 } else {
14278 reinterpretExpressionAsPattern(expr);
14279 }
14280
14281 expr = {
14282 type: PlaceHolders.ArrowParameterPlaceHolder,
14283 params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
14284 };
14285 }
14286 isBindingElement = false;
14287 return expr;
14288 }
14289
14290
Jian Li83d87a72016-04-20 15:38:24 -070014291 // ECMA-262 12.2 Primary Expressions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014292
14293 function parsePrimaryExpression() {
14294 var type, token, expr, node;
14295
14296 if (match('(')) {
14297 isBindingElement = false;
14298 return inheritCoverGrammar(parseGroupExpression);
14299 }
14300
14301 if (match('[')) {
Jian Li83d87a72016-04-20 15:38:24 -070014302 return inheritCoverGrammar(parseArrayInitializer);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014303 }
14304
14305 if (match('{')) {
Jian Li83d87a72016-04-20 15:38:24 -070014306 return inheritCoverGrammar(parseObjectInitializer);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014307 }
14308
14309 type = lookahead.type;
14310 node = new Node();
14311
14312 if (type === Token.Identifier) {
Jian Li83d87a72016-04-20 15:38:24 -070014313 if (state.sourceType === 'module' && lookahead.value === 'await') {
14314 tolerateUnexpectedToken(lookahead);
14315 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014316 expr = node.finishIdentifier(lex().value);
14317 } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
14318 isAssignmentTarget = isBindingElement = false;
14319 if (strict && lookahead.octal) {
14320 tolerateUnexpectedToken(lookahead, Messages.StrictOctalLiteral);
14321 }
14322 expr = node.finishLiteral(lex());
14323 } else if (type === Token.Keyword) {
Jian Li83d87a72016-04-20 15:38:24 -070014324 if (!strict && state.allowYield && matchKeyword('yield')) {
14325 return parseNonComputedProperty();
14326 }
14327 if (!strict && matchKeyword('let')) {
14328 return node.finishIdentifier(lex().value);
14329 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014330 isAssignmentTarget = isBindingElement = false;
14331 if (matchKeyword('function')) {
14332 return parseFunctionExpression();
14333 }
14334 if (matchKeyword('this')) {
14335 lex();
14336 return node.finishThisExpression();
14337 }
14338 if (matchKeyword('class')) {
14339 return parseClassExpression();
14340 }
14341 throwUnexpectedToken(lex());
14342 } else if (type === Token.BooleanLiteral) {
14343 isAssignmentTarget = isBindingElement = false;
14344 token = lex();
14345 token.value = (token.value === 'true');
14346 expr = node.finishLiteral(token);
14347 } else if (type === Token.NullLiteral) {
14348 isAssignmentTarget = isBindingElement = false;
14349 token = lex();
14350 token.value = null;
14351 expr = node.finishLiteral(token);
14352 } else if (match('/') || match('/=')) {
14353 isAssignmentTarget = isBindingElement = false;
14354 index = startIndex;
14355
14356 if (typeof extra.tokens !== 'undefined') {
14357 token = collectRegex();
14358 } else {
14359 token = scanRegExp();
14360 }
14361 lex();
14362 expr = node.finishLiteral(token);
14363 } else if (type === Token.Template) {
14364 expr = parseTemplateLiteral();
14365 } else {
14366 throwUnexpectedToken(lex());
14367 }
14368
14369 return expr;
14370 }
14371
Jian Li83d87a72016-04-20 15:38:24 -070014372 // ECMA-262 12.3 Left-Hand-Side Expressions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014373
14374 function parseArguments() {
Jian Li83d87a72016-04-20 15:38:24 -070014375 var args = [], expr;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014376
14377 expect('(');
14378
14379 if (!match(')')) {
14380 while (startIndex < length) {
Jian Li83d87a72016-04-20 15:38:24 -070014381 if (match('...')) {
14382 expr = new Node();
14383 lex();
14384 expr.finishSpreadElement(isolateCoverGrammar(parseAssignmentExpression));
14385 } else {
14386 expr = isolateCoverGrammar(parseAssignmentExpression);
14387 }
14388 args.push(expr);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014389 if (match(')')) {
14390 break;
14391 }
14392 expectCommaSeparator();
14393 }
14394 }
14395
14396 expect(')');
14397
14398 return args;
14399 }
14400
14401 function parseNonComputedProperty() {
14402 var token, node = new Node();
14403
14404 token = lex();
14405
14406 if (!isIdentifierName(token)) {
14407 throwUnexpectedToken(token);
14408 }
14409
14410 return node.finishIdentifier(token.value);
14411 }
14412
14413 function parseNonComputedMember() {
14414 expect('.');
14415
14416 return parseNonComputedProperty();
14417 }
14418
14419 function parseComputedMember() {
14420 var expr;
14421
14422 expect('[');
14423
14424 expr = isolateCoverGrammar(parseExpression);
14425
14426 expect(']');
14427
14428 return expr;
14429 }
14430
Jian Li83d87a72016-04-20 15:38:24 -070014431 // ECMA-262 12.3.3 The new Operator
14432
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014433 function parseNewExpression() {
14434 var callee, args, node = new Node();
14435
14436 expectKeyword('new');
Jian Li83d87a72016-04-20 15:38:24 -070014437
14438 if (match('.')) {
14439 lex();
14440 if (lookahead.type === Token.Identifier && lookahead.value === 'target') {
14441 if (state.inFunctionBody) {
14442 lex();
14443 return node.finishMetaProperty('new', 'target');
14444 }
14445 }
14446 throwUnexpectedToken(lookahead);
14447 }
14448
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014449 callee = isolateCoverGrammar(parseLeftHandSideExpression);
14450 args = match('(') ? parseArguments() : [];
14451
14452 isAssignmentTarget = isBindingElement = false;
14453
14454 return node.finishNewExpression(callee, args);
14455 }
14456
Jian Li83d87a72016-04-20 15:38:24 -070014457 // ECMA-262 12.3.4 Function Calls
14458
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014459 function parseLeftHandSideExpressionAllowCall() {
14460 var quasi, expr, args, property, startToken, previousAllowIn = state.allowIn;
14461
14462 startToken = lookahead;
14463 state.allowIn = true;
14464
14465 if (matchKeyword('super') && state.inFunctionBody) {
14466 expr = new Node();
14467 lex();
14468 expr = expr.finishSuper();
14469 if (!match('(') && !match('.') && !match('[')) {
14470 throwUnexpectedToken(lookahead);
14471 }
14472 } else {
14473 expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
14474 }
14475
14476 for (;;) {
14477 if (match('.')) {
14478 isBindingElement = false;
14479 isAssignmentTarget = true;
14480 property = parseNonComputedMember();
14481 expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
14482 } else if (match('(')) {
14483 isBindingElement = false;
14484 isAssignmentTarget = false;
14485 args = parseArguments();
14486 expr = new WrappingNode(startToken).finishCallExpression(expr, args);
14487 } else if (match('[')) {
14488 isBindingElement = false;
14489 isAssignmentTarget = true;
14490 property = parseComputedMember();
14491 expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
14492 } else if (lookahead.type === Token.Template && lookahead.head) {
14493 quasi = parseTemplateLiteral();
14494 expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
14495 } else {
14496 break;
14497 }
14498 }
14499 state.allowIn = previousAllowIn;
14500
14501 return expr;
14502 }
14503
Jian Li83d87a72016-04-20 15:38:24 -070014504 // ECMA-262 12.3 Left-Hand-Side Expressions
14505
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014506 function parseLeftHandSideExpression() {
14507 var quasi, expr, property, startToken;
14508 assert(state.allowIn, 'callee of new expression always allow in keyword.');
14509
14510 startToken = lookahead;
14511
14512 if (matchKeyword('super') && state.inFunctionBody) {
14513 expr = new Node();
14514 lex();
14515 expr = expr.finishSuper();
14516 if (!match('[') && !match('.')) {
14517 throwUnexpectedToken(lookahead);
14518 }
14519 } else {
14520 expr = inheritCoverGrammar(matchKeyword('new') ? parseNewExpression : parsePrimaryExpression);
14521 }
14522
14523 for (;;) {
14524 if (match('[')) {
14525 isBindingElement = false;
14526 isAssignmentTarget = true;
14527 property = parseComputedMember();
14528 expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);
14529 } else if (match('.')) {
14530 isBindingElement = false;
14531 isAssignmentTarget = true;
14532 property = parseNonComputedMember();
14533 expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);
14534 } else if (lookahead.type === Token.Template && lookahead.head) {
14535 quasi = parseTemplateLiteral();
14536 expr = new WrappingNode(startToken).finishTaggedTemplateExpression(expr, quasi);
14537 } else {
14538 break;
14539 }
14540 }
14541 return expr;
14542 }
14543
Jian Li83d87a72016-04-20 15:38:24 -070014544 // ECMA-262 12.4 Postfix Expressions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014545
14546 function parsePostfixExpression() {
14547 var expr, token, startToken = lookahead;
14548
14549 expr = inheritCoverGrammar(parseLeftHandSideExpressionAllowCall);
14550
14551 if (!hasLineTerminator && lookahead.type === Token.Punctuator) {
14552 if (match('++') || match('--')) {
Jian Li83d87a72016-04-20 15:38:24 -070014553 // ECMA-262 11.3.1, 11.3.2
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014554 if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
14555 tolerateError(Messages.StrictLHSPostfix);
14556 }
14557
14558 if (!isAssignmentTarget) {
14559 tolerateError(Messages.InvalidLHSInAssignment);
14560 }
14561
14562 isAssignmentTarget = isBindingElement = false;
14563
14564 token = lex();
14565 expr = new WrappingNode(startToken).finishPostfixExpression(token.value, expr);
14566 }
14567 }
14568
14569 return expr;
14570 }
14571
Jian Li83d87a72016-04-20 15:38:24 -070014572 // ECMA-262 12.5 Unary Operators
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014573
14574 function parseUnaryExpression() {
14575 var token, expr, startToken;
14576
14577 if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
14578 expr = parsePostfixExpression();
14579 } else if (match('++') || match('--')) {
14580 startToken = lookahead;
14581 token = lex();
14582 expr = inheritCoverGrammar(parseUnaryExpression);
Jian Li83d87a72016-04-20 15:38:24 -070014583 // ECMA-262 11.4.4, 11.4.5
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014584 if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
14585 tolerateError(Messages.StrictLHSPrefix);
14586 }
14587
14588 if (!isAssignmentTarget) {
14589 tolerateError(Messages.InvalidLHSInAssignment);
14590 }
14591 expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
14592 isAssignmentTarget = isBindingElement = false;
14593 } else if (match('+') || match('-') || match('~') || match('!')) {
14594 startToken = lookahead;
14595 token = lex();
14596 expr = inheritCoverGrammar(parseUnaryExpression);
14597 expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
14598 isAssignmentTarget = isBindingElement = false;
14599 } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
14600 startToken = lookahead;
14601 token = lex();
14602 expr = inheritCoverGrammar(parseUnaryExpression);
14603 expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
14604 if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
14605 tolerateError(Messages.StrictDelete);
14606 }
14607 isAssignmentTarget = isBindingElement = false;
14608 } else {
14609 expr = parsePostfixExpression();
14610 }
14611
14612 return expr;
14613 }
14614
14615 function binaryPrecedence(token, allowIn) {
14616 var prec = 0;
14617
14618 if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
14619 return 0;
14620 }
14621
14622 switch (token.value) {
14623 case '||':
14624 prec = 1;
14625 break;
14626
14627 case '&&':
14628 prec = 2;
14629 break;
14630
14631 case '|':
14632 prec = 3;
14633 break;
14634
14635 case '^':
14636 prec = 4;
14637 break;
14638
14639 case '&':
14640 prec = 5;
14641 break;
14642
14643 case '==':
14644 case '!=':
14645 case '===':
14646 case '!==':
14647 prec = 6;
14648 break;
14649
14650 case '<':
14651 case '>':
14652 case '<=':
14653 case '>=':
14654 case 'instanceof':
14655 prec = 7;
14656 break;
14657
14658 case 'in':
14659 prec = allowIn ? 7 : 0;
14660 break;
14661
14662 case '<<':
14663 case '>>':
14664 case '>>>':
14665 prec = 8;
14666 break;
14667
14668 case '+':
14669 case '-':
14670 prec = 9;
14671 break;
14672
14673 case '*':
14674 case '/':
14675 case '%':
14676 prec = 11;
14677 break;
14678
14679 default:
14680 break;
14681 }
14682
14683 return prec;
14684 }
14685
Jian Li83d87a72016-04-20 15:38:24 -070014686 // ECMA-262 12.6 Multiplicative Operators
14687 // ECMA-262 12.7 Additive Operators
14688 // ECMA-262 12.8 Bitwise Shift Operators
14689 // ECMA-262 12.9 Relational Operators
14690 // ECMA-262 12.10 Equality Operators
14691 // ECMA-262 12.11 Binary Bitwise Operators
14692 // ECMA-262 12.12 Binary Logical Operators
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014693
14694 function parseBinaryExpression() {
14695 var marker, markers, expr, token, prec, stack, right, operator, left, i;
14696
14697 marker = lookahead;
14698 left = inheritCoverGrammar(parseUnaryExpression);
14699
14700 token = lookahead;
14701 prec = binaryPrecedence(token, state.allowIn);
14702 if (prec === 0) {
14703 return left;
14704 }
14705 isAssignmentTarget = isBindingElement = false;
14706 token.prec = prec;
14707 lex();
14708
14709 markers = [marker, lookahead];
14710 right = isolateCoverGrammar(parseUnaryExpression);
14711
14712 stack = [left, token, right];
14713
14714 while ((prec = binaryPrecedence(lookahead, state.allowIn)) > 0) {
14715
14716 // Reduce: make a binary expression from the three topmost entries.
14717 while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
14718 right = stack.pop();
14719 operator = stack.pop().value;
14720 left = stack.pop();
14721 markers.pop();
14722 expr = new WrappingNode(markers[markers.length - 1]).finishBinaryExpression(operator, left, right);
14723 stack.push(expr);
14724 }
14725
14726 // Shift.
14727 token = lex();
14728 token.prec = prec;
14729 stack.push(token);
14730 markers.push(lookahead);
14731 expr = isolateCoverGrammar(parseUnaryExpression);
14732 stack.push(expr);
14733 }
14734
14735 // Final reduce to clean-up the stack.
14736 i = stack.length - 1;
14737 expr = stack[i];
14738 markers.pop();
14739 while (i > 1) {
14740 expr = new WrappingNode(markers.pop()).finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
14741 i -= 2;
14742 }
14743
14744 return expr;
14745 }
14746
14747
Jian Li83d87a72016-04-20 15:38:24 -070014748 // ECMA-262 12.13 Conditional Operator
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014749
14750 function parseConditionalExpression() {
14751 var expr, previousAllowIn, consequent, alternate, startToken;
14752
14753 startToken = lookahead;
14754
14755 expr = inheritCoverGrammar(parseBinaryExpression);
14756 if (match('?')) {
14757 lex();
14758 previousAllowIn = state.allowIn;
14759 state.allowIn = true;
14760 consequent = isolateCoverGrammar(parseAssignmentExpression);
14761 state.allowIn = previousAllowIn;
14762 expect(':');
14763 alternate = isolateCoverGrammar(parseAssignmentExpression);
14764
14765 expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);
14766 isAssignmentTarget = isBindingElement = false;
14767 }
14768
14769 return expr;
14770 }
14771
Jian Li83d87a72016-04-20 15:38:24 -070014772 // ECMA-262 14.2 Arrow Function Definitions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014773
14774 function parseConciseBody() {
14775 if (match('{')) {
14776 return parseFunctionSourceElements();
14777 }
14778 return isolateCoverGrammar(parseAssignmentExpression);
14779 }
14780
14781 function checkPatternParam(options, param) {
14782 var i;
14783 switch (param.type) {
14784 case Syntax.Identifier:
14785 validateParam(options, param, param.name);
14786 break;
14787 case Syntax.RestElement:
14788 checkPatternParam(options, param.argument);
14789 break;
14790 case Syntax.AssignmentPattern:
14791 checkPatternParam(options, param.left);
14792 break;
14793 case Syntax.ArrayPattern:
14794 for (i = 0; i < param.elements.length; i++) {
14795 if (param.elements[i] !== null) {
14796 checkPatternParam(options, param.elements[i]);
14797 }
14798 }
14799 break;
Jian Li83d87a72016-04-20 15:38:24 -070014800 case Syntax.YieldExpression:
14801 break;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014802 default:
14803 assert(param.type === Syntax.ObjectPattern, 'Invalid type');
14804 for (i = 0; i < param.properties.length; i++) {
14805 checkPatternParam(options, param.properties[i].value);
14806 }
14807 break;
14808 }
14809 }
14810 function reinterpretAsCoverFormalsList(expr) {
14811 var i, len, param, params, defaults, defaultCount, options, token;
14812
14813 defaults = [];
14814 defaultCount = 0;
14815 params = [expr];
14816
14817 switch (expr.type) {
14818 case Syntax.Identifier:
14819 break;
14820 case PlaceHolders.ArrowParameterPlaceHolder:
14821 params = expr.params;
14822 break;
14823 default:
14824 return null;
14825 }
14826
14827 options = {
14828 paramSet: {}
14829 };
14830
14831 for (i = 0, len = params.length; i < len; i += 1) {
14832 param = params[i];
14833 switch (param.type) {
14834 case Syntax.AssignmentPattern:
14835 params[i] = param.left;
Jian Li83d87a72016-04-20 15:38:24 -070014836 if (param.right.type === Syntax.YieldExpression) {
14837 if (param.right.argument) {
14838 throwUnexpectedToken(lookahead);
14839 }
14840 param.right.type = Syntax.Identifier;
14841 param.right.name = 'yield';
14842 delete param.right.argument;
14843 delete param.right.delegate;
14844 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014845 defaults.push(param.right);
14846 ++defaultCount;
14847 checkPatternParam(options, param.left);
14848 break;
14849 default:
14850 checkPatternParam(options, param);
14851 params[i] = param;
14852 defaults.push(null);
14853 break;
14854 }
14855 }
14856
Jian Li83d87a72016-04-20 15:38:24 -070014857 if (strict || !state.allowYield) {
14858 for (i = 0, len = params.length; i < len; i += 1) {
14859 param = params[i];
14860 if (param.type === Syntax.YieldExpression) {
14861 throwUnexpectedToken(lookahead);
14862 }
14863 }
14864 }
14865
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014866 if (options.message === Messages.StrictParamDupe) {
14867 token = strict ? options.stricted : options.firstRestricted;
14868 throwUnexpectedToken(token, options.message);
14869 }
14870
14871 if (defaultCount === 0) {
14872 defaults = [];
14873 }
14874
14875 return {
14876 params: params,
14877 defaults: defaults,
14878 stricted: options.stricted,
14879 firstRestricted: options.firstRestricted,
14880 message: options.message
14881 };
14882 }
14883
14884 function parseArrowFunctionExpression(options, node) {
Jian Li83d87a72016-04-20 15:38:24 -070014885 var previousStrict, previousAllowYield, body;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014886
14887 if (hasLineTerminator) {
14888 tolerateUnexpectedToken(lookahead);
14889 }
14890 expect('=>');
Jian Li83d87a72016-04-20 15:38:24 -070014891
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014892 previousStrict = strict;
Jian Li83d87a72016-04-20 15:38:24 -070014893 previousAllowYield = state.allowYield;
14894 state.allowYield = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014895
14896 body = parseConciseBody();
14897
14898 if (strict && options.firstRestricted) {
14899 throwUnexpectedToken(options.firstRestricted, options.message);
14900 }
14901 if (strict && options.stricted) {
14902 tolerateUnexpectedToken(options.stricted, options.message);
14903 }
14904
14905 strict = previousStrict;
Jian Li83d87a72016-04-20 15:38:24 -070014906 state.allowYield = previousAllowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014907
14908 return node.finishArrowFunctionExpression(options.params, options.defaults, body, body.type !== Syntax.BlockStatement);
14909 }
14910
Jian Li83d87a72016-04-20 15:38:24 -070014911 // ECMA-262 14.4 Yield expression
14912
14913 function parseYieldExpression() {
14914 var argument, expr, delegate, previousAllowYield;
14915
14916 argument = null;
14917 expr = new Node();
14918 delegate = false;
14919
14920 expectKeyword('yield');
14921
14922 if (!hasLineTerminator) {
14923 previousAllowYield = state.allowYield;
14924 state.allowYield = false;
14925 delegate = match('*');
14926 if (delegate) {
14927 lex();
14928 argument = parseAssignmentExpression();
14929 } else {
14930 if (!match(';') && !match('}') && !match(')') && lookahead.type !== Token.EOF) {
14931 argument = parseAssignmentExpression();
14932 }
14933 }
14934 state.allowYield = previousAllowYield;
14935 }
14936
14937 return expr.finishYieldExpression(argument, delegate);
14938 }
14939
14940 // ECMA-262 12.14 Assignment Operators
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014941
14942 function parseAssignmentExpression() {
14943 var token, expr, right, list, startToken;
14944
14945 startToken = lookahead;
14946 token = lookahead;
14947
Jian Li83d87a72016-04-20 15:38:24 -070014948 if (!state.allowYield && matchKeyword('yield')) {
14949 return parseYieldExpression();
14950 }
14951
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014952 expr = parseConditionalExpression();
14953
14954 if (expr.type === PlaceHolders.ArrowParameterPlaceHolder || match('=>')) {
14955 isAssignmentTarget = isBindingElement = false;
14956 list = reinterpretAsCoverFormalsList(expr);
14957
14958 if (list) {
14959 firstCoverInitializedNameError = null;
14960 return parseArrowFunctionExpression(list, new WrappingNode(startToken));
14961 }
14962
14963 return expr;
14964 }
14965
14966 if (matchAssign()) {
14967 if (!isAssignmentTarget) {
14968 tolerateError(Messages.InvalidLHSInAssignment);
14969 }
14970
Jian Li83d87a72016-04-20 15:38:24 -070014971 // ECMA-262 12.1.1
14972 if (strict && expr.type === Syntax.Identifier) {
14973 if (isRestrictedWord(expr.name)) {
14974 tolerateUnexpectedToken(token, Messages.StrictLHSAssignment);
14975 }
14976 if (isStrictModeReservedWord(expr.name)) {
14977 tolerateUnexpectedToken(token, Messages.StrictReservedWord);
14978 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014979 }
14980
14981 if (!match('=')) {
14982 isAssignmentTarget = isBindingElement = false;
14983 } else {
14984 reinterpretExpressionAsPattern(expr);
14985 }
14986
14987 token = lex();
14988 right = isolateCoverGrammar(parseAssignmentExpression);
14989 expr = new WrappingNode(startToken).finishAssignmentExpression(token.value, expr, right);
14990 firstCoverInitializedNameError = null;
14991 }
14992
14993 return expr;
14994 }
14995
Jian Li83d87a72016-04-20 15:38:24 -070014996 // ECMA-262 12.15 Comma Operator
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070014997
14998 function parseExpression() {
14999 var expr, startToken = lookahead, expressions;
15000
15001 expr = isolateCoverGrammar(parseAssignmentExpression);
15002
15003 if (match(',')) {
15004 expressions = [expr];
15005
15006 while (startIndex < length) {
15007 if (!match(',')) {
15008 break;
15009 }
15010 lex();
15011 expressions.push(isolateCoverGrammar(parseAssignmentExpression));
15012 }
15013
15014 expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
15015 }
15016
15017 return expr;
15018 }
15019
Jian Li83d87a72016-04-20 15:38:24 -070015020 // ECMA-262 13.2 Block
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015021
15022 function parseStatementListItem() {
15023 if (lookahead.type === Token.Keyword) {
15024 switch (lookahead.value) {
15025 case 'export':
Jian Li83d87a72016-04-20 15:38:24 -070015026 if (state.sourceType !== 'module') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015027 tolerateUnexpectedToken(lookahead, Messages.IllegalExportDeclaration);
15028 }
15029 return parseExportDeclaration();
15030 case 'import':
Jian Li83d87a72016-04-20 15:38:24 -070015031 if (state.sourceType !== 'module') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015032 tolerateUnexpectedToken(lookahead, Messages.IllegalImportDeclaration);
15033 }
15034 return parseImportDeclaration();
15035 case 'const':
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015036 return parseLexicalDeclaration({inFor: false});
15037 case 'function':
15038 return parseFunctionDeclaration(new Node());
15039 case 'class':
15040 return parseClassDeclaration();
15041 }
15042 }
15043
Jian Li83d87a72016-04-20 15:38:24 -070015044 if (matchKeyword('let') && isLexicalDeclaration()) {
15045 return parseLexicalDeclaration({inFor: false});
15046 }
15047
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015048 return parseStatement();
15049 }
15050
15051 function parseStatementList() {
15052 var list = [];
15053 while (startIndex < length) {
15054 if (match('}')) {
15055 break;
15056 }
15057 list.push(parseStatementListItem());
15058 }
15059
15060 return list;
15061 }
15062
15063 function parseBlock() {
15064 var block, node = new Node();
15065
15066 expect('{');
15067
15068 block = parseStatementList();
15069
15070 expect('}');
15071
15072 return node.finishBlockStatement(block);
15073 }
15074
Jian Li83d87a72016-04-20 15:38:24 -070015075 // ECMA-262 13.3.2 Variable Statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015076
Jian Li83d87a72016-04-20 15:38:24 -070015077 function parseVariableIdentifier(kind) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015078 var token, node = new Node();
15079
15080 token = lex();
15081
Jian Li83d87a72016-04-20 15:38:24 -070015082 if (token.type === Token.Keyword && token.value === 'yield') {
15083 if (strict) {
15084 tolerateUnexpectedToken(token, Messages.StrictReservedWord);
15085 } if (!state.allowYield) {
15086 throwUnexpectedToken(token);
15087 }
15088 } else if (token.type !== Token.Identifier) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015089 if (strict && token.type === Token.Keyword && isStrictModeReservedWord(token.value)) {
15090 tolerateUnexpectedToken(token, Messages.StrictReservedWord);
15091 } else {
Jian Li83d87a72016-04-20 15:38:24 -070015092 if (strict || token.value !== 'let' || kind !== 'var') {
15093 throwUnexpectedToken(token);
15094 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015095 }
Jian Li83d87a72016-04-20 15:38:24 -070015096 } else if (state.sourceType === 'module' && token.type === Token.Identifier && token.value === 'await') {
15097 tolerateUnexpectedToken(token);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015098 }
15099
15100 return node.finishIdentifier(token.value);
15101 }
15102
Jian Li83d87a72016-04-20 15:38:24 -070015103 function parseVariableDeclaration(options) {
15104 var init = null, id, node = new Node(), params = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015105
Jian Li83d87a72016-04-20 15:38:24 -070015106 id = parsePattern(params, 'var');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015107
Jian Li83d87a72016-04-20 15:38:24 -070015108 // ECMA-262 12.2.1
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015109 if (strict && isRestrictedWord(id.name)) {
15110 tolerateError(Messages.StrictVarName);
15111 }
15112
15113 if (match('=')) {
15114 lex();
15115 init = isolateCoverGrammar(parseAssignmentExpression);
Jian Li83d87a72016-04-20 15:38:24 -070015116 } else if (id.type !== Syntax.Identifier && !options.inFor) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015117 expect('=');
15118 }
15119
15120 return node.finishVariableDeclarator(id, init);
15121 }
15122
Jian Li83d87a72016-04-20 15:38:24 -070015123 function parseVariableDeclarationList(options) {
15124 var opt, list;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015125
Jian Li83d87a72016-04-20 15:38:24 -070015126 opt = { inFor: options.inFor };
15127 list = [parseVariableDeclaration(opt)];
15128
15129 while (match(',')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015130 lex();
Jian Li83d87a72016-04-20 15:38:24 -070015131 list.push(parseVariableDeclaration(opt));
15132 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015133
15134 return list;
15135 }
15136
15137 function parseVariableStatement(node) {
15138 var declarations;
15139
15140 expectKeyword('var');
15141
Jian Li83d87a72016-04-20 15:38:24 -070015142 declarations = parseVariableDeclarationList({ inFor: false });
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015143
15144 consumeSemicolon();
15145
15146 return node.finishVariableDeclaration(declarations);
15147 }
15148
Jian Li83d87a72016-04-20 15:38:24 -070015149 // ECMA-262 13.3.1 Let and Const Declarations
15150
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015151 function parseLexicalBinding(kind, options) {
Jian Li83d87a72016-04-20 15:38:24 -070015152 var init = null, id, node = new Node(), params = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015153
Jian Li83d87a72016-04-20 15:38:24 -070015154 id = parsePattern(params, kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015155
Jian Li83d87a72016-04-20 15:38:24 -070015156 // ECMA-262 12.2.1
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015157 if (strict && id.type === Syntax.Identifier && isRestrictedWord(id.name)) {
15158 tolerateError(Messages.StrictVarName);
15159 }
15160
15161 if (kind === 'const') {
Jian Li83d87a72016-04-20 15:38:24 -070015162 if (!matchKeyword('in') && !matchContextualKeyword('of')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015163 expect('=');
15164 init = isolateCoverGrammar(parseAssignmentExpression);
15165 }
15166 } else if ((!options.inFor && id.type !== Syntax.Identifier) || match('=')) {
15167 expect('=');
15168 init = isolateCoverGrammar(parseAssignmentExpression);
15169 }
15170
15171 return node.finishVariableDeclarator(id, init);
15172 }
15173
15174 function parseBindingList(kind, options) {
Jian Li83d87a72016-04-20 15:38:24 -070015175 var list = [parseLexicalBinding(kind, options)];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015176
Jian Li83d87a72016-04-20 15:38:24 -070015177 while (match(',')) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015178 lex();
Jian Li83d87a72016-04-20 15:38:24 -070015179 list.push(parseLexicalBinding(kind, options));
15180 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015181
15182 return list;
15183 }
15184
Jian Li83d87a72016-04-20 15:38:24 -070015185
15186 function tokenizerState() {
15187 return {
15188 index: index,
15189 lineNumber: lineNumber,
15190 lineStart: lineStart,
15191 hasLineTerminator: hasLineTerminator,
15192 lastIndex: lastIndex,
15193 lastLineNumber: lastLineNumber,
15194 lastLineStart: lastLineStart,
15195 startIndex: startIndex,
15196 startLineNumber: startLineNumber,
15197 startLineStart: startLineStart,
15198 lookahead: lookahead,
15199 tokenCount: extra.tokens ? extra.tokens.length : 0
15200 };
15201 }
15202
15203 function resetTokenizerState(ts) {
15204 index = ts.index;
15205 lineNumber = ts.lineNumber;
15206 lineStart = ts.lineStart;
15207 hasLineTerminator = ts.hasLineTerminator;
15208 lastIndex = ts.lastIndex;
15209 lastLineNumber = ts.lastLineNumber;
15210 lastLineStart = ts.lastLineStart;
15211 startIndex = ts.startIndex;
15212 startLineNumber = ts.startLineNumber;
15213 startLineStart = ts.startLineStart;
15214 lookahead = ts.lookahead;
15215 if (extra.tokens) {
15216 extra.tokens.splice(ts.tokenCount, extra.tokens.length);
15217 }
15218 }
15219
15220 function isLexicalDeclaration() {
15221 var lexical, ts;
15222
15223 ts = tokenizerState();
15224
15225 lex();
15226 lexical = (lookahead.type === Token.Identifier) || match('[') || match('{') ||
15227 matchKeyword('let') || matchKeyword('yield');
15228
15229 resetTokenizerState(ts);
15230
15231 return lexical;
15232 }
15233
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015234 function parseLexicalDeclaration(options) {
15235 var kind, declarations, node = new Node();
15236
15237 kind = lex().value;
15238 assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
15239
15240 declarations = parseBindingList(kind, options);
15241
15242 consumeSemicolon();
15243
15244 return node.finishLexicalDeclaration(declarations, kind);
15245 }
15246
Jian Li83d87a72016-04-20 15:38:24 -070015247 function parseRestElement(params) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015248 var param, node = new Node();
15249
15250 lex();
15251
15252 if (match('{')) {
15253 throwError(Messages.ObjectPatternAsRestParameter);
15254 }
15255
Jian Li83d87a72016-04-20 15:38:24 -070015256 params.push(lookahead);
15257
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015258 param = parseVariableIdentifier();
15259
15260 if (match('=')) {
15261 throwError(Messages.DefaultRestParameter);
15262 }
15263
15264 if (!match(')')) {
15265 throwError(Messages.ParameterAfterRestParameter);
15266 }
15267
15268 return node.finishRestElement(param);
15269 }
15270
Jian Li83d87a72016-04-20 15:38:24 -070015271 // ECMA-262 13.4 Empty Statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015272
15273 function parseEmptyStatement(node) {
15274 expect(';');
15275 return node.finishEmptyStatement();
15276 }
15277
Jian Li83d87a72016-04-20 15:38:24 -070015278 // ECMA-262 12.4 Expression Statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015279
15280 function parseExpressionStatement(node) {
15281 var expr = parseExpression();
15282 consumeSemicolon();
15283 return node.finishExpressionStatement(expr);
15284 }
15285
Jian Li83d87a72016-04-20 15:38:24 -070015286 // ECMA-262 13.6 If statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015287
15288 function parseIfStatement(node) {
15289 var test, consequent, alternate;
15290
15291 expectKeyword('if');
15292
15293 expect('(');
15294
15295 test = parseExpression();
15296
15297 expect(')');
15298
15299 consequent = parseStatement();
15300
15301 if (matchKeyword('else')) {
15302 lex();
15303 alternate = parseStatement();
15304 } else {
15305 alternate = null;
15306 }
15307
15308 return node.finishIfStatement(test, consequent, alternate);
15309 }
15310
Jian Li83d87a72016-04-20 15:38:24 -070015311 // ECMA-262 13.7 Iteration Statements
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015312
15313 function parseDoWhileStatement(node) {
15314 var body, test, oldInIteration;
15315
15316 expectKeyword('do');
15317
15318 oldInIteration = state.inIteration;
15319 state.inIteration = true;
15320
15321 body = parseStatement();
15322
15323 state.inIteration = oldInIteration;
15324
15325 expectKeyword('while');
15326
15327 expect('(');
15328
15329 test = parseExpression();
15330
15331 expect(')');
15332
15333 if (match(';')) {
15334 lex();
15335 }
15336
15337 return node.finishDoWhileStatement(body, test);
15338 }
15339
15340 function parseWhileStatement(node) {
15341 var test, body, oldInIteration;
15342
15343 expectKeyword('while');
15344
15345 expect('(');
15346
15347 test = parseExpression();
15348
15349 expect(')');
15350
15351 oldInIteration = state.inIteration;
15352 state.inIteration = true;
15353
15354 body = parseStatement();
15355
15356 state.inIteration = oldInIteration;
15357
15358 return node.finishWhileStatement(test, body);
15359 }
15360
15361 function parseForStatement(node) {
Jian Li83d87a72016-04-20 15:38:24 -070015362 var init, forIn, initSeq, initStartToken, test, update, left, right, kind, declarations,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015363 body, oldInIteration, previousAllowIn = state.allowIn;
15364
15365 init = test = update = null;
Jian Li83d87a72016-04-20 15:38:24 -070015366 forIn = true;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015367
15368 expectKeyword('for');
15369
15370 expect('(');
15371
15372 if (match(';')) {
15373 lex();
15374 } else {
15375 if (matchKeyword('var')) {
15376 init = new Node();
15377 lex();
15378
15379 state.allowIn = false;
Jian Li83d87a72016-04-20 15:38:24 -070015380 declarations = parseVariableDeclarationList({ inFor: true });
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015381 state.allowIn = previousAllowIn;
15382
Jian Li83d87a72016-04-20 15:38:24 -070015383 if (declarations.length === 1 && matchKeyword('in')) {
15384 init = init.finishVariableDeclaration(declarations);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015385 lex();
15386 left = init;
15387 right = parseExpression();
15388 init = null;
Jian Li83d87a72016-04-20 15:38:24 -070015389 } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) {
15390 init = init.finishVariableDeclaration(declarations);
15391 lex();
15392 left = init;
15393 right = parseAssignmentExpression();
15394 init = null;
15395 forIn = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015396 } else {
Jian Li83d87a72016-04-20 15:38:24 -070015397 init = init.finishVariableDeclaration(declarations);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015398 expect(';');
15399 }
15400 } else if (matchKeyword('const') || matchKeyword('let')) {
15401 init = new Node();
15402 kind = lex().value;
15403
Jian Li83d87a72016-04-20 15:38:24 -070015404 if (!strict && lookahead.value === 'in') {
15405 init = init.finishIdentifier(kind);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015406 lex();
15407 left = init;
15408 right = parseExpression();
15409 init = null;
15410 } else {
Jian Li83d87a72016-04-20 15:38:24 -070015411 state.allowIn = false;
15412 declarations = parseBindingList(kind, {inFor: true});
15413 state.allowIn = previousAllowIn;
15414
15415 if (declarations.length === 1 && declarations[0].init === null && matchKeyword('in')) {
15416 init = init.finishLexicalDeclaration(declarations, kind);
15417 lex();
15418 left = init;
15419 right = parseExpression();
15420 init = null;
15421 } else if (declarations.length === 1 && declarations[0].init === null && matchContextualKeyword('of')) {
15422 init = init.finishLexicalDeclaration(declarations, kind);
15423 lex();
15424 left = init;
15425 right = parseAssignmentExpression();
15426 init = null;
15427 forIn = false;
15428 } else {
15429 consumeSemicolon();
15430 init = init.finishLexicalDeclaration(declarations, kind);
15431 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015432 }
15433 } else {
15434 initStartToken = lookahead;
15435 state.allowIn = false;
15436 init = inheritCoverGrammar(parseAssignmentExpression);
15437 state.allowIn = previousAllowIn;
15438
15439 if (matchKeyword('in')) {
15440 if (!isAssignmentTarget) {
15441 tolerateError(Messages.InvalidLHSInForIn);
15442 }
15443
15444 lex();
15445 reinterpretExpressionAsPattern(init);
15446 left = init;
15447 right = parseExpression();
15448 init = null;
Jian Li83d87a72016-04-20 15:38:24 -070015449 } else if (matchContextualKeyword('of')) {
15450 if (!isAssignmentTarget) {
15451 tolerateError(Messages.InvalidLHSInForLoop);
15452 }
15453
15454 lex();
15455 reinterpretExpressionAsPattern(init);
15456 left = init;
15457 right = parseAssignmentExpression();
15458 init = null;
15459 forIn = false;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015460 } else {
15461 if (match(',')) {
15462 initSeq = [init];
15463 while (match(',')) {
15464 lex();
15465 initSeq.push(isolateCoverGrammar(parseAssignmentExpression));
15466 }
15467 init = new WrappingNode(initStartToken).finishSequenceExpression(initSeq);
15468 }
15469 expect(';');
15470 }
15471 }
15472 }
15473
15474 if (typeof left === 'undefined') {
15475
15476 if (!match(';')) {
15477 test = parseExpression();
15478 }
15479 expect(';');
15480
15481 if (!match(')')) {
15482 update = parseExpression();
15483 }
15484 }
15485
15486 expect(')');
15487
15488 oldInIteration = state.inIteration;
15489 state.inIteration = true;
15490
15491 body = isolateCoverGrammar(parseStatement);
15492
15493 state.inIteration = oldInIteration;
15494
15495 return (typeof left === 'undefined') ?
15496 node.finishForStatement(init, test, update, body) :
Jian Li83d87a72016-04-20 15:38:24 -070015497 forIn ? node.finishForInStatement(left, right, body) :
15498 node.finishForOfStatement(left, right, body);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015499 }
15500
Jian Li83d87a72016-04-20 15:38:24 -070015501 // ECMA-262 13.8 The continue statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015502
15503 function parseContinueStatement(node) {
15504 var label = null, key;
15505
15506 expectKeyword('continue');
15507
15508 // Optimize the most common form: 'continue;'.
15509 if (source.charCodeAt(startIndex) === 0x3B) {
15510 lex();
15511
15512 if (!state.inIteration) {
15513 throwError(Messages.IllegalContinue);
15514 }
15515
15516 return node.finishContinueStatement(null);
15517 }
15518
15519 if (hasLineTerminator) {
15520 if (!state.inIteration) {
15521 throwError(Messages.IllegalContinue);
15522 }
15523
15524 return node.finishContinueStatement(null);
15525 }
15526
15527 if (lookahead.type === Token.Identifier) {
15528 label = parseVariableIdentifier();
15529
15530 key = '$' + label.name;
15531 if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
15532 throwError(Messages.UnknownLabel, label.name);
15533 }
15534 }
15535
15536 consumeSemicolon();
15537
15538 if (label === null && !state.inIteration) {
15539 throwError(Messages.IllegalContinue);
15540 }
15541
15542 return node.finishContinueStatement(label);
15543 }
15544
Jian Li83d87a72016-04-20 15:38:24 -070015545 // ECMA-262 13.9 The break statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015546
15547 function parseBreakStatement(node) {
15548 var label = null, key;
15549
15550 expectKeyword('break');
15551
15552 // Catch the very common case first: immediately a semicolon (U+003B).
15553 if (source.charCodeAt(lastIndex) === 0x3B) {
15554 lex();
15555
15556 if (!(state.inIteration || state.inSwitch)) {
15557 throwError(Messages.IllegalBreak);
15558 }
15559
15560 return node.finishBreakStatement(null);
15561 }
15562
15563 if (hasLineTerminator) {
15564 if (!(state.inIteration || state.inSwitch)) {
15565 throwError(Messages.IllegalBreak);
15566 }
Jian Li83d87a72016-04-20 15:38:24 -070015567 } else if (lookahead.type === Token.Identifier) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015568 label = parseVariableIdentifier();
15569
15570 key = '$' + label.name;
15571 if (!Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
15572 throwError(Messages.UnknownLabel, label.name);
15573 }
15574 }
15575
15576 consumeSemicolon();
15577
15578 if (label === null && !(state.inIteration || state.inSwitch)) {
15579 throwError(Messages.IllegalBreak);
15580 }
15581
15582 return node.finishBreakStatement(label);
15583 }
15584
Jian Li83d87a72016-04-20 15:38:24 -070015585 // ECMA-262 13.10 The return statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015586
15587 function parseReturnStatement(node) {
15588 var argument = null;
15589
15590 expectKeyword('return');
15591
15592 if (!state.inFunctionBody) {
15593 tolerateError(Messages.IllegalReturn);
15594 }
15595
15596 // 'return' followed by a space and an identifier is very common.
15597 if (source.charCodeAt(lastIndex) === 0x20) {
15598 if (isIdentifierStart(source.charCodeAt(lastIndex + 1))) {
15599 argument = parseExpression();
15600 consumeSemicolon();
15601 return node.finishReturnStatement(argument);
15602 }
15603 }
15604
15605 if (hasLineTerminator) {
15606 // HACK
15607 return node.finishReturnStatement(null);
15608 }
15609
15610 if (!match(';')) {
15611 if (!match('}') && lookahead.type !== Token.EOF) {
15612 argument = parseExpression();
15613 }
15614 }
15615
15616 consumeSemicolon();
15617
15618 return node.finishReturnStatement(argument);
15619 }
15620
Jian Li83d87a72016-04-20 15:38:24 -070015621 // ECMA-262 13.11 The with statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015622
15623 function parseWithStatement(node) {
15624 var object, body;
15625
15626 if (strict) {
15627 tolerateError(Messages.StrictModeWith);
15628 }
15629
15630 expectKeyword('with');
15631
15632 expect('(');
15633
15634 object = parseExpression();
15635
15636 expect(')');
15637
15638 body = parseStatement();
15639
15640 return node.finishWithStatement(object, body);
15641 }
15642
Jian Li83d87a72016-04-20 15:38:24 -070015643 // ECMA-262 13.12 The switch statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015644
15645 function parseSwitchCase() {
15646 var test, consequent = [], statement, node = new Node();
15647
15648 if (matchKeyword('default')) {
15649 lex();
15650 test = null;
15651 } else {
15652 expectKeyword('case');
15653 test = parseExpression();
15654 }
15655 expect(':');
15656
15657 while (startIndex < length) {
15658 if (match('}') || matchKeyword('default') || matchKeyword('case')) {
15659 break;
15660 }
15661 statement = parseStatementListItem();
15662 consequent.push(statement);
15663 }
15664
15665 return node.finishSwitchCase(test, consequent);
15666 }
15667
15668 function parseSwitchStatement(node) {
15669 var discriminant, cases, clause, oldInSwitch, defaultFound;
15670
15671 expectKeyword('switch');
15672
15673 expect('(');
15674
15675 discriminant = parseExpression();
15676
15677 expect(')');
15678
15679 expect('{');
15680
15681 cases = [];
15682
15683 if (match('}')) {
15684 lex();
15685 return node.finishSwitchStatement(discriminant, cases);
15686 }
15687
15688 oldInSwitch = state.inSwitch;
15689 state.inSwitch = true;
15690 defaultFound = false;
15691
15692 while (startIndex < length) {
15693 if (match('}')) {
15694 break;
15695 }
15696 clause = parseSwitchCase();
15697 if (clause.test === null) {
15698 if (defaultFound) {
15699 throwError(Messages.MultipleDefaultsInSwitch);
15700 }
15701 defaultFound = true;
15702 }
15703 cases.push(clause);
15704 }
15705
15706 state.inSwitch = oldInSwitch;
15707
15708 expect('}');
15709
15710 return node.finishSwitchStatement(discriminant, cases);
15711 }
15712
Jian Li83d87a72016-04-20 15:38:24 -070015713 // ECMA-262 13.14 The throw statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015714
15715 function parseThrowStatement(node) {
15716 var argument;
15717
15718 expectKeyword('throw');
15719
15720 if (hasLineTerminator) {
15721 throwError(Messages.NewlineAfterThrow);
15722 }
15723
15724 argument = parseExpression();
15725
15726 consumeSemicolon();
15727
15728 return node.finishThrowStatement(argument);
15729 }
15730
Jian Li83d87a72016-04-20 15:38:24 -070015731 // ECMA-262 13.15 The try statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015732
15733 function parseCatchClause() {
Jian Li83d87a72016-04-20 15:38:24 -070015734 var param, params = [], paramMap = {}, key, i, body, node = new Node();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015735
15736 expectKeyword('catch');
15737
15738 expect('(');
15739 if (match(')')) {
15740 throwUnexpectedToken(lookahead);
15741 }
15742
Jian Li83d87a72016-04-20 15:38:24 -070015743 param = parsePattern(params);
15744 for (i = 0; i < params.length; i++) {
15745 key = '$' + params[i].value;
15746 if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
15747 tolerateError(Messages.DuplicateBinding, params[i].value);
15748 }
15749 paramMap[key] = true;
15750 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015751
Jian Li83d87a72016-04-20 15:38:24 -070015752 // ECMA-262 12.14.1
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015753 if (strict && isRestrictedWord(param.name)) {
15754 tolerateError(Messages.StrictCatchVariable);
15755 }
15756
15757 expect(')');
15758 body = parseBlock();
15759 return node.finishCatchClause(param, body);
15760 }
15761
15762 function parseTryStatement(node) {
15763 var block, handler = null, finalizer = null;
15764
15765 expectKeyword('try');
15766
15767 block = parseBlock();
15768
15769 if (matchKeyword('catch')) {
15770 handler = parseCatchClause();
15771 }
15772
15773 if (matchKeyword('finally')) {
15774 lex();
15775 finalizer = parseBlock();
15776 }
15777
15778 if (!handler && !finalizer) {
15779 throwError(Messages.NoCatchOrFinally);
15780 }
15781
15782 return node.finishTryStatement(block, handler, finalizer);
15783 }
15784
Jian Li83d87a72016-04-20 15:38:24 -070015785 // ECMA-262 13.16 The debugger statement
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015786
15787 function parseDebuggerStatement(node) {
15788 expectKeyword('debugger');
15789
15790 consumeSemicolon();
15791
15792 return node.finishDebuggerStatement();
15793 }
15794
Jian Li83d87a72016-04-20 15:38:24 -070015795 // 13 Statements
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015796
15797 function parseStatement() {
15798 var type = lookahead.type,
15799 expr,
15800 labeledBody,
15801 key,
15802 node;
15803
15804 if (type === Token.EOF) {
15805 throwUnexpectedToken(lookahead);
15806 }
15807
15808 if (type === Token.Punctuator && lookahead.value === '{') {
15809 return parseBlock();
15810 }
15811 isAssignmentTarget = isBindingElement = true;
15812 node = new Node();
15813
15814 if (type === Token.Punctuator) {
15815 switch (lookahead.value) {
15816 case ';':
15817 return parseEmptyStatement(node);
15818 case '(':
15819 return parseExpressionStatement(node);
15820 default:
15821 break;
15822 }
15823 } else if (type === Token.Keyword) {
15824 switch (lookahead.value) {
15825 case 'break':
15826 return parseBreakStatement(node);
15827 case 'continue':
15828 return parseContinueStatement(node);
15829 case 'debugger':
15830 return parseDebuggerStatement(node);
15831 case 'do':
15832 return parseDoWhileStatement(node);
15833 case 'for':
15834 return parseForStatement(node);
15835 case 'function':
15836 return parseFunctionDeclaration(node);
15837 case 'if':
15838 return parseIfStatement(node);
15839 case 'return':
15840 return parseReturnStatement(node);
15841 case 'switch':
15842 return parseSwitchStatement(node);
15843 case 'throw':
15844 return parseThrowStatement(node);
15845 case 'try':
15846 return parseTryStatement(node);
15847 case 'var':
15848 return parseVariableStatement(node);
15849 case 'while':
15850 return parseWhileStatement(node);
15851 case 'with':
15852 return parseWithStatement(node);
15853 default:
15854 break;
15855 }
15856 }
15857
15858 expr = parseExpression();
15859
Jian Li83d87a72016-04-20 15:38:24 -070015860 // ECMA-262 12.12 Labelled Statements
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015861 if ((expr.type === Syntax.Identifier) && match(':')) {
15862 lex();
15863
15864 key = '$' + expr.name;
15865 if (Object.prototype.hasOwnProperty.call(state.labelSet, key)) {
15866 throwError(Messages.Redeclaration, 'Label', expr.name);
15867 }
15868
15869 state.labelSet[key] = true;
15870 labeledBody = parseStatement();
15871 delete state.labelSet[key];
15872 return node.finishLabeledStatement(expr, labeledBody);
15873 }
15874
15875 consumeSemicolon();
15876
15877 return node.finishExpressionStatement(expr);
15878 }
15879
Jian Li83d87a72016-04-20 15:38:24 -070015880 // ECMA-262 14.1 Function Definition
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015881
15882 function parseFunctionSourceElements() {
15883 var statement, body = [], token, directive, firstRestricted,
15884 oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
15885 node = new Node();
15886
15887 expect('{');
15888
15889 while (startIndex < length) {
15890 if (lookahead.type !== Token.StringLiteral) {
15891 break;
15892 }
15893 token = lookahead;
15894
15895 statement = parseStatementListItem();
15896 body.push(statement);
15897 if (statement.expression.type !== Syntax.Literal) {
15898 // this is not directive
15899 break;
15900 }
15901 directive = source.slice(token.start + 1, token.end - 1);
15902 if (directive === 'use strict') {
15903 strict = true;
15904 if (firstRestricted) {
15905 tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
15906 }
15907 } else {
15908 if (!firstRestricted && token.octal) {
15909 firstRestricted = token;
15910 }
15911 }
15912 }
15913
15914 oldLabelSet = state.labelSet;
15915 oldInIteration = state.inIteration;
15916 oldInSwitch = state.inSwitch;
15917 oldInFunctionBody = state.inFunctionBody;
15918 oldParenthesisCount = state.parenthesizedCount;
15919
15920 state.labelSet = {};
15921 state.inIteration = false;
15922 state.inSwitch = false;
15923 state.inFunctionBody = true;
15924 state.parenthesizedCount = 0;
15925
15926 while (startIndex < length) {
15927 if (match('}')) {
15928 break;
15929 }
15930 body.push(parseStatementListItem());
15931 }
15932
15933 expect('}');
15934
15935 state.labelSet = oldLabelSet;
15936 state.inIteration = oldInIteration;
15937 state.inSwitch = oldInSwitch;
15938 state.inFunctionBody = oldInFunctionBody;
15939 state.parenthesizedCount = oldParenthesisCount;
15940
15941 return node.finishBlockStatement(body);
15942 }
15943
15944 function validateParam(options, param, name) {
15945 var key = '$' + name;
15946 if (strict) {
15947 if (isRestrictedWord(name)) {
15948 options.stricted = param;
15949 options.message = Messages.StrictParamName;
15950 }
15951 if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
15952 options.stricted = param;
15953 options.message = Messages.StrictParamDupe;
15954 }
15955 } else if (!options.firstRestricted) {
15956 if (isRestrictedWord(name)) {
15957 options.firstRestricted = param;
15958 options.message = Messages.StrictParamName;
15959 } else if (isStrictModeReservedWord(name)) {
15960 options.firstRestricted = param;
15961 options.message = Messages.StrictReservedWord;
15962 } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
Jian Li83d87a72016-04-20 15:38:24 -070015963 options.stricted = param;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015964 options.message = Messages.StrictParamDupe;
15965 }
15966 }
15967 options.paramSet[key] = true;
15968 }
15969
15970 function parseParam(options) {
Jian Li83d87a72016-04-20 15:38:24 -070015971 var token, param, params = [], i, def;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015972
15973 token = lookahead;
15974 if (token.value === '...') {
Jian Li83d87a72016-04-20 15:38:24 -070015975 param = parseRestElement(params);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015976 validateParam(options, param.argument, param.argument.name);
15977 options.params.push(param);
15978 options.defaults.push(null);
15979 return false;
15980 }
15981
Jian Li83d87a72016-04-20 15:38:24 -070015982 param = parsePatternWithDefault(params);
15983 for (i = 0; i < params.length; i++) {
15984 validateParam(options, params[i], params[i].value);
15985 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070015986
15987 if (param.type === Syntax.AssignmentPattern) {
15988 def = param.right;
15989 param = param.left;
15990 ++options.defaultCount;
15991 }
15992
15993 options.params.push(param);
15994 options.defaults.push(def);
15995
15996 return !match(')');
15997 }
15998
15999 function parseParams(firstRestricted) {
16000 var options;
16001
16002 options = {
16003 params: [],
16004 defaultCount: 0,
16005 defaults: [],
16006 firstRestricted: firstRestricted
16007 };
16008
16009 expect('(');
16010
16011 if (!match(')')) {
16012 options.paramSet = {};
16013 while (startIndex < length) {
16014 if (!parseParam(options)) {
16015 break;
16016 }
16017 expect(',');
16018 }
16019 }
16020
16021 expect(')');
16022
16023 if (options.defaultCount === 0) {
16024 options.defaults = [];
16025 }
16026
16027 return {
16028 params: options.params,
16029 defaults: options.defaults,
16030 stricted: options.stricted,
16031 firstRestricted: options.firstRestricted,
16032 message: options.message
16033 };
16034 }
16035
16036 function parseFunctionDeclaration(node, identifierIsOptional) {
Jian Li83d87a72016-04-20 15:38:24 -070016037 var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict,
16038 isGenerator, previousAllowYield;
16039
16040 previousAllowYield = state.allowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016041
16042 expectKeyword('function');
Jian Li83d87a72016-04-20 15:38:24 -070016043
16044 isGenerator = match('*');
16045 if (isGenerator) {
16046 lex();
16047 }
16048
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016049 if (!identifierIsOptional || !match('(')) {
16050 token = lookahead;
16051 id = parseVariableIdentifier();
16052 if (strict) {
16053 if (isRestrictedWord(token.value)) {
16054 tolerateUnexpectedToken(token, Messages.StrictFunctionName);
16055 }
16056 } else {
16057 if (isRestrictedWord(token.value)) {
16058 firstRestricted = token;
16059 message = Messages.StrictFunctionName;
16060 } else if (isStrictModeReservedWord(token.value)) {
16061 firstRestricted = token;
16062 message = Messages.StrictReservedWord;
16063 }
16064 }
16065 }
16066
Jian Li83d87a72016-04-20 15:38:24 -070016067 state.allowYield = !isGenerator;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016068 tmp = parseParams(firstRestricted);
16069 params = tmp.params;
16070 defaults = tmp.defaults;
16071 stricted = tmp.stricted;
16072 firstRestricted = tmp.firstRestricted;
16073 if (tmp.message) {
16074 message = tmp.message;
16075 }
16076
Jian Li83d87a72016-04-20 15:38:24 -070016077
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016078 previousStrict = strict;
16079 body = parseFunctionSourceElements();
16080 if (strict && firstRestricted) {
16081 throwUnexpectedToken(firstRestricted, message);
16082 }
16083 if (strict && stricted) {
16084 tolerateUnexpectedToken(stricted, message);
16085 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016086
Jian Li83d87a72016-04-20 15:38:24 -070016087 strict = previousStrict;
16088 state.allowYield = previousAllowYield;
16089
16090 return node.finishFunctionDeclaration(id, params, defaults, body, isGenerator);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016091 }
16092
16093 function parseFunctionExpression() {
16094 var token, id = null, stricted, firstRestricted, message, tmp,
Jian Li83d87a72016-04-20 15:38:24 -070016095 params = [], defaults = [], body, previousStrict, node = new Node(),
16096 isGenerator, previousAllowYield;
16097
16098 previousAllowYield = state.allowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016099
16100 expectKeyword('function');
16101
Jian Li83d87a72016-04-20 15:38:24 -070016102 isGenerator = match('*');
16103 if (isGenerator) {
16104 lex();
16105 }
16106
16107 state.allowYield = !isGenerator;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016108 if (!match('(')) {
16109 token = lookahead;
Jian Li83d87a72016-04-20 15:38:24 -070016110 id = (!strict && !isGenerator && matchKeyword('yield')) ? parseNonComputedProperty() : parseVariableIdentifier();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016111 if (strict) {
16112 if (isRestrictedWord(token.value)) {
16113 tolerateUnexpectedToken(token, Messages.StrictFunctionName);
16114 }
16115 } else {
16116 if (isRestrictedWord(token.value)) {
16117 firstRestricted = token;
16118 message = Messages.StrictFunctionName;
16119 } else if (isStrictModeReservedWord(token.value)) {
16120 firstRestricted = token;
16121 message = Messages.StrictReservedWord;
16122 }
16123 }
16124 }
16125
16126 tmp = parseParams(firstRestricted);
16127 params = tmp.params;
16128 defaults = tmp.defaults;
16129 stricted = tmp.stricted;
16130 firstRestricted = tmp.firstRestricted;
16131 if (tmp.message) {
16132 message = tmp.message;
16133 }
16134
16135 previousStrict = strict;
16136 body = parseFunctionSourceElements();
16137 if (strict && firstRestricted) {
16138 throwUnexpectedToken(firstRestricted, message);
16139 }
16140 if (strict && stricted) {
16141 tolerateUnexpectedToken(stricted, message);
16142 }
16143 strict = previousStrict;
Jian Li83d87a72016-04-20 15:38:24 -070016144 state.allowYield = previousAllowYield;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016145
Jian Li83d87a72016-04-20 15:38:24 -070016146 return node.finishFunctionExpression(id, params, defaults, body, isGenerator);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016147 }
16148
Jian Li83d87a72016-04-20 15:38:24 -070016149 // ECMA-262 14.5 Class Definitions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016150
16151 function parseClassBody() {
16152 var classBody, token, isStatic, hasConstructor = false, body, method, computed, key;
16153
16154 classBody = new Node();
16155
16156 expect('{');
16157 body = [];
16158 while (!match('}')) {
16159 if (match(';')) {
16160 lex();
16161 } else {
16162 method = new Node();
16163 token = lookahead;
16164 isStatic = false;
16165 computed = match('[');
Jian Li83d87a72016-04-20 15:38:24 -070016166 if (match('*')) {
16167 lex();
16168 } else {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016169 key = parseObjectPropertyKey();
Jian Li83d87a72016-04-20 15:38:24 -070016170 if (key.name === 'static' && (lookaheadPropertyName() || match('*'))) {
16171 token = lookahead;
16172 isStatic = true;
16173 computed = match('[');
16174 if (match('*')) {
16175 lex();
16176 } else {
16177 key = parseObjectPropertyKey();
16178 }
16179 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016180 }
16181 method = tryParseMethodDefinition(token, key, computed, method);
16182 if (method) {
Jian Li83d87a72016-04-20 15:38:24 -070016183 method['static'] = isStatic; // jscs:ignore requireDotNotation
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016184 if (method.kind === 'init') {
16185 method.kind = 'method';
16186 }
16187 if (!isStatic) {
16188 if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') {
16189 if (method.kind !== 'method' || !method.method || method.value.generator) {
16190 throwUnexpectedToken(token, Messages.ConstructorSpecialMethod);
16191 }
16192 if (hasConstructor) {
16193 throwUnexpectedToken(token, Messages.DuplicateConstructor);
16194 } else {
16195 hasConstructor = true;
16196 }
16197 method.kind = 'constructor';
16198 }
16199 } else {
16200 if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') {
16201 throwUnexpectedToken(token, Messages.StaticPrototype);
16202 }
16203 }
16204 method.type = Syntax.MethodDefinition;
16205 delete method.method;
16206 delete method.shorthand;
16207 body.push(method);
16208 } else {
16209 throwUnexpectedToken(lookahead);
16210 }
16211 }
16212 }
16213 lex();
16214 return classBody.finishClassBody(body);
16215 }
16216
16217 function parseClassDeclaration(identifierIsOptional) {
16218 var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
16219 strict = true;
16220
16221 expectKeyword('class');
16222
16223 if (!identifierIsOptional || lookahead.type === Token.Identifier) {
16224 id = parseVariableIdentifier();
16225 }
16226
16227 if (matchKeyword('extends')) {
16228 lex();
16229 superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
16230 }
16231 classBody = parseClassBody();
16232 strict = previousStrict;
16233
16234 return classNode.finishClassDeclaration(id, superClass, classBody);
16235 }
16236
16237 function parseClassExpression() {
16238 var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict;
16239 strict = true;
16240
16241 expectKeyword('class');
16242
16243 if (lookahead.type === Token.Identifier) {
16244 id = parseVariableIdentifier();
16245 }
16246
16247 if (matchKeyword('extends')) {
16248 lex();
16249 superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall);
16250 }
16251 classBody = parseClassBody();
16252 strict = previousStrict;
16253
16254 return classNode.finishClassExpression(id, superClass, classBody);
16255 }
16256
Jian Li83d87a72016-04-20 15:38:24 -070016257 // ECMA-262 15.2 Modules
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016258
16259 function parseModuleSpecifier() {
16260 var node = new Node();
16261
16262 if (lookahead.type !== Token.StringLiteral) {
16263 throwError(Messages.InvalidModuleSpecifier);
16264 }
16265 return node.finishLiteral(lex());
16266 }
16267
Jian Li83d87a72016-04-20 15:38:24 -070016268 // ECMA-262 15.2.3 Exports
16269
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016270 function parseExportSpecifier() {
16271 var exported, local, node = new Node(), def;
16272 if (matchKeyword('default')) {
16273 // export {default} from 'something';
16274 def = new Node();
16275 lex();
16276 local = def.finishIdentifier('default');
16277 } else {
16278 local = parseVariableIdentifier();
16279 }
16280 if (matchContextualKeyword('as')) {
16281 lex();
16282 exported = parseNonComputedProperty();
16283 }
16284 return node.finishExportSpecifier(local, exported);
16285 }
16286
16287 function parseExportNamedDeclaration(node) {
16288 var declaration = null,
16289 isExportFromIdentifier,
16290 src = null, specifiers = [];
16291
16292 // non-default export
16293 if (lookahead.type === Token.Keyword) {
16294 // covers:
16295 // export var f = 1;
16296 switch (lookahead.value) {
16297 case 'let':
16298 case 'const':
Jian Li83d87a72016-04-20 15:38:24 -070016299 declaration = parseLexicalDeclaration({inFor: false});
16300 return node.finishExportNamedDeclaration(declaration, specifiers, null);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016301 case 'var':
16302 case 'class':
16303 case 'function':
16304 declaration = parseStatementListItem();
16305 return node.finishExportNamedDeclaration(declaration, specifiers, null);
16306 }
16307 }
16308
16309 expect('{');
Jian Li83d87a72016-04-20 15:38:24 -070016310 while (!match('}')) {
16311 isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');
16312 specifiers.push(parseExportSpecifier());
16313 if (!match('}')) {
16314 expect(',');
16315 if (match('}')) {
16316 break;
16317 }
16318 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016319 }
16320 expect('}');
16321
16322 if (matchContextualKeyword('from')) {
16323 // covering:
16324 // export {default} from 'foo';
16325 // export {foo} from 'foo';
16326 lex();
16327 src = parseModuleSpecifier();
16328 consumeSemicolon();
16329 } else if (isExportFromIdentifier) {
16330 // covering:
16331 // export {default}; // missing fromClause
16332 throwError(lookahead.value ?
16333 Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
16334 } else {
16335 // cover
16336 // export {foo};
16337 consumeSemicolon();
16338 }
16339 return node.finishExportNamedDeclaration(declaration, specifiers, src);
16340 }
16341
16342 function parseExportDefaultDeclaration(node) {
16343 var declaration = null,
16344 expression = null;
16345
16346 // covers:
16347 // export default ...
16348 expectKeyword('default');
16349
16350 if (matchKeyword('function')) {
16351 // covers:
16352 // export default function foo () {}
16353 // export default function () {}
16354 declaration = parseFunctionDeclaration(new Node(), true);
16355 return node.finishExportDefaultDeclaration(declaration);
16356 }
16357 if (matchKeyword('class')) {
16358 declaration = parseClassDeclaration(true);
16359 return node.finishExportDefaultDeclaration(declaration);
16360 }
16361
16362 if (matchContextualKeyword('from')) {
16363 throwError(Messages.UnexpectedToken, lookahead.value);
16364 }
16365
16366 // covers:
16367 // export default {};
16368 // export default [];
16369 // export default (1 + 2);
16370 if (match('{')) {
Jian Li83d87a72016-04-20 15:38:24 -070016371 expression = parseObjectInitializer();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016372 } else if (match('[')) {
Jian Li83d87a72016-04-20 15:38:24 -070016373 expression = parseArrayInitializer();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016374 } else {
16375 expression = parseAssignmentExpression();
16376 }
16377 consumeSemicolon();
16378 return node.finishExportDefaultDeclaration(expression);
16379 }
16380
16381 function parseExportAllDeclaration(node) {
16382 var src;
16383
16384 // covers:
16385 // export * from 'foo';
16386 expect('*');
16387 if (!matchContextualKeyword('from')) {
16388 throwError(lookahead.value ?
16389 Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
16390 }
16391 lex();
16392 src = parseModuleSpecifier();
16393 consumeSemicolon();
16394
16395 return node.finishExportAllDeclaration(src);
16396 }
16397
16398 function parseExportDeclaration() {
16399 var node = new Node();
16400 if (state.inFunctionBody) {
16401 throwError(Messages.IllegalExportDeclaration);
16402 }
16403
16404 expectKeyword('export');
16405
16406 if (matchKeyword('default')) {
16407 return parseExportDefaultDeclaration(node);
16408 }
16409 if (match('*')) {
16410 return parseExportAllDeclaration(node);
16411 }
16412 return parseExportNamedDeclaration(node);
16413 }
16414
Jian Li83d87a72016-04-20 15:38:24 -070016415 // ECMA-262 15.2.2 Imports
16416
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016417 function parseImportSpecifier() {
16418 // import {<foo as bar>} ...;
16419 var local, imported, node = new Node();
16420
16421 imported = parseNonComputedProperty();
16422 if (matchContextualKeyword('as')) {
16423 lex();
16424 local = parseVariableIdentifier();
16425 }
16426
16427 return node.finishImportSpecifier(local, imported);
16428 }
16429
16430 function parseNamedImports() {
16431 var specifiers = [];
16432 // {foo, bar as bas}
16433 expect('{');
Jian Li83d87a72016-04-20 15:38:24 -070016434 while (!match('}')) {
16435 specifiers.push(parseImportSpecifier());
16436 if (!match('}')) {
16437 expect(',');
16438 if (match('}')) {
16439 break;
16440 }
16441 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016442 }
16443 expect('}');
16444 return specifiers;
16445 }
16446
16447 function parseImportDefaultSpecifier() {
16448 // import <foo> ...;
16449 var local, node = new Node();
16450
16451 local = parseNonComputedProperty();
16452
16453 return node.finishImportDefaultSpecifier(local);
16454 }
16455
16456 function parseImportNamespaceSpecifier() {
16457 // import <* as foo> ...;
16458 var local, node = new Node();
16459
16460 expect('*');
16461 if (!matchContextualKeyword('as')) {
16462 throwError(Messages.NoAsAfterImportNamespace);
16463 }
16464 lex();
16465 local = parseNonComputedProperty();
16466
16467 return node.finishImportNamespaceSpecifier(local);
16468 }
16469
16470 function parseImportDeclaration() {
Jian Li83d87a72016-04-20 15:38:24 -070016471 var specifiers = [], src, node = new Node();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016472
16473 if (state.inFunctionBody) {
16474 throwError(Messages.IllegalImportDeclaration);
16475 }
16476
16477 expectKeyword('import');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016478
16479 if (lookahead.type === Token.StringLiteral) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016480 // import 'foo';
16481 src = parseModuleSpecifier();
Jian Li83d87a72016-04-20 15:38:24 -070016482 } else {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016483
Jian Li83d87a72016-04-20 15:38:24 -070016484 if (match('{')) {
16485 // import {bar}
16486 specifiers = specifiers.concat(parseNamedImports());
16487 } else if (match('*')) {
16488 // import * as foo
16489 specifiers.push(parseImportNamespaceSpecifier());
16490 } else if (isIdentifierName(lookahead) && !matchKeyword('default')) {
16491 // import foo
16492 specifiers.push(parseImportDefaultSpecifier());
16493 if (match(',')) {
16494 lex();
16495 if (match('*')) {
16496 // import foo, * as foo
16497 specifiers.push(parseImportNamespaceSpecifier());
16498 } else if (match('{')) {
16499 // import foo, {bar}
16500 specifiers = specifiers.concat(parseNamedImports());
16501 } else {
16502 throwUnexpectedToken(lookahead);
16503 }
16504 }
16505 } else {
16506 throwUnexpectedToken(lex());
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016507 }
Jian Li83d87a72016-04-20 15:38:24 -070016508
16509 if (!matchContextualKeyword('from')) {
16510 throwError(lookahead.value ?
16511 Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
16512 }
16513 lex();
16514 src = parseModuleSpecifier();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016515 }
16516
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016517 consumeSemicolon();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016518 return node.finishImportDeclaration(specifiers, src);
16519 }
16520
Jian Li83d87a72016-04-20 15:38:24 -070016521 // ECMA-262 15.1 Scripts
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016522
16523 function parseScriptBody() {
16524 var statement, body = [], token, directive, firstRestricted;
16525
16526 while (startIndex < length) {
16527 token = lookahead;
16528 if (token.type !== Token.StringLiteral) {
16529 break;
16530 }
16531
16532 statement = parseStatementListItem();
16533 body.push(statement);
16534 if (statement.expression.type !== Syntax.Literal) {
16535 // this is not directive
16536 break;
16537 }
16538 directive = source.slice(token.start + 1, token.end - 1);
16539 if (directive === 'use strict') {
16540 strict = true;
16541 if (firstRestricted) {
16542 tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
16543 }
16544 } else {
16545 if (!firstRestricted && token.octal) {
16546 firstRestricted = token;
16547 }
16548 }
16549 }
16550
16551 while (startIndex < length) {
16552 statement = parseStatementListItem();
16553 /* istanbul ignore if */
16554 if (typeof statement === 'undefined') {
16555 break;
16556 }
16557 body.push(statement);
16558 }
16559 return body;
16560 }
16561
16562 function parseProgram() {
16563 var body, node;
16564
16565 peek();
16566 node = new Node();
16567
16568 body = parseScriptBody();
Jian Li83d87a72016-04-20 15:38:24 -070016569 return node.finishProgram(body, state.sourceType);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016570 }
16571
16572 function filterTokenLocation() {
16573 var i, entry, token, tokens = [];
16574
16575 for (i = 0; i < extra.tokens.length; ++i) {
16576 entry = extra.tokens[i];
16577 token = {
16578 type: entry.type,
16579 value: entry.value
16580 };
16581 if (entry.regex) {
16582 token.regex = {
16583 pattern: entry.regex.pattern,
16584 flags: entry.regex.flags
16585 };
16586 }
16587 if (extra.range) {
16588 token.range = entry.range;
16589 }
16590 if (extra.loc) {
16591 token.loc = entry.loc;
16592 }
16593 tokens.push(token);
16594 }
16595
16596 extra.tokens = tokens;
16597 }
16598
Jian Li83d87a72016-04-20 15:38:24 -070016599 function tokenize(code, options, delegate) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016600 var toString,
16601 tokens;
16602
16603 toString = String;
16604 if (typeof code !== 'string' && !(code instanceof String)) {
16605 code = toString(code);
16606 }
16607
16608 source = code;
16609 index = 0;
16610 lineNumber = (source.length > 0) ? 1 : 0;
16611 lineStart = 0;
16612 startIndex = index;
16613 startLineNumber = lineNumber;
16614 startLineStart = lineStart;
16615 length = source.length;
16616 lookahead = null;
16617 state = {
16618 allowIn: true,
Jian Li83d87a72016-04-20 15:38:24 -070016619 allowYield: true,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016620 labelSet: {},
16621 inFunctionBody: false,
16622 inIteration: false,
16623 inSwitch: false,
16624 lastCommentStart: -1,
16625 curlyStack: []
16626 };
16627
16628 extra = {};
16629
16630 // Options matching.
16631 options = options || {};
16632
16633 // Of course we collect tokens here.
16634 options.tokens = true;
16635 extra.tokens = [];
Jian Li83d87a72016-04-20 15:38:24 -070016636 extra.tokenValues = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016637 extra.tokenize = true;
Jian Li83d87a72016-04-20 15:38:24 -070016638 extra.delegate = delegate;
16639
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016640 // The following two fields are necessary to compute the Regex tokens.
16641 extra.openParenToken = -1;
16642 extra.openCurlyToken = -1;
16643
16644 extra.range = (typeof options.range === 'boolean') && options.range;
16645 extra.loc = (typeof options.loc === 'boolean') && options.loc;
16646
16647 if (typeof options.comment === 'boolean' && options.comment) {
16648 extra.comments = [];
16649 }
16650 if (typeof options.tolerant === 'boolean' && options.tolerant) {
16651 extra.errors = [];
16652 }
16653
16654 try {
16655 peek();
16656 if (lookahead.type === Token.EOF) {
16657 return extra.tokens;
16658 }
16659
16660 lex();
16661 while (lookahead.type !== Token.EOF) {
16662 try {
16663 lex();
16664 } catch (lexError) {
16665 if (extra.errors) {
16666 recordError(lexError);
16667 // We have to break on the first error
16668 // to avoid infinite loops.
16669 break;
16670 } else {
16671 throw lexError;
16672 }
16673 }
16674 }
16675
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016676 tokens = extra.tokens;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016677 if (typeof extra.errors !== 'undefined') {
16678 tokens.errors = extra.errors;
16679 }
16680 } catch (e) {
16681 throw e;
16682 } finally {
16683 extra = {};
16684 }
16685 return tokens;
16686 }
16687
16688 function parse(code, options) {
16689 var program, toString;
16690
16691 toString = String;
16692 if (typeof code !== 'string' && !(code instanceof String)) {
16693 code = toString(code);
16694 }
16695
16696 source = code;
16697 index = 0;
16698 lineNumber = (source.length > 0) ? 1 : 0;
16699 lineStart = 0;
16700 startIndex = index;
16701 startLineNumber = lineNumber;
16702 startLineStart = lineStart;
16703 length = source.length;
16704 lookahead = null;
16705 state = {
16706 allowIn: true,
Jian Li83d87a72016-04-20 15:38:24 -070016707 allowYield: true,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016708 labelSet: {},
16709 inFunctionBody: false,
16710 inIteration: false,
16711 inSwitch: false,
16712 lastCommentStart: -1,
Jian Li83d87a72016-04-20 15:38:24 -070016713 curlyStack: [],
16714 sourceType: 'script'
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016715 };
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016716 strict = false;
16717
16718 extra = {};
16719 if (typeof options !== 'undefined') {
16720 extra.range = (typeof options.range === 'boolean') && options.range;
16721 extra.loc = (typeof options.loc === 'boolean') && options.loc;
16722 extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;
16723
16724 if (extra.loc && options.source !== null && options.source !== undefined) {
16725 extra.source = toString(options.source);
16726 }
16727
16728 if (typeof options.tokens === 'boolean' && options.tokens) {
16729 extra.tokens = [];
16730 }
16731 if (typeof options.comment === 'boolean' && options.comment) {
16732 extra.comments = [];
16733 }
16734 if (typeof options.tolerant === 'boolean' && options.tolerant) {
16735 extra.errors = [];
16736 }
16737 if (extra.attachComment) {
16738 extra.range = true;
16739 extra.comments = [];
16740 extra.bottomRightStack = [];
16741 extra.trailingComments = [];
16742 extra.leadingComments = [];
16743 }
16744 if (options.sourceType === 'module') {
16745 // very restrictive condition for now
Jian Li83d87a72016-04-20 15:38:24 -070016746 state.sourceType = options.sourceType;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016747 strict = true;
16748 }
16749 }
16750
16751 try {
16752 program = parseProgram();
16753 if (typeof extra.comments !== 'undefined') {
16754 program.comments = extra.comments;
16755 }
16756 if (typeof extra.tokens !== 'undefined') {
16757 filterTokenLocation();
16758 program.tokens = extra.tokens;
16759 }
16760 if (typeof extra.errors !== 'undefined') {
16761 program.errors = extra.errors;
16762 }
16763 } catch (e) {
16764 throw e;
16765 } finally {
16766 extra = {};
16767 }
16768
16769 return program;
16770 }
16771
16772 // Sync with *.json manifests.
Jian Li83d87a72016-04-20 15:38:24 -070016773 exports.version = '2.7.1';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070016774
16775 exports.tokenize = tokenize;
16776
16777 exports.parse = parse;
16778
16779 // Deep copy.
16780 /* istanbul ignore next */
16781 exports.Syntax = (function () {
16782 var name, types = {};
16783
16784 if (typeof Object.create === 'function') {
16785 types = Object.create(null);
16786 }
16787
16788 for (name in Syntax) {
16789 if (Syntax.hasOwnProperty(name)) {
16790 types[name] = Syntax[name];
16791 }
16792 }
16793
16794 if (typeof Object.freeze === 'function') {
16795 Object.freeze(types);
16796 }
16797
16798 return types;
16799 }());
16800
16801}));
16802/* vim: set sw=4 ts=4 et tw=80 : */
16803
16804},{}],51:[function(require,module,exports){
Jian Li83d87a72016-04-20 15:38:24 -070016805/*!
16806 * node-inherit
16807 * Copyright(c) 2011 Dmitry Filatov <dfilatov@yandex-team.ru>
16808 * MIT Licensed
16809 */
16810
16811module.exports = require('./lib/inherit');
16812
16813},{"./lib/inherit":52}],52:[function(require,module,exports){
16814/**
16815 * @module inherit
16816 * @version 2.2.2
16817 * @author Filatov Dmitry <dfilatov@yandex-team.ru>
16818 * @description This module provides some syntax sugar for "class" declarations, constructors, mixins, "super" calls and static members.
16819 */
16820
16821(function(global) {
16822
16823var hasIntrospection = (function(){'_';}).toString().indexOf('_') > -1,
16824 emptyBase = function() {},
16825 hasOwnProperty = Object.prototype.hasOwnProperty,
16826 objCreate = Object.create || function(ptp) {
16827 var inheritance = function() {};
16828 inheritance.prototype = ptp;
16829 return new inheritance();
16830 },
16831 objKeys = Object.keys || function(obj) {
16832 var res = [];
16833 for(var i in obj) {
16834 hasOwnProperty.call(obj, i) && res.push(i);
16835 }
16836 return res;
16837 },
16838 extend = function(o1, o2) {
16839 for(var i in o2) {
16840 hasOwnProperty.call(o2, i) && (o1[i] = o2[i]);
16841 }
16842
16843 return o1;
16844 },
16845 toStr = Object.prototype.toString,
16846 isArray = Array.isArray || function(obj) {
16847 return toStr.call(obj) === '[object Array]';
16848 },
16849 isFunction = function(obj) {
16850 return toStr.call(obj) === '[object Function]';
16851 },
16852 noOp = function() {},
16853 needCheckProps = true,
16854 testPropObj = { toString : '' };
16855
16856for(var i in testPropObj) { // fucking ie hasn't toString, valueOf in for
16857 testPropObj.hasOwnProperty(i) && (needCheckProps = false);
16858}
16859
16860var specProps = needCheckProps? ['toString', 'valueOf'] : null;
16861
16862function getPropList(obj) {
16863 var res = objKeys(obj);
16864 if(needCheckProps) {
16865 var specProp, i = 0;
16866 while(specProp = specProps[i++]) {
16867 obj.hasOwnProperty(specProp) && res.push(specProp);
16868 }
16869 }
16870
16871 return res;
16872}
16873
16874function override(base, res, add) {
16875 var addList = getPropList(add),
16876 j = 0, len = addList.length,
16877 name, prop;
16878 while(j < len) {
16879 if((name = addList[j++]) === '__self') {
16880 continue;
16881 }
16882 prop = add[name];
16883 if(isFunction(prop) &&
16884 (!hasIntrospection || prop.toString().indexOf('.__base') > -1)) {
16885 res[name] = (function(name, prop) {
16886 var baseMethod = base[name]?
16887 base[name] :
16888 name === '__constructor'? // case of inheritance from plane function
16889 res.__self.__parent :
16890 noOp;
16891 return function() {
16892 var baseSaved = this.__base;
16893 this.__base = baseMethod;
16894 var res = prop.apply(this, arguments);
16895 this.__base = baseSaved;
16896 return res;
16897 };
16898 })(name, prop);
16899 } else {
16900 res[name] = prop;
16901 }
16902 }
16903}
16904
16905function applyMixins(mixins, res) {
16906 var i = 1, mixin;
16907 while(mixin = mixins[i++]) {
16908 res?
16909 isFunction(mixin)?
16910 inherit.self(res, mixin.prototype, mixin) :
16911 inherit.self(res, mixin) :
16912 res = isFunction(mixin)?
16913 inherit(mixins[0], mixin.prototype, mixin) :
16914 inherit(mixins[0], mixin);
16915 }
16916 return res || mixins[0];
16917}
16918
16919/**
16920* Creates class
16921* @exports
16922* @param {Function|Array} [baseClass|baseClassAndMixins] class (or class and mixins) to inherit from
16923* @param {Object} prototypeFields
16924* @param {Object} [staticFields]
16925* @returns {Function} class
16926*/
16927function inherit() {
16928 var args = arguments,
16929 withMixins = isArray(args[0]),
16930 hasBase = withMixins || isFunction(args[0]),
16931 base = hasBase? withMixins? applyMixins(args[0]) : args[0] : emptyBase,
16932 props = args[hasBase? 1 : 0] || {},
16933 staticProps = args[hasBase? 2 : 1],
16934 res = props.__constructor || (hasBase && base.prototype.__constructor)?
16935 function() {
16936 return this.__constructor.apply(this, arguments);
16937 } :
16938 hasBase?
16939 function() {
16940 return base.apply(this, arguments);
16941 } :
16942 function() {};
16943
16944 if(!hasBase) {
16945 res.prototype = props;
16946 res.prototype.__self = res.prototype.constructor = res;
16947 return extend(res, staticProps);
16948 }
16949
16950 extend(res, base);
16951
16952 res.__parent = base;
16953
16954 var basePtp = base.prototype,
16955 resPtp = res.prototype = objCreate(basePtp);
16956
16957 resPtp.__self = resPtp.constructor = res;
16958
16959 props && override(basePtp, resPtp, props);
16960 staticProps && override(base, res, staticProps);
16961
16962 return res;
16963}
16964
16965inherit.self = function() {
16966 var args = arguments,
16967 withMixins = isArray(args[0]),
16968 base = withMixins? applyMixins(args[0], args[0][0]) : args[0],
16969 props = args[1],
16970 staticProps = args[2],
16971 basePtp = base.prototype;
16972
16973 props && override(basePtp, basePtp, props);
16974 staticProps && override(base, base, staticProps);
16975
16976 return base;
16977};
16978
16979var defineAsGlobal = true;
16980if(typeof exports === 'object') {
16981 module.exports = inherit;
16982 defineAsGlobal = false;
16983}
16984
16985if(typeof modules === 'object') {
16986 modules.define('inherit', function(provide) {
16987 provide(inherit);
16988 });
16989 defineAsGlobal = false;
16990}
16991
16992if(typeof define === 'function') {
16993 define(function(require, exports, module) {
16994 module.exports = inherit;
16995 });
16996 defineAsGlobal = false;
16997}
16998
16999defineAsGlobal && (global.inherit = inherit);
17000
17001})(this);
17002
17003},{}],53:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017004var baseIndexOf = require('../internal/baseIndexOf'),
17005 binaryIndex = require('../internal/binaryIndex');
17006
17007/* Native method references for those with the same name as other `lodash` methods. */
17008var nativeMax = Math.max;
17009
17010/**
17011 * Gets the index at which the first occurrence of `value` is found in `array`
Jian Li83d87a72016-04-20 15:38:24 -070017012 * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
17013 * for equality comparisons. If `fromIndex` is negative, it's used as the offset
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017014 * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
17015 * performs a faster binary search.
17016 *
17017 * @static
17018 * @memberOf _
17019 * @category Array
17020 * @param {Array} array The array to search.
17021 * @param {*} value The value to search for.
17022 * @param {boolean|number} [fromIndex=0] The index to search from or `true`
17023 * to perform a binary search on a sorted array.
17024 * @returns {number} Returns the index of the matched value, else `-1`.
17025 * @example
17026 *
17027 * _.indexOf([1, 2, 1, 2], 2);
17028 * // => 1
17029 *
17030 * // using `fromIndex`
17031 * _.indexOf([1, 2, 1, 2], 2, 2);
17032 * // => 3
17033 *
17034 * // performing a binary search
17035 * _.indexOf([1, 1, 2, 2], 2, true);
17036 * // => 2
17037 */
17038function indexOf(array, value, fromIndex) {
17039 var length = array ? array.length : 0;
17040 if (!length) {
17041 return -1;
17042 }
17043 if (typeof fromIndex == 'number') {
17044 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
17045 } else if (fromIndex) {
Jian Li83d87a72016-04-20 15:38:24 -070017046 var index = binaryIndex(array, value);
17047 if (index < length &&
17048 (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017049 return index;
17050 }
17051 return -1;
17052 }
17053 return baseIndexOf(array, value, fromIndex || 0);
17054}
17055
17056module.exports = indexOf;
17057
Jian Li83d87a72016-04-20 15:38:24 -070017058},{"../internal/baseIndexOf":82,"../internal/binaryIndex":96}],54:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017059/**
17060 * Gets the last element of `array`.
17061 *
17062 * @static
17063 * @memberOf _
17064 * @category Array
17065 * @param {Array} array The array to query.
17066 * @returns {*} Returns the last element of `array`.
17067 * @example
17068 *
17069 * _.last([1, 2, 3]);
17070 * // => 3
17071 */
17072function last(array) {
17073 var length = array ? array.length : 0;
17074 return length ? array[length - 1] : undefined;
17075}
17076
17077module.exports = last;
17078
Jian Li83d87a72016-04-20 15:38:24 -070017079},{}],55:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017080var LazyWrapper = require('../internal/LazyWrapper'),
17081 LodashWrapper = require('../internal/LodashWrapper'),
17082 baseLodash = require('../internal/baseLodash'),
17083 isArray = require('../lang/isArray'),
17084 isObjectLike = require('../internal/isObjectLike'),
17085 wrapperClone = require('../internal/wrapperClone');
17086
17087/** Used for native method references. */
17088var objectProto = Object.prototype;
17089
17090/** Used to check objects for own properties. */
17091var hasOwnProperty = objectProto.hasOwnProperty;
17092
17093/**
17094 * Creates a `lodash` object which wraps `value` to enable implicit chaining.
17095 * Methods that operate on and return arrays, collections, and functions can
Jian Li83d87a72016-04-20 15:38:24 -070017096 * be chained together. Methods that retrieve a single value or may return a
17097 * primitive value will automatically end the chain returning the unwrapped
17098 * value. Explicit chaining may be enabled using `_.chain`. The execution of
17099 * chained methods is lazy, that is, execution is deferred until `_#value`
17100 * is implicitly or explicitly called.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017101 *
17102 * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
Jian Li83d87a72016-04-20 15:38:24 -070017103 * fusion is an optimization strategy which merge iteratee calls; this can help
17104 * to avoid the creation of intermediate data structures and greatly reduce the
17105 * number of iteratee executions.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017106 *
17107 * Chaining is supported in custom builds as long as the `_#value` method is
17108 * directly or indirectly included in the build.
17109 *
17110 * In addition to lodash methods, wrappers have `Array` and `String` methods.
17111 *
17112 * The wrapper `Array` methods are:
17113 * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
17114 * `splice`, and `unshift`
17115 *
17116 * The wrapper `String` methods are:
17117 * `replace` and `split`
17118 *
17119 * The wrapper methods that support shortcut fusion are:
17120 * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
17121 * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
17122 * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
17123 * and `where`
17124 *
17125 * The chainable wrapper methods are:
17126 * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
17127 * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
Jian Li83d87a72016-04-20 15:38:24 -070017128 * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
17129 * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,
17130 * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,
17131 * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
17132 * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
17133 * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,
17134 * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
17135 * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
17136 * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
17137 * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
17138 * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
17139 * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
17140 * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
17141 * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
17142 * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017143 *
17144 * The wrapper methods that are **not** chainable by default are:
Jian Li83d87a72016-04-20 15:38:24 -070017145 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
17146 * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
17147 * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
17148 * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
17149 * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
17150 * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
17151 * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
17152 * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
17153 * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
17154 * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
17155 * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
17156 * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
17157 * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
17158 * `unescape`, `uniqueId`, `value`, and `words`
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017159 *
17160 * The wrapper method `sample` will return a wrapped value when `n` is provided,
17161 * otherwise an unwrapped value is returned.
17162 *
17163 * @name _
17164 * @constructor
17165 * @category Chain
17166 * @param {*} value The value to wrap in a `lodash` instance.
17167 * @returns {Object} Returns the new `lodash` wrapper instance.
17168 * @example
17169 *
17170 * var wrapped = _([1, 2, 3]);
17171 *
17172 * // returns an unwrapped value
17173 * wrapped.reduce(function(total, n) {
17174 * return total + n;
17175 * });
17176 * // => 6
17177 *
17178 * // returns a wrapped value
17179 * var squares = wrapped.map(function(n) {
17180 * return n * n;
17181 * });
17182 *
17183 * _.isArray(squares);
17184 * // => false
17185 *
17186 * _.isArray(squares.value());
17187 * // => true
17188 */
17189function lodash(value) {
17190 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
17191 if (value instanceof LodashWrapper) {
17192 return value;
17193 }
17194 if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
17195 return wrapperClone(value);
17196 }
17197 }
17198 return new LodashWrapper(value);
17199}
17200
17201// Ensure wrappers are instances of `baseLodash`.
17202lodash.prototype = baseLodash.prototype;
17203
17204module.exports = lodash;
17205
Jian Li83d87a72016-04-20 15:38:24 -070017206},{"../internal/LazyWrapper":64,"../internal/LodashWrapper":65,"../internal/baseLodash":86,"../internal/isObjectLike":130,"../internal/wrapperClone":141,"../lang/isArray":144}],56:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017207module.exports = require('./forEach');
17208
Jian Li83d87a72016-04-20 15:38:24 -070017209},{"./forEach":58}],57:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017210var baseEach = require('../internal/baseEach'),
17211 createFind = require('../internal/createFind');
17212
17213/**
17214 * Iterates over elements of `collection`, returning the first element
17215 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
17216 * invoked with three arguments: (value, index|key, collection).
17217 *
17218 * If a property name is provided for `predicate` the created `_.property`
17219 * style callback returns the property value of the given element.
17220 *
17221 * If a value is also provided for `thisArg` the created `_.matchesProperty`
17222 * style callback returns `true` for elements that have a matching property
17223 * value, else `false`.
17224 *
17225 * If an object is provided for `predicate` the created `_.matches` style
17226 * callback returns `true` for elements that have the properties of the given
17227 * object, else `false`.
17228 *
17229 * @static
17230 * @memberOf _
17231 * @alias detect
17232 * @category Collection
17233 * @param {Array|Object|string} collection The collection to search.
17234 * @param {Function|Object|string} [predicate=_.identity] The function invoked
17235 * per iteration.
17236 * @param {*} [thisArg] The `this` binding of `predicate`.
17237 * @returns {*} Returns the matched element, else `undefined`.
17238 * @example
17239 *
17240 * var users = [
17241 * { 'user': 'barney', 'age': 36, 'active': true },
17242 * { 'user': 'fred', 'age': 40, 'active': false },
17243 * { 'user': 'pebbles', 'age': 1, 'active': true }
17244 * ];
17245 *
17246 * _.result(_.find(users, function(chr) {
17247 * return chr.age < 40;
17248 * }), 'user');
17249 * // => 'barney'
17250 *
17251 * // using the `_.matches` callback shorthand
17252 * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
17253 * // => 'pebbles'
17254 *
17255 * // using the `_.matchesProperty` callback shorthand
17256 * _.result(_.find(users, 'active', false), 'user');
17257 * // => 'fred'
17258 *
17259 * // using the `_.property` callback shorthand
17260 * _.result(_.find(users, 'active'), 'user');
17261 * // => 'barney'
17262 */
17263var find = createFind(baseEach);
17264
17265module.exports = find;
17266
Jian Li83d87a72016-04-20 15:38:24 -070017267},{"../internal/baseEach":75,"../internal/createFind":106}],58:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017268var arrayEach = require('../internal/arrayEach'),
17269 baseEach = require('../internal/baseEach'),
17270 createForEach = require('../internal/createForEach');
17271
17272/**
17273 * Iterates over elements of `collection` invoking `iteratee` for each element.
17274 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
17275 * (value, index|key, collection). Iteratee functions may exit iteration early
17276 * by explicitly returning `false`.
17277 *
17278 * **Note:** As with other "Collections" methods, objects with a "length" property
17279 * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
17280 * may be used for object iteration.
17281 *
17282 * @static
17283 * @memberOf _
17284 * @alias each
17285 * @category Collection
17286 * @param {Array|Object|string} collection The collection to iterate over.
17287 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17288 * @param {*} [thisArg] The `this` binding of `iteratee`.
17289 * @returns {Array|Object|string} Returns `collection`.
17290 * @example
17291 *
17292 * _([1, 2]).forEach(function(n) {
17293 * console.log(n);
17294 * }).value();
17295 * // => logs each value from left to right and returns the array
17296 *
17297 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
17298 * console.log(n, key);
17299 * });
17300 * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
17301 */
17302var forEach = createForEach(arrayEach, baseEach);
17303
17304module.exports = forEach;
17305
Jian Li83d87a72016-04-20 15:38:24 -070017306},{"../internal/arrayEach":67,"../internal/baseEach":75,"../internal/createForEach":107}],59:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017307var baseIndexOf = require('../internal/baseIndexOf'),
17308 getLength = require('../internal/getLength'),
17309 isArray = require('../lang/isArray'),
17310 isIterateeCall = require('../internal/isIterateeCall'),
17311 isLength = require('../internal/isLength'),
17312 isString = require('../lang/isString'),
17313 values = require('../object/values');
17314
17315/* Native method references for those with the same name as other `lodash` methods. */
17316var nativeMax = Math.max;
17317
17318/**
Jian Li83d87a72016-04-20 15:38:24 -070017319 * Checks if `target` is in `collection` using
17320 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
17321 * for equality comparisons. If `fromIndex` is negative, it's used as the offset
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017322 * from the end of `collection`.
17323 *
17324 * @static
17325 * @memberOf _
17326 * @alias contains, include
17327 * @category Collection
17328 * @param {Array|Object|string} collection The collection to search.
17329 * @param {*} target The value to search for.
17330 * @param {number} [fromIndex=0] The index to search from.
17331 * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
17332 * @returns {boolean} Returns `true` if a matching element is found, else `false`.
17333 * @example
17334 *
17335 * _.includes([1, 2, 3], 1);
17336 * // => true
17337 *
17338 * _.includes([1, 2, 3], 1, 2);
17339 * // => false
17340 *
17341 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
17342 * // => true
17343 *
17344 * _.includes('pebbles', 'eb');
17345 * // => true
17346 */
17347function includes(collection, target, fromIndex, guard) {
17348 var length = collection ? getLength(collection) : 0;
17349 if (!isLength(length)) {
17350 collection = values(collection);
17351 length = collection.length;
17352 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017353 if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
17354 fromIndex = 0;
17355 } else {
17356 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
17357 }
17358 return (typeof collection == 'string' || !isArray(collection) && isString(collection))
Jian Li83d87a72016-04-20 15:38:24 -070017359 ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
17360 : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017361}
17362
17363module.exports = includes;
17364
Jian Li83d87a72016-04-20 15:38:24 -070017365},{"../internal/baseIndexOf":82,"../internal/getLength":116,"../internal/isIterateeCall":126,"../internal/isLength":129,"../lang/isArray":144,"../lang/isString":150,"../object/values":156}],60:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017366var arrayMap = require('../internal/arrayMap'),
17367 baseCallback = require('../internal/baseCallback'),
17368 baseMap = require('../internal/baseMap'),
17369 isArray = require('../lang/isArray');
17370
17371/**
17372 * Creates an array of values by running each element in `collection` through
17373 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
17374 * arguments: (value, index|key, collection).
17375 *
17376 * If a property name is provided for `iteratee` the created `_.property`
17377 * style callback returns the property value of the given element.
17378 *
17379 * If a value is also provided for `thisArg` the created `_.matchesProperty`
17380 * style callback returns `true` for elements that have a matching property
17381 * value, else `false`.
17382 *
17383 * If an object is provided for `iteratee` the created `_.matches` style
17384 * callback returns `true` for elements that have the properties of the given
17385 * object, else `false`.
17386 *
17387 * Many lodash methods are guarded to work as iteratees for methods like
17388 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
17389 *
17390 * The guarded methods are:
17391 * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
17392 * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
17393 * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
17394 * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
17395 * `sum`, `uniq`, and `words`
17396 *
17397 * @static
17398 * @memberOf _
17399 * @alias collect
17400 * @category Collection
17401 * @param {Array|Object|string} collection The collection to iterate over.
17402 * @param {Function|Object|string} [iteratee=_.identity] The function invoked
17403 * per iteration.
17404 * @param {*} [thisArg] The `this` binding of `iteratee`.
17405 * @returns {Array} Returns the new mapped array.
17406 * @example
17407 *
17408 * function timesThree(n) {
17409 * return n * 3;
17410 * }
17411 *
17412 * _.map([1, 2], timesThree);
17413 * // => [3, 6]
17414 *
17415 * _.map({ 'a': 1, 'b': 2 }, timesThree);
17416 * // => [3, 6] (iteration order is not guaranteed)
17417 *
17418 * var users = [
17419 * { 'user': 'barney' },
17420 * { 'user': 'fred' }
17421 * ];
17422 *
17423 * // using the `_.property` callback shorthand
17424 * _.map(users, 'user');
17425 * // => ['barney', 'fred']
17426 */
17427function map(collection, iteratee, thisArg) {
17428 var func = isArray(collection) ? arrayMap : baseMap;
17429 iteratee = baseCallback(iteratee, thisArg, 3);
17430 return func(collection, iteratee);
17431}
17432
17433module.exports = map;
17434
Jian Li83d87a72016-04-20 15:38:24 -070017435},{"../internal/arrayMap":68,"../internal/baseCallback":71,"../internal/baseMap":87,"../lang/isArray":144}],61:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017436var getNative = require('../internal/getNative');
17437
17438/* Native method references for those with the same name as other `lodash` methods. */
17439var nativeNow = getNative(Date, 'now');
17440
17441/**
17442 * Gets the number of milliseconds that have elapsed since the Unix epoch
17443 * (1 January 1970 00:00:00 UTC).
17444 *
17445 * @static
17446 * @memberOf _
17447 * @category Date
17448 * @example
17449 *
17450 * _.defer(function(stamp) {
17451 * console.log(_.now() - stamp);
17452 * }, _.now());
17453 * // => logs the number of milliseconds it took for the deferred function to be invoked
17454 */
17455var now = nativeNow || function() {
17456 return new Date().getTime();
17457};
17458
17459module.exports = now;
17460
Jian Li83d87a72016-04-20 15:38:24 -070017461},{"../internal/getNative":118}],62:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017462var createWrapper = require('../internal/createWrapper'),
17463 replaceHolders = require('../internal/replaceHolders'),
17464 restParam = require('./restParam');
17465
17466/** Used to compose bitmasks for wrapper metadata. */
17467var BIND_FLAG = 1,
17468 PARTIAL_FLAG = 32;
17469
17470/**
17471 * Creates a function that invokes `func` with the `this` binding of `thisArg`
17472 * and prepends any additional `_.bind` arguments to those provided to the
17473 * bound function.
17474 *
17475 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
17476 * may be used as a placeholder for partially applied arguments.
17477 *
17478 * **Note:** Unlike native `Function#bind` this method does not set the "length"
17479 * property of bound functions.
17480 *
17481 * @static
17482 * @memberOf _
17483 * @category Function
17484 * @param {Function} func The function to bind.
17485 * @param {*} thisArg The `this` binding of `func`.
17486 * @param {...*} [partials] The arguments to be partially applied.
17487 * @returns {Function} Returns the new bound function.
17488 * @example
17489 *
17490 * var greet = function(greeting, punctuation) {
17491 * return greeting + ' ' + this.user + punctuation;
17492 * };
17493 *
17494 * var object = { 'user': 'fred' };
17495 *
17496 * var bound = _.bind(greet, object, 'hi');
17497 * bound('!');
17498 * // => 'hi fred!'
17499 *
17500 * // using placeholders
17501 * var bound = _.bind(greet, object, _, '!');
17502 * bound('hi');
17503 * // => 'hi fred!'
17504 */
17505var bind = restParam(function(func, thisArg, partials) {
17506 var bitmask = BIND_FLAG;
17507 if (partials.length) {
17508 var holders = replaceHolders(partials, bind.placeholder);
17509 bitmask |= PARTIAL_FLAG;
17510 }
17511 return createWrapper(func, bitmask, thisArg, partials, holders);
17512});
17513
17514// Assign default placeholders.
17515bind.placeholder = {};
17516
17517module.exports = bind;
17518
Jian Li83d87a72016-04-20 15:38:24 -070017519},{"../internal/createWrapper":110,"../internal/replaceHolders":136,"./restParam":63}],63:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017520/** Used as the `TypeError` message for "Functions" methods. */
17521var FUNC_ERROR_TEXT = 'Expected a function';
17522
17523/* Native method references for those with the same name as other `lodash` methods. */
17524var nativeMax = Math.max;
17525
17526/**
17527 * Creates a function that invokes `func` with the `this` binding of the
17528 * created function and arguments from `start` and beyond provided as an array.
17529 *
Jian Li83d87a72016-04-20 15:38:24 -070017530 * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017531 *
17532 * @static
17533 * @memberOf _
17534 * @category Function
17535 * @param {Function} func The function to apply a rest parameter to.
17536 * @param {number} [start=func.length-1] The start position of the rest parameter.
17537 * @returns {Function} Returns the new function.
17538 * @example
17539 *
17540 * var say = _.restParam(function(what, names) {
17541 * return what + ' ' + _.initial(names).join(', ') +
17542 * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
17543 * });
17544 *
17545 * say('hello', 'fred', 'barney', 'pebbles');
17546 * // => 'hello fred, barney, & pebbles'
17547 */
17548function restParam(func, start) {
17549 if (typeof func != 'function') {
17550 throw new TypeError(FUNC_ERROR_TEXT);
17551 }
17552 start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
17553 return function() {
17554 var args = arguments,
17555 index = -1,
17556 length = nativeMax(args.length - start, 0),
17557 rest = Array(length);
17558
17559 while (++index < length) {
17560 rest[index] = args[start + index];
17561 }
17562 switch (start) {
17563 case 0: return func.call(this, rest);
17564 case 1: return func.call(this, args[0], rest);
17565 case 2: return func.call(this, args[0], args[1], rest);
17566 }
17567 var otherArgs = Array(start + 1);
17568 index = -1;
17569 while (++index < start) {
17570 otherArgs[index] = args[index];
17571 }
17572 otherArgs[start] = rest;
17573 return func.apply(this, otherArgs);
17574 };
17575}
17576
17577module.exports = restParam;
17578
Jian Li83d87a72016-04-20 15:38:24 -070017579},{}],64:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017580var baseCreate = require('./baseCreate'),
17581 baseLodash = require('./baseLodash');
17582
17583/** Used as references for `-Infinity` and `Infinity`. */
17584var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
17585
17586/**
17587 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
17588 *
17589 * @private
17590 * @param {*} value The value to wrap.
17591 */
17592function LazyWrapper(value) {
17593 this.__wrapped__ = value;
Jian Li83d87a72016-04-20 15:38:24 -070017594 this.__actions__ = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017595 this.__dir__ = 1;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017596 this.__filtered__ = false;
Jian Li83d87a72016-04-20 15:38:24 -070017597 this.__iteratees__ = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017598 this.__takeCount__ = POSITIVE_INFINITY;
Jian Li83d87a72016-04-20 15:38:24 -070017599 this.__views__ = [];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017600}
17601
17602LazyWrapper.prototype = baseCreate(baseLodash.prototype);
17603LazyWrapper.prototype.constructor = LazyWrapper;
17604
17605module.exports = LazyWrapper;
17606
Jian Li83d87a72016-04-20 15:38:24 -070017607},{"./baseCreate":74,"./baseLodash":86}],65:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017608var baseCreate = require('./baseCreate'),
17609 baseLodash = require('./baseLodash');
17610
17611/**
17612 * The base constructor for creating `lodash` wrapper objects.
17613 *
17614 * @private
17615 * @param {*} value The value to wrap.
17616 * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
17617 * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
17618 */
17619function LodashWrapper(value, chainAll, actions) {
17620 this.__wrapped__ = value;
17621 this.__actions__ = actions || [];
17622 this.__chain__ = !!chainAll;
17623}
17624
17625LodashWrapper.prototype = baseCreate(baseLodash.prototype);
17626LodashWrapper.prototype.constructor = LodashWrapper;
17627
17628module.exports = LodashWrapper;
17629
Jian Li83d87a72016-04-20 15:38:24 -070017630},{"./baseCreate":74,"./baseLodash":86}],66:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017631/**
17632 * Copies the values of `source` to `array`.
17633 *
17634 * @private
17635 * @param {Array} source The array to copy values from.
17636 * @param {Array} [array=[]] The array to copy values to.
17637 * @returns {Array} Returns `array`.
17638 */
17639function arrayCopy(source, array) {
17640 var index = -1,
17641 length = source.length;
17642
17643 array || (array = Array(length));
17644 while (++index < length) {
17645 array[index] = source[index];
17646 }
17647 return array;
17648}
17649
17650module.exports = arrayCopy;
17651
Jian Li83d87a72016-04-20 15:38:24 -070017652},{}],67:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017653/**
17654 * A specialized version of `_.forEach` for arrays without support for callback
17655 * shorthands and `this` binding.
17656 *
17657 * @private
17658 * @param {Array} array The array to iterate over.
17659 * @param {Function} iteratee The function invoked per iteration.
17660 * @returns {Array} Returns `array`.
17661 */
17662function arrayEach(array, iteratee) {
17663 var index = -1,
17664 length = array.length;
17665
17666 while (++index < length) {
17667 if (iteratee(array[index], index, array) === false) {
17668 break;
17669 }
17670 }
17671 return array;
17672}
17673
17674module.exports = arrayEach;
17675
Jian Li83d87a72016-04-20 15:38:24 -070017676},{}],68:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017677/**
17678 * A specialized version of `_.map` for arrays without support for callback
17679 * shorthands and `this` binding.
17680 *
17681 * @private
17682 * @param {Array} array The array to iterate over.
17683 * @param {Function} iteratee The function invoked per iteration.
17684 * @returns {Array} Returns the new mapped array.
17685 */
17686function arrayMap(array, iteratee) {
17687 var index = -1,
17688 length = array.length,
17689 result = Array(length);
17690
17691 while (++index < length) {
17692 result[index] = iteratee(array[index], index, array);
17693 }
17694 return result;
17695}
17696
17697module.exports = arrayMap;
17698
Jian Li83d87a72016-04-20 15:38:24 -070017699},{}],69:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017700/**
17701 * A specialized version of `_.some` for arrays without support for callback
17702 * shorthands and `this` binding.
17703 *
17704 * @private
17705 * @param {Array} array The array to iterate over.
17706 * @param {Function} predicate The function invoked per iteration.
17707 * @returns {boolean} Returns `true` if any element passes the predicate check,
17708 * else `false`.
17709 */
17710function arraySome(array, predicate) {
17711 var index = -1,
17712 length = array.length;
17713
17714 while (++index < length) {
17715 if (predicate(array[index], index, array)) {
17716 return true;
17717 }
17718 }
17719 return false;
17720}
17721
17722module.exports = arraySome;
17723
Jian Li83d87a72016-04-20 15:38:24 -070017724},{}],70:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017725var baseCopy = require('./baseCopy'),
17726 keys = require('../object/keys');
17727
17728/**
17729 * The base implementation of `_.assign` without support for argument juggling,
17730 * multiple sources, and `customizer` functions.
17731 *
17732 * @private
17733 * @param {Object} object The destination object.
17734 * @param {Object} source The source object.
17735 * @returns {Object} Returns `object`.
17736 */
17737function baseAssign(object, source) {
17738 return source == null
17739 ? object
17740 : baseCopy(source, keys(source), object);
17741}
17742
17743module.exports = baseAssign;
17744
Jian Li83d87a72016-04-20 15:38:24 -070017745},{"../object/keys":153,"./baseCopy":73}],71:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017746var baseMatches = require('./baseMatches'),
17747 baseMatchesProperty = require('./baseMatchesProperty'),
17748 bindCallback = require('./bindCallback'),
17749 identity = require('../utility/identity'),
17750 property = require('../utility/property');
17751
17752/**
17753 * The base implementation of `_.callback` which supports specifying the
17754 * number of arguments to provide to `func`.
17755 *
17756 * @private
17757 * @param {*} [func=_.identity] The value to convert to a callback.
17758 * @param {*} [thisArg] The `this` binding of `func`.
17759 * @param {number} [argCount] The number of arguments to provide to `func`.
17760 * @returns {Function} Returns the callback.
17761 */
17762function baseCallback(func, thisArg, argCount) {
17763 var type = typeof func;
17764 if (type == 'function') {
17765 return thisArg === undefined
17766 ? func
17767 : bindCallback(func, thisArg, argCount);
17768 }
17769 if (func == null) {
17770 return identity;
17771 }
17772 if (type == 'object') {
17773 return baseMatches(func);
17774 }
17775 return thisArg === undefined
17776 ? property(func)
17777 : baseMatchesProperty(func, thisArg);
17778}
17779
17780module.exports = baseCallback;
17781
Jian Li83d87a72016-04-20 15:38:24 -070017782},{"../utility/identity":158,"../utility/property":160,"./baseMatches":88,"./baseMatchesProperty":89,"./bindCallback":98}],72:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017783var arrayCopy = require('./arrayCopy'),
17784 arrayEach = require('./arrayEach'),
17785 baseAssign = require('./baseAssign'),
17786 baseForOwn = require('./baseForOwn'),
17787 initCloneArray = require('./initCloneArray'),
17788 initCloneByTag = require('./initCloneByTag'),
17789 initCloneObject = require('./initCloneObject'),
17790 isArray = require('../lang/isArray'),
17791 isHostObject = require('./isHostObject'),
17792 isObject = require('../lang/isObject');
17793
17794/** `Object#toString` result references. */
17795var argsTag = '[object Arguments]',
17796 arrayTag = '[object Array]',
17797 boolTag = '[object Boolean]',
17798 dateTag = '[object Date]',
17799 errorTag = '[object Error]',
17800 funcTag = '[object Function]',
17801 mapTag = '[object Map]',
17802 numberTag = '[object Number]',
17803 objectTag = '[object Object]',
17804 regexpTag = '[object RegExp]',
17805 setTag = '[object Set]',
17806 stringTag = '[object String]',
17807 weakMapTag = '[object WeakMap]';
17808
17809var arrayBufferTag = '[object ArrayBuffer]',
17810 float32Tag = '[object Float32Array]',
17811 float64Tag = '[object Float64Array]',
17812 int8Tag = '[object Int8Array]',
17813 int16Tag = '[object Int16Array]',
17814 int32Tag = '[object Int32Array]',
17815 uint8Tag = '[object Uint8Array]',
17816 uint8ClampedTag = '[object Uint8ClampedArray]',
17817 uint16Tag = '[object Uint16Array]',
17818 uint32Tag = '[object Uint32Array]';
17819
17820/** Used to identify `toStringTag` values supported by `_.clone`. */
17821var cloneableTags = {};
17822cloneableTags[argsTag] = cloneableTags[arrayTag] =
17823cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
17824cloneableTags[dateTag] = cloneableTags[float32Tag] =
17825cloneableTags[float64Tag] = cloneableTags[int8Tag] =
17826cloneableTags[int16Tag] = cloneableTags[int32Tag] =
17827cloneableTags[numberTag] = cloneableTags[objectTag] =
17828cloneableTags[regexpTag] = cloneableTags[stringTag] =
17829cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
17830cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
17831cloneableTags[errorTag] = cloneableTags[funcTag] =
17832cloneableTags[mapTag] = cloneableTags[setTag] =
17833cloneableTags[weakMapTag] = false;
17834
17835/** Used for native method references. */
17836var objectProto = Object.prototype;
17837
17838/**
Jian Li83d87a72016-04-20 15:38:24 -070017839 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017840 * of values.
17841 */
17842var objToString = objectProto.toString;
17843
17844/**
17845 * The base implementation of `_.clone` without support for argument juggling
17846 * and `this` binding `customizer` functions.
17847 *
17848 * @private
17849 * @param {*} value The value to clone.
17850 * @param {boolean} [isDeep] Specify a deep clone.
17851 * @param {Function} [customizer] The function to customize cloning values.
17852 * @param {string} [key] The key of `value`.
17853 * @param {Object} [object] The object `value` belongs to.
17854 * @param {Array} [stackA=[]] Tracks traversed source objects.
17855 * @param {Array} [stackB=[]] Associates clones with source counterparts.
17856 * @returns {*} Returns the cloned value.
17857 */
17858function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
17859 var result;
17860 if (customizer) {
17861 result = object ? customizer(value, key, object) : customizer(value);
17862 }
17863 if (result !== undefined) {
17864 return result;
17865 }
17866 if (!isObject(value)) {
17867 return value;
17868 }
17869 var isArr = isArray(value);
17870 if (isArr) {
17871 result = initCloneArray(value);
17872 if (!isDeep) {
17873 return arrayCopy(value, result);
17874 }
17875 } else {
17876 var tag = objToString.call(value),
17877 isFunc = tag == funcTag;
17878
17879 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
17880 if (isHostObject(value)) {
17881 return object ? value : {};
17882 }
17883 result = initCloneObject(isFunc ? {} : value);
17884 if (!isDeep) {
17885 return baseAssign(result, value);
17886 }
17887 } else {
17888 return cloneableTags[tag]
17889 ? initCloneByTag(value, tag, isDeep)
17890 : (object ? value : {});
17891 }
17892 }
Jian Li83d87a72016-04-20 15:38:24 -070017893 // Check for circular references and return its corresponding clone.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017894 stackA || (stackA = []);
17895 stackB || (stackB = []);
17896
17897 var length = stackA.length;
17898 while (length--) {
17899 if (stackA[length] == value) {
17900 return stackB[length];
17901 }
17902 }
17903 // Add the source value to the stack of traversed objects and associate it with its clone.
17904 stackA.push(value);
17905 stackB.push(result);
17906
17907 // Recursively populate clone (susceptible to call stack limits).
17908 (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
17909 result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
17910 });
17911 return result;
17912}
17913
17914module.exports = baseClone;
17915
Jian Li83d87a72016-04-20 15:38:24 -070017916},{"../lang/isArray":144,"../lang/isObject":148,"./arrayCopy":66,"./arrayEach":67,"./baseAssign":70,"./baseForOwn":80,"./initCloneArray":120,"./initCloneByTag":121,"./initCloneObject":122,"./isHostObject":124}],73:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017917/**
17918 * Copies properties of `source` to `object`.
17919 *
17920 * @private
17921 * @param {Object} source The object to copy properties from.
17922 * @param {Array} props The property names to copy.
17923 * @param {Object} [object={}] The object to copy properties to.
17924 * @returns {Object} Returns `object`.
17925 */
17926function baseCopy(source, props, object) {
17927 object || (object = {});
17928
17929 var index = -1,
17930 length = props.length;
17931
17932 while (++index < length) {
17933 var key = props[index];
17934 object[key] = source[key];
17935 }
17936 return object;
17937}
17938
17939module.exports = baseCopy;
17940
Jian Li83d87a72016-04-20 15:38:24 -070017941},{}],74:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017942var isObject = require('../lang/isObject');
17943
17944/**
17945 * The base implementation of `_.create` without support for assigning
17946 * properties to the created object.
17947 *
17948 * @private
17949 * @param {Object} prototype The object to inherit from.
17950 * @returns {Object} Returns the new object.
17951 */
17952var baseCreate = (function() {
17953 function object() {}
17954 return function(prototype) {
17955 if (isObject(prototype)) {
17956 object.prototype = prototype;
17957 var result = new object;
Jian Li83d87a72016-04-20 15:38:24 -070017958 object.prototype = undefined;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017959 }
17960 return result || {};
17961 };
17962}());
17963
17964module.exports = baseCreate;
17965
Jian Li83d87a72016-04-20 15:38:24 -070017966},{"../lang/isObject":148}],75:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017967var baseForOwn = require('./baseForOwn'),
17968 createBaseEach = require('./createBaseEach');
17969
17970/**
17971 * The base implementation of `_.forEach` without support for callback
17972 * shorthands and `this` binding.
17973 *
17974 * @private
17975 * @param {Array|Object|string} collection The collection to iterate over.
17976 * @param {Function} iteratee The function invoked per iteration.
17977 * @returns {Array|Object|string} Returns `collection`.
17978 */
17979var baseEach = createBaseEach(baseForOwn);
17980
17981module.exports = baseEach;
17982
Jian Li83d87a72016-04-20 15:38:24 -070017983},{"./baseForOwn":80,"./createBaseEach":102}],76:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070017984/**
17985 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
17986 * without support for callback shorthands and `this` binding, which iterates
17987 * over `collection` using the provided `eachFunc`.
17988 *
17989 * @private
17990 * @param {Array|Object|string} collection The collection to search.
17991 * @param {Function} predicate The function invoked per iteration.
17992 * @param {Function} eachFunc The function to iterate over `collection`.
17993 * @param {boolean} [retKey] Specify returning the key of the found element
17994 * instead of the element itself.
17995 * @returns {*} Returns the found element or its key, else `undefined`.
17996 */
17997function baseFind(collection, predicate, eachFunc, retKey) {
17998 var result;
17999 eachFunc(collection, function(value, key, collection) {
18000 if (predicate(value, key, collection)) {
18001 result = retKey ? key : value;
18002 return false;
18003 }
18004 });
18005 return result;
18006}
18007
18008module.exports = baseFind;
18009
Jian Li83d87a72016-04-20 15:38:24 -070018010},{}],77:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018011/**
18012 * The base implementation of `_.findIndex` and `_.findLastIndex` without
18013 * support for callback shorthands and `this` binding.
18014 *
18015 * @private
18016 * @param {Array} array The array to search.
18017 * @param {Function} predicate The function invoked per iteration.
18018 * @param {boolean} [fromRight] Specify iterating from right to left.
18019 * @returns {number} Returns the index of the matched value, else `-1`.
18020 */
18021function baseFindIndex(array, predicate, fromRight) {
18022 var length = array.length,
18023 index = fromRight ? length : -1;
18024
18025 while ((fromRight ? index-- : ++index < length)) {
18026 if (predicate(array[index], index, array)) {
18027 return index;
18028 }
18029 }
18030 return -1;
18031}
18032
18033module.exports = baseFindIndex;
18034
Jian Li83d87a72016-04-20 15:38:24 -070018035},{}],78:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018036var createBaseFor = require('./createBaseFor');
18037
18038/**
18039 * The base implementation of `baseForIn` and `baseForOwn` which iterates
18040 * over `object` properties returned by `keysFunc` invoking `iteratee` for
18041 * each property. Iteratee functions may exit iteration early by explicitly
18042 * returning `false`.
18043 *
18044 * @private
18045 * @param {Object} object The object to iterate over.
18046 * @param {Function} iteratee The function invoked per iteration.
18047 * @param {Function} keysFunc The function to get the keys of `object`.
18048 * @returns {Object} Returns `object`.
18049 */
18050var baseFor = createBaseFor();
18051
18052module.exports = baseFor;
18053
Jian Li83d87a72016-04-20 15:38:24 -070018054},{"./createBaseFor":103}],79:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018055var baseFor = require('./baseFor'),
18056 keysIn = require('../object/keysIn');
18057
18058/**
18059 * The base implementation of `_.forIn` without support for callback
18060 * shorthands and `this` binding.
18061 *
18062 * @private
18063 * @param {Object} object The object to iterate over.
18064 * @param {Function} iteratee The function invoked per iteration.
18065 * @returns {Object} Returns `object`.
18066 */
18067function baseForIn(object, iteratee) {
18068 return baseFor(object, iteratee, keysIn);
18069}
18070
18071module.exports = baseForIn;
18072
Jian Li83d87a72016-04-20 15:38:24 -070018073},{"../object/keysIn":154,"./baseFor":78}],80:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018074var baseFor = require('./baseFor'),
18075 keys = require('../object/keys');
18076
18077/**
18078 * The base implementation of `_.forOwn` without support for callback
18079 * shorthands and `this` binding.
18080 *
18081 * @private
18082 * @param {Object} object The object to iterate over.
18083 * @param {Function} iteratee The function invoked per iteration.
18084 * @returns {Object} Returns `object`.
18085 */
18086function baseForOwn(object, iteratee) {
18087 return baseFor(object, iteratee, keys);
18088}
18089
18090module.exports = baseForOwn;
18091
Jian Li83d87a72016-04-20 15:38:24 -070018092},{"../object/keys":153,"./baseFor":78}],81:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018093var toObject = require('./toObject');
18094
18095/**
18096 * The base implementation of `get` without support for string paths
18097 * and default values.
18098 *
18099 * @private
18100 * @param {Object} object The object to query.
18101 * @param {Array} path The path of the property to get.
18102 * @param {string} [pathKey] The key representation of path.
18103 * @returns {*} Returns the resolved value.
18104 */
18105function baseGet(object, path, pathKey) {
18106 if (object == null) {
18107 return;
18108 }
18109 object = toObject(object);
18110 if (pathKey !== undefined && pathKey in object) {
18111 path = [pathKey];
18112 }
18113 var index = 0,
18114 length = path.length;
18115
18116 while (object != null && index < length) {
18117 object = toObject(object)[path[index++]];
18118 }
18119 return (index && index == length) ? object : undefined;
18120}
18121
18122module.exports = baseGet;
18123
Jian Li83d87a72016-04-20 15:38:24 -070018124},{"./toObject":139}],82:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018125var indexOfNaN = require('./indexOfNaN');
18126
18127/**
18128 * The base implementation of `_.indexOf` without support for binary searches.
18129 *
18130 * @private
18131 * @param {Array} array The array to search.
18132 * @param {*} value The value to search for.
18133 * @param {number} fromIndex The index to search from.
18134 * @returns {number} Returns the index of the matched value, else `-1`.
18135 */
18136function baseIndexOf(array, value, fromIndex) {
18137 if (value !== value) {
18138 return indexOfNaN(array, fromIndex);
18139 }
18140 var index = fromIndex - 1,
18141 length = array.length;
18142
18143 while (++index < length) {
18144 if (array[index] === value) {
18145 return index;
18146 }
18147 }
18148 return -1;
18149}
18150
18151module.exports = baseIndexOf;
18152
Jian Li83d87a72016-04-20 15:38:24 -070018153},{"./indexOfNaN":119}],83:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018154var baseIsEqualDeep = require('./baseIsEqualDeep'),
18155 isObject = require('../lang/isObject'),
18156 isObjectLike = require('./isObjectLike');
18157
18158/**
18159 * The base implementation of `_.isEqual` without support for `this` binding
18160 * `customizer` functions.
18161 *
18162 * @private
18163 * @param {*} value The value to compare.
18164 * @param {*} other The other value to compare.
18165 * @param {Function} [customizer] The function to customize comparing values.
18166 * @param {boolean} [isLoose] Specify performing partial comparisons.
18167 * @param {Array} [stackA] Tracks traversed `value` objects.
18168 * @param {Array} [stackB] Tracks traversed `other` objects.
18169 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
18170 */
18171function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
18172 if (value === other) {
18173 return true;
18174 }
18175 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
18176 return value !== value && other !== other;
18177 }
18178 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
18179}
18180
18181module.exports = baseIsEqual;
18182
Jian Li83d87a72016-04-20 15:38:24 -070018183},{"../lang/isObject":148,"./baseIsEqualDeep":84,"./isObjectLike":130}],84:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018184var equalArrays = require('./equalArrays'),
18185 equalByTag = require('./equalByTag'),
18186 equalObjects = require('./equalObjects'),
18187 isArray = require('../lang/isArray'),
18188 isHostObject = require('./isHostObject'),
18189 isTypedArray = require('../lang/isTypedArray');
18190
18191/** `Object#toString` result references. */
18192var argsTag = '[object Arguments]',
18193 arrayTag = '[object Array]',
18194 objectTag = '[object Object]';
18195
18196/** Used for native method references. */
18197var objectProto = Object.prototype;
18198
18199/** Used to check objects for own properties. */
18200var hasOwnProperty = objectProto.hasOwnProperty;
18201
18202/**
Jian Li83d87a72016-04-20 15:38:24 -070018203 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018204 * of values.
18205 */
18206var objToString = objectProto.toString;
18207
18208/**
18209 * A specialized version of `baseIsEqual` for arrays and objects which performs
18210 * deep comparisons and tracks traversed objects enabling objects with circular
18211 * references to be compared.
18212 *
18213 * @private
18214 * @param {Object} object The object to compare.
18215 * @param {Object} other The other object to compare.
18216 * @param {Function} equalFunc The function to determine equivalents of values.
18217 * @param {Function} [customizer] The function to customize comparing objects.
18218 * @param {boolean} [isLoose] Specify performing partial comparisons.
18219 * @param {Array} [stackA=[]] Tracks traversed `value` objects.
18220 * @param {Array} [stackB=[]] Tracks traversed `other` objects.
18221 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
18222 */
18223function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
18224 var objIsArr = isArray(object),
18225 othIsArr = isArray(other),
18226 objTag = arrayTag,
18227 othTag = arrayTag;
18228
18229 if (!objIsArr) {
18230 objTag = objToString.call(object);
18231 if (objTag == argsTag) {
18232 objTag = objectTag;
18233 } else if (objTag != objectTag) {
18234 objIsArr = isTypedArray(object);
18235 }
18236 }
18237 if (!othIsArr) {
18238 othTag = objToString.call(other);
18239 if (othTag == argsTag) {
18240 othTag = objectTag;
18241 } else if (othTag != objectTag) {
18242 othIsArr = isTypedArray(other);
18243 }
18244 }
18245 var objIsObj = objTag == objectTag && !isHostObject(object),
18246 othIsObj = othTag == objectTag && !isHostObject(other),
18247 isSameTag = objTag == othTag;
18248
18249 if (isSameTag && !(objIsArr || objIsObj)) {
18250 return equalByTag(object, other, objTag);
18251 }
18252 if (!isLoose) {
18253 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
18254 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
18255
18256 if (objIsWrapped || othIsWrapped) {
18257 return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
18258 }
18259 }
18260 if (!isSameTag) {
18261 return false;
18262 }
18263 // Assume cyclic values are equal.
18264 // For more information on detecting circular references see https://es5.github.io/#JO.
18265 stackA || (stackA = []);
18266 stackB || (stackB = []);
18267
18268 var length = stackA.length;
18269 while (length--) {
18270 if (stackA[length] == object) {
18271 return stackB[length] == other;
18272 }
18273 }
18274 // Add `object` and `other` to the stack of traversed objects.
18275 stackA.push(object);
18276 stackB.push(other);
18277
18278 var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
18279
18280 stackA.pop();
18281 stackB.pop();
18282
18283 return result;
18284}
18285
18286module.exports = baseIsEqualDeep;
18287
Jian Li83d87a72016-04-20 15:38:24 -070018288},{"../lang/isArray":144,"../lang/isTypedArray":151,"./equalArrays":111,"./equalByTag":112,"./equalObjects":113,"./isHostObject":124}],85:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018289var baseIsEqual = require('./baseIsEqual'),
18290 toObject = require('./toObject');
18291
18292/**
18293 * The base implementation of `_.isMatch` without support for callback
18294 * shorthands and `this` binding.
18295 *
18296 * @private
18297 * @param {Object} object The object to inspect.
18298 * @param {Array} matchData The propery names, values, and compare flags to match.
18299 * @param {Function} [customizer] The function to customize comparing objects.
18300 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
18301 */
18302function baseIsMatch(object, matchData, customizer) {
18303 var index = matchData.length,
18304 length = index,
18305 noCustomizer = !customizer;
18306
18307 if (object == null) {
18308 return !length;
18309 }
18310 object = toObject(object);
18311 while (index--) {
18312 var data = matchData[index];
18313 if ((noCustomizer && data[2])
18314 ? data[1] !== object[data[0]]
18315 : !(data[0] in object)
18316 ) {
18317 return false;
18318 }
18319 }
18320 while (++index < length) {
18321 data = matchData[index];
18322 var key = data[0],
18323 objValue = object[key],
18324 srcValue = data[1];
18325
18326 if (noCustomizer && data[2]) {
18327 if (objValue === undefined && !(key in object)) {
18328 return false;
18329 }
18330 } else {
18331 var result = customizer ? customizer(objValue, srcValue, key) : undefined;
18332 if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
18333 return false;
18334 }
18335 }
18336 }
18337 return true;
18338}
18339
18340module.exports = baseIsMatch;
18341
Jian Li83d87a72016-04-20 15:38:24 -070018342},{"./baseIsEqual":83,"./toObject":139}],86:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018343/**
18344 * The function whose prototype all chaining wrappers inherit from.
18345 *
18346 * @private
18347 */
18348function baseLodash() {
18349 // No operation performed.
18350}
18351
18352module.exports = baseLodash;
18353
Jian Li83d87a72016-04-20 15:38:24 -070018354},{}],87:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018355var baseEach = require('./baseEach'),
18356 isArrayLike = require('./isArrayLike');
18357
18358/**
18359 * The base implementation of `_.map` without support for callback shorthands
18360 * and `this` binding.
18361 *
18362 * @private
18363 * @param {Array|Object|string} collection The collection to iterate over.
18364 * @param {Function} iteratee The function invoked per iteration.
18365 * @returns {Array} Returns the new mapped array.
18366 */
18367function baseMap(collection, iteratee) {
18368 var index = -1,
18369 result = isArrayLike(collection) ? Array(collection.length) : [];
18370
18371 baseEach(collection, function(value, key, collection) {
18372 result[++index] = iteratee(value, key, collection);
18373 });
18374 return result;
18375}
18376
18377module.exports = baseMap;
18378
Jian Li83d87a72016-04-20 15:38:24 -070018379},{"./baseEach":75,"./isArrayLike":123}],88:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018380var baseIsMatch = require('./baseIsMatch'),
18381 getMatchData = require('./getMatchData'),
18382 toObject = require('./toObject');
18383
18384/**
18385 * The base implementation of `_.matches` which does not clone `source`.
18386 *
18387 * @private
18388 * @param {Object} source The object of property values to match.
18389 * @returns {Function} Returns the new function.
18390 */
18391function baseMatches(source) {
18392 var matchData = getMatchData(source);
18393 if (matchData.length == 1 && matchData[0][2]) {
18394 var key = matchData[0][0],
18395 value = matchData[0][1];
18396
18397 return function(object) {
18398 if (object == null) {
18399 return false;
18400 }
18401 object = toObject(object);
18402 return object[key] === value && (value !== undefined || (key in object));
18403 };
18404 }
18405 return function(object) {
18406 return baseIsMatch(object, matchData);
18407 };
18408}
18409
18410module.exports = baseMatches;
18411
Jian Li83d87a72016-04-20 15:38:24 -070018412},{"./baseIsMatch":85,"./getMatchData":117,"./toObject":139}],89:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018413var baseGet = require('./baseGet'),
18414 baseIsEqual = require('./baseIsEqual'),
18415 baseSlice = require('./baseSlice'),
18416 isArray = require('../lang/isArray'),
18417 isKey = require('./isKey'),
18418 isStrictComparable = require('./isStrictComparable'),
18419 last = require('../array/last'),
18420 toObject = require('./toObject'),
18421 toPath = require('./toPath');
18422
18423/**
18424 * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
18425 *
18426 * @private
18427 * @param {string} path The path of the property to get.
18428 * @param {*} srcValue The value to compare.
18429 * @returns {Function} Returns the new function.
18430 */
18431function baseMatchesProperty(path, srcValue) {
18432 var isArr = isArray(path),
18433 isCommon = isKey(path) && isStrictComparable(srcValue),
18434 pathKey = (path + '');
18435
18436 path = toPath(path);
18437 return function(object) {
18438 if (object == null) {
18439 return false;
18440 }
18441 var key = pathKey;
18442 object = toObject(object);
18443 if ((isArr || !isCommon) && !(key in object)) {
18444 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
18445 if (object == null) {
18446 return false;
18447 }
18448 key = last(path);
18449 object = toObject(object);
18450 }
18451 return object[key] === srcValue
18452 ? (srcValue !== undefined || (key in object))
18453 : baseIsEqual(srcValue, object[key], undefined, true);
18454 };
18455}
18456
18457module.exports = baseMatchesProperty;
18458
Jian Li83d87a72016-04-20 15:38:24 -070018459},{"../array/last":54,"../lang/isArray":144,"./baseGet":81,"./baseIsEqual":83,"./baseSlice":93,"./isKey":127,"./isStrictComparable":131,"./toObject":139,"./toPath":140}],90:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018460var toObject = require('./toObject');
18461
18462/**
18463 * The base implementation of `_.property` without support for deep paths.
18464 *
18465 * @private
18466 * @param {string} key The key of the property to get.
18467 * @returns {Function} Returns the new function.
18468 */
18469function baseProperty(key) {
18470 return function(object) {
18471 return object == null ? undefined : toObject(object)[key];
18472 };
18473}
18474
18475module.exports = baseProperty;
18476
Jian Li83d87a72016-04-20 15:38:24 -070018477},{"./toObject":139}],91:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018478var baseGet = require('./baseGet'),
18479 toPath = require('./toPath');
18480
18481/**
18482 * A specialized version of `baseProperty` which supports deep paths.
18483 *
18484 * @private
18485 * @param {Array|string} path The path of the property to get.
18486 * @returns {Function} Returns the new function.
18487 */
18488function basePropertyDeep(path) {
18489 var pathKey = (path + '');
18490 path = toPath(path);
18491 return function(object) {
18492 return baseGet(object, path, pathKey);
18493 };
18494}
18495
18496module.exports = basePropertyDeep;
18497
Jian Li83d87a72016-04-20 15:38:24 -070018498},{"./baseGet":81,"./toPath":140}],92:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018499var identity = require('../utility/identity'),
18500 metaMap = require('./metaMap');
18501
18502/**
18503 * The base implementation of `setData` without support for hot loop detection.
18504 *
18505 * @private
18506 * @param {Function} func The function to associate metadata with.
18507 * @param {*} data The metadata.
18508 * @returns {Function} Returns `func`.
18509 */
18510var baseSetData = !metaMap ? identity : function(func, data) {
18511 metaMap.set(func, data);
18512 return func;
18513};
18514
18515module.exports = baseSetData;
18516
Jian Li83d87a72016-04-20 15:38:24 -070018517},{"../utility/identity":158,"./metaMap":133}],93:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018518/**
18519 * The base implementation of `_.slice` without an iteratee call guard.
18520 *
18521 * @private
18522 * @param {Array} array The array to slice.
18523 * @param {number} [start=0] The start position.
18524 * @param {number} [end=array.length] The end position.
18525 * @returns {Array} Returns the slice of `array`.
18526 */
18527function baseSlice(array, start, end) {
18528 var index = -1,
18529 length = array.length;
18530
18531 start = start == null ? 0 : (+start || 0);
18532 if (start < 0) {
18533 start = -start > length ? 0 : (length + start);
18534 }
18535 end = (end === undefined || end > length) ? length : (+end || 0);
18536 if (end < 0) {
18537 end += length;
18538 }
18539 length = start > end ? 0 : ((end - start) >>> 0);
18540 start >>>= 0;
18541
18542 var result = Array(length);
18543 while (++index < length) {
18544 result[index] = array[index + start];
18545 }
18546 return result;
18547}
18548
18549module.exports = baseSlice;
18550
Jian Li83d87a72016-04-20 15:38:24 -070018551},{}],94:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018552/**
18553 * Converts `value` to a string if it's not one. An empty string is returned
18554 * for `null` or `undefined` values.
18555 *
18556 * @private
18557 * @param {*} value The value to process.
18558 * @returns {string} Returns the string.
18559 */
18560function baseToString(value) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018561 return value == null ? '' : (value + '');
18562}
18563
18564module.exports = baseToString;
18565
Jian Li83d87a72016-04-20 15:38:24 -070018566},{}],95:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018567/**
18568 * The base implementation of `_.values` and `_.valuesIn` which creates an
18569 * array of `object` property values corresponding to the property names
18570 * of `props`.
18571 *
18572 * @private
18573 * @param {Object} object The object to query.
18574 * @param {Array} props The property names to get values for.
18575 * @returns {Object} Returns the array of property values.
18576 */
18577function baseValues(object, props) {
18578 var index = -1,
18579 length = props.length,
18580 result = Array(length);
18581
18582 while (++index < length) {
18583 result[index] = object[props[index]];
18584 }
18585 return result;
18586}
18587
18588module.exports = baseValues;
18589
Jian Li83d87a72016-04-20 15:38:24 -070018590},{}],96:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018591var binaryIndexBy = require('./binaryIndexBy'),
18592 identity = require('../utility/identity');
18593
18594/** Used as references for the maximum length and index of an array. */
18595var MAX_ARRAY_LENGTH = 4294967295,
18596 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
18597
18598/**
18599 * Performs a binary search of `array` to determine the index at which `value`
18600 * should be inserted into `array` in order to maintain its sort order.
18601 *
18602 * @private
18603 * @param {Array} array The sorted array to inspect.
18604 * @param {*} value The value to evaluate.
18605 * @param {boolean} [retHighest] Specify returning the highest qualified index.
18606 * @returns {number} Returns the index at which `value` should be inserted
18607 * into `array`.
18608 */
18609function binaryIndex(array, value, retHighest) {
18610 var low = 0,
18611 high = array ? array.length : low;
18612
18613 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
18614 while (low < high) {
18615 var mid = (low + high) >>> 1,
18616 computed = array[mid];
18617
18618 if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
18619 low = mid + 1;
18620 } else {
18621 high = mid;
18622 }
18623 }
18624 return high;
18625 }
18626 return binaryIndexBy(array, value, identity, retHighest);
18627}
18628
18629module.exports = binaryIndex;
18630
Jian Li83d87a72016-04-20 15:38:24 -070018631},{"../utility/identity":158,"./binaryIndexBy":97}],97:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018632/* Native method references for those with the same name as other `lodash` methods. */
Jian Li83d87a72016-04-20 15:38:24 -070018633var nativeFloor = Math.floor,
18634 nativeMin = Math.min;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018635
18636/** Used as references for the maximum length and index of an array. */
18637var MAX_ARRAY_LENGTH = 4294967295,
18638 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
18639
18640/**
18641 * This function is like `binaryIndex` except that it invokes `iteratee` for
18642 * `value` and each element of `array` to compute their sort ranking. The
18643 * iteratee is invoked with one argument; (value).
18644 *
18645 * @private
18646 * @param {Array} array The sorted array to inspect.
18647 * @param {*} value The value to evaluate.
18648 * @param {Function} iteratee The function invoked per iteration.
18649 * @param {boolean} [retHighest] Specify returning the highest qualified index.
18650 * @returns {number} Returns the index at which `value` should be inserted
18651 * into `array`.
18652 */
18653function binaryIndexBy(array, value, iteratee, retHighest) {
18654 value = iteratee(value);
18655
18656 var low = 0,
18657 high = array ? array.length : 0,
18658 valIsNaN = value !== value,
18659 valIsNull = value === null,
18660 valIsUndef = value === undefined;
18661
18662 while (low < high) {
Jian Li83d87a72016-04-20 15:38:24 -070018663 var mid = nativeFloor((low + high) / 2),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018664 computed = iteratee(array[mid]),
18665 isDef = computed !== undefined,
18666 isReflexive = computed === computed;
18667
18668 if (valIsNaN) {
18669 var setLow = isReflexive || retHighest;
18670 } else if (valIsNull) {
18671 setLow = isReflexive && isDef && (retHighest || computed != null);
18672 } else if (valIsUndef) {
18673 setLow = isReflexive && (retHighest || isDef);
18674 } else if (computed == null) {
18675 setLow = false;
18676 } else {
18677 setLow = retHighest ? (computed <= value) : (computed < value);
18678 }
18679 if (setLow) {
18680 low = mid + 1;
18681 } else {
18682 high = mid;
18683 }
18684 }
18685 return nativeMin(high, MAX_ARRAY_INDEX);
18686}
18687
18688module.exports = binaryIndexBy;
18689
Jian Li83d87a72016-04-20 15:38:24 -070018690},{}],98:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018691var identity = require('../utility/identity');
18692
18693/**
18694 * A specialized version of `baseCallback` which only supports `this` binding
18695 * and specifying the number of arguments to provide to `func`.
18696 *
18697 * @private
18698 * @param {Function} func The function to bind.
18699 * @param {*} thisArg The `this` binding of `func`.
18700 * @param {number} [argCount] The number of arguments to provide to `func`.
18701 * @returns {Function} Returns the callback.
18702 */
18703function bindCallback(func, thisArg, argCount) {
18704 if (typeof func != 'function') {
18705 return identity;
18706 }
18707 if (thisArg === undefined) {
18708 return func;
18709 }
18710 switch (argCount) {
18711 case 1: return function(value) {
18712 return func.call(thisArg, value);
18713 };
18714 case 3: return function(value, index, collection) {
18715 return func.call(thisArg, value, index, collection);
18716 };
18717 case 4: return function(accumulator, value, index, collection) {
18718 return func.call(thisArg, accumulator, value, index, collection);
18719 };
18720 case 5: return function(value, other, key, object, source) {
18721 return func.call(thisArg, value, other, key, object, source);
18722 };
18723 }
18724 return function() {
18725 return func.apply(thisArg, arguments);
18726 };
18727}
18728
18729module.exports = bindCallback;
18730
Jian Li83d87a72016-04-20 15:38:24 -070018731},{"../utility/identity":158}],99:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018732(function (global){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018733/** Native method references. */
Jian Li83d87a72016-04-20 15:38:24 -070018734var ArrayBuffer = global.ArrayBuffer,
18735 Uint8Array = global.Uint8Array;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018736
18737/**
18738 * Creates a clone of the given array buffer.
18739 *
18740 * @private
18741 * @param {ArrayBuffer} buffer The array buffer to clone.
18742 * @returns {ArrayBuffer} Returns the cloned array buffer.
18743 */
18744function bufferClone(buffer) {
Jian Li83d87a72016-04-20 15:38:24 -070018745 var result = new ArrayBuffer(buffer.byteLength),
18746 view = new Uint8Array(result);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018747
Jian Li83d87a72016-04-20 15:38:24 -070018748 view.set(new Uint8Array(buffer));
18749 return result;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018750}
18751
18752module.exports = bufferClone;
18753
18754}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04-20 15:38:24 -070018755//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2J1ZmZlckNsb25lLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBOYXRpdmUgbWV0aG9kIHJlZmVyZW5jZXMuICovXG52YXIgQXJyYXlCdWZmZXIgPSBnbG9iYWwuQXJyYXlCdWZmZXIsXG4gICAgVWludDhBcnJheSA9IGdsb2JhbC5VaW50OEFycmF5O1xuXG4vKipcbiAqIENyZWF0ZXMgYSBjbG9uZSBvZiB0aGUgZ2l2ZW4gYXJyYXkgYnVmZmVyLlxuICpcbiAqIEBwcml2YXRlXG4gKiBAcGFyYW0ge0FycmF5QnVmZmVyfSBidWZmZXIgVGhlIGFycmF5IGJ1ZmZlciB0byBjbG9uZS5cbiAqIEByZXR1cm5zIHtBcnJheUJ1ZmZlcn0gUmV0dXJucyB0aGUgY2xvbmVkIGFycmF5IGJ1ZmZlci5cbiAqL1xuZnVuY3Rpb24gYnVmZmVyQ2xvbmUoYnVmZmVyKSB7XG4gIHZhciByZXN1bHQgPSBuZXcgQXJyYXlCdWZmZXIoYnVmZmVyLmJ5dGVMZW5ndGgpLFxuICAgICAgdmlldyA9IG5ldyBVaW50OEFycmF5KHJlc3VsdCk7XG5cbiAgdmlldy5zZXQobmV3IFVpbnQ4QXJyYXkoYnVmZmVyKSk7XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gYnVmZmVyQ2xvbmU7XG4iXX0=
18756},{}],100:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018757/* Native method references for those with the same name as other `lodash` methods. */
18758var nativeMax = Math.max;
18759
18760/**
18761 * Creates an array that is the composition of partially applied arguments,
18762 * placeholders, and provided arguments into a single array of arguments.
18763 *
18764 * @private
18765 * @param {Array|Object} args The provided arguments.
18766 * @param {Array} partials The arguments to prepend to those provided.
18767 * @param {Array} holders The `partials` placeholder indexes.
18768 * @returns {Array} Returns the new array of composed arguments.
18769 */
18770function composeArgs(args, partials, holders) {
18771 var holdersLength = holders.length,
18772 argsIndex = -1,
18773 argsLength = nativeMax(args.length - holdersLength, 0),
18774 leftIndex = -1,
18775 leftLength = partials.length,
Jian Li83d87a72016-04-20 15:38:24 -070018776 result = Array(leftLength + argsLength);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018777
18778 while (++leftIndex < leftLength) {
18779 result[leftIndex] = partials[leftIndex];
18780 }
18781 while (++argsIndex < holdersLength) {
18782 result[holders[argsIndex]] = args[argsIndex];
18783 }
18784 while (argsLength--) {
18785 result[leftIndex++] = args[argsIndex++];
18786 }
18787 return result;
18788}
18789
18790module.exports = composeArgs;
18791
Jian Li83d87a72016-04-20 15:38:24 -070018792},{}],101:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018793/* Native method references for those with the same name as other `lodash` methods. */
18794var nativeMax = Math.max;
18795
18796/**
18797 * This function is like `composeArgs` except that the arguments composition
18798 * is tailored for `_.partialRight`.
18799 *
18800 * @private
18801 * @param {Array|Object} args The provided arguments.
18802 * @param {Array} partials The arguments to append to those provided.
18803 * @param {Array} holders The `partials` placeholder indexes.
18804 * @returns {Array} Returns the new array of composed arguments.
18805 */
18806function composeArgsRight(args, partials, holders) {
18807 var holdersIndex = -1,
18808 holdersLength = holders.length,
18809 argsIndex = -1,
18810 argsLength = nativeMax(args.length - holdersLength, 0),
18811 rightIndex = -1,
18812 rightLength = partials.length,
18813 result = Array(argsLength + rightLength);
18814
18815 while (++argsIndex < argsLength) {
18816 result[argsIndex] = args[argsIndex];
18817 }
18818 var offset = argsIndex;
18819 while (++rightIndex < rightLength) {
18820 result[offset + rightIndex] = partials[rightIndex];
18821 }
18822 while (++holdersIndex < holdersLength) {
18823 result[offset + holders[holdersIndex]] = args[argsIndex++];
18824 }
18825 return result;
18826}
18827
18828module.exports = composeArgsRight;
18829
Jian Li83d87a72016-04-20 15:38:24 -070018830},{}],102:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018831var getLength = require('./getLength'),
18832 isLength = require('./isLength'),
18833 toObject = require('./toObject');
18834
18835/**
18836 * Creates a `baseEach` or `baseEachRight` function.
18837 *
18838 * @private
18839 * @param {Function} eachFunc The function to iterate over a collection.
18840 * @param {boolean} [fromRight] Specify iterating from right to left.
18841 * @returns {Function} Returns the new base function.
18842 */
18843function createBaseEach(eachFunc, fromRight) {
18844 return function(collection, iteratee) {
18845 var length = collection ? getLength(collection) : 0;
18846 if (!isLength(length)) {
18847 return eachFunc(collection, iteratee);
18848 }
18849 var index = fromRight ? length : -1,
18850 iterable = toObject(collection);
18851
18852 while ((fromRight ? index-- : ++index < length)) {
18853 if (iteratee(iterable[index], index, iterable) === false) {
18854 break;
18855 }
18856 }
18857 return collection;
18858 };
18859}
18860
18861module.exports = createBaseEach;
18862
Jian Li83d87a72016-04-20 15:38:24 -070018863},{"./getLength":116,"./isLength":129,"./toObject":139}],103:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018864var toObject = require('./toObject');
18865
18866/**
18867 * Creates a base function for `_.forIn` or `_.forInRight`.
18868 *
18869 * @private
18870 * @param {boolean} [fromRight] Specify iterating from right to left.
18871 * @returns {Function} Returns the new base function.
18872 */
18873function createBaseFor(fromRight) {
18874 return function(object, iteratee, keysFunc) {
18875 var iterable = toObject(object),
18876 props = keysFunc(object),
18877 length = props.length,
18878 index = fromRight ? length : -1;
18879
18880 while ((fromRight ? index-- : ++index < length)) {
18881 var key = props[index];
18882 if (iteratee(iterable[key], key, iterable) === false) {
18883 break;
18884 }
18885 }
18886 return object;
18887 };
18888}
18889
18890module.exports = createBaseFor;
18891
Jian Li83d87a72016-04-20 15:38:24 -070018892},{"./toObject":139}],104:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018893(function (global){
18894var createCtorWrapper = require('./createCtorWrapper');
18895
18896/**
18897 * Creates a function that wraps `func` and invokes it with the `this`
18898 * binding of `thisArg`.
18899 *
18900 * @private
18901 * @param {Function} func The function to bind.
18902 * @param {*} [thisArg] The `this` binding of `func`.
18903 * @returns {Function} Returns the new bound function.
18904 */
18905function createBindWrapper(func, thisArg) {
18906 var Ctor = createCtorWrapper(func);
18907
18908 function wrapper() {
18909 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
18910 return fn.apply(thisArg, arguments);
18911 }
18912 return wrapper;
18913}
18914
18915module.exports = createBindWrapper;
18916
18917}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04-20 15:38:24 -070018918//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZUJpbmRXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUF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achuska0fa2aa12015-08-18 12:53:04 -070018920var baseCreate = require('./baseCreate'),
18921 isObject = require('../lang/isObject');
18922
18923/**
18924 * Creates a function that produces an instance of `Ctor` regardless of
18925 * whether it was invoked as part of a `new` expression or by `call` or `apply`.
18926 *
18927 * @private
18928 * @param {Function} Ctor The constructor to wrap.
18929 * @returns {Function} Returns the new wrapped function.
18930 */
18931function createCtorWrapper(Ctor) {
18932 return function() {
18933 // Use a `switch` statement to work with class constructors.
Jian Li83d87a72016-04-20 15:38:24 -070018934 // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018935 // for more details.
18936 var args = arguments;
18937 switch (args.length) {
18938 case 0: return new Ctor;
18939 case 1: return new Ctor(args[0]);
18940 case 2: return new Ctor(args[0], args[1]);
18941 case 3: return new Ctor(args[0], args[1], args[2]);
18942 case 4: return new Ctor(args[0], args[1], args[2], args[3]);
18943 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
Jian Li83d87a72016-04-20 15:38:24 -070018944 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
18945 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018946 }
18947 var thisBinding = baseCreate(Ctor.prototype),
18948 result = Ctor.apply(thisBinding, args);
18949
18950 // Mimic the constructor's `return` behavior.
18951 // See https://es5.github.io/#x13.2.2 for more details.
18952 return isObject(result) ? result : thisBinding;
18953 };
18954}
18955
18956module.exports = createCtorWrapper;
18957
Jian Li83d87a72016-04-20 15:38:24 -070018958},{"../lang/isObject":148,"./baseCreate":74}],106:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018959var baseCallback = require('./baseCallback'),
18960 baseFind = require('./baseFind'),
18961 baseFindIndex = require('./baseFindIndex'),
18962 isArray = require('../lang/isArray');
18963
18964/**
18965 * Creates a `_.find` or `_.findLast` function.
18966 *
18967 * @private
18968 * @param {Function} eachFunc The function to iterate over a collection.
18969 * @param {boolean} [fromRight] Specify iterating from right to left.
18970 * @returns {Function} Returns the new find function.
18971 */
18972function createFind(eachFunc, fromRight) {
18973 return function(collection, predicate, thisArg) {
18974 predicate = baseCallback(predicate, thisArg, 3);
18975 if (isArray(collection)) {
18976 var index = baseFindIndex(collection, predicate, fromRight);
18977 return index > -1 ? collection[index] : undefined;
18978 }
18979 return baseFind(collection, predicate, eachFunc);
18980 };
18981}
18982
18983module.exports = createFind;
18984
Jian Li83d87a72016-04-20 15:38:24 -070018985},{"../lang/isArray":144,"./baseCallback":71,"./baseFind":76,"./baseFindIndex":77}],107:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070018986var bindCallback = require('./bindCallback'),
18987 isArray = require('../lang/isArray');
18988
18989/**
18990 * Creates a function for `_.forEach` or `_.forEachRight`.
18991 *
18992 * @private
18993 * @param {Function} arrayFunc The function to iterate over an array.
18994 * @param {Function} eachFunc The function to iterate over a collection.
18995 * @returns {Function} Returns the new each function.
18996 */
18997function createForEach(arrayFunc, eachFunc) {
18998 return function(collection, iteratee, thisArg) {
18999 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
19000 ? arrayFunc(collection, iteratee)
19001 : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
19002 };
19003}
19004
19005module.exports = createForEach;
19006
Jian Li83d87a72016-04-20 15:38:24 -070019007},{"../lang/isArray":144,"./bindCallback":98}],108:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019008(function (global){
19009var arrayCopy = require('./arrayCopy'),
19010 composeArgs = require('./composeArgs'),
19011 composeArgsRight = require('./composeArgsRight'),
19012 createCtorWrapper = require('./createCtorWrapper'),
19013 isLaziable = require('./isLaziable'),
19014 reorder = require('./reorder'),
19015 replaceHolders = require('./replaceHolders'),
19016 setData = require('./setData');
19017
19018/** Used to compose bitmasks for wrapper metadata. */
19019var BIND_FLAG = 1,
19020 BIND_KEY_FLAG = 2,
19021 CURRY_BOUND_FLAG = 4,
19022 CURRY_FLAG = 8,
19023 CURRY_RIGHT_FLAG = 16,
19024 PARTIAL_FLAG = 32,
19025 PARTIAL_RIGHT_FLAG = 64,
19026 ARY_FLAG = 128;
19027
19028/* Native method references for those with the same name as other `lodash` methods. */
19029var nativeMax = Math.max;
19030
19031/**
19032 * Creates a function that wraps `func` and invokes it with optional `this`
19033 * binding of, partial application, and currying.
19034 *
19035 * @private
19036 * @param {Function|string} func The function or method name to reference.
19037 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
19038 * @param {*} [thisArg] The `this` binding of `func`.
19039 * @param {Array} [partials] The arguments to prepend to those provided to the new function.
19040 * @param {Array} [holders] The `partials` placeholder indexes.
19041 * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
19042 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
19043 * @param {Array} [argPos] The argument positions of the new function.
19044 * @param {number} [ary] The arity cap of `func`.
19045 * @param {number} [arity] The arity of `func`.
19046 * @returns {Function} Returns the new wrapped function.
19047 */
19048function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
19049 var isAry = bitmask & ARY_FLAG,
19050 isBind = bitmask & BIND_FLAG,
19051 isBindKey = bitmask & BIND_KEY_FLAG,
19052 isCurry = bitmask & CURRY_FLAG,
19053 isCurryBound = bitmask & CURRY_BOUND_FLAG,
19054 isCurryRight = bitmask & CURRY_RIGHT_FLAG,
Jian Li83d87a72016-04-20 15:38:24 -070019055 Ctor = isBindKey ? undefined : createCtorWrapper(func);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019056
19057 function wrapper() {
19058 // Avoid `arguments` object use disqualifying optimizations by
19059 // converting it to an array before providing it to other functions.
19060 var length = arguments.length,
19061 index = length,
19062 args = Array(length);
19063
19064 while (index--) {
19065 args[index] = arguments[index];
19066 }
19067 if (partials) {
19068 args = composeArgs(args, partials, holders);
19069 }
19070 if (partialsRight) {
19071 args = composeArgsRight(args, partialsRight, holdersRight);
19072 }
19073 if (isCurry || isCurryRight) {
19074 var placeholder = wrapper.placeholder,
19075 argsHolders = replaceHolders(args, placeholder);
19076
19077 length -= argsHolders.length;
19078 if (length < arity) {
Jian Li83d87a72016-04-20 15:38:24 -070019079 var newArgPos = argPos ? arrayCopy(argPos) : undefined,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019080 newArity = nativeMax(arity - length, 0),
Jian Li83d87a72016-04-20 15:38:24 -070019081 newsHolders = isCurry ? argsHolders : undefined,
19082 newHoldersRight = isCurry ? undefined : argsHolders,
19083 newPartials = isCurry ? args : undefined,
19084 newPartialsRight = isCurry ? undefined : args;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019085
19086 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
19087 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
19088
19089 if (!isCurryBound) {
19090 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
19091 }
19092 var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
19093 result = createHybridWrapper.apply(undefined, newData);
19094
19095 if (isLaziable(func)) {
19096 setData(result, newData);
19097 }
19098 result.placeholder = placeholder;
19099 return result;
19100 }
19101 }
19102 var thisBinding = isBind ? thisArg : this,
19103 fn = isBindKey ? thisBinding[func] : func;
19104
19105 if (argPos) {
19106 args = reorder(args, argPos);
19107 }
19108 if (isAry && ary < args.length) {
19109 args.length = ary;
19110 }
19111 if (this && this !== global && this instanceof wrapper) {
19112 fn = Ctor || createCtorWrapper(func);
19113 }
19114 return fn.apply(thisBinding, args);
19115 }
19116 return wrapper;
19117}
19118
19119module.exports = createHybridWrapper;
19120
19121}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04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A9IGFyeTtcbiAgICB9XG4gICAgaWYgKHRoaXMgJiYgdGhpcyAhPT0gZ2xvYmFsICYmIHRoaXMgaW5zdGFuY2VvZiB3cmFwcGVyKSB7XG4gICAgICBmbiA9IEN0b3IgfHwgY3JlYXRlQ3RvcldyYXBwZXIoZnVuYyk7XG4gICAgfVxuICAgIHJldHVybiBmbi5hcHBseSh0aGlzQmluZGluZywgYXJncyk7XG4gIH1cbiAgcmV0dXJuIHdyYXBwZXI7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gY3JlYXRlSHlicmlkV3JhcHBlcjtcbiJdfQ==
19123},{"./arrayCopy":66,"./composeArgs":100,"./composeArgsRight":101,"./createCtorWrapper":105,"./isLaziable":128,"./reorder":135,"./replaceHolders":136,"./setData":137}],109:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019124(function (global){
19125var createCtorWrapper = require('./createCtorWrapper');
19126
19127/** Used to compose bitmasks for wrapper metadata. */
19128var BIND_FLAG = 1;
19129
19130/**
19131 * Creates a function that wraps `func` and invokes it with the optional `this`
19132 * binding of `thisArg` and the `partials` prepended to those provided to
19133 * the wrapper.
19134 *
19135 * @private
19136 * @param {Function} func The function to partially apply arguments to.
19137 * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
19138 * @param {*} thisArg The `this` binding of `func`.
19139 * @param {Array} partials The arguments to prepend to those provided to the new function.
19140 * @returns {Function} Returns the new bound function.
19141 */
19142function createPartialWrapper(func, bitmask, thisArg, partials) {
19143 var isBind = bitmask & BIND_FLAG,
19144 Ctor = createCtorWrapper(func);
19145
19146 function wrapper() {
19147 // Avoid `arguments` object use disqualifying optimizations by
19148 // converting it to an array before providing it `func`.
19149 var argsIndex = -1,
19150 argsLength = arguments.length,
19151 leftIndex = -1,
19152 leftLength = partials.length,
Jian Li83d87a72016-04-20 15:38:24 -070019153 args = Array(leftLength + argsLength);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019154
19155 while (++leftIndex < leftLength) {
19156 args[leftIndex] = partials[leftIndex];
19157 }
19158 while (argsLength--) {
19159 args[leftIndex++] = arguments[++argsIndex];
19160 }
19161 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
19162 return fn.apply(isBind ? thisArg : this, args);
19163 }
19164 return wrapper;
19165}
19166
19167module.exports = createPartialWrapper;
19168
19169}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04-20 15:38:24 -070019170//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2NyZWF0ZVBhcnRpYWxXcmFwcGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgY3JlYXRlQ3RvcldyYXBwZXIgPSByZXF1aXJlKCcuL2NyZWF0ZUN0b3JXcmFwcGVyJyk7XG5cbi8qKiBVc2VkIHRvIGNvbXBvc2UgYml0bWFza3MgZm9yIHdyYXBwZXIgbWV0YWRhdGEuICovXG52YXIgQklORF9GTEFHID0gMTtcblxuLyoqXG4gKiBDcmVhdGVzIGEgZnVuY3Rpb24gd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XJ0aW5nIGl0IHRvIGFuIGFycmF5IGJlZm9yZSBwcm92aWRpbmcgaXQgYGZ1bmNgLlxuICAgIHZhciBhcmdzSW5kZXggPSAtMSxcbiAgICAgICAgYXJnc0xlbmd0aCA9IGFyZ3VtZW50cy5sZW5ndGgsXG4gICAgICAgIGxlZnRJbmRleCA9IC0xLFxuICAgICAgICBsZWZ0TGVuZ3RoID0gcGFydGlhbHMubGVuZ3RoLFxuICAgICAgICBhcmdzID0gQXJyYXkobGVmdExlbmd0aCArIGFyZ3NMZW5ndGgpO1xuXG4gICAgd2hpbGUgKCsrbGVmdEluZGV4IDwgbGVmdExlbmd0aCkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXhdID0gcGFydGlhbHNbbGVmdEluZGV4XTtcbiAgICB9XG4gICAgd2hpbGUgKGFyZ3NMZW5ndGgtLSkge1xuICAgICAgYXJnc1tsZWZ0SW5kZXgrK10gPSBhcmd1bWVudHNbKythcmdzSW5kZXhdO1xuICAgIH1cbiAgICB2YXIgZm4gPSAodGhpcyAmJiB0aGlzICE9PSBnbG9iYWwgJiYgdGhpcyBpbnN0YW5jZW9mIHdyYXBwZXIpID8gQ3RvciA6IGZ1bmM7XG4gICAgcmV0dXJuIGZuLmFwcGx5KGlzQmluZCA/IHRoaXNBcmcgOiB0aGlzLCBhcmdzKTtcbiAgfVxuICByZXR1cm4gd3JhcHBlcjtcbn1cblxubW9kdWxlLmV4cG9ydHMgPSBjcmVhdGVQYXJ0aWFsV3JhcHBlcjtcbiJdfQ==
19171},{"./createCtorWrapper":105}],110:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019172var baseSetData = require('./baseSetData'),
19173 createBindWrapper = require('./createBindWrapper'),
19174 createHybridWrapper = require('./createHybridWrapper'),
19175 createPartialWrapper = require('./createPartialWrapper'),
19176 getData = require('./getData'),
19177 mergeData = require('./mergeData'),
19178 setData = require('./setData');
19179
19180/** Used to compose bitmasks for wrapper metadata. */
19181var BIND_FLAG = 1,
19182 BIND_KEY_FLAG = 2,
19183 PARTIAL_FLAG = 32,
19184 PARTIAL_RIGHT_FLAG = 64;
19185
19186/** Used as the `TypeError` message for "Functions" methods. */
19187var FUNC_ERROR_TEXT = 'Expected a function';
19188
19189/* Native method references for those with the same name as other `lodash` methods. */
19190var nativeMax = Math.max;
19191
19192/**
19193 * Creates a function that either curries or invokes `func` with optional
19194 * `this` binding and partially applied arguments.
19195 *
19196 * @private
19197 * @param {Function|string} func The function or method name to reference.
19198 * @param {number} bitmask The bitmask of flags.
19199 * The bitmask may be composed of the following flags:
19200 * 1 - `_.bind`
19201 * 2 - `_.bindKey`
19202 * 4 - `_.curry` or `_.curryRight` of a bound function
19203 * 8 - `_.curry`
19204 * 16 - `_.curryRight`
19205 * 32 - `_.partial`
19206 * 64 - `_.partialRight`
19207 * 128 - `_.rearg`
19208 * 256 - `_.ary`
19209 * @param {*} [thisArg] The `this` binding of `func`.
19210 * @param {Array} [partials] The arguments to be partially applied.
19211 * @param {Array} [holders] The `partials` placeholder indexes.
19212 * @param {Array} [argPos] The argument positions of the new function.
19213 * @param {number} [ary] The arity cap of `func`.
19214 * @param {number} [arity] The arity of `func`.
19215 * @returns {Function} Returns the new wrapped function.
19216 */
19217function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
19218 var isBindKey = bitmask & BIND_KEY_FLAG;
19219 if (!isBindKey && typeof func != 'function') {
19220 throw new TypeError(FUNC_ERROR_TEXT);
19221 }
19222 var length = partials ? partials.length : 0;
19223 if (!length) {
19224 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
Jian Li83d87a72016-04-20 15:38:24 -070019225 partials = holders = undefined;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019226 }
19227 length -= (holders ? holders.length : 0);
19228 if (bitmask & PARTIAL_RIGHT_FLAG) {
19229 var partialsRight = partials,
19230 holdersRight = holders;
19231
Jian Li83d87a72016-04-20 15:38:24 -070019232 partials = holders = undefined;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019233 }
Jian Li83d87a72016-04-20 15:38:24 -070019234 var data = isBindKey ? undefined : getData(func),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019235 newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
19236
19237 if (data) {
19238 mergeData(newData, data);
19239 bitmask = newData[1];
19240 arity = newData[9];
19241 }
19242 newData[9] = arity == null
19243 ? (isBindKey ? 0 : func.length)
19244 : (nativeMax(arity - length, 0) || 0);
19245
19246 if (bitmask == BIND_FLAG) {
19247 var result = createBindWrapper(newData[0], newData[2]);
19248 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
19249 result = createPartialWrapper.apply(undefined, newData);
19250 } else {
19251 result = createHybridWrapper.apply(undefined, newData);
19252 }
19253 var setter = data ? baseSetData : setData;
19254 return setter(result, newData);
19255}
19256
19257module.exports = createWrapper;
19258
Jian Li83d87a72016-04-20 15:38:24 -070019259},{"./baseSetData":92,"./createBindWrapper":104,"./createHybridWrapper":108,"./createPartialWrapper":109,"./getData":114,"./mergeData":132,"./setData":137}],111:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019260var arraySome = require('./arraySome');
19261
19262/**
19263 * A specialized version of `baseIsEqualDeep` for arrays with support for
19264 * partial deep comparisons.
19265 *
19266 * @private
19267 * @param {Array} array The array to compare.
19268 * @param {Array} other The other array to compare.
19269 * @param {Function} equalFunc The function to determine equivalents of values.
19270 * @param {Function} [customizer] The function to customize comparing arrays.
19271 * @param {boolean} [isLoose] Specify performing partial comparisons.
19272 * @param {Array} [stackA] Tracks traversed `value` objects.
19273 * @param {Array} [stackB] Tracks traversed `other` objects.
19274 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
19275 */
19276function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
19277 var index = -1,
19278 arrLength = array.length,
19279 othLength = other.length;
19280
19281 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
19282 return false;
19283 }
19284 // Ignore non-index properties.
19285 while (++index < arrLength) {
19286 var arrValue = array[index],
19287 othValue = other[index],
19288 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
19289
19290 if (result !== undefined) {
19291 if (result) {
19292 continue;
19293 }
19294 return false;
19295 }
19296 // Recursively compare arrays (susceptible to call stack limits).
19297 if (isLoose) {
19298 if (!arraySome(other, function(othValue) {
19299 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
19300 })) {
19301 return false;
19302 }
19303 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
19304 return false;
19305 }
19306 }
19307 return true;
19308}
19309
19310module.exports = equalArrays;
19311
Jian Li83d87a72016-04-20 15:38:24 -070019312},{"./arraySome":69}],112:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019313/** `Object#toString` result references. */
19314var boolTag = '[object Boolean]',
19315 dateTag = '[object Date]',
19316 errorTag = '[object Error]',
19317 numberTag = '[object Number]',
19318 regexpTag = '[object RegExp]',
19319 stringTag = '[object String]';
19320
19321/**
19322 * A specialized version of `baseIsEqualDeep` for comparing objects of
19323 * the same `toStringTag`.
19324 *
19325 * **Note:** This function only supports comparing values with tags of
19326 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
19327 *
19328 * @private
Jian Li83d87a72016-04-20 15:38:24 -070019329 * @param {Object} object The object to compare.
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019330 * @param {Object} other The other object to compare.
19331 * @param {string} tag The `toStringTag` of the objects to compare.
19332 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
19333 */
19334function equalByTag(object, other, tag) {
19335 switch (tag) {
19336 case boolTag:
19337 case dateTag:
19338 // Coerce dates and booleans to numbers, dates to milliseconds and booleans
19339 // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
19340 return +object == +other;
19341
19342 case errorTag:
19343 return object.name == other.name && object.message == other.message;
19344
19345 case numberTag:
19346 // Treat `NaN` vs. `NaN` as equal.
19347 return (object != +object)
19348 ? other != +other
19349 : object == +other;
19350
19351 case regexpTag:
19352 case stringTag:
19353 // Coerce regexes to strings and treat strings primitives and string
19354 // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
19355 return object == (other + '');
19356 }
19357 return false;
19358}
19359
19360module.exports = equalByTag;
19361
Jian Li83d87a72016-04-20 15:38:24 -070019362},{}],113:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019363var keys = require('../object/keys');
19364
19365/** Used for native method references. */
19366var objectProto = Object.prototype;
19367
19368/** Used to check objects for own properties. */
19369var hasOwnProperty = objectProto.hasOwnProperty;
19370
19371/**
19372 * A specialized version of `baseIsEqualDeep` for objects with support for
19373 * partial deep comparisons.
19374 *
19375 * @private
19376 * @param {Object} object The object to compare.
19377 * @param {Object} other The other object to compare.
19378 * @param {Function} equalFunc The function to determine equivalents of values.
19379 * @param {Function} [customizer] The function to customize comparing values.
19380 * @param {boolean} [isLoose] Specify performing partial comparisons.
19381 * @param {Array} [stackA] Tracks traversed `value` objects.
19382 * @param {Array} [stackB] Tracks traversed `other` objects.
19383 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
19384 */
19385function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
19386 var objProps = keys(object),
19387 objLength = objProps.length,
19388 othProps = keys(other),
19389 othLength = othProps.length;
19390
19391 if (objLength != othLength && !isLoose) {
19392 return false;
19393 }
19394 var index = objLength;
19395 while (index--) {
19396 var key = objProps[index];
19397 if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
19398 return false;
19399 }
19400 }
19401 var skipCtor = isLoose;
19402 while (++index < objLength) {
19403 key = objProps[index];
19404 var objValue = object[key],
19405 othValue = other[key],
19406 result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
19407
19408 // Recursively compare objects (susceptible to call stack limits).
19409 if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
19410 return false;
19411 }
19412 skipCtor || (skipCtor = key == 'constructor');
19413 }
19414 if (!skipCtor) {
19415 var objCtor = object.constructor,
19416 othCtor = other.constructor;
19417
19418 // Non `Object` object instances with different constructors are not equal.
19419 if (objCtor != othCtor &&
19420 ('constructor' in object && 'constructor' in other) &&
19421 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
19422 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
19423 return false;
19424 }
19425 }
19426 return true;
19427}
19428
19429module.exports = equalObjects;
19430
Jian Li83d87a72016-04-20 15:38:24 -070019431},{"../object/keys":153}],114:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019432var metaMap = require('./metaMap'),
19433 noop = require('../utility/noop');
19434
19435/**
19436 * Gets metadata for `func`.
19437 *
19438 * @private
19439 * @param {Function} func The function to query.
19440 * @returns {*} Returns the metadata for `func`.
19441 */
19442var getData = !metaMap ? noop : function(func) {
19443 return metaMap.get(func);
19444};
19445
19446module.exports = getData;
19447
Jian Li83d87a72016-04-20 15:38:24 -070019448},{"../utility/noop":159,"./metaMap":133}],115:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019449var realNames = require('./realNames');
19450
19451/**
19452 * Gets the name of `func`.
19453 *
19454 * @private
19455 * @param {Function} func The function to query.
19456 * @returns {string} Returns the function name.
19457 */
19458function getFuncName(func) {
Jian Li83d87a72016-04-20 15:38:24 -070019459 var result = (func.name + ''),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019460 array = realNames[result],
19461 length = array ? array.length : 0;
19462
19463 while (length--) {
19464 var data = array[length],
19465 otherFunc = data.func;
19466 if (otherFunc == null || otherFunc == func) {
19467 return data.name;
19468 }
19469 }
19470 return result;
19471}
19472
19473module.exports = getFuncName;
19474
Jian Li83d87a72016-04-20 15:38:24 -070019475},{"./realNames":134}],116:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019476var baseProperty = require('./baseProperty');
19477
19478/**
19479 * Gets the "length" property value of `object`.
19480 *
19481 * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
19482 * that affects Safari on at least iOS 8.1-8.3 ARM64.
19483 *
19484 * @private
19485 * @param {Object} object The object to query.
19486 * @returns {*} Returns the "length" value.
19487 */
19488var getLength = baseProperty('length');
19489
19490module.exports = getLength;
19491
Jian Li83d87a72016-04-20 15:38:24 -070019492},{"./baseProperty":90}],117:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019493var isStrictComparable = require('./isStrictComparable'),
19494 pairs = require('../object/pairs');
19495
19496/**
19497 * Gets the propery names, values, and compare flags of `object`.
19498 *
19499 * @private
19500 * @param {Object} object The object to query.
19501 * @returns {Array} Returns the match data of `object`.
19502 */
19503function getMatchData(object) {
19504 var result = pairs(object),
19505 length = result.length;
19506
19507 while (length--) {
19508 result[length][2] = isStrictComparable(result[length][1]);
19509 }
19510 return result;
19511}
19512
19513module.exports = getMatchData;
19514
Jian Li83d87a72016-04-20 15:38:24 -070019515},{"../object/pairs":155,"./isStrictComparable":131}],118:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019516var isNative = require('../lang/isNative');
19517
19518/**
19519 * Gets the native function at `key` of `object`.
19520 *
19521 * @private
19522 * @param {Object} object The object to query.
19523 * @param {string} key The key of the method to get.
19524 * @returns {*} Returns the function if it's native, else `undefined`.
19525 */
19526function getNative(object, key) {
19527 var value = object == null ? undefined : object[key];
19528 return isNative(value) ? value : undefined;
19529}
19530
19531module.exports = getNative;
19532
Jian Li83d87a72016-04-20 15:38:24 -070019533},{"../lang/isNative":147}],119:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019534/**
19535 * Gets the index at which the first occurrence of `NaN` is found in `array`.
19536 *
19537 * @private
19538 * @param {Array} array The array to search.
19539 * @param {number} fromIndex The index to search from.
19540 * @param {boolean} [fromRight] Specify iterating from right to left.
19541 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
19542 */
19543function indexOfNaN(array, fromIndex, fromRight) {
19544 var length = array.length,
19545 index = fromIndex + (fromRight ? 0 : -1);
19546
19547 while ((fromRight ? index-- : ++index < length)) {
19548 var other = array[index];
19549 if (other !== other) {
19550 return index;
19551 }
19552 }
19553 return -1;
19554}
19555
19556module.exports = indexOfNaN;
19557
Jian Li83d87a72016-04-20 15:38:24 -070019558},{}],120:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019559/** Used for native method references. */
19560var objectProto = Object.prototype;
19561
19562/** Used to check objects for own properties. */
19563var hasOwnProperty = objectProto.hasOwnProperty;
19564
19565/**
19566 * Initializes an array clone.
19567 *
19568 * @private
19569 * @param {Array} array The array to clone.
19570 * @returns {Array} Returns the initialized clone.
19571 */
19572function initCloneArray(array) {
19573 var length = array.length,
19574 result = new array.constructor(length);
19575
19576 // Add array properties assigned by `RegExp#exec`.
19577 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
19578 result.index = array.index;
19579 result.input = array.input;
19580 }
19581 return result;
19582}
19583
19584module.exports = initCloneArray;
19585
Jian Li83d87a72016-04-20 15:38:24 -070019586},{}],121:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019587(function (global){
19588var bufferClone = require('./bufferClone');
19589
19590/** `Object#toString` result references. */
19591var boolTag = '[object Boolean]',
19592 dateTag = '[object Date]',
19593 numberTag = '[object Number]',
19594 regexpTag = '[object RegExp]',
19595 stringTag = '[object String]';
19596
19597var arrayBufferTag = '[object ArrayBuffer]',
19598 float32Tag = '[object Float32Array]',
19599 float64Tag = '[object Float64Array]',
19600 int8Tag = '[object Int8Array]',
19601 int16Tag = '[object Int16Array]',
19602 int32Tag = '[object Int32Array]',
19603 uint8Tag = '[object Uint8Array]',
19604 uint8ClampedTag = '[object Uint8ClampedArray]',
19605 uint16Tag = '[object Uint16Array]',
19606 uint32Tag = '[object Uint32Array]';
19607
19608/** Used to match `RegExp` flags from their coerced string values. */
19609var reFlags = /\w*$/;
19610
Jian Li83d87a72016-04-20 15:38:24 -070019611/** Native method references. */
19612var Uint8Array = global.Uint8Array;
19613
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019614/** Used to lookup a type array constructors by `toStringTag`. */
19615var ctorByTag = {};
19616ctorByTag[float32Tag] = global.Float32Array;
19617ctorByTag[float64Tag] = global.Float64Array;
19618ctorByTag[int8Tag] = global.Int8Array;
19619ctorByTag[int16Tag] = global.Int16Array;
19620ctorByTag[int32Tag] = global.Int32Array;
Jian Li83d87a72016-04-20 15:38:24 -070019621ctorByTag[uint8Tag] = Uint8Array;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019622ctorByTag[uint8ClampedTag] = global.Uint8ClampedArray;
19623ctorByTag[uint16Tag] = global.Uint16Array;
19624ctorByTag[uint32Tag] = global.Uint32Array;
19625
19626/**
19627 * Initializes an object clone based on its `toStringTag`.
19628 *
19629 * **Note:** This function only supports cloning values with tags of
19630 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
19631 *
19632 * @private
19633 * @param {Object} object The object to clone.
19634 * @param {string} tag The `toStringTag` of the object to clone.
19635 * @param {boolean} [isDeep] Specify a deep clone.
19636 * @returns {Object} Returns the initialized clone.
19637 */
19638function initCloneByTag(object, tag, isDeep) {
19639 var Ctor = object.constructor;
19640 switch (tag) {
19641 case arrayBufferTag:
19642 return bufferClone(object);
19643
19644 case boolTag:
19645 case dateTag:
19646 return new Ctor(+object);
19647
19648 case float32Tag: case float64Tag:
19649 case int8Tag: case int16Tag: case int32Tag:
19650 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
19651 // Safari 5 mobile incorrectly has `Object` as the constructor of typed arrays.
19652 if (Ctor instanceof Ctor) {
19653 Ctor = ctorByTag[tag];
19654 }
19655 var buffer = object.buffer;
19656 return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
19657
19658 case numberTag:
19659 case stringTag:
19660 return new Ctor(object);
19661
19662 case regexpTag:
19663 var result = new Ctor(object.source, reFlags.exec(object));
19664 result.lastIndex = object.lastIndex;
19665 }
19666 return result;
19667}
19668
19669module.exports = initCloneByTag;
19670
19671}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04-20 15:38:24 -070019672//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL2luaXRDbG9uZUJ5VGFnLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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xuICAgICAgfVxuICAgICAgdmFyIGJ1ZmZlciA9IG9iamVjdC5idWZmZXI7XG4gICAgICByZXR1cm4gbmV3IEN0b3IoaXNEZWVwID8gYnVmZmVyQ2xvbmUoYnVmZmVyKSA6IGJ1ZmZlciwgb2JqZWN0LmJ5dGVPZmZzZXQsIG9iamVjdC5sZW5ndGgpO1xuXG4gICAgY2FzZSBudW1iZXJUYWc6XG4gICAgY2FzZSBzdHJpbmdUYWc6XG4gICAgICByZXR1cm4gbmV3IEN0b3Iob2JqZWN0KTtcblxuICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgdmFyIHJlc3VsdCA9IG5ldyBDdG9yKG9iamVjdC5zb3VyY2UsIHJlRmxhZ3MuZXhlYyhvYmplY3QpKTtcbiAgICAgIHJlc3VsdC5sYXN0SW5kZXggPSBvYmplY3QubGFzdEluZGV4O1xuICB9XG4gIHJldHVybiByZXN1bHQ7XG59XG5cbm1vZHVsZS5leHBvcnRzID0gaW5pdENsb25lQnlUYWc7XG4iXX0=
19673},{"./bufferClone":99}],122:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019674/**
19675 * Initializes an object clone.
19676 *
19677 * @private
19678 * @param {Object} object The object to clone.
19679 * @returns {Object} Returns the initialized clone.
19680 */
19681function initCloneObject(object) {
19682 var Ctor = object.constructor;
19683 if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
19684 Ctor = Object;
19685 }
19686 return new Ctor;
19687}
19688
19689module.exports = initCloneObject;
19690
Jian Li83d87a72016-04-20 15:38:24 -070019691},{}],123:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019692var getLength = require('./getLength'),
19693 isLength = require('./isLength');
19694
19695/**
19696 * Checks if `value` is array-like.
19697 *
19698 * @private
19699 * @param {*} value The value to check.
19700 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
19701 */
19702function isArrayLike(value) {
19703 return value != null && isLength(getLength(value));
19704}
19705
19706module.exports = isArrayLike;
19707
Jian Li83d87a72016-04-20 15:38:24 -070019708},{"./getLength":116,"./isLength":129}],124:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019709/**
19710 * Checks if `value` is a host object in IE < 9.
19711 *
19712 * @private
19713 * @param {*} value The value to check.
19714 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
19715 */
19716var isHostObject = (function() {
19717 try {
19718 Object({ 'toString': 0 } + '');
19719 } catch(e) {
19720 return function() { return false; };
19721 }
19722 return function(value) {
19723 // IE < 9 presents many host objects as `Object` objects that can coerce
19724 // to strings despite having improperly defined `toString` methods.
19725 return typeof value.toString != 'function' && typeof (value + '') == 'string';
19726 };
19727}());
19728
19729module.exports = isHostObject;
19730
Jian Li83d87a72016-04-20 15:38:24 -070019731},{}],125:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019732/** Used to detect unsigned integer values. */
19733var reIsUint = /^\d+$/;
19734
19735/**
Jian Li83d87a72016-04-20 15:38:24 -070019736 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019737 * of an array-like value.
19738 */
19739var MAX_SAFE_INTEGER = 9007199254740991;
19740
19741/**
19742 * Checks if `value` is a valid array-like index.
19743 *
19744 * @private
19745 * @param {*} value The value to check.
19746 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
19747 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
19748 */
19749function isIndex(value, length) {
19750 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
19751 length = length == null ? MAX_SAFE_INTEGER : length;
19752 return value > -1 && value % 1 == 0 && value < length;
19753}
19754
19755module.exports = isIndex;
19756
Jian Li83d87a72016-04-20 15:38:24 -070019757},{}],126:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019758var isArrayLike = require('./isArrayLike'),
19759 isIndex = require('./isIndex'),
19760 isObject = require('../lang/isObject');
19761
19762/**
19763 * Checks if the provided arguments are from an iteratee call.
19764 *
19765 * @private
19766 * @param {*} value The potential iteratee value argument.
19767 * @param {*} index The potential iteratee index or key argument.
19768 * @param {*} object The potential iteratee object argument.
19769 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
19770 */
19771function isIterateeCall(value, index, object) {
19772 if (!isObject(object)) {
19773 return false;
19774 }
19775 var type = typeof index;
19776 if (type == 'number'
19777 ? (isArrayLike(object) && isIndex(index, object.length))
19778 : (type == 'string' && index in object)) {
19779 var other = object[index];
19780 return value === value ? (value === other) : (other !== other);
19781 }
19782 return false;
19783}
19784
19785module.exports = isIterateeCall;
19786
Jian Li83d87a72016-04-20 15:38:24 -070019787},{"../lang/isObject":148,"./isArrayLike":123,"./isIndex":125}],127:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019788var isArray = require('../lang/isArray'),
19789 toObject = require('./toObject');
19790
19791/** Used to match property names within property paths. */
19792var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
19793 reIsPlainProp = /^\w*$/;
19794
19795/**
19796 * Checks if `value` is a property name and not a property path.
19797 *
19798 * @private
19799 * @param {*} value The value to check.
19800 * @param {Object} [object] The object to query keys on.
19801 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
19802 */
19803function isKey(value, object) {
19804 var type = typeof value;
19805 if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
19806 return true;
19807 }
19808 if (isArray(value)) {
19809 return false;
19810 }
19811 var result = !reIsDeepProp.test(value);
19812 return result || (object != null && value in toObject(object));
19813}
19814
19815module.exports = isKey;
19816
Jian Li83d87a72016-04-20 15:38:24 -070019817},{"../lang/isArray":144,"./toObject":139}],128:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019818var LazyWrapper = require('./LazyWrapper'),
19819 getData = require('./getData'),
19820 getFuncName = require('./getFuncName'),
19821 lodash = require('../chain/lodash');
19822
19823/**
19824 * Checks if `func` has a lazy counterpart.
19825 *
19826 * @private
19827 * @param {Function} func The function to check.
19828 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
19829 */
19830function isLaziable(func) {
Jian Li83d87a72016-04-20 15:38:24 -070019831 var funcName = getFuncName(func),
19832 other = lodash[funcName];
19833
19834 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019835 return false;
19836 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019837 if (func === other) {
19838 return true;
19839 }
19840 var data = getData(other);
19841 return !!data && func === data[0];
19842}
19843
19844module.exports = isLaziable;
19845
Jian Li83d87a72016-04-20 15:38:24 -070019846},{"../chain/lodash":55,"./LazyWrapper":64,"./getData":114,"./getFuncName":115}],129:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019847/**
Jian Li83d87a72016-04-20 15:38:24 -070019848 * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019849 * of an array-like value.
19850 */
19851var MAX_SAFE_INTEGER = 9007199254740991;
19852
19853/**
19854 * Checks if `value` is a valid array-like length.
19855 *
Jian Li83d87a72016-04-20 15:38:24 -070019856 * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019857 *
19858 * @private
19859 * @param {*} value The value to check.
19860 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
19861 */
19862function isLength(value) {
19863 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
19864}
19865
19866module.exports = isLength;
19867
Jian Li83d87a72016-04-20 15:38:24 -070019868},{}],130:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019869/**
19870 * Checks if `value` is object-like.
19871 *
19872 * @private
19873 * @param {*} value The value to check.
19874 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
19875 */
19876function isObjectLike(value) {
19877 return !!value && typeof value == 'object';
19878}
19879
19880module.exports = isObjectLike;
19881
Jian Li83d87a72016-04-20 15:38:24 -070019882},{}],131:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019883var isObject = require('../lang/isObject');
19884
19885/**
19886 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
19887 *
19888 * @private
19889 * @param {*} value The value to check.
19890 * @returns {boolean} Returns `true` if `value` if suitable for strict
19891 * equality comparisons, else `false`.
19892 */
19893function isStrictComparable(value) {
19894 return value === value && !isObject(value);
19895}
19896
19897module.exports = isStrictComparable;
19898
Jian Li83d87a72016-04-20 15:38:24 -070019899},{"../lang/isObject":148}],132:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019900var arrayCopy = require('./arrayCopy'),
19901 composeArgs = require('./composeArgs'),
19902 composeArgsRight = require('./composeArgsRight'),
19903 replaceHolders = require('./replaceHolders');
19904
19905/** Used to compose bitmasks for wrapper metadata. */
19906var BIND_FLAG = 1,
19907 CURRY_BOUND_FLAG = 4,
19908 CURRY_FLAG = 8,
19909 ARY_FLAG = 128,
19910 REARG_FLAG = 256;
19911
19912/** Used as the internal argument placeholder. */
19913var PLACEHOLDER = '__lodash_placeholder__';
19914
19915/* Native method references for those with the same name as other `lodash` methods. */
19916var nativeMin = Math.min;
19917
19918/**
19919 * Merges the function metadata of `source` into `data`.
19920 *
19921 * Merging metadata reduces the number of wrappers required to invoke a function.
19922 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
19923 * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
19924 * augment function arguments, making the order in which they are executed important,
19925 * preventing the merging of metadata. However, we make an exception for a safe
19926 * common case where curried functions have `_.ary` and or `_.rearg` applied.
19927 *
19928 * @private
19929 * @param {Array} data The destination metadata.
19930 * @param {Array} source The source metadata.
19931 * @returns {Array} Returns `data`.
19932 */
19933function mergeData(data, source) {
19934 var bitmask = data[1],
19935 srcBitmask = source[1],
19936 newBitmask = bitmask | srcBitmask,
19937 isCommon = newBitmask < ARY_FLAG;
19938
19939 var isCombo =
19940 (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
19941 (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
19942 (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
19943
19944 // Exit early if metadata can't be merged.
19945 if (!(isCommon || isCombo)) {
19946 return data;
19947 }
19948 // Use source `thisArg` if available.
19949 if (srcBitmask & BIND_FLAG) {
19950 data[2] = source[2];
19951 // Set when currying a bound function.
19952 newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
19953 }
19954 // Compose partial arguments.
19955 var value = source[3];
19956 if (value) {
19957 var partials = data[3];
19958 data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
19959 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
19960 }
19961 // Compose partial right arguments.
19962 value = source[5];
19963 if (value) {
19964 partials = data[5];
19965 data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
19966 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
19967 }
19968 // Use source `argPos` if available.
19969 value = source[7];
19970 if (value) {
19971 data[7] = arrayCopy(value);
19972 }
19973 // Use source `ary` if it's smaller.
19974 if (srcBitmask & ARY_FLAG) {
19975 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
19976 }
19977 // Use source `arity` if one is not provided.
19978 if (data[9] == null) {
19979 data[9] = source[9];
19980 }
19981 // Use source `func` and merge bitmasks.
19982 data[0] = source[0];
19983 data[1] = newBitmask;
19984
19985 return data;
19986}
19987
19988module.exports = mergeData;
19989
Jian Li83d87a72016-04-20 15:38:24 -070019990},{"./arrayCopy":66,"./composeArgs":100,"./composeArgsRight":101,"./replaceHolders":136}],133:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070019991(function (global){
19992var getNative = require('./getNative');
19993
19994/** Native method references. */
19995var WeakMap = getNative(global, 'WeakMap');
19996
19997/** Used to store function metadata. */
19998var metaMap = WeakMap && new WeakMap;
19999
20000module.exports = metaMap;
20001
20002}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
Jian Li83d87a72016-04-20 15:38:24 -070020003//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9sb2Rhc2gtY29tcGF0L2ludGVybmFsL21ldGFNYXAuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2V0TmF0aXZlID0gcmVxdWlyZSgnLi9nZXROYXRpdmUnKTtcblxuLyoqIE5hdGl2ZSBtZXRob2QgcmVmZXJlbmNlcy4gKi9cbnZhciBXZWFrTWFwID0gZ2V0TmF0aXZlKGdsb2JhbCwgJ1dlYWtNYXAnKTtcblxuLyoqIFVzZWQgdG8gc3RvcmUgZnVuY3Rpb24gbWV0YWRhdGEuICovXG52YXIgbWV0YU1hcCA9IFdlYWtNYXAgJiYgbmV3IFdlYWtNYXA7XG5cbm1vZHVsZS5leHBvcnRzID0gbWV0YU1hcDtcbiJdfQ==
20004},{"./getNative":118}],134:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020005/** Used to lookup unminified function names. */
20006var realNames = {};
20007
20008module.exports = realNames;
20009
Jian Li83d87a72016-04-20 15:38:24 -070020010},{}],135:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020011var arrayCopy = require('./arrayCopy'),
20012 isIndex = require('./isIndex');
20013
20014/* Native method references for those with the same name as other `lodash` methods. */
20015var nativeMin = Math.min;
20016
20017/**
20018 * Reorder `array` according to the specified indexes where the element at
20019 * the first index is assigned as the first element, the element at
20020 * the second index is assigned as the second element, and so on.
20021 *
20022 * @private
20023 * @param {Array} array The array to reorder.
20024 * @param {Array} indexes The arranged array indexes.
20025 * @returns {Array} Returns `array`.
20026 */
20027function reorder(array, indexes) {
20028 var arrLength = array.length,
20029 length = nativeMin(indexes.length, arrLength),
20030 oldArray = arrayCopy(array);
20031
20032 while (length--) {
20033 var index = indexes[length];
20034 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
20035 }
20036 return array;
20037}
20038
20039module.exports = reorder;
20040
Jian Li83d87a72016-04-20 15:38:24 -070020041},{"./arrayCopy":66,"./isIndex":125}],136:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020042/** Used as the internal argument placeholder. */
20043var PLACEHOLDER = '__lodash_placeholder__';
20044
20045/**
20046 * Replaces all `placeholder` elements in `array` with an internal placeholder
20047 * and returns an array of their indexes.
20048 *
20049 * @private
20050 * @param {Array} array The array to modify.
20051 * @param {*} placeholder The placeholder to replace.
20052 * @returns {Array} Returns the new array of placeholder indexes.
20053 */
20054function replaceHolders(array, placeholder) {
20055 var index = -1,
20056 length = array.length,
20057 resIndex = -1,
20058 result = [];
20059
20060 while (++index < length) {
20061 if (array[index] === placeholder) {
20062 array[index] = PLACEHOLDER;
20063 result[++resIndex] = index;
20064 }
20065 }
20066 return result;
20067}
20068
20069module.exports = replaceHolders;
20070
Jian Li83d87a72016-04-20 15:38:24 -070020071},{}],137:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020072var baseSetData = require('./baseSetData'),
20073 now = require('../date/now');
20074
20075/** Used to detect when a function becomes hot. */
20076var HOT_COUNT = 150,
20077 HOT_SPAN = 16;
20078
20079/**
20080 * Sets metadata for `func`.
20081 *
20082 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
20083 * period of time, it will trip its breaker and transition to an identity function
20084 * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
20085 * for more details.
20086 *
20087 * @private
20088 * @param {Function} func The function to associate metadata with.
20089 * @param {*} data The metadata.
20090 * @returns {Function} Returns `func`.
20091 */
20092var setData = (function() {
20093 var count = 0,
20094 lastCalled = 0;
20095
20096 return function(key, value) {
20097 var stamp = now(),
20098 remaining = HOT_SPAN - (stamp - lastCalled);
20099
20100 lastCalled = stamp;
20101 if (remaining > 0) {
20102 if (++count >= HOT_COUNT) {
20103 return key;
20104 }
20105 } else {
20106 count = 0;
20107 }
20108 return baseSetData(key, value);
20109 };
20110}());
20111
20112module.exports = setData;
20113
Jian Li83d87a72016-04-20 15:38:24 -070020114},{"../date/now":61,"./baseSetData":92}],138:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020115var isArguments = require('../lang/isArguments'),
20116 isArray = require('../lang/isArray'),
20117 isIndex = require('./isIndex'),
20118 isLength = require('./isLength'),
20119 isString = require('../lang/isString'),
20120 keysIn = require('../object/keysIn');
20121
20122/** Used for native method references. */
20123var objectProto = Object.prototype;
20124
20125/** Used to check objects for own properties. */
20126var hasOwnProperty = objectProto.hasOwnProperty;
20127
20128/**
20129 * A fallback implementation of `Object.keys` which creates an array of the
20130 * own enumerable property names of `object`.
20131 *
20132 * @private
20133 * @param {Object} object The object to query.
20134 * @returns {Array} Returns the array of property names.
20135 */
20136function shimKeys(object) {
20137 var props = keysIn(object),
20138 propsLength = props.length,
20139 length = propsLength && object.length;
20140
20141 var allowIndexes = !!length && isLength(length) &&
20142 (isArray(object) || isArguments(object) || isString(object));
20143
20144 var index = -1,
20145 result = [];
20146
20147 while (++index < propsLength) {
20148 var key = props[index];
20149 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
20150 result.push(key);
20151 }
20152 }
20153 return result;
20154}
20155
20156module.exports = shimKeys;
20157
Jian Li83d87a72016-04-20 15:38:24 -070020158},{"../lang/isArguments":143,"../lang/isArray":144,"../lang/isString":150,"../object/keysIn":154,"./isIndex":125,"./isLength":129}],139:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020159var isObject = require('../lang/isObject'),
20160 isString = require('../lang/isString'),
20161 support = require('../support');
20162
20163/**
20164 * Converts `value` to an object if it's not one.
20165 *
20166 * @private
20167 * @param {*} value The value to process.
20168 * @returns {Object} Returns the object.
20169 */
20170function toObject(value) {
20171 if (support.unindexedChars && isString(value)) {
20172 var index = -1,
20173 length = value.length,
20174 result = Object(value);
20175
20176 while (++index < length) {
20177 result[index] = value.charAt(index);
20178 }
20179 return result;
20180 }
20181 return isObject(value) ? value : Object(value);
20182}
20183
20184module.exports = toObject;
20185
Jian Li83d87a72016-04-20 15:38:24 -070020186},{"../lang/isObject":148,"../lang/isString":150,"../support":157}],140:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020187var baseToString = require('./baseToString'),
20188 isArray = require('../lang/isArray');
20189
20190/** Used to match property names within property paths. */
20191var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
20192
20193/** Used to match backslashes in property paths. */
20194var reEscapeChar = /\\(\\)?/g;
20195
20196/**
20197 * Converts `value` to property path array if it's not one.
20198 *
20199 * @private
20200 * @param {*} value The value to process.
20201 * @returns {Array} Returns the property path array.
20202 */
20203function toPath(value) {
20204 if (isArray(value)) {
20205 return value;
20206 }
20207 var result = [];
20208 baseToString(value).replace(rePropName, function(match, number, quote, string) {
20209 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
20210 });
20211 return result;
20212}
20213
20214module.exports = toPath;
20215
Jian Li83d87a72016-04-20 15:38:24 -070020216},{"../lang/isArray":144,"./baseToString":94}],141:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020217var LazyWrapper = require('./LazyWrapper'),
20218 LodashWrapper = require('./LodashWrapper'),
20219 arrayCopy = require('./arrayCopy');
20220
20221/**
20222 * Creates a clone of `wrapper`.
20223 *
20224 * @private
20225 * @param {Object} wrapper The wrapper to clone.
20226 * @returns {Object} Returns the cloned wrapper.
20227 */
20228function wrapperClone(wrapper) {
20229 return wrapper instanceof LazyWrapper
20230 ? wrapper.clone()
20231 : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
20232}
20233
20234module.exports = wrapperClone;
20235
Jian Li83d87a72016-04-20 15:38:24 -070020236},{"./LazyWrapper":64,"./LodashWrapper":65,"./arrayCopy":66}],142:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020237var baseClone = require('../internal/baseClone'),
20238 bindCallback = require('../internal/bindCallback');
20239
20240/**
Jian Li83d87a72016-04-20 15:38:24 -070020241 * Creates a deep clone of `value`. If `customizer` is provided it's invoked
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020242 * to produce the cloned values. If `customizer` returns `undefined` cloning
20243 * is handled by the method instead. The `customizer` is bound to `thisArg`
Jian Li83d87a72016-04-20 15:38:24 -070020244 * and invoked with up to three argument; (value [, index|key, object]).
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020245 *
20246 * **Note:** This method is loosely based on the
20247 * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
20248 * The enumerable properties of `arguments` objects and objects created by
20249 * constructors other than `Object` are cloned to plain `Object` objects. An
20250 * empty object is returned for uncloneable values such as functions, DOM nodes,
20251 * Maps, Sets, and WeakMaps.
20252 *
20253 * @static
20254 * @memberOf _
20255 * @category Lang
20256 * @param {*} value The value to deep clone.
20257 * @param {Function} [customizer] The function to customize cloning values.
20258 * @param {*} [thisArg] The `this` binding of `customizer`.
20259 * @returns {*} Returns the deep cloned value.
20260 * @example
20261 *
20262 * var users = [
20263 * { 'user': 'barney' },
20264 * { 'user': 'fred' }
20265 * ];
20266 *
20267 * var deep = _.cloneDeep(users);
20268 * deep[0] === users[0];
20269 * // => false
20270 *
20271 * // using a customizer callback
20272 * var el = _.cloneDeep(document.body, function(value) {
20273 * if (_.isElement(value)) {
20274 * return value.cloneNode(true);
20275 * }
20276 * });
20277 *
20278 * el === document.body
20279 * // => false
20280 * el.nodeName
20281 * // => BODY
20282 * el.childNodes.length;
20283 * // => 20
20284 */
20285function cloneDeep(value, customizer, thisArg) {
20286 return typeof customizer == 'function'
Jian Li83d87a72016-04-20 15:38:24 -070020287 ? baseClone(value, true, bindCallback(customizer, thisArg, 3))
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020288 : baseClone(value, true);
20289}
20290
20291module.exports = cloneDeep;
20292
Jian Li83d87a72016-04-20 15:38:24 -070020293},{"../internal/baseClone":72,"../internal/bindCallback":98}],143:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020294var isArrayLike = require('../internal/isArrayLike'),
Jian Li83d87a72016-04-20 15:38:24 -070020295 isObjectLike = require('../internal/isObjectLike');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020296
20297/** Used for native method references. */
20298var objectProto = Object.prototype;
20299
20300/** Used to check objects for own properties. */
20301var hasOwnProperty = objectProto.hasOwnProperty;
20302
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020303/** Native method references. */
20304var propertyIsEnumerable = objectProto.propertyIsEnumerable;
20305
20306/**
20307 * Checks if `value` is classified as an `arguments` object.
20308 *
20309 * @static
20310 * @memberOf _
20311 * @category Lang
20312 * @param {*} value The value to check.
20313 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20314 * @example
20315 *
20316 * _.isArguments(function() { return arguments; }());
20317 * // => true
20318 *
20319 * _.isArguments([1, 2, 3]);
20320 * // => false
20321 */
20322function isArguments(value) {
Jian Li83d87a72016-04-20 15:38:24 -070020323 return isObjectLike(value) && isArrayLike(value) &&
20324 hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020325}
20326
20327module.exports = isArguments;
20328
Jian Li83d87a72016-04-20 15:38:24 -070020329},{"../internal/isArrayLike":123,"../internal/isObjectLike":130}],144:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020330var getNative = require('../internal/getNative'),
20331 isLength = require('../internal/isLength'),
20332 isObjectLike = require('../internal/isObjectLike');
20333
20334/** `Object#toString` result references. */
20335var arrayTag = '[object Array]';
20336
20337/** Used for native method references. */
20338var objectProto = Object.prototype;
20339
20340/**
Jian Li83d87a72016-04-20 15:38:24 -070020341 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020342 * of values.
20343 */
20344var objToString = objectProto.toString;
20345
20346/* Native method references for those with the same name as other `lodash` methods. */
20347var nativeIsArray = getNative(Array, 'isArray');
20348
20349/**
20350 * Checks if `value` is classified as an `Array` object.
20351 *
20352 * @static
20353 * @memberOf _
20354 * @category Lang
20355 * @param {*} value The value to check.
20356 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20357 * @example
20358 *
20359 * _.isArray([1, 2, 3]);
20360 * // => true
20361 *
20362 * _.isArray(function() { return arguments; }());
20363 * // => false
20364 */
20365var isArray = nativeIsArray || function(value) {
20366 return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
20367};
20368
20369module.exports = isArray;
20370
Jian Li83d87a72016-04-20 15:38:24 -070020371},{"../internal/getNative":118,"../internal/isLength":129,"../internal/isObjectLike":130}],145:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020372var isArguments = require('./isArguments'),
20373 isArray = require('./isArray'),
20374 isArrayLike = require('../internal/isArrayLike'),
20375 isFunction = require('./isFunction'),
20376 isObjectLike = require('../internal/isObjectLike'),
20377 isString = require('./isString'),
20378 keys = require('../object/keys');
20379
20380/**
Jian Li83d87a72016-04-20 15:38:24 -070020381 * Checks if `value` is empty. A value is considered empty unless it's an
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020382 * `arguments` object, array, string, or jQuery-like collection with a length
20383 * greater than `0` or an object with own enumerable properties.
20384 *
20385 * @static
20386 * @memberOf _
20387 * @category Lang
20388 * @param {Array|Object|string} value The value to inspect.
20389 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
20390 * @example
20391 *
20392 * _.isEmpty(null);
20393 * // => true
20394 *
20395 * _.isEmpty(true);
20396 * // => true
20397 *
20398 * _.isEmpty(1);
20399 * // => true
20400 *
20401 * _.isEmpty([1, 2, 3]);
20402 * // => false
20403 *
20404 * _.isEmpty({ 'a': 1 });
20405 * // => false
20406 */
20407function isEmpty(value) {
20408 if (value == null) {
20409 return true;
20410 }
20411 if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
20412 (isObjectLike(value) && isFunction(value.splice)))) {
20413 return !value.length;
20414 }
20415 return !keys(value).length;
20416}
20417
20418module.exports = isEmpty;
20419
Jian Li83d87a72016-04-20 15:38:24 -070020420},{"../internal/isArrayLike":123,"../internal/isObjectLike":130,"../object/keys":153,"./isArguments":143,"./isArray":144,"./isFunction":146,"./isString":150}],146:[function(require,module,exports){
20421var isObject = require('./isObject');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020422
20423/** `Object#toString` result references. */
20424var funcTag = '[object Function]';
20425
20426/** Used for native method references. */
20427var objectProto = Object.prototype;
20428
20429/**
Jian Li83d87a72016-04-20 15:38:24 -070020430 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020431 * of values.
20432 */
20433var objToString = objectProto.toString;
20434
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020435/**
20436 * Checks if `value` is classified as a `Function` object.
20437 *
20438 * @static
20439 * @memberOf _
20440 * @category Lang
20441 * @param {*} value The value to check.
20442 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20443 * @example
20444 *
20445 * _.isFunction(_);
20446 * // => true
20447 *
20448 * _.isFunction(/abc/);
20449 * // => false
20450 */
Jian Li83d87a72016-04-20 15:38:24 -070020451function isFunction(value) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020452 // The use of `Object#toString` avoids issues with the `typeof` operator
20453 // in older versions of Chrome and Safari which return 'function' for regexes
Jian Li83d87a72016-04-20 15:38:24 -070020454 // and Safari 8 which returns 'object' for typed array constructors.
20455 return isObject(value) && objToString.call(value) == funcTag;
20456}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020457
20458module.exports = isFunction;
20459
Jian Li83d87a72016-04-20 15:38:24 -070020460},{"./isObject":148}],147:[function(require,module,exports){
20461var isFunction = require('./isFunction'),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020462 isHostObject = require('../internal/isHostObject'),
20463 isObjectLike = require('../internal/isObjectLike');
20464
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020465/** Used to detect host constructors (Safari > 5). */
20466var reIsHostCtor = /^\[object .+?Constructor\]$/;
20467
20468/** Used for native method references. */
20469var objectProto = Object.prototype;
20470
20471/** Used to resolve the decompiled source of functions. */
20472var fnToString = Function.prototype.toString;
20473
20474/** Used to check objects for own properties. */
20475var hasOwnProperty = objectProto.hasOwnProperty;
20476
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020477/** Used to detect if a method is native. */
20478var reIsNative = RegExp('^' +
Jian Li83d87a72016-04-20 15:38:24 -070020479 fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020480 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
20481);
20482
20483/**
20484 * Checks if `value` is a native function.
20485 *
20486 * @static
20487 * @memberOf _
20488 * @category Lang
20489 * @param {*} value The value to check.
20490 * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
20491 * @example
20492 *
20493 * _.isNative(Array.prototype.push);
20494 * // => true
20495 *
20496 * _.isNative(_);
20497 * // => false
20498 */
20499function isNative(value) {
20500 if (value == null) {
20501 return false;
20502 }
Jian Li83d87a72016-04-20 15:38:24 -070020503 if (isFunction(value)) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020504 return reIsNative.test(fnToString.call(value));
20505 }
20506 return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
20507}
20508
20509module.exports = isNative;
20510
Jian Li83d87a72016-04-20 15:38:24 -070020511},{"../internal/isHostObject":124,"../internal/isObjectLike":130,"./isFunction":146}],148:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020512/**
20513 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
20514 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
20515 *
20516 * @static
20517 * @memberOf _
20518 * @category Lang
20519 * @param {*} value The value to check.
20520 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
20521 * @example
20522 *
20523 * _.isObject({});
20524 * // => true
20525 *
20526 * _.isObject([1, 2, 3]);
20527 * // => true
20528 *
20529 * _.isObject(1);
20530 * // => false
20531 */
20532function isObject(value) {
20533 // Avoid a V8 JIT bug in Chrome 19-20.
20534 // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
20535 var type = typeof value;
20536 return !!value && (type == 'object' || type == 'function');
20537}
20538
20539module.exports = isObject;
20540
20541},{}],149:[function(require,module,exports){
Jian Li83d87a72016-04-20 15:38:24 -070020542var baseForIn = require('../internal/baseForIn'),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020543 isArguments = require('./isArguments'),
Jian Li83d87a72016-04-20 15:38:24 -070020544 isHostObject = require('../internal/isHostObject'),
20545 isObjectLike = require('../internal/isObjectLike'),
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020546 support = require('../support');
20547
20548/** `Object#toString` result references. */
20549var objectTag = '[object Object]';
20550
20551/** Used for native method references. */
20552var objectProto = Object.prototype;
20553
Jian Li83d87a72016-04-20 15:38:24 -070020554/** Used to check objects for own properties. */
20555var hasOwnProperty = objectProto.hasOwnProperty;
20556
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020557/**
Jian Li83d87a72016-04-20 15:38:24 -070020558 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020559 * of values.
20560 */
20561var objToString = objectProto.toString;
20562
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020563/**
20564 * Checks if `value` is a plain object, that is, an object created by the
20565 * `Object` constructor or one with a `[[Prototype]]` of `null`.
20566 *
20567 * **Note:** This method assumes objects created by the `Object` constructor
20568 * have no inherited enumerable properties.
20569 *
20570 * @static
20571 * @memberOf _
20572 * @category Lang
20573 * @param {*} value The value to check.
20574 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
20575 * @example
20576 *
20577 * function Foo() {
20578 * this.a = 1;
20579 * }
20580 *
20581 * _.isPlainObject(new Foo);
20582 * // => false
20583 *
20584 * _.isPlainObject([1, 2, 3]);
20585 * // => false
20586 *
20587 * _.isPlainObject({ 'x': 0, 'y': 0 });
20588 * // => true
20589 *
20590 * _.isPlainObject(Object.create(null));
20591 * // => true
20592 */
Jian Li83d87a72016-04-20 15:38:24 -070020593function isPlainObject(value) {
20594 var Ctor;
20595
20596 // Exit early for non `Object` objects.
20597 if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) ||
20598 (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020599 return false;
20600 }
Jian Li83d87a72016-04-20 15:38:24 -070020601 // IE < 9 iterates inherited properties before own properties. If the first
20602 // iterated property is an object's own property then there are no inherited
20603 // enumerable properties.
20604 var result;
20605 if (support.ownLast) {
20606 baseForIn(value, function(subValue, key, object) {
20607 result = hasOwnProperty.call(object, key);
20608 return false;
20609 });
20610 return result !== false;
20611 }
20612 // In most environments an object's own properties are iterated before
20613 // its inherited properties. If the last iterated property is an object's
20614 // own property then there are no inherited enumerable properties.
20615 baseForIn(value, function(subValue, key) {
20616 result = key;
20617 });
20618 return result === undefined || hasOwnProperty.call(value, result);
20619}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020620
20621module.exports = isPlainObject;
20622
Jian Li83d87a72016-04-20 15:38:24 -070020623},{"../internal/baseForIn":79,"../internal/isHostObject":124,"../internal/isObjectLike":130,"../support":157,"./isArguments":143}],150:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020624var isObjectLike = require('../internal/isObjectLike');
20625
20626/** `Object#toString` result references. */
20627var stringTag = '[object String]';
20628
20629/** Used for native method references. */
20630var objectProto = Object.prototype;
20631
20632/**
Jian Li83d87a72016-04-20 15:38:24 -070020633 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020634 * of values.
20635 */
20636var objToString = objectProto.toString;
20637
20638/**
20639 * Checks if `value` is classified as a `String` primitive or object.
20640 *
20641 * @static
20642 * @memberOf _
20643 * @category Lang
20644 * @param {*} value The value to check.
20645 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20646 * @example
20647 *
20648 * _.isString('abc');
20649 * // => true
20650 *
20651 * _.isString(1);
20652 * // => false
20653 */
20654function isString(value) {
20655 return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
20656}
20657
20658module.exports = isString;
20659
Jian Li83d87a72016-04-20 15:38:24 -070020660},{"../internal/isObjectLike":130}],151:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020661var isLength = require('../internal/isLength'),
20662 isObjectLike = require('../internal/isObjectLike');
20663
20664/** `Object#toString` result references. */
20665var argsTag = '[object Arguments]',
20666 arrayTag = '[object Array]',
20667 boolTag = '[object Boolean]',
20668 dateTag = '[object Date]',
20669 errorTag = '[object Error]',
20670 funcTag = '[object Function]',
20671 mapTag = '[object Map]',
20672 numberTag = '[object Number]',
20673 objectTag = '[object Object]',
20674 regexpTag = '[object RegExp]',
20675 setTag = '[object Set]',
20676 stringTag = '[object String]',
20677 weakMapTag = '[object WeakMap]';
20678
20679var arrayBufferTag = '[object ArrayBuffer]',
20680 float32Tag = '[object Float32Array]',
20681 float64Tag = '[object Float64Array]',
20682 int8Tag = '[object Int8Array]',
20683 int16Tag = '[object Int16Array]',
20684 int32Tag = '[object Int32Array]',
20685 uint8Tag = '[object Uint8Array]',
20686 uint8ClampedTag = '[object Uint8ClampedArray]',
20687 uint16Tag = '[object Uint16Array]',
20688 uint32Tag = '[object Uint32Array]';
20689
20690/** Used to identify `toStringTag` values of typed arrays. */
20691var typedArrayTags = {};
20692typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
20693typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
20694typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
20695typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
20696typedArrayTags[uint32Tag] = true;
20697typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
20698typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
20699typedArrayTags[dateTag] = typedArrayTags[errorTag] =
20700typedArrayTags[funcTag] = typedArrayTags[mapTag] =
20701typedArrayTags[numberTag] = typedArrayTags[objectTag] =
20702typedArrayTags[regexpTag] = typedArrayTags[setTag] =
20703typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
20704
20705/** Used for native method references. */
20706var objectProto = Object.prototype;
20707
20708/**
Jian Li83d87a72016-04-20 15:38:24 -070020709 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020710 * of values.
20711 */
20712var objToString = objectProto.toString;
20713
20714/**
20715 * Checks if `value` is classified as a typed array.
20716 *
20717 * @static
20718 * @memberOf _
20719 * @category Lang
20720 * @param {*} value The value to check.
20721 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
20722 * @example
20723 *
20724 * _.isTypedArray(new Uint8Array);
20725 * // => true
20726 *
20727 * _.isTypedArray([]);
20728 * // => false
20729 */
20730function isTypedArray(value) {
20731 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
20732}
20733
20734module.exports = isTypedArray;
20735
Jian Li83d87a72016-04-20 15:38:24 -070020736},{"../internal/isLength":129,"../internal/isObjectLike":130}],152:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020737/**
20738 * Checks if `value` is `undefined`.
20739 *
20740 * @static
20741 * @memberOf _
20742 * @category Lang
20743 * @param {*} value The value to check.
20744 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
20745 * @example
20746 *
20747 * _.isUndefined(void 0);
20748 * // => true
20749 *
20750 * _.isUndefined(null);
20751 * // => false
20752 */
20753function isUndefined(value) {
20754 return value === undefined;
20755}
20756
20757module.exports = isUndefined;
20758
20759},{}],153:[function(require,module,exports){
20760var getNative = require('../internal/getNative'),
20761 isArrayLike = require('../internal/isArrayLike'),
20762 isObject = require('../lang/isObject'),
20763 shimKeys = require('../internal/shimKeys'),
20764 support = require('../support');
20765
20766/* Native method references for those with the same name as other `lodash` methods. */
20767var nativeKeys = getNative(Object, 'keys');
20768
20769/**
20770 * Creates an array of the own enumerable property names of `object`.
20771 *
20772 * **Note:** Non-object values are coerced to objects. See the
Jian Li83d87a72016-04-20 15:38:24 -070020773 * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020774 * for more details.
20775 *
20776 * @static
20777 * @memberOf _
20778 * @category Object
20779 * @param {Object} object The object to query.
20780 * @returns {Array} Returns the array of property names.
20781 * @example
20782 *
20783 * function Foo() {
20784 * this.a = 1;
20785 * this.b = 2;
20786 * }
20787 *
20788 * Foo.prototype.c = 3;
20789 *
20790 * _.keys(new Foo);
20791 * // => ['a', 'b'] (iteration order is not guaranteed)
20792 *
20793 * _.keys('hi');
20794 * // => ['0', '1']
20795 */
20796var keys = !nativeKeys ? shimKeys : function(object) {
Jian Li83d87a72016-04-20 15:38:24 -070020797 var Ctor = object == null ? undefined : object.constructor;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020798 if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
20799 (typeof object == 'function' ? support.enumPrototypes : isArrayLike(object))) {
20800 return shimKeys(object);
20801 }
20802 return isObject(object) ? nativeKeys(object) : [];
20803};
20804
20805module.exports = keys;
20806
Jian Li83d87a72016-04-20 15:38:24 -070020807},{"../internal/getNative":118,"../internal/isArrayLike":123,"../internal/shimKeys":138,"../lang/isObject":148,"../support":157}],154:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020808var arrayEach = require('../internal/arrayEach'),
20809 isArguments = require('../lang/isArguments'),
20810 isArray = require('../lang/isArray'),
20811 isFunction = require('../lang/isFunction'),
20812 isIndex = require('../internal/isIndex'),
20813 isLength = require('../internal/isLength'),
20814 isObject = require('../lang/isObject'),
20815 isString = require('../lang/isString'),
20816 support = require('../support');
20817
20818/** `Object#toString` result references. */
20819var arrayTag = '[object Array]',
20820 boolTag = '[object Boolean]',
20821 dateTag = '[object Date]',
20822 errorTag = '[object Error]',
20823 funcTag = '[object Function]',
20824 numberTag = '[object Number]',
20825 objectTag = '[object Object]',
20826 regexpTag = '[object RegExp]',
20827 stringTag = '[object String]';
20828
20829/** Used to fix the JScript `[[DontEnum]]` bug. */
20830var shadowProps = [
20831 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
20832 'toLocaleString', 'toString', 'valueOf'
20833];
20834
20835/** Used for native method references. */
20836var errorProto = Error.prototype,
20837 objectProto = Object.prototype,
20838 stringProto = String.prototype;
20839
20840/** Used to check objects for own properties. */
20841var hasOwnProperty = objectProto.hasOwnProperty;
20842
20843/**
Jian Li83d87a72016-04-20 15:38:24 -070020844 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020845 * of values.
20846 */
20847var objToString = objectProto.toString;
20848
20849/** Used to avoid iterating over non-enumerable properties in IE < 9. */
20850var nonEnumProps = {};
20851nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
20852nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true };
20853nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true };
20854nonEnumProps[objectTag] = { 'constructor': true };
20855
20856arrayEach(shadowProps, function(key) {
20857 for (var tag in nonEnumProps) {
20858 if (hasOwnProperty.call(nonEnumProps, tag)) {
20859 var props = nonEnumProps[tag];
20860 props[key] = hasOwnProperty.call(props, key);
20861 }
20862 }
20863});
20864
20865/**
20866 * Creates an array of the own and inherited enumerable property names of `object`.
20867 *
20868 * **Note:** Non-object values are coerced to objects.
20869 *
20870 * @static
20871 * @memberOf _
20872 * @category Object
20873 * @param {Object} object The object to query.
20874 * @returns {Array} Returns the array of property names.
20875 * @example
20876 *
20877 * function Foo() {
20878 * this.a = 1;
20879 * this.b = 2;
20880 * }
20881 *
20882 * Foo.prototype.c = 3;
20883 *
20884 * _.keysIn(new Foo);
20885 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
20886 */
20887function keysIn(object) {
20888 if (object == null) {
20889 return [];
20890 }
20891 if (!isObject(object)) {
20892 object = Object(object);
20893 }
20894 var length = object.length;
20895
20896 length = (length && isLength(length) &&
20897 (isArray(object) || isArguments(object) || isString(object)) && length) || 0;
20898
20899 var Ctor = object.constructor,
20900 index = -1,
20901 proto = (isFunction(Ctor) && Ctor.prototype) || objectProto,
20902 isProto = proto === object,
20903 result = Array(length),
20904 skipIndexes = length > 0,
20905 skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error),
20906 skipProto = support.enumPrototypes && isFunction(object);
20907
20908 while (++index < length) {
20909 result[index] = (index + '');
20910 }
Jian Li83d87a72016-04-20 15:38:24 -070020911 // lodash skips the `constructor` property when it infers it's iterating
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020912 // over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
20913 // attribute of an existing property and the `constructor` property of a
20914 // prototype defaults to non-enumerable.
20915 for (var key in object) {
20916 if (!(skipProto && key == 'prototype') &&
20917 !(skipErrorProps && (key == 'message' || key == 'name')) &&
20918 !(skipIndexes && isIndex(key, length)) &&
20919 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
20920 result.push(key);
20921 }
20922 }
20923 if (support.nonEnumShadows && object !== objectProto) {
20924 var tag = object === stringProto ? stringTag : (object === errorProto ? errorTag : objToString.call(object)),
20925 nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag];
20926
20927 if (tag == objectTag) {
20928 proto = objectProto;
20929 }
20930 length = shadowProps.length;
20931 while (length--) {
20932 key = shadowProps[length];
20933 var nonEnum = nonEnums[key];
20934 if (!(isProto && nonEnum) &&
20935 (nonEnum ? hasOwnProperty.call(object, key) : object[key] !== proto[key])) {
20936 result.push(key);
20937 }
20938 }
20939 }
20940 return result;
20941}
20942
20943module.exports = keysIn;
20944
Jian Li83d87a72016-04-20 15:38:24 -070020945},{"../internal/arrayEach":67,"../internal/isIndex":125,"../internal/isLength":129,"../lang/isArguments":143,"../lang/isArray":144,"../lang/isFunction":146,"../lang/isObject":148,"../lang/isString":150,"../support":157}],155:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070020946var keys = require('./keys'),
20947 toObject = require('../internal/toObject');
20948
20949/**
20950 * Creates a two dimensional array of the key-value pairs for `object`,
20951 * e.g. `[[key1, value1], [key2, value2]]`.
20952 *
20953 * @static
20954 * @memberOf _
20955 * @category Object
20956 * @param {Object} object The object to query.
20957 * @returns {Array} Returns the new array of key-value pairs.
20958 * @example
20959 *
20960 * _.pairs({ 'barney': 36, 'fred': 40 });
20961 * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
20962 */
20963function pairs(object) {
20964 object = toObject(object);
20965
20966 var index = -1,
20967 props = keys(object),
20968 length = props.length,
20969 result = Array(length);
20970
20971 while (++index < length) {
20972 var key = props[index];
20973 result[index] = [key, object[key]];
20974 }
20975 return result;
20976}
20977
20978module.exports = pairs;
20979
20980},{"../internal/toObject":139,"./keys":153}],156:[function(require,module,exports){
20981var baseValues = require('../internal/baseValues'),
20982 keys = require('./keys');
20983
20984/**
20985 * Creates an array of the own enumerable property values of `object`.
20986 *
20987 * **Note:** Non-object values are coerced to objects.
20988 *
20989 * @static
20990 * @memberOf _
20991 * @category Object
20992 * @param {Object} object The object to query.
20993 * @returns {Array} Returns the array of property values.
20994 * @example
20995 *
20996 * function Foo() {
20997 * this.a = 1;
20998 * this.b = 2;
20999 * }
21000 *
21001 * Foo.prototype.c = 3;
21002 *
21003 * _.values(new Foo);
21004 * // => [1, 2] (iteration order is not guaranteed)
21005 *
21006 * _.values('hi');
21007 * // => ['h', 'i']
21008 */
21009function values(object) {
21010 return baseValues(object, keys(object));
21011}
21012
21013module.exports = values;
21014
Jian Li83d87a72016-04-20 15:38:24 -070021015},{"../internal/baseValues":95,"./keys":153}],157:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021016/** Used for native method references. */
21017var arrayProto = Array.prototype,
21018 errorProto = Error.prototype,
21019 objectProto = Object.prototype;
21020
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021021/** Native method references. */
21022var propertyIsEnumerable = objectProto.propertyIsEnumerable,
21023 splice = arrayProto.splice;
21024
21025/**
21026 * An object environment feature flags.
21027 *
21028 * @static
21029 * @memberOf _
21030 * @type Object
21031 */
21032var support = {};
21033
21034(function(x) {
21035 var Ctor = function() { this.x = x; },
21036 object = { '0': x, 'length': x },
21037 props = [];
21038
21039 Ctor.prototype = { 'valueOf': x, 'y': x };
21040 for (var key in new Ctor) { props.push(key); }
21041
21042 /**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021043 * Detect if `name` or `message` properties of `Error.prototype` are
21044 * enumerable by default (IE < 9, Safari < 5.1).
21045 *
21046 * @memberOf _.support
21047 * @type boolean
21048 */
21049 support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') ||
21050 propertyIsEnumerable.call(errorProto, 'name');
21051
21052 /**
21053 * Detect if `prototype` properties are enumerable by default.
21054 *
21055 * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
21056 * (if the prototype or a property on the prototype has been set)
21057 * incorrectly set the `[[Enumerable]]` value of a function's `prototype`
21058 * property to `true`.
21059 *
21060 * @memberOf _.support
21061 * @type boolean
21062 */
21063 support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
21064
21065 /**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021066 * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
21067 *
21068 * In IE < 9 an object's own properties, shadowing non-enumerable ones,
21069 * are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
21070 *
21071 * @memberOf _.support
21072 * @type boolean
21073 */
21074 support.nonEnumShadows = !/valueOf/.test(props);
21075
21076 /**
21077 * Detect if own properties are iterated after inherited properties (IE < 9).
21078 *
21079 * @memberOf _.support
21080 * @type boolean
21081 */
21082 support.ownLast = props[0] != 'x';
21083
21084 /**
21085 * Detect if `Array#shift` and `Array#splice` augment array-like objects
21086 * correctly.
21087 *
21088 * Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
21089 * `shift()` and `splice()` functions that fail to remove the last element,
21090 * `value[0]`, of array-like objects even though the "length" property is
21091 * set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
21092 * while `splice()` is buggy regardless of mode in IE < 9.
21093 *
21094 * @memberOf _.support
21095 * @type boolean
21096 */
21097 support.spliceObjects = (splice.call(object, 0, 1), !object[0]);
21098
21099 /**
21100 * Detect lack of support for accessing string characters by index.
21101 *
21102 * IE < 8 can't access characters by index. IE 8 can only access characters
21103 * by index on string literals, not string objects.
21104 *
21105 * @memberOf _.support
21106 * @type boolean
21107 */
21108 support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021109}(1, 0));
21110
21111module.exports = support;
21112
Jian Li83d87a72016-04-20 15:38:24 -070021113},{}],158:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021114/**
21115 * This method returns the first argument provided to it.
21116 *
21117 * @static
21118 * @memberOf _
21119 * @category Utility
21120 * @param {*} value Any value.
21121 * @returns {*} Returns `value`.
21122 * @example
21123 *
21124 * var object = { 'user': 'fred' };
21125 *
21126 * _.identity(object) === object;
21127 * // => true
21128 */
21129function identity(value) {
21130 return value;
21131}
21132
21133module.exports = identity;
21134
Jian Li83d87a72016-04-20 15:38:24 -070021135},{}],159:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021136/**
21137 * A no-operation function that returns `undefined` regardless of the
21138 * arguments it receives.
21139 *
21140 * @static
21141 * @memberOf _
21142 * @category Utility
21143 * @example
21144 *
21145 * var object = { 'user': 'fred' };
21146 *
21147 * _.noop(object) === undefined;
21148 * // => true
21149 */
21150function noop() {
21151 // No operation performed.
21152}
21153
21154module.exports = noop;
21155
Jian Li83d87a72016-04-20 15:38:24 -070021156},{}],160:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070021157var baseProperty = require('../internal/baseProperty'),
21158 basePropertyDeep = require('../internal/basePropertyDeep'),
21159 isKey = require('../internal/isKey');
21160
21161/**
21162 * Creates a function that returns the property value at `path` on a
21163 * given object.
21164 *
21165 * @static
21166 * @memberOf _
21167 * @category Utility
21168 * @param {Array|string} path The path of the property to get.
21169 * @returns {Function} Returns the new function.
21170 * @example
21171 *
21172 * var objects = [
21173 * { 'a': { 'b': { 'c': 2 } } },
21174 * { 'a': { 'b': { 'c': 1 } } }
21175 * ];
21176 *
21177 * _.map(objects, _.property('a.b.c'));
21178 * // => [2, 1]
21179 *
21180 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
21181 * // => [1, 2]
21182 */
21183function property(path) {
21184 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
21185}
21186
21187module.exports = property;
21188
Jian Li83d87a72016-04-20 15:38:24 -070021189},{"../internal/baseProperty":90,"../internal/basePropertyDeep":91,"../internal/isKey":127}],161:[function(require,module,exports){
21190(function (process){
21191// vim:ts=4:sts=4:sw=4:
21192/*!
21193 *
21194 * Copyright 2009-2012 Kris Kowal under the terms of the MIT
21195 * license found at http://github.com/kriskowal/q/raw/master/LICENSE
21196 *
21197 * With parts by Tyler Close
21198 * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
21199 * at http://www.opensource.org/licenses/mit-license.html
21200 * Forked at ref_send.js version: 2009-05-11
21201 *
21202 * With parts by Mark Miller
21203 * Copyright (C) 2011 Google Inc.
21204 *
21205 * Licensed under the Apache License, Version 2.0 (the "License");
21206 * you may not use this file except in compliance with the License.
21207 * You may obtain a copy of the License at
21208 *
21209 * http://www.apache.org/licenses/LICENSE-2.0
21210 *
21211 * Unless required by applicable law or agreed to in writing, software
21212 * distributed under the License is distributed on an "AS IS" BASIS,
21213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21214 * See the License for the specific language governing permissions and
21215 * limitations under the License.
21216 *
21217 */
21218
21219(function (definition) {
21220 "use strict";
21221
21222 // This file will function properly as a <script> tag, or a module
21223 // using CommonJS and NodeJS or RequireJS module formats. In
21224 // Common/Node/RequireJS, the module exports the Q API and when
21225 // executed as a simple <script>, it creates a Q global instead.
21226
21227 // Montage Require
21228 if (typeof bootstrap === "function") {
21229 bootstrap("promise", definition);
21230
21231 // CommonJS
21232 } else if (typeof exports === "object" && typeof module === "object") {
21233 module.exports = definition();
21234
21235 // RequireJS
21236 } else if (typeof define === "function" && define.amd) {
21237 define(definition);
21238
21239 // SES (Secure EcmaScript)
21240 } else if (typeof ses !== "undefined") {
21241 if (!ses.ok()) {
21242 return;
21243 } else {
21244 ses.makeQ = definition;
21245 }
21246
21247 // <script>
21248 } else if (typeof window !== "undefined" || typeof self !== "undefined") {
21249 // Prefer window over self for add-on scripts. Use self for
21250 // non-windowed contexts.
21251 var global = typeof window !== "undefined" ? window : self;
21252
21253 // Get the `window` object, save the previous Q global
21254 // and initialize Q as a global.
21255 var previousQ = global.Q;
21256 global.Q = definition();
21257
21258 // Add a noConflict function so Q can be removed from the
21259 // global namespace.
21260 global.Q.noConflict = function () {
21261 global.Q = previousQ;
21262 return this;
21263 };
21264
21265 } else {
21266 throw new Error("This environment was not anticipated by Q. Please file a bug.");
21267 }
21268
21269})(function () {
21270"use strict";
21271
21272var hasStacks = false;
21273try {
21274 throw new Error();
21275} catch (e) {
21276 hasStacks = !!e.stack;
21277}
21278
21279// All code after this point will be filtered from stack traces reported
21280// by Q.
21281var qStartingLine = captureLine();
21282var qFileName;
21283
21284// shims
21285
21286// used for fallback in "allResolved"
21287var noop = function () {};
21288
21289// Use the fastest possible means to execute a task in a future turn
21290// of the event loop.
21291var nextTick =(function () {
21292 // linked list of tasks (single, with head node)
21293 var head = {task: void 0, next: null};
21294 var tail = head;
21295 var flushing = false;
21296 var requestTick = void 0;
21297 var isNodeJS = false;
21298 // queue for late tasks, used by unhandled rejection tracking
21299 var laterQueue = [];
21300
21301 function flush() {
21302 /* jshint loopfunc: true */
21303 var task, domain;
21304
21305 while (head.next) {
21306 head = head.next;
21307 task = head.task;
21308 head.task = void 0;
21309 domain = head.domain;
21310
21311 if (domain) {
21312 head.domain = void 0;
21313 domain.enter();
21314 }
21315 runSingle(task, domain);
21316
21317 }
21318 while (laterQueue.length) {
21319 task = laterQueue.pop();
21320 runSingle(task);
21321 }
21322 flushing = false;
21323 }
21324 // runs a single function in the async queue
21325 function runSingle(task, domain) {
21326 try {
21327 task();
21328
21329 } catch (e) {
21330 if (isNodeJS) {
21331 // In node, uncaught exceptions are considered fatal errors.
21332 // Re-throw them synchronously to interrupt flushing!
21333
21334 // Ensure continuation if the uncaught exception is suppressed
21335 // listening "uncaughtException" events (as domains does).
21336 // Continue in next event to avoid tick recursion.
21337 if (domain) {
21338 domain.exit();
21339 }
21340 setTimeout(flush, 0);
21341 if (domain) {
21342 domain.enter();
21343 }
21344
21345 throw e;
21346
21347 } else {
21348 // In browsers, uncaught exceptions are not fatal.
21349 // Re-throw them asynchronously to avoid slow-downs.
21350 setTimeout(function () {
21351 throw e;
21352 }, 0);
21353 }
21354 }
21355
21356 if (domain) {
21357 domain.exit();
21358 }
21359 }
21360
21361 nextTick = function (task) {
21362 tail = tail.next = {
21363 task: task,
21364 domain: isNodeJS && process.domain,
21365 next: null
21366 };
21367
21368 if (!flushing) {
21369 flushing = true;
21370 requestTick();
21371 }
21372 };
21373
21374 if (typeof process === "object" &&
21375 process.toString() === "[object process]" && process.nextTick) {
21376 // Ensure Q is in a real Node environment, with a `process.nextTick`.
21377 // To see through fake Node environments:
21378 // * Mocha test runner - exposes a `process` global without a `nextTick`
21379 // * Browserify - exposes a `process.nexTick` function that uses
21380 // `setTimeout`. In this case `setImmediate` is preferred because
21381 // it is faster. Browserify's `process.toString()` yields
21382 // "[object Object]", while in a real Node environment
21383 // `process.nextTick()` yields "[object process]".
21384 isNodeJS = true;
21385
21386 requestTick = function () {
21387 process.nextTick(flush);
21388 };
21389
21390 } else if (typeof setImmediate === "function") {
21391 // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate
21392 if (typeof window !== "undefined") {
21393 requestTick = setImmediate.bind(window, flush);
21394 } else {
21395 requestTick = function () {
21396 setImmediate(flush);
21397 };
21398 }
21399
21400 } else if (typeof MessageChannel !== "undefined") {
21401 // modern browsers
21402 // http://www.nonblocking.io/2011/06/windownexttick.html
21403 var channel = new MessageChannel();
21404 // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create
21405 // working message ports the first time a page loads.
21406 channel.port1.onmessage = function () {
21407 requestTick = requestPortTick;
21408 channel.port1.onmessage = flush;
21409 flush();
21410 };
21411 var requestPortTick = function () {
21412 // Opera requires us to provide a message payload, regardless of
21413 // whether we use it.
21414 channel.port2.postMessage(0);
21415 };
21416 requestTick = function () {
21417 setTimeout(flush, 0);
21418 requestPortTick();
21419 };
21420
21421 } else {
21422 // old browsers
21423 requestTick = function () {
21424 setTimeout(flush, 0);
21425 };
21426 }
21427 // runs a task after all other tasks have been run
21428 // this is useful for unhandled rejection tracking that needs to happen
21429 // after all `then`d tasks have been run.
21430 nextTick.runAfter = function (task) {
21431 laterQueue.push(task);
21432 if (!flushing) {
21433 flushing = true;
21434 requestTick();
21435 }
21436 };
21437 return nextTick;
21438})();
21439
21440// Attempt to make generics safe in the face of downstream
21441// modifications.
21442// There is no situation where this is necessary.
21443// If you need a security guarantee, these primordials need to be
21444// deeply frozen anyway, and if you don’t need a security guarantee,
21445// this is just plain paranoid.
21446// However, this **might** have the nice side-effect of reducing the size of
21447// the minified code by reducing x.call() to merely x()
21448// See Mark Miller’s explanation of what this does.
21449// http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
21450var call = Function.call;
21451function uncurryThis(f) {
21452 return function () {
21453 return call.apply(f, arguments);
21454 };
21455}
21456// This is equivalent, but slower:
21457// uncurryThis = Function_bind.bind(Function_bind.call);
21458// http://jsperf.com/uncurrythis
21459
21460var array_slice = uncurryThis(Array.prototype.slice);
21461
21462var array_reduce = uncurryThis(
21463 Array.prototype.reduce || function (callback, basis) {
21464 var index = 0,
21465 length = this.length;
21466 // concerning the initial value, if one is not provided
21467 if (arguments.length === 1) {
21468 // seek to the first value in the array, accounting
21469 // for the possibility that is is a sparse array
21470 do {
21471 if (index in this) {
21472 basis = this[index++];
21473 break;
21474 }
21475 if (++index >= length) {
21476 throw new TypeError();
21477 }
21478 } while (1);
21479 }
21480 // reduce
21481 for (; index < length; index++) {
21482 // account for the possibility that the array is sparse
21483 if (index in this) {
21484 basis = callback(basis, this[index], index);
21485 }
21486 }
21487 return basis;
21488 }
21489);
21490
21491var array_indexOf = uncurryThis(
21492 Array.prototype.indexOf || function (value) {
21493 // not a very good shim, but good enough for our one use of it
21494 for (var i = 0; i < this.length; i++) {
21495 if (this[i] === value) {
21496 return i;
21497 }
21498 }
21499 return -1;
21500 }
21501);
21502
21503var array_map = uncurryThis(
21504 Array.prototype.map || function (callback, thisp) {
21505 var self = this;
21506 var collect = [];
21507 array_reduce(self, function (undefined, value, index) {
21508 collect.push(callback.call(thisp, value, index, self));
21509 }, void 0);
21510 return collect;
21511 }
21512);
21513
21514var object_create = Object.create || function (prototype) {
21515 function Type() { }
21516 Type.prototype = prototype;
21517 return new Type();
21518};
21519
21520var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
21521
21522var object_keys = Object.keys || function (object) {
21523 var keys = [];
21524 for (var key in object) {
21525 if (object_hasOwnProperty(object, key)) {
21526 keys.push(key);
21527 }
21528 }
21529 return keys;
21530};
21531
21532var object_toString = uncurryThis(Object.prototype.toString);
21533
21534function isObject(value) {
21535 return value === Object(value);
21536}
21537
21538// generator related shims
21539
21540// FIXME: Remove this function once ES6 generators are in SpiderMonkey.
21541function isStopIteration(exception) {
21542 return (
21543 object_toString(exception) === "[object StopIteration]" ||
21544 exception instanceof QReturnValue
21545 );
21546}
21547
21548// FIXME: Remove this helper and Q.return once ES6 generators are in
21549// SpiderMonkey.
21550var QReturnValue;
21551if (typeof ReturnValue !== "undefined") {
21552 QReturnValue = ReturnValue;
21553} else {
21554 QReturnValue = function (value) {
21555 this.value = value;
21556 };
21557}
21558
21559// long stack traces
21560
21561var STACK_JUMP_SEPARATOR = "From previous event:";
21562
21563function makeStackTraceLong(error, promise) {
21564 // If possible, transform the error stack trace by removing Node and Q
21565 // cruft, then concatenating with the stack trace of `promise`. See #57.
21566 if (hasStacks &&
21567 promise.stack &&
21568 typeof error === "object" &&
21569 error !== null &&
21570 error.stack &&
21571 error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
21572 ) {
21573 var stacks = [];
21574 for (var p = promise; !!p; p = p.source) {
21575 if (p.stack) {
21576 stacks.unshift(p.stack);
21577 }
21578 }
21579 stacks.unshift(error.stack);
21580
21581 var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
21582 error.stack = filterStackString(concatedStacks);
21583 }
21584}
21585
21586function filterStackString(stackString) {
21587 var lines = stackString.split("\n");
21588 var desiredLines = [];
21589 for (var i = 0; i < lines.length; ++i) {
21590 var line = lines[i];
21591
21592 if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
21593 desiredLines.push(line);
21594 }
21595 }
21596 return desiredLines.join("\n");
21597}
21598
21599function isNodeFrame(stackLine) {
21600 return stackLine.indexOf("(module.js:") !== -1 ||
21601 stackLine.indexOf("(node.js:") !== -1;
21602}
21603
21604function getFileNameAndLineNumber(stackLine) {
21605 // Named functions: "at functionName (filename:lineNumber:columnNumber)"
21606 // In IE10 function name can have spaces ("Anonymous function") O_o
21607 var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
21608 if (attempt1) {
21609 return [attempt1[1], Number(attempt1[2])];
21610 }
21611
21612 // Anonymous functions: "at filename:lineNumber:columnNumber"
21613 var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
21614 if (attempt2) {
21615 return [attempt2[1], Number(attempt2[2])];
21616 }
21617
21618 // Firefox style: "function@filename:lineNumber or @filename:lineNumber"
21619 var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
21620 if (attempt3) {
21621 return [attempt3[1], Number(attempt3[2])];
21622 }
21623}
21624
21625function isInternalFrame(stackLine) {
21626 var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
21627
21628 if (!fileNameAndLineNumber) {
21629 return false;
21630 }
21631
21632 var fileName = fileNameAndLineNumber[0];
21633 var lineNumber = fileNameAndLineNumber[1];
21634
21635 return fileName === qFileName &&
21636 lineNumber >= qStartingLine &&
21637 lineNumber <= qEndingLine;
21638}
21639
21640// discover own file name and line number range for filtering stack
21641// traces
21642function captureLine() {
21643 if (!hasStacks) {
21644 return;
21645 }
21646
21647 try {
21648 throw new Error();
21649 } catch (e) {
21650 var lines = e.stack.split("\n");
21651 var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
21652 var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
21653 if (!fileNameAndLineNumber) {
21654 return;
21655 }
21656
21657 qFileName = fileNameAndLineNumber[0];
21658 return fileNameAndLineNumber[1];
21659 }
21660}
21661
21662function deprecate(callback, name, alternative) {
21663 return function () {
21664 if (typeof console !== "undefined" &&
21665 typeof console.warn === "function") {
21666 console.warn(name + " is deprecated, use " + alternative +
21667 " instead.", new Error("").stack);
21668 }
21669 return callback.apply(callback, arguments);
21670 };
21671}
21672
21673// end of shims
21674// beginning of real work
21675
21676/**
21677 * Constructs a promise for an immediate reference, passes promises through, or
21678 * coerces promises from different systems.
21679 * @param value immediate reference or promise
21680 */
21681function Q(value) {
21682 // If the object is already a Promise, return it directly. This enables
21683 // the resolve function to both be used to created references from objects,
21684 // but to tolerably coerce non-promises to promises.
21685 if (value instanceof Promise) {
21686 return value;
21687 }
21688
21689 // assimilate thenables
21690 if (isPromiseAlike(value)) {
21691 return coerce(value);
21692 } else {
21693 return fulfill(value);
21694 }
21695}
21696Q.resolve = Q;
21697
21698/**
21699 * Performs a task in a future turn of the event loop.
21700 * @param {Function} task
21701 */
21702Q.nextTick = nextTick;
21703
21704/**
21705 * Controls whether or not long stack traces will be on
21706 */
21707Q.longStackSupport = false;
21708
21709// enable long stacks if Q_DEBUG is set
21710if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
21711 Q.longStackSupport = true;
21712}
21713
21714/**
21715 * Constructs a {promise, resolve, reject} object.
21716 *
21717 * `resolve` is a callback to invoke with a more resolved value for the
21718 * promise. To fulfill the promise, invoke `resolve` with any value that is
21719 * not a thenable. To reject the promise, invoke `resolve` with a rejected
21720 * thenable, or invoke `reject` with the reason directly. To resolve the
21721 * promise to another thenable, thus putting it in the same state, invoke
21722 * `resolve` with that other thenable.
21723 */
21724Q.defer = defer;
21725function defer() {
21726 // if "messages" is an "Array", that indicates that the promise has not yet
21727 // been resolved. If it is "undefined", it has been resolved. Each
21728 // element of the messages array is itself an array of complete arguments to
21729 // forward to the resolved promise. We coerce the resolution value to a
21730 // promise using the `resolve` function because it handles both fully
21731 // non-thenable values and other thenables gracefully.
21732 var messages = [], progressListeners = [], resolvedPromise;
21733
21734 var deferred = object_create(defer.prototype);
21735 var promise = object_create(Promise.prototype);
21736
21737 promise.promiseDispatch = function (resolve, op, operands) {
21738 var args = array_slice(arguments);
21739 if (messages) {
21740 messages.push(args);
21741 if (op === "when" && operands[1]) { // progress operand
21742 progressListeners.push(operands[1]);
21743 }
21744 } else {
21745 Q.nextTick(function () {
21746 resolvedPromise.promiseDispatch.apply(resolvedPromise, args);
21747 });
21748 }
21749 };
21750
21751 // XXX deprecated
21752 promise.valueOf = function () {
21753 if (messages) {
21754 return promise;
21755 }
21756 var nearerValue = nearer(resolvedPromise);
21757 if (isPromise(nearerValue)) {
21758 resolvedPromise = nearerValue; // shorten chain
21759 }
21760 return nearerValue;
21761 };
21762
21763 promise.inspect = function () {
21764 if (!resolvedPromise) {
21765 return { state: "pending" };
21766 }
21767 return resolvedPromise.inspect();
21768 };
21769
21770 if (Q.longStackSupport && hasStacks) {
21771 try {
21772 throw new Error();
21773 } catch (e) {
21774 // NOTE: don't try to use `Error.captureStackTrace` or transfer the
21775 // accessor around; that causes memory leaks as per GH-111. Just
21776 // reify the stack trace as a string ASAP.
21777 //
21778 // At the same time, cut off the first line; it's always just
21779 // "[object Promise]\n", as per the `toString`.
21780 promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
21781 }
21782 }
21783
21784 // NOTE: we do the checks for `resolvedPromise` in each method, instead of
21785 // consolidating them into `become`, since otherwise we'd create new
21786 // promises with the lines `become(whatever(value))`. See e.g. GH-252.
21787
21788 function become(newPromise) {
21789 resolvedPromise = newPromise;
21790 promise.source = newPromise;
21791
21792 array_reduce(messages, function (undefined, message) {
21793 Q.nextTick(function () {
21794 newPromise.promiseDispatch.apply(newPromise, message);
21795 });
21796 }, void 0);
21797
21798 messages = void 0;
21799 progressListeners = void 0;
21800 }
21801
21802 deferred.promise = promise;
21803 deferred.resolve = function (value) {
21804 if (resolvedPromise) {
21805 return;
21806 }
21807
21808 become(Q(value));
21809 };
21810
21811 deferred.fulfill = function (value) {
21812 if (resolvedPromise) {
21813 return;
21814 }
21815
21816 become(fulfill(value));
21817 };
21818 deferred.reject = function (reason) {
21819 if (resolvedPromise) {
21820 return;
21821 }
21822
21823 become(reject(reason));
21824 };
21825 deferred.notify = function (progress) {
21826 if (resolvedPromise) {
21827 return;
21828 }
21829
21830 array_reduce(progressListeners, function (undefined, progressListener) {
21831 Q.nextTick(function () {
21832 progressListener(progress);
21833 });
21834 }, void 0);
21835 };
21836
21837 return deferred;
21838}
21839
21840/**
21841 * Creates a Node-style callback that will resolve or reject the deferred
21842 * promise.
21843 * @returns a nodeback
21844 */
21845defer.prototype.makeNodeResolver = function () {
21846 var self = this;
21847 return function (error, value) {
21848 if (error) {
21849 self.reject(error);
21850 } else if (arguments.length > 2) {
21851 self.resolve(array_slice(arguments, 1));
21852 } else {
21853 self.resolve(value);
21854 }
21855 };
21856};
21857
21858/**
21859 * @param resolver {Function} a function that returns nothing and accepts
21860 * the resolve, reject, and notify functions for a deferred.
21861 * @returns a promise that may be resolved with the given resolve and reject
21862 * functions, or rejected by a thrown exception in resolver
21863 */
21864Q.Promise = promise; // ES6
21865Q.promise = promise;
21866function promise(resolver) {
21867 if (typeof resolver !== "function") {
21868 throw new TypeError("resolver must be a function.");
21869 }
21870 var deferred = defer();
21871 try {
21872 resolver(deferred.resolve, deferred.reject, deferred.notify);
21873 } catch (reason) {
21874 deferred.reject(reason);
21875 }
21876 return deferred.promise;
21877}
21878
21879promise.race = race; // ES6
21880promise.all = all; // ES6
21881promise.reject = reject; // ES6
21882promise.resolve = Q; // ES6
21883
21884// XXX experimental. This method is a way to denote that a local value is
21885// serializable and should be immediately dispatched to a remote upon request,
21886// instead of passing a reference.
21887Q.passByCopy = function (object) {
21888 //freeze(object);
21889 //passByCopies.set(object, true);
21890 return object;
21891};
21892
21893Promise.prototype.passByCopy = function () {
21894 //freeze(object);
21895 //passByCopies.set(object, true);
21896 return this;
21897};
21898
21899/**
21900 * If two promises eventually fulfill to the same value, promises that value,
21901 * but otherwise rejects.
21902 * @param x {Any*}
21903 * @param y {Any*}
21904 * @returns {Any*} a promise for x and y if they are the same, but a rejection
21905 * otherwise.
21906 *
21907 */
21908Q.join = function (x, y) {
21909 return Q(x).join(y);
21910};
21911
21912Promise.prototype.join = function (that) {
21913 return Q([this, that]).spread(function (x, y) {
21914 if (x === y) {
21915 // TODO: "===" should be Object.is or equiv
21916 return x;
21917 } else {
21918 throw new Error("Can't join: not the same: " + x + " " + y);
21919 }
21920 });
21921};
21922
21923/**
21924 * Returns a promise for the first of an array of promises to become settled.
21925 * @param answers {Array[Any*]} promises to race
21926 * @returns {Any*} the first promise to be settled
21927 */
21928Q.race = race;
21929function race(answerPs) {
21930 return promise(function (resolve, reject) {
21931 // Switch to this once we can assume at least ES5
21932 // answerPs.forEach(function (answerP) {
21933 // Q(answerP).then(resolve, reject);
21934 // });
21935 // Use this in the meantime
21936 for (var i = 0, len = answerPs.length; i < len; i++) {
21937 Q(answerPs[i]).then(resolve, reject);
21938 }
21939 });
21940}
21941
21942Promise.prototype.race = function () {
21943 return this.then(Q.race);
21944};
21945
21946/**
21947 * Constructs a Promise with a promise descriptor object and optional fallback
21948 * function. The descriptor contains methods like when(rejected), get(name),
21949 * set(name, value), post(name, args), and delete(name), which all
21950 * return either a value, a promise for a value, or a rejection. The fallback
21951 * accepts the operation name, a resolver, and any further arguments that would
21952 * have been forwarded to the appropriate method above had a method been
21953 * provided with the proper name. The API makes no guarantees about the nature
21954 * of the returned object, apart from that it is usable whereever promises are
21955 * bought and sold.
21956 */
21957Q.makePromise = Promise;
21958function Promise(descriptor, fallback, inspect) {
21959 if (fallback === void 0) {
21960 fallback = function (op) {
21961 return reject(new Error(
21962 "Promise does not support operation: " + op
21963 ));
21964 };
21965 }
21966 if (inspect === void 0) {
21967 inspect = function () {
21968 return {state: "unknown"};
21969 };
21970 }
21971
21972 var promise = object_create(Promise.prototype);
21973
21974 promise.promiseDispatch = function (resolve, op, args) {
21975 var result;
21976 try {
21977 if (descriptor[op]) {
21978 result = descriptor[op].apply(promise, args);
21979 } else {
21980 result = fallback.call(promise, op, args);
21981 }
21982 } catch (exception) {
21983 result = reject(exception);
21984 }
21985 if (resolve) {
21986 resolve(result);
21987 }
21988 };
21989
21990 promise.inspect = inspect;
21991
21992 // XXX deprecated `valueOf` and `exception` support
21993 if (inspect) {
21994 var inspected = inspect();
21995 if (inspected.state === "rejected") {
21996 promise.exception = inspected.reason;
21997 }
21998
21999 promise.valueOf = function () {
22000 var inspected = inspect();
22001 if (inspected.state === "pending" ||
22002 inspected.state === "rejected") {
22003 return promise;
22004 }
22005 return inspected.value;
22006 };
22007 }
22008
22009 return promise;
22010}
22011
22012Promise.prototype.toString = function () {
22013 return "[object Promise]";
22014};
22015
22016Promise.prototype.then = function (fulfilled, rejected, progressed) {
22017 var self = this;
22018 var deferred = defer();
22019 var done = false; // ensure the untrusted promise makes at most a
22020 // single call to one of the callbacks
22021
22022 function _fulfilled(value) {
22023 try {
22024 return typeof fulfilled === "function" ? fulfilled(value) : value;
22025 } catch (exception) {
22026 return reject(exception);
22027 }
22028 }
22029
22030 function _rejected(exception) {
22031 if (typeof rejected === "function") {
22032 makeStackTraceLong(exception, self);
22033 try {
22034 return rejected(exception);
22035 } catch (newException) {
22036 return reject(newException);
22037 }
22038 }
22039 return reject(exception);
22040 }
22041
22042 function _progressed(value) {
22043 return typeof progressed === "function" ? progressed(value) : value;
22044 }
22045
22046 Q.nextTick(function () {
22047 self.promiseDispatch(function (value) {
22048 if (done) {
22049 return;
22050 }
22051 done = true;
22052
22053 deferred.resolve(_fulfilled(value));
22054 }, "when", [function (exception) {
22055 if (done) {
22056 return;
22057 }
22058 done = true;
22059
22060 deferred.resolve(_rejected(exception));
22061 }]);
22062 });
22063
22064 // Progress propagator need to be attached in the current tick.
22065 self.promiseDispatch(void 0, "when", [void 0, function (value) {
22066 var newValue;
22067 var threw = false;
22068 try {
22069 newValue = _progressed(value);
22070 } catch (e) {
22071 threw = true;
22072 if (Q.onerror) {
22073 Q.onerror(e);
22074 } else {
22075 throw e;
22076 }
22077 }
22078
22079 if (!threw) {
22080 deferred.notify(newValue);
22081 }
22082 }]);
22083
22084 return deferred.promise;
22085};
22086
22087Q.tap = function (promise, callback) {
22088 return Q(promise).tap(callback);
22089};
22090
22091/**
22092 * Works almost like "finally", but not called for rejections.
22093 * Original resolution value is passed through callback unaffected.
22094 * Callback may return a promise that will be awaited for.
22095 * @param {Function} callback
22096 * @returns {Q.Promise}
22097 * @example
22098 * doSomething()
22099 * .then(...)
22100 * .tap(console.log)
22101 * .then(...);
22102 */
22103Promise.prototype.tap = function (callback) {
22104 callback = Q(callback);
22105
22106 return this.then(function (value) {
22107 return callback.fcall(value).thenResolve(value);
22108 });
22109};
22110
22111/**
22112 * Registers an observer on a promise.
22113 *
22114 * Guarantees:
22115 *
22116 * 1. that fulfilled and rejected will be called only once.
22117 * 2. that either the fulfilled callback or the rejected callback will be
22118 * called, but not both.
22119 * 3. that fulfilled and rejected will not be called in this turn.
22120 *
22121 * @param value promise or immediate reference to observe
22122 * @param fulfilled function to be called with the fulfilled value
22123 * @param rejected function to be called with the rejection exception
22124 * @param progressed function to be called on any progress notifications
22125 * @return promise for the return value from the invoked callback
22126 */
22127Q.when = when;
22128function when(value, fulfilled, rejected, progressed) {
22129 return Q(value).then(fulfilled, rejected, progressed);
22130}
22131
22132Promise.prototype.thenResolve = function (value) {
22133 return this.then(function () { return value; });
22134};
22135
22136Q.thenResolve = function (promise, value) {
22137 return Q(promise).thenResolve(value);
22138};
22139
22140Promise.prototype.thenReject = function (reason) {
22141 return this.then(function () { throw reason; });
22142};
22143
22144Q.thenReject = function (promise, reason) {
22145 return Q(promise).thenReject(reason);
22146};
22147
22148/**
22149 * If an object is not a promise, it is as "near" as possible.
22150 * If a promise is rejected, it is as "near" as possible too.
22151 * If it’s a fulfilled promise, the fulfillment value is nearer.
22152 * If it’s a deferred promise and the deferred has been resolved, the
22153 * resolution is "nearer".
22154 * @param object
22155 * @returns most resolved (nearest) form of the object
22156 */
22157
22158// XXX should we re-do this?
22159Q.nearer = nearer;
22160function nearer(value) {
22161 if (isPromise(value)) {
22162 var inspected = value.inspect();
22163 if (inspected.state === "fulfilled") {
22164 return inspected.value;
22165 }
22166 }
22167 return value;
22168}
22169
22170/**
22171 * @returns whether the given object is a promise.
22172 * Otherwise it is a fulfilled value.
22173 */
22174Q.isPromise = isPromise;
22175function isPromise(object) {
22176 return object instanceof Promise;
22177}
22178
22179Q.isPromiseAlike = isPromiseAlike;
22180function isPromiseAlike(object) {
22181 return isObject(object) && typeof object.then === "function";
22182}
22183
22184/**
22185 * @returns whether the given object is a pending promise, meaning not
22186 * fulfilled or rejected.
22187 */
22188Q.isPending = isPending;
22189function isPending(object) {
22190 return isPromise(object) && object.inspect().state === "pending";
22191}
22192
22193Promise.prototype.isPending = function () {
22194 return this.inspect().state === "pending";
22195};
22196
22197/**
22198 * @returns whether the given object is a value or fulfilled
22199 * promise.
22200 */
22201Q.isFulfilled = isFulfilled;
22202function isFulfilled(object) {
22203 return !isPromise(object) || object.inspect().state === "fulfilled";
22204}
22205
22206Promise.prototype.isFulfilled = function () {
22207 return this.inspect().state === "fulfilled";
22208};
22209
22210/**
22211 * @returns whether the given object is a rejected promise.
22212 */
22213Q.isRejected = isRejected;
22214function isRejected(object) {
22215 return isPromise(object) && object.inspect().state === "rejected";
22216}
22217
22218Promise.prototype.isRejected = function () {
22219 return this.inspect().state === "rejected";
22220};
22221
22222//// BEGIN UNHANDLED REJECTION TRACKING
22223
22224// This promise library consumes exceptions thrown in handlers so they can be
22225// handled by a subsequent promise. The exceptions get added to this array when
22226// they are created, and removed when they are handled. Note that in ES6 or
22227// shimmed environments, this would naturally be a `Set`.
22228var unhandledReasons = [];
22229var unhandledRejections = [];
22230var reportedUnhandledRejections = [];
22231var trackUnhandledRejections = true;
22232
22233function resetUnhandledRejections() {
22234 unhandledReasons.length = 0;
22235 unhandledRejections.length = 0;
22236
22237 if (!trackUnhandledRejections) {
22238 trackUnhandledRejections = true;
22239 }
22240}
22241
22242function trackRejection(promise, reason) {
22243 if (!trackUnhandledRejections) {
22244 return;
22245 }
22246 if (typeof process === "object" && typeof process.emit === "function") {
22247 Q.nextTick.runAfter(function () {
22248 if (array_indexOf(unhandledRejections, promise) !== -1) {
22249 process.emit("unhandledRejection", reason, promise);
22250 reportedUnhandledRejections.push(promise);
22251 }
22252 });
22253 }
22254
22255 unhandledRejections.push(promise);
22256 if (reason && typeof reason.stack !== "undefined") {
22257 unhandledReasons.push(reason.stack);
22258 } else {
22259 unhandledReasons.push("(no stack) " + reason);
22260 }
22261}
22262
22263function untrackRejection(promise) {
22264 if (!trackUnhandledRejections) {
22265 return;
22266 }
22267
22268 var at = array_indexOf(unhandledRejections, promise);
22269 if (at !== -1) {
22270 if (typeof process === "object" && typeof process.emit === "function") {
22271 Q.nextTick.runAfter(function () {
22272 var atReport = array_indexOf(reportedUnhandledRejections, promise);
22273 if (atReport !== -1) {
22274 process.emit("rejectionHandled", unhandledReasons[at], promise);
22275 reportedUnhandledRejections.splice(atReport, 1);
22276 }
22277 });
22278 }
22279 unhandledRejections.splice(at, 1);
22280 unhandledReasons.splice(at, 1);
22281 }
22282}
22283
22284Q.resetUnhandledRejections = resetUnhandledRejections;
22285
22286Q.getUnhandledReasons = function () {
22287 // Make a copy so that consumers can't interfere with our internal state.
22288 return unhandledReasons.slice();
22289};
22290
22291Q.stopUnhandledRejectionTracking = function () {
22292 resetUnhandledRejections();
22293 trackUnhandledRejections = false;
22294};
22295
22296resetUnhandledRejections();
22297
22298//// END UNHANDLED REJECTION TRACKING
22299
22300/**
22301 * Constructs a rejected promise.
22302 * @param reason value describing the failure
22303 */
22304Q.reject = reject;
22305function reject(reason) {
22306 var rejection = Promise({
22307 "when": function (rejected) {
22308 // note that the error has been handled
22309 if (rejected) {
22310 untrackRejection(this);
22311 }
22312 return rejected ? rejected(reason) : this;
22313 }
22314 }, function fallback() {
22315 return this;
22316 }, function inspect() {
22317 return { state: "rejected", reason: reason };
22318 });
22319
22320 // Note that the reason has not been handled.
22321 trackRejection(rejection, reason);
22322
22323 return rejection;
22324}
22325
22326/**
22327 * Constructs a fulfilled promise for an immediate reference.
22328 * @param value immediate reference
22329 */
22330Q.fulfill = fulfill;
22331function fulfill(value) {
22332 return Promise({
22333 "when": function () {
22334 return value;
22335 },
22336 "get": function (name) {
22337 return value[name];
22338 },
22339 "set": function (name, rhs) {
22340 value[name] = rhs;
22341 },
22342 "delete": function (name) {
22343 delete value[name];
22344 },
22345 "post": function (name, args) {
22346 // Mark Miller proposes that post with no name should apply a
22347 // promised function.
22348 if (name === null || name === void 0) {
22349 return value.apply(void 0, args);
22350 } else {
22351 return value[name].apply(value, args);
22352 }
22353 },
22354 "apply": function (thisp, args) {
22355 return value.apply(thisp, args);
22356 },
22357 "keys": function () {
22358 return object_keys(value);
22359 }
22360 }, void 0, function inspect() {
22361 return { state: "fulfilled", value: value };
22362 });
22363}
22364
22365/**
22366 * Converts thenables to Q promises.
22367 * @param promise thenable promise
22368 * @returns a Q promise
22369 */
22370function coerce(promise) {
22371 var deferred = defer();
22372 Q.nextTick(function () {
22373 try {
22374 promise.then(deferred.resolve, deferred.reject, deferred.notify);
22375 } catch (exception) {
22376 deferred.reject(exception);
22377 }
22378 });
22379 return deferred.promise;
22380}
22381
22382/**
22383 * Annotates an object such that it will never be
22384 * transferred away from this process over any promise
22385 * communication channel.
22386 * @param object
22387 * @returns promise a wrapping of that object that
22388 * additionally responds to the "isDef" message
22389 * without a rejection.
22390 */
22391Q.master = master;
22392function master(object) {
22393 return Promise({
22394 "isDef": function () {}
22395 }, function fallback(op, args) {
22396 return dispatch(object, op, args);
22397 }, function () {
22398 return Q(object).inspect();
22399 });
22400}
22401
22402/**
22403 * Spreads the values of a promised array of arguments into the
22404 * fulfillment callback.
22405 * @param fulfilled callback that receives variadic arguments from the
22406 * promised array
22407 * @param rejected callback that receives the exception if the promise
22408 * is rejected.
22409 * @returns a promise for the return value or thrown exception of
22410 * either callback.
22411 */
22412Q.spread = spread;
22413function spread(value, fulfilled, rejected) {
22414 return Q(value).spread(fulfilled, rejected);
22415}
22416
22417Promise.prototype.spread = function (fulfilled, rejected) {
22418 return this.all().then(function (array) {
22419 return fulfilled.apply(void 0, array);
22420 }, rejected);
22421};
22422
22423/**
22424 * The async function is a decorator for generator functions, turning
22425 * them into asynchronous generators. Although generators are only part
22426 * of the newest ECMAScript 6 drafts, this code does not cause syntax
22427 * errors in older engines. This code should continue to work and will
22428 * in fact improve over time as the language improves.
22429 *
22430 * ES6 generators are currently part of V8 version 3.19 with the
22431 * --harmony-generators runtime flag enabled. SpiderMonkey has had them
22432 * for longer, but under an older Python-inspired form. This function
22433 * works on both kinds of generators.
22434 *
22435 * Decorates a generator function such that:
22436 * - it may yield promises
22437 * - execution will continue when that promise is fulfilled
22438 * - the value of the yield expression will be the fulfilled value
22439 * - it returns a promise for the return value (when the generator
22440 * stops iterating)
22441 * - the decorated function returns a promise for the return value
22442 * of the generator or the first rejected promise among those
22443 * yielded.
22444 * - if an error is thrown in the generator, it propagates through
22445 * every following yield until it is caught, or until it escapes
22446 * the generator function altogether, and is translated into a
22447 * rejection for the promise returned by the decorated generator.
22448 */
22449Q.async = async;
22450function async(makeGenerator) {
22451 return function () {
22452 // when verb is "send", arg is a value
22453 // when verb is "throw", arg is an exception
22454 function continuer(verb, arg) {
22455 var result;
22456
22457 // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only
22458 // engine that has a deployed base of browsers that support generators.
22459 // However, SM's generators use the Python-inspired semantics of
22460 // outdated ES6 drafts. We would like to support ES6, but we'd also
22461 // like to make it possible to use generators in deployed browsers, so
22462 // we also support Python-style generators. At some point we can remove
22463 // this block.
22464
22465 if (typeof StopIteration === "undefined") {
22466 // ES6 Generators
22467 try {
22468 result = generator[verb](arg);
22469 } catch (exception) {
22470 return reject(exception);
22471 }
22472 if (result.done) {
22473 return Q(result.value);
22474 } else {
22475 return when(result.value, callback, errback);
22476 }
22477 } else {
22478 // SpiderMonkey Generators
22479 // FIXME: Remove this case when SM does ES6 generators.
22480 try {
22481 result = generator[verb](arg);
22482 } catch (exception) {
22483 if (isStopIteration(exception)) {
22484 return Q(exception.value);
22485 } else {
22486 return reject(exception);
22487 }
22488 }
22489 return when(result, callback, errback);
22490 }
22491 }
22492 var generator = makeGenerator.apply(this, arguments);
22493 var callback = continuer.bind(continuer, "next");
22494 var errback = continuer.bind(continuer, "throw");
22495 return callback();
22496 };
22497}
22498
22499/**
22500 * The spawn function is a small wrapper around async that immediately
22501 * calls the generator and also ends the promise chain, so that any
22502 * unhandled errors are thrown instead of forwarded to the error
22503 * handler. This is useful because it's extremely common to run
22504 * generators at the top-level to work with libraries.
22505 */
22506Q.spawn = spawn;
22507function spawn(makeGenerator) {
22508 Q.done(Q.async(makeGenerator)());
22509}
22510
22511// FIXME: Remove this interface once ES6 generators are in SpiderMonkey.
22512/**
22513 * Throws a ReturnValue exception to stop an asynchronous generator.
22514 *
22515 * This interface is a stop-gap measure to support generator return
22516 * values in older Firefox/SpiderMonkey. In browsers that support ES6
22517 * generators like Chromium 29, just use "return" in your generator
22518 * functions.
22519 *
22520 * @param value the return value for the surrounding generator
22521 * @throws ReturnValue exception with the value.
22522 * @example
22523 * // ES6 style
22524 * Q.async(function* () {
22525 * var foo = yield getFooPromise();
22526 * var bar = yield getBarPromise();
22527 * return foo + bar;
22528 * })
22529 * // Older SpiderMonkey style
22530 * Q.async(function () {
22531 * var foo = yield getFooPromise();
22532 * var bar = yield getBarPromise();
22533 * Q.return(foo + bar);
22534 * })
22535 */
22536Q["return"] = _return;
22537function _return(value) {
22538 throw new QReturnValue(value);
22539}
22540
22541/**
22542 * The promised function decorator ensures that any promise arguments
22543 * are settled and passed as values (`this` is also settled and passed
22544 * as a value). It will also ensure that the result of a function is
22545 * always a promise.
22546 *
22547 * @example
22548 * var add = Q.promised(function (a, b) {
22549 * return a + b;
22550 * });
22551 * add(Q(a), Q(B));
22552 *
22553 * @param {function} callback The function to decorate
22554 * @returns {function} a function that has been decorated.
22555 */
22556Q.promised = promised;
22557function promised(callback) {
22558 return function () {
22559 return spread([this, all(arguments)], function (self, args) {
22560 return callback.apply(self, args);
22561 });
22562 };
22563}
22564
22565/**
22566 * sends a message to a value in a future turn
22567 * @param object* the recipient
22568 * @param op the name of the message operation, e.g., "when",
22569 * @param args further arguments to be forwarded to the operation
22570 * @returns result {Promise} a promise for the result of the operation
22571 */
22572Q.dispatch = dispatch;
22573function dispatch(object, op, args) {
22574 return Q(object).dispatch(op, args);
22575}
22576
22577Promise.prototype.dispatch = function (op, args) {
22578 var self = this;
22579 var deferred = defer();
22580 Q.nextTick(function () {
22581 self.promiseDispatch(deferred.resolve, op, args);
22582 });
22583 return deferred.promise;
22584};
22585
22586/**
22587 * Gets the value of a property in a future turn.
22588 * @param object promise or immediate reference for target object
22589 * @param name name of property to get
22590 * @return promise for the property value
22591 */
22592Q.get = function (object, key) {
22593 return Q(object).dispatch("get", [key]);
22594};
22595
22596Promise.prototype.get = function (key) {
22597 return this.dispatch("get", [key]);
22598};
22599
22600/**
22601 * Sets the value of a property in a future turn.
22602 * @param object promise or immediate reference for object object
22603 * @param name name of property to set
22604 * @param value new value of property
22605 * @return promise for the return value
22606 */
22607Q.set = function (object, key, value) {
22608 return Q(object).dispatch("set", [key, value]);
22609};
22610
22611Promise.prototype.set = function (key, value) {
22612 return this.dispatch("set", [key, value]);
22613};
22614
22615/**
22616 * Deletes a property in a future turn.
22617 * @param object promise or immediate reference for target object
22618 * @param name name of property to delete
22619 * @return promise for the return value
22620 */
22621Q.del = // XXX legacy
22622Q["delete"] = function (object, key) {
22623 return Q(object).dispatch("delete", [key]);
22624};
22625
22626Promise.prototype.del = // XXX legacy
22627Promise.prototype["delete"] = function (key) {
22628 return this.dispatch("delete", [key]);
22629};
22630
22631/**
22632 * Invokes a method in a future turn.
22633 * @param object promise or immediate reference for target object
22634 * @param name name of method to invoke
22635 * @param value a value to post, typically an array of
22636 * invocation arguments for promises that
22637 * are ultimately backed with `resolve` values,
22638 * as opposed to those backed with URLs
22639 * wherein the posted value can be any
22640 * JSON serializable object.
22641 * @return promise for the return value
22642 */
22643// bound locally because it is used by other methods
22644Q.mapply = // XXX As proposed by "Redsandro"
22645Q.post = function (object, name, args) {
22646 return Q(object).dispatch("post", [name, args]);
22647};
22648
22649Promise.prototype.mapply = // XXX As proposed by "Redsandro"
22650Promise.prototype.post = function (name, args) {
22651 return this.dispatch("post", [name, args]);
22652};
22653
22654/**
22655 * Invokes a method in a future turn.
22656 * @param object promise or immediate reference for target object
22657 * @param name name of method to invoke
22658 * @param ...args array of invocation arguments
22659 * @return promise for the return value
22660 */
22661Q.send = // XXX Mark Miller's proposed parlance
22662Q.mcall = // XXX As proposed by "Redsandro"
22663Q.invoke = function (object, name /*...args*/) {
22664 return Q(object).dispatch("post", [name, array_slice(arguments, 2)]);
22665};
22666
22667Promise.prototype.send = // XXX Mark Miller's proposed parlance
22668Promise.prototype.mcall = // XXX As proposed by "Redsandro"
22669Promise.prototype.invoke = function (name /*...args*/) {
22670 return this.dispatch("post", [name, array_slice(arguments, 1)]);
22671};
22672
22673/**
22674 * Applies the promised function in a future turn.
22675 * @param object promise or immediate reference for target function
22676 * @param args array of application arguments
22677 */
22678Q.fapply = function (object, args) {
22679 return Q(object).dispatch("apply", [void 0, args]);
22680};
22681
22682Promise.prototype.fapply = function (args) {
22683 return this.dispatch("apply", [void 0, args]);
22684};
22685
22686/**
22687 * Calls the promised function in a future turn.
22688 * @param object promise or immediate reference for target function
22689 * @param ...args array of application arguments
22690 */
22691Q["try"] =
22692Q.fcall = function (object /* ...args*/) {
22693 return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]);
22694};
22695
22696Promise.prototype.fcall = function (/*...args*/) {
22697 return this.dispatch("apply", [void 0, array_slice(arguments)]);
22698};
22699
22700/**
22701 * Binds the promised function, transforming return values into a fulfilled
22702 * promise and thrown errors into a rejected one.
22703 * @param object promise or immediate reference for target function
22704 * @param ...args array of application arguments
22705 */
22706Q.fbind = function (object /*...args*/) {
22707 var promise = Q(object);
22708 var args = array_slice(arguments, 1);
22709 return function fbound() {
22710 return promise.dispatch("apply", [
22711 this,
22712 args.concat(array_slice(arguments))
22713 ]);
22714 };
22715};
22716Promise.prototype.fbind = function (/*...args*/) {
22717 var promise = this;
22718 var args = array_slice(arguments);
22719 return function fbound() {
22720 return promise.dispatch("apply", [
22721 this,
22722 args.concat(array_slice(arguments))
22723 ]);
22724 };
22725};
22726
22727/**
22728 * Requests the names of the owned properties of a promised
22729 * object in a future turn.
22730 * @param object promise or immediate reference for target object
22731 * @return promise for the keys of the eventually settled object
22732 */
22733Q.keys = function (object) {
22734 return Q(object).dispatch("keys", []);
22735};
22736
22737Promise.prototype.keys = function () {
22738 return this.dispatch("keys", []);
22739};
22740
22741/**
22742 * Turns an array of promises into a promise for an array. If any of
22743 * the promises gets rejected, the whole array is rejected immediately.
22744 * @param {Array*} an array (or promise for an array) of values (or
22745 * promises for values)
22746 * @returns a promise for an array of the corresponding values
22747 */
22748// By Mark Miller
22749// http://wiki.ecmascript.org/doku.php?id=strawman:concurrency&rev=1308776521#allfulfilled
22750Q.all = all;
22751function all(promises) {
22752 return when(promises, function (promises) {
22753 var pendingCount = 0;
22754 var deferred = defer();
22755 array_reduce(promises, function (undefined, promise, index) {
22756 var snapshot;
22757 if (
22758 isPromise(promise) &&
22759 (snapshot = promise.inspect()).state === "fulfilled"
22760 ) {
22761 promises[index] = snapshot.value;
22762 } else {
22763 ++pendingCount;
22764 when(
22765 promise,
22766 function (value) {
22767 promises[index] = value;
22768 if (--pendingCount === 0) {
22769 deferred.resolve(promises);
22770 }
22771 },
22772 deferred.reject,
22773 function (progress) {
22774 deferred.notify({ index: index, value: progress });
22775 }
22776 );
22777 }
22778 }, void 0);
22779 if (pendingCount === 0) {
22780 deferred.resolve(promises);
22781 }
22782 return deferred.promise;
22783 });
22784}
22785
22786Promise.prototype.all = function () {
22787 return all(this);
22788};
22789
22790/**
22791 * Returns the first resolved promise of an array. Prior rejected promises are
22792 * ignored. Rejects only if all promises are rejected.
22793 * @param {Array*} an array containing values or promises for values
22794 * @returns a promise fulfilled with the value of the first resolved promise,
22795 * or a rejected promise if all promises are rejected.
22796 */
22797Q.any = any;
22798
22799function any(promises) {
22800 if (promises.length === 0) {
22801 return Q.resolve();
22802 }
22803
22804 var deferred = Q.defer();
22805 var pendingCount = 0;
22806 array_reduce(promises, function (prev, current, index) {
22807 var promise = promises[index];
22808
22809 pendingCount++;
22810
22811 when(promise, onFulfilled, onRejected, onProgress);
22812 function onFulfilled(result) {
22813 deferred.resolve(result);
22814 }
22815 function onRejected() {
22816 pendingCount--;
22817 if (pendingCount === 0) {
22818 deferred.reject(new Error(
22819 "Can't get fulfillment value from any promise, all " +
22820 "promises were rejected."
22821 ));
22822 }
22823 }
22824 function onProgress(progress) {
22825 deferred.notify({
22826 index: index,
22827 value: progress
22828 });
22829 }
22830 }, undefined);
22831
22832 return deferred.promise;
22833}
22834
22835Promise.prototype.any = function () {
22836 return any(this);
22837};
22838
22839/**
22840 * Waits for all promises to be settled, either fulfilled or
22841 * rejected. This is distinct from `all` since that would stop
22842 * waiting at the first rejection. The promise returned by
22843 * `allResolved` will never be rejected.
22844 * @param promises a promise for an array (or an array) of promises
22845 * (or values)
22846 * @return a promise for an array of promises
22847 */
22848Q.allResolved = deprecate(allResolved, "allResolved", "allSettled");
22849function allResolved(promises) {
22850 return when(promises, function (promises) {
22851 promises = array_map(promises, Q);
22852 return when(all(array_map(promises, function (promise) {
22853 return when(promise, noop, noop);
22854 })), function () {
22855 return promises;
22856 });
22857 });
22858}
22859
22860Promise.prototype.allResolved = function () {
22861 return allResolved(this);
22862};
22863
22864/**
22865 * @see Promise#allSettled
22866 */
22867Q.allSettled = allSettled;
22868function allSettled(promises) {
22869 return Q(promises).allSettled();
22870}
22871
22872/**
22873 * Turns an array of promises into a promise for an array of their states (as
22874 * returned by `inspect`) when they have all settled.
22875 * @param {Array[Any*]} values an array (or promise for an array) of values (or
22876 * promises for values)
22877 * @returns {Array[State]} an array of states for the respective values.
22878 */
22879Promise.prototype.allSettled = function () {
22880 return this.then(function (promises) {
22881 return all(array_map(promises, function (promise) {
22882 promise = Q(promise);
22883 function regardless() {
22884 return promise.inspect();
22885 }
22886 return promise.then(regardless, regardless);
22887 }));
22888 });
22889};
22890
22891/**
22892 * Captures the failure of a promise, giving an oportunity to recover
22893 * with a callback. If the given promise is fulfilled, the returned
22894 * promise is fulfilled.
22895 * @param {Any*} promise for something
22896 * @param {Function} callback to fulfill the returned promise if the
22897 * given promise is rejected
22898 * @returns a promise for the return value of the callback
22899 */
22900Q.fail = // XXX legacy
22901Q["catch"] = function (object, rejected) {
22902 return Q(object).then(void 0, rejected);
22903};
22904
22905Promise.prototype.fail = // XXX legacy
22906Promise.prototype["catch"] = function (rejected) {
22907 return this.then(void 0, rejected);
22908};
22909
22910/**
22911 * Attaches a listener that can respond to progress notifications from a
22912 * promise's originating deferred. This listener receives the exact arguments
22913 * passed to ``deferred.notify``.
22914 * @param {Any*} promise for something
22915 * @param {Function} callback to receive any progress notifications
22916 * @returns the given promise, unchanged
22917 */
22918Q.progress = progress;
22919function progress(object, progressed) {
22920 return Q(object).then(void 0, void 0, progressed);
22921}
22922
22923Promise.prototype.progress = function (progressed) {
22924 return this.then(void 0, void 0, progressed);
22925};
22926
22927/**
22928 * Provides an opportunity to observe the settling of a promise,
22929 * regardless of whether the promise is fulfilled or rejected. Forwards
22930 * the resolution to the returned promise when the callback is done.
22931 * The callback can return a promise to defer completion.
22932 * @param {Any*} promise
22933 * @param {Function} callback to observe the resolution of the given
22934 * promise, takes no arguments.
22935 * @returns a promise for the resolution of the given promise when
22936 * ``fin`` is done.
22937 */
22938Q.fin = // XXX legacy
22939Q["finally"] = function (object, callback) {
22940 return Q(object)["finally"](callback);
22941};
22942
22943Promise.prototype.fin = // XXX legacy
22944Promise.prototype["finally"] = function (callback) {
22945 callback = Q(callback);
22946 return this.then(function (value) {
22947 return callback.fcall().then(function () {
22948 return value;
22949 });
22950 }, function (reason) {
22951 // TODO attempt to recycle the rejection with "this".
22952 return callback.fcall().then(function () {
22953 throw reason;
22954 });
22955 });
22956};
22957
22958/**
22959 * Terminates a chain of promises, forcing rejections to be
22960 * thrown as exceptions.
22961 * @param {Any*} promise at the end of a chain of promises
22962 * @returns nothing
22963 */
22964Q.done = function (object, fulfilled, rejected, progress) {
22965 return Q(object).done(fulfilled, rejected, progress);
22966};
22967
22968Promise.prototype.done = function (fulfilled, rejected, progress) {
22969 var onUnhandledError = function (error) {
22970 // forward to a future turn so that ``when``
22971 // does not catch it and turn it into a rejection.
22972 Q.nextTick(function () {
22973 makeStackTraceLong(error, promise);
22974 if (Q.onerror) {
22975 Q.onerror(error);
22976 } else {
22977 throw error;
22978 }
22979 });
22980 };
22981
22982 // Avoid unnecessary `nextTick`ing via an unnecessary `when`.
22983 var promise = fulfilled || rejected || progress ?
22984 this.then(fulfilled, rejected, progress) :
22985 this;
22986
22987 if (typeof process === "object" && process && process.domain) {
22988 onUnhandledError = process.domain.bind(onUnhandledError);
22989 }
22990
22991 promise.then(void 0, onUnhandledError);
22992};
22993
22994/**
22995 * Causes a promise to be rejected if it does not get fulfilled before
22996 * some milliseconds time out.
22997 * @param {Any*} promise
22998 * @param {Number} milliseconds timeout
22999 * @param {Any*} custom error message or Error object (optional)
23000 * @returns a promise for the resolution of the given promise if it is
23001 * fulfilled before the timeout, otherwise rejected.
23002 */
23003Q.timeout = function (object, ms, error) {
23004 return Q(object).timeout(ms, error);
23005};
23006
23007Promise.prototype.timeout = function (ms, error) {
23008 var deferred = defer();
23009 var timeoutId = setTimeout(function () {
23010 if (!error || "string" === typeof error) {
23011 error = new Error(error || "Timed out after " + ms + " ms");
23012 error.code = "ETIMEDOUT";
23013 }
23014 deferred.reject(error);
23015 }, ms);
23016
23017 this.then(function (value) {
23018 clearTimeout(timeoutId);
23019 deferred.resolve(value);
23020 }, function (exception) {
23021 clearTimeout(timeoutId);
23022 deferred.reject(exception);
23023 }, deferred.notify);
23024
23025 return deferred.promise;
23026};
23027
23028/**
23029 * Returns a promise for the given value (or promised value), some
23030 * milliseconds after it resolved. Passes rejections immediately.
23031 * @param {Any*} promise
23032 * @param {Number} milliseconds
23033 * @returns a promise for the resolution of the given promise after milliseconds
23034 * time has elapsed since the resolution of the given promise.
23035 * If the given promise rejects, that is passed immediately.
23036 */
23037Q.delay = function (object, timeout) {
23038 if (timeout === void 0) {
23039 timeout = object;
23040 object = void 0;
23041 }
23042 return Q(object).delay(timeout);
23043};
23044
23045Promise.prototype.delay = function (timeout) {
23046 return this.then(function (value) {
23047 var deferred = defer();
23048 setTimeout(function () {
23049 deferred.resolve(value);
23050 }, timeout);
23051 return deferred.promise;
23052 });
23053};
23054
23055/**
23056 * Passes a continuation to a Node function, which is called with the given
23057 * arguments provided as an array, and returns a promise.
23058 *
23059 * Q.nfapply(FS.readFile, [__filename])
23060 * .then(function (content) {
23061 * })
23062 *
23063 */
23064Q.nfapply = function (callback, args) {
23065 return Q(callback).nfapply(args);
23066};
23067
23068Promise.prototype.nfapply = function (args) {
23069 var deferred = defer();
23070 var nodeArgs = array_slice(args);
23071 nodeArgs.push(deferred.makeNodeResolver());
23072 this.fapply(nodeArgs).fail(deferred.reject);
23073 return deferred.promise;
23074};
23075
23076/**
23077 * Passes a continuation to a Node function, which is called with the given
23078 * arguments provided individually, and returns a promise.
23079 * @example
23080 * Q.nfcall(FS.readFile, __filename)
23081 * .then(function (content) {
23082 * })
23083 *
23084 */
23085Q.nfcall = function (callback /*...args*/) {
23086 var args = array_slice(arguments, 1);
23087 return Q(callback).nfapply(args);
23088};
23089
23090Promise.prototype.nfcall = function (/*...args*/) {
23091 var nodeArgs = array_slice(arguments);
23092 var deferred = defer();
23093 nodeArgs.push(deferred.makeNodeResolver());
23094 this.fapply(nodeArgs).fail(deferred.reject);
23095 return deferred.promise;
23096};
23097
23098/**
23099 * Wraps a NodeJS continuation passing function and returns an equivalent
23100 * version that returns a promise.
23101 * @example
23102 * Q.nfbind(FS.readFile, __filename)("utf-8")
23103 * .then(console.log)
23104 * .done()
23105 */
23106Q.nfbind =
23107Q.denodeify = function (callback /*...args*/) {
23108 var baseArgs = array_slice(arguments, 1);
23109 return function () {
23110 var nodeArgs = baseArgs.concat(array_slice(arguments));
23111 var deferred = defer();
23112 nodeArgs.push(deferred.makeNodeResolver());
23113 Q(callback).fapply(nodeArgs).fail(deferred.reject);
23114 return deferred.promise;
23115 };
23116};
23117
23118Promise.prototype.nfbind =
23119Promise.prototype.denodeify = function (/*...args*/) {
23120 var args = array_slice(arguments);
23121 args.unshift(this);
23122 return Q.denodeify.apply(void 0, args);
23123};
23124
23125Q.nbind = function (callback, thisp /*...args*/) {
23126 var baseArgs = array_slice(arguments, 2);
23127 return function () {
23128 var nodeArgs = baseArgs.concat(array_slice(arguments));
23129 var deferred = defer();
23130 nodeArgs.push(deferred.makeNodeResolver());
23131 function bound() {
23132 return callback.apply(thisp, arguments);
23133 }
23134 Q(bound).fapply(nodeArgs).fail(deferred.reject);
23135 return deferred.promise;
23136 };
23137};
23138
23139Promise.prototype.nbind = function (/*thisp, ...args*/) {
23140 var args = array_slice(arguments, 0);
23141 args.unshift(this);
23142 return Q.nbind.apply(void 0, args);
23143};
23144
23145/**
23146 * Calls a method of a Node-style object that accepts a Node-style
23147 * callback with a given array of arguments, plus a provided callback.
23148 * @param object an object that has the named method
23149 * @param {String} name name of the method of object
23150 * @param {Array} args arguments to pass to the method; the callback
23151 * will be provided by Q and appended to these arguments.
23152 * @returns a promise for the value or error
23153 */
23154Q.nmapply = // XXX As proposed by "Redsandro"
23155Q.npost = function (object, name, args) {
23156 return Q(object).npost(name, args);
23157};
23158
23159Promise.prototype.nmapply = // XXX As proposed by "Redsandro"
23160Promise.prototype.npost = function (name, args) {
23161 var nodeArgs = array_slice(args || []);
23162 var deferred = defer();
23163 nodeArgs.push(deferred.makeNodeResolver());
23164 this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
23165 return deferred.promise;
23166};
23167
23168/**
23169 * Calls a method of a Node-style object that accepts a Node-style
23170 * callback, forwarding the given variadic arguments, plus a provided
23171 * callback argument.
23172 * @param object an object that has the named method
23173 * @param {String} name name of the method of object
23174 * @param ...args arguments to pass to the method; the callback will
23175 * be provided by Q and appended to these arguments.
23176 * @returns a promise for the value or error
23177 */
23178Q.nsend = // XXX Based on Mark Miller's proposed "send"
23179Q.nmcall = // XXX Based on "Redsandro's" proposal
23180Q.ninvoke = function (object, name /*...args*/) {
23181 var nodeArgs = array_slice(arguments, 2);
23182 var deferred = defer();
23183 nodeArgs.push(deferred.makeNodeResolver());
23184 Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject);
23185 return deferred.promise;
23186};
23187
23188Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send"
23189Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal
23190Promise.prototype.ninvoke = function (name /*...args*/) {
23191 var nodeArgs = array_slice(arguments, 1);
23192 var deferred = defer();
23193 nodeArgs.push(deferred.makeNodeResolver());
23194 this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
23195 return deferred.promise;
23196};
23197
23198/**
23199 * If a function would like to support both Node continuation-passing-style and
23200 * promise-returning-style, it can end its internal promise chain with
23201 * `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user
23202 * elects to use a nodeback, the result will be sent there. If they do not
23203 * pass a nodeback, they will receive the result promise.
23204 * @param object a result (or a promise for a result)
23205 * @param {Function} nodeback a Node.js-style callback
23206 * @returns either the promise or nothing
23207 */
23208Q.nodeify = nodeify;
23209function nodeify(object, nodeback) {
23210 return Q(object).nodeify(nodeback);
23211}
23212
23213Promise.prototype.nodeify = function (nodeback) {
23214 if (nodeback) {
23215 this.then(function (value) {
23216 Q.nextTick(function () {
23217 nodeback(null, value);
23218 });
23219 }, function (error) {
23220 Q.nextTick(function () {
23221 nodeback(error);
23222 });
23223 });
23224 } else {
23225 return this;
23226 }
23227};
23228
23229Q.noConflict = function() {
23230 throw new Error("Q.noConflict only works when Q is used as a global");
23231};
23232
23233// All code before this point will be filtered from stack traces.
23234var qEndingLine = captureLine();
23235
23236return Q;
23237
23238});
23239
23240}).call(this,require('_process'))
23241//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9xL3EuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtB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C8vIHF1ZXVlIGZvciBsYXRlIHRhc2tzLCB1c2VkIGJ5IHVuaGFuZGxlZCByZWplY3Rpb24gdHJhY2tpbmdcbiAgICB2YXIgbGF0ZXJRdWV1ZSA9IFtdO1xuXG4gICAgZnVuY3Rpb24gZmx1c2goKSB7XG4gICAgICAgIC8qIGpzaGludCBsb29wZnVuYzogdHJ1ZSAqL1xuICAgICAgICB2YXIgdGFzaywgZG9tYWluO1xuXG4gICAgICAgIHdoaWxlIChoZWFkLm5leHQpIHtcbiAgICAgICAgICAgIGhlYWQgPSBoZWFkLm5leHQ7XG4gICAgICAgICAgICB0YXNrID0gaGVhZC50YXNrO1xuICAgICAgICAgICAgaGVhZC50YXNrID0gdm9pZCAwO1xuICAgICAgICAgICAgZG9tYWluID0gaGVhZC5kb21haW47XG5cbiAgICAgICAgICAgIGlmIChkb21haW4pIHtcbiAgICAgICAgICAgICAgICBoZWFkLmRvbWFpbiA9IHZvaWQgMDtcbiAgICAgICAgICAgICAgICBkb21haW4uZW50ZXIoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJ1blNpbmdsZSh0YXNrLCBkb21haW4pO1xuXG4gICAgICAgIH1cbiAgICAgICAgd2hpbGUgKGxhdGVyUXVldWUubGVuZ3RoKSB7XG4gICAgICAgICAgICB0YXNrID0gbGF0ZXJRdWV1ZS5wb3AoKTtcbiAgICAgICAgICAgIHJ1blNpbmdsZSh0YXNrKTtcbiAgICAgICAgfVxuICAgICAgICBmbHVzaGluZyA9IGZhbHNlO1xuICAgIH1cbiAgICAvLyBydW5zIGEgc2luZ2xlIGZ1bmN0aW9uIGluIHRoZSBhc3luYyBxdWV1ZVxuICAgIGZ1bmN0aW9uIHJ1blNpbmdsZSh0YXNrLCBkb21haW4pIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRhc2soKTtcblxuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBpZiAoaXNOb2RlSlMpIHtcbiAgICAgICAgICAgICAgICAvLyBJbiBub2RlLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBjb25zaWRlcmVkIGZhdGFsIGVycm9ycy5cbiAgICAgICAgICAgICAgICAvLyBSZS10aHJvdyB0aGVtIHN5bmNocm9ub3VzbHkgdG8gaW50ZXJydXB0IGZsdXNoaW5nIVxuXG4gICAgICAgICAgICAgICAgLy8gRW5zdXJlIGNvbnRpbnVhdGlvbiBpZiB0aGUgdW5jYXVnaHQgZXhjZXB0aW9uIGlzIHN1cHByZXNzZWRcbiAgICAgICAgICAgICAgICAvLyBsaXN0ZW5pbmcgXCJ1bmNhdWdodEV4Y2VwdGlvblwiIGV2ZW50cyAoYXMgZG9tYWlucyBkb2VzKS5cbiAgICAgICAgICAgICAgICAvLyBDb250aW51ZSBpbiBuZXh0IGV2ZW50IHRvIGF2b2lkIHRpY2sgcmVjdXJzaW9uLlxuICAgICAgICAgICAgICAgIGlmIChkb21haW4pIHtcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmbHVzaCwgMCk7XG4gICAgICAgICAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgICAgICAgICBkb21haW4uZW50ZXIoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEluIGJyb3dzZXJzLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBub3QgZmF0YWwuXG4gICAgICAgICAgICAgICAgLy8gUmUtdGhyb3cgdGhlbSBhc3luY2hyb25vdXNseSB0byBhdm9pZCBzbG93LWRvd25zLlxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH0sIDApO1xuICA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XksIGFjY291bnRpbmdcbiAgICAgICAgICAgIC8vIGZvciB0aGUgcG9zc2liaWxpdHkgdGhhdCBpcyBpcyBhIHNwYXJzZSBhcnJheVxuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCBpbiB0aGlzKSB7XG4gICAgICAgICAgICAgICAgICAgIGJhc2lzID0gdGhpc1tpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICgrK2luZGV4ID49IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSB3aGlsZSAoMSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gcmVkdWNlXG4gICAgICAgIGZvciAoOyBpbmRleCA8IGxlbmd0aDsgaW5kZXgrKykge1xuICAgICAgICAgICAgLy8gYWNjb3VudCBmb3IgdGhlIHBvc3NpYmlsaXR5IHRoYXQgdGhlIGFycmF5IGlzIHNwYXJzZVxuICAgICAgICAgICAgaWYgKGluZGV4IGluIHRoaXMpIHtcbiAgICAgICAgICAgICAgICBiYXNpcyA9IGNhbGxiYWNrKGJhc2lzLCB0aGlzW2luZGV4XSwgaW5kZXgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBiYXNpcztcbiAgICB9XG4pO1xuXG52YXIgYXJyYXlfaW5kZXhPZiA9IHVuY3VycnlUaGlzKFxuICAgIEFycmF5LnByb3RvdHlwZS5pbmRleE9mIHx8IGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAvLyBub3QgYSB2ZXJ5IGdvb2Qgc2hpbSwgYnV0IGdvb2QgZW5vdWdoIGZvciBvdXIgb25lIHVzZSBvZiBpdFxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRoaXMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmICh0aGlzW2ldID09PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiAtMTtcbiAgICB9XG4pO1xuXG52YXIgYXJyYXlfbWFwID0gdW5jdXJyeVRoaXMoXG4gICAgQXJyYXkucHJvdG90eXBlLm1hcCB8fCBmdW5jdGlvbiAoY2FsbGJhY2ssIHRoaXNwKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIGNvbGxlY3QgPSBbXTtcbiAgICAgICAgYXJyYXlfcmVkdWNlKHNlbGYsIGZ1bmN0aW9uICh1bmRlZmluZWQsIHZhbHVlLCBpbmRleCkge1xuICAgICAgICAgICAgY29sbGVjdC5wdXNoKGNhbGxiYWNrLmNhbGwodGhpc3AsIHZhbHVlLCBpbmRleCwgc2VsZikpO1xuICAgICAgICB9LCB2b2lkIDApO1xuICAgICAgICByZXR1cm4gY29sbGVjdDtcbiAgICB9XG4pO1xuXG52YXIgb2JqZWN0X2NyZWF0ZSA9IE9iamVjdC5jcmVhdGUgfHwgZnVuY3Rpb24gKHByb3RvdHlwZSkge1xuICAgIGZ1bmN0aW9uIFR5cGUoKSB7IH1cbiAgICBUeXBlLnByb3RvdHlwZSA9IHByb3RvdHlwZTtcbiAgICByZXR1cm4gbmV3IFR5cGUoKTtcbn07XG5cbnZhciBvYmplY3RfaGFzT3duUHJvcGVydHkgPSB1bmN1cnJ5VGhpcyhPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5KTtcblxudmFyIG9iamVjdF9rZXlzID0gT2JqZWN0LmtleXMgfHwgZnVuY3Rpb24gKG9iamVjdCkge1xuICAgIHZhciBrZXlzID0gW107XG4gICAgZm9yICh2YXIga2V5IGluIG9iamVjdCkge1xuICAgICAgICBpZiAob2JqZWN0X2hhc093blByb3BlcnR5KG9iamVjdCwga2V5KSkge1xuICAgICAgICAgIC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BmYWxsYmFjay5jYWxsKHByb21pc2UsIG9wLCBhcmdzKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICByZXN1bHQgPSByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocmVzb2x2ZSkge1xuICAgICAgICAgICAgcmVzb2x2ZShyZXN1bHQpO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHByb21pc2UuaW5zcGVjdCA9IGluc3BlY3Q7XG5cbiAgICAvLyBYWFggZGVwcmVjYXRlZCBgdmFsdWVPZmAgYW5kIGBleGNlcHRpb25gIHN1cHBvcnRcbiAgICBpZiAoaW5zcGVjdCkge1xuICAgICAgICB2YXIgaW5zcGVjdGVkID0gaW5zcGVjdCgpO1xuICAgICAgICBpZiAoaW5zcGVjdGVkLnN0YXRlID09PSBcInJlamVjdGVkXCIpIHtcbiAgICAgICAgICAgIHByb21pc2UuZXhjZXB0aW9uID0gaW5zcGVjdGVkLnJlYXNvbjtcbiAgICAgICAgfVxuXG4gICAgICAgIHByb21pc2UudmFsdWVPZiA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBpbnNwZWN0ZWQgPSBpbnNwZWN0KCk7XG4gICAgICAgICAgICBpZiAoaW5zcGVjdGVkLnN0YXRlID09PSBcInBlbmRpbmdcIiB8fFxuICAgICAgICAgICAgICAgIGluc3BlY3RlZC5zdGF0ZSA9PT0gXCJyZWplY3RlZFwiKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gaW5zcGVjdGVkLnZhbHVlO1xuICAgICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBwcm9taXNlO1xufVxuXG5Qcm9taXNlLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gXCJbb2JqZWN0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sZWRSZWplY3Rpb25zKSB7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG4gICAgaWYgKHR5cGVvZiBwcm9jZXNzID09PSBcIm9iamVjdFwiICYmIHR5cGVvZiBwcm9jZXNzLmVtaXQgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICBRLm5leHRUaWNrLnJ1bkFmdGVyKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmIChhcnJheV9pbmRleE9mKHVuaGFuZGxlZFJlamVjdGlvbnMsIHByb21pc2UpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIHByb2Nlc3MuZW1pdChcInVuaGFuZGxlZFJlamVjdGlvblwiLCByZWFzb24sIHByb21pc2UpO1xuICAgICAgICAgICAgICAgIHJlcG9ydGVkVW5oYW5kbGVkUmVqZWN0aW9ucy5wdXNoKHByb21pc2UpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICB1bmhhbmRsZWRSZWplY3Rpb25zLnB1c2gocHJvbWlzZSk7XG4gICAgaWYgKHJlYXNvbiAmJiB0eXBlb2YgcmVhc29uLnN0YWNrICE9PSBcInVuZGVmaW5lZFwiKSB7XG4gICAgICAgIHVuaGFuZGxlZFJlYXNvbnMucHVzaChyZWFzb24uc3RhY2spO1xuICAgIH0gZWxzZSB7XG4gICAgICAgIHVuaGFuZGxlZFJlYXNvbnMucHVzaChcIihubyBzdGFjaykgXCIgKyByZWFzb24pO1xuICAgIH1cbn1cblxuZnVuY3Rpb24gdW50cmFja1JlamVjdGlvbihwcm9taXNlKSB7XG4gICAgaWYgKCF0cmFja1VuaGFuZGxlZFJlamVjdGlvbnMpIHtcbiAgICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIHZhciBhdCA9IGFycmF5X2luZGV4T2YodW5oYW5kbGVkUmVqZWN0aW9ucywgcHJvbWlzZSk7XG4gICAgaWYgKGF0ICE9PSAtMSkge1xuICAgICAgICBpZiAodHlwZW9mIHByb2Nlc3Mg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gICAgICAgICAgIGlmICh0eXBlb2YgU3RvcEl0ZXJhdGlvbiA9PT0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICAgICAgICAgIC8vIEVTNiBHZW5lcmF0b3JzXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZ2VuZXJhdG9yW3ZlcmJdKGFyZyk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5kb25lKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBRKHJlc3VsdC52YWx1ZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdoZW4ocmVzdWx0LnZhbHVlLCBjYWxsYmFjaywgZXJyYmFjayk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBTcGlkZXJNb25rZXkgR2VuZXJhdG9yc1xuICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBSZW1vdmUgdGhpcyBjYXNlIHdoZW4gU00gZG9lcyBFUzYgZ2VuZXJhdG9ycy5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBnZW5lcmF0b3JbdmVyYl0oYXJnKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChleGNlcHRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzU3RvcEl0ZXJhdGlvbihleGNlcHRpb24pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUShleGNlcHRpb24udmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAg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zaG90ID0gcHJvbWlzZS5pbnNwZWN0KCkpLnN0YXRlID09PSBcImZ1bGZpbGxlZFwiXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSBzbmFwc2hvdC52YWx1ZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgKytwZW5kaW5nQ291bnQ7XG4gICAgICAgICAgICAgICAgd2hlbihcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLXBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUocHJvbWlzZXMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChwcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQubm90aWZ5KHsgaW5kZXg6IGluZGV4LCB2YWx1ZTogcHJvZ3Jlc3MgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB2b2lkIDApO1xuICAgICAgICBpZiAocGVuZGluZ0NvdW50ID09PSAwKSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKHByb21pc2VzKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZGVmZXJyZWQucHJvbWlzZTtcbiAgICB9KTtcbn1cblxuUHJvbWlzZS5wcm90b3R5cGUuYWxsID0gZnVuY3Rpb24gKC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iAgICAgICAgZnVuY3Rpb24gb25SZWplY3RlZCgpIHtcbiAgICAgICAgICAgIHBlbmRpbmdDb3VudC0tO1xuICAgICAgICAgICAgaWYgKHBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIFwiQ2FuJ3QgZ2V0IGZ1bGZpbGxtZW50IHZhbHVlIGZyb20gYW55IHByb21pc2UsIGFsbCBcIiArXG4gICAgICAgICAgICAgICAgICAgIFwicHJvbWlzZXMgd2VyZSByZWplY3RlZC5cIlxuICAgICAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uUHJvZ3Jlc3MocHJvZ3Jlc3MpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLm5vdGlmeSh7XG4gICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBwcm9ncmVzc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LCB1bmRlZmluZWQpO1xuXG4gICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG59XG5cblByb21pc2UucHJvdG90eXBlLmFueSA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gYW55KHRoaXMpO1xufTtcblxuLyoqXG4gKiBXYWl0cyBmb3IgYWxsIHByb21pc2VzIHRvIGJlIHNldHRsZWQsIGVpdGhlciBmdWxmaWxsZWQgb3JcbiAqIHJlamVjdGVkLiAgVGhpcyBpcyBkaXN0aW5jdCBmcm9tIGBhbGxgIHNpbmNlIHRoYXQgd291bGQgc3RvcFxuICogd2FpdGluZyBhdCB0aGUgZmlyc3QgcmVqZWN0aW9uLiAgVGhlIHByb21pc2UgcmV0dXJuZWQgYnlcbiAqIGBhbGxSZXNvbHZlZGAgd2lsbCBuZXZlciBiZSByZWplY3RlZC5cbiAqI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ub3RoaW5nXG4gKi9cblEubm9kZWlmeSA9IG5vZGVpZnk7XG5mdW5jdGlvbiBub2RlaWZ5KG9iamVjdCwgbm9kZWJhY2spIHtcbiAgICByZXR1cm4gUShvYmplY3QpLm5vZGVpZnkobm9kZWJhY2spO1xufVxuXG5Qcm9taXNlLnByb3RvdHlwZS5ub2RlaWZ5ID0gZnVuY3Rpb24gKG5vZGViYWNrKSB7XG4gICAgaWYgKG5vZGViYWNrKSB7XG4gICAgICAgIHRoaXMudGhlbihmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgICAgIFEubmV4dFRpY2soZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIG5vZGViYWNrKG51bGwsIHZhbHVlKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LCBmdW5jdGlvbiAoZXJyb3IpIHtcbiAgICAgICAgICAgIFEubmV4dFRpY2soZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIG5vZGViYWNrKGVycm9yKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gdGhpcztcbiAgICB9XG59O1xuXG5RLm5vQ29uZmxpY3QgPSBmdW5jdGlvbigpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoXCJRLm5vQ29uZmxpY3Qgb25seSB3b3JrcyB3aGVuIFEgaXMgdXNlZCBhcyBhIGdsb2JhbFwiKTtcbn07XG5cbi8vIEFsbCBjb2RlIGJlZm9yZSB0aGlzIHBvaW50IHdpbGwgYmUgZmlsdGVyZWQgZnJvbSBzdGFjayB0cmFjZXMuXG52YXIgcUVuZGluZ0xpbmUgPSBjYXB0dXJlTGluZSgpO1xuXG5yZXR1cm4gUTtcblxufSk7XG4iXX0=
23242},{"_process":13}],162:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023243/**
23244 * Module dependencies.
23245 */
23246
23247var Emitter = require('emitter');
23248var reduce = require('reduce');
23249
23250/**
23251 * Root reference for iframes.
23252 */
23253
Jian Li83d87a72016-04-20 15:38:24 -070023254var root;
23255if (typeof window !== 'undefined') { // Browser window
23256 root = window;
23257} else if (typeof self !== 'undefined') { // Web Worker
23258 root = self;
23259} else { // Other environments
23260 root = this;
23261}
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023262
23263/**
23264 * Noop.
23265 */
23266
23267function noop(){};
23268
23269/**
23270 * Check if `obj` is a host object,
23271 * we don't want to serialize these :)
23272 *
23273 * TODO: future proof, move to compoent land
23274 *
23275 * @param {Object} obj
23276 * @return {Boolean}
23277 * @api private
23278 */
23279
23280function isHost(obj) {
23281 var str = {}.toString.call(obj);
23282
23283 switch (str) {
23284 case '[object File]':
23285 case '[object Blob]':
23286 case '[object FormData]':
23287 return true;
23288 default:
23289 return false;
23290 }
23291}
23292
23293/**
23294 * Determine XHR.
23295 */
23296
23297request.getXHR = function () {
23298 if (root.XMLHttpRequest
23299 && (!root.location || 'file:' != root.location.protocol
23300 || !root.ActiveXObject)) {
23301 return new XMLHttpRequest;
23302 } else {
23303 try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}
23304 try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}
23305 try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}
23306 try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}
23307 }
23308 return false;
23309};
23310
23311/**
23312 * Removes leading and trailing whitespace, added to support IE.
23313 *
23314 * @param {String} s
23315 * @return {String}
23316 * @api private
23317 */
23318
23319var trim = ''.trim
23320 ? function(s) { return s.trim(); }
23321 : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
23322
23323/**
23324 * Check if `obj` is an object.
23325 *
23326 * @param {Object} obj
23327 * @return {Boolean}
23328 * @api private
23329 */
23330
23331function isObject(obj) {
23332 return obj === Object(obj);
23333}
23334
23335/**
23336 * Serialize the given `obj`.
23337 *
23338 * @param {Object} obj
23339 * @return {String}
23340 * @api private
23341 */
23342
23343function serialize(obj) {
23344 if (!isObject(obj)) return obj;
23345 var pairs = [];
23346 for (var key in obj) {
23347 if (null != obj[key]) {
Jian Li83d87a72016-04-20 15:38:24 -070023348 pushEncodedKeyValuePair(pairs, key, obj[key]);
23349 }
23350 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023351 return pairs.join('&');
23352}
23353
23354/**
Jian Li83d87a72016-04-20 15:38:24 -070023355 * Helps 'serialize' with serializing arrays.
23356 * Mutates the pairs array.
23357 *
23358 * @param {Array} pairs
23359 * @param {String} key
23360 * @param {Mixed} val
23361 */
23362
23363function pushEncodedKeyValuePair(pairs, key, val) {
23364 if (Array.isArray(val)) {
23365 return val.forEach(function(v) {
23366 pushEncodedKeyValuePair(pairs, key, v);
23367 });
23368 }
23369 pairs.push(encodeURIComponent(key)
23370 + '=' + encodeURIComponent(val));
23371}
23372
23373/**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023374 * Expose serialization method.
23375 */
23376
23377 request.serializeObject = serialize;
23378
23379 /**
23380 * Parse the given x-www-form-urlencoded `str`.
23381 *
23382 * @param {String} str
23383 * @return {Object}
23384 * @api private
23385 */
23386
23387function parseString(str) {
23388 var obj = {};
23389 var pairs = str.split('&');
23390 var parts;
23391 var pair;
23392
23393 for (var i = 0, len = pairs.length; i < len; ++i) {
23394 pair = pairs[i];
23395 parts = pair.split('=');
23396 obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
23397 }
23398
23399 return obj;
23400}
23401
23402/**
23403 * Expose parser.
23404 */
23405
23406request.parseString = parseString;
23407
23408/**
23409 * Default MIME type map.
23410 *
23411 * superagent.types.xml = 'application/xml';
23412 *
23413 */
23414
23415request.types = {
23416 html: 'text/html',
23417 json: 'application/json',
23418 xml: 'application/xml',
23419 urlencoded: 'application/x-www-form-urlencoded',
23420 'form': 'application/x-www-form-urlencoded',
23421 'form-data': 'application/x-www-form-urlencoded'
23422};
23423
23424/**
23425 * Default serialization map.
23426 *
23427 * superagent.serialize['application/xml'] = function(obj){
23428 * return 'generated xml here';
23429 * };
23430 *
23431 */
23432
23433 request.serialize = {
23434 'application/x-www-form-urlencoded': serialize,
23435 'application/json': JSON.stringify
23436 };
23437
23438 /**
23439 * Default parsers.
23440 *
23441 * superagent.parse['application/xml'] = function(str){
23442 * return { object parsed from str };
23443 * };
23444 *
23445 */
23446
23447request.parse = {
23448 'application/x-www-form-urlencoded': parseString,
23449 'application/json': JSON.parse
23450};
23451
23452/**
23453 * Parse the given header `str` into
23454 * an object containing the mapped fields.
23455 *
23456 * @param {String} str
23457 * @return {Object}
23458 * @api private
23459 */
23460
23461function parseHeader(str) {
23462 var lines = str.split(/\r?\n/);
23463 var fields = {};
23464 var index;
23465 var line;
23466 var field;
23467 var val;
23468
23469 lines.pop(); // trailing CRLF
23470
23471 for (var i = 0, len = lines.length; i < len; ++i) {
23472 line = lines[i];
23473 index = line.indexOf(':');
23474 field = line.slice(0, index).toLowerCase();
23475 val = trim(line.slice(index + 1));
23476 fields[field] = val;
23477 }
23478
23479 return fields;
23480}
23481
23482/**
23483 * Return the mime type for the given `str`.
23484 *
23485 * @param {String} str
23486 * @return {String}
23487 * @api private
23488 */
23489
23490function type(str){
23491 return str.split(/ *; */).shift();
23492};
23493
23494/**
23495 * Return header field parameters.
23496 *
23497 * @param {String} str
23498 * @return {Object}
23499 * @api private
23500 */
23501
23502function params(str){
23503 return reduce(str.split(/ *; */), function(obj, str){
23504 var parts = str.split(/ *= */)
23505 , key = parts.shift()
23506 , val = parts.shift();
23507
23508 if (key && val) obj[key] = val;
23509 return obj;
23510 }, {});
23511};
23512
23513/**
23514 * Initialize a new `Response` with the given `xhr`.
23515 *
23516 * - set flags (.ok, .error, etc)
23517 * - parse header
23518 *
23519 * Examples:
23520 *
23521 * Aliasing `superagent` as `request` is nice:
23522 *
23523 * request = superagent;
23524 *
23525 * We can use the promise-like API, or pass callbacks:
23526 *
23527 * request.get('/').end(function(res){});
23528 * request.get('/', function(res){});
23529 *
23530 * Sending data can be chained:
23531 *
23532 * request
23533 * .post('/user')
23534 * .send({ name: 'tj' })
23535 * .end(function(res){});
23536 *
23537 * Or passed to `.send()`:
23538 *
23539 * request
23540 * .post('/user')
23541 * .send({ name: 'tj' }, function(res){});
23542 *
23543 * Or passed to `.post()`:
23544 *
23545 * request
23546 * .post('/user', { name: 'tj' })
23547 * .end(function(res){});
23548 *
23549 * Or further reduced to a single call for simple cases:
23550 *
23551 * request
23552 * .post('/user', { name: 'tj' }, function(res){});
23553 *
23554 * @param {XMLHTTPRequest} xhr
23555 * @param {Object} options
23556 * @api private
23557 */
23558
23559function Response(req, options) {
23560 options = options || {};
23561 this.req = req;
23562 this.xhr = this.req.xhr;
23563 // responseText is accessible only if responseType is '' or 'text' and on older browsers
23564 this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined')
23565 ? this.xhr.responseText
23566 : null;
23567 this.statusText = this.req.xhr.statusText;
23568 this.setStatusProperties(this.xhr.status);
23569 this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
23570 // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
23571 // getResponseHeader still works. so we get content-type even if getting
23572 // other headers fails.
23573 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
23574 this.setHeaderProperties(this.header);
23575 this.body = this.req.method != 'HEAD'
23576 ? this.parseBody(this.text ? this.text : this.xhr.response)
23577 : null;
23578}
23579
23580/**
23581 * Get case-insensitive `field` value.
23582 *
23583 * @param {String} field
23584 * @return {String}
23585 * @api public
23586 */
23587
23588Response.prototype.get = function(field){
23589 return this.header[field.toLowerCase()];
23590};
23591
23592/**
23593 * Set header related properties:
23594 *
23595 * - `.type` the content type without params
23596 *
23597 * A response of "Content-Type: text/plain; charset=utf-8"
23598 * will provide you with a `.type` of "text/plain".
23599 *
23600 * @param {Object} header
23601 * @api private
23602 */
23603
23604Response.prototype.setHeaderProperties = function(header){
23605 // content-type
23606 var ct = this.header['content-type'] || '';
23607 this.type = type(ct);
23608
23609 // params
23610 var obj = params(ct);
23611 for (var key in obj) this[key] = obj[key];
23612};
23613
23614/**
23615 * Parse the given body `str`.
23616 *
23617 * Used for auto-parsing of bodies. Parsers
23618 * are defined on the `superagent.parse` object.
23619 *
23620 * @param {String} str
23621 * @return {Mixed}
23622 * @api private
23623 */
23624
23625Response.prototype.parseBody = function(str){
23626 var parse = request.parse[this.type];
23627 return parse && str && (str.length || str instanceof Object)
23628 ? parse(str)
23629 : null;
23630};
23631
23632/**
23633 * Set flags such as `.ok` based on `status`.
23634 *
23635 * For example a 2xx response will give you a `.ok` of __true__
23636 * whereas 5xx will be __false__ and `.error` will be __true__. The
23637 * `.clientError` and `.serverError` are also available to be more
23638 * specific, and `.statusType` is the class of error ranging from 1..5
23639 * sometimes useful for mapping respond colors etc.
23640 *
23641 * "sugar" properties are also defined for common cases. Currently providing:
23642 *
23643 * - .noContent
23644 * - .badRequest
23645 * - .unauthorized
23646 * - .notAcceptable
23647 * - .notFound
23648 *
23649 * @param {Number} status
23650 * @api private
23651 */
23652
23653Response.prototype.setStatusProperties = function(status){
23654 // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
23655 if (status === 1223) {
23656 status = 204;
23657 }
23658
23659 var type = status / 100 | 0;
23660
23661 // status / class
Jian Li83d87a72016-04-20 15:38:24 -070023662 this.status = this.statusCode = status;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023663 this.statusType = type;
23664
23665 // basics
23666 this.info = 1 == type;
23667 this.ok = 2 == type;
23668 this.clientError = 4 == type;
23669 this.serverError = 5 == type;
23670 this.error = (4 == type || 5 == type)
23671 ? this.toError()
23672 : false;
23673
23674 // sugar
23675 this.accepted = 202 == status;
23676 this.noContent = 204 == status;
23677 this.badRequest = 400 == status;
23678 this.unauthorized = 401 == status;
23679 this.notAcceptable = 406 == status;
23680 this.notFound = 404 == status;
23681 this.forbidden = 403 == status;
23682};
23683
23684/**
23685 * Return an `Error` representative of this response.
23686 *
23687 * @return {Error}
23688 * @api public
23689 */
23690
23691Response.prototype.toError = function(){
23692 var req = this.req;
23693 var method = req.method;
23694 var url = req.url;
23695
23696 var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')';
23697 var err = new Error(msg);
23698 err.status = this.status;
23699 err.method = method;
23700 err.url = url;
23701
23702 return err;
23703};
23704
23705/**
23706 * Expose `Response`.
23707 */
23708
23709request.Response = Response;
23710
23711/**
23712 * Initialize a new `Request` with the given `method` and `url`.
23713 *
23714 * @param {String} method
23715 * @param {String} url
23716 * @api public
23717 */
23718
23719function Request(method, url) {
23720 var self = this;
23721 Emitter.call(this);
23722 this._query = this._query || [];
23723 this.method = method;
23724 this.url = url;
23725 this.header = {};
23726 this._header = {};
23727 this.on('end', function(){
23728 var err = null;
23729 var res = null;
23730
23731 try {
23732 res = new Response(self);
23733 } catch(e) {
23734 err = new Error('Parser is unable to parse the response');
23735 err.parse = true;
23736 err.original = e;
23737 return self.callback(err);
23738 }
23739
23740 self.emit('response', res);
23741
23742 if (err) {
23743 return self.callback(err, res);
23744 }
23745
23746 if (res.status >= 200 && res.status < 300) {
23747 return self.callback(err, res);
23748 }
23749
23750 var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
23751 new_err.original = err;
23752 new_err.response = res;
23753 new_err.status = res.status;
23754
Jian Li83d87a72016-04-20 15:38:24 -070023755 self.callback(new_err, res);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023756 });
23757}
23758
23759/**
23760 * Mixin `Emitter`.
23761 */
23762
23763Emitter(Request.prototype);
23764
23765/**
23766 * Allow for extension
23767 */
23768
23769Request.prototype.use = function(fn) {
23770 fn(this);
23771 return this;
23772}
23773
23774/**
23775 * Set timeout to `ms`.
23776 *
23777 * @param {Number} ms
23778 * @return {Request} for chaining
23779 * @api public
23780 */
23781
23782Request.prototype.timeout = function(ms){
23783 this._timeout = ms;
23784 return this;
23785};
23786
23787/**
23788 * Clear previous timeout.
23789 *
23790 * @return {Request} for chaining
23791 * @api public
23792 */
23793
23794Request.prototype.clearTimeout = function(){
23795 this._timeout = 0;
23796 clearTimeout(this._timer);
23797 return this;
23798};
23799
23800/**
23801 * Abort the request, and clear potential timeout.
23802 *
23803 * @return {Request}
23804 * @api public
23805 */
23806
23807Request.prototype.abort = function(){
23808 if (this.aborted) return;
23809 this.aborted = true;
23810 this.xhr.abort();
23811 this.clearTimeout();
23812 this.emit('abort');
23813 return this;
23814};
23815
23816/**
23817 * Set header `field` to `val`, or multiple fields with one object.
23818 *
23819 * Examples:
23820 *
23821 * req.get('/')
23822 * .set('Accept', 'application/json')
23823 * .set('X-API-Key', 'foobar')
23824 * .end(callback);
23825 *
23826 * req.get('/')
23827 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
23828 * .end(callback);
23829 *
23830 * @param {String|Object} field
23831 * @param {String} val
23832 * @return {Request} for chaining
23833 * @api public
23834 */
23835
23836Request.prototype.set = function(field, val){
23837 if (isObject(field)) {
23838 for (var key in field) {
23839 this.set(key, field[key]);
23840 }
23841 return this;
23842 }
23843 this._header[field.toLowerCase()] = val;
23844 this.header[field] = val;
23845 return this;
23846};
23847
23848/**
23849 * Remove header `field`.
23850 *
23851 * Example:
23852 *
23853 * req.get('/')
23854 * .unset('User-Agent')
23855 * .end(callback);
23856 *
23857 * @param {String} field
23858 * @return {Request} for chaining
23859 * @api public
23860 */
23861
23862Request.prototype.unset = function(field){
23863 delete this._header[field.toLowerCase()];
23864 delete this.header[field];
23865 return this;
23866};
23867
23868/**
23869 * Get case-insensitive header `field` value.
23870 *
23871 * @param {String} field
23872 * @return {String}
23873 * @api private
23874 */
23875
23876Request.prototype.getHeader = function(field){
23877 return this._header[field.toLowerCase()];
23878};
23879
23880/**
23881 * Set Content-Type to `type`, mapping values from `request.types`.
23882 *
23883 * Examples:
23884 *
23885 * superagent.types.xml = 'application/xml';
23886 *
23887 * request.post('/')
23888 * .type('xml')
23889 * .send(xmlstring)
23890 * .end(callback);
23891 *
23892 * request.post('/')
23893 * .type('application/xml')
23894 * .send(xmlstring)
23895 * .end(callback);
23896 *
23897 * @param {String} type
23898 * @return {Request} for chaining
23899 * @api public
23900 */
23901
23902Request.prototype.type = function(type){
23903 this.set('Content-Type', request.types[type] || type);
23904 return this;
23905};
23906
23907/**
Jian Li83d87a72016-04-20 15:38:24 -070023908 * Force given parser
23909 *
23910 * Sets the body parser no matter type.
23911 *
23912 * @param {Function}
23913 * @api public
23914 */
23915
23916Request.prototype.parse = function(fn){
23917 this._parser = fn;
23918 return this;
23919};
23920
23921/**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070023922 * Set Accept to `type`, mapping values from `request.types`.
23923 *
23924 * Examples:
23925 *
23926 * superagent.types.json = 'application/json';
23927 *
23928 * request.get('/agent')
23929 * .accept('json')
23930 * .end(callback);
23931 *
23932 * request.get('/agent')
23933 * .accept('application/json')
23934 * .end(callback);
23935 *
23936 * @param {String} accept
23937 * @return {Request} for chaining
23938 * @api public
23939 */
23940
23941Request.prototype.accept = function(type){
23942 this.set('Accept', request.types[type] || type);
23943 return this;
23944};
23945
23946/**
23947 * Set Authorization field value with `user` and `pass`.
23948 *
23949 * @param {String} user
23950 * @param {String} pass
23951 * @return {Request} for chaining
23952 * @api public
23953 */
23954
23955Request.prototype.auth = function(user, pass){
23956 var str = btoa(user + ':' + pass);
23957 this.set('Authorization', 'Basic ' + str);
23958 return this;
23959};
23960
23961/**
23962* Add query-string `val`.
23963*
23964* Examples:
23965*
23966* request.get('/shoes')
23967* .query('size=10')
23968* .query({ color: 'blue' })
23969*
23970* @param {Object|String} val
23971* @return {Request} for chaining
23972* @api public
23973*/
23974
23975Request.prototype.query = function(val){
23976 if ('string' != typeof val) val = serialize(val);
23977 if (val) this._query.push(val);
23978 return this;
23979};
23980
23981/**
23982 * Write the field `name` and `val` for "multipart/form-data"
23983 * request bodies.
23984 *
23985 * ``` js
23986 * request.post('/upload')
23987 * .field('foo', 'bar')
23988 * .end(callback);
23989 * ```
23990 *
23991 * @param {String} name
23992 * @param {String|Blob|File} val
23993 * @return {Request} for chaining
23994 * @api public
23995 */
23996
23997Request.prototype.field = function(name, val){
23998 if (!this._formData) this._formData = new root.FormData();
23999 this._formData.append(name, val);
24000 return this;
24001};
24002
24003/**
24004 * Queue the given `file` as an attachment to the specified `field`,
24005 * with optional `filename`.
24006 *
24007 * ``` js
24008 * request.post('/upload')
24009 * .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
24010 * .end(callback);
24011 * ```
24012 *
24013 * @param {String} field
24014 * @param {Blob|File} file
24015 * @param {String} filename
24016 * @return {Request} for chaining
24017 * @api public
24018 */
24019
24020Request.prototype.attach = function(field, file, filename){
24021 if (!this._formData) this._formData = new root.FormData();
24022 this._formData.append(field, file, filename);
24023 return this;
24024};
24025
24026/**
24027 * Send `data`, defaulting the `.type()` to "json" when
24028 * an object is given.
24029 *
24030 * Examples:
24031 *
24032 * // querystring
24033 * request.get('/search')
24034 * .end(callback)
24035 *
24036 * // multiple data "writes"
24037 * request.get('/search')
24038 * .send({ search: 'query' })
24039 * .send({ range: '1..5' })
24040 * .send({ order: 'desc' })
24041 * .end(callback)
24042 *
24043 * // manual json
24044 * request.post('/user')
24045 * .type('json')
Jian Li83d87a72016-04-20 15:38:24 -070024046 * .send('{"name":"tj"}')
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024047 * .end(callback)
24048 *
24049 * // auto json
24050 * request.post('/user')
24051 * .send({ name: 'tj' })
24052 * .end(callback)
24053 *
24054 * // manual x-www-form-urlencoded
24055 * request.post('/user')
24056 * .type('form')
24057 * .send('name=tj')
24058 * .end(callback)
24059 *
24060 * // auto x-www-form-urlencoded
24061 * request.post('/user')
24062 * .type('form')
24063 * .send({ name: 'tj' })
24064 * .end(callback)
24065 *
24066 * // defaults to x-www-form-urlencoded
24067 * request.post('/user')
24068 * .send('name=tobi')
24069 * .send('species=ferret')
24070 * .end(callback)
24071 *
24072 * @param {String|Object} data
24073 * @return {Request} for chaining
24074 * @api public
24075 */
24076
24077Request.prototype.send = function(data){
24078 var obj = isObject(data);
24079 var type = this.getHeader('Content-Type');
24080
24081 // merge
24082 if (obj && isObject(this._data)) {
24083 for (var key in data) {
24084 this._data[key] = data[key];
24085 }
24086 } else if ('string' == typeof data) {
24087 if (!type) this.type('form');
24088 type = this.getHeader('Content-Type');
24089 if ('application/x-www-form-urlencoded' == type) {
24090 this._data = this._data
24091 ? this._data + '&' + data
24092 : data;
24093 } else {
24094 this._data = (this._data || '') + data;
24095 }
24096 } else {
24097 this._data = data;
24098 }
24099
24100 if (!obj || isHost(data)) return this;
24101 if (!type) this.type('json');
24102 return this;
24103};
24104
24105/**
24106 * Invoke the callback with `err` and `res`
24107 * and handle arity check.
24108 *
24109 * @param {Error} err
24110 * @param {Response} res
24111 * @api private
24112 */
24113
24114Request.prototype.callback = function(err, res){
24115 var fn = this._callback;
24116 this.clearTimeout();
24117 fn(err, res);
24118};
24119
24120/**
24121 * Invoke callback with x-domain error.
24122 *
24123 * @api private
24124 */
24125
24126Request.prototype.crossDomainError = function(){
24127 var err = new Error('Origin is not allowed by Access-Control-Allow-Origin');
24128 err.crossDomain = true;
24129 this.callback(err);
24130};
24131
24132/**
24133 * Invoke callback with timeout error.
24134 *
24135 * @api private
24136 */
24137
24138Request.prototype.timeoutError = function(){
24139 var timeout = this._timeout;
24140 var err = new Error('timeout of ' + timeout + 'ms exceeded');
24141 err.timeout = timeout;
24142 this.callback(err);
24143};
24144
24145/**
24146 * Enable transmission of cookies with x-domain requests.
24147 *
24148 * Note that for this to work the origin must not be
24149 * using "Access-Control-Allow-Origin" with a wildcard,
24150 * and also must set "Access-Control-Allow-Credentials"
24151 * to "true".
24152 *
24153 * @api public
24154 */
24155
24156Request.prototype.withCredentials = function(){
24157 this._withCredentials = true;
24158 return this;
24159};
24160
24161/**
24162 * Initiate request, invoking callback `fn(res)`
24163 * with an instanceof `Response`.
24164 *
24165 * @param {Function} fn
24166 * @return {Request} for chaining
24167 * @api public
24168 */
24169
24170Request.prototype.end = function(fn){
24171 var self = this;
24172 var xhr = this.xhr = request.getXHR();
24173 var query = this._query.join('&');
24174 var timeout = this._timeout;
24175 var data = this._formData || this._data;
24176
24177 // store callback
24178 this._callback = fn || noop;
24179
24180 // state change
24181 xhr.onreadystatechange = function(){
24182 if (4 != xhr.readyState) return;
24183
24184 // In IE9, reads to any property (e.g. status) off of an aborted XHR will
24185 // result in the error "Could not complete the operation due to error c00c023f"
24186 var status;
24187 try { status = xhr.status } catch(e) { status = 0; }
24188
24189 if (0 == status) {
24190 if (self.timedout) return self.timeoutError();
24191 if (self.aborted) return;
24192 return self.crossDomainError();
24193 }
24194 self.emit('end');
24195 };
24196
24197 // progress
24198 var handleProgress = function(e){
24199 if (e.total > 0) {
24200 e.percent = e.loaded / e.total * 100;
24201 }
24202 self.emit('progress', e);
24203 };
24204 if (this.hasListeners('progress')) {
24205 xhr.onprogress = handleProgress;
24206 }
24207 try {
24208 if (xhr.upload && this.hasListeners('progress')) {
24209 xhr.upload.onprogress = handleProgress;
24210 }
24211 } catch(e) {
24212 // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
24213 // Reported here:
24214 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
24215 }
24216
24217 // timeout
24218 if (timeout && !this._timer) {
24219 this._timer = setTimeout(function(){
24220 self.timedout = true;
24221 self.abort();
24222 }, timeout);
24223 }
24224
24225 // querystring
24226 if (query) {
24227 query = request.serializeObject(query);
24228 this.url += ~this.url.indexOf('?')
24229 ? '&' + query
24230 : '?' + query;
24231 }
24232
24233 // initiate request
24234 xhr.open(this.method, this.url, true);
24235
24236 // CORS
24237 if (this._withCredentials) xhr.withCredentials = true;
24238
24239 // body
24240 if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
24241 // serialize stuff
Jian Li83d87a72016-04-20 15:38:24 -070024242 var contentType = this.getHeader('Content-Type');
24243 var serialize = this._parser || request.serialize[contentType ? contentType.split(';')[0] : ''];
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024244 if (serialize) data = serialize(data);
24245 }
24246
24247 // set header fields
24248 for (var field in this.header) {
24249 if (null == this.header[field]) continue;
24250 xhr.setRequestHeader(field, this.header[field]);
24251 }
24252
24253 // send stuff
24254 this.emit('request', this);
Jian Li83d87a72016-04-20 15:38:24 -070024255
24256 // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
24257 // We need null here if data is undefined
24258 xhr.send(typeof data !== 'undefined' ? data : null);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024259 return this;
24260};
24261
24262/**
Jian Li83d87a72016-04-20 15:38:24 -070024263 * Faux promise support
24264 *
24265 * @param {Function} fulfill
24266 * @param {Function} reject
24267 * @return {Request}
24268 */
24269
24270Request.prototype.then = function (fulfill, reject) {
24271 return this.end(function(err, res) {
24272 err ? reject(err) : fulfill(res);
24273 });
24274}
24275
24276/**
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024277 * Expose `Request`.
24278 */
24279
24280request.Request = Request;
24281
24282/**
24283 * Issue a request:
24284 *
24285 * Examples:
24286 *
24287 * request('GET', '/users').end(callback)
24288 * request('/users').end(callback)
24289 * request('/users', callback)
24290 *
24291 * @param {String} method
24292 * @param {String|Function} url or callback
24293 * @return {Request}
24294 * @api public
24295 */
24296
24297function request(method, url) {
24298 // callback
24299 if ('function' == typeof url) {
24300 return new Request('GET', method).end(url);
24301 }
24302
24303 // url first
24304 if (1 == arguments.length) {
24305 return new Request('GET', method);
24306 }
24307
24308 return new Request(method, url);
24309}
24310
24311/**
24312 * GET `url` with optional callback `fn(res)`.
24313 *
24314 * @param {String} url
24315 * @param {Mixed|Function} data or fn
24316 * @param {Function} fn
24317 * @return {Request}
24318 * @api public
24319 */
24320
24321request.get = function(url, data, fn){
24322 var req = request('GET', url);
24323 if ('function' == typeof data) fn = data, data = null;
24324 if (data) req.query(data);
24325 if (fn) req.end(fn);
24326 return req;
24327};
24328
24329/**
24330 * HEAD `url` with optional callback `fn(res)`.
24331 *
24332 * @param {String} url
24333 * @param {Mixed|Function} data or fn
24334 * @param {Function} fn
24335 * @return {Request}
24336 * @api public
24337 */
24338
24339request.head = function(url, data, fn){
24340 var req = request('HEAD', url);
24341 if ('function' == typeof data) fn = data, data = null;
24342 if (data) req.send(data);
24343 if (fn) req.end(fn);
24344 return req;
24345};
24346
24347/**
24348 * DELETE `url` with optional callback `fn(res)`.
24349 *
24350 * @param {String} url
24351 * @param {Function} fn
24352 * @return {Request}
24353 * @api public
24354 */
24355
Jian Li83d87a72016-04-20 15:38:24 -070024356function del(url, fn){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024357 var req = request('DELETE', url);
24358 if (fn) req.end(fn);
24359 return req;
24360};
24361
Jian Li83d87a72016-04-20 15:38:24 -070024362request.del = del;
24363request.delete = del;
24364
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024365/**
24366 * PATCH `url` with optional `data` and callback `fn(res)`.
24367 *
24368 * @param {String} url
24369 * @param {Mixed} data
24370 * @param {Function} fn
24371 * @return {Request}
24372 * @api public
24373 */
24374
24375request.patch = function(url, data, fn){
24376 var req = request('PATCH', url);
24377 if ('function' == typeof data) fn = data, data = null;
24378 if (data) req.send(data);
24379 if (fn) req.end(fn);
24380 return req;
24381};
24382
24383/**
24384 * POST `url` with optional `data` and callback `fn(res)`.
24385 *
24386 * @param {String} url
24387 * @param {Mixed} data
24388 * @param {Function} fn
24389 * @return {Request}
24390 * @api public
24391 */
24392
24393request.post = function(url, data, fn){
24394 var req = request('POST', url);
24395 if ('function' == typeof data) fn = data, data = null;
24396 if (data) req.send(data);
24397 if (fn) req.end(fn);
24398 return req;
24399};
24400
24401/**
24402 * PUT `url` with optional `data` and callback `fn(res)`.
24403 *
24404 * @param {String} url
24405 * @param {Mixed|Function} data or fn
24406 * @param {Function} fn
24407 * @return {Request}
24408 * @api public
24409 */
24410
24411request.put = function(url, data, fn){
24412 var req = request('PUT', url);
24413 if ('function' == typeof data) fn = data, data = null;
24414 if (data) req.send(data);
24415 if (fn) req.end(fn);
24416 return req;
24417};
24418
24419/**
24420 * Expose `request`.
24421 */
24422
24423module.exports = request;
24424
Jian Li83d87a72016-04-20 15:38:24 -070024425},{"emitter":163,"reduce":164}],163:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024426
24427/**
24428 * Expose `Emitter`.
24429 */
24430
24431module.exports = Emitter;
24432
24433/**
24434 * Initialize a new `Emitter`.
24435 *
24436 * @api public
24437 */
24438
24439function Emitter(obj) {
24440 if (obj) return mixin(obj);
24441};
24442
24443/**
24444 * Mixin the emitter properties.
24445 *
24446 * @param {Object} obj
24447 * @return {Object}
24448 * @api private
24449 */
24450
24451function mixin(obj) {
24452 for (var key in Emitter.prototype) {
24453 obj[key] = Emitter.prototype[key];
24454 }
24455 return obj;
24456}
24457
24458/**
24459 * Listen on the given `event` with `fn`.
24460 *
24461 * @param {String} event
24462 * @param {Function} fn
24463 * @return {Emitter}
24464 * @api public
24465 */
24466
24467Emitter.prototype.on =
24468Emitter.prototype.addEventListener = function(event, fn){
24469 this._callbacks = this._callbacks || {};
24470 (this._callbacks[event] = this._callbacks[event] || [])
24471 .push(fn);
24472 return this;
24473};
24474
24475/**
24476 * Adds an `event` listener that will be invoked a single
24477 * time then automatically removed.
24478 *
24479 * @param {String} event
24480 * @param {Function} fn
24481 * @return {Emitter}
24482 * @api public
24483 */
24484
24485Emitter.prototype.once = function(event, fn){
24486 var self = this;
24487 this._callbacks = this._callbacks || {};
24488
24489 function on() {
24490 self.off(event, on);
24491 fn.apply(this, arguments);
24492 }
24493
24494 on.fn = fn;
24495 this.on(event, on);
24496 return this;
24497};
24498
24499/**
24500 * Remove the given callback for `event` or all
24501 * registered callbacks.
24502 *
24503 * @param {String} event
24504 * @param {Function} fn
24505 * @return {Emitter}
24506 * @api public
24507 */
24508
24509Emitter.prototype.off =
24510Emitter.prototype.removeListener =
24511Emitter.prototype.removeAllListeners =
24512Emitter.prototype.removeEventListener = function(event, fn){
24513 this._callbacks = this._callbacks || {};
24514
24515 // all
24516 if (0 == arguments.length) {
24517 this._callbacks = {};
24518 return this;
24519 }
24520
24521 // specific event
24522 var callbacks = this._callbacks[event];
24523 if (!callbacks) return this;
24524
24525 // remove all handlers
24526 if (1 == arguments.length) {
24527 delete this._callbacks[event];
24528 return this;
24529 }
24530
24531 // remove specific handler
24532 var cb;
24533 for (var i = 0; i < callbacks.length; i++) {
24534 cb = callbacks[i];
24535 if (cb === fn || cb.fn === fn) {
24536 callbacks.splice(i, 1);
24537 break;
24538 }
24539 }
24540 return this;
24541};
24542
24543/**
24544 * Emit `event` with the given args.
24545 *
24546 * @param {String} event
24547 * @param {Mixed} ...
24548 * @return {Emitter}
24549 */
24550
24551Emitter.prototype.emit = function(event){
24552 this._callbacks = this._callbacks || {};
24553 var args = [].slice.call(arguments, 1)
24554 , callbacks = this._callbacks[event];
24555
24556 if (callbacks) {
24557 callbacks = callbacks.slice(0);
24558 for (var i = 0, len = callbacks.length; i < len; ++i) {
24559 callbacks[i].apply(this, args);
24560 }
24561 }
24562
24563 return this;
24564};
24565
24566/**
24567 * Return array of callbacks for `event`.
24568 *
24569 * @param {String} event
24570 * @return {Array}
24571 * @api public
24572 */
24573
24574Emitter.prototype.listeners = function(event){
24575 this._callbacks = this._callbacks || {};
24576 return this._callbacks[event] || [];
24577};
24578
24579/**
24580 * Check if this emitter has `event` handlers.
24581 *
24582 * @param {String} event
24583 * @return {Boolean}
24584 * @api public
24585 */
24586
24587Emitter.prototype.hasListeners = function(event){
24588 return !! this.listeners(event).length;
24589};
24590
Jian Li83d87a72016-04-20 15:38:24 -070024591},{}],164:[function(require,module,exports){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024592
24593/**
24594 * Reduce `arr` with `fn`.
24595 *
24596 * @param {Array} arr
24597 * @param {Function} fn
24598 * @param {Mixed} initial
24599 *
24600 * TODO: combatible error handling?
24601 */
24602
24603module.exports = function(arr, fn, initial){
24604 var idx = 0;
24605 var len = arr.length;
24606 var curr = arguments.length == 3
24607 ? initial
24608 : arr[idx++];
24609
24610 while (idx < len) {
24611 curr = fn.call(null, curr, arr[idx], ++idx, arr);
24612 }
24613
24614 return curr;
24615};
24616},{}]},{},[1])(1)
24617});
Jian Li83d87a72016-04-20 15:38:24 -070024618//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hdXRoLmpzIiwibGliL2NsaWVudC5qcyIsImxpYi9oZWxwZXJzLmpzIiwibGliL2h0dHAuanMiLCJsaWIvcmVzb2x2ZXIuanMiLCJsaWIvc2NoZW1hLW1hcmt1cC5qcyIsImxpYi9zcGVjLWNvbnZlcnRlci5qcyIsImxpYi90eXBlcy9tb2RlbC5qcyIsImxpYi90eXBlcy9vcGVyYXRpb24uanMiLCJsaWIvdHlwZXMvb3BlcmF0aW9uR3JvdXAuanMiLCJub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvYnJvd3Nlci1yZXNvbHZlL2VtcHR5LmpzIiwibm9kZV9tb2R1bGVzL2Jyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL3Byb2Nlc3MvYnJvd3Nlci5qcyIsIm5vZGVfbW9kdWxlcy9idG9hL2luZGV4LmpzIiwibm9kZV9tb2R1bGVzL2J1ZmZlci9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9idWZmZXIvbm9kZV9tb2R1bGVzL2Jhc2U2NC1qcy9saWIvYjY0LmpzIiwibm9kZV9tb2R1bGVzL2J1ZmZlci9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcyIsIm5vZGVfbW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gICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKG9iai51cmwuaW5kZXhPZignPycpID4gMCkge1xuICAgICAgb2JqLnVybCA9IG9iai51cmwgKyAnJicgKyB0aGlzLm5hbWUgKyAnPScgKyB0aGlzLnZhbHVlO1xuICAgIH0gZWxzZSB7XG4gICAgICBvYmoudXJsID0gb2JqLnVybCArICc/JyArIHRoaXMubmFtZSArICc9JyArIHRoaXMudmFsdWU7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG4gIH0gZWxzZSBpZiAodGhpcy50eXBlID09PSAnaGVhZGVyJykge1xuICAgIGlmKHR5cGVvZiBvYmouaGVhZGVyc1t0aGlzLm5hbWVdID09PSAndW5kZWZpbmVkJykge1xuICAgICAgb2JqLmhlYWRlcnNbdGhpcy5uYW1lXSA9IHRoaXMudmFsdWU7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG4gIH1cbn07XG5cbnZhciBDb29raWVBdXRob3JpemF0aW9uID0gbW9kdWxlLmV4cG9ydHMuQ29va2llQXV0aG9yaXphdGlvbiA9IGZ1bmN0aW9uIChjb29raWUpIHtcbiAgdGhpcy5jb29raWUgPSBjb29raWU7XG59O1xuXG5Db29raWVBdXRob3JpemF0aW9uLnByb3RvdHlwZS5hcHBseSA9IGZ1bmN0aW9uIChvYmopIHtcbiAgb2JqLmNvb2tpZUphciA9IG9iai5jb29raWVKYXIgfHwgbmV3IENvb2tpZUphcigpO1xuICBvYmouY29va2llSmFyLnNldENvb2tpZSh0aGlzLmNvb2tpZSk7XG5cbiAgcmV0dXJuIHRydWU7XG59O1xuXG4vKipcbiAqIFBhc3N3b3JkIEF1dGhvcml6YXRpb24gaXMgYSBiYXNpYyBhdXRoIGltcGxlbWVudGF0aW9uXG4gKi9cbnZhciBQYXNzd29yZEF1dGhvcml6YXRpb24gPSBtb2R1bGUuZXhwb3J0cy5QYXNzd29yZEF1dGhvcml6YXRpb24gPSBmdW5jdGlvbiAodXNlcm5hb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HRvIHRoZSBhcGlzIG9iamVjdFxuICAgICAgICBzZWxmLmFwaXNbYXBpUHJvcGVydHldW29wZXJhdGlvbklkXSA9IG9wZXJhdGlvbkdyb3VwW29wZXJhdGlvbklkXSA9IF8uYmluZChvcGVyYXRpb25PYmplY3QuZXhlY3V0ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRpb25PYmplY3QpO1xuICAgICAgICBzZWxmLmFwaXNbYXBpUHJvcGVydHldW29wZXJhdGlvbklkXS5oZWxwID0gb3BlcmF0aW9uR3JvdXBbb3BlcmF0aW9uSWRdLmhlbHAgPSBfLmJpbmQob3BlcmF0aW9uT2JqZWN0LmhlbHAsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVyYXRpb25PYmplY3QpO1xuICAgICAgICBzZWxmLmFwaXNbYXBpUHJvcGVydHldW29wZXJhdGlvbklkXS5hc0N1cmwgPSBvcGVyYXRpb25Hcm91cFtvcGVyYXRpb25JZF0uYXNDdXJsID0gXy5iaW5kKG9wZXJhdGlvbk9iamVjdC5hc0N1cmwsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BlcmF0aW9uT2JqZWN0KTtcblxuICAgICAgICBvcGVyYXRpb25Hcm91cC5hcGlzW29wZXJhdGlvbklkXSA9IG9wZXJhdGlvbkdyb3VwLm9wZXJhdGlvbnNbb3BlcmF0aW9uSWRdID0gb3BlcmF0aW9uT2JqZWN0O1xuXG4gICAgICAgIC8vIGxlZ2FjeSBVSSBmZWF0dXJlXG4gICAgICAgIHZhciBhcGkgPSBfLmZpbmQoc2VsZi5hcGlzQXJyYXksI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XJzICYmIHJlcy5oZWFkZXJzWydjb250ZW50LXR5cGUnXSkge1xuICAgICAgICBpZihyZXMuaGVhZGVyc1snY29udGVudC10eXBlJ10uaW5kZXhPZignYXBwbGljYXRpb24vanNvbicpID49IDApIHtcbiAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmVzcG9uc2Uub2JqID0gSlNPTi5wYXJzZShyZXNwb25zZS5zdGF0dXNUZXh0KTtcbiAgICAgICAgICB9XG4gICAgICAgICAgY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHJlc3BvbnNlLm9iaiA9IG51bGw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICBjYiA9IG9iai5vbi5lcnJvcjtcbiAgICB9IGVsc2UgaWYgKHJlcyAmJiBvYmoub24gJiYgb2JqLm9uLnJlc3BvbnNlKSB7XG4gICAgICB2YXIgcG9zc2libGVPYmo7XG5cbiAgICAgIC8vIEFscmVhZHkgcGFyc2VkIGJ5IGJ5IHN1cGVyYWdlbnQ/XG4gICAgICBpZihyZXMuYm9keSAmJiBPYmplY3Qua2V5cyhyZXMuYm9keSkubGVuZ3RoID4gMCkge1xuICAgICAgICBwb3NzaWJsZU9iaiA9IHJlcy5ib2R5O1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgcG9zc2libGVPYmogPSBqc3lhbWwuc2FmZUxvYWQocmVzLnRleHQpO1xuICAgICAgICAgICAgLy8gY2FuIHBhcnNlIGludG8gYSBzdHJpbmcuLi4gd2hpY2ggd2UgZG9uJ3QgbmVlZCBydW5uaW5nIGFyb3VuZCBpbiB0aGUgc3lzdGVtXG4gICAgICAgICAgICBwb3NzaWJsZU9iaiA9ICh0eXBlb2YgcG9zc2libGVPYmogPT09ICdzdHJpbmcnKSA/IG51bGwgOiBwb3NzaWJsZU9iajtcbiAgICAgICAgICB9IGNhdGNoKGUpIHtcbiAgICAgICAgICAgIGhlbHBlcnMubG9nKCdjYW5ub3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ICAgICAgICAgICBpZih0eXBlb2Ygc3BlYy5kZWZpbml0aW9uc1tuYW1lXSA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICAgIGRvbmUgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5hbWUgPSBtb2RlbE5hbWUgKyAnXycgKyBjb3VudGVyO1xuICAgICAgICAgICAgICAgIGNvdW50ZXIgKys7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgc3BlYy5kZWZpbml0aW9uc1tuYW1lXSA9IHsgYWxsT2Y6IHBhcmFtZXRlci5zY2hlbWEuYWxsT2YgfTtcbiAgICAgICAgICAgICAgZGVsZXRlIHBhcmFtZXRlci5zY2hlbWEuYWxsT2Y7XG4gICAgICAgICAgICAgIHBhcmFtZXRlci5zY2hlbWEuJHJlZiA9ICcjL2RlZmluaXRpb25zLycgKyBuYW1lO1xuICAgICAgICAgICAgICB0aGlzLnByb2Nlc3NBbGxPZihyb290LCBuYW1lLCBzcGVjLmRlZmluaXRpb25zW25hbWVdLCByZXNvbHV0aW9uVGFibGUsIHVucmVzb2x2ZWRSZWZzLCBzcGVjKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICB0aGlzLnJlc29sdmVUbyhyb290LCBwYXJhbWV0ZXIuc2NoZW1hLCByZXNvbHV0aW9uVGFibGUsIGxvY2F0aW9uKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAocGFyYW1ldGVyLiRyZWYpIHtcbiAgICAgICAgICAgIC8vIHBhcmFtZXRlciByZWZlcmVuY2VcbiAgICAgICAgICAgIHRoaXMucmVzb2x2ZUlubGluZShyb290LCBzcGVjLCBwYXJhbWV0ZXIsIHJlc29sdXRpb25UYWJsZSwgdW5yZXNvbHZlZFJlZnMsIHBhcmFtZXRlci4kcmV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2x1dGlvblRhYmxlO1xuXG4gIHZhciBwYXJ0cztcbiAgZm9yKGkgPSAwOyBpIDwgYWxsLmxlbmd0aDsgaSsrKSB7XG4gICAgdmFyIGEgPSBhbGxbaV07XG4gICAgaWYocm9vdCA9PT0gYS5yb290KSB7XG4gICAgICBpZihhLnJlc29sdmVBcyA9PT0gJ3JlZicpIHtcbiAgICAgICAgLy8gcmVzb2x2ZSBhbnkgcGF0aCB3YWxraW5nXG4gICAgICAgIHZhciBqb2luZWQgPSAoKGEucm9vdCB8fCAnJykgKyAnLycgKyBhLmtleSkuc3BsaXQoJy8nKTtcbiAgICAgICAgdmFyIG5vcm1hbGl6ZWQgPSBbXTtcbiAgICAgICAgdmFyIHVybCA9ICcnO1xuICAgICAgICB2YXIgaztcblxuICAgICAgICBpZihhLmtleS5pbmRleE9mKCcuLi8nKSA+PSAwKSB7XG4gICAgICAgICAgZm9yKHZhciBqID0gMDsgaiA8IGpvaW5lZC5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgaWYoam9pbmVkW2pdID09PSAnLi4nKSB7XG4gICAgICAgICAgICAgIG5vcm1hbGl6ZWQgPSBub3JtYWxpemVkLnNsaWNlKDAsIG5vcm1hbGl6ZWQubGVuZ3RoLTEpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgIG5vcm1hbGl6ZWQucHVzaChqb2luZWRbal0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBmb3IoayA9IDA7IGsgPCBub3JtYWxpemVkLmxlbmd0aDsgayArKykge1xuICAgICAgICAgICAgaWYoayA+IDApIHtcbiAgICAgICAgICAgICAgdXJsICs9ICcvJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHVybCArPSBub3JtYWxpemVkW2tdO1xuICAgICAgICAgIH1cbiAgICAgICAgICAvLyB3ZSBub3cgaGF2ZSB0byByZW1vdGUgcmVzb2x2ZSB0aGlzIGJlY2F1c2UgdGhlIHBhdGggaGFzIGNoYW5nZWRcbiAgICAgICAgICBhLnJvb3QgPSB1cmw7XG4gICAgICAgICAgdG9SZXNvbHZlLnB1c2goYSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgcGFydHMgPSBhLmtleS5zcGxpdCgnIycpO1xuICAgICAgICAgIGlmKHBhcnRzLmxlbmd0aCA9PT0gMikge1xuICAgICAgICAgICAgaWYocGFydHNbMF0uaW5kZXhPZignaHR0cDovLycpID09PSAwIHx8IHBhcnRzWzBdLmluZGV4T2YoJ2h0dHBzOi8vJykgPT09IDApIHtcbiAgICAgICAgICAgICAgYS5yb290ID0gcGFydHNbMF07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsb2NhdGlvbiA9IHBhcnRzWzFdLnNwbGl0KCcvJyk7XG4gICAgICAgICAgICB2YXIgcjtcbiAgICAgICAgICAgIHZhciBzID0gc3BlYztcbiAgICAgICAgICAgIGZvcihrID0gMDsgayA8IGxvY2F0aW9uLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIHZhciBwYXJ0ID0gbG9jYXRpb25ba107XG4gICAgICAgICAgICAgIGlmKHBhcnQgIT09ICcnKSB7XG4gICAgICAgICAgICAgICAgcyA9IHNbcGFydF07XG4gICAgICAgICAgICAgICAgaWYodHlwZW9mIHMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICByID0gcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICByID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYociA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAvLyBtdXN0IHJlc29sdmUgdGhpcyB0b29cbiAgICAgICAgICAgICAgdG9SZXNvbHZlLnB1c2goYSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgaWYgKGEucmVzb2x2ZUFzID09PSAnaW5saW5lJykge1xuICAgICAgICAgIGlmKGEua2V5ICYmIGEua2V5LmluZGV4T2YoJyMnKSA9PT0gLTEgJiYgYS5rZXkuY2hhckF0KDApICE9PSAnLycpIHtcbiAgICAgICAgICAgIC8vIGhhbmRsZSByZWxhdGl2ZSBzY2hlbWFcbiAgICAgICAgICAgIHBhcnRzID0gYS5yb290LnNwbGl0KCcvJyk7XG4gICAgICAgICAgICBsb2NhdGlvbiA9ICcnO1xuICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgcGFydHMubGVuZ3RoIC0gMTsgaSsrKSB7XG4gICAgICAgICAgICAgIGxvY2F0aW9uICs9IHBhcnRzW2ldICsgJy8nO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbG9jYXRpb24gKz0gYS5rZXk7XG4gICAgICAgICAgICBhLnJvb3QgPSBsb2NhdGlvbjtcbiAgICAgICAgICAgIGEubG9jYXRpb24gPSAnJztcbiAgICAgICAgICB9XG4gICAgICAgICAgdG9SZXNvbHZlLnB1c2goYSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gICAgZWxzZSB7XG4gICAgICB0b1Jlc29sdmUucHVzaChhKTtcbiAgICB9XG4gIH1cbiAgZXhwZWN0ZWRDYWxscyA9IHRvUmVzb2x2ZS5sZW5ndGg7XG5cbiAgLy8gcmVzb2x2ZSBhbnl0aGluZyB0aGF0IGlzIGxvY2FsXG4gIGZvcih2YXIgaWkgPSAwOyBpaSA8IHRvUmVzb2x2ZS5sZW5ndGg7IGlpKyspIHtcbiAgICAoZnVuY3Rpb24oaXRlbSwgc3BlYywgc2VsZikge1xuICAgICAgaWYoaXRlbS5yb290ID09PSBudWxsIHx8IGl0ZW0ucm9vdCA9PT0gcm9vdCkge1xuICAgICAgICAvLyBsb2NhbCBy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lKS5sZW5ndGggPT09IDApIHtcbiAgICB0aGlzLmZpbmlzaChzcGVjLCBfcm9vdCwgcmVzb2x1dGlvblRhYmxlLCByZXNvbHZlZFJlZnMsIHVucmVzb2x2ZWRSZWZzLCBjYWxsYmFjayk7XG4gIH1cbn07XG5cblJlc29sdmVyLnByb3RvdHlwZS5yZXNvbHZlSXRlbSA9IGZ1bmN0aW9uKHNwZWMsIHJvb3QsIHJlc29sdXRpb25UYWJsZSwgcmVzb2x2ZWRSZWZzLCB1bnJlc29sdmVkUmVmcywgaXRlbSkge1xuICB2YXIgcGF0aCA9IGl0ZW0ubG9jYXRpb247XG4gIHZhciBsb2NhdGlvbiA9IHNwZWMsIHBhcnRzID0gcGF0aC5zcGxpdCgnLycpO1xuICBpZihwYXRoICE9PSAnJykge1xuICAgIGZvciAodmFyIGogPSAwOyBqIDwgcGFydHMubGVuZ3RoOyBqKyspIHtcbiAgICAgIHZhciBzZWdtZW50ID0gcGFydHNbal07XG4gICAgICBpZiAoc2VnbWVudC5pbmRleE9mKCd+MScpICE9PSAtMSkge1xuICAgICAgICBzZWdtZW50ID0gcGFydHNbal0ucmVwbGFjZSgvfjAvZywgJ34nKS5yZXBsYWNlKC9+MS9nLCAnLycpO1xuICAgICAgICBpZiAoc2VnbWVudC5jaGFyQXQoMCkgIT09ICcvJykge1xuICAgICAgICAgIHNlZ21lbnQgPSAnLycgKyBzZWdtZW50O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAodHlwZW9mIGxvY2F0aW9uID09PSAndW5kZWZpbmVkJyB8fCBsb2NhdGlvbiA9PT0gbnVsbCkge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICAgIGlmIChzZWdtZW50ID09PSAnJyAmJiBqID09PSAocGFydHMubGVuZ3RoIC0gMSkgJiYgcGFydHMubGVuZ3RoID4gMSkge1xuICAgICAgICBsb2NhdGlvbiA9IG51bGw7XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgICAgaWYgKH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0eSwgcmVzb2x1dGlvblRhYmxlLCB1bnJlc29sdmVkUmVmcywgbG9jYXRpb24pIHtcbiAgdmFyIGtleSA9IHByb3BlcnR5LiRyZWYsIHJlZiA9IHByb3BlcnR5LiRyZWYsIGksIHAsIHAyLCBycztcbiAgdmFyIHJvb3RUcmltbWVkID0gZmFsc2U7XG4gIGlmIChyZWYpIHtcbiAgICBpZihyZWYuaW5kZXhPZignLi4vJykgPT09IDApIHtcbiAgICAgIC8vIHJlc2V0IHJvb3RcbiAgICAgIHAgPSByZWYuc3BsaXQoJy4uLycpO1xuICAgICAgcDIgPSByb290LnNwbGl0KCcvJyk7XG4gICAgICByZWYgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHAubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgaWYocFtpXSA9PT0gJycpIHtcbiAgICAgICAgICBwMiA9IHAyLnNsaWNlKDAsIHAyLmxlbmd0aC0xKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICByZWYgKz0gcFtpXTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcm9vdCA9ICcnO1xuICAgICAgZm9yKGkgPSAwOyBpIDwgcDIubGVuZ3RoIC0gMTsgaSsrKSB7XG4gICAgICAgIGlmKGkgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgIHJvb3QgKz0gcDJbaV07XG4gICAgICB9XG4gICAgICByb290VHJpbW1lZCA9IHRydWU7XG4gICAgfVxuICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgaWYocmVmLmluZGV4T2YoJy8nKSA9PT0gMCkge1xuICAgICAgICBycyA9IHJlZi5zcGxpdCgnIycpO1xuICAgICAgICBwICA9IHJvb3Quc3BsaXQoJy8vJyk7XG4gICAgICAgIHAyID0gcFsxXS5zcGxpdCgnLycpO1xuICAgICAgICByb290ID0gcFswXSArICcvLycgKyBwMlswXSArIHJzWzBdO1xuICAgICAgICBsb2NhdGlvbiA9IHJzWzFdO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG4gICAgICAgIHJzID0gcmVmLnNwbGl0KCcjJyk7XG4gICAgICAgIGlmKHJzWzBdICE9PSAnJykge1xuICAgICAgICAgIHAyID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgICAgIHAyID0gcDIuc2xpY2UoMCwgcDIubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgaWYoIXJvb3RUcmltbWVkKSB7XG4gICAgICAgICAgICByb290ID0gJyc7XG4gICAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IHAyLmxlbmd0aDsgaysrKSB7XG4gICAgICAgICAgICAgIGlmKGsgPiAwKSB7IHJvb3QgKz0gJy8nOyB9XG4gICAgICAgICAgICAgIHJvb3QgKz0gcDJba107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIHJvb3QgKz0gJy8nICsgcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIH1cbiAgICAgICAgbG9jYXRpb24gPSByc1sxXTtcbiAgICAgIH1cbiAgICB9XG4gICAgaWYgKHJlZi5pbmRleE9mKCdodHRwJykgPT09IDApIHtcbiAgICAgIGlmKHJlZi5pbmRleE9mKCcjJykgPj0gMCkge1xuICAgICAgICByb290ID0gcmVmLnNwbGl0KCcjJylbMF07XG4gICAgICAgIGxvY2F0aW9uID0gcmVmLnNwbGl0KCcjJylbMV07XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgcm9vdCA9IHJlZjtcbiAgICAgICAgbG9jYXRpb24gPSAnJztcbiAgICAgIH1cbiAgICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtvYmo6IHByb3BlcnR5LCByZXNvbHZlQXM6ICdpbmxpbmUnLCByb290OiByb290LCBrZXk6IGtleSwgbG9jYXRpb246IGxvY2F0aW9ufSk7XG4gICAgfSBlbHNlIGlmIChyZWYuaW5kZXhPZignIycpID09PSAwKSB7XG4gICAgICBsb2NhdGlvbiA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gcGFydHNbMF07XG4gICAgICAgIHJlZiA9IHBhcnRzWzFdO1xuICAgICAgfVxuICAgICAgZWxzZSBpZihwYXJ0c1swXSAmJiBwYXJ0c1swXS5sZW5ndGggPiAwKSB7XG4gICAgICAgIC8vIHJlbGF0aXZlIGZpbGVcbiAgICAgICAgc3AgPSByb290LnNwbGl0KCcvJyk7XG4gICAgICAgIGxyb290ID0gJyc7XG4gICAgICAgIGZvcihpID0gMDsgaSA8IHNwLmxlbmd0aCAtIDE7IGkrKykge1xuICAgICAgICAgIGxyb290ICs9IHNwW2ldICsgJy8nO1xuICAgICAgICB9XG4gICAgICAgIGxyb290ICs9IHBhcnRzWzBdO1xuICAgICAgfVxuICAgICAgZWxzZSB7XG5cbiAgICAgIH1cblxuICAgICAgbG9jYXRpb24gPSBwYXJ0c1sxXTtcbiAgICB9XG4gICAgZWxzZSBpZiAocmVmLmluZGV4T2YoJ2h0dHA6Ly8nKSA9PT0gMCB8fCByZWYuaW5kZXhPZignaHR0cHM6Ly8nKSA9PT0gMCkge1xuICAgICAgbHJvb3QgPSByZWY7XG4gICAgICBsb2NhdGlvbiA9ICcnO1xuICAgIH1cbiAgICBlbHNlIHtcbiAgICAgIC8vIHJlbGF0aXZlIGZpbGVcbiAgICAgIHNwID0gcm9vdC5zcGxpdCgnLycpO1xuICAgICAgbHJvb3QgPSAnJztcbiAgICAgIGZvcihpID0gMDsgaSA8IHNwLmxlbmd0aCAtIDE7IGkrKykge1xuICAgICAgICBscm9vdCArPSBzcFtpXSArICcvJztcbiAgICAgIH1cbiAgICAgIGxyb290ICs9IHJlZjtcbiAgICAgIGxvY2F0aW9uID0gJyc7XG4gICAgfVxuICAgIHJlc29sdXRpb25UYWJsZS5wdXNoKHtcbiAgICAgIG9iajogcHJvcGVydHksIHJlc29sdmVBczogJ3JlZicsIHJvb3Q6IGxyb290LCBrZXk6IHJlZiwgbG9jYXRpb246IGxvY2F0aW9uXG4gICAgfSk7XG4gIH0gZWxzZSBpZiAocHJvcG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ciBzb3VyY2UgPSAnc2VsZic7XG4gICAgICAgICAgaWYodHlwZW9mIGNvbXBvbmVudFsneC1yZXNvbHZlZC1mcm9tJ10gIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICBzb3VyY2UgPSBjb21wb25lbnRbJ3gtcmVzb2x2ZWQtZnJvbSddWzBdO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGZvcih2YXIgcGFydCBpbiBjb21wb25lbnQpIHtcbiAgICAgICAgICAgIGlmKCFvdXRwdXQuaGFzT3duUHJvcGVydHkocGFydCkpIHtcbiAgICAgICAgICAgICAgb3V0cHV0W3BhcnRdID0gXy5jbG9uZURlZXAoY29tcG9uZW50W3BhcnRdKTtcbiAgICAgICAgICAgICAgaWYocGFydCA9PT0gJ3Byb3BlcnRpZXMnKSB7XG4gICAgICAgICAgICAgICAgZm9yKG5hbWUgaW4gb3V0cHV0W3BhcnRdKSB7XG4gICAgICAgICAgICAgICAgICBvdXRwdXRbcGFydF1bbmFtZV1bJ3gtcmVzb2x2ZWQtZnJvbSddID0gc291cmNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgIGlmKHBhcnQgPT09ICdwcm9wZXJ0aWVzJykge1xuICAgICAgICAgICAgICAgIHZhciBwcm9wZXJ0aWVzID0gY29tcG9uZW50W3BhcnRdO1xuICAgICAgICAgICAgICAgIGZvcihuYW1lIGluIHByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgICAgICAgIG91dHB1dC5wcm9wZXJ0aWVzW25hbWVdID0gXy5jbG9uZURlZXAocHJvcGVydGllc1tuYW1lXSk7XG4gICAgICAgICAgICAgICAgICB2YXIgcmVzb2x2ZWRGcm9tID0gcHJvcGVydGllc1tuYW1lXVsneC1yZXNvbHZlZC1mcm9tJ107XG4gICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHJlc29sdmVkRnJvbSA9PT0gJ3VuZGVmaW5lZCcgfHwgcmVzb2x2ZWRGcm9tID09PSAnc2VsZicpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZWRGcm9tID0gc291cmNlO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByb3BlcnRpZXNbbmFtZV1bJ3gtcmVzb2x2ZWQtZnJvbSddID0gcmVzb2x2ZWRGcm9tO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBlbHNlIGlmKHBhcnQgPT09ICdyZXF1aXJlZCcpIHtcbiAgICAgICAgICAgICAgICAvLyBtZXJnZSAmIGRlZHVwIHRoZSByZXF1aXJlZCBhcnJheVxuICAgICAgICAgICAgICAgIHZhciBhID0gb3V0cHV0LnJlcXVpcmVkLmNvbmNhdChjb21wb25lbnRbcGFydF0pO1xuICAgICAgICAgICAgICAgIGZvcih2YXIgayA9IDA7IGsgPCBhLmxlbmd0aDsgKytrKSB7XG4gICAgICAgICAgICAgICAgICBmb3IodmFyIGogPSBrICsgMTsgaiA8IGEubGVuZ3RoOyArK2opIHtcbiAgICAgICAgICAgICAgICAgICAgaWYoYVtrXSA9PT0gYVtqXSkgeyBhLnNwbGljZShqLS0sIDEpOyB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG91dHB1dC5yZXF1aXJlZCA9IGE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZWxzZSBpZihwYXJ0ID09PSAneC1yZXNvbHZlZC1mcm9tJykge1xuICAgICAgICAgICAgICAgIG91dHB1dFsneC1yZXNvbHZlZC1mcm9tJ10ucHVzaChzb3VyY2UpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIFRPRE86IG5lZWQgdG8gbWVyZ2UgdGhpcyBwcm9wZXJ0eVxuICAgICAgIC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tMSkge1xuICAgICAgICAgICAgICAgIC8vIFVzZSByZWZlcmVuY2VkIHNjaGVtYVxuICAgICAgICAgICAgICAgIGNQcm9wZXJ0eSA9IEhlbHBlcnMucmVzb2x2ZVNjaGVtYShtb2RlbC5kZWZpbml0aW9uKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBodG1sICs9IHByaW1pdGl2ZVRvSFRNTChjUHJvcGVydHkpO1xuXG4gICAgICAgICAgICBpZighcHJvcGVydHlJc1JlcXVpcmVkKSB7XG4gICAgICAgICAgICAgIGh0bWwgKz0gJywgPHNwYW4gY2xhc3M9XCJwcm9wT3B0S2V5XCI+b3B0aW9uYWw8L3NwYW4+JztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYocHJvcGVydHkucmVhZE9ubHkpIHtcbiAgICAgICAgICAgICAgICBodG1sICs9ICcsIDxzcGFuIGNsYXNzPVwicHJvcFJlYWRPbmx5XCI+cmVhZCBvbmx5PC9zcGFuPic7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGh0bWwgKz0gJyknO1xuXG4gICAgICAgICAgICBpZiAoIV8uaXNVbmRlZmluZWQocHJvcERlc2NyaXB0aW9uKSkge1xuICAgICAgICAgICAgICBodG1sICs9ICc6ICcgKyAnPHNwYW4gY2xhc3M9XCJwcm9wRGVzY1wiPicgKyBwcm9wRGVzY3JpcHRpb24gKyAnPC9zcGFuPic7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChjUHJvcGVydHkuZW51bSkge1xuICAgICAgICAgICAgICBodG1sICs9ICcgPSA8c3BhbiBjbGFzcz1cInByb3BWYWxzXCI+W1xcJycgKyBjUHJvcGVydHkuZW51bS5qb2luKCdcXCcsIFxcJycpICsgJ1xcJ108L3NwYW4+JztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHByaW1pdGl2ZVRvT3B0aW9uc0hUTUwoY1Byb3BlcnR5LC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WU7XG4gICAgICAgIGlzVmFsaWQgPSB0cnVlO1xuICAgICAgfVxuICAgICAgZWxzZSBpZihkZWZpbml0aW9uLnR5cGUgPT09ICdiYXNpY0F1dGgnKSB7XG4gICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi50eXBlID0gJ2Jhc2ljQXV0aCc7XG4gICAgICAgIGlzVmFsaWQgPSB0cnVlO1xuICAgICAgfVxuICAgICAgZWxzZSBpZihkZWZpbml0aW9uLnR5cGUgPT09ICdvYXV0aDInKSB7XG4gICAgICAgIHZhciBleGlzdGluZ1Njb3BlcyA9IGRlZmluaXRpb24uc2NvcGVzIHx8IFtdO1xuICAgICAgICB2YXIgc2NvcGVzID0ge307XG4gICAgICAgIHZhciBpO1xuICAgICAgICBmb3IoaSBpbiBleGlzdGluZ1Njb3Blcykge1xuICAgICAgICAgIHZhciBzY29wZSA9IGV4aXN0aW5nU2NvcGVzW2ldO1xuICAgICAgICAgIHNjb3Blc1tzY29wZS5zY29wZV0gPSBzY29wZS5kZXNjcmlwdGlvbjtcbiAgICAgICAgfVxuICAgICAgICBzZWN1cml0eURlZmluaXRpb24udHlwZSA9ICdvYXV0aDInO1xuICAgICAgICBpZihpID4gMCkge1xuICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5zY29wZXMgPSBzY29wZXM7XG4gICAgICAgIH1cbiAgICAgICAgaWYoZGVmaW5pdGlvbi5ncmFudFR5cGVzKSB7XG4gICAgICAgICAgaWYoZGVmaW5pdGlvbi5ncmFudFR5cGVzLmltcGxpY2l0KSB7XG4gICAgICAgICAgICB2YXIgaW1wbGljaXQgPSBkZWZpbml0aW9uLmdyYW50VHlwZXMuaW1wbGljaXQ7XG4gICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uZmxvdyA9ICdpbXBsaWNpdCc7XG4gICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uYXV0aG9yaXphdGlvblVybCA9IGltcGxpY2l0LmxvZ2luRW5kcG9pbnQ7XG4gICAgICAgICAgICBpc1ZhbGlkID0gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLyoganNoaW50IGlnbm9yZTpzdGFydCAqL1xuICAgICAgICAgIGlmKGRlZmluaXRpb24uZ3JhbnRUeXBlc1snYXV0aG9yaXphdGlvbl9jb2RlJ10pIHtcbiAgICAgICAgICAgIGlmKCFzZWN1cml0eURlZmluaXRpb24uZmxvdykge1xuICAgICAgICAgICAgICAvLyBjYW5ub3Qgc2V0IGlmIGZsb3cgaXMgYWxyZWFkeSBkZWZpbmVkXG4gICAgICAgICAgICAgIHZhciBhdXRoQ29kZSA9IGRlZmluaXRpb24uZ3JhbnRUeXBlc1snYXV0aG9yaXphdGlvbl9jb2RlJ107XG4gICAgICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5mbG93ID0gJ2FjY2Vzc0NvZGUnO1xuICAgICAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uYXV0aG9yaXphdGlvblVybCA9IGF1dGhDb2RlLnRva2VuUmVxdWVzdEVuZHBvaW50LnVybDtcbiAgICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnRva2VuVXJsID0gYXV0aENvZGUudG9rZW5FbmRwb2ludC51cmw7XG4gICAgICAgICAgICAgIGlzVmFsaWQgPSB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICAvKiBqc2hpbnQgaWdub3JlOmVuZCAqL1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZihpc1ZhbGlkKSB7XG4gICAgICAgIHN3YWdnZXIuc2VjdXJpdHlEZWZpbml0aW9ucyA9IHN3YWdnZXIuc2VjdXJpdHlEZWZpbml0aW9ucyB8fCB7fTtcbiAgICAgICAgc3dhZ2dlci5zZWN1cml0eURlZmluaXRpb25zW25hbWVdID0gc2VjdXJpdHlEZWZpbml0aW9uO1xuICAgICAgfVxuICAgIH1cbiAgfVxufTtcblxuU3dhZ2dlclNwZWNDb252ZXJ0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ICAgICAgdmFsdWUgPSBmb3JtUGFyYW1zW2tleV07XG5cbiAgICAgIGlmICh0eXBlb2YgdmFsdWUgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgIGlmIChlbmNvZGVkICE9PSAnJykge1xuICAgICAgICAgIGVuY29kZWQgKz0gJyYnO1xuICAgICAgICB9XG5cbiAgICAgICAgZW5jb2RlZCArPSBlbmNvZGVVUklDb21wb25lbnQoa2V5KSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgYm9keSA9IGVuY29kZWQ7XG4gIH0gZWxzZSBpZiAoaXNNdWx0aVBhcnQpIHtcbiAgICBpZiAob3B0cy51c2VKUXVlcnkpIHtcbiAgICAgIHZhciBib2R5UGFyYW0gPSBuZXcgRm9ybURhdGEoKTtcblxuICAgICAgYm9keVBhcmFtLnR5cGUgPSAnZm9ybURhdGEnO1xuXG4gICAgICBmb3IgKGtleSBpbiBmb3JtUGFyYW1zKSB7XG4gICAgICAgIHZhbHVlID0gYXJnc1trZXldO1xuXG4gICAgICAgIGlmICh0eXBlb2YgdmFsdWUgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgLy8gcmVxdWlyZWQgZm9yIGpxdWVyeSBmaWxlIHVwbG9hZFxuICAgICAgICAgIGlmICh2YWx1ZS50eXBlID09PSAnZmlsZScgJiYgdmFsdWUudmFsdWUpIHtcbiAgICAgICAgICAgIGRlbGV0ZSBoZWFkZXJzWydDb250ZW50LVR5cGUnXTtcblxuICAgICAgICAgICAgYm9keVBhcmFtLmFwcGVuZChrZXksIHZhbHVlLnZhbHVlKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYm9keVBhcmFtLmFwcGVuZChrZXksIHZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgYm9keSA9IGJvZHlQYXJhbTtcbiAgICB9XG4gIH1cblxuICByZXR1c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gICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAweDFGKSA8PCAweDYgfCAoc2Vjb25kQnl0ZSAmIDB4M0YpXG4gICAgICAgICAgICBpZiAodGVtcENvZGVQb2ludCA+IDB4N0YpIHtcbiAgICAgICAgICAgICAgY29kZVBvaW50ID0gdGVtcENvZGVQb2ludFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBicmVha1xuICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV1cbiAgICAgICAgICB0aGlyZEJ5dGUgPSBidWZbaSArIDJdXG4gICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMHhDMCkgPT09IDB4ODAgJiYgKHRoaXJkQnl0ZSAmIDB4QzApID09PSAweDgwKSB7XG4gICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDB4RikgPDwgMHhDIHwgKHNlY29uZEJ5dGUgJiAweDNGKSA8PCAweDYgfCAodGhpcmRCeXRlICYgMHgzRilcbiAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gMHg3RkYgJiYgKHRlbXBDb2RlUG9pbnQgPCAweEQ4MDAgfHwgdGVtcENvZGVQb2ludCA+IDB4REZGRikpIHtcbiAgICAgICAgICAgICAgY29kZVBvaW50ID0gdGVtcENvZGVQb2ludFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICBicmVha1xuICAgICAgICBjYXNlIDQ6XG4gICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV1cbiAgICAgICAgICB0aGlyZEJ5dGUgPSBidWZbaSArIDJdXG4gICAgICAgICAgZm91cnRoQnl0ZSA9IGJ1ZltpICsgM11cbiAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAweEMwKSA9PT0gMHg4MCAmJiAodGhpcmRCeXRlICYgMHhDMCkgPT09IDB4ODAgJ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b2tpZSkge1xuICAgICAgICAgICAgdGhpcy5uYW1lID0gbnVsbDtcbiAgICAgICAgICAgIHRoaXMudmFsdWUgPSBudWxsO1xuICAgICAgICAgICAgdGhpcy5leHBpcmF0aW9uX2RhdGUgPSBJbmZpbml0eTtcbiAgICAgICAgICAgIHRoaXMucGF0aCA9IFN0cmluZyhyZXF1ZXN0X3BhdGggfHwgXCIvXCIpO1xuICAgICAgICAgICAgdGhpcy5leHBsaWNpdF9wYXRoID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmRvbWFpbiA9IHJlcXVlc3RfZG9tYWluIHx8IG51bGw7XG4gICAgICAgICAgICB0aGlzLmV4cGxpY2l0X2RvbWFpbiA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5zZWN1cmUgPSBmYWxzZTsgLy9ob3cgdG8gZGVmaW5lIGRlZmF1bHQ/XG4gICAgICAgICAgICB0aGlzLm5vc2NyaXB0ID0gZmFsc2U7IC8vaHR0cG9ubHlcbiAgICAgICAgICAgIGlmIChjb29raWVzdHIpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnBhcnNlKGNvb2tpZXN0ciwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbmV3IENvb2tpZShjb29raWVzdHIsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgIH1cbiAgICBleHBvcnRzLkNvb2tpZSA9IENvb2tpZTtcblxuICAgIENvb2tpZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZygpIHtcbiAgICAgICAgdmFyIHN0ciA9IFt0aGlzLm5hbWUgKyBcIj1cIiArIHRoaXMudmFsdWVdO1xuICAgICAgICBpZiAodGhpcy5leHBpcmF0aW9uX2RhdGUgIT09IEluZmluaXR5KSB7XG4gICAgICAgICAgICBzdHIucHVzaChcImV4cGlyZXM9XCIgKyAobmV3IERhdGUodGhpcy5leHBpcmF0aW9uX2RhdGUpKS50b0dNVFN0cmluZygpKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5kb21haW4pIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwiZG9tYWluPVwiICsgdGhpcy5kb21haW4pO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLnBhdGgpIHtcbiAgICAgICAgICAgIHN0ci5wdXNoKFwicGF0aD1cIiArIHRoaXMucGF0aCk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMuc2VjdXJlKSB7XG4gICAgICAgICAgICBzdHIucHVzaChcInNlY3VyZVwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5ub3NjcmlwdCkge1xuICAgICAgICAgICAgc3RyLnB1c2goXCJodHRwb25seVwiKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gc3RyLmpvaW4oXCI7IFwiKTtcbiAgICB9O1xuXG4gICAgQ29va2llLnByb3RvdHlwZS50b1ZhbHVlU3RyaW5nID0gZnVuY3Rpb24gdG9WYWx1ZVN0cmluZygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMubmFtZSArIFwiPVwiICsgdGhpcy52YWx1ZTtcbiAgICB9O1xuXG4gICAgdmFyIGNvb2tpZV9zdHJfc3BsaXR0ZXIgPSAvWzpdKD89XFxzKlthLXpBLVowLTlfXFwtXStcXHMqWz1dKS9nO1xuICAgIENvb2tpZS5wcm90b3R5cGUucGFyc2UgPSBmdW5jdGlvbiBwYXJzZShzdHIsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpIHtcbiAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBDb29raWUpIHtcbiAgICAgICAgICAgIHZhciBwYXJ0cyA9IHN0ci5zcGxpdChcIjtcIikuZmlsdGVyKGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF2YWx1ZTtcbiAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICBwYWlyID0gcGFydHNbMF0ubWF0Y2goLyhbXj1dKyk9KFtcXHNcXFNdKikvKSxcbiAgICAgICAgICAgICAgICBrZXkgPSBwYWlyWzFdLFxuICAgICAgICAgICAgICAgIHZhbHVlID0gcGFpclsyXSxcbiAgICAgICAgICAgICAgICBpO1xuICAgICAgICAgICAgdGhpcy5uYW1lID0ga2V5O1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHZhbHVlO1xuXG4gICAgICAgICAgICBmb3IgKGkgPSAxOyBpIDwgcGFydHMubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICBwYWlyID0gcGFydHNbaV0ubWF0Y2goLyhbXj1dKykoPzo9KFtcXHNcXFNdKikpPy8pO1xuICAgICAgICAgICAgICAgIGtleSA9IHBhaXJbMV0udHJpbSgpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYWlyWzJdO1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoa2V5KSB7XG4gICAgICAgICAgICAgICAgY2FzZSBcImh0dHBvbmx5XCI6XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubm9zY3JpcHQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICBjYXNlIFwiZXhwaXJlc1wiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLmV4cGlyYXRpb25fZGF0ZSA9IHZhbHVlID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOdW1iZXIoRGF0ZS5wYXJzZSh2YWx1ZSkpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbmZpbml0eTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBcInBhdGhcIjpcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wYXRoID0gdmFsdWUgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnRyaW0oKSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJcIjtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5leHBsaWNpdF9wYXRoID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBcImRvbWFpblwiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLmRvbWFpbiA9IHZhbHVlID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS50cmltKCkgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiXCI7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZXhwbGljaXRfZG9tYWluID0gISF0aGlzLmRvbWFpbjtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgY2FzZSBcInNlY3VyZVwiOlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNlY3VyZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCF0aGlzLmV4cGxpY2l0X3BhdGgpIHtcbiAgICAgICAgICAgICAgIHRoaXMucGF0aCA9IHJlcXVlc3RfcGF0aCB8fCBcIi9cIjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICghdGhpcy5leHBsaWNpdF9kb21haW4pIHtcbiAgICAgICAgICAgICAgIHRoaXMuZG9tYWluID0gcmVxdWVzdF9kb21haW47XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgQ29va2llKCkucGFyc2Uoc3RyLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKTtcbiAgICB9O1xuXG4gICAgQ29va2llL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YmIHRoaXMuZG9tYWluLnJlcGxhY2UoL15bXFwuXS8sJycpO1xuICAgICAgICBpZiAoY29va2llX2RvbWFpbiA9PT0gYWNjZXNzX2RvbWFpbikge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvb2tpZV9kb21haW4pIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5leHBsaWNpdF9kb21haW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7IC8vIHdlIGFscmVhZHkgY2hlY2tlZCBpZiB0aGUgZG9tYWlucyB3ZXJlIGV4YWN0bHkgdGhlIHNhbWVcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB3aWxkY2FyZCA9IGFjY2Vzc19kb21haW4uaW5kZXhPZihjb29raWVfZG9tYWluKTtcbiAgICAgICAgICAgIGlmICh3aWxkY2FyZCA9PT0gLTEgfHwgd2lsZGNhcmQgIT09IGFjY2Vzc19kb21haW4ubGVuZ3RoIC0gY29va2llX2RvbWFpbi5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9O1xuXG4gICAgZnVuY3Rpb24gQ29va2llSmFyKCkge1xuICAgICAgICB2YXIgY29va2llcywgY29va2llc19saXN0LCBjb2xsaWRhYmxlX2Nvb2tpZTtcbiAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBDb29raWVKYXIpIHtcbiAgICAgICAgICAgIGNvb2tpZXMgPSBPYmplY3QuY3JlYXRlKG51bGwpOyAvL25hbWU6IFtDb29raWVdXG5cbiAgICAgICAgICAgIHRoaXMuc2V0Q29va2llID0gZnVuY3Rpb24gc2V0Q29va2llKGNvb2tpZSwgcmVxdWVzdF9kb21haW4sIHJlcXVlc3RfcGF0aCkge1xuICAgICAgICAgICAgICAgIHZhciByZW1vdmUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llID0gbmV3IENvb2tpZShjb29raWUsIHJlcXVlc3RfZG9tYWluLCByZXF1ZXN0X3BhdGgpO1xuICAgICAgICAgICAgICAgIC8vRGVsZXRlIHRoZSBjb29raWUgaWYgdGhlIHNldCBpcyBwYXN0IHRoZSBjdXJyZW50IHRpbWVcbiAgICAgICAgICAgICAgICByZW1vdmUgPSBjb29raWUuZXhwaXJhdGlvbl9kYXRlIDw9IERhdGUubm93KCk7XG4gICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNbY29va2llLm5hbWVdICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBjb29raWVzX2xpc3QubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbGxpZGFibGVfY29va2llID0gY29va2llc19saXN0W2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvbGxpZGFibGVfY29va2llLmNvbGxpZGVzV2l0aChjb29raWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVzX2xpc3Quc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29va2llc19saXN0Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGNvb2tpZXNbY29va2llLm5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llc19saXN0W2ldID0gY29va2llO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlbW92ZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZXNfbGlzdC5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChyZW1vdmUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjb29raWVzW2Nvb2tpZS5uYW1lXSA9IFtjb29raWVdO1xuICAgICAgICAgICAgICAgIHJldHVybiBjb29raWVzW2Nvb2tpZS5uYW1lXTtcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICAvL3JldHVybnMgYSBjb29raWVcbiAgICAgICAgICAgIHRoaXMuZ2V0Q29va2llID0gZnVuY3Rpb24gZ2V0Q29va2llKGNvb2tpZV9uYW1lLCBhY2Nlc3NfaW5mbykge1xuICAgICAgICAgICAgICAgIHZhciBjb29raWUsIGk7XG4gICAgICAgICAgICAgICAgY29va2llc19saXN0ID0gY29va2llc1tjb29raWVfbmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKCFjb29raWVzX2xpc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgY29va2llc19saXN0Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZSA9IGNvb2tpZXNfbGlzdFtpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZS5leHBpcmF0aW9uX2RhdGUgPD0gRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZXNfbGlzdC5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29va2llc1tjb29raWUubmFtZV07XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUubWF0Y2hlcyhhY2Nlc3NfaW5mbykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb29raWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgLy9yZXR1cm5zIGEgbGlzdCBvZiBjb29raWVzXG4gICAgICAgICAgICB0aGlzLmdldENvb2tpZXMgPSBmdW5jdGlvbiBnZXRDb29raWVzKGFjY2Vzc19pbmZvKSB7XG4gICAgICAgICAgICAgICAgdmFyIG1hdGNoZXMgPSBbXSwgY29va2llX25hbWUsIGNvb2tpZTtcbiAgICAgICAgICAgICAgICBmb3IgKGNvb2tpZV9uYW1lIGluIGNvb2tpZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgY29va2llID0gdGhpcy5nZXRDb29raWUoY29va2llX25hbWUsIGFjY2Vzc19pbmZvKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvb2tpZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWF0Y2hlcy5wdXNoKGNvb2tpZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbWF0Y2hlcy50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hlcy5qb2luKFwiOlwiKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIG1hdGNoZXMudG9WYWx1ZVN0cmluZyA9IGZ1bmN0aW9uIHRvVmFsdWVTdHJpbmcoKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBtYXRjaGVzLm1hcChmdW5jdGlvbiAoYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMudG9WYWx1ZVN0cmluZygpO1xuICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCc7Jyk7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hlcztcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBuZXcgQ29va2llSmFyKCk7XG4gICAgfVxuICAgIGV4cG9ydHMuQ29va2llSmFyID0gQ29va2llSmFyO1xuXG4gICAgLy9yZXR1cm5zIGxpc3Qgb2YgY29va2llcyB0aGF0IHdlcmUgc2V0IGNvcnJlY3RseS4gQ29va2llcyB0aGF0IGFyZSBleHBpcmVkIGFuZCByZW1vdmVkIGFyZSBub3QgcmV0dXJuZWQuXG4gICAgQ29va2llSmFyLnByb3RvdHlwZS5zZXRDb29raWVzID0gZnVuY3Rpb24gc2V0Q29va2llcyhjb29raWVzLCByZXF1ZXN0X2RvbWFpbiwgcmVxdWVzdF9wYXRoKSB7XG4gICAgICAgIGNvb2tpZXMgPSBBcnJheS5pc0FycmF5KGNvb2tpZXMpID9cbiAgICAgICAgICAgICAgICBjb29raWVzIDpcbiAgICAgICAgICAgICAgICBjb29raWVzLnNwbGl0KGNvb2tpZV9zdHJfc3BsaXR0ZXIpO1xuICAgICAgICB2YXIgc3VjY2Vzc2Z1bCA9IFtdLFxuICAgICAgICAgICAgaSxcbiAgICAgICAgICAgIGNv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AgICAgICAgPSAvXig/OiF8ISF8IVthLXpcXC1dKyEpJC9pO1xudmFyIFBBVFRFUk5fVEFHX1VSSSAgICAgICAgICAgICAgID0gL14oPzohfFteLFxcW1xcXVxce1xcfV0pKD86JVswLTlhLWZdezJ9fFswLTlhLXpcXC0jO1xcL1xcPzpAJj1cXCtcXCQsX1xcLiF+XFwqJ1xcKFxcKVxcW1xcXV0pKiQvaTtcblxuXG5mdW5jdGlvbiBpc19FT0woYykge1xuICByZXR1cm4gKGMgPT09IDB4MEEvKiBMRiAqLykgfHwgKGMgPT09IDB4MEQvKiBDUiAqLyk7XG59XG5cbmZ1bmN0aW9uIGlzX1dISVRFX1NQQUNFKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fCAoYyA9PT0gMHgyMC8qIFNwYWNlICovKTtcbn1cblxuZnVuY3Rpb24gaXNfV1NfT1JfRU9MKGMpIHtcbiAgcmV0dXJuIChjID09PSAweDA5LyogVGFiICovKSB8fFxuICAgICAgICAgKGMgPT09IDB4MjAvKiBTcGFjZSAqLykgfHxcbiAgICAgICAgIChjID09PSAweDBBLyogTEYgKi8pIHx8XG4gICAgICAgICAoYyA9PT0gMHgwRC8qIENSICovKTtcbn1cblxuZnVuY3Rpb24gaXNfRkxPV19JTkRJQ0FUT1IoYykge1xuICByZXR1cm4gMHgyQy8qICwgKi8gPT09IGMgfHxcbiAgICAgICAgIDB4NUIvKiBbICovID09PSBjIHx8XG4gICAgICAgICAweDVELyogXSAqLyA9PT0gYyB8fFxuICAgICAgICAgMHg3Qi8qIHsgKi8gPT09IGMgfHxcbiAgICAgICAgIDB4N0QvKiB9ICovID09PSBjO1xufVxuXG5mdW5jdGlvbiBmcm9tSGV4Q29kZShjKSB7XG4gIHZhciBsYztcblxuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIC8qZXNsaW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KSAgICAgICAgICAgICB8fFxuICAgICAgaXNfRkxPV19JTkRJQ0FUT1IoY2gpICAgICAgICB8fFxuICAgICAgMHgyMy8qICMgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyNi8qICYgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyQS8qICogKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyMS8qICEgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHg3Qy8qIHwgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgzRS8qID4gKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyNy8qICcgKi8gICAgICAgICAgID09PSBjaCB8fFxuICAgICAgMHgyMi8qIFwiICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4MjUvKiAlICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NDAvKiBAICovICAgICAgICAgICA9PT0gY2ggfHxcbiAgICAgIDB4NjAvKiBgICovICAgICAgICAgICA9PT0gY2gpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBpZiAoMHgzRi8qID8gKi8gPT09IGNoIHx8IDB4MkQvKiAtICovID09PSBjaCkge1xuICAgIGZvbGxvd2luZyA9IHN0YXRlLmlucHV0LmNoYXJDb2RlQXQoc3RhdGUucG9zaXRpb24gKyAxKTtcblxuICAgIGlmIChpc19XU19PUl9FT0woZm9sbG93aW5nKSB8fFxuICAgICAgICB3aXRoaW5GbG93Q29sbGVjdGlvbiAmJiBpc19GTE9XX0lORElDQVRPUihmb2xsb3dpbmcpKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgc3RhdGUua2luZCA9ICdzY2FsYXInO1xuICBzdGF0ZS5yZXN1bHQgPSAnJztcbiAgY2FwdHVyZVN0YXJ0ID0gY2FwdHVyZUVuZCA9IHN0YXRlLnBvc2l0aW9uO1xuICBoYXNQZW5ka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A9PT0gJysnKSB7XG4gICAgY2ggPSBkYXRhWysraW5kZXhdO1xuICB9XG5cbiAgaWYgKGNoID09PSAnMCcpIHtcbiAgICAvLyAwXG4gICAgaWYgKGluZGV4ICsgMSA9PT0gbWF4KSB7IHJldHVybiB0cnVlOyB9XG4gICAgY2ggPSBkYXRhWysraW5kZXhdO1xuXG4gICAgLy8gYmFzZSAyLCBiYXNlIDgsIGJhc2UgMTZcblxuICAgIGlmIChjaCA9PT0gJ2InKSB7XG4gICAgICAvLyBiYXNlIDJcbiAgICAgIGluZGV4Kys7XG5cbiAgICAgIGZvciAoOyBpbmRleCA8IG1heDsgaW5kZXgrKykge1xuICAgICAgICBjaCA9IGRhdGFbaW5kZXhdO1xuICAgICAgICBpZiAoY2ggPT09ICdfJykgeyBjb250aW51ZTsgfVxuICAgICAgICBpZiAoY2ggIT09ICcwJyAmJiBjaCAhPT0gJzEnKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIGhhc0RpZ2l0cyA9IHRydWU7XG4gICAgICB9XG4gICAgICByZXR1cm4gaGFzRGlnaXRzO1xuICAgIH1cblxuXG4gICAgaWYgKGNoID09PSAneCcpIHtcbiAgICAgIC8vIGJhc2UgMTZcbiAgICAgIGluZGV4Kys7XG5cbiAgICAgIGZvciAoOyBpbmRleCA8IG1heDsgaW5kZXgrKykge1xuICAgICAgICBjaCA9IGRhdGFbaW5kZXhdO1xuICAgICAgICBpZiAoY2ggPT09ICdfJykgeyBjb250aW51ZTsgfVxuICAgICAgICBpZiAoIWlzSGV4Q29kZShkYXRhLmNoYXJDb2RlQXQoaW5kZXgpKSkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBoYXNEaWdpdHMgPSB0cnVlO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGhhc0RpZ2l0cztcbiAgICB9XG5cbiAgICAvLyBiYXNlIDhcbiAgICBmb3IgKDsgaW5kZXggPC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XgsXG4gICAgICAgIHNvdXJjZSxcbiAgICAgICAgc3RyaWN0LFxuICAgICAgICBpbmRleCxcbiAgICAgICAgbGluZU51bWJlcixcbiAgICAgICAgbGluZVN0YXJ0LFxuICAgICAgICBoYXNMaW5lVGVybWluYXRvcixcbiAgICAgICAgbGFzdEluZGV4LFxuICAgICAgICBsYXN0TGluZU51bWJlcixcbiAgICAgICAgbGFzdExpbmVTdGFydCxcbiAgICAgICAgc3RhcnRJbmRleCxcbiAgICAgICAgc3RhcnRMaW5lTnVtYmVyLFxuICAgICAgICBzdGFydExpbmVTdGFydCxcbiAgICAgICAgc2Nhbm5pbmcsXG4gICAgICAgIGxlbmd0aCxcbiAgICAgICAgbG9va2FoZWFkLFxuICAgICAgICBzdGF0ZSxcbiAgICAgICAgZXh0cmEsXG4gICAgICAgIGlzQmluZGluZ0VsZW1lbnQsXG4gICAgICAgIGlzQXNzaWdubWVudFRhcmdldCxcbiAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yO1xuXG4gICAgVG9rZW4gPSB7XG4gICAgICAgIEJvb2xlYW5MaXRlcmFsOiAxLFxuICAgICAgICBFT0Y6IDIsXG4gICAgICAgIElkZW50aWZpZXI6IDMsXG4gICAgICAgIEtleXdvcmQ6IDQsXG4gICAgICAgIE51bGxMaXRlcmFsOiA1LFxuICAgICAgICBOdW1lcmljTGl0ZXJhbDogNixcbiAgICAgICAgUHVuY3R1YXRvcjogNyxcbiAgICAgICAgU3RyaW5nTGl0ZXJhbDogOCxcbiAgICAgICAgUmVndWxhckV4cHJlc3Npb246IDksXG4gICAgICAgIFRlbXBsYXRlOiAxMFxuICAgIH07XG5cbiAgICBUb2tlbk5hbWUgPSB7fTtcbiAgICBUb2tlbk5hbWVbVG9rZW4uQm9vbGVhbkxpdGVyYWxdID0gJ0Jvb2xlYW4nO1xuICAgIFRva2VuTmFtZVtUb2tlbi5FT0ZdID0gJzxlbmQ+JztcbiAgICBUb2tlbk5hbWVbVG9r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H1cbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxMS40IENvbW1lbnRzXG5cbiAgICBmdW5jdGlvbiBhZGRDb21tZW50KHR5cGUsIHZhbHVlLCBzdGFydCwgZW5kLCBsb2MpIHtcbiAgICAgICAgdmFyIGNvbW1lbnQ7XG5cbiAgICAgICAgYXNzZXJ0KHR5cGVvZiBzdGFydCA9PT0gJ251bWJlcicsICdDb21tZW50IG11c3QgaGF2ZSB2YWxpZCBwb3NpdGlvbicpO1xuXG4gICAgICAgIHN0YXRlLmxhc3RDb21tZW50U3RhcnQgPSBzdGFydDtcblxuICAgICAgICBjb21tZW50ID0ge1xuICAgICAgICAgICAgdHlwZTogdHlwZSxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZVxuICAgICAgICB9O1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIGNvbW1lbnQucmFuZ2UgPSBbc3RhcnQsIGVuZF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgY29tbWVudC5sb2MgPSBsb2M7XG4gICAgICAgIH1cbiAgICAgICAgZXh0cmEuY29tbWVudHMucHVzaChjb21tZW50KTtcbiAgICAgICAgaWYgKGV4dHJhLmF0dGFjaENvbW1lbnQpIHtcbiAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICAgICAgZXh0cmEudHJhaWxpbmdDb21tZW50cy5wdXNoKGNvbW1lbnQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgY29tbWVudC50eXBlID0gY29tbWVudC50eXBlICsgJ0NvbW1lbnQnO1xuICAgICAgICAgICAgaWYgKGV4dHJhLmRlbGVnYXRlKSB7XG4gICAgICAgICAgICAgICAgY29tbWVudCA9IGV4dHJhLmRlbGVnYXRlKGNvbW1lbnQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXh0cmEudG9rZW5zLnB1c2goY29tbWVudCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBza2lwU2luZ2xlTGluZUNvbW1lbnQob2Zmc2V0KSB7XG4gICAgICAgIHZhciBzdGFydCwgbG9jLCBjaCwgY29tbWVudDtcblxuICAgICAgICBzdGFydCA9IGluZGV4IC0gb2Zmc2V0O1xuICAgICAgICBsb2MgPSB7XG4gICAgICAgICAgICBzdGFydDoge1xuICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgY29sdW1uOiBpbmRleCAtIGxpbmVTdGFydCAtIG9mZnNldFxuICAgICAgICAgICAgfVxuICAgICAgICB9O1xuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2gpKSB7XG4gICAgICAgICAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGlmIChleHRyYS5jb21tZW50cykge1xuICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gc291cmNlLnNsaWNlKHN0YXJ0ICsgb2Zmc2V0LCBpbmRleCAtIDEpO1xuICAgICAgICAgICAgICAgICAgICBsb2MuZW5kID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnQgLSAxXG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIGFkZENvbW1lbnQoJ0xpbmUnLCBjb21tZW50LCBzdGFydCwgaW5kZXggLSAxLCBsb2MpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09IDEzICYmIHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSA9PT0gMTApIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgIGxpbmVTdGFydCA9IGluZGV4O1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChleHRyYS5jb21tZW50cykge1xuICAgICAgICAgICAgY29tbWVudCA9IHNvdXJjZS5zbGljZShzdGFydCArIG9mZnNldCwgaW5kZXgpO1xuICAgICAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBhZGRDb21tZW50KCdMaW5lJywgY29tbWVudCwgc3RhcnQsIGluZGV4LCBsb2MpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2tpcE11bHRpTGluZUNvbW1lbnQoKSB7XG4gICAgICAgIHZhciBzdGFydCwgbG9jLCBjaCwgY29tbWVudDtcblxuICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgIHN0YXJ0ID0gaW5kZXggLSAyO1xuICAgICAgICAgICAgbG9jID0ge1xuICAgICAgICAgICAgICAgIHN0YXJ0OiB7XG4gICAgICAgICAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnQgLSAyXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoaXNMaW5lVGVybWluYXRvcihjaCkpIHtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09IDB4MEQgJiYgc291cmNlLmNoYXJDb2RlQXQoaW5kZXggKyAxKSA9PT0gMHgwQSkge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBoYXNMaW5lVGVybWluYXRvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAweDJBKSB7XG4gICAgICAgICAgICAgICAgLy8gQmxvY2sgY29tbWVudCBlbmRzIHdpdGggJyovJy5cbiAgICAgICAgICAgICAgICBpZiAoc291cmNlLmNoYXJDb2RlQXQoaW5kZXggKyAxKSA9PT0gMHgyRikge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmEuY29tbWVudHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1lbnQgPSBzb3VyY2Uuc2xpY2Uoc3RhcnQgKyAyLCBpbmRleCAtIDIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRDb21tZW50KCdCbG9jaycsIGNvbW1lbnQsIHN0YXJ0LCBpbmRleCwgbG9jKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBSYW4gb2ZmIHRoZSBlbmQgb2YgdGhlIGZpbGUgLSB0aGUgd2hvbGUgdGhpbmcgaXMgYSBjb21tZW50XG4gICAgICAgIGlmIChleHRyYS5jb21tZW50cykge1xuICAgICAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBjb21tZW50ID0gc291cmNlLnNsaWNlKHN0YXJ0ICsgMiwgaW5kZXgpO1xuICAgICAgICAgICAgYWRkQ29tbWVudCgnQmxvY2snLCBjb21tZW50LCBzdGFydCwgaW5kZXgsIGxvYyk7XG4gICAgICAgIH1cbiAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBza2lwQ29tbWVudCgpIHtcbiAgICAgICAgdmFyIGNoLCBzdGFydDtcbiAgICAgICAgaGFzTGluZVRlcm1pbmF0b3IgPSBmYWxzZTtcblxuICAgICAgICBzdGFydCA9IChpbmRleCA9PT0gMCk7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG5cbiAgICAgICAgICAgIGlmIChpc1doaXRlU3BhY2UoY2gpKSB7XG4gICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNMaW5lVGVybWluYXRvcihjaCkpIHtcbiAgICAgICAgICAgICAgICBoYXNMaW5lVGVybWluYXRvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09IDB4MEQgJiYgc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpID09PSAweDBBKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICBsaW5lU3RhcnQgPSBpbmRleDtcbiAgICAgICAgICAgICAgICBzdGFydCA9IHRydWU7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAweDJGKSB7IC8vIFUrMDAyRiBpcyAnLydcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSk7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAweDJGKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHNraXBTaW5nbGVMaW5lQ29tbWVudCgyKTtcbiAgICAgICAgICAgICAgICAgICAgc3RhcnQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09IDB4MkEpIHsgIC8vIFUrMDAyQSBpcyAnKidcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgc2tpcE11bHRpTGluZUNvbW1lbnQoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXJ0ICYmIGNoID09PSAweDJEKSB7IC8vIFUrMDAyRCBpcyAnLSdcbiAgICAgICAgICAgICAgICAvLyBVKzAwM0UgaXMgJz4nXG4gICAgICAgICAgICAgICAgaWYgKChzb3VyY2UuY2hhckNvZGVBdChpbmRleCArIDEpID09PSAweDJEKSAmJiAoc291cmNlLmNoYXJDb2RlQXQoaW5kZXggKyAyKSA9PT0gMHgzRSkpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gJy0tPicgaXMgYSBzaW5nbGUtbGluZSBjb21tZW50XG4gICAgICAgICAgICAgICAgICAgIGluZGV4ICs9IDM7XG4gICAgICAgICAgICAgICAgICAgIHNraXBTaW5nbGVMaW5lQ29tbWVudCgzKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAweDNDKSB7IC8vIFUrMDAzQyBpcyAnPCdcbiAgICAgICAgICAgICAgICBpZiAoc291cmNlLnNsaWNlKGluZGV4ICsgMSwgaW5kZXggKyA0KSA9PT0gJyEtLScpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDsgLy8gYDxgXG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7IC8vIGAhYFxuICAgICAgICAgICAgICAgICAgICArK2luZGV4OyAvLyBgLWBcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDsgLy8gYC1gXG4gICAgICAgICAgICAgICAgICAgIHNraXBTaW5nbGVMaW5lQ29tbWVudCg0KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2NhbkhleEVzY2FwZShwcmVmaXgpIHtcbiAgICAgICAgdmFyIGksIGxlbiwgY2gsIGNvZGUgPSAwO1xuXG4gICAgICAgIGxlbiA9IChwcmVmaXggPT09ICd1JykgPyA0IDogMjtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbjsgKytpKSB7XG4gICAgICAgICAgICBpZiAoaW5kZXggPCBsZW5ndGggJiYgaXNIZXhEaWdpdChzb3VyY2VbaW5kZXhdKSkge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgICAgIGNvZGUgPSBjb2RlICogMTYgKyAnMDEyMzQ1Njc4OWFiY2RlZicuaW5kZXhPZihjaC50b0xvd2VyQ2FzZSgpKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlKGNvZGUpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5Vbmljb2RlQ29kZVBvaW50RXNjYXBlKCkge1xuICAgICAgICB2YXIgY2gsIGNvZGU7XG5cbiAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICBjb2RlID0gMDtcblxuICAgICAgICAvLyBBdCBsZWFzdCwgb25lIGhleCBkaWdpdCBpcyByZXF1aXJlZC5cbiAgICAgICAgaWYgKGNoID09PSAnfScpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgaWYgKCFpc0hleERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29kZSA9IGNvZGUgKiAxNiArICcwMTIzNDU2Nzg5YWJjZGVmJy5pbmRleE9mKGNoLnRvTG93ZXJD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AgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSAhPT0gMHg3NSkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgaWYgKHNvdXJjZVtpbmRleF0gPT09ICd7Jykge1xuICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgY2ggPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgICAgICBjcCA9IGNoLmNoYXJDb2RlQXQoMCk7XG4gICAgICAgICAgICAgICAgaWYgKCFjaCB8fCBjaCA9PT0gJ1xcXFwnIHx8ICFpc0lkZW50aWZpZXJTdGFydChjcCkpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZCA9IGNoO1xuICAgICAgICB9XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjcCA9IGNvZGVQb2ludEF0KGluZGV4KTtcbiAgICAgICAgICAgIGlmICghaXNJZGVudGlmaWVyUGFydChjcCkpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNoID0gZnJvbUNvZGVQb2ludChjcCk7XG4gICAgICAgICAgICBpZCArPSBjaDtcbiAgICAgICAgICAgIGluZGV4ICs9IGNoLmxlbmd0aDtcblxuICAgICAgICAgICAgLy8gJ1xcdScgKFUrMDA1QywgVSswMDc1KSBkZW5vdGVzIGFuIGVzY2FwZWQgY2hhcmFjdGVyLlxuICAgICAgICAgICAgaWYgKGNwID09PSAweDVDKSB7XG4gICAgICAgICAgICAgICAgaWQgPSBpZC5zdWJzdHIoMCwgaWQubGVuZ3RoIC0gMSk7XG4gICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSAhPT0gMHg3NSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgY2ggPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGNoID0gc2NhbkhleEVzY2FwZSgndScpO1xuICAgICAgICAgICAgICAgICAgICBjcCA9IGNoLmNoYXJDb2RlQXQoMCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghY2ggfHwgY2ggPT09ICdcXFxcJyB8fCAhaXNJZGVudGlmaWVyUGFydChjcCkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gaWQ7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZ2V0SWRlbnRpZmllcigpIHtcbiAgICAgICAgdmFyIHN0YXJ0LCBjaDtcblxuICAgICAgICBzdGFydCA9IGluZGV4Kys7XG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICBpZiAoY2ggPT09IDB4NUMpIHtcbiAgICAgICAgICAgICAgICAvLyBCbGFja3NsYXNoIChVKzAwNUMpIG1hcmtzIFVuaWNvZGUgZXNjYXBlIHNlcXVlbmNlLlxuICAgICAgICAgICAgICAgIGluZGV4ID0gc3RhcnQ7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldENvbXBsZXhJZGVudGlmaWVyKCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID49IDB4RDgwMCAmJiBjaCA8IDB4REZGRikge1xuICAgICAgICAgICAgICAgIC8vIE5lZWQgdG8gaGFuZGxlIHN1cnJvZ2F0ZSBwYWlycy5cbiAgICAgICAgICAgICAgICBpbmRleCA9IHN0YXJ0O1xuICAgICAgICAgICAgICAgIHJldHVybiBnZXRDb21wbGV4SWRlbnRpZmllcigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGlzSWRlbnRpZmllclBhcnQoY2gpKSB7XG4gICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gc291cmNlLnNsaWNlKHN0YXJ0LCBpbmRleCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2NhbklkZW50aWZpZXIoKSB7XG4gICAgICAgIHZhciBzdGFydCwgaWQsIHR5cGU7XG5cbiAgICAgICAgc3RhcnQgPSBpbmRleDtcblxuICAgICAgICAvLyBCYWNrc2xhc2ggKFUrMDA1Qykgc3RhcnRzIGFuIGVzY2FwZWQgY2hhcmFjdGVyLlxuICAgICAgICBpZCA9IChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkgPT09IDB4NUMpID8gZ2V0Q29tcGxleElkZW50aWZpZXIoKSA6IGdldElkZW50aWZpZXIoKTtcblxuICAgICAgICAvLyBUaGVyZSBpcyBubyBrZXl3b3JkIG9yIGxpdGVyYWwgd2l0aCBvbmx5IG9uZSBjaGFyYWN0ZXIuXG4gICAgICAgIC8vIFRodXMsIGl0IG11c3QgYmUgYW4gaWRlbnRpZmllci5cbiAgICAgICAgaWYgKGlkLmxlbmd0aCA9PT0gMSkge1xuICAgICAgICAgICAgdHlwZSA9IFRva2VuLklkZW50aWZpZXI7XG4gICAgICAgIH0gZWxzZSBpZiAoaXNLZXl3b3JkKGlkKSkge1xuICAgICAgICAgICAgdHlwZSA9IFRva2VuLktleXdvcmQ7XG4gICAgICAgIH0gZWxzZSBpZiAoaWQgPT09ICdudWxsJykge1xuICAgICAgICAgICAgdHlwZSA9IFRva2VuLk51bGxMaXRlcmFsO1xuICAgICAgICB9IGVsc2UgaWYgKGlkID09PSAndHJ1ZScgfHwgaWQgPT09ICdmYWxzZScpIHtcbiAgICAgICAgICAgIHR5cGUgPSBUb2tlbi5Cb29sZWFuTGl0ZXJhbDtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHR5cGUgPSBUb2tlbi5JZGVudGlmaWVyO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IHR5cGUsXG4gICAgICAgICAgICB2YWx1ZTogaWQsXG4gICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgbGluZVN0YXJ0OiBsaW5lU3RhcnQsXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG5cbiAgICAvLyBFQ01BLTI2MiAxMS43IFB1bmN0dWF0b3JzXG5cbiAgICBmdW5jdGlvbiBzY2FuUHVuY3R1YXRvcigpIHtcbiAgICAgICAgdmFyIHRva2VuLCBzdHI7XG5cbiAgICAgICAgdG9rZW4gPSB7XG4gICAgICAgICAgICB0eXBlOiBUb2tlbi5QdW5jdHVhdG9yLFxuICAgICAgICAgICAgdmFsdWU6ICcnLFxuICAgICAgICAgICAgbGluZU51bWJlcjogbGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgc3RhcnQ6IGluZGV4LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuXG4gICAgICAgIC8vIENoZWNrIGZvciBtb3N0IGNvbW1vbiBzaW5nbGUtY2hhcmFjdGVyIHB1bmN0dWF0b3JzLlxuICAgICAgICBzdHIgPSBzb3VyY2VbaW5kZXhdO1xuICAgICAgICBzd2l0Y2ggKHN0cikge1xuXG4gICAgICAgIGNhc2UgJygnOlxuICAgICAgICAgICAgaWYgKGV4dHJhLnRva2VuaXplKSB7XG4gICAgICAgICAgICAgICAgZXh0cmEub3BlblBhcmVuVG9rZW4gPSBleHRyYS50b2tlblZhbHVlcy5sZW5ndGg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAneyc6XG4gICAgICAgICAgICBpZiAoZXh0cmEudG9rZW5pemUpIHtcbiAgICAgICAgICAgICAgICBleHRyYS5vcGVuQ3VybHlUb2tlbiA9IGV4dHJhLnRva2VuVmFsdWVzLmxlbmd0aDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucHVzaCgneycpO1xuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJy4nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAnLicgJiYgc291cmNlW2luZGV4ICsgMV0gPT09ICcuJykge1xuICAgICAgICAgICAgICAgIC8vIFNwcmVhZCBvcGVyYXRvcjogLi4uXG4gICAgICAgICAgICAgICAgaW5kZXggKz0gMjtcbiAgICAgICAgICAgICAgICBzdHIgPSAnLi4uJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ30nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAnKSc6XG4gICAgICAgIGNhc2UgJzsnOlxuICAgICAgICBjYXNlICcsJzpcbiAgICAgICAgY2FzZSAnWyc6XG4gICAgICAgIGNhc2UgJ10nOlxuICAgICAgICBjYXNlICc6JzpcbiAgICAgICAgY2FzZSAnPyc6XG4gICAgICAgIGNhc2UgJ34nOlxuICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAvLyA0LWNoYXJhY3RlciBwdW5jdHVhdG9yLlxuICAgICAgICAgICAgc3RyID0gc291cmNlLnN1YnN0cihpbmRleCwgNCk7XG4gICAgICAgICAgICBpZiAoc3RyID09PSAnPj4+PScpIHtcbiAgICAgICAgICAgICAgICBpbmRleCArPSA0O1xuICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgIC8vIDMtY2hhcmFjdGVyIHB1bmN0dWF0b3JzLlxuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMyk7XG4gICAgICAgICAgICAgICAgaWYgKHN0ciA9PT0gJz09PScgfHwgc3RyID09PSAnIT09JyB8fCBzdHIgPT09ICc+Pj4nIHx8XG4gICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw8PScgfHwgc3RyID09PSAnPj49Jykge1xuICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAzO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gMi1jaGFyYWN0ZXIgcHVuY3R1YXRvcnMuXG4gICAgICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHIoMCwgMik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzdHIgPT09ICcmJicgfHwgc3RyID09PSAnfHwnIHx8IHN0ciA9PT0gJz09JyB8fCBzdHIgPT09ICchPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJys9JyB8fCBzdHIgPT09ICctPScgfHwgc3RyID09PSAnKj0nIHx8IHN0ciA9PT0gJy89JyB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RyID09PSAnKysnIHx8IHN0ciA9PT0gJy0tJyB8fCBzdHIgPT09ICc8PCcgfHwgc3RyID09PSAnPj4nIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgPT09ICcmPScgfHwgc3RyID09PSAnfD0nIHx8IHN0ciA9PT0gJ149JyB8fCBzdHIgPT09ICclPScgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9PT0gJzw9JyB8fCBzdHIgPT09ICc+PScgfHwgc3RyID09PSAnPT4nKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCArPSAyO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAxLWNoYXJhY3RlciBwdW5jdHVhdG9ycy5cbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzw+PSErLSolJnxeLycuaW5kZXhPZihzdHIpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGluZGV4ID09PSB0b2tlbi5zdGFydCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRva2VuLmVuZCA9IGluZGV4O1xuICAgICAgICB0b2tlbi52YWx1ZSA9IHN0cjtcbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIC8vIEVDTUEtMjYyIDExLjguMyBOdW1lcmljIExpdGVyYWxzXG5cbiAgICBmdW5jdGlvbiBzY2FuSGV4TGl0ZXJhbChzdGFydCkge1xuICAgICAgICB2YXIgbnVtYmVyID0gJyc7XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAoIWlzSGV4RGlnaXQoc291cmNlW2luZGV4XSkpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobnVtYmVyLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpc0lkZW50aWZpZXJTdGFydChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IFRva2VuLk51bWVyaWNMaXRlcmFsLFxuICAgICAgICAgICAgdmFsdWU6IHBhcnNlSW50KCcweCcgKyBudW1iZXIsIDE2KSxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBsaW5lU3RhcnQ6IGxpbmVTdGFydCxcbiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgIGVuZDogaW5kZXhcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuQmluYXJ5TGl0ZXJhbChzdGFydCkge1xuICAgICAgICB2YXIgY2gsIG51bWJlcjtcblxuICAgICAgICBudW1iZXIgPSAnJztcblxuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgICAgIGlmIChjaCAhPT0gJzAnICYmIGNoICE9PSAnMScpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobnVtYmVyLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgLy8gb25seSAwYiBvciAwQlxuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgY2ggPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG4gICAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KGNoKSB8fCBpc0RlY2ltYWxEaWdpdChjaCkpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IFRva2VuLk51bWVyaWNMaXRlcmFsLFxuICAgICAgICAgICAgdmFsdWU6IHBhcnNlSW50KG51bWJlciwgMiksXG4gICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgbGluZVN0YXJ0OiBsaW5lU3RhcnQsXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2Nhbk9jdGFsTGl0ZXJhbChwcmVmaXgsIHN0YXJ0KSB7XG4gICAgICAgIHZhciBudW1iZXIsIG9jdGFsO1xuXG4gICAgICAgIGlmIChpc09jdGFsRGlnaXQocHJlZml4KSkge1xuICAgICAgICAgICAgb2N0YWwgPSB0cnVlO1xuICAgICAgICAgICAgbnVtYmVyID0gJzAnICsgc291cmNlW2luZGV4KytdO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgb2N0YWwgPSBmYWxzZTtcbiAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICBudW1iZXIgPSAnJztcbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgaWYgKCFpc09jdGFsRGlnaXQoc291cmNlW2luZGV4XSkpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW9jdGFsICYmIG51bWJlci5sZW5ndGggPT09IDApIHtcbiAgICAgICAgICAgIC8vIG9ubHkgMG8gb3IgME9cbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaXNJZGVudGlmaWVyU3RhcnQoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpKSB8fCBpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHR5cGU6IFRva2VuLk51bWVyaWNMaXRlcmFsLFxuICAgICAgICAgICAgdmFsdWU6IHBhcnNlSW50KG51bWJlciwgOCksXG4gICAgICAgICAgICBvY3RhbDogb2N0YWwsXG4gICAgICAgICAgICBsaW5l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5cbiAgICAgICAgc3RhcnQgPSBpbmRleDtcbiAgICAgICAgbnVtYmVyID0gJyc7XG4gICAgICAgIGlmIChjaCAhPT0gJy4nKSB7XG4gICAgICAgICAgICBudW1iZXIgPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG5cbiAgICAgICAgICAgIC8vIEhleCBudW1iZXIgc3RhcnRzIHdpdGggJzB4Jy5cbiAgICAgICAgICAgIC8vIE9jdGFsIG51bWJlciBzdGFydHMgd2l0aCAnMCcuXG4gICAgICAgICAgICAvLyBPY3RhbCBudW1iZXIgaW4gRVM2IHN0YXJ0cyB3aXRoICcwbycuXG4gICAgICAgICAgICAvLyBCaW5hcnkgbnVtYmVyIGluIEVTNiBzdGFydHMgd2l0aCAnMGInLlxuICAgICAgICAgICAgaWYgKG51bWJlciA9PT0gJzAnKSB7XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAneCcgfHwgY2ggPT09ICdYJykge1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2NhbkhleExpdGVyYWwoc3RhcnQpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICdiJyB8fCBjaCA9PT0gJ0InKSB7XG4gICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY2FuQmluYXJ5TGl0ZXJhbChzdGFydCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ28nIHx8IGNoID09PSAnTycpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5PY3RhbExpdGVyYWwoY2gsIHN0YXJ0KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoaXNPY3RhbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNJbXBsaWNpdE9jdGFsTGl0ZXJhbCgpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2Nhbk9jdGFsTGl0ZXJhbChjaCwgc3RhcnQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB3aGlsZSAoaXNEZWNpbWFsRGlnaXQoc291cmNlLmNoYXJDb2RlQXQoaW5kZXgpKSkge1xuICAgICAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoY2ggPT09ICcuJykge1xuICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIHdoaWxlIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgbnVtYmVyICs9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjaCA9PT0gJ2UnIHx8IGNoID09PSAnRScpIHtcbiAgICAgICAgICAgIG51bWJlciArPSBzb3VyY2VbaW5kZXgrK107XG5cbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJysnIHx8IGNoID09PSAnLScpIHtcbiAgICAgICAgICAgICAgICBudW1iZXIgKz0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4KSkpIHtcbiAgICAgICAgICAgICAgICB3aGlsZSAoaXNEZWNpbWFsRGlnaXQoc291cmNl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gIHN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICsraW5kZXg7XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcblxuICAgICAgICAgICAgaWYgKGNoID09PSBxdW90ZSkge1xuICAgICAgICAgICAgICAgIHF1b3RlID0gJyc7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFxcXCcpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgICAgICBpZiAoIWNoIHx8ICFpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoY2gpIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAndSc6XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3gnOlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNvdXJjZVtpbmRleF0gPT09ICd7Jykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9IHNjYW5Vbmljb2RlQ29kZVBvaW50RXNjYXBlKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZXNjYXBlZCA9IHNjYW5IZXhFc2NhcGUoY2gpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdW5lc2NhcGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSB1bmVzY2FwZWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbic6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcbic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAncic6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xccic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAndCc6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcdCc7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnYic6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcYic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZic6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xcZic7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAndic6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gJ1xceDBCJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICc4JzpcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnOSc6XG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gY2g7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbigpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc09jdGFsRGlnaXQoY2gpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb2N0VG9EZWMgPSBvY3RhbFRvRGVjaW1hbChjaCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvY3RhbCA9IG9jdFRvRGVjLm9jdGFsIHx8IG9jdGFsO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKG9jdFRvRGVjLmNvZGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgKz0gY2g7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICsrbGluZU51bWJlcjtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAnXFxyJyAmJiBzb3VyY2VbaW5kZXhdID09PSAnXFxuJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBsaW5lU3RhcnQgPSBpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgc3RyICs9IGNoO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHF1b3RlICE9PSAnJykge1xuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB0eXBlOiBUb2tlbi5TdHJpbmdMaXRlcmFsLFxuICAgICAgICAgICAgdmFsdWU6IHN0cixcbiAgICAgICAgICAgIG9jdGFsOiBvY3RhbCxcbiAgICAgICAgICAgIGxpbmVOdW1iZXI6IHN0YXJ0TGluZU51bWJlcixcbiAgICAgICAgICAgIGxpbmVTdGFydDogc3RhcnRMaW5lU3RhcnQsXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgLy8gRUNNQS0yNjIgMTEuOC42IFRlbXBsYXRlIExpdGVyYWwgTGV4aWNhbCBDb21wb25lbnRzXG5cbiAgICBmdW5jdGlvbiBzY2FuVGVtcGxhdGUoKSB7XG4gICAgICAgIHZhciBjb29rZWQgPSAnJywgY2gsIHN0YXJ0LCByYXdPZmZzZXQsIHRlcm1pbmF0ZWQsIGhlYWQsIHRhaWwsIHJlc3RvcmUsIHVuZXNjYXBlZDtcblxuICAgICAgICB0ZXJtaW5hdGVkID0gZmFsc2U7XG4gICAgICAgIHRhaWwgPSBmYWxzZTtcbiAgICAgICAgc3RhcnQgPSBpbmRleDtcbiAgICAgICAgaGVhZCA9IChzb3VyY2VbaW5kZXhdID09PSAnYCcpO1xuICAgICAgICByYXdPZmZzZXQgPSAyO1xuXG4gICAgICAgICsraW5kZXg7XG5cbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJ2AnKSB7XG4gICAgICAgICAgICAgICAgcmF3T2Zmc2V0ID0gMTtcbiAgICAgICAgICAgICAgICB0YWlsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICckJykge1xuICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY3VybHlTdGFjay5wdXNoKCckeycpO1xuICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvb2tlZCArPSBjaDtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT09ICdcXFxcJykge1xuICAgICAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4KytdO1xuICAgICAgICAgICAgICAgIGlmICghaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ24nOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3InOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHInO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3QnOlxuICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9ICdcXHQnO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3UnOlxuICAgICAgICAgICAgICAgICAgICBjYXNlICd4JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzb3VyY2VbaW5kZXhdID09PSAneycpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSBzY2FuVW5pY29kZUNvZGVQb2ludEVzY2FwZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5lc2NhcGVkID0gc2NhbkhleEVzY2FwZShjaCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVuZXNjYXBlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29rZWQgKz0gdW5lc2NhcGVkO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcmVzdG9yZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdiJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxiJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdmJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFxmJztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICd2JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFx2JztcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICcwJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0RlY2ltYWxEaWdpdChzb3VyY2UuY2hhckNvZGVBdChpbmRleCkpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMDEgXFwwMiBhbmQgc28gb25cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dFcnJvcihNZXNzYWdlcy5UZW1wbGF0ZU9jdGFsTGl0ZXJhbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tlZCArPSAnXFwwJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNPY3RhbERpZ2l0KGNoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElsbGVnYWw6IFxcMSBcXDJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLlRlbXBsYXRlT2N0YWxMaXRlcmFsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2VkICs9IGNoO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICArK2xpbmVOdW1iZXI7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICsraW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChpc0xpbmVUZXJtaW5hdG9yKGNoLmNoYXJDb2RlQXQoMCkpKSB7XG4gICAgICAgICAgICAgICAgKytsaW5lTnVtYmVyO1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xccicgJiYgc291cmNlW2luZGV4XSA9PT0gJ1xcbicpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGluZVN0YXJ0ID0gaW5kZXg7XG4gICAgICAgICAgICAgICAgY29va2VkICs9ICdcXG4nO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb29rZWQgKz0gY2g7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIWhlYWQpIHtcbiAgICAgICAgICAgIHN0YXRlLmN1cmx5U3RhY2sucG9wKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdHlwZTogVG9rZW4uVGVtcGxhdGUsXG4gICAgICAgICAgICB2YWx1ZToge1xuICAgICAgICAgICAgICAgIGNvb2tlZDogY29va2VkLFxuICAgICAgICAgICAgICAgIHJhdzogc291cmNlLnNsaWNlKHN0YXJ0ICsgMSwgaW5kZXggLSByYXdPZmZzZXQpXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaGVhZDogaGVhZCxcbiAgICAgICAgICAgIHRhaWw6IHRhaWwsXG4gICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgbGluZVN0YXJ0OiBsaW5lU3RhcnQsXG4gICAgICAgICAgICBzdGFydDogc3RhcnQsXG4gICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgLy8gRUNNQS0yNjIgMTEuOC41IFJlZ3VsYXIgRXhwcmVzc2lvbiBMaXRlcmFsc1xuXG4gICAgZnVuY3Rpb24gdGVzdFJlZ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yZSBpbmZvcm1hdGlvbi4pXG4gICAgICAgICAgICAgICAgLnJlcGxhY2UoL1xcXFx1XFx7KFswLTlhLWZBLUZdKylcXH18XFxcXHUoW2EtZkEtRjAtOV17NH0pL2csIGZ1bmN0aW9uICgkMCwgJDEsICQyKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2RlUG9pbnQgPSBwYXJzZUludCgkMSB8fCAkMiwgMTYpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID4gMHgxMEZGRkYpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLkludmFsaWRSZWdFeHApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmIChjb2RlUG9pbnQgPD0gMHhGRkZGKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZShjb2RlUG9pbnQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBhc3RyYWxTdWJzdGl0dXRlO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLy8gUmVwbGFjZSBlYWNoIHBhaXJlZCBzdXJyb2dhdGUgd2l0aCBhIHNpbmdsZSBBU0NJSSBzeW1ib2wgdG9cbiAgICAgICAgICAgICAgICAvLyBhdm9pZCB0aHJvd2luZyBvbiByZWd1bGFyIGV4cHJlc3Npb25zIHRoYXQgYXJlIG9ubHkgdmFsaWQgaW5cbiAgICAgICAgICAgICAgICAvLyBjb21iaW5hdGlvbiB3aXRoIHRoZSBcInVcIiBmbGFnLlxuICAgICAgICAgICAgICAgIC5yZXBsYWNlKFxuICAgICAgICAgICAgICAgICAgICAvW1xcdUQ4MDAtXFx1REJGRl1bXFx1REMwMC1cXHVERkZGXS9nLFxuICAgICAgICAgICAgICAgICAgICBhc3RyYWxTdWJzdGl0dXRlXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEZpcnN0LCBkZXRlY3QgaW52YWxpZCByZWd1bGFyIGV4cHJlc3Npb25zLlxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgUmVnRXhwKHRtcCk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLkludmFsaWRSZWdFeHApO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gUmV0dXJuIGEgcmVndWxhciBleHByZXNzaW9uIG9iamVjdCBmb3IgdGhpcyBwYXR0ZXJuLWZsYWcgcGFpciwgb3JcbiAgICAgICAgLy8gYG51bGxgIGluIGNhc2UgdGhlIGN1cnJlbnQgZW52aXJvbm1lbnQgZG9lc24ndCBzdXBwb3J0IHRoZSBmbGFncyBpdFxuICAgICAgICAvLyB1c2VzLlxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmV0dXJuIG5ldyBSZWdFeHAocGF0dGVybiwgZmxhZ3MpO1xuICAgICAgICB9IGNhdGNoIChleGNlcHRpb24pIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2NhblJlZ0V4cEJvZHkoKSB7XG4gICAgICAgIHZhciBjaCwgc3RyLCBjbGFzc01hcmtlciwgdGVybWluYXRlZCwgYm9keTtcblxuICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgIGFzc2VydChjaCA9PT0gJy8nLCAnUmVndWxhciBleHByZXNzaW9uIGxpdGVyYWwgbXVzdCBzdGFydCB3aXRoIGEgc2xhc2gnKTtcbiAgICAgICAgc3RyID0gc291cmNlW2luZGV4KytdO1xuXG4gICAgICAgIGNsYXNzTWFya2VyID0gZmFsc2U7XG4gICAgICAgIHRlcm1pbmF0ZWQgPSBmYWxzZTtcbiAgICAgICAgd2hpbGUgKGluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleCsrXTtcbiAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgIGlmIChjaCA9PT0gJ1xcXFwnKSB7XG4gICAgICAgICAgICAgICAgY2ggPSBzb3VyY2VbaW5kZXgrK107XG4gICAgICAgICAgICAgICAgLy8gRUNNQS0yNjIgNy44LjVcbiAgICAgICAgICAgICAgICBpZiAoaXNMaW5lVGVybWluYXRvcihjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihudWxsLCBNZXNzYWdlcy5VbnRlcm1pbmF0ZWRSZWdFeHApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzdHIgKz0gY2g7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzTGluZVRlcm1pbmF0b3IoY2guY2hhckNvZGVBdCgwKSkpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihudWxsLCBNZXNzYWdlcy5VbnRlcm1pbmF0ZWRSZWdFeHApO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChjbGFzc01hcmtlcikge1xuICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7XG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTWFya2VyID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICcvJykge1xuICAgICAgICAgICAgICAgICAgICB0ZXJtaW5hdGVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PT0gJ1snKSB7XG4gICAgICAgICAgICAgICAgICAgIGNsYXNzTWFya2VyID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXRlcm1pbmF0ZWQpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKG51bGwsIE1lc3NhZ2VzLlVudGVybWluYXRlZFJlZ0V4cCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBFeGNsdWRlIGxlYWRpbmcgYW5kIHRyYWlsaW5nIHNsYXNoLlxuICAgICAgICBib2R5ID0gc3RyLnN1YnN0cigxLCBzdHIubGVuZ3RoIC0gMik7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogYm9keSxcbiAgICAgICAgICAgIGxpdGVyYWw6IHN0clxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHNjYW5SZWdFeHBGbGFncygpIHtcbiAgICAgICAgdmFyIGNoLCBzdHIsIGZsYWdzLCByZXN0b3JlO1xuXG4gICAgICAgIHN0ciA9ICcnO1xuICAgICAgICBmbGFncyA9ICcnO1xuICAgICAgICB3aGlsZSAoaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgIGNoID0gc291cmNlW2luZGV4XTtcbiAgICAgICAgICAgIGlmICghaXNJZGVudGlmaWVyUGFydChjaC5jaGFyQ29kZUF0KDApKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICArK2luZGV4O1xuICAgICAgICAgICAgaWYgKGNoID09PSAnXFxcXCcgJiYgaW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBjaCA9IHNvdXJjZVtpbmRleF07XG4gICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHtcbiAgICAgICAgICAgICAgICAgICAgKytpbmRleDtcbiAgICAgICAgICAgICAgICAgICAgcmVzdG9yZSA9IGluZGV4O1xuICAgICAgICAgICAgICAgICAgICBjaCA9IHNjYW5IZXhFc2NhcGUoJ3UnKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmbGFncyArPSBjaDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoc3RyICs9ICdcXFxcdSc7IHJlc3RvcmUgPCBpbmRleDsgKytyZXN0b3JlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyICs9IHNvdXJjZVtyZXN0b3JlXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gcmVzdG9yZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzICs9ICd1JztcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0ciArPSAnXFxcXHUnO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlVW5leHBlY3RlZFRva2VuKCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3RyICs9ICdcXFxcJztcbiAgICAgICAgICAgICAgICAgICAgdG9sZXJhdGVVbmV4cGVjdGVkVG9rZW4oKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGZsYWdzICs9IGNoO1xuICAgICAgICAgICAgICAgIHN0ciArPSBjaDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICB2YWx1ZTogZmxhZ3MsXG4gICAgICAgICAgICBsaXRlcmFsOiBzdHJcbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBzY2FuUmVnRXhwKCkge1xuICAgICAgICB2YXIgc3RhcnQsIGJvZHksIGZsYWdzLCB2YWx1ZTtcbiAgICAgICAgc2Nhbm5pbmcgPSB0cnVlO1xuXG4gICAgICAgIGxvb2thaGVhZCA9IG51bGw7XG4gICAgICAgIHNraXBDb21tZW50KCk7XG4gICAgICAgIHN0YXJ0ID0gaW5kZXg7XG5cbiAgICAgICAgYm9keSA9IHNjYW5SZWdFeHBCb2R5KCk7XG4gICAgICAgIGZsYWdzID0gc2NhblJlZ0V4cEZsYWdzKCk7XG4gICAgICAgIHZhbHVlID0gdGVzdFJlZ0V4cChib2R5LnZhbHVlLCBmbGFncy52YWx1ZSk7XG4gICAgICAgIHNjYW5uaW5nID0gZmFsc2U7XG4gICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiBUb2tlbi5SZWd1bGFyRXhwcmVzc2lvbixcbiAgICAgICAgICAgICAgICB2YWx1ZTogdmFsdWUsXG4gICAgICAgICAgICAgICAgcmVnZXg6IHtcbiAgICAgICAgICAgICAgICAgICAgcGF0dGVybjogYm9keS52YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgZmxhZ3M6IGZsYWdzLnZhbHVlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgICAgIHN0YXJ0OiBzdGFydCxcbiAgICAgICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIGxpdGVyYWw6IGJvZHkubGl0ZXJhbCArIGZsYWdzLmxpdGVyYWwsXG4gICAgICAgICAgICB2YWx1ZTogdmFsdWUsXG4gICAgICAgICAgICByZWdleDoge1xuICAgICAgICAgICAgICAgIHBhdHRlcm46IGJvZHkudmFsdWUsXG4gICAgICAgICAgICAgICAgZmxhZ3M6IGZsYWdzLnZhbHVlXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgc3RhcnQ6IHN0YXJ0LFxuICAgICAgICAgICAgZW5kOiBpbmRleFxuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbGxlY3RSZWdleCgpIHtcbiAgICAgICAgdmFyIHBvcywgbG9jLCByZWdleCwgdG9rZW47XG5cbiAgICAgICAgc2tpcENvbW1lbnQoKTtcblxuICAgICAgICBwb3MgPSBpbmRleDtcbiAgICAgICAgbG9jID0ge1xuICAgICAgICAgICAgc3RhcnQ6IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICByZWdleCA9IHNjYW5SZWdFeHAoKTtcblxuICAgICAgICBsb2MuZW5kID0ge1xuICAgICAgICAgICAgbGluZTogbGluZU51bWJlcixcbiAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgfTtcblxuICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICAgICAgICBpZiAoIWV4dHJhLnRva2VuaXplKSB7XG4gICAgICAgICAgICAvLyBQb3AgdGhlIHByZXZpb3VzIHRva2VuLCB3aGljaCBpcyBsaWtlbHkgJy8nIG9yICcvPSdcbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbnMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRva2VuID0gZXh0cmEudG9rZW5zW2V4dHJhLnRva2Vucy5sZW5ndGggLSAxXTtcbiAgICAgICAgICAgICAgICBpZiAodG9rZW4ucmFuZ2VbMF0gPT09IHBvcyAmJiB0b2tlbi50eXBlID09PSAnUHVuY3R1YXRvcicpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRva2VuLnZhbHVlID09PSAnLycgfHwgdG9rZW4udmFsdWUgPT09ICcvPScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRva2Vucy5wb3AoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZXh0cmEudG9rZW5zLnB1c2goe1xuICAgICAgICAgICAgICAgIHR5cGU6ICdSZWd1bGFyRXhwcmVzc2lvbicsXG4gICAgICAgICAgICAgICAgdmFsdWU6IHJlZ2V4LmxpdGVyYWwsXG4gICAgICAgICAgICAgICAgcmVnZXg6IHJlZ2V4LnJlZ2V4LFxuICAgICAgICAgICAgICAgIHJhbmdlOiBbcG9zLCBpbmRleF0sXG4gICAgICAgICAgICAgICAgbG9jOiBsb2NcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHJlZ2V4O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGlzSWRlbnRpZmllck5hbWUodG9rZW4pIHtcbiAgICAgICAgcmV0dXJuIHRva2VuLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIgfHxcbiAgICAgICAgICAgIHRva2VuLnR5cGUgPT09IFRva2VuLktleXdvcmQgfHxcbiAgICAgICAgICAgIHRva2VuLnR5cGUgPT09IFRva2VuLkJvb2xlYW5MaXRlcmFsIHx8XG4gICAgICAgICAgICB0b2tlbi50eXBlID09PSBUb2tlbi5OdWxsTGl0ZXJhbDtcbiAgICB9XG5cbiAgICAvLyBVc2luZyB0aGUgZm9sbG93aW5nIGFsZ29yaXRobTpcbiAgICAvLyBodHRwczovL2dpdGh1Yi5jb20vbW96aWxsYS9zd2VldC5qcy93aWtpL2Rlc2lnblxuXG4gICAgZnVuY3Rpb24gYWR2YW5jZVNsYXNoKCkge1xuICAgICAgICB2YXIgcmVnZXgsIHByZXZpb3VzLCBjaGVjaztcblxuICAgICAgICBmdW5jdGlvbiB0ZXN0S2V5d29yZCh2YWx1ZSkge1xuICAgICAgICAgICAgcmV0dXJuIHZhbHVlICYmICh2YWx1ZS5sZW5ndGggPiAxKSAmJiAodmFsdWVbMF0gPj0gJ2EnKSAmJiAodmFsdWVbMF0gPD0gJ3onKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHByZXZpb3VzID0gZXh0cmEudG9rZW5WYWx1ZXNbZXh0cmEudG9rZW5zLmxlbmd0aCAtIDFdO1xuICAgICAgICByZWdleCA9IChwcmV2aW91cyAhPT0gbnVsbCk7XG5cbiAgICAgICAgc3dpdGNoIChwcmV2aW91cykge1xuICAgICAgICBjYXNlICd0aGlzJzpcbiAgICAgICAgY2FzZSAnXSc6XG4gICAgICAgICAgICByZWdleCA9IGZhbHNlO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnKSc6XG4gICAgICAgICAgICBjaGVjayA9IGV4dHJhLnRva2VuVmFsdWVzW2V4dHJhLm9wZW5QYXJlblRva2VuIC0gMV07XG4gICAgICAgICAgICByZWdleCA9IChjaGVjayA9PT0gJ2lmJyB8fCBjaGVjayA9PT0gJ3doaWxlJyB8fCBjaGVjayA9PT0gJ2ZvcicgfHwgY2hlY2sgPT09ICd3aXRoJyk7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICd9JzpcbiAgICAgICAgICAgIC8vIERpdmlkaW5nIGEgZnVuY3Rpb24gYnkgYW55dGhpbmcgbWFrZXMgbGl0dGxlIHNlbnNlLFxuICAgICAgICAgICAgLy8gYnV0IHdlIGhhdmUgdG8gY2hlY2sgZm9yIHRoYXQuXG4gICAgICAgICAgICByZWdleCA9IGZhbHNlO1xuICAgICAgICAgICAgaWYgKHRlc3RLZXl3b3JkKGV4dHJhLnRva2VuVmFsdWVzW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gM10pKSB7XG4gICAgICAgICAgICAgICAgLy8gQW5vbnltb3VzIGZ1bmN0aW9uLCBlLmcuIGZ1bmN0aW9uKCl7fSAvNDJcbiAgICAgICAgICAgICAgICBjaGVjayA9IGV4dHJhLnRva2VuVmFsdWVzW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gNF07XG4gICAgICAgICAgICAgICAgcmVnZXggPSBjaGVjayA/IChGbkV4cHJUb2tlbnMuaW5kZXhPZihjaGVjaykgPCAwKSA6IGZhbHNlO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0ZXN0S2V5d29yZChleHRyYS50b2tlblZhbHVlc1tleHRyYS5vcGVuQ3VybHlUb2tlbiAtIDRdKSkge1xuICAgICAgICAgICAgICAgIC8vIE5hbWVkIGZ1bmN0aW9uLCBlLmcuIGZ1bmN0aW9uIGYoKXt9IC80Mi9cbiAgICAgICAgICAgICAgICBjaGVjayA9IGV4dHJhLnRva2VuVmFsdWVzW2V4dHJhLm9wZW5DdXJseVRva2VuIC0gNV07XG4gICAgICAgICAgICAgICAgcmVnZXggPSBjaGVjayA/IChGbkV4cHJUb2tlbnMuaW5kZXhPZihjaGVjaykgPCAwKSA6IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcmVnZXggPyBjb2xsZWN0UmVnZXgoKSA6IHNjYW5QdW5jdHVhdG9yKCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gYWR2YW5jZSgpIHtcbiAgICAgICAgdmFyIGNwLCB0b2tlbjtcblxuICAgICAgICBpZiAoaW5kZXggPj0gbGVuZ3RoKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6IFRva2VuLkVPRixcbiAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGxpbmVTdGFydDogbGluZVN0YXJ0LFxuICAgICAgICAgICAgICAgIHN0YXJ0OiBpbmRleCxcbiAgICAgICAgICAgICAgICBlbmQ6IGluZGV4XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgY3AgPSBzb3VyY2UuY2hhckNvZGVBdChpbmRleCk7XG5cbiAgICAgICAgaWYgKGlzSWRlbnRpZmllclN0YXJ0KGNwKSkge1xuICAgICAgICAgICAgdG9rZW4gPSBzY2FuSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQodG9rZW4udmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4udHlwZSA9IFRva2VuLktleXdvcmQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gdG9rZW47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBWZXJ5IGNvbW1vbjogKCBhbmQgKSBhbmQgO1xuICAgICAgICBpZiAoY3AgPT09IDB4MjggfHwgY3AgPT09IDB4MjkgfHwgY3AgPT09IDB4M0IpIHtcbiAgICAgICAgICAgIHJldHVybiBzY2FuUHVuY3R1YXRvcigpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gU3RyaW5nIGxpdGVyYWwgc3RhcnRzIHdpdGggc2luZ2xlIHF1b3RlIChVKzAwMjcpIG9yIGRvdWJsZSBxdW90ZSAoVSswMDIyKS5cbiAgICAgICAgaWYgKGNwID09PSAweDI3IHx8IGNwID09PSAweDIyKSB7XG4gICAgICAgICAgICByZXR1cm4gc2NhblN0cmluZ0xpdGVyYWwoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIERvdCAoLikgVSswMDJFIGNhbiBhbHNvIHN0YXJ0IGEgZmxvYXRpbmctcG9pbnQgbnVtYmVyLCBoZW5jZSB0aGUgbmVlZFxuICAgICAgICAvLyB0byBjaGVjayB0aGUgbmV4dCBjaGFyYWN0ZXIuXG4gICAgICAgIGlmIChjcCA9PT0gMHgyRSkge1xuICAgICAgICAgICAgaWYgKGlzRGVjaW1hbERpZ2l0KHNvdXJjZS5jaGFyQ29kZUF0KGluZGV4ICsgMSkpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHNjYW5OdW1lcmljTGl0ZXJhbCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJu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oKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBjb2xsZWN0VG9rZW4oKSB7XG4gICAgICAgIHZhciBsb2MsIHRva2VuLCB2YWx1ZSwgZW50cnk7XG5cbiAgICAgICAgbG9jID0ge1xuICAgICAgICAgICAgc3RhcnQ6IHtcbiAgICAgICAgICAgICAgICBsaW5lOiBsaW5lTnVtYmVyLFxuICAgICAgICAgICAgICAgIGNvbHVtbjogaW5kZXggLSBsaW5lU3RhcnRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICB0b2tlbiA9IGFkdmFuY2UoKTtcbiAgICAgICAgbG9jLmVuZCA9IHtcbiAgICAgICAgICAgIGxpbmU6IGxpbmVOdW1iZXIsXG4gICAgICAgICAgICBjb2x1bW46IGluZGV4IC0gbGluZVN0YXJ0XG4gICAgICAgIH07XG5cbiAgICAgICAgaWYgKHRva2VuLnR5cGUgIT09IFRva2VuLkVPRikge1xuICAgICAgICAgICAgdmFsdWUgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQsIHRva2VuLmVuZCk7XG4gICAgICAgICAgICBlbnRyeSA9IHtcbiAgICAgICAgICAgICAgICB0eXBlOiBUb2tlbk5hbWVbdG9rZW4udHlwZV0sXG4gICAgICAgICAgICAgICAgdmFsdWU6IHZhbHVlLFxuICAgICAgICAgICAgICAgIHJhbmdlOiBbdG9rZW4uc3RhcnQsIHRva2VuLmVuZF0sXG4gICAgICAgICAgICAgICAgbG9jOiBsb2NcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAodG9rZW4ucmVnZXgpIHtcbiAgICAgICAgICAgICAgICBlbnRyeS5yZWdleCA9IHtcbiAgICAgICAgICAgICAgICAgICAgcGF0dGVybjogdG9rZW4ucmVnZXgucGF0dGVybixcbiAgICAgICAgICAgICAgICAgICAgZmxhZ3M6IHRva2VuLnJlZ2V4LmZsYWdzXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlblZhbHVlcykge1xuICAgICAgICAgICAgICAgIGV4dHJhLnRva2VuVmFsdWVzLnB1c2goKGVudHJ5LnR5cGUgPT09ICdQdW5jdHVhdG9yJyB8fCBlbnRyeS50eXBlID09PSAnS2V5d29yZCcpID8gZW50cnkudmFsdWUgOiBudWxsKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChleHRyYS50b2tlbml6ZSkge1xuICAgICAgICAgICAgICAgIGlmICghZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGVudHJ5LnJhbmdlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoIWV4dHJhLmxvYykge1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgZW50cnkubG9jO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuZGVsZWdhdGUpIHtcbiAgICAgICAgICAgICAgICAgICAgZW50cnkgPSBleHRyYS5kZWxlZ2F0ZShlbnRyeSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXh0cmEudG9rZW5zLnB1c2goZW50cnkpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIHRva2VuO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGxleCgpIHtcbiAgICAgICAgdmFyIHRva2VuO1xuICAgICAgICBzY2FubmluZyA9IHRydWU7XG5cbiAgICAgICAgbGFzdEluZGV4ID0gaW5kZXg7XG4gICAgICAgIGxhc3RMaW5lTnVtYmVyID0gbGluZU51bWJlcjtcbiAgICAgICAgbGFzdExpbmVTdGFydCA9IGxpbmVTdGFydDtcblxuICAgICAgICBza2lwQ29tbWVudCgpO1xuXG4gICAgICAgIHRva2VuID0gbG9va2FoZWFkO1xuXG4gICAgICAgIHN0YXJ0SW5kZXggPSBpbmRleDtcbiAgICAgICAgc3RhcnRMaW5lTnVtY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G51bGw7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gV3JhcHBpbmdTb3VyY2VMb2NhdGlvbihzdGFydFRva2VuKSB7XG4gICAgICAgIHRoaXMuc3RhcnQgPSB7XG4gICAgICAgICAgICBsaW5lOiBzdGFydFRva2VuLmxpbmVOdW1iZXIsXG4gICAgICAgICAgICBjb2x1bW46IHN0YXJ0VG9rZW4uc3RhcnQgLSBzdGFydFRva2VuLmxpbmVTdGFydFxuICAgICAgICB9O1xuICAgICAgICB0aGlzLmVuZCA9IG51bGw7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gTm9kZSgpIHtcbiAgICAgICAgaWYgKGV4dHJhLnJhbmdlKSB7XG4gICAgICAgICAgICB0aGlzLnJhbmdlID0gW3N0YXJ0SW5kZXgsIDBdO1xuICAgICAgICB9XG4gICAgICAgIGlmIChleHRyYS5sb2MpIHtcbiAgICAgICAgICAgIHRoaXMubG9jID0gbmV3IFNvdXJjZUxvY2F0aW9uKCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikge1xuICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgIHRoaXMucmFuZ2UgPSBbc3RhcnRUb2tlbi5zdGFydCwgMF07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgdGhpcy5sb2MgPSBuZXcgV3JhcHBpbmdTb3VyY2VMb2NhdGlvbihzdGFydFRva2VuKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFdyYXBwaW5nTm9kZS5wcm90b3R5cGUgPSBOb2RlLnByb3RvdHlwZSA9IHtcblxuICAgICAgICBwcm9jZXNzQ29tbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGxhc3RDaGlsZCxcbiAgICAgICAgICAgICAgICBpbm5lckNvbW1lbnRzLFxuICAgICAgICAgICAgICAgIGxlYWRpbmdDb21tZW50cyxcbiAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzLFxuICAgICAgICAgICAgICAgIGJvdHRvbVJpZ2h0ID0gZXh0cmEuYm90dG9tUmlnaHRTdGFjayxcbiAgICAgICAgICAgICAgICBpLFxuICAgICAgICAgICAgICAgIGNvbW1lbnQsXG4gICAgICAgICAgICAgICAgbGFzdCA9IGJvdHRvbVJpZ2h0W2JvdHRvbVJpZ2h0Lmxlbmd0aCAtIDFdO1xuXG4gICAgICAgICAgICBpZiAodGhpcy50eXBlID09PSBTeW50YXguUHJvZ3JhbSkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmJvZHkubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLyoqXG4gICAgICAgICAgICAgKiBwYXRjaCBpbm5uZXJDb21tZW50cyBmb3IgcHJvcGVydGllcyBlbXB0eSBibG9ja1xuICAgICAgICAgICAgICogYGZ1bmN0aW9uIGEoKSB7LyoqIGNvbW1lbnRzICoqXFwvfWBcbiAgICAgICAgICAgICAqL1xuXG4gICAgICAgICAgICBpZiAodGhpcy50eXBlID09PSBTeW50YXguQmxvY2tTdGF0ZW1lbnQgJiYgdGhpcy5ib2R5Lmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGlubmVyQ29tbWVudHMgPSBbXTtcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSBleHRyYS5sZWFkaW5nQ29tbWVudHMubGVuZ3RoIC0gMTsgaSA+PSAwOyAtLWkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29tbWVudCA9IGV4dHJhLmxlYWRpbmdDb21tZW50c1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucmFuZ2VbMV0gPj0gY29tbWVudC5yYW5nZVsxXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5uZXJDb21tZW50cy51bnNoaWZ0KGNvbW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmEubGVhZGluZ0NvbW1lbnRzLnNwbGljZShpLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLnRyYWlsaW5nQ29tbWVudHMuc3BsaWNlKGksIDEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChpbm5lckNvbW1lbnRzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmlubmVyQ29tbWVudHMgPSBpbm5lckNvbW1lbnRzO1xuICAgICAgICAgICAgICAgICAgICAvL2JvdHRvbVJpZ2h0LnB1c2godGhpcyk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChleHRyYS50cmFpbGluZ0NvbW1lbnRzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICB0cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICAgICAgZm9yIChpID0gZXh0cmEudHJhaWxpbmdDb21tZW50cy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gZXh0cmEudHJhaWxpbmdDb21tZW50c1tpXTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvbW1lbnQucmFuZ2VbMF0gPj0gdGhpcy5yYW5nZVsxXSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHJhaWxpbmdDb21tZW50cy51bnNoaWZ0KGNvbW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmEudHJhaWxpbmdDb21tZW50cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZXh0cmEudHJhaWxpbmdDb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBpZiAobGFzdCAmJiBsYXN0LnRyYWlsaW5nQ29tbWVudHMgJiYgbGFzdC50cmFpbGluZ0NvbW1lbnRzWzBdLnJhbmdlWzBdID49IHRoaXMucmFuZ2VbMV0pIHtcbiAgICAgICAgICAgICAgICAgICAgdHJhaWxpbmdDb21tZW50cyA9IGxhc3QudHJhaWxpbmdDb21tZW50cztcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGxhc3QudHJhaWxpbmdDb21tZW50cztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIEVhdGluZyB0aGUgc3RhY2suXG4gICAgICAgICAgICB3aGlsZSAobGFzdCAmJiBsYXN0LnJhbmdlWzBdID49IHRoaXMucmFuZ2VbMF0pIHtcbiAgICAgICAgICAgICAgICBsYXN0Q2hpbGQgPSBib3R0b21SaWdodC5wb3AoKTtcbiAgICAgICAgICAgICAgICBsYXN0ID0gYm90dG9tUmlnaHRbYm90dG9tUmlnaHQubGVuZ3RoIC0gMV07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChsYXN0Q2hpbGQpIHtcbiAgICAgICAgICAgICAgICBpZiAobGFzdENoaWxkLmxlYWRpbmdDb21tZW50cykge1xuICAgICAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gbGFzdENoaWxkLmxlYWRpbmdDb21tZW50cy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29tbWVudCA9IGxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVsxXSA8PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVhZGluZ0NvbW1lbnRzLnVuc2hpZnQoY29tbWVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdENoaWxkLmxlYWRpbmdDb21tZW50cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZiAoIWxhc3RDaGlsZC5sZWFkaW5nQ29tbWVudHMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsYXN0Q2hpbGQubGVhZGluZ0NvbW1lbnRzID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChleHRyYS5sZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGxlYWRpbmdDb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGZvciAoaSA9IGV4dHJhLmxlYWRpbmdDb21tZW50cy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgICAgICBjb21tZW50ID0gZXh0cmEubGVhZGluZ0NvbW1lbnRzW2ldO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY29tbWVudC5yYW5nZVsxXSA8PSB0aGlzLnJhbmdlWzBdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZWFkaW5nQ29tbWVudHMudW5zaGlmdChjb21tZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmxlYWRpbmdDb21tZW50cy5zcGxpY2UoaSwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cblxuICAgICAgICAgICAgaWYgKGxlYWRpbmdDb21tZW50cyAmJiBsZWFkaW5nQ29tbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHRoaXMubGVhZGluZ0NvbW1lbnRzID0gbGVhZGluZ0NvbW1lbnRzO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRyYWlsaW5nQ29tbWVudHMgJiYgdHJhaWxpbmdDb21tZW50cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdGhpcy50cmFpbGluZ0NvbW1lbnRzID0gdHJhaWxpbmdDb21tZW50cztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgYm90dG9tUmlnaHQucHVzaCh0aGlzKTtcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2g6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGlmIChleHRyYS5yYW5nZSkge1xuICAgICAgICAgICAgICAgIHRoaXMucmFuZ2VbMV0gPSBsYXN0SW5kZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEubG9jKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2MuZW5kID0ge1xuICAgICAgICAgICAgICAgICAgICBsaW5lOiBsYXN0TGluZU51bWJlcixcbiAgICAgICAgICAgICAgICAgICAgY29sdW1uOiBsYXN0SW5kZXggLSBsYXN0TGluZVN0YXJ0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmEuc291cmNlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9jLnNvdXJjZSA9IGV4dHJhLnNvdXJjZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChleHRyYS5hdHRhY2hDb21tZW50KSB7XG4gICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzQ29tbWVudCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5RXhwcmVzc2lvbjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycmF5UGF0dGVybjogZnVuY3Rpb24gKGVsZW1lbnRzKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXJyYXlQYXR0ZXJuO1xuICAgICAgICAgICAgdGhpcy5lbGVtZW50cyA9IGVsZW1lbnRzO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEFycm93RnVuY3Rpb25FeHByZXNzaW9uOiBmdW5jdGlvbiAocGFyYW1zLCBkZWZhdWx0cywgYm9keSwgZXhwcmVzc2lvbikge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFycm93RnVuY3Rpb25FeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLnBhcmFtcyA9IHBhcmFtcztcbiAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBkZWZhdWx0cztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmdlbmVyYXRvciA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50RXhwcmVzc2lvbjogZnVuY3Rpb24gKG9wZXJhdG9yLCBsZWZ0LCByaWdodCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkFzc2lnbm1lbnRFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5vcGVyYXRvciA9IG9wZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5sZWZ0ID0gbGVmdDtcbiAgICAgICAgICAgIHRoaXMucmlnaHQgPSByaWdodDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hBc3NpZ25tZW50UGF0dGVybjogZnVuY3Rpb24gKGxlZnQsIHJpZ2h0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQXNzaWdubWVudFBhdHRlcm47XG4gICAgICAgICAgICB0aGlzLmxlZnQgPSBsZWZ0O1xuICAgICAgICAgICAgdGhpcy5yaWdodCA9IHJpZ2h0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJpbmFyeUV4cHJlc3Npb246IGZ1bmN0aW9uIChvcGVyYXRvciwgbGVmdCwgcmlnaHQpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IChvcGVyYXRvciA9PT0gJ3x8JyB8fCBvcGVyYXRvciA9PT0gJyYmJykgPyBTeW50YXguTG9naWNhbEV4cHJlc3Npb24gOiBTeW50YXguQmluYXJ5RXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMub3BlcmF0b3IgPSBvcGVyYXRvcjtcbiAgICAgICAgICAgIHRoaXMubGVmdCA9IGxlZnQ7XG4gICAgICAgICAgICB0aGlzLnJpZ2h0ID0gcmlnaHQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQmxvY2tTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQmxvY2tTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmJvZHkgPSBib2R5O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEJyZWFrU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5CcmVha1N0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDYWxsRXhwcmVzc2lvbjogZnVuY3Rpb24gKGNhbGxlZSwgYXJncykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhbGxFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5jYWxsZWUgPSBjYWxsZWU7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50cyA9IGFyZ3M7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2F0Y2hDbGF1c2U6IGZ1bmN0aW9uIChwYXJhbSwgYm9keSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkNhdGNoQ2xhdXNlO1xuICAgICAgICAgICAgdGhpcy5wYXJhbSA9IHBhcmFtO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0JvZHk6IGZ1bmN0aW9uIChib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguQ2xhc3NCb2R5O1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDbGFzc0RlY2xhcmF0aW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0RlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5pZCA9IGlkO1xuICAgICAgICAgICAgdGhpcy5zdXBlckNsYXNzID0gc3VwZXJDbGFzcztcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoQ2xhc3NFeHByZXNzaW9uOiBmdW5jdGlvbiAoaWQsIHN1cGVyQ2xhc3MsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5DbGFzc0V4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLmlkID0gaWQ7XG4gICAgICAgICAgICB0aGlzLnN1cGVyQ2xhc3MgPSBzdXBlckNsYXNzO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hDb25kaXRpb25hbEV4cHJlc3Npb246IGZ1bmN0aW9uICh0ZXN0LCBjb25zZXF1ZW50LCBhbHRlcm5hdGUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db25kaXRpb25hbEV4cHJlc3Npb247XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5jb25zZXF1ZW50ID0gY29uc2VxdWVudDtcbiAgICAgICAgICAgIHRoaXMuYWx0ZXJuYXRlID0gYWx0ZXJuYXRlO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaENvbnRpbnVlU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Db250aW51ZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMubGFiZWwgPSBsYWJlbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hEZWJ1Z2dlclN0YXRlbWVudDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkRlYnVnZ2VyU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaERvV2hpbGVTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChib2R5LCB0ZXN0KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRG9XaGlsZVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYm9keSA9IGJvZHk7XG4gICAgICAgICAgICB0aGlzLnRlc3QgPSB0ZXN0O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEVtcHR5U3RhdGVtZW50OiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRW1wdHlTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwcmVzc2lvblN0YXRlbWVudDogZnVuY3Rpb24gKGV4cHJlc3Npb24pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHByZXNzaW9uU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hGb3JTdGF0ZW1lbnQ6IGZ1bmN0aW9uIChpbml0LCB0ZXN0LCB1cGRhdGUsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5Gb3JTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmluaXQgPSBpbml0O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMudXBkYXRlID0gdXBkYXRlO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hGb3JPZlN0YXRlbWVudDogZnVuY3Rpb24gKGxlZnQsIHJpZ2h0LCBib2R5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguRm9yT2ZTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmxlZnQgPSBsZWZ0O1xuICAgICAgICAgICAgdGhpcy5yaWdodCA9IHJpZ2h0O1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRo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IGJvZHksIGdlbmVyYXRvcikge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkZ1bmN0aW9uRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuaWQgPSBpZDtcbiAgICAgICAgICAgIHRoaXMucGFyYW1zID0gcGFyYW1zO1xuICAgICAgICAgICAgdGhpcy5kZWZhdWx0cyA9IGRlZmF1bHRzO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZ2VuZXJhdG9yID0gZ2VuZXJhdG9yO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9uID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoSWRlbnRpZmllcjogZnVuY3Rpb24gKG5hbWUpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5JZGVudGlmaWVyO1xuICAgICAgICAgICAgdGhpcy5uYW1lID0gbmFtZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJZlN0YXRlbWVudDogZnVuY3Rpb24gKHRlc3QsIGNvbnNlcXVlbnQsIGFsdGVybmF0ZSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LklmU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy50ZXN0ID0gdGVzdDtcbiAgICAgICAgICAgIHRoaXMuY29uc2VxdWVudCA9IGNvbnNlcXVlbnQ7XG4gICAgICAgICAgICB0aGlzLmFsdGVybmF0ZSA9IGFsdGVybmF0ZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMYWJlbGVkU3RhdGVtZW50OiBmdW5jdGlvbiAobGFiZWwsIGJvZHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MYWJlbGVkU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5sYWJlbCA9IGxhYmVsO1xuICAgICAgICAgICAgdGhpcy5ib2R5ID0gYm9keTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hMaXRlcmFsOiBmdW5jdGlvbiAodG9rZW4pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5MaXRlcmFsO1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHRva2VuLnZhbHVlO1xuICAgICAgICAgICAgdGhpcy5yYXcgPSBzb3VyY2Uuc2xpY2UodG9rZW4uc3RhcnQsIHRva2VuLmVuZCk7XG4gICAgICAgICAgICBpZiAodG9rZW4ucmVnZXgpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlZ2V4ID0gdG9rZW4ucmVnZXg7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTWVtYmVyRXhwcmVzc2lvbjogZnVuY3Rpb24gKGFjY2Vzc29yLCBvYmplY3QsIHByb3BlcnR5KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguTWVtYmVyRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuY29tcHV0ZWQgPSBhY2Nlc3NvciA9PT0gJ1snO1xuICAgICAgICAgICAgdGhpcy5vYmplY3QgPSBvYmplY3Q7XG4gICAgICAgICAgICB0aGlzLnByb3BlcnR5ID0gcHJvcGVydHk7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTWV0YVByb3BlcnR5OiBmdW5jdGlvbiAobWV0YSwgcHJvcGVydHkpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5NZXRhUHJvcGVydHk7XG4gICAgICAgICAgICB0aGlzLm1ldGEgPSBtZXRhO1xuICAgICAgICAgICAgdGhpcy5wcm9wZXJ0eSA9IHByb3BlcnR5O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaE5ld0V4cHJlc3Npb246IGZ1bmN0aW9uIChjYWxsZWUsIGFyZ3MpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5OZXdFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5jYWxsZWUgPSBjYWxsZWU7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50cyA9IGFyZ3M7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoT2JqZWN0RXhwcmVzc2lvbjogZnVuY3Rpb24gKHByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5PYmplY3RFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5wcm9wZXJ0aWVzID0gcHJvcGVydGllcztcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hPYmplY3RQYXR0ZXJuOiBmdW5jdGlvbiAocHJvcGVydGllcykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4Lk9iamVjdFBhdHRlcm47XG4gICAgICAgICAgICB0aGlzLnByb3Blcn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ZhbHVlO1xuICAgICAgICAgICAgdGhpcy5raW5kID0ga2luZDtcbiAgICAgICAgICAgIHRoaXMubWV0aG9kID0gbWV0aG9kO1xuICAgICAgICAgICAgdGhpcy5zaG9ydGhhbmQgPSBzaG9ydGhhbmQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoUmVzdEVsZW1lbnQ6IGZ1bmN0aW9uIChhcmd1bWVudCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlJlc3RFbGVtZW50O1xuICAgICAgICAgICAgdGhpcy5hcmd1bWVudCA9IGFyZ3VtZW50O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFJldHVyblN0YXRlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguUmV0dXJuU3RhdGVtZW50O1xuICAgICAgICAgICAgdGhpcy5hcmd1bWVudCA9IGFyZ3VtZW50O1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFNlcXVlbmNlRXhwcmVzc2lvbjogZnVuY3Rpb24gKGV4cHJlc3Npb25zKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguU2VxdWVuY2VFeHByZXNzaW9uO1xuICAgICAgICAgICAgdGhpcy5leHByZXNzaW9ucyA9IGV4cHJlc3Npb25zO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFNwcmVhZEVsZW1lbnQ6IGZ1bmN0aW9uICh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GVFeHByZXNzaW9uOiBmdW5jdGlvbiAodGFnLCBxdWFzaSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlRhZ2dlZFRlbXBsYXRlRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMudGFnID0gdGFnO1xuICAgICAgICAgICAgdGhpcy5xdWFzaSA9IHF1YXNpO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFRlbXBsYXRlRWxlbWVudDogZnVuY3Rpb24gKHZhbHVlLCB0YWlsKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVGVtcGxhdGVFbGVtZW50O1xuICAgICAgICAgICAgdGhpcy52YWx1ZSA9IHZhbHVlO1xuICAgICAgICAgICAgdGhpcy50YWlsID0gdGFpbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUZW1wbGF0ZUxpdGVyYWw6IGZ1bmN0aW9uIChxdWFzaXMsIGV4cHJlc3Npb25zKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVGVtcGxhdGVMaXRlcmFsO1xuICAgICAgICAgICAgdGhpcy5xdWFzaXMgPSBxdWFzaXM7XG4gICAgICAgICAgICB0aGlzLmV4cHJlc3Npb25zID0gZXhwcmVzc2lvbnM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVGhpc0V4cHJlc3Npb246IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5UaGlzRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hUaHJvd1N0YXRlbWVudDogZnVuY3Rpb24gKGFyZ3VtZW50KSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVGhyb3dTdGF0ZW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmFyZ3VtZW50ID0gYXJndW1lbnQ7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoVHJ5U3RhdGVtZW50OiBmdW5jdGlvbiAoYmxvY2ssIGhhbmRsZXIsIGZpbmFsaXplcikge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlRyeVN0YXRlbWVudDtcbiAgICAgICAgICAgIHRoaXMuYmxvY2sgPSBibG9jaztcbiAgICAgICAgICAgIHRoaXMuZ3VhcmRlZEhhbmRsZXJzID0gW107XG4gICAgICAgICAgICB0aGlzLmhhbmRsZXJzID0gaGFuZGxlciA/IFtoYW5kbGVyXSA6IFtdO1xuICAgICAgICAgICAgdGhpcy5oYW5kbGVyID0gaGFuZGxlcjtcbiAgICAgICAgICAgIHRoaXMuZmluYWxpemVyID0gZmluYWxpemVyO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFVuYXJ5RXhwcmVzc2lvbjogZnVuY3Rpb24gKG9wZXJhdG9yLCBhcmd1bWVudCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gKG9wZXJhdG9yID09PSAnKysnIHx8IG9wZXJhdG9yID09PSAnLS0nKSA/IFN5bnRheC5VcGRhdGVFeHByZXNzaW9uIDogU3ludGF4LlVuYXJ5RXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMub3BlcmF0b3IgPSBvcGVyYXRvcjtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMucHJlZml4ID0gdHJ1ZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hWYXJpYWJsZURlY2xhcmF0aW9uOiBmdW5jdGlvbiAoZGVjbGFyYXRpb25zKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVmFyaWFibGVEZWNsYXJhdGlvbjtcbiAgICAgICAgICAgIHRoaXMuZGVjbGFyYXRpb25zID0gZGVjbGFyYXRpb25zO1xuICAgICAgICAgICAgdGhpcy5raW5kID0gJ3Zhcic7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoTGV4aWNhbERlY2xhcmF0aW9uOiBmdW5jdGlvbiAoZGVjbGFyYXRpb25zLCBraW5kKSB7XG4gICAgICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguVmFyaWFibGVEZWNsYXJhdGlvbjtcbiAgICAgICAgICAgIHRoaXMuZGVjbGFyYXRpb25zID0gZGVjbGFyYXRpb25zO1xuICAgICAgICAgICAgdGhpcy5raW5kID0ga2luZDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hWYXJpYWJsZURlY2xhcmF0b3I6IGZ1bmN0aW9uIChpZCwgaW5pdCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LlZhcmlhYmxlRGVjbGFyYXRvcjtcbiAgICAgICAgICAgIHRoaXMuaWQgPSBpZDtcbiAgICAgICAgICAgIHRoaXMuaW5pdCA9IGluaXQ7XG4gICAgICAgICAgICB0aGlz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gICAgICAgICB0aGlzLnR5cGUgPSBTeW50YXguSW1wb3J0RGVmYXVsdFNwZWNpZmllcjtcbiAgICAgICAgICAgIHRoaXMubG9jYWwgPSBsb2NhbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJbXBvcnROYW1lc3BhY2VTcGVjaWZpZXI6IGZ1bmN0aW9uIChsb2NhbCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkltcG9ydE5hbWVzcGFjZVNwZWNpZmllcjtcbiAgICAgICAgICAgIHRoaXMubG9jYWwgPSBsb2NhbDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hFeHBvcnROYW1lZERlY2xhcmF0aW9uOiBmdW5jdGlvbiAoZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIHNyYykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkV4cG9ydE5hbWVkRGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9uID0gZGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLnNwZWNpZmllcnMgPSBzcGVjaWZpZXJzO1xuICAgICAgICAgICAgdGhpcy5zb3VyY2UgPSBzcmM7XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uOiBmdW5jdGlvbiAoZGVjbGFyYXRpb24pIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHBvcnREZWZhdWx0RGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmRlY2xhcmF0aW9uID0gZGVjbGFyYXRpb247XG4gICAgICAgICAgICB0aGlzLmZpbmlzaCgpO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH0sXG5cbiAgICAgICAgZmluaXNoRXhwb3J0QWxsRGVjbGFyYXRpb246IGZ1bmN0aW9uIChzcmMpIHtcbiAgICAgICAgICAgIHRoaXMudHlwZSA9IFN5bnRheC5FeHBvcnRBbGxEZWNsYXJhdGlvbjtcbiAgICAgICAgICAgIHRoaXMuc291cmNlID0gc3JjO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaEltcG9ydFNwZWNpZmllcjogZnVuY3Rpb24gKGxvY2FsLCBpbXBvcnRlZCkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkltcG9ydFNwZWNpZmllcjtcbiAgICAgICAgICAgIHRoaXMubG9jYWwgPSBsb2NhbCB8fCBpbXBvcnRlZDtcbiAgICAgICAgICAgIHRoaXMuaW1wb3J0ZWQgPSBpbXBvcnRlZDtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfSxcblxuICAgICAgICBmaW5pc2hJbXBvcnREZWNsYXJhdGlvbjogZnVuY3Rpb24gKHNwZWNpZmllcnMsIHNyYykge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LkltcG9ydERlY2xhcmF0aW9uO1xuICAgICAgICAgICAgdGhpcy5zcGVjaWZpZXJzID0gc3BlY2lmaWVycztcbiAgICAgICAgICAgIHRoaXMuc291cmNlID0gc3JjO1xuICAgICAgICAgICAgdGhpcy5maW5pc2goKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xuICAgICAgICB9LFxuXG4gICAgICAgIGZpbmlzaFlpZWxkRXhwcmVzc2lvbjogZnVuY3Rpb24gKGFyZ3VtZW50LCBkZWxlZ2F0ZSkge1xuICAgICAgICAgICAgdGhpcy50eXBlID0gU3ludGF4LllpZWxkRXhwcmVzc2lvbjtcbiAgICAgICAgICAgIHRoaXMuYXJndW1lbnQgPSBhcmd1bWVudDtcbiAgICAgICAgICAgIHRoaXMuZGVsZWdhdGUgPSBkZWxlZ2F0ZTtcbiAgICAgICAgICAgIHRoaXMuZmluaXNoKCk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgfVxuICAgIH07XG5cblxuICAgIGZ1bmN0aW9uIHJlY29yZEVycm9yKGVycm9yKSB7XG4gICAgICAgIHZhciBlLCBleGlzdGluZztcblxuICAgICAgICBmb3IgKGUgPSAwOyBlIDwgZXh0cmEuZXJyb3JzLmxlbmd0aDsgZSsrKSB7XG4gICAgICAgICAgICBleGlzdGluZyA9IGV4dHJhLmVycm9yc1tlXTtcbiAgICAgICAgICAgIC8vIFByZXZlbnQgZHVwbGljYXRlZCBlcnJvci5cbiAgICAgICAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovXG4gICAgICAgICAgICBpZiAoZXhpc3RpbmcuaW5kZXggPT09IGVycm9yLmluZGV4ICYmIGV4aXN0aW5nLm1lc3NhZ2UgPT09IGVycm9yLm1lc3NhZ2UpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHRyYS5lcnJvcnMucHVzaChlcnJvcik7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY29uc3RydWN0RXJyb3IobXNnLCBjb2x1bW4pIHtcbiAgICAgICAgdmFyIGVycm9yID0gbmV3IEVycm9yKG1zZyk7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICB0aHJvdyBlcnJvcjtcbiAgICAgICAgfSBjYXRjaCAoYmFzZSkge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIGVsc2UgKi9cbiAgICAgICAgICAgIGlmIChPYmplY3QuY3JlYXRl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BhbiBleGNlcHRpb24gYmVjYXVzZSBvZiB0aGUgdG9rZW4uXG5cbiAgICBmdW5jdGlvbiB1bmV4cGVjdGVkVG9rZW5FcnJvcih0b2tlbiwgbWVzc2FnZSkge1xuICAgICAgICB2YXIgdmFsdWUsIG1zZyA9IG1lc3NhZ2UgfHwgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgIGlmICh0b2tlbikge1xuICAgICAgICAgICAgaWYgKCFtZXNzYWdlKSB7XG4gICAgICAgICAgICAgICAgbXNnID0gKHRva2VuLnR5cGUgPT09IFRva2VuLkVPRikgPyBNZXNzYWdlcy5VbmV4cGVjdGVkRU9TIDpcbiAgICAgICAgICAgICAgICAgICAgKHRva2VuLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIpID8gTWVzc2FnZXMuVW5leHBlY3RlZElkZW50aWZpZXIgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uTnVtZXJpY0xpdGVyYWwpID8gTWVzc2FnZXMuVW5leHBlY3RlZE51bWJlciA6XG4gICAgICAgICAgICAgICAgICAgICh0b2tlbi50eXBlID09PSBUb2tlbi5TdHJpbmdMaXRlcmFsKSA/IE1lc3NhZ2VzLlVuZXhwZWN0ZWRTdHJpbmcgOlxuICAgICAgICAgICAgICAgICAgICAodG9rZW4udHlwZSA9PT0gVG9rZW4uVGVtcGxhdGUpID8gTWVzc2FnZXMuVW5leHBlY3RlZFRlbXBsYXRlIDpcbiAgICAgICAgICAgICAgICAgICAgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRva2VuLnR5cGUgPT09IFRva2VuLktleXdvcmQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzRnV0dXJlUmVzZXJ2ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbXNnID0gTWVzc2FnZXMuVW5leHBlY3RlZFJ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ICAgICAgICAgb3AgPT09ICcvPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnJT0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJys9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICctPScgfHxcbiAgICAgICAgICAgIG9wID09PSAnPDw9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICc+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJz4+Pj0nIHx8XG4gICAgICAgICAgICBvcCA9PT0gJyY9JyB8fFxuICAgICAgICAgICAgb3AgPT09ICdePScgfHxcbiAgICAgICAgICAgIG9wID09PSAnfD0nO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNvbnN1bWVTZW1pY29sb24oKSB7XG4gICAgICAgIC8vIENhdGNoIHRoZSB2ZXJ5IGNvbW1vbiBjYXNlIGZpcnN0OiBpbW1lZGlhdGVseSBhIHNlbWljb2xvbiAoVSswMDNCKS5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCIHx8IG1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBGSVhNRShpa2FyaWVuYXRvcik6IHRoaXMgaXMgc2VlbWluZ2x5IGFuIGlzc3VlIGluIHRoZSBwcmV2aW91cyBsb2NhdGlvbiBpbmZvIGNvbnZlbnRpb24uXG4gICAgICAgIGxhc3RJbmRleCA9IHN0YXJ0SW5kZXg7XG4gICAgICAgIGxhc3RMaW5lTnVtYmVyID0gc3RhcnRMaW5lTnVtYmVyO1xuICAgICAgICBsYXN0TGluZVN0YXJ0ID0gc3RhcnRMaW5lU3RhcnQ7XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBUb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ubWVudFRhcmdldDtcbiAgICAgICAgZmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yID0gb2xkRmlyc3RDb3ZlckluaXRpYWxpemVkTmFtZUVycm9yIHx8IGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvcjtcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxMy4zLjMgRGVzdHJ1Y3R1cmluZyBCaW5kaW5nIFBhdHRlcm5zXG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycmF5UGF0dGVybihwYXJhbXMsIGtpbmQpIHtcbiAgICAgICAgdmFyIG5vZGUgPSBuZXcgTm9kZSgpLCBlbGVtZW50cyA9IFtdLCByZXN0LCByZXN0Tm9kZTtcbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgd2hpbGUgKCFtYXRjaCgnXScpKSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgIGVsZW1lbnRzLnB1c2gobnVsbCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLi4uJykpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdE5vZGUgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zLnB1c2gobG9va2FoZWFkKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzdCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKGtpbmQpO1xuICAgICAgICAgICAgICAgICAgICBlbGVtZW50cy5wdXNoKHJlc3ROb2RlLmZpbmlzaFJlc3RFbGVtZW50KHJlc3QpKTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChwYXJzZVBhdHRlcm5XaXRoRGVmYXVsdChwYXJhbXMsIGtpbmQpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnXScpKSB7XG4gICAgICAgICAgICAgICAgICAgIGV4cGVjdCgnLCcpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCddJyk7XG5cbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQXJyYXlQYXR0ZXJuKGVsZW1lbnRzKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZVByb3BlcnR5UGF0dGVybihwYXJhbXMsIGtpbmQpIHtcbiAgICAgICAgdmFyIG5vZGUgPSBuZXcgTm9kZSgpLCBrZXksIGtleVRva2VuLCBjb21wdXRlZCA9IG1hdGNoKCdbJyksIGluaXQ7XG4gICAgICAgIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllcikge1xuICAgICAgICAgICAga2V5VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICBrZXkgPSBwYXJzZVZhcmlhYmxlSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKG1hdGNoKCc9JykpIHtcbiAgICAgICAgICAgICAgICBwYXJhbXMucHVzaChrZXlUb2tlbik7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgaW5pdCA9IHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24oKTtcblxuICAgICAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaFByb3BlcnR5KFxuICAgICAgICAgICAgICAgICAgICAnaW5pdCcsIGtleSwgZmFsc2UsXG4gICAgICAgICAgICAgICAgICAgIG5ldyBXcmFwcGluZ05vZGUoa2V5VG9rZW4pLmZpbmlzaEFzc2lnbm1lbnRQYXR0ZXJuKGtleSwgaW5pdCksIGZhbHN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Fzc2lnbm1lbnRFeHByZXNzaW9uKTtcbiAgICAgICAgICAgIHN0YXRlLmFsbG93WWllbGQgPSBwcmV2aW91c0FsbG93WWllbGQ7XG4gICAgICAgICAgICBwYXR0ZXJuID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hBc3NpZ25tZW50UGF0dGVybihwYXR0ZXJuLCByaWdodCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHBhdHRlcm47XG4gICAgfVxuXG4gICAgLy8gRUNNQS0yNjIgMTIuMi41IEFycmF5IEluaXRpYWxpemVyXG5cbiAgICBmdW5jdGlvbiBwYXJzZUFycmF5SW5pdGlhbGl6ZXIoKSB7XG4gICAgICAgIHZhciBlbGVtZW50cyA9IFtdLCBub2RlID0gbmV3IE5vZGUoKSwgcmVzdFNwcmVhZDtcblxuICAgICAgICBleHBlY3QoJ1snKTtcblxuICAgICAgICB3aGlsZSAoIW1hdGNoKCddJykpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgZWxlbWVudHMucHVzaChudWxsKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJy4uLicpKSB7XG4gICAgICAgICAgICAgICAgcmVzdFNwcmVhZCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgcmVzdFNwcmVhZC5maW5pc2hTcHJlYWRFbGVtZW50KGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuXG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnXScpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCcsJyk7XG4gICAgICA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IC8vIEluIG9yZGVyIHRvIGF2b2lkIGJhY2sgdHJhY2tpbmcsIGl0IHJldHVybnMgYG51bGxgIGlmIHRoZSBwb3NpdGlvbiBpcyBub3QgYSBNZXRob2REZWZpbml0aW9uIGFuZCB0aGUgY2FsbGVyXG4gICAgLy8gaXMgcmVzcG9uc2libGUgdG8gdmlzaXQgb3RoZXIgb3B0aW9ucy5cbiAgICBmdW5jdGlvbiB0cnlQYXJzZU1ldGhvZERlZmluaXRpb24odG9rZW4sIGtleSwgY29tcHV0ZWQsIG5vZGUpIHtcbiAgICAgICAgdmFyIHZhbHVlLCBvcHRpb25zLCBtZXRob2ROb2RlLCBwYXJhbXMsXG4gICAgICAgICAgICBwcmV2aW91c0FsbG93WWllbGQgPSBzdGF0ZS5hbGxvd1lpZWxkO1xuXG4gICAgICAgIGlmICh0b2tlbi50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICAvLyBjaGVjayBmb3IgYGdldGAgYW5kIGBzZXRgO1xuXG4gICAgICAgICAgICBpZiAodG9rZW4udmFsdWUgPT09ICdnZXQnICYmIGxvb2thaGVhZFByb3BlcnR5TmFtZSgpKSB7XG4gICAgICAgICAgICAgICAgY29tcHV0ZWQgPSBtYXRjaCgnWycpO1xuICAgICAgICAgICAgICAgIGtleSA9IHBhcnNlT2JqZWN0UHJvcGVydHlLZXkoKTtcbiAgICAgICAgICAgICAgICBtZXRob2ROb2RlID0gbmV3IE5vZGUoKTtcbiAgICAgICAgICAgICAgICBleHBlY3QoJygnKTtcbiAgICAgICAgICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93WWllbGQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHBhcnNlUHJvcGVydHlGdW5jdGlvbihtZXRob2ROb2RlLCB7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtczogW10sXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHRzOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgc3RyaWN0ZWQ6IG51bGwsXG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZDogbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogbnVsbFxuICAgICAgICAgICAgICAgIH0sIGZhbHNlKTtcbiAgICAgICAgICAgICAgICBzdGF0ZS5hbGxvd1lpZWxkID0gcHJldmlvdXNBbGxvd1lpZWxkO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvcGVydHkoJ2dldCcsIGtleSwgY29tcHV0ZWQsIHZhbHVlLCBmYWxzZSwgZmFsc2UpO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0b2tlbi52YWx1ZSA9PT0gJ3NldCcgJiYgbG9va2FoZWFkUHJvcGVydHlOYW1lKCkpIHtcbiAgICAgICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICAgICAga2V5ID0gcGFyc2VPYmplY3RQcm9wZXJ0eUtleSgpO1xuICAgICAgICAgICAgICAgIG1ldGhvZE5vZGUgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgIGV4cGVjdCgnKCcpO1xuXG4gICAgICAgICAgICAgICAgb3B0aW9ucyA9IHtcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvdW50OiAwLFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0czogW10sXG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZDogbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgcGFyYW1TZXQ6IHt9XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2goJyknKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93WWllbGQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VQYXJhbShvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dZaWVsZCA9IHByZXZpb3VzQWxsb3dZaWVsZDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG9wdGlvbnMuZGVmYXVsdENvdW50ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zLmRlZmF1bHRzID0gW107XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgICAgICAgICBzdGF0ZS5hbGxvd1lpZWxkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSBwYXJzZVByb3BlcnR5RnVuY3Rpb24obWV0aG9kTm9kZSwgb3B0aW9ucywgZmFsc2UpO1xuICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93WWllbGQgPSBwcmV2aW91c0FsbG93WWllbGQ7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hQcm9wZXJ0eSgnc2V0Jywga2V5LCBjb21wdXRlZCwgdmFsdWUsIGZhbHNlLCBmYWxzZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAodG9rZW4udHlwZSA9PT0gVG9rZW4uUHVuY3R1YXRvciAmJiB0b2tlbi52YWx1ZSA9PT0gJyonICYmIGxvb2thaGVhZFByb3BlcnR5TmFtZSgpKSB7XG4gICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICBtZXRob2ROb2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICAgICAgc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TtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGtleSA9IHBhcnNlT2JqZWN0UHJvcGVydHlLZXkoKTtcbiAgICAgICAgfVxuICAgICAgICBtYXliZU1ldGhvZCA9IHRyeVBhcnNlTWV0aG9kRGVmaW5pdGlvbih0b2tlbiwga2V5LCBjb21wdXRlZCwgbm9kZSk7XG4gICAgICAgIGlmIChtYXliZU1ldGhvZCkge1xuICAgICAgICAgICAgcmV0dXJuIG1heWJlTWV0aG9kO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFrZXkpIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBDaGVjayBmb3IgZHVwbGljYXRlZCBfX3Byb3RvX19cbiAgICAgICAgaWYgKCFjb21wdXRlZCkge1xuICAgICAgICAgICAgcHJvdG8gPSAoa2V5LnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGtleS5uYW1lID09PSAnX19wcm90b19fJykgfHxcbiAgICAgICAgICAgICAgICAoa2V5LnR5cGUgPT09IFN5bnRheC5MaXRlcmFsICYmIGtleS52YWx1ZSA9PT0gJ19fcHJvdG9fXycpO1xuICAgICAgICAgICAgaWYgKGhhc1Byb3RvLnZhbHVlICYmIHByb3RvKSB7XG4gICAgICAgICAgICAgICAgdG9sZXJhdGVFcnJvcihNZXNzYWdlcy5EdXBsaWNhdGVQcm90b1Byb3BlcnR5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGhhc1Byb3RvLnZhbHVlIHw9IHByb3RvO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG1hdGNoKCc6JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgdmFsdWUgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmlua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plY3RQcm9wZXJ0eShoYXNQcm90bykpO1xuXG4gICAgICAgICAgICBpZiAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBleHBlY3RDb21tYVNlcGFyYXRvcigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCd9Jyk7XG5cbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoT2JqZWN0RXhwcmVzc2lvbihwcm9wZXJ0aWVzKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwcikge1xuICAgICAgICB2YXIgaTtcbiAgICAgICAgc3dpdGNoIChleHByLnR5cGUpIHtcbiAgICAgICAgY2FzZSBTeW50YXguSWRlbnRpZmllcjpcbiAgICAgICAgY2FzZSBTeW50YXguTWVtYmVyRXhwcmVzc2lvbjpcbiAgICAgICAgY2FzZSBTeW50YXguUmVzdEVsZW1lbnQ6XG4gICAgICAgIGNhc2UgU3ludGF4LkFzc2lnbm1lbnRQYXR0ZXJuOlxuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGNhc2UgU3ludGF4LlNwcmVhZEVsZW1lbnQ6XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguUmVzdEVsZW1lbnQ7XG4gICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5hcmd1bWVudCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguQXJyYXlFeHByZXNzaW9uOlxuICAgICAgICAgICAgZXhwci50eXBlID0gU3ludGF4LkFycmF5UGF0dGVybjtcbiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHByLmVsZW1lbnRzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKGV4cHIuZWxlbWVudHNbaV0gIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIuZWxlbWVudHNbaV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5PYmplY3RFeHByZXNzaW9uOlxuICAgICAgICAgICAgZXhwci50eXBlID0gU3ludGF4Lk9iamVjdFBhdHRlcm47XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZXhwci5wcm9wZXJ0aWVzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIucHJvcGVydGllc1tpXS52YWx1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguQXNzaWdubWVudEV4cHJlc3Npb246XG4gICAgICAgICAgICBleHByLnR5cGUgPSBTeW50YXguQXNzaWdubWVudFBhdHRlcm47XG4gICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5sZWZ0KTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgLy8gQWxsb3cgb3RoZXIgbm9kZSB0eXBlIGZvciB0b2xlcmFudCBwYXJzaW5nLlxuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxMi4yLjkgVGVtcGxhdGUgTGl0ZXJhbHNcblxuICAgIGZ1bmN0aW9uIHBhcnNlVGVtcGxhdGVFbGVtZW50KG9wdGlvbikge1xuICAgICAgICB2YXIgbm9kZSwgdG9rZW47XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5UZW1wbGF0ZSB8fCAob3B0aW9uLmhlYWQgJiYgIWxvb2thaGVhZC5oZWFkKSkge1xuICAgICAg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LCBwYXJhbXMgPSBbXTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBpZiAobWF0Y2goJyknKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCc9PicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcixcbiAgICAgICAgICAgICAgICBwYXJhbXM6IFtdLFxuICAgICAgICAgICAgICAgIHJhd1BhcmFtczogW11cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICBzdGFydFRva2VuID0gbG9va2FoZWFkO1xuICAgICAgICBpZiAobWF0Y2goJy4uLicpKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VSZXN0RWxlbWVudChwYXJhbXMpO1xuICAgICAgICAgICAgZXhwZWN0KCcpJyk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCc9PicpKSB7XG4gICAgICAgICAgICAgICAgZXhwZWN0KCc9PicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcixcbiAgICAgICAgICAgICAgICBwYXJhbXM6IFtleHByXVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSB0cnVlO1xuICAgICAgICBleHByID0gaW5oZXJpdENvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKTtcblxuICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gZmFsc2U7XG4gICAgICAgICAgICBleHByZXNzaW9ucyA9IFtleHByXTtcblxuICAgICAgICAgICAgd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBpZiAoIW1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGxleCgpO1xuXG4gICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcuLi4nKSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIWlzQmluZGluZ0VsZW1lbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChwYXJzZVJlc3RFbGVtZW50KHBhcmFtcykpO1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJyknKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnPT4nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0KCc9PicpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cHJlc3Npb25zLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwcmVzc2lvbnNbaV0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBQbGFjZUhvbGRlcnMuQXJyb3dQYXJhbWV0ZXJQbGFjZUhvbGRlcixcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtczogZXhwcmVzc2lvbnNcbiAgICAgICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBleHByZXNzaW9ucy5wdXNoKGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hTZXF1ZW5jZUV4cHJlc3Npb24oZXhwcmVzc2lvbnMpO1xuICAgICAgICB9XG5cblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICBpZiAobWF0Y2goJz0+JykpIHtcbiAgICAgICAgICAgIGlmIChleHByLnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyICYmIGV4cHIubmFtZSA9PT0gJ3lpZWxkJykge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IFBsYWNlSG9sZGVycy5BcnJvd1BhcmFtZXRlclBsYWNlSG9sZGVyLFxuICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IFtleHByXVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghaXNCaW5kaW5nRWxlbWVudCkge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChleHByLnR5cGUgPT09IFN5bnRheC5TZXF1ZW5jZUV4cHJlc3Npb24pIHtcbiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZXhwci5leHByZXNzaW9ucy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwci5leHByZXNzaW9uc1tpXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oZXhwcik7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGV4cHIgPSB7XG4gICAgICAgICAgICAgICAgdHlwZTogUGxhY2VIb2xkZXJzLkFycm93UGFyYW1ldGVyUGxhY2VIb2xkZXIsXG4gICAgICAgICAgICAgICAgcGFyYW1zOiBleHByLnR5cGUgPT09IFN5bnRheC5TZXF1ZW5jZUV4cHJlc3Npb24gPyBleHByLmV4cHJlc3Npb25zIDogW2V4cHJdXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgcmV0dXJuIGV4cHI7XG4gICAgfVxuXG5cbiAgICAvLyBFQ01BLTI2MiAxMi4yIFByaW1hcnkgRXhwcmVzc2lvbnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlUHJpbWFyeUV4cHJlc3Npb24oKSB7XG4gICAgICAgIHZhciB0eXBlLCB0b2tlbiwgZXhwciwgbm9kZTtcblxuICAgICAgICBpZiAobWF0Y2goJygnKSkge1xuICAgICAgICAgICAgaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgcmV0dXJuIGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VHcm91cEV4cHJlc3Npb24pO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG1hdGNoKCdbJykpIHtcbiAgICAgICAgICAgIHJldHVybiBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXJyYXlJbml0aWFsaXplcik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobWF0Y2goJ3snKSkge1xuICAgICAgICAgICAgcmV0dXJuIGluaGVyaXRDb3ZlckdyYW1tYXIocGFyc2VPYmplY3RJbml0aWFsaXplcik7XG4gICAgICAgIH1cblxuICAgICAgICB0eXBlID0gbG9va2FoZWFkLnR5cGU7XG4gICAg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7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoSWRlbnRpZmllcihsZXgoKS52YWx1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdmdW5jdGlvbicpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRnVuY3Rpb25FeHByZXNzaW9uKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCd0aGlzJykpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hUaGlzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG1hdGNoS2V5d29yZCgnY2xhc3MnKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUNsYXNzRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obGV4KCkpO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLkJvb2xlYW5MaXRlcmFsKSB7XG4gICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgdG9rZW4udmFsdWUgPSAodG9rZW4udmFsdWUgPT09ICd0cnVlJyk7XG4gICAgICAgICAgICBleHByID0gbm9kZS5maW5pc2hMaXRlcmFsKHRva2VuKTtcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlID09PSBUb2tlbi5OdWxsTGl0ZXJhbCkge1xuICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgdG9rZW4gPSBsZXgoKTtcbiAgICAgICAgICAgIHRva2VuLnZhbHVlID0gbnVsbDtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcvJykgfHwgbWF0Y2goJy89JykpIHtcbiAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgIGluZGV4ID0gc3RhcnRJbmRleDtcblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS50b2tlbnMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBjb2xsZWN0UmVnZXgoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBzY2FuUmVnRXhwKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIGV4cHIgPSBub2RlLmZpbmlzaExpdGVyYWwodG9rZW4pO1xuICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFRva2VuLlRlbXBsYXRlKSB7XG4gICAgICAgICAgICBleHByID0gcGFyc2VUZW1wbGF0ZUxpdGVyYWwoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxleCgpKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuICAgIC8vIEVDTUEtMjYyIDEyLjMgTGVmdC1IYW5kLVNpZGUgRXhwcmVzc2lvbnNcblxuICAgIGZ1bmN0aW9uIHBhcnNlQXJndW1lbnRzKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdLCBleHByO1xuXG4gICAgICAgIGV4cGVjdCgnKCcpO1xuXG4gICAgICAgIGlmICghbWF0Y2goJyknKSkge1xuICAgICAgICAgICAgd2hpbGUgKHN0YXJ0SW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2goJy4uLicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGV4cHIgPSBuZXcgTm9kZSgpO1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgZXhwci5maW5pc2hTcHJlYWRFbGVtZW50KGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbikpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGV4cHIgPSBpc29sYXRlQ292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBhcmdzLnB1c2goZXhwcik7XG4gICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcpJykpIHtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGV4cGVjdENvbW1hU2VwYXJhdG9yKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICByZXR1cm4gYXJncztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkUHJvcGVydHkoKSB7XG4gICAgICAgIHZhciB0b2tlbiwgbm9kZSA9IG5ldyBOb2RlKCk7XG5cbiAgICAgICAgdG9rZW4gPSBsZXgoKTtcblxuICAgICAgICBpZiAoIWlzSWRlbnRpZmllck5hbWUodG9rZW4pKSB7XG4gICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbik7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hJZGVudGlmaWVyKHRva2VuLnZhbHVlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCkge1xuICAgICAgICBleHBlY3QoJy4nKTtcblxuICAgICAgICByZXR1cm4gcGFyc2VOb25Db21wdXRlZFByb3BlcnR5KCk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb21wdXRlZE1lbWJlcigpIHtcbiAgICAgICAgdmFyIGV4cHI7XG5cbiAgICAgICAgZXhwZWN0KCdbJyk7XG5cbiAgICAgICAgZXhwciA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VFeHByZXNzaW9uKTtcblxuICAgICAgICBleHBlY3QoJ10nKTtcblxuICAgICAgICByZXR1cm4gZXhwcjtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxMi4zLjMgVGhlIG5ldyBPcGVyYXRvclxuXG4gICAgZnVuY3Rpb24gcGFyc2VOZXdFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgY2FsbGVlLCBhcmdzLCBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCduZXcnKTtcblxuICAgICAgICBpZiAobWF0Y2goJy4nKSkge1xuICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLklkZW50aWZpZXIgJiYgbG9va2FoZWFkLnZhbHVlID09PSAndGFyZ2V0Jykge1xuICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5pbkZ1bmN0aW9uQm9keSkge1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoTWV0YVByb3BlcnR5KCduZXcnLCAndGFyZ2V0Jyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtc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VyR3JhbW1hcihtYXRjaEtleXdvcmQoJ25ldycpID8gcGFyc2VOZXdFeHByZXNzaW9uIDogcGFyc2VQcmltYXJ5RXhwcmVzc2lvbik7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKDs7KSB7XG4gICAgICAgICAgICBpZiAobWF0Y2goJy4nKSkge1xuICAgICAgICAgICAgICAgIGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIHByb3BlcnR5ID0gcGFyc2VOb25Db21wdXRlZE1lbWJlcigpO1xuICAgICAgICAgICAgICAgIGV4cHIgPSBuZXcgV3JhcHBpbmdOb2RlKHN0YXJ0VG9rZW4pLmZpbmlzaE1lbWJlckV4cHJlc3Npb24oJy4nLCBleHByLCBwcm9wZXJ0eSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcoJykpIHtcbiAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgYXJncyA9IHBhcnNlQXJndW1lbnRzKCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoQ2FsbEV4cHJlc3Npb24oZXhwciwgYXJncyk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCdbJykpIHtcbiAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0eSA9IHBhcnNlQ29tcHV0ZWRNZW1iZXIoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW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IgPSBleHByLmZpbmlzaFN1cGVyKCk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCdbJykgJiYgIW1hdGNoKCcuJykpIHtcbiAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbihsb29rYWhlYWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgZXhwciA9IGluaGVyaXRDb3ZlckdyYW1tYXIobWF0Y2hLZXl3b3JkKCduZXcnKSA/IHBhcnNlTmV3RXhwcmVzc2lvbiA6IHBhcnNlUHJpbWFyeUV4cHJlc3Npb24pO1xuICAgICAgICB9XG5cbiAgICAgICAgZm9yICg7Oykge1xuICAgICAgICAgICAgaWYgKG1hdGNoKCdbJykpIHtcbiAgICAgICAgICAgICAgICBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgaXNBc3NpZ25tZW50VGFyZ2V0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBwcm9wZXJ0eSA9IHBhcnNlQ29tcHV0ZWRNZW1iZXIoKTtcbiAgICAgICAgICAgICAgICBleHByID0gbmV3IFdyYXBwaW5nTm9kZShzdGFydFRva2VuKS5maW5pc2hNZW1iZXJFeHByZXNzaW9uKCdbJywgZXhwciwgcHJvcGVydHkpO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChtYXRjaCgnLicpKSB7XG4gICAgICAgICAgICAgICAgaXNCaW5kaW5nRWxlbWVudCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IHRydWU7XG4gICAgICAgICAgICAgICAgcHJvcGVydHkgPSBwYXJzZU5vbkNvbXB1dGVkTWVtYmVyKCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoTWVtYmVyRXhwcmVzc2lvbignLicsIGV4cHIsIHByb3BlcnR5KTtcbiAgICAgICAgICAgIH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V0dXJuIDA7XG4gICAgICAgIH1cblxuICAgICAgICBzd2l0Y2ggKHRva2VuLnZhbHVlKSB7XG4gICAgICAgIGNhc2UgJ3x8JzpcbiAgICAgICAgICAgIHByZWMgPSAxO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnJiYnOlxuICAgICAgICAgICAgcHJlYyA9IDI7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICd8JzpcbiAgICAgICAgICAgIHByZWMgPSAzO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnXic6XG4gICAgICAgICAgICBwcmVjID0gNDtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJyYnOlxuICAgICAgICAgICAgcHJlYyA9IDU7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICc9PSc6XG4gICAgICAgIGNhc2UgJyE9JzpcbiAgICAgICAgY2FzZSAnPT09JzpcbiAgICAgICAgY2FzZSAnIT09JzpcbiAgICAgICAgICAgIHByZWMgPSA2O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnPCc6XG4gICAgICAgIGNhc2UgJz4nOlxuICAgICAgICBjYXNlICc8PSc6XG4gICAgICAgIGNhc2UgJz49JzpcbiAgICAgICAgY2FzZSAnaW5zdGFuY2VvZic6XG4gICAgICAgICAgICBwcmVjID0gNztcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ2luJzpcbiAgICAgICAgICAgIHByZWMgPSBhbGxvd0luID8gNyA6IDA7XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICc8PCc6XG4gICAgICAgIGNhc2UgJz4+JzpcbiAgICAgICAgY2FzZSAnPj4+JzpcbiAgICAgICAgICAgIHByZWMgPSA4O1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSAnKyc6XG4gICAgICAgIGNhc2UgJy0n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h0b2tlbiwgc3RhdGUuYWxsb3dJbik7XG4gICAgICAgIGlmIChwcmVjID09PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gbGVmdDtcbiAgICAgICAgfVxuICAgICAgICBpc0Fzc2lnbm1lbnRUYXJnZXQgPSBpc0JpbmRpbmdFbGVtZW50ID0gZmFsc2U7XG4gICAgICAgIHRva2VuLnByZWMgPSBwcmVjO1xuICAgICAgICBsZXgoKTtcblxuICAgICAgICBtYXJrZXJzID0gW21hcmtlciwgbG9va2FoZWFkXTtcbiAgICAgICAgcmlnaHQgPSBpc29sYXRlQ292ZXJHcmFtbWFyKHBhcnNlVW5hcnlFeHByZXNzaW9uKTtcblxuICAgICAgICBzdGFjayA9IFtsZWZ0LCB0b2tlbiwgcmlnaHRdO1xuXG4gICAgICAgIHdoaWxlICgocHJlYyA9IGJpbmFyeVByZWNlZGVuY2UobG9va2FoZWFkLCBzdGF0ZS5hbGxvd0luKSkgPiAwKSB7XG5cbiAgICAgICAgICAgIC8vIFJlZHVjZTogbWFrZSBhIGJpbmFyeSBleHByZXNzaW9uIGZyb20gdGhlIHRocmVlIHRvcG1vc3QgZW50cmllcy5cbiAgICAgICAgICAgIHdoaWxlICgoc3RhY2subGVuZ3RoID4gMikgJiYgKHByZWMgPD0gc3RhY2tbc3RhY2subGVuZ3RoIC0gMl0ucHJlYykpIHtcbiAgICAgICAgICAgICAgICByaWdodCA9IHN0YWNrLnBvcCgpO1xuICAgICAgICAgICAgICAgIG9wZXJhdG9yID0gc3RhY2sucG9wKCkudmFsdWU7XG4gICAgICAgICAgICAgICAgbGVmdCA9IHN0YWNrLnBvcCgpO1xuICAgICAgICAgICAgICAgIG1hcmtlcnMucG9wKCk7XG4gICAgICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUobWFya2Vyc1ttYXJrZXJzLmxlbmd0aCAtIDFdKS5maW5pc2hCaW5hcnlFeHByZXNzaW9uKG9wZXJhdG9yLCBsZWZ0LCByaWdodCk7XG4gICAgICAgICAgICAgICAgc3RhY2sucHVzaChleHByKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gU2hpZnQuXG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgdG9rZW4ucHJlYyA9IHByZWM7XG4gICAgICAgICAgICBzdGFjay5wdXNoKHRva2VuKTtcbiAgICAgICAgICAgIG1hcmtlcnMucHVzaChsb29rYWhlYWQpO1xuICAgICAgICAgICAgZXhwciA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VVbmFyeUV4cHJlc3Npb24pO1xuICAgICAgICAgICAgc3RhY2sucHVzaChleHByKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEZpbmFsIHJlZHVjZSB0byBjbGVhbi11cCB0aGUgc3RhY2suXG4gICAgICAgIGkgPSBzdGFjay5sZW5ndGggLSAxO1xuICAgICAgICBleHByID0gc3RhY2tbaV07XG4gICAgICAgIG1hcmtlcnMucG9wKCk7XG4gICAgICAgIHdoaWxlIChpID4gMSkge1xuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUobWFya2Vycy5wb3AoKSkuZmluaXNoQmluYXJ5RXhwcmVzc2lvbihzdGFja1tpIC0gMV0udmFsdWUsIHN0YWNrW2kgLSAyXSwgZXhwcik7XG4gICAgICAgICAgICBpIC09IDI7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZXhwcjtcbiAgICB9XG5cblxuICAgIC8vIEVDTUEtMjYyIDEyLjEzIENvbmRpdGlvbmFsIE9wZXJhdG9yXG5cbiAgICBmdW5jdGlvbiBwYXJzZUNvbmRpdGlvbmFsRXhwcmVzc2lvbigpIHtcbiAgICAgICAgdmFyIGV4cHIsIHByZXZpb3VzQWxsb3dJbiwgY29uc2VxdWVudCwgYWx0ZXJuYXRlLCBzdGFydFRva2VuO1xuXG4gICAgICAgIHN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG5cbiAgICAgICAgZ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lvbik7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0pIHtcbiAgICAgICAgdmFyIGk7XG4gICAgICAgIHN3aXRjaCAocGFyYW0udHlwZSkge1xuICAgICAgICBjYXNlIFN5bnRheC5JZGVudGlmaWVyOlxuICAgICAgICAgICAgdmFsaWRhdGVQYXJhbShvcHRpb25zLCBwYXJhbSwgcGFyYW0ubmFtZSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguUmVzdEVsZW1lbnQ6XG4gICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbS5hcmd1bWVudCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSBTeW50YXguQXNzaWdubWVudFBhdHRlcm46XG4gICAgICAgICAgICBjaGVja1BhdHRlcm5QYXJhbShvcHRpb25zLCBwYXJhbS5sZWZ0KTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5BcnJheVBhdHRlcm46XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgcGFyYW0uZWxlbWVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAocGFyYW0uZWxlbWVudHNbaV0gIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0uZWxlbWVudHNbaV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFN5bnRheC5ZaWVsZEV4cHJlc3Npb246XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGFzc2VydChwYXJhbS50eXBlID09PSBTeW50YXguT2JqZWN0UGF0dGVybiwgJ0ludmFsaWQgdHlwZScpO1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ICBjYXNlIFN5bnRheC5Bc3NpZ25tZW50UGF0dGVybjpcbiAgICAgICAgICAgICAgICBwYXJhbXNbaV0gPSBwYXJhbS5sZWZ0O1xuICAgICAgICAgICAgICAgIGlmIChwYXJhbS5yaWdodC50eXBlID09PSBTeW50YXguWWllbGRFeHByZXNzaW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbS5yaWdodC5hcmd1bWVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4obG9va2FoZWFkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBwYXJhbS5yaWdodC50eXBlID0gU3ludGF4LklkZW50aWZpZXI7XG4gICAgICAgICAgICAgICAgICAgIHBhcmFtLnJpZ2h0Lm5hbWUgPSAneWllbGQnO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgcGFyYW0ucmlnaHQuYXJndW1lbnQ7XG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBwYXJhbS5yaWdodC5kZWxlZ2F0ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZGVmYXVsdHMucHVzaChwYXJhbS5yaWdodCk7XG4gICAgICAgICAgICAgICAgKytkZWZhdWx0Q291bnQ7XG4gICAgICAgICAgICAgICAgY2hlY2tQYXR0ZXJuUGFyYW0ob3B0aW9ucywgcGFyYW0ubGVmdCk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIGNoZWNrUGF0dGVyblBhcmFtKG9wdGlvbnMsIHBhcmFtKTtcbiAgICAgICAgICAgICAgICBwYXJhbXNbaV0gPSBwYXJhbTtcbiAgICAgICAgICAgICAgICBkZWZhdWx0cy5wdXNoKG51bGwpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHN0cm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hdGVtZW50KTtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxNC40IFlpZWxkIGV4cHJlc3Npb25cblxuICAgIGZ1bmN0aW9uIHBhcnNlWWllbGRFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgYXJndW1lbnQsIGV4cHIsIGRlbGVnYXRlLCBwcmV2aW91c0FsbG93WWllbGQ7XG5cbiAgICAgICAgYXJndW1lbnQgPSBudWxsO1xuICAgICAgICBleHByID0gbmV3IE5vZGUoKTtcbiAgICAgICAgZGVsZWdhdGUgPSBmYWxzZTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCd5aWVsZCcpO1xuXG4gICAgICAgIGlmICghaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIHByZXZpb3VzQWxsb3dZaWVsZCA9IHN0YXRlLmFsbG93WWllbGQ7XG4gICAgICAgICAgICBzdGF0ZS5hbGxvd1lpZWxkID0gZmFsc2U7XG4gICAgICAgICAgICBkZWxlZ2F0ZSA9IG1hdGNoKCcqJyk7XG4gICAgICAgICAgICBpZiAoZGVsZWdhdGUpIHtcbiAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICBhcmd1bWVudCA9IHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKCFtYXRjaCgnOycpICYmICFtYXRjaCgnfScpICYmICFtYXRjaCgnKScpICYmIGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5FT0YpIHtcbiAgICAgICAgICAgICAgICAgICAgYXJndW1lbnQgPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc3RhdGUuYWxsb3dZaWVsZCA9IHByZXZpb3VzQWxsb3dZaWVsZDtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByLmZpbm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ICAgICAgfVxuXG4gICAgICAgIGlmIChtYXRjaEFzc2lnbigpKSB7XG4gICAgICAgICAgICBpZiAoIWlzQXNzaWdubWVudFRhcmdldCkge1xuICAgICAgICAgICAgICAgIHRvbGVyYXRlRXJyb3IoTWVzc2FnZXMuSW52YWxpZExIU0luQXNzaWdubWVudCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIEVDTUEtMjYyIDEyLjEuMVxuICAgICAgICAgICAgaWYgKHN0cmljdCAmJiBleHByLnR5cGUgPT09IFN5bnRheC5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGlzUmVzdHJpY3RlZFdvcmQoZXhwci5uYW1lKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RyaWN0TEhTQXNzaWdubWVudCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChpc1N0cmljdE1vZGVSZXNlcnZlZFdvcmQoZXhwci5uYW1lKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RyaWN0UmVzZXJ2ZWRXb3JkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJz0nKSkge1xuICAgICAgICAgICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSBmYWxzZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGV4cHIpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0b2tlbiA9IGxleCgpO1xuICAgICAgICAgICAgcmlnaHQgPSBpc29sYXRlQ292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoQXNzaWdubWVudEV4cHJlc3Npb24odG9rZW4udmFsdWUsIGV4cHIsIHJpZ2h0KTtcbiAgICAgICAgICAgIGZpcnN0Q292ZXJJbml0aWFsaXplZE5hbWVFcnJvciA9IG51bGw7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZXhwcjtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxMi4xNSBDb21tYSBPcGVyYXRvclxuXG4gICAgZnVuY3Rpb24gcGFyc2VFeHByZXNzaW9uKCkge1xuICAgICAgICB2YXIgZXhwciwgc3RhcnRUb2tlbiA9IGxvb2thaGVhZCwgZXhwcmVzc2lvbnM7XG5cbiAgICAgICAgZXhwciA9IGlzb2xhdGVDb3ZlckdyYW1tYXIocGFyc2VBc3NpZ25tZW50RXhwcmVzc2lvbik7XG5cbiAgICAgICAgaWYgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgIGV4cHJlc3Npb25zID0gW2V4cHJdO1xuXG4gICAgICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgIGlmICghbWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgZXhwcmVzc2lvbnMucHVzaChpc29sYXRlQ292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgZXhwciA9IG5ldyBXcmFwcGluZ05vZGUoc3RhcnRUb2tlbikuZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uKGV4cHJlc3Npb25zKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHByO1xuICAgIH1cblxuIC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bG93SW47XG5cbiAgICAgICAgICAgICAgICBpZiAoZGVjbGFyYXRpb25zLmxlbmd0aCA9PT0gMSAmJiBtYXRjaEtleXdvcmQoJ2luJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaW5pdCA9IGluaXQuZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgbGVmdCA9IGluaXQ7XG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0ID0gcGFyc2VFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBudWxsO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZGVjbGFyYXRpb25zLmxlbmd0aCA9PT0gMSAmJiBkZWNsYXJhdGlvbnNbMF0uaW5pdCA9PT0gbnVsbCAmJiBtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdvZicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaFZhcmlhYmxlRGVjbGFyYXRpb24oZGVjbGFyYXRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgICAgICAgICAgaW5pdCA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgIGZvckluID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaW5pdCA9IGluaXQuZmluaXNoVmFyaWFibGVEZWNsYXJhdGlvbihkZWNsYXJhdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICBleHBlY3QoJzsnKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoS2V5d29yZCgnY29uc3QnKSB8fCBtYXRjaEtleXdvcmQoJ2xldCcpKSB7XG4gICAgICAgICAgICAgICAgaW5pdCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAga2luZCA9IGxleCgpLnZhbHVlO1xuXG4gICAgICAgICAgICAgICAgaWYgKCFzdHJpY3QgJiYgbG9va2FoZWFkLnZhbHVlID09PSAnaW4nKSB7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBpbml0LmZpbmlzaElkZW50aWZpZXIoa2luZCk7XG4gICAgICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgICAgICBsZWZ0ID0gaW5pdDtcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgICAgICAgICAgaW5pdCA9IG51bGw7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICBkZWNsYXJhdGlvbnMgPSBwYXJzZUJpbmRpbmdMaXN0KGtpbmQsIHtpbkZvcjogdHJ1ZX0pO1xuICAgICAgICAgICAgICAgICAgICBzdGF0ZS5hbGxvd0luID0gcHJldmlvdXNBbGxvd0luO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmIChkZWNsYXJhdGlvbnMubGVuZ3RoID09PSAxICYmIGRlY2xhcmF0aW9uc1swXS5pbml0ID09PSBudWxsICYmIG1hdGNoS2V5d29yZCgnaW4nKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdCA9IGluaXQuZmluaXNoTGV4aWNhbERlY2xhcmF0aW9uKGRlY2xhcmF0aW9ucywga2luZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXQgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGRlY2xhcmF0aW9ucy5sZW5ndGggPT09IDEgJiYgZGVjbGFyYXRpb25zWzBdLmluaXQgPT09IG51bGwgJiYgbWF0Y2hDb250ZXh0dWFsS2V5d29yZCgnb2YnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdCA9IGluaXQuZmluaXNoTGV4aWNhbERlY2xhcmF0aW9uKGRlY2xhcmF0aW9ucywga2luZCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQgPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvckluID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdW1lU2VtaWNvbG9uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0ID0gaW5pdC5maW5pc2hMZXhpY2FsRGVjbGFyYXRpb24oZGVjbGFyYXRpb25zLCBraW5kKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaW5pdFN0YXJ0VG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgc3RhdGUuYWxsb3dJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIGluaXQgPSBpbmhlcml0Q292ZXJHcmFtbWFyKHBhcnNlQXNzaWdubWVudEV4cHJlc3Npb24pO1xuICAgICAgICAgICAgICAgIHN0YXRlLmFsbG93SW4gPSBwcmV2aW91c0FsbG93SW47XG5cbiAgICAgICAgICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdpbicpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghaXNBc3NpZ25tZW50VGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLkludmFsaWRMSFNJbkZvckluKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgICAgICByZWludGVycHJldEV4cHJlc3Npb25Bc1BhdHRlcm4oaW5pdCk7XG4gICAgICAgICAgICAgICAgICAgIGxlZnQgPSBpbml0O1xuICAgICAgICAgICAgICAgICAgICByaWdodCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgICAgICAgICBpbml0ID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoQ29udGV4dHVhbEtleXdvcmQoJ29mJykpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc0Fzc2lnbm1lbnRUYXJnZXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvbGVyYXRlRXJyb3IoTWVzc2FnZXMuSW52YWxpZExIU0luRm9yTG9vcCk7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgcmVpbnRlcnByZXRFeHByZXNzaW9uQXNQYXR0ZXJuKGluaXQpO1xuICAgICAgICAgICAgICAgICAgICBsZWZ0ID0gaW5pdDtcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQgPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgICAgICAgICAgICAgIGluaXQgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICBmb3JJbiA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaCgnLCcpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0U2VxID0gW2luaXRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG1hdGNoKCcsJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0U2VxLnB1c2goaXNvbGF0ZUNvdmVyR3JhbW1hcihwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0ID0gbmV3IFdyYXBwaW5nTm9kZShpbml0U3RhcnRUb2tlbikuZmluaXNoU2VxdWVuY2VFeHByZXNzaW9uKGluaXRTZXEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGV4cGVjdCgnOycpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0eXBlb2YgbGVmdCA9PT0gJ3VuZGVmaW5lZCcpIHtcblxuICAgICAgICAgICAgaWYgKCFtYXRjaCgnOycpKSB7XG4gICAgICAgICAgICAgICAgdGVzdCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZXhwZWN0KCc7Jyk7XG5cbiAgICAgICAgICAgIGlmICghbWF0Y2goJyknKSkge1xuICAgICAgICAgICAgICAgIHVwZGF0ZSA9IHBhcnNlRXhwcmVzc2lvbigpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCcpJyk7XG5cbiAgICAgICAgb2xkSW5JdGVyYXRpb24gPSBzdGF0ZS5pbkl0ZXJhdGlvbjtcbiAgICAgICAgc3RhdGUuaW5JdGVyYXRpb24gPSB0cnVlO1xuXG4gICAgICAgIGJvZHkgPSBpc29sYXRlQ292ZXJHcmFtbWFyKHBhcnNlU3RhdGVtZW50KTtcblxuICAgICAgICBzdGF0ZS5pbkl0ZXJhdGlvbiA9IG9sZEluSXRlcmF0aW9uO1xuXG4gICAgICAgIHJldHVybiAodHlwZW9mIGxlZnQgPT09ICd1bmRlZmluZWQnKSA/XG4gICAgICAgICAgICAgICAgbm9kZS5maW5pc2hGb3JTdGF0ZW1lbnQoaW5pdCwgdGVzdCwgdXBkYXRlLCBib2R5KSA6XG4gICAgICAgICAgICAgICAgZm9ySW4gPyBub2RlLmZpbmlzaEZvckluU3RhdGVtZW50KGxlZnQsIHJpZ2h0LCBib2R5KSA6XG4gICAgICAgICAgICAgICAgICAgIG5vZGUuZmluaXNoRm9yT2ZTdGF0ZW1lbnQobGVmdCwgcmlnaHQsIGJvZHkpO1xuICAgIH1cblxuICAgIC8vIEVDTUEtMjYyIDEzLjggVGhlIGNvbnRpbnVlIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VDb250aW51ZVN0YXRlbWVudChub2RlKSB7XG4gICAgICAgIHZhciBsYWJlbCA9IG51bGwsIGtleTtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdjb250aW51ZScpO1xuXG4gICAgICAgIC8vIE9wdGltaXplIHRoZSBtb3N0IGNvbW1vbiBmb3JtOiAnY29udGludWU7Jy5cbiAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KHN0YXJ0SW5kZXgpID09PSAweDNCKSB7XG4gICAgICAgICAgICBsZXgoKTtcblxuICAgICAgICAgICAgaWYgKCFzdGF0ZS5pbkl0ZXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbENvbnRpbnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQ29udGludWVTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIGlmICghc3RhdGUuaW5JdGVyYXRpb24pIHtcbiAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaENvbnRpbnVlU3RhdGVtZW50KG51bGwpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICBsYWJlbCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG5cbiAgICAgICAgICAgIGtleSA9ICckJyArIGxhYmVsLm5hbWU7XG4gICAgICAgICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChzdGF0ZS5sYWJlbFNldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuVW5rbm93bkxhYmVsLCBsYWJlbC5uYW1lKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICBpZiAobGFiZWwgPT09IG51bGwgJiYgIXN0YXRlLmluSXRlcmF0aW9uKSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxDb250aW51ZSk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hDb250aW51ZVN0YXRlbWVudChsYWJlbCk7XG4gICAgfVxuXG4gICAgLy8gRUNNQS0yNjIgMTMuOSBUaGUgYnJlYWsgc3RhdGVtZW50XG5cbiAgICBmdW5jdGlvbiBwYXJzZUJyZWFrU3RhdGVtZW50KG5vZGUpIHtcbiAgICAgICAgdmFyIGxhYmVsID0gbnVsbCwga2V5O1xuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ2JyZWFrJyk7XG5cbiAgICAgICAgLy8gQ2F0Y2ggdGhlIHZlcnkgY29tbW9uIGNhc2UgZmlyc3Q6IGltbWVkaWF0ZWx5IGEgc2VtaWNvbG9uIChVKzAwM0IpLlxuICAgICAgICBpZiAoc291cmNlLmNoYXJDb2RlQXQobGFzdEluZGV4KSA9PT0gMHgzQikge1xuICAgICAgICAgICAgbGV4KCk7XG5cbiAgICAgICAgICAgIGlmICghKHN0YXRlLmluSXRlcmF0aW9uIHx8IHN0YXRlLmluU3dpdGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbEJyZWFrKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoQnJlYWtTdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaGFzTGluZVRlcm1pbmF0b3IpIHtcbiAgICAgICAgICAgIGlmICghKHN0YXRlLmluSXRlcmF0aW9uIHx8IHN0YXRlLmluU3dpdGNoKSkge1xuICAgICAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbEJyZWFrKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uSWRlbnRpZmllcikge1xuICAgICAgICAgICAgbGFiZWwgPSBwYXJzZVZhcmlhYmxlSWRlbnRpZmllcigpO1xuXG4gICAgICAgICAgICBrZXkgPSAnJCcgKyBsYWJlbC5uYW1lO1xuICAgICAgICAgICAgaWYgKCFPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoc3RhdGUubGFiZWxTZXQsIGtleSkpIHtcbiAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLlVua25vd25MYWJlbCwgbGFiZWwubmFtZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICA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gICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGhhc0xpbmVUZXJtaW5hdG9yKSB7XG4gICAgICAgICAgICAvLyBIQUNLXG4gICAgICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQobnVsbCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIW1hdGNoKCc7JykpIHtcbiAgICAgICAgICAgIGlmICghbWF0Y2goJ30nKSAmJiBsb29rYWhlYWQudHlwZSAhPT0gVG9rZW4uRU9GKSB7XG4gICAgICAgICAgICAgICAgYXJndW1lbnQgPSBwYXJzZUV4cHJlc3Npb24oKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hSZXR1cm5TdGF0ZW1lbnQoYXJndW1lbnQpO1xuICAgIH1cblxuICAgIC8vIEVDTUEtMjYyIDEzLjExIFRoZSB3aXRoIHN0YXRlbWVudFxuXG4gICAgZnVuY3Rpb24gcGFyc2VXaXRoU3RhdGVtZW50KG5vZGUpIHtcbiAgICAgICAgdmFyIG9iamVjdCwgYm9keTtcblxuICAgICAgICBpZiAoc3RyaWN0KSB7XG4gICAgICAgICAgICB0b2xlcmF0ZUVycm9yKE1lc3NhZ2VzLlN0cmljdE1vZGVXaXRoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ3dpdGgnKTtcblxuICAgICAgICBleHBlY3QoJygnKTtcblxuICAgICAgICBvYmplY3QgPSBwYXJzZUV4cHJlc3Npb24oKTtcblxuICAgICAgICBleHBlY3QoJyknKTtcblxuICAgICAgICBib2R5ID0gcGFyc2VTdGF0ZW1lbnQoKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hXaXRoU3RhdGVtZW50KG9iamVjdCwgYm9keSk7XG4gICAgfVxuXG4gICAgLy8gRUNNQS0yNjIgMTMuMTI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VjdCgnKCcpO1xuXG4gICAgICAgIGRpc2NyaW1pbmFudCA9IHBhcnNlRXhwcmVzc2lvbigpO1xuXG4gICAgICAgIGV4cGVjdCgnKScpO1xuXG4gICAgICAgIGV4cGVjdCgneycpO1xuXG4gICAgICAgIGNhc2VzID0gW107XG5cbiAgICAgICAgaWYgKG1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoU3dpdGNoU3RhdGVtZW50KGRpc2NyaW1pbmFudCwgY2FzZXMpO1xuICAgICAgICB9XG5cbiAgICAgICAgb2xkSW5Td2l0Y2ggPSBzdGF0ZS5pblN3aXRjaDtcbiAgICAgICAgc3RhdGUuaW5Td2l0Y2ggPSB0cnVlO1xuICAgICAgICBkZWZhdWx0Rm91bmQgPSBmYWxzZTtcblxuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgaWYgKG1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNsYXVzZSA9IHBhcnNlU3dpdGNoQ2FzZSgpO1xuICAgICAgICAgICAgaWYgKGNsYXVzZS50ZXN0ID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaWYgKGRlZmF1bHRGb3VuZCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLk11bHRpcGxlRGVmYXVsdHNJblN3aXRjaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGRlZmF1bHRGb3VuZCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjYXNlcy5wdXNoKGNsYXVzZSk7XG4gICAgICAgIH1cblxuICAgICAgICBzdGF0ZS5pblN3aXRjaCA9IG9sZEluU3dpdGNoO1xuXG4gICAgICAgIGV4cGVjdCgnfScpO1xuXG4gICAgICAgIHJldHV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XG4gICAgICAgIGlzQXNzaWdubWVudFRhcmdldCA9IGlzQmluZGluZ0VsZW1lbnQgPSB0cnVlO1xuICAgICAgICBub2RlID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBpZiAodHlwZSA9PT0gVG9rZW4uUHVuY3R1YXRvcikge1xuICAgICAgICAgICAgc3dpdGNoIChsb29rYWhlYWQudmFsdWUpIHtcbiAgICAgICAgICAgIGNhc2UgJzsnOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUVtcHR5U3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnKCc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRXhwcmVzc2lvblN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gVG9rZW4uS2V5d29yZCkge1xuICAgICAgICAgICAgc3dpdGNoIChsb29rYWhlYWQudmFsdWUpIHtcbiAgICAgICAgICAgIGNhc2UgJ2JyZWFrJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VCcmVha1N0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2NvbnRpbnVlJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VDb250aW51ZVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2RlYnVnZ2VyJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VEZWJ1Z2dlclN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2RvJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VEb1doaWxlU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnZm9yJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VGb3JTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICdmdW5jdGlvbic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRnVuY3Rpb25EZWNsYXJhdGlvbihub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ2lmJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJZlN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ3JldHVybic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlUmV0dXJuU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgY2FzZSAnc3dpdGNoJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VTd2l0Y2hTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd0aHJvdyc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlVGhyb3dTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd0cnknOlxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZVRyeVN0YXRlbWVudChub2RlKTtcbiAgICAgICAgICAgIGNhc2UgJ3Zhcic6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlVmFyaWFibGVTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd3aGlsZSc6XG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlV2hpbGVTdGF0ZW1lbnQobm9kZSk7XG4gICAgICAgICAgICBjYXNlICd3aXRoJzpcbiAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VXaXRoU3RhdGVtZW50KG5vZGUpO1xuICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGV4cHIgPSBwYXJzZUV4cHJlc3Npb24oKTtcblxuICAgICAgICAvLyBFQ01BLTI2MiAxMi4xMiBMYWJlbGxlZCBTdGF0ZW1l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hbCkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQgPSB0b2tlbjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBvbGRMYWJlbFNldCA9IHN0YXRlLmxhYmVsU2V0O1xuICAgICAgICBvbGRJbkl0ZXJhdGlvbiA9IHN0YXRlLmluSXRlcmF0aW9uO1xuICAgICAgICBvbGRJblN3aXRjaCA9IHN0YXRlLmluU3dpdGNoO1xuICAgICAgICBvbGRJbkZ1bmN0aW9uQm9keSA9IHN0YXRlLmluRnVuY3Rpb25Cb2R5O1xuICAgICAgICBvbGRQYXJlbnRoZXNpc0NvdW50ID0gc3RhdGUucGFyZW50aGVzaXplZENvdW50O1xuXG4gICAgICAgIHN0YXRlLmxhYmVsU2V0ID0ge307XG4gICAgICAgIHN0YXRlLmluSXRlcmF0aW9uID0gZmFsc2U7XG4gICAgICAgIHN0YXRlLmluU3dpdGNoID0gZmFsc2U7XG4gICAgICAgIHN0YXRlLmluRnVuY3Rpb25Cb2R5ID0gdHJ1ZTtcbiAgICAgICAgc3RhdGUucGFyZW50aGVzaXplZENvdW50ID0gMDtcblxuICAgICAgICB3aGlsZSAoc3RhcnRJbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgICAgaWYgKG1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGJvZHkucHVzaChwYXJzZVN0YXRlbWVudExpc3RJdGVtKCkpO1xuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCd9Jyk7XG5cbiAgICAgICAgc3RhdGUubGFiZWxTZXQgPSBvbGRMYWJlbFNldDtcbiAgICAgICAgc3RhdGUuaW5JdGVyYXRpb24gPSBvbGRJbkl0ZXJhdGlvbjtcbiAgICAgICAgc3RhdGUuaW5Td2l0Y2ggPSBvbGRJblN3aXRjaDtcbiAgICAgICAgc3RhdGUuaW5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AgICAgaWYgKGlzR2VuZXJhdG9yKSB7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghaWRlbnRpZmllcklzT3B0aW9uYWwgfHwgIW1hdGNoKCcoJykpIHtcbiAgICAgICAgICAgIHRva2VuID0gbG9va2FoZWFkO1xuICAgICAgICAgICAgaWQgPSBwYXJzZVZhcmlhYmxlSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKHN0cmljdCkge1xuICAgICAgICAgICAgICAgIGlmIChpc1Jlc3RyaWN0ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RyaWN0RnVuY3Rpb25OYW1lKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChpc1Jlc3RyaWN0ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0ZWQgPSB0b2tlbjtcbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZSA9IE1lc3NhZ2VzLlN0cmljdEZ1bmN0aW9uTmFtZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzU3RyaWN0TW9kZVJlc2VydmVkV29yZCh0b2tlbi52YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlyc3RSZXN0cmljdGVkID0gdG9rZW47XG4gICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgPSBNZXNzYWdlcy5TdHJpY3RSZXNlcnZlZFdvcmQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgc3RhdGUuYWxsb3dZaWVsZCA9ICFpc0dlbmVyYXRvcjtcbiAgICAgICAgdG1wID0gcGFyc2VQYXJhbXMoZmlyc3RSZ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zc2FnZSwgdG1wLFxuICAgICAgICAgICAgcGFyYW1zID0gW10sIGRlZmF1bHRzID0gW10sIGJvZHksIHByZXZpb3VzU3RyaWN0LCBub2RlID0gbmV3IE5vZGUoKSxcbiAgICAgICAgICAgIGlzR2VuZXJhdG9yLCBwcmV2aW91c0FsbG93WWllbGQ7XG5cbiAgICAgICAgcHJldmlvdXNBbGxvd1lpZWxkID0gc3RhdGUuYWxsb3dZaWVsZDtcblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdmdW5jdGlvbicpO1xuXG4gICAgICAgIGlzR2VuZXJhdG9yID0gbWF0Y2goJyonKTtcbiAgICAgICAgaWYgKGlzR2VuZXJhdG9yKSB7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHN0YXRlLmFsbG93WWllbGQgPSAhaXNHZW5lcmF0b3I7XG4gICAgICAgIGlmICghbWF0Y2goJygnKSkge1xuICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICBpZCA9ICghc3RyaWN0ICYmICFpc0dlbmVyYXRvciAmJiBtYXRjaEtleXdvcmQoJ3lpZWxkJykpID8gcGFyc2VOb25Db21wdXRlZFByb3BlcnR5KCkgOiBwYXJzZVZhcmlhYmxlSWRlbnRpZmllcigpO1xuICAgICAgICAgICAgaWYgKHN0cmljdCkge1xuICAgICAgICAgICAgICAgIGlmIChpc1Jlc3RyaWN0ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2xlcmF0ZVVuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RyaWN0RnVuY3Rpb25OYW1lKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChpc1Jlc3RyaWN0ZWRXb3JkKHRva2VuLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICBmaXJzdFJlc3RyaWN0Z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GVkLCBtZXNzYWdlKTtcbiAgICAgICAgfVxuICAgICAgICBzdHJpY3QgPSBwcmV2aW91c1N0cmljdDtcbiAgICAgICAgc3RhdGUuYWxsb3dZaWVsZCA9IHByZXZpb3VzQWxsb3dZaWVsZDtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hGdW5jdGlvbkV4cHJlc3Npb24oaWQsIHBhcmFtcywgZGVmYXVsdHMsIGJvZHksIGlzR2VuZXJhdG9yKTtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxNC41IENsYXNzIERlZmluaXRpb25zXG5cbiAgICBmdW5jdGlvbiBwYXJzZUNsYXNzQm9keSgpIHtcbiAgICAgICAgdmFyIGNsYXNzQm9keSwgdG9rZW4sIGlzU3RhdGljLCBoYXNDb25zdHJ1Y3RvciA9IGZhbHNlLCBib2R5LCBtZXRob2QsIGNvbXB1dGVkLCBrZXk7XG5cbiAgICAgICAgY2xhc3NCb2R5ID0gbmV3IE5vZGUoKTtcblxuICAgICAgICBleHBlY3QoJ3snKTtcbiAgICAgICAgYm9keSA9IFtdO1xuICAgICAgICB3aGlsZSAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgIGlmIChtYXRjaCgnOycpKSB7XG4gICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG1ldGhvZCA9IG5ldyBOb2RlKCk7XG4gICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgaXNTdGF0aWMgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcqJykpIHtcbiAgICAgICAgICAgICAgICAgICAgbGV4KCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAga2V5ID0gcGFyc2VPYmplY3RQcm9wZXJ0eUtleSgpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoa2V5Lm5hbWUgPT09ICdzdGF0aWMnICYmIChsb29rYWhlYWRQcm9wZXJ0eU5hbWUoKSB8fCBtYXRjaCgnKicpKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdG9rZW4gPSBsb29rYWhlYWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpc1N0YXRpYyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlZCA9IG1hdGNoKCdbJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobWF0Y2goJyonKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXkgPSBwYXJzZU9iamVjdFByb3BlcnR5S2V5KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbWV0aG9kID0gdHJ5UGFyc2VNZXRob2REZWZpbml0aW9uKHRva2VuLCBrZXksIGNvbXB1dGVkLCBtZXRob2QpO1xuICAgICAgICAgICAgICAgIGlmIChtZXRob2QpIHtcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kWydzdGF0aWMnXSA9IGlzU3RhdGljOyAvLyBqc2NzOmlnbm9yZSByZXF1aXJlRG90Tm90YXRpb25cbiAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kID09PSAnaW5pdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ21ldGhvZCc7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpc1N0YXRpYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtZXRob2QuY29tcHV0ZWQgJiYgKG1ldGhvZC5rZXkubmFtZSB8fCBtZXRob2Qua2V5LnZhbHVlLnRvU3RyaW5nKCkpID09PSAnY29uc3RydWN0b3InKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1ldGhvZC5raW5kICE9PSAnbWV0aG9kJyB8fCAhbWV0aG9kLm1ldGhvZCB8fCBtZXRob2QudmFsdWUuZ2VuZXJhdG9yKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKHRva2VuLCBNZXNzYWdlcy5Db25zdHJ1Y3RvclNwZWNpYWxNZXRob2QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGFzQ29uc3RydWN0b3IpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3dVbmV4cGVjdGVkVG9rZW4odG9rZW4sIE1lc3NhZ2VzLkR1cGxpY2F0ZUNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNDb25zdHJ1Y3RvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZC5raW5kID0gJ2NvbnN0cnVjdG9yJztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbWV0aG9kLmNvbXB1dGVkICYmIChtZXRob2Qua2V5Lm5hbWUgfHwgbWV0aG9kLmtleS52YWx1ZS50b1N0cmluZygpKSA9PT0gJ3Byb3RvdHlwZScpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvd1VuZXhwZWN0ZWRUb2tlbih0b2tlbiwgTWVzc2FnZXMuU3RhdGljUHJvdG90eXBlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBtZXRob2QudHlwZSA9IFN5bnRheC5NZXRob2REZWZpbml0aW9uO1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgbWV0aG9kLm1ldGhvZDtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG1ldGhvZC5zaG9ydGhhbmQ7XG4gICAgICAgICAgICAgICAgICAgIGJvZHkucHVzaChtZXRob2QpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGxleCgpO1xuICAgICAgICByZXR1cm4gY2xhc3NCb2R5LmZpbmlzaENsYXNzQm9keShib2R5KTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUNsYXNzRGVjbGFyYXRpb24oaWRlbnRpZmllcklzT3B0aW9uYWwpIHtcbiAgICAgICAgdmFyIGlkID0gbnVsbCwgc3VwZXJDbGFzcyA9IG51bGwsIGNsYXNzTm9kZSA9IG5ldyBOb2RlKCksIGNsYXNzQm9keSwgcHJldmlvdXNTdHJpY3QgPSBzdHJpY3Q7XG4gICAgICAgIHN0cmljdCA9IHRydWU7XG5cbiAgICAgICAgZXhwZWN0S2V5d29yZCgnY2xhc3MnKTtcblxuICAgICAgICBpZiAoIWlkZW50aWZpZXJJc09wdGlvbmFsIHx8IGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICBpZCA9IHBhcnNlVmFyaWFibGVJZGVudGlmaWVyKCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdleHRlbmRzJykpIHtcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAg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kUHJvcGVydHkoKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hFeHBvcnRTcGVjaWZpZXIobG9jYWwsIGV4cG9ydGVkKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwYXJzZUV4cG9ydE5hbWVkRGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICB2YXIgZGVjbGFyYXRpb24gPSBudWxsLFxuICAgICAgICAgICAgaXNFeHBvcnRGcm9tSWRlbnRpZmllcixcbiAgICAgICAgICAgIHNyYyA9IG51bGwsIHNwZWNpZmllcnMgPSBbXTtcblxuICAgICAgICAvLyBub24tZGVmYXVsdCBleHBvcnRcbiAgICAgICAgaWYgKGxvb2thaGVhZC50eXBlID09PSBUb2tlbi5LZXl3b3JkKSB7XG4gICAgICAgICAgICAvLyBjb3ZlcnM6XG4gICAgICAgICAgICAvLyBleHBvcnQgdmFyIGYgPSAxO1xuICAgICAgICAgICAgc3dpdGNoIChsb29rYWhlYWQudmFsdWUpIHtcbiAgICAgICAgICAgICAgICBjYXNlICdsZXQnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ2NvbnN0JzpcbiAgICAgICAgICAgICAgICAgICAgZGVjbGFyYXRpb24gPSBwYXJzZUxleGljYWxEZWNsYXJhdGlvbih7aW5Gb3I6IGZhbHNlfSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydE5hbWVkRGVjbGFyYXRpb24oZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIG51bGwpO1xuICAgICAgICAgICAgICAgIGNhc2UgJ3Zhcic6XG4gICAgICAgICAgICAgICAgY2FzZSAnY2xhc3MnOlxuICAgICAgICAgICAgICAgIGNhc2UgJ2Z1bmN0aW9uJzpcbiAgICAgICAgICAgICAgICAgICAgZGVjbGFyYXRpb24gPSBwYXJzZVN0YXRlbWVudExpc3RJdGVtKCk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBub2RlLmZpbmlzaEV4cG9ydE5hbWVkRGVjbGFyYXRpb24oZGVjbGFyYXRpb24sIHNwZWNpZmllcnMsIG51bGwpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZXhwZWN0KCd7Jyk7XG4gICAgICAgIHdoaWxlICghbWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgaXNFeHBvcnRGcm9tSWRlbnRpZmllciA9IGlzRXhwb3J0RnJvbUlkZW50aWZpZXIgfHwgbWF0Y2hLZXl3b3JkKCdkZWZhdWx0Jyk7XG4gICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VFeHBvcnRTcGVjaWZpZXIoKSk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZXhwZWN0KCd9Jyk7XG5cbiAgICAgICAgaWYgKG1hdGNoQ29udGV4dHVhbEtleXdvcmQoJ2Zyb20nKSkge1xuICAgICAgICAgICAgLy8gY292ZXJpbmc6XG4gICAgICAgICAgICAvLyBleHBvcnQge2RlZmF1bHR9IGZyb20gJ2Zvbyc7XG4gICAgICAgICAgICAvLyBleHBvcnQge2Zvb30gZnJvbSAnZm9vJztcbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgc3JjID0gcGFyc2VNb2R1bGVTcGVjaWZpZXIoKTtcbiAgICAgICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgfSBlbHNlIGlmIChpc0V4cG9ydEZyb21JZGVudGlmaWVyKSB7XG4gICAgICAgICAgICAvLyBjb3ZlcmluZzpcbiAgICAgICAgICAgIC8vIGV4cG9ydCB7ZGVmYXVsdH07IC8vIG1pc3NpbmcgZnJvbUNsY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VjbGFyYXRpb24pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtYXRjaEtleXdvcmQoJ2NsYXNzJykpIHtcbiAgICAgICAgICAgIGRlY2xhcmF0aW9uID0gcGFyc2VDbGFzc0RlY2xhcmF0aW9uKHRydWUpO1xuICAgICAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoRXhwb3J0RGVmYXVsdERlY2xhcmF0aW9uKGRlY2xhcmF0aW9uKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdmcm9tJykpIHtcbiAgICAgICAgICAgIHRocm93RXJyb3IoTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuLCBsb29rYWhlYWQudmFsdWUpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAvLyBleHBvcnQgZGVmYXVsdCB7fTtcbiAgICAgICAgLy8gZXhwb3J0IGRlZmF1bHQgW107XG4gICAgICAgIC8vIGV4cG9ydCBkZWZhdWx0ICgxICsgMik7XG4gICAgICAgIGlmIChtYXRjaCgneycpKSB7XG4gICAgICAgICAgICBleHByZXNzaW9uID0gcGFyc2VPYmplY3RJbml0aWFsaXplcigpO1xuICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCdbJykpIHtcbiAgICAgICAgICAgIGV4cHJlc3Npb24gPSBwYXJzZUFycmF5SW5pdGlhbGl6ZXIoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGV4cHJlc3Npb24gPSBwYXJzZUFzc2lnbm1lbnRFeHByZXNzaW9uKCk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3VtZVNlbWljb2xvbigpO1xuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24oZXhwcmVzc2lvbik7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VFeHBvcnRBbGxEZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIHZhciBzcmM7XG5cbiAgICAgICAgLy8gY292ZXJzOlxuICAgICAgICAvLyBleHBvcnQgKiBmcm9tICdmb28nO1xuICAgICAgICBleHBlY3QoJyonKTtcbiAgICAgICAgaWYgKCFtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdmcm9tJykpIHtcbiAgICAgICAgICAgIHRocm93RXJyb3IobG9va2FoZWFkLnZhbHVlID9cbiAgICAgICAgICAgICAgICAgICAgTWVzc2FnZXMuVW5leHBlY3RlZFRva2VuIDogTWVzc2FnZXMuTWlzc2luZ0Zyb21DbGF1c2UsIGxvb2thaGVhZC52YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV4KCk7XG4gICAgICAgIHNyYyA9IHBhcnNlTW9kdWxlU3BlY2lmaWVyKCk7XG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcblxuICAgICAgICByZXR1cm4gbm9kZS5maW5pc2hFeHBvcnRBbGxEZWNsYXJhdGlvbihzcmMpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlRXhwb3J0RGVjbGFyYXRpb24oKSB7XG4gICAgICAgIHZhciBub2RlID0gbmV3IE5vZGUoKTtcbiAgICAgICAgaWYgKHN0YXRlLmluRnVuY3Rpb25Cb2R5KSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKE1lc3NhZ2VzLklsbGVnYWxFeHBvcnREZWNsYXJhdGlvbik7XG4gICAgICAgIH1cblxuICAgICAgICBleHBlY3RLZXl3b3JkKCdleHBvcnQnKTtcblxuICAgICAgICBpZiAobWF0Y2hLZXl3b3JkKCdkZWZhdWx0JykpIHtcbiAgICAgICAgICAgIHJldHVybiBwYXJzZUV4cG9ydERlZmF1bHREZWNsYXJhdGlvbihub2RlKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWF0Y2goJyonKSkge1xuICAgICAgICAgICAgcmV0dXJuIHBhcnNlRXhwb3J0QWxsRGVjbGFyYXRpb24obm9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHBhcnNlRXhwb3J0TmFtZWREZWNsYXJhdGlvbihub2RlKTtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxNS4yLjIgSW1wb3J0c1xuXG4gICAgZnVuY3Rpb24gcGFyc2VJbXBvcnRTcGVjaWZpZXIoKSB7XG4gICAgICAgIC8vIGltcG9ydCB7PGZvbyBhcyBiYXI+fSAuLi47XG4gICAgICAgIHZhciBsb2NhbCwgaW1wb3J0ZWQsIG5vZGUgPSBuZXcgTm9kZSgpO1xuXG4gICAgICAgIGltcG9ydGVkID0gcGFyc2VOb25Db21wdXRlZFByb3BlcnR5KCk7XG4gICAgICAgIGlmIChtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdhcycpKSB7XG4gICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgIGxvY2FsID0gcGFyc2VWYXJpYWJsZUlkZW50aWZpZXIoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBub2RlLmZpbmlzaEltcG9ydFNwZWNpZmllcihsb2NhbCwgaW1wb3J0ZWQpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlTmFtZWRJbXBvcnRzKCkge1xuICAgICAgICB2YXIgc3BlY2lmaWVycyA9IFtdO1xuICAgICAgICAvLyB7Zm9vLCBiYXIgYXMgYmFzfVxuICAgICAgICBleHBlY3QoJ3snKTtcbiAgICAgICAgd2hpbGUgKCFtYXRjaCgnfScpKSB7XG4gICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VJbXBvcnRTcGVjaWZpZXIoKSk7XG4gICAgICAgICAgICBpZiAoIW1hdGNoKCd9JykpIHtcbiAgICAgICAgICAgICAgICBleHBlY3QoJywnKTtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2goJ30nKSkge1xuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbi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ICAgIHRocm93RXJyb3IoTWVzc2FnZXMuSWxsZWdhbEltcG9ydERlY2xhcmF0aW9uKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV4cGVjdEtleXdvcmQoJ2ltcG9ydCcpO1xuXG4gICAgICAgIGlmIChsb29rYWhlYWQudHlwZSA9PT0gVG9rZW4uU3RyaW5nTGl0ZXJhbCkge1xuICAgICAgICAgICAgLy8gaW1wb3J0ICdmb28nO1xuICAgICAgICAgICAgc3JjID0gcGFyc2VNb2R1bGVTcGVjaWZpZXIoKTtcbiAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgaWYgKG1hdGNoKCd7JykpIHtcbiAgICAgICAgICAgICAgICAvLyBpbXBvcnQge2Jhcn1cbiAgICAgICAgICAgICAgICBzcGVjaWZpZXJzID0gc3BlY2lmaWVycy5jb25jYXQocGFyc2VOYW1lZEltcG9ydHMoKSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoKCcqJykpIHtcbiAgICAgICAgICAgICAgICAvLyBpbXBvcnQgKiBhcyBmb29cbiAgICAgICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VJbXBvcnROYW1lc3BhY2VTcGVjaWZpZXIoKSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlzSWRlbnRpZmllck5hbWUobG9va2FoZWFkKSAmJiAhbWF0Y2hLZXl3b3JkKCdkZWZhdWx0JykpIHtcbiAgICAgICAgICAgICAgICAvLyBpbXBvcnQgZm9vXG4gICAgICAgICAgICAgICAgc3BlY2lmaWVycy5wdXNoKHBhcnNlSW1wb3J0RGVmYXVsdFNwZWNpZmllcigpKTtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2goJywnKSkge1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoKCcqJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGltcG9ydCBmb28sICogYXMgZm9vXG4gICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZXJzLnB1c2gocGFyc2VJbXBvcnROYW1lc3BhY2VTcGVjaWZpZXIoKSk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWF0Y2goJ3snKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaW1wb3J0IGZvbywge2Jhcn1cbiAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpZmllcnMgPSBzcGVjaWZpZXJzLmNvbmNhdChwYXJzZU5hbWVkSW1wb3J0cygpKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxvb2thaGVhZCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRocm93VW5leHBlY3RlZFRva2VuKGxleCgpKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFtYXRjaENvbnRleHR1YWxLZXl3b3JkKCdmcm9tJykpIHtcbiAgICAgICAgICAgICAgICB0aHJvd0Vycm9yKGxvb2thaGVhZC52YWx1ZSA/XG4gICAgICAgICAgICAgICAgICAgICAgICBNZXNzYWdlcy5VbmV4cGVjdGVkVG9rZW4gOiBNZXNzYWdlcy5NaXNzaW5nRnJvbUNsYXVzZSwgbG9va2FoZWFkLnZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgc3JjID0gcGFyc2VNb2R1bGVTcGVjaWZpZXIoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN1bWVTZW1pY29sb24oKTtcbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoSW1wb3J0RGVjbGFyYXRpb24oc3BlY2lmaWVycywgc3JjKTtcbiAgICB9XG5cbiAgICAvLyBFQ01BLTI2MiAxNS4xIFN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ICAgICAgICAgICAgIGlmICghZmlyc3RSZXN0cmljdGVkICYmIHRva2VuLm9jdGFsKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpcnN0UmVzdHJpY3RlZCA9IHRva2VuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHdoaWxlIChzdGFydEluZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICBzdGF0ZW1lbnQgPSBwYXJzZVN0YXRlbWVudExpc3RJdGVtKCk7XG4gICAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc3RhdGVtZW50ID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYm9keS5wdXNoKHN0YXRlbWVudCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGJvZHk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcGFyc2VQcm9ncmFtKCkge1xuICAgICAgICB2YXIgYm9keSwgbm9kZTtcblxuICAgICAgICBwZWVrKCk7XG4gICAgICAgIG5vZGUgPSBuZXcgTm9kZSgpO1xuXG4gICAgICAgIGJvZHkgPSBwYXJzZVNjcmlwdEJvZHkoKTtcbiAgICAgICAgcmV0dXJuIG5vZGUuZmluaXNoUHJvZ3JhbShib2R5LCBzdGF0ZS5zb3VyY2VUeXBlKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBmaWx0ZXJUb2tlbkxvY2F0aW9uKCkge1xuICAgICAgICB2YXIgaSwgZW50cnksIHRva2VuLCB0b2tlbnMgPSBbXTtcblxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZXh0cmEudG9rZW5zLmxlbmd0aDsgKytpKSB7XG4gICAgICAgICAgICBlbnRyeSA9IGV4dHJhLnRva2Vuc1tpXTtcbiAgICAgICAgICAgIHRva2VuID0ge1xuICAgICAgICAgICAgICAgIHR5cGU6IGVudHJ5LnR5cGUsXG4gICAgICAgICAgICAgICAgdmFsdWU6IGVudHJ5LnZhbHVlXG4gICAgICAgICAgICB9O1xuICAgICAgICAgICAgaWYgKGVudHJ5LnJlZ2V4KSB7XG4gICAgICAgICAgICAgICAgdG9rZW4ucmVnZXggPSB7XG4gICAgICAgICAgICAgICAgICAgIHBhdHRlcm46IGVudHJ5LnJlZ2V4LnBhdHRlcm4sXG4gICAgICAgICAgICAgICAgICAgIGZsYWdzOiBlbnRyeS5yZWdleC5mbGFnc1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEucmFuZ2UpIHtcbiAgICAgICAgICAgICAgICB0b2tlbi5yYW5nZSA9IGVudHJ5LnJhbmdlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGV4dHJhLmxvYykge1xuICAgICAgICAgICAgICAgIHRva2VuLmxvYyA9IGVudHJ5LmxvYztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRva2Vucy5wdXNoKHRva2VuKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGV4dHJhLnRva2VucyA9IHRva2VucztcbiAgICB9XG5cbiAgICBmdW5jdGlvbiB0b2tlbml6ZShjb2RlLCBvcHRpb25zLCBkZWxlZ2F0ZSkge1xuICAgICAgICB2YXIgdG9TdHJpbmcsXG4gICAgICAgICAgICB0b2tlbnM7XG5cbiAgICAgICAgdG9TdHJpbmcgPSBTdHJpbmc7XG4gICAgICAgIGlmICh0eXBlb2YgY29kZSAhPT0gJ3N0cmluZycgJiYgIShjb2RlIGluc3RhbmNlb2YgU3RyaW5nKSkge1xuICAgICAgICAgICAgY29kZSA9IHRvU3RyaW5nKGNvZGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgc291cmNlID0gY29kZTtcbiAgICAgICAgaW5kZXggPSAwO1xuICAgICAgICBsaW5lTnVtYmVyID0gKHNvdXJjZS5sZW5ndGggPiAwKSA/IDEgOiAwO1xuICAgICAgICBsaW5lU3RhcnQgPSAwO1xuICAgICAgICBzdGFydEluZGV4ID0gaW5kZXg7XG4gICAgICAgIHN0YXJ0TGluZU51bWJlciA9IGxpbmVOdW1iZXI7XG4gICAgICAgIHN0YXJ0TGluZVN0YXJ0ID0gbGluZVN0YXJ0O1xuICAgICAgICBsZW5ndGggPSBzb3VyY2UubGVuZ3RoO1xuICAgICAgICBsb29rYWhlYWQgPSBudWxsO1xuICAgICAgICBzdGF0ZSA9IHtcbiAgICAgICAgICAgIGFsbG93SW46IHRydWUsXG4gICAgICAgICAgICBhbGxvd1lpZWxkOiB0cnVlLFxuICAgICAgICAgICAgbGFiZWxTZXQ6IHt9LFxuICAgICAgICAgICAgaW5GdW5jdGlvbkJvZHk6IGZhbHNlLFxuICAgICAgICAgICAgaW5JdGVyYXRpb246IGZhbHNlLFxuICAgICAgICAgICAgaW5Td2l0Y2g6IGZhbHNlLFxuICAgICAgICAgICAgbGFzdENvbW1lbnRTdGFydDogLTEsXG4gICAgICAgICAgICBjdXJseVN0YWNrOiBbXVxuICAgICAgICB9O1xuXG4gICAgICAgIGV4dHJhID0ge307XG5cbiAgICAgICAgLy8gT3B0aW9ucyBtYXRjaGluZy5cbiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307XG5cbiAgICAgICAgLy8gT2YgY291cnNlIHdlIGNvbGxlY3QgdG9rZW5zIGhlcmUuXG4gICAgICAgIG9wdGlvbnMudG9rZW5zID0gdHJ1ZTtcbiAgICAgICAgZXh0cmEudG9rZW5zID0gW107XG4gICAgICAgIGV4dHJhLnRva2VuVmFsdWVzID0gW107XG4gICAgICAgIGV4dHJhLnRva2VuaXplID0gdHJ1ZTtcbiAgICAgICAgZXh0cmEuZGVsZWdhdGUgPSBkZWxlZ2F0ZTtcblxuICAgICAgICAvLyBUaGUgZm9sbG93aW5nIHR3byBmaWVsZHMgYXJlIG5lY2Vzc2FyeSB0byBjb21wdXRlIHRoZSBSZWdleCB0b2tlbnMuXG4gICAgICAgIGV4dHJhLm9wZW5QYXJlblRva2VuID0gLTE7XG4gICAgICAgIGV4dHJhLm9wZW5DdXJseVRva2VuID0gLTE7XG5cbiAgICAgICAgZXh0cmEucmFuZ2UgPSAodHlwZW9mIG9wdGlvbnMucmFuZ2UgPT09ICdib29sZWFuJykgJiYgb3B0aW9ucy5yYW5nZTtcbiAgICAgICAgZXh0cmEubG9jID0gKHR5cGVvZiBvcHRpb25zLmxvYyA9PT0gJ2Jvb2xlYW4nKSAmJiBvcHRpb25zLmxvYztcblxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuY29tbWVudCA9PT0gJ2Jvb2xlYW4nICYmIG9wdGlvbnMuY29tbWVudCkge1xuICAgICAgICAgICAgZXh0cmEuY29tbWVudHMgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMudG9sZXJhbnQgPT09ICdib29sZWFuJyAmJiBvcHRpb25zLnRvbGVyYW50KSB7XG4gICAgICAgICAgICBleHRyYS5lcnJvcnMgPSBbXTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBwZWVrKCk7XG4gICAgICAgICAgICBpZiAobG9va2FoZWFkLnR5cGUgPT09IFRva2VuLkVPRikge1xuICAgICAgICAgICAgICAgIHJldHVybiBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGxleCgpO1xuICAgICAgICAgICAgd2hpbGUgKGxvb2thaGVhZC50eXBlICE9PSBUb2tlbi5FT0YpIHtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBsZXgoKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChsZXhFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmEuZXJyb3JzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWNvcmRFcnJvcihsZXhFcnJvcik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBoYXZlIHRvIGJyZWFrIG9uIHRoZSBmaXJzdCBlcnJvclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdG8gYXZvaWQgaW5maW5pdGUgbG9vcHMuXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGxleEVycm9yO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmVycm9ycyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICB0b2tlbnMuZXJyb3JzID0gZXh0cmEuZXJyb3JzO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9IGZpbmFsbHkge1xuICAgICAgICAgICAgZXh0cmEgPSB7fTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdG9rZW5zO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHBhcnNlKGNvZGUsIG9wdGlvbnMpIHtcbiAgICAgICAgdmFyIHByb2dyYW0sIHRvU3RyaW5nO1xuXG4gICAgICAgIHRvU3RyaW5nID0gU3RyaW5nO1xuICAgICAgICBpZiAodHlwZW9mIGNvZGUgIT09ICdzdHJpbmcnICYmICEoY29kZSBpbnN0YW5jZW9mIFN0cmluZykpIHtcbiAgICAgICAgICAgIGNvZGUgPSB0b1N0cmluZyhjb2RlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHNvdXJjZSA9IGNvZGU7XG4gICAgICAgIGluZGV4ID0gMDtcbiAgICAgICAgbGluZU51bWJlciA9IChzb3VyY2UubGVuZ3RoID4gMCk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W4nKSAmJiBvcHRpb25zLmF0dGFjaENvbW1lbnQ7XG5cbiAgICAgICAgICAgIGlmIChleHRyYS5sb2MgJiYgb3B0aW9ucy5zb3VyY2UgIT09IG51bGwgJiYgb3B0aW9ucy5zb3VyY2UgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLnNvdXJjZSA9IHRvU3RyaW5nKG9wdGlvbnMuc291cmNlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zLnRva2VucyA9PT0gJ2Jvb2xlYW4nICYmIG9wdGlvbnMudG9rZW5zKSB7XG4gICAgICAgICAgICAgICAgZXh0cmEudG9rZW5zID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuY29tbWVudCA9PT0gJ2Jvb2xlYW4nICYmIG9wdGlvbnMuY29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLmNvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMudG9sZXJhbnQgPT09ICdib29sZWFuJyAmJiBvcHRpb25zLnRvbGVyYW50KSB7XG4gICAgICAgICAgICAgICAgZXh0cmEuZXJyb3JzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXh0cmEuYXR0YWNoQ29tbWVudCkge1xuICAgICAgICAgICAgICAgIGV4dHJhLnJhbmdlID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBleHRyYS5jb21tZW50cyA9IFtdO1xuICAgICAgICAgICAgICAgIGV4dHJhLmJvdHRvbVJpZ2h0U3RhY2sgPSBbXTtcbiAgICAgICAgICAgICAgICBleHRyYS50cmFpbGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICAgICAgZXh0cmEubGVhZGluZ0NvbW1lbnRzID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5zb3VyY2VUeXBlID09PSAnbW9kdWxlJykge1xuICAgICAgICAgICAgICAgIC8vIHZlcnkgcmVzdHJpY3RpdmUgY29uZGl0aW9uIGZvciBub3dcbiAgICAgICAgICAgICAgICBzdGF0ZS5zb3VyY2VUeXBlID0gb3B0aW9ucy5zb3VyY2VUeXBlO1xuICAgICAgICAgICAgICAgIHN0cmljdCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcHJvZ3JhbSA9IHBhcnNlUHJvZ3JhbSgpO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBleHRyYS5jb21tZW50cyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmNvbW1lbnRzID0gZXh0cmEuY29tbWVudHM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLnRva2VucyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBmaWx0ZXJUb2tlbkxvY2F0aW9uKCk7XG4gICAgICAgICAgICAgICAgcHJvZ3JhbS50b2tlbnMgPSBleHRyYS50b2tlbnM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodHlwZW9mIGV4dHJhLmVycm9ycyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgICBwcm9ncmFtLmVycm9ycyA9IGV4dHJhLmVycm9ycztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgIGV4dHJhID0ge307XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcHJvZ3JhbTtcbiAgICB9XG5cbiAgICAvLyBTeW5jIHdpdGggKi5qc29uIG1hbmlmZXN0cy5cbiAgICBleHBvcnRzLnZlcnNpb24gPSAnMi43L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GFzT3duUHJvcGVydHkoc3BlY1Byb3ApICYmIHJlcy5wdXNoKHNwZWNQcm9wKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiByZXM7XG59XG5cbmZ1bmN0aW9uIG92ZXJyaWRlKGJhc2UsIHJlcywgYWRkKSB7XG4gICAgdmFyIGFkZExpc3QgPSBnZXRQcm9wTGlzdChhZGQpLFxuICAgICAgICBqID0gMCwgbGVuID0gYWRkTGlzdC5sZW5ndGgsXG4gICAgICAgIG5hbWUsIHByb3A7XG4gICAgd2hpbGUoaiA8IGxlbikge1xuICAgICAgICBpZigobmFtZSA9IGFkZExpc3RbaisrXSkgPT09ICdfX3NlbGYnKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfVxuICAgICAgICBwcm9wID0gYWRkW25hbWVdO1xuICAgICAgICBpZihpc0Z1bmN0aW9uKHByb3ApICYmXG4gICAgICAgICAgICAgICAgKCFoYXNJbnRyb3NwZWN0aW9uIHx8IHByb3AudG9TdHJpbmcoKS5pbmRleE9mKCcuX19iYXNlJykgPiAtMSkpIHtcbiAgICAgICAgICAgIHJlc1tuYW1lXSA9IChmdW5jdGlvbihuYW1lLCBwcm9wKSB7XG4gICAgICAgICAgICAgICAgdmFyIGJhc2VNZXRob2QgPSBiYXNlW25hbWVdP1xuICAgICAgICAgICAgICAgICAgICAgICAgYmFzZVtuYW1lXSA6XG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lID09PSAnX19jb25zdHJ1Y3Rvcic/IC8vIGNhc2Ugb2YgaW5oZXJpdGFuY2UgZnJvbSBwbGFuZSBmdW5jdGlvblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5fX3NlbGYuX19wYXJlbnQgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vT3A7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgYmFzZVNhdmVkID0gdGhpcy5fX2Jhc2U7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX19iYXNlID0gYmFzZU1ldGhvZDtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IHByb3AuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5fX2Jhc2UgPSBiYXNlU2F2ZWQ7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZXM7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH0pKG5hbWUsIHByb3ApO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmVzW25hbWVdID0gcHJvcDtcbiAgICAgICAgfVxuICAgIH1cbn1cblxuZnVuY3Rpb24gYXBwbHlNaXhpbnMobWl4aW5zLCByZXMpIHtcbiAgICB2YXIgaSA9IDEsIG1peGluO1xuICAgIHdoaWxlKG1peGluID0gbWl4aW5zW2krK10pIHtcbiAgICAgICAgcmVzP1xuICAgICAgICAgICAgaXNGdW5jdGlvbihtaXhpbik/XG4gICAgICAgICAgICAgICAgaW5oZXJpdC5zZWxmKHJlcywgbWl4aW4ucHJvdG90eXBlLCBtaXhpbikgOlxuICAgICAgICAgICAgICAgIGluaGVyaXQuc2VsZihyZXMsIG1peGluKSA6XG4gICAgICAgICAgICByZXMgPSBpc0Z1bmN0aW9uKG1peGluKT9cbiAgICAgICAgICAgICAgICBpbmhlcml0KG1peGluc1swXSwgbWl4aW4ucHJvdG90eXBlLCBtaXhpbikgOlxuICAgICAgICAgICAgICAgIGluaGVyaXQobWl4aW5zWzBdLCBtaXhpbik7XG4gICAgfVxuICAgIHJldHVybiByZXMgfHwgbWl4aW5zWzBdO1xufVxuXG4vKipcbiogQ3JlYXRlcyBjbGFzc1xuKiBAZXhwb3J0c1xuKiBAcGFyYW0ge0Z1bmN0aW9ufEFycmF5fSBbYmFzZUNsYXNzfGJhc2VDbGFzc0FuZE1peGluc10gY2xhc3MgKG9yIGNsYXNzIGFuZCB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gICAvLyBydW5zIGEgc2luZ2xlIGZ1bmN0aW9uIGluIHRoZSBhc3luYyBxdWV1ZVxuICAgIGZ1bmN0aW9uIHJ1blNpbmdsZSh0YXNrLCBkb21haW4pIHtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHRhc2soKTtcblxuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBpZiAoaXNOb2RlSlMpIHtcbiAgICAgICAgICAgICAgICAvLyBJbiBub2RlLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBjb25zaWRlcmVkIGZhdGFsIGVycm9ycy5cbiAgICAgICAgICAgICAgICAvLyBSZS10aHJvdyB0aGVtIHN5bmNocm9ub3VzbHkgdG8gaW50ZXJydXB0IGZsdXNoaW5nIVxuXG4gICAgICAgICAgICAgICAgLy8gRW5zdXJlIGNvbnRpbnVhdGlvbiBpZiB0aGUgdW5jYXVnaHQgZXhjZXB0aW9uIGlzIHN1cHByZXNzZWRcbiAgICAgICAgICAgICAgICAvLyBsaXN0ZW5pbmcgXCJ1bmNhdWdodEV4Y2VwdGlvblwiIGV2ZW50cyAoYXMgZG9tYWlucyBkb2VzKS5cbiAgICAgICAgICAgICAgICAvLyBDb250aW51ZSBpbiBuZXh0IGV2ZW50IHRvIGF2b2lkIHRpY2sgcmVjdXJzaW9uLlxuICAgICAgICAgICAgICAgIGlmIChkb21haW4pIHtcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgc2V0VGltZW91dChmbHVzaCwgMCk7XG4gICAgICAgICAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgICAgICAgICBkb21haW4uZW50ZXIoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIEluIGJyb3dzZXJzLCB1bmNhdWdodCBleGNlcHRpb25zIGFyZSBub3QgZmF0YWwuXG4gICAgICAgICAgICAgICAgLy8gUmUtdGhyb3cgdGhlbSBhc3luY2hyb25vdXNseSB0byBhdm9pZCBzbG93LWRvd25zLlxuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGRvbWFpbikge1xuICAgICAgICAgICAgZG9tYWluLmV4aXQoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG5leHRUaWNrID0gZnVuY3Rpb24gKHRhc2spIHtcbiAgICAgICAgdGFpbCA9IHRhaWwubmV4dCA9IHtcbiAgICAgICAgICAgIHRhc2s6IHRhc2ssXG4gICAgICAgICAgICBkb21haW46IGlzTm9kZUpTICYmIHByb2Nlc3MuZG9tYWluLFxuICAgICAgICAgICAgbmV4dDogbnVsbFxuICAgICAgICB9O1xuXG4gICAgICAgIGlmICghZmx1c2hpbmcpIHtcbiAgICAgICAgICAgIGZsdXNoaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHJlcXVlc3RUaWNrKCk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgaWYgKHR5cGVvZiBwcm9jZXNzID09PSBcIm9iamVjdFwiICYmXG4gICAgICAgIHByb2Nlc3MudG9TdHJpbmcoKSA9PT0gXCJbb2JqZWN0IHByb2Nlc3NdXCIgJiYgcHJvY2Vzcy5uZXh0VGljaykge1xuICAgICAgICAvLyBFbnN1cmUgUSBpcyBpbiBhIHJlYWwgTm9kZSBlbnZpcm9ubWVudCwgd2l0aCBhIGBwcm9jZXNzLm5leHRUaWNrYC5cbiAgICAgICAgLy8gVG8gc2VlIHRocm91Z2ggZmFrZSBOb2RlIGVudmlyb25tZW50czpcbiAgICAgICAgLy8gKiBNb2NoYSB0ZXN0IHJ1bm5lciA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gICAgICAgIGxlbmd0aCA9IHRoaXMubGVuZ3RoO1xuICAgICAgICAvLyBjb25jZXJuaW5nIHRoZSBpbml0aWFsIHZhbHVlLCBpZiBvbmUgaXMgbm90IHByb3ZpZGVkXG4gICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID09PSAxKSB7XG4gICAgICAgICAgICAvLyBzZWVrIHRvIHRoZSBmaXJzdCB2YWx1ZSBpbiB0aGUgYXJyYXksIGFjY291bnRpbmdcbiAgICAgICAgICAgIC8vIGZvciB0aGUgcG9zc2liaWxpdHkgdGhhdCBpcyBpcyBhIHNwYXJzZSBhcnJheVxuICAgICAgICAgICAgZG8ge1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCBpbiB0aGlzKSB7XG4gICAgICAgICAgICAgICAgICAgIGJhc2lzID0gdGhpc1tpbmRleCsrXTtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmICgrK2luZGV4ID49IGxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSB3aGlsZSAoMSk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gcmVkdWNlXG4gICAgICAgIGZvciAoOyBpbmRleCA8IGxlbmd0aDsgaW5kZXgrKykge1xuICAgICAgICAgICAgLy8gYWNjb3VudCBmb3IgdGhlIHBvc3NpYmlsaXR5IHRoYXQgdGhlIGFycmF5IGlzIHNwYXJzZVxuICAgICAgICAgICAgaWYgKGluZGV4IGluIHRoaXMpIHtcbiAgICAgICAgICAgICAgICBiYXNpcyA9IGNhbGxiYWNrKGJhc2lzLCB0aGlzW2luZGV4XSwgaW5kZXgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBiYXNpcztcbiAgICB9XG4pO1xuXG52YXIgYXJyYXlfaW5kZXhPZiA9IHV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VsZik7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHJldHVybiByZWplY3RlZChleGNlcHRpb24pO1xuICAgICAgICAgICAgfSBjYXRjaCAobmV3RXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChuZXdFeGNlcHRpb24pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfcHJvZ3Jlc3NlZCh2YWx1ZSkge1xuICAgICAgICByZXR1cm4gdHlwZW9mIHByb2dyZXNzZWQgPT09IFwiZnVuY3Rpb25cIiA/IHByb2dyZXNzZWQodmFsdWUpIDogdmFsdWU7XG4gICAgfVxuXG4gICAgUS5uZXh0VGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgIHNlbGYucHJvbWlzZURpc3BhdGNoKGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfZnVsZmlsbGVkKHZhbHVlKSk7XG4gICAgICAgIH0sIFwid2hlblwiLCBbZnVuY3Rpb24gKGV4Y2VwdGlvbikge1xuICAgICAgICAgICAgaWYgKGRvbmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBkb25lID0gdHJ1ZTtcblxuICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZShfcmVqZWN0ZWQoZXhjZXB0aW9uKSk7XG4gICAgICAgIH1dKTtcbiAgICB9KTtcblxuICAgIC8vIFByb2dyZXNzIHByb3BhZ2F0b3IgbmVlZCB0byBiZSBhdHRhY2hlZCBpbiB0aGUgY3VycmVudCB0aWNrLlxuICAgIHN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HRvIG1ha2UgaXQgcG9zc2libGUgdG8gdXNlIGdlbmVyYXRvcnMgaW4gZGVwbG95ZWQgYnJvd3NlcnMsIHNvXG4gICAgICAgICAgICAvLyB3ZSBhbHNvIHN1cHBvcnQgUHl0aG9uLXN0eWxlIGdlbmVyYXRvcnMuICBBdCBzb21lIHBvaW50IHdlIGNhbiByZW1vdmVcbiAgICAgICAgICAgIC8vIHRoaXMgYmxvY2suXG5cbiAgICAgICAgICAgIGlmICh0eXBlb2YgU3RvcEl0ZXJhdGlvbiA9PT0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICAgICAgICAgIC8vIEVTNiBHZW5lcmF0b3JzXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZ2VuZXJhdG9yW3ZlcmJdKGFyZyk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QoZXhjZXB0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5kb25lKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBRKHJlc3VsdC52YWx1ZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdoZW4ocmVzdWx0LnZhbHVlLCBjYWxsYmFjaywgZXJyYmFjayk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBTcGlkZXJNb25rZXkgR2VuZXJhdG9yc1xuICAgICAgICAgICAgICAgIC8vIEZJWE1FOiBSZW1vdmUgdGhpcyBjYXNlIHdoZW4gU00gZG9lcyBFUzYgZ2VuZXJhdG9ycy5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBnZW5lcmF0b3JbdmVyY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VmZXJyZWQgPSBkZWZlcigpO1xuICAgICAgICBhcnJheV9yZWR1Y2UocHJvbWlzZXMsIGZ1bmN0aW9uICh1bmRlZmluZWQsIHByb21pc2UsIGluZGV4KSB7XG4gICAgICAgICAgICB2YXIgc25hcHNob3Q7XG4gICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgaXNQcm9taXNlKHByb21pc2UpICYmXG4gICAgICAgICAgICAgICAgKHNuYXBzaG90ID0gcHJvbWlzZS5pbnNwZWN0KCkpLnN0YXRlID09PSBcImZ1bGZpbGxlZFwiXG4gICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSBzbmFwc2hvdC52YWx1ZTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgKytwZW5kaW5nQ291bnQ7XG4gICAgICAgICAgICAgICAgd2hlbihcbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSxcbiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlc1tpbmRleF0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLXBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUocHJvbWlzZXMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QsXG4gICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChwcm9ncmVzcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQubm90aWZ5KHsgaW5kZXg6IGluZGV4LCB2YWx1ZTogcHJvZ3Jlc3MgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfV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2VzW2luZGV4XTtcblxuICAgICAgICBwZW5kaW5nQ291bnQrKztcblxuICAgICAgICB3aGVuKHByb21pc2UsIG9uRnVsZmlsbGVkLCBvblJlamVjdGVkLCBvblByb2dyZXNzKTtcbiAgICAgICAgZnVuY3Rpb24gb25GdWxmaWxsZWQocmVzdWx0KSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKHJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgZnVuY3Rpb24gb25SZWplY3RlZCgpIHtcbiAgICAgICAgICAgIHBlbmRpbmdDb3VudC0tO1xuICAgICAgICAgICAgaWYgKHBlbmRpbmdDb3VudCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgICAgIFwiQ2FuJ3QgZ2V0IGZ1bGZpbGxtZW50IHZhbHVlIGZyb20gYW55IHByb21pc2UsIGFsbCBcIiArXG4gICAgICAgICAgICAgICAgICAgIFwicHJvbWlzZXMgd2VyZSByZWplY3RlZC5cIlxuICAgICAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGZ1bmN0aW9uIG9uUHJvZ3Jlc3MocHJvZ3Jlc3MpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLm5vdGlmeSh7XG4gICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBwcm9ncmVzc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9LCB1bmRlZmluZWQpO1xuXG4gICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG59XG5cblByb21pc2UucHJvdG90eXBlLmFueSA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gYW55KHRoaXMpO1xufTtcblxuLyoqXG4gKiBXYWl0cyBmb3IgYWxsIHByb21pc2VzIHRvIGJlIHNldHRsZWQsIGVpdGhlciBmdWxma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3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2pzb24nKVxuICogICAgICAgICAuc2VuZCgne1wibmFtZVwiOlwidGpcIn0nKVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGF1dG8ganNvblxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIG1hbnVhbCB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKCduYW1lPXRqJylcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC50eXBlKCdmb3JtJylcbiAqICAgICAgICAgLnNlbmQoeyBuYW1lOiAndGonIH0pXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gZGVmYXVsdHMgdG8geC13d3ctZm9ybS11cmxlbmNvZGVkXG4gICogICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAgKiAgICAgICAgLnNlbmQoJ25hbWU9dG9iaScpXG4gICogICAgICAgIC5zZW5kKCdzcGVjaWVzPWZlcnJldCcpXG4gICogICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogQHBhcmFtIHtTdHJpbmd8T2JqZWN0fSBkYXRhXG4gKiBAcmV0dXJuIHtSZXF1ZXN0fSBmb3IgY2hhaW5pbmdcbiAqIEBhcGkgcHVibGljXG4gKi9cblxuUmVxdWVzdC5wcm90b3R5cGUuc2VuZCA9IGZ1bmN0aW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GluZz9cbiAqL1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uKGFyciwgZm4sIGluaXRpYWwpeyAgXG4gIHZhciBpZHggPSAwO1xuICB2YXIgbGVuID0gYXJyLmxlbmd0aDtcbiAgdmFyIGN1cnIgPSBhcmd1bWVudHMubGVuZ3RoID09IDNcbiAgICA/IGluaXRpYWxcbiAgICA6IGFycltpZHgrK107XG5cbiAgd2hpbGUgKGlkeCA8IGxlbikge1xuICAgIGN1cnIgPSBmbi5jYWxsKG51bGwsIGN1cnIsIGFycltpZHhdLCArK2lkeCwgYXJyKTtcbiAgfVxuICBcbiAgcmV0dXJuIGN1cnI7XG59OyJdfQ==
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024619
Jian Li83d87a72016-04-20 15:38:24 -070024620 /*global JSONEditor*/
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024621'use strict';
24622
24623window.SwaggerUi = Backbone.Router.extend({
24624
24625 dom_id: 'swagger_ui',
24626
24627 // Attributes
24628 options: null,
24629 api: null,
24630 headerView: null,
24631 mainView: null,
24632
24633 // SwaggerUi accepts all the same options as SwaggerApi
24634 initialize: function(options) {
24635 options = options || {};
Jian Li83d87a72016-04-20 15:38:24 -070024636
24637 if (options.defaultModelRendering !== 'model') {
24638 options.defaultModelRendering = 'schema';
24639 }
24640
24641 if (!options.highlightSizeThreshold) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024642 options.highlightSizeThreshold = 100000;
24643 }
24644
24645 // Allow dom_id to be overridden
24646 if (options.dom_id) {
24647 this.dom_id = options.dom_id;
24648 delete options.dom_id;
24649 }
24650
24651 if (!options.supportedSubmitMethods){
24652 options.supportedSubmitMethods = [
24653 'get',
24654 'put',
24655 'post',
24656 'delete',
24657 'head',
24658 'options',
24659 'patch'
24660 ];
24661 }
24662
24663 if (typeof options.oauth2RedirectUrl === 'string') {
24664 window.oAuthRedirectUrl = options.redirectUrl;
24665 }
24666
24667 // Create an empty div which contains the dom_id
24668 if (! $('#' + this.dom_id).length){
24669 $('body').append('<div id="' + this.dom_id + '"></div>') ;
24670 }
24671
24672 this.options = options;
24673
24674 // set marked options
24675 marked.setOptions({gfm: true});
24676
24677 // Set the callbacks
24678 var that = this;
24679 this.options.success = function() { return that.render(); };
24680 this.options.progress = function(d) { return that.showMessage(d); };
24681 this.options.failure = function(d) { return that.onLoadFailure(d); };
24682
24683 // Create view to handle the header inputs
24684 this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});
24685
24686 // Event handler for when the baseUrl/apiKey is entered by user
24687 this.headerView.on('update-swagger-ui', function(data) {
24688 return that.updateSwaggerUi(data);
24689 });
Jian Li83d87a72016-04-20 15:38:24 -070024690
24691 // JSon Editor custom theming
24692 JSONEditor.defaults.iconlibs.swagger = JSONEditor.AbstractIconLib.extend({
24693 mapping: {
24694 collapse: 'collapse',
24695 expand: 'expand'
24696 },
24697 icon_prefix: 'swagger-'
24698 });
24699
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024700 },
24701
24702 // Set an option after initializing
24703 setOption: function(option, value) {
24704 this.options[option] = value;
24705 },
24706
24707 // Get the value of a previously set option
24708 getOption: function(option) {
24709 return this.options[option];
24710 },
24711
24712 // Event handler for when url/key is received from user
24713 updateSwaggerUi: function(data){
24714 this.options.url = data.url;
24715 this.load();
24716 },
24717
24718 // Create an api and render
24719 load: function(){
24720 // Initialize the API object
24721 if (this.mainView) {
24722 this.mainView.clear();
24723 }
24724 var url = this.options.url;
24725 if (url && url.indexOf('http') !== 0) {
24726 url = this.buildUrl(window.location.href.toString(), url);
24727 }
24728 if(this.api) {
24729 this.options.authorizations = this.api.clientAuthorizations.authz;
24730 }
24731 this.options.url = url;
24732 this.headerView.update(url);
24733
24734 this.api = new SwaggerClient(this.options);
24735 },
24736
24737 // collapse all sections
24738 collapseAll: function(){
24739 Docs.collapseEndpointListForResource('');
24740 },
24741
24742 // list operations for all sections
24743 listAll: function(){
24744 Docs.collapseOperationsForResource('');
24745 },
24746
24747 // expand operations for all sections
24748 expandAll: function(){
24749 Docs.expandOperationsForResource('');
24750 },
24751
24752 // This is bound to success handler for SwaggerApi
24753 // so it gets called when SwaggerApi completes loading
24754 render: function(){
24755 this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
24756 this.mainView = new SwaggerUi.Views.MainView({
24757 model: this.api,
24758 el: $('#' + this.dom_id),
24759 swaggerOptions: this.options,
24760 router: this
24761 }).render();
24762 this.showMessage();
24763 switch (this.options.docExpansion) {
24764 case 'full':
24765 this.expandAll(); break;
24766 case 'list':
24767 this.listAll(); break;
24768 default:
24769 break;
24770 }
24771 this.renderGFM();
24772
24773 if (this.options.onComplete){
24774 this.options.onComplete(this.api, this);
24775 }
24776
24777 setTimeout(Docs.shebang.bind(this), 100);
24778 },
24779
24780 buildUrl: function(base, url){
24781 if (url.indexOf('/') === 0) {
24782 var parts = base.split('/');
24783 base = parts[0] + '//' + parts[2];
24784 return base + url;
24785 } else {
24786 var endOfPath = base.length;
24787
24788 if (base.indexOf('?') > -1){
24789 endOfPath = Math.min(endOfPath, base.indexOf('?'));
24790 }
24791
24792 if (base.indexOf('#') > -1){
24793 endOfPath = Math.min(endOfPath, base.indexOf('#'));
24794 }
24795
24796 base = base.substring(0, endOfPath);
24797
24798 if (base.indexOf('/', base.length - 1 ) !== -1){
24799 return base + url;
24800 }
24801
24802 return base + '/' + url;
24803 }
24804 },
24805
24806 // Shows message on topbar of the ui
24807 showMessage: function(data){
24808 if (data === undefined) {
24809 data = '';
24810 }
Jian Li83d87a72016-04-20 15:38:24 -070024811 var $msgbar = $('#message-bar');
24812 $msgbar.removeClass('message-fail');
24813 $msgbar.addClass('message-success');
24814 $msgbar.text(data);
24815 if(window.SwaggerTranslator) {
24816 window.SwaggerTranslator.translate($msgbar);
24817 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024818 },
24819
24820 // shows message in red
24821 onLoadFailure: function(data){
24822 if (data === undefined) {
24823 data = '';
24824 }
24825 $('#message-bar').removeClass('message-success');
24826 $('#message-bar').addClass('message-fail');
24827
24828 var val = $('#message-bar').text(data);
24829
24830 if (this.options.onFailure) {
24831 this.options.onFailure(data);
24832 }
24833
24834 return val;
24835 },
24836
24837 // Renders GFM for elements with 'markdown' class
24838 renderGFM: function(){
24839 $('.markdown').each(function(){
24840 $(this).html(marked($(this).html()));
24841 });
24842
24843 $('.propDesc', '.model-signature .description').each(function () {
24844 $(this).html(marked($(this).html())).addClass('markdown');
24845 });
24846 }
24847
24848});
24849
24850window.SwaggerUi.Views = {};
24851
24852// don't break backward compatibility with previous versions and warn users to upgrade their code
24853(function(){
24854 window.authorizations = {
24855 add: function() {
24856 warn('Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add().');
24857
24858 if (typeof window.swaggerUi === 'undefined') {
24859 throw new TypeError('window.swaggerUi is not defined');
24860 }
24861
24862 if (window.swaggerUi instanceof SwaggerUi) {
24863 window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments);
24864 }
24865 }
24866 };
24867
24868 window.ApiKeyAuthorization = function() {
24869 warn('window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.');
24870 SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
24871 };
24872
24873 window.PasswordAuthorization = function() {
24874 warn('window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization.');
24875 SwaggerClient.PasswordAuthorization.apply(window, arguments);
24876 };
24877
24878 function warn(message) {
24879 if ('console' in window && typeof window.console.warn === 'function') {
24880 console.warn(message);
24881 }
24882 }
24883})();
24884
24885
24886// UMD
24887(function (root, factory) {
24888 if (typeof define === 'function' && define.amd) {
24889 // AMD. Register as an anonymous module.
24890 define(['b'], function (b) {
24891 return (root.SwaggerUi = factory(b));
24892 });
24893 } else if (typeof exports === 'object') {
24894 // Node. Does not work with strict CommonJS, but
Jian Li83d87a72016-04-20 15:38:24 -070024895 // only CommonJS-like environments that support module.exports,
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024896 // like Node.
24897 module.exports = factory(require('b'));
24898 } else {
24899 // Browser globals
24900 root.SwaggerUi = factory(root.b);
24901 }
24902}(this, function () {
24903 return SwaggerUi;
24904}));
24905
24906'use strict';
24907
24908SwaggerUi.Views.ApiKeyButton = Backbone.View.extend({ // TODO: append this to global SwaggerUi
24909
24910 events:{
24911 'click #apikey_button' : 'toggleApiKeyContainer',
24912 'click #apply_api_key' : 'applyApiKey'
24913 },
24914
24915 initialize: function(opts){
24916 this.options = opts || {};
24917 this.router = this.options.router;
24918 },
24919
24920 render: function(){
24921 var template = this.template();
24922 $(this.el).html(template(this.model));
24923
24924 return this;
24925 },
24926
24927
24928 applyApiKey: function(){
24929 var keyAuth = new SwaggerClient.ApiKeyAuthorization(
24930 this.model.name,
24931 $('#input_apiKey_entry').val(),
24932 this.model.in
24933 );
24934 this.router.api.clientAuthorizations.add(this.model.name, keyAuth);
24935 this.router.load();
24936 $('#apikey_container').show();
24937 },
24938
24939 toggleApiKeyContainer: function(){
24940 if ($('#apikey_container').length) {
24941
24942 var elem = $('#apikey_container').first();
24943
24944 if (elem.is(':visible')){
24945 elem.hide();
24946 } else {
24947
24948 // hide others
24949 $('.auth_container').hide();
24950 elem.show();
24951 }
24952 }
24953 },
24954
24955 template: function(){
24956 return Handlebars.templates.apikey_button_view;
24957 }
24958
24959});
24960'use strict';
24961
24962SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
24963
24964
24965 initialize: function (opts) {
24966 this.options = opts || {};
24967 this.router = this.options.router;
24968 },
24969
24970 render: function(){
24971 var template = this.template();
24972 $(this.el).html(template(this.model));
24973
24974 return this;
24975 },
24976
24977 events: {
24978 'click #basic_auth_button' : 'togglePasswordContainer',
24979 'click #apply_basic_auth' : 'applyPassword'
24980 },
24981
Jian Li83d87a72016-04-20 15:38:24 -070024982 applyPassword: function(event){
24983 event.preventDefault();
24984 var username = $('#input_username').val();
24985 var password = $('#input_password').val();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070024986 var basicAuth = new SwaggerClient.PasswordAuthorization('basic', username, password);
24987 this.router.api.clientAuthorizations.add(this.model.type, basicAuth);
24988 this.router.load();
24989 $('#basic_auth_container').hide();
24990 },
24991
24992 togglePasswordContainer: function(){
24993 if ($('#basic_auth_container').length) {
24994 var elem = $('#basic_auth_container').show();
24995 if (elem.is(':visible')){
24996 elem.slideUp();
24997 } else {
24998 // hide others
24999 $('.auth_container').hide();
25000 elem.show();
25001 }
25002 }
25003 },
25004
25005 template: function(){
25006 return Handlebars.templates.basic_auth_button_view;
25007 }
25008
25009});
25010'use strict';
25011
25012SwaggerUi.Views.ContentTypeView = Backbone.View.extend({
25013 initialize: function() {},
25014
25015 render: function(){
25016 this.model.contentTypeId = 'ct' + Math.random();
25017 $(this.el).html(Handlebars.templates.content_type(this.model));
25018 return this;
25019 }
25020});
25021'use strict';
25022
25023SwaggerUi.Views.HeaderView = Backbone.View.extend({
25024 events: {
25025 'click #show-pet-store-icon' : 'showPetStore',
25026 'click #explore' : 'showCustom',
25027 'keyup #input_baseUrl' : 'showCustomOnKeyup',
25028 'keyup #input_apiKey' : 'showCustomOnKeyup'
25029 },
25030
25031 initialize: function(){},
25032
25033 showPetStore: function(){
25034 this.trigger('update-swagger-ui', {
25035 url:'http://petstore.swagger.io/v2/swagger.json'
25036 });
25037 },
25038
25039 showCustomOnKeyup: function(e){
25040 if (e.keyCode === 13) {
25041 this.showCustom();
25042 }
25043 },
25044
25045 showCustom: function(e){
25046 if (e) {
25047 e.preventDefault();
25048 }
25049
25050 this.trigger('update-swagger-ui', {
25051 url: $('#input_baseUrl').val(),
25052 apiKey: $('#input_apiKey').val()
25053 });
25054 },
25055
25056 update: function(url, apiKey, trigger){
25057 if (trigger === undefined) {
25058 trigger = false;
25059 }
25060
25061 $('#input_baseUrl').val(url);
25062
25063 //$('#input_apiKey').val(apiKey);
25064 if (trigger) {
25065 this.trigger('update-swagger-ui', {url:url});
25066 }
25067 }
25068});
25069
25070'use strict';
25071
25072SwaggerUi.Views.MainView = Backbone.View.extend({
25073 apisSorter : {
25074 alpha : function(a,b){ return a.name.localeCompare(b.name); }
25075 },
25076 operationsSorters : {
25077 alpha : function(a,b){ return a.path.localeCompare(b.path); },
25078 method : function(a,b){ return a.method.localeCompare(b.method); }
25079 },
25080 initialize: function(opts){
25081 var sorterOption, sorterFn, key, value;
25082 opts = opts || {};
25083
25084 this.router = opts.router;
25085
25086 // Sort APIs
25087 if (opts.swaggerOptions.apisSorter) {
25088 sorterOption = opts.swaggerOptions.apisSorter;
25089 if (_.isFunction(sorterOption)) {
25090 sorterFn = sorterOption;
25091 } else {
25092 sorterFn = this.apisSorter[sorterOption];
25093 }
25094 if (_.isFunction(sorterFn)) {
25095 this.model.apisArray.sort(sorterFn);
25096 }
25097 }
25098 // Sort operations of each API
25099 if (opts.swaggerOptions.operationsSorter) {
25100 sorterOption = opts.swaggerOptions.operationsSorter;
25101 if (_.isFunction(sorterOption)) {
25102 sorterFn = sorterOption;
25103 } else {
25104 sorterFn = this.operationsSorters[sorterOption];
25105 }
25106 if (_.isFunction(sorterFn)) {
25107 for (key in this.model.apisArray) {
25108 this.model.apisArray[key].operationsArray.sort(sorterFn);
25109 }
25110 }
25111 }
25112
25113 // set up the UI for input
25114 this.model.auths = [];
25115
25116 for (key in this.model.securityDefinitions) {
25117 value = this.model.securityDefinitions[key];
25118
25119 this.model.auths.push({
25120 name: key,
25121 type: value.type,
25122 value: value
25123 });
25124 }
25125
25126 if ('validatorUrl' in opts.swaggerOptions) {
25127 // Validator URL specified explicitly
25128 this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
25129 } else if (this.model.url.indexOf('localhost') > 0) {
25130 // Localhost override
25131 this.model.validatorUrl = null;
25132 } else {
25133 // Default validator
Jian Li83d87a72016-04-20 15:38:24 -070025134 if(window.location.protocol === 'https:') {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025135 this.model.validatorUrl = 'https://online.swagger.io/validator';
25136 }
25137 else {
25138 this.model.validatorUrl = 'http://online.swagger.io/validator';
25139 }
25140 }
Jian Li83d87a72016-04-20 15:38:24 -070025141
25142 // JSonEditor requires type='object' to be present on defined types, we add it if it's missing
25143 // is there any valid case were it should not be added ?
25144 var def;
25145 for(def in this.model.definitions){
25146 if (!this.model.definitions[def].type){
25147 this.model.definitions[def].type = 'object';
25148 }
25149 }
25150
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025151 },
25152
25153 render: function(){
25154 if (this.model.securityDefinitions) {
25155 for (var name in this.model.securityDefinitions) {
25156 var auth = this.model.securityDefinitions[name];
25157 var button;
25158
25159 if (auth.type === 'apiKey' && $('#apikey_button').length === 0) {
25160 button = new SwaggerUi.Views.ApiKeyButton({model: auth, router: this.router}).render().el;
25161 $('.auth_main_container').append(button);
25162 }
25163
25164 if (auth.type === 'basicAuth' && $('#basic_auth_button').length === 0) {
25165 button = new SwaggerUi.Views.BasicAuthButton({model: auth, router: this.router}).render().el;
25166 $('.auth_main_container').append(button);
25167 }
25168 }
25169 }
25170
25171 // Render the outer container for resources
25172 $(this.el).html(Handlebars.templates.main(this.model));
25173
25174 // Render each resource
25175
25176 var resources = {};
25177 var counter = 0;
25178 for (var i = 0; i < this.model.apisArray.length; i++) {
25179 var resource = this.model.apisArray[i];
25180 var id = resource.name;
25181 while (typeof resources[id] !== 'undefined') {
25182 id = id + '_' + counter;
25183 counter += 1;
25184 }
25185 resource.id = id;
25186 resources[id] = resource;
25187 this.addResource(resource, this.model.auths);
25188 }
25189
25190 $('.propWrap').hover(function onHover(){
25191 $('.optionsWrapper', $(this)).show();
25192 }, function offhover(){
25193 $('.optionsWrapper', $(this)).hide();
25194 });
25195 return this;
25196 },
25197
25198 addResource: function(resource, auths){
25199 // Render a resource and add it to resources li
25200 resource.id = resource.id.replace(/\s/g, '_');
Jian Li83d87a72016-04-20 15:38:24 -070025201
25202 // Make all definitions available at the root of the resource so that they can
25203 // be loaded by the JSonEditor
25204 resource.definitions = this.model.definitions;
25205
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025206 var resourceView = new SwaggerUi.Views.ResourceView({
25207 model: resource,
25208 router: this.router,
25209 tagName: 'li',
25210 id: 'resource_' + resource.id,
25211 className: 'resource',
25212 auths: auths,
25213 swaggerOptions: this.options.swaggerOptions
25214 });
25215 $('#resources', this.el).append(resourceView.render().el);
25216 },
25217
25218 clear: function(){
25219 $(this.el).html('');
25220 }
25221});
25222
25223'use strict';
25224
25225SwaggerUi.Views.OperationView = Backbone.View.extend({
25226 invocationUrl: null,
25227
25228 events: {
25229 'submit .sandbox' : 'submitOperation',
25230 'click .submit' : 'submitOperation',
25231 'click .response_hider' : 'hideResponse',
25232 'click .toggleOperation' : 'toggleOperationContent',
25233 'mouseenter .api-ic' : 'mouseEnter',
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025234 'dblclick .curl' : 'selectText',
25235 },
25236
25237 initialize: function(opts) {
25238 opts = opts || {};
25239 this.router = opts.router;
25240 this.auths = opts.auths;
25241 this.parentId = this.model.parentId;
25242 this.nickname = this.model.nickname;
25243 this.model.encodedParentId = encodeURIComponent(this.parentId);
Jian Li83d87a72016-04-20 15:38:24 -070025244
25245 if (opts.swaggerOptions) {
25246 this.model.defaultRendering = opts.swaggerOptions.defaultModelRendering;
25247
25248 if (opts.swaggerOptions.showRequestHeaders) {
25249 this.model.showRequestHeaders = true;
25250 }
25251 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025252 return this;
25253 },
25254
25255 selectText: function(event) {
25256 var doc = document,
25257 text = event.target.firstChild,
25258 range,
25259 selection;
25260 if (doc.body.createTextRange) {
25261 range = document.body.createTextRange();
25262 range.moveToElementText(text);
25263 range.select();
25264 } else if (window.getSelection) {
Jian Li83d87a72016-04-20 15:38:24 -070025265 selection = window.getSelection();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025266 range = document.createRange();
25267 range.selectNodeContents(text);
25268 selection.removeAllRanges();
25269 selection.addRange(range);
25270 }
25271 },
25272
25273 mouseEnter: function(e) {
25274 var elem = $(this.el).find('.content');
25275 var x = e.pageX;
25276 var y = e.pageY;
25277 var scX = $(window).scrollLeft();
25278 var scY = $(window).scrollTop();
25279 var scMaxX = scX + $(window).width();
25280 var scMaxY = scY + $(window).height();
25281 var wd = elem.width();
25282 var hgh = elem.height();
25283
25284 if (x + wd > scMaxX) {
25285 x = scMaxX - wd;
25286 }
25287
25288 if (x < scX) {
25289 x = scX;
25290 }
25291
25292 if (y + hgh > scMaxY) {
25293 y = scMaxY - hgh;
25294 }
25295
25296 if (y < scY) {
25297 y = scY;
25298 }
25299
25300 var pos = {};
25301 pos.top = y;
25302 pos.left = x;
25303 elem.css(pos);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025304 },
25305
25306 // Note: copied from CoffeeScript compiled file
25307 // TODO: redactor
25308 render: function() {
25309 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;
25310 isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
25311 if (!isMethodSubmissionSupported) {
25312 this.model.isReadOnly = true;
25313 }
25314 this.model.description = this.model.description || this.model.notes;
25315 this.model.oauth = null;
25316 modelAuths = this.model.authorizations || this.model.security;
25317 if (modelAuths) {
25318 if (Array.isArray(modelAuths)) {
25319 for (l = 0, len = modelAuths.length; l < len; l++) {
25320 auths = modelAuths[l];
25321 for (key in auths) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025322 for (a in this.auths) {
25323 auth = this.auths[a];
Jian Li83d87a72016-04-20 15:38:24 -070025324 if (key === auth.name) {
25325 if (auth.type === 'oauth2') {
25326 this.model.oauth = {};
25327 this.model.oauth.scopes = [];
25328 ref1 = auth.value.scopes;
25329 for (k in ref1) {
25330 v = ref1[k];
25331 scopeIndex = auths[key].indexOf(k);
25332 if (scopeIndex >= 0) {
25333 o = {
25334 scope: k,
25335 description: v
25336 };
25337 this.model.oauth.scopes.push(o);
25338 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025339 }
25340 }
25341 }
25342 }
25343 }
25344 }
25345 } else {
25346 for (k in modelAuths) {
25347 v = modelAuths[k];
25348 if (k === 'oauth2') {
25349 if (this.model.oauth === null) {
25350 this.model.oauth = {};
25351 }
25352 if (this.model.oauth.scopes === void 0) {
25353 this.model.oauth.scopes = [];
25354 }
25355 for (m = 0, len1 = v.length; m < len1; m++) {
25356 o = v[m];
25357 this.model.oauth.scopes.push(o);
25358 }
25359 }
25360 }
25361 }
25362 }
25363 if (typeof this.model.responses !== 'undefined') {
25364 this.model.responseMessages = [];
25365 ref2 = this.model.responses;
25366 for (code in ref2) {
25367 value = ref2[code];
25368 schema = null;
25369 schemaObj = this.model.responses[code].schema;
25370 if (schemaObj && schemaObj.$ref) {
25371 schema = schemaObj.$ref;
Jian Li83d87a72016-04-20 15:38:24 -070025372 if (schema.indexOf('#/definitions/') !== -1) {
25373 schema = schema.replace(/^.*#\/definitions\//, '');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025374 }
25375 }
25376 this.model.responseMessages.push({
25377 code: code,
25378 message: value.description,
Jian Li83d87a72016-04-20 15:38:24 -070025379 responseModel: schema,
25380 headers: value.headers
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025381 });
25382 }
25383 }
25384 if (typeof this.model.responseMessages === 'undefined') {
25385 this.model.responseMessages = [];
25386 }
25387 signatureModel = null;
25388 if (this.model.successResponse) {
25389 successResponse = this.model.successResponse;
25390 for (key in successResponse) {
25391 value = successResponse[key];
25392 this.model.successCode = key;
25393 if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
Jian Li83d87a72016-04-20 15:38:24 -070025394 this.model.successDescription = value.description;
25395 this.model.headers = this.parseResponseHeaders(value.headers);
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025396 signatureModel = {
25397 sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
25398 isParam: false,
25399 signature: value.getMockSignature()
25400 };
25401 }
25402 }
25403 } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
25404 signatureModel = {
25405 sampleJSON: this.model.responseSampleJSON,
25406 isParam: false,
25407 signature: this.model.responseClassSignature
25408 };
25409 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025410 $(this.el).html(Handlebars.templates.operation(this.model));
25411 if (signatureModel) {
Jian Li83d87a72016-04-20 15:38:24 -070025412 signatureModel.defaultRendering = this.model.defaultRendering;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025413 responseSignatureView = new SwaggerUi.Views.SignatureView({
25414 model: signatureModel,
25415 router: this.router,
25416 tagName: 'div'
25417 });
25418 $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
25419 } else {
25420 this.model.responseClassSignature = 'string';
25421 $('.model-signature', $(this.el)).html(this.model.type);
25422 }
25423 contentTypeModel = {
25424 isParam: false
25425 };
25426 contentTypeModel.consumes = this.model.consumes;
25427 contentTypeModel.produces = this.model.produces;
25428 ref3 = this.model.parameters;
25429 for (n = 0, len2 = ref3.length; n < len2; n++) {
25430 param = ref3[n];
25431 type = param.type || param.dataType || '';
25432 if (typeof type === 'undefined') {
25433 schema = param.schema;
25434 if (schema && schema.$ref) {
25435 ref = schema.$ref;
25436 if (ref.indexOf('#/definitions/') === 0) {
25437 type = ref.substring('#/definitions/'.length);
25438 } else {
25439 type = ref;
25440 }
25441 }
25442 }
25443 if (type && type.toLowerCase() === 'file') {
25444 if (!contentTypeModel.consumes) {
25445 contentTypeModel.consumes = 'multipart/form-data';
25446 }
25447 }
25448 param.type = type;
25449 }
25450 responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({
25451 model: contentTypeModel,
25452 router: this.router
25453 });
25454 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
25455 ref4 = this.model.parameters;
25456 for (p = 0, len3 = ref4.length; p < len3; p++) {
25457 param = ref4[p];
25458 this.addParameter(param, contentTypeModel.consumes);
25459 }
25460 ref5 = this.model.responseMessages;
25461 for (q = 0, len4 = ref5.length; q < len4; q++) {
25462 statusCode = ref5[q];
25463 this.addStatusCode(statusCode);
25464 }
25465 return this;
25466 },
25467
Jian Li83d87a72016-04-20 15:38:24 -070025468 parseResponseHeaders: function (data) {
25469 var HEADERS_SEPARATOR = '; ';
25470 var headers = _.clone(data);
25471
25472 _.forEach(headers, function (header) {
25473 var other = [];
25474 _.forEach(header, function (value, key) {
25475 var properties = ['type', 'description'];
25476 if (properties.indexOf(key.toLowerCase()) === -1) {
25477 other.push(key + ': ' + value);
25478 }
25479 });
25480
25481 other.join(HEADERS_SEPARATOR);
25482 header.other = other;
25483 });
25484
25485 return headers;
25486 },
25487
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025488 addParameter: function(param, consumes) {
25489 // Render a parameter
25490 param.consumes = consumes;
Jian Li83d87a72016-04-20 15:38:24 -070025491 param.defaultRendering = this.model.defaultRendering;
25492
25493 // Copy this param JSON spec so that it will be available for JsonEditor
25494 if(param.schema){
25495 $.extend(true, param.schema, this.model.definitions[param.type]);
25496 param.schema.definitions = this.model.definitions;
25497 // This is required for JsonEditor to display the root properly
25498 if(!param.schema.type){
25499 param.schema.type = 'object';
25500 }
25501 // This is the title that will be used by JsonEditor for the root
25502 // Since we already display the parameter's name in the Parameter column
25503 // We set this to space, we can't set it to null or space otherwise JsonEditor
25504 // will replace it with the text "root" which won't look good on screen
25505 if(!param.schema.title){
25506 param.schema.title = ' ';
25507 }
25508 }
25509
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025510 var paramView = new SwaggerUi.Views.ParameterView({
25511 model: param,
25512 tagName: 'tr',
Jian Li83d87a72016-04-20 15:38:24 -070025513 readOnly: this.model.isReadOnly,
25514 swaggerOptions: this.options.swaggerOptions
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025515 });
25516 $('.operation-params', $(this.el)).append(paramView.render().el);
25517 },
25518
25519 addStatusCode: function(statusCode) {
25520 // Render status codes
Jian Li83d87a72016-04-20 15:38:24 -070025521 statusCode.defaultRendering = this.model.defaultRendering;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025522 var statusCodeView = new SwaggerUi.Views.StatusCodeView({
25523 model: statusCode,
25524 tagName: 'tr',
25525 router: this.router
25526 });
25527 $('.operation-status', $(this.el)).append(statusCodeView.render().el);
25528 },
25529
25530 // Note: copied from CoffeeScript compiled file
25531 // TODO: redactor
25532 submitOperation: function(e) {
25533 var error_free, form, isFileUpload, map, opts;
25534 if (e !== null) {
25535 e.preventDefault();
25536 }
25537 form = $('.sandbox', $(this.el));
25538 error_free = true;
25539 form.find('input.required').each(function() {
25540 $(this).removeClass('error');
25541 if (jQuery.trim($(this).val()) === '') {
25542 $(this).addClass('error');
25543 $(this).wiggle({
25544 callback: (function(_this) {
25545 return function() {
25546 $(_this).focus();
25547 };
25548 })(this)
25549 });
25550 error_free = false;
25551 }
25552 });
Jian Li83d87a72016-04-20 15:38:24 -070025553 form.find('textarea.required:visible').each(function() {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025554 $(this).removeClass('error');
25555 if (jQuery.trim($(this).val()) === '') {
25556 $(this).addClass('error');
25557 $(this).wiggle({
25558 callback: (function(_this) {
25559 return function() {
25560 return $(_this).focus();
25561 };
25562 })(this)
25563 });
25564 error_free = false;
25565 }
25566 });
25567 form.find('select.required').each(function() {
25568 $(this).removeClass('error');
25569 if (this.selectedIndex === -1) {
25570 $(this).addClass('error');
25571 $(this).wiggle({
25572 callback: (function(_this) {
25573 return function() {
25574 $(_this).focus();
25575 };
25576 })(this)
25577 });
25578 error_free = false;
25579 }
25580 });
25581 if (error_free) {
25582 map = this.getInputMap(form);
25583 isFileUpload = this.isFileUpload(form);
25584 opts = {
25585 parent: this
25586 };
25587 if (this.options.swaggerOptions) {
25588 for(var key in this.options.swaggerOptions) {
25589 opts[key] = this.options.swaggerOptions[key];
25590 }
25591 }
Jian Li83d87a72016-04-20 15:38:24 -070025592
25593 var pi;
25594 for(pi = 0; pi < this.model.parameters.length; pi++){
25595 var p = this.model.parameters[pi];
25596 if( p.jsonEditor && p.jsonEditor.isEnabled()){
25597 var json = p.jsonEditor.getValue();
25598 map[p.name] = JSON.stringify(json);
25599 }
25600 }
25601
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025602 opts.responseContentType = $('div select[name=responseContentType]', $(this.el)).val();
25603 opts.requestContentType = $('div select[name=parameterContentType]', $(this.el)).val();
25604 $('.response_throbber', $(this.el)).show();
25605 if (isFileUpload) {
25606 $('.request_url', $(this.el)).html('<pre></pre>');
25607 $('.request_url pre', $(this.el)).text(this.invocationUrl);
25608
25609 opts.useJQuery = true;
25610 map.parameterContentType = 'multipart/form-data';
Jian Li83d87a72016-04-20 15:38:24 -070025611 this.map = map;
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025612 return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
25613 } else {
25614 this.map = map;
25615 return this.model.execute(map, opts, this.showCompleteStatus, this.showErrorStatus, this);
25616 }
25617 }
25618 },
25619
25620 getInputMap: function (form) {
25621 var map, ref1, l, len, o, ref2, m, len1, val, ref3, n, len2;
25622 map = {};
25623 ref1 = form.find('input');
25624 for (l = 0, len = ref1.length; l < len; l++) {
25625 o = ref1[l];
25626 if ((o.value !== null) && jQuery.trim(o.value).length > 0) {
25627 map[o.name] = o.value;
25628 }
25629 if (o.type === 'file') {
25630 map[o.name] = o.files[0];
25631 }
25632 }
25633 ref2 = form.find('textarea');
25634 for (m = 0, len1 = ref2.length; m < len1; m++) {
25635 o = ref2[m];
25636 val = this.getTextAreaValue(o);
25637 if ((val !== null) && jQuery.trim(val).length > 0) {
25638 map[o.name] = val;
25639 }
25640 }
25641 ref3 = form.find('select');
25642 for (n = 0, len2 = ref3.length; n < len2; n++) {
25643 o = ref3[n];
25644 val = this.getSelectedValue(o);
25645 if ((val !== null) && jQuery.trim(val).length > 0) {
25646 map[o.name] = val;
25647 }
25648 }
25649 return map;
25650 },
25651
25652 isFileUpload: function (form) {
25653 var ref1, l, len, o;
25654 var isFileUpload = false;
25655 ref1 = form.find('input');
25656 for (l = 0, len = ref1.length; l < len; l++) {
25657 o = ref1[l];
25658 if (o.type === 'file') {
25659 isFileUpload = true;
25660 }
25661 }
25662 return isFileUpload;
25663 },
25664
25665 success: function(response, parent) {
25666 parent.showCompleteStatus(response);
25667 },
25668
25669 // wraps a jquery response as a shred response
25670 wrap: function(data) {
25671 var h, headerArray, headers, i, l, len, o;
25672 headers = {};
25673 headerArray = data.getAllResponseHeaders().split('\r');
25674 for (l = 0, len = headerArray.length; l < len; l++) {
25675 i = headerArray[l];
25676 h = i.match(/^([^:]*?):(.*)$/);
25677 if (!h) {
25678 h = [];
25679 }
25680 h.shift();
25681 if (h[0] !== void 0 && h[1] !== void 0) {
25682 headers[h[0].trim()] = h[1].trim();
25683 }
25684 }
25685 o = {};
25686 o.content = {};
25687 o.content.data = data.responseText;
25688 o.headers = headers;
25689 o.request = {};
25690 o.request.url = this.invocationUrl;
25691 o.status = data.status;
25692 return o;
25693 },
25694
25695 getSelectedValue: function(select) {
25696 if (!select.multiple) {
25697 return select.value;
25698 } else {
25699 var options = [];
25700 for (var l = 0, len = select.options.length; l < len; l++) {
25701 var opt = select.options[l];
25702 if (opt.selected) {
25703 options.push(opt.value);
25704 }
25705 }
25706 if (options.length > 0) {
25707 return options;
25708 } else {
25709 return null;
25710 }
25711 }
25712 },
25713
25714 // handler for hide response link
25715 hideResponse: function(e) {
25716 if (e) { e.preventDefault(); }
25717 $('.response', $(this.el)).slideUp();
25718 $('.response_hider', $(this.el)).fadeOut();
25719 },
25720
25721 // Show response from server
25722 showResponse: function(response) {
25723 var prettyJson = JSON.stringify(response, null, '\t').replace(/\n/g, '<br>');
25724 $('.response_body', $(this.el)).html(_.escape(prettyJson));
25725 },
25726
25727 // Show error from server
25728 showErrorStatus: function(data, parent) {
25729 parent.showStatus(data);
25730 },
25731
25732 // show the status codes
25733 showCompleteStatus: function(data, parent){
25734 parent.showStatus(data);
25735 },
25736
25737 // Adapted from http://stackoverflow.com/a/2893259/454004
25738 // Note: directly ported from CoffeeScript
25739 // TODO: Cleanup CoffeeScript artifacts
25740 formatXml: function(xml) {
25741 var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
25742 reg = /(>)(<)(\/*)/g;
25743 wsexp = /[ ]*(.*)[ ]+\n/g;
25744 contexp = /(<.+>)(.+\n)/g;
25745 xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
25746 pad = 0;
25747 formatted = '';
25748 lines = xml.split('\n');
25749 indent = 0;
25750 lastType = 'other';
25751 transitions = {
25752 'single->single': 0,
25753 'single->closing': -1,
25754 'single->opening': 0,
25755 'single->other': 0,
25756 'closing->single': 0,
25757 'closing->closing': -1,
25758 'closing->opening': 0,
25759 'closing->other': 0,
25760 'opening->single': 1,
25761 'opening->closing': 0,
25762 'opening->opening': 1,
25763 'opening->other': 1,
25764 'other->single': 0,
25765 'other->closing': -1,
25766 'other->opening': 0,
25767 'other->other': 0
25768 };
25769 fn = function(ln) {
25770 var fromTo, j, key, padding, type, types, value;
25771 types = {
25772 single: Boolean(ln.match(/<.+\/>/)),
25773 closing: Boolean(ln.match(/<\/.+>/)),
25774 opening: Boolean(ln.match(/<[^!?].*>/))
25775 };
25776 type = ((function() {
25777 var results;
25778 results = [];
25779 for (key in types) {
25780 value = types[key];
25781 if (value) {
25782 results.push(key);
25783 }
25784 }
25785 return results;
25786 })())[0];
25787 type = type === void 0 ? 'other' : type;
25788 fromTo = lastType + '->' + type;
25789 lastType = type;
25790 padding = '';
25791 indent += transitions[fromTo];
25792 padding = ((function() {
25793 var m, ref1, results;
25794 results = [];
25795 for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
25796 results.push(' ');
25797 }
25798 return results;
25799 })()).join('');
25800 if (fromTo === 'opening->closing') {
25801 formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
25802 } else {
25803 formatted += padding + ln + '\n';
25804 }
25805 };
25806 for (l = 0, len = lines.length; l < len; l++) {
25807 ln = lines[l];
25808 fn(ln);
25809 }
25810 return formatted;
25811 },
25812
25813 // puts the response data in UI
25814 showStatus: function(response) {
25815 var url, content;
25816 if (response.content === undefined) {
25817 content = response.data;
25818 url = response.url;
25819 } else {
25820 content = response.content.data;
25821 url = response.request.url;
25822 }
25823 var headers = response.headers;
25824 content = jQuery.trim(content);
25825
25826 // if server is nice, and sends content-type back, we can use it
25827 var contentType = null;
25828 if (headers) {
25829 contentType = headers['Content-Type'] || headers['content-type'];
25830 if (contentType) {
25831 contentType = contentType.split(';')[0].trim();
25832 }
25833 }
25834 $('.response_body', $(this.el)).removeClass('json');
25835 $('.response_body', $(this.el)).removeClass('xml');
25836
25837 var supportsAudioPlayback = function(contentType){
25838 var audioElement = document.createElement('audio');
25839 return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, ''));
25840 };
25841
25842 var pre;
25843 var code;
25844 if (!content) {
25845 code = $('<code />').text('no content');
25846 pre = $('<pre class="json" />').append(code);
25847
25848 // JSON
25849 } else if (contentType === 'application/json' || /\+json$/.test(contentType)) {
25850 var json = null;
25851 try {
25852 json = JSON.stringify(JSON.parse(content), null, ' ');
25853 } catch (_error) {
25854 json = 'can\'t parse JSON. Raw result:\n\n' + content;
25855 }
25856 code = $('<code />').text(json);
25857 pre = $('<pre class="json" />').append(code);
25858
25859 // XML
25860 } else if (contentType === 'application/xml' || /\+xml$/.test(contentType)) {
25861 code = $('<code />').text(this.formatXml(content));
25862 pre = $('<pre class="xml" />').append(code);
25863
25864 // HTML
25865 } else if (contentType === 'text/html') {
25866 code = $('<code />').html(_.escape(content));
25867 pre = $('<pre class="xml" />').append(code);
25868
25869 // Plain Text
25870 } else if (/text\/plain/.test(contentType)) {
25871 code = $('<code />').text(content);
25872 pre = $('<pre class="plain" />').append(code);
25873
25874
25875 // Image
25876 } else if (/^image\//.test(contentType)) {
25877 pre = $('<img>').attr('src', url);
25878
25879 // Audio
25880 } else if (/^audio\//.test(contentType) && supportsAudioPlayback(contentType)) {
25881 pre = $('<audio controls>').append($('<source>').attr('src', url).attr('type', contentType));
25882
25883 // Download
25884 } else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
25885 headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
25886 headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
25887 headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
25888
25889 if ('Blob' in window) {
25890 var type = contentType || 'text/html';
25891 var blob = new Blob([content], {type: type});
25892 var a = document.createElement('a');
25893 var href = window.URL.createObjectURL(blob);
25894 var fileName = response.url.substr(response.url.lastIndexOf('/') + 1);
25895 var download = [type, fileName, href].join(':');
25896
25897 a.setAttribute('href', href);
25898 a.setAttribute('download', download);
25899 a.innerText = 'Download ' + fileName;
25900
25901 pre = $('<div/>').append(a);
25902 } else {
25903 pre = $('<pre class="json" />').append('Download headers detected but your browser does not support downloading binary via XHR (Blob).');
25904 }
25905
25906 // Location header based redirect download
25907 } else if(headers.location || headers.Location) {
25908 window.location = response.url;
25909
25910 // Anything else (CORS)
25911 } else {
25912 code = $('<code />').text(content);
25913 pre = $('<pre class="json" />').append(code);
25914 }
25915 var response_body = pre;
25916 $('.request_url', $(this.el)).html('<pre></pre>');
25917 $('.request_url pre', $(this.el)).text(url);
25918 $('.response_code', $(this.el)).html('<pre>' + response.status + '</pre>');
25919 $('.response_body', $(this.el)).html(response_body);
25920 $('.response_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(response.headers, null, ' ')).replace(/\n/g, '<br>') + '</pre>');
25921 $('.response', $(this.el)).slideDown();
25922 $('.response_hider', $(this.el)).show();
25923 $('.response_throbber', $(this.el)).hide();
25924
25925
Jian Li83d87a72016-04-20 15:38:24 -070025926 // adds curl output
25927 var curlCommand = this.model.asCurl(this.map, {responseContentType: contentType});
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025928 curlCommand = curlCommand.replace('!', '&#33;');
Jian Li83d87a72016-04-20 15:38:24 -070025929 $( 'div.curl', $(this.el)).html('<pre>' + curlCommand + '</pre>');
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025930
25931 // only highlight the response if response is less than threshold, default state is highlight response
25932 var opts = this.options.swaggerOptions;
25933
25934 if (opts.showRequestHeaders) {
25935 var form = $('.sandbox', $(this.el)),
25936 map = this.getInputMap(form),
25937 requestHeaders = this.model.getHeaderParams(map);
25938 delete requestHeaders['Content-Type'];
25939 $('.request_headers', $(this.el)).html('<pre>' + _.escape(JSON.stringify(requestHeaders, null, ' ')).replace(/\n/g, '<br>') + '</pre>');
25940 }
25941
25942 var response_body_el = $('.response_body', $(this.el))[0];
25943 // only highlight the response if response is less than threshold, default state is highlight response
25944 if (opts.highlightSizeThreshold && typeof response.data !== 'undefined' && response.data.length > opts.highlightSizeThreshold) {
25945 return response_body_el;
25946 } else {
25947 return hljs.highlightBlock(response_body_el);
25948 }
25949 },
25950
25951 toggleOperationContent: function (event) {
25952 var elem = $('#' + Docs.escapeResourceName(this.parentId + '_' + this.nickname + '_content'));
25953 if (elem.is(':visible')){
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025954 $.bbq.pushState('#/', 2);
Jian Li83d87a72016-04-20 15:38:24 -070025955 event.preventDefault();
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070025956 Docs.collapseOperation(elem);
25957 } else {
25958 Docs.expandOperation(elem);
25959 }
25960 },
25961
25962 getTextAreaValue: function(textArea) {
25963 var param, parsed, result, i;
25964 if (textArea.value === null || jQuery.trim(textArea.value).length === 0) {
25965 return null;
25966 }
25967 param = this.getParamByName(textArea.name);
25968 if (param && param.type && param.type.toLowerCase() === 'array') {
25969 parsed = textArea.value.split('\n');
25970 result = [];
25971 for (i = 0; i < parsed.length; i++) {
25972 if (parsed[i] !== null && jQuery.trim(parsed[i]).length > 0) {
25973 result.push(parsed[i]);
25974 }
25975 }
25976 return result.length > 0 ? result : null;
25977 } else {
25978 return textArea.value;
25979 }
25980 },
25981
25982 getParamByName: function(name) {
25983 var i;
25984 if (this.model.parameters) {
25985 for(i = 0; i < this.model.parameters.length; i++) {
25986 if (this.model.parameters[i].name === name) {
25987 return this.model.parameters[i];
25988 }
25989 }
25990 }
25991 return null;
25992 }
25993
25994});
25995
25996'use strict';
25997
25998SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
25999 initialize: function () {},
26000
26001 render: function(){
26002 this.model.parameterContentTypeId = 'pct' + Math.random();
26003 $(this.el).html(Handlebars.templates.parameter_content_type(this.model));
26004 return this;
26005 }
26006
26007});
26008'use strict';
26009
26010SwaggerUi.Views.ParameterView = Backbone.View.extend({
26011 initialize: function(){
26012 Handlebars.registerHelper('isArray', function(param, opts) {
26013 if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
26014 return opts.fn(this);
26015 } else {
26016 return opts.inverse(this);
26017 }
26018 });
26019 },
26020
26021 render: function() {
26022 var type = this.model.type || this.model.dataType;
26023
26024 if (typeof type === 'undefined') {
26025 var schema = this.model.schema;
26026 if (schema && schema.$ref) {
26027 var ref = schema.$ref;
26028 if (ref.indexOf('#/definitions/') === 0) {
26029 type = ref.substring('#/definitions/'.length);
26030 } else {
26031 type = ref;
26032 }
26033 }
26034 }
26035
26036 this.model.type = type;
26037 this.model.paramType = this.model.in || this.model.paramType;
26038 this.model.isBody = this.model.paramType === 'body' || this.model.in === 'body';
26039 this.model.isFile = type && type.toLowerCase() === 'file';
26040
26041 // Allow for default === false
26042 if(typeof this.model.default === 'undefined') {
26043 this.model.default = this.model.defaultValue;
26044 }
26045
26046 this.model.hasDefault = (typeof this.model.default !== 'undefined');
26047 this.model.valueId = 'm' + this.model.name + Math.random();
26048
26049 if (this.model.allowableValues) {
26050 this.model.isList = true;
26051 }
26052
26053 var template = this.template();
26054 $(this.el).html(template(this.model));
26055
26056 var signatureModel = {
26057 sampleJSON: this.model.sampleJSON,
26058 isParam: true,
Jian Li83d87a72016-04-20 15:38:24 -070026059 signature: this.model.signature,
26060 defaultRendering: this.model.defaultRendering
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026061 };
26062
26063 if (this.model.sampleJSON) {
26064 var signatureView = new SwaggerUi.Views.SignatureView({model: signatureModel, tagName: 'div'});
26065 $('.model-signature', $(this.el)).append(signatureView.render().el);
26066 }
26067 else {
26068 $('.model-signature', $(this.el)).html(this.model.signature);
26069 }
26070
26071 var isParam = false;
26072
Jian Li83d87a72016-04-20 15:38:24 -070026073 if( this.options.swaggerOptions.jsonEditor && this.model.isBody && this.model.schema){
26074 var $self = $(this.el);
26075 this.model.jsonEditor =
26076 /* global JSONEditor */
26077 new JSONEditor($('.editor_holder', $self)[0],
26078 {schema: this.model.schema, startval : this.model.default,
26079 ajax:true,
26080 disable_properties:true,
26081 disable_edit_json:true,
26082 iconlib: 'swagger' });
26083 // This is so that the signature can send back the sample to the json editor
26084 // TODO: SignatureView should expose an event "onSampleClicked" instead
26085 signatureModel.jsonEditor = this.model.jsonEditor;
26086 $('.body-textarea', $self).hide();
26087 $('.editor_holder', $self).show();
26088 $('.parameter-content-type', $self)
26089 .change(function(e){
26090 if(e.target.value === 'application/xml'){
26091 $('.body-textarea', $self).show();
26092 $('.editor_holder', $self).hide();
26093 this.model.jsonEditor.disable();
26094 }
26095 else {
26096 $('.body-textarea', $self).hide();
26097 $('.editor_holder', $self).show();
26098 this.model.jsonEditor.enable();
26099 }
26100 });
26101 }
26102
26103
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026104 if (this.model.isBody) {
26105 isParam = true;
26106 }
26107
26108 var contentTypeModel = {
26109 isParam: isParam
26110 };
26111
26112 contentTypeModel.consumes = this.model.consumes;
26113
26114 if (isParam) {
26115 var parameterContentTypeView = new SwaggerUi.Views.ParameterContentTypeView({model: contentTypeModel});
26116 $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
26117 }
26118
26119 else {
26120 var responseContentTypeView = new SwaggerUi.Views.ResponseContentTypeView({model: contentTypeModel});
26121 $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
26122 }
26123
26124 return this;
26125 },
26126
26127 // Return an appropriate template based on if the parameter is a list, readonly, required
26128 template: function(){
26129 if (this.model.isList) {
26130 return Handlebars.templates.param_list;
26131 } else {
26132 if (this.options.readOnly) {
26133 if (this.model.required) {
26134 return Handlebars.templates.param_readonly_required;
26135 } else {
26136 return Handlebars.templates.param_readonly;
26137 }
26138 } else {
26139 if (this.model.required) {
26140 return Handlebars.templates.param_required;
26141 } else {
26142 return Handlebars.templates.param;
26143 }
26144 }
26145 }
26146 }
26147});
26148
26149'use strict';
26150
26151SwaggerUi.Views.ResourceView = Backbone.View.extend({
26152 initialize: function(opts) {
26153 opts = opts || {};
26154 this.router = opts.router;
26155 this.auths = opts.auths;
26156 if ('' === this.model.description) {
26157 this.model.description = null;
26158 }
26159 if (this.model.description) {
26160 this.model.summary = this.model.description;
26161 }
26162 },
26163
26164 render: function(){
26165 var methods = {};
26166
26167
26168 $(this.el).html(Handlebars.templates.resource(this.model));
26169
26170 // Render each operation
26171 for (var i = 0; i < this.model.operationsArray.length; i++) {
26172 var operation = this.model.operationsArray[i];
26173 var counter = 0;
26174 var id = operation.nickname;
26175
26176 while (typeof methods[id] !== 'undefined') {
26177 id = id + '_' + counter;
26178 counter += 1;
26179 }
26180
26181 methods[id] = operation;
26182
26183 operation.nickname = id;
26184 operation.parentId = this.model.id;
Jian Li83d87a72016-04-20 15:38:24 -070026185 operation.definitions = this.model.definitions; // make Json Schema available for JSonEditor in this operation
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026186 this.addOperation(operation);
26187 }
26188
26189 $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
26190 $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
26191 $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
26192
26193 return this;
26194 },
26195
26196 addOperation: function(operation) {
26197
26198 operation.number = this.number;
26199
26200 // Render an operation and add it to operations li
26201 var operationView = new SwaggerUi.Views.OperationView({
26202 model: operation,
26203 router: this.router,
26204 tagName: 'li',
26205 className: 'endpoint',
26206 swaggerOptions: this.options.swaggerOptions,
26207 auths: this.auths
26208 });
26209
26210 $('.endpoints', $(this.el)).append(operationView.render().el);
26211
26212 this.number++;
26213
26214 },
26215 // Generic Event handler (`Docs` is global)
26216
26217
26218 callDocs: function(fnName, e) {
26219 e.preventDefault();
26220 Docs[fnName](e.currentTarget.getAttribute('data-id'));
26221 }
26222});
26223'use strict';
26224
26225SwaggerUi.Views.ResponseContentTypeView = Backbone.View.extend({
26226 initialize: function(){},
26227
26228 render: function(){
26229 this.model.responseContentTypeId = 'rct' + Math.random();
26230 $(this.el).html(Handlebars.templates.response_content_type(this.model));
26231 return this;
26232 }
26233});
26234'use strict';
26235
26236SwaggerUi.Views.SignatureView = Backbone.View.extend({
26237 events: {
26238 'click a.description-link' : 'switchToDescription',
26239 'click a.snippet-link' : 'switchToSnippet',
26240 'mousedown .snippet' : 'snippetToTextArea'
26241 },
26242
26243 initialize: function () {
26244
26245 },
26246
26247 render: function(){
26248
26249 $(this.el).html(Handlebars.templates.signature(this.model));
26250
Jian Li83d87a72016-04-20 15:38:24 -070026251 if (this.model.defaultRendering === 'model') {
26252 this.switchToDescription();
26253 } else {
26254 this.switchToSnippet();
26255 }
26256
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026257 this.isParam = this.model.isParam;
26258
26259 if (this.isParam) {
26260 $('.notice', $(this.el)).text('Click to set as parameter value');
26261 }
26262
26263 return this;
26264 },
26265
26266 // handler for show signature
26267 switchToDescription: function(e){
26268 if (e) { e.preventDefault(); }
26269
26270 $('.snippet', $(this.el)).hide();
26271 $('.description', $(this.el)).show();
26272 $('.description-link', $(this.el)).addClass('selected');
26273 $('.snippet-link', $(this.el)).removeClass('selected');
26274 },
26275
26276 // handler for show sample
26277 switchToSnippet: function(e){
26278 if (e) { e.preventDefault(); }
26279
26280 $('.description', $(this.el)).hide();
26281 $('.snippet', $(this.el)).show();
26282 $('.snippet-link', $(this.el)).addClass('selected');
26283 $('.description-link', $(this.el)).removeClass('selected');
26284 },
26285
26286 // handler for snippet to text area
26287 snippetToTextArea: function(e) {
26288 if (this.isParam) {
26289 if (e) { e.preventDefault(); }
26290
26291 var textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
Jian Li83d87a72016-04-20 15:38:24 -070026292
26293 // Fix for bug in IE 10/11 which causes placeholder text to be copied to "value"
26294 if ($.trim(textArea.val()) === '' || textArea.prop('placeholder') === textArea.val()) {
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026295 textArea.val(this.model.sampleJSON);
Jian Li83d87a72016-04-20 15:38:24 -070026296 // TODO move this code outside of the view and expose an event instead
26297 if( this.model.jsonEditor && this.model.jsonEditor.isEnabled()){
26298 this.model.jsonEditor.setValue(JSON.parse(this.model.sampleJSON));
26299 }
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026300 }
26301 }
26302 }
26303});
26304'use strict';
26305
26306SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
26307 initialize: function (opts) {
26308 this.options = opts || {};
26309 this.router = this.options.router;
26310 },
26311
26312 render: function(){
26313 $(this.el).html(Handlebars.templates.status_code(this.model));
26314
26315 if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
26316 var responseModel = {
26317 sampleJSON: JSON.stringify(this.router.api.models[this.model.responseModel].createJSONSample(), null, 2),
26318 isParam: false,
26319 signature: this.router.api.models[this.model.responseModel].getMockSignature(),
Jian Li83d87a72016-04-20 15:38:24 -070026320 defaultRendering: this.model.defaultRendering
Thomas Vachuska0fa2aa12015-08-18 12:53:04 -070026321 };
26322
26323 var responseModelView = new SwaggerUi.Views.SignatureView({model: responseModel, tagName: 'div'});
26324 $('.model-signature', this.$el).append(responseModelView.render().el);
26325 } else {
26326 $('.model-signature', this.$el).html('');
26327 }
26328 return this;
26329 }
26330});}).call(this);