favesalon-embed 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/custom-elements/index.d.ts +12 -0
  2. package/dist/{cjs/_commonjsHelpers-5cfcba41.js → favesalon-embed/_commonjsHelpers-a4f66ccd.js} +14 -6
  3. package/dist/{cjs/global-9073d10e.js → favesalon-embed/app-globals-15861a7f.js} +15 -8
  4. package/dist/{esm/global-e1089ffd.js → favesalon-embed/app-globals-270fe240.js} +16 -7
  5. package/dist/favesalon-embed/app-globals-437cc3f3.js +712 -0
  6. package/dist/favesalon-embed/app-globals-b8b0fc7a.js +712 -0
  7. package/dist/favesalon-embed/chat-button.entry.js +56 -0
  8. package/dist/favesalon-embed/chat-form.entry.js +39 -0
  9. package/dist/favesalon-embed/chat-messages.entry.js +51 -0
  10. package/dist/favesalon-embed/css-shim-b7d3d95f.js +4 -0
  11. package/dist/favesalon-embed/dom-64053c71.js +73 -0
  12. package/dist/favesalon-embed/favesalon-embed.css +2433 -4
  13. package/dist/favesalon-embed/favesalon-embed.esm.js +148 -1
  14. package/dist/{collection/components/google-map/index.js → favesalon-embed/google-map.entry.js} +12 -54
  15. package/dist/{esm/index-80523fec.js → favesalon-embed/index-00b83e1c.js} +425 -15
  16. package/dist/favesalon-embed/index-888e99e3.js +3371 -0
  17. package/dist/favesalon-embed/index-9ad82b12.js +3371 -0
  18. package/dist/favesalon-embed/index-aa906326.js +3371 -0
  19. package/dist/favesalon-embed/index-b97af793.js +3371 -0
  20. package/dist/favesalon-embed/index.esm.js +1 -0
  21. package/dist/favesalon-embed/relativeTime-268e64b0.js +7 -0
  22. package/dist/{esm → favesalon-embed}/salon-booking-modal.entry.js +1 -1
  23. package/dist/{esm → favesalon-embed}/salon-booking.entry.js +3 -3
  24. package/dist/{esm → favesalon-embed}/salon-gift-card-modal.entry.js +1 -1
  25. package/dist/{esm → favesalon-embed}/salon-gift-card.entry.js +3 -3
  26. package/dist/favesalon-embed/salon-info.entry.js +29 -0
  27. package/dist/{esm → favesalon-embed}/salon-latest-reviews.entry.js +4 -4
  28. package/dist/{collection/components/salon-latest-styles/index.js → favesalon-embed/salon-latest-styles.entry.js} +14 -99
  29. package/dist/{collection/components/salon-locations/index.js → favesalon-embed/salon-locations.entry.js} +15 -95
  30. package/dist/{esm → favesalon-embed}/salon-lookbook.entry.js +3 -3
  31. package/dist/{esm → favesalon-embed}/salon-ranking.entry.js +1 -1
  32. package/dist/{esm → favesalon-embed}/salon-reviews.entry.js +3 -3
  33. package/dist/{collection/components/salon-schedules/index.js → favesalon-embed/salon-schedules.entry.js} +14 -95
  34. package/dist/{esm → favesalon-embed}/salon-services.entry.js +3 -3
  35. package/dist/{esm → favesalon-embed}/salon-stylists.entry.js +3 -3
  36. package/dist/{esm/services-40a3e622.js → favesalon-embed/services-7cb8f2a6.js} +2469 -100
  37. package/dist/favesalon-embed/shadow-css-98135883.js +387 -0
  38. package/dist/{esm → favesalon-embed}/style-detail.entry.js +4 -4
  39. package/dist/{esm → favesalon-embed}/user-avatar.entry.js +2 -1
  40. package/dist/{esm/utils-e97485e0.js → favesalon-embed/utils-7de9628a.js} +3 -0
  41. package/dist/types/components/chat-button/index.d.ts +0 -8
  42. package/dist/types/components/chat-form/index.d.ts +6 -0
  43. package/dist/types/components/chat-messages/index.d.ts +14 -0
  44. package/dist/types/components.d.ts +40 -0
  45. package/package.json +1 -1
  46. package/dist/cjs/chat-button.cjs.entry.js +0 -118
  47. package/dist/cjs/colors-38421769.js +0 -69
  48. package/dist/cjs/favesalon-embed.cjs.js +0 -24
  49. package/dist/cjs/google-map_5.cjs.entry.js +0 -310
  50. package/dist/cjs/index-47c2a5f6.js +0 -1533
  51. package/dist/cjs/index-7f190886.js +0 -4396
  52. package/dist/cjs/index.cjs.js +0 -2
  53. package/dist/cjs/loader.cjs.js +0 -23
  54. package/dist/cjs/relativeTime-3721080d.js +0 -9
  55. package/dist/cjs/salon-booking-modal.cjs.entry.js +0 -30
  56. package/dist/cjs/salon-booking.cjs.entry.js +0 -51
  57. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +0 -29
  58. package/dist/cjs/salon-gift-card.cjs.entry.js +0 -51
  59. package/dist/cjs/salon-latest-reviews.cjs.entry.js +0 -97
  60. package/dist/cjs/salon-lookbook.cjs.entry.js +0 -222
  61. package/dist/cjs/salon-ranking.cjs.entry.js +0 -60
  62. package/dist/cjs/salon-reviews.cjs.entry.js +0 -193
  63. package/dist/cjs/salon-services.cjs.entry.js +0 -81
  64. package/dist/cjs/salon-stylists.cjs.entry.js +0 -118
  65. package/dist/cjs/services-125c82d8.js +0 -21492
  66. package/dist/cjs/style-detail.cjs.entry.js +0 -312
  67. package/dist/cjs/user-avatar.cjs.entry.js +0 -45
  68. package/dist/cjs/utils-c5a33b3c.js +0 -23
  69. package/dist/collection/collection-manifest.json +0 -29
  70. package/dist/collection/components/chat-button/index.css +0 -122
  71. package/dist/collection/components/chat-button/index.js +0 -218
  72. package/dist/collection/components/chat-conversation/index.js +0 -103
  73. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  74. package/dist/collection/components/google-map/index.css +0 -5
  75. package/dist/collection/components/salon-booking/index.css +0 -30
  76. package/dist/collection/components/salon-booking/index.js +0 -126
  77. package/dist/collection/components/salon-booking/salon-booking-modal.js +0 -92
  78. package/dist/collection/components/salon-gift-card/index.css +0 -30
  79. package/dist/collection/components/salon-gift-card/index.js +0 -126
  80. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -73
  81. package/dist/collection/components/salon-info/index.css +0 -1
  82. package/dist/collection/components/salon-info/index.js +0 -77
  83. package/dist/collection/components/salon-latest-reviews/index.css +0 -11
  84. package/dist/collection/components/salon-latest-reviews/index.js +0 -163
  85. package/dist/collection/components/salon-latest-styles/index.css +0 -12
  86. package/dist/collection/components/salon-locations/index.css +0 -24
  87. package/dist/collection/components/salon-lookbook/index.css +0 -15
  88. package/dist/collection/components/salon-lookbook/index.js +0 -368
  89. package/dist/collection/components/salon-ranking/index.css +0 -3
  90. package/dist/collection/components/salon-ranking/index.js +0 -117
  91. package/dist/collection/components/salon-reviews/index.css +0 -18
  92. package/dist/collection/components/salon-reviews/index.js +0 -249
  93. package/dist/collection/components/salon-schedules/index.css +0 -18
  94. package/dist/collection/components/salon-services/index.css +0 -1
  95. package/dist/collection/components/salon-services/index.js +0 -146
  96. package/dist/collection/components/salon-stylists/index.css +0 -43
  97. package/dist/collection/components/salon-stylists/index.js +0 -184
  98. package/dist/collection/components/style-detail/index.css +0 -76
  99. package/dist/collection/components/style-detail/index.js +0 -386
  100. package/dist/collection/components/user-avatar/index.css +0 -0
  101. package/dist/collection/components/user-avatar/index.js +0 -134
  102. package/dist/collection/constants/colors.js +0 -65
  103. package/dist/collection/global/global.js +0 -8
  104. package/dist/collection/index.js +0 -1
  105. package/dist/collection/mocks/users.js +0 -10
  106. package/dist/collection/services/services.js +0 -295
  107. package/dist/collection/types/chat.js +0 -23
  108. package/dist/collection/types/common.js +0 -11
  109. package/dist/collection/types/review.js +0 -39
  110. package/dist/collection/types/salon.js +0 -58
  111. package/dist/collection/types/service.js +0 -24
  112. package/dist/collection/types/style.js +0 -128
  113. package/dist/collection/types/stylist.js +0 -30
  114. package/dist/collection/types/user.js +0 -10
  115. package/dist/collection/utils/utils.js +0 -20
  116. package/dist/custom-elements/index.js +0 -28340
  117. package/dist/esm/_commonjsHelpers-098d5b27.js +0 -32
  118. package/dist/esm/chat-button.entry.js +0 -114
  119. package/dist/esm/favesalon-embed.js +0 -19
  120. package/dist/esm/google-map_5.entry.js +0 -302
  121. package/dist/esm/index-3fae868e.js +0 -1506
  122. package/dist/esm/index.js +0 -1
  123. package/dist/esm/loader.js +0 -19
  124. package/dist/esm/polyfills/core-js.js +0 -11
  125. package/dist/esm/polyfills/css-shim.js +0 -1
  126. package/dist/esm/polyfills/dom.js +0 -79
  127. package/dist/esm/polyfills/es5-html-element.js +0 -1
  128. package/dist/esm/polyfills/index.js +0 -34
  129. package/dist/esm/polyfills/system.js +0 -6
  130. package/dist/esm/relativeTime-cd452e6d.js +0 -7
  131. package/dist/favesalon-embed/p-019c5ccd.entry.js +0 -1
  132. package/dist/favesalon-embed/p-083a8821.entry.js +0 -1
  133. package/dist/favesalon-embed/p-0d0ed9ea.entry.js +0 -1
  134. package/dist/favesalon-embed/p-119db8de.entry.js +0 -1
  135. package/dist/favesalon-embed/p-1432c51b.entry.js +0 -1
  136. package/dist/favesalon-embed/p-22093506.entry.js +0 -1
  137. package/dist/favesalon-embed/p-32b314e9.js +0 -2
  138. package/dist/favesalon-embed/p-47e646f8.js +0 -1
  139. package/dist/favesalon-embed/p-4a5eca9a.js +0 -6
  140. package/dist/favesalon-embed/p-58d2e9be.js +0 -1
  141. package/dist/favesalon-embed/p-71404b6a.entry.js +0 -1
  142. package/dist/favesalon-embed/p-857c3a61.entry.js +0 -1
  143. package/dist/favesalon-embed/p-99ec77f7.entry.js +0 -1
  144. package/dist/favesalon-embed/p-a33331cc.js +0 -1
  145. package/dist/favesalon-embed/p-b0c3673a.entry.js +0 -1
  146. package/dist/favesalon-embed/p-b287b1ea.entry.js +0 -1
  147. package/dist/favesalon-embed/p-b3af7842.entry.js +0 -1
  148. package/dist/favesalon-embed/p-b630ae68.js +0 -1580
  149. package/dist/favesalon-embed/p-ce2c1c9a.entry.js +0 -1
  150. package/dist/favesalon-embed/p-d6083940.js +0 -1
  151. package/dist/favesalon-embed/p-d9b7ad58.entry.js +0 -1
  152. package/dist/favesalon-embed/p-fc9a5551.js +0 -6
  153. package/dist/index.cjs.js +0 -1
  154. package/dist/index.js +0 -1
  155. package/dist/types/components/chat-conversation/index.d.ts +0 -0
  156. /package/dist/{esm → favesalon-embed}/colors-ea36347a.js +0 -0
