diff --git a/src/assets/ydn.db-dev.js b/src/assets/ydn.db-dev.js deleted file mode 100755 index d9a1b3958..000000000 --- a/src/assets/ydn.db-dev.js +++ /dev/null @@ -1,365 +0,0 @@ -(function(){var l,s=this;function t(a){return void 0!==a}function ba(a){a=a.split(".");for(var b=s,c;c=a.shift();)if(null!=b[c])b=b[c];else return null;return b} -function ca(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; -else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function u(a){return"array"==ca(a)}function v(a){var b=ca(a);return"array"==b||"object"==b&&"number"==typeof a.length}function w(a){return"string"==typeof a}function da(a){return"boolean"==typeof a}function ea(a){return"number"==typeof a}function fa(a){return"function"==ca(a)}function y(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}var ga="closure_uid_"+(1E9*Math.random()>>>0),ha=0; -function ia(a,b,c){return a.call.apply(a.bind,arguments)}function ja(a,b,c){if(!a)throw Error();if(2":"
")} -function va(a){if(!wa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(xa,"&"));-1!=a.indexOf("<")&&(a=a.replace(ya,"<"));-1!=a.indexOf(">")&&(a=a.replace(za,">"));-1!=a.indexOf('"')&&(a=a.replace(Aa,"""));-1!=a.indexOf("'")&&(a=a.replace(Ba,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(Ca,"�"));return a}var xa=/&/g,ya=//g,Aa=/"/g,Ba=/'/g,Ca=/\x00/g,wa=/[\x00&<>"']/;function Da(a){return ua(a.replace(/ /g,"  "),void 0)} -function Ea(a,b){for(var c=b.length,d=0;de))if(d in Ga)d=Ga[d];else if(d in Fa)d=Ga[d]=Fa[d];else{e=d;g=d.charCodeAt(0);if(31g)e=d;else{if(256>g){if(e="\\x",16>g||256g&&(e+="0");e+=g.toString(16).toUpperCase()}d=Ga[d]=e}g=d}b[f]=g}b.push('"');return b.join("")}function Ia(a,b){return ab?1:0};function Ja(a,b){b.unshift(a);qa.call(this,sa.apply(null,b));b.shift()}z(Ja,qa);Ja.prototype.name="AssertionError";function Ka(a,b){throw new Ja("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};function La(a){s.setTimeout(function(){throw a;},0)}var Ma; -function Na(){if(s.Promise&&s.Promise.resolve){var a=s.Promise.resolve();return function(b){a.then(function(){try{b()}catch(a){La(a)}})}}var b=s.MessageChannel;"undefined"===typeof b&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&(b=function(){var a=document.createElement("iframe");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d=b.location.protocol+ -"//"+b.location.host,a=ka(function(a){if(a.origin==d||a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof b){var c=new b,d={},e=d;c.port1.onmessage=function(){d=d.next;var a=d.Eb;d.Eb=null;a()};return function(a){e.next={Eb:a};e=e.next;c.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("script")?function(a){var b=document.createElement("script"); -b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){s.setTimeout(a,0)}};function Oa(a,b){if(!Pa){var c=Qa;fa(s.setImmediate)?s.setImmediate(c):(Ma||(Ma=Na()),Ma(c));Pa=!0}Ra.push(new Sa(a,b))}var Pa=!1,Ra=[];[].push(function(){Pa=!1;Ra=[]});function Qa(){for(;Ra.length;){var a=Ra;Ra=[];for(var b=0;bc?Math.max(0,a.length+c):c;if(w(a))return w(b)&&1==b.length?a.indexOf(b,c):-1;for(;cc?null:w(a)?a.charAt(c):a[c]}function ob(a,b,c){for(var d=a.length,e=w(a)?a.split(""):a,f=0;f=a.length)throw Qb;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");} -function Tb(a,b){if(v(a))try{kb(a,b,void 0)}catch(c){if(c!==Qb)throw c;}else{a=Sb(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(d){if(d!==Qb)throw d;}}};function Ub(a,b){this.b={};this.a=[];this.d=this.c=0;var c=arguments.length;if(1=c.length)throw Qb;var g=c[b++];return a?g:d[g]}};return g};var Xb;a:{var Yb=s.navigator;if(Yb){var Zb=Yb.userAgent;if(Zb){Xb=Zb;break a}}Xb=""}function $b(a){return-1!=Xb.indexOf(a)};function ac(){return s.navigator||null}var bc=$b("Opera")||$b("OPR"),cc=$b("Trident")||$b("MSIE"),dc=$b("Gecko")&&-1==Xb.toLowerCase().indexOf("webkit")&&!($b("Trident")||$b("MSIE")),ec=-1!=Xb.toLowerCase().indexOf("webkit");ec&&$b("Mobile");var fc,gc=ac();fc=gc&&gc.platform||"";fc.indexOf("Mac");fc.indexOf("Win");fc.indexOf("Linux");ac()&&(ac().appVersion||"").indexOf("X11");var hc=Xb;hc&&hc.indexOf("Android");hc&&hc.indexOf("iPhone");hc&&hc.indexOf("iPad"); -function ic(){var a=s.document;return a?a.documentMode:void 0}var jc=function(){var a="",b;if(bc&&s.opera)return a=s.opera.version,fa(a)?a():a;dc?b=/rv\:([^\);]+)(\)|;)/:cc?b=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:ec&&(b=/WebKit\/(\S+)/);b&&(a=(a=b.exec(Xb))?a[1]:"");return cc&&(b=ic(),b>parseFloat(a))?String(b):a}(),kc={}; -function lc(a){var b;if(!(b=kc[a])){b=0;for(var c=String(jc).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&fb.length){c.push(qc(a)+"(");for(var d=a.arguments,e=0;d&&e=Gc(this).value)for(fa(b)&&(b=b()),a=this.f(a,b,c,uc.prototype.log),b="log:"+a.d,s.console&&(s.console.timeStamp?s.console.timeStamp(b):s.console.markTimeline&&s.console.markTimeline(b)),s.msWriteProfilerMark&&s.msWriteProfilerMark(b),b=this;b;){c=b;var d=a;if(c.a)for(var e=0,f=void 0;f=c.a[e];e++)f(d);b=b.c}}; -uc.prototype.f=function(a,b,c,d){a=new sc(a,String(b),this.e);if(c){a.b=c;var e;d=d||uc.prototype.f;try{var f;var g=ba("window.location.href");if(w(c))f={message:c,name:"Unknown error",lineNumber:"Not available",fileName:g,stack:"Not available"};else{var h,k;b=!1;try{h=c.lineNumber||c.sc||"Not available"}catch(m){h="Not available",b=!0}try{k=c.fileName||c.filename||c.sourceURL||s.$googDebugFname||g}catch(n){k="Not available",b=!0}f=!b&&c.lineNumber&&c.fileName&&c.stack&&c.message&&c.name?c:{message:c.message|| -"Not available",name:c.name||"UnknownError",lineNumber:h,fileName:k,stack:c.stack||"Not available"}}e="Message: "+va(f.message)+'\nUrl: '+f.fileName+"\nLine: "+f.lineNumber+"\n\nBrowser stack:\n"+va(f.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+va(oc(d)+"-> ")}catch(q){e="Exception trying to expose exception! You win, we lose. "+q}a.a=e}return a};var Hc={},Ic=null;function Jc(){Ic||(Ic=new uc(""),Hc[""]=Ic,Ic.b=Ac)} -function Kc(){Jc();return Ic}function G(a){Jc();var b;if(!(b=Hc[a])){b=new uc(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=G(a.substr(0,c));c.d||(c.d={});c.d[d]=b;b.c=c;Hc[a]=b}return b};function Lc(a,b,c){a&&a.log(b,c,void 0)}function Mc(a,b){a&&a.log(xc,b,void 0)}function H(a,b){a&&a.log(yc,b,void 0)}function Nc(a,b){a&&a.log(Bc,b,void 0)};function I(a,b){a&&a.log(Dc,b,void 0)}function J(a,b){a&&a.log(Cc,b,void 0)};function Oc(a,b){B.call(this,0,b);this.e=[]}z(Oc,B);Oc.prototype.Va=function(a,b){this.e.push([a,b]);return this};Oc.prototype.callback=function(a){this.e.length=0;Oc.r.callback.call(this,a)};Oc.prototype.k=function(a){this.e.length=0;Oc.r.k.call(this,a)};B.prototype.done=B.prototype.C;B.prototype.fail=B.prototype.Db;B.prototype.always=B.prototype.Cb;Oc.prototype.then=Oc.prototype.then;function K(a,b,c,d){this.lower=a;this.upper=b;this.lowerOpen=!!c;this.upperOpen=!!d;fa(Object.freeze)&&Object.freeze(this)}K.prototype.lower=void 0;K.prototype.upper=void 0;K.prototype.toJSON=function(){return Pc(this)};function Qc(a){return Rc(a)}K.only=function(a){return new K(a,a,!1,!1)};K.bound=function(a,b,c,d){return new K(a,b,c,d)};K.upperBound=function(a,b){return new K(void 0,a,void 0,!!b)};K.lowerBound=function(a,b){return new K(a,void 0,!!b,void 0)}; -function Sc(a){var b;if(u(a))b=sb(a),b.push("\uffff");else if(w(a))b=a+"\uffff";else if(ea(a))b=a+2.220460492503131E-16,a-=2.220460492503131E-16;else return K.only(a);return K.bound(a,b,!1,!0)}function Pc(a){a=a||{};return{lower:a.lower,upper:a.upper,lowerOpen:a.lowerOpen,upperOpen:a.upperOpen}} -function Rc(a){return null!=a?null!=a.upper&&null!=a.lower?Tc.bound(a.lower,a.upper,!!a.lowerOpen,!!a.upperOpen):null!=a.upper?Tc.upperBound(a.upper,a.upperOpen):null!=a.lower?Tc.lowerBound(a.lower,a.lowerOpen):null:null}function Uc(a){if(a instanceof K)return"";if(null!=a){if(y(a)){for(var b in a){var c;if(c=a.hasOwnProperty(b))c=!(0<=jb(["lower","upper","lowerOpen","upperOpen"],b));if(c)return'invalid attribute "'+b+'" in key range object'}return""}return"key range must be an object"}return""} -K.prototype.ba=function(a){var b=this.lower,c=this.upper,d=this.lowerOpen,e=this.upperOpen;null!=a.lower&&(null==this.lower||a.lower>=this.lower)&&(b=a.lower,d=a.lowerOpen||this.lowerOpen);null!=a.upper&&(null==this.upper||a.upper<=this.upper)&&(c=a.upper,e=a.upperOpen||this.upperOpen);return K.bound(b,c,d,e)};function Vc(a){if(!a)return"";var b=a.lowerOpen?"(":"[";null!=a.lower&&(b+=a.lower+", ");null!=a.upper&&(b+=a.upper);return b+=a.upperOpen?")":"]"} -function Wc(a,b,c,d,e){if(c)if(c.lowerOpen||c.upperOpen||null==c.lower||null==c.upper||0!==L(c.lower,c.upper)){if(null!=c.lower){var f=c.lowerOpen?" > ":" >= ";d.push(a+f+"?");e.push(Xc(c.lower,b))}null!=c.upper&&(f=c.upperOpen?" < ":" <= ",d.push(a+f+"?"),e.push(Xc(c.upper,b)))}else d.push(a+" = ?"),e.push(Xc(c.lower,b))} -function Yc(a,b,c,d){var e,f,g,h;if("starts"==a||"^"==a)return Sc(b);if("<"==a||"<="==a)e=b,g="<"==a;else if(">"==a||">="==a)f=b,h=">"==a;else if("="==a||"=="==a)e=f=b;else throw new C("invalid op: "+a);if("<"==c||"<="==c)e=d,g="<"==c;else if(">"==c||">="==c)f=d,h=">"==c;else if(t(c))throw new C("invalid op2: "+c);return K.bound(f,e,h,g)}var Tc=s.IDBKeyRange||s.webkitIDBKeyRange||K;function Zc(a,b){var c,d;2==arguments.length&&w(arguments[1])?(c=!0,d=arguments[1].split(".")):d=(c=v(b))?b:arguments;for(c=c?0:1;c=f?c.write(f+1):16510>=f?(f-=127,c.write(128|f>>8,f&255)):c.write(192|f>>10, -f>>2|255,(f|3)<<6)}c.write(0)}else if(e===ad)a.write(0);else return"";c=0}for(b=a.a.length;"00"===a.a[--b];);a.a.length=++b;return a.toString()}function ed(a){for(var b=[],c=b,d=[],e,f,g=new fd(a);null!=gd(g);)if(0===g.a)c=d.pop();else{if(null===g.a)break;do{e=g.a/4|0;a=g.a%4;for(var h=0;hc&&(d=1,c=-c);f=0;if(2.2250738585072014E-308<=c){for(e=c;1>e;)f--,e*=2;for(;2<=e;)f++,e/=2;e=f+1023}f=e?Math.floor(4503599627370496*(c/Math.pow(2,f)-1)):Math.floor(c/4.9E-324)}else e=2047,isNaN(c)?f=0x8000000000000:-Infinity===c&&(d=1);c=d;d=e;e=f;c&&(e=0xfffffffffffff-e,d=2047-d);a.write((c?0:128)|d>>4);a.write((d&15)<<4|0|e/281474976710656);e%=281474976710656;c=0|e/4294967296;a.write(c>>8,c&255);e%=4294967296;c=0|e/65536;a.write(c>> -8,c&255);c=e%65536;a.write(c>>8,c&255)}function hd(a){var b=gd(a)|0,c=b>>7?!1:!0,d=c?-1:1,e=(b&127)<<4,b=gd(a)|0,e=e+(b>>4);c&&(e=2047-e);for(var b=[c?15-(b&15):b&15],f=6;f--;)b.push(c?255-(gd(a)|0):gd(a)|0);a=0;for(f=7;f--;)a=a/256+b[f];a/=16;return 0===a&&0===e?0:(a+1)*Math.pow(2,e-1023)*d} -function id(a){for(var b=[],c=0,d=0,e=0,f,g;;){f=gd(a);if(0===f||null==f)break;0===c?(g=f>>6,2>g&&!isNaN(f)?b.push(String.fromCharCode(f-1)):(c=g,d=f<<10,e++)):2===c?(b.push(String.fromCharCode(d+f+127)),c=d=e=0):2===e?(d+=f<<2,e++):(b.push(String.fromCharCode(d|f>>6)),c=d=e=0)}return b.join("")}function fd(a){this.a=null;this.b=a;this.c=this.b.length-1;this.index=-1}function gd(a){return a.a=a.indexd?1:c==d?0:-1};function kd(a,b,c,d,e){if(!(b instanceof K))if(w(b)&&t(c))b=Yc(b,c,d,e);else if(null!=b){if(!(b instanceof K))if(y(b))b=new K(b.lower,b.upper,b.lowerOpen,b.upperOpen);else throw new C("Invalid key range: "+b+" of type "+typeof b);}else b=null;this.a=b;this.ea=a}kd.prototype.ea="";kd.prototype.ba=function(a){if(this.ea!=a.ea)return null;a=null!=this.a&&null!=a.a?this.a.ba(a.a):this.a||a.a;return new kd(this.ea,a)};var ld={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchange"},md=s.IDBRequest&&"LOADING"in s.IDBRequest?s.IDBTransaction:s.webkitIDBRequest&&"LOADING"in s.webkitIDBRequest&&1===s.webkitIDBTransaction.READ_WRITE?s.webkitIDBTransaction:ld,nd=md.READ_ONLY,M=md.READ_WRITE,od=md.VERSION_CHANGE,pd=s.indexedDB||s.mozIndexedDB||s.webkitIndexedDB||s.moz_indexedDB||s.msIndexedDB;function qd(){0!=rd&&(sd[this[ga]||(this[ga]=++ha)]=this)}var rd=0,sd={};qd.prototype.xa=!1;qd.prototype.kb=function(){if(!this.xa&&(this.xa=!0,this.$(),0!=rd)){var a=this[ga]||(this[ga]=++ha);delete sd[a]}};qd.prototype.$=function(){if(this.Va)for(;this.Va.length;)this.Va.shift()()};function td(a,b,c,d){qd.call(this);this.b=c;this.m=c.getName();this.I=void 0;this.f=!1;this.p=null;this.d=a;this.Mb=b;this.ma=0;this.N=this.v=!1;this.u=d||4;this.h=this.c=this.a=void 0;this.i=function(){throw new Jb;};this.l=function(){throw new Jb;};this.Ya=function(){}}z(td,qd);l=td.prototype; -l.Bb=function(a,b,c,d,e){if(t(b)){a=this.b;var f,g=b;u(b)?(f=ud(a,b),g=b.join(", ")):f=vd(a,b);if(!f)throw new C('require index "'+g+'" not found in store "'+a.getName()+'"');this.I=f.getName()}this.f=w(this.I);this.p=c||null;this.ma=0;this.N=this.v=!1;this.reverse="prev"==d||"prevunique"==d;this.unique="nextunique"==d||"prevunique"==d;this.Q=d;this.wa=e;this.h=this.c=this.a=void 0};l.Q="";l.p=null;l.unique=!1;l.reverse=!1;l.wa=!0;l.logger=G("ydn.db.core.req.AbstractCursor"); -function wd(a,b){a.l(b);xd(a);a.v=!0}l.O=function(a,b,c){null==a&&(J(this.logger,this+" finished."),this.v=!0);this.a=a;this.c=b;this.h=c;this.ma++;this.v?(I(this.logger,this+" DONE."),this.i(),xd(this)):(I(this.logger,this+" new cursor position {"+(this.f?this.a+", "+this.c:this.a)+"}"),this.i(this.a))};l.$=function(){this.d=null};l.toString=function(){return"Cursor:"+this.m+(t(this.I)?":"+this.I:"")+"["+(this.d?"":"~")+this.Mb+"]"}; -function xd(a){null!=a.c?a.c=yd(a.c):a.c=void 0;null!=a.a?a.a=yd(a.a):a.a=void 0;a.Ya(a.N,a.a,a.c)}l.open=function(a,b,c,d){this.d=a;this.Mb=b;this.v=this.N=!1;this.a=c;this.c=d;this.openCursor(this.a,this.c)};function zd(a){a.N=!0;I(a.logger,a+": exit");xd(a)}l.mb=function(){return this.ma};l.nc=function(){return this.a};l.B=function(){return this.f?this.c:this.a};l.aa=function(){return this.wa?this.B():this.h};l.Da=function(){};l.ja=function(){}; -function Ad(a,b,c){I(a.logger,a+" restarting");a.v=!1;a.N=!1;a.openCursor(c,b)};function Bd(){};function N(a,b,c,d,e,f,g){if(!w(a))throw new TypeError("store name must be a string, but "+a+" found.");this.c=a;this.d=b;this.e=g;this.i=!!this.d;if(t(d)&&!da(d))throw new C("reverse value must be a boolean, but "+typeof d+" found");if(t(e)&&!da(e))throw new C("unique value must be a boolean, but "+typeof e+" found");if(t(f)&&!da(f))throw new C("key_only value must be a boolean, but "+typeof f+" found");this.a=t(f)?f:!!w(this.d);a="next";d&&e?a="prevunique":d?a="prev":e&&(a="nextunique");this.l= -a;if(d=Uc(c))throw new C("Invalid key range: "+d);this.b=Rc(c);this.f=Dd;this.o=NaN}z(N,Bd);N.prototype.a=!0;function Ed(a,b,c){if(3=a.g)?[]:b}$d.prototype.c=function(){return[]};function be(a){Error.captureStackTrace?Error.captureStackTrace(this,be):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="ConstraintError"}z(be,Error);be.prototype.name="ConstraintError";be.prototype.toString=function(){return this.name+": "+this.message};function ce(a){Error.captureStackTrace?Error.captureStackTrace(this,ce):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="ydn.db.InvalidKeyException"}z(ce,Error); -ce.prototype.toString=function(){return this.name+": "+this.message};function de(a){Error.captureStackTrace?Error.captureStackTrace(this,de):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="ydn.db.VersionError"}z(de,Error);de.prototype.name="ydn.db.VersionError";de.prototype.toString=function(){return this.name+": "+this.message};function ee(a){Error.captureStackTrace?Error.captureStackTrace(this,ee):this.stack=Error().stack||"";a&&(this.message=String(a))}z(ee,Error); -ee.prototype.name="ydn.db.InternalError";function Ld(a){Error.captureStackTrace?Error.captureStackTrace(this,Ld):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="InvalidStateError"}z(Ld,Error);function fe(a){Error.captureStackTrace?Error.captureStackTrace(this,fe):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="InvalidAccessError"}z(fe,Error); -function ge(a){Error.captureStackTrace?Error.captureStackTrace(this,ge):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="NotFoundError"}z(ge,Error);ge.prototype.name="NotFoundError";ge.prototype.toString=function(){return this.name+": "+this.message};function he(a,b){Error.captureStackTrace?Error.captureStackTrace(this,he):this.stack=Error().stack||"";b&&(this.message=String(b));this.message+=" :"+a.message+" ["+a.code+"]";this.name="SQLError"}z(he,Error); -he.prototype.toString=function(){return this.name+": "+this.message};function ie(a,b){Error.captureStackTrace?Error.captureStackTrace(this,ie):this.stack=Error().stack||"";b&&(this.message=String(b));this.message+=" :"+a.message;this.name="SecurityError"}z(ie,Error);ie.prototype.toString=function(){return this.name+": "+this.message};function je(a){Error.captureStackTrace?Error.captureStackTrace(this,je):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="ydn.db.SqlParseError"} -z(je,Error);function ke(a){Error.captureStackTrace?Error.captureStackTrace(this,ke):this.stack=Error().stack||"";a&&(this.message=String(a));this.name="ydn.db.TimeoutError"}z(ke,Error);function le(a,b,c){var d;if(y(a))d=a.store,b=a.id,null!=a.parent&&(c=new le(a.parent));else if(t(b))d=a;else if(d=a.lastIndexOf("^|"),b=a,0a.J.length)b=!1;else{for(c=0;c=this.i)throw new Ib("Exceed maximum number of transactions of "+this.i);this.l=!0;this.j().transaction(function(c){var d=h.b;d.a=c;d.d=!1;d.J=b;d.mode=g;d.b++;d.F=null;k=h.A();Nc(h.logger,k+" BEGIN "+U(b)+" "+g);a(h);for(a=null;ve(h);)c=h.c.shift(),c.F&&h.e.push(c.F),I(h.logger,"pop tx queue"+(h.c.length+1)+" reusing T"+h.d),c.Ma()},e,g,function(a,b){Nc(h.logger,k+" "+a);var c=h.b;c.a?(c.a=null,c.J=null,c.mode=null,fa(c.F)&&c.F(a,b),c.F=null):H(c.logger,c+" has no TX to be unlocked for "+ -a);for(c=0;cc.length)throw new C('at least one valid key required in key list "'+ -Ke(a)+'"');d=this.a.request("rm:keys",c,M);Q(d,function(){W(this).vb(d,a)},this)}else throw new C('first argument requires store name, key (ydn.db.Key) or list of keys (array) , but "'+Ke(a)+'" ('+ca(a)+") found.");return d};l.toString=function(){return"DbOperator:"+this.j().getName()};function Ze(a,b,c){ze.call(this,a,b,c)}z(Ze,Ie);l=Ze.prototype;l.logger=G("ydn.db.core.DbOperator");l.get=function(a,b){if(a instanceof N){var c=a.c,d=X(this.b,c);if(!d)throw new C('store "'+c+'" not found.');var e=a.d;if(t(e)&&!Pe(d,e))throw new C('index "'+e+'" not found in store "'+c+'".');J(this.logger,"getByIterator:"+a);var f=this.a.request("get:iter",[c]);Q(f,function(){$e(this,5,f,a,1)},this);return f}return Ze.r.get.call(this,a,b)}; -l.keys=function(a,b,c,d,e,f,g){if(a instanceof N){var h=100;if(ea(b)){if(h=b,1>h)throw new C("limit must be a positive value, but "+b);}else if(t(b))throw new C("limit must be a number, but "+b);if(t(c))throw new C("offset must not be specified");J(this.logger,"keysByIterator:"+a);var k=this.a.request("keys:iter",[a.c]);Q(k,function(){a.i?$e(this,1,k,a,h):$e(this,2,k,a,h)},this);return k}return Ze.r.keys.call(this,a,b,c,d,e,f,g)}; -l.count=function(a,b,c,d){if(a instanceof N){if(t(b)||t(c))throw new C("too many arguments.");J(this.logger,"countIterator:"+a);var e=this.a.request("count",[a.c]);Q(e,function(){$e(this,6,e,a)},this);return e}return Ze.r.count.call(this,a,b,c,d)}; -l.w=function(a,b,c,d,e,f){if(a instanceof N){var g;if(ea(b)){if(g=b,1>g)throw new C("limit must be a positive value, but "+g);}else if(t(b))throw new C("limit must be a number, but "+b);if(t(c))throw new C("offset must not be specified");J(this.logger,"listByIterator:"+a);var h=this.a.request("values:iter",[a.c]);Q(h,function(){a.a?$e(this,2,h,a,g):$e(this,4,h,a,g)},this);return h}return Ze.r.w.call(this,a,b,c,d,e,f)}; -l.Ab=function(a,b,c){if(!u(b))throw new C("iterators argument must be an array, but "+b+" of type "+typeof b+" found");for(var d=0;d",r=g?r+" ":r+"= ";g=Xc(f,n.type);h=Xc(h,a.type);n="";e?(a=tf(a,c,b,q,e,k,m),a.n+=" AND ",n=d+r+"?",c.push(g)):(e=k?K.upperBound(f,!0):K.lowerBound(f,!0),a=tf(a,c,b,q,e,k,m),n=a.n,a.n="");a.n+="("+n+" OR ("+d+" = ? AND "+p+r+"?))";c.push(g);c.push(h);return"SELECT "+a.select+" FROM "+a.M+" WHERE "+a.n+(a.group?" GROUP BY "+a.group:"")+" ORDER BY "+a.P}l.clone=function(){return Ce(this.toJSON())}; -l.index=function(a){return this.a[a]||null};function vd(a,b){return nb(a.a,function(a){return a.getName()==b})}function ud(a,b){for(var c=0;c -c)throw new C("Invalid version: "+c+" ("+a+")");isNaN(c)&&(c=void 0)}if(t(b)&&(!u(b)||0c.a.length)c=!1;else{for(var d=0;d=this.h)throw new Ib("Exceed maximum number of transactions of "+this.h);this.j().transaction(e,b,h,f)}}; -l.request=function(a,b,c,d){var e=new O(a),f=this;this.ha(function(a){f.a++;Id(e,a,f.A()+"R"+f.a)},b,c||nd,function(a,b){Kd(e);d&&d(a,b)});return e};l.W=function(a,b,c,d,e){var f=this,g;this.ha(function(c){f.a++;g=f.A()+"R"+f.a;J(f.logger,g+" BEGIN");b(c,g,function(b,d){f.c=c;g=f.A()+"R"+f.a;d?(J(f.logger,g+" ERROR"),a.k(b)):(J(f.logger,g+" SUCCESS"),a.callback(b));f.c=null});b=null;J(f.logger,g+" END")},c,d,e)};l.toString=function(){return"Parallel:"+this.f+":"+this.A()+(this.c?"*":"")};function Of(a,b){Nf.call(this,a,b,re)}z(Of,Nf);l=Of.prototype;l.logger=G("ydn.db.tr.AtomicParallel");l.Qb=function(){return!1};l.request=function(a,b,c){var d,e,f,g=this,h=Of.r.request.call(this,a,b,c,function(a,b){Kd(h);J(g.logger,"transaction "+a);if(d)"complete"!=a&&(f=!0,e=b),d(e,f);else{var c=new ke;P(h,c,!0)}});Md(h,function(a,b,c){f=b;e=a;d=c});return h}; -l.W=function(a,b,c,d,e){var f,g,h=new B;yb(h,function(a){g=!1;f=a},function(a){g=!0;f=a});Of.r.W.call(this,h,b,c,d,function(b,c){if("complete"!=b)a.k(c);else if(!0===g)a.k(f);else if(!1===g)a.callback(f);else{var d=new ke;a.k(d)}e&&(e(b,c),e=void 0)})};l.toString=function(){return"Atomic"+Of.r.toString.call(this)};function Pf(a,b,c){T.call(this,a,b,c);this.na=0;a=!0;b=re;c&&(t(c.isSerial)&&(a=!!c.isSerial),c.policy&&(b=c.policy));c=Qf(this,b,a);this.i=Qf(this,"atomic",!1);this.c=this.la(c,this.i)}z(Pf,T);l=Pf.prototype;l.na=0;l.Rb=function(a,b,c,d,e,f){a=a||re;var g;"readonly"==d?g=nd:"readwrite"==d&&(g=M);a=Qf(this,a,b,c,g,e);return this.la(a,f?null:this.i)};l.la=function(a){return new ze(this,this.a,a)}; -function Qf(a,b,c,d,e,f){if(c){if("multi"==b||"repeat"==b||"all"==b||b==re)return new te(a,a.na++,b,d,e,f);if("atomic"==b)return new ye(a,a.na++);throw new C('Invalid requestType "'+b+'"');}if("multi"==b||"repeat"==b||"all"==b||b==re)return new Nf(a,a.na++,b,d,e,f);if("atomic"==b)return new Of(a,a.na++);throw new C('Invalid requestType "'+b+'"');} -l.Zb=function(a,b,c){if(3r&&rk&&k=b.length)0b&&bf&&f=a)return Yf(c,b)}var c=this,d=this.e?-1:0;this.reverse?Zf(this.ca,b,this.e):$f(this.ca,b,this.e)}; -l.ja=function(a){if(null!=a){var b=this,c=new Z(a),d=function(c){b.e=c;if(!c)return Yf(b,c);var d=L(c.value.key,a);if(b.reverse){if(1!=d)return Yf(b,c)}else if(-1!=d)return Yf(b,c)};this.reverse?Zf(this.ca,d,c):$f(this.ca,d,c)}else this.advance(1)};function ag(a){setTimeout(function(){a.o.a?(a.o.a=!1,a.O(a.a,a.c,a.h),ag(a)):(a.g(),a.g=null)},4)} -function Yf(a,b){if(a.e=b){var c=b.value;if(a.p)if(a.reverse||null==a.p.upper)a.reverse&&null!=a.p.lower&&(d=L(c.key,a.p.lower),-1==d||0==d&&a.p.lowerOpen)&&(a.e=null);else{var d=L(c.key,a.p.upper);if(1==d||0==d&&a.p.upperOpen)a.e=null}if(a.e){if(a.unique&&null!=a.a&&null!=c.key&&0==L(a.a,c.key))return;a.a=c.key;a.c=a.f?c.a:a.a;4==a.u&&(a.wa?a.h=a.c:a.h=bg(a.Za,a.c))}}a.e||(a.a=void 0,a.c=void 0,a.h=void 0);return a.o.a=!0} -l.openCursor=function(a,b){var c=null;if(this.p)if(this.reverse){var d=this.f?"\uffff":void 0;null!=this.p.upper&&(c=new Z(this.p.upper,d))}else null!=this.p.lower&&(c=new Z(this.p.lower));null!=a&&(c=this.f?new Z(a,b):new Z(a));this.g=this.d.j(function(b){function d(b){var e=b.value,f=e.key;if(b&&null!=f)if(null!=a){if(0==cg(c,e))return}else if(this.p&&(!this.reverse&&this.p.lowerOpen&&null!=this.p.lower&&(e=L(f,this.p.lower),0==e)||this.reverse&&this.p.upperOpen&&null!=this.p.upper&&(e=L(f,this.p.upper), -0==e)))return;return Yf(this,b)}this.Za=dg(b,this.m);this.ca=eg(this.Za,this.I);this.reverse?Zf(this.ca,ka(d,this),c):$f(this.ca,ka(d,this),c);ag(this)},this)};l.clear=function(){throw new Hb;};l.Da=function(){throw new Hb;};l.toString=function(){return"Simple"+Wf.r.toString.call(this)};function fg(a,b,c){a=["ydn.db",a];t(b)&&(a.push(b),t(c)&&(a.push(c),t(void 0)&&a.push(bd(void 0))));return a.join("^|")};function Z(a,b){this.key=a;this.a=b}Z.prototype.toString=function(){return"ydn.db.con.simple.Node("+this.key+(null!=this.a?", "+this.a+")":")")};function cg(a,b){var c=L(a.key,b.key);return 0===c?null!=a.a?null!=b.a?L(a.a,b.a):1:null!=b.a?-1:0:c};function gg(a){this.L=a||hg}function hg(a,b){return String(a)String(b)?1:0}l=gg.prototype;l.s=null;l.L=null;l.U=null;l.T=null; -l.add=function(a){if(null==this.s)return this.T=this.U=this.s=new ig(a),!0;var b=null;jg(this,function(c){var d=null,e=this.L(c.value,a);0e&&(d=c.right,null==c.right&&(b=new ig(a,c),c.right=b,c==this.T&&(this.T=b)));return d});b&&(jg(this,function(a){a.count++;return a.parent},b.parent),kg(this,b.parent));return!!b}; -function lg(a,b){jg(a,function(a){var d=null,e=this.L(a.value,b);0e?d=a.right:mg(this,a);return d})}l.clear=function(){this.T=this.U=this.s=null};l.contains=function(a){var b=!1;jg(this,function(c){var d=null,e=this.L(c.value,a);0e?d=c.right:b=!0;return d});return b};l.indexOf=function(a){var b=-1,c=0;jg(this,function(d){var e=this.L(d.value,a);if(0e)return c++,d.right;b=c;return null});return b}; -l.mb=function(){return this.s?this.s.count:0};l.Oa=function(){var a=[];ng(this,function(b){a.push(b)});return a};function ng(a,b){if(a.s){var c,d=c=og(a);for(c=c.left?c.left:c;null!=d;)if(null!=d.left&&d.left!=c&&d.right!=c)d=d.left;else{if(d.right!=c&&b(d.value))break;var e=d,d=null!=d.right&&d.right!=c?d.right:d.parent;c=e}}}function jg(a,b,c){for(c=c?c:a.s;c&&null!=c;)c=b.call(a,c)} -function kg(a,b){jg(a,function(a){var b=a.left?a.left.height:0,e=a.right?a.right.height:0;1this.L(a.value,c)?b=a.right:d=a;return b}),!d)return}else d=og(a);a=d;for(var e=d.left?d.left:d;null!=a;)if(null!=a.left&&a.left!=e&&a.right!=e)a=a.left;else{if(a.right!=e&&b(a))return;var f=a;a=null!=a.right&&a.right!=e?a.right:a.parent;e=f}b(null)}} -function Zf(a,b,c){if(a.s){var d;if(c instanceof ig)d=c;else if(c){if(jg(a,ka(function(a){var b=null;0this.L(a.value,c)&&(b=a.right),d=a);return b},a)),!d)return}else d=tg(a);a=d;for(var e=d.right?d.right:d;null!=a;)if(null!=a.right&&a.right!=e&&a.left!=e)a=a.right;else{if(a.left!=e&&b(a))return;var f=a;a=null!=a.left&&a.left!=e?a.left:a.parent;e=f}b(null)}};function vg(a,b,c){this.f=a;this.storage=b;this.b=c;this.a={};a=this.b.keyPath;this.c=u(a)?a.join(","):a||"_ROWID_";this.a[this.c]=null;this.d=fg(this.f,this.b.getName(),this.c)+"^|"} -function eg(a,b){var c=b||a.c;if(!a.a[c]){a.a[c]=new ug(cg);for(var d=a.storage.length,e=0;eg.length&&(g.push(b.key),h.push(bf(p))))}},d);if(10>g.length)for(c=0;c=f)return!0}}var n=[],q,p=!!k&&null!=k[0];c=c||a.c;var r=c!=a.c;c=eg(a,c);var x=null,A=null;t(g)||(g=0);var E=-1,D=!1,F=!1;null!=d&&(null!=d.lower&&(x=r&&e?new Z(d.lower,"\uffff"):new Z(d.lower)),null!=d.upper&&(A=r&&!e?new Z(d.upper,"\uffff"):new Z(d.upper)),D=!!d.lowerOpen,F=!!d.upperOpen);if(p){e?F=!0:D=!0;d=k[0];var R=t(k[1])?k[1]:"\uffff";e?A=r?new Z(d,R):new Z(d):x=r?new Z(d,R):new Z(d)}e? -Zf(c,m,A):$f(c,m,x);return n}vg.prototype.fa=function(a,b,c,d,e){return Bg(this,2,a,b,c,d,e)};vg.prototype.toString=function(){return"ydn.db.con.simple.Store:"+this.f+":"+this.b.getName()};function Cg(){this.clear()}l=Cg.prototype;l.ib=function(){return this};l.setItem=function(a,b){t(this.a[a])||(this.keys.push(a.toString()),this.length=this.keys.length);this.a[a]=b};l.getItem=function(a){return t(this.a[a])?this.a[a]:null};l.removeItem=function(a){delete this.a[a];qb(this.keys,a.toString());this.length=this.keys.length};l.length=0;l.key=function(a){a=this.keys[a];return t(a)?this.a[a]:null};l.clear=function(){this.a={};this.keys=[];this.length=0};function Dg(a){this.e=a||new Cg;this.f={}}function dg(a,b){var c=X(a.a,b);if(c)a.f[b]||(a.f[b]=new vg(a.d,a.c,c));else throw new Jb('store name "'+b+'" not found.');return a.f[b]}Dg.prototype.K=function(a){var b=this;setTimeout(function(){var c=fg(b.d),c=b.c.getItem(c),c=new Df(c);a(c)},10)};function Eg(a,b){this.b=a;this.a=b}Eg.prototype.j=function(a,b){var c=this.b;setTimeout(function(){a.call(b,c)},4);var d=this;return function(){d.a("complete",null);d.a=null;d.b=null}};function Fg(a,b){this.a=b}z(Fg,ne);l=Fg.prototype;l.logger=G("ydn.db.crud.req.SimpleStore");l.sb=function(a,b,c){this.S(a,!0,!1,null,b,c)}; -l.S=function(a,b,c,d,e,f){I(this.logger,S(a)+" "+(b?"put":"add")+"Object"+(c?"":"s "+e.length+" objects"));var g=a.a.j(function(h){var k;if(c)k=dg(h,d),h=f?f[0]:void 0,h=Xf(k,h,e[0],!b),null!=h?P(a,h):(k=Ke(h),k=new be(k),P(a,k,!0));else{for(var m=d,n=[],q=!1,p=f||{},r=0;rp.rowsAffected&&(r=!0,aa=new be(aa+" no-op"));for(var ib=0,Cd=h.a.length;ibb&&b -b&&bh&&h=b.length)P(a,f,g);else{var k=X(e.a,b[h].m),m=Xc(b[h].id,k.type),n=" WHERE "+k.d+" = ?",q="DELETE FROM "+uf(k)+n,p=S(a)+" SQL: "+q+" PARAMS: "+[m];d.executeSql(q,[m],function(){f++;c(h)},function(a,b){H(e.logger,"error: "+p+b.message);g=!0;c(h);return!1});h++;for(var q=function(b){b="ydn.db.me:"+k.getName()+":"+b.getName();b="DELETE FROM "+Ha(b)+n;I(e.logger,S(a)+NaN+b);d.executeSql(b,[m])},r=0,x=k.a.length;r=|=|>|<)(.+)/i;if(0d?c:d:d}};function $g(a,b){this.a=b}z($g,Uf);$g.prototype.logger=G("ydn.db.sql.req.IndexedDb");$g.prototype.executeSql=function(a,b,c){if(c=Rg(b,c))throw new je(c);c=sb(b.a);if(1==c.length){var d=X(this.a,c[0]);if(!d)throw new ge(c[0]);var e=Tg(b);if(e)for(var f=0;fh.version){var k=h.setVersion(b.version);k.a=function(a){H(e.logger,"migrating from "+h.version+" to "+b.version+" failed.");d(null,a)};k.onsuccess=function(){c(h,k.transaction,!0)}}else b.version==h.version?Lc(e.logger,Cc,"database version "+h.version+" ready to go"):H(e.logger,"connected database version "+h.version+" is higher than requested version."),e.K(function(a){a=Ef(b,a,!1,!0);0g.version)c(NaN,new de("existing version "+g.version+" is larger than "+this.a.version));else{var h= -this.a.version;this.b=t(h)?h:g.version+1;for(h=0;hthis.d)throw Error("[goog.structs.SimplePool] Initial cannot be greater than max");for(var c=0;ca&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a}function vh(a){a=Math.round(a);return String(100+a/1E3%60).substring(1,3)+"."+String(1E3+a%1E3).substring(1,4)}new qh;var wh=!cc||cc&&9<=nc,xh=cc&&!lc("9");!ec||lc("528");dc&&lc("1.9b")||cc&&lc("8")||bc&&lc("9.5")||ec&&lc("528");dc&&!lc("8")||cc&&lc("9");function yh(a){yh[" "](a);return a}yh[" "]=function(){};function zh(a,b){df.call(this,a?a.type:"");this.a=this.target=null;this.clientY=this.clientX=0;this.b=null;if(a){this.type=a.type;this.target=a.target||a.srcElement;this.a=b;var c=a.relatedTarget;if(c&&dc)try{yh(c.nodeName)}catch(d){}this.clientX=void 0!==a.clientX?a.clientX:a.pageX;this.clientY=void 0!==a.clientY?a.clientY:a.pageY;this.b=a;a.defaultPrevented&&this.preventDefault()}}z(zh,df); -zh.prototype.preventDefault=function(){zh.r.preventDefault.call(this);var a=this.b;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,xh)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Ah="closure_listenable_"+(1E6*Math.random()|0),Bh=0;function Ch(a,b,c,d,e){this.ga=a;this.a=null;this.src=b;this.type=c;this.Fa=!!d;this.Pa=e;this.key=++Bh;this.oa=this.Ea=!1}function Dh(a){a.oa=!0;a.ga=null;a.a=null;a.src=null;a.Pa=null};function Eh(a){this.src=a;this.a={};this.b=0}Eh.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=Fh(a,b,d,e);-1c.keyCode||void 0!=c.returnValue)){a:{var f=!1;if(0==c.keyCode)try{c.keyCode=-1;break a}catch(g){f=!0}if(f||void 0==c.returnValue)c.returnValue=!0}c=[];for(f=d.a;f;f=f.parentNode)c.push(f);for(var f=a.type,h=c.length-1;0<=h;h--)d.a=c[h],e&=Uh(c[h],f,!0,d);for(h=0;h>>0);function Lh(a){return fa(a)?a:a[Wh]||(a[Wh]=function(b){return a.handleEvent(b)})};function Xh(){qd.call(this);this.Z=new Eh(this);this.b=this;this.a=null}z(Xh,qd);Xh.prototype[Ah]=!0;Xh.prototype.addEventListener=function(a,b,c,d){Kh(this,a,b,c,d)};Xh.prototype.removeEventListener=function(a,b,c,d){Sh(this,a,b,c,d)};Xh.prototype.$=function(){Xh.r.$.call(this);if(this.Z){var a=this.Z,b=0,c;for(c in a.a){for(var d=a.a[c],e=0;ee;e++){var f;if(f="_ROWID_"!=c[e]){f=b;var g=c[e];f=!(t(f.keyPath)&&(1== -f.e.length?f.keyPath===g:v(g)&&tb(f.e,g)))}if(f&&c[e]!=d)throw new C('select field name must be "'+d+'", but "'+c[e]+'" found.');}d=3}else throw new C("Selecting more than 2 field names is not supported, but "+c.length+" fields selected.");return new $(this.db,this.b,d,a)};l.jc=function(a){a=a||100;var b=4,c=oi(this);this.c&&this.c[0]&&(c=c.Ob(this.c[0],this.c[1]));if(2==this.type||3==this.type||1==this.type)b=this.type;a=cf(this.db,b,c,a);a.C(function(){"rest"==c.f&&(this.c=[c.g,c.h])},this);return a}; -l.nb=function(){return[this.a.clone()]};function oi(a){return hi(a.a,!(2==a.type||3==a.type||1==a.type))} -l.Yb=function(a,b){var c=oi(this);c.a&&(c=new N(c.c,c.d,c.b,c.V(),c.qa(),!1,c.e));if(1>arguments.length)throw new C("too few arguments");if(2==arguments.length){if(!w(a)&&u(a)){if(!u(b))throw new C("an array is expected for second argument but, "+Ke(b)+" of type "+typeof b+" found");if(a.length!=b.length)throw new C("length of two input arguments must be equal but, "+a.length+" and "+b.length+" found");}}else if(1==arguments.length){if(!y(a))throw new C("an object is expected but, "+Ke(a)+" of type "+ -typeof a+" found");}else throw new C("too many arguments");var d=this.db.open(function(c){var f=c.aa();if(w(a))$c(f,a,b);else if(u(a))for(var g=0;ga?"0"+a:String(a)}function ui(a,b){var c=(a.e-b)/1E3,d=c.toFixed(3),e=0;if(1>c)e=2;else for(;100>c;)e++,c*=10;for(;0',ua(Da(va(a.d))));this.b&&a.b&&c.push("
",ua(Da(a.a||"")));c.push("");c.push("
");return c.join("")};function wi(a){ri.call(this,a)}z(wi,ri); -wi.prototype.c=function(a){var b=[];b.push(this.d," ");this.a&&b.push("[",si(a),"] ");b.push("[",ui(a,this.f.get()),"s] ");b.push("[",a.c,"] ");b.push(a.d);this.b&&a.b&&b.push("\n",a.a);b.push("\n");return b.join("")};function xi(){this.f=ka(this.e,this);this.a=new wi;this.a.a=!1;this.b=this.a.b=!1;this.c="";this.d={}}xi.prototype.e=function(a){if(!this.d[a.c]){var b=this.a.c(a),c=yi;if(c)switch(a.f){case wc:zi(c,"info",b);break;case xc:zi(c,"error",b);break;case yc:zi(c,"warn",b);break;default:zi(c,"debug",b)}else window.opera?window.opera.postError(b):this.c+=b}};var yi=window.console;function zi(a,b,c){if(a[b])a[b](c);else a.log(c)};var Ai=!cc||cc&&9<=nc;!dc&&!cc||cc&&cc&&9<=nc||dc&&lc("1.9.1");cc&&lc("9");function Bi(a,b){Mb(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in Ci?a.setAttribute(Ci[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})}var Ci={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"}; -function Di(a,b,c){function d(c){c&&b.appendChild(w(c)?a.createTextNode(c):c)}for(var e=2;e");f=f.join("")}f=d.createElement(f);g&&(w(g)?f.className=g:u(g)?f.className=g.join(" "):Bi(f,g));2=this.a.scrollHeight-this.a.scrollTop-this.a.clientHeight,c=this.d.createElement("div");c.className="logmsg";c.innerHTML=this.b.c(a);this.a.appendChild(c);b&&(this.a.scrollTop=this.a.scrollHeight)};Hi.prototype.clear=function(){this.a.innerHTML=""};var Ii=null,Ji=null;G("ydn.debug");na("ydn.debug.log",function(a,b,c){if(ea(b))b=new vc("log",b);else if(w(b)){b=b.toUpperCase();if(!Fc){Fc={};for(var d=0,e;e=Ec[d];d++)Fc[e.value]=e,Fc[e.name]=e}b=Fc[b]||null}else b=Bc;G(a||"ydn").b=b;t(c)?Ji||(a=Ji=new Hi(c),!0!=a.c&&(c=Kc(),b=a.f,c.a||(c.a=[]),c.a.push(b),a.c=!0),Kc().b=yc):Ii||Ji||(a=Ii=new xi,!0!=a.b&&(c=Kc(),b=a.f,c.a||(c.a=[]),c.a.push(b),a.b=!0),Kc().b=yc)});na("ydn.db.Storage",$h);})(); - - //# sourceMappingURL=ydn.db-dev.js.map - \ No newline at end of file diff --git a/src/index.html b/src/index.html index bd4bf7fb1..fa07d2622 100644 --- a/src/index.html +++ b/src/index.html @@ -34,8 +34,6 @@ })(); - - diff --git a/src/providers/update-manager.ts b/src/providers/update-manager.ts index 24ddb9f79..5aec55467 100644 --- a/src/providers/update-manager.ts +++ b/src/providers/update-manager.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable } from '@angular/core'; -import { CoreAppProvider } from './app'; import { CoreConfigProvider } from './config'; import { CoreFilepoolProvider } from './filepool'; import { CoreInitHandler, CoreInitDelegate } from './init'; @@ -24,7 +23,6 @@ import { CoreUtilsProvider } from './utils/utils'; import { CoreTimeUtilsProvider } from './utils/time'; import { CoreConfigConstants } from '../configconstants'; import { AddonCalendarProvider } from '@addon/calendar/providers/calendar'; -import { SQLiteDB } from '@classes/sqlitedb'; /** * Data to migrate a store of Ionic 1 app to the SQLite DB. @@ -315,7 +313,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { constructor(logger: CoreLoggerProvider, private configProvider: CoreConfigProvider, private sitesProvider: CoreSitesProvider, private filepoolProvider: CoreFilepoolProvider, private notifProvider: CoreLocalNotificationsProvider, - private utils: CoreUtilsProvider, private appProvider: CoreAppProvider, private timeUtils: CoreTimeUtilsProvider, + private utils: CoreUtilsProvider, private timeUtils: CoreTimeUtilsProvider, private calendarProvider: AddonCalendarProvider) { this.logger = logger.getInstance('CoreUpdateManagerProvider'); } @@ -330,20 +328,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { const promises = [], versionCode = CoreConfigConstants.versioncode; - return this.configProvider.get(this.VERSION_APPLIED, 0).then((versionApplied) => { - if (!versionApplied) { - // No version applied, either the app was just installed or it's being updated from Ionic 1. - return this.migrateAllDBs().then(() => { - // Now that the DBs have been migrated, migrate the local notification components names. - return this.migrateLocalNotificationsComponents(); - }).then(() => { - // DBs migrated, get the version applied again. - return this.configProvider.get(this.VERSION_APPLIED, 0); - }); - } else { - return versionApplied; - } - }).then((versionApplied: number) => { + return this.configProvider.get(this.VERSION_APPLIED, 0).then((versionApplied: number) => { if (versionCode >= 2013 && versionApplied < 2013 && versionApplied > 0) { promises.push(this.migrateFileExtensions()); @@ -419,134 +404,6 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { this.localNotificationsComponentsMigrate[oldName] = newName; } - /** - * Migrate all DBs and tables from the old format to SQLite. - * - * @return Promise resolved when done. - */ - protected migrateAllDBs(): Promise { - if (!( window).ydn) { - // The ydn-db library is not loaded, stop. - return Promise.resolve(); - } - - // First migrate the app DB. - return this.migrateAppDB().then(() => { - // Now migrate all site DBs. - return this.sitesProvider.getSitesIds(); - }).then((ids) => { - const promises = []; - - ids.forEach((id) => { - promises.push(this.migrateSiteDB(id)); - }); - - return this.utils.allPromises(promises); - }); - } - - /** - * Migrate the app DB. - * - * @return Promise resolved when done. - */ - protected migrateAppDB(): Promise { - const oldDb = new ( window).ydn.db.Storage('MoodleMobile'), - newDb = this.appProvider.getDB(); - - return this.migrateDB(oldDb, newDb, this.appDBTables); - } - - /** - * Migrate the DB of a certain site. - * - * @param siteId The site ID. - * @return Promise resolved when done. - */ - protected migrateSiteDB(siteId: string): Promise { - // Get the site DB. - return this.sitesProvider.getSiteDb(siteId).then((newDb) => { - const oldDb = new ( window).ydn.db.Storage('Site-' + siteId); - - return this.migrateDB(oldDb, newDb, this.siteDBTables); - }); - } - - /** - * Migrate all the tables of a certain DB to the SQLite DB. - * - * @param oldDb The old DB (created using ydn-db). - * @param newDb The new DB. - * @param tables The tables to migrate. - * @return Promise resolved when done. - */ - protected migrateDB(oldDb: any, newDb: SQLiteDB, tables: CoreUpdateManagerMigrateTable[]): Promise { - if (!oldDb || !newDb) { - // Some of the DBs doesn't exist, stop. - return Promise.resolve(); - } - - const promises = []; - - tables.forEach((table) => { - - // Get current values. - promises.push(Promise.resolve(oldDb.values(table.name, undefined, 99999999)).then((entries) => { - const fields = table.fields || [], - filterFields = table.filterFields || []; - - // Treat the entries. - for (let i = 0; i < entries.length; i++) { - const entry = entries[i]; - - // Convert and rename the fields to match the new schema. - fields.forEach((field) => { - const value = entry[field.name]; - - // Convert the field to the right format. - if (field.type == 'object' || (field.type == 'any' && typeof value == 'object')) { - entry[field.name] = JSON.stringify(value); - } else if (field.type == 'date' && value) { - entry[field.name] = value.getTime(); - } else if (field.type == 'boolean' || (field.type == 'any' && typeof value == 'boolean')) { - entry[field.name] = value ? 1 : 0; - } - - if (field.newName) { - // Rename the field. - entry[field.newName] = entry[field.name]; - delete entry[field.name]; - } - - if (field.delete) { - // Delete the field. - delete entry[field.name]; - } - }); - - // Remove invalid and unneeded properties. - for (const name in entry) { - if (name.indexOf('$') === 0) { - // Property not valid, remove. - delete entry[name]; - - } else if (filterFields.length && filterFields.indexOf(name) == -1) { - // The property isn't present in filterFields, remove it. - delete entry[name]; - } - } - } - - // Now store the entries in the new DB. - return newDb.insertRecords(table.newName || table.name, entries); - }).catch((error) => { - this.logger.error('Error migrating table ' + table.name + ' to ' + (table.newName || table.name) + ': ', error); - })); - }); - - return this.utils.allPromises(promises); - } - /** * Migrates files filling extensions. * @@ -564,30 +421,6 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { }); } - /** - * Migrate local notifications components from the old nomenclature to the new one. - * - * @return Promise resolved when done. - */ - protected migrateLocalNotificationsComponents(): Promise { - if (!this.notifProvider.isAvailable()) { - // Local notifications not available, nothing to do. - return Promise.resolve(); - } - - const promises = []; - - for (const oldName in this.localNotificationsComponentsMigrate) { - const newName = this.localNotificationsComponentsMigrate[oldName]; - - promises.push(this.notifProvider.updateComponentName(oldName, newName).catch((error) => { - this.logger.error('Error migrating local notif component from ' + oldName + ' to ' + newName + ': ', error); - })); - } - - return Promise.all(promises); - } - /** * Calendar default notification time is configurable from version 3.2.1, and a new option "Default" is added. * All events that were configured to use the fixed default time should now be configured to use "Default" option.