favesalon-embed 1.0.2 → 1.0.4
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.
- package/dist/{favesalon-embed/_commonjsHelpers-a4f66ccd.js → cjs/_commonjsHelpers-5cfcba41.js} +6 -14
- package/dist/cjs/chat-box_5.cjs.entry.js +17439 -0
- package/dist/cjs/chat-button.cjs.entry.js +55 -0
- package/dist/cjs/colors-38421769.js +69 -0
- package/dist/cjs/favesalon-embed.cjs.js +23 -0
- package/dist/cjs/google-map.cjs.entry.js +52 -0
- package/dist/cjs/index-7f190886.js +4396 -0
- package/dist/cjs/index-dd8176c4.js +1531 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/cjs/relativeTime-3721080d.js +9 -0
- package/dist/cjs/salon-booking-modal.cjs.entry.js +30 -0
- package/dist/cjs/salon-booking.cjs.entry.js +51 -0
- package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
- package/dist/cjs/salon-gift-card.cjs.entry.js +51 -0
- package/dist/cjs/salon-info.cjs.entry.js +33 -0
- package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
- package/dist/cjs/salon-latest-styles_3.cjs.entry.js +241 -0
- package/dist/cjs/salon-lookbook.cjs.entry.js +222 -0
- package/dist/cjs/salon-ranking.cjs.entry.js +60 -0
- package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
- package/dist/cjs/salon-services.cjs.entry.js +81 -0
- package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
- package/dist/cjs/services-d1bdf299.js +21494 -0
- package/dist/cjs/style-detail.cjs.entry.js +312 -0
- package/dist/cjs/utils-c5a33b3c.js +23 -0
- package/dist/collection/collection-manifest.json +33 -0
- package/dist/collection/components/chat-box/index.css +105 -0
- package/dist/collection/components/chat-box/index.js +138 -0
- package/dist/collection/components/chat-button/index.css +101 -0
- package/dist/collection/components/chat-button/index.js +155 -0
- package/dist/collection/components/chat-form/index.css +40 -0
- package/dist/collection/components/chat-form/index.js +79 -0
- package/dist/collection/components/chat-messages/index.css +48 -0
- package/dist/collection/components/chat-messages/index.js +142 -0
- package/dist/collection/components/chat-rooms/index.css +102 -0
- package/dist/collection/components/chat-rooms/index.js +157 -0
- package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
- package/dist/collection/components/google-map/index.css +5 -0
- package/dist/collection/components/google-map/index.js +90 -0
- package/dist/collection/components/salon-booking/index.css +30 -0
- package/dist/collection/components/salon-booking/index.js +126 -0
- package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
- package/dist/collection/components/salon-gift-card/index.css +30 -0
- package/dist/collection/components/salon-gift-card/index.js +126 -0
- package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
- package/dist/collection/components/salon-info/index.css +1 -0
- package/dist/collection/components/salon-info/index.js +77 -0
- package/dist/collection/components/salon-latest-reviews/index.css +11 -0
- package/dist/collection/components/salon-latest-reviews/index.js +163 -0
- package/dist/collection/components/salon-latest-styles/index.css +12 -0
- package/dist/{favesalon-embed/salon-latest-styles.entry.js → collection/components/salon-latest-styles/index.js} +99 -14
- package/dist/collection/components/salon-locations/index.css +24 -0
- package/dist/{favesalon-embed/salon-locations.entry.js → collection/components/salon-locations/index.js} +95 -15
- package/dist/collection/components/salon-lookbook/index.css +15 -0
- package/dist/collection/components/salon-lookbook/index.js +368 -0
- package/dist/collection/components/salon-ranking/index.css +3 -0
- package/dist/collection/components/salon-ranking/index.js +117 -0
- package/dist/collection/components/salon-reviews/index.css +18 -0
- package/dist/collection/components/salon-reviews/index.js +249 -0
- package/dist/collection/components/salon-schedules/index.css +18 -0
- package/dist/{favesalon-embed/salon-schedules.entry.js → collection/components/salon-schedules/index.js} +95 -14
- package/dist/collection/components/salon-services/index.css +1 -0
- package/dist/collection/components/salon-services/index.js +146 -0
- package/dist/collection/components/salon-stylists/index.css +43 -0
- package/dist/collection/components/salon-stylists/index.js +184 -0
- package/dist/collection/components/style-detail/index.css +76 -0
- package/dist/collection/components/style-detail/index.js +386 -0
- package/dist/collection/components/user-avatar/index.css +0 -0
- package/dist/collection/components/user-avatar/index.js +159 -0
- package/dist/collection/constants/colors.js +65 -0
- package/dist/collection/global/global.js +0 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/mocks/users.js +10 -0
- package/dist/collection/services/services.js +295 -0
- package/dist/collection/types/chat.js +23 -0
- package/dist/collection/types/common.js +11 -0
- package/dist/collection/types/review.js +39 -0
- package/dist/collection/types/salon.js +58 -0
- package/dist/collection/types/service.js +24 -0
- package/dist/collection/types/style.js +128 -0
- package/dist/collection/types/stylist.js +30 -0
- package/dist/collection/types/user.js +10 -0
- package/dist/collection/utils/utils.js +23 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +44974 -0
- package/dist/esm/_commonjsHelpers-66ac50f5.js +32 -0
- package/dist/esm/chat-box_5.entry.js +17431 -0
- package/dist/{favesalon-embed → esm}/chat-button.entry.js +5 -10
- package/dist/esm/favesalon-embed.js +18 -0
- package/dist/{favesalon-embed → esm}/google-map.entry.js +1 -1
- package/dist/esm/index-0494771f.js +1504 -0
- package/dist/{favesalon-embed/index-00b83e1c.js → esm/index-a1c7583c.js} +15 -425
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +18 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/relativeTime-baa50aa2.js +7 -0
- package/dist/{favesalon-embed → esm}/salon-booking-modal.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-booking.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-gift-card-modal.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-gift-card.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-info.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-latest-reviews.entry.js +4 -4
- package/dist/esm/salon-latest-styles_3.entry.js +235 -0
- package/dist/{favesalon-embed → esm}/salon-lookbook.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-ranking.entry.js +1 -1
- package/dist/{favesalon-embed → esm}/salon-reviews.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-services.entry.js +3 -3
- package/dist/{favesalon-embed → esm}/salon-stylists.entry.js +3 -3
- package/dist/{favesalon-embed/services-7cb8f2a6.js → esm/services-257442e2.js} +99 -2467
- package/dist/{favesalon-embed → esm}/style-detail.entry.js +4 -4
- package/dist/{favesalon-embed/utils-7de9628a.js → esm/utils-e97485e0.js} +0 -3
- package/dist/favesalon-embed/favesalon-embed.css +1 -2439
- package/dist/favesalon-embed/favesalon-embed.esm.js +1 -148
- package/dist/favesalon-embed/index.esm.js +0 -1
- package/dist/favesalon-embed/p-05a1c88a.entry.js +1 -0
- package/dist/favesalon-embed/p-0acf0447.entry.js +1 -0
- package/dist/favesalon-embed/p-0bc4f624.js +1 -0
- package/dist/favesalon-embed/p-1af1515f.entry.js +1 -0
- package/dist/favesalon-embed/p-1cba5fc9.entry.js +1 -0
- package/dist/favesalon-embed/p-39a4ef15.entry.js +1 -0
- package/dist/favesalon-embed/p-3e2cb05b.entry.js +1 -0
- package/dist/favesalon-embed/p-47e646f8.js +1 -0
- package/dist/favesalon-embed/p-487b311f.entry.js +1 -0
- package/dist/favesalon-embed/p-55387c2f.entry.js +1 -0
- package/dist/favesalon-embed/p-566f05b4.entry.js +1 -0
- package/dist/favesalon-embed/p-862a0de0.entry.js +1 -0
- package/dist/favesalon-embed/p-9fe0cbeb.js +2 -0
- package/dist/favesalon-embed/p-a33331cc.js +1 -0
- package/dist/favesalon-embed/p-aeeb7b5f.entry.js +1 -0
- package/dist/favesalon-embed/p-b08e5b54.js +6 -0
- package/dist/favesalon-embed/p-b5cca5fc.entry.js +1 -0
- package/dist/favesalon-embed/p-c7fb7af5.js +1580 -0
- package/dist/favesalon-embed/p-ccab56d8.js +1 -0
- package/dist/favesalon-embed/p-d6e13053.entry.js +1 -0
- package/dist/favesalon-embed/p-dee42d34.entry.js +1 -0
- package/dist/favesalon-embed/p-e661ca1d.entry.js +1 -0
- package/dist/favesalon-embed/p-eeceab9c.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/chat-box/index.d.ts +12 -0
- package/dist/types/components/chat-rooms/index.d.ts +12 -0
- package/dist/types/components/user-avatar/index.d.ts +2 -1
- package/dist/types/components.d.ts +45 -2
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/favesalon-embed/app-globals-15861a7f.js +0 -712
- package/dist/favesalon-embed/app-globals-270fe240.js +0 -712
- package/dist/favesalon-embed/app-globals-437cc3f3.js +0 -712
- package/dist/favesalon-embed/app-globals-b8b0fc7a.js +0 -712
- package/dist/favesalon-embed/chat-form.entry.js +0 -39
- package/dist/favesalon-embed/chat-messages.entry.js +0 -51
- package/dist/favesalon-embed/css-shim-b7d3d95f.js +0 -4
- package/dist/favesalon-embed/dom-64053c71.js +0 -73
- package/dist/favesalon-embed/index-888e99e3.js +0 -3371
- package/dist/favesalon-embed/index-9ad82b12.js +0 -3371
- package/dist/favesalon-embed/index-aa906326.js +0 -3371
- package/dist/favesalon-embed/index-b97af793.js +0 -3371
- package/dist/favesalon-embed/relativeTime-268e64b0.js +0 -7
- package/dist/favesalon-embed/shadow-css-98135883.js +0 -387
- package/dist/favesalon-embed/user-avatar.entry.js +0 -42
- /package/dist/{favesalon-embed → esm}/colors-ea36347a.js +0 -0
|
@@ -0,0 +1,1580 @@
|
|
|
1
|
+
import{a as t,c as n}from"./p-0bc4f624.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)\]/,b=/^\w*$/,y=function(t,n){if(r(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!v(t))||b.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\]$/,M=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O=function(t){return!(!_(t)||(n=t,I&&I in n))&&(S(t)?M: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 O(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:y(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 bt,yt,_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,Mt=(bt=Object.keys,yt=Object,function(t){return bt(yt(t))}),Ot=Object.prototype.hasOwnProperty,Tt=function(t){if((n=t)!==("function"==typeof(e=n&&n.constructor)&&e.prototype||jt))return Mt(t);var n,e,i=[];for(var r in Object(t))Ot.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 bn=gn,yn="[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:bn(t),a=h?_n:bn(n),l=(c=c==yn?Sn:c)==Sn,f=(a=a==yn?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,b=n.constructor;g==b||!("constructor"in t)||!("constructor"in n)||"function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b||(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))}},Mn=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)}},On=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,On)},Dn=function(t){return y(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],y(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)}):Mn(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},be="0.22.0",ye=be,_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"+ye+"] 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 Me=je,Oe=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);Oe.Axios=Ce,Oe.Cancel=he,Oe.CancelToken=Me,Oe.isCancel=me,Oe.VERSION=be,Oe.all=function(t){return Promise.all(t)},Oe.spread=function(t){return function(n){return t.apply(null,n)}},Oe.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError};var Te=Oe;Te.default=Oe;var De=Te;const Ne="YYYY-MM-DD",Ae="YYYY-MM-DD HH:mm:ss",Re="ddd, MMM DD YYYY";var $e;function xe(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 Pe({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"}($e||($e={}));const Le=function(t,n){if(!t)throw Ue(n)},Ue=function(t){return new Error("Firebase Database (${JSCORE_VERSION}) INTERNAL ASSERT FAILED: "+t)},Fe=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},Be={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(Fe(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 qe;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 qe extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const We=function(t){const n=Fe(t);return Be.encodeByteArray(n,!0)},He=function(t){return We(t).replace(/\./g,"")},ze=function(t){try{return Be.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 Ve(t){return Ye(void 0,t)}function Ye(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]=Ye(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 Je=()=>{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&&ze(t[1]);return n&&JSON.parse(n)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},Ke=()=>{var t;return null===(t=Je())||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 Ge{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 Xe(){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 Ze extends Error{constructor(t,n,e){super(n),this.code=t,this.customData=e,this.name="FirebaseError",Object.setPrototypeOf(this,Ze.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Qe.prototype.create)}}class Qe{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(ti,((t,e)=>{const i=n[e];return null!=i?String(i):`<${e}?>`}))}(r,e):"Error";return new Ze(i,`${this.serviceName}: ${s} (${i}).`,e)}}const ti=/\{\$([^}]+)}/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 ni(t){return JSON.parse(t)}function ei(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 ii=function(t){let n={},e={},i={},r="";try{const s=t.split(".");n=ni(ze(s[0])||""),e=ni(ze(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 ri(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function si(t,n){return Object.prototype.hasOwnProperty.call(t,n)?t[n]:void 0}function oi(t){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n))return!1;return!0}function ui(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 hi(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(ci(e)&&ci(s)){if(!hi(e,s))return!1}else if(e!==s)return!1}for(const t of i)if(!e.includes(t))return!1;return!0}function ci(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 ai{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 li(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 fi=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 di(t){return t&&t._delegate?t._delegate:t}class pi{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 mi="[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 wi{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 Ge;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:mi})}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=mi){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=mi){return this.instances.has(t)}getOptions(t=mi){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===mi?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=mi){return this.component?this.component.multipleInstances?t:mi:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class vi{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 wi(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 gi;!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"}(gi||(gi={}));const bi={debug:gi.DEBUG,verbose:gi.VERBOSE,info:gi.INFO,warn:gi.WARN,error:gi.ERROR,silent:gi.SILENT},yi=gi.INFO,_i={[gi.DEBUG]:"log",[gi.VERBOSE]:"log",[gi.INFO]:"info",[gi.WARN]:"warn",[gi.ERROR]:"error"},Si=(t,n,...e)=>{if(n<t.logLevel)return;const i=(new Date).toISOString(),r=_i[n];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${n})`);console[r](`[${i}] ${t.name}:`,...e)};class Ei{constructor(t){this.name=t,this._logLevel=yi,this._logHandler=Si,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in gi))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?bi[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,gi.DEBUG,...t),this._logHandler(this,gi.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,gi.VERBOSE,...t),this._logHandler(this,gi.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,gi.INFO,...t),this._logHandler(this,gi.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,gi.WARN,...t),this._logHandler(this,gi.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,gi.ERROR,...t),this._logHandler(this,gi.ERROR,...t)}}let Ii,ki;const Ci=new WeakMap,ji=new WeakMap,Mi=new WeakMap,Oi=new WeakMap,Ti=new WeakMap;let Di={get(t,n,e){if(t instanceof IDBTransaction){if("done"===n)return ji.get(t);if("objectStoreNames"===n)return t.objectStoreNames||Mi.get(t);if("store"===n)return e.objectStoreNames[1]?void 0:e.objectStore(e.objectStoreNames[0])}return Ai(t[n])},set:(t,n,e)=>(t[n]=e,!0),has:(t,n)=>t instanceof IDBTransaction&&("done"===n||"store"===n)||n in t};function Ni(t){return"function"==typeof t?function(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ki||(ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...n){return t.apply(Ri(this),n),Ai(Ci.get(this))}:function(...n){return Ai(t.apply(Ri(this),n))}:function(n,...e){const i=t.call(Ri(this),n,...e);return Mi.set(i,n.sort?n.sort():[n]),Ai(i)}}(t):(t instanceof IDBTransaction&&function(t){if(ji.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)}));ji.set(t,n)}(t),n=t,(Ii||(Ii=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>n instanceof t))?new Proxy(t,Di):t);var n}function Ai(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(Ai(t.result)),i()},s=()=>{e(t.error),i()};t.addEventListener("success",r),t.addEventListener("error",s)}));return n.then((n=>{n instanceof IDBCursor&&Ci.set(n,t)})).catch((()=>{})),Ti.set(n,t),n}(t);if(Oi.has(t))return Oi.get(t);const n=Ni(t);return n!==t&&(Oi.set(t,n),Ti.set(n,t)),n}const Ri=t=>Ti.get(t),$i=["get","getKey","getAll","getAllKeys","count"],xi=["put","add","delete","clear"],Pi=new Map;function Li(t,n){if(!(t instanceof IDBDatabase)||n in t||"string"!=typeof n)return;if(Pi.get(n))return Pi.get(n);const e=n.replace(/FromIndex$/,""),i=n!==e,r=xi.includes(e);if(!(e in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!$i.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 Pi.set(n,s),s}var Ui;Ui=Di,Di={...Ui,get:(t,n,e)=>Li(t,n)||Ui.get(t,n,e),has:(t,n)=>!!Li(t,n)||Ui.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 Fi{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 Bi="@firebase/app",qi="0.9.14",Wi=new Ei("@firebase/app"),Hi="[DEFAULT]",zi={[Bi]:"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"},Vi=new Map,Yi=new Map;function Ji(t,n){try{t.container.addComponent(n)}catch(e){Wi.debug(`Component ${n.name} failed to register with FirebaseApp ${t.name}`,e)}}function Ki(t){const n=t.name;if(Yi.has(n))return Wi.debug(`There were multiple attempts to register component ${n}.`),!1;Yi.set(n,t);for(const n of Vi.values())Ji(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 Gi=new Qe("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 Xi{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 pi("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 Gi.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 Zi(t,n={}){let e=t;"object"!=typeof n&&(n={name:n});const i=Object.assign({name:Hi,automaticDataCollectionEnabled:!1},n),r=i.name;if("string"!=typeof r||!r)throw Gi.create("bad-app-name",{appName:String(r)});if(e||(e=Ke()),!e)throw Gi.create("no-options");const s=Vi.get(r);if(s){if(hi(e,s.options)&&hi(i,s.config))return s;throw Gi.create("duplicate-app",{appName:r})}const o=new vi(r);for(const t of Yi.values())o.addComponent(t);const u=new Xi(e,i,o);return Vi.set(r,u),u}function Qi(t,n,e){var i;let r=null!==(i=zi[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 Wi.warn(t.join(" "))}Ki(new pi(`${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 tr="firebase-heartbeat-store";let nr=null;function er(){return nr||(nr=function(t,n,{blocked:e,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(t,n),u=Ai(o);return i&&o.addEventListener("upgradeneeded",(t=>{i(Ai(o.result),t.oldVersion,t.newVersion,Ai(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(tr)}}).catch((t=>{throw Gi.create("idb-open",{originalErrorMessage:t.message})}))),nr}async function ir(t,n){try{const e=(await er()).transaction(tr,"readwrite"),i=e.objectStore(tr);await i.put(n,rr(t)),await e.done}catch(t){if(t instanceof Ze)Wi.warn(t.message);else{const n=Gi.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});Wi.warn(n.message)}}}function rr(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 sr{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new ur(n),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=or();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=or(),{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),hr(e)>n){t.dates.pop();break}}else if(e.push({agent:r.agent,dates:[r.date]}),hr(e)>n){e.pop();break}i=i.slice(1)}return{heartbeatsToSend:e,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=He(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 or(){return(new Date).toISOString().substring(0,10)}class ur{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 er();return await n.transaction(tr).objectStore(tr).get(rr(t))}catch(t){if(t instanceof Ze)Wi.warn(t.message);else{const n=Gi.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});Wi.warn(n.message)}}}(this.app)||{heartbeats:[]}}async overwrite(t){var n;if(await this._canUseIndexedDBPromise){const e=await this.read();return ir(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 ir(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:e.lastSentHeartbeatDate,heartbeats:[...e.heartbeats,...t.heartbeats]})}}}function hr(t){return He(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
|
+
*/Ki(new pi("platform-logger",(t=>new Fi(t)),"PRIVATE")),Ki(new pi("heartbeat",(t=>new sr(t)),"PRIVATE")),Qi(Bi,qi,""),Qi(Bi,qi,"esm2017"),Qi("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
|
+
Qi("firebase","10.0.0","app");const cr="@firebase/database",ar="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 lr="";
|
|
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 fr{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),ei(n))}get(t){const n=this.domStorage_.getItem(this.prefixedName_(t));return null==n?null:ni(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 dr{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,n){null==n?delete this.cache_[t]:this.cache_[t]=n}get(t){return ri(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 pr=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 fr(n)}}catch(t){}return new dr},mr=pr("localStorage"),wr=pr("sessionStorage"),vr=new Ei("@firebase/database"),gr=function(){let t=1;return function(){return t++}}(),br=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++,Le(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 ai;e.update(n);const i=e.digest();return Be.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?ei(i):i,n+=" "}return n};let _r=null,Sr=!0;const Er=function(...t){if(!0===Sr&&(Sr=!1,null===_r&&!0===wr.get("logging_enabled")&&(!0,Le(!0,"Can't turn on custom loggers persistently."),vr.logLevel=gi.VERBOSE,_r=vr.log.bind(vr))),_r){const n=yr.apply(null,t);_r(n)}},Ir=function(t){return function(...n){Er(t,...n)}},kr=function(...t){const n="FIREBASE INTERNAL ERROR: "+yr(...t);vr.error(n)},Cr=function(...t){const n=`FIREBASE FATAL ERROR: ${yr(...t)}`;throw vr.error(n),new Error(n)},jr=function(...t){const n="FIREBASE WARNING: "+yr(...t);vr.warn(n)},Mr=function(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},Or="[MIN_NAME]",Tr="[MAX_NAME]",Dr=function(t,n){if(t===n)return 0;if(t===Or||n===Tr)return-1;if(n===Or||t===Tr)return 1;{const e=Ur(t),i=Ur(n);return null!==e?null!==i?e-i==0?t.length-n.length:e-i:-1:null!==i?1:t<n?-1:1}},Nr=function(t,n){return t===n?0:t<n?-1:1},Ar=function(t,n){if(n&&t in n)return n[t];throw new Error("Missing required key ("+t+") in object: "+ei(n))},Rr=function(t){if("object"!=typeof t||null===t)return ei(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+=ei(n[i]),e+=":",e+=Rr(t[n[i]]);return e+="}",e},$r=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 xr(t,n){for(const e in t)t.hasOwnProperty(e)&&n(e,t[e])}const Pr=function(t){Le(!Mr(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()},Lr=new RegExp("^-?(0*)\\d{1,10}$"),Ur=function(t){if(Lr.test(t)){const n=Number(t);if(n>=-2147483648&&n<=2147483647)return n}return null},Fr=function(t){try{t()}catch(t){setTimeout((()=>{throw jr("Exception was thrown by user callback.",t.stack||""),t}),Math.floor(0))}},Br=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 qr{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(){jr(`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 Wr{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?(Er("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/.',jr(t)}}class Hr{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}Hr.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 zr=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Vr="ac",Yr="websocket",Jr="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 Kr{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=mr.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()&&mr.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 Gr(t,n,e){let i;if(Le("string"==typeof n,"typeof type must == string"),Le("object"==typeof e,"typeof params must == object"),n===Yr)i=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(n!==Jr)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 xr(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 Xr{constructor(){this.counters_={}}incrementCounter(t,n=1){ri(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=n}get(){return Ve(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 Zr={},Qr={};function ts(t){const n=t.toString();return Zr[n]||(Zr[n]=new Xr),Zr[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 ns{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]&&Fr((()=>{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 es="start";class is{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_=Ir(t),this.stats_=ts(n),this.urlFn=t=>(this.appCheckToken&&(t[Vr]=this.appCheckToken),Gr(n,Jr,t))}open(t,n){this.curSegmentNum=0,this.onDisconnect_=n,this.myPacketOrderer=new ns(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 rs(((...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===es)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[es]="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[Vr]=this.appCheckToken),"undefined"!=typeof location&&location.hostname&&zr.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(){is.forceAllow_=!0}static forceDisallow(){is.forceDisallow_=!0}static isAvailable(){return!!is.forceAllow_||!(is.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=ei(t);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const e=We(n),i=$r(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=ei(t).length;this.bytesReceived+=n,this.stats_.incrementCounter("bytes_received",n)}}class rs{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=gr(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=n,this.myIFrame=rs.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){Er("frame writing exception"),t.stack&&Er(t.stack),Er(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||Er("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=()=>{Er("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 ss=null;"undefined"!=typeof MozWebSocket?ss=MozWebSocket:"undefined"!=typeof WebSocket&&(ss=WebSocket);class os{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_=Ir(this.connId),this.stats_=ts(n),this.connURL=os.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&&zr.test(location.hostname)&&(s.r="f"),n&&(s.s=n),e&&(s.ls=e),i&&(s[Vr]=i),r&&(s.p=r),Gr(t,Yr,s)}open(t,n){this.onDisconnect=n,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,mr.set("previous_websocket_failure",!0);try{let t;this.mySock=new ss(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(){os.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!==ss&&!os.forceDisallow_}static previouslyFailed(){return mr.isInMemoryStorage||!0===mr.get("previous_websocket_failure")}markConnectionHealthy(){mr.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=ni(t);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(Le(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=ei(t);this.bytesSent+=n.length,this.stats_.incrementCounter("bytes_sent",n.length);const e=$r(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)}}}os.responsesRequiredToBeHealthy=2,os.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 us{constructor(t){this.initTransports_(t)}static get ALL_TRANSPORTS(){return[is,os]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}initTransports_(t){const n=os&&os.isAvailable();let e=n&&!os.previouslyFailed();if(t.webSocketOnly&&(n||jr("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),e=!0),e)this.transports_=[os];else{const t=this.transports_=[];for(const n of us.ALL_TRANSPORTS)n&&n.isAvailable()&&t.push(n);us.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}}us.globalTransportInitialized_=!1;class hs{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_=Ir("c:"+this.id+":"),this.transportManager_=new us(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_=Br((()=>{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=Ar("t",t),e=Ar("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=Ar("t",t),e=Ar("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=Ar("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?kr("Server Error: "+e):"o"===n?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):kr("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&&jr("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),Br((()=>{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):Br((()=>{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()&&(mr.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 cs{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 as{constructor(t){this.allowedEvents_=t,this.listeners_={},Le(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){Le(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 ls extends as{constructor(){super(["online"]),this.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||Xe()||(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 ls}getInitialEvent(t){return Le("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 fs{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 ds(){return new fs("")}function ps(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ms(t){return t.pieces_.length-t.pieceNum_}function ws(t){let n=t.pieceNum_;return n<t.pieces_.length&&n++,new fs(t.pieces_,n)}function vs(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function gs(t,n=0){return t.pieces_.slice(t.pieceNum_+n)}function bs(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 fs(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 fs)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 fs(e,0)}function _s(t){return t.pieceNum_>=t.pieces_.length}function Ss(t,n){const e=ps(t),i=ps(n);if(null===e)return n;if(e===i)return Ss(ws(t),ws(n));throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+t+")")}function Es(t,n){const e=gs(t,0),i=gs(n,0);for(let t=0;t<e.length&&t<i.length;t++){const n=Dr(e[t],i[t]);if(0!==n)return n}return e.length===i.length?0:e.length<i.length?-1:1}function Is(t,n){if(ms(t)!==ms(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 ks(t,n){let e=t.pieceNum_,i=n.pieceNum_;if(ms(t)>ms(n))return!1;for(;e<t.pieces_.length;){if(t.pieces_[e]!==n.pieces_[i])return!1;++e,++i}return!0}class Cs{constructor(t,n){this.errorPrefix_=n,this.parts_=gs(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(let t=0;t<this.parts_.length;t++)this.byteLength_+=fi(this.parts_[t]);js(this)}}function js(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 "+Ms(t))}function Ms(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 as{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 Le("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 Ts=1e3;class Ds extends cs{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=Ds.nextPersistentConnectionId_++,this.log_=Ir("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_=Ts,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")&&ls.getInstance().on("online",this.onOnline_,this)}sendRequest(t,n,e){const i=++this.requestNumber_,r={r:i,a:t,b:n};this.log_(ei(r)),Le(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 Ge,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),Le(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),Le(!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;Ds.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&&ri(t,"w")){const e=si(t,"w");if(Array.isArray(e)&&~e.indexOf("no_index")){const t='".indexOn": "'+n._queryParams.getIndex().toString()+'"',e=n._path.toString();jr(`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=ii(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=ii(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),Le(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: "+ei(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):kr("Unrecognized action received from server: "+ei(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){Le(!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_=Ts,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Ts,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_=Ts),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+":"+Ds.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){Le(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?Er("getToken() completed but was canceled"):(Er("getToken() completed. Creating connection."),this.authToken_=u&&u.accessToken,this.appCheckToken_=c&&c.token,o=new hs(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,n,e,(t=>{jr(t+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")}),r))}catch(t){this.log_("Failed to get token: "+t),s||(this.repoInfo_.nodeAdmin&&jr(t),u())}}}interrupt(t){Er("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){Er("Resuming connection for reason: "+t),delete this.interruptReasons_[t],oi(this.interruptReasons_)&&(this.reconnectDelay_=Ts,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=>Rr(t))).join("$"):"default";const i=this.removeListen_(t,e);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(t,n){const e=new fs(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){Er("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){Er("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."+lr.replace(/\./g,"-")]=1,Xe()?t["framework.cordova"]=1:"object"==typeof navigator&&"ReactNative"===navigator.product&&(t["framework.reactnative"]=1),this.reportStats(t)}shouldReconnect_(){const t=ls.getInstance().currentlyOnline();return oi(this.interruptReasons_)&&t}}Ds.nextPersistentConnectionId_=0,Ds.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 Ns{constructor(t,n){this.name=t,this.node=n}static Wrap(t,n){return new Ns(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 As{getCompare(){return this.compare.bind(this)}indexedValueChanged(t,n){const e=new Ns(Or,t),i=new Ns(Or,n);return 0!==this.compare(e,i)}minPost(){return Ns.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 Rs;class $s extends As{static get __EMPTY_NODE(){return Rs}static set __EMPTY_NODE(t){Rs=t}compare(t,n){return Dr(t.name,n.name)}isDefinedOn(t){throw Ue("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(t,n){return!1}minPost(){return Ns.MIN}maxPost(){return new Ns(Tr,Rs)}makePost(t,n){return Le("string"==typeof t,"KeyIndex indexValue must always be a string."),new Ns(t,Rs)}toString(){return".key"}}const xs=new $s;
|
|
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 Ps{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 Ls{constructor(t,n,e,i,r){this.key=t,this.value=n,this.color=null!=e?e:Ls.RED,this.left=null!=i?i:Us.EMPTY_NODE,this.right=null!=r?r:Us.EMPTY_NODE}copy(t,n,e,i,r){return new Ls(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 Us.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 Us.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,Ls.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,Ls.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)}}Ls.RED=!0,Ls.BLACK=!1;class Us{constructor(t,n=Us.EMPTY_NODE){this.comparator_=t,this.root_=n}insert(t,n){return new Us(this.comparator_,this.root_.insert(t,n,this.comparator_).copy(null,null,Ls.BLACK,null,null))}remove(t){return new Us(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ls.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 Ps(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,n){return new Ps(this.root_,t,this.comparator_,!1,n)}getReverseIteratorFrom(t,n){return new Ps(this.root_,t,this.comparator_,!0,n)}getReverseIterator(t){return new Ps(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 Fs(t,n){return Dr(t.name,n.name)}function Bs(t,n){return Dr(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 qs;Us.EMPTY_NODE=new class{copy(t,n,e,i,r){return this}insert(t,n,e){return new Ls(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 Ws=function(t){return"number"==typeof t?"number:"+Pr(t):"string:"+t},Hs=function(t){if(t.isLeafNode()){const n=t.val();Le("string"==typeof n||"number"==typeof n||"object"==typeof n&&ri(n,".sv"),"Priority must be a string or number.")}else Le(t===qs||t.isEmpty(),"priority of unexpected type.");Le(t===qs||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 zs,Vs,Ys;class Js{constructor(t,n=Js.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=n,this.lazyHash_=null,Le(null!=this.value_,"LeafNode shouldn't be created with null/undefined value."),Hs(this.priorityNode_)}static set __childrenNodeConstructor(t){zs=t}static get __childrenNodeConstructor(){return zs}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Js(this.value_,t)}getImmediateChild(t){return".priority"===t?this.priorityNode_:Js.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return _s(t)?this:".priority"===ps(t)?this.priorityNode_:Js.__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:Js.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,n).updatePriority(this.priorityNode_)}updateChild(t,n){const e=ps(t);return null===e?n:n.isEmpty()&&".priority"!==e?this:(Le(".priority"!==e||1===ms(t),".priority must be the last token in a path"),this.updateImmediateChild(e,Js.__childrenNodeConstructor.EMPTY_NODE.updateChild(ws(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:"+Ws(this.priorityNode_.val())+":");const n=typeof this.value_;t+=n+":",t+="number"===n?Pr(this.value_):this.value_,this.lazyHash_=br(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Js.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Js.__childrenNodeConstructor?-1:(Le(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const n=typeof t.value_,e=typeof this.value_,i=Js.VALUE_TYPE_ORDER.indexOf(n),r=Js.VALUE_TYPE_ORDER.indexOf(e);return Le(i>=0,"Unknown leaf type: "+n),Le(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_))}}Js.VALUE_TYPE_ORDER=["object","boolean","number","string"];const Ks=new class extends As{compare(t,n){const e=t.node.getPriority(),i=n.node.getPriority(),r=e.compareTo(i);return 0===r?Dr(t.name,n.name):r}isDefinedOn(t){return!t.getPriority().isEmpty()}indexedValueChanged(t,n){return!t.getPriority().equals(n.getPriority())}minPost(){return Ns.MIN}maxPost(){return new Ns(Tr,new Js("[PRIORITY-POST]",Ys))}makePost(t,n){const e=Vs(t);return new Ns(n,new Js("[PRIORITY-POST]",e))}toString(){return".priority"}},Gs=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 Xs{constructor(t){this.count=parseInt(Math.log(t+1)/Gs,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 Zs=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 Ls(u,o.node,Ls.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 Ls(u,o.node,Ls.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 Ls(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,Ls.BLACK):(u(i,Ls.BLACK),u(i,Ls.RED))}return s}(new Xs(t.length));return new Us(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 Qs;const to={};class no{constructor(t,n){this.indexes_=t,this.indexSet_=n}static get Default(){return Le(to&&Ks,"ChildrenNode.ts has not been loaded"),Qs=Qs||new no({".priority":to},{".priority":Ks}),Qs}get(t){const n=si(this.indexes_,t);if(!n)throw new Error("No index defined for "+t);return n instanceof Us?n:null}hasIndex(t){return ri(this.indexSet_,t.toString())}addIndex(t,n){Le(t!==xs,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const e=[];let i=!1;const r=n.getIterator(Ns.Wrap);let s,o=r.getNext();for(;o;)i=i||t.isDefinedOn(o.node),e.push(o),o=r.getNext();s=i?Zs(e,t.getCompare()):to;const u=t.toString(),h=Object.assign({},this.indexSet_);h[u]=t;const c=Object.assign({},this.indexes_);return c[u]=s,new no(c,h)}addToIndexes(t,n){const e=ui(this.indexes_,((e,i)=>{const r=si(this.indexSet_,i);if(Le(r,"Missing index implementation for "+i),e===to){if(r.isDefinedOn(t.node)){const e=[],i=n.getIterator(Ns.Wrap);let s=i.getNext();for(;s;)s.name!==t.name&&e.push(s),s=i.getNext();return e.push(t),Zs(e,r.getCompare())}return to}{const i=n.get(t.name);let r=e;return i&&(r=r.remove(new Ns(t.name,i))),r.insert(t,t.node)}}));return new no(e,this.indexSet_)}removeFromIndexes(t,n){const e=ui(this.indexes_,(e=>{if(e===to)return e;{const i=n.get(t.name);return i?e.remove(new Ns(t.name,i)):e}}));return new no(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 eo;class io{constructor(t,n,e){this.children_=t,this.priorityNode_=n,this.indexMap_=e,this.lazyHash_=null,this.priorityNode_&&Hs(this.priorityNode_),this.children_.isEmpty()&&Le(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return eo||(eo=new io(new Us(Bs),null,no.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||eo}updatePriority(t){return this.children_.isEmpty()?this:new io(this.children_,t,this.indexMap_)}getImmediateChild(t){if(".priority"===t)return this.getPriority();{const n=this.children_.get(t);return null===n?eo:n}}getChild(t){const n=ps(t);return null===n?this:this.getImmediateChild(n).getChild(ws(t))}hasChild(t){return null!==this.children_.get(t)}updateImmediateChild(t,n){if(Le(n,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(n);{const e=new Ns(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()?eo:this.priorityNode_;return new io(i,s,r)}}updateChild(t,n){const e=ps(t);if(null===e)return n;{Le(".priority"!==ps(t)||1===ms(t),".priority must be the last token in a path");const i=this.getImmediateChild(e).updateChild(ws(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(Ks,((s,o)=>{n[s]=o.val(t),e++,r&&io.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:"+Ws(this.getPriority().val())+":"),this.forEachChild(Ks,((n,e)=>{const i=e.hash();""!==i&&(t+=":"+n+":"+i)})),this.lazyHash_=""===t?"":br(t)}return this.lazyHash_}getPredecessorChildName(t,n,e){const i=this.resolveIndex_(e);if(i){const e=i.getPredecessorKey(new Ns(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 Ns(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 Ns(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,Ns.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,Ns.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===ro?-1:0}withIndex(t){if(t===xs||this.indexMap_.hasIndex(t))return this;{const n=this.indexMap_.addIndex(t,this.children_);return new io(this.children_,this.priorityNode_,n)}}isIndexed(t){return t===xs||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(Ks),e=n.getIterator(Ks);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===xs?null:this.indexMap_.get(t.toString())}}io.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;const ro=new class extends io{constructor(){super(new Us(Bs),io.EMPTY_NODE,no.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return io.EMPTY_NODE}isEmpty(){return!1}};function so(t,n=null){if(null===t)return io.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(n=t[".priority"]),Le(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 Js(t,so(n));if(t instanceof Array){let e=io.EMPTY_NODE;return xr(t,((n,i)=>{if(ri(t,n)&&"."!==n.substring(0,1)){const t=so(i);!t.isLeafNode()&&t.isEmpty()||(e=e.updateImmediateChild(n,t))}})),e.updatePriority(so(n))}{const e=[];let i=!1;if(xr(t,((t,n)=>{if("."!==t.substring(0,1)){const r=so(n);r.isEmpty()||(i=i||!r.getPriority().isEmpty(),e.push(new Ns(t,r)))}})),0===e.length)return io.EMPTY_NODE;const r=Zs(e,Fs,(t=>t.name),Bs);if(i){const t=Zs(e,Ks.getCompare());return new io(r,so(n),new no({".priority":t},{".priority":Ks}))}return new io(r,so(n),no.Default)}}Object.defineProperties(Ns,{MIN:{value:new Ns(Or,io.EMPTY_NODE)},MAX:{value:new Ns(Tr,ro)}}),$s.__EMPTY_NODE=io.EMPTY_NODE,Js.__childrenNodeConstructor=io,qs=ro,Ys=ro,Vs=so;
|
|
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 oo extends As{constructor(t){super(),this.indexPath_=t,Le(!_s(t)&&".priority"!==ps(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?Dr(t.name,n.name):r}makePost(t,n){const e=so(t),i=io.EMPTY_NODE.updateChild(this.indexPath_,e);return new Ns(n,i)}maxPost(){const t=io.EMPTY_NODE.updateChild(this.indexPath_,ro);return new Ns(Tr,t)}toString(){return gs(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 uo=new class extends As{compare(t,n){const e=t.node.compareTo(n.node);return 0===e?Dr(t.name,n.name):e}isDefinedOn(t){return!0}indexedValueChanged(t,n){return!t.equals(n)}minPost(){return Ns.MIN}maxPost(){return Ns.MAX}makePost(t,n){const e=so(t);return new Ns(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 ho(t){return{type:"value",snapshotNode:t}}function co(t,n){return{type:"child_added",snapshotNode:n,childName:t}}function ao(t,n){return{type:"child_removed",snapshotNode:n,childName:t}}function lo(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 fo{constructor(t){this.index_=t}updateChild(t,n,e,i,r,s){Le(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(ao(n,o)):Le(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):o.isEmpty()?s.trackChildChange(co(n,e)):s.trackChildChange(lo(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(Ks,((t,i)=>{n.hasChild(t)||e.trackChildChange(ao(t,i))})),n.isLeafNode()||n.forEachChild(Ks,((n,i)=>{if(t.hasChild(n)){const r=t.getImmediateChild(n);r.equals(i)||e.trackChildChange(lo(n,i,r))}else e.trackChildChange(co(n,i))}))),n.withIndex(this.index_)}updatePriority(t,n){return t.isEmpty()?io.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 po{constructor(t){this.indexedFilter_=new fo(t.getIndex()),this.index_=t.getIndex(),this.startPost_=po.getStartPost_(t),this.endPost_=po.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 Ns(n,e))||(e=io.EMPTY_NODE),this.indexedFilter_.updateChild(t,n,e,i,r,s)}updateFullNode(t,n,e){n.isLeafNode()&&(n=io.EMPTY_NODE);let i=n.withIndex(this.index_);i=i.updatePriority(io.EMPTY_NODE);const r=this;return n.forEachChild(Ks,((t,n)=>{r.matches(new Ns(t,n))||(i=i.updateImmediateChild(t,io.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 mo{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 po(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 Ns(n,e))||(e=io.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=io.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<n.numChildren()&&n.isIndexed(this.index_)){let t;i=io.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(io.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,io.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;Le(o.numChildren()===this.limit_,"");const u=new Ns(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(lo(n,e,t)),o.updateImmediateChild(n,e);{null!=r&&r.trackChildChange(ao(n,t));const e=o.updateImmediateChild(n,io.EMPTY_NODE);return null!=a&&this.rangedFilter_.matches(a)?(null!=r&&r.trackChildChange(co(a.name,a.node)),e.updateImmediateChild(a.name,a.node)):e}}return e.isEmpty()?t:c&&s(h,u)>=0?(null!=r&&(r.trackChildChange(ao(h.name,h.node)),r.trackChildChange(co(n,e))),o.updateImmediateChild(n,e).updateImmediateChild(h.name,io.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 wo{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_=Ks}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return Le(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return Le(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Or}hasEnd(){return this.endSet_}getIndexEndValue(){return Le(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return Le(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Tr}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return Le(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_===Ks}copy(){const t=new wo;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 vo(t){const n={};if(t.isDefault())return n;let e;if(t.index_===Ks?e="$priority":t.index_===uo?e="$value":t.index_===xs?e="$key":(Le(t.index_ instanceof oo,"Unrecognized index type!"),e=t.index_.toString()),n.orderBy=ei(e),t.startSet_){const e=t.startAfterSet_?"startAfter":"startAt";n[e]=ei(t.indexStartValue_),t.startNameSet_&&(n[e]+=","+ei(t.indexStartName_))}if(t.endSet_){const e=t.endBeforeSet_?"endBefore":"endAt";n[e]=ei(t.indexEndValue_),t.endNameSet_&&(n[e]+=","+ei(t.indexEndName_))}return t.limitSet_&&(t.isViewFromLeft()?n.limitToFirst=t.limit_:n.limitToLast=t.limit_),n}function go(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_!==Ks&&(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 bo extends cs{constructor(t,n,e,i){super(),this.repoInfo_=t,this.onDataUpdate_=n,this.authTokenProvider_=e,this.appCheckTokenProvider_=i,this.log_=Ir("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,n){return void 0!==n?"tag$"+n:(Le(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=bo.getListenId_(t,e),o={};this.listens_[s]=o;const u=vo(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),si(this.listens_,s)===o){let n;n=t?401===t?"permission_denied":"rest_error:"+t:"ok",i(n,null)}}))}unlisten(t,n){const e=bo.getListenId_(t,n);delete this.listens_[e]}get(t){const n=vo(t._queryParams),e=t._path.toString(),i=new Ge;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=ni(o.responseText)}catch(t){jr("Failed to parse JSON response for "+s+": "+o.responseText)}e(null,t)}else 401!==o.status&&404!==o.status&&jr("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_=io.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 _o(){return{value:null,children:new Map}}function So(t,n,e){if(_s(n))t.value=e,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(n,e);else{const i=ps(n);t.children.has(i)||t.children.set(i,_o()),So(t.children.get(i),n=ws(n),e)}}function Eo(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)=>{Eo(i,new fs(n.toString()+"/"+t),e)}))}class Io{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),n=Object.assign({},t);return this.last_&&xr(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 ko{constructor(t,n){this.server_=n,this.statsToReport_={},this.statsListener_=new Io(t);const e=1e4+2e4*Math.random();Br(this.reportStats_.bind(this),Math.floor(e))}reportStats_(){const t=this.statsListener_.get(),n={};let e=!1;xr(t,((t,i)=>{i>0&&ri(this.statsToReport_,t)&&(n[t]=i,e=!0)})),e&&this.server_.reportStats(n),Br(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 Co;function jo(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"}(Co||(Co={}));class Mo{constructor(t,n,e){this.path=t,this.affectedTree=n,this.revert=e,this.type=Co.ACK_USER_WRITE,this.source={fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}operationForChild(t){if(_s(this.path)){if(null!=this.affectedTree.value)return Le(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const n=this.affectedTree.subtree(new fs(t));return new Mo(ds(),n,this.revert)}}return Le(ps(this.path)===t,"operationForChild called for unrelated child."),new Mo(ws(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=Co.LISTEN_COMPLETE}operationForChild(t){return _s(this.path)?new Oo(this.source,ds()):new Oo(this.source,ws(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 To{constructor(t,n,e){this.source=t,this.path=n,this.snap=e,this.type=Co.OVERWRITE}operationForChild(t){return _s(this.path)?new To(this.source,ds(),this.snap.getImmediateChild(t)):new To(this.source,ws(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 Do{constructor(t,n,e){this.source=t,this.path=n,this.children=e,this.type=Co.MERGE}operationForChild(t){if(_s(this.path)){const n=this.children.subtree(new fs(t));return n.isEmpty()?null:n.value?new To(this.source,ds(),n.value):new Do(this.source,ds(),n)}return Le(ps(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new Do(this.source,ws(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 No{constructor(t,n,e){this.node_=t,this.fullyInitialized_=n,this.filtered_=e}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(_s(t))return this.isFullyInitialized()&&!this.filtered_;const n=ps(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 Ao{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function Ro(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 Ue("Should only compare child_ events.");const i=new Ns(n.childName,n.snapshotNode),r=new Ns(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 $o(t,n){return{eventCache:t,serverCache:n}}function xo(t,n,e,i){return $o(new No(n,e,i),t.serverCache)}function Po(t,n,e,i){return $o(t.eventCache,new No(n,e,i))}function Lo(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Uo(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 Fo;class Bo{constructor(t,n=(()=>(Fo||(Fo=new Us(Nr)),Fo))()){this.value=t,this.children=n}static fromObject(t){let n=new Bo(null);return xr(t,((t,e)=>{n=n.set(new fs(t),e)})),n}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,n){if(null!=this.value&&n(this.value))return{path:ds(),value:this.value};if(_s(t))return null;{const e=ps(t),i=this.children.get(e);if(null!==i){const r=i.findRootMostMatchingPathAndValue(ws(t),n);return null!=r?{path:ys(new fs(e),r.path),value:r.value}:null}return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,(()=>!0))}subtree(t){if(_s(t))return this;{const n=ps(t),e=this.children.get(n);return null!==e?e.subtree(ws(t)):new Bo(null)}}set(t,n){if(_s(t))return new Bo(n,this.children);{const e=ps(t),i=(this.children.get(e)||new Bo(null)).set(ws(t),n),r=this.children.insert(e,i);return new Bo(this.value,r)}}remove(t){if(_s(t))return this.children.isEmpty()?new Bo(null):new Bo(null,this.children);{const n=ps(t),e=this.children.get(n);if(e){const i=e.remove(ws(t));let r;return r=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&r.isEmpty()?new Bo(null):new Bo(this.value,r)}return this}}get(t){if(_s(t))return this.value;{const n=ps(t),e=this.children.get(n);return e?e.get(ws(t)):null}}setTree(t,n){if(_s(t))return n;{const e=ps(t),i=(this.children.get(e)||new Bo(null)).setTree(ws(t),n);let r;return r=i.isEmpty()?this.children.remove(e):this.children.insert(e,i),new Bo(this.value,r)}}fold(t){return this.fold_(ds(),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,ds(),n)}findOnPath_(t,n,e){const i=!!this.value&&e(n,this.value);if(i)return i;if(_s(t))return null;{const i=ps(t),r=this.children.get(i);return r?r.findOnPath_(ws(t),ys(n,i),e):null}}foreachOnPath(t,n){return this.foreachOnPath_(t,ds(),n)}foreachOnPath_(t,n,e){if(_s(t))return this;{this.value&&e(n,this.value);const i=ps(t),r=this.children.get(i);return r?r.foreachOnPath_(ws(t),ys(n,i),e):new Bo(null)}}foreach(t){this.foreach_(ds(),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 qo{constructor(t){this.writeTree_=t}static empty(){return new qo(new Bo(null))}}function Wo(t,n,e){if(_s(n))return new qo(new Bo(e));{const i=t.writeTree_.findRootMostValueAndPath(n);if(null!=i){const r=i.path;let s=i.value;const o=Ss(r,n);return s=s.updateChild(o,e),new qo(t.writeTree_.set(r,s))}{const i=new Bo(e),r=t.writeTree_.setTree(n,i);return new qo(r)}}}function Ho(t,n,e){let i=t;return xr(e,((t,e)=>{i=Wo(i,ys(n,t),e)})),i}function zo(t,n){if(_s(n))return qo.empty();{const e=t.writeTree_.setTree(n,new Bo(null));return new qo(e)}}function Vo(t,n){return null!=Yo(t,n)}function Yo(t,n){const e=t.writeTree_.findRootMostValueAndPath(n);return null!=e?t.writeTree_.get(e.path).getChild(Ss(e.path,n)):null}function Jo(t){const n=[],e=t.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Ks,((t,e)=>{n.push(new Ns(t,e))})):t.writeTree_.children.inorderTraversal(((t,e)=>{null!=e.value&&n.push(new Ns(t,e.value))})),n}function Ko(t,n){if(_s(n))return t;{const e=Yo(t,n);return new qo(null!=e?new Bo(e):t.writeTree_.subtree(n))}}function Go(t){return t.writeTree_.isEmpty()}function Xo(t,n){return Zo(ds(),t.writeTree_,n)}function Zo(t,n,e){if(null!=n.value)return e.updateChild(t,n.value);{let i=null;return n.children.inorderTraversal(((n,r)=>{".priority"===n?(Le(null!==r.value,"Priority writes must always be leaf nodes"),i=r.value):e=Zo(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 Qo(t,n){return au(n,t)}function tu(t,n){if(t.snap)return ks(t.path,n);for(const e in t.children)if(t.children.hasOwnProperty(e)&&ks(ys(t.path,e),n))return!0;return!1}function nu(t){return t.visible}function eu(t,n,e){let i=qo.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)ks(e,t)?(n=Ss(e,t),i=Wo(i,n,s.snap)):ks(t,e)&&(n=Ss(t,e),i=Wo(i,ds(),s.snap.getChild(n)));else{if(!s.children)throw Ue("WriteRecord should have .snap or .children");if(ks(e,t))n=Ss(e,t),i=Ho(i,n,s.children);else if(ks(t,e))if(n=Ss(t,e),_s(n))i=Ho(i,ds(),s.children);else{const t=si(s.children,ps(n));if(t){const e=t.getChild(ws(n));i=Wo(i,ds(),e)}}}}}return i}function iu(t,n,e,i,r){if(i||r){const s=Ko(t.visibleWrites,n);return!r&&Go(s)?e:r||null!=e||Vo(s,ds())?Xo(eu(t.allWrites,(function(t){return(t.visible||r)&&(!i||!~i.indexOf(t.writeId))&&(ks(t.path,n)||ks(n,t.path))}),n),e||io.EMPTY_NODE):null}{const i=Yo(t.visibleWrites,n);if(null!=i)return i;{const i=Ko(t.visibleWrites,n);return Go(i)?e:null!=e||Vo(i,ds())?Xo(i,e||io.EMPTY_NODE):null}}}function ru(t,n,e,i){return iu(t.writeTree,t.treePath,n,e,i)}function su(t,n){return function(t,n,e){let i=io.EMPTY_NODE;const r=Yo(t.visibleWrites,n);if(r)return r.isLeafNode()||r.forEachChild(Ks,((t,n)=>{i=i.updateImmediateChild(t,n)})),i;if(e){const r=Ko(t.visibleWrites,n);return e.forEachChild(Ks,((t,n)=>{const e=Xo(Ko(r,new fs(t)),n);i=i.updateImmediateChild(t,e)})),Jo(r).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}return Jo(Ko(t.visibleWrites,n)).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}(t.writeTree,t.treePath,n)}function ou(t,n,e,i){return function(t,n,e,i,r){Le(i||r,"Either existingEventSnap or existingServerSnap must exist");const s=ys(n,e);if(Vo(t.visibleWrites,s))return null;{const n=Ko(t.visibleWrites,s);return Go(n)?r.getChild(e):Xo(n,r.getChild(e))}}(t.writeTree,t.treePath,n,e,i)}function uu(t,n){return function(t,n){return Yo(t.visibleWrites,n)}(t.writeTree,ys(t.treePath,n))}function hu(t,n,e){return function(t,n,e,i){const r=ys(n,e),s=Yo(t.visibleWrites,r);return null!=s?s:i.isCompleteForChild(e)?Xo(Ko(t.visibleWrites,r),i.getNode().getImmediateChild(e)):null}(t.writeTree,t.treePath,n,e)}function cu(t,n){return au(ys(t.treePath,n),t.writeTree)}function au(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 lu{constructor(){this.changeMap=new Map}trackChildChange(t){const n=t.type,e=t.childName;Le("child_added"===n||"child_changed"===n||"child_removed"===n,"Only child changes supported for tracking"),Le(".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,lo(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,ao(e,i.oldSnap));else if("child_changed"===n&&"child_added"===r)this.changeMap.set(e,co(e,t.snapshotNode));else{if("child_changed"!==n||"child_changed"!==r)throw Ue("Illegal combination of changes: "+t+" occurred after "+i);this.changeMap.set(e,lo(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 fu=new class{getCompleteChild(t){return null}getChildAfterChild(t,n,e){return null}};class du{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 No(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return hu(this.writes_,t,n)}}getChildAfterChild(t,n,e){const i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:Uo(this.viewCache_),r=function(t,n,e,i,r,s){return function(t,n,e,i,r,s,o){let u;const h=Ko(t.visibleWrites,n),c=Yo(h,ds());if(null!=c)u=c;else{if(null==e)return[];u=Xo(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 pu(t,n,e,i,r,s){const o=n.eventCache;if(null!=uu(i,e))return n;{let u,h;if(_s(e))if(Le(n.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),n.serverCache.isFiltered()){const e=Uo(n),r=su(i,e instanceof io?e:io.EMPTY_NODE);u=t.filter.updateFullNode(n.eventCache.getNode(),r,s)}else{const e=ru(i,Uo(n));u=t.filter.updateFullNode(n.eventCache.getNode(),e,s)}else{const c=ps(e);if(".priority"===c){Le(1===ms(e),"Can't have a priority with additional path components");const r=o.getNode();h=n.serverCache.getNode();const s=ou(i,e,r,h);u=null!=s?t.filter.updatePriority(r,s):o.getNode()}else{const a=ws(e);let l;if(o.isCompleteForChild(c)){h=n.serverCache.getNode();const t=ou(i,e,o.getNode(),h);l=null!=t?o.getNode().getImmediateChild(c).updateChild(a,t):o.getNode().getImmediateChild(c)}else l=hu(i,c,n.serverCache);u=null!=l?t.filter.updateChild(o.getNode(),c,l,a,r,s):o.getNode()}}return xo(n,u,o.isFullyInitialized()||_s(e),t.filter.filtersNodes())}}function mu(t,n,e,i,r,s,o,u){const h=n.serverCache;let c;const a=o?t.filter:t.filter.getIndexedFilter();if(_s(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=ps(e);if(!h.isCompleteForPath(e)&&ms(e)>1)return n;const r=ws(e),s=h.getNode().getImmediateChild(t).updateChild(r,i);c=".priority"===t?a.updatePriority(h.getNode(),s):a.updateChild(h.getNode(),t,s,r,fu,null)}const l=Po(n,c,h.isFullyInitialized()||_s(e),a.filtersNodes());return pu(t,l,e,r,new du(r,l,s),u)}function wu(t,n,e,i,r,s,o){const u=n.eventCache;let h,c;const a=new du(r,n,s);if(_s(e))c=t.filter.updateFullNode(n.eventCache.getNode(),i,o),h=xo(n,c,!0,t.filter.filtersNodes());else{const r=ps(e);if(".priority"===r)c=t.filter.updatePriority(n.eventCache.getNode(),i),h=xo(n,c,u.isFullyInitialized(),u.isFiltered());else{const s=ws(e),c=u.getNode().getImmediateChild(r);let l;if(_s(s))l=i;else{const t=a.getCompleteChild(r);l=null!=t?".priority"===vs(s)&&t.getChild(bs(s)).isEmpty()?t:t.updateChild(s,i):io.EMPTY_NODE}h=c.equals(l)?n:xo(n,t.filter.updateChild(u.getNode(),r,l,s,a,o),u.isFullyInitialized(),t.filter.filtersNodes())}}return h}function vu(t,n){return t.eventCache.isCompleteForChild(n)}function gu(t,n,e){return e.foreach(((t,e)=>{n=n.updateChild(t,e)})),n}function bu(t,n,e,i,r,s,o,u){if(n.serverCache.getNode().isEmpty()&&!n.serverCache.isFullyInitialized())return n;let h,c=n;h=_s(e)?i:new Bo(null).setTree(e,i);const a=n.serverCache.getNode();return h.children.inorderTraversal(((e,i)=>{if(a.hasChild(e)){const h=gu(0,n.serverCache.getNode().getImmediateChild(e),i);c=mu(t,c,new fs(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=gu(0,n.serverCache.getNode().getImmediateChild(e),i);c=mu(t,c,new fs(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 fo(e.getIndex()),r=(s=e).loadsAllData()?new fo(s.getIndex()):s.hasLimit()?new mo(s):new po(s);var s;this.processor_=function(t){return{filter:t}}(r);const o=n.serverCache,u=n.eventCache,h=i.updateFullNode(io.EMPTY_NODE,o.getNode(),null),c=r.updateFullNode(io.EMPTY_NODE,u.getNode(),null),a=new No(h,o.isFullyInitialized(),i.filtersNodes()),l=new No(c,u.isFullyInitialized(),r.filtersNodes());this.viewCache_=$o(l,a),this.eventGenerator_=new Ao(this.query_)}get query(){return this.query_}}function _u(t,n){const e=Uo(t.viewCache_);return e&&(t.query._queryParams.loadsAllData()||!_s(n)&&!e.getImmediateChild(ps(n)).isEmpty())?e.getChild(n):null}function Su(t){return 0===t.eventRegistrations_.length}function Eu(t,n,e){const i=[];if(e){Le(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 Iu(t,n,e,i){n.type===Co.MERGE&&null!==n.source.queryId&&(Le(Uo(t.viewCache_),"We should always have a full cache before handling merges"),Le(Lo(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 lu;let o,u;if(e.type===Co.OVERWRITE){const h=e;h.source.fromUser?o=wu(t,n,h.path,h.snap,i,r,s):(Le(h.source.fromServer,"Unknown source."),u=h.source.tagged||n.serverCache.isFiltered()&&!_s(h.path),o=mu(t,n,h.path,h.snap,i,r,u,s))}else if(e.type===Co.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);vu(n,ps(c))&&(u=wu(t,u,c,h,r,s,o))})),i.foreach(((i,h)=>{const c=ys(e,i);vu(n,ps(c))||(u=wu(t,u,c,h,r,s,o))})),u}(t,n,h.path,h.children,i,r,s):(Le(h.source.fromServer,"Unknown source."),u=h.source.tagged||n.serverCache.isFiltered(),o=bu(t,n,h.path,h.children,i,r,u,s))}else if(e.type===Co.ACK_USER_WRITE){const u=e;o=u.revert?function(t,n,e,i,r,s){let o;if(null!=uu(i,e))return n;{const u=new du(i,n,r),h=n.eventCache.getNode();let c;if(_s(e)||".priority"===ps(e)){let e;if(n.serverCache.isFullyInitialized())e=ru(i,Uo(n));else{const t=n.serverCache.getNode();Le(t instanceof io,"serverChildren would be complete if leaf node"),e=su(i,t)}c=t.filter.updateFullNode(h,e,s)}else{const r=ps(e);let a=hu(i,r,n.serverCache);null==a&&n.serverCache.isCompleteForChild(r)&&(a=h.getImmediateChild(r)),c=null!=a?t.filter.updateChild(h,r,a,ws(e),u,s):n.eventCache.getNode().hasChild(r)?t.filter.updateChild(h,r,io.EMPTY_NODE,ws(e),u,s):h,c.isEmpty()&&n.serverCache.isFullyInitialized()&&(o=ru(i,Uo(n)),o.isLeafNode()&&(c=t.filter.updateFullNode(c,o,s)))}return o=n.serverCache.isFullyInitialized()||null!=uu(i,ds()),xo(n,c,o,t.filter.filtersNodes())}}(t,n,u.path,i,r,s):function(t,n,e,i,r,s,o){if(null!=uu(r,e))return n;const u=n.serverCache.isFiltered(),h=n.serverCache;if(null!=i.value){if(_s(e)&&h.isFullyInitialized()||h.isCompleteForPath(e))return mu(t,n,e,h.getNode().getChild(e),r,s,u,o);if(_s(e)){let i=new Bo(null);return h.getNode().forEachChild(xs,((t,n)=>{i=i.set(new fs(t),n)})),bu(t,n,e,i,r,s,u,o)}return n}{let c=new Bo(null);return i.foreach((t=>{const n=ys(e,t);h.isCompleteForPath(n)&&(c=c.set(t,h.getNode().getChild(n)))})),bu(t,n,e,c,r,s,u,o)}}(t,n,u.path,u.affectedTree,i,r,s)}else{if(e.type!==Co.LISTEN_COMPLETE)throw Ue("Unknown operation type: "+e.type);o=function(t,n,e,i,r){const s=n.serverCache;return pu(t,Po(n,s.getNode(),s.isFullyInitialized()||_s(e),s.isFiltered()),e,i,fu,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=Lo(t);(e.length>0||!t.eventCache.isFullyInitialized()||r&&!i.getNode().equals(s)||!i.getNode().getPriority().equals(s.getPriority()))&&e.push(ho(Lo(n)))}}(n,o,h),{viewCache:o,changes:h}}(t.processor_,r,n,e,i);var o,u;return o=t.processor_,Le((u=s.viewCache).eventCache.getNode().isIndexed(o.filter.getIndex()),"Event snap not indexed"),Le(u.serverCache.getNode().isIndexed(o.filter.getIndex()),"Server snap not indexed"),Le(s.viewCache.serverCache.isFullyInitialized()||!r.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=s.viewCache,ku(t,s.changes,s.viewCache.eventCache.getNode(),null)}function ku(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})})),Ro(t,r,"child_removed",n,i,e),Ro(t,r,"child_added",n,i,e),Ro(t,r,"child_moved",s,i,e),Ro(t,r,"child_changed",n,i,e),Ro(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 Cu,ju;class Mu{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 Le(null!=s,"SyncTree gave us an op for an invalid query."),Iu(s,n,e,i)}{let r=[];for(const s of t.views.values())r=r.concat(Iu(s,n,e,i));return r}}function Tu(t){const n=[];for(const e of t.views.values())e.query._queryParams.loadsAllData()||n.push(e);return n}function Du(t,n){let e=null;for(const i of t.views.values())e=e||_u(i,n);return e}function Nu(t,n){return n._queryParams.loadsAllData()?$u(t):t.views.get(n._queryIdentifier)}function Au(t,n){return null!=Nu(t,n)}function Ru(t){return null!=$u(t)}function $u(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 xu=1;class Pu{constructor(t){this.listenProvider_=t,this.syncPointTree_=new Bo(null),this.pendingWriteTree_={visibleWrites:qo.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function Lu(t,n,e,i,r){return function(t,n,e,i,r){Le(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=Wo(t.visibleWrites,n,e)),t.lastWriteId=i}(t.pendingWriteTree_,n,e,i,r),r?Hu(t,new To({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},n,e)):[]}function Uu(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));Le(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&&tu(n,i.path)?r=!1:ks(i.path,n.path)&&(s=!0)),o--}return!!r&&(s?(function(t){t.visibleWrites=eu(t.allWrites,nu,ds()),t.lastWriteId=t.allWrites.length>0?t.allWrites[t.allWrites.length-1].writeId:-1}(t),!0):(i.snap?t.visibleWrites=zo(t.visibleWrites,i.path):xr(i.children,(n=>{t.visibleWrites=zo(t.visibleWrites,ys(i.path,n))})),!0))}(t.pendingWriteTree_,n)){let n=new Bo(null);return null!=i.snap?n=n.set(ds(),!0):xr(i.children,(t=>{n=n.set(new fs(t),!0)})),Hu(t,new Mo(i.path,n,e))}return[]}function Fu(t,n,e){return Hu(t,new To({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},n,e))}function Bu(t,n,e,i,r=!1){const s=n._path,o=t.syncPointTree_.get(s);let u=[];if(o&&("default"===n._queryIdentifier||Au(o,n))){const h=function(t,n,e,i){const r=n._queryIdentifier,s=[];let o=[];const u=Ru(t);if("default"===r)for(const[n,r]of t.views.entries())o=o.concat(Eu(r,e,i)),Su(r)&&(t.views.delete(n),r.query._queryParams.loadsAllData()||s.push(r.query));else{const n=t.views.get(r);n&&(o=o.concat(Eu(n,e,i)),Su(n)&&(t.views.delete(r),n.query._queryParams.loadsAllData()||s.push(n.query)))}return u&&!Ru(t)&&s.push(new(Le(Cu,"Reference.ts has not been loaded"),Cu)(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)=>Ru(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&&Ru(n))return[$u(n)];{let t=[];return n&&(t=Tu(n)),xr(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=Yu(t,i);t.listenProvider_.startListening(Qu(r),Ju(t,r),s.hashFn,s.onComplete)}}}if(!r&&c.length>0&&!i)if(e){const e=null;t.listenProvider_.stopListening(Qu(n),e)}else c.forEach((n=>{const e=t.queryToTagMap.get(Ku(n));t.listenProvider_.stopListening(Qu(n),e)}))}!function(t,n){for(let e=0;e<n.length;++e){const i=n[e];if(!i._queryParams.loadsAllData()){const n=Ku(i),e=t.queryToTagMap.get(n);t.queryToTagMap.delete(n),t.tagToQueryMap.delete(e)}}}(t,c)}return u}function qu(t,n,e,i=!1){const r=n._path;let s=null,o=!1;t.syncPointTree_.foreachOnPath(r,((t,n)=>{const e=Ss(t,r);s=s||Du(n,e),o=o||Ru(n)}));let u,h=t.syncPointTree_.get(r);h?(o=o||Ru(h),s=s||Du(h,ds())):(h=new Mu,t.syncPointTree_=t.syncPointTree_.set(r,h)),null!=s?u=!0:(u=!1,s=io.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild(((t,n)=>{const e=Du(n,ds());e&&(s=s.updateImmediateChild(t,e))})));const c=Au(h,n);if(!c&&!n._queryParams.loadsAllData()){const e=Ku(n);Le(!t.queryToTagMap.has(e),"View does not exist, but we have a tag");const i=xu++;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=ru(e,r?i:null),s=!1;t?s=!0:i instanceof io?(t=su(e,i),s=!1):(t=io.EMPTY_NODE,s=!1);const o=$o(new No(t,s,!1),new No(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(Ks,((t,n)=>{i.push(co(t,n))})),e.isFullyInitialized()&&i.push(ho(e.getNode())),ku(t,i,e.getNode(),n)}(o,e)}(h,n,e,Qo(t.pendingWriteTree_,r),s,u);if(!c&&!o&&!i){const e=Nu(h,n);a=a.concat(function(t,n,e){const i=n._path,r=Ju(t,n),s=Yu(t,e),o=t.listenProvider_.startListening(Qu(n),r,s.hashFn,s.onComplete),u=t.syncPointTree_.subtree(i);if(r)Le(!Ru(u.value),"If we're adding a query, it shouldn't be shadowed");else{const n=u.fold(((t,n,e)=>{if(!_s(t)&&n&&Ru(n))return[$u(n).query];{let t=[];return n&&(t=t.concat(Tu(n).map((t=>t.query)))),xr(e,((n,e)=>{t=t.concat(e)})),t}}));for(let e=0;e<n.length;++e){const i=n[e];t.listenProvider_.stopListening(Qu(i),Ju(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 Wu(t,n,e){const i=t.pendingWriteTree_,r=t.syncPointTree_.findOnPath(n,((t,e)=>{const i=Du(e,Ss(t,n));if(i)return i}));return iu(i,n,r,e,!0)}function Hu(t,n){return zu(n,t.syncPointTree_,null,Qo(t.pendingWriteTree_,ds()))}function zu(t,n,e,i){if(_s(t.path))return Vu(t,n,e,i);{const r=n.get(ds());null==e&&null!=r&&(e=Du(r,ds()));let s=[];const o=ps(t.path),u=t.operationForChild(o),h=n.children.get(o);if(h&&u){const t=e?e.getImmediateChild(o):null,n=cu(i,o);s=s.concat(zu(u,h,t,n))}return r&&(s=s.concat(Ou(r,t,i,e))),s}}function Vu(t,n,e,i){const r=n.get(ds());null==e&&null!=r&&(e=Du(r,ds()));let s=[];return n.children.inorderTraversal(((n,r)=>{const o=e?e.getImmediateChild(n):null,u=cu(i,n),h=t.operationForChild(n);h&&(s=s.concat(Vu(h,r,o,u)))})),r&&(s=s.concat(Ou(r,t,i,e))),s}function Yu(t,n){const e=n.query,i=Ju(t,e);return{hashFn:()=>{const t=function(t){return t.viewCache_.serverCache.getNode()}(n)||io.EMPTY_NODE;return t.hash()},onComplete:n=>{if("ok"===n)return i?function(t,n,e){const i=Gu(t,e);if(i){const e=Xu(i),r=e.path,s=e.queryId,o=Ss(r,n);return Zu(t,r,new Oo(jo(s),o))}return[]}(t,e._path,i):function(t,n){return Hu(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 Bu(t,e,null,i)}}}}function Ju(t,n){const e=Ku(n);return t.queryToTagMap.get(e)}function Ku(t){return t._path.toString()+"$"+t._queryIdentifier}function Gu(t,n){return t.tagToQueryMap.get(n)}function Xu(t){const n=t.indexOf("$");return Le(-1!==n&&n<t.length-1,"Bad queryKey."),{queryId:t.substr(n+1),path:new fs(t.substr(0,n))}}function Zu(t,n,e){const i=t.syncPointTree_.get(n);return Le(i,"Missing sync point for query tag that we're tracking"),Ou(i,e,Qo(t.pendingWriteTree_,n),null)}function Qu(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?new(Le(ju,"Reference.ts has not been loaded"),ju)(t._repo,t._path):t}class th{constructor(t){this.node_=t}getImmediateChild(t){const n=this.node_.getImmediateChild(t);return new th(n)}node(){return this.node_}}class nh{constructor(t,n){this.syncTree_=t,this.path_=n}getImmediateChild(t){const n=ys(this.path_,t);return new nh(this.syncTree_,n)}node(){return Wu(this.syncTree_,this.path_)}}const eh=function(t,n,e){return t&&"object"==typeof t?(Le(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?ih(t[".sv"],n,e):"object"==typeof t[".sv"]?rh(t[".sv"],n):void Le(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},ih=function(t,n,e){if("timestamp"===t)return e.timestamp;Le(!1,"Unexpected server value: "+t)},rh=function(t,n){t.hasOwnProperty("increment")||Le(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const e=t.increment;"number"!=typeof e&&Le(!1,"Unexpected increment value: "+e);const i=n.node();if(Le(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return e;const r=i.getValue();return"number"!=typeof r?e:r+e},sh=function(t,n,e,i){return uh(n,new nh(e,t),i)},oh=function(t,n,e){return uh(t,new th(n),e)};function uh(t,n,e){const i=t.getPriority().val(),r=eh(i,n.getImmediateChild(".priority"),e);let s;if(t.isLeafNode()){const i=t,s=eh(i.getValue(),n,e);return s!==i.getValue()||r!==i.getPriority().val()?new Js(s,so(r)):t}{const i=t;return s=i,r!==i.getPriority().val()&&(s=s.updatePriority(new Js(r))),i.forEachChild(Ks,((t,i)=>{const r=uh(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 hh{constructor(t="",n=null,e={children:{},childCount:0}){this.name=t,this.parent=n,this.node=e}}function ch(t,n){let e=n instanceof fs?n:new fs(n),i=t,r=ps(e);for(;null!==r;){const t=si(i.node.children,r)||{children:{},childCount:0};i=new hh(r,i,t),e=ws(e),r=ps(e)}return i}function ah(t){return t.node.value}function lh(t,n){t.node.value=n,wh(t)}function fh(t){return t.node.childCount>0}function dh(t,n){xr(t.node.children,((e,i)=>{n(new hh(e,t,i))}))}function ph(t,n,e,i){e&&!i&&n(t),dh(t,(t=>{ph(t,n,!0,i)})),e&&i&&n(t)}function mh(t){return new fs(null===t.parent?t.name:mh(t.parent)+"/"+t.name)}function wh(t){null!==t.parent&&function(t,n,e){const i=function(t){return void 0===ah(t)&&!fh(t)}(e),r=ri(t.node.children,n);i&&r?(delete t.node.children[n],t.node.childCount--,wh(t)):i||r||(t.node.children[n]=e.node,t.node.childCount++,wh(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 vh=/[\[\].#$\/\u0000-\u001F\u007F]/,gh=/[\[\].#$\u0000-\u001F\u007F]/,bh=10485760,yh=function(t){return"string"==typeof t&&0!==t.length&&!vh.test(t)},_h=function(t){return"string"==typeof t&&0!==t.length&&!gh.test(t)},Sh=function(t,n,e,i){i&&void 0===n||Eh(li(t,"value"),n,e)},Eh=function(t,n,e){const i=e instanceof fs?new Cs(e,t):e;if(void 0===n)throw new Error(t+"contains undefined "+Ms(i));if("function"==typeof n)throw new Error(t+"contains a function "+Ms(i)+" with contents = "+n.toString());if(Mr(n))throw new Error(t+"contains "+n.toString()+" "+Ms(i));if("string"==typeof n&&n.length>bh/3&&fi(n)>bh)throw new Error(t+"contains a string greater than "+bh+" utf8 bytes "+Ms(i)+" ('"+n.substring(0,50)+"...')");if(n&&"object"==typeof n){let e=!1,r=!1;if(xr(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+") "+Ms(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_+=fi(n),js(t)}(i,n),Eh(t,s,i),function(t){const n=t.parts_.pop();t.byteLength_-=fi(n),t.parts_.length>0&&(t.byteLength_-=1)}(i)})),e&&r)throw new Error(t+' contains ".value" child '+Ms(i)+" in addition to actual children.")}},Ih=function(t,n,e,i){if(!(i&&void 0===e||_h(e)))throw new Error(li(t,n)+'was an invalid path = "'+e+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},kh=function(t,n){if(".info"===ps(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 Ch{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function jh(t,n){let e=null;for(let i=0;i<n.length;i++){const r=n[i],s=r.getPath();null===e||Is(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 Mh(t,n,e){jh(t,e),Th(t,(t=>Is(t,n)))}function Oh(t,n,e){jh(t,e),Th(t,(t=>ks(t,n)||ks(n,t)))}function Th(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)?(Dh(t.eventLists_[i]),t.eventLists_[i]=null):e=!1)}e&&(t.eventLists_=[]),t.recursionDepth_--}function Dh(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();_r&&Er("event: "+e.toString()),Fr(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 Nh{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 Ch,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=_o(),this.transactionQueueTree_=new hh,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function Ah(t,n,e){if(t.stats_=ts(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 bo(t.repoInfo_,((n,e,i,r)=>{xh(t,n,e,i,r)}),t.authTokenProvider_,t.appCheckProvider_),setTimeout((()=>Ph(t,!0)),0);else{if(null!=e){if("object"!=typeof e)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{ei(e)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}t.persistentConnection_=new Ds(t.repoInfo_,n,((n,e,i,r)=>{xh(t,n,e,i,r)}),(n=>{Ph(t,n)}),(n=>{!function(t,n){xr(n,((n,e)=>{Lh(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 Qr[e]||(Qr[e]=new ko(t.stats_,t.server_)),Qr[e]}(t.repoInfo_),t.infoData_=new yo,t.infoSyncTree_=new Pu({startListening:(n,e,i,r)=>{let s=[];const o=t.infoData_.getNode(n._path);return o.isEmpty()||(s=Fu(t.infoSyncTree_,n._path,o),setTimeout((()=>{r("ok")}),0)),s},stopListening:()=>{}}),Lh(t,"connected",!1),t.serverSyncTree_=new Pu({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 Rh(t){const n=t.infoData_.getNode(new fs(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+n}function $h(t){return(n=(n={timestamp:Rh(t)})||{}).timestamp=n.timestamp||(new Date).getTime(),n;var n}function xh(t,n,e,i,r){t.dataUpdateCount++;const s=new fs(n);e=t.interceptServerDataCallback_?t.interceptServerDataCallback_(n,e):e;let o=[];if(r)if(i){const n=ui(e,(t=>so(t)));o=function(t,n,e,i){const r=Gu(t,i);if(r){const i=Xu(r),s=i.path,o=i.queryId,u=Ss(s,n),h=Bo.fromObject(e);return Zu(t,s,new Do(jo(o),u,h))}return[]}(t.serverSyncTree_,s,n,r)}else{const n=so(e);o=function(t,n,e,i){const r=Gu(t,i);if(null!=r){const i=Xu(r),s=i.path,o=i.queryId,u=Ss(s,n);return Zu(t,s,new To(jo(o),u,e))}return[]}(t.serverSyncTree_,s,n,r)}else if(i){const n=ui(e,(t=>so(t)));o=function(t,n,e){const i=Bo.fromObject(e);return Hu(t,new Do({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},n,i))}(t.serverSyncTree_,s,n)}else{const n=so(e);o=Fu(t.serverSyncTree_,s,n)}let u=s;o.length>0&&(u=zh(t,s)),Oh(t.eventQueue_,u,o)}function Ph(t,n){Lh(t,"connected",n),!1===n&&function(t){Bh(t,"onDisconnectEvents");const n=$h(t),e=_o();Eo(t.onDisconnect_,ds(),((i,r)=>{const s=sh(i,r,t.serverSyncTree_,n);So(e,i,s)}));let i=[];Eo(e,ds(),((n,e)=>{i=i.concat(Fu(t.serverSyncTree_,n,e));const r=Gh(t,n);zh(t,r)})),t.onDisconnect_=_o(),Oh(t.eventQueue_,ds(),i)}(t)}function Lh(t,n,e){const i=new fs("/.info/"+n),r=so(e);t.infoData_.updateSnapshot(i,r);const s=Fu(t.infoSyncTree_,i,r);Oh(t.eventQueue_,i,s)}function Uh(t){return t.nextWriteId_++}function Fh(t,n,e){let i;i=".info"===ps(n._path)?Bu(t.infoSyncTree_,n,e):Bu(t.serverSyncTree_,n,e),Mh(t.eventQueue_,n._path,i)}function Bh(t,...n){let e="";t.persistentConnection_&&(e=t.persistentConnection_.id+":"),Er(e,...n)}function qh(t,n,e,i){n&&Fr((()=>{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 Wh(t,n,e){return Wu(t.serverSyncTree_,n,e)||io.EMPTY_NODE}function Hh(t,n=t.transactionQueueTree_){if(n||Kh(t,n),ah(n)){const e=Yh(t,n);Le(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=Wh(t,n,i);let s=r;const o=r.hash();for(let t=0;t<e.length;t++){const i=e[t];Le(0===i.status,"tryToSendTransactionQueue_: items in queue should all be run."),i.status=1,i.retryCount++;const r=Ss(n,i.path);s=s.updateChild(r,i.currentOutputSnapshotRaw)}const u=s.val(!0),h=n;t.server_.put(h.toString(),u,(i=>{Bh(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(Uu(t.serverSyncTree_,e[n].currentWriteId)),e[n].onComplete&&i.push((()=>e[n].onComplete(null,!0,e[n].currentOutputSnapshotResolved))),e[n].unwatcher();Kh(t,ch(t.transactionQueueTree_,n)),Hh(t,t.transactionQueueTree_),Oh(t.eventQueue_,n,r);for(let t=0;t<i.length;t++)Fr(i[t])}else{if("datastale"===i)for(let t=0;t<e.length;t++)e[t].status=3===e[t].status?4:0;else{jr("transaction at "+h.toString()+" failed: "+i);for(let t=0;t<e.length;t++)e[t].status=4,e[t].abortReason=i}zh(t,n)}}),o)}(t,mh(n),e)}else fh(n)&&dh(n,(n=>{Hh(t,n)}))}function zh(t,n){const e=Vh(t,n),i=mh(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=Ss(e,u.path);let c,a=!1;if(Le(null!==h,"rerunTransactionsUnderNode_: relativePath should not be null."),4===u.status)a=!0,c=u.abortReason,r=r.concat(Uu(t.serverSyncTree_,u.currentWriteId,!0));else if(0===u.status)if(u.retryCount>=25)a=!0,c="maxretry",r=r.concat(Uu(t.serverSyncTree_,u.currentWriteId,!0));else{const e=Wh(t,u.path,s);u.currentInputSnapshot=e;const i=n[o].update(e.val());if(void 0!==i){Eh("transaction failed: Data returned ",i,u.path);let n=so(i);"object"==typeof i&&null!=i&&ri(i,".priority")||(n=n.updatePriority(e.getPriority()));const o=u.currentWriteId,h=$h(t),c=oh(n,e,h);u.currentOutputSnapshotRaw=n,u.currentOutputSnapshotResolved=c,u.currentWriteId=Uh(t),s.splice(s.indexOf(o),1),r=r.concat(Lu(t.serverSyncTree_,u.path,c,u.currentWriteId,u.applyLocally)),r=r.concat(Uu(t.serverSyncTree_,o,!0))}else a=!0,c="nodata",r=r.concat(Uu(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)))}Kh(t,t.transactionQueueTree_);for(let t=0;t<i.length;t++)Fr(i[t]);Hh(t,t.transactionQueueTree_)}(t,Yh(t,e),i),i}function Vh(t,n){let e,i=t.transactionQueueTree_;for(e=ps(n);null!==e&&void 0===ah(i);)i=ch(i,e),e=ps(n=ws(n));return i}function Yh(t,n){const e=[];return Jh(t,n,e),e.sort(((t,n)=>t.order-n.order)),e}function Jh(t,n,e){const i=ah(n);if(i)for(let t=0;t<i.length;t++)e.push(i[t]);dh(n,(n=>{Jh(t,n,e)}))}function Kh(t,n){const e=ah(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,lh(n,e.length>0?e:void 0)}dh(n,(n=>{Kh(t,n)}))}function Gh(t,n){const e=mh(Vh(t,n)),i=ch(t.transactionQueueTree_,n);return function(t,n){let e=t.parent;for(;null!==e;){if(n(e))return!0;e=e.parent}}(i,(n=>{Xh(t,n)})),Xh(t,i),ph(i,(n=>{Xh(t,n)})),e}function Xh(t,n){const e=ah(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?(Le(s===n-1,"All SENT items should be at beginning of queue."),s=n,e[n].status=3,e[n].abortReason="set"):(Le(0===e[n].status,"Unexpected transaction status in abort"),e[n].unwatcher(),r=r.concat(Uu(t.serverSyncTree_,e[n].currentWriteId,!0)),e[n].onComplete&&i.push(e[n].onComplete.bind(null,new Error("set"),!1,null))));-1===s?lh(n,void 0):e.length=s+1,Oh(t.eventQueue_,mh(n),r);for(let t=0;t<i.length;t++)Fr(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 Zh=function(t,n){const e=Qh(t),i=e.namespace;return"firebase.com"===e.domain&&Cr(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),i&&"undefined"!==i||"localhost"===e.domain||Cr("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:")&&jr("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),{repoInfo:new Kr(e.host,e.secure,i,"ws"===e.scheme||"wss"===e.scheme,n,"",i!==e.subdomain),path:new fs(e.pathString)}},Qh=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]):jr(`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}},tc="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",nc=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]=tc.charAt(e%64),e=Math.floor(e/64);Le(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+=tc.charAt(n[r]);return Le(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 ec{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+":"+ei(this.snapshot.exportVal())}}class ic{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 rc{constructor(t,n){this.snapshotCallback=t,this.cancelCallback=n}onValue(t,n){this.snapshotCallback.call(null,t,n)}onCancel(t){return Le(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 sc{constructor(t,n,e,i){this._repo=t,this._path=n,this._queryParams=e,this._orderByCalled=i}get key(){return _s(this._path)?null:vs(this._path)}get ref(){return new oc(this._repo,this._path)}get _queryIdentifier(){const t=go(this._queryParams),n=Rr(t);return"{}"===n?"default":n}get _queryObject(){return go(this._queryParams)}isEqual(t){if(!((t=di(t))instanceof sc))return!1;const n=this._repo===t._repo,e=Is(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 oc extends sc{constructor(t,n){super(t,n,new wo,!1)}get parent(){const t=bs(this._path);return null===t?null:new oc(this._repo,t)}get root(){let t=this;for(;null!==t.parent;)t=t.parent;return t}}class uc{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 fs(t),e=cc(this.ref,t);return new uc(this._node.getChild(n),e,Ks)}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 uc(e,cc(this.ref,n),Ks))))}hasChild(t){const n=new fs(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 hc(t,n){return(t=di(t))._checkNotDeleted("ref"),void 0!==n?cc(t._root,n):t._root}function cc(t,n){var e;return null===ps((t=di(t))._path)?("child","path",!1,(e=n)&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),Ih("child","path",e,false)):Ih("child","path",n,!1),new oc(t._repo,ys(t._path,n))}function ac(t,n){!function(t,n,e,i){if(i&&void 0===n)return;const r=li(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=[];xr(n,((t,n)=>{const i=new fs(t);if(Eh(r,n,ys(e,i)),".priority"===vs(i)&&!(null===(o=n)||"string"==typeof o||"number"==typeof o&&!Mr(o)||o&&"object"==typeof o&&ri(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=gs(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(Es);let r=null;for(e=0;e<n.length;e++){if(i=n[e],null!==r&&ks(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 Ge;return function(t,n,e,i){Bh(t,"update",{path:n.toString(),value:e});let r=!0;const s=$h(t),o={};if(xr(e,((e,i)=>{r=!1,o[e]=sh(ys(n,e),so(i),t.serverSyncTree_,s)})),r)Er("update() called with empty data. Don't do anything."),qh(0,i,"ok",void 0);else{const r=Uh(t),s=function(t,n,e,i){!function(t,n,e,i){Le(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=Ho(t.visibleWrites,n,e),t.lastWriteId=i}(t.pendingWriteTree_,n,e,i);const r=Bo.fromObject(e);return Hu(t,new Do({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},n,r))}(t.serverSyncTree_,n,o,r);jh(t.eventQueue_,s),t.server_.merge(n.toString(),e,((e,s)=>{const o="ok"===e;o||jr("update at "+n+" failed: "+e);const u=Uu(t.serverSyncTree_,r,!o),h=u.length>0?zh(t,n):n;Oh(t.eventQueue_,h,u),qh(0,i,e,s)})),xr(e,(e=>{const i=Gh(t,ys(n,e));zh(t,i)})),Oh(t.eventQueue_,n,[])}}(t._repo,t._path,n,e.wrapCallback((()=>{}))),e.promise}class lc{constructor(t){this.callbackContext=t}respondsTo(t){return"value"===t}createEvent(t,n){const e=n._queryParams.getIndex();return new ec("value",this,new uc(t.snapshotNode,new oc(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 ic(this,t,n):null}matches(t){return t instanceof lc&&(!t.callbackContext||!this.callbackContext||t.callbackContext.matches(this.callbackContext))}hasAnyCallback(){return null!==this.callbackContext}}class fc{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 ic(this,t,n):null}createEvent(t,n){Le(null!=t.childName,"Child events should have a childName.");const e=cc(new oc(n._repo,n._path),t.childName),i=n._queryParams.getIndex();return new ec(t.type,this,new uc(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 fc&&this.eventType===t.eventType&&(!this.callbackContext||!t.callbackContext||this.callbackContext.matches(t.callbackContext))}hasAnyCallback(){return!!this.callbackContext}}var dc;dc=oc,Le(!Cu,"__referenceConstructor has already been defined"),Cu=dc,function(t){Le(!ju,"__referenceConstructor has already been defined"),ju=t}(oc);
|
|
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 pc={};function mc(t,n,e,i,r){let s=i||t.options.databaseURL;void 0===s&&(t.options.projectId||Cr("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Er("Using default host for project ",t.options.projectId),s=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o,u,h=Zh(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=Zh(s,r),c=h.repoInfo):o=!h.repoInfo.secure;const a=r&&o?new Hr(Hr.OWNER):new Wr(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(\/|$)/,"/")),_h(t)}(e))throw new Error(li(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')})("Invalid Firebase Database URL",h),_s(h.path)||Cr("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=pc[n.name];r||(r={},pc[n.name]=r);let s=r[t.toURLString()];return s&&Cr("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),s=new Nh(t,!1,e,i),r[t.toURLString()]=s,s}(c,t,a,new qr(t.name,e));return new wc(l,t)}class wc{constructor(t,n){this._repoInternal=t,this.app=n,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(Ah(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new oc(this._repo,ds())),this._rootInternal}_delete(){return null!==this._rootInternal&&(function(t,n){const e=pc[n];e&&e[t.key]===t||Cr(`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&&Cr("Cannot call "+t+" on a deleted database.")}}function vc(t=function(t=Hi){const n=Vi.get(t);if(!n&&t===Hi&&Ke())return Zi();if(!n)throw Gi.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=Je())||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=di(t))._checkNotDeleted("useEmulator"),t._instanceStarted&&Cr("Cannot call useEmulator() after instance has already been initialized.");const r=t._repoInternal;let s;if(r.repoInfo_.nodeAdmin)i.mockUserToken&&Cr('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 Hr(Hr.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[He(JSON.stringify({alg:"none",type:"JWT"})),He(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 Hr(n)}!function(t,n,e,i){t.repoInfo_=new Kr(`${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}Ds.prototype.simpleListen=function(t,n){this.sendRequest("q",{p:t},n)},Ds.prototype.echo=function(t,n){this.sendRequest("echo",{d:t},n)},lr="10.0.0",Ki(new pi("database",((t,{instanceIdentifier:n})=>mc(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"),t.getProvider("app-check-internal"),n)),"PUBLIC").setMultipleInstances(!0)),Qi(cr,ar,void 0),Qi(cr,ar,"esm2017");var gc,bc=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",b={};b[g]=m;var y=function(t){return t instanceof I},_=function(t,n,e){var i;if(!t)return g;if("string"==typeof t)b[t]&&(i=t),n&&(b[t]=n,i=t);else{var r=t.name;b[r]=t,i=r}return!e&&i&&(g=i),i||!e&&g},S=function(t,n){if(y(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=y,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 b=this.$locale().weekStart||0,y=(m<b?m+7:m)-b;return d(c?v-y:v+(6-y),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 b[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=y,S.unix=function(t){return S(1e3*t)},S.en=b[g],S.Ls=b,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 _c(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 Sc(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 Ec(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"}(gc||(gc={}));class Ic{constructor(t){Object.assign(this,t)}}function kc(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?bc(`${n} ${e}`,Ae).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?bc(`${r} ${s}`,Ae).valueOf():null,u=t.media_type===gc.Video||t.full_image_url.indexOf(".mp4")>-1;return new Ic({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?gc.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 Cc{constructor(t){Object.assign(this,t)}}function jc(t){return new Cc({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 Mc{constructor(t){Object.assign(this,t)}}function Oc(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?bc(`${n} ${e}`,Ae).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?bc(`${r} ${s}`,Ae).valueOf():null;return new Mc({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:Ec(t.user)})}class Tc{constructor(t){Object.assign(this,t)}}function Dc(t){const[n,e]=t.create_date?String(t.create_date).split(" "):[],i=n&&e?bc(`${n} ${e}`,Ae).valueOf():null,[r,s]=t.update_date?String(t.update_date).split(" "):[],o=r&&s?bc(`${r} ${s}`,Ae).valueOf():null,u=[kc(t)].concat(t.album_medias?t.album_medias.map(kc).filter((n=>n.id!==t.id)):[]),{total_booked:h,total_like:c,total_share:a,total_view:l}=t.style_activity||{};return new Tc({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?jc(t.album):null,owner:t.user?Ec(t.user):null,salonId:t.salon_id?Number(t.salon_id):null,salon:t.salon?xe(t.salon):null,stylistId:t.stylist_id?Number(t.stylist_id):null,stylist:t.stylist?Sc(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 Nc({mediaType:t}){return t===gc.Video}function Ac(t){return{id:t.id,caption:t.caption,imageUrl:t.full_image_url,imageUrlThumb:t.full_image_url_thumb}}function Rc(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:bc(`${e} ${i}`,Ae).valueOf(),updatedDate:bc(`${r} ${s}`,Ae).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?Ec(t.user):null,salon:t.salon?xe(t.salon):null,stylist:t.stylist&&t.stylist.user?_c(t.stylist):null,photos:n.map(Ac)}}class $c{constructor(t){Object.assign(this,t)}}function xc(t){return new $c({id:t.id,uid:t.firebase_room_id,members:t.from_user&&t.to_user?[Ec(t.from_user),Ec(t.to_user)]:[],messages:[]})}const Pc="api-ver2",Lc="favesalon--messages";class Uc{constructor(){this.http=null,this.http=De.create({baseURL:"https://favesalon.com",headers:{}});try{this.firebaseApp||(this.firebaseApp=Zi({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=vc(this.firebaseApp)}catch(t){}}fetchStyleDetail(t){return this.http.get(`${Pc}/style/${t}/detail`).then((t=>{const{status:n,data:e}=t.data;if(n){let t=null,n=[];try{t=Dc(e),n=(e.style_similars||[]).map(Dc)}catch(t){}return{styleInfo:t,similarStyles:n}}return{styleInfo:null,similarStyles:[]}})).catch((()=>({styleInfo:null,similarStyles:[]})))}fetchSalonInfo(t){return this.http.get(`${Pc}/salon/${t}/detail`).then((t=>{const{status:n,data:e}=t.data;return n&&e?xe(e):null})).catch((()=>null))}fetchSalonLatestStyles(t,n){return this.http.post(`${Pc}/salon/${t}/styles`,Object.assign(Object.assign({},n),{sort:"newest"})).then((t=>{const{data:e}=t.data;return(e||[]).slice(0,n.limit).map(Dc)})).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(`${Pc}/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(_c)}})).catch((()=>({total:0,data:[]})))}fetchSalonReviews(t,n){return this.http.post(`${Pc}/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(Rc)}})).catch((()=>({total:0,stats:{},data:[]})))}fetchSalonCategories(){return this.http.post(`${Pc}/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=`${Pc}/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(Dc)}:e})).catch((()=>e))}fetchStyleComments(t){return this.http.get(`${Pc}/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(`${Pc}/chatroom/create/${t}?access_token=${n}`).then((t=>xc(st(t,"data.data",{})))).catch((()=>null))}fetchRooms(t,n,e=[]){return this.http.get(`${Pc}/chatroom/get?page=${n}&limit=20&access_token=${t}`).then((i=>{const r=st(i,"data.data",[]).map(xc);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)=>{Fh(t._repo,t,u),n(e,i)};i.userCallback=e.userCallback,i.context=e.context,e=i}const o=new rc(e,s||void 0),u="value"===n?new lc(o):new fc(n,o);!function(t,n,e){let i;i=".info"===ps(n._path)?qu(t.infoSyncTree_,n,e):qu(t.serverSyncTree_,n,e),Mh(t.eventQueue_,n._path,i)}(t._repo,t,u)})(hc(this.firebaseDatabase,`${Lc}/${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:Number(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=hc(this.firebaseDatabase,`${Lc}/${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})})),ac(e,i)}catch(t){}return Promise.reject()}sendChatMessage(t){if(this.firebaseDatabase)try{const{message:n,senderId:e,chatRoomId:i}=t,r=hc(this.firebaseDatabase,`${Lc}`),s=function(t,n){t=di(t),kh("push",t._path),Sh("push",n,t._path,!0);const e=Rh(t._repo),i=nc(e),r=cc(t,i),s=cc(t,i);let o;return o=null!=n?function(t,n){t=di(t),kh("set",t._path),Sh("set",n,t._path,!1);const e=new Ge;return function(t,n,e,i,r){Bh(t,"set",{path:n.toString(),value:e,priority:null});const s=$h(t),o=so(e,null),u=Wu(t.serverSyncTree_,n),h=oh(o,u,s),c=Uh(t),a=Lu(t.serverSyncTree_,n,h,c,!0);jh(t.eventQueue_,a),t.server_.put(n.toString(),o.val(!0),((e,i)=>{const s="ok"===e;s||jr("set at "+n+" failed: "+e);const o=Uu(t.serverSyncTree_,c,!s);Oh(t.eventQueue_,n,o),qh(0,r,e,i)}));const l=Gh(t,n);zh(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}(cc(r,i)).key,o=`/${i}/${s}`,u={message:n,unRead:1,senderId:e,timestamp:bc().valueOf()};return ac(r,{[o]:u}).then((()=>Object.assign(Object.assign({},u),{uid:s})))}catch(t){}return Promise.reject()}}const Fc=()=>new Uc;export{$e as B,Fc as H,Ne as a,Bn as b,bc as d,Pe as g,Nc as i,Re as s}
|