From 361c1f6f08aed64c8da1784cef5ea61a83bac787 Mon Sep 17 00:00:00 2001 From: argos83 Date: Sun, 4 Feb 2018 08:47:05 +1100 Subject: [PATCH] fix: incorrectly traversing of object with length property (#557) --- browser/swagger-tools-min.js | 2 +- browser/swagger-tools-standalone-min.js | 2 +- browser/swagger-tools-standalone.js | 1476 +++++++++++++---------- browser/swagger-tools.js | 12 +- lib/specs.js | 10 +- package.json | 2 +- test/2.0/test-specs.js | 20 + 7 files changed, 902 insertions(+), 622 deletions(-) diff --git a/browser/swagger-tools-min.js b/browser/swagger-tools-min.js index e13b3b00e7..f0eafe6e1f 100755 --- a/browser/swagger-tools-min.js +++ b/browser/swagger-tools-min.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;((t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SwaggerTools||(t.SwaggerTools={})).specs=e()}}(function(){return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var p="function"==typeof require&&require;if(!a&&p)return p(s,!0);if(o)return o(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var f=i[s]={exports:{}};t[s][0].call(f.exports,function(e){var i=t[s][1][e];return n(i||e)},f,f.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s1?"s are":" is")+" invalid:"),r.each(t.getLastErrors(),function(e){console.error(" "+(r.isArray(e.path)?n.pathToPtr(e.path):e.path)+": "+e.message)}),new Error("Unable to create validator due to invalid JSON Schema");return t},t.exports.formatResults=function(e){return e&&(e=e.errors.length+e.warnings.length+r.reduce(e.apiDeclarations,function(e,t){return t&&(e+=t.errors.length+t.warnings.length),e},0)>0?e:void 0),e};var f=t.exports.getErrorCount=function(e){var t=0;return e&&(t=e.errors.length,r.each(e.apiDeclarations,function(e){e&&(t+=e.errors.length)})),t},c=function(e){return e&&!r.isString(e)&&-1===(e=e.toString()).indexOf(".")&&(e+=".0"),e};t.exports.getSpec=function(t,i){var n;if(t=c(t),n=d[t],r.isUndefined(n))switch(t){case"1.2":n=e("../lib/specs").v1_2;break;case"2.0":n=e("../lib/specs").v2_0;break;default:if(!0===i)throw new Error("Unsupported Swagger version: "+t)}return n},t.exports.getSwaggerVersion=function(e){return r.isPlainObject(e)?c(e.swaggerVersion||e.swagger):void 0},t.exports.printValidationResults=function(e,t,i,o,s){var a=f(o)>0?console.error:console.log,p=function(e,t){return 1===t?e:e+"s"},d=function(e,t,i){e&&(a(e+":"),a()),r.each(t,function(e){a(new Array(i+1).join(" ")+n.pathToPtr(e.path)+": "+e.message),e.inner&&d(void 0,e.inner,i+2)}),e&&a()},c=0,m=0;a(),o.errors.length>0&&(c+=o.errors.length,d("API Errors",o.errors,2)),o.warnings.length>0&&(m+=o.warnings.length,d("API Warnings",o.warnings,2)),o.apiDeclarations&&o.apiDeclarations.forEach(function(e,t){if(e){var r=i[t].resourcePath||t;e.errors.length>0&&(c+=e.errors.length,d(" API Declaration ("+r+") Errors",e.errors,4)),e.warnings.length>0&&(m+=e.warnings.length,d(" API Declaration ("+r+") Warnings",e.warnings,4))}}),s&&a(c>0?c+" "+p("error",c)+" and "+m+" "+p("warning",m):"Validation succeeded but with "+m+" "+p("warning",m)),a()},t.exports.swaggerOperationMethods=["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":16}],2:[function(e,t,i){(function(i){"use strict";var r="undefined"!=typeof window?window._:void 0!==i?i._:null,n="undefined"!=typeof window?window.async:void 0!==i?i.async:null,o=e("./helpers"),s="undefined"!=typeof window?window.JsonRefs:void 0!==i?i.JsonRefs:null,a="undefined"!=typeof window?window.SparkMD5:void 0!==i?i.SparkMD5:null,p="undefined"!=typeof window?window.SwaggerConverter.convert:void 0!==i?i.SwaggerConverter.convert:null,d="undefined"!=typeof window?window.traverse:void 0!==i?i.traverse:null,f=e("./validators"),c="undefined"!=typeof window?window.jsyaml:void 0!==i?i.jsyaml:null;r.isPlainObject(p)&&(p=i.SwaggerConverter.convert);var m={},u=function(e,t){return"1.2"!==e?t:t.replace("#/models/","")},l=function(e){var t=r.cloneDeep(e);return t.$ref="#/models/"+e.$ref,t},h=r.map(o.swaggerOperationMethods,function(e){return e.toLowerCase()}),y=function(e){return["relative","remote"].indexOf(e.type)>-1},g=function(e,t,i,r){r.push({code:e,message:t,path:i})},v=function(e,t,i,n,a){var p,d,f,c,m,u,l=!0,h=o.getSwaggerVersion(e.resolved),y=r.isArray(t)?t:s.pathFromPtr(t),v=r.isArray(t)?s.pathToPtr(t):t,b=r.isArray(i)?i:s.pathFromPtr(i),$=r.isArray(i)?s.pathToPtr(i):i;if(d=e.definitions[v],u=y[0],p="securityDefinitions"===u?"SECURITY_DEFINITION":u.substring(0,u.length-1).toUpperCase(),f="1.2"===h?y[y.length-1]:v,m="securityDefinitions"===u?"Security definition":p.charAt(0)+p.substring(1).toLowerCase(),["authorizations","securityDefinitions"].indexOf(y[0])>-1&&"scopes"===y[2]&&(p+="_SCOPE",m+=" scope"),r.isUndefined(d)&&-1===["AUTHORIZATION_SCOPE","SECURITY_DEFINITION_SCOPE"].indexOf(p))for(c=1;c0&&(i.allOf=[],r.each(a.lineage,function(t){i.allOf.push(b(e,t))})),delete i.subTypes,r.each(i.properties,function(t,i){var o=n.properties[i];r.each(["maximum","minimum"],function(e){r.isString(t[e])&&(t[e]=parseFloat(t[e]))}),r.each(s.findRefs(o,{includeInvalid:!0,refPreProcessor:l}),function(i,r){var n=e.definitions[i.uri],o=s.pathFromPtr(r);n.lineage.length>0?d(t).set(o,b(e,i.uri)):d(t).set(o.concat("title"),"Composed "+u(e.swaggerVersion,i.uri))})})),i=d(i).map(function(e){"id"===this.key&&r.isString(e)&&this.remove()}),i.title=o,i},$=function(e,t,i,r,n){g("UNUSED_"+t,i+" is defined but is not used: "+e,r,n)},w=function(e){var t=a.hash(JSON.stringify(e)),i=m[t]||r.find(m,function(e){return e.resolvedId===t});return i||(i=m[t]={definitions:{},original:e,resolved:void 0,swaggerVersion:o.getSwaggerVersion(e)}),i},j=function(e,t){var i=new Error("The Swagger document(s) are invalid");i.errors=e.errors,i.failedValidation=!0,i.warnings=e.warnings,e.apiDeclarations&&(i.apiDeclarations=e.apiDeclarations),t(i)},x=function(e){var t=e.match(/\{(.*?)\}/g),i=[],n=e;return t&&r.each(t,function(e,t){n=n.replace(e,"{"+t+"}"),i.push(e.replace(/[{}]/g,""))}),{path:n,args:i}},P=function(e){function t(i,n,o){function s(e,r){o.push(r),t(i,e,o),o.pop()}-1===i.indexOf(n)?(i.push(n),(r.isArray(n)||r.isPlainObject(n))&&r.each(n,function(e,t){s(e,t.toString())})):r.set(e,o,{}),i.pop()}t([],e,[])},I=function(e,t,i,n,o,s){!r.isUndefined(e)&&e.indexOf(t)>-1&&g("DUPLICATE_"+i,n+" already defined: "+t,o,s)},O=function(e,t,i,r,n){try{f.validateSchemaConstraints(e.swaggerVersion,t,i,void 0)}catch(e){n||g(e.code,e.message,e.path,r.errors)}},E=function(e,t){var i=e.swaggerVersion,n=function(t,i){var r=s.pathToPtr(t),n=e.definitions[r];return n||(n=e.definitions[r]={inline:i||!1,references:[]},["definitions","models"].indexOf(s.pathFromPtr(r)[0])>-1&&(n.cyclical=!1,n.lineage=void 0,n.parents=[])),n},o=function(e){return"1.2"===i?s.pathFromPtr(e).pop():e},a={filter:"local",includeInvalid:!0},p=function(t,i,n){var o=e.definitions[i||t];o&&r.each(o.parents,function(e){n.push(e),t!==e&&p(t,e,n)})},f="1.2"===i?"authorizations":"securityDefinitions",c="1.2"===i?"models":"definitions";switch(r.each(e.resolved[f],function(e,o){var s=[f,o];("1.2"!==i||e.type)&&(n(s),r.reduce(e.scopes,function(e,r,o){var a="1.2"===i?r.scope:o,p=s.concat(["scopes",o.toString()]);return n(s.concat(["scopes",a])).scopePath=p,I(e,a,"AUTHORIZATION_SCOPE_DEFINITION","Authorization scope definition","1.2"===i?p.concat("scope"):p,t.warnings),e.push(a),e},[]))}),r.each(e.resolved[c],function(o,a){var p=[c,a],f=n(p);if("1.2"===i&&a!==o.id&&g("MODEL_ID_MISMATCH","Model id does not match id in models object: "+o.id,p.concat("id"),t.errors),r.isUndefined(f.lineage))switch(i){case"1.2":r.each(o.subTypes,function(i,r){var o=["models",i],a=s.pathToPtr(o),d=e.definitions[a],f=p.concat(["subTypes",r.toString()]);!d&&e.resolved[c][i]&&(d=n(o)),v(e,o,f,t)&&d.parents.push(s.pathToPtr(p))});break;default:r.each(e.original[c][a].allOf,function(t,i){var o,a=!1;r.isUndefined(t.$ref)||y(s.getRefDetails(t))?(a=!0,o=p.concat(["allOf",i.toString()])):o=s.pathFromPtr(t.$ref),r.isUndefined(d(e.resolved).get(o))||(n(o,a),f.parents.push(s.pathToPtr(o)))})}}),i){case"2.0":r.each(e.resolved.parameters,function(i,r){var o=["parameters",r];n(o),O(e,i,o,t)}),r.each(e.resolved.responses,function(i,r){var o=["responses",r];n(o),O(e,i,o,t)})}r.each(e.definitions,function(n,a){var f,c,m,u=s.pathFromPtr(a),l=d(e.original).get(u),h=u[0],y=h.substring(0,h.length-1).toUpperCase(),v=y.charAt(0)+y.substring(1).toLowerCase();-1!==["definitions","models"].indexOf(h)&&(f=[],c=[],m=n.lineage,r.isUndefined(m)&&(p(a,void 0,m=[]),m.reverse(),n.lineage=r.cloneDeep(m),n.cyclical=m.length>1&&m[0]===a),n.parents.length>1&&"1.2"===i&&g("MULTIPLE_"+y+"_INHERITANCE","Child "+y.toLowerCase()+" is sub type of multiple models: "+r.map(n.parents,function(e){return o(e)}).join(" && "),u,t.errors),n.cyclical&&g("CYCLICAL_"+y+"_INHERITANCE",v+" has a circular inheritance: "+r.map(m,function(e){return o(e)}).join(" -> ")+" -> "+o(a),u.concat("1.2"===i?"subTypes":"allOf"),t.errors),r.each(m.slice(n.cyclical?1:0),function(t){var i=d(e.resolved).get(s.pathFromPtr(t));r.each(Object.keys(i.properties||{}),function(e){-1===c.indexOf(e)&&c.push(e)})}),O(e,l,u,t),r.each(l.properties,function(i,n){var o=u.concat(["properties",n]);r.isUndefined(i)||(O(e,i,o,t),c.indexOf(n)>-1?g("CHILD_"+y+"_REDECLARES_PROPERTY","Child "+y.toLowerCase()+" declares property already declared by ancestor: "+n,o,t.errors):f.push(n))}),r.each(l.required||[],function(e,r){var n="1.2"===i?"Model":"Definition";-1===c.indexOf(e)&&-1===f.indexOf(e)&&g("MISSING_REQUIRED_"+n.toUpperCase()+"_PROPERTY",n+" requires property but it is not defined: "+e,u.concat(["required",r.toString()]),t.errors)}))}),"1.2"===e.swaggerVersion&&(a.refPreProcessor=l),r.each(s.findRefs(e.original,a),function(i,r){v(e,i.uri,r,t)}),r.each(e.referencesMetadata,function(i,r){y(i)&&!0===i.missing&&t.errors.push({code:"UNRESOLVABLE_REFERENCE",message:"Reference could not be resolved: "+u(e.swaggerVersion,i.uri),path:s.pathFromPtr(r).concat("$ref")})})},T=function(e,t,i,n,o,s){r.isUndefined(e)||-1!==e.indexOf(t)||g("UNRESOLVABLE_"+i,n+" could not be resolved: "+t,o,s)},S=function(e,t,i,n){var o="1.2"===e.swaggerVersion?"AUTHORIZATION":"SECURITY_DEFINITION",s="AUTHORIZATION"===o?"Authorization":"Security definition";"1.2"===e.swaggerVersion?r.reduce(t,function(t,a,p){var d=["authorizations",p],f=i.concat([p]);return v(e,d,f,n)&&r.reduce(a,function(t,i,r){var a=f.concat(r.toString(),"scope"),p=d.concat(["scopes",i.scope]);return I(t,i.scope,o+"_SCOPE_REFERENCE",s+" scope reference",a,n.warnings),v(e,p,a,n),t.concat(i.scope)},[]),t.concat(p)},[]):r.reduce(t,function(t,a,p){return r.each(a,function(a,d){var f=["securityDefinitions",d],c=i.concat(p.toString(),d);I(t,d,o+"_REFERENCE",s+" reference",c,n.warnings),t.push(d),v(e,f,c,n)&&r.each(a,function(t,i){var r=f.concat(["scopes",t]);v(e,r,c.concat(i.toString()),n)})}),t},[])},A=function(e,t){var i=w(e),n=o.getSwaggerVersion(e),p={includeInvalid:!0,loaderOptions:{processContent:function(e,t){t(void 0,c.safeLoad(e.text))}}};i.resolved?t():("1.2"===n&&(p.refPreProcessor=l),s.resolveRefs(e,p).then(function(e){P(e.resolved),r.each(e.refs,function(t,i){t.circular&&r.set(e.resolved,s.pathFromPtr(i),{})}),i.referencesMetadata=e.refs,i.resolved=e.resolved,i.resolvedId=a.hash(JSON.stringify(e.resolved)),t()}).catch(t))},q=function(e,t,i,n){var s=r.isString(t)?e.validators[t]:o.createJsonValidator();o.registerCustomFormats(i);try{f.validateAgainstSchema(t,i,s)}catch(e){return e.failedValidation?n(void 0,e.results):n(e)}A(i,function(e){return n(e)})},M=function(e,t){r.each(e.definitions,function(i,r){var n=s.pathFromPtr(r),o=n[0].substring(0,n[0].length-1),a="1.2"===e.swaggerVersion?n[n.length-1]:r,p="securityDefinition"===o?"SECURITY_DEFINITION":o.toUpperCase(),d="securityDefinition"===o?"Security definition":o.charAt(0).toUpperCase()+o.substring(1);0!==i.references.length||i.inline||(i.scopePath&&(p+="_SCOPE",d+=" scope",n=i.scopePath),$(a,p,d,n,t.warnings))})},U=function(e,t,i,n,o,s,a){var p=function(t){g("INVALID_PARAMETER_COMBINATION","API cannot have a a body parameter and a "+("1.2"===e.version?"form":"formData")+" parameter",t,s.errors)},d=[],f=!1,c=!1;r.reduce(n,function(n,a,m){var u=o.concat(["parameters",m.toString()]);if(!r.isUndefined(a))return I(n,a.name,"PARAMETER","Parameter",u.concat("name"),s.errors),"body"===a.paramType||"body"===a.in?(!0===f?g("DUPLICATE_API_BODY_PARAMETER","API has more than one body parameter",u,s.errors):!0===c&&p(u),f=!0):"form"===a.paramType||"formData"===a.in?(!0===f&&p(u),c=!0):"path"!==a.paramType&&"path"!==a.in||(-1===i.args.indexOf(a.name)&&g("UNRESOLVABLE_API_PATH_PARAMETER","API path parameter could not be resolved: "+a.name,u.concat("name"),s.errors),d.push(a.name)),-1===e.primitives.indexOf(a.type)&&"1.2"===e.version&&v(t,"#/models/"+a.type,u.concat("type"),s),O(t,a,u,s,a.skipErrors),n.concat(a.name)},[]),(r.isUndefined(a)||!1===a)&&r.each(r.difference(i.args,d),function(e){g("MISSING_API_PATH_PARAMETER","API requires path parameter but it is not defined: "+e,"1.2"===t.swaggerVersion?o.slice(0,2).concat("path"):o,s.errors)})},D=function(e,t,i,n){var o=[],s=w(t),a=[],p={errors:[],warnings:[],apiDeclarations:[]};a=r.reduce(t.apis,function(e,t,i){return I(e,t.path,"RESOURCE_PATH","Resource path",["apis",i.toString(),"path"],p.errors),e.push(t.path),e},[]),E(s,p),o=r.reduce(i,function(t,i,n){var d=p.apiDeclarations[n]={errors:[],warnings:[]},f=w(i);return I(t,i.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],d.errors),-1===o.indexOf(i.resourcePath)&&(T(a,i.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],d.errors),t.push(i.resourcePath)),E(f,d),r.reduce(i.apis,function(t,i,n){var o=["apis",n.toString()],a=x(i.path);return t.indexOf(a.path)>-1?g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+i.path,o.concat("path"),d.errors):t.push(a.path),r.reduce(i.operations,function(t,i,n){var p=o.concat(["operations",n.toString()]);return I(t,i.method,"OPERATION_METHOD","Operation method",p.concat("method"),d.errors),t.push(i.method),-1===e.primitives.indexOf(i.type)&&"1.2"===e.version&&v(f,"#/models/"+i.type,p.concat("type"),d),S(s,i.authorizations,p.concat("authorizations"),d),O(f,i,p,d),U(e,f,a,i.parameters,p,d),r.reduce(i.responseMessages,function(e,t,i){var r=p.concat(["responseMessages",i.toString()]);return I(e,t.code,"RESPONSE_MESSAGE_CODE","Response message code",r.concat(["code"]),d.errors),t.responseModel&&v(f,"#/models/"+t.responseModel,r.concat("responseModel"),d),e.concat(t.code)},[]),t},[]),t},[]),M(f,d),t},[]),M(s,p),r.each(r.difference(a,o),function(e){var i=a.indexOf(e);$(t.apis[i].path,"RESOURCE_PATH","Resource path",["apis",i.toString(),"path"],p.errors)}),n(void 0,p)},L=function(e,t,i){var n=w(t),o={errors:[],warnings:[]};E(n,o),S(n,t.security,["security"],o),r.reduce(n.resolved.paths,function(t,i,s){var a=["paths",s],p=x(s);return t.indexOf(p.path)>-1&&g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+s,a,o.errors),U(e,n,p,i.parameters,a,o,!0),r.each(i,function(t,s){var d=[],f=a.concat(s),c=[];-1!==h.indexOf(s)&&(S(n,t.security,f.concat("security"),o),r.each(t.parameters,function(e){r.isUndefined(e)||(d.push(e),c.push(e.name+":"+e.in))}),r.each(i.parameters,function(e){var t=r.cloneDeep(e);t.skipErrors=!0,-1===c.indexOf(e.name+":"+e.in)&&d.push(t)}),U(e,n,p,d,f,o),r.each(t.responses,function(e,t){r.isUndefined(e)||O(n,e,f.concat("responses",t),o)}))}),t.concat(p.path)},[]),M(n,o),i(void 0,o)},R=function(e,t,i,r){var n=function(e,t){r(e,o.formatResults(t))};"1.2"===e.version?D(e,t,i,n):L(e,t,n)},_=function(e,t,i,o){q(e,"1.2"===e.version?"resourceListing.json":"schema.json",t,function(t,s){if(t)return o(t);s||"1.2"!==e.version?o(void 0,s):(s={errors:[],warnings:[],apiDeclarations:[]},n.map(i,function(t,i){q(e,"apiDeclaration.json",t,i)},function(e,t){if(e)return o(e);r.each(t,function(e,t){s.apiDeclarations[t]=e}),o(void 0,s)}))})},N=function(t){var i=this,n=function(e,t){return r.reduce(t,function(e,t,i){return e[i]=o.createJsonValidator(t),e},{})},s=function(e){var t=r.cloneDeep(i.schemas[e]);return t.id=e,t},a=["string","number","boolean","integer","array"];switch(t){case"1.2":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md",this.primitives=r.union(a,["void","File"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2",this.schemas={"apiDeclaration.json":e("../schemas/1.2/apiDeclaration.json"),"authorizationObject.json":e("../schemas/1.2/authorizationObject.json"),"dataType.json":e("../schemas/1.2/dataType.json"),"dataTypeBase.json":e("../schemas/1.2/dataTypeBase.json"),"infoObject.json":e("../schemas/1.2/infoObject.json"),"modelsObject.json":e("../schemas/1.2/modelsObject.json"),"oauth2GrantType.json":e("../schemas/1.2/oauth2GrantType.json"),"operationObject.json":e("../schemas/1.2/operationObject.json"),"parameterObject.json":e("../schemas/1.2/parameterObject.json"),"resourceListing.json":e("../schemas/1.2/resourceListing.json"),"resourceObject.json":e("../schemas/1.2/resourceObject.json")},this.validators=n(0,{"apiDeclaration.json":r.map(["dataTypeBase.json","modelsObject.json","oauth2GrantType.json","authorizationObject.json","parameterObject.json","operationObject.json","apiDeclaration.json"],s),"resourceListing.json":r.map(["resourceObject.json","infoObject.json","oauth2GrantType.json","authorizationObject.json","resourceListing.json"],s)});break;case"2.0":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md",this.primitives=r.union(a,["file"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0",this.schemas={"schema.json":e("../schemas/2.0/schema.json")},this.validators=n(0,{"schema.json":[s("schema.json")]});break;default:throw new Error(t+" is an unsupported Swagger specification version")}this.version=t};N.prototype.validate=function(e,t,i){switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("resourceListing is required");if(!r.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(r.isUndefined(t))throw new Error("apiDeclarations is required");if(!r.isArray(t))throw new TypeError("apiDeclarations must be an array");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object")}if("2.0"===this.version&&(i=arguments[1]),r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");"2.0"===this.version&&(t=[]);var n=this;_(this,e,t,function(r,s){r||o.formatResults(s)?i(r,s):R(n,e,t,i)})},N.prototype.composeModel=function(e,t,i){var n=o.getSwaggerVersion(e),s=function(r,n){var s;return r?i(r):o.getErrorCount(n)>0?j(n,i):(s=w(e),n={errors:[],warnings:[]},E(s,n),s.definitions[t]?o.getErrorCount(n)>0?j(n,i):void i(void 0,b(s,t)):i())};switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("apiDeclaration is required");if(!r.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(r.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(r.isUndefined(t))throw new Error("modelRef is required")}if(r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");if("#"!==t.charAt(0)){if("1.2"!==this.version)throw new Error("modelRef must be a JSON Pointer");t="#/models/"+t}"1.2"===n?q(this,"apiDeclaration.json",e,s):this.validate(e,s)},N.prototype.validateModel=function(e,t,i,n){switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("apiDeclaration is required");if(!r.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(r.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(r.isUndefined(t))throw new Error("modelRef is required")}if(r.isUndefined(i))throw new Error("data is required");if(r.isUndefined(n))throw new Error("callback is required");if(!r.isFunction(n))throw new TypeError("callback must be a function");var o=this;this.composeModel(e,t,function(e,t){if(e)return n(e);q(o,t,i,n)})},N.prototype.resolve=function(e,t,i){var n,a=function(e){return r.isString(t)?i(void 0,d(e).get(s.pathFromPtr(t))):i(void 0,e)};if(r.isUndefined(e))throw new Error("document is required");if(!r.isPlainObject(e))throw new TypeError("document must be an object");if(2===arguments.length&&(i=arguments[1],t=void 0),!r.isUndefined(t)&&!r.isString(t))throw new TypeError("ptr must be a JSON Pointer string");if(r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");if("1.2"===(n=w(e)).swaggerVersion)throw new Error("Swagger 1.2 is not supported");if(n.resolved)return a(n.resolved);this.validate(e,function(e,t){return e?i(e):o.getErrorCount(t)>0?j(t,i):a(n.resolved)})},N.prototype.convert=function(e,t,i,n){var s=function(e,t){n(void 0,p(e,t))};if("1.2"!==this.version)throw new Error("Specification#convert only works for Swagger 1.2");if(r.isUndefined(e))throw new Error("resourceListing is required");if(!r.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(r.isUndefined(t)&&(t=[]),!r.isArray(t))throw new TypeError("apiDeclarations must be an array");if(arguments.length<4&&(n=arguments[arguments.length-1]),r.isUndefined(n))throw new Error("callback is required");if(!r.isFunction(n))throw new TypeError("callback must be a function");!0===i?s(e,t):this.validate(e,t,function(i,r){return i?n(i):o.getErrorCount(r)>0?j(r,n):void s(e,t)})},t.exports.v1=t.exports.v1_2=new N("1.2"),t.exports.v2=t.exports.v2_0=new N("2.0")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../schemas/1.2/apiDeclaration.json":4,"../schemas/1.2/authorizationObject.json":5,"../schemas/1.2/dataType.json":6,"../schemas/1.2/dataTypeBase.json":7,"../schemas/1.2/infoObject.json":8,"../schemas/1.2/modelsObject.json":9,"../schemas/1.2/oauth2GrantType.json":10,"../schemas/1.2/operationObject.json":11,"../schemas/1.2/parameterObject.json":12,"../schemas/1.2/resourceListing.json":13,"../schemas/1.2/resourceObject.json":14,"../schemas/2.0/schema.json":15,"./helpers":1,"./validators":3}],3:[function(e,t,i){(function(i){"use strict";var r="undefined"!=typeof window?window._:void 0!==i?i._:null,n=e("./helpers"),o=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/,s=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}):([0-9]{2}))$/,a=t.exports.isValidDate=function(e){var t,i,n;return!!r.isDate(e)||(r.isString(e)||(e=e.toString()),null!==(i=o.exec(e))&&(t=i[3],!((n=i[2])<"01"||n>"12"||t<"01"||t>"31")))},p=t.exports.isValidDateTime=function(e){var t,i,n,o,p,d,f,c,m;if(r.isDate(e))return!0;if(r.isString(e)||(e=e.toString()),d=e.toLowerCase().split("t"),i=d[0],n=d.length>1?d[1]:void 0,!a(i))return!1;if(null===(o=s.exec(n)))return!1;t=o[1],p=o[2],f=o[3],"z"===o[5]?(c=0,m=0):(c=Number(o[6]),m=Number(o[7]));var u=0===m||15===m||30===m||45===m;return!(t>"23"||p>"59"||f>"59"||c>14||c<-12||!u)},d=function(e,t){var i=new Error(t);throw i.code=e,i.failedValidation=!0,i};t.exports.validateAgainstSchema=function(e,t,i){var o=function(e){var t=["additionalProperties","items"].indexOf(e.path[e.path.length-1])>-1?"schema":e.path[e.path.length-2];if(["ANY_OF_MISSING","ONE_OF_MISSING"].indexOf(e.code)>-1){switch(t){case"parameters":t="parameter";break;case"responses":t="response";break;case"schema":t+=" "+e.path[e.path.length-1]}e.message="Not a valid "+t+" definition"}delete e.params,delete e.schemaId,e.inner&&r.each(e.inner,function(e){o(e)})},s=r.isPlainObject(e)?r.cloneDeep(e):e;if(r.isUndefined(i)&&(i=n.createJsonValidator([s])),!i.validate(t,s))try{d("SCHEMA_VALIDATION_FAILED","Failed schema validation")}catch(e){throw e.results={errors:r.map(i.getLastErrors(),function(e){return o(e),e}),warnings:[]},e}};var f=t.exports.validateArrayType=function(e){"array"===e.type&&r.isUndefined(e.items)&&d("OBJECT_MISSING_REQUIRED_PROPERTY","Missing required property: items")};t.exports.validateContentType=function(e,t,i){var n="function"==typeof i.end,o=n?i.getHeader("content-type"):i.headers["content-type"],s=r.map(r.union(e,t),function(e){return e.split(";")[0]});if(o||(o=n?"text/plain":"application/octet-stream"),o=o.split(";")[0],s.length>0&&(n||-1!==["POST","PUT"].indexOf(i.method))&&-1===s.indexOf(o))throw new Error("Invalid content type ("+o+"). These are valid: "+s.join(", "))};var c=t.exports.validateEnum=function(e,t){r.isUndefined(t)||r.isUndefined(e)||-1!==t.indexOf(e)||d("ENUM_MISMATCH","Not an allowable value ("+t.join(", ")+"): "+e)},m=t.exports.validateMaximum=function(e,t,i,n){var o,s,a=!0===n?"MAXIMUM_EXCLUSIVE":"MAXIMUM";r.isUndefined(n)&&(n=!1),"integer"===i?s=parseInt(e,10):"number"===i&&(s=parseFloat(e)),r.isUndefined(t)||(o=parseFloat(t),n&&s>=o?d(a,"Greater than or equal to the configured maximum ("+t+"): "+e):s>o&&d(a,"Greater than the configured maximum ("+t+"): "+e))},u=t.exports.validateMaxItems=function(e,t){!r.isUndefined(t)&&e.length>t&&d("ARRAY_LENGTH_LONG","Array is too long ("+e.length+"), maximum "+t)},l=t.exports.validateMaxLength=function(e,t){!r.isUndefined(t)&&e.length>t&&d("MAX_LENGTH","String is too long ("+e.length+" chars), maximum "+t)},h=t.exports.validateMaxProperties=function(e,t){var i=r.isPlainObject(e)?Object.keys(e).length:0;!r.isUndefined(t)&&i>t&&d("MAX_PROPERTIES","Number of properties is too many ("+i+" properties), maximum "+t)},y=t.exports.validateMinimum=function(e,t,i,n){var o,s,a=!0===n?"MINIMUM_EXCLUSIVE":"MINIMUM";r.isUndefined(n)&&(n=!1),"integer"===i?s=parseInt(e,10):"number"===i&&(s=parseFloat(e)),r.isUndefined(t)||(o=parseFloat(t),n&&s<=o?d(a,"Less than or equal to the configured minimum ("+t+"): "+e):s1?"s are":" is")+" invalid:"),r.each(t.getLastErrors(),function(e){console.error(" "+(r.isArray(e.path)?n.pathToPtr(e.path):e.path)+": "+e.message)}),new Error("Unable to create validator due to invalid JSON Schema");return t},t.exports.formatResults=function(e){return e&&(e=e.errors.length+e.warnings.length+r.reduce(e.apiDeclarations,function(e,t){return t&&(e+=t.errors.length+t.warnings.length),e},0)>0?e:void 0),e};var f=t.exports.getErrorCount=function(e){var t=0;return e&&(t=e.errors.length,r.each(e.apiDeclarations,function(e){e&&(t+=e.errors.length)})),t},c=function(e){return e&&!r.isString(e)&&-1===(e=e.toString()).indexOf(".")&&(e+=".0"),e};t.exports.getSpec=function(t,i){var n;if(t=c(t),n=d[t],r.isUndefined(n))switch(t){case"1.2":n=e("../lib/specs").v1_2;break;case"2.0":n=e("../lib/specs").v2_0;break;default:if(!0===i)throw new Error("Unsupported Swagger version: "+t)}return n},t.exports.getSwaggerVersion=function(e){return r.isPlainObject(e)?c(e.swaggerVersion||e.swagger):void 0},t.exports.printValidationResults=function(e,t,i,o,s){var a=f(o)>0?console.error:console.log,p=function(e,t){return 1===t?e:e+"s"},d=function(e,t,i){e&&(a(e+":"),a()),r.each(t,function(e){a(new Array(i+1).join(" ")+n.pathToPtr(e.path)+": "+e.message),e.inner&&d(void 0,e.inner,i+2)}),e&&a()},c=0,m=0;a(),o.errors.length>0&&(c+=o.errors.length,d("API Errors",o.errors,2)),o.warnings.length>0&&(m+=o.warnings.length,d("API Warnings",o.warnings,2)),o.apiDeclarations&&o.apiDeclarations.forEach(function(e,t){if(e){var r=i[t].resourcePath||t;e.errors.length>0&&(c+=e.errors.length,d(" API Declaration ("+r+") Errors",e.errors,4)),e.warnings.length>0&&(m+=e.warnings.length,d(" API Declaration ("+r+") Warnings",e.warnings,4))}}),s&&a(c>0?c+" "+p("error",c)+" and "+m+" "+p("warning",m):"Validation succeeded but with "+m+" "+p("warning",m)),a()},t.exports.swaggerOperationMethods=["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":16}],2:[function(e,t,i){(function(i){"use strict";var r="undefined"!=typeof window?window._:void 0!==i?i._:null,n="undefined"!=typeof window?window.async:void 0!==i?i.async:null,o=e("./helpers"),s="undefined"!=typeof window?window.JsonRefs:void 0!==i?i.JsonRefs:null,a="undefined"!=typeof window?window.SparkMD5:void 0!==i?i.SparkMD5:null,p="undefined"!=typeof window?window.SwaggerConverter.convert:void 0!==i?i.SwaggerConverter.convert:null,d="undefined"!=typeof window?window.traverse:void 0!==i?i.traverse:null,f=e("./validators"),c="undefined"!=typeof window?window.jsyaml:void 0!==i?i.jsyaml:null;r.isPlainObject(p)&&(p=i.SwaggerConverter.convert);var m={},u=function(e,t){return"1.2"!==e?t:t.replace("#/models/","")},l=function(e){var t=r.cloneDeep(e);return t.$ref="#/models/"+e.$ref,t},h=r.map(o.swaggerOperationMethods,function(e){return e.toLowerCase()}),y=function(e){return["relative","remote"].indexOf(e.type)>-1},g=function(e,t,i,r){r.push({code:e,message:t,path:i})},v=function(e,t,i,n,a){var p,d,f,c,m,u,l=!0,h=o.getSwaggerVersion(e.resolved),y=r.isArray(t)?t:s.pathFromPtr(t),v=r.isArray(t)?s.pathToPtr(t):t,b=r.isArray(i)?i:s.pathFromPtr(i),$=r.isArray(i)?s.pathToPtr(i):i;if(d=e.definitions[v],u=y[0],p="securityDefinitions"===u?"SECURITY_DEFINITION":u.substring(0,u.length-1).toUpperCase(),f="1.2"===h?y[y.length-1]:v,m="securityDefinitions"===u?"Security definition":p.charAt(0)+p.substring(1).toLowerCase(),["authorizations","securityDefinitions"].indexOf(y[0])>-1&&"scopes"===y[2]&&(p+="_SCOPE",m+=" scope"),r.isUndefined(d)&&-1===["AUTHORIZATION_SCOPE","SECURITY_DEFINITION_SCOPE"].indexOf(p))for(c=1;c0&&(i.allOf=[],r.each(a.lineage,function(t){i.allOf.push(b(e,t))})),delete i.subTypes,r.each(i.properties,function(t,i){var o=n.properties[i];r.each(["maximum","minimum"],function(e){r.isString(t[e])&&(t[e]=parseFloat(t[e]))}),r.each(s.findRefs(o,{includeInvalid:!0,refPreProcessor:l}),function(i,r){var n=e.definitions[i.uri],o=s.pathFromPtr(r);n.lineage.length>0?d(t).set(o,b(e,i.uri)):d(t).set(o.concat("title"),"Composed "+u(e.swaggerVersion,i.uri))})})),i=d(i).map(function(e){"id"===this.key&&r.isString(e)&&this.remove()}),i.title=o,i},$=function(e,t,i,r,n){g("UNUSED_"+t,i+" is defined but is not used: "+e,r,n)},w=function(e){var t=a.hash(JSON.stringify(e)),i=m[t]||r.find(m,function(e){return e.resolvedId===t});return i||(i=m[t]={definitions:{},original:e,resolved:void 0,swaggerVersion:o.getSwaggerVersion(e)}),i},j=function(e,t){var i=new Error("The Swagger document(s) are invalid");i.errors=e.errors,i.failedValidation=!0,i.warnings=e.warnings,e.apiDeclarations&&(i.apiDeclarations=e.apiDeclarations),t(i)},x=function(e){var t=e.match(/\{(.*?)\}/g),i=[],n=e;return t&&r.each(t,function(e,t){n=n.replace(e,"{"+t+"}"),i.push(e.replace(/[{}]/g,""))}),{path:n,args:i}},P=function(e,t,i,n,o,s){!r.isUndefined(e)&&e.indexOf(t)>-1&&g("DUPLICATE_"+i,n+" already defined: "+t,o,s)},I=function(e,t,i,r,n){try{f.validateSchemaConstraints(e.swaggerVersion,t,i,void 0)}catch(e){n||g(e.code,e.message,e.path,r.errors)}},O=function(e,t){var i=e.swaggerVersion,n=function(t,i){var r=s.pathToPtr(t),n=e.definitions[r];return n||(n=e.definitions[r]={inline:i||!1,references:[]},["definitions","models"].indexOf(s.pathFromPtr(r)[0])>-1&&(n.cyclical=!1,n.lineage=void 0,n.parents=[])),n},o=function(e){return"1.2"===i?s.pathFromPtr(e).pop():e},a={filter:"local",includeInvalid:!0},p=function(t,i,n){var o=e.definitions[i||t];o&&r.each(o.parents,function(e){n.push(e),t!==e&&p(t,e,n)})},f="1.2"===i?"authorizations":"securityDefinitions",c="1.2"===i?"models":"definitions";switch(r.each(e.resolved[f],function(e,o){var s=[f,o];("1.2"!==i||e.type)&&(n(s),r.reduce(e.scopes,function(e,r,o){var a="1.2"===i?r.scope:o,p=s.concat(["scopes",o.toString()]);return n(s.concat(["scopes",a])).scopePath=p,P(e,a,"AUTHORIZATION_SCOPE_DEFINITION","Authorization scope definition","1.2"===i?p.concat("scope"):p,t.warnings),e.push(a),e},[]))}),r.each(e.resolved[c],function(o,a){var p=[c,a],f=n(p);if("1.2"===i&&a!==o.id&&g("MODEL_ID_MISMATCH","Model id does not match id in models object: "+o.id,p.concat("id"),t.errors),r.isUndefined(f.lineage))switch(i){case"1.2":r.each(o.subTypes,function(i,r){var o=["models",i],a=s.pathToPtr(o),d=e.definitions[a],f=p.concat(["subTypes",r.toString()]);!d&&e.resolved[c][i]&&(d=n(o)),v(e,o,f,t)&&d.parents.push(s.pathToPtr(p))});break;default:r.each(e.original[c][a].allOf,function(t,i){var o,a=!1;r.isUndefined(t.$ref)||y(s.getRefDetails(t))?(a=!0,o=p.concat(["allOf",i.toString()])):o=s.pathFromPtr(t.$ref),r.isUndefined(d(e.resolved).get(o))||(n(o,a),f.parents.push(s.pathToPtr(o)))})}}),i){case"2.0":r.each(e.resolved.parameters,function(i,r){var o=["parameters",r];n(o),I(e,i,o,t)}),r.each(e.resolved.responses,function(i,r){var o=["responses",r];n(o),I(e,i,o,t)})}r.each(e.definitions,function(n,a){var f,c,m,u=s.pathFromPtr(a),l=d(e.original).get(u),h=u[0],y=h.substring(0,h.length-1).toUpperCase(),v=y.charAt(0)+y.substring(1).toLowerCase();-1!==["definitions","models"].indexOf(h)&&(f=[],c=[],m=n.lineage,r.isUndefined(m)&&(p(a,void 0,m=[]),m.reverse(),n.lineage=r.cloneDeep(m),n.cyclical=m.length>1&&m[0]===a),n.parents.length>1&&"1.2"===i&&g("MULTIPLE_"+y+"_INHERITANCE","Child "+y.toLowerCase()+" is sub type of multiple models: "+r.map(n.parents,function(e){return o(e)}).join(" && "),u,t.errors),n.cyclical&&g("CYCLICAL_"+y+"_INHERITANCE",v+" has a circular inheritance: "+r.map(m,function(e){return o(e)}).join(" -> ")+" -> "+o(a),u.concat("1.2"===i?"subTypes":"allOf"),t.errors),r.each(m.slice(n.cyclical?1:0),function(t){var i=d(e.resolved).get(s.pathFromPtr(t));r.each(Object.keys(i.properties||{}),function(e){-1===c.indexOf(e)&&c.push(e)})}),I(e,l,u,t),r.each(l.properties,function(i,n){var o=u.concat(["properties",n]);r.isUndefined(i)||(I(e,i,o,t),c.indexOf(n)>-1?g("CHILD_"+y+"_REDECLARES_PROPERTY","Child "+y.toLowerCase()+" declares property already declared by ancestor: "+n,o,t.errors):f.push(n))}),r.each(l.required||[],function(e,r){var n="1.2"===i?"Model":"Definition";-1===c.indexOf(e)&&-1===f.indexOf(e)&&g("MISSING_REQUIRED_"+n.toUpperCase()+"_PROPERTY",n+" requires property but it is not defined: "+e,u.concat(["required",r.toString()]),t.errors)}))}),"1.2"===e.swaggerVersion&&(a.refPreProcessor=l),r.each(s.findRefs(e.original,a),function(i,r){v(e,i.uri,r,t)}),r.each(e.referencesMetadata,function(i,r){y(i)&&!0===i.missing&&t.errors.push({code:"UNRESOLVABLE_REFERENCE",message:"Reference could not be resolved: "+u(e.swaggerVersion,i.uri),path:s.pathFromPtr(r).concat("$ref")})})},E=function(e,t,i,n){var o="1.2"===e.swaggerVersion?"AUTHORIZATION":"SECURITY_DEFINITION",s="AUTHORIZATION"===o?"Authorization":"Security definition";"1.2"===e.swaggerVersion?r.reduce(t,function(t,a,p){var d=["authorizations",p],f=i.concat([p]);return v(e,d,f,n)&&r.reduce(a,function(t,i,r){var a=f.concat(r.toString(),"scope"),p=d.concat(["scopes",i.scope]);return P(t,i.scope,o+"_SCOPE_REFERENCE",s+" scope reference",a,n.warnings),v(e,p,a,n),t.concat(i.scope)},[]),t.concat(p)},[]):r.reduce(t,function(t,a,p){return r.each(a,function(a,d){var f=["securityDefinitions",d],c=i.concat(p.toString(),d);P(t,d,o+"_REFERENCE",s+" reference",c,n.warnings),t.push(d),v(e,f,c,n)&&r.each(a,function(t,i){var r=f.concat(["scopes",t]);v(e,r,c.concat(i.toString()),n)})}),t},[])},T=function(e,t){var i=w(e),n=o.getSwaggerVersion(e),p={includeInvalid:!0,loaderOptions:{processContent:function(e,t){t(void 0,c.safeLoad(e.text))}}};i.resolved?t():("1.2"===n&&(p.refPreProcessor=l),s.resolveRefs(e,p).then(function(e){!function(e){function t(i,n,o){function s(e,r){o.push(r),t(i,e,o),o.pop()}-1===i.indexOf(n)?(i.push(n),r.isArray(n)?r.each(n,function(e,t){s(e,t.toString())}):r.isPlainObject(n)&&r.forOwn(n,function(e,t){s(e,t.toString())})):r.set(e,o,{}),i.pop()}t([],e,[])}(e.resolved),r.each(e.refs,function(t,i){t.circular&&r.set(e.resolved,s.pathFromPtr(i),{})}),i.referencesMetadata=e.refs,i.resolved=e.resolved,i.resolvedId=a.hash(JSON.stringify(e.resolved)),t()}).catch(t))},S=function(e,t,i,n){var s=r.isString(t)?e.validators[t]:o.createJsonValidator();o.registerCustomFormats(i);try{f.validateAgainstSchema(t,i,s)}catch(e){return e.failedValidation?n(void 0,e.results):n(e)}T(i,function(e){return n(e)})},A=function(e,t){r.each(e.definitions,function(i,r){var n=s.pathFromPtr(r),o=n[0].substring(0,n[0].length-1),a="1.2"===e.swaggerVersion?n[n.length-1]:r,p="securityDefinition"===o?"SECURITY_DEFINITION":o.toUpperCase(),d="securityDefinition"===o?"Security definition":o.charAt(0).toUpperCase()+o.substring(1);0!==i.references.length||i.inline||(i.scopePath&&(p+="_SCOPE",d+=" scope",n=i.scopePath),$(a,p,d,n,t.warnings))})},q=function(e,t,i,n,o,s,a){var p=function(t){g("INVALID_PARAMETER_COMBINATION","API cannot have a a body parameter and a "+("1.2"===e.version?"form":"formData")+" parameter",t,s.errors)},d=[],f=!1,c=!1;r.reduce(n,function(n,a,m){var u=o.concat(["parameters",m.toString()]);if(!r.isUndefined(a))return P(n,a.name,"PARAMETER","Parameter",u.concat("name"),s.errors),"body"===a.paramType||"body"===a.in?(!0===f?g("DUPLICATE_API_BODY_PARAMETER","API has more than one body parameter",u,s.errors):!0===c&&p(u),f=!0):"form"===a.paramType||"formData"===a.in?(!0===f&&p(u),c=!0):"path"!==a.paramType&&"path"!==a.in||(-1===i.args.indexOf(a.name)&&g("UNRESOLVABLE_API_PATH_PARAMETER","API path parameter could not be resolved: "+a.name,u.concat("name"),s.errors),d.push(a.name)),-1===e.primitives.indexOf(a.type)&&"1.2"===e.version&&v(t,"#/models/"+a.type,u.concat("type"),s),I(t,a,u,s,a.skipErrors),n.concat(a.name)},[]),(r.isUndefined(a)||!1===a)&&r.each(r.difference(i.args,d),function(e){g("MISSING_API_PATH_PARAMETER","API requires path parameter but it is not defined: "+e,"1.2"===t.swaggerVersion?o.slice(0,2).concat("path"):o,s.errors)})},M=function(e,t,i,n){var o=[],s=w(t),a=[],p={errors:[],warnings:[],apiDeclarations:[]};a=r.reduce(t.apis,function(e,t,i){return P(e,t.path,"RESOURCE_PATH","Resource path",["apis",i.toString(),"path"],p.errors),e.push(t.path),e},[]),O(s,p),o=r.reduce(i,function(t,i,n){var d=p.apiDeclarations[n]={errors:[],warnings:[]},f=w(i);return P(t,i.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],d.errors),-1===o.indexOf(i.resourcePath)&&(!function(e,t,i,n,o,s){r.isUndefined(e)||-1!==e.indexOf(t)||g("UNRESOLVABLE_"+i,n+" could not be resolved: "+t,o,s)}(a,i.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],d.errors),t.push(i.resourcePath)),O(f,d),r.reduce(i.apis,function(t,i,n){var o=["apis",n.toString()],a=x(i.path);return t.indexOf(a.path)>-1?g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+i.path,o.concat("path"),d.errors):t.push(a.path),r.reduce(i.operations,function(t,i,n){var p=o.concat(["operations",n.toString()]);return P(t,i.method,"OPERATION_METHOD","Operation method",p.concat("method"),d.errors),t.push(i.method),-1===e.primitives.indexOf(i.type)&&"1.2"===e.version&&v(f,"#/models/"+i.type,p.concat("type"),d),E(s,i.authorizations,p.concat("authorizations"),d),I(f,i,p,d),q(e,f,a,i.parameters,p,d),r.reduce(i.responseMessages,function(e,t,i){var r=p.concat(["responseMessages",i.toString()]);return P(e,t.code,"RESPONSE_MESSAGE_CODE","Response message code",r.concat(["code"]),d.errors),t.responseModel&&v(f,"#/models/"+t.responseModel,r.concat("responseModel"),d),e.concat(t.code)},[]),t},[]),t},[]),A(f,d),t},[]),A(s,p),r.each(r.difference(a,o),function(e){var i=a.indexOf(e);$(t.apis[i].path,"RESOURCE_PATH","Resource path",["apis",i.toString(),"path"],p.errors)}),n(void 0,p)},U=function(e,t,i,n){var s=function(e,t){n(e,o.formatResults(t))};"1.2"===e.version?M(e,t,i,s):function(e,t,i){var n=w(t),o={errors:[],warnings:[]};O(n,o),E(n,t.security,["security"],o),r.reduce(n.resolved.paths,function(t,i,s){var a=["paths",s],p=x(s);return t.indexOf(p.path)>-1&&g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+s,a,o.errors),q(e,n,p,i.parameters,a,o,!0),r.each(i,function(t,s){var d=[],f=a.concat(s),c=[];-1!==h.indexOf(s)&&(E(n,t.security,f.concat("security"),o),r.each(t.parameters,function(e){r.isUndefined(e)||(d.push(e),c.push(e.name+":"+e.in))}),r.each(i.parameters,function(e){var t=r.cloneDeep(e);t.skipErrors=!0,-1===c.indexOf(e.name+":"+e.in)&&d.push(t)}),q(e,n,p,d,f,o),r.each(t.responses,function(e,t){r.isUndefined(e)||I(n,e,f.concat("responses",t),o)}))}),t.concat(p.path)},[]),A(n,o),i(void 0,o)}(e,t,s)},D=function(t){var i=this,n=function(e,t){return r.reduce(t,function(e,t,i){return e[i]=o.createJsonValidator(t),e},{})},s=function(e){var t=r.cloneDeep(i.schemas[e]);return t.id=e,t},a=["string","number","boolean","integer","array"];switch(t){case"1.2":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md",this.primitives=r.union(a,["void","File"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2",this.schemas={"apiDeclaration.json":e("../schemas/1.2/apiDeclaration.json"),"authorizationObject.json":e("../schemas/1.2/authorizationObject.json"),"dataType.json":e("../schemas/1.2/dataType.json"),"dataTypeBase.json":e("../schemas/1.2/dataTypeBase.json"),"infoObject.json":e("../schemas/1.2/infoObject.json"),"modelsObject.json":e("../schemas/1.2/modelsObject.json"),"oauth2GrantType.json":e("../schemas/1.2/oauth2GrantType.json"),"operationObject.json":e("../schemas/1.2/operationObject.json"),"parameterObject.json":e("../schemas/1.2/parameterObject.json"),"resourceListing.json":e("../schemas/1.2/resourceListing.json"),"resourceObject.json":e("../schemas/1.2/resourceObject.json")},this.validators=n(0,{"apiDeclaration.json":r.map(["dataTypeBase.json","modelsObject.json","oauth2GrantType.json","authorizationObject.json","parameterObject.json","operationObject.json","apiDeclaration.json"],s),"resourceListing.json":r.map(["resourceObject.json","infoObject.json","oauth2GrantType.json","authorizationObject.json","resourceListing.json"],s)});break;case"2.0":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md",this.primitives=r.union(a,["file"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0",this.schemas={"schema.json":e("../schemas/2.0/schema.json")},this.validators=n(0,{"schema.json":[s("schema.json")]});break;default:throw new Error(t+" is an unsupported Swagger specification version")}this.version=t};D.prototype.validate=function(e,t,i){switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("resourceListing is required");if(!r.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(r.isUndefined(t))throw new Error("apiDeclarations is required");if(!r.isArray(t))throw new TypeError("apiDeclarations must be an array");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object")}if("2.0"===this.version&&(i=arguments[1]),r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");"2.0"===this.version&&(t=[]);var s=this;!function(e,t,i,o){S(e,"1.2"===e.version?"resourceListing.json":"schema.json",t,function(t,s){if(t)return o(t);s||"1.2"!==e.version?o(void 0,s):(s={errors:[],warnings:[],apiDeclarations:[]},n.map(i,function(t,i){S(e,"apiDeclaration.json",t,i)},function(e,t){if(e)return o(e);r.each(t,function(e,t){s.apiDeclarations[t]=e}),o(void 0,s)}))})}(this,e,t,function(r,n){r||o.formatResults(n)?i(r,n):U(s,e,t,i)})},D.prototype.composeModel=function(e,t,i){var n=o.getSwaggerVersion(e),s=function(r,n){var s;return r?i(r):o.getErrorCount(n)>0?j(n,i):(s=w(e),n={errors:[],warnings:[]},O(s,n),s.definitions[t]?o.getErrorCount(n)>0?j(n,i):void i(void 0,b(s,t)):i())};switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("apiDeclaration is required");if(!r.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(r.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(r.isUndefined(t))throw new Error("modelRef is required")}if(r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");if("#"!==t.charAt(0)){if("1.2"!==this.version)throw new Error("modelRef must be a JSON Pointer");t="#/models/"+t}"1.2"===n?S(this,"apiDeclaration.json",e,s):this.validate(e,s)},D.prototype.validateModel=function(e,t,i,n){switch(this.version){case"1.2":if(r.isUndefined(e))throw new Error("apiDeclaration is required");if(!r.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(r.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(r.isUndefined(e))throw new Error("swaggerObject is required");if(!r.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(r.isUndefined(t))throw new Error("modelRef is required")}if(r.isUndefined(i))throw new Error("data is required");if(r.isUndefined(n))throw new Error("callback is required");if(!r.isFunction(n))throw new TypeError("callback must be a function");var o=this;this.composeModel(e,t,function(e,t){if(e)return n(e);S(o,t,i,n)})},D.prototype.resolve=function(e,t,i){var n,a=function(e){return r.isString(t)?i(void 0,d(e).get(s.pathFromPtr(t))):i(void 0,e)};if(r.isUndefined(e))throw new Error("document is required");if(!r.isPlainObject(e))throw new TypeError("document must be an object");if(2===arguments.length&&(i=arguments[1],t=void 0),!r.isUndefined(t)&&!r.isString(t))throw new TypeError("ptr must be a JSON Pointer string");if(r.isUndefined(i))throw new Error("callback is required");if(!r.isFunction(i))throw new TypeError("callback must be a function");if("1.2"===(n=w(e)).swaggerVersion)throw new Error("Swagger 1.2 is not supported");if(n.resolved)return a(n.resolved);this.validate(e,function(e,t){return e?i(e):o.getErrorCount(t)>0?j(t,i):a(n.resolved)})},D.prototype.convert=function(e,t,i,n){var s=function(e,t){n(void 0,p(e,t))};if("1.2"!==this.version)throw new Error("Specification#convert only works for Swagger 1.2");if(r.isUndefined(e))throw new Error("resourceListing is required");if(!r.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(r.isUndefined(t)&&(t=[]),!r.isArray(t))throw new TypeError("apiDeclarations must be an array");if(arguments.length<4&&(n=arguments[arguments.length-1]),r.isUndefined(n))throw new Error("callback is required");if(!r.isFunction(n))throw new TypeError("callback must be a function");!0===i?s(e,t):this.validate(e,t,function(i,r){return i?n(i):o.getErrorCount(r)>0?j(r,n):void s(e,t)})},t.exports.v1=t.exports.v1_2=new D("1.2"),t.exports.v2=t.exports.v2_0=new D("2.0")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../schemas/1.2/apiDeclaration.json":4,"../schemas/1.2/authorizationObject.json":5,"../schemas/1.2/dataType.json":6,"../schemas/1.2/dataTypeBase.json":7,"../schemas/1.2/infoObject.json":8,"../schemas/1.2/modelsObject.json":9,"../schemas/1.2/oauth2GrantType.json":10,"../schemas/1.2/operationObject.json":11,"../schemas/1.2/parameterObject.json":12,"../schemas/1.2/resourceListing.json":13,"../schemas/1.2/resourceObject.json":14,"../schemas/2.0/schema.json":15,"./helpers":1,"./validators":3}],3:[function(e,t,i){(function(i){"use strict";var r="undefined"!=typeof window?window._:void 0!==i?i._:null,n=e("./helpers"),o=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/,s=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}):([0-9]{2}))$/,a=t.exports.isValidDate=function(e){var t,i,n;return!!r.isDate(e)||(r.isString(e)||(e=e.toString()),null!==(i=o.exec(e))&&(t=i[3],!((n=i[2])<"01"||n>"12"||t<"01"||t>"31")))},p=t.exports.isValidDateTime=function(e){var t,i,n,o,p,d,f,c,m;if(r.isDate(e))return!0;if(r.isString(e)||(e=e.toString()),d=e.toLowerCase().split("t"),i=d[0],n=d.length>1?d[1]:void 0,!a(i))return!1;if(null===(o=s.exec(n)))return!1;t=o[1],p=o[2],f=o[3],"z"===o[5]?(c=0,m=0):(c=Number(o[6]),m=Number(o[7]));return!(t>"23"||p>"59"||f>"59"||c>14||c<-12||0!==m&&15!==m&&30!==m&&45!==m)},d=function(e,t){var i=new Error(t);throw i.code=e,i.failedValidation=!0,i};t.exports.validateAgainstSchema=function(e,t,i){var o=function(e){var t=["additionalProperties","items"].indexOf(e.path[e.path.length-1])>-1?"schema":e.path[e.path.length-2];if(["ANY_OF_MISSING","ONE_OF_MISSING"].indexOf(e.code)>-1){switch(t){case"parameters":t="parameter";break;case"responses":t="response";break;case"schema":t+=" "+e.path[e.path.length-1]}e.message="Not a valid "+t+" definition"}delete e.params,delete e.schemaId,e.inner&&r.each(e.inner,function(e){o(e)})},s=r.isPlainObject(e)?r.cloneDeep(e):e;r.isUndefined(i)&&(i=n.createJsonValidator([s]));if(!i.validate(t,s))try{d("SCHEMA_VALIDATION_FAILED","Failed schema validation")}catch(e){throw e.results={errors:r.map(i.getLastErrors(),function(e){return o(e),e}),warnings:[]},e}};var f=t.exports.validateArrayType=function(e){"array"===e.type&&r.isUndefined(e.items)&&d("OBJECT_MISSING_REQUIRED_PROPERTY","Missing required property: items")};t.exports.validateContentType=function(e,t,i){var n="function"==typeof i.end,o=n?i.getHeader("content-type"):i.headers["content-type"],s=r.map(r.union(e,t),function(e){return e.split(";")[0]});if(o||(o=n?"text/plain":"application/octet-stream"),o=o.split(";")[0],s.length>0&&(n||-1!==["POST","PUT"].indexOf(i.method))&&-1===s.indexOf(o))throw new Error("Invalid content type ("+o+"). These are valid: "+s.join(", "))};var c=t.exports.validateEnum=function(e,t){r.isUndefined(t)||r.isUndefined(e)||-1!==t.indexOf(e)||d("ENUM_MISMATCH","Not an allowable value ("+t.join(", ")+"): "+e)},m=t.exports.validateMaximum=function(e,t,i,n){var o,s,a=!0===n?"MAXIMUM_EXCLUSIVE":"MAXIMUM";r.isUndefined(n)&&(n=!1),"integer"===i?s=parseInt(e,10):"number"===i&&(s=parseFloat(e)),r.isUndefined(t)||(o=parseFloat(t),n&&s>=o?d(a,"Greater than or equal to the configured maximum ("+t+"): "+e):s>o&&d(a,"Greater than the configured maximum ("+t+"): "+e))},u=t.exports.validateMaxItems=function(e,t){!r.isUndefined(t)&&e.length>t&&d("ARRAY_LENGTH_LONG","Array is too long ("+e.length+"), maximum "+t)},l=t.exports.validateMaxLength=function(e,t){!r.isUndefined(t)&&e.length>t&&d("MAX_LENGTH","String is too long ("+e.length+" chars), maximum "+t)},h=t.exports.validateMaxProperties=function(e,t){var i=r.isPlainObject(e)?Object.keys(e).length:0;!r.isUndefined(t)&&i>t&&d("MAX_PROPERTIES","Number of properties is too many ("+i+" properties), maximum "+t)},y=t.exports.validateMinimum=function(e,t,i,n){var o,s,a=!0===n?"MINIMUM_EXCLUSIVE":"MINIMUM";r.isUndefined(n)&&(n=!1),"integer"===i?s=parseInt(e,10):"number"===i&&(s=parseFloat(e)),r.isUndefined(t)||(o=parseFloat(t),n&&s<=o?d(a,"Less than or equal to the configured minimum ("+t+"): "+e):s1?"s are":" is")+" invalid:"),n.each(t.getLastErrors(),function(e){console.error(" "+(n.isArray(e.path)?i.pathToPtr(e.path):e.path)+": "+e.message)}),new Error("Unable to create validator due to invalid JSON Schema");return t},t.exports.formatResults=function(e){return e&&(e=e.errors.length+e.warnings.length+n.reduce(e.apiDeclarations,function(e,t){return t&&(e+=t.errors.length+t.warnings.length),e},0)>0?e:void 0),e};var f=t.exports.getErrorCount=function(e){var t=0;return e&&(t=e.errors.length,n.each(e.apiDeclarations,function(e){e&&(t+=e.errors.length)})),t},l=function(e){return e&&!n.isString(e)&&-1===(e=e.toString()).indexOf(".")&&(e+=".0"),e};t.exports.getSpec=function(t,r){var i;if(t=l(t),i=c[t],n.isUndefined(i))switch(t){case"1.2":i=e("../lib/specs").v1_2;break;case"2.0":i=e("../lib/specs").v2_0;break;default:if(!0===r)throw new Error("Unsupported Swagger version: "+t)}return i},t.exports.getSwaggerVersion=function(e){return n.isPlainObject(e)?l(e.swaggerVersion||e.swagger):void 0},t.exports.printValidationResults=function(e,t,r,o,a){var s=f(o)>0?console.error:console.log,u=function(e,t){return 1===t?e:e+"s"},c=function(e,t,r){e&&(s(e+":"),s()),n.each(t,function(e){s(new Array(r+1).join(" ")+i.pathToPtr(e.path)+": "+e.message),e.inner&&c(void 0,e.inner,r+2)}),e&&s()},l=0,p=0;s(),o.errors.length>0&&(l+=o.errors.length,c("API Errors",o.errors,2)),o.warnings.length>0&&(p+=o.warnings.length,c("API Warnings",o.warnings,2)),o.apiDeclarations&&o.apiDeclarations.forEach(function(e,t){if(e){var n=r[t].resourcePath||t;e.errors.length>0&&(l+=e.errors.length,c(" API Declaration ("+n+") Errors",e.errors,4)),e.warnings.length>0&&(p+=e.warnings.length,c(" API Declaration ("+n+") Warnings",e.warnings,4))}}),a&&s(l>0?l+" "+u("error",l)+" and "+p+" "+u("warning",p):"Validation succeeded but with "+p+" "+u("warning",p)),s()},t.exports.swaggerOperationMethods=["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":204,"json-refs":57,lodash:89,traverse:108,"z-schema":189}],2:[function(e,t,r){(function(r){"use strict";var n=e("lodash"),i=e("async"),o=e("./helpers"),a=e("json-refs"),s=e("spark-md5"),u=e("swagger-converter"),c=e("traverse"),f=e("./validators"),l=e("js-yaml");n.isPlainObject(u)&&(u=r.SwaggerConverter.convert);var p={},d=function(e,t){return"1.2"!==e?t:t.replace("#/models/","")},h=function(e){var t=n.cloneDeep(e);return t.$ref="#/models/"+e.$ref,t},m=n.map(o.swaggerOperationMethods,function(e){return e.toLowerCase()}),y=function(e){return["relative","remote"].indexOf(e.type)>-1},g=function(e,t,r,n){n.push({code:e,message:t,path:r})},v=function(e,t,r,i,s){var u,c,f,l,p,d,h=!0,m=o.getSwaggerVersion(e.resolved),y=n.isArray(t)?t:a.pathFromPtr(t),v=n.isArray(t)?a.pathToPtr(t):t,_=n.isArray(r)?r:a.pathFromPtr(r),b=n.isArray(r)?a.pathToPtr(r):r;if(c=e.definitions[v],d=y[0],u="securityDefinitions"===d?"SECURITY_DEFINITION":d.substring(0,d.length-1).toUpperCase(),f="1.2"===m?y[y.length-1]:v,p="securityDefinitions"===d?"Security definition":u.charAt(0)+u.substring(1).toLowerCase(),["authorizations","securityDefinitions"].indexOf(y[0])>-1&&"scopes"===y[2]&&(u+="_SCOPE",p+=" scope"),n.isUndefined(c)&&-1===["AUTHORIZATION_SCOPE","SECURITY_DEFINITION_SCOPE"].indexOf(u))for(l=1;l0&&(r.allOf=[],n.each(s.lineage,function(t){r.allOf.push(_(e,t))})),delete r.subTypes,n.each(r.properties,function(t,r){var o=i.properties[r];n.each(["maximum","minimum"],function(e){n.isString(t[e])&&(t[e]=parseFloat(t[e]))}),n.each(a.findRefs(o,{includeInvalid:!0,refPreProcessor:h}),function(r,n){var i=e.definitions[r.uri],o=a.pathFromPtr(n);i.lineage.length>0?c(t).set(o,_(e,r.uri)):c(t).set(o.concat("title"),"Composed "+d(e.swaggerVersion,r.uri))})})),r=c(r).map(function(e){"id"===this.key&&n.isString(e)&&this.remove()}),r.title=o,r},b=function(e,t,r,n,i){g("UNUSED_"+t,r+" is defined but is not used: "+e,n,i)},E=function(e){var t=s.hash(JSON.stringify(e)),r=p[t]||n.find(p,function(e){return e.resolvedId===t});return r||(r=p[t]={definitions:{},original:e,resolved:void 0,swaggerVersion:o.getSwaggerVersion(e)}),r},w=function(e,t){var r=new Error("The Swagger document(s) are invalid");r.errors=e.errors,r.failedValidation=!0,r.warnings=e.warnings,e.apiDeclarations&&(r.apiDeclarations=e.apiDeclarations),t(r)},x=function(e){var t=e.match(/\{(.*?)\}/g),r=[],i=e;return t&&n.each(t,function(e,t){i=i.replace(e,"{"+t+"}"),r.push(e.replace(/[{}]/g,""))}),{path:i,args:r}},O=function(e){function t(r,i,o){function a(e,n){o.push(n),t(r,e,o),o.pop()}-1===r.indexOf(i)?(r.push(i),(n.isArray(i)||n.isPlainObject(i))&&n.each(i,function(e,t){a(e,t.toString())})):n.set(e,o,{}),r.pop()}t([],e,[])},j=function(e,t,r,i,o,a){!n.isUndefined(e)&&e.indexOf(t)>-1&&g("DUPLICATE_"+r,i+" already defined: "+t,o,a)},A=function(e,t,r,n,i){try{f.validateSchemaConstraints(e.swaggerVersion,t,r,void 0)}catch(e){i||g(e.code,e.message,e.path,n.errors)}},S=function(e,t){var r=e.swaggerVersion,i=function(t,r){var n=a.pathToPtr(t),i=e.definitions[n];return i||(i=e.definitions[n]={inline:r||!1,references:[]},["definitions","models"].indexOf(a.pathFromPtr(n)[0])>-1&&(i.cyclical=!1,i.lineage=void 0,i.parents=[])),i},o=function(e){return"1.2"===r?a.pathFromPtr(e).pop():e},s={filter:"local",includeInvalid:!0},u=function(t,r,i){var o=e.definitions[r||t];o&&n.each(o.parents,function(e){i.push(e),t!==e&&u(t,e,i)})},f="1.2"===r?"authorizations":"securityDefinitions",l="1.2"===r?"models":"definitions";switch(n.each(e.resolved[f],function(e,o){var a=[f,o];("1.2"!==r||e.type)&&(i(a),n.reduce(e.scopes,function(e,n,o){var s="1.2"===r?n.scope:o,u=a.concat(["scopes",o.toString()]);return i(a.concat(["scopes",s])).scopePath=u,j(e,s,"AUTHORIZATION_SCOPE_DEFINITION","Authorization scope definition","1.2"===r?u.concat("scope"):u,t.warnings),e.push(s),e},[]))}),n.each(e.resolved[l],function(o,s){var u=[l,s],f=i(u);if("1.2"===r&&s!==o.id&&g("MODEL_ID_MISMATCH","Model id does not match id in models object: "+o.id,u.concat("id"),t.errors),n.isUndefined(f.lineage))switch(r){case"1.2":n.each(o.subTypes,function(r,n){var o=["models",r],s=a.pathToPtr(o),c=e.definitions[s],f=u.concat(["subTypes",n.toString()]);!c&&e.resolved[l][r]&&(c=i(o)),v(e,o,f,t)&&c.parents.push(a.pathToPtr(u))});break;default:n.each(e.original[l][s].allOf,function(t,r){var o,s=!1;n.isUndefined(t.$ref)||y(a.getRefDetails(t))?(s=!0,o=u.concat(["allOf",r.toString()])):o=a.pathFromPtr(t.$ref),n.isUndefined(c(e.resolved).get(o))||(i(o,s),f.parents.push(a.pathToPtr(o)))})}}),r){case"2.0":n.each(e.resolved.parameters,function(r,n){var o=["parameters",n];i(o),A(e,r,o,t)}),n.each(e.resolved.responses,function(r,n){var o=["responses",n];i(o),A(e,r,o,t)})}n.each(e.definitions,function(i,s){var f,l,p,d=a.pathFromPtr(s),h=c(e.original).get(d),m=d[0],y=m.substring(0,m.length-1).toUpperCase(),v=y.charAt(0)+y.substring(1).toLowerCase();-1!==["definitions","models"].indexOf(m)&&(f=[],l=[],p=i.lineage,n.isUndefined(p)&&(u(s,void 0,p=[]),p.reverse(),i.lineage=n.cloneDeep(p),i.cyclical=p.length>1&&p[0]===s),i.parents.length>1&&"1.2"===r&&g("MULTIPLE_"+y+"_INHERITANCE","Child "+y.toLowerCase()+" is sub type of multiple models: "+n.map(i.parents,function(e){return o(e)}).join(" && "),d,t.errors),i.cyclical&&g("CYCLICAL_"+y+"_INHERITANCE",v+" has a circular inheritance: "+n.map(p,function(e){return o(e)}).join(" -> ")+" -> "+o(s),d.concat("1.2"===r?"subTypes":"allOf"),t.errors),n.each(p.slice(i.cyclical?1:0),function(t){var r=c(e.resolved).get(a.pathFromPtr(t));n.each(Object.keys(r.properties||{}),function(e){-1===l.indexOf(e)&&l.push(e)})}),A(e,h,d,t),n.each(h.properties,function(r,i){var o=d.concat(["properties",i]);n.isUndefined(r)||(A(e,r,o,t),l.indexOf(i)>-1?g("CHILD_"+y+"_REDECLARES_PROPERTY","Child "+y.toLowerCase()+" declares property already declared by ancestor: "+i,o,t.errors):f.push(i))}),n.each(h.required||[],function(e,n){var i="1.2"===r?"Model":"Definition";-1===l.indexOf(e)&&-1===f.indexOf(e)&&g("MISSING_REQUIRED_"+i.toUpperCase()+"_PROPERTY",i+" requires property but it is not defined: "+e,d.concat(["required",n.toString()]),t.errors)}))}),"1.2"===e.swaggerVersion&&(s.refPreProcessor=h),n.each(a.findRefs(e.original,s),function(r,n){v(e,r.uri,n,t)}),n.each(e.referencesMetadata,function(r,n){y(r)&&!0===r.missing&&t.errors.push({code:"UNRESOLVABLE_REFERENCE",message:"Reference could not be resolved: "+d(e.swaggerVersion,r.uri),path:a.pathFromPtr(n).concat("$ref")})})},I=function(e,t,r,i,o,a){n.isUndefined(e)||-1!==e.indexOf(t)||g("UNRESOLVABLE_"+r,i+" could not be resolved: "+t,o,a)},P=function(e,t,r,i){var o="1.2"===e.swaggerVersion?"AUTHORIZATION":"SECURITY_DEFINITION",a="AUTHORIZATION"===o?"Authorization":"Security definition";"1.2"===e.swaggerVersion?n.reduce(t,function(t,s,u){var c=["authorizations",u],f=r.concat([u]);return v(e,c,f,i)&&n.reduce(s,function(t,r,n){var s=f.concat(n.toString(),"scope"),u=c.concat(["scopes",r.scope]);return j(t,r.scope,o+"_SCOPE_REFERENCE",a+" scope reference",s,i.warnings),v(e,u,s,i),t.concat(r.scope)},[]),t.concat(u)},[]):n.reduce(t,function(t,s,u){return n.each(s,function(s,c){var f=["securityDefinitions",c],l=r.concat(u.toString(),c);j(t,c,o+"_REFERENCE",a+" reference",l,i.warnings),t.push(c),v(e,f,l,i)&&n.each(s,function(t,r){var n=f.concat(["scopes",t]);v(e,n,l.concat(r.toString()),i)})}),t},[])},T=function(e,t){var r=E(e),i=o.getSwaggerVersion(e),u={includeInvalid:!0,loaderOptions:{processContent:function(e,t){t(void 0,l.safeLoad(e.text))}}};r.resolved?t():("1.2"===i&&(u.refPreProcessor=h),a.resolveRefs(e,u).then(function(e){O(e.resolved),n.each(e.refs,function(t,r){t.circular&&n.set(e.resolved,a.pathFromPtr(r),{})}),r.referencesMetadata=e.refs,r.resolved=e.resolved,r.resolvedId=s.hash(JSON.stringify(e.resolved)),t()}).catch(t))},$=function(e,t,r,i){var a=n.isString(t)?e.validators[t]:o.createJsonValidator();o.registerCustomFormats(r);try{f.validateAgainstSchema(t,r,a)}catch(e){return e.failedValidation?i(void 0,e.results):i(e)}T(r,function(e){return i(e)})},C=function(e,t){n.each(e.definitions,function(r,n){var i=a.pathFromPtr(n),o=i[0].substring(0,i[0].length-1),s="1.2"===e.swaggerVersion?i[i.length-1]:n,u="securityDefinition"===o?"SECURITY_DEFINITION":o.toUpperCase(),c="securityDefinition"===o?"Security definition":o.charAt(0).toUpperCase()+o.substring(1);0!==r.references.length||r.inline||(r.scopePath&&(u+="_SCOPE",c+=" scope",i=r.scopePath),b(s,u,c,i,t.warnings))})},R=function(e,t,r,i,o,a,s){var u=function(t){g("INVALID_PARAMETER_COMBINATION","API cannot have a a body parameter and a "+("1.2"===e.version?"form":"formData")+" parameter",t,a.errors)},c=[],f=!1,l=!1;n.reduce(i,function(i,s,p){var d=o.concat(["parameters",p.toString()]);if(!n.isUndefined(s))return j(i,s.name,"PARAMETER","Parameter",d.concat("name"),a.errors),"body"===s.paramType||"body"===s.in?(!0===f?g("DUPLICATE_API_BODY_PARAMETER","API has more than one body parameter",d,a.errors):!0===l&&u(d),f=!0):"form"===s.paramType||"formData"===s.in?(!0===f&&u(d),l=!0):"path"!==s.paramType&&"path"!==s.in||(-1===r.args.indexOf(s.name)&&g("UNRESOLVABLE_API_PATH_PARAMETER","API path parameter could not be resolved: "+s.name,d.concat("name"),a.errors),c.push(s.name)),-1===e.primitives.indexOf(s.type)&&"1.2"===e.version&&v(t,"#/models/"+s.type,d.concat("type"),a),A(t,s,d,a,s.skipErrors),i.concat(s.name)},[]),(n.isUndefined(s)||!1===s)&&n.each(n.difference(r.args,c),function(e){g("MISSING_API_PATH_PARAMETER","API requires path parameter but it is not defined: "+e,"1.2"===t.swaggerVersion?o.slice(0,2).concat("path"):o,a.errors)})},D=function(e,t,r,i){var o=[],a=E(t),s=[],u={errors:[],warnings:[],apiDeclarations:[]};s=n.reduce(t.apis,function(e,t,r){return j(e,t.path,"RESOURCE_PATH","Resource path",["apis",r.toString(),"path"],u.errors),e.push(t.path),e},[]),S(a,u),o=n.reduce(r,function(t,r,i){var c=u.apiDeclarations[i]={errors:[],warnings:[]},f=E(r);return j(t,r.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],c.errors),-1===o.indexOf(r.resourcePath)&&(I(s,r.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],c.errors),t.push(r.resourcePath)),S(f,c),n.reduce(r.apis,function(t,r,i){var o=["apis",i.toString()],s=x(r.path);return t.indexOf(s.path)>-1?g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+r.path,o.concat("path"),c.errors):t.push(s.path),n.reduce(r.operations,function(t,r,i){var u=o.concat(["operations",i.toString()]);return j(t,r.method,"OPERATION_METHOD","Operation method",u.concat("method"),c.errors),t.push(r.method),-1===e.primitives.indexOf(r.type)&&"1.2"===e.version&&v(f,"#/models/"+r.type,u.concat("type"),c),P(a,r.authorizations,u.concat("authorizations"),c),A(f,r,u,c),R(e,f,s,r.parameters,u,c),n.reduce(r.responseMessages,function(e,t,r){var n=u.concat(["responseMessages",r.toString()]);return j(e,t.code,"RESPONSE_MESSAGE_CODE","Response message code",n.concat(["code"]),c.errors),t.responseModel&&v(f,"#/models/"+t.responseModel,n.concat("responseModel"),c),e.concat(t.code)},[]),t},[]),t},[]),C(f,c),t},[]),C(a,u),n.each(n.difference(s,o),function(e){var r=s.indexOf(e);b(t.apis[r].path,"RESOURCE_PATH","Resource path",["apis",r.toString(),"path"],u.errors)}),i(void 0,u)},k=function(e,t,r){var i=E(t),o={errors:[],warnings:[]};S(i,o),P(i,t.security,["security"],o),n.reduce(i.resolved.paths,function(t,r,a){var s=["paths",a],u=x(a);return t.indexOf(u.path)>-1&&g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+a,s,o.errors),R(e,i,u,r.parameters,s,o,!0),n.each(r,function(t,a){var c=[],f=s.concat(a),l=[];-1!==m.indexOf(a)&&(P(i,t.security,f.concat("security"),o),n.each(t.parameters,function(e){n.isUndefined(e)||(c.push(e),l.push(e.name+":"+e.in))}),n.each(r.parameters,function(e){var t=n.cloneDeep(e);t.skipErrors=!0,-1===l.indexOf(e.name+":"+e.in)&&c.push(t)}),R(e,i,u,c,f,o),n.each(t.responses,function(e,t){n.isUndefined(e)||A(i,e,f.concat("responses",t),o)}))}),t.concat(u.path)},[]),C(i,o),r(void 0,o)},M=function(e,t,r,n){var i=function(e,t){n(e,o.formatResults(t))};"1.2"===e.version?D(e,t,r,i):k(e,t,i)},F=function(e,t,r,o){$(e,"1.2"===e.version?"resourceListing.json":"schema.json",t,function(t,a){if(t)return o(t);a||"1.2"!==e.version?o(void 0,a):(a={errors:[],warnings:[],apiDeclarations:[]},i.map(r,function(t,r){$(e,"apiDeclaration.json",t,r)},function(e,t){if(e)return o(e);n.each(t,function(e,t){a.apiDeclarations[t]=e}),o(void 0,a)}))})},U=function(t){var r=this,i=function(e,t){return n.reduce(t,function(e,t,r){return e[r]=o.createJsonValidator(t),e},{})},a=function(e){var t=n.cloneDeep(r.schemas[e]);return t.id=e,t},s=["string","number","boolean","integer","array"];switch(t){case"1.2":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md",this.primitives=n.union(s,["void","File"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2",this.schemas={"apiDeclaration.json":e("../schemas/1.2/apiDeclaration.json"),"authorizationObject.json":e("../schemas/1.2/authorizationObject.json"),"dataType.json":e("../schemas/1.2/dataType.json"),"dataTypeBase.json":e("../schemas/1.2/dataTypeBase.json"),"infoObject.json":e("../schemas/1.2/infoObject.json"),"modelsObject.json":e("../schemas/1.2/modelsObject.json"),"oauth2GrantType.json":e("../schemas/1.2/oauth2GrantType.json"),"operationObject.json":e("../schemas/1.2/operationObject.json"),"parameterObject.json":e("../schemas/1.2/parameterObject.json"),"resourceListing.json":e("../schemas/1.2/resourceListing.json"),"resourceObject.json":e("../schemas/1.2/resourceObject.json")},this.validators=i(0,{"apiDeclaration.json":n.map(["dataTypeBase.json","modelsObject.json","oauth2GrantType.json","authorizationObject.json","parameterObject.json","operationObject.json","apiDeclaration.json"],a),"resourceListing.json":n.map(["resourceObject.json","infoObject.json","oauth2GrantType.json","authorizationObject.json","resourceListing.json"],a)});break;case"2.0":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md",this.primitives=n.union(s,["file"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0",this.schemas={"schema.json":e("../schemas/2.0/schema.json")},this.validators=i(0,{"schema.json":[a("schema.json")]});break;default:throw new Error(t+" is an unsupported Swagger specification version")}this.version=t};U.prototype.validate=function(e,t,r){switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("resourceListing is required");if(!n.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(n.isUndefined(t))throw new Error("apiDeclarations is required");if(!n.isArray(t))throw new TypeError("apiDeclarations must be an array");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object")}if("2.0"===this.version&&(r=arguments[1]),n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");"2.0"===this.version&&(t=[]);var i=this;F(this,e,t,function(n,a){n||o.formatResults(a)?r(n,a):M(i,e,t,r)})},U.prototype.composeModel=function(e,t,r){var i=o.getSwaggerVersion(e),a=function(n,i){var a;return n?r(n):o.getErrorCount(i)>0?w(i,r):(a=E(e),i={errors:[],warnings:[]},S(a,i),a.definitions[t]?o.getErrorCount(i)>0?w(i,r):void r(void 0,_(a,t)):r())};switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("apiDeclaration is required");if(!n.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(n.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(n.isUndefined(t))throw new Error("modelRef is required")}if(n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");if("#"!==t.charAt(0)){if("1.2"!==this.version)throw new Error("modelRef must be a JSON Pointer");t="#/models/"+t}"1.2"===i?$(this,"apiDeclaration.json",e,a):this.validate(e,a)},U.prototype.validateModel=function(e,t,r,i){switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("apiDeclaration is required");if(!n.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(n.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(n.isUndefined(t))throw new Error("modelRef is required")}if(n.isUndefined(r))throw new Error("data is required");if(n.isUndefined(i))throw new Error("callback is required");if(!n.isFunction(i))throw new TypeError("callback must be a function");var o=this;this.composeModel(e,t,function(e,t){if(e)return i(e);$(o,t,r,i)})},U.prototype.resolve=function(e,t,r){var i,s=function(e){return n.isString(t)?r(void 0,c(e).get(a.pathFromPtr(t))):r(void 0,e)};if(n.isUndefined(e))throw new Error("document is required");if(!n.isPlainObject(e))throw new TypeError("document must be an object");if(2===arguments.length&&(r=arguments[1],t=void 0),!n.isUndefined(t)&&!n.isString(t))throw new TypeError("ptr must be a JSON Pointer string");if(n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");if("1.2"===(i=E(e)).swaggerVersion)throw new Error("Swagger 1.2 is not supported");if(i.resolved)return s(i.resolved);this.validate(e,function(e,t){return e?r(e):o.getErrorCount(t)>0?w(t,r):s(i.resolved)})},U.prototype.convert=function(e,t,r,i){var a=function(e,t){i(void 0,u(e,t))};if("1.2"!==this.version)throw new Error("Specification#convert only works for Swagger 1.2");if(n.isUndefined(e))throw new Error("resourceListing is required");if(!n.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(n.isUndefined(t)&&(t=[]),!n.isArray(t))throw new TypeError("apiDeclarations must be an array");if(arguments.length<4&&(i=arguments[arguments.length-1]),n.isUndefined(i))throw new Error("callback is required");if(!n.isFunction(i))throw new TypeError("callback must be a function");!0===r?a(e,t):this.validate(e,t,function(r,n){return r?i(r):o.getErrorCount(n)>0?w(n,i):void a(e,t)})},t.exports.v1=t.exports.v1_2=new U("1.2"),t.exports.v2=t.exports.v2_0=new U("2.0")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../schemas/1.2/apiDeclaration.json":192,"../schemas/1.2/authorizationObject.json":193,"../schemas/1.2/dataType.json":194,"../schemas/1.2/dataTypeBase.json":195,"../schemas/1.2/infoObject.json":196,"../schemas/1.2/modelsObject.json":197,"../schemas/1.2/oauth2GrantType.json":198,"../schemas/1.2/operationObject.json":199,"../schemas/1.2/parameterObject.json":200,"../schemas/1.2/resourceListing.json":201,"../schemas/1.2/resourceObject.json":202,"../schemas/2.0/schema.json":203,"./helpers":1,"./validators":3,async:4,"js-yaml":27,"json-refs":57,lodash:89,"spark-md5":100,"swagger-converter":107,traverse:108}],3:[function(e,t,r){"use strict";var n=e("lodash"),i=e("./helpers"),o=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/,a=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}):([0-9]{2}))$/,s=t.exports.isValidDate=function(e){var t,r,i;return!!n.isDate(e)||(n.isString(e)||(e=e.toString()),null!==(r=o.exec(e))&&(t=r[3],!((i=r[2])<"01"||i>"12"||t<"01"||t>"31")))},u=t.exports.isValidDateTime=function(e){var t,r,i,o,u,c,f,l,p;if(n.isDate(e))return!0;if(n.isString(e)||(e=e.toString()),c=e.toLowerCase().split("t"),r=c[0],i=c.length>1?c[1]:void 0,!s(r))return!1;if(null===(o=a.exec(i)))return!1;t=o[1],u=o[2],f=o[3],"z"===o[5]?(l=0,p=0):(l=Number(o[6]),p=Number(o[7]));var d=0===p||15===p||30===p||45===p;return!(t>"23"||u>"59"||f>"59"||l>14||l<-12||!d)},c=function(e,t){var r=new Error(t);throw r.code=e,r.failedValidation=!0,r};t.exports.validateAgainstSchema=function(e,t,r){var o=function(e){var t=["additionalProperties","items"].indexOf(e.path[e.path.length-1])>-1?"schema":e.path[e.path.length-2];if(["ANY_OF_MISSING","ONE_OF_MISSING"].indexOf(e.code)>-1){switch(t){case"parameters":t="parameter";break;case"responses":t="response";break;case"schema":t+=" "+e.path[e.path.length-1]}e.message="Not a valid "+t+" definition"}delete e.params,delete e.schemaId,e.inner&&n.each(e.inner,function(e){o(e)})},a=n.isPlainObject(e)?n.cloneDeep(e):e;if(n.isUndefined(r)&&(r=i.createJsonValidator([a])),!r.validate(t,a))try{c("SCHEMA_VALIDATION_FAILED","Failed schema validation")}catch(e){throw e.results={errors:n.map(r.getLastErrors(),function(e){return o(e),e}),warnings:[]},e}};var f=t.exports.validateArrayType=function(e){"array"===e.type&&n.isUndefined(e.items)&&c("OBJECT_MISSING_REQUIRED_PROPERTY","Missing required property: items")};t.exports.validateContentType=function(e,t,r){var i="function"==typeof r.end,o=i?r.getHeader("content-type"):r.headers["content-type"],a=n.map(n.union(e,t),function(e){return e.split(";")[0]});if(o||(o=i?"text/plain":"application/octet-stream"),o=o.split(";")[0],a.length>0&&(i||-1!==["POST","PUT"].indexOf(r.method))&&-1===a.indexOf(o))throw new Error("Invalid content type ("+o+"). These are valid: "+a.join(", "))};var l=t.exports.validateEnum=function(e,t){n.isUndefined(t)||n.isUndefined(e)||-1!==t.indexOf(e)||c("ENUM_MISMATCH","Not an allowable value ("+t.join(", ")+"): "+e)},p=t.exports.validateMaximum=function(e,t,r,i){var o,a,s=!0===i?"MAXIMUM_EXCLUSIVE":"MAXIMUM";n.isUndefined(i)&&(i=!1),"integer"===r?a=parseInt(e,10):"number"===r&&(a=parseFloat(e)),n.isUndefined(t)||(o=parseFloat(t),i&&a>=o?c(s,"Greater than or equal to the configured maximum ("+t+"): "+e):a>o&&c(s,"Greater than the configured maximum ("+t+"): "+e))},d=t.exports.validateMaxItems=function(e,t){!n.isUndefined(t)&&e.length>t&&c("ARRAY_LENGTH_LONG","Array is too long ("+e.length+"), maximum "+t)},h=t.exports.validateMaxLength=function(e,t){!n.isUndefined(t)&&e.length>t&&c("MAX_LENGTH","String is too long ("+e.length+" chars), maximum "+t)},m=t.exports.validateMaxProperties=function(e,t){var r=n.isPlainObject(e)?Object.keys(e).length:0;!n.isUndefined(t)&&r>t&&c("MAX_PROPERTIES","Number of properties is too many ("+r+" properties), maximum "+t)},y=t.exports.validateMinimum=function(e,t,r,i){var o,a,s=!0===i?"MINIMUM_EXCLUSIVE":"MINIMUM";n.isUndefined(i)&&(i=!1),"integer"===r?a=parseInt(e,10):"number"===r&&(a=parseFloat(e)),n.isUndefined(t)||(o=parseFloat(t),i&&a<=o?c(s,"Less than or equal to the configured minimum ("+t+"): "+e):a-1&&e%1==0&&e<=Ot}function _(e){return null!=e&&v(e.length)&&!g(e)}function b(){}function E(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}function w(e,t){for(var r=-1,n=Array(e);++r-1&&e%1==0&&ei?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n=n?e:X(e,t,r)}function Q(e,t){for(var r=e.length;r--&&H(t,e[r],0)>-1;);return r}function ee(e,t){for(var r=-1,n=e.length;++r-1;);return r}function te(e){return e.split("")}function re(e){return lr.test(e)}function ne(e){return e.match(_r)||[]}function ie(e){return re(e)?ne(e):te(e)}function oe(e){return null==e?"":G(e)}function ae(e,t,r){if((e=oe(e))&&(r||void 0===t))return e.replace(br,"");if(!e||!(t=G(t)))return e;var n=ie(e),i=ie(t);return J(n,ee(n,i),Q(n,i)+1).join("")}function se(e){return e=e.toString().replace(Or,""),e=e.match(Er)[2].replace(" ",""),e=e?e.split(wr):[],e=e.map(function(e){return ae(e.replace(xr,""))})}function ue(e,t){var r={};z(e,function(e,t){function n(t,r){var n=K(i,function(e){return t[e]});n.push(r),p(e).apply(null,n)}var i,o=l(e),a=!o&&1===e.length||o&&0===e.length;if(Rt(e))i=e.slice(0,-1),e=e[e.length-1],r[t]=i.concat(i.length>0?n:e);else if(a)r[t]=e;else{if(i=se(e),0===e.length&&!o&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");o||i.pop(),r[t]=i.concat(n)}}),ar(r,t)}function ce(){this.head=this.tail=null,this.length=0}function fe(e,t){e.length=1,e.head=e.tail=t}function le(e,t,r){function n(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(c.started=!0,Rt(e)||(e=[e]),0===e.length&&c.idle())return at(function(){c.drain()});for(var n=0,i=e.length;n=0&&s.splice(o,1),i.callback.apply(i,arguments),null!=t&&c.error(t,i.data)}a<=c.concurrency-c.buffer&&c.unsaturated(),c.idle()&&c.drain(),c.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var o=p(e),a=0,s=[],u=!1,c={_tasks:new ce,concurrency:t,payload:r,saturated:b,unsaturated:b,buffer:t/4,empty:b,drain:b,error:b,started:!1,paused:!1,push:function(e,t){n(e,!1,t)},kill:function(){c.drain=b,c._tasks.empty()},unshift:function(e,t){n(e,!0,t)},remove:function(e){c._tasks.remove(e)},process:function(){if(!u){for(u=!0;!c.paused&&a2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function Fe(e,t){Me(Jt,e,t)}function Ue(e,t,r){Me(k(t),e,r)}function Ne(e,t){if(t=E(t||b),!Rt(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;rn?1:0}var i=p(t);Qt(e,function(e,t){i(e,function(r,n){if(r)return t(r);t(null,{value:e,criteria:n})})},function(e,t){if(e)return r(e);r(null,K(t.sort(n),Ie("value")))})}function Ke(e,t,r){var n=p(e);return nt(function(i,o){var a,s=!1;i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(function(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)},t),n.apply(null,i)})}function Ze(e,t,r,n){for(var i=-1,o=un(sn((t-e)/(r||1)),0),a=Array(o);o--;)a[n?o:++i]=e,e+=r;return a}function Ge(e,t,r,n){var i=p(r);tr(Ze(0,e,1),t,i,n)}function Xe(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=Rt(e)?[]:{}),n=E(n||b);var i=p(r);Jt(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function Je(e,t){var r,n=null;t=t||b,Fr(e,function(e,t){p(e)(function(e,o){r=arguments.length>2?i(arguments,1):o,n=e,t(!e)})},function(){t(n,r)})}function Qe(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function et(e,t,r){r=D(r||b);var n=p(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var a=i(arguments,1);r.apply(null,[null].concat(a))};n(o)}function tt(e,t,r){et(function(){return!e.apply(this,arguments)},t,r)}var rt,nt=function(e){return function(){var t=i(arguments),r=t.pop();e.call(this,t,r)}},it="function"==typeof setImmediate&&setImmediate,ot="object"==typeof e&&"function"==typeof e.nextTick,at=s(rt=it?setImmediate:ot?e.nextTick:a),st="function"==typeof Symbol,ut="object"==typeof n&&n&&n.Object===Object&&n,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=ut||ct||Function("return this")(),lt=ft.Symbol,pt=Object.prototype,dt=pt.hasOwnProperty,ht=pt.toString,mt=lt?lt.toStringTag:void 0,yt=Object.prototype.toString,gt="[object Null]",vt="[object Undefined]",_t=lt?lt.toStringTag:void 0,bt="[object AsyncFunction]",Et="[object Function]",wt="[object GeneratorFunction]",xt="[object Proxy]",Ot=9007199254740991,jt={},At="function"==typeof Symbol&&Symbol.iterator,St=function(e){return At&&e[At]&&e[At]()},It="[object Arguments]",Pt=Object.prototype,Tt=Pt.hasOwnProperty,$t=Pt.propertyIsEnumerable,Ct=O(function(){return arguments}())?O:function(e){return x(e)&&Tt.call(e,"callee")&&!$t.call(e,"callee")},Rt=Array.isArray,Dt="object"==typeof r&&r&&!r.nodeType&&r,kt=Dt&&"object"==typeof t&&t&&!t.nodeType&&t,Mt=kt&&kt.exports===Dt?ft.Buffer:void 0,Ft=(Mt?Mt.isBuffer:void 0)||function(){return!1},Ut=9007199254740991,Nt=/^(?:0|[1-9]\d*)$/,Lt={};Lt["[object Float32Array]"]=Lt["[object Float64Array]"]=Lt["[object Int8Array]"]=Lt["[object Int16Array]"]=Lt["[object Int32Array]"]=Lt["[object Uint8Array]"]=Lt["[object Uint8ClampedArray]"]=Lt["[object Uint16Array]"]=Lt["[object Uint32Array]"]=!0,Lt["[object Arguments]"]=Lt["[object Array]"]=Lt["[object ArrayBuffer]"]=Lt["[object Boolean]"]=Lt["[object DataView]"]=Lt["[object Date]"]=Lt["[object Error]"]=Lt["[object Function]"]=Lt["[object Map]"]=Lt["[object Number]"]=Lt["[object Object]"]=Lt["[object RegExp]"]=Lt["[object Set]"]=Lt["[object String]"]=Lt["[object WeakMap]"]=!1;var qt="object"==typeof r&&r&&!r.nodeType&&r,Bt=qt&&"object"==typeof t&&t&&!t.nodeType&&t,zt=Bt&&Bt.exports===qt&&ut.process,Yt=function(){try{return zt&&zt.binding("util")}catch(e){}}(),Wt=Yt&&Yt.isTypedArray,Vt=Wt?function(e){return function(t){return e(t)}}(Wt):function(e){return x(e)&&v(e.length)&&!!Lt[y(e)]},Ht=Object.prototype.hasOwnProperty,Kt=Object.prototype,Zt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Gt=Object.prototype.hasOwnProperty,Xt=F(M,1/0),Jt=function(e,t,r){(_(e)?U:Xt)(e,p(t),r)},Qt=N(L),er=d(Qt),tr=q(L),rr=F(tr,1),nr=d(rr),ir=function(e){var t=i(arguments,1);return function(){var r=i(arguments);return e.apply(null,t.concat(r))}},or=function(e){return function(t,r,n){for(var i=-1,o=Object(t),a=n(t),s=a.length;s--;){var u=a[e?s:++i];if(!1===r(o[u],u,o))break}return t}}(),ar=function(e,t,r){function n(e,t){y.push(function(){u(e,t)})}function o(){if(0===y.length&&0===d)return r(null,l);for(;y.length&&d2&&(n=i(arguments,1)),t){var o={};z(l,function(e,t){o[t]=e}),o[e]=n,h=!0,m=Object.create(null),r(t,o)}else l[e]=n,s(e)});d++;var o=p(t[t.length-1]);t.length>1?o(l,n):o(n)}}function c(t){var r=[];return z(e,function(e,n){Rt(e)&&H(e,t,0)>=0&&r.push(n)}),r}"function"==typeof t&&(r=t,t=null),r=E(r||b);var f=P(e).length;if(!f)return r(null);t||(t=f);var l={},d=0,h=!1,m=Object.create(null),y=[],g=[],v={};z(e,function(t,r){if(!Rt(t))return n(r,[t]),void g.push(r);var i=t.slice(0,t.length-1),o=i.length;if(0===o)return n(r,t),void g.push(r);v[r]=o,B(i,function(s){if(!e[s])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+s+"` in "+i.join(", "));a(s,function(){0===--o&&n(r,t)})})}),function(){for(var e=0;g.length;)e++,B(c(g.pop()),function(e){0==--v[e]&&g.push(e)});if(e!==f)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),o()},sr="[object Symbol]",ur=1/0,cr=lt?lt.prototype:void 0,fr=cr?cr.toString:void 0,lr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),pr="[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]",dr="\\ud83c[\\udffb-\\udfff]",hr="(?:\\ud83c[\\udde6-\\uddff]){2}",mr="[\\ud800-\\udbff][\\udc00-\\udfff]",yr="(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?",gr="[\\ufe0e\\ufe0f]?"+yr+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",hr,mr].join("|")+")[\\ufe0e\\ufe0f]?"+yr+")*"),vr="(?:"+["[^\\ud800-\\udfff]"+pr+"?",pr,hr,mr,"[\\ud800-\\udfff]"].join("|")+")",_r=RegExp(dr+"(?="+dr+")|"+vr+gr,"g"),br=/^\s+|\s+$/g,Er=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,wr=/,/,xr=/(=.+)?(\s*)$/,Or=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;ce.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},ce.prototype.empty=function(){for(;this.head;)this.shift();return this},ce.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},ce.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},ce.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):fe(this,e)},ce.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):fe(this,e)},ce.prototype.shift=function(){return this.head&&this.removeLink(this.head)},ce.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},ce.prototype.toArray=function(){for(var e=Array(this.length),t=this.head,r=0;r=i.priority;)i=i.next;for(var o=0,a=e.length;o1&&(n=r[0]+"@",e=r[1]),n+o((e=e.replace(T,".")).split("."),t).join(".")}function s(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=D((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=D(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:b}function f(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function l(e,t,r){var n=0;for(e=r?R(e/O):e>>1,e+=R(e/t);e>C*w>>1;n+=b)e=R(e/C);return R(n+(C+1)*e/(e+x))}function p(e){var t,r,n,o,a,s,f,p,d,h,m=[],y=e.length,g=0,v=A,x=j;for((r=e.lastIndexOf(S))<0&&(r=0),n=0;n=128&&i("not-basic"),m.push(e.charCodeAt(n));for(o=r>0?r+1:0;o=y&&i("invalid-input"),((p=c(e.charCodeAt(o++)))>=b||p>R((_-g)/s))&&i("overflow"),g+=p*s,d=f<=x?E:f>=x+w?w:f-x,!(pR(_/(h=b-d))&&i("overflow"),s*=h;x=l(g-a,t=m.length+1,0==a),R(g/t)>_-v&&i("overflow"),v+=R(g/t),g%=t,m.splice(g++,0,v)}return u(m)}function d(e){var t,r,n,o,a,u,c,p,d,h,m,y,g,v,x,O=[];for(y=(e=s(e)).length,t=A,r=0,a=j,u=0;u=t&&mR((_-r)/(g=n+1))&&i("overflow"),r+=(c-t)*g,t=c,u=0;u_&&i("overflow"),m==t){for(p=r,d=b;h=d<=a?E:d>=a+w?w:d-a,!(p= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=b-E,R=Math.floor,D=String.fromCharCode;if(g={version:"1.4.1",ucs2:{decode:s,encode:u},decode:p,encode:d,toASCII:function(e){return a(e,function(e){return P.test(e)?"xn--"+d(e):e})},toUnicode:function(e){return a(e,function(e){return I.test(e)?p(e.slice(4).toLowerCase()):e})}},h&&m)if(t.exports==h)m.exports=g;else for(v in g)g.hasOwnProperty(v)&&(h[v]=g[v]);else n.punycode=g}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}void 0!==t&&(t.exports=n),n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,i=0;i0&&(i=u.removeMin(),(a=s[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(function(e){var t=e.v!==i?e.v:e.w,n=s[t],o=r(e),c=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);c1||1===t.length&&e.hasEdge(t[0],t[0])})}},{"../lodash":25,"./tarjan":19}],13:[function(e,t,r){function n(e,t,r){var n={},i=e.nodes();return i.forEach(function(e){n[e]={},n[e][e]={distance:0},i.forEach(function(t){e!==t&&(n[e][t]={distance:Number.POSITIVE_INFINITY})}),r(e).forEach(function(r){var i=r.v===e?r.w:r.v,o=t(r);n[e][i]={distance:o,predecessor:e}})}),i.forEach(function(e){var t=n[e];i.forEach(function(r){var o=n[r];i.forEach(function(r){var n=o[e],i=t[r],a=o[r],s=n.distance+i.distance;s0;){if(r=u.removeMin(),n.has(s,r))a.setEdge(r,s[r]);else{if(c)throw new Error("Input graph is not connected: "+e);c=!0}e.nodeEdges(r).forEach(function(e){var n=e.v===r?e.w:e.v,i=u.priority(n);if(void 0!==i){var o=t(e);othis._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)},n.prototype._heapify=function(e){var t=this._arr,r=2*e,n=r+1,i=e;r>1,!(r[t].priorityo){var a=i;i=o,o=a}return i+p+o+p+(c.isUndefined(n)?f:n)}function s(e,t,r,n){var i=""+t,o=""+r;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return n&&(s.name=n),s}function u(e,t){return a(e,t.v,t.w,t.name)}var c=e("./lodash");t.exports=n;var f="\0",l="\0",p="";n.prototype._nodeCount=0,n.prototype._edgeCount=0,n.prototype.isDirected=function(){return this._isDirected},n.prototype.isMultigraph=function(){return this._isMultigraph},n.prototype.isCompound=function(){return this._isCompound},n.prototype.setGraph=function(e){return this._label=e,this},n.prototype.graph=function(){return this._label},n.prototype.setDefaultNodeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultNodeLabelFn=e,this},n.prototype.nodeCount=function(){return this._nodeCount},n.prototype.nodes=function(){return c.keys(this._nodes)},n.prototype.sources=function(){return c.filter(this.nodes(),c.bind(function(e){return c.isEmpty(this._in[e])},this))},n.prototype.sinks=function(){return c.filter(this.nodes(),c.bind(function(e){return c.isEmpty(this._out[e])},this))},n.prototype.setNodes=function(e,t){var r=arguments;return c.each(e,c.bind(function(e){r.length>1?this.setNode(e,t):this.setNode(e)},this)),this},n.prototype.setNode=function(e,t){return c.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=l,this._children[e]={},this._children[l][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},n.prototype.node=function(e){return this._nodes[e]},n.prototype.hasNode=function(e){return c.has(this._nodes,e)},n.prototype.removeNode=function(e){var t=this;if(c.has(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c.each(this.children(e),c.bind(function(e){this.setParent(e)},this)),delete this._children[e]),c.each(c.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],c.each(c.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},n.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(c.isUndefined(t))t=l;else{for(var r=t+="";!c.isUndefined(r);r=this.parent(r))if(r===e)throw new Error("Setting "+t+" as parent of "+e+" would create create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},n.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},n.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==l)return t}},n.prototype.children=function(e){if(c.isUndefined(e)&&(e=l),this._isCompound){var t=this._children[e];if(t)return c.keys(t)}else{if(e===l)return this.nodes();if(this.hasNode(e))return[]}},n.prototype.predecessors=function(e){var t=this._preds[e];if(t)return c.keys(t)},n.prototype.successors=function(e){var t=this._sucs[e];if(t)return c.keys(t)},n.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return c.union(t,this.successors(e))},n.prototype.filterNodes=function(e){function t(e){var o=n.parent(e);return void 0===o||r.hasNode(o)?(i[e]=o,o):o in i?i[o]:t(o)}var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph()),c.each(this._nodes,c.bind(function(t,n){e(n)&&r.setNode(n,t)},this)),c.each(this._edgeObjs,c.bind(function(e){r.hasNode(e.v)&&r.hasNode(e.w)&&r.setEdge(e,this.edge(e))},this));var n=this,i={};return this._isCompound&&c.each(r.nodes(),function(e){r.setParent(e,t(e))}),r},n.prototype.setDefaultEdgeLabel=function(e){return c.isFunction(e)||(e=c.constant(e)),this._defaultEdgeLabelFn=e,this},n.prototype.edgeCount=function(){return this._edgeCount},n.prototype.edges=function(){return c.values(this._edgeObjs)},n.prototype.setPath=function(e,t){var r=this,n=arguments;return c.reduce(e,function(e,i){return n.length>1?r.setEdge(e,i,t):r.setEdge(e,i),i}),this},n.prototype.setEdge=function(){var e,t,r,n,o=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(e=u.v,t=u.w,r=u.name,2===arguments.length&&(n=arguments[1],o=!0)):(e=u,t=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],o=!0)),e=""+e,t=""+t,c.isUndefined(r)||(r=""+r);var f=a(this._isDirected,e,t,r);if(c.has(this._edgeLabels,f))return o&&(this._edgeLabels[f]=n),this;if(!c.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[f]=o?n:this._defaultEdgeLabelFn(e,t,r);var l=s(this._isDirected,e,t,r);return e=l.v,t=l.w,Object.freeze(l),this._edgeObjs[f]=l,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][f]=l,this._out[e][f]=l,this._edgeCount++,this},n.prototype.edge=function(e,t,r){var n=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]},n.prototype.hasEdge=function(e,t,r){var n=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return c.has(this._edgeLabels,n)},n.prototype.removeEdge=function(e,t,r){var n=1===arguments.length?u(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this},n.prototype.inEdges=function(e,t){var r=this._in[e];if(r){var n=c.values(r);return t?c.filter(n,function(e){return e.v===t}):n}},n.prototype.outEdges=function(e,t){var r=this._out[e];if(r){var n=c.values(r);return t?c.filter(n,function(e){return e.w===t}):n}},n.prototype.nodeEdges=function(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}},{"./lodash":25}],23:[function(e,t,r){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":22,"./version":26}],24:[function(e,t,r){function n(e){return o.map(e.nodes(),function(t){var r=e.node(t),n=e.parent(t),i={v:t};return o.isUndefined(r)||(i.value=r),o.isUndefined(n)||(i.parent=n),i})}function i(e){return o.map(e.edges(),function(t){var r=e.edge(t),n={v:t.v,w:t.w};return o.isUndefined(t.name)||(n.name=t.name),o.isUndefined(r)||(n.value=r),n})}var o=e("./lodash"),a=e("./graph");t.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n(e),edges:i(e)};return o.isUndefined(e.graph())||(t.value=o.clone(e.graph())),t},read:function(e){var t=new a(e.options).setGraph(e.value);return o.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),o.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},{"./graph":22,"./lodash":25}],25:[function(e,t,r){var n;if("function"==typeof e)try{n=e("lodash")}catch(e){}n||(n=window._),t.exports=n},{lodash:89}],26:[function(e,t,r){t.exports="2.1.1"},{}],27:[function(e,t,r){"use strict";var n=e("./lib/js-yaml.js");t.exports=n},{"./lib/js-yaml.js":28}],28:[function(e,t,r){"use strict";function n(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}var i=e("./js-yaml/loader"),o=e("./js-yaml/dumper");t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=i.load,t.exports.loadAll=i.loadAll,t.exports.safeLoad=i.safeLoad,t.exports.safeLoadAll=i.safeLoadAll,t.exports.dump=o.dump,t.exports.safeDump=o.safeDump,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=n("scan"),t.exports.parse=n("parse"),t.exports.compose=n("compose"),t.exports.addConstructor=n("addConstructor")},{"./js-yaml/dumper":30,"./js-yaml/exception":31,"./js-yaml/loader":32,"./js-yaml/schema":34,"./js-yaml/schema/core":35,"./js-yaml/schema/default_full":36,"./js-yaml/schema/default_safe":37,"./js-yaml/schema/failsafe":38,"./js-yaml/schema/json":39,"./js-yaml/type":40}],29:[function(e,t,r){"use strict";function n(e){return void 0===e||null===e}t.exports.isNothing=n,t.exports.isObject=function(e){return"object"==typeof e&&null!==e},t.exports.toArray=function(e){return Array.isArray(e)?e:n(e)?[]:[e]},t.exports.repeat=function(e,t){var r,n="";for(r=0;rn&&" "!==e[h+1],h=o);else if(!f(a))return ce;m=m&&l(a)}u=u||d&&o-h-1>n&&" "!==e[h+1]}return s||u?" "===e[0]&&r>9?ce:u?ue:se:m&&!i(e)?oe:ae}function h(e,t,r,n){e.dump=function(){if(0===t.length)return"''";if(!e.noCompatMode&&-1!==ie.indexOf(t))return"'"+t+"'";var i=e.indent*Math.max(1,r),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),s=n||e.flowLevel>-1&&r>=e.flowLevel;switch(d(t,s,e.indent,o,function(t){return u(e,t)})){case oe:return t;case ae:return"'"+t.replace(/'/g,"''")+"'";case se:return"|"+m(t,e.indent)+y(a(t,i));case ue:return">"+m(t,e.indent)+y(a(g(t,o),i));case ce:return'"'+_(t)+'"';default:throw new T("impossible error: invalid scalar style")}}()}function m(e,t){var r=" "===e[0]?String(t):"",n="\n"===e[e.length-1];return r+(n&&("\n"===e[e.length-2]||"\n"===e)?"+":n?"":"-")+"\n"}function y(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function g(e,t){for(var r,n,i=/(\n+)([^\n]*)/g,o=function(){var r=e.indexOf("\n");return r=-1!==r?r:e.length,i.lastIndex=r,v(e.slice(0,r),t)}(),a="\n"===e[0]||" "===e[0];n=i.exec(e);){var s=n[1],u=n[2];r=" "===u[0],o+=s+(a||r||""===u?"":"\n")+v(u,t),a=r}return o}function v(e,t){if(""===e||" "===e[0])return e;for(var r,n,i=/ [^ ]/g,o=0,a=0,s=0,u="";r=i.exec(e);)(s=r.index)-o>t&&(n=a>o?a:s,u+="\n"+e.slice(o,n),o=n+1),a=s;return u+="\n",e.length-o>t&&a>o?u+=e.slice(o,a)+"\n"+e.slice(a+1):u+=e.slice(o),u.slice(1)}function _(e){for(var t,r,n,o="",a=0;a=55296&&t<=56319&&(r=e.charCodeAt(a+1))>=56320&&r<=57343?(o+=i(1024*(t-55296)+r-56320+65536),a++):o+=!(n=ne[t])&&f(t)?e[a]:n||i(t);return o}function b(e,t,r){var n,i,o="",a=e.tag;for(n=0,i=r.length;n1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),j(e,t,a,!1,!1)&&(u+=s+=e.dump));e.tag=c,e.dump="{"+u+"}"}function x(e,t,r,n){var i,o,a,u,c,f,l="",p=e.tag,d=Object.keys(r);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new T("sortKeys must be a boolean or a function");for(i=0,o=d.length;i1024)&&(e.dump&&M===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,c&&(f+=s(e,t)),j(e,t+1,u,!0,c)&&(e.dump&&M===e.dump.charCodeAt(0)?f+=":":f+=": ",l+=f+=e.dump));e.tag=p,e.dump=l||"{}"}function O(e,t,r){var n,i,o,a,s,u;for(o=0,a=(i=r?e.explicitTypes:e.implicitTypes).length;o tag resolver accepts not "'+u+'" style');n=s.represent[u](t,u)}e.dump=n}return!0}return!1}function j(e,t,r,n,i,o){e.tag=null,e.dump=r,O(e,r,!1)||O(e,r,!0);var a=R.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var s,u,c="[object Object]"===a||"[object Array]"===a;if(c&&(u=-1!==(s=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(c&&u&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)n&&0!==Object.keys(e.dump).length?(x(e,t,e.dump,i),u&&(e.dump="&ref_"+s+e.dump)):(w(e,t,e.dump),u&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)n&&0!==e.dump.length?(E(e,t,e.dump,i),u&&(e.dump="&ref_"+s+e.dump)):(b(e,t,e.dump),u&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new T("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&h(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function A(e,t){var r,n,i=[],o=[];for(S(e,i,o),r=0,n=o.length;r>10),56320+(e-65536&1023))}function p(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||B,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function d(e,t){return new N(t,new L(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function h(e,t){throw d(e,t)}function m(e,t){e.onWarning&&e.onWarning.call(null,d(e,t))}function y(e,t,r,n){var i,o,a,s;if(t1&&(e.result+=U.repeat("\n",t-1))}function x(e,t,r){var s,u,c,f,l,p,d,h,m,g=e.kind,v=e.result;if(m=e.input.charCodeAt(e.position),o(m)||a(m)||35===m||38===m||42===m||33===m||124===m||62===m||39===m||34===m||37===m||64===m||96===m)return!1;if((63===m||45===m)&&(u=e.input.charCodeAt(e.position+1),o(u)||r&&a(u)))return!1;for(e.kind="scalar",e.result="",c=f=e.position,l=!1;0!==m;){if(58===m){if(u=e.input.charCodeAt(e.position+1),o(u)||r&&a(u))break}else if(35===m){if(s=e.input.charCodeAt(e.position-1),o(s))break}else{if(e.position===e.lineStart&&E(e)||r&&a(m))break;if(n(m)){if(p=e.line,d=e.lineStart,h=e.lineIndent,b(e,!1,-1),e.lineIndent>=t){l=!0,m=e.input.charCodeAt(e.position);continue}e.position=f,e.line=p,e.lineStart=d,e.lineIndent=h;break}}l&&(y(e,c,f,!1),w(e,e.line-p),c=f=e.position,l=!1),i(m)||(f=e.position+1),m=e.input.charCodeAt(++e.position)}return y(e,c,f,!1),!!e.result||(e.kind=g,e.result=v,!1)}function O(e,t){var r,i,o;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=o=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(y(e,i,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,o=e.position}else n(r)?(y(e,i,o,!0),w(e,b(e,!1,t)),i=o=e.position):e.position===e.lineStart&&E(e)?h(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);h(e,"unexpected end of the stream within a single quoted scalar")}function j(e,t){var r,i,o,a,c,f;if(34!==(f=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;0!==(f=e.input.charCodeAt(e.position));){if(34===f)return y(e,r,e.position,!0),e.position++,!0;if(92===f){if(y(e,r,e.position,!0),f=e.input.charCodeAt(++e.position),n(f))b(e,!1,t);else if(f<256&&re[f])e.result+=ne[f],e.position++;else if((c=u(f))>0){for(o=c,a=0;o>0;o--)(c=s(f=e.input.charCodeAt(++e.position)))>=0?a=(a<<4)+c:h(e,"expected hexadecimal character");e.result+=l(a),e.position++}else h(e,"unknown escape sequence");r=i=e.position}else n(f)?(y(e,r,i,!0),w(e,b(e,!1,t)),r=i=e.position):e.position===e.lineStart&&E(e)?h(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}h(e,"unexpected end of the stream within a double quoted scalar")}function A(e,t){var r,n,i,a,s,u,c,f,l,p,d=!0,m=e.tag,y=e.anchor,g={};if(91===(p=e.input.charCodeAt(e.position)))i=93,u=!1,n=[];else{if(123!==p)return!1;i=125,u=!0,n={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=n),p=e.input.charCodeAt(++e.position);0!==p;){if(b(e,!0,t),(p=e.input.charCodeAt(e.position))===i)return e.position++,e.tag=m,e.anchor=y,e.kind=u?"mapping":"sequence",e.result=n,!0;d||h(e,"missed comma between flow collection entries"),f=c=l=null,a=s=!1,63===p&&o(e.input.charCodeAt(e.position+1))&&(a=s=!0,e.position++,b(e,!0,t)),r=e.line,R(e,t,Y,!1,!0),f=e.tag,c=e.result,b(e,!0,t),p=e.input.charCodeAt(e.position),!s&&e.line!==r||58!==p||(a=!0,p=e.input.charCodeAt(++e.position),b(e,!0,t),R(e,t,Y,!1,!0),l=e.result),u?v(e,n,g,f,c,l):a?n.push(v(e,null,g,f,c,l)):n.push(c),b(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(d=!0,p=e.input.charCodeAt(++e.position)):d=!1}h(e,"unexpected end of the stream within a flow collection")}function S(e,t){var r,o,a,s,u=K,f=!1,l=!1,p=t,d=0,m=!1;if(124===(s=e.input.charCodeAt(e.position)))o=!1;else{if(62!==s)return!1;o=!0}for(e.kind="scalar",e.result="";0!==s;)if(43===(s=e.input.charCodeAt(++e.position))||45===s)K===u?u=43===s?G:Z:h(e,"repeat of a chomping mode identifier");else{if(!((a=c(s))>=0))break;0===a?h(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?h(e,"repeat of an indentation width identifier"):(p=t+a-1,l=!0)}if(i(s)){do{s=e.input.charCodeAt(++e.position)}while(i(s));if(35===s)do{s=e.input.charCodeAt(++e.position)}while(!n(s)&&0!==s)}for(;0!==s;){for(_(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndentp&&(p=e.lineIndent),n(s))d++;else{if(e.lineIndentt)&&0!==i)h(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(R(e,t,H,!0,a)&&(_?y=e.result:g=e.result),_||(v(e,p,d,m,y,g,s,u),m=y=g=null),b(e,!0,-1),c=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==c)h(e,"bad indentation of a mapping entry");else if(e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndent tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result)?(e.result=f.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):h(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):h(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function D(e){var t,r,a,s,u=e.position,c=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(b(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(c=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);for(a=[],(r=e.input.slice(t,e.position)).length<1&&h(e,"directive name must not be less than one character in length");0!==s;){for(;i(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!n(s));break}if(n(s))break;for(t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==s&&_(e),z.call(oe,r)?oe[r](e,r,a):m(e,'unknown document directive "'+r+'"')}b(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,b(e,!0,-1)):c&&h(e,"directives end mark is expected"),R(e,e.lineIndent-1,H,!1,!0),b(e,!0,-1),e.checkLineBreaks&&J.test(e.input.slice(u,e.position))&&m(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&E(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,b(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>t/2-1){r=" ... ",n+=5;break}for(o="",a=this.position;at/2-1){o=" ... ",a-=5;break}return s=this.buffer.slice(n,a),i.repeat(" ",e)+r+s+o+"\n"+i.repeat(" ",e+this.position-n+r.length)+"^"},n.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},t.exports=n},{"./common":29}],34:[function(e,t,r){"use strict";function n(e,t,r){var i=[];return e.include.forEach(function(e){r=n(e,t,r)}),e[t].forEach(function(e){r.forEach(function(t,r){t.tag===e.tag&&t.kind===e.kind&&i.push(r)}),r.push(e)}),r.filter(function(e,t){return-1===i.indexOf(t)})}function i(){var e,t,r={scalar:{},sequence:{},mapping:{},fallback:{}};for(e=0,t=arguments.length;e64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,i=e.replace(/[\r\n=]/g,""),a=i.length,s=o,u=0,c=[];for(t=0;t>16&255),c.push(u>>8&255),c.push(255&u)),u=u<<6|s.indexOf(i.charAt(t));return 0==(r=a%4*6)?(c.push(u>>16&255),c.push(u>>8&255),c.push(255&u)):18===r?(c.push(u>>10&255),c.push(u>>2&255)):12===r&&c.push(u>>4&255),n?n.from?n.from(c):new n(c):c},predicate:function(e){return n&&n.isBuffer(e)},represent:function(e){var t,r,n="",i=0,a=e.length,s=o;for(t=0;t>18&63],n+=s[i>>12&63],n+=s[i>>6&63],n+=s[63&i]),i=(i<<8)+e[t];return 0==(r=a%3)?(n+=s[i>>18&63],n+=s[i>>12&63],n+=s[i>>6&63],n+=s[63&i]):2===r?(n+=s[i>>10&63],n+=s[i>>4&63],n+=s[i<<2&63],n+=s[64]):1===r&&(n+=s[i>>2&63],n+=s[i<<4&63],n+=s[64],n+=s[64]),n}})},{"../type":40}],42:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":40}],43:[function(e,t,r){"use strict";var n=e("../common"),i=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-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))$"),a=/^[-+]?[0-9]+e/;t.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r="-"===t[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,n=1,i.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return r=e.toString(10),a.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})},{"../common":29,"../type":40}],44:[function(e,t,r){"use strict";function n(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function i(e){return 48<=e&&e<=55}function o(e){return 48<=e&&e<=57}var a=e("../common"),s=e("../type");t.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r=e.length,a=0,s=!1;if(!r)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===r)return!0;if("b"===(t=e[++a])){for(a++;a3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},{"../../type":40}],47:[function(e,t,r){"use strict";var n=e("../../type");t.exports=new n("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},{"../../type":40}],48:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":40}],49:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},{"../type":40}],50:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":40}],51:[function(e,t,r){"use strict";var n=e("../type"),i=Object.prototype.hasOwnProperty,o=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,a,s,u=[],c=e;for(t=0,r=c.length;t-1?i=o:(r=T.isUndefined(e)?void 0:g(e),T.isUndefined(r)?i=o:((i=r).path=k(C.join(r.path,o.path)),i.query=n(r.query,o.query))),i.fragment=void 0,(-1===L.indexOf(i.reference)&&0===i.path.indexOf("../")?"../":"")+M.serialize(i)}function o(e,t){var r,n=[];return t.length>0&&(r=e,t.slice(0,t.length-1).forEach(function(e){e in r&&(r=r[e],n.push(r))})),n}function a(e){return N.indexOf(f(e))>-1}function s(e){return T.isUndefined(e.error)&&"invalid"!==e.type}function u(e,t){var r=e;return t.forEach(function(e){if(!((e=decodeURI(e))in r))throw Error("JSON Pointer points to missing location: "+I(t));r=r[e]}),r}function c(e){return Object.keys(e).filter(function(e){return"$ref"!==e})}function f(e){var t;switch(e.uriDetails.reference){case"absolute":case"uri":t="remote";break;case"same-document":t="local";break;default:t=e.uriDetails.reference}return t}function l(e,t){var r=U[e],n=Promise.resolve(),i=T.cloneDeep(t.loaderOptions||{});return T.isUndefined(r)?(T.isUndefined(i.processContent)&&(i.processContent=function(e,t){t(void 0,JSON.parse(e.text))}),n=(n=R.load(decodeURI(e),i)).then(function(t){return U[e]={value:t},t}).catch(function(t){throw U[e]={error:t},t})):n=n.then(function(){if(T.isError(r.error))throw r.error;return r.value}),n=n.then(function(e){return T.cloneDeep(e)})}function p(e,t){var r=!0;try{if(!T.isPlainObject(e))throw new Error("obj is not an Object");if(!T.isString(e.$ref))throw new Error("obj.$ref is not a String")}catch(e){if(t)throw e;r=!1}return r}function d(e){return-1!==e.indexOf("://")||C.isAbsolute(e)?e:C.resolve(r.cwd(),e)}function h(e){var t,r;return T.isArray(e.filter)||T.isString(e.filter)?(r=T.isString(e.filter)?[e.filter]:e.filter,t=function(e){return r.indexOf(e.type)>-1||r.indexOf(f(e))>-1}):T.isFunction(e.filter)?t=e.filter:T.isUndefined(e.filter)&&(t=function(){return!0}),function(r,n){return("invalid"!==r.type||!0===e.includeInvalid)&&t(r,n)}}function m(e){var t;return T.isArray(e.subDocPath)?t=e.subDocPath:T.isString(e.subDocPath)?t=S(e.subDocPath):T.isUndefined(e.subDocPath)&&(t=[]),t}function y(e,t){e.error=t.message,e.missing=!0}function g(e){return M.parse(encodeURI(decodeURI(e)))}function v(e,t,r){var n,o,u=Promise.resolve(),c=I(t.subDocPath),f=d(t.location),p=C.dirname(t.location),h=f+c;return T.isUndefined(r.docs[f])&&(r.docs[f]=e),T.isUndefined(r.deps[h])&&(r.deps[h]={},n=O(e,t),T.each(n,function(n,f){var m=d(t.location)+f,g=n.refdId=d(a(n)?i(p,n.uri):t.location)+"#"+(n.uri.indexOf("#")>-1?n.uri.split("#")[1]:"");r.refs[m]=n,s(n)&&(r.deps[h][f===c?"#":f.replace(c+"/","#/")]=g,0!==m.indexOf(g+"/")?((o=T.cloneDeep(t)).subDocPath=T.isUndefined(n.uriDetails.fragment)?[]:S(decodeURI(n.uriDetails.fragment)),a(n)?(delete o.filter,o.location=g.split("#")[0],u=u.then(function(e,t){return function(){var r=d(t.location),n=e.docs[r];return T.isUndefined(n)?l(r,t).catch(function(t){return e.docs[r]=t,t}):Promise.resolve().then(function(){return n})}}(r,o))):u=u.then(function(){return e}),u=u.then(function(e,t,r){return function(n){if(T.isError(n))y(r,n);else try{return v(n,t,e).catch(function(e){y(r,e)})}catch(e){y(r,e)}}}(r,o,n))):n.circular=!0)})),u}function _(e,t,r){u(e,t.slice(0,t.length-1))[decodeURI(t[t.length-1])]=r}function b(e,t,r,n){function i(t,i){r.push(i),b(e,t,r,n),r.pop()}var o=!0;T.isFunction(n)&&(o=n(e,t,r)),-1===e.indexOf(t)&&(e.push(t),!1!==o&&(T.isArray(t)?t.forEach(function(e,t){i(e,t.toString())}):T.isObject(t)&&T.each(t,function(e,t){i(e,t)})),e.pop())}function E(e,t){var r;if(e=T.isUndefined(e)?{}:T.cloneDeep(e),!T.isObject(e))throw new TypeError("options must be an Object");if(!T.isUndefined(e.resolveCirculars)&&!T.isBoolean(e.resolveCirculars))throw new TypeError("options.resolveCirculars must be a Boolean");if(!(T.isUndefined(e.filter)||T.isArray(e.filter)||T.isFunction(e.filter)||T.isString(e.filter)))throw new TypeError("options.filter must be an Array, a Function of a String");if(!T.isUndefined(e.includeInvalid)&&!T.isBoolean(e.includeInvalid))throw new TypeError("options.includeInvalid must be a Boolean");if(!T.isUndefined(e.location)&&!T.isString(e.location))throw new TypeError("options.location must be a String");if(!T.isUndefined(e.refPreProcessor)&&!T.isFunction(e.refPreProcessor))throw new TypeError("options.refPreProcessor must be a Function");if(!T.isUndefined(e.refPostProcessor)&&!T.isFunction(e.refPostProcessor))throw new TypeError("options.refPostProcessor must be a Function");if(!T.isUndefined(e.subDocPath)&&!T.isArray(e.subDocPath)&&!A(e.subDocPath))throw new TypeError("options.subDocPath must be an Array of path segments or a valid JSON Pointer");if(T.isUndefined(e.resolveCirculars)&&(e.resolveCirculars=!1),e.filter=h(e),T.isUndefined(e.location)&&(e.location=d("./root.json")),(r=e.location.split("#")).length>1&&(e.subDocPath="#"+r[1]),e.location=i(e.location,void 0),e.subDocPath=m(e),!T.isUndefined(t))try{u(t,e.subDocPath)}catch(e){throw e.message=e.message.replace("JSON Pointer","options.subDocPath"),e}return e}function w(e){if(!T.isArray(e))throw new TypeError("path must be an array");return e.map(function(e){return T.isString(e)||(e=JSON.stringify(e)),decodeURI(e.replace(/~1/g,"/").replace(/~0/g,"~"))})}function x(e){if(!T.isArray(e))throw new TypeError("path must be an array");return e.map(function(e){return T.isString(e)||(e=JSON.stringify(e)),e.replace(/~/g,"~0").replace(/\//g,"~1")})}function O(e,t){var r={};if(!T.isArray(e)&&!T.isObject(e))throw new TypeError("obj must be an Array or an Object");return t=E(t,e),b(o(e,t.subDocPath),u(e,t.subDocPath),T.cloneDeep(t.subDocPath),function(e,n,i){var o,a,s=!0;return p(n)&&(T.isUndefined(t.refPreProcessor)||(n=t.refPreProcessor(T.cloneDeep(n),i)),o=j(n),T.isUndefined(t.refPostProcessor)||(o=t.refPostProcessor(o,i)),t.filter(o,i)&&(a=I(i),r[a]=o),c(n).length>0&&(s=!1)),s}),r}function j(e){var t,r,n,i={def:e};try{p(e,!0)?(t=e.$ref,n=q[t],T.isUndefined(n)&&(n=q[t]=g(t)),i.uri=t,i.uriDetails=n,T.isUndefined(n.error)?i.type=f(i):(i.error=i.uriDetails.error,i.type="invalid"),(r=c(e)).length>0&&(i.warning="Extra JSON Reference properties will be ignored: "+r.join(", "))):i.type="invalid"}catch(e){i.error=e.message,i.type="invalid"}return i}function A(e,t){var r,n=!0;try{if(!T.isString(e))throw new Error("ptr is not a String");if(""!==e){if(r=e.charAt(0),-1===["#","/"].indexOf(r))throw new Error("ptr must start with a / or #/");if("#"===r&&"#"!==e&&"/"!==e.charAt(1))throw new Error("ptr must start with a / or #/");if(e.match(F))throw new Error("ptr has invalid token(s)")}}catch(e){if(!0===t)throw e;n=!1}return n}function S(e){try{A(e,!0)}catch(e){throw new Error("ptr must be a JSON Pointer: "+e.message)}var t=e.split("/");return t.shift(),w(t)}function I(e,t){if(!T.isArray(e))throw new Error("path must be an Array");return(!1!==t?"#":"")+(e.length>0?"/":"")+x(e).join("/")}function P(e,t){var r=Promise.resolve();return r=r.then(function(){if(!T.isArray(e)&&!T.isObject(e))throw new TypeError("obj must be an Array or an Object");t=E(t,e),e=T.cloneDeep(e)}).then(function(){var r={deps:{},docs:{},refs:{}};return v(e,t,r).then(function(){return r})}).then(function(e){function r(i,o,a){var u,c=o.split("#"),f=e.refs[o];n[c[0]===t.location?"#"+c[1]:I(t.subDocPath.concat(a))]=f,!f.circular&&s(f)?(u=e.deps[f.refdId],0!==f.refdId.indexOf(i)&&Object.keys(u).forEach(function(e){r(f.refdId,f.refdId+e.substr(1),a.concat(S(e)))})):!f.circular&&f.error&&(f.error=f.error.replace("options.subDocPath","JSON Pointer"),f.error.indexOf("#")>-1&&(f.error=f.error.replace(f.uri.substr(f.uri.indexOf("#")),f.uri)),0!==f.error.indexOf("ENOENT:")&&0!==f.error.indexOf("Not Found")||(f.error="JSON Pointer points to missing location: "+f.uri))}var n={},i=[],o=[],c=new $.Graph,f=d(t.location),l=f+I(t.subDocPath);return Object.keys(e.deps).forEach(function(e){c.setNode(e)}),T.each(e.deps,function(e,t){T.each(e,function(e){c.setEdge(t,e)})}),(i=$.alg.findCycles(c)).forEach(function(e){e.forEach(function(e){-1===o.indexOf(e)&&o.push(e)})}),T.each(e.deps,function(t,r){T.each(t,function(t,n){var s,u=!1,c=r+n.slice(1),f=e.refs[r+n.slice(1)],l=a(f);o.indexOf(t)>-1&&i.forEach(function(e){u||(s=e.indexOf(t))>-1&&e.forEach(function(t){u||0===c.indexOf(t+"/")&&(l&&s===e.length-1||!l)&&(u=!0)})}),u&&(f.circular=!0)})}),T.each(e.deps,function(r,n){var i=n.split("#"),o=e.docs[i[0]],a=S(i[1]);T.each(r,function(r,n){var s=r.split("#"),c=e.docs[s[0]],f=a.concat(S(n)),l=e.refs[i[0]+I(f)];if(T.isUndefined(l.error)&&T.isUndefined(l.missing))if(!t.resolveCirculars&&l.circular)l.value=l.def;else{try{l.value=u(c,S(s[1]))}catch(e){return void y(l,e)}""===i[1]&&"#"===n?e.docs[i[0]]=l.value:_(o,f,l.value)}})}),Object.keys(e.refs).forEach(function(e){0===e.indexOf(l)&&r(l,e,S(e.substr(l.length)))}),T.each(e.refs,function(e){delete e.refdId}),{refs:n,resolved:e.docs[f]}})}var T=e("lodash"),$=e("graphlib"),C=e("path"),R=e("path-loader"),D=e("querystring"),k=e("slash"),M=e("uri-js"),F=/~(?:[^01]|$)/g,U={},N=["relative","remote"],L=["absolute","uri"],q={};"undefined"==typeof Promise&&e("native-promise-only"),t.exports.clearCache=function(){U={}},t.exports.decodePath=w,t.exports.encodePath=x,t.exports.findRefs=O,t.exports.findRefsAt=function(e,t){var r=Promise.resolve();return r=r.then(function(){if(!T.isString(e))throw new TypeError("location must be a string");return T.isUndefined(t)&&(t={}),T.isObject(t)&&(t.location=e),t=E(t),l(t.location,t)}).then(function(e){var r=T.cloneDeep(U[t.location]),n=T.cloneDeep(t),i=g(t.location);return T.isUndefined(r.refs)&&(delete n.filter,delete n.subDocPath,n.includeInvalid=!0,U[t.location].refs=O(e,n)),T.isUndefined(t.filter)||(n.filter=t.filter),T.isUndefined(i.fragment)?T.isUndefined(i.subDocPath)||(n.subDocPath=t.subDocPath):n.subDocPath=S(decodeURI(i.fragment)),{refs:O(e,n),value:e}})},t.exports.getRefDetails=j,t.exports.isPtr=A,t.exports.isRef=function(e,t){return p(e,t)&&"invalid"!==j(e,t).type},t.exports.pathFromPtr=S,t.exports.pathToPtr=I,t.exports.resolveRefs=P,t.exports.resolveRefsAt=function(e,t){var r=Promise.resolve();return r=r.then(function(){if(!T.isString(e))throw new TypeError("location must be a string");return T.isUndefined(t)&&(t={}),T.isObject(t)&&(t.location=e),t=E(t),l(t.location,t)}).then(function(e){var r=T.cloneDeep(t),n=g(t.location);return T.isUndefined(n.fragment)||(r.subDocPath=S(decodeURI(n.fragment))),P(e,r).then(function(t){return{refs:t.refs,resolved:t.resolved,value:e}})})}}).call(this,e("_process"))},{_process:95,graphlib:7,lodash:89,"native-promise-only":90,path:91,"path-loader":92,querystring:98,slash:99,"uri-js":109}],58:[function(e,t,r){var n=[];t.exports=n},{}],59:[function(e,t,r){var n=e("lodash._basecreate"),i=e("lodash.isobject"),o=e("lodash._setbinddata"),a=e("lodash._slice"),s=[].push;t.exports=function(e){function t(){if(u){var e=a(u);s.apply(e,arguments)}if(this instanceof t){var o=n(r.prototype),f=r.apply(o,e||arguments);return i(f)?f:o}return r.apply(c,e||arguments)}var r=e[0],u=e[2],c=e[4];return o(t,e),t}},{"lodash._basecreate":60,"lodash._setbinddata":72,"lodash._slice":74,"lodash.isobject":86}],60:[function(e,t,r){(function(r){function n(e,t){return o(e)?a(e):{}}var i=e("lodash._isnative"),o=e("lodash.isobject"),a=(e("lodash.noop"),i(a=Object.create)&&a);a||(n=function(){function e(){}return function(t){if(o(t)){e.prototype=t;var n=new e;e.prototype=null}return n||r.Object()}}()),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":68,"lodash.isobject":86,"lodash.noop":87}],61:[function(e,t,r){function n(e,t,r,_,x){if(r){var O=r(e);if(void 0!==O)return O}if(!c(e))return e;var j=b.call(e);if(!v[j])return e;var A=w[j];switch(j){case d:case h:return new A(+e);case m:case g:return new A(e);case y:return O=A(e.source,p.exec(e)),O.lastIndex=e.lastIndex,O}var S=u(e);if(t){var I=!_;_||(_=s()),x||(x=s());for(var P=_.length;P--;)if(_[P]==e)return x[P];O=S?A(e.length):{}}else O=S?l(e):i({},e);return S&&(E.call(e,"index")&&(O.index=e.index),E.call(e,"input")&&(O.input=e.input)),t?(_.push(e),x.push(O),(S?o:a)(e,function(e,i){O[i]=n(e,t,r,_,x)}),I&&(f(_),f(x)),O):O}var i=e("lodash.assign"),o=e("lodash.foreach"),a=e("lodash.forown"),s=e("lodash._getarray"),u=e("lodash.isarray"),c=e("lodash.isobject"),f=e("lodash._releasearray"),l=e("lodash._slice"),p=/\w*$/,d="[object Boolean]",h="[object Date]",m="[object Number]",y="[object RegExp]",g="[object String]",v={};v["[object Function]"]=!1,v["[object Arguments]"]=v["[object Array]"]=v[d]=v[h]=v[m]=v["[object Object]"]=v[y]=v[g]=!0;var _=Object.prototype,b=_.toString,E=_.hasOwnProperty,w={};w["[object Array]"]=Array,w[d]=Boolean,w[h]=Date,w["[object Function]"]=Function,w["[object Object]"]=Object,w[m]=Number,w[y]=RegExp,w[g]=String,t.exports=n},{"lodash._getarray":67,"lodash._releasearray":71,"lodash._slice":74,"lodash.assign":75,"lodash.foreach":79,"lodash.forown":80,"lodash.isarray":62,"lodash.isobject":86}],62:[function(e,t,r){var n=e("lodash._isnative"),i=Object.prototype.toString,o=n(o=Array.isArray)&&o,a=o||function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&"[object Array]"==i.call(e)||!1};t.exports=a},{"lodash._isnative":68}],63:[function(e,t,r){var n=e("lodash.bind"),i=e("lodash.identity"),o=e("lodash._setbinddata"),a=e("lodash.support"),s=/^\s*function[ \n\r\t]+\w/,u=/\bthis\b/,c=Function.prototype.toString;t.exports=function(e,t,r){if("function"!=typeof e)return i;if(void 0===t||!("prototype"in e))return e;var f=e.__bindData__;if(void 0===f&&(a.funcNames&&(f=!e.name),!(f=f||!a.funcDecomp))){var l=c.call(e);a.funcNames||(f=!s.test(l)),f||(f=u.test(l),o(e,f))}if(!1===f||!0!==f&&1&f[1])return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,o){return e.call(t,r,n,i,o)}}return n(e,t)}},{"lodash._setbinddata":72,"lodash.bind":77,"lodash.identity":83,"lodash.support":88}],64:[function(e,t,r){function n(e){function t(){var e=h?p:this;if(f){var a=s(f);u.apply(a,arguments)}if((l||y)&&(a||(a=s(arguments)),l&&u.apply(a,l),y&&a.length3&&"function"==typeof c[l-2])var p=n(c[--l-1],c[l--],2);else l>2&&"function"==typeof c[l-1]&&(p=c[--l]);for(;++f2?n(e,17,i(arguments,2),null,t):n(e,1,null,null,t)}},{"lodash._createwrapper":66,"lodash._slice":74}],78:[function(e,t,r){var n=e("lodash._baseclone"),i=e("lodash._basecreatecallback");t.exports=function(e,t,r){return n(e,!0,"function"==typeof t&&i(t,r,1))}},{"lodash._baseclone":61,"lodash._basecreatecallback":63}],79:[function(e,t,r){var n=e("lodash._basecreatecallback"),i=e("lodash.forown");t.exports=function(e,t,r){var o=-1,a=e?e.length:0;if(t=t&&void 0===r?t:n(t,r,3),"number"==typeof a)for(;++o-1},o.prototype.set=function(e,t){var r=this.__data__,n=s(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},a.prototype.clear=function(){this.__data__={hash:new i,map:new(Q||o),string:new i}},a.prototype.delete=function(e){return p(this,e).delete(e)},a.prototype.get=function(e){return p(this,e).get(e)},a.prototype.has=function(e){return p(this,e).has(e)},a.prototype.set=function(e,t){return p(this,e).set(e,t),this};var ne=_(function(e){e=j(e);var t=[];return D.test(e)&&t.push(""),e.replace(k,function(e,r,n,i){t.push(n?i.replace(F,"$1"):r||e)}),t});_.Cache=a;var ie=Array.isArray;t.exports=function(e,t,r){var n=null==e?void 0:u(e,t);return void 0===n?r:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],83:[function(e,t,r){t.exports=function(e){return e}},{}],84:[function(e,t,r){(function(e){function n(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++rc))return!1;var l=a.get(e);if(l&&a.get(t))return l==t;var p=-1,d=!0,m=r&K?new h:void 0;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e-1&&e%1==0&&e<=Z}function B(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function z(e){return null!=e&&"object"==typeof e}function Y(e){return N(e)?y(e):O(e)}var W=200,V="__lodash_hash_undefined__",H=1,K=2,Z=9007199254740991,G="[object Arguments]",X="[object Array]",J="[object AsyncFunction]",Q="[object Boolean]",ee="[object Date]",te="[object Error]",re="[object Function]",ne="[object GeneratorFunction]",ie="[object Map]",oe="[object Number]",ae="[object Null]",se="[object Object]",ue="[object Proxy]",ce="[object RegExp]",fe="[object Set]",le="[object String]",pe="[object Symbol]",de="[object Undefined]",he="[object ArrayBuffer]",me="[object DataView]",ye=/[\\^$.*+?()[\]{}|]/g,ge=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,_e={};_e["[object Float32Array]"]=_e["[object Float64Array]"]=_e["[object Int8Array]"]=_e["[object Int16Array]"]=_e["[object Int32Array]"]=_e["[object Uint8Array]"]=_e["[object Uint8ClampedArray]"]=_e["[object Uint16Array]"]=_e["[object Uint32Array]"]=!0,_e[G]=_e[X]=_e[he]=_e[Q]=_e[me]=_e[ee]=_e[te]=_e[re]=_e[ie]=_e[oe]=_e[se]=_e[ce]=_e[fe]=_e[le]=_e["[object WeakMap]"]=!1;var be="object"==typeof e&&e&&e.Object===Object&&e,Ee="object"==typeof self&&self&&self.Object===Object&&self,we=be||Ee||Function("return this")(),xe="object"==typeof r&&r&&!r.nodeType&&r,Oe=xe&&"object"==typeof t&&t&&!t.nodeType&&t,je=Oe&&Oe.exports===xe,Ae=je&&be.process,Se=function(){try{return Ae&&Ae.binding&&Ae.binding("util")}catch(e){}}(),Ie=Se&&Se.isTypedArray,Pe=Array.prototype,Te=Function.prototype,$e=Object.prototype,Ce=we["__core-js_shared__"],Re=Te.toString,De=$e.hasOwnProperty,ke=function(){var e=/[^.]+$/.exec(Ce&&Ce.keys&&Ce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Me=$e.toString,Fe=RegExp("^"+Re.call(De).replace(ye,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=je?we.Buffer:void 0,Ne=we.Symbol,Le=we.Uint8Array,qe=$e.propertyIsEnumerable,Be=Pe.splice,ze=Ne?Ne.toStringTag:void 0,Ye=Object.getOwnPropertySymbols,We=Ue?Ue.isBuffer:void 0,Ve=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),He=T(we,"DataView"),Ke=T(we,"Map"),Ze=T(we,"Promise"),Ge=T(we,"Set"),Xe=T(we,"WeakMap"),Je=T(Object,"create"),Qe=F(He),et=F(Ke),tt=F(Ze),rt=F(Ge),nt=F(Xe),it=Ne?Ne.prototype:void 0,ot=it?it.valueOf:void 0;l.prototype.clear=function(){this.__data__=Je?Je(null):{},this.size=0},l.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},l.prototype.get=function(e){var t=this.__data__;if(Je){var r=t[e];return r===V?void 0:r}return De.call(t,e)?t[e]:void 0},l.prototype.has=function(e){var t=this.__data__;return Je?void 0!==t[e]:De.call(t,e)},l.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Je&&void 0===t?V:t,this},p.prototype.clear=function(){this.__data__=[],this.size=0},p.prototype.delete=function(e){var t=this.__data__,r=g(t,e);return!(r<0||(r==t.length-1?t.pop():Be.call(t,r,1),--this.size,0))},p.prototype.get=function(e){var t=this.__data__,r=g(t,e);return r<0?void 0:t[r][1]},p.prototype.has=function(e){return g(this.__data__,e)>-1},p.prototype.set=function(e,t){var r=this.__data__,n=g(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},d.prototype.clear=function(){this.size=0,this.__data__={hash:new l,map:new(Ke||p),string:new l}},d.prototype.delete=function(e){var t=P(this,e).delete(e);return this.size-=t?1:0,t},d.prototype.get=function(e){return P(this,e).get(e)},d.prototype.has=function(e){return P(this,e).has(e)},d.prototype.set=function(e,t){var r=P(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},h.prototype.add=h.prototype.push=function(e){return this.__data__.set(e,V),this},h.prototype.has=function(e){return this.__data__.has(e)},m.prototype.clear=function(){this.__data__=new p,this.size=0},m.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},m.prototype.get=function(e){return this.__data__.get(e)},m.prototype.has=function(e){return this.__data__.has(e)},m.prototype.set=function(e,t){var r=this.__data__;if(r instanceof p){var n=r.__data__;if(!Ke||n.length-1}function p(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function F(e,t){for(var r=e.length;r--&&w(t,e[r],0)>-1;);return r}function U(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}function N(e){return"\\"+Or[e]}function L(e,t){return null==e?re:e[t]}function q(e){return mr.test(e)}function B(e){return yr.test(e)}function z(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function Y(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function W(e,t){return function(r){return e(t(r))}}function V(e,t){for(var r=-1,n=e.length,i=0,o=[];++r>>1,Fe=[["ary",Ee],["bind",he],["bindKey",me],["curry",ge],["curryRight",ve],["flip",xe],["partial",_e],["partialRight",be],["rearg",we]],Ue="[object Arguments]",Ne="[object Array]",Le="[object AsyncFunction]",qe="[object Boolean]",Be="[object Date]",ze="[object DOMException]",Ye="[object Error]",We="[object Function]",Ve="[object GeneratorFunction]",He="[object Map]",Ke="[object Number]",Ze="[object Null]",Ge="[object Object]",Xe="[object Proxy]",Je="[object RegExp]",Qe="[object Set]",et="[object String]",tt="[object Symbol]",rt="[object Undefined]",nt="[object WeakMap]",it="[object WeakSet]",ot="[object ArrayBuffer]",at="[object DataView]",st="[object Float32Array]",ut="[object Float64Array]",ct="[object Int8Array]",ft="[object Int16Array]",lt="[object Int32Array]",pt="[object Uint8Array]",dt="[object Uint8ClampedArray]",ht="[object Uint16Array]",mt="[object Uint32Array]",yt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,vt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_t=/&(?:amp|lt|gt|quot|#39);/g,bt=/[&<>"']/g,Et=RegExp(_t.source),wt=RegExp(bt.source),xt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,jt=/<%=([\s\S]+?)%>/g,At=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,St=/^\w*$/,It=/^\./,Pt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tt=/[\\^$.*+?()[\]{}|]/g,$t=RegExp(Tt.source),Ct=/^\s+|\s+$/g,Rt=/^\s+/,Dt=/\s+$/,kt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mt=/\{\n\/\* \[wrapped with (.+)\] \*/,Ft=/,? & /,Ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Nt=/\\(\\)?/g,Lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,qt=/\w*$/,Bt=/^[-+]0x[0-9a-f]+$/i,zt=/^0b[01]+$/i,Yt=/^\[object .+?Constructor\]$/,Wt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Ht=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Kt=/($^)/,Zt=/['\n\r\u2028\u2029\\]/g,Gt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Xt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Jt="["+Xt+"]",Qt="["+Gt+"]",er="[a-z\\xdf-\\xf6\\xf8-\\xff]",tr="[^\\ud800-\\udfff"+Xt+"\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",rr="\\ud83c[\\udffb-\\udfff]",nr="(?:\\ud83c[\\udde6-\\uddff]){2}",ir="[\\ud800-\\udbff][\\udc00-\\udfff]",or="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ar="(?:"+er+"|"+tr+")",sr="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ur="[\\ufe0e\\ufe0f]?"+sr+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",nr,ir].join("|")+")[\\ufe0e\\ufe0f]?"+sr+")*"),cr="(?:"+["[\\u2700-\\u27bf]",nr,ir].join("|")+")"+ur,fr="(?:"+["[^\\ud800-\\udfff]"+Qt+"?",Qt,nr,ir,"[\\ud800-\\udfff]"].join("|")+")",lr=RegExp("['’]","g"),pr=RegExp(Qt,"g"),dr=RegExp(rr+"(?="+rr+")|"+fr+ur,"g"),hr=RegExp([or+"?"+er+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Jt,or,"$"].join("|")+")","(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Jt,or+ar,"$"].join("|")+")",or+"?"+ar+"+(?:['’](?:d|ll|m|re|s|t|ve))?",or+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)","\\d+",cr].join("|"),"g"),mr=RegExp("[\\u200d\\ud800-\\udfff"+Gt+"\\ufe0e\\ufe0f]"),yr=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,gr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],vr=-1,_r={};_r[st]=_r[ut]=_r[ct]=_r[ft]=_r[lt]=_r[pt]=_r[dt]=_r[ht]=_r[mt]=!0,_r[Ue]=_r[Ne]=_r[ot]=_r[qe]=_r[at]=_r[Be]=_r[Ye]=_r[We]=_r[He]=_r[Ke]=_r[Ge]=_r[Je]=_r[Qe]=_r[et]=_r[nt]=!1;var br={};br[Ue]=br[Ne]=br[ot]=br[at]=br[qe]=br[Be]=br[st]=br[ut]=br[ct]=br[ft]=br[lt]=br[He]=br[Ke]=br[Ge]=br[Je]=br[Qe]=br[et]=br[tt]=br[pt]=br[dt]=br[ht]=br[mt]=!0,br[Ye]=br[We]=br[nt]=!1;var Er={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},wr={"&":"&","<":"<",">":">",'"':""","'":"'"},xr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Or={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},jr=parseFloat,Ar=parseInt,Sr="object"==typeof e&&e&&e.Object===Object&&e,Ir="object"==typeof self&&self&&self.Object===Object&&self,Pr=Sr||Ir||Function("return this")(),Tr="object"==typeof r&&r&&!r.nodeType&&r,$r=Tr&&"object"==typeof t&&t&&!t.nodeType&&t,Cr=$r&&$r.exports===Tr,Rr=Cr&&Sr.process,Dr=function(){try{return Rr&&Rr.binding&&Rr.binding("util")}catch(e){}}(),kr=Dr&&Dr.isArrayBuffer,Mr=Dr&&Dr.isDate,Fr=Dr&&Dr.isMap,Ur=Dr&&Dr.isRegExp,Nr=Dr&&Dr.isSet,Lr=Dr&&Dr.isTypedArray,qr=A("length"),Br=S(Er),zr=S(wr),Yr=S(xr),Wr=function e(t){function r(e){if(ta(e)&&!Yu(e)&&!(e instanceof Z)){if(e instanceof S)return e;if(Ya.call(e,"__wrapped__"))return jo(e)}return new S(e)}function v(){}function S(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=re}function Z(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=De,this.__views__=[]}function Q(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function dr(e,t,r,n,i,o){var a,u=t&ce,c=t&fe,f=t≤if(r&&(a=i?r(e,n,i,o):r(e)),a!==re)return a;if(!ea(e))return e;var l=Yu(e);if(l){if(a=Ji(e),!u)return ai(e,a)}else{var p=eu(e),d=p==We||p==Ve;if(Vu(e))return Kn(e,u);if(p==Ge||p==Ue||d&&!i){if(a=c||d?{}:Qi(e),!u)return c?ci(e,sr(a,e)):ui(e,ar(a,e))}else{if(!br[p])return i?e:{};a=eo(e,p,dr,u)}}o||(o=new Xt);var h=o.get(e);if(h)return h;o.set(e,a);var m=f?c?qi:Li:c?ya:ma,y=l?re:m(e);return s(y||e,function(n,i){y&&(n=e[i=n]),nr(a,i,dr(n,t,r,i,e,o))}),a}function hr(e){var t=ma(e);return function(r){return mr(r,e,t)}}function mr(e,t,r){var n=r.length;if(null==e)return!n;for(e=ka(e);n--;){var i=r[n],o=t[i],a=e[i];if(a===re&&!(i in e)||!o(a))return!1}return!0}function yr(e,t,r){if("function"!=typeof e)throw new Ua(oe);return nu(function(){e.apply(re,r)},t)}function Er(e,t,r,n){var i=-1,o=l,a=!0,s=e.length,u=[],c=t.length;if(!s)return u;r&&(t=d(t,R(r))),n?(o=p,a=!1):t.length>=ne&&(o=k,a=!1,t=new Gt(t));e:for(;++ii?0:i+r),(n=n===re||n>i?i:ua(n))<0&&(n+=i),n=r>n?0:ca(n);r0&&r(s)?t>1?Ir(s,t-1,r,n,i):h(i,s):n||(i[i.length]=s)}return i}function Tr(e,t){return e&&Ys(e,t,ma)}function $r(e,t){return e&&Ws(e,t,ma)}function Rr(e,t){return f(t,function(t){return Xo(e[t])})}function Dr(e,t){for(var r=0,n=(t=Vn(t,e)).length;null!=e&&rt}function Kr(e,t){return null!=e&&Ya.call(e,t)}function Zr(e,t){return null!=e&&t in ka(e)}function Gr(e,t,r){return e>=bs(t,r)&&e<_s(t,r)}function Xr(e,t,r){for(var n=r?p:l,i=e[0].length,o=e.length,a=o,s=Ta(o),u=1/0,c=[];a--;){var f=e[a];a&&t&&(f=d(f,R(t))),u=bs(f.length,u),s[a]=!r&&(t||i>=120&&f.length>=120)?new Gt(a&&f):re}f=e[0];var h=-1,m=s[0];e:for(;++h-1;)s!==e&&is.call(s,u,1),is.call(e,u,1);return e}function En(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;no(i)?is.call(e,i,1):Un(e,i)}}return e}function wn(e,t){return e+ds(xs()*(t-e+1))}function xn(e,t,r,n){for(var i=-1,o=_s(ps((t-e)/(r||1)),0),a=Ta(o);o--;)a[n?o:++i]=e,e+=r;return a}function On(e,t){var r="";if(!e||t<1||t>$e)return r;do{t%2&&(r+=e),(t=ds(t/2))&&(e+=e)}while(t);return r}function jn(e,t){return iu(yo(e,t,xa),e+"")}function An(e){return Qt(va(e))}function Sn(e,t){var r=va(e);return Eo(r,fr(t,0,r.length))}function In(e,t,r,n){if(!ea(e))return e;for(var i=-1,o=(t=Vn(t,e)).length,a=o-1,s=e;null!=s&&++ii?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Ta(i);++n>>1,a=e[o];null!==a&&!oa(a)&&(r?a<=t:a=ne){var c=t?null:Gs(e);if(c)return H(c);a=!1,i=k,u=new Gt}else u=t?[]:s;e:for(;++n=n?e:Tn(e,t,r)}function Kn(e,t){if(t)return e.slice();var r=e.length,n=es?es(r):new e.constructor(r);return e.copy(n),n}function Zn(e){var t=new e.constructor(e.byteLength);return new Qa(t).set(new Qa(e)),t}function Gn(e,t){var r=t?Zn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Xn(e,t,r){return m(t?r(Y(e),ce):Y(e),n,new e.constructor)}function Jn(e){var t=new e.constructor(e.source,qt.exec(e));return t.lastIndex=e.lastIndex,t}function Qn(e,t,r){return m(t?r(H(e),ce):H(e),i,new e.constructor)}function ei(e){return Ns?ka(Ns.call(e)):{}}function ti(e,t){var r=t?Zn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ri(e,t){if(e!==t){var r=e!==re,n=null===e,i=e===e,o=oa(e),a=t!==re,s=null===t,u=t===t,c=oa(t);if(!s&&!c&&!o&&e>t||o&&a&&u&&!s&&!c||n&&a&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e=s?u:u*("desc"==r[n]?-1:1)}return e.index-t.index}function ii(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,c=_s(o-a,0),f=Ta(u+c),l=!n;++s1?r[i-1]:re,a=i>2?r[2]:re;for(o=e.length>3&&"function"==typeof o?(i--,o):re,a&&io(r[0],r[1],a)&&(o=i<3?re:o,i=1),t=ka(t);++n-1?i[o?t[a]:a]:re}}function bi(e){return Ni(function(t){var r=t.length,n=r,i=S.prototype.thru;for(e&&t.reverse();n--;){var o=t[n];if("function"!=typeof o)throw new Ua(oe);if(i&&!a&&"wrapper"==Bi(o))var a=new S([],!0)}for(n=a?n:r;++n1&&v.reverse(),l&&us))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,l=!0,p=r&de?new Gt:re;for(o.set(e,t),o.set(t,e);++f1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(kt,"{\n/* [wrapped with "+t+"] */\n")}function ro(e){return Yu(e)||zu(e)||!!(os&&e&&e[os])}function no(e,t){return!!(t=null==t?$e:t)&&("number"==typeof e||Vt.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Ae)return arguments[0]}else t=0;return e.apply(re,arguments)}}function Eo(e,t){var r=-1,n=e.length,i=n-1;for(t=t===re?n:t;++r0&&(r=t.apply(this,arguments)),e<=1&&(t=re),r}}function Bo(e,t,r){var n=Ci(e,ge,re,re,re,re,re,t=r?re:t);return n.placeholder=Bo.placeholder,n}function zo(e,t,r){var n=Ci(e,ve,re,re,re,re,re,t=r?re:t);return n.placeholder=zo.placeholder,n}function Yo(e,t,r){function n(t){var r=f,n=l;return f=l=re,y=t,d=e.apply(n,r)}function i(e){return y=e,h=nu(s,t),g?n(e):d}function o(e){var r=e-y,n=t-(e-m);return v?bs(n,p-r):n}function a(e){var r=e-m,n=e-y;return m===re||r>=t||r<0||v&&n>=p}function s(){var e=Cu();if(a(e))return u(e);h=nu(s,o(e))}function u(e){return h=re,_&&f?n(e):(f=l=re,d)}function c(){var e=Cu(),r=a(e);if(f=arguments,l=this,m=e,r){if(h===re)return i(m);if(v)return h=nu(s,t),n(m)}return h===re&&(h=nu(s,t)),d}var f,l,p,d,h,m,y=0,g=!1,v=!1,_=!0;if("function"!=typeof e)throw new Ua(oe);return t=fa(t)||0,ea(r)&&(g=!!r.leading,p=(v="maxWait"in r)?_s(fa(r.maxWait)||0,t):p,_="trailing"in r?!!r.trailing:_),c.cancel=function(){h!==re&&Zs(h),y=0,f=m=l=h=re},c.flush=function(){return h===re?d:u(Cu())},c}function Wo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ua(oe);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Wo.Cache||Ut),r}function Vo(e){if("function"!=typeof e)throw new Ua(oe);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function Ho(e,t){return e===t||e!==e&&t!==t}function Ko(e){return null!=e&&Qo(e.length)&&!Xo(e)}function Zo(e){return ta(e)&&Ko(e)}function Go(e){if(!ta(e))return!1;var t=Vr(e);return t==Ye||t==ze||"string"==typeof e.message&&"string"==typeof e.name&&!na(e)}function Xo(e){if(!ea(e))return!1;var t=Vr(e);return t==We||t==Ve||t==Le||t==Xe}function Jo(e){return"number"==typeof e&&e==ua(e)}function Qo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=$e}function ea(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ta(e){return null!=e&&"object"==typeof e}function ra(e){return"number"==typeof e||ta(e)&&Vr(e)==Ke}function na(e){if(!ta(e)||Vr(e)!=Ge)return!1;var t=ts(e);if(null===t)return!0;var r=Ya.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&za.call(r)==Ka}function ia(e){return"string"==typeof e||!Yu(e)&&ta(e)&&Vr(e)==et}function oa(e){return"symbol"==typeof e||ta(e)&&Vr(e)==tt}function aa(e){if(!e)return[];if(Ko(e))return ia(e)?J(e):ai(e);if(as&&e[as])return z(e[as]());var t=eu(e);return(t==He?Y:t==Qe?H:va)(e)}function sa(e){return e?(e=fa(e))===Te||e===-Te?(e<0?-1:1)*Ce:e===e?e:0:0===e?e:0}function ua(e){var t=sa(e),r=t%1;return t===t?r?t-r:t:0}function ca(e){return e?fr(ua(e),0,De):0}function fa(e){if("number"==typeof e)return e;if(oa(e))return Re;if(ea(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ea(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Ct,"");var r=zt.test(e);return r||Wt.test(e)?Ar(e.slice(2),r?2:8):Bt.test(e)?Re:+e}function la(e){return si(e,ya(e))}function pa(e){return null==e?"":Mn(e)}function da(e,t,r){var n=null==e?re:Dr(e,t);return n===re?r:n}function ha(e,t){return null!=e&&Xi(e,t,Zr)}function ma(e){return Ko(e)?Jt(e):sn(e)}function ya(e){return Ko(e)?Jt(e,!0):un(e)}function ga(e,t){if(null==e)return{};var r=d(qi(e),function(e){return[e]});return t=Yi(t),vn(e,r,function(e,r){return t(e,r[0])})}function va(e){return null==e?[]:D(e,ma(e))}function _a(e){return xc(pa(e).toLowerCase())}function ba(e){return(e=pa(e))&&e.replace(Ht,Br).replace(pr,"")}function Ea(e,t,r){return e=pa(e),(t=r?re:t)===re?B(e)?te(e):_(e):e.match(t)||[]}function wa(e){return function(){return e}}function xa(e){return e}function Oa(e){return an("function"==typeof e?e:dr(e,ce))}function ja(e,t,r){var n=ma(t),i=Rr(t,n);null!=r||ea(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=Rr(t,ma(t)));var o=!(ea(r)&&"chain"in r&&!r.chain),a=Xo(e);return s(i,function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=ai(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,h([this.value()],arguments))})}),e}function Aa(){}function Sa(e){return oo(e)?A(wo(e)):_n(e)}function Ia(){return[]}function Pa(){return!1}var Ta=(t=null==t?Pr:Wr.defaults(Pr.Object(),t,Wr.pick(Pr,gr))).Array,$a=t.Date,Ca=t.Error,Ra=t.Function,Da=t.Math,ka=t.Object,Ma=t.RegExp,Fa=t.String,Ua=t.TypeError,Na=Ta.prototype,La=Ra.prototype,qa=ka.prototype,Ba=t["__core-js_shared__"],za=La.toString,Ya=qa.hasOwnProperty,Wa=0,Va=function(){var e=/[^.]+$/.exec(Ba&&Ba.keys&&Ba.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ha=qa.toString,Ka=za.call(ka),Za=Pr._,Ga=Ma("^"+za.call(Ya).replace(Tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xa=Cr?t.Buffer:re,Ja=t.Symbol,Qa=t.Uint8Array,es=Xa?Xa.allocUnsafe:re,ts=W(ka.getPrototypeOf,ka),rs=ka.create,ns=qa.propertyIsEnumerable,is=Na.splice,os=Ja?Ja.isConcatSpreadable:re,as=Ja?Ja.iterator:re,ss=Ja?Ja.toStringTag:re,us=function(){try{var e=Hi(ka,"defineProperty");return e({},"",{}),e}catch(e){}}(),cs=t.clearTimeout!==Pr.clearTimeout&&t.clearTimeout,fs=$a&&$a.now!==Pr.Date.now&&$a.now,ls=t.setTimeout!==Pr.setTimeout&&t.setTimeout,ps=Da.ceil,ds=Da.floor,hs=ka.getOwnPropertySymbols,ms=Xa?Xa.isBuffer:re,ys=t.isFinite,gs=Na.join,vs=W(ka.keys,ka),_s=Da.max,bs=Da.min,Es=$a.now,ws=t.parseInt,xs=Da.random,Os=Na.reverse,js=Hi(t,"DataView"),As=Hi(t,"Map"),Ss=Hi(t,"Promise"),Is=Hi(t,"Set"),Ps=Hi(t,"WeakMap"),Ts=Hi(ka,"create"),$s=Ps&&new Ps,Cs={},Rs=xo(js),Ds=xo(As),ks=xo(Ss),Ms=xo(Is),Fs=xo(Ps),Us=Ja?Ja.prototype:re,Ns=Us?Us.valueOf:re,Ls=Us?Us.toString:re,qs=function(){function e(){}return function(t){if(!ea(t))return{};if(rs)return rs(t);e.prototype=t;var r=new e;return e.prototype=re,r}}();r.templateSettings={escape:xt,evaluate:Ot,interpolate:jt,variable:"",imports:{_:r}},r.prototype=v.prototype,r.prototype.constructor=r,S.prototype=qs(v.prototype),S.prototype.constructor=S,Z.prototype=qs(v.prototype),Z.prototype.constructor=Z,Q.prototype.clear=function(){this.__data__=Ts?Ts(null):{},this.size=0},Q.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Q.prototype.get=function(e){var t=this.__data__;if(Ts){var r=t[e];return r===ae?re:r}return Ya.call(t,e)?t[e]:re},Q.prototype.has=function(e){var t=this.__data__;return Ts?t[e]!==re:Ya.call(t,e)},Q.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ts&&t===re?ae:t,this},ee.prototype.clear=function(){this.__data__=[],this.size=0},ee.prototype.delete=function(e){var t=this.__data__,r=ir(t,e);return!(r<0||(r==t.length-1?t.pop():is.call(t,r,1),--this.size,0))},ee.prototype.get=function(e){var t=this.__data__,r=ir(t,e);return r<0?re:t[r][1]},ee.prototype.has=function(e){return ir(this.__data__,e)>-1},ee.prototype.set=function(e,t){var r=this.__data__,n=ir(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Ut.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(As||ee),string:new Q}},Ut.prototype.delete=function(e){var t=Wi(this,e).delete(e);return this.size-=t?1:0,t},Ut.prototype.get=function(e){return Wi(this,e).get(e)},Ut.prototype.has=function(e){return Wi(this,e).has(e)},Ut.prototype.set=function(e,t){var r=Wi(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Gt.prototype.add=Gt.prototype.push=function(e){return this.__data__.set(e,ae),this},Gt.prototype.has=function(e){return this.__data__.has(e)},Xt.prototype.clear=function(){this.__data__=new ee,this.size=0},Xt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Xt.prototype.get=function(e){return this.__data__.get(e)},Xt.prototype.has=function(e){return this.__data__.has(e)},Xt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ee){var n=r.__data__;if(!As||n.length1?e[t-1]:re;return r="function"==typeof r?(e.pop(),r):re,Do(e,r)}),xu=Ni(function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return cr(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Z&&no(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:Mo,args:[i],thisArg:re}),new S(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(re),e})):this.thru(i)}),Ou=fi(function(e,t,r){Ya.call(e,r)?++e[r]:ur(e,r,1)}),ju=_i(Ao),Au=_i(So),Su=fi(function(e,t,r){Ya.call(e,r)?e[r].push(t):ur(e,r,[t])}),Iu=jn(function(e,t,r){var n=-1,i="function"==typeof t,a=Ko(e)?Ta(e.length):[];return Bs(e,function(e){a[++n]=i?o(t,e,r):Qr(e,t,r)}),a}),Pu=fi(function(e,t,r){ur(e,r,t)}),Tu=fi(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),$u=jn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&io(e,t[0],t[1])?t=[]:r>2&&io(t[0],t[1],t[2])&&(t=[t[0]]),yn(e,Ir(t,1),[])}),Cu=fs||function(){return Pr.Date.now()},Ru=jn(function(e,t,r){var n=he;if(r.length){var i=V(r,zi(Ru));n|=_e}return Ci(e,n,t,r,i)}),Du=jn(function(e,t,r){var n=he|me;if(r.length){var i=V(r,zi(Du));n|=_e}return Ci(t,n,e,r,i)}),ku=jn(function(e,t){return yr(e,1,t)}),Mu=jn(function(e,t,r){return yr(e,fa(t)||0,r)});Wo.Cache=Ut;var Fu=Ks(function(e,t){var r=(t=1==t.length&&Yu(t[0])?d(t[0],R(Yi())):d(Ir(t,1),R(Yi()))).length;return jn(function(n){for(var i=-1,a=bs(n.length,r);++i=t}),zu=en(function(){return arguments}())?en:function(e){return ta(e)&&Ya.call(e,"callee")&&!ns.call(e,"callee")},Yu=Ta.isArray,Wu=kr?R(kr):function(e){return ta(e)&&Vr(e)==ot},Vu=ms||Pa,Hu=Mr?R(Mr):function(e){return ta(e)&&Vr(e)==Be},Ku=Fr?R(Fr):function(e){return ta(e)&&eu(e)==He},Zu=Ur?R(Ur):function(e){return ta(e)&&Vr(e)==Je},Gu=Nr?R(Nr):function(e){return ta(e)&&eu(e)==Qe},Xu=Lr?R(Lr):function(e){return ta(e)&&Qo(e.length)&&!!_r[Vr(e)]},Ju=Ii(cn),Qu=Ii(function(e,t){return e<=t}),ec=li(function(e,t){if(co(t)||Ko(t))si(t,ma(t),e);else for(var r in t)Ya.call(t,r)&&nr(e,r,t[r])}),tc=li(function(e,t){si(t,ya(t),e)}),rc=li(function(e,t,r,n){si(t,ya(t),e,n)}),nc=li(function(e,t,r,n){si(t,ma(t),e,n)}),ic=Ni(cr),oc=jn(function(e){return e.push(re,Ri),o(rc,re,e)}),ac=jn(function(e){return e.push(re,Di),o(lc,re,e)}),sc=wi(function(e,t,r){e[t]=r},wa(xa)),uc=wi(function(e,t,r){Ya.call(e,t)?e[t].push(r):e[t]=[r]},Yi),cc=jn(Qr),fc=li(function(e,t,r){dn(e,t,r)}),lc=li(function(e,t,r,n){dn(e,t,r,n)}),pc=Ni(function(e,t){var r={};if(null==e)return r;var n=!1;t=d(t,function(t){return t=Vn(t,e),n||(n=t.length>1),t}),si(e,qi(e),r),n&&(r=dr(r,ce|fe|le,ki));for(var i=t.length;i--;)Un(r,t[i]);return r}),dc=Ni(function(e,t){return null==e?{}:gn(e,t)}),hc=$i(ma),mc=$i(ya),yc=yi(function(e,t,r){return t=t.toLowerCase(),e+(r?_a(t):t)}),gc=yi(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),vc=yi(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),_c=mi("toLowerCase"),bc=yi(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Ec=yi(function(e,t,r){return e+(r?" ":"")+xc(t)}),wc=yi(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),xc=mi("toUpperCase"),Oc=jn(function(e,t){try{return o(e,re,t)}catch(e){return Go(e)?e:new Ca(e)}}),jc=Ni(function(e,t){return s(t,function(t){t=wo(t),ur(e,t,Ru(e[t],e))}),e}),Ac=bi(),Sc=bi(!0),Ic=jn(function(e,t){return function(r){return Qr(r,e,t)}}),Pc=jn(function(e,t){return function(r){return Qr(e,r,t)}}),Tc=Oi(d),$c=Oi(c),Cc=Oi(g),Rc=Si(),Dc=Si(!0),kc=xi(function(e,t){return e+t},0),Mc=Ti("ceil"),Fc=xi(function(e,t){return e/t},1),Uc=Ti("floor"),Nc=xi(function(e,t){return e*t},1),Lc=Ti("round"),qc=xi(function(e,t){return e-t},0);return r.after=function(e,t){if("function"!=typeof t)throw new Ua(oe);return e=ua(e),function(){if(--e<1)return t.apply(this,arguments)}},r.ary=Lo,r.assign=ec,r.assignIn=tc,r.assignInWith=rc,r.assignWith=nc,r.at=ic,r.before=qo,r.bind=Ru,r.bindAll=jc,r.bindKey=Du,r.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Yu(e)?e:[e]},r.chain=ko,r.chunk=function(e,t,r){t=(r?io(e,t,r):t===re)?1:_s(ua(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,o=0,a=Ta(ps(n/t));i>>0)?(e=pa(e))&&("string"==typeof t||null!=t&&!Zu(t))&&!(t=Mn(t))&&q(e)?Hn(J(e),0,r):e.split(t,r):[]},r.spread=function(e,t){if("function"!=typeof e)throw new Ua(oe);return t=null==t?0:_s(ua(t),0),jn(function(r){var n=r[t],i=Hn(r,0,t);return n&&h(i,n),o(e,this,i)})},r.tail=function(e){var t=null==e?0:e.length;return t?Tn(e,1,t):[]},r.take=function(e,t,r){return e&&e.length?(t=r||t===re?1:ua(t),Tn(e,0,t<0?0:t)):[]},r.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?(t=r||t===re?1:ua(t),t=n-t,Tn(e,t<0?0:t,n)):[]},r.takeRightWhile=function(e,t){return e&&e.length?Ln(e,Yi(t,3),!1,!0):[]},r.takeWhile=function(e,t){return e&&e.length?Ln(e,Yi(t,3)):[]},r.tap=function(e,t){return t(e),e},r.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Ua(oe);return ea(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Yo(e,t,{leading:n,maxWait:t,trailing:i})},r.thru=Mo,r.toArray=aa,r.toPairs=hc,r.toPairsIn=mc,r.toPath=function(e){return Yu(e)?d(e,wo):oa(e)?[e]:ai(ou(pa(e)))},r.toPlainObject=la,r.transform=function(e,t,r){var n=Yu(e),i=n||Vu(e)||Xu(e);if(t=Yi(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:ea(e)&&Xo(o)?qs(ts(e)):{}}return(i?s:Tr)(e,function(e,n,i){return t(r,e,n,i)}),r},r.unary=function(e){return Lo(e,1)},r.union=hu,r.unionBy=mu,r.unionWith=yu,r.uniq=function(e){return e&&e.length?Fn(e):[]},r.uniqBy=function(e,t){return e&&e.length?Fn(e,Yi(t,2)):[]},r.uniqWith=function(e,t){return t="function"==typeof t?t:re,e&&e.length?Fn(e,re,t):[]},r.unset=function(e,t){return null==e||Un(e,t)},r.unzip=Ro,r.unzipWith=Do,r.update=function(e,t,r){return null==e?e:Nn(e,t,Wn(r))},r.updateWith=function(e,t,r,n){return n="function"==typeof n?n:re,null==e?e:Nn(e,t,Wn(r),n)},r.values=va,r.valuesIn=function(e){return null==e?[]:D(e,ya(e))},r.without=gu,r.words=Ea,r.wrap=function(e,t){return Uu(Wn(t),e)},r.xor=vu,r.xorBy=_u,r.xorWith=bu,r.zip=Eu,r.zipObject=function(e,t){return zn(e||[],t||[],nr)},r.zipObjectDeep=function(e,t){return zn(e||[],t||[],In)},r.zipWith=wu,r.entries=hc,r.entriesIn=mc,r.extend=tc,r.extendWith=rc,ja(r,r),r.add=kc,r.attempt=Oc,r.camelCase=yc,r.capitalize=_a,r.ceil=Mc,r.clamp=function(e,t,r){return r===re&&(r=t,t=re),r!==re&&(r=(r=fa(r))===r?r:0),t!==re&&(t=(t=fa(t))===t?t:0),fr(fa(e),t,r)},r.clone=function(e){return dr(e,le)},r.cloneDeep=function(e){return dr(e,ce|le)},r.cloneDeepWith=function(e,t){return t="function"==typeof t?t:re,dr(e,ce|le,t)},r.cloneWith=function(e,t){return t="function"==typeof t?t:re,dr(e,le,t)},r.conformsTo=function(e,t){return null==t||mr(e,t,ma(t))},r.deburr=ba,r.defaultTo=function(e,t){return null==e||e!==e?t:e},r.divide=Fc,r.endsWith=function(e,t,r){e=pa(e),t=Mn(t);var n=e.length,i=r=r===re?n:fr(ua(r),0,n);return(r-=t.length)>=0&&e.slice(r,i)==t},r.eq=Ho,r.escape=function(e){return(e=pa(e))&&wt.test(e)?e.replace(bt,zr):e},r.escapeRegExp=function(e){return(e=pa(e))&&$t.test(e)?e.replace(Tt,"\\$&"):e},r.every=function(e,t,r){var n=Yu(e)?c:wr;return r&&io(e,t,r)&&(t=re),n(e,Yi(t,3))},r.find=ju,r.findIndex=Ao,r.findKey=function(e,t){return b(e,Yi(t,3),Tr)},r.findLast=Au,r.findLastIndex=So,r.findLastKey=function(e,t){return b(e,Yi(t,3),$r)},r.floor=Uc,r.forEach=Fo,r.forEachRight=Uo,r.forIn=function(e,t){return null==e?e:Ys(e,Yi(t,3),ya)},r.forInRight=function(e,t){return null==e?e:Ws(e,Yi(t,3),ya)},r.forOwn=function(e,t){return e&&Tr(e,Yi(t,3))},r.forOwnRight=function(e,t){return e&&$r(e,Yi(t,3))},r.get=da,r.gt=qu,r.gte=Bu,r.has=function(e,t){return null!=e&&Xi(e,t,Kr)},r.hasIn=ha,r.head=Po,r.identity=xa,r.includes=function(e,t,r,n){e=Ko(e)?e:va(e),r=r&&!n?ua(r):0;var i=e.length;return r<0&&(r=_s(i+r,0)),ia(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&w(e,t,r)>-1},r.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ua(r);return i<0&&(i=_s(n+i,0)),w(e,t,i)},r.inRange=function(e,t,r){return t=sa(t),r===re?(r=t,t=0):r=sa(r),e=fa(e),Gr(e,t,r)},r.invoke=cc,r.isArguments=zu,r.isArray=Yu,r.isArrayBuffer=Wu,r.isArrayLike=Ko,r.isArrayLikeObject=Zo,r.isBoolean=function(e){return!0===e||!1===e||ta(e)&&Vr(e)==qe},r.isBuffer=Vu,r.isDate=Hu,r.isElement=function(e){return ta(e)&&1===e.nodeType&&!na(e)},r.isEmpty=function(e){if(null==e)return!0;if(Ko(e)&&(Yu(e)||"string"==typeof e||"function"==typeof e.splice||Vu(e)||Xu(e)||zu(e)))return!e.length;var t=eu(e);if(t==He||t==Qe)return!e.size;if(co(e))return!sn(e).length;for(var r in e)if(Ya.call(e,r))return!1;return!0},r.isEqual=function(e,t){return tn(e,t)},r.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:re)?r(e,t):re;return n===re?tn(e,t,re,r):!!n},r.isError=Go,r.isFinite=function(e){return"number"==typeof e&&ys(e)},r.isFunction=Xo,r.isInteger=Jo,r.isLength=Qo,r.isMap=Ku,r.isMatch=function(e,t){return e===t||nn(e,t,Vi(t))},r.isMatchWith=function(e,t,r){return r="function"==typeof r?r:re,nn(e,t,Vi(t),r)},r.isNaN=function(e){return ra(e)&&e!=+e},r.isNative=function(e){if(tu(e))throw new Ca(ie);return on(e)},r.isNil=function(e){return null==e},r.isNull=function(e){return null===e},r.isNumber=ra,r.isObject=ea,r.isObjectLike=ta,r.isPlainObject=na,r.isRegExp=Zu,r.isSafeInteger=function(e){return Jo(e)&&e>=-$e&&e<=$e},r.isSet=Gu,r.isString=ia,r.isSymbol=oa,r.isTypedArray=Xu,r.isUndefined=function(e){return e===re},r.isWeakMap=function(e){return ta(e)&&eu(e)==nt},r.isWeakSet=function(e){return ta(e)&&Vr(e)==it},r.join=function(e,t){return null==e?"":gs.call(e,t)},r.kebabCase=gc,r.last=To,r.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==re&&(i=(i=ua(r))<0?_s(n+i,0):bs(i,n-1)),t===t?G(e,t,i):E(e,O,i,!0)},r.lowerCase=vc,r.lowerFirst=_c,r.lt=Ju,r.lte=Qu,r.max=function(e){return e&&e.length?xr(e,xa,Hr):re},r.maxBy=function(e,t){return e&&e.length?xr(e,Yi(t,2),Hr):re},r.mean=function(e){return j(e,xa)},r.meanBy=function(e,t){return j(e,Yi(t,2))},r.min=function(e){return e&&e.length?xr(e,xa,cn):re},r.minBy=function(e,t){return e&&e.length?xr(e,Yi(t,2),cn):re},r.stubArray=Ia,r.stubFalse=Pa,r.stubObject=function(){return{}},r.stubString=function(){return""},r.stubTrue=function(){return!0},r.multiply=Nc,r.nth=function(e,t){return e&&e.length?mn(e,ua(t)):re},r.noConflict=function(){return Pr._===this&&(Pr._=Za),this},r.noop=Aa,r.now=Cu,r.pad=function(e,t,r){e=pa(e);var n=(t=ua(t))?X(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return ji(ds(i),r)+e+ji(ps(i),r)},r.padEnd=function(e,t,r){e=pa(e);var n=(t=ua(t))?X(e):0;return t&&nt){var n=e;e=t,t=n}if(r||e%1||t%1){var i=xs();return bs(e+i*(t-e+jr("1e-"+((i+"").length-1))),t)}return wn(e,t)},r.reduce=function(e,t,r){var n=Yu(e)?m:I,i=arguments.length<3;return n(e,Yi(t,4),r,i,Bs)},r.reduceRight=function(e,t,r){var n=Yu(e)?y:I,i=arguments.length<3;return n(e,Yi(t,4),r,i,zs)},r.repeat=function(e,t,r){return t=(r?io(e,t,r):t===re)?1:ua(t),On(pa(e),t)},r.replace=function(){var e=arguments,t=pa(e[0]);return e.length<3?t:t.replace(e[1],e[2])},r.result=function(e,t,r){var n=-1,i=(t=Vn(t,e)).length;for(i||(i=1,e=re);++n$e)return[];var r=De,n=bs(e,De);t=Yi(t),e-=De;for(var i=$(n,t);++r=o)return e;var s=r-X(n);if(s<1)return n;var u=a?Hn(a,0,s).join(""):e.slice(0,s);if(i===re)return u+n;if(a&&(s+=u.length-s),Zu(i)){if(e.slice(s).search(i)){var c,f=u;for(i.global||(i=Ma(i.source,pa(qt.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var l=c.index;u=u.slice(0,l===re?s:l)}}else if(e.indexOf(Mn(i),s)!=s){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+n},r.unescape=function(e){return(e=pa(e))&&Et.test(e)?e.replace(_t,Yr):e},r.uniqueId=function(e){var t=++Wa;return pa(e)+t},r.upperCase=wc,r.upperFirst=xc,r.each=Fo,r.eachRight=Uo,r.first=Po,ja(r,function(){var e={};return Tr(r,function(t,n){Ya.call(r.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),r.VERSION="4.17.4",s(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){r[e].placeholder=r}),s(["drop","take"],function(e,t){Z.prototype[e]=function(r){r=r===re?1:_s(ua(r),0);var n=this.__filtered__&&!t?new Z(this):this.clone();return n.__filtered__?n.__takeCount__=bs(r,n.__takeCount__):n.__views__.push({size:bs(r,De),type:e+(n.__dir__<0?"Right":"")}),n},Z.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),s(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r==Ie||3==r;Z.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Yi(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),s(["head","last"],function(e,t){var r="take"+(t?"Right":"");Z.prototype[e]=function(){return this[r](1).value()[0]}}),s(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Z.prototype[e]=function(){return this.__filtered__?new Z(this):this[r](1)}}),Z.prototype.compact=function(){return this.filter(xa)},Z.prototype.find=function(e){return this.filter(e).head()},Z.prototype.findLast=function(e){return this.reverse().find(e)},Z.prototype.invokeMap=jn(function(e,t){return"function"==typeof e?new Z(this):this.map(function(r){return Qr(r,e,t)})}),Z.prototype.reject=function(e){return this.filter(Vo(Yi(e)))},Z.prototype.slice=function(e,t){e=ua(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Z(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==re&&(r=(t=ua(t))<0?r.dropRight(-t):r.take(t-e)),r)},Z.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Z.prototype.toArray=function(){return this.take(De)},Tr(Z.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=r[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(r.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof Z,c=s[0],f=u||Yu(t),l=function(e){var t=o.apply(r,h([e],s));return i&&p?t[0]:t};f&&n&&"function"==typeof c&&1!=c.length&&(u=f=!1);var p=this.__chain__,d=!!this.__actions__.length,m=a&&!p,y=u&&!d;if(!a&&f){t=y?t:new Z(this);var g=e.apply(t,s);return g.__actions__.push({func:Mo,args:[l],thisArg:re}),new S(g,p)}return m&&y?e.apply(this,s):(g=this.thru(l),m?i?g.value()[0]:g.value():g)})}),s(["pop","push","shift","sort","splice","unshift"],function(e){var t=Na[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);r.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(Yu(r)?r:[],e)}return this[n](function(r){return t.apply(Yu(r)?r:[],e)})}}),Tr(Z.prototype,function(e,t){var n=r[t];if(n){var i=n.name+"";(Cs[i]||(Cs[i]=[])).push({name:t,func:n})}}),Cs[Ei(re,me).name]=[{name:"wrapper",func:re}],Z.prototype.clone=function(){var e=new Z(this.__wrapped__);return e.__actions__=ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ai(this.__views__),e},Z.prototype.reverse=function(){if(this.__filtered__){var e=new Z(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Z.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Yu(e),n=t<0,i=r?e.length:0,o=Zi(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=n?s:a-1,f=this.__iteratees__,l=f.length,p=0,d=bs(u,this.__takeCount__);if(!r||!n&&i==u&&d==u)return qn(e,this.__actions__);var h=[];e:for(;u--&&p=this.__values__.length;return{done:e,value:e?re:this.__values__[this.__index__++]}},r.prototype.plant=function(e){for(var t,r=this;r instanceof v;){var n=jo(r);n.__index__=0,n.__values__=re,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},r.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Z){var t=e;return this.__actions__.length&&(t=new Z(this)),(t=t.reverse()).__actions__.push({func:Mo,args:[Co],thisArg:re}),new S(t,this.__chain__)}return this.thru(Co)},r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=function(){return qn(this.__wrapped__,this.__actions__)},r.prototype.first=r.prototype.head,as&&(r.prototype[as]=function(){return this}),r}();$r?(($r.exports=Wr)._=Wr,Tr._=Wr):Pr._=Wr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],90:[function(e,t,r){(function(e){!function(e,r,n){r[e]=r[e]||n(),void 0!==t&&t.exports&&(t.exports=r[e])}("Promise",void 0!==e?e:this,function(){"use strict";function e(e,t){p.add(e,t),l||(l=h(p.drain))}function t(e){var t,r=typeof e;return null==e||"object"!=r&&"function"!=r||(t=e.then),"function"==typeof t&&t}function r(){for(var e=0;e0&&e(r,u))}catch(e){o.call(new s(u),e)}}}function o(t){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=t,n.state=2,n.chain.length>0&&e(r,n))}function a(e,t,r,n){for(var i=0;i=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),o="/"===a(e,-1);return(e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),o=n(t.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u1)for(var r=1;r0&&c>u&&(c=u);for(var f=0;f=0?(l=m.substr(0,y),p=m.substr(y+1)):(l=m,p=""),d=decodeURIComponent(l),h=decodeURIComponent(p),n(a,d)?i(a[d])?a[d].push(h):a[d]=[a[d],h]:a[d]=h}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],97:[function(e,t,r){"use strict";function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>25)+n|0)&n|~r&i)+t[1]-389564586|0)<<12|o>>>20)+r|0)&r|~o&n)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&r)+t[3]-1044525330|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[4]-176418897|0)<<7|r>>>25)+n|0)&n|~r&i)+t[5]+1200080426|0)<<12|o>>>20)+r|0)&r|~o&n)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&r)+t[7]-45705983|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[8]+1770035416|0)<<7|r>>>25)+n|0)&n|~r&i)+t[9]-1958414417|0)<<12|o>>>20)+r|0)&r|~o&n)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&r)+t[11]-1990404162|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[12]+1804603682|0)<<7|r>>>25)+n|0)&n|~r&i)+t[13]-40341101|0)<<12|o>>>20)+r|0)&r|~o&n)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&r)+t[15]+1236535329|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[1]-165796510|0)<<5|r>>>27)+n|0)&i|n&~i)+t[6]-1069501632|0)<<9|o>>>23)+r|0)&n|r&~n)+t[11]+643717713|0)<<14|i>>>18)+o|0)&r|o&~r)+t[0]-373897302|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[5]-701558691|0)<<5|r>>>27)+n|0)&i|n&~i)+t[10]+38016083|0)<<9|o>>>23)+r|0)&n|r&~n)+t[15]-660478335|0)<<14|i>>>18)+o|0)&r|o&~r)+t[4]-405537848|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[9]+568446438|0)<<5|r>>>27)+n|0)&i|n&~i)+t[14]-1019803690|0)<<9|o>>>23)+r|0)&n|r&~n)+t[3]-187363961|0)<<14|i>>>18)+o|0)&r|o&~r)+t[8]+1163531501|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[13]-1444681467|0)<<5|r>>>27)+n|0)&i|n&~i)+t[2]-51403784|0)<<9|o>>>23)+r|0)&n|r&~n)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&r|o&~r)+t[12]-1926607734|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[5]-378558|0)<<4|r>>>28)+n|0)^n^i)+t[8]-2022574463|0)<<11|o>>>21)+r|0)^r^n)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^r)+t[14]-35309556|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[1]-1530992060|0)<<4|r>>>28)+n|0)^n^i)+t[4]+1272893353|0)<<11|o>>>21)+r|0)^r^n)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^r)+t[10]-1094730640|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[13]+681279174|0)<<4|r>>>28)+n|0)^n^i)+t[0]-358537222|0)<<11|o>>>21)+r|0)^r^n)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^r)+t[6]+76029189|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[9]-640364487|0)<<4|r>>>28)+n|0)^n^i)+t[12]-421815835|0)<<11|o>>>21)+r|0)^r^n)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^r)+t[2]-995338651|0)<<23|n>>>9)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[0]-198630844|0)<<6|r>>>26)+n|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~r))+t[5]-57434055|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[12]+1700485571|0)<<6|r>>>26)+n|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~r))+t[1]-2054922799|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[8]+1873313359|0)<<6|r>>>26)+n|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~r))+t[13]+1309151649|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[4]-145523070|0)<<6|r>>>26)+n|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~r))+t[9]-343485551|0)<<21|n>>>11)+i|0,e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function i(e){var n,i,o,a,s,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=c;n+=64)t(f,r(e.substring(n-64,n)));for(i=(e=e.substring(n-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n>2]|=e.charCodeAt(n)<<(n%4<<3);if(o[n>>2]|=128<<(n%4<<3),n>55)for(t(f,o),n=0;n<16;n+=1)o[n]=0;return a=8*c,a=a.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),u=parseInt(a[1],16)||0,o[14]=s,o[15]=u,t(f,o),f}function o(e){var r,i,o,a,s,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(r=64;r<=c;r+=64)t(f,n(e.subarray(r-64,r)));for(i=(e=r-64>2]|=e[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(t(f,o),r=0;r<16;r+=1)o[r]=0;return a=8*c,a=a.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),u=parseInt(a[1],16)||0,o[14]=s,o[15]=u,t(f,o),f}function a(e){var t,r="";for(t=0;t<4;t+=1)r+=h[e>>8*t+4&15]+h[e>>8*t&15];return r}function s(e){var t;for(t=0;t>16)+(t>>16)+(r>>16)<<16|65535&r},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(r,n){var i,o,a,s,u=this.byteLength,c=t(r,u),f=u;return n!==e&&(f=t(n,u)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),d.prototype.append=function(e){return this.appendBinary(u(e)),this},d.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var n,i=this._buff.length;for(n=64;n<=i;n+=64)t(this._hash,r(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},d.prototype.end=function(e){var t,r,n=this._buff,i=n.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=n.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),r=s(this._hash),e&&(r=p(r)),this.reset(),r},d.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},d.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},d.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},d.prototype._finish=function(e,r){var n,i,o,a=r;if(e[a>>2]|=128<<(a%4<<3),a>55)for(t(this._hash,e),a=0;a<16;a+=1)e[a]=0;n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]=i,e[15]=o,t(this._hash,e)},d.hash=function(e,t){return d.hashBinary(u(e),t)},d.hashBinary=function(e,t){var r=s(i(e));return t?p(r):r},d.ArrayBuffer=function(){this.reset()},d.ArrayBuffer.prototype.append=function(e){var r,i=l(this._buff.buffer,e,!0),o=i.length;for(this._length+=e.byteLength,r=64;r<=o;r+=64)t(this._hash,n(i.subarray(r-64,r)));return this._buff=r-64>2]|=n[t]<<(t%4<<3);return this._finish(o,i),r=s(this._hash),e&&(r=p(r)),this.reset(),r},d.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.ArrayBuffer.prototype.getState=function(){var e=d.prototype.getState.call(this);return e.buff=f(e.buff),e},d.ArrayBuffer.prototype.setState=function(e){return e.buff=c(e.buff,!0),d.prototype.setState.call(this,e)},d.ArrayBuffer.prototype.destroy=d.prototype.destroy,d.ArrayBuffer.prototype._finish=d.prototype._finish,d.ArrayBuffer.hash=function(e,t){var r=s(o(new Uint8Array(e)));return t?p(r):r},d})},{}],101:[function(e,t,r){function n(){}function i(e){if(!m(e))return e;var t=[];for(var r in e)o(t,r,e[r]);return t.join("&")}function o(e,t,r){if(null!=r)if(Array.isArray(r))r.forEach(function(r){o(e,t,r)});else if(m(r))for(var n in r)o(e,t+"["+n+"]",r[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));else null===r&&e.push(encodeURIComponent(t))}function a(e){for(var t,r,n={},i=e.split("&"),o=0,a=i.length;o=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.onprogress=n.bind(null,"download"),t.upload&&(t.upload.onprogress=n.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var i=this._header["content-type"],o=this._serializer||v.serialize[i?i.split(";")[0]:""];!o&&u(i)&&(o=v.serialize["application/json"]),o&&(r=o(r))}for(var a in this.header)null!=this.header[a]&&this.header.hasOwnProperty(a)&&t.setRequestHeader(a,this.header[a]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==r?r:null),this},v.get=function(e,t,r){var n=v("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},v.head=function(e,t,r){var n=v("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},v.options=function(e,t,r){var n=v("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},v.del=l,v.delete=l,v.patch=function(e,t,r){var n=v("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},v.post=function(e,t,r){var n=v("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},v.put=function(e,t,r){var n=v("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},{"./is-object":102,"./request-base":103,"./response-base":104,"./should-retry":105,"component-emitter":6}],102:[function(e,t,r){t.exports=function(e){return null!==e&&"object"==typeof e}},{}],103:[function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./is-object");t.exports=n,n.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},n.prototype.parse=function(e){return this._parser=e,this},n.prototype.responseType=function(e){return this._responseType=e,this},n.prototype.serialize=function(e){return this._serializer=e,this},n.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},n.prototype.retry=function(e){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},n.prototype.then=function(e,t){if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){r.end(function(r,n){r?t(r):e(n)})})}return this._fullfilledPromise.then(e,t)},n.prototype.catch=function(e){return this.then(void 0,e)},n.prototype.use=function(e){return e(this),this},n.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},n.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},n.prototype.get=function(e){return this._header[e.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(e,t){if(o(e)){for(var r in e)this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},n.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},n.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),o(e)){for(var r in e)this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)this.field(e,t[n]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},n.prototype.redirects=function(e){return this._maxRedirects=e,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(e){var t=o(e),r=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)this._data[n]=e[n];else"string"==typeof e?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"==r?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(r||this.type("json"),this)},n.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},n.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.substring(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.substring(0,t)+"?"+r.join("&")}}},n.prototype._appendQueryString=function(){console.trace("Unsupported")},n.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.abort(),this.callback(n)}},n.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":102}],104:[function(e,t,r){function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var o=e("./utils");t.exports=n,n.prototype.get=function(e){return this.header[e.toLowerCase()]},n.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=o.type(t);var r=o.params(t);for(var n in r)this[n]=r[n];this.links={};try{e.link&&(this.links=o.parseLinks(e.link))}catch(e){}},n.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},{"./utils":106}],105:[function(e,t,r){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(e,t){return!!(e&&e.code&&~n.indexOf(e.code))||(!!(t&&t.status&&t.status>=500)||(!!(e&&"timeout"in e&&"ECONNABORTED"==e.code)||!!(e&&"crossDomain"in e)))}},{}],106:[function(e,t,r){r.type=function(e){return e.split(/ *; */).shift()},r.params=function(e){return e.split(/ *; */).reduce(function(e,t){var r=t.split(/ *= */),n=r.shift(),i=r.shift();return n&&i&&(e[n]=i),e},{})},r.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var r=t.split(/ *; */),n=r[0].slice(1,-1);return e[r[1].split(/ *= */)[1].slice(1,-1)]=n,e},{})},r.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&delete e.cookie,e}},{}],107:[function(e,t,r){function n(e,t){if("object"!=typeof e)throw new Error("resourceListing must be an object");Array.isArray(t)||(t=[]);var r={},n={},a={swagger:"2.0",info:i(e),paths:{}};return e.authorizations&&(a.securityDefinitions=p(e,r)),e.basePath&&o(e.basePath,a),m(n,e.models),Array.isArray(e.apis)&&(t.length>0&&(a.tags=[]),e.apis.forEach(function(t){a.tags&&a.tags.push({name:t.path.replace(".{format}","").substring(1),description:t.description}),Array.isArray(t.operations)&&(a.paths[t.path]=s(t,e))})),t.forEach(function(e){e.basePath&&o(e.basePath,a),Array.isArray(e.apis)&&(e.apis.forEach(function(t){a.paths[t.path]=s(t,e)}),e.models&&Object.keys(e.models).length&&m(n,h(e.models)))}),Object.keys(n).length&&(a.definitions=h(n)),a}function i(e){var t={version:e.apiVersion,title:"Title was not specified"};return"object"==typeof e.info&&(e.info.title&&(t.title=e.info.title),e.info.description&&(t.description=e.info.description),e.info.contact&&(t.contact={email:e.info.contact}),e.info.license&&(t.license={name:e.info.license,url:e.info.licenseUrl}),e.info.termsOfServiceUrl&&(t.termsOfService=e.info.termsOfServiceUrl)),t}function o(e,t){var r=g(e);t.host=r.host,t.basePath=r.path,r.protocol&&(t.schemes=[r.protocol.substr(0,r.protocol.length-1)])}function a(e,t){return(e=v(e)).$ref&&-1===e.$ref.indexOf("#/definitions/")?e.$ref="#/definitions/"+e.$ref:e.items&&e.items.$ref&&-1===e.items.$ref.indexOf("#/definitions/")&&(e.items.$ref="#/definitions/"+e.items.$ref),t&&e.type&&-1===_.indexOf(e.type)&&(e={$ref:"#/definitions/"+e.type}),e.minimum&&(e.minimum=y(e.minimum)),e.maximum&&(e.maximum=y(e.maximum)),e.defaultValue&&(e.default=e.defaultValue,delete e.defaultValue,e.type&&"string"!==e.type&&(e.default=y(e.default))),e}function s(e,t){var r={};return e.operations.forEach(function(e){var n=e.method.toLowerCase();r[n]=u(e,t.produces,t.consumes,t.resourcePath)}),r}function u(e,t,r,n){var i={responses:{},description:e.description||""};if(n&&(i.tags=[],i.tags.push(n.substr(1))),e.summary&&(i.summary=e.summary),e.nickname&&(i.operationId=e.nickname),t&&(i.produces=t),r&&(i.consumes=r),Array.isArray(e.parameters)&&e.parameters.length&&(i.parameters=e.parameters.map(function(e){return f(e)})),Array.isArray(e.responseMessages)&&e.responseMessages.forEach(function(e){i.responses[e.code]=c(e)}),(!Object.keys(i.responses).length||!i.responses[200]&&e.type)&&(i.responses[200]={description:"No response was specified"}),e.type&&"void"!==e.type){var o=l(e);-1===_.indexOf(e.type)&&(o={$ref:"#/definitions/"+e.type}),i.responses[200].schema=o}return i}function c(e){var t={};return t.description=e.message,t}function f(e){var t={in:e.paramType,description:e.description,name:e.name,required:!!e.required};return-1===_.indexOf(e.type)?t.schema={$ref:"#/definitions/"+e.type}:"body"===e.paramType?t.schema=l(e):m(t,l(e)),"form"===t.in&&(t.in="formData"),t}function l(e){var t={},r=["default","maximum","minimum","items"];return e=a(e,!1),t.type=e.type.toLowerCase(),r.forEach(function(r){void 0!==e[r]&&(t[r]=e[r])}),void 0!==e.defaultValue&&(t.default=e.defaultValue),t}function p(e,t){var r={};return Object.keys(e.authorizations).forEach(function(n){var i=e.authorizations[n],o=function(e){var t=r[e||n]={type:i.type};return i.passAs&&(t.in=i.passAs),i.keyname&&(t.name=i.keyname),t};i.grantTypes?(t[n]=[],Object.keys(i.grantTypes).forEach(function(e){var r=i.grantTypes[e],a=n+"_"+e,s=o(a);switch(t[n].push(a),s.flow="implicit"===e?"implicit":"accessCode",e){case"implicit":s.authorizationUrl=r.loginEndpoint.url;break;case"authorization_code":s.authorizationUrl=r.tokenRequestEndpoint.url,s.tokenUrl=r.tokenEndpoint.url}i.scopes&&(s.scopes={},i.scopes.forEach(function(e){s.scopes[e.scope]=e.description||"Undescribed "+e.scope}))})):o()}),r}function d(e){"object"==typeof e.properties&&Object.keys(e.properties).forEach(function(t){e.properties[t]=a(e.properties[t],!0)})}function h(e){var t=v(e);if("object"!=typeof e)throw new Error("models must be object");var r={};return Object.keys(t).forEach(function(e){var n=t[e];delete n.id,d(n),n.subTypes&&(r[e]=n.subTypes,delete n.subTypes)}),Object.keys(r).forEach(function(e){r[e].forEach(function(r){var n=t[r];if(n){var i=(n.allOf||[]).concat({$ref:"#/definitions/"+e}).concat(v(n));for(var o in n)delete n[o];n.allOf=i}})}),t}function m(e,t){if("object"!=typeof e)throw new Error("source must be objects");"object"==typeof t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}function y(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){throw Error("incorect property value: "+e.message)}}var g=e("url").parse,v=e("lodash.clonedeep"),_=["string","number","boolean","integer","array","void","File"];"undefined"==typeof window?t.exports=n:window.SwaggerConverter=window.SwaggerConverter||{convert:n}},{"lodash.clonedeep":78,url:110}],108:[function(e,t,r){function n(e){this.value=e}function i(e,t,r){var n=[],i=[],a=!0;return function e(s){function u(){if("object"==typeof l.node&&null!==l.node){l.keys&&l.node_===l.node||(l.keys=h(l.node)),l.isLeaf=0==l.keys.length;for(var e=0;e1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,i=1;i1&&(n=r[0]+"@",e=r[1]),n+u((e=e.replace(S,".")).split("."),t).join(".")}function f(e){for(var t=[],r=0,n=e.length;r=55296&&i<=56319&&r>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function p(e){for(var t="",r=0,n=e.length;r=194&&i<224){if(n-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var a=parseInt(e.substr(r+4,2),16),s=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&a)<<6|63&s)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function d(e,t){function r(e){var r=p(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,l).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,l).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,l).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,l).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,l).replace(t.PCT_ENCODED,i)),e}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?w:E;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(U);if(i){N?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=r.host.replace(n.IPV6ADDRESS,"$1")),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=F[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)d(r,n);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=M.toASCII(r.host.replace(n.PCT_ENCODED,p).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}d(r,E)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function m(e,t){var r=!1!==t.iri?w:E,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(String(e.host).replace(r.IPV6ADDRESS,"[$1]")),"number"==typeof e.port&&(n.push(":"),n.push(e.port.toString(10))),n.length?n.join(""):void 0}function y(e){for(var t=[];e.length;)if(e.match(L))e=e.replace(L,"");else if(e.match(q))e=e.replace(q,"/");else if(e.match(B))e=e.replace(B,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(z);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?w:E,n=[],i=F[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?M.toUnicode(e.host):M.toASCII(e.host.replace(r.PCT_ENCODED,p).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}d(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var o=m(e,t);if(void 0!==o&&("suffix"!==t.reference&&n.push("//"),n.push(o),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var a=e.path;t.absolutePath||i&&i.absolutePath||(a=y(a)),void 0===o&&(a=a.replace(/^\/\//,"/%2F")),n.push(a)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function v(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=h(g(e,r),r),t=h(g(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=y(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=y(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=y(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=y(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function _(e,t){return e&&e.toString().replace(t&&t.iri?w.PCT_ENCODED:E.PCT_ENCODED,p)}function b(e){var t=p(e);return t.match(X)?t:e}var E=a(!1),w=a(!0),x=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=Math.floor,T=String.fromCharCode,$=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},C=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},R=function(e,t,r){var n=0;for(e=r?P(e/700):e>>1,e+=P(e/t);e>455;n+=36)e=P(e/35);return P(n+36*e/(e+38))},D=function(e){var t=[],r=e.length,n=0,i=128,o=72,a=e.lastIndexOf("-");a<0&&(a=0);for(var u=0;u=128&&s("not-basic"),t.push(e.charCodeAt(u));for(var c=a>0?a+1:0;c=r&&s("invalid-input");var d=$(e.charCodeAt(c++));(d>=36||d>P((O-n)/l))&&s("overflow"),n+=d*l;var h=p<=o?1:p>=o+26?26:p-o;if(dP(O/m)&&s("overflow"),l*=m}var y=t.length+1;o=R(n-f,y,0==f),P(n/y)>O-i&&s("overflow"),i+=P(n/y),n%=y,t.splice(n++,0,i)}return String.fromCodePoint.apply(String,t)},k=function(e){var t=[],r=(e=f(e)).length,n=128,i=0,o=72,a=!0,u=!1,c=void 0;try{for(var l,p=e[Symbol.iterator]();!(a=(l=p.next()).done);a=!0){var d=l.value;d<128&&t.push(T(d))}}catch(e){u=!0,c=e}finally{try{!a&&p.return&&p.return()}finally{if(u)throw c}}var h=t.length,m=h;for(h&&t.push("-");m=n&&wP((O-i)/x)&&s("overflow"),i+=(y-n)*x,n=y;var j=!0,A=!1,S=void 0;try{for(var I,$=e[Symbol.iterator]();!(j=(I=$.next()).done);j=!0){var D=I.value;if(DO&&s("overflow"),D==n){for(var k=i,M=36;;M+=36){var F=M<=o?1:M>=o+26?26:M-o;if(kA-Z\\x5E-\\x7E]",'[\\"\\\\]'),X=new RegExp(H,"g"),J=new RegExp(Z,"g"),Q=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',G),"g"),ee=new RegExp(t("[^]",H,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),te=ee,re={scheme:"mailto",parse:function(e,t){var r=e.to=e.path?e.path.split(","):[];if(e.path=void 0,e.query){for(var n=!1,i={},o=e.query.split("&"),a=0,s=o.length;a\[\]\^\`\{\|\}\~\x7F-\xFF]/g,ae={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(ie);if(r){var n="urn:"+r[1].toLowerCase(),i=F[n];i||(i=F[n]={scheme:n,parse:function(e,t){return e},serialize:F.urn.serialize}),e.scheme=n,e.path=r[2],e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){var r=e.scheme||t.scheme;if(r&&"urn"!==r){var n=r.match(ne)||["urn:"+r,r];e.scheme="urn",e.path=n[1]+":"+(e.path?e.path.replace(oe,l):"")}return e}},se=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ue={scheme:"urn:uuid",parse:function(e,t){return t.tolerant||e.path&&e.path.match(se)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e,t){return t.tolerant||e.path&&e.path.match(se)?e.path=(e.path||"").toLowerCase():e.scheme=void 0,F.urn.serialize(e,t)}};F.http=Y,F.https=W,F.mailto=re,F.urn=ae,F["urn:uuid"]=ue,e.SCHEMES=F,e.pctEncChar=l,e.pctDecChars=p,e.parse=h,e.removeDotSegments=y,e.serialize=g,e.resolveComponents=v,e.resolve=function(e,t,r){return g(v(h(e,r),h(t,r),r,!0),r)},e.normalize=function(e,t){return"string"==typeof e?e=g(h(e,t),t):"object"===n(e)&&(e=h(g(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=g(h(e,r),r):"object"===n(e)&&(e=g(e,r)),"string"==typeof t?t=g(h(t,r),r):"object"===n(t)&&(t=g(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?w.ESCAPE:E.ESCAPE,l)},e.unescapeComponent=_,Object.defineProperty(e,"__esModule",{value:!0})})},{}],110:[function(e,t,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(e,t,r){if(e&&a.isObject(e)&&e instanceof n)return e;var i=new n;return i.parse(e,t,r),i}var o=e("punycode"),a=e("./util");r.parse=i,r.resolve=function(e,t){return i(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?i(e,!1,!0).resolveObject(t):t},r.format=function(e){return a.isString(e)&&(e=i(e)),e instanceof n?e.format():n.prototype.format.call(e)},r.Url=n;var s=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["<",">",'"',"`"," ","\r","\n","\t"],l=["{","}","|","\\","^","`"].concat(f),p=["'"].concat(l),d=["%","/","?",";","#"].concat(p),h=["/","?","#"],m=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=e("querystring");n.prototype.parse=function(e,t,r){if(!a.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),i=-1!==n&&n127?D+="x":D+=R[k];if(!D.match(m)){var F=$.slice(0,A),U=$.slice(A+1),N=R.match(y);N&&(F.push(N[1]),U.unshift(N[2])),U.length&&(l="/"+U.join(".")+l),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=o.toASCII(this.hostname));var L=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+L,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==l[0]&&(l="/"+l))}if(!g[x])for(var A=0,C=p.length;A0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift())),r.search=e.search,r.query=e.query,a.isNull(r.pathname)&&a.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var j=w.slice(-1)[0],A=(r.host||e.host||w.length>1)&&("."===j||".."===j)||""===j,S=0,I=w.length;I>=0;I--)"."===(j=w[I])?w.splice(I,1):".."===j?(w.splice(I,1),S++):S&&(w.splice(I,1),S--);if(!b&&!E)for(;S--;S)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),A&&"/"!==w.join("/").substr(-1)&&w.push("");var P=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(O){r.hostname=r.host=P?"":w.length?w.shift():"";var T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");T&&(r.auth=T.shift(),r.host=r.hostname=T.shift())}return(b=b||r.host&&w.length)&&!P&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),a.isNull(r.pathname)&&a.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":111,punycode:5,querystring:98}],111:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],112:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("./lib/toDate")),o=n(e("./lib/toFloat")),a=n(e("./lib/toInt")),s=n(e("./lib/toBoolean")),u=n(e("./lib/equals")),c=n(e("./lib/contains")),f=n(e("./lib/matches")),l=n(e("./lib/isEmail")),p=n(e("./lib/isURL")),d=n(e("./lib/isMACAddress")),h=n(e("./lib/isIP")),m=n(e("./lib/isFQDN")),y=n(e("./lib/isBoolean")),g=n(e("./lib/isAlpha")),v=n(e("./lib/isAlphanumeric")),_=n(e("./lib/isNumeric")),b=n(e("./lib/isLowercase")),E=n(e("./lib/isUppercase")),w=n(e("./lib/isAscii")),x=n(e("./lib/isFullWidth")),O=n(e("./lib/isHalfWidth")),j=n(e("./lib/isVariableWidth")),A=n(e("./lib/isMultibyte")),S=n(e("./lib/isSurrogatePair")),I=n(e("./lib/isInt")),P=n(e("./lib/isFloat")),T=n(e("./lib/isDecimal")),$=n(e("./lib/isHexadecimal")),C=n(e("./lib/isDivisibleBy")),R=n(e("./lib/isHexColor")),D=n(e("./lib/isISRC")),k=n(e("./lib/isMD5")),M=n(e("./lib/isHash")),F=n(e("./lib/isJSON")),U=n(e("./lib/isEmpty")),N=n(e("./lib/isLength")),L=n(e("./lib/isByteLength")),q=n(e("./lib/isUUID")),B=n(e("./lib/isMongoId")),z=n(e("./lib/isAfter")),Y=n(e("./lib/isBefore")),W=n(e("./lib/isIn")),V=n(e("./lib/isCreditCard")),H=n(e("./lib/isISIN")),K=n(e("./lib/isISBN")),Z=n(e("./lib/isISSN")),G=n(e("./lib/isMobilePhone")),X=n(e("./lib/isCurrency")),J=n(e("./lib/isISO8601")),Q=n(e("./lib/isBase64")),ee=n(e("./lib/isDataURI")),te=n(e("./lib/isLatLong")),re=n(e("./lib/isPostalCode")),ne=n(e("./lib/ltrim")),ie=n(e("./lib/rtrim")),oe=n(e("./lib/trim")),ae=n(e("./lib/escape")),se=n(e("./lib/unescape")),ue=n(e("./lib/stripLow")),ce=n(e("./lib/whitelist")),fe=n(e("./lib/blacklist")),le=n(e("./lib/isWhitelisted")),pe=n(e("./lib/normalizeEmail")),de=n(e("./lib/util/toString")),he={version:"8.2.0",toDate:i.default,toFloat:o.default,toInt:a.default,toBoolean:s.default,equals:u.default,contains:c.default,matches:f.default,isEmail:l.default,isURL:p.default,isMACAddress:d.default,isIP:h.default,isFQDN:m.default,isBoolean:y.default,isAlpha:g.default,isAlphanumeric:v.default,isNumeric:_.default,isLowercase:b.default,isUppercase:E.default,isAscii:w.default,isFullWidth:x.default,isHalfWidth:O.default,isVariableWidth:j.default,isMultibyte:A.default,isSurrogatePair:S.default,isInt:I.default,isFloat:P.default,isDecimal:T.default,isHexadecimal:$.default,isDivisibleBy:C.default,isHexColor:R.default,isISRC:D.default,isMD5:k.default,isHash:M.default,isJSON:F.default,isEmpty:U.default,isLength:N.default,isByteLength:L.default,isUUID:q.default,isMongoId:B.default,isAfter:z.default,isBefore:Y.default,isIn:W.default,isCreditCard:V.default,isISIN:H.default,isISBN:K.default,isISSN:Z.default,isMobilePhone:G.default,isPostalCode:re.default,isCurrency:X.default,isISO8601:J.default,isBase64:Q.default,isDataURI:ee.default,isLatLong:te.default,ltrim:ne.default,rtrim:ie.default,trim:oe.default,escape:ae.default,unescape:se.default,stripLow:ue.default,whitelist:ce.default,blacklist:fe.default,isWhitelisted:le.default,normalizeEmail:pe.default,toString:de.default};r.default=he,t.exports=r.default},{"./lib/blacklist":114,"./lib/contains":115,"./lib/equals":116,"./lib/escape":117,"./lib/isAfter":118,"./lib/isAlpha":119,"./lib/isAlphanumeric":120,"./lib/isAscii":121,"./lib/isBase64":122,"./lib/isBefore":123,"./lib/isBoolean":124,"./lib/isByteLength":125,"./lib/isCreditCard":126,"./lib/isCurrency":127,"./lib/isDataURI":128,"./lib/isDecimal":129,"./lib/isDivisibleBy":130,"./lib/isEmail":131,"./lib/isEmpty":132,"./lib/isFQDN":133,"./lib/isFloat":134,"./lib/isFullWidth":135,"./lib/isHalfWidth":136,"./lib/isHash":137,"./lib/isHexColor":138,"./lib/isHexadecimal":139,"./lib/isIP":140,"./lib/isISBN":141,"./lib/isISIN":142,"./lib/isISO8601":143,"./lib/isISRC":144,"./lib/isISSN":145,"./lib/isIn":146,"./lib/isInt":147,"./lib/isJSON":148,"./lib/isLatLong":149,"./lib/isLength":150,"./lib/isLowercase":151,"./lib/isMACAddress":152,"./lib/isMD5":153,"./lib/isMobilePhone":154,"./lib/isMongoId":155,"./lib/isMultibyte":156,"./lib/isNumeric":157,"./lib/isPostalCode":158,"./lib/isSurrogatePair":159,"./lib/isURL":160,"./lib/isUUID":161,"./lib/isUppercase":162,"./lib/isVariableWidth":163,"./lib/isWhitelisted":164,"./lib/ltrim":165,"./lib/matches":166,"./lib/normalizeEmail":167,"./lib/rtrim":168,"./lib/stripLow":169,"./lib/toBoolean":170,"./lib/toDate":171,"./lib/toFloat":172,"./lib/toInt":173,"./lib/trim":174,"./lib/unescape":175,"./lib/util/toString":178,"./lib/whitelist":179}],113:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});for(var n,i=r.alpha={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},o=r.alphanumeric={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nb-NO":/^[0-9A-ZÆØÅ]+$/i,"nl-NL":/^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[0-9A-ZÆØÅ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[0-9A-ZÅÄÖ]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},a=r.englishLocales=["AU","GB","HK","IN","NZ","ZA","ZM"],s=0;s=0};var i=n(e("./util/assertString")),o=n(e("./util/toString"));t.exports=r.default},{"./util/assertString":176,"./util/toString":178}],116:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),e===t};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],117:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],118:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,i.default)(e);var r=(0,o.default)(t),n=(0,o.default)(e);return!!(n&&r&&n>r)};var i=n(e("./util/assertString")),o=n(e("./toDate"));t.exports=r.default},{"./toDate":171,"./util/assertString":176}],119:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if((0,n.default)(e),t in i.alpha)return i.alpha[t].test(e);throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./alpha");t.exports=r.default},{"./alpha":113,"./util/assertString":176}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if((0,n.default)(e),t in i.alphanumeric)return i.alphanumeric[t].test(e);throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./alpha");t.exports=r.default},{"./alpha":113,"./util/assertString":176}],121:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[\x00-\x7F]+$/;t.exports=r.default},{"./util/assertString":176}],122:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){(0,n.default)(e);var t=e.length;if(!t||t%4!=0||i.test(e))return!1;var r=e.indexOf("=");return-1===r||r===t-1||r===t-2&&"="===e[t-1]};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[^A-Z0-9+\/=]/i;t.exports=r.default},{"./util/assertString":176}],123:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,i.default)(e);var r=(0,o.default)(t),n=(0,o.default)(e);return!!(n&&r&&n=0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],125:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,i.default)(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":n(t))?(r=t.min||0,o=t.max):(r=arguments[1],o=arguments[2]);var a=encodeURI(e).split(/%..|./).length-1;return a>=r&&(void 0===o||a<=o)};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],126:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){(0,n.default)(e);var t=e.replace(/[- ]+/g,"");if(!i.test(t))return!1;for(var r=0,o=void 0,a=void 0,s=void 0,u=t.length-1;u>=0;u--)o=t.substring(u,u+1),a=parseInt(o,10),r+=s&&(a*=2)>=10?a%10+1:a,s=!s;return!(r%10!=0||!t)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|62[0-9]{14})$/;t.exports=r.default},{"./util/assertString":176}],127:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var t="\\d{"+e.digits_after_decimal[0]+"}";e.digits_after_decimal.forEach(function(e,r){0!==r&&(t=t+"|\\d{"+e+"}")});var r="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),n="("+["0","[1-9]\\d*","[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*"].join("|")+")?",i="(\\"+e.decimal_separator+"("+t+"))"+(e.require_decimal?"":"?"),o=n+(e.allow_decimal||e.require_decimal?i:"");return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?o+="-?":e.negative_sign_before_digits&&(o="-?"+o)),e.allow_negative_sign_placeholder?o="( (?!\\-))?"+o:e.allow_space_after_symbol?o=" ?"+o:e.allow_space_after_digits&&(o+="( (?!$))?"),e.symbol_after_digits?o+=r:o=r+o,e.allow_negatives&&(e.parens_for_negatives?o="(\\("+o+"\\)|"+o+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(o="-?"+o)),new RegExp("^(?!-? )(?=.*\\d)"+o+"$")}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,a.default)(e),t=(0,o.default)(t,s),i(t).test(e)};var o=n(e("./util/merge")),a=n(e("./util/assertString")),s={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};t.exports=r.default},{"./util/assertString":176,"./util/merge":177}],128:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9!\$&',\(\)\*\+,;=\-\._~:@\/\?%\s]*\s*$/i;t.exports=r.default},{"./util/assertString":176}],129:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),""!==e&&i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/;t.exports=r.default},{"./util/assertString":176}],130:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,i.default)(e),(0,o.default)(e)%parseInt(t,10)==0};var i=n(e("./util/assertString")),o=n(e("./toFloat"));t.exports=r.default},{"./toFloat":172,"./util/assertString":176}],131:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if((0,i.default)(e),(t=(0,o.default)(t,u)).require_display_name||t.allow_display_name){var r=e.match(c);if(r)e=r[1];else if(t.require_display_name)return!1}var n=e.split("@"),h=n.pop(),m=n.join("@"),y=h.toLowerCase();if("gmail.com"!==y&&"googlemail.com"!==y||(m=m.replace(/\./g,"").toLowerCase()),!(0,a.default)(m,{max:64})||!(0,a.default)(h,{max:254}))return!1;if(!(0,s.default)(h,{require_tld:t.require_tld}))return!1;if('"'===m[0])return m=m.slice(1,m.length-1),t.allow_utf8_local_part?d.test(m):l.test(m);for(var g=t.allow_utf8_local_part?p:f,v=m.split("."),_=0;_$/i,f=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,l=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,p=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,d=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;t.exports=r.default},{"./isByteLength":125,"./isFQDN":133,"./util/assertString":176,"./util/merge":177}],132:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),0===e.length};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],133:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,i.default)(e),(t=(0,o.default)(t,a)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));var r=e.split(".");if(t.require_tld){var n=r.pop();if(!r.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(n))return!1;if(/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(n))return!1}for(var s,u=0;u=t.min)&&(!t.hasOwnProperty("max")||e<=t.max)&&(!t.hasOwnProperty("lt")||et.gt)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(?:[-+])?(?:[0-9]+)?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/;t.exports=r.default},{"./util/assertString":176}],135:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fullWidth=void 0,r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=r.fullWidth=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/},{"./util/assertString":176}],136:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.halfWidth=void 0,r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=r.halfWidth=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/},{"./util/assertString":176}],137:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),new RegExp("^[a-f0-9]{"+i[t]+"}$").test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};t.exports=r.default},{"./util/assertString":176}],138:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;t.exports=r.default},{"./util/assertString":176}],139:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[0-9A-F]+$/i;t.exports=r.default},{"./util/assertString":176}],140:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(e),!(t=String(t)))return n(e,4)||n(e,6);if("4"===t)return!!o.test(e)&&e.split(".").sort(function(e,t){return e-t})[3]<=255;if("6"===t){var r=e.split(":"),s=!1,u=n(r[r.length-1],4),c=u?7:8;if(r.length>c)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),s=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),s=!0);for(var f=0;f0&&f=1:r.length===c}return!1}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),o=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,a=/^[0-9A-F]{1,4}$/i;t.exports=r.default},{"./util/assertString":176}],141:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(e),!(t=String(t)))return n(e,10)||n(e,13);var r=e.replace(/[\s-]+/g,""),u=0,c=void 0;if("10"===t){if(!o.test(r))return!1;for(c=0;c<9;c++)u+=(c+1)*r.charAt(c);if("X"===r.charAt(9)?u+=100:u+=10*r.charAt(9),u%11==0)return!!r}else if("13"===t){if(!a.test(r))return!1;for(c=0;c<12;c++)u+=s[c%2]*r.charAt(c);if(r.charAt(12)-(10-u%10)%10==0)return!!r}return!1}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),o=/^(?:[0-9]{9}X|[0-9]{10})$/,a=/^(?:[0-9]{13})$/,s=[1,3];t.exports=r.default},{"./util/assertString":176}],142:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if((0,n.default)(e),!i.test(e))return!1;for(var t=e.replace(/[A-Z]/g,function(e){return parseInt(e,36)}),r=0,o=void 0,a=void 0,s=!0,u=t.length-2;u>=0;u--)o=t.substring(u,u+1),a=parseInt(o,10),r+=s&&(a*=2)>=10?a+1:a,s=!s;return parseInt(e.substr(e.length-1),10)===(1e4-r)%10};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;t.exports=r.default},{"./util/assertString":176}],143:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;t.exports=r.default},{"./util/assertString":176}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;t.exports=r.default},{"./util/assertString":176}],145:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,n.default)(e);var r=i;if(r=t.require_hyphen?r.replace("?",""):r,!(r=t.case_sensitive?new RegExp(r):new RegExp(r,"i")).test(e))return!1;var o=e.replace("-",""),a=8,s=0,u=!0,c=!1,f=void 0;try{for(var l,p=o[Symbol.iterator]();!(u=(l=p.next()).done);u=!0){var d=l.value;s+=("X"===d.toUpperCase()?10:+d)*a,--a}}catch(e){c=!0,f=e}finally{try{!u&&p.return&&p.return()}finally{if(c)throw f}}return s%11==0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i="^\\d{4}-?\\d{3}[\\dX]$";t.exports=r.default},{"./util/assertString":176}],146:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,o.default)(e);var r=void 0;if("[object Array]"===Object.prototype.toString.call(t)){var n=[];for(r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=(0,a.default)(t[r]));return n.indexOf(e)>=0}return"object"===(void 0===t?"undefined":i(t))?t.hasOwnProperty(e):!(!t||"function"!=typeof t.indexOf)&&t.indexOf(e)>=0};var o=n(e("./util/assertString")),a=n(e("./util/toString"));t.exports=r.default},{"./util/assertString":176,"./util/toString":178}],147:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);var r=(t=t||{}).hasOwnProperty("allow_leading_zeroes")&&!t.allow_leading_zeroes?i:o,a=!t.hasOwnProperty("min")||e>=t.min,s=!t.hasOwnProperty("max")||e<=t.max,u=!t.hasOwnProperty("lt")||et.gt;return r.test(e)&&a&&s&&u&&c};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,o=/^[-+]?[0-9]+$/;t.exports=r.default},{"./util/assertString":176}],148:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e){(0,i.default)(e);try{var t=JSON.parse(e);return!!t&&"object"===(void 0===t?"undefined":n(t))}catch(e){}return!1};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],149:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if((0,n.default)(e),!e.includes(","))return!1;var t=e.split(",");return i.test(t[0])&&o.test(t[1])};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,o=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;t.exports=r.default},{"./util/assertString":176}],150:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,i.default)(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":n(t))?(r=t.min||0,o=t.max):(r=arguments[1],o=arguments[2]);var a=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],s=e.length-a.length;return s>=r&&(void 0===o||s<=o)};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],151:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e===e.toLowerCase()};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],152:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;t.exports=r.default},{"./util/assertString":176}],153:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[a-f0-9]{32}$/;t.exports=r.default},{"./util/assertString":176}],154:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if((0,n.default)(e),t in i)return i[t].test(e);if("any"===t){for(var r in i)if(i.hasOwnProperty(r)&&i[r].test(e))return!0;return!1}throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[012]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"sk-SK":/^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"de-DE":/^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"da-DK":/^(\+?45)?(\d{8})$/,"el-GR":/^(\+?30)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[569]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[789]\d{9}$/,"en-KE":/^(\+?254|0)?[7]\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\d{7,9}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"lt-LT":/^(\+370|8)\d{8}$/,"id-ID":/^(\+?62|0[1-9])[\s|\d]+$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ko-KR":/^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,"ja-JP":/^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/,"ms-MY":/^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ro-RO":/^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"sr-RS":/^(\+3816|06)[- \d]{5,9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"vi-VN":/^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?1[345789]\d{9}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};i["en-CA"]=i["en-US"],i["fr-BE"]=i["nl-BE"],i["zh-HK"]=i["en-HK"],t.exports=r.default},{"./util/assertString":176}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,i.default)(e),(0,o.default)(e)&&24===e.length};var i=n(e("./util/assertString")),o=n(e("./isHexadecimal"));t.exports=r.default},{"./isHexadecimal":139,"./util/assertString":176}],156:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[^\x00-\x7F]/;t.exports=r.default},{"./util/assertString":176}],157:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[-+]?[0-9]+$/;t.exports=r.default},{"./util/assertString":176}],158:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.locales=void 0,r.default=function(e,t){if((0,n.default)(e),t in s)return s[t].test(e);if("any"===t){for(var r in s)if(s.hasOwnProperty(r)&&s[r].test(e))return!0;return!1}throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\d{4}$/,o=/^\d{5}$/,a=/^\d{6}$/,s={AT:i,AU:a,BE:i,CA:/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,CH:i,CZ:/^\d{3}\s?\d{2}$/,DE:o,DK:i,DZ:o,ES:o,FI:o,FR:/^\d{2}\s?\d{3}$/,GB:/^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,GR:/^\d{3}\s?\d{2}$/,IL:o,IN:a,IS:/^\d{3}$/,IT:o,JP:/^\d{3}\-\d{4}$/,KE:o,LI:/^(948[5-9]|949[0-7])$/,MX:o,NL:/^\d{4}\s?[a-z]{2}$/i,NO:i,PL:/^\d{2}\-\d{3}$/,PT:/^\d{4}(\-\d{3})?$/,RO:a,RU:a,SA:o,SE:/^\d{3}\s?\d{2}$/,TW:/^\d{3}(\d{2})?$/,US:/^\d{5}(-\d{4})?$/,ZA:i,ZM:o};r.locales=Object.keys(s)},{"./util/assertString":176}],159:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;t.exports=r.default},{"./util/assertString":176}],160:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function o(e,t){for(var r=0;r=2083||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;t=(0,c.default)(t,f);var r=void 0,n=void 0,i=void 0,p=void 0,d=void 0,h=void 0,m=void 0,y=void 0;if(m=e.split("#"),e=m.shift(),m=e.split("?"),e=m.shift(),(m=e.split("://")).length>1){if(r=m.shift(),t.require_valid_protocol&&-1===t.protocols.indexOf(r))return!1}else{if(t.require_protocol)return!1;t.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(m[0]=e.substr(2))}if(""===(e=m.join("://")))return!1;if(m=e.split("/"),""===(e=m.shift())&&!t.require_host)return!0;if((m=e.split("@")).length>1&&(n=m.shift()).indexOf(":")>=0&&n.split(":").length>2)return!1;h=null,y=null;var g=(p=m.join("@")).match(l);return g?(i="",y=g[1],h=g[2]||null):(i=(m=p.split(":")).shift(),m.length&&(h=m.join(":"))),!(null!==h&&(d=parseInt(h,10),!/^[0-9]+$/.test(h)||d<=0||d>65535)||!((0,u.default)(i)||(0,s.default)(i,t)||y&&(0,u.default)(y,6))||(i=i||y,t.host_whitelist&&!o(i,t.host_whitelist)||t.host_blacklist&&o(i,t.host_blacklist)))};var a=n(e("./util/assertString")),s=n(e("./isFQDN")),u=n(e("./isIP")),c=n(e("./util/merge")),f={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},l=/^\[([^\]]+)\](?::([0-9]+))?$/;t.exports=r.default},{"./isFQDN":133,"./isIP":140,"./util/assertString":176,"./util/merge":177}],161:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";(0,n.default)(e);var r=i[t];return r&&r.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};t.exports=r.default},{"./util/assertString":176}],162:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e===e.toUpperCase()};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],163:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.fullWidth.test(e)&&o.halfWidth.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./isFullWidth"),o=e("./isHalfWidth");t.exports=r.default},{"./isFullWidth":135,"./isHalfWidth":136,"./util/assertString":176}],164:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);for(var r=e.length-1;r>=0;r--)if(-1===t.indexOf(e[r]))return!1;return!0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],165:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);var r=t?new RegExp("^["+t+"]+","g"):/^\s+/g;return e.replace(r,"")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],166:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t,r){return(0,n.default)(e),"[object RegExp]"!==Object.prototype.toString.call(t)&&(t=new RegExp(t,r)),t.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],167:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if(t=(0,o.default)(t,a),!(0,i.default)(e))return!1;var r=e.split("@"),n=r.pop(),f=[r.join("@"),n];if(f[1]=f[1].toLowerCase(),"gmail.com"===f[1]||"googlemail.com"===f[1]){if(t.gmail_remove_subaddress&&(f[0]=f[0].split("+")[0]),t.gmail_remove_dots&&(f[0]=f[0].replace(/\./g,"")),!f[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(f[0]=f[0].toLowerCase()),f[1]=t.gmail_convert_googlemaildotcom?"gmail.com":f[1]}else if(~s.indexOf(f[1])){if(t.icloud_remove_subaddress&&(f[0]=f[0].split("+")[0]),!f[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(f[0]=f[0].toLowerCase())}else if(~u.indexOf(f[1])){if(t.outlookdotcom_remove_subaddress&&(f[0]=f[0].split("+")[0]),!f[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(f[0]=f[0].toLowerCase())}else if(~c.indexOf(f[1])){if(t.yahoo_remove_subaddress){var l=f[0].split("-");f[0]=l.length>1?l.slice(0,-1).join("-"):l[0]}if(!f[0].length)return!1;(t.all_lowercase||t.yahoo_lowercase)&&(f[0]=f[0].toLowerCase())}else t.all_lowercase&&(f[0]=f[0].toLowerCase());return f.join("@")};var i=n(e("./isEmail")),o=n(e("./util/merge")),a={all_lowercase:!0,gmail_lowercase:!0,gmail_remove_dots:!0,gmail_remove_subaddress:!0,gmail_convert_googlemaildotcom:!0,outlookdotcom_lowercase:!0,outlookdotcom_remove_subaddress:!0,yahoo_lowercase:!0,yahoo_remove_subaddress:!0,icloud_lowercase:!0,icloud_remove_subaddress:!0},s=["icloud.com","me.com"],u=["hotmail.at","hotmail.be","hotmail.ca","hotmail.cl","hotmail.co.il","hotmail.co.nz","hotmail.co.th","hotmail.co.uk","hotmail.com","hotmail.com.ar","hotmail.com.au","hotmail.com.br","hotmail.com.gr","hotmail.com.mx","hotmail.com.pe","hotmail.com.tr","hotmail.com.vn","hotmail.cz","hotmail.de","hotmail.dk","hotmail.es","hotmail.fr","hotmail.hu","hotmail.id","hotmail.ie","hotmail.in","hotmail.it","hotmail.jp","hotmail.kr","hotmail.lv","hotmail.my","hotmail.ph","hotmail.pt","hotmail.sa","hotmail.sg","hotmail.sk","live.be","live.co.uk","live.com","live.com.ar","live.com.mx","live.de","live.es","live.eu","live.fr","live.it","live.nl","msn.com","outlook.at","outlook.be","outlook.cl","outlook.co.il","outlook.co.nz","outlook.co.th","outlook.com","outlook.com.ar","outlook.com.au","outlook.com.br","outlook.com.gr","outlook.com.pe","outlook.com.tr","outlook.com.vn","outlook.cz","outlook.de","outlook.dk","outlook.es","outlook.fr","outlook.hu","outlook.id","outlook.ie","outlook.in","outlook.it","outlook.jp","outlook.kr","outlook.lv","outlook.my","outlook.ph","outlook.pt","outlook.sa","outlook.sg","outlook.sk","passport.com"],c=["rocketmail.com","yahoo.ca","yahoo.co.uk","yahoo.com","yahoo.de","yahoo.fr","yahoo.in","yahoo.it","ymail.com"];t.exports=r.default},{"./isEmail":131,"./util/merge":177}],168:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);for(var r=t?new RegExp("["+t+"]"):/\s/,i=e.length-1;i>=0&&r.test(e[i]);)i--;return i").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],176:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if(!("string"==typeof e||e instanceof String))throw new TypeError("This library (validator.js) validates strings only")},t.exports=r.default},{}],177:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];for(var r in t)void 0===e[r]&&(e[r]=t[r]);return e},t.exports=r.default},{}],178:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null===e||void 0===e||isNaN(e)&&!e.length)&&(e=""),String(e)},t.exports=r.default},{}],179:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),e.replace(new RegExp("[^"+t+"]+","g"),"")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":176}],180:[function(e,t,r){"use strict";t.exports={INVALID_TYPE:"Expected type {0} but found type {1}",INVALID_FORMAT:"Object didn't pass validation for format {0}: {1}",ENUM_MISMATCH:"No enum match for: {0}",ANY_OF_MISSING:"Data does not match any schemas from 'anyOf'",ONE_OF_MISSING:"Data does not match any schemas from 'oneOf'",ONE_OF_MULTIPLE:"Data is valid against more than one schema from 'oneOf'",NOT_PASSED:"Data matches schema from 'not'",ARRAY_LENGTH_SHORT:"Array is too short ({0}), minimum {1}",ARRAY_LENGTH_LONG:"Array is too long ({0}), maximum {1}",ARRAY_UNIQUE:"Array items are not unique (indexes {0} and {1})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",MULTIPLE_OF:"Value {0} is not a multiple of {1}",MINIMUM:"Value {0} is less than minimum {1}",MINIMUM_EXCLUSIVE:"Value {0} is equal or less than exclusive minimum {1}",MAXIMUM:"Value {0} is greater than maximum {1}",MAXIMUM_EXCLUSIVE:"Value {0} is equal or greater than exclusive maximum {1}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({0}), minimum {1}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({0}), maximum {1}",OBJECT_MISSING_REQUIRED_PROPERTY:"Missing required property: {0}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed: {0}",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {0} (due to key: {1})",MIN_LENGTH:"String is too short ({0} chars), minimum {1}",MAX_LENGTH:"String is too long ({0} chars), maximum {1}",PATTERN:"String does not match pattern {0}: {1}",KEYWORD_TYPE_EXPECTED:"Keyword '{0}' is expected to be of type '{1}'",KEYWORD_UNDEFINED_STRICT:"Keyword '{0}' must be defined in strict mode",KEYWORD_UNEXPECTED:"Keyword '{0}' is not expected to appear in the schema",KEYWORD_MUST_BE:"Keyword '{0}' must be {1}",KEYWORD_DEPENDENCY:"Keyword '{0}' requires keyword '{1}'",KEYWORD_PATTERN:"Keyword '{0}' is not a valid RegExp pattern: {1}",KEYWORD_VALUE_TYPE:"Each element of keyword '{0}' array must be a '{1}'",UNKNOWN_FORMAT:"There is no validation function for format '{0}'",CUSTOM_MODE_FORCE_PROPERTIES:"{0} must define at least one property if present",REF_UNRESOLVED:"Reference has not been resolved during compilation: {0}",UNRESOLVABLE_REFERENCE:"Reference could not be resolved: {0}",SCHEMA_NOT_REACHABLE:"Validator was not able to read schema with uri: {0}",SCHEMA_TYPE_EXPECTED:"Schema is expected to be of type 'object'",SCHEMA_NOT_AN_OBJECT:"Schema is not an object: {0}",ASYNC_TIMEOUT:"{0} asynchronous task(s) have timed out after {1} ms",PARENT_SCHEMA_VALIDATION_FAILED:"Schema failed to validate against its parent schema, see inner errors for details.",REMOTE_NOT_VALID:"Remote reference didn't compile successfully: {0}"}},{}],181:[function(e,t,r){var n=e("validator"),i={date:function(e){if("string"!=typeof e)return!0;var t=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(e);return null!==t&&!(t[2]<"01"||t[2]>"12"||t[3]<"01"||t[3]>"31")},"date-time":function(e){if("string"!=typeof e)return!0;var t=e.toLowerCase().split("t");if(!i.date(t[0]))return!1;var r=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$/.exec(t[1]);return null!==r&&!(r[1]>"23"||r[2]>"59"||r[3]>"59")},email:function(e){return"string"!=typeof e||n.isEmail(e,{require_tld:!0})},hostname:function(e){if("string"!=typeof e)return!0;var t=/^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/.test(e);if(t){if(e.length>255)return!1;for(var r=e.split("."),n=0;n63)return!1}return t},"host-name":function(e){return i.hostname.call(this,e)},ipv4:function(e){return"string"!=typeof e||n.isIP(e,4)},ipv6:function(e){return"string"!=typeof e||n.isIP(e,6)},regex:function(e){try{return RegExp(e),!0}catch(e){return!1}},uri:function(e){return this.options.strictUris?i["strict-uri"].apply(this,arguments):"string"!=typeof e||RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?").test(e)},"strict-uri":function(e){return"string"!=typeof e||n.isURL(e)}};t.exports=i},{validator:112}],182:[function(e,t,r){"use strict";var n=e("./FormatValidators"),i=e("./Report"),o=e("./Utils"),a={multipleOf:function(e,t,r){"number"==typeof r&&"integer"!==o.whatIs(r/t.multipleOf)&&e.addError("MULTIPLE_OF",[r,t.multipleOf],null,t.description)},maximum:function(e,t,r){"number"==typeof r&&(!0!==t.exclusiveMaximum?r>t.maximum&&e.addError("MAXIMUM",[r,t.maximum],null,t.description):r>=t.maximum&&e.addError("MAXIMUM_EXCLUSIVE",[r,t.maximum],null,t.description))},exclusiveMaximum:function(){},minimum:function(e,t,r){"number"==typeof r&&(!0!==t.exclusiveMinimum?rt.maxLength&&e.addError("MAX_LENGTH",[r.length,t.maxLength],null,t.description)},minLength:function(e,t,r){"string"==typeof r&&o.ucs2decode(r).lengtht.items.length&&e.addError("ARRAY_ADDITIONAL_ITEMS",null,null,t.description)},items:function(){},maxItems:function(e,t,r){Array.isArray(r)&&r.length>t.maxItems&&e.addError("ARRAY_LENGTH_LONG",[r.length,t.maxItems],null,t.description)},minItems:function(e,t,r){Array.isArray(r)&&r.lengtht.maxProperties&&e.addError("OBJECT_PROPERTIES_MAXIMUM",[n,t.maxProperties],null,t.description)}},minProperties:function(e,t,r){if("object"===o.whatIs(r)){var n=Object.keys(r).length;n0){var p=this.options.assumeAdditional.length;if(p)for(;p--;){var d=a.indexOf(this.options.assumeAdditional[p]);-1!==d&&a.splice(d,1)}a.length>0&&e.addError("OBJECT_ADDITIONAL_PROPERTIES",[a],null,t.description)}}}},dependencies:function(e,t,n){if("object"===o.whatIs(n))for(var i=Object.keys(t.dependencies),a=i.length;a--;){var s=i[a];if(n[s]){var u=t.dependencies[s];if("object"===o.whatIs(u))r.validate.call(this,e,u,n);else for(var c=u.length;c--;){var f=u[c];void 0===n[f]&&e.addError("OBJECT_DEPENDENCY_KEY",[f,s],null,t.description)}}}},enum:function(e,t,r){for(var n=!1,i=t.enum.length;i--;)if(o.areEqual(r,t.enum[i])){n=!0;break}!1===n&&e.addError("ENUM_MISMATCH",[r],null,t.description)},allOf:function(e,t,n){for(var i=t.allOf.length;i--;){var o=r.validate.call(this,e,t.allOf[i],n);if(this.options.breakOnFirstError&&!1===o)break}},anyOf:function(e,t,n){for(var o=[],a=!1,s=t.anyOf.length;s--&&!1===a;){var u=new i(e);o.push(u),a=r.validate.call(this,u,t.anyOf[s],n)}!1===a&&e.addError("ANY_OF_MISSING",void 0,o,t.description)},oneOf:function(e,t,n){for(var o=0,a=[],s=t.oneOf.length;s--;){var u=new i(e,{maxErrors:1});a.push(u),!0===r.validate.call(this,u,t.oneOf[s],n)&&o++}0===o?e.addError("ONE_OF_MISSING",void 0,a,t.description):o>1&&e.addError("ONE_OF_MULTIPLE",null,null,t.description)},not:function(e,t,n){var o=new i(e);!0===r.validate.call(this,o,t.not,n)&&e.addError("NOT_PASSED",null,null,t.description)},definitions:function(){},format:function(e,t,r){var i=n[t.format];"function"==typeof i?2===i.length?e.addAsyncTask(i,[r],function(n){!0!==n&&e.addError("INVALID_FORMAT",[t.format,r],null,t.description)}):!0!==i.call(this,r)&&e.addError("INVALID_FORMAT",[t.format,r],null,t.description):!0!==this.options.ignoreUnknownFormats&&e.addError("UNKNOWN_FORMAT",[t.format],null,t.description)}},s=function(e,t,n){var i=n.length;if(Array.isArray(t.items))for(;i--;)i0;){if(!t.__$refResolved){e.addError("REF_UNRESOLVED",[t.$ref],null,t.description);break}if(t.__$refResolved===t)break;t=t.__$refResolved,i=Object.keys(t),f--}if(0===f)throw new Error("Circular dependency by $ref references!")}var l=o.whatIs(r);if(t.type)if("string"==typeof t.type){if(l!==t.type&&("integer"!==l||"number"!==t.type)&&(e.addError("INVALID_TYPE",[t.type,l],null,t.description),this.options.breakOnFirstError))return!1}else if(-1===t.type.indexOf(l)&&("integer"!==l||-1===t.type.indexOf("number"))&&(e.addError("INVALID_TYPE",[t.type,l],null,t.description),this.options.breakOnFirstError))return!1;for(var p=i.length;p--&&!(a[i[p]]&&(a[i[p]].call(this,e,t,r),e.errors.length&&this.options.breakOnFirstError)););return 0!==e.errors.length&&!1!==this.options.breakOnFirstError||("array"===l?s.call(this,e,t,r):"object"===l&&u.call(this,e,t,r)),"function"==typeof this.options.customValidator&&this.options.customValidator(e,t,r),c&&(e.rootSchema=void 0),0===e.errors.length}},{"./FormatValidators":181,"./Report":184,"./Utils":188}],183:[function(e,t,r){"function"!=typeof Number.isFinite&&(Number.isFinite=function(e){return"number"==typeof e&&(e===e&&e!==1/0&&e!==-1/0)})},{}],184:[function(e,t,r){(function(r){"use strict";function n(e,t){this.parentReport=e instanceof n?e:void 0,this.options=e instanceof n?e.options:e||{},this.reportOptions=t||{},this.errors=[],this.path=[],this.asyncTasks=[]}var i=e("lodash.get"),o=e("./Errors"),a=e("./Utils");n.prototype.isValid=function(){if(this.asyncTasks.length>0)throw new Error("Async tasks pending, can't answer isValid");return 0===this.errors.length},n.prototype.addAsyncTask=function(e,t,r){this.asyncTasks.push([e,t,r])},n.prototype.processAsyncTasks=function(e,t){function n(){r.nextTick(function(){var e=0===u.errors.length,r=e?void 0:u.errors;t(r,e)})}var i=e||2e3,o=this.asyncTasks.length,a=o,s=!1,u=this;if(0===o||this.errors.length>0)n();else{for(;a--;){var c=this.asyncTasks[a];c[0].apply(null,c[1].concat(function(e){return function(t){s||(e(t),0==--o&&n())}}(c[2])))}setTimeout(function(){o>0&&(s=!0,u.addError("ASYNC_TIMEOUT",[o,i]),t(u.errors,!1))},i)}},n.prototype.getPath=function(e){var t=[];return this.parentReport&&(t=t.concat(this.parentReport.path)),t=t.concat(this.path),!0!==e&&(t="#/"+t.map(function(e){return a.isAbsoluteUri(e)?"uri("+e+")":e.replace(/\~/g,"~0").replace(/\//g,"~1")}).join("/")),t},n.prototype.getSchemaId=function(){if(!this.rootSchema)return null;var e=[];for(this.parentReport&&(e=e.concat(this.parentReport.path)),e=e.concat(this.path);e.length>0;){var t=i(this.rootSchema,e);if(t&&t.id)return t.id;e.pop()}return this.rootSchema.id},n.prototype.hasError=function(e,t){for(var r=this.errors.length;r--;)if(this.errors[r].code===e){for(var n=!0,i=this.errors[r].params.length;i--;)this.errors[r].params[i]!==t[i]&&(n=!1);if(n)return n}return!1},n.prototype.addError=function(e,t,r,n){if(!e)throw new Error("No errorCode passed into addError()");this.addCustomError(e,o[e],t,r,n)},n.prototype.addCustomError=function(e,t,r,n,i){if(!(this.errors.length>=this.reportOptions.maxErrors)){if(!t)throw new Error("No errorMessage known for code "+e);for(var o=(r=r||[]).length;o--;){var s=a.whatIs(r[o]),u="object"===s||"null"===s?JSON.stringify(r[o]):r[o];t=t.replace("{"+o+"}",u)}var c={code:e,params:r,message:t,path:this.getPath(this.options.reportPathAsArray),schemaId:this.getSchemaId()};if(i&&(c.description=i),null!=n){for(Array.isArray(n)||(n=[n]),c.inner=[],o=n.length;o--;)for(var f=n[o],l=f.errors.length;l--;)c.inner.push(f.errors[l]);0===c.inner.length&&(c.inner=void 0)}this.errors.push(c)}},t.exports=n}).call(this,e("_process"))},{"./Errors":180,"./Utils":188,_process:95,"lodash.get":82}],185:[function(e,t,r){"use strict";function n(e){return decodeURIComponent(e).replace(/~[0-1]/g,function(e){return"~1"===e?"/":"~"})}function i(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function o(e){var t=e.indexOf("#");return-1===t?void 0:e.slice(t+1)}function a(e,t){if("object"==typeof e&&null!==e){if(!t)return e;if(e.id&&(e.id===t||"#"===e.id[0]&&e.id.substring(1)===t))return e;var r,n;if(Array.isArray(e)){for(r=e.length;r--;)if(n=a(e[r],t))return n}else{var i=Object.keys(e);for(r=i.length;r--;){var o=i[r];if(0!==o.indexOf("__$")&&(n=a(e[o],t)))return n}}}}var s=e("lodash.isequal"),u=e("./Report"),c=e("./SchemaCompilation"),f=e("./SchemaValidation"),l=e("./Utils");r.cacheSchemaByUri=function(e,t){var r=i(e);r&&(this.cache[r]=t)},r.removeFromCacheByUri=function(e){var t=i(e);t&&delete this.cache[t]},r.checkCacheForUri=function(e){var t=i(e);return!!t&&null!=this.cache[t]},r.getSchema=function(e,t){return"object"==typeof t&&(t=r.getSchemaByReference.call(this,e,t)),"string"==typeof t&&(t=r.getSchemaByUri.call(this,e,t)),t},r.getSchemaByReference=function(e,t){for(var r=this.referenceCache.length;r--;)if(s(this.referenceCache[r][0],t))return this.referenceCache[r][1];var n=l.cloneDeep(t);return this.referenceCache.push([t,n]),n},r.getSchemaByUri=function(e,t,r){var s=i(t),l=o(t),p=s?this.cache[s]:r;if(p&&s&&p!==r){e.path.push(s);var d=new u(e);c.compileSchema.call(this,d,p)&&f.validateSchema.call(this,d,p);var h=d.isValid();if(h||e.addError("REMOTE_NOT_VALID",[t],d),e.path.pop(),!h)return}if(p&&l)for(var m=l.split("/"),y=0,g=m.length;p&&y=55296&&t<=56319&&i0)throw new Error("This validation has async tasks and cannot be done in sync mode, please provide callback argument.");return this.lastReport=m,m.isValid()}m.processAsyncTasks(this.options.asyncTimeout,a)},n.prototype.getLastError=function(){if(0===this.lastReport.errors.length)return null;var e=new Error;return e.name="z-schema validation error",e.message=this.lastReport.commonErrorMessage,e.details=this.lastReport.errors,e},n.prototype.getLastErrors=function(){return this.lastReport&&this.lastReport.errors.length>0?this.lastReport.errors:void 0},n.prototype.getMissingReferences=function(e){for(var t=[],r=(e=e||this.lastReport.errors).length;r--;){var n=e[r];if("UNRESOLVABLE_REFERENCE"===n.code){var i=n.params[0];-1===t.indexOf(i)&&t.push(i)}n.inner&&(t=t.concat(this.getMissingReferences(n.inner)))}return t},n.prototype.getMissingRemoteReferences=function(){for(var e=this.getMissingReferences(),t=[],r=e.length;r--;){var n=u.getRemotePath(e[r]);n&&-1===t.indexOf(n)&&t.push(n)}return t},n.prototype.setRemoteReference=function(e,t){t="string"==typeof t?JSON.parse(t):l.cloneDeep(t),u.cacheSchemaByUri.call(this,e,t)},n.prototype.getResolvedSchema=function(e){var t=new o(this.options);e=u.getSchema.call(this,t,e),e=l.cloneDeep(e);var r=[],n=function(e){var t,i=l.whatIs(e);if(("object"===i||"array"===i)&&!e.___$visited){if(e.___$visited=!0,r.push(e),e.$ref&&e.__$refResolved){var o=e.__$refResolved,a=e;delete e.$ref,delete e.__$refResolved;for(t in o)o.hasOwnProperty(t)&&(a[t]=o[t])}for(t in e)e.hasOwnProperty(t)&&(0===t.indexOf("__$")?delete e[t]:n(e[t]))}};if(n(e),r.forEach(function(e){delete e.___$visited}),this.lastReport=t,t.isValid())return e;throw this.getLastError()},n.prototype.setSchemaReader=function(e){return n.setSchemaReader(e)},n.prototype.getSchemaReader=function(){return n.schemaReader},n.setSchemaReader=function(e){n.schemaReader=e},n.registerFormat=function(e,t){a[e]=t},n.unregisterFormat=function(e){delete a[e]},n.getRegisteredFormats=function(){return Object.keys(a)},n.getDefaultOptions=function(){return l.cloneDeep(h)},t.exports=n}).call(this,e("_process"))},{"./FormatValidators":181,"./JsonValidation":182,"./Polyfills":183,"./Report":184,"./SchemaCache":185,"./SchemaCompilation":186,"./SchemaValidation":187,"./Utils":188,"./schemas/hyper-schema.json":190,"./schemas/schema.json":191,_process:95,"lodash.get":82}],190:[function(e,t,r){t.exports={$schema:"http://json-schema.org/draft-04/hyper-schema#",id:"http://json-schema.org/draft-04/hyper-schema#",title:"JSON Hyper-Schema",allOf:[{$ref:"http://json-schema.org/draft-04/schema#"}],properties:{additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}]},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}]},dependencies:{additionalProperties:{anyOf:[{$ref:"#"},{type:"array"}]}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}]},definitions:{additionalProperties:{$ref:"#"}},patternProperties:{additionalProperties:{$ref:"#"}},properties:{additionalProperties:{$ref:"#"}},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"},links:{type:"array",items:{$ref:"#/definitions/linkDescription"}},fragmentResolution:{type:"string"},media:{type:"object",properties:{type:{description:"A media type, as described in RFC 2046",type:"string"},binaryEncoding:{description:"A content encoding scheme, as described in RFC 2045",type:"string"}}},pathStart:{description:"Instances' URIs must start with this value for this schema to apply to them",type:"string",format:"uri"}},definitions:{schemaArray:{type:"array",items:{$ref:"#"}},linkDescription:{title:"Link Description Object",type:"object",required:["href","rel"],properties:{href:{description:"a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",type:"string"},rel:{description:"relation to the target resource of the link",type:"string"},title:{description:"a title for the link",type:"string"},targetSchema:{description:"JSON Schema describing the link target",$ref:"#"},mediaType:{description:"media type (as defined by RFC 2046) describing the link target",type:"string"},method:{description:'method for requesting the target of the link (e.g. for HTTP this might be "GET" or "DELETE")',type:"string"},encType:{description:"The media type in which to submit data along with the request",type:"string",default:"application/json"},schema:{description:"Schema describing the data to submit along with the request",$ref:"#"}}}}}},{}],191:[function(e,t,r){t.exports={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}}},{}],192:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/apiDeclaration.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swaggerVersion","basePath","apis"],properties:{swaggerVersion:{enum:["1.2"]},apiVersion:{type:"string"},basePath:{type:"string",format:"uri",pattern:"^https?://"},resourcePath:{type:"string",format:"uri",pattern:"^/"},apis:{type:"array",items:{$ref:"#/definitions/apiObject"}},models:{type:"object",additionalProperties:{$ref:"modelsObject.json#"}},produces:{$ref:"#/definitions/mimeTypeArray"},consumes:{$ref:"#/definitions/mimeTypeArray"},authorizations:{$ref:"authorizationObject.json#"}},additionalProperties:!1,definitions:{apiObject:{type:"object",required:["path","operations"],properties:{path:{type:"string",format:"uri-template",pattern:"^/"},description:{type:"string"},operations:{type:"array",items:{$ref:"operationObject.json#"}}},additionalProperties:!1},mimeTypeArray:{type:"array",items:{type:"string",format:"mime-type"},uniqueItems:!0}}}},{}],193:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/authorizationObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuth"},{$ref:"#/definitions/apiKey"},{$ref:"#/definitions/oauth2"}]},definitions:{basicAuth:{required:["type"],properties:{type:{enum:["basicAuth"]}},additionalProperties:!1},apiKey:{required:["type","passAs","keyname"],properties:{type:{enum:["apiKey"]},passAs:{enum:["header","query"]},keyname:{type:"string"}},additionalProperties:!1},oauth2:{type:"object",required:["type","grantTypes"],properties:{type:{enum:["oauth2"]},scopes:{type:"array",items:{$ref:"#/definitions/oauth2Scope"}},grantTypes:{$ref:"oauth2GrantType.json#"}},additionalProperties:!1},oauth2Scope:{type:"object",required:["scope"],properties:{scope:{type:"string"},description:{type:"string"}},additionalProperties:!1}}}},{}],194:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/dataType.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"Data type as described by the specification (version 1.2)",type:"object",oneOf:[{$ref:"#/definitions/refType"},{$ref:"#/definitions/voidType"},{$ref:"#/definitions/primitiveType"},{$ref:"#/definitions/modelType"},{$ref:"#/definitions/arrayType"}],definitions:{refType:{required:["$ref"],properties:{$ref:{type:"string"}},additionalProperties:!1},voidType:{enum:[{type:"void"}]},modelType:{required:["type"],properties:{type:{type:"string",not:{enum:["boolean","integer","number","string","array"]}}},additionalProperties:!1},primitiveType:{required:["type"],properties:{type:{enum:["boolean","integer","number","string"]},format:{type:"string"},defaultValue:{not:{type:["array","object","null"]}},enum:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},minimum:{type:"string"},maximum:{type:"string"}},additionalProperties:!1,dependencies:{format:{oneOf:[{properties:{type:{enum:["integer"]},format:{enum:["int32","int64"]}}},{properties:{type:{enum:["number"]},format:{enum:["float","double"]}}},{properties:{type:{enum:["string"]},format:{enum:["byte","date","date-time"]}}}]},enum:{properties:{type:{enum:["string"]}}},minimum:{properties:{type:{enum:["integer","number"]}}},maximum:{properties:{type:{enum:["integer","number"]}}}}},arrayType:{required:["type","items"],properties:{type:{enum:["array"]},items:{type:"array",items:{$ref:"#/definitions/itemsObject"}},uniqueItems:{type:"boolean"}},additionalProperties:!1},itemsObject:{oneOf:[{$ref:"#/definitions/refType"},{allOf:[{$ref:"#/definitions/primitiveType"},{properties:{type:{},format:{}},additionalProperties:!1}]}]}}}},{}],195:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"Data type fields (section 4.3.3)",type:"object",oneOf:[{required:["type"]},{required:["$ref"]}],properties:{type:{type:"string"},$ref:{type:"string"},format:{type:"string"},defaultValue:{not:{type:["array","object","null"]}},enum:{type:"array",items:{type:"string"},uniqueItems:!0,minItems:1},minimum:{type:"string"},maximum:{type:"string"},items:{$ref:"#/definitions/itemsObject"},uniqueItems:{type:"boolean"}},dependencies:{format:{oneOf:[{properties:{type:{enum:["integer"]},format:{enum:["int32","int64"]}}},{properties:{type:{enum:["number"]},format:{enum:["float","double"]}}},{properties:{type:{enum:["string"]},format:{enum:["byte","date","date-time"]}}}]}},definitions:{itemsObject:{oneOf:[{type:"object",required:["$ref"],properties:{$ref:{type:"string"}},additionalProperties:!1},{allOf:[{$ref:"#"},{required:["type"],properties:{type:{},format:{}},additionalProperties:!1}]}]}}}},{}],196:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/infoObject.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"info object (section 5.1.3)",type:"object",required:["title","description"],properties:{title:{type:"string"},description:{type:"string"},termsOfServiceUrl:{type:"string",format:"uri"},contact:{type:"string",format:"email"},license:{type:"string"},licenseUrl:{type:"string",format:"uri"}},additionalProperties:!1}},{}],197:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/modelsObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["id","properties"],properties:{id:{type:"string"},description:{type:"string"},properties:{type:"object",additionalProperties:{$ref:"#/definitions/propertyObject"}},subTypes:{type:"array",items:{type:"string"},uniqueItems:!0},discriminator:{type:"string"}},dependencies:{subTypes:["discriminator"]},definitions:{propertyObject:{allOf:[{not:{$ref:"#"}},{$ref:"dataTypeBase.json#"}]}}}},{}],198:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/oauth2GrantType.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",minProperties:1,properties:{implicit:{$ref:"#/definitions/implicit"},authorization_code:{$ref:"#/definitions/authorizationCode"}},definitions:{implicit:{type:"object",required:["loginEndpoint"],properties:{loginEndpoint:{$ref:"#/definitions/loginEndpoint"},tokenName:{type:"string"}},additionalProperties:!1},authorizationCode:{type:"object",required:["tokenEndpoint","tokenRequestEndpoint"],properties:{tokenEndpoint:{$ref:"#/definitions/tokenEndpoint"},tokenRequestEndpoint:{$ref:"#/definitions/tokenRequestEndpoint"}},additionalProperties:!1},loginEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"}},additionalProperties:!1},tokenEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"},tokenName:{type:"string"}},additionalProperties:!1},tokenRequestEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"},clientIdName:{type:"string"},clientSecretName:{type:"string"}},additionalProperties:!1}}}},{}],199:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/operationObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",allOf:[{$ref:"dataTypeBase.json#"},{required:["method","nickname","parameters"],properties:{method:{enum:["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS"]},summary:{type:"string",maxLength:120},notes:{type:"string"},nickname:{type:"string",pattern:"^[a-zA-Z0-9_]+$"},authorizations:{type:"object",additionalProperties:{type:"array",items:{$ref:"authorizationObject.json#/definitions/oauth2Scope"}}},parameters:{type:"array",items:{$ref:"parameterObject.json#"}},responseMessages:{type:"array",items:{$ref:"#/definitions/responseMessageObject"}},produces:{$ref:"#/definitions/mimeTypeArray"},consumes:{$ref:"#/definitions/mimeTypeArray"},deprecated:{enum:["true","false"]}}}],definitions:{responseMessageObject:{type:"object",required:["code","message"],properties:{code:{$ref:"#/definitions/rfc2616section10"},message:{type:"string"},responseModel:{type:"string"}}},rfc2616section10:{type:"integer",minimum:100,maximum:600,exclusiveMaximum:!0},mimeTypeArray:{type:"array",items:{type:"string",format:"mime-type"},uniqueItems:!0}}}},{}],200:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/parameterObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",allOf:[{$ref:"dataTypeBase.json#"},{required:["paramType","name"],properties:{paramType:{enum:["path","query","body","header","form"]},name:{type:"string"},description:{type:"string"},required:{type:"boolean"},allowMultiple:{type:"boolean"}}},{description:"type File requires special paramType and consumes",oneOf:[{properties:{type:{not:{enum:["File"]}}}},{properties:{type:{enum:["File"]},paramType:{enum:["form"]},consumes:{enum:["multipart/form-data"]}}}]}]}},{}],201:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/resourceListing.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swaggerVersion","apis"],properties:{swaggerVersion:{enum:["1.2"]},apis:{type:"array",items:{$ref:"resourceObject.json#"}},apiVersion:{type:"string"},info:{$ref:"infoObject.json#"},authorizations:{$ref:"authorizationObject.json#"}}}},{}],202:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/resourceObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["path"],properties:{path:{type:"string",format:"uri"},description:{type:"string"}},additionalProperties:!1}},{}],203:[function(e,t,r){t.exports={title:"A JSON Schema for Swagger 2.0 API.",id:"http://swagger.io/v2/schema.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swagger","info","paths"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{swagger:{type:"string",enum:["2.0"],description:"The Swagger version of this document."},info:{$ref:"#/definitions/info"},host:{type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",description:"The host (name or ip) of the API. Example: 'swagger.io'"},basePath:{type:"string",pattern:"^/",description:"The base path to the API. Example: '/api'."},schemes:{$ref:"#/definitions/schemesList"},consumes:{description:"A list of MIME types accepted by the API.",$ref:"#/definitions/mediaTypeList"},produces:{description:"A list of MIME types the API can produce.",$ref:"#/definitions/mediaTypeList"},paths:{$ref:"#/definitions/paths"},definitions:{$ref:"#/definitions/definitions"},parameters:{$ref:"#/definitions/parameterDefinitions"},responses:{$ref:"#/definitions/responseDefinitions"},security:{$ref:"#/definitions/security"},securityDefinitions:{$ref:"#/definitions/securityDefinitions"},tags:{type:"array",items:{$ref:"#/definitions/tag"},uniqueItems:!0},externalDocs:{$ref:"#/definitions/externalDocs"}},definitions:{info:{type:"object",description:"General information about the API.",required:["version","title"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{title:{type:"string",description:"A unique and precise title of the API."},version:{type:"string",description:"A semantic version number of the API."},description:{type:"string",description:"A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."},termsOfService:{type:"string",description:"The terms of service for the API."},contact:{$ref:"#/definitions/contact"},license:{$ref:"#/definitions/license"}}},contact:{type:"object",description:"Contact information for the owners of the API.",additionalProperties:!1,properties:{name:{type:"string",description:"The identifying name of the contact person/organization."},url:{type:"string",description:"The URL pointing to the contact information.",format:"uri"},email:{type:"string",description:"The email address of the contact person/organization.",format:"email"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},license:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"The name of the license type. It's encouraged to use an OSI compatible license."},url:{type:"string",description:"The URL pointing to the license.",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},paths:{type:"object",description:"Relative paths to the individual endpoints. They must be relative to the 'basePath'.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"},"^/":{$ref:"#/definitions/pathItem"}},additionalProperties:!1},definitions:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},description:"One or more JSON objects describing the schemas being consumed and produced by the API."},parameterDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/parameter"},description:"One or more JSON representations for parameters"},responseDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/response"},description:"One or more JSON representations for parameters"},externalDocs:{type:"object",additionalProperties:!1,description:"information about external documentation",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},examples:{type:"object",additionalProperties:!0},mimeType:{type:"string",description:"The MIME type of the HTTP message."},operation:{type:"object",required:["responses"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{tags:{type:"array",items:{type:"string"},uniqueItems:!0},summary:{type:"string",description:"A brief summary of the operation."},description:{type:"string",description:"A longer description of the operation, GitHub Flavored Markdown is allowed."},externalDocs:{$ref:"#/definitions/externalDocs"},operationId:{type:"string",description:"A unique identifier of the operation."},produces:{description:"A list of MIME types the API can produce.",$ref:"#/definitions/mediaTypeList"},consumes:{description:"A list of MIME types the API can consume.",$ref:"#/definitions/mediaTypeList"},parameters:{$ref:"#/definitions/parametersList"},responses:{$ref:"#/definitions/responses"},schemes:{$ref:"#/definitions/schemesList"},deprecated:{type:"boolean",default:!1},security:{$ref:"#/definitions/security"}}},pathItem:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},get:{$ref:"#/definitions/operation"},put:{$ref:"#/definitions/operation"},post:{$ref:"#/definitions/operation"},delete:{$ref:"#/definitions/operation"},options:{$ref:"#/definitions/operation"},head:{$ref:"#/definitions/operation"},patch:{$ref:"#/definitions/operation"},parameters:{$ref:"#/definitions/parametersList"}}},responses:{type:"object",description:"Response objects names can either be any valid HTTP status code or 'default'.",minProperties:1,additionalProperties:!1,patternProperties:{"^([0-9]{3})$|^(default)$":{$ref:"#/definitions/responseValue"},"^x-":{$ref:"#/definitions/vendorExtension"}},not:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}}},responseValue:{oneOf:[{$ref:"#/definitions/response"},{$ref:"#/definitions/jsonReference"}]},response:{type:"object",required:["description"],properties:{description:{type:"string"},schema:{oneOf:[{$ref:"#/definitions/schema"},{$ref:"#/definitions/fileSchema"}]},headers:{$ref:"#/definitions/headers"},examples:{$ref:"#/definitions/examples"}},additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},headers:{type:"object",additionalProperties:{$ref:"#/definitions/header"}},header:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},vendorExtension:{description:"Any property starting with x- is valid.",additionalProperties:!0,additionalItems:!0},bodyParameter:{type:"object",required:["name","in","schema"],patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},in:{type:"string",description:"Determines the location of the parameter.",enum:["body"]},required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},schema:{$ref:"#/definitions/schema"}},additionalProperties:!1},headerParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["header"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},queryParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["query"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},formDataParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["formData"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array","file"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},pathParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["required"],properties:{required:{type:"boolean",enum:[!0],description:"Determines whether or not this parameter is required or optional."},in:{type:"string",description:"Determines the location of the parameter.",enum:["path"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},nonBodyParameter:{type:"object",required:["name","in","type"],oneOf:[{$ref:"#/definitions/headerParameterSubSchema"},{$ref:"#/definitions/formDataParameterSubSchema"},{$ref:"#/definitions/queryParameterSubSchema"},{$ref:"#/definitions/pathParameterSubSchema"}]},parameter:{oneOf:[{$ref:"#/definitions/bodyParameter"},{$ref:"#/definitions/nonBodyParameter"}]},schema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},maxProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},additionalProperties:{anyOf:[{$ref:"#/definitions/schema"},{type:"boolean"}],default:{}},type:{$ref:"http://json-schema.org/draft-04/schema#/properties/type"},items:{anyOf:[{$ref:"#/definitions/schema"},{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}}],default:{}},allOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},properties:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},default:{}},discriminator:{type:"string"},readOnly:{type:"boolean",default:!1},xml:{$ref:"#/definitions/xml"},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},fileSchema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["type"],properties:{format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},type:{type:"string",enum:["file"]},readOnly:{type:"boolean",default:!1},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},primitivesItems:{type:"object",additionalProperties:!1,properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},security:{type:"array",items:{$ref:"#/definitions/securityRequirement"},uniqueItems:!0},securityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"},uniqueItems:!0}},xml:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},tag:{type:"object",additionalProperties:!1,required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/externalDocs"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},securityDefinitions:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuthenticationSecurity"},{$ref:"#/definitions/apiKeySecurity"},{$ref:"#/definitions/oauth2ImplicitSecurity"},{$ref:"#/definitions/oauth2PasswordSecurity"},{$ref:"#/definitions/oauth2ApplicationSecurity"},{$ref:"#/definitions/oauth2AccessCodeSecurity"}]}},basicAuthenticationSecurity:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["basic"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},apiKeySecurity:{type:"object",additionalProperties:!1,required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ImplicitSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["implicit"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2PasswordSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["password"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ApplicationSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["application"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2AccessCodeSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["accessCode"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2Scopes:{type:"object",additionalProperties:{type:"string"}},mediaTypeList:{type:"array",items:{$ref:"#/definitions/mimeType"},uniqueItems:!0},parametersList:{type:"array",description:"The parameters needed to send a valid API call.",additionalItems:!1,items:{oneOf:[{$ref:"#/definitions/parameter"},{$ref:"#/definitions/jsonReference"}]},uniqueItems:!0},schemesList:{type:"array",description:"The transfer protocol of the API.",items:{type:"string",enum:["http","https","ws","wss"]},uniqueItems:!0},collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes"],default:"csv"},collectionFormatWithMulti:{type:"string",enum:["csv","ssv","tsv","pipes","multi"],default:"csv"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},jsonReference:{type:"object",required:["$ref"],additionalProperties:!1,properties:{$ref:{type:"string"}}}}}},{}],204:[function(e,t,r){t.exports={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}}},{}]},{},[2])(2)}); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;((t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SwaggerTools||(t.SwaggerTools={})).specs=e()}}(function(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[a]={exports:{}};t[a][0].call(f.exports,function(e){var r=t[a][1][e];return i(r||e)},f,f.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a1?"s are":" is")+" invalid:"),n.each(t.getLastErrors(),function(e){console.error(" "+(n.isArray(e.path)?i.pathToPtr(e.path):e.path)+": "+e.message)}),new Error("Unable to create validator due to invalid JSON Schema");return t},t.exports.formatResults=function(e){return e&&(e=e.errors.length+e.warnings.length+n.reduce(e.apiDeclarations,function(e,t){return t&&(e+=t.errors.length+t.warnings.length),e},0)>0?e:void 0),e};var f=t.exports.getErrorCount=function(e){var t=0;return e&&(t=e.errors.length,n.each(e.apiDeclarations,function(e){e&&(t+=e.errors.length)})),t},l=function(e){return e&&!n.isString(e)&&-1===(e=e.toString()).indexOf(".")&&(e+=".0"),e};t.exports.getSpec=function(t,r){var i;if(t=l(t),i=c[t],n.isUndefined(i))switch(t){case"1.2":i=e("../lib/specs").v1_2;break;case"2.0":i=e("../lib/specs").v2_0;break;default:if(!0===r)throw new Error("Unsupported Swagger version: "+t)}return i},t.exports.getSwaggerVersion=function(e){return n.isPlainObject(e)?l(e.swaggerVersion||e.swagger):void 0},t.exports.printValidationResults=function(e,t,r,o,a){var s=f(o)>0?console.error:console.log,u=function(e,t){return 1===t?e:e+"s"},c=function(e,t,r){e&&(s(e+":"),s()),n.each(t,function(e){s(new Array(r+1).join(" ")+i.pathToPtr(e.path)+": "+e.message),e.inner&&c(void 0,e.inner,r+2)}),e&&s()},l=0,p=0;s(),o.errors.length>0&&(l+=o.errors.length,c("API Errors",o.errors,2)),o.warnings.length>0&&(p+=o.warnings.length,c("API Warnings",o.warnings,2)),o.apiDeclarations&&o.apiDeclarations.forEach(function(e,t){if(e){var n=r[t].resourcePath||t;e.errors.length>0&&(l+=e.errors.length,c(" API Declaration ("+n+") Errors",e.errors,4)),e.warnings.length>0&&(p+=e.warnings.length,c(" API Declaration ("+n+") Warnings",e.warnings,4))}}),a&&s(l>0?l+" "+u("error",l)+" and "+p+" "+u("warning",p):"Validation succeeded but with "+p+" "+u("warning",p)),s()},t.exports.swaggerOperationMethods=["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":205,"json-refs":57,lodash:87,traverse:106,"z-schema":190}],2:[function(e,t,r){(function(r){"use strict";var n=e("lodash"),i=e("async"),o=e("./helpers"),a=e("json-refs"),s=e("spark-md5"),u=e("swagger-converter"),c=e("traverse"),f=e("./validators"),l=e("js-yaml");n.isPlainObject(u)&&(u=r.SwaggerConverter.convert);var p={},d=function(e,t){return"1.2"!==e?t:t.replace("#/models/","")},h=function(e){var t=n.cloneDeep(e);return t.$ref="#/models/"+e.$ref,t},m=n.map(o.swaggerOperationMethods,function(e){return e.toLowerCase()}),y=function(e){return["relative","remote"].indexOf(e.type)>-1},g=function(e,t,r,n){n.push({code:e,message:t,path:r})},v=function(e,t,r,i,s){var u,c,f,l,p,d,h=!0,m=o.getSwaggerVersion(e.resolved),y=n.isArray(t)?t:a.pathFromPtr(t),v=n.isArray(t)?a.pathToPtr(t):t,_=n.isArray(r)?r:a.pathFromPtr(r),b=n.isArray(r)?a.pathToPtr(r):r;if(c=e.definitions[v],d=y[0],u="securityDefinitions"===d?"SECURITY_DEFINITION":d.substring(0,d.length-1).toUpperCase(),f="1.2"===m?y[y.length-1]:v,p="securityDefinitions"===d?"Security definition":u.charAt(0)+u.substring(1).toLowerCase(),["authorizations","securityDefinitions"].indexOf(y[0])>-1&&"scopes"===y[2]&&(u+="_SCOPE",p+=" scope"),n.isUndefined(c)&&-1===["AUTHORIZATION_SCOPE","SECURITY_DEFINITION_SCOPE"].indexOf(u))for(l=1;l0&&(r.allOf=[],n.each(s.lineage,function(t){r.allOf.push(_(e,t))})),delete r.subTypes,n.each(r.properties,function(t,r){var o=i.properties[r];n.each(["maximum","minimum"],function(e){n.isString(t[e])&&(t[e]=parseFloat(t[e]))}),n.each(a.findRefs(o,{includeInvalid:!0,refPreProcessor:h}),function(r,n){var i=e.definitions[r.uri],o=a.pathFromPtr(n);i.lineage.length>0?c(t).set(o,_(e,r.uri)):c(t).set(o.concat("title"),"Composed "+d(e.swaggerVersion,r.uri))})})),r=c(r).map(function(e){"id"===this.key&&n.isString(e)&&this.remove()}),r.title=o,r},b=function(e,t,r,n,i){g("UNUSED_"+t,r+" is defined but is not used: "+e,n,i)},E=function(e){var t=s.hash(JSON.stringify(e)),r=p[t]||n.find(p,function(e){return e.resolvedId===t});return r||(r=p[t]={definitions:{},original:e,resolved:void 0,swaggerVersion:o.getSwaggerVersion(e)}),r},w=function(e,t){var r=new Error("The Swagger document(s) are invalid");r.errors=e.errors,r.failedValidation=!0,r.warnings=e.warnings,e.apiDeclarations&&(r.apiDeclarations=e.apiDeclarations),t(r)},x=function(e){var t=e.match(/\{(.*?)\}/g),r=[],i=e;return t&&n.each(t,function(e,t){i=i.replace(e,"{"+t+"}"),r.push(e.replace(/[{}]/g,""))}),{path:i,args:r}},O=function(e,t,r,i,o,a){!n.isUndefined(e)&&e.indexOf(t)>-1&&g("DUPLICATE_"+r,i+" already defined: "+t,o,a)},j=function(e,t,r,n,i){try{f.validateSchemaConstraints(e.swaggerVersion,t,r,void 0)}catch(e){i||g(e.code,e.message,e.path,n.errors)}},A=function(e,t){var r=e.swaggerVersion,i=function(t,r){var n=a.pathToPtr(t),i=e.definitions[n];return i||(i=e.definitions[n]={inline:r||!1,references:[]},["definitions","models"].indexOf(a.pathFromPtr(n)[0])>-1&&(i.cyclical=!1,i.lineage=void 0,i.parents=[])),i},o=function(e){return"1.2"===r?a.pathFromPtr(e).pop():e},s={filter:"local",includeInvalid:!0},u=function(t,r,i){var o=e.definitions[r||t];o&&n.each(o.parents,function(e){i.push(e),t!==e&&u(t,e,i)})},f="1.2"===r?"authorizations":"securityDefinitions",l="1.2"===r?"models":"definitions";switch(n.each(e.resolved[f],function(e,o){var a=[f,o];("1.2"!==r||e.type)&&(i(a),n.reduce(e.scopes,function(e,n,o){var s="1.2"===r?n.scope:o,u=a.concat(["scopes",o.toString()]);return i(a.concat(["scopes",s])).scopePath=u,O(e,s,"AUTHORIZATION_SCOPE_DEFINITION","Authorization scope definition","1.2"===r?u.concat("scope"):u,t.warnings),e.push(s),e},[]))}),n.each(e.resolved[l],function(o,s){var u=[l,s],f=i(u);if("1.2"===r&&s!==o.id&&g("MODEL_ID_MISMATCH","Model id does not match id in models object: "+o.id,u.concat("id"),t.errors),n.isUndefined(f.lineage))switch(r){case"1.2":n.each(o.subTypes,function(r,n){var o=["models",r],s=a.pathToPtr(o),c=e.definitions[s],f=u.concat(["subTypes",n.toString()]);!c&&e.resolved[l][r]&&(c=i(o)),v(e,o,f,t)&&c.parents.push(a.pathToPtr(u))});break;default:n.each(e.original[l][s].allOf,function(t,r){var o,s=!1;n.isUndefined(t.$ref)||y(a.getRefDetails(t))?(s=!0,o=u.concat(["allOf",r.toString()])):o=a.pathFromPtr(t.$ref),n.isUndefined(c(e.resolved).get(o))||(i(o,s),f.parents.push(a.pathToPtr(o)))})}}),r){case"2.0":n.each(e.resolved.parameters,function(r,n){var o=["parameters",n];i(o),j(e,r,o,t)}),n.each(e.resolved.responses,function(r,n){var o=["responses",n];i(o),j(e,r,o,t)})}n.each(e.definitions,function(i,s){var f,l,p,d=a.pathFromPtr(s),h=c(e.original).get(d),m=d[0],y=m.substring(0,m.length-1).toUpperCase(),v=y.charAt(0)+y.substring(1).toLowerCase();-1!==["definitions","models"].indexOf(m)&&(f=[],l=[],p=i.lineage,n.isUndefined(p)&&(u(s,void 0,p=[]),p.reverse(),i.lineage=n.cloneDeep(p),i.cyclical=p.length>1&&p[0]===s),i.parents.length>1&&"1.2"===r&&g("MULTIPLE_"+y+"_INHERITANCE","Child "+y.toLowerCase()+" is sub type of multiple models: "+n.map(i.parents,function(e){return o(e)}).join(" && "),d,t.errors),i.cyclical&&g("CYCLICAL_"+y+"_INHERITANCE",v+" has a circular inheritance: "+n.map(p,function(e){return o(e)}).join(" -> ")+" -> "+o(s),d.concat("1.2"===r?"subTypes":"allOf"),t.errors),n.each(p.slice(i.cyclical?1:0),function(t){var r=c(e.resolved).get(a.pathFromPtr(t));n.each(Object.keys(r.properties||{}),function(e){-1===l.indexOf(e)&&l.push(e)})}),j(e,h,d,t),n.each(h.properties,function(r,i){var o=d.concat(["properties",i]);n.isUndefined(r)||(j(e,r,o,t),l.indexOf(i)>-1?g("CHILD_"+y+"_REDECLARES_PROPERTY","Child "+y.toLowerCase()+" declares property already declared by ancestor: "+i,o,t.errors):f.push(i))}),n.each(h.required||[],function(e,n){var i="1.2"===r?"Model":"Definition";-1===l.indexOf(e)&&-1===f.indexOf(e)&&g("MISSING_REQUIRED_"+i.toUpperCase()+"_PROPERTY",i+" requires property but it is not defined: "+e,d.concat(["required",n.toString()]),t.errors)}))}),"1.2"===e.swaggerVersion&&(s.refPreProcessor=h),n.each(a.findRefs(e.original,s),function(r,n){v(e,r.uri,n,t)}),n.each(e.referencesMetadata,function(r,n){y(r)&&!0===r.missing&&t.errors.push({code:"UNRESOLVABLE_REFERENCE",message:"Reference could not be resolved: "+d(e.swaggerVersion,r.uri),path:a.pathFromPtr(n).concat("$ref")})})},S=function(e,t,r,i){var o="1.2"===e.swaggerVersion?"AUTHORIZATION":"SECURITY_DEFINITION",a="AUTHORIZATION"===o?"Authorization":"Security definition";"1.2"===e.swaggerVersion?n.reduce(t,function(t,s,u){var c=["authorizations",u],f=r.concat([u]);return v(e,c,f,i)&&n.reduce(s,function(t,r,n){var s=f.concat(n.toString(),"scope"),u=c.concat(["scopes",r.scope]);return O(t,r.scope,o+"_SCOPE_REFERENCE",a+" scope reference",s,i.warnings),v(e,u,s,i),t.concat(r.scope)},[]),t.concat(u)},[]):n.reduce(t,function(t,s,u){return n.each(s,function(s,c){var f=["securityDefinitions",c],l=r.concat(u.toString(),c);O(t,c,o+"_REFERENCE",a+" reference",l,i.warnings),t.push(c),v(e,f,l,i)&&n.each(s,function(t,r){var n=f.concat(["scopes",t]);v(e,n,l.concat(r.toString()),i)})}),t},[])},I=function(e,t){var r=E(e),i=o.getSwaggerVersion(e),u={includeInvalid:!0,loaderOptions:{processContent:function(e,t){t(void 0,l.safeLoad(e.text))}}};r.resolved?t():("1.2"===i&&(u.refPreProcessor=h),a.resolveRefs(e,u).then(function(e){!function(e){function t(r,i,o){function a(e,n){o.push(n),t(r,e,o),o.pop()}-1===r.indexOf(i)?(r.push(i),n.isArray(i)?n.each(i,function(e,t){a(e,t.toString())}):n.isPlainObject(i)&&n.forOwn(i,function(e,t){a(e,t.toString())})):n.set(e,o,{}),r.pop()}t([],e,[])}(e.resolved),n.each(e.refs,function(t,r){t.circular&&n.set(e.resolved,a.pathFromPtr(r),{})}),r.referencesMetadata=e.refs,r.resolved=e.resolved,r.resolvedId=s.hash(JSON.stringify(e.resolved)),t()}).catch(t))},P=function(e,t,r,i){var a=n.isString(t)?e.validators[t]:o.createJsonValidator();o.registerCustomFormats(r);try{f.validateAgainstSchema(t,r,a)}catch(e){return e.failedValidation?i(void 0,e.results):i(e)}I(r,function(e){return i(e)})},T=function(e,t){n.each(e.definitions,function(r,n){var i=a.pathFromPtr(n),o=i[0].substring(0,i[0].length-1),s="1.2"===e.swaggerVersion?i[i.length-1]:n,u="securityDefinition"===o?"SECURITY_DEFINITION":o.toUpperCase(),c="securityDefinition"===o?"Security definition":o.charAt(0).toUpperCase()+o.substring(1);0!==r.references.length||r.inline||(r.scopePath&&(u+="_SCOPE",c+=" scope",i=r.scopePath),b(s,u,c,i,t.warnings))})},$=function(e,t,r,i,o,a,s){var u=function(t){g("INVALID_PARAMETER_COMBINATION","API cannot have a a body parameter and a "+("1.2"===e.version?"form":"formData")+" parameter",t,a.errors)},c=[],f=!1,l=!1;n.reduce(i,function(i,s,p){var d=o.concat(["parameters",p.toString()]);if(!n.isUndefined(s))return O(i,s.name,"PARAMETER","Parameter",d.concat("name"),a.errors),"body"===s.paramType||"body"===s.in?(!0===f?g("DUPLICATE_API_BODY_PARAMETER","API has more than one body parameter",d,a.errors):!0===l&&u(d),f=!0):"form"===s.paramType||"formData"===s.in?(!0===f&&u(d),l=!0):"path"!==s.paramType&&"path"!==s.in||(-1===r.args.indexOf(s.name)&&g("UNRESOLVABLE_API_PATH_PARAMETER","API path parameter could not be resolved: "+s.name,d.concat("name"),a.errors),c.push(s.name)),-1===e.primitives.indexOf(s.type)&&"1.2"===e.version&&v(t,"#/models/"+s.type,d.concat("type"),a),j(t,s,d,a,s.skipErrors),i.concat(s.name)},[]),(n.isUndefined(s)||!1===s)&&n.each(n.difference(r.args,c),function(e){g("MISSING_API_PATH_PARAMETER","API requires path parameter but it is not defined: "+e,"1.2"===t.swaggerVersion?o.slice(0,2).concat("path"):o,a.errors)})},C=function(e,t,r,i){var o=[],a=E(t),s=[],u={errors:[],warnings:[],apiDeclarations:[]};s=n.reduce(t.apis,function(e,t,r){return O(e,t.path,"RESOURCE_PATH","Resource path",["apis",r.toString(),"path"],u.errors),e.push(t.path),e},[]),A(a,u),o=n.reduce(r,function(t,r,i){var c=u.apiDeclarations[i]={errors:[],warnings:[]},f=E(r);return O(t,r.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],c.errors),-1===o.indexOf(r.resourcePath)&&(!function(e,t,r,i,o,a){n.isUndefined(e)||-1!==e.indexOf(t)||g("UNRESOLVABLE_"+r,i+" could not be resolved: "+t,o,a)}(s,r.resourcePath,"RESOURCE_PATH","Resource path",["resourcePath"],c.errors),t.push(r.resourcePath)),A(f,c),n.reduce(r.apis,function(t,r,i){var o=["apis",i.toString()],s=x(r.path);return t.indexOf(s.path)>-1?g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+r.path,o.concat("path"),c.errors):t.push(s.path),n.reduce(r.operations,function(t,r,i){var u=o.concat(["operations",i.toString()]);return O(t,r.method,"OPERATION_METHOD","Operation method",u.concat("method"),c.errors),t.push(r.method),-1===e.primitives.indexOf(r.type)&&"1.2"===e.version&&v(f,"#/models/"+r.type,u.concat("type"),c),S(a,r.authorizations,u.concat("authorizations"),c),j(f,r,u,c),$(e,f,s,r.parameters,u,c),n.reduce(r.responseMessages,function(e,t,r){var n=u.concat(["responseMessages",r.toString()]);return O(e,t.code,"RESPONSE_MESSAGE_CODE","Response message code",n.concat(["code"]),c.errors),t.responseModel&&v(f,"#/models/"+t.responseModel,n.concat("responseModel"),c),e.concat(t.code)},[]),t},[]),t},[]),T(f,c),t},[]),T(a,u),n.each(n.difference(s,o),function(e){var r=s.indexOf(e);b(t.apis[r].path,"RESOURCE_PATH","Resource path",["apis",r.toString(),"path"],u.errors)}),i(void 0,u)},R=function(e,t,r,i){var a=function(e,t){i(e,o.formatResults(t))};"1.2"===e.version?C(e,t,r,a):function(e,t,r){var i=E(t),o={errors:[],warnings:[]};A(i,o),S(i,t.security,["security"],o),n.reduce(i.resolved.paths,function(t,r,a){var s=["paths",a],u=x(a);return t.indexOf(u.path)>-1&&g("DUPLICATE_API_PATH","API path (or equivalent) already defined: "+a,s,o.errors),$(e,i,u,r.parameters,s,o,!0),n.each(r,function(t,a){var c=[],f=s.concat(a),l=[];-1!==m.indexOf(a)&&(S(i,t.security,f.concat("security"),o),n.each(t.parameters,function(e){n.isUndefined(e)||(c.push(e),l.push(e.name+":"+e.in))}),n.each(r.parameters,function(e){var t=n.cloneDeep(e);t.skipErrors=!0,-1===l.indexOf(e.name+":"+e.in)&&c.push(t)}),$(e,i,u,c,f,o),n.each(t.responses,function(e,t){n.isUndefined(e)||j(i,e,f.concat("responses",t),o)}))}),t.concat(u.path)},[]),T(i,o),r(void 0,o)}(e,t,a)},D=function(t){var r=this,i=function(e,t){return n.reduce(t,function(e,t,r){return e[r]=o.createJsonValidator(t),e},{})},a=function(e){var t=n.cloneDeep(r.schemas[e]);return t.id=e,t},s=["string","number","boolean","integer","array"];switch(t){case"1.2":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md",this.primitives=n.union(s,["void","File"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2",this.schemas={"apiDeclaration.json":e("../schemas/1.2/apiDeclaration.json"),"authorizationObject.json":e("../schemas/1.2/authorizationObject.json"),"dataType.json":e("../schemas/1.2/dataType.json"),"dataTypeBase.json":e("../schemas/1.2/dataTypeBase.json"),"infoObject.json":e("../schemas/1.2/infoObject.json"),"modelsObject.json":e("../schemas/1.2/modelsObject.json"),"oauth2GrantType.json":e("../schemas/1.2/oauth2GrantType.json"),"operationObject.json":e("../schemas/1.2/operationObject.json"),"parameterObject.json":e("../schemas/1.2/parameterObject.json"),"resourceListing.json":e("../schemas/1.2/resourceListing.json"),"resourceObject.json":e("../schemas/1.2/resourceObject.json")},this.validators=i(0,{"apiDeclaration.json":n.map(["dataTypeBase.json","modelsObject.json","oauth2GrantType.json","authorizationObject.json","parameterObject.json","operationObject.json","apiDeclaration.json"],a),"resourceListing.json":n.map(["resourceObject.json","infoObject.json","oauth2GrantType.json","authorizationObject.json","resourceListing.json"],a)});break;case"2.0":this.docsUrl="https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md",this.primitives=n.union(s,["file"]),this.schemasUrl="https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0",this.schemas={"schema.json":e("../schemas/2.0/schema.json")},this.validators=i(0,{"schema.json":[a("schema.json")]});break;default:throw new Error(t+" is an unsupported Swagger specification version")}this.version=t};D.prototype.validate=function(e,t,r){switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("resourceListing is required");if(!n.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(n.isUndefined(t))throw new Error("apiDeclarations is required");if(!n.isArray(t))throw new TypeError("apiDeclarations must be an array");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object")}if("2.0"===this.version&&(r=arguments[1]),n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");"2.0"===this.version&&(t=[]);var a=this;!function(e,t,r,o){P(e,"1.2"===e.version?"resourceListing.json":"schema.json",t,function(t,a){if(t)return o(t);a||"1.2"!==e.version?o(void 0,a):(a={errors:[],warnings:[],apiDeclarations:[]},i.map(r,function(t,r){P(e,"apiDeclaration.json",t,r)},function(e,t){if(e)return o(e);n.each(t,function(e,t){a.apiDeclarations[t]=e}),o(void 0,a)}))})}(this,e,t,function(n,i){n||o.formatResults(i)?r(n,i):R(a,e,t,r)})},D.prototype.composeModel=function(e,t,r){var i=o.getSwaggerVersion(e),a=function(n,i){var a;return n?r(n):o.getErrorCount(i)>0?w(i,r):(a=E(e),i={errors:[],warnings:[]},A(a,i),a.definitions[t]?o.getErrorCount(i)>0?w(i,r):void r(void 0,_(a,t)):r())};switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("apiDeclaration is required");if(!n.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(n.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(n.isUndefined(t))throw new Error("modelRef is required")}if(n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");if("#"!==t.charAt(0)){if("1.2"!==this.version)throw new Error("modelRef must be a JSON Pointer");t="#/models/"+t}"1.2"===i?P(this,"apiDeclaration.json",e,a):this.validate(e,a)},D.prototype.validateModel=function(e,t,r,i){switch(this.version){case"1.2":if(n.isUndefined(e))throw new Error("apiDeclaration is required");if(!n.isPlainObject(e))throw new TypeError("apiDeclaration must be an object");if(n.isUndefined(t))throw new Error("modelId is required");break;case"2.0":if(n.isUndefined(e))throw new Error("swaggerObject is required");if(!n.isPlainObject(e))throw new TypeError("swaggerObject must be an object");if(n.isUndefined(t))throw new Error("modelRef is required")}if(n.isUndefined(r))throw new Error("data is required");if(n.isUndefined(i))throw new Error("callback is required");if(!n.isFunction(i))throw new TypeError("callback must be a function");var o=this;this.composeModel(e,t,function(e,t){if(e)return i(e);P(o,t,r,i)})},D.prototype.resolve=function(e,t,r){var i,s=function(e){return n.isString(t)?r(void 0,c(e).get(a.pathFromPtr(t))):r(void 0,e)};if(n.isUndefined(e))throw new Error("document is required");if(!n.isPlainObject(e))throw new TypeError("document must be an object");if(2===arguments.length&&(r=arguments[1],t=void 0),!n.isUndefined(t)&&!n.isString(t))throw new TypeError("ptr must be a JSON Pointer string");if(n.isUndefined(r))throw new Error("callback is required");if(!n.isFunction(r))throw new TypeError("callback must be a function");if("1.2"===(i=E(e)).swaggerVersion)throw new Error("Swagger 1.2 is not supported");if(i.resolved)return s(i.resolved);this.validate(e,function(e,t){return e?r(e):o.getErrorCount(t)>0?w(t,r):s(i.resolved)})},D.prototype.convert=function(e,t,r,i){var a=function(e,t){i(void 0,u(e,t))};if("1.2"!==this.version)throw new Error("Specification#convert only works for Swagger 1.2");if(n.isUndefined(e))throw new Error("resourceListing is required");if(!n.isPlainObject(e))throw new TypeError("resourceListing must be an object");if(n.isUndefined(t)&&(t=[]),!n.isArray(t))throw new TypeError("apiDeclarations must be an array");if(arguments.length<4&&(i=arguments[arguments.length-1]),n.isUndefined(i))throw new Error("callback is required");if(!n.isFunction(i))throw new TypeError("callback must be a function");!0===r?a(e,t):this.validate(e,t,function(r,n){return r?i(r):o.getErrorCount(n)>0?w(n,i):void a(e,t)})},t.exports.v1=t.exports.v1_2=new D("1.2"),t.exports.v2=t.exports.v2_0=new D("2.0")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../schemas/1.2/apiDeclaration.json":193,"../schemas/1.2/authorizationObject.json":194,"../schemas/1.2/dataType.json":195,"../schemas/1.2/dataTypeBase.json":196,"../schemas/1.2/infoObject.json":197,"../schemas/1.2/modelsObject.json":198,"../schemas/1.2/oauth2GrantType.json":199,"../schemas/1.2/operationObject.json":200,"../schemas/1.2/parameterObject.json":201,"../schemas/1.2/resourceListing.json":202,"../schemas/1.2/resourceObject.json":203,"../schemas/2.0/schema.json":204,"./helpers":1,"./validators":3,async:4,"js-yaml":27,"json-refs":57,lodash:87,"spark-md5":98,"swagger-converter":105,traverse:106}],3:[function(e,t,r){"use strict";var n=e("lodash"),i=e("./helpers"),o=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/,a=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}):([0-9]{2}))$/,s=t.exports.isValidDate=function(e){var t,r,i;return!!n.isDate(e)||(n.isString(e)||(e=e.toString()),null!==(r=o.exec(e))&&(t=r[3],!((i=r[2])<"01"||i>"12"||t<"01"||t>"31")))},u=t.exports.isValidDateTime=function(e){var t,r,i,o,u,c,f,l,p;if(n.isDate(e))return!0;if(n.isString(e)||(e=e.toString()),c=e.toLowerCase().split("t"),r=c[0],i=c.length>1?c[1]:void 0,!s(r))return!1;if(null===(o=a.exec(i)))return!1;t=o[1],u=o[2],f=o[3],"z"===o[5]?(l=0,p=0):(l=Number(o[6]),p=Number(o[7]));return!(t>"23"||u>"59"||f>"59"||l>14||l<-12||0!==p&&15!==p&&30!==p&&45!==p)},c=function(e,t){var r=new Error(t);throw r.code=e,r.failedValidation=!0,r};t.exports.validateAgainstSchema=function(e,t,r){var o=function(e){var t=["additionalProperties","items"].indexOf(e.path[e.path.length-1])>-1?"schema":e.path[e.path.length-2];if(["ANY_OF_MISSING","ONE_OF_MISSING"].indexOf(e.code)>-1){switch(t){case"parameters":t="parameter";break;case"responses":t="response";break;case"schema":t+=" "+e.path[e.path.length-1]}e.message="Not a valid "+t+" definition"}delete e.params,delete e.schemaId,e.inner&&n.each(e.inner,function(e){o(e)})},a=n.isPlainObject(e)?n.cloneDeep(e):e;n.isUndefined(r)&&(r=i.createJsonValidator([a]));if(!r.validate(t,a))try{c("SCHEMA_VALIDATION_FAILED","Failed schema validation")}catch(e){throw e.results={errors:n.map(r.getLastErrors(),function(e){return o(e),e}),warnings:[]},e}};var f=t.exports.validateArrayType=function(e){"array"===e.type&&n.isUndefined(e.items)&&c("OBJECT_MISSING_REQUIRED_PROPERTY","Missing required property: items")};t.exports.validateContentType=function(e,t,r){var i="function"==typeof r.end,o=i?r.getHeader("content-type"):r.headers["content-type"],a=n.map(n.union(e,t),function(e){return e.split(";")[0]});if(o||(o=i?"text/plain":"application/octet-stream"),o=o.split(";")[0],a.length>0&&(i||-1!==["POST","PUT"].indexOf(r.method))&&-1===a.indexOf(o))throw new Error("Invalid content type ("+o+"). These are valid: "+a.join(", "))};var l=t.exports.validateEnum=function(e,t){n.isUndefined(t)||n.isUndefined(e)||-1!==t.indexOf(e)||c("ENUM_MISMATCH","Not an allowable value ("+t.join(", ")+"): "+e)},p=t.exports.validateMaximum=function(e,t,r,i){var o,a,s=!0===i?"MAXIMUM_EXCLUSIVE":"MAXIMUM";n.isUndefined(i)&&(i=!1),"integer"===r?a=parseInt(e,10):"number"===r&&(a=parseFloat(e)),n.isUndefined(t)||(o=parseFloat(t),i&&a>=o?c(s,"Greater than or equal to the configured maximum ("+t+"): "+e):a>o&&c(s,"Greater than the configured maximum ("+t+"): "+e))},d=t.exports.validateMaxItems=function(e,t){!n.isUndefined(t)&&e.length>t&&c("ARRAY_LENGTH_LONG","Array is too long ("+e.length+"), maximum "+t)},h=t.exports.validateMaxLength=function(e,t){!n.isUndefined(t)&&e.length>t&&c("MAX_LENGTH","String is too long ("+e.length+" chars), maximum "+t)},m=t.exports.validateMaxProperties=function(e,t){var r=n.isPlainObject(e)?Object.keys(e).length:0;!n.isUndefined(t)&&r>t&&c("MAX_PROPERTIES","Number of properties is too many ("+r+" properties), maximum "+t)},y=t.exports.validateMinimum=function(e,t,r,i){var o,a,s=!0===i?"MINIMUM_EXCLUSIVE":"MINIMUM";n.isUndefined(i)&&(i=!1),"integer"===r?a=parseInt(e,10):"number"===r&&(a=parseFloat(e)),n.isUndefined(t)||(o=parseFloat(t),i&&a<=o?c(s,"Less than or equal to the configured minimum ("+t+"): "+e):a-1&&e%1==0&&e<=it}function y(e){return null!=e&&m(e.length)&&!function(e){if(!o(e))return!1;var t=h(e);return t==tt||t==rt||t==et||t==nt}(e)}function g(){}function v(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}function _(e){return null!=e&&"object"==typeof e}function b(e){return _(e)&&h(e)==ut}function E(e,t){return!!(t=null==t?vt:t)&&("number"==typeof e||_t.test(e))&&e>-1&&e%1==0&&e=n?e:function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n-1;);return r}(n,i),function(e,t){for(var r=e.length;r--&&U(t,e[r],0)>-1;);return r}(n,i)+1).join("")}function z(e,t){var r={};k(e,function(e,t){function n(t,r){var n=F(i,function(e){return t[e]});n.push(r),p(e).apply(null,n)}var i,o=l(e),a=!o&&1===e.length||o&&0===e.length;if(dt(e))i=e.slice(0,-1),e=e[e.length-1],r[t]=i.concat(i.length>0?n:e);else if(a)r[t]=e;else{if(i=function(e){return e=e.toString().replace(ar,""),e=e.match(nr)[2].replace(" ",""),e=e?e.split(ir):[],e=e.map(function(e){return B(e.replace(or,""))})}(e),0===e.length&&!o&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");o||i.pop(),r[t]=i.concat(n)}}),Nt(r,t)}function Y(){this.head=this.tail=null,this.length=0}function W(e,t){e.length=1,e.head=e.tail=t}function V(e,t,r){function n(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(f.started=!0,dt(e)||(e=[e]),0===e.length&&f.idle())return Le(function(){f.drain()});for(var n=0,i=e.length;n0&&s.splice(o,1),i.callback.apply(i,arguments),null!=t&&f.error(t,i.data)}a<=f.concurrency-f.buffer&&f.unsaturated(),f.idle()&&f.drain(),f.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var o=p(e),a=0,s=[],u=!1,c=!1,f={_tasks:new Y,concurrency:t,payload:r,saturated:g,unsaturated:g,buffer:t/4,empty:g,drain:g,error:g,started:!1,paused:!1,push:function(e,t){n(e,!1,t)},kill:function(){f.drain=g,f._tasks.empty()},unshift:function(e,t){n(e,!0,t)},remove:function(e){f._tasks.remove(e)},process:function(){if(!c){for(c=!0;!f.paused&&a2&&(o=i(arguments,1)),n[t]=o,r(e)})},function(e){r(e,n)})}function ve(e,t){ge(Ct,e,t)}function _e(e,t,r){ge(S(t),e,r)}function be(e,t){if(t=v(t||g),!dt(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;rn?1:0}var i=p(t);Rt(e,function(e,t){i(e,function(r,n){if(r)return t(r);t(null,{value:e,criteria:n})})},function(e,t){if(e)return r(e);r(null,F(t.sort(n),ce("value")))})}function Pe(e,t,r){var n=p(e);return Ue(function(i,o){var a,s=!1;i.push(function(){s||(o.apply(null,arguments),clearTimeout(a))}),a=setTimeout(function(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,o(n)},t),n.apply(null,i)})}function Te(e,t,r,n){var i=p(r);kt(function(e,t,r,n){for(var i=-1,o=Br(qr((t-e)/(r||1)),0),a=Array(o);o--;)a[n?o:++i]=e,e+=r;return a}(0,e,1),t,i,n)}function $e(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=dt(e)?[]:{}),n=v(n||g);var i=p(r);Ct(e,function(e,r,n){i(t,e,r,n)},function(e){n(e,t)})}function Ce(e,t){var r,n=null;t=t||g,vr(e,function(e,t){p(e)(function(e,o){r=arguments.length>2?i(arguments,1):o,n=e,t(!e)})},function(){t(n,r)})}function Re(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function De(e,t,r){r=A(r||g);var n=p(t);if(!e())return r(null);var o=function(t){if(t)return r(t);if(e())return n(o);var a=i(arguments,1);r.apply(null,[null].concat(a))};n(o)}function ke(e,t,r){De(function(){return!e.apply(this,arguments)},t,r)}var Me=function(e){var t=i(arguments,1);return function(){var r=i(arguments);return e.apply(null,t.concat(r))}},Ue=function(e){return function(){var t=i(arguments),r=t.pop();e.call(this,t,r)}},Fe="function"==typeof setImmediate&&setImmediate,Ne="object"==typeof e&&"function"==typeof e.nextTick,Le=s(Fe?setImmediate:Ne?e.nextTick:a),qe="function"==typeof Symbol,Be="object"==typeof n&&n&&n.Object===Object&&n,ze="object"==typeof self&&self&&self.Object===Object&&self,Ye=Be||ze||Function("return this")(),We=Ye.Symbol,Ve=Object.prototype,He=Ve.hasOwnProperty,Ke=Ve.toString,Ge=We?We.toStringTag:void 0,Ze=Object.prototype.toString,Xe="[object Null]",Je="[object Undefined]",Qe=We?We.toStringTag:void 0,et="[object AsyncFunction]",tt="[object Function]",rt="[object GeneratorFunction]",nt="[object Proxy]",it=9007199254740991,ot={},at="function"==typeof Symbol&&Symbol.iterator,st=function(e){return at&&e[at]&&e[at]()},ut="[object Arguments]",ct=Object.prototype,ft=ct.hasOwnProperty,lt=ct.propertyIsEnumerable,pt=b(function(){return arguments}())?b:function(e){return _(e)&&ft.call(e,"callee")&&!lt.call(e,"callee")},dt=Array.isArray,ht="object"==typeof r&&r&&!r.nodeType&&r,mt=ht&&"object"==typeof t&&t&&!t.nodeType&&t,yt=mt&&mt.exports===ht?Ye.Buffer:void 0,gt=(yt?yt.isBuffer:void 0)||function(){return!1},vt=9007199254740991,_t=/^(?:0|[1-9]\d*)$/,bt={};bt["[object Float32Array]"]=bt["[object Float64Array]"]=bt["[object Int8Array]"]=bt["[object Int16Array]"]=bt["[object Int32Array]"]=bt["[object Uint8Array]"]=bt["[object Uint8ClampedArray]"]=bt["[object Uint16Array]"]=bt["[object Uint32Array]"]=!0,bt["[object Arguments]"]=bt["[object Array]"]=bt["[object ArrayBuffer]"]=bt["[object Boolean]"]=bt["[object DataView]"]=bt["[object Date]"]=bt["[object Error]"]=bt["[object Function]"]=bt["[object Map]"]=bt["[object Number]"]=bt["[object Object]"]=bt["[object RegExp]"]=bt["[object Set]"]=bt["[object String]"]=bt["[object WeakMap]"]=!1;var Et="object"==typeof r&&r&&!r.nodeType&&r,wt=Et&&"object"==typeof t&&t&&!t.nodeType&&t,xt=wt&&wt.exports===Et&&Be.process,Ot=function(){try{return xt&&xt.binding&&xt.binding("util")}catch(e){}}(),jt=Ot&&Ot.isTypedArray,At=jt?function(e){return function(t){return e(t)}}(jt):function(e){return _(e)&&m(e.length)&&!!bt[h(e)]},St=Object.prototype.hasOwnProperty,It=Object.prototype,Pt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Tt=Object.prototype.hasOwnProperty,$t=P(I,1/0),Ct=function(e,t,r){(y(e)?T:$t)(e,p(t),r)},Rt=$(C),Dt=d(Rt),kt=R(C),Mt=P(kt,1),Ut=d(Mt),Ft=function(e){return function(t,r,n){for(var i=-1,o=Object(t),a=n(t),s=a.length;s--;){var u=a[e?s:++i];if(!1===r(o[u],u,o))break}return t}}(),Nt=function(e,t,r){function n(e,t){l.push(function(){!function(e,t){if(c)return;var n=A(function(t,n){if(u--,arguments.length>2&&(n=i(arguments,1)),t){var a={};k(s,function(e,t){a[t]=e}),a[e]=n,c=!0,f=Object.create(null),r(t,a)}else s[e]=n,function(e){D(f[e]||[],function(e){e()}),o()}(e)});u++;var a=p(t[t.length-1]);t.length>1?a(s,n):a(n)}(e,t)})}function o(){if(0===l.length&&0===u)return r(null,s);for(;l.length&&u=0&&r.push(n)}),r}(d.pop()),function(e){0==--h[e]&&d.push(e)});if(t!==a)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),o()},Lt="[object Symbol]",qt=1/0,Bt=We?We.prototype:void 0,zt=Bt?Bt.toString:void 0,Yt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Wt="[\\ud800-\\udfff]",Vt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ht="\\ud83c[\\udffb-\\udfff]",Kt="[^\\ud800-\\udfff]",Gt="(?:\\ud83c[\\udde6-\\uddff]){2}",Zt="[\\ud800-\\udbff][\\udc00-\\udfff]",Xt="(?:"+Vt+"|"+Ht+")"+"?",Jt="[\\ufe0e\\ufe0f]?",Qt=Jt+Xt+("(?:\\u200d(?:"+[Kt,Gt,Zt].join("|")+")"+Jt+Xt+")*"),er="(?:"+[Kt+Vt+"?",Vt,Gt,Zt,Wt].join("|")+")",tr=RegExp(Ht+"(?="+Ht+")|"+er+Qt,"g"),rr=/^\s+|\s+$/g,nr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ir=/,/,or=/(=.+)?(\s*)$/,ar=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;Y.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},Y.prototype.empty=function(){for(;this.head;)this.shift();return this},Y.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},Y.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},Y.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):W(this,e)},Y.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):W(this,e)},Y.prototype.shift=function(){return this.head&&this.removeLink(this.head)},Y.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},Y.prototype.toArray=function(){for(var e=Array(this.length),t=this.head,r=0;r=i.priority;)i=i.next;for(var o=0,a=e.length;o1&&(n=r[0]+"@",e=r[1]);return n+o((e=e.replace(T,".")).split("."),t).join(".")}function s(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=D((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=D(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:b}function f(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function l(e,t,r){var n=0;for(e=r?R(e/O):e>>1,e+=R(e/t);e>C*w>>1;n+=b)e=R(e/C);return R(n+(C+1)*e/(e+x))}function p(e){var t,r,n,o,a,s,f,p,d,h,m=[],y=e.length,g=0,v=A,x=j;for((r=e.lastIndexOf(S))<0&&(r=0),n=0;n=128&&i("not-basic"),m.push(e.charCodeAt(n));for(o=r>0?r+1:0;o=y&&i("invalid-input"),((p=c(e.charCodeAt(o++)))>=b||p>R((_-g)/s))&&i("overflow"),g+=p*s,d=f<=x?E:f>=x+w?w:f-x,!(pR(_/(h=b-d))&&i("overflow"),s*=h;x=l(g-a,t=m.length+1,0==a),R(g/t)>_-v&&i("overflow"),v+=R(g/t),g%=t,m.splice(g++,0,v)}return u(m)}function d(e){var t,r,n,o,a,u,c,p,d,h,m,y,g,v,x,O=[];for(y=(e=s(e)).length,t=A,r=0,a=j,u=0;u=t&&mR((_-r)/(g=n+1))&&i("overflow"),r+=(c-t)*g,t=c,u=0;u_&&i("overflow"),m==t){for(p=r,d=b;h=d<=a?E:d>=a+w?w:d-a,!(p= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=b-E,R=Math.floor,D=String.fromCharCode;if(g={version:"1.4.1",ucs2:{decode:s,encode:u},decode:p,encode:d,toASCII:function(e){return a(e,function(e){return P.test(e)?"xn--"+d(e):e})},toUnicode:function(e){return a(e,function(e){return I.test(e)?p(e.slice(4).toLowerCase()):e})}},h&&m)if(t.exports==h)m.exports=g;else for(v in g)g.hasOwnProperty(v)&&(h[v]=g[v]);else n.punycode=g}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,r){function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}void 0!==t&&(t.exports=n),n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,i=0;i0&&(o=u.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)n(o).forEach(c);return s}(e,String(t),r||o,n||function(t){return e.outEdges(t)})};var o=n.constant(1)},{"../data/priority-queue":21,"../lodash":25}],12:[function(e,t,r){var n=e("../lodash"),i=e("./tarjan");t.exports=function(e){return n.filter(i(e),function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}},{"../lodash":25,"./tarjan":19}],13:[function(e,t,r){var n=e("../lodash");t.exports=function(e,t,r){return function(e,t,r){var n={},i=e.nodes();return i.forEach(function(e){n[e]={},n[e][e]={distance:0},i.forEach(function(t){e!==t&&(n[e][t]={distance:Number.POSITIVE_INFINITY})}),r(e).forEach(function(r){var i=r.v===e?r.w:r.v,o=t(r);n[e][i]={distance:o,predecessor:e}})}),i.forEach(function(e){var t=n[e];i.forEach(function(r){var o=n[r];i.forEach(function(r){var n=o[e],i=t[r],a=o[r],s=n.distance+i.distance;s0;){if(a=c.removeMin(),n.has(u,a))s.setEdge(a,u[a]);else{if(f)throw new Error("Input graph is not connected: "+e);f=!0}e.nodeEdges(a).forEach(r)}return s}},{"../data/priority-queue":21,"../graph":22,"../lodash":25}],19:[function(e,t,r){var n=e("../lodash");t.exports=function(e){function t(s){var u=o[s]={onStack:!0,lowlink:r,index:r++};if(i.push(s),e.successors(s).forEach(function(e){n.has(o,e)?o[e].onStack&&(u.lowlink=Math.min(u.lowlink,o[e].index)):(t(e),u.lowlink=Math.min(u.lowlink,o[e].lowlink))}),u.lowlink===u.index){var c,f=[];do{c=i.pop(),o[c].onStack=!1,f.push(c)}while(s!==c);a.push(f)}}var r=0,i=[],o={},a=[];return e.nodes().forEach(function(e){n.has(o,e)||t(e)}),a}},{"../lodash":25}],20:[function(e,t,r){function n(e){function t(s){if(o.has(n,s))throw new i;o.has(r,s)||(n[s]=!0,r[s]=!0,o.each(e.predecessors(s),t),delete n[s],a.push(s))}var r={},n={},a=[];if(o.each(e.sinks(),t),o.size(r)!==e.nodeCount())throw new i;return a}function i(){}var o=e("../lodash");t.exports=n,n.CycleException=i},{"../lodash":25}],21:[function(e,t,r){function n(){this._arr=[],this._keyIndices={}}var i=e("../lodash");t.exports=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map(function(e){return e.key})},n.prototype.has=function(e){return i.has(this._keyIndices,e)},n.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(e,t){var r=this._keyIndices;if(e=String(e),!i.has(r,e)){var n=this._arr,o=n.length;return r[e]=o,n.push({key:e,priority:t}),this._decrease(o),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,t){var r=this._keyIndices[e];if(t>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+t);this._arr[r].priority=t,this._decrease(r)},n.prototype._heapify=function(e){var t=this._arr,r=2*e,n=r+1,i=e;r>1,!(r[t].priorityo){var a=i;i=o,o=a}return i+l+o+l+(u.isUndefined(n)?c:n)}function s(e,t){return a(e,t.v,t.w,t.name)}var u=e("./lodash");t.exports=n;var c="\0",f="\0",l="";n.prototype._nodeCount=0,n.prototype._edgeCount=0,n.prototype.isDirected=function(){return this._isDirected},n.prototype.isMultigraph=function(){return this._isMultigraph},n.prototype.isCompound=function(){return this._isCompound},n.prototype.setGraph=function(e){return this._label=e,this},n.prototype.graph=function(){return this._label},n.prototype.setDefaultNodeLabel=function(e){return u.isFunction(e)||(e=u.constant(e)),this._defaultNodeLabelFn=e,this},n.prototype.nodeCount=function(){return this._nodeCount},n.prototype.nodes=function(){return u.keys(this._nodes)},n.prototype.sources=function(){var e=this;return u.filter(this.nodes(),function(t){return u.isEmpty(e._in[t])})},n.prototype.sinks=function(){var e=this;return u.filter(this.nodes(),function(t){return u.isEmpty(e._out[t])})},n.prototype.setNodes=function(e,t){var r=arguments,n=this;return u.each(e,function(e){r.length>1?n.setNode(e,t):n.setNode(e)}),this},n.prototype.setNode=function(e,t){return u.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=f,this._children[e]={},this._children[f][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},n.prototype.node=function(e){return this._nodes[e]},n.prototype.hasNode=function(e){return u.has(this._nodes,e)},n.prototype.removeNode=function(e){var t=this;if(u.has(this._nodes,e)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],u.each(this.children(e),function(e){t.setParent(e)}),delete this._children[e]),u.each(u.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],u.each(u.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},n.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(u.isUndefined(t))t=f;else{for(var r=t+="";!u.isUndefined(r);r=this.parent(r))if(r===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},n.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},n.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==f)return t}},n.prototype.children=function(e){if(u.isUndefined(e)&&(e=f),this._isCompound){var t=this._children[e];if(t)return u.keys(t)}else{if(e===f)return this.nodes();if(this.hasNode(e))return[]}},n.prototype.predecessors=function(e){var t=this._preds[e];if(t)return u.keys(t)},n.prototype.successors=function(e){var t=this._sucs[e];if(t)return u.keys(t)},n.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return u.union(t,this.successors(e))},n.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},n.prototype.filterNodes=function(e){function t(e){var o=n.parent(e);return void 0===o||r.hasNode(o)?(i[e]=o,o):o in i?i[o]:t(o)}var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;u.each(this._nodes,function(t,n){e(n)&&r.setNode(n,t)}),u.each(this._edgeObjs,function(e){r.hasNode(e.v)&&r.hasNode(e.w)&&r.setEdge(e,n.edge(e))});var i={};return this._isCompound&&u.each(r.nodes(),function(e){r.setParent(e,t(e))}),r},n.prototype.setDefaultEdgeLabel=function(e){return u.isFunction(e)||(e=u.constant(e)),this._defaultEdgeLabelFn=e,this},n.prototype.edgeCount=function(){return this._edgeCount},n.prototype.edges=function(){return u.values(this._edgeObjs)},n.prototype.setPath=function(e,t){var r=this,n=arguments;return u.reduce(e,function(e,i){return n.length>1?r.setEdge(e,i,t):r.setEdge(e,i),i}),this},n.prototype.setEdge=function(){var e,t,r,n,o=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,r=s.name,2===arguments.length&&(n=arguments[1],o=!0)):(e=s,t=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],o=!0)),e=""+e,t=""+t,u.isUndefined(r)||(r=""+r);var c=a(this._isDirected,e,t,r);if(u.has(this._edgeLabels,c))return o&&(this._edgeLabels[c]=n),this;if(!u.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[c]=o?n:this._defaultEdgeLabelFn(e,t,r);var f=function(e,t,r,n){var i=""+t,o=""+r;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return n&&(s.name=n),s}(this._isDirected,e,t,r);return e=f.v,t=f.w,Object.freeze(f),this._edgeObjs[c]=f,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][c]=f,this._out[e][c]=f,this._edgeCount++,this},n.prototype.edge=function(e,t,r){var n=1===arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return this._edgeLabels[n]},n.prototype.hasEdge=function(e,t,r){var n=1===arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r);return u.has(this._edgeLabels,n)},n.prototype.removeEdge=function(e,t,r){var n=1===arguments.length?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,r),i=this._edgeObjs[n];return i&&(e=i.v,t=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][n],delete this._out[e][n],this._edgeCount--),this},n.prototype.inEdges=function(e,t){var r=this._in[e];if(r){var n=u.values(r);return t?u.filter(n,function(e){return e.v===t}):n}},n.prototype.outEdges=function(e,t){var r=this._out[e];if(r){var n=u.values(r);return t?u.filter(n,function(e){return e.w===t}):n}},n.prototype.nodeEdges=function(e,t){var r=this.inEdges(e,t);if(r)return r.concat(this.outEdges(e,t))}},{"./lodash":25}],23:[function(e,t,r){t.exports={Graph:e("./graph"),version:e("./version")}},{"./graph":22,"./version":26}],24:[function(e,t,r){var n=e("./lodash"),i=e("./graph");t.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:function(e){return n.map(e.nodes(),function(t){var r=e.node(t),i=e.parent(t),o={v:t};return n.isUndefined(r)||(o.value=r),n.isUndefined(i)||(o.parent=i),o})}(e),edges:function(e){return n.map(e.edges(),function(t){var r=e.edge(t),i={v:t.v,w:t.w};return n.isUndefined(t.name)||(i.name=t.name),n.isUndefined(r)||(i.value=r),i})}(e)};return n.isUndefined(e.graph())||(t.value=n.clone(e.graph())),t},read:function(e){var t=new i(e.options).setGraph(e.value);return n.each(e.nodes,function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),n.each(e.edges,function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}},{"./graph":22,"./lodash":25}],25:[function(e,t,r){var n;if("function"==typeof e)try{n=e("lodash")}catch(e){}n||(n=window._),t.exports=n},{lodash:87}],26:[function(e,t,r){t.exports="2.1.5"},{}],27:[function(e,t,r){"use strict";var n=e("./lib/js-yaml.js");t.exports=n},{"./lib/js-yaml.js":28}],28:[function(e,t,r){"use strict";function n(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}var i=e("./js-yaml/loader"),o=e("./js-yaml/dumper");t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=i.load,t.exports.loadAll=i.loadAll,t.exports.safeLoad=i.safeLoad,t.exports.safeLoadAll=i.safeLoadAll,t.exports.dump=o.dump,t.exports.safeDump=o.safeDump,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=n("scan"),t.exports.parse=n("parse"),t.exports.compose=n("compose"),t.exports.addConstructor=n("addConstructor")},{"./js-yaml/dumper":30,"./js-yaml/exception":31,"./js-yaml/loader":32,"./js-yaml/schema":34,"./js-yaml/schema/core":35,"./js-yaml/schema/default_full":36,"./js-yaml/schema/default_safe":37,"./js-yaml/schema/failsafe":38,"./js-yaml/schema/json":39,"./js-yaml/type":40}],29:[function(e,t,r){"use strict";function n(e){return void 0===e||null===e}t.exports.isNothing=n,t.exports.isObject=function(e){return"object"==typeof e&&null!==e},t.exports.toArray=function(e){return Array.isArray(e)?e:n(e)?[]:[e]},t.exports.repeat=function(e,t){var r,n="";for(r=0;rn&&" "!==e[d+1],d=o);else if(!u(a))return Q;h=h&&c(a)}l=l||p&&o-d-1>n&&" "!==e[d+1]}return f||l?" "===e[0]&&r>9?Q:l?J:X:h&&!i(e)?G:Z}function l(e,t,r,i){e.dump=function(){if(0===t.length)return"''";if(!e.noCompatMode&&-1!==K.indexOf(t))return"'"+t+"'";var a=e.indent*Math.max(1,r),s=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&r>=e.flowLevel;switch(f(t,c,e.indent,s,function(t){return function(e,t){var r,n;for(r=0,n=e.implicitTypes.length;r"+p(t,e.indent)+d(o(function(e,t){var r,n,i=/(\n+)([^\n]*)/g,o=function(){var r=e.indexOf("\n");return r=-1!==r?r:e.length,i.lastIndex=r,h(e.slice(0,r),t)}(),a="\n"===e[0]||" "===e[0];for(;n=i.exec(e);){var s=n[1],u=n[2];r=" "===u[0],o+=s+(a||r||""===u?"":"\n")+h(u,t),a=r}return o}(t,s),a));case Q:return'"'+function(e){for(var t,r,i,o="",a=0;a=55296&&t<=56319&&(r=e.charCodeAt(a+1))>=56320&&r<=57343?(o+=n(1024*(t-55296)+r-56320+65536),a++):(i=H[t],o+=!i&&u(t)?e[a]:i||n(t));return o}(t)+'"';default:throw new b("impossible error: invalid scalar style")}}()}function p(e,t){var r=" "===e[0]?String(t):"",n="\n"===e[e.length-1];return r+(n&&("\n"===e[e.length-2]||"\n"===e)?"+":n?"":"-")+"\n"}function d(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function h(e,t){if(""===e||" "===e[0])return e;for(var r,n,i=/ [^ ]/g,o=0,a=0,s=0,u="";r=i.exec(e);)(s=r.index)-o>t&&(n=a>o?a:s,u+="\n"+e.slice(o,n),o=n+1),a=s;return u+="\n",e.length-o>t&&a>o?u+=e.slice(o,a)+"\n"+e.slice(a+1):u+=e.slice(o),u.slice(1)}function m(e,t,r){var n,i,o,a,s,u;for(o=0,a=(i=r?e.explicitTypes:e.implicitTypes).length;o tag resolver accepts not "'+u+'" style');n=s.represent[u](t,u)}e.dump=n}return!0}return!1}function y(e,t,r,n,i,o){e.tag=null,e.dump=r,m(e,r,!1)||m(e,r,!0);var s=x.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var u,c,f="[object Object]"===s||"[object Array]"===s;if(f&&(c=-1!==(u=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&t>0)&&(i=!1),c&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&c&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)n&&0!==Object.keys(e.dump).length?(!function(e,t,r,n){var i,o,s,u,c,f,l="",p=e.tag,d=Object.keys(r);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new b("sortKeys must be a boolean or a function");for(i=0,o=d.length;i1024)&&(e.dump&&A===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,c&&(f+=a(e,t)),y(e,t+1,u,!0,c)&&(e.dump&&A===e.dump.charCodeAt(0)?f+=":":f+=": ",l+=f+=e.dump));e.tag=p,e.dump=l||"{}"}(e,t,e.dump,i),c&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,r){var n,i,o,a,s,u="",c=e.tag,f=Object.keys(r);for(n=0,i=f.length;n1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),y(e,t,a,!1,!1)&&(u+=s+=e.dump));e.tag=c,e.dump="{"+u+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)n&&0!==e.dump.length?(!function(e,t,r,n){var i,o,s="",u=e.tag;for(i=0,o=r.length;i "+e.dump)}return!0}function g(e,t,r){var n,i,o;if(null!==e&&"object"==typeof e)if(-1!==(i=t.indexOf(e)))-1===r.indexOf(i)&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,o=e.length;i>10),56320+(e-65536&1023))}function p(e,t){return new $(t,new C(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function d(e,t){throw p(e,t)}function h(e,t){e.onWarning&&e.onWarning.call(null,p(e,t))}function m(e,t,r,n){var i,o,a,s;if(t1&&(e.result+=T.repeat("\n",t-1))}function w(e,t){var r,n,i,a=e.tag,s=e.anchor,u=[],c=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=u),i=e.input.charCodeAt(e.position);0!==i&&45===i&&(n=e.input.charCodeAt(e.position+1),o(n));)if(c=!0,e.position++,_(e,!0,-1)&&e.lineIndent<=t)u.push(null),i=e.input.charCodeAt(e.position);else if(r=e.line,j(e,t,F,!1,!0),u.push(e.result),_(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==i)d(e,"bad indentation of a sequence entry");else if(e.lineIndentt?R=1:e.lineIndent===t?R=0:e.lineIndentt?R=1:e.lineIndent===t?R=0:e.lineIndentt)&&(j(e,t,N,!0,a)&&(b?y=e.result:v=e.result),b||(g(e,p,h,m,y,v,s,u),m=y=v=null),_(e,!0,-1),c=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==c)d(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===a?d(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?d(e,"repeat of an indentation width identifier"):(p=t+a-1,l=!0)}if(i(s)){do{s=e.input.charCodeAt(++e.position)}while(i(s));if(35===s)do{s=e.input.charCodeAt(++e.position)}while(!n(s)&&0!==s)}for(;0!==s;){for(v(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!l||e.lineIndentp&&(p=e.lineIndent),n(s))h++;else{if(e.lineIndent0){for(o=c,a=0;o>0;o--)(c=s(f=e.input.charCodeAt(++e.position)))>=0?a=(a<<4)+c:d(e,"expected hexadecimal character");e.result+=l(a),e.position++}else d(e,"unknown escape sequence");r=i=e.position}else n(f)?(m(e,r,i,!0),E(e,_(e,!1,t)),r=i=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}d(e,"unexpected end of the stream within a double quoted scalar")}(e,$)?z=!0:!function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!o(n)&&!a(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&d(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||d(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],_(e,!0,-1),!0}(e)?function(e,t,r){var s,u,c,f,l,p,d,h,y,g=e.kind,v=e.result;if(y=e.input.charCodeAt(e.position),o(y)||a(y)||35===y||38===y||42===y||33===y||124===y||62===y||39===y||34===y||37===y||64===y||96===y)return!1;if((63===y||45===y)&&(u=e.input.charCodeAt(e.position+1),o(u)||r&&a(u)))return!1;for(e.kind="scalar",e.result="",c=f=e.position,l=!1;0!==y;){if(58===y){if(u=e.input.charCodeAt(e.position+1),o(u)||r&&a(u))break}else if(35===y){if(s=e.input.charCodeAt(e.position-1),o(s))break}else{if(e.position===e.lineStart&&b(e)||r&&a(y))break;if(n(y)){if(p=e.line,d=e.lineStart,h=e.lineIndent,_(e,!1,-1),e.lineIndent>=t){l=!0,y=e.input.charCodeAt(e.position);continue}e.position=f,e.line=p,e.lineStart=d,e.lineIndent=h;break}}l&&(m(e,c,f,!1),E(e,e.line-p),c=f=e.position,l=!1),i(y)||(f=e.position+1),y=e.input.charCodeAt(++e.position)}return m(e,c,f,!1),!!e.result||(e.kind=g,e.result=v,!1)}(e,$,M===r)&&(z=!0,null===e.tag&&(e.tag="?")):(z=!0,null===e.tag&&null===e.anchor||d(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===R&&(z=A&&w(e,C))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(S=0,I=e.implicitTypes.length;S tag; it should be "'+P.kind+'", not "'+e.kind+'"'),P.resolve(e.result)?(e.result=P.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):d(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):d(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||z}function A(e){var t,r,a,s,u=e.position,c=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(_(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(c=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);for(a=[],(r=e.input.slice(t,e.position)).length<1&&d(e,"directive name must not be less than one character in length");0!==s;){for(;i(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!n(s));break}if(n(s))break;for(t=e.position;0!==s&&!o(s);)s=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==s&&v(e),k.call(X,r)?X[r](e,r,a):h(e,'unknown document directive "'+r+'"')}_(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,_(e,!0,-1)):c&&d(e,"directives end mark is expected"),j(e,e.lineIndent-1,N,!1,!0),_(e,!0,-1),e.checkLineBreaks&&Y.test(e.input.slice(u,e.position))&&h(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&b(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,_(e,!0,-1)):e.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(n-1));)if(n-=1,this.position-n>t/2-1){r=" ... ",n+=5;break}for(o="",a=this.position;at/2-1){o=" ... ",a-=5;break}return s=this.buffer.slice(n,a),i.repeat(" ",e)+r+s+o+"\n"+i.repeat(" ",e+this.position-n+r.length)+"^"},n.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(r+=":\n"+t),r},t.exports=n},{"./common":29}],34:[function(e,t,r){"use strict";function n(e,t,r){var i=[];return e.include.forEach(function(e){r=n(e,t,r)}),e[t].forEach(function(e){r.forEach(function(t,r){t.tag===e.tag&&t.kind===e.kind&&i.push(r)}),r.push(e)}),r.filter(function(e,t){return-1===i.indexOf(t)})}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new a("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=n(this,"implicit",[]),this.compiledExplicit=n(this,"explicit",[]),this.compiledTypeMap=function(){function e(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}var t,r,n={scalar:{},sequence:{},mapping:{},fallback:{}};for(t=0,r=arguments.length;t64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,i=e.replace(/[\r\n=]/g,""),a=i.length,s=o,u=0,c=[];for(t=0;t>16&255),c.push(u>>8&255),c.push(255&u)),u=u<<6|s.indexOf(i.charAt(t));return 0==(r=a%4*6)?(c.push(u>>16&255),c.push(u>>8&255),c.push(255&u)):18===r?(c.push(u>>10&255),c.push(u>>2&255)):12===r&&c.push(u>>4&255),n?n.from?n.from(c):new n(c):c},predicate:function(e){return n&&n.isBuffer(e)},represent:function(e){var t,r,n="",i=0,a=e.length,s=o;for(t=0;t>18&63],n+=s[i>>12&63],n+=s[i>>6&63],n+=s[63&i]),i=(i<<8)+e[t];return 0==(r=a%3)?(n+=s[i>>18&63],n+=s[i>>12&63],n+=s[i>>6&63],n+=s[63&i]):2===r?(n+=s[i>>10&63],n+=s[i>>4&63],n+=s[i<<2&63],n+=s[64]):1===r&&(n+=s[i>>2&63],n+=s[i<<4&63],n+=s[64],n+=s[64]),n}})},{"../type":40}],42:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":40}],43:[function(e,t,r){"use strict";var n=e("../common"),i=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-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))$"),a=/^[-+]?[0-9]+e/;t.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r="-"===t[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,n=1,i.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return r=e.toString(10),a.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"})},{"../common":29,"../type":40}],44:[function(e,t,r){"use strict";function n(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function i(e){return 48<=e&&e<=55}function o(e){return 48<=e&&e<=57}var a=e("../common"),s=e("../type");t.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r=e.length,a=0,s=!1;if(!r)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===r)return!0;if("b"===(t=e[++a])){for(a++;a3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0},construct:function(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},{"../../type":40}],47:[function(e,t,r){"use strict";var n=e("../../type");t.exports=new n("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},{"../../type":40}],48:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":40}],49:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},{"../type":40}],50:[function(e,t,r){"use strict";var n=e("../type");t.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":40}],51:[function(e,t,r){"use strict";var n=e("../type"),i=Object.prototype.hasOwnProperty,o=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,a,s,u=[],c=e;for(t=0,r=c.length;t-1?n=i:(r=j.isUndefined(e)?void 0:d(e),j.isUndefined(r)?n=i:((n=r).path=T(S.join(r.path,i.path)),n.query=function(e,t){function r(e){j.forOwn(e,function(e,t){n[t]=e})}var n={};return r(P.parse(e||"")),r(P.parse(t||"")),0===Object.keys(n).length?void 0:P.stringify(n)}(r.query,i.query))),n.fragment=void 0,(-1===k.indexOf(n.reference)&&0===n.path.indexOf("../")?"../":"")+$.serialize(n)}function i(e){return D.indexOf(u(e))>-1}function o(e){return j.isUndefined(e.error)&&"invalid"!==e.type}function a(e,t){var r=e;return t.forEach(function(e){if(!((e=decodeURI(e))in r))throw Error("JSON Pointer points to missing location: "+x(t));r=r[e]}),r}function s(e){return Object.keys(e).filter(function(e){return"$ref"!==e})}function u(e){var t;switch(e.uriDetails.reference){case"absolute":case"uri":t="remote";break;case"same-document":t="local";break;default:t=e.uriDetails.reference}return t}function c(e,t){var r=R[e],n=Promise.resolve(),i=j.cloneDeep(t.loaderOptions||{});return j.isUndefined(r)?(j.isUndefined(i.processContent)&&(i.processContent=function(e,t){t(void 0,JSON.parse(e.text))}),n=(n=I.load(decodeURI(e),i)).then(function(t){return R[e]={value:t},t}).catch(function(t){throw R[e]={error:t},t})):n=n.then(function(){if(j.isError(r.error))throw r.error;return r.value}),n=n.then(function(e){return j.cloneDeep(e)})}function f(e,t){var r=!0;try{if(!j.isPlainObject(e))throw new Error("obj is not an Object");if(!j.isString(e.$ref))throw new Error("obj.$ref is not a String")}catch(e){if(t)throw e;r=!1}return r}function l(e){return-1!==e.indexOf("://")||S.isAbsolute(e)?e:S.resolve(r.cwd(),e)}function p(e,t){e.error=t.message,e.missing=!0}function d(e){return $.parse(encodeURI(decodeURI(e)))}function h(e,t,r){var a,s,u=Promise.resolve(),f=x(t.subDocPath),d=l(t.location),m=S.dirname(t.location),y=d+f;return j.isUndefined(r.docs[d])&&(r.docs[d]=e),j.isUndefined(r.deps[y])&&(r.deps[y]={},a=_(e,t),j.forOwn(a,function(a,d){var g=l(t.location)+d,v=a.refdId=l(i(a)?n(m,a.uri):t.location)+"#"+(a.uri.indexOf("#")>-1?a.uri.split("#")[1]:"");r.refs[g]=a,o(a)&&(r.deps[y][d===f?"#":d.replace(f+"/","#/")]=v,0!==g.indexOf(v+"/")?((s=j.cloneDeep(t)).subDocPath=j.isUndefined(a.uriDetails.fragment)?[]:w(decodeURI(a.uriDetails.fragment)),i(a)?(delete s.filter,s.location=v.split("#")[0],u=u.then(function(e,t){return function(){var r=l(t.location),n=e.docs[r];return j.isUndefined(n)?c(r,t).catch(function(t){return e.docs[r]=t,t}):Promise.resolve().then(function(){return n})}}(r,s))):u=u.then(function(){return e}),u=u.then(function(e,t,r){return function(n){if(j.isError(n))p(r,n);else try{return h(n,t,e).catch(function(e){p(r,e)})}catch(e){p(r,e)}}}(r,s,a))):a.circular=!0)})),u}function m(e,t,r,n){function i(t,i){r.push(i),m(e,t,r,n),r.pop()}var o=!0;j.isFunction(n)&&(o=n(e,t,r)),-1===e.indexOf(t)&&(e.push(t),!1!==o&&(j.isArray(t)?t.forEach(function(e,t){i(e,t.toString())}):j.isObject(t)&&j.forOwn(t,function(e,t){i(e,t)})),e.pop())}function y(e,t){var r;if(e=j.isUndefined(e)?{}:j.cloneDeep(e),!j.isObject(e))throw new TypeError("options must be an Object");if(!j.isUndefined(e.resolveCirculars)&&!j.isBoolean(e.resolveCirculars))throw new TypeError("options.resolveCirculars must be a Boolean");if(!(j.isUndefined(e.filter)||j.isArray(e.filter)||j.isFunction(e.filter)||j.isString(e.filter)))throw new TypeError("options.filter must be an Array, a Function of a String");if(!j.isUndefined(e.includeInvalid)&&!j.isBoolean(e.includeInvalid))throw new TypeError("options.includeInvalid must be a Boolean");if(!j.isUndefined(e.location)&&!j.isString(e.location))throw new TypeError("options.location must be a String");if(!j.isUndefined(e.refPreProcessor)&&!j.isFunction(e.refPreProcessor))throw new TypeError("options.refPreProcessor must be a Function");if(!j.isUndefined(e.refPostProcessor)&&!j.isFunction(e.refPostProcessor))throw new TypeError("options.refPostProcessor must be a Function");if(!j.isUndefined(e.subDocPath)&&!j.isArray(e.subDocPath)&&!E(e.subDocPath))throw new TypeError("options.subDocPath must be an Array of path segments or a valid JSON Pointer");if(j.isUndefined(e.resolveCirculars)&&(e.resolveCirculars=!1),e.filter=function(e){var t,r;return j.isArray(e.filter)||j.isString(e.filter)?(r=j.isString(e.filter)?[e.filter]:e.filter,t=function(e){return r.indexOf(e.type)>-1||r.indexOf(u(e))>-1}):j.isFunction(e.filter)?t=e.filter:j.isUndefined(e.filter)&&(t=function(){return!0}),function(r,n){return("invalid"!==r.type||!0===e.includeInvalid)&&t(r,n)}}(e),j.isUndefined(e.location)&&(e.location=l("./root.json")),(r=e.location.split("#")).length>1&&(e.subDocPath="#"+r[1]),e.location=n(e.location,void 0),e.subDocPath=function(e){var t;return j.isArray(e.subDocPath)?t=e.subDocPath:j.isString(e.subDocPath)?t=w(e.subDocPath):j.isUndefined(e.subDocPath)&&(t=[]),t}(e),!j.isUndefined(t))try{a(t,e.subDocPath)}catch(e){throw e.message=e.message.replace("JSON Pointer","options.subDocPath"),e}return e}function g(e){if(!j.isArray(e))throw new TypeError("path must be an array");return e.map(function(e){return j.isString(e)||(e=JSON.stringify(e)),decodeURI(e.replace(/~1/g,"/").replace(/~0/g,"~"))})}function v(e){if(!j.isArray(e))throw new TypeError("path must be an array");return e.map(function(e){return j.isString(e)||(e=JSON.stringify(e)),e.replace(/~/g,"~0").replace(/\//g,"~1")})}function _(e,t){var r={};if(!j.isArray(e)&&!j.isObject(e))throw new TypeError("obj must be an Array or an Object");return t=y(t,e),m(function(e,t){var r,n=[];return t.length>0&&(r=e,t.slice(0,t.length-1).forEach(function(e){e in r&&(r=r[e],n.push(r))})),n}(e,t.subDocPath),a(e,t.subDocPath),j.cloneDeep(t.subDocPath),function(e,n,i){var o,a,u=!0;return f(n)&&(j.isUndefined(t.refPreProcessor)||(n=t.refPreProcessor(j.cloneDeep(n),i)),o=b(n),j.isUndefined(t.refPostProcessor)||(o=t.refPostProcessor(o,i)),t.filter(o,i)&&(a=x(i),r[a]=o),s(n).length>0&&(u=!1)),u}),r}function b(e){var t,r,n,i={def:e};try{f(e,!0)?(t=e.$ref,n=M[t],j.isUndefined(n)&&(n=M[t]=d(t)),i.uri=t,i.uriDetails=n,j.isUndefined(n.error)?i.type=u(i):(i.error=i.uriDetails.error,i.type="invalid"),(r=s(e)).length>0&&(i.warning="Extra JSON Reference properties will be ignored: "+r.join(", "))):i.type="invalid"}catch(e){i.error=e.message,i.type="invalid"}return i}function E(e,t){var r,n=!0;try{if(!j.isString(e))throw new Error("ptr is not a String");if(""!==e){if(r=e.charAt(0),-1===["#","/"].indexOf(r))throw new Error("ptr must start with a / or #/");if("#"===r&&"#"!==e&&"/"!==e.charAt(1))throw new Error("ptr must start with a / or #/");if(e.match(C))throw new Error("ptr has invalid token(s)")}}catch(e){if(!0===t)throw e;n=!1}return n}function w(e){try{E(e,!0)}catch(e){throw new Error("ptr must be a JSON Pointer: "+e.message)}var t=e.split("/");return t.shift(),g(t)}function x(e,t){if(!j.isArray(e))throw new Error("path must be an Array");return(!1!==t?"#":"")+(e.length>0?"/":"")+v(e).join("/")}function O(e,t){var r=Promise.resolve();return r=r.then(function(){if(!j.isArray(e)&&!j.isObject(e))throw new TypeError("obj must be an Array or an Object");t=y(t,e),e=j.cloneDeep(e)}).then(function(){var r={deps:{},docs:{},refs:{}};return h(e,t,r).then(function(){return r})}).then(function(e){function r(i,a,s){var u,c=a.split("#"),f=e.refs[a];n[c[0]===t.location?"#"+c[1]:x(t.subDocPath.concat(s))]=f,!f.circular&&o(f)?(u=e.deps[f.refdId],0!==f.refdId.indexOf(i)&&Object.keys(u).forEach(function(e){r(f.refdId,f.refdId+e.substr(1),s.concat(w(e)))})):!f.circular&&f.error&&(f.error=f.error.replace("options.subDocPath","JSON Pointer"),f.error.indexOf("#")>-1&&(f.error=f.error.replace(f.uri.substr(f.uri.indexOf("#")),f.uri)),0!==f.error.indexOf("ENOENT:")&&0!==f.error.indexOf("Not Found")||(f.error="JSON Pointer points to missing location: "+f.uri))}var n={},s=[],u=[],c=new A.Graph,f=l(t.location),d=f+x(t.subDocPath);return Object.keys(e.deps).forEach(function(e){c.setNode(e)}),j.forOwn(e.deps,function(e,t){j.forOwn(e,function(e){c.setEdge(t,e)})}),(s=A.alg.findCycles(c)).forEach(function(e){e.forEach(function(e){-1===u.indexOf(e)&&u.push(e)})}),j.forOwn(e.deps,function(t,r){j.forOwn(t,function(t,n){var o,a=!1,c=r+n.slice(1),f=e.refs[r+n.slice(1)],l=i(f);u.indexOf(t)>-1&&s.forEach(function(e){a||(o=e.indexOf(t))>-1&&e.forEach(function(t){a||0===c.indexOf(t+"/")&&(l&&o===e.length-1||!l)&&(a=!0)})}),a&&(f.circular=!0)})}),j.forOwn(Object.keys(e.deps).reverse(),function(r){var n=e.deps[r],i=r.split("#"),o=e.docs[i[0]],s=w(i[1]);j.forOwn(n,function(r,n){var u=r.split("#"),c=e.docs[u[0]],f=s.concat(w(n)),l=e.refs[i[0]+x(f)];if(j.isUndefined(l.error)&&j.isUndefined(l.missing))if(!t.resolveCirculars&&l.circular)l.value=l.def;else{try{l.value=a(c,w(u[1]))}catch(e){return void p(l,e)}""===i[1]&&"#"===n?e.docs[i[0]]=l.value:function(e,t,r){a(e,t.slice(0,t.length-1))[decodeURI(t[t.length-1])]=r}(o,f,l.value)}})}),Object.keys(e.refs).forEach(function(e){0===e.indexOf(d)&&r(d,e,w(e.substr(d.length)))}),j.forOwn(e.refs,function(e){delete e.refdId}),{refs:n,resolved:e.docs[f]}})}var j=e("lodash"),A=e("graphlib"),S=e("path"),I=e("path-loader"),P=e("querystring"),T=e("slash"),$=e("uri-js"),C=/~(?:[^01]|$)/g,R={},D=["relative","remote"],k=["absolute","uri"],M={};"undefined"==typeof Promise&&e("native-promise-only"),t.exports.clearCache=function(){R={}},t.exports.decodePath=g,t.exports.encodePath=v,t.exports.findRefs=_,t.exports.findRefsAt=function(e,t){var r=Promise.resolve();return r=r.then(function(){if(!j.isString(e))throw new TypeError("location must be a string");return j.isUndefined(t)&&(t={}),j.isObject(t)&&(t.location=e),t=y(t),c(t.location,t)}).then(function(e){var r=j.cloneDeep(R[t.location]),n=j.cloneDeep(t),i=d(t.location);return j.isUndefined(r.refs)&&(delete n.filter,delete n.subDocPath,n.includeInvalid=!0,R[t.location].refs=_(e,n)),j.isUndefined(t.filter)||(n.filter=t.filter),j.isUndefined(i.fragment)?j.isUndefined(i.subDocPath)||(n.subDocPath=t.subDocPath):n.subDocPath=w(decodeURI(i.fragment)),{refs:_(e,n),value:e}})},t.exports.getRefDetails=b,t.exports.isPtr=E,t.exports.isRef=function(e,t){return f(e,t)&&"invalid"!==b(e).type},t.exports.pathFromPtr=w,t.exports.pathToPtr=x,t.exports.resolveRefs=O,t.exports.resolveRefsAt=function(e,t){var r=Promise.resolve();return r=r.then(function(){if(!j.isString(e))throw new TypeError("location must be a string");return j.isUndefined(t)&&(t={}),j.isObject(t)&&(t.location=e),t=y(t),c(t.location,t)}).then(function(e){var r=j.cloneDeep(t),n=d(t.location);return j.isUndefined(n.fragment)||(r.subDocPath=w(decodeURI(n.fragment))),O(e,r).then(function(t){return{refs:t.refs,resolved:t.resolved,value:e}})})}}).call(this,e("_process"))},{_process:93,graphlib:7,lodash:87,"native-promise-only":88,path:89,"path-loader":90,querystring:96,slash:97,"uri-js":107}],58:[function(e,t,r){t.exports=[]},{}],59:[function(e,t,r){var n=e("lodash._basecreate"),i=e("lodash.isobject"),o=e("lodash._setbinddata"),a=e("lodash._slice"),s=[].push;t.exports=function(e){function t(){if(u){var e=a(u);s.apply(e,arguments)}if(this instanceof t){var o=n(r.prototype),f=r.apply(o,e||arguments);return i(f)?f:o}return r.apply(c,e||arguments)}var r=e[0],u=e[2],c=e[4];return o(t,e),t}},{"lodash._basecreate":61,"lodash._setbinddata":70,"lodash._slice":72,"lodash.isobject":83}],60:[function(e,t,r){function n(e,t,r,m,b){if(r){var O=r(e);if(void 0!==O)return O}if(!c(e))return e;var j=E.call(e);if(!_[j])return e;var A=x[j];switch(j){case d:case h:return new A(+e);case y:case v:return new A(e);case g:return O=A(e.source,p.exec(e)),O.lastIndex=e.lastIndex,O}var S=u(e);if(t){var I=!m;m||(m=s()),b||(b=s());for(var P=m.length;P--;)if(m[P]==e)return b[P];O=S?A(e.length):{}}else O=S?l(e):i({},e);return S&&(w.call(e,"index")&&(O.index=e.index),w.call(e,"input")&&(O.input=e.input)),t?(m.push(e),b.push(O),(S?o:a)(e,function(e,i){O[i]=n(e,t,r,m,b)}),I&&(f(m),f(b)),O):O}var i=e("lodash.assign"),o=e("lodash.foreach"),a=e("lodash.forown"),s=e("lodash._getarray"),u=e("lodash.isarray"),c=e("lodash.isobject"),f=e("lodash._releasearray"),l=e("lodash._slice"),p=/\w*$/,d="[object Boolean]",h="[object Date]",m="[object Function]",y="[object Number]",g="[object RegExp]",v="[object String]",_={};_[m]=!1,_["[object Arguments]"]=_["[object Array]"]=_[d]=_[h]=_[y]=_["[object Object]"]=_[g]=_[v]=!0;var b=Object.prototype,E=b.toString,w=b.hasOwnProperty,x={};x["[object Array]"]=Array,x[d]=Boolean,x[h]=Date,x[m]=Function,x["[object Object]"]=Object,x[y]=Number,x[g]=RegExp,x[v]=String,t.exports=n},{"lodash._getarray":65,"lodash._releasearray":69,"lodash._slice":72,"lodash.assign":73,"lodash.foreach":76,"lodash.forown":77,"lodash.isarray":80,"lodash.isobject":83}],61:[function(e,t,r){(function(r){function n(e,t){return o(e)?a(e):{}}var i=e("lodash._isnative"),o=e("lodash.isobject"),a=(e("lodash.noop"),i(a=Object.create)&&a);a||(n=function(){function e(){}return function(t){if(o(t)){e.prototype=t;var n=new e;e.prototype=null}return n||r.Object()}}()),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._isnative":66,"lodash.isobject":83,"lodash.noop":85}],62:[function(e,t,r){var n=e("lodash.bind"),i=e("lodash.identity"),o=e("lodash._setbinddata"),a=e("lodash.support"),s=/^\s*function[ \n\r\t]+\w/,u=/\bthis\b/,c=Function.prototype.toString;t.exports=function(e,t,r){if("function"!=typeof e)return i;if(void 0===t||!("prototype"in e))return e;var f=e.__bindData__;if(void 0===f&&(a.funcNames&&(f=!e.name),!(f=f||!a.funcDecomp))){var l=c.call(e);a.funcNames||(f=!s.test(l)),f||(f=u.test(l),o(e,f))}if(!1===f||!0!==f&&1&f[1])return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,o){return e.call(t,r,n,i,o)}}return n(e,t)}},{"lodash._setbinddata":70,"lodash.bind":74,"lodash.identity":79,"lodash.support":86}],63:[function(e,t,r){function n(e){function t(){var e=h?p:this;if(f){var a=s(f);u.apply(a,arguments)}if((l||y)&&(a||(a=s(arguments)),l&&u.apply(a,l),y&&a.length3&&"function"==typeof c[l-2])var p=n(c[--l-1],c[l--],2);else l>2&&"function"==typeof c[l-1]&&(p=c[--l]);for(;++f2?n(e,17,i(arguments,2),null,t):n(e,1,null,null,t)}},{"lodash._createwrapper":64,"lodash._slice":72}],75:[function(e,t,r){var n=e("lodash._baseclone"),i=e("lodash._basecreatecallback");t.exports=function(e,t,r){return n(e,!0,"function"==typeof t&&i(t,r,1))}},{"lodash._baseclone":60,"lodash._basecreatecallback":62}],76:[function(e,t,r){var n=e("lodash._basecreatecallback"),i=e("lodash.forown");t.exports=function(e,t,r){var o=-1,a=e?e.length:0;if(t=t&&void 0===r?t:n(t,r,3),"number"==typeof a)for(;++o-1},n.prototype.set=function(e,t){var r=this.__data__,n=o(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},i.prototype.clear=function(){this.__data__={hash:new r,map:new(L||n),string:new r}},i.prototype.delete=function(e){return u(this,e).delete(e)},i.prototype.get=function(e){return u(this,e).get(e)},i.prototype.has=function(e){return u(this,e).has(e)},i.prototype.set=function(e,t){return u(this,e).set(e,t),this};var Y=f(function(e){e=d(e);var t=[];return w.test(e)&&t.push(""),e.replace(x,function(e,r,n,i){t.push(n?i.replace(O,"$1"):r||e)}),t});f.Cache=i;var W=Array.isArray;t.exports=function(e,t,r){var n=null==e?void 0:a(e,t);return void 0===n?r:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],79:[function(e,t,r){t.exports=function(e){return e}},{}],80:[function(e,t,r){var n=e("lodash._isnative"),i=Object.prototype.toString,o=n(o=Array.isArray)&&o,a=o||function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&"[object Array]"==i.call(e)||!1};t.exports=a},{"lodash._isnative":66}],81:[function(e,t,r){(function(e){function n(e,t){for(var r=-1,n=null==e?0:e.length;++r-1&&e%1==0&&ec))return!1;var p=s.get(e);if(p&&s.get(t))return p==t;var d=-1,h=!0,m=r&R?new f:void 0;for(s.set(e,t),s.set(t,e);++d-1&&e%1==0&&e<=D}function S(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function I(e){return null!=e&&"object"==typeof e}function P(e){return function(e){return null!=e&&A(e.length)&&!j(e)}(e)?p(e):v(e)}var T=200,$="__lodash_hash_undefined__",C=1,R=2,D=9007199254740991,k="[object Arguments]",M="[object Array]",U="[object AsyncFunction]",F="[object Boolean]",N="[object Date]",L="[object Error]",q="[object Function]",B="[object GeneratorFunction]",z="[object Map]",Y="[object Number]",W="[object Null]",V="[object Object]",H="[object Promise]",K="[object Proxy]",G="[object RegExp]",Z="[object Set]",X="[object String]",J="[object Symbol]",Q="[object Undefined]",ee="[object WeakMap]",te="[object ArrayBuffer]",re="[object DataView]",ne=/^\[object .+?Constructor\]$/,ie=/^(?:0|[1-9]\d*)$/,oe={};oe["[object Float32Array]"]=oe["[object Float64Array]"]=oe["[object Int8Array]"]=oe["[object Int16Array]"]=oe["[object Int32Array]"]=oe["[object Uint8Array]"]=oe["[object Uint8ClampedArray]"]=oe["[object Uint16Array]"]=oe["[object Uint32Array]"]=!0,oe[k]=oe[M]=oe[te]=oe[F]=oe[re]=oe[N]=oe[L]=oe[q]=oe[z]=oe[Y]=oe[V]=oe[G]=oe[Z]=oe[X]=oe[ee]=!1;var ae="object"==typeof e&&e&&e.Object===Object&&e,se="object"==typeof self&&self&&self.Object===Object&&self,ue=ae||se||Function("return this")(),ce="object"==typeof r&&r&&!r.nodeType&&r,fe=ce&&"object"==typeof t&&t&&!t.nodeType&&t,le=fe&&fe.exports===ce,pe=le&&ae.process,de=function(){try{return pe&&pe.binding&&pe.binding("util")}catch(e){}}(),he=de&&de.isTypedArray,me=Array.prototype,ye=Function.prototype,ge=Object.prototype,ve=ue["__core-js_shared__"],_e=ye.toString,be=ge.hasOwnProperty,Ee=function(){var e=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),we=ge.toString,xe=RegExp("^"+_e.call(be).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=le?ue.Buffer:void 0,je=ue.Symbol,Ae=ue.Uint8Array,Se=ge.propertyIsEnumerable,Ie=me.splice,Pe=je?je.toStringTag:void 0,Te=Object.getOwnPropertySymbols,$e=Oe?Oe.isBuffer:void 0,Ce=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Re=w(ue,"DataView"),De=w(ue,"Map"),ke=w(ue,"Promise"),Me=w(ue,"Set"),Ue=w(ue,"WeakMap"),Fe=w(Object,"create"),Ne=x(Re),Le=x(De),qe=x(ke),Be=x(Me),ze=x(Ue),Ye=je?je.prototype:void 0,We=Ye?Ye.valueOf:void 0;s.prototype.clear=function(){this.__data__=Fe?Fe(null):{},this.size=0},s.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},s.prototype.get=function(e){var t=this.__data__;if(Fe){var r=t[e];return r===$?void 0:r}return be.call(t,e)?t[e]:void 0},s.prototype.has=function(e){var t=this.__data__;return Fe?void 0!==t[e]:be.call(t,e)},s.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Fe&&void 0===t?$:t,this},u.prototype.clear=function(){this.__data__=[],this.size=0},u.prototype.delete=function(e){var t=this.__data__,r=d(t,e);return!(r<0||(r==t.length-1?t.pop():Ie.call(t,r,1),--this.size,0))},u.prototype.get=function(e){var t=this.__data__,r=d(t,e);return r<0?void 0:t[r][1]},u.prototype.has=function(e){return d(this.__data__,e)>-1},u.prototype.set=function(e,t){var r=this.__data__,n=d(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},c.prototype.clear=function(){this.size=0,this.__data__={hash:new s,map:new(De||u),string:new s}},c.prototype.delete=function(e){var t=E(this,e).delete(e);return this.size-=t?1:0,t},c.prototype.get=function(e){return E(this,e).get(e)},c.prototype.has=function(e){return E(this,e).has(e)},c.prototype.set=function(e,t){var r=E(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},f.prototype.add=f.prototype.push=function(e){return this.__data__.set(e,$),this},f.prototype.has=function(e){return this.__data__.has(e)},l.prototype.clear=function(){this.__data__=new u,this.size=0},l.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},l.prototype.get=function(e){return this.__data__.get(e)},l.prototype.has=function(e){return this.__data__.has(e)},l.prototype.set=function(e,t){var r=this.__data__;if(r instanceof u){var n=r.__data__;if(!De||n.length-1}function p(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function R(e,t){for(var r=e.length;r--&&b(t,e[r],0)>-1;);return r}function D(e){return"\\"+_r[e]}function k(e){return dr.test(e)}function M(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function U(e,t){return function(r){return e(t(r))}}function F(e,t){for(var r=-1,n=e.length,i=0,o=[];++r>>1,xe=[["ary",se],["bind",ee],["bindKey",te],["curry",ne],["curryRight",ie],["flip",ce],["partial",oe],["partialRight",ae],["rearg",ue]],Oe="[object Arguments]",je="[object Array]",Ae="[object AsyncFunction]",Se="[object Boolean]",Ie="[object Date]",Pe="[object DOMException]",Te="[object Error]",$e="[object Function]",Ce="[object GeneratorFunction]",Re="[object Map]",De="[object Number]",ke="[object Null]",Me="[object Object]",Ue="[object Promise]",Fe="[object Proxy]",Ne="[object RegExp]",Le="[object Set]",qe="[object String]",Be="[object Symbol]",ze="[object Undefined]",Ye="[object WeakMap]",We="[object WeakSet]",Ve="[object ArrayBuffer]",He="[object DataView]",Ke="[object Float32Array]",Ge="[object Float64Array]",Ze="[object Int8Array]",Xe="[object Int16Array]",Je="[object Int32Array]",Qe="[object Uint8Array]",et="[object Uint8ClampedArray]",tt="[object Uint16Array]",rt="[object Uint32Array]",nt=/\b__p \+= '';/g,it=/\b(__p \+=) '' \+/g,ot=/(__e\(.*?\)|\b__t\)) \+\n'';/g,at=/&(?:amp|lt|gt|quot|#39);/g,st=/[&<>"']/g,ut=RegExp(at.source),ct=RegExp(st.source),ft=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,pt=/<%=([\s\S]+?)%>/g,dt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ht=/^\w*$/,mt=/^\./,yt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gt=/[\\^$.*+?()[\]{}|]/g,vt=RegExp(gt.source),_t=/^\s+|\s+$/g,bt=/^\s+/,Et=/\s+$/,wt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xt=/\{\n\/\* \[wrapped with (.+)\] \*/,Ot=/,? & /,jt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,At=/\\(\\)?/g,St=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,It=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,$t=/^\[object .+?Constructor\]$/,Ct=/^0o[0-7]+$/i,Rt=/^(?:0|[1-9]\d*)$/,Dt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,kt=/($^)/,Mt=/['\n\r\u2028\u2029\\]/g,Ut="\\ud800-\\udfff",Ft="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Nt="a-z\\xdf-\\xf6\\xf8-\\xff",Lt="A-Z\\xc0-\\xd6\\xd8-\\xde",qt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Bt="["+Ut+"]",zt="["+qt+"]",Yt="["+Ft+"]",Wt="\\d+",Vt="[\\u2700-\\u27bf]",Ht="["+Nt+"]",Kt="[^"+Ut+qt+Wt+"\\u2700-\\u27bf"+Nt+Lt+"]",Gt="\\ud83c[\\udffb-\\udfff]",Zt="[^"+Ut+"]",Xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Jt="[\\ud800-\\udbff][\\udc00-\\udfff]",Qt="["+Lt+"]",er="(?:"+Ht+"|"+Kt+")",tr="(?:"+Qt+"|"+Kt+")",rr="(?:['’](?:d|ll|m|re|s|t|ve))?",nr="(?:['’](?:D|LL|M|RE|S|T|VE))?",ir="(?:"+Yt+"|"+Gt+")"+"?",or="[\\ufe0e\\ufe0f]?",ar=or+ir+("(?:\\u200d(?:"+[Zt,Xt,Jt].join("|")+")"+or+ir+")*"),sr="(?:"+[Vt,Xt,Jt].join("|")+")"+ar,ur="(?:"+[Zt+Yt+"?",Yt,Xt,Jt,Bt].join("|")+")",cr=RegExp("['’]","g"),fr=RegExp(Yt,"g"),lr=RegExp(Gt+"(?="+Gt+")|"+ur+ar,"g"),pr=RegExp([Qt+"?"+Ht+"+"+rr+"(?="+[zt,Qt,"$"].join("|")+")",tr+"+"+nr+"(?="+[zt,Qt+er,"$"].join("|")+")",Qt+"?"+er+"+"+rr,Qt+"+"+nr,"\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)","\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)",Wt,sr].join("|"),"g"),dr=RegExp("[\\u200d"+Ut+Ft+"\\ufe0e\\ufe0f]"),hr=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,mr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],yr=-1,gr={};gr[Ke]=gr[Ge]=gr[Ze]=gr[Xe]=gr[Je]=gr[Qe]=gr[et]=gr[tt]=gr[rt]=!0,gr[Oe]=gr[je]=gr[Ve]=gr[Se]=gr[He]=gr[Ie]=gr[Te]=gr[$e]=gr[Re]=gr[De]=gr[Me]=gr[Ne]=gr[Le]=gr[qe]=gr[Ye]=!1;var vr={};vr[Oe]=vr[je]=vr[Ve]=vr[He]=vr[Se]=vr[Ie]=vr[Ke]=vr[Ge]=vr[Ze]=vr[Xe]=vr[Je]=vr[Re]=vr[De]=vr[Me]=vr[Ne]=vr[Le]=vr[qe]=vr[Be]=vr[Qe]=vr[et]=vr[tt]=vr[rt]=!0,vr[Te]=vr[$e]=vr[Ye]=!1;var _r={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},br=parseFloat,Er=parseInt,wr="object"==typeof e&&e&&e.Object===Object&&e,xr="object"==typeof self&&self&&self.Object===Object&&self,Or=wr||xr||Function("return this")(),jr="object"==typeof r&&r&&!r.nodeType&&r,Ar=jr&&"object"==typeof t&&t&&!t.nodeType&&t,Sr=Ar&&Ar.exports===jr,Ir=Sr&&wr.process,Pr=function(){try{return Ir&&Ir.binding&&Ir.binding("util")}catch(e){}}(),Tr=Pr&&Pr.isArrayBuffer,$r=Pr&&Pr.isDate,Cr=Pr&&Pr.isMap,Rr=Pr&&Pr.isRegExp,Dr=Pr&&Pr.isSet,kr=Pr&&Pr.isTypedArray,Mr=O("length"),Ur=j({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Fr=j({"&":"&","<":"<",">":">",'"':""","'":"'"}),Nr=j({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Lr=function e(t){function r(e){if(po(e)&&!ru(e)&&!(e instanceof Ft)){if(e instanceof Ut)return e;if(ra.call(e,"__wrapped__"))return Mi(e)}return new Ut(e)}function j(){}function Ut(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=B}function Ft(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=be,this.__views__=[]}function Nt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function rr(e,t,r,o,a,u){var c,f=t&G,l=t&Z,p=t&X;if(r&&(c=a?r(e,o,a,u):r(e)),c!==B)return c;if(!lo(e))return e;var d=ru(e);if(d){if(c=function(e){var t=e.length,r=e.constructor(t);return t&&"string"==typeof e[0]&&ra.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!f)return Fn(e,c)}else{var h=ps(e),y=h==$e||h==Ce;if(iu(e))return Cn(e,f);if(h==Me||h==Oe||y&&!a){if(c=l||y?{}:bi(e),!f)return l?function(e,t){return Nn(e,ls(e),t)}(e,function(e,t){return e&&Nn(t,Io(t),e)}(c,e)):function(e,t){return Nn(e,fs(e),t)}(e,Jt(c,e))}else{if(!vr[h])return a?e:{};c=function(e,t,r,o){var a=e.constructor;switch(t){case Ve:return Rn(e);case Se:case Ie:return new a(+e);case He:return function(e,t){var r=t?Rn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,o);case Ke:case Ge:case Ze:case Xe:case Je:case Qe:case et:case tt:case rt:return Dn(e,o);case Re:return function(e,t,r){return m(t?r(M(e),G):M(e),n,new e.constructor)}(e,o,r);case De:case qe:return new a(e);case Ne:return function(e){var t=new e.constructor(e.source,It.exec(e));return t.lastIndex=e.lastIndex,t}(e);case Le:return function(e,t,r){return m(t?r(N(e),G):N(e),i,new e.constructor)}(e,o,r);case Be:return function(e){return Xa?Ho(Xa.call(e)):{}}(e)}}(e,h,rr,f)}}u||(u=new zt);var g=u.get(e);if(g)return g;u.set(e,c);var v=d?B:(p?l?pi:li:l?Io:So)(e);return s(v||e,function(n,i){v&&(n=e[i=n]),Gt(c,i,rr(n,t,r,i,e,u))}),c}function nr(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ho(e);n--;){var i=r[n],o=t[i],a=e[i];if(a===B&&!(i in e)||!o(a))return!1}return!0}function ir(e,t,r){if("function"!=typeof e)throw new Zo(W);return ms(function(){e.apply(B,r)},t)}function or(e,t,r,n){var i=-1,o=l,a=!0,s=e.length,u=[],c=t.length;if(!s)return u;r&&(t=d(t,P(r))),n?(o=p,a=!1):t.length>=z&&(o=$,a=!1,t=new Bt(t));e:for(;++i0&&r(s)?t>1?lr(s,t-1,r,n,i):h(i,s):n||(i[i.length]=s)}return i}function dr(e,t){return e&&rs(e,t,So)}function _r(e,t){return e&&ns(e,t,So)}function wr(e,t){return f(t,function(t){return uo(e[t])})}function xr(e,t){for(var r=0,n=(t=Tn(t,e)).length;null!=e&&rt}function Pr(e,t){return null!=e&&ra.call(e,t)}function Mr(e,t){return null!=e&&t in Ho(e)}function qr(e,t,r){for(var n=r?p:l,i=e[0].length,o=e.length,a=o,s=Bo(o),u=1/0,c=[];a--;){var f=e[a];a&&t&&(f=d(f,P(t))),u=Ca(f.length,u),s[a]=!r&&(t||i>=120&&f.length>=120)?new Bt(a&&f):B}f=e[0];var h=-1,m=s[0];e:for(;++h=s)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}(e,t,r)})}function nn(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&ya.call(s,u,1),ya.call(e,u,1);return e}function an(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;wi(i)?ya.call(e,i,1):wn(e,i)}}return e}function sn(e,t){return e+ja(ka()*(t-e+1))}function un(e,t){var r="";if(!e||t<1||t>ge)return r;do{t%2&&(r+=e),(t=ja(t/2))&&(e+=e)}while(t);return r}function cn(e,t){return ys(Pi(e,t,ko),e+"")}function fn(e){return Wt(To(e))}function ln(e,t){var r=To(e);return Ri(r,tr(t,0,r.length))}function pn(e,t,r,n){if(!lo(e))return e;for(var i=-1,o=(t=Tn(t,e)).length,a=o-1,s=e;null!=s&&++ii?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Bo(i);++n>>1,a=e[o];null!==a&&!go(a)&&(r?a<=t:a=z){var c=t?null:us(e);if(c)return N(c);a=!1,i=$,u=new Bt}else u=t?[]:s;e:for(;++n=n?e:hn(e,t,r)}function Cn(e,t){if(t)return e.slice();var r=e.length,n=pa?pa(r):new e.constructor(r);return e.copy(n),n}function Rn(e){var t=new e.constructor(e.byteLength);return new la(t).set(new la(e)),t}function Dn(e,t){var r=t?Rn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function kn(e,t){if(e!==t){var r=e!==B,n=null===e,i=e==e,o=go(e),a=t!==B,s=null===t,u=t==t,c=go(t);if(!s&&!c&&!o&&e>t||o&&a&&u&&!s&&!c||n&&a&&u||!r&&u||!i)return 1;if(!n&&!o&&!c&&e1?r[i-1]:B,a=i>2?r[2]:B;for(o=e.length>3&&"function"==typeof o?(i--,o):B,a&&xi(r[0],r[1],a)&&(o=i<3?B:o,i=1),t=Ho(t);++n-1?i[o?t[a]:a]:B}}function Kn(e){return fi(function(t){var r=t.length,n=r,i=Ut.prototype.thru;for(e&&t.reverse();n--;){var o=t[n];if("function"!=typeof o)throw new Zo(W);if(i&&!a&&"wrapper"==di(o))var a=new Ut([],!0)}for(n=a?n:r;++n1&&v.reverse(),l&&us))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var f=-1,l=!0,p=r&Q?new Bt:B;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(wt,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return s(xe,function(r){var n="_."+r[0];t&r[1]&&!l(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(xt);return t?t[1].split(Ot):[]}(n),r)))}function Ci(e){var t=0,r=0;return function(){var n=Ra(),i=de-(n-r);if(r=n,i>0){if(++t>=pe)return arguments[0]}else t=0;return e.apply(B,arguments)}}function Ri(e,t){var r=-1,n=e.length,i=n-1;for(t=t===B?n:t;++r0&&(r=t.apply(this,arguments)),e<=1&&(t=B),r}}function Qi(e,t,r){var n=oi(e,ne,B,B,B,B,B,t=r?B:t);return n.placeholder=Qi.placeholder,n}function eo(e,t,r){var n=oi(e,ie,B,B,B,B,B,t=r?B:t);return n.placeholder=eo.placeholder,n}function to(e,t,r){function n(t){var r=u,n=c;return u=c=B,h=t,l=e.apply(n,r)}function i(e){var r=e-d;return d===B||r>=t||r<0||y&&e-h>=f}function o(){var e=Ys();if(i(e))return a(e);p=ms(o,function(e){var r=t-(e-d);return y?Ca(r,f-(e-h)):r}(e))}function a(e){return p=B,g&&u?n(e):(u=c=B,l)}function s(){var e=Ys(),r=i(e);if(u=arguments,c=this,d=e,r){if(p===B)return function(e){return h=e,p=ms(o,t),m?n(e):l}(d);if(y)return p=ms(o,t),n(d)}return p===B&&(p=ms(o,t)),l}var u,c,f,l,p,d,h=0,m=!1,y=!1,g=!0;if("function"!=typeof e)throw new Zo(W);return t=wo(t)||0,lo(r)&&(m=!!r.leading,f=(y="maxWait"in r)?$a(wo(r.maxWait)||0,t):f,g="trailing"in r?!!r.trailing:g),s.cancel=function(){p!==B&&ss(p),h=0,u=d=c=p=B},s.flush=function(){return p===B?l:a(Ys())},s}function ro(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Zo(W);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ro.Cache||qt),r}function no(e){if("function"!=typeof e)throw new Zo(W);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function io(e,t){return e===t||e!=e&&t!=t}function oo(e){return null!=e&&fo(e.length)&&!uo(e)}function ao(e){return po(e)&&oo(e)}function so(e){if(!po(e))return!1;var t=Ar(e);return t==Te||t==Pe||"string"==typeof e.message&&"string"==typeof e.name&&!mo(e)}function uo(e){if(!lo(e))return!1;var t=Ar(e);return t==$e||t==Ce||t==Ae||t==Fe}function co(e){return"number"==typeof e&&e==bo(e)}function fo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ge}function lo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function po(e){return null!=e&&"object"==typeof e}function ho(e){return"number"==typeof e||po(e)&&Ar(e)==De}function mo(e){if(!po(e)||Ar(e)!=Me)return!1;var t=da(e);if(null===t)return!0;var r=ra.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ta.call(r)==aa}function yo(e){return"string"==typeof e||!ru(e)&&po(e)&&Ar(e)==qe}function go(e){return"symbol"==typeof e||po(e)&&Ar(e)==Be}function vo(e){if(!e)return[];if(oo(e))return yo(e)?q(e):Fn(e);if(va&&e[va])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[va]());var t=ps(e);return(t==Re?M:t==Le?N:To)(e)}function _o(e){return e?(e=wo(e))===ye||e===-ye?(e<0?-1:1)*ve:e==e?e:0:0===e?e:0}function bo(e){var t=_o(e),r=t%1;return t==t?r?t-r:t:0}function Eo(e){return e?tr(bo(e),0,be):0}function wo(e){if("number"==typeof e)return e;if(go(e))return _e;if(lo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=lo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(_t,"");var r=Tt.test(e);return r||Ct.test(e)?Er(e.slice(2),r?2:8):Pt.test(e)?_e:+e}function xo(e){return Nn(e,Io(e))}function Oo(e){return null==e?"":bn(e)}function jo(e,t,r){var n=null==e?B:xr(e,t);return n===B?r:n}function Ao(e,t){return null!=e&&_i(e,t,Mr)}function So(e){return oo(e)?Yt(e):Kr(e)}function Io(e){return oo(e)?Yt(e,!0):Gr(e)}function Po(e,t){if(null==e)return{};var r=d(pi(e),function(e){return[e]});return t=mi(t),nn(e,r,function(e,r){return t(e,r[0])})}function To(e){return null==e?[]:T(e,So(e))}function $o(e){return ku(Oo(e).toLowerCase())}function Co(e){return(e=Oo(e))&&e.replace(Dt,Ur).replace(fr,"")}function Ro(e,t,r){return e=Oo(e),(t=r?B:t)===B?function(e){return hr.test(e)}(e)?function(e){return e.match(pr)||[]}(e):function(e){return e.match(jt)||[]}(e):e.match(t)||[]}function Do(e){return function(){return e}}function ko(e){return e}function Mo(e){return Hr("function"==typeof e?e:rr(e,G))}function Uo(e,t,r){var n=So(t),i=wr(t,n);null!=r||lo(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=wr(t,So(t)));var o=!(lo(r)&&"chain"in r&&!r.chain),a=uo(e);return s(i,function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Fn(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,h([this.value()],arguments))})}),e}function Fo(){}function No(e){return Oi(e)?O(Di(e)):function(e){return function(t){return xr(t,e)}}(e)}function Lo(){return[]}function qo(){return!1}var Bo=(t=null==t?Or:Lr.defaults(Or.Object(),t,Lr.pick(Or,mr))).Array,zo=t.Date,Yo=t.Error,Wo=t.Function,Vo=t.Math,Ho=t.Object,Ko=t.RegExp,Go=t.String,Zo=t.TypeError,Xo=Bo.prototype,Jo=Wo.prototype,Qo=Ho.prototype,ea=t["__core-js_shared__"],ta=Jo.toString,ra=Qo.hasOwnProperty,na=0,ia=function(){var e=/[^.]+$/.exec(ea&&ea.keys&&ea.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),oa=Qo.toString,aa=ta.call(Ho),sa=Or._,ua=Ko("^"+ta.call(ra).replace(gt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ca=Sr?t.Buffer:B,fa=t.Symbol,la=t.Uint8Array,pa=ca?ca.allocUnsafe:B,da=U(Ho.getPrototypeOf,Ho),ha=Ho.create,ma=Qo.propertyIsEnumerable,ya=Xo.splice,ga=fa?fa.isConcatSpreadable:B,va=fa?fa.iterator:B,_a=fa?fa.toStringTag:B,ba=function(){try{var e=vi(Ho,"defineProperty");return e({},"",{}),e}catch(e){}}(),Ea=t.clearTimeout!==Or.clearTimeout&&t.clearTimeout,wa=zo&&zo.now!==Or.Date.now&&zo.now,xa=t.setTimeout!==Or.setTimeout&&t.setTimeout,Oa=Vo.ceil,ja=Vo.floor,Aa=Ho.getOwnPropertySymbols,Sa=ca?ca.isBuffer:B,Ia=t.isFinite,Pa=Xo.join,Ta=U(Ho.keys,Ho),$a=Vo.max,Ca=Vo.min,Ra=zo.now,Da=t.parseInt,ka=Vo.random,Ma=Xo.reverse,Ua=vi(t,"DataView"),Fa=vi(t,"Map"),Na=vi(t,"Promise"),La=vi(t,"Set"),qa=vi(t,"WeakMap"),Ba=vi(Ho,"create"),za=qa&&new qa,Ya={},Wa=ki(Ua),Va=ki(Fa),Ha=ki(Na),Ka=ki(La),Ga=ki(qa),Za=fa?fa.prototype:B,Xa=Za?Za.valueOf:B,Ja=Za?Za.toString:B,Qa=function(){function e(){}return function(t){if(!lo(t))return{};if(ha)return ha(t);e.prototype=t;var r=new e;return e.prototype=B,r}}();r.templateSettings={escape:ft,evaluate:lt,interpolate:pt,variable:"",imports:{_:r}},(r.prototype=j.prototype).constructor=r,(Ut.prototype=Qa(j.prototype)).constructor=Ut,(Ft.prototype=Qa(j.prototype)).constructor=Ft,Nt.prototype.clear=function(){this.__data__=Ba?Ba(null):{},this.size=0},Nt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Nt.prototype.get=function(e){var t=this.__data__;if(Ba){var r=t[e];return r===V?B:r}return ra.call(t,e)?t[e]:B},Nt.prototype.has=function(e){var t=this.__data__;return Ba?t[e]!==B:ra.call(t,e)},Nt.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ba&&t===B?V:t,this},Lt.prototype.clear=function(){this.__data__=[],this.size=0},Lt.prototype.delete=function(e){var t=this.__data__,r=Zt(t,e);return!(r<0||(r==t.length-1?t.pop():ya.call(t,r,1),--this.size,0))},Lt.prototype.get=function(e){var t=this.__data__,r=Zt(t,e);return r<0?B:t[r][1]},Lt.prototype.has=function(e){return Zt(this.__data__,e)>-1},Lt.prototype.set=function(e,t){var r=this.__data__,n=Zt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},qt.prototype.clear=function(){this.size=0,this.__data__={hash:new Nt,map:new(Fa||Lt),string:new Nt}},qt.prototype.delete=function(e){var t=yi(this,e).delete(e);return this.size-=t?1:0,t},qt.prototype.get=function(e){return yi(this,e).get(e)},qt.prototype.has=function(e){return yi(this,e).has(e)},qt.prototype.set=function(e,t){var r=yi(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Bt.prototype.add=Bt.prototype.push=function(e){return this.__data__.set(e,V),this},Bt.prototype.has=function(e){return this.__data__.has(e)},zt.prototype.clear=function(){this.__data__=new Lt,this.size=0},zt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},zt.prototype.get=function(e){return this.__data__.get(e)},zt.prototype.has=function(e){return this.__data__.has(e)},zt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Lt){var n=r.__data__;if(!Fa||n.length1?e[t-1]:B;return r="function"==typeof r?(e.pop(),r):B,Wi(e,r)}),ks=fi(function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return er(t,e)};return!(t>1||this.__actions__.length)&&n instanceof Ft&&wi(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:Hi,args:[i],thisArg:B}),new Ut(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(B),e})):this.thru(i)}),Ms=Ln(function(e,t,r){ra.call(e,r)?++e[r]:Qt(e,r,1)}),Us=Hn(Ui),Fs=Hn(Fi),Ns=Ln(function(e,t,r){ra.call(e,r)?e[r].push(t):Qt(e,r,[t])}),Ls=cn(function(e,t,r){var n=-1,i="function"==typeof t,a=oo(e)?Bo(e.length):[];return es(e,function(e){a[++n]=i?o(t,e,r):Br(e,t,r)}),a}),qs=Ln(function(e,t,r){Qt(e,r,t)}),Bs=Ln(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),zs=cn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&xi(e,t[0],t[1])?t=[]:r>2&&xi(t[0],t[1],t[2])&&(t=[t[0]]),rn(e,lr(t,1),[])}),Ys=wa||function(){return Or.Date.now()},Ws=cn(function(e,t,r){var n=ee;if(r.length){var i=F(r,hi(Ws));n|=oe}return oi(e,n,t,r,i)}),Vs=cn(function(e,t,r){var n=ee|te;if(r.length){var i=F(r,hi(Vs));n|=oe}return oi(t,n,e,r,i)}),Hs=cn(function(e,t){return ir(e,1,t)}),Ks=cn(function(e,t,r){return ir(e,wo(t)||0,r)});ro.Cache=qt;var Gs=as(function(e,t){var r=(t=1==t.length&&ru(t[0])?d(t[0],P(mi())):d(lr(t,1),P(mi()))).length;return cn(function(n){for(var i=-1,a=Ca(n.length,r);++i=t}),tu=zr(function(){return arguments}())?zr:function(e){return po(e)&&ra.call(e,"callee")&&!ma.call(e,"callee")},ru=Bo.isArray,nu=Tr?P(Tr):function(e){return po(e)&&Ar(e)==Ve},iu=Sa||qo,ou=$r?P($r):function(e){return po(e)&&Ar(e)==Ie},au=Cr?P(Cr):function(e){return po(e)&&ps(e)==Re},su=Rr?P(Rr):function(e){return po(e)&&Ar(e)==Ne},uu=Dr?P(Dr):function(e){return po(e)&&ps(e)==Le},cu=kr?P(kr):function(e){return po(e)&&fo(e.length)&&!!gr[Ar(e)]},fu=ti(Zr),lu=ti(function(e,t){return e<=t}),pu=qn(function(e,t){if(Ai(t)||oo(t))Nn(t,So(t),e);else for(var r in t)ra.call(t,r)&&Gt(e,r,t[r])}),du=qn(function(e,t){Nn(t,Io(t),e)}),hu=qn(function(e,t,r,n){Nn(t,Io(t),e,n)}),mu=qn(function(e,t,r,n){Nn(t,So(t),e,n)}),yu=fi(er),gu=cn(function(e){return e.push(B,ai),o(hu,B,e)}),vu=cn(function(e){return e.push(B,si),o(xu,B,e)}),_u=Zn(function(e,t,r){e[t]=r},Do(ko)),bu=Zn(function(e,t,r){ra.call(e,t)?e[t].push(r):e[t]=[r]},mi),Eu=cn(Br),wu=qn(function(e,t,r){en(e,t,r)}),xu=qn(function(e,t,r,n){en(e,t,r,n)}),Ou=fi(function(e,t){var r={};if(null==e)return r;var n=!1;t=d(t,function(t){return t=Tn(t,e),n||(n=t.length>1),t}),Nn(e,pi(e),r),n&&(r=rr(r,G|Z|X,ui));for(var i=t.length;i--;)wn(r,t[i]);return r}),ju=fi(function(e,t){return null==e?{}:function(e,t){return nn(e,t,function(t,r){return Ao(e,r)})}(e,t)}),Au=ii(So),Su=ii(Io),Iu=Wn(function(e,t,r){return t=t.toLowerCase(),e+(r?$o(t):t)}),Pu=Wn(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Tu=Wn(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),$u=Yn("toLowerCase"),Cu=Wn(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Ru=Wn(function(e,t,r){return e+(r?" ":"")+ku(t)}),Du=Wn(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),ku=Yn("toUpperCase"),Mu=cn(function(e,t){try{return o(e,B,t)}catch(e){return so(e)?e:new Yo(e)}}),Uu=fi(function(e,t){return s(t,function(t){t=Di(t),Qt(e,t,Ws(e[t],e))}),e}),Fu=Kn(),Nu=Kn(!0),Lu=cn(function(e,t){return function(r){return Br(r,e,t)}}),qu=cn(function(e,t){return function(r){return Br(e,r,t)}}),Bu=Jn(d),zu=Jn(c),Yu=Jn(g),Wu=ei(),Vu=ei(!0),Hu=Xn(function(e,t){return e+t},0),Ku=ni("ceil"),Gu=Xn(function(e,t){return e/t},1),Zu=ni("floor"),Xu=Xn(function(e,t){return e*t},1),Ju=ni("round"),Qu=Xn(function(e,t){return e-t},0);return r.after=function(e,t){if("function"!=typeof t)throw new Zo(W);return e=bo(e),function(){if(--e<1)return t.apply(this,arguments)}},r.ary=Xi,r.assign=pu,r.assignIn=du,r.assignInWith=hu,r.assignWith=mu,r.at=yu,r.before=Ji,r.bind=Ws,r.bindAll=Uu,r.bindKey=Vs,r.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ru(e)?e:[e]},r.chain=Vi,r.chunk=function(e,t,r){t=(r?xi(e,t,r):t===B)?1:$a(bo(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,o=0,a=Bo(Oa(n/t));ii?0:i+r),(n=n===B||n>i?i:bo(n))<0&&(n+=i),n=r>n?0:Eo(n);r>>0)?(e=Oo(e))&&("string"==typeof t||null!=t&&!su(t))&&!(t=bn(t))&&k(e)?$n(q(e),0,r):e.split(t,r):[]},r.spread=function(e,t){if("function"!=typeof e)throw new Zo(W);return t=null==t?0:$a(bo(t),0),cn(function(r){var n=r[t],i=$n(r,0,t);return n&&h(i,n),o(e,this,i)})},r.tail=function(e){var t=null==e?0:e.length;return t?hn(e,1,t):[]},r.take=function(e,t,r){return e&&e.length?(t=r||t===B?1:bo(t),hn(e,0,t<0?0:t)):[]},r.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?(t=r||t===B?1:bo(t),t=n-t,hn(e,t<0?0:t,n)):[]},r.takeRightWhile=function(e,t){return e&&e.length?On(e,mi(t,3),!1,!0):[]},r.takeWhile=function(e,t){return e&&e.length?On(e,mi(t,3)):[]},r.tap=function(e,t){return t(e),e},r.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new Zo(W);return lo(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),to(e,t,{leading:n,maxWait:t,trailing:i})},r.thru=Hi,r.toArray=vo,r.toPairs=Au,r.toPairsIn=Su,r.toPath=function(e){return ru(e)?d(e,Di):go(e)?[e]:Fn(gs(Oo(e)))},r.toPlainObject=xo,r.transform=function(e,t,r){var n=ru(e),i=n||iu(e)||cu(e);if(t=mi(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:lo(e)&&uo(o)?Qa(da(e)):{}}return(i?s:dr)(e,function(e,n,i){return t(r,e,n,i)}),r},r.unary=function(e){return Xi(e,1)},r.union=As,r.unionBy=Ss,r.unionWith=Is,r.uniq=function(e){return e&&e.length?En(e):[]},r.uniqBy=function(e,t){return e&&e.length?En(e,mi(t,2)):[]},r.uniqWith=function(e,t){return t="function"==typeof t?t:B,e&&e.length?En(e,B,t):[]},r.unset=function(e,t){return null==e||wn(e,t)},r.unzip=Yi,r.unzipWith=Wi,r.update=function(e,t,r){return null==e?e:xn(e,t,Pn(r))},r.updateWith=function(e,t,r,n){return n="function"==typeof n?n:B,null==e?e:xn(e,t,Pn(r),n)},r.values=To,r.valuesIn=function(e){return null==e?[]:T(e,Io(e))},r.without=Ps,r.words=Ro,r.wrap=function(e,t){return Zs(Pn(t),e)},r.xor=Ts,r.xorBy=$s,r.xorWith=Cs,r.zip=Rs,r.zipObject=function(e,t){return Sn(e||[],t||[],Gt)},r.zipObjectDeep=function(e,t){return Sn(e||[],t||[],pn)},r.zipWith=Ds,r.entries=Au,r.entriesIn=Su,r.extend=du,r.extendWith=hu,Uo(r,r),r.add=Hu,r.attempt=Mu,r.camelCase=Iu,r.capitalize=$o,r.ceil=Ku,r.clamp=function(e,t,r){return r===B&&(r=t,t=B),r!==B&&(r=(r=wo(r))==r?r:0),t!==B&&(t=(t=wo(t))==t?t:0),tr(wo(e),t,r)},r.clone=function(e){return rr(e,X)},r.cloneDeep=function(e){return rr(e,G|X)},r.cloneDeepWith=function(e,t){return t="function"==typeof t?t:B,rr(e,G|X,t)},r.cloneWith=function(e,t){return t="function"==typeof t?t:B,rr(e,X,t)},r.conformsTo=function(e,t){return null==t||nr(e,t,So(t))},r.deburr=Co,r.defaultTo=function(e,t){return null==e||e!=e?t:e},r.divide=Gu,r.endsWith=function(e,t,r){e=Oo(e),t=bn(t);var n=e.length,i=r=r===B?n:tr(bo(r),0,n);return(r-=t.length)>=0&&e.slice(r,i)==t},r.eq=io,r.escape=function(e){return(e=Oo(e))&&ct.test(e)?e.replace(st,Fr):e},r.escapeRegExp=function(e){return(e=Oo(e))&&vt.test(e)?e.replace(gt,"\\$&"):e},r.every=function(e,t,r){var n=ru(e)?c:ar;return r&&xi(e,t,r)&&(t=B),n(e,mi(t,3))},r.find=Us,r.findIndex=Ui,r.findKey=function(e,t){return v(e,mi(t,3),dr)},r.findLast=Fs,r.findLastIndex=Fi,r.findLastKey=function(e,t){return v(e,mi(t,3),_r)},r.floor=Zu,r.forEach=Ki,r.forEachRight=Gi,r.forIn=function(e,t){return null==e?e:rs(e,mi(t,3),Io)},r.forInRight=function(e,t){return null==e?e:ns(e,mi(t,3),Io)},r.forOwn=function(e,t){return e&&dr(e,mi(t,3))},r.forOwnRight=function(e,t){return e&&_r(e,mi(t,3))},r.get=jo,r.gt=Qs,r.gte=eu,r.has=function(e,t){return null!=e&&_i(e,t,Pr)},r.hasIn=Ao,r.head=Li,r.identity=ko,r.includes=function(e,t,r,n){e=oo(e)?e:To(e),r=r&&!n?bo(r):0;var i=e.length;return r<0&&(r=$a(i+r,0)),yo(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&b(e,t,r)>-1},r.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:bo(r);return i<0&&(i=$a(n+i,0)),b(e,t,i)},r.inRange=function(e,t,r){return t=_o(t),r===B?(r=t,t=0):r=_o(r),e=wo(e),function(e,t,r){return e>=Ca(t,r)&&e<$a(t,r)}(e,t,r)},r.invoke=Eu,r.isArguments=tu,r.isArray=ru,r.isArrayBuffer=nu,r.isArrayLike=oo,r.isArrayLikeObject=ao,r.isBoolean=function(e){return!0===e||!1===e||po(e)&&Ar(e)==Se},r.isBuffer=iu,r.isDate=ou,r.isElement=function(e){return po(e)&&1===e.nodeType&&!mo(e)},r.isEmpty=function(e){if(null==e)return!0;if(oo(e)&&(ru(e)||"string"==typeof e||"function"==typeof e.splice||iu(e)||cu(e)||tu(e)))return!e.length;var t=ps(e);if(t==Re||t==Le)return!e.size;if(Ai(e))return!Kr(e).length;for(var r in e)if(ra.call(e,r))return!1;return!0},r.isEqual=function(e,t){return Yr(e,t)},r.isEqualWith=function(e,t,r){var n=(r="function"==typeof r?r:B)?r(e,t):B;return n===B?Yr(e,t,B,r):!!n},r.isError=so,r.isFinite=function(e){return"number"==typeof e&&Ia(e)},r.isFunction=uo,r.isInteger=co,r.isLength=fo,r.isMap=au,r.isMatch=function(e,t){return e===t||Wr(e,t,gi(t))},r.isMatchWith=function(e,t,r){return r="function"==typeof r?r:B,Wr(e,t,gi(t),r)},r.isNaN=function(e){return ho(e)&&e!=+e},r.isNative=function(e){if(ds(e))throw new Yo(Y);return Vr(e)},r.isNil=function(e){return null==e},r.isNull=function(e){return null===e},r.isNumber=ho,r.isObject=lo,r.isObjectLike=po,r.isPlainObject=mo,r.isRegExp=su,r.isSafeInteger=function(e){return co(e)&&e>=-ge&&e<=ge},r.isSet=uu,r.isString=yo,r.isSymbol=go,r.isTypedArray=cu,r.isUndefined=function(e){return e===B},r.isWeakMap=function(e){return po(e)&&ps(e)==Ye},r.isWeakSet=function(e){return po(e)&&Ar(e)==We},r.join=function(e,t){return null==e?"":Pa.call(e,t)},r.kebabCase=Pu,r.last=qi,r.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==B&&(i=(i=bo(r))<0?$a(n+i,0):Ca(i,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,i):_(e,w,i,!0)},r.lowerCase=Tu,r.lowerFirst=$u,r.lt=fu,r.lte=lu,r.max=function(e){return e&&e.length?sr(e,ko,Ir):B},r.maxBy=function(e,t){return e&&e.length?sr(e,mi(t,2),Ir):B},r.mean=function(e){return x(e,ko)},r.meanBy=function(e,t){return x(e,mi(t,2))},r.min=function(e){return e&&e.length?sr(e,ko,Zr):B},r.minBy=function(e,t){return e&&e.length?sr(e,mi(t,2),Zr):B},r.stubArray=Lo,r.stubFalse=qo,r.stubObject=function(){return{}},r.stubString=function(){return""},r.stubTrue=function(){return!0},r.multiply=Xu,r.nth=function(e,t){return e&&e.length?tn(e,bo(t)):B},r.noConflict=function(){return Or._===this&&(Or._=sa),this},r.noop=Fo,r.now=Ys,r.pad=function(e,t,r){e=Oo(e);var n=(t=bo(t))?L(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Qn(ja(i),r)+e+Qn(Oa(i),r)},r.padEnd=function(e,t,r){e=Oo(e);var n=(t=bo(t))?L(e):0;return t&&nt){var n=e;e=t,t=n}if(r||e%1||t%1){var i=ka();return Ca(e+i*(t-e+br("1e-"+((i+"").length-1))),t)}return sn(e,t)},r.reduce=function(e,t,r){var n=ru(e)?m:A,i=arguments.length<3;return n(e,mi(t,4),r,i,es)},r.reduceRight=function(e,t,r){var n=ru(e)?y:A,i=arguments.length<3;return n(e,mi(t,4),r,i,ts)},r.repeat=function(e,t,r){return t=(r?xi(e,t,r):t===B)?1:bo(t),un(Oo(e),t)},r.replace=function(){var e=arguments,t=Oo(e[0]);return e.length<3?t:t.replace(e[1],e[2])},r.result=function(e,t,r){var n=-1,i=(t=Tn(t,e)).length;for(i||(i=1,e=B);++nge)return[];var r=be,n=Ca(e,be);t=mi(t),e-=be;for(var i=I(n,t);++r=o)return e;var s=r-L(n);if(s<1)return n;var u=a?$n(a,0,s).join(""):e.slice(0,s);if(i===B)return u+n;if(a&&(s+=u.length-s),su(i)){if(e.slice(s).search(i)){var c,f=u;for(i.global||(i=Ko(i.source,Oo(It.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var l=c.index;u=u.slice(0,l===B?s:l)}}else if(e.indexOf(bn(i),s)!=s){var p=u.lastIndexOf(i);p>-1&&(u=u.slice(0,p))}return u+n},r.unescape=function(e){return(e=Oo(e))&&ut.test(e)?e.replace(at,Nr):e},r.uniqueId=function(e){var t=++na;return Oo(e)+t},r.upperCase=Du,r.upperFirst=ku,r.each=Ki,r.eachRight=Gi,r.first=Li,Uo(r,function(){var e={};return dr(r,function(t,n){ra.call(r.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),r.VERSION="4.17.4",s(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){r[e].placeholder=r}),s(["drop","take"],function(e,t){Ft.prototype[e]=function(r){r=r===B?1:$a(bo(r),0);var n=this.__filtered__&&!t?new Ft(this):this.clone();return n.__filtered__?n.__takeCount__=Ca(r,n.__takeCount__):n.__views__.push({size:Ca(r,be),type:e+(n.__dir__<0?"Right":"")}),n},Ft.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),s(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r==he||3==r;Ft.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:mi(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),s(["head","last"],function(e,t){var r="take"+(t?"Right":"");Ft.prototype[e]=function(){return this[r](1).value()[0]}}),s(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Ft.prototype[e]=function(){return this.__filtered__?new Ft(this):this[r](1)}}),Ft.prototype.compact=function(){return this.filter(ko)},Ft.prototype.find=function(e){return this.filter(e).head()},Ft.prototype.findLast=function(e){return this.reverse().find(e)},Ft.prototype.invokeMap=cn(function(e,t){return"function"==typeof e?new Ft(this):this.map(function(r){return Br(r,e,t)})}),Ft.prototype.reject=function(e){return this.filter(no(mi(e)))},Ft.prototype.slice=function(e,t){e=bo(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Ft(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==B&&(r=(t=bo(t))<0?r.dropRight(-t):r.take(t-e)),r)},Ft.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ft.prototype.toArray=function(){return this.take(be)},dr(Ft.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=r[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(r.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof Ft,c=s[0],f=u||ru(t),l=function(e){var t=o.apply(r,h([e],s));return i&&p?t[0]:t};f&&n&&"function"==typeof c&&1!=c.length&&(u=f=!1);var p=this.__chain__,d=!!this.__actions__.length,m=a&&!p,y=u&&!d;if(!a&&f){t=y?t:new Ft(this);var g=e.apply(t,s);return g.__actions__.push({func:Hi,args:[l],thisArg:B}),new Ut(g,p)}return m&&y?e.apply(this,s):(g=this.thru(l),m?i?g.value()[0]:g.value():g)})}),s(["pop","push","shift","sort","splice","unshift"],function(e){var t=Xo[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);r.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var r=this.value();return t.apply(ru(r)?r:[],e)}return this[n](function(r){return t.apply(ru(r)?r:[],e)})}}),dr(Ft.prototype,function(e,t){var n=r[t];if(n){var i=n.name+"";(Ya[i]||(Ya[i]=[])).push({name:t,func:n})}}),Ya[Gn(B,te).name]=[{name:"wrapper",func:B}],Ft.prototype.clone=function(){var e=new Ft(this.__wrapped__);return e.__actions__=Fn(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Fn(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Fn(this.__views__),e},Ft.prototype.reverse=function(){if(this.__filtered__){var e=new Ft(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ft.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=ru(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n=this.__values__.length;return{done:e,value:e?B:this.__values__[this.__index__++]}},r.prototype.plant=function(e){for(var t,r=this;r instanceof j;){var n=Mi(r);n.__index__=0,n.__values__=B,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},r.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Ft){var t=e;return this.__actions__.length&&(t=new Ft(this)),(t=t.reverse()).__actions__.push({func:Hi,args:[zi],thisArg:B}),new Ut(t,this.__chain__)}return this.thru(zi)},r.prototype.toJSON=r.prototype.valueOf=r.prototype.value=function(){return jn(this.__wrapped__,this.__actions__)},r.prototype.first=r.prototype.head,va&&(r.prototype[va]=function(){return this}),r}();Ar?((Ar.exports=Lr)._=Lr,jr._=Lr):Or._=Lr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],88:[function(e,t,r){(function(e){!function(e,r,n){r[e]=r[e]||n(),void 0!==t&&t.exports&&(t.exports=r[e])}("Promise",void 0!==e?e:this,function(){"use strict";function e(e,t){f.add(e,t),c||(c=p(f.drain))}function t(e){var t,r=typeof e;return null==e||"object"!=r&&"function"!=r||(t=e.then),"function"==typeof t&&t}function r(){for(var e=0;e0&&e(r,u))}catch(e){i.call(new a(u),e)}}}function i(t){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=t,n.state=2,n.chain.length>0&&e(r,n))}function o(e,t,r,n){for(var i=0;i=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),o="/"===a(e,-1);return(e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"))||i||(e="."),e&&o&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),o=n(t.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u1)for(var r=1;r0&&c>u&&(c=u);for(var f=0;f=0?(l=m.substr(0,y),p=m.substr(y+1)):(l=m,p=""),d=decodeURIComponent(l),h=decodeURIComponent(p),n(a,d)?i(a[d])?a[d].push(h):a[d]=[a[d],h]:a[d]=h}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],95:[function(e,t,r){"use strict";function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n>>25)+n|0)&n|~r&i)+t[1]-389564586|0)<<12|o>>>20)+r|0)&r|~o&n)+t[2]+606105819|0)<<17|i>>>15)+o|0)&o|~i&r)+t[3]-1044525330|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[4]-176418897|0)<<7|r>>>25)+n|0)&n|~r&i)+t[5]+1200080426|0)<<12|o>>>20)+r|0)&r|~o&n)+t[6]-1473231341|0)<<17|i>>>15)+o|0)&o|~i&r)+t[7]-45705983|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[8]+1770035416|0)<<7|r>>>25)+n|0)&n|~r&i)+t[9]-1958414417|0)<<12|o>>>20)+r|0)&r|~o&n)+t[10]-42063|0)<<17|i>>>15)+o|0)&o|~i&r)+t[11]-1990404162|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&i|~n&o)+t[12]+1804603682|0)<<7|r>>>25)+n|0)&n|~r&i)+t[13]-40341101|0)<<12|o>>>20)+r|0)&r|~o&n)+t[14]-1502002290|0)<<17|i>>>15)+o|0)&o|~i&r)+t[15]+1236535329|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[1]-165796510|0)<<5|r>>>27)+n|0)&i|n&~i)+t[6]-1069501632|0)<<9|o>>>23)+r|0)&n|r&~n)+t[11]+643717713|0)<<14|i>>>18)+o|0)&r|o&~r)+t[0]-373897302|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[5]-701558691|0)<<5|r>>>27)+n|0)&i|n&~i)+t[10]+38016083|0)<<9|o>>>23)+r|0)&n|r&~n)+t[15]-660478335|0)<<14|i>>>18)+o|0)&r|o&~r)+t[4]-405537848|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[9]+568446438|0)<<5|r>>>27)+n|0)&i|n&~i)+t[14]-1019803690|0)<<9|o>>>23)+r|0)&n|r&~n)+t[3]-187363961|0)<<14|i>>>18)+o|0)&r|o&~r)+t[8]+1163531501|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n&o|i&~o)+t[13]-1444681467|0)<<5|r>>>27)+n|0)&i|n&~i)+t[2]-51403784|0)<<9|o>>>23)+r|0)&n|r&~n)+t[7]+1735328473|0)<<14|i>>>18)+o|0)&r|o&~r)+t[12]-1926607734|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[5]-378558|0)<<4|r>>>28)+n|0)^n^i)+t[8]-2022574463|0)<<11|o>>>21)+r|0)^r^n)+t[11]+1839030562|0)<<16|i>>>16)+o|0)^o^r)+t[14]-35309556|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[1]-1530992060|0)<<4|r>>>28)+n|0)^n^i)+t[4]+1272893353|0)<<11|o>>>21)+r|0)^r^n)+t[7]-155497632|0)<<16|i>>>16)+o|0)^o^r)+t[10]-1094730640|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[13]+681279174|0)<<4|r>>>28)+n|0)^n^i)+t[0]-358537222|0)<<11|o>>>21)+r|0)^r^n)+t[3]-722521979|0)<<16|i>>>16)+o|0)^o^r)+t[6]+76029189|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((o=((o+=((r=((r+=(n^i^o)+t[9]-640364487|0)<<4|r>>>28)+n|0)^n^i)+t[12]-421815835|0)<<11|o>>>21)+r|0)^r^n)+t[15]+530742520|0)<<16|i>>>16)+o|0)^o^r)+t[2]-995338651|0)<<23|n>>>9)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[0]-198630844|0)<<6|r>>>26)+n|0)|~i))+t[7]+1126891415|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[14]-1416354905|0)<<15|i>>>17)+o|0)|~r))+t[5]-57434055|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[12]+1700485571|0)<<6|r>>>26)+n|0)|~i))+t[3]-1894986606|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[10]-1051523|0)<<15|i>>>17)+o|0)|~r))+t[1]-2054922799|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[8]+1873313359|0)<<6|r>>>26)+n|0)|~i))+t[15]-30611744|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[6]-1560198380|0)<<15|i>>>17)+o|0)|~r))+t[13]+1309151649|0)<<21|n>>>11)+i|0,n=((n+=((o=((o+=(n^((r=((r+=(i^(n|~o))+t[4]-145523070|0)<<6|r>>>26)+n|0)|~i))+t[11]-1120210379|0)<<10|o>>>22)+r|0)^((i=((i+=(r^(o|~n))+t[2]+718787259|0)<<15|i>>>17)+o|0)|~r))+t[9]-343485551|0)<<21|n>>>11)+i|0,e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=i+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function i(e){var n,i,o,a,s,u,c=e.length,f=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=c;n+=64)t(f,r(e.substring(n-64,n)));for(i=(e=e.substring(n-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n>2]|=e.charCodeAt(n)<<(n%4<<3);if(o[n>>2]|=128<<(n%4<<3),n>55)for(t(f,o),n=0;n<16;n+=1)o[n]=0;return a=8*c,a=a.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),u=parseInt(a[1],16)||0,o[14]=s,o[15]=u,t(f,o),f}function o(e){var t,r="";for(t=0;t<4;t+=1)r+=f[e>>8*t+4&15]+f[e>>8*t&15];return r}function a(e){var t;for(t=0;t>16)+(t>>16)+(r>>16)<<16|65535&r},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(r,n){var i,o,a,s,u=this.byteLength,c=t(r,u),f=u;return n!==e&&(f=t(n,u)),c>f?new ArrayBuffer(0):(i=f-c,o=new ArrayBuffer(i),a=new Uint8Array(o),s=new Uint8Array(this,c,i),a.set(s),o)}}(),c.prototype.append=function(e){return this.appendBinary(s(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var n,i=this._buff.length;for(n=64;n<=i;n+=64)t(this._hash,r(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},c.prototype.end=function(e){var t,r,n=this._buff,i=n.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=n.charCodeAt(t)<<(t%4<<3);return this._finish(o,i),r=a(this._hash),e&&(r=u(r)),this.reset(),r},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,r){var n,i,o,a=r;if(e[a>>2]|=128<<(a%4<<3),a>55)for(t(this._hash,e),a=0;a<16;a+=1)e[a]=0;n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(n[2],16),o=parseInt(n[1],16)||0,e[14]=i,e[15]=o,t(this._hash,e)},c.hash=function(e,t){return c.hashBinary(s(e),t)},c.hashBinary=function(e,t){var r=a(i(e));return t?u(r):r},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var r,i=function(e,t,r){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e)),n.set(new Uint8Array(t),e.byteLength),r?n:n.buffer}(this._buff.buffer,e,!0),o=i.length;for(this._length+=e.byteLength,r=64;r<=o;r+=64)t(this._hash,n(i.subarray(r-64,r)));return this._buff=r-64>2]|=n[t]<<(t%4<<3);return this._finish(o,i),r=a(this._hash),e&&(r=u(r)),this.reset(),r},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e=c.prototype.getState.call(this);return e.buff=function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}(e.buff),e},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var r,n=e.length,i=new ArrayBuffer(n),o=new Uint8Array(i);for(r=0;r>2]|=e[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(t(f,o),r=0;r<16;r+=1)o[r]=0;return a=8*c,a=a.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),u=parseInt(a[1],16)||0,o[14]=s,o[15]=u,t(f,o),f}(new Uint8Array(e)));return r?u(i):i},c})},{}],99:[function(e,t,r){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}}),n.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,t.arguments)})},t.exports=n},{}],100:[function(e,t,r){function n(e){if(!d(e))return e;var t=[];for(var r in e)i(t,r,e[r]);return t.join("&")}function i(e,t,r){if(null!=r)if(Array.isArray(r))r.forEach(function(r){i(e,t,r)});else if(d(r))for(var n in r)i(e,t+"["+n+"]",r[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));else null===r&&e.push(encodeURIComponent(t))}function o(e){for(var t,r,n={},i=e.split("&"),o=0,a=i.length;o=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.onprogress=n.bind(null,"download"),t.upload&&(t.upload.onprogress=n.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var i=this._header["content-type"],o=this._serializer||y.serialize[i?i.split(";")[0]:""];!o&&a(i)&&(o=y.serialize["application/json"]),o&&(r=o(r))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==r?r:null),this},y.agent=function(){return new m},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){m.prototype[e.toLowerCase()]=function(t,r){var n=new y.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}}),m.prototype.del=m.prototype.delete,y.get=function(e,t,r){var n=y("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},y.head=function(e,t,r){var n=y("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},y.options=function(e,t,r){var n=y("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},y.del=c,y.delete=c,y.patch=function(e,t,r){var n=y("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},y.post=function(e,t,r){var n=y("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},y.put=function(e,t,r){var n=y("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},{"./agent-base":99,"./is-object":101,"./request-base":102,"./response-base":103,"component-emitter":6}],101:[function(e,t,r){"use strict";t.exports=function(e){return null!==e&&"object"==typeof e}},{}],102:[function(e,t,r){"use strict";function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}var i=e("./is-object");t.exports=n,n.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},n.prototype.parse=function(e){return this._parser=e,this},n.prototype.responseType=function(e){return this._responseType=e,this},n.prototype.serialize=function(e){return this._serializer=e,this},n.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},n.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var o=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];n.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~o.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},n.prototype.then=function(e,t){if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){r.end(function(r,n){r?t(r):e(n)})})}return this._fullfilledPromise.then(e,t)},n.prototype.catch=function(e){return this.then(void 0,e)},n.prototype.use=function(e){return e(this),this},n.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},n.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},n.prototype.get=function(e){return this._header[e.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(e,t){if(i(e)){for(var r in e)this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},n.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},n.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var r in e)this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)this.field(e,t[n]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic "+n(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},n.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},n.prototype.redirects=function(e){return this._maxRedirects=e,this},n.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(e){var t=i(e),r=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var n in e)this._data[n]=e[n];else"string"==typeof e?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"==r?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(r||this.type("json"),this)},n.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},n.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.substring(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.substring(0,t)+"?"+r.join("&")}}},n.prototype._appendQueryString=function(){console.trace("Unsupported")},n.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.abort(),this.callback(n)}},n.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":101}],103:[function(e,t,r){"use strict";function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}var i=e("./utils");t.exports=n,n.prototype.get=function(e){return this.header[e.toLowerCase()]},n.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var r=i.params(t);for(var n in r)this[n]=r[n];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},n.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},{"./utils":104}],104:[function(e,t,r){"use strict";r.type=function(e){return e.split(/ *; */).shift()},r.params=function(e){return e.split(/ *; */).reduce(function(e,t){var r=t.split(/ *= */),n=r.shift(),i=r.shift();return n&&i&&(e[n]=i),e},{})},r.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var r=t.split(/ *; */),n=r[0].slice(1,-1);return e[r[1].split(/ *= */)[1].slice(1,-1)]=n,e},{})},r.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},{}],105:[function(e,t,r){function n(e,t){if("object"!=typeof e)throw new Error("resourceListing must be an object");Array.isArray(t)||(t=[]);var r={},n={swagger:"2.0",info:function(e){var t={version:e.apiVersion,title:"Title was not specified"};"object"==typeof e.info&&(e.info.title&&(t.title=e.info.title),e.info.description&&(t.description=e.info.description),e.info.contact&&(t.contact={email:e.info.contact}),e.info.license&&(t.license={name:e.info.license,url:e.info.licenseUrl}),e.info.termsOfServiceUrl&&(t.termsOfService=e.info.termsOfServiceUrl));return t}(e),paths:{}};return e.authorizations&&(n.securityDefinitions=function(e,t){var r={};return Object.keys(e.authorizations).forEach(function(n){var i=e.authorizations[n],o=function(e){var t=r[e||n]={type:i.type};return i.passAs&&(t.in=i.passAs),i.keyname&&(t.name=i.keyname),t};i.grantTypes?(t[n]=[],Object.keys(i.grantTypes).forEach(function(e){var r=i.grantTypes[e],a=n+"_"+e,s=o(a);switch(t[n].push(a),s.flow="implicit"===e?"implicit":"accessCode",e){case"implicit":s.authorizationUrl=r.loginEndpoint.url;break;case"authorization_code":s.authorizationUrl=r.tokenRequestEndpoint.url,s.tokenUrl=r.tokenEndpoint.url}i.scopes&&(s.scopes={},i.scopes.forEach(function(e){s.scopes[e.scope]=e.description||"Undescribed "+e.scope}))})):o()}),r}(e,{})),e.basePath&&i(e.basePath,n),c(r,e.models),Array.isArray(e.apis)&&(t.length>0&&(n.tags=[]),e.apis.forEach(function(t){n.tags&&n.tags.push({name:t.path.replace(".{format}","").substring(1),description:t.description}),Array.isArray(t.operations)&&(n.paths[t.path]=a(t,e))})),t.forEach(function(e){e.basePath&&i(e.basePath,n),Array.isArray(e.apis)&&(e.apis.forEach(function(t){n.paths[t.path]=a(t,e)}),e.models&&Object.keys(e.models).length&&c(r,u(e.models)))}),Object.keys(r).length&&(n.definitions=u(r)),n}function i(e,t){var r=l(e);t.host=r.host,t.basePath=r.path,r.protocol&&(t.schemes=[r.protocol.substr(0,r.protocol.length-1)])}function o(e,t){return(e=p(e)).$ref&&-1===e.$ref.indexOf("#/definitions/")?e.$ref="#/definitions/"+e.$ref:e.items&&e.items.$ref&&-1===e.items.$ref.indexOf("#/definitions/")&&(e.items.$ref="#/definitions/"+e.items.$ref),t&&e.type&&-1===d.indexOf(e.type)&&(e={$ref:"#/definitions/"+e.type}),e.minimum&&(e.minimum=f(e.minimum)),e.maximum&&(e.maximum=f(e.maximum)),e.defaultValue&&(e.default=e.defaultValue,delete e.defaultValue,e.type&&"string"!==e.type&&(e.default=f(e.default))),e}function a(e,t){var r={};return e.operations.forEach(function(e){var n=e.method.toLowerCase();r[n]=function(e,t,r,n){var i={responses:{},description:e.description||""};n&&(i.tags=[],i.tags.push(n.substr(1)));e.summary&&(i.summary=e.summary);e.nickname&&(i.operationId=e.nickname);t&&(i.produces=t);r&&(i.consumes=r);Array.isArray(e.parameters)&&e.parameters.length&&(i.parameters=e.parameters.map(function(e){return function(e){var t={in:e.paramType,description:e.description,name:e.name,required:!!e.required};-1===d.indexOf(e.type)?t.schema={$ref:"#/definitions/"+e.type}:"body"===e.paramType?t.schema=s(e):c(t,s(e));"form"===t.in&&(t.in="formData");return t}(e)}));Array.isArray(e.responseMessages)&&e.responseMessages.forEach(function(e){i.responses[e.code]=function(e){var t={};return t.description=e.message,t}(e)});(!Object.keys(i.responses).length||!i.responses[200]&&e.type)&&(i.responses[200]={description:"No response was specified"});if(e.type&&"void"!==e.type){var o=s(e);-1===d.indexOf(e.type)&&(o={$ref:"#/definitions/"+e.type}),i.responses[200].schema=o}return i}(e,t.produces,t.consumes,t.resourcePath)}),r}function s(e){var t={};return e=o(e,!1),t.type=e.type.toLowerCase(),["default","maximum","minimum","items"].forEach(function(r){void 0!==e[r]&&(t[r]=e[r])}),void 0!==e.defaultValue&&(t.default=e.defaultValue),t}function u(e){var t=p(e);if("object"!=typeof e)throw new Error("models must be object");var r={};return Object.keys(t).forEach(function(e){var n=t[e];delete n.id,function(e){"object"==typeof e.properties&&Object.keys(e.properties).forEach(function(t){e.properties[t]=o(e.properties[t],!0)})}(n),n.subTypes&&(r[e]=n.subTypes,delete n.subTypes)}),Object.keys(r).forEach(function(e){r[e].forEach(function(r){var n=t[r];if(n){var i=(n.allOf||[]).concat({$ref:"#/definitions/"+e}).concat(p(n));for(var o in n)delete n[o];n.allOf=i}})}),t}function c(e,t){if("object"!=typeof e)throw new Error("source must be objects");"object"==typeof t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}function f(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){throw Error("incorect property value: "+e.message)}}var l=e("url").parse,p=e("lodash.clonedeep"),d=["string","number","boolean","integer","array","void","File"];"undefined"==typeof window?t.exports=n:window.SwaggerConverter=window.SwaggerConverter||{convert:n}},{"lodash.clonedeep":75,url:108}],106:[function(e,t,r){function n(e){this.value=e}function i(e,t,r){var n=[],i=[],a=!0;return function e(s){function p(){if("object"==typeof m.node&&null!==m.node){m.keys&&m.node_===m.node||(m.keys=u(m.node)),m.isLeaf=0==m.keys.length;for(var e=0;e1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,i=1;i1&&(n=r[0]+"@",e=r[1]);return n+function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(x,".")).split("."),t).join(".")}function u(e){for(var t=[],r=0,n=e.length;r=55296&&i<=56319&&r>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function f(e){for(var t="",r=0,n=e.length;r=194&&i<224){if(n-r>=6){var o=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&o)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(n-r>=9){var a=parseInt(e.substr(r+4,2),16),s=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&a)<<6|63&s)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function l(e,t){function r(e){var r=f(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,c).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,c).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,c).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,c).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,c).replace(t.PCT_ENCODED,i)),e}function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=!1!==t.iri?_:v;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(D);if(i){k?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=r.host.replace(n.IPV6ADDRESS,"$1")),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var o=R[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)l(r,n);else{if(r.host&&(t.domainHost||o&&o.domainHost))try{r.host=C.toASCII(r.host.replace(n.PCT_ENCODED,f).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}l(r,v)}o&&o.parse&&o.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function d(e){for(var t=[];e.length;)if(e.match(M))e=e.replace(M,"");else if(e.match(U))e=e.replace(U,"/");else if(e.match(F))e=e.replace(F,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(N);if(!r)throw new Error("Unexpected dot segment condition");var n=r[0];e=e.slice(n.length),t.push(n)}return t.join("")}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?_:v,n=[],i=R[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?C.toUnicode(e.host):C.toASCII(e.host.replace(r.PCT_ENCODED,f).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}l(e,r),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var o=function(e,t){var r=!1!==t.iri?_:v,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(String(e.host).replace(r.IPV6ADDRESS,"[$1]")),"number"==typeof e.port&&(n.push(":"),n.push(e.port.toString(10))),n.length?n.join(""):void 0}(e,t);if(void 0!==o&&("suffix"!==t.reference&&n.push("//"),n.push(o),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var a=e.path;t.absolutePath||i&&i.absolutePath||(a=d(a)),void 0===o&&(a=a.replace(/^\/\//,"/%2F")),n.push(a)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=p(h(e,r),r),t=p(h(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=d(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=d(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=d(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=d(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function y(e,t){return e&&e.toString().replace(t&&t.iri?_.PCT_ENCODED:v.PCT_ENCODED,f)}function g(e){var t=f(e);return t.match(H)?t:e}var v=o(!1),_=o(!0),b=2147483647,E=/^xn--/,w=/[^\0-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=Math.floor,A=String.fromCharCode,S=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},I=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},P=function(e,t,r){var n=0;for(e=r?j(e/700):e>>1,e+=j(e/t);e>455;n+=36)e=j(e/35);return j(n+36*e/(e+38))},T=function(e){var t=[],r=e.length,n=0,i=128,o=72,s=e.lastIndexOf("-");s<0&&(s=0);for(var u=0;u=128&&a("not-basic"),t.push(e.charCodeAt(u));for(var c=s>0?s+1:0;c=r&&a("invalid-input");var d=S(e.charCodeAt(c++));(d>=36||d>j((b-n)/l))&&a("overflow"),n+=d*l;var h=p<=o?1:p>=o+26?26:p-o;if(dj(b/m)&&a("overflow"),l*=m}var y=t.length+1;o=P(n-f,y,0==f),j(n/y)>b-i&&a("overflow"),i+=j(n/y),n%=y,t.splice(n++,0,i)}return String.fromCodePoint.apply(String,t)},$=function(e){var t=[],r=(e=u(e)).length,n=128,i=0,o=72,s=!0,c=!1,f=void 0;try{for(var l,p=e[Symbol.iterator]();!(s=(l=p.next()).done);s=!0){var d=l.value;d<128&&t.push(A(d))}}catch(e){c=!0,f=e}finally{try{!s&&p.return&&p.return()}finally{if(c)throw f}}var h=t.length,m=h;for(h&&t.push("-");m=n&&xj((b-i)/O)&&a("overflow"),i+=(y-n)*O,n=y;var S=!0,T=!1,$=void 0;try{for(var C,R=e[Symbol.iterator]();!(S=(C=R.next()).done);S=!0){var D=C.value;if(Db&&a("overflow"),D==n){for(var k=i,M=36;;M+=36){var U=M<=o?1:M>=o+26?26:M-o;if(kA-Z\\x5E-\\x7E]",'[\\"\\\\]'),H=new RegExp(z,"g"),K=new RegExp(W,"g"),G=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',V),"g"),Z=new RegExp(t("[^]",z,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),X=Z,J={scheme:"mailto",parse:function(e,t){var r=e.to=e.path?e.path.split(","):[];if(e.path=void 0,e.query){for(var n=!1,i={},o=e.query.split("&"),a=0,s=o.length;a\[\]\^\`\{\|\}\~\x7F-\xFF]/g,re={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(ee);if(r){var n="urn:"+r[1].toLowerCase(),i=R[n];i||(i=R[n]={scheme:n,parse:function(e,t){return e},serialize:R.urn.serialize}),e.scheme=n,e.path=r[2],e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){var r=e.scheme||t.scheme;if(r&&"urn"!==r){var n=r.match(Q)||["urn:"+r,r];e.scheme="urn",e.path=n[1]+":"+(e.path?e.path.replace(te,c):"")}return e}},ne=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ie={scheme:"urn:uuid",parse:function(e,t){return t.tolerant||e.path&&e.path.match(ne)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e,t){return t.tolerant||e.path&&e.path.match(ne)?e.path=(e.path||"").toLowerCase():e.scheme=void 0,R.urn.serialize(e,t)}};R.http=L,R.https=q,R.mailto=J,R.urn=re,R["urn:uuid"]=ie,e.SCHEMES=R,e.pctEncChar=c,e.pctDecChars=f,e.parse=p,e.removeDotSegments=d,e.serialize=h,e.resolveComponents=m,e.resolve=function(e,t,r){return h(m(p(e,r),p(t,r),r,!0),r)},e.normalize=function(e,t){return"string"==typeof e?e=h(p(e,t),t):"object"===n(e)&&(e=p(h(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=h(p(e,r),r):"object"===n(e)&&(e=h(e,r)),"string"==typeof t?t=h(p(t,r),r):"object"===n(t)&&(t=h(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?_.ESCAPE:v.ESCAPE,c)},e.unescapeComponent=y,Object.defineProperty(e,"__esModule",{value:!0})})},{}],108:[function(e,t,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(e,t,r){if(e&&a.isObject(e)&&e instanceof n)return e;var i=new n;return i.parse(e,t,r),i}var o=e("punycode"),a=e("./util");r.parse=i,r.resolve=function(e,t){return i(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?i(e,!1,!0).resolveObject(t):t},r.format=function(e){return a.isString(e)&&(e=i(e)),e instanceof n?e.format():n.prototype.format.call(e)},r.Url=n;var s=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(f),p=["%","/","?",";","#"].concat(l),d=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=e("querystring");n.prototype.parse=function(e,t,r){if(!a.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),i=-1!==n&&n127?R+="x":R+=C[D];if(!R.match(h)){var M=T.slice(0,j),U=T.slice(j+1),F=C.match(m);F&&(M.push(F[1]),U.unshift(F[2])),U.length&&(f="/"+U.join(".")+f),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),P||(this.hostname=o.toASCII(this.hostname));var N=this.port?":"+this.port:"",L=this.hostname||"";this.host=L+N,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==f[0]&&(f="/"+f))}if(!y[w])for(j=0,$=l.length;j<$;j++){var q=l[j];if(-1!==f.indexOf(q)){var B=encodeURIComponent(q);B===q&&(B=escape(q)),f=f.split(q).join(B)}}var z=f.indexOf("#");-1!==z&&(this.hash=f.substr(z),f=f.slice(0,z));var Y=f.indexOf("?");if(-1!==Y?(this.search=f.substr(Y),this.query=f.substr(Y+1),t&&(this.query=_.parse(this.query)),f=f.slice(0,Y)):t&&(this.search="",this.query={}),f&&(this.pathname=f),v[w]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var W=this.search||"";this.path=N+W}return this.href=this.format(),this},n.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,o="";this.host?i=e+this.host:this.hostname&&(i=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&a.isObject(this.query)&&Object.keys(this.query).length&&(o=_.stringify(this.query));var s=this.search||o&&"?"+o||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||v[t])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace("#","%23"),t+i+r+s+n},n.prototype.resolve=function(e){return this.resolveObject(i(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if(a.isString(e)){var t=new n;t.parse(e,!1,!0),e=t}for(var r=new n,i=Object.keys(this),o=0;o0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift())}return r.search=e.search,r.query=e.query,a.isNull(r.pathname)&&a.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var j=x.slice(-1)[0],A=(r.host||e.host||x.length>1)&&("."===j||".."===j)||""===j,S=0,I=x.length;I>=0;I--)"."===(j=x[I])?x.splice(I,1):".."===j?(x.splice(I,1),S++):S&&(x.splice(I,1),S--);if(!E&&!w)for(;S--;S)x.unshift("..");!E||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),A&&"/"!==x.join("/").substr(-1)&&x.push("");var P=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(O){r.hostname=r.host=P?"":x.length?x.shift():"";var T;(T=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=T.shift(),r.host=r.hostname=T.shift())}return(E=E||r.host&&x.length)&&!P&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),a.isNull(r.pathname)&&a.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":109,punycode:5,querystring:96}],109:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],110:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("./lib/toDate")),o=n(e("./lib/toFloat")),a=n(e("./lib/toInt")),s=n(e("./lib/toBoolean")),u=n(e("./lib/equals")),c=n(e("./lib/contains")),f=n(e("./lib/matches")),l=n(e("./lib/isEmail")),p=n(e("./lib/isURL")),d=n(e("./lib/isMACAddress")),h=n(e("./lib/isIP")),m=n(e("./lib/isFQDN")),y=n(e("./lib/isBoolean")),g=n(e("./lib/isAlpha")),v=n(e("./lib/isAlphanumeric")),_=n(e("./lib/isNumeric")),b=n(e("./lib/isPort")),E=n(e("./lib/isLowercase")),w=n(e("./lib/isUppercase")),x=n(e("./lib/isAscii")),O=n(e("./lib/isFullWidth")),j=n(e("./lib/isHalfWidth")),A=n(e("./lib/isVariableWidth")),S=n(e("./lib/isMultibyte")),I=n(e("./lib/isSurrogatePair")),P=n(e("./lib/isInt")),T=n(e("./lib/isFloat")),$=n(e("./lib/isDecimal")),C=n(e("./lib/isHexadecimal")),R=n(e("./lib/isDivisibleBy")),D=n(e("./lib/isHexColor")),k=n(e("./lib/isISRC")),M=n(e("./lib/isMD5")),U=n(e("./lib/isHash")),F=n(e("./lib/isJSON")),N=n(e("./lib/isEmpty")),L=n(e("./lib/isLength")),q=n(e("./lib/isByteLength")),B=n(e("./lib/isUUID")),z=n(e("./lib/isMongoId")),Y=n(e("./lib/isAfter")),W=n(e("./lib/isBefore")),V=n(e("./lib/isIn")),H=n(e("./lib/isCreditCard")),K=n(e("./lib/isISIN")),G=n(e("./lib/isISBN")),Z=n(e("./lib/isISSN")),X=n(e("./lib/isMobilePhone")),J=n(e("./lib/isCurrency")),Q=n(e("./lib/isISO8601")),ee=n(e("./lib/isISO31661Alpha2")),te=n(e("./lib/isBase64")),re=n(e("./lib/isDataURI")),ne=n(e("./lib/isMimeType")),ie=n(e("./lib/isLatLong")),oe=n(e("./lib/isPostalCode")),ae=n(e("./lib/ltrim")),se=n(e("./lib/rtrim")),ue=n(e("./lib/trim")),ce=n(e("./lib/escape")),fe=n(e("./lib/unescape")),le=n(e("./lib/stripLow")),pe=n(e("./lib/whitelist")),de=n(e("./lib/blacklist")),he=n(e("./lib/isWhitelisted")),me=n(e("./lib/normalizeEmail")),ye=n(e("./lib/util/toString")),ge={version:"9.2.0",toDate:i.default,toFloat:o.default,toInt:a.default,toBoolean:s.default,equals:u.default,contains:c.default,matches:f.default,isEmail:l.default,isURL:p.default,isMACAddress:d.default,isIP:h.default,isFQDN:m.default,isBoolean:y.default,isAlpha:g.default,isAlphanumeric:v.default,isNumeric:_.default,isPort:b.default,isLowercase:E.default,isUppercase:w.default,isAscii:x.default,isFullWidth:O.default,isHalfWidth:j.default,isVariableWidth:A.default,isMultibyte:S.default,isSurrogatePair:I.default,isInt:P.default,isFloat:T.default,isDecimal:$.default,isHexadecimal:C.default,isDivisibleBy:R.default,isHexColor:D.default,isISRC:k.default,isMD5:M.default,isHash:U.default,isJSON:F.default,isEmpty:N.default,isLength:L.default,isByteLength:q.default,isUUID:B.default,isMongoId:z.default,isAfter:Y.default,isBefore:W.default,isIn:V.default,isCreditCard:H.default,isISIN:K.default,isISBN:G.default,isISSN:Z.default,isMobilePhone:X.default,isPostalCode:oe.default,isCurrency:J.default,isISO8601:Q.default,isISO31661Alpha2:ee.default,isBase64:te.default,isDataURI:re.default,isMimeType:ne.default,isLatLong:ie.default,ltrim:ae.default,rtrim:se.default,trim:ue.default,escape:ce.default,unescape:fe.default,stripLow:le.default,whitelist:pe.default,blacklist:de.default,isWhitelisted:he.default,normalizeEmail:me.default,toString:ye.default};r.default=ge,t.exports=r.default},{"./lib/blacklist":112,"./lib/contains":113,"./lib/equals":114,"./lib/escape":115,"./lib/isAfter":116,"./lib/isAlpha":117,"./lib/isAlphanumeric":118,"./lib/isAscii":119,"./lib/isBase64":120,"./lib/isBefore":121,"./lib/isBoolean":122,"./lib/isByteLength":123,"./lib/isCreditCard":124,"./lib/isCurrency":125,"./lib/isDataURI":126,"./lib/isDecimal":127,"./lib/isDivisibleBy":128,"./lib/isEmail":129,"./lib/isEmpty":130,"./lib/isFQDN":131,"./lib/isFloat":132,"./lib/isFullWidth":133,"./lib/isHalfWidth":134,"./lib/isHash":135,"./lib/isHexColor":136,"./lib/isHexadecimal":137,"./lib/isIP":138,"./lib/isISBN":139,"./lib/isISIN":140,"./lib/isISO31661Alpha2":141,"./lib/isISO8601":142,"./lib/isISRC":143,"./lib/isISSN":144,"./lib/isIn":145,"./lib/isInt":146,"./lib/isJSON":147,"./lib/isLatLong":148,"./lib/isLength":149,"./lib/isLowercase":150,"./lib/isMACAddress":151,"./lib/isMD5":152,"./lib/isMimeType":153,"./lib/isMobilePhone":154,"./lib/isMongoId":155,"./lib/isMultibyte":156,"./lib/isNumeric":157,"./lib/isPort":158,"./lib/isPostalCode":159,"./lib/isSurrogatePair":160,"./lib/isURL":161,"./lib/isUUID":162,"./lib/isUppercase":163,"./lib/isVariableWidth":164,"./lib/isWhitelisted":165,"./lib/ltrim":166,"./lib/matches":167,"./lib/normalizeEmail":168,"./lib/rtrim":169,"./lib/stripLow":170,"./lib/toBoolean":171,"./lib/toDate":172,"./lib/toFloat":173,"./lib/toInt":174,"./lib/trim":175,"./lib/unescape":176,"./lib/util/toString":179,"./lib/whitelist":180}],111:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});for(var n,i=r.alpha={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"el-GR":/^[Α-ω]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐі]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},o=r.alphanumeric={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"el-GR":/^[0-9Α-ω]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nb-NO":/^[0-9A-ZÆØÅ]+$/i,"nl-NL":/^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[0-9A-ZÆØÅ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[0-9A-ZÅÄÖ]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},a=r.decimal={"en-US":".",ar:"٫"},s=r.englishLocales=["AU","GB","HK","IN","NZ","ZA","ZM"],u=0;u=0};var i=n(e("./util/assertString")),o=n(e("./util/toString"));t.exports=r.default},{"./util/assertString":177,"./util/toString":179}],114:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),e===t};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],115:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],116:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,i.default)(e);var r=(0,o.default)(t),n=(0,o.default)(e);return!!(n&&r&&n>r)};var i=n(e("./util/assertString")),o=n(e("./toDate"));t.exports=r.default},{"./toDate":172,"./util/assertString":177}],117:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if((0,n.default)(e),t in i.alpha)return i.alpha[t].test(e);throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./alpha");t.exports=r.default},{"./alpha":111,"./util/assertString":177}],118:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if((0,n.default)(e),t in i.alphanumeric)return i.alphanumeric[t].test(e);throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./alpha");t.exports=r.default},{"./alpha":111,"./util/assertString":177}],119:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[\x00-\x7F]+$/;t.exports=r.default},{"./util/assertString":177}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){(0,n.default)(e);var t=e.length;if(!t||t%4!=0||i.test(e))return!1;var r=e.indexOf("=");return-1===r||r===t-1||r===t-2&&"="===e[t-1]};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[^A-Z0-9+\/=]/i;t.exports=r.default},{"./util/assertString":177}],121:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,i.default)(e);var r=(0,o.default)(t),n=(0,o.default)(e);return!!(n&&r&&n=0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],123:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,i.default)(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":n(t))?(r=t.min||0,o=t.max):(r=arguments[1],o=arguments[2]);var a=encodeURI(e).split(/%..|./).length-1;return a>=r&&(void 0===o||a<=o)};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],124:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){(0,n.default)(e);var t=e.replace(/[- ]+/g,"");if(!i.test(t))return!1;for(var r=0,o=void 0,a=void 0,s=void 0,u=t.length-1;u>=0;u--)o=t.substring(u,u+1),a=parseInt(o,10),r+=s&&(a*=2)>=10?a%10+1:a,s=!s;return!(r%10!=0||!t)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|62[0-9]{14})$/;t.exports=r.default},{"./util/assertString":177}],125:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,o.default)(e),t=(0,i.default)(t,a),function(e){var t="\\d{"+e.digits_after_decimal[0]+"}";e.digits_after_decimal.forEach(function(e,r){0!==r&&(t=t+"|\\d{"+e+"}")});var r="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),n="("+["0","[1-9]\\d*","[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*"].join("|")+")?",i="(\\"+e.decimal_separator+"("+t+"))"+(e.require_decimal?"":"?"),o=n+(e.allow_decimal||e.require_decimal?i:"");return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?o+="-?":e.negative_sign_before_digits&&(o="-?"+o)),e.allow_negative_sign_placeholder?o="( (?!\\-))?"+o:e.allow_space_after_symbol?o=" ?"+o:e.allow_space_after_digits&&(o+="( (?!$))?"),e.symbol_after_digits?o+=r:o=r+o,e.allow_negatives&&(e.parens_for_negatives?o="(\\("+o+"\\)|"+o+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(o="-?"+o)),new RegExp("^(?!-? )(?=.*\\d)"+o+"$")}(t).test(e)};var i=n(e("./util/merge")),o=n(e("./util/assertString")),a={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};t.exports=r.default},{"./util/assertString":177,"./util/merge":178}],126:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9!\$&',\(\)\*\+,;=\-\._~:@\/\?%\s]*\s*$/i;t.exports=r.default},{"./util/assertString":177}],127:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if((0,o.default)(e),(t=(0,i.default)(t,s)).locale in a.decimal)return!u.includes(e.replace(/ /g,""))&&function(e){return new RegExp("^[-+]?([0-9]+)?(\\"+a.decimal[e.locale]+"[0-9]{"+e.decimal_digits+"})"+(e.force_decimal?"":"?")+"$")}(t).test(e);throw new Error("Invalid locale '"+t.locale+"'")};var i=n(e("./util/merge")),o=n(e("./util/assertString")),a=e("./alpha"),s={force_decimal:!1,decimal_digits:"1,",locale:"en-US"},u=["","-","+"];t.exports=r.default},{"./alpha":111,"./util/assertString":177,"./util/merge":178}],128:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,i.default)(e),(0,o.default)(e)%parseInt(t,10)==0};var i=n(e("./util/assertString")),o=n(e("./toFloat"));t.exports=r.default},{"./toFloat":173,"./util/assertString":177}],129:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if((0,i.default)(e),(t=(0,o.default)(t,u)).require_display_name||t.allow_display_name){var r=e.match(c);if(r)e=r[1];else if(t.require_display_name)return!1}var n=e.split("@"),h=n.pop(),m=n.join("@"),y=h.toLowerCase();if("gmail.com"!==y&&"googlemail.com"!==y||(m=m.replace(/\./g,"").toLowerCase()),!(0,a.default)(m,{max:64})||!(0,a.default)(h,{max:254}))return!1;if(!(0,s.default)(h,{require_tld:t.require_tld}))return!1;if('"'===m[0])return m=m.slice(1,m.length-1),t.allow_utf8_local_part?d.test(m):l.test(m);for(var g=t.allow_utf8_local_part?p:f,v=m.split("."),_=0;_$/i,f=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,l=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,p=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,d=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;t.exports=r.default},{"./isByteLength":123,"./isFQDN":131,"./util/assertString":177,"./util/merge":178}],130:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),0===e.length};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],131:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,i.default)(e),(t=(0,o.default)(t,a)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));var r=e.split(".");if(t.require_tld){var n=r.pop();if(!r.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(n))return!1;if(/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20]/.test(n))return!1}for(var s,u=0;u=t.min)&&(!t.hasOwnProperty("max")||e<=t.max)&&(!t.hasOwnProperty("lt")||et.gt)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./alpha");t.exports=r.default},{"./alpha":111,"./util/assertString":177}],133:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fullWidth=void 0,r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=r.fullWidth=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/},{"./util/assertString":177}],134:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.halfWidth=void 0,r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=r.halfWidth=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/},{"./util/assertString":177}],135:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),new RegExp("^[a-f0-9]{"+i[t]+"}$").test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};t.exports=r.default},{"./util/assertString":177}],136:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;t.exports=r.default},{"./util/assertString":177}],137:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[0-9A-F]+$/i;t.exports=r.default},{"./util/assertString":177}],138:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(e),!(t=String(t)))return n(e,4)||n(e,6);if("4"===t){if(!o.test(e))return!1;return e.split(".").sort(function(e,t){return e-t})[3]<=255}if("6"===t){var r=e.split(":"),s=!1,u=n(r[r.length-1],4),c=u?7:8;if(r.length>c)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),s=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),s=!0);for(var f=0;f0&&f=1:r.length===c}return!1}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),o=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,a=/^[0-9A-F]{1,4}$/i;t.exports=r.default},{"./util/assertString":177}],139:[function(e,t,r){"use strict";function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(e),!(t=String(t)))return n(e,10)||n(e,13);var r=e.replace(/[\s-]+/g,""),u=0,c=void 0;if("10"===t){if(!o.test(r))return!1;for(c=0;c<9;c++)u+=(c+1)*r.charAt(c);if("X"===r.charAt(9)?u+=100:u+=10*r.charAt(9),u%11==0)return!!r}else if("13"===t){if(!a.test(r))return!1;for(c=0;c<12;c++)u+=s[c%2]*r.charAt(c);if(r.charAt(12)-(10-u%10)%10==0)return!!r}return!1}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n;var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),o=/^(?:[0-9]{9}X|[0-9]{10})$/,a=/^(?:[0-9]{13})$/,s=[1,3];t.exports=r.default},{"./util/assertString":177}],140:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if((0,n.default)(e),!i.test(e))return!1;for(var t=e.replace(/[A-Z]/g,function(e){return parseInt(e,36)}),r=0,o=void 0,a=void 0,s=!0,u=t.length-2;u>=0;u--)o=t.substring(u,u+1),a=parseInt(o,10),r+=s&&(a*=2)>=10?a+1:a,s=!s;return parseInt(e.substr(e.length-1),10)===(1e4-r)%10};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;t.exports=r.default},{"./util/assertString":177}],141:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.includes(e.toUpperCase())};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"];t.exports=r.default},{"./util/assertString":177}],142:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;t.exports=r.default},{"./util/assertString":177}],143:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;t.exports=r.default},{"./util/assertString":177}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,n.default)(e);var r=i;if(r=t.require_hyphen?r.replace("?",""):r,!(r=t.case_sensitive?new RegExp(r):new RegExp(r,"i")).test(e))return!1;var o=e.replace("-",""),a=8,s=0,u=!0,c=!1,f=void 0;try{for(var l,p=o[Symbol.iterator]();!(u=(l=p.next()).done);u=!0){var d=l.value;s+=("X"===d.toUpperCase()?10:+d)*a,--a}}catch(e){c=!0,f=e}finally{try{!u&&p.return&&p.return()}finally{if(c)throw f}}return s%11==0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i="^\\d{4}-?\\d{3}[\\dX]$";t.exports=r.default},{"./util/assertString":177}],145:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,o.default)(e);var r=void 0;if("[object Array]"===Object.prototype.toString.call(t)){var n=[];for(r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=(0,a.default)(t[r]));return n.indexOf(e)>=0}return"object"===(void 0===t?"undefined":i(t))?t.hasOwnProperty(e):!(!t||"function"!=typeof t.indexOf)&&t.indexOf(e)>=0};var o=n(e("./util/assertString")),a=n(e("./util/toString"));t.exports=r.default},{"./util/assertString":177,"./util/toString":179}],146:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);var r=(t=t||{}).hasOwnProperty("allow_leading_zeroes")&&!t.allow_leading_zeroes?i:o,a=!t.hasOwnProperty("min")||e>=t.min,s=!t.hasOwnProperty("max")||e<=t.max,u=!t.hasOwnProperty("lt")||et.gt;return r.test(e)&&a&&s&&u&&c};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,o=/^[-+]?[0-9]+$/;t.exports=r.default},{"./util/assertString":177}],147:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e){(0,i.default)(e);try{var t=JSON.parse(e);return!!t&&"object"===(void 0===t?"undefined":n(t))}catch(e){}return!1};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],148:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if((0,n.default)(e),!e.includes(","))return!1;var t=e.split(",");return i.test(t[0])&&o.test(t[1])};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,o=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;t.exports=r.default},{"./util/assertString":177}],149:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e,t){(0,i.default)(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":n(t))?(r=t.min||0,o=t.max):(r=arguments[1],o=arguments[2]);var a=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],s=e.length-a.length;return s>=r&&(void 0===o||s<=o)};var i=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],150:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e===e.toLowerCase()};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],151:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;t.exports=r.default},{"./util/assertString":177}],152:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[a-f0-9]{32}$/;t.exports=r.default},{"./util/assertString":177}],153:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)||o.test(e)||a.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,o=/^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i,a=/^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i;t.exports=r.default},{"./util/assertString":177}],154:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){if((0,n.default)(e),t in i)return i[t].test(e);if("any"===t){for(var r in i)if(i.hasOwnProperty(r)&&i[r].test(e))return!0;return!1}throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[012]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"da-DK":/^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,"de-DE":/^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[789]\d{9}$/,"en-KE":/^(\+?254|0)?[7]\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\d{7,9}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-SG":/^(\+65)?[89]\d{7}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"et-EE":/^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"id-ID":/^(\+?62|0[1-9])[\s|\d]+$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,"kl-GL":/^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"ko-KR":/^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,"lt-LT":/^(\+370|8)\d{8}$/,"ms-MY":/^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ro-RO":/^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"sk-SK":/^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"sr-RS":/^(\+3816|06)[- \d]{5,9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"uk-UA":/^(\+?38|8)?0\d{9}$/,"vi-VN":/^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?1[345789]\d{9}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};i["en-CA"]=i["en-US"],i["fr-BE"]=i["nl-BE"],i["zh-HK"]=i["en-HK"],t.exports=r.default},{"./util/assertString":177}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,i.default)(e),(0,o.default)(e)&&24===e.length};var i=n(e("./util/assertString")),o=n(e("./isHexadecimal"));t.exports=r.default},{"./isHexadecimal":137,"./util/assertString":177}],156:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[^\x00-\x7F]/;t.exports=r.default},{"./util/assertString":177}],157:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^[-+]?[0-9]+$/;t.exports=r.default},{"./util/assertString":177}],158:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e,{min:0,max:65535})};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./isInt"));t.exports=r.default},{"./isInt":146}],159:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.locales=void 0,r.default=function(e,t){if((0,n.default)(e),t in s)return s[t].test(e);if("any"===t){for(var r in s)if(s.hasOwnProperty(r)){if(s[r].test(e))return!0}return!1}throw new Error("Invalid locale '"+t+"'")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/^\d{4}$/,o=/^\d{5}$/,a=/^\d{6}$/,s={AT:i,AU:i,BE:i,CA:/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,CH:i,CZ:/^\d{3}\s?\d{2}$/,DE:o,DK:i,DZ:o,ES:o,FI:o,FR:/^\d{2}\s?\d{3}$/,GB:/^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,GR:/^\d{3}\s?\d{2}$/,IL:o,IN:a,IS:/^\d{3}$/,IT:o,JP:/^\d{3}\-\d{4}$/,KE:o,LI:/^(948[5-9]|949[0-7])$/,MX:o,NL:/^\d{4}\s?[a-z]{2}$/i,NO:i,PL:/^\d{2}\-\d{3}$/,PT:/^\d{4}\-\d{3}?$/,RO:a,RU:a,SA:o,SE:/^\d{3}\s?\d{2}$/,TW:/^\d{3}(\d{2})?$/,US:/^\d{5}(-\d{4})?$/,ZA:i,ZM:o};r.locales=Object.keys(s)},{"./util/assertString":177}],160:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;t.exports=r.default},{"./util/assertString":177}],161:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function o(e,t){for(var r=0;r=2083||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;t=(0,c.default)(t,f);var r=void 0,n=void 0,i=void 0,p=void 0,d=void 0,h=void 0,m=void 0,y=void 0;if(m=e.split("#"),e=m.shift(),m=e.split("?"),e=m.shift(),(m=e.split("://")).length>1){if(r=m.shift(),t.require_valid_protocol&&-1===t.protocols.indexOf(r))return!1}else{if(t.require_protocol)return!1;t.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(m[0]=e.substr(2))}if(""===(e=m.join("://")))return!1;if(m=e.split("/"),""===(e=m.shift())&&!t.require_host)return!0;if((m=e.split("@")).length>1&&(n=m.shift()).indexOf(":")>=0&&n.split(":").length>2)return!1;h=null,y=null;var g=(p=m.join("@")).match(l);return g?(i="",y=g[1],h=g[2]||null):(i=(m=p.split(":")).shift(),m.length&&(h=m.join(":"))),!(null!==h&&(d=parseInt(h,10),!/^[0-9]+$/.test(h)||d<=0||d>65535)||!((0,u.default)(i)||(0,s.default)(i,t)||y&&(0,u.default)(y,6))||(i=i||y,t.host_whitelist&&!o(i,t.host_whitelist)||t.host_blacklist&&o(i,t.host_blacklist)))};var a=n(e("./util/assertString")),s=n(e("./isFQDN")),u=n(e("./isIP")),c=n(e("./util/merge")),f={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},l=/^\[([^\]]+)\](?::([0-9]+))?$/;t.exports=r.default},{"./isFQDN":131,"./isIP":138,"./util/assertString":177,"./util/merge":178}],162:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";(0,n.default)(e);var r=i[t];return r&&r.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};t.exports=r.default},{"./util/assertString":177}],163:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),e===e.toUpperCase()};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],164:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return(0,n.default)(e),i.fullWidth.test(e)&&o.halfWidth.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString")),i=e("./isFullWidth"),o=e("./isHalfWidth");t.exports=r.default},{"./isFullWidth":133,"./isHalfWidth":134,"./util/assertString":177}],165:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);for(var r=e.length-1;r>=0;r--)if(-1===t.indexOf(e[r]))return!1;return!0};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],166:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);var r=t?new RegExp("^["+t+"]+","g"):/^\s+/g;return e.replace(r,"")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],167:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t,r){return(0,n.default)(e),"[object RegExp]"!==Object.prototype.toString.call(t)&&(t=new RegExp(t,r)),t.test(e)};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],168:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){t=(0,n.default)(t,i);var r=e.split("@"),u=r.pop(),c=[r.join("@"),u];if(c[1]=c[1].toLowerCase(),"gmail.com"===c[1]||"googlemail.com"===c[1]){if(t.gmail_remove_subaddress&&(c[0]=c[0].split("+")[0]),t.gmail_remove_dots&&(c[0]=c[0].replace(/\./g,"")),!c[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(c[0]=c[0].toLowerCase()),c[1]=t.gmail_convert_googlemaildotcom?"gmail.com":c[1]}else if(~o.indexOf(c[1])){if(t.icloud_remove_subaddress&&(c[0]=c[0].split("+")[0]),!c[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(c[0]=c[0].toLowerCase())}else if(~a.indexOf(c[1])){if(t.outlookdotcom_remove_subaddress&&(c[0]=c[0].split("+")[0]),!c[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(c[0]=c[0].toLowerCase())}else if(~s.indexOf(c[1])){if(t.yahoo_remove_subaddress){var f=c[0].split("-");c[0]=f.length>1?f.slice(0,-1).join("-"):f[0]}if(!c[0].length)return!1;(t.all_lowercase||t.yahoo_lowercase)&&(c[0]=c[0].toLowerCase())}else t.all_lowercase&&(c[0]=c[0].toLowerCase());return c.join("@")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/merge")),i={all_lowercase:!0,gmail_lowercase:!0,gmail_remove_dots:!0,gmail_remove_subaddress:!0,gmail_convert_googlemaildotcom:!0,outlookdotcom_lowercase:!0,outlookdotcom_remove_subaddress:!0,yahoo_lowercase:!0,yahoo_remove_subaddress:!0,icloud_lowercase:!0,icloud_remove_subaddress:!0},o=["icloud.com","me.com"],a=["hotmail.at","hotmail.be","hotmail.ca","hotmail.cl","hotmail.co.il","hotmail.co.nz","hotmail.co.th","hotmail.co.uk","hotmail.com","hotmail.com.ar","hotmail.com.au","hotmail.com.br","hotmail.com.gr","hotmail.com.mx","hotmail.com.pe","hotmail.com.tr","hotmail.com.vn","hotmail.cz","hotmail.de","hotmail.dk","hotmail.es","hotmail.fr","hotmail.hu","hotmail.id","hotmail.ie","hotmail.in","hotmail.it","hotmail.jp","hotmail.kr","hotmail.lv","hotmail.my","hotmail.ph","hotmail.pt","hotmail.sa","hotmail.sg","hotmail.sk","live.be","live.co.uk","live.com","live.com.ar","live.com.mx","live.de","live.es","live.eu","live.fr","live.it","live.nl","msn.com","outlook.at","outlook.be","outlook.cl","outlook.co.il","outlook.co.nz","outlook.co.th","outlook.com","outlook.com.ar","outlook.com.au","outlook.com.br","outlook.com.gr","outlook.com.pe","outlook.com.tr","outlook.com.vn","outlook.cz","outlook.de","outlook.dk","outlook.es","outlook.fr","outlook.hu","outlook.id","outlook.ie","outlook.in","outlook.it","outlook.jp","outlook.kr","outlook.lv","outlook.my","outlook.ph","outlook.pt","outlook.sa","outlook.sg","outlook.sk","passport.com"],s=["rocketmail.com","yahoo.ca","yahoo.co.uk","yahoo.com","yahoo.de","yahoo.fr","yahoo.in","yahoo.it","ymail.com"];t.exports=r.default},{"./util/merge":178}],169:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){(0,n.default)(e);for(var r=t?new RegExp("["+t+"]"):/\s/,i=e.length-1;i>=0&&r.test(e[i]);)i--;return i").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],177:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){if(!("string"==typeof e||e instanceof String))throw new TypeError("This library (validator.js) validates strings only")},t.exports=r.default},{}],178:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];for(var r in t)void 0===e[r]&&(e[r]=t[r]);return e},t.exports=r.default},{}],179:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.default=function(e){return"object"===(void 0===e?"undefined":n(e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null===e||void 0===e||isNaN(e)&&!e.length)&&(e=""),String(e)},t.exports=r.default},{}],180:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e,t){return(0,n.default)(e),e.replace(new RegExp("[^"+t+"]+","g"),"")};var n=function(e){return e&&e.__esModule?e:{default:e}}(e("./util/assertString"));t.exports=r.default},{"./util/assertString":177}],181:[function(e,t,r){"use strict";t.exports={INVALID_TYPE:"Expected type {0} but found type {1}",INVALID_FORMAT:"Object didn't pass validation for format {0}: {1}",ENUM_MISMATCH:"No enum match for: {0}",ANY_OF_MISSING:"Data does not match any schemas from 'anyOf'",ONE_OF_MISSING:"Data does not match any schemas from 'oneOf'",ONE_OF_MULTIPLE:"Data is valid against more than one schema from 'oneOf'",NOT_PASSED:"Data matches schema from 'not'",ARRAY_LENGTH_SHORT:"Array is too short ({0}), minimum {1}",ARRAY_LENGTH_LONG:"Array is too long ({0}), maximum {1}",ARRAY_UNIQUE:"Array items are not unique (indexes {0} and {1})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",MULTIPLE_OF:"Value {0} is not a multiple of {1}",MINIMUM:"Value {0} is less than minimum {1}",MINIMUM_EXCLUSIVE:"Value {0} is equal or less than exclusive minimum {1}",MAXIMUM:"Value {0} is greater than maximum {1}",MAXIMUM_EXCLUSIVE:"Value {0} is equal or greater than exclusive maximum {1}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({0}), minimum {1}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({0}), maximum {1}",OBJECT_MISSING_REQUIRED_PROPERTY:"Missing required property: {0}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed: {0}",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {0} (due to key: {1})",MIN_LENGTH:"String is too short ({0} chars), minimum {1}",MAX_LENGTH:"String is too long ({0} chars), maximum {1}",PATTERN:"String does not match pattern {0}: {1}",KEYWORD_TYPE_EXPECTED:"Keyword '{0}' is expected to be of type '{1}'",KEYWORD_UNDEFINED_STRICT:"Keyword '{0}' must be defined in strict mode",KEYWORD_UNEXPECTED:"Keyword '{0}' is not expected to appear in the schema",KEYWORD_MUST_BE:"Keyword '{0}' must be {1}",KEYWORD_DEPENDENCY:"Keyword '{0}' requires keyword '{1}'",KEYWORD_PATTERN:"Keyword '{0}' is not a valid RegExp pattern: {1}",KEYWORD_VALUE_TYPE:"Each element of keyword '{0}' array must be a '{1}'",UNKNOWN_FORMAT:"There is no validation function for format '{0}'",CUSTOM_MODE_FORCE_PROPERTIES:"{0} must define at least one property if present",REF_UNRESOLVED:"Reference has not been resolved during compilation: {0}",UNRESOLVABLE_REFERENCE:"Reference could not be resolved: {0}",SCHEMA_NOT_REACHABLE:"Validator was not able to read schema with uri: {0}",SCHEMA_TYPE_EXPECTED:"Schema is expected to be of type 'object'",SCHEMA_NOT_AN_OBJECT:"Schema is not an object: {0}",ASYNC_TIMEOUT:"{0} asynchronous task(s) have timed out after {1} ms",PARENT_SCHEMA_VALIDATION_FAILED:"Schema failed to validate against its parent schema, see inner errors for details.",REMOTE_NOT_VALID:"Remote reference didn't compile successfully: {0}"}},{}],182:[function(e,t,r){var n=e("validator"),i={date:function(e){if("string"!=typeof e)return!0;var t=/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.exec(e);return null!==t&&!(t[2]<"01"||t[2]>"12"||t[3]<"01"||t[3]>"31")},"date-time":function(e){if("string"!=typeof e)return!0;var t=e.toLowerCase().split("t");if(!i.date(t[0]))return!1;var r=/^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$/.exec(t[1]);return null!==r&&!(r[1]>"23"||r[2]>"59"||r[3]>"59")},email:function(e){return"string"!=typeof e||n.isEmail(e,{require_tld:!0})},hostname:function(e){if("string"!=typeof e)return!0;var t=/^[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?(\.[a-zA-Z](([-0-9a-zA-Z]+)?[0-9a-zA-Z])?)*$/.test(e);if(t){if(e.length>255)return!1;for(var r=e.split("."),n=0;n63)return!1}return t},"host-name":function(e){return i.hostname.call(this,e)},ipv4:function(e){return"string"!=typeof e||n.isIP(e,4)},ipv6:function(e){return"string"!=typeof e||n.isIP(e,6)},regex:function(e){try{return RegExp(e),!0}catch(e){return!1}},uri:function(e){return this.options.strictUris?i["strict-uri"].apply(this,arguments):"string"!=typeof e||RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?").test(e)},"strict-uri":function(e){return"string"!=typeof e||n.isURL(e)}};t.exports=i},{validator:110}],183:[function(e,t,r){"use strict";var n=e("./FormatValidators"),i=e("./Report"),o=e("./Utils"),a={multipleOf:function(e,t,r){"number"==typeof r&&"integer"!==o.whatIs(r/t.multipleOf)&&e.addError("MULTIPLE_OF",[r,t.multipleOf],null,t.description)},maximum:function(e,t,r){"number"==typeof r&&(!0!==t.exclusiveMaximum?r>t.maximum&&e.addError("MAXIMUM",[r,t.maximum],null,t.description):r>=t.maximum&&e.addError("MAXIMUM_EXCLUSIVE",[r,t.maximum],null,t.description))},exclusiveMaximum:function(){},minimum:function(e,t,r){"number"==typeof r&&(!0!==t.exclusiveMinimum?rt.maxLength&&e.addError("MAX_LENGTH",[r.length,t.maxLength],null,t.description)},minLength:function(e,t,r){"string"==typeof r&&o.ucs2decode(r).lengtht.items.length&&e.addError("ARRAY_ADDITIONAL_ITEMS",null,null,t.description)},items:function(){},maxItems:function(e,t,r){Array.isArray(r)&&r.length>t.maxItems&&e.addError("ARRAY_LENGTH_LONG",[r.length,t.maxItems],null,t.description)},minItems:function(e,t,r){Array.isArray(r)&&r.lengtht.maxProperties&&e.addError("OBJECT_PROPERTIES_MAXIMUM",[n,t.maxProperties],null,t.description)}},minProperties:function(e,t,r){if("object"===o.whatIs(r)){var n=Object.keys(r).length;n0){var p=this.options.assumeAdditional.length;if(p)for(;p--;){var d=a.indexOf(this.options.assumeAdditional[p]);-1!==d&&a.splice(d,1)}a.length>0&&e.addError("OBJECT_ADDITIONAL_PROPERTIES",[a],null,t.description)}}}},dependencies:function(e,t,n){if("object"===o.whatIs(n))for(var i=Object.keys(t.dependencies),a=i.length;a--;){var s=i[a];if(n[s]){var u=t.dependencies[s];if("object"===o.whatIs(u))r.validate.call(this,e,u,n);else for(var c=u.length;c--;){var f=u[c];void 0===n[f]&&e.addError("OBJECT_DEPENDENCY_KEY",[f,s],null,t.description)}}}},enum:function(e,t,r){for(var n=!1,i=t.enum.length;i--;)if(o.areEqual(r,t.enum[i])){n=!0;break}!1===n&&e.addError("ENUM_MISMATCH",[r],null,t.description)},allOf:function(e,t,n){for(var i=t.allOf.length;i--;){var o=r.validate.call(this,e,t.allOf[i],n);if(this.options.breakOnFirstError&&!1===o)break}},anyOf:function(e,t,n){for(var o=[],a=!1,s=t.anyOf.length;s--&&!1===a;){var u=new i(e);o.push(u),a=r.validate.call(this,u,t.anyOf[s],n)}!1===a&&e.addError("ANY_OF_MISSING",void 0,o,t.description)},oneOf:function(e,t,n){for(var o=0,a=[],s=t.oneOf.length;s--;){var u=new i(e,{maxErrors:1});a.push(u),!0===r.validate.call(this,u,t.oneOf[s],n)&&o++}0===o?e.addError("ONE_OF_MISSING",void 0,a,t.description):o>1&&e.addError("ONE_OF_MULTIPLE",null,null,t.description)},not:function(e,t,n){var o=new i(e);!0===r.validate.call(this,o,t.not,n)&&e.addError("NOT_PASSED",null,null,t.description)},definitions:function(){},format:function(e,t,r){var i=n[t.format];"function"==typeof i?2===i.length?e.addAsyncTask(i,[r],function(n){!0!==n&&e.addError("INVALID_FORMAT",[t.format,r],null,t.description)}):!0!==i.call(this,r)&&e.addError("INVALID_FORMAT",[t.format,r],null,t.description):!0!==this.options.ignoreUnknownFormats&&e.addError("UNKNOWN_FORMAT",[t.format],null,t.description)}};r.validate=function(e,t,n){e.commonErrorMessage="JSON_OBJECT_VALIDATION_FAILED";var i=o.whatIs(t);if("object"!==i)return e.addError("SCHEMA_NOT_AN_OBJECT",[i],null,t.description),!1;var s=Object.keys(t);if(0===s.length)return!0;var u=!1;if(e.rootSchema||(e.rootSchema=t,u=!0),void 0!==t.$ref){for(var c=99;t.$ref&&c>0;){if(!t.__$refResolved){e.addError("REF_UNRESOLVED",[t.$ref],null,t.description);break}if(t.__$refResolved===t)break;t=t.__$refResolved,s=Object.keys(t),c--}if(0===c)throw new Error("Circular dependency by $ref references!")}var f=o.whatIs(n);if(t.type)if("string"==typeof t.type){if(f!==t.type&&("integer"!==f||"number"!==t.type)&&(e.addError("INVALID_TYPE",[t.type,f],null,t.description),this.options.breakOnFirstError))return!1}else if(-1===t.type.indexOf(f)&&("integer"!==f||-1===t.type.indexOf("number"))&&(e.addError("INVALID_TYPE",[t.type,f],null,t.description),this.options.breakOnFirstError))return!1;for(var l=s.length;l--&&!(a[s[l]]&&(a[s[l]].call(this,e,t,n),e.errors.length&&this.options.breakOnFirstError)););return 0!==e.errors.length&&!1!==this.options.breakOnFirstError||("array"===f?function(e,t,n){var i=n.length;if(Array.isArray(t.items))for(;i--;)i0)throw new Error("Async tasks pending, can't answer isValid");return 0===this.errors.length},n.prototype.addAsyncTask=function(e,t,r){this.asyncTasks.push([e,t,r])},n.prototype.processAsyncTasks=function(e,t){function n(){r.nextTick(function(){var e=0===c.errors.length,r=e?void 0:c.errors;t(r,e)})}function i(e){return function(t){u||(e(t),0==--a&&n())}}var o=e||2e3,a=this.asyncTasks.length,s=a,u=!1,c=this;if(0===a||this.errors.length>0)n();else{for(;s--;){var f=this.asyncTasks[s];f[0].apply(null,f[1].concat(i(f[2])))}setTimeout(function(){a>0&&(u=!0,c.addError("ASYNC_TIMEOUT",[a,o]),t(c.errors,!1))},o)}},n.prototype.getPath=function(e){var t=[];return this.parentReport&&(t=t.concat(this.parentReport.path)),t=t.concat(this.path),!0!==e&&(t="#/"+t.map(function(e){return a.isAbsoluteUri(e)?"uri("+e+")":e.replace(/\~/g,"~0").replace(/\//g,"~1")}).join("/")),t},n.prototype.getSchemaId=function(){if(!this.rootSchema)return null;var e=[];for(this.parentReport&&(e=e.concat(this.parentReport.path)),e=e.concat(this.path);e.length>0;){var t=i(this.rootSchema,e);if(t&&t.id)return t.id;e.pop()}return this.rootSchema.id},n.prototype.hasError=function(e,t){for(var r=this.errors.length;r--;)if(this.errors[r].code===e){for(var n=!0,i=this.errors[r].params.length;i--;)this.errors[r].params[i]!==t[i]&&(n=!1);if(n)return n}return!1},n.prototype.addError=function(e,t,r,n){if(!e)throw new Error("No errorCode passed into addError()");this.addCustomError(e,o[e],t,r,n)},n.prototype.addCustomError=function(e,t,r,n,i){if(!(this.errors.length>=this.reportOptions.maxErrors)){if(!t)throw new Error("No errorMessage known for code "+e);for(var o=(r=r||[]).length;o--;){var s=a.whatIs(r[o]),u="object"===s||"null"===s?JSON.stringify(r[o]):r[o];t=t.replace("{"+o+"}",u)}var c={code:e,params:r,message:t,path:this.getPath(this.options.reportPathAsArray),schemaId:this.getSchemaId()};if(i&&(c.description=i),null!=n){for(Array.isArray(n)||(n=[n]),c.inner=[],o=n.length;o--;)for(var f=n[o],l=f.errors.length;l--;)c.inner.push(f.errors[l]);0===c.inner.length&&(c.inner=void 0)}this.errors.push(c)}},t.exports=n}).call(this,e("_process"))},{"./Errors":181,"./Utils":189,_process:93,"lodash.get":78}],186:[function(e,t,r){"use strict";function n(e){return decodeURIComponent(e).replace(/~[0-1]/g,function(e){return"~1"===e?"/":"~"})}function i(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function o(e,t){if("object"==typeof e&&null!==e){if(!t)return e;if(e.id&&(e.id===t||"#"===e.id[0]&&e.id.substring(1)===t))return e;var r,n;if(Array.isArray(e)){for(r=e.length;r--;)if(n=o(e[r],t))return n}else{var i=Object.keys(e);for(r=i.length;r--;){var a=i[r];if(0!==a.indexOf("__$")&&(n=o(e[a],t)))return n}}}}var a=e("lodash.isequal"),s=e("./Report"),u=e("./SchemaCompilation"),c=e("./SchemaValidation"),f=e("./Utils");r.cacheSchemaByUri=function(e,t){var r=i(e);r&&(this.cache[r]=t)},r.removeFromCacheByUri=function(e){var t=i(e);t&&delete this.cache[t]},r.checkCacheForUri=function(e){var t=i(e);return!!t&&null!=this.cache[t]},r.getSchema=function(e,t){return"object"==typeof t&&(t=r.getSchemaByReference.call(this,e,t)),"string"==typeof t&&(t=r.getSchemaByUri.call(this,e,t)),t},r.getSchemaByReference=function(e,t){for(var r=this.referenceCache.length;r--;)if(a(this.referenceCache[r][0],t))return this.referenceCache[r][1];var n=f.cloneDeep(t);return this.referenceCache.push([t,n]),n},r.getSchemaByUri=function(e,t,r){var a=i(t),f=function(e){var t=e.indexOf("#");return-1===t?void 0:e.slice(t+1)}(t),l=a?this.cache[a]:r;if(l&&a){if(l!==r){e.path.push(a);var p=new s(e);if(u.compileSchema.call(this,p,l)){var d=this.options;try{this.options=l.__$validationOptions||this.options,c.validateSchema.call(this,p,l)}finally{this.options=d}}var h=p.isValid();if(h||e.addError("REMOTE_NOT_VALID",[t],p),e.path.pop(),!h)return}}if(l&&f)for(var m=f.split("/"),y=0,g=m.length;l&&y=55296&&t<=56319&&i0)throw new Error("This validation has async tasks and cannot be done in sync mode, please provide callback argument.");return this.lastReport=m,m.isValid()}m.processAsyncTasks(this.options.asyncTimeout,i)},i.prototype.getLastError=function(){if(0===this.lastReport.errors.length)return null;var e=new Error;return e.name="z-schema validation error",e.message=this.lastReport.commonErrorMessage,e.details=this.lastReport.errors,e},i.prototype.getLastErrors=function(){return this.lastReport&&this.lastReport.errors.length>0?this.lastReport.errors:void 0},i.prototype.getMissingReferences=function(e){for(var t=[],r=(e=e||this.lastReport.errors).length;r--;){var n=e[r];if("UNRESOLVABLE_REFERENCE"===n.code){var i=n.params[0];-1===t.indexOf(i)&&t.push(i)}n.inner&&(t=t.concat(this.getMissingReferences(n.inner)))}return t},i.prototype.getMissingRemoteReferences=function(){for(var e=this.getMissingReferences(),t=[],r=e.length;r--;){var n=c.getRemotePath(e[r]);n&&-1===t.indexOf(n)&&t.push(n)}return t},i.prototype.setRemoteReference=function(e,t,r){t="string"==typeof t?JSON.parse(t):p.cloneDeep(t),r&&(t.__$validationOptions=n(r)),c.cacheSchemaByUri.call(this,e,t)},i.prototype.getResolvedSchema=function(e){var t=new a(this.options);e=c.getSchema.call(this,t,e),e=p.cloneDeep(e);var r=[],n=function(e){var t,i=p.whatIs(e);if(("object"===i||"array"===i)&&!e.___$visited){if(e.___$visited=!0,r.push(e),e.$ref&&e.__$refResolved){var o=e.__$refResolved,a=e;delete e.$ref,delete e.__$refResolved;for(t in o)o.hasOwnProperty(t)&&(a[t]=o[t])}for(t in e)e.hasOwnProperty(t)&&(0===t.indexOf("__$")?delete e[t]:n(e[t]))}};if(n(e),r.forEach(function(e){delete e.___$visited}),this.lastReport=t,t.isValid())return e;throw this.getLastError()},i.prototype.setSchemaReader=function(e){return i.setSchemaReader(e)},i.prototype.getSchemaReader=function(){return i.schemaReader},i.setSchemaReader=function(e){i.schemaReader=e},i.registerFormat=function(e,t){s[e]=t},i.unregisterFormat=function(e){delete s[e]},i.getRegisteredFormats=function(){return Object.keys(s)},i.getDefaultOptions=function(){return p.cloneDeep(m)},t.exports=i}).call(this,e("_process"))},{"./FormatValidators":182,"./JsonValidation":183,"./Polyfills":184,"./Report":185,"./SchemaCache":186,"./SchemaCompilation":187,"./SchemaValidation":188,"./Utils":189,"./schemas/hyper-schema.json":191,"./schemas/schema.json":192,_process:93,"lodash.get":78}],191:[function(e,t,r){t.exports={$schema:"http://json-schema.org/draft-04/hyper-schema#",id:"http://json-schema.org/draft-04/hyper-schema#",title:"JSON Hyper-Schema",allOf:[{$ref:"http://json-schema.org/draft-04/schema#"}],properties:{additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}]},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}]},dependencies:{additionalProperties:{anyOf:[{$ref:"#"},{type:"array"}]}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}]},definitions:{additionalProperties:{$ref:"#"}},patternProperties:{additionalProperties:{$ref:"#"}},properties:{additionalProperties:{$ref:"#"}},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"},links:{type:"array",items:{$ref:"#/definitions/linkDescription"}},fragmentResolution:{type:"string"},media:{type:"object",properties:{type:{description:"A media type, as described in RFC 2046",type:"string"},binaryEncoding:{description:"A content encoding scheme, as described in RFC 2045",type:"string"}}},pathStart:{description:"Instances' URIs must start with this value for this schema to apply to them",type:"string",format:"uri"}},definitions:{schemaArray:{type:"array",items:{$ref:"#"}},linkDescription:{title:"Link Description Object",type:"object",required:["href","rel"],properties:{href:{description:"a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",type:"string"},rel:{description:"relation to the target resource of the link",type:"string"},title:{description:"a title for the link",type:"string"},targetSchema:{description:"JSON Schema describing the link target",$ref:"#"},mediaType:{description:"media type (as defined by RFC 2046) describing the link target",type:"string"},method:{description:'method for requesting the target of the link (e.g. for HTTP this might be "GET" or "DELETE")',type:"string"},encType:{description:"The media type in which to submit data along with the request",type:"string",default:"application/json"},schema:{description:"Schema describing the data to submit along with the request",$ref:"#"}}}}}},{}],192:[function(e,t,r){t.exports={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}}},{}],193:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/apiDeclaration.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swaggerVersion","basePath","apis"],properties:{swaggerVersion:{enum:["1.2"]},apiVersion:{type:"string"},basePath:{type:"string",format:"uri",pattern:"^https?://"},resourcePath:{type:"string",format:"uri",pattern:"^/"},apis:{type:"array",items:{$ref:"#/definitions/apiObject"}},models:{type:"object",additionalProperties:{$ref:"modelsObject.json#"}},produces:{$ref:"#/definitions/mimeTypeArray"},consumes:{$ref:"#/definitions/mimeTypeArray"},authorizations:{$ref:"authorizationObject.json#"}},additionalProperties:!1,definitions:{apiObject:{type:"object",required:["path","operations"],properties:{path:{type:"string",format:"uri-template",pattern:"^/"},description:{type:"string"},operations:{type:"array",items:{$ref:"operationObject.json#"}}},additionalProperties:!1},mimeTypeArray:{type:"array",items:{type:"string",format:"mime-type"},uniqueItems:!0}}}},{}],194:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/authorizationObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuth"},{$ref:"#/definitions/apiKey"},{$ref:"#/definitions/oauth2"}]},definitions:{basicAuth:{required:["type"],properties:{type:{enum:["basicAuth"]}},additionalProperties:!1},apiKey:{required:["type","passAs","keyname"],properties:{type:{enum:["apiKey"]},passAs:{enum:["header","query"]},keyname:{type:"string"}},additionalProperties:!1},oauth2:{type:"object",required:["type","grantTypes"],properties:{type:{enum:["oauth2"]},scopes:{type:"array",items:{$ref:"#/definitions/oauth2Scope"}},grantTypes:{$ref:"oauth2GrantType.json#"}},additionalProperties:!1},oauth2Scope:{type:"object",required:["scope"],properties:{scope:{type:"string"},description:{type:"string"}},additionalProperties:!1}}}},{}],195:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/dataType.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"Data type as described by the specification (version 1.2)",type:"object",oneOf:[{$ref:"#/definitions/refType"},{$ref:"#/definitions/voidType"},{$ref:"#/definitions/primitiveType"},{$ref:"#/definitions/modelType"},{$ref:"#/definitions/arrayType"}],definitions:{refType:{required:["$ref"],properties:{$ref:{type:"string"}},additionalProperties:!1},voidType:{enum:[{type:"void"}]},modelType:{required:["type"],properties:{type:{type:"string",not:{enum:["boolean","integer","number","string","array"]}}},additionalProperties:!1},primitiveType:{required:["type"],properties:{type:{enum:["boolean","integer","number","string"]},format:{type:"string"},defaultValue:{not:{type:["array","object","null"]}},enum:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0},minimum:{type:"string"},maximum:{type:"string"}},additionalProperties:!1,dependencies:{format:{oneOf:[{properties:{type:{enum:["integer"]},format:{enum:["int32","int64"]}}},{properties:{type:{enum:["number"]},format:{enum:["float","double"]}}},{properties:{type:{enum:["string"]},format:{enum:["byte","date","date-time"]}}}]},enum:{properties:{type:{enum:["string"]}}},minimum:{properties:{type:{enum:["integer","number"]}}},maximum:{properties:{type:{enum:["integer","number"]}}}}},arrayType:{required:["type","items"],properties:{type:{enum:["array"]},items:{type:"array",items:{$ref:"#/definitions/itemsObject"}},uniqueItems:{type:"boolean"}},additionalProperties:!1},itemsObject:{oneOf:[{$ref:"#/definitions/refType"},{allOf:[{$ref:"#/definitions/primitiveType"},{properties:{type:{},format:{}},additionalProperties:!1}]}]}}}},{}],196:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"Data type fields (section 4.3.3)",type:"object",oneOf:[{required:["type"]},{required:["$ref"]}],properties:{type:{type:"string"},$ref:{type:"string"},format:{type:"string"},defaultValue:{not:{type:["array","object","null"]}},enum:{type:"array",items:{type:"string"},uniqueItems:!0,minItems:1},minimum:{type:"string"},maximum:{type:"string"},items:{$ref:"#/definitions/itemsObject"},uniqueItems:{type:"boolean"}},dependencies:{format:{oneOf:[{properties:{type:{enum:["integer"]},format:{enum:["int32","int64"]}}},{properties:{type:{enum:["number"]},format:{enum:["float","double"]}}},{properties:{type:{enum:["string"]},format:{enum:["byte","date","date-time"]}}}]}},definitions:{itemsObject:{oneOf:[{type:"object",required:["$ref"],properties:{$ref:{type:"string"}},additionalProperties:!1},{allOf:[{$ref:"#"},{required:["type"],properties:{type:{},format:{}},additionalProperties:!1}]}]}}}},{}],197:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/infoObject.json#",$schema:"http://json-schema.org/draft-04/schema#",description:"info object (section 5.1.3)",type:"object",required:["title","description"],properties:{title:{type:"string"},description:{type:"string"},termsOfServiceUrl:{type:"string",format:"uri"},contact:{type:"string",format:"email"},license:{type:"string"},licenseUrl:{type:"string",format:"uri"}},additionalProperties:!1}},{}],198:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/modelsObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["id","properties"],properties:{id:{type:"string"},description:{type:"string"},properties:{type:"object",additionalProperties:{$ref:"#/definitions/propertyObject"}},subTypes:{type:"array",items:{type:"string"},uniqueItems:!0},discriminator:{type:"string"}},dependencies:{subTypes:["discriminator"]},definitions:{propertyObject:{allOf:[{not:{$ref:"#"}},{$ref:"dataTypeBase.json#"}]}}}},{}],199:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/oauth2GrantType.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",minProperties:1,properties:{implicit:{$ref:"#/definitions/implicit"},authorization_code:{$ref:"#/definitions/authorizationCode"}},definitions:{implicit:{type:"object",required:["loginEndpoint"],properties:{loginEndpoint:{$ref:"#/definitions/loginEndpoint"},tokenName:{type:"string"}},additionalProperties:!1},authorizationCode:{type:"object",required:["tokenEndpoint","tokenRequestEndpoint"],properties:{tokenEndpoint:{$ref:"#/definitions/tokenEndpoint"},tokenRequestEndpoint:{$ref:"#/definitions/tokenRequestEndpoint"}},additionalProperties:!1},loginEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"}},additionalProperties:!1},tokenEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"},tokenName:{type:"string"}},additionalProperties:!1},tokenRequestEndpoint:{type:"object",required:["url"],properties:{url:{type:"string",format:"uri"},clientIdName:{type:"string"},clientSecretName:{type:"string"}},additionalProperties:!1}}}},{}],200:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/operationObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",allOf:[{$ref:"dataTypeBase.json#"},{required:["method","nickname","parameters"],properties:{method:{enum:["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS"]},summary:{type:"string",maxLength:120},notes:{type:"string"},nickname:{type:"string",pattern:"^[a-zA-Z0-9_]+$"},authorizations:{type:"object",additionalProperties:{type:"array",items:{$ref:"authorizationObject.json#/definitions/oauth2Scope"}}},parameters:{type:"array",items:{$ref:"parameterObject.json#"}},responseMessages:{type:"array",items:{$ref:"#/definitions/responseMessageObject"}},produces:{$ref:"#/definitions/mimeTypeArray"},consumes:{$ref:"#/definitions/mimeTypeArray"},deprecated:{enum:["true","false"]}}}],definitions:{responseMessageObject:{type:"object",required:["code","message"],properties:{code:{$ref:"#/definitions/rfc2616section10"},message:{type:"string"},responseModel:{type:"string"}}},rfc2616section10:{type:"integer",minimum:100,maximum:600,exclusiveMaximum:!0},mimeTypeArray:{type:"array",items:{type:"string",format:"mime-type"},uniqueItems:!0}}}},{}],201:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/parameterObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",allOf:[{$ref:"dataTypeBase.json#"},{required:["paramType","name"],properties:{paramType:{enum:["path","query","body","header","form"]},name:{type:"string"},description:{type:"string"},required:{type:"boolean"},allowMultiple:{type:"boolean"}}},{description:"type File requires special paramType and consumes",oneOf:[{properties:{type:{not:{enum:["File"]}}}},{properties:{type:{enum:["File"]},paramType:{enum:["form"]},consumes:{enum:["multipart/form-data"]}}}]}]}},{}],202:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/resourceListing.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swaggerVersion","apis"],properties:{swaggerVersion:{enum:["1.2"]},apis:{type:"array",items:{$ref:"resourceObject.json#"}},apiVersion:{type:"string"},info:{$ref:"infoObject.json#"},authorizations:{$ref:"authorizationObject.json#"}}}},{}],203:[function(e,t,r){t.exports={id:"http://wordnik.github.io/schemas/v1.2/resourceObject.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["path"],properties:{path:{type:"string",format:"uri"},description:{type:"string"}},additionalProperties:!1}},{}],204:[function(e,t,r){t.exports={title:"A JSON Schema for Swagger 2.0 API.",id:"http://swagger.io/v2/schema.json#",$schema:"http://json-schema.org/draft-04/schema#",type:"object",required:["swagger","info","paths"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{swagger:{type:"string",enum:["2.0"],description:"The Swagger version of this document."},info:{$ref:"#/definitions/info"},host:{type:"string",pattern:"^[^{}/ :\\\\]+(?::\\d+)?$",description:"The host (name or ip) of the API. Example: 'swagger.io'"},basePath:{type:"string",pattern:"^/",description:"The base path to the API. Example: '/api'."},schemes:{$ref:"#/definitions/schemesList"},consumes:{description:"A list of MIME types accepted by the API.",$ref:"#/definitions/mediaTypeList"},produces:{description:"A list of MIME types the API can produce.",$ref:"#/definitions/mediaTypeList"},paths:{$ref:"#/definitions/paths"},definitions:{$ref:"#/definitions/definitions"},parameters:{$ref:"#/definitions/parameterDefinitions"},responses:{$ref:"#/definitions/responseDefinitions"},security:{$ref:"#/definitions/security"},securityDefinitions:{$ref:"#/definitions/securityDefinitions"},tags:{type:"array",items:{$ref:"#/definitions/tag"},uniqueItems:!0},externalDocs:{$ref:"#/definitions/externalDocs"}},definitions:{info:{type:"object",description:"General information about the API.",required:["version","title"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{title:{type:"string",description:"A unique and precise title of the API."},version:{type:"string",description:"A semantic version number of the API."},description:{type:"string",description:"A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."},termsOfService:{type:"string",description:"The terms of service for the API."},contact:{$ref:"#/definitions/contact"},license:{$ref:"#/definitions/license"}}},contact:{type:"object",description:"Contact information for the owners of the API.",additionalProperties:!1,properties:{name:{type:"string",description:"The identifying name of the contact person/organization."},url:{type:"string",description:"The URL pointing to the contact information.",format:"uri"},email:{type:"string",description:"The email address of the contact person/organization.",format:"email"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},license:{type:"object",required:["name"],additionalProperties:!1,properties:{name:{type:"string",description:"The name of the license type. It's encouraged to use an OSI compatible license."},url:{type:"string",description:"The URL pointing to the license.",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},paths:{type:"object",description:"Relative paths to the individual endpoints. They must be relative to the 'basePath'.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"},"^/":{$ref:"#/definitions/pathItem"}},additionalProperties:!1},definitions:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},description:"One or more JSON objects describing the schemas being consumed and produced by the API."},parameterDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/parameter"},description:"One or more JSON representations for parameters"},responseDefinitions:{type:"object",additionalProperties:{$ref:"#/definitions/response"},description:"One or more JSON representations for parameters"},externalDocs:{type:"object",additionalProperties:!1,description:"information about external documentation",required:["url"],properties:{description:{type:"string"},url:{type:"string",format:"uri"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},examples:{type:"object",additionalProperties:!0},mimeType:{type:"string",description:"The MIME type of the HTTP message."},operation:{type:"object",required:["responses"],additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{tags:{type:"array",items:{type:"string"},uniqueItems:!0},summary:{type:"string",description:"A brief summary of the operation."},description:{type:"string",description:"A longer description of the operation, GitHub Flavored Markdown is allowed."},externalDocs:{$ref:"#/definitions/externalDocs"},operationId:{type:"string",description:"A unique identifier of the operation."},produces:{description:"A list of MIME types the API can produce.",$ref:"#/definitions/mediaTypeList"},consumes:{description:"A list of MIME types the API can consume.",$ref:"#/definitions/mediaTypeList"},parameters:{$ref:"#/definitions/parametersList"},responses:{$ref:"#/definitions/responses"},schemes:{$ref:"#/definitions/schemesList"},deprecated:{type:"boolean",default:!1},security:{$ref:"#/definitions/security"}}},pathItem:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},get:{$ref:"#/definitions/operation"},put:{$ref:"#/definitions/operation"},post:{$ref:"#/definitions/operation"},delete:{$ref:"#/definitions/operation"},options:{$ref:"#/definitions/operation"},head:{$ref:"#/definitions/operation"},patch:{$ref:"#/definitions/operation"},parameters:{$ref:"#/definitions/parametersList"}}},responses:{type:"object",description:"Response objects names can either be any valid HTTP status code or 'default'.",minProperties:1,additionalProperties:!1,patternProperties:{"^([0-9]{3})$|^(default)$":{$ref:"#/definitions/responseValue"},"^x-":{$ref:"#/definitions/vendorExtension"}},not:{type:"object",additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}}},responseValue:{oneOf:[{$ref:"#/definitions/response"},{$ref:"#/definitions/jsonReference"}]},response:{type:"object",required:["description"],properties:{description:{type:"string"},schema:{oneOf:[{$ref:"#/definitions/schema"},{$ref:"#/definitions/fileSchema"}]},headers:{$ref:"#/definitions/headers"},examples:{$ref:"#/definitions/examples"}},additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},headers:{type:"object",additionalProperties:{$ref:"#/definitions/header"}},header:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},vendorExtension:{description:"Any property starting with x- is valid.",additionalProperties:!0,additionalItems:!0},bodyParameter:{type:"object",required:["name","in","schema"],patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},in:{type:"string",description:"Determines the location of the parameter.",enum:["body"]},required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},schema:{$ref:"#/definitions/schema"}},additionalProperties:!1},headerParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["header"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},queryParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["query"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},formDataParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{required:{type:"boolean",description:"Determines whether or not this parameter is required or optional.",default:!1},in:{type:"string",description:"Determines the location of the parameter.",enum:["formData"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},allowEmptyValue:{type:"boolean",default:!1,description:"allows sending a parameter by name only or with an empty value."},type:{type:"string",enum:["string","number","boolean","integer","array","file"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormatWithMulti"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},pathParameterSubSchema:{additionalProperties:!1,patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["required"],properties:{required:{type:"boolean",enum:[!0],description:"Determines whether or not this parameter is required or optional."},in:{type:"string",description:"Determines the location of the parameter.",enum:["path"]},description:{type:"string",description:"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."},name:{type:"string",description:"The name of the parameter."},type:{type:"string",enum:["string","number","boolean","integer","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}}},nonBodyParameter:{type:"object",required:["name","in","type"],oneOf:[{$ref:"#/definitions/headerParameterSubSchema"},{$ref:"#/definitions/formDataParameterSubSchema"},{$ref:"#/definitions/queryParameterSubSchema"},{$ref:"#/definitions/pathParameterSubSchema"}]},parameter:{oneOf:[{$ref:"#/definitions/bodyParameter"},{$ref:"#/definitions/nonBodyParameter"}]},schema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},properties:{$ref:{type:"string"},format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},maxProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minProperties:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},additionalProperties:{anyOf:[{$ref:"#/definitions/schema"},{type:"boolean"}],default:{}},type:{$ref:"http://json-schema.org/draft-04/schema#/properties/type"},items:{anyOf:[{$ref:"#/definitions/schema"},{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}}],default:{}},allOf:{type:"array",minItems:1,items:{$ref:"#/definitions/schema"}},properties:{type:"object",additionalProperties:{$ref:"#/definitions/schema"},default:{}},discriminator:{type:"string"},readOnly:{type:"boolean",default:!1},xml:{$ref:"#/definitions/xml"},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},fileSchema:{type:"object",description:"A deterministic version of a JSON Schema object.",patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}},required:["type"],properties:{format:{type:"string"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},required:{$ref:"http://json-schema.org/draft-04/schema#/definitions/stringArray"},type:{type:"string",enum:["file"]},readOnly:{type:"boolean",default:!1},externalDocs:{$ref:"#/definitions/externalDocs"},example:{}},additionalProperties:!1},primitivesItems:{type:"object",additionalProperties:!1,properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:{$ref:"#/definitions/primitivesItems"},collectionFormat:{$ref:"#/definitions/collectionFormat"},default:{$ref:"#/definitions/default"},maximum:{$ref:"#/definitions/maximum"},exclusiveMaximum:{$ref:"#/definitions/exclusiveMaximum"},minimum:{$ref:"#/definitions/minimum"},exclusiveMinimum:{$ref:"#/definitions/exclusiveMinimum"},maxLength:{$ref:"#/definitions/maxLength"},minLength:{$ref:"#/definitions/minLength"},pattern:{$ref:"#/definitions/pattern"},maxItems:{$ref:"#/definitions/maxItems"},minItems:{$ref:"#/definitions/minItems"},uniqueItems:{$ref:"#/definitions/uniqueItems"},enum:{$ref:"#/definitions/enum"},multipleOf:{$ref:"#/definitions/multipleOf"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},security:{type:"array",items:{$ref:"#/definitions/securityRequirement"},uniqueItems:!0},securityRequirement:{type:"object",additionalProperties:{type:"array",items:{type:"string"},uniqueItems:!0}},xml:{type:"object",additionalProperties:!1,properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean",default:!1},wrapped:{type:"boolean",default:!1}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},tag:{type:"object",additionalProperties:!1,required:["name"],properties:{name:{type:"string"},description:{type:"string"},externalDocs:{$ref:"#/definitions/externalDocs"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},securityDefinitions:{type:"object",additionalProperties:{oneOf:[{$ref:"#/definitions/basicAuthenticationSecurity"},{$ref:"#/definitions/apiKeySecurity"},{$ref:"#/definitions/oauth2ImplicitSecurity"},{$ref:"#/definitions/oauth2PasswordSecurity"},{$ref:"#/definitions/oauth2ApplicationSecurity"},{$ref:"#/definitions/oauth2AccessCodeSecurity"}]}},basicAuthenticationSecurity:{type:"object",additionalProperties:!1,required:["type"],properties:{type:{type:"string",enum:["basic"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},apiKeySecurity:{type:"object",additionalProperties:!1,required:["type","name","in"],properties:{type:{type:"string",enum:["apiKey"]},name:{type:"string"},in:{type:"string",enum:["header","query"]},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ImplicitSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["implicit"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2PasswordSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["password"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2ApplicationSecurity:{type:"object",additionalProperties:!1,required:["type","flow","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["application"]},scopes:{$ref:"#/definitions/oauth2Scopes"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2AccessCodeSecurity:{type:"object",additionalProperties:!1,required:["type","flow","authorizationUrl","tokenUrl"],properties:{type:{type:"string",enum:["oauth2"]},flow:{type:"string",enum:["accessCode"]},scopes:{$ref:"#/definitions/oauth2Scopes"},authorizationUrl:{type:"string",format:"uri"},tokenUrl:{type:"string",format:"uri"},description:{type:"string"}},patternProperties:{"^x-":{$ref:"#/definitions/vendorExtension"}}},oauth2Scopes:{type:"object",additionalProperties:{type:"string"}},mediaTypeList:{type:"array",items:{$ref:"#/definitions/mimeType"},uniqueItems:!0},parametersList:{type:"array",description:"The parameters needed to send a valid API call.",additionalItems:!1,items:{oneOf:[{$ref:"#/definitions/parameter"},{$ref:"#/definitions/jsonReference"}]},uniqueItems:!0},schemesList:{type:"array",description:"The transfer protocol of the API.",items:{type:"string",enum:["http","https","ws","wss"]},uniqueItems:!0},collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes"],default:"csv"},collectionFormatWithMulti:{type:"string",enum:["csv","ssv","tsv","pipes","multi"],default:"csv"},title:{$ref:"http://json-schema.org/draft-04/schema#/properties/title"},description:{$ref:"http://json-schema.org/draft-04/schema#/properties/description"},default:{$ref:"http://json-schema.org/draft-04/schema#/properties/default"},multipleOf:{$ref:"http://json-schema.org/draft-04/schema#/properties/multipleOf"},maximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/maximum"},exclusiveMaximum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"},minimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/minimum"},exclusiveMinimum:{$ref:"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"},maxLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minLength:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},pattern:{$ref:"http://json-schema.org/draft-04/schema#/properties/pattern"},maxItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveInteger"},minItems:{$ref:"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"},uniqueItems:{$ref:"http://json-schema.org/draft-04/schema#/properties/uniqueItems"},enum:{$ref:"http://json-schema.org/draft-04/schema#/properties/enum"},jsonReference:{type:"object",required:["$ref"],additionalProperties:!1,properties:{$ref:{type:"string"}}}}}},{}],205:[function(e,t,r){t.exports={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}}},{}]},{},[2])(2)}); \ No newline at end of file diff --git a/browser/swagger-tools-standalone.js b/browser/swagger-tools-standalone.js index 6c672bb6d0..063cd5cfc8 100755 --- a/browser/swagger-tools-standalone.js +++ b/browser/swagger-tools-standalone.js @@ -262,7 +262,7 @@ module.exports.swaggerOperationMethods = [ 'PUT' ]; -},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":204,"json-refs":57,"lodash":89,"traverse":108,"z-schema":189}],2:[function(require,module,exports){ +},{"../lib/specs":2,"../schemas/json-schema-draft-04.json":205,"json-refs":57,"lodash":87,"traverse":106,"z-schema":190}],2:[function(require,module,exports){ (function (global){ /* * The MIT License (MIT) @@ -539,9 +539,13 @@ var removeCirculars = function (obj) { if (ancestors.indexOf(node) === -1) { ancestors.push(node); - if (_.isArray(node) || _.isPlainObject(node)) { - _.each(node, function (member, indexOrKey) { - walkItem(member, indexOrKey.toString()); + if (_.isArray(node)) { + _.each(node, function (member, index) { + walkItem(member, index.toString()); + }); + } else if (_.isPlainObject(node)) { + _.forOwn(node, function (member, key) { + walkItem(member, key.toString()); }); } } else { @@ -1781,7 +1785,7 @@ module.exports.v2 = module.exports.v2_0 = new Specification('2.0'); // jshint ig }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../schemas/1.2/apiDeclaration.json":192,"../schemas/1.2/authorizationObject.json":193,"../schemas/1.2/dataType.json":194,"../schemas/1.2/dataTypeBase.json":195,"../schemas/1.2/infoObject.json":196,"../schemas/1.2/modelsObject.json":197,"../schemas/1.2/oauth2GrantType.json":198,"../schemas/1.2/operationObject.json":199,"../schemas/1.2/parameterObject.json":200,"../schemas/1.2/resourceListing.json":201,"../schemas/1.2/resourceObject.json":202,"../schemas/2.0/schema.json":203,"./helpers":1,"./validators":3,"async":4,"js-yaml":27,"json-refs":57,"lodash":89,"spark-md5":100,"swagger-converter":107,"traverse":108}],3:[function(require,module,exports){ +},{"../schemas/1.2/apiDeclaration.json":193,"../schemas/1.2/authorizationObject.json":194,"../schemas/1.2/dataType.json":195,"../schemas/1.2/dataTypeBase.json":196,"../schemas/1.2/infoObject.json":197,"../schemas/1.2/modelsObject.json":198,"../schemas/1.2/oauth2GrantType.json":199,"../schemas/1.2/operationObject.json":200,"../schemas/1.2/parameterObject.json":201,"../schemas/1.2/resourceListing.json":202,"../schemas/1.2/resourceObject.json":203,"../schemas/2.0/schema.json":204,"./helpers":1,"./validators":3,"async":4,"js-yaml":27,"json-refs":57,"lodash":87,"spark-md5":98,"swagger-converter":105,"traverse":106}],3:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -2452,7 +2456,7 @@ var validateSchemaConstraints = module.exports.validateSchemaConstraints = funct } }; -},{"./helpers":1,"lodash":89}],4:[function(require,module,exports){ +},{"./helpers":1,"lodash":87}],4:[function(require,module,exports){ (function (process,global){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -2470,6 +2474,59 @@ function slice(arrayLike, start) { return newArr; } +/** + * Creates a continuation function with some arguments already applied. + * + * Useful as a shorthand when combined with other control flow functions. Any + * arguments passed to the returned function are added to the arguments + * originally passed to apply. + * + * @name apply + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {Function} fn - The function you want to eventually apply all + * arguments to. Invokes with (arguments...). + * @param {...*} arguments... - Any number of arguments to automatically apply + * when the continuation is called. + * @returns {Function} the partially-applied function + * @example + * + * // using apply + * async.parallel([ + * async.apply(fs.writeFile, 'testfile1', 'test1'), + * async.apply(fs.writeFile, 'testfile2', 'test2') + * ]); + * + * + * // the same process without using apply + * async.parallel([ + * function(callback) { + * fs.writeFile('testfile1', 'test1', callback); + * }, + * function(callback) { + * fs.writeFile('testfile2', 'test2', callback); + * } + * ]); + * + * // It's possible to pass any number of additional arguments when calling the + * // continuation: + * + * node> var fn = async.apply(sys.puts, 'one'); + * node> fn('two', 'three'); + * one + * two + * three + */ +var apply = function(fn/*, ...args*/) { + var args = slice(arguments, 1); + return function(/*callArgs*/) { + var callArgs = slice(arguments); + return fn.apply(null, args.concat(callArgs)); + }; +}; + var initialParams = function (fn) { return function (/*...args, callback*/) { var args = slice(arguments); @@ -2747,8 +2804,7 @@ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } - value = Object(value); - return (symToStringTag && symToStringTag in value) + return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } @@ -3157,7 +3213,7 @@ var freeProcess = moduleExports$1 && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { - return freeProcess && freeProcess.binding('util'); + return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); @@ -3672,59 +3728,6 @@ var mapSeries = doLimit(mapLimit, 1); */ var applyEachSeries = applyEach$1(mapSeries); -/** - * Creates a continuation function with some arguments already applied. - * - * Useful as a shorthand when combined with other control flow functions. Any - * arguments passed to the returned function are added to the arguments - * originally passed to apply. - * - * @name apply - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {Function} fn - The function you want to eventually apply all - * arguments to. Invokes with (arguments...). - * @param {...*} arguments... - Any number of arguments to automatically apply - * when the continuation is called. - * @returns {Function} the partially-applied function - * @example - * - * // using apply - * async.parallel([ - * async.apply(fs.writeFile, 'testfile1', 'test1'), - * async.apply(fs.writeFile, 'testfile2', 'test2') - * ]); - * - * - * // the same process without using apply - * async.parallel([ - * function(callback) { - * fs.writeFile('testfile1', 'test1', callback); - * }, - * function(callback) { - * fs.writeFile('testfile2', 'test2', callback); - * } - * ]); - * - * // It's possible to pass any number of additional arguments when calling the - * // continuation: - * - * node> var fn = async.apply(sys.puts, 'one'); - * node> fn('two', 'three'); - * one - * two - * three - */ -var apply = function(fn/*, ...args*/) { - var args = slice(arguments, 1); - return function(/*callArgs*/) { - var callArgs = slice(arguments); - return fn.apply(null, args.concat(callArgs)); - }; -}; - /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. @@ -4279,15 +4282,17 @@ function asciiToArray(string) { /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff'; -var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23'; -var rsComboSymbolsRange = '\\u20d0-\\u20f0'; +var rsComboMarksRange = '\\u0300-\\u036f'; +var reComboHalfMarksRange = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange = '\\u20d0-\\u20ff'; +var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; var rsVarRange = '\\ufe0e\\ufe0f'; /** Used to compose unicode capture groups. */ var rsZWJ = '\\u200d'; /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); /** * Checks if `string` contains Unicode symbols. @@ -4302,13 +4307,15 @@ function hasUnicode(string) { /** Used to compose unicode character classes. */ var rsAstralRange$1 = '\\ud800-\\udfff'; -var rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23'; -var rsComboSymbolsRange$1 = '\\u20d0-\\u20f0'; +var rsComboMarksRange$1 = '\\u0300-\\u036f'; +var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff'; +var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; var rsVarRange$1 = '\\ufe0e\\ufe0f'; /** Used to compose unicode capture groups. */ var rsAstral = '[' + rsAstralRange$1 + ']'; -var rsCombo = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']'; +var rsCombo = '[' + rsComboRange$1 + ']'; var rsFitz = '\\ud83c[\\udffb-\\udfff]'; var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')'; var rsNonAstral = '[^' + rsAstralRange$1 + ']'; @@ -4655,6 +4662,7 @@ function queue(worker, concurrency, payload) { var numRunning = 0; var workersList = []; + var processingScheduled = false; function _insert(data, insertAtFront, callback) { if (callback != null && typeof callback !== 'function') { throw new Error('task callback must be a function'); @@ -4682,7 +4690,14 @@ function queue(worker, concurrency, payload) { q._tasks.push(item); } } - setImmediate$1(q.process); + + if (!processingScheduled) { + processingScheduled = true; + setImmediate$1(function() { + processingScheduled = false; + q.process(); + }); + } } function _next(tasks) { @@ -4693,7 +4708,9 @@ function queue(worker, concurrency, payload) { var task = tasks[i]; var index = baseIndexOf(workersList, task, 0); - if (index >= 0) { + if (index === 0) { + workersList.shift(); + } else if (index > 0) { workersList.splice(index, 1); } @@ -6260,7 +6277,7 @@ function memoize(fn, hasher) { /** * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `setImmediate`. In the browser it will use `setImmediate` if + * calls `process.nextTicl`. In the browser it will use `setImmediate` if * available, otherwise `setTimeout(callback, 0)`, which means other higher * priority events may precede the execution of `callback`. * @@ -6270,7 +6287,7 @@ function memoize(fn, hasher) { * @static * @memberOf module:Utils * @method - * @alias setImmediate + * @see [async.setImmediate]{@link module:Utils.setImmediate} * @category Util * @param {Function} callback - The function to call on a later loop around * the event loop. Invoked with (args...). @@ -6730,43 +6747,6 @@ function reflect(fn) { }); } -function reject$1(eachfn, arr, iteratee, callback) { - _filter(eachfn, arr, function(value, cb) { - iteratee(value, function(err, v) { - cb(err, !v); - }); - }, callback); -} - -/** - * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. - * - * @name reject - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @example - * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); - * }); - */ -var reject = doParallel(reject$1); - /** * A helper function that wraps an array or an object of functions with `reflect`. * @@ -6847,6 +6827,43 @@ function reflectAll(tasks) { return results; } +function reject$1(eachfn, arr, iteratee, callback) { + _filter(eachfn, arr, function(value, cb) { + iteratee(value, function(err, v) { + cb(err, !v); + }); + }, callback); +} + +/** + * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. + * + * @name reject + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.reject(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of missing files + * createFiles(results); + * }); + */ +var reject = doParallel(reject$1); + /** * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a * time. @@ -6986,8 +7003,8 @@ function constant$1(value) { * // do something with the result * }); * - * // It can also be embedded within other control flow functions to retry - * // individual methods that are not as reliable, like this: + * // to retry individual methods that are not as reliable within other + * // control flow functions, use the `retryable` wrapper: * async.auto({ * users: api.getUsers.bind(api), * payments: async.retryable(3, api.getPayments.bind(api)) @@ -7554,7 +7571,7 @@ function transform (coll, accumulator, iteratee, callback) { * `result` arguments of the last attempt at completing the `task`. Invoked with * (err, results). * @example - * async.try([ + * async.tryEach([ * function getDataFromFirstWebsite(callback) { * // Try getting the data from the first website * callback(err, data); @@ -7829,9 +7846,9 @@ var waterfall = function(tasks, callback) { */ var index = { + apply: apply, applyEach: applyEach, applyEachSeries: applyEachSeries, - apply: apply, asyncify: asyncify, auto: auto, autoInject: autoInject, @@ -7909,7 +7926,14 @@ var index = { // aliases all: every, + allLimit: everyLimit, + allSeries: everySeries, any: some, + anyLimit: someLimit, + anySeries: someSeries, + find: detect, + findLimit: detectLimit, + findSeries: detectSeries, forEach: eachLimit, forEachSeries: eachSeries, forEachLimit: eachLimit$1, @@ -7926,9 +7950,9 @@ var index = { }; exports['default'] = index; +exports.apply = apply; exports.applyEach = applyEach; exports.applyEachSeries = applyEachSeries; -exports.apply = apply; exports.asyncify = asyncify; exports.auto = auto; exports.autoInject = autoInject; @@ -8032,7 +8056,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":95}],5:[function(require,module,exports){ +},{"_process":93}],5:[function(require,module,exports){ (function (global){ /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -9439,26 +9463,29 @@ Graph.prototype.nodes = function() { }; Graph.prototype.sources = function() { - return _.filter(this.nodes(), _.bind(function(v) { - return _.isEmpty(this._in[v]); - }, this)); + var self = this; + return _.filter(this.nodes(), function(v) { + return _.isEmpty(self._in[v]); + }); }; Graph.prototype.sinks = function() { - return _.filter(this.nodes(), _.bind(function(v) { - return _.isEmpty(this._out[v]); - }, this)); + var self = this; + return _.filter(this.nodes(), function(v) { + return _.isEmpty(self._out[v]); + }); }; Graph.prototype.setNodes = function(vs, value) { var args = arguments; - _.each(vs, _.bind(function(v) { + var self = this; + _.each(vs, function(v) { if (args.length > 1) { - this.setNode(v, value); + self.setNode(v, value); } else { - this.setNode(v); + self.setNode(v); } - }, this)); + }); return this; }; @@ -9500,9 +9527,9 @@ Graph.prototype.removeNode = function(v) { if (this._isCompound) { this._removeFromParentsChildList(v); delete this._parent[v]; - _.each(this.children(v), _.bind(function(child) { - this.setParent(child); - }, this)); + _.each(this.children(v), function(child) { + self.setParent(child); + }); delete this._children[v]; } _.each(_.keys(this._in[v]), removeEdge); @@ -9531,7 +9558,7 @@ Graph.prototype.setParent = function(v, parent) { ancestor = this.parent(ancestor)) { if (ancestor === v) { throw new Error("Setting " + parent+ " as parent of " + v + - " would create create a cycle"); + " would create a cycle"); } } @@ -9596,6 +9623,16 @@ Graph.prototype.neighbors = function(v) { } }; +Graph.prototype.isLeaf = function (v) { + var neighbors; + if (this.isDirected()) { + neighbors = this.successors(v); + } else { + neighbors = this.neighbors(v); + } + return neighbors.length === 0; +}; + Graph.prototype.filterNodes = function(filter) { var copy = new this.constructor({ directed: this._isDirected, @@ -9605,19 +9642,19 @@ Graph.prototype.filterNodes = function(filter) { copy.setGraph(this.graph()); - _.each(this._nodes, _.bind(function(value, v) { + var self = this; + _.each(this._nodes, function(value, v) { if (filter(v)) { copy.setNode(v, value); } - }, this)); + }); - _.each(this._edgeObjs, _.bind(function(e) { + _.each(this._edgeObjs, function(e) { if (copy.hasNode(e.v) && copy.hasNode(e.w)) { - copy.setEdge(e, this.edge(e)); + copy.setEdge(e, self.edge(e)); } - }, this)); + }); - var self = this; var parents = {}; function findParent(v) { var parent = self.parent(v); @@ -9936,8 +9973,8 @@ if (!lodash) { module.exports = lodash; -},{"lodash":89}],26:[function(require,module,exports){ -module.exports = '2.1.1'; +},{"lodash":87}],26:[function(require,module,exports){ +module.exports = '2.1.5'; },{}],27:[function(require,module,exports){ 'use strict'; @@ -13874,7 +13911,6 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', { * @module JsonRefs */ -// Cherry-pick lodash components to help with size var _ = require('lodash'); var gl = require('graphlib'); var path = require('path'); @@ -13901,7 +13937,7 @@ function combineQueryParams (qs1, qs2) { var combined = {}; function mergeQueryParams (obj) { - _.each(obj, function (val, key) { + _.forOwn(obj, function (val, key) { combined[key] = val; }); } @@ -14169,7 +14205,7 @@ function buildRefModel (document, options, metadata) { refs = findRefs(document, options); // Iterate over the references and process - _.each(refs, function (refDetails, refPtr) { + _.forOwn(refs, function (refDetails, refPtr) { var refKey = makeAbsolute(options.location) + refPtr; var refdKey = refDetails.refdId = makeAbsolute(isRemote(refDetails) ? combineURIs(relativeBase, refDetails.uri) : @@ -14296,7 +14332,7 @@ function walk (ancestors, node, path, fn) { walkItem(member, index.toString()); }); } else if (_.isObject(node)) { - _.each(node, function (cNode, key) { + _.forOwn(node, function (cNode, key) { walkItem(cNode, key); }); } @@ -15016,8 +15052,8 @@ function resolveRefs (obj, options) { }); // Add edges - _.each(results.deps, function (props, node) { - _.each(props, function (dep) { + _.forOwn(results.deps, function (props, node) { + _.forOwn(props, function (dep) { depGraph.setEdge(node, dep); }); }); @@ -15034,8 +15070,8 @@ function resolveRefs (obj, options) { }); // Process circulars - _.each(results.deps, function (props, node) { - _.each(props, function (dep, prop) { + _.forOwn(results.deps, function (props, node) { + _.forOwn(props, function (dep, prop) { var isCircular = false; var refPtr = node + prop.slice(1); var refDetails = results.refs[node + prop.slice(1)]; @@ -15079,13 +15115,14 @@ function resolveRefs (obj, options) { }); }); - // Resolve the references - _.each(results.deps, function (deps, parentPtr) { + // Resolve the references in reverse order since the current order is top-down + _.forOwn(Object.keys(results.deps).reverse(), function (parentPtr) { + var deps = results.deps[parentPtr]; var pPtrParts = parentPtr.split('#'); var pDocument = results.docs[pPtrParts[0]]; var pPtrPath = pathFromPtr(pPtrParts[1]); - _.each(deps, function (dep, prop) { + _.forOwn(deps, function (dep, prop) { var depParts = dep.split('#'); var dDocument = results.docs[depParts[0]]; var dPtrPath = pPtrPath.concat(pathFromPtr(prop)); @@ -15171,7 +15208,7 @@ function resolveRefs (obj, options) { }); // Sanitize the reference details - _.each(results.refs, function (refDetails) { + _.forOwn(results.refs, function (refDetails) { // Delete the reference id used for dependency tracking and circular identification delete refDetails.refdId; }); @@ -15276,7 +15313,7 @@ module.exports.resolveRefsAt = resolveRefsAt; }).call(this,require('_process')) -},{"_process":95,"graphlib":7,"lodash":89,"native-promise-only":90,"path":91,"path-loader":92,"querystring":98,"slash":99,"uri-js":109}],58:[function(require,module,exports){ +},{"_process":93,"graphlib":7,"lodash":87,"native-promise-only":88,"path":89,"path-loader":90,"querystring":96,"slash":97,"uri-js":107}],58:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15355,54 +15392,7 @@ function baseBind(bindData) { module.exports = baseBind; -},{"lodash._basecreate":60,"lodash._setbinddata":72,"lodash._slice":74,"lodash.isobject":86}],60:[function(require,module,exports){ -(function (global){ -/** - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash modularize modern exports="npm" -o ./npm/` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var isNative = require('lodash._isnative'), - isObject = require('lodash.isobject'), - noop = require('lodash.noop'); - -/* Native method shortcuts for methods with the same name as other `lodash` methods */ -var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(prototype, properties) { - return isObject(prototype) ? nativeCreate(prototype) : {}; -} -// fallback for browsers without `Object.create` -if (!nativeCreate) { - baseCreate = (function() { - function Object() {} - return function(prototype) { - if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; - } - return result || global.Object(); - }; - }()); -} - -module.exports = baseCreate; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"lodash._isnative":68,"lodash.isobject":86,"lodash.noop":87}],61:[function(require,module,exports){ +},{"lodash._basecreate":61,"lodash._setbinddata":70,"lodash._slice":72,"lodash.isobject":83}],60:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15556,7 +15546,8 @@ function baseClone(value, isDeep, callback, stackA, stackB) { module.exports = baseClone; -},{"lodash._getarray":67,"lodash._releasearray":71,"lodash._slice":74,"lodash.assign":75,"lodash.foreach":79,"lodash.forown":80,"lodash.isarray":62,"lodash.isobject":86}],62:[function(require,module,exports){ +},{"lodash._getarray":65,"lodash._releasearray":69,"lodash._slice":72,"lodash.assign":73,"lodash.foreach":76,"lodash.forown":77,"lodash.isarray":80,"lodash.isobject":83}],61:[function(require,module,exports){ +(function (global){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15565,45 +15556,44 @@ module.exports = baseClone; * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var isNative = require('lodash._isnative'); - -/** `Object#toString` result shortcuts */ -var arrayClass = '[object Array]'; - -/** Used for native method references */ -var objectProto = Object.prototype; - -/** Used to resolve the internal [[Class]] of values */ -var toString = objectProto.toString; +var isNative = require('lodash._isnative'), + isObject = require('lodash.isobject'), + noop = require('lodash.noop'); /* Native method shortcuts for methods with the same name as other `lodash` methods */ -var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray; +var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false + * The base implementation of `_.create` without support for assigning + * properties to the created object. * - * _.isArray([1, 2, 3]); - * // => true + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. */ -var isArray = nativeIsArray || function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == arrayClass || false; -}; +function baseCreate(prototype, properties) { + return isObject(prototype) ? nativeCreate(prototype) : {}; +} +// fallback for browsers without `Object.create` +if (!nativeCreate) { + baseCreate = (function() { + function Object() {} + return function(prototype) { + if (isObject(prototype)) { + Object.prototype = prototype; + var result = new Object; + Object.prototype = null; + } + return result || global.Object(); + }; + }()); +} -module.exports = isArray; +module.exports = baseCreate; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"lodash._isnative":68}],63:[function(require,module,exports){ +},{"lodash._isnative":66,"lodash.isobject":83,"lodash.noop":85}],62:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15685,7 +15675,7 @@ function baseCreateCallback(func, thisArg, argCount) { module.exports = baseCreateCallback; -},{"lodash._setbinddata":72,"lodash.bind":77,"lodash.identity":83,"lodash.support":88}],64:[function(require,module,exports){ +},{"lodash._setbinddata":70,"lodash.bind":74,"lodash.identity":79,"lodash.support":86}],63:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15765,54 +15755,7 @@ function baseCreateWrapper(bindData) { module.exports = baseCreateWrapper; -},{"lodash._basecreate":65,"lodash._setbinddata":72,"lodash._slice":74,"lodash.isobject":86}],65:[function(require,module,exports){ -(function (global){ -/** - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash modularize modern exports="npm" -o ./npm/` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var isNative = require('lodash._isnative'), - isObject = require('lodash.isobject'), - noop = require('lodash.noop'); - -/* Native method shortcuts for methods with the same name as other `lodash` methods */ -var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(prototype, properties) { - return isObject(prototype) ? nativeCreate(prototype) : {}; -} -// fallback for browsers without `Object.create` -if (!nativeCreate) { - baseCreate = (function() { - function Object() {} - return function(prototype) { - if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; - } - return result || global.Object(); - }; - }()); -} - -module.exports = baseCreate; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"lodash._isnative":68,"lodash.isobject":86,"lodash.noop":87}],66:[function(require,module,exports){ +},{"lodash._basecreate":61,"lodash._setbinddata":70,"lodash._slice":72,"lodash.isobject":83}],64:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15920,7 +15863,7 @@ function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, ar module.exports = createWrapper; -},{"lodash._basebind":59,"lodash._basecreatewrapper":64,"lodash._slice":74,"lodash.isfunction":85}],67:[function(require,module,exports){ +},{"lodash._basebind":59,"lodash._basecreatewrapper":63,"lodash._slice":72,"lodash.isfunction":82}],65:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15943,7 +15886,7 @@ function getArray() { module.exports = getArray; -},{"lodash._arraypool":58}],68:[function(require,module,exports){ +},{"lodash._arraypool":58}],66:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15979,7 +15922,7 @@ function isNative(value) { module.exports = isNative; -},{}],69:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -15994,7 +15937,7 @@ var maxPoolSize = 40; module.exports = maxPoolSize; -},{}],70:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16016,7 +15959,7 @@ var objectTypes = { module.exports = objectTypes; -},{}],71:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16043,7 +15986,7 @@ function releaseArray(array) { module.exports = releaseArray; -},{"lodash._arraypool":58,"lodash._maxpoolsize":69}],72:[function(require,module,exports){ +},{"lodash._arraypool":58,"lodash._maxpoolsize":67}],70:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16088,7 +16031,7 @@ var setBindData = !defineProperty ? noop : function(func, value) { module.exports = setBindData; -},{"lodash._isnative":68,"lodash.noop":87}],73:[function(require,module,exports){ +},{"lodash._isnative":66,"lodash.noop":85}],71:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16128,7 +16071,7 @@ var shimKeys = function(object) { module.exports = shimKeys; -},{"lodash._objecttypes":70}],74:[function(require,module,exports){ +},{"lodash._objecttypes":68}],72:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16168,7 +16111,7 @@ function slice(array, start, end) { module.exports = slice; -},{}],75:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16240,45 +16183,7 @@ var assign = function(object, source, guard) { module.exports = assign; -},{"lodash._basecreatecallback":63,"lodash._objecttypes":70,"lodash.keys":76}],76:[function(require,module,exports){ -/** - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash modularize modern exports="npm" -o ./npm/` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -var isNative = require('lodash._isnative'), - isObject = require('lodash.isobject'), - shimKeys = require('lodash._shimkeys'); - -/* Native method shortcuts for methods with the same name as other `lodash` methods */ -var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys; - -/** - * Creates an array composed of the own enumerable property names of an object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) - */ -var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - return nativeKeys(object); -}; - -module.exports = keys; - -},{"lodash._isnative":68,"lodash._shimkeys":73,"lodash.isobject":86}],77:[function(require,module,exports){ +},{"lodash._basecreatecallback":62,"lodash._objecttypes":68,"lodash.keys":84}],74:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16320,7 +16225,7 @@ function bind(func, thisArg) { module.exports = bind; -},{"lodash._createwrapper":66,"lodash._slice":74}],78:[function(require,module,exports){ +},{"lodash._createwrapper":64,"lodash._slice":72}],75:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16379,7 +16284,7 @@ function cloneDeep(value, callback, thisArg) { module.exports = cloneDeep; -},{"lodash._baseclone":61,"lodash._basecreatecallback":63}],79:[function(require,module,exports){ +},{"lodash._baseclone":60,"lodash._basecreatecallback":62}],76:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16436,7 +16341,7 @@ function forEach(collection, callback, thisArg) { module.exports = forEach; -},{"lodash._basecreatecallback":63,"lodash.forown":80}],80:[function(require,module,exports){ +},{"lodash._basecreatecallback":62,"lodash.forown":77}],77:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -16488,9 +16393,7 @@ var forOwn = function(collection, callback, thisArg) { module.exports = forOwn; -},{"lodash._basecreatecallback":63,"lodash._objecttypes":70,"lodash.keys":81}],81:[function(require,module,exports){ -arguments[4][76][0].apply(exports,arguments) -},{"dup":76,"lodash._isnative":68,"lodash._shimkeys":73,"lodash.isobject":86}],82:[function(require,module,exports){ +},{"lodash._basecreatecallback":62,"lodash._objecttypes":68,"lodash.keys":84}],78:[function(require,module,exports){ (function (global){ /** * lodash (Custom Build) @@ -17426,7 +17329,7 @@ module.exports = get; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],83:[function(require,module,exports){ +},{}],79:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -17456,7 +17359,54 @@ function identity(value) { module.exports = identity; -},{}],84:[function(require,module,exports){ +},{}],80:[function(require,module,exports){ +/** + * Lo-Dash 2.4.1 (Custom Build) + * Build: `lodash modularize modern exports="npm" -o ./npm/` + * Copyright 2012-2013 The Dojo Foundation + * Based on Underscore.js 1.5.2 + * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var isNative = require('lodash._isnative'); + +/** `Object#toString` result shortcuts */ +var arrayClass = '[object Array]'; + +/** Used for native method references */ +var objectProto = Object.prototype; + +/** Used to resolve the internal [[Class]] of values */ +var toString = objectProto.toString; + +/* Native method shortcuts for methods with the same name as other `lodash` methods */ +var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray; + +/** + * Checks if `value` is an array. + * + * @static + * @memberOf _ + * @type Function + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is an array, else `false`. + * @example + * + * (function() { return _.isArray(arguments); })(); + * // => false + * + * _.isArray([1, 2, 3]); + * // => true + */ +var isArray = nativeIsArray || function(value) { + return value && typeof value == 'object' && typeof value.length == 'number' && + toString.call(value) == arrayClass || false; +}; + +module.exports = isArray; + +},{"lodash._isnative":66}],81:[function(require,module,exports){ (function (global){ /** * Lodash (Custom Build) @@ -19309,7 +19259,7 @@ module.exports = isEqual; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],85:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -19338,7 +19288,7 @@ function isFunction(value) { module.exports = isFunction; -},{}],86:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -19379,7 +19329,45 @@ function isObject(value) { module.exports = isObject; -},{"lodash._objecttypes":70}],87:[function(require,module,exports){ +},{"lodash._objecttypes":68}],84:[function(require,module,exports){ +/** + * Lo-Dash 2.4.1 (Custom Build) + * Build: `lodash modularize modern exports="npm" -o ./npm/` + * Copyright 2012-2013 The Dojo Foundation + * Based on Underscore.js 1.5.2 + * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var isNative = require('lodash._isnative'), + isObject = require('lodash.isobject'), + shimKeys = require('lodash._shimkeys'); + +/* Native method shortcuts for methods with the same name as other `lodash` methods */ +var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys; + +/** + * Creates an array composed of the own enumerable property names of an object. + * + * @static + * @memberOf _ + * @category Objects + * @param {Object} object The object to inspect. + * @returns {Array} Returns an array of property names. + * @example + * + * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); + * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) + */ +var keys = !nativeKeys ? shimKeys : function(object) { + if (!isObject(object)) { + return []; + } + return nativeKeys(object); +}; + +module.exports = keys; + +},{"lodash._isnative":66,"lodash._shimkeys":71,"lodash.isobject":83}],85:[function(require,module,exports){ /** * Lo-Dash 2.4.1 (Custom Build) * Build: `lodash modularize modern exports="npm" -o ./npm/` @@ -19407,7 +19395,7 @@ function noop() { module.exports = noop; -},{}],88:[function(require,module,exports){ +},{}],86:[function(require,module,exports){ (function (global){ /** * Lo-Dash 2.4.1 (Custom Build) @@ -19452,7 +19440,7 @@ module.exports = support; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"lodash._isnative":68}],89:[function(require,module,exports){ +},{"lodash._isnative":66}],87:[function(require,module,exports){ (function (global){ /** * @license @@ -36541,7 +36529,7 @@ module.exports = support; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],90:[function(require,module,exports){ +},{}],88:[function(require,module,exports){ (function (global){ /*! Native Promise Only v0.8.1 (c) Kyle Simpson @@ -36919,7 +36907,7 @@ module.exports = support; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],91:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -37148,7 +37136,7 @@ var substr = 'ab'.substr(-1) === 'b' }).call(this,require('_process')) -},{"_process":95}],92:[function(require,module,exports){ +},{"_process":93}],90:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -37379,7 +37367,7 @@ module.exports.load = function (location, options) { return allTasks; }; -},{"./lib/loaders/file":93,"./lib/loaders/http":94,"native-promise-only":90}],93:[function(require,module,exports){ +},{"./lib/loaders/file":91,"./lib/loaders/http":92,"native-promise-only":88}],91:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -37430,7 +37418,7 @@ module.exports.load = function () { } }; -},{}],94:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ /* eslint-env node, browser */ /* @@ -37528,7 +37516,7 @@ module.exports.load = function (location, options, callback) { } }; -},{"superagent":101}],95:[function(require,module,exports){ +},{"superagent":100}],93:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -37714,7 +37702,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],96:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -37800,7 +37788,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],97:[function(require,module,exports){ +},{}],95:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -37887,13 +37875,13 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],98:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":96,"./encode":97}],99:[function(require,module,exports){ +},{"./decode":94,"./encode":95}],97:[function(require,module,exports){ 'use strict'; module.exports = function (str) { var isExtendedLengthPath = /^\\\\\?\\/.test(str); @@ -37906,7 +37894,7 @@ module.exports = function (str) { return str.replace(/\\/g, '/'); }; -},{}],100:[function(require,module,exports){ +},{}],98:[function(require,module,exports){ (function (factory) { if (typeof exports === 'object') { // Node/CommonJS @@ -38659,7 +38647,29 @@ module.exports = function (str) { return SparkMD5; })); -},{}],101:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ +function Agent() { + this._defaults = []; +} + +["use", "on", "once", "set", "query", "type", "accept", "auth", "withCredentials", "sortQuery", "retry", "ok", "redirects", + "timeout", "buffer", "serialize", "parse", "ca", "key", "pfx", "cert"].forEach(function(fn) { + /** Default setting for all requests from this agent */ + Agent.prototype[fn] = function(/*varargs*/) { + this._defaults.push({fn:fn, arguments:arguments}); + return this; + } +}); + +Agent.prototype._setDefaults = function(req) { + this._defaults.forEach(function(def) { + req[def.fn].apply(req, def.arguments); + }); +}; + +module.exports = Agent; + +},{}],100:[function(require,module,exports){ /** * Root reference for iframes. */ @@ -38678,7 +38688,7 @@ var Emitter = require('component-emitter'); var RequestBase = require('./request-base'); var isObject = require('./is-object'); var ResponseBase = require('./response-base'); -var shouldRetry = require('./should-retry'); +var Agent = require('./agent-base'); /** * Noop. @@ -38785,9 +38795,9 @@ function pushEncodedKeyValuePair(pairs, key, val) { * Expose serialization method. */ - request.serializeObject = serialize; +request.serializeObject = serialize; - /** +/** * Parse the given x-www-form-urlencoded `str`. * * @param {String} str @@ -38846,12 +38856,12 @@ request.types = { * */ - request.serialize = { - 'application/x-www-form-urlencoded': serialize, - 'application/json': JSON.stringify - }; +request.serialize = { + 'application/x-www-form-urlencoded': serialize, + 'application/json': JSON.stringify, +}; - /** +/** * Default parsers. * * superagent.parse['application/xml'] = function(str){ @@ -38862,7 +38872,7 @@ request.types = { request.parse = { 'application/x-www-form-urlencoded': parseString, - 'application/json': JSON.parse + 'application/json': JSON.parse, }; /** @@ -38882,11 +38892,12 @@ function parseHeader(str) { var field; var val; - lines.pop(); // trailing CRLF - for (var i = 0, len = lines.length; i < len; ++i) { line = lines[i]; index = line.indexOf(':'); + if (index === -1) { // could be empty line, just skip it + continue; + } field = line.slice(0, index).toLowerCase(); val = trim(line.slice(index + 1)); fields[field] = val; @@ -38904,7 +38915,9 @@ function parseHeader(str) { */ function isJSON(mime) { - return /[\/+]json\b/.test(mime); + // should match /json or +json + // but not /json-seq + return /[\/+]json($|[^-\w])/.test(mime); } /** @@ -38964,7 +38977,7 @@ function Response(req) { var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request if (status === 1223) { - status = 204; + status = 204; } this._setStatusProperties(status); this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); @@ -38996,9 +39009,9 @@ ResponseBase(Response.prototype); * @api private */ -Response.prototype._parseBody = function(str){ +Response.prototype._parseBody = function(str) { var parse = request.parse[this.type]; - if(this.req._parser) { + if (this.req._parser) { return this.req._parser(this, str); } if (!parse && isJSON(this.type)) { @@ -39082,16 +39095,16 @@ function Request(method, url) { try { if (!self._isResponseOK(res)) { new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); - new_err.original = err; - new_err.response = res; - new_err.status = res.status; } - } catch(e) { - new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android + } catch(custom_err) { + new_err = custom_err; // ok() callback can throw } // #1000 don't catch errors from the callback to avoid double calling it if (new_err) { + new_err.original = err; + new_err.response = res; + new_err.status = res.status; self.callback(new_err, res); } else { self.callback(null, res); @@ -39169,30 +39182,25 @@ Request.prototype.accept = function(type){ */ Request.prototype.auth = function(user, pass, options){ - if (typeof pass === 'object' && pass !== null) { // pass is optional and can substitute for options + if (1 === arguments.length) pass = ''; + if (typeof pass === 'object' && pass !== null) { // pass is optional and can be replaced with options options = pass; + pass = ''; } if (!options) { options = { type: 'function' === typeof btoa ? 'basic' : 'auto', - } + }; } - switch (options.type) { - case 'basic': - this.set('Authorization', 'Basic ' + btoa(user + ':' + pass)); - break; - - case 'auto': - this.username = user; - this.password = pass; - break; + var encoder = function(string) { + if ('function' === typeof btoa) { + return btoa(string); + } + throw new Error('Cannot use basic auth, btoa is not a function'); + }; - case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' }) - this.set('Authorization', 'Bearer ' + user); - break; - } - return this; + return this._auth(user, pass, options, encoder); }; /** @@ -39260,8 +39268,7 @@ Request.prototype._getFormData = function(){ */ Request.prototype.callback = function(err, res){ - // console.log(this._retries, this._maxRetries) - if (this._maxRetries && this._retries++ < this._maxRetries && shouldRetry(err, res)) { + if (this._shouldRetry(err, res)) { return this._retry(); } @@ -39343,7 +39350,7 @@ Request.prototype.end = function(fn){ Request.prototype._end = function() { var self = this; - var xhr = this.xhr = request.getXHR(); + var xhr = (this.xhr = request.getXHR()); var data = this._formData || this._data; this._setTimeouts(); @@ -39377,7 +39384,7 @@ Request.prototype._end = function() { } e.direction = direction; self.emit('progress', e); - } + }; if (this.hasListeners('progress')) { try { xhr.onprogress = handleProgress.bind(null, 'download'); @@ -39438,6 +39445,23 @@ Request.prototype._end = function() { return this; }; +request.agent = function() { + return new Agent(); +}; + +["GET", "POST", "OPTIONS", "PATCH", "PUT", "DELETE"].forEach(function(method) { + Agent.prototype[method.toLowerCase()] = function(url, fn) { + var req = new request.Request(method, url); + this._setDefaults(req); + if (fn) { + req.end(fn); + } + return req; + }; +}); + +Agent.prototype.del = Agent.prototype['delete']; + /** * GET `url` with optional callback `fn(res)`. * @@ -39448,9 +39472,9 @@ Request.prototype._end = function() { * @api public */ -request.get = function(url, data, fn){ +request.get = function(url, data, fn) { var req = request('GET', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.query(data); if (fn) req.end(fn); return req; @@ -39466,9 +39490,9 @@ request.get = function(url, data, fn){ * @api public */ -request.head = function(url, data, fn){ +request.head = function(url, data, fn) { var req = request('HEAD', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.query(data); if (fn) req.end(fn); return req; @@ -39484,9 +39508,9 @@ request.head = function(url, data, fn){ * @api public */ -request.options = function(url, data, fn){ +request.options = function(url, data, fn) { var req = request('OPTIONS', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.send(data); if (fn) req.end(fn); return req; @@ -39502,13 +39526,13 @@ request.options = function(url, data, fn){ * @api public */ -function del(url, data, fn){ +function del(url, data, fn) { var req = request('DELETE', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.send(data); if (fn) req.end(fn); return req; -}; +} request['del'] = del; request['delete'] = del; @@ -39523,9 +39547,9 @@ request['delete'] = del; * @api public */ -request.patch = function(url, data, fn){ +request.patch = function(url, data, fn) { var req = request('PATCH', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.send(data); if (fn) req.end(fn); return req; @@ -39541,9 +39565,9 @@ request.patch = function(url, data, fn){ * @api public */ -request.post = function(url, data, fn){ +request.post = function(url, data, fn) { var req = request('POST', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.send(data); if (fn) req.end(fn); return req; @@ -39559,15 +39583,17 @@ request.post = function(url, data, fn){ * @api public */ -request.put = function(url, data, fn){ +request.put = function(url, data, fn) { var req = request('PUT', url); - if ('function' == typeof data) fn = data, data = null; + if ('function' == typeof data) (fn = data), (data = null); if (data) req.send(data); if (fn) req.end(fn); return req; }; -},{"./is-object":102,"./request-base":103,"./response-base":104,"./should-retry":105,"component-emitter":6}],102:[function(require,module,exports){ +},{"./agent-base":99,"./is-object":101,"./request-base":102,"./response-base":103,"component-emitter":6}],101:[function(require,module,exports){ +'use strict'; + /** * Check if `obj` is an object. * @@ -39582,7 +39608,9 @@ function isObject(obj) { module.exports = isObject; -},{}],103:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ +'use strict'; + /** * Module of mixed-in functions shared between node and client code */ @@ -39726,19 +39754,60 @@ RequestBase.prototype.timeout = function timeout(options){ * Failed requests will be retried 'count' times if timeout or err.code >= 500. * * @param {Number} count + * @param {Function} [fn] * @return {Request} for chaining * @api public */ -RequestBase.prototype.retry = function retry(count){ +RequestBase.prototype.retry = function retry(count, fn){ // Default to 1 if no count passed or true if (arguments.length === 0 || count === true) count = 1; if (count <= 0) count = 0; this._maxRetries = count; this._retries = 0; + this._retryCallback = fn; return this; }; +var ERROR_CODES = [ + 'ECONNRESET', + 'ETIMEDOUT', + 'EADDRINFO', + 'ESOCKETTIMEDOUT' +]; + +/** + * Determine if a request should be retried. + * (Borrowed from segmentio/superagent-retry) + * + * @param {Error} err + * @param {Response} [res] + * @returns {Boolean} + */ +RequestBase.prototype._shouldRetry = function(err, res) { + if (!this._maxRetries || this._retries++ >= this._maxRetries) { + return false; + } + if (this._retryCallback) { + try { + var override = this._retryCallback(err, res); + if (override === true) return true; + if (override === false) return false; + // undefined falls back to defaults + } catch(e) { + console.error(e); + } + } + if (res && res.status && res.status >= 500 && res.status != 501) return true; + if (err) { + if (err.code && ~ERROR_CODES.indexOf(err.code)) return true; + // Superagent timeout + if (err.timeout && err.code == 'ECONNABORTED') return true; + if (err.crossDomain) return true; + } + return false; +}; + /** * Retry request * @@ -39747,6 +39816,7 @@ RequestBase.prototype.retry = function retry(count){ */ RequestBase.prototype._retry = function() { + this.clearTimeout(); // node @@ -39775,14 +39845,15 @@ RequestBase.prototype.then = function then(resolve, reject) { if (this._endCalled) { console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"); } - this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ - self.end(function(err, res){ - if (err) innerReject(err); else innerResolve(res); + this._fullfilledPromise = new Promise(function(innerResolve, innerReject) { + self.end(function(err, res) { + if (err) innerReject(err); + else innerResolve(res); }); }); } return this._fullfilledPromise.then(resolve, reject); -} +}; RequestBase.prototype.catch = function(cb) { return this.then(undefined, cb); @@ -39795,7 +39866,7 @@ RequestBase.prototype.catch = function(cb) { RequestBase.prototype.use = function use(fn) { fn(this); return this; -} +}; RequestBase.prototype.ok = function(cb) { if ('function' !== typeof cb) throw Error("Callback required"); @@ -39815,7 +39886,6 @@ RequestBase.prototype._isResponseOK = function(res) { return res.status >= 200 && res.status < 300; }; - /** * Get request header `field`. * Case-insensitive. @@ -39914,9 +39984,8 @@ RequestBase.prototype.unset = function(field){ * @api public */ RequestBase.prototype.field = function(name, val) { - // name should be either a string or an object. - if (null === name || undefined === name) { + if (null === name || undefined === name) { throw new Error('.field(name, val) name can not be empty'); } @@ -39967,6 +40036,24 @@ RequestBase.prototype.abort = function(){ return this; }; +RequestBase.prototype._auth = function(user, pass, options, base64Encoder) { + switch (options.type) { + case 'basic': + this.set('Authorization', 'Basic ' + base64Encoder(user + ':' + pass)); + break; + + case 'auto': + this.username = user; + this.password = pass; + break; + + case 'bearer': // usage would be .auth(accessToken, { type: 'bearer' }) + this.set('Authorization', 'Bearer ' + user); + break; + } + return this; +}; + /** * Enable transmission of cookies with x-domain requests. * @@ -39978,9 +40065,9 @@ RequestBase.prototype.abort = function(){ * @api public */ -RequestBase.prototype.withCredentials = function(on){ +RequestBase.prototype.withCredentials = function(on) { // This is browser-only functionality. Node side is no-op. - if(on==undefined) on = true; + if (on == undefined) on = true; this._withCredentials = on; return this; }; @@ -39998,6 +40085,21 @@ RequestBase.prototype.redirects = function(n){ return this; }; +/** + * Maximum size of buffered response body, in bytes. Counts uncompressed size. + * Default 200MB. + * + * @param {Number} n + * @return {Request} for chaining + */ +RequestBase.prototype.maxResponseSize = function(n){ + if ('number' !== typeof n) { + throw TypeError("Invalid argument"); + } + this._maxResponseSize = n; + return this; +}; + /** * Convert to a plain javascript object (not JSON string) of scalar properties. * Note as this method is designed to return a useful non-this value, @@ -40007,16 +40109,15 @@ RequestBase.prototype.redirects = function(n){ * @api public */ -RequestBase.prototype.toJSON = function(){ +RequestBase.prototype.toJSON = function() { return { method: this.method, url: this.url, data: this._data, - headers: this._header + headers: this._header, }; }; - /** * Send `data` as the request body, defaulting the `.type()` to "json" when * an object is given. @@ -40104,7 +40205,6 @@ RequestBase.prototype.send = function(data){ return this; }; - /** * Sort `querystring` by the sort function * @@ -40202,9 +40302,10 @@ RequestBase.prototype._setTimeouts = function() { self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT'); }, this._responseTimeout); } -} +}; -},{"./is-object":102}],104:[function(require,module,exports){ +},{"./is-object":101}],103:[function(require,module,exports){ +'use strict'; /** * Module dependencies. @@ -40251,8 +40352,8 @@ function mixin(obj) { * @api public */ -ResponseBase.prototype.get = function(field){ - return this.header[field.toLowerCase()]; +ResponseBase.prototype.get = function(field) { + return this.header[field.toLowerCase()]; }; /** @@ -40339,32 +40440,8 @@ ResponseBase.prototype._setStatusProperties = function(status){ this.notFound = 404 == status; }; -},{"./utils":106}],105:[function(require,module,exports){ -var ERROR_CODES = [ - 'ECONNRESET', - 'ETIMEDOUT', - 'EADDRINFO', - 'ESOCKETTIMEDOUT' -]; - -/** - * Determine if a request should be retried. - * (Borrowed from segmentio/superagent-retry) - * - * @param {Error} err - * @param {Response} [res] - * @returns {Boolean} - */ -module.exports = function shouldRetry(err, res) { - if (err && err.code && ~ERROR_CODES.indexOf(err.code)) return true; - if (res && res.status && res.status >= 500) return true; - // Superagent timeout - if (err && 'timeout' in err && err.code == 'ECONNABORTED') return true; - if (err && 'crossDomain' in err) return true; - return false; -}; - -},{}],106:[function(require,module,exports){ +},{"./utils":104}],104:[function(require,module,exports){ +'use strict'; /** * Return the mime type for the given `str`. @@ -40423,17 +40500,20 @@ exports.parseLinks = function(str){ * @api private */ -exports.cleanHeader = function(header, shouldStripCookie){ +exports.cleanHeader = function(header, changesOrigin){ delete header['content-type']; delete header['content-length']; delete header['transfer-encoding']; delete header['host']; - if (shouldStripCookie) { + // secuirty + if (changesOrigin) { + delete header['authorization']; delete header['cookie']; } return header; }; -},{}],107:[function(require,module,exports){ + +},{}],105:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -40993,7 +41073,7 @@ function fixNonStringValue(value) { } } -},{"lodash.clonedeep":78,"url":110}],108:[function(require,module,exports){ +},{"lodash.clonedeep":75,"url":108}],106:[function(require,module,exports){ var traverse = module.exports = function (obj) { return new Traverse(obj); }; @@ -41309,7 +41389,7 @@ var hasOwnProperty = Object.hasOwnProperty || function (obj, key) { return key in obj; }; -},{}],109:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ /** @license URI.js v3.0.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -42559,7 +42639,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); -},{}],110:[function(require,module,exports){ +},{}],108:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -43293,7 +43373,7 @@ Url.prototype.parseHost = function() { if (host) this.hostname = host; }; -},{"./util":111,"punycode":5,"querystring":98}],111:[function(require,module,exports){ +},{"./util":109,"punycode":5,"querystring":96}],109:[function(require,module,exports){ 'use strict'; module.exports = { @@ -43311,7 +43391,7 @@ module.exports = { } }; -},{}],112:[function(require,module,exports){ +},{}],110:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43382,6 +43462,10 @@ var _isNumeric = require('./lib/isNumeric'); var _isNumeric2 = _interopRequireDefault(_isNumeric); +var _isPort = require('./lib/isPort'); + +var _isPort2 = _interopRequireDefault(_isPort); + var _isLowercase = require('./lib/isLowercase'); var _isLowercase2 = _interopRequireDefault(_isLowercase); @@ -43514,6 +43598,10 @@ var _isISO = require('./lib/isISO8601'); var _isISO2 = _interopRequireDefault(_isISO); +var _isISO31661Alpha = require('./lib/isISO31661Alpha2'); + +var _isISO31661Alpha2 = _interopRequireDefault(_isISO31661Alpha); + var _isBase = require('./lib/isBase64'); var _isBase2 = _interopRequireDefault(_isBase); @@ -43522,6 +43610,10 @@ var _isDataURI = require('./lib/isDataURI'); var _isDataURI2 = _interopRequireDefault(_isDataURI); +var _isMimeType = require('./lib/isMimeType'); + +var _isMimeType2 = _interopRequireDefault(_isMimeType); + var _isLatLong = require('./lib/isLatLong'); var _isLatLong2 = _interopRequireDefault(_isLatLong); @@ -43576,7 +43668,7 @@ var _toString2 = _interopRequireDefault(_toString); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var version = '8.2.0'; +var version = '9.2.0'; var validator = { version: version, @@ -43596,6 +43688,7 @@ var validator = { isAlpha: _isAlpha2.default, isAlphanumeric: _isAlphanumeric2.default, isNumeric: _isNumeric2.default, + isPort: _isPort2.default, isLowercase: _isLowercase2.default, isUppercase: _isUppercase2.default, isAscii: _isAscii2.default, @@ -43630,8 +43723,10 @@ var validator = { isPostalCode: _isPostalCode2.default, isCurrency: _isCurrency2.default, isISO8601: _isISO2.default, + isISO31661Alpha2: _isISO31661Alpha2.default, isBase64: _isBase2.default, isDataURI: _isDataURI2.default, + isMimeType: _isMimeType2.default, isLatLong: _isLatLong2.default, ltrim: _ltrim2.default, rtrim: _rtrim2.default, @@ -43648,7 +43743,7 @@ var validator = { exports.default = validator; module.exports = exports['default']; -},{"./lib/blacklist":114,"./lib/contains":115,"./lib/equals":116,"./lib/escape":117,"./lib/isAfter":118,"./lib/isAlpha":119,"./lib/isAlphanumeric":120,"./lib/isAscii":121,"./lib/isBase64":122,"./lib/isBefore":123,"./lib/isBoolean":124,"./lib/isByteLength":125,"./lib/isCreditCard":126,"./lib/isCurrency":127,"./lib/isDataURI":128,"./lib/isDecimal":129,"./lib/isDivisibleBy":130,"./lib/isEmail":131,"./lib/isEmpty":132,"./lib/isFQDN":133,"./lib/isFloat":134,"./lib/isFullWidth":135,"./lib/isHalfWidth":136,"./lib/isHash":137,"./lib/isHexColor":138,"./lib/isHexadecimal":139,"./lib/isIP":140,"./lib/isISBN":141,"./lib/isISIN":142,"./lib/isISO8601":143,"./lib/isISRC":144,"./lib/isISSN":145,"./lib/isIn":146,"./lib/isInt":147,"./lib/isJSON":148,"./lib/isLatLong":149,"./lib/isLength":150,"./lib/isLowercase":151,"./lib/isMACAddress":152,"./lib/isMD5":153,"./lib/isMobilePhone":154,"./lib/isMongoId":155,"./lib/isMultibyte":156,"./lib/isNumeric":157,"./lib/isPostalCode":158,"./lib/isSurrogatePair":159,"./lib/isURL":160,"./lib/isUUID":161,"./lib/isUppercase":162,"./lib/isVariableWidth":163,"./lib/isWhitelisted":164,"./lib/ltrim":165,"./lib/matches":166,"./lib/normalizeEmail":167,"./lib/rtrim":168,"./lib/stripLow":169,"./lib/toBoolean":170,"./lib/toDate":171,"./lib/toFloat":172,"./lib/toInt":173,"./lib/trim":174,"./lib/unescape":175,"./lib/util/toString":178,"./lib/whitelist":179}],113:[function(require,module,exports){ +},{"./lib/blacklist":112,"./lib/contains":113,"./lib/equals":114,"./lib/escape":115,"./lib/isAfter":116,"./lib/isAlpha":117,"./lib/isAlphanumeric":118,"./lib/isAscii":119,"./lib/isBase64":120,"./lib/isBefore":121,"./lib/isBoolean":122,"./lib/isByteLength":123,"./lib/isCreditCard":124,"./lib/isCurrency":125,"./lib/isDataURI":126,"./lib/isDecimal":127,"./lib/isDivisibleBy":128,"./lib/isEmail":129,"./lib/isEmpty":130,"./lib/isFQDN":131,"./lib/isFloat":132,"./lib/isFullWidth":133,"./lib/isHalfWidth":134,"./lib/isHash":135,"./lib/isHexColor":136,"./lib/isHexadecimal":137,"./lib/isIP":138,"./lib/isISBN":139,"./lib/isISIN":140,"./lib/isISO31661Alpha2":141,"./lib/isISO8601":142,"./lib/isISRC":143,"./lib/isISSN":144,"./lib/isIn":145,"./lib/isInt":146,"./lib/isJSON":147,"./lib/isLatLong":148,"./lib/isLength":149,"./lib/isLowercase":150,"./lib/isMACAddress":151,"./lib/isMD5":152,"./lib/isMimeType":153,"./lib/isMobilePhone":154,"./lib/isMongoId":155,"./lib/isMultibyte":156,"./lib/isNumeric":157,"./lib/isPort":158,"./lib/isPostalCode":159,"./lib/isSurrogatePair":160,"./lib/isURL":161,"./lib/isUUID":162,"./lib/isUppercase":163,"./lib/isVariableWidth":164,"./lib/isWhitelisted":165,"./lib/ltrim":166,"./lib/matches":167,"./lib/normalizeEmail":168,"./lib/rtrim":169,"./lib/stripLow":170,"./lib/toBoolean":171,"./lib/toDate":172,"./lib/toFloat":173,"./lib/toInt":174,"./lib/trim":175,"./lib/unescape":176,"./lib/util/toString":179,"./lib/whitelist":180}],111:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43659,6 +43754,7 @@ var alpha = exports.alpha = { 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, 'da-DK': /^[A-ZÆØÅ]+$/i, 'de-DE': /^[A-ZÄÖÜß]+$/i, + 'el-GR': /^[Α-ω]+$/i, 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i, 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, 'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i, @@ -43673,7 +43769,7 @@ var alpha = exports.alpha = { 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i, 'sv-SE': /^[A-ZÅÄÖ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, - 'uk-UA': /^[А-ЩЬЮЯЄIЇҐ]+$/i, + 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; @@ -43682,6 +43778,7 @@ var alphanumeric = exports.alphanumeric = { 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, 'da-DK': /^[0-9A-ZÆØÅ]+$/i, 'de-DE': /^[0-9A-ZÄÖÜß]+$/i, + 'el-GR': /^[0-9Α-ω]+$/i, 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i, 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, 'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i, @@ -43696,21 +43793,24 @@ var alphanumeric = exports.alphanumeric = { 'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i, 'sv-SE': /^[0-9A-ZÅÄÖ]+$/i, 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, - 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐ]+$/i, + 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; +var decimal = exports.decimal = { + 'en-US': '.', + ar: '٫' +}; + var englishLocales = exports.englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM']; for (var locale, i = 0; i < englishLocales.length; i++) { locale = 'en-' + englishLocales[i]; alpha[locale] = alpha['en-US']; alphanumeric[locale] = alphanumeric['en-US']; + decimal[locale] = decimal['en-US']; } -alpha['pt-BR'] = alpha['pt-PT']; -alphanumeric['pt-BR'] = alphanumeric['pt-PT']; - // Source: http://www.localeplanet.com/java/ var arabicLocales = exports.arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE']; @@ -43718,8 +43818,25 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { _locale = 'ar-' + arabicLocales[_i]; alpha[_locale] = alpha.ar; alphanumeric[_locale] = alphanumeric.ar; + decimal[_locale] = decimal.ar; +} + +// Source: https://en.wikipedia.org/wiki/Decimal_mark +var dotDecimal = exports.dotDecimal = []; +var commaDecimal = exports.commaDecimal = ['cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-Pl', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA']; + +for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) { + decimal[dotDecimal[_i2]] = decimal['en-US']; +} + +for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) { + decimal[commaDecimal[_i3]] = ','; } -},{}],114:[function(require,module,exports){ + +alpha['pt-BR'] = alpha['pt-PT']; +alphanumeric['pt-BR'] = alphanumeric['pt-PT']; +decimal['pt-BR'] = decimal['pt-PT']; +},{}],112:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43738,7 +43855,7 @@ function blacklist(str, chars) { return str.replace(new RegExp('[' + chars + ']+', 'g'), ''); } module.exports = exports['default']; -},{"./util/assertString":176}],115:[function(require,module,exports){ +},{"./util/assertString":177}],113:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43761,7 +43878,7 @@ function contains(str, elem) { return str.indexOf((0, _toString2.default)(elem)) >= 0; } module.exports = exports['default']; -},{"./util/assertString":176,"./util/toString":178}],116:[function(require,module,exports){ +},{"./util/assertString":177,"./util/toString":179}],114:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43780,7 +43897,7 @@ function equals(str, comparison) { return str === comparison; } module.exports = exports['default']; -},{"./util/assertString":176}],117:[function(require,module,exports){ +},{"./util/assertString":177}],115:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43799,7 +43916,7 @@ function escape(str) { return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(//g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`'); } module.exports = exports['default']; -},{"./util/assertString":176}],118:[function(require,module,exports){ +},{"./util/assertString":177}],116:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43826,7 +43943,7 @@ function isAfter(str) { return !!(original && comparison && original > comparison); } module.exports = exports['default']; -},{"./toDate":171,"./util/assertString":176}],119:[function(require,module,exports){ +},{"./toDate":172,"./util/assertString":177}],117:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43852,7 +43969,7 @@ function isAlpha(str) { throw new Error('Invalid locale \'' + locale + '\''); } module.exports = exports['default']; -},{"./alpha":113,"./util/assertString":176}],120:[function(require,module,exports){ +},{"./alpha":111,"./util/assertString":177}],118:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43878,7 +43995,7 @@ function isAlphanumeric(str) { throw new Error('Invalid locale \'' + locale + '\''); } module.exports = exports['default']; -},{"./alpha":113,"./util/assertString":176}],121:[function(require,module,exports){ +},{"./alpha":111,"./util/assertString":177}],119:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43901,7 +44018,7 @@ function isAscii(str) { return ascii.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],122:[function(require,module,exports){ +},{"./util/assertString":177}],120:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43927,7 +44044,7 @@ function isBase64(str) { return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '='; } module.exports = exports['default']; -},{"./util/assertString":176}],123:[function(require,module,exports){ +},{"./util/assertString":177}],121:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43954,7 +44071,7 @@ function isBefore(str) { return !!(original && comparison && original < comparison); } module.exports = exports['default']; -},{"./toDate":171,"./util/assertString":176}],124:[function(require,module,exports){ +},{"./toDate":172,"./util/assertString":177}],122:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -43973,7 +44090,7 @@ function isBoolean(str) { return ['true', 'false', '1', '0'].indexOf(str) >= 0; } module.exports = exports['default']; -},{"./util/assertString":176}],125:[function(require,module,exports){ +},{"./util/assertString":177}],123:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44007,7 +44124,7 @@ function isByteLength(str, options) { return len >= min && (typeof max === 'undefined' || len <= max); } module.exports = exports['default']; -},{"./util/assertString":176}],126:[function(require,module,exports){ +},{"./util/assertString":177}],124:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44053,7 +44170,7 @@ function isCreditCard(str) { return !!(sum % 10 === 0 ? sanitized : false); } module.exports = exports['default']; -},{"./util/assertString":176}],127:[function(require,module,exports){ +},{"./util/assertString":177}],125:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44146,7 +44263,7 @@ function isCurrency(str, options) { return currencyRegex(options).test(str); } module.exports = exports['default']; -},{"./util/assertString":176,"./util/merge":177}],128:[function(require,module,exports){ +},{"./util/assertString":177,"./util/merge":178}],126:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44167,7 +44284,7 @@ function isDataURI(str) { return dataURI.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],129:[function(require,module,exports){ +},{"./util/assertString":177}],127:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44175,20 +44292,41 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = isDecimal; +var _merge = require('./util/merge'); + +var _merge2 = _interopRequireDefault(_merge); + var _assertString = require('./util/assertString'); var _assertString2 = _interopRequireDefault(_assertString); +var _alpha = require('./alpha'); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var decimal = /^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/; +function decimalRegExp(options) { + var regExp = new RegExp('^[-+]?([0-9]+)?(\\' + _alpha.decimal[options.locale] + '[0-9]{' + options.decimal_digits + '})' + (options.force_decimal ? '' : '?') + '$'); + return regExp; +} -function isDecimal(str) { +var default_decimal_options = { + force_decimal: false, + decimal_digits: '1,', + locale: 'en-US' +}; + +var blacklist = ['', '-', '+']; + +function isDecimal(str, options) { (0, _assertString2.default)(str); - return str !== '' && decimal.test(str); + options = (0, _merge2.default)(options, default_decimal_options); + if (options.locale in _alpha.decimal) { + return !blacklist.includes(str.replace(/ /g, '')) && decimalRegExp(options).test(str); + } + throw new Error('Invalid locale \'' + options.locale + '\''); } module.exports = exports['default']; -},{"./util/assertString":176}],130:[function(require,module,exports){ +},{"./alpha":111,"./util/assertString":177,"./util/merge":178}],128:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44211,7 +44349,7 @@ function isDivisibleBy(str, num) { return (0, _toFloat2.default)(str) % parseInt(num, 10) === 0; } module.exports = exports['default']; -},{"./toFloat":172,"./util/assertString":176}],131:[function(require,module,exports){ +},{"./toFloat":173,"./util/assertString":177}],129:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44301,7 +44439,7 @@ function isEmail(str, options) { return true; } module.exports = exports['default']; -},{"./isByteLength":125,"./isFQDN":133,"./util/assertString":176,"./util/merge":177}],132:[function(require,module,exports){ +},{"./isByteLength":123,"./isFQDN":131,"./util/assertString":177,"./util/merge":178}],130:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44320,13 +44458,13 @@ function isEmpty(str) { return str.length === 0; } module.exports = exports['default']; -},{"./util/assertString":176}],133:[function(require,module,exports){ +},{"./util/assertString":177}],131:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = isFDQN; +exports.default = isFQDN; var _assertString = require('./util/assertString'); @@ -44344,7 +44482,7 @@ var default_fqdn_options = { allow_trailing_dot: false }; -function isFDQN(str, options) { +function isFQDN(str, options) { (0, _assertString2.default)(str); options = (0, _merge2.default)(options, default_fqdn_options); @@ -44382,7 +44520,7 @@ function isFDQN(str, options) { return true; } module.exports = exports['default']; -},{"./util/assertString":176,"./util/merge":177}],134:[function(require,module,exports){ +},{"./util/assertString":177,"./util/merge":178}],132:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44394,20 +44532,21 @@ var _assertString = require('./util/assertString'); var _assertString2 = _interopRequireDefault(_assertString); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _alpha = require('./alpha'); -var float = /^(?:[-+])?(?:[0-9]+)?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isFloat(str, options) { (0, _assertString2.default)(str); options = options || {}; - if (str === '' || str === '.') { + var float = new RegExp('^(?:[-+])?(?:[0-9]+)?(?:\\' + (options.locale ? _alpha.decimal[options.locale] : '.') + '[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$'); + if (str === '' || str === '.' || str === '-' || str === '+') { return false; } return float.test(str) && (!options.hasOwnProperty('min') || str >= options.min) && (!options.hasOwnProperty('max') || str <= options.max) && (!options.hasOwnProperty('lt') || str < options.lt) && (!options.hasOwnProperty('gt') || str > options.gt); } module.exports = exports['default']; -},{"./util/assertString":176}],135:[function(require,module,exports){ +},{"./alpha":111,"./util/assertString":177}],133:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44428,7 +44567,7 @@ function isFullWidth(str) { (0, _assertString2.default)(str); return fullWidth.test(str); } -},{"./util/assertString":176}],136:[function(require,module,exports){ +},{"./util/assertString":177}],134:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44449,7 +44588,7 @@ function isHalfWidth(str) { (0, _assertString2.default)(str); return halfWidth.test(str); } -},{"./util/assertString":176}],137:[function(require,module,exports){ +},{"./util/assertString":177}],135:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44485,7 +44624,7 @@ function isHash(str, algorithm) { return hash.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],138:[function(require,module,exports){ +},{"./util/assertString":177}],136:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44506,7 +44645,7 @@ function isHexColor(str) { return hexcolor.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],139:[function(require,module,exports){ +},{"./util/assertString":177}],137:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44527,7 +44666,7 @@ function isHexadecimal(str) { return hexadecimal.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],140:[function(require,module,exports){ +},{"./util/assertString":177}],138:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44609,7 +44748,7 @@ function isIP(str) { return false; } module.exports = exports['default']; -},{"./util/assertString":176}],141:[function(require,module,exports){ +},{"./util/assertString":177}],139:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44667,7 +44806,7 @@ function isISBN(str) { return false; } module.exports = exports['default']; -},{"./util/assertString":176}],142:[function(require,module,exports){ +},{"./util/assertString":177}],140:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44716,7 +44855,29 @@ function isISIN(str) { return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10; } module.exports = exports['default']; -},{"./util/assertString":176}],143:[function(require,module,exports){ +},{"./util/assertString":177}],141:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISO31661Alpha2; + +var _assertString = require('./util/assertString'); + +var _assertString2 = _interopRequireDefault(_assertString); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +var validISO31661Alpha2CountriesCodes = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW']; + +function isISO31661Alpha2(str) { + (0, _assertString2.default)(str); + return validISO31661Alpha2CountriesCodes.includes(str.toUpperCase()); +} +module.exports = exports['default']; +},{"./util/assertString":177}],142:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44740,7 +44901,7 @@ function isISO8601(str) { return iso8601.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],144:[function(require,module,exports){ +},{"./util/assertString":177}],143:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44762,7 +44923,7 @@ function isISRC(str) { return isrc.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],145:[function(require,module,exports){ +},{"./util/assertString":177}],144:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44821,7 +44982,7 @@ function isISSN(str) { return checksum % 11 === 0; } module.exports = exports['default']; -},{"./util/assertString":176}],146:[function(require,module,exports){ +},{"./util/assertString":177}],145:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44861,7 +45022,7 @@ function isIn(str, options) { return false; } module.exports = exports['default']; -},{"./util/assertString":176,"./util/toString":178}],147:[function(require,module,exports){ +},{"./util/assertString":177,"./util/toString":179}],146:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44895,7 +45056,7 @@ function isInt(str, options) { return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed; } module.exports = exports['default']; -},{"./util/assertString":176}],148:[function(require,module,exports){ +},{"./util/assertString":177}],147:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44921,7 +45082,7 @@ function isJSON(str) { return false; } module.exports = exports['default']; -},{"./util/assertString":176}],149:[function(require,module,exports){ +},{"./util/assertString":177}],148:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44945,7 +45106,7 @@ var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; module.exports = exports['default']; -},{"./util/assertString":176}],150:[function(require,module,exports){ +},{"./util/assertString":177}],149:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44980,7 +45141,7 @@ function isLength(str, options) { return len >= min && (typeof max === 'undefined' || len <= max); } module.exports = exports['default']; -},{"./util/assertString":176}],151:[function(require,module,exports){ +},{"./util/assertString":177}],150:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -44999,7 +45160,7 @@ function isLowercase(str) { return str === str.toLowerCase(); } module.exports = exports['default']; -},{"./util/assertString":176}],152:[function(require,module,exports){ +},{"./util/assertString":177}],151:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45020,7 +45181,7 @@ function isMACAddress(str) { return macAddress.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],153:[function(require,module,exports){ +},{"./util/assertString":177}],152:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45041,7 +45202,60 @@ function isMD5(str) { return md5.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],154:[function(require,module,exports){ +},{"./util/assertString":177}],153:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMimeType; + +var _assertString = require('./util/assertString'); + +var _assertString2 = _interopRequireDefault(_assertString); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* + Checks if the provided string matches to a correct Media type format (MIME type) + + This function only checks is the string format follows the + etablished rules by the according RFC specifications. + This function supports 'charset' in textual media types + (https://tools.ietf.org/html/rfc6657). + + This function does not check against all the media types listed + by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml) + because of lightness purposes : it would require to include + all these MIME types in this librairy, which would weigh it + significantly. This kind of effort maybe is not worth for the use that + this function has in this entire librairy. + + More informations in the RFC specifications : + - https://tools.ietf.org/html/rfc2045 + - https://tools.ietf.org/html/rfc2046 + - https://tools.ietf.org/html/rfc7231#section-3.1.1.1 + - https://tools.ietf.org/html/rfc7231#section-3.1.1.5 +*/ + +// Match simple MIME types +// NB : +// Subtype length must not exceed 100 characters. +// This rule does not comply to the RFC specs (what is the max length ?). +var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len + +// Handle "charset" in "text/*" +var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len + +// Handle "boundary" in "multipart/*" +var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len + +function isMimeType(str) { + (0, _assertString2.default)(str); + return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str); +} +module.exports = exports['default']; +},{"./util/assertString":177}],154:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45061,37 +45275,41 @@ var phones = { 'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/, 'ar-EG': /^((\+?20)|0)?1[012]\d{8}$/, 'ar-JO': /^(\+?962|0)?7[789]\d{7}$/, - 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, - 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/, + 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, - 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, + 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/, 'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, - 'da-DK': /^(\+?45)?(\d{8})$/, - 'el-GR': /^(\+?30)?(69\d{8})$/, + 'el-GR': /^(\+?30|0)?(69\d{8})$/, 'en-AU': /^(\+?61|0)4\d{8}$/, 'en-GB': /^(\+?44|0)7\d{9}$/, - 'en-HK': /^(\+?852\-?)?[569]\d{3}\-?\d{4}$/, + 'en-HK': /^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/, 'en-IN': /^(\+?91|0)?[789]\d{9}$/, 'en-KE': /^(\+?254|0)?[7]\d{8}$/, 'en-NG': /^(\+?234|0)?[789]\d{9}$/, 'en-NZ': /^(\+?64|0)2\d{7,9}$/, - 'en-UG': /^(\+?256|0)?[7]\d{8}$/, + 'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/, 'en-RW': /^(\+?250|0)?[7]\d{8}$/, + 'en-SG': /^(\+65)?[89]\d{7}$/, 'en-TZ': /^(\+?255|0)?[67]\d{8}$/, + 'en-UG': /^(\+?256|0)?[7]\d{8}$/, + 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/, 'en-ZA': /^(\+?27|0)\d{9}$/, 'en-ZM': /^(\+?26)?09[567]\d{7}$/, 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, - 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/, + 'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/, 'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/, + 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/, + 'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 'fr-FR': /^(\+?33|0)[67]\d{8}$/, 'he-IL': /^(\+972|0)([23489]|5[0248]|77)[1-9]\d{6}/, 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, - 'lt-LT': /^(\+370|8)\d{8}$/, 'id-ID': /^(\+?62|0[1-9])[\s|\d]+$/, 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, + 'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/, + 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/, - 'ja-JP': /^(\+?81|0)\d{1,4}[ \-]?\d{1,4}[ \-]?\d{4}$/, + 'lt-LT': /^(\+370|8)\d{8}$/, 'ms-MY': /^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/, 'nb-NO': /^(\+?47)?[49]\d{7}$/, 'nl-BE': /^(\+?32|0)4?\d{8}$/, @@ -45100,10 +45318,11 @@ var phones = { 'pt-BR': /^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/, 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, 'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/, - 'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/, 'ru-RU': /^(\+?7|8)?9\d{9}$/, + 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/, 'tr-TR': /^(\+?90|0)?5\d{9}$/, + 'uk-UA': /^(\+?38|8)?0\d{9}$/, 'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/, 'zh-CN': /^(\+?0?86\-?)?1[345789]\d{9}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ @@ -45133,7 +45352,7 @@ function isMobilePhone(str, locale) { throw new Error('Invalid locale \'' + locale + '\''); } module.exports = exports['default']; -},{"./util/assertString":176}],155:[function(require,module,exports){ +},{"./util/assertString":177}],155:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45156,7 +45375,7 @@ function isMongoId(str) { return (0, _isHexadecimal2.default)(str) && str.length === 24; } module.exports = exports['default']; -},{"./isHexadecimal":139,"./util/assertString":176}],156:[function(require,module,exports){ +},{"./isHexadecimal":137,"./util/assertString":177}],156:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45179,7 +45398,7 @@ function isMultibyte(str) { return multibyte.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],157:[function(require,module,exports){ +},{"./util/assertString":177}],157:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45200,7 +45419,25 @@ function isNumeric(str) { return numeric.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],158:[function(require,module,exports){ +},{"./util/assertString":177}],158:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isPort; + +var _isInt = require('./isInt'); + +var _isInt2 = _interopRequireDefault(_isInt); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isPort(str) { + return (0, _isInt2.default)(str, { min: 0, max: 65535 }); +} +module.exports = exports['default']; +},{"./isInt":146}],159:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45240,7 +45477,7 @@ var sixDigit = /^\d{6}$/; var patterns = { AT: fourDigit, - AU: sixDigit, + AU: fourDigit, BE: fourDigit, CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, CH: fourDigit, @@ -45264,7 +45501,7 @@ var patterns = { NL: /^\d{4}\s?[a-z]{2}$/i, NO: fourDigit, PL: /^\d{2}\-\d{3}$/, - PT: /^\d{4}(\-\d{3})?$/, + PT: /^\d{4}\-\d{3}?$/, RO: sixDigit, RU: sixDigit, SA: fiveDigit, @@ -45276,7 +45513,7 @@ var patterns = { }; var locales = exports.locales = Object.keys(patterns); -},{"./util/assertString":176}],159:[function(require,module,exports){ +},{"./util/assertString":177}],160:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45297,7 +45534,7 @@ function isSurrogatePair(str) { return surrogatePair.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],160:[function(require,module,exports){ +},{"./util/assertString":177}],161:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45445,7 +45682,7 @@ function isURL(url, options) { return true; } module.exports = exports['default']; -},{"./isFQDN":133,"./isIP":140,"./util/assertString":176,"./util/merge":177}],161:[function(require,module,exports){ +},{"./isFQDN":131,"./isIP":138,"./util/assertString":177,"./util/merge":178}],162:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45474,7 +45711,7 @@ function isUUID(str) { return pattern && pattern.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],162:[function(require,module,exports){ +},{"./util/assertString":177}],163:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45493,7 +45730,7 @@ function isUppercase(str) { return str === str.toUpperCase(); } module.exports = exports['default']; -},{"./util/assertString":176}],163:[function(require,module,exports){ +},{"./util/assertString":177}],164:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45516,7 +45753,7 @@ function isVariableWidth(str) { return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str); } module.exports = exports['default']; -},{"./isFullWidth":135,"./isHalfWidth":136,"./util/assertString":176}],164:[function(require,module,exports){ +},{"./isFullWidth":133,"./isHalfWidth":134,"./util/assertString":177}],165:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45540,7 +45777,7 @@ function isWhitelisted(str, chars) { return true; } module.exports = exports['default']; -},{"./util/assertString":176}],165:[function(require,module,exports){ +},{"./util/assertString":177}],166:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45560,7 +45797,7 @@ function ltrim(str, chars) { return str.replace(pattern, ''); } module.exports = exports['default']; -},{"./util/assertString":176}],166:[function(require,module,exports){ +},{"./util/assertString":177}],167:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45582,7 +45819,7 @@ function matches(str, pattern, modifiers) { return pattern.test(str); } module.exports = exports['default']; -},{"./util/assertString":176}],167:[function(require,module,exports){ +},{"./util/assertString":177}],168:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45590,10 +45827,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = normalizeEmail; -var _isEmail = require('./isEmail'); - -var _isEmail2 = _interopRequireDefault(_isEmail); - var _merge = require('./util/merge'); var _merge2 = _interopRequireDefault(_merge); @@ -45652,10 +45885,6 @@ var yahoo_domains = ['rocketmail.com', 'yahoo.ca', 'yahoo.co.uk', 'yahoo.com', ' function normalizeEmail(email, options) { options = (0, _merge2.default)(options, default_normalize_email_options); - if (!(0, _isEmail2.default)(email)) { - return false; - } - var raw_parts = email.split('@'); var domain = raw_parts.pop(); var user = raw_parts.join('@'); @@ -45720,7 +45949,7 @@ function normalizeEmail(email, options) { return parts.join('@'); } module.exports = exports['default']; -},{"./isEmail":131,"./util/merge":177}],168:[function(require,module,exports){ +},{"./util/merge":178}],169:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45746,7 +45975,7 @@ function rtrim(str, chars) { return idx < str.length ? str.substr(0, idx + 1) : str; } module.exports = exports['default']; -},{"./util/assertString":176}],169:[function(require,module,exports){ +},{"./util/assertString":177}],170:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45770,7 +45999,7 @@ function stripLow(str, keep_new_lines) { return (0, _blacklist2.default)(str, chars); } module.exports = exports['default']; -},{"./blacklist":114,"./util/assertString":176}],170:[function(require,module,exports){ +},{"./blacklist":112,"./util/assertString":177}],171:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45792,7 +46021,7 @@ function toBoolean(str, strict) { return str !== '0' && str !== 'false' && str !== ''; } module.exports = exports['default']; -},{"./util/assertString":176}],171:[function(require,module,exports){ +},{"./util/assertString":177}],172:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45812,7 +46041,7 @@ function toDate(date) { return !isNaN(date) ? new Date(date) : null; } module.exports = exports['default']; -},{"./util/assertString":176}],172:[function(require,module,exports){ +},{"./util/assertString":177}],173:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45831,7 +46060,7 @@ function toFloat(str) { return parseFloat(str); } module.exports = exports['default']; -},{"./util/assertString":176}],173:[function(require,module,exports){ +},{"./util/assertString":177}],174:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45850,7 +46079,7 @@ function toInt(str, radix) { return parseInt(str, radix || 10); } module.exports = exports['default']; -},{"./util/assertString":176}],174:[function(require,module,exports){ +},{"./util/assertString":177}],175:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45872,7 +46101,7 @@ function trim(str, chars) { return (0, _rtrim2.default)((0, _ltrim2.default)(str, chars), chars); } module.exports = exports['default']; -},{"./ltrim":165,"./rtrim":168}],175:[function(require,module,exports){ +},{"./ltrim":166,"./rtrim":169}],176:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45891,7 +46120,7 @@ function unescape(str) { return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`'); } module.exports = exports['default']; -},{"./util/assertString":176}],176:[function(require,module,exports){ +},{"./util/assertString":177}],177:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45906,7 +46135,7 @@ function assertString(input) { } } module.exports = exports['default']; -},{}],177:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45925,7 +46154,7 @@ function merge() { return obj; } module.exports = exports['default']; -},{}],178:[function(require,module,exports){ +},{}],179:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45948,7 +46177,7 @@ function toString(input) { return String(input); } module.exports = exports['default']; -},{}],179:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -45967,7 +46196,7 @@ function whitelist(str, chars) { return str.replace(new RegExp('[^' + chars + ']+', 'g'), ''); } module.exports = exports['default']; -},{"./util/assertString":176}],180:[function(require,module,exports){ +},{"./util/assertString":177}],181:[function(require,module,exports){ "use strict"; module.exports = { @@ -46028,7 +46257,7 @@ module.exports = { }; -},{}],181:[function(require,module,exports){ +},{}],182:[function(require,module,exports){ /*jshint maxlen: false*/ var validator = require("validator"); @@ -46159,7 +46388,7 @@ var FormatValidators = { module.exports = FormatValidators; -},{"validator":112}],182:[function(require,module,exports){ +},{"validator":110}],183:[function(require,module,exports){ "use strict"; var FormatValidators = require("./FormatValidators"), @@ -46702,7 +46931,7 @@ exports.validate = function (report, schema, json) { }; -},{"./FormatValidators":181,"./Report":184,"./Utils":188}],183:[function(require,module,exports){ +},{"./FormatValidators":182,"./Report":185,"./Utils":189}],184:[function(require,module,exports){ // Number.isFinite polyfill // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite if (typeof Number.isFinite !== "function") { @@ -46720,7 +46949,7 @@ if (typeof Number.isFinite !== "function") { }; } -},{}],184:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ (function (process){ "use strict"; @@ -46927,7 +47156,7 @@ module.exports = Report; }).call(this,require('_process')) -},{"./Errors":180,"./Utils":188,"_process":95,"lodash.get":82}],185:[function(require,module,exports){ +},{"./Errors":181,"./Utils":189,"_process":93,"lodash.get":78}],186:[function(require,module,exports){ "use strict"; var isequal = require("lodash.isequal"); @@ -47051,7 +47280,15 @@ exports.getSchemaByUri = function (report, uri, root) { var remoteReport = new Report(report); if (SchemaCompilation.compileSchema.call(this, remoteReport, result)) { - SchemaValidation.validateSchema.call(this, remoteReport, result); + var savedOptions = this.options; + try { + // If custom validationOptions were provided to setRemoteReference(), + // use them instead of the default options + this.options = result.__$validationOptions || this.options; + SchemaValidation.validateSchema.call(this, remoteReport, result); + } finally { + this.options = savedOptions; + } } var remoteReportIsValid = remoteReport.isValid(); if (!remoteReportIsValid) { @@ -47083,7 +47320,7 @@ exports.getSchemaByUri = function (report, uri, root) { exports.getRemotePath = getRemotePath; -},{"./Report":184,"./SchemaCompilation":186,"./SchemaValidation":187,"./Utils":188,"lodash.isequal":84}],186:[function(require,module,exports){ +},{"./Report":185,"./SchemaCompilation":187,"./SchemaValidation":188,"./Utils":189,"lodash.isequal":81}],187:[function(require,module,exports){ "use strict"; var Report = require("./Report"); @@ -47384,7 +47621,7 @@ exports.compileSchema = function (report, schema) { }; -},{"./Report":184,"./SchemaCache":185,"./Utils":188}],187:[function(require,module,exports){ +},{"./Report":185,"./SchemaCache":186,"./Utils":189}],188:[function(require,module,exports){ "use strict"; var FormatValidators = require("./FormatValidators"), @@ -47993,7 +48230,7 @@ exports.validateSchema = function (report, schema) { return isValid; }; -},{"./FormatValidators":181,"./JsonValidation":182,"./Report":184,"./Utils":188}],188:[function(require,module,exports){ +},{"./FormatValidators":182,"./JsonValidation":183,"./Report":185,"./Utils":189}],189:[function(require,module,exports){ "use strict"; exports.isAbsoluteUri = function (uri) { @@ -48212,7 +48449,7 @@ exports.ucs2decode = function (string) { }; /*jshint +W016*/ -},{}],189:[function(require,module,exports){ +},{}],190:[function(require,module,exports){ (function (process){ "use strict"; @@ -48276,15 +48513,8 @@ var defaultOptions = { customValidator: null }; -/* - constructor -*/ -function ZSchema(options) { - this.cache = {}; - this.referenceCache = []; - - this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema); - this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema); +function normalizeOptions(options) { + var normalized; // options if (typeof options === "object") { @@ -48310,22 +48540,39 @@ function ZSchema(options) { } } - this.options = options; + normalized = options; } else { - this.options = Utils.clone(defaultOptions); + normalized = Utils.clone(defaultOptions); } - if (this.options.strictMode === true) { - this.options.forceAdditional = true; - this.options.forceItems = true; - this.options.forceMaxLength = true; - this.options.forceProperties = true; - this.options.noExtraKeywords = true; - this.options.noTypeless = true; - this.options.noEmptyStrings = true; - this.options.noEmptyArrays = true; + if (normalized.strictMode === true) { + normalized.forceAdditional = true; + normalized.forceItems = true; + normalized.forceMaxLength = true; + normalized.forceProperties = true; + normalized.noExtraKeywords = true; + normalized.noTypeless = true; + normalized.noEmptyStrings = true; + normalized.noEmptyArrays = true; } + return normalized; +} + +/* + constructor +*/ +function ZSchema(options) { + this.cache = {}; + this.referenceCache = []; + + this.options = normalizeOptions(options); + + // Disable strict validation for the built-in schemas + var metaschemaOptions = normalizeOptions({ }); + + this.setRemoteReference("http://json-schema.org/draft-04/schema", Draft4Schema, metaschemaOptions); + this.setRemoteReference("http://json-schema.org/draft-04/hyper-schema", Draft4HyperSchema, metaschemaOptions); } /* @@ -48473,12 +48720,17 @@ ZSchema.prototype.getMissingRemoteReferences = function () { } return missingRemoteReferences; }; -ZSchema.prototype.setRemoteReference = function (uri, schema) { +ZSchema.prototype.setRemoteReference = function (uri, schema, validationOptions) { if (typeof schema === "string") { schema = JSON.parse(schema); } else { schema = Utils.cloneDeep(schema); } + + if (validationOptions) { + schema.__$validationOptions = normalizeOptions(validationOptions); + } + SchemaCache.cacheSchemaByUri.call(this, uri, schema); }; ZSchema.prototype.getResolvedSchema = function (schema) { @@ -48569,7 +48821,7 @@ module.exports = ZSchema; }).call(this,require('_process')) -},{"./FormatValidators":181,"./JsonValidation":182,"./Polyfills":183,"./Report":184,"./SchemaCache":185,"./SchemaCompilation":186,"./SchemaValidation":187,"./Utils":188,"./schemas/hyper-schema.json":190,"./schemas/schema.json":191,"_process":95,"lodash.get":82}],190:[function(require,module,exports){ +},{"./FormatValidators":182,"./JsonValidation":183,"./Polyfills":184,"./Report":185,"./SchemaCache":186,"./SchemaCompilation":187,"./SchemaValidation":188,"./Utils":189,"./schemas/hyper-schema.json":191,"./schemas/schema.json":192,"_process":93,"lodash.get":78}],191:[function(require,module,exports){ module.exports={ "$schema": "http://json-schema.org/draft-04/hyper-schema#", "id": "http://json-schema.org/draft-04/hyper-schema#", @@ -48729,7 +48981,7 @@ module.exports={ } -},{}],191:[function(require,module,exports){ +},{}],192:[function(require,module,exports){ module.exports={ "id": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -48882,7 +49134,7 @@ module.exports={ "default": {} } -},{}],192:[function(require,module,exports){ +},{}],193:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/apiDeclaration.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -48945,7 +49197,7 @@ module.exports={ } } -},{}],193:[function(require,module,exports){ +},{}],194:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/authorizationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49006,7 +49258,7 @@ module.exports={ } -},{}],194:[function(require,module,exports){ +},{}],195:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/dataType.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49139,7 +49391,7 @@ module.exports={ } } } -},{}],195:[function(require,module,exports){ +},{}],196:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/dataTypeBase.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49222,7 +49474,7 @@ module.exports={ } } -},{}],196:[function(require,module,exports){ +},{}],197:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/infoObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49239,7 +49491,7 @@ module.exports={ }, "additionalProperties": false } -},{}],197:[function(require,module,exports){ +},{}],198:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/modelsObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49277,7 +49529,7 @@ module.exports={ } -},{}],198:[function(require,module,exports){ +},{}],199:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/oauth2GrantType.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49335,7 +49587,7 @@ module.exports={ } } } -},{}],199:[function(require,module,exports){ +},{}],200:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/operationObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49402,7 +49654,7 @@ module.exports={ } } -},{}],200:[function(require,module,exports){ +},{}],201:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/parameterObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49441,7 +49693,7 @@ module.exports={ ] } -},{}],201:[function(require,module,exports){ +},{}],202:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/resourceListing.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49459,7 +49711,7 @@ module.exports={ } } -},{}],202:[function(require,module,exports){ +},{}],203:[function(require,module,exports){ module.exports={ "id": "http://wordnik.github.io/schemas/v1.2/resourceObject.json#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -49471,7 +49723,7 @@ module.exports={ }, "additionalProperties": false } -},{}],203:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ module.exports={ "title": "A JSON Schema for Swagger 2.0 API.", "id": "http://swagger.io/v2/schema.json#", @@ -51063,7 +51315,7 @@ module.exports={ } } } -},{}],204:[function(require,module,exports){ +},{}],205:[function(require,module,exports){ module.exports={ "id": "http://json-schema.org/draft-04/schema#", "$schema": "http://json-schema.org/draft-04/schema#", @@ -51217,4 +51469,4 @@ module.exports={ },{}]},{},[2])(2) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvaGVscGVycy5qcyIsImxpYi9zcGVjcy5qcyIsImxpYi92YWxpZGF0b3JzLmpzIiwibm9kZV9tb2R1bGVzL2FzeW5jL2Rpc3QvYXN5bmMuanMiLCJub2RlX21vZHVsZXMvYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvcHVueWNvZGUvcHVueWNvZGUuanMiLCJub2RlX21vZHVsZXMvY29tcG9uZW50LWVtaXR0ZXIvaW5kZXguanMiLCJub2RlX21vZHVsZXMvZ3JhcGhsaWIvaW5kZXguanMiLCJub2RlX21vZHVsZXMvZ3JhcGhsaWIvbGliL2FsZy9jb21wb25lbnRzLmpzIiwibm9kZV9tb2R1bGVzL2dyYXBobGliL2xpYi9hbGcvZGZzLmpzIiwibm9kZV9tb2R1bGVzL2dyYXBobGliL2xpYi9hbGcvZGlqa3N0cmEtYWxsLmpzIiwibm9kZV9tb2R1bGVzL2dyYXBobGliL2xpYi9hbGcvZGlqa3N0cmEuanMiLCJub2RlX21vZHVsZXMvZ3JhcGhsaWIvbGliL2F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ZiBtdWx0aXBsZSBtb2RlbHM6ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5tYXAobWV0YWRhdGEucGFyZW50cywgZnVuY3Rpb24gKHBhcmVudCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0RGlzcGxheUlkKHBhcmVudCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcgJiYgJyksIGRlZlBhdGgsIHJlc3VsdHMuZXJyb3JzKTtcbiAgICB9XG5cbiAgICBpZiAobWV0YWRhdGEuY3ljbGljYWwpIHtcbiAgICAgIGNyZWF0ZUVycm9yT3JXYXJuaW5nKCdDWUNMSUNBTF8nICsgY29kZSArICdfSU5IRVJJVEFOQ0UnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgbXNnUHJlZml4ICsgJyBoYXMgYSBjaXJjdWxhciBpbmhlcml0YW5jZTogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8ubWFwKGxpbmVhZ2UsIGZ1bmN0aW9uIChkZXApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0RGlzcGxheUlkKGRlcCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyAtPiAnKSArICcgLT4gJyArIGdldERpc3BsYXlJZChpZCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmUGF0aC5jb25jYXQoc3dhZ2dlclZlcnNpb24gPT09ICcxLjInID8gJ3N1YlR5cGVzJyA6ICdhbGxPZicpLCByZXN1bHRzLmVycm9ycyk7XG4gICAgfVxuXG4gICAgLy8gUmVtb3ZlIHNlbGYgcmVmZXJlbmNlIGZyb20gdGhlIGVuZCBvZiB0aGUgbGluZWFnZSAoRnJvbnQgdG9vIGlmIGN5Y2xpY2FsKVxuICAgIF8uZWFjaChsaW5lYWdlLnNsaWNlKG1ldGFkYXRhLmN5Y2xpY2FsID8gMSA6IDApLCBmd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JuaW5nKCdDSElMRF8nICsgY29kZSArICdfUkVERUNMQVJFU19QUk9QRVJUWScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NoaWxkICcgKyBjb2RlLnRvTG93ZXJDYXNlKCkgKyAnIGRlY2xhcmVzIHByb3BlcnR5IGFscmVhZHkgZGVjbGFyZWQgYnkgYW5jZXN0b3I6ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcFBhdGgsIHJlc3VsdHMuZXJyb3JzKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBkUHJvcGVydGllcy5wdXNoKG5hbWUpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICAvLyBJZGVudGlmeSBtaXNzaW5nIHJlcXVpcmVkIHByb3BlcnRpZXNcbiAgICBfLmVhY2goZGVmaW5pdGlvbi5yZXF1aXJlZCB8fCBbXSwgZnVuY3Rpb24gKG5hbWUsIGluZGV4KSB7XG4gICAgICB2YXIgdHlwZSA9IHN3YWdnZXJWZXJzaW9uID09PSAnMS4yJyA/ICdNb2RlbCcgOiAnRGVmaW5pdGlvbic7XG5cbiAgICAgIGlmIChpUHJvcGVydGllcy5pbmRleE9mKG5hbWUpID09PSAtMSAmJiBkUHJvcGVydGllcy5pbmRleE9mKG5hbWUpID09PSAtMSkge1xuICAgICAgICBjcmVhdGVFcnJvck9yV2FybmluZygnTUlTU0lOR19SRVFVSVJFRF8nICsgdHlwZS50b1VwcGVyQ2FzZSgpICsgJ19QUk9QRVJUWScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgKyAnIHJlcXVpcmVzIHByb3BlcnR5IGJ1dCBpdCBpcyBub3QgZGVmaW5lZDogJyArIG5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZlBhdGguY29uY2F0KFsncmVxdWlyZWQnLCBpbmRleC50b1N0cmluZ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GUgUmVzb3VyY2UgTGlzdGluZyB3YXMgdmFsaWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHRzICYmIHNwZWMudmVyc2lvbiA9PT0gJzEuMicpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRzID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JzOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhcm5pbmdzOiBbXSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwaURlY2xhcmF0aW9uczogW11cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXN5bmMubWFwKGFwaURlY2xhcmF0aW9ucywgZnVuY3Rpb24gKGFwaURlY2xhcmF0aW9uLCBjYWxsYmFjazIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlQWdhaW5zdFNjaGVtYShzcGVjLCAnYXBpRGVjbGFyYXRpb24uanNvbicsIGFwaURlY2xhcmF0aW9uLCBjYWxsYmFjazIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlcnIsIGFsbFJlc3VsdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrKGVycik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uZWFjaChhbGxSZXN1bHRzLCBmdW5jdGlvbiAocmVzdWx0LCBpbmRleCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHRzLmFwaURlY2xhcmF0aW9uc1tpbmRleF0gPSByZXN1bHQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtc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iAgICB9IGVsc2Uge1xuICAgICAgc3dpdGNoICh0eXBlKSB7XG4gICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgICAgLy8gQ29lcmNlIHRoZSB2YWx1ZSBvbmx5IGZvciBTd2FnZ2VyIDEuMlxuICAgICAgICBpZiAodmVyc2lvbiA9PT0gJzEuMicgJiYgXy5pc1N0cmluZyh2YWwpKSB7XG4gICAgICAgICAgaWYgKHZhbCA9PT0gJ2ZhbHNlJykge1xuICAgICAgICAgICAgdmFsID0gZmFsc2U7XG4gICAgICAgICAgfSBlbHNlIGlmICh2YWwgPT09ICd0cnVlJykge1xuICAgICAgICAgICAgdmFsID0gdHJ1ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXN1bHQgPSBfLmlzQm9vbGVhbih2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ2ludGVnZXInOlxuICAgICAgICAvLyBDb2VyY2UgdGhlIHZhbHVlIG9ubHkgZm9yIFN3YWdnZXIgMS4yXG4gICAgICAgIGlmICh2ZXJzaW9uID09PSAnMS4yJyAmJiBfLmlzU3RyaW5nKHZhbCkpIHtcbiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJlc3VsdCA9IF8uaXNGaW5pdGUodmFsKSAmJiAoTWF0aC5yb3VuZCh2YWwpID09PSB2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ251bWJlcic6XG4gICAgICAgIC8vIENvZXJjZSB0aGUgdmFsdWUgb25seSBmb3IgU3dhZ2dlciAxLjJcbiAgICAgICAgaWYgKHZlcnNpb24gPT09ICcxLjInICYmIF8uaXNTdHJpbmcodmFsKSkge1xuICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmVzdWx0ID0gXy5pc0Zpbml0ZSh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3N0cmluZyc6XG4gICAgICAgIGlmICghXy5pc1VuZGVmaW5lZChmb3JtYXQpKSB7XG4gICAgICAgICAgc3dpdGNoIChmb3JtYXQpIHtcbiAgICAgICAgICBjYXNlICdkYXRlJzpcbiAgICAgICAgICAgIHJlc3VsdCA9IGlzVmFsaWREYXRlKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICdkYXRlLXRpbWUnOlxuICAgICAgICAgICAgcmVzdWx0ID0gaXNWYWxpZERhdGVUaW1lKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICd2b2lkJzpcbiAgICAgICAgcmVzdWx0ID0gXy5pc1VuZGVmaW5lZCh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAoc2tpcEVycm9yKSB7XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0gZWxzZSBpZiAoIXJlc3VsdCkge1xuICAgICAgdGhyb3dFcnJvcldpdGhDb2RlKCdJTlZBTElEX1RZUEUnLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgIT09ICd2b2lkJyA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAnTm90IGEgdmFsaWQgJyArIChfLmlzVW5kZWZpbmVkKGZvcm1hdCkgPyAnJyA6IGZvcm1hdCArICcgJykgKyB0eXBlICsgJzogJyArIG9WYWwgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZvaWQgZG9lcyBub3QgYWxsb3cgYSB2YWx1ZScpO1xuICAgIH1cbiAgfTtcblxuLyoqXG4gKiBWYWxpZGF0ZXMgdGhlIHZhbHVlIHZhbHVlcyBhcmUgdW5pcXVlICh3aGVuIG5lY2Vzc2FyeSkuXG4gKlxuICogQHBhcmFtIHtzdHJpbmdbXX0gdmFsIC0gVGhlIHBhcmFtZXRlciB2YWx1ZVxuIC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SB7XG4gICAgICAgICAgICAgICAgZG9uZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrKG51bGwpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVwbGVuaXNoKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiByZXBsZW5pc2ggKCkge1xuICAgICAgICAgICAgd2hpbGUgKHJ1bm5pbmcgPCBsaW1pdCAmJiAhZG9uZSkge1xuICAgICAgICAgICAgICAgIHZhciBlbGVtID0gbmV4dEVsZW0oKTtcbiAgICAgICAgICAgICAgICBpZiAoZWxlbSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJ1bm5pbmcgPD0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2sobnVsbCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBydW5uaW5nICs9IDE7XG4gICAgICAgICAgICAgICAgaXRlcmF0ZWUoZWxlbS52YWx1ZSwgZWxlbS5rZXksIG9ubHlPbmNlKGl0ZXJhdGVlQ2FsbGJhY2spKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJlcGxlbmlzaCgpO1xuICAgIH07XG59XG5cbi8qKlxuICogVGhlIHNhbWUgYXMgW2BlYWNoT2ZgXXtAbGluayBtb2R1bGU6Q29sbGVjdGlvbnMuZWFjaE9mfSBidXQgcnVucyBhIG1heGltdW0gb2YgYGxpbWl0YCBhc3luYyBvcGVyYXRpb25zIGF0IGFcbiAqIHRpbWUuXG4gKlxuICogQG5hbWUgZWFjaE9mTGltaXRcbiAqIEBzdGF0aWNcbiAqIEBtZW1iZXJPZiB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CBbdGFza10pO1xuICAgICAgICAgICAgcmVhZHlUb0NoZWNrLnB1c2goa2V5KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBkZXBlbmRlbmNpZXMgPSB0YXNrLnNsaWNlKDAsIHRhc2subGVuZ3RoIC0gMSk7XG4gICAgICAgIHZhciByZW1haW5pbmdEZXBlbmRlbmNpZXMgPSBkZXBlbmRlbmNpZXMubGVuZ3RoO1xuICAgICAgICBpZiAocmVtYWluaW5nRGVwZW5kZW5jaWVzID09PSAwKSB7XG4gICAgICAgICAgICBlbnF1ZXVlVGFzayhrZXksIHRhc2spO1xuICAgICAgICAgICAgcmVhZHlUb0NoZWNrLnB1c2goa2V5KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB1bmNoZWNrZWREZXBlbmRlbmNpZXNba2V5XSA9IHJlbWFpbmluZ0RlcGVuZGVuY2llcztcblxuICAgICAgICBhcnJheUVhY2goZGVwZW5kZW5jaWVzLCBmdW5jdGlvbiAoZGVwZW5kZW5jeU5hbWUpIHtcbiAgICAgICAgICAgIGlmICghdGFza3NbZGVwZW5kZW5jeU5hbWVdKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdhc3luYy5hdXRvIHRhc2sgYCcgKyBrZXkgK1xuICAgICAgICAgICAgICAgICAgICAnYCBoYXMgYSBub24tZXhpc3RlbnQgZGVwZW5kZW5jeSBgJyArXG4gICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3lOYW1lICsgJ2AgaW4gJyArXG4gICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY2llcy5qb2luKCcsICcpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGFkZExpc3RlbmVyKGRlcGVuZGVuY3lOYW1lLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgcmVtYWluaW5nRGVwZW5kZW5jaWVzLS07XG4gICAgICAgICAgICA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Vycy5wdXNoKGZuKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiB0YXNrQ29tcGxldGUodGFza05hbWUpIHtcbiAgICAgICAgdmFyIHRhc2tMaXN0ZW5lcnMgPSBsaXN0ZW5lcnNbdGFza05hbWVdIHx8IFtdO1xuICAgICAgICBhcnJheUVhY2godGFza0xpc3RlbmVycywgZnVuY3Rpb24gKGZuKSB7XG4gICAgICAgICAgICBmbigpO1xuICAgICAgICB9KTtcbiAgICAgICAgcHJvY2Vzc1F1ZXVlKCk7XG4gICAgfVxuXG5cbiAgICBmdW5jdGlvbiBydW5UYXNrKGtleSwgdGFzaykge1xuICAgICAgICBpZiAoaGFzRXJyb3IpIHJldHVybjtcblxuICAgICAgICB2YXIgdGFza0NhbGxiYWNrID0gb25seU9uY2UoZnVuY3Rpb24oZXJyLCByZXN1bHQpIHtcbiAgICAgICAgICAgIHJ1bm5pbmdUYXNrcy0tO1xuICAgICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPiAyKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gc2xpY2UoYXJndW1lbnRzLCAxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgICB2YXIgc2FmZVJlc3VsdHMgPSB7fTtcbiAgICAgICAgICAgICAgICBiYXNlRm9yT3duKHJlc3VsdHMsIGZ1bmN0aW9uKHZhbCwgcmtleSkge1xuICAgICAgICAgICAgICAgICAgICBzYWZlUmVzdWx0c1tya2V5XSA9IHZhbDtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBzYWZlUmVzdWx0c1trZXldID0gcmVzdWx0O1xuICAgICAgICAgICAgICAgIGhhc0Vycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBsaXN0ZW5lcnMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICAgICAgY2FsbGJhY2soZXJyLCBzYWZlUmVzdWx0cyk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJlc3VsdHNba2V5XSA9IHJlc3VsdDtcbiAgICAgICAgICAgICAgICB0YXNrQ29tcGxldGUoa2V5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcnVubmluZ1Rhc2tzKys7XG4gICAgICAgIHZhciB0YXNrRm4gPSB3cmFwQXN5bmModGFza1t0YXNrLmxlbmd0aCAtIDFdKTtcbiAgICAgICAgaWYgKHRhc2subGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgdGFza0ZuKHJlc3VsdHMsIHRhc2tDYWxsYmFjayk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0YXNrRm4odGFza0NhbGxiYWNrKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrRm9yRGVhZGxvY2tzKCkge1xuICAgICAgICAvLyBLYWhuJ3MgYWxnb3JpdGhtXG4gICAgICAgIC8vIGh0dHBzOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL1RvcG9sb2dpY2FsX3NvcnRpbmcjS2Fobi4yN3NfYWxnb3JpdGhtXG4gICAgICAgIC8vIGh0dHA6Ly9jb25uYWxsZS5ibG9nc3BvdC5jb20vMjAxMy8xMC90b3BvbG9naWNhbC1zb3J0aW5na2Fobi1hbGdvcml0aG0uaHRtbFxuICAgICAgICB2YXIgY3VycmVudFRhc2s7XG4gICAgICAgIHZhciBjb3VudGVyID0gMDtcbiAgICAgICAgd2hpbGUgKHJlYWR5VG9DaGVjay5sZW5ndGgpIHtcbiAgICAgICAgICAgIGN1cnJlbnRUYXNrID0gcmVhZHlUb0NoZWNrLnBvcCgpO1xuICAgICAgICAgICAgY291bnRlcisrO1xuICAgICAgICAgICAgYXJyYXlFYWNoKGdldERlcGVuZGVudHMoY3VycmVudFRhc2spLCBmdW5jdGlvbiAoZGVwZW5kZW50KSB7XG4gICAgICAgICAgIC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RlbSA9IHtcbiAgICAgICAgICAgICAgICBkYXRhOiBkYXRhW2ldLFxuICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBjYWxsYmFjayB8fCBub29wXG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBpZiAoaW5zZXJ0QXRGcm9udCkge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLnVuc2hpZnQoaXRlbSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLnB1c2goaXRlbSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgc2V0SW1tZWRpYXRlJDEocS5wcm9jZXNzKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfbmV4dCh0YXNrcykge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oZXJyKXtcbiAgICAgICAgICAgIG51bVJ1bm5pbmcgLT0gMTtcblxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSB0YXNrcy5sZW5ndGg7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgdGFzayA9IHRhc2tzW2ldO1xuXG4gICAgICAgICAgICAgICAgdmFyIGluZGV4ID0gYmFzZUluZGV4T2Yod29ya2Vyc0xpc3QsIHRhc2ssIDApO1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHdvcmtlcnNMaXN0LnNwbGljZShpbmRleCwgMSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGFzay5jYWxsYmFjay5hcHBseSh0YXNrLCBhcmd1bWVudHMpO1xuXG4gICAgICAgICAgICAgICAgaWYgKGVyciAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHEuZXJyb3IoZXJyLCB0YXNrLmRhdGEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKG51bVJ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gICAgICB9LFxuICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICh0ZXN0Rm4pIHtcbiAgICAgICAgICAgIHEuX3Rhc2tzLnJlbW92ZSh0ZXN0Rm4pO1xuICAgICAgICB9LFxuICAgICAgICBwcm9jZXNzOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAvLyBBdm9pZCB0cnlpbmcgdG8gc3RhcnQgdG9vIG1hbnkgcHJvY2Vzc2luZyBvcGVyYXRpb25zLiBUaGlzIGNhbiBvY2N1clxuICAgICAgICAgICAgLy8gd2hlbiBjYWxsYmFja3MgcmVzb2x2ZSBzeW5jaHJvbm91c2x5ICgjMTI2NykuXG4gICAgICAgICAgICBpZiAoaXNQcm9jZXNzaW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaXNQcm9jZXNzaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHdoaWxlKCFxLnBhdXNlZCAmJiBudW1SdW5uaW5nIDwgcS5jb25jdXJyZW5jeSAmJiBxLl90YXNrcy5sZW5ndGgpe1xuICAgICAgICAgICAgICAgIHZhciB0YXNrcyA9IFtdLCBkYXRhID0gW107XG4gICAgICAgICAgICAgICAgdmFyIGwgPSBxLl90YXNrcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgaWYgKHEucGF5bG9hZCkgbCA9IE1hdGgubWluKGwsIHEucGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBxLl90YXNrcy5zaGlmdCgpO1xuICAgICAgICAgICAgICAgICAgICB0YXNrcy5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgICAgICAgICB3b3JrZXJzTGlzdC5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgICAgICAgICBkYXRhLnB1c2gobm9kZS5kYXRhKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW1SdW5uaW5nICs9IDE7XG5cbiAgICAgICAgICAgICAgICBpZiAocS5fdGFza3MubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHEuZW1wdHkoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAobnVtUnVubmluZyA9PT0gcS5jb25jdXJyZW5jeSkge1xuICAgICAgICAgICAgICAgICAgICBxLnNhdHVyYXRlZCgpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhciBjYiA9IG9ubHlPbmNlKF9uZXh0KHRhc2tzKSk7XG4gICAgICAgICAgICAgICAgX3dvcmtlcihkYXRhLCBjYik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpc1Byb2Nlc3NpbmcgPSBmYWxzZTtcbiAgICAgICAgfSxcbiAgICAgICAgbGVuZ3RoOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gcS5fdGFza3MubGVuZ3RoO1xuICAgICAgICB9LFxuICAgICAgICBydW5uaW5nOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVtUnVubmluZztcbiAgICAgICAgfSxcbiAgICAgICAgd29ya2Vyc0xpc3Q6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiB3b3JrZXJzTGlzdDtcbiAgICAgICAgfSxcbiAgICAgICAgaWRsZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gcS5fdGFza3MubGVuZ3RoICsgbnVtUnVubmluZyA9PT0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgcGF1c2U6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHEucGF1c2VkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVzdW1lOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBpZiAocS5wYXVzZWQgPT09IGZhbHNlK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YmplY3QpO1xuICogLy8gPT4gdHJ1ZVxuICovXG5mdW5jdGlvbiBpZGVudGl0eSh2YWx1ZSkge1xuICByZXR1cm4gdmFsdWU7XG59XG5cbmZ1bmN0aW9uIF9jcmVhdGVUZXN0ZXIoY2hlY2ssIGdldFJlc3VsdCkge1xuICAgIHJldHVybiBmdW5jdGlvbihlYWNoZm4sIGFyciwgaXRlcmF0ZWUsIGNiKSB7XG4gICAgICAgIGNiID0gY2IgfHwgbm9vcDtcbiAgICAgICAgdmFyIHRlc3RQYXNzZWQgPSBmYWxzZTtcbiAgICAgICAgdmFyIHRlc3RSZXN1bHQ7XG4gICAgICAgIGVhY2hmbihhcnIsIGZ1bmN0aW9uKHZhbHVlLCBfLCBjYWxsYmFjaykge1xuICAgICAgICAgICAgaXRlcmF0ZWUodmFsdWUsIGZ1bmN0aW9uKGVyciwgcmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICBjYWxsYmFjayhlcnIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hlY2socmVzdWx0KSAmJiAhdGVzdFJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICB0ZXN0UGFzc2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgdGVzdFJlc3VsdCA9IGdldFJlc3VsdCh0cnVlLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKG51bGwsIGJyZWFrTG9vcCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSwgZnVuY3Rpb24oZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgY2IoZXJyKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY2IobnVs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ICAgICBxLmRyYWluKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHByaW9yaXR5ID0gcHJpb3JpdHkgfHwgMDtcbiAgICAgICAgdmFyIG5leHROb2RlID0gcS5fdGFza3MuaGVhZDtcbiAgICAgICAgd2hpbGUgKG5leHROb2RlICYmIHByaW9yaXR5ID49IG5leHROb2RlLnByaW9yaXR5KSB7XG4gICAgICAgICAgICBuZXh0Tm9kZSA9IG5leHROb2RlLm5leHQ7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGRhdGEubGVuZ3RoOyBpIDwgbDsgaSsrKSB7XG4gICAgICAgICAgICB2YXIgaXRlbSA9IHtcbiAgICAgICAgICAgICAgICBkYXRhOiBkYXRhW2ldLFxuICAgICAgICAgICAgICAgIHByaW9yaXR5OiBwcmlvcml0eSxcbiAgICAgICAgICAgICAgICBjYWxsYmFjazogY2FsbGJhY2tcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIGlmIChuZXh0Tm9kZSkge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLmluc2VydEJlZm9yZShuZXh0Tm9kZSwgaXRlbSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLnB1c2goaXRlbSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgc2V0SW1tZWRpYXRlJDEocS5wcm9jZXNzKTtcbiAgICB9O1xuXG4gICAgLy8gUmVtb3ZlIHVuc2hpZnQgZnVuY3Rpb25cbiAgICBkZWxldGUgcS51bnNoaWZ0O1xuXG4gICAgcmV0dXJuIHE7XG59O1xuXG4vKipcbiAqIFJ1bnMgdGhlIGB0YXNrc2AgYXJyYXkgb2YgZnVuY3Rpb25zIGluIHBhcmFsbGVsLCB3aXRob3V0IHdhaXRpbmcgdW50aWwgdGhlXG4gKiBwcmV2aW91cyBmdW5jdGlvbiBoYXMgY29tcG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uICAgICAgICBmdW5jdGlvbiB0aW1lb3V0Q2FsbGJhY2soKSB7XG4gICAgICAgICAgICB2YXIgbmFtZSA9IGFzeW5jRm4ubmFtZSB8fCAnYW5vbnltb3VzJztcbiAgICAgICAgICAgIHZhciBlcnJvciAgPSBuZXcgRXJyb3IoJ0NhbGxiYWNrIGZ1bmN0aW9uIFwiJyArIG5hbWUgKyAnXCIgdGltZWQgb3V0LicpO1xuICAgICAgICAgICAgZXJyb3IuY29kZSA9ICdFVElNRURPVVQnO1xuICAgICAgICAgICAgaWYgKGluZm8pIHtcbiAgICAgICAgICAgICAgICBlcnJvci5pbmZvID0gaW5mbztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRpbWVkT3V0ID0gdHJ1ZTtcbiAgICAgICAgICAgIGNhbGxiYWNrKGVycm9yKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGFyZ3MucHVzaChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBpZiAoIXRpbWVkT3V0KSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2suYXBwbHkobnVsbCwgYXJndW1lbnRzKTtcbiAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICAvLyBzZXR1cCB0aW1lciBhbmQgY2FsbCBvcmlnaW5hbCBmdW5jdGlvblxuICAgICAgICB0aW1lciA9IHNldFRpbWVvdXQodGltZW91dENhbGxiYWNrLCBtaWxsaXNlY29uZHMpO1xuICAgICAgICBmbi5hcHBseShudWxsLCBhcmdzKTtcbiAgICB9KTtcbn1cblxuLyogQnVpbHQtaW4gbWV0aG9kIHJlZmVyZW5jZXMgZm9yIHRob3NlIHdpdGggdGhlIHNhbWUgbmFtZSBhcyBvdGhlciBgbG9kYXNoYCBtZXRob2RzLiAqL1xudmFyIG5hdGl2ZUNlaWwgPSBNYXRoLmNlaWw7XG52YXIgbmF0aXZlTWF4ID0gTWF0aC5tYXg7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REVGQVVMVF9GVUxMX1NDSEVNQSA9IHJlcXVpcmUoJy4vc2NoZW1hL2RlZmF1bHRfZnVsbCcpO1xudmFyIERFRkFVTFRfU0FGRV9TQ0hFTUEgPSByZXF1aXJlKCcuL3NjaGVtYS9kZWZhdWx0X3NhZmUnKTtcblxudmFyIF90b1N0cmluZyAgICAgICA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7XG52YXIgX2hhc093blByb3BlcnR5ID0gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eTtcblxudmFyIENIQVJfVEFCICAgICAgICAgICAgICAgICAgPSAweDA5OyAvKiBUYWIgKi9cbnZhciBDSEFSX0xJTkVfRkVFRCAgICAgICAgICAgID0gMHgwQTsgLyogTEYgKi9cbnZhciBDSEFSX1NQQUNFICAgICAgICAgICAgICAgID0gMHgyMDsgLyogU3BhY2UgKi9cbnZhciBDSEFSX0VYQ0xBTUFUSU9OICAgICAgICAgID0gMHgyMTsgLyogISAqL1xudmFyIENIQVJfRE9VQkxFX1FVT1RFICAgICAgICAgPSAweDIyOyAvKiBcIiAqL1xudmFyIENIQVJfU0hBUlAgICAgICAgICAgICAgICAgPSAweDIzOyAvKiAjICovXG52YXIgQ0hBUl9QRVJDRU5UICAgICAgICAgICAgICA9IDB4MjU7IC8qICUgKi9cbnZhciBDSEFSX0FNUEVSU0FORCAgICAgICAgICAgID0gMHgyNjsgLyogJiAqL1xudmFyIENIQVJfU0lOR0xFX1FVT1RFICAgICAgICAgPSAweDI3OyAvKiAnICovXG52YXIgQ0hBUl9BU1RFUklTSyAgICAgICAgICAgICA9IDB4MkE7IC8qICogKi9cbnZhciBDSEFSX0NPTU1BICAgICAgICAgICAgICAgID0gMHgyQzsgLyogLCAqL1xudmFyIENIQVJfTUlOVVMgICAgICAgICAgICAgICAgPSAweDJEOyAvKiAtICovXG52YXIgQ0hBUl9DT0xPTiAgICAgICAgICAgICAgICA9IDB4M0E7IC8qIDogKi9cbnZhciBDSEFS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biAgaWYgKGMgPT09IDB4NTUvKiBVICovKSB7IHJldHVybiA4OyB9XG4gIHJldHVybiAwO1xufVxuXG5mdW5jdGlvbiBmcm9tRGVjaW1hbENvZGUoYykge1xuICBpZiAoKDB4MzAvKiAwICovIDw9IGMpICYmIChjIDw9IDB4MzkvKiA5ICovKSkge1xuICAgIHJldHVybiBjIC0gMHgzMDtcbiAgfVxuXG4gIHJldHVybiAtMTtcbn1cblxuZnVuY3Rpb24gc2ltcGxlRXNjYXBlU2VxdWVuY2UoYykge1xuICAvKiBlc2xpbnQtZGlzYWJsZSBpbmRlbnQgKi9cbiAgcmV0dXJuIChjID09PSAweDMwLyogMCAqLykgPyAnXFx4MDAnIDpcbiAgICAgICAgKGMgPT09IDB4NjEvKiBhICovKSA/ICdcXHgwNycgOlxuICAgICAgICAoYyA9PT0gMHg2Mi8qIGIgKi8pID8gJ1xceDA4JyA6XG4gICAgICAgIChjID09PSAweDc0LyogdCAqLykgPyAnXFx4MDknIDpcbiAgICAgICAgKGMgPT09IDB4MDkvKiBUYWIgKi8pID8gJ1xceDA5JyA6XG4gICAgICAgIChjID09PSAweDZFLyogbiAqLykgPyAnXFx4MEEnIDpcbiAgICAgICAgKGMgPT09IDB4NzYvKiB2ICovKSA/ICdcXHgwQicgOlxuICAgICAgICAoYyA9PT0gMHg2Ni8qIGYgKi8pID8gJ1xceDBDJyA6XG4gICAgICAgIChjID09PSAweDcyLyogciAqLykgPyAnXFx4MEQnIDpcbiAgICAgICAgKGMgPT09IDB4NjUvKiBlICovKSA/ICdcXHgxQicgOlxuICAgICAgICAoYyA9PT0gMHgyMC8qIFNwYWNlICovKSA/ICcgJyA6XG4gICAgICAgIChjID09PSAweDIyLyogXCIgKi8pID8gJ1xceDIyJyA6XG4gICAgICAgIChjID09PSAweDJGLyogLyAqLykgPyAnLycgOlxuICAgICAgICAoYyA9PT0gMHg1Qy8qIFxcICovKSA/ICdcXHg1QycgOlxuICAgICAgICAoYyA9PT0gMHg0RS8qIE4g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1BlbmRpbmdDb250ZW50LFxuICAgICAgX2xpbmUsXG4gICAgICBfbGluZVN0YXJ0LFxuICAgICAgX2xpbmVJbmRlbnQsXG4gICAgICBfa2luZCA9IHN0YXRlLmtpbmQsXG4gICAgICBfcmVzdWx0ID0gc3RhdGUucmVzdWx0LFxuICAgICAgY2g7XG5cbiAgY2ggPSBzdGF0ZS5pbnB1dC5jaGFyQ29kZUF0KHN0YXRlLnBvc2l0aW9uKTtcblxuICBpZiAoaXNfV1NfT1JfRU9MKGNoKSAgICAgIHx8XG4gICAgICBpc19GTE9XX0lORElDQVRPUihjaCkgfHxcbiAgICAgIGNoID09PSAweDIzLyogIyAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4MjYvKiAmICovICAgIHx8XG4gICAgICBjaCA9PT0gMHgyQS8qICogKi8gICAgfHxcbiAgICAgIGNoID09PSAweDIxLyogISAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4N0MvKiB8ICovICAgIHx8XG4gICAgICBjaCA9PT0gMHgzRS8qID4gKi8gICAgfHxcbiAgICAgIGNoID09PSAweDI3LyogJyAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4MjIvKiBcIiAqLyAgICB8fFxuICAgICAgY2ggPT09IDB4MjUvKiAlICovICAgIHx8XG4gICAgICBjaCA9PT0gMHg0MC8qIEAgKi8gICAgfHxcbiAgICAgIGNoID09PSAweDYwLyogYCAqLykge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIGlmIChjaCA9PT0gMHgzRi8qID8gKi8gfHwgY2ggPT09IDB4MkQvKiAtICovKSB7XG4gICAgZm9sbG93aW5nID0gc3RhdGUuaW5wdXQuY2hhckNvZGVBdChzdGF0ZS5wb3NpdGlvbiArIDEpO1xuXG4gICAgaWYgKGlzX1dTX09SX0VPTChmb2xsb3dpbmcpIHx8XG4gICAgICAgIHdpdGhpbkZsb3dDb2xsZWN0aW9uICYmIGlzX0ZMT1dfSU5ESUNBVE9SKGZvbGxvd2luZykpIHtc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gICAgICAgaGFzQ29udGVudCA9IHRydWU7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBpZiAoKGFsbG93QmxvY2tTY2FsYXJzICYmIHJlYWRCbG9ja1NjYWxhcihzdGF0ZSwgZmxvd0luZGVudCkpIHx8XG4gICAgICAgICAgICByZWFkU2luZ2xlUXVvdGVkU2NhbGFyKHN0YXRlLCBmbG93SW5kZW50KSB8fFxuICAgICAgICAgICAgcmVhZERvdWJsZVF1b3RlZFNjYWxhcihzdGF0ZSwgZmxvd0luZGVudCkpIHtcbiAgICAgICAgICBoYXNDb250ZW50ID0gdHJ1ZTtcblxuICAgICAgICB9IGVsc2UgaWYgKHJlYWRBbGlhcyhzdGF0ZSkpIHtcbiAgICAgICAgICBoYXNDb250ZW50ID0gdHJ1ZTtcblxuICAgICAgICAgIGlmIChzdGF0ZS50YWcgIT09IG51bGwgfHwgc3RhdGUuYW5jaG9yICE9PSBudWxsKSB7XG4gICAgICAgICAgICB0aHJvd0Vycm9yKHN0YXRlLCAnYWxpYXMgbm9kZSBzaG91bGQgbm90IGhhdmUgYW55IHByb3BlcnRpZXMnKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgfSBlbHNlIGlmIChyZWFkUGxhaW5TY2FsYXIoc3RhdGUsIGZsb3dJbmRlbnQsIENPTlRFWFRfRkxPV19JTiA9PT0gbm9kZUNvbnRleHQpKSB7XG4gICAgICAgICAgaGFzQ29udGVudCA9IHRydWU7XG5cbiAgICAgICAgICBpZiAoc3RhdGUudGFnID09PSBudWxsKSB7XG4gICAgICAgICAgICBzdGF0ZS50YWcgPSAnPyc7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHN0YXRlLmFuY2hvciAhPT0gbnVsbCkge1xuICAgICAgICAgIHN0YXRlLmFuY2hvck1hcFtzdGF0ZS5hbmNob3JdID0gc3RhdGUucmVzdWx0O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSBlbHNlIGlmIChpbmRlbnRTdG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250aFxuICAnLShbMC05XVswLTldKSQnKTsgICAgICAgICAgICAgICAgICAgLy8gWzNdIGRheVxuXG52YXIgWUFNTF9USU1FU1RBTVBfUkVHRVhQID0gbmV3IFJlZ0V4cChcbiAgJ14oWzAtOV1bMC05XVswLTldWzAtOV0pJyAgICAgICAgICArIC8vIFsxXSB5ZWFyXG4gICctKFswLTldWzAtOV0/KScgICAgICAgICAgICAgICAgICAgKyAvLyBbMl0gbW9udGhcbiAgJy0oWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICArIC8vIFszXSBkYXlcbiAgJyg/OltUdF18WyBcXFxcdF0rKScgICAgICAgICAgICAgICAgICsgLy8gLi4uXG4gICcoWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICAgKyAvLyBbNF0gaG91clxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzVdIG1pbnV0ZVxuICAnOihbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzZdIHNlY29uZFxuICAnKD86XFxcXC4oWzAtOV0qKSk/JyAgICAgICAgICAgICAgICAgKyAvLyBbN10gZnJhY3Rpb25cbiAgJyg/OlsgXFxcXHRdKihafChbLStdKShbMC05XVswLTldPyknICsgLy8gWzhdIHR6IFs5XSB0el9zaWduIFsxMF0gdHpfaG91clxuICAnKD86OihbMC05XVswLTldKSk/KSk/JCcpOyAgICAgICAgICAgLy8gWzExXSB0el9taW51dGVcblxuZnVuY3Rpb24gcmVzb2x2ZVlhbWxUaW1lc3RhbXAoZGF0YSkge1xuICBpZiAoZGF0YSA9PT0gbnVsbCkgcmV0dXJuIGZhbHNlO1xuICBpZiAoWUFNTF9EQVRFX1JFR0VYUC5leGVjKGRhdGEpICE9PSBudWxsKSByZXR1cm4gdHJ1ZTtcbiAgaWYgKFlBTUxfVElNRVNUQU1QX1JFR0VYUC5leGVjKGRhdGEpICE9PSBudWxsKSByZXR1cm4gdHJ1ZTtcbiAgcmV0dXJuIGZhb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ZW5jZXMgYmFzZWQgb24gdGhlIG9wdGlvbnNcbiAgICByZWZzID0gZmluZFJlZnMoZG9jdW1lbnQsIG9wdGlvbnMpO1xuXG4gICAgLy8gSXRlcmF0ZSBvdmVyIHRoZSByZWZlcmVuY2VzIGFuZCBwcm9jZXNzXG4gICAgXy5lYWNoKHJlZnMsIGZ1bmN0aW9uIChyZWZEZXRhaWxzLCByZWZQdHIpIHtcbiAgICAgIHZhciByZWZLZXkgPSBtYWtlQWJzb2x1dGUob3B0aW9ucy5sb2NhdGlvbikgKyByZWZQdHI7XG4gICAgICB2YXIgcmVmZEtleSA9IHJlZkRldGFpbHMucmVmZElkID0gbWFrZUFic29sdXRlKGlzUmVtb3RlKHJlZkRldGFpbHMpID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21iaW5lVVJJcyhyZWxhdGl2ZUJhc2UsIHJlZkRldGFpbHMudXJpKSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9ucy5sb2NhdGlvbikgKyAnIycgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHJlZkRldGFpbHMudXJpLmluZGV4T2YoJyMnKSA+IC0xID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZkRldGFpbHMudXJpLnNwbGl0KCcjJylbMV0gOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycpO1xuXG4gICAgICAvLyBSZWNvcmQgcmVmZXJlbmNlIG1ldGFkYXRhXG4gICAgICBtZXRhZGF0YS5yZWZzW3JlZktleV0gPSByZWZEZXRhaWxzO1xuXG4gICAgICAvLyBEbyBub3QgcHJvY2VzcyBpbnZhbGlkIHJlZmVyZW5jZXNcbiAgICAgIGlmICghaXNWYWxpZChyZWZEZXRhaWxzKSkge1xuICAgICAgICByZXR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WVudCBgdGhlbmAgdG8gaGFuZGxlIGJvdGggZXJyb3JzIGFuZCBzdWNjZXNzZXNcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVycjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIFdlIGhhdmUgYWxyZWFkeSByZXRyaWV2ZWQgKG9yIGF0dGVtcHRlZCB0bykgdGhlIGRvY3VtZW50IGFuZCBzaG91bGQgdXNlIHRoZSBjYWNoZWQgdmVyc2lvbiBpbiB0aGVcbiAgICAgICAgICAgICAgICAvLyBtZXRhZGF0YSBzaW5jZSBpdCBjb3VsZCBhbHJlYWR5IGJlIHByb2Nlc3NlZCBzb21lLlxuICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoKVxuICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gckRvYztcbiAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICAgIH0obWV0YWRhdGEsIHJPcHRpb25zKSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBhbGxUYXNrcyA9IGFsbFRhc2tzXG4gICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50O1xuICAgICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICAvLyBQcm9jZXNzIHRoZSByZW1vdGUgZG9jdW1lbnQgb3IgdGhlIHJlZmVyZW5jZWQgcG9ydGlvbiBvZiB0aGUgbG9jYWwgZG9jdW1lbnRcbiAgICAgIGFsbFRhc2tzID0gYWxsVGFza3NcbiAgICAgICAgLnRoZW4oZnVuY3Rpb24gKG5NZXRhZGF0YSwgbk9wdGlvbnMsIG5SZWZEZXRhaWxzKSB7XG4gICAgICAgICAgc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kge1xuICAgICAgICAgICAgLy8gRmlndXJlIG91dCBpZiB0aGUgY2lyY3VsYXIgaXMgcGFydCBvZiBhIGNpcmN1bGFyIGNoYWluIG9yIGp1c3QgYSByZWZlcmVuY2UgdG8gYSBjaXJjdWxhclxuICAgICAgICAgICAgY2lyY3VsYXJQYXRocy5mb3JFYWNoKGZ1bmN0aW9uIChwYXRoKSB7XG4gICAgICAgICAgICAgIC8vIFNob3J0IGNpcmN1aXRcbiAgICAgICAgICAgICAgaWYgKGlzQ2lyY3VsYXIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBwYXRoSW5kZXggPSBwYXRoLmluZGV4T2YoZGVwKTtcblxuICAgICAgICAgICAgICBpZiAocGF0aEluZGV4ID4gLTEpIHtcbiAgICAgICAgICAgICAgICAvLyBDaGVjayBlYWNoIHBhdGggc2VnbWVudCB0byBzZWUgaWYgdGhlIHJlZmVyZW5jZSBsb2NhdGlvbiBpcyBiZW5lYXRoIG9uZSBvZiBpdHMgc2VnbWVudHNcbiAgICAgICAgICAgICAgICBwYXRoLmZvckVhY2goZnVuY3Rpb24gKHNlZykge1xuICAgICAgICAgICAgICAgICAgLy8gU2hvcnQgY2lyY3VpdFxuICAgICAgICAgICAgICAgICAgaWYgKGlzQ2lyY3VsYXIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICBpZiAocmVmUHRyLmluZGV4T2Yoc2VnICsgJy8nKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgcmVmZXJlbmNlIGlzIGxvY2FsLCBtYXJrIGl0IGFzIGNpcmN1bGFyIGJ1dCBpZiBpdCdzIGEgcmVtb3RlIHJlZmVyZW5jZSwgb25seSBtYXJrIGl0XG4gICAgICAgICAgICAgICAgICAgIC8vIGNpcmN1bGFyIGlmIHRoZSBtYXRjaGluZyBwYXRoIGlzIHRoZSBsYXN0IHBhdGggc2VnbWVudC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKChyZW1vdGUgJiYgcGF0aEluZGV4ID09PSBwYXRoLmxlbmd0aCAtIDEpIHx8ICFyZW1vdGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpc0NpcmN1bGFyID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaXNDaXJjdWxhcikge1xuICAgICAgICAgICAgLy8gVXBkYXRlIGFsbCByZWZlcmVuY2VzIGFuZCByZWZlcmVuY2UgZGV0YWlsc1xuICAgICAgICAgICAgcmVmRGV0YWlscy5jaXJjdWxhciA9IHRydWU7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuXG4gICAgICAvLyBSZXNvbHZlIHRoZSByZWZlcmVuY2VzXG4gICAgICBfLmVhY2gocmVzdWx0cy5kZXBzLCBmdW5jdGlvbiAoZGVwcywgcGFyZW50UHRyKSB7XG4gICAgICAgIHZhciBwUHRyUGFydHMgPSBwYXJlbnRQdHIuc3BsaXQoJyMnKTtcbiAgICAgICAgdmFyIHBEb2N1bWVudCA9IHJlc3VsdHMuZG9jc1twUHRyUGFydHNbMF1dO1xuICAgICAgICB2YXIgcFB0clBhdGggPSBwYXRoRnJvbVB0cihwUHRyUGFydHNbMV0pO1xuXG4gICAgICAgIF8uZWFjaChkZXBzLCBmdW5jdGlvbiAoZGVwLCBwcm9wKSB7XG4gICAgICAgICAgdmFyIGRlcFBhcnRzID0gZGVwLnNwbGl0KCcjJyk7XG4gICAgICAgICAgdmFyIGREb2N1bWVudCA9IHJlc3VsdHMuZG9jc1tkZXBQYXJ0c1swXV07XG4gICAgICAgICAgdmFyIGRQdHJQYXRoID0gcFB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nNcbiAgICAgICAgICBpZiAoIXJlZkRldGFpbHMuY2lyY3VsYXIgJiYgcmVmRGV0YWlscy5lcnJvcikge1xuICAgICAgICAgICAgLy8gVGhlIHdheSB3ZSB1c2UgZmluZFJlZnMgbm93IHJlc3VsdHMgaW4gYW4gZXJyb3IgdGhhdCBkb2Vzbid0IG1hdGNoIHRoZSBleHBlY3RhdGlvblxuICAgICAgICAgICAgcmVmRGV0YWlscy5lcnJvciA9IHJlZkRldGFpbHMuZXJyb3IucmVwbGFjZSgnb3B0aW9ucy5zdWJEb2NQYXRoJywgJ0pTT04gUG9pbnRlcicpO1xuXG4gICAgICAgICAgICAvLyBVcGRhdGUgdGhlIGVycm9yIHRvIHVzZSB0aGUgYXBwcm9wcmlhdGUgSlNPTiBQb2ludGVyXG4gICAgICAgICAgICBpZiAocmVmRGV0YWlscy5lcnJvci5pbmRleE9mKCcjJykgPiAtMSkge1xuICAgICAgICAgICAgICByZWZEZXRhaWxzLmVycm9yID0gcmVmRGV0YWlscy5lcnJvci5yZXBsYWNlKHJlZkRldGFpbHMudXJpLnN1YnN0cihyZWZEZXRhaWxzLnVyaS5pbmRleE9mKCcjJykpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZkRldGFpbHMudXJpKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gUmVwb3J0IGVycm9ycyBvcGVuaW5nIGZpbGVzIGFzIEpTT04gUG9pbnRlciBlcnJvcnNcbiAgICAgICAgICAgIGlmIChyZWZEZXRhaWxzLmVycm9yLmluZGV4T2YoJ0VOT0VOVDonKSA9PT0gMCB8fCByZWZEZXRhaWxzLmVycm9yLmluZGV4T2YoJ05vdCBGb3VuZCcpID09PSAwKSB7XG4gICAgICAgICAgICAgIHJlZkRldGFpbHMuZXJyb3IgPSAnSlNPTiBQb2ludGVyIHBvaW50cyB0byBtaXNzaW5nIGxvY2F0aW9uOiAnICsgcmVmRGV0Y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YXBlJzogcmVFc2NhcGUsXG5cbiAgICAgIC8qKlxuICAgICAgICogVXNlZCB0byBkZXRlY3QgY29kZSB0byBiZSBldmFsdWF0ZWQuXG4gICAgICAgKlxuICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5nc1xuICAgICAgICogQHR5cGUge1JlZ0V4cH1cbiAgICAgICAqL1xuICAgICAgJ2V2YWx1YXRlJzogcmVFdmFsdWF0ZSxcblxuICAgICAgLyoqXG4gICAgICAgKiBVc2VkIHRvIGRldGVjdCBgZGF0YWAgcHJvcGVydHkgdmFsdWVzIHRvIGluamVjdC5cbiAgICAgICAqXG4gICAgICAgKiBAbWVtYmVyT2YgXy50ZW1wbGF0ZVNldHRpbmdzXG4gICAgICAgKiBAdHlwZSB7UmVnRXhwfVxuICAgICAgICovXG4gICAgICAnaW50ZXJwb2xhdGUnOiByZUludGVycG9sYXRlLFxuXG4gICAgICAvKipcbiAgICAgICAqIFVzZWQgdG8gcmVmZXJlbmNlIHRoZSBkYXRhIG9iamVjdCBpbiB0aGUgdGVtcGxhdGUgdGV4dC5cbiAgICAgICAqXG4gICAgICAgKiBAbWVtYmVyT2YgXy50ZW1wbGF0ZVNldHRpbmdzXG4gICAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAgICovXG4gICAgICAndmFyaWFibGUnOiAnJyxcblxuICAgICAgLyoqXG4gICAgICAgKiBVc2VkIHRvIGltcG9ydCB2YXJpYWJsZXMgaW50byB0aGUgY29tcGlsZWQgdGVtcGxhdGUuXG4gICAgICAgKlxuICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5nc1xuICAgICAgICogQHR5cGUge09iamVjdH1cbiAgICAgICAqL1xuICAgICAgJ2ltcG9ydHMnOiB7XG5cbiAgICAgICAgLyoqXG4gICAgICAgICAqIEEgcmVmZXJlbmNlIHRvIHRoZSBgbG9kYXNoYCBmdW5jdGlvbi5cbiAgICAgICAgICpcbiAgICAgICAgICogQG1lbWJl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SA/IHZhbHVlIDogMDtcbiAgICAgICAgaWYgKCEoc2VlblxuICAgICAgICAgICAgICA/IGNhY2hlSGFzKHNlZW4sIGNvbXB1dGVkKVxuICAgICAgICAgICAgICA6IGluY2x1ZGVzKHJlc3VsdCwgY29tcHV0ZWQsIGNvbXBhcmF0b3IpXG4gICAgICAgICAgICApKSB7XG4gICAgICAgICAgb3RoSW5kZXggPSBvdGhMZW5ndGg7XG4gICAgICAgICAgd2hpbGUgKC0tb3RoSW5kZXgpIHtcbiAgICAgICAgICAgIHZhciBjYWNoZSA9IGNhY2hlc1tvdGhJbmRleF07XG4gICAgICAgICAgICBpZiAoIShjYWNoZVxuICAgICAgICAgICAgICAgICAgPyBjYWNoZUhhcyhjYWNoZSwgY29tcHV0ZWQpXG4gICAgICAgICAgICAgICAgICA6IGluY2x1ZGVzKGFycmF5c1tvdGhJbmRleF0sIGNvbXB1dGVkLCBjb21wYXJhdG9yKSlcbiAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzZWVuKSB7XG4gICAgICAgICAgICBzZWVuLnB1c2goY29tcHV0ZWQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQucHVzaCh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8uaW52ZXJ0YCBhbmQgYF8uaW52ZXJ0QnlgIHdoaWNoIGludmVydHNcbiAgICAgKiBgb2JqZWN0YCB3aXRoIHZhbHVlcyB0cmFuc2Zvcm1lZCBieSBgaXRlcmF0ZWVgIGFuZCBzZXQgYnkgYHNldHRlcmAuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvYmplY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WxzZWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZUlzTWF0Y2gob2JqZWN0LCBzb3VyY2UsIG1hdGNoRGF0YSwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGluZGV4ID0gbWF0Y2hEYXRhLmxlbmd0aCxcbiAgICAgICAgICBsZW5ndGggPSBpbmRleCxcbiAgICAgICAgICBub0N1c3RvbWl6ZXIgPSAhY3VzdG9taXplcjtcblxuICAgICAgaWYgKG9iamVjdCA9PSBudWxsKSB7XG4gICAgICAgIHJldHVybiAhbGVuZ3RoO1xuICAgICAgfVxuICAgICAgb2JqZWN0ID0gT2JqZWN0KG9iamVjdCk7XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICB2YXIgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIGlmICgobm9DdXN0b21pemVyICYmIGRhdGFbMl0pXG4gICAgICAgICAgICAgID8gZGF0YVsxXSAhPT0gb2JqZWN0W2RhdGFbMF1dXG4gICAgICAgICAgICAgIDogIShkYXRhWzBdIGluIG9iamVjdClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIHZhciBrZXkgPSBkYXRhWzBdLFxuICAgICAgICAgICAgb2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHNyY1ZhbHVlID0gZGF0YVsxXTtcblxuICAgICAgICBpZiAobm9DdXN0b21pemVyICYmIGRhdGFbMl0pIHtcbiAgICAgICAgICBpZiAob2JqVmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICA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ICdjb25zdHJ1Y3RvcicpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmtleXNJbmAgd2hpY2ggZG9lc24ndCB0cmVhdCBzcGFyc2UgYXJyYXlzIGFzIGRlbnNlLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gcXVlcnkuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBhcnJheSBvZiBwcm9wZXJ0eSBuYW1lcy5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBiYXNlS2V5c0luKG9iamVjdCkge1xuICAgICAgaWYgKCFpc09iamVjdChvYmplY3QpKSB7XG4gICAgICAgIHJldHVybiBuYXRpdmVLZXlzSW4ob2JqZWN0KTtcbiAgICAgIH1cbiAgICAgIHZhciBpc1Byb3RvID0gaXNQcm90b3R5cGUob2JqZWN0KSxcbiAgICAgICAgICByZXN1bHQgPSBbXTtcblxuICAgICAgZm9yICh2YXIga2V5IGluIG9iamVjdCkge1xuICAgICAgICBpZiAoIShrZXkgPT0gJ2NvbnN0cnVjdG9yJyAmJiAoaXNQcm90byB8fCAhaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIGtleSkpKSkge1xuICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ubHRgIHdoaWNoIGRvZXNuJ3QgY29lcmNlIGFyZ3VtZW50cy5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBh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5IFRoZSBhcnJheSB0byBtb2RpZnkuXG4gICAgICogQHBhcmFtIHtudW1iZXJbXX0gaW5kZXhlcyBUaGUgaW5kZXhlcyBvZiBlbGVtZW50cyB0byByZW1vdmUuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIGBhcnJheWAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYmFzZVB1bGxBdChhcnJheSwgaW5kZXhlcykge1xuICAgICAgdmFyIGxlbmd0aCA9IGFycmF5ID8gaW5kZXhlcy5sZW5ndGggOiAwLFxuICAgICAgICAgIGxhc3RJbmRleCA9IGxlbmd0aCAtIDE7XG5cbiAgICAgIHdoaWxlIChsZW5ndGgtLSkge1xuICAgICAgICB2YXIgaW5kZXggPSBpbmRleGVzW2xlbmd0aF07XG4gICAgICAgIGlmIChsZW5ndGggPT0gbGFzdEluZGV4IHx8IGluZGV4ICE9PSBwcmV2aW91cykge1xuICAgICAgICAgIHZhciBwcmV2aW91cyA9IGluZGV4O1xuICAgICAgICAgIGlmIChpc0luZGV4KGluZGV4KSkge1xuICAgICAgICAgICAgc3BsaWNlLmNhbGwoYXJyYXksIGluZGV4LCAxKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYmFzZVVuc2V0KGFycmF5LCBpbmRleCk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gYXJyYXk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ucmFuZG9tYCB3aXRob3V0IHN1cHBvcnQgZm9yIHJldHVybmluZ1xuICAgICAqIGZsb2F0aW5nLXBvaW50IG51bWJlcnMuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsb3dlciBUaGUgbG93ZXIgYm91bmQuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHVwcGVyIFRoZSB1cHBlciBib3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90aGVyID09PSBvdGhlcixcbiAgICAgICAgICAgIG90aElzU3ltYm9sID0gaXNTeW1ib2wob3RoZXIpO1xuXG4gICAgICAgIGlmICgoIW90aElzTnVsbCAmJiAhb3RoSXNTeW1ib2wgJiYgIXZhbElzU3ltYm9sICYmIHZhbHVlID4gb3RoZXIpIHx8XG4gICAgICAgICAgICAodmFsSXNTeW1ib2wgJiYgb3RoSXNEZWZpbmVkICYmIG90aElzUmVmbGV4aXZlICYmICFvdGhJc051bGwgJiYgIW90aElzU3ltYm9sKSB8fFxuICAgICAgICAgICAgKHZhbElzTnVsbCAmJiBvdGhJc0RlZmluZWQgJiYgb3RoSXNSZWZsZXhpdmUpIHx8XG4gICAgICAgICAgICAoIXZhbElzRGVmaW5lZCAmJiBvdGhJc1JlZmxleGl2ZSkgfHxcbiAgICAgICAgICAgICF2YWxJc1JlZmxleGl2ZSkge1xuICAgICAgICAgIHJldHVybiAxO1xuICAgICAgICB9XG4gICAgICAgIGlmICgoIXZhbElzTnVsbCAmJiAhdmFsSXNTeW1ib2wgJiYgIW90aElzU3ltYm9sICYmIHZhbHVlIDwgb3RoZXIpIHx8XG4gICAgICAgICAgICAob3RoSXNTeW1ib2wgJiYgdmFsSXNEZWZpbmVkICYmIHZhbElzUmVmbGV4aXZlICYmICF2YWxJc051bGwgJiYgIXZhbElzU3ltYm9sKSB8fFxuICAgICAgICAgICAgKG90aElzTnVsbCAmJiB2YWxJc0RlZmluZWQgJiYgdmFsSXNSZWZsZXhpdmUpIHx8XG4gICAgICAgICAgICAoIW90aElzRGVmaW5lZCAmJiB2YWxJc1JlZmxleGl2ZSkgfHxcbiAgICAgICAgICAgICFvdGhJc1JlZmxleGl2ZSkge1xuICAgICAgICAgIHJldHVybiAtMTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIDA7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVXNlZCBieSBgXy5vcmRlckJ5YCB0byBjb21wYXJlIG11bHRpcGxlIHByb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SA9IHNvdXJjZVtrZXldO1xuICAgICAgICB9XG4gICAgICAgIGlmIChpc05ldykge1xuICAgICAgICAgIGJhc2VBc3NpZ25WYWx1ZShvYmplY3QsIGtleSwgbmV3VmFsdWUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGFzc2lnblZhbHVlKG9iamVjdCwga2V5LCBuZXdWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29waWVzIG93biBzeW1ib2xzIG9mIGBzb3VyY2VgIHRvIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc291cmNlIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIGZyb20uXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvYmplY3Q9e31dIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIHRvLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29weVN5bWJvbHMoc291cmNlLCBvYmplY3QpIHtcbiAgICAgIHJldHVybiBjb3B5T2JqZWN0KHNvdXJjZSwgZ2V0U3ltYm9scyhzb3VyY2UpLCBvYmplY3QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvcGllcyBvd24gYW5kIGluaGVyaXRlZCBzeW1ib2xzIG9mIGBzb3VyY2VgIHRvIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc291cmNlIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIGZyb20uXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvYmplY3Q9e31dIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIHRvLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R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GVuZ3RoO1xuICAgICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICAgIGZ1bmMgPSBmdW5jc1tpbmRleF07XG5cbiAgICAgICAgICB2YXIgZnVuY05hbWUgPSBnZXRGdW5jTmFtZShmdW5jKSxcbiAgICAgICAgICAgICAgZGF0YSA9IGZ1bmNOYW1lID09ICd3cmFwcGVyJyA/IGdldERhdGEoZnVuYykgOiB1bmRlZmluZWQ7XG5cbiAgICAgICAgICBpZiAoZGF0YSAmJiBpc0xhemlhYmxlKGRhdGFbMF0pICYmXG4gICAgICAgICAgICAgICAgZGF0YVsxXSA9PSAoV1JBUF9BUllfRkxBRyB8IFdSQVBfQ1VSUllfRkxBRyB8IFdSQVBfUEFSVElBTF9GTEFHIHwgV1JBUF9SRUFSR19GTEFHKSAmJlxuICAgICAgICAgICAgICAgICFkYXRhWzRdLmxlbmd0aCAmJiBkYXRhWzldID09IDFcbiAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICB3cmFwcGVyID0gd3JhcHBlcltnZXRGdW5jTmFtZShkYXRhWzBdKV0uYXBwbHkod3JhcHBlciwgZGF0YVszXSk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHdyYXBwZXIgPSAoZnVuYy5sZW5ndGggPT0gMSAmJiBpc0xhemlhYmxlKGZ1bmMpKVxuICAgICAgICAgICAgICA/IHdyYXBwZXJbZnVuY05hbWVdKClcbiAgICAgICAgICAgICAgOiB3cmFwcGVyLnRocnUoZnVuYyk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmdW5jdGlvbigpIHtcbiAgICAgICAgICB2YXIgYXJncyA9IGFyZ3VtZW50cyxcbiAgICAgICAgICAgICAgdmFsdWUgPSBhcmdzWzBdO1xuXG4gICAgICAgICAgaWYgKHdyYXBwZXIgJiYgYXJncy5sZW5ndGggPT0gMSAmJiBpc0FycmF5KHZhbHVlKSkge1xuICAgICAgICAgICAgcmV0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W9uKSwgMjkyKTtcbiAgICAgICAgaWYgKHByZWNpc2lvbikge1xuICAgICAgICAgIC8vIFNoaWZ0IHdpdGggZXhwb25lbnRpYWwgbm90YXRpb24gdG8gYXZvaWQgZmxvYXRpbmctcG9pbnQgaXNzdWVzLlxuICAgICAgICAgIC8vIFNlZSBbTUROXShodHRwczovL21kbi5pby9yb3VuZCNFeGFtcGxlcykgZm9yIG1vcmUgZGV0YWlscy5cbiAgICAgICAgICB2YXIgcGFpciA9ICh0b1N0cmluZyhudW1iZXIpICsgJ2UnKS5zcGxpdCgnZScpLFxuICAgICAgICAgICAgICB2YWx1ZSA9IGZ1bmMocGFpclswXSArICdlJyArICgrcGFpclsxXSArIHByZWNpc2lvbikpO1xuXG4gICAgICAgICAgcGFpciA9ICh0b1N0cmluZyh2YWx1ZSkgKyAnZScpLnNwbGl0KCdlJyk7XG4gICAgICAgICAgcmV0dXJuICsocGFpclswXSArICdlJyArICgrcGFpclsxXSAtIHByZWNpc2lvbikpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmdW5jKG51bWJlcik7XG4gICAgICB9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYSBzZXQgb2JqZWN0IG9mIGB2YWx1ZXNgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge0FycmF5fSB2YWx1ZXMgVGhlIHZhbHVlcyB0byBhZGQgdG8gdGhlIHNldC5cbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fSBSZXR1cm5zIHRoZSBuZXcgc2V0LlxuICAgICAqL1xuICAgIHZhciBjcmVhdGVTZXQgPSAhKFNldCAmJiAoMSAvIHNldFRvQXJyYXkobmV3IFNldChbLC0wXSkpWzFdKSA9PSBJTkZJTklUWSkgPyBub29wIDogZnVuY3Rpb24odmFsdWVzKSB7XG4gICAgICByZXR1cm4gbmV3IFNldCh2YWx1ZXMpO1xuICAgIH07XG5cbiAgICAvKipcbiAgICAgKiBDc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gICBzdGFjay5zZXQob3RoZXIsIGFycmF5KTtcblxuICAgICAgLy8gSWdub3JlIG5vbi1pbmRleCBwcm9wZXJ0aWVzLlxuICAgICAgd2hpbGUgKCsraW5kZXggPCBhcnJMZW5ndGgpIHtcbiAgICAgICAgdmFyIGFyclZhbHVlID0gYXJyYXlbaW5kZXhdLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltpbmRleF07XG5cbiAgICAgICAgaWYgKGN1c3RvbWl6ZXIpIHtcbiAgICAgICAgICB2YXIgY29tcGFyZWQgPSBpc1BhcnRpYWxcbiAgICAgICAgICAgID8gY3VzdG9taXplcihvdGhWYWx1ZSwgYXJyVmFsdWUsIGluZGV4LCBvdGhlciwgYXJyYXksIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKGFyclZhbHVlLCBvdGhWYWx1ZSwgaW5kZXgsIGFycmF5LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wYXJlZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKGNvbXBhcmVkKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBhcnJheXMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICBpZiAoIWFycmF5U29tZShvdGhlciwgZnVuY3Rpb24ob3RoVmFsdWUsIG90aEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFjYWNoZUhhcyhzZWVuLCBvdGhJbmRleCkgJiZcbiAgICAgICAgICAgICAgICAgICAgKGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gc2Vlbi5wdXNoKG90aEluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0pKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmICghKFxuICAgICAgICAgICAgICBhcnJWYWx1ZSA9PT0gb3RoVmFsdWUgfHxcbiAgICAgICAgICAgICAgICBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaylcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgc3RhY2tbJ2RlbGV0ZSddKGFycmF5KTtcbiAgICAgIHN0YWNrWydkZWxldGUnXShvdGhlcik7XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEEgc3BlY2lhbGl6ZWQgdmVyc2lvbiBvZiBgYmFzZUlzRXF1YWxEZWVwYCBmb3IgY29tcGFyaW5nIG9iamVjdHMgb2ZcbiAgICAgKiB0aGUgc2FtZSBgdG9TdHJpbmdUYWdgLlxuICAgICAqXG4gICAgICogKipOb3RlOioqIFRoaXMgZnVuY3Rpb24gb25seSBzdXBwb3J0cyBjb21wYXJpbmcgdmFsdWVzIHdpdGggdGFncyBvZlxuICAgICAqIGBCb29sZWFuYCwgYERhdGVgLCBgRXJyb3JgLCBgTnVtYmVyYCwgYFJlZ0V4cGAsIG9yIGBTdHJpbmdgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gY29tcGFy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y5lY21hLWludGVybmF0aW9uYWwub3JnL2VjbWEtMjYyLzcuMC8jc2VjLXJlZ2V4cC5wcm90b3R5cGUudG9zdHJpbmdcbiAgICAgICAgICAvLyBmb3IgbW9yZSBkZXRhaWxzLlxuICAgICAgICAgIHJldHVybiBvYmplY3QgPT0gKG90aGVyICsgJycpO1xuXG4gICAgICAgIGNhc2UgbWFwVGFnOlxuICAgICAgICAgIHZhciBjb252ZXJ0ID0gbWFwVG9BcnJheTtcblxuICAgICAgICBjYXNlIHNldFRhZzpcbiAgICAgICAgICB2YXIgaXNQYXJ0aWFsID0gYml0bWFzayAmIENPTVBBUkVfUEFSVElBTF9GTEFHO1xuICAgICAgICAgIGNvbnZlcnQgfHwgKGNvbnZlcnQgPSBzZXRUb0FycmF5KTtcblxuICAgICAgICAgIGlmIChvYmplY3Quc2l6ZSAhPSBvdGhlci5zaXplICYmICFpc1BhcnRpYWwpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gQXNzdW1lIGN5Y2xpYyB2YWx1ZXMgYXJlIGVxdWFsLlxuICAgICAgICAgIHZhciBzdGFja2VkID0gc3RhY2suZ2V0KG9iamVjdCk7XG4gICAgICAgICAgaWYgKHN0YWNrZWQpIHtcbiAgICAgICAgICAgIHJldHVybiBzdGFja2VkID09IG90aGVyO1xuICAgICAgICAgIH1cbiAgICAgICAgICBiaXRtYXNrIHw9IENPTVBBUkVfVU5PUkRFUkVEX0ZMQUc7XG5cbiAgICAgICAgICAvLyBSZWN1cnNpdmVseSBjb21wYXJlIG9iamVjdHMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgICBzdGFjay5zZXQob2JqZWN0LCBvdGhlcik7XG4gICAgICAgICAgdmFyIHJlc3VsdCA9IGVxdWFsQXJyYXlzKGNvbnZlcnQob2JqZWN0KSwgY29udmVydChvdGhlciksIGJpdG1hc2ssIGN1c3RvbWl6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0KG90aGVyKSkge1xuICAgICAgICByZXR1cm4gc3RhY2tlZCA9PSBvdGhlcjtcbiAgICAgIH1cbiAgICAgIHZhciByZXN1bHQgPSB0cnVlO1xuICAgICAgc3RhY2suc2V0KG9iamVjdCwgb3RoZXIpO1xuICAgICAgc3RhY2suc2V0KG90aGVyLCBvYmplY3QpO1xuXG4gICAgICB2YXIgc2tpcEN0b3IgPSBpc1BhcnRpYWw7XG4gICAgICB3aGlsZSAoKytpbmRleCA8IG9iakxlbmd0aCkge1xuICAgICAgICBrZXkgPSBvYmpQcm9wc1tpbmRleF07XG4gICAgICAgIHZhciBvYmpWYWx1ZSA9IG9iamVjdFtrZXldLFxuICAgICAgICAgICAgb3RoVmFsdWUgPSBvdGhlcltrZXldO1xuXG4gICAgICAgIGlmIChjdXN0b21pemVyKSB7XG4gICAgICAgICAgdmFyIGNvbXBhcmVkID0gaXNQYXJ0aWFsXG4gICAgICAgICAgICA/IGN1c3RvbWl6ZXIob3RoVmFsdWUsIG9ialZhbHVlLCBrZXksIG90aGVyLCBvYmplY3QsIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKG9ialZhbHVlLCBvdGhWYWx1ZSwga2V5LCBvYmplY3QsIG90aGVyLCBzdGFjayk7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBvYmplY3RzIChzdXNjZXB0aWJsZSB0byBjYWxsIHN0YWNrIGxpbWl0cykuXG4gICAgICAgIGlmICghKGNvbXBhcmVkID09PSB1bmRlZmluZWRcbiAgICAgICAgICAgICAgPyAob2JqVmFsdWUgPT09IG90aFZhbHVlIHx8IGVxdWFsRnVuYyhvYmpWYWx1ZSwgb3RoVmFsdWUsIGJpdG1hc2ssIGN1c3RvbWl6ZXIsIHN0YWNrKSlcbiAgICAgICAgICAgICAgOiBjb21wYXJlZFxuICAgICAgICAgICAgKSkge1xuICAgICAgICAgIHJlc3VsdCA9IGZhbHNlO1xuICAgICAgICAgIGJy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50OFRhZzogY2FzZSB1aW50OENsYW1wZWRUYWc6IGNhc2UgdWludDE2VGFnOiBjYXNlIHVpbnQzMlRhZzpcbiAgICAgICAgICByZXR1cm4gY2xvbmVUeXBlZEFycmF5KG9iamVjdCwgaXNEZWVwKTtcblxuICAgICAgICBjYXNlIG1hcFRhZzpcbiAgICAgICAgICByZXR1cm4gY2xvbmVNYXAob2JqZWN0LCBpc0RlZXAsIGNsb25lRnVuYyk7XG5cbiAgICAgICAgY2FzZSBudW1iZXJUYWc6XG4gICAgICAgIGNhc2Ugc3RyaW5nVGFnOlxuICAgICAgICAgIHJldHVybiBuZXcgQ3RvcihvYmplY3QpO1xuXG4gICAgICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgICAgIHJldHVybiBjbG9uZVJlZ0V4cChvYmplY3QpO1xuXG4gICAgICAgIGNhc2Ugc2V0VGFnOlxuICAgICAgICAgIHJldHVybiBjbG9uZVNldChvYmplY3QsIGlzRGVlcCwgY2xvbmVGdW5jKTtcblxuICAgICAgICBjYXNlIHN5bWJvbFRhZzpcbiAgICAgICAgICByZXR1cm4gY2xvbmVTeW1ib2wob2JqZWN0KTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBJbnNlcnRzIHdyYXBwZXIgYGRldGFpbHNgIGluIGEgY29tbWVudCBhdCB0aGUgdG9wIG9mIHRoZSBgc291cmNlYCBib2R5LlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gc291cmNlIFRoZSBzb3VyY2UgdG8gbW9kaWZ5LlxuICAgICAqIEByZXR1cm5zIHtBcnJheX0gZGV0YWlscyBUaGUgZGV0YWlscyB0byBpbnNlcnQuXG4gICAgICogQHJldHVybnMge3N0cmluZ30gUmV0dXJucyB0aGUgbW9kaWZpZWQgc291cmNlLlxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGluc2VydFdyYXBEZXRhaWxzKHNvdXJjZSwgZGV0YWlscykge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gIH1cbiAgICAgICAgbGFzdEludm9rZVRpbWUgPSAwO1xuICAgICAgICBsYXN0QXJncyA9IGxhc3RDYWxsVGltZSA9IGxhc3RUaGlzID0gdGltZXJJZCA9IHVuZGVmaW5lZDtcbiAgICAgIH1cblxuICAgICAgZnVuY3Rpb24gZmx1c2goKSB7XG4gICAgICAgIHJldHVybiB0aW1lcklkID09PSB1bmRlZmluZWQgPyByZXN1bHQgOiB0cmFpbGluZ0VkZ2Uobm93KCkpO1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBkZWJvdW5jZWQoKSB7XG4gICAgICAgIHZhciB0aW1lID0gbm93KCksXG4gICAgICAgICAgICBpc0ludm9raW5nID0gc2hvdWxkSW52b2tlKHRpbWUpO1xuXG4gICAgICAgIGxhc3RBcmdzID0gYXJndW1lbnRzO1xuICAgICAgICBsYXN0VGhpcyA9IHRoaXM7XG4gICAgICAgIGxhc3RDYWxsVGltZSA9IHRpbWU7XG5cbiAgICAgICAgaWYgKGlzSW52b2tpbmcpIHtcbiAgICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4gbGVhZGluZ0VkZ2UobGFzdENhbGxUaW1lKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG1heGluZykge1xuICAgICAgICAgICAgLy8gSGFuZGxlIGludm9jYXRpb25zIGluIGEgdGlnaHQgbG9vcC5cbiAgICAgICAgICAgIHRpbWVySWQgPSBzZXRUaW1lb3V0KHRpbWVyRXhwaXJlZCwgd2FpdCk7XG4gICAgICAgICAgICByZXR1cm4gaW52b2tlRnVuYyhsYXN0Q2FsbFRpbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgdGltZXJJZCA9IHNldFRpbWVvdXQodGltZXJFeHBpcmVkLCB3YWl0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1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rpb259IFtpdGVyYXRlZT1fLmlkZW50aXR5XSBUaGUgZnVuY3Rpb24gaW52b2tlZCBwZXIgaXRlcmF0aW9uLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICogQHNlZSBfLmZvck93blxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBGb28oKSB7XG4gICAgICogICB0aGlzLmEgPSAxO1xuICAgICAqICAgdGhpcy5iID0gMjtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBGb28ucHJvdG90eXBlLmMgPSAzO1xuICAgICAqXG4gICAgICogXy5mb3JPd25SaWdodChuZXcgRm9vLCBmdW5jdGlvbih2YWx1ZSwga2V5KSB7XG4gICAgICogICBjb25zb2xlLmxvZyhrZXkpO1xuICAgICAqIH0pO1xuICAgICAqIC8vID0+IExvZ3MgJ2InIHRoZW4gJ2EnIGFzc3VtaW5nIGBfLmZvck93bmAgbG9ncyAnYScgdGhlbiAnYicuXG4gICAgICovXG4gICAgZnVuY3Rpb24gZm9yT3duUmlnaHQob2JqZWN0LCBpdGVyYXRlZSkge1xuICAgICAgcmV0dXJuIG9iamVjdCAmJiBiYXNlRm9yT3duUmlnaHQob2JqZWN0LCBnZXRJdGVyYXRlZShpdGVyYXRlZSwgMykpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYW4gYXJyYXkgb2YgZnVuY3Rpb24gcHJvcGVydHkgbmFtZXMgZnJvbSBvd24gZW51bWVyYWJsZSBwcm9wZXJ0aWVzXG4gICAgICogb2YgYG9iamVjdGAuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgT2JqZWN0XG4gICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgb2JqZWN0IHRvIGluc3BlY3QuXG4gICAgIC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0cmluZyB0byBjb252ZXJ0LlxuICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IFJldHVybnMgdGhlIGxvd2VyIGNhc2VkIHN0cmluZy5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy50b0xvd2VyKCctLUZvby1CYXItLScpO1xuICAgICAqIC8vID0+ICctLWZvby1iYXItLSdcbiAgICAgKlxuICAgICAqIF8udG9Mb3dlcignZm9vQmFyJyk7XG4gICAgICogLy8gPT4gJ2Zvb2JhcidcbiAgICAgKlxuICAgICAqIF8udG9Mb3dlcignX19GT09fQkFSX18nKTtcbiAgICAgKiAvLyA9PiAnX19mb29fYmFyX18nXG4gICAgICovXG4gICAgZnVuY3Rpb24gdG9Mb3dlcih2YWx1ZSkge1xuICAgICAgcmV0dXJuIHRvU3RyaW5nKHZhbHVlKS50b0xvd2VyQ2FzZSgpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvbnZlcnRzIGBzdHJpbmdgLCBhcyBhIHdob2xlLCB0byB1cHBlciBjYXNlIGp1c3QgbGlrZVxuICAgICAqIFtTdHJpbmcjdG9VcHBlckNhc2VdKGh0dHBzOi8vbWRuLmlvL3RvVXBwZXJDYXNlKS5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjAuMFxuICAgICAqIEBjYXRlZ29yeSBTdHJpbmdcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gW3N0cmluZz0nJ10gVGhlIHN0cmluZyB0byBjb252ZXJ0LlxuICAgICAqIEByZXR1cm5zIHtzdHJpbmd9IFJldHVybnMgdGhlIHVwcGVyIGNhc2VkIHN0cmluZy5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy50b1VwcGVyKCctLWZvby1iYXItLScpO1xuICAgICAqIC8vID0+ICctLUZPTy1CQVItLSdcbiAgICAgKlxuICAgICAqIF8udG9VcHBlcignZm9vQmFyJy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XG4gICAgICogQHJldHVybnMge0Z1bmN0aW9ufE9iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogZnVuY3Rpb24gdm93ZWxzKHN0cmluZykge1xuICAgICAqICAgcmV0dXJuIF8uZmlsdGVyKHN0cmluZywgZnVuY3Rpb24odikge1xuICAgICAqICAgICByZXR1cm4gL1thZWlvdV0vaS50ZXN0KHYpO1xuICAgICAqICAgfSk7XG4gICAgICogfVxuICAgICAqXG4gICAgICogXy5taXhpbih7ICd2b3dlbHMnOiB2b3dlbHMgfSk7XG4gICAgICogXy52b3dlbHMoJ2ZyZWQnKTtcbiAgICAgKiAvLyA9PiBbJ2UnXVxuICAgICAqXG4gICAgICogXygnZnJlZCcpLnZvd2VscygpLnZhbHVlKCk7XG4gICAgICogLy8gPT4gWydlJ11cbiAgICAgKlxuICAgICAqIF8ubWl4aW4oeyAndm93ZWxzJzogdm93ZWxzIH0sIHsgJ2NoYWluJzogZmFsc2UgfSk7XG4gICAgICogXygnZnJlZCcpLnZvd2VscygpO1xuICAgICAqIC8vID0+IFsnZSddXG4gICAgICovXG4gICAgZnVuY3Rpb24gbWl4aW4ob2JqZWN0LCBzb3VyY2UsIG9wdGlvbnMpIHtcbiAgICAgIHZhciBwcm9wcyA9IGtleXMoc291cmNlKSxcbiAgICAgICAgICBtZXRob2ROYW1lcyA9IGJhc2VGdW5jdGlvbnMoc291cmNlLCBwcm9wcyk7XG5cbiAgICAgIGlmIChvcHRpb25zID09IG51bGwgJiZcbiAgICAgICAgICAhKGlzT2JqZWN0KHNvdXJjZSkgJiYgKG1ldGhvZE5hbWVzLmxlbmd0aCB8fCAhcHJvcHMubGVuZ3RoKSkpIHtcbiAgICAgICAgb3B0aW9ucyA9IHNvdXJjZTtcbiAgICAgICAgc291cmNlID0gb2JqZWN0O1xuICAgICAgICBvYmplY3QgPSB0aGlzO1xuICAgICAgICBtZXRob2ROYW1lcyA9IGJhc2VGdW5jdGlvbnMoc291cmNlLCBrZXlzKHNvdXJjZSkpO1xuICAgICAgfVxuICAgICAgdmFyIGNoYWluID0gIShpc09iamVjdChvcHRpb25zKSAmJiAnY2hhaW4nIGluIG9wdGlvbnMpIHx8ICEhb3B0aW9ucy5jaGFpbixcbiAgICAgICAgICBpc0Z1bmMgPSBpc0Z1bmN0aW9uKG9iamVjdCk7XG5cbiAgICAgIGFycmF5RWFjaChtZXRob2ROYW1lcywgZnVuY3Rpb24obWV0aG9kTmFtZSkge1xuICAgICAgICB2YXIgZnVuYyA9IHNvdXJjZVttZXRob2ROYW1lXTtcbiAgICAgICAgb2JqZWN0W21ldGhvZE5hbWVdID0gZnVuYztcbiAgICAgICAgaWYgKGlzRnVuYykge1xuICAgICAgICAgIG9iamVjdC5wcm90b3R5cGVbbWV0aG9kTmFtZV0gPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBjaGFpbkFsbCA9IHRoaXMuX19jaGFpbl9fO1xuICAgICAgICAgICAgaWYgKGNoYWluIHx8IGNoYWluQWxsKSB7XG4gICAgICAgICAgICAgIHZhciByZXN1bHQgPSBvYmplY3QodGhpcy5fX3dyYXBwZWRfXyksXG4gICAgICAgICAgICAgICAgICBhY3Rpb25zID0gcmVzdWx0Ll9fYWN0aW9uc19fID0gY29weUFycmF5KHRoaXMuX19hY3Rpb25zX18pO1xuXG4gICAgICAgICAgICAgIGFjdGlvbnMucHVzaCh7ICdmdW5jJzogZnVuYywgJ2FyZ3MnOiBhcmd1bWVudHMsICd0aGlzQXJnJzogb2JqZWN0IH0pO1xuICAgICAgICAgICAgICByZXN1bHQuX19jaGFpbl9fID0gY2hhaW5BbGw7XG4gICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZnVuYy5hcHBseShvYmplY3QsIGFycmF5UHVzaChbdGhpcy52YWx1ZSgpXSwgYXJndW1lbnRzKSk7XG4gICAgICAgICAgfTtcb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5cyA9IF8udGltZXMoMiwgXy5zdHViQXJyYXkpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzKTtcbiAgICAgKiAvLyA9PiBbW10sIFtdXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzWzBdID09PSBhcnJheXNbMV0pO1xuICAgICAqIC8vID0+IGZhbHNlXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkFycmF5KCkge1xuICAgICAgcmV0dXJuIFtdO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYGZhbHNlYC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjEzLjBcbiAgICAgKiBAY2F0ZWdvcnkgVXRpbFxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBSZXR1cm5zIGBmYWxzZWAuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udGltZXMoMiwgXy5zdHViRmFsc2UpO1xuICAgICAqIC8vID0+IFtmYWxzZSwgZmFsc2VdXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkZhbHNlKCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYSBuZXcgZW1wdHkgb2JqZWN0LlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgbmV3IGVtcHR5IG9iamVjdC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIG9iamVjdHMgPSBfLnRpbWVzKDIsIF8uc3R1Yk9iamVjdCk7XG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhvYmplY3RzKTtcbiAgICAgKiAvLyA9PiBbe30sIHt9XVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2cob2JqZWN0c1swXSA9PT0gb2JqZWN0c1sxXSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViT2JqZWN0KCkge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge3N0cmluZ30gUmV0dXJucyB0aGUgZW1wdHkgc3RyaW5nLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBfLnRpbWVzKDIsIF8uc3R1YlN0cmluZyk7XG4gICAgICogLy8gPT4gWycnLCAnJ11cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViU3RyaW5nKCkge1xuICAgICAgcmV0dXJuICcnO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYHRydWVgLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge2Jvb2xlYW59IFJldHVybnMgYHRydWVgLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBfLnRpbWVzKDIsIF8uc3R1YlRydWUpO1xuICAgICAqIC8vID0+IFt0cnVlLCB0cnVlXVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHN0dWJUcnVlKCkge1xuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxu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XF1ZXN0OiBmdW5jdGlvbiAocmVxLCBjYWxsYmFjaykge1xuICogICAgICAgcmVxLmF1dGgoJ215LXVzZXJuYW1lJywgJ215LXBhc3N3b3JkJyk7XG4gKiAgICAgICBjYWxsYmFjayh1bmRlZmluZWQsIHJlcSk7XG4gKiAgICAgfVxuICogICB9KVxuICogICAudGhlbihKU09OLnBhcnNlKVxuICogICAudGhlbihmdW5jdGlvbiAoZG9jdW1lbnQpIHtcbiAqICAgICBjb25zb2xlLmxvZyhkb2N1bWVudC5mdWxsX25hbWUgKyAnOiAnICsgZG9jdW1lbnQuZGVzY3JpcHRpb24pO1xuICogICB9LCBmdW5jdGlvbiAoZXJyKSB7XG4gKiAgICAgY29uc29sZS5lcnJvcihlcnIuc3RhY2spO1xuICogICB9KTtcbiAqXG4gKiBAZXhhbXBsZVxuICogLy8gRXhhbXBsZSBsb2FkaW5nIGEgWUFNTCBmaWxlXG4gKlxuICogUGF0aExvYWRlclxuICogICAubG9hZCgnL1VzZXJzL25vdC15b3UvcHJvamVjdHMvcGF0aC1sb2FkZXIvLnRyYXZpcy55bWwnKVxuICogICAudGhlbihZQU1MLnNhZmVMb2FkKVxuICogICAudGhlbihmdW5jdGlvbiAoZG9jdW1lbnQpIHtcbiAqICAgICBjb25zb2xlLmxvZygncGF0aC1sb2FkZXIgdXNlcyB0aGUnLCBkb2N1bWVudC5sYW5ndWFnZSwgJ2xhbmd1YWdlLicpO1xuICogICB9LCBmdW5jdGlvbiAoZXJyKSB7XG4gKiAgICAgY29uc29sZS5lcnJvcihlcnIuc3RhY2spO1xuICogICB9KTtcbiAqXG4gKiBAZXhhbXBsZVxuICogLy8gRXhhbXBsZSBsb2FkaW5nIGEgWUFNTCBmaWxlIHdpdGggb3B0aW9ucy5wcm9jZXNzQ29udGVudCAoVXNlZnVsIGlmIHlvdSBuZWVkIGluZm9ybWF0aW9uIGluIHRoZSByYXcgcmVzcG9uc2UpXG4gKlxuICogUGF0aExvYWRlclxuICogICAubG9hZCgn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biAgICAgICAgZm9yIChpID0gMDsgaSA8IDY0OyBpICs9IDQpIHtcbiAgICAgICAgICAgIG1kNWJsa3NbaSA+PiAyXSA9IHMuY2hhckNvZGVBdChpKSArIChzLmNoYXJDb2RlQXQoaSArIDEpIDw8IDgpICsgKHMuY2hhckNvZGVBdChpICsgMikgPDwgMTYpICsgKHMuY2hhckNvZGVBdChpICsgMykgPDwgMjQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZDVibGtzO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIG1kNWJsa19hcnJheShhKSB7XG4gICAgICAgIHZhciBtZDVibGtzID0gW10sXG4gICAgICAgICAgICBpOyAvKiBBbmR5IEtpbmcgc2FpZCBkbyBpdCB0aGlzIHdheS4gKi9cblxuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgNjQ7IGkgKz0gNCkge1xuICAgICAgICAgICAgbWQ1Ymxrc1tpID4+IDJdID0gYVtpXSArIChhW2kgKyAxXSA8PCA4KSArIChhW2kgKyAyXSA8PCAxNikgKyAoYVtpICsgM10gPDwgMjQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZDVibGtzO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIG1kNTEocykge1xuICAgICAgICB2YXIgbiA9IHMubGVuZ3RoLFxuICAgICAgICAgICAgc3RhdGUgPSBbMTczMjU4NDE5MywgLTI3MTczMzg3OSwgLTE3MzI1ODQxOTQsIDI3MTczMzg3OF0sXG4gICAgICAgICAgICBpLFxuICAgICAgICAgICAgbGVuZ3RoLFxuICAgICAgICAgICAgdGFpbCxcbiAgICAgICAgICAgIHRtcCxcbiAgICAgICAgICAgIGxvLFxuICAgICAgICAgICAgaGk7XG5cbiAgICAgICAgZm9yIChpID0gNjQ7IGkgPD0gbjsgaSArPSA2NCkge1xuICAgICAgICAgICAgbWQ1Y3ljbGUoc3RhdGUsIG1kNWJsayhzLnN1YnN0cmluZyhpIC0gNjQsIGkpKSk7XG4gICAgICAgIH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wLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwXTtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICB0YWlsW2kgPj4gMl0gfD0gYVtpXSA8PCAoKGkgJSA0KSA8PCAzKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRhaWxbaSA+PiAyXSB8PSAweDgwIDw8ICgoaSAlIDQpIDw8IDMpO1xuICAgICAgICBpZiAoaSA+IDU1KSB7XG4gICAgICAgICAgICBtZDVjeWNsZShzdGF0ZSwgdGFpbCk7XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgMTY7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgIHRhaWxbaV0gPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gQmV3YXJlIHRoYXQgdGhlIGZpbmFsIGxlbmd0aCBtaWdodCBub3QgZml0IGluIDMyIGJpdHMgc28gd2UgdGFrZSBjYXJlIG9mIHRoYXRcbiAgICAgICAgdG1wID0gbiAqIDg7XG4gICAgICAgIHRtcCA9IHRtcC50b1N0cmluZygxNikubWF0Y2goLyguKj8pKC57MCw4fSkkLyk7XG4gICAgICAgIGxvID0gcGFyc2VJbnQodG1wWzJdLCAxNik7XG4gICAgICAgIGhpID0gcGFyc2VJbnQodG1wWzFdLCAxNikgfHwgMDtcblxuICAgICAgICB0YWlsWzE0XSA9IGxvO1xuICAgICAgICB0YWlsWzE1XSA9IGhpO1xuXG4gICAgICAgIG1kNWN5Y2xlKHN0YXRlLCB0YWlsKTtcblxuICAgICAgICByZXR1cm4gc3RhdGU7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcmhleChuKSB7XG4gICAgICAgIHZhciBzID0gJycsXG4gICAgICAgICAgICBqO1xuICAgICAgICBmb3IgKGogPSAwOyBqIDwgNDsgaiArPSAxKSB7XG4gICAgICAgICAgICBzICs9IGhleF9jaHJbKG4gPj4gKGogKiA4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ZGVmaW5lZCcgJiYgIUFycmF5QnVmZmVyLnByb3RvdHlwZS5zbGljZSkge1xuICAgICAgICAoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgZnVuY3Rpb24gY2xhbXAodmFsLCBsZW5ndGgpIHtcbiAgICAgICAgICAgICAgICB2YWwgPSAodmFsIHwgMCkgfHwgMDtcblxuICAgICAgICAgICAgICAgIGlmICh2YWwgPCAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLm1heCh2YWwgKyBsZW5ndGgsIDApO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLm1pbih2YWwsIGxlbmd0aCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIEFycmF5QnVmZmVyLnByb3RvdHlwZS5zbGljZSA9IGZ1bmN0aW9uIChmcm9tLCB0bykge1xuICAgICAgICAgICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmJ5dGVMZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIGJlZ2luID0gY2xhbXAoZnJvbSwgbGVuZ3RoKSxcbiAgICAgICAgICAgICAgICAgICAgZW5kID0gbGVuZ3RoLFxuICAgICAgICAgICAgICAgICAgICBudW0sXG4gICAgICAgICAgICAgICAgICAgIHRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0QXJyYXksXG4gICAgICAgICAgICAgICAgICAgIHNvdXJjZUFycmF5O1xuXG4gICAgICAgICAgICAgICAgaWYgKHRvICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZW5kID0gY2xhbXAodG8sIGxlbmd0aCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKGJlZ2luID4gZW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQXJyYXlCdWZmZXIoMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgbnVtID0gZ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jpcInRqXCJ9JylcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBtYW51YWwgeC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCgnbmFtZT10aicpXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGRlZmF1bHRzIHRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICogICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAuc2VuZCgnbmFtZT10b2JpJylcbiAqICAgICAgICAuc2VuZCgnc3BlY2llcz1mZXJyZXQnKVxuICogICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogQHBhcmFtIHtTdHJpbmd8T2JqZWN0fSBkYXRhXG4gKiBAcmV0dXJuIHtSZXF1ZXN0fSBmb3IgY2hhaW5pbmdcbiAqIEBhcGkgcHVibGljXG4gKi9cblxuUmVxdWVzdEJhc2UucHJvdG90eXBlLnNlbmQgPSBmdW5jdGlvbihkYXRhKXtcbiAgdmFyIGlzT2JqID0gaXNPYmplY3QoZGF0YSk7XG4gIHZhciB0eXBlID0gdGhpcy5fa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nlc3NDb2RlJztcbiAgICAgICAgfVxuXG4gICAgICAgIHN3aXRjaCAoZ3ROYW1lKSB7XG4gICAgICAgIGNhc2UgJ2ltcGxpY2l0JzpcbiAgICAgICAgICBzZWN1cml0eURlZmluaXRpb24uYXV0aG9yaXphdGlvblVybCA9IGdyYW50VHlwZS5sb2dpbkVuZHBvaW50LnVybDtcbiAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlICdhdXRob3JpemF0aW9uX2NvZGUnOlxuICAgICAgICAgIHNlY3VyaXR5RGVmaW5pdGlvbi5hdXRob3JpemF0aW9uVXJsID1cbiAgICAgICAgICAgIGdyYW50VHlwZS50b2tlblJlcXVlc3RFbmRwb2ludC51cmw7XG4gICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnRva2VuVXJsID0gZ3JhbnRUeXBlLnRva2VuRW5kcG9pbnQudXJsO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGF1dGhvcml6YXRpb24uc2NvcGVzKSB7XG4gICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnNjb3BlcyA9IHt9O1xuXG4gICAgICAgICAgYXV0aG9yaXphdGlvbi5zY29wZXMuZm9yRWFjaChmdW5jdGlvbihzY29wZSkge1xuICAgICAgICAgICAgc2VjdXJpdHlEZWZpbml0aW9uLnNjb3Blc1tzY29wZS5zY29wZV0gPSBzY29wZS5kZXNjcmlwdGlvbiB8fFxuICAgICAgICAgICAgICAoJ1VuZGVzY3JpYmVkICcgKyBzY29wZS5zY29wZSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH0gZWxzZSB7XG4gICAgICBjcmVhdGVEZWZpbml0aW9uKCk7XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gc2VjdXJpdHlEZWZpbml0aW9ucztcbn1cblxuLypcbiAqIFRyYW5zZm9ybXMgYSBTd2FnZ2VyIDEuMiBtb2RlbCBvYmplY3QgdG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O1xufTtcblxuVHJhdmVyc2UucHJvdG90eXBlLm5vZGVzID0gZnVuY3Rpb24gKCkge1xuICAgIHZhciBhY2MgPSBbXTtcbiAgICB0aGlzLmZvckVhY2goZnVuY3Rpb24gKHgpIHtcbiAgICAgICAgYWNjLnB1c2godGhpcy5ub2RlKTtcbiAgICB9KTtcbiAgICByZXR1cm4gYWNjO1xufTtcblxuVHJhdmVyc2UucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkge1xuICAgIHZhciBwYXJlbnRzID0gW10sIG5vZGVzID0gW107XG4gICAgXG4gICAgcmV0dXJuIChmdW5jdGlvbiBjbG9uZSAoc3JjKSB7XG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGFyZW50cy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgaWYgKHBhcmVudHNbaV0gPT09IHNyYykge1xuICAgICAgICAgICAgICAgIHJldHVybiBub2Rlc1tpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBcbiAgICAgICAgaWYgKHR5cGVvZiBzcmMgPT09ICdvYmplY3QnICYmIHNyYyAhPT0gbnVsbCkge1xuICAgICAgICAgICAgdmFyIGRzdCA9IGNvcHkoc3JjKTtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgcGFyZW50cy5wdXNoKHNyYyk7XG4gICAgICAgICAgICBub2Rlcy5wdXNoKGRzdCk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIGZvckVhY2gob2JqZWN0S2V5cyhzcmMpLCBmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgICAgICAgICAgZHN0W2tleV0gPSBjbG9uZShzcmNba2V5XSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIFxuICAgICAgICAgICAgcGFyZW50cy5wb3AoKTtcbiAgICAgICAgICAgIG5vZGVzLnBvcCgpO1xuICAgICAgICAgICAgcmV0dXJuIGRzdDtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBzcmM7XG4gICAgICAgIH1cbiAgICB9KSh0aGlzLnZhbHVlKTtcbn07XG5cbmZ1bmN0aW9uIHdhbGsgKHJvb3QsIGNiLCBpbW11dGFibGUpIHtcbiAgICB2YXIgcGF0aCA9IFtdO1xuICAgIHZhciBwYXJlbnRzID0gW107XG4gICAgdmFyIGFsaXZlID0gdHJ1ZTtcbiAgICBcbiAgICByZXR1cm4gKGZ1bmN0aW9uIHdhbGtlciAobm9kZV8pIHtcbiAgICAgICAgdmFyIG5vZGUgPSBpbW11dGFibGUgPyBjb3B5KG5vZGVfKSA6IG5vZGVfO1xuICAgICAgICB2YXIgbW9kaWZpZXJzID0ge307XG4gICAgICAgIFxuICAgICAgICB2YXIga2VlcEdvaW5nID0gdHJ1ZTtcbiAgICAgICAgXG4gICAgICAgIHZhciBzdGF0ZSA9IHtcbiAgICAgICAgICAgIG5vZGUgOiBub2RlLFxuICAgICAgICAgICAgbm9kZV8gOiBub2RlXyxcbiAgICAgICAgICAgIHBhdGggOiBbXS5jb25jYXQocGF0aCksXG4gICAgICAgICAgICBwYXJlbnQgOiBwYXJlbnRzW3BhcmVudHMubGVuZ3RoIC0gMV0sXG4gICAgICAgICAgICBwYXJlbnRzIDogcGFyZW50cyxcbiAgICAgICAgICAgIGtleSA6IHBhdGguc2xpY2UoLTEpWzBdLFxuICAgICAgICAgICAgaXNSb290IDogcGF0aC5sZW5ndGggPT09IDAsXG4gICAgICAgICAgICBsZXZlbCA6IHBhdGgubGVuZ3RoLFxuICAgICAgICAgICAgY2lyY3VsYXIgOiBudWxsLFxuICAgICAgICAgICAgdXBkYXRlIDogZnVuY3Rpb24gKHgsIHN0b3BIZXJlKSB7XG4gICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5pc1Jvb3QpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUucGFyZW50Lm5vZGVbc3RhdGUua2V5XSA9IHg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHN0YXRlLm5vZGUgPSB4O1xuICAgICAgICAgICAgICAgIGlmIChzdG9wSGVyZSkga2VlcEdvaW5nID0gZmFsc2U7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgJ2RlbGV0ZScgOiBmdW5jdGlvbiAoc3RvcEhlcmUpIHtcbiAgICAgICAgICAgICAgICBkZWxldGUgc3RhdGUucGFyZW50Lm5vZGVbc3RhdGUua2V5XTtcbiAgICAgICAgICAgICAgICBpZiAoc3RvcEhlcmUpIGtlZXBHb2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHJlbW92ZSA6IGZ1bmN0aW9uIChzdG9wSGVyZSkge1xuICAgICAgICAgICAgICAgIGlmIChpc0FycmF5KHN0YXRlLnBhcmVudC5ub2RlKSkge1xuICAgICAgICAgICAgICAgICAgICBzdGF0ZS5wYXJlbnQubm9kZS5zcGxpY2Uoc3RhdGUua2V5LCAxKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBzdGF0ZS5wYXJlbnQubm9kZVtzdGF0ZS5rZXldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoc3RvcEhlcmUpIGtlZXBHb2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGtleXMgOiBudWxsLFxuICAgICAgICAgICAgYmVmb3JlIDogZnVuY3Rpb24gKGYpIHsgbW9kaWZpZXJzLmJlZm9yZSA9IGYgfSxcbiAgICAgICAgICAgIGFmdGVyIDogZnVuY3Rpb24gKGYpIHsgbW9kaWZpZXJzLmFmdGVyID0gZiB9LFxuICAgICAgICAgICAgcHJlIDogZnVuY3Rpb24gKGYpIHsgbW9kaWZpZXJzLnByZSA9IGYgfSxcbiAgICAgICAgICAgIHBvc3QgOiBmdW5jdGlvbiAoZikgeyBtb2RpZmllcnMucG9zdCA9IGYgfSxcbiAgICAgICAgICAgIHN0b3AgOiBmdW5jdGlvbiAoKSB7IGFsaXZlID0gZmFsc2UgfSxcbiAgICAgICAgICAgIGJsb2NrIDogZnVuY3Rpb24gKCkgeyBrZWVwR29pbmcgPSBmYWxzZSB9XG4gICAgICAgIH07XG4gICAgICAgIFxuICAgICAgICBpZiAoIWFsaXZlKSByZXR1cm4gc3RhdGU7XG4gICAgICAgIFxuICAgICAgICBmdW5jdGlvbiB1cGRhdGVTdGF0ZSgpIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc3RhdGUubm9kZSA9PT0gJ29iamVjdCcgJiYgc3RhdGUubm9kZSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIGlmICghc3RhdGUua2V5cyB8fCBzdGF0ZS5ub2RlXyAhPT0gc3RhdGUubm9kZSkge1xuICAgICAgICAgICAgICAgICAgICBzdGF0ZS5rZXlzID0gb2JqZWN0S2V5cyhzdGF0ZS5ub2RlKVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBzdGF0ZS5pc0xlYWYgPSBzdGF0ZS5rZXlzLmxlbmd0aCA9PSAwO1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcGFyZW50cy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBpZiAocGFyZW50c1tpXS5ub2RlXyA9PT0gbm9kZV8pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmNpcmN1bGFyID0gcGFyZW50c1tpXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgc3RhdGUuaXNMZWFmID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBzdGF0ZS5rZXlzID0gbnVsbDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIFxuICAgICAgICAgICAgc3RhdGUubm90TGVhZiA9ICFzdGF0ZS5pc0xlYWY7XG4gICAgICAgICAgICBzdGF0ZS5ub3RSb290ID0gIXN0YXRlLmlzUm9vdDtcbiAgICAgICAgfVxuICAgICAgICBcbiAgICAgICAgdXBkYXRlU3RhdGUoKTtcbiAgICAgICAgXG4gICAgICAgIC8vIHVzZSByZXR1cm4gdmFsdWVzIHRvIHVwZGF0ZSBpZiBkZWZpbmVkXG4gICAgICAgIHZhciByZXQgPSBjYi5jYWxsKHN0YXRlLCBzdGF0ZS5ub2RlKTtcbiAgICAgICAgaWYgKHJldCAhPT0gdW5kZWZpbmVkICYmIHN0YXRlLnVwZGF0ZSkgc3RhdGUudXBkYXRlKHJldCk7XG4gICAgICAgIFxuICAgICAgICBpZiAobW9kaWZpZXJzLmJlZm9yZSkgbW9kaWZpZXJzLmJlZm9yZS5jYWxsKHN0YXRlLCBzdGF0ZS5ub2RlKTtcbiAgICAgICAgXG4gICAgICAgIGlmICgha2VlcEdvaW5nKSByZXR1cm4gc3RhdGU7XG4gICAgICAgIFxuICAgICAgICBpZiAodHlwZW9mIHN0YXRlLm5vZGUgPT0gJ29iamVjdCdcbiAgICAgICAgJiYgc3RhdGUubm9kZSAhPT0gbnVsbCAmJiAhc3RhdGUuY2lyY3VsYXIpIHtcbiAgICAgICAgICAgIHBhcmVudHMucHVzaChzdGF0ZSk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIHVwZGF0ZVN0YXRlKCk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIGZvckVhY2goc3RhdGUua2V5cywgZnVuY3Rpb24gKGtleSwgaSkge1xuICAgICAgICAgICAgICAgIHBhdGgucHVzaChrZXkpO1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGlmIChtb2RpZmllcnMucHJlKSBtb2RpZmllcnMucHJlLmNhbGwoc3RhdGUsIHN0YXRlLm5vZGVba2V5XSwga2V5KTtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICB2YXIgY2hpbGQgPSB3YWxrZXIoc3RhdGUubm9kZVtrZXldKTtcbiAgICAgICAgICAgICAgICBpZiAoaW1tdXRhYmxlICYmIGhhc093blByb3BlcnR5LmNhbGwoc3RhdGUubm9kZSwga2V5KSkge1xuICAgICAgICAgICAgICAgICAgICBzdGF0ZS5ub2RlW2tleV0gPSBjaGlsZC5ub2RlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBjaGlsZC5pc0xhc3QgPSBpID09IHN0YXRlLmtleXMubGVuZ3RoIC0gMTtcbiAgICAgICAgICAgICAgICBjaGlsZC5pc0ZpcnN0ID0gaSA9PSAwO1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIGlmIChtb2RpZmllcnMucG9zdCkgbW9kaWZpZXJzLnBvc3QuY2FsbChzdGF0ZSwgY2hpbGQpO1xuICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgIHBhdGgucG9wKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHBhcmVudHMucG9wKCk7XG4gICAgICAgIH1cbiAgICAgICAgXG4gICAgICAgIGlmIChtb2RpZmllcnMuYWZ0ZXIpIG1vZGlmaWVycy5hZnRlci5jYWxsKHN0YXRlLCBzdGF0ZS5ub2RlKTtcbiAgICAgICAgXG4gICAgICAgIHJldHVybiBzdGF0ZTtcbiAgICB9KShyb290KS5ub2RlO1xufVxuXG5mdW5jdGlvbiBjb3B5IChzcmMpIHtcbiAgICBpZiAodHlwZW9mIHNyYyA9PT0gJ29iamVjdCcgJiYgc3JjICE9PSBudWxsKSB7XG4gICAgICAgIHZhciBkc3Q7XG4gICAgICAgIFxuICAgICAgICBpZiAoaXNBcnJheShzcmMpKSB7XG4gICAgICAgICAgICBkc3QgPSBbXTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChpc0RhdGUoc3JjKSkge1xuICAgICAgICAgICAgZHN0ID0gbmV3IERhdGUoc3JjLmdldFRpbWUgPyBzcmMuZ2V0VGltZSgpIDogc3JjKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChpc1JlZ0V4cChzcmMpKSB7XG4gICAgICAgICAgICBkc3QgPSBuZXcgUmVnRXhwKHNyYyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoaXNFcnJvcihzcmMpKSB7XG4gICAgICAgICAgICBkc3QgPSB7IG1lc3NhZ2U6IHNyYy5tZXNzYWdlIH07XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoaXNCb29sZWFuKHNyYykpIHtcbiAgICAgICAgICAgIGRzdCA9IG5ldyBCb29sZWFuKHNyYyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoaXNOdW1iZXIoc3JjKSkge1xuICAgICAgICAgICAgZHN0ID0gbmV3IE51bWJlcihzcmMpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzU3RyaW5nKHNyYykpIHtcbiAgICAgICAgICAgIGRzdCA9IG5ldyBTdHJpbmcoc3JjKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChPYmplY3QuY3JlYXRlICYmIE9iamVjdC5nZXRQcm90b3R5cGVPZikge1xuICAgICAgICAgICAgZHN0ID0gT2JqZWN0LmNyZWF0ZShPYmplY3QuZ2V0UHJvdG90eXBlT2Yoc3JjKSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoc3JjLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcbiAgICAgICAgICAgIGRzdCA9IHt9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgdmFyIHByb3RvID1cbiAgICAgICAgICAgICAgICAoc3JjLmNvbnN0cnVjdG9yICYmIHNyYy5jb25zdHJ1Y3Rvci5wcm90b3R5cGUpXG4gICAgICAgICAgICAgICAgfHwgc3JjLl9fcHJvdG9fX1xuICAgICAgICAgICAgICAgIHx8IHt9XG4gICAgICAgICAgICA7XG4gICAgICAgICAgICB2YXIgVCA9IGZ1bmN0aW9uICgpIHt9O1xuICAgICAgICAgICAgVC5wcm90b3R5cGUgPSBwcm90bztcbiAgICAgICAgICAgIGRzdCA9IG5ldyBUO1xuICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICBmb3JFYWNoKG9iamVjdEtleXMoc3JjKSwgZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgZHN0W2tleV0gPSBzcmNba2V5XTtcbiAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkc3Q7XG4gICAgfVxuICAgIGVsc2UgcmV0dXJuIHNyYztcbn1cblxudmFyIG9iamVjdEtleXMgPSBPYmplY3Qua2V5cyB8fCBmdW5jdGlvbiBrZXlzIChvYmopIHtcbiAgICB2YXIgcmVzID0gW107XG4gICAgZm9yICh2YXIga2V5IGluIG9iaikgcmVzLnB1c2goa2V5KVxuICAgIHJldHVybiByZXM7XG59O1xuXG5mdW5jdGlvbiB0b1MgKG9iaikgeyByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKG9iaikgfVxuZnVuY3Rpb24gaXNEYXRlIChvYmopIHsgcmV0dXJuIHRvUyhvYmopID09PSAnW29iamVjdCBEYXRlXScgfVxuZnVuY3Rpb24gaXNSZWdFeHAgKG9iaikgeyByZXR1cm4gdG9TKG9iaikgPT09ICdbb2JqZWN0IFJlZ0V4cF0nIH1cbmZ1bmN0aW9uIGlzRXJyb3IgKG9iaikgeyByZXR1cm4gdG9TKG9iaikgPT09ICdbb2JqZWN0IEVycm9yXScgfVxuZnVuY3Rpb24gaXNCb29sZWFuIChvYmopIHsgcmV0dXJuIHRvUyhvYmopID09PSAnW29iamVjdCBCb29sZWFuXScgfVxuZnVuY3Rpb24gaXNOdW1iZXIgKG9iaikgeyByZXR1cm4gdG9TKG9iaikgPT09ICdbb2JqZ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lUJCQsIFwiW1xcXFwrXFxcXC1cXFxcLl1cIikgKyBcIipcIiksXG4gICAgICAgIFVTRVJJTkZPJCA9IHN1YmV4cChzdWJleHAoUENUX0VOQ09ERUQkICsgXCJ8XCIgKyBtZXJnZShVTlJFU0VSVkVEJCQsIFNVQl9ERUxJTVMkJCwgXCJbXFxcXDpdXCIpKSArIFwiKlwiKSxcbiAgICAgICAgREVDX09DVEVUJCA9IHN1YmV4cChzdWJleHAoXCIyNVswLTVdXCIpICsgXCJ8XCIgKyBzdWJleHAoXCIyWzAtNF1cIiArIERJR0lUJCQpICsgXCJ8XCIgKyBzdWJleHAoXCIxXCIgKyBESUdJVCQkICsgRElHSVQkJCkgKyBcInxcIiArIHN1YmV4cChcIlsxLTldXCIgKyBESUdJVCQkKSArIFwifFwiICsgRElHSVQkJCksXG4gICAgICAgIElQVjRBRERSRVNTJCA9IHN1YmV4cChERUNfT0NURVQkICsgXCJcXFxcLlwiICsgREVDX09DVEVUJCArIFwiXFxcXC5cIiArIERFQ19PQ1RFVCQgKyBcIlxcXFwuXCIgKyBERUNfT0NURVQkKSxcbiAgICAgICAgSDE2JCA9IHN1YmV4cChIRVhESUckJCArIFwiezEsNH1cIiksXG4gICAgICAgIExTMzIkID0gc3ViZXhwKHN1YmV4cChIMTYkICsgXCJcXFxcOlwiICsgSDE2JCkgKyBcInxcIiArIElQVjRBRERSRVNTJCksXG4gICAgICAgIElQVjZBRERSRVNTMSQgPSBzdWJleHAoc3ViZXhwKEgxNiQgKyBcIlxcXFw6XCIpICsgXCJ7Nn1cIiArIExTMzIkKSxcbiAgICAgICAgLy8gICAgICAgICAgICAgICAgICAgICAgICAgICA2KCBoMTYgXCI6XCIgKSBsczMyXG4gICAgSVBWNkFERFJFU1MyJCA9IHN1YmV4cChcIlxcXFw6XFxcXDpcIiArIHN1YmV4cChIMTYkICsgXCJcXFxcOlwiKSArIFwiezV9XCIgKyBMUzMyJCksXG4gICAgICAgIC8vICAgICAgICAgICAgICAgICAgICA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NjaGVtZSA/IG9wdGlvbnMuc2NoZW1lICsgXCI6XCIgOiBcIlwiKSArIFwiLy9cIiArIHVyaVN0cmluZztcbiAgICB2YXIgbWF0Y2hlcyA9IHVyaVN0cmluZy5tYXRjaChVUklfUEFSU0UpO1xuICAgIGlmIChtYXRjaGVzKSB7XG4gICAgICAgIGlmIChOT19NQVRDSF9JU19VTkRFRklORUQpIHtcbiAgICAgICAgICAgIC8vc3RvcmUgZWFjaCBjb21wb25lbnRcbiAgICAgICAgICAgIGNvbXBvbmVudHMuc2NoZW1lID0gbWF0Y2hlc1sxXTtcbiAgICAgICAgICAgIGNvbXBvbmVudHMudXNlcmluZm8gPSBtYXRjaGVzWzNdO1xuICAgICAgICAgICAgY29tcG9uZW50cy5ob3N0ID0gbWF0Y2hlc1s0XTtcbiAgICAgICAgICAgIGNvbXBvbmVudHMucG9ydCA9IHBhcnNlSW50KG1hdGNoZXNbNV0sIDEwKTtcbiAgICAgICAgICAgIGNvbXBvbmVudHMucGF0aCA9IG1hdGNoZXNbNl0gfHwgXCJcIjtcbiAgICAgICAgICAgIGNvbXBvbmVudHMucXVlcnkgPSBtYXRjaGVzWzddO1xuICAgICAgICAgICAgY29tcG9uZW50cy5mcmFnbWVudCA9IG1hdGNoZXNbOF07XG4gICAgICAgICAgICAvL2ZpeCBwb3J0IG51bWJlclxuICAgICAgICAgICAgaWYgKGlzTmFOKGNvbXBvbmVudHMucG9ydCkpIHtcbiAgICAgICAgICAgICAgICBjb21wb25lbnRzLnBvcnQgPSBtYXRjaGVzWzVdO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy9zdG9yZSBlYWNoIGNvbXBvbmVudFxuICAgICAgICAgICAgY29tcG9uZW50cy5zY2hlbWUgPSBtYXRjaGVzWzFdIHx8IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIGNvbXBvbmVudHMudXNlcmluZm8gPSB1cmlTdHJpbmcuaW5kZXhPZihcIkBcIikgIT09I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W1lIGhhbmRsZXJcbiAgICAgICAgdmFyIHNjaGVtZUhhbmRsZXIgPSBTQ0hFTUVTWyhvcHRpb25zLnNjaGVtZSB8fCBjb21wb25lbnRzLnNjaGVtZSB8fCBcIlwiKS50b0xvd2VyQ2FzZSgpXTtcbiAgICAgICAgLy9jaGVjayBpZiBzY2hlbWUgY2FuJ3QgaGFuZGxlIElSSXNcbiAgICAgICAgaWYgKCFvcHRpb25zLnVuaWNvZGVTdXBwb3J0ICYmICghc2NoZW1lSGFuZGxlciB8fCAhc2NoZW1lSGFuZGxlci51bmljb2RlU3VwcG9ydCkpIHtcbiAgICAgICAgICAgIC8vaWYgaG9zdCBjb21wb25lbnQgaXMgYSBkb21haW4gbmFtZVxuICAgICAgICAgICAgaWYgKGNvbXBvbmVudHMuaG9zdCAmJiAob3B0aW9ucy5kb21haW5Ib3N0IHx8IHNjaGVtZUhhbmRsZXIgJiYgc2NoZW1lSGFuZGxlci5kb21haW5Ib3N0KSkge1xuICAgICAgICAgICAgICAgIC8vY29udmVydCBVbmljb2RlIElETiAtPiBBU0NJSSBJRE5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmhvc3QgPSBwdW55Y29kZS50b0FTQ0lJKGNvbXBvbmVudHMuaG9zdC5yZXBsYWNlKHByb3RvY29sLlBDVF9FTkNPREVELCBwY3REZWNDaGFycykudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmVycm9yID0gY29tcG9uZW50cy5lcnJvciB8fCBcIkhvc3QncyBkb21haW4gbmFtZSBjYW4gbm90IGJlIGNvbnZlcnRlZCB0byBBU0NJSSB2aWEgcHVueWNvZGU6IFwiICsgZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL2NvbnZlcnQgSVJJIC0+IFVSSVxuICAgICAgICAgIC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ybWFsaXplIGVuY29kaW5nXG4gICAgX25vcm1hbGl6ZUNvbXBvbmVudEVuY29kaW5nKGNvbXBvbmVudHMsIHByb3RvY29sKTtcbiAgICBpZiAob3B0aW9ucy5yZWZlcmVuY2UgIT09IFwic3VmZml4XCIgJiYgY29tcG9uZW50cy5zY2hlbWUpIHtcbiAgICAgICAgdXJpVG9rZW5zLnB1c2goY29tcG9uZW50cy5zY2hlbWUpO1xuICAgICAgICB1cmlUb2tlbnMucHVzaChcIjpcIik7XG4gICAgfVxuICAgIHZhciBhdXRob3JpdHkgPSBfcmVjb21wb3NlQXV0aG9yaXR5KGNvbXBvbmVudHMsIG9wdGlvbnMpO1xuICAgIGlmIChhdXRob3JpdHkgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICBpZiAob3B0aW9ucy5yZWZlcmVuY2UgIT09IFwic3VmZml4XCIpIHtcbiAgICAgICAgICAgIHVyaVRva2Vucy5wdXNoKFwiLy9cIik7XG4gICAgICAgIH1cbiAgICAgICAgdXJpVG9rZW5zLnB1c2goYXV0aG9yaXR5KTtcbiAgICAgICAgaWYgKGNvbXBvbmVudHMucGF0aCAmJiBjb21wb25lbnRzLnBhdGguY2hhckF0KDApICE9PSBcIi9cIikge1xuICAgICAgICAgICAgdXJpVG9rZW5zLnB1c2goXCIvXCIpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGlmIChjb21wb25lbnRzLnBhdGggIT09IHVuZGVmaW5lZCkge1xuICAgICAgICB2YXIgcyA9IGNvbXBvbmVudHMucGF0aDtcbiAgICAgICAgaWYgKCFvcHRpb25zLmFic29sdXRlUGF0aCAmJiAoIXNjaGVtZUhhbmRsZXIgfHwgIXNjaGVtZUhhbmRsZXIuYWJzb2x1dGVQYXRoKSkge1xuICAgICAgICAgICAgcyA9IHJlbW92ZURvdFNlZ21lbnRzKHMpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChhdXRob3JpdHkgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcyA9IH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RoIHx8IFwiXCIpO1xuICAgICAgICAgICAgdGFyZ2V0LnF1ZXJ5ID0gcmVsYXRpdmUucXVlcnk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoIXJlbGF0aXZlLnBhdGgpIHtcbiAgICAgICAgICAgICAgICB0YXJnZXQucGF0aCA9IGJhc2UucGF0aDtcbiAgICAgICAgICAgICAgICBpZiAocmVsYXRpdmUucXVlcnkgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQucXVlcnkgPSByZWxhdGl2ZS5xdWVyeTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQucXVlcnkgPSBiYXNlLnF1ZXJ5O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHJlbGF0aXZlLnBhdGguY2hhckF0KDApID09PSBcIi9cIikge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXQucGF0aCA9IHJlbW92ZURvdFNlZ21lbnRzKHJlbGF0aXZlLnBhdGgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICgoYmFzZS51c2VyaW5mbyAhPT0gdW5kZWZpbmVkIHx8IGJhc2UuaG9zdCAhPT0gdW5kZWZpbmVkIHx8IGJhc2UucG9ydCAhPT0gdW5kZWZpbmVkKSAmJiAhYmFzZS5wYXRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQucGF0aCA9IFwiL1wiICsgcmVsYXRpdmUucGF0aDtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICghYmFzZS5wYXRoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQucGF0aCA9IHJlbGF0aXZlLnBhdGg7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAg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ICAgICBjYXNlIFwidG9cIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0b0FkZHJzID0gaGZpZWxkWzFdLnNwbGl0KFwiLFwiKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIF94ID0gMCwgX3hsID0gdG9BZGRycy5sZW5ndGg7IF94IDwgX3hsOyArK194KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG8ucHVzaCh0b0FkZHJzW194XSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcInN1YmplY3RcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuc3ViamVjdCA9IHVuZXNjYXBlQ29tcG9uZW50KGhmaWVsZFsxXSwgb3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcImJvZHlcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuYm9keSA9IHVuZXNjYXBlQ29tcG9uZW50KGhmaWVsZFsxXSwgb3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHVua25vd25IZWFkZXJzID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnNbdW5lc2NhcGVDb21wb25lbnQoaGZpZWxkWzBdLCBvcHRpb25zKV0gPSB1bmVzY2FwZUNvbXBvbmVudChoZmllbGRbMV0sIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHVua25vd25IZWFkZXJzKSBjb21wb25lbnRzLmhlYWRlcnMgPSBoZWFkZXJzO1xuICAgICAgICB9XG4gICAgICAgIGNvbXBvbmVudHMucXVlcnkgPSB1bmRlZmluZWQ7XG4gICAgICAgIGZvciAodmFyIF94MiA9IDAsIF94bDIgPSB0by5sZW5ndGg7IF94MiA8IF94bDI7ICsrX3gyKSB7XG4gICAgICAgICAgICB2YXIgYWRkciA9IHRvW194Ml0uc3BsaXQoXCJAXCIpO1xuICAgICAgICAgICAgYWRkclswXSA9IHVuZXNjYXBlQ29tcG9uZW50KGFkZHJbMF0pO1xuICAgICAgICAgICAgaWYgKCFvcHRpb25zLnVuaWNvZGVTdXBwb3J0KSB7XG4gICAgICAgICAgICAgICAgLy9jb252ZXJ0IFVuaWNvZGUgSUROIC0+IEFTQ0lJIElETlxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGFkZHJbMV0gPSBwdW55Y29kZS50b0FTQ0lJKHVuZXNjYXBlQ29tcG9uZW50KGFkZHJbMV0sIG9wdGlvbnMpLnRvTG93ZXJDYXNlKCkpO1xuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgY29tcG9uZW50cy5lcnJvciA9IGNvbXBvbmVudHMuZXJyb3IgfHwgXCJFbWFpbCBhZGRyZXNzJ3MgZG9tYWluIG5hbWUgY2FuIG5vdCBiZSBjb252ZXJ0ZWQgdG8gQVNDSUkgdmlhIHB1bnljb2RlOiBcIiArIGU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBhZGRyWzFdID0gdW5lc2NhcGVDb21wb25lbnQoYWRkclsxXSwgb3B0aW9ucykudG9Mb3dlckNhc2UoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRvW194Ml0gPSBhZGRyLmpvaW4oXCJAXCIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBjb21wb25lbnRzO1xuICAgIH0sXG4gICAgc2VyaWFsaXplOiBmdW5jdGlvbiBzZXJpYWxpemUkJDEoY29tcG9uZW50cywgb3B0aW9ucykge1xuICAgICAgICB2YXIgdG8gPSB0b0FycmF5KGNvbXBvbmVudHMudG8pO1xuICAgICAgICBpZiAodG8pIHtcbiAgICAgICAgICAgIGZvciAodmFyIHggPSAwLCB4bCA9IHRvLmxlbmd0aDsgeCA8IHhsOyArK3gpIHtcbiAgICAgICAgICAgICAgICB2YXIgdG9BZGRyID0gU3RyaW5nKHRvW3hdKTtcbiAgICAgICAgICAgICAgICB2YXIgYXRJZHggPSB0b0FkZHIubGFzdEluZGV4T2YoXCJAXCIpO1xuICAgICAgICAgICAgICAgIHZhciBsb2NhbFBhcnQgPSB0b0FkZHIuc2xpY2UoMCwgYXRJZHgpLnJlcGxhY2UoUENUX0VOQ09ERUQsIGRlY29kZVVucmVzZXJ2ZWQpLnJlcGxhY2UoUENUX0VOQ09ERUQsIHRvVXBwZXJDYXNlKS5yZXBsYWNlKE5PVF9MT0NBTF9QQVJULCBwY3RFbmNDaGFyKTtcbiAgICAgICAgICAgICAgICB2YXIgZG9tYWluID0gdG9BZGRyLnNsaWNlKGF0SWR4ICsgMSk7XG4gICAgICAgICAgICAgICAgLy9jb252ZXJ0IElETiB2aWEgcHVueWNvZGVcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBkb21haW4gPSAhb3B0aW9ucy5pcmkgPyBwdW55Y29kZS50b0FTQ0lJKHVuZXNjYXBlQ29tcG9uZW50KGRvbWFpbiwgb3B0aW9ucykudG9Mb3dlckNhc2UoKSkgOiBwdW55Y29kZS50b1VuaWNvZGUoZG9tYWluKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuZXJyb3IgPSBjb21wb25lbnRzLmVycm9yIHx8IFwiRW1haWwgYWRkcmVzcydzIGRvbWFpbiBuYW1lIGNhbiBub3QgYmUgY29udmVydGVkIHRvIFwiICsgKCFvcHRpb25zLmlyaSA/IFwiQVNDSUlcIiA6IFwiVW5pY29kZVwiKSArIFwiIHZpYSBwdW55Y29kZTogXCIgKyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0b1t4XSA9IGxvY2FsUGFydCArIFwiQFwiICsgZG9tYWluO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29tcG9uZW50cy5wYXRoID0gdG8uam9pbihcIixcIik7XG4gICAgICAgIH1cbiAgICAgICAgdmFyIGhlYWRlcnMgPSBjb21wb25lbnRzLmhlYWRlcnMgPSBjb21wb25lbnRzLmhlYWRlcnMgfHwge307XG4gICAgICAgIGlmIChjb21wb25lbnRzLnN1YmplY3QpIGhlYWRlcnNbXCJzdWJqZWN0XCJdID0gY29tcG9uZW50cy5zdWJqZWN0O1xuICAgICAgICBpZiAoY29tcG9uZW50cy5ib2R5KSBoZWFkZXJzW1wiYm9keVwiXSA9IGNvbXBvbmVudHMuYm9keTtcbiAgICAgICAgdmFyIGZpZWxkcyA9IFtdO1xuICAgICAgICBmb3IgKHZhciBuYW1lIGluIGhlYWRlcnMpIHtcbiAgICAgICAgICAgIGlmIChoZWFkZXJzW25hbWVdICE9PSBPW25hbWVdKSB7XG4gICAgICAgICAgICAgICAgZmllbGRzLnB1c2gobmFtZS5yZXBsYWNlKFBDVF9FTkNPREVELCBkZWNvZGVVbnJlc2VydmVkKS5yZXBsYWNlKFBDVF9FTkNPREVELCB0b1VwcGVyQ2FzZSkucmVwbGFjZShOT1RfSEZOQU1FLCBwY3RFbmNDaGFyKSArIFwiPVwiICsgaGVhZGVyc1tuYW1lXS5yZXBsYWNlKFBDVF9FTkNPREVELCBkZWNvZGVVbnJlc2VydmVkKS5yZXBsYWNlKFBDVF9FTkNPREVELCB0b1VwcGVyQ2FzZSkucmVwbGFjZShOT1RfSEZWQUxVRSwgcGN0RW5jQ2hhcikpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChmaWV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bGVyKSB7XG4gICAgICAgICAgICAgICAgLy9jcmVhdGUgZmFrZSBzY2hlbWUgaGFuZGxlclxuICAgICAgICAgICAgICAgIHNjaGVtZUhhbmRsZXIgPSBTQ0hFTUVTW3NjaGVtZV0gPSB7XG4gICAgICAgICAgICAgICAgICAgIHNjaGVtZTogc2NoZW1lLFxuICAgICAgICAgICAgICAgICAgICBwYXJzZTogZnVuY3Rpb24gcGFyc2UkJDEoY29tcG9uZW50cywgb3B0aW9ucykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbXBvbmVudHM7XG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIHNlcmlhbGl6ZTogU0NIRU1FU1tcInVyblwiXS5zZXJpYWxpemVcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29tcG9uZW50cy5zY2hlbWUgPSBzY2hlbWU7XG4gICAgICAgICAgICBjb21wb25lbnRzLnBhdGggPSBtYXRjaGVzWzJdO1xuICAgICAgICAgICAgY29tcG9uZW50cyA9IHNjaGVtZUhhbmRsZXIucGFyc2UoY29tcG9uZW50cywgb3B0aW9ucyk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb21wb25lbnRzLmVycm9yID0gY29tcG9uZW50cy5lcnJvciB8fCBcIlVSTiBjYW4gbm90IGJlIHBhcnNlZC5cIjtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29tcG9uZW50cztcbiAgICB9LFxuICAgIHNlcmlhbGl6ZTogZnVuY3Rpb24gc2VyaWFsaXplJCQxKGNvbXBvbmVudHMsIG9wdGlvbnMpIHtcbiAgICAgICAgdmFyIHNjaGVtZSA9IGNvbXBvbmVudHMuc2NoZW1lIHx8IG9wdGlvbnMuc2NoZW1lO1xuICAgICAgICBpZiAoc2NoZW1lICYmIHNjaGVtZSAhPT0gXCJ1cm5cIikge1xuICAgICAgICAgICAgdmFyIG1hdGNoZXMgP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PSAwLCBrID0gcGFydC5sZW5ndGg7IGogPCBrOyBqKyspIHtcbiAgICAgICAgICAgIGlmIChwYXJ0LmNoYXJDb2RlQXQoaikgPiAxMjcpIHtcbiAgICAgICAgICAgICAgLy8gd2UgcmVwbGFjZSBub24tQVNDSUkgY2hhciB3aXRoIGEgdGVtcG9yYXJ5IHBsYWNlaG9sZGVyXG4gICAgICAgICAgICAgIC8vIHdlIG5lZWQgdGhpcyB0byBtYWtlIHN1cmUgc2l6ZSBvZiBob3N0bmFtZSBpcyBub3RcbiAgICAgICAgICAgICAgLy8gYnJva2VuIGJ5IHJlcGxhY2luZyBub24tQVNDSUkgYnkgbm90aGluZ1xuICAgICAgICAgICAgICBuZXdwYXJ0ICs9ICd4JztcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIG5ld3BhcnQgKz0gcGFydFtqXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gd2UgdGVzdCBhZ2FpbiB3aXRoIEFTQ0lJIGNoYXIgb25seVxuICAgICAgICAgIGlmICghbmV3cGFydC5tYXRjaChob3N0bmFtZVBhcnRQYXR0ZXJuKSkge1xuICAgICAgICAgICAgdmFyIHZhbGlkUGFydHMgPSBob3N0cGFydHMuc2xpY2UoMCwgaSk7XG4gICAgICAgICAgICB2YXIgbm90SG9zdCA9IGhvc3RwYXJ0cy5zbGljZShpICsgMSk7XG4gICAgICAgICAgICB2YXIgYml0ID0gcGFydC5tYXRjaChob3N0bmFtZVBhcnRTdGFydCk7XG4gICAgICAgICAgICBpZiAoYml0KSB7XG4gICAgICAgICAgICAgIHZhbGlkUGFydHMucHVzaChiaXRbMV0pO1xuICAgICAgICAgICAgICBub3RIb3N0LnVuc2hpZnQoYml0WzJdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChub3RIb3N0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICByZXN0ID0gJy8nICsgbm90SG9zdC5qb2luKCcuJ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aG90bWFpbC5odScsICdob3RtYWlsLmlkJywgJ2hvdG1haWwuaWUnLCAnaG90bWFpbC5pbicsICdob3RtYWlsLml0JywgJ2hvdG1haWwuanAnLCAnaG90bWFpbC5rcicsICdob3RtYWlsLmx2JywgJ2hvdG1haWwubXknLCAnaG90bWFpbC5waCcsICdob3RtYWlsLnB0JywgJ2hvdG1haWwuc2EnLCAnaG90bWFpbC5zZycsICdob3RtYWlsLnNrJywgJ2xpdmUuYmUnLCAnbGl2ZS5jby51aycsICdsaXZlLmNvbScsICdsaXZlLmNvbS5hcicsICdsaXZlLmNvbS5teCcsICdsaXZlLmRlJywgJ2xpdmUuZXMnLCAnbGl2ZS5ldScsICdsaXZlLmZyJywgJ2xpdmUuaXQnLCAnbGl2ZS5ubCcsICdtc24uY29tJywgJ291dGxvb2suYXQnLCAnb3V0bG9vay5iZScsICdvdXRsb29rLmNsJywgJ291dGxvb2suY28uaWwnLCAnb3V0bG9vay5jby5ueicsICdvdXRsb29rLmNvLnRoJywgJ291dGxvb2suY29tJywgJ291dGxvb2suY29tLmFyJywgJ291dGxvb2suY29tLmF1JywgJ291dGxvb2suY29tLmJyJywgJ291dGxvb2suY29tLmdyJywgJ291dGxvb2suY29tLnBlJywgJ291dGxvb2suY29tLnRyJywgJ291dGxvb2suY29tLnZuJywgJ291dGxvb2suY3onLCAnb3V0bG9vay5kZScsICdvdXRsb29rLmRrJywgJ291dGxvb2suZXMnLCAnb3V0bG9vay5mcicsICdvdXRsb29rLmh1JywgJ291dGxvb2suaWQnLCAnb3V0bG9vay5pZScsICdvdXRsb29rLmluJywgJ291dGxvb2suaXQnLCAnb3V0bG9vay5qcCcsICdvdXRsb29rLmtyJywgJ291dGxvb2subHYnLCAnb3V0bG9vay5teScsICdvdXRsb29rLnBoJywgJ291dGxvb2sucHQnLCAnb3V0bG9vay5zYScsICdvdXRsb29rLnNnJywgJ291dGxvb2suc2snLCAncGFzc3BvcnQuY29tJ107XG5cbi8vIExpc3Qgb2YgZG9tY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1hcyBmcm9tICdvbmVPZidcIixcbiAgICBPTkVfT0ZfTVVMVElQTEU6ICAgICAgICAgICAgICAgICAgICAgICAgXCJEYXRhIGlzIHZhbGlkIGFnYWluc3QgbW9yZSB0aGFuIG9uZSBzY2hlbWEgZnJvbSAnb25lT2YnXCIsXG4gICAgTk9UX1BBU1NFRDogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiRGF0YSBtYXRjaGVzIHNjaGVtYSBmcm9tICdub3QnXCIsXG5cbiAgICAvLyBBcnJheSBlcnJvcnNcbiAgICBBUlJBWV9MRU5HVEhfU0hPUlQ6ICAgICAgICAgICAgICAgICAgICAgXCJBcnJheSBpcyB0b28gc2hvcnQgKHswfSksIG1pbmltdW0gezF9XCIsXG4gICAgQVJSQVlfTEVOR1RIX0xPTkc6ICAgICAgICAgICAgICAgICAgICAgIFwiQXJyYXkgaXMgdG9vIGxvbmcgKHswfSksIG1heGltdW0gezF9XCIsXG4gICAgQVJSQVlfVU5JUVVFOiAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiQXJyYXkgaXRlbXMgYXJlIG5vdCB1bmlxdWUgKGluZGV4ZXMgezB9IGFuZCB7MX0pXCIsXG4gICAgQVJSQVlfQURESVRJT05BTF9JVEVNUzogICAgICAgICAgICAgICAgIFwiQWRkaXRpb25hbCBpdGVtcyBub3QgYWxsb3dlZFwiLFxuXG4gICAgLy8gTnVtZXJpYyBlcnJvcnNcbiAgICBNVUxUSVBMRV9PRjogICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJWYWx1ZSB7MH0gaXMgbm90IGEgbXVsdGlwbGUgb2YgezF9XCIsXG4gICAgTUlOSU1VTTogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiVmFsdWUgezB9IGlzIGxlc3MgdGhhbiBtaW5pbXVtIHsxfVwiLFxuICAgIE1JTklNVU1fRVhDTFVTSVZFOiAgICAgICAgICAgICAgICAgICAgICBcIlZhbHVlIHswfSBpcyBlcXVhbCBvciBsZXNzI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AgICBNQVhfTEVOR1RIOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJTdHJpbmcgaXMgdG9vIGxvbmcgKHswfSBjaGFycyksIG1heGltdW0gezF9XCIsXG4gICAgUEFUVEVSTjogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiU3RyaW5nIGRvZXMgbm90IG1hdGNoIHBhdHRlcm4gezB9OiB7MX1cIixcblxuICAgIC8vIFNjaGVtYSB2YWxpZGF0aW9uIGVycm9yc1xuICAgIEtFWVdPUkRfVFlQRV9FWFBFQ1RFRDogICAgICAgICAgICAgICAgICBcIktleXdvcmQgJ3swfScgaXMgZXhwZWN0ZWQgdG8gYmUgb2YgdHlwZSAnezF9J1wiLFxuICAgIEtFWVdPUkRfVU5ERUZJTkVEX1NUUklDVDogICAgICAgICAgICAgICBcIktleXdvcmQgJ3swfScgbXVzdCBiZSBkZWZpbmVkIGluIHN0cmljdCBtb2RlXCIsXG4gICAgS0VZV09SRF9VTkVYUEVDVEVEOiAgICAgICAgICAgICAgICAgICAgIFwiS2V5d29yZCAnezB9JyBpcyBub3QgZXhwZWN0ZWQgdG8gYXBwZWFyIGluIHRoZSBzY2hlbWFcIixcbiAgICBLRVlXT1JEX01VU1RfQkU6ICAgICAgICAgICAgICAgICAgICAgICAgXCJLZXl3b3JkICd7MH0nIG11c3QgYmUgezF9XCIsXG4gICAgS0VZV09SRF9ERVBFTkRFTkNZOiAgICAgICAgICAgICAgICAgICAgIFwiS2V5d29yZCAnezB9JyByZXF1aXJlcyBrZXl3b3JkICd7MX0nXCIsXG4gICAgS0VZV09SRF9QQVRURVJOOiAgICAgICAgICAgICAgICAgICAgICAgIFwiS2V5d29yZCAnezB9JyBpcyBub3QgYSB2YWxpZCBSZWdFeHAgcGF0dGVybjogezF9XCIsXG4gICAgS0VZV09SRF9WQUxVRV9UWVBFOiAgICAgICAgICAgICAgICAgICAgIFwiRWFjaCBlbGVtZW50IG9mIGtleXdvcmQgJ3swfScgYXJyYXkgbX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YXRpb24uaHRtbCNyZmMuc2VjdGlvbi41LjEuMi4yXG4gICAgICAgIGlmICh0eXBlb2YganNvbiAhPT0gXCJudW1iZXJcIikge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChzY2hlbWEuZXhjbHVzaXZlTWF4aW11bSAhPT0gdHJ1ZSkge1xuICAgICAgICAgICAgaWYgKGpzb24gPiBzY2hlbWEubWF4aW11bSkge1xuICAgICAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIk1BWElNVU1cIiwgW2pzb24sIHNjaGVtYS5tYXhpbXVtXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChqc29uID49IHNjaGVtYS5tYXhpbXVtKSB7XG4gICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiTUFYSU1VTV9FWENMVVNJVkVcIiwgW2pzb24sIHNjaGVtYS5tYXhpbXVtXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgZXhjbHVzaXZlTWF4aW11bTogZnVuY3Rpb24gKCkge1xuICAgICAgICAvLyBjb3ZlcmVkIGluIG1heGltdW1cbiAgICB9LFxuICAgIG1pbmltdW06IGZ1bmN0aW9uIChyZXBvcnQsIHNjaGVtYSwganNvbikge1xuICAgICAgICAvLyBodHRwOi8vanNvbi1zY2hlbWEub3JnL2xhdGVzdC9qc29uLXNjaGVtYS12YWxpZGF0aW9uLmh0bWwjcmZjLnNlY3Rpb24uNS4xLjMuMlxuICAgICAgICBpZiAodHlwZW9mIGpzb24gIT09IFwibnVtYmVyXCIpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoc2NoZW1hLmV4Y2x1c2l2ZU1pbmltdW0gIT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChqc29uIDwgc2NoZW1hLm1pbmltdW0pIHtcbiAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJNSU5JTVVNXCIsIFtqc29uLCBzY2hlbWEubWluaW11bV0sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoanNvbiA8PSBzY2hlbWEubWluaW11bSkge1xuICAgICAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIk1JTklNVU1fRVhDTFVTSVZFXCIsIFtqc29uLCBzY2hlbWEubWluaW11bV0sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGV4Y2x1c2l2ZU1pbmltdW06IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgLy8gY292ZXJlZCBpbiBtaW5pbXVtXG4gICAgfSxcbiAgICBtYXhMZW5ndGg6IGZ1bmN0aW9uIChyZXBvcnQsIHNjaGVtYSwganNvbikge1xuICAgICAgICAvLyBodHRwOi8vanNvbi1zY2hlbWEub3JnL2xhdGVzdC9qc29uLXNjaGVtYS12YWxpZGF0aW9uLmh0bWwjcmZjLnNlY3Rpb24uNS4yLjEuMlxuICAgICAgICBpZiAodHlwZW9mIGpzb24gIT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAoVXRpbHMudWNzMmRlY29kZShqc29uKS5sZW5ndGggPiBzY2hlbWEubWF4TGVuZ3RoKSB7XG4gICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJNQVhfTEVOR1RIXCIsIFtqc29uLmxlbmd0aCwgc2NoZW1hLm1heExlbmd0aF0sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgIH1cbiAgICB9LFxuICAgIG1pbkxl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dGNoZXMuXG4gICAgICAgICAgICB2YXIgaWR4ID0gcHAubGVuZ3RoO1xuICAgICAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICAgICAgdmFyIHJlZ0V4cCA9IFJlZ0V4cChwcFtpZHhdKSxcbiAgICAgICAgICAgICAgICAgICAgaWR4MiA9IHMubGVuZ3RoO1xuICAgICAgICAgICAgICAgIHdoaWxlIChpZHgyLS0pIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlZ0V4cC50ZXN0KHNbaWR4Ml0pID09PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzLnNwbGljZShpZHgyLCAxKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIFZhbGlkYXRpb24gb2YgdGhlIGpzb24gc3VjY2VlZHMgaWYsIGFmdGVyIHRoZXNlIHR3byBzdGVwcywgc2V0IFwic1wiIGlzIGVtcHR5LlxuICAgICAgICAgICAgaWYgKHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIC8vIGFzc3VtZUFkZGl0aW9uYWwgY2FuIGJlIGFuIGFycmF5IG9mIGFsbG93ZWQgcHJvcGVydGllc1xuICAgICAgICAgICAgICAgIHZhciBpZHgzID0gdGhpcy5vcHRpb25zLmFzc3VtZUFkZGl0aW9uYWwubGVuZ3RoO1xuICAgICAgICAgICAgICAgIGlmIChpZHgzKSB7XG4gICAgICAgICAgICAgICAgICAgIHdoaWxlIChpZHgzLS0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpbyA9IHMuaW5kZXhPZih0aGlzLm9wdGlvbnMuYXNzdW1lQWRkaXRpb25hbFtpZHgzXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW8gIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5zcGxpY2UoaW8sIDEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiT0JKRUNUX0FERElUSU9OQUxfUFJPUEVSVElFU1wiLCBbc10sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcbiAgICBkZXBlbmRlbmNpZXM6IGZ1bmN0aW9uIChyZXBvcnQsIHNjaGVtYSwganNvbikge1xuICAgICAgICAvLyBodHRwOi8vanNvbi1zY2hlbWEub3JnL2xhdGVzdC9qc29uLXNjaGVtYS12YWxpZGF0aW9uLmh0bWwjcmZjLnNlY3Rpb24uNS40LjUuMlxuICAgICAgICBpZiAoVXRpbHMud2hhdElzKGpzb24pICE9PSBcIm9iamVjdFwiKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICB2YXIga2V5cyA9IE9iamVjdC5rZXlzKHNjaGVtYS5kZXBlbmRlbmNpZXMpLFxuICAgICAgICAgICAgaWR4ID0ga2V5cy5sZW5ndGg7XG5cbiAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICAvLyBpdGVyYXRlIGFsbCBkZXBlbmRlbmNpZXNcbiAgICAgICAgICAgIHZhciBkZXBlbmRlbmN5TmFtZSA9IGtleXNbaWR4XTtcbiAgICAgICAgICAgIGlmIChqc29uW2RlcGVuZGVuY3lOYW1lXSkge1xuICAgICAgICAgICAgICAgIHZhciBkZXBlbmRlbmN5RGVmaW5pdGlvbiA9IHNjaGVtYS5kZXBlbmRlbmNpZXNbZGVwZW5kZW5jeU5hbWVdO1xuICAgICAgICAgICAgICAgIGlmIChVdGlscy53aGF0SXMoZGVwZW5kZW5jeURlZmluaXRpb24pID09PSBcIm9iamVjdFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGlmIGRlcGVuZGVuY3kgaXMgYSBzY2hlbWEsIHZhbGlkYXRlIGFnYWluc3QgdGhpcyBzY2hlbWFcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy52YWxpZGF0ZS5jYWxsKHRoaXMsIHJlcG9ydCwgZGVwZW5kZW5jeURlZmluaXRpb24sIGpzb24pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7IC8vIEFycmF5XG4gICAgICAgICAgICAgICAgICAgIC8vIGlmIGRlcGVuZGVuY3kgaXMgYW4gYXJyYXksIG9iamVjdCBuZWVkcyB0byBoYXZlIGFsbCBwcm9wZXJ0aWVzIGluIHRoaXMgYXJyYXlcbiAgICAgICAgICAgICAgICAgICAgdmFyIGlkeDIgPSBkZXBlbmRlbmN5RGVmaW5pdGlvbi5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgIHdoaWxlIChpZHgyLS0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZXF1aXJlZFByb3BlcnR5TmFtZSA9IGRlcGVuZGVuY3lEZWZpbml0aW9uW2lkeDJdO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGpzb25bcmVxdWlyZWRQcm9wZXJ0eU5hbWVdID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJPQkpFQ1RfREVQRU5ERU5DWV9LRVlcIiwgW3JlcXVpcmVkUHJvcGVydHlOYW1lLCBkZXBlbmRlbmN5TmFtZV0sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGVudW06IGZ1bmN0aW9uIChyZXBvcnQsIHNjaGVtYSwganNvbikge1xu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ICAgICAgaWYgKGpzb25UeXBlICE9PSBzY2hlbWEudHlwZSAmJiAoanNvblR5cGUgIT09IFwiaW50ZWdlclwiIHx8IHNjaGVtYS50eXBlICE9PSBcIm51bWJlclwiKSkge1xuICAgICAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIklOVkFMSURfVFlQRVwiLCBbc2NoZW1hLnR5cGUsIGpzb25UeXBlXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLmJyZWFrT25GaXJzdEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUuaW5kZXhPZihqc29uVHlwZSkgPT09IC0xICYmIChqc29uVHlwZSAhPT0gXCJpbnRlZ2VyXCIgfHwgc2NoZW1hLnR5cGUuaW5kZXhPZihcIm51bWJlclwiKSA9PT0gLTEpKSB7XG4gICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiSU5WQUxJRF9UWVBFXCIsIFtzY2hlbWEudHlwZSwganNvblR5cGVdLCBudWxsLCBzY2hlbWEuZGVzY3JpcHRpb24pO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMuYnJlYWtPbkZpcnN0RXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8vIG5vdyBpdGVyYXRlIGFsbCB0aGUga2V5cyBpbiBzY2hlbWEgYW5kIGV4ZWN1dGUgdmFsaWRhdGlvbiBtZXRob2RzXG4gICAgdmFyIGlkeCA9IGtleXMubGVuZ3RoO1xuICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAg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2Nlc3NBc3luY1Rhc2tzID0gZnVuY3Rpb24gKHRpbWVvdXQsIGNhbGxiYWNrKSB7XG5cbiAgICB2YXIgdmFsaWRhdGlvblRpbWVvdXQgPSB0aW1lb3V0IHx8IDIwMDAsXG4gICAgICAgIHRhc2tzQ291bnQgICAgICAgID0gdGhpcy5hc3luY1Rhc2tzLmxlbmd0aCxcbiAgICAgICAgaWR4ICAgICAgICAgICAgICAgPSB0YXNrc0NvdW50LFxuICAgICAgICB0aW1lZE91dCAgICAgICAgICA9IGZhbHNlLFxuICAgICAgICBzZWxmICAgICAgICAgICAgICA9IHRoaXM7XG5cbiAgICBmdW5jdGlvbiBmaW5pc2goKSB7XG4gICAgICAgIHByb2Nlc3MubmV4dFRpY2soZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIHZhbGlkID0gc2VsZi5lcnJvcnMubGVuZ3RoID09PSAwLFxuICAgICAgICAgICAgICAgIGVyciAgID0gdmFsaWQgPyB1bmRlZmluZWQgOiBzZWxmLmVycm9ycztcbiAgICAgICAgICAgIGNhbGxiYWNrKGVyciwgdmFsaWQpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiByZXNwb25kKGFzeW5jVGFza1Jlc3VsdFByb2Nlc3NGbikge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGFzeW5jVGFza1Jlc3VsdCkge1xuICAgICAgICAgICAgaWYgKHRpbWVkT3V0KSB7IHJldHVybjsgfVxuICAgICAgICAgICAgYXN5bmNUYXNrUmVzdWx0UHJvY2Vzc0ZuKGFzeW5jVGFza1Jlc3VsdCk7XG4gICAgICAgICAgICBpZiAoLS10YXNrc0NvdW50ID09PSAwKSB7XG4gICAgICAgICAgICAgICAgZmluaXNoKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgaWYgKHRhc2tzQ291bnQgPT09IDAgfHwgdGhpcy5lcnJvcnMubGVuZ3RoID4gMCkge1xuICAgICAgIC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gaWQpIHtcbiAgICAvLyBwcm9jZXNzIG9ubHkgYXJyYXlzIGFuZCBvYmplY3RzXG4gICAgaWYgKHR5cGVvZiBzY2hlbWEgIT09IFwib2JqZWN0XCIgfHwgc2NoZW1hID09PSBudWxsKSB7XG4gICAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICAvLyBubyBpZCBtZWFucyByb290IHNvIHJldHVybiBpdHNlbGZcbiAgICBpZiAoIWlkKSB7XG4gICAgICAgIHJldHVybiBzY2hlbWE7XG4gICAgfVxuXG4gICAgaWYgKHNjaGVtYS5pZCkge1xuICAgICAgICBpZiAoc2NoZW1hLmlkID09PSBpZCB8fCBzY2hlbWEuaWRbMF0gPT09IFwiI1wiICYmIHNjaGVtYS5pZC5zdWJzdHJpbmcoMSkgPT09IGlkKSB7XG4gICAgICAgICAgICByZXR1cm4gc2NoZW1hO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgdmFyIGlkeCwgcmVzdWx0O1xuICAgIGlmIChBcnJheS5pc0FycmF5KHNjaGVtYSkpIHtcbiAgICAgICAgaWR4ID0gc2NoZW1hLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmaW5kSWQoc2NoZW1hW2lkeF0sIGlkKTtcbiAgICAgICAgICAgIGlmIChyZXN1bHQpIHsgcmV0dXJuIHJlc3VsdDsgfVxuICAgICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdmFyIGtleXMgPSBPYmplY3Qua2V5cyhzY2hlbWEpO1xuICAgICAgICBpZHggPSBrZXlzLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICB2YXIgayA9IGtleXNbaWR4XTtcbiAgICAgICAgICAgIGlmIChrLmluZGV4T2YoXCJfXyRcIikgPT09IDApIHtcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc3VsdCA9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bnkgd2VyZSBjb21waWxlZCBpbiB0aGUgbGFzdCBsb29wXG4gICAgICAgIGxhc3RMb29wQ29tcGlsZWQgPSBjb21waWxlZDtcblxuICAgICAgICAvLyBjb3VudCBob3cgbWFueSBhcmUgY29tcGlsZWQgbm93XG4gICAgICAgIGNvbXBpbGVkID0gY29tcGlsZUFycmF5T2ZTY2hlbWFzTG9vcC5jYWxsKHRoaXMsIHJlcG9ydCwgYXJyKTtcblxuICAgICAgICAvLyBmaXggX18kbWlzc2luZ1JlZmVyZW5jZXMgaWYgcG9zc2libGVcbiAgICAgICAgaWR4ID0gYXJyLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICB2YXIgc2NoID0gYXJyW2lkeF07XG4gICAgICAgICAgICBpZiAoc2NoLl9fJG1pc3NpbmdSZWZlcmVuY2VzKSB7XG4gICAgICAgICAgICAgICAgdmFyIGlkeDIgPSBzY2guX18kbWlzc2luZ1JlZmVyZW5jZXMubGVuZ3RoO1xuICAgICAgICAgICAgICAgIHdoaWxlIChpZHgyLS0pIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlZk9iaiA9IHNjaC5fXyRtaXNzaW5nUmVmZXJlbmNlc1tpZHgyXTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlID0gZmluZElkKGFyciwgcmVmT2JqLnJlZik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBtaWdodCBjcmVhdGUgY2lyY3VsYXIgcmVmZXJlbmNlc1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVmT2JqLm9ialtcIl9fXCIgKyByZWZPYmoua2V5ICsgXCJSZXNvbHZlZFwiXSA9IHJlc3BvbnNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXQncyByZXNvbHZlZCBub3cgc28gZGVsZXRlIGl0XG4gICAgICAgICAgICAgICAgICAg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LyB3ZSBjYW4gdHJ5IHRvIHVzZSBjdXN0b20gc2NoZW1hUmVhZGVyIGlmIGF2YWlsYWJsZVxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG4gICAgICAgICAgICB2YXIgc2NoZW1hUmVhZGVyID0gdGhpcy5nZXRTY2hlbWFSZWFkZXIoKTtcbiAgICAgICAgICAgIGlmIChzY2hlbWFSZWFkZXIpIHtcbiAgICAgICAgICAgICAgICAvLyBpdCdzIHN1cHBvc2VkIHRvIHJldHVybiBhIHZhbGlkIHNjaGVtYVxuICAgICAgICAgICAgICAgIHZhciBzID0gc2NoZW1hUmVhZGVyKHJlZk9iai5yZWYpO1xuICAgICAgICAgICAgICAgIGlmIChzKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIGl0IG5lZWRzIHRvIGhhdmUgdGhlIGlkXG4gICAgICAgICAgICAgICAgICAgIHMuaWQgPSByZWZPYmoucmVmO1xuICAgICAgICAgICAgICAgICAgICAvLyB0cnkgdG8gY29tcGlsZSB0aGUgc2NoZW1hXG4gICAgICAgICAgICAgICAgICAgIHZhciBzdWJyZXBvcnQgPSBuZXcgUmVwb3J0KHJlcG9ydCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICghZXhwb3J0cy5jb21waWxlU2NoZW1hLmNhbGwodGhpcywgc3VicmVwb3J0LCBzKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29weSBlcnJvcnMgdG8gcmVwb3J0XG4gICAgICAgICAgICAgICAgICAgICAgICByZXBvcnQuZXJyb3JzID0gcmVwb3J0LmVycm9ycy5jb25jYXQoc3VicmVwb3J0LmVycm9ycyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZSA9IFNjaGVtYUNhY2hlLmdldFNjaGVtYUJ5VXJpLmNhbGwodGhpcywgcmVwb3J0LCByZWZPYmoucmVmLCBzY2hlbWEpO1xuICAgICAgICAgICAgICAgICAgICB9XG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GUgKGlkeC0tKSB7XG4gICAgICAgICAgICAgICAgdmFyIHNjaGVtYUtleSA9IGtleXNbaWR4XSxcbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hRGVwZW5kZW5jeSA9IHNjaGVtYS5kZXBlbmRlbmNpZXNbc2NoZW1hS2V5XSxcbiAgICAgICAgICAgICAgICAgICAgdHlwZSA9IFV0aWxzLndoYXRJcyhzY2hlbWFEZXBlbmRlbmN5KTtcblxuICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSBcIm9iamVjdFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydC5wYXRoLnB1c2goXCJkZXBlbmRlbmNpZXNcIik7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydC5wYXRoLnB1c2goc2NoZW1hS2V5KTtcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy52YWxpZGF0ZVNjaGVtYS5jYWxsKHRoaXMsIHJlcG9ydCwgc2NoZW1hRGVwZW5kZW5jeSk7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydC5wYXRoLnBvcCgpO1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IFwiYXJyYXlcIikge1xuICAgICAgICAgICAgICAgICAgICB2YXIgaWR4MiA9IHNjaGVtYURlcGVuZGVuY3kubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICBpZiAoaWR4MiA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9NVVNUX0JFXCIsIFtcImRlcGVuZGVuY2llc1wiLCBcIm5vdCBlbXB0eSBhcnJheVwiXSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGlkeDItLSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBzY2hlbWFEZXBlbm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gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1pbkxlbmd0aCA9PT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5lbnVtID09PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hLmZvcm1hdCA9PT0gdW5kZWZpbmVkKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hLm1pbkxlbmd0aCA9IDE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9wdGlvbnMubm9FbXB0eUFycmF5cyA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgaWYgKHNjaGVtYS50eXBlID09PSBcImFycmF5XCIgfHwgaXNBcnJheSAmJiBzY2hlbWEudHlwZS5pbmRleE9mKFwiYXJyYXlcIikgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgaWYgKHNjaGVtYS5taW5JdGVtcyA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5taW5JdGVtcyA9IDE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9wdGlvbnMuZm9yY2VQcm9wZXJ0aWVzID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwib2JqZWN0XCIgfHwgaXNBcnJheSAmJiBzY2hlbWEudHlwZS5pbmRleE9mKFwib2JqZWN0XCIpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIGlmIChzY2hlbWEucHJvcGVydGllcyA9PT0gdW5kZWZpbmVkICYmIHNjaGVtYS5wYXR0ZXJuUHJvcGVydGllcyA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIktFWVdPUkRfVU5ERUZJTkVEX1NUUklDVFwiLCBbXCJwcm9wZXJ0aWVzXCJdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZUl0ZW1zID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwiYXJyYXlcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJhcnJheVwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLml0ZW1zID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcIml0ZW1zXCJdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZU1pbkl0ZW1zID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwiYXJyYXlcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJhcnJheVwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1pbkl0ZW1zID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcIm1pbkl0ZW1zXCJdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZU1heEl0ZW1zID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwiYXJyYXlcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJhcnJheVwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1heEl0ZW1zID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcIm1heEl0ZW1zXCJdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZU1pbkxlbmd0aCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgaWYgKHNjaGVtYS50eXBlID09PSBcInN0cmluZ1wiIHx8IGlzQXJyYXkgJiYgc2NoZW1hLnR5cGUuaW5kZXhPZihcInN0cmluZ1wiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1pbkxlbmd0aCA9PT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5mb3JtYXQgPT09IHVuZGVmaW5lZCAmJlxuICAgICAgICAgICAgICAgICAgICBzY2hlbWEuZW51bSA9PT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5wYXR0ZXJuID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcIm1pbkxlbmd0aFwiXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0aGlzLm9wdGlvbnMuZm9yY2VNYXhMZW5ndGggPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZSA9PT0gXCJzdHJpbmdcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJzdHJpbmdcIikgIT09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VudW0pIHtcbiAgICAgICAgICAgIC8vIGJyZWFrIHJlY3Vyc2lvblxuICAgICAgICAgICAgdmFyIHRtcFNjaGVtYSA9IFV0aWxzLmNsb25lKHNjaGVtYSk7XG4gICAgICAgICAgICBkZWxldGUgdG1wU2NoZW1hLmVudW07XG4gICAgICAgICAgICBkZWxldGUgdG1wU2NoZW1hLmRlZmF1bHQ7XG5cbiAgICAgICAgICAgIHJlcG9ydC5wYXRoLnB1c2goXCJlbnVtXCIpO1xuICAgICAgICAgICAgaWR4ID0gc2NoZW1hLmVudW0ubGVuZ3RoO1xuICAgICAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucHVzaChpZHgudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICAgICAgSnNvblZhbGlkYXRpb24udmFsaWRhdGUuY2FsbCh0aGlzLCByZXBvcnQsIHRtcFNjaGVtYSwgc2NoZW1hLmVudW1baWR4XSk7XG4gICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucG9wKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChzY2hlbWEuZGVmYXVsdCkge1xuICAgICAgICAgICAgcmVwb3J0LnBhdGgucHVzaChcImRlZmF1bHRcIik7XG4gICAgICAgICAgICBKc29uVmFsaWRhdGlvbi52YWxpZGF0ZS5jYWxsKHRoaXMsIHJlcG9ydCwgc2NoZW1hLCBzY2hlbWEuZGVmYXVsdCk7XG4gICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHZhciBpc1ZhbGlkID0gcmVwb3J0LmlzVmFsaWQoKTtcbiAgICBpZiAoaXNWYWxpZCkge1xuICAgICAgICBzY2hlbWEuX18kdmFsaWRhdGVkID0gdHJ1ZTtcbiAgICB9XG4gICAgcmV0dXJuIGlzVmFsaWQ7XG59O1x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F1YWwoanNvbjFba2V5czFbaV1dLCBqc29uMltrZXlzMVtpXV0pKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cblxuICAgIHJldHVybiBmYWxzZTtcbn07XG5cbmV4cG9ydHMuaXNVbmlxdWVBcnJheSA9IGZ1bmN0aW9uIChhcnIsIGluZGV4ZXMpIHtcbiAgICB2YXIgaSwgaiwgbCA9IGFyci5sZW5ndGg7XG4gICAgZm9yIChpID0gMDsgaSA8IGw7IGkrKykge1xuICAgICAgICBmb3IgKGogPSBpICsgMTsgaiA8IGw7IGorKykge1xuICAgICAgICAgICAgaWYgKGV4cG9ydHMuYXJlRXF1YWwoYXJyW2ldLCBhcnJbal0pKSB7XG4gICAgICAgICAgICAgICAgaWYgKGluZGV4ZXMpIHsgaW5kZXhlcy5wdXNoKGksIGopOyB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiB0cnVlO1xufTtcblxuZXhwb3J0cy5kaWZmZXJlbmNlID0gZnVuY3Rpb24gKGJpZ1NldCwgc3ViU2V0KSB7XG4gICAgdmFyIGFyciA9IFtdLFxuICAgICAgICBpZHggPSBiaWdTZXQubGVuZ3RoO1xuICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICBpZiAoc3ViU2V0LmluZGV4T2YoYmlnU2V0W2lkeF0pID09PSAtMSkge1xuICAgICAgICAgICAgYXJyLnB1c2goYmlnU2V0W2lkeF0pO1xuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiBhcnI7XG59O1xuXG4vLyBOT1QgYSBkZWVwIHZlcnNpb24gb2YgY2xvbmVcbmV4cG9ydHMuY2xvbmUgPSBmdW5jdGlvbiAoc3JjKSB7XG4gICAgaWYgKHR5cGVvZiBzcmMgPT09IFwidW5kZWZpb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5pc0FycmF5KHNyYykpIHtcbiAgICAgICAgICAgIHJlcyA9IFtdO1xuICAgICAgICAgICAgY2xvbmVkLnB1c2gocmVzKTtcbiAgICAgICAgICAgIGlkeCA9IHNyYy5sZW5ndGg7XG4gICAgICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgICAgICByZXNbaWR4XSA9IGNsb25lRGVlcChzcmNbaWR4XSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXMgPSB7fTtcbiAgICAgICAgICAgIGNsb25lZC5wdXNoKHJlcyk7XG4gICAgICAgICAgICB2YXIga2V5cyA9IE9iamVjdC5rZXlzKHNyYyk7XG4gICAgICAgICAgICBpZHggPSBrZXlzLmxlbmd0aDtcbiAgICAgICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBrZXlzW2lkeF07XG4gICAgICAgICAgICAgICAgcmVzW2tleV0gPSBjbG9uZURlZXAoc3JjW2tleV0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiByZXM7XG4gICAgfVxuICAgIHJldHVybiBjbG9uZURlZXAoc3JjKTtcbn07XG5cbi8qXG4gIGZvbGxvd2luZyBmdW5jdGlvbiBjb21lcyBmcm9tIHB1bnljb2RlLmpzIGxpYnJhcnlcbiAgc2VlOiBodHRwczovL2dpdGh1Yi5jb20vYmVzdGllanMvcHVueWNvZGUuanNcbiovXG4vKmpzaGludCAtVzAxNiovXG4vKipcbiAqIENyZWF0ZXMgYW4gYXJyYXkgY29udGFpbmluZyB0aGUgbnVtZXJpYyBjb2RlIHBvaW50cyBvZiBlYWNoIFVuaWNvZGVcbiAqIGNoYXJhY3RlciBpbiB0aGUgc3RyaW5nLiBXaGlsZSBKYXZhU2NyaXB0IHVzZXMgVUNTLTIgaW50ZXJuYWxseSxcbiAqIHRoaXMgZnVuY3Rpb24gd2lsbCBjb252ZXJ0IGEg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BkZWxldGUgc2NoZW1hLl9fJHJlZlJlc29sdmVkO1xuICAgICAgICAgICAgZm9yIChrZXkgaW4gZnJvbSkge1xuICAgICAgICAgICAgICAgIGlmIChmcm9tLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgICAgICAgICAgdG9ba2V5XSA9IGZyb21ba2V5XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChrZXkgaW4gc2NoZW1hKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLmhhc093blByb3BlcnR5KGtleSkpIHtcbiAgICAgICAgICAgICAgICBpZiAoa2V5LmluZGV4T2YoXCJfXyRcIikgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHNjaGVtYVtrZXldO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGNsZWFudXAoc2NoZW1hW2tleV0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH07XG5cbiAgICBjbGVhbnVwKHNjaGVtYSk7XG4gICAgdmlzaXRlZC5mb3JFYWNoKGZ1bmN0aW9uIChzKSB7XG4gICAgICAgIGRlbGV0ZSBzLl9fXyR2aXNpdGVkO1xuICAgIH0pO1xuXG4gICAgdGhpcy5sYXN0UmVwb3J0ID0gcmVwb3J0O1xuICAgIGlmIChyZXBvcnQuaXNWYWxpZCgpKSB7XG4gICAgICAgIHJldHVybiBzY2hlbWE7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgdGhyb3cgdGhpcy5nZXRMYXN0RXJyb3IoKTtcbiAgICB9XG59O1xuWlNjaGVtYS5wcm90b3R5cGUuc2V0U2NoZW1hUmVhZGVyID0gZnVuY3Rpb24gKHNjaGVtYVJlYWRlcikge1xuICAgIHJldHVybiBaU2NoZW1hLnNldFNjaGVtYVJlYWRlcihzY2hlbWFSZWFkZXIpO1xufT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QtMDQvaHlwZXItc2NoZW1hI1wiLFxuICAgIFwidGl0bGVcIjogXCJKU09OIEh5cGVyLVNjaGVtYVwiLFxuICAgIFwiYWxsT2ZcIjogW1xuICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIlxuICAgICAgICB9XG4gICAgXSxcbiAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcImFkZGl0aW9uYWxJdGVtc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlcGVuZGVuY2llc1wiOiB7XG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCJcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiNcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhbnlPZlwiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJvbmVPZlwiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJub3RcIjoge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgIH0sXG5cbiAgICAgICAgXCJsaW5rc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9saW5rRGVzY3JpcHRpb25cIlxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcImZyYWdtZW50UmVzb2x1dGlvblwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1lZGlhXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBtZWRpYSB0eXBlLCBhcyBkZXNjcmliZWQgaW4gUkZDIDIwNDZcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiYmluYXJ5RW5jb2RpbmdcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBjb250ZW50IGVuY29kaW5nIHNjaGVtZSwgYXMgZGVzY3JpYmVkIGluIFJGQyAyMDQ1XCIsXG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcInBhdGhTdGFydFwiOiB7XG4gICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiSW5zdGFuY2VzJyBVUklzIG11c3Qgc3RhcnQgd2l0aCB0aGlzIHZhbHVlIGZvciB0aGlzIHNjaGVtYSB0byBhcHBseSB0byB0aGVtXCIsXG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwic2NoZW1hQXJyYXlcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiNcIlxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcImxpbmtEZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgICBcInRpdGxlXCI6IFwiTGluayBEZXNjcmlwdGlvbiBPYmplY3RcIixcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiaHJlZlwiLCBcInJlbFwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiaHJlZlwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJhIFVSSSB0ZW1wbGF0ZSwgYXMgZGVmaW5lZCBieSBSRkMgNjU3MCwgd2l0aCB0aGUgYWRkaXRpb24gb2YgdGhlICQsICggYW5kICkgY2hhcmFjdGVycyBmb3IgcHJlLXByb2Nlc3NpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicmVsXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcInJlbGF0aW9uIHRvIHRoZSB0YXJnZXQgcmVzb3VyY2Ugb2YgdGhlIGxpbmtcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwidGl0bGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiYSB0aXRsZSBmb3IgdGhlIGxpbmtcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwidGFyZ2V0U2NoZW1hXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkpTT04gU2NoZW1hIGRlc2NyaWJpbmcgdGhlIGxpbmsgdGFyZ2V0XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiNcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJtZWRpYVR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwibWVkaWEgdHlwZSAoYXMgZGVmaW5lZCBieSBSRkMgMjA0NikgZGVzY3JpYmluZyB0aGUgbGluayB0YXJnZXRcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWV0aG9kXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIm1ldGhvZCBmb3IgcmVxdWVzdGluZyB0aGUgdGFyZ2V0IG9mIHRoZSBsaW5rIChlLmcuIGZvciBIVFRQIHRoaXMgbWlnaHQgYmUgXFxcIkdFVFxcXCIgb3IgXFxcIkRFTEVURVxcXCIpXCIsXG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcImVuY1R5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG1lZGlhIHR5cGUgaW4gd2hpY2ggdG8gc3VibWl0IGRhdGEgYWxvbmcgd2l0aCB0aGUgcmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJkZWZhdWx0XCI6IFwiYXBwbGljYXRpb24vanNvblwiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInNjaGVtYVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJTY2hlbWEgZGVzY3JpYmluZyB0aGUgZGF0YSB0byBzdWJtaXQgYWxvbmcgd2l0aCB0aGUgcmVxdWVzdFwiLFxuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59XG5cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJkZXNjcmlwdGlvblwiOiBcIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hXCIsXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwic2NoZW1hQXJyYXlcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICB9LFxuICAgICAgICBcInBvc2l0aXZlSW50ZWdlclwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcIm1pbmltdW1cIjogMFxuICAgICAgICB9LFxuICAgICAgICBcInBvc2l0aXZlSW50ZWdlckRlZmF1bHQwXCI6IHtcbiAgICAgICAgICAgIFwiYWxsT2ZcIjogWyB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyXCIgfSwgeyBcImRlZmF1bHRcIjogMCB9IF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzaW1wbGVUeXBlc1wiOiB7XG4gICAgICAgICAgICBcImVudW1cIjogWyBcImFycmF5XCIsIFwiYm9vbGVhblwiLCBcImludGVnZXJcIiwgXCJudWxsXCIsIFwibnVtYmVyXCIsIFwib2JqZWN0XCIsIFwic3RyaW5nXCIgXVxuICAgICAgICB9LFxuICAgICAgICBcInN0cmluZ0FycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICB9XG4gICAgfSxcbiAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcImlkXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcIiRzY2hlbWFcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidGl0bGVcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge30sXG4gICAgICAgIFwibXVsdGlwbGVPZlwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwibWluaW11bVwiOiAwLFxuICAgICAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm51bWJlclwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm51bWJlclwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhMZW5ndGhcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlclwiIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MFwiIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwicmVnZXhcIlxuICAgICAgICB9LFxuICAgICAgICBcImFkZGl0aW9uYWxJdGVtc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7IFwidHlwZVwiOiBcImJvb2xlYW5cIiB9LFxuICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH1cbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH1cbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyXCIgfSxcbiAgICAgICAgXCJtaW5JdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDBcIiB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm1heFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlclwiIH0sXG4gICAgICAgIFwibWluUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDBcIiB9LFxuICAgICAgICBcInJlcXVpcmVkXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zdHJpbmdBcnJheVwiIH0sXG4gICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcInR5cGVcIjogXCJib29sZWFuXCIgfSxcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9XG4gICAgICAgICAgICBdLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5XCIgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBlc1wiIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBlc1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgIC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ogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImJhc2VQYXRoXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIixcbiAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl5odHRwcz86Ly9cIlxuICAgICAgICB9LFxuICAgICAgICBcInJlc291cmNlUGF0aFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCIsXG4gICAgICAgICAgICBcInBhdHRlcm5cIjogXCJeL1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXBpc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpT2JqZWN0XCIgfVxuICAgICAgICB9LFxuICAgICAgICBcIm1vZGVsc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIm1vZGVsc09iamVjdC5qc29uI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICBcImNvbnN1bWVzXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW1lVHlwZUFycmF5XCIgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uc1wiOiB7IFwiJHJlZlwiOiBcImF1dGhvcml6YXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgfSxcbiAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcImFwaU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInBhdGhcIiwgXCJvcGVyYXRpb25zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJwYXRoXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpLXRlbXBsYXRlXCIsXG4gICAgICAgICAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl4vXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwib3BlcmF0aW9uc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJvcGVyYXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW1lVHlwZUFycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiBcIm1pbWUtdHlwZVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvYXV0aG9yaXphdGlvbk9iamVjdC5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2Jhc2ljQXV0aFwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpS2V5XCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJcIlxuICAgICAgICAgICAgfVxuICAgICAgICBdXG4gICAgfSxcbiAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgXCJiYXNpY0F1dGhcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYmFzaWNBdXRoXCIgXSB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcImFwaUtleVwiOiB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0eXBlXCIsIFwicGFzc0FzXCIsIFwia2V5bmFtZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYXBpS2V5XCIgXSB9LFxuICAgICAgICAgICAgICAgIFwicGFzc0FzXCI6IHsgXCJlbnVtXCI6IFsgXCJoZWFkZXJcIiwgXCJxdWVyeVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcImtleW5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm9hdXRoMlwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiwgXCJncmFudFR5cGVzXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJvYXV0aDJcIiBdIH0sXG4gICAgICAgICAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZVwiIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZ3JhbnRUeXBlc1wiOiB7IFwiJHJlZlwiOiBcIm9hdXRoMkdyYW50VHlwZS5qc29uI1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIF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RyZWZcIjogXCIjL2RlZmluaXRpb25zL2FycmF5VHlwZVwiIH1cbiAgICBdLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInJlZlR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwidm9pZFR5cGVcIjoge1xuICAgICAgICAgICAgXCJlbnVtXCI6IFsgeyBcInR5cGVcIjogXCJ2b2lkXCIgfSBdXG4gICAgICAgIH0sXG4gICAgICAgIFwibW9kZWxUeXBlXCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJib29sZWFuXCIsIFwiaW50ZWdlclwiLCBcIm51bWJlclwiLCBcInN0cmluZ1wiLCBcImFycmF5XCIgXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmltaXRpdmVUeXBlXCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcImJvb2xlYW5cIiwgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIsIFwic3RyaW5nXCIgXVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVmYXVsdFZhbHVlXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcInR5cGVcIjogWyBcImFycmF5XCIsIFwib2JqZWN0XCIsIFwibnVsbFwiIF0gfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgICAgICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiaW50MzJcIiwgXCJpbnQ2NFwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHsgXCJlbnVtXCI6IFsgXCJmbG9hdFwiLCBcImRvdWJsZVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZW51bVwiOiBbIFwiYnl0ZVwiLCBcImRhdGVcIiwgXCJkYXRlLXRpbWVcIiBdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcInN0cmluZ1wiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIgXSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiwgXCJudW1iZXJcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhcnJheVR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiLCBcIml0ZW1zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJhcnJheVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3JlZlR5cGVcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcImFsbE9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZVR5cGVcIlxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjoge30sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHt9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAg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xcbiAgICAgICAgXCJtaW5pbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcImVudW1cIjogWyBcImludDMyXCIsIFwiaW50NjRcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiZmxvYXRcIiwgXCJkb3VibGVcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJieXRlXCIsIFwiZGF0ZVwiLCBcImRhdGUtdGltZVwiIF1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0sXG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJhbGxPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7fSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge31cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9pbmZvT2JqZWN0Lmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJkZXNjcmlwdGlvblwiOiBcImluZm8gb2JqZWN0IChzZWN0aW9uIDUuMS4zKVwiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwicmVxdWlyZWRcIjogWyBcInRpdGxlXCIsIFwiZGVzY3JpcHRpb25cIiBdLFxuICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidGl0bGVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJ0ZXJtc09mU2VydmljZVVybFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcInVyaVwiIH0sXG4gICAgICAgIFwiY29udGFjdFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcImVtYWlsXCIgfSxcbiAgICAgICAgXCJsaWNlbnNlXCI6IHsgXCJ0eX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OiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJzdWJUeXBlc1wiOiBbIFwiZGlzY3JpbWluYXRvclwiIF1cbiAgICB9LFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInByb3BlcnR5T2JqZWN0XCI6IHtcbiAgICAgICAgICAgIFwiYWxsT2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCJkYXRhVHlwZUJhc2UuanNvbiNcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuIiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL29hdXRoMkdyYW50VHlwZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwibWluUHJvcGVydGllc1wiOiAxLFxuICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiaW1wbGljaXRcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2ltcGxpY2l0XCIgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uX2NvZGVcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2F1dGhvcml6YXRpb25Db2RlXCIgfVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwiaW1wbGljaXRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJsb2dpbkVuZHBvaW50XCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJsb2dpbkVuZHBvaW50XCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9sb2dpbkVuZHBvaW50XCIgfSxcbiAgICAgICAgICAgICAgICBcInRva2VuTmFtZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXV0aG9yaXphdGlvbkNvZGVcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0b2tlbkVuZHBvaW50XCIsIFwidG9rZW5SZXF1ZXN0RW5kcG9pbnRcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInRva2VuRW5kcG9pbnRcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Rva2VuRW5kcG9pbnRcIiB9LFxuICAgICAgICAgICAgICAgIFwidG9rZW5SZXF1ZXN0RW5kcG9pbnRcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Rva2VuUmVxdWVzdEVuZHBvaW50XCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJsb2dpbkVuZHBvaW50XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidXJsXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ1cmxcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiwgXCJmb3JtYXRcIjogXCJ1cmlcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuRW5kcG9pbnRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ1cmxcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInVybFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcInVyaVwiIH0sXG4gICAgICAgICAgICAgICAgXCJ0b2tlbk5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuUmVxdWVzdEVuZHBvaW50XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidXJsXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ1cmxcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiwgXCJmb3JtYXRcIjogXCJ1cmlcIiB9LFxuICAgICAgICAgICAgICAgIFwiY2xpZW50SWROYW1lXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgICAgICBcImNsaWVudFNlY3JldE5hbWVcIjogeyBcInR5cGV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XCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiYXV0aG9yaXphdGlvbnNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiYXV0aG9yaXphdGlvbk9iamVjdC5qc29uIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicGFyYW1ldGVyc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJwYXJhbWV0ZXJPYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInJlc3BvbnNlTWVzc2FnZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZXNwb25zZU1lc3NhZ2VPYmplY3RcIn1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiY29uc3VtZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVwcmVjYXRlZFwiOiB7IFwiZW51bVwiOiBbIFwidHJ1ZVwiLCBcImZhbHNlXCIgXSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICBdLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInJlc3BvbnNlTWVzc2FnZU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcImNvZGVcIiwgXCJtZXNzYWdlXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJjb2RlXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZmMyNjE2c2VjdGlvbjEwXCIgfSxcbiAgICAgICAgICAgICAgICBcIm1lc3NhZ2VcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwicmVzcG9uc2VNb2RlbFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJyZmMyNjE2c2VjdGlvbjEwXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwibWluaW11bVwiOiAxMDAsXG4gICAgICAgICAgICBcIm1heGltdW1cIjogNjAwLFxuICAgICAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW1lVHlwZUFycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICBc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XG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJ0eXBlIEZpbGUgcmVxdWlyZXMgc3BlY2lhbCBwYXJhbVR5cGUgYW5kIGNvbnN1bWVzXCIsXG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcIm5vdFwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFwicGFyYW1UeXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJmb3JtXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJjb25zdW1lc1wiOiB7IFwiZW51bVwiOiBbIFwibXVsdGlwYXJ0L2Zvcm0tZGF0YVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9XG4gICAgXVxufVxuIiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL3Jlc291cmNlTGlzdGluZy5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwicmVxdWly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1wiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Jlc3BvbnNlXCJcbiAgICAgIH0sXG4gICAgICBcImRlc2NyaXB0aW9uXCI6IFwiT25lIG9yIG1vcmUgSlNPTiByZXByZXNlbnRhdGlvbnMgZm9yIHBhcmFtZXRlcnNcIlxuICAgIH0sXG4gICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJkZXNjcmlwdGlvblwiOiBcImluZm9ybWF0aW9uIGFib3V0IGV4dGVybmFsIGRvY3VtZW50YXRpb25cIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1cmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcImV4YW1wbGVzXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB0c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ICAgICAgfSxcbiAgICAgICAgXCJzY2hlbWVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtZXNMaXN0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXByZWNhdGVkXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwic2VjdXJpdHlcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2VjdXJpdHlcIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInBhdGhJdGVtXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCIkcmVmXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImdldFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInB1dFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInBvc3RcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb3BlcmF0aW9uXCJcbiAgICAgICAgfSxcbi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iRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcIm5vdFwiOiB7XG4gICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInJlc3BvbnNlVmFsdWVcIjoge1xuICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Jlc3BvbnNlXCJcbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvanNvblJlZmVyZW5jZVwiXG4gICAgICAgIH1cbiAgICAgIF1cbiAgICB9LFxuICAgIFwicmVzcG9uc2VcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJzY2hlbWFcIjoge1xuICAgICAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgICB9LFxuIC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biAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiYXJyYXlcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlc0l0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJjb2xsZWN0aW9uRm9ybWF0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2NvbGxlY3Rpb25Gb3JtYXRcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZGVmYXVsdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNaW5pbXVtXCJcbiA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ICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgd2hldGhlciBvciBub3QgdGhpcyBwYXJhbWV0ZXIgaXMgcmVxdWlyZWQgb3Igb3B0aW9uYWwuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiaW5cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJEZXRlcm1pbmVzIHRoZSBsb2NhdGlvbiBvZiB0aGUgcGFyYW1ldGVyLlwiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImhlYWRlclwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBicmllZiBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbXVsdGlwbGVPZlwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwicXVlcnlQYXJhbWV0ZXJTdWJTY2hlbWFcIjoge1xuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9L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AgIFwiZGVmYXVsdFwiOiBmYWxzZSxcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiYWxsb3dzIHNlbmRpbmcgYSBwYXJhbWV0ZXIgYnkgbmFtZSBvbmx5IG9yIHdpdGggYW4gZW1wdHkgdmFsdWUuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFdpdGhNdWx0aVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZG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FtZXRlci4gVGhpcyBjb3VsZCBjb250YWluIGV4YW1wbGVzIG9mIHVzZS4gIEdpdEh1YiBGbGF2b3JlZCBNYXJrZG93biBpcyBhbGxvd2VkLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibmFtZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIlRoZSBuYW1lIG9mIHRoZSBwYXJhbWV0ZXIuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxvd0VtcHR5VmFsdWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2UsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcImFsbG93cyBzZW5kaW5nIGEgcGFyYW1ldGVyIGJ5IG5hbWUgb25seSBvciB3aXRoIGFuIGVtcHR5IHZhbHVlLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiZmlsZVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFdpdGhNdWx0aVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhMZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5MZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGF0dGVyblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4SXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4SXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy91bmlxdWVJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9lbnVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtdWx0aXBsZU9mXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL211bHRpcGxlT2ZcIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInBhdGhQYXJhbWV0ZXJTdWJTY2hlbWFcIjoge1xuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwicmVxdWlyZWRcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwicmVxdWlyZWRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgIF0sXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgd2hldGhlciBvciBub3QgdGhpcyBwYXJhbWV0ZXIgaXMgcmVxdWlyZWQgb3Igb3B0aW9uYWwuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgdGhlIGxvY2F0aW9uIG9mIHRoZSBwYXJhbWV0ZXIuXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGF0aFwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBicmllZiBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbXVsdGlwbGVPZlwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwibm9uQm9keVBhcmFtZXRlclwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIixcbiAgICAgICAgXCJpblwiLFxuICAgICAgICBcInR5cGVcIlxuICAgICAgXSxcbiAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9oZWFkZXJQYXJhbWV0ZXJTdWJTY2hlbWFcIlxuICAgICAgICB9LFxuICAgICAgICB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9mb3JtRGF0YVBhcmFtZXRlclN1YlNj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XCI6IFwiYm9vbGVhblwiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMvcHJvcGVydGllcy90eXBlXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGlzY3JpbWluYXRvclwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJyZWFkT25seVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInhtbFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy94bWxcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4dGVybmFsRG9jc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leHRlcm5hbERvY3NcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVcIjoge31cbiAgICAgIH0sXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgfSxcbiAgICBcImZpbGVTY2hlbWFcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBkZXRlcm1pbmlzdGljIHZlcnNpb24gb2YgYSBKU09OIFNjaGVtYSBvYmplY3QuXCIsXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcInRpdGxlXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMvcHJvcGVydGllcy90aXRsZVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIy9wcm9wZXJ0aWVzL2Rlc2NyaXB0aW9uXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMvcHJvcGVydGllcy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJyZXF1aXJlZFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJmaWxlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwicmVhZE9ubHlcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGFtcGxlXCI6IHt9XG4gICAgICB9LFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgIH0sXG4gICAgXCJwcmltaXRpdmVzSXRlbXNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhMZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5MZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGF0dGVyblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4SXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4SXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy91bmlxdWVJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51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IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVzcGFjZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmVmaXhcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXR0cmlidXRlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwid3JhcHBlZFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwidGFnXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwibmFtZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInNlY3VyaXR5RGVmaW5pdGlvbnNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9iYXNpY0F1dGhlbnRpY2F0aW9uU2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9hcGlLZXlTZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkltcGxpY2l0U2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJQYXNzd29yZFNlY3VyaXR5XCJcbiAgICAgICAgICB9LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiXG4gICAgICAgICAgfVxuICAgICAgICBdXG4gICAgICB9XG4gICAgfSxcbiAgICBcImJhc2ljQXV0aGVudGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImJhc2ljXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJhcGlLZXlTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwibmFtZVwiLFxuICAgICAgICBcImluXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwaUtleVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaW5cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImhlYWRlclwiLFxuICAgICAgICAgICAgXCJxdWVyeVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgySW1wbGljaXRTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiaW1wbGljaXRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJQYXNzd29yZFNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwidG9rZW5VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGFzc3dvcmRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0b2tlblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcInRva2VuVXJsXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcIm9hdXRoMlwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZsb3dcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwcGxpY2F0aW9uXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwidG9rZW5VcmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcIm9hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIixcbiAgICAgICAgXCJ0b2tlblVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJvYXV0aDJcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmbG93XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJhY2Nlc3NDb2RlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXV0aG9yaXphdGlvblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJTY29wZXNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgIH1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VcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfVxuICAgIH0sXG4gICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJpZFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCIkc2NoZW1hXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcInRpdGxlXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHt9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcIm1pbmltdW1cIjogMCxcbiAgICAgICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJcIiB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDBcIiB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInJlZ2V4XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhZGRpdGlvbmFsSXRlbXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcInR5cGVcIjogXCJib29sZWFuXCIgfSxcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9XG4gICAgICAgICAgICBdLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9XG4gICAgICAgICAgICBdLFxuICAgICAgIC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IiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zdHJpbmdBcnJheVwiIH1cbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9LFxuICAgICAgICBcImFueU9mXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH0sXG4gICAgICAgIFwib25lT2ZcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCIgfSxcbiAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgIH0sXG4gICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjogWyBcIm1heGltdW1cIiBdLFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjogWyBcIm1pbmltdW1cIiBdXG4gICAgfSxcbiAgICBcImRlZmF1bHRcIjoge31cbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvaGVscGVycy5qcyIsImxpYi9zcGVjcy5qcyIsImxpY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FsdWVzXG4gICAgICBfLmVhY2goWydtYXhpbXVtJywgJ21pbmltdW0nXSwgZnVuY3Rpb24gKHByb3ApIHtcbiAgICAgICAgaWYgKF8uaXNTdHJpbmcocHJvcGVydHlbcHJvcF0pKSB7XG4gICAgICAgICAgcHJvcGVydHlbcHJvcF0gPSBwYXJzZUZsb2F0KHByb3BlcnR5W3Byb3BdKTtcbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIF8uZWFjaChKc29uUmVmcy5maW5kUmVmcyhvUHJvcCwge1xuICAgICAgICBpbmNsdWRlSW52YWxpZDogdHJ1ZSxcbiAgICAgICAgcmVmUHJlUHJvY2Vzc29yOiBzd2FnZ2VyMVJlZlByZVByb2Nlc29yXG4gICAgICB9KSwgZnVuY3Rpb24gKHJlZkRldGFpbHMsIHJlZlB0cikge1xuICAgICAgICB2YXIgZE1ldGFkYXRhID0gZG9jdW1lbnRNZXRhZGF0YS5kZWZpbml0aW9uc1tyZWZEZXRhaWxzLnVyaV07XG4gICAgICAgIHZhciBwYXRoID0gSnNvblJlZnMucGF0aEZyb21QdHIocmVmUHRyKTtcblxuICAgICAgICBpZiAoZE1ldGFkYXRhLmxpbmVhZ2UubGVuZ3RoID4gMCkge1xuICAgICAgICAgIHRyYXZlcnNlKHByb3BlcnR5KS5zZXQocGF0aCwgZ2V0T3JDb21wb3NlU2NoZW1hKGRvY3VtZW50TWV0YWRhdGEsIHJlZkRldGFpbHMudXJpKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdHJhdmVyc2UocHJvcGVydHkpLnNldChwYXRoLmNvbmNhdCgndGl0bGUnKSwgJ0NvbXBvc2VkICcgKyBzYW5pdGl6ZVJlZihkb2N1bWVudE1ldGFkYXRhLnN3YWdnZXJWZXJzaW9uLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmRGV0YWlscy51cmkpKTtcb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md0aCA+IDEgJiYgbGluZWFnZVswXSA9PT0gaWQ7XG4gICAgfVxuXG4gICAgLy8gU3dhZ2dlciAxLjIgZG9lcyBub3QgYWxsb3cgbXVsdGlwbGUgaW5oZXJpdGFuY2Ugd2hpbGUgU3dhZ2dlciAyLjArIGRvZXNcbiAgICBpZiAobWV0YWRhdGEucGFyZW50cy5sZW5ndGggPiAxICYmIHN3YWdnZXJWZXJzaW9uID09PSAnMS4yJykge1xuICAgICAgY3JlYXRlRXJyb3JPcldhcm5pbmcoJ01VTFRJUExFXycgKyBjb2RlICsgJ19JTkhFUklUQU5DRScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hpbGQgJyArIGNvZGUudG9Mb3dlckNhc2UoKSArICcgaXMgc3ViIHR5cGUgb2YgbXVsdGlwbGUgbW9kZWxzOiAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIF8ubWFwKG1ldGFkYXRhLnBhcmVudHMsIGZ1bmN0aW9uIChwYXJlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldERpc3BsYXlJZChwYXJlbnQpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignICYmICcpLCBkZWZQYXRoLCByZXN1bHRzLmVycm9ycyk7XG4gICAgfVxuXG4gICAgaWYgKG1ldGFkYXRhLmN5Y2xpY2FsKSB7XG4gICAgICBjcmVhdGVFcnJvck9yV2FybmluZygnQ1lDTElDQUxfJyArIGNvZGUgKyAnX0lOSEVSSVRBTkNFJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZ1ByZWZpeCArICcgaGFzIGEgY2lyY3VsYXIgaW5oZXJpdGFuY2U6ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLm1hcChsaW5lYWdlLCBmdW5jdGlvbiAoZGVwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldERpc3BsYXlJZChkZXApO1xuICAg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biAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlcnIsIHJlc3VsdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWxsYmFjayhlcnIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gT25seSB2YWxpZGF0ZSB0aGUgQVBJIERlY2xhcmF0aW9ucyBpZiB0aGUgQVBJIGlzIDEuMiBhbmQgdGhlIFJlc291cmNlIExpc3Rpbmcgd2FzIHZhbGlkXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzdWx0cyAmJiBzcGVjLnZlcnNpb24gPT09ICcxLjInKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0cyA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yczogW10sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YXJuaW5nczogW10sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlEZWNsYXJhdGlvbnM6IFtdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFzeW5jLm1hcChhcGlEZWNsYXJhdGlvbnMsIGZ1bmN0aW9uIChhcGlEZWNsYXJhdGlvbiwgY2FsbGJhY2syKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZUFnYWluc3RTY2hlbWEoc3BlYywgJ2FwaURlY2xhcmF0aW9uLmpzb24nLCBhcGlEZWNsYXJhdGlvbiwgY2FsbGJhY2syKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZXJyLCBhbGxSZXN1bHRzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWxsYmFjayhlcnIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLmVhY2goYWxsUmVzdWx0cywgZnVuY3Rpb24gKHJlc3VsdCwgaW5kZXgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0cy5hcGlEZWNsYXJhdGlvbnNbaW5kZXhdID0gcmVzdWx0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKHVuZGVmaW5lZCwgcmVzdWx0cyk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2sodW5kZWZpbmVkLCByZXN1bHRzKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG59O1xuXG4vKipcbiAqIENyZWF0ZXMgYSBuZXcgU3dhZ2dlciBzcGVjaWZpY2F0aW9uIG9iamVjdC5cbiAqXG4gKiBAcGFyYW0ge3N0cmluZ30gdmVyc2lvbiAtIFRoZSBTd2FnZ2VyIHZlcnNpb25cbiAqXG4gKiBAY29uc3RydWN0b3JcbiAqL1xudmFyIFNwZWNpZmljYXRpb24gPSBmdW5jdGlvbiAodmVyc2lvbikge1xuICB2YXIgdGhhdCA9IHRoaXM7XG4gIHZhciBjcmVhdGVWYWxpZGF0b3JzID0gZnVuY3Rpb24gKHNwZWMsIHZhbGlkYXRvcnNNYXApIHtcbiAgICByZXR1cm4gXy5yZWR1Y2UodmFsaWRhdG9yc01hcCwgZnVuY3Rpb24gKHJlc3VsdCwgc2NoZW1hcywgc2NoZW1hTmFtZSkge1xuICAgICAgcmVzdWx0W3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m91bmQodmFsKSA9PT0gdmFsKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdudW1iZXInOlxuICAgICAgICAvLyBDb2VyY2UgdGhlIHZhbHVlIG9ubHkgZm9yIFN3YWdnZXIgMS4yXG4gICAgICAgIGlmICh2ZXJzaW9uID09PSAnMS4yJyAmJiBfLmlzU3RyaW5nKHZhbCkpIHtcbiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJlc3VsdCA9IF8uaXNGaW5pdGUodmFsKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdzdHJpbmcnOlxuICAgICAgICBpZiAoIV8uaXNVbmRlZmluZWQoZm9ybWF0KSkge1xuICAgICAgICAgIHN3aXRjaCAoZm9ybWF0KSB7XG4gICAgICAgICAgY2FzZSAnZGF0ZSc6XG4gICAgICAgICAgICByZXN1bHQgPSBpc1ZhbGlkRGF0ZSh2YWwpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgY2FzZSAnZGF0ZS10aW1lJzpcbiAgICAgICAgICAgIHJlc3VsdCA9IGlzVmFsaWREYXRlVGltZSh2YWwpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAndm9pZCc6XG4gICAgICAgIHJlc3VsdCA9IF8uaXNVbmRlZmluZWQodmFsKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHNraXBFcnJvcikge1xuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9IGVsc2UgaWYgKCFyZXN1bHQpIHtcbiAgICAgIHRocm93RXJyb3JXaXRoQ29kZSgnSU5WQUxJRF9UWVBFJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlICE9PSAndm9pZCcgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05vdCBhIHZhb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tcbiAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBjYWxsYmFjayhlcnIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSBpZiAodmFsdWUgPT09IGJyZWFrTG9vcCB8fCAoZG9uZSAmJiBydW5uaW5nIDw9IDApKSB7XG4gICAgICAgICAgICAgICAgZG9uZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrKG51bGwpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVwbGVuaXNoKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiByZXBsZW5pc2ggKCkge1xuICAgICAgICAgICAgd2hpbGUgKHJ1bm5pbmcgPCBsaW1pdCAmJiAhZG9uZSkge1xuICAgICAgICAgICAgICAgIHZhciBlbGVtID0gbmV4dEVsZW0oKTtcbiAgICAgICAgICAgICAgICBpZiAoZWxlbSA9PT0gbnVsbCkge1xuICAgICAgICAgICAgICAgICAgICBkb25lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJ1bm5pbmcgPD0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2sobnVsbCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBydW5uaW5nICs9IDE7XG4gICAgICAgICAgICAgICAgaXRlcmF0ZWUoZWxlbS52YWx1ZSwgZWxlbS5rZXksIG9ubHlPbmNlKGl0ZXJhdGVlQ2FsbGJhY2spKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJlcGxlbmlzaCgpO1xuICAgIH07XG59XG5cbi8qKlxuICogVGhlIHNhbWUgYXMgW2BlYWNoT2ZgXXtAbGluayBtb2R1bG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lIHBvc3NpYmlsaXR5IG9mIHJldHVybmluZyB0byBhbiBhbmNlc3RvciB0YXNrXG4gICAgdmFyIHVuY2hlY2tlZERlcGVuZGVuY2llcyA9IHt9O1xuXG4gICAgYmFzZUZvck93bih0YXNrcywgZnVuY3Rpb24gKHRhc2ssIGtleSkge1xuICAgICAgICBpZiAoIWlzQXJyYXkodGFzaykpIHtcbiAgICAgICAgICAgIC8vIG5vIGRlcGVuZGVuY2llc1xuICAgICAgICAgICAgZW5xdWV1ZVRhc2soa2V5LCBbdGFza10pO1xuICAgICAgICAgICAgcmVhZHlUb0NoZWNrLnB1c2goa2V5KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBkZXBlbmRlbmNpZXMgPSB0YXNrLnNsaWNlKDAsIHRhc2subGVuZ3RoIC0gMSk7XG4gICAgICAgIHZhciByZW1haW5pbmdEZXBlbmRlbmNpZXMgPSBkZXBlbmRlbmNpZXMubGVuZ3RoO1xuICAgICAgICBpZiAocmVtYWluaW5nRGVwZW5kZW5jaWVzID09PSAwKSB7XG4gICAgICAgICAgICBlbnF1ZXVlVGFzayhrZXksIHRhc2spO1xuICAgICAgICAgICAgcmVhZHlUb0NoZWNrLnB1c2goa2V5KTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB1bmNoZWNrZWREZXBlbmRlbmNpZXNba2V5XSA9IHJlbWFpbmluZ0RlcGVuZGVuY2llcztcblxuICAgICAgICBhcnJheUVhY2goZGVwZW5kZW5jaWVzLCBmdW5jdGlvbiAoZGVwZW5kZW5jeU5hbWUpIHtcbiAgICAgICAgICAgIGlmICghdGFza3NbZGVwZW5kZW5jeU5hbWVdKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdhc3luYy5hdXRvIHRhc2sgYCcgKyBrZXkgK1xuICAgICAgICAgICAgICAgICAgICAnYCBoYXMgYSBub24tZXhpc3RlbnQgZGVwZW5kZW5jeSBgJyArXG4gICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3lOYW1lICsgJ2AgaW4gJyArXG4gICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY2llcy5qb2luKCcsICcpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGFkZExpc3RlbmVyKGRlcGVuZGVuY3lOYW1lLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgcmVtYWluaW5nRGVwZW5kZW5jaWVzLS07XG4gICAgICAgICAgICAgICAgaWYgKHJlbWFpbmluZ0RlcGVuZGVuY2llcyA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlVGFzayhrZXksIHRhc2spO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9KTtcblxuICAgIGNoZWNrRm9yRGVhZGxvY2tzKCk7XG4gICAgcHJvY2Vzc1F1ZXVlKCk7XG5cbiAgICBmdW5jdGlvbiBlbnF1ZXVlVGFzayhrZXksIHRhc2spIHtcbiAgICAgICAgcmVhZHlUYXNrcy5wdXNoKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJ1blRhc2soa2V5LCB0YXNrKTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcHJvY2Vzc1F1ZXVlKCkge1xuICAgICAgICBpZiAocmVhZHlUYXNrcy5sZW5ndGggPT09IDAgJiYgcnVubmluZ1Rhc2tzID09PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gY2FsbGJhY2sobnVsbCwgcmVzdWx0cyk7XG4gICAgICAgIH1cbiAgICAgICAgd2hpbGUocmVhZHlUYXNrcy5sZW5ndGggJiYgcnVubmluZ1Rhc2tzIDwgY29uY3VycmVuY3kpIHtcbiAgICAgICAgICAgIHZhciBydW4gPSByZWFkeVRhc2tzLnNoaWZ0KCk7XG4gICAgICAgICAgICBydW4oKTtcbiAgICAgICAgfVxuXG4g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ICAgICAgICAgICAgICBzYWZlUmVzdWx0c1tya2V5XSA9IHZhbDtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBzYWZlUmVzdWx0c1trZXldID0gcmVzdWx0O1xuICAgICAgICAgICAgICAgIGhhc0Vycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBsaXN0ZW5lcnMgPSBPYmplY3QuY3JlYXRlKG51bGwpO1xuXG4gICAgICAgICAgICAgICAgY2FsbGJhY2soZXJyLCBzYWZlUmVzdWx0cyk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJlc3VsdHNba2V5XSA9IHJlc3VsdDtcbiAgICAgICAgICAgICAgICB0YXNrQ29tcGxldGUoa2V5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgcnVubmluZ1Rhc2tzKys7XG4gICAgICAgIHZhciB0YXNrRm4gPSB3cmFwQXN5bmModGFza1t0YXNrLmxlbmd0aCAtIDFdKTtcbiAgICAgICAgaWYgKHRhc2subGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgdGFza0ZuKHJlc3VsdHMsIHRhc2tDYWxsYmFjayk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0YXNrRm4odGFza0NhbGxiYWNrKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrRm9yRGVhZGxvY2tzKCkge1xuICAgICAgICAvLyBLYWhuJ3MgYWxnb3JpdGhtXG4gICAgICAgIC8vIGh0dHBzOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL1RvcG9sb2dpY2FsX3NvcnRpbmcjS2Fobi4yN3NfYWxnb3JpdGhtXG4gICAgICAgIC8vIGh0dHA6Ly9jb25uYWxsZS5ibG9nc3BvdC5jb20vMjAxMy8xMC90b3BvbG9naWNhbC1zb3J0aW5na2Fobi1hbGdvcml0aG0uaHRtbFxuICAgICAgICB2YXIgY3VycmVudFRhc2s7XG4gICAgICAgIHZhciBjb3VudGVyID0gMDtcbiAgICAgICAgd2hpbGUgKHJlYWR5VG9DaGVjay5sZW5ndGgpIHtcbiAgICAgICAgICAgIGN1cnJlbnRUYXNrID0gcmVhZHlUb0NoZWNrLnBvcCgpO1xuICAgICAgICAgICAgY291bnRlcisrO1xuICAgICAgICAgICAgYXJyYXlFYWNoKGdldERlcGVuZGVudHMoY3VycmVudFRhc2spLCBmdW5jdGlvbiAoZGVwZW5kZW50KSB7XG4gICAgICAgICAgICAgICAgaWYgKC0tdW5jaGVja2VkRGVwZW5kZW5jaWVzW2RlcGVuZGVudF0gPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmVhZHlUb0NoZWNrLnB1c2goZGVwZW5kZW50KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjb3VudGVyICE9PSBudW1UYXNrcykge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgICAgICdhc3luYy5hdXRvIGNhbm5vdCBleGVjdXRlIHRhc2tzIGR1ZSB0byBhIHJlY3Vyc2l2ZSBkZXBlbmRlbmN5J1xuICAgICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGdldERlcGVuZGVudHModGFza05hbWUpIHtcbiAgICAgICAgdmFyIHJlc3VsdCA9IFtdO1xuICAgICAgICBiYXNlRm9yT3duKHRhc2tzLCBmdW5jdGlvbiAodGFzaywga2V5KSB7XG4gICAgICAgICAgICBpZiAoaXNBcnJheSh0YXNrKSAmJiBiYXNlSW5kZXhPZih0YXNrLCB0YXNrTmFtZSwgMCkgPj0gMCkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKGtleSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cbn07XG5cbi8qKlxuICogQS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ge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd0YXNrIGNhbGxiYWNrIG11c3QgYmUgYSBmdW5jdGlvbicpO1xuICAgICAgICB9XG4gICAgICAgIHEuc3RhcnRlZCA9IHRydWU7XG4gICAgICAgIGlmICghaXNBcnJheShkYXRhKSkge1xuICAgICAgICAgICAgZGF0YSA9IFtkYXRhXTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZGF0YS5sZW5ndGggPT09IDAgJiYgcS5pZGxlKCkpIHtcbiAgICAgICAgICAgIC8vIGNhbGwgZHJhaW4gaW1tZWRpYXRlbHkgaWYgdGhlcmUgYXJlIG5vIHRhc2tzXG4gICAgICAgICAgICByZXR1cm4gc2V0SW1tZWRpYXRlJDEoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcS5kcmFpbigpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IGRhdGEubGVuZ3RoOyBpIDwgbDsgaSsrKSB7XG4gICAgICAgICAgICB2YXIgaXRlbSA9IHtcbiAgICAgICAgICAgICAgICBkYXRhOiBkYXRhW2ldLFxuICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBjYWxsYmFjayB8fCBub29wXG4gICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICBpZiAoaW5zZXJ0QXRGcm9udCkge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLnVuc2hpZnQoaXRlbSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHEuX3Rhc2tzLnB1c2goaXRlbSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXByb2Nlc3NpbmdTY2hlZHVsZWQpIHtcbiAgICAgICAgICAgIHByb2Nlc3NpbmdTY2hlZHVsZWQgPSB0cnVlO1xuICAgICAgICAgICAgc2V0SW1tZWRpYXRlJDEoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgcHJvY2Vzc2luZ1NjaGVkdWxlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIHEucHJvY2VzcygpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBfbmV4dCh0YXNrcykge1xuICAgICAgICByZXR1cm4gZnVuY3Rpb24oZXJyKXtcbiAgICAgICAgICAgIG51bVJ1bm5pbmcgLT0gMTtcblxuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSB0YXNrcy5sZW5ndGg7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgdGFzayA9IHRhc2tzW2ldO1xuXG4gICAgICAgICAgICAgICAgdmFyIGluZGV4ID0gYmFzZUluZGV4T2Yod29ya2Vyc0xpc3QsIHRhc2ssIDApO1xuICAgICAgICAgICAgICAgIGlmIChpbmRleCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICB3b3JrZXJzTGlzdC5zaGlmdCgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5kZXggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHdvcmtlcnNMaXN0LnNwbGljZShpbmRleCwgMSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdGFzay5jYWxsYmFjay5hcHBseSh0YXNrLCBhcmd1bWVudHMpO1xuXG4gICAgICAgICAgICAgICAgaWYgKGVyciAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIHEuZXJyb3IoZXJyLCB0YXNrLmRhdGEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKG51bVJ1bm5pbmcgPD0gKHEuY29uY3VycmVuY3kgLSBxLmJ1ZmZlcikgKSB7XG4gICAgICAgICAgICAgICAgcS51bnNhdHVyYXRlZCgpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAocS5pZGxlKCkp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mdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAvLyBBdm9pZCB0cnlpbmcgdG8gc3RhcnQgdG9vIG1hbnkgcHJvY2Vzc2luZyBvcGVyYXRpb25zLiBUaGlzIGNhbiBvY2N1clxuICAgICAgICAgICAgLy8gd2hlbiBjYWxsYmFja3MgcmVzb2x2ZSBzeW5jaHJvbm91c2x5ICgjMTI2NykuXG4gICAgICAgICAgICBpZiAoaXNQcm9jZXNzaW5nKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaXNQcm9jZXNzaW5nID0gdHJ1ZTtcbiAgICAgICAgICAgIHdoaWxlKCFxLnBhdXNlZCAmJiBudW1SdW5uaW5nIDwgcS5jb25jdXJyZW5jeSAmJiBxLl90YXNrcy5sZW5ndGgpe1xuICAgICAgICAgICAgICAgIHZhciB0YXNrcyA9IFtdLCBkYXRhID0gW107XG4gICAgICAgICAgICAgICAgdmFyIGwgPSBxLl90YXNrcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgaWYgKHEucGF5bG9hZCkgbCA9IE1hdGgubWluKGwsIHEucGF5bG9hZCk7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG5vZGUgPSBxLl90YXNrcy5zaGlmdCgpO1xuICAgICAgICAgICAgICAgICAgICB0YXNrcy5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgICAgICAgICB3b3JrZXJzTGlzdC5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgICAgICAgICBkYXRhLnB1c2gobm9kZS5kYXRhKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBudW1SdW5uaW5nICs9IDE7XG5cbiAgICAgICAgICAgICAgICBpZiAocS5fdGFza3MubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHEuZW1wdHkoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAobnVtUnVubmluZyA9PT0gcS5jb25jdXJyZW5jeSkge1xuICAgICAgICAgICAgICAgICAgICBxLnNhdHVyYXRlZCgpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHZhciBjYiA9IG9ubHlPbmNlKF9uZXh0KHRhc2tzKSk7XG4gICAgICAgICAgICAgICAgX3dvcmtlcihkYXRhLCBjYik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpc1Byb2Nlc3NpbmcgPSBmYWxzZTtcbiAgICAgICAgfSxcbiAgICAgICAgbGVuZ3RoOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gcS5fdGFza3MubGVuZ3RoO1xuICAgICAgICB9LFxuICAgICAgICBydW5uaW5nOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVtUnVubmluZztcbiAgICAgICAgfSxcbiAgICAgICAgd29ya2Vyc0xpc3Q6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiB3b3JrZXJzTGlzdDtcbiAgICAgICAgfSxcbiAgICAgICAgaWRsZTogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICByZXR1cm4gcS5fdGFza3MubGVuZ3RoICsgbnVtUnVubmluZyA9PT0gMDtcbiAgICAgICAgfSxcbiAgICAgICAgcGF1c2U6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHEucGF1c2VkID0gdHJ1ZTtcbiAgICAgICAgfSxcbiAgICAgICAgcmVzdW1lOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICBpZiAocS5wYXVzZWQgPT09IGZhbHNlKSB7IHJldHVybjsgfVxuICAgICAgICAgICAgcS5wYXVzZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIHNldEltbWVkaWF0ZSQxKHEucHJvY2Vzcyk7XG4gICAgICAgIH1cbiAgICB9O1xuICAgIHJldHVybiBxO1x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ldFJlc3VsdCkge1xuICAgIHJldHVybiBmdW5jdGlvbihlYWNoZm4sIGFyciwgaXRlcmF0ZWUsIGNiKSB7XG4gICAgICAgIGNiID0gY2IgfHwgbm9vcDtcbiAgICAgICAgdmFyIHRlc3RQYXNzZWQgPSBmYWxzZTtcbiAgICAgICAgdmFyIHRlc3RSZXN1bHQ7XG4gICAgICAgIGVhY2hmbihhcnIsIGZ1bmN0aW9uKHZhbHVlLCBfLCBjYWxsYmFjaykge1xuICAgICAgICAgICAgaXRlcmF0ZWUodmFsdWUsIGZ1bmN0aW9uKGVyciwgcmVzdWx0KSB7XG4gICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICBjYWxsYmFjayhlcnIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hlY2socmVzdWx0KSAmJiAhdGVzdFJlc3VsdCkge1xuICAgICAgICAgICAgICAgICAgICB0ZXN0UGFzc2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgdGVzdFJlc3VsdCA9IGdldFJlc3VsdCh0cnVlLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKG51bGwsIGJyZWFrTG9vcCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSwgZnVuY3Rpb24oZXJyKSB7XG4gICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgY2IoZXJyKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY2IobnVsbCwgdGVzdFBhc3NlZCA/IHRlc3RSZXN1bHQgOiBnZXRSZXN1bHQoZmFsc2UpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfTtcbn1cblxuZnVuY3Rpb24gX2ZpbmRHZXRSZXN1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bGwpO1xuICAgIGhhc2hlciA9IGhhc2hlciB8fCBpZGVudGl0eTtcbiAgICB2YXIgX2ZuID0gd3JhcEFzeW5jKGZuKTtcbiAgICB2YXIgbWVtb2l6ZWQgPSBpbml0aWFsUGFyYW1zKGZ1bmN0aW9uIG1lbW9pemVkKGFyZ3MsIGNhbGxiYWNrKSB7XG4gICAgICAgIHZhciBrZXkgPSBoYXNoZXIuYXBwbHkobnVsbCwgYXJncyk7XG4gICAgICAgIGlmIChoYXMobWVtbywga2V5KSkge1xuICAgICAgICAgICAgc2V0SW1tZWRpYXRlJDEoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2suYXBwbHkobnVsbCwgbWVtb1trZXldKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2UgaWYgKGhhcyhxdWV1ZXMsIGtleSkpIHtcbiAgICAgICAgICAgIHF1ZXVlc1trZXldLnB1c2goY2FsbGJhY2spO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcXVldWVzW2tleV0gPSBbY2FsbGJhY2tdO1xuICAgICAgICAgICAgX2ZuLmFwcGx5KG51bGwsIGFyZ3MuY29uY2F0KGZ1bmN0aW9uKC8qYXJncyovKSB7XG4gICAgICAgICAgICAgICAgdmFyIGFyZ3MgPSBzbGljZShhcmd1bWVudHMpO1xuICAgICAgICAgICAgICAgIG1lbW9ba2V5XSA9IGFyZ3M7XG4gICAgICAgICAgICAgICAgdmFyIHEgPSBxdWV1ZXNba2V5XTtcbiAgICAgICAgICAgICAgICBkZWxldGUgcXVldWVzW2tleV07XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBxLmxlbmd0aDsgaSA8IGw7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICBxW2ldLmFwcGx5KG51bGwsIGFyZ3MpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pKTtcbiAgICAgICAgfVxuICAgIH0pO1xuICAgIG1l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gICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICogICAgICAgICAgICAgY2FsbGJhY2sobnVsbCwgJ29uZScpO1xuICogICAgICAgICB9LCAyMDApO1xuICogICAgIH0sXG4gKiAgICAgZnVuY3Rpb24oY2FsbGJhY2spIHtcbiAqICAgICAgICAgLy8gZG8gc29tZSBtb3JlIHN0dWZmIGJ1dCBlcnJvciAuLi5cbiAqICAgICAgICAgY2FsbGJhY2sobmV3IEVycm9yKCdiYWQgc3R1ZmYgaGFwcGVuZWQnKSk7XG4gKiAgICAgfSxcbiAqICAgICBmdW5jdGlvbihjYWxsYmFjaykge1xuICogICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uKCkge1xuICogICAgICAgICAgICAgY2FsbGJhY2sobnVsbCwgJ3R3bycpO1xuICogICAgICAgICB9LCAxMDApO1xuICogICAgIH1cbiAqIF07XG4gKlxuICogYXN5bmMucGFyYWxsZWwoYXN5bmMucmVmbGVjdEFsbCh0YXNrcyksXG4gKiAvLyBvcHRpb25hbCBjYWxsYmFja1xuICogZnVuY3Rpb24oZXJyLCByZXN1bHRzKSB7XG4gKiAgICAgLy8gdmFsdWVzXG4gKiAgICAgLy8gcmVzdWx0c1swXS52YWx1ZSA9ICdvbmUnXG4gKiAgICAgLy8gcmVzdWx0c1sxXS5lcnJvciA9IEVycm9yKCdiYWQgc3R1ZmYgaGFwcGVuZWQnKVxuICogICAgIC8vIHJlc3VsdHNbMl0udmFsdWUgPSAndHdvJ1xuICogfSk7XG4gKlxuICogLy8gYW4gZXhhbXBsZSB1c2luZyBhbiBvYmplY3QgaW5zdGVhZCBvZiBhbiBhcnJheVxuICogbGV0IHRhc2tzID0ge1xuICogICAgIG9uZTogZnVuY3Rpb24oY2FsbGJhY2spIHtcbiAqICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAqICAgICAgICAgICAgIGNhbGxiYWNrKG51bGwsICdvbmUnKTtcbiAqICAgICAgICAgfSwgMjAwKTtcb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WJsZSBuby11c2UtYmVmb3JlLWRlZmluZSovXG5cbnZhciBjb21tb24gICAgICAgICAgICAgID0gcmVxdWlyZSgnLi9jb21tb24nKTtcbnZhciBZQU1MRXhjZXB0aW9uICAgICAgID0gcmVxdWlyZSgnLi9leGNlcHRpb24nKTtcbnZhciBERUZBVUxUX0ZVTExfU0NIRU1BID0gcmVxdWlyZSgnLi9zY2hlbWEvZGVmYXVsdF9mdWxsJyk7XG52YXIgREVGQVVMVF9TQUZFX1NDSEVNQSA9IHJlcXVpcmUoJy4vc2NoZW1hL2RlZmF1bHRfc2FmZScpO1xuXG52YXIgX3RvU3RyaW5nICAgICAgID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZztcbnZhciBfaGFzT3duUHJvcGVydHkgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5O1xuXG52YXIgQ0hBUl9UQUIgICAgICAgICAgICAgICAgICA9IDB4MDk7IC8qIFRhYiAqL1xudmFyIENIQVJfTElORV9GRUVEICAgICAgICAgICAgPSAweDBBOyAvKiBMRiAqL1xudmFyIENIQVJfU1BBQ0UgICAgICAgICAgICAgICAgPSAweDIwOyAvKiBTcGFjZSAqL1xudmFyIENIQVJfRVhDTEFNQVRJT04gICAgICAgICAgPSAweDIxOyAvKiAhICovXG52YXIgQ0hBUl9ET1VCTEVfUVVPVEUgICAgICAgICA9IDB4MjI7IC8qIFwiICovXG52YXIgQ0hBUl9TSEFSUCAgICAgICAgICAgICAgICA9IDB4MjM7IC8qICMgKi9cbnZhciBDSEFSX1BFUkNFTlQgICAgICAgICAgICAgID0gMHgyNTsgLyogJSAqL1xudmFyIENIQVJfQU1QRVJTQU5EICAgICAgICAgICAgPSAweDI2OyAvKiAmICovXG52YXIgQ0hBUl9TSU5HTEVfUVVPVEUgICAgICAgICA9IDB4Mjc7IC8qICcgKi9cbnZhciBDSEFSX0FTVEVSSVNLICAgICAgICAgICAgID0gMHgyQTsgLyogKiAqL1xudmFyIENIQVJfQ09NTUE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vO1xudmFyIFBBVFRFUk5fTk9OX0FTQ0lJX0xJTkVfQlJFQUtTID0gL1tcXHg4NVxcdTIwMjhcXHUyMDI5XS87XG52YXIgUEFUVEVSTl9GTE9XX0lORElDQVRPUlMgICAgICAgPSAvWyxcXFtcXF1cXHtcXH1dLztcbnZhciBQQVRURVJOX1RBR19IQU5ETEUgICAgICAgICAgICA9IC9eKD86IXwhIXwhW2EtelxcLV0rISkkL2k7XG52YXIgUEFUVEVSTl9UQUdfVVJJICAgICAgICAgICAgICAgPSAvXig/OiF8W14sXFxbXFxdXFx7XFx9XSkoPzolWzAtOWEtZl17Mn18WzAtOWEtelxcLSM7XFwvXFw/OkAmPVxcK1xcJCxfXFwuIX5cXConXFwoXFwpXFxbXFxdXSkqJC9pO1xuXG5cbmZ1bmN0aW9uIGlzX0VPTChjKSB7XG4gIHJldHVybiAoYyA9PT0gMHgwQS8qIExGICovKSB8fCAoYyA9PT0gMHgwRC8qIENSICovKTtcbn1cblxuZnVuY3Rpb24gaXNfV0hJVEVfU1BBQ0UoYykge1xuICByZXR1cm4gKGMgPT09IDB4MDkvKiBUYWIgKi8pIHx8IChjID09PSAweDIwLyogU3BhY2UgKi8pO1xufVxuXG5mdW5jdGlvbiBpc19XU19PUl9FT0woYykge1xuICByZXR1cm4gKGMgPT09IDB4MDkvKiBUYWIgKi8pIHx8XG4gICAgICAgICAoYyA9PT0gMHgyMC8qIFNwYWNlICovKSB8fFxuICAgICAgICAgKGMgPT09IDB4MEEvKiBMRiAqLykgfHxcbiAgICAgICAgIChjID09PSAweDBELyogQ1IgKi8pO1xufVxuXG5mdW5jdGlvbiBpc19GTE9XX0lORElDQVRPUihjKSB7XG4gIHJldHVybiBjID09PSAweDJDLyogLCAqLyB8fFxuICAgICAgICAgYyA9PT0gMHg1Qi8qIFsgKi8gfHxcbiAgICAgICAgIGMgPT09IDB4NUQvKiBdICovIHx8XG4gICAgICAgICBjID09PSAweDdCLyogeyAqLyB8fFxuICAgICAgICAgYyA9PT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ICBjb25zdHJ1Y3Q6IGNvbnN0cnVjdFlhbWxTZXRcbn0pO1xuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgVHlwZSA9IHJlcXVpcmUoJy4uL3R5cGUnKTtcblxubW9kdWxlLmV4cG9ydHMgPSBuZXcgVHlwZSgndGFnOnlhbWwub3JnLDIwMDI6c3RyJywge1xuICBraW5kOiAnc2NhbGFyJyxcbiAgY29uc3RydWN0OiBmdW5jdGlvbiAoZGF0YSkgeyByZXR1cm4gZGF0YSAhPT0gbnVsbCA/IGRhdGEgOiAnJzsgfVxufSk7XG4iLCIndXNlIHN0cmljdCc7XG5cbnZhciBUeXBlID0gcmVxdWlyZSgnLi4vdHlwZScpO1xuXG52YXIgWUFNTF9EQVRFX1JFR0VYUCA9IG5ldyBSZWdFeHAoXG4gICdeKFswLTldWzAtOV1bMC05XVswLTldKScgICAgICAgICAgKyAvLyBbMV0geWVhclxuICAnLShbMC05XVswLTldKScgICAgICAgICAgICAgICAgICAgICsgLy8gWzJdIG1vbnRoXG4gICctKFswLTldWzAtOV0pJCcpOyAgICAgICAgICAgICAgICAgICAvLyBbM10gZGF5XG5cbnZhciBZQU1MX1RJTUVTVEFNUF9SRUdFWFAgPSBuZXcgUmVnRXhwKFxuICAnXihbMC05XVswLTldWzAtOV1bMC05XSknICAgICAgICAgICsgLy8gWzFdIHllYXJcbiAgJy0oWzAtOV1bMC05XT8pJyAgICAgICAgICAgICAgICAgICArIC8vIFsyXSBtb250aFxuICAnLShbMC05XVswLTldPyknICAgICAgICAgICAgICAgICAgICsgLy8gWzNdIGRheVxuICAnKD86W1R0XXxbIFxcXFx0XSspJyAgICAgICAgICAgICAgICAgKyAvLyAuLi5cbiAgJyhbMC05XVswLTldPyknICAgICAgICAgICAgICAgICAgICArIC8vIFs0XSBob3VyXG4gICc6KFswLTldWzAtOV0pJyAgICAgICAgICAgICAgICAgICAgKyAvLyBbNV0gbWludXRlXG4gICc6KFswLTldWzAtOV0pJyAgICAgICAgICAg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LmxvY2F0aW9uKSArICcjJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocmVmRGV0YWlscy51cmkuaW5kZXhPZignIycpID4gLTEgP1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmRGV0YWlscy51cmkuc3BsaXQoJyMnKVsxXSA6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJyk7XG5cbiAgICAgIC8vIFJlY29yZCByZWZlcmVuY2UgbWV0YWRhdGFcbiAgICAgIG1ldGFkYXRhLnJlZnNbcmVmS2V5XSA9IHJlZkRldGFpbHM7XG5cbiAgICAgIC8vIERvIG5vdCBwcm9jZXNzIGludmFsaWQgcmVmZXJlbmNlc1xuICAgICAgaWYgKCFpc1ZhbGlkKHJlZkRldGFpbHMpKSB7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgLy8gUmVjb3JkIGRlcGVuZGVuY3kgKHJlbGF0aXZlIHRvIHRoZSBkb2N1bWVudCdzIHN1Yi1kb2N1bWVudCBwYXRoKVxuICAgICAgbWV0YWRhdGEuZGVwc1tkb2NEZXBLZXldW3JlZlB0ciA9PT0gc3ViRG9jUHRyID8gJyMnIDogcmVmUHRyLnJlcGxhY2Uoc3ViRG9jUHRyICsgJy8nLCAnIy8nKV0gPSByZWZkS2V5O1xuXG4gICAgICAvLyBEbyBub3QgcHJvY2VzcyBkaXJlY3RseS1jaXJjdWxhciByZWZlcmVuY2VzICh0byBhbiBhbmNlc3RvciBvciBzZWxmKVxuICAgICAgaWYgKHJlZktleS5pbmRleE9mKHJlZmRLZXkgKyAnLycpID09PSAwKSB7XG4gICAgICAgIHJlZkRldGFpbHMuY2lyY3VsYXIgPSB0cnVlO1xuXG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cblxuICAgICAgLy8gUHJlcGFyZSB0aGUgb3B0aW9ucyBmb3Igc3Vic2VxdWVudCBwcm9jZXNz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ICAgICAgICAgICAgICAgIC8vIFdlIGhhdmUgbm8gY2FjaGUgc28gd2UgbXVzdCByZXRyaWV2ZSB0aGUgZG9jdW1lbnRcbiAgICAgICAgICAgICAgICByZXR1cm4gZ2V0UmVtb3RlRG9jdW1lbnQockFic0xvY2F0aW9uLCBuT3B0aW9ucylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaChmdW5jdGlvbiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFN0b3JlIHRoZSByZXNwb25zZSBpbiB0aGUgZG9jdW1lbnQgY2FjaGVcbiAgICAgICAgICAgICAgICAgICAgICAgICAgbk1ldGFkYXRhLmRvY3NbckFic0xvY2F0aW9uXSA9IGVycjtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBSZXR1cm4gdGhlIGVycm9yIHRvIGFsbG93IHRoZSBzdWJzZXF1ZW50IGB0aGVuYCB0byBoYW5kbGUgYm90aCBlcnJvcnMgYW5kIHN1Y2Nlc3Nlc1xuICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZXJyO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gV2UgaGF2ZSBhbHJlYWR5IHJldHJpZXZlZCAob3IgYXR0ZW1wdGVkIHRvKSB0aGUgZG9jdW1lbnQgYW5kIHNob3VsZCB1c2UgdGhlIGNhY2hlZCB2ZXJzaW9uIGluIHRoZVxuICAgICAgICAgICAgICAgIC8vIG1ldGFkYXRhIHNpbmNlIGl0IGNvdWxkIGFscmVhZHkgYmUgcHJvY2Vzc2VkIHNvbWUuXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSgpXG4gICAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiByRG9jO1xuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgICAgfShtZXRhZGF0YSwgck9wdGlvbnMpKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGFsbFRhc2tzID0gYWxsVGFza3NcbiAgICAgICAgICAudGhlbihmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQ7XG4gICAgICAgICAgfSk7XG4gICAgICB9XG5cbiAgICAgIC8vIFByb2Nlc3MgdGhlIHJlbW90ZSBkb2N1bWVudCBvciB0aGUgcmVmZXJlbmNlZCBwb3J0aW9uIG9mIHRoZSBsb2NhbCBkb2N1bWVudFxuICAgICAgYWxsVGFza3MgPSBhbGxUYXNrc1xuICAgICAgICAudGhlbihmdW5jdGlvbiAobk1ldGFkYXRhLCBuT3B0aW9ucywgblJlZkRldGFpbHMpIHtcbiAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGRvYykge1xuICAgICAgICAgICAgaWYgKF8uaXNFcnJvcihkb2MpKSB7XG4gICAgICAgICAgICAgIG1hcmtNaXNzaW5nKG5SZWZEZXRhaWxzLCBkb2MpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gV3JhcHBlZCBpbiBhIHRyeS9jYXRjaCBzaW5jZSBmaW5kUmVmcyB0aHJvd3NcbiAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRSZWZNb2RlbChkb2MsIG5PcHRpb25zLCBuTWV0YWRhdGEpXG4gICAgICAgICAgICAgICAgICAuY2F0Y2goZnVuY3Rpb24gKGVycikge1xuICAgICAgICAgICAgICAgICAgICBtYXJrTWlzc2luZyhuUmVmRGV0YWlscywgZXJyKTtcbiAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9IGNhdGNoIChlcnIpIHtcbiAgICAgICAgICAgICAgICBtYXJrTWlzc2luZyhuUmVmRGV0YWlscywgZXJyKTtcbiAgICA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jdWxhcnNcbiAgICAgIF8uZm9yT3duKHJlc3VsdHMuZGVwcywgZnVuY3Rpb24gKHByb3BzLCBub2RlKSB7XG4gICAgICAgIF8uZm9yT3duKHByb3BzLCBmdW5jdGlvbiAoZGVwLCBwcm9wKSB7XG4gICAgICAgICAgdmFyIGlzQ2lyY3VsYXIgPSBmYWxzZTtcbiAgICAgICAgICB2YXIgcmVmUHRyID0gbm9kZSArIHByb3Auc2xpY2UoMSk7XG4gICAgICAgICAgdmFyIHJlZkRldGFpbHMgPSByZXN1bHRzLnJlZnNbbm9kZSArIHByb3Auc2xpY2UoMSldO1xuICAgICAgICAgIHZhciByZW1vdGUgPSBpc1JlbW90ZShyZWZEZXRhaWxzKTtcbiAgICAgICAgICB2YXIgcGF0aEluZGV4O1xuXG4gICAgICAgICAgaWYgKGNpcmN1bGFycy5pbmRleE9mKGRlcCkgPiAtMSkge1xuICAgICAgICAgICAgLy8gRmlndXJlIG91dCBpZiB0aGUgY2lyY3VsYXIgaXMgcGFydCBvZiBhIGNpcmN1bGFyIGNoYWluIG9yIGp1c3QgYSByZWZlcmVuY2UgdG8gYSBjaXJjdWxhclxuICAgICAgICAgICAgY2lyY3VsYXJQYXRocy5mb3JFYWNoKGZ1bmN0aW9uIChwYXRoKSB7XG4gICAgICAgICAgICAgIC8vIFNob3J0IGNpcmN1aXRcbiAgICAgICAgICAgICAgaWYgKGlzQ2lyY3VsYXIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBwYXRoSW5kZXggPSBwYXRoLmluZGV4T2YoZGVwKTtcblxuICAgICAgICAgICAgICBpZiAocGF0aEluZGV4ID4gLTEpIHtcbiAgICAgICAgICAgICAgICAvLyBDaGVjayBlYWNoIHBhdGggc2VnbWVudCB0byBzZWUgaWYgdGhlIHJlZmVyZW5jZSBsb2NhdGlvbiBpcyBiZW5lYXRoIG9uZSBvZiBpdHMgc2VnbWVudHNcbiAgICAgICAgICAgICAgICBwYXRoLmZvckVhY2goZnVuY3Rpb24gKHNlZykge1xuICAgICAgICAgICAgICAgICAgLy8gU2hvcnQgY2lyY3VpdFxuICAgICAgICAgICAgICAgICAgaWYgKGlzQ2lyY3VsYXIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICBpZiAocmVmUHRyLmluZGV4T2Yoc2VnICsgJy8nKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgcmVmZXJlbmNlIGlzIGxvY2FsLCBtYXJrIGl0IGFzIGNpcmN1bGFyIGJ1dCBpZiBpdCdzIGEgcmVtb3RlIHJlZmVyZW5jZSwgb25seSBtYXJrIGl0XG4gICAgICAgICAgICAgICAgICAgIC8vIGNpcmN1bGFyIGlmIHRoZSBtYXRjaGluZyBwYXRoIGlzIHRoZSBsYXN0IHBhdGggc2VnbWVudC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKChyZW1vdGUgJiYgcGF0aEluZGV4ID09PSBwYXRoLmxlbmd0aCAtIDEpIHx8ICFyZW1vdGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpc0NpcmN1bGFyID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoaXNDaXJjdWxhcikge1xuICAgICAgICAgICAgLy8gVXBkYXRlIGFsbCByZWZlcmVuY2VzIGFuZCByZWZlcmVuY2UgZGV0YWlsc1xuICAgICAgICAgICAgcmVmRGV0YWlscy5jaXJjdWxhciA9IHRydWU7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuXG4gICAgICAvLyBSZXNvbHZlIHRoZSByZWZlcmVuY2VzIGluIHJldmVyc2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9IHJlZkRldGFpbHMuZGVmO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICByZWZEZXRhaWxzLnZhbHVlID0gZmluZFZhbHVlKGREb2N1bWVudCwgcGF0aEZyb21QdHIoZGVwUGFydHNbMV0pKTtcbiAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgbWFya01pc3NpbmcocmVmRGV0YWlscywgZXJyKTtcblxuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIC8vIElmIHRoZSByZWZlcmVuY2UgaXMgYXQgdGhlIHJvb3Qgb2YgdGhlIGRvY3VtZW50LCByZXBsYWNlIHRoZSBkb2N1bWVudCBpbiB0aGUgY2FjaGUuICBPdGhlcndpc2UsIHJlcGxhY2VcbiAgICAgICAgICAgICAgLy8gdGhlIHZhbHVlIGluIHRoZSBhcHByb3ByaWF0ZSBsb2NhdGlvbiBpbiB0aGUgZG9jdW1lbnQgY2FjaGUuXG4gICAgICAgICAgICAgIGlmIChwUHRyUGFydHNbMV0gPT09ICcnICYmIHByb3AgPT09ICcjJykge1xuICAgICAgICAgICAgICAgIHJlc3VsdHMuZG9jc1twUHRyUGFydHNbMF1dID0gcmVmRGV0YWlscy52YWx1ZTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZXRWYWx1ZShwRG9jdW1lbnQsIGRQdHJQYXRoLCByZWZEZXRhaWxzLnZhbHVlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9KTtcblxuICAgICAgZnVuY3Rpb24gd2Fsa1JlZnMgKHJvb3QsIHJlZlB0ciwgcmVmUGF0aCkge1xuICAgICAgICB2YXIgcmVmUHRyUGFydHMgPSByZWZQdHIuc3BsaXQoJyMnKTtcbiAgICA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WxzLmVycm9yLmluZGV4T2YoJyMnKSA+IC0xKSB7XG4gICAgICAgICAgICAgIHJlZkRldGFpbHMuZXJyb3IgPSByZWZEZXRhaWxzLmVycm9yLnJlcGxhY2UocmVmRGV0YWlscy51cmkuc3Vic3RyKHJlZkRldGFpbHMudXJpLmluZGV4T2YoJyMnKSksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmRGV0YWlscy51cmkpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBSZXBvcnQgZXJyb3JzIG9wZW5pbmcgZmlsZXMgYXMgSlNPTiBQb2ludGVyIGVycm9yc1xuICAgICAgICAgICAgaWYgKHJlZkRldGFpbHMuZXJyb3IuaW5kZXhPZignRU5PRU5UOicpID09PSAwIHx8IHJlZkRldGFpbHMuZXJyb3IuaW5kZXhPZignTm90IEZvdW5kJykgPT09IDApIHtcbiAgICAgICAgICAgICAgcmVmRGV0YWlscy5lcnJvciA9ICdKU09OIFBvaW50ZXIgcG9pbnRzIHRvIG1pc3NpbmcgbG9jYXRpb246ICcgKyByZWZEZXRhaWxzLnVyaTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICByZWZEZXBzID0gcmVzdWx0cy5kZXBzW3JlZkRldGFpbHMucmVmZElkXTtcblxuICAgICAgICBpZiAocmVmRGV0YWlscy5yZWZkSWQuaW5kZXhPZihyb290KSAhPT0gMCkge1xuICAgICAgICAgIE9iamVjdC5rZXlzKHJlZkRlcHMpLmZvckVhY2goZnVuY3Rpb24gKHByb3ApIHtcbiAgICAgICAgICAgIHdhbGtSZWZzKHJlZkRldGFpbHMucmVmZElkLCByZWZEZXRhaWxzLnJlZmRJZCArIHByb3Auc3Vic3RyKDEpLCByZWZQYXRoLmNvbmNhdChwYXRoRnJvbVB0cihwcm9wKSkpO1xuICAgICAgICAgIH0pO1xuIC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luZykgOiBbXSxcbiAgICAgICAgICBsZW5ndGggPSByZXN1bHQubGVuZ3RoO1xuXG4gICAgICBmb3IgKHZhciBrZXkgaW4gdmFsdWUpIHtcbiAgICAgICAgaWYgKChpbmhlcml0ZWQgfHwgaGFzT3duUHJvcGVydHkuY2FsbCh2YWx1ZSwga2V5KSkgJiZcbiAgICAgICAgICAgICEoc2tpcEluZGV4ZXMgJiYgKFxuICAgICAgICAgICAgICAgLy8gU2FmYXJpIDkgaGFzIGVudW1lcmFibGUgYGFyZ3VtZW50cy5sZW5ndGhgIGluIHN0cmljdCBtb2RlLlxuICAgICAgICAgICAgICAga2V5ID09ICdsZW5ndGgnIHx8XG4gICAgICAgICAgICAgICAvLyBOb2RlLmpzIDAuMTAgaGFzIGVudW1lcmFibGUgbm9uLWluZGV4IHByb3BlcnRpZXMgb24gYnVmZmVycy5cbiAgICAgICAgICAgICAgIChpc0J1ZmYgJiYgKGtleSA9PSAnb2Zmc2V0JyB8fCBrZXkgPT0gJ3BhcmVudCcpKSB8fFxuICAgICAgICAgICAgICAgLy8gUGhhbnRvbUpTIDIgaGFzIGVudW1lcmFibGUgbm9uLWluZGV4IHByb3BlcnRpZXMgb24gdHlwZWQgYXJyYXlzLlxuICAgICAgICAgICAgICAgKGlzVHlwZSAmJiAoa2V5ID09ICdidWZmZXInIHx8IGtleSA9PSAnYnl0ZUxlbmd0aCcgfHwga2V5ID09ICdieXRlT2Zmc2V0JykpIHx8XG4gICAgICAgICAgICAgICAvLyBTa2lwIGluZGV4IHByb3BlcnRpZXMuXG4gICAgICAgICAgICAgICBpc0luZGV4KGtleSwgbGVuZ3RoKVxuICAgICAgICAgICAgKSkpIHtcbiAgICAgICAgICByZXN1bHQucHVzaChrZXkpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEEgc3BlY2lhbGl6ZWQgdmVyc2lvbiBvZiBgXy5zYW1wbGVgIGZv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WN0ID0gT2JqZWN0KG9iamVjdCk7XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICB2YXIgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIGlmICgobm9DdXN0b21pemVyICYmIGRhdGFbMl0pXG4gICAgICAgICAgICAgID8gZGF0YVsxXSAhPT0gb2JqZWN0W2RhdGFbMF1dXG4gICAgICAgICAgICAgIDogIShkYXRhWzBdIGluIG9iamVjdClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIHZhciBrZXkgPSBkYXRhWzBdLFxuICAgICAgICAgICAgb2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHNyY1ZhbHVlID0gZGF0YVsxXTtcblxuICAgICAgICBpZiAobm9DdXN0b21pemVyICYmIGRhdGFbMl0pIHtcbiAgICAgICAgICBpZiAob2JqVmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhciBzdGFjayA9IG5ldyBTdGFjaztcbiAgICAgICAgICBpZiAoY3VzdG9taXplcikge1xuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IGN1c3RvbWl6ZXIob2JqVmFsdWUsIHNyY1ZhbHVlLCBrZXksIG9iamVjdCwgc291cmNlLCBzdGFjayk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmICghKHJlc3VsdCA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgPyBiYXNlSXNFcXVhbChzcmNWYWx1ZSwgb2JqVmFsdWUsIENPTVBBUkVfUEFSVElBTF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aCAtIDE7XG5cbiAgICAgIHdoaWxlIChsZW5ndGgtLSkge1xuICAgICAgICB2YXIgaW5kZXggPSBpbmRleGVzW2xlbmd0aF07XG4gICAgICAgIGlmIChsZW5ndGggPT0gbGFzdEluZGV4IHx8IGluZGV4ICE9PSBwcmV2aW91cykge1xuICAgICAgICAgIHZhciBwcmV2aW91cyA9IGluZGV4O1xuICAgICAgICAgIGlmIChpc0luZGV4KGluZGV4KSkge1xuICAgICAgICAgICAgc3BsaWNlLmNhbGwoYXJyYXksIGluZGV4LCAxKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgYmFzZVVuc2V0KGFycmF5LCBpbmRleCk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gYXJyYXk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ucmFuZG9tYCB3aXRob3V0IHN1cHBvcnQgZm9yIHJldHVybmluZ1xuICAgICAqIGZsb2F0aW5nLXBvaW50IG51bWJlcnMuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBsb3dlciBUaGUgbG93ZXIgYm91bmQuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IHVwcGVyIFRoZSB1cHBlciBib3VuZC5cbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfSBSZXR1cm5zIHRoZSByYW5kb20gbnVtYmVyLlxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGJhc2VSYW5kb20obG93ZXIsIHVwcGVyKSB7XG4gICAgICByZXR1cm4gbG93ZXIgKyBuYXRpdmVGbG9vcihuYXRpdmVSYW5kb20oKSAqICh1cHBlciAtIGxvd2VyICsgMSkpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLnJhbmdlYCBhbmQgYF8ucmFuZ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0aWVzIHRvLlxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IFtjdXN0b21pemVyXSBUaGUgZnVuY3Rpb24gdG8gY3VzdG9taXplIGNvcGllZCB2YWx1ZXMuXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBjb3B5T2JqZWN0KHNvdXJjZSwgcHJvcHMsIG9iamVjdCwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGlzTmV3ID0gIW9iamVjdDtcbiAgICAgIG9iamVjdCB8fCAob2JqZWN0ID0ge30pO1xuXG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBsZW5ndGggPSBwcm9wcy5sZW5ndGg7XG5cbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgIHZhciBrZXkgPSBwcm9wc1tpbmRleF07XG5cbiAgICAgICAgdmFyIG5ld1ZhbHVlID0gY3VzdG9taXplclxuICAgICAgICAgID8gY3VzdG9taXplcihvYmplY3Rba2V5XSwgc291cmNlW2tleV0sIGtleSwgb2JqZWN0LCBzb3VyY2UpXG4gICAgICAgICAgOiB1bmRlZmluZWQ7XG5cbiAgICAgICAgaWYgKG5ld1ZhbHVlID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICBuZXdWYWx1ZSA9IHNvdXJjZVtrZXldO1xuICAgICAgICB9XG4gICAgICAgIGlmIChpc05ldykge1xuICAgICAgICAgIGJhc2VBc3NpZ25WYWx1ZShvYmplY3QsIGtleSwgbmV3VmFsdWUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGFzc2lnblZhbHVlKG9iamVjdCwga2V5LCBuZXdWYWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29waWVzIG93biBzeW1ib2xzIG9mIGBzb3VyY2VgIHRvIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc291cmNlIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIGZyb20uXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvYmplY3Q9e31dIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIHRvLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29weVN5bWJvbHMoc291cmNlLCBvYmplY3QpIHtcbiAgICAgIHJldHVybiBjb3B5T2JqZWN0KHNvdXJjZSwgZ2V0U3ltYm9scyhzb3VyY2UpLCBvYmplY3QpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENvcGllcyBvd24gYW5kIGluaGVyaXRlZCBzeW1ib2xzIG9mIGBzb3VyY2VgIHRvIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gc291cmNlIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIGZyb20uXG4gICAgICogQHBhcmFtIHtPYmplY3R9IFtvYmplY3Q9e31dIFRoZSBvYmplY3QgdG8gY29weSBzeW1ib2xzIHRvLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gY29weVN5bWJvbHNJbihzb3VyY2UsIG9iamVjdCkge1xuICAgICAgcmV0dXJuIGNvcHlPYmplY3Qoc291cmNlLCBnZXRTeW1ib2xzSW4oc291cmNlKSwgb2JqZWN0KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgZnVuY3Rpb24gbGlrZSBgXy5ncm91cEJ5YC5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtGdW5jdGlvbn0gc2V0dGVy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aW9uKG9iamVjdCwgc291cmNlcykge1xuICAgICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICAgIGxlbmd0aCA9IHNvdXJjZXMubGVuZ3RoLFxuICAgICAgICAgICAgY3VzdG9taXplciA9IGxlbmd0aCA+IDEgPyBzb3VyY2VzW2xlbmd0aCAtIDFdIDogdW5kZWZpbmVkLFxuICAgICAgICAgICAgZ3VhcmQgPSBsZW5ndGggPiAyID8gc291cmNlc1syXSA6IHVuZGVmaW5lZDtcblxuICAgICAgICBjdXN0b21pemVyID0gKGFzc2lnbmVyLmxlbmd0aCA+IDMgJiYgdHlwZW9mIGN1c3RvbWl6ZXIgPT0gJ2Z1bmN0aW9uJylcbiAgICAgICAgICA/IChsZW5ndGgtLSwgY3VzdG9taXplcilcbiAgICAgICAgICA6IHVuZGVmaW5lZDtcblxuICAgICAgICBpZiAoZ3VhcmQgJiYgaXNJdGVyYXRlZUNhbGwoc291cmNlc1swXSwgc291cmNlc1sxXSwgZ3VhcmQpKSB7XG4gICAgICAgICAgY3VzdG9taXplciA9IGxlbmd0aCA8IDMgPyB1bmRlZmluZWQgOiBjdXN0b21pemVyO1xuICAgICAgICAgIGxlbmd0aCA9IDE7XG4gICAgICAgIH1cbiAgICAgICAgb2JqZWN0ID0gT2JqZWN0KG9iamVjdCk7XG4gICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgdmFyIHNvdXJjZSA9IHNvdXJjZXNbaW5kZXhdO1xuICAgICAgICAgIGlmIChzb3VyY2UpIHtcbiAgICAgICAgICAgIGFzc2lnbmVyKG9iamVjdCwgc291cmNlLCBpbmRleCwgY3VzdG9taXplcik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgYGJhc2VFYWNoYCBvciBgYmFzZUVhY2hSaWdodGAgZnVuY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gY3VzdG9taXplcihvdGhWYWx1ZSwgYXJyVmFsdWUsIGluZGV4LCBvdGhlciwgYXJyYXksIHN0YWNrKVxuICAgICAgICAgICAgOiBjdXN0b21pemVyKGFyclZhbHVlLCBvdGhWYWx1ZSwgaW5kZXgsIGFycmF5LCBvdGhlciwgc3RhY2spO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21wYXJlZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgaWYgKGNvbXBhcmVkKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgICAgLy8gUmVjdXJzaXZlbHkgY29tcGFyZSBhcnJheXMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKHNlZW4pIHtcbiAgICAgICAgICBpZiAoIWFycmF5U29tZShvdGhlciwgZnVuY3Rpb24ob3RoVmFsdWUsIG90aEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaWYgKCFjYWNoZUhhcyhzZWVuLCBvdGhJbmRleCkgJiZcbiAgICAgICAgICAgICAgICAgICAgKGFyclZhbHVlID09PSBvdGhWYWx1ZSB8fCBlcXVhbEZ1bmMoYXJyVmFsdWUsIG90aFZhbHVlLCBiaXRtYXNrLCBjdXN0b21pemVyLCBzdGFjaykpKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gc2Vlbi5wdXNoKG90aEluZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0pKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmYWxzZTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmICghKFxuICAgICAgICAgICAgICBhcnJWYWx1ZSA9PT0gb3RoVmFsdWUgfHxcbiAgICAgICAgICAgICAgICBlcX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FMX0ZMQUcsXG4gICAgICAgICAgb2JqUHJvcHMgPSBnZXRBbGxLZXlzKG9iamVjdCksXG4gICAgICAgICAgb2JqTGVuZ3RoID0gb2JqUHJvcHMubGVuZ3RoLFxuICAgICAgICAgIG90aFByb3BzID0gZ2V0QWxsS2V5cyhvdGhlciksXG4gICAgICAgICAgb3RoTGVuZ3RoID0gb3RoUHJvcHMubGVuZ3RoO1xuXG4gICAgICBpZiAob2JqTGVuZ3RoICE9IG90aExlbmd0aCAmJiAhaXNQYXJ0aWFsKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cbiAgICAgIHZhciBpbmRleCA9IG9iakxlbmd0aDtcbiAgICAgIHdoaWxlIChpbmRleC0tKSB7XG4gICAgICAgIHZhciBrZXkgPSBvYmpQcm9wc1tpbmRleF07XG4gICAgICAgIGlmICghKGlzUGFydGlhbCA/IGtleSBpbiBvdGhlciA6IGhhc093blByb3BlcnR5LmNhbGwob3RoZXIsIGtleSkpKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAvLyBBc3N1bWUgY3ljbGljIHZhbHVlcyBhcmUgZXF1YWwuXG4gICAgICB2YXIgc3RhY2tlZCA9IHN0YWNrLmdldChvYmplY3QpO1xuICAgICAgaWYgKHN0YWNrZWQgJiYgc3RhY2suZ2V0KG90aGVyKSkge1xuICAgICAgICByZXR1cm4gc3RhY2tlZCA9PSBvdGhlcjtcbiAgICAgIH1cbiAgICAgIHZhciByZXN1bHQgPSB0cnVlO1xuICAgICAgc3RhY2suc2V0KG9iamVjdCwgb3RoZXIpO1xuICAgICAgc3RhY2suc2V0KG90aGVyLCBvYmplY3QpO1xuXG4gICAgICB2YXIgc2tpcEN0b3IgPSBpc1BhcnRpYWw7XG4gICAgICB3aGlsZSAoKytpbmRleCA8IG9iakxlbmd0aCkge1xuICAgICAgICBrZXkgPSBvYmpQcm9wc1tpbmRleF07XG4gICAgICAgIHZhci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lbnRzLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMiwgMywgNF07XG4gICAgICogdmFyIGV2ZW5zID0gXy5yZW1vdmUoYXJyYXksIGZ1bmN0aW9uKG4pIHtcbiAgICAgKiAgIHJldHVybiBuICUgMiA9PSAwO1xuICAgICAqIH0pO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAzXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coZXZlbnMpO1xuICAgICAqIC8vID0+IFsyLCA0XVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHJlbW92ZShhcnJheSwgcHJlZGljYXRlKSB7XG4gICAgICB2YXIgcmVzdWx0ID0gW107XG4gICAgICBpZiAoIShhcnJheSAmJiBhcnJheS5sZW5ndGgpKSB7XG4gICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBpbmRleGVzID0gW10sXG4gICAgICAgICAgbGVuZ3RoID0gYXJyYXkubGVuZ3RoO1xuXG4gICAgICBwcmVkaWNhdGUgPSBnZXRJdGVyYXRlZShwcmVkaWNhdGUsIDMpO1xuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgdmFyIHZhbHVlID0gYXJyYXlbaW5kZXhdO1xuICAgICAgICBpZiAocHJlZGljYXRlKHZhbHVlLCBpbmRleCwgYXJyYXkpKSB7XG4gICAgICAgICAgcmVzdWx0LnB1c2godmFsdWUpO1xuICAgICAgICAgIGluZGV4ZXMucHVzaChpbmRleCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGJhc2VQdWxsQXQoYXJyYXksIGluZGV4ZXMpO1xuICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXZlcnNlcyBgYXJyYXlgIHNvIHRo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ugd2l0aG91dCBleHBsaWNpdCBjaGFpbmluZy5cbiAgICAgKiBfKHVzZXJzKS5oZWFkKCk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknLCAnYWdlJzogMzYgfVxuICAgICAqXG4gICAgICogLy8gQSBzZXF1ZW5jZSB3aXRoIGV4cGxpY2l0IGNoYWluaW5nLlxuICAgICAqIF8odXNlcnMpXG4gICAgICogICAuY2hhaW4oKVxuICAgICAqICAgLmhlYWQoKVxuICAgICAqICAgLnBpY2soJ3VzZXInKVxuICAgICAqICAgLnZhbHVlKCk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknIH1cbiAgICAgKi9cbiAgICBmdW5jdGlvbiB3cmFwcGVyQ2hhaW4oKSB7XG4gICAgICByZXR1cm4gY2hhaW4odGhpcyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRXhlY3V0ZXMgdGhlIGNoYWluIHNlcXVlbmNlIGFuZCByZXR1cm5zIHRoZSB3cmFwcGVkIHJlc3VsdC5cbiAgICAgKlxuICAgICAqIEBuYW1lIGNvbW1pdFxuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDMuMi4wXG4gICAgICogQGNhdGVnb3J5IFNlcVxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgdGhlIG5ldyBgbG9kYXNoYCB3cmFwcGVyIGluc3RhbmNlLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiB2YXIgYXJyYXkgPSBbMSwgMl07XG4gICAgICogdmFyIHdyYXBwZWQgPSBfKGFycmF5KS5wdXNoKDMpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAyXVxuICAgICAqXG4gICAgICogd3JhcHBlZCA9IHdyYXBwZWQuY29tbWl0KCk7XG4gICAgICogY29uc29sZS5sb2coYXJyYXkpO1xuICAgICAqIC8vID0+IFsxLCAyLCAzXVxuIC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0aW1lID0gbm93KCksXG4gICAgICAgICAgICBpc0ludm9raW5nID0gc2hvdWxkSW52b2tlKHRpbWUpO1xuXG4gICAgICAgIGxhc3RBcmdzID0gYXJndW1lbnRzO1xuICAgICAgICBsYXN0VGhpcyA9IHRoaXM7XG4gICAgICAgIGxhc3RDYWxsVGltZSA9IHRpbWU7XG5cbiAgICAgICAgaWYgKGlzSW52b2tpbmcpIHtcbiAgICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICByZXR1cm4gbGVhZGluZ0VkZ2UobGFzdENhbGxUaW1lKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG1heGluZykge1xuICAgICAgICAgICAgLy8gSGFuZGxlIGludm9jYXRpb25zIGluIGEgdGlnaHQgbG9vcC5cbiAgICAgICAgICAgIHRpbWVySWQgPSBzZXRUaW1lb3V0KHRpbWVyRXhwaXJlZCwgd2FpdCk7XG4gICAgICAgICAgICByZXR1cm4gaW52b2tlRnVuYyhsYXN0Q2FsbFRpbWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGltZXJJZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgdGltZXJJZCA9IHNldFRpbWVvdXQodGltZXJFeHBpcmVkLCB3YWl0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgfVxuICAgICAgZGVib3VuY2VkLmNhbmNlbCA9IGNhbmNlbDtcbiAgICAgIGRlYm91bmNlZC5mbHVzaCA9IGZsdXNoO1xuICAgICAgcmV0dXJuIGRlYm91bmNlZDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBEZWZlcnMgaW52b2tpbmcgdGhlIGBmdW5jYCB1bnRpbCB0aGUgY3VycmVudCBjYWxsIHN0YWNrIGhhcyBjbGVhcmVkLiBBbnlcbiAgICAgKiBhZGRpdGlvbmFsIGFyZ3VtZW50cyBhcmUgcHJvdmlkZW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gICAqXG4gICAgICogXy5sdGUoMSwgMyk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqXG4gICAgICogXy5sdGUoMywgMyk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqXG4gICAgICogXy5sdGUoMywgMSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICB2YXIgbHRlID0gY3JlYXRlUmVsYXRpb25hbE9wZXJhdGlvbihmdW5jdGlvbih2YWx1ZSwgb3RoZXIpIHtcbiAgICAgIHJldHVybiB2YWx1ZSA8PSBvdGhlcjtcbiAgICB9KTtcblxuICAgIC8qKlxuICAgICAqIENvbnZlcnRzIGB2YWx1ZWAgdG8gYW4gYXJyYXkuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQHNpbmNlIDAuMS4wXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgTGFuZ1xuICAgICAqIEBwYXJhbSB7Kn0gdmFsdWUgVGhlIHZhbHVlIHRvIGNvbnZlcnQuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBjb252ZXJ0ZWQgYXJyYXkuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udG9BcnJheSh7ICdhJzogMSwgJ2InOiAyIH0pO1xuICAgICAqIC8vID0+IFsxLCAyXVxuICAgICAqXG4gICAgICogXy50b0FycmF5KCdhYmMnKTtcbiAgICAgKiAvLyA9PiBbJ2EnLCAnYicsICdjJ11cbiAgICAgKlxuICAgICAqIF8udG9BcnJheSgxKTtcbiAgICAgKiAvLyA9PiBbXVxuICAgICAqXG4gICAgICogXy50b0FycmF5KG51bGwpO1xuICAgICAqIC8vID0+IFtdXG4gICAgICovXG4gICAgZnVuY3Rpb24gdG9BcnJheSh2YWx1ZSkge1xuICAgICAgaWYgKCF2YWx1ZSkge1xuICAgICAgICByZXR1cm4gW107XG4gICAgICB9XG4gICAgICBpZiAoaXNBcnJhe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kgdmFsdWVzLlxuICAgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiBGb28oKSB7XG4gICAgICogICB0aGlzLmEgPSAxO1xuICAgICAqICAgdGhpcy5iID0gMjtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBGb28ucHJvdG90eXBlLmMgPSAzO1xuICAgICAqXG4gICAgICogXy52YWx1ZXMobmV3IEZvbyk7XG4gICAgICogLy8gPT4gWzEsIDJdIChpdGVyYXRpb24gb3JkZXIgaXMgbm90IGd1YXJhbnRlZWQpXG4gICAgICpcbiAgICAgKiBfLnZhbHVlcygnaGknKTtcbiAgICAgKiAvLyA9PiBbJ2gnLCAnaSddXG4gICAgICovXG4gICAgZnVuY3Rpb24gdmFsdWVzKG9iamVjdCkge1xuICAgICAgcmV0dXJuIG9iamVjdCA9PSBudWxsID8gW10gOiBiYXNlVmFsdWVzKG9iamVjdCwga2V5cyhvYmplY3QpKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGFuIGFycmF5IG9mIHRoZSBvd24gYW5kIGluaGVyaXRlZCBlbnVtZXJhYmxlIHN0cmluZyBrZXllZCBwcm9wZXJ0eVxuICAgICAqIHZhbHVlcyBvZiBgb2JqZWN0YC5cbiAgICAgKlxuICAgICAqICoqTm90ZToqKiBOb24tb2JqZWN0IHZhbHVlcyBhcmUgY29lcmNlZCB0byBvYmplY3RzLlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDMuMC4wXG4gICAgICogQGNhdGVnb3J5IE9iamVjdFxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvYmplY3QgVGhlIG9iamVjdCB0byBxdWVyeS5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIGFycmF5IG9mIHByb3BlcnR5IHZhbHVlcy5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogZn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ICAgICAgICAgIGZsb2F0aW5nID0gdXBwZXI7XG4gICAgICAgICAgdXBwZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodHlwZW9mIGxvd2VyID09ICdib29sZWFuJykge1xuICAgICAgICAgIGZsb2F0aW5nID0gbG93ZXI7XG4gICAgICAgICAgbG93ZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGlmIChsb3dlciA9PT0gdW5kZWZpbmVkICYmIHVwcGVyID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgbG93ZXIgPSAwO1xuICAgICAgICB1cHBlciA9IDE7XG4gICAgICB9XG4gICAgICBlbHNlIHtcbiAgICAgICAgbG93ZXIgPSB0b0Zpbml0ZShsb3dlcik7XG4gICAgICAgIGlmICh1cHBlciA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgdXBwZXIgPSBsb3dlcjtcbiAgICAgICAgICBsb3dlciA9IDA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdXBwZXIgPSB0b0Zpbml0ZSh1cHBlcik7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGlmIChsb3dlciA+IHVwcGVyKSB7XG4gICAgICAgIHZhciB0ZW1wID0gbG93ZXI7XG4gICAgICAgIGxvd2VyID0gdXBwZXI7XG4gICAgICAgIHVwcGVyID0gdGVtcDtcbiAgICAgIH1cbiAgICAgIGlmIChmbG9hdGluZyB8fCBsb3dlciAlIDEgfHwgdXBwZXIgJSAxKSB7XG4gICAgICAgIHZhciByYW5kID0gbmF0aXZlUmFuZG9tKCk7XG4gICAgICAgIHJldHVybiBuYXRpdmVNaW4obG93ZXIgKyAocmFuZCAqICh1cHBlciAtIGxvd2VyICsgZnJlZVBhcnNlRmxvYXQoJzFlLScgKyAoKHJhbmQgKyAnJykubGVuZ3RoIC0gMSkpKSksIHVwcGVyKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBiY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lxuICAgICAgc291cmNlID0gKGlzRXZhbHVhdGluZyA/IHNvdXJjZS5yZXBsYWNlKHJlRW1wdHlTdHJpbmdMZWFkaW5nLCAnJykgOiBzb3VyY2UpXG4gICAgICAgIC5yZXBsYWNlKHJlRW1wdHlTdHJpbmdNaWRkbGUsICckMScpXG4gICAgICAgIC5yZXBsYWNlKHJlRW1wdHlTdHJpbmdUcmFpbGluZywgJyQxOycpO1xuXG4gICAgICAvLyBGcmFtZSBjb2RlIGFzIHRoZSBmdW5jdGlvbiBib2R5LlxuICAgICAgc291cmNlID0gJ2Z1bmN0aW9uKCcgKyAodmFyaWFibGUgfHwgJ29iaicpICsgJykge1xcbicgK1xuICAgICAgICAodmFyaWFibGVcbiAgICAgICAgICA/ICcnXG4gICAgICAgICAgOiAnb2JqIHx8IChvYmogPSB7fSk7XFxuJ1xuICAgICAgICApICtcbiAgICAgICAgXCJ2YXIgX190LCBfX3AgPSAnJ1wiICtcbiAgICAgICAgKGlzRXNjYXBpbmdcbiAgICAgICAgICAgPyAnLCBfX2UgPSBfLmVzY2FwZSdcbiAgICAgICAgICAgOiAnJ1xuICAgICAgICApICtcbiAgICAgICAgKGlzRXZhbHVhdGluZ1xuICAgICAgICAgID8gJywgX19qID0gQXJyYXkucHJvdG90eXBlLmpvaW47XFxuJyArXG4gICAgICAgICAgICBcImZ1bmN0aW9uIHByaW50KCkgeyBfX3AgKz0gX19qLmNhbGwoYXJndW1lbnRzLCAnJykgfVxcblwiXG4gICAgICAgICAgOiAnO1xcbidcbiAgICAgICAgKSArXG4gICAgICAgIHNvdXJjZSArXG4gICAgICAgICdyZXR1cm4gX19wXFxufSc7XG5cbiAgICAgIHZhciByZXN1bHQgPSBhdHRlbXB0KGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gRnVuY3Rpb24oaW1wb3J0c0tleXMsIHNvdXJjZVVSTCArICdyZXR1cm4gJyArIHNvdXJjZSlcbiAgICAgICAgICAuYXBwbHkodW5kZWZpbmVkLCBp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iAgICAgICAgb2JqZWN0W21ldGhvZE5hbWVdID0gZnVuYztcbiAgICAgICAgaWYgKGlzRnVuYykge1xuICAgICAgICAgIG9iamVjdC5wcm90b3R5cGVbbWV0aG9kTmFtZV0gPSBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBjaGFpbkFsbCA9IHRoaXMuX19jaGFpbl9fO1xuICAgICAgICAgICAgaWYgKGNoYWluIHx8IGNoYWluQWxsKSB7XG4gICAgICAgICAgICAgIHZhciByZXN1bHQgPSBvYmplY3QodGhpcy5fX3dyYXBwZWRfXyksXG4gICAgICAgICAgICAgICAgICBhY3Rpb25zID0gcmVzdWx0Ll9fYWN0aW9uc19fID0gY29weUFycmF5KHRoaXMuX19hY3Rpb25zX18pO1xuXG4gICAgICAgICAgICAgIGFjdGlvbnMucHVzaCh7ICdmdW5jJzogZnVuYywgJ2FyZ3MnOiBhcmd1bWVudHMsICd0aGlzQXJnJzogb2JqZWN0IH0pO1xuICAgICAgICAgICAgICByZXN1bHQuX19jaGFpbl9fID0gY2hhaW5BbGw7XG4gICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZnVuYy5hcHBseShvYmplY3QsIGFycmF5UHVzaChbdGhpcy52YWx1ZSgpXSwgYXJndW1lbnRzKSk7XG4gICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUmV2ZXJ0cyB0aGUgYF9gIHZhcmlhYmxlIHRvIGl0cyBwcmV2aW91cyB2YWx1ZSBhbmQgcmV0dXJucyBhIHJlZmVyZW5jZSB0b1xuICAgICAqIHRoZSBgbG9kYXNoYCBmdW5jdGlvbi5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAc2luY2UgMC4xLjBcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBjYX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odCgxLCA1KTtcbiAgICAgKiAvLyA9PiBbNCwgMywgMiwgMV1cbiAgICAgKlxuICAgICAqIF8ucmFuZ2VSaWdodCgwLCAyMCwgNSk7XG4gICAgICogLy8gPT4gWzE1LCAxMCwgNSwgMF1cbiAgICAgKlxuICAgICAqIF8ucmFuZ2VSaWdodCgwLCAtNCwgLTEpO1xuICAgICAqIC8vID0+IFstMywgLTIsIC0xLCAwXVxuICAgICAqXG4gICAgICogXy5yYW5nZVJpZ2h0KDEsIDQsIDApO1xuICAgICAqIC8vID0+IFsxLCAxLCAxXVxuICAgICAqXG4gICAgICogXy5yYW5nZVJpZ2h0KDApO1xuICAgICAqIC8vID0+IFtdXG4gICAgICovXG4gICAgdmFyIHJhbmdlUmlnaHQgPSBjcmVhdGVSYW5nZSh0cnVlKTtcblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYSBuZXcgZW1wdHkgYXJyYXkuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAc2luY2UgNC4xMy4wXG4gICAgICogQGNhdGVnb3J5IFV0aWxcbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIG5ldyBlbXB0eSBhcnJheS5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIGFycmF5cyA9IF8udGltZXMoMiwgXy5zdHViQXJyYXkpO1xuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzKTtcbiAgICAgKiAvLyA9PiBbW10sIFtdXVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2coYXJyYXlzWzBdID09PSBhcnJheXNbMV0pO1xuICAgICAqIC8vID0+IGZhbHNlXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkFycmF5KCkge1xuICAgICAgcmV0dXJuIFtdO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYGZhbHNlYC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBzaW5jZSA0LjEzLjBcbiAgICAgKiBAY2F0ZWdvcnkgVXRpbFxuICAgICAqIEByZXR1cm5zIHtib29sZWFufSBSZXR1cm5zIGBmYWxzZWAuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udGltZXMoMiwgXy5zdHViRmFsc2UpO1xuICAgICAqIC8vID0+IFtmYWxzZSwgZmFsc2VdXG4gICAgICovXG4gICAgZnVuY3Rpb24gc3R1YkZhbHNlKCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYSBuZXcgZW1wdHkgb2JqZWN0LlxuICAgICAqXG4gICAgICogQHN0YXRpY1xuICAgICAqIEBtZW1iZXJPZiBfXG4gICAgICogQHNpbmNlIDQuMTMuMFxuICAgICAqIEBjYXRlZ29yeSBVdGlsXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgbmV3IGVtcHR5IG9iamVjdC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIG9iamVjdHMgPSBfLnRpbWVzKDIsIF8uc3R1Yk9iamVjdCk7XG4gICAgICpcbiAgICAgKiBjb25zb2xlLmxvZyhvYmplY3RzKTtcbiAgICAgKiAvLyA9PiBbe30sIHt9XVxuICAgICAqXG4gICAgICogY29uc29sZS5sb2cob2JqZWN0c1swXSA9PT0gb2JqZWN0c1sxXSk7XG4gICAgICogLy8gPT4gZmFsc2VcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzdHViT2JqZWN0KCkge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoaXMgbWV0aG9kIHJldHVybnMgYW4gZW1wdHkgc3RyaW5nLlxuICAgICAqXG4gICAgICogQHN0YXRpY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CB8IDA7XG4gICAgICAgIGEgID0gKGEgPDwgNiB8IGEgPj4+IDI2KSArIGIgfCAwO1xuICAgICAgICBkICs9IChiIF4gKGEgfCB+YykpICsga1sxMV0gLSAxMTIwMjEwMzc5IHwgMDtcbiAgICAgICAgZCAgPSAoZCA8PCAxMCB8IGQgPj4+IDIyKSArIGEgfCAwO1xuICAgICAgICBjICs9IChhIF4gKGQgfCB+YikpICsga1syXSArIDcxODc4NzI1OSB8IDA7XG4gICAgICAgIGMgID0gKGMgPDwgMTUgfCBjID4+PiAxNykgKyBkIHwgMDtcbiAgICAgICAgYiArPSAoZCBeIChjIHwgfmEpKSArIGtbOV0gLSAzNDM0ODU1NTEgfCAwO1xuICAgICAgICBiICA9IChiIDw8IDIxIHwgYiA+Pj4gMTEpICsgYyB8IDA7XG5cbiAgICAgICAgeFswXSA9IGEgKyB4WzBdIHwgMDtcbiAgICAgICAgeFsxXSA9IGIgKyB4WzFdIHwgMDtcbiAgICAgICAgeFsyXSA9IGMgKyB4WzJdIHwgMDtcbiAgICAgICAgeFszXSA9IGQgKyB4WzNdIHwgMDtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBtZDVibGsocykge1xuICAgICAgICB2YXIgbWQ1YmxrcyA9IFtdLFxuICAgICAgICAgICAgaTsgLyogQW5keSBLaW5nIHNhaWQgZG8gaXQgdGhpcyB3YXkuICovXG5cbiAgICAgICAgZm9yIChpID0gMDsgaSA8IDY0OyBpICs9IDQpIHtcbiAgICAgICAgICAgIG1kNWJsa3NbaSA+PiAyXSA9IHMuY2hhckNvZGVBdChpKSArIChzLmNoYXJDb2RlQXQoaSArIDEpIDw8IDgpICsgKHMuY2hhckNvZGVBdChpICsgMikgPDwgMTYpICsgKHMuY2hhckNvZGVBdChpICsgMykgPDwgMjQpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBtZDVibGtzO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIG1kNWJsa19hcnJheShhKSB7XG4gICAgICAgIHZhciB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gICBmb3IgKGkgPSAwOyBpIDwgMTY7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgIHRhaWxbaV0gPSAwO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gQmV3YXJlIHRoYXQgdGhlIGZpbmFsIGxlbmd0aCBtaWdodCBub3QgZml0IGluIDMyIGJpdHMgc28gd2UgdGFrZSBjYXJlIG9mIHRoYXRcbiAgICAgICAgdG1wID0gbiAqIDg7XG4gICAgICAgIHRtcCA9IHRtcC50b1N0cmluZygxNikubWF0Y2goLyguKj8pKC57MCw4fSkkLyk7XG4gICAgICAgIGxvID0gcGFyc2VJbnQodG1wWzJdLCAxNik7XG4gICAgICAgIGhpID0gcGFyc2VJbnQodG1wWzFdLCAxNikgfHwgMDtcblxuICAgICAgICB0YWlsWzE0XSA9IGxvO1xuICAgICAgICB0YWlsWzE1XSA9IGhpO1xuXG4gICAgICAgIG1kNWN5Y2xlKHN0YXRlLCB0YWlsKTtcblxuICAgICAgICByZXR1cm4gc3RhdGU7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gcmhleChuKSB7XG4gICAgICAgIHZhciBzID0gJycsXG4gICAgICAgICAgICBqO1xuICAgICAgICBmb3IgKGogPSAwOyBqIDwgNDsgaiArPSAxKSB7XG4gICAgICAgICAgICBzICs9IGhleF9jaHJbKG4gPj4gKGogKiA4ICsgNCkpICYgMHgwRl0gKyBoZXhfY2hyWyhuID4+IChqICogOCkpICYgMHgwRl07XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHM7XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gaGV4KHgpIHtcbiAgICAgICAgdmFyIGk7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCB4Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICB4W2ldID0gcmhleCh4W2ldKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4geC5qb2luKCcnKTtcbiAgICB9XG5cbiAgICAvLyBJbi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AgICAgIHJldHVybiBNYXRoLm1pbih2YWwsIGxlbmd0aCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIEFycmF5QnVmZmVyLnByb3RvdHlwZS5zbGljZSA9IGZ1bmN0aW9uIChmcm9tLCB0bykge1xuICAgICAgICAgICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmJ5dGVMZW5ndGgsXG4gICAgICAgICAgICAgICAgICAgIGJlZ2luID0gY2xhbXAoZnJvbSwgbGVuZ3RoKSxcbiAgICAgICAgICAgICAgICAgICAgZW5kID0gbGVuZ3RoLFxuICAgICAgICAgICAgICAgICAgICBudW0sXG4gICAgICAgICAgICAgICAgICAgIHRhcmdldCxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0QXJyYXksXG4gICAgICAgICAgICAgICAgICAgIHNvdXJjZUFycmF5O1xuXG4gICAgICAgICAgICAgICAgaWYgKHRvICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZW5kID0gY2xhbXAodG8sIGxlbmd0aCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKGJlZ2luID4gZW5kKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQXJyYXlCdWZmZXIoMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgbnVtID0gZW5kIC0gYmVnaW47XG4gICAgICAgICAgICAgICAgdGFyZ2V0ID0gbmV3IEFycmF5QnVmZmVyKG51bSk7XG4gICAgICAgICAgICAgICAgdGFyZ2V0QXJyYXkgPSBuZXcgVWludDhBcnJheSh0YXJnZXQpO1xuXG4gICAgICAgICAgICAgICAgc291cmNlQXJyYXkgPSBuZXcgVWludDhBcnJheSh0aGlzLCBiZWdpbiwgbnVtKTtcbiAgICAgICAgICAgICAgICB0YXJnZXRBcnJheS5zZXQoc291cmNlQXJyYXkpO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRhcmdldDtcbiA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V0aG9kOiB0aGlzLm1ldGhvZCxcbiAgICB1cmw6IHRoaXMudXJsLFxuICAgIGRhdGE6IHRoaXMuX2RhdGEsXG4gICAgaGVhZGVyczogdGhpcy5faGVhZGVyLFxuICB9O1xufTtcblxuLyoqXG4gKiBTZW5kIGBkYXRhYCBhcyB0aGUgcmVxdWVzdCBib2R5LCBkZWZhdWx0aW5nIHRoZSBgLnR5cGUoKWAgdG8gXCJqc29uXCIgd2hlblxuICogYW4gb2JqZWN0IGlzIGdpdmVuLlxuICpcbiAqIEV4YW1wbGVzOlxuICpcbiAqICAgICAgIC8vIG1hbnVhbCBqc29uXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2pzb24nKVxuICogICAgICAgICAuc2VuZCgne1wibmFtZVwiOlwidGpcIn0nKVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGF1dG8ganNvblxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIG1hbnVhbCB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKCduYW1lPXRqJylcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC50eXBlKCdmb3JtJylcbiAqICAgICAgICAgLnNlbmQoeyBuYW1lOiAndGonIH0pXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gZGVmYXV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uICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBhcmVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGlmIChwYXJlbnRzW2ldID09PSBzcmMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZXNbaV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgXG4gICAgICAgIGlmICh0eXBlb2Ygc3JjID09PSAnb2JqZWN0JyAmJiBzcmMgIT09IG51bGwpIHtcbiAgICAgICAgICAgIHZhciBkc3QgPSBjb3B5KHNyYyk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIHBhcmVudHMucHVzaChzcmMpO1xuICAgICAgICAgICAgbm9kZXMucHVzaChkc3QpO1xuICAgICAgICAgICAgXG4gICAgICAgICAgICBmb3JFYWNoKG9iamVjdEtleXMoc3JjKSwgZnVuY3Rpb24gKGtleSkge1xuICAgICAgICAgICAgICAgIGRzdFtrZXldID0gY2xvbmUoc3JjW2tleV0pO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIHBhcmVudHMucG9wKCk7XG4gICAgICAgICAgICBub2Rlcy5wb3AoKTtcbiAgICAgICAgICAgIHJldHVybiBkc3Q7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4gc3JjO1xuICAgICAgICB9XG4gICAgfSkodGhpcy52YWx1ZSk7XG59O1xuXG5mdW5jdGlvbiB3YWxrIChyb290LCBjYiwgaW1tdXRhYmxlKSB7XG4gICAgdmFyIHBhdGggPSBbXTtcbiAgICB2YXIgcGFyZW50cyA9IFtdO1xuICAgIHZhciBhbGl2ZSA9IHRydWU7XG4gICAgXG4gICAgcmV0dXJuIChmdW5jdGlvbiB3YWxrZXIgKG5vZGVfKSB7XG4gICAgICAgIHZhciBub2RlID0gaW1tdXRhYmxlID8gY29weShub2RlXykgOiBub2RlXztcbiAgICAgICAgdmFyIG1vZGlmaWVycyA9IHt9O1xuICAgICAgICBcbiAgICAgICAgdmFyIGtlZXBHb2luZyA9IHRydWU7XG4gICAgICAgIFxuICAgICAgICB2YXIgc3RhdGUgPSB7XG4gICAgICAgICAgICBub2RlIDogbm9kZSxcbiAgICAgICAgICAgIG5vZGVfIDogbm9kZV8sXG4gICAgICAgICAgICBwYXRoIDogW10uY29uY2F0KHBhdGgpLFxuICAgICAgICAgICAgcGFyZW50IDogcGFyZW50c1twYXJlbnRzLmxlbmd0aCAtIDFdLFxuICAgICAgICAgICAgcGFyZW50cyA6IHBhcmVudHMsXG4gICAgICAgICAgICBrZXkgOiBwYXRoLnNsaWNlKC0xKVswXSxcbiAgICAgICAgICAgIGlzUm9vdCA6IHBhdGgubGVuZ3RoID09PSAwLFxuICAgICAgICAgICAgbGV2ZWwgOiBwYXRoLmxlbmd0aCxcbiAgICAgICAgICAgIGNpcmN1bGFyIDogbnVsbCxcbiAgICAgICAgICAgIHVwZGF0ZSA6IGZ1bmN0aW9uICh4LCBzdG9wSGVyZSkge1xuICAgICAgICAgICAgICAgIGlmICghc3RhdGUuaXNSb290KSB7XG4gICAgICAgICAgICAgICAgICAgIHN0YXRlLnBhcmVudC5ub2RlW3N0YXRlLmtleV0gPSB4O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBzdGF0ZS5ub2RlID0geDtcbiAgICAgICAgICAgICAgICBpZiAoc3RvcEhlcmUpIGtlZXBHb2luZyA9IGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICdkZWxldGUnIDogZnVuY3Rpb24gKHN0b3BIZXJlKSB7XG4gICAgICAgICAgICAgICAgZGVsZXRlIHN0YXRlLnBhcmVudC5ub2RlW3N0YXRlLmtleV07XG4gICAgICAgICAgICAgICAgaWYgKHN0b3BIZXJlKSBrZWVwR29pbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICByZW1vdmUgOiBmdW5jdGlvbiAoc3RvcEhlcmUpIHtcbiAgICAgICAgICAgICAgICBpZiAoaXNBcnJheShzdGF0ZS5wYXJlbnQubm9kZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUucGFyZW50Lm5vZGUuc3BsaWNlKHN0YXRlLmtleSwgMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgc3RhdGUucGFyZW50Lm5vZGVbc3RhdGUua2V5XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHN0b3BIZXJlKSBrZWVwR29pbmcgPSBmYWxzZTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBrZXlzIDogbnVsbCxcbiAgICAgICAgICAgIGJlZm9yZSA6IGZ1bmN0aW9uIChmKSB7IG1vZGlmaWVycy5iZWZvcmUgPSBmIH0sXG4gICAgICAgICAgICBhZnRlciA6IGZ1bmN0aW9uIChmKSB7IG1vZGlmaWVycy5hZnRlciA9IGYgfSxcbiAgICAgICAgICAgIHByZSA6IGZ1bmN0aW9uIChmKSB7IG1vZGlmaWVycy5wcmUgPSBmIH0sXG4gICAgICAgICAgICBwb3N0IDogZnVuY3Rpb24gKGYpIHsgbW9kaWZpZXJzLnBvc3QgPSBmIH0sXG4gICAgICAgICAgICBzdG9wIDogZnVuY3Rpb24gKCkgeyBhbGl2ZSA9IGZhbHNlIH0sXG4gICAgICAgICAgICBibG9jayA6IGZ1bmN0aW9uICgpIHsga2VlcEdvaW5nID0gZmFsc2UgfVxuICAgICAgICB9O1xuICAgICAgICBcbiAgICAgICAgaWYgKCFhbGl2ZSkgcmV0dXJuIHN0YXRlO1xuICAgICAgICBcbiAgICAgICAgZnVuY3Rpb24gdXBkYXRlU3RhdGUoKSB7XG4gICAgICAgICAgICBpZiAodHlwZW9mIHN0YXRlLm5vZGUgPT09ICdvYmplY3QnICYmIHN0YXRlLm5vZGUgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAoIXN0YXRlLmtleXMgfHwgc3RhdGUubm9kZV8gIT09IHN0YXRlLm5vZGUpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUua2V5cyA9IG9iamVjdEtleXMoc3RhdGUubm9kZSlcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgc3RhdGUuaXNMZWFmID0gc3RhdGUua2V5cy5sZW5ndGggPT0gMDtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHBhcmVudHMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmVudHNbaV0ubm9kZV8gPT09IG5vZGVfKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5jaXJjdWxhciA9IHBhcmVudHNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0YXRlLmlzTGVhZiA9IHRydWU7XG4gICAgICAgICAgICAgICAgc3RhdGUua2V5cyA9IG51bGw7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBcbiAgICAgICAgICAgIHN0YXRlLm5vdExlYWYgPSAhc3RhdGUuaXNMZWFmO1xuICAgICAgICAgICAgc3RhdGUubm90Um9vdCA9ICFzdGF0ZS5pc1Jvb3Q7XG4gICAgICAgIH1cbiAgICAgICAgXG4gICAgICAgIHVwZGF0ZVN0YXRlKCk7XG4gICAgICAgIFxuICAgICAgICAvLyB1c2UgcmV0dXJuIHZhbHVlcyB0byB1cGRhdGUgaWYgZGVmaW5lZFxuICAgICAgICB2YXIgcmV0ID0gY2IuY2FsbChzdGF0ZSwgc3RhdGUubm9kZSk7XG4gICAgICAgIGlmIChyZXQgIT09IHVuZGVmaW5lZCAmJiBzdGF0ZS51cGRhdGUpIHN0YXRlLnVwZGF0ZShyZXQpO1xuICAgICAgICBcbiAgICAgICAgaWYgKG1vZGlmaWVycy5iZWZvcmUpIG1vZGlmaWVycy5iZWZvcmUuY2FsbChzdGF0ZSwgc3RhdGUubm9kZSk7XG4gICAgICAgIFxuICAgICAgICBpZiAoIWtlZXBHb2luZykgcmV0dXJuIHN0YXRlO1xuICAgICAgICBcbiAgICAgICAgaWYgKHR5cGVvZiBzdGF0ZS5ub2RlID09ICdvYmplY3QnXG4gICAgICAgICYmIHN0YXRlLm5vZGUgIT09IG51bGwgJiYgIXN0YXRlLmNpcmN1bGFyKSB7XG4gICAgICAgICAgICBwYXJlbnRzLnB1c2goc3RhdGUpO1xuICAgICAgICAgICAgXG4gICAgICAgICAgICB1cGRhdGVTdGF0ZSgpO1xuICAgICAgICAgICAgXG4gICAgICAgICAgICBmb3JFYWNoKHN0YXRlLmtleXMsIGZ1bmN0aW9uIChrZXksIGkpIHtcbiAgICAgICAgICAgICAgICBwYXRoLnB1c2goa2V5KTtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBpZiAobW9kaWZpZXJzLnByZSkgbW9kaWZpZXJzLnByZS5jYWxsKHN0YXRlLCBzdGF0ZS5ub2RlW2tleV0sIGtleSk7XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgdmFyIGNoaWxkID0gd2Fsa2VyKHN0YXRlLm5vZGVba2V5XSk7XG4gICAgICAgICAgICAgICAgaWYgKGltbXV0YWJsZSAmJiBoYXNPd25Qcm9wZXJ0eS5jYWxsKHN0YXRlLm5vZGUsIGtleSkpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUubm9kZVtrZXldID0gY2hpbGQubm9kZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgY2hpbGQuaXNMYXN0ID0gaSA9PSBzdGF0ZS5rZXlzLmxlbmd0aCAtIDE7XG4gICAgICAgICAgICAgICAgY2hpbGQuaXNGaXJzdCA9IGkgPT0gMDtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBpZiAobW9kaWZpZXJzLnBvc3QpIG1vZGlmaWVycy5wb3N0LmNhbGwoc3RhdGUsIGNoaWxkKTtcbiAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICBwYXRoLnBvcCgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBwYXJlbnRzLnBvcCgpO1xuICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICBpZiAobW9kaWZpZXJzLmFmdGVyKSBtb2RpZmllcnMuYWZ0ZXIuY2FsbChzdGF0ZSwgc3RhdGUubm9kZSk7XG4gICAgICAgIFxuICAgICAgICByZXR1cm4gc3RhdGU7XG4gICAgfSkocm9vdCkubm9kZTtcbn1cblxuZnVuY3Rpb24gY29weSAoc3JjKSB7XG4gICAgaWYgKHR5cGVvZiBzcmMgPT09ICdvYmplY3QnICYmIHNyYyAhPT0gbnVsbCkge1xuICAgICAgICB2YXIgZHN0O1xuICAgICAgICBcbiAgICAgICAgaWYgKGlzQXJyYXkoc3JjKSkge1xuICAgICAgICAgICAgZHN0ID0gW107XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoaXNEYXRlKHNyYykpIHtcbiAgICAgICAgICAgIGRzdCA9IG5ldyBEYXRlKHNyYy5nZXRUaW1lID8gc3JjLmdldFRpbWUoKSA6IHNyYyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoaXNSZWdFeHAoc3JjKSkge1xuICAgICAgICAgICAgZHN0ID0gbmV3IFJlZ0V4cChzcmMpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzRXJyb3Ioc3JjKSkge1xuICAgICAgICAgICAgZHN0ID0geyBtZXNzYWdlOiBzcmMubWVzc2FnZSB9O1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzQm9vbGVhbihzcmMpKSB7XG4gICAgICAgICAgICBkc3QgPSBuZXcgQm9vbGVhbihzcmMpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKGlzTnVtYmVyKHNyYykpIHtcbiAgICAgICAgICAgIGRzdCA9IG5ldyBOdW1iZXIoc3JjKTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmIChpc1N0cmluZyhzcmMpKSB7XG4gICAgICAgICAgICBkc3QgPSBuZXcgU3RyaW5nKHNyYyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoT2JqZWN0LmNyZWF0ZSAmJiBPYmplY3QuZ2V0UHJvdG90eXBlT2YpIHtcbiAgICAgICAgICAgIGRzdCA9IE9iamVjdC5jcmVhdGUoT2JqZWN0LmdldFByb3RvdHlwZU9mKHNyYykpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKHNyYy5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XG4gICAgICAgICAgICBkc3QgPSB7fTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgIHZhciBwcm90byA9XG4gICAgICAgICAgICAgICAgKHNyYy5jb25zdHJ1Y3RvciAmJiBzcmMuY29uc3RydWN0b3IucHJvdG90eXBlKVxuICAgICAgICAgICAgICAgIHx8IHNyYy5fX3Byb3RvX19cbiAgICAgICAgICAgICAgICB8fCB7fVxuICAgICAgICAgICAgO1xuICAgICAgICAgICAgdmFyIFQgPSBmdW5jdGlvbiAoKSB7fTtcbiAgICAgICAgICAgIFQucHJvdG90eXBlID0gcHJvdG87XG4gICAgICAgICAgICBkc3QgPSBuZXcgVDtcbiAgICAgICAgfVxuICAgICAgICBcbiAgICAgICAgZm9yRWFjaChvYmplY3RLZXlzKHNyYyksIGZ1bmN0aW9uIChrZXkpIHtcbiAgICAgICAgICAgIGRzdFtrZXldID0gc3JjW2tleV07XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZHN0O1xuICAgIH1cbiAgICBlbHNlIHJldHVyb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WJleHAoXCJbMS05XVwiICsgRElHSVQkJCkgKyBcInxcIiArIERJR0lUJCQpLFxuICAgICAgICBJUFY0QUREUkVTUyQgPSBzdWJleHAoREVDX09DVEVUJCArIFwiXFxcXC5cIiArIERFQ19PQ1RFVCQgKyBcIlxcXFwuXCIgKyBERUNfT0NURVQkICsgXCJcXFxcLlwiICsgREVDX09DVEVUJCksXG4gICAgICAgIEgxNiQgPSBzdWJleHAoSEVYRElHJCQgKyBcInsxLDR9XCIpLFxuICAgICAgICBMUzMyJCA9IHN1YmV4cChzdWJleHAoSDE2JCArIFwiXFxcXDpcIiArIEgxNiQpICsgXCJ8XCIgKyBJUFY0QUREUkVTUyQpLFxuICAgICAgICBJUFY2QUREUkVTUzEkID0gc3ViZXhwKHN1YmV4cChIMTYkICsgXCJcXFxcOlwiKSArIFwiezZ9XCIgKyBMUzMyJCksXG4gICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgNiggaDE2IFwiOlwiICkgbHMzMlxuICAgIElQVjZBRERSRVNTMiQgPSBzdWJleHAoXCJcXFxcOlxcXFw6XCIgKyBzdWJleHAoSDE2JCArIFwiXFxcXDpcIikgKyBcIns1fVwiICsgTFMzMiQpLFxuICAgICAgICAvLyAgICAgICAgICAgICAgICAgICAgICBcIjo6XCIgNSggaDE2IFwiOlwiICkgbHMzMlxuICAgIElQVjZBRERSRVNTMyQgPSBzdWJleHAoc3ViZXhwKEgxNiQpICsgXCI/XFxcXDpcXFxcOlwiICsgc3ViZXhwKEgxNiQgKyBcIlxcXFw6XCIpICsgXCJ7NH1cIiArIExTMzIkKSxcbiAgICAgICAgLy9bICAgICAgICAgICAgICAgaDE2IF0gXCI6OlwiIDQoIGgxNiBcIjpcIiApIGxzMzJcbiAgICBJUFY2QUREUkVTUzQkID0gc3ViZXhwKHN1YmV4cChzdWJleHAoSDE2JCArIFwiXFxcXDpcIikgKyBcInswLDF9XCIgKyBIMTYkKSArIFwiP1xcXFw6XFxcXDpcIiArIHN1YmV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A8IDEyOCkge1xuICAgICAgICAgICAgbmV3U3RyICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYyk7XG4gICAgICAgICAgICBpICs9IDM7XG4gICAgICAgIH0gZWxzZSBpZiAoYyA+PSAxOTQgJiYgYyA8IDIyNCkge1xuICAgICAgICAgICAgaWYgKGlsIC0gaSA+PSA2KSB7XG4gICAgICAgICAgICAgICAgdmFyIGMyID0gcGFyc2VJbnQoc3RyLnN1YnN0cihpICsgNCwgMiksIDE2KTtcbiAgICAgICAgICAgICAgICBuZXdTdHIgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoYyAmIDMxKSA8PCA2IHwgYzIgJiA2Myk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG5ld1N0ciArPSBzdHIuc3Vic3RyKGksIDYpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaSArPSA2O1xuICAgICAgICB9IGVsc2UgaWYgKGMgPj0gMjI0KSB7XG4gICAgICAgICAgICBpZiAoaWwgLSBpID49IDkpIHtcbiAgICAgICAgICAgICAgICB2YXIgX2MgPSBwYXJzZUludChzdHIuc3Vic3RyKGkgKyA0LCAyKSwgMTYpO1xuICAgICAgICAgICAgICAgIHZhciBjMyA9IHBhcnNlSW50KHN0ci5zdWJzdHIoaSArIDcsIDIpLCAxNik7XG4gICAgICAgICAgICAgICAgbmV3U3RyICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKGMgJiAxNSkgPDwgMTIgfCAoX2MgJiA2MykgPDwgNiB8IGMzICYgNjMpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBuZXdTdHIgKz0gc3RyLnN1YnN0cihpLCA5KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGkgKz0gOTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIG5ld1N0ciArPSBzdHIuc3Vic3RyKGksIDMpO1xuICAgICAgICAgICAgaSArPSAzO1xuICAg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gICAgICAgICAgICBjb21wb25lbnRzLmZyYWdtZW50ID0gdXJpU3RyaW5nLmluZGV4T2YoXCIjXCIpICE9PSAtMSA/IG1hdGNoZXNbOF0gOiB1bmRlZmluZWQ7XG4gICAgICAgICAgICAvL2ZpeCBwb3J0IG51bWJlclxuICAgICAgICAgICAgaWYgKGlzTmFOKGNvbXBvbmVudHMucG9ydCkpIHtcbiAgICAgICAgICAgICAgICBjb21wb25lbnRzLnBvcnQgPSB1cmlTdHJpbmcubWF0Y2goL1xcL1xcLyg/Oi58XFxuKSpcXDooPzpcXC98XFw/fFxcI3wkKS8pID8gbWF0Y2hlc1s0XSA6IHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICAvL3N0cmlwIGJyYWNrZXRzIGZyb20gSVB2NiBob3N0c1xuICAgICAgICBpZiAoY29tcG9uZW50cy5ob3N0KSB7XG4gICAgICAgICAgICBjb21wb25lbnRzLmhvc3QgPSBjb21wb25lbnRzLmhvc3QucmVwbGFjZShwcm90b2NvbC5JUFY2QUREUkVTUywgXCIkMVwiKTtcbiAgICAgICAgfVxuICAgICAgICAvL2RldGVybWluZSByZWZlcmVuY2UgdHlwZVxuICAgICAgICBpZiAoY29tcG9uZW50cy5zY2hlbWUgPT09IHVuZGVmaW5lZCAmJiBjb21wb25lbnRzLnVzZXJpbmZvID09PSB1bmRlZmluZWQgJiYgY29tcG9uZW50cy5ob3N0ID09PSB1bmRlZmluZWQgJiYgY29tcG9uZW50cy5wb3J0ID09PSB1bmRlZmluZWQgJiYgIWNvbXBvbmVudHMucGF0aCAmJiBjb21wb25lbnRzLnF1ZXJ5ID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGNvbXBvbmVudHMucmVmZXJlbmNlID0gXCJzYW1lLWRvY3VtZW50XCI7XG4gICAgICAgIH0gZWxzZSBpZiAoY29tcG9uZW50cy5zY2hlbWUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgY29tcG9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2V0LnF1ZXJ5ID0gYmFzZS5xdWVyeTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmIChyZWxhdGl2ZS5wYXRoLmNoYXJBdCgwKSA9PT0gXCIvXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LnBhdGggPSByZW1vdmVEb3RTZWdtZW50cyhyZWxhdGl2ZS5wYXRoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoKGJhc2UudXNlcmluZm8gIT09IHVuZGVmaW5lZCB8fCBiYXNlLmhvc3QgIT09IHVuZGVmaW5lZCB8fCBiYXNlLnBvcnQgIT09IHVuZGVmaW5lZCkgJiYgIWJhc2UucGF0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LnBhdGggPSBcIi9cIiArIHJlbGF0aXZlLnBhdGg7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIWJhc2UucGF0aCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LnBhdGggPSByZWxhdGl2ZS5wYXRoO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LnBhdGggPSBiYXNlLnBhdGguc2xpY2UoMCwgYmFzZS5wYXRoLmxhc3RJbmRleE9mKFwiL1wiKSArIDEpICsgcmVsYXRpdmUucGF0aDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB0YXJnZXQucGF0aCA9IHJlbW92ZURvdFNlZ21lbnRzKHRhcmdldC5wYXRoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGFyZ2V0LnF1ZXJ5ID0gcmVsYXRpdmUucXVlcnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvL3RhcmdldC5hdXRob3JpdHkgPSBiYXNlLm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PSB7XG4gICAgc2NoZW1lOiBcIm1haWx0b1wiLFxuICAgIHBhcnNlOiBmdW5jdGlvbiBwYXJzZSQkMShjb21wb25lbnRzLCBvcHRpb25zKSB7XG4gICAgICAgIHZhciB0byA9IGNvbXBvbmVudHMudG8gPSBjb21wb25lbnRzLnBhdGggPyBjb21wb25lbnRzLnBhdGguc3BsaXQoXCIsXCIpIDogW107XG4gICAgICAgIGNvbXBvbmVudHMucGF0aCA9IHVuZGVmaW5lZDtcbiAgICAgICAgaWYgKGNvbXBvbmVudHMucXVlcnkpIHtcbiAgICAgICAgICAgIHZhciB1bmtub3duSGVhZGVycyA9IGZhbHNlO1xuICAgICAgICAgICAgdmFyIGhlYWRlcnMgPSB7fTtcbiAgICAgICAgICAgIHZhciBoZmllbGRzID0gY29tcG9uZW50cy5xdWVyeS5zcGxpdChcIiZcIik7XG4gICAgICAgICAgICBmb3IgKHZhciB4ID0gMCwgeGwgPSBoZmllbGRzLmxlbmd0aDsgeCA8IHhsOyArK3gpIHtcbiAgICAgICAgICAgICAgICB2YXIgaGZpZWxkID0gaGZpZWxkc1t4XS5zcGxpdChcIj1cIik7XG4gICAgICAgICAgICAgICAgc3dpdGNoIChoZmllbGRbMF0pIHtcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBcInRvXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdG9BZGRycyA9IGhmaWVsZFsxXS5zcGxpdChcIixcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBfeCA9IDAsIF94bCA9IHRvQWRkcnMubGVuZ3RoOyBfeCA8IF94bDsgKytfeCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvLnB1c2godG9BZGRyc1tfeF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJzdWJqZWN0XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLnN1YmplY3QgPSB1bmVzY2FwZUNvbXBvbmVudChoZmllbGRbMV0sIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgXCJib2R5XCI6XG4gICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmJvZHkgPSB1bmVzY2FwZUNvbXBvbmVudChoZmllbGRbMV0sIG9wdGlvbnMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICB1bmtub3duSGVhZGVycyA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzW3VuZXNjYXBlQ29tcG9uZW50KGhmaWVsZFswXSwgb3B0aW9ucyldID0gdW5lc2NhcGVDb21wb25lbnQoaGZpZWxkWzFdLCBvcHRpb25zKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh1bmtub3duSGVhZGVycykgY29tcG9uZW50cy5oZWFkZXJzID0gaGVhZGVycztcbiAgICAgICAgfVxuICAgICAgICBjb21wb25lbnRzLnF1ZXJ5ID0gdW5kZWZpbmVkO1xuICAgICAgICBmb3IgKHZhciBfeDIgPSAwLCBfeGwyID0gdG8ubGVuZ3RoOyBfeDIgPCBfeGwyOyArK194Mikge1xuICAgICAgICAgICAgdmFyIGFkZHIgPSB0b1tfeDJdLnNwbGl0KFwiQFwiKTtcbiAgICAgICAgICAgIGFkZHJbMF0gPSB1bmVzY2FwZUNvbXBvbmVudChhZGRyWzBdKTtcbiAgICAgICAgICAgIGlmICghb3B0aW9ucy51bmljb2RlU3VwcG9ydCkge1xuICAgICAgICAgICAgICAgIC8vY29udmVydCBVbmljb2RlIElETiAtPiBBU0NJSSBJRE5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBhZGRyWzFdID0gcHVueWNvZGUudG9BU0NJSSh1bmVzY2FwZUNvbXBvbmVudChhZGRyWzFdLCBvcHRpb25zKS50b0xvd2VyQ2FzZSgpKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudHMuZXJyb3IgPSBjb21wb25lbnRzLmVycm9yIHx8IFwiRW1haWwgYWRkcmVzcydzIGRvbWFpbiBuYW1lIGNhbiBub3QgYmUgY29udmVydGVkIHRvIEFTQ0lJIHZpYSBwdW55Y29kZTogXCIgKyBlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgYWRkclsxXSA9IHVuZXNjYXBlQ29tcG9uZW50KGFkZHJbMV0sIG9wdGlvbnMpLnRvTG93ZXJDYXNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0b1tfeDJdID0gYWRkci5qb2luKFwiQFwiKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gY29tcG9uZW50cztcbiAgICB9LFxuICAgIHNlcmlhbGl6ZTogZnVuY3Rpb24gc2VyaWFsaXplJCQxKGNvbXBvbmVudHMsIG9wdGlvbnMpIHtcbiAgICAgICAgdmFyIHRvID0gdG9BcnJheShjb21wb25lbnRzLnRvKTtcbiAgICAgICAgaWYgKHRvKSB7XG4gICAgICAgICAgICBmb3IgKHZhciB4ID0gMCwgeGwgPSB0by5sZW5ndGg7IHggPCB4bDsgKyt4KSB7XG4gICAgICAgICAgICAgICAgdmFyIHRvQWRkciA9IFN0cmluZyh0b1t4XSk7XG4gICAgICAgICAgICAgICAgdmFyIGF0SWR4ID0gdG9BZGRyLmxhc3RJbmRleE9mKFwiQFwiKTtcbiAgICAgICAgICAgICAgICB2YXIgbG9jYWxQYXJ0ID0gdG9BZGRyLnNsaWNlKDAsIGF0SWR4KS5yZXBsYWNlKFBDVF9FTkNPREVELCBkZWNvZGVVbnJlc2VydmVkKS5yZXBsYWNlKFBDVF9FTkNPREVELCB0b1VwcGVyQ2FzZSkucmVwbGFjZShOT1RfTE9DQUxfUEFSVCwgcGN0RW5jQ2hhcik7XG4gICAgICAgICAgICAgICAgdmFyIGRvbWFpbiA9IHRvQWRkci5zbGljZShhdElkeCArIDEpO1xuICAgICAgICAgICAgICAgIC8vY29udmVydCBJRE4gdmlhIHB1bnljb2RlXG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgZG9tYWluID0gIW9wdGlvbnMuaXJpID8gcHVueWNvZGUudG9BU0NJSSh1bmVzY2FwZUNvbXBvbmVudChkb21haW4sIG9wdGlvbnMpLnRvTG93ZXJDYXNlKCkpIDogcHVueWNvZGUudG9Vbmljb2RlKGRvbWFpbik7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRzLmVycm9yID0gY29tcG9uZW50cy5lcnJvciB8fCBcIkVtYWlsIGFkZHJlc3MncyBkb21haW4gbmFtZSBjYW4gbm90IGJlIGNvbnZlcnRlZCB0byBcIiArICghb3B0aW9ucy5pcmkgPyBcIkFTQ0lJXCIgOiBcIlVuaWNvZGVcIikgKyBcIiB2aWEgcHVueWNvZGU6IFwiICsgZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdG9beF0gPSBsb2NhbFBhcnQgKyBcIkBcIiArIGRvbWFpbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvbXBvbmVudHMucGF0aCA9IHRvLmpvaW4oXCIsXCIpO1xuICAgICAgICB9XG4gICAgICAgIHZhciBoZWFkZXJzID0gY29tcG9uZW50cy5oZWFkZXJzID0gY29tcG9uZW50cy5oZWFkZXJzIHx8IHt9O1xuICAgICAgICBpZiAoY29tcG9uZW50cy5zdWJqZWN0KSBoZWFkZXJzW1wic3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gICB9IGVsc2Uge1xuICAgICAgICAgICAgICBuZXdwYXJ0ICs9IHBhcnRbal07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIC8vIHdlIHRlc3QgYWdhaW4gd2l0aCBBU0NJSSBjaGFyIG9ubHlcbiAgICAgICAgICBpZiAoIW5ld3BhcnQubWF0Y2goaG9zdG5hbWVQYXJ0UGF0dGVybikpIHtcbiAgICAgICAgICAgIHZhciB2YWxpZFBhcnRzID0gaG9zdHBhcnRzLnNsaWNlKDAsIGkpO1xuICAgICAgICAgICAgdmFyIG5vdEhvc3QgPSBob3N0cGFydHMuc2xpY2UoaSArIDEpO1xuICAgICAgICAgICAgdmFyIGJpdCA9IHBhcnQubWF0Y2goaG9zdG5hbWVQYXJ0U3RhcnQpO1xuICAgICAgICAgICAgaWYgKGJpdCkge1xuICAgICAgICAgICAgICB2YWxpZFBhcnRzLnB1c2goYml0WzFdKTtcbiAgICAgICAgICAgICAgbm90SG9zdC51bnNoaWZ0KGJpdFsyXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAobm90SG9zdC5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgcmVzdCA9ICcvJyArIG5vdEhvc3Quam9pbignLicpICsgcmVzdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuaG9zdG5hbWUgPSB2YWxpZFBhcnRzLmpvaW4oJy4nKTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIGlmICh0aGlzLmhvc3RuYW1lLmxlbmd0aCA+IGhvc3RuYW1lTWF4TGVuKSB7XG4gICAgICB0aGlzLmhvc3RuYW1lID0gJyc7XG4gICAgfSBlbHNlIHtcbiAgICAgIC8vIGhvc3RuYW1lcyBhcmUgYWx3YXlzIGxvd2VyIGNhc2UuXG4gICAgICB0aGlzLmhvc3RuYW1lID0gdGhpcy5ob3N0bmFtZS50b0x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29tLzIwMTMvMDQvMTcvb3V0bG9vay1jb20tZ2V0cy10d28tc3RlcC12ZXJpZmljYXRpb24tc2lnbi1pbi1ieS1hbGlhcy1hbmQtbmV3LWludGVybmF0aW9uYWwtZG9tYWlucy9cbnZhciBvdXRsb29rZG90Y29tX2RvbWFpbnMgPSBbJ2hvdG1haWwuYXQnLCAnaG90bWFpbC5iZScsICdob3RtYWlsLmNhJywgJ2hvdG1haWwuY2wnLCAnaG90bWFpbC5jby5pbCcsICdob3RtYWlsLmNvLm56JywgJ2hvdG1haWwuY28udGgnLCAnaG90bWFpbC5jby51aycsICdob3RtYWlsLmNvbScsICdob3RtYWlsLmNvbS5hcicsICdob3RtYWlsLmNvbS5hdScsICdob3RtYWlsLmNvbS5icicsICdob3RtYWlsLmNvbS5ncicsICdob3RtYWlsLmNvbS5teCcsICdob3RtYWlsLmNvbS5wZScsICdob3RtYWlsLmNvbS50cicsICdob3RtYWlsLmNvbS52bicsICdob3RtYWlsLmN6JywgJ2hvdG1haWwuZGUnLCAnaG90bWFpbC5kaycsICdob3RtYWlsLmVzJywgJ2hvdG1haWwuZnInLCAnaG90bWFpbC5odScsICdob3RtYWlsLmlkJywgJ2hvdG1haWwuaWUnLCAnaG90bWFpbC5pbicsICdob3RtYWlsLml0JywgJ2hvdG1haWwuanAnLCAnaG90bWFpbC5rcicsICdob3RtYWlsLmx2JywgJ2hvdG1haWwubXknLCAnaG90bWFpbC5waCcsICdob3RtYWlsLnB0JywgJ2hvdG1haWwuc2EnLCAnaG90bWFpbC5zZycsICdob3RtYWlsLnNrJywgJ2xpdmUuYmUnLCAnbGl2ZS5jby51aycsICdsaXZlLmNvbScsICdsaXZlLmNvbS5hcicsICdsaXZlLmNvbS5teCcsICdsaXZlLmRlJywgJ2xpdmUuZXMnLCAnbGl2ZS5ldScsICdsaXZlLmZyJywgJ2xpdmUuaXQnLCAnbGl2ZS5ubCcsICdtc24uY29tJywgJ291dGxvb2suYXQnLCAnb3V0bG9vay5iZScsICdvdXRsb29rLmNsJywgJ291dGxvb2suY28uaWwnLCAnb3V0bG9vay5jby5ueicsICdvdXRsb29rLmNvLnRoJywgJ291dGxvb2suY29tJywgJ291dGxvb2suY29tLmFyJywgJ291dGxvb2suY29tLmF1JywgJ291dGxvb2suY29tLmJyJywgJ291dGxvb2suY29tLmdyJywgJ291dGxvb2suY29tLnBlJywgJ291dGxvb2suY29tLnRyJywgJ291dGxvb2suY29tLnZuJywgJ291dGxvb2suY3onLCAnb3V0bG9vay5kZScsICdvdXRsb29rLmRrJywgJ291dGxvb2suZXMnLCAnb3V0bG9vay5mcicsICdvdXRsb29rLmh1JywgJ291dGxvb2suaWQnLCAnb3V0bG9vay5pZScsICdvdXRsb29rLmluJywgJ291dGxvb2suaXQnLCAnb3V0bG9vay5qcCcsICdvdXRsb29rLmtyJywgJ291dGxvb2subHYnLCAnb3V0bG9vay5teScsICdvdXRsb29rLnBoJywgJ291dGxvb2sucHQnLCAnb3V0bG9vay5zYScsICdvdXRsb29rLnNnJywgJ291dGxvb2suc2snLCAncGFzc3BvcnQuY29tJ107XG5cbi8vIExpc3Qgb2YgZG9tYWlucyB1c2VkIGJ5IFlhaG9vIE1haWxcbi8vIFRoaXMgbGlzdCBpcyBsaWtlbHkgaW5jb21wbGV0ZVxudmFyIHlhaG9vX2RvbWFpbnMgPSBbJ3JvY2tldG1haWwuY29tJywgJ3lhaG9vLmNhJywgJ3lhaG9vLmNvLnVrJywgJ3lhaG9vLmNvbScsICd5YWhvby5kZScsICd5YWhvby5mcicsICd5YWhvby5pbicsICd5YWhvby5pdCcsICd5bWFpbC5jb20nXTtcblxuZnVuY3Rpb24gbm9ybWFsaXplRW1haWwoZW1haWwsIG9wdGlvbnMpIHtcbiAgb3B0aW9ucyA9ICgwLCBfbWVyZ2UyLmRlZmF1bHQpKG9wdGlvbnMsIGRlZmF1bHRfbm9ybWFsaXplX2VtYWlsX29wdGlvbnMpO1xuXG4gIHZhciByYXdfcGFydHMgPSBlbWFpbC5zcGxpd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gICAgICAgICAgICAgICAgICAgICAgICBcIkV4cGVjdGVkIHR5cGUgezB9IGJ1dCBmb3VuZCB0eXBlIHsxfVwiLFxuICAgIElOVkFMSURfRk9STUFUOiAgICAgICAgICAgICAgICAgICAgICAgICBcIk9iamVjdCBkaWRuJ3QgcGFzcyB2YWxpZGF0aW9uIGZvciBmb3JtYXQgezB9OiB7MX1cIixcbiAgICBFTlVNX01JU01BVENIOiAgICAgICAgICAgICAgICAgICAgICAgICAgXCJObyBlbnVtIG1hdGNoIGZvcjogezB9XCIsXG4gICAgQU5ZX09GX01JU1NJTkc6ICAgICAgICAgICAgICAgICAgICAgICAgIFwiRGF0YSBkb2VzIG5vdCBtYXRjaCBhbnkgc2NoZW1hcyBmcm9tICdhbnlPZidcIixcbiAgICBPTkVfT0ZfTUlTU0lORzogICAgICAgICAgICAgICAgICAgICAgICAgXCJEYXRhIGRvZXMgbm90IG1hdGNoIGFueSBzY2hlbWFzIGZyb20gJ29uZU9mJ1wiLFxuICAgIE9ORV9PRl9NVUxUSVBMRTogICAgICAgICAgICAgICAgICAgICAgICBcIkRhdGEgaXMgdmFsaWQgYWdhaW5zdCBtb3JlIHRoYW4gb25lIHNjaGVtYSBmcm9tICdvbmVPZidcIixcbiAgICBOT1RfUEFTU0VEOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJEYXRhIG1hdGNoZXMgc2NoZW1hIGZyb20gJ25vdCdcIixcblxuICAgIC8vIEFycmF5IGVycm9yc1xuICAgIEFSUkFZX0xFTkdUSF9TSE9SVDogICAgICAgICAgICAgICAgICAgICBcIkFycmF5IGlzIHRvbyBzaG9ydCAoezB9KSwgbWluaW11bSB7MX1cIixcbiAgICBBUlJBWV9MRU5HVEhfTE9ORzogICAgICAgICAgICAgICAgICAgICAgXCJBcnJheSBpcyB0b28gbG9uZyAoezB9KSwgbWF4aW11bSB7MX1cIixcbiAgICBBUlJBWV9VTklRVUU6ICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJBcnJheSBpdGVtcyBhcmUgbm90IHVuaXF1ZSAoaW5kZXhlcyB7MH0gYW5kIHsxfSlcIixcbiAgICBBUlJBWV9BRERJVElPTkFMX0lURU1TOiAgICAgICAgICAgICAgICAgXCJBZGRpdGlvbmFsIGl0ZW1zIG5vdCBhbGxvd2VkXCIsXG5cbiAgICAvLyBOdW1lcmljIGVycm9yc1xuICAgIE1VTFRJUExFX09GOiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIlZhbHVlIHswfSBpcyBub3QgYSBtdWx0aXBsZSBvZiB7MX1cIixcbiAgICBNSU5JTVVNOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJWYWx1ZSB7MH0gaXMgbGVzcyB0aGFuIG1pbmltdW0gezF9XCIsXG4gICAgTUlOSU1VTV9FWENMVVNJVkU6ICAgICAgICAgICAgICAgICAgICAgIFwiVmFsdWUgezB9IGlzIGVxdWFsIG9yIGxlc3MgdGhhbiBleGNsdXNpdmUgbWluaW11bSB7MX1cIixcbiAgICBNQVhJTVVNOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJWYWx1ZSB7MH0gaXMgZ3JlYXRlciB0aGFuIG1heGltdW0gezF9XCIsXG4gICAgTUFYSU1VTV9FWENMVVNJVkU6ICAgICAgICAgICAgICAgICAgICAgIFwiVmFsdWUgezB9IGlzIGVxdWFsIG9yIGdyZWF0ZXIgdGhhbiBleGNsdXNpdmUgbWF4aW11bSB7MX1cIixcblxuICAgIC8vIE9iamVjdCBlcnJvcnNcbiAgICBPQkpFQ1RfUFJPUEVSVElFU19NSU5JTVVNOiAgICAgICAgICAgICAgXCJUb28gZmV3IHByb3BlcnRpZXMgZGVmaW5lZCAoezB9KSwgbWluaW11bSB7MX1cIixcbiAgICBPQkpFQ1RfUFJPUEVSVElFU19NQVhJTVVNOiAgICAgICAgICAgICAgXCJUb28gbWFueSBwcm9wZXJ0aWVzIGRlZmluZWQgKHswfSksIG1heGltdW0gezF9XCIsXG4gICAgT0JKRUN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IHZhciBtYXRjaGVzID0gL14oWzAtOV17Mn0pOihbMC05XXsyfSk6KFswLTldezJ9KSguWzAtOV0rKT8oenwoWystXVswLTldezJ9OlswLTldezJ9KSkkLy5leGVjKHNbMV0pO1xuICAgICAgICBpZiAobWF0Y2hlcyA9PT0gbnVsbCkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIC8vIHZhciBob3VyID0gbWF0Y2hlc1sxXTtcbiAgICAgICAgLy8gdmFyIG1pbnV0ZSA9IG1hdGNoZXNbMl07XG4gICAgICAgIC8vIHZhciBzZWNvbmQgPSBtYXRjaGVzWzNdO1xuICAgICAgICAvLyB2YXIgZnJhY3Rpb24gPSBtYXRjaGVzWzRdO1xuICAgICAgICAvLyB2YXIgdGltZXpvbmUgPSBtYXRjaGVzWzVdO1xuICAgICAgICBpZiAobWF0Y2hlc1sxXSA+IFwiMjNcIiB8fCBtYXRjaGVzWzJdID4gXCI1OVwiIHx8IG1hdGNoZXNbM10gPiBcIjU5XCIpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9LFxuICAgIFwiZW1haWxcIjogZnVuY3Rpb24gKGVtYWlsKSB7XG4gICAgICAgIGlmICh0eXBlb2YgZW1haWwgIT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB2YWxpZGF0b3IuaXNFbWFpbChlbWFpbCwgeyBcInJlcXVpcmVfdGxkXCI6IHRydWUgfSk7XG4gICAgfSxcbiAgICBcImhvc3RuYW1lXCI6IGZ1bmN0aW9uIChob3N0bmFtZSkge1xuICAgICAgICBpZiAodHlwZW9mIGhvc3RuYW1lICE9PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgICAvKlxuICAgICA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vbi41LjQuMS4yXG4gICAgICAgIGlmIChVdGlscy53aGF0SXMoanNvbikgIT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB2YXIga2V5c0NvdW50ID0gT2JqZWN0LmtleXMoanNvbikubGVuZ3RoO1xuICAgICAgICBpZiAoa2V5c0NvdW50ID4gc2NoZW1hLm1heFByb3BlcnRpZXMpIHtcbiAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIk9CSkVDVF9QUk9QRVJUSUVTX01BWElNVU1cIiwgW2tleXNDb3VudCwgc2NoZW1hLm1heFByb3BlcnRpZXNdLCBudWxsLCBzY2hlbWEuZGVzY3JpcHRpb24pO1xuICAgICAgICB9XG4gICAgfSxcbiAgICBtaW5Qcm9wZXJ0aWVzOiBmdW5jdGlvbiAocmVwb3J0LCBzY2hlbWEsIGpzb24pIHtcbiAgICAgICAgLy8gaHR0cDovL2pzb24tc2NoZW1hLm9yZy9sYXRlc3QvanNvbi1zY2hlbWEtdmFsaWRhdGlvbi5odG1sI3JmYy5zZWN0aW9uLjUuNC4yLjJcbiAgICAgICAgaWYgKFV0aWxzLndoYXRJcyhqc29uKSAhPT0gXCJvYmplY3RcIikge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHZhciBrZXlzQ291bnQgPSBPYmplY3Qua2V5cyhqc29uKS5sZW5ndGg7XG4gICAgICAgIGlmIChrZXlzQ291bnQgPCBzY2hlbWEubWluUHJvcGVydGllcykge1xuICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiT0JKRUNUX1BST1BFUlRJRVNfTUlOSU1VTVwiLCBba2V5c0NvdW50LCBzY2hlbWEubWluUHJvcGVydGllc10sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlcXVpcmVkOiBmdW5jdGlvbiAocmVwb3J0LCBzY2hlbWEsIGpzb24p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tIFwicHJvcGVydGllc1wiLlxuICAgICAgICAgICAgdmFyIHAgPSBPYmplY3Qua2V5cyhwcm9wZXJ0aWVzKTtcbiAgICAgICAgICAgIC8vIFRoZSBwcm9wZXJ0eSBzZXQgZnJvbSBcInBhdHRlcm5Qcm9wZXJ0aWVzXCIuXG4gICAgICAgICAgICB2YXIgcHAgPSBPYmplY3Qua2V5cyhwYXR0ZXJuUHJvcGVydGllcyk7XG4gICAgICAgICAgICAvLyByZW1vdmUgZnJvbSBcInNcIiBhbGwgZWxlbWVudHMgb2YgXCJwXCIsIGlmIGFueTtcbiAgICAgICAgICAgIHMgPSBVdGlscy5kaWZmZXJlbmNlKHMsIHApO1xuICAgICAgICAgICAgLy8gZm9yIGVhY2ggcmVnZXggaW4gXCJwcFwiLCByZW1vdmUgYWxsIGVsZW1lbnRzIG9mIFwic1wiIHdoaWNoIHRoaXMgcmVnZXggbWF0Y2hlcy5cbiAgICAgICAgICAgIHZhciBpZHggPSBwcC5sZW5ndGg7XG4gICAgICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVnRXhwID0gUmVnRXhwKHBwW2lkeF0pLFxuICAgICAgICAgICAgICAgICAgICBpZHgyID0gcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgd2hpbGUgKGlkeDItLSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAocmVnRXhwLnRlc3Qoc1tpZHgyXSkgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHMuc3BsaWNlKGlkeDIsIDEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gVmFsaWRhdGlvbiBvZiB0aGUganNvbiBzdWNjZWVkcyBpZiwgYWZ0ZXIgdGhlc2UgdHdvIHN0ZXBzLCBzZXQgXCJzXCIgaXMgZW1wdHkuXG4gICAgICAgICAgICBpZiAocy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgLy8gYXNzdW1lQWRkaXRpb25hbCBjYW4gYmUgYW4gYXJyYXkgb2YgYWxsb3dlZCBwcm9wZXJ0aWVzXG4gICAgICAgICAgICAgICAgdmFyIGlkeDMgPSB0aGlzLm9wdGlvbnMuYXNzdW1lQWRkaXRpb25hbC5sZW5ndGg7XG4gICAgICAgICAgICAgICAgaWYgKGlkeDMpIHtcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGlkeDMtLSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGlvID0gcy5pbmRleE9mKHRoaXMub3B0aW9ucy5hc3N1bWVBZGRpdGlvbmFsW2lkeDNdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbyAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnNwbGljZShpbywgMSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJPQkpFQ1RfQURESVRJT05BTF9QUk9QRVJUSUVTXCIsIFtzXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGRlcGVuZGVuY2llczogZnVuY3Rpb24gKHJlcG9ydCwgc2NoZW1hLCBqc29uKSB7XG4gICAgICAgIC8vIGh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvbGF0ZXN0L2pzb24tc2NoZW1hLXZhbGlkYXRpb24uaHRtbCNyZmMuc2VjdGlvbi41LjQuNS4yXG4gICAgICAgIGlmIChVdGlscy53aGF0SXMoanNvbikgIT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHZhciBrZXlzID0gT2JqZWN0LmtleXMoc2NoZW1hLmRlcGVuZGVuY2llcyksXG4gICAgICAgICAgICBpZHggPSBrZXlzLmxlbmd0aDtcblxuICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgIC8vIGl0ZXJhdGUgYWxsIGRlcGVuZGVuY2llc1xuICAgICAgICAgICAgdmFyIGRlcGVuZGVuY3lOYW1lID0ga2V5c1tpZHhdO1xuICAgICAgICAgICAgaWYgKGpzb25bZGVwZW5kZW5jeU5hbWVdKSB7XG4gICAgICAgICAgICAgICAgdmFyIGRlcGVuZGVuY3lEZWZpbml0aW9uID0gc2NoZW1hLmRlcGVuZGVuY2llc1tkZXBlbmRlbmN5TmFtZV07XG4gICAgICAgICAgICAgICAgaWYgKFV0aWxzLndoYXRJcyhkZXBlbmRlbmN5RGVmaW5pdGlvbikgPT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gaWYgZGVwZW5kZW5jeSBpcyBhIHNjaGVtYSwgdmFsaWRhdGUgYWdhaW5zdCB0aGlzIHNjaGVtYVxuICAgICAgICAgICAgICAgICAgICBleHBvcnRzLnZhbGlkYXRlLmNhbGwodGhpcywgcmVwb3J0LCBkZXBlbmRlbmN5RGVmaW5pdGlvbiwganNvbik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gQXJyYXlcbiAgICAgICAgICAgICAgICAgICAgLy8gaWYgZGVwZW5kZW5jeSBpcyBhbiBhcnJheSwgb2JqZWN0IG5lZWRzIHRvIGhhdmUgYWxsIHByb3BlcnRpZXMgaW4gdGhpcyBhcnJheVxuICAgICAgICAgICAgICAgICAgICB2YXIgaWR4MiA9IGRlcGVuZGVuY3lEZWZpbml0aW9uLmxlbmd0aDtcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGlkeDItLSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcXVpcmVkUHJvcGVydHlOYW1lID0gZGVwZW5kZW5jeURlZmluaXRpb25baWR4Ml07XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoanNvbltyZXF1aXJlZFByb3BlcnR5TmFtZV0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcG9ydC5hZGRFcnJvcihcIk9CSkVDVF9ERVBFTkRFTkNZX0tFWVwiLCBbcmVxdWlyZWRQcm9wZXJ0eU5hbWUsIGRlcGVuZGVuY3lOYW1lXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgZW51bTogZnVuY3Rpb24gKHJlcG9ydCwgc2NoZW1hLCBqc29uKSB7XG4gICAgICAgIC8vIGh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvbGF0ZXN0L2pzb24tc2NoZW1hLXZhbGlkYXRpb24uaHRtbCNyZmMuc2VjdGlvbi41LjUuMS4yXG4gICAgICAgIHZhciBtYXRjaCA9IGZhbHNlLFxuICAgICAgICAgICAgaWR4ID0gc2NoZW1hLmVudW0ubGVuZ3RoO1xuICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgIGlmIChVdGlscy5hcmVFcXVhbChqc29uLCBzY2hlbWEuZW51bVtpZHhdKSkge1xuICAgICAgICAgICAgICAgIG1hdGNoID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAobWF0Y2ggPT09IGZhbHNlKSB7XG4gICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJFTlVNX01JU01BVENIXCIsIFtqc29uXSwgbnVsbCwgc2NoZW1hLmRlc2NyaXB0aW9uKTtcbiAgICAgICAgfVxuICAgIH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El0ZW1zXCIuXG4gICAgaWYgKEFycmF5LmlzQXJyYXkoc2NoZW1hLml0ZW1zKSkge1xuXG4gICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAgLy8gZXF1YWwgdG8gZG9lc250IG1ha2Ugc2Vuc2UgaGVyZVxuICAgICAgICAgICAgaWYgKGlkeCA8IHNjaGVtYS5pdGVtcy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wdXNoKGlkeC50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICBleHBvcnRzLnZhbGlkYXRlLmNhbGwodGhpcywgcmVwb3J0LCBzY2hlbWEuaXRlbXNbaWR4XSwganNvbltpZHhdKTtcbiAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gbWlnaHQgYmUgYm9vbGVhbiwgc28gY2hlY2sgdGhhdCBpdCdzIGFuIG9iamVjdFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygc2NoZW1hLmFkZGl0aW9uYWxJdGVtcyA9PT0gXCJvYmplY3RcIikge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wdXNoKGlkeC50b1N0cmluZygpKTtcbiAgICAgICAgICAgICAgICAgICAgZXhwb3J0cy52YWxpZGF0ZS5jYWxsKHRoaXMsIHJlcG9ydCwgc2NoZW1hLmFkZGl0aW9uYWxJdGVtcywganNvbltpZHhdKTtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucG9wKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICB9IGVsc2UgaWYgKHR5cGVvZiBzY2hlbWEuaXRlbXMgPT09IFwib2JqZWN0XCIpIHtcblxuICAgICAgICAvLyBJZiBpdGVtcyBpcyBhIHNjaGVtYSwgdGhlbiB0aGUgY2hpbGQgaW5zdGFuY2Ugb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1cbiAgICAgICAgICAgIG1heFJlZnMtLTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobWF4UmVmcyA9PT0gMCkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiQ2lyY3VsYXIgZGVwZW5kZW5jeSBieSAkcmVmIHJlZmVyZW5jZXMhXCIpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gdHlwZSBjaGVja2luZyBmaXJzdFxuICAgIC8vIGh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvbGF0ZXN0L2pzb24tc2NoZW1hLXZhbGlkYXRpb24uaHRtbCNyZmMuc2VjdGlvbi41LjUuMi4yXG4gICAgdmFyIGpzb25UeXBlID0gVXRpbHMud2hhdElzKGpzb24pO1xuICAgIGlmIChzY2hlbWEudHlwZSkge1xuICAgICAgICBpZiAodHlwZW9mIHNjaGVtYS50eXBlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICBpZiAoanNvblR5cGUgIT09IHNjaGVtYS50eXBlICYmIChqc29uVHlwZSAhPT0gXCJpbnRlZ2VyXCIgfHwgc2NoZW1hLnR5cGUgIT09IFwibnVtYmVyXCIpKSB7XG4gICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiSU5WQUxJRF9UWVBFXCIsIFtzY2hlbWEudHlwZSwganNvblR5cGVdLCBudWxsLCBzY2hlbWEuZGVzY3JpcHRpb24pO1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMuYnJlYWtPbkZpcnN0RXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZS5pbmRleE9mKGpzb25UeXBlKSA9PT0gLTEgJiYgKGpzb25UeXBlICE9PSBcImludGVnZXJcIiB8fCBzY2hlbWEudHlwZS5pbmRleE9mKFwibnVtYmVyXCIpID09PSAtMSkpIHtcbiAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJJTlZBTElEX1RZUEVcIiwgW3NjaGVtYS50eXBlLCBqc29uVHlwZV0sIG51bGwsIHNjaGVtYS5kZXNjcmlwdGlvbik7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5icmVha09uRmlyc3RFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLy8gbm93IGl0ZXJhdGUgYWxsIHRoZSBrZXlzIGluIHNjaGVtYSBhbmQgZXhlY3V0ZSB2YWxpZGF0aW9uIG1ldGhvZHNcbiAgICB2YXIgaWR4ID0ga2V5cy5sZW5ndGg7XG4gICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgIGlmIChKc29uVmFsaWRhdG9yc1trZXlzW2lkeF1dKSB7XG4gICAgICAgICAgICBKc29uVmFsaWRhdG9yc1trZXlzW2lkeF1dLmNhbGwodGhpcywgcmVwb3J0LCBzY2hlbWEsIGpzb24pO1xuICAgICAgICAgICAgaWYgKHJlcG9ydC5lcnJvcnMubGVuZ3RoICYmIHRoaXMub3B0aW9ucy5icmVha09uRmlyc3RFcnJvcikgeyBicmVhazsgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHJlcG9ydC5lcnJvcnMubGVuZ3RoID09PSAwIHx8IHRoaXMub3B0aW9ucy5icmVha09uRmlyc3RFcnJvciA9PT0gZmFsc2UpIHtcbiAgICAgICAgaWYgKGpzb25UeXBlID09PSBcImFycmF5XCIpIHtcbiAgICAgICAgICAgIHJlY3Vyc2VBcnJheS5jYWxsKHRoaXMsIHJlcG9ydCwgc2NoZW1hLCBqc29uKTtcbiAgICAgICAgfSBlbHNlIGlmIChqc29uVHlwZSA9PT0gXCJvYmplY3RcIikge1xuICAgICAgIC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ciDiiJLiiJ4sIHJldHVybiBmYWxzZS5cbiAgICAgICAgaWYgKHZhbHVlICE9PSB2YWx1ZSB8fCB2YWx1ZSA9PT0gSW5maW5pdHkgfHwgdmFsdWUgPT09IC1JbmZpbml0eSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIC8vIDMuIE90aGVyd2lzZSwgcmV0dXJuIHRydWUuXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH07XG59XG4iLCJcInVzZSBzdHJpY3RcIjtcblxudmFyIGdldCAgICA9IHJlcXVpcmUoXCJsb2Rhc2guZ2V0XCIpO1xudmFyIEVycm9ycyA9IHJlcXVpcmUoXCIuL0Vycm9yc1wiKTtcbnZhciBVdGlscyAgPSByZXF1aXJlKFwiLi9VdGlsc1wiKTtcblxuZnVuY3Rpb24gUmVwb3J0KHBhcmVudE9yT3B0aW9ucywgcmVwb3J0T3B0aW9ucykge1xuICAgIHRoaXMucGFyZW50UmVwb3J0ID0gcGFyZW50T3JPcHRpb25zIGluc3RhbmNlb2YgUmVwb3J0ID9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnRPck9wdGlvbnMgOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZGVmaW5lZDtcblxuICAgIHRoaXMub3B0aW9ucyA9IHBhcmVudE9yT3B0aW9ucyBpbnN0YW5jZW9mIFJlcG9ydCA/XG4gICAgICAgICAgICAgICAgICAgICAgIHBhcmVudE9yT3B0aW9ucy5vcHRpb25zIDpcbiAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50T3JPcHRpb25zIHx8IHt9O1xuXG4gICAgdGhpcy5yZXBvcnRPcHRpb25zID0gcmVwb3J0T3B0aW9ucyB8fCB7fTtcblxuICAgIHRoaXMuZXJyb3JzID0gW107XG4gICAgdGhpcy5wYXRoID0gW107XG4gICAgdGhpcy5hc3luY1Rhc2tzID0gW107XG59XG5cblJlcG9ydC5wcm90b3R5cGUua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ksXG4gICAgICAgICAgICAgICAgICAgIC8vIHVzZSB0aGVtIGluc3RlYWQgb2YgdGhlIGRlZmF1bHQgb3B0aW9uc1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnMgPSByZXN1bHQuX18kdmFsaWRhdGlvbk9wdGlvbnMgfHwgdGhpcy5vcHRpb25zO1xuICAgICAgICAgICAgICAgICAgICBTY2hlbWFWYWxpZGF0aW9uLnZhbGlkYXRlU2NoZW1hLmNhbGwodGhpcywgcmVtb3RlUmVwb3J0LCByZXN1bHQpO1xuICAgICAgICAgICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucyA9IHNhdmVkT3B0aW9ucztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB2YXIgcmVtb3RlUmVwb3J0SXNWYWxpZCA9IHJlbW90ZVJlcG9ydC5pc1ZhbGlkKCk7XG4gICAgICAgICAgICBpZiAoIXJlbW90ZVJlcG9ydElzVmFsaWQpIHtcbiAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJSRU1PVEVfTk9UX1ZBTElEXCIsIFt1cmldLCByZW1vdGVSZXBvcnQpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcblxuICAgICAgICAgICAgaWYgKCFyZW1vdGVSZXBvcnRJc1ZhbGlkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgIGlmIChyZXN1bHQgJiYgcXVlcnlQYXRoKSB7XG4gICAgICAgIHZhciBwYXJ0cyA9IHF1ZXJ5UGF0aC5zcGxpdChcIi9cIik7XG4gICAgICAgIGZvciAodmFyIGlkeCA9IDAsIGxpbSA9IHBhcnRzLmxlbmd0aDsgcmVzdWx0ICYmIGlkeCA8IGxpbTsgaWR4KyspIHtcb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zaChvYmouaWQpO1xuICAgIH1cblxuICAgIGlmICh0eXBlb2Ygb2JqLiRyZWYgPT09IFwic3RyaW5nXCIgJiYgdHlwZW9mIG9iai5fXyRyZWZSZXNvbHZlZCA9PT0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICByZXN1bHRzLnB1c2goe1xuICAgICAgICAgICAgcmVmOiBtZXJnZVJlZmVyZW5jZShzY29wZSwgb2JqLiRyZWYpLFxuICAgICAgICAgICAga2V5OiBcIiRyZWZcIixcbiAgICAgICAgICAgIG9iajogb2JqLFxuICAgICAgICAgICAgcGF0aDogcGF0aC5zbGljZSgwKVxuICAgICAgICB9KTtcbiAgICB9XG4gICAgaWYgKHR5cGVvZiBvYmouJHNjaGVtYSA9PT0gXCJzdHJpbmdcIiAmJiB0eXBlb2Ygb2JqLl9fJHNjaGVtYVJlc29sdmVkID09PSBcInVuZGVmaW5lZFwiKSB7XG4gICAgICAgIHJlc3VsdHMucHVzaCh7XG4gICAgICAgICAgICByZWY6IG1lcmdlUmVmZXJlbmNlKHNjb3BlLCBvYmouJHNjaGVtYSksXG4gICAgICAgICAgICBrZXk6IFwiJHNjaGVtYVwiLFxuICAgICAgICAgICAgb2JqOiBvYmosXG4gICAgICAgICAgICBwYXRoOiBwYXRoLnNsaWNlKDApXG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIHZhciBpZHg7XG4gICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkge1xuICAgICAgICBpZHggPSBvYmoubGVuZ3RoO1xuICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgIHBhdGgucHVzaChpZHgudG9TdHJpbmcoKSk7XG4gICAgICAgICAgICBjb2xsZWN0UmVmZXJlbmNlcyhvYmpbaWR4XSwgcmVzdWx0cywgc2NvcGUsIHBhdGgpO1xuICAgICAgICAgICAgcGF0aC5wb3AoKTtcbiAgICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAgIHZhciBrZXlzID0gT2JqZWN0L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IGhvdyBtYW55IGFyZSBjb21waWxlZCBub3dcbiAgICAgICAgY29tcGlsZWQgPSBjb21waWxlQXJyYXlPZlNjaGVtYXNMb29wLmNhbGwodGhpcywgcmVwb3J0LCBhcnIpO1xuXG4gICAgICAgIC8vIGZpeCBfXyRtaXNzaW5nUmVmZXJlbmNlcyBpZiBwb3NzaWJsZVxuICAgICAgICBpZHggPSBhcnIubGVuZ3RoO1xuICAgICAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgICAgIHZhciBzY2ggPSBhcnJbaWR4XTtcbiAgICAgICAgICAgIGlmIChzY2guX18kbWlzc2luZ1JlZmVyZW5jZXMpIHtcbiAgICAgICAgICAgICAgICB2YXIgaWR4MiA9IHNjaC5fXyRtaXNzaW5nUmVmZXJlbmNlcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgd2hpbGUgKGlkeDItLSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgcmVmT2JqID0gc2NoLl9fJG1pc3NpbmdSZWZlcmVuY2VzW2lkeDJdO1xuICAgICAgICAgICAgICAgICAgICB2YXIgcmVzcG9uc2UgPSBmaW5kSWQoYXJyLCByZWZPYmoucmVmKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIG1pZ2h0IGNyZWF0ZSBjaXJjdWxhciByZWZlcmVuY2VzXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZPYmoub2JqW1wiX19cIiArIHJlZk9iai5rZXkgKyBcIlJlc29sdmVkXCJdID0gcmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBpdCdzIHJlc29sdmVkIG5vdyBzbyBkZWxldGUgaXRcbiAgICAgICAgICAgICAgICAgICAgICAgIHNjaC5fXyRtaXNzaW5nUmVmZXJlbmNlcy5zcGxpY2UoaWR4MiwgMSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9X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HZhciBzY2hlbWFSZWFkZXIgPSB0aGlzLmdldFNjaGVtYVJlYWRlcigpO1xuICAgICAgICAgICAgaWYgKHNjaGVtYVJlYWRlcikge1xuICAgICAgICAgICAgICAgIC8vIGl0J3Mgc3VwcG9zZWQgdG8gcmV0dXJuIGEgdmFsaWQgc2NoZW1hXG4gICAgICAgICAgICAgICAgdmFyIHMgPSBzY2hlbWFSZWFkZXIocmVmT2JqLnJlZik7XG4gICAgICAgICAgICAgICAgaWYgKHMpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gaXQgbmVlZHMgdG8gaGF2ZSB0aGUgaWRcbiAgICAgICAgICAgICAgICAgICAgcy5pZCA9IHJlZk9iai5yZWY7XG4gICAgICAgICAgICAgICAgICAgIC8vIHRyeSB0byBjb21waWxlIHRoZSBzY2hlbWFcbiAgICAgICAgICAgICAgICAgICAgdmFyIHN1YnJlcG9ydCA9IG5ldyBSZXBvcnQocmVwb3J0KTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFleHBvcnRzLmNvbXBpbGVTY2hlbWEuY2FsbCh0aGlzLCBzdWJyZXBvcnQsIHMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBjb3B5IGVycm9ycyB0byByZXBvcnRcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcG9ydC5lcnJvcnMgPSByZXBvcnQuZXJyb3JzLmNvbmNhdChzdWJyZXBvcnQuZXJyb3JzKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gU2NoZW1hQ2FjaGUuZ2V0U2NoZW1hQnlVcmkuY2FsbCh0aGlzLCByZXBvcnQsIHJlZk9iai5yZWYsIHNjaGVtYSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoIXJlc3BvbnNlKSB7XG5cbiAgICAgICAgICA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FEZXBlbmRlbmN5ID0gc2NoZW1hLmRlcGVuZGVuY2llc1tzY2hlbWFLZXldLFxuICAgICAgICAgICAgICAgICAgICB0eXBlID0gVXRpbHMud2hhdElzKHNjaGVtYURlcGVuZGVuY3kpO1xuXG4gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucHVzaChcImRlcGVuZGVuY2llc1wiKTtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucHVzaChzY2hlbWFLZXkpO1xuICAgICAgICAgICAgICAgICAgICBleHBvcnRzLnZhbGlkYXRlU2NoZW1hLmNhbGwodGhpcywgcmVwb3J0LCBzY2hlbWFEZXBlbmRlbmN5KTtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LnBhdGgucG9wKCk7XG4gICAgICAgICAgICAgICAgICAgIHJlcG9ydC5wYXRoLnBvcCgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gXCJhcnJheVwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBpZHgyID0gc2NoZW1hRGVwZW5kZW5jeS5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpZHgyID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX01VU1RfQkVcIiwgW1wiZGVwZW5kZW5jaWVzXCIsIFwibm90IGVtcHR5IGFycmF5XCJdKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB3aGlsZSAoaWR4Mi0tKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHNjaGVtYURlcGVuZGVuY3lbaWR4Ml0gIT09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1ZBTFVFX1RZUEVcIiwgW1wiZGVwZW5kZW5zaWNlc1wiLCBcInN0cmluZ1wiXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKFV0aWxzLmlzVW5pcXVlQXJyYXkoc2NoZW1hRGVwZW5kZW5jeSkgPT09IGZhbHNlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX01VU1RfQkVcIiwgW1wiZGVwZW5kZW5jaWVzXCIsIFwiYW4gYXJyYXkgd2l0aCB1bmlxdWUgaXRlbXNcIl0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9WQUxVRV9UWVBFXCIsIFtcImRlcGVuZGVuY2llc1wiLCBcIm9iamVjdCBvciBhcnJheVwiXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcbiAgICBlbnVtOiBmdW5jdGlvbiAocmVwb3J0LCBzY2hlbWEpIHtcbiAgICAgICAgLy8gaHR0cDovL2pzb24tc2NoZW1hLm9yZy9sYXRlc3QvanNvbi1zY2hlbWEtdmFsaWRhdGlvbi5odG1sI3JmYy5zZWN0aW9uLjUuNS4xLjFcbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoc2NoZW1hLmVudW0pID09PSBmYWxzZSkge1xuICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9UWVBFX0VYUEVDVEVEXCIsIFtcImVudW1cIiwgXCJhcnJheVwiXSk7XG4gICAgICAgIH0gZWxzZSBpZiAoc2NoZW1hLmVudW0ubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX01VU1Rf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maW5lZCAmJlxuICAgICAgICAgICAgICAgICAgICBzY2hlbWEuZm9ybWF0ID09PSB1bmRlZmluZWQpIHtcblxuICAgICAgICAgICAgICAgICAgICBzY2hlbWEubWluTGVuZ3RoID0gMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5ub0VtcHR5QXJyYXlzID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwiYXJyYXlcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJhcnJheVwiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1pbkl0ZW1zID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hLm1pbkl0ZW1zID0gMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZVByb3BlcnRpZXMgPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZSA9PT0gXCJvYmplY3RcIiB8fCBpc0FycmF5ICYmIHNjaGVtYS50eXBlLmluZGV4T2YoXCJvYmplY3RcIikgIT09IC0xKSB7XG4gICAgICAgICAgICAgICAgaWYgKHNjaGVtYS5wcm9wZXJ0aWVzID09PSB1bmRlZmluZWQgJiYgc2NoZW1hLnBhdHRlcm5Qcm9wZXJ0aWVzID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcInByb3BlcnRpZXNcIl0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLmZvcmNlSXRlbXMgPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZSA9PT0gXCJhcnJheVwiIHx8IGlzQXJyYXkgJiYgc2NoZW1hLnR5cGUuaW5kZXhPZihcImFycmF5XCIpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIGlmIChzY2hlbWEuaXRlbXMgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1VOREVGSU5FRF9TVFJJQ1RcIiwgW1wiaXRlbXNcIl0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLmZvcmNlTWluSXRlbXMgPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZSA9PT0gXCJhcnJheVwiIHx8IGlzQXJyYXkgJiYgc2NoZW1hLnR5cGUuaW5kZXhPZihcImFycmF5XCIpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIGlmIChzY2hlbWEubWluSXRlbXMgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1VOREVGSU5FRF9TVFJJQ1RcIiwgW1wibWluSXRlbXNcIl0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLmZvcmNlTWF4SXRlbXMgPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEudHlwZSA9PT0gXCJhcnJheVwiIHx8IGlzQXJyYXkgJiYgc2NoZW1hLnR5cGUuaW5kZXhPZihcImFycmF5XCIpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIGlmIChzY2hlbWEubWF4SXRlbXMgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1VOREVGSU5FRF9TVFJJQ1RcIiwgW1wibWF4SXRlbXNcIl0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5vcHRpb25zLmZvcmNlTWluTGVuZ3RoID09PSB0cnVlKSB7XG4gICAgICAgICAgICBpZiAoc2NoZW1hLnR5cGUgPT09IFwic3RyaW5nXCIgfHwgaXNBcnJheSAmJiBzY2hlbWEudHlwZS5pbmRleE9mKFwic3RyaW5nXCIpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIGlmIChzY2hlbWEubWluTGVuZ3RoID09PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hLmZvcm1hdCA9PT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5lbnVtID09PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICAgICAgc2NoZW1hLnBhdHRlcm4gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1VOREVGSU5FRF9TVFJJQ1RcIiwgW1wibWluTGVuZ3RoXCJdKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5mb3JjZU1heExlbmd0aCA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgaWYgKHNjaGVtYS50eXBlID09PSBcInN0cmluZ1wiIHx8IGlzQXJyYXkgJiYgc2NoZW1hLnR5cGUuaW5kZXhPZihcInN0cmluZ1wiKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBpZiAoc2NoZW1hLm1heExlbmd0aCA9PT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgIHNjaGVtYS5mb3JtYXQgPT09IHVuZGVmaW5lZCAmJlxuICAgICA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AgIHZhciBrZXlzID0gT2JqZWN0LmtleXMoc2NoZW1hLmRlZmluaXRpb25zKSxcbiAgICAgICAgICAgICAgICBpZHggPSBrZXlzLmxlbmd0aDtcbiAgICAgICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAgICAgIHZhciBrZXkgPSBrZXlzW2lkeF0sXG4gICAgICAgICAgICAgICAgICAgIHZhbCA9IHNjaGVtYS5kZWZpbml0aW9uc1trZXldO1xuICAgICAgICAgICAgICAgIHJlcG9ydC5wYXRoLnB1c2goXCJkZWZpbml0aW9uc1wiKTtcbiAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wdXNoKGtleSk7XG4gICAgICAgICAgICAgICAgZXhwb3J0cy52YWxpZGF0ZVNjaGVtYS5jYWxsKHRoaXMsIHJlcG9ydCwgdmFsKTtcbiAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgICAgICAgICByZXBvcnQucGF0aC5wb3AoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgZm9ybWF0OiBmdW5jdGlvbiAocmVwb3J0LCBzY2hlbWEpIHtcbiAgICAgICAgaWYgKHR5cGVvZiBzY2hlbWEuZm9ybWF0ICE9PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1RZUEVfRVhQRUNURURcIiwgW1wiZm9ybWF0XCIsIFwic3RyaW5nXCJdKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChGb3JtYXRWYWxpZGF0b3JzW3NjaGVtYS5mb3JtYXRdID09PSB1bmRlZmluZWQgJiYgdGhpcy5vcHRpb25zLmlnbm9yZVVua25vd25Gb3JtYXRzICE9PSB0cnVlKSB7XG4gICAgICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiVU5LTk9XTl9GT1JNQVRcIiwgW3NjaGVtYS5mb3JtYXRdKTtcbiAgIC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iZcbiAgICAgICAgICAgIHNjaGVtYS5ub3QgPT09IHVuZGVmaW5lZCAmJlxuICAgICAgICAgICAgc2NoZW1hLiRyZWYgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmVwb3J0LmFkZEVycm9yKFwiS0VZV09SRF9VTkRFRklORURfU1RSSUNUXCIsIFtcInR5cGVcIl0pO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgdmFyIGtleXMgPSBPYmplY3Qua2V5cyhzY2hlbWEpLFxuICAgICAgICBpZHggPSBrZXlzLmxlbmd0aDtcbiAgICB3aGlsZSAoaWR4LS0pIHtcbiAgICAgICAgdmFyIGtleSA9IGtleXNbaWR4XTtcbiAgICAgICAgaWYgKGtleS5pbmRleE9mKFwiX19cIikgPT09IDApIHsgY29udGludWU7IH1cbiAgICAgICAgaWYgKFNjaGVtYVZhbGlkYXRvcnNba2V5XSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBTY2hlbWFWYWxpZGF0b3JzW2tleV0uY2FsbCh0aGlzLCByZXBvcnQsIHNjaGVtYSk7XG4gICAgICAgIH0gZWxzZSBpZiAoIWhhc1BhcmVudFNjaGVtYSkge1xuICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5ub0V4dHJhS2V5d29yZHMgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICByZXBvcnQuYWRkRXJyb3IoXCJLRVlXT1JEX1VORVhQRUNURURcIiwgW2tleV0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHRoaXMub3B0aW9ucy5wZWRhbnRpY0NoZWNrID09PSB0cnVlKSB7XG4gICAgICAgIGlmIChzY2hlbWEuZW51bSkge1xuICAgICAgICAgICAgLy8gYnJlYWsgcmVjdXJzaW9uXG4gICAgICAgICAgICB2YXIgdG1wU2NoZW1hID0gVXRpbHMuY2xvbmUoc2NoZW1hKTtcbiAgICAgICAgICAgIGRlbGV0ZSB0bXBTY2hlbWEu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4cG9ydHMuaXNSZWxhdGl2ZVVyaSA9IGZ1bmN0aW9uICh1cmkpIHtcbiAgICAvLyByZWxhdGl2ZSBVUklzIHRoYXQgZW5kIHdpdGggYSBoYXNoIHNpZ24sIGlzc3VlICM1NlxuICAgIHJldHVybiAvLisjLy50ZXN0KHVyaSk7XG59O1xuXG5leHBvcnRzLndoYXRJcyA9IGZ1bmN0aW9uICh3aGF0KSB7XG5cbiAgICB2YXIgdG8gPSB0eXBlb2Ygd2hhdDtcblxuICAgIGlmICh0byA9PT0gXCJvYmplY3RcIikge1xuICAgICAgICBpZiAod2hhdCA9PT0gbnVsbCkge1xuICAgICAgICAgICAgcmV0dXJuIFwibnVsbFwiO1xuICAgICAgICB9XG4gICAgICAgIGlmIChBcnJheS5pc0FycmF5KHdoYXQpKSB7XG4gICAgICAgICAgICByZXR1cm4gXCJhcnJheVwiO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBcIm9iamVjdFwiOyAvLyB0eXBlb2Ygd2hhdCA9PT0gJ29iamVjdCcgJiYgd2hhdCA9PT0gT2JqZWN0KHdoYXQpICYmICFBcnJheS5pc0FycmF5KHdoYXQpO1xuICAgIH1cblxuICAgIGlmICh0byA9PT0gXCJudW1iZXJcIikge1xuICAgICAgICBpZiAoTnVtYmVyLmlzRmluaXRlKHdoYXQpKSB7XG4gICAgICAgICAgICBpZiAod2hhdCAlIDEgPT09IDApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gXCJpbnRlZ2VyXCI7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBcIm51bWJlclwiO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmIChOdW1iZXIuaXNOYU4od2hhdCkpIHtcbiAgICAgICAgICAgIHJldHVybiBcIm5vdC1hLW51bWJlclwiO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBcInVua25vd24tbnVtYmVyXCI7XG4gICAgfVxuXG4gICAgcmV0dXJu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sZW4gPSBqc29uMS5sZW5ndGg7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xuICAgICAgICAgICAgaWYgKCFhcmVFcXVhbChqc29uMVtpXSwganNvbjJbaV0pKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cblxuICAgIC8vIGJvdGggYXJlIG9iamVjdHMsIGFuZDpcbiAgICBpZiAoZXhwb3J0cy53aGF0SXMoanNvbjEpID09PSBcIm9iamVjdFwiICYmIGV4cG9ydHMud2hhdElzKGpzb24yKSA9PT0gXCJvYmplY3RcIikge1xuICAgICAgICAvLyBoYXZlIHRoZSBzYW1lIHNldCBvZiBwcm9wZXJ0eSBuYW1lczsgYW5kXG4gICAgICAgIHZhciBrZXlzMSA9IE9iamVjdC5rZXlzKGpzb24xKTtcbiAgICAgICAgdmFyIGtleXMyID0gT2JqZWN0LmtleXMoanNvbjIpO1xuICAgICAgICBpZiAoIWFyZUVxdWFsKGtleXMxLCBrZXlzMikpIHtcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICAvLyB2YWx1ZXMgZm9yIGEgc2FtZSBwcm9wZXJ0eSBuYW1lIGFyZSBlcXVhbCBhY2NvcmRpbmcgdG8gdGhpcyBkZWZpbml0aW9uLlxuICAgICAgICBsZW4gPSBrZXlzMS5sZW5ndGg7XG4gICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkrKykge1xuICAgICAgICAgICAgaWYgKCFhcmVFcXVhbChqc29uMVtrZXlzMVtpXV0sIGpzb24yW2tleXMxW2ldXSkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuXG4gICAgcmV0dXJuIGZhbHNlO1xufTtc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oc3JjKSkge1xuICAgICAgICByZXMgPSBbXTtcbiAgICAgICAgaWR4ID0gc3JjLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKGlkeC0tKSB7XG4gICAgICAgICAgICByZXNbaWR4XSA9IHNyY1tpZHhdO1xuICAgICAgICB9XG4gICAgfSBlbHNlIHtcbiAgICAgICAgcmVzID0ge307XG4gICAgICAgIHZhciBrZXlzID0gT2JqZWN0LmtleXMoc3JjKTtcbiAgICAgICAgaWR4ID0ga2V5cy5sZW5ndGg7XG4gICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAgdmFyIGtleSA9IGtleXNbaWR4XTtcbiAgICAgICAgICAgIHJlc1trZXldID0gc3JjW2tleV07XG4gICAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHJlcztcbn07XG5cbmV4cG9ydHMuY2xvbmVEZWVwID0gZnVuY3Rpb24gKHNyYykge1xuICAgIHZhciB2aXNpdGVkID0gW10sIGNsb25lZCA9IFtdO1xuICAgIGZ1bmN0aW9uIGNsb25lRGVlcChzcmMpIHtcbiAgICAgICAgaWYgKHR5cGVvZiBzcmMgIT09IFwib2JqZWN0XCIgfHwgc3JjID09PSBudWxsKSB7IHJldHVybiBzcmM7IH1cbiAgICAgICAgdmFyIHJlcywgaWR4LCBjaWR4O1xuXG4gICAgICAgIGNpZHggPSB2aXNpdGVkLmluZGV4T2Yoc3JjKTtcbiAgICAgICAgaWYgKGNpZHggIT09IC0xKSB7IHJldHVybiBjbG9uZWRbY2lkeF07IH1cblxuICAgICAgICB2aXNpdGVkLnB1c2goc3JjKTtcbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoc3JjKSkge1xuICAgICAgICAgICAgcmVzID0gW107XG4gICAgICAgICAgICBjbG9uZWQucHVzaChyZXMpO1xuICAgICAgICAgICAgaWR4ID0gc3JjLmxlbmd0aDtcbiAgICAgICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAgICAgIHJlc1tpZHhdID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O1xuXG4gICAgICAgIC8vIGNoZWNrIHRoYXQgdGhlIG9wdGlvbnMgYXJlIGNvcnJlY3RseSBjb25maWd1cmVkXG4gICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAga2V5ID0ga2V5c1tpZHhdO1xuICAgICAgICAgICAgaWYgKGRlZmF1bHRPcHRpb25zW2tleV0gPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIlVuZXhwZWN0ZWQgb3B0aW9uIHBhc3NlZCB0byBjb25zdHJ1Y3RvcjogXCIgKyBrZXkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gY29weSB0aGUgZGVmYXVsdCBvcHRpb25zIGludG8gcGFzc2VkIG9wdGlvbnNcbiAgICAgICAga2V5cyA9IE9iamVjdC5rZXlzKGRlZmF1bHRPcHRpb25zKTtcbiAgICAgICAgaWR4ID0ga2V5cy5sZW5ndGg7XG4gICAgICAgIHdoaWxlIChpZHgtLSkge1xuICAgICAgICAgICAga2V5ID0ga2V5c1tpZHhdO1xuICAgICAgICAgICAgaWYgKG9wdGlvbnNba2V5XSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgb3B0aW9uc1trZXldID0gVXRpbHMuY2xvbmUoZGVmYXVsdE9wdGlvbnNba2V5XSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBub3JtYWxpemVkID0gb3B0aW9ucztcbiAgICB9IGVsc2Uge1xuICAgICAgICBub3JtYWxpemVkID0gVXRpbHMuY2xvbmUoZGVmYXVsdE9wdGlvbnMpO1xuICAgIH1cblxuICAgIGlmIChub3JtYWxpemVkLnN0cmljdE1vZGUgPT09IHRydWUpIHtcbiAgICAgICAgbm9ybWFsaXplZC5mb3JjZUFkZGl0aW9uYWwgID0gdHJ1ZTtcbiAgICAgICAgbm9ybWFsaXplZC5mb3JjZUl0ZW1zICAgICAgID0gdHJ1Z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VkKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBzY2hlbWEuX19fJHZpc2l0ZWQgPSB0cnVlO1xuICAgICAgICB2aXNpdGVkLnB1c2goc2NoZW1hKTtcblxuICAgICAgICBpZiAoc2NoZW1hLiRyZWYgJiYgc2NoZW1hLl9fJHJlZlJlc29sdmVkKSB7XG4gICAgICAgICAgICB2YXIgZnJvbSA9IHNjaGVtYS5fXyRyZWZSZXNvbHZlZDtcbiAgICAgICAgICAgIHZhciB0byA9IHNjaGVtYTtcbiAgICAgICAgICAgIGRlbGV0ZSBzY2hlbWEuJHJlZjtcbiAgICAgICAgICAgIGRlbGV0ZSBzY2hlbWEuX18kcmVmUmVzb2x2ZWQ7XG4gICAgICAgICAgICBmb3IgKGtleSBpbiBmcm9tKSB7XG4gICAgICAgICAgICAgICAgaWYgKGZyb20uaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICAgICAgICB0b1trZXldID0gZnJvbVtrZXldO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBmb3IgKGtleSBpbiBzY2hlbWEpIHtcbiAgICAgICAgICAgIGlmIChzY2hlbWEuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgICAgIGlmIChrZXkuaW5kZXhPZihcIl9fJFwiKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBkZWxldGUgc2NoZW1hW2tleV07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgY2xlYW51cChzY2hlbWFba2V5XSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcblxuICAgIGNsZWFudXAoc2NoZW1hKTtcbiAgICB2aXNpdGVkLmZvckVhY2goZnVuY3Rpb24gKHMpIHtcbiAgICAgICAgZGVsZXRlIHMuX19fJHZpc2l0ZWQ7X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dG9ycyk7XG59O1xuWlNjaGVtYS5nZXREZWZhdWx0T3B0aW9ucyA9IGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gVXRpbHMuY2xvbmVEZWVwKGRlZmF1bHRPcHRpb25zKTtcbn07XG5cbm1vZHVsZS5leHBvcnRzID0gWlNjaGVtYTtcbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcIiRzY2hlbWFcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L2h5cGVyLXNjaGVtYSNcIixcbiAgICBcImlkXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9oeXBlci1zY2hlbWEjXCIsXG4gICAgXCJ0aXRsZVwiOiBcIkpTT04gSHlwZXItU2NoZW1hXCIsXG4gICAgXCJhbGxPZlwiOiBbXG4gICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiXG4gICAgICAgIH1cbiAgICBdLFxuICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiYWRkaXRpb25hbEl0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiNcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIlxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiNcIlxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcImFsbE9mXCI6IHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIlxuICAgICAgICB9LFxuICAgICAgICBcImFueU9mXCI6IHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIlxuICAgICAgICB9LFxuICAgICAgICBcIm9uZU9mXCI6IHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIlxuICAgICAgICB9LFxuICAgICAgICBcIm5vdFwiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjXCJcbiAgICAgICAgfSxcblxuICAgICAgICBcImxpbmtzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2xpbmtEZXNjcmlwdGlvblwiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZnJhZ21lbnRSZXNvbHV0aW9uXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWVkaWFcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJBIG1lZGlhIHR5cGUsIGFzIGRlc2NyaWJlZCBpbiBSRkMgMjA0NlwiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJiaW5hcnlFbmNvZGluZ1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJBIGNvbnRlbnQgZW5jb2Rpbmcgc2NoZW1lLCBhcyBkZXNjcmliZWQgaW4gUkZDIDIwNDVcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0aFN0YXJ0XCI6IHtcbiAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJJbnN0YW5jZXMnIFVSSXMgbXVzdCBzdGFydCB3aXRoIHRoaXMgdmFsdWUgZm9yIHRoaXMgc2NoZW1hIHRvIGFwcGx5IHRvIHRoZW1cIixcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9XG4gICAgfSxcbiAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgXCJzY2hlbWFBcnJheVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwibGlua0Rlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICAgIFwidGl0bGVcIjogXCJMaW5rIERlc2NyaXB0aW9uIE9iamVjdFwiLFxuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJocmVmXCIsIFwicmVsXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJocmVmXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcImEgVVJJIHRlbXBsYXRlLCBhcyBkZWZpbmVkIGJ5IFJGQyA2NTcwLCB3aXRoIHRoZSBhZGRpdGlvbiBvZiB0aGUgJCwgKCBhbmQgKSBjaGFyYWN0ZXJzIGZvciBwcmUtcHJvY2Vzc2luZ1wiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJyZWxcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwicmVsYXRpb24gdG8gdGhlIHRhcmdldCByZXNvdXJjZSBvZiB0aGUgbGlua1wiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJ0aXRsZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJhIHRpdGxlIGZvciB0aGUgbGlua1wiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJ0YXJnZXRTY2hlbWFcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiSlNPTiBTY2hlbWEgZGVzY3JpYmluZyB0aGUgbGluayB0YXJnZXRcIixcbiAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiI1wiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1lZGlhVHlwZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJtZWRpYSB0eXBlIChhcyBkZWZpbmVkIGJ5IFJGQyAyMDQ2KSBkZXNjcmliaW5nIHRoZSBsaW5rIHRhcmdldFwiLFxuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJtZXRob2RcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwibWV0aG9kIGZvciByZXF1ZXN0aW5nIHRoZSB0YXJnZXQgb2YgdGhlIGxpbmsgKGUuZy4gZm9yIEhUVFAgdGhpcyBtaWdodCBiZSBcXFwiR0VUXFxcIiBvciBcXFwiREVMRVRFXFxcIilcIixcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZW5jVHlwZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgbWVkaWEgdHlwZSBpbiB3aGljaCB0byBzdWJtaXQgZGF0YSBhbG9uZyB3aXRoIHRoZSByZXF1ZXN0XCIsXG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgICAgICAgICBcImRlZmF1bHRcIjogXCJhcHBsaWNhdGlvbi9qc29uXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwic2NoZW1hXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIlNjaGVtYSBkZXNjcmliaW5nIHRoZSBkYXRhIHRvIHN1Ym1pdCBhbG9uZyB3aXRoIHRoZSByZXF1ZXN0XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiJHJ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gICAgICAgIFwic3RyaW5nQXJyYXlcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH1cbiAgICB9LFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiaWRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiJHNjaGVtYVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0aXRsZVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7fSxcbiAgICAgICAgXCJtdWx0aXBsZU9mXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJtaW5pbXVtXCI6IDAsXG4gICAgICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjogdHJ1ZVxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwibnVtYmVyXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwibnVtYmVyXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyXCIgfSxcbiAgICAgICAgXCJtaW5MZW5ndGhcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlckRlZmF1bHQwXCIgfSxcbiAgICAgICAgXCJwYXR0ZXJuXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJyZWdleFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYWRkaXRpb25hbEl0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH0sXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgXSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmlu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gICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcImRlcGVuZGVuY2llc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXlcIiB9XG4gICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcImVudW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NpbXBsZVR5cGVzXCIgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NpbXBsZVR5cGVzXCIgfSxcbiAgICAgICAgICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9LFxuICAgICAgICBcImFueU9mXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH0sXG4gICAgICAgIFwib25lT2ZcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCIgfSxcbiAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgIH0sXG4gICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjogWyBcIm1heGltdW1cIiBdLFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjogWyBcIm1pbmltdW1cIiBdXG4gICAgfSxcbiAgICBcImRlZmF1bHRcIjoge31cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHVi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JvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwibW9kZWxzT2JqZWN0Lmpzb24jXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJwcm9kdWNlc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWltZVR5cGVBcnJheVwiIH0sXG4gICAgICAgIFwiY29uc3VtZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICBcImF1dGhvcml6YXRpb25zXCI6IHsgXCIkcmVmXCI6IFwiYXV0aG9yaXphdGlvbk9iamVjdC5qc29uI1wiIH1cbiAgICB9LFxuICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwiYXBpT2JqZWN0XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwicGF0aFwiLCBcIm9wZXJhdGlvbnNcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInBhdGhcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmktdGVtcGxhdGVcIixcbiAgICAgICAgICAgICAgICAgICAgXCJwYXR0ZXJuXCI6IFwiXi9cIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJvcGVyYXRpb25zXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIm9wZXJhdGlvbk9iamVjdC5qc29uI1wiIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm1pbWVUeXBlQXJyYXlcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwibWltZS10eXBlXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9hdXRob3JpemF0aW9uT2JqZWN0Lmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYmFzaWNBdXRoXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9hcGlLZXlcIlxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlwiXG4gICAgICAgICAgICB9XG4gICAgICAgIF1cbiAgICB9LFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcImJhc2ljQXV0aFwiOiB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0eXBlXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJiYXNpY0F1dGhcIiBdIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXBpS2V5XCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiwgXCJwYXNzQXNcIiwgXCJrZXluYW1lXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJhcGlLZXlcIiBdIH0sXG4gICAgICAgICAgICAgICAgXCJwYXNzQXNcIjogeyBcImVudW1cIjogWyBcImhlYWRlclwiLCBcInF1ZXJ5XCIgXSB9LFxuICAgICAgICAgICAgICAgIFwia2V5bmFtZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwib2F1dGgyXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiLCBcImdyYW50VHlwZXNcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcIm9hdXRoMlwiIF0gfSxcbiAgICAgICAgICAgICAgICBcInNjb3Blc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3BlXCIgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJncmFudFR5cGVzXCI6IHsgXCIkcmVmXCI6IFwib2F1dGgyR3JhbnRUeXBlLmpzb24jXCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJvYXV0aDJTY29wZVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInNjb3BlXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJzY29wZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH1cbiAgICB9XG59XG5cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9kYXRhVHlwZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAg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gICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgICAgICAgICBcIm5vdFwiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcImJvb2xlYW5cIiwgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIsIFwic3RyaW5nXCIsIFwiYXJyYXlcIiBdXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInByaW1pdGl2ZVR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwiZW51bVwiOiBbIFwiYm9vbGVhblwiLCBcImludGVnZXJcIiwgXCJudW1iZXJcIiwgXCJzdHJpbmdcIiBdXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJkZWZhdWx0VmFsdWVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcIm5vdFwiOiB7IFwidHlwZVwiOiBbIFwiYXJyYXlcIiwgXCJvYmplY3RcIiwgXCJudWxsXCIgXSB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcImVudW1cIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWluaW11bVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJtYXhpbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICAgICAgICBcImRlcGVuZGVuY2llc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHsgXCJlbnVtXCI6IFsgXCJpbnQzMlwiLCBcImludDY0XCIgXSB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcIm51bWJlclwiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcImVudW1cIjogWyBcImZsb2F0XCIsIFwiZG91YmxlXCIgXSB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcInN0cmluZ1wiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJieXRlXCIsIFwiZGF0ZVwiLCBcImRhdGUtdGltZVwiIF1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwic3RyaW5nXCIgXSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiwgXCJudW1iZXJcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiaW50ZWdlclwiLCBcIm51bWJlclwiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcImFycmF5VHlwZVwiOiB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0eXBlXCIsIFwiaXRlbXNcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImFycmF5XCIgXSB9LFxuICAgICAgICAgICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9pdGVtc09iamVjdFwiIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogeyBcInR5cGVcIjogXCJib29sZWFuXCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc09iamVjdFwiOiB7XG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcmVmVHlwZVwiXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiYWxsT2ZcIjogW1xuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlVHlwZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7fSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge31cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn0iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvZGF0YVR5cGVCYXNlLmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJkZXNjcmlwdGlvblwiOiBcIkRhdGEgdHlwZSBmaWVsZHMgKHNlY3Rpb24gNC4zLjMpXCIsXG4gICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgXCJvbmVPZlwiOiBbXG4gICAgICAgIHsgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0gfSxcbiAgICAgICAgeyBcInJlcXVpcmVkXCI6IFsgXCIkcmVmXCIgXSB9XG4gICAgXSxcbiAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcIiRyZWZcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgIFwiZGVmYXVsdFZhbHVlXCI6IHtcbiAgICAgICAgICAgIFwibm90XCI6IHsgXCJ0eXBlXCI6IFsgXCJhcnJheVwiLCBcIm9iamVjdFwiLCBcIm51bGxcIiBdIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZSxcbiAgICAgICAgICAgIFwibWluSXRlbXNcIjogMVxuICAgICAgICB9LFxuICAgICAgICBcIm1pbmltdW1cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcIm1heGltdW1cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9pdGVtc09iamVjdFwiIH0sXG4gICAgICAgIFwidW5pcXVlSXRlbXNcIjogeyBcInR5cGVcIjogXCJib29sZWFuXCIgfVxuICAgIH0sXG4gICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiaW50MzJcIiwgXCJpbnQ2NFwiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcIm51bWJlclwiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHsgXCJlbnVtXCI6IFsgXCJmbG9hdFwiLCBcImRvdWJsZVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcInN0cmluZ1wiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcImJ5dGVcIiwgXCJkYXRlXCIsIFwiZGF0ZS10aW1lXCIgXVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9XG4gICAgfSxcbiAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgXCJpdGVtc09iamVjdFwiOiB7XG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCIkcmVmXCIgXSxcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcImFsbE9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHt9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7fVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9XG4gICAgfVxufVxuIiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL2luZm9PYmplY3QuanNvbiNcIixcbiAgICBcIiRzY2hlbWFcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIixcbiAgICBcImRlc2NyaXB0aW9uXCI6IFwiaW5mbyBvYmplY3QgKHNlY3Rpb24gNS4xLjMpXCIsXG4gICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgXCJyZXF1aXJlZFwiOiBbIFwidGl0bGVcIiwgXCJkZXNjcmlwdGlvblwiIF0sXG4gICAgXCJwcm9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I6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcm9wZXJ0eU9iamVjdFwiIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzdWJUeXBlc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJkaXNjcmltaW5hdG9yXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfVxuICAgIH0sXG4gICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICBcInN1YlR5cGVzXCI6IFsgXCJkaXNjcmltaW5hdG9yXCIgXVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwicHJvcGVydHlPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJhbGxPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIm5vdFwiOiB7IFwiJHJlZlwiOiBcIiNcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcImRhdGFUeXBlQmFzZS5qc29uI1wiXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9XG4gICAgfVxufVxuXG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvb2F1dGgyR3JhbnRUeXBlLmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9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ludFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdG9rZW5FbmRwb2ludFwiIH0sXG4gICAgICAgICAgICAgICAgXCJ0b2tlblJlcXVlc3RFbmRwb2ludFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdG9rZW5SZXF1ZXN0RW5kcG9pbnRcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcImxvZ2luRW5kcG9pbnRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ1cmxcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInVybFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcInVyaVwiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwidG9rZW5FbmRwb2ludFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInVybFwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidXJsXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIsIFwiZm9ybWF0XCI6IFwidXJpXCIgfSxcbiAgICAgICAgICAgICAgICBcInRva2VuTmFtZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAg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EXCIsIFwiUE9TVFwiLCBcIlBVVFwiLCBcIlBBVENIXCIsIFwiREVMRVRFXCIsIFwiT1BUSU9OU1wiIF0gfSxcbiAgICAgICAgICAgICAgICBcInN1bW1hcnlcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiwgXCJtYXhMZW5ndGhcIjogMTIwIH0sXG4gICAgICAgICAgICAgICAgXCJub3Rlc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJuaWNrbmFtZVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgICAgICAgICBcInBhdHRlcm5cIjogXCJeW2EtekEtWjAtOV9dKyRcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJhdXRob3JpemF0aW9uc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCJhdXRob3JpemF0aW9uT2JqZWN0Lmpzb24jL2RlZmluaXRpb25zL29hdXRoMlNjb3BlXCJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJwYXJhbWV0ZXJzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcInBhcmFtZXRlck9iamVjdC5qc29uI1wiIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicmVzcG9uc2VNZXNzYWdlc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Jlc3BvbnNlTWVzc2FnZU9iamVjdFwifVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJwcm9kdWNlc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWltZVR5cGVBcnJheVwiIH0sXG4gICAgICAgICAgICAgICAgXCJjb25zdW1lc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWltZVR5cGVBcnJheVwiIH0sXG4gICAgICAgICAgICAgICAgXCJkZXByZWNhdGVkXCI6IHsgXCJlbnVtXCI6IFsgXCJ0cnVlXCIsIFwiZmFsc2VcIiBdIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIF0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwicmVzcG9uc2VNZXNzYWdlT2JqZWN0XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiY29kZVwiLCBcIm1lc3NhZ2VcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcImNvZGVcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3JmYzI2MTZzZWN0aW9uMTBcIiB9LFxuICAgICAgICAgICAgICAgIFwibWVzc2FnZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJyZXNwb25zZU1vZGVsXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcInJmYzI2MTZzZWN0aW9uMTBcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJtaW5pbXVtXCI6IDEwMCxcbiAgICAgICAgICAgIFwibWF4aW11bVwiOiA2MDAsXG4gICAgICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjogdHJ1ZVxuICAgICAgICB9LFxuICAgICAgICBcIm1pbWVUeXBlQXJyYXlcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwibWltZS10eXBlXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9wYXJhbWV0ZXJPYmplY3QuanNvbiNcIixcbiAgICBcIiRzY2hlbWFcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIixcbiAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICBcImFsbE9mXCI6IFtcbiAgICAgICAgeyBcIiRyZWZcIjogXCJkYXRhVHlwZUJhc2UuanNvbiNcIiB9LFxuICAgICAgICB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJwYXJhbVR5cGVcIiwgXCJuYW1lXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJwYXJhbVR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcInBhdGhcIiwgXCJxdWVyeVwiLCBcImJvZHlcIiwgXCJoZWFkZXJcIiwgXCJmb3JtXCIgXVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJuYW1lXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgICAgICBcInJlcXVpcmVkXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH0sXG4gICAgICAgICAgICAgICAgXCJhbGxvd011bHRpcGxlXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcInR5cGUgRmlsZSByZXF1aXJlcyBzcGVjaWFsIHBhcmFtVHlwZSBhbmQgY29uc3VtZXNcIixcbiAgICAgICAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwibm90XCI6IHsgXCJlbnVtXCI6IFsgXCJGaWxlXCIgXSB9IH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJGaWxlXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJwYXJhbVR5cGVcIjogeyBcImVudW1cIjogWyBcImZvcm1cIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImNvbnN1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2hvdWxkIGJlIGRpZmZlcmVudCBmcm9tIHRoZSB0aXRsZS4gIEdpdEh1YiBGbGF2b3JlZCBNYXJrZG93biBpcyBhbGxvd2VkLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidGVybXNPZlNlcnZpY2VcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgdGVybXMgb2Ygc2VydmljZSBmb3IgdGhlIEFQSS5cIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbnRhY3RcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29udGFjdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibGljZW5zZVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9saWNlbnNlXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJjb250YWN0XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkNvbnRhY3QgaW5mb3JtYXRpb24gZm9yIHRoZSBvd25lcnMgb2YgdGhlIEFQSS5cIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgaWRlbnRpZnlpbmcgbmFtZSBvZiB0aGUgY29udGFjdCBwZXJzb24vb3JnYW5pemF0aW9uLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIFVSTCBwb2ludGluZyB0byB0aGUgY29udGFjdCBpbmZvcm1hdGlvbi5cIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZW1haWxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgZW1haWwgYWRkcmVzcyBvZiB0aGUgY29udGFjdCBwZXJzb24vb3JnYW5pemF0aW9uLlwiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwiZW1haWxcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwibGljZW5zZVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIlxuICAgICAgXSxcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgbmFtZSBvZiB0aGUgbGljZW5zZSB0eXBlLiBJdCdzIGVuY291cmFnZWQgdG8gdXNlIGFuIE9TSSBjb21wYXRpYmxlIGxpY2Vuc2UuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1cmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgVVJMIHBvaW50aW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B9LFxuICAgICAgICBcInVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwiZXhhbXBsZXNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHRydWVcbiAgICB9LFxuICAgIFwibWltZVR5cGVcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIE1JTUUgdHlwZSBvZiB0aGUgSFRUUCBtZXNzYWdlLlwiXG4gICAgfSxcbiAgICBcIm9wZXJhdGlvblwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInJlc3BvbnNlc1wiXG4gICAgICBdLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0YWdzXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAg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NyaXB0aW9uXCI6IFwiQSBsaXN0IG9mIE1JTUUgdHlwZXMgdGhlIEFQSSBjYW4gY29uc3VtZS5cIixcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21lZGlhVHlwZUxpc3RcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhcmFtZXRlcnNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGFyYW1ldGVyc0xpc3RcIlxuICAgICAgICB9LFxuICAgICAgICBcInJlc3BvbnNlc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZXNwb25zZXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInNjaGVtZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1lc0xpc3RcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlcHJlY2F0ZWRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJzZWN1cml0eVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zZWN1cml0eVwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwicGF0aEl0ZW1cIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICB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gICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcImRlc2NyaXB0aW9uXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcInNjaGVtYVwiOiB7XG4gICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZmlsZVNjaGVtYVwiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImhlYWRlcnNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaGVhZGVyc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhhbXBsZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhhbXBsZXNcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcImhlYWRlcnNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9oZWFkZXJcIlxuICAgICAgfVxuICAgIH0sXG4gICAgXCJoZWFkZXJcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwidHlwZVwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhMZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5MZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGF0dGVyblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4SXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4SXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy91bmlxdWVJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9lbnVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtdWx0aXBsZU9mXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL211bHRpcGxlT2ZcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwidmVuZG9yRXh0ZW5zaW9uXCI6IHtcbiAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJBbnkgcHJvcGVydHkgc3RhcnRpbmcgd2l0aCB4LSBpcyB2YWxpZC5cIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogdHJ1ZSxcbiAgICAgIFwiYWRkaXRpb25hbEl0ZW1zXCI6IHRydWVcbiAgICB9LFxuICAgIFwiYm9keVBhcmFtZXRlclwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIixcbiAgICAgICAgXCJpblwiLFxuICAgICAgICBcInNjaGVtYVwiXG4gICAgICBdLFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBicmllZiBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcImluXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiRGV0ZXJtaW5lcyB0aGUgbG9jYXRpb24gb2YgdGhlIHBhcmFtZXRlci5cIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJib2R5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwicmVxdWlyZWRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiRGV0ZXJtaW5lcyB3aGV0aGVyIG9yIG5vdCB0aGlzIHBhcmFtZXRlciBpcyByZXF1aXJlZCBvciBvcHRpb25hbC5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJzY2hlbWFcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZm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MgYWxsb3dlZC5cIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgbmFtZSBvZiB0aGUgcGFyYW1ldGVyLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYXJyYXlcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlc0l0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJjb2xsZWN0aW9uRm9ybWF0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2NvbGxlY3Rpb25Gb3JtYXRcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZGVmYXVsdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjog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XIuIFRoaXMgY291bGQgY29udGFpbiBleGFtcGxlcyBvZiB1c2UuICBHaXRIdWIgRmxhdm9yZWQgTWFya2Rvd24gaXMgYWxsb3dlZC5cIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgbmFtZSBvZiB0aGUgcGFyYW1ldGVyLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYWxsb3dFbXB0eVZhbHVlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJhbGxvd3Mgc2VuZGluZyBhIHBhcmFtZXRlciBieSBuYW1lIG9ubHkgb3Igd2l0aCBhbiBlbXB0eSB2YWx1ZS5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmX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ICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJmaWxlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0V2l0aE11bHRpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXC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ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJyZXF1aXJlZFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJyZXF1aXJlZFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICB0cnVlXG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiRGV0ZXJtaW5lcyB3aGV0aGVyIG9yIG5vdCB0aGlzIHBhcmFtZXRlciBpcyByZXF1aXJlZCBvciBvcHRpb25hbC5cIlxuICAgICAgICB9LFxuICAgICAgICBcImluXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiRGV0ZXJtaW5lcyB0aGUgbG9jYXRpb24gb2YgdGhlIHBhcmFtZXRlci5cIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJwYXRoXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJBIGJyaWVmIGRlc2NyaXB0aW9uIG9mIHRoZSBwYXJhbWV0ZXIuIFRoaXMgY291bGQgY29udGFpbiBleGFtcGxlcyBvZiB1c2UuICBHaXRIdWIgRmxhdm9yZWQgTWFya2Rvd24gaXMgYWxsb3dlZC5cIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJUaGUgbmFtZSBvZiB0aGUgcGFyYW1ldGVyLlwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYXJyYXlcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlc0l0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJjb2xsZWN0aW9uRm9ybWF0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2NvbGxlY3Rpb25Gb3JtYXRcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZGVmYXVsdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluaW11b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ICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjL3Byb3BlcnRpZXMvZW51bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICBdLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIy9wcm9wZXJ0aWVzL3R5cGVcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICBdLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcImFsbE9mXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJkaXNjcmltaW5hdG9yXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcInJlYWRPbmx5XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwieG1sXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3htbFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXh0ZXJuYWxEb2NzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4dGVybmFsRG9jc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhhbXBsZVwiOiB7fVxuICAgICAgfSxcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICB9LFxuICAgIFwiZmlsZVNjaGVtYVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIix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B9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImZpbGVcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJyZWFkT25seVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcImV4dGVybmFsRG9jc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leHRlcm5hbERvY3NcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVcIjoge31cbiAgICAgIH0sXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgfSxcbiAgICBcInByaW1pdGl2ZXNJdGVtc1wiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRp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VzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICB9XG4gICAgfSxcbiAgICBcInhtbFwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibmFtZXNwYWNlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcInByZWZpeFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhdHRyaWJ1dGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJ3cmFwcGVkXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJ0YWdcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwibmFtZVwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4dGVybmFsRG9jc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leHRlcm5hbERvY3NcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwic2VjdXJpdHlEZWZpbml0aW9uc1wiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2Jhc2ljQXV0aGVudGljYXRpb25TZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2FwaUtleVNlY3VyaXR5XCJcbiAgICAgICAgICB9LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgySW1wbGljaXRTZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlBhc3N3b3JkU2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJBcHBsaWNhdGlvblNlY3VyaXR5XCJcbiAgICAgICAgICB9LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyQWNjZXNzQ29kZVNlY3VyaXR5XCJcbiAgICAgICAgICB9XG4gICAgICAgIF1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwiYmFzaWNBdXRoZW50aWNhdGlvblNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiYmFzaWNcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcImFwaUtleVNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJuYW1lXCIsXG4gICAgICAgIFwiaW5cIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiYXBpS2V5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwibmFtZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiaGVhZGVyXCIsXG4gICAgICAgICAgICBcInF1ZXJ5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJJbXBsaWNpdFNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwiYXV0aG9yaXphdGlvblVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJvYXV0aDJcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmbG93XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJpbXBsaWNpdFwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcInNjb3Blc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcIm9hdXRoMlBhc3N3b3JkU2VjdXJpdHlcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwidHlwZVwiLFxuICAgICAgICBcImZsb3dcIixcbiAgICAgICAgXCJ0b2tlblVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJvYXV0aDJcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmbG93XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJwYXNzd29yZFwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcInNjb3Blc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJBcHBsaWNhdGlvblNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwidG9rZW5VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiYXBwbGljYXRpb25cIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0b2tlblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgyQWNjZXNzQ29kZVNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwiYXV0aG9yaXphdGlvblVybFwiLFxuICAgICAgICBcInRva2VuVXJsXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcIm9hdXRoMlwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZsb3dcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFjY2Vzc0NvZGVcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidG9rZW5VcmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFw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ICAgICBdXG4gICAgICB9LFxuICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgfSxcbiAgICBcInNjaGVtZXNMaXN0XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIHRyYW5zZmVyIHByb3RvY29sIG9mIHRoZSBBUEkuXCIsXG4gICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgXCJodHRwXCIsXG4gICAgICAgICAgXCJodHRwc1wiLFxuICAgICAgICAgIFwid3NcIixcbiAgICAgICAgICBcIndzc1wiXG4gICAgICAgIF1cbiAgICAgIH0sXG4gICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICB9LFxuICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgIFwiY3N2XCIsXG4gICAgICAgIFwic3N2XCIsXG4gICAgICAgIFwidHN2XCIsXG4gICAgICAgIFwicGlwZXNcIlxuICAgICAgXSxcbiAgICAgIFwiZGVmYXVsdFwiOiBcImNzdlwiXG4gICAgfSxcbiAgICBcImNvbGxlY3Rpb25Gb3JtYXRXaXRoTXVsdGlcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICBcImVudW1cIjogW1xuICAgICAgICBcImNzdlwiLFxuICAgICAgICBcInNzdlwiLFxuICAgICAgICBcInRzdlwiLFxuICAgICAgICBcInBpcGVzXCIsXG4gICAgICAgIFwibXVsdGlcIlxuICAgICAgXSxcbiAgICAgIFwiZGVmYXVsdFwiOiBcImNzdlwiXG4gICAgfSxcbiAgICBcInRpdGxlXCI6IHtcbiAgICAgIFwiJHJlZlwiOiBcImh0dHA6Ly9qc29uL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ZWdlckRlZmF1bHQwXCI6IHtcbiAgICAgICAgICAgIFwiYWxsT2ZcIjogWyB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyXCIgfSwgeyBcImRlZmF1bHRcIjogMCB9IF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzaW1wbGVUeXBlc1wiOiB7XG4gICAgICAgICAgICBcImVudW1cIjogWyBcImFycmF5XCIsIFwiYm9vbGVhblwiLCBcImludGVnZXJcIiwgXCJudWxsXCIsIFwibnVtYmVyXCIsIFwib2JqZWN0XCIsIFwic3RyaW5nXCIgXVxuICAgICAgICB9LFxuICAgICAgICBcInN0cmluZ0FycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICB9XG4gICAgfSxcbiAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcImlkXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcIiRzY2hlbWFcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwidGl0bGVcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge30sXG4gICAgICAgIFwibXVsdGlwbGVPZlwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwibWluaW11bVwiOiAwLFxuICAgICAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm51bWJlclwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm51bWJlclwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhMZW5ndGhcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlclwiIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MFwiIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwicmVnZXhcIlxuICAgICAgICB9LFxuICAgICAgICBcImFkZGl0aW9uYWxJdGVtc1wiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgIC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iYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcInR5cGVcIjogXCJib29sZWFuXCIgfSxcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9XG4gICAgICAgICAgICBdLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5XCIgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBlc1wiIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBlc1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImFsbE9mXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH0sXG4gICAgICAgIFwiYW55T2ZcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCIgfSxcbiAgICAgICAgXCJvbmVPZlwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9LFxuICAgICAgICBcIm5vdFwiOiB7IFwiJHJlZlwiOiBcIiNcIiB9XG4gICAgfSxcbiAgICBcImRlcGVuZGVuY2llc1wiOiB7XG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiBbIFwibWF4aW11bVwiIF0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiBbIFwibWluaW11bVwiIF1cbiAgICB9LFxuICAgIFwiZGVmYXVsdFwiOiB7fVxufVxuIl19 diff --git a/browser/swagger-tools.js b/browser/swagger-tools.js index 7365fed078..04eea7335c 100755 --- a/browser/swagger-tools.js +++ b/browser/swagger-tools.js @@ -542,9 +542,13 @@ var removeCirculars = function (obj) { if (ancestors.indexOf(node) === -1) { ancestors.push(node); - if (_.isArray(node) || _.isPlainObject(node)) { - _.each(node, function (member, indexOrKey) { - walkItem(member, indexOrKey.toString()); + if (_.isArray(node)) { + _.each(node, function (member, index) { + walkItem(member, index.toString()); + }); + } else if (_.isPlainObject(node)) { + _.forOwn(node, function (member, key) { + walkItem(member, key.toString()); }); } } else { @@ -4793,4 +4797,4 @@ module.exports={ },{}]},{},[2])(2) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvaGVscGVycy5qcyIsImxpYi9zcGVjcy5qcyIsImxpYi92YWxpZGF0b3JzLmpzIiwic2NoZW1hcy8xLjIvYXBpRGVjbGFyYXRpb24uanNvbiIsInNjaGVtYXMvMS4yL2F1dGhvcml6YXRpb25PYmplY3QuanNvbiIsInNjaGVtYXMvMS4yL2RhdGFUeXBlLmpzb24iLCJzY2hlbWFzLzEuMi9kYXRhVHlwZUJhc2UuanNvbiIsInNjaGVtYXMvMS4yL2luZm9PYmplY3QuanNvbiIsInNjaGVtYXMvMS4yL21vZGVsc09iamVjdC5qc29uIiwic2NoZW1hcy8xLjIvb2F1dGgyR3JhbnRUeXBlLmpzb24iLCJzY2hlbWFzLzEuMi9vc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uMicpIHtcbiAgICAgIGNyZWF0ZUVycm9yT3JXYXJuaW5nKCdNVUxUSVBMRV8nICsgY29kZSArICdfSU5IRVJJVEFOQ0UnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NoaWxkICcgKyBjb2RlLnRvTG93ZXJDYXNlKCkgKyAnIGlzIHN1YiB0eXBlIG9mIG11bHRpcGxlIG1vZGVsczogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBfLm1hcChtZXRhZGF0YS5wYXJlbnRzLCBmdW5jdGlvbiAocGFyZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXREaXNwbGF5SWQocGFyZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyAmJiAnKSwgZGVmUGF0aCwgcmVzdWx0cy5lcnJvcnMpO1xuICAgIH1cblxuICAgIGlmIChtZXRhZGF0YS5jeWNsaWNhbCkge1xuICAgICAgY3JlYXRlRXJyb3JPcldhcm5pbmcoJ0NZQ0xJQ0FMXycgKyBjb2RlICsgJ19JTkhFUklUQU5DRScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBtc2dQcmVmaXggKyAnIGhhcyBhIGNpcmN1bGFyIGluaGVyaXRhbmNlOiAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5tYXAobGluZWFnZSwgZnVuY3Rpb24gKGRlcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXREaXNwbGF5SWQoZGVwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignIC0+ICcpICsgJyAtPiAnICsgZ2V0RGlzcGxheUlkKGlkKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZQYXRoLmNvbmNhdChzd2FnZ2VyVmVyc2lvbiA9PT0gJzEuMicgPyAnc3ViVHlwZXMnIDogJ2FsbE9mJyksIHJlc3VsdHMuZXJyb3JzKTtcbiAgICB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ZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE9ubHkgdmFsaWRhdGUgdGhlIEFQSSBEZWNsYXJhdGlvbnMgaWYgdGhlIEFQSSBpcyAxLjIgYW5kIHRoZSBSZXNvdXJjZSBMaXN0aW5nIHdhcyB2YWxpZFxuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdHMgJiYgc3BlYy52ZXJzaW9uID09PSAnMS4yJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcnM6IFtdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FybmluZ3M6IFtdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpRGVjbGFyYXRpb25zOiBbXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3luYy5tYXAoYXBpRGVjbGFyYXRpb25zLCBmdW5jdGlvbiAoYXBpRGVjbGFyYXRpb24sIGNhbGxiYWNrMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGVBZ2FpbnN0U2NoZW1hKHNwZWMsICdhcGlEZWNsYXJhdGlvbi5qc29uJywgYXBpRGVjbGFyYXRpb24sIGNhbGxiYWNrMik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGVyciwgYWxsUmVzdWx0cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5lYWNoKGFsbFJlc3VsdHMsIGZ1bmN0a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IGNhc2UgJ251bWJlcic6XG4gICAgICAgIC8vIENvZXJjZSB0aGUgdmFsdWUgb25seSBmb3IgU3dhZ2dlciAxLjJcbiAgICAgICAgaWYgKHZlcnNpb24gPT09ICcxLjInICYmIF8uaXNTdHJpbmcodmFsKSkge1xuICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmVzdWx0ID0gXy5pc0Zpbml0ZSh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3N0cmluZyc6XG4gICAgICAgIGlmICghXy5pc1VuZGVmaW5lZChmb3JtYXQpKSB7XG4gICAgICAgICAgc3dpdGNoIChmb3JtYXQpIHtcbiAgICAgICAgICBjYXNlICdkYXRlJzpcbiAgICAgICAgICAgIHJlc3VsdCA9IGlzVmFsaWREYXRlKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICdkYXRlLXRpbWUnOlxuICAgICAgICAgICAgcmVzdWx0ID0gaXNWYWxpZERhdGVUaW1lKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICd2b2lkJzpcbiAgICAgICAgcmVzdWx0ID0gXy5pc1VuZGVmaW5lZCh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAoc2tpcEVycm9yKSB7XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0gZWxzZSBpZiAoIXJlc3VsdCkge1xuICAgICAgdGhyb3dFcnJvcldpdGhDb2RlKCdJTlZBTElEX1RZUEUnLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgIT09ICd2b2lkJyA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAnTm90IGEgdmFsaWQgJyArIChfLmlzVW5kZWZpbmVkKGZvcm1hdCkgPyAnJyA6IGZvcm1hdCArICcgJykgKy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FyYXRpb24uanNvbiNcIixcbiAgICBcIiRzY2hlbWFcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIixcbiAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICBcInJlcXVpcmVkXCI6IFsgXCJzd2FnZ2VyVmVyc2lvblwiLCBcImJhc2VQYXRoXCIsIFwiYXBpc1wiIF0sXG4gICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJzd2FnZ2VyVmVyc2lvblwiOiB7IFwiZW51bVwiOiBbIFwiMS4yXCIgXSB9LFxuICAgICAgICBcImFwaVZlcnNpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImJhc2VQYXRoXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIixcbiAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl5odHRwcz86Ly9cIlxuICAgICAgICB9LFxuICAgICAgICBcInJlc291cmNlUGF0aFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCIsXG4gICAgICAgICAgICBcInBhdHRlcm5cIjogXCJeL1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXBpc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpT2JqZWN0XCIgfVxuICAgICAgICB9LFxuICAgICAgICBcIm1vZGVsc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIm1vZGVsc09iamVjdC5qc29uI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICBcImNvbnN1bWVzXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW1lVHlwZUFycmF5XCIgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uc1wiOiB7IFwiJHJlZlwiOiBcImF1dGhvcml6YXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgfSxcbiAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcImFwaU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInBhdGhcIiwgXCJvcGVyYXRpb25zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJwYXRoXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpLXRlbXBsYXRlXCIsXG4gICAgICAgICAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl4vXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwib3BlcmF0aW9uc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJvcGVyYXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW1lVHlwZUFycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiBcIm1pbWUtdHlwZVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvYXV0aG9yaXphdGlvbk9iamVjdC5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2Jhc2ljQXV0aFwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpS2V5XCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJcIlxuICAgICAgICAgICAgfVxuICAgICAgICBdXG4gICAgfSxcbiAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgXCJiYXNpY0F1dGhcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYmFzaWNBdXRoXCIgXSB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcImFwaUtleVwiOiB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0eXBlXCIsIFwicGFzc0FzXCIsIFwia2V5bmFtZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYXBpS2V5XCIgXSB9LFxuICAgICAgICAgICAgICAgIFwicGFzc0FzXCI6IHsgXCJlbnVtXCI6IFsgXCJoZWFkZXJcIiwgXCJxdWVyeVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcImtleW5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm9hdXRoMlwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiwgXCJncmFudFR5cGVzXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJvYXV0aDJcIiBdIH0sXG4gICAgICAgICAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZVwiIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZ3JhbnRUeXBlc1wiOiB7IFwiJHJlZlwiOiBcIm9hdXRoMkdyYW50VHlwZS5qc29uI1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwib2F1dGgyU2NvcGVcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJzY29wZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwic2NvcGVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9XG4gICAgfVxufVxuXG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvZGF0YVR5cGUuanNvbiNcIixcbiAgICBcIiRzY2hlbWFcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIixcbiAgICBcImRlc2NyaXB0aW9uXCI6IFwiRGF0YSB0eXBlIGFzIGRlc2NyaWJlZCBieSB0aGUgc3BlY2lmaWNhdGlvbiAodm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gICAgICAgXCJub3RcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJib29sZWFuXCIsIFwiaW50ZWdlclwiLCBcIm51bWJlclwiLCBcInN0cmluZ1wiLCBcImFycmF5XCIgXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmltaXRpdmVUeXBlXCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcImJvb2xlYW5cIiwgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIsIFwic3RyaW5nXCIgXVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVmYXVsdFZhbHVlXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcInR5cGVcIjogWyBcImFycmF5XCIsIFwib2JqZWN0XCIsIFwibnVsbFwiIF0gfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgICAgICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiaW50MzJcIiwgXCJpbnQ2NFwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHsgXCJlbnVtXCI6IFsgXCJmbG9hdFwiLCBcImRvdWJsZVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZW51bVwiOiBbIFwiYnl0ZVwiLCBcImRhdGVcIiwgXCJkYXRlLXRpbWVcIiBdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcInN0cmluZ1wiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIgXSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiwgXCJudW1iZXJcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhcnJheVR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiLCBcIml0ZW1zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJhcnJheVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3JlZlR5cGVcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcImFsbE9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZVR5cGVcIlxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjoge30sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHt9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH1cbiAgICB9XG59IiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL2RhdGFUeXBlQmFzZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwiZGVzY3JpcHRpb25cIjogXCJEYXRhIHR5cGUgZmllbGRzIChzZWN0aW9uIDQuMy4zKVwiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwib25lT2ZcIjogW1xuICAgICAgICB7IFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdIH0sXG4gICAgICAgIHsgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0gfVxuICAgIF0sXG4gICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCIkcmVmXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJmb3JtYXRcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImRlZmF1bHRWYWx1ZVwiOiB7XG4gICAgICAgICAgICBcIm5vdFwiOiB7IFwidHlwZVwiOiBbIFwiYXJyYXlcIiwgXCJvYmplY3RcIiwgXCJudWxsXCIgXSB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWUsXG4gICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcImVudW1cIjogWyBcImludDMyXCIsIFwiaW50NjRcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiZmxvYXRcIiwgXCJkb3VibGVcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJieXRlXCIsIFwiZGF0ZVwiLCBcImRhdGUtdGltZVwiIF1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0sXG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJhbGxPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7fSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge31cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9pbmZvT2JqZWN0Lmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJkZXNjcmlwdGlvblwiOiBcImluZm8gb2JqZWN0IChzZWN0aW9uIDUuMS4zKVwiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwicmVxdWlyZWRcIjogWyBcInRpdGxlXCIsIFwiZGVzY3JpcHRpb25cIiBdLFxuICAgIFwicHJ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OiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJvcGVydHlPYmplY3RcIiB9XG4gICAgICAgIH0sXG4gICAgICAgIFwic3ViVHlwZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGlzY3JpbWluYXRvclwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJzdWJUeXBlc1wiOiBbIFwiZGlzY3JpbWluYXRvclwiIF1cbiAgICB9LFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInByb3BlcnR5T2JqZWN0XCI6IHtcbiAgICAgICAgICAgIFwiYWxsT2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCJkYXRhVHlwZUJhc2UuanNvbiNcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuIiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL29hdXRoMkdyYW50VHlwZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZ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yZWZcIjogXCIjL2RlZmluaXRpb25zL3Rva2VuRW5kcG9pbnRcIiB9LFxuICAgICAgICAgICAgICAgIFwidG9rZW5SZXF1ZXN0RW5kcG9pbnRcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Rva2VuUmVxdWVzdEVuZHBvaW50XCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJsb2dpbkVuZHBvaW50XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidXJsXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ1cmxcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiwgXCJmb3JtYXRcIjogXCJ1cmlcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuRW5kcG9pbnRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ1cmxcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInVybFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcInVyaVwiIH0sXG4gICAgICAgICAgICAgICAgXCJ0b2tlbk5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuUmVxdWVzdEVu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IiwgXCJQQVRDSFwiLCBcIkRFTEVURVwiLCBcIk9QVElPTlNcIiBdIH0sXG4gICAgICAgICAgICAgICAgXCJzdW1tYXJ5XCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIsIFwibWF4TGVuZ3RoXCI6IDEyMCB9LFxuICAgICAgICAgICAgICAgIFwibm90ZXNcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwibmlja25hbWVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJwYXR0ZXJuXCI6IFwiXlthLXpBLVowLTlfXSskXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiYXV0aG9yaXphdGlvbnNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiYXV0aG9yaXphdGlvbk9iamVjdC5qc29uIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicGFyYW1ldGVyc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJwYXJhbWV0ZXJPYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInJlc3BvbnNlTWVzc2FnZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZXNwb25zZU1lc3NhZ2VPYmplY3RcIn1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiY29uc3VtZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVwcmVjYXRlZFwiOiB7IFwiZW51bVwiOiBbIFwidHJ1ZVwiLCBcImZhbHNlXCIgXSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICBdLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInJlc3BvbnNlTWVzc2FnZU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcImNvZGVcIiwgXCJtZXNzYWdlXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJjb2RlXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZmMyNjE2c2VjdGlvbjEwXCIgfSxcbiAgICAgICAgICAgICAgICBcIm1lc3NhZ2VcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwicmVzcG9uc2VNb2RlbFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJyZmMyNjE2c2VjdGlvbjEwXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwibWluaW11bVwiOiAxMDAsXG4gICAgICAgICAgICBcIm1heGltdW1cIjogNjAwLFxuICAgICAgICAgICAgXCJleGNsdXNpdmVNYXhpbXVtXCI6IHRydWVcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW1lVHlwZUFycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiBcIm1pbWUtdHlwZVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvcGFyYW1ldGVyT2JqZWN0Lmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgXCJhbGxPZlwiOiBbXG4gICAgICAgIHsgXCIkcmVmXCI6IFwiZGF0YVR5cGVCYXNlLmpzb24jXCIgfSxcbiAgICAgICAge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwicGFyYW1UeXBlXCIsIFwibmFtZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwicGFyYW1UeXBlXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJwYXRoXCIsIFwicXVlcnlcIiwgXCJib2R5XCIsIFwiaGVhZGVyXCIsIFwiZm9ybVwiIF1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibmFtZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiB7IFwidHlwZVwiOiBcImJvb2xlYW5cIiB9LFxuICAgICAgICAgICAgICAgIFwiYWxsb3dNdWx0aXBsZVwiOiB7IFwidHlwZVwiOiBcImJvb2xlYW5cIiB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJ0eXBlIEZpbGUgcmVxdWlyZXMgc3BlY2lhbCBwYXJhbVR5cGUgYW5kIGNvbnN1bWVzXCIsXG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcIm5vdFwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFwicGFyYW1UeXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJmb3JtXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJjb25zdW1lc1wiOiB7IFwiZW51bVwiOiBbIFwibXVsdGlwYXJ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CIkcmVmXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcImdldFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInB1dFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInBvc3RcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb3BlcmF0aW9uXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWxldGVcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb3BlcmF0aW9uXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29wZXJhdGlvblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaGVhZFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdGNoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29wZXJhdGlvblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGFyYW1ldGVyc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXJhbWV0ZXJzTGlzdFwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwicmVzcG9uc2VzXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIlJlc3BvbnNlIG9iamVjdHMgbmFtZXMgY2FuIGVpd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XCI6IFwib2JqZWN0XCIsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJzY2hlbWFcIjoge1xuICAgICAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2ZpbGVTY2hlbWFcIlxuICAgICAgICAgICAgfVxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJoZWFkZXJzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2hlYWRlcnNcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4YW1wbGVzXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJoZWFkZXJzXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaGVhZGVyXCJcbiAgICAgIH1cbiAgICB9LFxuICAgIFwiaGVhZGVyXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiYXJyYXlcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlc0l0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJjb2xsZWN0aW9uRm9ybWF0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2NvbGxlY3Rpb25Gb3JtYXRcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZGVmYXVsdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYX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E1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHR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VyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcImFsbG93RW1wdHlWYWx1ZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZSxcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiYWxsb3dzIHNlbmRpbmcgYSBwYXJhbWV0ZXIgYnkgbmFtZSBvbmx5IG9yIHdpdGggYW4gZW1wdHkgdmFsdWUuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICA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WJlclwiLFxuICAgICAgICAgICAgXCJib29sZWFuXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiZmlsZVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFdpdGhNdWx0aVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAg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9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwicmVxdWlyZWRcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwicmVxdWlyZWRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgIF0sXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgd2hldGhlciBvciBub3QgdGhpcyBwYXJhbWV0ZXIgaXMgcmVxdWlyZWQgb3Igb3B0aW9uYWwuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgdGhlIGxvY2F0aW9uIG9mIHRoZSBwYXJhbWV0ZXIuXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGF0aFwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBicmllZiBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbXVsdGlwbGVPZlwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwibm9uQm9keVBhcmFtZXR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AgICB9LFxuICAgICAgICBcImVudW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIy9wcm9wZXJ0aWVzL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMvcHJvcGVydGllcy90eXBlXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGlzY3JpbWluYXRvclwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJyZWFkT25seVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInhtbFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy94bWxcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4dGVybmFsRG9jc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leHRlcm5hbERvY3NcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVcIjoge31cbiAgICAgIH0sXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgfSxcbiAgICBcImZpbGVTY2hlbWFcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZW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cbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJmaWxlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwicmVhZE9ubHlcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGFtcGxlXCI6IHt9XG4gICAgICB9LFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgIH0sXG4gICAgXCJwcmltaXRpdmVzSXRlbXNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXC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bmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJ4bWxcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVzcGFjZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmVmaXhcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXR0cmlidXRlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwid3JhcHBlZFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwidGFnXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwibmFtZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInNlY3VyaXR5RGVmaW5pdGlvbnNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9iYXNpY0F1dGhlbnRpY2F0aW9uU2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9hcGlLZXlTZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkltcGxpY2l0U2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJQYXNzd29yZFNlY3VyaXR5XCJcbiAgICAgICAgICB9LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiXG4gICAgICAgICAgfVxuICAgICAgICBdXG4gICAgICB9XG4gICAgfSxcbiAgICBcImJhc2ljQXV0aGVudGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImJhc2ljXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJhcGlLZXlTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwibmFtZVwiLFxuICAgICAgICBcImluXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwaUtleVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaW5cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImhlYWRlclwiLFxuICAgICAgICAgICAgXCJxdWVyeVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgySW1wbGljaXRTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiaW1wbGljaXRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJQYXNzd29yZFNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwidG9rZW5VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGFzc3dvcmRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0b2tlblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcInRva2VuVXJsXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcIm9hdXRoMlwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZsb3dcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwcGxpY2F0aW9uXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwidG9rZW5VcmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcIm9hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIixcbiAgICAgICAgXCJ0b2tlblVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJvYXV0aDJcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmbG93XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJhY2Nlc3NDb2RlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXV0aG9yaXphdGlvblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ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AgICAgICAgXVxuICAgICAgfSxcbiAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgIH0sXG4gICAgXCJzY2hlbWVzTGlzdFwiOiB7XG4gICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIlRoZSB0cmFuc2ZlciBwcm90b2NvbCBvZiB0aGUgQVBJLlwiLFxuICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgIFwiaHR0cFwiLFxuICAgICAgICAgIFwiaHR0cHNcIixcbiAgICAgICAgICBcIndzXCIsXG4gICAgICAgICAgXCJ3c3NcIlxuICAgICAgICBdXG4gICAgICB9LFxuICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgfSxcbiAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICBcImVudW1cIjogW1xuICAgICAgICBcImNzdlwiLFxuICAgICAgICBcInNzdlwiLFxuICAgICAgICBcInRzdlwiLFxuICAgICAgICBcInBpcGVzXCJcbiAgICAgIF0sXG4gICAgICBcImRlZmF1bHRcIjogXCJjc3ZcIlxuICAgIH0sXG4gICAgXCJjb2xsZWN0aW9uRm9ybWF0V2l0aE11bHRpXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgXCJjc3ZcIixcbiAgICAgICAgXCJzc3ZcIixcbiAgICAgICAgXCJ0c3ZcIixcbiAgICAgICAgXCJwaXBlc1wiLFxuICAgICAgICBcIm11bHRpXCJcbiAgICAgIF0sXG4gICAgICBcImRlZmF1bHRcIjogXCJjc3ZcIlxuICAgIH0sXG4gICAgXCJ0aXRsZVwiOiB7XG4gICAgICBcIiRyZWZcIjogXCJodHRwOi8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gXCJkZWZhdWx0XCI6IHt9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcIm1pbmltdW1cIjogMCxcbiAgICAgICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJcIiB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDBcIiB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInJlZ2V4XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhZGRpdGlvbmFsSXRlbXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAg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W9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwiYW55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH0sXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgXSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zdHJpbmdBcnJheVwiIH1cbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9LFxuICAgICAgICBcImFueU9mXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH0sXG4gICAgICAgIFwib25lT2ZcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCIgfSxcbiAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfV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VUxUSVBMRV8nICsgY29kZSArICdfSU5IRVJJVEFOQ0UnLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NoaWxkICcgKyBjb2RlLnRvTG93ZXJDYXNlKCkgKyAnIGlzIHN1YiB0eXBlIG9mIG11bHRpcGxlIG1vZGVsczogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBfLm1hcChtZXRhZGF0YS5wYXJlbnRzLCBmdW5jdGlvbiAocGFyZW50KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXREaXNwbGF5SWQocGFyZW50KTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyAmJiAnKSwgZGVmUGF0aCwgcmVzdWx0cy5lcnJvcnMpO1xuICAgIH1cblxuICAgIGlmIChtZXRhZGF0YS5jeWNsaWNhbCkge1xuICAgICAgY3JlYXRlRXJyb3JPcldhcm5pbmcoJ0NZQ0xJQ0FMXycgKyBjb2RlICsgJ19JTkhFUklUQU5DRScsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICBtc2dQcmVmaXggKyAnIGhhcyBhIGNpcmN1bGFyIGluaGVyaXRhbmNlOiAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5tYXAobGluZWFnZSwgZnVuY3Rpb24gKGRlcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXREaXNwbGF5SWQoZGVwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignIC0+ICcpICsgJyAtPiAnICsgZ2V0RGlzcGxheUlkKGlkKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZQYXRoLmNvbmNhdChzd2FnZ2VyVmVyc2lvbiA9PT0gJzEuMicgPyAnc3ViVHlwZXMnIDogJ2FsbE9mJyksIHJlc3VsdHMuZXJyb3JzKTtcbiAgICB9XG5cbiAgICAvLyBSZW1vdmUgc2VsZiByZWZlcmVuY2UgZnJv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XRoLCByZXN1bHRzKTtcblxuICAgICAgICBpZiAoaVByb3BlcnRpZXMuaW5kZXhPZihuYW1lKSA+IC0xKSB7XG4gICAgICAgICAgY3JlYXRlRXJyb3JPcldhcm5pbmcoJ0NISUxEXycgKyBjb2RlICsgJ19SRURFQ0xBUkVTX1BST1BFUlRZJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hpbGQgJyArIGNvZGUudG9Mb3dlckNhc2UoKSArICcgZGVjbGFyZXMgcHJvcGVydHkgYWxyZWFkeSBkZWNsYXJlZCBieSBhbmNlc3RvcjogJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwUGF0aCwgcmVzdWx0cy5lcnJvcnMpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGRQcm9wZXJ0aWVzLnB1c2gobmFtZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9KTtcblxuICAgIC8vIElkZW50aWZ5IG1pc3NpbmcgcmVxdWlyZWQgcHJvcGVydGllc1xuICAgIF8uZWFjaChkZWZpbml0aW9uLnJlcXVpcmVkIHx8IFtdLCBmdW5jdGlvbiAobmFtZSwgaW5kZXgpIHtcbiAgICAgIHZhciB0eXBlID0gc3dhZ2dlclZlcnNpb24gPT09ICcxLjInID8gJ01vZGVsJyA6ICdEZWZpbml0aW9uJztcblxuICAgICAgaWYgKGlQcm9wZXJ0aWVzLmluZGV4T2YobmFtZSkgPT09IC0xICYmIGRQcm9wZXJ0aWVzLmluZGV4T2YobmFtZSkgPT09IC0xKSB7XG4gICAgICAgIGNyZWF0ZUVycm9yT3JXYXJuaW5nKCdNSVNTSU5HX1JFUVVJUkVEXycgKyB0eXBlLnRvVXBwZXJDYXNlKCkgKyAnX1BST1BFUlRZJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSArICcgcmVxdWlyZXMgcHJvcGVydHkgYnV0IGl0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ICAgICAgICAgICAgICAgICAgICAgIC8vIE9ubHkgdmFsaWRhdGUgdGhlIEFQSSBEZWNsYXJhdGlvbnMgaWYgdGhlIEFQSSBpcyAxLjIgYW5kIHRoZSBSZXNvdXJjZSBMaXN0aW5nIHdhcyB2YWxpZFxuICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXJlc3VsdHMgJiYgc3BlYy52ZXJzaW9uID09PSAnMS4yJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdHMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcnM6IFtdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FybmluZ3M6IFtdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpRGVjbGFyYXRpb25zOiBbXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3luYy5tYXAoYXBpRGVjbGFyYXRpb25zLCBmdW5jdGlvbiAoYXBpRGVjbGFyYXRpb24sIGNhbGxiYWNrMikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGVBZ2FpbnN0U2NoZW1hKHNwZWMsICdhcGlEZWNsYXJhdGlvbi5qc29uJywgYXBpRGVjbGFyYXRpb24sIGNhbGxiYWNrMik7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGVyciwgYWxsUmVzdWx0cykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5lYWNoKGFsbFJlc3VsdHMsIGZ1bmN0aW9uIChyZXN1bHQsIGluZGV4KSB7XG4gICAgICAgICAgICAgICAgICAg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dmFsdWUgb25seSBmb3IgU3dhZ2dlciAxLjJcbiAgICAgICAgaWYgKHZlcnNpb24gPT09ICcxLjInICYmIF8uaXNTdHJpbmcodmFsKSkge1xuICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmVzdWx0ID0gXy5pc0Zpbml0ZSh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ3N0cmluZyc6XG4gICAgICAgIGlmICghXy5pc1VuZGVmaW5lZChmb3JtYXQpKSB7XG4gICAgICAgICAgc3dpdGNoIChmb3JtYXQpIHtcbiAgICAgICAgICBjYXNlICdkYXRlJzpcbiAgICAgICAgICAgIHJlc3VsdCA9IGlzVmFsaWREYXRlKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICdkYXRlLXRpbWUnOlxuICAgICAgICAgICAgcmVzdWx0ID0gaXNWYWxpZERhdGVUaW1lKHZhbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICd2b2lkJzpcbiAgICAgICAgcmVzdWx0ID0gXy5pc1VuZGVmaW5lZCh2YWwpO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAoc2tpcEVycm9yKSB7XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH0gZWxzZSBpZiAoIXJlc3VsdCkge1xuICAgICAgdGhyb3dFcnJvcldpdGhDb2RlKCdJTlZBTElEX1RZUEUnLFxuICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgIT09ICd2b2lkJyA/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAnTm90IGEgdmFsaWQgJyArIChfLmlzVW5kZWZpbmVkKGZvcm1hdCkgPyAnJyA6IGZvcm1hdCArICcgJykgKyB0eXBlICsgJzogJyArIG9WYWwgOlxuICAgICAgICAgICAgICAgICAgICA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wOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSNcIixcbiAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICBcInJlcXVpcmVkXCI6IFsgXCJzd2FnZ2VyVmVyc2lvblwiLCBcImJhc2VQYXRoXCIsIFwiYXBpc1wiIF0sXG4gICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJzd2FnZ2VyVmVyc2lvblwiOiB7IFwiZW51bVwiOiBbIFwiMS4yXCIgXSB9LFxuICAgICAgICBcImFwaVZlcnNpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImJhc2VQYXRoXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIixcbiAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl5odHRwcz86Ly9cIlxuICAgICAgICB9LFxuICAgICAgICBcInJlc291cmNlUGF0aFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCIsXG4gICAgICAgICAgICBcInBhdHRlcm5cIjogXCJeL1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXBpc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpT2JqZWN0XCIgfVxuICAgICAgICB9LFxuICAgICAgICBcIm1vZGVsc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIm1vZGVsc09iamVjdC5qc29uI1wiXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICBcImNvbnN1bWVzXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW1lVHlwZUFycmF5XCIgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uc1wiOiB7IFwiJHJlZlwiOiBcImF1dGhvcml6YXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgfSxcbiAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcImFwaU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInBhdGhcIiwgXCJvcGVyYXRpb25zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJwYXRoXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpLXRlbXBsYXRlXCIsXG4gICAgICAgICAgICAgICAgICAgIFwicGF0dGVyblwiOiBcIl4vXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwib3BlcmF0aW9uc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJvcGVyYXRpb25PYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW1lVHlwZUFycmF5XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiBcIm1pbWUtdHlwZVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH1cbiAgICB9XG59XG4iLCJtb2R1bGUuZXhwb3J0cz17XG4gICAgXCJpZFwiOiBcImh0dHA6Ly93b3JkbmlrLmdpdGh1Yi5pby9zY2hlbWFzL3YxLjIvYXV0aG9yaXphdGlvbk9iamVjdC5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2Jhc2ljQXV0aFwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvYXBpS2V5XCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJcIlxuICAgICAgICAgICAgfVxuICAgICAgICBdXG4gICAgfSxcbiAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgXCJiYXNpY0F1dGhcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYmFzaWNBdXRoXCIgXSB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcImFwaUtleVwiOiB7XG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ0eXBlXCIsIFwicGFzc0FzXCIsIFwia2V5bmFtZVwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiYXBpS2V5XCIgXSB9LFxuICAgICAgICAgICAgICAgIFwicGFzc0FzXCI6IHsgXCJlbnVtXCI6IFsgXCJoZWFkZXJcIiwgXCJxdWVyeVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcImtleW5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcIm9hdXRoMlwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiwgXCJncmFudFR5cGVzXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJvYXV0aDJcIiBdIH0sXG4gICAgICAgICAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJ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N0XCIsXG4gICAgXCJvbmVPZlwiOiBbXG4gICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZWZUeXBlXCIgfSxcbiAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZvaWRUeXBlXCIgfSxcbiAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZVR5cGVcIiB9LFxuICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbW9kZWxUeXBlXCIgfSxcbiAgICAgICAgeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2FycmF5VHlwZVwiIH1cbiAgICBdLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInJlZlR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0sXG4gICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiJHJlZlwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwidm9pZFR5cGVcIjoge1xuICAgICAgICAgICAgXCJlbnVtXCI6IFsgeyBcInR5cGVcIjogXCJ2b2lkXCIgfSBdXG4gICAgICAgIH0sXG4gICAgICAgIFwibW9kZWxUeXBlXCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJib29sZWFuXCIsIFwiaW50ZWdlclwiLCBcIm51bWJlclwiLCBcInN0cmluZ1wiLCBcImFycmF5XCIgXVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmltaXRpdmVUeXBlXCI6IHtcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcImVudW1cIjogWyBcImJvb2xlYW5cIiwgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIsIFwic3RyaW5nXCIgXVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVmYXVsdFZhbHVlXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcInR5cGVcIjogWyBcImFycmF5XCIsIFwib2JqZWN0XCIsIFwibnVsbFwiIF0gfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgICAgICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiaW50MzJcIiwgXCJpbnQ2NFwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHsgXCJlbnVtXCI6IFsgXCJmbG9hdFwiLCBcImRvdWJsZVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZW51bVwiOiBbIFwiYnl0ZVwiLCBcImRhdGVcIiwgXCJkYXRlLXRpbWVcIiBdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcInN0cmluZ1wiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcIm1pbmltdW1cIjoge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIsIFwibnVtYmVyXCIgXSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcImVudW1cIjogWyBcImludGVnZXJcIiwgXCJudW1iZXJcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhcnJheVR5cGVcIjoge1xuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidHlwZVwiLCBcIml0ZW1zXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJhcnJheVwiIF0gfSxcbiAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3JlZlR5cGVcIlxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcImFsbE9mXCI6IFtcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZVR5cGVcIlxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjoge30sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiZm9ybWF0XCI6IHt9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICBdXG4gICAgICAgIH1cbiAgICB9XG59IiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL2RhdGFUeXBlQmFzZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwiZGVzY3JpcHRpb25cIjogXCJEYXRhIHR5cGUgZmllbGRzIChzZWN0aW9uIDQuMy4zKVwiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwib25lT2ZcIjogW1xuICAgICAgICB7IFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdIH0sXG4gICAgICAgIHsgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0gfVxuICAgIF0sXG4gICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCIkcmVmXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJmb3JtYXRcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICBcImRlZmF1bHRWYWx1ZVwiOiB7XG4gICAgICAgICAgICBcIm5vdFwiOiB7IFwidHlwZVwiOiBbIFwiYXJyYXlcIiwgXCJvYmplY3RcIiwgXCJudWxsXCIgXSB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHRydWUsXG4gICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDFcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaXRlbXNPYmplY3RcIiB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJpbnRlZ2VyXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjogeyBcImVudW1cIjogWyBcImludDMyXCIsIFwiaW50NjRcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJudW1iZXJcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7IFwiZW51bVwiOiBbIFwiZmxvYXRcIiwgXCJkb3VibGVcIiBdIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJzdHJpbmdcIiBdIH0sXG4gICAgICAgICAgICAgICAgICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJlbnVtXCI6IFsgXCJieXRlXCIsIFwiZGF0ZVwiLCBcImRhdGUtdGltZVwiIF1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH0sXG4gICAgXCJkZWZpbml0aW9uc1wiOiB7XG4gICAgICAgIFwiaXRlbXNPYmplY3RcIjoge1xuICAgICAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwiJHJlZlwiIF0sXG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJhbGxPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcInR5cGVcIiBdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7fSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmb3JtYXRcIjoge31cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cbiIsIm1vZHVsZS5leHBvcnRzPXtcbiAgICBcImlkXCI6IFwiaHR0cDovL3dvcmRuaWsuZ2l0aHViLmlvL3NjaGVtYXMvdjEuMi9pbmZvT2JqZWN0Lmpzb24jXCIsXG4gICAgXCIkc2NoZW1hXCI6IFwiaHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWEjXCIsXG4gICAgXCJkZXNjcmlwdGlvblwiOiBcImluZm8gb2JqZWN0IChzZWN0aW9uIDUuMS4zKVwiLFxuICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgIFwicmVxdWlyZWRcIjogWyBcInRpdGxlXCIsIFwiZGVzY3JpcHRpb25cIiBdLFxuICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidGl0bGVcIjogeyBcInR5c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UHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJvcGVydHlPYmplY3RcIiB9XG4gICAgICAgIH0sXG4gICAgICAgIFwic3ViVHlwZXNcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGlzY3JpbWluYXRvclwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICB9LFxuICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgXCJzdWJUeXBlc1wiOiBbIFwiZGlzY3JpbWluYXRvclwiIF1cbiAgICB9LFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInByb3BlcnR5T2JqZWN0XCI6IHtcbiAgICAgICAgICAgIFwiYWxsT2ZcIjogW1xuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgICAgICBcIiRyZWZcIjogXCJkYXRhVHlwZUJhc2UuanNvbiNcIlxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfVxuICAgIH1cbn1cblxuIiwibW9kdWxlLmV4cG9ydHM9e1xuICAgIFwiaWRcIjogXCJodHRwOi8vd29yZG5pay5naXRodWIuaW8vc2NoZW1hcy92MS4yL29hdXRoMkdyYW50VHlwZS5qc29uI1wiLFxuICAgIFwiJHNjaGVtYVwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hI1wiLFxuICAgIFwidHlwZVwiOiBcIm9iamV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iB9LFxuICAgICAgICAgICAgICAgIFwidG9rZW5SZXF1ZXN0RW5kcG9pbnRcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3Rva2VuUmVxdWVzdEVuZHBvaW50XCIgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJsb2dpbkVuZHBvaW50XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiBbIFwidXJsXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJ1cmxcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiwgXCJmb3JtYXRcIjogXCJ1cmlcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuRW5kcG9pbnRcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICAgICAgICBcInJlcXVpcmVkXCI6IFsgXCJ1cmxcIiBdLFxuICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICBcInVybFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiLCBcImZvcm1hdFwiOiBcInVyaVwiIH0sXG4gICAgICAgICAgICAgICAgXCJ0b2tlbk5hbWVcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuUmVxdWVzdEVuZHBvaW50XCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9i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iBdIH0sXG4gICAgICAgICAgICAgICAgXCJzdW1tYXJ5XCI6IHsgXCJ0eXBlXCI6IFwic3RyaW5nXCIsIFwibWF4TGVuZ3RoXCI6IDEyMCB9LFxuICAgICAgICAgICAgICAgIFwibm90ZXNcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwibmlja25hbWVcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICAgICAgICAgICAgXCJwYXR0ZXJuXCI6IFwiXlthLXpBLVowLTlfXSskXCJcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwiYXV0aG9yaXphdGlvbnNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiYXV0aG9yaXphdGlvbk9iamVjdC5qc29uIy9kZWZpbml0aW9ucy9vYXV0aDJTY29wZVwiXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicGFyYW1ldGVyc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgICAgICAgIFwiaXRlbXNcIjogeyBcIiRyZWZcIjogXCJwYXJhbWV0ZXJPYmplY3QuanNvbiNcIiB9XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBcInJlc3BvbnNlTWVzc2FnZXNcIjoge1xuICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgICAgICAgICBcIml0ZW1zXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZXNwb25zZU1lc3NhZ2VPYmplY3RcIn1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwicHJvZHVjZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiY29uc3VtZXNcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbWVUeXBlQXJyYXlcIiB9LFxuICAgICAgICAgICAgICAgIFwiZGVwcmVjYXRlZFwiOiB7IFwiZW51bVwiOiBbIFwidHJ1ZVwiLCBcImZhbHNlXCIgXSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICBdLFxuICAgIFwiZGVmaW5pdGlvbnNcIjoge1xuICAgICAgICBcInJlc3BvbnNlTWVzc2FnZU9iamVjdFwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwicmVxdWlyZWRcIjogWyBcImNvZGVcIiwgXCJtZXNzYWdlXCIgXSxcbiAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJjb2RlXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9yZmMyNjE2c2VjdGlvbjEwXCIgfSxcbiAgICAgICAgICAgICAgICBcIm1lc3NhZ2VcIjogeyBcInR5cGVcIjogXCJzdHJpbmdcIiB9LFxuICAgICAgICAgICAgICAgIFwicmVzcG9uc2VNb2RlbFwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgXCJyZmMyNjE2c2VjdGlvbjEwXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcImlud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gICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIFwibmFtZVwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7IFwidHlwZVwiOiBcInN0cmluZ1wiIH0sXG4gICAgICAgICAgICAgICAgXCJyZXF1aXJlZFwiOiB7IFwidHlwZVwiOiBcImJvb2xlYW5cIiB9LFxuICAgICAgICAgICAgICAgIFwiYWxsb3dNdWx0aXBsZVwiOiB7IFwidHlwZVwiOiBcImJvb2xlYW5cIiB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHtcbiAgICAgICAgICAgIFwiZGVzY3JpcHRpb25cIjogXCJ0eXBlIEZpbGUgcmVxdWlyZXMgc3BlY2lhbCBwYXJhbVR5cGUgYW5kIGNvbnN1bWVzXCIsXG4gICAgICAgICAgICBcIm9uZU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBcInR5cGVcIjogeyBcIm5vdFwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFwidHlwZVwiOiB7IFwiZW51bVwiOiBbIFwiRmlsZVwiIF0gfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIFwicGFyYW1UeXBlXCI6IHsgXCJlbnVtXCI6IFsgXCJmb3JtXCIgXSB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgXCJjb25zdW1lc1wiOiB7IFwiZW51bVwiOiBbIFwibXVsdGlwYXJ0L2Zvcm0tZGF0YVwiIF0gfVxuICAgICAgICAgICAgICAgICAgICB9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mdcIlxuICAgICAgICB9LFxuICAgICAgICBcImdldFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInB1dFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInBvc3RcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb3BlcmF0aW9uXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWxldGVcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb3BlcmF0aW9uXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJvcHRpb25zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29wZXJhdGlvblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaGVhZFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vcGVyYXRpb25cIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdGNoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29wZXJhdGlvblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGFyYW1ldGVyc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXJhbWV0ZXJzTGlzdFwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwicmVzcG9uc2VzXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIlJlc3BvbnNlIG9iamVjdHMgbmFtZXMgY2FuIGVpdGhlciBiZSBhbnkgdmFsaWQgSFRUUCBzdGF0dXMgY29kZSBvciA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cbiAgICAgICAgXCJkZXNjcmlwdGlvblwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJzY2hlbWFcIjoge1xuICAgICAgICAgIFwib25lT2ZcIjogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2ZpbGVTY2hlbWFcIlxuICAgICAgICAgICAgfVxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJoZWFkZXJzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2hlYWRlcnNcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4YW1wbGVzXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJoZWFkZXJzXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvaGVhZGVyXCJcbiAgICAgIH1cbiAgICB9LFxuICAgIFwiaGVhZGVyXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcIm51bWJlclwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiYXJyYXlcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmb3JtYXRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcHJpbWl0aXZlc0l0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJjb2xsZWN0aW9uRm9ybWF0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2NvbGxlY3Rpb25Gb3JtYXRcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlZmF1bHRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZGVmYXVsdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdm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gICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZ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XNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcImFsbG93RW1wdHlWYWx1ZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZSxcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiYWxsb3dzIHNlbmRpbmcgYSBwYXJhbWV0ZXIgYnkgbmFtZSBvbmx5IG9yIHdpdGggYW4gZW1wdHkgdmFsdWUuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImJvb2xlYW5cIixcbiAgICAgICAgICAgIFwiaW50ZWdlclwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFdpdGhNdWx0aVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhMZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5MZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGF0dGVyblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4SXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4SXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkl0ZW1zXCI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AgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYXJyYXlcIixcbiAgICAgICAgICAgIFwiZmlsZVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFdpdGhNdWx0aVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6I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B9XG4gICAgICB9LFxuICAgICAgXCJyZXF1aXJlZFwiOiBbXG4gICAgICAgIFwicmVxdWlyZWRcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwicmVxdWlyZWRcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgIF0sXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgd2hldGhlciBvciBub3QgdGhpcyBwYXJhbWV0ZXIgaXMgcmVxdWlyZWQgb3Igb3B0aW9uYWwuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJkZXNjcmlwdGlvblwiOiBcIkRldGVybWluZXMgdGhlIGxvY2F0aW9uIG9mIHRoZSBwYXJhbWV0ZXIuXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGF0aFwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBicmllZiBkZXNjcmlwdGlvbiBvZiB0aGUgcGFyYW1ldGVyLiBUaGlzIGNvdWxkIGNvbnRhaW4gZXhhbXBsZXMgb2YgdXNlLiAgR2l0SHViIEZsYXZvcmVkIE1hcmtkb3duIGlzIGFsbG93ZWQuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImRlc2NyaXB0aW9uXCI6IFwiVGhlIG5hbWUgb2YgdGhlIHBhcmFtZXRlci5cIlxuICAgICAgICB9LFxuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcInN0cmluZ1wiLFxuICAgICAgICAgICAgXCJudW1iZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJpbnRlZ2VyXCIsXG4gICAgICAgICAgICBcImFycmF5XCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZm9ybWF0XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIml0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ByaW1pdGl2ZXNJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiY29sbGVjdGlvbkZvcm1hdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9jb2xsZWN0aW9uRm9ybWF0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZWZhdWx0XCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2RlZmF1bHRcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZXhjbHVzaXZlTWF4aW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leGNsdXNpdmVNYXhpbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWluaW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heExlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluTGVuZ3RoXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21pbkxlbmd0aFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwicGF0dGVyblwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wYXR0ZXJuXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhJdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhJdGVtc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluSXRlbXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbWluSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcInVuaXF1ZUl0ZW1zXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3VuaXF1ZUl0ZW1zXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJlbnVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm11bHRpcGxlT2ZcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvbXVsdGlwbGVPZlwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwibm9uQm9keVBhcmFtZXRlclwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgIC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lZlwiOiBcImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIy9wcm9wZXJ0aWVzL2VudW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiXG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMvcHJvcGVydGllcy90eXBlXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIFwidHlwZVwiOiBcImFycmF5XCIsXG4gICAgICAgICAgICAgIFwibWluSXRlbXNcIjogMSxcbiAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgXSxcbiAgICAgICAgICBcImRlZmF1bHRcIjoge31cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYVwiXG4gICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjoge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGlzY3JpbWluYXRvclwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJyZWFkT25seVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9LFxuICAgICAgICBcInhtbFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy94bWxcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4dGVybmFsRG9jc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9leHRlcm5hbERvY3NcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4YW1wbGVcIjoge31cbiAgICAgIH0sXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlXG4gICAgfSxcbiAgICBcImZpbGVTY2hlbWFcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImRlc2NyaXB0aW9uXCI6IFwiQSBkZXRl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AgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJmaWxlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwicmVhZE9ubHlcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcImJvb2xlYW5cIixcbiAgICAgICAgICBcImRlZmF1bHRcIjogZmFsc2VcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGFtcGxlXCI6IHt9XG4gICAgICB9LFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZVxuICAgIH0sXG4gICAgXCJwcmltaXRpdmVzSXRlbXNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJzdHJpbmdcIixcbiAgICAgICAgICAgIFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcImludGVnZXJcIixcbiAgICAgICAgICAgIFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJhcnJheVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZvcm1hdFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJpdGVtc1wiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wcmltaXRpdmVzSXRlbXNcIlxuICAgICAgICB9LFxuICAgICAgICBcImNvbGxlY3Rpb25Gb3JtYXRcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvY29sbGVjdGlvbkZvcm1hdFwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVmYXVsdFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9kZWZhdWx0XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJtYXhpbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL21heGltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXhjbHVzaXZlTWF4aW11bVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5pbXVtXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleGNsdXNpdmVNaW5pbXVtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL2V4Y2x1c2l2ZU1pbmltdW1cIlxuICAgICAgICB9LFxuICAgICAgICBcIm1heExlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9tYXhMZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9taW5MZW5ndGhcIlxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcGF0dGVyblwiXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4SXRlbXNcI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ImFycmF5XCIsXG4gICAgICAgIFwiaXRlbXNcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJ4bWxcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IGZhbHNlLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJuYW1lXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVzcGFjZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJwcmVmaXhcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXR0cmlidXRlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJib29sZWFuXCIsXG4gICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwid3JhcHBlZFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgIFwiZGVmYXVsdFwiOiBmYWxzZVxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwidGFnXCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcIm5hbWVcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwibmFtZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJleHRlcm5hbERvY3NcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvZXh0ZXJuYWxEb2NzXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcInNlY3VyaXR5RGVmaW5pdGlvbnNcIjoge1xuICAgICAgXCJ0eXBlXCI6IFwib2JqZWN0XCIsXG4gICAgICBcImFkZGl0aW9uYWxQcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJvbmVPZlwiOiBbXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9iYXNpY0F1dGhlbnRpY2F0aW9uU2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9hcGlLZXlTZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkltcGxpY2l0U2VjdXJpdHlcIlxuICAgICAgICAgIH0sXG4gICAgICAgICAge1xuICAgICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9vYXV0aDJQYXNzd29yZFNlY3VyaXR5XCJcbiAgICAgICAgICB9LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiXG4gICAgICAgICAgfSxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiXG4gICAgICAgICAgfVxuICAgICAgICBdXG4gICAgICB9XG4gICAgfSxcbiAgICBcImJhc2ljQXV0aGVudGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImJhc2ljXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJhcGlLZXlTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwibmFtZVwiLFxuICAgICAgICBcImluXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwaUtleVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcIm5hbWVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiaW5cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImhlYWRlclwiLFxuICAgICAgICAgICAgXCJxdWVyeVwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgySW1wbGljaXRTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwiaW1wbGljaXRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhdXRob3JpemF0aW9uVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJeeC1cIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvdmVuZG9yRXh0ZW5zaW9uXCJcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG4gICAgXCJvYXV0aDJQYXNzd29yZFNlY3VyaXR5XCI6IHtcbiAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiBmYWxzZSxcbiAgICAgIFwicmVxdWlyZWRcIjogW1xuICAgICAgICBcInR5cGVcIixcbiAgICAgICAgXCJmbG93XCIsXG4gICAgICAgIFwidG9rZW5VcmxcIlxuICAgICAgXSxcbiAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwib2F1dGgyXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwiZmxvd1wiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJlbnVtXCI6IFtcbiAgICAgICAgICAgIFwicGFzc3dvcmRcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJzY29wZXNcIjoge1xuICAgICAgICAgIFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvb2F1dGgyU2NvcGVzXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJ0b2tlblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcImRlc2NyaXB0aW9uXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIlxuICAgICAgICB9XG4gICAgICB9LFxuICAgICAgXCJwYXR0ZXJuUHJvcGVydGllc1wiOiB7XG4gICAgICAgIFwiXngtXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3ZlbmRvckV4dGVuc2lvblwiXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIFwib2F1dGgyQXBwbGljYXRpb25TZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcInRva2VuVXJsXCJcbiAgICAgIF0sXG4gICAgICBcInByb3BlcnRpZXNcIjoge1xuICAgICAgICBcInR5cGVcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcIm9hdXRoMlwiXG4gICAgICAgICAgXVxuICAgICAgICB9LFxuICAgICAgICBcImZsb3dcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZW51bVwiOiBbXG4gICAgICAgICAgICBcImFwcGxpY2F0aW9uXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwidG9rZW5VcmxcIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiLFxuICAgICAgICAgIFwiZm9ybWF0XCI6IFwidXJpXCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJkZXNjcmlwdGlvblwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCJcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFwicGF0dGVyblByb3BlcnRpZXNcIjoge1xuICAgICAgICBcIl54LVwiOiB7XG4gICAgICAgICAgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy92ZW5kb3JFeHRlbnNpb25cIlxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcbiAgICBcIm9hdXRoMkFjY2Vzc0NvZGVTZWN1cml0eVwiOiB7XG4gICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogZmFsc2UsXG4gICAgICBcInJlcXVpcmVkXCI6IFtcbiAgICAgICAgXCJ0eXBlXCIsXG4gICAgICAgIFwiZmxvd1wiLFxuICAgICAgICBcImF1dGhvcml6YXRpb25VcmxcIixcbiAgICAgICAgXCJ0b2tlblVybFwiXG4gICAgICBdLFxuICAgICAgXCJwcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgXCJ0eXBlXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJvYXV0aDJcIlxuICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJmbG93XCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImVudW1cIjogW1xuICAgICAgICAgICAgXCJhY2Nlc3NDb2RlXCJcbiAgICAgICAgICBdXG4gICAgICAgIH0sXG4gICAgICAgIFwic2NvcGVzXCI6IHtcbiAgICAgICAgICBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL29hdXRoMlNjb3Blc1wiXG4gICAgICAgIH0sXG4gICAgICAgIFwiYXV0aG9yaXphdGlvblVybFwiOiB7XG4gICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgXCJmb3JtYXRcIjogXCJ1cmlcIlxuICAgICAgICB9LFxuICAgICAgICBcInRva2VuVXJsXCI6IHtcbiAgICAgICAgICBcInR5cGVcIjogXCJzdHJpbmdcIixcbiAgICAgICAgICBcImZvcm1hdFwiOiBcInVyaVwiXG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVzY3JpcHRpb25cIjoge1xuICAgICAgICAgIFwidHlwZVwiOiBcInN0cmluZ1wiXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgICBcInBhdHRlcm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ZcIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwibnVtYmVyXCIsXG4gICAgICAgICAgICBcIm1pbmltdW1cIjogMCxcbiAgICAgICAgICAgIFwiZXhjbHVzaXZlTWluaW11bVwiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4aW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWluaW11bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJudW1iZXJcIlxuICAgICAgICB9LFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYm9vbGVhblwiLFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IGZhbHNlXG4gICAgICAgIH0sXG4gICAgICAgIFwibWF4TGVuZ3RoXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJcIiB9LFxuICAgICAgICBcIm1pbkxlbmd0aFwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDBcIiB9LFxuICAgICAgICBcInBhdHRlcm5cIjoge1xuICAgICAgICAgICAgXCJ0eXBlXCI6IFwic3RyaW5nXCIsXG4gICAgICAgICAgICBcImZvcm1hdFwiOiBcInJlZ2V4XCJcbiAgICAgICAgfSxcbiAgICAgICAgXCJhZGRpdGlvbmFsSXRlbXNcIjoge1xuICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgeyBcInR5cGVcIjogXCJib29sZWFuXCIgfSxcbiA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55T2ZcIjogW1xuICAgICAgICAgICAgICAgIHsgXCJ0eXBlXCI6IFwiYm9vbGVhblwiIH0sXG4gICAgICAgICAgICAgICAgeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgICAgICAgICAgXSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcImRlZmluaXRpb25zXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwicHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJvYmplY3RcIixcbiAgICAgICAgICAgIFwiYWRkaXRpb25hbFByb3BlcnRpZXNcIjogeyBcIiRyZWZcIjogXCIjXCIgfSxcbiAgICAgICAgICAgIFwiZGVmYXVsdFwiOiB7fVxuICAgICAgICB9LFxuICAgICAgICBcInBhdHRlcm5Qcm9wZXJ0aWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7IFwiJHJlZlwiOiBcIiNcIiB9LFxuICAgICAgICAgICAgXCJkZWZhdWx0XCI6IHt9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZGVwZW5kZW5jaWVzXCI6IHtcbiAgICAgICAgICAgIFwidHlwZVwiOiBcIm9iamVjdFwiLFxuICAgICAgICAgICAgXCJhZGRpdGlvbmFsUHJvcGVydGllc1wiOiB7XG4gICAgICAgICAgICAgICAgXCJhbnlPZlwiOiBbXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiI1wiIH0sXG4gICAgICAgICAgICAgICAgICAgIHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zdHJpbmdBcnJheVwiIH1cbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIFwiZW51bVwiOiB7XG4gICAgICAgICAgICBcInR5cGVcIjogXCJhcnJheVwiLFxuICAgICAgICAgICAgXCJtaW5JdGVtc1wiOiAxLFxuICAgICAgICAgICAgXCJ1bmlxdWVJdGVtc1wiOiB0cnVlXG4gICAgICAgIH0sXG4gICAgICAgIFwidHlwZVwiOiB7XG4gICAgICAgICAgICBcImFueU9mXCI6IFtcbiAgICAgICAgICAgICAgICB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgXCJ0eXBlXCI6IFwiYXJyYXlcIixcbiAgICAgICAgICAgICAgICAgICAgXCJpdGVtc1wiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2ltcGxlVHlwZXNcIiB9LFxuICAgICAgICAgICAgICAgICAgICBcIm1pbkl0ZW1zXCI6IDEsXG4gICAgICAgICAgICAgICAgICAgIFwidW5pcXVlSXRlbXNcIjogdHJ1ZVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF1cbiAgICAgICAgfSxcbiAgICAgICAgXCJhbGxPZlwiOiB7IFwiJHJlZlwiOiBcIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJyYXlcIiB9LFxuICAgICAgICBcImFueU9mXCI6IHsgXCIkcmVmXCI6IFwiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheVwiIH0sXG4gICAgICAgIFwib25lT2ZcIjogeyBcIiRyZWZcIjogXCIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5XCIgfSxcbiAgICAgICAgXCJub3RcIjogeyBcIiRyZWZcIjogXCIjXCIgfVxuICAgIH0sXG4gICAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgICAgICBcImV4Y2x1c2l2ZU1heGltdW1cIjogWyBcIm1heGltdW1cIiBdLFxuICAgICAgICBcImV4Y2x1c2l2ZU1pbmltdW1cIjogWyBcIm1pbmltdW1cIiBdXG4gICAgfSxcbiAgICBcImRlZmF1bHRcIjoge31cbn1cbiJdfQ== diff --git a/lib/specs.js b/lib/specs.js index 54d6be6203..78997ac255 100644 --- a/lib/specs.js +++ b/lib/specs.js @@ -273,9 +273,13 @@ var removeCirculars = function (obj) { if (ancestors.indexOf(node) === -1) { ancestors.push(node); - if (_.isArray(node) || _.isPlainObject(node)) { - _.each(node, function (member, indexOrKey) { - walkItem(member, indexOrKey.toString()); + if (_.isArray(node)) { + _.each(node, function (member, index) { + walkItem(member, index.toString()); + }); + } else if (_.isPlainObject(node)) { + _.forOwn(node, function (member, key) { + walkItem(member, key.toString()); }); } } else { diff --git a/package.json b/package.json index 212c6f0c44..5b5f80af41 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "commander": "~2.11.0", "debug": "^3.1.0", "js-yaml": "^3.3.1", - "json-refs": "^3.0.1", + "json-refs": "^3.0.2", "lodash": "^4.17.4", "multer": "^1.1.0", "parseurl": "^1.3.0", diff --git a/test/2.0/test-specs.js b/test/2.0/test-specs.js index 29a92c1435..46b3b874c1 100644 --- a/test/2.0/test-specs.js +++ b/test/2.0/test-specs.js @@ -2785,6 +2785,26 @@ describe('Specification v2.0', function () { }); }); + it('should properly traverse objects with a length property', function (done) { + var swaggerObject = _.cloneDeep(petStoreJson); + var definitionWithLengthPropertyInExample = { + properties: { + length: {type: 'integer'}, + name: {type: 'string'} + }, + example: { + name: 'joe', + length: 20000000 + } + }; + + swaggerObject.definitions.Pet = definitionWithLengthPropertyInExample; + + spec.validate(swaggerObject, function () { + done(); + }); + }); + describe('human readable errors for invalid schema', function () { function validateResults (results, defType, done) { assert.equal(results.errors.length, 1);