diff --git a/index.html b/index.html index 54160a8..37c19c6 100644 --- a/index.html +++ b/index.html @@ -42,5 +42,10 @@ })(); + + + + + diff --git a/static/bmob-info.js b/static/bmob-info.js new file mode 100644 index 0000000..6e4ffd8 --- /dev/null +++ b/static/bmob-info.js @@ -0,0 +1,67 @@ +function getBrowserInfo() { + var agent = navigator.userAgent.toLowerCase(); + var arr = []; + var system = agent.split(' ')[1].split(' ')[0].split('(')[1]; + arr.push(system); + var regStr_edge = /edge\/[\d.]+/gi; + var regStr_ie = /trident\/[\d.]+/gi; + var regStr_ff = /firefox\/[\d.]+/gi; + var regStr_chrome = /chrome\/[\d.]+/gi; + var regStr_saf = /safari\/[\d.]+/gi; + var regStr_opera = /opr\/[\d.]+/gi; + //IE + if (agent.indexOf("trident") > 0) { + arr.push(agent.match(regStr_ie)[0].split('/')[0]); + arr.push(agent.match(regStr_ie)[0].split('/')[1]); + return arr; + } + //Edge + if (agent.indexOf('edge') > 0) { + arr.push(agent.match(regStr_edge)[0].split('/')[0]); + arr.push(agent.match(regStr_edge)[0].split('/')[1]); + return arr; + } + //firefox + if (agent.indexOf("firefox") > 0) { + arr.push(agent.match(regStr_ff)[0].split('/')[0]); + arr.push(agent.match(regStr_ff)[0].split('/')[1]); + return arr; + } + //Opera + if (agent.indexOf("opr") > 0) { + arr.push(agent.match(regStr_opera)[0].split('/')[0]); + arr.push(agent.match(regStr_opera)[0].split('/')[1]); + return arr; + } + //Safari + if (agent.indexOf("safari") > 0 && agent.indexOf("chrome") < 0) { + arr.push(agent.match(regStr_saf)[0].split('/')[0]); + arr.push(agent.match(regStr_saf)[0].split('/')[1]); + return arr; + } + //Chrome + if (agent.indexOf("chrome") > 0) { + arr.push(agent.match(regStr_chrome)[0].split('/')[0]); + arr.push(agent.match(regStr_chrome)[0].split('/')[1]); + return arr; + } else { + arr.push('请更换主流浏览器,例如chrome,firefox,opera,safari,IE,Edge!') + return arr; + } +} + +Bmob.initialize("d19fc452ebff91c7997a4ef3f3e7e7d8", "fee019e3f8acfb4ac43f9c22c4b74917"); +var GameScore = Bmob.Object.extend("GameScore"); +var gameScore = new GameScore(); +gameScore.set("sourcePage", window.location.href); +gameScore.set("cip", returnCitySN["cip"]); +gameScore.set("cname", returnCitySN["cname"]); +gameScore.set("system", getBrowserInfo()[0]); +gameScore.set("browse", getBrowserInfo()[1]); +gameScore.set("browseNum", getBrowserInfo()[2]); +gameScore.save(null, { + success: function (gameScore) { + }, + error: function (gameScore, error) { + } +}); diff --git a/static/bmob-min.js b/static/bmob-min.js new file mode 100644 index 0000000..c94c128 --- /dev/null +++ b/static/bmob-min.js @@ -0,0 +1,11 @@ +/* + * bmob JavaScript SDK + * http://www.bmob.cn + * Copyright Bmob, Inc. + * The Bmob JavaScript SDK is freely distributable under the MIT license. + * + * Includes: Underscore.js + * Copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. + * Released under the MIT license. + */ +(function(a){a.Bmob=a.Bmob||{};a.Bmob.VERSION="js0.0.1"}(this));(function(){var w=this;var k=w._;var D={};var C=Array.prototype,f=Object.prototype,r=Function.prototype;var G=C.push,o=C.slice,y=C.concat,d=f.toString,j=f.hasOwnProperty;var K=C.forEach,q=C.map,E=C.reduce,c=C.reduceRight,b=C.filter,B=C.every,p=C.some,n=C.indexOf,l=C.lastIndexOf,u=Array.isArray,e=Object.keys,F=r.bind;var L=function(M){if(M instanceof L){return M}if(!(this instanceof L)){return new L(M)}this._wrapped=M};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=L}exports._=L}else{w._=L}L.VERSION="1.4.4";var H=L.each=L.forEach=function(R,Q,P){if(R==null){return}if(K&&R.forEach===K){R.forEach(Q,P)}else{if(R.length===+R.length){for(var O=0,M=R.length;O2;if(Q==null){Q=[]}if(E&&Q.reduce===E){if(O){P=L.bind(P,O)}return N?Q.reduce(P,M):Q.reduce(P)}H(Q,function(T,R,S){if(!N){M=T;N=true}else{M=P.call(O,M,T,R,S)}});if(!N){throw new TypeError(g)}return M};L.reduceRight=L.foldr=function(S,P,M,O){var N=arguments.length>2;if(S==null){S=[]}if(c&&S.reduceRight===c){if(O){P=L.bind(P,O)}return N?S.reduceRight(P,M):S.reduceRight(P)}var R=S.length;if(R!==+R){var Q=L.keys(S);R=Q.length}H(S,function(V,T,U){T=Q?Q[--R]:--R;if(!N){M=S[T];N=true}else{M=P.call(O,M,S[T],T,U)}});if(!N){throw new TypeError(g)}return M};L.find=L.detect=function(P,O,N){var M;A(P,function(S,Q,R){if(O.call(N,S,Q,R)){M=S;return true}});return M};L.filter=L.select=function(P,O,N){var M=[];if(P==null){return M}if(b&&P.filter===b){return P.filter(O,N)}H(P,function(S,Q,R){if(O.call(N,S,Q,R)){M[M.length]=S}});return M};L.reject=function(O,N,M){return L.filter(O,function(R,P,Q){return !N.call(M,R,P,Q)},M)};L.every=L.all=function(P,O,N){O||(O=L.identity);var M=true;if(P==null){return M}if(B&&P.every===B){return P.every(O,N)}H(P,function(S,Q,R){if(!(M=M&&O.call(N,S,Q,R))){return D}});return !!M};var A=L.some=L.any=function(P,O,N){O||(O=L.identity);var M=false;if(P==null){return M}if(p&&P.some===p){return P.some(O,N)}H(P,function(S,Q,R){if(M||(M=O.call(N,S,Q,R))){return D}});return !!M};L.contains=L.include=function(N,M){if(N==null){return false}if(n&&N.indexOf===n){return N.indexOf(M)!=-1}return A(N,function(O){return O===M})};L.invoke=function(O,P){var M=o.call(arguments,2);var N=L.isFunction(P);return L.map(O,function(Q){return(N?P:Q[P]).apply(Q,M)})};L.pluck=function(N,M){return L.map(N,function(O){return O[M]})};L.where=function(N,M,O){if(L.isEmpty(M)){return O?null:[]}return L[O?"find":"filter"](N,function(Q){for(var P in M){if(M[P]!==Q[P]){return false}}return true})};L.findWhere=function(N,M){return L.where(N,M,true)};L.max=function(P,O,N){if(!O&&L.isArray(P)&&P[0]===+P[0]&&P.length<65535){return Math.max.apply(Math,P)}if(!O&&L.isEmpty(P)){return -Infinity}var M={computed:-Infinity,value:-Infinity};H(P,function(T,Q,S){var R=O?O.call(N,T,Q,S):T;R>=M.computed&&(M={value:T,computed:R})});return M.value};L.min=function(P,O,N){if(!O&&L.isArray(P)&&P[0]===+P[0]&&P.length<65535){return Math.min.apply(Math,P)}if(!O&&L.isEmpty(P)){return Infinity}var M={computed:Infinity,value:Infinity};H(P,function(T,Q,S){var R=O?O.call(N,T,Q,S):T;RQ||R===void 0){return 1}if(R>>1;P.call(O,T[N])=0})})};L.difference=function(N){var M=y.apply(C,o.call(arguments,1));return L.filter(N,function(O){return !L.contains(M,O)})};L.zip=function(){var M=o.call(arguments);var P=L.max(L.pluck(M,"length"));var O=new Array(P);for(var N=0;N=0;O--){N=[M[O].apply(this,N)]}return N[0]}};L.after=function(N,M){if(N<=0){return M()}return function(){if(--N<1){return M.apply(this,arguments)}}};L.keys=e||function(O){if(O!==Object(O)){throw new TypeError("Invalid object")}var N=[];for(var M in O){if(L.has(O,M)){N[N.length]=M}}return N};L.values=function(O){var M=[];for(var N in O){if(L.has(O,N)){M.push(O[N])}}return M};L.pairs=function(O){var N=[];for(var M in O){if(L.has(O,M)){N.push([M,O[M]])}}return N};L.invert=function(O){var M={};for(var N in O){if(L.has(O,N)){M[O[N]]=N}}return M};L.functions=L.methods=function(O){var N=[];for(var M in O){if(L.isFunction(O[M])){N.push(M)}}return N.sort()};L.extend=function(M){H(o.call(arguments,1),function(N){if(N){for(var O in N){M[O]=N[O]}}});return M};L.pick=function(N){var O={};var M=y.apply(C,o.call(arguments,1));H(M,function(P){if(P in N){O[P]=N[P]}});return O};L.omit=function(O){var P={};var N=y.apply(C,o.call(arguments,1));for(var M in O){if(!L.contains(N,M)){P[M]=O[M]}}return P};L.defaults=function(M){H(o.call(arguments,1),function(N){if(N){for(var O in N){if(M[O]==null){M[O]=N[O]}}}});return M};L.clone=function(M){if(!L.isObject(M)){return M}return L.isArray(M)?M.slice():L.extend({},M)};L.tap=function(N,M){M(N);return N};var I=function(T,S,N,O){if(T===S){return T!==0||1/T==1/S}if(T==null||S==null){return T===S}if(T instanceof L){T=T._wrapped}if(S instanceof L){S=S._wrapped}var Q=d.call(T);if(Q!=d.call(S)){return false}switch(Q){case"[object String]":return T==String(S);case"[object Number]":return T!=+T?S!=+S:(T==0?1/T==1/S:T==+S);case"[object Date]":case"[object Boolean]":return +T==+S;case"[object RegExp]":return T.source==S.source&&T.global==S.global&&T.multiline==S.multiline&&T.ignoreCase==S.ignoreCase}if(typeof T!="object"||typeof S!="object"){return false}var M=N.length;while(M--){if(N[M]==T){return O[M]==S}}N.push(T);O.push(S);var V=0,W=true;if(Q=="[object Array]"){V=T.length;W=V==S.length;if(W){while(V--){if(!(W=I(T[V],S[V],N,O))){break}}}}else{var R=T.constructor,P=S.constructor;if(R!==P&&!(L.isFunction(R)&&(R instanceof R)&&L.isFunction(P)&&(P instanceof P))){return false}for(var U in T){if(L.has(T,U)){V++;if(!(W=L.has(S,U)&&I(T[U],S[U],N,O))){break}}}if(W){for(U in S){if(L.has(S,U)&&!(V--)){break}}W=!V}}N.pop();O.pop();return W};L.isEqual=function(N,M){return I(N,M,[],[])};L.isEmpty=function(N){if(N==null){return true}if(L.isArray(N)||L.isString(N)){return N.length===0}for(var M in N){if(L.has(N,M)){return false}}return true};L.isElement=function(M){return !!(M&&M.nodeType===1)};L.isArray=u||function(M){return d.call(M)=="[object Array]"};L.isObject=function(M){return M===Object(M)};H(["Arguments","Function","String","Number","Date","RegExp"],function(M){L["is"+M]=function(N){return d.call(N)=="[object "+M+"]"}});if(!L.isArguments(arguments)){L.isArguments=function(M){return !!(M&&L.has(M,"callee"))}}if(typeof(/./)!=="function"){L.isFunction=function(M){return typeof M==="function"}}L.isFinite=function(M){return isFinite(M)&&!isNaN(parseFloat(M))};L.isNaN=function(M){return L.isNumber(M)&&M!=+M};L.isBoolean=function(M){return M===true||M===false||d.call(M)=="[object Boolean]"};L.isNull=function(M){return M===null};L.isUndefined=function(M){return M===void 0};L.has=function(N,M){return j.call(N,M)};L.noConflict=function(){w._=k;return this};L.identity=function(M){return M};L.times=function(Q,P,O){var M=Array(Q);for(var N=0;N":">",'"':""","'":"'","/":"/"}};m.unescape=L.invert(m.escape);var J={escape:new RegExp("["+L.keys(m.escape).join("")+"]","g"),unescape:new RegExp("("+L.keys(m.unescape).join("|")+")","g")};L.each(["escape","unescape"],function(M){L[M]=function(N){if(N==null){return""}return(""+N).replace(J[M],function(O){return m[M][O]})}});L.result=function(M,O){if(M==null){return null}var N=M[O];return L.isFunction(N)?N.call(M):N};L.mixin=function(M){H(L.functions(M),function(N){var O=L[N]=M[N];L.prototype[N]=function(){var P=[this._wrapped];G.apply(P,arguments);return s.call(this,O.apply(L,P))}})};var z=0;L.uniqueId=function(M){var N=++z+"";return M?M+N:N};L.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var v=/(.)^/;var h={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"};var i=/\\|'|\r|\n|\t|\u2028|\u2029/g;L.template=function(U,P,O){var N;O=L.defaults({},O,L.templateSettings);var Q=new RegExp([(O.escape||v).source,(O.interpolate||v).source,(O.evaluate||v).source].join("|")+"|$","g");var R=0;var M="__p+='";U.replace(Q,function(W,X,V,Z,Y){M+=U.slice(R,Y).replace(i,function(aa){return"\\"+h[aa]});if(X){M+="'+\n((__t=("+X+"))==null?'':_.escape(__t))+\n'"}if(V){M+="'+\n((__t=("+V+"))==null?'':__t)+\n'"}if(Z){M+="';\n"+Z+"\n__p+='"}R=Y+W.length;return W});M+="';\n";if(!O.variable){M="with(obj||{}){\n"+M+"}\n"}M="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+M+"return __p;\n";try{N=new Function(O.variable||"obj","_",M)}catch(S){S.source=M;throw S}if(P){return N(P,L)}var T=function(V){return N.call(this,V,L)};T.source="function("+(O.variable||"obj")+"){\n"+M+"}";return T};L.chain=function(M){return L(M).chain()};var s=function(M){return this._chain?L(M).chain():M};L.mixin(L);H(["pop","push","reverse","shift","sort","splice","unshift"],function(M){var N=C[M];L.prototype[M]=function(){var O=this._wrapped;N.apply(O,arguments);if((M=="shift"||M=="splice")&&O.length===0){delete O[0]}return s.call(this,O)}});H(["concat","join","slice"],function(M){var N=C[M];L.prototype[M]=function(){return s.call(this,N.apply(this._wrapped,arguments))}});L.extend(L.prototype,{chain:function(){this._chain=true;return this},value:function(){return this._wrapped}})}).call(this);(function(a){a.Bmob=a.Bmob||{};var d=a.Bmob;if(typeof(exports)!=="undefined"&&exports._){d._=exports._.noConflict();try{d.localStorage=require("localStorage")}catch(b){d.localStorage=require("./localStorage.js").localStorage}d.XMLHttpRequest=require("xmlhttprequest").XMLHttpRequest;exports.Bmob=d}else{d._=_.noConflict();if(typeof(localStorage)!=="undefined"){d.localStorage=localStorage}if(typeof(XMLHttpRequest)!=="undefined"){d.XMLHttpRequest=XMLHttpRequest}}if(typeof($)!=="undefined"){d.$=$}var c=function(){};var e=function(g,f,h){var i;if(f&&f.hasOwnProperty("constructor")){i=f.constructor}else{i=function(){g.apply(this,arguments)}}d._.extend(i,g);c.prototype=g.prototype;i.prototype=new c();if(f){d._.extend(i.prototype,f)}if(h){d._.extend(i,h)}i.prototype.constructor=i;i.__super__=g.prototype;return i};d.serverURL="https://api.bmob.cn";d.fileURL="http://file.bmob.cn";if(typeof(process)!=="undefined"&&process.versions&&process.versions.node){d._isNode=true}d.initialize=function(h,g,f){d._initialize(h,g,f)};d._initialize=function(h,g,f){d.applicationId=h;d.applicationKey=g;d.masterKey=f;d._useMasterKey=true};if(d._isNode){d.initialize=d._initialize}d._getBmobPath=function(f){if(!d.applicationId){throw"You need to call Bmob.initialize before using Bmob."}if(!f){f=""}if(!d._.isString(f)){throw"Tried to get a localStorage path that wasn't a String."}if(f[0]==="/"){f=f.substring(1)}return"Bmob/"+d.applicationId+"/"+f};d._installationId=null;d._getInstallationId=function(){if(d._installationId){return d._installationId}var g=d._getBmobPath("installationId");d._installationId=d.localStorage.getItem(g);if(!d._installationId||d._installationId===""){var f=function(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)};d._installationId=(f()+f()+"-"+f()+"-"+f()+"-"+f()+"-"+f()+f()+f());d.localStorage.setItem(g,d._installationId)}return d._installationId};d._parseDate=function(o){var l=new RegExp("^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})(.([0-9]+))?Z$");var j=l.exec(o);if(!j){return null}var m=j[1]||0;var k=(j[2]||1)-1;var n=j[3]||0;var h=j[4]||0;var g=j[5]||0;var f=j[6]||0;var i=j[8]||0;return new Date(Date.UTC(m,k,n,h,g,f,i))};d._ajaxIE8=function(j,g,h){var i=new d.Promise();var f=new XDomainRequest();f.onload=function(){var k;try{k=JSON.parse(f.responseText)}catch(l){i.reject(l)}if(k){i.resolve(k)}};f.onerror=f.ontimeout=function(){i.reject(f)};f.onprogress=function(){};f.open(j,g);f.send(h);return i};d._ajax=function(f,g,h,k,j){var n={success:k,error:j};if(typeof(XDomainRequest)!=="undefined"){return d._ajaxIE8(f,g,h)._thenRunCallbacks(n)}var m=new d.Promise();var i=false;var l=new d.XMLHttpRequest();l.onreadystatechange=function(){if(l.readyState===4){if(i){return}i=true;var p;try{p=JSON.parse(l.responseText)}catch(q){}if(l.status==200&&p&&p.code&&p.error){l.status=400;m.reject(l)}else{if(l.status>=200&&l.status<300){var o;try{o=JSON.parse(l.responseText)}catch(q){m.reject(q)}if(o){m.resolve(o,l.status,l)}}}}};l.open(f,g,true);l.setRequestHeader("Content-Type","text/plain");if(d._isNode){l.setRequestHeader("User-Agent","Bmob/"+d.VERSION+" (NodeJS "+process.versions.node+")")}l.send(h);return m._thenRunCallbacks(n)};d._extend=function(f,g){var h=e(this,f,g);h.extend=this.extend;return h};d._request=function(h,k,g,m,j){if(!d.applicationId){throw"You must specify your applicationId using Bmob.initialize"}if(!d.applicationKey&&!d.masterKey){throw"You must specify a key using Bmob.initialize"}var i=d.serverURL;if(i.charAt(i.length-1)!=="/"){i+="/"}if(h.indexOf("2/")<0){i+="1/"+h}else{i+=h}if(k){i+="/"+k}if(g){i+="/"+g}if((h==="users"||h==="classes")&&m==="PUT"&&j._fetchWhenSave){delete j._fetchWhenSave;i+="?new=true"}j=d._.clone(j||{});if(m!=="POST"){j._Method=m;m="POST"}j._ApplicationId=d.applicationId;j._RestKey=d.applicationKey;if(d._useMasterKey&&d.masterKey!=undefined){j._MasterKey=d.masterKey}j._ClientVersion=d.VERSION;j._InstallationId=d._getInstallationId();var f=d.User.current();if(f&&f._sessionToken){j._SessionToken=f._sessionToken}var l=JSON.stringify(j);return d._ajax(m,i,l).then(null,function(n){var p;if(n&&n.responseText){try{var o=JSON.parse(n.responseText);if(o){p=new d.Error(o.code,o.error)}}catch(q){}}p=p||new d.Error(-1,n.responseText);return d.Promise.error(p)})};d._getValue=function(f,g){if(!(f&&f[g])){return null}return d._.isFunction(f[g])?f[g]():f[g]};d._encode=function(j,i,h){var g=d._;if(j instanceof d.Object){if(h){throw"Bmob.Objects not allowed here"}if(!i||g.include(i,j)||!j._hasData){return j._toPointer()}if(!j.dirty()){i=i.concat(j);return d._encode(j._toFullJSON(i),i,h)}throw"Tried to save an object with a pointer to a new, unsaved object."}if(j instanceof d.ACL){return j.toJSON()}if(g.isDate(j)){return{__type:"Date",iso:j.toJSON()}}if(j instanceof d.GeoPoint){return j.toJSON()}if(g.isArray(j)){return g.map(j,function(k){return d._encode(k,i,h)})}if(g.isRegExp(j)){return j.source}if(j instanceof d.Relation){return j.toJSON()}if(j instanceof d.Op){return j.toJSON()}if(j instanceof d.File){if(!j.url()){throw"Tried to save an object containing an unsaved file."}return{__type:"File",cdn:j.cdn(),filename:j.name(),url:j.url()}}if(g.isObject(j)){var f={};d._objectEach(j,function(m,l){f[l]=d._encode(m,i,h)});return f}return j};d._decode=function(i,l){var g=d._;if(!g.isObject(l)){return l}if(g.isArray(l)){d._arrayEach(l,function(o,n){l[n]=d._decode(n,o)});return l}if(l instanceof d.Object){return l}if(l instanceof d.File){return l}if(l instanceof d.Op){return l}if(l.__op){return d.Op._decode(l)}if(l.__type==="Pointer"){var j=l.className;var m=d.Object._create(j);if(l.createdAt){delete l.__type;delete l.className;m._finishFetch(l,true)}else{m._finishFetch({objectId:l.objectId},false)}return m}if(l.__type==="Object"){var j=l.className;delete l.__type;delete l.className;var f=d.Object._create(j);f._finishFetch(l,true);return f}if(l.__type==="Date"){return l.iso}if(l.__type==="GeoPoint"){return new d.GeoPoint({latitude:l.latitude,longitude:l.longitude})}if(i==="ACL"){if(l instanceof d.ACL){return l}return new d.ACL(l)}if(l.__type==="Relation"){var k=new d.Relation(null,i);k.targetClassName=l.className;return k}if(l.__type==="File"){if(l.url!=undefined&&l.url!=null){if(l.url.indexOf("http")>=0){var h={_name:l.filename,_url:l.url,_group:l.group}}else{var h={_name:l.filename,_url:d.fileURL+"/"+l.url,_group:l.group}}}else{var h={_name:l.filename,_url:l.url,_group:l.group}}return h}d._objectEach(l,function(o,n){l[n]=d._decode(n,o)});return l};d._arrayEach=d._.each;d._traverse=function(g,h,f){if(g instanceof d.Object){f=f||[];if(d._.indexOf(f,g)>=0){return}f.push(g);d._traverse(g.attributes,h,f);return h(g)}if(g instanceof d.Relation||g instanceof d.File){return h(g)}if(d._.isArray(g)){d._.each(g,function(k,j){var i=d._traverse(k,h,f);if(i){g[j]=i}});return h(g)}if(d._.isObject(g)){d._each(g,function(k,j){var i=d._traverse(k,h,f);if(i){g[j]=i}});return h(g)}return h(g)};d._objectEach=d._each=function(g,h){var f=d._;if(f.isObject(g)){f.each(f.keys(g),function(i){h(g[i],i)})}else{f.each(g,h)}};d._isNullOrUndefined=function(f){return d._.isNull(f)||d._.isUndefined(f)}}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Error=function(e,d){this.code=e;this.message=d};b.extend(c.Error,{OTHER_CAUSE:-1,OBJECT_NOT_FOUND:101,INVALID_QUERY:102,INVALID_CLASS_NAME:103,RELATIONDOCNOTEXISTS:104,INVALID_KEY_NAME:105,INVALID_POINTER:106,INVALID_JSON:107,USERNAME_PASSWORD_REQUIRED:108,INCORRECT_TYPE:111,REQUEST_MUST_ARRAY:112,REQUEST_MUST_OBJECT:113,OBJECT_TOO_LARGE:114,GEO_ERROR:117,EMAIL_VERIFY_MUST_OPEN:120,CACHE_MISS:120,INVALID_DEVICE_TOKEN:131,INVALID_INSTALLID:132,INVALID_DEVICE_TYPE:133,DEVICE_TOKEN_EXIST:134,INSTALLID_EXIST:135,DEVICE_TOKEN_NOT_FOR_ANDROID:136,INVALID_INSTALL_OPERATE:137,READ_ONLY:138,INVALID_ROLE_NAME:139,MISS_PUSH_DATA:141,INVALID_PUSH_TIME:142,INVALID_PUSH_EXPIRE:143,PUSH_TIME_MUST_BEFORE_NOW:144,FILE_SIZE_ERROR:145,FILE_NAME_ERROR:146,FILE_NAME_ERROR:147,FILE_LEN_ERROR:148,FILE_UPLOAD_ERROR:150,FILE_DELETE_ERROR:151,IMAGE_ERROR:160,IMAGE_MODE_ERROR:161,IMAGE_WIDTH_ERROR:162,IMAGE_HEIGHT_ERROR:163,IMAGE_LONGEDGE_ERROR:164,IMAGE_SHORTEDGE_ERROR:165,USER_MISSING:201,USER_NAME_TOKEN:202,EMAIL_EXIST:203,NO_EMAIL:204,NOT_FOUND_EMAIL:205,SESSIONTOKEN_ERROR:206,VALID_ERROR:301})}(this));(function(){var a=this;var c=(a.Bmob||(a.Bmob={}));var b=/\s+/;var d=Array.prototype.slice;c.Events={on:function(h,l,g){var f,j,i,e,k;if(!l){return this}h=h.split(b);f=this._callbacks||(this._callbacks={});j=h.shift();while(j){k=f[j];i=k?k.tail:{};i.next=e={};i.context=g;i.callback=l;f[j]={tail:e,next:k?k.next:i};j=h.shift()}return this},off:function(l,j,f){var e,m,g,i,h,k;if(!(m=this._callbacks)){return}if(!(l||j||f)){delete this._callbacks;return this}l=l?l.split(b):_.keys(m);e=l.shift();while(e){g=m[e];delete m[e];if(!g||!(j||f)){continue}i=g.tail;g=g.next;while(g!==i){h=g.callback;k=g.context;if((j&&h!==j)||(f&&k!==f)){this.on(e,h,k)}g=g.next}e=l.shift()}return this},trigger:function(h){var l,k,g,f,e,j,i;if(!(g=this._callbacks)){return this}j=g.all;h=h.split(b);i=d.call(arguments,1);l=h.shift();while(l){k=g[l];if(k){f=k.tail;while((k=k.next)!==f){k.callback.apply(k.context||this,i)}}k=j;if(k){f=k.tail;e=[l].concat(i);while((k=k.next)!==f){k.callback.apply(k.context||this,e)}}l=h.shift()}return this}};c.Events.bind=c.Events.on;c.Events.unbind=c.Events.off}.call(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.GeoPoint=function(f,e){if(b.isArray(f)){c.GeoPoint._validate(f[0],f[1]);this.latitude=f[0];this.longitude=f[1]}else{if(b.isObject(f)){c.GeoPoint._validate(f.latitude,f.longitude);this.latitude=f.latitude;this.longitude=f.longitude}else{if(b.isNumber(f)&&b.isNumber(e)){c.GeoPoint._validate(f,e);this.latitude=f;this.longitude=e}else{this.latitude=0;this.longitude=0}}}var d=this;if(this.__defineGetter__&&this.__defineSetter__){this._latitude=this.latitude;this._longitude=this.longitude;this.__defineGetter__("latitude",function(){return d._latitude});this.__defineGetter__("longitude",function(){return d._longitude});this.__defineSetter__("latitude",function(g){c.GeoPoint._validate(g,d.longitude);d._latitude=g});this.__defineSetter__("longitude",function(g){c.GeoPoint._validate(d.latitude,g);d._longitude=g})}};c.GeoPoint._validate=function(e,d){if(e<-90){throw"Bmob.GeoPoint latitude "+e+" < -90.0."}if(e>90){throw"Bmob.GeoPoint latitude "+e+" > 90.0."}if(d<-180){throw"Bmob.GeoPoint longitude "+d+" < -180.0."}if(d>180){throw"Bmob.GeoPoint longitude "+d+" > 180.0."}};c.GeoPoint.current=function(d){var e=new c.Promise();navigator.geolocation.getCurrentPosition(function(f){e.resolve(new c.GeoPoint({latitude:f.coords.latitude,longitude:f.coords.longitude}))},function(f){e.reject(f)});return e._thenRunCallbacks(d)};c.GeoPoint.prototype={toJSON:function(){c.GeoPoint._validate(this.latitude,this.longitude);return{__type:"GeoPoint",latitude:this.latitude,longitude:this.longitude}},radiansTo:function(n){var h=Math.PI/180;var d=this.latitude*h;var j=this.longitude*h;var m=n.latitude*h;var g=n.longitude*h;var f=d-m;var i=j-g;var e=Math.sin(f/2);var k=Math.sin(i/2);var l=((e*e)+(Math.cos(d)*Math.cos(m)*k*k));l=Math.min(1,l);return 2*Math.asin(Math.sqrt(l))},kilometersTo:function(d){return this.radiansTo(d)*6371},milesTo:function(d){return this.radiansTo(d)*3958.8}}}(this));(function(a){a.Bmob=a.Bmob||{};var d=a.Bmob;var c=d._;var b="*";d.ACL=function(f){var e=this;e.permissionsById={};if(c.isObject(f)){if(f instanceof d.User){e.setReadAccess(f,true);e.setWriteAccess(f,true)}else{if(c.isFunction(f)){throw"Bmob.ACL() called with a function. Did you forget ()?"}d._objectEach(f,function(h,g){if(!c.isString(g)){throw"Tried to create an ACL with an invalid userId."}e.permissionsById[g]={};d._objectEach(h,function(j,i){if(i!=="read"&&i!=="write"){throw"Tried to create an ACL with an invalid permission type."}if(!c.isBoolean(j)){throw"Tried to create an ACL with an invalid permission value."}e.permissionsById[g][i]=j})})}}};d.ACL.prototype.toJSON=function(){return c.clone(this.permissionsById)};d.ACL.prototype._setAccess=function(e,f,h){if(f instanceof d.User){f=f.id}else{if(f instanceof d.Role){f="role:"+f.getName()}}if(!c.isString(f)){throw"userId must be a string."}if(!c.isBoolean(h)){throw"allowed must be either true or false."}var g=this.permissionsById[f];if(!g){if(!h){return}else{g={};this.permissionsById[f]=g}}if(h){this.permissionsById[f][e]=true}else{delete g[e];if(c.isEmpty(g)){delete g[f]}}};d.ACL.prototype._getAccess=function(e,f){if(f instanceof d.User){f=f.id}else{if(f instanceof d.Role){f="role:"+f.getName()}}var g=this.permissionsById[f];if(!g){return false}return g[e]?true:false};d.ACL.prototype.setReadAccess=function(e,f){this._setAccess("read",e,f)};d.ACL.prototype.getReadAccess=function(e){return this._getAccess("read",e)};d.ACL.prototype.setWriteAccess=function(e,f){this._setAccess("write",e,f)};d.ACL.prototype.getWriteAccess=function(e){return this._getAccess("write",e)};d.ACL.prototype.setPublicReadAccess=function(e){this.setReadAccess(b,e)};d.ACL.prototype.getPublicReadAccess=function(){return this.getReadAccess(b)};d.ACL.prototype.setPublicWriteAccess=function(e){this.setWriteAccess(b,e)};d.ACL.prototype.getPublicWriteAccess=function(){return this.getWriteAccess(b)};d.ACL.prototype.getRoleReadAccess=function(e){if(e instanceof d.Role){e=e.getName()}if(c.isString(e)){return this.getReadAccess("role:"+e)}throw"role must be a Bmob.Role or a String"};d.ACL.prototype.getRoleWriteAccess=function(e){if(e instanceof d.Role){e=e.getName()}if(c.isString(e)){return this.getWriteAccess("role:"+e)}throw"role must be a Bmob.Role or a String"};d.ACL.prototype.setRoleReadAccess=function(f,e){if(f instanceof d.Role){f=f.getName()}if(c.isString(f)){this.setReadAccess("role:"+f,e);return}throw"role must be a Bmob.Role or a String"};d.ACL.prototype.setRoleWriteAccess=function(f,e){if(f instanceof d.Role){f=f.getName()}if(c.isString(f)){this.setWriteAccess("role:"+f,e);return}throw"role must be a Bmob.Role or a String"}}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Op=function(){this._initialize.apply(this,arguments)};c.Op.prototype={_initialize:function(){}};b.extend(c.Op,{_extend:c._extend,_opDecoderMap:{},_registerDecoder:function(d,e){c.Op._opDecoderMap[d]=e},_decode:function(d){var e=c.Op._opDecoderMap[d.__op];if(e){return e(d)}else{return undefined}}});c.Op._registerDecoder("Batch",function(d){var e=null;c._arrayEach(d.ops,function(f){f=c.Op._decode(f);e=f._mergeWithPrevious(e)});return e});c.Op.Set=c.Op._extend({_initialize:function(d){this._value=d},value:function(){return this._value},toJSON:function(){return c._encode(this.value())},_mergeWithPrevious:function(d){return this},_estimate:function(d){return this.value()}});c.Op._UNSET={};c.Op.Unset=c.Op._extend({toJSON:function(){return{__op:"Delete"}},_mergeWithPrevious:function(d){return this},_estimate:function(d){return c.Op._UNSET}});c.Op._registerDecoder("Delete",function(d){return new c.Op.Unset()});c.Op.Increment=c.Op._extend({_initialize:function(d){this._amount=d},amount:function(){return this._amount},toJSON:function(){return{__op:"Increment",amount:this._amount}},_mergeWithPrevious:function(d){if(!d){return this}else{if(d instanceof c.Op.Unset){return new c.Op.Set(this.amount())}else{if(d instanceof c.Op.Set){return new c.Op.Set(d.value()+this.amount())}else{if(d instanceof c.Op.Increment){return new c.Op.Increment(this.amount()+d.amount())}else{throw"Op is invalid after previous op."}}}}},_estimate:function(d){if(!d){return this.amount()}return d+this.amount()}});c.Op._registerDecoder("Increment",function(d){return new c.Op.Increment(d.amount)});c.Op.Add=c.Op._extend({_initialize:function(d){this._objects=d},objects:function(){return this._objects},toJSON:function(){return{__op:"Add",objects:c._encode(this.objects())}},_mergeWithPrevious:function(d){if(!d){return this}else{if(d instanceof c.Op.Unset){return new c.Op.Set(this.objects())}else{if(d instanceof c.Op.Set){return new c.Op.Set(this._estimate(d.value()))}else{if(d instanceof c.Op.Add){return new c.Op.Add(d.objects().concat(this.objects()))}else{throw"Op is invalid after previous op."}}}}},_estimate:function(d){if(!d){return b.clone(this.objects())}else{return d.concat(this.objects())}}});c.Op._registerDecoder("Add",function(d){return new c.Op.Add(c._decode(undefined,d.objects))});c.Op.AddUnique=c.Op._extend({_initialize:function(d){this._objects=b.uniq(d)},objects:function(){return this._objects},toJSON:function(){return{__op:"AddUnique",objects:c._encode(this.objects())}},_mergeWithPrevious:function(d){if(!d){return this}else{if(d instanceof c.Op.Unset){return new c.Op.Set(this.objects())}else{if(d instanceof c.Op.Set){return new c.Op.Set(this._estimate(d.value()))}else{if(d instanceof c.Op.AddUnique){return new c.Op.AddUnique(this._estimate(d.objects()))}else{throw"Op is invalid after previous op."}}}}},_estimate:function(d){if(!d){return b.clone(this.objects())}else{var e=b.clone(d);c._arrayEach(this.objects(),function(h){if(h instanceof c.Object&&h.id){var g=b.find(e,function(i){return(i instanceof c.Object)&&(i.id===h.id)});if(!g){e.push(h)}else{var f=b.indexOf(e,g);e[f]=h}}else{if(!b.contains(e,h)){e.push(h)}}});return e}}});c.Op._registerDecoder("AddUnique",function(d){return new c.Op.AddUnique(c._decode(undefined,d.objects))});c.Op.Remove=c.Op._extend({_initialize:function(d){this._objects=b.uniq(d)},objects:function(){return this._objects},toJSON:function(){return{__op:"Remove",objects:c._encode(this.objects())}},_mergeWithPrevious:function(d){if(!d){return this}else{if(d instanceof c.Op.Unset){return d}else{if(d instanceof c.Op.Set){return new c.Op.Set(this._estimate(d.value()))}else{if(d instanceof c.Op.Remove){return new c.Op.Remove(b.union(d.objects(),this.objects()))}else{throw"Op is invalid after previous op."}}}}},_estimate:function(d){if(!d){return[]}else{var e=b.difference(d,this.objects());c._arrayEach(this.objects(),function(f){if(f instanceof c.Object&&f.id){e=b.reject(e,function(g){return(g instanceof c.Object)&&(g.id===f.id)})}});return e}}});c.Op._registerDecoder("Remove",function(d){return new c.Op.Remove(c._decode(undefined,d.objects))});c.Op.Relation=c.Op._extend({_initialize:function(g,e){this._targetClassName=null;var d=this;var f=function(h){if(h instanceof c.Object){if(!h.id){throw"You can't add an unsaved Bmob.Object to a relation."}if(!d._targetClassName){d._targetClassName=h.className}if(d._targetClassName!==h.className){throw"Tried to create a Bmob.Relation with 2 different types: "+d._targetClassName+" and "+h.className+"."}return h.id}return h};this.relationsToAdd=b.uniq(b.map(g,f));this.relationsToRemove=b.uniq(b.map(e,f))},added:function(){var d=this;return b.map(this.relationsToAdd,function(e){var f=c.Object._create(d._targetClassName);f.id=e;return f})},removed:function(){var d=this;return b.map(this.relationsToRemove,function(e){var f=c.Object._create(d._targetClassName);f.id=e;return f})},toJSON:function(){var h=null;var f=null;var e=this;var g=function(i){return{__type:"Pointer",className:e._targetClassName,objectId:i}};var d=null;if(this.relationsToAdd.length>0){d=b.map(this.relationsToAdd,g);h={__op:"AddRelation",objects:d}}if(this.relationsToRemove.length>0){d=b.map(this.relationsToRemove,g);f={__op:"RemoveRelation",objects:d}}if(h&&f){return{__op:"Batch",ops:[h,f]}}return h||f||{}},_mergeWithPrevious:function(g){if(!g){return this}else{if(g instanceof c.Op.Unset){throw"You can't modify a relation after deleting it."}else{if(g instanceof c.Op.Relation){if(g._targetClassName&&g._targetClassName!==this._targetClassName){throw"Related object must be of class "+g._targetClassName+", but "+this._targetClassName+" was passed in."}var f=b.union(b.difference(g.relationsToAdd,this.relationsToRemove),this.relationsToAdd);var e=b.union(b.difference(g.relationsToRemove,this.relationsToAdd),this.relationsToRemove);var d=new c.Op.Relation(f,e);d._targetClassName=this._targetClassName;return d}else{throw"Op is invalid after previous op."}}}},_estimate:function(e,d,f){if(!e){var g=new c.Relation(d,f);g.targetClassName=this._targetClassName}else{if(e instanceof c.Relation){if(this._targetClassName){if(e.targetClassName){if(e.targetClassName!==this._targetClassName){throw"Related object must be a "+e.targetClassName+", but a "+this._targetClassName+" was passed in."}}else{e.targetClassName=this._targetClassName}}return e}else{throw"Op is invalid after previous op."}}}});c.Op._registerDecoder("AddRelation",function(d){return new c.Op.Relation(c._decode(undefined,d.objects),[])});c.Op._registerDecoder("RemoveRelation",function(d){return new c.Op.Relation([],c._decode(undefined,d.objects))})}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Relation=function(e,d){this.parent=e;this.key=d;this.targetClassName=null};c.Relation.reverseQuery=function(e,g,f){var d=new c.Query(e);d.equalTo(g,f._toPointer());return d};c.Relation.prototype={_ensureParentAndKey:function(e,d){this.parent=this.parent||e;this.key=this.key||d;if(this.parent!==e){throw"Internal Error. Relation retrieved from two different Objects."}if(this.key!==d){throw"Internal Error. Relation retrieved from two different keys."}},add:function(d){if(!b.isArray(d)){d=[d]}var e=new c.Op.Relation(d,[]);this.parent.set(this.key,e);this.targetClassName=e._targetClassName},remove:function(d){if(!b.isArray(d)){d=[d]}var e=new c.Op.Relation([],d);this.parent.set(this.key,e);this.targetClassName=e._targetClassName},toJSON:function(){return{__type:"Relation",className:this.targetClassName}},query:function(){var d;var e;if(!this.targetClassName){d=c.Object._getSubclass(this.parent.className);e=new c.Query(d);e._extraOptions.redirectClassNameForKey=this.key}else{d=c.Object._getSubclass(this.targetClassName);e=new c.Query(d)}e._addCondition("$relatedTo","object",this.parent._toPointer());e._addCondition("$relatedTo","key",this.key);return e}}}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Promise=function(){this._resolved=false;this._rejected=false;this._resolvedCallbacks=[];this._rejectedCallbacks=[]};b.extend(c.Promise,{is:function(d){return d&&d.then&&b.isFunction(d.then)},as:function(){var d=new c.Promise();d.resolve.apply(d,arguments);return d},error:function(){var d=new c.Promise();d.reject.apply(d,arguments);return d},when:function(g){var i;if(g&&c._isNullOrUndefined(g.length)){i=arguments}else{i=g}var h=i.length;var e=false;var f=[];var k=[];f.length=i.length;k.length=i.length;if(h===0){return c.Promise.as.apply(this,f)}var j=new c.Promise();var d=function(){h=h-1;if(h===0){if(e){j.reject(k)}else{j.resolve.apply(j,f)}}};c._arrayEach(i,function(l,m){if(c.Promise.is(l)){l.then(function(n){f[m]=n;d()},function(n){k[m]=n;e=true;d()})}else{f[m]=l;d()}});return j},_continueWhile:function(d,e){if(d()){return e().then(function(){return c.Promise._continueWhile(d,e)})}return c.Promise.as()}});b.extend(c.Promise.prototype,{resolve:function(d){if(this._resolved||this._rejected){throw"A promise was resolved even though it had already been "+(this._resolved?"resolved":"rejected")+"."}this._resolved=true;this._result=arguments;var e=arguments;c._arrayEach(this._resolvedCallbacks,function(f){f.apply(this,e)});this._resolvedCallbacks=[];this._rejectedCallbacks=[]},reject:function(d){if(this._resolved||this._rejected){throw"A promise was rejected even though it had already been "+(this._resolved?"resolved":"rejected")+"."}this._rejected=true;this._error=d;c._arrayEach(this._rejectedCallbacks,function(e){e(d)});this._resolvedCallbacks=[];this._rejectedCallbacks=[]},then:function(d,f){var g=new c.Promise();var h=function(){var i=arguments;if(d){i=[d.apply(this,i)]}if(i.length===1&&c.Promise.is(i[0])){i[0].then(function(){g.resolve.apply(g,arguments)},function(j){g.reject(j)})}else{g.resolve.apply(g,i)}};var e=function(j){var i=[];if(f){i=[f(j)];if(i.length===1&&c.Promise.is(i[0])){i[0].then(function(){g.resolve.apply(g,arguments)},function(k){g.reject(k)})}else{g.reject(i[0])}}else{g.reject(j)}};if(this._resolved){h.apply(this,this._result)}else{if(this._rejected){e(this._error)}else{this._resolvedCallbacks.push(h);this._rejectedCallbacks.push(e)}}return g},_thenRunCallbacks:function(f,e){var d;if(b.isFunction(f)){var g=f;d={success:function(h){g(h,null)},error:function(h){g(null,h)}}}else{d=b.clone(f)}d=d||{};return this.then(function(h){if(d.success){d.success.apply(this,arguments)}else{if(e){e.trigger("sync",e,h,d)}}return c.Promise.as.apply(c.Promise,arguments)},function(h){if(d.error){if(!b.isUndefined(e)){d.error(e,h)}else{d.error(h)}}else{if(e){e.trigger("error",e,h,d)}}return c.Promise.error(h)})},_continueWith:function(d){return this.then(function(){return d(arguments,null)},function(e){return d(null,e)})}})}(this));(function(b){b.Bmob=b.Bmob||{};var h=b.Bmob;var d=h._;var c=function(i){if(i<26){return String.fromCharCode(65+i)}if(i<52){return String.fromCharCode(97+(i-26))}if(i<62){return String.fromCharCode(48+(i-52))}if(i===62){return"+"}if(i===63){return"/"}throw"Tried to encode large digit "+i+" in base64."};var a=function(q){var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var m,o,j;var p,n,l;j=q.length;o=0;m="";while(o>2);m+=k.charAt((p&3)<<4);m+="==";break}n=q.charCodeAt(o++);if(o==j){m+=k.charAt(p>>2);m+=k.charAt(((p&3)<<4)|((n&240)>>4));m+=k.charAt((n&15)<<2);m+="=";break}l=q.charCodeAt(o++);m+=k.charAt(p>>2);m+=k.charAt(((p&3)<<4)|((n&240)>>4));m+=k.charAt(((n&15)<<2)|((l&192)>>6));m+=k.charAt(l&63)}return m};var g=function(m){var k,l,j,n;k="";j=m.length;for(l=0;l=1)&&(n<=127)){k+=m.charAt(l)}else{if(n>2047){k+=String.fromCharCode(224|((n>>12)&15));k+=String.fromCharCode(128|((n>>6)&63));k+=String.fromCharCode(128|((n>>0)&63))}else{k+=String.fromCharCode(192|((n>>6)&31));k+=String.fromCharCode(128|((n>>0)&63))}}}return k};var f={ai:"application/postscript",aif:"audio/x-aiff",aifc:"audio/x-aiff",aiff:"audio/x-aiff",asc:"text/plain",atom:"application/atom+xml",au:"audio/basic",avi:"video/x-msvideo",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",cdf:"application/x-netcdf",cgm:"image/cgm","class":"application/octet-stream",cpio:"application/x-cpio",cpt:"application/mac-compactpro",csh:"application/x-csh",css:"text/css",dcr:"application/x-director",dif:"video/x-dv",dir:"application/x-director",djv:"image/vnd.djvu",djvu:"image/vnd.djvu",dll:"application/octet-stream",dmg:"application/octet-stream",dms:"application/octet-stream",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",docm:"application/vnd.ms-word.document.macroEnabled.12",dotm:"application/vnd.ms-word.template.macroEnabled.12",dtd:"application/xml-dtd",dv:"video/x-dv",dvi:"application/x-dvi",dxr:"application/x-director",eps:"application/postscript",etx:"text/x-setext",exe:"application/octet-stream",ez:"application/andrew-inset",gif:"image/gif",gram:"application/srgs",grxml:"application/srgs+xml",gtar:"application/x-gtar",hdf:"application/x-hdf",hqx:"application/mac-binhex40",htm:"text/html",html:"text/html",ice:"x-conference/x-cooltalk",ico:"image/x-icon",ics:"text/calendar",ief:"image/ief",ifb:"text/calendar",iges:"model/iges",igs:"model/iges",jnlp:"application/x-java-jnlp-file",jp2:"image/jp2",jpe:"image/jpeg",jpeg:"image/jpeg",jpg:"image/jpeg",js:"application/x-javascript",kar:"audio/midi",latex:"application/x-latex",lha:"application/octet-stream",lzh:"application/octet-stream",m3u:"audio/x-mpegurl",m4a:"audio/mp4a-latm",m4b:"audio/mp4a-latm",m4p:"audio/mp4a-latm",m4u:"video/vnd.mpegurl",m4v:"video/x-m4v",mac:"image/x-macpaint",man:"application/x-troff-man",mathml:"application/mathml+xml",me:"application/x-troff-me",mesh:"model/mesh",mid:"audio/midi",midi:"audio/midi",mif:"application/vnd.mif",mov:"video/quicktime",movie:"video/x-sgi-movie",mp2:"audio/mpeg",mp3:"audio/mpeg",mp4:"video/mp4",mpe:"video/mpeg",mpeg:"video/mpeg",mpg:"video/mpeg",mpga:"audio/mpeg",ms:"application/x-troff-ms",msh:"model/mesh",mxu:"video/vnd.mpegurl",nc:"application/x-netcdf",oda:"application/oda",ogg:"application/ogg",pbm:"image/x-portable-bitmap",pct:"image/pict",pdb:"chemical/x-pdb",pdf:"application/pdf",pgm:"image/x-portable-graymap",pgn:"application/x-chess-pgn",pic:"image/pict",pict:"image/pict",png:"image/png",pnm:"image/x-portable-anymap",pnt:"image/x-macpaint",pntg:"image/x-macpaint",ppm:"image/x-portable-pixmap",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",ppam:"application/vnd.ms-powerpoint.addin.macroEnabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroEnabled.12",potm:"application/vnd.ms-powerpoint.template.macroEnabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroEnabled.12",ps:"application/postscript",qt:"video/quicktime",qti:"image/x-quicktime",qtif:"image/x-quicktime",ra:"audio/x-pn-realaudio",ram:"audio/x-pn-realaudio",ras:"image/x-cmu-raster",rdf:"application/rdf+xml",rgb:"image/x-rgb",rm:"application/vnd.rn-realmedia",roff:"application/x-troff",rtf:"text/rtf",rtx:"text/richtext",sgm:"text/sgml",sgml:"text/sgml",sh:"application/x-sh",shar:"application/x-shar",silo:"model/mesh",sit:"application/x-stuffit",skd:"application/x-koan",skm:"application/x-koan",skp:"application/x-koan",skt:"application/x-koan",smi:"application/smil",smil:"application/smil",snd:"audio/basic",so:"application/octet-stream",spl:"application/x-futuresplash",src:"application/x-wais-source",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",svg:"image/svg+xml",swf:"application/x-shockwave-flash",t:"application/x-troff",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",texi:"application/x-texinfo",texinfo:"application/x-texinfo",tif:"image/tiff",tiff:"image/tiff",tr:"application/x-troff",tsv:"text/tab-separated-values",txt:"text/plain",ustar:"application/x-ustar",vcd:"application/x-cdlink",vrml:"model/vrml",vxml:"application/voicexml+xml",wav:"audio/x-wav",wbmp:"image/vnd.wap.wbmp",wbmxl:"application/vnd.wap.wbxml",wml:"text/vnd.wap.wml",wmlc:"application/vnd.wap.wmlc",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wrl:"model/vrml",xbm:"image/x-xbitmap",xht:"application/xhtml+xml",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xml:"application/xml",xpm:"image/x-xpixmap",xsl:"application/xml",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.12",xltm:"application/vnd.ms-excel.template.macroEnabled.12",xlam:"application/vnd.ms-excel.addin.macroEnabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.12",xslt:"application/xslt+xml",xul:"application/vnd.mozilla.xul+xml",xwd:"image/x-xwindowdump",xyz:"chemical/x-xyz",zip:"application/zip"};var e=function(j,k){var l=new h.Promise();if(typeof(FileReader)==="undefined"){return h.Promise.error(new h.Error(-1,"Attempted to use a FileReader on an unsupported browser."))}var i=new FileReader();i.onloadend=function(){l.resolve(i.result)};i.readAsBinaryString(j);return l};h.File=function(j,l,k){this._name=a(g(j));var i=h.User.current();this._metaData={owner:(i!=null?i.id:"unknown")};var n=/\.([^.]*)$/.exec(j);if(n){n=n[1].toLowerCase()}var m=k||f[n]||"text/plain";this._guessedType=m;if(typeof(File)!=="undefined"&&l instanceof File){this._source=e(l,k)}else{this._source=h.Promise.as(l,m);this._metaData.size=l.length}};h.File.prototype={name:function(){return this._name},setName:function(i){this._name=i},url:function(){return this._url},setUrl:function(i){this._url=i},cdn:function(){return this._cdn},metaData:function(i,j){if(i!=null&&j!=null){this._metaData[i]=j;return this}else{if(i!=null){return this._metaData[i]}else{return this._metaData}}},destroy:function(i){if(!this._url&&!this._cdn){return h.Promise.error("The file url and cdn is not eixsts.")._thenRunCallbacks(i)}var k={cdn:this._cdn,_ContentType:"application/json",url:this._url,metaData:self._metaData,};var j=h._request("2/files",null,null,"DELETE",k);return j._thenRunCallbacks(i)},save:function(j){var i=this;if(!i._previousSave){if(i._source){i._previousSave=i._source.then(function(k,l){var m={base64:a(k),_ContentType:"text/plain",mime_type:"text/plain",metaData:i._metaData,};if(!i._metaData.size){i._metaData.size=k.length}return h._request("2/files",i._name,null,"POST",m)}).then(function(k){i._name=k.filename;i._url=k.url;i._cdn=k.cdn;return i})}else{throw"not source file"}}return i._previousSave._thenRunCallbacks(j)}}}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Object=function(d,e){if(b.isString(d)){return c.Object._create.apply(this,arguments)}d=d||{};if(e&&e.parse){d=this.parse(d)}var f=c._getValue(this,"defaults");if(f){d=b.extend({},f,d)}if(e&&e.collection){this.collection=e.collection}this._serverData={};this._opSetQueue=[{}];this.attributes={};this._hashedJSON={};this._escapedAttributes={};this.cid=b.uniqueId("c");this.changed={};this._silent={};this._pending={};if(!this.set(d,{silent:true})){throw new Error("Can't create an invalid Bmob.Object")}this.changed={};this._silent={};this._pending={};this._hasData=true;this._previousAttributes=b.clone(this.attributes);this.initialize.apply(this,arguments)};c.Object.saveAll=function(e,d){return c.Object._deepSaveAsync(e)._thenRunCallbacks(d)};b.extend(c.Object.prototype,c.Events,{_existed:false,_fetchWhenSave:false,initialize:function(){},fetchWhenSave:function(d){if(typeof d!=="boolean"){throw"Expect boolean value for fetchWhenSave"}this._fetchWhenSave=d},toJSON:function(){var d=this._toFullJSON();c._arrayEach(["__type","className"],function(e){delete d[e]});return d},_toFullJSON:function(e){var d=b.clone(this.attributes);c._objectEach(d,function(g,f){d[f]=c._encode(g,e)});c._objectEach(this._operations,function(g,f){d[f]=g});if(b.has(this,"id")){d.objectId=this.id}if(b.has(this,"createdAt")){if(b.isDate(this.createdAt)){d.createdAt=this.createdAt.toJSON()}else{d.createdAt=this.createdAt}}if(b.has(this,"updatedAt")){if(b.isDate(this.updatedAt)){d.updatedAt=this.updatedAt.toJSON()}else{d.updatedAt=this.updatedAt}}d.__type="Object";d.className=this.className;return d},_refreshCache:function(){var d=this;if(d._refreshingCache){return}d._refreshingCache=true;c._objectEach(this.attributes,function(f,e){if(f instanceof c.Object){f._refreshCache()}else{if(b.isObject(f)){if(d._resetCacheForKey(e)){d.set(e,new c.Op.Set(f),{silent:true})}}}});delete d._refreshingCache},dirty:function(d){this._refreshCache();var e=b.last(this._opSetQueue);if(d){return(e[d]?true:false)}if(!this.id){return true}if(b.keys(e).length>0){return true}return false},_toPointer:function(){return{__type:"Pointer",className:this.className,objectId:this.id}},get:function(d){return this.attributes[d]},relation:function(d){var e=this.get(d);if(e){if(!(e instanceof c.Relation)){throw"Called relation() on non-relation field "+d}e._ensureParentAndKey(this,d);return e}else{return new c.Relation(this,d)}},escape:function(d){var e=this._escapedAttributes[d];if(e){return e}var g=this.attributes[d];var f;if(c._isNullOrUndefined(g)){f=""}else{f=b.escape(g.toString())}this._escapedAttributes[d]=f;return f},has:function(d){return !c._isNullOrUndefined(this.attributes[d])},_mergeMagicFields:function(e){var d=this;var f=["id","objectId","createdAt","updatedAt"];c._arrayEach(f,function(g){if(e[g]){if(g==="objectId"){d.id=e[g]}else{d[g]=e[g]}delete e[g]}})},_startSave:function(){this._opSetQueue.push({})},_cancelSave:function(){var e=this;var d=b.first(this._opSetQueue);this._opSetQueue=b.rest(this._opSetQueue);var f=b.first(this._opSetQueue);c._objectEach(d,function(j,h){var i=d[h];var g=f[h];if(i&&g){f[h]=g._mergeWithPrevious(i)}else{if(i){f[h]=i}}});this._saving=this._saving-1},_finishSave:function(f){var d={};c._traverse(this.attributes,function(h){if(h instanceof c.Object&&h.id&&h._hasData){d[h.id]=h}});var g=b.first(this._opSetQueue);this._opSetQueue=b.rest(this._opSetQueue);this._applyOpSet(g,this._serverData);this._mergeMagicFields(f);var e=this;c._objectEach(f,function(i,h){e._serverData[h]=c._decode(h,i);var j=c._traverse(e._serverData[h],function(k){if(k instanceof c.Object&&d[k.id]){return d[k.id]}});if(j){e._serverData[h]=j}});this._rebuildAllEstimatedData();this._saving=this._saving-1},_finishFetch:function(f,e){this._opSetQueue=[{}];this._mergeMagicFields(f);var d=this;c._objectEach(f,function(h,g){d._serverData[g]=c._decode(g,h)});this._rebuildAllEstimatedData();this._refreshCache();this._opSetQueue=[{}];this._hasData=e},_applyOpSet:function(e,f){var d=this;c._objectEach(e,function(h,g){f[g]=h._estimate(f[g],d,g);if(f[g]===c.Op._UNSET){delete f[g]}})},_resetCacheForKey:function(e){var f=this.attributes[e];if(b.isObject(f)&&!(f instanceof c.Object)&&!(f instanceof c.File)){f=f.toJSON?f.toJSON():f;var d=JSON.stringify(f);if(this._hashedJSON[e]!==d){this._hashedJSON[e]=d;return true}}return false},_rebuildEstimatedDataForKey:function(e){var d=this;delete this.attributes[e];if(this._serverData[e]){this.attributes[e]=this._serverData[e]}c._arrayEach(this._opSetQueue,function(f){var g=f[e];if(g){d.attributes[e]=g._estimate(d.attributes[e],d,e);if(d.attributes[e]===c.Op._UNSET){delete d.attributes[e]}else{d._resetCacheForKey(e)}}})},_rebuildAllEstimatedData:function(){var d=this;var e=b.clone(this.attributes);this.attributes=b.clone(this._serverData);c._arrayEach(this._opSetQueue,function(f){d._applyOpSet(f,d.attributes);c._objectEach(f,function(h,g){d._resetCacheForKey(g)})});c._objectEach(e,function(f,g){if(d.attributes[g]!==f){d.trigger("change:"+g,d,d.attributes[g],{})}});c._objectEach(this.attributes,function(g,f){if(!b.has(e,f)){d.trigger("change:"+f,d,g,{})}})},set:function(i,h,l){var j,g;if(b.isObject(i)||c._isNullOrUndefined(i)){j=i;c._objectEach(j,function(n,m){j[m]=c._decode(m,n)});l=h}else{j={};j[i]=c._decode(i,h)}l=l||{};if(!j){return this}if(j instanceof c.Object){j=j.attributes}if(l.unset){c._objectEach(j,function(m,n){j[n]=new c.Op.Unset()})}var f=b.clone(j);var k=this;c._objectEach(f,function(n,m){if(n instanceof c.Op){f[m]=n._estimate(k.attributes[m],k,m);if(f[m]===c.Op._UNSET){delete f[m]}}});if(!this._validate(j,l)){return false}this._mergeMagicFields(j);l.changes={};var d=this._escapedAttributes;var e=this._previousAttributes||{};c._arrayEach(b.keys(j),function(n){var p=j[n];if(p instanceof c.Relation){p.parent=k}if(!(p instanceof c.Op)){p=new c.Op.Set(p)}var m=true;if(p instanceof c.Op.Set&&b.isEqual(k.attributes[n],p.value)){m=false}if(m){delete d[n];if(l.silent){k._silent[n]=true}else{l.changes[n]=true}}var o=b.last(k._opSetQueue);o[n]=p._mergeWithPrevious(o[n]);k._rebuildEstimatedDataForKey(n);if(m){k.changed[n]=k.attributes[n];if(!l.silent){k._pending[n]=true}}else{delete k.changed[n];delete k._pending[n]}});if(!l.silent){this.change(l)}return this},unset:function(d,e){e=e||{};e.unset=true;return this.set(d,null,e)},increment:function(d,e){if(b.isUndefined(e)||b.isNull(e)){e=1}return this.set(d,new c.Op.Increment(e))},add:function(d,e){return this.set(d,new c.Op.Add([e]))},addUnique:function(d,e){return this.set(d,new c.Op.AddUnique([e]))},remove:function(d,e){return this.set(d,new c.Op.Remove([e]))},op:function(d){return b.last(this._opSetQueue)[d]},clear:function(d){d=d||{};d.unset=true;var e=b.extend(this.attributes,this._operations);return this.set(e,d)},_getSaveJSON:function(){var d=b.clone(b.first(this._opSetQueue));c._objectEach(d,function(f,e){d[e]=f.toJSON()});return d},_canBeSerialized:function(){return c.Object._canBeSerializedAsValue(this.attributes)},fetch:function(e){var d=this;var f=c._request("classes",this.className,this.id,"GET");return f.then(function(h,g,i){d._finishFetch(d.parse(h,g,i),true);return d})._thenRunCallbacks(e,this)},save:function(k,j,g){var f,p,l,s,o;if(b.isObject(k)||c._isNullOrUndefined(k)){p=k;s=j}else{p={};p[k]=j;s=g}if(!s&&p){var q=b.reject(p,function(t,i){return b.include(["success","error","wait"],i)});if(q.length===0){var r=true;if(b.has(p,"success")&&!b.isFunction(p.success)){r=false}if(b.has(p,"error")&&!b.isFunction(p.error)){r=false}if(r){return this.save(null,p)}}}s=b.clone(s)||{};if(s.wait){l=b.clone(this.attributes)}var m=b.clone(s)||{};if(m.wait){m.silent=true}var e;m.error=function(t,i){e=i};if(p&&!this.set(p,m)){return c.Promise.error(e)._thenRunCallbacks(s,this)}var h=this;h._refreshCache();var n=[];var d=[];c.Object._findUnsavedChildren(h.attributes,n,d);if(n.length+d.length>0){return c.Object._deepSaveAsync(this.attributes).then(function(){return h.save(null,s)},function(i){return c.Promise.error(i)._thenRunCallbacks(s,h)})}this._startSave();this._saving=(this._saving||0)+1;this._allPreviousSaves=this._allPreviousSaves||c.Promise.as();this._allPreviousSaves=this._allPreviousSaves._continueWith(function(){var w=h.id?"PUT":"POST";var t=h._getSaveJSON();if(w==="PUT"&&h._fetchWhenSave){t._fetchWhenSave=true}var i="classes";var u=h.className;if(h.className==="_User"&&!h.id){i="users";u=null}var v=c._request(i,u,h.id,w,t);v=v.then(function(A,x,z){var y=h.parse(A,x,z);if(s.wait){y=b.extend(p||{},y)}h._finishSave(y);if(s.wait){h.set(l,m)}return h},function(x){h._cancelSave();return c.Promise.error(x)})._thenRunCallbacks(s,h);return v});return this._allPreviousSaves},destroy:function(e){e=e||{};var d=this;var g=function(){d.trigger("destroy",d,d.collection,e)};if(!this.id){return g()}if(!e.wait){g()}var f=c._request("classes",this.className,this.id,"DELETE");return f.then(function(){if(e.wait){g()}return d})._thenRunCallbacks(e,this)},parse:function(g,d,f){var e=b.clone(g);b(["createdAt","updatedAt"]).each(function(h){if(e[h]){e[h]=e[h]}});if(!e.updatedAt){e.updatedAt=e.createdAt}if(d){this._existed=(d!==201)}return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return !this.id},change:function(f){f=f||{};var h=this._changing;this._changing=true;var e=this;c._objectEach(this._silent,function(i){e._pending[i]=true});var g=b.extend({},f.changes,this._silent);this._silent={};c._objectEach(g,function(j,i){e.trigger("change:"+i,e,e.get(i),f)});if(h){return this}var d=function(j,i){if(!e._pending[i]&&!e._silent[i]){delete e.changed[i]}};while(!b.isEmpty(this._pending)){this._pending={};this.trigger("change",this,f);c._objectEach(this.changed,d);e._previousAttributes=b.clone(this.attributes)}this._changing=false;return this},existed:function(){return this._existed},hasChanged:function(d){if(!arguments.length){return !b.isEmpty(this.changed)}return this.changed&&b.has(this.changed,d)},changedAttributes:function(e){if(!e){return this.hasChanged()?b.clone(this.changed):false}var f={};var d=this._previousAttributes;c._objectEach(e,function(h,g){if(!b.isEqual(d[g],h)){f[g]=h}});return f},previous:function(d){if(!arguments.length||!this._previousAttributes){return null}return this._previousAttributes[d]},previousAttributes:function(){return b.clone(this._previousAttributes)},isValid:function(){return !this.validate(this.attributes)},validate:function(e,d){if(b.has(e,"ACL")&&!(e.ACL instanceof c.ACL)){return new c.Error(c.Error.OTHER_CAUSE,"ACL must be a Bmob.ACL.")}return false},_validate:function(f,e){if(e.silent||!this.validate){return true}f=b.extend({},this.attributes,f);var d=this.validate(f,e);if(!d){return true}if(e&&e.error){e.error(this,d,e)}else{this.trigger("error",this,d,e)}return false},getACL:function(){return this.get("ACL")},setACL:function(e,d){return this.set("ACL",e,d)}});c.Object.createWithoutData=function(f,g,e){var d=new c.Object(f);d.id=g;d._hasData=e;return d};c.Object.destroyAll=function(h,e){if(h==null||h.length==0){return c.Promise.as()._thenRunCallbacks(e)}var f=h[0].className;var i="";var d=true;h.forEach(function(j){if(j.className!=f){throw"Bmob.Object.destroyAll requires the argument object array's classNames must be the same"}if(!j.id){throw"Could not delete unsaved object"}if(d){i=j.id;d=false}else{i=i+","+j.id}});var g=c._request("classes",f,i,"DELETE");return g._thenRunCallbacks(e)};c.Object._getSubclass=function(e){if(!b.isString(e)){throw"Bmob.Object._getSubclass requires a string argument."}var d=c.Object._classMap[e];if(!d){d=c.Object.extend(e);c.Object._classMap[e]=d}return d};c.Object._create=function(g,d,e){var f=c.Object._getSubclass(g);return new f(d,e)};c.Object._classMap={};c.Object._extend=c._extend;c.Object.extend=function(g,f,h){if(!b.isString(g)){if(g&&b.has(g,"className")){return c.Object.extend(g.className,g,f)}else{throw new Error("Bmob.Object.extend's first argument should be the className.")}}if(g==="User"){g="_User"}var d=null;if(b.has(c.Object._classMap,g)){var e=c.Object._classMap[g];d=e._extend(f,h)}else{f=f||{};f.className=g;d=this._extend(f,h)}d.extend=function(j){if(b.isString(j)||(j&&b.has(j,"className"))){return c.Object.extend.apply(d,arguments)}var i=[g].concat(c._.toArray(arguments));return c.Object.extend.apply(d,i)};c.Object._classMap[g]=d;return d};c.Object._findUnsavedChildren=function(d,e,f){c._traverse(d,function(g){if(g instanceof c.Object){g._refreshCache();if(g.dirty()){e.push(g)}return}if(g instanceof c.File){if(!g.url()){f.push(g)}return}})};c.Object._canBeSerializedAsValue=function(d){var e=true;if(d instanceof c.Object){e=!!d.id}else{if(b.isArray(d)){c._arrayEach(d,function(f){if(!c.Object._canBeSerializedAsValue(f)){e=false}})}else{if(b.isObject(d)){c._objectEach(d,function(f){if(!c.Object._canBeSerializedAsValue(f)){e=false}})}}}return e};c.Object._deepSaveAsync=function(e){var d=[];var h=[];c.Object._findUnsavedChildren(e,d,h);var i=c.Promise.as();b.each(h,function(j){i=i.then(function(){return j.save()})});var g=b.uniq(d);var f=b.uniq(g);return i.then(function(){return c.Promise._continueWhile(function(){return f.length>0},function(){var m=[];var j=[];c._arrayEach(f,function(n){if(m.length>20){j.push(n);return}if(n._canBeSerialized()){m.push(n)}else{j.push(n)}});f=j;if(m.length===0){return c.Promise.error(new c.Error(c.Error.OTHER_CAUSE,"Tried to save a batch with a cycle."))}var k=c.Promise.when(b.map(m,function(n){return n._allPreviousSaves||c.Promise.as()}));var l=new c.Promise();c._arrayEach(m,function(n){n._allPreviousSaves=l});return k._continueWith(function(){return c._request("batch",null,null,"POST",{requests:b.map(m,function(n){var o=n._getSaveJSON();var q="POST";var p="/1/classes/"+n.className;if(n.id){p=p+"/"+n.id;q="PUT"}n._startSave();return{method:q,path:p,body:o}})}).then(function(o,n,q){var p;c._arrayEach(m,function(r,s){if(o[s].success){r._finishSave(r.parse(o[s].success,n,q))}else{p=p||o[s].error;r._cancelSave()}});if(p){return c.Promise.error(new c.Error(p.code,p.error))}}).then(function(n){l.resolve(n);return n},function(n){l.reject(n);return c.Promise.error(n)})})})}).then(function(){return e})}}(this));(function(a){a.Bmob=a.Bmob||{};var c=a.Bmob;var b=c._;c.Role=c.Object.extend("_Role",{constructor:function(d,e){if(b.isString(d)&&(e instanceof c.ACL)){c.Object.prototype.constructor.call(this,null,null);this.setName(d);this.setACL(e)}else{c.Object.prototype.constructor.call(this,d,e)}},getName:function(){return this.get("name")},setName:function(e,d){return this.set("name",e,d)},getUsers:function(){return this.relation("users")},getRoles:function(){return this.relation("roles")},validate:function(f,e){if("name" in f&&f.name!==this.getName()){var d=f.name;if(this.id&&this.id!==f.objectId){return new c.Error(c.Error.OTHER_CAUSE,"A role's name can only be set before it has been saved.")}if(!b.isString(d)){return new c.Error(c.Error.OTHER_CAUSE,"A role's name must be a String.")}if(!(/^[0-9a-zA-Z\-_ ]+$/).test(d)){return new c.Error(c.Error.OTHER_CAUSE,"A role's name can only contain alphanumeric characters, _, -, and spaces.")}}if(c.Object.prototype.validate){return c.Object.prototype.validate.call(this,f,e)}return false}})}(this));(function(a){a.Bmob=a.Bmob||{};var d=a.Bmob;var c=d._;d.Collection=function(f,e){e=e||{};if(e.comparator){this.comparator=e.comparator}if(e.model){this.model=e.model}if(e.query){this.query=e.query}this._reset();this.initialize.apply(this,arguments);if(f){this.reset(f,{silent:true,parse:e.parse})}};c.extend(d.Collection.prototype,d.Events,{model:d.Object,initialize:function(){},toJSON:function(){return this.map(function(e){return e.toJSON()})},add:function(f,o){var k,m,h,l,n,g,j={},e={};o=o||{};f=c.isArray(f)?f.slice():[f];for(k=0,h=f.length;k0){d.include=this._include.join(",")}if(this._select){d.keys=this._select.join(",")}if(this._limit>=0){d.limit=this._limit}if(this._skip>0){d.skip=this._skip}if(this._order!==undefined){d.order=this._order}c._objectEach(this._extraOptions,function(f,e){d[e]=f});return d},_newObject:function(d){if(d&&d.className){obj=new c.Object(d.className)}else{obj=new this.objectClass()}return obj},_createRequest:function(d){return c._request("classes",this.className,null,"GET",d||this.toJSON())},find:function(e){var d=this;var f=this._createRequest();return f.then(function(g){return b.map(g.results,function(h){var i=d._newObject(g);i._finishFetch(d._processResult(h),true);return i})})._thenRunCallbacks(e)},destroyAll:function(e){var d=this;return d.find().then(function(f){return c.Object.destroyAll(f)})._thenRunCallbacks(e)},count:function(d){var f=this.toJSON();f.limit=0;f.count=1;var e=this._createRequest(f);return e.then(function(g){return g.count})._thenRunCallbacks(d)},first:function(e){var d=this;var g=this.toJSON();g.limit=1;var f=this._createRequest(g);return f.then(function(h){return b.map(h.results,function(i){var j=d._newObject();j._finishFetch(d._processResult(i),true);return j})[0]})._thenRunCallbacks(e)},collection:function(d,e){e=e||{};return new c.Collection(d,b.extend(e,{model:this._objectClass||this.objectClass,query:this}))},skip:function(d){this._skip=d;return this},limit:function(d){this._limit=d;return this},equalTo:function(d,e){this._where[d]=c._encode(e);return this},_addCondition:function(d,f,e){if(!this._where[d]){this._where[d]={}}this._where[d][f]=c._encode(e);return this},notEqualTo:function(d,e){this._addCondition(d,"$ne",e);return this},lessThan:function(d,e){this._addCondition(d,"$lt",e);return this},greaterThan:function(d,e){this._addCondition(d,"$gt",e);return this},lessThanOrEqualTo:function(d,e){this._addCondition(d,"$lte",e);return this},greaterThanOrEqualTo:function(d,e){this._addCondition(d,"$gte",e);return this},containedIn:function(e,d){this._addCondition(e,"$in",d);return this},notContainedIn:function(e,d){this._addCondition(e,"$nin",d);return this},containsAll:function(e,d){this._addCondition(e,"$all",d);return this},exists:function(d){this._addCondition(d,"$exists",true);return this},doesNotExist:function(d){this._addCondition(d,"$exists",false);return this},matches:function(e,f,d){this._addCondition(e,"$regex",f);if(!d){d=""}if(f.ignoreCase){d+="i"}if(f.multiline){d+="m"}if(d&&d.length){this._addCondition(e,"$options",d)}return this},matchesQuery:function(d,f){var e=f.toJSON();e.className=f.className;this._addCondition(d,"$inQuery",e);return this},doesNotMatchQuery:function(d,f){var e=f.toJSON();e.className=f.className;this._addCondition(d,"$notInQuery",e);return this},matchesKeyInQuery:function(e,d,g){var f=g.toJSON();f.className=g.className;this._addCondition(e,"$select",{key:d,query:f});return this},doesNotMatchKeyInQuery:function(e,d,g){var f=g.toJSON();f.className=g.className;this._addCondition(e,"$dontSelect",{key:d,query:f});return this},_orQuery:function(d){var e=b.map(d,function(f){return f.toJSON().where});this._where.$or=e;return this},_quote:function(d){return"\\Q"+d.replace("\\E","\\E\\\\E\\Q")+"\\E"},contains:function(d,e){this._addCondition(d,"$regex",this._quote(e));return this},startsWith:function(d,e){this._addCondition(d,"$regex","^"+this._quote(e));return this},endsWith:function(d,e){this._addCondition(d,"$regex",this._quote(e)+"$");return this},ascending:function(d){if(c._isNullOrUndefined(this._order)){this._order=d}else{this._order=this._order+","+d}return this},cleanOrder:function(d){this._order=null;return this},descending:function(d){if(c._isNullOrUndefined(this._order)){this._order="-"+d}else{this._order=this._order+",-"+d}return this},near:function(e,d){if(!(d instanceof c.GeoPoint)){d=new c.GeoPoint(d)}this._addCondition(e,"$nearSphere",d);return this},withinRadians:function(e,d,f){this.near(e,d);this._addCondition(e,"$maxDistance",f);return this},withinMiles:function(e,d,f){return this.withinRadians(e,d,f/3958.8)},withinKilometers:function(e,d,f){return this.withinRadians(e,d,f/6371)},withinGeoBox:function(d,f,e){if(!(f instanceof c.GeoPoint)){f=new c.GeoPoint(f)}if(!(e instanceof c.GeoPoint)){e=new c.GeoPoint(e)}this._addCondition(d,"$within",{"$box":[f,e]});return this},include:function(){var d=this;c._arrayEach(arguments,function(e){if(b.isArray(e)){d._include=d._include.concat(e)}else{d._include.push(e)}});return this},select:function(){var d=this;this._select=this._select||[];c._arrayEach(arguments,function(e){if(b.isArray(e)){d._select=d._select.concat(e)}else{d._select.push(e)}});return this},each:function(i,e){e=e||{};if(this._order||this._skip||(this._limit>=0)){var d="Cannot iterate on a query with sort, skip, or limit.";return c.Promise.error(d)._thenRunCallbacks(e)}var g=new c.Promise();var f=new c.Query(this.objectClass);f._limit=e.batchSize||100;f._where=b.clone(this._where);f._include=b.clone(this._include);f.ascending("objectId");var h=false;return c.Promise._continueWhile(function(){return !h},function(){return f.find().then(function(j){var k=c.Promise.as();c._.each(j,function(l){k=k.then(function(){return i(l)})});return k.then(function(){if(j.length>=f._limit){f.greaterThan("objectId",j[j.length-1].id)}else{h=true}})})})._thenRunCallbacks(e)}};c.FriendShipQuery=c.Query._extend({_objectClass:c.User,_newObject:function(){return new c.User()},_processResult:function(e){var d=e[this._friendshipTag];if(d.__type==="Pointer"&&d.className==="_User"){delete d.__type;delete d.className}return d},})}(this));(function(a){a.Bmob=a.Bmob||{};var d=a.Bmob;var c=d._;d.History=function(){this.handlers=[];c.bindAll(this,"checkUrl")};var e=/^[#\/]/;var b=/msie [\w.]+/;d.History.started=false;c.extend(d.History.prototype,d.Events,{interval:50,getHash:function(h){var g=h?h.location:window.location;var f=g.href.match(/#(.*)$/);return f?f[1]:""},getFragment:function(g,f){if(d._isNullOrUndefined(g)){if(this._hasPushState||f){g=window.location.pathname;var h=window.location.search;if(h){g+=h}}else{g=this.getHash()}}if(!g.indexOf(this.options.root)){g=g.substr(this.options.root.length)}return g.replace(e,"")},start:function(h){if(d.History.started){throw new Error("Bmob.history has already been started")}d.History.started=true;this.options=c.extend({},{root:"/"},this.options,h);this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var g=this.getFragment();var f=document.documentMode;var j=(b.exec(navigator.userAgent.toLowerCase())&&(!f||f<=7));if(j){this.iframe=d.$('