module.exports = "(function(i){var t=i.exports=function(){};t.prototype={wrap:function(){if(this.wrapped)return this.validate;this.wrapped=!0;var i=[\"toJSON\",\"unwrap\",\"errors\"];i=i.concat(this.publicFunctions||[]);for(var t=0;t<i.length;t++)this[i[t]]&&(this.validate[i[t]]=this[i[t]].bind(this));return this.validate},unwrap:function(){return this},toJSON:r((function(i){var e,r=t.session;r.serialized||(r.serialized={objects:[],jsons:[],ids:[]});var n=r.serialized.objects.indexOf(this);if(i&&-1!==n){if(null==(e=r.serialized.jsons[n]).id){do{e.id=\"id-\"+Math.floor(1e5*Math.random())}while(-1!==r.serialized.ids.indexOf(e.id));r.serialized.ids.push(e.id)}e={$ref:e.id}}else e={},null!=this.doc&&(e.description=this.doc),r.serialized.objects.push(this),r.serialized.jsons.push(e);return e}))},t.extend=function(i){if(!i.validate)throw new Error(\"Schema objects must have a validate function.\");var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.validate=this.validate.bind(this),this.validate.schema=this.validate},r=Object.create(t.prototype);for(var n in i)r[n]=i[n];return e.prototype=r,e};var e=!1;function r(i){return function(){if(e)return i.apply(this,arguments);e=!0;var t=i.apply(this,arguments);for(var n in r)delete r[n];return e=!1,t}}function n(i,t){for(var e,r=i.length;r--;)if(null!=(e=i[r](t)))return e}t.session=r;var s=[];t.fromJS=n.bind(null,s),t.fromJS.def=Array.prototype.push.bind(s);var a=[];t.fromJSON=r(n.bind(null,a)),t.fromJSON.def=Array.prototype.push.bind(a),t.patterns={},t.extensions={}})";