function J(){return function(){}}function P(p){return function(){return p}} (function(p,x){function n(){}function K(a,b,c){var d=p.console;switch(arguments.length){case 1:d.log(a);break;case 2:d.log(a,b);break;default:d.log(a,b,c);break}}function ba(a,b,c){var d=p.console;switch(arguments.length){case 1:d.error(a);break;case 2:d.error(a,b);break;default:d.error(a,b,c);break}}function ha(a,b){var c=x.createElement("div");c.className=a;for(var d=a="",e=0;e/g,">")}function Ka(a){if(!a||!a.replace)return a;return a.replace(//g,">").replace(/\"/g,""")}function La(a,b){if(!a)throw"Missing this";if(!_.isFunction(b))throw"Missing function";return function(){return b.apply(a,arguments)}}function ka(a){var b=x.createElement("div"); b.appendChild(a);var c=b.innerHTML;b.removeChild(a);return c}function W(a){var b=(""+a).toLowerCase();if(b=="f"||b=="0"||b=="false"||b=="no")a=false;return!!a}function X(a,b){for(var c in a){var d=b[c],e=typeof d;if(e=="undefined")b[c]=L(v(a[c]));else e=="object"&&d.constructor!=array&&c.substring(0,1)!="$"&&X(a[c],d)}}function la(a){this.location=a;this.delay=25;this.setTimeout=function(b,c){p.setTimeout(b,c)};this.Ha=function(b){return b};this.N=a.href}function Ma(){var a=l.fn;a.scope=function(){for(var b= this;b&&b.get(0);){var c=b.data("scope");if(c)return c;b=b.parent()}return null};a.controller=function(){return this.data("controller")||R.Kb}}function Na(a){if(a.Gc=="console"&&!Q){Q=x.createElement("div");Q.id="ng-console";x.getElementsByTagName("body")[0].appendChild(Q);K=function(){ha("ng-console-info",arguments)};console.error=function(){ha("ng-console-error",arguments)}}}function ca(a,b){var c={};o(b,function(d,e){c[e]=_(d).bind(a)});return c}function Oa(a,b){var c=new ma(b.server,b.database), d=new w(a[0],c,g,b.location,b);d.sa.push(b.Nc);c=new S(a.find("body"),b.server,b.database);var e=b.database=="$MEMORY"?new da(p):new na(b.server,l.getScript);e=new oa(e,new Y(a.find("body")),function(){d.d()});var f=new pa(e,c),h="/data/"+b.database,g=new Z(function(k,q){e.P("POST",h,k,q)},f,d.anchor);d.l=g;d.sa.push(function(){g.V()});var i=new u({$anchor:d.anchor,$updateView:_(d.d).bind(d),$config:b,$invalidWidgets:[],$console:p.console,$datastore:ca(g,{load:g.load,loadMany:g.ma,loadOrCreate:g.Ka, loadAll:g.Ja,save:g.save,remove:g.remove,flush:g.V,query:g.Sa,entity:g.G,entities:g.entities,documentCountsByUser:g.zb,userDocumentIdsByEntity:g.sc,join:g.join}),$save:function(k){g.mc(i.k,k,d.anchor)},$window:p,$uid:function(){return""+(new Date).getTime()},$users:f},"ROOT");a.data("scope",i);d.G(i);d.compile();c.bind();(new z(a)).bind();var j=_(ca(i,{set:i.i,get:i.get,eval:i.eval})).extend({init:function(){b.location.listen(_(d.gc).bind(d));d.Pa();d.Eb();d.d();return j},element:a[0],updateView:_(d.d).bind(d), config:b});return j}function F(a,b,c){var d=_.last(b);o(c,function(e){d[e]=_[e]});m[a]=m[a]||{};o(b,function(e){B(m[a],e)})}function w(a,b,c,d,e){this.F=a;this.location=d;this.l=c;this.anchor={};this.xc=b;this.tb=e||{};this.sa=[]}function S(a,b,c){this.eb=a;this.ea=b;this.ka=c;this.ib=p;this.H=[]}function Z(a,b,c){this.post=a;this.Xa=b;this.K=[];this.ha={$collections:this.K};this.anchor=c;this.R=[]}function T(a,b){return{format:a,parse:b||a}}function qa(a){return""+a}function v(a,b){var c=[];ea(c, a,b?"\n ":null,_([]));return c.join("")}function L(a){try{var b=new D(a,true),c=b.ca();b.L();return c()}catch(d){ba("fromJson error: ",a,d);throw d;}}function ea(a,b,c,d){if(typeof b=="object"){if(d.include(b)){a.push("RECURSION");return}d.push(b)}var e=typeof b;if(b===null)a.push("null");else if(e==="function")return;else if(e==="boolean")a.push(""+b);else if(e==="number")isNaN(b)?a.push("null"):a.push(""+b);else if(e==="string")return a.push(m.String.quoteUnicode(b));else if(e==="object")if(b instanceof Array){a.push("[");var f=b.length;e=false;for(var h=0;h>2;c=(c&3)<<4|d>>4;h=(d&15)<<2|e>>6;g=e&63;if(isNaN(d))h=g=64;else if(isNaN(e))g=64;b=b+this.B.charAt(f)+this.B.charAt(c)+this.B.charAt(h)+this.B.charAt(g)}return b},Hc:function(a){var b="",c,d,e,f,h,g=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");g>4;d=(d&15)<<4|f>>2;e=(f&3)<<6|h;b+=String.fromCharCode(c);if(f!=64)b+=String.fromCharCode(d);if(h!=64)b+=String.fromCharCode(e)}return b=fa.gb(b)},hb:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c127&&d<2048)b+=String.fromCharCode(d>>6|192);else{b+=String.fromCharCode(d>>12|224);b+=String.fromCharCode(d>>6&63|128)}b+=String.fromCharCode(d&63|128)}}return b},gb:function(a){for(var b="",c=0,d=c1=c2=0;c< a.length;){d=a.charCodeAt(c);if(d<128){b+=String.fromCharCode(d);c++}else if(d>191&&d<224){c2=a.charCodeAt(c+1);b+=String.fromCharCode((d&31)<<6|c2&63);c+=2}else{c2=a.charCodeAt(c+1);c3=a.charCodeAt(c+2);b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63);c+=3}}return b}};if(typeof x.getAttribute=="undefined")x.getAttribute=J();if(typeof Node=="undefined")Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8, DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};p.console||(p.console={log:n,error:n});var Q,V,l=p.jQuery||p.$,o=_.each,B=_.extend,Fa=_.identity,m=p.angular||(p.angular={}),Ga=m.validator||(m.validator={}),s=m.filter||(m.filter={}),ga=m.formatter||(m.formatter={}),N=m.callbacks||(m.callbacks={});m.alert||(m.alert=function(){K(arguments);p.alert.apply(p,arguments)});var Ha=Ha||function(a){return l(a).is(":visible")};la.prototype={Pb:function(a){this.Ha=a},watch:function(){var a= this;function b(){if(a.N!==a.location.href){var c=a.location.hash.match(/^#\$iframe_notify=(.*)$/);if(c){a.N.match(/#/)||(a.N+="#");a.location.href=a.N;c="_iframe_notify_"+c[1];var d=N[c];delete N[c];try{(d||n)()}catch(e){alert(e)}}else{a.Ha(a.location.href);a.N=a.location.href}}a.setTimeout(b,a.delay)}b()},i:function(a){var b=this.location.href;b.match(/#/)||(b+="#");if(b!=a)this.location.href=a;this.Kc=a},get:function(){return p.location.href}};m.startUrlWatcher=function(){var a=new la(p.location); a.watch();return ca(a,{listen:a.Pb,set:a.i,get:a.get})};m.compile=function(a,b){l=p.jQuery;V=l.browser.msie;b=_({onUpdateView:n,server:"",location:{get:n,set:n,listen:n}}).extend(b||{});Na(b);Ma();return Oa(l(a),b)};var H={typeOf:function(a){if(a===null)return"null";var b=typeof a;if(b=="object"){if(a instanceof Array)return"array";if(a instanceof Date)return"date";if(a.nodeType==1)return"element"}return b}},aa={},Ia={includeIf:function(a,b,c){var d=_.indexOf(a,b);if(c)d==-1&&a.push(b);else a.splice(d, 1);return a},sum:function(a,b){b=m.Function.compile(b);for(var c=0,d=0;d=0&&a.splice(c,1);return b},find:function(a,b,c){if(b){var d=m.Function.compile(b);_.detect(a,function(e){if(d(e)){c=e;return true}});return c}},findById:function(a,b){return m.zc.find(a,function(c){return c.Za==b},null)},filter:function(a,b){var c=[];c.rb=function(j){for(var k=0;k-1;case "object":for(var q in j)if(q.charAt(0)!=="$"&&e(j[q],k))return true;return false;case "array":for(q=0;q=0&&a.splice(d,1);a.unshift((c?"-":"+")+b);return a},orderByDirection:function(a,b,c,d){c=c||"ng-ascend";d=d||"ng-descend";a=a[0]||"";var e=true;if(a.charAt(0)=="-"){a=a.substring(1);e=false}else if(a.charAt(0)=="+")a=a.substring(1);return a==b?e?c:d:""},merge:function(a, b,c){var d=a[b];if(!d){d={};a[b]=d}X(c,d);return a}},Pa={quote:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(a){a=m.String.quote(a);for(var b=[],c=0;c-1;){c1||w.M(a[0])!==null};w.M=function(a){return(a=a.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/))?a[1]:null};w.prototype={hc:function(a){var b={};a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(c,d,e){if(d)b[decodeURIComponent(d)]=decodeURIComponent(e)});return b},Pa:function(){var a=this,b=this.location.get()||"",c=b.indexOf("#");if(!(c<0)){b=this.hc(b.substring(c+1));o(a.anchor,function(d,e){delete a.anchor[e]});o(b,function(d,e){a.anchor[e]=d})}},gc:function(){this.Pa();this.d()},qc:function(){var a=this.location.get()||"",b=a.indexOf("#");if(b>-1)a=a.substring(0,b);a+="#";b="";for(var c in this.anchor){var d=this.anchor[c];if(typeof d==="undefined"||d===null)delete this.anchor[c]; else{a+=b+encodeURIComponent(c);if(d!==true)a+="="+encodeURIComponent(d);b="&"}}this.location.set(a);return a},d:function(){(new Date).getTime();var a=l(this.F).scope();a.sb();a.d();(new Date).getTime();this.qc();o(this.sa,function(b){b()})},T:function(a){var b=l(this.F),c=b.find(a);if(b.is(a))c=c.andSelf();return c},Eb:function(){this.T("[ng-init]").each(function(){var a=l(this),b=a.scope();try{b.eval(a.attr("ng-init"))}catch(c){alert("EVAL ERROR:\n"+a.attr("ng-init")+"\n"+v(c,true))}})},G:function(a){var b= this;this.T("[ng-entity]").attr("ng-watch",function(){try{var c=l(this);return a.G(c.attr("ng-entity"),b.l)+(c.attr("ng-watch")||"")}catch(d){K(d);alert(d)}})},compile:function(){var a=l(this.F);if(this.tb.autoSubmit){var b=this.T(":submit").not("[ng-action]");b.attr("ng-action","$save()");b.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr",'{disabled:"{{$invalidWidgets}}"}')}this.Qa(this.F)(this.F,a.scope(),"");this.T("a[ng-action]").live("click",function(){var c=l(this),d=c.scope();try{d.eval(c.attr("ng-action")); c.removeAttr("ng-error");c.removeClass("ng-exception")}catch(e){c.addClass("ng-exception");c.attr("ng-error",v(e,true))}d.get("$updateView")();return false})},pc:function(a,b,c){b=b.concat();var d=b.pop(),e=w.aa(a.nodeValue);if(e.length>1||w.M(e[0])){var f=a.parentNode;if(ia(f)){f.setAttribute("ng-bind-template",a.nodeValue);c.push({path:b,b:function(k){return new M(k,k.getAttribute("ng-bind-template"))}})}else for(var h=0;h2&&a.setAttribute("ng-bind-attr",d)}a.getAttribute||K(a);var j=a.getAttribute("ng-repeat");if(j){a.removeAttribute("ng-repeat");var k=this.Qa(a);d=x.createComment("ng-repeat: "+ j);e=a.parentNode;e.insertBefore(d,a);e.removeChild(a);function q(r,A,y){var I=l(a).clone();I.css("display","");I.attr("ng-repeat-index",""+y);I.data("scope",r);k(I[0],r,A+y+":");return I}c.push({path:b,b:function(r,A,y){return new Ea(l(r),j,q,y)}})}else{a.getAttribute("ng-eval")&&c.push({path:b,b:this.Zb});a.getAttribute("ng-bind")&&c.push({path:b,b:this.Oa});a.getAttribute("ng-bind-attr")&&c.push({path:b,b:this.Vb});a.getAttribute("ng-hide")&&c.push({path:b,b:this.$b});a.getAttribute("ng-show")&& c.push({path:b,b:this.ac});a.getAttribute("ng-class")&&c.push({path:b,b:this.Wb});a.getAttribute("ng-class-odd")&&c.push({path:b,b:this.Yb});a.getAttribute("ng-class-even")&&c.push({path:b,b:this.Xb});a.getAttribute("ng-style")&&c.push({path:b,b:this.bc});a.getAttribute("ng-watch")&&c.push({path:b,b:this.cc});d=a.nodeName;if(d=="INPUT"||d=="TEXTAREA"||d=="SELECT"||d=="BUTTON"){var O=this;c.push({path:b,b:function(r,A,y){r.name=y+r.name.split(":").pop();return O.xc.ub(l(r),A)}})}if(d=="OPTION")if(!l("')};B(U.prototype,{cancel:n,complete:n,httpStatus:function(a){alert("httpStatus:"+this.J+" status:"+a)},ioError:function(){alert("ioError:"+this.J)},open:function(){alert("open:"+this.J)},progress:n,securityError:function(){alert("securityError:"+this.J)},uploadCompleteData:function(a){a=L(a);a.url=this.ya+"/"+a.id+"/"+a.text;this.view.find("input").attr("checked", true);var b=this.view.scope();this.value=a;this.e(b);this.value=null},select:function(a,b){this.name=a;this.view.find("a").text(a).attr("href",a);this.view.find("span").text(m.filter.bytes(b));this.upload()},e:function(a){var b=this.view.find("input").attr("checked")?this.value:null;if(this.c===b)return false;else{a.i(this.J,b);return true}},d:function(a){if((a=a.get(this.J))&&this.value!==a){this.value=a;this.view.find("a").attr("href",this.value.url).text(this.value.text);this.view.find("span").text(m.filter.bytes(this.value.size))}this.view.find("input").attr("checked", !!a)},upload:function(){this.name&&this.rc.uploadFile(this.ya)}});R.prototype={e:P(true),d:n};R.Kb=new R;var Ra=R;ra.prototype={e:function(a){var b=this.A.parse(this.view.value);if(this.c===b)return false;else{a.q(this.exp,b);this.c=b;return true}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}c=c?c:"";if(!_(this.c).isEqual(c)){b.value=this.A.format(c);this.c=c}var d=false;b.removeAttribute("ng-error");if(this.lc)d=!(c&&$.trim(""+c).length>0); var e=d?"Required Value":null;if(!d&&this.Q&&c){e=a.uc(this.Q,c,b);d=!!e}if(this.Ga!==e){this.Ga=d;if(e&&Ha(b)){b.setAttribute("ng-error",e);a.Sb(this)}l(b).toggleClass("ng-validation-error",d)}}};sa.prototype={e:function(a){var b=this.view;b=b.checked?b.value:"";b=this.A.parse(b);b=this.A.format(b);if(this.c===b)return false;else{a.q(this.exp,this.A.parse(b));this.c=b;return true}},d:function(a){var b=this.view,c=a.eval(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}b.checked=this.A.parse(b.value)== c}};ta.prototype={e:function(a){if(this.view.selectedIndex<0)a.q(this.exp,null);else{var b=this.view.value;if(this.c===b)return false;else{a.q(this.exp,b);this.c=b;return true}}},d:function(a){var b=this.view,c=a.get(this.exp);if(typeof c==="undefined"){c=this.w;a.q(this.exp,c)}if(c!==this.c){b.value=c?c:"";this.c=c}}};ua.prototype={selected:function(){for(var a=[],b=this.view.options,c=0;cd;--b)this.children.pop().element.remove();if(g&&g.element[0].nodeName==="OPTION")if(d=l(g.element[0].parentNode).data("controller")){d.c=undefined;d.d(a)}})}};z.va="mouseleave mouseout click dblclick keypress keyup";z.fc=function(){z.pa();var a=l(this); a.bind(z.va,z.pa);var b=a.position(),c=x.documentElement,d=(self.innerWidth||c&&c.clientWidth||x.body.clientWidth)-b.left;c=a.hasClass("ng-exception")?"EXCEPTION:":"Validation error...";a=a.attr("ng-error");d=d>375?"left":"right";c=l("
"+c+"
"+a+"
");l("body").append(c);if(d==="left")a=b.left+this.offsetWidth+11;else{a=b.left-315;c.find(".ng-arrow-right").css({left:301})}c.css({left:a+ "px",top:b.top-3+"px"});return true};z.pa=function(){l("#ng-callout").unbind(z.va,z.pa).remove();return true};z.prototype={bind:function(){this.F.find(".ng-validation-error,.ng-exception").live("mouseover",z.fc)}};Y.$a='
loading....
';Y.prototype={qb:function(){if(this.da===0)(this.La=this.La||this.body.append(Y.$a).find("#ng-loading")).show();this.da++},Bb:function(){this.da--;this.da===0&&this.La.hide("fold")}}})(window,document);