if(!self.window){window=self;} (function(){'use strict';function aa(){return function(){}}function ba(a){return function(b){this[a]=b}}function h(a){return function(){return this[a]}}function m(a){return function(){return a}}var n,ca=this||self;function q(a){return void 0!==a}function da(a){return"string"==typeof a}function ea(){} function fa(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 ha(a){return null!=a}function ia(a){var b=fa(a);return"array"==b||"object"==b&&"number"==typeof a.length}function ja(a){return"function"==fa(a)}function ka(a){return a[la]||(a[la]=++ma)}var la="closure_uid_"+(1E9*Math.random()>>>0),ma=0;function oa(a,b,c){return a.call.apply(a.bind,arguments)} function pa(a,b,c){if(!a)throw Error();if(2=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)}function za(a){for(var b=[],c=0;cb?1:0};function Na(){}Na.prototype.Ab=function(){return this};(new Na).Ab("");function Oa(){}Oa.prototype.Ab=function(){return this};(new Oa).Ab("");var Pa;a:{var Qa=ca.navigator;if(Qa){var Ra=Qa.userAgent;if(Ra){Pa=Ra;break a}}Pa=""}function v(a){return Ka(Pa,a)};function Sa(){return v("Safari")&&!(Ua()||v("Coast")||v("Opera")||v("Edge")||v("Edg/")||v("OPR")||v("Firefox")||v("FxiOS")||v("Silk")||v("Android"))}function Ua(){return(v("Chrome")||v("CriOS"))&&!v("Edge")};function Va(){this.lf="";this.Ef=Wa}function Xa(){var a=Ya;if(a instanceof Va&&a.constructor===Va&&a.Ef===Wa)return a.lf;fa(a);return"type_error:SafeHtml"}var Wa={};Va.prototype.Ab=function(a){this.lf=a;return this};(new Va).Ab("");var Ya=(new Va).Ab("");(new Va).Ab("
");function Za(a){var b=new Ha;b.mf=Fa instanceof Ca&&Fa.constructor===Ca&&Fa.Ff===Ea?Fa.yf:"type_error:Const";b.Bf?b=b.Bf:(b instanceof Ha&&b.constructor===Ha&&b.Gf===Ia?b=b.mf:(fa(b),b="type_error:TrustedResourceUrl"),b=b.toString());a.src=b};function $a(a){ca.setTimeout(function(){throw a;},0)}var ab; function bb(){var a=ca.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!v("Presto")&&(a=function(){var e=document.createElement("IFRAME");e.style.display="none";Za(e);document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.write(Xa());e.close();var g="callImmediate"+Math.random(),k="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;e=qa(function(l){if(("*"==k||l.origin==k)&&l.data== g)this.port1.onmessage()},this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,k)}}});if("undefined"!==typeof a&&!v("Trident")&&!v("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(q(c.next)){c=c.next;var e=c.Ge;c.Ge=null;e()}};return function(e){d.next={Ge:e};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(e){var f=document.createElement("SCRIPT"); f.onreadystatechange=function(){f.onreadystatechange=null;f.parentNode.removeChild(f);f=null;e();e=null};document.documentElement.appendChild(f)}:function(e){ca.setTimeout(e,0)}};function cb(){this.Cd=this.pc=null}var eb=new Ba(function(){return new db},function(a){a.reset()});cb.prototype.add=function(a,b){var c=eb.get();c.set(a,b);this.Cd?this.Cd.next=c:this.pc=c;this.Cd=c};cb.prototype.remove=function(){var a=null;this.pc&&(a=this.pc,this.pc=this.pc.next,this.pc||(this.Cd=null),a.next=null);return a};function db(){this.next=this.scope=this.Ud=null}db.prototype.set=function(a,b){this.Ud=a;this.scope=b;this.next=null}; db.prototype.reset=function(){this.next=this.scope=this.Ud=null};function fb(a,b){gb||hb();jb||(gb(),jb=!0);kb.add(a,b)}var gb;function hb(){if(ca.Promise&&ca.Promise.resolve){var a=ca.Promise.resolve(void 0);gb=function(){a.then(lb)}}else gb=function(){var b=lb;!ja(ca.setImmediate)||ca.Window&&ca.Window.prototype&&!v("Edge")&&ca.Window.prototype.setImmediate==ca.setImmediate?(ab||(ab=bb()),ab(b)):ca.setImmediate(b)}}var jb=!1,kb=new cb;function lb(){for(var a;a=kb.remove();){try{a.Ud.call(a.scope)}catch(b){$a(b)}eb.put(a)}jb=!1};function w(a,b){this.Sa=0;this.rf=void 0;this.Wc=this.dc=this.C=null;this.fd=this.Sd=!1;if(a!=ea)try{var c=this;a.call(b,function(d){mb(c,2,d)},function(d){mb(c,3,d)})}catch(d){mb(this,3,d)}}function nb(){this.next=this.context=this.ic=this.Ic=this.child=null;this.Fd=!1}nb.prototype.reset=function(){this.context=this.ic=this.Ic=this.child=null;this.Fd=!1};var ob=new Ba(function(){return new nb},function(a){a.reset()});function pb(a,b,c){var d=ob.get();d.Ic=a;d.ic=b;d.context=c;return d} function x(a){if(a instanceof w)return a;var b=new w(ea);mb(b,2,a);return b}function qb(a){return new w(function(b,c){c(a)})}function rb(a,b,c){sb(a,b,c,null)||fb(ra(b,a))}function tb(a){return new w(function(b,c){var d=a.length,e=[];if(d)for(var f=function(p,r){d--;e[p]=r;0==d&&b(e)},g=function(p){c(p)},k=0,l;kg[k][l-1]?k--:l--;return p}function Gb(a){return wa(arguments,function(b,c){return b+c},0)} function Hb(a){return Gb.apply(null,arguments)/arguments.length}function Ib(a){var b=arguments.length;if(2>b)return 0;var c=Hb.apply(null,arguments);return Gb.apply(null,va(arguments,function(d){return Math.pow(d-c,2)}))/(b-1)}function Jb(a){return Math.sqrt(Ib.apply(null,arguments))};var Kb="StopIteration"in ca?ca.StopIteration:{message:"StopIteration",stack:""};function Lb(){}Lb.prototype.next=function(){throw Kb;};Lb.prototype.qc=function(){return this};function Mb(a){if(a instanceof Lb)return a;if("function"==typeof a.qc)return a.qc(!1);if(ia(a)){var b=0,c=new Lb;c.next=function(){for(;;){if(b>=a.length)throw Kb;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");} function Nb(a,b){if(ia(a))try{ua(a,b,void 0)}catch(c){if(c!==Kb)throw c;}else{a=Mb(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==Kb)throw c;}}}function Ob(a){if(xa(arguments,function(e){return!e.length})||!arguments.length)return new Lb;var b=new Lb,c=arguments,d=za(c.length);b.next=function(){if(d){for(var e=va(d,function(g,k){return c[k][g]}),f=d.length-1;0<=f;f--){if(d[f]2*this.Fb&&Qb(this),!0):!1};function Qb(a){if(a.Fb!=a.a.length){for(var b=0,c=0;b=d.a.length)throw Kb;var f=d.a[b++];return a?f:d.l[f]};return e};function Sb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Tb(){return v("iPhone")&&!v("iPod")&&!v("iPad")};function Ub(a){var b=Vb;return Object.prototype.hasOwnProperty.call(b,10)?b[10]:b[10]=a(10)};var Wb=v("Opera"),Xb=v("Trident")||v("MSIE"),Yb=v("Edge"),Zb=v("Gecko")&&!(Ka(Pa.toLowerCase(),"webkit")&&!v("Edge"))&&!(v("Trident")||v("MSIE"))&&!v("Edge"),$b=Ka(Pa.toLowerCase(),"webkit")&&!v("Edge"),ac=v("Macintosh"),bc=v("Windows"),cc=v("Android"),dc=Tb(),ec=v("iPad"),fc=v("iPod"),gc; a:{var hc="",ic=function(){var a=Pa;if(Zb)return/rv:([^\);]+)(\)|;)/.exec(a);if(Yb)return/Edge\/([\d\.]+)/.exec(a);if(Xb)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if($b)return/WebKit\/(\S+)/.exec(a);if(Wb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();ic&&(hc=ic?ic[1]:"");if(Xb){var jc,kc=ca.document;jc=kc?kc.documentMode:void 0;if(null!=jc&&jc>parseFloat(hc)){gc=String(jc);break a}}gc=hc}var lc=gc,Vb={};function mc(){return Ub(function(){return 0<=La(lc)})};var nc=function(){if(bc){var a=/Windows NT ([0-9.]+)/;return(a=a.exec(Pa))?a[1]:"0"}return ac?(a=/10[_.][0-9_.]+/,(a=a.exec(Pa))?a[0].replace(/_/g,"."):"10"):cc?(a=/Android\s+([^\);]+)(\)|;)/,(a=a.exec(Pa))?a[1]:""):dc||ec||fc?(a=/(?:iPhone|CPU)\s+OS\s+(\S+)/,(a=a.exec(Pa))?a[1].replace(/_/g,"."):""):""}();var oc=Tb()||v("iPod"),pc=v("iPad");/* Copyright 2015 The Lovefield Project Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function qc(){var a;!(a=Sa()&&!mc())&&(a=pc||oc)&&(a=!(0<=La(nc)));this.be=a;this.ng=!(this.be||Xb&&!mc());this.bh=Ua()||Sa();this.Cg=q(window.Map)&&q(window.Map.prototype.values)&&q(window.Map.prototype.forEach)&&!this.be;this.Dg=q(window.Set)&&q(window.Set.prototype.values)&&q(window.Set.prototype.forEach)&&!this.be}var rc;function sc(){q(rc)||(rc=new qc);return rc};function z(){this.l=new Pb;Object.defineProperty(this,"size",{get:function(){return this.l.zc()}})}z.prototype.clear=function(){this.l.clear()};z.prototype.clear=z.prototype.clear;z.prototype.delete=function(a){return this.l.remove(a)};z.prototype["delete"]=z.prototype.delete;z.prototype.forEach=function(a,b){return this.l.forEach(a,b)};z.prototype.forEach=z.prototype.forEach;z.prototype.get=function(a){return this.l.get(a)};z.prototype.get=z.prototype.get;z.prototype.has=function(a){return this.l.Oa(a)}; z.prototype.has=z.prototype.has;z.prototype.set=function(a,b){return this.l.set(a,b)};z.prototype.set=z.prototype.set;var tc=sc().Cg;function A(){return tc?new window.Map:new z}function uc(a){return a instanceof z?Rb(a.l):Array.from(a.keys())}function B(a){return a instanceof z?a.l.wa():Array.from(a.values())};/* Copyright 2014 The Lovefield Project Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function vc(a,b){this.ra=a;this.m=b||this.Le()}var wc=0;n=vc.prototype;n.id=h("ra");n.Le=function(){return{}};n.Af=h("m");n.Ja=function(){return{id:this.ra,value:this.Af()}};n.nb=function(a){return"#"==a.substr(-1)?this.ra:null};function xc(a){return new vc(a.id,a.value)}function yc(a){return new vc(wc++,a||{})}function zc(a){if(null==a)return null;a=new Uint8Array(a);for(var b="",c=0;cd.length?"0"+d:d}return b};var Ac={};t("lf.TransactionType",Ac);Ac.READ_ONLY=0;Ac.READ_WRITE=1;function C(a,b,c,d,e){this.xd=a;this.rg=b;this.ah=c;this.Yf=d;this.Rf=e}t("lf.TransactionStats",C);C.prototype.Wg=h("xd");C.prototype.success=C.prototype.Wg;C.prototype.qg=h("rg");C.prototype.insertedRowCount=C.prototype.qg;C.prototype.$g=h("ah");C.prototype.updatedRowCount=C.prototype.$g;C.prototype.Xf=h("Yf");C.prototype.deletedRowCount=C.prototype.Xf;C.prototype.Qf=h("Rf");C.prototype.changedTableCount=C.prototype.Qf;function Bc(a,b){this.zd=a;this.Qa=b||null;this.S=ub();this.xd=!1;this.za=null}Bc.prototype.ka=function(){return(0==this.zd?this.sc():Cc(this)).then(function(a){this.xd=!0;return a}.bind(this))};function Cc(a){try{Dc(a.Qa)}catch(b){return qb(b)}return Ec(a).then(function(b){this.Qa.ka();return b}.bind(a))}function Ec(a){Fc(a);Gc(a);return a.sc()} function Fc(a){a.Qa.ib.forEach(function(b,c){c=this.Qa.da().get(c);c=this.I(c.getName(),c.kb.bind(c),0);var d=B(b.va).map(function(f){return f.id()});b=B(b.la).map(function(f){return f[1]}).concat(B(b.ua));var e=0a.size)return!1;var c=!0;b.forEach(function(d){c=c&&a.has(d)});return c};function Wc(a,b){this.ra=a;this.m=b||{}}function Xc(a){var b=D();a.forEach(function(c){b.add(c>>9)});return E(b)}Wc.prototype.W=h("ra");function Yc(a,b){b.forEach(function(c){this.m[c.id()]=c.Ja()},a)}function Zc(a,b){b.forEach(function(c){delete this.m[c]},a)}Wc.prototype.Ja=function(){return{id:this.ra,value:JSON.stringify(this.m)}};function $c(a){return new Wc(a.id,JSON.parse(a.value))};function ad(a,b,c){this.ba=a;this.Pb=b;this.sf=c}n=ad.prototype;n.get=function(a){if(0==a.length)return this.Wd();var b=this.Pb;return bd(this,a).then(function(c){return a.map(function(d){var e=c.get(d>>9);return b(e.m[d])})})};function bd(a,b){var c=A(),d=ub();a=Xc(b).map(function(e){return new w(function(f,g){try{var k=this.ba.get(e)}catch(l){g(l);return}k.onerror=g;k.onsuccess=function(l){l=$c(l.target.result);c.set(l.W(),l);f()}},this)},a);tb(a).then(function(){d.resolve(c)});return d.ha} n.Wd=function(){return new w(function(a,b){var c=[];try{var d=this.ba.openCursor()}catch(e){b(e);return}d.onerror=b;d.onsuccess=function(){var e=d.result;if(e){var f=$c(e.value).m,g;for(g in f)c.push(this.Pb(f[g]));e.continue()}else a(c)}.bind(this)},this)};n.Vb=function(a){return new w(function(b,c){try{var d=a()}catch(e){c(e);return}d.onsuccess=b;d.onerror=c},this)}; n.put=function(a){if(0==a.length)return x();var b=A();a.forEach(function(c){var d=c.id()>>9,e=b.get(d)||null;null===e&&(e=this.sf(this.ba.name,d));Yc(e,[c]);b.set(d,e)},this);a=B(b).map(function(c){return this.Vb(function(){return this.ba.put(c.Ja())}.bind(this))},this);return tb(a)}; n.remove=function(a){if(0==a.length)return this.Vb(function(){return this.ba.clear()}.bind(this));var b=A();a.forEach(function(c){var d=c>>9,e=b.get(d)||null;null===e&&(e=this.sf(this.ba.name,d));Zc(e,[c]);b.set(d,e)},this);a=B(b).map(function(c){return this.Vb(function(){return 0==Object.keys(c.m).length?this.ba.delete(c.W()):this.ba.put(c.Ja())}.bind(this))},this);return tb(a)};function cd(a,b,c){a=a.b(Kc);var d=[c<<9,(c+1<<9)-1];b=a.Ua(b,d[0],d[1]);c=new Wc(c);Yc(c,b);return c} function dd(a,b){return new Wc(b)};function ed(a){this.V=a.b(Kc);this.B=a.b(Lc);this.g=a.b(Pc)}ed.prototype.update=function(a){a.forEach(function(b){fd(this,b);gd(this,b)},this)};function gd(a,b){var c=b.getName();b.va.forEach(function(d,e){this.V.remove(c,e)},a);b.ua.forEach(function(d){this.V.set(c,d)},a);b.la.forEach(function(d){this.V.set(c,d[1])},a)}function fd(a,b){var c=a.g.table(b.getName());hd(b).forEach(function(d){id(this,c,d)},a)} function id(a,b,c){var d=a.B.lc.get(b.getName())||[],e=0;d.forEach(function(f){try{jd(f,c),e++}catch(g){throw d.slice(0,e).forEach(function(k){jd(k,[c[1],c[0]])},this),g;}},a)}function jd(a,b){var c=null===b[1]?void 0:b[1].nb(a.getName()),d=null===b[0]?void 0:b[0].nb(a.getName());if(!q(d)&&q(c))a.add(c,b[1].id());else if(q(d)&&q(c)){if(null===c||null===d){if(c==d)return}else if(0==a.jb().compare(d,c))return;a.add(c,b[1].id());a.remove(d,b[0].id())}else q(d)&&!q(c)&&a.remove(d,b[0].id())};var kd={};t("lf.ConstraintAction",kd);kd.RESTRICT=0;kd.CASCADE=1;var ld={};t("lf.ConstraintTiming",ld);ld.IMMEDIATE=0;ld.DEFERRABLE=1;var md={};t("lf.Order",md);md.DESC=0;md.ASC=1;var nd={};t("lf.Type",nd);nd.ARRAY_BUFFER=0;nd.BOOLEAN=1;nd.DATE_TIME=2;nd.INTEGER=3;nd.NUMBER=4;nd.STRING=5;nd.OBJECT=6;var od={0:null,1:!1,2:Object.freeze(new Date(0)),3:0,4:0,5:"",6:null};t("lf.type.DEFAULT_VALUES",od);function F(a,b){this.message="http://google.github.io/lovefield/error_lookup/src/error_lookup.html?c="+a;if(1a.from||d.o==a.from&&!d.na&&!a.ea}function Rd(){return new Md(G,G,!1,!1)}function Od(a){return a.from==G&&a.o==G}function Sd(a){return a.from==a.o&&a.from!=G&&!a.ea&&!a.na}Md.prototype.contains=function(a){var b=this.o==G||athis.from||a==this.from&&!this.ea)&&b}; function Qd(a,b,c,d,e){function f(g){return c?g:1==g?-1:1}d=d||!1;e=e||!1;return a==G?b==G?(d?!e:e)?d?f(1):f(-1):0:f(-1):b==G?f(1):a=c[0]&&b<=c[1]});a.set("gte",function(b,c){return null===b||null===c?!1:b>=c});a.set("gt",function(b,c){return null===b||null===c?!1:b>c});a.set("in",function(b,c){return-1!=c.indexOf(b)});a.set("lte",function(b,c){return null===b||null===c?!1:b<=c});a.set("lt",function(b,c){return null===b||null===c?!1:b=c[0].getTime()&&b.getTime()<=c[1].getTime()});a.set("eq",function(b,c){return(null===b?-1:b.getTime())==(null===c?-1:c.getTime())});a.set("gte",function(b,c){return null===b||null===c?!1:b.getTime()>=c.getTime()});a.set("gt",function(b,c){return null===b||null===c?!1:b.getTime()>c.getTime()});a.set("in",function(b,c){return c.some(function(d){return d.getTime()==b.getTime()})});a.set("lte", function(b,c){return null===b||null===c?!1:b.getTime()<=c.getTime()});a.set("lt",function(b,c){return null===b||null===c?!1:b.getTime()c&&(c=b[d]);a.oa().forEach(function(e){this.Ya.has(e.getName())||(b[e.getName()]=++c)},this);var d=this.i.child("@table");return $e(d,b)}.bind(this))}; function af(a,b,c){var d=a.Ya.get(b);return null!=d?function(){var e={},f=ub();this.i.orderByChild("T").equalTo(d).once("value",function(g){g.forEach(function(k){var l=c(k.val());e[parseInt(k.key(),10)]=l});f.resolve(e)});return f.ha}.call(a).then(function(e){e["@rev"]={R:++this.Ra};return $e(this.i,e)}.bind(a)):x()}N.prototype.tc=function(a){return af(this,a,m(null)).then(function(){this.Ya.delete(a);return $e(this.i.child("@table/"+a),null,!0)}.bind(this))};N.prototype.dropTable=N.prototype.tc; N.prototype.rc=function(a,b,c){return af(this,a,function(d){var e=d.P;e[b]=c;return{R:this.Ra+1,T:d.T,P:e}}.bind(this))};N.prototype.addTableColumn=N.prototype.rc;N.prototype.uc=function(a,b){return af(this,a,function(c){var d=c.P;delete d[b];return{R:this.Ra+1,T:c.T,P:d}}.bind(this))};N.prototype.dropTableColumn=N.prototype.uc;N.prototype.Lc=function(a,b,c){return af(this,a,function(d){var e=d.P;e[c]=e[b];delete e[b];return{R:this.Ra+1,T:d.T,P:e}}.bind(this))};N.prototype.renameTableColumn=N.prototype.Lc; N.prototype.xb=function(){throw new F(351);};N.prototype.createRow=N.prototype.xb;N.prototype.Cc=h("Ta");N.prototype.getVersion=N.prototype.Cc;N.prototype.ec=function(a){var b=ub();a=this.Ya.get(a);this.i.orderByChild("T").equalTo(a).once("value",function(c){var d=[];c.forEach(function(e){d.push(e.val().P)});b.resolve(d)});return b.ha};N.prototype.dump=function(){var a={},b=uc(this.Ya).map(function(c){return this.ec(c).then(function(d){a[c]=d})}.bind(this));return tb(b).then(function(){return a})}; N.prototype.dump=N.prototype.dump;function bf(a,b,c){Bc.call(this,b,c);this.i=a}u(bf,Bc);bf.prototype.I=function(a){return this.i.Ac(a)}; bf.prototype.sc=function(){if(0==this.zd)return this.S.resolve(),this.S.ha;var a=this.Qa.ib;if(0==a.size)this.S.resolve();else{var b=this.i.Ra+1;this.i.Ra=b;var c={"@rev":{R:b}};a.forEach(function(d,e){var f=this.i.Ya.get(e);d.ua.forEach(function(g,k){c[k]={R:b,T:f,P:g.m}});d.la.forEach(function(g,k){c[k]={R:b,T:f,P:g[1].m}});d.va.forEach(function(g,k){c[k]=null})},this);this.i.i.update(c,function(d){null===d?this.S.resolve():(this.i.Ra=b-1,d=B(a).map(function(e){return cf(this.i,e.getName())},this), tb(d).then(this.S.reject.bind(this.S),this.S.reject.bind(this.S)))}.bind(this))}return this.S.ha};function df(){this.Ba=A()}function ef(a,b){if(0==b.length)return B(a.Ba);var c=[];b.forEach(function(d){d=this.Ba.get(d)||null;null===d||c.push(d)},a);return c}df.prototype.getData=h("Ba");df.prototype.get=function(a){return x(ef(this,a))};function ff(a,b){b.forEach(function(c){this.Ba.set(c.id(),c)},a)}df.prototype.put=function(a){ff(this,a);return x()};function gf(a,b){0==b.length||b.length==a.Ba.size?a.Ba.clear():b.forEach(function(c){this.Ba.delete(c)},a)} df.prototype.remove=function(a){gf(this,a);return x()};function hf(a){return 0==a.Ba.size?0:uc(a.Ba).reduce(function(b,c){return b>c?b:c},0)};function jf(a,b){this.g=a;this.Lf=b;this.Kc=A();this.Ra=-1;this.M=A();this.Ya=A();this.Kd=null}n=jf.prototype; n.Ea=function(a){this.i=this.Lf.child(this.g.name());var b=a||function(){return x()};return Ze(this.i,"@db/version").then(function(c){return null===c?$e(this.i,kf(this),!0).then(function(){var d=new N(0,this.i);return b(d)}.bind(this)).then(function(){return this.Ea()}.bind(this)):c==this.g.version()?Ze(this.i,"@rev/R").then(function(d){this.Ra=d;return Ze(this.i,"@table")}.bind(this)).then(function(d){for(var e in d)this.Ya.set(e,d[e]);d=this.g.oa().map(function(f){return cf(this,f.getName())},this); return tb(d)}.bind(this)).then(function(){mf(this);nf(this);return x()}.bind(this)):this.ie(c,b).then(function(){return this.Ea()}.bind(this))}.bind(this))};n.ie=function(a,b){var c=new N(a,this.i);return c.Ea(this.g).then(function(){return x()}.bind(this)).then(function(){return b(c)}).then(function(){var d=this.i.child("@db");return $e(d,{version:this.g.version()},!0)}.bind(this))}; function nf(a){a.i.off();a.i.on("child_removed",a.Hg.bind(a));a.Ld&&(a.Ld.off(),a.Kc.clear());a.Ld=a.i.orderByChild("R").startAt(a.Ra+1);a.Ld.on("value",a.fe.bind(a))}function mf(a){wc=B(a.M).map(function(b){return hf(b)}).reduce(function(b,c){return b>c?b:c},0)+1}n.Hg=function(a){var b=a.val(),c=this.Kc.get(b.T)||null;null===c&&(c=D(),this.Kc.set(b.T,c));c.add(parseInt(a.key(),10))}; n.fe=function(a){var b=a.child("@rev/R").val();null!=b&&b!=this.Ra&&(this.Ra=b,a=of(this,a),a.forEach(function(c){var d=this.M.get(c.getName()),e=uc(c.va);0this.g.version()?c.reject(new F(108)):c.resolve()}.bind(a),c.reject.bind(c));return c.ha}n.Gb=function(a,b,c){if(null!=this.i)return new If(this.i,a,c);throw new F(2);};n.close=aa(); n.Ac=function(){throw new F(512);};n.subscribe=function(){throw new F(355);};n.Gc=function(){throw new F(355);};n.ie=function(a,b){return Pf(this).then(function(){return a(new P(this.c,b,this.i))}.bind(this))}; function Pf(a){var b=a.g.oa(),c=new If(a.i,1,new Hd(a.c,D())),d=new If(a.i,1,new Hd(a.c,D()));Hf(c,"INSERT OR REPLACE INTO __lf_ver VALUES (0, ?)",[a.g.version()]);Mf(c);return c.ka().then(function(e){var f=e[1];f.filter(function(p){return-1!=p.indexOf("__d__")}).forEach(function(p){Hf(d,'DROP TABLE "'+(p+'"'),[])});var g=[],k=[],l=[];b.map(function(p){-1==f.indexOf(p.getName())&&g.push(p.getName());p.Db&&(p.Da().forEach(function(r){r=Jf(r.j());g.push(r);k.push(r)}),p=Jf(Af(p)),g.push(p),l.push(p))}); g.forEach(function(p){Hf(d,'CREATE TABLE "'+(p+'"(id INTEGER PRIMARY KEY, value TEXT)'),[])});return d.ka()})}n.re=function(){var a=0,b=ub(),c=function(e){var f=new If(this.i,0);Hf(f,'SELECT MAX(id) FROM "'+(e+'"'),[]);return f.ka().then(function(g){g=g[0].rows.item(0)["MAX(id)"];a=Math.max(g,a)})}.bind(this),d=this.g.oa().map(function(e){return c(e.getName())});tb(d).then(function(){wc=Math.max(wc,a+1);b.resolve()},function(e){b.reject(e)});return b.ha};n.Pc=m(!0);function Qf(a){this.l=A();this.nc=A();a.oa().forEach(function(b){this.nc.set(b.getName(),D())},this)}n=Qf.prototype;n.set=function(a,b){this.l.set(b.id(),b);this.nc.get(a).add(b.id())};n.Yb=function(a,b){var c=this.nc.get(a);b.forEach(function(d){this.l.set(d.id(),d);c.add(d.id())},this)};n.get=function(a){return this.l.get(a)||null};function Rf(a,b){return b.map(function(c){return this.get(c)},a)} n.Ua=function(a,b,c){var d=[],e=Math.min(b,c),f=Math.max(b,c);a=this.nc.get(a);if(a.size=e&&g<=f&&(g=this.l.get(g),d.push(g))},this);else for(b=e;b<=f;++b)a.has(b)&&(c=this.l.get(b),d.push(c));return d};n.remove=function(a,b){this.l.delete(b);this.nc.get(a).delete(b)};n.zc=function(){return this.l.size};n.clear=function(){this.l.clear();this.nc.clear()};function Sf(a,b,c){var d=0,e=a.length;for(c=c||Tf;d>1;0>c(a[f],b)?d=f+1:e=f}return d==e&&a[d]==b?d:~d}function Tf(a,b){return a-b}function Uf(a,b,c){c=Sf(a,b,c);return 0>c?(a.splice(-(c+1),0,b),!0):!1};function Vf(a,b,c,d){a=b?a.reverse():a;if(null==c&&null==d)return a;c=Math.min(q(c)?c:a.length,a.length);if(0==c)return[];d=Math.min(d||0,a.length);return a.slice(d,d+c)};function Wf(){this.ia=0;this.Fc=null}Wf.prototype.add=function(a,b){this.ia+=b;this.Fc=null===this.Fc?a:a>this.Fc?a:this.Fc};Wf.prototype.remove=function(a,b){this.ia-=b};Wf.prototype.clear=function(){this.ia=0};function Xf(a,b){a.clear();b.forEach(function(c){this.ia+=c.ia},a)};function Yf(a,b,c){this.A=a;this.Z=b;this.Df=c;this.za=new Wf;this.clear()}var Zf=[];n=Yf.prototype;n.getName=h("A");n.toString=function(){return this.ya.toString()};n.add=function(a,b){this.ya=this.ya.Bb(a,b)};n.set=function(a,b){this.ya=this.ya.Bb(a,b,!0)};n.remove=function(a,b){this.ya=this.ya.remove(a,b)};n.get=function(a){return this.ya.get(a)};n.$c=function(a){if(null==a)return this.Y().ia;if(a instanceof Md){if(Od(a))return this.Y().ia;if(Sd(a))return this.get(a.from).length}return this.Ua([a]).length}; n.Y=h("za");n.Wd=function(a,b,c){var d=Array(a);this.ya.fill({offset:b?this.za.ia-a-c:c,count:a,ue:0},d);return b?d.reverse():d}; n.Ua=function(a,b,c,d){var e=$f(this.ya).a[0];if(!q(e)||0==c)return Zf;b=b||!1;c=null!=c?Math.min(c,this.za.ia):this.za.ia;d=d||0;var f=Math.min(Math.max(this.za.ia-d,0),c);if(0==f)return Zf;if(!q(a)||1==a.length&&a[0]instanceof Md&&Od(a[0]))return this.Wd(f,b,d);a=this.Z.xf(a);var g=Array(b?this.za.ia:f),k={count:0,X:g.length,reverse:b,L:d},l=1k.count&&g.splice(k.count,g.length-k.count);return b?Vf(g,b,c,d):g};n.clear=function(){this.ya=bg(this);this.za.clear()};n.Oa=function(a){return this.ya.Oa(a)};n.min=function(){return this.Hb(this.Z.min.bind(this.Z))};n.max=function(){return this.Hb(this.Z.max.bind(this.Z))}; function cg(a,b,c){if(!a.Z.Pd(b.a[c]))if(1=b.a.length)b=b.xa,c=0;else{var d=cg(this,b,c);if(null!==d){b=d;break a}c++}while(null!==b);b=null}a:{c=dg(this.ya);d=c.a.length-1;do if(0>d)c=c.qb,d=0;else{var e=cg(this,c,d);if(null!==e){c=e;break a}d--}while(null!==c);c=null}return null===b||null===c?null:1==a(b[0],c[0])?b:c};n.Ma=h("Df");n.jb=h("Z"); n.Pa=function(a,b){return null!=a?0==this.Z.compare(a,b):!1};n.Ja=function(){for(var a=[],b=$f(this.ya);b;)a.push(new vc(b.ra,[b.a,b.D])),b=b.xa;return a};function eg(a,b,c,d){a=new Yf(b,a,c);d=fg(d,a);a.ya=d;return a}function gg(a,b){this.ra=a;this.u=b;this.mb=0;this.xa=this.qb=this.C=null;this.a=[];this.D=[];this.h=[];this.fg=1==b.jb().$d()?this.Qe:this.Pe}function bg(a){return new gg(wc++,a)}function hg(a){return 0==a.mb}n=gg.prototype;n.next=h("xa"); function ig(a){function b(g){return null!=g?g.ra.toString():"_"}var c=a.ra+"["+a.a.join("|")+"]",d=a.h.map(function(g){return g.ra}).join("|"),e=a.D.join("/"),f=b(a.qb)+"{";f=hg(a)?f+e:f+d;f=f+"}"+b(a.C);a.xa&&(a=ig(a.xa),c=c+" "+a[0],f=f+" "+a[1]);return[c,f]}n.toString=function(){var a="",b=ig(this);a+=b[0]+"\n"+b[1]+"\n";this.h.length&&(a+=this.h[0].toString());return a};function $f(a){return hg(a)?a:$f(a.h[0])}function dg(a){return hg(a)?a:dg(a.h[a.h.length-1])} function jg(a,b){b&&(b.qb=a);a&&(a.xa=b)}function kg(a){var b=a[0],c=bg(b.u);c.mb=b.mb+1;c.h=a;for(b=0;b=c.length)b=kg(c);else{var d=c.length,e=0;b=bg(a.u);for(b.mb=a.mb+2;0=d?d:257;var f=c.slice(e,e+a),g=kg(f);g.C=b;b.h.length&&(b.a.push(f[0].a[0]),jg(b.h[b.h.length-1],g));b.h.push(g);e+=a;d-=a}}return b} n.get=function(a){var b=mg(this,a);if(hg(this)){var c=Zf;this.u.Pa(this.a[b],a)&&(c=c.concat(this.D[b]));return c}b=this.u.Pa(this.a[b],a)?b+1:b;return this.h[b].get(a)};n.Oa=function(a){var b=mg(this,a);return this.u.Pa(this.a[b],a)?!0:hg(this)?!1:this.h[b].Oa(a)};n.remove=function(a,b){ng(this,a,-1,b);return null===this.C?(a=this,1==this.h.length&&(a=this.h[0],a.C=null),a):this};function og(a){return hg(a)?a.a[0]:og(a.h[0])} function pg(a){a.a=[];for(var b=1;be&&a.u.Pa(a.a[e],b)){if(q(d)&&!a.u.Ma()&&f&&(g=a.D[e],d=Sf(g,d,void 0),0>d?d=!1:(g.splice(d,1),d=!0),d&&a.u.Y().remove(b,1),a.D[e].length))return!1;a.a.splice(e,1);f&&(f=a.u.Ma()?1:a.D[e].length,a.D.splice(e,1),a.u.Y().remove(b,f))}if(256>a.a.length&&null!==a.C){a:{if(a.xa&&256a.xa.a.length){var d=a.xa;var e=c=0}else a.qb&&(d=a.qb,c=d.a.length,e=hg(d)?d.D.length:d.h.length);c=[c,0].concat(a.a);Array.prototype.splice.apply(d.a,c);c=null;hg(a)?c=a.D:(c=a.h,c.forEach(function(f){f.C=d}));c=[e,0].concat(c);Array.prototype.splice.apply(hg(d)?d.D:d.h,c);jg(a.qb,a.xa);hg(d)||pg(d);-1!=b&&(a.C.a.splice(b,1),a.C.h.splice(b,1))} n.Bb=function(a,b,c){var d=mg(this,a);if(hg(this)){if(this.u.Pa(this.a[d],a)){if(c)this.u.Y().remove(a,this.u.Ma()?1:this.D[d].length),this.D[d]=this.u.Ma()?b:[b];else{if(this.u.Ma())throw new F(201,this.u.getName(),JSON.stringify(a));if(!Uf(this.D[d],b))throw new F(109);}this.u.Y().add(a,1);return this}this.a.splice(d,0,a);this.D.splice(d,0,this.u.Ma()?b:[b]);this.u.Y().add(a,1);512==this.a.length?(d=bg(this.u),a=bg(this.u),a.mb=1,a.a=[this.a[256]],a.h=[this,d],a.C=this.C,this.C=a,d.a=this.a.splice(256), d.D=this.D.splice(256),d.C=a,jg(d,this.xa),jg(this,d),d=a):d=this;return d}d=this.u.Pa(this.a[d],a)?d+1:d;a=this.h[d].Bb(a,b,c);hg(a)||1!=a.a.length||(this.a.splice(d,0,a.a[0]),a.h[1].C=this,a.h[0].C=this,this.h.splice(d,1,a.h[1]),this.h.splice(d,0,a.h[0]));return 512==this.a.length?rg(this):this}; function rg(a){var b=bg(a.u),c=bg(a.u);b.C=a.C;b.mb=a.mb+1;b.a=[a.a[256]];b.h=[a,c];a.a.splice(256,1);c.C=b;c.mb=a.mb;c.a=a.a.splice(256);c.h=a.h.splice(257);c.h.forEach(function(d){d.C=c});a.C=b;jg(c,a.xa);jg(a,c);return b}function mg(a,b){for(var c=0,d=a.a.length,e=a.u.jb();c>1;-1==e.compare(a.a[f],b)?c=f+1:d=f}return c}n.Qe=function(a){if(!hg(this)){var b=mg(this,a);this.u.Pa(this.a[b],a)&&b++;return this.h[b].Qe(a)}return this}; n.Pe=function(a){if(!hg(this)){var b=mg(this,a);this.u.Pa(this.a[b],a)&&(a.some(function(c){return c==G})||b++);return this.h[b].Pe(a)}return this}; n.Ua=function(a,b,c){function d(y){return y[0]?y[1]?0:1:-1}var e=this.u.jb(),f=0,g=this.a.length-1,k=this.a,l=d(e.wb(k[f],a)),p=d(e.wb(k[g],a));if(1!=l&&(-1!=l||-1!=p)){var r=function(y,L){L=y+L>>1;return L==y?L+1:L},W=function(y,L,V){if(y>=L)return 0==V?L:-1;var na=d(e.wb(k[y],a));if(0==na)return y;if(1==na)return-1;na=r(y,L);if(na==L)return 0==V?L:-1;var ib=d(e.wb(k[na],a));return 0==ib?W(y,na,ib):-1==ib?W(na+1,L,V):W(y+1,na,ib)},K=function(y,L){if(y>=L)return y;var V=d(e.wb(k[L],a));if(0==V)return L; if(-1==V)return y;V=r(y,L);if(V==L)return y;var na=d(e.wb(k[V],a));return 0==na?K(V,L):1==na?K(y,V-1):-1};0!=l&&(f=W(f+1,g,p));-1!=f&&(g=K(f,g),-1!=g&&g>=f&&sg(this,b,c,f,g+1))}};function ag(a,b,c,d){if(a.u.Ma())!b.reverse&&b.L?b.L--:c[b.count++]=a.D[d];else for(var e=0;e=b.X));++d)ag(a,b,c,d)} n.fill=function(a,b){if(hg(this))for(var c=0;ca.offset)for(var d=this.D[c].length+a.offset;db?1:ab?1:a==b?0:-1};n.Cb=function(a,b){a=this.wb(a,b);return a[0]&&a[1]};n.ld=function(a,b){return this.Cb(a,b)};n.xf=function(a){return a.filter(function(b){return null!==b}).sort(function(b,c){return this.je(b,c)}.bind(this))};n.Yd=function(a){return this.de(a).from==G};n.vd=function(a){a=this.de(a);return[a.from,a.o]};n.Pd=function(a){return null!==a};n.$d=m(1); n.toString=function(){return this.compare==ug?"SimpleComparator_DESC":"SimpleComparator_ASC"};function yg(a){tg.call(this,a);this.Yc=0==a?zg:Ag}u(yg,tg);function Ag(a,b){return null===a?null===b?0:-1:null===b?1:vg(a,b)}function zg(a,b){return Ag(b,a)}yg.prototype.Cb=function(a,b){return null===a?Od(b):yg.hb.Cb.call(this,a,b)};yg.prototype.Hb=function(a,b){return null===a?null===b?0:-1:null===b?1:null};yg.prototype.min=function(a,b){var c=this.Hb(a,b);null===c&&(c=yg.hb.min.call(this,a,b));return c}; yg.prototype.max=function(a,b){var c=this.Hb(a,b);null===c&&(c=yg.hb.max.call(this,a,b));return c};function Bg(a){this.pa=a.map(function(b){return new tg(b)})}function Cg(a,b,c,d){for(var e=0,f=0;fb.entries.length){a:{c=a.ga;a.ga=a.ma;a.ma=c;switch(a.F){case "gt":c="lt";break;case "lt":c="gt";break;case "gte":c="lte";break;case "lte":c="gte";break;default:break a}a.F=c;a.vc=te(se(),a.ga.G(),a.F)}return[b,d]}return[d,b]}function eh(a){var b={};a.lb().forEach(function(c){b[c.getName()]=null});return b} function fh(a,b,c){null===a.ee&&(a.ee=eh(a.ma.I()));var d=new ee(new vc(-1,a.ee),!1);return ie(b,c,d,[ge(a.ma.I())])} function gh(a,b,c,d){var e=[b,c];d||(e=dh(a,b,c));b=e[0];c=e[1];e=b;var f=c,g=a.ga,k=a.ma;d&&(e=c,f=b,g=a.ma,k=a.ga);var l=new pd,p=[];e.entries.forEach(function(K){var y=String(I(K,g));l.set(y,K)});var r=e.s(),W=f.s();f.entries.forEach(function(K){var y=I(K,k),L=String(y);null!==y&&l.has(L)?l.get(L).forEach(function(V){V=ie(K,W,V,r);p.push(V)}):d&&p.push(fh(this,K,W))}.bind(a));a=b.s().concat(c.s());return new H(p,a)} function hh(a,b,c,d,e){function f(K,y){y=new ee(y,1e?f:e});break;case "DISTINCT":d=xh(b,c);break;case "COUNT":d=yh(b,c);break;case "SUM":d=zh(b,c);break;case "AVG":a=yh(b,c);0b.from.length)return a;this.H=a;this.ub(this.H);return this.H};Wh.prototype.ub=function(a){if(a instanceof Kh)for(;2c;c++){var d=ze(a,0);ye(b,d)}xe(a,b,0)}M(a).forEach(function(e){this.ub(e)},this)};function Xh(){S.call(this,2,0)}u(Xh,S);Xh.prototype.toString=m("cross_product");Xh.prototype.ca=function(a){var b=a[0],c=a[1];a=[];for(var d=b.s(),e=c.s(),f=0;f=";case "gt":return">";case "in":return"IN";case "lte":return"<=";case "lt":return"<";case "match":return"LIKE";case "neq":return"<>";default:return"UNKNOWN"}}function li(a,b,c,d){return a instanceof je?"?"+a.Ca().toString():d?null!=a?"#":"NULL":"match"==b?"'"+a.toString()+"'":"in"==b?"("+a.map(function(e){return ii(c,e)}).join(", ")+")":"between"==b?ii(c,a[0])+" AND "+ii(c,a[1]):ii(c,a).toString()} function mi(a,b){return M(a).map(function(c){return"("+ni(c,b)+")"}).join("and"==a.pb?" AND ":" OR ")}function oi(a){return[a.ga.j(),ki(a.F),a.ma.j()].join(" ")}function ni(a,b){if(a instanceof Ee){var c=a.J.j(),d=ki(a.F);a=li(a.value,a.F,a.J.G(),b);return"="==d&&"NULL"==a?[c,"IS NULL"].join(" "):"<>"==d&&"NULL"==a?[c,"IS NOT NULL"].join(" "):[c,d,a].join(" ")}if(a instanceof $g)return mi(a,b);if(a instanceof ch)return oi(a);throw new F(357,typeof a);} function pi(a,b){return(a=ni(a,b))?" WHERE "+a:""}function qi(a,b){var c="UPDATE "+a.table.getName()+" SET ";c+=a.set.map(function(d){var e=d.J.j()+" = ";return-1!=d.Uc?e+"?"+d.Uc.toString():e+ii(d.J.G(),d.value).toString()}).join(", ");a.w&&(c+=pi(a.w,b));return c+";"} function ri(a,b){var c="*";a.f.length&&(c=a.f.map(function(d){return d.Ka?d.j()+" AS "+d.Ka:d.j()}).join(", "));c="SELECT "+c+" FROM ";null!=a.eb&&0!=a.eb.size?c+=si(a,b):(c+=a.from.map(ti).join(", "),a.w&&(c+=pi(a.w,b)));a.N&&(b=a.N.map(function(d){return d.J.j()+(0==d.order?" DESC":" ASC")}).join(", "),c+=" ORDER BY "+b);a.qa&&(b=a.qa.map(function(d){return d.j()}).join(", "),c+=" GROUP BY "+b);a.X&&(c+=" LIMIT "+a.X.toString());a.L&&(c+=" SKIP "+a.L.toString());return c+";"} function ti(a){return ge(a)!=a.getName()?a.getName()+" AS "+ge(a):a.getName()}function si(a,b){for(var c=Tg(a.w,function(k){return k instanceof ch}),d=c.map(oi),e=ti(a.from[0]),f=1;fa)throw new F(531);this.query.X=a}return this};U.prototype.limit=U.prototype.X;U.prototype.L=function(a){if(null!=(this.query.L||this.query.Kb))throw new F(529);if(a instanceof je)this.query.Kb=a;else{if(0>a)throw new F(531);this.query.L=a}return this};U.prototype.skip=U.prototype.L; U.prototype.N=function(a,b){Fi(this,549);null==this.query.N&&(this.query.N=[]);this.query.N.push({J:a,order:null!=b?b:1});return this};U.prototype.orderBy=U.prototype.N;U.prototype.qa=function(a){Fi(this,549);if(null!=this.query.qa)throw new F(530);null==this.query.qa&&(this.query.qa=[]);this.query.qa.push.apply(this.query.qa,Array.prototype.slice.call(arguments));return this};U.prototype.groupBy=U.prototype.qa; function Ei(a,b){switch(a){case "COUNT":case "DISTINCT":return!0;case "AVG":case "GEOMEAN":case "STDDEV":case "SUM":return 4==b||3==b;case "MAX":case "MIN":return 4==b||3==b||5==b||2==b}return!1}U.prototype.clone=function(){var a=new U(this.global,this.query.f);a.query=this.query.clone();a.query.Xc=null;return a};U.prototype.clone=U.prototype.clone;function Hi(a,b){T.call(this,a,new ei(a.b(Pc)));this.query.table=b}u(Hi,T);t("lf.query.UpdateBuilder",Hi);Hi.prototype.set=function(a,b){a={Uc:b instanceof je?b.Ca():-1,J:a,value:b};null!=this.query.set?this.query.set.push(a):this.query.set=[a];return this};Hi.prototype.set=Hi.prototype.set;Hi.prototype.w=function(a){this.Gd();this.query.w=a;return this};Hi.prototype.where=Hi.prototype.w;Hi.prototype.Gd=function(){if(null!=this.query.w)throw new F(516);}; Hi.prototype.$a=function(){Hi.hb.$a.call(this);if(null==this.query.set)throw new F(532);if(this.query.set.some(function(a){return a.value instanceof je}))throw new F(501);};function Ii(a){this.query=a;this.Ha=null}Ii.prototype.gc=function(){null===this.Ha&&(this.Ha=this.bd());return this.Ha};function Ji(a){Ii.call(this,a)}u(Ji,Ii);Ji.prototype.bd=function(){return this.query.ac?new Fh(this.query.La,this.query.values):new Eh(this.query.La,this.query.values)};function Ki(a){Ii.call(this,a)}u(Ki,Ii); Ki.prototype.bd=function(){var a=new Hh(this.query.table),b=null!=this.query.w?new Ih(this.query.w.Ob()):null,c=new Jh(this.query.table);null===b?ye(a,c):(ye(b,c),ye(a,b));return a};function Li(a,b,c){this.Ha=a;this.me=b;this.Xb=c}Li.prototype.gc=function(){this.Xb.forEach(function(a){this.Ha=a.gb(this.Ha,this.me)},this);return this.Ha};function Mi(a,b){Ii.call(this,a);this.Xb=b}u(Mi,Ii);Mi.prototype.bd=function(){var a=new Gh(this.query.from),b=null!=this.query.w?new Ih(this.query.w.Ob()):null,c=new Jh(this.query.from);null===b?ye(a,c):(ye(b,c),ye(a,b));return(new Li(a,this.query,this.Xb)).gc()};function Ni(){}u(Ni,Sh);Ni.prototype.gb=function(a,b){if(2>b.from.length)return a;this.H=a;this.ub(this.H,b);return this.H};Ni.prototype.ub=function(a,b){if(a instanceof Ih&&a.O instanceof ch){var c=a.O.W(),d=we(a,0);d instanceof Kh&&(c=null!=b.eb&&b.eb.has(c),c=new Rh(a.O,c),Yg(a,d,c,c),a==this.H&&(this.H=c),a=c)}M(a).forEach(function(e){this.ub(e,b)},this)};function Oi(){this.Tc=D()}u(Oi,Sh);Oi.prototype.gb=function(a,b){if(!q(b.w))return a;this.Tc.clear();this.H=a;this.ub(this.H,b);this.Tc.clear();return this.H};Oi.prototype.ub=function(a,b){var c=function(e){M(e).forEach(d)}.bind(this),d=function(e){if(!this.Tc.has(e)){if(e instanceof Ih){var f=e.O.s(),g=function(k){return Pi(this,k,f)}.bind(this);g=Qi(this,b,e,g);this.Tc.add(e);g!=e&&(null===g.getParent()&&(this.H=g),d(g))}c(e)}}.bind(this);d(a)}; function Qi(a,b,c,d){var e=c;if(Ri(b,c))e=Wg(c),Qi(a,b,c,d);else if(Si(c)){var f=[];e=Xg(c,d,function(g){g=new Ih(g.O);f.push(g);return g});f.forEach(function(g){Qi(this,b,g,d)},a)}return e}function Pi(a,b,c){var d=D();Sg(b).forEach(function(e){d.add(e.table)},a);b instanceof Jh&&d.add(b.table);return Vc(d,c)}function Si(a){a=we(a,0);return a instanceof Kh||a instanceof Rh} function Ri(a,b){var c=we(b,0);if(!(c instanceof Ih))return!1;if(null==a.eb)return!0;b=b.O instanceof ch;a=a.eb.has(c.O.W());return b||!a};function Ti(a,b){Ii.call(this,a);this.Xb=b;this.nf=this.df=this.wf=this.gf=this.Ee=this.Te=this.vf=this.Ke=this.zf=null}u(Ti,Ii); Ti.prototype.bd=function(){Ui(this);2<=this.query.from.length&&(this.Ke=new Kh);this.vf=null!=this.query.w?new Ih(this.query.w.Ob()):null;this.query.N&&(this.gf=new Mh(this.query.N));if(null!=this.query.L&&0>8,r=0;roj(this)?!1:!0:a instanceof $g?a.md()&&we(a,0).J.I()==this.yd?M(a).length<=oj(this):!1:!1}; function sj(a,b){this.B=a;this.cb=b;this.mg=D(this.cb.f.map(function(c){return c.aa.getName()}));this.ae=this.Ga=null}function uj(a){null===a.ae&&(a.ae=new kj(a.cb,a.Ga));return a.ae}function tj(a,b){b.forEach(function(c){var d=c.lb()[0].getName();this.mg.has(d)&&(null===this.Ga&&(this.Ga=new pd),this.Ga.set(d,c.W()))},a)}function rj(a,b){b=uj(a).cd(b);var c=a.B.get(a.cb.j());return b.reduce(function(d,e){return d+c.$c(e)},0)};function vj(a,b,c,d){S.call(this,0,-1);this.B=a.b(Lc);this.index=b;this.af=c;this.qe=d;this.Sc=this.Rc=!1}u(vj,S);vj.prototype.toString=function(){return"index_range_scan("+this.index.j()+", ?, "+(this.qe?"reverse":"natural")+(this.Rc?", limit:?":"")+(this.Sc?", skip:?":"")+")"};vj.prototype.Qc=function(a){var b=this.toString(),c=this.af.cd(a);b=b.replace("?",c.toString());this.Rc&&(b=b.replace("?",a.X.toString()));this.Sc&&(b=b.replace("?",a.L.toString()));return b}; vj.prototype.ca=function(a,b,c){a=this.af.cd(c);b=this.B.get(this.index.j());c=(1==a.length&&a[0]instanceof Md&&Sd(a[0])?Vf(b.get(a[0].from),!1,this.Rc?c.X:void 0,this.Sc?c.L:void 0):b.Ua(a,this.qe,this.Rc?c.X:void 0,this.Sc?c.L:void 0)).map(function(d){return new vc(d,{})},this);return[de(c,[this.index.mc])]};function wj(){S.call(this,-1,0)}u(wj,S);wj.prototype.toString=m("multi_index_range_scan()"); wj.prototype.ca=function(a){var b=A();a.forEach(function(d){d.entries.forEach(function(e){b.set(e.ta.id(),e)})});var c=B(b);return[new H(c,a[0].s())]};function xj(a){S.call(this,1,1);this.jc=a}u(xj,S);xj.prototype.toString=m("select(?)");xj.prototype.Qc=function(a){a=Je(a,this.jc);return this.toString().replace("?",a.toString())};xj.prototype.ca=function(a,b,c){return[Je(c,this.jc).eval(a[0])]};function yj(a,b){S.call(this,1,1);this.V=a.b(Kc);this.U=b}u(yj,S);yj.prototype.toString=function(){return"table_access_by_row_id("+this.U.getName()+")"};yj.prototype.ca=function(a){return[de(Rf(this.V,Yd(a[0])),[ge(this.U)])]};function zj(a){this.c=a}u(zj,Sh);zj.prototype.gb=function(a,b){this.H=a;Tg(a,function(c){return c instanceof $i}).forEach(function(c){var d=Aj(c);if(0!=d.length){var e=pj(new nj(this.c,c.table),b,d.map(function(g){return Je(b,g.jc)}));if(null!==e){var f=A();d.forEach(function(g){f.set(g.jc,g)},this);this.H=Bj(this,e,f,c)}}},this);return this.H};function Aj(a){var b=[];for(a=a.getParent();a;){if(a instanceof xj)b.push(a);else if(a instanceof dj)break;a=a.getParent()}return b} function Bj(a,b,c,d){(null===b.Ga?[]:b.Ga.values()).map(function(e){return c.get(e)}).forEach(Ug);b=new vj(a.c,b.cb,uj(b),!1);a=new yj(a.c,d.table);ye(a,b);Yg(d,d,a,b);return b.bb()};function Cj(a,b){S.call(this,0,-1);this.B=a.b(Lc);this.U=b}u(Cj,S);Cj.prototype.toString=function(){return"insert("+this.U.getName()+")"};Cj.prototype.ca=function(a,b,c){Dj(this.U,c.values,this.B);b.Bb(this.U,c.values);return[de(c.values,[this.U.getName()])]};function Dj(a,b,c){a=a.Nb.td;if(null===a?0:a.f[0].autoIncrement){var d=a.f[0].aa.getName();c=c.get(a.j()).Y().Fc;var e=null===c?0:c;b.forEach(function(f){if(0==f.m[d]||null==f.m[d])e++,f.m[d]=e})}} function Ej(a,b){S.call(this,0,-1);this.B=a.b(Lc);this.U=b}u(Ej,S);Ej.prototype.toString=function(){return"insert_replace("+this.U.getName()+")"};Ej.prototype.ca=function(a,b,c){Dj(this.U,c.values,this.B);b.Xd(this.U,c.values);return[de(c.values,[this.U.getName()])]};function Fj(){S.call(this,1,1)}u(Fj,S);Fj.prototype.toString=m("limit(?)");Fj.prototype.Qc=function(a){return this.toString().replace("?",a.X.toString())};Fj.prototype.ca=function(a,b,c){a[0].entries.splice(c.X);return a};function Gj(a){S.call(this,-1,1);this.N=a}u(Gj,S);n=Gj.prototype;n.toString=function(){return"order_by("+Oe(this.N)+")"};n.ca=function(a){if(1==a.length){var b=a[0];for(var c=null,d=0;dd?1:0;return 1==e?a:-a};n.Rg=function(a,b){return this.Z(function(c){return c instanceof R?Zd(a,c):I(a.entries[a.entries.length-1],c)},function(c){return c instanceof R?Zd(b,c):I(b.entries[b.entries.length-1],c)})};n.ag=function(a,b){return this.Z(function(c){return I(a,c)},function(c){return I(b,c)})};function Hj(a,b){this.Na=a;this.K=b}function Ij(a){return a.K.some(function(b){return b instanceof R},a)?Jj(a):Kj(a)}function Jj(a){if(1==a.K.length&&"DISTINCT"==a.K[0].Mb)return a=Zd(a.Na,a.K[0]).entries.map(function(c){var d=new ee(new vc(-1,{}),1b.getPriority()||2>b.getPriority())&&nk(a.Ec,b.da());a.Wb.Bb(b);qk(a);return b.Eb.ha}function qk(a){for(var b=a.Wb.wa(),c=0;c