-
Notifications
You must be signed in to change notification settings - Fork 46
/
wilddog-weapp-all.js
278 lines (278 loc) · 184 KB
/
wilddog-weapp-all.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.eio=e():t.eio=e()}(global,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";t.exports=r(1),global.eio=t.exports},function(t,e,r){"use strict";t.exports=r(2),t.exports.parser=r(6)},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);e=e||{},t&&"object"===("undefined"==typeof t?"undefined":s(t))&&(e=t,t=null),t?(t=p(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=p(e.host).host),this.secure=null!=e.secure?e.secure:global.location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(global.location?location.hostname:"localhost"),this.port=e.port||(global.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=f.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["websocket"],this.readyState="",this.writeBuffer=[],this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized;var r="object"===("undefined"==typeof global?"undefined":s(global))&&global;r.global===r&&e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),this.open()}function o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=r(3),a=r(17),c=r(21)("engine.io-client:socket"),u=r(32),h=r(6),p=r(33),f=r(18);t.exports=n,n.priorWebsocketSuccess=!1,a(n.prototype),n.protocol=h.protocol,n.Socket=n,n.Transport=r(5),n.transports=r(3),n.parser=r(6),n.prototype.createTransport=function(t){c('creating transport "%s"',t);var e=o(this.query);e.EIO=h.protocol,e.transport=t,this.id&&(e.sid=this.id);var r=new i[t]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders});return r},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(r){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){c("setting transport %s",t.name);var e=this;this.transport&&(c("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},n.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;p=p||e}p||(c('probe transport "%s" opened',t),h.send([{type:"ping",data:"probe"}]),h.once("packet",function(e){if(!p)if("pong"===e.type&&"probe"===e.data){if(c('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",h),!h)return;n.priorWebsocketSuccess="websocket"===h.name,c('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){p||"closed"!==f.readyState&&(c("changing transport and sending upgrade packet"),u(),f.setTransport(h),h.send([{type:"upgrade"}]),f.emit("upgrade",h),h=null,f.upgrading=!1,f.flush())})}else{c('probe transport "%s" failed',t);var r=new Error("probe error");r.transport=h.name,f.emit("upgradeError",r)}}))}function r(){p||(p=!0,u(),h.close(),h=null)}function o(e){var n=new Error("probe error: "+e);n.transport=h.name,r(),c('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",n)}function s(){o("transport closed")}function i(){o("socket closed")}function a(t){h&&t.name!==h.name&&(c('"%s" works - aborting "%s"',t.name,h.name),r())}function u(){h.removeListener("open",e),h.removeListener("error",o),h.removeListener("close",s),f.removeListener("close",i),f.removeListener("upgrading",a)}c('probing transport "%s"',t);var h=this.createTransport(t,{probe:1}),p=!1,f=this;n.priorWebsocketSuccess=!1,h.once("open",e),h.once("error",o),h.once("close",s),this.once("close",i),this.once("upgrading",a),h.open()},n.prototype.onOpen=function(){if(c("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){c("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState)switch(c('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else c('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){c("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(c("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},n.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){r=r||{},r.compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}},n.prototype.close=function(){function t(){n.onClose("forced close"),c("socket closing - telling transport to close"),n.transport.close()}function e(){n.removeListener("upgrade",e),n.removeListener("upgradeError",e),t()}function r(){n.once("upgrade",e),n.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var n=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?r():t()}):this.upgrading?r():t()}return this},n.prototype.onError=function(t){c("socket error %j",t),n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){c('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}},n.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~u(this.transports,t[r])&&e.push(t[r]);return e}},function(t,e,r){"use strict";function n(t){var e,r=!1,n=!1,o=!1!==t.jsonp;if(global.location){var s="https:"===location.protocol,i=location.port;i||(i=s?443:80),r=t.hostname!==location.hostname||i!==t.port,n=t.secure!==s}if(t.xdomain=r,t.xscheme=n,e=new XMLHttpRequest(t),"open"in e&&!t.forceJSONP)return new XHR(t);if(!o)throw new Error("JSONP disabled");return new JSONP(t)}var o=r(4);e.polling=n,e.websocket=o},function(t,e,r){"use strict";function n(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,o.call(this,t)}var o=r(5),s=r(6),i=r(18),a=r(19),c=r(20),u=r(21)("engine.io-client:websocket"),h=r(24).WebSocket;t.exports=n,a(n,o),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e={agent:this.agent,perMessageDeflate:this.perMessageDeflate};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(e.headers=this.extraHeaders),this.ws=new h(t),void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},"undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(n.prototype.onData=function(t){var e=this;setTimeout(function(){o.prototype.onData.call(e,t)},0)}),n.prototype.write=function(t){function e(){r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0)}var r=this;this.writable=!1;for(var n=t.length,o=0,i=n;o<i;o++)!function(t){s.encodePacket(t,r.supportsBinary,function(t){try{r.ws.send(t)}catch(o){u("websocket closed before onclose event")}--n||e()})}(t[o])},n.prototype.onClose=function(){o.prototype.onClose.call(this)},n.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||(t.b64=1),t=i.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t},n.prototype.check=function(){return!(!h||"__initialize"in h&&this.name===n.prototype.name)}},function(t,e,r){"use strict";function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders}var o=r(6),s=r(17);t.exports=n,s(n.prototype),n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){"use strict";function n(t,r){var n="b"+e.packets[t.type]+t.data.data;return r(n)}function o(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=t.data,s=new Uint8Array(o),i=new Uint8Array(1+o.byteLength);i[0]=v[t.type];for(var a=0;a<s.length;a++)i[a+1]=s[a];return n(i.buffer)}function s(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=new FileReader;return o.onload=function(){t.data=o.result,e.encodePacket(t,r,!0,n)},o.readAsArrayBuffer(t.data)}function i(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(m)return s(t,r,n);var o=new Uint8Array(1);o[0]=v[t.type];var i=new k([o.buffer,t.data]);return n(i)}function a(t){try{t=d.decode(t)}catch(e){return!1}return t}function c(t,e,r){for(var n=new Array(t.length),o=l(t.length,r),s=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},i=0;i<t.length;i++)s(i,t[i],o)}var u,h=r(7),p=r(8),f=r(10),l=r(11),d=r(12);global&&global.ArrayBuffer&&(u=r(15));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),g="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),m=y||g;e.protocol=3;var v=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},b=h(v),w={type:"error",data:"parser error"},k=r(16);e.encodePacket=function(t,e,r,s){"function"==typeof e&&(s=e,e=!1),"function"==typeof r&&(s=r,r=null);var a=void 0===t.data?void 0:t.data.buffer||t.data;if(global.ArrayBuffer&&a instanceof ArrayBuffer)return o(t,e,s);if(k&&a instanceof global.Blob)return i(t,e,s);if(a&&a.base64)return n(t,s);var c=v[t.type];return void 0!==t.data&&(c+=r?d.encode(String(t.data)):String(t.data)),s(""+c)},e.encodeBase64Packet=function(t,r){var n="b"+e.packets[t.type];if(k&&t.data instanceof global.Blob){var o=new FileReader;return o.onload=function(){var t=o.result.split(",")[1];r(n+t)},o.readAsDataURL(t.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(i){for(var a=new Uint8Array(t.data),c=new Array(a.length),u=0;u<a.length;u++)c[u]=a[u];s=String.fromCharCode.apply(null,c)}return n+=global.btoa(s),r(n)},e.decodePacket=function(t,r,n){if("string"==typeof t||void 0===t){if("b"==t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n&&(t=a(t),t===!1))return w;var o=t.charAt(0);return Number(o)==o&&b[o]?t.length>1?{type:b[o],data:t.substring(1)}:{type:b[o]}:w}var s=new Uint8Array(t),o=s[0],i=f(t,1);return k&&"blob"===r&&(i=new k([i])),{type:b[o],data:i}},e.decodeBase64Packet=function(t,e){var r=b[t.charAt(0)];if(!u)return{type:r,data:{base64:!0,data:t.substr(1)}};var n=u.decode(t.substr(1));return"blob"===e&&k&&(n=new k([n])),{type:r,data:n}},e.encodePayload=function(t,r,n){function o(t){return t.length+":"+t}function s(t,n){e.encodePacket(t,!!i&&r,!0,function(t){n(null,o(t))})}"function"==typeof r&&(n=r,r=null);var i=p(t);return r&&i?k&&!m?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void c(t,s,function(t,e){return n(e.join(""))}):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);"function"==typeof r&&(n=r,r=null);var o;if(""==t)return n(w,0,1);for(var s,i,a="",c=0,u=t.length;c<u;c++){var h=t.charAt(c);if(":"!=h)a+=h;else{if(""==a||a!=(s=Number(a)))return n(w,0,1);if(i=t.substr(c+1,s),a!=i.length)return n(w,0,1);if(i.length){if(o=e.decodePacket(i,r,!0),w.type==o.type&&w.data==o.data)return n(w,0,1);var p=n(o,c+s,u);if(!1===p)return}c+=s,a=""}}return""!=a?n(w,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})}return t.length?void c(t,n,function(t,e){var n=e.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),o=new Uint8Array(n),s=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);r=n.buffer}e?o[s++]=0:o[s++]=1;for(var a=r.byteLength.toString(),i=0;i<a.length;i++)o[s++]=parseInt(a[i]);o[s++]=255;for(var n=new Uint8Array(r),i=0;i<n.length;i++)o[s++]=n[i]}),r(o.buffer)}):r(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}for(var s=t instanceof ArrayBuffer?t.byteLength:t.size,i=s.toString(),a=new Uint8Array(i.length+1),o=0;o<i.length;o++)a[o]=parseInt(i[o]);if(a[i.length]=255,k){var c=new k([e.buffer,a.buffer,t]);r(null,c)}})}c(t,n,function(t,e){return r(new k(e))})},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var o=t,s=[],i=!1;o.byteLength>0;){for(var a=new Uint8Array(o),c=0===a[0],u="",h=1;255!=a[h];h++){if(u.length>310){i=!0;break}u+=a[h]}if(i)return n(w,0,1);o=f(o,2+u.length),u=parseInt(u);var p=f(o,0,u);if(c)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(l){var d=new Uint8Array(p);p="";for(var h=0;h<d.length;h++)p+=String.fromCharCode(d[h])}s.push(p),o=f(o,u)}var y=s.length;s.forEach(function(t,o){n(e.decodePacket(t,r,!0),o,y)})}},function(t,e){"use strict";t.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}},function(t,e,r){"use strict";function n(t){function e(t){if(!t)return!1;if(global.Buffer&&global.Buffer.isBuffer(t)||global.ArrayBuffer&&t instanceof ArrayBuffer||global.Blob&&t instanceof Blob||global.File&&t instanceof File)return!0;if(s(t)){for(var r=0;r<t.length;r++)if(e(t[r]))return!0}else if(t&&"object"==("undefined"==typeof t?"undefined":o(t))){t.toJSON&&(t=t.toJSON());for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return!0}return!1}return e(t)}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=r(9);t.exports=n},function(t,e){"use strict";t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e){"use strict";t.exports=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),s=new Uint8Array(r-e),i=e,a=0;i<r;i++,a++)s[a]=o[i];return s.buffer}},function(t,e){"use strict";function r(t,e,r){function o(t,n){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(s=!0,e(t),e=r):0!==o.count||s||e(null,n)}var s=!1;return r=r||n,o.count=t,0===t?e():o}function n(){}t.exports=r},function(t,e,r){var n;(function(t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(s){function i(t){for(var e,r,n=[],o=0,s=t.length;o<s;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<s?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function a(t){for(var e,r=t.length,n=-1,o="";++n<r;)e=t[n],e>65535&&(e-=65536,o+=w(e>>>10&1023|55296),e=56320|1023&e),o+=w(e);return o}function c(t,e){return w(t>>e&63|128)}function u(t){if(0==(4294967168&t))return w(t);var e="";return 0==(4294965248&t)?e=w(t>>6&31|192):0==(4294901760&t)?(e=w(t>>12&15|224),e+=c(t,6)):0==(4292870144&t)&&(e=w(t>>18&7|240),e+=c(t,12),e+=c(t,6)),e+=w(63&t|128)}function h(t){for(var e,r=i(t),n=r.length,o=-1,s="";++o<n;)e=r[o],s+=u(e);return s}function p(){if(b>=v)throw Error("Invalid byte index");var t=255&m[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function f(){var t,e,r,n,o;if(b>v)throw Error("Invalid byte index");if(b==v)return!1;if(t=255&m[b],b++,0==(128&t))return t;if(192==(224&t)){var e=p();if(o=(31&t)<<6|e,o>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if(e=p(),r=p(),o=(15&t)<<12|e<<6|r,o>=2048)return o;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=p(),r=p(),n=p(),o=(15&t)<<18|e<<12|r<<6|n,o>=65536&&o<=1114111))return o;throw Error("Invalid WTF-8 detected")}function l(t){m=i(t),v=m.length,b=0;for(var e,r=[];(e=f())!==!1;)r.push(e);return a(r)}var d="object"==o(e)&&e,y="object"==o(t)&&t&&t.exports==d&&t,g="object"==("undefined"==typeof global?"undefined":o(global))&&global;g.global!==g&&g.window!==g||(s=g);var m,v,b,w=String.fromCharCode,k={version:"1.0.0",encode:h,decode:l};if("object"==o(r(14))&&r(14))n=function(){return k}.call(e,r,e,t),!(void 0!==n&&(t.exports=n));else if(d&&!d.nodeType)if(y)y.exports=k;else{var S={},x=S.hasOwnProperty;for(var A in k)x.call(k,A)&&(d[A]=k[A])}else s.wtf8=k}(void 0)}).call(e,r(13)(t))},function(t,e){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e){"use strict";!function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;e.encode=function(e){var r,n=new Uint8Array(e),o=n.length,s="";for(r=0;r<o;r+=3)s+=t[n[r]>>2],s+=t[(3&n[r])<<4|n[r+1]>>4],s+=t[(15&n[r+1])<<2|n[r+2]>>6],s+=t[63&n[r+2]];return o%3===2?s=s.substring(0,s.length-1)+"=":o%3===1&&(s=s.substring(0,s.length-2)+"=="),s},e.decode=function(t){var e,n,o,s,i,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var h=new ArrayBuffer(a),p=new Uint8Array(h);for(e=0;e<c;e+=4)n=r[t.charCodeAt(e)],o=r[t.charCodeAt(e+1)],s=r[t.charCodeAt(e+2)],i=r[t.charCodeAt(e+3)],p[u++]=n<<2|o>>4,p[u++]=(15&o)<<4|s>>2,p[u++]=(3&s)<<6|63&i;return h}}()},function(t,e){"use strict";function r(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var o=new Uint8Array(r.byteLength);o.set(new Uint8Array(n,r.byteOffset,r.byteLength)),n=o.buffer}t[e]=n}}}function n(t,e){e=e||{};var n=new s;r(t);for(var o=0;o<t.length;o++)n.append(t[o]);return e.type?n.getBlob(e.type):n.getBlob()}function o(t,e){return r(t),new Blob(t,e||{})}var s=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder,i=function(){try{var t=new Blob(["hi"]);return 2===t.size}catch(e){return!1}}(),a=i&&function(){try{var t=new Blob([new Uint8Array([1,2])]);return 2===t.size}catch(e){return!1}}(),c=s&&s.prototype.append&&s.prototype.getBlob;t.exports=function(){return i?a?global.Blob:o:c?n:void 0}()},function(t,e){"use strict";function r(t){if(t)return n(t)}function n(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){n.off(t,r),e.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks[t];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){"use strict";e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var s=r[n].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},function(t,e){"use strict";t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){"use strict";function r(t){var e="";do e=i[t%a]+e,t=Math.floor(t/a);while(t>0);return e}function n(t){var e=0;for(h=0;h<t.length;h++)e=e*a+c[t.charAt(h)];return e}function o(){var t=r(+new Date);return t!==s?(u=0,s=t):t+"."+r(u++)}for(var s,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,c={},u=0,h=0;h<a;h++)c[i[h]]=h;o.encode=r,o.decode=n,t.exports=o},function(t,e,r){"use strict";function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var t=arguments,r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return t;var n="color: "+this.color;t=[t[0],n,"color: inherit"].concat(Array.prototype.slice.call(t,1));var o=0,s=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(s=o))}),t.splice(s,0,n),t}function s(){return"object"===("undefined"==typeof console?"undefined":u(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(r){}}function a(){var t;try{t=e.storage.debug}catch(r){}return t}function c(){try{return window.localStorage}catch(t){}}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e=t.exports=r(22),e.log=s,e.formatArgs=o,e.save=i,e.load=a,e.useColors=n,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(a())},function(t,e,r){"use strict";function n(){return e.colors[h++%e.colors.length]}function o(t){function r(){}function o(){var t=o,r=+new Date,s=r-(u||r);t.diff=s,t.prev=u,t.curr=r,u=r,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=n());var i=Array.prototype.slice.call(arguments);i[0]=e.coerce(i[0]),"string"!=typeof i[0]&&(i=["%o"].concat(i));var a=0;i[0]=i[0].replace(/%([a-z%])/g,function(r,n){if("%%"===r)return r;a++;var o=e.formatters[n];if("function"==typeof o){var s=i[a];r=o.call(t,s),i.splice(a,1),a--}return r}),"function"==typeof e.formatArgs&&(i=e.formatArgs.apply(t,i));var c=o.log||e.log||console.log.bind(console);c.apply(t,i)}r.enabled=!1,o.enabled=!0;var s=e.enabled(t)?o:r;return s.namespace=t,s}function s(t){e.save(t);for(var r=(t||"").split(/[\s,]+/),n=r.length,o=0;o<n;o++)r[o]&&(t=r[o].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function i(){e.enable("")}function a(t){var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1}function c(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o,e.coerce=c,e.disable=i,e.enable=s,e.enabled=a,e.humanize=r(23),e.names=[],e.skips=[],e.formatters={};var u,h=0},function(t,e){"use strict";function r(t){if(t=""+t,!(t.length>1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"days":case"day":case"d":return r*u;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c;case"minutes":case"minute":case"mins":case"min":case"m":return r*a;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function n(t){return t>=u?Math.round(t/u)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}function o(t){return s(t,u,"day")||s(t,c,"hour")||s(t,a,"minute")||s(t,i,"second")||t+" ms"}function s(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}var i=1e3,a=60*i,c=60*a,u=24*c,h=365.25*u;t.exports=function(t,e){return e=e||{},"string"==typeof t?r(t):e["long"]?o(t):n(t)}},function(t,e,r){"use strict";var n=r(25);t.exports={WebSocket:n},null==navigator&&(navigator={},navigator.userAgent="WeApp")},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=r(26),i=r(27),a=function(){function t(e){var r=this;if(n(this,t),null==e)throw new TypeError("1 argument needed");try{var o=i.parse(e);if("wss:"!=o.protocol)throw new Error("protocol must be wss")}catch(s){throw new SyntaxError("url in wrong format,protocol must be wss")}t.instance=this,this.url=e,this.readyState=0,this.onopen=null,this.onclose=null,this.onerror=null,this.onmessage=null,wx.connectSocket({url:e,header:{"content-type":"application/json"},method:"GET"}),wx.onSocketOpen(function(){r.readyState=t.OPEN,r.onopen&&r.onopen.call(r),r.dispatchEvent({type:"open"})}),wx.onSocketError(function(t){if(""!==t.message){var e={type:"error",data:t};r.onerror&&r.onerror.call(r,e),r.dispatchEvent(e)}}),wx.onSocketMessage(function(e){if(r.readyState===t.OPEN||r.readyState===t.CLOSING){var n={type:"message",data:e.data};r.onmessage&&r.onmessage.call(r,n),r.dispatchEvent(n)}}),wx.onSocketClose(function(){if(r.readyState=t.CLOSED,r.onclose){var e={type:"close",wasClean:!0,code:0,reason:""};r.onclose.call(r,e)}})}return o(t,[{key:"close",value:function(){wx.closeSocket()}},{key:"send",value:function(t){wx.sendSocketMessage({data:t})}}]),t}();a.prototype.addEventListener=s.addEventListener,
a.prototype.removeEventListener=s.removeEventListener,a.prototype.dispatchEvent=s.dispatchEvent,a.CONNECTING=0,a.OPEN=1,a.CLOSING=2,a.CLOSED=3,a.instance=null,t.exports=a},function(t,e){"use strict";t.exports=function(){function t(t,e,r){i.value=r,a(t,e,i),i.value=null}function e(e,r,n){var o;u.call(e,r)?o=e[r]:t(e,r,o=[]),c.call(o,n)<0&&o.push(n)}function r(t,e,r){var n,o,s;if(u.call(t,e))for(r.target=t,n=t[e].slice(0),s=0;s<n.length;s++)o=n[s],"function"==typeof o?o.call(t,r):"function"==typeof o.handleEvent&&o.handleEvent(r)}function n(t,e,r){var n,o;u.call(t,e)&&(n=t[e],o=c.call(n,r),-1<o&&(n.splice(o,1),n.length||delete t[e]))}var o="@@",s={},i={configurable:!0,value:null},a=Object.defineProperty||function(t,e,r){t[e]=r.value},c=[].indexOf||function(t){for(var e=this.length;e--&&this[e]!==t;);return e},u=s.hasOwnProperty;return t(s,"addEventListener",function(t,r){e(this,o+t,r)}),t(s,"dispatchEvent",function(t){r(this,o+t.type,t)}),t(s,"removeEventListener",function(t,e){n(this,o+t,e)}),s}()},function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,r){if(t&&u(t)&&t instanceof n)return t;var o=new n;return o.parse(t,e,r),o}function s(t){return c(t)&&(t=o(t)),t instanceof n?t.format():n.prototype.format.call(t)}function i(t,e){return o(t,!1,!0).resolve(e)}function a(t,e){return t?o(t,!1,!0).resolveObject(e):e}function c(t){return"string"==typeof t}function u(t){return"object"===("undefined"==typeof t?"undefined":f(t))&&null!==t}function h(t){return null===t}function p(t){return null==t}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l=r(28);e.parse=o,e.resolve=i,e.resolveObject=a,e.format=s,e.Url=n;var d=/^([a-z0-9.+-]+:)/i,y=/:[0-9]*$/,g=["<",">",'"',"`"," ","\r","\n","\t"],m=["{","}","|","\\","^","`"].concat(g),v=["'"].concat(m),b=["%","/","?",";","#"].concat(v),w=["/","?","#"],k=255,S=/^[a-z0-9A-Z_-]{0,63}$/,x=/^([a-z0-9A-Z_-]{0,63})(.*)$/,A={javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},B={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},O=r(29);n.prototype.parse=function(t,e,r){if(!c(t))throw new TypeError("Parameter 'url' must be a string, not "+("undefined"==typeof t?"undefined":f(t)));var n=t;n=n.trim();var o=d.exec(n);if(o){o=o[0];var s=o.toLowerCase();this.protocol=s,n=n.substr(o.length)}if(r||o||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var i="//"===n.substr(0,2);!i||o&&C[o]||(n=n.substr(2),this.slashes=!0)}if(!C[o]&&(i||o&&!B[o])){for(var a=-1,u=0;u<w.length;u++){var h=n.indexOf(w[u]);h!==-1&&(a===-1||h<a)&&(a=h)}var p,y;y=a===-1?n.lastIndexOf("@"):n.lastIndexOf("@",a),y!==-1&&(p=n.slice(0,y),n=n.slice(y+1),this.auth=decodeURIComponent(p)),a=-1;for(var u=0;u<b.length;u++){var h=n.indexOf(b[u]);h!==-1&&(a===-1||h<a)&&(a=h)}a===-1&&(a=n.length),this.host=n.slice(0,a),n=n.slice(a),this.parseHost(),this.hostname=this.hostname||"";var g="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!g)for(var m=this.hostname.split(/\./),u=0,P=m.length;u<P;u++){var j=m[u];if(j&&!j.match(S)){for(var E="",U=0,L=j.length;U<L;U++)E+=j.charCodeAt(U)>127?"x":j[U];if(!E.match(S)){var T=m.slice(0,u),I=m.slice(u+1),q=j.match(x);q&&(T.push(q[1]),I.unshift(q[2])),I.length&&(n="/"+I.join(".")+n),this.hostname=T.join(".");break}}}if(this.hostname.length>k?this.hostname="":this.hostname=this.hostname.toLowerCase(),!g){for(var R=this.hostname.split("."),D=[],u=0;u<R.length;++u){var M=R[u];D.push(M.match(/[^A-Za-z0-9_-]/)?"xn--"+l.encode(M):M)}this.hostname=D.join(".")}var z=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+z,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==n[0]&&(n="/"+n))}if(!A[s])for(var u=0,P=v.length;u<P;u++){var _=v[u],H=encodeURIComponent(_);H===_&&(H=escape(_)),n=n.split(_).join(H)}var F=n.indexOf("#");F!==-1&&(this.hash=n.substr(F),n=n.slice(0,F));var J=n.indexOf("?");if(J!==-1?(this.search=n.substr(J),this.query=n.substr(J+1),e&&(this.query=O.parse(this.query)),n=n.slice(0,J)):e&&(this.search="",this.query={}),n&&(this.pathname=n),B[s]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var z=this.pathname||"",M=this.search||"";this.path=z+M}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&u(this.query)&&Object.keys(this.query).length&&(s=O.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||B[e])&&o!==!1?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),i&&"?"!==i.charAt(0)&&(i="?"+i),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),i=i.replace("#","%23"),e+o+r+i+n},n.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(c(t)){var e=new n;e.parse(t,!1,!0),t=e}var r=new n;if(Object.keys(this).forEach(function(t){r[t]=this[t]},this),r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(e){"protocol"!==e&&(r[e]=t[e])}),B[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r;if(t.protocol&&t.protocol!==r.protocol){if(!B[t.protocol])return Object.keys(t).forEach(function(e){r[e]=t[e]}),r.href=r.format(),r;if(r.protocol=t.protocol,t.host||C[t.protocol])r.pathname=t.pathname;else{for(var o=(t.pathname||"").split("/");o.length&&!(t.host=o.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),r.pathname=o.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var s=r.pathname||"",i=r.search||"";r.path=s+i}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var a=r.pathname&&"/"===r.pathname.charAt(0),u=t.host||t.pathname&&"/"===t.pathname.charAt(0),f=u||a||r.host&&t.pathname,l=f,d=r.pathname&&r.pathname.split("/")||[],o=t.pathname&&t.pathname.split("/")||[],y=r.protocol&&!B[r.protocol];if(y&&(r.hostname="",r.port=null,r.host&&(""===d[0]?d[0]=r.host:d.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===o[0]?o[0]=t.host:o.unshift(t.host)),t.host=null),f=f&&(""===o[0]||""===d[0])),u)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,d=o;else if(o.length)d||(d=[]),d.pop(),d=d.concat(o),r.search=t.search,r.query=t.query;else if(!p(t.search)){if(y){r.hostname=r.host=d.shift();var g=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");g&&(r.auth=g.shift(),r.host=r.hostname=g.shift())}return r.search=t.search,r.query=t.query,h(r.pathname)&&h(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!d.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var m=d.slice(-1)[0],v=(r.host||t.host)&&("."===m||".."===m)||""===m,b=0,w=d.length;w>=0;w--)m=d[w],"."==m?d.splice(w,1):".."===m?(d.splice(w,1),b++):b&&(d.splice(w,1),b--);if(!f&&!l)for(;b--;b)d.unshift("..");!f||""===d[0]||d[0]&&"/"===d[0].charAt(0)||d.unshift(""),v&&"/"!==d.join("/").substr(-1)&&d.push("");var k=""===d[0]||d[0]&&"/"===d[0].charAt(0);if(y){r.hostname=r.host=k?"":d.length?d.shift():"";var g=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");g&&(r.auth=g.shift(),r.host=r.hostname=g.shift())}return f=f||r.host&&d.length,f&&!k&&d.unshift(""),d.length?r.pathname=d.join("/"):(r.pathname=null,r.path=null),h(r.pathname)&&h(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=y.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){var n;(function(t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(s){function i(t){throw RangeError(q[t])}function a(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function c(t,e){var r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]),t=t.replace(I,".");var o=t.split("."),s=a(o,e).join(".");return n+s}function u(t){for(var e,r,n=[],o=0,s=t.length;o<s;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<s?(r=t.charCodeAt(o++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--)):n.push(e);return n}function h(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=M(t>>>10&1023|55296),t=56320|1023&t),e+=M(t)}).join("")}function p(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:A}function f(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function l(t,e,r){var n=0;for(t=r?D(t/P):t>>1,t+=D(t/e);t>R*B>>1;n+=A)t=D(t/R);return D(n+(R+1)*t/(t+O))}function d(t){var e,r,n,o,s,a,c,u,f,d,y=[],g=t.length,m=0,v=E,b=j;for(r=t.lastIndexOf(U),r<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&i("not-basic"),y.push(t.charCodeAt(n));for(o=r>0?r+1:0;o<g;){for(s=m,a=1,c=A;o>=g&&i("invalid-input"),u=p(t.charCodeAt(o++)),(u>=A||u>D((x-m)/a))&&i("overflow"),m+=u*a,f=c<=b?C:c>=b+B?B:c-b,!(u<f);c+=A)d=A-f,a>D(x/d)&&i("overflow"),a*=d;e=y.length+1,b=l(m-s,e,0==s),D(m/e)>x-v&&i("overflow"),v+=D(m/e),m%=e,y.splice(m++,0,v)}return h(y)}function y(t){var e,r,n,o,s,a,c,h,p,d,y,g,m,v,b,w=[];for(t=u(t),g=t.length,e=E,r=0,s=j,a=0;a<g;++a)y=t[a],y<128&&w.push(M(y));for(n=o=w.length,o&&w.push(U);n<g;){for(c=x,a=0;a<g;++a)y=t[a],y>=e&&y<c&&(c=y);for(m=n+1,c-e>D((x-r)/m)&&i("overflow"),r+=(c-e)*m,e=c,a=0;a<g;++a)if(y=t[a],y<e&&++r>x&&i("overflow"),y==e){for(h=r,p=A;d=p<=s?C:p>=s+B?B:p-s,!(h<d);p+=A)b=h-d,v=A-d,w.push(M(f(d+b%v,0))),h=D(b/v);w.push(M(f(h,0))),s=l(r,m,n==o),r=0,++n}++r,++e}return w.join("")}function g(t){return c(t,function(t){return L.test(t)?d(t.slice(4).toLowerCase()):t})}function m(t){return c(t,function(t){return T.test(t)?"xn--"+y(t):t})}var v="object"==o(e)&&e&&!e.nodeType&&e,b="object"==o(t)&&t&&!t.nodeType&&t,w="object"==("undefined"==typeof global?"undefined":o(global))&&global;w.global!==w&&w.window!==w&&w.self!==w||(s=w);var k,S,x=2147483647,A=36,C=1,B=26,O=38,P=700,j=72,E=128,U="-",L=/^xn--/,T=/[^\x20-\x7E]/,I=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=A-C,D=Math.floor,M=String.fromCharCode;if(k={version:"1.3.2",ucs2:{decode:u,encode:h},decode:d,encode:y,toASCII:m,toUnicode:g},"object"==o(r(14))&&r(14))n=function(){return k}.call(e,r,e,t),!(void 0!==n&&(t.exports=n));else if(v&&b)if(t.exports==v)b.exports=k;else for(S in k)k.hasOwnProperty(S)&&(v[S]=k[S]);else s.punycode=k}(void 0)}).call(e,r(13)(t))},function(t,e,r){"use strict";e.decode=e.parse=r(30),e.encode=e.stringify=r(31)},function(t,e){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,o){e=e||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var i=/\+/g;t=t.split(e);var a=1e3;o&&"number"==typeof o.maxKeys&&(a=o.maxKeys);var c=t.length;a>0&&c>a&&(c=a);for(var u=0;u<c;++u){var h,p,f,l,d=t[u].replace(i,"%20"),y=d.indexOf(n);y>=0?(h=d.substr(0,y),p=d.substr(y+1)):(h=d,p=""),f=decodeURIComponent(h),l=decodeURIComponent(p),r(s,f)?Array.isArray(s[f])?s[f].push(l):s[f]=[s[f],l]:s[f]=l}return s}},function(t,e){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t){switch("undefined"==typeof t?"undefined":r(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,o,s){return e=e||"&",o=o||"=",null===t&&(t=void 0),"object"===("undefined"==typeof t?"undefined":r(t))?Object.keys(t).map(function(r){var s=encodeURIComponent(n(r))+o;return Array.isArray(t[r])?t[r].map(function(t){return s+encodeURIComponent(n(t))}).join(e):s+encodeURIComponent(n(t[r]))}).join(e):s?encodeURIComponent(n(s))+o+encodeURIComponent(n(t)):""}},function(t,e){"use strict";var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e){"use strict";var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),s=t.indexOf("]");o!=-1&&s!=-1&&(t=t.substring(0,o)+t.substring(o,s).replace(/:/g,";")+t.substring(s,t.length));for(var i=r.exec(t||""),a={},c=14;c--;)a[n[c]]=i[c]||"";return o!=-1&&s!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}}])});
(function(ns){var CLIENT_VERSION = "2.5.17";var CLIENT_TYPE ="WX";ns.wrapper=function(goog,wd){
var h,n=this;function p(a){return void 0!==a}function aa(){}function ba(a){a.ac=function(){return a.jf?a.jf:a.jf=new a}}
function da(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 ea(a){return"array"==da(a)}function q(a){return"string"==typeof a}function fa(a){return"number"==typeof a}function ga(a){return"function"==da(a)}function ha(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)}
function ja(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function r(a,b,c){r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ia:ja;return r.apply(null,arguments)}
function ka(a,b){var c=a.split("."),d=n;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&p(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function la(a,b){function c(){}c.prototype=b.prototype;a.Ah=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.sh=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};var ma={},na={NETWORK_ERROR:"Unable to contact the Wilddog server.",SERVER_ERROR:"An unknown server error occurred.",TRANSPORT_UNAVAILABLE:"There are no login transports available for the requested method.",REQUEST_INTERRUPTED:"The browser redirected the page before the login request could complete.",USER_CANCELLED:"The user cancelled authentication."};function oa(a){var b=t(na,a),b=Error(b,a);b.code=a;return b};function pa(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function t(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]}function qa(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])}function ra(a){var b={};qa(a,function(a,d){b[a]=d});return b};function sa(a){var b=[];qa(a,function(a,d){ea(d)?ta(d,function(c){b.push(encodeURIComponent(a)+"="+encodeURIComponent(c))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.join("&"):""}function ua(a){var b={};a=a.replace(/^\?/,"").split("&");ta(a,function(a){a&&(a=a.split("="),b[a[0]]=a[1])});return b};function va(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))}function wa(a){a=String(a);if(va(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);}function xa(){this.Od=void 0}
function ya(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),e=d[f],ya(a,a.Od?a.Od.call(d,String(f),e):e,c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");f="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(e=b[d],"function"!=typeof e&&(c.push(f),za(d,c),c.push(":"),ya(a,a.Od?a.Od.call(b,d,e):e,c),f=","));c.push("}");return}}switch(typeof b){case "string":za(b,
c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var Aa={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Ba=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function za(a,b){b.push('"',a.replace(Ba,function(a){var b=Aa[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),Aa[a]=b);return b}),'"')};function Ca(a){return"undefined"!==typeof JSON&&p(JSON.parse)?JSON.parse(a):wa(a)}function u(a){if("undefined"!==typeof JSON&&p(JSON.stringify))a=JSON.stringify(a);else{var b=[];ya(new xa,a,b);a=b.join("")}return a};function Da(a){a.method||(a.method="GET");a.headers||(a.headers={});this.options=a}Da.prototype.open=function(a,b,c){var d={Accept:"application/json;text/plain"};Ea(d,this.options.headers);a={url:a,method:this.options.method.toUpperCase(),header:d,success:function(a){c&&(c(null,a.data),c=null)},fail:function(a){500<=a.Oe&&600>a.Oe?c(oa("SERVER_ERROR")):c(oa("NETWORK_ERROR"));c=null}};a.data=b;a.headers=d;wx.request(a)};Da.isAvailable=function(){return wx&&wx.request};var Fa="auth.wilddog.com";function Ga(){var a=window.opener.frames,b;for(b=a.length-1;0<=b;b--)try{if(a[b].location.protocol===window.location.protocol&&a[b].location.host===window.location.host&&"__winchan_relay_frame"===a[b].name)return a[b]}catch(c){}return null}function Ha(a,b,c){a.attachEvent?a.attachEvent("on"+b,c):a.addEventListener&&a.addEventListener(b,c,!1)}function Ia(a,b){a.detachEvent?a.detachEvent("onmessage",b):a.removeEventListener&&a.removeEventListener("message",b,!1)}
function Ja(){var a=document.location.hash,b="";try{var a=a.replace("#",""),c=ua(a);c&&pa(c,"__wilddog_request_key")&&(b=t(c,"__wilddog_request_key"))}catch(d){}return b}function Ka(){var a=La(Fa);return a.scheme+"://"+a.host+"/v2"}function Ma(a){return Ka()+"/"+a+"/auth/channel"};function Na(){if("undefined"===typeof navigator)return!1;var a=navigator.userAgent;if("Microsoft Internet Explorer"===navigator.appName){if((a=a.match(/MSIE ([0-9]{1,}[\.0-9]{0,})/))&&1<a.length)return 8<=parseFloat(a[1])}else if(-1<a.indexOf("Trident")&&(a=a.match(/rv:([0-9]{2,2}[\.0-9]{0,})/))&&1<a.length)return 8<=parseFloat(a[1]);return!1};function Oa(){}Oa.prototype.open=function(a,b,c){wx.login({success:function(b){b.code?Pa(function(d,f){if(d)c(d);else{var e={};e.code=b.code;e.signature=f.signature;e.rawData=f.rawData;e.encryptedData=f.encryptedData;e.iv=f.iv;Qa(e,a,c)}}):c(Error("\u5fae\u4fe1\u670d\u52a1\u7aef\u672a\u8fd4\u56decode"))},fail:function(a){Ra("debug WxImplicit fail"+JSON.stringify(a));c(Error("\u83b7\u53d6\u7528\u6237\u767b\u9646\u72b6\u6001\u5931\u8d25,res.Msg:"+a.dg),null)}})};
function Qa(a,b,c){wx.request({url:b,method:"POST",header:{Accept:"application/json;text/plain"},success:function(a){if(a.data)if(null!=a.data.idToken)c(null,a.data);else if(a.data.message){var b=Error(a.data.message);b.code=a.data.code;c(b)}else c(Error("unkown error:"+a.data));else c(Error("unkown error: no data returned"));c=null},fail:function(a){500<=a.Oe&&600>a.Oe?c(oa("SERVER_ERROR")):c(oa("NETWORK_ERROR"));c=null},data:a})}
function Pa(a){wx.getUserInfo({success:function(b){a(null,{rawData:b.rawData,signature:b.signature,encryptedData:b.encryptedData,iv:b.iv})},fail:function(){Ra("debug WxImplicit fail"+JSON.stringify(res));a(Error("invoke wx.getUserInfo failed"+res.dg))}})}Oa.isAvailable=function(){return wx&&wx.request};function Sa(){this.yc={}}Sa.prototype.set=function(a,b){null==b?delete this.yc[a]:this.yc[a]=b};Sa.prototype.get=function(a){return pa(this.yc,a)?this.yc[a]:null};Sa.prototype.remove=function(a){delete this.yc[a]};Sa.prototype.xe=!0;function Ta(){this.Dg="wilddog123:"}h=Ta.prototype;h.set=function(a,b){null==b?wx.removeStorageSync(this.Ld(a)):wx.setStorageSync(this.Ld(a),b)};h.get=function(a){var b;try{b=wx.getStorageSync(this.Ld(a))}catch(c){}return null==b||""==b?null:b};h.xe=!1;h.Ld=function(a){return this.Dg+a};h.remove=function(a){wx.removeStorageSync(this.Ld(a))};h.toString=function(){return"wx-storage:{}"};var Ua=new Ta,v=new Sa;function Va(a){if(Error.captureStackTrace)Error.captureStackTrace(this,Va);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}la(Va,Error);Va.prototype.name="CustomError";function Wa(a,b,c){this.ga=c;this.ag=a;this.Kg=b;this.Ed=0;this.sd=null}Wa.prototype.get=function(){var a;0<this.Ed?(this.Ed--,a=this.sd,this.sd=a.next,a.next=null):a=this.ag();return a};Wa.prototype.put=function(a){this.Kg(a);this.Ed<this.ga&&(this.Ed++,a.next=this.sd,this.sd=a)};function Xa(){this.de=this.wc=null}var Za=new Wa(function(){return new Ya},function(a){a.reset()},100);Xa.prototype.add=function(a,b){var c=Za.get();c.set(a,b);this.de?this.de.next=c:this.wc=c;this.de=c};Xa.prototype.remove=function(){var a=null;this.wc&&(a=this.wc,this.wc=this.wc.next,this.wc||(this.de=null),a.next=null);return a};function Ya(){this.next=this.scope=this.oe=null}Ya.prototype.set=function(a,b){this.oe=a;this.scope=b;this.next=null};
Ya.prototype.reset=function(){this.next=this.scope=this.oe=null};var $a=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},ta=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},ab=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a,
b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=q(a)?a.split(""):a,k=0;k<d;k++)if(k in g){var l=g[k];b.call(c,l,k,a)&&(e[f++]=l)}return e},bb=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},cb=Array.prototype.reduce?function(a,b,c,d){d&&(b=r(b,d));return Array.prototype.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;ta(a,function(c,g){e=b.call(d,
e,c,g,a)});return e},db=Array.prototype.every?function(a,b,c){return Array.prototype.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};function eb(a,b){var c=fb(a,b,void 0);return 0>c?null:q(a)?a.charAt(c):a[c]}function fb(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1}function gb(a,b){var c=$a(a,b);0<=c&&Array.prototype.splice.call(a,c,1)}
function hb(a,b){a.sort(b||ib)}function ib(a,b){return a>b?1:a<b?-1:0};var jb;a:{var kb=n.navigator;if(kb){var lb=kb.userAgent;if(lb){jb=lb;break a}}jb=""};function w(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function mb(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}function nb(a,b){for(var c in a)if(!b.call(void 0,a[c],c,a))return!1;return!0}function ob(a){var b=0,c;for(c in a)b++;return b}function pb(a){for(var b in a)return b}function qb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function rb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function sb(a,b){return null!==a&&b in a}
function tb(a,b){for(var c in a)if(a[c]==b)return!0;return!1}function ub(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d}function vb(a,b){var c=ub(a,b,void 0);return c&&a[c]}function wb(a){for(var b in a)return!1;return!0}function xb(a){var b={},c;for(c in a)b[c]=a[c];return b}var yb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function Ea(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<yb.length;f++)c=yb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function zb(a){n.setTimeout(function(){throw a;},0)}var Ab;
function Bb(){var a=n.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&-1==jb.indexOf("Presto")&&(a=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="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=r(function(a){if(("*"==d||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 a&&-1==jb.indexOf("Trident")&&-1==jb.indexOf("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(p(c.next)){c=c.next;var a=c.pb;c.pb=null;a()}};return function(a){d.next={pb:a};d=d.next;b.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){n.setTimeout(a,0)}};function Cb(a,b){Db||Eb();Fb||(Db(),Fb=!0);Gb.add(a,b)}var Db;function Eb(){var a=n.Promise;if(-1!=String(a).indexOf("[native code]")){var b=a.resolve(void 0);Db=function(){b.then(Hb)}}else Db=function(){var a=Hb,b;!(b=!ga(n.setImmediate))&&(b=n.Window&&n.Window.prototype)&&(b=-1==jb.indexOf("Edge")&&n.Window.prototype.setImmediate==n.setImmediate);b?(Ab||(Ab=Bb()),Ab(a)):n.setImmediate(a)}}var Fb=!1,Gb=new Xa;
function Hb(){for(var a;a=Gb.remove();){try{a.oe.call(a.scope)}catch(b){zb(b)}Za.put(a)}Fb=!1};function Ib(a,b){this.da=Jb;this.Bf=void 0;this.Vb=this.ob=this.Ea=null;this.pd=this.me=!1;if(a!=aa)try{var c=this;a.call(b,function(a){Kb(c,Lb,a)},function(a){if(!(a instanceof Mb))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(e){}Kb(c,Nb,a)})}catch(d){Kb(this,Nb,d)}}var Jb=0,Lb=2,Nb=3;function Ob(){this.next=this.context=this.nc=this.Qc=this.w=null;this.Zc=!1}Ob.prototype.reset=function(){this.context=this.nc=this.Qc=this.w=null;this.Zc=!1};
var Pb=new Wa(function(){return new Ob},function(a){a.reset()},100);function Qb(a,b,c){var d=Pb.get();d.Qc=a;d.nc=b;d.context=c;return d}Ib.prototype.then=function(a,b,c){return Rb(this,ga(a)?a:null,ga(b)?b:null,c)};Ib.prototype.then=Ib.prototype.then;Ib.prototype.$goog_Thenable=!0;h=Ib.prototype;h.eh=function(a,b){return Rb(this,null,a,b)};h.cancel=function(a){this.da==Jb&&Cb(function(){var b=new Mb(a);Sb(this,b)},this)};
function Sb(a,b){if(a.da==Jb)if(a.Ea){var c=a.Ea;if(c.ob){for(var d=0,e=null,f=null,g=c.ob;g&&(g.Zc||(d++,g.w==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.da==Jb&&1==d?Sb(c,b):(f?(d=f,d.next==c.Vb&&(c.Vb=d),d.next=d.next.next):Tb(c),Ub(c,e,Nb,b)))}a.Ea=null}else Kb(a,Nb,b)}function Vb(a,b){a.ob||a.da!=Lb&&a.da!=Nb||Wb(a);a.Vb?a.Vb.next=b:a.ob=b;a.Vb=b}
function Rb(a,b,c,d){var e=Qb(null,null,null);e.w=new Ib(function(a,g){e.Qc=b?function(c){try{var e=b.call(d,c);a(e)}catch(m){g(m)}}:a;e.nc=c?function(b){try{var e=c.call(d,b);!p(e)&&b instanceof Mb?g(b):a(e)}catch(m){g(m)}}:g});e.w.Ea=a;Vb(a,e);return e.w}h.gh=function(a){this.da=Jb;Kb(this,Lb,a)};h.hh=function(a){this.da=Jb;Kb(this,Nb,a)};
function Kb(a,b,c){if(a.da==Jb){a===c&&(b=Nb,c=new TypeError("Promise cannot resolve to itself"));a.da=1;var d;a:{var e=c,f=a.gh,g=a.hh;if(e instanceof Ib)Vb(e,Qb(f||aa,g||null,a)),d=!0;else{var k;if(e)try{k=!!e.$goog_Thenable}catch(m){k=!1}else k=!1;if(k)e.then(f,g,a),d=!0;else{if(ha(e))try{var l=e.then;if(ga(l)){Xb(e,l,f,g,a);d=!0;break a}}catch(m){g.call(a,m);d=!0;break a}d=!1}}}d||(a.Bf=c,a.da=b,a.Ea=null,Wb(a),b!=Nb||c instanceof Mb||Yb(a,c))}}
function Xb(a,b,c,d,e){function f(a){k||(k=!0,d.call(e,a))}function g(a){k||(k=!0,c.call(e,a))}var k=!1;try{b.call(a,g,f)}catch(l){f(l)}}function Wb(a){a.me||(a.me=!0,Cb(a.gg,a))}function Tb(a){var b=null;a.ob&&(b=a.ob,a.ob=b.next,b.next=null);a.ob||(a.Vb=null);return b}h.gg=function(){for(var a;a=Tb(this);)Ub(this,a,this.da,this.Bf);this.me=!1};
function Ub(a,b,c,d){if(c==Nb&&b.nc&&!b.Zc)for(;a&&a.pd;a=a.Ea)a.pd=!1;if(b.w)b.w.Ea=null,Zb(b,c,d);else try{b.Zc?b.Qc.call(b.context):Zb(b,c,d)}catch(e){$b.call(null,e)}Pb.put(b)}function Zb(a,b,c){b==Lb?a.Qc.call(a.context,c):a.nc&&a.nc.call(a.context,c)}function Yb(a,b){a.pd=!0;Cb(function(){a.pd&&$b.call(null,b)})}var $b=zb;function Mb(a){Va.call(this,a)}la(Mb,Va);Mb.prototype.name="cancel";var ac="undefined"!=typeof Promise?Promise:"undefined"!=typeof n.Promise?n.Promise:Ib;n.setTimeout||(n.setTimeout=function(){setTimeout.apply(null,arguments)});Ib.prototype["catch"]=Ib.prototype.eh;function x(){var a=this;this.reject=this.resolve=null;this.o=new ac(function(b,c){a.resolve=b;a.reject=c})}function y(a,b){return function(c,d){c?a.reject(c):a.resolve(d);ga(b)&&(bc(a.o),1===b.length?b(c):b(c,d))}}function bc(a){a.then(void 0,aa)};var cc=global.eio;function dc(){this.nf={WxHttp:Da,WxImplicit:Oa};this.Xc="s-dalwx-nss-1.wilddogio.com"}function ec(a){var b=[];a.forEach(function(a){null!=this.nf[a]&&b.push(this.nf[a])},fc);return b}
dc.prototype.yf=function(a){function b(a,b){if(null==b)return-1;for(var c=0;c<a.length;c++)if(a[c][".key"]===b)return c;return-1}function c(a){return{".key":a.key(),".value":a.val(),".priority":a.getPriority()}}a.prototype.bindAsArray=function(a,e,f){function d(){var b={};b[e]=k;a.setData(b)}if(null==a)throw Error("please provide page as 1st param");if(null==e||"string"!=typeof e)throw Error("please provide varible name as 2nd param");if(null==a[".bindWilddogFuncs"]||"object"!=typeof a[".bindWilddogFuncs"])a[".bindWilddogFuncs"]=
{};if(null!=a[".bindWilddogFuncs"][e])throw Error(e+" bind more than once");var k=[],l={child_added:function(a,e){var f=c(a);k.splice(b(k,e)+1,0,f);d()},child_removed:function(a){a=a.key();k.splice(b(k,a),1);d()},child_moved:function(a,c){var e=b(k,a.key()),e=k.splice(e,1);k.splice(b(k,c)+1,0,e[0]);d()},child_changed:function(a){a=c(a);k[b(k,a[".key"])]=a;d()}},m=["child_added","child_removed","child_moved","child_changed"],A=new x;bc(A.o);this.once("value",function(){f&&f(null);A.resolve()},function(a){f&&
f(a);A.reject(a)});for(var H=0;H<m.length;H++)this.on(m[H],l[m[H]]);a[".bindWilddogFuncs"][e]=l;return A.o};a.prototype.bindAsObject=function(a,b,f){if(null==a)throw Error("please provide page as 1st param");if(null==b||"string"!=typeof b)throw Error("please provide varible name as 2nd param");if(null==a[".bindWilddogFuncs"]||"object"!=typeof a[".bindWilddogFuncs"])a[".bindWilddogFuncs"]={};if(null!=a[".bindWilddogFuncs"][b])throw Error(b+" bind more than once");var d=null,e={value:function(e){d=
c(e);e={};e[b]=d;a.setData(e)}},l=new x;bc(l.o);this.once("value",function(){f&&f(null);l.resolve()},function(a){f&&f(a);l.reject(a)});this.on("value",e.value);a[".bindWilddogFuncs"][b]=e;return l.o};a.prototype.unbind=function(a,b){if(null==a)throw Error("please provide page as 1st param");if(null==b||"string"!=typeof b)throw Error("please provide varible name as 2nd param");if(null!=a[".bindWilddogFuncs"]){var c=a[".bindWilddogFuncs"][b];if(null!=c&&"object"==typeof c){for(var d=["child_added",
"child_removed","child_moved","child_changed","value"],e=0;e<d.length;e++){var l=d[e];null!=c[l]&&"function"==typeof c[l]&&this.off(l,c[l])}delete a[".bindWilddogFuncs"][b]}}}};var fc=new dc;function gc(a){this.M=a}gc.prototype.Pf=function(a){this.M.bind(this.M.Ha.Na,a)};gc.prototype.addAuthTokenListener=gc.prototype.Pf;gc.prototype.Hg=function(){this.M.unbind(this.M.Ha.Na,listener)};gc.prototype.removeAuthTokenListener=gc.prototype.Hg;gc.prototype.Of=function(a){this.M.bind(this.M.Ha.cd,a)};gc.prototype.addAuthRevokListener=gc.prototype.Of;gc.prototype.Gg=function(){this.M.unbind(this.M.Ha.cd,listener)};gc.prototype.removeAuthRevokListener=gc.prototype.Gg;function hc(){this.nb=-1};function ic(){this.nb=64;this.W=[];this.he=[];this.Mf=[];this.Jd=[];this.Jd[0]=128;for(var a=1;a<this.nb;++a)this.Jd[a]=0;this.$d=this.gc=0;this.reset()}la(ic,hc);ic.prototype.reset=function(){this.W[0]=1732584193;this.W[1]=4023233417;this.W[2]=2562383102;this.W[3]=271733878;this.W[4]=3285377520;this.$d=this.gc=0};
function jc(a,b,c){c||(c=0);var d=a.Mf;if(q(b))for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.W[0];c=a.W[1];for(var g=a.W[2],k=a.W[3],l=a.W[4],m,e=0;80>e;e++)40>e?20>e?(f=k^c&(g^k),m=1518500249):(f=c^g^k,m=1859775393):60>e?(f=c&g|k&(c|g),m=2400959708):(f=c^g^k,m=3395469782),f=(b<<
5|b>>>27)+f+l+m+d[e]&4294967295,l=k,k=g,g=(c<<30|c>>>2)&4294967295,c=b,b=f;a.W[0]=a.W[0]+b&4294967295;a.W[1]=a.W[1]+c&4294967295;a.W[2]=a.W[2]+g&4294967295;a.W[3]=a.W[3]+k&4294967295;a.W[4]=a.W[4]+l&4294967295}
ic.prototype.update=function(a,b){if(null!=a){p(b)||(b=a.length);for(var c=b-this.nb,d=0,e=this.he,f=this.gc;d<b;){if(0==f)for(;d<=c;)jc(this,a,d),d+=this.nb;if(q(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.nb){jc(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.nb){jc(this,e);f=0;break}}this.gc=f;this.$d+=b}};
ic.prototype.digest=function(){var a=[],b=8*this.$d;56>this.gc?this.update(this.Jd,56-this.gc):this.update(this.Jd,this.nb-(this.gc-56));for(var c=this.nb-1;56<=c;c--)this.he[c]=b&255,b/=256;jc(this,this.he);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.W[c]>>d&255,++b;return a};var kc=null,lc=null;function mc(a){var b="";nc(a,function(a){b+=String.fromCharCode(a)});return b}function nc(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=lc[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}oc();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),k=c(64);if(64===k&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=k&&b(g<<6&192|k))}}
function oc(){if(!kc){kc={};lc={};for(var a=0;65>a;a++)kc[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),lc[kc[a]]=a,62<=a&&(lc["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var pc=function(){var a=1;return function(){return a++}}();function z(a,b){if(!a)throw qc(b);}function qc(a){return Error("Wilddog ("+wilddog.Re+") INTERNAL ASSERT FAILED: "+a)}function rc(a){try{return"NODE"==CLIENT_TYPE?(new Buffer(a,"base64")).toString("utf8"):"undefined"!==typeof atob?atob(a):mc(a)}catch(b){Ra("base64Decode failed: ",b)}return null}
function sc(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,z(d<a.length,"Surrogate pair missing trail surrogate."),e=65536+(e<<10)+(a.charCodeAt(d)-56320));128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}a=new ic;a.update(b);b=a.digest();oc();a=kc;c=[];for(d=0;d<b.length;d+=3){var f=b[d],g=(e=d+1<b.length)?b[d+1]:0,k=d+2<b.length,l=k?b[d+2]:0,m=f>>2,f=(f&3)<<
4|g>>4,g=(g&15)<<2|l>>6,l=l&63;k||(l=64,e||(g=64));c.push(a[m],a[f],a[g],a[l])}return c.join("")}function tc(a){for(var b="",c=0;c<arguments.length;c++)var d=arguments[c],e=da(d),b="array"==e||"object"==e&&"number"==typeof d.length?b+tc.apply(null,arguments[c]):"object"===typeof arguments[c]?b+u(arguments[c]):b+arguments[c],b=b+" ";return b}var uc=null,vc=!0;function Ra(a){!0===vc&&(vc=!1,null===uc&&!0===v.get("logging_enabled")&&Wilddog.Ze(!0));if(uc){var b=tc.apply(null,arguments);uc(b)}}
function wc(a){return function(){Ra(a,arguments)}}function xc(a){if("undefined"!==typeof console){var b="WILDDOG INTERNAL ERROR: "+tc.apply(null,arguments);"undefined"!==typeof console.error?console.error(b):console.log(b)}}function yc(a){var b=tc.apply(null,arguments);throw Error("WILDDOG FATAL ERROR: "+b);}function B(a){if("undefined"!==typeof console){var b="WILDDOG WARNING: "+tc.apply(null,arguments);"undefined"!==typeof console.warn?console.warn(b):console.log(b)}}
function La(a){var b="",c="",d="",e="",f=!0,g="https",k=443;if(q(a)){var l=a.indexOf("//");0<=l&&(g=a.substring(0,l-1),a=a.substring(l+2));l=a.indexOf("/");-1===l&&(l=a.length);b=a.substring(0,l);e="";a=a.substring(l).split("/");for(l=0;l<a.length;l++)if(0<a[l].length){var m=a[l];try{m=decodeURIComponent(m.replace(/\+/g," "))}catch(A){}e+="/"+m}a=b.split(".");3===a.length?(c=a[1],d=a[0].toLowerCase()):2===a.length&&(c=a[0]);l=b.indexOf(":");0<=l&&(f="https"===g||"wss"===g,k=b.substring(l+1),isFinite(k)&&
(k=String(k)),k=q(k)?/^\s*-?0x/i.test(k)?parseInt(k,16):parseInt(k,10):NaN)}return{host:b,port:k,domain:c,bh:d,Pb:f,scheme:g,Lb:e}}function zc(a){return fa(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)}function Ac(a,b){if(a===b)return 0;if("[MIN_NAME]"===a||"[MAX_NAME]"===b)return-1;if("[MIN_NAME]"===b||"[MAX_NAME]"===a)return 1;var c=Bc(a),d=Bc(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:a<b?-1:1}
function Cc(a){if("object"!==typeof a||null===a)return u(a);var b=[],c;for(c in a)b.push(c);b.sort();c="{";for(var d=0;d<b.length;d++)0!==d&&(c+=","),c+=u(b[d]),c+=":",c+=Cc(a[b[d]]);return c+"}"}function Dc(a,b){if(ea(a))for(var c=0;c<a.length;++c)b(c,a[c]);else w(a,b)}
function Ec(a){z(!zc(a),"Invalid JSON number");var b,c,d,e;0===a?(d=c=0,b=-Infinity===1/a?1:0):(b=0>a,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;--a)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;--a)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join("");c="";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&&
(d="0"+d),c+=d;return c.toLowerCase()}var Fc=/^-?\d{1,10}$/;function Bc(a){return Fc.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Gc(a){try{a()}catch(b){setTimeout(function(){B("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function C(a,b){if(ga(a)){var c=Array.prototype.slice.call(arguments,1).slice();Gc(function(){a.apply(null,c)})}};function Hc(a){z(ea(a)&&0<a.length,"Requires a non-empty array");this.Qf=a;this.tb={}}Hc.prototype.ae=function(a,b){for(var c=this.tb[a]||[],d=0;d<c.length;d++)if(c[d].Ef){var e=c.splice(d,1)[0];e.yb.apply(e.context,Array.prototype.slice.call(arguments,1))}else c[d].yb.apply(c[d].context,Array.prototype.slice.call(arguments,1))};Hc.prototype.Hb=function(a,b,c){Ic(this,a);this.tb[a]=this.tb[a]||[];this.tb[a].push({yb:b,context:c,Ef:!1});(a=this.od(a))&&b.apply(c,[a])};
Hc.prototype.Hd=function(a,b,c){Ic(this,a);var d=this.od(a);d?b.apply(c,[d]):(this.tb[a]=this.tb[a]||[],this.tb[a].push({yb:b,context:c,Ef:!0}))};Hc.prototype.mc=function(a,b,c){Ic(this,a);a=this.tb[a]||[];for(var d=0;d<a.length;d++)if(a[d].yb===b&&(!c||c===a[d].context)){a.splice(d,1);break}};function Ic(a,b){z(eb(a.Qf,function(a){return a===b}),"Unknown event: "+b)};function D(a,b){Hc.call(this,["authStateChanged","authTokenExpired"]);this.Nf={Df:!1};this.Se={};Object.defineProperty(this,"name",{value:b,writable:!1});Object.defineProperty(this,"options",{value:a,writable:!1});this.INTERNAL=new gc(this)}la(D,Hc);function Jc(a,b){D.prototype[a]=function(){return b(this)}}
D.prototype.cg=function(a,b){var c=!0,d;for(d in Kc)if(Kc.hasOwnProperty(d)&&Kc[d]===a){c=!1;break}if(c)throw Error("Unknown event "+a);this.Se[a]=b;switch(a){case Kc.Na:this.Nf.Df=b&&b.Df}this.ae(a,b)};D.prototype.emit=D.prototype.cg;D.prototype.Tf=function(a,b){this.Hd(a,b)};D.prototype.bindOnce=D.prototype.Tf;D.prototype.bind=function(a,b){this.Hb(a,b)};D.prototype.bind=D.prototype.bind;D.prototype.fh=function(a,b){this.mc(a,b)};D.prototype.unbind=D.prototype.fh;D.prototype.od=function(a){switch(a){case Kc.Na:return this.Se[Kc.Na]}return null};
var Kc={Na:"authStateChanged",cd:"authTokenExpired"};D.prototype.Ha=Kc;function Lc(a,b,c,d,e,f){this.uid=e;this.displayName=a;this.phone=f;this.email=b;this.photoURL=c;this.providerId=d};function E(a,b,c,d,e){Lc.call(this,b.displayName,b.email,b.photoURL,b.providerId,b.uid,b.phone);this.isAnonymous="anonymous"===this.providerId;this.emailVerified=!0===c;this.phoneVerified=!0===d;this.providerData=e||[];this.refreshToken=null;Object.defineProperty(this,"__authManager",{value:a,writable:!1})}la(E,Lc);ka("wd.User",E);E.prototype["delete"]=function(a){var b=new x;Mc(this.__authManager,this.Ka(),y(b,a));return b.o};E.prototype["delete"]=E.prototype["delete"];
E.prototype.Ka=function(){return(this.__authManager.Wa||null).idToken};E.prototype.getToken=E.prototype.Ka;E.prototype.se=function(){return this.phone};E.prototype.getPhone=E.prototype.se;
E.prototype.link=function(a,b){F("wilddog.User.link",1,2,arguments.length);Nc("wilddog.User.link",a);var c=a.provider,d=new x,e={};e.idToken=this.Ka();"password"==c?(e.email=a.email,e.password=a.password,Oc(this.__authManager,e,y(d,b))):(e.providerId=a.provider,e.accessToken=a.accessToken,e.openId=a.openId||"",e.authType="link",Pc(this.__authManager,e,y(d,b)));return d.o};E.prototype.link=E.prototype.link;
E.prototype.ih=function(a,b){F("wilddog.User.unlink",1,2,arguments.length);Qc("wilddog.User.unlink",1,a);var c=new x,d=this;Rc(this.__authManager,"unlink",{idToken:this.Ka(),deleteProvider:[a]},y(c,function(c,f){f&&(d.providerData=d.providerData.filter(function(b){if(b.providerId!=a)return b}),0===d.providerData.length&&Sc(d.__authManager));b&&b(c,f)}));return c.o};E.prototype.unlink=E.prototype.ih;
E.prototype.sg=function(a,b){F("wilddog.auth().signInWithPopup",1,2,arguments.length);Nc("wilddog.auth().signInWithPopup",a);var c=new x;Tc(this.__authManager,a,{authType:"link",idToken:this.Ka()},y(c,b));return c.o};E.prototype.linkWithPopup=E.prototype.sg;E.prototype.tg=function(a,b){F("wilddog.auth().signInWithPopup",1,2,arguments.length);Nc("wilddog.auth().signInWithPopup",a);var c=new x;Uc(this.__authManager,a,{authType:"link",idToken:this.Ka()},y(c,b));return c.o};
E.prototype.linkWithRedirect=E.prototype.tg;E.prototype.mh=function(a,b){F("wilddog.User.updateProfile",1,2,arguments.length);Nc("wilddog.User.updateProfile",a);var c=new x;a.idToken=this.Ka();Rc(this.__authManager,"profile",a,y(c,b));return c.o};E.prototype.updateProfile=E.prototype.mh;E.prototype.jh=function(a,b){F("wilddog.User.updateEmail",1,2,arguments.length);Qc("wilddog.User.updateEmail",1,a);var c=new x;Oc(this.__authManager,{email:a,idToken:this.Ka()},y(c,b));return c.o};
E.prototype.updateEmail=E.prototype.jh;E.prototype.lh=function(a,b){F("wilddog.User.updatePhone",1,2,arguments.length);Qc("wilddog.User.updatePhone",1,a);var c=new x;Oc(this.__authManager,{phoneNumber:a,idToken:this.Ka()},y(c,b));return c.o};E.prototype.updatePhone=E.prototype.lh;E.prototype.oh=function(a,b){F("wilddog.User.verifiyPhone",1,2,arguments.length);Qc("wilddog.User.verifiyPhone",1,a);var c=new x;Vc(this.__authManager,{phoneNumber:this.se(),smsCode:a},y(c,b));return c.o};
E.prototype.verifiyPhone=E.prototype.oh;E.prototype.kh=function(a,b){F("wilddog.User.updatePassword",1,2,arguments.length);Qc("wilddog.User.updatePassword",1,a);var c=new x;Oc(this.__authManager,{password:a,idToken:this.Ka()},y(c,b));return c.o};E.prototype.updatePassword=E.prototype.kh;
E.prototype.Lg=function(a){F("wilddog.User.sendEmailVerification",0,1,arguments.length);G("wilddog.User.sendEmailVerification",1,a,!0);var b=new x;Wc(this.__authManager,{idToken:this.Ka(),requestType:"VERIFY_EMAIL"},y(b,a));return b.o};E.prototype.sendEmailVerification=E.prototype.Lg;
E.prototype.Og=function(a){F("wilddog.User.sendPhoneVerification",0,1,arguments.length);G("wilddog.User.sendPhoneVerification",1,a,!0);var b=new x;Xc(this.__authManager,{phoneNumber:this.se(),type:"PHONE_VERIFY"},y(b,a));return b.o};E.prototype.sendPhoneVerification=E.prototype.Og;E.prototype.reload=function(a){F("wilddog.User.reload",0,1,arguments.length);G("wilddog.User.reload",1,a,!0);var b=new x;Yc(this.__authManager,this.Ka(),y(b,a));return b.o};E.prototype.reload=E.prototype.reload;
E.prototype.Fg=function(a,b){F("wilddog.User.reload",1,2,arguments.length);G("wilddog.User.reload",2,b,!0);if(!a||!a.provider)throw Error("Unknown credential object.");var c=new x;Pc(this.__authManager,a,y(c,b));return c.o};E.prototype.reauthenticate=E.prototype.Fg;function Zc(a){var b="POST";switch(a.providerId||a.provider){case "password":a="verifyPassword";break;case "anonymous":a="verifyAnonymous";break;case "custom":a="verifyCustomToken";break;default:a="credential",b="GET"}if(!a)throw Error("Unknown provider '"+provider+"'.");return{path:a,method:b}};function $c(a){if(a&&a.users&&a.users[0])return a=a.users[0],new Lc(a.displayName,a.email,a.photoUrl,a.providerId,a.localId,a.phoneNumber);throw Error("Bad response format.");}function ad(a,b){var c=$c(b);if(!c)return null;var d=b.users[0],e=d.providerUserInfo.map(function(a){a.photoURL=a.photoUrl;delete a.photoUrl;return a});return new E(a,c,d.emailVerified,d.phoneNumberVerified,e)};function bd(a){var b={},c={},d={},e="";try{var f=a.split("."),g=rc(f[0])||"",k=rc(f[1])||"",b=Ca(g),c=Ca(k),e=f[2],d=c.d||{};delete c.d}catch(l){console.warn("error",l)}return{vh:b,je:c,data:d,xh:e}}function cd(a){a=bd(a).je;return"object"===typeof a&&a.hasOwnProperty("iat")?t(a,"iat"):null};function dd(a,b,c){this.Fe=["session",b.Kd,b.xc,a].join(":");this.Yd=c}dd.prototype.set=function(a,b){if(!b)if(this.Yd.length)b=this.Yd[0];else throw Error("wd.auth.SessionManager : No storage options available!");b.set(this.Fe,a)};dd.prototype.get=function(){var a=bb(this.Yd,r(this.ng,this)),a=ab(a,function(a){return null!==a});hb(a,function(a,c){return cd(c.idToken)-cd(a.idToken)});return 0<a.length?a.shift():null};dd.prototype.ng=function(a){try{var b=a.get(this.Fe);if(b.idToken)return b;this.clear(a)}catch(c){}return null};
dd.prototype.clear=function(){var a=this;ta(this.Yd,function(b){b.remove(a.Fe)})};function ed(a,b,c){this.gd=a||{};this.Yc=b||{};this.$=c||{};this.gd.remember||(this.gd.remember="default")}var fd=["remember","redirectTo"];function gd(a){var b={},c={};qa(a||{},function(a,e){0<=$a(fd,a)?b[a]=e:c[a]=e});return new ed(b,{},c)};function hd(a,b,c){this.fb=a;this.M=a.app;this.Ub=b;this.rc=new dd(this.M.name,b,[Ua,v]);this.Wa=null;this.Ib=c;id(this)}function jd(a){var b=v.get("redirect_request_id");a=a.rc.get();return b||a&&a.idToken}function id(a){v.get("redirect_request_id")&&ld(a);var b=a.rc.get();b&&b.idToken?Yc(a,b.idToken,function(c,d){if(!c&&d){var e={signIn:!0};e.currentUser=d;e.idToken=b.idToken;md(a,e,{});nd(a,e)}else nd(a,null)}):nd(a,null)}
function od(a,b,c,d){b&&b.idToken?pd(a,b.idToken,c,function(a,b){d(a,b)}):(nd(a,null),d(Error("No idToken found in response.")))}function pd(a,b,c,d){Yc(a,b,function(e,f){if(!e&&f){var g={signIn:!0};g.currentUser=f;g.idToken=b;md(a,g,c);nd(a,g);d(null,f)}else nd(a,null),d(e)})}function Sc(a,b){a.M.bindOnce(a.M.Ha.Na,function(){nd(a,null);b&&b(null)})}
function Pc(a,b,c){qd(a);var d=new ed({},{},b||{});b=Zc(b);d.$._method=b.method;var e=ec(["XHR","JSONP","NodeHttp","WxHttp"]);rd(a,e,"/auth/"+b.path,d,function(a,b){C(c,a,b)})}function sd(a,b){qd(a);var c=new ed({},{},{}),d=ec(["WxImplicit"]);rd(a,d,"/auth/wxapp",c,function(a,c){C(b,a,c)})}
function Tc(a,b,c,d){qd(a);var e=ec(["Popup","Cordova"]);requestInfo=gd(c);height=width=625;b.id?(requestInfo.$.providerId=b.id,requestInfo.$.scope=b.scope||"",requestInfo.$.appId=a.Ub.xc,requestInfo.Yc.window_features="menubar=yes,modal=yes,alwaysRaised=yeslocation=yes,resizable=yes,scrollbars=yes,status=yes,height="+height+",width="+width+",top="+("object"===typeof screen?.5*(screen.height-height):0)+",left="+("object"===typeof screen?.5*(screen.width-width):0),requestInfo.Yc.relay_url=Ma(a.Ub.xc),
requestInfo.Yc.requestWithCredential=r(a.cb,a),rd(a,e,"/auth/oauth",requestInfo,function(a,b){C(d,a,b)})):setTimeout(function(){C(d,oa("TRANSPORT_UNAVAILABLE_FOR_UNKNOWN_PROVIDER"))},0)}function Uc(a,b,c,d){qd(a);var e=ec(["Redirect"]);c=gd(c);b.id?(c.$.providerId=b.id,c.$.scope=b.scope||"",c.$.appId=a.Ub.xc,v.set("redirect_client_options",c.gd),rd(a,e,"/auth/oauth",c,function(a,b){C(d,a,b)})):C(d,oa("TRANSPORT_UNAVAILABLE"))}
function ld(a){var b=v.get("redirect_request_id");if(b){var c=v.get("redirect_client_options"),d=ec(["XHR","JSONP"]);serverParams={requestId:b,requestKey:Ja()};transportOptions={};requestInfo=new ed(c,transportOptions,serverParams);try{document.location.hash=document.location.hash.replace(/&__wilddog_request_key=([a-zA-z0-9]*)/,"")}catch(e){}rd(a,d,"/auth/session",requestInfo,function(){v.remove("redirect_request_id");v.remove("redirect_client_options")}.bind(a))}}
function td(a,b,c){qd(a);b=gd(b);b.$._method="POST";a.cb("/auth/signupNewUser",b,function(b,e){!b&&e&&e.idToken?pd(a,e.idToken,null,function(a,b){C(c,a,b)}):C(c,b)})}
function Rc(a,b,c,d){var e={idToken:c.idToken},f=c.photoURL||a.Wa.currentUser.photoURL,g=c.displayName||a.Wa.currentUser.displayName;switch(b){case "unlink":e.deleteProvider=c.deleteProvider;break;case "profile":e.photoUrl=f,e.displayName=g}ud(a,e,function(b,c){b?C(d,b):(a.Wa.currentUser.displayName=g,a.Wa.currentUser.photoURL=f,md(a,a.Wa),C(d,b,c))})}function Oc(a,b,c){ud(a,b,function(b,e){b?C(c,b):od(a,e,{},c)})}
function ud(a,b,c){b=gd(b);b.$._method="POST";b.$.idToken=a.Wa.idToken;a.cb("/auth/setAccountInfo",b,function(a,b){a?c(a):c(a,b)})}function Yc(a,b,c){qd(a);b=gd({idToken:b});b.$._method="POST";a.cb("/auth/getAccountInfo",b,function(b,e){b?c(b):c(b,ad(a,e))})}function Mc(a,b,c){qd(a);b=gd({idToken:b});b.$._method="POST";a.cb("/auth/deleteAccount",b,function(b,e){!b&&e&&"ok"==e.status&&a.Wa&&Sc(a);C(c,b)})}
function Wc(a,b,c){qd(a);b=gd(b);b.$._method="POST";a.cb("/auth/getOobConfirmationCode",b,function(a,b){C(c,a,b)})}hd.prototype.ne=function(a,b){qd(this);var c=gd({email:a});c.$._method="POST";this.cb("/auth/getProvider",c,function(a,c){a?C(b,a):C(b,a,c.allProviders||[])})};hd.prototype.cb=function(a,b,c){var d=ec(["XHR","JSONP","NodeHttp","WxHttp"]);vd(this,d,a,b,c)};
function rd(a,b,c,d,e){vd(a,b,c,d,function(b,c){!b&&c&&c.idToken?od(a,c,d.gd,function(a,b){a?e(a):e(null,b)}):e(b||oa("UNKNOWN_ERROR"))})}
function vd(a,b,c,d,e){b=ab(b,function(a){return"function"===typeof a.isAvailable&&a.isAvailable()});0===b.length?setTimeout(function(){e(oa("TRANSPORT_UNAVAILABLE"))},0):(b=b.shift(),d.Yc.method=d.$._method,b=new b(d.Yc),d=ra(d.$),d.v=CLIENT_TYPE+CLIENT_VERSION,d.transport="json",d.suppress_status_codes=!0,a=Ka()+"/"+a.Ub.xc+c,b.open(a,d,function(a,b){if(a)e(a);else if(b&&b.error){var c=Error(b.message);c.code=b.errcode;e(c)}else e(null,b)}))}
function md(a,b,c){a.rc.clear();c=c||{};var d=Ua;"sessionOnly"===c.remember&&(d=v);"none"!==c.remember&&a.rc.set(b,d)}function nd(a,b){a.Wa=b;a.fb.currentUser=b&&b.signIn?b.currentUser:null;a.Ib&&a.Ib(null!==b);b&&b.signIn||a.rc.clear();a.M.emit(a.M.Ha.Na,b||{signIn:!1})}function qd(a){if(a.Ub.kf&&"auth.wilddog.com"===Fa)throw Error("This custom Wilddog server ('"+a.Ub.domain+"') does not support delegated login.");}
function Vc(a,b,c){b=gd(b);b.$._method="POST";a.cb("/auth/verifyPhone",b,function(b,e){!b&&e&&"ok"==e.status&&a.fb.currentUser&&(a.fb.currentUser.phoneVerified=!0);!b&&e&&e.idToken?pd(a,e.idToken,null,function(a){C(c,a)}):C(c,b)})}function xd(a,b,c){qd(a);b=gd(b);b.$._method="POST";a.cb("/auth/resetPhonePassword",b,function(a,b){a?C(c,a):C(c,a,b)})}function Xc(a,b,c){qd(a);b=gd(b);b.$._method="POST";a.cb("/auth/sendSmsCode",b,function(a,b){C(c,a,b)})};function F(a,b,c,d){var e;d<b?e="at least "+b:d>c&&(e=0===c?"none":"no more than "+c);if(e)throw Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+".");}function yd(a,b,c){switch(b){case 1:b=c?"first":"First";break;case 2:b=c?"second":"Second";break;case 3:b=c?"third":"Third";break;case 4:b=c?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}return a+" failed: "+(b+" argument ")}
function G(a,b,c,d){if((!d||p(c))&&!ga(c))throw Error(yd(a,b,d)+"must be a valid function.");}function zd(a,b,c){if(p(c)&&(!ha(c)||null===c))throw Error(yd(a,b,!0)+"must be a valid context object.");};function I(a,b){if(1==arguments.length){this.C=a.split("/");for(var c=0,d=0;d<this.C.length;d++)0<this.C[d].length&&(this.C[c]=this.C[d],c++);this.C.length=c;this.ca=0}else this.C=a,this.ca=b}function J(a,b){var c=K(a);if(null===c)return b;if(c===K(b))return J(L(a),L(b));throw Error("INTERNAL ERROR: innerPath ("+b+") is not within outerPath ("+a+")");}function K(a){return a.ca>=a.C.length?null:a.C[a.ca]}function Ad(a){return a.C.length-a.ca}
function L(a){var b=a.ca;b<a.C.length&&b++;return new I(a.C,b)}function Bd(a){return a.ca<a.C.length?a.C[a.C.length-1]:null}h=I.prototype;h.toString=function(){for(var a="",b=this.ca;b<this.C.length;b++)""!==this.C[b]&&(a+="/"+this.C[b]);return a||"/"};h.slice=function(a){return this.C.slice(this.ca+(a||0))};h.parent=function(){if(this.ca>=this.C.length)return null;for(var a=[],b=this.ca;b<this.C.length-1;b++)a.push(this.C[b]);return new I(a,0)};
h.w=function(a){for(var b=[],c=this.ca;c<this.C.length;c++)b.push(this.C[c]);if(a instanceof I)for(c=a.ca;c<a.C.length;c++)b.push(a.C[c]);else for(a=a.split("/"),c=0;c<a.length;c++)0<a[c].length&&b.push(a[c]);return new I(b,0)};h.f=function(){return this.ca>=this.C.length};h.fa=function(a){if(Ad(this)!==Ad(a))return!1;for(var b=this.ca,c=a.ca;b<=this.C.length;b++,c++)if(this.C[b]!==a.C[c])return!1;return!0};
h.contains=function(a){var b=this.ca,c=a.ca;if(Ad(this)>Ad(a))return!1;for(;b<this.C.length;){if(this.C[b]!==a.C[c])return!1;++b;++c}return!0};var M=new I("");function Cd(a,b){this.ab=a.slice();this.Oa=Math.max(1,this.ab.length);this.af=b;for(var c=0;c<this.ab.length;c++)this.Oa+=Dd(this.ab[c]);Ed(this)}Cd.prototype.push=function(a){0<this.ab.length&&(this.Oa+=1);this.ab.push(a);this.Oa+=Dd(a);Ed(this)};Cd.prototype.pop=function(){var a=this.ab.pop();this.Oa-=Dd(a);0<this.ab.length&&--this.Oa};
function Ed(a){if(768<a.Oa)throw Error(a.af+"has a key path longer than 768 bytes ("+a.Oa+").");if(32<a.ab.length)throw Error(a.af+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+Fd(a));}function Fd(a){return 0==a.ab.length?"":"in property '"+a.ab.join(".")+"'"};function Dd(a){for(var b=0,c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b++:2048>d?b+=2:55296<=d&&56319>=d?(b+=4,c++):b+=3}return b};var Gd=/[\[\].#$\/\u0000-\u001F\u007F]/,Hd=/[\[\].#$\u0000-\u001F\u007F]/;function Id(a){return q(a)&&0!==a.length&&!Gd.test(a)}function Jd(a){return null===a||q(a)||fa(a)&&!zc(a)||ha(a)&&pa(a,".sv")}function Kd(a,b,c,d){d&&!p(b)||Ld(yd(a,1,d),b,c)}
function Ld(a,b,c){c instanceof I&&(c=new Cd(c,a));if(!p(b))throw Error(a+"contains undefined "+Fd(c));if(ga(b))throw Error(a+"contains a function "+Fd(c)+" with contents: "+b.toString());if(zc(b))throw Error(a+"contains "+b.toString()+" "+Fd(c));if(q(b)&&b.length>10485760/3&&10485760<Dd(b))throw Error(a+"contains a string greater than 10485760 utf8 bytes "+Fd(c)+" ('"+b.substring(0,50)+"...')");if(ha(b)){var d=!1,e=!1;qa(b,function(b,g){if(".value"===b)d=!0;else if(".priority"!==b&&".sv"!==b&&(e=
!0,!Id(b)))throw Error(a+" contains an invalid key ("+b+") "+Fd(c)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');c.push(b);Ld(a,g,c);c.pop()});if(d&&e)throw Error(a+' contains ".value" child '+Fd(c)+" in addition to actual children.");}}
function Md(a,b){var c,d;for(c=0;c<b.length;c++){d=b[c];for(var e=d.slice(),f=0;f<e.length;f++)if((".priority"!==e[f]||f!==e.length-1)&&!Id(e[f]))throw Error(a+"contains an invalid key ("+e[f]+") in path "+d.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');}b.sort(I.th);e=null;for(c=0;c<b.length;c++){d=b[c];if(null!==e&&e.contains(d))throw Error(a+"contains a path "+e.toString()+" that is ancestor of another path "+d.toString());e=d}}
function Nd(a,b,c){var d=yd(a,1,!1);if(!ha(b)||ea(b))throw Error(d+" must be an Object containing the children to replace.");if(pa(b,".value"))throw Error(d+' must not contain ".value". To overwrite with a leaf value, just use .set() instead.');var e=[];qa(b,function(a,b){var f=new I(a);Ld(d,b,c.w(f));if(".priority"===Bd(f)&&!Jd(b))throw Error(d+"contains an invalid value for '"+f.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");e.push(f)});
Md(d,e)}function Od(a,b,c){if(zc(c))throw Error(yd(a,b,!1)+"is "+c.toString()+", but must be a valid Wilddog priority (a string, finite number, server value, or null).");if(!Jd(c))throw Error(yd(a,b,!1)+"must be a valid Wilddog priority (a string, finite number, server value, or null).");}
function Pd(a,b,c){if(!c||p(b))switch(b){case "value":case "child_added":case "child_removed":case "child_changed":case "child_moved":break;default:throw Error(yd(a,1,c)+'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".');}}function Qd(a,b,c,d){if((!d||p(c))&&!Id(c))throw Error(yd(a,b,d)+'was an invalid key: "'+c+'". Wilddog keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").');}
function Rd(a,b){if(!q(b)||0===b.length||Hd.test(b))throw Error(yd(a,1,!1)+'was an invalid path: "'+b+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');}function Sd(a,b){b&&(b=b.replace(/^\/*\.info(\/|$)/,"/"));Rd(a,b)}function Td(a,b){if(".info"===K(b))throw Error(a+" failed: Can't modify data under /.info/");}function Qc(a,b,c){if(!q(c))throw Error(yd(a,b,!1)+"must be a valid string.");}
function Nc(a,b){if(!ha(b)||null===b)throw Error(yd(a,1,!1)+"must be a valid object.");};function Ud(a){this.fb=a}Ud.prototype.lg=function(){return this.fb.Ve};Ud.prototype.getAuthRevokListener=Ud.prototype.lg;function N(a){if(!a.options.authDomain)throw Error("Could not find 'authDomain' in options.");var b=this;this.Rf=function(a){var b=/^([a-zA-Z0-9\-_]+)\.([a-z]+)\.com/.exec(a.toLowerCase());if(!b)throw Error("Bad 'authDomain' format '"+a+"'.");return{xc:b[1],zh:b[2],rh:b[0],Kd:"",kf:"wilddog"!==b[2]}}(a.options.authDomain);this.app=a;this.ea=new hd(this,this.Rf);this.Ve=function(a){var c=b.ea;a=a.reason;c.fb.currentUser&&(c.rc.clear(),c.Wa=null,c.fb.currentUser=null,c.M.emit(c.M.Ha.Na,{signIn:!1,reason:a}),
c.Ib&&c.Ib(!1))};this.app.bind(this.app.Ha.cd,this.Ve);this.INTERNAL=new Ud(this)}N.prototype.vg=function(a){function b(b){(b&&b.signIn||!jd(c.ea))&&setTimeout(function(){a(b&&b.signIn?b.currentUser:null)},0)}var c=this;F("wilddog.auth().onAuthStateChanged",1,1,arguments.length);G("wilddog.auth().onAuthStateChanged",1,a,!1);this.app.bind(this.app.Ha.Na,b);return function(){c.app.unbind(c.app.Ha.Na,b)}};N.prototype.onAuthStateChanged=N.prototype.vg;
N.prototype.Sg=function(a){F("wilddog.auth().signInAnonymously",0,1,arguments.length);G("wilddog.auth().signInAnonymously",1,a,!0);var b=new x;td(this.ea,{},y(b,a));return b.o};N.prototype.signInAnonymously=N.prototype.Sg;N.prototype.Tg=function(a){F("wilddog.auth().signInAnonymously",0,1,arguments.length);G("wilddog.auth().signInAnonymously",1,a,!0);var b=new x;sd(this.ea,y(b,a));return b.o};N.prototype.signInWeapp=N.prototype.Tg;
N.prototype.Mg=function(a,b){F("wilddog.auth().sendPasswordResetEmail",1,2,arguments.length);G("wilddog.auth().sendPasswordResetEmail",2,b,!0);var c=new x;Wc(this.ea,{requestType:"RESET_PASSWORD",email:a},y(c,b));return c.o};N.prototype.sendPasswordResetEmail=N.prototype.Mg;N.prototype.Ng=function(a,b){F("wilddog.auth().sendPasswordResetSms",1,2,arguments.length);G("wilddog.auth().sendPasswordResetSms",2,b,!0);var c=new x;Xc(this.ea,{type:"PASSWORD_RESET",phoneNumber:a},y(c,b));return c.o};
N.prototype.sendPasswordResetSms=N.prototype.Ng;N.prototype.Yf=function(a,b,c,d){F("wilddog.auth().sendPasswordResetSms",3,4,arguments.length);G("wilddog.auth().sendPasswordResetSms",4,d,!0);Qc("wilddog.auth().sendPasswordResetSms",2,b);var e=new x;xd(this.ea,{phoneNumber:a,password:c,smsCode:b},y(e,d));return e.o};N.prototype.confirmPasswordResetSms=N.prototype.Yf;
N.prototype.ne=function(a,b){F("wilddog.auth().fetchProvidersForEmail",1,2,arguments.length);G("wilddog.auth().fetchProvidersForEmail",2,b,!0);var c=new x;this.ea.ne(a,y(c,b));return c.o};N.prototype.fetchProvidersForEmail=N.prototype.ne;N.prototype.Vg=function(a,b){F("wilddog.auth().signInWithCustomToken",1,2,arguments.length);G("wilddog.auth().signInWithCustomToken",2,b,!0);var c=new x;Pc(this.ea,{providerId:"custom",token:a},y(c,b));return c.o};N.prototype.signInWithCustomToken=N.prototype.Vg;
N.prototype.Wg=function(a,b,c){F("wilddog.auth().signInWithEmailAndPassword",2,3,arguments.length);G("wilddog.auth().signInWithEmailAndPassword",3,c,!0);var d=new x;Pc(this.ea,{providerId:"password",password:b,email:a},y(d,c));return d.o};N.prototype.signInWithEmailAndPassword=N.prototype.Wg;
N.prototype.Xg=function(a,b,c){F("wilddog.auth().signInWithPhoneAndPassword",2,3,arguments.length);G("wilddog.auth().signInWithPhoneAndPassword",3,c,!0);var d=new x;Pc(this.ea,{providerId:"password",password:b,phoneNumber:a},y(d,c));return d.o};N.prototype.signInWithPhoneAndPassword=N.prototype.Xg;N.prototype.$g=function(a){F("wilddog.auth().signOut",0,1,arguments.length);G("wilddog.auth().signOut",1,a,!0);var b=new x;Sc(this.ea,y(b,a));return b.o};N.prototype.signOut=N.prototype.$g;
N.prototype.Zf=function(a,b,c){F("wilddog.auth().createUserWithEmailAndPassword",2,3,arguments.length);G("wilddog.auth().createUserWithEmailAndPassword",3,c,!0);var d=new x;td(this.ea,{email:a,password:b},y(d,c));return d.o};N.prototype.createUserWithEmailAndPassword=N.prototype.Zf;
N.prototype.$f=function(a,b,c){F("wilddog.auth().createUserWithPhoneAndPassword",2,3,arguments.length);G("wilddog.auth().createUserWithPhoneAndPassword",3,c,!0);var d=new x;td(this.ea,{phoneNumber:a,password:b},y(d,c));return d.o};N.prototype.createUserWithPhoneAndPassword=N.prototype.$f;N.prototype.Yg=function(a,b){F("wilddog.auth().signInWithPopup",1,2,arguments.length);Nc("wilddog.auth().signInWithPopup",a);var c=new x;Tc(this.ea,a,{authType:"login"},y(c,b));return c.o};
N.prototype.signInWithPopup=N.prototype.Yg;N.prototype.Zg=function(a,b){F("wilddog.auth().signInWithRedirect",1,2,arguments.length);Nc("wilddog.auth().signInWithRedirect",a);var c=new x;Uc(this.ea,a,{authType:"login"},y(c,b));return c.o};N.prototype.signInWithRedirect=N.prototype.Zg;
N.prototype.Ug=function(a,b){F("wilddog.auth().signInWithCredential",1,2,arguments.length);Nc("wilddog.auth().signInWithCredential",a);var c={};"password"==a.provider?(c.providerId=a.provider,c.email=a.email,c.phoneNumber=a.phone,c.password=a.password):(c.providerId=a.provider,c.accessToken=a.accessToken,c.openId=a.openId||a.email);c.authType="login";var d=new x;Pc(this.ea,c,y(d,b));return d.o};N.prototype.signInWithCredential=N.prototype.Ug;function Vd(){this.Ye="DEFAULT";this.ug={};this.$c={};this.ge=this.app=null}Vd.prototype.qg=function(a,b){var c=b||this.Ye;this.$c[c]=new D(a,c);b==this.Ye||null==b?this.app=this.$c[c]:this[c]=this.$c[c];return this.$c[c]};Vd.prototype.initializeApp=Vd.prototype.qg;Vd.prototype.Ge=function(a,b){this.ug[a]=b;Jc(a,b);this[a]=function(){if(this.app)return this.app[a]();throw Error("Default application not initialized!Please call wilddog.initializeApp first.");}};Vd.prototype.regService=Vd.prototype.Ge;
Vd.prototype.Re=CLIENT_VERSION;Vd.prototype.SDK_VERSION=Vd.prototype.Re;var Wd=new Vd;function Xd(a,b){return Ac(a.name,b.name)}function Yd(a,b){return Ac(a,b)};function Zd(){}var $d={};function ae(a){return r(a.compare,a)}Zd.prototype.ud=function(a,b){return 0!==this.compare(new O("[MIN_NAME]",a),new O("[MIN_NAME]",b))};function be(a){this.ic=a}la(be,Zd);h=be.prototype;h.Fc=function(a){return!a.S(this.ic).f()};h.compare=function(a,b){var c=a.node.S(this.ic),d=b.node.S(this.ic),c=c.Ac(d);return 0===c?Ac(a.name,b.name):c};h.Kc=function(a,b){var c=P(a),c=Q.V(this.ic,c);return new O(b,c)};h.Lc=function(){var a=Q.V(this.ic,ce);return new O("[MAX_NAME]",a)};
h.toString=function(){return this.ic};function de(){}la(de,Zd);h=de.prototype;h.compare=function(a,b){var c=a.node.H(),d=b.node.H(),c=c.Ac(d);return 0===c?Ac(a.name,b.name):c};h.Fc=function(a){return!a.H().f()};h.ud=function(a,b){return!a.H().fa(b.H())};h.Lc=function(){return new O("[MAX_NAME]",new ee("[PRIORITY-POST]",ce))};h.Kc=function(a,b){var c=P(a);return new O(b,new ee("[PRIORITY-POST]",c))};h.toString=function(){return".priority"};var R=new de;function fe(){}la(fe,Zd);h=fe.prototype;
h.compare=function(a,b){return Ac(a.name,b.name)};h.Fc=function(){throw qc("KeyIndex.isDefinedOn not expected to be called.");};h.ud=function(){return!1};h.Lc=function(){return new O("[MAX_NAME]",Q)};h.Kc=function(a){z(q(a),"KeyIndex indexValue must always be a string.");return new O(a,Q)};h.toString=function(){return".key"};var ge=new fe;function he(){}la(he,Zd);h=he.prototype;h.compare=function(a,b){var c=a.node.Ac(b.node);return 0===c?Ac(a.name,b.name):c};h.Fc=function(){return!0};
h.ud=function(a,b){return!a.fa(b)};h.Lc=function(){return ie};h.Kc=function(a,b){var c=P(a);return new O(b,c)};h.toString=function(){return".value"};var je=new he;function ke(a,b){this.vd=a;this.jc=b}ke.prototype.get=function(a){var b=t(this.vd,a);if(!b)throw Error("No index defined for "+a);return b===$d?null:b};function le(a,b,c){var d=mb(a.vd,function(d,f){var e=t(a.jc,f);z(e,"Missing index implementation for "+f);if(d===$d){if(e.Fc(b.node)){for(var k=[],l=c.cc(me),m=S(l);m;)m.name!=b.name&&k.push(m),m=S(l);k.push(b);return ne(k,ae(e))}return $d}e=c.get(b.name);k=d;e&&(k=k.remove(new O(b.name,e)));return k.Ya(b,b.node)});return new ke(d,a.jc)}
function oe(a,b,c){var d=mb(a.vd,function(a){if(a===$d)return a;var d=c.get(b.name);return d?a.remove(new O(b.name,d)):a});return new ke(d,a.jc)}var pe=new ke({".priority":$d},{".priority":R});function O(a,b){this.name=a;this.node=b}function me(a,b){return new O(a,b)};function ee(a,b){this.J=a;z(p(this.J)&&null!==this.J,"LeafNode shouldn't be created with null/undefined value.");this.ha=b||Q;qe(this.ha);this.Fb=null}h=ee.prototype;h.T=function(){return!0};h.H=function(){return this.ha};h.ia=function(a){return new ee(this.J,a)};h.S=function(a){return".priority"===a?this.ha:Q};h.va=function(a){return a.f()?this:".priority"===K(a)?this.ha:Q};h.Sa=function(){return!1};h.ff=function(){return null};
h.V=function(a,b){return".priority"===a?this.ia(b):b.f()&&".priority"!==a?this:Q.V(a,b).ia(this.ha)};h.L=function(a,b){var c=K(a);if(null===c)return b;if(b.f()&&".priority"!==c)return this;z(".priority"!==c||1===Ad(a),".priority must be the last token in a path");return this.V(c,Q.L(L(a),b))};h.f=function(){return!1};h.Gb=function(){return 0};h.R=function(a){return a&&!this.H().f()?{".value":this.La(),".priority":this.H().R()}:this.La()};
h.hash=function(){if(null===this.Fb){var a="";this.ha.f()||(a+="priority:"+re(this.ha.R())+":");var b=typeof this.J,a=a+(b+":"),a="number"===b?a+Ec(this.J):a+this.J;this.Fb=sc(a)}return this.Fb};h.La=function(){return this.J};h.Ac=function(a){if(a===Q)return 1;if(a instanceof T)return-1;z(a.T(),"Unknown node type");var b=typeof a.J,c=typeof this.J,d=$a(se,b),e=$a(se,c);z(0<=d,"Unknown leaf type: "+b);z(0<=e,"Unknown leaf type: "+c);return d===e?"object"===c?0:this.J<a.J?-1:this.J===a.J?0:1:e-d};
var se=["object","boolean","number","string"];ee.prototype.wb=function(){return this};ee.prototype.Gc=function(){return!0};ee.prototype.fa=function(a){return a===this?!0:a.T()?this.J===a.J&&this.ha.fa(a.ha):!1};ee.prototype.toString=function(){return u(this.R(!0))};function te(a,b){this.Xa=a;this.Fa=b?b:ue}h=te.prototype;h.Ya=function(a,b){return new te(this.Xa,this.Fa.Ya(a,b,this.Xa).ba(null,null,ve,null,null))};h.remove=function(a){return new te(this.Xa,this.Fa.remove(a,this.Xa).ba(null,null,ve,null,null))};h.get=function(a){for(var b,c=this.Fa;!c.f();){b=this.Xa(a,c.key);if(0===b)return c.value;0>b?c=c.left:0<b&&(c=c.right)}return null};
function we(a,b){for(var c,d=a.Fa,e=null;!d.f();){c=a.Xa(b,d.key);if(0===c){if(d.left.f())return e?e.key:null;for(d=d.left;!d.right.f();)d=d.right;return d.key}0>c?d=d.left:0<c&&(e=d,d=d.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?");}h.f=function(){return this.Fa.f()};h.count=function(){return this.Fa.count()};h.Nc=function(){return this.Fa.Nc()};h.lc=function(){return this.Fa.lc()};h.ra=function(a){return this.Fa.ra(a)};
h.cc=function(a){return new xe(this.Fa,null,this.Xa,!1,a)};h.dc=function(a,b){return new xe(this.Fa,a,this.Xa,!1,b)};h.fc=function(a,b){return new xe(this.Fa,a,this.Xa,!0,b)};h.gf=function(a){return new xe(this.Fa,null,this.Xa,!0,a)};function xe(a,b,c,d,e){this.Qd=e||null;this.ye=d;for(this.$a=[];!a.f();)if(e=b?c(a.key,b):1,d&&(e*=-1),0>e)a=this.ye?a.left:a.right;else if(0===e){this.$a.push(a);break}else this.$a.push(a),a=this.ye?a.right:a.left}
function S(a){if(0===a.$a.length)return null;var b=a.$a.pop(),c;c=a.Qd?a.Qd(b.key,b.value):{key:b.key,value:b.value};if(a.ye)for(b=b.left;!b.f();)a.$a.push(b),b=b.right;else for(b=b.right;!b.f();)a.$a.push(b),b=b.left;return c}function ye(a){if(0===a.$a.length)return null;var b;b=a.$a;b=b[b.length-1];return a.Qd?a.Qd(b.key,b.value):{key:b.key,value:b.value}}function ze(a,b,c,d,e){this.key=a;this.value=b;this.color=null!=c?c:Ae;this.left=null!=d?d:ue;this.right=null!=e?e:ue}var Ae=!0,ve=!1;h=ze.prototype;
h.ba=function(a,b,c,d,e){return new ze(null!=a?a:this.key,null!=b?b:this.value,null!=c?c:this.color,null!=d?d:this.left,null!=e?e:this.right)};h.count=function(){return this.left.count()+1+this.right.count()};h.f=function(){return!1};h.ra=function(a){return this.left.ra(a)||a(this.key,this.value)||this.right.ra(a)};function Be(a){return a.left.f()?a:Be(a.left)}h.Nc=function(){return Be(this).key};h.lc=function(){return this.right.f()?this.key:this.right.lc()};
h.Ya=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.ba(null,null,null,e.left.Ya(a,b,c),null):0===d?e.ba(null,b,null,null,null):e.ba(null,null,null,null,e.right.Ya(a,b,c));return Ce(e)};function De(a){if(a.left.f())return ue;a.left.la()||a.left.left.la()||(a=Ee(a));a=a.ba(null,null,null,De(a.left),null);return Ce(a)}
h.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))c.left.f()||c.left.la()||c.left.left.la()||(c=Ee(c)),c=c.ba(null,null,null,c.left.remove(a,b),null);else{c.left.la()&&(c=Fe(c));c.right.f()||c.right.la()||c.right.left.la()||(c=Ge(c),c.left.left.la()&&(c=Fe(c),c=Ge(c)));if(0===b(a,c.key)){if(c.right.f())return ue;d=Be(c.right);c=c.ba(d.key,d.value,null,null,De(c.right))}c=c.ba(null,null,null,null,c.right.remove(a,b))}return Ce(c)};h.la=function(){return this.color};
function Ce(a){a.right.la()&&!a.left.la()&&(a=He(a));a.left.la()&&a.left.left.la()&&(a=Fe(a));a.left.la()&&a.right.la()&&(a=Ge(a));return a}function Ee(a){a=Ge(a);a.right.left.la()&&(a=a.ba(null,null,null,null,Fe(a.right)),a=He(a),a=Ge(a));return a}function He(a){return a.right.ba(null,null,a.color,a.ba(null,null,Ae,null,a.right.left),null)}function Fe(a){return a.left.ba(null,null,a.color,null,a.ba(null,null,Ae,a.left.right,null))}
function Ge(a){return a.ba(null,null,!a.color,a.left.ba(null,null,!a.left.color,null,null),a.right.ba(null,null,!a.right.color,null,null))}function Ie(){}h=Ie.prototype;h.ba=function(){return this};h.Ya=function(a,b){return new ze(a,b,null)};h.remove=function(){return this};h.count=function(){return 0};h.f=function(){return!0};h.ra=function(){return!1};h.Nc=function(){return null};h.lc=function(){return null};h.la=function(){return!1};var ue=new Ie;function T(a,b,c){this.A=a;(this.ha=b)&&qe(this.ha);a.f()&&z(!this.ha||this.ha.f(),"An empty node cannot have a priority");this.Db=c;this.Fb=null}h=T.prototype;h.T=function(){return!1};h.H=function(){return this.ha||Q};h.ia=function(a){return this.A.f()?this:new T(this.A,a,this.Db)};h.S=function(a){if(".priority"===a)return this.H();a=this.A.get(a);return null===a?Q:a};h.va=function(a){var b=K(a);return null===b?this:this.S(b).va(L(a))};h.Sa=function(a){return null!==this.A.get(a)};
h.V=function(a,b){z(b,"We should always be passing snapshot nodes");if(".priority"===a)return this.ia(b);var c=new O(a,b),d,e;b.f()?(d=this.A.remove(a),c=oe(this.Db,c,this.A)):(d=this.A.Ya(a,b),c=le(this.Db,c,this.A));e=d.f()?Q:this.ha;return new T(d,e,c)};h.L=function(a,b){var c=K(a);if(null===c)return b;z(".priority"!==K(a)||1===Ad(a),".priority must be the last token in a path");var d=this.S(c).L(L(a),b);return this.V(c,d)};h.f=function(){return this.A.f()};h.Gb=function(){return this.A.count()};
var Je=/^(0|[1-9]\d*)$/;h=T.prototype;h.R=function(a){if(this.f())return null;var b={},c=0,d=0,e=!0;this.Y(R,function(f,g){b[f]=g.R(a);c++;e&&Je.test(f)?d=Math.max(d,Number(f)):e=!1});if(!a&&e&&d<2*c){var f=[],g;for(g in b)f[g]=b[g];return f}a&&!this.H().f()&&(b[".priority"]=this.H().R());return b};h.hash=function(){if(null===this.Fb){var a="";this.H().f()||(a+="priority:"+re(this.H().R())+":");this.Y(R,function(b,c){var d=c.hash();""!==d&&(a+=":"+b+":"+d)});this.Fb=""===a?"":sc(a)}return this.Fb};
h.ff=function(a,b,c){return(c=Ke(this,c))?(a=we(c,new O(a,b)))?a.name:null:we(this.A,a)};function Le(a,b){var c;c=(c=Ke(a,b))?(c=c.Nc())&&c.name:a.A.Nc();return c?new O(c,a.A.get(c)):null}function Me(a,b){var c;c=(c=Ke(a,b))?(c=c.lc())&&c.name:a.A.lc();return c?new O(c,a.A.get(c)):null}h.Y=function(a,b){var c=Ke(this,a);return c?c.ra(function(a){return b(a.name,a.node)}):this.A.ra(b)};h.cc=function(a){return this.dc(Ne,a)};
h.dc=function(a,b){var c=Ke(this,b);if(c)return c.dc(a,function(a){return a});for(var c=this.A.dc(a.name,me),d=ye(c);null!=d&&0>b.compare(d,a);)S(c),d=ye(c);return c};h.gf=function(a){return this.fc(a.Lc(),a)};h.fc=function(a,b){var c=Ke(this,b);if(c)return c.fc(a,function(a){return a});for(var c=this.A.fc(a.name,me),d=ye(c);null!=d&&0<b.compare(d,a);)S(c),d=ye(c);return c};h.Ac=function(a){return this.f()?a.f()?0:-1:a.T()||a.f()?1:a===ce?-1:0};
h.wb=function(a){if(a===ge||tb(this.Db.jc,a.toString()))return this;var b=this.Db,c=this.A;z(a!==ge,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var d=[],e=!1,c=c.cc(me),f=S(c);f;)e=e||a.Fc(f.node),d.push(f),f=S(c);d=e?ne(d,ae(a)):$d;e=a.toString();c=xb(b.jc);c[e]=a;a=xb(b.vd);a[e]=d;return new T(this.A,this.ha,new ke(a,c))};h.Gc=function(a){return a===ge||tb(this.Db.jc,a.toString())};
h.fa=function(a){if(a===this)return!0;if(a.T())return!1;if(this.H().fa(a.H())&&this.A.count()===a.A.count()){var b=this.cc(R);a=a.cc(R);for(var c=S(b),d=S(a);c&&d;){if(c.name!==d.name||!c.node.fa(d.node))return!1;c=S(b);d=S(a)}return null===c&&null===d}return!1};function Ke(a,b){return b===ge?null:a.Db.get(b.toString())}h.toString=function(){return u(this.R(!0))};function P(a,b){if(null===a)return Q;var c=null;"object"===typeof a&&".priority"in a?c=a[".priority"]:"undefined"!==typeof b&&(c=b);z(null===c||"string"===typeof c||"number"===typeof c||"object"===typeof c&&".sv"in c,"Invalid priority type found: "+typeof c);"object"===typeof a&&".value"in a&&null!==a[".value"]&&(a=a[".value"]);if("object"!==typeof a||".sv"in a)return new ee(a,P(c));if(a instanceof Array){var d=Q,e=a;w(e,function(a,b){if(pa(e,b)&&"."!==b.substring(0,1)){var c=P(a);if(c.T()||!c.f())d=
d.V(b,c)}});return d.ia(P(c))}var f=[],g=!1,k=a;qa(k,function(a){if("string"!==typeof a||"."!==a.substring(0,1)){var b=P(k[a]);b.f()||(g=g||!b.H().f(),f.push(new O(a,b)))}});if(0==f.length)return Q;var l=ne(f,Xd,function(a){return a.name},Yd);if(g){var m=ne(f,ae(R));return new T(l,P(c),new ke({".priority":m},{".priority":R}))}return new T(l,P(c),pe)}var Oe=Math.log(2);
function Pe(a){this.count=parseInt(Math.log(a+1)/Oe,10);this.Xe=this.count-1;this.Uf=a+1&parseInt(Array(this.count+1).join("1"),2)}function Qe(a){var b=!(a.Uf&1<<a.Xe);a.Xe--;return b}
function ne(a,b,c,d){function e(b,d){var f=d-b;if(0==f)return null;if(1==f){var g=a[b],k=c?c(g):g;return new ze(k,g.node,ve,null,null)}var g=parseInt(f/2,10)+b,f=e(b,g),H=e(g+1,d),g=a[g],k=c?c(g):g;return new ze(k,g.node,ve,f,H)}a.sort(b);var f=function(b){function d(b,d){var k=A-b,l=A;A-=b;var l=e(k+1,l),k=a[k],m=c?c(k):k,l=new ze(m,k.node,d,null,l);f?f.left=l:g=l;f=l}for(var f=null,g=null,A=a.length,H=0;H<b.count;++H){var ca=Qe(b),kd=Math.pow(2,b.count-(H+1));ca?d(kd,ve):(d(kd,ve),d(kd,Ae))}return g}(new Pe(a.length));
return null!==f?new te(d||b,f):new te(d||b)}function re(a){return"number"===typeof a?"number:"+Ec(a):"string:"+a}function qe(a){if(a.T()){var b=a.R();z("string"===typeof b||"number"===typeof b||"object"===typeof b&&pa(b,".sv"),"Priority must be a string or number.")}else z(a===ce||a.f(),"priority of unexpected type.");z(a===ce||a.H().f(),"Priority nodes can't have a priority of their own.")}var Q=new T(new te(Yd),null,pe);function Re(){T.call(this,new te(Yd),Q,pe)}la(Re,T);h=Re.prototype;
h.Ac=function(a){return a===this?0:1};h.fa=function(a){return a===this};h.H=function(){return this};h.S=function(){return Q};h.f=function(){return!1};var ce=new Re,Ne=new O("[MIN_NAME]",Q),ie=new O("[MAX_NAME]",ce);function U(a,b,c){this.I=a;this.Z=b;this.g=c}U.prototype.R=function(){F("Wilddog.DataSnapshot.val",0,0,arguments.length);return this.I.R()};U.prototype.val=U.prototype.R;U.prototype.bf=function(){F("Wilddog.DataSnapshot.exportVal",0,0,arguments.length);return this.I.R(!0)};U.prototype.exportVal=U.prototype.bf;U.prototype.hg=function(){F("Wilddog.DataSnapshot.exists",0,0,arguments.length);return!this.I.f()};U.prototype.exists=U.prototype.hg;
U.prototype.w=function(a){F("Wilddog.DataSnapshot.child",0,1,arguments.length);fa(a)&&(a=String(a));Rd("Wilddog.DataSnapshot.child",a);var b=new I(a),c=this.Z.w(b);return new U(this.I.va(b),c,R)};U.prototype.child=U.prototype.w;U.prototype.Sa=function(a){F("Wilddog.DataSnapshot.hasChild",1,1,arguments.length);Rd("Wilddog.DataSnapshot.hasChild",a);var b=new I(a);return!this.I.va(b).f()};U.prototype.hasChild=U.prototype.Sa;
U.prototype.H=function(){F("Wilddog.DataSnapshot.getPriority",0,0,arguments.length);return this.I.H().R()};U.prototype.getPriority=U.prototype.H;U.prototype.forEach=function(a){F("Wilddog.DataSnapshot.forEach",1,1,arguments.length);G("Wilddog.DataSnapshot.forEach",1,a,!1);if(this.I.T())return!1;var b=this;return!!this.I.Y(this.g,function(c,d){return a(new U(d,b.Z.w(c),R))})};U.prototype.forEach=U.prototype.forEach;
U.prototype.qd=function(){F("Wilddog.DataSnapshot.hasChildren",0,0,arguments.length);return this.I.T()?!1:!this.I.f()};U.prototype.hasChildren=U.prototype.qd;U.prototype.name=function(){B("Wilddog.DataSnapshot.name() being deprecated. Please use Wilddog.DataSnapshot.key() instead.");F("Wilddog.DataSnapshot.name",0,0,arguments.length);return this.key()};U.prototype.name=U.prototype.name;U.prototype.key=function(){F("Wilddog.DataSnapshot.key",0,0,arguments.length);return this.Z.key()};
U.prototype.key=U.prototype.key;U.prototype.Gb=function(){F("Wilddog.DataSnapshot.numChildren",0,0,arguments.length);return this.I.Gb()};U.prototype.numChildren=U.prototype.Gb;U.prototype.qc=function(){F("Wilddog.DataSnapshot.ref",0,0,arguments.length);return this.Z};U.prototype.ref=U.prototype.qc;function Se(){Hc.call(this,["online"]);this.Kb=!0;if("undefined"!==typeof window&&"undefined"!==typeof window.addEventListener){this.Kb=window.navigator?window.navigator.onLine:!0;var a=this;window.addEventListener("online",function(){a.Kb||(a.Kb=!0,a.ae("online",!0))},!1);window.addEventListener("offline",function(){a.Kb&&(a.Kb=!1,a.ae("online",!1))},!1)}}la(Se,Hc);Se.prototype.od=function(a){z("online"===a,"Unknown event type: "+a);return this.Kb};ba(Se);function Te(){Hc.call(this,["visible"]);var a,b;"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(b="visibilitychange",a="hidden"):"undefined"!==typeof document.mozHidden?(b="mozvisibilitychange",a="mozHidden"):"undefined"!==typeof document.msHidden?(b="msvisibilitychange",a="msHidden"):"undefined"!==typeof document.webkitHidden&&(b="webkitvisibilitychange",a="webkitHidden"));this.vc=!0;if(b){var c=this;document.addEventListener(b,
function(){var b=!document[a];b!==c.vc&&(c.vc=b,c.ae("visible",b))},!1)}}la(Te,Hc);Te.prototype.od=function(a){z("visible"===a,"Unknown event type: "+a);return this.vc};ba(Te);function Ue(a){try{if("undefined"!==typeof window&&"undefined"!==typeof window[a]){var b=window[a];b.setItem("wilddog:sentinel","cache");b.removeItem("wilddog:sentinel")}}catch(c){}}Ue("localStorage");Ue("sessionStorage");function Ve(a,b,c,d,e,f,g){this.id=a;this.u=wc("c:"+this.id+":");this.Za=c;this.Ie=null;this.Gd=d;this.Rc=e;this.Da=f;this.xg=g;this.B=b;this.da=0;this.u("Connection created");We(this)}function We(a){Xe(a,function(b){a.Pa=b;a.Pa.on("open",Ye(a));a.Pa.on("error",Ze(a))})}function Ye(a){return function(){a.tc&&(clearTimeout(a.tc),delete a.tc);a.Pa.on("message",$e(a));a.Pa.on("close",af(a))}}
function $e(a){return function(b){if(null==b)throw Error("data is null");if(0!=b.charAt(0))if(2==b.charAt(0)){var c=null;try{c=JSON.parse(b.substr(1))}catch(d){throw d;}if("object"!=typeof c||2>c.length)throw Error("decodedData in wrong format");b=c[1];"wd"==c[0]?"c"==b.t?(c=b.d,"h"==c.t?bf(a,c.d):"r"==c.t?(c=c.d,a.u("Reset packet received. New host: "+c),a.B.Ud||(a.Ie=c,b=a.B.ka,b[b.indexOf(a.Za)]=c,cf(a.B,b),a.close())):"s"==c.t&&(a.xg(c.d),a.close())):"d"==b.t&&a.Gd(b.d):a.u("eventType not known")}else 1!=
b.charAt(0)&&a.u("data format error")}}function af(a){return function(){2!==a.da&&(a.u("Closing realtime connection."),a.da=2,a.Da&&(a.Da(a.Za,a.Ie),a.Da=null))}}function Ze(a){return function(){a.tc&&(clearTimeout(a.tc),delete a.tc);a.close()}}
function bf(a,b){var c=b.ts,d=b.v,e=b.h;a.sessionId=b.s;"1.0"!=d&&B("Protocol version mismatch detected");0==a.da&&(e==a.Za||a.B.Ud?(a.da=1,a.u("realtime state connected"),df(a.B,a.Za),a.Rc&&(a.Rc(c,a.Za),a.Rc=null)):(c=a.B.ka.indexOf(a.Za),d=a.B.ka,0<=c&&(d[c]=e),cf(a.B,d),a.u("updateHost ",d.toString()),a.Pa.close(),a.Za=e,Xe(a,function(b){a.Pa=b;a.Pa.on("open",Ye(a));a.Pa.on("error",Ze(a))})))}
function Xe(a,b){var c=["websocket"],d=(a.B.Pb?"https://":"http://")+a.Za+"?v=1.0&cv="+CLIENT_VERSION;ef(a.B)&&(d=d+"&ns="+a.B.Ae);a.sessionId&&(d=d+"&s="+a.sessionId);0<a.B.rb.length&&(d=d+"&fst="+encodeURIComponent(a.B.rb.join(",")));var e;e=Ua.xe?"Default":Ua.get("UUID");e||(e=a.ke(),Ua.set("UUID",e));var f={path:"/.ws",rememberUpgrade:!0};"undefined"==typeof document&&(f.jsonp=!1);a.B.ph?f.transports=["websocket"]:null!=c&&(f.transports=c);c=cc(d+"&did="+e,f);a.tc=setTimeout(function(){af(a)()},
3E3);Ra("new Socket_",typeof c);b(c)}Ve.prototype.lb=function(a){a="2"+JSON.stringify(["wd",{t:"d",d:a}]);Ra("sendRequest by eio",a);this.Pa.send(a)};Ve.prototype.close=function(){2!==this.da&&(this.u("Closing realtime connection."),this.da=2,this.Pa&&this.Pa.close(),this.Da&&(this.Da(this.Za,this.Ie),this.Da=null))};Ve.prototype.ke=function(){for(var a=0,b="";32>a;)b+="0123456789abcdefghijklmnopqrstuvwxyz"[Math.floor(36*Math.random())],a++;return b};function ff(a,b,c,d){this.id=gf++;this.u=wc("p:"+this.id+":");this.bd=this.lf=this.we=!1;this.ma={};this.wa=[];this.Tc=0;this.Pc=[];this.qa=!1;this.j={};this.na=1E3;this.Bd=3E5;this.Jb=b;this.Oc=c;this.Ee=d;this.B=a;this.Ke=null;this.Pd={};this.Jg=0;this.Hc=this.bc=null;this.ad=0;hf(this,0);Te.ac().Hb("visible",this.Cg,this);-1===a.host.indexOf("wd.local")&&Se.ac().Hb("online",this.zg,this)}var gf=0,jf=0;h=ff.prototype;
h.lb=function(a,b,c){var d=++this.Jg;a={r:d,a:a,b:b};this.u(u(a));z(this.qa,"sendRequest call when we're not connected not allowed.");this.Ma.lb(a);c&&(this.Pd[d]=c)};h.mf=function(a,b,c,d){var e=kf(a),f=a.path.toString();this.u("Listen called for "+f+" "+e);this.ma[f]=this.ma[f]||{};z(!this.ma[f][e],"listen() called twice for same path/queryId.");a={P:d,rd:b,query:a,tag:c};this.ma[f][e]=a;this.qa&&lf(this,a)};
function lf(a,b){var c=b.query,d=c.path.toString(),e=kf(c);a.u("Listen on "+d+" for "+e);var f={p:d};b.tag&&(f.q=mf(c.D),f.t=b.tag);f.h=b.rd();a.lb("q",f,function(f){var g=f.d,l=f.s,m=f.c;if(g&&"object"===typeof g&&pa(g,"w")){var A=t(g,"w");ea(A)&&0<=$a(A,"no_index")&&B("Using an unspecified index. Consider adding "+('".indexOn": "'+c.D.g.toString()+'"')+" at "+c.path.toString()+" to your security rules for better performance")}(a.ma[d]&&a.ma[d][e])===b&&(a.u("listen response",f),"ok"!==l&&nf(a,d,
e),b.P&&b.P(l,g,m))})}h.ge=function(a,b,c){this.Qa={bg:a,cf:!1,yb:b,ed:c};this.u("Authenticating using credential: "+a);of(this);40==a.length&&(this.u("Admin auth credential detected. Reducing max reconnect time."),this.Bd=3E4)};h.Hf=function(a){delete this.Qa;this.qa&&this.lb("unauth",{},function(b){a(b.s,b.d,b.c||null)})};
function of(a){var b=a.Qa;a.qa&&b&&a.lb("auth",{cred:b.bg},function(c){var d=c.s,e=c.d||"error";c=c.c||null;"ok"!==d&&a.Qa===b&&delete a.Qa;b.cf?"ok"!==d&&b.ed&&b.ed(d,e,c):(b.cf=!0,b.yb&&b.yb(d,e))})}h.If=function(a,b){var c=a.path.toString(),d=kf(a);this.u("Unlisten called for "+c+" "+d);if(nf(this,c,d)&&this.qa){var e=mf(a.D);this.u("Unlisten on "+c+" for "+d);c={p:c};b&&(c.q=e,c.t=b);this.lb("n",c)}};h.De=function(a,b,c){this.qa?pf(this,"o",a,b,c):this.Pc.push({Lb:a,action:"o",data:b,P:c})};
h.rf=function(a,b,c){this.qa?pf(this,"om",a,b,c):this.Pc.push({Lb:a,action:"om",data:b,P:c})};h.Fd=function(a,b){this.qa?pf(this,"oc",a,null,b):this.Pc.push({Lb:a,action:"oc",data:null,P:b})};function pf(a,b,c,d,e){c={p:c,d:d};a.u("onDisconnect "+b,c);a.lb(b,c,function(a){e&&setTimeout(function(){e(a.s,a.d,a.c)},Math.floor(0))})}h.put=function(a,b,c,d){qf(this,"p",a,b,c,d)};h.pf=function(a,b,c,d){qf(this,"m",a,b,c,d)};
function qf(a,b,c,d,e,f){d={p:c,d:d};p(f)&&(d.h=f);a.wa.push({action:b,request:d,P:e});a.Tc++;b=a.wa.length-1;a.qa?rf(a,b):a.u("Buffering put: "+c)}function rf(a,b){var c=a.wa[b].action,d=a.wa[b].request,e=a.wa[b].P;a.wa[b].Eg=a.qa;a.lb(c,d,function(d){a.u(c+" response",d);delete a.wa[b];a.Tc--;0===a.Tc&&(a.wa=[]);e&&e(d.s,d.d,d.c)})}h.He=function(a){if(this.qa){a={c:a};this.u("reportStats",a);var b=this;this.lb("s",a,function(a){"ok"!==a.s&&b.u("reportStats","Error sending stats: "+a.d,"Code:"+a.c)})}};
h.wg=function(a){if("r"in a){this.u("from server: "+u(a));var b=a.r,c=this.Pd[b];c&&(delete this.Pd[b],c(a.b))}else{if("error"in a)throw"A server-side error has occurred: "+a.error;"a"in a&&(b=a.a,c=a.b,this.u("handleServerMessage",b,c),"d"===b?this.Jb(c.p,c.d,!1,c.t):"m"===b?this.Jb(c.p,c.d,!0,c.t):"c"===b?sf(this,c.p,c.q):"ac"===b?(a=c.s,b=c.d,c=this.Qa,delete this.Qa,c&&c.ed&&c.ed(a,b)):"sd"===b?this.Ke?this.Ke(c):"msg"in c&&"undefined"!==typeof console&&console.log("WILDDOG: "+c.msg.replace("\n",
"\nWILDDOG: ")):xc("Unrecognized action received from server: "+u(b)+"\nAre you using the latest client?"))}};
h.Rc=function(a,b){if(!1===this.qa){this.u("connection ready");this.qa=!0;this.Ma=this.j[b].za;for(var c in this.j)this.j.hasOwnProperty(c)&&(clearTimeout(this.j[c].Be),delete this.j[c].Be);delete this.j[b];this.Hc=(new Date).getTime();this.Ee({serverTimeOffset:a-(new Date).getTime()});c=Ua.xe?"Default":Ua.get("UUID");c||(c=this.ke(),Ua.set("UUID",c));var d={};d["sdk.js."+CLIENT_VERSION.replace(/\./g,"-")]=1;d.did=c;"undefined"!==typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&
/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(navigator.userAgent)&&(d["framework.cordova"]=1);this.He(d);tf(this);this.Oc(!0)}else this.j[b].za.close(),delete this.j[b]};function hf(a,b,c){z(!a.Ma,"Scheduling a connect when we're already connected/ing?");uf(a,function(){var a=c||this.B.ka[0];this.j[a]=this.j[a]||{na:1E3,ad:0};this.j[a].ib&&clearTimeout(this.j[a].ib);var e=this;this.j[a].ib=setTimeout(function(){e.j[a]&&e.j[a].ib&&(e.j[a].ib=null,vf(e,a))},Math.floor(b))}.bind(a))}
h.Cg=function(a){if(a&&!this.vc){this.u("Window became visible. Reducing delay.");this.na=1E3;var b=!1,c;for(c in this.j)this.j.hasOwnProperty(c)&&c.za&&(b=!0,c.na=1E3);this.Ma||b||this.bd||hf(this,0)}this.vc=a};
h.zg=function(a){if(a){this.u("Browser went online.");this.na=1E3;a=!1;for(var b in this.j)this.j.hasOwnProperty(b)&&b.za&&(a=!0,b.na=1E3);this.Ma||a||this.bd||(this.bc&&clearTimeout(this.bc),hf(this,0))}else for(b in this.u("Browser went offline. Killing connection."),this.Ma&&this.Ma.close(),this.j)this.j.hasOwnProperty(b)&&b.za&&b.za.close()};
h.Ag=function(a,b){this.u("data client disconnected");if(b)delete this.j[a];else if(this.qa&&this.Ma.Za!=a||-1==this.B.ka.indexOf(a)){delete this.j[a];return}var c=b||a;this.Oc(!1);this.qa=!1;this.Ma=null;this.j[a]&&delete this.j[a].za;for(var d=0;d<this.wa.length;d++){var e=this.wa[d];e&&"h"in e.request&&e.Eg&&(e.P&&e.P("disconnect"),delete this.wa[d],this.Tc--)}0===this.Tc&&(this.wa=[]);this.Pd={};if(wf(this)){this.j[c]=this.j[c]||{na:1E3,ad:0};this.j[c].ad++;var d=!0,f;for(f in this.j)this.j.hasOwnProperty(f)&&
5>this.j[f].ad&&(d=!1);e=this.B;!fc.Xc&&null!=c&&0>e.rb.indexOf(c)&&c!=e.host&&(e.rb.push(c),v.set("failHosts",JSON.stringify(e.rb)));if(d&&Object.getOwnPropertyNames(this.j).length==this.B.ka.length&&!this.B.Ud){this.u("error while connecting",c);cf(this.B,[]);for(f in this.j)this.j.hasOwnProperty(f)&&this.j[f].ib&&clearTimeout(this.j[f].ib);this.j={};hf(this,0)}else this.vc?this.Hc&&(3E4<(new Date).getTime()-this.Hc&&(this.j[c].na=1E3),this.Hc=null):(this.u("Window isn't visible. Delaying reconnect."),
this.j[c].na=this.Bd,this.j[c].xd=(new Date).getTime()),f=Math.max(0,this.j[c].na-((new Date).getTime()-this.j[c].xd)),f*=Math.random(),this.u("Trying to reconnect in "+f+"ms"),hf(this,f,c),this.j[c].na=Math.min(this.Bd,1.3*this.j[c].na)}};
function vf(a,b){if(!a.j[b]||!a.j[b].za){a.u("Making a connection attempt");a.j[b].xd=(new Date).getTime();a.Hc=null;var c=r(a.wg,a),d=r(a.Rc,a),e=r(a.Ag,a),f=a.id+":"+jf++;a.j[b].za=new Ve(f,a.B,b,c,d,e,function(b){B(b+" ("+a.B.toString()+")");a.lf=!0});var g=a.B.ka[a.B.ka.indexOf(b)+1];g&&(a.j[b].Be=a.j[b].Be||setTimeout(function(){wf(a)&&!a.Ma&&hf(a,0,g)},1E4))}}
h.Ec=function(){this.we=!0;if(this.Ma)this.Ma.close();else for(var a in this.j)this.j.hasOwnProperty(a)&&(a.za?a.za.close():a.ib&&(clearTimeout(a.ib),a.ib=null))};h.resume=function(){this.we=!1;this.na=1E3;var a=!1,b;for(b in this.j)this.j.hasOwnProperty(b)&&b.za&&(a=!0,b.na=1E3);this.Ma||a||hf(this,0)};function sf(a,b,c){c=c?bb(c,function(a){return Cc(a)}).join("$"):"default";(a=nf(a,b,c))&&a.P&&a.P("permission_denied")}
function nf(a,b,c){b=(new I(b)).toString();var d;p(a.ma[b])?(d=a.ma[b][c],delete a.ma[b][c],0===ob(a.ma[b])&&delete a.ma[b]):d=void 0;return d}function tf(a){of(a);w(a.ma,function(b){w(b,function(b){lf(a,b)})});for(var b=0;b<a.wa.length;b++)a.wa[b]&&rf(a,b);for(;a.Pc.length;)b=a.Pc.shift(),pf(a,b.action,b.Lb,b.data,b.P)}function wf(a){var b;b=Se.ac().Kb;return!a.lf&&!a.we&&b}h.ke=function(){for(var a=0,b="";32>a;)b+="0123456789abcdefghijklmnopqrstuvwxyz"[Math.floor(36*Math.random())],a++;return b};
function uf(a,b){if(0!=a.B.ka.length&&a.B.ka)b(a.B.ka);else{a.xd=(new Date).getTime();var c=ec(["XHR","JSONP","NodeHttp","WxHttp"]),c=ab(c,function(a){return"function"===typeof a.isAvailable&&a.isAvailable()});if(0===c.length)setTimeout(function(){a.close()},0);else{var c=new (c.shift())({method:"GET"}),d=("undefined"==typeof document?"http":"https")+"://ns.wilddog.com/v1/lookup?appId="+a.B.Ae;a.bd=!0;c.open(d,null,function(c,d){a.bd=!1;if(d&&(d.errcode||d.message))throw c=Error(d.message||"Unknown error!"),
c.code=d.errcode,c;if(c||!d.nssList){var e=Math.max(0,a.na-((new Date).getTime()-a.xd)),e=Math.random()*e;a.u("Trying to nslookup in "+e+"ms");a.bc&&(clearTimeout(a.bc),a.bc=null);a.bc=setTimeout(function(){wf(a)&&hf(a,0)},e);a.na=Math.min(a.Bd,1.3*a.na)}else cf(a.B,d.nssList),b(d.nssList)})}}};function xf(a,b){this.u=wc("p:rest:");this.B=a;this.Jb=b;this.Qa=null;this.ma={}}function yf(a,b){if(p(b))return"tag$"+b;var c=a.D;z(zf(c)&&c.g==R,"should have a tag if it's not a default query.");return a.path.toString()}h=xf.prototype;
h.mf=function(a,b,c,d){var e=a.path.toString();this.u("Listen called for "+e+" "+kf(a));var f=yf(a,c),g={};this.ma[f]=g;a=Af(a.D);var k=this;Bf(this,e+".json",a,function(a,b){var l=b;404===a&&(a=l=null);null===a&&k.Jb(e,l,!1,c);t(k.ma,f)===g&&d(a?401==a?"permission_denied":"rest_error:"+a:"ok",null)})};h.If=function(a,b){var c=yf(a,b);delete this.ma[c]};h.ge=function(a,b){this.Qa=a;var c=bd(a),d=c.data,c=c.je&&c.je.exp;b&&b("ok",{auth:d,expires:c})};h.Hf=function(a){this.Qa=null;a("ok",null)};
h.De=function(){};h.rf=function(){};h.Fd=function(){};h.put=function(){};h.pf=function(){};h.He=function(){};
function Bf(a,b,c,d){c=c||{};c.format="export";a.Qa&&(c.auth=a.Qa);var e=(a.B.Pb?"https://":"http://")+a.B.host+b+"?"+sa(c);a.u("Sending REST request for "+e);var f=new XMLHttpRequest;f.onreadystatechange=function(){if(d&&4===f.readyState){a.u("REST Response for "+e+" received. status:",f.status,"response:",f.responseText);var b=null;if(200<=f.status&&300>f.status){try{b=Ca(f.responseText)}catch(k){B("Failed to parse JSON response for "+e+": "+f.responseText)}d(null,b)}else 401!==f.status&&404!==
f.status&&B("Got unsuccessful REST response for "+e+" Status: "+f.status),d(f.status);d=null}};f.open("GET",e,!0);f.send()};function Cf(){this.Rd=Q}Cf.prototype.m=function(a){return this.Rd.va(a)};Cf.prototype.toString=function(){return this.Rd.toString()};function Df(){this.set={}}h=Df.prototype;h.add=function(a,b){this.set[a]=null!==b?b:!0};h.contains=function(a){return pa(this.set,a)};h.get=function(a){return this.contains(a)?this.set[a]:void 0};h.remove=function(a){delete this.set[a]};h.clear=function(){this.set={}};h.f=function(){return wb(this.set)};h.count=function(){return ob(this.set)};function Ef(a,b){w(a.set,function(a,d){b(d,a)})}h.keys=function(){var a=[];w(this.set,function(b,c){a.push(c)});return a};function Ff(){this.A=this.J=null}Ff.prototype.find=function(a){if(null!=this.J)return this.J.va(a);if(a.f()||null==this.A)return null;var b=K(a);a=L(a);return this.A.contains(b)?this.A.get(b).find(a):null};function Gf(a,b,c){if(b.f())a.J=c,a.A=null;else if(null!==a.J)a.J=a.J.L(b,c);else{null==a.A&&(a.A=new Df);var d=K(b);a.A.contains(d)||a.A.add(d,new Ff);a=a.A.get(d);b=L(b);Gf(a,b,c)}}
function Hf(a,b){if(b.f())return a.J=null,a.A=null,!0;if(null!==a.J){if(a.J.T())return!1;var c=a.J;a.J=null;c.Y(R,function(b,c){Gf(a,new I(b),c)});return Hf(a,b)}return null!==a.A?(c=K(b),b=L(b),a.A.contains(c)&&Hf(a.A.get(c),b)&&a.A.remove(c),a.A.f()?(a.A=null,!0):!1):!0}function If(a,b,c){null!==a.J?c(b,a.J):a.Y(function(a,e){var d=new I(b.toString()+"/"+a);If(e,d,c)})}Ff.prototype.Y=function(a){null!==this.A&&Ef(this.A,function(b,c){a(b,c)})};function Jf(a,b){this.type=Kf;this.source=Lf;this.path=a;this.Je=b}Jf.prototype.Sc=function(){return this.path.f()?this:new Jf(L(this.path),this.Je)};Jf.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" ack write revert="+this.Je+")"};function Mf(a,b,c){this.type=Nf;this.source=a;this.path=b;this.children=c}Mf.prototype.Sc=function(a){if(this.path.f())return a=this.children.subtree(new I(a)),a.f()?null:a.value?new Of(this.source,M,a.value):new Mf(this.source,M,a);z(K(this.path)===a,"Can't get a merge for a child not on the path of the operation");return new Mf(this.source,L(this.path),this.children)};Mf.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"};function Of(a,b,c){this.type=Pf;this.source=a;this.path=b;this.Ta=c}Of.prototype.Sc=function(a){return this.path.f()?new Of(this.source,M,this.Ta.S(a)):new Of(this.source,L(this.path),this.Ta)};Of.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" overwrite: "+this.Ta.toString()+")"};function Qf(a,b){this.type=Rf;this.source=a;this.path=b}Qf.prototype.Sc=function(){return this.path.f()?new Qf(this.source,M):new Qf(this.source,L(this.path))};Qf.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" listen_complete)"};var Pf=0,Nf=1,Kf=2,Rf=3;function Sf(a,b,c,d){this.pe=a;this.df=b;this.Nb=c;this.Qe=d;z(!d||b,"Tagged queries must be from server.")}var Lf=new Sf(!0,!1,null,!1),Tf=new Sf(!1,!0,null,!1);Sf.prototype.toString=function(){return this.pe?"user":this.Qe?"server(queryID="+this.Nb+")":"server"};function Uf(a,b){this.value=a;this.children=b||Vf}var Vf=new te(function(a,b){return a===b?0:a<b?-1:1});function Wf(a){var b=Xf;w(a,function(a,d){b=b.set(new I(d),a)});return b}h=Uf.prototype;h.f=function(){return null===this.value&&this.children.f()};function Yf(a,b,c){if(null!=a.value&&c(a.value))return{path:M,value:a.value};if(b.f())return null;var d=K(b);a=a.children.get(d);return null!==a?(b=Yf(a,L(b),c),null!=b?{path:(new I(d)).w(b.path),value:b.value}:null):null}
function Zf(a,b){return Yf(a,b,function(){return!0})}h.subtree=function(a){if(a.f())return this;var b=this.children.get(K(a));return null!==b?b.subtree(L(a)):Xf};h.set=function(a,b){if(a.f())return new Uf(b,this.children);var c=K(a),d=(this.children.get(c)||Xf).set(L(a),b),c=this.children.Ya(c,d);return new Uf(this.value,c)};
h.remove=function(a){if(a.f())return this.children.f()?Xf:new Uf(null,this.children);var b=K(a),c=this.children.get(b);return c?(a=c.remove(L(a)),b=a.f()?this.children.remove(b):this.children.Ya(b,a),null===this.value&&b.f()?Xf:new Uf(this.value,b)):this};h.get=function(a){if(a.f())return this.value;var b=this.children.get(K(a));return b?b.get(L(a)):null};
function $f(a,b,c){if(b.f())return c;var d=K(b);b=$f(a.children.get(d)||Xf,L(b),c);d=b.f()?a.children.remove(d):a.children.Ya(d,b);return new Uf(a.value,d)}function ag(a,b){return bg(a,M,b)}function bg(a,b,c){var d={};a.children.ra(function(a,f){d[a]=bg(f,b.w(a),c)});return c(b,a.value,d)}function cg(a,b,c){return dg(a,b,M,c)}function dg(a,b,c,d){var e=a.value?d(c,a.value):!1;if(e)return e;if(b.f())return null;e=K(b);return(a=a.children.get(e))?dg(a,L(b),c.w(e),d):null}
function eg(a,b,c){if(!b.f()){var d=!0;a.value&&(d=c(M,a.value));!0===d&&(d=K(b),(a=a.children.get(d))&&fg(a,L(b),M.w(d),c))}}function fg(a,b,c,d){if(b.f())return a;a.value&&d(c,a.value);var e=K(b);return(a=a.children.get(e))?fg(a,L(b),c.w(e),d):Xf}function gg(a,b){hg(a,M,b)}function hg(a,b,c){a.children.ra(function(a,e){hg(e,b.w(a),c)});a.value&&c(b,a.value)}function ig(a,b){a.children.ra(function(a,d){d.value&&b(a,d.value)})}var Xf=new Uf(null);
Uf.prototype.toString=function(){var a={};gg(this,function(b,c){a[b.toString()]=c.toString()});return u(a)};function jg(a,b,c){this.I=a;this.O=b;this.Yb=c}function kg(a,b){return a.O&&!a.Yb||a.I.Sa(b)}jg.prototype.m=function(){return this.I};function lg(a,b){this.K=a;this.Sd=b}function mg(a,b,c,d){return new lg(new jg(b,c,d),a.Sd)}function ng(a){return a.K.O?a.K.m():null}lg.prototype.F=function(){return this.Sd};function og(a){return a.Sd.O?a.Sd.m():null};function V(a,b,c,d){this.type=a;this.Ua=b;this.hb=c;this.Ce=d;this.Md=void 0};function pg(a,b,c,d){this.le=b;this.Td=c;this.Md=d;this.md=a}pg.prototype.ec=function(){var a=this.Td.qc();return"value"===this.md?a.path:a.parent().path};pg.prototype.re=function(){return this.md};pg.prototype.Zb=function(){return this.le.Zb(this)};pg.prototype.toString=function(){return this.ec().toString()+":"+this.md+":"+u(this.Td.bf())};function qg(a,b,c){this.le=a;this.error=b;this.path=c}qg.prototype.ec=function(){return this.path};qg.prototype.re=function(){return"cancel"};
qg.prototype.Zb=function(){return this.le.Zb(this)};qg.prototype.toString=function(){return this.path.toString()+":cancel"};function rg(a,b,c){this.Wb=a;this.zb=b;this.Ab=c||null}h=rg.prototype;h.Af=function(a){return"value"===a};h.createEvent=function(a,b){var c=b.D.g;return new pg("value",this,new U(a.Ua,b.qc(),c))};h.Zb=function(a){var b=this.Ab;if("cancel"===a.re()){z(this.zb,"Raising a cancel event on a listener with no cancel callback");var c=this.zb;return function(){c.call(b,a.error)}}var d=this.Wb;return function(){d.call(b,a.Td)}};h.We=function(a,b){return this.zb?new qg(this,a,b):null};
h.matches=function(a){return a instanceof rg?a.Wb&&this.Wb?a.Wb===this.Wb&&a.Ab===this.Ab:!0:!1};h.hf=function(){return null!==this.Wb};function sg(a,b,c){this.pa=a;this.zb=b;this.Ab=c}h=sg.prototype;h.Af=function(a){a="children_added"===a?"child_added":a;return sb(this.pa,"children_removed"===a?"child_removed":a)};h.We=function(a,b){return this.zb?new qg(this,a,b):null};
h.createEvent=function(a,b){z(null!=a.hb,"Child events should have a childName.");var c=b.qc().w(a.hb);return new pg(a.type,this,new U(a.Ua,c,b.D.g),a.Md)};h.Zb=function(a){var b=this.Ab;if("cancel"===a.re()){z(this.zb,"Raising a cancel event on a listener with no cancel callback");var c=this.zb;return function(){c.call(b,a.error)}}var d=this.pa[a.md];return function(){d.call(b,a.Td,a.Md)}};
h.matches=function(a){if(a instanceof sg){if(!this.pa||!a.pa)return!0;if(this.Ab===a.Ab){var b=ob(a.pa);if(b===ob(this.pa)){if(1===b){var b=pb(a.pa),c=pb(this.pa);return c===b&&(!a.pa[b]||!this.pa[c]||a.pa[b]===this.pa[c])}return nb(this.pa,function(b,c){return a.pa[c]===b})}}}return!1};h.hf=function(){return null!==this.pa};function tg(a){this.Z=a;this.g=a.D.g}function ug(a,b,c,d){var e=[],f=[];ta(b,function(b){"child_changed"===b.type&&a.g.ud(b.Ce,b.Ua)&&f.push(new V("child_moved",b.Ua,b.hb))});vg(a,e,"child_removed",b,d,c);vg(a,e,"child_added",b,d,c);vg(a,e,"child_moved",f,d,c);vg(a,e,"child_changed",b,d,c);vg(a,e,"value",b,d,c);return e}function vg(a,b,c,d,e,f){d=ab(d,function(a){return a.type===c});hb(d,r(a.Xf,a));ta(d,function(c){var d=wg(a,c,f);ta(e,function(e){e.Af(c.type)&&b.push(e.createEvent(d,a.Z))})})}
function wg(a,b,c){"value"!==b.type&&"child_removed"!==b.type&&(b.Md=c.ff(b.hb,b.Ua,a.g));return b}tg.prototype.Xf=function(a,b){if(null==a.hb||null==b.hb)throw qc("Should only compare child_ events.");return this.g.compare(new O(a.hb,a.Ua),new O(b.hb,b.Ua))};function xg(){}xg.prototype.ef=function(){return null};xg.prototype.qe=function(){return null};var yg=new xg;function zg(a,b,c){this.Jf=a;this.Va=b;this.Id=c}zg.prototype.ef=function(a){var b=this.Va.K;if(kg(b,a))return b.m().S(a);b=null!=this.Id?new jg(this.Id,!0,!1):this.Va.F();return this.Jf.gb(a,b)};zg.prototype.qe=function(a,b,c){var d=null!=this.Id?this.Id:og(this.Va);a=this.Jf.ie(d,b,1,c,a);return 0===a.length?null:a[0]};function Ag(a,b){this.ce=a;this.Vf=b}function Bg(a){this.N=a}
Bg.prototype.mb=function(a,b,c,d){var e=new Cg,f;if(b.type===Pf)b.source.pe?c=Dg(this,a,b.path,b.Ta,c,d,e):(z(b.source.df,"Unknown source."),f=b.source.Qe,c=Eg(this,a,b.path,b.Ta,c,d,f,e));else if(b.type===Nf)b.source.pe?c=Fg(this,a,b.path,b.children,c,d,e):(z(b.source.df,"Unknown source."),f=b.source.Qe,c=Gg(this,a,b.path,b.children,c,d,f,e));else if(b.type===Kf)if(b.Je)if(f=b.path,null!=c.sc(f))c=a;else{b=new zg(c,a,d);d=a.K.m();if(f.f()||".priority"===K(f))a.F().O?b=c.Ca(og(a)):(b=a.F().m(),z(b instanceof
T,"serverChildren would be complete if leaf node"),b=c.zc(b)),b=this.N.Ba(d,b,e);else{f=K(f);var g=c.gb(f,a.F());null==g&&kg(a.F(),f)&&(g=d.S(f));b=null!=g?this.N.L(d,f,g,b,e):a.K.m().Sa(f)?this.N.L(d,f,Q,b,e):d;b.f()&&a.F().O&&(d=c.Ca(og(a)),d.T()&&(b=this.N.Ba(b,d,e)))}d=a.F().O||null!=c.sc(M);c=mg(a,b,d,this.N.Ra())}else c=Hg(this,a,b.path,c,d,e);else if(b.type===Rf)d=b.path,b=a.F(),f=b.m(),g=b.O||d.f(),c=Ig(this,new lg(a.K,new jg(f,g,b.Yb)),d,c,yg,e);else throw qc("Unknown operation type: "+b.type);
e=qb(e.qb);d=c;b=d.K;b.O&&(f=b.m().T()||b.m().f(),g=ng(a),(0<e.length||!a.K.O||f&&!b.m().fa(g)||!b.m().H().fa(g.H()))&&e.push(new V("value",ng(d))));return new Ag(c,e)};
function Ig(a,b,c,d,e,f){var g=b.K;if(null!=d.sc(c))return b;var k;if(c.f())z(b.F().O,"If change path is empty, we must have complete server data"),b.F().Yb?(e=og(b),d=d.zc(e instanceof T?e:Q)):d=d.Ca(og(b)),f=a.N.Ba(b.K.m(),d,f);else{var l=K(c);if(".priority"==l)z(1==Ad(c),"Can't have a priority with additional path components"),f=g.m(),k=b.F().m(),d=d.dd(c,f,k),f=null!=d?a.N.ia(f,d):g.m();else{var m=L(c);kg(g,l)?(k=b.F().m(),d=d.dd(c,g.m(),k),d=null!=d?g.m().S(l).L(m,d):g.m().S(l)):d=d.gb(l,b.F());
f=null!=d?a.N.L(g.m(),l,d,e,f):g.m()}}return mg(b,f,g.O||c.f(),a.N.Ra())}function Eg(a,b,c,d,e,f,g,k){var l=b.F();g=g?a.N:a.N.$b();if(c.f())d=g.Ba(l.m(),d,null);else if(g.Ra()&&!l.Yb)d=l.m().L(c,d),d=g.Ba(l.m(),d,null);else{var m=K(c);if((c.f()?!l.O||l.Yb:!kg(l,K(c)))&&1<Ad(c))return b;d=l.m().S(m).L(L(c),d);d=".priority"==m?g.ia(l.m(),d):g.L(l.m(),m,d,yg,null)}l=l.O||c.f();b=new lg(b.K,new jg(d,l,g.Ra()));return Ig(a,b,c,e,new zg(e,b,f),k)}
function Dg(a,b,c,d,e,f,g){var k=b.K;e=new zg(e,b,f);if(c.f())g=a.N.Ba(b.K.m(),d,g),a=mg(b,g,!0,a.N.Ra());else if(f=K(c),".priority"===f)g=a.N.ia(b.K.m(),d),a=mg(b,g,k.O,k.Yb);else{var l=L(c);c=k.m().S(f);if(!l.f()){var m=e.ef(f);d=null!=m?".priority"===Bd(l)&&m.va(l.parent()).f()?m:m.L(l,d):Q}c.fa(d)?a=b:(g=a.N.L(k.m(),f,d,e,g),a=mg(b,g,k.O,a.N.Ra()))}return a}
function Fg(a,b,c,d,e,f,g){var k=b;gg(d,function(d,m){var l=c.w(d);kg(b.K,K(l))&&(k=Dg(a,k,l,m,e,f,g))});gg(d,function(d,m){var l=c.w(d);kg(b.K,K(l))||(k=Dg(a,k,l,m,e,f,g))});return k}function Jg(a,b){gg(b,function(b,d){a=a.L(b,d)});return a}
function Gg(a,b,c,d,e,f,g,k){if(b.F().m().f()&&!b.F().O)return b;var l=b;c=c.f()?d:$f(Xf,c,d);var m=b.F().m();c.children.ra(function(c,d){if(m.Sa(c)){var A=b.F().m().S(c),A=Jg(A,d);l=Eg(a,l,new I(c),A,e,f,g,k)}});c.children.ra(function(c,d){var A=!b.F().O&&null==d.value;m.Sa(c)||A||(A=b.F().m().S(c),A=Jg(A,d),l=Eg(a,l,new I(c),A,e,f,g,k))});return l}
function Hg(a,b,c,d,e,f){if(null!=d.sc(c))return b;var g=new zg(d,b,e),k=e=b.K.m();if(b.F().O){if(c.f())e=d.Ca(og(b)),k=a.N.Ba(b.K.m(),e,f);else if(".priority"===K(c)){var l=d.gb(K(c),b.F());null==l||e.f()||e.H().fa(l)||(k=a.N.ia(e,l))}else l=K(c),e=d.gb(l,b.F()),null!=e&&(k=a.N.L(b.K.m(),l,e,g,f));e=!0}else if(b.K.O||c.f())k=e,e=b.K.m(),e.T()||e.Y(R,function(c){var e=d.gb(c,b.F());null!=e&&(k=a.N.L(k,c,e,g,f))}),e=b.K.O;else{l=K(c);if(1==Ad(c)||kg(b.K,l))c=d.gb(l,b.F()),null!=c&&(k=a.N.L(e,l,c,g,
f));e=!1}return mg(b,k,e,a.N.Ra())};function Kg(a,b){this.Z=a;var c=a.D,d=new Lg(c.g),c=zf(c)?new Lg(c.g):c.sa?new Mg(c):new Ng(c);this.xf=new Bg(c);var e=b.F(),f=b.K,g=d.Ba(Q,e.m(),null),k=c.Ba(Q,f.m(),null);this.Va=new lg(new jg(k,f.O,c.Ra()),new jg(g,e.O,d.Ra()));this.jb=[];this.eg=new tg(a)}h=Kg.prototype;h.F=function(){return this.Va.F().m()};h.sb=function(a){var b=og(this.Va);return b&&(zf(this.Z.D)||!a.f()&&!b.S(K(a)).f())?b.va(a):null};h.f=function(){return 0===this.jb.length};h.Tb=function(a){this.jb.push(a)};
h.ub=function(a,b){var c=[];if(b){z(null==a,"A cancel should cancel all event registrations.");var d=this.Z.path;ta(this.jb,function(a){(a=a.We(b,d))&&c.push(a)})}if(a){for(var e=[],f=0;f<this.jb.length;++f){var g=this.jb[f];if(!g.matches(a))e.push(g);else if(a.hf()){e=e.concat(this.jb.slice(f+1));break}}this.jb=e}else this.jb=[];return c};
h.mb=function(a,b,c){a.type===Nf&&null!==a.source.Nb&&(z(og(this.Va),"We should always have a full cache before handling merges"),z(ng(this.Va),"Missing event cache, even though we have a server cache"));var d=this.Va;a=this.xf.mb(d,a,b,c);b=this.xf;c=a.ce;z(c.K.m().Gc(b.N.g),"Event snap not indexed");z(c.F().m().Gc(b.N.g),"Server snap not indexed");z(a.ce.F().O||!d.F().O,"Once a server snap is complete, it should never go back");this.Va=a.ce;return Og(this,a.Vf,a.ce.K.m(),null)};
function Pg(a,b){var c=a.Va.K,d=[];c.m().T()||c.m().Y(R,function(a,b){d.push(new V("child_added",b,a))});c.O&&d.push(new V("value",c.m()));return Og(a,d,c.m(),b)}function Og(a,b,c,d){return ug(a.eg,b,c,d?[d]:a.jb)};function Qg(){this.Ga={}}h=Qg.prototype;h.f=function(){return wb(this.Ga)};h.mb=function(a,b,c){var d=a.source.Nb;if(null!==d)return d=t(this.Ga,d),z(null!=d,"SyncTree gave us an op for an invalid query."),d.mb(a,b,c);var e=[];w(this.Ga,function(d){e=e.concat(d.mb(a,b,c))});return e};h.Tb=function(a,b,c,d,e){var f=kf(a),g=t(this.Ga,f);g||((g=c.Ca(e?d:null))?c=!0:(g=d instanceof T?c.zc(d):Q,c=!1),g=new Kg(a,new lg(new jg(g,c,!1),new jg(d,e,!1))),this.Ga[f]=g);g.Tb(b);return Pg(g,b)};
h.ub=function(a,b,c){var d=kf(a),e=[],f=[],g=null!=Rg(this);if("default"===d){var k=this;w(this.Ga,function(a,d){f=f.concat(a.ub(b,c));a.f()&&(delete k.Ga[d],zf(a.Z.D)||e.push(a.Z))})}else{var l=t(this.Ga,d);l&&(f=f.concat(l.ub(b,c)),l.f()&&(delete this.Ga[d],zf(l.Z.D)||e.push(l.Z)))}g&&null==Rg(this)&&e.push(new W(a.G.M,a.G,a.path));return{Ig:e,fg:f}};function Sg(a){return ab(qb(a.Ga),function(a){return!zf(a.Z.D)})}h.sb=function(a){var b=null;w(this.Ga,function(c){b=b||c.sb(a)});return b};
function Tg(a,b){if(zf(b.D))return Rg(a);var c=kf(b);return t(a.Ga,c)}function Rg(a){return vb(a.Ga,function(a){return zf(a.Z.D)})||null};function Ug(a){this.aa=a}var Vg=new Ug(new Uf(null));function Wg(a,b,c){if(b.f())return new Ug(new Uf(c));var d=Zf(a.aa,b);if(null!=d){var e=d.path,d=d.value;b=J(e,b);d=d.L(b,c);return new Ug(a.aa.set(e,d))}a=$f(a.aa,b,new Uf(c));return new Ug(a)}function Xg(a,b,c){var d=a;qa(c,function(a,c){d=Wg(d,b.w(a),c)});return d}Ug.prototype.Nd=function(a){if(a.f())return Vg;a=$f(this.aa,a,Xf);return new Ug(a)};function Yg(a,b){var c=Zf(a.aa,b);return null!=c?a.aa.get(c.path).va(J(c.path,b)):null}
function Zg(a){var b=[],c=a.aa.value;null!=c?c.T()||c.Y(R,function(a,c){b.push(new O(a,c))}):a.aa.children.ra(function(a,c){null!=c.value&&b.push(new O(a,c.value))});return b}function $g(a,b){if(b.f())return a;var c=Yg(a,b);return null!=c?new Ug(new Uf(c)):new Ug(a.aa.subtree(b))}Ug.prototype.f=function(){return this.aa.f()};Ug.prototype.apply=function(a){return ah(M,this.aa,a)};
function ah(a,b,c){if(null!=b.value)return c.L(a,b.value);var d=null;b.children.ra(function(b,f){".priority"===b?(z(null!==f.value,"Priority writes must always be leaf nodes"),d=f.value):c=ah(a.w(b),f,c)});c.va(a).f()||null===d||(c=c.L(a.w(".priority"),d));return c};function bh(){this.X=Vg;this.Ia=[];this.Ic=-1}h=bh.prototype;
h.Nd=function(a){var b=fb(this.Ia,function(b){return b.ee===a});z(0<=b,"removeWrite called with nonexistent writeId.");var c=this.Ia[b];this.Ia.splice(b,1);for(var d=c.visible,e=!1,f=this.Ia.length-1;d&&0<=f;){var g=this.Ia[f];g.visible&&(f>=b&&ch(g,c.path)?d=!1:c.path.contains(g.path)&&(e=!0));f--}if(d){if(e)this.X=dh(this.Ia,eh,M),this.Ic=0<this.Ia.length?this.Ia[this.Ia.length-1].ee:-1;else if(c.Ta)this.X=this.X.Nd(c.path);else{var k=this;w(c.children,function(a,b){k.X=k.X.Nd(c.path.w(b))})}return c.path}return null};
h.Ca=function(a,b,c,d){if(c||d){var e=$g(this.X,a);return!d&&e.f()?b:d||null!=b||null!=Yg(e,M)?(e=dh(this.Ia,function(b){return(b.visible||d)&&(!c||!(0<=$a(c,b.ee)))&&(b.path.contains(a)||a.contains(b.path))},a),b=b||Q,e.apply(b)):null}e=Yg(this.X,a);if(null!=e)return e;e=$g(this.X,a);return e.f()?b:null!=b||null!=Yg(e,M)?(b=b||Q,e.apply(b)):null};
h.zc=function(a,b){var c=Q,d=Yg(this.X,a);if(d)d.T()||d.Y(R,function(a,b){c=c.V(a,b)});else if(b){var e=$g(this.X,a);b.Y(R,function(a,b){var d=$g(e,new I(a)).apply(b);c=c.V(a,d)});ta(Zg(e),function(a){c=c.V(a.name,a.node)})}else e=$g(this.X,a),ta(Zg(e),function(a){c=c.V(a.name,a.node)});return c};h.dd=function(a,b,c,d){z(c||d,"Either existingEventSnap or existingServerSnap must exist");a=a.w(b);if(null!=Yg(this.X,a))return null;a=$g(this.X,a);return a.f()?d.va(b):a.apply(d.va(b))};
h.gb=function(a,b,c){a=a.w(b);var d=Yg(this.X,a);return null!=d?d:kg(c,b)?$g(this.X,a).apply(c.m().S(b)):null};h.sc=function(a){return Yg(this.X,a)};h.ie=function(a,b,c,d,e,f){var g;a=$g(this.X,a);g=Yg(a,M);if(null==g)if(null!=b)g=a.apply(b);else return[];g=g.wb(f);if(g.f()||g.T())return[];b=[];a=ae(f);e=e?g.fc(c,f):g.dc(c,f);for(f=S(e);f&&b.length<d;)0!==a(f,c)&&b.push(f),f=S(e);return b};
function ch(a,b){return a.Ta?a.path.contains(b):!!ub(a.children,function(c,d){return a.path.w(d).contains(b)})}function eh(a){return a.visible}
function dh(a,b,c){for(var d=Vg,e=0;e<a.length;++e){var f=a[e];if(b(f)){var g=f.path;if(f.Ta)c.contains(g)?(g=J(c,g),d=Wg(d,g,f.Ta)):g.contains(c)&&(g=J(g,c),d=Wg(d,M,f.Ta.va(g)));else if(f.children)if(c.contains(g))g=J(c,g),d=Xg(d,g,f.children);else{if(g.contains(c))if(g=J(g,c),g.f())d=Xg(d,M,f.children);else if(f=t(f.children,K(g)))f=f.va(L(g)),d=Wg(d,M,f)}else throw qc("WriteRecord should have .snap or .children");}}return d}function fh(a,b){this.Rb=a;this.aa=b}h=fh.prototype;
h.Ca=function(a,b,c){return this.aa.Ca(this.Rb,a,b,c)};h.zc=function(a){return this.aa.zc(this.Rb,a)};h.dd=function(a,b,c){return this.aa.dd(this.Rb,a,b,c)};h.sc=function(a){return this.aa.sc(this.Rb.w(a))};h.ie=function(a,b,c,d,e){return this.aa.ie(this.Rb,a,b,c,d,e)};h.gb=function(a,b){return this.aa.gb(this.Rb,a,b)};h.w=function(a){return new fh(this.Rb.w(a),this.aa)};function gh(a){this.Aa=Xf;this.Mb=new bh;this.Pe={};this.pc={};this.Jc=a}function hh(a,b,c,d,e){var f=a.Mb,g=e;z(d>f.Ic,"Stacking an older write on top of newer ones");p(g)||(g=!0);f.Ia.push({path:b,Ta:c,ee:d,visible:g});g&&(f.X=Wg(f.X,b,c));f.Ic=d;return e?ih(a,new Of(Lf,b,c)):[]}function jh(a,b,c,d){var e=a.Mb;z(d>e.Ic,"Stacking an older merge on top of newer ones");e.Ia.push({path:b,children:c,ee:d,visible:!0});e.X=Xg(e.X,b,c);e.Ic=d;c=Wf(c);return ih(a,new Mf(Lf,b,c))}
function kh(a,b,c){c=c||!1;b=a.Mb.Nd(b);return null==b?[]:ih(a,new Jf(b,c))}function lh(a,b,c){c=Wf(c);return ih(a,new Mf(Tf,b,c))}function mh(a,b,c,d){d=nh(a,d);if(null!=d){var e=oh(d);d=e.path;e=e.Nb;b=J(d,b);c=new Of(new Sf(!1,!0,e,!0),b,c);return ph(a,d,c)}return[]}function qh(a,b,c,d){if(d=nh(a,d)){var e=oh(d);d=e.path;e=e.Nb;b=J(d,b);c=Wf(c);c=new Mf(new Sf(!1,!0,e,!0),b,c);return ph(a,d,c)}return[]}
gh.prototype.Tb=function(a,b){var c=a.path,d=null,e=!1;eg(this.Aa,c,function(a,b){var f=J(a,c);d=b.sb(f);e=e||null!=Rg(b);return!d});var f=this.Aa.get(c);f?(e=e||null!=Rg(f),d=d||f.sb(M)):(f=new Qg,this.Aa=this.Aa.set(c,f));var g;null!=d?g=!0:(g=!1,d=Q,ig(this.Aa.subtree(c),function(a,b){var c=b.sb(M);c&&(d=d.V(a,c))}));var k=null!=Tg(f,a);if(!k&&!zf(a.D)){var l=rh(a);z(!sb(this.pc,l),"View does not exist, but we have a tag");var m=sh++;this.pc[l]=m;this.Pe["_"+m]=l}g=f.Tb(a,b,new fh(c,this.Mb),d,
g);k||e||(f=Tg(f,a),g=g.concat(th(this,a,f)));return g};
gh.prototype.ub=function(a,b,c){var d=a.path,e=this.Aa.get(d),f=[];if(e&&("default"===kf(a)||null!=Tg(e,a))){f=e.ub(a,b,c);e.f()&&(this.Aa=this.Aa.remove(d));e=f.Ig;f=f.fg;b=-1!==fb(e,function(a){return zf(a.D)});var g=cg(this.Aa,d,function(a,b){return null!=Rg(b)});if(b&&!g&&(d=this.Aa.subtree(d),!d.f()))for(var d=uh(d),k=0;k<d.length;++k){var l=d[k],m=l.Z,l=vh(this,l);this.Jc.Le(m,wh(this,m),l.rd,l.P)}if(!g&&0<e.length&&!c)if(b)this.Jc.Xd(a,null);else{var A=this;ta(e,function(a){kf(a);var b=A.pc[rh(a)];
A.Jc.Xd(a,b)})}xh(this,e)}return f};gh.prototype.Ca=function(a,b){var c=this.Mb,d=cg(this.Aa,a,function(b,c){var d=J(b,a);if(d=c.sb(d))return d});return c.Ca(a,d,b,!0)};function uh(a){return ag(a,function(a,c,d){if(c&&null!=Rg(c))return[Rg(c)];var b=[];c&&(b=Sg(c));w(d,function(a){b=b.concat(a)});return b})}function xh(a,b){for(var c=0;c<b.length;++c){var d=b[c];if(!zf(d.D)){var d=rh(d),e=a.pc[d];delete a.pc[d];delete a.Pe["_"+e]}}}
function th(a,b,c){var d=b.path,e=wh(a,b);c=vh(a,c);b=a.Jc.Le(b,e,c.rd,c.P);d=a.Aa.subtree(d);if(e)z(null==Rg(d.value),"If we're adding a query, it shouldn't be shadowed");else for(e=ag(d,function(a,b,c){if(!a.f()&&b&&null!=Rg(b))return[Rg(b).Z];var d=[];b&&(d=d.concat(bb(Sg(b),function(a){return a.Z})));w(c,function(a){d=d.concat(a)});return d}),d=0;d<e.length;++d)c=e[d],a.Jc.Xd(c,wh(a,c));return b}
function vh(a,b){var c=b.Z,d=wh(a,c);return{rd:function(){return(b.F()||Q).hash()},P:function(b,f,g){if("ok"===b)return d?(f=c.path,(g=nh(a,d))?(b=oh(g),g=b.path,b=b.Nb,f=J(g,f),f=new Qf(new Sf(!1,!0,b,!0),f),g=ph(a,g,f)):g=[]):g=ih(a,new Qf(Tf,c.path)),g;b=(b||"error").toUpperCase();f&&(b+=": "+f);f=Error(b);f.code=g;B(f.message);return a.ub(c,null,f)}}}function rh(a){return a.path.toString()+"$"+kf(a)}
function oh(a){var b=a.indexOf("$");z(-1!==b&&b<a.length-1,"Bad queryKey.");return{Nb:a.substr(b+1),path:new I(a.substr(0,b))}}function nh(a,b){var c=a.Pe,d="_"+b;return null!==c&&d in c?c[d]:void 0}function wh(a,b){var c=rh(b);return t(a.pc,c)}var sh=1;function ph(a,b,c){var d=a.Aa.get(b);z(d,"Missing sync point for query tag that we're tracking");return d.mb(c,new fh(b,a.Mb),null)}function ih(a,b){return yh(a,b,a.Aa,null,new fh(M,a.Mb))}
function yh(a,b,c,d,e){if(b.path.f())return zh(a,b,c,d,e);var f=c.get(M);null==d&&null!=f&&(d=f.sb(M));var g=[],k=K(b.path),l=b.Sc(k);if((c=c.children.get(k))&&l)var m=d?d.S(k):null,k=e.w(k),g=g.concat(yh(a,l,c,m,k));f&&(g=g.concat(f.mb(b,e,d)));return g}function zh(a,b,c,d,e){var f=c.get(M);null==d&&null!=f&&(d=f.sb(M));var g=[];c.children.ra(function(c,f){var k=d?d.S(c):null,l=e.w(c),H=b.Sc(c);H&&(g=g.concat(zh(a,H,f,k,l)))});f&&(g=g.concat(f.mb(b,e,d)));return g};function Ah(){this.Bc={}}Ah.prototype.get=function(){return xb(this.Bc)};function Bh(a){this.Wf=a;this.yd=null}Bh.prototype.get=function(){var a=this.Wf.get(),b=xb(a);if(this.yd)for(var c in this.yd)b[c]-=this.yd[c];this.yd=a;return b};function Ch(a,b){this.Ff={};this.Vd=new Bh(a);this.oa=b;var c=1E4+2E4*Math.random();setTimeout(r(this.zf,this),Math.floor(c))}Ch.prototype.zf=function(){var a=this.Vd.get(),b={},c=!1,d;for(d in a)0<a[d]&&pa(this.Ff,d)&&(b[d]=a[d],c=!0);c&&this.oa.He(b);setTimeout(r(this.zf,this),Math.floor(6E5*Math.random()))};var Dh={},Eh={};function Fh(a){a=a.toString();Dh[a]||(Dh[a]=new Ah);return Dh[a]}function Gh(a,b){var c=a.toString();Eh[c]||(Eh[c]=b());return Eh[c]};function Hh(a,b){return a&&"object"===typeof a?(z(".sv"in a,"Unexpected leaf node or priority contents"),b[a[".sv"]]):a}function Ih(a,b){var c=new Ff;If(a,new I(""),function(a,e){Gf(c,a,Jh(e,b))});return c}function Jh(a,b){var c=a.H().R(),c=Hh(c,b),d;if(a.T()){var e=Hh(a.La(),b);return e!==a.La()||c!==a.H().R()?new ee(e,P(c)):a}d=a;c!==a.H().R()&&(d=d.ia(new ee(c)));a.Y(R,function(a,c){var e=Jh(c,b);e!==c&&(d=d.V(a,e))});return d};function Kh(){this.children={};this.fd=0;this.value=null}function Lh(a,b,c){this.Cd=a?a:"";this.Ea=b?b:null;this.I=c?c:new Kh}function Mh(a,b){for(var c=b instanceof I?b:new I(b),d=a,e;null!==(e=K(c));)var f=t(d.I.children,e)||new Kh,d=new Lh(e,d,f),c=L(c);return d}h=Lh.prototype;h.La=function(){return this.I.value};function Nh(a,b){z("undefined"!==typeof b,"Cannot set value to undefined");a.I.value=b;Oh(a)}h.clear=function(){this.I.value=null;this.I.children={};this.I.fd=0;Oh(this)};
h.qd=function(){return 0<this.I.fd};h.f=function(){return null===this.La()&&!this.qd()};h.Y=function(a){var b=this;w(this.I.children,function(c,d){a(new Lh(d,b,c))})};function Ph(a,b,c,d){c&&!d&&b(a);a.Y(function(a){Ph(a,b,!0,d)});c&&d&&b(a)}function Qh(a,b){for(var c=a.parent();null!==c&&!b(c);)c=c.parent()}h.path=function(){return new I(null===this.Ea?this.Cd:this.Ea.path()+"/"+this.Cd)};h.name=function(){return this.Cd};h.parent=function(){return this.Ea};
function Oh(a){if(null!==a.Ea){var b=a.Ea,c=a.Cd,d=a.f(),e=pa(b.I.children,c);d&&e?(delete b.I.children[c],b.I.fd--,Oh(b)):d||e||(b.I.children[c]=a.I,b.I.fd++,Oh(b))}};function Rh(){this.Bb=[]}function Sh(a,b){for(var c=null,d=0;d<b.length;d++){var e=b[d],f=e.ec();null===c||f.fa(c.ec())||(a.Bb.push(c),c=null);null===c&&(c=new Th(f));c.add(e)}c&&a.Bb.push(c)}function Uh(a,b,c){Sh(a,c);Vh(a,function(a){return a.fa(b)})}function Wh(a,b,c){Sh(a,c);Vh(a,function(a){return a.contains(b)||b.contains(a)})}
function Vh(a,b){for(var c=!0,d=0;d<a.Bb.length;d++){var e=a.Bb[d];if(e)if(e=e.ec(),b(e)){for(var e=a.Bb[d],f=0;f<e.nd.length;f++){var g=e.nd[f];if(null!==g){e.nd[f]=null;var k=g.Zb();uc&&Ra("event: "+g.toString());Gc(k)}}a.Bb[d]=null}else c=!1}c&&(a.Bb=[])}function Th(a){this.xa=a;this.nd=[]}Th.prototype.add=function(a){this.nd.push(a)};Th.prototype.ec=function(){return this.xa};function Xh(a,b,c){this.B=b;this.M=a;this.Wd=Fh(b);this.ja=new Rh;this.Dd=1;this.oa=this.kb=null;c||0<=("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)?(this.oa=new xf(this.B,r(this.Jb,this)),setTimeout(r(this.Oc,this,!0),0)):this.oa=this.kb=new ff(this.B,r(this.Jb,this),r(this.Oc,this),r(this.Ee,this));this.ah=Gh(b,r(function(){return new Ch(this.Wd,this.oa)},this));this.uc=
new Lh;this.ue=new Cf;var d=this;this.wd=new gh({Le:function(a,b,c,k){b=[];c=d.ue.m(a.path);c.f()||(b=ih(d.wd,new Of(Tf,a.path,c)),setTimeout(function(){k("ok")},0));return b},Xd:aa});this.Gf=function(a){a&&a.signIn?d.oa.ge(a.idToken,function(b,c){d.fb(b,c,a)},function(a,b){Yh(d,a,b)}):d.oa.Hf(function(a,b){Yh(d,a,b)})};this.M.bind(this.M.Ha.Na,this.Gf);Zh(this,"connected",!1);this.Da=new Ff;this.ld=0;this.ve=null;this.U=new gh({Le:function(a,b,c,k){d.oa.mf(a,c,b,function(b,c,e){b=k(b,c,e);Wh(d.ja,
a.path,b)});return[]},Xd:function(a,b){d.oa.If(a,b)}})}h=Xh.prototype;h.fb=function(){this.Ib(!0)};function Yh(a,b,c){a.Ib(!1);"expired_token"==b&&a.M.emit(a.M.Ha.cd,{status:b,reason:c})}h.toString=function(){return(this.B.Pb?"https://":"http://")+this.B.host};h.name=function(){return this.B.Ae};function $h(a){a=a.ue.m(new I(".info/serverTimeOffset")).R()||0;return(new Date).getTime()+a}function ai(a){a=a={timestamp:$h(a)};a.timestamp=a.timestamp||(new Date).getTime();return a}
h.Jb=function(a,b,c,d){this.ld++;var e=new I(a);b=this.ve?this.ve(a,b):b;a=[];d?c?(b=mb(b,function(a){return P(a)}),a=qh(this.U,e,b,d)):(b=P(b),a=mh(this.U,e,b,d)):c?(d=mb(b,function(a){return P(a)}),a=lh(this.U,e,d)):(d=P(b),a=ih(this.U,new Of(Tf,e,d)));d=e;0<a.length&&(d=bi(this,e));Wh(this.ja,d,a)};h.Oc=function(a){Zh(this,"connected",a);!1===a&&ci(this)};h.Ee=function(a){var b=this;Dc(a,function(a,d){Zh(b,d,a)})};h.Ib=function(a){Zh(this,"authenticated",a)};
function Zh(a,b,c){b=new I("/.info/"+b);c=P(c);var d=a.ue;d.Rd=d.Rd.L(b,c);c=ih(a.wd,new Of(Tf,b,c));Wh(a.ja,b,c)}h.vb=function(a,b,c,d){this.u("set",{path:a.toString(),value:b,wh:c});var e=ai(this);b=P(b,c);var e=Jh(b,e),f=this.Dd++,e=hh(this.U,a,e,f,!0);Sh(this.ja,e);var g=this;this.oa.put(a.toString(),b.R(!0),function(b,c,e){var k="ok"===b;k||B("set at "+a+" failed: "+b);k=kh(g.U,f,!k);Wh(g.ja,a,k);di(d,b,c,e)});e=ei(this,a);bi(this,e);Wh(this.ja,e,[])};
h.update=function(a,b,c){this.u("update",{path:a.toString(),value:b});var d=!0,e=ai(this),f={};w(b,function(a,b){d=!1;var c=P(a);f[b]=Jh(c,e)});if(d)Ra("update() called with empty data. Don't do anything."),di(c,"ok");else{var g=this.Dd++,k=jh(this.U,a,f,g);Sh(this.ja,k);var l=this;this.oa.pf(a.toString(),b,function(b,d,e){var f="ok"===b;f||B("update at "+a+" failed: "+b);var f=kh(l.U,g,!f),k=a;0<f.length&&(k=bi(l,a));Wh(l.ja,k,f);di(c,b,d,e)});b=ei(this,a);bi(this,b);Wh(this.ja,a,[])}};
function ci(a){a.u("onDisconnectEvents");var b=ai(a),c=[];If(Ih(a.Da,b),M,function(b,e){c=c.concat(ih(a.U,new Of(Tf,b,e)));var d=ei(a,b);bi(a,d)});a.Da=new Ff;Wh(a.ja,M,c)}h.Fd=function(a,b){var c=this;this.oa.Fd(a.toString(),function(d,e,f){"ok"===d&&Hf(c.Da,a);di(b,d,e,f)})};function fi(a,b,c,d){var e=P(c);a.oa.De(b.toString(),e.R(!0),function(c,g,k){"ok"===c&&Gf(a.Da,b,e);di(d,c,g,k)})}
function gi(a,b,c,d,e){var f=P(c,d);a.oa.De(b.toString(),f.R(!0),function(c,d,l){"ok"===c&&Gf(a.Da,b,f);di(e,c,d,l)})}function hi(a,b,c,d){var e=!0,f;for(f in c)e=!1;e?(Ra("onDisconnect().update() called with empty data. Don't do anything."),di(d,"ok")):a.oa.rf(b.toString(),c,function(e,f,l){if("ok"===e)for(var g in c)if(c.hasOwnProperty(g)){var k=P(c[g]);Gf(a.Da,b.w(g),k)}di(d,e,f,l)})}function ii(a,b,c){c=".info"===K(b.path)?a.wd.Tb(b,c):a.U.Tb(b,c);Uh(a.ja,b.path,c)}h.Ec=function(){this.kb&&this.kb.Ec()};
h.resume=function(){this.kb&&this.kb.resume()};h.Me=function(a){if("undefined"!==typeof console){a?(this.Vd||(this.Vd=new Bh(this.Wd)),a=this.Vd.get()):a=this.Wd.get();var b=cb(rb(a),function(a,b){return Math.max(b.length,a)},0),c;for(c in a)if(a.hasOwnProperty(c)){for(var d=a[c],e=c.length;e<b+2;e++)c+=" ";console.log(c+d)}}};h.Ne=function(a){var b=this.Wd,c;p(c)||(c=1);pa(b.Bc,a)||(b.Bc[a]=0);b.Bc[a]+=c;this.ah.Ff[a]=!0};h.u=function(a){var b="";this.kb&&(b=this.kb.id+":");Ra(b,arguments)};
function di(a,b,c,d){a&&Gc(function(){if("ok"==b)a(null);else{var e=(b||"error").toUpperCase();c&&(e+=": "+(c||"Unknown error"));e=Error(e);e.code=d||29999;a(e)}})};function ji(a,b,c,d,e){this.host=a.toLowerCase();this.domain=this.host.substr(this.host.indexOf(".")+1);this.Pb=b;this.Ae=c;this.ph=d;this.Kd=e||"";fc.Xc?(this.Ud=!0,this.ka=[fc.Xc]):(this.ka=(a=Ua.get("host:"+a))&&a.split(",ts:")[1]>=Date.now()-6E5?a.split(",ts:")[0].split(","):[],this.Ud=!1);this.rb=JSON.parse(v.get("failHosts"))||[]}function ef(a){return a.host!==a.ka}ji.prototype.kf=function(){return"wilddogio.com"!==this.domain&&"wilddogio-demo.com"!==this.domain};
function cf(a,b){fc.Xc||(null==b||0==b.length?(a.ka=[],Ua.remove("host:"+a.host)):(a.ka=b,Ua.set("host:"+a.host,a.ka.toString()+",ts:"+Date.now())))}ji.prototype.toString=function(){var a=(this.Pb?"https://":"http://")+this.host;this.Kd&&(a+="<"+this.Kd+">");return a};function df(a,b){if(!fc.Xc){var c=a.rb.indexOf(b);0<=c&&(a.rb.splice(c,1),v.set("failHosts",JSON.stringify(a.rb)))}};function ki(a,b,c,d,e){function f(){}a.u("transaction on "+b);var g=new W(a.M,a,b);g.Hb("value",f);c={path:b,update:c,P:d,status:null,order:pc(),Ue:e,Cf:0,be:function(){g.mc("value",f)},fe:null,Ja:null,hd:null,jd:null,kd:null};d=a.U.Ca(b,void 0)||Q;c.hd=d;d=c.update(d.R());if(p(d)){Ld("transaction failed: Data returned ",d,c.path);c.status=1;e=Mh(a.uc,b);var k=e.La()||[];k.push(c);Nh(e,k);"object"===typeof d&&null!==d&&pa(d,".priority")?(k=t(d,".priority"),z(Jd(k),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):
k=(a.U.Ca(b)||Q).H().R();e=ai(a);d=P(d,k);e=Jh(d,e);c.jd=d;c.kd=e;c.Ja=a.Dd++;c=hh(a.U,b,e,c.Ja,c.Ue);Wh(a.ja,b,c);li(a)}else c.be(),c.jd=null,c.kd=null,c.P&&(a=new U(c.hd,new W(a.M,a,c.path),R),c.P(null,!1,a))}function li(a,b){var c=b||a.uc;b||mi(a,c);if(null!==c.La()){var d=ni(a,c);z(0<d.length,"Sending zero length transaction queue");db(d,function(a){return 1===a.status})&&oi(a,c.path(),d)}else c.qd()&&c.Y(function(b){li(a,b)})}
function oi(a,b,c){for(var d=bb(c,function(a){return a.Ja}),e=a.U.Ca(b,d)||Q,d=e,e=e.hash(),f=0;f<c.length;f++){var g=c[f];z(1===g.status,"tryToSendTransactionQueue_: items in queue should all be run.");g.status=2;g.Cf++;var k=J(b,g.path),d=d.L(k,g.jd)}var d=d.R(!0),l=a.M;a.oa.put(b.toString(),d,function(d){a.u("transaction put response",{path:b.toString(),status:d});var e=[];if("ok"===d){d=[];for(f=0;f<c.length;f++){c[f].status=3;e=e.concat(kh(a.U,c[f].Ja));if(c[f].P){var g=c[f].kd,k=new W(l,a,c[f].path);
d.push(r(c[f].P,null,null,!0,new U(g,k,R)))}c[f].be()}mi(a,Mh(a.uc,b));li(a);Wh(a.ja,b,e);for(f=0;f<d.length;f++)Gc(d[f])}else{if("datastale"===d)for(f=0;f<c.length;f++)c[f].status=4===c[f].status?5:1;else for(B("transaction at "+b.toString()+" failed: "+d),f=0;f<c.length;f++)c[f].status=5,c[f].fe=d;bi(a,b)}},e)}function bi(a,b){var c=pi(a,b),d=c.path(),c=ni(a,c);qi(a,c,d);return d}
function qi(a,b,c){if(0!==b.length){for(var d=[],e=[],f=bb(b,function(a){return a.Ja}),g=0;g<b.length;g++){var k=b[g],l=J(c,k.path),m=!1,A;z(null!==l,"rerunTransactionsUnderNode_: relativePath should not be null.");if(5===k.status)m=!0,A=k.fe,e=e.concat(kh(a.U,k.Ja,!0));else if(1===k.status)if(25<=k.Cf)m=!0,A="maxretry",e=e.concat(kh(a.U,k.Ja,!0));else{var H=a.U.Ca(k.path,f)||Q;k.hd=H;var ca=b[g].update(H.R());p(ca)?(Ld("transaction failed: Data returned ",ca,k.path),l=P(ca),"object"===typeof ca&&
null!=ca&&pa(ca,".priority")||(l=l.ia(H.H())),H=k.Ja,ca=ai(a),ca=Jh(l,ca),k.jd=l,k.kd=ca,k.Ja=a.Dd++,gb(f,H),e=e.concat(hh(a.U,k.path,ca,k.Ja,k.Ue)),e=e.concat(kh(a.U,H,!0))):(m=!0,A="nodata",e=e.concat(kh(a.U,k.Ja,!0)))}Wh(a.ja,c,e);e=[];m&&(b[g].status=3,setTimeout(b[g].be,Math.floor(0)),b[g].P&&("nodata"===A?(k=new W(a.M,a,b[g].path),d.push(r(b[g].P,null,null,!1,new U(b[g].hd,k,R)))):("maxretry"==A?(k=Error("maxretries: The transaction had too many retries!"),k.code=26203):"set"==A?(k=Error("overriddenbyset: The transaction was overridden by a subsequent set!"),
k.code=26204):(k=Error("user_code_exception: User code called from the SyncReference runloop threw an exception!"),k.code=26202),d.push(r(b[g].P,null,k,!1,null)))))}mi(a,a.uc);for(g=0;g<d.length;g++)Gc(d[g]);li(a)}}function pi(a,b){for(var c,d=a.uc;null!==(c=K(b))&&null===d.La();)d=Mh(d,c),b=L(b);return d}function ni(a,b){var c=[];ri(a,b,c);c.sort(function(a,b){return a.order-b.order});return c}
function ri(a,b,c){var d=b.La();if(null!==d)for(var e=0;e<d.length;e++)c.push(d[e]);b.Y(function(b){ri(a,b,c)})}function mi(a,b){var c=b.La();if(c){for(var d=0,e=0;e<c.length;e++)3!==c[e].status&&(c[d]=c[e],d++);c.length=d;Nh(b,0<c.length?c:null)}b.Y(function(b){mi(a,b)})}function ei(a,b){var c=pi(a,b).path(),d=Mh(a.uc,b);Qh(d,function(b){si(a,b)});si(a,d);Ph(d,function(b){si(a,b)});return c}
function si(a,b){var c=b.La();if(null!==c){for(var d=[],e=[],f=-1,g=0;g<c.length;g++)if(4!==c[g].status)if(2===c[g].status)z(f===g-1,"All SENT items should be at beginning of queue."),f=g,c[g].status=4,c[g].fe="set";else if(z(1===c[g].status,"Unexpected transaction status in abort"),c[g].be(),e=e.concat(kh(a.U,c[g].Ja,!0)),c[g].P){var k=Error("overriddenbyset: The transaction was overridden by a subsequent set!");k.code=26204;d.push(r(c[g].P,null,k,!1,null))}-1===f?Nh(b,null):c.length=f+1;Wh(a.ja,
b.path(),e);for(g=0;g<d.length;g++)Gc(d[g])}};function ti(){this.bb={};this.nh=!1}ba(ti);ti.prototype.Ec=function(a){for(var b in this.bb[a.name])this.bb[a.name].hasOwnProperty(b)&&this.bb[a.name][b].Ec()};ti.prototype.resume=function(a){for(var b in this.bb[a.name])this.bb[a.name].hasOwnProperty(b)&&this.bb[a.name][b].resume()};function ui(a){var b=this;this.pb=a;this.Zd="*";Na()?this.Mc=this.td=Ga():(this.Mc=window.opener,this.td=window);if(!b.Mc)throw"Unable to find relay frame";Ha(this.td,"message",r(this.Gd,this));Ha(this.td,"message",r(this.qf,this));try{vi(this,{a:"ready"})}catch(c){Ha(this.Mc,"load",function(){vi(b,{a:"ready"})})}Ha(window,"unload",r(this.Bg,this))}function vi(a,b){b=u(b);Na()?a.Mc.doPost(b,a.Zd):a.Mc.postMessage(b,a.Zd)}
ui.prototype.Gd=function(a){var b=this,c;try{c=Ca(a.data)}catch(d){}c&&"request"===c.a&&(Ia(window,this.Gd),this.Zd=a.origin,this.pb&&setTimeout(function(){b.pb(b.Zd,c.d,function(a,c){b.Sf=!c;b.pb=void 0;vi(b,{a:"response",d:a,forceKeepWindowOpen:c})})},0))};ui.prototype.Bg=function(){try{Ia(this.td,this.qf)}catch(a){}this.pb&&(vi(this,{a:"error",d:"unknown closed window"}),this.pb=void 0);try{window.close()}catch(a){}};ui.prototype.qf=function(a){if(this.Sf&&"die"===a.data)try{window.close()}catch(b){}};function X(a){this.dh=a}X.prototype.mg=function(){return this.dh.G.Gf};X.prototype.getAuthTokenListener=X.prototype.mg;X.prototype.jg=function(){ma.za.qh.ig();ma.za.Kf.uh()};X.prototype.forceLongPolling=X.prototype.jg;X.prototype.kg=function(){ma.za.Kf.ig()};X.prototype.forceWebSockets=X.prototype.kg;X.prototype.Rg=function(a,b){a.G.kb.Ke=b};X.prototype.setSecurityDebugCallback=X.prototype.Rg;X.prototype.Me=function(a,b){a.G.Me(b)};X.prototype.stats=X.prototype.Me;X.prototype.Ne=function(a,b){a.G.Ne(b)};
X.prototype.statsIncrementCounter=X.prototype.Ne;X.prototype.ld=function(a){return a.G.ld};X.prototype.dataUpdateCount=X.prototype.ld;X.prototype.rg=function(a,b){a.G.ve=b};X.prototype.interceptServerData=X.prototype.rg;X.prototype.yg=function(a){new ui(a)};X.prototype.onLoginPopupOpen=X.prototype.yg;X.prototype.Pg=function(a){Fa=a};X.prototype.setAuthenticationServer=X.prototype.Pg;function Y(a,b){this.Uc=a;this.xa=b}Y.prototype.cancel=function(a){F("Wilddog.onDisconnect().cancel",0,1,arguments.length);G("Wilddog.onDisconnect().cancel",1,a,!0);var b=new x;this.Uc.Fd(this.xa,y(b,a));return b.o};Y.prototype.cancel=Y.prototype.cancel;Y.prototype.cancel=Y.prototype.cancel;
Y.prototype.remove=function(a){F("Wilddog.onDisconnect().remove",0,1,arguments.length);Td("Wilddog.onDisconnect().remove",this.xa);G("Wilddog.onDisconnect().remove",1,a,!0);var b=new x;fi(this.Uc,this.xa,null,y(b,a));return b.o};Y.prototype.remove=Y.prototype.remove;Y.prototype.remove=Y.prototype.remove;
Y.prototype.set=function(a,b){F("Wilddog.onDisconnect().set",1,2,arguments.length);Td("Wilddog.onDisconnect().set",this.xa);Kd("Wilddog.onDisconnect().set",a,this.xa,!1);G("Wilddog.onDisconnect().set",2,b,!0);var c=new x;fi(this.Uc,this.xa,a,y(c,b));return c.o};Y.prototype.set=Y.prototype.set;Y.prototype.set=Y.prototype.set;
Y.prototype.vb=function(a,b,c){F("Wilddog.onDisconnect().setWithPriority",2,3,arguments.length);Td("Wilddog.onDisconnect().setWithPriority",this.xa);Kd("Wilddog.onDisconnect().setWithPriority",a,this.xa,!1);Od("Wilddog.onDisconnect().setWithPriority",2,b);G("Wilddog.onDisconnect().setWithPriority",3,c,!0);var d=new x;gi(this.Uc,this.xa,a,b,y(d,c));return d.o};Y.prototype.setWithPriority=Y.prototype.vb;Y.prototype.setWithPriority=Y.prototype.vb;
Y.prototype.update=function(a,b){F("Wilddog.onDisconnect().update",1,2,arguments.length);Td("Wilddog.onDisconnect().update",this.xa);if(ea(a)){for(var c={},d=0;d<a.length;++d)c[""+d]=a[d];a=c;B("Passing an Array to Wilddog.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Nd("Wilddog.onDisconnect().update",a,this.xa);G("Wilddog.onDisconnect().update",2,b,!0);c=new x;
hi(this.Uc,this.xa,a,y(c,b));return c.o};Y.prototype.update=Y.prototype.update;Y.prototype.update=Y.prototype.update;function Lg(a){this.g=a}h=Lg.prototype;h.L=function(a,b,c,d,e){z(a.Gc(this.g),"A node must be indexed if only a child is updated");d=a.S(b);if(d.fa(c))return a;null!=e&&(c.f()?a.Sa(b)?wi(e,new V("child_removed",d,b)):z(a.T(),"A child remove without an old child only makes sense on a leaf node"):d.f()?wi(e,new V("child_added",c,b)):wi(e,new V("child_changed",c,b,d)));return a.T()&&c.f()?a:a.V(b,c).wb(this.g)};
h.Ba=function(a,b,c){null!=c&&(a.T()||a.Y(R,function(a,e){b.Sa(a)||wi(c,new V("child_removed",e,a))}),b.T()||b.Y(R,function(b,e){if(a.Sa(b)){var d=a.S(b);d.fa(e)||wi(c,new V("child_changed",e,b,d))}else wi(c,new V("child_added",e,b))}));return b.wb(this.g)};h.ia=function(a,b){return a.f()?Q:a.ia(b)};h.Ra=function(){return!1};h.$b=function(){return this};function Ng(a){this.te=new Lg(a.g);this.g=a.g;var b;a.ta?(b=xi(a),b=a.g.Kc(yi(a),b)):b=Ne;this.Wc=b;a.ua?(b=zi(a),a=a.g.Kc(Ai(a),b)):a=a.g.Lc();this.Dc=a}h=Ng.prototype;h.matches=function(a){return 0>=this.g.compare(this.Wc,a)&&0>=this.g.compare(a,this.Dc)};h.L=function(a,b,c,d,e){this.matches(new O(b,c))||(c=Q);return this.te.L(a,b,c,d,e)};h.Ba=function(a,b,c){b.T()&&(b=Q);var d=b.wb(this.g),d=d.ia(Q),e=this;b.Y(R,function(a,b){e.matches(new O(a,b))||(d=d.V(a,Q))});return this.te.Ba(a,d,c)};
h.ia=function(a){return a};h.Ra=function(){return!0};h.$b=function(){return this.te};function Mg(a){this.ya=new Ng(a);this.g=a.g;z(a.sa,"Only valid if limit has been set");this.ga=a.ga;this.Ob=!Bi(a)}h=Mg.prototype;h.L=function(a,b,c,d,e){this.ya.matches(new O(b,c))||(c=Q);return a.S(b).fa(c)?a:a.Gb()<this.ga?this.ya.$b().L(a,b,c,d,e):Ci(this,a,b,c,d,e)};
h.Ba=function(a,b,c){var d;if(b.T()||b.f())d=Q.wb(this.g);else if(2*this.ga<b.Gb()&&b.Gc(this.g)){d=Q.wb(this.g);b=this.Ob?b.fc(this.ya.Dc,this.g):b.dc(this.ya.Wc,this.g);for(var e=0;0<b.$a.length&&e<this.ga;){var f=S(b),g;if(g=this.Ob?0>=this.g.compare(this.ya.Wc,f):0>=this.g.compare(f,this.ya.Dc))d=d.V(f.name,f.node),e++;else break}}else{d=b.wb(this.g);d=d.ia(Q);var k,l,m;if(this.Ob){b=d.gf(this.g);k=this.ya.Dc;l=this.ya.Wc;var A=ae(this.g);m=function(a,b){return A(b,a)}}else b=d.cc(this.g),k=this.ya.Wc,
l=this.ya.Dc,m=ae(this.g);for(var e=0,H=!1;0<b.$a.length;)f=S(b),!H&&0>=m(k,f)&&(H=!0),(g=H&&e<this.ga&&0>=m(f,l))?e++:d=d.V(f.name,Q)}return this.ya.$b().Ba(a,d,c)};h.ia=function(a){return a};h.Ra=function(){return!0};h.$b=function(){return this.ya.$b()};
function Ci(a,b,c,d,e,f){var g;if(a.Ob){var k=ae(a.g);g=function(a,b){return k(b,a)}}else g=ae(a.g);z(b.Gb()==a.ga,"");var l=new O(c,d),m=a.Ob?Le(b,a.g):Me(b,a.g),A=a.ya.matches(l);if(b.Sa(c)){var H=b.S(c),m=e.qe(a.g,m,a.Ob);null!=m&&m.name==c&&(m=e.qe(a.g,m,a.Ob));e=null==m?1:g(m,l);if(A&&!d.f()&&0<=e)return null!=f&&wi(f,new V("child_changed",d,c,H)),b.V(c,d);null!=f&&wi(f,new V("child_removed",H,c));b=b.V(c,Q);return null!=m&&a.ya.matches(m)?(null!=f&&wi(f,new V("child_added",m.node,m.name)),b.V(m.name,
m.node)):b}return d.f()?b:A&&0<=g(m,l)?(null!=f&&(wi(f,new V("child_removed",m.node,m.name)),wi(f,new V("child_added",d,c))),b.V(c,d).V(m.name,Q)):b};function Cg(){this.qb={}}
function wi(a,b){var c=b.type,d=b.hb;z("child_added"==c||"child_changed"==c||"child_removed"==c,"Only child changes supported for tracking");z(".priority"!==d,"Only non-priority child changes can be tracked.");var e=t(a.qb,d);if(e){var f=e.type;if("child_added"==c&&"child_removed"==f)a.qb[d]=new V("child_changed",b.Ua,d,e.Ua);else if("child_removed"==c&&"child_added"==f)delete a.qb[d];else if("child_removed"==c&&"child_changed"==f)a.qb[d]=new V("child_removed",e.Ce,d);else if("child_changed"==c&&
"child_added"==f)a.qb[d]=new V("child_added",b.Ua,d);else if("child_changed"==c&&"child_changed"==f)a.qb[d]=new V("child_changed",b.Ua,d,e.Ce);else throw qc("Illegal combination of changes: "+b+" occurred after "+e);}else a.qb[d]=b};function Di(){this.Xb=this.ua=this.Qb=this.ta=this.sa=!1;this.ga=0;this.Sb="";this.kc=null;this.Eb="";this.hc=null;this.Cb="";this.g=R}var Ei=new Di;function Bi(a){return""===a.Sb?a.ta:"l"===a.Sb}function yi(a){z(a.ta,"Only valid if start has been set");return a.kc}function xi(a){z(a.ta,"Only valid if start has been set");return a.Qb?a.Eb:"[MIN_NAME]"}function Ai(a){z(a.ua,"Only valid if end has been set");return a.hc}
function zi(a){z(a.ua,"Only valid if end has been set");return a.Xb?a.Cb:"[MAX_NAME]"}function Fi(a){var b=new Di;b.sa=a.sa;b.ga=a.ga;b.ta=a.ta;b.kc=a.kc;b.Qb=a.Qb;b.Eb=a.Eb;b.ua=a.ua;b.hc=a.hc;b.Xb=a.Xb;b.Cb=a.Cb;b.g=a.g;return b}h=Di.prototype;h.ze=function(a){var b=Fi(this);b.sa=!0;b.ga=a;b.Sb="";return b};h.zd=function(a){var b=Fi(this);b.sa=!0;b.ga=a;b.Sb="l";return b};h.Ad=function(a){var b=Fi(this);b.sa=!0;b.ga=a;b.Sb="r";return b};
h.Vc=function(a,b){var c=Fi(this);c.ta=!0;p(a)||(a=null);c.kc=a;null!=b?(c.Qb=!0,c.Eb=b):(c.Qb=!1,c.Eb="");return c};h.Cc=function(a,b){var c=Fi(this);c.ua=!0;p(a)||(a=null);c.hc=a;p(b)?(c.Xb=!0,c.Cb=b):(c.yh=!1,c.Cb="");return c};function Gi(a,b){var c=Fi(a);c.g=b;return c}function mf(a){var b={};a.ta&&(b.sp=a.kc,a.Qb&&(b.sn=a.Eb));a.ua&&(b.ep=a.hc,a.Xb&&(b.en=a.Cb));if(a.sa){b.l=a.ga;var c=a.Sb;""===c&&(c=Bi(a)?"l":"r");b.vf=c}a.g!==R&&(b.i=a.g.toString());return b}
function zf(a){return!(a.ta||a.ua||a.sa)}function Af(a){var b={};if(zf(a)&&a.g==R)return b;var c;a.g===R?c="$priority":a.g===je?c="$value":a.g===ge?c="$key":(z(a.g instanceof be,"Unrecognized index type!"),c=a.g.toString());b.orderBy=u(c);a.ta&&(b.startAt=u(a.kc),a.Qb&&(b.startAt+=","+u(a.Eb)));a.ua&&(b.endAt=u(a.hc),a.Xb&&(b.endAt+=","+u(a.Cb)));a.sa&&(Bi(a)?b.limitToFirst=a.ga:b.limitToLast=a.ga);return b}h.toString=function(){return u(mf(this))};function Z(a,b,c,d){this.G=a;this.path=b;this.D=c;this.oc=d}
function Hi(a){var b=null,c=null;a.ta&&(b=yi(a));a.ua&&(c=Ai(a));if(a.g===ge){if(a.ta){if("[MIN_NAME]"!=xi(a))throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");if("string"!==typeof b)throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");}if(a.ua){if("[MAX_NAME]"!=zi(a))throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");if("string"!==
typeof c)throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");}}else if(a.g===R){if(null!=b&&!Jd(b)||null!=c&&!Jd(c))throw Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).");}else if(z(a.g instanceof be||a.g===je,"unknown index type."),null!=b&&"object"===typeof b||null!=c&&"object"===typeof c)throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.");
}function Ii(a){if(a.ta&&a.ua&&a.sa&&(!a.sa||""===a.Sb))throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.");}function Ji(a,b){if(!0===a.oc)throw Error(b+": You can't combine multiple orderBy calls.");}Z.prototype.qc=function(a){F("Query.ref",0,1,arguments.length);a&&Sd("Query.ref",a);return new W(this.app,this.G,a?this.path.w(a):this.path)};Z.prototype.ref=Z.prototype.qc;
Z.prototype.Hb=function(a,b,c,d){F("Query.on",2,4,arguments.length);Pd("Query.on",a,!1);G("Query.on",2,b,!1);var e=Ki("Query.on",c,d);if("value"===a)ii(this.G,this,new rg(b,e.cancel||null,e.context||null));else{var f={};f[a]=b;ii(this.G,this,new sg(f,e.cancel,e.context))}return b};Z.prototype.on=Z.prototype.Hb;
Z.prototype.mc=function(a,b,c){F("Query.off",0,3,arguments.length);Pd("Query.off",a,!0);G("Query.off",2,b,!0);zd("Query.off",3,c);var d=null,e=null;"value"===a?d=new rg(b||null,null,c||null):a&&(b&&(e={},e[a]=b),d=new sg(e,null,c||null));e=this.G;d=".info"===K(this.path)?e.wd.ub(this,d):e.U.ub(this,d);Uh(e.ja,this.path,d)};Z.prototype.off=Z.prototype.mc;
Z.prototype.Hd=function(a,b,c,d){function e(c){k&&(k=!1,g.mc(a,e),b&&b.call(f.context,c),l.resolve(c))}F("Query.once",1,4,arguments.length);Pd("Query.once",a,!1);G("Query.once",2,b,!0);var f=Ki("Query.once",c,d),g=this,k=!0,l=new x;bc(l.o);this.Hb(a,e,function(b){g.mc(a,e);f.cancel&&f.cancel.call(f.context,b);l.reject(b)});return l.o};Z.prototype.once=Z.prototype.Hd;Z.prototype.once=Z.prototype.Hd;
Z.prototype.ze=function(a){B("Query.limit() being deprecated. Please use Query.limitToFirst() or Query.limitToLast() instead.");F("Query.limit",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limit: First argument must be a positive integer.");if(this.D.sa)throw Error("Query.limit: Limit was already set (by another call to limit, limitToFirst, orlimitToLast.");var b=this.D.ze(a);Ii(b);return new Z(this.G,this.path,b,this.oc)};Z.prototype.limit=Z.prototype.ze;
Z.prototype.zd=function(a){F("Query.limitToFirst",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.D.sa)throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Z(this.G,this.path,this.D.zd(a),this.oc)};Z.prototype.limitToFirst=Z.prototype.zd;Z.prototype.limitToFirst=Z.prototype.zd;
Z.prototype.Ad=function(a){F("Query.limitToLast",1,1,arguments.length);if(!fa(a)||Math.floor(a)!==a||0>=a)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.D.sa)throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Z(this.G,this.path,this.D.Ad(a),this.oc)};Z.prototype.limitToLast=Z.prototype.Ad;Z.prototype.limitToLast=Z.prototype.Ad;
Z.prototype.sf=function(a){F("Query.orderByChild",1,1,arguments.length);if("$key"===a)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===a)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===a)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Qd("Query.orderByChild",1,a,!1);Ji(this,"Query.orderByChild");var b=Gi(this.D,new be(a));Hi(b);return new Z(this.G,
this.path,b,!0)};Z.prototype.orderByChild=Z.prototype.sf;Z.prototype.orderByChild=Z.prototype.sf;Z.prototype.tf=function(){F("Query.orderByKey",0,0,arguments.length);Ji(this,"Query.orderByKey");var a=Gi(this.D,ge);Hi(a);return new Z(this.G,this.path,a,!0)};Z.prototype.orderByKey=Z.prototype.tf;Z.prototype.orderByKey=Z.prototype.tf;Z.prototype.uf=function(){F("Query.orderByPriority",0,0,arguments.length);Ji(this,"Query.orderByPriority");var a=Gi(this.D,R);Hi(a);return new Z(this.G,this.path,a,!0)};
Z.prototype.orderByPriority=Z.prototype.uf;Z.prototype.orderByPriority=Z.prototype.uf;Z.prototype.wf=function(){F("Query.orderByValue",0,0,arguments.length);Ji(this,"Query.orderByValue");var a=Gi(this.D,je);Hi(a);return new Z(this.G,this.path,a,!0)};Z.prototype.orderByValue=Z.prototype.wf;Z.prototype.orderByValue=Z.prototype.wf;
Z.prototype.Vc=function(a,b){F("Query.startAt",0,2,arguments.length);Kd("Query.startAt",a,this.path,!0);Qd("Query.startAt",2,b,!0);var c=this.D.Vc(a,b);Ii(c);Hi(c);if(this.D.ta)throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");p(a)||(b=a=null);return new Z(this.G,this.path,c,this.oc)};Z.prototype.startAt=Z.prototype.Vc;Z.prototype.startAt=Z.prototype.Vc;
Z.prototype.Cc=function(a,b){F("Query.endAt",0,2,arguments.length);Kd("Query.endAt",a,this.path,!0);Qd("Query.endAt",2,b,!0);var c=this.D.Cc(a,b);Ii(c);Hi(c);if(this.D.ua)throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new Z(this.G,this.path,c,this.oc)};Z.prototype.endAt=Z.prototype.Cc;Z.prototype.endAt=Z.prototype.Cc;
Z.prototype.$e=function(a,b){F("Query.equalTo",1,2,arguments.length);Kd("Query.equalTo",a,this.path,!1);Qd("Query.equalTo",2,b,!0);if(this.D.ta)throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");if(this.D.ua)throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.Vc(a,b).Cc(a,b)};Z.prototype.equalTo=Z.prototype.$e;Z.prototype.equalTo=Z.prototype.$e;
Z.prototype.toString=function(){F("Query.toString",0,0,arguments.length);for(var a=this.path,b="",c=a.ca;c<a.C.length;c++)""!==a.C[c]&&(b+="/"+encodeURIComponent(String(a.C[c])));return this.G.toString()+(b||"/")};Z.prototype.toString=Z.prototype.toString;function kf(a){a=Cc(mf(a.D));return"{}"===a?"default":a}
function Ki(a,b,c){var d={cancel:null,context:null};if(b&&c)d.cancel=b,G(a,3,d.cancel,!0),d.context=c,zd(a,4,d.context);else if(b)if("object"===typeof b&&null!==b)d.context=b;else if("function"===typeof b)d.cancel=b;else throw Error(yd(a,3,!0)+" must either be a cancel callback or a context object.");return d};function Li(a,b){this.committed=a;this.snapshot=b};var Mi=function(){var a=0,b=[];return function(c){var d=c===a;a=c;for(var e=Array(8),f=7;0<=f;f--)e[f]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(c%64),c=Math.floor(c/64);z(0===c,"Cannot push at time == 0");c=e.join("");if(d){for(f=11;0<=f&&63===b[f];f--)b[f]=0;b[f]++}else for(f=0;12>f;f++)b[f]=Math.floor(64*Math.random());for(f=0;12>f;f++)c+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(b[f]);z(20===c.length,"nextPushId: Length should be 20.");
return c}}();function W(a,b,c){this.app=a;if(!b&&!c){b=a.options.syncURL;c=!0===a.options.websocketOnly?!0:!1;if(!b)throw Error("Could not find 'syncURL' in options.");a=La(b);var d=a.bh;"wilddog"===a.domain&&yc(a.host+" is no longer supported. Please use <YOUR WILDDOG>.wilddogio.com instead");d||yc("Cannot parse Wilddog url. Please use https://<YOUR WILDDOG>.wilddogio.com");a.Pb||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&B("Insecure Wilddog access from a secure page. Please use https.");
if(a.Lb){var e=a.Lb;e&&(e=e.replace(/^\/*\.info(\/|$)/,"/"));q(e)&&0!==e.length&&!Hd.test(e)||yc("App syncURL was an invalid path: "+b+'. Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}b=new ji(a.host,a.Pb,d,"ws"===a.scheme||"wss"===a.scheme||c);a=new I(a.Lb);c=ti.ac();d=this.app;e=b.toString();c.bb[d.name]||(c.bb[d.name]={});var f=t(c.bb[d.name],e);f||(f=new Xh(d,b,c.nh),c.bb[d.name][e]=f);b=f;c=a}Z.call(this,b,c,Ei,!1);this.INTERNAL=new X(this)}la(W,Z);
W.prototype.name=function(){B("Wilddog.name() being deprecated. Please use Wilddog.key() instead.");F("Wilddog.name",0,0,arguments.length);return this.key()};W.prototype.name=W.prototype.name;W.prototype.key=function(){F("Wilddog.key",0,0,arguments.length);return this.path.f()?null:Bd(this.path)};W.prototype.key=W.prototype.key;
W.prototype.w=function(a){F("Wilddog.child",1,1,arguments.length);fa(a)?a=String(a):a instanceof I||(null===K(this.path)?Sd("Wilddog.child",a):Rd("Wilddog.child",a));return new W(this.app,this.G,this.path.w(a))};W.prototype.child=W.prototype.w;W.prototype.parent=function(){F("Wilddog.parent",0,0,arguments.length);var a=this.path.parent();return null===a?null:new W(this.app,this.G,a)};W.prototype.parent=W.prototype.parent;
W.prototype.root=function(){F("Wilddog.ref",0,0,arguments.length);for(var a=this;null!==a.parent();)a=a.parent();return a};W.prototype.root=W.prototype.root;W.prototype.set=function(a,b){F("Wilddog.set",1,2,arguments.length);Td("Wilddog.set",this.path);Kd("Wilddog.set",a,this.path,!1);G("Wilddog.set",2,b,!0);var c=new x;this.G.vb(this.path,a,null,y(c,b));return c.o};W.prototype.set=W.prototype.set;
W.prototype.update=function(a,b){F("Wilddog.update",1,2,arguments.length);Td("Wilddog.update",this.path);if(ea(a)){for(var c={},d=0;d<a.length;++d)c[""+d]=a[d];a=c;B("Passing an Array to Wilddog.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Nd("Wilddog.update",a,this.path);G("Wilddog.update",2,b,!0);c=new x;this.G.update(this.path,a,y(c,b));return c.o};W.prototype.update=W.prototype.update;
W.prototype.vb=function(a,b,c){F("Wilddog.setWithPriority",2,3,arguments.length);Td("Wilddog.setWithPriority",this.path);Kd("Wilddog.setWithPriority",a,this.path,!1);Od("Wilddog.setWithPriority",2,b);G("Wilddog.setWithPriority",3,c,!0);if(".length"===this.key()||".keys"===this.key())throw"Wilddog.setWithPriority failed: "+this.key()+" is a read-only object.";var d=new x;this.G.vb(this.path,a,b,y(d,c));return d.o};W.prototype.setWithPriority=W.prototype.vb;
W.prototype.remove=function(a){F("Wilddog.remove",0,1,arguments.length);Td("Wilddog.remove",this.path);G("Wilddog.remove",1,a,!0);return this.set(null,a)};W.prototype.remove=W.prototype.remove;
W.prototype.transaction=function(a,b,c){F("Wilddog.transaction",1,3,arguments.length);Td("Wilddog.transaction",this.path);G("Wilddog.transaction",1,a,!1);G("Wilddog.transaction",2,b,!0);if(p(c)&&"boolean"!=typeof c)throw Error(yd("Wilddog.transaction",3,!0)+"must be a boolean.");if(".length"===this.key()||".keys"===this.key())throw"Wilddog.transaction failed: "+this.key()+" is a read-only object.";"undefined"===typeof c&&(c=!0);var d=new x;ga(b)&&bc(d.o);ki(this.G,this.path,a,function(a,c,g){a?d.reject(a):
d.resolve(new Li(c,g));ga(b)&&b(a,c,g)},c);return d.o};W.prototype.transaction=W.prototype.transaction;W.prototype.Qg=function(a,b){F("Wilddog.setPriority",1,2,arguments.length);Td("Wilddog.setPriority",this.path);Od("Wilddog.setPriority",1,a);G("Wilddog.setPriority",2,b,!0);var c=new x;this.G.vb(this.path.w(".priority"),a,null,y(c,b));return c.o};W.prototype.setPriority=W.prototype.Qg;
W.prototype.push=function(a,b){F("Wilddog.push",0,2,arguments.length);Td("Wilddog.push",this.path);Kd("Wilddog.push",a,this.path,!0);G("Wilddog.push",2,b,!0);var c=$h(this.G),d=Mi(c),c=this.w(d);if(null!=a){var e=this,f=c.set(a,b).then(function(){return e.w(d)});c.then=r(f.then,f);c["catch"]=r(f.then,f,void 0);ga(b)&&bc(f)}return c};W.prototype.push=W.prototype.push;W.prototype.onDisconnect=function(){Td("Wilddog.onDisconnect",this.path);return new Y(this.G,this.path)};W.prototype.onDisconnect=W.prototype.onDisconnect;
function Ni(){F("Wilddog.goOffline",0,0,arguments.length);ti.ac().Ec(this.app)}ka("module$exports$wd$sync$Sync.goOffline",Ni);function Oi(){F("Wilddog.goOnline",0,0,arguments.length);ti.ac().resume(this.app)}ka("module$exports$wd$sync$Sync.goOnline",Oi);var Pi={TIMESTAMP:{".sv":"timestamp"}};ka("module$exports$wd$sync$Sync.ServerValue",Pi);ka("module$exports$wd$sync$Sync.Context",ti);W.prototype.og=Ni;W.prototype.goOffline=W.prototype.og;W.prototype.pg=Oi;W.prototype.goOnline=W.prototype.pg;
W.prototype.Ze=function(a,b){z(!b||!0===a||!1===a,"Can't turn on custom loggers persistently.");!0===a?("undefined"!==typeof console&&("function"===typeof console.log?uc=r(console.log,console):"object"===typeof console.log&&(uc=function(a){console.log(a)})),b&&v.set("logging_enabled",!0)):a?uc=a:(uc=null,v.remove("logging_enabled"))};W.prototype.enableLogging=W.prototype.Ze;W.prototype.Lf=Pi;W.prototype.ServerValue=W.prototype.Lf;fc&&fc.yf&&fc.yf(Z);Wd.Ge("sync",function(a){return new W(a)});Wd.Ge("auth",function(a){null==a.Te&&(a.Te=new N(a));return a.Te});
(function(a){a.auth=a.auth?a.auth:{};[{id:"password",name:"Wilddog",xb:"phoneOrEmail",eb:"password"},{id:"password",name:"Email",xb:"email",eb:"password"},{id:"qq",name:"QQ",xb:"accessToken",eb:"openId"},{id:"weibo",name:"Weibo",xb:"accessToken",eb:"openId"},{id:"weixin",name:"Weixin",xb:"accessToken",eb:"openId"},{id:"weixinmp",name:"Weixinmp",xb:"accessToken",eb:"openId"}].forEach(function(b){a.auth[b.name+"AuthProvider"]=function(){this.id=b.id;this.addScope=function(a){this.scope=a}};"Wilddog"==
b.name?(a.auth.WilddogAuthProvider.emailCredential=function(a,d){var c={};c.provider=b.id;c.email=a;c[b.eb]=d;return c},a.auth.WilddogAuthProvider.phoneCredential=function(a,d){var c={};c.provider=b.id;c.phoneNumber=a;c[b.eb]=d;return c}):a.auth[b.name+"AuthProvider"].credential="Email"==b.name?function(a,d){B("wilddog.auth.EmailAuthProvider being deprecated. Please usewilddog.auth.WilddogAuthProvider instead.");var c={};c.provider=b.id;c[b.xb]=a;c[b.eb]=d;return c}:function(a,d){var c={};c.provider=
b.id;c[b.xb]=a;c[b.eb]=d;return c}})})(Wd);if("WEB"==CLIENT_TYPE)"object"==typeof module&&module.exports&&(module.exports=Wd),"function"==typeof define&&define.amd&&define("wilddog",[],function(){return Wd}),"undefined"!=typeof window?window.wilddog=Wd:WorkerGlobalScope&&self&&(self.wilddog=Wd);else if("NODE"==CLIENT_TYPE||"WX"==CLIENT_TYPE||"RN"==CLIENT_TYPE)module.exports=Wd;
};ns.wrapper(ns.goog,ns.wd)})({goog:{},wd:{}})