diff --git a/dist/raml-parser.js b/dist/raml-parser.js index c54d84a..aa777bb 100644 --- a/dist/raml-parser.js +++ b/dist/raml-parser.js @@ -5564,14 +5564,18 @@ }; Transformations.prototype.applyTransformationsToRoot = function(rootObject) { - var expressions, template; + var expressions, template, _ref; if (rootObject.baseUri) { template = uritemplate.parse(rootObject.baseUri); - expressions = template.expressions.filter(function(expr) { - return 'templateText' in expr; - }).map(function(expression) { - return expression.templateText; - }); + expressions = []; + if ((_ref = template.expressions) != null) { + _ref.forEach(function(expression) { + var _ref1; + return (_ref1 = expression.varspecs) != null ? _ref1.forEach(function(spec) { + return expressions.push(spec.varname); + }) : void 0; + }); + } if (expressions.length) { if (!rootObject.baseUriParameters) { rootObject.baseUriParameters = {}; @@ -5593,7 +5597,7 @@ }; Transformations.prototype.applyTransformationsToResources = function(rootObject, resources) { - var expressions, inheritedSecScheme, method, parameterName, pathParts, resource, template, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _results; + var expressions, inheritedSecScheme, method, parameterName, pathParts, resource, template, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results; if (resources != null ? resources.length : void 0) { _results = []; for (_i = 0, _len = resources.length; _i < _len; _i++) { @@ -5616,11 +5620,15 @@ } resource.relativeUriPathSegments = pathParts; template = uritemplate.parse(resource.relativeUri); - expressions = template.expressions.filter(function(expr) { - return 'templateText' in expr; - }).map(function(expression) { - return expression.templateText; - }); + expressions = []; + if ((_ref2 = template.expressions) != null) { + _ref2.forEach(function(expression) { + var _ref3; + return (_ref3 = expression.varspecs) != null ? _ref3.forEach(function(spec) { + return expressions.push(spec.varname); + }) : void 0; + }); + } if (expressions.length) { if (!resource.uriParameters) { resource.uriParameters = {}; @@ -6390,7 +6398,7 @@ }; Validator.prototype.validate_uri_parameters = function(uri, uriProperty, allowParameterKeys, skipParameterUseCheck, reservedNames) { - var err, expressions, parameterName, template, uriParameter, uriParameters, _i, _len, _ref1, _ref2, _results; + var err, expressions, parameterName, template, uriParameter, uriParameters, _i, _len, _ref1, _ref2, _ref3, _results; if (reservedNames == null) { reservedNames = []; } @@ -6400,18 +6408,22 @@ err = _error; throw new exports.ValidationError('while validating uri parameters', null, err != null ? (_ref1 = err.options) != null ? _ref1.message : void 0 : void 0, uriProperty.start_mark); } - expressions = template.expressions.filter(function(expr) { - return "templateText" in expr; - }).map(function(expression) { - return expression.templateText; - }); + expressions = []; + if ((_ref2 = template.expressions) != null) { + _ref2.forEach(function(expression) { + var _ref3; + return (_ref3 = expression.varspecs) != null ? _ref3.forEach(function(spec) { + return expressions.push(spec.varname); + }) : void 0; + }); + } uriParameters = {}; if (typeof uriProperty.value === "object") { - _ref2 = uriProperty.value; + _ref3 = uriProperty.value; _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - uriParameter = _ref2[_i]; - parameterName = this.canonicalizePropertyName(uriParameter[0].value, allowParameterKeys); + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + uriParameter = _ref3[_i]; + parameterName = this.canonicalizeParameterName(uriParameter[0].value, allowParameterKeys); this.trackRepeatedProperties(uriParameters, parameterName, uriProperty, 'while validating URI parameters', "URI parameter with the same name already exists"); if (__indexOf.call(reservedNames, parameterName) >= 0) { throw new exports.ValidationError('while validating baseUri', null, uriParameter[0].value + ' parameter not allowed here', uriParameter[0].start_mark); @@ -6513,6 +6525,15 @@ return this.validate_method(node, true, 'trait'); }; + Validator.prototype.canonicalizeParameterName = function(propertyName, mustRemoveQuestionMark) { + var canonicalParameterName; + canonicalParameterName = this.canonicalizePropertyName(propertyName, mustRemoveQuestionMark); + if (canonicalParameterName[0] === '+') { + return canonicalParameterName.slice(1); + } + return canonicalParameterName; + }; + Validator.prototype.canonicalizePropertyName = function(propertyName, mustRemoveQuestionMark) { if (mustRemoveQuestionMark && propertyName.slice(-1) === '?') { return propertyName.slice(0, -1); diff --git a/dist/raml-parser.min.js b/dist/raml-parser.min.js index 5db378a..24f4a76 100644 --- a/dist/raml-parser.min.js +++ b/dist/raml-parser.min.js @@ -1,7 +1,7 @@ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(b.RAML||(b.RAML={})).Parser=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gb;b++)if(b in this&&this[b]===a)return b;return-1};e=a("./errors").MarkedYAMLError,f=a("./nodes"),g=a("./util"),this.ConstructorError=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return k(b,a),b}(e),this.BaseConstructor=function(){function a(){this.constructed_objects={},this.constructing_nodes=[],this.deferred_constructors=[]}return a.prototype.yaml_constructors={},a.prototype.yaml_multi_constructors={},a.add_constructor=function(a,b){return this.prototype.hasOwnProperty("yaml_constructors")||(this.prototype.yaml_constructors=g.extend({},this.prototype.yaml_constructors)),this.prototype.yaml_constructors[a]=b},a.add_multi_constructor=function(a,b){return this.prototype.hasOwnProperty("yaml_multi_constructors")||(this.prototype.yaml_multi_constructors=g.extend({},this.prototype.yaml_multi_constructors)),this.prototype.yaml_multi_constructors[a]=b},a.prototype.construct_document=function(a){var b;for(this.applyAstTransformations(a),b=this.construct_object(a);!g.is_empty(this.deferred_constructors);)this.deferred_constructors.pop()();return this.applyTransformations(b),b},a.prototype.defer=function(a){return this.deferred_constructors.push(a)},a.prototype.construct_object=function(a){var b,d,e,g,h;if(a.unique_id in this.constructed_objects)return this.constructed_objects[a.unique_id];if(h=a.unique_id,l.call(this.constructing_nodes,h)>=0)throw new c.ConstructorError(null,null,"found unconstructable recursive node",a.start_mark);if(this.constructing_nodes.push(a.unique_id),b=null,g=null,a.tag in this.yaml_constructors)b=this.yaml_constructors[a.tag];else{for(e in this.yaml_multi_constructors)if(a.tag.indexOf(0===e)){g=a.tag.slice(e.length),b=this.yaml_multi_constructors[e];break}null==b&&(null in this.yaml_multi_constructors?(g=a.tag,b=this.yaml_multi_constructors[null]):null in this.yaml_constructors?b=this.yaml_constructors[null]:a instanceof f.ScalarNode?b=this.construct_scalar:a instanceof f.SequenceNode?b=this.construct_sequence:a instanceof f.MappingNode&&(b=this.construct_mapping))}return d=b.call(this,null!=g?g:a,a),this.constructed_objects[a.unique_id]=d,this.constructing_nodes.pop(),d},a.prototype.construct_scalar=function(a){if(!(a instanceof f.ScalarNode))throw new c.ConstructorError(null,null,"expected a scalar node but found "+a.id,a.start_mark);return a.value},a.prototype.construct_sequence=function(a){var b,d,e,g,h;if(!(a instanceof f.SequenceNode))throw new c.ConstructorError(null,null,"expected an array node but found "+a.id,a.start_mark);for(g=a.value,h=[],d=0,e=g.length;e>d;d++)b=g[d],h.push(this.construct_object(b));return h},a.prototype.construct_mapping=function(a){var b,d,e,g,h,i,j,k,l,m,n,o,p,q;if(!(a instanceof f.MappingNode))throw new c.ConstructorError(null,null,"expected a map node but found "+a.id,a.start_mark);for(h={},o=a.value,k=0,m=o.length;m>k;k++)if(p=o[k],g=p[0],j=p[1],b=this.construct_object(g),i=this.construct_object(j),"object"==typeof b&&"tag:yaml.org,2002:seq"===g.tag)for(q=g.value,l=0,n=q.length;n>l;l++)d=q[l],e=this.construct_object(d),h[e]=i;else{if("object"==typeof b)throw new c.ConstructorError("while constructing a map",a.start_mark,"found unhashable key",g.start_mark);h[b]=i}return h},a.prototype.construct_pairs=function(a){var b,d,e,g,h,i,j,k,l;if(!(a instanceof f.MappingNode))throw new c.ConstructorError(null,null,"expected a map node but found "+a.id,a.start_mark);for(e=[],k=a.value,i=0,j=k.length;j>i;i++)l=k[i],d=l[0],h=l[1],b=this.construct_object(d),g=this.construct_object(h),e.push([b,g]);return e},a}(),this.Constructor=function(a){function b(){return i=b.__super__.constructor.apply(this,arguments)}var e,g,h;return k(b,a),e={"true":!0,"false":!1},h=/^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[\x20\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\.([0-9]*))?(?:[\x20\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$/,g={year:1,month:2,day:3,hour:4,minute:5,second:6,fraction:7,tz:8,tz_sign:9,tz_hour:10,tz_minute:11},b.prototype.yaml_constructors={},b.prototype.yaml_multi_constructors={},b.prototype.construct_scalar=function(a){var c,d,e,g,h,i;if(a instanceof f.MappingNode)for(h=a.value,e=0,g=h.length;g>e;e++)if(i=h[e],c=i[0],d=i[1],"tag:yaml.org,2002:value"===c.tag)return this.construct_scalar(d);return b.__super__.construct_scalar.call(this,a)},b.prototype.flatten_mapping=function(a){var b,d,e,g,h,i,j,k,l,m,n,o,p;for(e=[],b=0;bk;k++){if(h=p[k],!(h instanceof f.MappingNode))throw new c.ConstructorError("while constructing a map",a.start_mark,"expected a map for merging, but found "+h.id,h.start_mark);this.flatten_mapping(h),g.push(h.value)}for(g.reverse(),l=0,n=g.length;n>l;l++)i=g[l],e=e.concat(i)}else"tag:yaml.org,2002:value"===d.tag?(d.tag="tag:yaml.org,2002:str",b++):b++;return e.length?a.value=e.concat(a.value):void 0},b.prototype.construct_mapping=function(a){return a instanceof f.MappingNode&&this.flatten_mapping(a),b.__super__.construct_mapping.call(this,a)},b.prototype.construct_yaml_null=function(a){return this.construct_scalar(a),null},b.prototype.construct_yaml_bool=function(a){var b;return b=this.construct_scalar(a),e[b.toLowerCase()]},b.prototype.construct_yaml_int=function(a){var b,c,d,e,f,g,h,i,j;if(g=this.construct_scalar(a),g=g.replace(/_/g,""),f="-"===g[0]?-1:1,j=g[0],l.call("+-",j)>=0&&(g=g.slice(1)),"0"===g)return 0;if(0===g.indexOf("0b"))return f*parseInt(g.slice(2),2);if(0===g.indexOf("0x"))return f*parseInt(g.slice(2),16);if(0===g.indexOf("0o"))return f*parseInt(g.slice(2),8);if("0"===g[0])return f*parseInt(g,8);if(l.call(g,":")>=0){for(d=function(){var a,b,c,d;for(c=g.split(/:/g),d=[],a=0,b=c.length;b>a;a++)e=c[a],d.push(parseInt(e));return d}(),d.reverse(),b=1,g=0,h=0,i=d.length;i>h;h++)c=d[h],g+=c*b,b*=60;return f*g}return f*parseInt(g)},b.prototype.construct_yaml_float=function(a){var b,c,d,e,f,g,h,i,j;if(g=this.construct_scalar(a),g=g.replace(/_/g,"").toLowerCase(),f="-"===g[0]?-1:1,j=g[0],l.call("+-",j)>=0&&(g=g.slice(1)),".inf"===g)return f*(1/0);if(".nan"===g)return NaN;if(l.call(g,":")>=0){for(d=function(){var a,b,c,d;for(c=g.split(/:/g),d=[],a=0,b=c.length;b>a;a++)e=c[a],d.push(parseFloat(e));return d}(),d.reverse(),b=1,g=0,h=0,i=d.length;i>h;h++)c=d[h],g+=c*b,b*=60;return f*g}return f*parseFloat(g)},b.prototype.construct_yaml_binary=function(a){var b,e;e=this.construct_scalar(a);try{return"undefined"!=typeof window&&null!==window?atob(e):new d(e,"base64").toString("ascii")}catch(f){throw b=f,new c.ConstructorError(null,null,"failed to decode base64 data: "+b,a.start_mark)}},b.prototype.construct_yaml_timestamp=function(a){var b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t;r=this.construct_scalar(a),j=a.value.match(h),s={};for(i in g)f=g[i],s[i]=j[f];if(t=parseInt(s.year),m=parseInt(s.month)-1,c=parseInt(s.day),!s.hour)return new Date(Date.UTC(t,m,c));if(e=parseInt(s.hour),l=parseInt(s.minute),n=parseInt(s.second),k=0,s.fraction){for(d=s.fraction.slice(0,6);d.length<6;)d+="0";d=parseInt(d),k=Math.round(d/1e3)}return s.tz_sign&&(q="-"===s.tz_sign?1:-1,(o=parseInt(s.tz_hour))&&(e+=q*o),(p=parseInt(s.tz_minute))&&(l+=q*p)),b=new Date(Date.UTC(t,m,c,e,l,n,k))},b.prototype.construct_yaml_pair_list=function(a,b){var d,e=this;if(d=[],!(b instanceof f.SequenceNode))throw new c.ConstructorError("while constructing "+a,b.start_mark,"expected an array but found "+b.id,b.start_mark);return this.defer(function(){var g,h,i,j,k,l,m,n,o,p;for(n=b.value,p=[],l=0,m=n.length;m>l;l++){if(i=n[l],!(i instanceof f.MappingNode))throw new c.ConstructorError("while constructing "+a,b.start_mark,"expected a map of length 1 but found "+i.id,i.start_mark);if(1!==i.value.length)throw new c.ConstructorError("while constructing "+a,b.start_mark,"expected a map of length 1 but found "+i.id,i.start_mark);o=i.value[0],h=o[0],k=o[1],g=e.construct_object(h),j=e.construct_object(k),p.push(d.push([g,j]))}return p}),d},b.prototype.construct_yaml_omap=function(a){return this.construct_yaml_pair_list("an ordered map",a)},b.prototype.construct_yaml_pairs=function(a){return this.construct_yaml_pair_list("pairs",a)},b.prototype.construct_yaml_set=function(a){var b,c=this;return b=[],this.defer(function(){var d,e;e=[];for(d in c.construct_mapping(a))e.push(b.push(d));return e}),b},b.prototype.construct_yaml_str=function(a){return this.construct_scalar(a)},b.prototype.construct_yaml_seq=function(a){var b,c=this;return b=[],this.defer(function(){var d,e,f,g,h;for(g=c.construct_sequence(a),h=[],e=0,f=g.length;f>e;e++)d=g[e],h.push(b.push(d));return h}),b},b.prototype.construct_yaml_map=function(a){var b,c=this;return b={},this.defer(function(){var d,e,f,g;f=c.construct_mapping(a),g=[];for(d in f)e=f[d],g.push(b[d]=e);return g}),b},b.prototype.construct_yaml_object=function(a,b){var c,d=this;return c=new b,this.defer(function(){var b,e,f,g;f=d.construct_mapping(a,!0),g=[];for(b in f)e=f[b],g.push(c[b]=e);return g}),c},b.prototype.construct_undefined=function(a){throw new c.ConstructorError(null,null,"could not determine a constructor for the tag "+a.tag,a.start_mark)},b}(this.BaseConstructor),this.Constructor.add_constructor("tag:yaml.org,2002:null",this.Constructor.prototype.construct_yaml_null),this.Constructor.add_constructor("tag:yaml.org,2002:bool",this.Constructor.prototype.construct_yaml_bool),this.Constructor.add_constructor("tag:yaml.org,2002:int",this.Constructor.prototype.construct_yaml_int),this.Constructor.add_constructor("tag:yaml.org,2002:float",this.Constructor.prototype.construct_yaml_float),this.Constructor.add_constructor("tag:yaml.org,2002:binary",this.Constructor.prototype.construct_yaml_binary),this.Constructor.add_constructor("tag:yaml.org,2002:timestamp",this.Constructor.prototype.construct_yaml_timestamp),this.Constructor.add_constructor("tag:yaml.org,2002:omap",this.Constructor.prototype.construct_yaml_omap),this.Constructor.add_constructor("tag:yaml.org,2002:pairs",this.Constructor.prototype.construct_yaml_pairs),this.Constructor.add_constructor("tag:yaml.org,2002:set",this.Constructor.prototype.construct_yaml_set),this.Constructor.add_constructor("tag:yaml.org,2002:str",this.Constructor.prototype.construct_yaml_str),this.Constructor.add_constructor("tag:yaml.org,2002:seq",this.Constructor.prototype.construct_yaml_seq),this.Constructor.add_constructor("tag:yaml.org,2002:map",this.Constructor.prototype.construct_yaml_map),this.Constructor.add_constructor(null,this.Constructor.prototype.construct_undefined),b.exports.Constructor=this.Constructor,b.exports.ConstructorError=this.ConstructorError}).call(this)}).call(this,a("buffer").Buffer)},{"./errors":3,"./nodes":7,"./util":20,buffer:24}],3:[function(a,b,c){(function(){var b,c,d=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};b=a("./util").NON_PRINTABLE,this.Mark=function(){function a(a,b,c,d,e){this.name=a,this.line=b,this.column=c,this.buffer=d,this.pointer=e}return a.prototype.get_snippet=function(a,c){var e,f,g,h,i,j,k,l;if(null==a&&(a=4),null==c&&(c=75),null==this.buffer)return null;for(e="\x00\r\n…\u2028\u2029",h=0,g="",j="",i=this.pointer,f=this.pointer;i>0&&(k=this.buffer[i-1],d.call(e,k)<0);)if(i--,b.test(this.buffer[i])&&h--,this.pointer-i>Math.ceil(c/2-1)){g="... ",i+=4,h+=4;break}for(;fMath.floor(c/2-1)){j=" ...",f-=4;break}return""+new Array(a+1).join(" ")+g+this.buffer.slice(i,f)+j+"\n"+new Array(a+1+this.pointer-i+h).join(" ")+"^"},a.prototype.toString=function(){var a,b;return a=this.get_snippet(),b=' in "'+this.name+'", line '+(this.line+1)+", column "+(this.column+1),a?""+b+":\n"+a:b},a}(),this.YAMLError=function(a){function b(){b.__super__.constructor.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}return f(b,a),b.prototype.name="YAMLError",b}(Error),this.MarkedYAMLError=function(a){function b(a,c,d,e,f){this.context=a,this.context_mark=c,this.message=d,this.problem_mark=e,this.note=f,b.__super__.constructor.call(this),this.message||(this.message=this.context),this.problem_mark||(this.problem_mark=this.context_mark)}return f(b,a),b.prototype.toString=function(){var a;return a=[],null!=this.context&&a.push(this.context),null==this.context_mark||null!=this.message&&null!=this.problem_mark&&this.context_mark.name===this.problem_mark.name&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||a.push(this.context_mark.toString()),this.message!==this.context&&a.push(this.message),null!=this.problem_mark&&a.push(this.problem_mark.toString()),null!=this.note&&a.push(this.note),a.join("\n")},b}(this.YAMLError),this.ValidationError=function(a){function b(){return c=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(this.MarkedYAMLError)}).call(this)},{"./util":20}],4:[function(a,b,c){(function(){var a,b,c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};this.Event=function(){function a(a,b){this.start_mark=a,this.end_mark=b}return a}(),this.NodeEvent=function(a){function b(a,b,c){this.anchor=a,this.start_mark=b,this.end_mark=c}return i(b,a),b}(this.Event),this.CollectionStartEvent=function(a){function b(a,b,c,d,e){this.anchor=a,this.tag=b,this.implicit=c,this.start_mark=d,this.end_mark=e}return i(b,a),b}(this.NodeEvent),this.CollectionEndEvent=function(b){function c(){return a=c.__super__.constructor.apply(this,arguments)}return i(c,b),c}(this.Event),this.StreamStartEvent=function(a){function b(a,b,c,d,e){this.start_mark=a,this.end_mark=b,this.explicit=c,this.version=d,this.tags=e}return i(b,a),b}(this.Event),this.StreamEndEvent=function(a){function c(){return b=c.__super__.constructor.apply(this,arguments)}return i(c,a),c}(this.Event),this.DocumentStartEvent=function(a){function b(a,b,c,d,e){this.start_mark=a,this.end_mark=b,this.explicit=c,this.version=d,this.tags=e}return i(b,a),b}(this.Event),this.DocumentEndEvent=function(a){function b(a,b,c){this.start_mark=a,this.end_mark=b,this.explicit=c}return i(b,a),b}(this.Event),this.AliasEvent=function(a){function b(){return c=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.NodeEvent),this.ScalarEvent=function(a){function b(a,b,c,d,e,f,g){this.anchor=a,this.tag=b,this.implicit=c,this.value=d,this.start_mark=e,this.end_mark=f,this.style=g}return i(b,a),b}(this.NodeEvent),this.SequenceStartEvent=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.CollectionStartEvent),this.SequenceEndEvent=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.CollectionEndEvent),this.MappingStartEvent=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.CollectionStartEvent),this.MappingEndEvent=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.CollectionEndEvent)}).call(this)},{}],5:[function(a,b,c){(function(){var b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};b=a("./errors").MarkedYAMLError,c=a("./nodes"),this.JoinError=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(b),this.Joiner=function(){function a(){}return a.prototype.join_resources=function(a,b){var d,e,f,g,h=this;return null==b&&(b=0),d=[],(null!=a?a.value:void 0)&&(d=a.value.filter(function(a){var b;return null!=(b=a[0])?b.value.match(/^\//):void 0})),e=[],d.length>0?((null!=a?a.value:void 0)&&(a.value=a.value.filter(function(a){return!a[0].value.match(/^\//)})),f=new c.ScalarNode("tag:yaml.org,2002:str","resources",d[0][0].start_mark,d[d.length-1][1].end_mark),d.forEach(function(a){var d,f;return d=new c.ScalarNode("tag:yaml.org,2002:str","relativeUri",a[0].start_mark,a[1].end_mark),f=new c.ScalarNode("tag:yaml.org,2002:str",a[0].value,a[0].start_mark,a[1].end_mark),"tag:yaml.org,2002:null"===a[1].tag&&(a[1]=new c.MappingNode("tag:yaml.org,2002:map",[],a[0].start_mark,a[1].end_mark)),a[1].value.push([d,f]),e.push(a[1]),h.join_methods(a[1]),h.join_resources(a[1],++b)}),g=new c.SequenceNode("tag:yaml.org,2002:seq",e,d[0][0].start_mark,d[d.length-1][1].end_mark),a.value.push([f,g])):void 0},a.prototype.join_methods=function(a){var b,d,e,f,g=this;return b=[],a&&a.value&&(b=a.value.filter(function(a){var b;return g.isHttpMethod(null!=(b=a[0])?b.value:void 0)})),d=[],b.length>0?(a.value=a.value.filter(function(a){return!g.isHttpMethod(a[0].value)}),e=new c.ScalarNode("tag:yaml.org,2002:str","methods",b[0][0].start_mark,b[b.length-1][1].end_mark),b.forEach(function(a){var b,e;return b=new c.ScalarNode("tag:yaml.org,2002:str","method",a[0].start_mark,a[1].end_mark),e=new c.ScalarNode("tag:yaml.org,2002:str",a[0].value,a[0].start_mark,a[1].end_mark),"tag:yaml.org,2002:null"===a[1].tag&&(a[1]=new c.MappingNode("tag:yaml.org,2002:map",[],a[1].start_mark,a[1].end_mark)),a[1].value.push([b,e]),d.push(a[1])}),f=new c.SequenceNode("tag:yaml.org,2002:seq",d,b[0][0].start_mark,b[b.length-1][1].end_mark),a.value.push([e,f])):void 0},a}()}).call(this)},{"./errors":3,"./nodes":7}],6:[function(a,b,c){(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;o=a("./util"),g=a("./reader"),i=a("./scanner"),e=a("./parser"),b=a("./composer"),h=a("./resolver"),c=a("./construct"),p=a("./validator"),d=a("./joiner"),l=a("./traits"),n=a("./resourceTypes"),j=a("./schemas"),f=a("./protocols"),k=a("./securitySchemes"),m=a("./transformations"),this.make_loader=function(a,q,r,s,t,u,v,w,x,y,z,A,B,C){return null==a&&(a=g.Reader),null==q&&(q=i.Scanner),null==r&&(r=e.Parser),null==s&&(s=b.Composer),null==t&&(t=h.Resolver),null==u&&(u=p.Validator),null==v&&(v=n.ResourceTypes),null==w&&(w=l.Traits),null==x&&(x=j.Schemas),null==y&&(y=f.Protocols),null==z&&(z=d.Joiner),null==A&&(A=k.SecuritySchemes),null==B&&(B=c.Constructor),null==C&&(C=m.Transformations),function(){function b(a,b,e,f){var g,h,i;for(this.parent=null!=f?f:null,d[0].call(this,a,b),d[1].call(this,e),d[2].call(this,e),d[3].call(this,e),i=d.slice(4),g=0,h=i.length;h>g;g++)c=i[g],c.call(this)}var c,d;return d=[a,q,s,C,r,t,u,w,v,x,y,z,B,A],o.extend.apply(o,[b.prototype].concat(function(){var a,b,e;for(e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c.prototype);return e}())),b}()},this.Loader=this.make_loader()}).call(this)},{"./composer":1,"./construct":2,"./joiner":5,"./parser":8,"./protocols":9,"./reader":11,"./resolver":12,"./resourceTypes":13,"./scanner":14,"./schemas":15,"./securitySchemes":16,"./traits":18,"./transformations":19,"./util":20,"./validator":21}],7:[function(a,b,c){(function(){var b,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};b=a("./errors").MarkedYAMLError,d=0,this.ApplicationError=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(b),this.Node=function(){function a(a,b,c,e){this.tag=a,this.value=b,this.start_mark=c,this.end_mark=e,this.unique_id="node_"+d++}return a.prototype.clone=function(){var a;return a=new this.constructor(this.tag,this.value,this.start_mark,this.end_mark)},a}(),this.ScalarNode=function(a){function b(a,c,d,e,f){this.tag=a,this.value=c,this.start_mark=d,this.end_mark=e,this.style=f,b.__super__.constructor.apply(this,arguments)}return i(b,a),b.prototype.id="scalar",b.prototype.clone=function(){var a;return a=new this.constructor(this.tag,this.value,this.start_mark,this.end_mark,this.style)},b.prototype.cloneRemoveIs=function(){return this.clone()},b.prototype.combine=function(a){if("tag:yaml.org,2002:null"===this.tag&&"tag:yaml.org,2002:map"===a.tag)return this.value=new c.MappingNode("tag:yaml.org,2002:map",[],a.start_mark,a.end_mark),this.value.combine(a);if(!(a instanceof c.ScalarNode))throw new c.ApplicationError("while applying node",null,"different YAML structures",this.start_mark);return this.value=a.value},b.prototype.remove_question_mark_properties=function(){},b}(this.Node),this.CollectionNode=function(a){function b(a,c,d,e,f){this.tag=a,this.value=c,this.start_mark=d,this.end_mark=e,this.flow_style=f,b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(this.Node),this.SequenceNode=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return i(b,a),b.prototype.id="sequence",b.prototype.clone=function(){var a,b,c,d,e,f,g;for(b=[],g=this.value,e=0,f=g.length;f>e;e++)a=g[e],d=a.clone(),b.push(d);return c=new this.constructor(this.tag,b,this.start_mark,this.end_mark,this.flow_style)},b.prototype.cloneRemoveIs=function(){return this.clone()},b.prototype.combine=function(a){var b,d,e,f,g,h;if(!(a instanceof c.SequenceNode))throw new c.ApplicationError("while applying node",null,"different YAML structures",this.start_mark);for(g=a.value,h=[],e=0,f=g.length;f>e;e++)b=g[e],d=b.clone(),h.push(this.value.push(d));return h},b.prototype.remove_question_mark_properties=function(){var a,b,c,d,e;for(d=this.value,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.remove_question_mark_properties());return e},b}(this.CollectionNode),this.MappingNode=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return i(b,a),b.prototype.id="mapping",b.prototype.clone=function(){var a,b,c,d,e,f,g,h;for(b=[],h=this.value,f=0,g=h.length;g>f;f++)c=h[f],a=c[0].clone(),e=c[1].clone(),b.push([a,e]);return d=new this.constructor(this.tag,b,this.start_mark,this.end_mark,this.flow_style)},b.prototype.cloneRemoveIs=function(){var a,b,c,d,e,f,g,h,i;for(b=[],h=this.value,f=0,g=h.length;g>f;f++)c=h[f],a=c[0].cloneRemoveIs(),e=c[1].cloneRemoveIs(),"is"!==(i=a.value)&&b.push([a,e]);return d=new this.constructor(this.tag,b,this.start_mark,this.end_mark,this.flow_style)},b.prototype.cloneForTrait=function(){var a,b,c,d,e,f,g,h,i;for(b=[],h=this.value,f=0,g=h.length;g>f;f++)c=h[f],a=c[0].clone(),e=c[1].clone(),"usage"!==(i=a.value)&&"displayName"!==i&&b.push([a,e]);return d=new this.constructor(this.tag,b,this.start_mark,this.end_mark,this.flow_style)},b.prototype.cloneForResourceType=function(){var a,b,c,d,e,f,g,h,i;for(b=[],h=this.value,f=0,g=h.length;g>f;f++)c=h[f],a=c[0].cloneRemoveIs(),e=c[1].cloneRemoveIs(),"is"!==(i=a.value)&&"type"!==i&&"usage"!==i&&"displayName"!==i&&b.push([a,e]);return d=new this.constructor(this.tag,b,this.start_mark,this.end_mark,this.flow_style)},b.prototype.combine=function(a){var b,d,e,f,g,h,i,j,k,l;if("tag:yaml.org,2002:null"===a.tag&&(a=new c.MappingNode("tag:yaml.org,2002:map",[],a.start_mark,a.end_mark)),!(a instanceof c.MappingNode))throw new c.ApplicationError("while applying node",null,"different YAML structures",this.start_mark);for(k=a.value,l=[],i=0,j=k.length;j>i;i++)h=k[i],b=h[0].value,d=this.value.some(function(a){return a[0].value===b||a[0].value+"?"===b||a[0].value===b+"?"}),d?l.push(function(){var a,d,i,j;for(i=this.value,j=[],a=0,d=i.length;d>a;a++)f=i[a],g=f[0].value,g===b||g+"?"===b||g===b+"?"?("tag:yaml.org,2002:null"===f[1].tag&&"tag:yaml.org,2002:map"===h[1].tag&&(e=new c.MappingNode("tag:yaml.org,2002:map",[],f[1].start_mark,f[1].end_mark),f[1]=e),f[1].combine(h[1]),("?"!==f[0].value.slice(-1)||"?"!==h[0].value.slice(-1))&&"?"===f[0].value.slice(-1)?j.push(f[0].value=f[0].value.slice(0,-1)):j.push(void 0)):j.push(void 0);return j}.call(this)):l.push(this.value.push([h[0].clone(),h[1].clone()]));return l},b.prototype.remove_question_mark_properties=function(){var a,b,c,d,e;for(this.value=this.value.filter(function(a){return"?"!==a[0].value.slice(-1)}),d=this.value,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a[1].remove_question_mark_properties());return e},b}(this.CollectionNode)}).call(this)},{"./errors":3}],8:[function(a,b,c){(function(){var b,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=[].slice;d=a("./events"),b=a("./errors").MarkedYAMLError,e=a("./tokens"),this.ParserError=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return h(b,a),b}(b),this.Parser=function(){function a(){this.current_event=null,this.yaml_version=null,this.tag_handles={},this.states=[],this.marks=[],this.state="parse_stream_start"}var b;return b={"!":"!","!!":"tag:yaml.org,2002:"},a.prototype.dispose=function(){return this.states=[],this.state=null},a.prototype.check_event=function(){var a,b,c,d;if(b=1<=arguments.length?i.call(arguments,0):[],null===this.current_event&&null!=this.state&&(this.current_event=this[this.state]()),null!==this.current_event){if(0===b.length)return!0;for(c=0,d=b.length;d>c;c++)if(a=b[c],this.current_event instanceof a)return!0}return!1},a.prototype.peek_event=function(){return null===this.current_event&&null!=this.state&&(this.current_event=this[this.state]()),this.current_event},a.prototype.get_event=function(){var a;return null===this.current_event&&null!=this.state&&(this.current_event=this[this.state]()),a=this.current_event,this.current_event=null,a},a.prototype.parse_stream_start=function(){var a,b;return b=this.get_token(),a=new d.StreamStartEvent(b.start_mark,b.end_mark),this.state="parse_implicit_document_start",a},a.prototype.parse_implicit_document_start=function(){var a,c,f,g;return this.check_token(e.DirectiveToken,e.DocumentStartToken,e.StreamEndToken)?this.parse_document_start():(this.tag_handles=b,g=this.peek_token(),f=a=g.start_mark,c=new d.DocumentStartEvent(f,a,!1),this.states.push("parse_document_end"),this.state="parse_block_node",c)},a.prototype.parse_document_start=function(){for(var a,b,f,g,h,i,j;this.check_token(e.DocumentEndToken);)this.get_token();if(this.check_token(e.StreamEndToken)){if(h=this.get_token(),b=new d.StreamEndEvent(h.start_mark,h.end_mark), 0!==this.states.length)throw new Error("assertion error, states should be empty");if(0!==this.marks.length)throw new Error("assertion error, marks should be empty");this.state=null}else{if(f=this.peek_token().start_mark,j=this.process_directives(),i=j[0],g=j[1],!this.check_token(e.DocumentStartToken))throw new c.ParserError("expected '', but found "+this.peek_token().id,this.peek_token().start_mark);h=this.get_token(),a=h.end_mark,b=new d.DocumentStartEvent(f,a,!0,i,g),this.states.push("parse_document_end"),this.state="parse_document_content"}return b},a.prototype.parse_document_end=function(){var a,b,c,f,g;return g=this.peek_token(),f=a=g.start_mark,c=!1,this.check_token(e.DocumentEndToken)&&(g=this.get_token(),a=g.end_mark,c=!0),b=new d.DocumentEndEvent(f,a,c),this.state="parse_document_start",b},a.prototype.parse_document_content=function(){var a;return this.check_token(e.DirectiveToken,e.DocumentStartToken,e.DocumentEndToken,e.StreamEndToken)?(a=this.process_empty_scalar(this.peek_token().start_mark),this.state=this.states.pop(),a):this.parse_block_node()},a.prototype.process_directives=function(){var a,d,f,h,i,j,k,l,m,n;for(this.yaml_version=null,this.tag_handles={};this.check_token(e.DirectiveToken);)if(j=this.get_token(),"YAML"===j.name){if(null!==this.yaml_version)throw new c.ParserError(null,null,"found duplicate YAML directive",j.start_mark);if(l=j.value,d=l[0],f=l[1],1!==d||2!==f)throw new c.ParserError(null,null,"found incompatible YAML document (version 1.2 is required)",j.start_mark);this.yaml_version=j.value}else if("TAG"===j.name){if(m=j.value,a=m[0],h=m[1],a in this.tag_handles)throw new c.ParserError(null,null,"duplicate tag handle "+a,j.start_mark);this.tag_handles[a]=h}i=null,n=this.tag_handles;for(a in n)g.call(n,a)&&(h=n[a],null==i&&(i={}),i[a]=h);k=[this.yaml_version,i];for(a in b)g.call(b,a)&&(h=b[a],h in this.tag_handles||(this.tag_handles[a]=h));return k},a.prototype.parse_block_node=function(){return this.parse_node(!0)},a.prototype.parse_flow_node=function(){return this.parse_node()},a.prototype.parse_block_node_or_indentless_sequence=function(){return this.parse_node(!0,!0)},a.prototype.parse_node=function(a,b){var f,g,h,i,j,k,l,m,n,o,p;if(null==a&&(a=!1),null==b&&(b=!1),this.check_token(e.AliasToken))p=this.get_token(),h=new d.AliasEvent(p.value,p.start_mark,p.end_mark),this.state=this.states.pop();else{if(f=null,n=null,l=g=o=null,this.check_token(e.AnchorToken)?(p=this.get_token(),l=p.start_mark,g=p.end_mark,f=p.value,this.check_token(e.TagToken)&&(p=this.get_token(),o=p.start_mark,g=p.end_mark,n=p.value)):this.check_token(e.TagToken)&&(p=this.get_token(),l=o=p.start_mark,g=p.end_mark,n=p.value,this.check_token(e.AnchorToken)&&(p=this.get_token(),g=p.end_mark,f=p.value)),null!==n)if(i=n[0],m=n[1],null!==i){if(!(i in this.tag_handles))throw new c.ParserError("while parsing a node",l,"found undefined tag handle "+i,o);n=this.tag_handles[i]+m}else n=m;if(null===l&&(l=g=this.peek_token().start_mark),h=null,j=null===n||"!"===n,b&&this.check_token(e.BlockEntryToken))g=this.peek_token().end_mark,h=new d.SequenceStartEvent(f,n,j,l,g),this.state="parse_indentless_sequence_entry";else if(this.check_token(e.ScalarToken))p=this.get_token(),g=p.end_mark,j=p.plain&&null===n||"!"===n?[!0,!1]:null===n?[!1,!0]:[!1,!1],h=new d.ScalarEvent(f,n,j,p.value,l,g,p.style),this.state=this.states.pop();else if(this.check_token(e.FlowSequenceStartToken))g=this.peek_token().end_mark,h=new d.SequenceStartEvent(f,n,j,l,g,!0),this.state="parse_flow_sequence_first_entry";else if(this.check_token(e.FlowMappingStartToken))g=this.peek_token().end_mark,h=new d.MappingStartEvent(f,n,j,l,g,!0),this.state="parse_flow_mapping_first_key";else if(a&&this.check_token(e.BlockSequenceStartToken))g=this.peek_token().end_mark,h=new d.SequenceStartEvent(f,n,j,l,g,!1),this.state="parse_block_sequence_first_entry";else if(a&&this.check_token(e.BlockMappingStartToken))g=this.peek_token().end_mark,h=new d.MappingStartEvent(f,n,j,l,g,!1),this.state="parse_block_mapping_first_key";else{if(null===f&&null===n)throw k=a?"block":"flow",p=this.peek_token(),new c.ParserError("while parsing a "+k+" node",l,"expected the node content, but found "+p.id,p.start_mark);h=new d.ScalarEvent(f,n,[j,!1],"",l,g),this.state=this.states.pop()}}return h},a.prototype.parse_block_sequence_first_entry=function(){var a;return a=this.get_token(),this.marks.push(a.start_mark),this.parse_block_sequence_entry()},a.prototype.parse_block_sequence_entry=function(){var a,b;if(this.check_token(e.BlockEntryToken))return b=this.get_token(),this.check_token(e.BlockEntryToken,e.BlockEndToken)?(this.state="parse_block_sequence_entry",this.process_empty_scalar(b.end_mark)):(this.states.push("parse_block_sequence_entry"),this.parse_block_node());if(!this.check_token(e.BlockEndToken))throw b=this.peek_token(),new c.ParserError("while parsing a block collection",this.marks.slice(-1)[0],"expected , but found "+b.id,b.start_mark);return b=this.get_token(),a=new d.SequenceEndEvent(b.start_mark,b.end_mark),this.state=this.states.pop(),this.marks.pop(),a},a.prototype.parse_indentless_sequence_entry=function(){var a,b;return this.check_token(e.BlockEntryToken)?(b=this.get_token(),this.check_token(e.BlockEntryToken,e.KeyToken,e.ValueToken,e.BlockEndToken)?(this.state="parse_indentless_sequence_entry",this.process_empty_scalar(b.end_mark)):(this.states.push("parse_indentless_sequence_entry"),this.parse_block_node())):(b=this.peek_token(),a=new d.SequenceEndEvent(b.start_mark,b.start_mark),this.state=this.states.pop(),a)},a.prototype.parse_block_mapping_first_key=function(){var a;return a=this.get_token(),this.marks.push(a.start_mark),this.parse_block_mapping_key()},a.prototype.parse_block_mapping_key=function(){var a,b;if(this.check_token(e.KeyToken))return b=this.get_token(),this.check_token(e.KeyToken,e.ValueToken,e.BlockEndToken)?(this.state="parse_block_mapping_value",this.process_empty_scalar(b.end_mark)):(this.states.push("parse_block_mapping_value"),this.parse_block_node_or_indentless_sequence());if(!this.check_token(e.BlockEndToken))throw b=this.peek_token(),new c.ParserError("while parsing a block mapping",this.marks.slice(-1)[0],"expected , but found "+b.id,b.start_mark);return b=this.get_token(),a=new d.MappingEndEvent(b.start_mark,b.end_mark),this.state=this.states.pop(),this.marks.pop(),a},a.prototype.parse_block_mapping_value=function(){var a;return this.check_token(e.ValueToken)?(a=this.get_token(),this.check_token(e.KeyToken,e.ValueToken,e.BlockEndToken)?(this.state="parse_block_mapping_key",this.process_empty_scalar(a.end_mark)):(this.states.push("parse_block_mapping_key"),this.parse_block_node_or_indentless_sequence())):(this.state="parse_block_mapping_key",a=this.peek_token(),this.process_empty_scalar(a.start_mark))},a.prototype.parse_flow_sequence_first_entry=function(){var a;return a=this.get_token(),this.marks.push(a.start_mark),this.parse_flow_sequence_entry(!0)},a.prototype.parse_flow_sequence_entry=function(a){var b,f;if(null==a&&(a=!1),!this.check_token(e.FlowSequenceEndToken)){if(!a){if(!this.check_token(e.FlowEntryToken))throw f=this.peek_token(),new c.ParserError("while parsing a flow sequence",this.marks.slice(-1)[0],"expected ',' or ']', but got "+f.id,f.start_mark);this.get_token()}if(this.check_token(e.KeyToken))return f=this.peek_token(),b=new d.MappingStartEvent(null,null,!0,f.start_mark,f.end_mark,!0),this.state="parse_flow_sequence_entry_mapping_key",b;if(!this.check_token(e.FlowSequenceEndToken))return this.states.push("parse_flow_sequence_entry"),this.parse_flow_node()}return f=this.get_token(),b=new d.SequenceEndEvent(f.start_mark,f.end_mark),this.state=this.states.pop(),this.marks.pop(),b},a.prototype.parse_flow_sequence_entry_mapping_key=function(){var a;return a=this.get_token(),this.check_token(e.ValueToken,e.FlowEntryToken,e.FlowSequenceEndToken)?(this.state="parse_flow_sequence_entry_mapping_value",this.process_empty_scalar(a.end_mark)):(this.states.push("parse_flow_sequence_entry_mapping_value"),this.parse_flow_node())},a.prototype.parse_flow_sequence_entry_mapping_value=function(){var a;return this.check_token(e.ValueToken)?(a=this.get_token(),this.check_token(e.FlowEntryToken,e.FlowSequenceEndToken)?(this.state="parse_flow_sequence_entry_mapping_end",this.process_empty_scalar(a.end_mark)):(this.states.push("parse_flow_sequence_entry_mapping_end"),this.parse_flow_node())):(this.state="parse_flow_sequence_entry_mapping_end",a=this.peek_token(),this.process_empty_scalar(a.start_mark))},a.prototype.parse_flow_sequence_entry_mapping_end=function(){var a;return this.state="parse_flow_sequence_entry",a=this.peek_token(),new d.MappingEndEvent(a.start_mark,a.start_mark)},a.prototype.parse_flow_mapping_first_key=function(){var a;return a=this.get_token(),this.marks.push(a.start_mark),this.parse_flow_mapping_key(!0)},a.prototype.parse_flow_mapping_key=function(a){var b,f;if(null==a&&(a=!1),!this.check_token(e.FlowMappingEndToken)){if(!a){if(!this.check_token(e.FlowEntryToken))throw f=this.peek_token(),new c.ParserError("while parsing a flow mapping",this.marks.slice(-1)[0],"expected ',' or '}', but got "+f.id,f.start_mark);this.get_token()}if(this.check_token(e.KeyToken))return f=this.get_token(),this.check_token(e.ValueToken,e.FlowEntryToken,e.FlowMappingEndToken)?(this.state="parse_flow_mapping_value",this.process_empty_scalar(f.end_mark)):(this.states.push("parse_flow_mapping_value"),this.parse_flow_node());if(!this.check_token(e.FlowMappingEndToken))return this.states.push("parse_flow_mapping_empty_value"),this.parse_flow_node()}return f=this.get_token(),b=new d.MappingEndEvent(f.start_mark,f.end_mark),this.state=this.states.pop(),this.marks.pop(),b},a.prototype.parse_flow_mapping_value=function(){var a;return this.check_token(e.ValueToken)?(a=this.get_token(),this.check_token(e.FlowEntryToken,e.FlowMappingEndToken)?(this.state="parse_flow_mapping_key",this.process_empty_scalar(a.end_mark)):(this.states.push("parse_flow_mapping_key"),this.parse_flow_node())):(this.state="parse_flow_mapping_key",a=this.peek_token(),this.process_empty_scalar(a.start_mark))},a.prototype.parse_flow_mapping_empty_value=function(){return this.state="parse_flow_mapping_key",this.process_empty_scalar(this.peek_token().start_mark)},a.prototype.process_empty_scalar=function(a){return new d.ScalarEvent(null,null,[!0,!1],"",a,a)},a}()}).call(this)},{"./errors":3,"./events":4,"./tokens":17}],9:[function(a,b,c){(function(){var b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}};d=a("url"),b=a("./errors").MarkedYAMLError,c=a("./nodes"),e=a("./util"),this.Protocols=function(){function a(){this.apply_protocols=f(this.apply_protocols,this)}return a.prototype.apply_protocols=function(a){var b;return(b=this.apply_protocols_to_root(a))?this.apply_protocols_to_resources(a,b):void 0},a.prototype.apply_protocols_to_root=function(a){var b,e,f,g;if(this.has_property(a,"protocols"))return this.get_property(a,"protocols");if(b=this.property_value(a,"baseUri"))return e=d.parse(b),f=(e.protocol||"http:").slice(0,-1).toUpperCase(),g=[new c.ScalarNode("tag:yaml.org,2002:str","protocols",a.start_mark,a.end_mark),new c.SequenceNode("tag:yaml.org,2002:seq",[new c.ScalarNode("tag:yaml.org,2002:str",f,a.start_mark,a.end_mark)],a.start_mark,a.end_mark)],a.value.push(g),g[1]},a.prototype.apply_protocols_to_resources=function(a,b){var c,d,e,f,g;for(f=this.child_resources(a),g=[],d=0,e=f.length;e>d;d++)c=f[d],this.apply_protocols_to_resources(c,b),g.push(this.apply_protocols_to_methods(c,b));return g},a.prototype.apply_protocols_to_methods=function(a,b){var d,f,g,h,i;for(h=this.child_methods(a[1]),i=[],f=0,g=h.length;g>f;f++)d=h[f],this.has_property(d[1],"protocols")?i.push(void 0):(e.isMapping(d[1])||(d[1]=new c.MappingNode("tag:yaml.org,2002:map",[],d[1].start_mark,d[1].end_mark)),i.push(d[1].value.push([new c.ScalarNode("tag:yaml.org,2002:str","protocols",d[0].start_mark,d[0].end_mark),b.clone()])));return i},a}()}).call(this)},{"./errors":3,"./nodes":7,"./util":20,url:32}],10:[function(a,b,c){(function(){var b,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};this.errors=a("./errors"),this.loader=a("./loader"),d=a("./util"),this.FileError=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return g(b,a),b}(this.errors.MarkedYAMLError),this.FileReader=function(){function b(b){this.q=a("q"),this.url=a("url"),b&&(this.readFileAsyncOverride=b)}return b.prototype.readFileAsync=function(a){return this.readFileAsyncOverride?this.readFileAsyncOverride(a):/^https?/i.test(a)||"undefined"!=typeof window&&null!==window?this.fetchFileAsync(a):this.fetchLocalFileAsync(a)},b.prototype.fetchLocalFileAsync=function(b){var d,e=this;return d=this.q.defer(),a("fs").readFile(b,function(a,f){return a?d.reject(new c.FileError("while reading "+b,null,"cannot read "+b+" ("+a+")",e.start_mark)):d.resolve(f.toString())}),d.promise},b.prototype.fetchFileAsync=function(a){return"undefined"!=typeof window&&null!==window?this.fetchFileAsyncBrowser(a):this.fetchFileAsyncNode(a)},b.prototype.fetchFileAsyncNode=function(b){var d;return d=this.q.defer(),a("got").get(b,{headers:{Accept:"application/raml+yaml, */*"}},function(a,e,f){return a?d.reject(new c.FileError("while fetching "+b,null,"cannot fetch "+b+" ("+a.message+")",this.start_mark)):200===f.statusCode||304===f.statusCode?d.resolve(e):d.reject(new c.FileError("while fetching "+b,null,"cannot fetch "+b+" ("+f.statusCode+")",this.start_mark))}),d.promise},b.prototype.fetchFileAsyncBrowser=function(a){var b,d,e,f=this;b=this.q.defer(),e=new XMLHttpRequest;try{e.open("GET",a)}catch(g){throw d=g,new c.FileError("while fetching "+a,null,"cannot fetch "+a+" ("+d+"), check that the server is up and that CORS is enabled",this.start_mark)}return e.setRequestHeader("Accept","application/raml+yaml, */*"),e.onreadystatechange=function(){return 4===e.readyState?200===e.status||304===e.status?b.resolve(e.responseText):b.reject(new c.FileError("while fetching "+a,null,"cannot fetch "+a+" ("+e.status+")",f.start_mark)):void 0},e.send(),b.promise},b}(),this.RamlParser=function(){function e(c){this.settings=null!=c?c:b,this.q=a("q"),this.url=a("url"),this.nodes=a("./nodes"),this.loadDefaultSettings(this.settings)}return e.prototype.loadDefaultSettings=function(a){return Object.keys(b).forEach(function(c){return c in a?void 0:a[c]=b[c]})},e.prototype.loadFile=function(a,b){var d,e=this;null==b&&(b=this.settings);try{return b.reader.readFileAsync(a).then(function(c){return e.load(c,a,b)})}catch(f){return d=f,this.q.fcall(function(){throw new c.FileError("while fetching "+a,null,"cannot fetch "+a+" ("+d+")",null)})}},e.prototype.composeFile=function(a,b,d){var e,f=this;null==b&&(b=this.settings);try{return b.reader.readFileAsync(a).then(function(c){return f.compose(c,a,b,d)})}catch(g){return e=g,this.q.fcall(function(){throw new c.FileError("while fetching "+a,null,"cannot fetch "+a+" ("+e+")",null)})}},e.prototype.compose=function(a,b,c,d){return null==c&&(c=this.settings),null==d&&(d={src:b}),c.compose=!1,this.parseStream(a,b,c,d)},e.prototype.load=function(a,b,c){return null==c&&(c=this.settings),c.compose=!0,this.parseStream(a,b,c,{src:b})},e.prototype.parseStream=function(a,b,d,e){var f,g=this;return null==d&&(d=this.settings),f=new c.loader.Loader(a,b,d,e),this.q.fcall(function(){return f.getYamlRoot()}).then(function(a){var b;return b=f.getPendingFilesList(),g.getPendingFiles(f,a,b)}).then(function(a){return f.composeRamlTree(a,d),d.compose?null!=a?f.construct_document(a):null:a})},e.prototype.getPendingFiles=function(a,b,c){var d,e=this;return c.length?(d=c.map(function(b){return e.getPendingFile(a,b)}),this.q.all(d).then(function(a){var d;return d=void 0,a.forEach(function(a,b){var f;return f=e.mergePendingFile(c[b],a),f&&!d?d=f:void 0}),d?d:b})):b},e.prototype.getPendingFile=function(a,b){var d,e,f=this;return d=b.event,e=b.targetFileUri,a.parent&&this.isInIncludeTagsStack(e,a)?this.q.reject(new c.FileError("while composing scalar out of !include",null,"detected circular !include of "+d.value,d.start_mark)):this.settings.reader.readFileAsync(e).then(function(c){return"fragment"===b.type?f.compose(c,b.targetFileUri,{validate:!1,transform:!1,compose:!0},a):new f.nodes.ScalarNode("tag:yaml.org,2002:str",c,d.start_mark,d.end_mark,d.style)})["catch"](function(a){return f.addContextToError(a,d)})},e.prototype.mergePendingFile=function(a,b){var c,d;return d=a.parentNode,c=a.parentKey,this.appendNewNodeToParent(d,c,b)},e.prototype.addContextToError=function(a,b){throw"FileError"===a.constructor.name?(a.problem_mark||(a.problem_mark=b.start_mark),a):new c.FileError("while reading file",null,a,b.start_mark)},e.prototype.isInIncludeTagsStack=function(a,b){for(;b=b.parent;)if(b.src===a)return!0;return!1},e.prototype.appendNewNodeToParent=function(a,b,c){return a?(d.isSequence(a)?a.value[b]=c:a.value.push([b,c]),null):c},e}(),b={validate:!0,transform:!0,compose:!0,reader:new c.FileReader(null),applySchemas:!0},this.loadFile=function(a,d){var e;return null==d&&(d=b),e=new c.RamlParser(d),e.loadFile(a,d)},this.composeFile=function(a,d,e){var f;return null==d&&(d=b),null==e&&(e=a),f=new c.RamlParser(d),f.composeFile(a,d,e)},this.compose=function(a,d,e,f){var g;return null==e&&(e=b),null==f&&(f=d),g=new c.RamlParser(e),g.compose(a,d,e,f)},this.load=function(a,d,e){var f;return null==e&&(e=b),f=new c.RamlParser(e),f.load(a,d,e,null)}}).call(this)},{"./errors":3,"./loader":6,"./nodes":7,"./util":20,fs:22,got:23,q:37,url:32}],11:[function(a,b,c){(function(){var b,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},j=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};f=a("./errors"),b=f.Mark,d=f.MarkedYAMLError,e=a("./util").NON_PRINTABLE,this.ReaderError=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(d),this.Reader=function(){function a(a,b){this.string=a,this.src=b,this.line=0,this.column=0,this.index=0,this.string+="\x00"}return a.prototype.peek=function(a){return null==a&&(a=0),this.string[this.index+a]},a.prototype.prefix=function(a){return null==a&&(a=1),this.string.slice(this.index,this.index+a)},a.prototype.forward=function(a){var b,c;for(null==a&&(a=1),c=[];a;)b=this.string[this.index],this.index++,j.call("\n…₂\u2029",b)>=0||"\r"===b&&"\n"!==this.string[this.index]?(this.line++,this.column=0):(this.check_printable(b),this.column++),c.push(a--);return c},a.prototype.create_mark=function(a,c){return null==a&&(a=this.line),null==c&&(c=this.column),new b(this.src,a,c,this.string,this.index)},a.prototype.get_mark=function(){return this.create_mark()},a.prototype.check_printable=function(a){if(e.exec(a))throw new c.ReaderError("while reading file",null,"non printable characters are not allowed column: "+(this.get_mark().column+1),this.get_mark())},a}()}).call(this)},{"./errors":3,"./util":20}],12:[function(a,b,c){(function(){var b,c,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};c=a("./nodes"),d=a("./util"),b=a("./errors").YAMLError,this.ResolverError=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return h(b,a),b}(b),this.BaseResolver=function(){function a(){this.resolver_exact_paths=[],this.resolver_prefix_paths=[]}var b,e,f;return e="tag:yaml.org,2002:str",f="tag:yaml.org,2002:seq",b="tag:yaml.org,2002:map",a.prototype.yaml_implicit_resolvers={},a.prototype.yaml_path_resolvers={},a.add_implicit_resolver=function(a,b,c){var e,f,g,h,i;for(null==c&&(c=[null]),this.prototype.hasOwnProperty("yaml_implicit_resolvers")||(this.prototype.yaml_implicit_resolvers=d.extend({},this.prototype.yaml_implicit_resolvers)),i=[],g=0,h=c.length;h>g;g++)e=c[g],i.push((null!=(f=this.prototype.yaml_implicit_resolvers)[e]?(f=this.prototype.yaml_implicit_resolvers)[e]:f[e]=[]).push([a,b]));return i},a.prototype.descend_resolver=function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,p;if(!d.is_empty(this.yaml_path_resolvers)){if(e={},h=[],a)for(c=this.resolver_prefix_paths.length,m=this.resolver_prefix_paths.slice(-1)[0],i=0,k=m.length;k>i;i++)n=m[i],g=n[0],f=n[1],this.check_resolver_prefix(c,g,f,a,b)&&(g.length>c?h.push([g,f]):e[f]=this.yaml_path_resolvers[g][f]);else for(o=this.yaml_path_resolvers,j=0,l=o.length;l>j;j++)p=o[j],g=p[0],f=p[1],g?h.push([g,f]):e[f]=this.yaml_path_resolvers[g][f];return this.resolver_exact_paths.push(e),this.resolver_prefix_paths.push(h)}},a.prototype.ascend_resolver=function(){return d.is_empty(this.yaml_path_resolvers)?void 0:(this.resolver_exact_paths.pop(),this.resolver_prefix_paths.pop())},a.prototype.check_resolver_prefix=function(a,b,d,e,f){var g,h,i;if(i=b[a-1],h=i[0],g=i[1],"string"==typeof h){if(e.tag!==h)return}else if(null!==h&&!(e instanceof h))return;if((g!==!0||null===f)&&(g!==!1&&null!==g||null!==f)){if("string"==typeof g){if(!(f instanceof c.ScalarNode)&&g===f.value)return}else if("number"==typeof g&&g!==f)return;return!0}},a.prototype.resolve=function(a,d,g){var h,j,k,l,m,n,o,p,q,r,s,t;if(a===c.ScalarNode&&g[0]){for(m=""===d?null!=(q=this.yaml_implicit_resolvers[""])?q:[]:null!=(r=this.yaml_implicit_resolvers[d[0]])?r:[],m=m.concat(null!=(s=this.yaml_implicit_resolvers[null])?s:[]),o=0,p=m.length;p>o;o++)if(t=m[o],n=t[0],l=t[1],d.match(l))return n;g=g[1]}h=!0;for(k in this.yaml_path_resolvers)null=={}[k]&&(h=!1);if(!h){if(j=this.resolver_exact_paths.slice(-1)[0],i.call(j,a)>=0)return j[a];if(i.call(j,null)>=0)return j[null]}return a===c.ScalarNode?e:a===c.SequenceNode?f:a===c.MappingNode?b:void 0},a}(),this.Resolver=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return h(b,a),b}(this.BaseResolver),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:bool",/^(?:true|True|TRUE|false|False|FALSE)$/,"tTfF"),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:float",/^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)?|\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/,"-+0123456789."),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:int",/^(?:[-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+|[-+]?0o[0-7_]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$/,"-+0123456789"),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:merge",/^(?:<<)$/,"<"),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:null",/^(?:~|null|Null|NULL|)$/,["~","n","N",""]),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:timestamp",/^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]|[0-9][0-9][0-9][0-9]-[0-9][0-9]?-[0-9][0-9]?(?:[Tt]|[\x20\t]+)[0-9][0-9]?:[0-9][0-9]:[0-9][0-9](?:\.[0-9]*)?(?:[\x20\t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$/,"0123456789"),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:value",/^(?:=)$/,"="),this.Resolver.add_implicit_resolver("tag:yaml.org,2002:yaml",/^(?:!|&|\*)$/,"!&*")}).call(this)},{"./errors":3,"./nodes":7,"./util":20}],13:[function(a,b,c){(function(){var b,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=function(a,b){return function(){return a.apply(b,arguments)}};b=a("./errors").MarkedYAMLError,d=a("./nodes"),e=a("./util"),this.ResourceTypeError=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return h(b,a),b}(b),this.ResourceTypes=function(){function a(){this.apply_parameters_to_type=i(this.apply_parameters_to_type,this),this.apply_type=i(this.apply_type,this),this.apply_types=i(this.apply_types,this),this.get_type=i(this.get_type,this),this.has_types=i(this.has_types,this),this.load_types=i(this.load_types,this),this.declaredTypes={}}return a.prototype.load_types=function(a){var b,c=this;return this.load_default_media_type(a),this.has_property(a,"resourceTypes")&&(b=this.property_value(a,"resourceTypes"),b&&"object"==typeof b)?b.forEach(function(a){return a&&"object"==typeof a&&"object"==typeof a.value?a.value.forEach(function(a){return c.declaredTypes[a[0].value]=a}):void 0}):void 0},a.prototype.has_types=function(a){return 0===Object.keys(this.declaredTypes).length&&this.has_property(a,"resourceTypes")&&this.load_types(a),Object.keys(this.declaredTypes).length>0},a.prototype.get_type=function(a){return this.declaredTypes[a]},a.prototype.apply_types=function(a,b){var c,d=this;return null==b&&(b=""),e.isMapping(a)?this.has_types(a)?(c=this.child_resources(a),c.forEach(function(a){var c;return d.apply_default_media_type_to_resource(a[1]),d.has_property(a[1],"type")&&(c=d.get_property(a[1],"type"),d.apply_type(b+a[0].value,a,c)),d.apply_types(a[1],b+a[0].value)})):(c=this.child_resources(a),c.forEach(function(a){return d.apply_default_media_type_to_resource(a[1])})):void 0},a.prototype.apply_type=function(a,b,c){var d;return d=this.resolve_inheritance_chain(a,c),d.combine(b[1]),b[1]=d,b[1].remove_question_mark_properties()},a.prototype.resolve_inheritance_chain=function(a,b){var d,e,f,g,h,i,j,k,l,m,n,o;for(f=this.key_or_value(b),e=this.apply_parameters_to_type(a,f,b),o=[f],h={},h[f]=e,this.apply_default_media_type_to_resource(e),this.apply_traits_to_resource(a,e,!1);this.has_property(e,"type");){if(b=this.get_property(e,"type"),k=this.key_or_value(b),k in h)throw l=o.concat(k).join(" -> "),g=this.get_type(f)[0],new c.ResourceTypeError("while applying resourceTypes",null,'circular reference of "'+k+'" has been detected: '+l,g.start_mark);j=this.apply_parameters_to_type(a,k,b),this.apply_default_media_type_to_resource(j),this.apply_traits_to_resource(a,j,!1),f=k,e=j,h[f]=e,o.push(f)}for(n=o.pop(),d=h[n].cloneForResourceType(),m=d;i=o.pop();)d=h[i].cloneForResourceType(),m.combine(d);return m},a.prototype.apply_parameters_to_type=function(a,b,d){var e,f;if(!(null!=b?b.trim():void 0))throw new c.ResourceTypeError("while applying resource type",null,"resource type name must be provided",d.start_mark);if(!(f=this.get_type(b)))throw new c.ResourceTypeError("while applying resource type",null,"there is no resource type named "+b,d.start_mark);return f=f[1].clone(),e=this._get_parameters_from_type_key(a,d),this.apply_parameters(f,e,d),f},a.prototype._get_parameters_from_type_key=function(a,b){var d,f,g,h,i,j,k;if(h={},g={resourcePath:a.replace(/\/\/*/g,"/"),resourcePathName:this.extractResourcePathName(a)},e.isMapping(b)&&(f=this.value_or_undefined(b),e.isMapping(f[0][1])))for(k=f[0][1].value,i=0,j=k.length;j>i;i++){if(d=k[i],d[0].value in g)throw new c.ResourceTypeError("while applying parameters",null,"invalid parameter name: "+d[0].value+" is reserved",d[0].start_mark);h[d[0].value]=d[1].value}return e.extend(h,g)},a}()}).call(this)},{"./errors":3,"./nodes":7,"./util":20}],14:[function(a,b,c){(function(){var b,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},j=[].slice,k=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};b=a("./errors").MarkedYAMLError,e=a("./tokens"),f=a("./util"),this.ScannerError=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return i(b,a),b}(b),d=function(){function a(a,b,c,d,e,f){this.token_number=a,this.required=b,this.index=c,this.line=d,this.column=e,this.mark=f}return a}(),this.Scanner=function(){function a(a){this.settings=a,this.done=!1,this.ramlHeaderFound=!this.settings.validate,this.flow_level=0,this.tokens=[],this.fetch_stream_start(),this.tokens_taken=0,this.indent=-1,this.indents=[],this.allow_simple_key=!0,this.possible_simple_keys={}}var b,g,i,l,m,n,o;return b="\r\n…\u2028\u2029",i=" ",g="0123456789",m={0:"\x00",a:"",b:"\b",t:" "," ":" ",n:"\n",v:" ",f:"\f",r:"\r",e:""," ":" ",'"':'"',"\\":"\\",N:"…",_:" ",L:"\u2028",P:"\u2029"},l={x:2,u:4,U:8},n="#%RAML 0.8",o=/^#%RAML .+$/,a.prototype.check_token=function(){var a,b,c,d;for(b=1<=arguments.length?j.call(arguments,0):[];this.need_more_tokens();)this.fetch_more_tokens();if(0!==this.tokens.length){if(0===b.length)return!0;for(c=0,d=b.length;d>c;c++)if(a=b[c],this.tokens[0]instanceof a)return!0}return!1},a.prototype.peek_token=function(){for(;this.need_more_tokens();)this.fetch_more_tokens();return 0!==this.tokens.length?this.tokens[0]:void 0},a.prototype.get_token=function(){for(;this.need_more_tokens();)this.fetch_more_tokens();return 0!==this.tokens.length?(this.tokens_taken++,this.tokens.shift()):void 0},a.prototype.need_more_tokens=function(){return this.done?!1:0===this.tokens.length?!0:(this.stale_possible_simple_keys(),this.next_possible_simple_key()===this.tokens_taken?!0:!1)},a.prototype.fetch_more_tokens=function(){var a;if(this.scan_to_next_token(),this.stale_possible_simple_keys(),this.unwind_indent(this.column),a=this.peek(),"\x00"===a)return this.fetch_stream_end();if("%"===a&&this.check_directive())return this.fetch_directive();if("-"===a&&this.check_document_start())return this.fetch_document_start();if("."===a&&this.check_document_end())return this.fetch_document_end();if("["===a)return this.fetch_flow_sequence_start();if("{"===a)return this.fetch_flow_mapping_start();if("]"===a)return this.fetch_flow_sequence_end();if("}"===a)return this.fetch_flow_mapping_end();if(","===a)return this.fetch_flow_entry();if("-"===a&&this.check_block_entry())return this.fetch_block_entry();if("?"===a&&this.check_key())return this.fetch_key();if(":"===a&&this.check_value())return this.fetch_value();if("*"===a)return this.fetch_alias();if("&"===a)return this.fetch_anchor();if("!"===a)return this.fetch_tag();if("|"===a&&0===this.flow_level)return this.fetch_literal();if(">"===a&&0===this.flow_level)return this.fetch_folded();if("'"===a)return this.fetch_single();if('"'===a)return this.fetch_double();if(this.check_plain())return this.fetch_plain();throw new c.ScannerError("while scanning for the next token",null,"found character "+a+" that cannot start any token",this.get_mark())},a.prototype.next_possible_simple_key=function(){var a,b,c,d;c=null,d=this.possible_simple_keys;for(b in d)h.call(d,b)&&(a=d[b],(null===c||a.token_numbera;)b=this.get_mark(),this.indent=this.indents.pop(),c.push(this.tokens.push(new e.BlockEndToken(b,b)));return c}},a.prototype.add_indent=function(a){return a>this.indent?(this.indents.push(this.indent), -this.indent=a,!0):!1},a.prototype.fetch_stream_start=function(){var a;return a=this.get_mark(),this.tokens.push(new e.StreamStartToken(a,a,this.encoding))},a.prototype.fetch_stream_end=function(){var a;return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_possible_simple_key=!1,this.possible_simple_keys={},a=this.get_mark(),this.tokens.push(new e.StreamEndToken(a,a)),this.done=!0},a.prototype.fetch_directive=function(){return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_directive())},a.prototype.fetch_document_start=function(){return this.fetch_document_indicator(e.DocumentStartToken)},a.prototype.fetch_document_end=function(){return this.fetch_document_indicator(e.DocumentEndToken)},a.prototype.fetch_document_indicator=function(a){var b;return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_simple_key=!1,b=this.get_mark(),this.forward(3),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_sequence_start=function(){return this.fetch_flow_collection_start(e.FlowSequenceStartToken)},a.prototype.fetch_flow_mapping_start=function(){return this.fetch_flow_collection_start(e.FlowMappingStartToken)},a.prototype.fetch_flow_collection_start=function(a){var b;return this.save_possible_simple_key(),this.flow_level++,this.allow_simple_key=!0,b=this.get_mark(),this.forward(),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_sequence_end=function(){return this.fetch_flow_collection_end(e.FlowSequenceEndToken)},a.prototype.fetch_flow_mapping_end=function(){return this.fetch_flow_collection_end(e.FlowMappingEndToken)},a.prototype.fetch_flow_collection_end=function(a){var b;return this.remove_possible_simple_key(),this.flow_level--,this.allow_simple_key=!1,b=this.get_mark(),this.forward(),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_entry=function(){var a;return this.allow_simple_key=!0,this.remove_possible_simple_key(),a=this.get_mark(),this.forward(),this.tokens.push(new e.FlowEntryToken(a,this.get_mark()))},a.prototype.fetch_block_entry=function(){var a,b;if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"sequence entries are not allowed here",this.get_mark());this.add_indent(this.column)&&(a=this.get_mark(),this.tokens.push(new e.BlockSequenceStartToken(a,a)))}return this.allow_simple_key=!0,this.remove_possible_simple_key(),b=this.get_mark(),this.forward(),this.tokens.push(new e.BlockEntryToken(b,this.get_mark()))},a.prototype.fetch_key=function(){var a,b;if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"mapping keys are not allowed here",this.get_mark());this.add_indent(this.column)&&(a=this.get_mark(),this.tokens.push(new e.BlockMappingStartToken(a,a)))}return this.allow_simple_key=!this.flow_level,this.remove_possible_simple_key(),b=this.get_mark(),this.forward(),this.tokens.push(new e.KeyToken(b,this.get_mark()))},a.prototype.fetch_value=function(){var a,b,d;if(a=this.possible_simple_keys[this.flow_level])delete this.possible_simple_keys[this.flow_level],this.tokens.splice(a.token_number-this.tokens_taken,0,new e.KeyToken(a.mark,a.mark)),0===this.flow_level&&this.add_indent(a.column)&&this.tokens.splice(a.token_number-this.tokens_taken,0,new e.BlockMappingStartToken(a.mark,a.mark)),this.allow_simple_key=!1;else{if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"mapping values are not allowed here",this.get_mark());this.add_indent(this.column)&&(b=this.get_mark(),this.tokens.push(new e.BlockMappingStartToken(b,b)))}this.allow_simple_key=!this.flow_level,this.remove_possible_simple_key()}return d=this.get_mark(),this.forward(),this.tokens.push(new e.ValueToken(d,this.get_mark()))},a.prototype.fetch_alias=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_anchor(e.AliasToken))},a.prototype.fetch_anchor=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_anchor(e.AnchorToken))},a.prototype.fetch_tag=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_tag())},a.prototype.fetch_literal=function(){return this.fetch_block_scalar("|")},a.prototype.fetch_folded=function(){return this.fetch_block_scalar(">")},a.prototype.fetch_block_scalar=function(a){return this.allow_simple_key=!0,this.remove_possible_simple_key(),this.tokens.push(this.scan_block_scalar(a))},a.prototype.fetch_single=function(){return this.fetch_flow_scalar("'")},a.prototype.fetch_double=function(){return this.fetch_flow_scalar('"')},a.prototype.fetch_flow_scalar=function(a){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_flow_scalar(a))},a.prototype.fetch_plain=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_plain())},a.prototype.check_directive=function(){return 0===this.column?!0:!1},a.prototype.check_document_start=function(){var a;return 0===this.column&&"---"===this.prefix(3)&&(a=this.peek(3),k.call(b+i+"\x00",a)>=0)?!0:!1},a.prototype.check_document_end=function(){var a;return 0===this.column&&"..."===this.prefix(3)&&(a=this.peek(3),k.call(b+i+"\x00",a)>=0)?!0:!1},a.prototype.check_block_entry=function(){var a;return a=this.peek(1),k.call(b+i+"\x00",a)>=0},a.prototype.check_key=function(){var a;return 0!==this.flow_level?!0:(a=this.peek(1),k.call(b+i+"\x00",a)>=0)},a.prototype.check_value=function(){var a;return 0!==this.flow_level?!0:(a=this.peek(1),k.call(b+i+"\x00",a)>=0)},a.prototype.check_plain=function(){var a,c;return a=this.peek(),k.call(b+i+"\x00-?:,[]{}#&*!|>'\"%@`",a)<0||(c=this.peek(1),k.call(b+i+"\x00",c)<0&&("-"===a||0===this.flow_level&&k.call("?:",a)>=0))},a.prototype.scan_to_next_token=function(){var a,d,e,f,g;for(0===this.index&&"\ufeff"===this.peek()&&this.forward(),d=!1,g=[];!d;){for(;" "===this.peek();)this.forward();if(a="","#"===this.peek())for(;f=this.peek(),k.call(b+"\x00",f)<0;)this.ramlHeaderFound||(a+=this.peek()),this.forward();if(!this.ramlHeaderFound){if(e=a.trim(),!e||!o.test(e))throw new c.ScannerError("version validation",null,"The first line must be: '"+n+"'",this.create_mark(0,0));if(e!==n)throw new c.ScannerError("version validation",null,"Unsupported RAML version: '"+a+"'",this.create_mark(0,0));this.ramlHeaderFound=!0}this.scan_line_break()?0===this.flow_level?g.push(this.allow_simple_key=!0):g.push(void 0):g.push(d=!0)}return g},a.prototype.scan_directive=function(){var a,c,d,f,g;if(d=this.get_mark(),this.forward(),c=this.scan_directive_name(d),f=null,"YAML"===c)f=this.scan_yaml_directive_value(d),a=this.get_mark();else if("TAG"===c)f=this.scan_tag_directive_value(d),a=this.get_mark();else for(a=this.get_mark();g=this.peek(),k.call(b+"\x00",g)<0;)this.forward();return this.scan_directive_ignored_line(d),new e.DirectiveToken(c,f,d,a)},a.prototype.scan_directive_name=function(a){var d,e,f;for(e=0,d=this.peek(e);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)e++,d=this.peek(e);if(0===e)throw new c.ScannerError("while scanning a directive",a,"expected alphanumeric or numeric character but found "+d,this.get_mark());if(f=this.prefix(e),this.forward(e),d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected alphanumeric or numeric character but found "+d,this.get_mark());return f},a.prototype.scan_yaml_directive_value=function(a){for(var d,e,f;" "===this.peek();)this.forward();if(d=this.scan_yaml_directive_number(a),"."!==this.peek())throw new c.ScannerError("while scanning a directive",a,"expected a digit or '.' but found "+this.peek(),this.get_mark());if(this.forward(),e=this.scan_yaml_directive_number(a),f=this.peek(),k.call(b+"\x00 ",f)<0)throw new c.ScannerError("while scanning a directive",a,"expected a digit or ' ' but found "+this.peek(),this.get_mark());return[d,e]},a.prototype.scan_yaml_directive_number=function(a){var b,d,e,f;if(b=this.peek(),!(b>="0"&&"9">=b))throw new c.ScannerError("while scanning a directive",a,"expected a digit but found "+b,this.get_mark());for(d=0;"0"<=(f=this.peek(d))&&"9">=f;)d++;return e=parseInt(this.prefix(d)),this.forward(d),e},a.prototype.scan_tag_directive_value=function(a){for(var b,c;" "===this.peek();)this.forward();for(b=this.scan_tag_directive_handle(a);" "===this.peek();)this.forward();return c=this.scan_tag_directive_prefix(a),[b,c]},a.prototype.scan_tag_directive_handle=function(a){var b,d;if(d=this.scan_tag_handle("directive",a),b=this.peek()," "!==b)throw new c.ScannerError("while scanning a directive",a,"expected ' ' but found "+b,this.get_mark());return d},a.prototype.scan_tag_directive_prefix=function(a){var d,e;if(e=this.scan_tag_uri("directive",a),d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected ' ' but found "+d,this.get_mark());return e},a.prototype.scan_directive_ignored_line=function(a){for(var d,e;" "===this.peek();)this.forward();if("#"===this.peek())for(;e=this.peek(),k.call(b+"\x00",e)<0;)this.forward();if(d=this.peek(),k.call(b+"\x00",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected a comment or a line break but found "+d,this.get_mark());return this.scan_line_break()},a.prototype.scan_anchor=function(a){var d,e,f,g,h,j;for(h=this.get_mark(),e=this.peek(),g="*"===e?"alias":"anchor",this.forward(),f=0,d=this.peek(f);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)f++,d=this.peek(f);if(0===f)throw new c.ScannerError("while scanning an "+g,h,"expected alphabetic or numeric character but found '"+d+"'",this.get_mark());if(j=this.prefix(f),this.forward(f),d=this.peek(),k.call(b+i+"\x00?:,]}%@`",d)<0)throw new c.ScannerError("while scanning an "+g,h,"expected alphabetic or numeric character but found '"+d+"'",this.get_mark());return new a(j,h,this.get_mark())},a.prototype.scan_tag=function(){var a,d,f,g,h,j;if(g=this.get_mark(),a=this.peek(1),"<"===a){if(d=null,this.forward(2),h=this.scan_tag_uri("tag",g),">"!==this.peek())throw new c.ScannerError("while parsing a tag",g,"expected '>' but found "+this.peek(),this.get_mark());this.forward()}else if(k.call(b+i+"\x00",a)>=0)d=null,h="!",this.forward();else{for(f=1,j=!1;k.call(b+"\x00 ",a)<0;){if("!"===a){j=!0;break}f++,a=this.peek(f)}j?d=this.scan_tag_handle("tag",g):(d="!",this.forward()),h=this.scan_tag_uri("tag",g)}if(a=this.peek(),k.call(b+"\x00 ",a)<0)throw new c.ScannerError("while scanning a tag",g,"expected ' ' but found "+a,this.get_mark());return new e.TagToken([d,h],g,this.get_mark())},a.prototype.scan_block_scalar=function(a){var c,d,g,h,i,j,l,m,n,o,p,q,r,s,t,u,v,w,x,y;for(i=">"===a,g=[],r=this.get_mark(),this.forward(),s=this.scan_block_scalar_indicators(r),d=s[0],j=s[1],this.scan_block_scalar_ignored_line(r),q=this.indent+1,1>q&&(q=1),null==j?(t=this.scan_block_scalar_indentation(),c=t[0],p=t[1],h=t[2],l=Math.max(q,p)):(l=q+j-1,u=this.scan_block_scalar_breaks(l),c=u[0],h=u[1]),o="";this.column===l&&"\x00"!==this.peek();){for(g=g.concat(c),v=this.peek(),m=k.call(" ",v)<0,n=0;w=this.peek(n),k.call(b+"\x00",w)<0;)n++;if(g.push(this.prefix(n)),this.forward(n),o=this.scan_line_break(),x=this.scan_block_scalar_breaks(l),c=x[0],h=x[1],this.column!==l||"\x00"===this.peek())break;i&&"\n"===o&&m&&(y=this.peek(),k.call(" ",y)<0)?f.is_empty(c)&&g.push(" "):g.push(o)}return d!==!1&&g.push(o),d===!0&&(g=g.concat(c)),new e.ScalarToken(g.join(""),!1,r,h,a)},a.prototype.scan_block_scalar_indicators=function(a){var d,e,f;if(e=null,f=null,d=this.peek(),k.call("+-",d)>=0){if(e="+"===d,this.forward(),d=this.peek(),k.call(g,d)>=0){if(f=parseInt(d),0===f)throw new c.ScannerError("while scanning a block scalar",a,"expected indentation indicator in the range 1-9 but found 0",this.get_mark());this.forward()}}else if(k.call(g,d)>=0){if(f=parseInt(d),0===f)throw new c.ScannerError("while scanning a block scalar",a,"expected indentation indicator in the range 1-9 but found 0",this.get_mark());this.forward(),d=this.peek(),k.call("+-",d)>=0&&(e="+"===d,this.forward())}if(d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a block scalar",a,"expected chomping or indentation indicators, but found "+d,this.get_mark());return[e,f]},a.prototype.scan_block_scalar_ignored_line=function(a){for(var d,e;" "===this.peek();)this.forward();if("#"===this.peek())for(;e=this.peek(),k.call(b+"\x00",e)<0;)this.forward();if(d=this.peek(),k.call(b+"\x00",d)<0)throw new c.ScannerError("while scanning a block scalar",a,"expected a comment or a line break but found "+d,this.get_mark());return this.scan_line_break()},a.prototype.scan_block_scalar_indentation=function(){var a,c,d,e;for(a=[],d=0,c=this.get_mark();e=this.peek(),k.call(b+" ",e)>=0;)" "!==this.peek()?(a.push(this.scan_line_break()),c=this.get_mark()):(this.forward(),this.column>d&&(d=this.column));return[a,d,c]},a.prototype.scan_block_scalar_breaks=function(a){var c,d,e;for(c=[],d=this.get_mark();this.column=0;)for(c.push(this.scan_line_break()),d=this.get_mark();this.column=0)f.push(e),this.forward();else{if(!a||"\\"!==e)return f;if(this.forward(),e=this.peek(),e in m)f.push(m[e]),this.forward();else if(e in l){for(n=l[e],this.forward(),j=o=0;n>=0?n>o:o>n;j=n>=0?++o:--o)if(q=this.peek(j),k.call(g+"ABCDEFabcdef",q)<0)throw new c.ScannerError("while scanning a double-quoted scalar",d,"expected escape sequence of "+n+" hexadecimal numbers, but found "+this.peek(j),this.get_mark());h=parseInt(this.prefix(n),16),f.push(String.fromCharCode(h)),this.forward(n)}else{if(!(k.call(b,e)>=0))throw new c.ScannerError("while scanning a double-quoted scalar",d,"found unknown escape character "+e,this.get_mark());this.scan_line_break(),f=f.concat(this.scan_flow_scalar_breaks(a,d))}}else f.push("'"),this.forward(2)}},a.prototype.scan_flow_scalar_spaces=function(a,d){var e,f,g,h,j,l,m;for(g=[],h=0;m=this.peek(h),k.call(i,m)>=0;)h++;if(l=this.prefix(h),this.forward(h),f=this.peek(),"\x00"===f)throw new c.ScannerError("while scanning a quoted scalar",d,"found unexpected end of stream",this.get_mark());return k.call(b,f)>=0?(j=this.scan_line_break(),e=this.scan_flow_scalar_breaks(a,d),"\n"!==j?g.push(j):e||g.push(" "),g=g.concat(e)):g.push(l),g},a.prototype.scan_flow_scalar_breaks=function(a,d){var e,f,g,h,j;for(e=[];;){if(f=this.prefix(3),"---"===f||"..."===f&&(g=this.peek(3),k.call(b+i+"\x00",g)>=0))throw new c.ScannerError("while scanning a quoted scalar",d,"found unexpected document separator",this.get_mark());for(;h=this.peek(),k.call(i,h)>=0;)this.forward();if(j=this.peek(),!(k.call(b,j)>=0))return e;e.push(this.scan_line_break())}},a.prototype.scan_plain=function(){var a,d,f,g,h,j,l,m,n;for(d=[],l=f=this.get_mark(),g=this.indent+1,j=[];;){if(h=0,"#"===this.peek())break;for(;;){if(a=this.peek(h),k.call(b+i+"\x00",a)>=0||0===this.flow_level&&":"===a&&(m=this.peek(h+1),k.call(b+i+"\x00",m)>=0)||0!==this.flow_level&&k.call(",:?[]{}",a)>=0)break;h++}if(0!==this.flow_level&&":"===a&&(n=this.peek(h+1),k.call(b+i+"\x00,[]{}",n)<0))throw this.forward(h),new c.ScannerError("while scanning a plain scalar",l,"found unexpected ':'",this.get_mark(),"Please check http://pyyaml.org/wiki/YAMLColonInFlowContext");if(0===h)break;if(this.allow_simple_key=!1,d=d.concat(j),d.push(this.prefix(h)),this.forward(h),f=this.get_mark(),j=this.scan_plain_spaces(g,l),null==j||0===j.length||"#"===this.peek()||0===this.flow_level&&this.column=0;)g++;if(l=this.prefix(g),this.forward(g),e=this.peek(),k.call(b,e)>=0){if(h=this.scan_line_break(),this.allow_simple_key=!0,j=this.prefix(3),"---"===j||"..."===j&&this.peek(k.call(b+i+"\x00",3)>=0))return;for(d=[];n=this.peek(),k.call(b+" ",n)>=0;)if(" "===this.peek())this.forward();else if(d.push(this.scan_line_break()),j=this.prefix(3),"---"===j||"..."===j&&this.peek(k.call(b+i+"\x00",3)>=0))return;"\n"!==h?f.push(h):0===d.length&&f.push(" "),f=f.concat(d)}else l&&f.push(l);return f},a.prototype.scan_tag_handle=function(a,b){var d,e,f;if(d=this.peek(),"!"!==d)throw new c.ScannerError("while scanning a "+a,b,"expected '!' but found "+d,this.get_mark());if(e=1,d=this.peek(e)," "!==d){for(;d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)e++,d=this.peek(e);if("!"!==d)throw this.forward(e),new c.ScannerError("while scanning a "+a,b,"expected '!' but found "+d,this.get_mark());e++}return f=this.prefix(e),this.forward(e),f},a.prototype.scan_tag_uri=function(a,b){var d,e,f;for(e=[],f=0,d=this.peek(f);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-;/?:@&=+$,_.!~*'()[]%",d)>=0;)"%"===d?(e.push(this.prefix(f)),this.forward(f),f=0,e.push(this.scan_uri_escapes(a,b))):f++,d=this.peek(f);if(0!==f&&(e.push(this.prefix(f)),this.forward(f),f=0),0===e.length)throw new c.ScannerError("while parsing a "+a,b,"expected URI but found "+d,this.get_mark());return e.join("")},a.prototype.scan_uri_escapes=function(a,b){var d,e,f,g;for(d=[],f=this.get_mark();"%"===this.peek();){for(this.forward(),e=g=0;2>=g;e=++g)throw new c.ScannerError("while scanning a "+a,b,"expected URI escape sequence of 2 hexadecimal numbers but found "+this.peek(e),this.get_mark());d.push(String.fromCharCode(parseInt(this.prefix(2),16))),this.forward(2)}return d.join("")},a.prototype.scan_line_break=function(){var a;return a=this.peek(),k.call("\r\n…",a)>=0?("\r\n"===this.prefix(2)?this.forward(2):this.forward(),"\n"):k.call("\u2028\u2029",a)>=0?(this.forward(),a):""},a}()}).call(this)},{"./errors":3,"./tokens":17,"./util":20}],15:[function(a,b,c){(function(){var b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};b=a("./errors").MarkedYAMLError,c=a("./nodes"),this.SchemaError=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(b),this.Schemas=function(){function a(){this.get_schemas_used=g(this.get_schemas_used,this),this.apply_schemas=g(this.apply_schemas,this),this.get_all_schemas=g(this.get_all_schemas,this),this.has_schemas=g(this.has_schemas,this),this.load_schemas=g(this.load_schemas,this),this.declaredSchemas={}}return a.prototype.load_schemas=function(a){var b,c=this;return this.has_property(a,"schemas")&&(b=this.property_value(a,"schemas"),b&&"object"==typeof b)?b.forEach(function(a){return a&&"object"==typeof a&&"object"==typeof a.value?a.value.forEach(function(a){return c.declaredSchemas[a[0].value]=a}):void 0}):void 0},a.prototype.has_schemas=function(a){return 0===this.declaredSchemas.length&&this.has_property(a,"schemas")&&this.load_schemas(a),Object.keys(this.declaredSchemas).length>0},a.prototype.get_all_schemas=function(){return this.declaredSchemas},a.prototype.apply_schemas=function(a){var b,c,d=this;return b=this.child_resources(a),c=this.get_schemas_used(b),c.forEach(function(a){return a[1].value in d.declaredSchemas?a[1].value=d.declaredSchemas[a[1].value][1].value:void 0})},a.prototype.get_schemas_used=function(a){var b,c=this;return b=[],a.forEach(function(a){var d;return d=c.get_properties(a[1],"schema"),b=b.concat(d)}),b},a}()}).call(this)},{"./errors":3,"./nodes":7}],16:[function(a,b,c){(function(){var b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};b=a("./errors").MarkedYAMLError,c=a("./nodes"),this.SecuritySchemeError=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(b),this.SecuritySchemes=function(){function a(){this.get_security_scheme=g(this.get_security_scheme,this),this.get_all_schemes=g(this.get_all_schemes,this),this.load_security_schemes=g(this.load_security_schemes,this),this.declaredSchemes={}}return a.prototype.load_security_schemes=function(a){var b,c=this;return this.has_property(a,"securitySchemes")&&(b=this.property_value(a,"securitySchemes"),b&&"object"==typeof b)?b.forEach(function(a){return"tag:yaml.org,2002:map"===a.tag?a.value.forEach(function(a){return c.declaredSchemes[a[0].value]=a[1].value}):void 0}):void 0},a.prototype.get_all_schemes=function(){return this.declaredSchemes},a.prototype.get_security_scheme=function(a){return this.declaredSchemes[a]},a}()}).call(this)},{"./errors":3,"./nodes":7}],17:[function(a,b,c){(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o={}.hasOwnProperty,p=function(a,b){function c(){this.constructor=a}for(var d in b)o.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};this.Token=function(){function a(a,b){this.start_mark=a,this.end_mark=b}return a}(),this.DirectiveToken=function(a){function b(a,b,c,d){this.name=a,this.value=b,this.start_mark=c,this.end_mark=d}return p(b,a),b.prototype.id="",b}(this.Token),this.DocumentStartToken=function(b){function c(){return a=c.__super__.constructor.apply(this,arguments)}return p(c,b),c.prototype.id="",c}(this.Token),this.DocumentEndToken=function(a){function c(){return b=c.__super__.constructor.apply(this,arguments)}return p(c,a),c.prototype.id="",c}(this.Token),this.StreamStartToken=function(a){function b(a,b,c){this.start_mark=a,this.end_mark=b,this.encoding=c}return p(b,a),b.prototype.id="",b}(this.Token),this.StreamEndToken=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockSequenceStartToken=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockMappingStartToken=function(a){function b(){return i=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockEndToken=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.FlowSequenceStartToken=function(a){function b(){return k=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="[",b}(this.Token),this.FlowMappingStartToken=function(a){function b(){return l=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="{",b}(this.Token),this.FlowSequenceEndToken=function(a){function b(){return m=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="]",b}(this.Token),this.FlowMappingEndToken=function(a){function b(){return n=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="}",b}(this.Token),this.KeyToken=function(a){function b(){return c=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="?",b}(this.Token),this.ValueToken=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id=":",b}(this.Token),this.BlockEntryToken=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="-",b}(this.Token),this.FlowEntryToken=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id=",",b}(this.Token),this.AliasToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.AnchorToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.TagToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.ScalarToken=function(a){function b(a,b,c,d,e){this.value=a,this.plain=b,this.start_mark=c,this.end_mark=d,this.style=e}return p(b,a),b.prototype.id="",b}(this.Token)}).call(this)},{}],18:[function(a,b,c){(function(){var b,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("pluralize"),b=a("./errors").MarkedYAMLError,d=a("./nodes"),f=a("./util"),this.TraitError=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return j(b,a),b}(b),this.ParameterError=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return j(b,a),b}(b),this.Traits=function(){function a(){this.declaredTraits={}}return a.prototype.load_traits=function(a){var b,c=this;return this.has_property(a,"traits")&&(b=this.property_value(a,"traits"),b&&"object"==typeof b)?b.forEach(function(a){return a&&"object"==typeof a&&"object"==typeof a.value?a.value.forEach(function(a){return c.declaredTraits[a[0].value]=a}):void 0}):void 0},a.prototype.has_traits=function(a){return 0===this.declaredTraits.length&&this.has_property(a,"traits")&&this.load_traits(a),Object.keys(this.declaredTraits).length>0},a.prototype.get_trait=function(a){return a in this.declaredTraits?this.declaredTraits[a][1]:null},a.prototype.apply_traits=function(a,b,c){var d,e=this;return null==b&&(b=""),null==c&&(c=!0),f.isMapping(a)&&this.has_traits(a)?(d=this.child_resources(a),d.forEach(function(a){return e.apply_traits_to_resource(b+a[0].value,a[1],c)})):void 0},a.prototype.apply_traits_to_resource=function(a,b,c){var d,e,g=this;if(f.isMapping(b))return d=this.child_methods(b),this.has_property(b,"is")&&(e=this.property_value(b,"is"),e.forEach(function(b){return d.forEach(function(c){return g.apply_trait(a,c,b)})})),d.forEach(function(b){return g.has_property(b[1],"is")?(e=g.property_value(b[1],"is"),e.forEach(function(c){return g.apply_trait(a,b,c)})):void 0}),c&&b.remove_question_mark_properties(),this.apply_traits(b,a,c)},a.prototype.apply_trait=function(a,b,d){var e,f,g,h;if(h=this.key_or_value(d),!(null!=h?h.trim():void 0))throw new c.TraitError("while applying trait",null,"trait name must be provided",d.start_mark);if(!(g=this.get_trait(h)))throw new c.TraitError("while applying trait",null,"there is no trait named "+h,d.start_mark);return e=this.get_parameters_from_is_key(a,b[0].value,d),f=g.cloneForTrait(),this.apply_parameters(f,e,d),this.apply_default_media_type_to_method(f),f.combine(b[1]),b[1]=f},a.prototype.apply_parameters=function(a,b,d){var e,f,g;this._apply_parameters(a,b,d,f={resourcePath:!0,resourcePathName:!0,methodName:!0}),g=[];for(e in b){if(!f[e])throw new c.ParameterError("while applying parameters",null,"unused parameter: "+e,d.start_mark);g.push(void 0)}return g},a.prototype._apply_parameters=function(a,b,d,g){var h,i=this;if(a)return f.isString(a)?void((h=a.value.match(/<<\s*([^\|\s>]+)\s*(\|[^>]*)?\s*>>/g))&&h.forEach(function(f){var h,i,j,k,l;if(i=null!=f&&null!=(k=f.trim())?k.replace(/[<>]+/g,"").trim():void 0,l=i.split(/\s*\|\s*/),i=l[0],h=l[1],!(i in b))throw new c.ParameterError("while applying parameters",null,"value was not provided for parameter: "+i,d.start_mark);if(j=b[i],g[i]=!0,h)if(h.match(/!\s*singularize/))j=e.singular(j);else{if(!h.match(/!\s*pluralize/))throw new c.ParameterError("while validating parameter",null,"unknown function applied to parameter",a.start_mark);j=e.plural(j)}return a.value=a.value.replace(f,j)})):f.isSequence(a)?void a.value.forEach(function(a){return i._apply_parameters(a,b,d,g)}):void(f.isMapping(a)&&a.value.forEach(function(a){return i._apply_parameters(a[0],b,d,g),i._apply_parameters(a[1],b,d,g)}))},a.prototype.get_parameters_from_is_key=function(a,b,d){var e,g,h,i,j,k,l;if(i={},h={methodName:b,resourcePath:a.replace(/\/\/*/g,"/"),resourcePathName:this.extractResourcePathName(a)},f.isMapping(d)&&(g=this.value_or_undefined(d),f.isMapping(g[0][1])))for(l=g[0][1].value,j=0,k=l.length;k>j;j++){if(e=l[j],e[0].value in h)throw new c.TraitError("while applying parameters",null,"invalid parameter name: "+e[0].value+" is reserved",e[0].start_mark);i[e[0].value]=e[1].value}return f.extend(i,h)},a.prototype.extractResourcePathName=function(a){var b,c;for(b=a.split(/\//);c=b.pop();)if(!("undefined"!=typeof c&&null!==c?c.match(/[{}]/):void 0))return c;return""},a}()}).call(this)},{"./errors":3,"./nodes":7,"./util":20,pluralize:36}],19:[function(a,b,c){(function(){var b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};c=a("uritemplate"),b=a("./nodes"),d=a("./util"),this.Transformations=function(){function a(a){this.settings=a,this.isContentTypeString=e(this.isContentTypeString,this),this.add_key_value_to_node=e(this.add_key_value_to_node,this),this.apply_default_media_type_to_resource=e(this.apply_default_media_type_to_resource,this),this.get_media_type=e(this.get_media_type,this),this.load_default_media_type=e(this.load_default_media_type,this),this.applyAstTransformations=e(this.applyAstTransformations,this),this.applyTransformations=e(this.applyTransformations,this),this.declaredSchemas={}}return a.prototype.applyTransformations=function(a){var b;return this.settings.transform?(this.applyTransformationsToRoot(a),b=a.resources,this.applyTransformationsToResources(a,b)):void 0},a.prototype.applyAstTransformations=function(a){return this.settings.transform?this.transform_document(a):void 0},a.prototype.load_default_media_type=function(a){return d.isMapping(a||(null!=a?a.value:void 0))?this.mediaType=this.property_value(a,"mediaType"):void 0},a.prototype.get_media_type=function(){return this.mediaType},a.prototype.applyTransformationsToRoot=function(a){var b,d;return a.baseUri?(d=c.parse(a.baseUri),b=d.expressions.filter(function(a){return"templateText"in a}).map(function(a){return a.templateText}),b.length&&(a.baseUriParameters||(a.baseUriParameters={})),b.forEach(function(b){return b in a.baseUriParameters||(a.baseUriParameters[b]={type:"string",required:!0,displayName:b},"version"!==b)?void 0:a.baseUriParameters[b]["enum"]=[a.version]})):void 0},a.prototype.applyTransformationsToResources=function(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(null!=b?b.length:void 0){for(s=[],k=0,n=b.length;n>k;k++){if(i=b[k],e=i.securedBy?i.securedBy:null!=a?a.securedBy:void 0,null!=(q=i.methods)?q.length:void 0)for(r=i.methods,l=0,o=r.length;o>l;l++)f=r[l],"securedBy"in f||e&&(f.securedBy=e);for(h=i.relativeUri.split("/");!h[0]&&h.length;)h.shift();i.relativeUriPathSegments=h,j=c.parse(i.relativeUri),d=j.expressions.filter(function(a){return"templateText"in a}).map(function(a){return a.templateText}),d.length&&(i.uriParameters||(i.uriParameters={}));for(m=0,p=d.length;p>m;m++)g=d[m],g in i.uriParameters||(i.uriParameters[g]={type:"string",required:!0,displayName:g});s.push(this.applyTransformationsToResources(a,i.resources))}return s}},a.prototype.apply_default_media_type_to_resource=function(a){var b,c,e,f,g,h,i,j,k;if(this.mediaType&&d.isMapping(a)){for(i=this.child_resources(a),e=0,g=i.length;g>e;e++)b=i[e],this.apply_default_media_type_to_resource(b[1]);for(j=this.child_methods(a),k=[],f=0,h=j.length;h>f;f++)c=j[f],k.push(this.apply_default_media_type_to_method(c[1])); -return k}},a.prototype.apply_default_media_type_to_method=function(a){var b,c=this;if(this.mediaType&&d.isMapping(a)&&(this.has_property(a,"body")&&this.apply_default_media_type_to_body(this.get_property_pair(a,"body")),this.has_property(a,"responses"))){if(b=this.get_property(a,"responses"),!b||!b.value)return;return b.value.forEach(function(a){return c.has_property(a[1],"body")?c.apply_default_media_type_to_body(c.get_property_pair(a[1],"body")):void 0})}},a.prototype.apply_default_media_type_to_body=function(a){var c,e,f,g,h,i,j;return d.isNull(a[1])&&(a[1]=new b.MappingNode("tag:yaml.org,2002:map",[])),(null!=(g=a[1])&&null!=(h=g.value)&&null!=(i=h[0])&&null!=(j=i[0])?j.value:0)?(c=a[1].value[0][0].value,c.match(/\//)?void 0:(e=new b.MappingNode("tag:yaml.org,2002:map",[],a[1].start_mark,a[1].end_mark),f=new b.ScalarNode("tag:yaml.org,2002:str",this.mediaType,a[1].start_mark,a[1].end_mark),e.value.push([f,a[1].clone()]),a[1].value=e.value)):a[1].value.push([new b.ScalarNode("tag:yaml.org,2002:str",this.mediaType),new b.ScalarNode("tag:yaml.org,2002:null")])},a.prototype.noop=function(){},a.prototype.transform_types=function(a){var b,c=this;return b=a.value,b.forEach(function(a){return a.value.forEach(function(a){return c.transform_resource(a,!0)})})},a.prototype.transform_traits=function(a){var b,c=this;return b=a.value,b.forEach(function(a){return a.value.forEach(function(a){return c.transform_method(a[1],!0)})})},a.prototype.transform_named_params=function(a,c,e){var f=this;return null==e&&(e=!0),d.isNull(a[1])?void 0:a[1].value.forEach(function(a){return d.isNull(a[1])&&(a[1]=new b.MappingNode("tag:yaml.org,2002:map",[],a[1].start_mark,a[1].end_mark)),f.transform_common_parameter_properties(a[0].value,a[1],c,e)})},a.prototype.transform_common_parameter_properties=function(a,b,c,e){var f=this;return d.isSequence(b)?b.value.forEach(function(b){return f.transform_named_parameter(a,b,c,e)}):this.transform_named_parameter(a,b,c,e)},a.prototype.transform_named_parameter=function(a,b,c,d){var e,f,g,h=this;return e=!1,f=!1,g=!1,b.value.forEach(function(a){var b;if(!c||!h.isParameterKey(a))switch(b=h.canonicalizePropertyName(a[0].value,c)){case"pattern":return h.noop();case"default":return h.noop();case"enum":return h.noop();case"description":return h.noop();case"example":return h.noop();case"minLength":return h.noop();case"maxLength":return h.noop();case"minimum":return h.noop();case"maximum":return h.noop();case"repeat":return h.noop();case"displayName":return e=!0;case"type":return g=!0;case"required":return f=!0;default:return h.noop()}}),e||this.add_key_value_to_node(b,"displayName","tag:yaml.org,2002:str",this.canonicalizePropertyName(a,c)),f||d&&this.add_key_value_to_node(b,"required","tag:yaml.org,2002:bool","true"),g?void 0:this.add_key_value_to_node(b,"type","tag:yaml.org,2002:str","string")},a.prototype.add_key_value_to_node=function(a,c,d,e){var f,g;return f=new b.ScalarNode("tag:yaml.org,2002:str",c,a.start_mark,a.end_mark),g=new b.ScalarNode(d,e,a.start_mark,a.end_mark),a.value.push([f,g])},a.prototype.transform_document=function(a){var b=this;return(null!=a?a.value:void 0)?a.value.forEach(function(a){var c;switch(a[0].value){case"title":return b.noop();case"securitySchemes":return b.noop();case"schemas":return b.noop();case"version":return b.noop();case"documentation":return b.noop();case"mediaType":return b.noop();case"securedBy":return b.noop();case"baseUri":return b.noop();case"traits":return b.transform_traits(a[1]);case"baseUriParameters":return b.transform_named_params(a,!1);case"resourceTypes":return b.transform_types(a[1]);case"resources":return null!=(c=a[1])?c.value.forEach(function(a){return b.transform_resource(a)}):void 0;default:return b.noop()}}):void 0},a.prototype.transform_resource=function(a,b){var c=this;return null==b&&(b=!1),a.value?a.value.forEach(function(a){var d,e,f,g;if(e=c.transform_common_properties(a,b),!e){if(c.isHttpMethod(a[0].value,b))return c.transform_method(a[1],b);switch(d=c.canonicalizePropertyName(a[0].value,b)){case"type":return c.noop();case"usage":return c.noop();case"securedBy":return c.noop();case"uriParameters":return c.transform_named_params(a,b);case"baseUriParameters":return c.transform_named_params(a,b);case"resources":return null!=(f=a[1])?f.value.forEach(function(a){return c.transform_resource(a)}):void 0;case"methods":return null!=(g=a[1])?g.value.forEach(function(a){return c.transform_method(a,b)}):void 0;default:return c.noop()}}}):void 0},a.prototype.transform_method=function(a,b){var c=this;if(!d.isNull(a))return a.value.forEach(function(a){var d;if(!c.transform_common_properties(a,b))switch(d=c.canonicalizePropertyName(a[0].value,b)){case"securedBy":return c.noop();case"usage":return c.noop();case"headers":return c.transform_named_params(a,b,!1);case"queryParameters":return c.transform_named_params(a,b,!1);case"baseUriParameters":return c.transform_named_params(a,b);case"body":return c.transform_body(a,b);case"responses":return c.transform_responses(a,b);default:return c.noop()}})},a.prototype.transform_responses=function(a,b){var c=this;if(!d.isNull(a[1]))return a[1].value.forEach(function(a){return c.transform_response(a,b)})},a.prototype.transform_response=function(a,b){var c=this;return d.isMapping(a[1])?a[1].value.forEach(function(a){var d;switch(d=c.canonicalizePropertyName(a[0].value,b)){case"description":return c.noop();case"body":return c.transform_body(a,b);case"headers":return c.transform_named_params(a,b,!1);default:return c.noop()}}):void 0},a.prototype.isContentTypeString=function(a){return null!=a?a.match(/^[^\/]+\/[^\/]+$/):void 0},a.prototype.transform_body=function(a,b){var c,e=this;if(!d.isNull(a[1]))return null!=(c=a[1].value)?c.forEach(function(a){var c;if(e.isParameterKey(a))return e.noop();if(e.isContentTypeString(a[0].value))return e.transform_body(a,b);switch(c=e.canonicalizePropertyName(a[0].value,b)){case"example":return e.noop();case"schema":return e.noop();case"formParameters":return e.transform_named_params(a,b,!1);default:return e.noop()}}):void 0},a.prototype.transform_common_properties=function(a,b){var c;if(this.isParameterKey(a))return!0;switch(c=this.canonicalizePropertyName(a[0].value,b)){case"displayName":return!0;case"description":return!0;case"is":return!0;default:this.noop()}return!1},a}()}).call(this)},{"./nodes":7,"./util":20,uritemplate:38}],20:[function(a,b,c){(function(){var a=[].slice,b={}.hasOwnProperty;this.extend=function(){var b,c,d,e,f,g,h;for(b=arguments[0],e=2<=arguments.length?a.call(arguments,1):[],g=0,h=e.length;h>g;g++){d=e[g];for(c in d)f=d[c],b[c]=f}return b},this.is_empty=function(a){var c;if(Array.isArray(a)||"string"==typeof a)return 0===a.length;for(c in a)if(b.call(a,c))return!1;return!0},this.isNoop=function(a){return a},this.isMapping=function(a){return"tag:yaml.org,2002:map"===(null!=a?a.tag:void 0)},this.isNull=function(a){return"tag:yaml.org,2002:null"===(null!=a?a.tag:void 0)},this.isSequence=function(a){return"tag:yaml.org,2002:seq"===(null!=a?a.tag:void 0)},this.isString=function(a){return"tag:yaml.org,2002:str"===(null!=a?a.tag:void 0)},this.isInteger=function(a){return"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)},this.isNullableMapping=function(a){return this.isMapping(a)||this.isNull(a)},this.isNullableString=function(a){return this.isString(a)||this.isNull(a)},this.isNullableSequence=function(a){return this.isSequence(a)||this.isNull(a)},this.isNumber=function(a){return"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:float"===(null!=a?a.tag:void 0)},this.isScalar=function(a){return"tag:yaml.org,2002:null"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:bool"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:float"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:binary"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:timestamp"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:str"===(null!=a?a.tag:void 0)},this.isCollection=function(a){return"tag:yaml.org,2002:omap"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:pairs"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:set"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:seq"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:map"===(null!=a?a.tag:void 0)},this.NON_PRINTABLE=/[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]/}).call(this)},{}],21:[function(a,b,c){(function(){var b,d,e,f,g,h,i,j,k={}.hasOwnProperty,l=function(a,b){function c(){this.constructor=a}for(var d in b)k.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},m=function(a,b){return function(){return a.apply(b,arguments)}},n=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};h=a("url"),g=a("uritemplate"),b=a("./errors").MarkedYAMLError,e=a("./nodes"),f=a("./traits"),i=a("./util"),d=a("jju/lib/parse"),this.ValidationError=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return l(b,a),b}(b),this.ValidationErrors=function(a){function b(a){this.validation_errors=a}return l(b,a),b.prototype.get_validation_errors=function(){return this.validation_errors},b}(b),this.Validator=function(){function a(){this.get_properties=m(this.get_properties,this),this.get_list_values=m(this.get_list_values,this),this.validations=[this.validate_root,this.validate_root_properties,this.validate_base_uri_parameters,this.valid_absolute_uris]}return a.prototype.validate_document=function(a){var b,c,d,e;for(e=this.validations,c=0,d=e.length;d>c;c++)b=e[c],b.call(this,a);return!0},a.prototype.validate_security_schemes=function(a){var b,d,e,f,g,h;if(!i.isSequence(a))throw new c.ValidationError("while validating securitySchemes",null,"invalid security schemes property, it must be an array",a.start_mark);for(g=a.value,h=[],e=0,f=g.length;f>e;e++){if(d=g[e],!i.isMapping(d))throw new c.ValidationError("while validating securitySchemes",null,"invalid security scheme property, it must be a map",d.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],!i.isMapping(b[1]))throw new c.ValidationError("while validating securitySchemes",null,"invalid security scheme property, it must be a map",b[0].start_mark);g.push(this.validate_security_scheme(b[1]))}return g}.call(this))}return h},a.prototype.trackRepeatedProperties=function(a,b,d,e,f){if(null==e&&(e="RAML"),null==f&&(f="a property with the same name already exists"),b in a)throw new c.ValidationError("while validating "+e,null,""+f+": '"+b+"'",d.start_mark);return a[b]=d},a.prototype.validate_security_scheme=function(a){var b,d,e,f,g,h,j;for(f=null,e=null,d={},j=a.value,g=0,h=j.length;h>g;g++)switch(b=j[g],this.trackRepeatedProperties(d,b[0].value,b[0],"while validating security scheme","property already used in security scheme"),b[0].value){case"description":if(!i.isScalar(b[1]))throw new c.ValidationError("while validating security scheme",null,"schemes description must be a string",b[1].start_mark);break;case"type":if(f=b[1].value,!i.isString(b[1])||!f.match(/^(OAuth 1.0|OAuth 2.0|Basic Authentication|Digest Authentication|x-.+)$/))throw new c.ValidationError("while validating security scheme",null,'schemes type must be any of: "OAuth 1.0", "OAuth 2.0", "Basic Authentication", "Digest Authentication", "x-{.+}"',b[1].start_mark);break;case"describedBy":this.validate_method(b,!0,"security scheme");break;case"settings":if(e=b,!i.isNullableMapping(b[1]))throw new c.ValidationError("while validating security scheme",null,"schemes settings must be a map",b[1].start_mark);break;default:throw new c.ValidationError("while validating security scheme",null,"property: '"+b[0].value+"' is invalid in a security scheme",b[0].start_mark)}if(!f)throw new c.ValidationError("while validating security scheme",null,'schemes type must be any of: "OAuth 1.0", "OAuth 2.0", "Basic Authentication", "Digest Authentication", "x-{.+}"',a.start_mark);if("OAuth 2.0"===f){if(!e)throw new c.ValidationError("while validating security scheme",null,"for OAuth 2.0 settings must be a map",a.start_mark);return this.validate_oauth2_settings(e)}if("OAuth 1.0"===f){if(!e)throw new c.ValidationError("while validating security scheme",null,"for OAuth 1.0 settings must be a map",a.start_mark);return this.validate_oauth1_settings(e)}},a.prototype.validate_oauth2_settings=function(a){var b,d,e,f,g,h,j,k,l,m;for(e={},k=a[1].value,f=0,h=k.length;h>f;f++)switch(b=k[f],this.trackRepeatedProperties(e,b[0].value,b[0],"while validating security scheme","setting with the same name already exists"),b[0].value){case"authorizationUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"authorizationUri must be a URL",b[0].start_mark);break;case"accessTokenUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"accessTokenUri must be a URL",b[0].start_mark)}for(l=["accessTokenUri","authorizationUri"],m=[],g=0,j=l.length;j>g;g++){if(d=l[g],!(d in e))throw new c.ValidationError("while validating security scheme",null,"OAuth 2.0 settings must have "+d+" property",a[0].start_mark);m.push(void 0)}return m},a.prototype.validate_oauth1_settings=function(a){var b,d,e,f,g,h,j,k,l,m;for(e={},k=a[1].value,f=0,h=k.length;h>f;f++)switch(b=k[f],this.trackRepeatedProperties(e,b[0].value,b[0],"while validating security scheme","setting with the same name already exists"),b[0].value){case"requestTokenUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"requestTokenUri must be a URL",b[0].start_mark);break;case"authorizationUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"authorizationUri must be a URL",b[0].start_mark);break;case"tokenCredentialsUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"tokenCredentialsUri must be a URL",b[0].start_mark)}for(l=["requestTokenUri","authorizationUri","tokenCredentialsUri"],m=[],g=0,j=l.length;j>g;g++){if(d=l[g],!(d in e))throw new c.ValidationError("while validating security scheme",null,"OAuth 1.0 settings must have "+d+" property",a[0].start_mark);m.push(void 0)}return m},a.prototype.validate_root_schemas=function(a){var b,d,e,f;if(!i.isSequence(a))throw new c.ValidationError("while validating schemas",null,"schemas property must be an array",a.start_mark);d=this.get_all_schemas(),f=[];for(e in d){if(b=d[e],!b[1].tag||!i.isString(b[1]))throw new c.ValidationError("while validating schemas",null,"schema "+e+" must be a string",b[0].start_mark);f.push(this.validateSchema(b[1]))}return f},a.prototype.validate_root=function(a){if(!a&&!i.isNull(a))throw new c.ValidationError("while validating root",null,"empty document",null!=a?a.start_mark:void 0);if(!i.isMapping(a))throw new c.ValidationError("while validating root",null,"document must be a map",a.start_mark)},a.prototype.validate_base_uri_parameters=function(){if(this.baseUriParameters){if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"uri parameters defined when there is no baseUri",this.baseUriParameters.start_mark);if(!i.isNullableMapping(this.baseUriParameters))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",this.baseUriParameters.start_mark);return this.validate_uri_parameters(this.baseUri,this.baseUriParameters,!1,!1,["version"])}},a.prototype.validate_uri_parameters=function(a,b,d,e,f){var h,j,k,l,m,o,p,q,r,s,t;null==f&&(f=[]);try{l=g.parse(a)}catch(u){throw h=u,new c.ValidationError("while validating uri parameters",null,null!=h&&null!=(r=h.options)?r.message:void 0,b.start_mark)}if(j=l.expressions.filter(function(a){return"templateText"in a}).map(function(a){return a.templateText}),o={},"object"==typeof b.value){for(s=b.value,t=[],p=0,q=s.length;q>p;p++){if(m=s[p],k=this.canonicalizePropertyName(m[0].value,d),this.trackRepeatedProperties(o,k,b,"while validating URI parameters","URI parameter with the same name already exists"),n.call(f,k)>=0)throw new c.ValidationError("while validating baseUri",null,m[0].value+" parameter not allowed here",m[0].start_mark);if(!i.isNullableMapping(m[1],d)&&!i.isNullableSequence(m[1],d))throw new c.ValidationError("while validating baseUri",null,"URI parameter must be a map",m[0].start_mark);if(i.isNull(m[1])||this.valid_common_parameter_properties(m[1],d),!(e||this.isParameterKey(m)||n.call(j,k)>=0))throw new c.ValidationError("while validating baseUri",null,m[0].value+" uri parameter unused",m[0].start_mark);t.push(void 0)}return t}},a.prototype.validate_types=function(a){var b,d,e,f,g,h;if(e=a.value,!i.isSequence(a))throw new c.ValidationError("while validating resource types",null,"invalid resourceTypes definition, it must be an array",a.start_mark);for(h=[],f=0,g=e.length;g>f;f++){if(d=e[f],!i.isMapping(d))throw new c.ValidationError("while validating resource types",null,"invalid resourceType definition, it must be a map",d.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],this.isParameterKey(b))throw new c.ValidationError("while validating resource types",null,"parameter key cannot be used as a resource type name",b[0].start_mark);if(!i.isMapping(b[1]))throw new c.ValidationError("while validating resource types",null,"invalid resourceType definition, it must be a map",b[1].start_mark);g.push(this.validate_resource(b,!0,"resource type"))}return g}.call(this))}return h},a.prototype.validate_traits=function(a){var b,d,e,g,h;if(f=a.value,!Array.isArray(f))throw new c.ValidationError("while validating traits",null,"invalid traits definition, it must be an array",a.start_mark);for(h=[],e=0,g=f.length;g>e;e++){if(d=f[e],!Array.isArray(d.value))throw new c.ValidationError("while validating traits",null,"invalid traits definition, it must be an array",a.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],this.isParameterKey(b))throw new c.ValidationError("while validating traits",null,"parameter key cannot be used as a trait name",b[0].start_mark);if(!i.isMapping(b[1]))throw new c.ValidationError("while validating traits",null,"invalid trait definition, it must be a map",b[1].start_mark);g.push(this.valid_traits_properties(b))}return g}.call(this))}return h},a.prototype.valid_traits_properties=function(a){var b;if(a[1].value&&i.isMapping(a[1])){if(b=a[1].value.filter(function(a){return"is"===a[0].value||"type"===a[0].value}),b.length>0)throw new c.ValidationError("while validating trait properties",null,"property: '"+b[0][0].value+"' is invalid in a trait",b[0][0].start_mark);return this.validate_method(a,!0,"trait")}},a.prototype.canonicalizePropertyName=function(a,b){return b&&"?"===a.slice(-1)?a.slice(0,-1):a},a.prototype.valid_common_parameter_properties=function(a,b){var d,e,f,g,h;if(a.value){if(i.isSequence(a)){if(0===a.value.length)throw new c.ValidationError("while validating parameter properties",null,"named parameter needs at least one type",a.start_mark);if(!(a.value.length>1))throw new c.ValidationError("while validating parameter properties",null,"single type for variably typed parameter",a.start_mark);for(g=a.value,h=[],e=0,f=g.length;f>e;e++)d=g[e],h.push(this.validate_named_parameter(d,b));return h}return this.validate_named_parameter(a,b)}},a.prototype.validate_named_parameter=function(a,b){var d,e,f,g,h,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z;for(h={},j="string",w=a.value,q=0,t=w.length;t>q;q++)if(f=w[q],k=f[0].value,l=f[1].value,this.trackRepeatedProperties(h,this.canonicalizePropertyName(f[0].value,!0),f[0],"while validating parameter properties","parameter property already used"),d=["true","false"],!b||!this.isParameterKey(f)&&!this.isParameterValue(f)){switch(e=this.canonicalizePropertyName(k,b),o=!0,k){case"displayName":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of displayName must be a scalar",f[1].start_mark);break;case"pattern":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of pattern must be a scalar",f[1].start_mark);break;case"default":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of default must be a scalar",f[1].start_mark);break;case"description":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of description must be a scalar",f[1].start_mark);break;case"example":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of example must be a scalar",f[1].start_mark);break;case"minLength":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of minLength must be a number",f[1].start_mark);break;case"maxLength":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of maxLength must be a number",f[1].start_mark);break;case"minimum":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of minimum must be a number",f[1].start_mark);break;case"maximum":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of maximum must be a number",f[1].start_mark);break;case"type":if(j=l,p=["string","number","integer","date","boolean","file"],n.call(p,l)<0)throw new c.ValidationError("while validating parameter properties",null,"type can be either of: string, number, integer, file, date or boolean ",f[1].start_mark);break;case"required":if(n.call(d,l)<0)throw new c.ValidationError("while validating parameter properties",null,"required can be any either true or false",f[1].start_mark);break;case"repeat":if(n.call(d,l)<0)throw new c.ValidationError("while validating parameter properties",null,"repeat can be any either true or false",f[1].start_mark);break;default:o=!1}switch(e){case"enum":if(!i.isNullableSequence(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of enum must be an array",f[1].start_mark);if(!f[1].value.length)throw new c.ValidationError("while validating parameter properties",null,"enum is empty",f[1].start_mark);if(g=this.get_list_values(f[1].value),this.hasDuplicates(g))throw new c.ValidationError("while validating parameter properties",null,"enum contains duplicated values",f[1].start_mark);break;default:if(!o)throw new c.ValidationError("while validating parameter properties",null,"unknown property "+k,f[0].start_mark)}}if("string"!==j)for(x=["enum","pattern","minLength","maxLength"],r=0,u=x.length;u>r;r++)if(m=x[r],m in h)throw new c.ValidationError("while validating parameter properties",null,"property "+m+" can only be used if type is 'string'",h[m].start_mark);if("number"!==j&&"integer"!==j){for(y=["minimum","maximum"],z=[],s=0,v=y.length;v>s;s++){if(m=y[s],m in h)throw new c.ValidationError("while validating parameter properties",null,"property "+m+" can only be used if type is 'number' or 'integer'",h[m].start_mark);z.push(void 0)}return z}},a.prototype.get_list_values=function(a){return a.map(function(a){return a.value})},a.prototype.validate_root_properties=function(a){var b,d,e,f,g,h;if(b=!1,e={},null!=a?a.value:void 0)for(h=a.value,f=0,g=h.length;g>f;f++)switch(d=h[f],d[0].value.match(/^\//)?this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating root properties","resource already declared"):this.trackRepeatedProperties(e,d[0].value,d[0],"while validating root properties","root property already used"),d[0].value){case"title":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"title must be a string",d[0].start_mark);break;case"baseUri":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"baseUri must be a string",d[0].start_mark);this.baseUri=d[1].value,b=this.validate_base_uri(d[1]);break;case"securitySchemes":this.validate_security_schemes(d[1]);break;case"schemas":this.validate_root_schemas(d[1]);break;case"version":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"version must be a string",d[0].start_mark);i.isNull(d[1])||(d[1].tag="tag:yaml.org,2002:str");break;case"traits":this.validate_traits(d[1]);break;case"documentation":if(!i.isSequence(d[1]))throw new c.ValidationError("while validating root properties",null,"documentation must be an array",d[0].start_mark);this.validate_documentation(d[1]);break;case"mediaType":if(!i.isString(d[1]))throw new c.ValidationError("while validating root properties",null,"mediaType must be a scalar",d[0].start_mark);break;case"baseUriParameters":this.baseUriParameters=d[1],i.isNoop(d[1]);break;case"resourceTypes":this.validate_types(d[1]);break;case"securedBy":this.validate_secured_by(d);break;case"protocols":this.validate_protocols_property(d);break;default:if(!d[0].value.match(/^\//))throw new c.ValidationError("while validating root properties",null,"unknown property "+d[0].value,d[0].start_mark);this.validate_resource(d)}if(!("title"in e))throw new c.ValidationError("while validating root properties",null,"missing title",a.start_mark);if(b&&!("version"in e))throw new c.ValidationError("while validating version",null,"missing version",a.start_mark)},a.prototype.validate_documentation=function(a){var b,d,e,f,g;if(!a.value.length)throw new c.ValidationError("while validating documentation section",null,"there must be at least one document in the documentation section",a.start_mark);for(f=a.value,g=[],d=0,e=f.length;e>d;d++)b=f[d],g.push(this.validate_doc_section(b));return g},a.prototype.validate_doc_section=function(a){var b,d,e,f,g;if(!i.isMapping(a))throw new c.ValidationError("while validating documentation section",null,"each documentation section must be a map",a.start_mark);for(b={},g=a.value,e=0,f=g.length;f>e;e++)switch(d=g[e],this.trackRepeatedProperties(b,d[0].value,d[0],"while validating documentation section","property already used"),d[0].value){case"title":if(!i.isScalar(d[1])||i.isNull(d[1]))throw new c.ValidationError("while validating documentation section",null,"title must be a string",d[0].start_mark);break;case"content":if(!i.isScalar(d[1])||i.isNull(d[1]))throw new c.ValidationError("while validating documentation section",null,"content must be a string",d[0].start_mark);break;default:throw new c.ValidationError("while validating root properties",null,"unknown property "+d[0].value,d[0].start_mark)}if(!("content"in b))throw new c.ValidationError("while validating documentation section",null,"a documentation entry must have content property",a.start_mark);if(!("title"in b))throw new c.ValidationError("while validating documentation section",null,"a documentation entry must have title property",a.start_mark)},a.prototype.child_resources=function(a){return a&&i.isMapping(a)?a.value.filter(function(a){return a[0].value.match(/^\//)}):[]},a.prototype.validate_resource=function(a,b,d){var e,f,h,j,k,l,m,n,o,p,q,r;if(null==b&&(b=!1),null==d&&(d="resource"),!a[1]||!i.isNullableMapping(a[1]))throw new c.ValidationError("while validating resources",null,"resource is not a map",a[1].start_mark);if(a[0].value)try{l=g.parse(a[0].value)}catch(s){throw f=s,new c.ValidationError("while validating resource",null,"Resource name is invalid: "+(null!=f&&null!=(p=f.options)?p.message:void 0),a[0].start_mark)}if(!i.isNull(a[1])&&a[1].value){for(k={},q=a[1].value,r=[],n=0,o=q.length;o>n;n++)if(j=q[n],j[0].value.match(/^\//)?this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","resource already declared"):this.isHttpMethod(j[0].value,b)?this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","method already declared"):this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","property already used"),this.validate_common_properties(j,b))r.push(void 0);else if(j[0].value.match(/^\//)){if(b)throw new c.ValidationError("while validating trait properties",null,"resource type cannot define child resources",j[0].start_mark);r.push(this.validate_resource(j,b))}else if(this.isHttpMethod(j[0].value,b))r.push(this.validate_method(j,b,"method"));else{switch(h=j[0].value,e=this.canonicalizePropertyName(h,b),m=!0,e){case"uriParameters":if(!i.isNullableMapping(j[1]))throw new c.ValidationError("while validating uri parameters",null,"uri parameters must be a map",j[0].start_mark);this.validate_uri_parameters(a[0].value,j[1],b,b);break;case"baseUriParameters":if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"base uri parameters defined when there is no baseUri",j[0].start_mark);if(!i.isNullableMapping(j[1]))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",j[0].start_mark);this.validate_uri_parameters(this.baseUri,j[1],b);break;default:m=!1}switch(h){case"type":r.push(this.validate_type_property(j,b));break;case"usage":if(!b)throw new c.ValidationError("while validating resources",null,"property: '"+j[0].value+"' is invalid in a resource",j[0].start_mark);r.push(void 0);break;case"securedBy":r.push(this.validate_secured_by(j));break;default:if(!m)throw new c.ValidationError("while validating resources",null,"property: '"+j[0].value+("' is invalid in a "+d),j[0].start_mark);r.push(void 0)}}return r}},a.prototype.validate_secured_by=function(a){var b,d,e,f,g,h,j;if(!i.isSequence(a[1]))throw new c.ValidationError("while validating securityScheme",null,"property 'securedBy' must be an array",a[0].start_mark);if(d=this.get_list_values(a[1].value),this.hasDuplicates(d))throw new c.ValidationError("while validating securityScheme consumption",null,"securitySchemes can only be referenced once in a securedBy property",a[0].start_mark);for(h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(b=h[f],i.isSequence(b))throw new c.ValidationError("while validating securityScheme consumption",null,"securityScheme reference cannot be an array",b.start_mark);if(i.isNull(b))j.push(void 0);else{if(e=this.key_or_value(b),!this.get_security_scheme(e))throw new c.ValidationError("while validating securityScheme consumption",null,"there is no securityScheme named "+e,b.start_mark);j.push(void 0)}}return j},a.prototype.validate_protocols_property=function(a){var b,d,e,f,g,h;if(!i.isSequence(a[1]))throw new c.ValidationError("while validating protocols",null,"property must be an array",a[0].start_mark);for(f=a[1].value,h=[],d=0,e=f.length;e>d;d++){if(b=f[d],!i.isString(b))throw new c.ValidationError("while validating protocols",null,"value must be a string",b.start_mark);if("HTTP"!==(g=b.value)&&"HTTPS"!==g)throw new c.ValidationError("while validating protocols",null,"only HTTP and HTTPS values are allowed",b.start_mark);h.push(void 0)}return h},a.prototype.validate_type_property=function(a){var b,d,e,f,g,h;if(!i.isMapping(a[1])&&!i.isString(a[1]))throw new c.ValidationError("while validating resource types",null,"property 'type' must be a string or a map",a[0].start_mark);if(i.isMapping(a[1])&&a[1].value.length>1)throw new c.ValidationError("while validating resource types",null,"a resource or resourceType can inherit from a single resourceType",a[0].start_mark);if(d=this.key_or_value(a[1]),!(null!=d?d.trim():void 0))throw new c.ValidationError("while validating resource type consumption",null,"resource type name must be provided",a[1].start_mark);if(!this.isParameterKeyValue(d)&&!this.get_type(d))throw new c.ValidationError("while validating resource type consumption",null,"there is no resource type named "+d,a[1].start_mark);if(i.isMapping(a[1])){for(g=a[1].value,h=[],e=0,f=g.length;f>e;e++){if(b=g[e],!i.isNull(b[1])&&!i.isMapping(b[1]))throw new c.ValidationError("while validating resource consumption",null,"resource type parameters must be in a map",b[1].start_mark); -h.push(void 0)}return h}},a.prototype.validate_method=function(a,b,d){var e,f,g,h,j,k,l,m,n;if(null==d&&(d="method"),!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating methods",null,"method must be a map",a[0].start_mark);for(g={},m=a[1].value,n=[],k=0,l=m.length;l>k;k++)if(h=m[k],this.trackRepeatedProperties(g,this.canonicalizePropertyName(h[0].value,!0),h[0],"while validating method","property already used"),!this.validate_common_properties(h,b,d)){switch(f=h[0].value,e=this.canonicalizePropertyName(f,b),j=!0,e){case"headers":this.validate_headers(h,b);break;case"queryParameters":this.validate_query_params(h,b);break;case"body":this.validate_body(h,b,null,!1);break;case"responses":this.validate_responses(h,b);break;case"baseUriParameters":if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"base uri parameters defined when there is no baseUri",h[0].start_mark);if(!i.isNullableMapping(h[1]))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",h[0].start_mark);this.validate_uri_parameters(this.baseUri,h[1],b);break;case"protocols":this.validate_protocols_property(h);break;default:j=!1}switch(f){case"securedBy":n.push(this.validate_secured_by(h));break;case"usage":if(!b||"trait"!==d)throw new c.ValidationError("while validating resources",null,"property: 'usage' is invalid in a "+d,h[0].start_mark);n.push(void 0);break;default:if(!j)throw new c.ValidationError("while validating resources",null,"property: '"+h[0].value+"' is invalid in a "+d,h[0].start_mark);n.push(void 0)}}return n}},a.prototype.validate_responses=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating responses",null,"property: 'responses' must be a map",a[0].start_mark);for(e={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(d=h[f],!i.isNullableMapping(d[1]))throw new c.ValidationError("while validating responses",null,"each response must be a map",d[1].start_mark);this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating responses","response code already used"),j.push(this.validate_response(d,b))}return j}},a.prototype.validate_query_params=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating query parameters",null,"property: 'queryParameters' must be a map",a[0].start_mark);for(e={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(d=h[f],!i.isNullableMapping(d[1])&&!i.isNullableSequence(d[1]))throw new c.ValidationError("while validating query parameters",null,"each query parameter must be a map",d[1].start_mark);this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating query parameter","parameter name already used"),j.push(this.valid_common_parameter_properties(d[1],b))}return j}},a.prototype.validate_form_params=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating query parameters",null,"property: 'formParameters' must be a map",a[0].start_mark);for(d={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(e=h[f],!i.isNullableMapping(e[1])&&!i.isNullableSequence(e[1]))throw new c.ValidationError("while validating query parameters",null,"each form parameter must be a map",e[1].start_mark);this.trackRepeatedProperties(d,this.canonicalizePropertyName(e[0].value,!0),e[0],"while validating form parameter","parameter name already used"),j.push(this.valid_common_parameter_properties(e[1],b))}return j}},a.prototype.validate_headers=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating headers",null,"property: 'headers' must be a map",a[0].start_mark);for(d={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(e=h[f],!i.isNullableMapping(e[1])&&!i.isNullableSequence(e[1]))throw new c.ValidationError("while validating query parameters",null,"each header must be a map",e[1].start_mark);this.trackRepeatedProperties(d,this.canonicalizePropertyName(e[0].value,!0),e[0],"while validating headers","header name already used"),j.push(this.valid_common_parameter_properties(e[1],b))}return j}},a.prototype.validate_response=function(a,b){var d,e,f,g,h,j,k,l,m,n,o,p;if(i.isSequence(a[0])){if(!a[0].value.length)throw new c.ValidationError("while validating responses",null,"there must be at least one response code",a[0].start_mark);for(n=a[0].value,j=0,l=n.length;l>j;j++)if(f=n[j],!this.isParameterKey(f)&&!i.isInteger(f)&&isNaN(this.canonicalizePropertyName(f,b)))throw new c.ValidationError("while validating responses",null,"each response key must be an integer",f.start_mark)}else if(!this.isParameterKey(a)&&!i.isInteger(a[0])&&isNaN(this.canonicalizePropertyName(a[0].value,b)))throw new c.ValidationError("while validating responses",null,"each response key must be an integer",a[0].start_mark);if(!i.isNullableMapping(a[1]))throw new c.ValidationError("while validating responses",null,"each response property must be a map",a[0].start_mark);if(i.isMapping(a[1])){for(g={},o=a[1].value,p=[],k=0,m=o.length;m>k;k++)if(e=o[k],d=this.canonicalizePropertyName(e[0].value,b),this.trackRepeatedProperties(g,d,e[0],"while validating responses","property already used"),h=!0,this.isParameterKey(e))p.push(void 0);else{switch(e[0].value){case"description":if(!i.isScalar(e[1]))throw new c.ValidationError("while validating responses",null,"property description must be a string",a[0].start_mark);break;default:h=!1}switch(d){case"body":p.push(this.validate_body(e,b,null,!0));break;case"headers":if(!i.isNullableMapping(e[1]))throw new c.ValidationError("while validating resources",null,"property 'headers' must be a map",e[0].start_mark);p.push(this.validate_headers(e));break;default:if(!h)throw new c.ValidationError("while validating response",null,"property: '"+e[0].value+"' is invalid in a response",e[0].start_mark);p.push(void 0)}}return p}},a.prototype.isHttpMethod=function(a,b){var c;return null==b&&(b=!1),a?(a=this.canonicalizePropertyName(a,b),"options"===(c=a.toLowerCase())||"get"===c||"head"===c||"post"===c||"put"===c||"delete"===c||"trace"===c||"connect"===c||"patch"===c):!1},a.prototype.isParameterValue=function(a){return this.isParameterKey(a,!1)},a.prototype.isParameterKey=function(a,b){var d;if(null==b&&(b=!0),d=b?0:1,!b&&!i.isScalar(a[1]))return!1;if(this.isParameterKeyValue(a[d].value))return!0;if(a[d].value.match(/<<\s*([^\|\s>]+)\s*\|.*\s*>>/g))throw new c.ValidationError("while validating parameter",null,"unknown function applied to property name",a[0].start_mark);return!1},a.prototype.isParameterKeyValue=function(a){return a.match(/<<\s*([^\|\s>]+)\s*>>/g)||a.match(/<<\s*([^\|\s>]+)\s*(\|\s*\!\s*(singularize|pluralize))?\s*>>/g)?!0:!1},a.prototype.validate_body=function(a,b,d,e){var f,g,h,j,k,l,m,o,p,q;if(null==d&&(d=null),!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating body",null,"property: body specification must be a map",a[0].start_mark);for(j=["implicit","forcedImplicit"],f={},q=a[1].value,o=0,p=q.length;p>o;o++)if(g=q[o],this.trackRepeatedProperties(f,this.canonicalizePropertyName(g[0].value,!0),g[0],"while validating body","property already used"),this.isParameterKey(g)){if(!b)throw new c.ValidationError("while validating body",null,"property '"+g[0].value+"' is invalid in a resource",g[0].start_mark)}else if(g[0].value.match(/^[^\/]+\/[^\/]+$/)){if(d&&"explicit"!==d)throw new c.ValidationError("while validating body",null,"not compatible with implicit default Media Type",g[0].start_mark);d="explicit",this.validate_body(g,b,"forcedImplicit",e)}else{switch(k=g[0].value,h=this.canonicalizePropertyName(k,b),m=!0,h){case"formParameters":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);null==d&&(d="implicit"),this.validate_form_params(g,b);break;default:m=!1}switch(k){case"description":if(!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"body description must be a string",g[0].start_mark);break;case"example":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);if(null==d&&(d="implicit"),!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"example must be a string",g[0].start_mark);break;case"schema":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);if(null==d&&(d="implicit"),!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"schema must be a string",g[0].start_mark);this.validateSchema(g[1]);break;default:if(!m)throw new c.ValidationError("while validating body",null,"property: '"+g[0].value+"' is invalid in a body",g[0].start_mark)}}if("formParameters"in f){if(l=f.formParameters.start_mark,e)throw new c.ValidationError("while validating body",null,"formParameters cannot be used to describe response bodies",l);if("schema"in f||"example"in f)throw new c.ValidationError("while validating body",null,"formParameters cannot be used together with the example or schema properties",l)}if("implicit"===d&&!this.get_media_type())throw new c.ValidationError("while validating body",null,"body tries to use default Media Type, but mediaType is null",a[0].start_mark)}},a.prototype.validateSchema=function(a){var b,e,f;if(this.isXmlSchema(a.value))return void 0;if(this.isJsonSchema(a.value))try{return f=JSON.parse(a.value)}catch(g){b=g;try{f=d.parse(a.value)}catch(g){throw b=g,e=this.create_mark(a.start_mark.line+b.row,0),a.end_mark.line===e.line&&0===a.end_mark.column&&e.line--,new c.ValidationError("while validating body",null,"schema is not valid JSON error: '"+b.message.split("\n")[0]+"'",e)}throw new c.ValidationError("while validating body",null,"schema is not valid JSON error: '"+b+"'",a.start_mark)}},a.prototype.isJsonSchema=function(a){return null!=a?a.match(/^\s*\{/):void 0},a.prototype.isXmlSchema=function(a){return null!=a?a.match(/^\s*(<\?xml[^>]+>)?[\s\n]*f;f++)e=h[f],this.validate_trait_use(e);return!0}return!1},a.prototype.validate_trait_use=function(a){var b,d,e,f,g,h,j;if(!i.isScalar(a)&&!i.isMapping(a))throw new c.ValidationError("while validating trait consumption",null,"trait must be a string or a map",a.start_mark);if(d=this.key_or_value(a),!(null!=d?d.trim():void 0))throw new c.ValidationError("while validating trait consumption",null,"trait name must be provided",a.start_mark);if(!this.isParameterKeyValue(d)&&!this.get_trait(d))throw new c.ValidationError("while validating trait consumption",null,"there is no trait named "+d,a.start_mark);if(!i.isScalar(a)){if(e=a.value[0][1],!i.isNull(e)&&!i.isMapping(e))throw new c.ValidationError("while validating trait consumption",null,"trait must be a map",e.start_mark);if(!i.isNull(e)){for(h=e.value,j=[],f=0,g=h.length;g>f;f++){if(b=h[f],!i.isScalar(b[1]))throw new c.ValidationError("while validating trait consumption",null,"parameter value must be a scalar",b[1].start_mark);j.push(void 0)}return j}}},a.prototype.child_methods=function(a){var b=this;return a&&i.isMapping(a)?a.value.filter(function(a){return b.isHttpMethod(a[0].value)}):[]},a.prototype.has_property=function(a,b){return a&&i.isMapping(a)?a.value.some(function(a){return a[0].value&&"object"!=typeof a[0].value&&a[0].value===b}):!1},a.prototype.property_value=function(a,b){var c;return c=a.value.filter(function(a){return"object"!=typeof a[0].value&&a[0].value===b}),c.length?c[0][1].value:void 0},a.prototype.get_property_pair=function(a,b){var c;return a&&i.isMapping(a)&&(c=a.value.filter(function(a){return i.isString(a[0])&&a[0].value===b}),c.length>0&&c[0].length>0)?c[0]:[]},a.prototype.get_property=function(a,b){var c;return c=this.get_property_pair(a,b),null!=c?c[1]:[]},a.prototype.get_properties=function(a,b){var c,d,e,f,g;if(d=[],a&&i.isMapping(a))for(g=a.value,e=0,f=g.length;f>e;e++)c=g[e],i.isString(c[0])&&c[0].value===b?d.push(c):d=d.concat(this.get_properties(c[1],b));return d},a.prototype.valid_absolute_uris=function(a){var b,d;if(d=this.get_absolute_uris(a),b=this.hasDuplicatesUris(d))throw new c.ValidationError("while validating trait consumption",null,"two resources share same URI "+b.uri,b.mark)},a.prototype.get_absolute_uris=function(a,b){var d,e,f,g,h,j;if(f=[],!i.isNullableMapping(a))throw new c.ValidationError("while validating resources",null,"resource is not a map",a.start_mark);for(e=this.child_resources(a),h=0,j=e.length;j>h;h++)d=e[h],g=null!=b?b+d[0].value:d[0].value,f.push({uri:g,mark:d[0].start_mark}),f=f.concat(this.get_absolute_uris(d[1],g));return f},a.prototype.key_or_value=function(a){var b,c,d,f;return a instanceof e.ScalarNode?a.value:a instanceof e.MappingNode&&(b=null!=a&&null!=(c=a.value)&&null!=(d=c[0])&&null!=(f=d[0])?f.value:void 0)?b:null},a.prototype.value_or_undefined=function(a){return a instanceof e.MappingNode?a.value:void 0},a.prototype.validate_base_uri=function(a){var b,d,e,f,i,j,k;if(b=null!=(j=a.value)?j.trim():void 0,!b)throw new c.ValidationError("while validating baseUri",null,"baseUri must have a value",a.start_mark);if(f=(h.parse(b).protocol||"http:").slice(0,-1).toUpperCase(),"HTTP"!==f&&"HTTPS"!==f)throw new c.ValidationError("while validating baseUri",null,"baseUri protocol must be either HTTP or HTTPS",a.start_mark);try{i=g.parse(b)}catch(l){throw d=l,new c.ValidationError("while validating baseUri",null,null!=d&&null!=(k=d.options)?k.message:void 0,a.start_mark)}return e=i.expressions.filter(function(a){return"templateText"in a}).map(function(a){return a.templateText}),n.call(e,"version")>=0?!0:void 0},a.prototype.get_validation_errors=function(){return this.validation_errors},a.prototype.is_valid=function(){return 0===this.validation_errors.length},a.prototype.hasDuplicatesUris=function(a){var b,c,d,e;for(c={},d=0,e=a.length;e>d;d++){if(b=a[d],b.uri in c)return b;c[b.uri]=b}return!1},a.prototype.hasDuplicates=function(a){var b,c,d,e;for(c={},d=0,e=a.length;e>d;d++){if(b=a[d],b in c)return!0;c[b]=!0}return!1},a}()}).call(this)},{"./errors":3,"./nodes":7,"./traits":18,"./util":20,"jju/lib/parse":34,uritemplate:38,url:32}],22:[function(a,b,c){},{}],23:[function(a,b,c){arguments[4][22][0].apply(c,arguments)},{dup:22}],24:[function(a,b,c){(function(b){"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,0>b?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;c++)a[c]=0;return a}function h(a,b,c){("string"!=typeof c||""===c)&&(c="utf8");var d=0|s(b,c);return a=p(a,d),a.write(b,c),a}function i(a,b){if(f.isBuffer(b))return j(a,b);if(Z(b))return k(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return l(a,b);if(b instanceof ArrayBuffer)return m(a,b)}return b.length?n(a,b):o(a,b)}function j(a,b){var c=0|q(b.length);return a=p(a,c),b.copy(a,0,0,c),a}function k(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function l(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function m(a,b){return f.TYPED_ARRAY_SUPPORT?(b.byteLength,a=f._augment(new Uint8Array(b))):a=l(a,new Uint8Array(b)),a}function n(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function o(a,b){var c,d=0;"Buffer"===b.type&&Z(b.data)&&(c=b.data,d=0|q(c.length)),a=p(a,d);for(var e=0;d>e;e+=1)a[e]=255&c[e];return a}function p(a,b){f.TYPED_ARRAY_SUPPORT?(a=f._augment(new Uint8Array(b)),a.__proto__=f.prototype):(a.length=b,a._isBuffer=!0);var c=0!==b&&b<=f.poolSize>>>1;return c&&(a.parent=$),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return S(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return V(a).length;default:if(d)return S(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function v(a,b,c,d){return W(S(b,a.length-c),a,c,d)}function w(a,b,c,d){return W(T(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return W(V(b),a,c,d)}function z(a,b,c,d){return W(U(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?X.fromByteArray(a):X.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;c>e;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(c>=e+h){var i,j,k,l;switch(h){case 1:128>f&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(55296>l||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&1114112>l&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(_>=b)return String.fromCharCode.apply(String,a);for(var c="",d=0;b>d;)c+=String.fromCharCode.apply(String,a.slice(d,d+=_));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=R(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;fa)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||g>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function J(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function K(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||f>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(0>c)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(ba,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function R(a){return 16>a?"0"+a.toString(16):a.toString(16)}function S(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;g++){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(1114112>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function T(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function V(a){return X.toByteArray(O(a))}function W(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var X=a("base64-js"),Y=a("ieee754"),Z=a("isarray");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var $={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);g>e&&a[e]===b[e];)++e;return e!==g&&(c=a[e],d=b[e]),d>c?-1:c>d?1:0},f.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(a,b){if(!Z(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new f(0);var c;if(void 0===b)for(b=0,c=0;c0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e2147483647?b=2147483647:-2147483648>b&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(0>b&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(f.TYPED_ARRAY_SUPPORT)d=f._augment(this.subarray(a,b));else{var e=b-a;d=new f(e,void 0);for(var g=0;e>g;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},f.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),Y.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),Y.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),Y.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),Y.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0>a?1:0;for(this[b]=255&a;++f>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0>a?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-bc&&d>b)for(e=g-1;e>=0;e--)a[e+b]=this[e+c];else if(1e3>g||!f.TYPED_ARRAY_SUPPORT)for(e=0;g>e;e++)a[e+b]=this[e+c];else a._set(this.subarray(c,c+g),b);return g},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new RangeError("start out of bounds");if(0>c||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=S(a.toString()),f=e.length; -for(d=b;c>d;d++)this[d]=e[d%f]}return this}},f.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(f.TYPED_ARRAY_SUPPORT)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var aa=f.prototype;f._augment=function(a){return a.constructor=f,a._isBuffer=!0,a._set=a.set,a.get=aa.get,a.set=aa.set,a.write=aa.write,a.toString=aa.toString,a.toLocaleString=aa.toString,a.toJSON=aa.toJSON,a.equals=aa.equals,a.compare=aa.compare,a.indexOf=aa.indexOf,a.copy=aa.copy,a.slice=aa.slice,a.readUIntLE=aa.readUIntLE,a.readUIntBE=aa.readUIntBE,a.readUInt8=aa.readUInt8,a.readUInt16LE=aa.readUInt16LE,a.readUInt16BE=aa.readUInt16BE,a.readUInt32LE=aa.readUInt32LE,a.readUInt32BE=aa.readUInt32BE,a.readIntLE=aa.readIntLE,a.readIntBE=aa.readIntBE,a.readInt8=aa.readInt8,a.readInt16LE=aa.readInt16LE,a.readInt16BE=aa.readInt16BE,a.readInt32LE=aa.readInt32LE,a.readInt32BE=aa.readInt32BE,a.readFloatLE=aa.readFloatLE,a.readFloatBE=aa.readFloatBE,a.readDoubleLE=aa.readDoubleLE,a.readDoubleBE=aa.readDoubleBE,a.writeUInt8=aa.writeUInt8,a.writeUIntLE=aa.writeUIntLE,a.writeUIntBE=aa.writeUIntBE,a.writeUInt16LE=aa.writeUInt16LE,a.writeUInt16BE=aa.writeUInt16BE,a.writeUInt32LE=aa.writeUInt32LE,a.writeUInt32BE=aa.writeUInt32BE,a.writeIntLE=aa.writeIntLE,a.writeIntBE=aa.writeIntBE,a.writeInt8=aa.writeInt8,a.writeInt16LE=aa.writeInt16LE,a.writeInt16BE=aa.writeInt16BE,a.writeInt32LE=aa.writeInt32LE,a.writeInt32BE=aa.writeInt32BE,a.writeFloatLE=aa.writeFloatLE,a.writeFloatBE=aa.writeFloatBE,a.writeDoubleLE=aa.writeDoubleLE,a.writeDoubleBE=aa.writeDoubleBE,a.fill=aa.fill,a.inspect=aa.inspect,a.toArrayBuffer=aa.toArrayBuffer,a};var ba=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":25,ieee754:26,isarray:27}],25:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g||b===l?62:b===h||b===m?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],26:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],27:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],28:[function(b,c,d){(function(b){!function(e){function f(a){throw new RangeError(I[a])}function g(a,b){for(var c=a.length,d=[];c--;)d[c]=b(a[c]);return d}function h(a,b){var c=a.split("@"),d="";c.length>1&&(d=c[0]+"@",a=c[1]),a=a.replace(H,".");var e=a.split("."),f=g(e,b).join(".");return d+f}function i(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function j(a){return g(a,function(a){var b="";return a>65535&&(a-=65536,b+=L(a>>>10&1023|55296),a=56320|1023&a),b+=L(a)}).join("")}function k(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:x}function l(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function m(a,b,c){var d=0;for(a=c?K(a/B):a>>1,a+=K(a/b);a>J*z>>1;d+=x)a=K(a/J);return K(d+(J+1)*a/(a+A))}function n(a){var b,c,d,e,g,h,i,l,n,o,p=[],q=a.length,r=0,s=D,t=C;for(c=a.lastIndexOf(E),0>c&&(c=0),d=0;c>d;++d)a.charCodeAt(d)>=128&&f("not-basic"),p.push(a.charCodeAt(d));for(e=c>0?c+1:0;q>e;){for(g=r,h=1,i=x;e>=q&&f("invalid-input"),l=k(a.charCodeAt(e++)),(l>=x||l>K((w-r)/h))&&f("overflow"),r+=l*h,n=t>=i?y:i>=t+z?z:i-t,!(n>l);i+=x)o=x-n,h>K(w/o)&&f("overflow"),h*=o;b=p.length+1,t=m(r-g,b,0==g),K(r/b)>w-s&&f("overflow"),s+=K(r/b),r%=b,p.splice(r++,0,s)}return j(p)}function o(a){var b,c,d,e,g,h,j,k,n,o,p,q,r,s,t,u=[];for(a=i(a),q=a.length,b=D,c=0,g=C,h=0;q>h;++h)p=a[h],128>p&&u.push(L(p));for(d=e=u.length,e&&u.push(E);q>d;){for(j=w,h=0;q>h;++h)p=a[h],p>=b&&j>p&&(j=p);for(r=d+1,j-b>K((w-c)/r)&&f("overflow"),c+=(j-b)*r,b=j,h=0;q>h;++h)if(p=a[h],b>p&&++c>w&&f("overflow"),p==b){for(k=c,n=x;o=g>=n?y:n>=g+z?z:n-g,!(o>k);n+=x)t=k-o,s=x-o,u.push(L(l(o+t%s,0))),k=K(t/s);u.push(L(l(k,0))),g=m(c,r,d==e),c=0,++d}++c,++b}return u.join("")}function p(a){return h(a,function(a){return F.test(a)?n(a.slice(4).toLowerCase()):a})}function q(a){return h(a,function(a){return G.test(a)?"xn--"+o(a):a})}var r="object"==typeof d&&d&&!d.nodeType&&d,s="object"==typeof c&&c&&!c.nodeType&&c,t="object"==typeof b&&b;(t.global===t||t.window===t||t.self===t)&&(e=t);var u,v,w=2147483647,x=36,y=1,z=26,A=38,B=700,C=72,D=128,E="-",F=/^xn--/,G=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=x-y,K=Math.floor,L=String.fromCharCode;if(u={version:"1.3.2",ucs2:{decode:i,encode:j},decode:n,encode:o,toASCII:q,toUnicode:p},"function"==typeof a&&"object"==typeof a.amd&&a.amd)a("punycode",function(){return u});else if(r&&s)if(c.exports==r)s.exports=u;else for(v in u)u.hasOwnProperty(v)&&(r[v]=u[v]);else e.punycode=u}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],29:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;j>k;++k){var l,m,n,o,p=a[k].replace(h,"%20"),q=p.indexOf(c);q>=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],30:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d",'"',"`"," ","\r","\n"," "],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=-1!==d&&dC)&&(A=C)}var D,E;E=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A),-1!==E&&(D=h.slice(0,E),h=h.slice(E+1),this.auth=decodeURIComponent(D)),A=-1;for(var B=0;BC)&&(A=C)}-1===A&&(A=h.length),this.host=h.slice(0,A),h=h.slice(A),this.parseHost(),this.hostname=this.hostname||"";var F="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!F)for(var G=this.hostname.split(/\./),B=0,H=G.length;H>B;B++){var I=G[B];if(I&&!I.match(t)){for(var J="",K=0,L=I.length;L>K;K++)J+=I.charCodeAt(K)>127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;H>B;B++){var S=p[B];if(-1!==h.indexOf(S)){var T=encodeURIComponent(S);T===S&&(T=escape(S)),h=h.split(S).join(T)}}var U=h.indexOf("#");-1!==U&&(this.hash=h.substr(U),h=h.slice(0,U));var V=h.indexOf("?");if(-1!==V?(this.search=h.substr(V),this.query=h.substr(V+1),b&&(this.query=y.parse(this.query)),h=h.slice(0,V)):b&&(this.search="",this.query={}),h&&(this.pathname=h),x[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",W=this.search||"";this.path=P+W}return this.href=this.format(),this},d.prototype.format=function(){var a=this.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var b=this.protocol||"",c=this.pathname||"",d=this.hash||"",e=!1,f="";this.host?e=a+this.host:this.hostname&&(e=a+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(e+=":"+this.port)),this.query&&j.isObject(this.query)&&Object.keys(this.query).length&&(f=y.stringify(this.query));var g=this.search||f&&"?"+f||"";return b&&":"!==b.substr(-1)&&(b+=":"),this.slashes||(!b||x[b])&&e!==!1?(e="//"+(e||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):e||(e=""),d&&"#"!==d.charAt(0)&&(d="#"+d),g&&"?"!==g.charAt(0)&&(g="?"+g),c=c.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),g=g.replace("#","%23"),b+e+c+g+d},d.prototype.resolve=function(a){return this.resolveObject(e(a,!1,!0)).format()},d.prototype.resolveObject=function(a){if(j.isString(a)){var b=new d;b.parse(a,!1,!0),a=b}for(var c=new d,e=Object.keys(this),f=0;f0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":33,punycode:28,querystring:31}],33:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],34:[function(a,b,c){function d(a){return a>="0"&&"9">=a||a>="A"&&"F">=a||a>="a"&&"f">=a}function e(a){return a>="0"&&"7">=a}function f(a){return a>="0"&&"9">=a}function g(a,b,c,d,e,f){var g=b+" at "+(d+1)+":"+(e+1),h=c-e-1,j="",k="",l=f?i.isLineTerminator:i.isLineTerminatorJSON;for(c-70>h&&(h=c-70);;){var m=a[++h];if(l(m)||h===a.length){c>=h&&(k+="^");break}if(j+=m,c===h?k+="^":c>h&&(k+=" "===a[h]?" ":" "),j.length>78)break}return g+"\n"+j+"\n"+k}function h(a,b){function c(b){var c=A-z;if(!b)if(x>A){var d="'"+JSON.stringify(a[A]).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";b||(b="Unexpected token "+d)}else b||(b="Unexpected end of input");var e=SyntaxError(g(a,b,A,y,c,u));throw e.row=y+1,e.column=c+1,e}function h(b){"\r"===b&&"\n"===a[A]&&A++,z=A,y++}function k(){for(;x>A;){C();var b=a[A++];return'"'===b||"'"===b&&u?D(t(b),"literal"):"{"===b?(D(void 0,"separator"),p()):"["===b?(D(void 0,"separator"),q()):"-"===b||"."===b||f(b)||u&&("+"===b||"I"===b||"N"===b)?D(r(),"literal"):"n"===b?(o("null"),D(null,"literal")):"t"===b?(o("true"),D(!0,"literal")):"f"===b?(o("false"),D(!1,"literal")):(A--,D(void 0))}}function l(){for(var b;x>A;){C();var c=a[A++];if('"'===c||"'"===c&&u)return D(t(c),"key");if("{"===c)return D(void 0,"separator"),p();if("["===c)return D(void 0,"separator"),q();if("."===c||f(c))return D(r(!0),"key");if(u&&i.isIdentifierStart(c)||"\\"===c&&"u"===a[A]){var d=A-1,b=s();return void 0===b?(A=d,D(void 0)):D(b,"key")}return A--,D(void 0)}}function m(){for(C();x>A;){var b=a[A++];if(v(b))A--,D(void 0,"whitespace"),C(),A++,h(b),D(void 0,"newline"),C();else if(w(b));else{if("/"!==b||!u||"/"!==a[A]&&"*"!==a[A]){A--;break}A--,D(void 0,"whitespace"),C(),A++,n("*"===a[A++]),D(void 0,"comment"),C()}}return D(void 0,"whitespace")}function n(b){for(;x>A;){var d=a[A++];if(v(d)){if(!b)return void A--;h(d)}else if("*"===d&&b&&"/"===a[A])return void A++}b&&c("Unclosed multiline comment")}function o(b){for(var d=A,e=b.length,f=1;e>f;f++)(A>=x||b[f]!=a[A])&&(A=d-1,c()),A++}function p(){for(var d=b.null_prototype?Object.create(null):{},e={},f=!1;x>A;){m();var g=l();m(),C();var h=a[A++];if(D(void 0,"separator"),"}"===h&&void 0===g)return!u&&f&&(A--,c("Trailing comma in object")),d;if(":"===h&&void 0!==g){m(),B.push(g);var i=k();B.pop(),void 0===i&&c("No value found for key "+g),"string"!=typeof g&&(u&&"number"==typeof g||c("Wrong key type: "+g)),(g in e||null!=e[g])&&"replace"!==b.reserved_keys?"throw"===b.reserved_keys&&c("Reserved key: "+g):("function"==typeof b.reviver&&(i=b.reviver.call(null,g,i)),void 0!==i&&(f=!0,Object.defineProperty(d,g,{value:i,enumerable:!0,configurable:!0,writable:!0}))),m(),C();var h=a[A++];if(D(void 0,"separator"),","===h)continue;if("}"===h)return d;c()}else A--,c()}c()}function q(){for(var d=[];x>A;){m(),B.push(d.length);var e=k();B.pop(),m(),C();var f=a[A++];if(D(void 0,"separator"),void 0!==e&&("function"==typeof b.reviver&&(e=b.reviver.call(null,String(d.length),e)),void 0===e?(d.length++,e=!0):d.push(e)),","===f)void 0===e&&c("Elisions are not supported");else{if("]"===f)return!u&&void 0===e&&d.length&&(A--,c("Trailing comma in array")),d;A--,c()}}}function r(){A--;var b=A,g=a[A++],h=function(d){var e=a.substr(b,A-b);if(d)var f=parseInt(e.replace(/^0o?/,""),8);else var f=Number(e);if(Number.isNaN(f))A--,c('Bad numeric literal - "'+a.substr(b,A-b+1)+'"');else{if(u||e.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i))return f;A--,c('Non-json numeric literal - "'+a.substr(b,A-b+1)+'"')}};if(("-"===g||"+"===g&&u)&&(g=a[A++]),"N"===g&&u)return o("NaN"),NaN;if("I"===g&&u)return o("Infinity"),h();if(g>="1"&&"9">=g){for(;x>A&&f(a[A]);)A++;g=a[A++]}if("0"===g){g=a[A++];var i="o"===g||"O"===g||e(g),j="x"===g||"X"===g;if(u&&(i||j)){for(;x>A&&(j?d:e)(a[A]);)A++;var k=1;return"-"===a[b]?(k=-1,b++):"+"===a[b]&&b++,k*h(i)}}if("."===g){for(;x>A&&f(a[A]);)A++;g=a[A++]}if("e"===g||"E"===g){for(g=a[A++],("-"===g||"+"===g)&&A++;x>A&&f(a[A]);)A++;g=a[A++]}return A--,h()}function s(){A--;for(var b="";x>A;){var e=a[A++];if("\\"===e&&"u"===a[A]&&d(a[A+1])&&d(a[A+2])&&d(a[A+3])&&d(a[A+4])&&(e=String.fromCharCode(parseInt(a.substr(A+1,4),16)),A+=5),b.length){if(!i.isIdentifierPart(e))return A--,b;b+=e}else{if(!i.isIdentifierStart(e))return void 0;b+=e}}c()}function t(b){for(var f="";x>A;){var g=a[A++];if(g===b)return f;if("\\"===g)if(A>=x&&c(),g=a[A++],j[g]&&(u||"v"!=g&&"'"!=g))f+=j[g];else if(u&&v(g))h(g);else if("u"===g||"x"===g&&u){for(var i="u"===g?4:2,k=0;i>k;k++)A>=x&&c(),d(a[A])||c("Bad escape sequence"),A++;f+=String.fromCharCode(parseInt(a.substr(A-i,i),16))}else if(u&&e(g)){if("4">g&&e(a[A])&&e(a[A+1]))var l=3;else if(e(a[A]))var l=2;else var l=1;A+=l-1,f+=String.fromCharCode(parseInt(a.substr(A-l,l),8))}else u?f+=g:(A--,c());else v(g)?c():(!u&&g.charCodeAt(0)<32&&(A--,c("Unexpected control character")),f+=g)}c()}var u=!("json"===b.mode||b.legacy),v=u?i.isLineTerminator:i.isLineTerminatorJSON,w=u?i.isWhiteSpace:i.isWhiteSpaceJSON,x=a.length,y=0,z=0,A=0,B=[],C=function(){},D=function(a){return a};b._tokenize&&!function(){var c=null;C=function(){if(null!==c)throw Error("internal error, token overlap");c=A},D=function(d,e){if(c!=A){var f={raw:a.substr(c,A-c),type:e,stack:B.slice(0)};void 0!==d&&(f.value=d),b._tokenize.call(null,f)}return c=null,d}}(),m();var E=k();if(void 0!==E||x>A){if(m(),A>=x)return"function"==typeof b.reviver&&(E=b.reviver.call(null,"",E)),E;c()}else c(A?"No data, only a whitespace":"No data, empty input")}var i=a("./unicode"),j={"'":"'",'"':'"',"\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:" ",v:" ","/":"/"};b.exports.parse=function(a,b){if("function"==typeof b&&(b={reviver:b}),void 0===a)return void 0;"string"!=typeof a&&(a=String(a)),null==b&&(b={}),null==b.reserved_keys&&(b.reserved_keys="ignore"),("throw"===b.reserved_keys||"ignore"===b.reserved_keys)&&null==b.null_prototype&&(b.null_prototype=!0);try{return h(a,b)}catch(c){if(c instanceof SyntaxError&&null!=c.row&&null!=c.column){var d=c;c=SyntaxError(d.message),c.column=d.column,c.row=d.row}throw c}},b.exports.tokenize=function(a,c){null==c&&(c={}),c._tokenize=function(a){c._addstack&&a.stack.unshift.apply(a.stack,c._addstack),d.push(a)};var d=[];return d.data=b.exports.parse(a,c),d}},{"./unicode":35}],35:[function(a,b,c){var d=b.exports;b.exports.isWhiteSpace=function(a){return" "===a||" "===a||"\ufeff"===a||a>=" "&&"\r">=a||" "===a||"᠎"===a||a>=" "&&" ">=a||"\u2028"===a||"\u2029"===a||" "===a||" "===a||" "===a},b.exports.isWhiteSpaceJSON=function(a){return" "===a||" "===a||"\n"===a||"\r"===a},b.exports.isLineTerminator=function(a){return"\n"===a||"\r"===a||"\u2028"===a||"\u2029"===a},b.exports.isLineTerminatorJSON=function(a){return"\n"===a||"\r"===a},b.exports.isIdentifierStart=function(a){return"$"===a||"_"===a||a>="A"&&"Z">=a||a>="a"&&"z">=a||a>="€"&&d.NonAsciiIdentifierStart.test(a)},b.exports.isIdentifierPart=function(a){return"$"===a||"_"===a||a>="A"&&"Z">=a||a>="a"&&"z">=a||a>="0"&&"9">=a||a>="€"&&d.NonAsciiIdentifierPart.test(a)},b.exports.NonAsciiIdentifierStart=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\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\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\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-\u0C33\u0C35-\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-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\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-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\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]/,b.exports.NonAsciiIdentifierPart=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\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\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\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\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\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\u0D02\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\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\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\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-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\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-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\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-\uFE26\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]/; +this.indent=a,!0):!1},a.prototype.fetch_stream_start=function(){var a;return a=this.get_mark(),this.tokens.push(new e.StreamStartToken(a,a,this.encoding))},a.prototype.fetch_stream_end=function(){var a;return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_possible_simple_key=!1,this.possible_simple_keys={},a=this.get_mark(),this.tokens.push(new e.StreamEndToken(a,a)),this.done=!0},a.prototype.fetch_directive=function(){return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_directive())},a.prototype.fetch_document_start=function(){return this.fetch_document_indicator(e.DocumentStartToken)},a.prototype.fetch_document_end=function(){return this.fetch_document_indicator(e.DocumentEndToken)},a.prototype.fetch_document_indicator=function(a){var b;return this.unwind_indent(-1),this.remove_possible_simple_key(),this.allow_simple_key=!1,b=this.get_mark(),this.forward(3),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_sequence_start=function(){return this.fetch_flow_collection_start(e.FlowSequenceStartToken)},a.prototype.fetch_flow_mapping_start=function(){return this.fetch_flow_collection_start(e.FlowMappingStartToken)},a.prototype.fetch_flow_collection_start=function(a){var b;return this.save_possible_simple_key(),this.flow_level++,this.allow_simple_key=!0,b=this.get_mark(),this.forward(),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_sequence_end=function(){return this.fetch_flow_collection_end(e.FlowSequenceEndToken)},a.prototype.fetch_flow_mapping_end=function(){return this.fetch_flow_collection_end(e.FlowMappingEndToken)},a.prototype.fetch_flow_collection_end=function(a){var b;return this.remove_possible_simple_key(),this.flow_level--,this.allow_simple_key=!1,b=this.get_mark(),this.forward(),this.tokens.push(new a(b,this.get_mark()))},a.prototype.fetch_flow_entry=function(){var a;return this.allow_simple_key=!0,this.remove_possible_simple_key(),a=this.get_mark(),this.forward(),this.tokens.push(new e.FlowEntryToken(a,this.get_mark()))},a.prototype.fetch_block_entry=function(){var a,b;if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"sequence entries are not allowed here",this.get_mark());this.add_indent(this.column)&&(a=this.get_mark(),this.tokens.push(new e.BlockSequenceStartToken(a,a)))}return this.allow_simple_key=!0,this.remove_possible_simple_key(),b=this.get_mark(),this.forward(),this.tokens.push(new e.BlockEntryToken(b,this.get_mark()))},a.prototype.fetch_key=function(){var a,b;if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"mapping keys are not allowed here",this.get_mark());this.add_indent(this.column)&&(a=this.get_mark(),this.tokens.push(new e.BlockMappingStartToken(a,a)))}return this.allow_simple_key=!this.flow_level,this.remove_possible_simple_key(),b=this.get_mark(),this.forward(),this.tokens.push(new e.KeyToken(b,this.get_mark()))},a.prototype.fetch_value=function(){var a,b,d;if(a=this.possible_simple_keys[this.flow_level])delete this.possible_simple_keys[this.flow_level],this.tokens.splice(a.token_number-this.tokens_taken,0,new e.KeyToken(a.mark,a.mark)),0===this.flow_level&&this.add_indent(a.column)&&this.tokens.splice(a.token_number-this.tokens_taken,0,new e.BlockMappingStartToken(a.mark,a.mark)),this.allow_simple_key=!1;else{if(0===this.flow_level){if(!this.allow_simple_key)throw new c.ScannerError(null,null,"mapping values are not allowed here",this.get_mark());this.add_indent(this.column)&&(b=this.get_mark(),this.tokens.push(new e.BlockMappingStartToken(b,b)))}this.allow_simple_key=!this.flow_level,this.remove_possible_simple_key()}return d=this.get_mark(),this.forward(),this.tokens.push(new e.ValueToken(d,this.get_mark()))},a.prototype.fetch_alias=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_anchor(e.AliasToken))},a.prototype.fetch_anchor=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_anchor(e.AnchorToken))},a.prototype.fetch_tag=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_tag())},a.prototype.fetch_literal=function(){return this.fetch_block_scalar("|")},a.prototype.fetch_folded=function(){return this.fetch_block_scalar(">")},a.prototype.fetch_block_scalar=function(a){return this.allow_simple_key=!0,this.remove_possible_simple_key(),this.tokens.push(this.scan_block_scalar(a))},a.prototype.fetch_single=function(){return this.fetch_flow_scalar("'")},a.prototype.fetch_double=function(){return this.fetch_flow_scalar('"')},a.prototype.fetch_flow_scalar=function(a){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_flow_scalar(a))},a.prototype.fetch_plain=function(){return this.save_possible_simple_key(),this.allow_simple_key=!1,this.tokens.push(this.scan_plain())},a.prototype.check_directive=function(){return 0===this.column?!0:!1},a.prototype.check_document_start=function(){var a;return 0===this.column&&"---"===this.prefix(3)&&(a=this.peek(3),k.call(b+i+"\x00",a)>=0)?!0:!1},a.prototype.check_document_end=function(){var a;return 0===this.column&&"..."===this.prefix(3)&&(a=this.peek(3),k.call(b+i+"\x00",a)>=0)?!0:!1},a.prototype.check_block_entry=function(){var a;return a=this.peek(1),k.call(b+i+"\x00",a)>=0},a.prototype.check_key=function(){var a;return 0!==this.flow_level?!0:(a=this.peek(1),k.call(b+i+"\x00",a)>=0)},a.prototype.check_value=function(){var a;return 0!==this.flow_level?!0:(a=this.peek(1),k.call(b+i+"\x00",a)>=0)},a.prototype.check_plain=function(){var a,c;return a=this.peek(),k.call(b+i+"\x00-?:,[]{}#&*!|>'\"%@`",a)<0||(c=this.peek(1),k.call(b+i+"\x00",c)<0&&("-"===a||0===this.flow_level&&k.call("?:",a)>=0))},a.prototype.scan_to_next_token=function(){var a,d,e,f,g;for(0===this.index&&"\ufeff"===this.peek()&&this.forward(),d=!1,g=[];!d;){for(;" "===this.peek();)this.forward();if(a="","#"===this.peek())for(;f=this.peek(),k.call(b+"\x00",f)<0;)this.ramlHeaderFound||(a+=this.peek()),this.forward();if(!this.ramlHeaderFound){if(e=a.trim(),!e||!o.test(e))throw new c.ScannerError("version validation",null,"The first line must be: '"+n+"'",this.create_mark(0,0));if(e!==n)throw new c.ScannerError("version validation",null,"Unsupported RAML version: '"+a+"'",this.create_mark(0,0));this.ramlHeaderFound=!0}this.scan_line_break()?0===this.flow_level?g.push(this.allow_simple_key=!0):g.push(void 0):g.push(d=!0)}return g},a.prototype.scan_directive=function(){var a,c,d,f,g;if(d=this.get_mark(),this.forward(),c=this.scan_directive_name(d),f=null,"YAML"===c)f=this.scan_yaml_directive_value(d),a=this.get_mark();else if("TAG"===c)f=this.scan_tag_directive_value(d),a=this.get_mark();else for(a=this.get_mark();g=this.peek(),k.call(b+"\x00",g)<0;)this.forward();return this.scan_directive_ignored_line(d),new e.DirectiveToken(c,f,d,a)},a.prototype.scan_directive_name=function(a){var d,e,f;for(e=0,d=this.peek(e);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)e++,d=this.peek(e);if(0===e)throw new c.ScannerError("while scanning a directive",a,"expected alphanumeric or numeric character but found "+d,this.get_mark());if(f=this.prefix(e),this.forward(e),d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected alphanumeric or numeric character but found "+d,this.get_mark());return f},a.prototype.scan_yaml_directive_value=function(a){for(var d,e,f;" "===this.peek();)this.forward();if(d=this.scan_yaml_directive_number(a),"."!==this.peek())throw new c.ScannerError("while scanning a directive",a,"expected a digit or '.' but found "+this.peek(),this.get_mark());if(this.forward(),e=this.scan_yaml_directive_number(a),f=this.peek(),k.call(b+"\x00 ",f)<0)throw new c.ScannerError("while scanning a directive",a,"expected a digit or ' ' but found "+this.peek(),this.get_mark());return[d,e]},a.prototype.scan_yaml_directive_number=function(a){var b,d,e,f;if(b=this.peek(),!(b>="0"&&"9">=b))throw new c.ScannerError("while scanning a directive",a,"expected a digit but found "+b,this.get_mark());for(d=0;"0"<=(f=this.peek(d))&&"9">=f;)d++;return e=parseInt(this.prefix(d)),this.forward(d),e},a.prototype.scan_tag_directive_value=function(a){for(var b,c;" "===this.peek();)this.forward();for(b=this.scan_tag_directive_handle(a);" "===this.peek();)this.forward();return c=this.scan_tag_directive_prefix(a),[b,c]},a.prototype.scan_tag_directive_handle=function(a){var b,d;if(d=this.scan_tag_handle("directive",a),b=this.peek()," "!==b)throw new c.ScannerError("while scanning a directive",a,"expected ' ' but found "+b,this.get_mark());return d},a.prototype.scan_tag_directive_prefix=function(a){var d,e;if(e=this.scan_tag_uri("directive",a),d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected ' ' but found "+d,this.get_mark());return e},a.prototype.scan_directive_ignored_line=function(a){for(var d,e;" "===this.peek();)this.forward();if("#"===this.peek())for(;e=this.peek(),k.call(b+"\x00",e)<0;)this.forward();if(d=this.peek(),k.call(b+"\x00",d)<0)throw new c.ScannerError("while scanning a directive",a,"expected a comment or a line break but found "+d,this.get_mark());return this.scan_line_break()},a.prototype.scan_anchor=function(a){var d,e,f,g,h,j;for(h=this.get_mark(),e=this.peek(),g="*"===e?"alias":"anchor",this.forward(),f=0,d=this.peek(f);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)f++,d=this.peek(f);if(0===f)throw new c.ScannerError("while scanning an "+g,h,"expected alphabetic or numeric character but found '"+d+"'",this.get_mark());if(j=this.prefix(f),this.forward(f),d=this.peek(),k.call(b+i+"\x00?:,]}%@`",d)<0)throw new c.ScannerError("while scanning an "+g,h,"expected alphabetic or numeric character but found '"+d+"'",this.get_mark());return new a(j,h,this.get_mark())},a.prototype.scan_tag=function(){var a,d,f,g,h,j;if(g=this.get_mark(),a=this.peek(1),"<"===a){if(d=null,this.forward(2),h=this.scan_tag_uri("tag",g),">"!==this.peek())throw new c.ScannerError("while parsing a tag",g,"expected '>' but found "+this.peek(),this.get_mark());this.forward()}else if(k.call(b+i+"\x00",a)>=0)d=null,h="!",this.forward();else{for(f=1,j=!1;k.call(b+"\x00 ",a)<0;){if("!"===a){j=!0;break}f++,a=this.peek(f)}j?d=this.scan_tag_handle("tag",g):(d="!",this.forward()),h=this.scan_tag_uri("tag",g)}if(a=this.peek(),k.call(b+"\x00 ",a)<0)throw new c.ScannerError("while scanning a tag",g,"expected ' ' but found "+a,this.get_mark());return new e.TagToken([d,h],g,this.get_mark())},a.prototype.scan_block_scalar=function(a){var c,d,g,h,i,j,l,m,n,o,p,q,r,s,t,u,v,w,x,y;for(i=">"===a,g=[],r=this.get_mark(),this.forward(),s=this.scan_block_scalar_indicators(r),d=s[0],j=s[1],this.scan_block_scalar_ignored_line(r),q=this.indent+1,1>q&&(q=1),null==j?(t=this.scan_block_scalar_indentation(),c=t[0],p=t[1],h=t[2],l=Math.max(q,p)):(l=q+j-1,u=this.scan_block_scalar_breaks(l),c=u[0],h=u[1]),o="";this.column===l&&"\x00"!==this.peek();){for(g=g.concat(c),v=this.peek(),m=k.call(" ",v)<0,n=0;w=this.peek(n),k.call(b+"\x00",w)<0;)n++;if(g.push(this.prefix(n)),this.forward(n),o=this.scan_line_break(),x=this.scan_block_scalar_breaks(l),c=x[0],h=x[1],this.column!==l||"\x00"===this.peek())break;i&&"\n"===o&&m&&(y=this.peek(),k.call(" ",y)<0)?f.is_empty(c)&&g.push(" "):g.push(o)}return d!==!1&&g.push(o),d===!0&&(g=g.concat(c)),new e.ScalarToken(g.join(""),!1,r,h,a)},a.prototype.scan_block_scalar_indicators=function(a){var d,e,f;if(e=null,f=null,d=this.peek(),k.call("+-",d)>=0){if(e="+"===d,this.forward(),d=this.peek(),k.call(g,d)>=0){if(f=parseInt(d),0===f)throw new c.ScannerError("while scanning a block scalar",a,"expected indentation indicator in the range 1-9 but found 0",this.get_mark());this.forward()}}else if(k.call(g,d)>=0){if(f=parseInt(d),0===f)throw new c.ScannerError("while scanning a block scalar",a,"expected indentation indicator in the range 1-9 but found 0",this.get_mark());this.forward(),d=this.peek(),k.call("+-",d)>=0&&(e="+"===d,this.forward())}if(d=this.peek(),k.call(b+"\x00 ",d)<0)throw new c.ScannerError("while scanning a block scalar",a,"expected chomping or indentation indicators, but found "+d,this.get_mark());return[e,f]},a.prototype.scan_block_scalar_ignored_line=function(a){for(var d,e;" "===this.peek();)this.forward();if("#"===this.peek())for(;e=this.peek(),k.call(b+"\x00",e)<0;)this.forward();if(d=this.peek(),k.call(b+"\x00",d)<0)throw new c.ScannerError("while scanning a block scalar",a,"expected a comment or a line break but found "+d,this.get_mark());return this.scan_line_break()},a.prototype.scan_block_scalar_indentation=function(){var a,c,d,e;for(a=[],d=0,c=this.get_mark();e=this.peek(),k.call(b+" ",e)>=0;)" "!==this.peek()?(a.push(this.scan_line_break()),c=this.get_mark()):(this.forward(),this.column>d&&(d=this.column));return[a,d,c]},a.prototype.scan_block_scalar_breaks=function(a){var c,d,e;for(c=[],d=this.get_mark();this.column=0;)for(c.push(this.scan_line_break()),d=this.get_mark();this.column=0)f.push(e),this.forward();else{if(!a||"\\"!==e)return f;if(this.forward(),e=this.peek(),e in m)f.push(m[e]),this.forward();else if(e in l){for(n=l[e],this.forward(),j=o=0;n>=0?n>o:o>n;j=n>=0?++o:--o)if(q=this.peek(j),k.call(g+"ABCDEFabcdef",q)<0)throw new c.ScannerError("while scanning a double-quoted scalar",d,"expected escape sequence of "+n+" hexadecimal numbers, but found "+this.peek(j),this.get_mark());h=parseInt(this.prefix(n),16),f.push(String.fromCharCode(h)),this.forward(n)}else{if(!(k.call(b,e)>=0))throw new c.ScannerError("while scanning a double-quoted scalar",d,"found unknown escape character "+e,this.get_mark());this.scan_line_break(),f=f.concat(this.scan_flow_scalar_breaks(a,d))}}else f.push("'"),this.forward(2)}},a.prototype.scan_flow_scalar_spaces=function(a,d){var e,f,g,h,j,l,m;for(g=[],h=0;m=this.peek(h),k.call(i,m)>=0;)h++;if(l=this.prefix(h),this.forward(h),f=this.peek(),"\x00"===f)throw new c.ScannerError("while scanning a quoted scalar",d,"found unexpected end of stream",this.get_mark());return k.call(b,f)>=0?(j=this.scan_line_break(),e=this.scan_flow_scalar_breaks(a,d),"\n"!==j?g.push(j):e||g.push(" "),g=g.concat(e)):g.push(l),g},a.prototype.scan_flow_scalar_breaks=function(a,d){var e,f,g,h,j;for(e=[];;){if(f=this.prefix(3),"---"===f||"..."===f&&(g=this.peek(3),k.call(b+i+"\x00",g)>=0))throw new c.ScannerError("while scanning a quoted scalar",d,"found unexpected document separator",this.get_mark());for(;h=this.peek(),k.call(i,h)>=0;)this.forward();if(j=this.peek(),!(k.call(b,j)>=0))return e;e.push(this.scan_line_break())}},a.prototype.scan_plain=function(){var a,d,f,g,h,j,l,m,n;for(d=[],l=f=this.get_mark(),g=this.indent+1,j=[];;){if(h=0,"#"===this.peek())break;for(;;){if(a=this.peek(h),k.call(b+i+"\x00",a)>=0||0===this.flow_level&&":"===a&&(m=this.peek(h+1),k.call(b+i+"\x00",m)>=0)||0!==this.flow_level&&k.call(",:?[]{}",a)>=0)break;h++}if(0!==this.flow_level&&":"===a&&(n=this.peek(h+1),k.call(b+i+"\x00,[]{}",n)<0))throw this.forward(h),new c.ScannerError("while scanning a plain scalar",l,"found unexpected ':'",this.get_mark(),"Please check http://pyyaml.org/wiki/YAMLColonInFlowContext");if(0===h)break;if(this.allow_simple_key=!1,d=d.concat(j),d.push(this.prefix(h)),this.forward(h),f=this.get_mark(),j=this.scan_plain_spaces(g,l),null==j||0===j.length||"#"===this.peek()||0===this.flow_level&&this.column=0;)g++;if(l=this.prefix(g),this.forward(g),e=this.peek(),k.call(b,e)>=0){if(h=this.scan_line_break(),this.allow_simple_key=!0,j=this.prefix(3),"---"===j||"..."===j&&this.peek(k.call(b+i+"\x00",3)>=0))return;for(d=[];n=this.peek(),k.call(b+" ",n)>=0;)if(" "===this.peek())this.forward();else if(d.push(this.scan_line_break()),j=this.prefix(3),"---"===j||"..."===j&&this.peek(k.call(b+i+"\x00",3)>=0))return;"\n"!==h?f.push(h):0===d.length&&f.push(" "),f=f.concat(d)}else l&&f.push(l);return f},a.prototype.scan_tag_handle=function(a,b){var d,e,f;if(d=this.peek(),"!"!==d)throw new c.ScannerError("while scanning a "+a,b,"expected '!' but found "+d,this.get_mark());if(e=1,d=this.peek(e)," "!==d){for(;d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-_",d)>=0;)e++,d=this.peek(e);if("!"!==d)throw this.forward(e),new c.ScannerError("while scanning a "+a,b,"expected '!' but found "+d,this.get_mark());e++}return f=this.prefix(e),this.forward(e),f},a.prototype.scan_tag_uri=function(a,b){var d,e,f;for(e=[],f=0,d=this.peek(f);d>="0"&&"9">=d||d>="A"&&"Z">=d||d>="a"&&"z">=d||k.call("-;/?:@&=+$,_.!~*'()[]%",d)>=0;)"%"===d?(e.push(this.prefix(f)),this.forward(f),f=0,e.push(this.scan_uri_escapes(a,b))):f++,d=this.peek(f);if(0!==f&&(e.push(this.prefix(f)),this.forward(f),f=0),0===e.length)throw new c.ScannerError("while parsing a "+a,b,"expected URI but found "+d,this.get_mark());return e.join("")},a.prototype.scan_uri_escapes=function(a,b){var d,e,f,g;for(d=[],f=this.get_mark();"%"===this.peek();){for(this.forward(),e=g=0;2>=g;e=++g)throw new c.ScannerError("while scanning a "+a,b,"expected URI escape sequence of 2 hexadecimal numbers but found "+this.peek(e),this.get_mark());d.push(String.fromCharCode(parseInt(this.prefix(2),16))),this.forward(2)}return d.join("")},a.prototype.scan_line_break=function(){var a;return a=this.peek(),k.call("\r\n…",a)>=0?("\r\n"===this.prefix(2)?this.forward(2):this.forward(),"\n"):k.call("\u2028\u2029",a)>=0?(this.forward(),a):""},a}()}).call(this)},{"./errors":3,"./tokens":17,"./util":20}],15:[function(a,b,c){(function(){var b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};b=a("./errors").MarkedYAMLError,c=a("./nodes"),this.SchemaError=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(b),this.Schemas=function(){function a(){this.get_schemas_used=g(this.get_schemas_used,this),this.apply_schemas=g(this.apply_schemas,this),this.get_all_schemas=g(this.get_all_schemas,this),this.has_schemas=g(this.has_schemas,this),this.load_schemas=g(this.load_schemas,this),this.declaredSchemas={}}return a.prototype.load_schemas=function(a){var b,c=this;return this.has_property(a,"schemas")&&(b=this.property_value(a,"schemas"),b&&"object"==typeof b)?b.forEach(function(a){return a&&"object"==typeof a&&"object"==typeof a.value?a.value.forEach(function(a){return c.declaredSchemas[a[0].value]=a}):void 0}):void 0},a.prototype.has_schemas=function(a){return 0===this.declaredSchemas.length&&this.has_property(a,"schemas")&&this.load_schemas(a),Object.keys(this.declaredSchemas).length>0},a.prototype.get_all_schemas=function(){return this.declaredSchemas},a.prototype.apply_schemas=function(a){var b,c,d=this;return b=this.child_resources(a),c=this.get_schemas_used(b),c.forEach(function(a){return a[1].value in d.declaredSchemas?a[1].value=d.declaredSchemas[a[1].value][1].value:void 0})},a.prototype.get_schemas_used=function(a){var b,c=this;return b=[],a.forEach(function(a){var d;return d=c.get_properties(a[1],"schema"),b=b.concat(d)}),b},a}()}).call(this)},{"./errors":3,"./nodes":7}],16:[function(a,b,c){(function(){var b,c,d,e={}.hasOwnProperty,f=function(a,b){function c(){this.constructor=a}for(var d in b)e.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};b=a("./errors").MarkedYAMLError,c=a("./nodes"),this.SecuritySchemeError=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return f(b,a),b}(b),this.SecuritySchemes=function(){function a(){this.get_security_scheme=g(this.get_security_scheme,this),this.get_all_schemes=g(this.get_all_schemes,this),this.load_security_schemes=g(this.load_security_schemes,this),this.declaredSchemes={}}return a.prototype.load_security_schemes=function(a){var b,c=this;return this.has_property(a,"securitySchemes")&&(b=this.property_value(a,"securitySchemes"),b&&"object"==typeof b)?b.forEach(function(a){return"tag:yaml.org,2002:map"===a.tag?a.value.forEach(function(a){return c.declaredSchemes[a[0].value]=a[1].value}):void 0}):void 0},a.prototype.get_all_schemes=function(){return this.declaredSchemes},a.prototype.get_security_scheme=function(a){return this.declaredSchemes[a]},a}()}).call(this)},{"./errors":3,"./nodes":7}],17:[function(a,b,c){(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o={}.hasOwnProperty,p=function(a,b){function c(){this.constructor=a}for(var d in b)o.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};this.Token=function(){function a(a,b){this.start_mark=a,this.end_mark=b}return a}(),this.DirectiveToken=function(a){function b(a,b,c,d){this.name=a,this.value=b,this.start_mark=c,this.end_mark=d}return p(b,a),b.prototype.id="",b}(this.Token),this.DocumentStartToken=function(b){function c(){return a=c.__super__.constructor.apply(this,arguments)}return p(c,b),c.prototype.id="",c}(this.Token),this.DocumentEndToken=function(a){function c(){return b=c.__super__.constructor.apply(this,arguments)}return p(c,a),c.prototype.id="",c}(this.Token),this.StreamStartToken=function(a){function b(a,b,c){this.start_mark=a,this.end_mark=b,this.encoding=c}return p(b,a),b.prototype.id="",b}(this.Token),this.StreamEndToken=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockSequenceStartToken=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockMappingStartToken=function(a){function b(){return i=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.BlockEndToken=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="",b}(this.Token),this.FlowSequenceStartToken=function(a){function b(){return k=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="[",b}(this.Token),this.FlowMappingStartToken=function(a){function b(){return l=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="{",b}(this.Token),this.FlowSequenceEndToken=function(a){function b(){return m=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="]",b}(this.Token),this.FlowMappingEndToken=function(a){function b(){return n=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="}",b}(this.Token),this.KeyToken=function(a){function b(){return c=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="?",b}(this.Token),this.ValueToken=function(a){function b(){return d=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id=":",b}(this.Token),this.BlockEntryToken=function(a){function b(){return e=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id="-",b}(this.Token),this.FlowEntryToken=function(a){function b(){return f=b.__super__.constructor.apply(this,arguments)}return p(b,a),b.prototype.id=",",b}(this.Token),this.AliasToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.AnchorToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.TagToken=function(a){function b(a,b,c){this.value=a,this.start_mark=b,this.end_mark=c}return p(b,a),b.prototype.id="",b}(this.Token),this.ScalarToken=function(a){function b(a,b,c,d,e){this.value=a,this.plain=b,this.start_mark=c,this.end_mark=d,this.style=e}return p(b,a),b.prototype.id="",b}(this.Token)}).call(this)},{}],18:[function(a,b,c){(function(){var b,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("pluralize"),b=a("./errors").MarkedYAMLError,d=a("./nodes"),f=a("./util"),this.TraitError=function(a){function b(){return g=b.__super__.constructor.apply(this,arguments)}return j(b,a),b}(b),this.ParameterError=function(a){function b(){return h=b.__super__.constructor.apply(this,arguments)}return j(b,a),b}(b),this.Traits=function(){function a(){this.declaredTraits={}}return a.prototype.load_traits=function(a){var b,c=this;return this.has_property(a,"traits")&&(b=this.property_value(a,"traits"),b&&"object"==typeof b)?b.forEach(function(a){return a&&"object"==typeof a&&"object"==typeof a.value?a.value.forEach(function(a){return c.declaredTraits[a[0].value]=a}):void 0}):void 0},a.prototype.has_traits=function(a){return 0===this.declaredTraits.length&&this.has_property(a,"traits")&&this.load_traits(a),Object.keys(this.declaredTraits).length>0},a.prototype.get_trait=function(a){return a in this.declaredTraits?this.declaredTraits[a][1]:null},a.prototype.apply_traits=function(a,b,c){var d,e=this;return null==b&&(b=""),null==c&&(c=!0),f.isMapping(a)&&this.has_traits(a)?(d=this.child_resources(a),d.forEach(function(a){return e.apply_traits_to_resource(b+a[0].value,a[1],c)})):void 0},a.prototype.apply_traits_to_resource=function(a,b,c){var d,e,g=this;if(f.isMapping(b))return d=this.child_methods(b),this.has_property(b,"is")&&(e=this.property_value(b,"is"),e.forEach(function(b){return d.forEach(function(c){return g.apply_trait(a,c,b)})})),d.forEach(function(b){return g.has_property(b[1],"is")?(e=g.property_value(b[1],"is"),e.forEach(function(c){return g.apply_trait(a,b,c)})):void 0}),c&&b.remove_question_mark_properties(),this.apply_traits(b,a,c)},a.prototype.apply_trait=function(a,b,d){var e,f,g,h;if(h=this.key_or_value(d),!(null!=h?h.trim():void 0))throw new c.TraitError("while applying trait",null,"trait name must be provided",d.start_mark);if(!(g=this.get_trait(h)))throw new c.TraitError("while applying trait",null,"there is no trait named "+h,d.start_mark);return e=this.get_parameters_from_is_key(a,b[0].value,d),f=g.cloneForTrait(),this.apply_parameters(f,e,d),this.apply_default_media_type_to_method(f),f.combine(b[1]),b[1]=f},a.prototype.apply_parameters=function(a,b,d){var e,f,g;this._apply_parameters(a,b,d,f={resourcePath:!0,resourcePathName:!0,methodName:!0}),g=[];for(e in b){if(!f[e])throw new c.ParameterError("while applying parameters",null,"unused parameter: "+e,d.start_mark);g.push(void 0)}return g},a.prototype._apply_parameters=function(a,b,d,g){var h,i=this;if(a)return f.isString(a)?void((h=a.value.match(/<<\s*([^\|\s>]+)\s*(\|[^>]*)?\s*>>/g))&&h.forEach(function(f){var h,i,j,k,l;if(i=null!=f&&null!=(k=f.trim())?k.replace(/[<>]+/g,"").trim():void 0,l=i.split(/\s*\|\s*/),i=l[0],h=l[1],!(i in b))throw new c.ParameterError("while applying parameters",null,"value was not provided for parameter: "+i,d.start_mark);if(j=b[i],g[i]=!0,h)if(h.match(/!\s*singularize/))j=e.singular(j);else{if(!h.match(/!\s*pluralize/))throw new c.ParameterError("while validating parameter",null,"unknown function applied to parameter",a.start_mark);j=e.plural(j)}return a.value=a.value.replace(f,j)})):f.isSequence(a)?void a.value.forEach(function(a){return i._apply_parameters(a,b,d,g)}):void(f.isMapping(a)&&a.value.forEach(function(a){return i._apply_parameters(a[0],b,d,g),i._apply_parameters(a[1],b,d,g)}))},a.prototype.get_parameters_from_is_key=function(a,b,d){var e,g,h,i,j,k,l;if(i={},h={methodName:b,resourcePath:a.replace(/\/\/*/g,"/"),resourcePathName:this.extractResourcePathName(a)},f.isMapping(d)&&(g=this.value_or_undefined(d),f.isMapping(g[0][1])))for(l=g[0][1].value,j=0,k=l.length;k>j;j++){if(e=l[j],e[0].value in h)throw new c.TraitError("while applying parameters",null,"invalid parameter name: "+e[0].value+" is reserved",e[0].start_mark);i[e[0].value]=e[1].value}return f.extend(i,h)},a.prototype.extractResourcePathName=function(a){var b,c;for(b=a.split(/\//);c=b.pop();)if(!("undefined"!=typeof c&&null!==c?c.match(/[{}]/):void 0))return c;return""},a}()}).call(this)},{"./errors":3,"./nodes":7,"./util":20,pluralize:36}],19:[function(a,b,c){(function(){var b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};c=a("uritemplate"),b=a("./nodes"),d=a("./util"),this.Transformations=function(){function a(a){this.settings=a,this.isContentTypeString=e(this.isContentTypeString,this),this.add_key_value_to_node=e(this.add_key_value_to_node,this),this.apply_default_media_type_to_resource=e(this.apply_default_media_type_to_resource,this),this.get_media_type=e(this.get_media_type,this),this.load_default_media_type=e(this.load_default_media_type,this),this.applyAstTransformations=e(this.applyAstTransformations,this),this.applyTransformations=e(this.applyTransformations,this),this.declaredSchemas={}}return a.prototype.applyTransformations=function(a){var b;return this.settings.transform?(this.applyTransformationsToRoot(a),b=a.resources,this.applyTransformationsToResources(a,b)):void 0},a.prototype.applyAstTransformations=function(a){return this.settings.transform?this.transform_document(a):void 0},a.prototype.load_default_media_type=function(a){return d.isMapping(a||(null!=a?a.value:void 0))?this.mediaType=this.property_value(a,"mediaType"):void 0},a.prototype.get_media_type=function(){return this.mediaType},a.prototype.applyTransformationsToRoot=function(a){var b,d,e;return a.baseUri?(d=c.parse(a.baseUri),b=[],null!=(e=d.expressions)&&e.forEach(function(a){var c;return null!=(c=a.varspecs)?c.forEach(function(a){return b.push(a.varname)}):void 0}),b.length&&(a.baseUriParameters||(a.baseUriParameters={})),b.forEach(function(b){return b in a.baseUriParameters||(a.baseUriParameters[b]={type:"string",required:!0,displayName:b},"version"!==b)?void 0:a.baseUriParameters[b]["enum"]=[a.version]})):void 0},a.prototype.applyTransformationsToResources=function(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;if(null!=b?b.length:void 0){for(t=[],k=0,n=b.length;n>k;k++){if(i=b[k],e=i.securedBy?i.securedBy:null!=a?a.securedBy:void 0,null!=(q=i.methods)?q.length:void 0)for(r=i.methods,l=0,o=r.length;o>l;l++)f=r[l],"securedBy"in f||e&&(f.securedBy=e);for(h=i.relativeUri.split("/");!h[0]&&h.length;)h.shift();for(i.relativeUriPathSegments=h,j=c.parse(i.relativeUri),d=[],null!=(s=j.expressions)&&s.forEach(function(a){var b;return null!=(b=a.varspecs)?b.forEach(function(a){return d.push(a.varname)}):void 0}),d.length&&(i.uriParameters||(i.uriParameters={})),m=0,p=d.length;p>m;m++)g=d[m],g in i.uriParameters||(i.uriParameters[g]={type:"string",required:!0,displayName:g});t.push(this.applyTransformationsToResources(a,i.resources))}return t}},a.prototype.apply_default_media_type_to_resource=function(a){var b,c,e,f,g,h,i,j,k;if(this.mediaType&&d.isMapping(a)){for(i=this.child_resources(a),e=0,g=i.length;g>e;e++)b=i[e],this.apply_default_media_type_to_resource(b[1]); +for(j=this.child_methods(a),k=[],f=0,h=j.length;h>f;f++)c=j[f],k.push(this.apply_default_media_type_to_method(c[1]));return k}},a.prototype.apply_default_media_type_to_method=function(a){var b,c=this;if(this.mediaType&&d.isMapping(a)&&(this.has_property(a,"body")&&this.apply_default_media_type_to_body(this.get_property_pair(a,"body")),this.has_property(a,"responses"))){if(b=this.get_property(a,"responses"),!b||!b.value)return;return b.value.forEach(function(a){return c.has_property(a[1],"body")?c.apply_default_media_type_to_body(c.get_property_pair(a[1],"body")):void 0})}},a.prototype.apply_default_media_type_to_body=function(a){var c,e,f,g,h,i,j;return d.isNull(a[1])&&(a[1]=new b.MappingNode("tag:yaml.org,2002:map",[])),(null!=(g=a[1])&&null!=(h=g.value)&&null!=(i=h[0])&&null!=(j=i[0])?j.value:0)?(c=a[1].value[0][0].value,c.match(/\//)?void 0:(e=new b.MappingNode("tag:yaml.org,2002:map",[],a[1].start_mark,a[1].end_mark),f=new b.ScalarNode("tag:yaml.org,2002:str",this.mediaType,a[1].start_mark,a[1].end_mark),e.value.push([f,a[1].clone()]),a[1].value=e.value)):a[1].value.push([new b.ScalarNode("tag:yaml.org,2002:str",this.mediaType),new b.ScalarNode("tag:yaml.org,2002:null")])},a.prototype.noop=function(){},a.prototype.transform_types=function(a){var b,c=this;return b=a.value,b.forEach(function(a){return a.value.forEach(function(a){return c.transform_resource(a,!0)})})},a.prototype.transform_traits=function(a){var b,c=this;return b=a.value,b.forEach(function(a){return a.value.forEach(function(a){return c.transform_method(a[1],!0)})})},a.prototype.transform_named_params=function(a,c,e){var f=this;return null==e&&(e=!0),d.isNull(a[1])?void 0:a[1].value.forEach(function(a){return d.isNull(a[1])&&(a[1]=new b.MappingNode("tag:yaml.org,2002:map",[],a[1].start_mark,a[1].end_mark)),f.transform_common_parameter_properties(a[0].value,a[1],c,e)})},a.prototype.transform_common_parameter_properties=function(a,b,c,e){var f=this;return d.isSequence(b)?b.value.forEach(function(b){return f.transform_named_parameter(a,b,c,e)}):this.transform_named_parameter(a,b,c,e)},a.prototype.transform_named_parameter=function(a,b,c,d){var e,f,g,h=this;return e=!1,f=!1,g=!1,b.value.forEach(function(a){var b;if(!c||!h.isParameterKey(a))switch(b=h.canonicalizePropertyName(a[0].value,c)){case"pattern":return h.noop();case"default":return h.noop();case"enum":return h.noop();case"description":return h.noop();case"example":return h.noop();case"minLength":return h.noop();case"maxLength":return h.noop();case"minimum":return h.noop();case"maximum":return h.noop();case"repeat":return h.noop();case"displayName":return e=!0;case"type":return g=!0;case"required":return f=!0;default:return h.noop()}}),e||this.add_key_value_to_node(b,"displayName","tag:yaml.org,2002:str",this.canonicalizePropertyName(a,c)),f||d&&this.add_key_value_to_node(b,"required","tag:yaml.org,2002:bool","true"),g?void 0:this.add_key_value_to_node(b,"type","tag:yaml.org,2002:str","string")},a.prototype.add_key_value_to_node=function(a,c,d,e){var f,g;return f=new b.ScalarNode("tag:yaml.org,2002:str",c,a.start_mark,a.end_mark),g=new b.ScalarNode(d,e,a.start_mark,a.end_mark),a.value.push([f,g])},a.prototype.transform_document=function(a){var b=this;return(null!=a?a.value:void 0)?a.value.forEach(function(a){var c;switch(a[0].value){case"title":return b.noop();case"securitySchemes":return b.noop();case"schemas":return b.noop();case"version":return b.noop();case"documentation":return b.noop();case"mediaType":return b.noop();case"securedBy":return b.noop();case"baseUri":return b.noop();case"traits":return b.transform_traits(a[1]);case"baseUriParameters":return b.transform_named_params(a,!1);case"resourceTypes":return b.transform_types(a[1]);case"resources":return null!=(c=a[1])?c.value.forEach(function(a){return b.transform_resource(a)}):void 0;default:return b.noop()}}):void 0},a.prototype.transform_resource=function(a,b){var c=this;return null==b&&(b=!1),a.value?a.value.forEach(function(a){var d,e,f,g;if(e=c.transform_common_properties(a,b),!e){if(c.isHttpMethod(a[0].value,b))return c.transform_method(a[1],b);switch(d=c.canonicalizePropertyName(a[0].value,b)){case"type":return c.noop();case"usage":return c.noop();case"securedBy":return c.noop();case"uriParameters":return c.transform_named_params(a,b);case"baseUriParameters":return c.transform_named_params(a,b);case"resources":return null!=(f=a[1])?f.value.forEach(function(a){return c.transform_resource(a)}):void 0;case"methods":return null!=(g=a[1])?g.value.forEach(function(a){return c.transform_method(a,b)}):void 0;default:return c.noop()}}}):void 0},a.prototype.transform_method=function(a,b){var c=this;if(!d.isNull(a))return a.value.forEach(function(a){var d;if(!c.transform_common_properties(a,b))switch(d=c.canonicalizePropertyName(a[0].value,b)){case"securedBy":return c.noop();case"usage":return c.noop();case"headers":return c.transform_named_params(a,b,!1);case"queryParameters":return c.transform_named_params(a,b,!1);case"baseUriParameters":return c.transform_named_params(a,b);case"body":return c.transform_body(a,b);case"responses":return c.transform_responses(a,b);default:return c.noop()}})},a.prototype.transform_responses=function(a,b){var c=this;if(!d.isNull(a[1]))return a[1].value.forEach(function(a){return c.transform_response(a,b)})},a.prototype.transform_response=function(a,b){var c=this;return d.isMapping(a[1])?a[1].value.forEach(function(a){var d;switch(d=c.canonicalizePropertyName(a[0].value,b)){case"description":return c.noop();case"body":return c.transform_body(a,b);case"headers":return c.transform_named_params(a,b,!1);default:return c.noop()}}):void 0},a.prototype.isContentTypeString=function(a){return null!=a?a.match(/^[^\/]+\/[^\/]+$/):void 0},a.prototype.transform_body=function(a,b){var c,e=this;if(!d.isNull(a[1]))return null!=(c=a[1].value)?c.forEach(function(a){var c;if(e.isParameterKey(a))return e.noop();if(e.isContentTypeString(a[0].value))return e.transform_body(a,b);switch(c=e.canonicalizePropertyName(a[0].value,b)){case"example":return e.noop();case"schema":return e.noop();case"formParameters":return e.transform_named_params(a,b,!1);default:return e.noop()}}):void 0},a.prototype.transform_common_properties=function(a,b){var c;if(this.isParameterKey(a))return!0;switch(c=this.canonicalizePropertyName(a[0].value,b)){case"displayName":return!0;case"description":return!0;case"is":return!0;default:this.noop()}return!1},a}()}).call(this)},{"./nodes":7,"./util":20,uritemplate:38}],20:[function(a,b,c){(function(){var a=[].slice,b={}.hasOwnProperty;this.extend=function(){var b,c,d,e,f,g,h;for(b=arguments[0],e=2<=arguments.length?a.call(arguments,1):[],g=0,h=e.length;h>g;g++){d=e[g];for(c in d)f=d[c],b[c]=f}return b},this.is_empty=function(a){var c;if(Array.isArray(a)||"string"==typeof a)return 0===a.length;for(c in a)if(b.call(a,c))return!1;return!0},this.isNoop=function(a){return a},this.isMapping=function(a){return"tag:yaml.org,2002:map"===(null!=a?a.tag:void 0)},this.isNull=function(a){return"tag:yaml.org,2002:null"===(null!=a?a.tag:void 0)},this.isSequence=function(a){return"tag:yaml.org,2002:seq"===(null!=a?a.tag:void 0)},this.isString=function(a){return"tag:yaml.org,2002:str"===(null!=a?a.tag:void 0)},this.isInteger=function(a){return"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)},this.isNullableMapping=function(a){return this.isMapping(a)||this.isNull(a)},this.isNullableString=function(a){return this.isString(a)||this.isNull(a)},this.isNullableSequence=function(a){return this.isSequence(a)||this.isNull(a)},this.isNumber=function(a){return"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:float"===(null!=a?a.tag:void 0)},this.isScalar=function(a){return"tag:yaml.org,2002:null"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:bool"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:int"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:float"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:binary"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:timestamp"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:str"===(null!=a?a.tag:void 0)},this.isCollection=function(a){return"tag:yaml.org,2002:omap"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:pairs"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:set"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:seq"===(null!=a?a.tag:void 0)||"tag:yaml.org,2002:map"===(null!=a?a.tag:void 0)},this.NON_PRINTABLE=/[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]/}).call(this)},{}],21:[function(a,b,c){(function(){var b,d,e,f,g,h,i,j,k={}.hasOwnProperty,l=function(a,b){function c(){this.constructor=a}for(var d in b)k.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},m=function(a,b){return function(){return a.apply(b,arguments)}},n=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};h=a("url"),g=a("uritemplate"),b=a("./errors").MarkedYAMLError,e=a("./nodes"),f=a("./traits"),i=a("./util"),d=a("jju/lib/parse"),this.ValidationError=function(a){function b(){return j=b.__super__.constructor.apply(this,arguments)}return l(b,a),b}(b),this.ValidationErrors=function(a){function b(a){this.validation_errors=a}return l(b,a),b.prototype.get_validation_errors=function(){return this.validation_errors},b}(b),this.Validator=function(){function a(){this.get_properties=m(this.get_properties,this),this.get_list_values=m(this.get_list_values,this),this.validations=[this.validate_root,this.validate_root_properties,this.validate_base_uri_parameters,this.valid_absolute_uris]}return a.prototype.validate_document=function(a){var b,c,d,e;for(e=this.validations,c=0,d=e.length;d>c;c++)b=e[c],b.call(this,a);return!0},a.prototype.validate_security_schemes=function(a){var b,d,e,f,g,h;if(!i.isSequence(a))throw new c.ValidationError("while validating securitySchemes",null,"invalid security schemes property, it must be an array",a.start_mark);for(g=a.value,h=[],e=0,f=g.length;f>e;e++){if(d=g[e],!i.isMapping(d))throw new c.ValidationError("while validating securitySchemes",null,"invalid security scheme property, it must be a map",d.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],!i.isMapping(b[1]))throw new c.ValidationError("while validating securitySchemes",null,"invalid security scheme property, it must be a map",b[0].start_mark);g.push(this.validate_security_scheme(b[1]))}return g}.call(this))}return h},a.prototype.trackRepeatedProperties=function(a,b,d,e,f){if(null==e&&(e="RAML"),null==f&&(f="a property with the same name already exists"),b in a)throw new c.ValidationError("while validating "+e,null,""+f+": '"+b+"'",d.start_mark);return a[b]=d},a.prototype.validate_security_scheme=function(a){var b,d,e,f,g,h,j;for(f=null,e=null,d={},j=a.value,g=0,h=j.length;h>g;g++)switch(b=j[g],this.trackRepeatedProperties(d,b[0].value,b[0],"while validating security scheme","property already used in security scheme"),b[0].value){case"description":if(!i.isScalar(b[1]))throw new c.ValidationError("while validating security scheme",null,"schemes description must be a string",b[1].start_mark);break;case"type":if(f=b[1].value,!i.isString(b[1])||!f.match(/^(OAuth 1.0|OAuth 2.0|Basic Authentication|Digest Authentication|x-.+)$/))throw new c.ValidationError("while validating security scheme",null,'schemes type must be any of: "OAuth 1.0", "OAuth 2.0", "Basic Authentication", "Digest Authentication", "x-{.+}"',b[1].start_mark);break;case"describedBy":this.validate_method(b,!0,"security scheme");break;case"settings":if(e=b,!i.isNullableMapping(b[1]))throw new c.ValidationError("while validating security scheme",null,"schemes settings must be a map",b[1].start_mark);break;default:throw new c.ValidationError("while validating security scheme",null,"property: '"+b[0].value+"' is invalid in a security scheme",b[0].start_mark)}if(!f)throw new c.ValidationError("while validating security scheme",null,'schemes type must be any of: "OAuth 1.0", "OAuth 2.0", "Basic Authentication", "Digest Authentication", "x-{.+}"',a.start_mark);if("OAuth 2.0"===f){if(!e)throw new c.ValidationError("while validating security scheme",null,"for OAuth 2.0 settings must be a map",a.start_mark);return this.validate_oauth2_settings(e)}if("OAuth 1.0"===f){if(!e)throw new c.ValidationError("while validating security scheme",null,"for OAuth 1.0 settings must be a map",a.start_mark);return this.validate_oauth1_settings(e)}},a.prototype.validate_oauth2_settings=function(a){var b,d,e,f,g,h,j,k,l,m;for(e={},k=a[1].value,f=0,h=k.length;h>f;f++)switch(b=k[f],this.trackRepeatedProperties(e,b[0].value,b[0],"while validating security scheme","setting with the same name already exists"),b[0].value){case"authorizationUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"authorizationUri must be a URL",b[0].start_mark);break;case"accessTokenUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"accessTokenUri must be a URL",b[0].start_mark)}for(l=["accessTokenUri","authorizationUri"],m=[],g=0,j=l.length;j>g;g++){if(d=l[g],!(d in e))throw new c.ValidationError("while validating security scheme",null,"OAuth 2.0 settings must have "+d+" property",a[0].start_mark);m.push(void 0)}return m},a.prototype.validate_oauth1_settings=function(a){var b,d,e,f,g,h,j,k,l,m;for(e={},k=a[1].value,f=0,h=k.length;h>f;f++)switch(b=k[f],this.trackRepeatedProperties(e,b[0].value,b[0],"while validating security scheme","setting with the same name already exists"),b[0].value){case"requestTokenUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"requestTokenUri must be a URL",b[0].start_mark);break;case"authorizationUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"authorizationUri must be a URL",b[0].start_mark);break;case"tokenCredentialsUri":if(!i.isString(b[1]))throw new c.ValidationError("while validating security scheme",null,"tokenCredentialsUri must be a URL",b[0].start_mark)}for(l=["requestTokenUri","authorizationUri","tokenCredentialsUri"],m=[],g=0,j=l.length;j>g;g++){if(d=l[g],!(d in e))throw new c.ValidationError("while validating security scheme",null,"OAuth 1.0 settings must have "+d+" property",a[0].start_mark);m.push(void 0)}return m},a.prototype.validate_root_schemas=function(a){var b,d,e,f;if(!i.isSequence(a))throw new c.ValidationError("while validating schemas",null,"schemas property must be an array",a.start_mark);d=this.get_all_schemas(),f=[];for(e in d){if(b=d[e],!b[1].tag||!i.isString(b[1]))throw new c.ValidationError("while validating schemas",null,"schema "+e+" must be a string",b[0].start_mark);f.push(this.validateSchema(b[1]))}return f},a.prototype.validate_root=function(a){if(!a&&!i.isNull(a))throw new c.ValidationError("while validating root",null,"empty document",null!=a?a.start_mark:void 0);if(!i.isMapping(a))throw new c.ValidationError("while validating root",null,"document must be a map",a.start_mark)},a.prototype.validate_base_uri_parameters=function(){if(this.baseUriParameters){if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"uri parameters defined when there is no baseUri",this.baseUriParameters.start_mark);if(!i.isNullableMapping(this.baseUriParameters))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",this.baseUriParameters.start_mark);return this.validate_uri_parameters(this.baseUri,this.baseUriParameters,!1,!1,["version"])}},a.prototype.validate_uri_parameters=function(a,b,d,e,f){var h,j,k,l,m,o,p,q,r,s,t,u;null==f&&(f=[]);try{l=g.parse(a)}catch(v){throw h=v,new c.ValidationError("while validating uri parameters",null,null!=h&&null!=(r=h.options)?r.message:void 0,b.start_mark)}if(j=[],null!=(s=l.expressions)&&s.forEach(function(a){var b;return null!=(b=a.varspecs)?b.forEach(function(a){return j.push(a.varname)}):void 0}),o={},"object"==typeof b.value){for(t=b.value,u=[],p=0,q=t.length;q>p;p++){if(m=t[p],k=this.canonicalizeParameterName(m[0].value,d),this.trackRepeatedProperties(o,k,b,"while validating URI parameters","URI parameter with the same name already exists"),n.call(f,k)>=0)throw new c.ValidationError("while validating baseUri",null,m[0].value+" parameter not allowed here",m[0].start_mark);if(!i.isNullableMapping(m[1],d)&&!i.isNullableSequence(m[1],d))throw new c.ValidationError("while validating baseUri",null,"URI parameter must be a map",m[0].start_mark);if(i.isNull(m[1])||this.valid_common_parameter_properties(m[1],d),!(e||this.isParameterKey(m)||n.call(j,k)>=0))throw new c.ValidationError("while validating baseUri",null,m[0].value+" uri parameter unused",m[0].start_mark);u.push(void 0)}return u}},a.prototype.validate_types=function(a){var b,d,e,f,g,h;if(e=a.value,!i.isSequence(a))throw new c.ValidationError("while validating resource types",null,"invalid resourceTypes definition, it must be an array",a.start_mark);for(h=[],f=0,g=e.length;g>f;f++){if(d=e[f],!i.isMapping(d))throw new c.ValidationError("while validating resource types",null,"invalid resourceType definition, it must be a map",d.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],this.isParameterKey(b))throw new c.ValidationError("while validating resource types",null,"parameter key cannot be used as a resource type name",b[0].start_mark);if(!i.isMapping(b[1]))throw new c.ValidationError("while validating resource types",null,"invalid resourceType definition, it must be a map",b[1].start_mark);g.push(this.validate_resource(b,!0,"resource type"))}return g}.call(this))}return h},a.prototype.validate_traits=function(a){var b,d,e,g,h;if(f=a.value,!Array.isArray(f))throw new c.ValidationError("while validating traits",null,"invalid traits definition, it must be an array",a.start_mark);for(h=[],e=0,g=f.length;g>e;e++){if(d=f[e],!Array.isArray(d.value))throw new c.ValidationError("while validating traits",null,"invalid traits definition, it must be an array",a.start_mark);h.push(function(){var a,e,f,g;for(f=d.value,g=[],a=0,e=f.length;e>a;a++){if(b=f[a],this.isParameterKey(b))throw new c.ValidationError("while validating traits",null,"parameter key cannot be used as a trait name",b[0].start_mark);if(!i.isMapping(b[1]))throw new c.ValidationError("while validating traits",null,"invalid trait definition, it must be a map",b[1].start_mark);g.push(this.valid_traits_properties(b))}return g}.call(this))}return h},a.prototype.valid_traits_properties=function(a){var b;if(a[1].value&&i.isMapping(a[1])){if(b=a[1].value.filter(function(a){return"is"===a[0].value||"type"===a[0].value}),b.length>0)throw new c.ValidationError("while validating trait properties",null,"property: '"+b[0][0].value+"' is invalid in a trait",b[0][0].start_mark);return this.validate_method(a,!0,"trait")}},a.prototype.canonicalizeParameterName=function(a,b){var c;return c=this.canonicalizePropertyName(a,b),"+"===c[0]?c.slice(1):c},a.prototype.canonicalizePropertyName=function(a,b){return b&&"?"===a.slice(-1)?a.slice(0,-1):a},a.prototype.valid_common_parameter_properties=function(a,b){var d,e,f,g,h;if(a.value){if(i.isSequence(a)){if(0===a.value.length)throw new c.ValidationError("while validating parameter properties",null,"named parameter needs at least one type",a.start_mark);if(!(a.value.length>1))throw new c.ValidationError("while validating parameter properties",null,"single type for variably typed parameter",a.start_mark);for(g=a.value,h=[],e=0,f=g.length;f>e;e++)d=g[e],h.push(this.validate_named_parameter(d,b));return h}return this.validate_named_parameter(a,b)}},a.prototype.validate_named_parameter=function(a,b){var d,e,f,g,h,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z;for(h={},j="string",w=a.value,q=0,t=w.length;t>q;q++)if(f=w[q],k=f[0].value,l=f[1].value,this.trackRepeatedProperties(h,this.canonicalizePropertyName(f[0].value,!0),f[0],"while validating parameter properties","parameter property already used"),d=["true","false"],!b||!this.isParameterKey(f)&&!this.isParameterValue(f)){switch(e=this.canonicalizePropertyName(k,b),o=!0,k){case"displayName":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of displayName must be a scalar",f[1].start_mark);break;case"pattern":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of pattern must be a scalar",f[1].start_mark);break;case"default":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of default must be a scalar",f[1].start_mark);break;case"description":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of description must be a scalar",f[1].start_mark);break;case"example":if(!i.isScalar(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of example must be a scalar",f[1].start_mark);break;case"minLength":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of minLength must be a number",f[1].start_mark);break;case"maxLength":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of maxLength must be a number",f[1].start_mark);break;case"minimum":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of minimum must be a number",f[1].start_mark);break;case"maximum":if(isNaN(l))throw new c.ValidationError("while validating parameter properties",null,"the value of maximum must be a number",f[1].start_mark);break;case"type":if(j=l,p=["string","number","integer","date","boolean","file"],n.call(p,l)<0)throw new c.ValidationError("while validating parameter properties",null,"type can be either of: string, number, integer, file, date or boolean ",f[1].start_mark);break;case"required":if(n.call(d,l)<0)throw new c.ValidationError("while validating parameter properties",null,"required can be any either true or false",f[1].start_mark);break;case"repeat":if(n.call(d,l)<0)throw new c.ValidationError("while validating parameter properties",null,"repeat can be any either true or false",f[1].start_mark);break;default:o=!1}switch(e){case"enum":if(!i.isNullableSequence(f[1]))throw new c.ValidationError("while validating parameter properties",null,"the value of enum must be an array",f[1].start_mark);if(!f[1].value.length)throw new c.ValidationError("while validating parameter properties",null,"enum is empty",f[1].start_mark);if(g=this.get_list_values(f[1].value),this.hasDuplicates(g))throw new c.ValidationError("while validating parameter properties",null,"enum contains duplicated values",f[1].start_mark);break;default:if(!o)throw new c.ValidationError("while validating parameter properties",null,"unknown property "+k,f[0].start_mark)}}if("string"!==j)for(x=["enum","pattern","minLength","maxLength"],r=0,u=x.length;u>r;r++)if(m=x[r],m in h)throw new c.ValidationError("while validating parameter properties",null,"property "+m+" can only be used if type is 'string'",h[m].start_mark);if("number"!==j&&"integer"!==j){for(y=["minimum","maximum"],z=[],s=0,v=y.length;v>s;s++){if(m=y[s],m in h)throw new c.ValidationError("while validating parameter properties",null,"property "+m+" can only be used if type is 'number' or 'integer'",h[m].start_mark);z.push(void 0)}return z}},a.prototype.get_list_values=function(a){return a.map(function(a){return a.value})},a.prototype.validate_root_properties=function(a){var b,d,e,f,g,h;if(b=!1,e={},null!=a?a.value:void 0)for(h=a.value,f=0,g=h.length;g>f;f++)switch(d=h[f],d[0].value.match(/^\//)?this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating root properties","resource already declared"):this.trackRepeatedProperties(e,d[0].value,d[0],"while validating root properties","root property already used"),d[0].value){case"title":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"title must be a string",d[0].start_mark);break;case"baseUri":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"baseUri must be a string",d[0].start_mark);this.baseUri=d[1].value,b=this.validate_base_uri(d[1]);break;case"securitySchemes":this.validate_security_schemes(d[1]);break;case"schemas":this.validate_root_schemas(d[1]);break;case"version":if(!i.isScalar(d[1]))throw new c.ValidationError("while validating root properties",null,"version must be a string",d[0].start_mark);i.isNull(d[1])||(d[1].tag="tag:yaml.org,2002:str");break;case"traits":this.validate_traits(d[1]);break;case"documentation":if(!i.isSequence(d[1]))throw new c.ValidationError("while validating root properties",null,"documentation must be an array",d[0].start_mark);this.validate_documentation(d[1]);break;case"mediaType":if(!i.isString(d[1]))throw new c.ValidationError("while validating root properties",null,"mediaType must be a scalar",d[0].start_mark);break;case"baseUriParameters":this.baseUriParameters=d[1],i.isNoop(d[1]);break;case"resourceTypes":this.validate_types(d[1]);break;case"securedBy":this.validate_secured_by(d);break;case"protocols":this.validate_protocols_property(d);break;default:if(!d[0].value.match(/^\//))throw new c.ValidationError("while validating root properties",null,"unknown property "+d[0].value,d[0].start_mark);this.validate_resource(d)}if(!("title"in e))throw new c.ValidationError("while validating root properties",null,"missing title",a.start_mark);if(b&&!("version"in e))throw new c.ValidationError("while validating version",null,"missing version",a.start_mark)},a.prototype.validate_documentation=function(a){var b,d,e,f,g;if(!a.value.length)throw new c.ValidationError("while validating documentation section",null,"there must be at least one document in the documentation section",a.start_mark);for(f=a.value,g=[],d=0,e=f.length;e>d;d++)b=f[d],g.push(this.validate_doc_section(b));return g},a.prototype.validate_doc_section=function(a){var b,d,e,f,g;if(!i.isMapping(a))throw new c.ValidationError("while validating documentation section",null,"each documentation section must be a map",a.start_mark);for(b={},g=a.value,e=0,f=g.length;f>e;e++)switch(d=g[e],this.trackRepeatedProperties(b,d[0].value,d[0],"while validating documentation section","property already used"),d[0].value){case"title":if(!i.isScalar(d[1])||i.isNull(d[1]))throw new c.ValidationError("while validating documentation section",null,"title must be a string",d[0].start_mark);break;case"content":if(!i.isScalar(d[1])||i.isNull(d[1]))throw new c.ValidationError("while validating documentation section",null,"content must be a string",d[0].start_mark);break;default:throw new c.ValidationError("while validating root properties",null,"unknown property "+d[0].value,d[0].start_mark)}if(!("content"in b))throw new c.ValidationError("while validating documentation section",null,"a documentation entry must have content property",a.start_mark);if(!("title"in b))throw new c.ValidationError("while validating documentation section",null,"a documentation entry must have title property",a.start_mark)},a.prototype.child_resources=function(a){return a&&i.isMapping(a)?a.value.filter(function(a){return a[0].value.match(/^\//)}):[]},a.prototype.validate_resource=function(a,b,d){var e,f,h,j,k,l,m,n,o,p,q,r;if(null==b&&(b=!1),null==d&&(d="resource"),!a[1]||!i.isNullableMapping(a[1]))throw new c.ValidationError("while validating resources",null,"resource is not a map",a[1].start_mark);if(a[0].value)try{l=g.parse(a[0].value)}catch(s){throw f=s,new c.ValidationError("while validating resource",null,"Resource name is invalid: "+(null!=f&&null!=(p=f.options)?p.message:void 0),a[0].start_mark)}if(!i.isNull(a[1])&&a[1].value){for(k={},q=a[1].value,r=[],n=0,o=q.length;o>n;n++)if(j=q[n],j[0].value.match(/^\//)?this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","resource already declared"):this.isHttpMethod(j[0].value,b)?this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","method already declared"):this.trackRepeatedProperties(k,this.canonicalizePropertyName(j[0].value,!0),j[0],"while validating resource","property already used"),this.validate_common_properties(j,b))r.push(void 0);else if(j[0].value.match(/^\//)){if(b)throw new c.ValidationError("while validating trait properties",null,"resource type cannot define child resources",j[0].start_mark);r.push(this.validate_resource(j,b))}else if(this.isHttpMethod(j[0].value,b))r.push(this.validate_method(j,b,"method"));else{switch(h=j[0].value,e=this.canonicalizePropertyName(h,b),m=!0,e){case"uriParameters":if(!i.isNullableMapping(j[1]))throw new c.ValidationError("while validating uri parameters",null,"uri parameters must be a map",j[0].start_mark);this.validate_uri_parameters(a[0].value,j[1],b,b);break;case"baseUriParameters":if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"base uri parameters defined when there is no baseUri",j[0].start_mark);if(!i.isNullableMapping(j[1]))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",j[0].start_mark);this.validate_uri_parameters(this.baseUri,j[1],b);break;default:m=!1}switch(h){case"type":r.push(this.validate_type_property(j,b));break;case"usage":if(!b)throw new c.ValidationError("while validating resources",null,"property: '"+j[0].value+"' is invalid in a resource",j[0].start_mark);r.push(void 0);break;case"securedBy":r.push(this.validate_secured_by(j));break;default:if(!m)throw new c.ValidationError("while validating resources",null,"property: '"+j[0].value+("' is invalid in a "+d),j[0].start_mark);r.push(void 0)}}return r}},a.prototype.validate_secured_by=function(a){var b,d,e,f,g,h,j;if(!i.isSequence(a[1]))throw new c.ValidationError("while validating securityScheme",null,"property 'securedBy' must be an array",a[0].start_mark);if(d=this.get_list_values(a[1].value),this.hasDuplicates(d))throw new c.ValidationError("while validating securityScheme consumption",null,"securitySchemes can only be referenced once in a securedBy property",a[0].start_mark);for(h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(b=h[f],i.isSequence(b))throw new c.ValidationError("while validating securityScheme consumption",null,"securityScheme reference cannot be an array",b.start_mark);if(i.isNull(b))j.push(void 0);else{if(e=this.key_or_value(b),!this.get_security_scheme(e))throw new c.ValidationError("while validating securityScheme consumption",null,"there is no securityScheme named "+e,b.start_mark);j.push(void 0)}}return j},a.prototype.validate_protocols_property=function(a){var b,d,e,f,g,h;if(!i.isSequence(a[1]))throw new c.ValidationError("while validating protocols",null,"property must be an array",a[0].start_mark);for(f=a[1].value,h=[],d=0,e=f.length;e>d;d++){if(b=f[d],!i.isString(b))throw new c.ValidationError("while validating protocols",null,"value must be a string",b.start_mark);if("HTTP"!==(g=b.value)&&"HTTPS"!==g)throw new c.ValidationError("while validating protocols",null,"only HTTP and HTTPS values are allowed",b.start_mark);h.push(void 0)}return h},a.prototype.validate_type_property=function(a){var b,d,e,f,g,h;if(!i.isMapping(a[1])&&!i.isString(a[1]))throw new c.ValidationError("while validating resource types",null,"property 'type' must be a string or a map",a[0].start_mark);if(i.isMapping(a[1])&&a[1].value.length>1)throw new c.ValidationError("while validating resource types",null,"a resource or resourceType can inherit from a single resourceType",a[0].start_mark);if(d=this.key_or_value(a[1]),!(null!=d?d.trim():void 0))throw new c.ValidationError("while validating resource type consumption",null,"resource type name must be provided",a[1].start_mark);if(!this.isParameterKeyValue(d)&&!this.get_type(d))throw new c.ValidationError("while validating resource type consumption",null,"there is no resource type named "+d,a[1].start_mark); +if(i.isMapping(a[1])){for(g=a[1].value,h=[],e=0,f=g.length;f>e;e++){if(b=g[e],!i.isNull(b[1])&&!i.isMapping(b[1]))throw new c.ValidationError("while validating resource consumption",null,"resource type parameters must be in a map",b[1].start_mark);h.push(void 0)}return h}},a.prototype.validate_method=function(a,b,d){var e,f,g,h,j,k,l,m,n;if(null==d&&(d="method"),!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating methods",null,"method must be a map",a[0].start_mark);for(g={},m=a[1].value,n=[],k=0,l=m.length;l>k;k++)if(h=m[k],this.trackRepeatedProperties(g,this.canonicalizePropertyName(h[0].value,!0),h[0],"while validating method","property already used"),!this.validate_common_properties(h,b,d)){switch(f=h[0].value,e=this.canonicalizePropertyName(f,b),j=!0,e){case"headers":this.validate_headers(h,b);break;case"queryParameters":this.validate_query_params(h,b);break;case"body":this.validate_body(h,b,null,!1);break;case"responses":this.validate_responses(h,b);break;case"baseUriParameters":if(!this.baseUri)throw new c.ValidationError("while validating uri parameters",null,"base uri parameters defined when there is no baseUri",h[0].start_mark);if(!i.isNullableMapping(h[1]))throw new c.ValidationError("while validating uri parameters",null,"base uri parameters must be a map",h[0].start_mark);this.validate_uri_parameters(this.baseUri,h[1],b);break;case"protocols":this.validate_protocols_property(h);break;default:j=!1}switch(f){case"securedBy":n.push(this.validate_secured_by(h));break;case"usage":if(!b||"trait"!==d)throw new c.ValidationError("while validating resources",null,"property: 'usage' is invalid in a "+d,h[0].start_mark);n.push(void 0);break;default:if(!j)throw new c.ValidationError("while validating resources",null,"property: '"+h[0].value+"' is invalid in a "+d,h[0].start_mark);n.push(void 0)}}return n}},a.prototype.validate_responses=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating responses",null,"property: 'responses' must be a map",a[0].start_mark);for(e={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(d=h[f],!i.isNullableMapping(d[1]))throw new c.ValidationError("while validating responses",null,"each response must be a map",d[1].start_mark);this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating responses","response code already used"),j.push(this.validate_response(d,b))}return j}},a.prototype.validate_query_params=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating query parameters",null,"property: 'queryParameters' must be a map",a[0].start_mark);for(e={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(d=h[f],!i.isNullableMapping(d[1])&&!i.isNullableSequence(d[1]))throw new c.ValidationError("while validating query parameters",null,"each query parameter must be a map",d[1].start_mark);this.trackRepeatedProperties(e,this.canonicalizePropertyName(d[0].value,!0),d[0],"while validating query parameter","parameter name already used"),j.push(this.valid_common_parameter_properties(d[1],b))}return j}},a.prototype.validate_form_params=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating query parameters",null,"property: 'formParameters' must be a map",a[0].start_mark);for(d={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(e=h[f],!i.isNullableMapping(e[1])&&!i.isNullableSequence(e[1]))throw new c.ValidationError("while validating query parameters",null,"each form parameter must be a map",e[1].start_mark);this.trackRepeatedProperties(d,this.canonicalizePropertyName(e[0].value,!0),e[0],"while validating form parameter","parameter name already used"),j.push(this.valid_common_parameter_properties(e[1],b))}return j}},a.prototype.validate_headers=function(a,b){var d,e,f,g,h,j;if(!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating headers",null,"property: 'headers' must be a map",a[0].start_mark);for(d={},h=a[1].value,j=[],f=0,g=h.length;g>f;f++){if(e=h[f],!i.isNullableMapping(e[1])&&!i.isNullableSequence(e[1]))throw new c.ValidationError("while validating query parameters",null,"each header must be a map",e[1].start_mark);this.trackRepeatedProperties(d,this.canonicalizePropertyName(e[0].value,!0),e[0],"while validating headers","header name already used"),j.push(this.valid_common_parameter_properties(e[1],b))}return j}},a.prototype.validate_response=function(a,b){var d,e,f,g,h,j,k,l,m,n,o,p;if(i.isSequence(a[0])){if(!a[0].value.length)throw new c.ValidationError("while validating responses",null,"there must be at least one response code",a[0].start_mark);for(n=a[0].value,j=0,l=n.length;l>j;j++)if(f=n[j],!this.isParameterKey(f)&&!i.isInteger(f)&&isNaN(this.canonicalizePropertyName(f,b)))throw new c.ValidationError("while validating responses",null,"each response key must be an integer",f.start_mark)}else if(!this.isParameterKey(a)&&!i.isInteger(a[0])&&isNaN(this.canonicalizePropertyName(a[0].value,b)))throw new c.ValidationError("while validating responses",null,"each response key must be an integer",a[0].start_mark);if(!i.isNullableMapping(a[1]))throw new c.ValidationError("while validating responses",null,"each response property must be a map",a[0].start_mark);if(i.isMapping(a[1])){for(g={},o=a[1].value,p=[],k=0,m=o.length;m>k;k++)if(e=o[k],d=this.canonicalizePropertyName(e[0].value,b),this.trackRepeatedProperties(g,d,e[0],"while validating responses","property already used"),h=!0,this.isParameterKey(e))p.push(void 0);else{switch(e[0].value){case"description":if(!i.isScalar(e[1]))throw new c.ValidationError("while validating responses",null,"property description must be a string",a[0].start_mark);break;default:h=!1}switch(d){case"body":p.push(this.validate_body(e,b,null,!0));break;case"headers":if(!i.isNullableMapping(e[1]))throw new c.ValidationError("while validating resources",null,"property 'headers' must be a map",e[0].start_mark);p.push(this.validate_headers(e));break;default:if(!h)throw new c.ValidationError("while validating response",null,"property: '"+e[0].value+"' is invalid in a response",e[0].start_mark);p.push(void 0)}}return p}},a.prototype.isHttpMethod=function(a,b){var c;return null==b&&(b=!1),a?(a=this.canonicalizePropertyName(a,b),"options"===(c=a.toLowerCase())||"get"===c||"head"===c||"post"===c||"put"===c||"delete"===c||"trace"===c||"connect"===c||"patch"===c):!1},a.prototype.isParameterValue=function(a){return this.isParameterKey(a,!1)},a.prototype.isParameterKey=function(a,b){var d;if(null==b&&(b=!0),d=b?0:1,!b&&!i.isScalar(a[1]))return!1;if(this.isParameterKeyValue(a[d].value))return!0;if(a[d].value.match(/<<\s*([^\|\s>]+)\s*\|.*\s*>>/g))throw new c.ValidationError("while validating parameter",null,"unknown function applied to property name",a[0].start_mark);return!1},a.prototype.isParameterKeyValue=function(a){return a.match(/<<\s*([^\|\s>]+)\s*>>/g)||a.match(/<<\s*([^\|\s>]+)\s*(\|\s*\!\s*(singularize|pluralize))?\s*>>/g)?!0:!1},a.prototype.validate_body=function(a,b,d,e){var f,g,h,j,k,l,m,o,p,q;if(null==d&&(d=null),!i.isNull(a[1])){if(!i.isMapping(a[1]))throw new c.ValidationError("while validating body",null,"property: body specification must be a map",a[0].start_mark);for(j=["implicit","forcedImplicit"],f={},q=a[1].value,o=0,p=q.length;p>o;o++)if(g=q[o],this.trackRepeatedProperties(f,this.canonicalizePropertyName(g[0].value,!0),g[0],"while validating body","property already used"),this.isParameterKey(g)){if(!b)throw new c.ValidationError("while validating body",null,"property '"+g[0].value+"' is invalid in a resource",g[0].start_mark)}else if(g[0].value.match(/^[^\/]+\/[^\/]+$/)){if(d&&"explicit"!==d)throw new c.ValidationError("while validating body",null,"not compatible with implicit default Media Type",g[0].start_mark);d="explicit",this.validate_body(g,b,"forcedImplicit",e)}else{switch(k=g[0].value,h=this.canonicalizePropertyName(k,b),m=!0,h){case"formParameters":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);null==d&&(d="implicit"),this.validate_form_params(g,b);break;default:m=!1}switch(k){case"description":if(!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"body description must be a string",g[0].start_mark);break;case"example":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);if(null==d&&(d="implicit"),!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"example must be a string",g[0].start_mark);break;case"schema":if(d&&n.call(j,d)<0)throw new c.ValidationError("while validating body",null,"not compatible with explicit Media Type",g[0].start_mark);if(null==d&&(d="implicit"),!i.isScalar(g[1]))throw new c.ValidationError("while validating body",null,"schema must be a string",g[0].start_mark);this.validateSchema(g[1]);break;default:if(!m)throw new c.ValidationError("while validating body",null,"property: '"+g[0].value+"' is invalid in a body",g[0].start_mark)}}if("formParameters"in f){if(l=f.formParameters.start_mark,e)throw new c.ValidationError("while validating body",null,"formParameters cannot be used to describe response bodies",l);if("schema"in f||"example"in f)throw new c.ValidationError("while validating body",null,"formParameters cannot be used together with the example or schema properties",l)}if("implicit"===d&&!this.get_media_type())throw new c.ValidationError("while validating body",null,"body tries to use default Media Type, but mediaType is null",a[0].start_mark)}},a.prototype.validateSchema=function(a){var b,e,f;if(this.isXmlSchema(a.value))return void 0;if(this.isJsonSchema(a.value))try{return f=JSON.parse(a.value)}catch(g){b=g;try{f=d.parse(a.value)}catch(g){throw b=g,e=this.create_mark(a.start_mark.line+b.row,0),a.end_mark.line===e.line&&0===a.end_mark.column&&e.line--,new c.ValidationError("while validating body",null,"schema is not valid JSON error: '"+b.message.split("\n")[0]+"'",e)}throw new c.ValidationError("while validating body",null,"schema is not valid JSON error: '"+b+"'",a.start_mark)}},a.prototype.isJsonSchema=function(a){return null!=a?a.match(/^\s*\{/):void 0},a.prototype.isXmlSchema=function(a){return null!=a?a.match(/^\s*(<\?xml[^>]+>)?[\s\n]*f;f++)e=h[f],this.validate_trait_use(e);return!0}return!1},a.prototype.validate_trait_use=function(a){var b,d,e,f,g,h,j;if(!i.isScalar(a)&&!i.isMapping(a))throw new c.ValidationError("while validating trait consumption",null,"trait must be a string or a map",a.start_mark);if(d=this.key_or_value(a),!(null!=d?d.trim():void 0))throw new c.ValidationError("while validating trait consumption",null,"trait name must be provided",a.start_mark);if(!this.isParameterKeyValue(d)&&!this.get_trait(d))throw new c.ValidationError("while validating trait consumption",null,"there is no trait named "+d,a.start_mark);if(!i.isScalar(a)){if(e=a.value[0][1],!i.isNull(e)&&!i.isMapping(e))throw new c.ValidationError("while validating trait consumption",null,"trait must be a map",e.start_mark);if(!i.isNull(e)){for(h=e.value,j=[],f=0,g=h.length;g>f;f++){if(b=h[f],!i.isScalar(b[1]))throw new c.ValidationError("while validating trait consumption",null,"parameter value must be a scalar",b[1].start_mark);j.push(void 0)}return j}}},a.prototype.child_methods=function(a){var b=this;return a&&i.isMapping(a)?a.value.filter(function(a){return b.isHttpMethod(a[0].value)}):[]},a.prototype.has_property=function(a,b){return a&&i.isMapping(a)?a.value.some(function(a){return a[0].value&&"object"!=typeof a[0].value&&a[0].value===b}):!1},a.prototype.property_value=function(a,b){var c;return c=a.value.filter(function(a){return"object"!=typeof a[0].value&&a[0].value===b}),c.length?c[0][1].value:void 0},a.prototype.get_property_pair=function(a,b){var c;return a&&i.isMapping(a)&&(c=a.value.filter(function(a){return i.isString(a[0])&&a[0].value===b}),c.length>0&&c[0].length>0)?c[0]:[]},a.prototype.get_property=function(a,b){var c;return c=this.get_property_pair(a,b),null!=c?c[1]:[]},a.prototype.get_properties=function(a,b){var c,d,e,f,g;if(d=[],a&&i.isMapping(a))for(g=a.value,e=0,f=g.length;f>e;e++)c=g[e],i.isString(c[0])&&c[0].value===b?d.push(c):d=d.concat(this.get_properties(c[1],b));return d},a.prototype.valid_absolute_uris=function(a){var b,d;if(d=this.get_absolute_uris(a),b=this.hasDuplicatesUris(d))throw new c.ValidationError("while validating trait consumption",null,"two resources share same URI "+b.uri,b.mark)},a.prototype.get_absolute_uris=function(a,b){var d,e,f,g,h,j;if(f=[],!i.isNullableMapping(a))throw new c.ValidationError("while validating resources",null,"resource is not a map",a.start_mark);for(e=this.child_resources(a),h=0,j=e.length;j>h;h++)d=e[h],g=null!=b?b+d[0].value:d[0].value,f.push({uri:g,mark:d[0].start_mark}),f=f.concat(this.get_absolute_uris(d[1],g));return f},a.prototype.key_or_value=function(a){var b,c,d,f;return a instanceof e.ScalarNode?a.value:a instanceof e.MappingNode&&(b=null!=a&&null!=(c=a.value)&&null!=(d=c[0])&&null!=(f=d[0])?f.value:void 0)?b:null},a.prototype.value_or_undefined=function(a){return a instanceof e.MappingNode?a.value:void 0},a.prototype.validate_base_uri=function(a){var b,d,e,f,i,j,k;if(b=null!=(j=a.value)?j.trim():void 0,!b)throw new c.ValidationError("while validating baseUri",null,"baseUri must have a value",a.start_mark);if(f=(h.parse(b).protocol||"http:").slice(0,-1).toUpperCase(),"HTTP"!==f&&"HTTPS"!==f)throw new c.ValidationError("while validating baseUri",null,"baseUri protocol must be either HTTP or HTTPS",a.start_mark);try{i=g.parse(b)}catch(l){throw d=l,new c.ValidationError("while validating baseUri",null,null!=d&&null!=(k=d.options)?k.message:void 0,a.start_mark)}return e=i.expressions.filter(function(a){return"templateText"in a}).map(function(a){return a.templateText}),n.call(e,"version")>=0?!0:void 0},a.prototype.get_validation_errors=function(){return this.validation_errors},a.prototype.is_valid=function(){return 0===this.validation_errors.length},a.prototype.hasDuplicatesUris=function(a){var b,c,d,e;for(c={},d=0,e=a.length;e>d;d++){if(b=a[d],b.uri in c)return b;c[b.uri]=b}return!1},a.prototype.hasDuplicates=function(a){var b,c,d,e;for(c={},d=0,e=a.length;e>d;d++){if(b=a[d],b in c)return!0;c[b]=!0}return!1},a}()}).call(this)},{"./errors":3,"./nodes":7,"./traits":18,"./util":20,"jju/lib/parse":34,uritemplate:38,url:32}],22:[function(a,b,c){},{}],23:[function(a,b,c){arguments[4][22][0].apply(c,arguments)},{dup:22}],24:[function(a,b,c){(function(b){"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(c){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,0>b?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;c++)a[c]=0;return a}function h(a,b,c){("string"!=typeof c||""===c)&&(c="utf8");var d=0|s(b,c);return a=p(a,d),a.write(b,c),a}function i(a,b){if(f.isBuffer(b))return j(a,b);if(Z(b))return k(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return l(a,b);if(b instanceof ArrayBuffer)return m(a,b)}return b.length?n(a,b):o(a,b)}function j(a,b){var c=0|q(b.length);return a=p(a,c),b.copy(a,0,0,c),a}function k(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function l(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function m(a,b){return f.TYPED_ARRAY_SUPPORT?(b.byteLength,a=f._augment(new Uint8Array(b))):a=l(a,new Uint8Array(b)),a}function n(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function o(a,b){var c,d=0;"Buffer"===b.type&&Z(b.data)&&(c=b.data,d=0|q(c.length)),a=p(a,d);for(var e=0;d>e;e+=1)a[e]=255&c[e];return a}function p(a,b){f.TYPED_ARRAY_SUPPORT?(a=f._augment(new Uint8Array(b)),a.__proto__=f.prototype):(a.length=b,a._isBuffer=!0);var c=0!==b&&b<=f.poolSize>>>1;return c&&(a.parent=$),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return S(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return V(a).length;default:if(d)return S(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),0>b&&(b=0),c>this.length&&(c=this.length),b>=c)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function v(a,b,c,d){return W(S(b,a.length-c),a,c,d)}function w(a,b,c,d){return W(T(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return W(V(b),a,c,d)}function z(a,b,c,d){return W(U(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?X.fromByteArray(a):X.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;c>e;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(c>=e+h){var i,j,k,l;switch(h){case 1:128>f&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(55296>l||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&1114112>l&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(_>=b)return String.fromCharCode.apply(String,a);for(var c="",d=0;b>d;)c+=String.fromCharCode.apply(String,a.slice(d,d+=_));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;e++)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;f++)e+=R(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;fa)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||g>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function J(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function K(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||f>b)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(0>c)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(ba,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function R(a){return 16>a?"0"+a.toString(16):a.toString(16)}function S(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;g++){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(1114112>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function T(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function V(a){return X.toByteArray(O(a))}function W(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var X=a("base64-js"),Y=a("ieee754"),Z=a("isarray");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var $={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);g>e&&a[e]===b[e];)++e;return e!==g&&(c=a[e],d=b[e]),d>c?-1:c>d?1:0},f.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(a,b){if(!Z(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new f(0);var c;if(void 0===b)for(b=0,c=0;c0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e2147483647?b=2147483647:-2147483648>b&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(0>b&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(f.TYPED_ARRAY_SUPPORT)d=f._augment(this.subarray(a,b));else{var e=b-a;d=new f(e,void 0);for(var g=0;e>g;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},f.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),Y.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),Y.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),Y.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),Y.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=0>a?1:0;for(this[b]=255&a;++f>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0>a?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-bc&&d>b)for(e=g-1;e>=0;e--)a[e+b]=this[e+c];else if(1e3>g||!f.TYPED_ARRAY_SUPPORT)for(e=0;g>e;e++)a[e+b]=this[e+c];else a._set(this.subarray(c,c+g),b);return g},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),b>c)throw new RangeError("end < start"); +if(c!==b&&0!==this.length){if(0>b||b>=this.length)throw new RangeError("start out of bounds");if(0>c||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;c>d;d++)this[d]=a;else{var e=S(a.toString()),f=e.length;for(d=b;c>d;d++)this[d]=e[d%f]}return this}},f.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(f.TYPED_ARRAY_SUPPORT)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;c>b;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var aa=f.prototype;f._augment=function(a){return a.constructor=f,a._isBuffer=!0,a._set=a.set,a.get=aa.get,a.set=aa.set,a.write=aa.write,a.toString=aa.toString,a.toLocaleString=aa.toString,a.toJSON=aa.toJSON,a.equals=aa.equals,a.compare=aa.compare,a.indexOf=aa.indexOf,a.copy=aa.copy,a.slice=aa.slice,a.readUIntLE=aa.readUIntLE,a.readUIntBE=aa.readUIntBE,a.readUInt8=aa.readUInt8,a.readUInt16LE=aa.readUInt16LE,a.readUInt16BE=aa.readUInt16BE,a.readUInt32LE=aa.readUInt32LE,a.readUInt32BE=aa.readUInt32BE,a.readIntLE=aa.readIntLE,a.readIntBE=aa.readIntBE,a.readInt8=aa.readInt8,a.readInt16LE=aa.readInt16LE,a.readInt16BE=aa.readInt16BE,a.readInt32LE=aa.readInt32LE,a.readInt32BE=aa.readInt32BE,a.readFloatLE=aa.readFloatLE,a.readFloatBE=aa.readFloatBE,a.readDoubleLE=aa.readDoubleLE,a.readDoubleBE=aa.readDoubleBE,a.writeUInt8=aa.writeUInt8,a.writeUIntLE=aa.writeUIntLE,a.writeUIntBE=aa.writeUIntBE,a.writeUInt16LE=aa.writeUInt16LE,a.writeUInt16BE=aa.writeUInt16BE,a.writeUInt32LE=aa.writeUInt32LE,a.writeUInt32BE=aa.writeUInt32BE,a.writeIntLE=aa.writeIntLE,a.writeIntBE=aa.writeIntBE,a.writeInt8=aa.writeInt8,a.writeInt16LE=aa.writeInt16LE,a.writeInt16BE=aa.writeInt16BE,a.writeInt32LE=aa.writeInt32LE,a.writeInt32BE=aa.writeInt32BE,a.writeFloatLE=aa.writeFloatLE,a.writeFloatBE=aa.writeFloatBE,a.writeDoubleLE=aa.writeDoubleLE,a.writeDoubleBE=aa.writeDoubleBE,a.fill=aa.fill,a.inspect=aa.inspect,a.toArrayBuffer=aa.toArrayBuffer,a};var ba=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":25,ieee754:26,isarray:27}],25:[function(a,b,c){var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===g||b===l?62:b===h||b===m?63:i>b?-1:i+10>b?b-i+26+26:k+26>b?b-k:j+26>b?b-j+26:void 0}function c(a){function c(a){j[l++]=a}var d,e,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;g>d;d+=4,e+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;g>e;e+=3)f=(a[e]<<16)+(a[e+1]<<8)+a[e+2],i+=c(f);switch(h){case 1:f=a[a.length-1],i+=b(f>>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],26:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],27:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],28:[function(b,c,d){(function(b){!function(e){function f(a){throw new RangeError(I[a])}function g(a,b){for(var c=a.length,d=[];c--;)d[c]=b(a[c]);return d}function h(a,b){var c=a.split("@"),d="";c.length>1&&(d=c[0]+"@",a=c[1]),a=a.replace(H,".");var e=a.split("."),f=g(e,b).join(".");return d+f}function i(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function j(a){return g(a,function(a){var b="";return a>65535&&(a-=65536,b+=L(a>>>10&1023|55296),a=56320|1023&a),b+=L(a)}).join("")}function k(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:x}function l(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function m(a,b,c){var d=0;for(a=c?K(a/B):a>>1,a+=K(a/b);a>J*z>>1;d+=x)a=K(a/J);return K(d+(J+1)*a/(a+A))}function n(a){var b,c,d,e,g,h,i,l,n,o,p=[],q=a.length,r=0,s=D,t=C;for(c=a.lastIndexOf(E),0>c&&(c=0),d=0;c>d;++d)a.charCodeAt(d)>=128&&f("not-basic"),p.push(a.charCodeAt(d));for(e=c>0?c+1:0;q>e;){for(g=r,h=1,i=x;e>=q&&f("invalid-input"),l=k(a.charCodeAt(e++)),(l>=x||l>K((w-r)/h))&&f("overflow"),r+=l*h,n=t>=i?y:i>=t+z?z:i-t,!(n>l);i+=x)o=x-n,h>K(w/o)&&f("overflow"),h*=o;b=p.length+1,t=m(r-g,b,0==g),K(r/b)>w-s&&f("overflow"),s+=K(r/b),r%=b,p.splice(r++,0,s)}return j(p)}function o(a){var b,c,d,e,g,h,j,k,n,o,p,q,r,s,t,u=[];for(a=i(a),q=a.length,b=D,c=0,g=C,h=0;q>h;++h)p=a[h],128>p&&u.push(L(p));for(d=e=u.length,e&&u.push(E);q>d;){for(j=w,h=0;q>h;++h)p=a[h],p>=b&&j>p&&(j=p);for(r=d+1,j-b>K((w-c)/r)&&f("overflow"),c+=(j-b)*r,b=j,h=0;q>h;++h)if(p=a[h],b>p&&++c>w&&f("overflow"),p==b){for(k=c,n=x;o=g>=n?y:n>=g+z?z:n-g,!(o>k);n+=x)t=k-o,s=x-o,u.push(L(l(o+t%s,0))),k=K(t/s);u.push(L(l(k,0))),g=m(c,r,d==e),c=0,++d}++c,++b}return u.join("")}function p(a){return h(a,function(a){return F.test(a)?n(a.slice(4).toLowerCase()):a})}function q(a){return h(a,function(a){return G.test(a)?"xn--"+o(a):a})}var r="object"==typeof d&&d&&!d.nodeType&&d,s="object"==typeof c&&c&&!c.nodeType&&c,t="object"==typeof b&&b;(t.global===t||t.window===t||t.self===t)&&(e=t);var u,v,w=2147483647,x=36,y=1,z=26,A=38,B=700,C=72,D=128,E="-",F=/^xn--/,G=/[^\x20-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=x-y,K=Math.floor,L=String.fromCharCode;if(u={version:"1.3.2",ucs2:{decode:i,encode:j},decode:n,encode:o,toASCII:q,toUnicode:p},"function"==typeof a&&"object"==typeof a.amd&&a.amd)a("punycode",function(){return u});else if(r&&s)if(c.exports==r)s.exports=u;else for(v in u)u.hasOwnProperty(v)&&(r[v]=u[v]);else e.punycode=u}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],29:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;j>k;++k){var l,m,n,o,p=a[k].replace(h,"%20"),q=p.indexOf(c);q>=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],30:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d",'"',"`"," ","\r","\n"," "],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=-1!==d&&dC)&&(A=C)}var D,E;E=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A),-1!==E&&(D=h.slice(0,E),h=h.slice(E+1),this.auth=decodeURIComponent(D)),A=-1;for(var B=0;BC)&&(A=C)}-1===A&&(A=h.length),this.host=h.slice(0,A),h=h.slice(A),this.parseHost(),this.hostname=this.hostname||"";var F="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!F)for(var G=this.hostname.split(/\./),B=0,H=G.length;H>B;B++){var I=G[B];if(I&&!I.match(t)){for(var J="",K=0,L=I.length;L>K;K++)J+=I.charCodeAt(K)>127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;H>B;B++){var S=p[B];if(-1!==h.indexOf(S)){var T=encodeURIComponent(S);T===S&&(T=escape(S)),h=h.split(S).join(T)}}var U=h.indexOf("#");-1!==U&&(this.hash=h.substr(U),h=h.slice(0,U));var V=h.indexOf("?");if(-1!==V?(this.search=h.substr(V),this.query=h.substr(V+1),b&&(this.query=y.parse(this.query)),h=h.slice(0,V)):b&&(this.search="",this.query={}),h&&(this.pathname=h),x[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",W=this.search||"";this.path=P+W}return this.href=this.format(),this},d.prototype.format=function(){var a=this.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var b=this.protocol||"",c=this.pathname||"",d=this.hash||"",e=!1,f="";this.host?e=a+this.host:this.hostname&&(e=a+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(e+=":"+this.port)),this.query&&j.isObject(this.query)&&Object.keys(this.query).length&&(f=y.stringify(this.query));var g=this.search||f&&"?"+f||"";return b&&":"!==b.substr(-1)&&(b+=":"),this.slashes||(!b||x[b])&&e!==!1?(e="//"+(e||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):e||(e=""),d&&"#"!==d.charAt(0)&&(d="#"+d),g&&"?"!==g.charAt(0)&&(g="?"+g),c=c.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),g=g.replace("#","%23"),b+e+c+g+d},d.prototype.resolve=function(a){return this.resolveObject(e(a,!1,!0)).format()},d.prototype.resolveObject=function(a){if(j.isString(a)){var b=new d;b.parse(a,!1,!0),a=b}for(var c=new d,e=Object.keys(this),f=0;f0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":33,punycode:28,querystring:31}],33:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],34:[function(a,b,c){function d(a){return a>="0"&&"9">=a||a>="A"&&"F">=a||a>="a"&&"f">=a}function e(a){return a>="0"&&"7">=a}function f(a){return a>="0"&&"9">=a}function g(a,b,c,d,e,f){var g=b+" at "+(d+1)+":"+(e+1),h=c-e-1,j="",k="",l=f?i.isLineTerminator:i.isLineTerminatorJSON;for(c-70>h&&(h=c-70);;){var m=a[++h];if(l(m)||h===a.length){c>=h&&(k+="^");break}if(j+=m,c===h?k+="^":c>h&&(k+=" "===a[h]?" ":" "),j.length>78)break}return g+"\n"+j+"\n"+k}function h(a,b){function c(b){var c=A-z;if(!b)if(x>A){var d="'"+JSON.stringify(a[A]).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";b||(b="Unexpected token "+d)}else b||(b="Unexpected end of input");var e=SyntaxError(g(a,b,A,y,c,u));throw e.row=y+1,e.column=c+1,e}function h(b){"\r"===b&&"\n"===a[A]&&A++,z=A,y++}function k(){for(;x>A;){C();var b=a[A++];return'"'===b||"'"===b&&u?D(t(b),"literal"):"{"===b?(D(void 0,"separator"),p()):"["===b?(D(void 0,"separator"),q()):"-"===b||"."===b||f(b)||u&&("+"===b||"I"===b||"N"===b)?D(r(),"literal"):"n"===b?(o("null"),D(null,"literal")):"t"===b?(o("true"),D(!0,"literal")):"f"===b?(o("false"),D(!1,"literal")):(A--,D(void 0))}}function l(){for(var b;x>A;){C();var c=a[A++];if('"'===c||"'"===c&&u)return D(t(c),"key");if("{"===c)return D(void 0,"separator"),p();if("["===c)return D(void 0,"separator"),q();if("."===c||f(c))return D(r(!0),"key");if(u&&i.isIdentifierStart(c)||"\\"===c&&"u"===a[A]){var d=A-1,b=s();return void 0===b?(A=d,D(void 0)):D(b,"key")}return A--,D(void 0)}}function m(){for(C();x>A;){var b=a[A++];if(v(b))A--,D(void 0,"whitespace"),C(),A++,h(b),D(void 0,"newline"),C();else if(w(b));else{if("/"!==b||!u||"/"!==a[A]&&"*"!==a[A]){A--;break}A--,D(void 0,"whitespace"),C(),A++,n("*"===a[A++]),D(void 0,"comment"),C()}}return D(void 0,"whitespace")}function n(b){for(;x>A;){var d=a[A++];if(v(d)){if(!b)return void A--;h(d)}else if("*"===d&&b&&"/"===a[A])return void A++}b&&c("Unclosed multiline comment")}function o(b){for(var d=A,e=b.length,f=1;e>f;f++)(A>=x||b[f]!=a[A])&&(A=d-1,c()),A++}function p(){for(var d=b.null_prototype?Object.create(null):{},e={},f=!1;x>A;){m();var g=l();m(),C();var h=a[A++];if(D(void 0,"separator"),"}"===h&&void 0===g)return!u&&f&&(A--,c("Trailing comma in object")),d;if(":"===h&&void 0!==g){m(),B.push(g);var i=k();B.pop(),void 0===i&&c("No value found for key "+g),"string"!=typeof g&&(u&&"number"==typeof g||c("Wrong key type: "+g)),(g in e||null!=e[g])&&"replace"!==b.reserved_keys?"throw"===b.reserved_keys&&c("Reserved key: "+g):("function"==typeof b.reviver&&(i=b.reviver.call(null,g,i)),void 0!==i&&(f=!0,Object.defineProperty(d,g,{value:i,enumerable:!0,configurable:!0,writable:!0}))),m(),C();var h=a[A++];if(D(void 0,"separator"),","===h)continue;if("}"===h)return d;c()}else A--,c()}c()}function q(){for(var d=[];x>A;){m(),B.push(d.length);var e=k();B.pop(),m(),C();var f=a[A++];if(D(void 0,"separator"),void 0!==e&&("function"==typeof b.reviver&&(e=b.reviver.call(null,String(d.length),e)),void 0===e?(d.length++,e=!0):d.push(e)),","===f)void 0===e&&c("Elisions are not supported");else{if("]"===f)return!u&&void 0===e&&d.length&&(A--,c("Trailing comma in array")),d;A--,c()}}}function r(){A--;var b=A,g=a[A++],h=function(d){var e=a.substr(b,A-b);if(d)var f=parseInt(e.replace(/^0o?/,""),8);else var f=Number(e);if(Number.isNaN(f))A--,c('Bad numeric literal - "'+a.substr(b,A-b+1)+'"');else{if(u||e.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i))return f;A--,c('Non-json numeric literal - "'+a.substr(b,A-b+1)+'"')}};if(("-"===g||"+"===g&&u)&&(g=a[A++]),"N"===g&&u)return o("NaN"),NaN;if("I"===g&&u)return o("Infinity"),h();if(g>="1"&&"9">=g){for(;x>A&&f(a[A]);)A++;g=a[A++]}if("0"===g){g=a[A++];var i="o"===g||"O"===g||e(g),j="x"===g||"X"===g;if(u&&(i||j)){for(;x>A&&(j?d:e)(a[A]);)A++;var k=1;return"-"===a[b]?(k=-1,b++):"+"===a[b]&&b++,k*h(i)}}if("."===g){for(;x>A&&f(a[A]);)A++;g=a[A++]}if("e"===g||"E"===g){for(g=a[A++],("-"===g||"+"===g)&&A++;x>A&&f(a[A]);)A++;g=a[A++]}return A--,h()}function s(){A--;for(var b="";x>A;){var e=a[A++];if("\\"===e&&"u"===a[A]&&d(a[A+1])&&d(a[A+2])&&d(a[A+3])&&d(a[A+4])&&(e=String.fromCharCode(parseInt(a.substr(A+1,4),16)),A+=5),b.length){if(!i.isIdentifierPart(e))return A--,b;b+=e}else{if(!i.isIdentifierStart(e))return void 0;b+=e}}c()}function t(b){for(var f="";x>A;){var g=a[A++];if(g===b)return f;if("\\"===g)if(A>=x&&c(),g=a[A++],j[g]&&(u||"v"!=g&&"'"!=g))f+=j[g];else if(u&&v(g))h(g);else if("u"===g||"x"===g&&u){for(var i="u"===g?4:2,k=0;i>k;k++)A>=x&&c(),d(a[A])||c("Bad escape sequence"),A++;f+=String.fromCharCode(parseInt(a.substr(A-i,i),16))}else if(u&&e(g)){if("4">g&&e(a[A])&&e(a[A+1]))var l=3;else if(e(a[A]))var l=2;else var l=1;A+=l-1,f+=String.fromCharCode(parseInt(a.substr(A-l,l),8))}else u?f+=g:(A--,c());else v(g)?c():(!u&&g.charCodeAt(0)<32&&(A--,c("Unexpected control character")),f+=g)}c()}var u=!("json"===b.mode||b.legacy),v=u?i.isLineTerminator:i.isLineTerminatorJSON,w=u?i.isWhiteSpace:i.isWhiteSpaceJSON,x=a.length,y=0,z=0,A=0,B=[],C=function(){},D=function(a){return a};b._tokenize&&!function(){var c=null;C=function(){if(null!==c)throw Error("internal error, token overlap");c=A},D=function(d,e){if(c!=A){var f={raw:a.substr(c,A-c),type:e,stack:B.slice(0)};void 0!==d&&(f.value=d),b._tokenize.call(null,f)}return c=null,d}}(),m();var E=k();if(void 0!==E||x>A){if(m(),A>=x)return"function"==typeof b.reviver&&(E=b.reviver.call(null,"",E)),E;c()}else c(A?"No data, only a whitespace":"No data, empty input")}var i=a("./unicode"),j={"'":"'",'"':'"',"\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:" ",v:" ","/":"/"};b.exports.parse=function(a,b){if("function"==typeof b&&(b={reviver:b}),void 0===a)return void 0;"string"!=typeof a&&(a=String(a)),null==b&&(b={}),null==b.reserved_keys&&(b.reserved_keys="ignore"),("throw"===b.reserved_keys||"ignore"===b.reserved_keys)&&null==b.null_prototype&&(b.null_prototype=!0);try{return h(a,b)}catch(c){if(c instanceof SyntaxError&&null!=c.row&&null!=c.column){var d=c;c=SyntaxError(d.message),c.column=d.column,c.row=d.row}throw c}},b.exports.tokenize=function(a,c){null==c&&(c={}),c._tokenize=function(a){c._addstack&&a.stack.unshift.apply(a.stack,c._addstack),d.push(a)};var d=[];return d.data=b.exports.parse(a,c),d}},{"./unicode":35}],35:[function(a,b,c){var d=b.exports;b.exports.isWhiteSpace=function(a){return" "===a||" "===a||"\ufeff"===a||a>=" "&&"\r">=a||" "===a||"᠎"===a||a>=" "&&" ">=a||"\u2028"===a||"\u2029"===a||" "===a||" "===a||" "===a},b.exports.isWhiteSpaceJSON=function(a){return" "===a||" "===a||"\n"===a||"\r"===a},b.exports.isLineTerminator=function(a){return"\n"===a||"\r"===a||"\u2028"===a||"\u2029"===a},b.exports.isLineTerminatorJSON=function(a){return"\n"===a||"\r"===a},b.exports.isIdentifierStart=function(a){return"$"===a||"_"===a||a>="A"&&"Z">=a||a>="a"&&"z">=a||a>="€"&&d.NonAsciiIdentifierStart.test(a)},b.exports.isIdentifierPart=function(a){return"$"===a||"_"===a||a>="A"&&"Z">=a||a>="a"&&"z">=a||a>="0"&&"9">=a||a>="€"&&d.NonAsciiIdentifierPart.test(a)},b.exports.NonAsciiIdentifierStart=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\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\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\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-\u0C33\u0C35-\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-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\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-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\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]/,b.exports.NonAsciiIdentifierPart=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\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\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\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\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\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\u0D02\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\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\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\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-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\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-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\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-\uFE26\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]/; },{}],36:[function(b,c,d){!function(e,f){"function"==typeof b&&"object"==typeof d&&"object"==typeof c?c.exports=f():"function"==typeof a&&a.amd?a(function(){return f()}):e.pluralize=f()}(this,function(){function a(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}function b(a){return"string"==typeof a?new RegExp("^"+a+"$","i"):a}function c(b,c){return b===b.toUpperCase()?c.toUpperCase():b[0]===b[0].toUpperCase()?a(c):c.toLowerCase()}function d(a,b){return a.replace(/\$(\d{1,2})/g,function(a,c){return b[c]||""})}function e(a,b){if(!a.length||j.hasOwnProperty(a))return a;for(var e=b.length;e--;){var f=b[e];if(f[0].test(a))return a.replace(f[0],function(a,b,e){var g=d(f[1],arguments);return""===a?c(e[b-1],g):c(a,g)})}return a}function f(a,b,d){return function(f){var g=f.toLowerCase();return b.hasOwnProperty(g)?c(f,g):a.hasOwnProperty(g)?c(f,a[g]):e(f,d)}}function g(a,b,c){var d=1===b?g.singular(a):g.plural(a);return(c?b+" ":"")+d}var h=[],i=[],j={},k={},l={};return g.plural=f(l,k,h),g.singular=f(k,l,i),g.addPluralRule=function(a,c){h.push([b(a),c])},g.addSingularRule=function(a,c){i.push([b(a),c])},g.addUncountableRule=function(a){return"string"==typeof a?void(j[a.toLowerCase()]=!0):(g.addPluralRule(a,"$0"),void g.addSingularRule(a,"$0"))},g.addIrregularRule=function(a,b){b=b.toLowerCase(),a=a.toLowerCase(),l[a]=b,k[b]=a},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["thief","thieves"],["genie","genies"],["groove","grooves"],["pickaxe","pickaxes"],["whiskey","whiskies"]].forEach(function(a){return g.addIrregularRule(a[0],a[1])}),[[/s?$/i,"s"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|tlas|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[emjzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/(m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(a){return g.addPluralRule(a[0],a[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(?:sis|ses)$/i,"$1sis"],[/(^analy)(?:sis|ses)$/i,"$1sis"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/(^[pl]|zomb|^(?:neck)?t|[aeo][lt]|cut)ies$/i,"$1ie"],[/([^c][eor]n|smil)ies$/i,"$1ey"],[/(m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i,"$1"],[/(e[mn]u)s?$/i,"$1"],[/(movie|twelve)s$/i,"$1"],[/(cris|test|diagnos)(?:is|es)$/i,"$1is"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(a){return g.addSingularRule(a[0],a[1])}),["advice","agenda","bison","bream","buffalo","carp","chassis","cod","cooperation","corps","digestion","debris","diabetes","energy","equipment","elk","excretion","expertise","flounder","gallows","garbage","graffiti","headquarters","health","herpes","highjinks","homework","information","jeans","justice","kudos","labour","machinery","mackerel","media","mews","moose","news","pike","plankton","pliers","pollution","premises","rain","rice","salmon","scissors","series","sewage","shambles","shrimp","species","staff","swine","trout","tuna","whiting","wildebeest","wildlife","you",/pox$/i,/ois$/i,/deer$/i,/fish$/i,/sheep$/i,/measles$/i,/[^aeiou]ese$/i].forEach(g.addUncountableRule),g})},{}],37:[function(b,c,d){!function(b){if("function"==typeof bootstrap)bootstrap("promise",b);else if("object"==typeof d)c.exports=b();else if("function"==typeof a&&a.amd)a(b);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=b}else Q=b()}(function(){"use strict";function a(a){return function(){return X.apply(a,arguments)}}function b(a){return a===Object(a)}function c(a){return"[object StopIteration]"===da(a)||a instanceof T}function d(a,b){if(P&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(fa)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+fa+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0;d=U&&ka>=d}function i(){if(P)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=g(c);if(!d)return;return S=d[0],d[1]}}function j(a,b,c){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(b+" is deprecated, use "+c+" instead.",new Error("").stack),a.apply(a,arguments)}}function Q(a){return q(a)?a:r(a)?C(a):B(a)}function k(){function a(a){b=a,f.source=a,Z(c,function(b,c){W(function(){a.promiseDispatch.apply(a,c)})},void 0),c=void 0,d=void 0}var b,c=[],d=[],e=aa(k.prototype),f=aa(n.prototype);if(f.promiseDispatch=function(a,e,f){var g=Y(arguments);c?(c.push(g),"when"===e&&f[1]&&d.push(f[1])):W(function(){b.promiseDispatch.apply(b,g)})},f.valueOf=j(function(){if(c)return f;var a=p(b);return q(a)&&(b=a),a},"valueOf","inspect"),f.inspect=function(){return b?b.inspect():{state:"pending"}},Q.longStackSupport&&P)try{throw new Error}catch(g){f.stack=g.stack.substring(g.stack.indexOf("\n")+1)}return e.promise=f,e.resolve=function(c){b||a(Q(c))},e.fulfill=function(c){b||a(B(c))},e.reject=function(c){b||a(A(c))},e.notify=function(a){b||Z(d,function(b,c){W(function(){c(a)})},void 0)},e}function l(a){if("function"!=typeof a)throw new TypeError("resolver must be a function.");var b=k();try{a(b.resolve,b.reject,b.notify)}catch(c){b.reject(c)}return b.promise}function m(a){return l(function(b,c){for(var d=0,e=a.length;e>d;d++)Q(a[d]).then(b,c)})}function n(a,b,c){void 0===b&&(b=function(a){return A(new Error("Promise does not support operation: "+a))}),void 0===c&&(c=function(){return{state:"unknown"}});var d=aa(n.prototype);if(d.promiseDispatch=function(c,e,f){var g;try{g=a[e]?a[e].apply(d,f):b.call(d,e,f)}catch(h){g=A(h)}c&&c(g)},d.inspect=c,c){var e=c();"rejected"===e.state&&(d.exception=e.reason),d.valueOf=j(function(){var a=c();return"pending"===a.state||"rejected"===a.state?d:a.value})}return d}function o(a,b,c,d){return Q(a).then(b,c,d)}function p(a){if(q(a)){var b=a.inspect();if("fulfilled"===b.state)return b.value}return a}function q(a){return b(a)&&"function"==typeof a.promiseDispatch&&"function"==typeof a.inspect}function r(a){return b(a)&&"function"==typeof a.then}function s(a){return q(a)&&"pending"===a.inspect().state}function t(a){return!q(a)||"fulfilled"===a.inspect().state}function u(a){return q(a)&&"rejected"===a.inspect().state}function v(){ia||"undefined"==typeof window||window.Touch||!window.console||console.warn("[Q] Unhandled rejection reasons (should be empty):",ga),ia=!0}function w(){for(var a=0;a=d)throw new TypeError}for(;d>c;c++)c in this&&(b=a(b,this[c],c));return b}),$=a(Array.prototype.indexOf||function(a){for(var b=0;b2?a.resolve(Y(arguments,1)):a.resolve(c)}},Q.promise=l,Q.passByCopy=function(a){return a},n.prototype.passByCopy=function(){return this},Q.join=function(a,b){return Q(a).join(b)},n.prototype.join=function(a){return Q([this,a]).spread(function(a,b){if(a===b)return a;throw new Error("Can't join: not the same: "+a+" "+b)})},Q.race=m,n.prototype.race=function(){return this.then(Q.race)},Q.makePromise=n,n.prototype.toString=function(){return"[object Promise]"},n.prototype.then=function(a,b,c){function e(b){try{return"function"==typeof a?a(b):b}catch(c){return A(c)}}function f(a){if("function"==typeof b){d(a,h);try{return b(a)}catch(c){return A(c)}}return A(a)}function g(a){return"function"==typeof c?c(a):a}var h=this,i=k(),j=!1;return W(function(){h.promiseDispatch(function(a){j||(j=!0,i.resolve(e(a)))},"when",[function(a){j||(j=!0,i.resolve(f(a)))}])}),h.promiseDispatch(void 0,"when",[void 0,function(a){var b,c=!1;try{b=g(a)}catch(d){if(c=!0,!Q.onerror)throw d;Q.onerror(d)}c||i.notify(b)}]),i.promise},Q.when=o,n.prototype.thenResolve=function(a){return this.then(function(){return a})},Q.thenResolve=function(a,b){return Q(a).thenResolve(b)},n.prototype.thenReject=function(a){return this.then(function(){throw a})},Q.thenReject=function(a,b){return Q(a).thenReject(b)},Q.nearer=p,Q.isPromise=q,Q.isPromiseAlike=r,Q.isPending=s,n.prototype.isPending=function(){return"pending"===this.inspect().state},Q.isFulfilled=t,n.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},Q.isRejected=u,n.prototype.isRejected=function(){return"rejected"===this.inspect().state};var ga=[],ha=[],ia=!1,ja=!0;Q.resetUnhandledRejections=x,Q.getUnhandledReasons=function(){return ga.slice()},Q.stopUnhandledRejectionTracking=function(){x(),"undefined"!=typeof process&&process.on&&process.removeListener("exit",w),ja=!1},x(),Q.reject=A,Q.fulfill=B,Q.master=D,Q.spread=E,n.prototype.spread=function(a,b){return this.all().then(function(b){return a.apply(void 0,b)},b)},Q.async=F,Q.spawn=G,Q["return"]=H,Q.promised=I,Q.dispatch=J,n.prototype.dispatch=function(a,b){var c=this,d=k();return W(function(){c.promiseDispatch(d.resolve,a,b)}),d.promise},Q.get=function(a,b){return Q(a).dispatch("get",[b])},n.prototype.get=function(a){return this.dispatch("get",[a])},Q.set=function(a,b,c){return Q(a).dispatch("set",[b,c])},n.prototype.set=function(a,b){return this.dispatch("set",[a,b])},Q.del=Q["delete"]=function(a,b){return Q(a).dispatch("delete",[b])},n.prototype.del=n.prototype["delete"]=function(a){return this.dispatch("delete",[a])},Q.mapply=Q.post=function(a,b,c){return Q(a).dispatch("post",[b,c])},n.prototype.mapply=n.prototype.post=function(a,b){return this.dispatch("post",[a,b])},Q.send=Q.mcall=Q.invoke=function(a,b){return Q(a).dispatch("post",[b,Y(arguments,2)])},n.prototype.send=n.prototype.mcall=n.prototype.invoke=function(a){return this.dispatch("post",[a,Y(arguments,1)])},Q.fapply=function(a,b){return Q(a).dispatch("apply",[void 0,b])},n.prototype.fapply=function(a){return this.dispatch("apply",[void 0,a])},Q["try"]=Q.fcall=function(a){return Q(a).dispatch("apply",[void 0,Y(arguments,1)])},n.prototype.fcall=function(){return this.dispatch("apply",[void 0,Y(arguments)])},Q.fbind=function(a){var b=Q(a),c=Y(arguments,1);return function(){return b.dispatch("apply",[this,c.concat(Y(arguments))])}},n.prototype.fbind=function(){var a=this,b=Y(arguments);return function(){return a.dispatch("apply",[this,b.concat(Y(arguments))])}},Q.keys=function(a){return Q(a).dispatch("keys",[])},n.prototype.keys=function(){return this.dispatch("keys",[])},Q.all=K,n.prototype.all=function(){return K(this)},Q.allResolved=j(L,"allResolved","allSettled"),n.prototype.allResolved=function(){return L(this)},Q.allSettled=M,n.prototype.allSettled=function(){return this.then(function(a){return K(_(a,function(a){function b(){return a.inspect()}return a=Q(a),a.then(b,b)}))})},Q.fail=Q["catch"]=function(a,b){return Q(a).then(void 0,b)},n.prototype.fail=n.prototype["catch"]=function(a){return this.then(void 0,a)},Q.progress=N,n.prototype.progress=function(a){return this.then(void 0,void 0,a)},Q.fin=Q["finally"]=function(a,b){return Q(a)["finally"](b)},n.prototype.fin=n.prototype["finally"]=function(a){return a=Q(a),this.then(function(b){return a.fcall().then(function(){return b})},function(b){return a.fcall().then(function(){throw b})})},Q.done=function(a,b,c,d){return Q(a).done(b,c,d)},n.prototype.done=function(a,b,c){var e=function(a){W(function(){if(d(a,f),!Q.onerror)throw a;Q.onerror(a)})},f=a||b||c?this.then(a,b,c):this;"object"==typeof process&&process&&process.domain&&(e=process.domain.bind(e)),f.then(void 0,e)},Q.timeout=function(a,b,c){return Q(a).timeout(b,c)},n.prototype.timeout=function(a,b){var c=k(),d=setTimeout(function(){c.reject(new Error(b||"Timed out after "+a+" ms"))},a);return this.then(function(a){clearTimeout(d),c.resolve(a)},function(a){clearTimeout(d),c.reject(a)},c.notify),c.promise},Q.delay=function(a,b){return void 0===b&&(b=a,a=void 0),Q(a).delay(b)},n.prototype.delay=function(a){return this.then(function(b){var c=k();return setTimeout(function(){c.resolve(b)},a),c.promise})},Q.nfapply=function(a,b){return Q(a).nfapply(b)},n.prototype.nfapply=function(a){var b=k(),c=Y(a);return c.push(b.makeNodeResolver()),this.fapply(c).fail(b.reject),b.promise},Q.nfcall=function(a){var b=Y(arguments,1);return Q(a).nfapply(b)},n.prototype.nfcall=function(){var a=Y(arguments),b=k();return a.push(b.makeNodeResolver()),this.fapply(a).fail(b.reject),b.promise},Q.nfbind=Q.denodeify=function(a){var b=Y(arguments,1);return function(){var c=b.concat(Y(arguments)),d=k();return c.push(d.makeNodeResolver()),Q(a).fapply(c).fail(d.reject),d.promise}},n.prototype.nfbind=n.prototype.denodeify=function(){var a=Y(arguments);return a.unshift(this),Q.denodeify.apply(void 0,a)},Q.nbind=function(a,b){var c=Y(arguments,2);return function(){function d(){return a.apply(b,arguments)}var e=c.concat(Y(arguments)),f=k();return e.push(f.makeNodeResolver()),Q(d).fapply(e).fail(f.reject),f.promise}},n.prototype.nbind=function(){var a=Y(arguments,0);return a.unshift(this),Q.nbind.apply(void 0,a)},Q.nmapply=Q.npost=function(a,b,c){return Q(a).npost(b,c)},n.prototype.nmapply=n.prototype.npost=function(a,b){var c=Y(b||[]),d=k();return c.push(d.makeNodeResolver()),this.dispatch("post",[a,c]).fail(d.reject),d.promise},Q.nsend=Q.nmcall=Q.ninvoke=function(a,b){var c=Y(arguments,2),d=k();return c.push(d.makeNodeResolver()),Q(a).dispatch("post",[b,c]).fail(d.reject),d.promise},n.prototype.nsend=n.prototype.nmcall=n.prototype.ninvoke=function(a){var b=Y(arguments,1),c=k();return b.push(c.makeNodeResolver()),this.dispatch("post",[a,b]).fail(c.reject),c.promise},Q.nodeify=O,n.prototype.nodeify=function(a){return a?void this.then(function(b){W(function(){a(null,b)})},function(b){W(function(){a(b)})}):this};var ka=i();return Q})},{}],38:[function(b,c,d){(function(b){!function(a){"use strict";function b(a){var c;if(null===a||void 0===a)return!1;if(d.isArray(a))return a.length>0;if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)return!0;for(c in a)if(a.hasOwnProperty(c)&&b(a[c]))return!0;return!1}var c=function(){function a(a){this.options=a}return a.prototype.toString=function(){return JSON&&JSON.stringify?JSON.stringify(this.options):this.options},a}(),d=function(){function a(a){return"[object Array]"===Object.prototype.toString.apply(a)}function b(a){return"[object String]"===Object.prototype.toString.apply(a)}function c(a){return"[object Number]"===Object.prototype.toString.apply(a)}function d(a){return"[object Boolean]"===Object.prototype.toString.apply(a)}function e(a,b){var c,d="",e=!0;for(c=0;c="a"&&"z">=a||a>="A"&&"Z">=a}function b(a){return a>="0"&&"9">=a}function c(a){return b(a)||a>="a"&&"f">=a||a>="A"&&"F">=a}return{isAlpha:a,isDigit:b,isHexDigit:c}}(),f=function(){function a(a){var b,c,d="",e=g.encode(a);for(c=0;cb?"0":"")+b.toString(16).toUpperCase();return d}function b(a,b){return"%"===a.charAt(b)&&e.isHexDigit(a.charAt(b+1))&&e.isHexDigit(a.charAt(b+2))}function c(a,b){return parseInt(a.substr(b,2),16)}function d(a){if(!b(a,0))return!1;var d=c(a,1),e=g.numBytes(d);if(0===e)return!1;for(var f=1;e>f;f+=1)if(!b(a,3*f)||!g.isValidFollowingCharCode(c(a,3*f+1)))return!1;return!0}function f(a,d){var e=a.charAt(d);if(!b(a,d))return e;var f=c(a,d+1),h=g.numBytes(f);if(0===h)return e;for(var i=1;h>i;i+=1)if(!b(a,d+3*i)||!g.isValidFollowingCharCode(c(a,d+3*i+1)))return e;return a.substr(d,3*h)}var g={encode:function(a){return unescape(encodeURIComponent(a))},numBytes:function(a){return 127>=a?1:a>=194&&223>=a?2:a>=224&&239>=a?3:a>=240&&244>=a?4:0},isValidFollowingCharCode:function(a){return a>=128&&191>=a}};return{encodeCharacter:a,isPctEncoded:d,pctCharAt:f}}(),g=function(){function a(a){return e.isAlpha(a)||e.isDigit(a)||"_"===a||f.isPctEncoded(a)}function b(a){return e.isAlpha(a)||e.isDigit(a)||"-"===a||"."===a||"_"===a||"~"===a}function c(a){return":"===a||"/"===a||"?"===a||"#"===a||"["===a||"]"===a||"@"===a||"!"===a||"$"===a||"&"===a||"("===a||")"===a||"*"===a||"+"===a||","===a||";"===a||"="===a||"'"===a}return{isVarchar:a,isUnreserved:b,isReserved:c}}(),h=function(){function a(a,b){var c,d="",e="";for(("number"==typeof a||"boolean"==typeof a)&&(a=a.toString()),c=0;c1?c:g.isReserved(c)||g.isUnreserved(c)?c:f.encodeCharacter(c)}function d(a){var b,c="",d="";for(b=0;b1?d:g.isReserved(d)||g.isUnreserved(d)?d:f.encodeCharacter(d);return c}return{encode:a,encodePassReserved:b,encodeLiteral:d,encodeLiteralCharacter:c}}(),i=function(){function a(a){b[a]={symbol:a,separator:"?"===a?"&":""===a||"+"===a||"#"===a?",":a,named:";"===a||"&"===a||"?"===a,ifEmpty:"&"===a||"?"===a?"=":"",first:"+"===a?"":a,encode:"+"===a||"#"===a?h.encodePassReserved:h.encode,toString:function(){return this.symbol}}}var b={};return a(""),a("+"),a("#"),a("."),a("/"),a(";"),a("?"),a("&"),{valueOf:function(a){return b[a]?b[a]:"=,!@|".indexOf(a)>=0?null:b[""]}}}(),j=function(){function a(a){this.literal=h.encodeLiteral(a)}return a.prototype.expand=function(){return this.literal},a.prototype.toString=a.prototype.expand,a}(),k=function(){function a(a){function b(){var b=a.substring(n,j);if(0===b.length)throw new c({expressionText:a,message:"a varname must be specified",position:j});m={varname:b,exploded:!1,maxLength:null},n=null}function d(){if(o===j)throw new c({expressionText:a,message:"after a ':' you have to specify the length",position:j});m.maxLength=parseInt(a.substring(o,j),10),o=null}var h,j,k=[],m=null,n=null,o=null,p="";for(h=function(b){var d=i.valueOf(b);if(null===d)throw new c({expressionText:a,message:"illegal use of reserved operator",position:j,operator:b});return d}(a.charAt(0)),j=h.symbol.length,n=j;j=4)throw new c({expressionText:a,message:"A :prefix must have max 4 digits",position:j});continue}d()}if(":"!==p)if("*"!==p){if(","!==p)throw new c({expressionText:a,message:"illegal character",character:p,position:j});k.push(m),m=null,n=j+1}else{if(null===m)throw new c({expressionText:a,message:"exploded without varspec",position:j});if(m.exploded)throw new c({expressionText:a,message:"exploded twice",position:j});if(m.maxLength)throw new c({expressionText:a,message:"an explode (*) MUST NOT follow to a prefix",position:j});m.exploded=!0}else{if(null!==m.maxLength)throw new c({expressionText:a,message:"only one :maxLength is allowed per varspec",position:j});if(m.exploded)throw new c({expressionText:a,message:"an exploeded varspec MUST NOT be varspeced",position:j});o=j+1}}return null!==n&&b(),null!==o&&d(),k.push(m),new l(a,h,k)}function b(b){var d,e,f=[],g=null,h=0;for(d=0;dh&&f.push(new j(b.substring(h,d))),h=null,g=d)}if(null!==g)throw new c({templateText:b,message:"unclosed brace",position:g});return h= 0) { throw new exports.ValidationError('while validating baseUri', null, uriParameter[0].value + ' parameter not allowed here', uriParameter[0].start_mark); @@ -401,6 +405,15 @@ return this.validate_method(node, true, 'trait'); }; + Validator.prototype.canonicalizeParameterName = function(propertyName, mustRemoveQuestionMark) { + var canonicalParameterName; + canonicalParameterName = this.canonicalizePropertyName(propertyName, mustRemoveQuestionMark); + if (canonicalParameterName[0] === '+') { + return canonicalParameterName.slice(1); + } + return canonicalParameterName; + }; + Validator.prototype.canonicalizePropertyName = function(propertyName, mustRemoveQuestionMark) { if (mustRemoveQuestionMark && propertyName.slice(-1) === '?') { return propertyName.slice(0, -1); diff --git a/src/transformations.coffee b/src/transformations.coffee index d654687..ce3f16d 100644 --- a/src/transformations.coffee +++ b/src/transformations.coffee @@ -28,9 +28,11 @@ class @Transformations applyTransformationsToRoot: (rootObject) -> if rootObject.baseUri - template = uritemplate.parse rootObject.baseUri - expressions = template.expressions.filter((expr) -> return 'templateText' of expr).map (expression) -> expression.templateText + expressions = [] + template.expressions?.forEach (expression) -> + expression.varspecs?.forEach (spec) -> + expressions.push spec.varname if expressions.length rootObject.baseUriParameters = {} unless rootObject.baseUriParameters @@ -62,7 +64,10 @@ class @Transformations resource.relativeUriPathSegments = pathParts template = uritemplate.parse resource.relativeUri - expressions = template.expressions.filter((expr) -> return 'templateText' of expr).map (expression) -> expression.templateText + expressions = [] + template.expressions?.forEach (expression) -> + expression.varspecs?.forEach (spec) -> + expressions.push spec.varname if expressions.length resource.uriParameters = {} unless resource.uriParameters diff --git a/src/validator.coffee b/src/validator.coffee index 928f589..d84cbe6 100644 --- a/src/validator.coffee +++ b/src/validator.coffee @@ -162,11 +162,16 @@ class @Validator template = uritemplate.parse uri catch err throw new exports.ValidationError 'while validating uri parameters', null, err?.options?.message, uriProperty.start_mark - expressions = template.expressions.filter((expr) -> return "templateText" of expr ).map (expression) -> expression.templateText + expressions = [] + template.expressions?.forEach (expression) -> + expression.varspecs?.forEach (spec) -> + expressions.push spec.varname + uriParameters = {} + if typeof uriProperty.value is "object" for uriParameter in uriProperty.value - parameterName = @canonicalizePropertyName(uriParameter[0].value, allowParameterKeys) + parameterName = @canonicalizeParameterName(uriParameter[0].value, allowParameterKeys) @trackRepeatedProperties(uriParameters, parameterName, uriProperty, 'while validating URI parameters', "URI parameter with the same name already exists") if parameterName in reservedNames @@ -225,6 +230,12 @@ class @Validator @validate_method node, true, 'trait' + canonicalizeParameterName: (propertyName, mustRemoveQuestionMark) -> + canonicalParameterName = @canonicalizePropertyName propertyName, mustRemoveQuestionMark + if canonicalParameterName[0] == '+' + return canonicalParameterName.slice(1) + return canonicalParameterName + canonicalizePropertyName: (propertyName, mustRemoveQuestionMark) -> if mustRemoveQuestionMark and propertyName.slice(-1) is '?' return propertyName.slice(0,-1) diff --git a/test/specs/uriParameters.js b/test/specs/uriParameters.js new file mode 100644 index 0000000..3031d11 --- /dev/null +++ b/test/specs/uriParameters.js @@ -0,0 +1,140 @@ +/* Reject optional scalar parameters */ + +'use strict'; + +if (typeof window === 'undefined') { + var raml = require('../../lib/raml.js'); + var chai = require('chai'); + var chaiAsPromised = require('chai-as-promised'); + + chai.should(); + chai.use(chaiAsPromised); +} else { + var raml = RAML.Parser; + + chai.should(); +} + +describe('Uri parameter validations', function () { + describe('L2 URI parameters', function () { + it('in baseUriParameters', function (done) { + return raml.load([ + '#%RAML 0.8', + 'title: Title', + 'baseUri: http://domain/{+l2Parameter}', + 'baseUriParameters:', + ' l2Parameter:', + ' type: number' + ].join('\n'), 'api.raml') + .then(function (result) { + setTimeout(function () { + var expected = { + title: 'Title', + baseUri: 'http://domain/{+l2Parameter}', + baseUriParameters: { + l2Parameter: { type: 'number', displayName: 'l2Parameter', required: true }, + }, + protocols: [ 'HTTP' ] + }; + + result.should.deep.equal(expected); + done(); + }, 0); + }); + }); + + it('in uriParameters', function (done) { + return raml.load([ + '#%RAML 0.8', + 'title: Title', + 'baseUri: http://domain', + '/resource/{+newParameter}:', + ' uriParameters:', + ' newParameter:', + ' type: number' + ].join('\n'), 'api.raml') + .then(function (result) { + setTimeout(function () { + var expected = { + title: 'Title', + baseUri: 'http://domain', + protocols: [ 'HTTP' ], + resources: [{ + uriParameters: { + newParameter: { type: 'number', displayName: 'newParameter', required: true }, + }, + "relativeUri": "/resource/{+newParameter}", + "relativeUriPathSegments": [ + "resource", + "{+newParameter}" + ] + }] + }; + + result.should.deep.equal(expected); + done(); + }, 0); + }, function (err) {console.log(err)}); + }); + }); + + describe('more than one parameter in bracket', function () { + it('in baseUriParameters', function (done) { + return raml.load([ + '#%RAML 0.8', + 'title: Title', + 'baseUri: http://domain/{parameter1,parameter2}/{parameter3,parameter4}' + ].join('\n'), 'api.raml') + .then(function (result) { + setTimeout(function () { + var expected = { + title: 'Title', + baseUri: 'http://domain/{parameter1,parameter2}/{parameter3,parameter4}', + protocols: [ 'HTTP' ], + baseUriParameters: { + parameter1: { type: 'string', displayName: 'parameter1', required: true }, + parameter2: { type: 'string', displayName: 'parameter2', required: true }, + parameter3: { type: 'string', displayName: 'parameter3', required: true }, + parameter4: { type: 'string', displayName: 'parameter4', required: true } + }, + }; + + result.should.deep.equal(expected); + done(); + }, 0); + }, console.log); + }); + + it('in uriParameters', function (done) { + return raml.load([ + '#%RAML 0.8', + 'title: Title', + 'baseUri: http://domain', + '/resource/{parameter1,parameter2}:' + ].join('\n'), 'api.raml') + .then(function (result) { + setTimeout(function () { + var expected = { + title: 'Title', + baseUri: 'http://domain', + protocols: [ 'HTTP' ], + resources: [{ + uriParameters: { + parameter1: { type: 'string', displayName: 'parameter1', required: true }, + parameter2: { type: 'string', displayName: 'parameter2', required: true }, + }, + "relativeUri": "/resource/{parameter1,parameter2}", + "relativeUriPathSegments": [ + "resource", + "{parameter1,parameter2}" + ] + }] + }; + + result.should.deep.equal(expected); + done(); + }, 0); + }, function (err) {console.log(err)}); + }); + }); +});