forked from garycourt/JSV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsv-bundled.min.js
3 lines (3 loc) · 63.3 KB
/
jsv-bundled.min.js
1
2
3
var JSV=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].e;var module=installedModules[moduleId]={e:{},i:moduleId,l:false};modules[moduleId].call(module.e,module,module.e,__webpack_require__);module.l=true;return module.e}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=0)}([function(module,exports,__webpack_require__){var URI=__webpack_require__(2).URI,O={},I2H="0123456789abcdef".split(""),mapArray,filterArray,searchArray,JSV;function typeOf(o){return o===undefined?"undefined":o===null?"null":Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase()}function F(){}function createObject(proto){F.prototype=proto||{};return new F}function mapObject(obj,func,scope){var newObj={},key;for(key in obj){if(obj[key]!==O[key]){newObj[key]=func.call(scope,obj[key],key,obj)}}return newObj}mapArray=function(arr,func,scope){var x=0,xl=arr.length,newArr=new Array(xl);for(;x<xl;++x){newArr[x]=func.call(scope,arr[x],x,arr)}return newArr};if(Array.prototype.map){mapArray=function(arr,func,scope){return Array.prototype.map.call(arr,func,scope)}}filterArray=function(arr,func,scope){var x=0,xl=arr.length,newArr=[];for(;x<xl;++x){if(func.call(scope,arr[x],x,arr)){newArr[newArr.length]=arr[x]}}return newArr};if(Array.prototype.filter){filterArray=function(arr,func,scope){return Array.prototype.filter.call(arr,func,scope)}}searchArray=function(arr,o){var x=0,xl=arr.length;for(;x<xl;++x){if(arr[x]===o){return x}}return-1};if(Array.prototype.indexOf){searchArray=function(arr,o){return Array.prototype.indexOf.call(arr,o)}}function toArray(o){return o!==undefined&&o!==null?o instanceof Array&&!o.callee?o:typeof o.length!=="number"||o.split||o.setInterval||o.call?[o]:Array.prototype.slice.call(o):[]}function keys(o){var result=[],key;switch(typeOf(o)){case"object":for(key in o){if(o[key]!==O[key]){result[result.length]=key}}break;case"array":for(key=o.length-1;key>=0;--key){result[key]=key}break}return result}function pushUnique(arr,o){if(searchArray(arr,o)===-1){arr.push(o)}return arr}function popFirst(arr,o){var index=searchArray(arr,o);if(index>-1){arr.splice(index,1)}return arr}function randomUUID(){return[I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],"-",I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],"-4",I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],"-",I2H[Math.floor(Math.random()*16)&3|8],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],"-",I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)],I2H[Math.floor(Math.random()*16)]].join("")}function escapeURIComponent(str){return encodeURIComponent(str).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function formatURI(uri){if(typeof uri==="string"&&uri.indexOf("#")===-1){uri+="#"}return uri}function stripInstances(o){if(o instanceof JSONInstance){return o.getURI()}switch(typeOf(o)){case"undefined":case"null":case"boolean":case"number":case"string":return o;case"object":return mapObject(o,stripInstances);case"array":return mapArray(o,stripInstances);default:return o.toString()}}function InitializationError(instance,schema,attr,message,details){Error.call(this,message);this.uri=instance instanceof JSONInstance?instance.getURI():instance;this.schemaUri=schema instanceof JSONInstance?schema.getURI():schema;this.attribute=attr;this.message=message;this.description=message;this.details=details}InitializationError.prototype=new Error;InitializationError.prototype.constructor=InitializationError;InitializationError.prototype.name="InitializationError";function Report(){this.errors=[];this.validated={}}Report.prototype.addError=function(instance,schema,attr,message,details){this.errors.push({uri:instance instanceof JSONInstance?instance.getURI():instance,schemaUri:schema instanceof JSONInstance?schema.getURI():schema,attribute:attr,message:message,details:stripInstances(details)})};Report.prototype.registerValidation=function(uri,schemaUri){if(!this.validated[uri]){this.validated[uri]=[schemaUri]}else{this.validated[uri].push(schemaUri)}};Report.prototype.isValidatedBy=function(uri,schemaUri){return!!this.validated[uri]&&searchArray(this.validated[uri],schemaUri)!==-1};function JSONInstance(env,json,uri,fd){if(json instanceof JSONInstance){if(typeof fd!=="string"){fd=json._fd}if(typeof uri!=="string"){uri=json._uri}json=json._value}if(typeof uri!=="string"){uri="urn:uuid:"+randomUUID()+"#"}else if(uri.indexOf(":")===-1){uri=formatURI(URI.resolve("urn:uuid:"+randomUUID()+"#",uri))}this._env=env;this._value=json;this._uri=uri;this._fd=fd||this._env._options["defaultFragmentDelimiter"]}JSONInstance.prototype.getEnvironment=function(){return this._env};JSONInstance.prototype.getType=function(){return typeOf(this._value)};JSONInstance.prototype.getValue=function(){return this._value};JSONInstance.prototype.getURI=function(){return this._uri};JSONInstance.prototype.resolveURI=function(uri){return formatURI(URI.resolve(this._uri,uri))};JSONInstance.prototype.getPropertyNames=function(){return keys(this._value)};JSONInstance.prototype.getProperty=function(key){var value=this._value?this._value[key]:undefined;if(value instanceof JSONInstance){return value}return new JSONInstance(this._env,value,this._uri+this._fd+escapeURIComponent(key),this._fd)};JSONInstance.prototype.getProperties=function(){var type=typeOf(this._value),self=this;if(type==="object"){return mapObject(this._value,function(value,key){if(value instanceof JSONInstance){return value}return new JSONInstance(self._env,value,self._uri+self._fd+escapeURIComponent(key),self._fd)})}else if(type==="array"){return mapArray(this._value,function(value,key){if(value instanceof JSONInstance){return value}return new JSONInstance(self._env,value,self._uri+self._fd+escapeURIComponent(key),self._fd)})}};JSONInstance.prototype.getValueOfProperty=function(key){if(this._value){if(this._value[key]instanceof JSONInstance){return this._value[key]._value}return this._value[key]}};JSONInstance.prototype.equals=function(instance){if(instance instanceof JSONInstance){return this._value===instance._value}return this._value===instance};function clone(obj,deep){var newObj,x;if(obj instanceof JSONInstance){obj=obj.getValue()}switch(typeOf(obj)){case"object":if(deep){newObj={};for(x in obj){if(obj[x]!==O[x]){newObj[x]=clone(obj[x],deep)}}return newObj}else{return createObject(obj)}break;case"array":if(deep){newObj=new Array(obj.length);x=obj.length;while(--x>=0){newObj[x]=clone(obj[x],deep)}return newObj}else{return Array.prototype.slice.call(obj)}break;default:return obj}}function JSONSchema(env,json,uri,schema){var fr;JSONInstance.call(this,env,json,uri);if(schema===true){this._schema=this}else if(json instanceof JSONSchema&&!(schema instanceof JSONSchema)){this._schema=json._schema}else{this._schema=schema instanceof JSONSchema?schema:this._env.getDefaultSchema()||this._env.createEmptySchema()}fr=this._schema.getValueOfProperty("fragmentResolution");if(fr==="dot-delimited"){this._fd="."}else if(fr==="slash-delimited"){this._fd="/"}return this.rebuild()}JSONSchema.prototype=createObject(JSONInstance.prototype);JSONSchema.prototype.getSchema=function(){var uri=this._refs&&this._refs["describedby"],newSchema;if(uri){newSchema=uri&&this._env.findSchema(uri);if(newSchema){if(!newSchema.equals(this._schema)){this._schema=newSchema;this.rebuild()}}else if(this._env._options["enforceReferences"]){throw new InitializationError(this,this._schema,"{describedby}","Unknown schema reference",uri)}}return this._schema};JSONSchema.prototype.getAttribute=function(key,arg){var schemaProperty,parser,property,result,schema=this.getSchema();if(!arg&&this._attributes&&this._attributes.hasOwnProperty(key)){return this._attributes[key]}schemaProperty=schema.getProperty("properties").getProperty(key);parser=schemaProperty.getValueOfProperty("parser");property=this.getProperty(key);if(typeof parser==="function"){result=parser(property,schemaProperty,arg);if(!arg&&this._attributes){this._attributes[key]=result}return result}return property.getValue()};JSONSchema.prototype.getAttributes=function(){var properties,schemaProperties,key,schemaProperty,parser,schema=this.getSchema();if(!this._attributes&&this.getType()==="object"){properties=this.getProperties();schemaProperties=schema.getProperty("properties");this._attributes={};for(key in properties){if(properties[key]!==O[key]){schemaProperty=schemaProperties&&schemaProperties.getProperty(key);parser=schemaProperty&&schemaProperty.getValueOfProperty("parser");if(typeof parser==="function"){this._attributes[key]=parser(properties[key],schemaProperty)}else{this._attributes[key]=properties[key].getValue()}}}}return clone(this._attributes,false)};JSONSchema.prototype.getLink=function(rel,instance){var schemaLinks=this.getAttribute("links",[rel,instance]);if(schemaLinks&&schemaLinks.length&&schemaLinks[schemaLinks.length-1]){return schemaLinks[schemaLinks.length-1]}};JSONSchema.prototype.validate=function(instance,report,parent,parentSchema,name){var schemaSchema=this.getSchema(),validator=schemaSchema.getValueOfProperty("validator");if(!(instance instanceof JSONInstance)){instance=this.getEnvironment().createInstance(instance)}if(!(report instanceof Report)){report=new Report}if(this._env._options["validateReferences"]&&this._refs){if(this._refs["describedby"]&&!this._env.findSchema(this._refs["describedby"])){report.addError(this,this._schema,"{describedby}","Unknown schema reference",this._refs["describedby"])}if(this._refs["full"]&&!this._env.findSchema(this._refs["full"])){report.addError(this,this._schema,"{full}","Unknown schema reference",this._refs["full"])}}if(typeof validator==="function"&&!report.isValidatedBy(instance.getURI(),this.getURI())){report.registerValidation(instance.getURI(),this.getURI());validator(instance,this,schemaSchema,report,parent,parentSchema,name)}return report};function createFullLookupWrapper(func){return function fullLookupWrapper(){var scope=this,stack=[],uri=scope._refs&&scope._refs["full"],schema;while(uri){schema=scope._env.findSchema(uri);if(schema){if(schema._value===scope._value){break}scope=schema;stack.push(uri);uri=scope._refs&&scope._refs["full"];if(searchArray(stack,uri)>-1){break}}else if(scope._env._options["enforceReferences"]){throw new InitializationError(scope,scope._schema,"{full}","Unknown schema reference",uri)}else{uri=null}}return func.apply(scope,arguments)}}(function(){var key;for(key in JSONSchema.prototype){if(JSONSchema.prototype[key]!==O[key]&&typeOf(JSONSchema.prototype[key])==="function"){JSONSchema.prototype[key]=createFullLookupWrapper(JSONSchema.prototype[key])}}})();JSONSchema.prototype.rebuild=function(){var instance=this,initializer=instance.getSchema().getValueOfProperty("initializer");instance._refs=null;instance._attributes=null;if(typeof initializer==="function"){instance=initializer(instance)}instance._env._schemas[instance._uri]=instance;instance.getAttributes();return instance};JSONSchema.prototype.setReference=function(name,uri){if(!this._refs){this._refs={}}this._refs[name]=this.resolveURI(uri)};JSONSchema.prototype.getReference=function(name){return this._refs&&this._refs[name]};function inherits(base,extra,extension){var baseType=typeOf(base),extraType=typeOf(extra),child,x;if(extraType==="undefined"){return clone(base,true)}else if(baseType==="undefined"||extraType!==baseType){return clone(extra,true)}else if(extraType==="object"){if(base instanceof JSONSchema){base=base.getAttributes()}if(extra instanceof JSONSchema){extra=extra.getAttributes();if(extra["extends"]&&extension&&extra["extends"]instanceof JSONSchema){extra["extends"]=[extra["extends"]]}}child=clone(base,true);for(x in extra){if(extra[x]!==O[x]){child[x]=inherits(base[x],extra[x],extension)}}return child}else{return clone(extra,true)}}function Environment(){this._id=randomUUID();this._schemas={};this._options={};this.createSchema({},true,"urn:jsv:empty-schema#")}Environment.prototype.clone=function(){var env=new Environment;env._schemas=createObject(this._schemas);env._options=createObject(this._options);return env};Environment.prototype.createInstance=function(data,uri){uri=formatURI(uri);if(data instanceof JSONInstance&&(!uri||data.getURI()===uri)){return data}return new JSONInstance(this,data,uri)};Environment.prototype.createSchema=function(data,schema,uri){uri=formatURI(uri);if(data instanceof JSONSchema&&(!uri||data._uri===uri)&&(!schema||data.getSchema().equals(schema))){return data}return new JSONSchema(this,data,uri,schema)};Environment.prototype.createEmptySchema=function(){return this._schemas["urn:jsv:empty-schema#"]};Environment.prototype.findSchema=function(uri){return this._schemas[formatURI(uri)]};Environment.prototype.setOption=function(name,value){this._options[name]=value};Environment.prototype.getOption=function(name){return this._options[name]};Environment.prototype.setDefaultFragmentDelimiter=function(fd){if(typeof fd==="string"&&fd.length>0){this._options["defaultFragmentDelimiter"]=fd}};Environment.prototype.getDefaultFragmentDelimiter=function(){return this._options["defaultFragmentDelimiter"]};Environment.prototype.setDefaultSchemaURI=function(uri){if(typeof uri==="string"){this._options["defaultSchemaURI"]=formatURI(uri)}};Environment.prototype.getDefaultSchema=function(){return this.findSchema(this._options["defaultSchemaURI"])};Environment.prototype.validate=function(instanceJSON,schemaJSON){var instance,schema,schemaSchema,report=new Report;try{instance=this.createInstance(instanceJSON);report.instance=instance}catch(e){report.addError(e.uri,e.schemaUri,e.attribute,e.message,e.details)}try{schema=this.createSchema(schemaJSON);report.schema=schema;schemaSchema=schema.getSchema();report.schemaSchema=schemaSchema}catch(f){report.addError(f.uri,f.schemaUri,f.attribute,f.message,f.details)}if(schemaSchema){schemaSchema.validate(schema,report)}if(report.errors.length){return report}return schema.validate(instance,report)};Environment.prototype._checkForInvalidInstances=function(stackSize,schemaURI){var result=[],stack=[[schemaURI,this._schemas[schemaURI]]],counter=0,item,uri,instance,properties,key;while(counter++<stackSize&&stack.length){item=stack.shift();uri=item[0];instance=item[1];if(instance instanceof JSONSchema){if(this._schemas[instance._uri]!==instance){result.push("Instance "+uri+" does not match "+instance._uri)}else{properties=instance.getAttributes();for(key in properties){if(properties[key]!==O[key]){stack.push([uri+"/"+escapeURIComponent(key),properties[key]])}}}}else if(typeOf(instance)==="object"){properties=instance;for(key in properties){if(properties.hasOwnProperty(key)){stack.push([uri+"/"+escapeURIComponent(key),properties[key]])}}}else if(typeOf(instance)==="array"){properties=instance;for(key=0;key<properties.length;++key){stack.push([uri+"/"+escapeURIComponent(key),properties[key]])}}}return result.length?result:counter};JSV={_environments:{},_defaultEnvironmentID:"",isJSONInstance:function(o){return o instanceof JSONInstance},isJSONSchema:function(o){return o instanceof JSONSchema},createEnvironment:function(id){id=id||this._defaultEnvironmentID;if(!this._environments[id]){throw new Error("Unknown Environment ID")}return this._environments[id].clone()},Environment:Environment,registerEnvironment:function(id,env){id=id||(env||0)._id;if(id&&!this._environments[id]&&env instanceof Environment){env._id=id;this._environments[id]=env}},setDefaultEnvironmentID:function(id){if(typeof id==="string"){if(!this._environments[id]){throw new Error("Unknown Environment ID")}this._defaultEnvironmentID=id}},getDefaultEnvironmentID:function(){return this._defaultEnvironmentID},typeOf:typeOf,createObject:createObject,mapObject:mapObject,mapArray:mapArray,filterArray:filterArray,searchArray:searchArray,toArray:toArray,keys:keys,pushUnique:pushUnique,popFirst:popFirst,clone:clone,randomUUID:randomUUID,escapeURIComponent:escapeURIComponent,formatURI:formatURI,inherits:inherits,InitializationError:InitializationError};exports.JSV=JSV;__webpack_require__(1)},function(module,exports,__webpack_require__){__webpack_require__(3)},function(module,exports){var mergeSet=function(sets){var set=arguments[0],x=1,nextSet=arguments[x];while(nextSet){set=set.slice(0,-1)+nextSet.slice(1);nextSet=arguments[++x]}return set},subexp=function(str){return"(?:"+str+")"},ALPHA$$="[A-Za-z]",CR$="[\\x0D]",DIGIT$$="[0-9]",DQUOTE$$="[\\x22]",HEXDIG$$=mergeSet(DIGIT$$,"[A-Fa-f]"),LF$$="[\\x0A]",SP$$="[\\x20]",PCT_ENCODED$=subexp("%"+HEXDIG$$+HEXDIG$$),GEN_DELIMS$$="[\\:\\/\\?\\#\\[\\]\\@]",SUB_DELIMS$$="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",RESERVED$$=mergeSet(GEN_DELIMS$$,SUB_DELIMS$$),UNRESERVED$$=mergeSet(ALPHA$$,DIGIT$$,"[\\-\\.\\_\\~]"),SCHEME$=subexp(ALPHA$$+mergeSet(ALPHA$$,DIGIT$$,"[\\+\\-\\.]")+"*"),USERINFO$=subexp(subexp(PCT_ENCODED$+"|"+mergeSet(UNRESERVED$$,SUB_DELIMS$$,"[\\:]"))+"*"),DEC_OCTET$=subexp(subexp("25[0-5]")+"|"+subexp("2[0-4]"+DIGIT$$)+"|"+subexp("1"+DIGIT$$+DIGIT$$)+"|"+subexp("[1-9]"+DIGIT$$)+"|"+DIGIT$$),IPV4ADDRESS$=subexp(DEC_OCTET$+"\\."+DEC_OCTET$+"\\."+DEC_OCTET$+"\\."+DEC_OCTET$),H16$=subexp(HEXDIG$$+"{1,4}"),LS32$=subexp(subexp(H16$+"\\:"+H16$)+"|"+IPV4ADDRESS$),IPV6ADDRESS$=subexp(mergeSet(UNRESERVED$$,SUB_DELIMS$$,"[\\:]")+"+"),IPVFUTURE$=subexp("v"+HEXDIG$$+"+\\."+mergeSet(UNRESERVED$$,SUB_DELIMS$$,"[\\:]")+"+"),IP_LITERAL$=subexp("\\["+subexp(IPV6ADDRESS$+"|"+IPVFUTURE$)+"\\]"),REG_NAME$=subexp(subexp(PCT_ENCODED$+"|"+mergeSet(UNRESERVED$$,SUB_DELIMS$$))+"*"),HOST$=subexp(IP_LITERAL$+"|"+IPV4ADDRESS$+"|"+REG_NAME$),PORT$=subexp(DIGIT$$+"*"),AUTHORITY$=subexp(subexp(USERINFO$+"@")+"?"+HOST$+subexp("\\:"+PORT$)+"?"),PCHAR$=subexp(PCT_ENCODED$+"|"+mergeSet(UNRESERVED$$,SUB_DELIMS$$,"[\\:\\@]")),SEGMENT$=subexp(PCHAR$+"*"),SEGMENT_NZ$=subexp(PCHAR$+"+"),SEGMENT_NZ_NC$=subexp(subexp(PCT_ENCODED$+"|"+mergeSet(UNRESERVED$$,SUB_DELIMS$$,"[\\@]"))+"+"),PATH_ABEMPTY$=subexp(subexp("\\/"+SEGMENT$)+"*"),PATH_ABSOLUTE$=subexp("\\/"+subexp(SEGMENT_NZ$+PATH_ABEMPTY$)+"?"),PATH_NOSCHEME$=subexp(SEGMENT_NZ_NC$+PATH_ABEMPTY$),PATH_ROOTLESS$=subexp(SEGMENT_NZ$+PATH_ABEMPTY$),PATH_EMPTY$=subexp(""),PATH$=subexp(PATH_ABEMPTY$+"|"+PATH_ABSOLUTE$+"|"+PATH_NOSCHEME$+"|"+PATH_ROOTLESS$+"|"+PATH_EMPTY$),QUERY$=subexp(subexp(PCHAR$+"|[\\/\\?]")+"*"),FRAGMENT$=subexp(subexp(PCHAR$+"|[\\/\\?]")+"*"),HIER_PART$=subexp(subexp("\\/\\/"+AUTHORITY$+PATH_ABEMPTY$)+"|"+PATH_ABSOLUTE$+"|"+PATH_ROOTLESS$+"|"+PATH_EMPTY$),URI$=subexp(SCHEME$+"\\:"+HIER_PART$+subexp("\\?"+QUERY$)+"?"+subexp("\\#"+FRAGMENT$)+"?"),RELATIVE_PART$=subexp(subexp("\\/\\/"+AUTHORITY$+PATH_ABEMPTY$)+"|"+PATH_ABSOLUTE$+"|"+PATH_NOSCHEME$+"|"+PATH_EMPTY$),RELATIVE_REF$=subexp(RELATIVE_PART$+subexp("\\?"+QUERY$)+"?"+subexp("\\#"+FRAGMENT$)+"?"),URI_REFERENCE$=subexp(URI$+"|"+RELATIVE_REF$),ABSOLUTE_URI$=subexp(SCHEME$+"\\:"+HIER_PART$+subexp("\\?"+QUERY$)+"?"),URI_REF=new RegExp("^"+subexp("("+URI$+")|("+RELATIVE_REF$+")")+"$"),GENERIC_REF=new RegExp("^("+SCHEME$+")\\:"+subexp(subexp("\\/\\/("+subexp("("+USERINFO$+")@")+"?("+HOST$+")"+subexp("\\:("+PORT$+")")+"?)")+"?("+PATH_ABEMPTY$+"|"+PATH_ABSOLUTE$+"|"+PATH_ROOTLESS$+"|"+PATH_EMPTY$+")")+subexp("\\?("+QUERY$+")")+"?"+subexp("\\#("+FRAGMENT$+")")+"?$"),RELATIVE_REF=new RegExp("^(){0}"+subexp(subexp("\\/\\/("+subexp("("+USERINFO$+")@")+"?("+HOST$+")"+subexp("\\:("+PORT$+")")+"?)")+"?("+PATH_ABEMPTY$+"|"+PATH_ABSOLUTE$+"|"+PATH_NOSCHEME$+"|"+PATH_EMPTY$+")")+subexp("\\?("+QUERY$+")")+"?"+subexp("\\#("+FRAGMENT$+")")+"?$"),ABSOLUTE_REF=new RegExp("^("+SCHEME$+")\\:"+subexp(subexp("\\/\\/("+subexp("("+USERINFO$+")@")+"?("+HOST$+")"+subexp("\\:("+PORT$+")")+"?)")+"?("+PATH_ABEMPTY$+"|"+PATH_ABSOLUTE$+"|"+PATH_ROOTLESS$+"|"+PATH_EMPTY$+")")+subexp("\\?("+QUERY$+")")+"?$"),SAMEDOC_REF=new RegExp("^"+subexp("\\#("+FRAGMENT$+")")+"?$"),AUTHORITY=new RegExp("^"+subexp("("+USERINFO$+")@")+"?("+HOST$+")"+subexp("\\:("+PORT$+")")+"?$"),NOT_SCHEME=new RegExp(mergeSet("[^]",ALPHA$$,DIGIT$$,"[\\+\\-\\.]"),"g"),NOT_USERINFO=new RegExp(mergeSet("[^\\%\\:]",UNRESERVED$$,SUB_DELIMS$$),"g"),NOT_HOST=new RegExp(mergeSet("[^\\%]",UNRESERVED$$,SUB_DELIMS$$),"g"),NOT_PATH=new RegExp(mergeSet("[^\\%\\/\\:\\@]",UNRESERVED$$,SUB_DELIMS$$),"g"),NOT_PATH_NOSCHEME=new RegExp(mergeSet("[^\\%\\/\\@]",UNRESERVED$$,SUB_DELIMS$$),"g"),NOT_QUERY=new RegExp(mergeSet("[^\\%]",UNRESERVED$$,SUB_DELIMS$$,"[\\:\\@\\/\\?]"),"g"),NOT_FRAGMENT=NOT_QUERY,ESCAPE=new RegExp(mergeSet("[^]",UNRESERVED$$,SUB_DELIMS$$),"g"),UNRESERVED=new RegExp(UNRESERVED$$,"g"),OTHER_CHARS=new RegExp(mergeSet("[^\\%]",UNRESERVED$$,RESERVED$$),"g"),PCT_ENCODEDS=new RegExp(PCT_ENCODED$+"+","g"),URI_PARSE=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/i,RDS1=/^\.\.?\//,RDS2=/^\/\.(\/|$)/,RDS3=/^\/\.\.(\/|$)/,RDS4=/^\.\.?$/,RDS5=/^\/?.*?(?=\/|$)/,NO_MATCH_IS_UNDEFINED="".match(/(){0}/)[1]===undefined,pctEncChar=function(chr){var c=chr.charCodeAt(0);if(c<128){return"%"+c.toString(16).toUpperCase()}else if(c>127&&c<2048){return"%"+(c>>6|192).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase()}else{return"%"+(c>>12|224).toString(16).toUpperCase()+"%"+(c>>6&63|128).toString(16).toUpperCase()+"%"+(c&63|128).toString(16).toUpperCase()}},pctDecUnreserved=function(str){var newStr="",i=0,c,s;while(i<str.length){c=parseInt(str.substr(i+1,2),16);if(c<128){s=String.fromCharCode(c);if(s.match(UNRESERVED)){newStr+=s}else{newStr+=str.substr(i,3)}i+=3}else if(c>191&&c<224){newStr+=str.substr(i,6);i+=6}else{newStr+=str.substr(i,9);i+=9}}return newStr},pctDecChars=function(str){var newStr="",i=0,c,c2,c3;while(i<str.length){c=parseInt(str.substr(i+1,2),16);if(c<128){newStr+=String.fromCharCode(c);i+=3}else if(c>191&&c<224){c2=parseInt(str.substr(i+4,2),16);newStr+=String.fromCharCode((c&31)<<6|c2&63);i+=6}else{c2=parseInt(str.substr(i+4,2),16);c3=parseInt(str.substr(i+7,2),16);newStr+=String.fromCharCode((c&15)<<12|(c2&63)<<6|c3&63);i+=9}}return newStr},typeOf=function(o){return o===undefined?"undefined":o===null?"null":Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase()},Components=function(){this.errors=[]},URI=exports;Components.prototype={scheme:undefined,authority:undefined,userinfo:undefined,host:undefined,port:undefined,path:undefined,query:undefined,fragment:undefined,reference:undefined,errors:undefined};URI.SCHEMES={};URI.parse=function(uriString,options){var matches,components=new Components,schemeHandler;uriString=uriString?uriString.toString():"";options=options||{};if(options.reference==="suffix"){uriString=(options.scheme?options.scheme+":":"")+"//"+uriString}matches=uriString.match(URI_REF);if(matches){if(matches[1]){matches=uriString.match(GENERIC_REF)}else{matches=uriString.match(RELATIVE_REF)}}if(!matches){if(!options.tolerant){components.errors.push("URI is not strictly valid.")}matches=uriString.match(URI_PARSE)}if(matches){if(NO_MATCH_IS_UNDEFINED){components.scheme=matches[1];components.authority=matches[2];components.userinfo=matches[3];components.host=matches[4];components.port=parseInt(matches[5],10);components.path=matches[6]||"";components.query=matches[7];components.fragment=matches[8];if(isNaN(components.port)){components.port=matches[5]}}else{components.scheme=matches[1]||undefined;components.authority=uriString.indexOf("//")!==-1?matches[2]:undefined;components.userinfo=uriString.indexOf("@")!==-1?matches[3]:undefined;components.host=uriString.indexOf("//")!==-1?matches[4]:undefined;components.port=parseInt(matches[5],10);components.path=matches[6]||"";components.query=uriString.indexOf("?")!==-1?matches[7]:undefined;components.fragment=uriString.indexOf("#")!==-1?matches[8]:undefined;if(isNaN(components.port)){components.port=uriString.match(/\/\/.*\:(?:\/|\?|\#|$)/)?matches[4]:undefined}}if(!components.scheme&&!components.authority&&!components.path&&!components.query){components.reference="same-document"}else if(!components.scheme){components.reference="relative"}else if(!components.fragment){components.reference="absolute"}else{components.reference="uri"}if(options.reference&&options.reference!=="suffix"&&options.reference!==components.reference){components.errors.push("URI is not a "+options.reference+" reference.")}schemeHandler=URI.SCHEMES[(components.scheme||options.scheme||"").toLowerCase()];if(schemeHandler&&schemeHandler.parse){schemeHandler.parse(components,options)}}else{components.errors.push("URI can not be parsed.")}return components};URI._recomposeAuthority=function(components){var uriTokens=[];if(components.userinfo!==undefined||components.host!==undefined||typeof components.port==="number"){if(components.userinfo!==undefined){uriTokens.push(components.userinfo.toString().replace(NOT_USERINFO,pctEncChar));uriTokens.push("@")}if(components.host!==undefined){uriTokens.push(components.host.toString().toLowerCase().replace(NOT_HOST,pctEncChar))}if(typeof components.port==="number"){uriTokens.push(":");uriTokens.push(components.port.toString(10))}}return uriTokens.length?uriTokens.join(""):undefined};URI.removeDotSegments=function(input){var output=[],s;while(input.length){if(input.match(RDS1)){input=input.replace(RDS1,"")}else if(input.match(RDS2)){input=input.replace(RDS2,"/")}else if(input.match(RDS3)){input=input.replace(RDS3,"/");output.pop()}else if(input==="."||input===".."){input=""}else{s=input.match(RDS5)[0];input=input.slice(s.length);output.push(s)}}return output.join("")};URI.serialize=function(components,options){var uriTokens=[],schemeHandler,s;options=options||{};schemeHandler=URI.SCHEMES[components.scheme||options.scheme];if(schemeHandler&&schemeHandler.serialize){schemeHandler.serialize(components,options)}if(options.reference!=="suffix"&&components.scheme){uriTokens.push(components.scheme.toString().toLowerCase().replace(NOT_SCHEME,""));uriTokens.push(":")}components.authority=URI._recomposeAuthority(components);if(components.authority!==undefined){if(options.reference!=="suffix"){uriTokens.push("//")}uriTokens.push(components.authority);if(components.path&&components.path.charAt(0)!=="/"){uriTokens.push("/")}}if(components.path){s=URI.removeDotSegments(components.path.toString().replace(/%2E/gi,"."));if(components.scheme){s=s.replace(NOT_PATH,pctEncChar)}else{s=s.replace(NOT_PATH_NOSCHEME,pctEncChar)}if(components.authority===undefined){s=s.replace(/^\/\//,"/%2F")}uriTokens.push(s)}if(components.query){uriTokens.push("?");uriTokens.push(components.query.toString().replace(NOT_QUERY,pctEncChar))}if(components.fragment){uriTokens.push("#");uriTokens.push(components.fragment.toString().replace(NOT_FRAGMENT,pctEncChar))}return uriTokens.join("").replace(PCT_ENCODEDS,pctDecUnreserved).replace(/%[0-9A-Fa-f]{2}/g,function(str){return str.toUpperCase()})};URI.resolveComponents=function(base,relative,options,skipNormalization){var target=new Components;if(!skipNormalization){base=URI.parse(URI.serialize(base,options),options);relative=URI.parse(URI.serialize(relative,options),options)}options=options||{};if(!options.tolerant&&relative.scheme){target.scheme=relative.scheme;target.authority=relative.authority;target.userinfo=relative.userinfo;target.host=relative.host;target.port=relative.port;target.path=URI.removeDotSegments(relative.path);target.query=relative.query}else{if(relative.authority!==undefined){target.authority=relative.authority;target.userinfo=relative.userinfo;target.host=relative.host;target.port=relative.port;target.path=URI.removeDotSegments(relative.path);target.query=relative.query}else{if(!relative.path){target.path=base.path;if(relative.query!==undefined){target.query=relative.query}else{target.query=base.query}}else{if(relative.path.charAt(0)==="/"){target.path=URI.removeDotSegments(relative.path)}else{if(base.authority!==undefined&&!base.path){target.path="/"+relative.path}else if(!base.path){target.path=relative.path}else{target.path=base.path.slice(0,base.path.lastIndexOf("/")+1)+relative.path}target.path=URI.removeDotSegments(target.path)}target.query=relative.query}target.authority=base.authority;target.userinfo=base.userinfo;target.host=base.host;target.port=base.port}target.scheme=base.scheme}target.fragment=relative.fragment;return target};URI.resolve=function(baseURI,relativeURI,options){return URI.serialize(URI.resolveComponents(URI.parse(baseURI,options),URI.parse(relativeURI,options),options,true),options)};URI.normalize=function(uri,options){if(typeof uri==="string"){return URI.serialize(URI.parse(uri,options),options)}else if(typeOf(uri)==="object"){return URI.parse(URI.serialize(uri,options),options)}return uri};URI.equal=function(uriA,uriB,options){if(typeof uriA==="string"){uriA=URI.serialize(URI.parse(uriA,options),options)}else if(typeOf(uriA)==="object"){uriA=URI.serialize(uriA,options)}if(typeof uriB==="string"){uriB=URI.serialize(URI.parse(uriB,options),options)}else if(typeOf(uriB)==="object"){uriB=URI.serialize(uriB,options)}return uriA===uriB};URI.escapeComponent=function(str){return str&&str.toString().replace(ESCAPE,pctEncChar)};URI.unescapeComponent=function(str){return str&&str.toString().replace(PCT_ENCODEDS,pctDecChars)};exports.pctEncChar=pctEncChar;exports.pctDecChars=pctDecChars;exports.Components=Components;exports.URI=URI;exports["pctEncChar"]=pctEncChar;exports["pctDecChars"]=pctDecChars;exports["Components"]=Components;exports["URI"]={SCHEMES:URI.SCHEMES,parse:URI.parse,removeDotSegments:URI.removeDotSegments,serialize:URI.serialize,resolveComponents:URI.resolveComponents,resolve:URI.resolve,normalize:URI.normalize,equal:URI.equal,escapeComponent:URI.escapeComponent,unescapeComponent:URI.unescapeComponent}},function(module,exports,__webpack_require__){(function(){var O={},JSV=__webpack_require__(0).JSV,TYPE_VALIDATORS,ENVIRONMENT,SCHEMA_00_JSON,HYPERSCHEMA_00_JSON,LINKS_00_JSON,SCHEMA_00,HYPERSCHEMA_00,LINKS_00,SCHEMA_01_JSON,HYPERSCHEMA_01_JSON,LINKS_01_JSON,SCHEMA_01,HYPERSCHEMA_01,LINKS_01,SCHEMA_02_JSON,HYPERSCHEMA_02_JSON,LINKS_02_JSON,SCHEMA_02,HYPERSCHEMA_02,LINKS_02,SCHEMA_03_JSON,HYPERSCHEMA_03_JSON,LINKS_03_JSON,SCHEMA_03,HYPERSCHEMA_03,LINKS_03;TYPE_VALIDATORS={string:function(instance,report){return instance.getType()==="string"},number:function(instance,report){return instance.getType()==="number"},integer:function(instance,report){return instance.getType()==="number"&&instance.getValue()%1===0},"boolean":function(instance,report){return instance.getType()==="boolean"},object:function(instance,report){return instance.getType()==="object"},array:function(instance,report){return instance.getType()==="array"},"null":function(instance,report){return instance.getType()==="null"},any:function(instance,report){return true}};ENVIRONMENT=new JSV.Environment;ENVIRONMENT.setOption("validateReferences",true);ENVIRONMENT.setOption("enforceReferences",false);ENVIRONMENT.setOption("strict",false);SCHEMA_00_JSON={$schema:"http://json-schema.org/draft-00/hyper-schema#",id:"http://json-schema.org/draft-00/schema#",type:"object",properties:{type:{type:["string","array"],items:{type:["string",{$ref:"#"}]},optional:true,uniqueItems:true,"default":"any",parser:function(instance,self){var parser;if(instance.getType()==="string"){return instance.getValue();
}else if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))}else if(instance.getType()==="array"){parser=self.getValueOfProperty("parser");return JSV.mapArray(instance.getProperties(),function(prop){return parser(prop,self)})}return"any"},validator:function(instance,schema,self,report,parent,parentSchema,name){var requiredTypes=JSV.toArray(schema.getAttribute("type")),x,xl,type,subreport,typeValidators;if(instance.getType()!=="undefined"&&requiredTypes&&requiredTypes.length){typeValidators=self.getValueOfProperty("typeValidators")||{};for(x=0,xl=requiredTypes.length;x<xl;++x){type=requiredTypes[x];if(JSV.isJSONSchema(type)){subreport=JSV.createObject(report);subreport.errors=[];subreport.validated=JSV.clone(report.validated);if(type.validate(instance,subreport,parent,parentSchema,name).errors.length===0){return true}}else{if(typeValidators[type]!==O[type]&&typeof typeValidators[type]==="function"){if(typeValidators[type](instance,report)){return true}}else{return true}}}report.addError(instance,schema,"type","Instance is not a required type",requiredTypes);return false}return true},typeValidators:TYPE_VALIDATORS},properties:{type:"object",additionalProperties:{$ref:"#"},optional:true,"default":{},parser:function(instance,self,arg){var env=instance.getEnvironment(),selfEnv=self.getEnvironment();if(instance.getType()==="object"){if(arg){return env.createSchema(instance.getProperty(arg),selfEnv.findSchema(self.resolveURI("#")))}else{return JSV.mapObject(instance.getProperties(),function(instance){return env.createSchema(instance,selfEnv.findSchema(self.resolveURI("#")))})}}return{}},validator:function(instance,schema,self,report,parent,parentSchema,name){var propertySchemas,key;if(instance.getType()==="object"){propertySchemas=schema.getAttribute("properties");for(key in propertySchemas){if(propertySchemas[key]!==O[key]&&propertySchemas[key]){propertySchemas[key].validate(instance.getProperty(key),report,instance,schema,key)}}}}},items:{type:[{$ref:"#"},"array"],items:{$ref:"#"},optional:true,"default":{},parser:function(instance,self){if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))}else if(instance.getType()==="array"){return JSV.mapArray(instance.getProperties(),function(instance){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))})}return instance.getEnvironment().createEmptySchema()},validator:function(instance,schema,self,report,parent,parentSchema,name){var properties,items,x,xl,itemSchema,additionalProperties;if(instance.getType()==="array"){properties=instance.getProperties();items=schema.getAttribute("items");additionalProperties=schema.getAttribute("additionalProperties");if(JSV.typeOf(items)==="array"){for(x=0,xl=properties.length;x<xl;++x){itemSchema=items[x]||additionalProperties;if(itemSchema!==false){itemSchema.validate(properties[x],report,instance,schema,x)}else{report.addError(instance,schema,"additionalProperties","Additional items are not allowed",itemSchema)}}}else{itemSchema=items||additionalProperties;for(x=0,xl=properties.length;x<xl;++x){itemSchema.validate(properties[x],report,instance,schema,x)}}}}},optional:{type:"boolean",optional:true,"default":false,parser:function(instance,self){return!!instance.getValue()},validator:function(instance,schema,self,report,parent,parentSchema,name){if(instance.getType()==="undefined"&&!schema.getAttribute("optional")){report.addError(instance,schema,"optional","Property is required",false)}},validationRequired:true},additionalProperties:{type:[{$ref:"#"},"boolean"],optional:true,"default":{},parser:function(instance,self){if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))}else if(instance.getType()==="boolean"&&instance.getValue()===false){return false}return instance.getEnvironment().createEmptySchema()},validator:function(instance,schema,self,report,parent,parentSchema,name){var additionalProperties,propertySchemas,properties,key;if(instance.getType()==="object"){additionalProperties=schema.getAttribute("additionalProperties");propertySchemas=schema.getAttribute("properties")||{};properties=instance.getProperties();for(key in properties){if(properties[key]!==O[key]&&properties[key]&&propertySchemas[key]===O[key]){if(JSV.isJSONSchema(additionalProperties)){additionalProperties.validate(properties[key],report,instance,schema,key)}else if(additionalProperties===false){report.addError(instance,schema,"additionalProperties","Additional properties are not allowed",additionalProperties)}}}}}},requires:{type:["string",{$ref:"#"}],optional:true,parser:function(instance,self){if(instance.getType()==="string"){return instance.getValue()}else if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))}},validator:function(instance,schema,self,report,parent,parentSchema,name){var requires;if(instance.getType()!=="undefined"&&parent&&parent.getType()!=="undefined"){requires=schema.getAttribute("requires");if(typeof requires==="string"){if(parent.getProperty(requires).getType()==="undefined"){report.addError(instance,schema,"requires",'Property requires sibling property "'+requires+'"',requires)}}else if(JSV.isJSONSchema(requires)){requires.validate(parent,report)}}}},minimum:{type:"number",optional:true,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var minimum,minimumCanEqual;if(instance.getType()==="number"){minimum=schema.getAttribute("minimum");minimumCanEqual=schema.getAttribute("minimumCanEqual");if(typeof minimum==="number"&&(instance.getValue()<minimum||minimumCanEqual===false&&instance.getValue()===minimum)){report.addError(instance,schema,"minimum","Number is less than the required minimum value",minimum)}}}},maximum:{type:"number",optional:true,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var maximum,maximumCanEqual;if(instance.getType()==="number"){maximum=schema.getAttribute("maximum");maximumCanEqual=schema.getAttribute("maximumCanEqual");if(typeof maximum==="number"&&(instance.getValue()>maximum||maximumCanEqual===false&&instance.getValue()===maximum)){report.addError(instance,schema,"maximum","Number is greater than the required maximum value",maximum)}}}},minimumCanEqual:{type:"boolean",optional:true,requires:"minimum","default":true,parser:function(instance,self){if(instance.getType()==="boolean"){return instance.getValue()}return true}},maximumCanEqual:{type:"boolean",optional:true,requires:"maximum","default":true,parser:function(instance,self){if(instance.getType()==="boolean"){return instance.getValue()}return true}},minItems:{type:"integer",optional:true,minimum:0,"default":0,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}return 0},validator:function(instance,schema,self,report,parent,parentSchema,name){var minItems;if(instance.getType()==="array"){minItems=schema.getAttribute("minItems");if(typeof minItems==="number"&&instance.getProperties().length<minItems){report.addError(instance,schema,"minItems","The number of items is less than the required minimum",minItems)}}}},maxItems:{type:"integer",optional:true,minimum:0,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var maxItems;if(instance.getType()==="array"){maxItems=schema.getAttribute("maxItems");if(typeof maxItems==="number"&&instance.getProperties().length>maxItems){report.addError(instance,schema,"maxItems","The number of items is greater than the required maximum",maxItems)}}}},pattern:{type:"string",optional:true,format:"regex",parser:function(instance,self){if(instance.getType()==="string"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var pattern;try{pattern=new XRegExp(schema.getAttribute("pattern"));if(instance.getType()==="string"&&pattern&&!pattern.test(instance.getValue())){report.addError(instance,schema,"pattern","String does not match pattern",pattern.toString())}}catch(e){report.addError(schema,self,"pattern","Invalid pattern",schema.getValueOfProperty("pattern"))}}},minLength:{type:"integer",optional:true,minimum:0,"default":0,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}return 0},validator:function(instance,schema,self,report,parent,parentSchema,name){var minLength;if(instance.getType()==="string"){minLength=schema.getAttribute("minLength");if(typeof minLength==="number"&&instance.getValue().length<minLength){report.addError(instance,schema,"minLength","String is less than the required minimum length",minLength)}}}},maxLength:{type:"integer",optional:true,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var maxLength;if(instance.getType()==="string"){maxLength=schema.getAttribute("maxLength");if(typeof maxLength==="number"&&instance.getValue().length>maxLength){report.addError(instance,schema,"maxLength","String is greater than the required maximum length",maxLength)}}}},"enum":{type:"array",optional:true,minItems:1,uniqueItems:true,parser:function(instance,self){if(instance.getType()==="array"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var enums,x,xl;if(instance.getType()!=="undefined"){enums=schema.getAttribute("enum");if(enums){for(x=0,xl=enums.length;x<xl;++x){if(instance.equals(enums[x])){return true}}report.addError(instance,schema,"enum","Instance is not one of the possible values",enums)}}}},title:{type:"string",optional:true},description:{type:"string",optional:true},format:{type:"string",optional:true,parser:function(instance,self){if(instance.getType()==="string"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var format,formatValidators;if(instance.getType()==="string"){format=schema.getAttribute("format");formatValidators=self.getValueOfProperty("formatValidators");if(typeof format==="string"&&formatValidators[format]!==O[format]&&typeof formatValidators[format]==="function"&&!formatValidators[format].call(this,instance,report)){report.addError(instance,schema,"format","String is not in the required format",format)}}},formatValidators:{}},contentEncoding:{type:"string",optional:true},"default":{type:"any",optional:true},maxDecimal:{type:"integer",optional:true,minimum:0,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var maxDecimal,decimals;if(instance.getType()==="number"){maxDecimal=schema.getAttribute("maxDecimal");if(typeof maxDecimal==="number"){decimals=instance.getValue().toString(10).split(".")[1];if(decimals&&decimals.length>maxDecimal){report.addError(instance,schema,"maxDecimal","The number of decimal places is greater than the allowed maximum",maxDecimal)}}}}},disallow:{type:["string","array"],items:{type:"string"},optional:true,uniqueItems:true,parser:function(instance,self){if(instance.getType()==="string"||instance.getType()==="array"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var disallowedTypes=JSV.toArray(schema.getAttribute("disallow")),x,xl,key,typeValidators,subreport;if(instance.getType()!=="undefined"&&disallowedTypes&&disallowedTypes.length){typeValidators=self.getValueOfProperty("typeValidators")||{};for(x=0,xl=disallowedTypes.length;x<xl;++x){key=disallowedTypes[x];if(JSV.isJSONSchema(key)){subreport=JSV.createObject(report);subreport.errors=[];subreport.validated=JSV.clone(report.validated);if(key.validate(instance,subreport,parent,parentSchema,name).errors.length===0){report.addError(instance,schema,"disallow","Instance is a disallowed type",disallowedTypes);return false}}else if(typeValidators[key]!==O[key]&&typeof typeValidators[key]==="function"){if(typeValidators[key](instance,report)){report.addError(instance,schema,"disallow","Instance is a disallowed type",disallowedTypes);return false}}}return true}return true},typeValidators:TYPE_VALIDATORS},"extends":{type:[{$ref:"#"},"array"],items:{$ref:"#"},optional:true,"default":{},parser:function(instance,self){if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))}else if(instance.getType()==="array"){return JSV.mapArray(instance.getProperties(),function(instance){return instance.getEnvironment().createSchema(instance,self.getEnvironment().findSchema(self.resolveURI("#")))})}},validator:function(instance,schema,self,report,parent,parentSchema,name){var extensions=schema.getAttribute("extends"),x,xl;if(extensions){if(JSV.isJSONSchema(extensions)){extensions.validate(instance,report,parent,parentSchema,name)}else if(JSV.typeOf(extensions)==="array"){for(x=0,xl=extensions.length;x<xl;++x){extensions[x].validate(instance,report,parent,parentSchema,name)}}}}}},optional:true,"default":{},fragmentResolution:"dot-delimited",parser:function(instance,self){if(instance.getType()==="object"){return instance.getEnvironment().createSchema(instance,self)}},validator:function(instance,schema,self,report,parent,parentSchema,name){var propNames=schema.getPropertyNames(),x,xl,attributeSchemas=self.getAttribute("properties"),strict=instance.getEnvironment().getOption("strict"),validator;for(x in attributeSchemas){if(attributeSchemas[x]!==O[x]){if(attributeSchemas[x].getValueOfProperty("validationRequired")){JSV.pushUnique(propNames,x)}if(strict&&attributeSchemas[x].getValueOfProperty("deprecated")){JSV.popFirst(propNames,x)}}}for(x=0,xl=propNames.length;x<xl;++x){if(attributeSchemas[propNames[x]]!==O[propNames[x]]){validator=attributeSchemas[propNames[x]].getValueOfProperty("validator");if(typeof validator==="function"){validator(instance,schema,attributeSchemas[propNames[x]],report,parent,parentSchema,name)}}}}};HYPERSCHEMA_00_JSON={$schema:"http://json-schema.org/draft-00/hyper-schema#",id:"http://json-schema.org/draft-00/hyper-schema#",properties:{links:{type:"array",items:{$ref:"links#"},optional:true,parser:function(instance,self,arg){var links,linkSchemaURI=self.getValueOfProperty("items")["$ref"],linkSchema=self.getEnvironment().findSchema(linkSchemaURI),linkParser=linkSchema&&linkSchema.getValueOfProperty("parser"),selfReferenceVariable;arg=JSV.toArray(arg);if(typeof linkParser==="function"){links=JSV.mapArray(instance.getProperties(),function(link){return linkParser(link,linkSchema)})}else{links=JSV.toArray(instance.getValue())}if(arg[0]){links=JSV.filterArray(links,function(link){return link["rel"]===arg[0]})}if(arg[1]){selfReferenceVariable=self.getValueOfProperty("selfReferenceVariable");links=JSV.mapArray(links,function(link){var instance=arg[1],href=link["href"];href=href.replace(/\{(.+)\}/g,function(str,p1,offset,s){var value;if(p1===selfReferenceVariable){value=instance.getValue()}else{value=instance.getValueOfProperty(p1)}return value!==undefined?String(value):""});return href?JSV.formatURI(instance.resolveURI(href)):href})}return links},selfReferenceVariable:"-this"},fragmentResolution:{type:"string",optional:true,"default":"dot-delimited"},root:{type:"boolean",optional:true,"default":false},readonly:{type:"boolean",optional:true,"default":false},pathStart:{type:"string",optional:true,format:"uri",validator:function(instance,schema,self,report,parent,parentSchema,name){var pathStart;if(instance.getType()!=="undefined"){pathStart=schema.getAttribute("pathStart");if(typeof pathStart==="string"){if(instance.getURI().indexOf(pathStart)!==0){report.addError(instance,schema,"pathStart","Instance's URI does not start with "+pathStart,pathStart)}}}}},mediaType:{type:"string",optional:true,format:"media-type"},alternate:{type:"array",items:{$ref:"#"},optional:true}},links:[{href:"{$ref}",rel:"full"},{href:"{$schema}",rel:"describedby"},{href:"{id}",rel:"self"}],initializer:function(instance){var link,extension,extended;link=instance._schema.getLink("describedby",instance);if(link&&instance._schema._uri!==link){instance.setReference("describedby",link)}link=instance._schema.getLink("self",instance);if(JSV.typeOf(link)==="string"){instance._uri=JSV.formatURI(link)}link=instance._schema.getLink("full",instance);if(link&&instance._uri!==link){instance.setReference("full",link)}extension=instance.getAttribute("extends");if(JSV.isJSONSchema(extension)){extended=JSV.inherits(extension,instance,true);instance=instance._env.createSchema(extended,instance._schema,instance._uri)}return instance}};LINKS_00_JSON={$schema:"http://json-schema.org/draft-00/hyper-schema#",id:"http://json-schema.org/draft-00/links#",type:"object",properties:{href:{type:"string"},rel:{type:"string"},method:{type:"string","default":"GET",optional:true},enctype:{type:"string",requires:"method",optional:true},properties:{type:"object",additionalProperties:{$ref:"hyper-schema#"},optional:true,parser:function(instance,self,arg){var env=instance.getEnvironment(),selfEnv=self.getEnvironment(),additionalPropertiesSchemaURI=self.getValueOfProperty("additionalProperties")["$ref"];if(instance.getType()==="object"){if(arg){return env.createSchema(instance.getProperty(arg),selfEnv.findSchema(self.resolveURI(additionalPropertiesSchemaURI)))}else{return JSV.mapObject(instance.getProperties(),function(instance){return env.createSchema(instance,selfEnv.findSchema(self.resolveURI(additionalPropertiesSchemaURI)))})}}}}},parser:function(instance,self){var selfProperties=self.getProperty("properties");if(instance.getType()==="object"){return JSV.mapObject(instance.getProperties(),function(property,key){var propertySchema=selfProperties.getProperty(key),parser=propertySchema&&propertySchema.getValueOfProperty("parser");if(typeof parser==="function"){return parser(property,propertySchema)}return property.getValue()})}return instance.getValue()}};ENVIRONMENT.setOption("defaultFragmentDelimiter",".");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-00/schema#");SCHEMA_00=ENVIRONMENT.createSchema(SCHEMA_00_JSON,true,"http://json-schema.org/draft-00/schema#");HYPERSCHEMA_00=ENVIRONMENT.createSchema(JSV.inherits(SCHEMA_00,ENVIRONMENT.createSchema(HYPERSCHEMA_00_JSON,true,"http://json-schema.org/draft-00/hyper-schema#"),true),true,"http://json-schema.org/draft-00/hyper-schema#");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-00/hyper-schema#");LINKS_00=ENVIRONMENT.createSchema(LINKS_00_JSON,HYPERSCHEMA_00,"http://json-schema.org/draft-00/links#");SCHEMA_01_JSON=JSV.inherits(SCHEMA_00_JSON,{$schema:"http://json-schema.org/draft-01/hyper-schema#",id:"http://json-schema.org/draft-01/schema#"});HYPERSCHEMA_01_JSON=JSV.inherits(HYPERSCHEMA_00_JSON,{$schema:"http://json-schema.org/draft-01/hyper-schema#",id:"http://json-schema.org/draft-01/hyper-schema#"});LINKS_01_JSON=JSV.inherits(LINKS_00_JSON,{$schema:"http://json-schema.org/draft-01/hyper-schema#",id:"http://json-schema.org/draft-01/links#"});ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-01/schema#");SCHEMA_01=ENVIRONMENT.createSchema(SCHEMA_01_JSON,true,"http://json-schema.org/draft-01/schema#");HYPERSCHEMA_01=ENVIRONMENT.createSchema(JSV.inherits(SCHEMA_01,ENVIRONMENT.createSchema(HYPERSCHEMA_01_JSON,true,"http://json-schema.org/draft-01/hyper-schema#"),true),true,"http://json-schema.org/draft-01/hyper-schema#");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-01/hyper-schema#");LINKS_01=ENVIRONMENT.createSchema(LINKS_01_JSON,HYPERSCHEMA_01,"http://json-schema.org/draft-01/links#");SCHEMA_02_JSON=JSV.inherits(SCHEMA_01_JSON,{$schema:"http://json-schema.org/draft-02/hyper-schema#",id:"http://json-schema.org/draft-02/schema#",properties:{uniqueItems:{type:"boolean",optional:true,"default":false,parser:function(instance,self){return!!instance.getValue()},validator:function(instance,schema,self,report,parent,parentSchema,name){var value,x,xl,y,yl;if(instance.getType()==="array"&&schema.getAttribute("uniqueItems")){value=instance.getProperties();for(x=0,xl=value.length-1;x<xl;++x){for(y=x+1,yl=value.length;y<yl;++y){if(value[x].equals(value[y])){report.addError(instance,schema,"uniqueItems","Array can only contain unique items",{x:x,y:y})}}}}}},maxDecimal:{deprecated:true},divisibleBy:{type:"number",minimum:0,minimumCanEqual:false,optional:true,parser:function(instance,self){if(instance.getType()==="number"){return instance.getValue()}},validator:function(instance,schema,self,report,parent,parentSchema,name){var divisor,value,digits;if(instance.getType()==="number"){divisor=schema.getAttribute("divisibleBy");if(divisor===0){report.addError(instance,schema,"divisibleBy","Nothing is divisible by 0",divisor)}else if(divisor!==1){value=instance.getValue();digits=Math.max((value.toString().split(".")[1]||" ").length,(divisor.toString().split(".")[1]||" ").length);digits=parseFloat((value/divisor%1).toFixed(digits));if(0<digits&&digits<1){report.addError(instance,schema,"divisibleBy","Number is not divisible by "+divisor,divisor)}}}}}},fragmentResolution:"slash-delimited"});HYPERSCHEMA_02_JSON=JSV.inherits(HYPERSCHEMA_01_JSON,{id:"http://json-schema.org/draft-02/hyper-schema#",properties:{fragmentResolution:{"default":"slash-delimited"}}});LINKS_02_JSON=JSV.inherits(LINKS_01_JSON,{$schema:"http://json-schema.org/draft-02/hyper-schema#",id:"http://json-schema.org/draft-02/links#",properties:{targetSchema:{$ref:"hyper-schema#",parser:HYPERSCHEMA_01.getAttribute("parser")}}});ENVIRONMENT.setOption("defaultFragmentDelimiter","/");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-02/schema#");SCHEMA_02=ENVIRONMENT.createSchema(SCHEMA_02_JSON,true,"http://json-schema.org/draft-02/schema#");HYPERSCHEMA_02=ENVIRONMENT.createSchema(JSV.inherits(SCHEMA_02,ENVIRONMENT.createSchema(HYPERSCHEMA_02_JSON,true,"http://json-schema.org/draft-02/hyper-schema#"),true),true,"http://json-schema.org/draft-02/hyper-schema#");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-02/hyper-schema#");LINKS_02=ENVIRONMENT.createSchema(LINKS_02_JSON,HYPERSCHEMA_02,"http://json-schema.org/draft-02/links#");function getMatchedPatternProperties(instance,schema,report,self){var matchedProperties={},patternProperties,pattern,regexp,properties,key;if(instance.getType()==="object"){patternProperties=schema.getAttribute("patternProperties");properties=instance.getProperties();for(pattern in patternProperties){if(patternProperties[pattern]!==O[pattern]){regexp=null;try{regexp=new RegExp(pattern)}catch(e){if(report){report.addError(schema,self,"patternProperties","Invalid pattern",pattern)}}if(regexp){for(key in properties){if(properties[key]!==O[key]&®exp.test(key)){matchedProperties[key]=matchedProperties[key]?JSV.pushUnique(matchedProperties[key],patternProperties[pattern]):[patternProperties[pattern]]}}}}}}return matchedProperties}SCHEMA_03_JSON=JSV.inherits(SCHEMA_02_JSON,{$schema:"http://json-schema.org/draft-03/schema#",id:"http://json-schema.org/draft-03/schema#",properties:{patternProperties:{type:"object",additionalProperties:{$ref:"#"},"default":{},parser:SCHEMA_02.getValueOfProperty("properties")["properties"]["parser"],validator:function(instance,schema,self,report,parent,parentSchema,name){var matchedProperties,key,x;if(instance.getType()==="object"){matchedProperties=getMatchedPatternProperties(instance,schema,report,self);for(key in matchedProperties){if(matchedProperties[key]!==O[key]){x=matchedProperties[key].length;while(x--){matchedProperties[key][x].validate(instance.getProperty(key),report,instance,schema,key)}}}}}},additionalProperties:{validator:function(instance,schema,self,report,parent,parentSchema,name){var additionalProperties,propertySchemas,properties,matchedProperties,key;if(instance.getType()==="object"){additionalProperties=schema.getAttribute("additionalProperties");propertySchemas=schema.getAttribute("properties")||{};properties=instance.getProperties();matchedProperties=getMatchedPatternProperties(instance,schema);for(key in properties){if(properties[key]!==O[key]&&properties[key]&&propertySchemas[key]===O[key]&&matchedProperties[key]===O[key]){if(JSV.isJSONSchema(additionalProperties)){additionalProperties.validate(properties[key],report,instance,schema,key)}else if(additionalProperties===false){report.addError(instance,schema,"additionalProperties","Additional properties are not allowed",additionalProperties)}}}}}},items:{validator:function(instance,schema,self,report,parent,parentSchema,name){var properties,items,x,xl,itemSchema,additionalItems;if(instance.getType()==="array"){properties=instance.getProperties();items=schema.getAttribute("items");additionalItems=schema.getAttribute("additionalItems");if(JSV.typeOf(items)==="array"){for(x=0,xl=properties.length;x<xl;++x){itemSchema=items[x]||additionalItems;if(itemSchema!==false){itemSchema.validate(properties[x],report,instance,schema,x)}else{report.addError(instance,schema,"additionalItems","Additional items are not allowed",itemSchema)}}}else{itemSchema=items||additionalItems;for(x=0,xl=properties.length;x<xl;++x){itemSchema.validate(properties[x],report,instance,schema,x)}}}}},additionalItems:{type:[{$ref:"#"},"boolean"],"default":{},parser:SCHEMA_02.getValueOfProperty("properties")["additionalProperties"]["parser"],validator:function(instance,schema,self,report,parent,parentSchema,name){var additionalItems,properties,x,xl;if(instance.getType()==="array"&&schema.getProperty("items").getType()==="undefined"){additionalItems=schema.getAttribute("additionalItems");properties=instance.getProperties();if(additionalItems!==false){for(x=0,xl=properties.length;x<xl;++x){additionalItems.validate(properties[x],report,instance,schema,x)}}else if(properties.length){report.addError(instance,schema,"additionalItems","Additional items are not allowed",additionalItems)}}}},optional:{validationRequired:false,deprecated:true},required:{type:"boolean","default":false,parser:function(instance,self){return!!instance.getValue()},validator:function(instance,schema,self,report,parent,parentSchema,name){if(instance.getType()==="undefined"&&schema.getAttribute("required")){report.addError(instance,schema,"required","Property is required",true)}}},requires:{deprecated:true},dependencies:{type:"object",additionalProperties:{type:["string","array",{$ref:"#"}],items:{type:"string"}},"default":{},parser:function(instance,self,arg){function parseProperty(property){var type=property.getType();if(type==="string"||type==="array"){return property.getValue()}else if(type==="object"){return property.getEnvironment().createSchema(property,self.getEnvironment().findSchema(self.resolveURI("#")))}}if(instance.getType()==="object"){if(arg){return parseProperty(instance.getProperty(arg))}else{return JSV.mapObject(instance.getProperties(),parseProperty)}}return{}},validator:function(instance,schema,self,report,parent,parentSchema,name){var dependencies,key,dependency,type,x,xl;if(instance.getType()==="object"){dependencies=schema.getAttribute("dependencies");for(key in dependencies){if(dependencies[key]!==O[key]&&instance.getProperty(key).getType()!=="undefined"){dependency=dependencies[key];type=JSV.typeOf(dependency);if(type==="string"){if(instance.getProperty(dependency).getType()==="undefined"){report.addError(instance,schema,"dependencies",'Property "'+key+'" requires sibling property "'+dependency+'"',dependencies)}}else if(type==="array"){for(x=0,xl=dependency.length;x<xl;++x){if(instance.getProperty(dependency[x]).getType()==="undefined"){report.addError(instance,schema,"dependencies",'Property "'+key+'" requires sibling property "'+dependency[x]+'"',dependencies)}}}else if(JSV.isJSONSchema(dependency)){dependency.validate(instance,report)}}}}}},minimumCanEqual:{deprecated:true},maximumCanEqual:{deprecated:true},exclusiveMinimum:{type:"boolean","default":false,parser:function(instance,self){return!!instance.getValue()}},exclusiveMaximum:{type:"boolean","default":false,parser:function(instance,self){return!!instance.getValue()}},minimum:{validator:function(instance,schema,self,report,parent,parentSchema,name){var minimum,exclusiveMinimum;if(instance.getType()==="number"){minimum=schema.getAttribute("minimum");exclusiveMinimum=schema.getAttribute("exclusiveMinimum")||!instance.getEnvironment().getOption("strict")&&!schema.getAttribute("minimumCanEqual");if(typeof minimum==="number"&&(instance.getValue()<minimum||exclusiveMinimum===true&&instance.getValue()===minimum)){report.addError(instance,schema,"minimum","Number is less than the required minimum value",minimum)}}}},maximum:{validator:function(instance,schema,self,report,parent,parentSchema,name){var maximum,exclusiveMaximum;if(instance.getType()==="number"){maximum=schema.getAttribute("maximum");exclusiveMaximum=schema.getAttribute("exclusiveMaximum")||!instance.getEnvironment().getOption("strict")&&!schema.getAttribute("maximumCanEqual");if(typeof maximum==="number"&&(instance.getValue()>maximum||exclusiveMaximum===true&&instance.getValue()===maximum)){report.addError(instance,schema,"maximum","Number is greater than the required maximum value",maximum)}}}},contentEncoding:{deprecated:true},divisibleBy:{exclusiveMinimum:true},disallow:{items:{type:["string",{$ref:"#"}]},parser:SCHEMA_02_JSON["properties"]["type"]["parser"]},id:{type:"string",format:"uri"},$ref:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"}},dependencies:{exclusiveMinimum:"minimum",exclusiveMaximum:"maximum"},initializer:function(instance){var link,extension,extended,schemaLink=instance.getValueOfProperty("$schema"),refLink=instance.getValueOfProperty("$ref"),idLink=instance.getValueOfProperty("id");if(schemaLink){link=instance.resolveURI(schemaLink);instance.setReference("describedby",link)}if(idLink){link=instance.resolveURI(idLink);if(JSV.typeOf(link)==="string"){instance._uri=JSV.formatURI(link)}}if(refLink){link=instance.resolveURI(refLink);instance.setReference("full",link)}extension=instance.getAttribute("extends");if(JSV.isJSONSchema(extension)){extended=JSV.inherits(extension,instance,true);instance=instance._env.createSchema(extended,instance._schema,instance._uri)}return instance}});HYPERSCHEMA_03_JSON=JSV.inherits(HYPERSCHEMA_02_JSON,{$schema:"http://json-schema.org/draft-03/hyper-schema#",id:"http://json-schema.org/draft-03/hyper-schema#",properties:{links:{selfReferenceVariable:"@"},root:{deprecated:true},contentEncoding:{deprecated:false},alternate:{deprecated:true}}});LINKS_03_JSON=JSV.inherits(LINKS_02_JSON,{$schema:"http://json-schema.org/draft-03/hyper-schema#",id:"http://json-schema.org/draft-03/links#",properties:{href:{required:true,format:"link-description-object-template"},rel:{required:true},properties:{deprecated:true},schema:{$ref:"http://json-schema.org/draft-03/hyper-schema#"}}});ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-03/schema#");SCHEMA_03=ENVIRONMENT.createSchema(SCHEMA_03_JSON,true,"http://json-schema.org/draft-03/schema#");HYPERSCHEMA_03=ENVIRONMENT.createSchema(JSV.inherits(SCHEMA_03,ENVIRONMENT.createSchema(HYPERSCHEMA_03_JSON,true,"http://json-schema.org/draft-03/hyper-schema#"),true),true,"http://json-schema.org/draft-03/hyper-schema#");ENVIRONMENT.setOption("defaultSchemaURI","http://json-schema.org/draft-03/hyper-schema#");LINKS_03=ENVIRONMENT.createSchema(LINKS_03_JSON,true,"http://json-schema.org/draft-03/links#");
ENVIRONMENT.setOption("latestJSONSchemaSchemaURI","http://json-schema.org/draft-03/schema#");ENVIRONMENT.setOption("latestJSONSchemaHyperSchemaURI","http://json-schema.org/draft-03/hyper-schema#");ENVIRONMENT.setOption("latestJSONSchemaLinksURI","http://json-schema.org/draft-03/links#");ENVIRONMENT._schemas["http://json-schema.org/schema#"]=SCHEMA_03;ENVIRONMENT._schemas["http://json-schema.org/hyper-schema#"]=HYPERSCHEMA_03;ENVIRONMENT._schemas["http://json-schema.org/links#"]=LINKS_03;JSV.registerEnvironment("json-schema-draft-03",ENVIRONMENT);if(!JSV.getDefaultEnvironmentID()||JSV.getDefaultEnvironmentID()==="json-schema-draft-01"||JSV.getDefaultEnvironmentID()==="json-schema-draft-02"){JSV.setDefaultEnvironmentID("json-schema-draft-03")}})()}]);