@@ -1,1580 +0,0 @@
1
- import{c as t,a as n}from"./p-d6083940.js";import{C as e}from"./p-a33331cc.js";var i,r=Array.isArray,s="object"==typeof t&&t&&t.Object===Object&&t,o="object"==typeof self&&self&&self.Object===Object&&self,u=s||o||Function("return this")(),h=u.Symbol,c=Object.prototype,a=c.hasOwnProperty,l=c.toString,f=h?h.toStringTag:void 0,d=Object.prototype.toString,p=h?h.toStringTag:void 0,m=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":p&&p in Object(t)?function(t){var n=a.call(t,f),e=t[f];try{t[f]=void 0;var i=!0}catch(t){}var r=l.call(t);return i&&(n?t[f]=e:delete t[f]),r}(t):function(t){return d.call(t)}(t)},w=function(t){return null!=t&&"object"==typeof t},v=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==m(t)},g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,y=/^\w*$/,b=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!v(t))||y.test(t)||!g.test(t)||null!=n&&t in Object(n)},_=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)},S=function(t){if(!_(t))return!1;var n=m(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n},E=u["__core-js_shared__"],I=(i=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",k=Function.prototype.toString,C=function(t){if(null!=t){try{return k.call(t)}catch(t){}try{return t+""}catch(t){}}return""},j=/^\[object .+?Constructor\]$/,O=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),M=function(t){return!(!_(t)||(n=t,I&&I in n))&&(S(t)?O:j).test(C(t));var n},T=function(t,n){var e=function(t,n){return null==t?void 0:t[n]}(t,n);return M(e)?e:void 0},D=T(Object,"create"),N=Object.prototype.hasOwnProperty,A=Object.prototype.hasOwnProperty;function R(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var i=t[n];this.set(i[0],i[1])}}R.prototype.clear=function(){this.__data__=D?D(null):{},this.size=0},R.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},R.prototype.get=function(t){var n=this.__data__;if(D){var e=n[t];return"__lodash_hash_undefined__"===e?void 0:e}return N.call(n,t)?n[t]:void 0},R.prototype.has=function(t){var n=this.__data__;return D?void 0!==n[t]:A.call(n,t)},R.prototype.set=function(t,n){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=D&&void 0===n?"__lodash_hash_undefined__":n,this};var $=R,x=function(t,n){return t===n||t!=t&&n!=n},P=function(t,n){for(var e=t.length;e--;)if(x(t[e][0],n))return e;return-1},L=Array.prototype.splice;function U(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var i=t[n];this.set(i[0],i[1])}}U.prototype.clear=function(){this.__data__=[],this.size=0},U.prototype.delete=function(t){var n=this.__data__,e=P(n,t);return!(e<0||(e==n.length-1?n.pop():L.call(n,e,1),--this.size,0))},U.prototype.get=function(t){var n=this.__data__,e=P(n,t);return e<0?void 0:n[e][1]},U.prototype.has=function(t){return P(this.__data__,t)>-1},U.prototype.set=function(t,n){var e=this.__data__,i=P(e,t);return i<0?(++this.size,e.push([t,n])):e[i][1]=n,this};var F=U,B=T(u,"Map"),q=function(t,n){var e,i,r=t.__data__;return("string"==(i=typeof(e=n))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==e:null===e)?r["string"==typeof n?"string":"hash"]:r.map};function W(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var i=t[n];this.set(i[0],i[1])}}W.prototype.clear=function(){this.size=0,this.__data__={hash:new $,map:new(B||F),string:new $}},W.prototype.delete=function(t){var n=q(this,t).delete(t);return this.size-=n?1:0,n},W.prototype.get=function(t){return q(this,t).get(t)},W.prototype.has=function(t){return q(this,t).has(t)},W.prototype.set=function(t,n){var e=q(this,t),i=e.size;return e.set(t,n),this.size+=e.size==i?0:1,this};var H=W;function z(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var e=function(){var i=arguments,r=n?n.apply(this,i):i[0],s=e.cache;if(s.has(r))return s.get(r);var o=t.apply(this,i);return e.cache=s.set(r,o)||s,o};return e.cache=new(z.Cache||H),e}z.Cache=H;var V,Y,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,K=/\\(\\)?/g,G=(V=z((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(J,(function(t,e,i,r){n.push(i?r.replace(K,"$1"):e||t)})),n}),(function(t){return 500===Y.size&&Y.clear(),t})),Y=V.cache,V),X=function(t,n){for(var e=-1,i=null==t?0:t.length,r=Array(i);++e<i;)r[e]=n(t[e],e,t);return r},Z=h?h.prototype:void 0,Q=Z?Z.toString:void 0,tt=function t(n){if("string"==typeof n)return n;if(r(n))return X(n,t)+"";if(v(n))return Q?Q.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e},nt=function(t){return null==t?"":tt(t)},et=function(t,n){return r(t)?t:b(t,n)?[t]:G(nt(t))},it=function(t){if("string"==typeof t||v(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},rt=function(t,n){for(var e=0,i=(n=et(n,t)).length;null!=t&&e<i;)t=t[it(n[e++])];return e&&e==i?t:void 0},st=function(t,n,e){var i=null==t?void 0:rt(t,n);return void 0===i?e:i},ot=function(t,n){for(var e=-1,i=null==t?0:t.length;++e<i&&!1!==n(t[e],e,t););return t},ut=function(t,n,e){for(var i=-1,r=Object(t),s=e(t),o=s.length;o--;){var u=s[++i];if(!1===n(r[u],u,r))break}return t},ht=function(t){return w(t)&&"[object Arguments]"==m(t)},ct=Object.prototype,at=ct.hasOwnProperty,lt=ct.propertyIsEnumerable,ft=ht(function(){return arguments}())?ht:function(t){return w(t)&&at.call(t,"callee")&&!lt.call(t,"callee")},dt=function(){return!1},pt=n((function(t,n){var e=n&&!n.nodeType&&n,i=e&&t&&!t.nodeType&&t,r=i&&i.exports===e?u.Buffer:void 0;t.exports=(r?r.isBuffer:void 0)||dt})),mt=/^(?:0|[1-9]\d*)$/,wt=function(t,n){var e=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==e||"symbol"!=e&&mt.test(t))&&t>-1&&t%1==0&&t<n},vt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},gt={};gt["[object Float32Array]"]=gt["[object Float64Array]"]=gt["[object Int8Array]"]=gt["[object Int16Array]"]=gt["[object Int32Array]"]=gt["[object Uint8Array]"]=gt["[object Uint8ClampedArray]"]=gt["[object Uint16Array]"]=gt["[object Uint32Array]"]=!0,gt["[object Arguments]"]=gt["[object Array]"]=gt["[object ArrayBuffer]"]=gt["[object Boolean]"]=gt["[object DataView]"]=gt["[object Date]"]=gt["[object Error]"]=gt["[object Function]"]=gt["[object Map]"]=gt["[object Number]"]=gt["[object Object]"]=gt["[object RegExp]"]=gt["[object Set]"]=gt["[object String]"]=gt["[object WeakMap]"]=!1;var yt,bt,_t=function(t){return function(n){return t(n)}},St=n((function(t,n){var e=n&&!n.nodeType&&n,i=e&&t&&!t.nodeType&&t,r=i&&i.exports===e&&s.process,o=function(){try{return i&&i.require&&i.require("util").types||r&&r.binding&&r.binding("util")}catch(t){}}();t.exports=o})),Et=St&&St.isTypedArray,It=Et?_t(Et):function(t){return w(t)&&vt(t.length)&&!!gt[m(t)]},kt=Object.prototype.hasOwnProperty,Ct=function(t,n){var e=r(t),i=!e&&ft(t),s=!e&&!i&&pt(t),o=!e&&!i&&!s&&It(t),u=e||i||s||o,h=u?function(t,n){for(var e=-1,i=Array(t);++e<t;)i[e]=n(e);return i}(t.length,String):[],c=h.length;for(var a in t)!n&&!kt.call(t,a)||u&&("length"==a||s&&("offset"==a||"parent"==a)||o&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||wt(a,c))||h.push(a);return h},jt=Object.prototype,Ot=(yt=Object.keys,bt=Object,function(t){return yt(bt(t))}),Mt=Object.prototype.hasOwnProperty,Tt=function(t){if((n=t)!==("function"==typeof(e=n&&n.constructor)&&e.prototype||jt))return Ot(t);var n,e,i=[];for(var r in Object(t))Mt.call(t,r)&&"constructor"!=r&&i.push(r);return i},Dt=function(t){return null!=t&&vt(t.length)&&!S(t)},Nt=function(t){return Dt(t)?Ct(t):Tt(t)},At=function(t,n){if(null==t)return t;if(!Dt(t))return function(t,n){return t&&ut(t,n,Nt)}(t,n);for(var e=t.length,i=-1,r=Object(t);++i<e&&!1!==n(r[i],i,r););return t},Rt=function(t){return t},$t=function(t,n){return(r(t)?ot:At)(t,"function"==typeof(e=n)?e:Rt);var e},xt=function(t,n){for(var e=-1,i=n.length,r=t.length;++e<i;)t[r+e]=n[e];return t},Pt=h?h.isConcatSpreadable:void 0,Lt=function(t){return r(t)||ft(t)||!!(Pt&&t&&t[Pt])},Ut=function t(n,e,i,r,s){var o=-1,u=n.length;for(i||(i=Lt),s||(s=[]);++o<u;){var h=n[o];e>0&&i(h)?e>1?t(h,e-1,i,r,s):xt(s,h):r||(s[s.length]=h)}return s};function Ft(t){var n=this.__data__=new F(t);this.size=n.size}Ft.prototype.clear=function(){this.__data__=new F,this.size=0},Ft.prototype.delete=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,n){var e=this.__data__;if(e instanceof F){var i=e.__data__;if(!B||i.length<199)return i.push([t,n]),this.size=++e.size,this;e=this.__data__=new H(i)}return e.set(t,n),this.size=e.size,this};var Bt=Ft;function qt(t){var n=-1,e=null==t?0:t.length;for(this.__data__=new H;++n<e;)this.add(t[n])}qt.prototype.add=qt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},qt.prototype.has=function(t){return this.__data__.has(t)};var Wt=qt,Ht=function(t,n){for(var e=-1,i=null==t?0:t.length;++e<i;)if(n(t[e],e,t))return!0;return!1},zt=function(t,n){return t.has(n)},Vt=function(t,n,e,i,r,s){var o=1&e,u=t.length,h=n.length;if(u!=h&&!(o&&h>u))return!1;var c=s.get(t),a=s.get(n);if(c&&a)return c==n&&a==t;var l=-1,f=!0,d=2&e?new Wt:void 0;for(s.set(t,n),s.set(n,t);++l<u;){var p=t[l],m=n[l];if(i)var w=o?i(m,p,l,n,t,s):i(p,m,l,t,n,s);if(void 0!==w){if(w)continue;f=!1;break}if(d){if(!Ht(n,(function(t,n){if(!zt(d,n)&&(p===t||r(p,t,e,i,s)))return d.push(n)}))){f=!1;break}}else if(p!==m&&!r(p,m,e,i,s)){f=!1;break}}return s.delete(t),s.delete(n),f},Yt=u.Uint8Array,Jt=function(t){var n=-1,e=Array(t.size);return t.forEach((function(t,i){e[++n]=[i,t]})),e},Kt=function(t){var n=-1,e=Array(t.size);return t.forEach((function(t){e[++n]=t})),e},Gt=h?h.prototype:void 0,Xt=Gt?Gt.valueOf:void 0,Zt=Object.prototype.propertyIsEnumerable,Qt=Object.getOwnPropertySymbols,tn=Qt?function(t){return null==t?[]:(t=Object(t),function(t,n){for(var e=-1,i=null==t?0:t.length,r=0,s=[];++e<i;){var o=t[e];n(o,e,t)&&(s[r++]=o)}return s}(Qt(t),(function(n){return Zt.call(t,n)})))}:function(){return[]},nn=function(t){return function(t,n,e){var i=n(t);return r(t)?i:xt(i,e(t))}(t,Nt,tn)},en=Object.prototype.hasOwnProperty,rn=T(u,"DataView"),sn=T(u,"Promise"),on=T(u,"Set"),un=T(u,"WeakMap"),hn="[object Map]",cn="[object Promise]",an="[object Set]",ln="[object WeakMap]",fn="[object DataView]",dn=C(rn),pn=C(B),mn=C(sn),wn=C(on),vn=C(un),gn=m;(rn&&gn(new rn(new ArrayBuffer(1)))!=fn||B&&gn(new B)!=hn||sn&&gn(sn.resolve())!=cn||on&&gn(new on)!=an||un&&gn(new un)!=ln)&&(gn=function(t){var n=m(t),e="[object Object]"==n?t.constructor:void 0,i=e?C(e):"";if(i)switch(i){case dn:return fn;case pn:return hn;case mn:return cn;case wn:return an;case vn:return ln}return n});var yn=gn,bn="[object Arguments]",_n="[object Array]",Sn="[object Object]",En=Object.prototype.hasOwnProperty,In=function(t,n,e,i,s,o){var u=r(t),h=r(n),c=u?_n:yn(t),a=h?_n:yn(n),l=(c=c==bn?Sn:c)==Sn,f=(a=a==bn?Sn:a)==Sn,d=c==a;if(d&&pt(t)){if(!pt(n))return!1;u=!0,l=!1}if(d&&!l)return o||(o=new Bt),u||It(t)?Vt(t,n,e,i,s,o):function(t,n,e,i,r,s,o){switch(e){case"[object DataView]":if(t.byteLength!=n.byteLength||t.byteOffset!=n.byteOffset)return!1;t=t.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=n.byteLength||!s(new Yt(t),new Yt(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return x(+t,+n);case"[object Error]":return t.name==n.name&&t.message==n.message;case"[object RegExp]":case"[object String]":return t==n+"";case"[object Map]":var u=Jt;case"[object Set]":if(u||(u=Kt),t.size!=n.size&&!(1&i))return!1;var h=o.get(t);if(h)return h==n;i|=2,o.set(t,n);var c=Vt(u(t),u(n),i,r,s,o);return o.delete(t),c;case"[object Symbol]":if(Xt)return Xt.call(t)==Xt.call(n)}return!1}(t,n,c,e,i,s,o);if(!(1&e)){var p=l&&En.call(t,"__wrapped__"),m=f&&En.call(n,"__wrapped__");if(p||m){var w=p?t.value():t,v=m?n.value():n;return o||(o=new Bt),s(w,v,e,i,o)}}return!!d&&(o||(o=new Bt),function(t,n,e,i,r,s){var o=1&e,u=nn(t),h=u.length;if(h!=nn(n).length&&!o)return!1;for(var c=h;c--;){var a=u[c];if(!(o?a in n:en.call(n,a)))return!1}var l=s.get(t),f=s.get(n);if(l&&f)return l==n&&f==t;var d=!0;s.set(t,n),s.set(n,t);for(var p=o;++c<h;){var m=t[a=u[c]],w=n[a];if(i)var v=o?i(w,m,a,n,t,s):i(m,w,a,t,n,s);if(!(void 0===v?m===w||r(m,w,e,i,s):v)){d=!1;break}p||(p="constructor"==a)}if(d&&!p){var g=t.constructor,y=n.constructor;g==y||!("constructor"in t)||!("constructor"in n)||"function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y||(d=!1)}return s.delete(t),s.delete(n),d}(t,n,e,i,s,o))},kn=function t(n,e,i,r,s){return n===e||(null==n||null==e||!w(n)&&!w(e)?n!=n&&e!=e:In(n,e,i,r,t,s))},Cn=function(t){return t==t&&!_(t)},jn=function(t,n){return function(e){return null!=e&&e[t]===n&&(void 0!==n||t in Object(e))}},On=function(t){var n=function(t){for(var n=Nt(t),e=n.length;e--;){var i=n[e],r=t[i];n[e]=[i,r,Cn(r)]}return n}(t);return 1==n.length&&n[0][2]?jn(n[0][0],n[0][1]):function(e){return e===t||function(t,n,e,i){var r=e.length,s=r,o=!i;if(null==t)return!s;for(t=Object(t);r--;){var u=e[r];if(o&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++r<s;){var h=(u=e[r])[0],c=t[h],a=u[1];if(o&&u[2]){if(void 0===c&&!(h in t))return!1}else{var l=new Bt;if(i)var f=i(c,a,h,t,n,l);if(!(void 0===f?kn(a,c,3,i,l):f))return!1}}return!0}(e,t,n)}},Mn=function(t,n){return null!=t&&n in Object(t)},Tn=function(t,n){return null!=t&&function(t,n,e){for(var i=-1,s=(n=et(n,t)).length,o=!1;++i<s;){var u=it(n[i]);if(!(o=null!=t&&e(t,u)))break;t=t[u]}return o||++i!=s?o:!!(s=null==t?0:t.length)&&vt(s)&&wt(u,s)&&(r(t)||ft(t))}(t,n,Mn)},Dn=function(t){return b(t)?(n=it(t),function(t){return null==t?void 0:t[n]}):function(t){return function(n){return rt(n,t)}}(t);var n},Nn=function(t){return"function"==typeof t?t:null==t?Rt:"object"==typeof t?r(t)?(e=t[1],b(n=t[0])&&Cn(e)?jn(it(n),e):function(t){var i=st(t,n);return void 0===i&&i===e?Tn(t,n):kn(e,i,3)}):On(t):Dn(t);var n,e},An=function(t,n){if(t!==n){var e=void 0!==t,i=null===t,r=t==t,s=v(t),o=void 0!==n,u=null===n,h=n==n,c=v(n);if(!u&&!c&&!s&&t>n||s&&o&&h&&!u&&!c||i&&o&&h||!e&&h||!r)return 1;if(!i&&!s&&!c&&t<n||c&&e&&r&&!i&&!s||u&&e&&r||!o&&r||!h)return-1}return 0},Rn=function(t,n,e){n=n.length?X(n,(function(t){return r(t)?function(n){return rt(n,1===t.length?t[0]:t)}:t})):[Rt];var i=-1;n=X(n,_t(Nn));var s=function(t,n){var e=-1,i=Dt(t)?Array(t.length):[];return At(t,(function(t,r,s){i[++e]=n(t,r,s)})),i}(t,(function(t){return{criteria:X(n,(function(n){return n(t)})),index:++i,value:t}}));return function(t,n){var e=t.length;for(t.sort(n);e--;)t[e]=t[e].value;return t}(s,(function(t,n){return function(t,n,e){for(var i=-1,r=t.criteria,s=n.criteria,o=r.length,u=e.length;++i<o;){var h=An(r[i],s[i]);if(h)return i>=u?h:h*("desc"==e[i]?-1:1)}return t.index-n.index}(t,n,e)}))},$n=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)},xn=Math.max,Pn=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ln=Date.now,Un=function(t){var n=0,e=0;return function(){var i=Ln(),r=16-(i-e);if(e=i,r>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}(Pn?function(t,n){return Pn(t,"toString",{configurable:!0,enumerable:!1,value:(e=n,function(){return e}),writable:!0});var e}:Rt),Fn=function(t,n,e){if(!_(e))return!1;var i=typeof n;return!!("number"==i?Dt(e)&&wt(n,e.length):"string"==i&&n in e)&&x(e[n],t)},Bn=function(t){return Un(function(t,n,e){return n=xn(void 0===n?t.length-1:n,0),function(){for(var i=arguments,r=-1,s=xn(i.length-n,0),o=Array(s);++r<s;)o[r]=i[n+r];r=-1;for(var u=Array(n+1);++r<n;)u[r]=i[r];return u[n]=e(o),$n(t,this,u)}}(t,void 0,Rt),t+"")}((function(t,n){if(null==t)return[];var e=n.length;return e>1&&Fn(t,n[0],n[1])?n=[]:e>2&&Fn(n[0],n[1],n[2])&&(n=[n[0]]),Rn(t,Ut(n,1),[])})),qn=function(t,n){return function(){for(var e=new Array(arguments.length),i=0;i<e.length;i++)e[i]=arguments[i];return t.apply(n,e)}},Wn=Object.prototype.toString;function Hn(t){return"[object Array]"===Wn.call(t)}function zn(t){return void 0===t}function Vn(t){return null!==t&&"object"==typeof t}function Yn(t){if("[object Object]"!==Wn.call(t))return!1;var n=Object.getPrototypeOf(t);return null===n||n===Object.prototype}function Jn(t){return"[object Function]"===Wn.call(t)}function Kn(t,n){if(null!=t)if("object"!=typeof t&&(t=[t]),Hn(t))for(var e=0,i=t.length;e<i;e++)n.call(null,t[e],e,t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.call(null,t[r],r,t)}var Gn={isArray:Hn,isArrayBuffer:function(t){return"[object ArrayBuffer]"===Wn.call(t)},isBuffer:function(t){return null!==t&&!zn(t)&&null!==t.constructor&&!zn(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:Vn,isPlainObject:Yn,isUndefined:zn,isDate:function(t){return"[object Date]"===Wn.call(t)},isFile:function(t){return"[object File]"===Wn.call(t)},isBlob:function(t){return"[object Blob]"===Wn.call(t)},isFunction:Jn,isStream:function(t){return Vn(t)&&Jn(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:Kn,merge:function t(){var n={};function e(e,i){n[i]=Yn(n[i])&&Yn(e)?t(n[i],e):Yn(e)?t({},e):Hn(e)?e.slice():e}for(var i=0,r=arguments.length;i<r;i++)Kn(arguments[i],e);return n},extend:function(t,n,e){return Kn(n,(function(n,i){t[i]=e&&"function"==typeof n?qn(n,e):n})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}};function Xn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Zn=function(t,n,e){if(!n)return t;var i;if(e)i=e(n);else if(Gn.isURLSearchParams(n))i=n.toString();else{var r=[];Gn.forEach(n,(function(t,n){null!=t&&(Gn.isArray(t)?n+="[]":t=[t],Gn.forEach(t,(function(t){Gn.isDate(t)?t=t.toISOString():Gn.isObject(t)&&(t=JSON.stringify(t)),r.push(Xn(n)+"="+Xn(t))})))})),i=r.join("&")}if(i){var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t};function Qn(){this.handlers=[]}Qn.prototype.use=function(t,n,e){return this.handlers.push({fulfilled:t,rejected:n,synchronous:!!e&&e.synchronous,runWhen:e?e.runWhen:null}),this.handlers.length-1},Qn.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},Qn.prototype.forEach=function(t){Gn.forEach(this.handlers,(function(n){null!==n&&t(n)}))};var te=Qn,ne=function(t,n){Gn.forEach(t,(function(e,i){i!==n&&i.toUpperCase()===n.toUpperCase()&&(t[n]=e,delete t[i])}))},ee=function(t,n,e,i,r){return t.config=n,e&&(t.code=e),t.request=i,t.response=r,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t},ie=function(t,n,e,i,r){var s=new Error(t);return ee(s,n,e,i,r)},re=Gn.isStandardBrowserEnv()?{write:function(t,n,e,i,r,s){var o=[];o.push(t+"="+encodeURIComponent(n)),Gn.isNumber(e)&&o.push("expires="+new Date(e).toGMTString()),Gn.isString(i)&&o.push("path="+i),Gn.isString(r)&&o.push("domain="+r),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},se=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],oe=Gn.isStandardBrowserEnv()?function(){var t,n=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");function i(t){var i=t;return n&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return t=i(window.location.href),function(n){var e=Gn.isString(n)?i(n):n;return e.protocol===t.protocol&&e.host===t.host}}():function(){return!0};function ue(t){this.message=t}ue.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ue.prototype.__CANCEL__=!0;var he=ue,ce={"Content-Type":"application/x-www-form-urlencoded"};function ae(t,n){!Gn.isUndefined(t)&&Gn.isUndefined(t["Content-Type"])&&(t["Content-Type"]=n)}var le,fe={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(le=function(t){return new Promise((function(n,e){var i,r=t.data,s=t.headers,o=t.responseType;function u(){t.cancelToken&&t.cancelToken.unsubscribe(i),t.signal&&t.signal.removeEventListener("abort",i)}Gn.isFormData(r)&&delete s["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var c=t.auth.username||"",a=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.Authorization="Basic "+btoa(c+":"+a)}var l,f,d=(f=t.url,(l=t.baseURL)&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(f)?function(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t}(l,f):f);function p(){if(h){var i,r,s,c,a,l="getAllResponseHeaders"in h?(i=h.getAllResponseHeaders(),a={},i?(Gn.forEach(i.split("\n"),(function(t){if(c=t.indexOf(":"),r=Gn.trim(t.substr(0,c)).toLowerCase(),s=Gn.trim(t.substr(c+1)),r){if(a[r]&&se.indexOf(r)>=0)return;a[r]="set-cookie"===r?(a[r]?a[r]:[]).concat([s]):a[r]?a[r]+", "+s:s}})),a):a):null;!function(t,n,e){var i=e.config.validateStatus;e.status&&i&&!i(e.status)?n(ie("Request failed with status code "+e.status,e.config,null,e.request,e)):t(e)}((function(t){n(t),u()}),(function(t){e(t),u()}),{data:o&&"text"!==o&&"json"!==o?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:l,config:t,request:h}),h=null}}if(h.open(t.method.toUpperCase(),Zn(d,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,"onloadend"in h?h.onloadend=p:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(p)},h.onabort=function(){h&&(e(ie("Request aborted",t,"ECONNABORTED",h)),h=null)},h.onerror=function(){e(ie("Network Error",t,null,h)),h=null},h.ontimeout=function(){var n="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(n=t.timeoutErrorMessage),e(ie(n,t,(t.transitional||de.transitional).clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},Gn.isStandardBrowserEnv()){var m=(t.withCredentials||oe(d))&&t.xsrfCookieName?re.read(t.xsrfCookieName):void 0;m&&(s[t.xsrfHeaderName]=m)}"setRequestHeader"in h&&Gn.forEach(s,(function(t,n){void 0===r&&"content-type"===n.toLowerCase()?delete s[n]:h.setRequestHeader(n,t)})),Gn.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),o&&"json"!==o&&(h.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(i=function(t){h&&(e(!t||t&&t.type?new he("canceled"):t),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(i),t.signal&&(t.signal.aborted?i():t.signal.addEventListener("abort",i))),r||(r=null),h.send(r)}))}),le),transformRequest:[function(t,n){return ne(n,"Accept"),ne(n,"Content-Type"),Gn.isFormData(t)||Gn.isArrayBuffer(t)||Gn.isBuffer(t)||Gn.isStream(t)||Gn.isFile(t)||Gn.isBlob(t)?t:Gn.isArrayBufferView(t)?t.buffer:Gn.isURLSearchParams(t)?(ae(n,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):Gn.isObject(t)||n&&"application/json"===n["Content-Type"]?(ae(n,"application/json"),function(t){if(Gn.isString(t))try{return(0,JSON.parse)(t),Gn.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var n=this.transitional||fe.transitional,e=!(n&&n.silentJSONParsing)&&"json"===this.responseType;if(e||n&&n.forcedJSONParsing&&Gn.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(e){if("SyntaxError"===t.name)throw ee(t,this,"E_JSON_PARSE");throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Gn.forEach(["delete","get","head"],(function(t){fe.headers[t]={}})),Gn.forEach(["post","put","patch"],(function(t){fe.headers[t]=Gn.merge(ce)}));var de=fe,pe=function(t,n,e){var i=this||de;return Gn.forEach(e,(function(e){t=e.call(i,t,n)})),t},me=function(t){return!(!t||!t.__CANCEL__)};function we(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new he("canceled")}var ve=function(t){return we(t),t.headers=t.headers||{},t.data=pe.call(t,t.data,t.headers,t.transformRequest),t.headers=Gn.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Gn.forEach(["delete","get","head","post","put","patch","common"],(function(n){delete t.headers[n]})),(t.adapter||de.adapter)(t).then((function(n){return we(t),n.data=pe.call(t,n.data,n.headers,t.transformResponse),n}),(function(n){return me(n)||(we(t),n&&n.response&&(n.response.data=pe.call(t,n.response.data,n.response.headers,t.transformResponse))),Promise.reject(n)}))},ge=function(t,n){n=n||{};var e={};function i(t,n){return Gn.isPlainObject(t)&&Gn.isPlainObject(n)?Gn.merge(t,n):Gn.isPlainObject(n)?Gn.merge({},n):Gn.isArray(n)?n.slice():n}function r(e){return Gn.isUndefined(n[e])?Gn.isUndefined(t[e])?void 0:i(void 0,t[e]):i(t[e],n[e])}function s(t){if(!Gn.isUndefined(n[t]))return i(void 0,n[t])}function o(e){return Gn.isUndefined(n[e])?Gn.isUndefined(t[e])?void 0:i(void 0,t[e]):i(void 0,n[e])}function u(e){return e in n?i(t[e],n[e]):e in t?i(void 0,t[e]):void 0}var h={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:u};return Gn.forEach(Object.keys(t).concat(Object.keys(n)),(function(t){var n=h[t]||r,i=n(t);Gn.isUndefined(i)&&n!==u||(e[t]=i)})),e},ye="0.22.0",be=ye,_e={};["object","boolean","number","function","string","symbol"].forEach((function(t,n){_e[t]=function(e){return typeof e===t||"a"+(n<1?"n ":" ")+t}}));var Se={};_e.transitional=function(t,n,e){function i(t,n){return"[Axios v"+be+"] Transitional option '"+t+"'"+n+(e?". "+e:"")}return function(e,r,s){if(!1===t)throw new Error(i(r," has been removed"+(n?" in "+n:"")));return n&&!Se[r]&&(Se[r]=!0,console.warn(i(r," has been deprecated since v"+n+" and will be removed in the near future"))),!t||t(e,r,s)}};var Ee={assertOptions:function(t,n,e){if("object"!=typeof t)throw new TypeError("options must be an object");for(var i=Object.keys(t),r=i.length;r-- >0;){var s=i[r],o=n[s];if(o){var u=t[s],h=void 0===u||o(u,s,t);if(!0!==h)throw new TypeError("option "+s+" must be "+h)}else if(!0!==e)throw Error("Unknown option "+s)}},validators:_e},Ie=Ee.validators;function ke(t){this.defaults=t,this.interceptors={request:new te,response:new te}}ke.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=ge(this.defaults,t)).method=t.method?t.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var n=t.transitional;void 0!==n&&Ee.assertOptions(n,{silentJSONParsing:Ie.transitional(Ie.boolean),forcedJSONParsing:Ie.transitional(Ie.boolean),clarifyTimeoutError:Ie.transitional(Ie.boolean)},!1);var e=[],i=!0;this.interceptors.request.forEach((function(n){"function"==typeof n.runWhen&&!1===n.runWhen(t)||(i=i&&n.synchronous,e.unshift(n.fulfilled,n.rejected))}));var r,s=[];if(this.interceptors.response.forEach((function(t){s.push(t.fulfilled,t.rejected)})),!i){var o=[ve,void 0];for(Array.prototype.unshift.apply(o,e),o=o.concat(s),r=Promise.resolve(t);o.length;)r=r.then(o.shift(),o.shift());return r}for(var u=t;e.length;){var h=e.shift(),c=e.shift();try{u=h(u)}catch(t){c(t);break}}try{r=ve(u)}catch(t){return Promise.reject(t)}for(;s.length;)r=r.then(s.shift(),s.shift());return r},ke.prototype.getUri=function(t){return t=ge(this.defaults,t),Zn(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},Gn.forEach(["delete","get","head","options"],(function(t){ke.prototype[t]=function(n,e){return this.request(ge(e||{},{method:t,url:n,data:(e||{}).data}))}})),Gn.forEach(["post","put","patch"],(function(t){ke.prototype[t]=function(n,e,i){return this.request(ge(i||{},{method:t,url:n,data:e}))}}));var Ce=ke;function je(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var n;this.promise=new Promise((function(t){n=t}));var e=this;this.promise.then((function(t){if(e._listeners){var n,i=e._listeners.length;for(n=0;n<i;n++)e._listeners[n](t);e._listeners=null}})),this.promise.then=function(t){var n,i=new Promise((function(t){e.subscribe(t),n=t})).then(t);return i.cancel=function(){e.unsubscribe(n)},i},t((function(t){e.reason||(e.reason=new he(t),n(e.reason))}))}je.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},je.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},je.prototype.unsubscribe=function(t){if(this._listeners){var n=this._listeners.indexOf(t);-1!==n&&this._listeners.splice(n,1)}},je.source=function(){var t;return{token:new je((function(n){t=n})),cancel:t}};var Oe=je,Me=function t(n){var e=new Ce(n),i=qn(Ce.prototype.request,e);return Gn.extend(i,Ce.prototype,e),Gn.extend(i,e),i.create=function(e){return t(ge(n,e))},i}(de);Me.Axios=Ce,Me.Cancel=he,Me.CancelToken=Oe,Me.isCancel=me,Me.VERSION=ye,Me.all=function(t){return Promise.all(t)},Me.spread=function(t){return function(n){return t.apply(null,n)}},Me.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError};var Te=Me;Te.default=Me;var De=Te;const Ne="YYYY-MM-DD HH:mm:ss",Ae="ddd, MMM DD YYYY";var Re;function $e(t){const n=t.salon_geolocation||[];let i=[];if(t.salon_miniwebsite){const n=Array.isArray(t.salon_miniwebsite)?t.salon_miniwebsite[0]:t.salon_miniwebsite||{};i=[n.full_small_slider_img1,n.full_small_slider_img2,n.full_small_slider_img3].filter((t=>!!t))}return{id:t.id,about:t.about,email:t.email,ownerName:t.owner_name,fullProfileImage:t.full_profile_image,fullCoverImage:t.full_cover_image,subdomain:t.subdomain,website:t.website,businessName:t.business_name,businessPhone:t.business_phone,businessAddress:t.business_address,businessLocationLat:n.length>0?n[0].location_lat:null,businessLocationLng:n.length>0?n[0].location_lng:null,city:t.city,state:t.state,zipcode:t.zipcode?Number(t.zipcode):null,businessHours:(t.business_hours||t.salon_working_time||[]).map((t=>({dayName:t.day_name,openTime:t.open_time,closeTime:t.close_time,status:t.status}))),rating:Number(t.rating_point),primaryColor:t.primary_color||e.Primary,salonImages:i}}function xe({salonImages:t,fullProfileImage:n}){return t&&t.length>0?t[0]:n||"https://res.cloudinary.com/reckon-mini-sites/image/upload/v1636477599/FaveSalon%20Social%20Website/default/default--picture_w3jvfh.png"}
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */!function(t){t[t.Open=0]="Open",t[t.Close=1]="Close",t[t.ByAppointment=2]="ByAppointment"}(Re||(Re={}));const Pe=function(t,n){if(!t)throw Le(n)},Le=function(t){return new Error("Firebase Database (${JSCORE_VERSION}) INTERNAL ASSERT FAILED: "+t)},Ue=function(t){const n=[];let e=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);r<128?n[e++]=r:r<2048?(n[e++]=r>>6|192,n[e++]=63&r|128):55296==(64512&r)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++i)),n[e++]=r>>18|240,n[e++]=r>>12&63|128,n[e++]=r>>6&63|128,n[e++]=63&r|128):(n[e++]=r>>12|224,n[e++]=r>>6&63|128,n[e++]=63&r|128)}return n},Fe={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,n){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const e=n?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let n=0;n<t.length;n+=3){const r=t[n],s=n+1<t.length,o=s?t[n+1]:0,u=n+2<t.length,h=u?t[n+2]:0;let c=(15&o)<<2|h>>6,a=63&h;u||(a=64,s||(c=64)),i.push(e[r>>2],e[(3&r)<<4|o>>4],e[c],e[a])}return i.join("")},encodeString(t,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(t):this.encodeByteArray(Ue(t),n)},decodeString(t,n){return this.HAS_NATIVE_SUPPORT&&!n?atob(t):function(t){const n=[];let e=0,i=0;for(;e<t.length;){const r=t[e++];if(r<128)n[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=t[e++];n[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536;n[i++]=String.fromCharCode(55296+(s>>10)),n[i++]=String.fromCharCode(56320+(1023&s))}else{const s=t[e++],o=t[e++];n[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return n.join("")}(this.decodeStringToByteArray(t,n))},decodeStringToByteArray(t,n){this.init_();const e=n?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let n=0;n<t.length;){const r=e[t.charAt(n++)],s=n<t.length?e[t.charAt(n)]:0;++n;const o=n<t.length?e[t.charAt(n)]:64;++n;const u=n<t.length?e[t.charAt(n)]:64;if(++n,null==r||null==s||null==o||null==u)throw new Be;i.push(r<<2|s>>4),64!==o&&(i.push(s<<4&240|o>>2),64!==u&&i.push(o<<6&192|u))}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- *
22
- * Licensed under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License.
24
- * You may obtain a copy of the License at
25
- *
26
- * http://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software
29
- * distributed under the License is distributed on an "AS IS" BASIS,
30
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
- * See the License for the specific language governing permissions and
32
- * limitations under the License.
33
- */class Be extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const qe=function(t){const n=Ue(t);return Fe.encodeByteArray(n,!0)},We=function(t){return qe(t).replace(/\./g,"")},He=function(t){try{return Fe.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
34
- /**
35
- * @license
36
- * Copyright 2017 Google LLC
37
- *
38
- * Licensed under the Apache License, Version 2.0 (the "License");
39
- * you may not use this file except in compliance with the License.
40
- * You may obtain a copy of the License at
41
- *
42
- * http://www.apache.org/licenses/LICENSE-2.0
43
- *
44
- * Unless required by applicable law or agreed to in writing, software
45
- * distributed under the License is distributed on an "AS IS" BASIS,
46
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47
- * See the License for the specific language governing permissions and
48
- * limitations under the License.
49
- */
50
- function ze(t){return Ve(void 0,t)}function Ve(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(const e in n)n.hasOwnProperty(e)&&"__proto__"!==e&&(t[e]=Ve(t[e],n[e]));return t}
51
- /**
52
- * @license
53
- * Copyright 2022 Google LLC
54
- *
55
- * Licensed under the Apache License, Version 2.0 (the "License");
56
- * you may not use this file except in compliance with the License.
57
- * You may obtain a copy of the License at
58
- *
59
- * http://www.apache.org/licenses/LICENSE-2.0
60
- *
61
- * Unless required by applicable law or agreed to in writing, software
62
- * distributed under the License is distributed on an "AS IS" BASIS,
63
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
- * See the License for the specific language governing permissions and
65
- * limitations under the License.
66
- */
67
- const Ye=()=>{try{
68
- /**
69
- * @license
70
- * Copyright 2022 Google LLC
71
- *
72
- * Licensed under the Apache License, Version 2.0 (the "License");
73
- * you may not use this file except in compliance with the License.
74
- * You may obtain a copy of the License at
75
- *
76
- * http://www.apache.org/licenses/LICENSE-2.0
77
- *
78
- * Unless required by applicable law or agreed to in writing, software
79
- * distributed under the License is distributed on an "AS IS" BASIS,
80
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
- * See the License for the specific language governing permissions and
82
- * limitations under the License.
83
- */
84
- return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const n=t&&He(t[1]);return n&&JSON.parse(n)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},Je=()=>{var t;return null===(t=Ye())||void 0===t?void 0:t.config};
85
- /**
86
- * @license
87
- * Copyright 2017 Google LLC
88
- *
89
- * Licensed under the Apache License, Version 2.0 (the "License");
90
- * you may not use this file except in compliance with the License.
91
- * You may obtain a copy of the License at
92
- *
93
- * http://www.apache.org/licenses/LICENSE-2.0
94
- *
95
- * Unless required by applicable law or agreed to in writing, software
96
- * distributed under the License is distributed on an "AS IS" BASIS,
97
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
- * See the License for the specific language governing permissions and
99
- * limitations under the License.
100
- */
101
- class Ke{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,n)=>{this.resolve=t,this.reject=n}))}wrapCallback(t){return(n,e)=>{n?this.reject(n):this.resolve(e),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(n):t(n,e))}}}
102
- /**
103
- * @license
104
- * Copyright 2021 Google LLC
105
- *
106
- * Licensed under the Apache License, Version 2.0 (the "License");
107
- * you may not use this file except in compliance with the License.
108
- * You may obtain a copy of the License at
109
- *
110
- * http://www.apache.org/licenses/LICENSE-2.0
111
- *
112
- * Unless required by applicable law or agreed to in writing, software
113
- * distributed under the License is distributed on an "AS IS" BASIS,
114
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115
- * See the License for the specific language governing permissions and
116
- * limitations under the License.
117
- */function Ge(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")}class Xe extends Error{constructor(t,n,e){super(n),this.code=t,this.customData=e,this.name="FirebaseError",Object.setPrototypeOf(this,Xe.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ze.prototype.create)}}class Ze{constructor(t,n,e){this.service=t,this.serviceName=n,this.errors=e}create(t,...n){const e=n[0]||{},i=`${this.service}/${t}`,r=this.errors[t],s=r?function(t,n){return t.replace(Qe,((t,e)=>{const i=n[e];return null!=i?String(i):`<${e}?>`}))}(r,e):"Error";return new Xe(i,`${this.serviceName}: ${s} (${i}).`,e)}}const Qe=/\{\$([^}]+)}/g;
118
- /**
119
- * @license
120
- * Copyright 2017 Google LLC
121
- *
122
- * Licensed under the Apache License, Version 2.0 (the "License");
123
- * you may not use this file except in compliance with the License.
124
- * You may obtain a copy of the License at
125
- *
126
- * http://www.apache.org/licenses/LICENSE-2.0
127
- *
128
- * Unless required by applicable law or agreed to in writing, software
129
- * distributed under the License is distributed on an "AS IS" BASIS,
130
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131
- * See the License for the specific language governing permissions and
132
- * limitations under the License.
133
- */function ti(t){return JSON.parse(t)}function ni(t){return JSON.stringify(t)}
134
- /**
135
- * @license
136
- * Copyright 2017 Google LLC
137
- *
138
- * Licensed under the Apache License, Version 2.0 (the "License");
139
- * you may not use this file except in compliance with the License.
140
- * You may obtain a copy of the License at
141
- *
142
- * http://www.apache.org/licenses/LICENSE-2.0
143
- *
144
- * Unless required by applicable law or agreed to in writing, software
145
- * distributed under the License is distributed on an "AS IS" BASIS,
146
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
147
- * See the License for the specific language governing permissions and
148
- * limitations under the License.
149
- */const ei=function(t){let n={},e={},i={},r="";try{const s=t.split(".");n=ti(He(s[0])||""),e=ti(He(s[1])||""),r=s[2],i=e.d||{},delete e.d}catch(t){}return{header:n,claims:e,data:i,signature:r}};
150
- /**
151
- * @license
152
- * Copyright 2017 Google LLC
153
- *
154
- * Licensed under the Apache License, Version 2.0 (the "License");
155
- * you may not use this file except in compliance with the License.
156
- * You may obtain a copy of the License at
157
- *
158
- * http://www.apache.org/licenses/LICENSE-2.0
159
- *
160
- * Unless required by applicable law or agreed to in writing, software
161
- * distributed under the License is distributed on an "AS IS" BASIS,
162
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163
- * See the License for the specific language governing permissions and
164
- * limitations under the License.
165
- */
166
- function ii(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function ri(t,n){return Object.prototype.hasOwnProperty.call(t,n)?t[n]:void 0}function si(t){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n))return!1;return!0}function oi(t,n,e){const i={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=n.call(e,t[r],r,t));return i}function ui(t,n){if(t===n)return!0;const e=Object.keys(t),i=Object.keys(n);for(const r of e){if(!i.includes(r))return!1;const e=t[r],s=n[r];if(hi(e)&&hi(s)){if(!ui(e,s))return!1}else if(e!==s)return!1}for(const t of i)if(!e.includes(t))return!1;return!0}function hi(t){return null!==t&&"object"==typeof t}
167
- /**
168
- * @license
169
- * Copyright 2017 Google LLC
170
- *
171
- * Licensed under the Apache License, Version 2.0 (the "License");
172
- * you may not use this file except in compliance with the License.
173
- * You may obtain a copy of the License at
174
- *
175
- * http://www.apache.org/licenses/LICENSE-2.0
176
- *
177
- * Unless required by applicable law or agreed to in writing, software
178
- * distributed under the License is distributed on an "AS IS" BASIS,
179
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180
- * See the License for the specific language governing permissions and
181
- * limitations under the License.
182
- */
183
- /**
184
- * @license
185
- * Copyright 2017 Google LLC
186
- *
187
- * Licensed under the Apache License, Version 2.0 (the "License");
188
- * you may not use this file except in compliance with the License.
189
- * You may obtain a copy of the License at
190
- *
191
- * http://www.apache.org/licenses/LICENSE-2.0
192
- *
193
- * Unless required by applicable law or agreed to in writing, software
194
- * distributed under the License is distributed on an "AS IS" BASIS,
195
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
196
- * See the License for the specific language governing permissions and
197
- * limitations under the License.
198
- */
199
- class ci{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(t,n){n||(n=0);const e=this.W_;if("string"==typeof t)for(let i=0;i<16;i++)e[i]=t.charCodeAt(n)<<24|t.charCodeAt(n+1)<<16|t.charCodeAt(n+2)<<8|t.charCodeAt(n+3),n+=4;else for(let i=0;i<16;i++)e[i]=t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3],n+=4;for(let t=16;t<80;t++){const n=e[t-3]^e[t-8]^e[t-14]^e[t-16];e[t]=4294967295&(n<<1|n>>>31)}let i,r,s=this.chain_[0],o=this.chain_[1],u=this.chain_[2],h=this.chain_[3],c=this.chain_[4];for(let t=0;t<80;t++){t<40?t<20?(i=h^o&(u^h),r=1518500249):(i=o^u^h,r=1859775393):t<60?(i=o&u|h&(o|u),r=2400959708):(i=o^u^h,r=3395469782);const n=(s<<5|s>>>27)+i+c+r+e[t]&4294967295;c=h,h=u,u=4294967295&(o<<30|o>>>2),o=s,s=n}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(t,n){if(null==t)return;void 0===n&&(n=t.length);const e=n-this.blockSize;let i=0;const r=this.buf_;let s=this.inbuf_;for(;i<n;){if(0===s)for(;i<=e;)this.compress_(t,i),i+=this.blockSize;if("string"==typeof t){for(;i<n;)if(r[s]=t.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}else for(;i<n;)if(r[s]=t[i],++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}this.inbuf_=s,this.total_+=n}digest(){const t=[];let n=8*this.total_;this.update(this.pad_,this.inbuf_<56?56-this.inbuf_:this.blockSize-(this.inbuf_-56));for(let t=this.blockSize-1;t>=56;t--)this.buf_[t]=255&n,n/=256;this.compress_(this.buf_);let e=0;for(let n=0;n<5;n++)for(let i=24;i>=0;i-=8)t[e]=this.chain_[n]>>i&255,++e;return t}}function ai(t,n){return`${t} failed: ${n} argument `}
200
- /**
201
- * @license
202
- * Copyright 2017 Google LLC
203
- *
204
- * Licensed under the Apache License, Version 2.0 (the "License");
205
- * you may not use this file except in compliance with the License.
206
- * You may obtain a copy of the License at
207
- *
208
- * http://www.apache.org/licenses/LICENSE-2.0
209
- *
210
- * Unless required by applicable law or agreed to in writing, software
211
- * distributed under the License is distributed on an "AS IS" BASIS,
212
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213
- * See the License for the specific language governing permissions and
214
- * limitations under the License.
215
- */const li=function(t){let n=0;for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);i<128?n++:i<2048?n+=2:i>=55296&&i<=56319?(n+=4,e++):n+=3}return n};
216
- /**
217
- * @license
218
- * Copyright 2021 Google LLC
219
- *
220
- * Licensed under the Apache License, Version 2.0 (the "License");
221
- * you may not use this file except in compliance with the License.
222
- * You may obtain a copy of the License at
223
- *
224
- * http://www.apache.org/licenses/LICENSE-2.0
225
- *
226
- * Unless required by applicable law or agreed to in writing, software
227
- * distributed under the License is distributed on an "AS IS" BASIS,
228
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
229
- * See the License for the specific language governing permissions and
230
- * limitations under the License.
231
- */
232
- function fi(t){return t&&t._delegate?t._delegate:t}class di{constructor(t,n,e){this.name=t,this.instanceFactory=n,this.type=e,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
233
- /**
234
- * @license
235
- * Copyright 2019 Google LLC
236
- *
237
- * Licensed under the Apache License, Version 2.0 (the "License");
238
- * you may not use this file except in compliance with the License.
239
- * You may obtain a copy of the License at
240
- *
241
- * http://www.apache.org/licenses/LICENSE-2.0
242
- *
243
- * Unless required by applicable law or agreed to in writing, software
244
- * distributed under the License is distributed on an "AS IS" BASIS,
245
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
246
- * See the License for the specific language governing permissions and
247
- * limitations under the License.
248
- */const pi="[DEFAULT]";
249
- /**
250
- * @license
251
- * Copyright 2019 Google LLC
252
- *
253
- * Licensed under the Apache License, Version 2.0 (the "License");
254
- * you may not use this file except in compliance with the License.
255
- * You may obtain a copy of the License at
256
- *
257
- * http://www.apache.org/licenses/LICENSE-2.0
258
- *
259
- * Unless required by applicable law or agreed to in writing, software
260
- * distributed under the License is distributed on an "AS IS" BASIS,
261
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
262
- * See the License for the specific language governing permissions and
263
- * limitations under the License.
264
- */class mi{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const t=new Ke;if(this.instancesDeferred.set(n,t),this.isInitialized(n)||this.shouldAutoInitialize())try{const e=this.getOrInitializeService({instanceIdentifier:n});e&&t.resolve(e)}catch(t){}}return this.instancesDeferred.get(n).promise}getImmediate(t){var n;const e=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),i=null!==(n=null==t?void 0:t.optional)&&void 0!==n&&n;if(!this.isInitialized(e)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:e})}catch(t){if(i)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
265
- /**
266
- * @license
267
- * Copyright 2019 Google LLC
268
- *
269
- * Licensed under the Apache License, Version 2.0 (the "License");
270
- * you may not use this file except in compliance with the License.
271
- * You may obtain a copy of the License at
272
- *
273
- * http://www.apache.org/licenses/LICENSE-2.0
274
- *
275
- * Unless required by applicable law or agreed to in writing, software
276
- * distributed under the License is distributed on an "AS IS" BASIS,
277
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
- * See the License for the specific language governing permissions and
279
- * limitations under the License.
280
- */(t))try{this.getOrInitializeService({instanceIdentifier:pi})}catch(t){}for(const[t,n]of this.instancesDeferred.entries()){const e=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:e});n.resolve(t)}catch(t){}}}}clearInstance(t=pi){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=pi){return this.instances.has(t)}getOptions(t=pi){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,e=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(e))throw Error(`${this.name}(${e}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:e,options:n});for(const[t,n]of this.instancesDeferred.entries())e===this.normalizeInstanceIdentifier(t)&&n.resolve(i);return i}onInit(t,n){var e;const i=this.normalizeInstanceIdentifier(n),r=null!==(e=this.onInitCallbacks.get(i))&&void 0!==e?e:new Set;r.add(t),this.onInitCallbacks.set(i,r);const s=this.instances.get(i);return s&&t(s,i),()=>{r.delete(t)}}invokeOnInitCallbacks(t,n){const e=this.onInitCallbacks.get(n);if(e)for(const i of e)try{i(t,n)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let e=this.instances.get(t);if(!e&&this.component&&(e=this.component.instanceFactory(this.container,{instanceIdentifier:(i=t,i===pi?void 0:i),options:n}),this.instances.set(t,e),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(e,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,e)}catch(t){}var i;return e||null}normalizeInstanceIdentifier(t=pi){return this.component?this.component.multipleInstances?t:pi:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class wi{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new mi(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}
281
- /**
282
- * @license
283
- * Copyright 2017 Google LLC
284
- *
285
- * Licensed under the Apache License, Version 2.0 (the "License");
286
- * you may not use this file except in compliance with the License.
287
- * You may obtain a copy of the License at
288
- *
289
- * http://www.apache.org/licenses/LICENSE-2.0
290
- *
291
- * Unless required by applicable law or agreed to in writing, software
292
- * distributed under the License is distributed on an "AS IS" BASIS,
293
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
294
- * See the License for the specific language governing permissions and
295
- * limitations under the License.
296
- */var vi;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(vi||(vi={}));const gi={debug:vi.DEBUG,verbose:vi.VERBOSE,info:vi.INFO,warn:vi.WARN,error:vi.ERROR,silent:vi.SILENT},yi=vi.INFO,bi={[vi.DEBUG]:"log",[vi.VERBOSE]:"log",[vi.INFO]:"info",[vi.WARN]:"warn",[vi.ERROR]:"error"},_i=(t,n,...e)=>{if(n<t.logLevel)return;const i=(new Date).toISOString(),r=bi[n];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${n})`);console[r](`[${i}] ${t.name}:`,...e)};class Si{constructor(t){this.name=t,this._logLevel=yi,this._logHandler=_i,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in vi))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?gi[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,vi.DEBUG,...t),this._logHandler(this,vi.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,vi.VERBOSE,...t),this._logHandler(this,vi.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,vi.INFO,...t),this._logHandler(this,vi.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,vi.WARN,...t),this._logHandler(this,vi.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,vi.ERROR,...t),this._logHandler(this,vi.ERROR,...t)}}let Ei,Ii;const ki=new WeakMap,Ci=new WeakMap,ji=new WeakMap,Oi=new WeakMap,Mi=new WeakMap;let Ti={get(t,n,e){if(t instanceof IDBTransaction){if("done"===n)return Ci.get(t);if("objectStoreNames"===n)return t.objectStoreNames||ji.get(t);if("store"===n)return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return Ni(t[n])},set:(t,n,e)=>(t[n]=e,!0),has:(t,n)=>t instanceof IDBTransaction&&("done"===n||"store"===n)||n in t};function Di(t){return"function"==typeof t?function(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Ii||(Ii=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...n){return t.apply(Ai(this),n),Ni(ki.get(this))}:function(...n){return Ni(t.apply(Ai(this),n))}:function(n,...e){const i=t.call(Ai(this),n,...e);return ji.set(i,n.sort?n.sort():[n]),Ni(i)}}(t):(t instanceof IDBTransaction&&function(t){if(Ci.has(t))return;const n=new Promise(((n,e)=>{const i=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",s),t.removeEventListener("abort",s)},r=()=>{n(),i()},s=()=>{e(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",r),t.addEventListener("error",s),t.addEventListener("abort",s)}));Ci.set(t,n)}(t),n=t,(Ei||(Ei=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>n instanceof t))?new Proxy(t,Ti):t);var n}function Ni(t){if(t instanceof IDBRequest)return function(t){const n=new Promise(((n,e)=>{const i=()=>{t.removeEventListener("success",r),t.removeEventListener("error",s)},r=()=>{n(Ni(t.result)),i()},s=()=>{e(t.error),i()};t.addEventListener("success",r),t.addEventListener("error",s)}));return n.then((n=>{n instanceof IDBCursor&&ki.set(n,t)})).catch((()=>{})),Mi.set(n,t),n}(t);if(Oi.has(t))return Oi.get(t);const n=Di(t);return n!==t&&(Oi.set(t,n),Mi.set(n,t)),n}const Ai=t=>Mi.get(t),Ri=["get","getKey","getAll","getAllKeys","count"],$i=["put","add","delete","clear"],xi=new Map;function Pi(t,n){if(!(t instanceof IDBDatabase)||n in t||"string"!=typeof n)return;if(xi.get(n))return xi.get(n);const e=n.replace(/FromIndex$/,""),i=n!==e,r=$i.includes(e);if(!(e in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!Ri.includes(e))return;const s=async function(t,...n){const s=this.transaction(t,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(n.shift())),(await Promise.all([o[e](...n),r&&s.done]))[0]};return xi.set(n,s),s}var Li;Li=Ti,Ti={...Li,get:(t,n,e)=>Pi(t,n)||Li.get(t,n,e),has:(t,n)=>!!Pi(t,n)||Li.has(t,n)};
297
- /**
298
- * @license
299
- * Copyright 2019 Google LLC
300
- *
301
- * Licensed under the Apache License, Version 2.0 (the "License");
302
- * you may not use this file except in compliance with the License.
303
- * You may obtain a copy of the License at
304
- *
305
- * http://www.apache.org/licenses/LICENSE-2.0
306
- *
307
- * Unless required by applicable law or agreed to in writing, software
308
- * distributed under the License is distributed on an "AS IS" BASIS,
309
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310
- * See the License for the specific language governing permissions and
311
- * limitations under the License.
312
- */
313
- class Ui{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const n=t.getComponent();return"VERSION"===(null==n?void 0:n.type)}(t)){const n=t.getImmediate();return`${n.library}/${n.version}`}return null})).filter((t=>t)).join(" ")}}const Fi="@firebase/app",Bi="0.9.14",qi=new Si("@firebase/app"),Wi="[DEFAULT]",Hi={[Fi]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},zi=new Map,Vi=new Map;function Yi(t,n){try{t.container.addComponent(n)}catch(e){qi.debug(`Component ${n.name} failed to register with FirebaseApp ${t.name}`,e)}}function Ji(t){const n=t.name;if(Vi.has(n))return qi.debug(`There were multiple attempts to register component ${n}.`),!1;Vi.set(n,t);for(const n of zi.values())Yi(n,t);return!0}
314
- /**
315
- * @license
316
- * Copyright 2019 Google LLC
317
- *
318
- * Licensed under the Apache License, Version 2.0 (the "License");
319
- * you may not use this file except in compliance with the License.
320
- * You may obtain a copy of the License at
321
- *
322
- * http://www.apache.org/licenses/LICENSE-2.0
323
- *
324
- * Unless required by applicable law or agreed to in writing, software
325
- * distributed under the License is distributed on an "AS IS" BASIS,
326
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
327
- * See the License for the specific language governing permissions and
328
- * limitations under the License.
329
- */
330
- const Ki=new Ze("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});
331
- /**
332
- * @license
333
- * Copyright 2019 Google LLC
334
- *
335
- * Licensed under the Apache License, Version 2.0 (the "License");
336
- * you may not use this file except in compliance with the License.
337
- * You may obtain a copy of the License at
338
- *
339
- * http://www.apache.org/licenses/LICENSE-2.0
340
- *
341
- * Unless required by applicable law or agreed to in writing, software
342
- * distributed under the License is distributed on an "AS IS" BASIS,
343
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344
- * See the License for the specific language governing permissions and
345
- * limitations under the License.
346
- */
347
- class Gi{constructor(t,n,e){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=e,this.container.addComponent(new di("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Ki.create("app-deleted",{appName:this._name})}}
348
- /**
349
- * @license
350
- * Copyright 2019 Google LLC
351
- *
352
- * Licensed under the Apache License, Version 2.0 (the "License");
353
- * you may not use this file except in compliance with the License.
354
- * You may obtain a copy of the License at
355
- *
356
- * http://www.apache.org/licenses/LICENSE-2.0
357
- *
358
- * Unless required by applicable law or agreed to in writing, software
359
- * distributed under the License is distributed on an "AS IS" BASIS,
360
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
361
- * See the License for the specific language governing permissions and
362
- * limitations under the License.
363
- */function Xi(t,n={}){let e=t;"object"!=typeof n&&(n={name:n});const i=Object.assign({name:Wi,automaticDataCollectionEnabled:!1},n),r=i.name;if("string"!=typeof r||!r)throw Ki.create("bad-app-name",{appName:String(r)});if(e||(e=Je()),!e)throw Ki.create("no-options");const s=zi.get(r);if(s){if(ui(e,s.options)&&ui(i,s.config))return s;throw Ki.create("duplicate-app",{appName:r})}const o=new wi(r);for(const t of Vi.values())o.addComponent(t);const u=new Gi(e,i,o);return zi.set(r,u),u}function Zi(t,n,e){var i;let r=null!==(i=Hi[t])&&void 0!==i?i:t;e&&(r+=`-${e}`);const s=r.match(/\s|\//),o=n.match(/\s|\//);if(s||o){const t=[`Unable to register library "${r}" with version "${n}":`];return s&&t.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${n}" contains illegal characters (whitespace or "/")`),void qi.warn(t.join(" "))}Ji(new di(`${r}-version`,(()=>({library:r,version:n})),"VERSION"))}
364
- /**
365
- * @license
366
- * Copyright 2021 Google LLC
367
- *
368
- * Licensed under the Apache License, Version 2.0 (the "License");
369
- * you may not use this file except in compliance with the License.
370
- * You may obtain a copy of the License at
371
- *
372
- * http://www.apache.org/licenses/LICENSE-2.0
373
- *
374
- * Unless required by applicable law or agreed to in writing, software
375
- * distributed under the License is distributed on an "AS IS" BASIS,
376
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
377
- * See the License for the specific language governing permissions and
378
- * limitations under the License.
379
- */const Qi="firebase-heartbeat-store";let tr=null;function nr(){return tr||(tr=function(t,n,{blocked:e,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(t,n),u=Ni(o);return i&&o.addEventListener("upgradeneeded",(t=>{i(Ni(o.result),t.oldVersion,t.newVersion,Ni(o.transaction),t)})),e&&o.addEventListener("blocked",(t=>e(t.oldVersion,t.newVersion,t))),u.then((t=>{s&&t.addEventListener("close",(()=>s())),r&&t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),u}("firebase-heartbeat-database",1,{upgrade:(t,n)=>{0===n&&t.createObjectStore(Qi)}}).catch((t=>{throw Ki.create("idb-open",{originalErrorMessage:t.message})}))),tr}async function er(t,n){try{const e=(await nr()).transaction(Qi,"readwrite"),i=e.objectStore(Qi);await i.put(n,ir(t)),await e.done}catch(t){if(t instanceof Xe)qi.warn(t.message);else{const n=Ki.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});qi.warn(n.message)}}}function ir(t){return`${t.name}!${t.options.appId}`}
380
- /**
381
- * @license
382
- * Copyright 2021 Google LLC
383
- *
384
- * Licensed under the Apache License, Version 2.0 (the "License");
385
- * you may not use this file except in compliance with the License.
386
- * You may obtain a copy of the License at
387
- *
388
- * http://www.apache.org/licenses/LICENSE-2.0
389
- *
390
- * Unless required by applicable law or agreed to in writing, software
391
- * distributed under the License is distributed on an "AS IS" BASIS,
392
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
393
- * See the License for the specific language governing permissions and
394
- * limitations under the License.
395
- */class rr{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new or(n),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=sr();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==n&&!this._heartbeatsCache.heartbeats.some((t=>t.date===n)))return this._heartbeatsCache.heartbeats.push({date:n,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const n=new Date(t.date).valueOf();return Date.now()-n<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=sr(),{heartbeatsToSend:n,unsentEntries:e}=function(t,n=1024){const e=[];let i=t.slice();for(const r of t){const t=e.find((t=>t.agent===r.agent));if(t){if(t.dates.push(r.date),ur(e)>n){t.dates.pop();break}}else if(e.push({agent:r.agent,dates:[r.date]}),ur(e)>n){e.pop();break}i=i.slice(1)}return{heartbeatsToSend:e,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=We(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,e.length>0?(this._heartbeatsCache.heartbeats=e,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function sr(){return(new Date).toISOString().substring(0,10)}class or{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,n)=>{try{let e=!0;const i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),e||self.indexedDB.deleteDatabase(i),t(!0)},r.onupgradeneeded=()=>{e=!1},r.onerror=()=>{var t;n((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch(t){n(t)}})).then((()=>!0)).catch((()=>!1))}async read(){return await this._canUseIndexedDBPromise&&await async function(t){try{const n=await nr();return await n.transaction(Qi).objectStore(Qi).get(ir(t))}catch(t){if(t instanceof Xe)qi.warn(t.message);else{const n=Ki.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});qi.warn(n.message)}}}(this.app)||{heartbeats:[]}}async overwrite(t){var n;if(await this._canUseIndexedDBPromise){const e=await this.read();return er(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:e.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var n;if(await this._canUseIndexedDBPromise){const e=await this.read();return er(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function ur(t){return We(JSON.stringify({version:2,heartbeats:t})).length}
396
- /**
397
- * @license
398
- * Copyright 2019 Google LLC
399
- *
400
- * Licensed under the Apache License, Version 2.0 (the "License");
401
- * you may not use this file except in compliance with the License.
402
- * You may obtain a copy of the License at
403
- *
404
- * http://www.apache.org/licenses/LICENSE-2.0
405
- *
406
- * Unless required by applicable law or agreed to in writing, software
407
- * distributed under the License is distributed on an "AS IS" BASIS,
408
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409
- * See the License for the specific language governing permissions and
410
- * limitations under the License.
411
- */Ji(new di("platform-logger",(t=>new Ui(t)),"PRIVATE")),Ji(new di("heartbeat",(t=>new rr(t)),"PRIVATE")),Zi(Fi,Bi,""),Zi(Fi,Bi,"esm2017"),Zi("fire-js",""),
412
- /**
413
- * @license
414
- * Copyright 2020 Google LLC
415
- *
416
- * Licensed under the Apache License, Version 2.0 (the "License");
417
- * you may not use this file except in compliance with the License.
418
- * You may obtain a copy of the License at
419
- *
420
- * http://www.apache.org/licenses/LICENSE-2.0
421
- *
422
- * Unless required by applicable law or agreed to in writing, software
423
- * distributed under the License is distributed on an "AS IS" BASIS,
424
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
425
- * See the License for the specific language governing permissions and
426
- * limitations under the License.
427
- */
428
- Zi("firebase","10.0.0","app");const hr="@firebase/database",cr="1.0.0";
429
- /**
430
- * @license
431
- * Copyright 2019 Google LLC
432
- *
433
- * Licensed under the Apache License, Version 2.0 (the "License");
434
- * you may not use this file except in compliance with the License.
435
- * You may obtain a copy of the License at
436
- *
437
- * http://www.apache.org/licenses/LICENSE-2.0
438
- *
439
- * Unless required by applicable law or agreed to in writing, software
440
- * distributed under the License is distributed on an "AS IS" BASIS,
441
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
- * See the License for the specific language governing permissions and
443
- * limitations under the License.
444
- */
445
- let ar="";
446
- /**
447
- * @license
448
- * Copyright 2017 Google LLC
449
- *
450
- * Licensed under the Apache License, Version 2.0 (the "License");
451
- * you may not use this file except in compliance with the License.
452
- * You may obtain a copy of the License at
453
- *
454
- * http://www.apache.org/licenses/LICENSE-2.0
455
- *
456
- * Unless required by applicable law or agreed to in writing, software
457
- * distributed under the License is distributed on an "AS IS" BASIS,
458
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
459
- * See the License for the specific language governing permissions and
460
- * limitations under the License.
461
- */
462
- class lr{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,n){null==n?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),ni(n))}get(t){const n=this.domStorage_.getItem(this.prefixedName_(t));return null==n?null:ti(n)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}
463
- /**
464
- * @license
465
- * Copyright 2017 Google LLC
466
- *
467
- * Licensed under the Apache License, Version 2.0 (the "License");
468
- * you may not use this file except in compliance with the License.
469
- * You may obtain a copy of the License at
470
- *
471
- * http://www.apache.org/licenses/LICENSE-2.0
472
- *
473
- * Unless required by applicable law or agreed to in writing, software
474
- * distributed under the License is distributed on an "AS IS" BASIS,
475
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
476
- * See the License for the specific language governing permissions and
477
- * limitations under the License.
478
- */class fr{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,n){null==n?delete this.cache_[t]:this.cache_[t]=n}get(t){return ii(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}
479
- /**
480
- * @license
481
- * Copyright 2017 Google LLC
482
- *
483
- * Licensed under the Apache License, Version 2.0 (the "License");
484
- * you may not use this file except in compliance with the License.
485
- * You may obtain a copy of the License at
486
- *
487
- * http://www.apache.org/licenses/LICENSE-2.0
488
- *
489
- * Unless required by applicable law or agreed to in writing, software
490
- * distributed under the License is distributed on an "AS IS" BASIS,
491
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492
- * See the License for the specific language governing permissions and
493
- * limitations under the License.
494
- */const dr=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){const n=window[t];return n.setItem("firebase:sentinel","cache"),n.removeItem("firebase:sentinel"),new lr(n)}}catch(t){}return new fr},pr=dr("localStorage"),mr=dr("sessionStorage"),wr=new Si("@firebase/database"),vr=function(){let t=1;return function(){return t++}}(),gr=function(t){const n=function(t){const n=[];let e=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);if(r>=55296&&r<=56319){const n=r-55296;i++,Pe(i<t.length,"Surrogate pair missing trail surrogate."),r=65536+(n<<10)+(t.charCodeAt(i)-56320)}r<128?n[e++]=r:r<2048?(n[e++]=r>>6|192,n[e++]=63&r|128):r<65536?(n[e++]=r>>12|224,n[e++]=r>>6&63|128,n[e++]=63&r|128):(n[e++]=r>>18|240,n[e++]=r>>12&63|128,n[e++]=r>>6&63|128,n[e++]=63&r|128)}return n}(t),e=new ci;e.update(n);const i=e.digest();return Fe.encodeByteArray(i)},yr=function(...t){let n="";for(let e=0;e<t.length;e++){const i=t[e];Array.isArray(i)||i&&"object"==typeof i&&"number"==typeof i.length?n+=yr.apply(null,i):n+="object"==typeof i?ni(i):i,n+=" "}return n};let br=null,_r=!0;const Sr=function(...t){if(!0===_r&&(_r=!1,null===br&&!0===mr.get("logging_enabled")&&(!0,Pe(!0,"Can't turn on custom loggers persistently."),wr.logLevel=vi.VERBOSE,br=wr.log.bind(wr))),br){const n=yr.apply(null,t);br(n)}},Er=function(t){return function(...n){Sr(t,...n)}},Ir=function(...t){const n="FIREBASE INTERNAL ERROR: "+yr(...t);wr.error(n)},kr=function(...t){const n=`FIREBASE FATAL ERROR: ${yr(...t)}`;throw wr.error(n),new Error(n)},Cr=function(...t){const n="FIREBASE WARNING: "+yr(...t);wr.warn(n)},jr=function(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Or="[MIN_NAME]",Mr="[MAX_NAME]",Tr=function(t,n){if(t===n)return 0;if(t===Or||n===Mr)return-1;if(n===Or||t===Mr)return 1;{const e=Lr(t),i=Lr(n);return null!==e?null!==i?e-i==0?t.length-n.length:e-i:-1:null!==i?1:t<n?-1:1}},Dr=function(t,n){return t===n?0:t<n?-1:1},Nr=function(t,n){if(n&&t in n)return n[t];throw new Error("Missing required key ("+t+") in object: "+ni(n))},Ar=function(t){if("object"!=typeof t||null===t)return ni(t);const n=[];for(const e in t)n.push(e);n.sort();let e="{";for(let i=0;i<n.length;i++)0!==i&&(e+=","),e+=ni(n[i]),e+=":",e+=Ar(t[n[i]]);return e+="}",e},Rr=function(t,n){const e=t.length;if(e<=n)return[t];const i=[];for(let r=0;r<e;r+=n)i.push(t.substring(r,r+n>e?e:r+n));return i};function $r(t,n){for(const e in t)t.hasOwnProperty(e)&&n(e,t[e])}const xr=function(t){Pe(!jr(t),"Invalid JSON number");let n,e,i,r,s;0===t?(e=0,i=0,n=1/t==-1/0?1:0):(n=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(r=Math.min(Math.floor(Math.log(t)/Math.LN2),1023),e=r+1023,i=Math.round(t*Math.pow(2,52-r)-Math.pow(2,52))):(e=0,i=Math.round(t/Math.pow(2,-1074))));const o=[];for(s=52;s;s-=1)o.push(i%2?1:0),i=Math.floor(i/2);for(s=11;s;s-=1)o.push(e%2?1:0),e=Math.floor(e/2);o.push(n?1:0),o.reverse();const u=o.join("");let h="";for(s=0;s<64;s+=8){let t=parseInt(u.substr(s,8),2).toString(16);1===t.length&&(t="0"+t),h+=t}return h.toLowerCase()},Pr=new RegExp("^-?(0*)\\d{1,10}$"),Lr=function(t){if(Pr.test(t)){const n=Number(t);if(n>=-2147483648&&n<=2147483647)return n}return null},Ur=function(t){try{t()}catch(t){setTimeout((()=>{throw Cr("Exception was thrown by user callback.",t.stack||""),t}),Math.floor(0))}},Fr=function(t,n){const e=setTimeout(t,n);return"number"==typeof e&&"undefined"!=typeof Deno&&Deno.unrefTimer?Deno.unrefTimer(e):"object"==typeof e&&e.unref&&e.unref(),e};
495
- /**
496
- * @license
497
- * Copyright 2021 Google LLC
498
- *
499
- * Licensed under the Apache License, Version 2.0 (the "License");
500
- * you may not use this file except in compliance with the License.
501
- * You may obtain a copy of the License at
502
- *
503
- * http://www.apache.org/licenses/LICENSE-2.0
504
- *
505
- * Unless required by applicable law or agreed to in writing, software
506
- * distributed under the License is distributed on an "AS IS" BASIS,
507
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508
- * See the License for the specific language governing permissions and
509
- * limitations under the License.
510
- */
511
- class Br{constructor(t,n){this.appName_=t,this.appCheckProvider=n,this.appCheck=null==n?void 0:n.getImmediate({optional:!0}),this.appCheck||null==n||n.get().then((t=>this.appCheck=t))}getToken(t){return this.appCheck?this.appCheck.getToken(t):new Promise(((n,e)=>{setTimeout((()=>{this.appCheck?this.getToken(t).then(n,e):n(null)}),0)}))}addTokenChangeListener(t){var n;null===(n=this.appCheckProvider)||void 0===n||n.get().then((n=>n.addTokenListener(t)))}notifyForInvalidToken(){Cr(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}
512
- /**
513
- * @license
514
- * Copyright 2017 Google LLC
515
- *
516
- * Licensed under the Apache License, Version 2.0 (the "License");
517
- * you may not use this file except in compliance with the License.
518
- * You may obtain a copy of the License at
519
- *
520
- * http://www.apache.org/licenses/LICENSE-2.0
521
- *
522
- * Unless required by applicable law or agreed to in writing, software
523
- * distributed under the License is distributed on an "AS IS" BASIS,
524
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
525
- * See the License for the specific language governing permissions and
526
- * limitations under the License.
527
- */class qr{constructor(t,n,e){this.appName_=t,this.firebaseOptions_=n,this.authProvider_=e,this.auth_=null,this.auth_=e.getImmediate({optional:!0}),this.auth_||e.onInit((t=>this.auth_=t))}getToken(t){return this.auth_?this.auth_.getToken(t).catch((t=>t&&"auth/token-not-initialized"===t.code?(Sr("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t))):new Promise(((n,e)=>{setTimeout((()=>{this.auth_?this.getToken(t).then(n,e):n(null)}),0)}))}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then((n=>n.addAuthTokenListener(t)))}removeTokenChangeListener(t){this.authProvider_.get().then((n=>n.removeAuthTokenListener(t)))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';t+="credential"in this.firebaseOptions_?'Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?'Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':'Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Cr(t)}}class Wr{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}Wr.OWNER="owner";
528
- /**
529
- * @license
530
- * Copyright 2017 Google LLC
531
- *
532
- * Licensed under the Apache License, Version 2.0 (the "License");
533
- * you may not use this file except in compliance with the License.
534
- * You may obtain a copy of the License at
535
- *
536
- * http://www.apache.org/licenses/LICENSE-2.0
537
- *
538
- * Unless required by applicable law or agreed to in writing, software
539
- * distributed under the License is distributed on an "AS IS" BASIS,
540
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
541
- * See the License for the specific language governing permissions and
542
- * limitations under the License.
543
- */
544
- const Hr=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,zr="ac",Vr="websocket",Yr="long_polling";
545
- /**
546
- * @license
547
- * Copyright 2017 Google LLC
548
- *
549
- * Licensed under the Apache License, Version 2.0 (the "License");
550
- * you may not use this file except in compliance with the License.
551
- * You may obtain a copy of the License at
552
- *
553
- * http://www.apache.org/licenses/LICENSE-2.0
554
- *
555
- * Unless required by applicable law or agreed to in writing, software
556
- * distributed under the License is distributed on an "AS IS" BASIS,
557
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
558
- * See the License for the specific language governing permissions and
559
- * limitations under the License.
560
- */
561
- class Jr{constructor(t,n,e,i,r=!1,s="",o=!1,u=!1){this.secure=n,this.namespace=e,this.webSocketOnly=i,this.nodeAdmin=r,this.persistenceKey=s,this.includeNamespaceInQueryParams=o,this.isUsingEmulator=u,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=pr.get("host:"+t)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&pr.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){return`${this.secure?"https://":"http://"}${this.host}/${this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:""}`}}function Kr(t,n,e){let i;if(Pe("string"==typeof n,"typeof type must == string"),Pe("object"==typeof e,"typeof params must == object"),n===Vr)i=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(n!==Yr)throw new Error("Unknown connection type: "+n);i=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}(function(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams})(t)&&(e.ns=t.namespace);const r=[];return $r(e,((t,n)=>{r.push(t+"="+n)})),i+r.join("&")}
562
- /**
563
- * @license
564
- * Copyright 2017 Google LLC
565
- *
566
- * Licensed under the Apache License, Version 2.0 (the "License");
567
- * you may not use this file except in compliance with the License.
568
- * You may obtain a copy of the License at
569
- *
570
- * http://www.apache.org/licenses/LICENSE-2.0
571
- *
572
- * Unless required by applicable law or agreed to in writing, software
573
- * distributed under the License is distributed on an "AS IS" BASIS,
574
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
575
- * See the License for the specific language governing permissions and
576
- * limitations under the License.
577
- */class Gr{constructor(){this.counters_={}}incrementCounter(t,n=1){ii(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=n}get(){return ze(this.counters_)}}
578
- /**
579
- * @license
580
- * Copyright 2017 Google LLC
581
- *
582
- * Licensed under the Apache License, Version 2.0 (the "License");
583
- * you may not use this file except in compliance with the License.
584
- * You may obtain a copy of the License at
585
- *
586
- * http://www.apache.org/licenses/LICENSE-2.0
587
- *
588
- * Unless required by applicable law or agreed to in writing, software
589
- * distributed under the License is distributed on an "AS IS" BASIS,
590
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
591
- * See the License for the specific language governing permissions and
592
- * limitations under the License.
593
- */const Xr={},Zr={};function Qr(t){const n=t.toString();return Xr[n]||(Xr[n]=new Gr),Xr[n]}
594
- /**
595
- * @license
596
- * Copyright 2017 Google LLC
597
- *
598
- * Licensed under the Apache License, Version 2.0 (the "License");
599
- * you may not use this file except in compliance with the License.
600
- * You may obtain a copy of the License at
601
- *
602
- * http://www.apache.org/licenses/LICENSE-2.0
603
- *
604
- * Unless required by applicable law or agreed to in writing, software
605
- * distributed under the License is distributed on an "AS IS" BASIS,
606
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
607
- * See the License for the specific language governing permissions and
608
- * limitations under the License.
609
- */
610
- class ts{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,n){this.closeAfterResponse=t,this.onClose=n,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(t,n){for(this.pendingResponses[t]=n;this.pendingResponses[this.currentResponseNum];){const t=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let n=0;n<t.length;++n)t[n]&&Ur((()=>{this.onMessage_(t[n])}));if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}
611
- /**
612
- * @license
613
- * Copyright 2017 Google LLC
614
- *
615
- * Licensed under the Apache License, Version 2.0 (the "License");
616
- * you may not use this file except in compliance with the License.
617
- * You may obtain a copy of the License at
618
- *
619
- * http://www.apache.org/licenses/LICENSE-2.0
620
- *
621
- * Unless required by applicable law or agreed to in writing, software
622
- * distributed under the License is distributed on an "AS IS" BASIS,
623
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
624
- * See the License for the specific language governing permissions and
625
- * limitations under the License.
626
- */const ns="start";class es{constructor(t,n,e,i,r,s,o){this.connId=t,this.repoInfo=n,this.applicationId=e,this.appCheckToken=i,this.authToken=r,this.transportSessionId=s,this.lastSessionId=o,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Er(t),this.stats_=Qr(n),this.urlFn=t=>(this.appCheckToken&&(t[zr]=this.appCheckToken),Kr(n,Yr,t))}open(t,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new ts(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout((()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null}),Math.floor(3e4)),function(t){if("complete"===document.readyState)t();else{let n=!1;const e=function(){document.body?n||(n=!0,t()):setTimeout(e,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",e,!1),window.addEventListener("load",e,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",(()=>{"complete"===document.readyState&&e()})),window.attachEvent("onload",e))}}((()=>{if(this.isClosed_)return;this.scriptTagHolder=new is(((...t)=>{const[n,e,i,r,s]=t;if(this.incrementIncomingBytes_(t),this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,n===ns)this.id=e,this.password=i;else{if("close"!==n)throw new Error("Unrecognized command received: "+n);e?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(e,(()=>{this.onClosed_()}))):this.onClosed_()}}),((...t)=>{const[n,e]=t;this.incrementIncomingBytes_(t),this.myPacketOrderer.handleResponse(n,e)}),(()=>{this.onClosed_()}),this.urlFn);const t={};t[ns]="t",t.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=this.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",this.transportSessionId&&(t.s=this.transportSessionId),this.lastSessionId&&(t.ls=this.lastSessionId),this.applicationId&&(t.p=this.applicationId),this.appCheckToken&&(t[zr]=this.appCheckToken),"undefined"!=typeof location&&location.hostname&&Hr.test(location.hostname)&&(t.r="f");const n=this.urlFn(t);this.log_("Connecting via long-poll to "+n),this.scriptTagHolder.addTag(n,(()=>{}))}))}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){es.forceAllow_=!0}static forceDisallow(){es.forceDisallow_=!0}static isAvailable(){return!!es.forceAllow_||!(es.forceDisallow_||"undefined"==typeof document||null==document.createElement||"object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)||"object"==typeof Windows&&"object"==typeof Windows.UI)}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const n=ni(t);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const e=qe(n),i=Rr(e,1840);for(let t=0;t<i.length;t++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[t]),this.curSegmentNum++}addDisconnectPingFrame(t,n){this.myDisconnFrame=document.createElement("iframe");const e={dframe:"t"};e.id=t,e.pw=n,this.myDisconnFrame.src=this.urlFn(e),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(t){const n=ni(t).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}}class is{constructor(t,n,e,i){this.onDisconnect=e,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=vr(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=n,this.myIFrame=is.createIFrame_();let e="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)&&(e='<script>document.domain="'+document.domain+'";<\/script>');const i="<html><body>"+e+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){Sr("frame writing exception"),t.stack&&Sr(t.stack),Sr(t)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||Sr("No IE domain setting required")}catch(n){const e=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout((()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)}),Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,n){for(this.myID=t,this.myPW=n,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;let n=this.urlFn(t),e="",i=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+30+e.length<=1870;){const t=this.pendingSegs.shift();e=e+"&seg"+i+"="+t.seg+"&ts"+i+"="+t.ts+"&d"+i+"="+t.d,i++}return n+=e,this.addLongPollTag_(n,this.currentSerial),!0}return!1}enqueueSegment(t,n,e){this.pendingSegs.push({seg:t,ts:n,d:e}),this.alive&&this.newRequest_()}addLongPollTag_(t,n){this.outstandingRequests.add(n);const e=()=>{this.outstandingRequests.delete(n),this.newRequest_()},i=setTimeout(e,Math.floor(25e3));this.addTag(t,(()=>{clearTimeout(i),e()}))}addTag(t,n){setTimeout((()=>{try{if(!this.sendNewPolls)return;const e=this.myIFrame.doc.createElement("script");e.type="text/javascript",e.async=!0,e.src=t,e.onload=e.onreadystatechange=function(){const t=e.readyState;t&&"loaded"!==t&&"complete"!==t||(e.onload=e.onreadystatechange=null,e.parentNode&&e.parentNode.removeChild(e),n())},e.onerror=()=>{Sr("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(e)}catch(t){}}),Math.floor(1))}}
627
- /**
628
- * @license
629
- * Copyright 2017 Google LLC
630
- *
631
- * Licensed under the Apache License, Version 2.0 (the "License");
632
- * you may not use this file except in compliance with the License.
633
- * You may obtain a copy of the License at
634
- *
635
- * http://www.apache.org/licenses/LICENSE-2.0
636
- *
637
- * Unless required by applicable law or agreed to in writing, software
638
- * distributed under the License is distributed on an "AS IS" BASIS,
639
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
640
- * See the License for the specific language governing permissions and
641
- * limitations under the License.
642
- */let rs=null;"undefined"!=typeof MozWebSocket?rs=MozWebSocket:"undefined"!=typeof WebSocket&&(rs=WebSocket);class ss{constructor(t,n,e,i,r,s,o){this.connId=t,this.applicationId=e,this.appCheckToken=i,this.authToken=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Er(this.connId),this.stats_=Qr(n),this.connURL=ss.connectionURL_(n,s,o,i,e),this.nodeAdmin=n.nodeAdmin}static connectionURL_(t,n,e,i,r){const s={v:"5"};return"undefined"!=typeof location&&location.hostname&&Hr.test(location.hostname)&&(s.r="f"),n&&(s.s=n),e&&(s.ls=e),i&&(s[zr]=i),r&&(s.p=r),Kr(t,Vr,s)}open(t,n){this.onDisconnect=n,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,pr.set("previous_websocket_failure",!0);try{let t;this.mySock=new rs(this.connURL,[],t)}catch(t){this.log_("Error instantiating WebSocket.");const n=t.message||t.data;return n&&this.log_(n),void this.onClosed_()}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=t=>{this.handleIncomingFrame(t)},this.mySock.onerror=t=>{this.log_("WebSocket error. Closing connection.");const n=t.message||t.data;n&&this.log_(n),this.onClosed_()}}start(){}static forceDisallow(){ss.forceDisallow_=!0}static isAvailable(){let t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){const n=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&null!==rs&&!ss.forceDisallow_}static previouslyFailed(){return pr.isInMemoryStorage||!0===pr.get("previous_websocket_failure")}markConnectionHealthy(){pr.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const n=ti(t);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(Pe(null===this.frames,"We already have a frame buffer"),t.length<=6){const n=Number(t);if(!isNaN(n))return this.handleNewFrameCount_(n),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(null===this.mySock)return;const n=t.data;if(this.bytesReceived+=n.length,this.stats_.incrementCounter("bytes_received",n.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(n);else{const t=this.extractFrameCount_(n);null!==t&&this.appendFrame_(t)}}send(t){this.resetKeepAlive();const n=ni(t);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const e=Rr(n,16384);e.length>1&&this.sendString_(String(e.length));for(let t=0;t<e.length;t++)this.sendString_(e[t])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval((()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()}),Math.floor(45e3))}sendString_(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ss.responsesRequiredToBeHealthy=2,ss.healthyTimeout=3e4;
643
- /**
644
- * @license
645
- * Copyright 2017 Google LLC
646
- *
647
- * Licensed under the Apache License, Version 2.0 (the "License");
648
- * you may not use this file except in compliance with the License.
649
- * You may obtain a copy of the License at
650
- *
651
- * http://www.apache.org/licenses/LICENSE-2.0
652
- *
653
- * Unless required by applicable law or agreed to in writing, software
654
- * distributed under the License is distributed on an "AS IS" BASIS,
655
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
656
- * See the License for the specific language governing permissions and
657
- * limitations under the License.
658
- */
659
- class os{constructor(t){this.initTransports_(t)}static get ALL_TRANSPORTS(){return[es,ss]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(t){const n=ss&&ss.isAvailable();let e=n&&!ss.previouslyFailed();if(t.webSocketOnly&&(n||Cr("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),e=!0),e)this.transports_=[ss];else{const t=this.transports_=[];for(const n of os.ALL_TRANSPORTS)n&&n.isAvailable()&&t.push(n);os.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}os.globalTransportInitialized_=!1;class us{constructor(t,n,e,i,r,s,o,u,h,c){this.id=t,this.repoInfo_=n,this.applicationId_=e,this.appCheckToken_=i,this.authToken_=r,this.onMessage_=s,this.onReady_=o,this.onDisconnect_=u,this.onKill_=h,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Er("c:"+this.id+":"),this.transportManager_=new os(n),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const n=this.connReceiver_(this.conn_),e=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout((()=>{this.conn_&&this.conn_.open(n,e)}),Math.floor(0));const i=t.healthyTimeout||0;i>0&&(this.healthyTimeout_=Fr((()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>10240?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))}),Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return n=>{t===this.conn_?this.onConnectionLost_(n):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return n=>{2!==this.state_&&(t===this.rx_?this.onPrimaryMessageReceived_(n):t===this.secondaryConn_?this.onSecondaryMessageReceived_(n):this.log_("message on old connection"))}}sendRequest(t){this.sendData_({t:"d",d:t})}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if("t"in t){const n=t.t;"a"===n?this.upgradeIfSecondaryHealthy_():"r"===n?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===n&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const n=Nr("t",t),e=Nr("d",t);if("c"===n)this.onSecondaryControl_(e);else{if("d"!==n)throw new Error("Unknown protocol layer: "+n);this.pendingDataMessages.push(e)}}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const n=Nr("t",t),e=Nr("d",t);"c"===n?this.onControl_(e):"d"===n&&this.onDataMessage_(e)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const n=Nr("t",t);if("d"in t){const e=t.d;if("h"===n){const t=Object.assign({},e);this.repoInfo_.isUsingEmulator&&(t.h=this.repoInfo_.host),this.onHandshake_(t)}else if("n"===n){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let t=0;t<this.pendingDataMessages.length;++t)this.onDataMessage_(this.pendingDataMessages[t]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===n?this.onConnectionShutdown_(e):"r"===n?this.onReset_(e):"e"===n?Ir("Server Error: "+e):"o"===n?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Ir("Unknown control packet command: "+n)}}onHandshake_(t){const n=t.ts,e=t.v,i=t.h;this.sessionId=t.s,this.repoInfo_.host=i,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,n),"5"!==e&&Cr("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)}startUpgrade_(t){this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const n=this.connReceiver_(this.secondaryConn_),e=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,e),Fr((()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())}),Math.floor(6e4))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,n){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(n,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Fr((()=>{this.sendPingOnPrimaryIfNecessary_()}),Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()}onConnectionLost_(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(pr.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)}close(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}
660
- /**
661
- * @license
662
- * Copyright 2017 Google LLC
663
- *
664
- * Licensed under the Apache License, Version 2.0 (the "License");
665
- * you may not use this file except in compliance with the License.
666
- * You may obtain a copy of the License at
667
- *
668
- * http://www.apache.org/licenses/LICENSE-2.0
669
- *
670
- * Unless required by applicable law or agreed to in writing, software
671
- * distributed under the License is distributed on an "AS IS" BASIS,
672
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
673
- * See the License for the specific language governing permissions and
674
- * limitations under the License.
675
- */class hs{put(t,n,e,i){}merge(t,n,e,i){}refreshAuthToken(t){}refreshAppCheckToken(t){}onDisconnectPut(t,n,e){}onDisconnectMerge(t,n,e){}onDisconnectCancel(t,n){}reportStats(t){}}
676
- /**
677
- * @license
678
- * Copyright 2017 Google LLC
679
- *
680
- * Licensed under the Apache License, Version 2.0 (the "License");
681
- * you may not use this file except in compliance with the License.
682
- * You may obtain a copy of the License at
683
- *
684
- * http://www.apache.org/licenses/LICENSE-2.0
685
- *
686
- * Unless required by applicable law or agreed to in writing, software
687
- * distributed under the License is distributed on an "AS IS" BASIS,
688
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689
- * See the License for the specific language governing permissions and
690
- * limitations under the License.
691
- */class cs{constructor(t){this.allowedEvents_=t,this.listeners_={},Pe(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}trigger(t,...n){if(Array.isArray(this.listeners_[t])){const e=[...this.listeners_[t]];for(let t=0;t<e.length;t++)e[t].callback.apply(e[t].context,n)}}on(t,n,e){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:n,context:e});const i=this.getInitialEvent(t);i&&n.apply(e,i)}off(t,n,e){this.validateEventType_(t);const i=this.listeners_[t]||[];for(let t=0;t<i.length;t++)if(i[t].callback===n&&(!e||e===i[t].context))return void i.splice(t,1)}validateEventType_(t){Pe(this.allowedEvents_.find((n=>n===t)),"Unknown event: "+t)}}
692
- /**
693
- * @license
694
- * Copyright 2017 Google LLC
695
- *
696
- * Licensed under the Apache License, Version 2.0 (the "License");
697
- * you may not use this file except in compliance with the License.
698
- * You may obtain a copy of the License at
699
- *
700
- * http://www.apache.org/licenses/LICENSE-2.0
701
- *
702
- * Unless required by applicable law or agreed to in writing, software
703
- * distributed under the License is distributed on an "AS IS" BASIS,
704
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
705
- * See the License for the specific language governing permissions and
706
- * limitations under the License.
707
- */class as extends cs{constructor(){super(["online"]),this.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||Ge()||(window.addEventListener("online",(()=>{this.online_||(this.online_=!0,this.trigger("online",!0))}),!1),window.addEventListener("offline",(()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))}),!1))}static getInstance(){return new as}getInitialEvent(t){return Pe("online"===t,"Unknown event type: "+t),[this.online_]}currentlyOnline(){return this.online_}}
708
- /**
709
- * @license
710
- * Copyright 2017 Google LLC
711
- *
712
- * Licensed under the Apache License, Version 2.0 (the "License");
713
- * you may not use this file except in compliance with the License.
714
- * You may obtain a copy of the License at
715
- *
716
- * http://www.apache.org/licenses/LICENSE-2.0
717
- *
718
- * Unless required by applicable law or agreed to in writing, software
719
- * distributed under the License is distributed on an "AS IS" BASIS,
720
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
721
- * See the License for the specific language governing permissions and
722
- * limitations under the License.
723
- */class ls{constructor(t,n){if(void 0===n){this.pieces_=t.split("/");let n=0;for(let t=0;t<this.pieces_.length;t++)this.pieces_[t].length>0&&(this.pieces_[n]=this.pieces_[t],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=n}toString(){let t="";for(let n=this.pieceNum_;n<this.pieces_.length;n++)""!==this.pieces_[n]&&(t+="/"+this.pieces_[n]);return t||"/"}}function fs(){return new ls("")}function ds(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ps(t){return t.pieces_.length-t.pieceNum_}function ms(t){let n=t.pieceNum_;return n<t.pieces_.length&&n++,new ls(t.pieces_,n)}function ws(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function vs(t,n=0){return t.pieces_.slice(t.pieceNum_+n)}function gs(t){if(t.pieceNum_>=t.pieces_.length)return null;const n=[];for(let e=t.pieceNum_;e<t.pieces_.length-1;e++)n.push(t.pieces_[e]);return new ls(n,0)}function ys(t,n){const e=[];for(let n=t.pieceNum_;n<t.pieces_.length;n++)e.push(t.pieces_[n]);if(n instanceof ls)for(let t=n.pieceNum_;t<n.pieces_.length;t++)e.push(n.pieces_[t]);else{const t=n.split("/");for(let n=0;n<t.length;n++)t[n].length>0&&e.push(t[n])}return new ls(e,0)}function bs(t){return t.pieceNum_>=t.pieces_.length}function _s(t,n){const e=ds(t),i=ds(n);if(null===e)return n;if(e===i)return _s(ms(t),ms(n));throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+t+")")}function Ss(t,n){const e=vs(t,0),i=vs(n,0);for(let t=0;t<e.length&&t<i.length;t++){const n=Tr(e[t],i[t]);if(0!==n)return n}return e.length===i.length?0:e.length<i.length?-1:1}function Es(t,n){if(ps(t)!==ps(n))return!1;for(let e=t.pieceNum_,i=n.pieceNum_;e<=t.pieces_.length;e++,i++)if(t.pieces_[e]!==n.pieces_[i])return!1;return!0}function Is(t,n){let e=t.pieceNum_,i=n.pieceNum_;if(ps(t)>ps(n))return!1;for(;e<t.pieces_.length;){if(t.pieces_[e]!==n.pieces_[i])return!1;++e,++i}return!0}class ks{constructor(t,n){this.errorPrefix_=n,this.parts_=vs(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(let t=0;t<this.parts_.length;t++)this.byteLength_+=li(this.parts_[t]);Cs(this)}}function Cs(t){if(t.byteLength_>768)throw new Error(t.errorPrefix_+"has a key path longer than 768 bytes ("+t.byteLength_+").");if(t.parts_.length>32)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+js(t))}function js(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}
724
- /**
725
- * @license
726
- * Copyright 2017 Google LLC
727
- *
728
- * Licensed under the Apache License, Version 2.0 (the "License");
729
- * you may not use this file except in compliance with the License.
730
- * You may obtain a copy of the License at
731
- *
732
- * http://www.apache.org/licenses/LICENSE-2.0
733
- *
734
- * Unless required by applicable law or agreed to in writing, software
735
- * distributed under the License is distributed on an "AS IS" BASIS,
736
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
737
- * See the License for the specific language governing permissions and
738
- * limitations under the License.
739
- */class Os extends cs{constructor(){let t,n;super(["visible"]),"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(n="visibilitychange",t="hidden"):void 0!==document.mozHidden?(n="mozvisibilitychange",t="mozHidden"):void 0!==document.msHidden?(n="msvisibilitychange",t="msHidden"):void 0!==document.webkitHidden&&(n="webkitvisibilitychange",t="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,(()=>{const n=!document[t];n!==this.visible_&&(this.visible_=n,this.trigger("visible",n))}),!1)}static getInstance(){return new Os}getInitialEvent(t){return Pe("visible"===t,"Unknown event type: "+t),[this.visible_]}}
740
- /**
741
- * @license
742
- * Copyright 2017 Google LLC
743
- *
744
- * Licensed under the Apache License, Version 2.0 (the "License");
745
- * you may not use this file except in compliance with the License.
746
- * You may obtain a copy of the License at
747
- *
748
- * http://www.apache.org/licenses/LICENSE-2.0
749
- *
750
- * Unless required by applicable law or agreed to in writing, software
751
- * distributed under the License is distributed on an "AS IS" BASIS,
752
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
753
- * See the License for the specific language governing permissions and
754
- * limitations under the License.
755
- */const Ms=1e3;class Ts extends hs{constructor(t,n,e,i,r,s,o,u){if(super(),this.repoInfo_=t,this.applicationId_=n,this.onDataUpdate_=e,this.onConnectStatus_=i,this.onServerInfoUpdate_=r,this.authTokenProvider_=s,this.appCheckTokenProvider_=o,this.authOverride_=u,this.id=Ts.nextPersistentConnectionId_++,this.log_=Er("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Ms,this.maxReconnectDelay_=3e5,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,u)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");Os.getInstance().on("visible",this.onVisible_,this),-1===t.host.indexOf("fblocal")&&as.getInstance().on("online",this.onOnline_,this)}sendRequest(t,n,e){const i=++this.requestNumber_,r={r:i,a:t,b:n};this.log_(ni(r)),Pe(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(r),e&&(this.requestCBHash_[i]=e)}get(t){this.initConnection_();const n=new Ke,e={p:t._path.toString(),q:t._queryObject};return this.outstandingGets_.push({action:"g",request:e,onComplete:t=>{const e=t.d;"ok"===t.s?n.resolve(e):n.reject(e)}}),this.outstandingGetCount_++,this.connected_&&this.sendGet_(this.outstandingGets_.length-1),n.promise}listen(t,n,e,i){this.initConnection_();const r=t._queryIdentifier,s=t._path.toString();this.log_("Listen called for "+s+" "+r),this.listens.has(s)||this.listens.set(s,new Map),Pe(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Pe(!this.listens.get(s).has(r),"listen() called twice for same path/queryId.");const o={onComplete:i,hashFn:n,query:t,tag:e};this.listens.get(s).set(r,o),this.connected_&&this.sendListen_(o)}sendGet_(t){const n=this.outstandingGets_[t];this.sendRequest("g",n.request,(e=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),n.onComplete&&n.onComplete(e)}))}sendListen_(t){const n=t.query,e=n._path.toString(),i=n._queryIdentifier;this.log_("Listen on "+e+" for "+i);const r={p:e};t.tag&&(r.q=n._queryObject,r.t=t.tag),r.h=t.hashFn(),this.sendRequest("q",r,(r=>{const s=r.d,o=r.s;Ts.warnOnListenWarnings_(s,n),(this.listens.get(e)&&this.listens.get(e).get(i))===t&&(this.log_("listen response",r),"ok"!==o&&this.removeListen_(e,i),t.onComplete&&t.onComplete(o,s))}))}static warnOnListenWarnings_(t,n){if(t&&"object"==typeof t&&ii(t,"w")){const e=ri(t,"w");if(Array.isArray(e)&&~e.indexOf("no_index")){const t='".indexOn": "'+n._queryParams.getIndex().toString()+'"',e=n._path.toString();Cr(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${t} at ${e} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},(()=>{})),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&40===t.length||function(t){const n=ei(t).claims;return"object"==typeof n&&!0===n.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},(()=>{}))}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,n=function(t){const n=ei(t).claims;return!!n&&"object"==typeof n&&n.hasOwnProperty("iat")}(t)?"auth":"gauth",e={cred:t};null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&&(e.authvar=this.authOverride_),this.sendRequest(n,e,(n=>{const e=n.s,i=n.d||"error";this.authToken_===t&&("ok"===e?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(e,i))}))}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},(t=>{const n=t.s,e=t.d||"error";"ok"===n?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(n,e)}))}unlisten(t,n){const e=t._path.toString(),i=t._queryIdentifier;this.log_("Unlisten called for "+e+" "+i),Pe(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(e,i)&&this.connected_&&this.sendUnlisten_(e,i,t._queryObject,n)}sendUnlisten_(t,n,e,i){this.log_("Unlisten on "+t+" for "+n);const r={p:t};i&&(r.q=e,r.t=i),this.sendRequest("n",r)}onDisconnectPut(t,n,e){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,n,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:n,onComplete:e})}onDisconnectMerge(t,n,e){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,n,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:n,onComplete:e})}onDisconnectCancel(t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:n})}sendOnDisconnect_(t,n,e,i){const r={p:n,d:e};this.log_("onDisconnect "+t,r),this.sendRequest(t,r,(t=>{i&&setTimeout((()=>{i(t.s,t.d)}),Math.floor(0))}))}put(t,n,e,i){this.putInternal("p",t,n,e,i)}merge(t,n,e,i){this.putInternal("m",t,n,e,i)}putInternal(t,n,e,i,r){this.initConnection_();const s={p:n,d:e};void 0!==r&&(s.h=r),this.outstandingPuts_.push({action:t,request:s,onComplete:i}),this.outstandingPutCount_++,this.connected_?this.sendPut_(this.outstandingPuts_.length-1):this.log_("Buffering put: "+n)}sendPut_(t){const n=this.outstandingPuts_[t].action,e=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(n,e,(e=>{this.log_(n+" response",e),delete this.outstandingPuts_[t],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),i&&i(e.s,e.d)}))}reportStats(t){if(this.connected_){const n={c:t};this.log_("reportStats",n),this.sendRequest("s",n,(t=>{"ok"!==t.s&&this.log_("reportStats","Error sending stats: "+t.d)}))}}onDataMessage_(t){if("r"in t){this.log_("from server: "+ni(t));const n=t.r,e=this.requestCBHash_[n];e&&(delete this.requestCBHash_[n],e(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,n){this.log_("handleServerMessage",t,n),"d"===t?this.onDataUpdate_(n.p,n.d,!1,n.t):"m"===t?this.onDataUpdate_(n.p,n.d,!0,n.t):"c"===t?this.onListenRevoked_(n.p,n.q):"ac"===t?this.onAuthRevoked_(n.s,n.d):"apc"===t?this.onAppCheckRevoked_(n.s,n.d):"sd"===t?this.onSecurityDebugPacket_(n):Ir("Unrecognized action received from server: "+ni(t)+"\nAre you using the latest client?")}onReady_(t,n){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=n,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){Pe(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout((()=>{this.establishConnectionTimer_=null,this.establishConnection_()}),Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Ms,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Ms,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&((new Date).getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=Ms),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime());const t=(new Date).getTime()-this.lastConnectionAttemptTime_;let n=Math.max(0,this.reconnectDelay_-t);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),e=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Ts.nextConnectionId_++,r=this.lastSessionId;let s=!1,o=null;const u=function(){o?o.close():(s=!0,e())};this.realtime_={close:u,sendRequest:function(t){Pe(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(t)}};const h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[u,c]=await Promise.all([this.authTokenProvider_.getToken(h),this.appCheckTokenProvider_.getToken(h)]);s?Sr("getToken() completed but was canceled"):(Sr("getToken() completed. Creating connection."),this.authToken_=u&&u.accessToken,this.appCheckToken_=c&&c.token,o=new us(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,n,e,(t=>{Cr(t+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")}),r))}catch(t){this.log_("Failed to get token: "+t),s||(this.repoInfo_.nodeAdmin&&Cr(t),u())}}}interrupt(t){Sr("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){Sr("Resuming connection for reason: "+t),delete this.interruptReasons_[t],si(this.interruptReasons_)&&(this.reconnectDelay_=Ms,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const n=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:n})}cancelSentTransactions_(){for(let t=0;t<this.outstandingPuts_.length;t++){const n=this.outstandingPuts_[t];n&&"h"in n.request&&n.queued&&(n.onComplete&&n.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(t,n){let e;e=n?n.map((t=>Ar(t))).join("$"):"default";const i=this.removeListen_(t,e);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(t,n){const e=new ls(t).toString();let i;if(this.listens.has(e)){const t=this.listens.get(e);i=t.get(n),t.delete(n),0===t.size&&this.listens.delete(e)}else i=void 0;return i}onAuthRevoked_(t,n){Sr("Auth token revoked: "+t+"/"+n),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,n){Sr("App check token revoked: "+t+"/"+n),this.appCheckToken_=null,this.forceTokenRefresh_=!0,"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const n of t.values())this.sendListen_(n);for(let t=0;t<this.outstandingPuts_.length;t++)this.outstandingPuts_[t]&&this.sendPut_(t);for(;this.onDisconnectRequestQueue_.length;){const t=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(t.action,t.pathString,t.data,t.onComplete)}for(let t=0;t<this.outstandingGets_.length;t++)this.outstandingGets_[t]&&this.sendGet_(t)}sendConnectStats_(){const t={};t["sdk.js."+ar.replace(/\./g,"-")]=1,Ge()?t["framework.cordova"]=1:"object"==typeof navigator&&"ReactNative"===navigator.product&&(t["framework.reactnative"]=1),this.reportStats(t)}shouldReconnect_(){const t=as.getInstance().currentlyOnline();return si(this.interruptReasons_)&&t}}Ts.nextPersistentConnectionId_=0,Ts.nextConnectionId_=0;
756
- /**
757
- * @license
758
- * Copyright 2017 Google LLC
759
- *
760
- * Licensed under the Apache License, Version 2.0 (the "License");
761
- * you may not use this file except in compliance with the License.
762
- * You may obtain a copy of the License at
763
- *
764
- * http://www.apache.org/licenses/LICENSE-2.0
765
- *
766
- * Unless required by applicable law or agreed to in writing, software
767
- * distributed under the License is distributed on an "AS IS" BASIS,
768
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
769
- * See the License for the specific language governing permissions and
770
- * limitations under the License.
771
- */
772
- class Ds{constructor(t,n){this.name=t,this.node=n}static Wrap(t,n){return new Ds(t,n)}}
773
- /**
774
- * @license
775
- * Copyright 2017 Google LLC
776
- *
777
- * Licensed under the Apache License, Version 2.0 (the "License");
778
- * you may not use this file except in compliance with the License.
779
- * You may obtain a copy of the License at
780
- *
781
- * http://www.apache.org/licenses/LICENSE-2.0
782
- *
783
- * Unless required by applicable law or agreed to in writing, software
784
- * distributed under the License is distributed on an "AS IS" BASIS,
785
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
786
- * See the License for the specific language governing permissions and
787
- * limitations under the License.
788
- */class Ns{getCompare(){return this.compare.bind(this)}indexedValueChanged(t,n){const e=new Ds(Or,t),i=new Ds(Or,n);return 0!==this.compare(e,i)}minPost(){return Ds.MIN}}
789
- /**
790
- * @license
791
- * Copyright 2017 Google LLC
792
- *
793
- * Licensed under the Apache License, Version 2.0 (the "License");
794
- * you may not use this file except in compliance with the License.
795
- * You may obtain a copy of the License at
796
- *
797
- * http://www.apache.org/licenses/LICENSE-2.0
798
- *
799
- * Unless required by applicable law or agreed to in writing, software
800
- * distributed under the License is distributed on an "AS IS" BASIS,
801
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
802
- * See the License for the specific language governing permissions and
803
- * limitations under the License.
804
- */let As;class Rs extends Ns{static get __EMPTY_NODE(){return As}static set __EMPTY_NODE(t){As=t}compare(t,n){return Tr(t.name,n.name)}isDefinedOn(t){throw Le("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(t,n){return!1}minPost(){return Ds.MIN}maxPost(){return new Ds(Mr,As)}makePost(t,n){return Pe("string"==typeof t,"KeyIndex indexValue must always be a string."),new Ds(t,As)}toString(){return".key"}}const $s=new Rs;
805
- /**
806
- * @license
807
- * Copyright 2017 Google LLC
808
- *
809
- * Licensed under the Apache License, Version 2.0 (the "License");
810
- * you may not use this file except in compliance with the License.
811
- * You may obtain a copy of the License at
812
- *
813
- * http://www.apache.org/licenses/LICENSE-2.0
814
- *
815
- * Unless required by applicable law or agreed to in writing, software
816
- * distributed under the License is distributed on an "AS IS" BASIS,
817
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
818
- * See the License for the specific language governing permissions and
819
- * limitations under the License.
820
- */class xs{constructor(t,n,e,i,r=null){this.isReverse_=i,this.resultGenerator_=r,this.nodeStack_=[];let s=1;for(;!t.isEmpty();)if(s=n?e(t.key,n):1,i&&(s*=-1),s<0)t=this.isReverse_?t.left:t.right;else{if(0===s){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}getNext(){if(0===this.nodeStack_.length)return null;let t,n=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(n.key,n.value):{key:n.key,value:n.value},this.isReverse_)for(n=n.left;!n.isEmpty();)this.nodeStack_.push(n),n=n.right;else for(n=n.right;!n.isEmpty();)this.nodeStack_.push(n),n=n.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class Ps{constructor(t,n,e,i,r){this.key=t,this.value=n,this.color=null!=e?e:Ps.RED,this.left=null!=i?i:Ls.EMPTY_NODE,this.right=null!=r?r:Ls.EMPTY_NODE}copy(t,n,e,i,r){return new Ps(null!=t?t:this.key,null!=n?n:this.value,null!=e?e:this.color,null!=i?i:this.left,null!=r?r:this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,n,e){let i=this;const r=e(t,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(t,n,e),null):0===r?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(t,n,e)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return Ls.EMPTY_NODE;let t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,n){let e,i;if(e=this,n(t,e.key)<0)e.left.isEmpty()||e.left.isRed_()||e.left.left.isRed_()||(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.remove(t,n),null);else{if(e.left.isRed_()&&(e=e.rotateRight_()),e.right.isEmpty()||e.right.isRed_()||e.right.left.isRed_()||(e=e.moveRedRight_()),0===n(t,e.key)){if(e.right.isEmpty())return Ls.EMPTY_NODE;i=e.right.min_(),e=e.copy(i.key,i.value,null,null,e.right.removeMin_())}e=e.copy(null,null,null,null,e.right.remove(t,n))}return e.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,Ps.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,Ps.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,n)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}Ps.RED=!0,Ps.BLACK=!1;class Ls{constructor(t,n=Ls.EMPTY_NODE){this.comparator_=t,this.root_=n}insert(t,n){return new Ls(this.comparator_,this.root_.insert(t,n,this.comparator_).copy(null,null,Ps.BLACK,null,null))}remove(t){return new Ls(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ps.BLACK,null,null))}get(t){let n,e=this.root_;for(;!e.isEmpty();){if(n=this.comparator_(t,e.key),0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}getPredecessorKey(t){let n,e=this.root_,i=null;for(;!e.isEmpty();){if(n=this.comparator_(t,e.key),0===n){if(e.left.isEmpty())return i?i.key:null;for(e=e.left;!e.right.isEmpty();)e=e.right;return e.key}n<0?e=e.left:n>0&&(i=e,e=e.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new xs(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,n){return new xs(this.root_,t,this.comparator_,!1,n)}getReverseIteratorFrom(t,n){return new xs(this.root_,t,this.comparator_,!0,n)}getReverseIterator(t){return new xs(this.root_,null,this.comparator_,!0,t)}}
821
- /**
822
- * @license
823
- * Copyright 2017 Google LLC
824
- *
825
- * Licensed under the Apache License, Version 2.0 (the "License");
826
- * you may not use this file except in compliance with the License.
827
- * You may obtain a copy of the License at
828
- *
829
- * http://www.apache.org/licenses/LICENSE-2.0
830
- *
831
- * Unless required by applicable law or agreed to in writing, software
832
- * distributed under the License is distributed on an "AS IS" BASIS,
833
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
834
- * See the License for the specific language governing permissions and
835
- * limitations under the License.
836
- */
837
- function Us(t,n){return Tr(t.name,n.name)}function Fs(t,n){return Tr(t,n)}
838
- /**
839
- * @license
840
- * Copyright 2017 Google LLC
841
- *
842
- * Licensed under the Apache License, Version 2.0 (the "License");
843
- * you may not use this file except in compliance with the License.
844
- * You may obtain a copy of the License at
845
- *
846
- * http://www.apache.org/licenses/LICENSE-2.0
847
- *
848
- * Unless required by applicable law or agreed to in writing, software
849
- * distributed under the License is distributed on an "AS IS" BASIS,
850
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
851
- * See the License for the specific language governing permissions and
852
- * limitations under the License.
853
- */let Bs;Ls.EMPTY_NODE=new class{copy(t,n,e,i,r){return this}insert(t,n,e){return new Ps(t,n,null)}remove(t,n){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}};const qs=function(t){return"number"==typeof t?"number:"+xr(t):"string:"+t},Ws=function(t){if(t.isLeafNode()){const n=t.val();Pe("string"==typeof n||"number"==typeof n||"object"==typeof n&&ii(n,".sv"),"Priority must be a string or number.")}else Pe(t===Bs||t.isEmpty(),"priority of unexpected type.");Pe(t===Bs||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};
854
- /**
855
- * @license
856
- * Copyright 2017 Google LLC
857
- *
858
- * Licensed under the Apache License, Version 2.0 (the "License");
859
- * you may not use this file except in compliance with the License.
860
- * You may obtain a copy of the License at
861
- *
862
- * http://www.apache.org/licenses/LICENSE-2.0
863
- *
864
- * Unless required by applicable law or agreed to in writing, software
865
- * distributed under the License is distributed on an "AS IS" BASIS,
866
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
867
- * See the License for the specific language governing permissions and
868
- * limitations under the License.
869
- */
870
- let Hs,zs,Vs;class Ys{constructor(t,n=Ys.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=n,this.lazyHash_=null,Pe(null!=this.value_,"LeafNode shouldn't be created with null/undefined value."),Ws(this.priorityNode_)}static set __childrenNodeConstructor(t){Hs=t}static get __childrenNodeConstructor(){return Hs}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Ys(this.value_,t)}getImmediateChild(t){return".priority"===t?this.priorityNode_:Ys.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return bs(t)?this:".priority"===ds(t)?this.priorityNode_:Ys.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,n){return null}updateImmediateChild(t,n){return".priority"===t?this.updatePriority(n):n.isEmpty()&&".priority"!==t?this:Ys.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,n).updatePriority(this.priorityNode_)}updateChild(t,n){const e=ds(t);return null===e?n:n.isEmpty()&&".priority"!==e?this:(Pe(".priority"!==e||1===ps(t),".priority must be the last token in a path"),this.updateImmediateChild(e,Ys.__childrenNodeConstructor.EMPTY_NODE.updateChild(ms(t),n)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,n){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+qs(this.priorityNode_.val())+":");const n=typeof this.value_;t+=n+":",t+="number"===n?xr(this.value_):this.value_,this.lazyHash_=gr(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Ys.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Ys.__childrenNodeConstructor?-1:(Pe(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const n=typeof t.value_,e=typeof this.value_,i=Ys.VALUE_TYPE_ORDER.indexOf(n),r=Ys.VALUE_TYPE_ORDER.indexOf(e);return Pe(i>=0,"Unknown leaf type: "+n),Pe(r>=0,"Unknown leaf type: "+e),i===r?"object"===e?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:r-i}withIndex(){return this}isIndexed(){return!0}equals(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))}}Ys.VALUE_TYPE_ORDER=["object","boolean","number","string"];const Js=new class extends Ns{compare(t,n){const e=t.node.getPriority(),i=n.node.getPriority(),r=e.compareTo(i);return 0===r?Tr(t.name,n.name):r}isDefinedOn(t){return!t.getPriority().isEmpty()}indexedValueChanged(t,n){return!t.getPriority().equals(n.getPriority())}minPost(){return Ds.MIN}maxPost(){return new Ds(Mr,new Ys("[PRIORITY-POST]",Vs))}makePost(t,n){const e=zs(t);return new Ds(n,new Ys("[PRIORITY-POST]",e))}toString(){return".priority"}},Ks=Math.log(2);
871
- /**
872
- * @license
873
- * Copyright 2017 Google LLC
874
- *
875
- * Licensed under the Apache License, Version 2.0 (the "License");
876
- * you may not use this file except in compliance with the License.
877
- * You may obtain a copy of the License at
878
- *
879
- * http://www.apache.org/licenses/LICENSE-2.0
880
- *
881
- * Unless required by applicable law or agreed to in writing, software
882
- * distributed under the License is distributed on an "AS IS" BASIS,
883
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
884
- * See the License for the specific language governing permissions and
885
- * limitations under the License.
886
- */class Gs{constructor(t){this.count=parseInt(Math.log(t+1)/Ks,10),this.current_=this.count-1;const n=parseInt(Array(this.count+1).join("1"),2);this.bits_=t+1&n}nextBitIsOne(){const t=!(this.bits_&1<<this.current_);return this.current_--,t}}const Xs=function(t,n,e,i){t.sort(n);const r=function(n,i){const s=i-n;let o,u;if(0===s)return null;if(1===s)return o=t[n],u=e?e(o):o,new Ps(u,o.node,Ps.BLACK,null,null);{const h=parseInt(s/2,10)+n,c=r(n,h),a=r(h+1,i);return o=t[h],u=e?e(o):o,new Ps(u,o.node,Ps.BLACK,c,a)}},s=function(n){let i=null,s=null,o=t.length;const u=function(n,i){const s=o-n,u=o;o-=n;const c=r(s+1,u),a=t[s],l=e?e(a):a;h(new Ps(l,a.node,i,null,c))},h=function(t){i?(i.left=t,i=t):(s=t,i=t)};for(let t=0;t<n.count;++t){const e=n.nextBitIsOne(),i=Math.pow(2,n.count-(t+1));e?u(i,Ps.BLACK):(u(i,Ps.BLACK),u(i,Ps.RED))}return s}(new Gs(t.length));return new Ls(i||n,s)};
887
- /**
888
- * @license
889
- * Copyright 2017 Google LLC
890
- *
891
- * Licensed under the Apache License, Version 2.0 (the "License");
892
- * you may not use this file except in compliance with the License.
893
- * You may obtain a copy of the License at
894
- *
895
- * http://www.apache.org/licenses/LICENSE-2.0
896
- *
897
- * Unless required by applicable law or agreed to in writing, software
898
- * distributed under the License is distributed on an "AS IS" BASIS,
899
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
900
- * See the License for the specific language governing permissions and
901
- * limitations under the License.
902
- */let Zs;const Qs={};class to{constructor(t,n){this.indexes_=t,this.indexSet_=n}static get Default(){return Pe(Qs&&Js,"ChildrenNode.ts has not been loaded"),Zs=Zs||new to({".priority":Qs},{".priority":Js}),Zs}get(t){const n=ri(this.indexes_,t);if(!n)throw new Error("No index defined for "+t);return n instanceof Ls?n:null}hasIndex(t){return ii(this.indexSet_,t.toString())}addIndex(t,n){Pe(t!==$s,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const e=[];let i=!1;const r=n.getIterator(Ds.Wrap);let s,o=r.getNext();for(;o;)i=i||t.isDefinedOn(o.node),e.push(o),o=r.getNext();s=i?Xs(e,t.getCompare()):Qs;const u=t.toString(),h=Object.assign({},this.indexSet_);h[u]=t;const c=Object.assign({},this.indexes_);return c[u]=s,new to(c,h)}addToIndexes(t,n){const e=oi(this.indexes_,((e,i)=>{const r=ri(this.indexSet_,i);if(Pe(r,"Missing index implementation for "+i),e===Qs){if(r.isDefinedOn(t.node)){const e=[],i=n.getIterator(Ds.Wrap);let s=i.getNext();for(;s;)s.name!==t.name&&e.push(s),s=i.getNext();return e.push(t),Xs(e,r.getCompare())}return Qs}{const i=n.get(t.name);let r=e;return i&&(r=r.remove(new Ds(t.name,i))),r.insert(t,t.node)}}));return new to(e,this.indexSet_)}removeFromIndexes(t,n){const e=oi(this.indexes_,(e=>{if(e===Qs)return e;{const i=n.get(t.name);return i?e.remove(new Ds(t.name,i)):e}}));return new to(e,this.indexSet_)}}
903
- /**
904
- * @license
905
- * Copyright 2017 Google LLC
906
- *
907
- * Licensed under the Apache License, Version 2.0 (the "License");
908
- * you may not use this file except in compliance with the License.
909
- * You may obtain a copy of the License at
910
- *
911
- * http://www.apache.org/licenses/LICENSE-2.0
912
- *
913
- * Unless required by applicable law or agreed to in writing, software
914
- * distributed under the License is distributed on an "AS IS" BASIS,
915
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
916
- * See the License for the specific language governing permissions and
917
- * limitations under the License.
918
- */let no;class eo{constructor(t,n,e){this.children_=t,this.priorityNode_=n,this.indexMap_=e,this.lazyHash_=null,this.priorityNode_&&Ws(this.priorityNode_),this.children_.isEmpty()&&Pe(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return no||(no=new eo(new Ls(Fs),null,to.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||no}updatePriority(t){return this.children_.isEmpty()?this:new eo(this.children_,t,this.indexMap_)}getImmediateChild(t){if(".priority"===t)return this.getPriority();{const n=this.children_.get(t);return null===n?no:n}}getChild(t){const n=ds(t);return null===n?this:this.getImmediateChild(n).getChild(ms(t))}hasChild(t){return null!==this.children_.get(t)}updateImmediateChild(t,n){if(Pe(n,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(n);{const e=new Ds(t,n);let i,r;n.isEmpty()?(i=this.children_.remove(t),r=this.indexMap_.removeFromIndexes(e,this.children_)):(i=this.children_.insert(t,n),r=this.indexMap_.addToIndexes(e,this.children_));const s=i.isEmpty()?no:this.priorityNode_;return new eo(i,s,r)}}updateChild(t,n){const e=ds(t);if(null===e)return n;{Pe(".priority"!==ds(t)||1===ps(t),".priority must be the last token in a path");const i=this.getImmediateChild(e).updateChild(ms(t),n);return this.updateImmediateChild(e,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const n={};let e=0,i=0,r=!0;if(this.forEachChild(Js,((s,o)=>{n[s]=o.val(t),e++,r&&eo.INTEGER_REGEXP_.test(s)?i=Math.max(i,Number(s)):r=!1})),!t&&r&&i<2*e){const t=[];for(const e in n)t[e]=n[e];return t}return t&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n}hash(){if(null===this.lazyHash_){let t="";this.getPriority().isEmpty()||(t+="priority:"+qs(this.getPriority().val())+":"),this.forEachChild(Js,((n,e)=>{const i=e.hash();""!==i&&(t+=":"+n+":"+i)})),this.lazyHash_=""===t?"":gr(t)}return this.lazyHash_}getPredecessorChildName(t,n,e){const i=this.resolveIndex_(e);if(i){const e=i.getPredecessorKey(new Ds(t,n));return e?e.name:null}return this.children_.getPredecessorKey(t)}getFirstChildName(t){const n=this.resolveIndex_(t);if(n){const t=n.minKey();return t&&t.name}return this.children_.minKey()}getFirstChild(t){const n=this.getFirstChildName(t);return n?new Ds(n,this.children_.get(n)):null}getLastChildName(t){const n=this.resolveIndex_(t);if(n){const t=n.maxKey();return t&&t.name}return this.children_.maxKey()}getLastChild(t){const n=this.getLastChildName(t);return n?new Ds(n,this.children_.get(n)):null}forEachChild(t,n){const e=this.resolveIndex_(t);return e?e.inorderTraversal((t=>n(t.name,t.node))):this.children_.inorderTraversal(n)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,n){const e=this.resolveIndex_(n);if(e)return e.getIteratorFrom(t,(t=>t));{const e=this.children_.getIteratorFrom(t.name,Ds.Wrap);let i=e.peek();for(;null!=i&&n.compare(i,t)<0;)e.getNext(),i=e.peek();return e}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,n){const e=this.resolveIndex_(n);if(e)return e.getReverseIteratorFrom(t,(t=>t));{const e=this.children_.getReverseIteratorFrom(t.name,Ds.Wrap);let i=e.peek();for(;null!=i&&n.compare(i,t)>0;)e.getNext(),i=e.peek();return e}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===io?-1:0}withIndex(t){if(t===$s||this.indexMap_.hasIndex(t))return this;{const n=this.indexMap_.addIndex(t,this.children_);return new eo(this.children_,this.priorityNode_,n)}}isIndexed(t){return t===$s||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const n=t;if(this.getPriority().equals(n.getPriority())){if(this.children_.count()===n.children_.count()){const t=this.getIterator(Js),e=n.getIterator(Js);let i=t.getNext(),r=e.getNext();for(;i&&r;){if(i.name!==r.name||!i.node.equals(r.node))return!1;i=t.getNext(),r=e.getNext()}return null===i&&null===r}return!1}return!1}}resolveIndex_(t){return t===$s?null:this.indexMap_.get(t.toString())}}eo.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;const io=new class extends eo{constructor(){super(new Ls(Fs),eo.EMPTY_NODE,to.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return eo.EMPTY_NODE}isEmpty(){return!1}};function ro(t,n=null){if(null===t)return eo.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(n=t[".priority"]),Pe(null===n||"string"==typeof n||"number"==typeof n||"object"==typeof n&&".sv"in n,"Invalid priority type found: "+typeof n),"object"==typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!=typeof t||".sv"in t)return new Ys(t,ro(n));if(t instanceof Array){let e=eo.EMPTY_NODE;return $r(t,((n,i)=>{if(ii(t,n)&&"."!==n.substring(0,1)){const t=ro(i);!t.isLeafNode()&&t.isEmpty()||(e=e.updateImmediateChild(n,t))}})),e.updatePriority(ro(n))}{const e=[];let i=!1;if($r(t,((t,n)=>{if("."!==t.substring(0,1)){const r=ro(n);r.isEmpty()||(i=i||!r.getPriority().isEmpty(),e.push(new Ds(t,r)))}})),0===e.length)return eo.EMPTY_NODE;const r=Xs(e,Us,(t=>t.name),Fs);if(i){const t=Xs(e,Js.getCompare());return new eo(r,ro(n),new to({".priority":t},{".priority":Js}))}return new eo(r,ro(n),to.Default)}}Object.defineProperties(Ds,{MIN:{value:new Ds(Or,eo.EMPTY_NODE)},MAX:{value:new Ds(Mr,io)}}),Rs.__EMPTY_NODE=eo.EMPTY_NODE,Ys.__childrenNodeConstructor=eo,Bs=io,Vs=io,zs=ro;
919
- /**
920
- * @license
921
- * Copyright 2017 Google LLC
922
- *
923
- * Licensed under the Apache License, Version 2.0 (the "License");
924
- * you may not use this file except in compliance with the License.
925
- * You may obtain a copy of the License at
926
- *
927
- * http://www.apache.org/licenses/LICENSE-2.0
928
- *
929
- * Unless required by applicable law or agreed to in writing, software
930
- * distributed under the License is distributed on an "AS IS" BASIS,
931
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
932
- * See the License for the specific language governing permissions and
933
- * limitations under the License.
934
- */
935
- class so extends Ns{constructor(t){super(),this.indexPath_=t,Pe(!bs(t)&&".priority"!==ds(t),"Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,n){const e=this.extractChild(t.node),i=this.extractChild(n.node),r=e.compareTo(i);return 0===r?Tr(t.name,n.name):r}makePost(t,n){const e=ro(t),i=eo.EMPTY_NODE.updateChild(this.indexPath_,e);return new Ds(n,i)}maxPost(){const t=eo.EMPTY_NODE.updateChild(this.indexPath_,io);return new Ds(Mr,t)}toString(){return vs(this.indexPath_,0).join("/")}}
936
- /**
937
- * @license
938
- * Copyright 2017 Google LLC
939
- *
940
- * Licensed under the Apache License, Version 2.0 (the "License");
941
- * you may not use this file except in compliance with the License.
942
- * You may obtain a copy of the License at
943
- *
944
- * http://www.apache.org/licenses/LICENSE-2.0
945
- *
946
- * Unless required by applicable law or agreed to in writing, software
947
- * distributed under the License is distributed on an "AS IS" BASIS,
948
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
949
- * See the License for the specific language governing permissions and
950
- * limitations under the License.
951
- */const oo=new class extends Ns{compare(t,n){const e=t.node.compareTo(n.node);return 0===e?Tr(t.name,n.name):e}isDefinedOn(t){return!0}indexedValueChanged(t,n){return!t.equals(n)}minPost(){return Ds.MIN}maxPost(){return Ds.MAX}makePost(t,n){const e=ro(t);return new Ds(n,e)}toString(){return".value"}};
952
- /**
953
- * @license
954
- * Copyright 2017 Google LLC
955
- *
956
- * Licensed under the Apache License, Version 2.0 (the "License");
957
- * you may not use this file except in compliance with the License.
958
- * You may obtain a copy of the License at
959
- *
960
- * http://www.apache.org/licenses/LICENSE-2.0
961
- *
962
- * Unless required by applicable law or agreed to in writing, software
963
- * distributed under the License is distributed on an "AS IS" BASIS,
964
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
965
- * See the License for the specific language governing permissions and
966
- * limitations under the License.
967
- */function uo(t){return{type:"value",snapshotNode:t}}function ho(t,n){return{type:"child_added",snapshotNode:n,childName:t}}function co(t,n){return{type:"child_removed",snapshotNode:n,childName:t}}function ao(t,n,e){return{type:"child_changed",snapshotNode:n,childName:t,oldSnap:e}}
968
- /**
969
- * @license
970
- * Copyright 2017 Google LLC
971
- *
972
- * Licensed under the Apache License, Version 2.0 (the "License");
973
- * you may not use this file except in compliance with the License.
974
- * You may obtain a copy of the License at
975
- *
976
- * http://www.apache.org/licenses/LICENSE-2.0
977
- *
978
- * Unless required by applicable law or agreed to in writing, software
979
- * distributed under the License is distributed on an "AS IS" BASIS,
980
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
981
- * See the License for the specific language governing permissions and
982
- * limitations under the License.
983
- */
984
- class lo{constructor(t){this.index_=t}updateChild(t,n,e,i,r,s){Pe(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");const o=t.getImmediateChild(n);return o.getChild(i).equals(e.getChild(i))&&o.isEmpty()===e.isEmpty()?t:(null!=s&&(e.isEmpty()?t.hasChild(n)?s.trackChildChange(co(n,o)):Pe(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):o.isEmpty()?s.trackChildChange(ho(n,e)):s.trackChildChange(ao(n,e,o))),t.isLeafNode()&&e.isEmpty()?t:t.updateImmediateChild(n,e).withIndex(this.index_))}updateFullNode(t,n,e){return null!=e&&(t.isLeafNode()||t.forEachChild(Js,((t,i)=>{n.hasChild(t)||e.trackChildChange(co(t,i))})),n.isLeafNode()||n.forEachChild(Js,((n,i)=>{if(t.hasChild(n)){const r=t.getImmediateChild(n);r.equals(i)||e.trackChildChange(ao(n,i,r))}else e.trackChildChange(ho(n,i))}))),n.withIndex(this.index_)}updatePriority(t,n){return t.isEmpty()?eo.EMPTY_NODE:t.updatePriority(n)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}
985
- /**
986
- * @license
987
- * Copyright 2017 Google LLC
988
- *
989
- * Licensed under the Apache License, Version 2.0 (the "License");
990
- * you may not use this file except in compliance with the License.
991
- * You may obtain a copy of the License at
992
- *
993
- * http://www.apache.org/licenses/LICENSE-2.0
994
- *
995
- * Unless required by applicable law or agreed to in writing, software
996
- * distributed under the License is distributed on an "AS IS" BASIS,
997
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
998
- * See the License for the specific language governing permissions and
999
- * limitations under the License.
1000
- */class fo{constructor(t){this.indexedFilter_=new lo(t.getIndex()),this.index_=t.getIndex(),this.startPost_=fo.getStartPost_(t),this.endPost_=fo.getEndPost_(t),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(t){const n=this.startIsInclusive_?this.index_.compare(this.getStartPost(),t)<=0:this.index_.compare(this.getStartPost(),t)<0,e=this.endIsInclusive_?this.index_.compare(t,this.getEndPost())<=0:this.index_.compare(t,this.getEndPost())<0;return n&&e}updateChild(t,n,e,i,r,s){return this.matches(new Ds(n,e))||(e=eo.EMPTY_NODE),this.indexedFilter_.updateChild(t,n,e,i,r,s)}updateFullNode(t,n,e){n.isLeafNode()&&(n=eo.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(eo.EMPTY_NODE);const r=this;return n.forEachChild(Js,((t,n)=>{r.matches(new Ds(t,n))||(i=i.updateImmediateChild(t,eo.EMPTY_NODE))})),this.indexedFilter_.updateFullNode(t,i,e)}updatePriority(t,n){return t}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(t){if(t.hasStart()){const n=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),n)}return t.getIndex().minPost()}static getEndPost_(t){if(t.hasEnd()){const n=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),n)}return t.getIndex().maxPost()}}
1001
- /**
1002
- * @license
1003
- * Copyright 2017 Google LLC
1004
- *
1005
- * Licensed under the Apache License, Version 2.0 (the "License");
1006
- * you may not use this file except in compliance with the License.
1007
- * You may obtain a copy of the License at
1008
- *
1009
- * http://www.apache.org/licenses/LICENSE-2.0
1010
- *
1011
- * Unless required by applicable law or agreed to in writing, software
1012
- * distributed under the License is distributed on an "AS IS" BASIS,
1013
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1014
- * See the License for the specific language governing permissions and
1015
- * limitations under the License.
1016
- */class po{constructor(t){this.withinDirectionalStart=t=>this.reverse_?this.withinEndPost(t):this.withinStartPost(t),this.withinDirectionalEnd=t=>this.reverse_?this.withinStartPost(t):this.withinEndPost(t),this.withinStartPost=t=>{const n=this.index_.compare(this.rangedFilter_.getStartPost(),t);return this.startIsInclusive_?n<=0:n<0},this.withinEndPost=t=>{const n=this.index_.compare(t,this.rangedFilter_.getEndPost());return this.endIsInclusive_?n<=0:n<0},this.rangedFilter_=new fo(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,n,e,i,r,s){return this.rangedFilter_.matches(new Ds(n,e))||(e=eo.EMPTY_NODE),t.getImmediateChild(n).equals(e)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,n,e,i,r,s):this.fullLimitUpdateChild_(t,n,e,r,s)}updateFullNode(t,n,e){let i;if(n.isLeafNode()||n.isEmpty())i=eo.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<n.numChildren()&&n.isIndexed(this.index_)){let t;i=eo.EMPTY_NODE.withIndex(this.index_),t=this.reverse_?n.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):n.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let e=0;for(;t.hasNext()&&e<this.limit_;){const n=t.getNext();if(this.withinDirectionalStart(n)){if(!this.withinDirectionalEnd(n))break;i=i.updateImmediateChild(n.name,n.node),e++}}}else{let t;i=n.withIndex(this.index_),i=i.updatePriority(eo.EMPTY_NODE),t=this.reverse_?i.getReverseIterator(this.index_):i.getIterator(this.index_);let e=0;for(;t.hasNext();){const n=t.getNext();e<this.limit_&&this.withinDirectionalStart(n)&&this.withinDirectionalEnd(n)?e++:i=i.updateImmediateChild(n.name,eo.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,i,e)}updatePriority(t,n){return t}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(t,n,e,i,r){let s;if(this.reverse_){const t=this.index_.getCompare();s=(n,e)=>t(e,n)}else s=this.index_.getCompare();const o=t;Pe(o.numChildren()===this.limit_,"");const u=new Ds(n,e),h=this.reverse_?o.getFirstChild(this.index_):o.getLastChild(this.index_),c=this.rangedFilter_.matches(u);if(o.hasChild(n)){const t=o.getImmediateChild(n);let a=i.getChildAfterChild(this.index_,h,this.reverse_);for(;null!=a&&(a.name===n||o.hasChild(a.name));)a=i.getChildAfterChild(this.index_,a,this.reverse_);const l=null==a?1:s(a,u);if(c&&!e.isEmpty()&&l>=0)return null!=r&&r.trackChildChange(ao(n,e,t)),o.updateImmediateChild(n,e);{null!=r&&r.trackChildChange(co(n,t));const e=o.updateImmediateChild(n,eo.EMPTY_NODE);return null!=a&&this.rangedFilter_.matches(a)?(null!=r&&r.trackChildChange(ho(a.name,a.node)),e.updateImmediateChild(a.name,a.node)):e}}return e.isEmpty()?t:c&&s(h,u)>=0?(null!=r&&(r.trackChildChange(co(h.name,h.node)),r.trackChildChange(ho(n,e))),o.updateImmediateChild(n,e).updateImmediateChild(h.name,eo.EMPTY_NODE)):t}}
1017
- /**
1018
- * @license
1019
- * Copyright 2017 Google LLC
1020
- *
1021
- * Licensed under the Apache License, Version 2.0 (the "License");
1022
- * you may not use this file except in compliance with the License.
1023
- * You may obtain a copy of the License at
1024
- *
1025
- * http://www.apache.org/licenses/LICENSE-2.0
1026
- *
1027
- * Unless required by applicable law or agreed to in writing, software
1028
- * distributed under the License is distributed on an "AS IS" BASIS,
1029
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1030
- * See the License for the specific language governing permissions and
1031
- * limitations under the License.
1032
- */class mo{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Js}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return Pe(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return Pe(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Or}hasEnd(){return this.endSet_}getIndexEndValue(){return Pe(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return Pe(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Mr}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return Pe(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Js}copy(){const t=new mo;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function wo(t){const n={};if(t.isDefault())return n;let e;if(t.index_===Js?e="$priority":t.index_===oo?e="$value":t.index_===$s?e="$key":(Pe(t.index_ instanceof so,"Unrecognized index type!"),e=t.index_.toString()),n.orderBy=ni(e),t.startSet_){const e=t.startAfterSet_?"startAfter":"startAt";n[e]=ni(t.indexStartValue_),t.startNameSet_&&(n[e]+=","+ni(t.indexStartName_))}if(t.endSet_){const e=t.endBeforeSet_?"endBefore":"endAt";n[e]=ni(t.indexEndValue_),t.endNameSet_&&(n[e]+=","+ni(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?n.limitToFirst=t.limit_:n.limitToLast=t.limit_),n}function vo(t){const n={};if(t.startSet_&&(n.sp=t.indexStartValue_,t.startNameSet_&&(n.sn=t.indexStartName_),n.sin=!t.startAfterSet_),t.endSet_&&(n.ep=t.indexEndValue_,t.endNameSet_&&(n.en=t.indexEndName_),n.ein=!t.endBeforeSet_),t.limitSet_){n.l=t.limit_;let e=t.viewFrom_;""===e&&(e=t.isViewFromLeft()?"l":"r"),n.vf=e}return t.index_!==Js&&(n.i=t.index_.toString()),n}
1033
- /**
1034
- * @license
1035
- * Copyright 2017 Google LLC
1036
- *
1037
- * Licensed under the Apache License, Version 2.0 (the "License");
1038
- * you may not use this file except in compliance with the License.
1039
- * You may obtain a copy of the License at
1040
- *
1041
- * http://www.apache.org/licenses/LICENSE-2.0
1042
- *
1043
- * Unless required by applicable law or agreed to in writing, software
1044
- * distributed under the License is distributed on an "AS IS" BASIS,
1045
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1046
- * See the License for the specific language governing permissions and
1047
- * limitations under the License.
1048
- */class go extends hs{constructor(t,n,e,i){super(),this.repoInfo_=t,this.onDataUpdate_=n,this.authTokenProvider_=e,this.appCheckTokenProvider_=i,this.log_=Er("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,n){return void 0!==n?"tag$"+n:(Pe(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}listen(t,n,e,i){const r=t._path.toString();this.log_("Listen called for "+r+" "+t._queryIdentifier);const s=go.getListenId_(t,e),o={};this.listens_[s]=o;const u=wo(t._queryParams);this.restRequest_(r+".json",u,((t,n)=>{let u=n;if(404===t&&(u=null,t=null),null===t&&this.onDataUpdate_(r,u,!1,e),ri(this.listens_,s)===o){let n;n=t?401===t?"permission_denied":"rest_error:"+t:"ok",i(n,null)}}))}unlisten(t,n){const e=go.getListenId_(t,n);delete this.listens_[e]}get(t){const n=wo(t._queryParams),e=t._path.toString(),i=new Ke;return this.restRequest_(e+".json",n,((t,n)=>{let r=n;404===t&&(r=null,t=null),null===t?(this.onDataUpdate_(e,r,!1,null),i.resolve(r)):i.reject(new Error(r))})),i.promise}refreshAuthToken(t){}restRequest_(t,n={},e){return n.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then((([i,r])=>{i&&i.accessToken&&(n.auth=i.accessToken),r&&r.token&&(n.ac=r.token);const s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+function(t){const n=[];for(const[e,i]of Object.entries(t))Array.isArray(i)?i.forEach((t=>{n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))})):n.push(encodeURIComponent(e)+"="+encodeURIComponent(i));return n.length?"&"+n.join("&"):""}(n);this.log_("Sending REST request for "+s);const o=new XMLHttpRequest;o.onreadystatechange=()=>{if(e&&4===o.readyState){this.log_("REST Response for "+s+" received. status:",o.status,"response:",o.responseText);let t=null;if(o.status>=200&&o.status<300){try{t=ti(o.responseText)}catch(t){Cr("Failed to parse JSON response for "+s+": "+o.responseText)}e(null,t)}else 401!==o.status&&404!==o.status&&Cr("Got unsuccessful REST response for "+s+" Status: "+o.status),e(o.status);e=null}},o.open("GET",s,!0),o.send()}))}}
1049
- /**
1050
- * @license
1051
- * Copyright 2017 Google LLC
1052
- *
1053
- * Licensed under the Apache License, Version 2.0 (the "License");
1054
- * you may not use this file except in compliance with the License.
1055
- * You may obtain a copy of the License at
1056
- *
1057
- * http://www.apache.org/licenses/LICENSE-2.0
1058
- *
1059
- * Unless required by applicable law or agreed to in writing, software
1060
- * distributed under the License is distributed on an "AS IS" BASIS,
1061
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1062
- * See the License for the specific language governing permissions and
1063
- * limitations under the License.
1064
- */class yo{constructor(){this.rootNode_=eo.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,n){this.rootNode_=this.rootNode_.updateChild(t,n)}}
1065
- /**
1066
- * @license
1067
- * Copyright 2017 Google LLC
1068
- *
1069
- * Licensed under the Apache License, Version 2.0 (the "License");
1070
- * you may not use this file except in compliance with the License.
1071
- * You may obtain a copy of the License at
1072
- *
1073
- * http://www.apache.org/licenses/LICENSE-2.0
1074
- *
1075
- * Unless required by applicable law or agreed to in writing, software
1076
- * distributed under the License is distributed on an "AS IS" BASIS,
1077
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1078
- * See the License for the specific language governing permissions and
1079
- * limitations under the License.
1080
- */function bo(){return{value:null,children:new Map}}function _o(t,n,e){if(bs(n))t.value=e,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(n,e);else{const i=ds(n);t.children.has(i)||t.children.set(i,bo()),_o(t.children.get(i),n=ms(n),e)}}function So(t,n,e){null!==t.value?e(n,t.value):function(t,n){t.children.forEach(((t,e)=>{n(e,t)}))}
1081
- /**
1082
- * @license
1083
- * Copyright 2017 Google LLC
1084
- *
1085
- * Licensed under the Apache License, Version 2.0 (the "License");
1086
- * you may not use this file except in compliance with the License.
1087
- * You may obtain a copy of the License at
1088
- *
1089
- * http://www.apache.org/licenses/LICENSE-2.0
1090
- *
1091
- * Unless required by applicable law or agreed to in writing, software
1092
- * distributed under the License is distributed on an "AS IS" BASIS,
1093
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1094
- * See the License for the specific language governing permissions and
1095
- * limitations under the License.
1096
- */(t,((t,i)=>{So(i,new ls(n.toString()+"/"+t),e)}))}class Eo{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),n=Object.assign({},t);return this.last_&&$r(this.last_,((t,e)=>{n[t]=n[t]-e})),this.last_=t,n}}
1097
- /**
1098
- * @license
1099
- * Copyright 2017 Google LLC
1100
- *
1101
- * Licensed under the Apache License, Version 2.0 (the "License");
1102
- * you may not use this file except in compliance with the License.
1103
- * You may obtain a copy of the License at
1104
- *
1105
- * http://www.apache.org/licenses/LICENSE-2.0
1106
- *
1107
- * Unless required by applicable law or agreed to in writing, software
1108
- * distributed under the License is distributed on an "AS IS" BASIS,
1109
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1110
- * See the License for the specific language governing permissions and
1111
- * limitations under the License.
1112
- */class Io{constructor(t,n){this.server_=n,this.statsToReport_={},this.statsListener_=new Eo(t);const e=1e4+2e4*Math.random();Fr(this.reportStats_.bind(this),Math.floor(e))}reportStats_(){const t=this.statsListener_.get(),n={};let e=!1;$r(t,((t,i)=>{i>0&&ii(this.statsToReport_,t)&&(n[t]=i,e=!0)})),e&&this.server_.reportStats(n),Fr(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}
1113
- /**
1114
- * @license
1115
- * Copyright 2017 Google LLC
1116
- *
1117
- * Licensed under the Apache License, Version 2.0 (the "License");
1118
- * you may not use this file except in compliance with the License.
1119
- * You may obtain a copy of the License at
1120
- *
1121
- * http://www.apache.org/licenses/LICENSE-2.0
1122
- *
1123
- * Unless required by applicable law or agreed to in writing, software
1124
- * distributed under the License is distributed on an "AS IS" BASIS,
1125
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1126
- * See the License for the specific language governing permissions and
1127
- * limitations under the License.
1128
- */var ko;function Co(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}
1129
- /**
1130
- * @license
1131
- * Copyright 2017 Google LLC
1132
- *
1133
- * Licensed under the Apache License, Version 2.0 (the "License");
1134
- * you may not use this file except in compliance with the License.
1135
- * You may obtain a copy of the License at
1136
- *
1137
- * http://www.apache.org/licenses/LICENSE-2.0
1138
- *
1139
- * Unless required by applicable law or agreed to in writing, software
1140
- * distributed under the License is distributed on an "AS IS" BASIS,
1141
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1142
- * See the License for the specific language governing permissions and
1143
- * limitations under the License.
1144
- */!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(ko||(ko={}));class jo{constructor(t,n,e){this.path=t,this.affectedTree=n,this.revert=e,this.type=ko.ACK_USER_WRITE,this.source={fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}operationForChild(t){if(bs(this.path)){if(null!=this.affectedTree.value)return Pe(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const n=this.affectedTree.subtree(new ls(t));return new jo(fs(),n,this.revert)}}return Pe(ds(this.path)===t,"operationForChild called for unrelated child."),new jo(ms(this.path),this.affectedTree,this.revert)}}
1145
- /**
1146
- * @license
1147
- * Copyright 2017 Google LLC
1148
- *
1149
- * Licensed under the Apache License, Version 2.0 (the "License");
1150
- * you may not use this file except in compliance with the License.
1151
- * You may obtain a copy of the License at
1152
- *
1153
- * http://www.apache.org/licenses/LICENSE-2.0
1154
- *
1155
- * Unless required by applicable law or agreed to in writing, software
1156
- * distributed under the License is distributed on an "AS IS" BASIS,
1157
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1158
- * See the License for the specific language governing permissions and
1159
- * limitations under the License.
1160
- */class Oo{constructor(t,n){this.source=t,this.path=n,this.type=ko.LISTEN_COMPLETE}operationForChild(t){return bs(this.path)?new Oo(this.source,fs()):new Oo(this.source,ms(this.path))}}
1161
- /**
1162
- * @license
1163
- * Copyright 2017 Google LLC
1164
- *
1165
- * Licensed under the Apache License, Version 2.0 (the "License");
1166
- * you may not use this file except in compliance with the License.
1167
- * You may obtain a copy of the License at
1168
- *
1169
- * http://www.apache.org/licenses/LICENSE-2.0
1170
- *
1171
- * Unless required by applicable law or agreed to in writing, software
1172
- * distributed under the License is distributed on an "AS IS" BASIS,
1173
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1174
- * See the License for the specific language governing permissions and
1175
- * limitations under the License.
1176
- */class Mo{constructor(t,n,e){this.source=t,this.path=n,this.snap=e,this.type=ko.OVERWRITE}operationForChild(t){return bs(this.path)?new Mo(this.source,fs(),this.snap.getImmediateChild(t)):new Mo(this.source,ms(this.path),this.snap)}}
1177
- /**
1178
- * @license
1179
- * Copyright 2017 Google LLC
1180
- *
1181
- * Licensed under the Apache License, Version 2.0 (the "License");
1182
- * you may not use this file except in compliance with the License.
1183
- * You may obtain a copy of the License at
1184
- *
1185
- * http://www.apache.org/licenses/LICENSE-2.0
1186
- *
1187
- * Unless required by applicable law or agreed to in writing, software
1188
- * distributed under the License is distributed on an "AS IS" BASIS,
1189
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1190
- * See the License for the specific language governing permissions and
1191
- * limitations under the License.
1192
- */class To{constructor(t,n,e){this.source=t,this.path=n,this.children=e,this.type=ko.MERGE}operationForChild(t){if(bs(this.path)){const n=this.children.subtree(new ls(t));return n.isEmpty()?null:n.value?new Mo(this.source,fs(),n.value):new To(this.source,fs(),n)}return Pe(ds(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new To(this.source,ms(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}
1193
- /**
1194
- * @license
1195
- * Copyright 2017 Google LLC
1196
- *
1197
- * Licensed under the Apache License, Version 2.0 (the "License");
1198
- * you may not use this file except in compliance with the License.
1199
- * You may obtain a copy of the License at
1200
- *
1201
- * http://www.apache.org/licenses/LICENSE-2.0
1202
- *
1203
- * Unless required by applicable law or agreed to in writing, software
1204
- * distributed under the License is distributed on an "AS IS" BASIS,
1205
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1206
- * See the License for the specific language governing permissions and
1207
- * limitations under the License.
1208
- */class Do{constructor(t,n,e){this.node_=t,this.fullyInitialized_=n,this.filtered_=e}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(bs(t))return this.isFullyInitialized()&&!this.filtered_;const n=ds(t);return this.isCompleteForChild(n)}isCompleteForChild(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)}getNode(){return this.node_}}
1209
- /**
1210
- * @license
1211
- * Copyright 2017 Google LLC
1212
- *
1213
- * Licensed under the Apache License, Version 2.0 (the "License");
1214
- * you may not use this file except in compliance with the License.
1215
- * You may obtain a copy of the License at
1216
- *
1217
- * http://www.apache.org/licenses/LICENSE-2.0
1218
- *
1219
- * Unless required by applicable law or agreed to in writing, software
1220
- * distributed under the License is distributed on an "AS IS" BASIS,
1221
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1222
- * See the License for the specific language governing permissions and
1223
- * limitations under the License.
1224
- */class No{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function Ao(t,n,e,i,r,s){const o=i.filter((t=>t.type===e));o.sort(((n,e)=>function(t,n,e){if(null==n.childName||null==e.childName)throw Le("Should only compare child_ events.");const i=new Ds(n.childName,n.snapshotNode),r=new Ds(e.childName,e.snapshotNode);return t.index_.compare(i,r)}
1225
- /**
1226
- * @license
1227
- * Copyright 2017 Google LLC
1228
- *
1229
- * Licensed under the Apache License, Version 2.0 (the "License");
1230
- * you may not use this file except in compliance with the License.
1231
- * You may obtain a copy of the License at
1232
- *
1233
- * http://www.apache.org/licenses/LICENSE-2.0
1234
- *
1235
- * Unless required by applicable law or agreed to in writing, software
1236
- * distributed under the License is distributed on an "AS IS" BASIS,
1237
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1238
- * See the License for the specific language governing permissions and
1239
- * limitations under the License.
1240
- */(t,n,e))),o.forEach((e=>{const i=function(t,n,e){return"value"===n.type||"child_removed"===n.type||(n.prevName=e.getPredecessorChildName(n.childName,n.snapshotNode,t.index_)),n}(t,e,s);r.forEach((r=>{r.respondsTo(e.type)&&n.push(r.createEvent(i,t.query_))}))}))}function Ro(t,n){return{eventCache:t,serverCache:n}}function $o(t,n,e,i){return Ro(new Do(n,e,i),t.serverCache)}function xo(t,n,e,i){return Ro(t.eventCache,new Do(n,e,i))}function Po(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Lo(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}
1241
- /**
1242
- * @license
1243
- * Copyright 2017 Google LLC
1244
- *
1245
- * Licensed under the Apache License, Version 2.0 (the "License");
1246
- * you may not use this file except in compliance with the License.
1247
- * You may obtain a copy of the License at
1248
- *
1249
- * http://www.apache.org/licenses/LICENSE-2.0
1250
- *
1251
- * Unless required by applicable law or agreed to in writing, software
1252
- * distributed under the License is distributed on an "AS IS" BASIS,
1253
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
- * See the License for the specific language governing permissions and
1255
- * limitations under the License.
1256
- */let Uo;class Fo{constructor(t,n=(()=>(Uo||(Uo=new Ls(Dr)),Uo))()){this.value=t,this.children=n}static fromObject(t){let n=new Fo(null);return $r(t,((t,e)=>{n=n.set(new ls(t),e)})),n}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,n){if(null!=this.value&&n(this.value))return{path:fs(),value:this.value};if(bs(t))return null;{const e=ds(t),i=this.children.get(e);if(null!==i){const r=i.findRootMostMatchingPathAndValue(ms(t),n);return null!=r?{path:ys(new ls(e),r.path),value:r.value}:null}return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,(()=>!0))}subtree(t){if(bs(t))return this;{const n=ds(t),e=this.children.get(n);return null!==e?e.subtree(ms(t)):new Fo(null)}}set(t,n){if(bs(t))return new Fo(n,this.children);{const e=ds(t),i=(this.children.get(e)||new Fo(null)).set(ms(t),n),r=this.children.insert(e,i);return new Fo(this.value,r)}}remove(t){if(bs(t))return this.children.isEmpty()?new Fo(null):new Fo(null,this.children);{const n=ds(t),e=this.children.get(n);if(e){const i=e.remove(ms(t));let r;return r=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&r.isEmpty()?new Fo(null):new Fo(this.value,r)}return this}}get(t){if(bs(t))return this.value;{const n=ds(t),e=this.children.get(n);return e?e.get(ms(t)):null}}setTree(t,n){if(bs(t))return n;{const e=ds(t),i=(this.children.get(e)||new Fo(null)).setTree(ms(t),n);let r;return r=i.isEmpty()?this.children.remove(e):this.children.insert(e,i),new Fo(this.value,r)}}fold(t){return this.fold_(fs(),t)}fold_(t,n){const e={};return this.children.inorderTraversal(((i,r)=>{e[i]=r.fold_(ys(t,i),n)})),n(t,this.value,e)}findOnPath(t,n){return this.findOnPath_(t,fs(),n)}findOnPath_(t,n,e){const i=!!this.value&&e(n,this.value);if(i)return i;if(bs(t))return null;{const i=ds(t),r=this.children.get(i);return r?r.findOnPath_(ms(t),ys(n,i),e):null}}foreachOnPath(t,n){return this.foreachOnPath_(t,fs(),n)}foreachOnPath_(t,n,e){if(bs(t))return this;{this.value&&e(n,this.value);const i=ds(t),r=this.children.get(i);return r?r.foreachOnPath_(ms(t),ys(n,i),e):new Fo(null)}}foreach(t){this.foreach_(fs(),t)}foreach_(t,n){this.children.inorderTraversal(((e,i)=>{i.foreach_(ys(t,e),n)})),this.value&&n(t,this.value)}foreachChild(t){this.children.inorderTraversal(((n,e)=>{e.value&&t(n,e.value)}))}}
1257
- /**
1258
- * @license
1259
- * Copyright 2017 Google LLC
1260
- *
1261
- * Licensed under the Apache License, Version 2.0 (the "License");
1262
- * you may not use this file except in compliance with the License.
1263
- * You may obtain a copy of the License at
1264
- *
1265
- * http://www.apache.org/licenses/LICENSE-2.0
1266
- *
1267
- * Unless required by applicable law or agreed to in writing, software
1268
- * distributed under the License is distributed on an "AS IS" BASIS,
1269
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1270
- * See the License for the specific language governing permissions and
1271
- * limitations under the License.
1272
- */class Bo{constructor(t){this.writeTree_=t}static empty(){return new Bo(new Fo(null))}}function qo(t,n,e){if(bs(n))return new Bo(new Fo(e));{const i=t.writeTree_.findRootMostValueAndPath(n);if(null!=i){const r=i.path;let s=i.value;const o=_s(r,n);return s=s.updateChild(o,e),new Bo(t.writeTree_.set(r,s))}{const i=new Fo(e),r=t.writeTree_.setTree(n,i);return new Bo(r)}}}function Wo(t,n,e){let i=t;return $r(e,((t,e)=>{i=qo(i,ys(n,t),e)})),i}function Ho(t,n){if(bs(n))return Bo.empty();{const e=t.writeTree_.setTree(n,new Fo(null));return new Bo(e)}}function zo(t,n){return null!=Vo(t,n)}function Vo(t,n){const e=t.writeTree_.findRootMostValueAndPath(n);return null!=e?t.writeTree_.get(e.path).getChild(_s(e.path,n)):null}function Yo(t){const n=[],e=t.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Js,((t,e)=>{n.push(new Ds(t,e))})):t.writeTree_.children.inorderTraversal(((t,e)=>{null!=e.value&&n.push(new Ds(t,e.value))})),n}function Jo(t,n){if(bs(n))return t;{const e=Vo(t,n);return new Bo(null!=e?new Fo(e):t.writeTree_.subtree(n))}}function Ko(t){return t.writeTree_.isEmpty()}function Go(t,n){return Xo(fs(),t.writeTree_,n)}function Xo(t,n,e){if(null!=n.value)return e.updateChild(t,n.value);{let i=null;return n.children.inorderTraversal(((n,r)=>{".priority"===n?(Pe(null!==r.value,"Priority writes must always be leaf nodes"),i=r.value):e=Xo(ys(t,n),r,e)})),e.getChild(t).isEmpty()||null===i||(e=e.updateChild(ys(t,".priority"),i)),e}}
1273
- /**
1274
- * @license
1275
- * Copyright 2017 Google LLC
1276
- *
1277
- * Licensed under the Apache License, Version 2.0 (the "License");
1278
- * you may not use this file except in compliance with the License.
1279
- * You may obtain a copy of the License at
1280
- *
1281
- * http://www.apache.org/licenses/LICENSE-2.0
1282
- *
1283
- * Unless required by applicable law or agreed to in writing, software
1284
- * distributed under the License is distributed on an "AS IS" BASIS,
1285
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1286
- * See the License for the specific language governing permissions and
1287
- * limitations under the License.
1288
- */function Zo(t,n){return cu(n,t)}function Qo(t,n){if(t.snap)return Is(t.path,n);for(const e in t.children)if(t.children.hasOwnProperty(e)&&Is(ys(t.path,e),n))return!0;return!1}function tu(t){return t.visible}function nu(t,n,e){let i=Bo.empty();for(let r=0;r<t.length;++r){const s=t[r];if(n(s)){const t=s.path;let n;if(s.snap)Is(e,t)?(n=_s(e,t),i=qo(i,n,s.snap)):Is(t,e)&&(n=_s(t,e),i=qo(i,fs(),s.snap.getChild(n)));else{if(!s.children)throw Le("WriteRecord should have .snap or .children");if(Is(e,t))n=_s(e,t),i=Wo(i,n,s.children);else if(Is(t,e))if(n=_s(t,e),bs(n))i=Wo(i,fs(),s.children);else{const t=ri(s.children,ds(n));if(t){const e=t.getChild(ms(n));i=qo(i,fs(),e)}}}}}return i}function eu(t,n,e,i,r){if(i||r){const s=Jo(t.visibleWrites,n);return!r&&Ko(s)?e:r||null!=e||zo(s,fs())?Go(nu(t.allWrites,(function(t){return(t.visible||r)&&(!i||!~i.indexOf(t.writeId))&&(Is(t.path,n)||Is(n,t.path))}),n),e||eo.EMPTY_NODE):null}{const i=Vo(t.visibleWrites,n);if(null!=i)return i;{const i=Jo(t.visibleWrites,n);return Ko(i)?e:null!=e||zo(i,fs())?Go(i,e||eo.EMPTY_NODE):null}}}function iu(t,n,e,i){return eu(t.writeTree,t.treePath,n,e,i)}function ru(t,n){return function(t,n,e){let i=eo.EMPTY_NODE;const r=Vo(t.visibleWrites,n);if(r)return r.isLeafNode()||r.forEachChild(Js,((t,n)=>{i=i.updateImmediateChild(t,n)})),i;if(e){const r=Jo(t.visibleWrites,n);return e.forEachChild(Js,((t,n)=>{const e=Go(Jo(r,new ls(t)),n);i=i.updateImmediateChild(t,e)})),Yo(r).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}return Yo(Jo(t.visibleWrites,n)).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}(t.writeTree,t.treePath,n)}function su(t,n,e,i){return function(t,n,e,i,r){Pe(i||r,"Either existingEventSnap or existingServerSnap must exist");const s=ys(n,e);if(zo(t.visibleWrites,s))return null;{const n=Jo(t.visibleWrites,s);return Ko(n)?r.getChild(e):Go(n,r.getChild(e))}}(t.writeTree,t.treePath,n,e,i)}function ou(t,n){return function(t,n){return Vo(t.visibleWrites,n)}(t.writeTree,ys(t.treePath,n))}function uu(t,n,e){return function(t,n,e,i){const r=ys(n,e),s=Vo(t.visibleWrites,r);return null!=s?s:i.isCompleteForChild(e)?Go(Jo(t.visibleWrites,r),i.getNode().getImmediateChild(e)):null}(t.writeTree,t.treePath,n,e)}function hu(t,n){return cu(ys(t.treePath,n),t.writeTree)}function cu(t,n){return{treePath:t,writeTree:n}}
1289
- /**
1290
- * @license
1291
- * Copyright 2017 Google LLC
1292
- *
1293
- * Licensed under the Apache License, Version 2.0 (the "License");
1294
- * you may not use this file except in compliance with the License.
1295
- * You may obtain a copy of the License at
1296
- *
1297
- * http://www.apache.org/licenses/LICENSE-2.0
1298
- *
1299
- * Unless required by applicable law or agreed to in writing, software
1300
- * distributed under the License is distributed on an "AS IS" BASIS,
1301
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1302
- * See the License for the specific language governing permissions and
1303
- * limitations under the License.
1304
- */class au{constructor(){this.changeMap=new Map}trackChildChange(t){const n=t.type,e=t.childName;Pe("child_added"===n||"child_changed"===n||"child_removed"===n,"Only child changes supported for tracking"),Pe(".priority"!==e,"Only non-priority child changes can be tracked.");const i=this.changeMap.get(e);if(i){const r=i.type;if("child_added"===n&&"child_removed"===r)this.changeMap.set(e,ao(e,t.snapshotNode,i.snapshotNode));else if("child_removed"===n&&"child_added"===r)this.changeMap.delete(e);else if("child_removed"===n&&"child_changed"===r)this.changeMap.set(e,co(e,i.oldSnap));else if("child_changed"===n&&"child_added"===r)this.changeMap.set(e,ho(e,t.snapshotNode));else{if("child_changed"!==n||"child_changed"!==r)throw Le("Illegal combination of changes: "+t+" occurred after "+i);this.changeMap.set(e,ao(e,t.snapshotNode,i.oldSnap))}}else this.changeMap.set(e,t)}getChanges(){return Array.from(this.changeMap.values())}}
1305
- /**
1306
- * @license
1307
- * Copyright 2017 Google LLC
1308
- *
1309
- * Licensed under the Apache License, Version 2.0 (the "License");
1310
- * you may not use this file except in compliance with the License.
1311
- * You may obtain a copy of the License at
1312
- *
1313
- * http://www.apache.org/licenses/LICENSE-2.0
1314
- *
1315
- * Unless required by applicable law or agreed to in writing, software
1316
- * distributed under the License is distributed on an "AS IS" BASIS,
1317
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1318
- * See the License for the specific language governing permissions and
1319
- * limitations under the License.
1320
- */const lu=new class{getCompleteChild(t){return null}getChildAfterChild(t,n,e){return null}};class fu{constructor(t,n,e=null){this.writes_=t,this.viewCache_=n,this.optCompleteServerCache_=e}getCompleteChild(t){const n=this.viewCache_.eventCache;if(n.isCompleteForChild(t))return n.getNode().getImmediateChild(t);{const n=null!=this.optCompleteServerCache_?new Do(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return uu(this.writes_,t,n)}}getChildAfterChild(t,n,e){const i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:Lo(this.viewCache_),r=function(t,n,e,i,r,s){return function(t,n,e,i,r,s,o){let u;const h=Jo(t.visibleWrites,n),c=Vo(h,fs());if(null!=c)u=c;else{if(null==e)return[];u=Go(h,e)}if(u=u.withIndex(o),u.isEmpty()||u.isLeafNode())return[];{const t=[],n=o.getCompare(),e=s?u.getReverseIteratorFrom(i,o):u.getIteratorFrom(i,o);let h=e.getNext();for(;h&&t.length<r;)0!==n(h,i)&&t.push(h),h=e.getNext();return t}}(t.writeTree,t.treePath,n,e,i,r,s)}(this.writes_,i,n,1,e,t);return 0===r.length?null:r[0]}}
1321
- /**
1322
- * @license
1323
- * Copyright 2017 Google LLC
1324
- *
1325
- * Licensed under the Apache License, Version 2.0 (the "License");
1326
- * you may not use this file except in compliance with the License.
1327
- * You may obtain a copy of the License at
1328
- *
1329
- * http://www.apache.org/licenses/LICENSE-2.0
1330
- *
1331
- * Unless required by applicable law or agreed to in writing, software
1332
- * distributed under the License is distributed on an "AS IS" BASIS,
1333
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334
- * See the License for the specific language governing permissions and
1335
- * limitations under the License.
1336
- */function du(t,n,e,i,r,s){const o=n.eventCache;if(null!=ou(i,e))return n;{let u,h;if(bs(e))if(Pe(n.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),n.serverCache.isFiltered()){const e=Lo(n),r=ru(i,e instanceof eo?e:eo.EMPTY_NODE);u=t.filter.updateFullNode(n.eventCache.getNode(),r,s)}else{const e=iu(i,Lo(n));u=t.filter.updateFullNode(n.eventCache.getNode(),e,s)}else{const c=ds(e);if(".priority"===c){Pe(1===ps(e),"Can't have a priority with additional path components");const r=o.getNode();h=n.serverCache.getNode();const s=su(i,e,r,h);u=null!=s?t.filter.updatePriority(r,s):o.getNode()}else{const a=ms(e);let l;if(o.isCompleteForChild(c)){h=n.serverCache.getNode();const t=su(i,e,o.getNode(),h);l=null!=t?o.getNode().getImmediateChild(c).updateChild(a,t):o.getNode().getImmediateChild(c)}else l=uu(i,c,n.serverCache);u=null!=l?t.filter.updateChild(o.getNode(),c,l,a,r,s):o.getNode()}}return $o(n,u,o.isFullyInitialized()||bs(e),t.filter.filtersNodes())}}function pu(t,n,e,i,r,s,o,u){const h=n.serverCache;let c;const a=o?t.filter:t.filter.getIndexedFilter();if(bs(e))c=a.updateFullNode(h.getNode(),i,null);else if(a.filtersNodes()&&!h.isFiltered()){const t=h.getNode().updateChild(e,i);c=a.updateFullNode(h.getNode(),t,null)}else{const t=ds(e);if(!h.isCompleteForPath(e)&&ps(e)>1)return n;const r=ms(e),s=h.getNode().getImmediateChild(t).updateChild(r,i);c=".priority"===t?a.updatePriority(h.getNode(),s):a.updateChild(h.getNode(),t,s,r,lu,null)}const l=xo(n,c,h.isFullyInitialized()||bs(e),a.filtersNodes());return du(t,l,e,r,new fu(r,l,s),u)}function mu(t,n,e,i,r,s,o){const u=n.eventCache;let h,c;const a=new fu(r,n,s);if(bs(e))c=t.filter.updateFullNode(n.eventCache.getNode(),i,o),h=$o(n,c,!0,t.filter.filtersNodes());else{const r=ds(e);if(".priority"===r)c=t.filter.updatePriority(n.eventCache.getNode(),i),h=$o(n,c,u.isFullyInitialized(),u.isFiltered());else{const s=ms(e),c=u.getNode().getImmediateChild(r);let l;if(bs(s))l=i;else{const t=a.getCompleteChild(r);l=null!=t?".priority"===ws(s)&&t.getChild(gs(s)).isEmpty()?t:t.updateChild(s,i):eo.EMPTY_NODE}h=c.equals(l)?n:$o(n,t.filter.updateChild(u.getNode(),r,l,s,a,o),u.isFullyInitialized(),t.filter.filtersNodes())}}return h}function wu(t,n){return t.eventCache.isCompleteForChild(n)}function vu(t,n,e){return e.foreach(((t,e)=>{n=n.updateChild(t,e)})),n}function gu(t,n,e,i,r,s,o,u){if(n.serverCache.getNode().isEmpty()&&!n.serverCache.isFullyInitialized())return n;let h,c=n;h=bs(e)?i:new Fo(null).setTree(e,i);const a=n.serverCache.getNode();return h.children.inorderTraversal(((e,i)=>{if(a.hasChild(e)){const h=vu(0,n.serverCache.getNode().getImmediateChild(e),i);c=pu(t,c,new ls(e),h,r,s,o,u)}})),h.children.inorderTraversal(((e,i)=>{const h=!n.serverCache.isCompleteForChild(e)&&null===i.value;if(!a.hasChild(e)&&!h){const h=vu(0,n.serverCache.getNode().getImmediateChild(e),i);c=pu(t,c,new ls(e),h,r,s,o,u)}})),c}
1337
- /**
1338
- * @license
1339
- * Copyright 2017 Google LLC
1340
- *
1341
- * Licensed under the Apache License, Version 2.0 (the "License");
1342
- * you may not use this file except in compliance with the License.
1343
- * You may obtain a copy of the License at
1344
- *
1345
- * http://www.apache.org/licenses/LICENSE-2.0
1346
- *
1347
- * Unless required by applicable law or agreed to in writing, software
1348
- * distributed under the License is distributed on an "AS IS" BASIS,
1349
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1350
- * See the License for the specific language governing permissions and
1351
- * limitations under the License.
1352
- */
1353
- class yu{constructor(t,n){this.query_=t,this.eventRegistrations_=[];const e=this.query_._queryParams,i=new lo(e.getIndex()),r=(s=e).loadsAllData()?new lo(s.getIndex()):s.hasLimit()?new po(s):new fo(s);var s;this.processor_=function(t){return{filter:t}}(r);const o=n.serverCache,u=n.eventCache,h=i.updateFullNode(eo.EMPTY_NODE,o.getNode(),null),c=r.updateFullNode(eo.EMPTY_NODE,u.getNode(),null),a=new Do(h,o.isFullyInitialized(),i.filtersNodes()),l=new Do(c,u.isFullyInitialized(),r.filtersNodes());this.viewCache_=Ro(l,a),this.eventGenerator_=new No(this.query_)}get query(){return this.query_}}function bu(t,n){const e=Lo(t.viewCache_);return e&&(t.query._queryParams.loadsAllData()||!bs(n)&&!e.getImmediateChild(ds(n)).isEmpty())?e.getChild(n):null}function _u(t){return 0===t.eventRegistrations_.length}function Su(t,n,e){const i=[];if(e){Pe(null==n,"A cancel should cancel all event registrations.");const r=t.query._path;t.eventRegistrations_.forEach((t=>{const n=t.createCancelEvent(e,r);n&&i.push(n)}))}if(n){let e=[];for(let i=0;i<t.eventRegistrations_.length;++i){const r=t.eventRegistrations_[i];if(r.matches(n)){if(n.hasAnyCallback()){e=e.concat(t.eventRegistrations_.slice(i+1));break}}else e.push(r)}t.eventRegistrations_=e}else t.eventRegistrations_=[];return i}function Eu(t,n,e,i){n.type===ko.MERGE&&null!==n.source.queryId&&(Pe(Lo(t.viewCache_),"We should always have a full cache before handling merges"),Pe(Po(t.viewCache_),"Missing event cache, even though we have a server cache"));const r=t.viewCache_,s=function(t,n,e,i,r){const s=new au;let o,u;if(e.type===ko.OVERWRITE){const h=e;h.source.fromUser?o=mu(t,n,h.path,h.snap,i,r,s):(Pe(h.source.fromServer,"Unknown source."),u=h.source.tagged||n.serverCache.isFiltered()&&!bs(h.path),o=pu(t,n,h.path,h.snap,i,r,u,s))}else if(e.type===ko.MERGE){const h=e;h.source.fromUser?o=function(t,n,e,i,r,s,o){let u=n;return i.foreach(((i,h)=>{const c=ys(e,i);wu(n,ds(c))&&(u=mu(t,u,c,h,r,s,o))})),i.foreach(((i,h)=>{const c=ys(e,i);wu(n,ds(c))||(u=mu(t,u,c,h,r,s,o))})),u}(t,n,h.path,h.children,i,r,s):(Pe(h.source.fromServer,"Unknown source."),u=h.source.tagged||n.serverCache.isFiltered(),o=gu(t,n,h.path,h.children,i,r,u,s))}else if(e.type===ko.ACK_USER_WRITE){const u=e;o=u.revert?function(t,n,e,i,r,s){let o;if(null!=ou(i,e))return n;{const u=new fu(i,n,r),h=n.eventCache.getNode();let c;if(bs(e)||".priority"===ds(e)){let e;if(n.serverCache.isFullyInitialized())e=iu(i,Lo(n));else{const t=n.serverCache.getNode();Pe(t instanceof eo,"serverChildren would be complete if leaf node"),e=ru(i,t)}c=t.filter.updateFullNode(h,e,s)}else{const r=ds(e);let a=uu(i,r,n.serverCache);null==a&&n.serverCache.isCompleteForChild(r)&&(a=h.getImmediateChild(r)),c=null!=a?t.filter.updateChild(h,r,a,ms(e),u,s):n.eventCache.getNode().hasChild(r)?t.filter.updateChild(h,r,eo.EMPTY_NODE,ms(e),u,s):h,c.isEmpty()&&n.serverCache.isFullyInitialized()&&(o=iu(i,Lo(n)),o.isLeafNode()&&(c=t.filter.updateFullNode(c,o,s)))}return o=n.serverCache.isFullyInitialized()||null!=ou(i,fs()),$o(n,c,o,t.filter.filtersNodes())}}(t,n,u.path,i,r,s):function(t,n,e,i,r,s,o){if(null!=ou(r,e))return n;const u=n.serverCache.isFiltered(),h=n.serverCache;if(null!=i.value){if(bs(e)&&h.isFullyInitialized()||h.isCompleteForPath(e))return pu(t,n,e,h.getNode().getChild(e),r,s,u,o);if(bs(e)){let i=new Fo(null);return h.getNode().forEachChild($s,((t,n)=>{i=i.set(new ls(t),n)})),gu(t,n,e,i,r,s,u,o)}return n}{let c=new Fo(null);return i.foreach((t=>{const n=ys(e,t);h.isCompleteForPath(n)&&(c=c.set(t,h.getNode().getChild(n)))})),gu(t,n,e,c,r,s,u,o)}}(t,n,u.path,u.affectedTree,i,r,s)}else{if(e.type!==ko.LISTEN_COMPLETE)throw Le("Unknown operation type: "+e.type);o=function(t,n,e,i,r){const s=n.serverCache;return du(t,xo(n,s.getNode(),s.isFullyInitialized()||bs(e),s.isFiltered()),e,i,lu,r)}(t,n,e.path,i,s)}const h=s.getChanges();return function(t,n,e){const i=n.eventCache;if(i.isFullyInitialized()){const r=i.getNode().isLeafNode()||i.getNode().isEmpty(),s=Po(t);(e.length>0||!t.eventCache.isFullyInitialized()||r&&!i.getNode().equals(s)||!i.getNode().getPriority().equals(s.getPriority()))&&e.push(uo(Po(n)))}}(n,o,h),{viewCache:o,changes:h}}(t.processor_,r,n,e,i);var o,u;return o=t.processor_,Pe((u=s.viewCache).eventCache.getNode().isIndexed(o.filter.getIndex()),"Event snap not indexed"),Pe(u.serverCache.getNode().isIndexed(o.filter.getIndex()),"Server snap not indexed"),Pe(s.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,Iu(t,s.changes,s.viewCache.eventCache.getNode(),null)}function Iu(t,n,e,i){return function(t,n,e,i){const r=[],s=[];return n.forEach((n=>{"child_changed"===n.type&&t.index_.indexedValueChanged(n.oldSnap,n.snapshotNode)&&s.push({type:"child_moved",snapshotNode:n.snapshotNode,childName:n.childName})})),Ao(t,r,"child_removed",n,i,e),Ao(t,r,"child_added",n,i,e),Ao(t,r,"child_moved",s,i,e),Ao(t,r,"child_changed",n,i,e),Ao(t,r,"value",n,i,e),r}(t.eventGenerator_,n,e,i?[i]:t.eventRegistrations_)}
1354
- /**
1355
- * @license
1356
- * Copyright 2017 Google LLC
1357
- *
1358
- * Licensed under the Apache License, Version 2.0 (the "License");
1359
- * you may not use this file except in compliance with the License.
1360
- * You may obtain a copy of the License at
1361
- *
1362
- * http://www.apache.org/licenses/LICENSE-2.0
1363
- *
1364
- * Unless required by applicable law or agreed to in writing, software
1365
- * distributed under the License is distributed on an "AS IS" BASIS,
1366
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1367
- * See the License for the specific language governing permissions and
1368
- * limitations under the License.
1369
- */let ku,Cu;class ju{constructor(){this.views=new Map}}function Ou(t,n,e,i){const r=n.source.queryId;if(null!==r){const s=t.views.get(r);return Pe(null!=s,"SyncTree gave us an op for an invalid query."),Eu(s,n,e,i)}{let r=[];for(const s of t.views.values())r=r.concat(Eu(s,n,e,i));return r}}function Mu(t){const n=[];for(const e of t.views.values())e.query._queryParams.loadsAllData()||n.push(e);return n}function Tu(t,n){let e=null;for(const i of t.views.values())e=e||bu(i,n);return e}function Du(t,n){return n._queryParams.loadsAllData()?Ru(t):t.views.get(n._queryIdentifier)}function Nu(t,n){return null!=Du(t,n)}function Au(t){return null!=Ru(t)}function Ru(t){for(const n of t.views.values())if(n.query._queryParams.loadsAllData())return n;return null}
1370
- /**
1371
- * @license
1372
- * Copyright 2017 Google LLC
1373
- *
1374
- * Licensed under the Apache License, Version 2.0 (the "License");
1375
- * you may not use this file except in compliance with the License.
1376
- * You may obtain a copy of the License at
1377
- *
1378
- * http://www.apache.org/licenses/LICENSE-2.0
1379
- *
1380
- * Unless required by applicable law or agreed to in writing, software
1381
- * distributed under the License is distributed on an "AS IS" BASIS,
1382
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1383
- * See the License for the specific language governing permissions and
1384
- * limitations under the License.
1385
- */let $u=1;class xu{constructor(t){this.listenProvider_=t,this.syncPointTree_=new Fo(null),this.pendingWriteTree_={visibleWrites:Bo.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Pu(t,n,e,i,r){return function(t,n,e,i,r){Pe(i>t.lastWriteId,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),t.allWrites.push({path:n,snap:e,writeId:i,visible:r}),r&&(t.visibleWrites=qo(t.visibleWrites,n,e)),t.lastWriteId=i}(t.pendingWriteTree_,n,e,i,r),r?Wu(t,new Mo({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},n,e)):[]}function Lu(t,n,e=!1){const i=function(t,n){for(let e=0;e<t.allWrites.length;e++){const i=t.allWrites[e];if(i.writeId===n)return i}return null}(t.pendingWriteTree_,n);if(function(t,n){const e=t.allWrites.findIndex((t=>t.writeId===n));Pe(e>=0,"removeWrite called with nonexistent writeId.");const i=t.allWrites[e];t.allWrites.splice(e,1);let r=i.visible,s=!1,o=t.allWrites.length-1;for(;r&&o>=0;){const n=t.allWrites[o];n.visible&&(o>=e&&Qo(n,i.path)?r=!1:Is(i.path,n.path)&&(s=!0)),o--}return!!r&&(s?(function(t){t.visibleWrites=nu(t.allWrites,tu,fs()),t.lastWriteId=t.allWrites.length>0?t.allWrites[t.allWrites.length-1].writeId:-1}(t),!0):(i.snap?t.visibleWrites=Ho(t.visibleWrites,i.path):$r(i.children,(n=>{t.visibleWrites=Ho(t.visibleWrites,ys(i.path,n))})),!0))}(t.pendingWriteTree_,n)){let n=new Fo(null);return null!=i.snap?n=n.set(fs(),!0):$r(i.children,(t=>{n=n.set(new ls(t),!0)})),Wu(t,new jo(i.path,n,e))}return[]}function Uu(t,n,e){return Wu(t,new Mo({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},n,e))}function Fu(t,n,e,i,r=!1){const s=n._path,o=t.syncPointTree_.get(s);let u=[];if(o&&("default"===n._queryIdentifier||Nu(o,n))){const h=function(t,n,e,i){const r=n._queryIdentifier,s=[];let o=[];const u=Au(t);if("default"===r)for(const[n,r]of t.views.entries())o=o.concat(Su(r,e,i)),_u(r)&&(t.views.delete(n),r.query._queryParams.loadsAllData()||s.push(r.query));else{const n=t.views.get(r);n&&(o=o.concat(Su(n,e,i)),_u(n)&&(t.views.delete(r),n.query._queryParams.loadsAllData()||s.push(n.query)))}return u&&!Au(t)&&s.push(new(Pe(ku,"Reference.ts has not been loaded"),ku)(n._repo,n._path)),{removed:s,events:o}}(o,n,e,i);0===o.views.size&&(t.syncPointTree_=t.syncPointTree_.remove(s));const c=h.removed;if(u=h.events,!r){const e=-1!==c.findIndex((t=>t._queryParams.loadsAllData())),r=t.syncPointTree_.findOnPath(s,((t,n)=>Au(n)));if(e&&!r){const n=t.syncPointTree_.subtree(s);if(!n.isEmpty()){const e=function(t){return t.fold(((t,n,e)=>{if(n&&Au(n))return[Ru(n)];{let t=[];return n&&(t=Mu(n)),$r(e,((n,e)=>{t=t.concat(e)})),t}}))}(n);for(let n=0;n<e.length;++n){const i=e[n],r=i.query,s=Vu(t,i);t.listenProvider_.startListening(Zu(r),Yu(t,r),s.hashFn,s.onComplete)}}}if(!r&&c.length>0&&!i)if(e){const e=null;t.listenProvider_.stopListening(Zu(n),e)}else c.forEach((n=>{const e=t.queryToTagMap.get(Ju(n));t.listenProvider_.stopListening(Zu(n),e)}))}!function(t,n){for(let e=0;e<n.length;++e){const i=n[e];if(!i._queryParams.loadsAllData()){const n=Ju(i),e=t.queryToTagMap.get(n);t.queryToTagMap.delete(n),t.tagToQueryMap.delete(e)}}}(t,c)}return u}function Bu(t,n,e,i=!1){const r=n._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(r,((t,n)=>{const e=_s(t,r);s=s||Tu(n,e),o=o||Au(n)}));let u,h=t.syncPointTree_.get(r);h?(o=o||Au(h),s=s||Tu(h,fs())):(h=new ju,t.syncPointTree_=t.syncPointTree_.set(r,h)),null!=s?u=!0:(u=!1,s=eo.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild(((t,n)=>{const e=Tu(n,fs());e&&(s=s.updateImmediateChild(t,e))})));const c=Nu(h,n);if(!c&&!n._queryParams.loadsAllData()){const e=Ju(n);Pe(!t.queryToTagMap.has(e),"View does not exist, but we have a tag");const i=$u++;t.queryToTagMap.set(e,i),t.tagToQueryMap.set(i,e)}let a=function(t,n,e,i,r,s){const o=function(t,n,e,i,r){const s=t.views.get(n._queryIdentifier);if(!s){let t=iu(e,r?i:null),s=!1;t?s=!0:i instanceof eo?(t=ru(e,i),s=!1):(t=eo.EMPTY_NODE,s=!1);const o=Ro(new Do(t,s,!1),new Do(i,r,!1));return new yu(n,o)}return s}(t,n,i,r,s);return t.views.has(n._queryIdentifier)||t.views.set(n._queryIdentifier,o),function(t,n){t.eventRegistrations_.push(n)}(o,e),function(t,n){const e=t.viewCache_.eventCache,i=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(Js,((t,n)=>{i.push(ho(t,n))})),e.isFullyInitialized()&&i.push(uo(e.getNode())),Iu(t,i,e.getNode(),n)}(o,e)}(h,n,e,Zo(t.pendingWriteTree_,r),s,u);if(!c&&!o&&!i){const e=Du(h,n);a=a.concat(function(t,n,e){const i=n._path,r=Yu(t,n),s=Vu(t,e),o=t.listenProvider_.startListening(Zu(n),r,s.hashFn,s.onComplete),u=t.syncPointTree_.subtree(i);if(r)Pe(!Au(u.value),"If we're adding a query, it shouldn't be shadowed");else{const n=u.fold(((t,n,e)=>{if(!bs(t)&&n&&Au(n))return[Ru(n).query];{let t=[];return n&&(t=t.concat(Mu(n).map((t=>t.query)))),$r(e,((n,e)=>{t=t.concat(e)})),t}}));for(let e=0;e<n.length;++e){const i=n[e];t.listenProvider_.stopListening(Zu(i),Yu(t,i))}}return o}
1386
- /**
1387
- * @license
1388
- * Copyright 2017 Google LLC
1389
- *
1390
- * Licensed under the Apache License, Version 2.0 (the "License");
1391
- * you may not use this file except in compliance with the License.
1392
- * You may obtain a copy of the License at
1393
- *
1394
- * http://www.apache.org/licenses/LICENSE-2.0
1395
- *
1396
- * Unless required by applicable law or agreed to in writing, software
1397
- * distributed under the License is distributed on an "AS IS" BASIS,
1398
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1399
- * See the License for the specific language governing permissions and
1400
- * limitations under the License.
1401
- */(t,n,e))}return a}function qu(t,n,e){const i=t.pendingWriteTree_,r=t.syncPointTree_.findOnPath(n,((t,e)=>{const i=Tu(e,_s(t,n));if(i)return i}));return eu(i,n,r,e,!0)}function Wu(t,n){return Hu(n,t.syncPointTree_,null,Zo(t.pendingWriteTree_,fs()))}function Hu(t,n,e,i){if(bs(t.path))return zu(t,n,e,i);{const r=n.get(fs());null==e&&null!=r&&(e=Tu(r,fs()));let s=[];const o=ds(t.path),u=t.operationForChild(o),h=n.children.get(o);if(h&&u){const t=e?e.getImmediateChild(o):null,n=hu(i,o);s=s.concat(Hu(u,h,t,n))}return r&&(s=s.concat(Ou(r,t,i,e))),s}}function zu(t,n,e,i){const r=n.get(fs());null==e&&null!=r&&(e=Tu(r,fs()));let s=[];return n.children.inorderTraversal(((n,r)=>{const o=e?e.getImmediateChild(n):null,u=hu(i,n),h=t.operationForChild(n);h&&(s=s.concat(zu(h,r,o,u)))})),r&&(s=s.concat(Ou(r,t,i,e))),s}function Vu(t,n){const e=n.query,i=Yu(t,e);return{hashFn:()=>{const t=function(t){return t.viewCache_.serverCache.getNode()}(n)||eo.EMPTY_NODE;return t.hash()},onComplete:n=>{if("ok"===n)return i?function(t,n,e){const i=Ku(t,e);if(i){const e=Gu(i),r=e.path,s=e.queryId,o=_s(r,n);return Xu(t,r,new Oo(Co(s),o))}return[]}(t,e._path,i):function(t,n){return Wu(t,new Oo({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},n))}(t,e._path);{const i=function(t,n){let e="Unknown Error";"too_big"===t?e="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?e="Client doesn't have permission to access the desired data.":"unavailable"===t&&(e="The service is unavailable");const i=new Error(t+" at "+n._path.toString()+": "+e);return i.code=t.toUpperCase(),i}(n,e);return Fu(t,e,null,i)}}}}function Yu(t,n){const e=Ju(n);return t.queryToTagMap.get(e)}function Ju(t){return t._path.toString()+"$"+t._queryIdentifier}function Ku(t,n){return t.tagToQueryMap.get(n)}function Gu(t){const n=t.indexOf("$");return Pe(-1!==n&&n<t.length-1,"Bad queryKey."),{queryId:t.substr(n+1),path:new ls(t.substr(0,n))}}function Xu(t,n,e){const i=t.syncPointTree_.get(n);return Pe(i,"Missing sync point for query tag that we're tracking"),Ou(i,e,Zo(t.pendingWriteTree_,n),null)}function Zu(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Pe(Cu,"Reference.ts has not been loaded"),Cu)(t._repo,t._path):t}class Qu{constructor(t){this.node_=t}getImmediateChild(t){const n=this.node_.getImmediateChild(t);return new Qu(n)}node(){return this.node_}}class th{constructor(t,n){this.syncTree_=t,this.path_=n}getImmediateChild(t){const n=ys(this.path_,t);return new th(this.syncTree_,n)}node(){return qu(this.syncTree_,this.path_)}}const nh=function(t,n,e){return t&&"object"==typeof t?(Pe(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?eh(t[".sv"],n,e):"object"==typeof t[".sv"]?ih(t[".sv"],n):void Pe(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},eh=function(t,n,e){if("timestamp"===t)return e.timestamp;Pe(!1,"Unexpected server value: "+t)},ih=function(t,n){t.hasOwnProperty("increment")||Pe(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const e=t.increment;"number"!=typeof e&&Pe(!1,"Unexpected increment value: "+e);const i=n.node();if(Pe(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return e;const r=i.getValue();return"number"!=typeof r?e:r+e},rh=function(t,n,e,i){return oh(n,new th(e,t),i)},sh=function(t,n,e){return oh(t,new Qu(n),e)};function oh(t,n,e){const i=t.getPriority().val(),r=nh(i,n.getImmediateChild(".priority"),e);let s;if(t.isLeafNode()){const i=t,s=nh(i.getValue(),n,e);return s!==i.getValue()||r!==i.getPriority().val()?new Ys(s,ro(r)):t}{const i=t;return s=i,r!==i.getPriority().val()&&(s=s.updatePriority(new Ys(r))),i.forEachChild(Js,((t,i)=>{const r=oh(i,n.getImmediateChild(t),e);r!==i&&(s=s.updateImmediateChild(t,r))})),s}}
1402
- /**
1403
- * @license
1404
- * Copyright 2017 Google LLC
1405
- *
1406
- * Licensed under the Apache License, Version 2.0 (the "License");
1407
- * you may not use this file except in compliance with the License.
1408
- * You may obtain a copy of the License at
1409
- *
1410
- * http://www.apache.org/licenses/LICENSE-2.0
1411
- *
1412
- * Unless required by applicable law or agreed to in writing, software
1413
- * distributed under the License is distributed on an "AS IS" BASIS,
1414
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1415
- * See the License for the specific language governing permissions and
1416
- * limitations under the License.
1417
- */class uh{constructor(t="",n=null,e={children:{},childCount:0}){this.name=t,this.parent=n,this.node=e}}function hh(t,n){let e=n instanceof ls?n:new ls(n),i=t,r=ds(e);for(;null!==r;){const t=ri(i.node.children,r)||{children:{},childCount:0};i=new uh(r,i,t),e=ms(e),r=ds(e)}return i}function ch(t){return t.node.value}function ah(t,n){t.node.value=n,mh(t)}function lh(t){return t.node.childCount>0}function fh(t,n){$r(t.node.children,((e,i)=>{n(new uh(e,t,i))}))}function dh(t,n,e,i){e&&!i&&n(t),fh(t,(t=>{dh(t,n,!0,i)})),e&&i&&n(t)}function ph(t){return new ls(null===t.parent?t.name:ph(t.parent)+"/"+t.name)}function mh(t){null!==t.parent&&function(t,n,e){const i=function(t){return void 0===ch(t)&&!lh(t)}(e),r=ii(t.node.children,n);i&&r?(delete t.node.children[n],t.node.childCount--,mh(t)):i||r||(t.node.children[n]=e.node,t.node.childCount++,mh(t))}
1418
- /**
1419
- * @license
1420
- * Copyright 2017 Google LLC
1421
- *
1422
- * Licensed under the Apache License, Version 2.0 (the "License");
1423
- * you may not use this file except in compliance with the License.
1424
- * You may obtain a copy of the License at
1425
- *
1426
- * http://www.apache.org/licenses/LICENSE-2.0
1427
- *
1428
- * Unless required by applicable law or agreed to in writing, software
1429
- * distributed under the License is distributed on an "AS IS" BASIS,
1430
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1431
- * See the License for the specific language governing permissions and
1432
- * limitations under the License.
1433
- */(t.parent,t.name,t)}const wh=/[\[\].#$\/\u0000-\u001F\u007F]/,vh=/[\[\].#$\u0000-\u001F\u007F]/,gh=10485760,yh=function(t){return"string"==typeof t&&0!==t.length&&!wh.test(t)},bh=function(t){return"string"==typeof t&&0!==t.length&&!vh.test(t)},_h=function(t,n,e,i){i&&void 0===n||Sh(ai(t,"value"),n,e)},Sh=function(t,n,e){const i=e instanceof ls?new ks(e,t):e;if(void 0===n)throw new Error(t+"contains undefined "+js(i));if("function"==typeof n)throw new Error(t+"contains a function "+js(i)+" with contents = "+n.toString());if(jr(n))throw new Error(t+"contains "+n.toString()+" "+js(i));if("string"==typeof n&&n.length>gh/3&&li(n)>gh)throw new Error(t+"contains a string greater than "+gh+" utf8 bytes "+js(i)+" ('"+n.substring(0,50)+"...')");if(n&&"object"==typeof n){let e=!1,r=!1;if($r(n,((n,s)=>{if(".value"===n)e=!0;else if(".priority"!==n&&".sv"!==n&&(r=!0,!yh(n)))throw new Error(t+" contains an invalid key ("+n+") "+js(i)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');!function(t,n){t.parts_.length>0&&(t.byteLength_+=1),t.parts_.push(n),t.byteLength_+=li(n),Cs(t)}(i,n),Sh(t,s,i),function(t){const n=t.parts_.pop();t.byteLength_-=li(n),t.parts_.length>0&&(t.byteLength_-=1)}(i)})),e&&r)throw new Error(t+' contains ".value" child '+js(i)+" in addition to actual children.")}},Eh=function(t,n,e,i){if(!(i&&void 0===e||bh(e)))throw new Error(ai(t,n)+'was an invalid path = "'+e+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},Ih=function(t,n){if(".info"===ds(n))throw new Error(t+" failed = Can't modify data under /.info/")};
1434
- /**
1435
- * @license
1436
- * Copyright 2017 Google LLC
1437
- *
1438
- * Licensed under the Apache License, Version 2.0 (the "License");
1439
- * you may not use this file except in compliance with the License.
1440
- * You may obtain a copy of the License at
1441
- *
1442
- * http://www.apache.org/licenses/LICENSE-2.0
1443
- *
1444
- * Unless required by applicable law or agreed to in writing, software
1445
- * distributed under the License is distributed on an "AS IS" BASIS,
1446
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1447
- * See the License for the specific language governing permissions and
1448
- * limitations under the License.
1449
- */
1450
- class kh{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function Ch(t,n){let e=null;for(let i=0;i<n.length;i++){const r=n[i],s=r.getPath();null===e||Es(s,e.path)||(t.eventLists_.push(e),e=null),null===e&&(e={events:[],path:s}),e.events.push(r)}e&&t.eventLists_.push(e)}function jh(t,n,e){Ch(t,e),Mh(t,(t=>Es(t,n)))}function Oh(t,n,e){Ch(t,e),Mh(t,(t=>Is(t,n)||Is(n,t)))}function Mh(t,n){t.recursionDepth_++;let e=!0;for(let i=0;i<t.eventLists_.length;i++){const r=t.eventLists_[i];r&&(n(r.path)?(Th(t.eventLists_[i]),t.eventLists_[i]=null):e=!1)}e&&(t.eventLists_=[]),t.recursionDepth_--}function Th(t){for(let n=0;n<t.events.length;n++){const e=t.events[n];if(null!==e){t.events[n]=null;const i=e.getEventRunner();br&&Sr("event: "+e.toString()),Ur(i)}}}
1451
- /**
1452
- * @license
1453
- * Copyright 2017 Google LLC
1454
- *
1455
- * Licensed under the Apache License, Version 2.0 (the "License");
1456
- * you may not use this file except in compliance with the License.
1457
- * You may obtain a copy of the License at
1458
- *
1459
- * http://www.apache.org/licenses/LICENSE-2.0
1460
- *
1461
- * Unless required by applicable law or agreed to in writing, software
1462
- * distributed under the License is distributed on an "AS IS" BASIS,
1463
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1464
- * See the License for the specific language governing permissions and
1465
- * limitations under the License.
1466
- */class Dh{constructor(t,n,e,i){this.repoInfo_=t,this.forceRestClient_=n,this.authTokenProvider_=e,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new kh,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=bo(),this.transactionQueueTree_=new uh,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function Nh(t,n,e){if(t.stats_=Qr(t.repoInfo_),t.forceRestClient_||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)t.server_=new go(t.repoInfo_,((n,e,i,r)=>{$h(t,n,e,i,r)}),t.authTokenProvider_,t.appCheckProvider_),setTimeout((()=>xh(t,!0)),0);else{if(null!=e){if("object"!=typeof e)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ni(e)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}t.persistentConnection_=new Ts(t.repoInfo_,n,((n,e,i,r)=>{$h(t,n,e,i,r)}),(n=>{xh(t,n)}),(n=>{!function(t,n){$r(n,((n,e)=>{Ph(t,n,e)}))}(t,n)}),t.authTokenProvider_,t.appCheckProvider_,e),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener((n=>{t.server_.refreshAuthToken(n)})),t.appCheckProvider_.addTokenChangeListener((n=>{t.server_.refreshAppCheckToken(n.token)})),t.statsReporter_=function(n){const e=n.toString();return Zr[e]||(Zr[e]=new Io(t.stats_,t.server_)),Zr[e]}(t.repoInfo_),t.infoData_=new yo,t.infoSyncTree_=new xu({startListening:(n,e,i,r)=>{let s=[];const o=t.infoData_.getNode(n._path);return o.isEmpty()||(s=Uu(t.infoSyncTree_,n._path,o),setTimeout((()=>{r("ok")}),0)),s},stopListening:()=>{}}),Ph(t,"connected",!1),t.serverSyncTree_=new xu({startListening:(n,e,i,r)=>(t.server_.listen(n,i,e,((e,i)=>{const s=r(e,i);Oh(t.eventQueue_,n._path,s)})),[]),stopListening:(n,e)=>{t.server_.unlisten(n,e)}})}function Ah(t){const n=t.infoData_.getNode(new ls(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+n}function Rh(t){return(n=(n={timestamp:Ah(t)})||{}).timestamp=n.timestamp||(new Date).getTime(),n;var n}function $h(t,n,e,i,r){t.dataUpdateCount++;const s=new ls(n);e=t.interceptServerDataCallback_?t.interceptServerDataCallback_(n,e):e;let o=[];if(r)if(i){const n=oi(e,(t=>ro(t)));o=function(t,n,e,i){const r=Ku(t,i);if(r){const i=Gu(r),s=i.path,o=i.queryId,u=_s(s,n),h=Fo.fromObject(e);return Xu(t,s,new To(Co(o),u,h))}return[]}(t.serverSyncTree_,s,n,r)}else{const n=ro(e);o=function(t,n,e,i){const r=Ku(t,i);if(null!=r){const i=Gu(r),s=i.path,o=i.queryId,u=_s(s,n);return Xu(t,s,new Mo(Co(o),u,e))}return[]}(t.serverSyncTree_,s,n,r)}else if(i){const n=oi(e,(t=>ro(t)));o=function(t,n,e){const i=Fo.fromObject(e);return Wu(t,new To({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},n,i))}(t.serverSyncTree_,s,n)}else{const n=ro(e);o=Uu(t.serverSyncTree_,s,n)}let u=s;o.length>0&&(u=Hh(t,s)),Oh(t.eventQueue_,u,o)}function xh(t,n){Ph(t,"connected",n),!1===n&&function(t){Fh(t,"onDisconnectEvents");const n=Rh(t),e=bo();So(t.onDisconnect_,fs(),((i,r)=>{const s=rh(i,r,t.serverSyncTree_,n);_o(e,i,s)}));let i=[];So(e,fs(),((n,e)=>{i=i.concat(Uu(t.serverSyncTree_,n,e));const r=Kh(t,n);Hh(t,r)})),t.onDisconnect_=bo(),Oh(t.eventQueue_,fs(),i)}(t)}function Ph(t,n,e){const i=new ls("/.info/"+n),r=ro(e);t.infoData_.updateSnapshot(i,r);const s=Uu(t.infoSyncTree_,i,r);Oh(t.eventQueue_,i,s)}function Lh(t){return t.nextWriteId_++}function Uh(t,n,e){let i;i=".info"===ds(n._path)?Fu(t.infoSyncTree_,n,e):Fu(t.serverSyncTree_,n,e),jh(t.eventQueue_,n._path,i)}function Fh(t,...n){let e="";t.persistentConnection_&&(e=t.persistentConnection_.id+":"),Sr(e,...n)}function Bh(t,n,e,i){n&&Ur((()=>{if("ok"===e)n(null);else{const t=(e||"error").toUpperCase();let r=t;i&&(r+=": "+i);const s=new Error(r);s.code=t,n(s)}}))}function qh(t,n,e){return qu(t.serverSyncTree_,n,e)||eo.EMPTY_NODE}function Wh(t,n=t.transactionQueueTree_){if(n||Jh(t,n),ch(n)){const e=Vh(t,n);Pe(e.length>0,"Sending zero length transaction queue"),e.every((t=>0===t.status))&&function(t,n,e){const i=e.map((t=>t.currentWriteId)),r=qh(t,n,i);let s=r;const o=r.hash();for(let t=0;t<e.length;t++){const i=e[t];Pe(0===i.status,"tryToSendTransactionQueue_: items in queue should all be run."),i.status=1,i.retryCount++;const r=_s(n,i.path);s=s.updateChild(r,i.currentOutputSnapshotRaw)}const u=s.val(!0),h=n;t.server_.put(h.toString(),u,(i=>{Fh(t,"transaction put response",{path:h.toString(),status:i});let r=[];if("ok"===i){const i=[];for(let n=0;n<e.length;n++)e[n].status=2,r=r.concat(Lu(t.serverSyncTree_,e[n].currentWriteId)),e[n].onComplete&&i.push((()=>e[n].onComplete(null,!0,e[n].currentOutputSnapshotResolved))),e[n].unwatcher();Jh(t,hh(t.transactionQueueTree_,n)),Wh(t,t.transactionQueueTree_),Oh(t.eventQueue_,n,r);for(let t=0;t<i.length;t++)Ur(i[t])}else{if("datastale"===i)for(let t=0;t<e.length;t++)e[t].status=3===e[t].status?4:0;else{Cr("transaction at "+h.toString()+" failed: "+i);for(let t=0;t<e.length;t++)e[t].status=4,e[t].abortReason=i}Hh(t,n)}}),o)}(t,ph(n),e)}else lh(n)&&fh(n,(n=>{Wh(t,n)}))}function Hh(t,n){const e=zh(t,n),i=ph(e);return function(t,n,e){if(0===n.length)return;const i=[];let r=[];const s=n.filter((t=>0===t.status)).map((t=>t.currentWriteId));for(let o=0;o<n.length;o++){const u=n[o],h=_s(e,u.path);let c,a=!1;if(Pe(null!==h,"rerunTransactionsUnderNode_: relativePath should not be null."),4===u.status)a=!0,c=u.abortReason,r=r.concat(Lu(t.serverSyncTree_,u.currentWriteId,!0));else if(0===u.status)if(u.retryCount>=25)a=!0,c="maxretry",r=r.concat(Lu(t.serverSyncTree_,u.currentWriteId,!0));else{const e=qh(t,u.path,s);u.currentInputSnapshot=e;const i=n[o].update(e.val());if(void 0!==i){Sh("transaction failed: Data returned ",i,u.path);let n=ro(i);"object"==typeof i&&null!=i&&ii(i,".priority")||(n=n.updatePriority(e.getPriority()));const o=u.currentWriteId,h=Rh(t),c=sh(n,e,h);u.currentOutputSnapshotRaw=n,u.currentOutputSnapshotResolved=c,u.currentWriteId=Lh(t),s.splice(s.indexOf(o),1),r=r.concat(Pu(t.serverSyncTree_,u.path,c,u.currentWriteId,u.applyLocally)),r=r.concat(Lu(t.serverSyncTree_,o,!0))}else a=!0,c="nodata",r=r.concat(Lu(t.serverSyncTree_,u.currentWriteId,!0))}Oh(t.eventQueue_,e,r),r=[],a&&(n[o].status=2,setTimeout(n[o].unwatcher,Math.floor(0)),n[o].onComplete&&i.push("nodata"===c?()=>n[o].onComplete(null,!1,n[o].currentInputSnapshot):()=>n[o].onComplete(new Error(c),!1,null)))}Jh(t,t.transactionQueueTree_);for(let t=0;t<i.length;t++)Ur(i[t]);Wh(t,t.transactionQueueTree_)}(t,Vh(t,e),i),i}function zh(t,n){let e,i=t.transactionQueueTree_;for(e=ds(n);null!==e&&void 0===ch(i);)i=hh(i,e),e=ds(n=ms(n));return i}function Vh(t,n){const e=[];return Yh(t,n,e),e.sort(((t,n)=>t.order-n.order)),e}function Yh(t,n,e){const i=ch(n);if(i)for(let t=0;t<i.length;t++)e.push(i[t]);fh(n,(n=>{Yh(t,n,e)}))}function Jh(t,n){const e=ch(n);if(e){let t=0;for(let n=0;n<e.length;n++)2!==e[n].status&&(e[t]=e[n],t++);e.length=t,ah(n,e.length>0?e:void 0)}fh(n,(n=>{Jh(t,n)}))}function Kh(t,n){const e=ph(zh(t,n)),i=hh(t.transactionQueueTree_,n);return function(t,n){let e=t.parent;for(;null!==e;){if(n(e))return!0;e=e.parent}}(i,(n=>{Gh(t,n)})),Gh(t,i),dh(i,(n=>{Gh(t,n)})),e}function Gh(t,n){const e=ch(n);if(e){const i=[];let r=[],s=-1;for(let n=0;n<e.length;n++)3===e[n].status||(1===e[n].status?(Pe(s===n-1,"All SENT items should be at beginning of queue."),s=n,e[n].status=3,e[n].abortReason="set"):(Pe(0===e[n].status,"Unexpected transaction status in abort"),e[n].unwatcher(),r=r.concat(Lu(t.serverSyncTree_,e[n].currentWriteId,!0)),e[n].onComplete&&i.push(e[n].onComplete.bind(null,new Error("set"),!1,null))));-1===s?ah(n,void 0):e.length=s+1,Oh(t.eventQueue_,ph(n),r);for(let t=0;t<i.length;t++)Ur(i[t])}}
1467
- /**
1468
- * @license
1469
- * Copyright 2017 Google LLC
1470
- *
1471
- * Licensed under the Apache License, Version 2.0 (the "License");
1472
- * you may not use this file except in compliance with the License.
1473
- * You may obtain a copy of the License at
1474
- *
1475
- * http://www.apache.org/licenses/LICENSE-2.0
1476
- *
1477
- * Unless required by applicable law or agreed to in writing, software
1478
- * distributed under the License is distributed on an "AS IS" BASIS,
1479
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1480
- * See the License for the specific language governing permissions and
1481
- * limitations under the License.
1482
- */const Xh=function(t,n){const e=Zh(t),i=e.namespace;return"firebase.com"===e.domain&&kr(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),i&&"undefined"!==i||"localhost"===e.domain||kr("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&Cr("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),{repoInfo:new Jr(e.host,e.secure,i,"ws"===e.scheme||"wss"===e.scheme,n,"",i!==e.subdomain),path:new ls(e.pathString)}},Zh=function(t){let n="",e="",i="",r="",s="",o=!0,u="https",h=443;if("string"==typeof t){let c=t.indexOf("//");c>=0&&(u=t.substring(0,c-1),t=t.substring(c+2));let a=t.indexOf("/");-1===a&&(a=t.length);let l=t.indexOf("?");-1===l&&(l=t.length),n=t.substring(0,Math.min(a,l)),a<l&&(r=function(t){let n="";const e=t.split("/");for(let t=0;t<e.length;t++)if(e[t].length>0){let i=e[t];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}n+="/"+i}return n}(t.substring(a,l)));const f=function(t){const n={};"?"===t.charAt(0)&&(t=t.substring(1));for(const e of t.split("&")){if(0===e.length)continue;const i=e.split("=");2===i.length?n[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):Cr(`Invalid query segment '${e}' in query '${t}'`)}return n}(t.substring(Math.min(t.length,l)));c=n.indexOf(":"),c>=0?(o="https"===u||"wss"===u,h=parseInt(n.substring(c+1),10)):c=n.length;const d=n.slice(0,c);if("localhost"===d.toLowerCase())e="localhost";else if(d.split(".").length<=2)e=d;else{const t=n.indexOf(".");i=n.substring(0,t).toLowerCase(),e=n.substring(t+1),s=i}"ns"in f&&(s=f.ns)}return{host:n,port:h,domain:e,subdomain:i,secure:o,scheme:u,pathString:r,namespace:s}},Qh="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",tc=function(){let t=0;const n=[];return function(e){const i=e===t;let r;t=e;const s=new Array(8);for(r=7;r>=0;r--)s[r]=Qh.charAt(e%64),e=Math.floor(e/64);Pe(0===e,"Cannot push at time == 0");let o=s.join("");if(i){for(r=11;r>=0&&63===n[r];r--)n[r]=0;n[r]++}else for(r=0;r<12;r++)n[r]=Math.floor(64*Math.random());for(r=0;r<12;r++)o+=Qh.charAt(n[r]);return Pe(20===o.length,"nextPushId: Length should be 20."),o}}();
1483
- /**
1484
- * @license
1485
- * Copyright 2017 Google LLC
1486
- *
1487
- * Licensed under the Apache License, Version 2.0 (the "License");
1488
- * you may not use this file except in compliance with the License.
1489
- * You may obtain a copy of the License at
1490
- *
1491
- * http://www.apache.org/licenses/LICENSE-2.0
1492
- *
1493
- * Unless required by applicable law or agreed to in writing, software
1494
- * distributed under the License is distributed on an "AS IS" BASIS,
1495
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1496
- * See the License for the specific language governing permissions and
1497
- * limitations under the License.
1498
- */
1499
- class nc{constructor(t,n,e,i){this.eventType=t,this.eventRegistration=n,this.snapshot=e,this.prevName=i}getPath(){const t=this.snapshot.ref;return"value"===this.eventType?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+ni(this.snapshot.exportVal())}}class ec{constructor(t,n,e){this.eventRegistration=t,this.error=n,this.path=e}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}
1500
- /**
1501
- * @license
1502
- * Copyright 2017 Google LLC
1503
- *
1504
- * Licensed under the Apache License, Version 2.0 (the "License");
1505
- * you may not use this file except in compliance with the License.
1506
- * You may obtain a copy of the License at
1507
- *
1508
- * http://www.apache.org/licenses/LICENSE-2.0
1509
- *
1510
- * Unless required by applicable law or agreed to in writing, software
1511
- * distributed under the License is distributed on an "AS IS" BASIS,
1512
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1513
- * See the License for the specific language governing permissions and
1514
- * limitations under the License.
1515
- */class ic{constructor(t,n){this.snapshotCallback=t,this.cancelCallback=n}onValue(t,n){this.snapshotCallback.call(null,t,n)}onCancel(t){return Pe(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||void 0!==this.snapshotCallback.userCallback&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}
1516
- /**
1517
- * @license
1518
- * Copyright 2020 Google LLC
1519
- *
1520
- * Licensed under the Apache License, Version 2.0 (the "License");
1521
- * you may not use this file except in compliance with the License.
1522
- * You may obtain a copy of the License at
1523
- *
1524
- * http://www.apache.org/licenses/LICENSE-2.0
1525
- *
1526
- * Unless required by applicable law or agreed to in writing, software
1527
- * distributed under the License is distributed on an "AS IS" BASIS,
1528
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1529
- * See the License for the specific language governing permissions and
1530
- * limitations under the License.
1531
- */class rc{constructor(t,n,e,i){this._repo=t,this._path=n,this._queryParams=e,this._orderByCalled=i}get key(){return bs(this._path)?null:ws(this._path)}get ref(){return new sc(this._repo,this._path)}get _queryIdentifier(){const t=vo(this._queryParams),n=Ar(t);return"{}"===n?"default":n}get _queryObject(){return vo(this._queryParams)}isEqual(t){if(!((t=fi(t))instanceof rc))return!1;const n=this._repo===t._repo,e=Es(this._path,t._path);return n&&e&&this._queryIdentifier===t._queryIdentifier}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(t){let n="";for(let e=t.pieceNum_;e<t.pieces_.length;e++)""!==t.pieces_[e]&&(n+="/"+encodeURIComponent(String(t.pieces_[e])));return n||"/"}(this._path)}}class sc extends rc{constructor(t,n){super(t,n,new mo,!1)}get parent(){const t=gs(this._path);return null===t?null:new sc(this._repo,t)}get root(){let t=this;for(;null!==t.parent;)t=t.parent;return t}}class oc{constructor(t,n,e){this._node=t,this.ref=n,this._index=e}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const n=new ls(t),e=hc(this.ref,t);return new oc(this._node.getChild(n),e,Js)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){return!this._node.isLeafNode()&&!!this._node.forEachChild(this._index,((n,e)=>t(new oc(e,hc(this.ref,n),Js))))}hasChild(t){const n=new ls(t);return!this._node.getChild(n).isEmpty()}hasChildren(){return!this._node.isLeafNode()&&!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function uc(t,n){return(t=fi(t))._checkNotDeleted("ref"),void 0!==n?hc(t._root,n):t._root}function hc(t,n){var e;return null===ds((t=fi(t))._path)?("child","path",!1,(e=n)&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),Eh("child","path",e,false)):Eh("child","path",n,!1),new sc(t._repo,ys(t._path,n))}function cc(t,n){!function(t,n,e,i){if(i&&void 0===n)return;const r=ai(t,"values");if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(r+" must be an object containing the children to replace.");const s=[];$r(n,((t,n)=>{const i=new ls(t);if(Sh(r,n,ys(e,i)),".priority"===ws(i)&&!(null===(o=n)||"string"==typeof o||"number"==typeof o&&!jr(o)||o&&"object"==typeof o&&ii(o,".sv")))throw new Error(r+"contains an invalid value for '"+i.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");var o;s.push(i)})),function(t,n){let e,i;for(e=0;e<n.length;e++){i=n[e];const r=vs(i);for(let n=0;n<r.length;n++)if(".priority"===r[n]&&n===r.length-1);else if(!yh(r[n]))throw new Error(t+"contains an invalid key ("+r[n]+") in path "+i.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')}n.sort(Ss);let r=null;for(e=0;e<n.length;e++){if(i=n[e],null!==r&&Is(r,i))throw new Error(t+"contains a path "+r.toString()+" that is ancestor of another path "+i.toString());r=i}}(r,s)}("update",n,t._path,!1);const e=new Ke;return function(t,n,e,i){Fh(t,"update",{path:n.toString(),value:e});let r=!0;const s=Rh(t),o={};if($r(e,((e,i)=>{r=!1,o[e]=rh(ys(n,e),ro(i),t.serverSyncTree_,s)})),r)Sr("update() called with empty data. Don't do anything."),Bh(0,i,"ok",void 0);else{const r=Lh(t),s=function(t,n,e,i){!function(t,n,e,i){Pe(i>t.lastWriteId,"Stacking an older merge on top of newer ones"),t.allWrites.push({path:n,children:e,writeId:i,visible:!0}),t.visibleWrites=Wo(t.visibleWrites,n,e),t.lastWriteId=i}(t.pendingWriteTree_,n,e,i);const r=Fo.fromObject(e);return Wu(t,new To({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},n,r))}(t.serverSyncTree_,n,o,r);Ch(t.eventQueue_,s),t.server_.merge(n.toString(),e,((e,s)=>{const o="ok"===e;o||Cr("update at "+n+" failed: "+e);const u=Lu(t.serverSyncTree_,r,!o),h=u.length>0?Hh(t,n):n;Oh(t.eventQueue_,h,u),Bh(0,i,e,s)})),$r(e,(e=>{const i=Kh(t,ys(n,e));Hh(t,i)})),Oh(t.eventQueue_,n,[])}}(t._repo,t._path,n,e.wrapCallback((()=>{}))),e.promise}class ac{constructor(t){this.callbackContext=t}respondsTo(t){return"value"===t}createEvent(t,n){const e=n._queryParams.getIndex();return new nc("value",this,new oc(t.snapshotNode,new sc(n._repo,n._path),e))}getEventRunner(t){return"cancel"===t.getEventType()?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,n){return this.callbackContext.hasCancelCallback?new ec(this,t,n):null}matches(t){return t instanceof ac&&(!t.callbackContext||!this.callbackContext||t.callbackContext.matches(this.callbackContext))}hasAnyCallback(){return null!==this.callbackContext}}class lc{constructor(t,n){this.eventType=t,this.callbackContext=n}respondsTo(t){let n="children_added"===t?"child_added":t;return n="children_removed"===n?"child_removed":n,this.eventType===n}createCancelEvent(t,n){return this.callbackContext.hasCancelCallback?new ec(this,t,n):null}createEvent(t,n){Pe(null!=t.childName,"Child events should have a childName.");const e=hc(new sc(n._repo,n._path),t.childName),i=n._queryParams.getIndex();return new nc(t.type,this,new oc(t.snapshotNode,e,i),t.prevName)}getEventRunner(t){return"cancel"===t.getEventType()?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,t.prevName)}matches(t){return t instanceof lc&&this.eventType===t.eventType&&(!this.callbackContext||!t.callbackContext||this.callbackContext.matches(t.callbackContext))}hasAnyCallback(){return!!this.callbackContext}}var fc;fc=sc,Pe(!ku,"__referenceConstructor has already been defined"),ku=fc,function(t){Pe(!Cu,"__referenceConstructor has already been defined"),Cu=t}(sc);
1532
- /**
1533
- * @license
1534
- * Copyright 2020 Google LLC
1535
- *
1536
- * Licensed under the Apache License, Version 2.0 (the "License");
1537
- * you may not use this file except in compliance with the License.
1538
- * You may obtain a copy of the License at
1539
- *
1540
- * http://www.apache.org/licenses/LICENSE-2.0
1541
- *
1542
- * Unless required by applicable law or agreed to in writing, software
1543
- * distributed under the License is distributed on an "AS IS" BASIS,
1544
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1545
- * See the License for the specific language governing permissions and
1546
- * limitations under the License.
1547
- */
1548
- const dc={};function pc(t,n,e,i,r){let s=i||t.options.databaseURL;void 0===s&&(t.options.projectId||kr("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Sr("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o,u,h=Xh(s,r),c=h.repoInfo;"undefined"!=typeof process&&process.env&&(u=process.env.FIREBASE_DATABASE_EMULATOR_HOST),u?(o=!0,s=`http://${u}?ns=${c.namespace}`,h=Xh(s,r),c=h.repoInfo):o=!h.repoInfo.secure;const a=r&&o?new Wr(Wr.OWNER):new qr(t.name,t.options,n);(function(t,n){const e=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!yh(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==e.length&&!function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),bh(t)}(e))throw new Error(ai(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')})("Invalid Firebase Database URL",h),bs(h.path)||kr("Database URL must point to the root of a Firebase Database (not including a child path).");const l=function(t,n,e,i){let r=dc[n.name];r||(r={},dc[n.name]=r);let s=r[t.toURLString()];return s&&kr("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new Dh(t,!1,e,i),r[t.toURLString()]=s,s}(c,t,a,new Br(t.name,e));return new mc(l,t)}class mc{constructor(t,n){this._repoInternal=t,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(Nh(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new sc(this._repo,fs())),this._rootInternal}_delete(){return null!==this._rootInternal&&(function(t,n){const e=dc[n];e&&e[t.key]===t||kr(`Database ${n}(${t.repoInfo_}) has already been deleted.`),function(t){t.persistentConnection_&&t.persistentConnection_.interrupt("repo_interrupt")}(t),delete e[t.key]}(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){null===this._rootInternal&&kr("Cannot call "+t+" on a deleted database.")}}function wc(t=function(t=Wi){const n=zi.get(t);if(!n&&t===Wi&&Je())return Xi();if(!n)throw Ki.create("no-app",{appName:t});return n}(),n){const e=function(t){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider("database")}(t).getImmediate({identifier:n});if(!e._instanceStarted){const t=(t=>{const n=(t=>{var n,e;return null===(e=null===(n=Ye())||void 0===n?void 0:n.emulatorHosts)||void 0===e?void 0:e[t]})(t);if(!n)return;const e=n.lastIndexOf(":");if(e<=0||e+1===n.length)throw new Error(`Invalid host ${n} with no separate hostname and port!`);const i=parseInt(n.substring(e+1),10);return"["===n[0]?[n.substring(1,e-1),i]:[n.substring(0,e),i]})("database");t&&function(t,n,e,i={}){(t=fi(t))._checkNotDeleted("useEmulator"),t._instanceStarted&&kr("Cannot call useEmulator() after instance has already been initialized.");const r=t._repoInternal;let s;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&kr('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new Wr(Wr.OWNER);else if(i.mockUserToken){const n="string"==typeof i.mockUserToken?i.mockUserToken:function(t,n){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const e=n||"demo-project",i=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${e}`,aud:e,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},t);return[We(JSON.stringify({alg:"none",type:"JWT"})),We(JSON.stringify(s)),""].join(".")}
1549
- /**
1550
- * @license
1551
- * Copyright 2017 Google LLC
1552
- *
1553
- * Licensed under the Apache License, Version 2.0 (the "License");
1554
- * you may not use this file except in compliance with the License.
1555
- * You may obtain a copy of the License at
1556
- *
1557
- * http://www.apache.org/licenses/LICENSE-2.0
1558
- *
1559
- * Unless required by applicable law or agreed to in writing, software
1560
- * distributed under the License is distributed on an "AS IS" BASIS,
1561
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1562
- * See the License for the specific language governing permissions and
1563
- * limitations under the License.
1564
- */(i.mockUserToken,t.app.options.projectId);s=new Wr(n)}!function(t,n,e,i){t.repoInfo_=new Jr(`${n}:${e}`,!1,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams,!0),i&&(t.authTokenProvider_=i)}(r,n,e,s)}
1565
- /**
1566
- * @license
1567
- * Copyright 2021 Google LLC
1568
- *
1569
- * Licensed under the Apache License, Version 2.0 (the "License");
1570
- * you may not use this file except in compliance with the License.
1571
- * You may obtain a copy of the License at
1572
- *
1573
- * http://www.apache.org/licenses/LICENSE-2.0
1574
- *
1575
- * Unless required by applicable law or agreed to in writing, software
1576
- * distributed under the License is distributed on an "AS IS" BASIS,
1577
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1578
- * See the License for the specific language governing permissions and
1579
- * limitations under the License.
1580
- */(e,...t)}return e}Ts.prototype.simpleListen=function(t,n){this.sendRequest("q",{p:t},n)},Ts.prototype.echo=function(t,n){this.sendRequest("echo",{d:t},n)},ar="10.0.0",Ji(new di("database",((t,{instanceIdentifier:n})=>pc(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"),t.getProvider("app-check-internal"),n)),"PUBLIC").setMultipleInstances(!0)),Zi(hr,cr,void 0),Zi(hr,cr,"esm2017");var vc,gc=n((function(t){t.exports=function(){var t=6e4,n=36e5,e="millisecond",i="second",r="minute",s="hour",o="day",u="week",h="month",c="quarter",a="year",l="date",f="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},w=function(t,n,e){var i=String(t);return!i||i.length>=n?t:""+Array(n+1-i.length).join(e)+t},v={s:w,z:function(t){var n=-t.utcOffset(),e=Math.abs(n),i=Math.floor(e/60),r=e%60;return(n<=0?"+":"-")+w(i,2,"0")+":"+w(r,2,"0")},m:function t(n,e){if(n.date()<e.date())return-t(e,n);var i=12*(e.year()-n.year())+(e.month()-n.month()),r=n.clone().add(i,h),s=e-r<0,o=n.clone().add(i+(s?-1:1),h);return+(-(i+(e-r)/(s?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:h,y:a,w:u,d:o,D:l,h:s,m:r,s:i,ms:e,Q:c}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",y={};y[g]=m;var b=function(t){return t instanceof I},_=function(t,n,e){var i;if(!t)return g;if("string"==typeof t)y[t]&&(i=t),n&&(y[t]=n,i=t);else{var r=t.name;y[r]=t,i=r}return!e&&i&&(g=i),i||!e&&g},S=function(t,n){if(b(t))return t.clone();var e="object"==typeof n?n:{};return e.date=t,e.args=arguments,new I(e)},E=v;E.l=_,E.i=b,E.w=function(t,n){return S(t,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var I=function(){function m(t){this.$L=_(t.locale,null,!0),this.parse(t)}var w=m.prototype;return w.parse=function(t){this.$d=function(t){var n=t.date,e=t.utc;if(null===n)return new Date(NaN);if(E.u(n))return new Date;if(n instanceof Date)return new Date(n);if("string"==typeof n&&!/Z$/i.test(n)){var i=n.match(d);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return e?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(n)}(t),this.$x=t.x||{},this.init()},w.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},w.$utils=function(){return E},w.isValid=function(){return!(this.$d.toString()===f)},w.isSame=function(t,n){var e=S(t);return this.startOf(n)<=e&&e<=this.endOf(n)},w.isAfter=function(t,n){return S(t)<this.startOf(n)},w.isBefore=function(t,n){return this.endOf(n)<S(t)},w.$g=function(t,n,e){return E.u(t)?this[n]:this.set(e,t)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(t,n){var e=this,c=!!E.u(n)||n,f=E.p(t),d=function(t,n){var i=E.w(e.$u?Date.UTC(e.$y,n,t):new Date(e.$y,n,t),e);return c?i:i.endOf(o)},p=function(t,n){return E.w(e.toDate()[t].apply(e.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(n)),e)},m=this.$W,w=this.$M,v=this.$D,g="set"+(this.$u?"UTC":"");switch(f){case a:return c?d(1,0):d(31,11);case h:return c?d(1,w):d(0,w+1);case u:var y=this.$locale().weekStart||0,b=(m<y?m+7:m)-y;return d(c?v-b:v+(6-b),w);case o:case l:return p(g+"Hours",0);case s:return p(g+"Minutes",1);case r:return p(g+"Seconds",2);case i:return p(g+"Milliseconds",3);default:return this.clone()}},w.endOf=function(t){return this.startOf(t,!1)},w.$set=function(t,n){var u,c=E.p(t),f="set"+(this.$u?"UTC":""),d=(u={},u[o]=f+"Date",u[l]=f+"Date",u[h]=f+"Month",u[a]=f+"FullYear",u[s]=f+"Hours",u[r]=f+"Minutes",u[i]=f+"Seconds",u[e]=f+"Milliseconds",u)[c],p=c===o?this.$D+(n-this.$W):n;if(c===h||c===a){var m=this.clone().set(l,1);m.$d[d](p),m.init(),this.$d=m.set(l,Math.min(this.$D,m.daysInMonth())).$d}else d&&this.$d[d](p);return this.init(),this},w.set=function(t,n){return this.clone().$set(t,n)},w.get=function(t){return this[E.p(t)]()},w.add=function(e,c){var l,f=this;e=Number(e);var d=E.p(c),p=function(t){var n=S(f);return E.w(n.date(n.date()+Math.round(t*e)),f)};if(d===h)return this.set(h,this.$M+e);if(d===a)return this.set(a,this.$y+e);if(d===o)return p(1);if(d===u)return p(7);var m=(l={},l[r]=t,l[s]=n,l[i]=1e3,l)[d]||1,w=this.$d.getTime()+e*m;return E.w(w,this)},w.subtract=function(t,n){return this.add(-1*t,n)},w.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||f;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=E.z(this),s=this.$H,o=this.$m,u=this.$M,h=e.weekdays,c=e.months,a=function(t,e,r,s){return t&&(t[e]||t(n,i))||r[e].substr(0,s)},l=function(t){return E.s(s%12||12,t,"0")},d=e.meridiem||function(t,n,e){var i=t<12?"AM":"PM";return e?i.toLowerCase():i},m={YY:String(this.$y).slice(-2),YYYY:this.$y,M:u+1,MM:E.s(u+1,2,"0"),MMM:a(e.monthsShort,u,c,3),MMMM:a(c,u),D:this.$D,DD:E.s(this.$D,2,"0"),d:String(this.$W),dd:a(e.weekdaysMin,this.$W,h,2),ddd:a(e.weekdaysShort,this.$W,h,3),dddd:h[this.$W],H:String(s),HH:E.s(s,2,"0"),h:l(1),hh:l(2),a:d(s,o,!0),A:d(s,o,!1),m:String(o),mm:E.s(o,2,"0"),s:String(this.$s),ss:E.s(this.$s,2,"0"),SSS:E.s(this.$ms,3,"0"),Z:r};return i.replace(p,(function(t,n){return n||m[t]||r.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(e,l,f){var d,p=E.p(l),m=S(e),w=(m.utcOffset()-this.utcOffset())*t,v=this-m,g=E.m(this,m);return g=(d={},d[a]=g/12,d[h]=g,d[c]=g/3,d[u]=(v-w)/6048e5,d[o]=(v-w)/864e5,d[s]=v/n,d[r]=v/t,d[i]=v/1e3,d)[p]||v,f?g:E.a(g)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return y[this.$L]},w.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),i=_(t,n,!0);return i&&(e.$L=i),e},w.clone=function(){return E.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},m}(),k=I.prototype;return S.prototype=k,[["$ms",e],["$s",i],["$m",r],["$H",s],["$W",o],["$M",h],["$y",a],["$D",l]].forEach((function(t){k[t[1]]=function(n){return this.$g(n,t[0],t[1])}})),S.extend=function(t,n){return t.$i||(t(n,I,S),t.$i=!0),S},S.locale=_,S.isDayjs=b,S.unix=function(t){return S(1e3*t)},S.en=y[g],S.Ls=y,S.p={},S}()}));function yc(t){const n=(t.photo_link||[]).map((t=>({id:t.number,src:t.src,caption:t.caption,serviceId:t.service_id,serviceName:t.service_name,stylistId:t.beautician_id,stylistName:t.beautician_name})));return{id:t.id,name:t.name,description:t.description,price:Number(t.price_info),isPriceUp:Boolean(t.price_up),hidePrice:Boolean(t.hide_price_from_public),duration:t.time_info?Number(t.time_info):0,hideDuration:Boolean(t.hide_duration_from_public),photos:n}}function bc(t){const n=t.rating_percent?Number(t.rating_percent):0,{first_name:e,last_name:i,mobile_phone:r,avatar:s,full_profile_image:o}=t.user||{},u=[e,i].filter((t=>!!t));return{id:Number(t.id),firstName:e,lastName:i,fullName:u.length>0?u.join(" "):t.email,avatar:s||o,phone:r,expertise:Boolean(t.expertise),rating:Math.ceil(5*n/100)}}function _c(t){const{user:n}=t,e=t.rating_percent?Number(t.rating_percent):0,i=[n.first_name,n.last_name].filter((t=>!!t));return{id:Number(t.id),firstName:n.first_name,lastName:n.last_name,fullName:i.length>0?i.join(" "):t.fullName||t.name||t.title,avatar:n.full_avatar||n.full_profile_image_thumb,phone:n.mobile_phone,expertise:Boolean(t.expertise),rating:Math.ceil(5*e/100)}}function Sc(t){const n=[t.first_name,t.last_name].filter((t=>!!t));return{id:t.id||t.user_id,firstName:t.first_name,lastName:t.last_name,fullName:n.length>0?n.join(" "):t.fullName||t.name||t.username,avatar:t.avatar||t.full_profile_image_thumb}}!function(t){t[t.Photo=0]="Photo",t[t.Video=1]="Video"}(vc||(vc={}));class Ec{constructor(t){Object.assign(this,t)}}function Ic(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?gc(`${n} ${e}`,Ne).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?gc(`${r} ${s}`,Ne).valueOf():null,u=t.media_type===vc.Video||t.full_image_url.indexOf(".mp4")>-1;return new Ec({id:t.id,caption:t.caption,description:t.description,createdDate:i,updatedDate:o,mediaUrl:t.full_image_url,imageThumb:u?null:t.full_image_url_thumb,imageThumbMedium:u?null:t.full_image_url_medium,imageWidth:u?400:t.img_w,imageHeight:u?300:t.img_h,mediaType:u?vc.Video:t.media_type,totalLike:t.total_like,totalDislike:t.total_dislike,totalShare:t.total_shared,totalView:t.view_count,totalBooking:t.total_booking})}class kc{constructor(t){Object.assign(this,t)}}function Cc(t){return new kc({id:t.id,name:t.name,caption:t.caption,description:t.description,tags:t.tags?t.tags.filter((t=>!!t)):[],salonId:t.salon_id,stylistId:t.stylist_id,totalMedias:t.total_medias||0,service:t.service?yc(t.service):null,isPublic:void 0===t.is_public||Boolean(t.is_public)})}class jc{constructor(t){Object.assign(this,t)}}function Oc(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?gc(`${n} ${e}`,Ne).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?gc(`${r} ${s}`,Ne).valueOf():null;return new jc({id:t.id,type:t.type,title:t.content,description:t.description,createdDate:i,updatedDate:o,parentCommentId:t.parentCommentId,childComments:t.child_comment?t.child_comment.map(Oc):[],user:Sc(t.user)})}class Mc{constructor(t){Object.assign(this,t)}}function Tc(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?gc(`${n} ${e}`,Ne).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?gc(`${r} ${s}`,Ne).valueOf():null,u=[Ic(t)].concat(t.album_medias?t.album_medias.map(Ic).filter((n=>n.id!==t.id)):[]),{total_booked:h,total_like:c,total_share:a,total_view:l}=t.style_activity||{};return new Mc({id:t.id,caption:t.caption,description:t.description,createdDate:i,updatedDate:o,imageUrl:t.full_image_url,imageThumb:t.full_image_url_thumb,imageThumbMedium:t.full_image_url_medium,imageWidth:t.img_w,imageHeight:t.img_h,mediaType:t.media_type,isPublic:void 0===t.is_public||Boolean(t.is_public),totalBooking:h||0,totalLike:c||0,totalDislike:t.total_dislike||0,totalShare:a||0,totalView:l||0,albumMedias:u,album:t.album?Cc(t.album):null,owner:t.user?Sc(t.user):null,salonId:t.salon_id?Number(t.salon_id):null,salon:t.salon?$e(t.salon):null,stylistId:t.stylist_id?Number(t.stylist_id):null,stylist:t.stylist?_c(t.stylist):null,isLiked:t.my_activity&&t.my_activity.liked,serviceId:t.service_id?Number(t.service_id):null,salonServiceId:t.category_service_id?Number(t.category_service_id):null,productBrand:t.product_brand_used||""})}function Dc({mediaType:t}){return t===vc.Video}function Nc(t){return{id:t.id,caption:t.caption,imageUrl:t.full_image_url,imageUrlThumb:t.full_image_url_thumb}}function Ac(t){const n=t.review_photo||[],[e,i]=String(t.create_date).split(" "),[r,s]=String(t.update_date).split(" ");return{title:t.title,description:t.comment,createdDate:gc(`${e} ${i}`,Ne).valueOf(),updatedDate:gc(`${r} ${s}`,Ne).valueOf(),point:Math.ceil(Number(t.avg_point)),pointView:t.view_point,pointPrice:t.price_point,pointProduct:t.product_point,pointProfessional:t.professional_point,like:t.like,report:t.report,helpful:t.helpful,recommend:t.recommend,user:t.user?Sc(t.user):null,salon:t.salon?$e(t.salon):null,stylist:t.stylist&&t.stylist.user?bc(t.stylist):null,photos:n.map(Nc)}}class Rc{constructor(t){Object.assign(this,t)}}function $c(t){return new Rc({id:t.id,uid:t.firebase_room_id,members:t.from_user&&t.to_user?[Sc(t.from_user),Sc(t.to_user)]:[],messages:[]})}const xc="api-ver2",Pc="favesalon--messages";class Lc{constructor(){this.http=null,this.http=De.create({baseURL:"https://favesalon.com",headers:{}});try{this.firebaseApp||(this.firebaseApp=Xi({apiKey:"AIzaSyD5IdiIA9QUZeguRbi8DEZ25TrNXPU3-uI",authDomain:"favestyle-b57d4.firebaseapp.com",databaseURL:"https://favestyle-b57d4.firebaseio.com",projectId:"favestyle-b57d4",storageBucket:"favestyle-b57d4.appspot.com",messagingSenderId:"105638847842",appId:"1:105638847842:web:35f50dfe0e8eb52f46783b"})),this.firebaseDatabase=wc(this.firebaseApp)}catch(t){}}fetchStyleDetail(t){return this.http.get(`${xc}/style/${t}/detail`).then((t=>{const{status:n,data:e}=t.data;if(n){let t=null,n=[];try{t=Tc(e),n=(e.style_similars||[]).map(Tc)}catch(t){}return{styleInfo:t,similarStyles:n}}return{styleInfo:null,similarStyles:[]}})).catch((()=>({styleInfo:null,similarStyles:[]})))}fetchSalonInfo(t){return this.http.get(`${xc}/salon/${t}/detail`).then((t=>{const{status:n,data:e}=t.data;return n&&e?$e(e):null})).catch((()=>null))}fetchSalonLatestStyles(t,n){return this.http.post(`${xc}/salon/${t}/styles`,Object.assign(Object.assign({},n),{sort:"newest"})).then((t=>{const{data:e}=t.data;return(e||[]).slice(0,n.limit).map(Tc)})).catch((()=>[]))}decorateServiceGroups(t){return t.map(((t,n)=>{const e=t.name,i=`${t.service_id}-${String(e).toLowerCase().split(" ").join("-")}-${t.order}-index-${n}`,r=Bn(t.service_groups,[t=>t.order]);return{id:i,name:e,type:"category",data:r.map(((t,n)=>({key:`${i}-${String(t.name).toLowerCase().split(" ").join("-")}-${t.order}-index-${n}`,name:t.category,type:"sub-category",data:(t.services||[]).map((t=>{const n=yc(t);return Object.assign(Object.assign({},n),{type:"service"})}))})))}}))}fetchSalonServices(t){return this.http.get(`api/salon/services?v=2&id=${t}`).then((t=>{const{status:n,data:e}=t.data;return n?this.decorateServiceGroups(e||[]):[]})).catch((()=>[]))}fetchSalonStylists(t,n={page:1,limit:12}){return this.http.get(`${xc}/salon/${t}/stylists?page=${n.page}&limit=${n.limit}`).then((t=>{const{paging:n,data:e}=t.data;return{total:n.total_item||e.length,data:e.map(bc)}})).catch((()=>({total:0,data:[]})))}fetchSalonReviews(t,n){return this.http.post(`${xc}/salon/${t}/reviews`,Object.assign({avg_point_greater_than:0},n)).then((t=>{const{data:n,paging:e}=t.data||{},{total_1star:i,total_2star:r,total_3star:s,total_4star:o,total_5star:u,total_review:h,avg_point:c}=e.review_detail||{};return{total:e.total_item||0,stats:{totalReviews:h,reviewPoint:c?Math.ceil(c):0,1:i?Math.ceil(i):0,2:r?Math.ceil(r):0,3:s?Math.ceil(s):0,4:o?Math.ceil(o):0,5:u?Math.ceil(u):0},data:n.map(Ac)}})).catch((()=>({total:0,stats:{},data:[]})))}fetchSalonCategories(){return this.http.post(`${xc}/search/get-services`,{limit:50}).then((t=>{const{status:n,data:e}=t.data;return n?(e||[]).map((t=>({id:t.id,name:t.name,image:t.full_image,imageThumb:t.full_thumb_image}))):[]})).catch((()=>[]))}fetchSalonLookbooks(t,n){const e={total:0,allLookbooks:[]},i=`${xc}/salon/${t}/styles`,r=Object.assign({page:1,limit:20},n);return this.http.post(i,r).then((t=>{const{status:n,data:i,paging:r}=t.data;return n?{total:r.total_item||0,allLookbooks:(i||[]).map(Tc)}:e})).catch((()=>e))}fetchStyleComments(t){return this.http.get(`${xc}/style/comment?photo_id=${t}`).then((t=>{const{paging:n,data:e}=t.data;return{total:n.total_item||0,data:e.map(Oc)}})).catch((()=>({total:0,data:[]})))}createChatRoom(t,n){return this.http.get(`${xc}/chatroom/create/${t}?access_token=${n}`).then((t=>$c(st(t,"data.data",{})))).catch((()=>null))}fetchRooms(t,n,e=[]){return this.http.get(`${xc}/chatroom/get?page=${n}&limit=20&access_token=${t}`).then((i=>{const r=st(i,"data.data",[]).map($c);return r.length>=20?this.fetchRooms(t,n+1,e.concat(r)):1===n?r:e.concat(r)}))}fetchChatRooms(t){return this.fetchRooms(t,1).catch((()=>[]))}fetchChatMessages(t,n){if(this.firebaseDatabase)try{(function(t,n,e,i,r){let s;if("object"==typeof i&&(s=void 0,r=i),"function"==typeof i&&(s=i),r&&r.onlyOnce){const n=e,i=(e,i)=>{Uh(t._repo,t,u),n(e,i)};i.userCallback=e.userCallback,i.context=e.context,e=i}const o=new ic(e,s||void 0),u="value"===n?new ac(o):new lc(n,o);!function(t,n,e){let i;i=".info"===ds(n._path)?Bu(t.infoSyncTree_,n,e):Bu(t.serverSyncTree_,n,e),jh(t.eventQueue_,n._path,i)}(t._repo,t,u)})(uc(this.firebaseDatabase,`${Pc}/${t}`),"value",(t=>{const e=[];$t(t.val(),((t,n)=>{const i={uid:(r=Object.assign(Object.assign({},t),{uid:n})).uid,message:r.message,timestamp:r.timestamp,unRead:r.unRead,senderId:r.senderId};var r;e.push(i)})),n(Bn(e,"timestamp"))}),void 0,void 0)}catch(t){n([])}return Promise.resolve({})}markMessagesAsRead(t,n){if(this.firebaseDatabase)try{const e=uc(this.firebaseDatabase,`${Pc}/${t}`),i={};return n.forEach((t=>{const n=function(t,n){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&n.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(e[i[r]]=t[i[r]])}return e}(t,["uid"]);i[`${t.uid}`]=Object.assign(Object.assign({},n),{unRead:0})})),cc(e,i)}catch(t){}return Promise.reject()}sendChatMessage(t){if(this.firebaseDatabase)try{const{message:n,senderId:e,chatRoomId:i}=t,r=uc(this.firebaseDatabase,`${Pc}`),s=function(t,n){t=fi(t),Ih("push",t._path),_h("push",n,t._path,!0);const e=Ah(t._repo),i=tc(e),r=hc(t,i),s=hc(t,i);let o;return o=null!=n?function(t,n){t=fi(t),Ih("set",t._path),_h("set",n,t._path,!1);const e=new Ke;return function(t,n,e,i,r){Fh(t,"set",{path:n.toString(),value:e,priority:null});const s=Rh(t),o=ro(e,null),u=qu(t.serverSyncTree_,n),h=sh(o,u,s),c=Lh(t),a=Pu(t.serverSyncTree_,n,h,c,!0);Ch(t.eventQueue_,a),t.server_.put(n.toString(),o.val(!0),((e,i)=>{const s="ok"===e;s||Cr("set at "+n+" failed: "+e);const o=Lu(t.serverSyncTree_,c,!s);Oh(t.eventQueue_,n,o),Bh(0,r,e,i)}));const l=Kh(t,n);Hh(t,l),Oh(t.eventQueue_,l,[])}(t._repo,t._path,n,0,e.wrapCallback((()=>{}))),e.promise}(s,n).then((()=>s)):Promise.resolve(s),r.then=o.then.bind(o),r.catch=o.then.bind(o,void 0),r}(hc(r,i)).key,o=`/${i}/${s}`,u={message:n,unRead:1,senderId:e,timestamp:gc().valueOf()};return cc(r,{[o]:u}).then((()=>Object.assign(Object.assign({},u),{uid:s})))}catch(t){}return Promise.reject()}}const Uc=()=>new Lc;export{Re as B,Uc as H,Bn as a,gc as d,xe as g,Dc as i,Ae as s}