require.def("preview/ref",["core/lib"],function(x){return{resolveJson:function(i,f){function m(d,p,e,j,a){var n,b;e=q in d?d[q]:e;if(e!==undefined)e=(r+e).replace(s,"$2$3");a=a||d;if(e!==undefined){if(y)d.__id=e;if(f.schemas&&!(d instanceof Array)&&(b=e.match(/^(.+\/)[^\.\[]*$/)))j=f.schemas[b[1]];if(g[e]&&d instanceof Array==g[e]instanceof Array){a=g[e];delete a.$ref;n=true}else if(b=j&&j.prototype){t.prototype=b;a=new t}g[e]=a;if(u)u[e]=f.time}j=j&&j.properties;var z=d.length;for(var c in d){if(c== z)break;if(d.hasOwnProperty(c)){b=d[c];var h=j&&j[c];if(h&&h.format=="date-time"&&typeof b=="string")b=x.fromISOString(b);else if(typeof b=="object"&&b&&!(b instanceof Date))if(k=b.$ref){delete d[c];var l=k.replace(/(#)([^\.\[])/,"$1.$2").match(/(^([^\[]*\/)?[^#\.\[]*)#?([\.\[].*)?/);if(k=l[1]=="$"||l[1]=="this"||l[1]==""?i:g[(r+l[1]).replace(s,"$2$3")])l[3]&&l[3].replace(/(\[([^\]]+)\])|(\.?([^\.\[]+))/g,function(C,D,v,E,A){k=k&&k[v?v.replace(/[\"\'\\]/,""):A]});if(k)b=k;else if(p){b=m(b,false,b.$ref, h);b._loadObject=f.loader}else{var w;w||o.push(a);w=true}}else p||(b=m(b,o==d,e&&B(e,c),h,a!=d&&typeof a[c]=="object"&&a[c]));d[c]=b;if(a!=d&&!a.__isDirty){h=a[c];a[c]=b;n&&b!==h&&!a._loadObject&&!(b instanceof Date&&h instanceof Date&&b.getTime()==h.getTime())&&!(typeof b=="function"&&typeof h=="function"&&b.toString()==h.toString())&&g.onUpdate&&g.onUpdate(a,c,h,b)}}}if(n)for(c in a){if(!a.__isDirty&&a.hasOwnProperty(c)&&!d.hasOwnProperty(c)&&c!="__id"&&c!="__clientId"&&!(a instanceof Array&&isNaN(c))){g.onUpdate&& c!="_loadObject"&&c!="_idAttr"&&g.onUpdate(a,c,a[c],undefined);for(delete a[c];a instanceof Array&&a.length&&a[a.length-1]===undefined;)a.length--}}else g.onLoad&&g.onLoad(a);return a}f=f||{};var q=f.idAttribute||"id",r=f.idPrefix||"",y=f.assignAbsoluteIds,g=f.index||{},u=f.timeStamps,k,o=[],s=/^(.*\/)?(\w+:\/\/)|[^\/\.]+\/\.\.\/|^.*\/(\/)/,B=this._addProp,t=function(){};if(i&&typeof i=="object"){i=m(i,false,f.defaultId);m(o,false)}return i},_addProp:function(i,f){return i+(i.match(/#/)?i.length== 1?"":".":"#")+f}}});