@thefittingroom/shop-ui 1.3.12 → 1.3.13
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/esm/index.js +7 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +36 -36
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.3.
|
|
2
|
+
* thefittingroom v1.3.13 (2024-07-06T01:53:10.344Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={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,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(r.push(c),64!==o){const t=s<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},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)}}},s=function(t){return function(t){const e=r(t);return i.encodeByteArray(e,!0)}(t).replace(/\./g,"")},o=function(t){try{return i.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
@@ -121,7 +121,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
121
121
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
122
|
* See the License for the specific language governing permissions and
|
|
123
123
|
* limitations under the License.
|
|
124
|
-
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function S(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=
|
|
124
|
+
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function S(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=T),void 0===r.error&&(r.error=T),void 0===r.complete&&(r.complete=T);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),i}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function T(){}
|
|
125
125
|
/**
|
|
126
126
|
* @license
|
|
127
127
|
* Copyright 2021 Google LLC
|
|
@@ -137,7 +137,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
137
137
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
138
138
|
* See the License for the specific language governing permissions and
|
|
139
139
|
* limitations under the License.
|
|
140
|
-
*/function
|
|
140
|
+
*/function E(t){return t&&t._delegate?t._delegate:t}class I{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,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}}
|
|
141
141
|
/**
|
|
142
142
|
* @license
|
|
143
143
|
* Copyright 2019 Google LLC
|
|
@@ -218,7 +218,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
218
218
|
* See the License for the specific language governing permissions and
|
|
219
219
|
* limitations under the License.
|
|
220
220
|
*/
|
|
221
|
-
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.0",et=new x("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",_t="@firebase/storage-compat",
|
|
221
|
+
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.0",et=new x("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",_t="@firebase/storage-compat",Tt="@firebase/firestore",Et="@firebase/firestore-compat",It="firebase",kt="[DEFAULT]",Ct={[Z]:"fire-core",[nt]:"fire-core-compat",[it]:"fire-analytics",[rt]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[St]:"fire-gcs",[_t]:"fire-gcs-compat",[Tt]:"fire-fst",[Et]:"fire-fst-compat","fire-js":"fire-js",[It]:"fire-js-all"},At=new Map,Rt=new Map;function Nt(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Lt(t){const e=t.name;if(Rt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Rt.set(e,t);for(const e of At.values())Nt(e,t);return!0}function Ot(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
222
222
|
/**
|
|
223
223
|
* @license
|
|
224
224
|
* Copyright 2019 Google LLC
|
|
@@ -315,7 +315,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
315
315
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
316
316
|
* See the License for the specific language governing permissions and
|
|
317
317
|
* limitations under the License.
|
|
318
|
-
*/var Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),zt(Z,tt,Yt),zt(Z,tt,"esm2017"),zt("fire-js","");var Jt=function(t,e){return Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Jt(t,e)};function Xt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var te,ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne=ne||{},re=ee||self;function ie(){}function se(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function oe(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ae="closure_uid_"+(1e9*Math.random()>>>0),ce=0;function le(t,e,n){return t.call.apply(t.bind,arguments)}function ue(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function he(t,e,n){return(he=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?le:ue).apply(null,arguments)}function de(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function fe(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function pe(){this.s=this.s,this.o=this.o}pe.prototype.s=!1,pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ae)&&t[ae]||(t[ae]=++ce))},pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var ge=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function ye(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function ve(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ve.prototype.h=function(){this.defaultPrevented=!0};var we=function(){if(!re.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{re.addEventListener("test",ie,e),re.removeEventListener("test",ie,e)}catch(t){}return t}();function be(t){return/^[\s\xa0]*$/.test(t)}var Se=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _e(t,e){return t<e?-1:t>e?1:0}function Ee(){var t=re.navigator;return t&&(t=t.userAgent)?t:""}function Te(t){return-1!=Ee().indexOf(t)}function Ie(t){return Ie[" "](t),t}Ie[" "]=ie;var ke,Ce,Ae=Te("Opera"),Re=Te("Trident")||Te("MSIE"),Ne=Te("Edge"),Le=Ne||Re,Oe=Te("Gecko")&&!(-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge"))&&!(Te("Trident")||Te("MSIE"))&&!Te("Edge"),De=-1!=Ee().toLowerCase().indexOf("webkit")&&!Te("Edge");function xe(){var t=re.document;return t?t.documentMode:void 0}t:{var Pe="",Me=(Ce=Ee(),Oe?/rv:([^\);]+)(\)|;)/.exec(Ce):Ne?/Edge\/([\d\.]+)/.exec(Ce):Re?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ce):De?/WebKit\/(\S+)/.exec(Ce):Ae?/(?:Version)[ \/]?(\S+)/.exec(Ce):void 0);if(Me&&(Pe=Me?Me[1]:""),Re){var Ue=xe();if(null!=Ue&&Ue>parseFloat(Pe)){ke=String(Ue);break t}}ke=Pe}var ze,Fe={};function Be(){return function(t){var e=Fe;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Se(String(ke)).split("."),n=Se("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=_e(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||_e(0==s[2].length,0==o[2].length)||_e(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(re.document&&Re){var Ve=xe();ze=Ve||(parseInt(ke,10)||void 0)}else ze=void 0;var He=ze;function je(t,e){if(ve.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Oe){t:{try{Ie(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:qe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&je.X.h.call(this)}}fe(je,ve);var qe={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var $e="closure_listenable_"+(1e6*Math.random()|0),Ke=0;function Ge(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++Ke,this.ba=this.ea=!1}function We(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Qe(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ye(t){var e={};for(var n in t)e[n]=t[n];return e}var Je="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Xe(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<Je.length;s++)n=Je[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ze(t){this.src=t,this.g={},this.h=0}function tn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=ge(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(We(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function en(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}Ze.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=en(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new Ge(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var nn="closure_lm_"+(1e6*Math.random()|0),rn={};function sn(t,e,n,r,i){if(r&&r.once)return an(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)sn(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.N(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!1,r,i)}function on(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=oe(i)?!!i.capture:!!i,a=dn(t);if(a||(t[nn]=a=new Ze(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=hn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)we||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(un(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function an(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)an(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.O(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!0,r,i)}function cn(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)cn(t,e[s],n,r,i);else r=oe(r)?!!r.capture:!!r,n=pn(n),t&&t[$e]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=en(s=t.g[e],n,r,i))&&(We(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=dn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=en(e,n,r,i)),(n=-1<t?e[t]:null)&&ln(n))}function ln(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[$e])tn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(un(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=dn(e))?(tn(n,t),0==n.h&&(n.src=null,e[nn]=null)):We(t)}}}function un(t){return t in rn?rn[t]:rn[t]="on"+t}function hn(t,e){if(t.ba)t=!0;else{e=new je(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&ln(t),t=n.call(r,e)}return t}function dn(t){return(t=t[nn])instanceof Ze?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(t){return"function"==typeof t?t:(t[fn]||(t[fn]=function(e){return t.handleEvent(e)}),t[fn])}function gn(){pe.call(this),this.i=new Ze(this),this.P=this,this.I=null}function mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new ve(e,t);else if(e instanceof ve)e.target=e.target||t;else{var i=e;Xe(e=new ve(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=yn(o,r,!0,e)&&i}if(i=yn(o=e.g=t,r,!0,e)&&i,i=yn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=yn(o=e.g=n[s],r,!1,e)&&i}function yn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&tn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}fe(gn,pe),gn.prototype[$e]=!0,gn.prototype.removeEventListener=function(t,e,n,r){cn(this,t,e,n,r)},gn.prototype.M=function(){if(gn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)We(n[r]);delete e.g[t],e.h--}}this.I=null},gn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},gn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vn=re.JSON.stringify;function wn(){var t=Cn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var bn,Sn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=_n.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),_n=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new En}),(function(t){return t.reset()})),En=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Tn(t){re.setTimeout((function(){throw t}),0)}function In(t,e){bn||function(){var t=re.Promise.resolve(void 0);bn=function(){t.then(An)}}(),kn||(bn(),kn=!0),Cn.add(t,e)}var kn=!1,Cn=new Sn;function An(){for(var t;t=wn();){try{t.h.call(t.g)}catch(t){Tn(t)}var e=_n;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}kn=!1}function Rn(t,e){gn.call(this),this.h=t||1,this.g=e||re,this.j=he(this.lb,this),this.l=Date.now()}function Nn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ln(t,e,n){if("function"==typeof t)n&&(t=he(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=he(t.handleEvent,t)}return 2147483647<Number(e)?-1:re.setTimeout(t,e||0)}function On(t){t.g=Ln((function(){t.g=null,t.i&&(t.i=!1,On(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}fe(Rn,gn),(te=Rn.prototype).ca=!1,te.R=null,te.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),mn(this,"tick"),this.ca&&(Nn(this),this.start()))}},te.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},te.M=function(){Rn.X.M.call(this),Nn(this),delete this.g};var Dn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Jt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:On(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(re.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(pe);function xn(t){pe.call(this),this.h=t,this.g={}}fe(xn,pe);var Pn=[];function Mn(t,e,n,r){Array.isArray(n)||(n&&(Pn[0]=n.toString()),n=Pn);for(var i=0;i<n.length;i++){var s=sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Un(t){Qe(t.g,(function(t,e){this.g.hasOwnProperty(e)&&ln(t)}),t),t.g={}}function zn(){this.g=!0}function Fn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return vn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}xn.prototype.M=function(){xn.X.M.call(this),Un(this)},xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},zn.prototype.Aa=function(){this.g=!1},zn.prototype.info=function(){};var Bn={},Vn=null;function Hn(){return Vn=Vn||new gn}function jn(t){ve.call(this,Bn.Pa,t)}function qn(t){var e=Hn();mn(e,new jn(e))}function $n(t,e){ve.call(this,Bn.STAT_EVENT,t),this.stat=e}function Kn(t){var e=Hn();mn(e,new $n(e,t))}function Gn(t,e){ve.call(this,Bn.Qa,t),this.size=e}function Wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return re.setTimeout((function(){t()}),e)}Bn.Pa="serverreachability",fe(jn,ve),Bn.STAT_EVENT="statevent",fe($n,ve),Bn.Qa="timingevent",fe(Gn,ve);var Qn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Yn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function Jn(){}function Xn(t){return t.h||(t.h=t.i())}function Zn(){}Jn.prototype.h=null;var tr,er={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function nr(){ve.call(this,"d")}function rr(){ve.call(this,"c")}function ir(){}function sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new xn(this),this.O=ar,t=Le?125:void 0,this.T=new Rn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new or}function or(){this.i=null,this.g="",this.h=!1}fe(nr,ve),fe(rr,ve),fe(ir,Jn),ir.prototype.g=function(){return new XMLHttpRequest},ir.prototype.i=function(){return{}},tr=new ir;var ar=45e3,cr={},lr={};function ur(t,e,n){t.K=1,t.v=Rr(Tr(e)),t.s=n,t.P=!0,hr(t,null)}function hr(t,e){t.F=Date.now(),gr(t),t.A=Tr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Hr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new or,t.g=Hi(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Dn(he(t.La,t,t.g),t.N)),Mn(t.S,t.g,"readystatechange",t.ib),e=t.H?Ye(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),qn(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function dr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function fr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=pr(t,n))==lr){4==e&&(t.o=4,Kn(14),i=!1),Fn(t.j,t.m,null,"[Incomplete Response]");break}if(r==cr){t.o=4,Kn(15),Fn(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}Fn(t.j,t.m,r,null),br(t,r)}dr(t)&&r!=lr&&r!=cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Kn(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),xi(e),e.K=!0,Kn(11))):(Fn(t.j,t.m,n,"[Invalid Chunked Response]"),wr(t),vr(t))}function pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?lr:(n=Number(e.substring(n,r)),isNaN(n)?cr:(r+=1)+n>e.length?lr:(e=e.substr(r,n),t.C=r+n,e))}function gr(t){t.V=Date.now()+t.O,mr(t,t.O)}function mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Wn(he(t.gb,t),e)}function yr(t){t.B&&(re.clearTimeout(t.B),t.B=null)}function vr(t){0==t.l.G||t.I||Ui(t.l,t)}function wr(t){yr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Nn(t.T),Un(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Qr(n.h,t)))if(!t.J&&Qr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mi(n),ki(n)}Di(n),Kn(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=Wn(he(n.cb,n),6e3));if(1>=Wr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else Fi(n,11)}else if((t.J||n.g==t)&&Mi(n),!be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(Yr(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Ar(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=Vi(r,r.H?r.ka:null,r.V),f.J){Jr(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(yr(p),gr(p)),r.g=f}else Oi(r);0<n.i.length&&Ai(n)}else"stop"!=s[0]&&"close"!=s[0]||Fi(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?Fi(n,7):Ii(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}qn()}catch(s){}}function Sr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(se(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(te=sr.prototype).setTimeout=function(t){this.O=t},te.ib=function(t){t=t.target;var e=this.L;e&&3==wi(t)?e.l():this.La(t)},te.La=function(t){try{if(t==this.g)t:{var e=wi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Le||this.g&&(this.h.h||this.g.fa()||bi(this.g)))){this.I||4!=e||7==n||qn(),yr(this);var r=this.g.aa();this.Y=r;e:if(dr(this)){var i=bi(this.g);t="";var s=i.length,o=4==wi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){wr(this),vr(this);var a="";break e}this.h.i=new re.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,Kn(12),wr(this),vr(this);break t}Fn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,br(this,r)}this.P?(fr(this,e,a),Le&&this.i&&3==e&&(Mn(this.S,this.T,"tick",this.hb),this.T.start())):(Fn(this.j,this.m,a,null),br(this,a)),4==e&&wr(this),this.i&&!this.I&&(4==e?Ui(this.l,this):(this.i=!1,gr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Kn(12)):(this.o=0,Kn(13)),wr(this),vr(this)}}}catch(e){}},te.hb=function(){if(this.g){var t=wi(this.g),e=this.g.fa();this.C<e.length&&(yr(this),fr(this,t,e),this.i&&4!=t&&gr(this))}},te.cancel=function(){this.I=!0,wr(this)},te.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(qn(),Kn(17)),wr(this),this.o=2,vr(this)):mr(this,this.V-t)};var _r=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Er(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Er){this.h=void 0!==e?e:t.h,Ir(this,t.j),this.s=t.s,this.g=t.g,kr(this,t.m),this.l=t.l,e=t.i;var n=new zr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Cr(this,n),this.o=t.o}else t&&(n=String(t).match(_r))?(this.h=!!e,Ir(this,n[1]||"",!0),this.s=Nr(n[2]||""),this.g=Nr(n[3]||"",!0),kr(this,n[4]),this.l=Nr(n[5]||"",!0),Cr(this,n[6]||"",!0),this.o=Nr(n[7]||"")):(this.h=!!e,this.i=new zr(null,this.h))}function Tr(t){return new Er(t)}function Ir(t,e,n){t.j=n?Nr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Cr(t,e,n){e instanceof zr?(t.i=e,function(t,e){e&&!t.j&&(Fr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Br(this,e),Hr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Lr(e,Mr)),t.i=new zr(e,t.h))}function Ar(t,e,n){t.i.set(e,n)}function Rr(t){return Ar(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Nr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Lr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Or),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Or(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Er.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Lr(e,Dr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Lr(e,Dr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Lr(n,"/"==n.charAt(0)?Pr:xr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Lr(n,Ur)),t.join("")};var Dr=/[#\/\?@]/g,xr=/[#\?:]/g,Pr=/[#\?]/g,Mr=/[#\?@]/g,Ur=/#/g;function zr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Fr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Br(t,e){Fr(t),e=jr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Vr(t,e){return Fr(t),e=jr(t,e),t.g.has(e)}function Hr(t,e,n){Br(t,e),0<n.length&&(t.i=null,t.g.set(jr(t,e),me(n)),t.h+=n.length)}function jr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(te=zr.prototype).add=function(t,e){Fr(this),this.i=null,t=jr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},te.forEach=function(t,e){Fr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},te.oa=function(){Fr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},te.W=function(t){Fr(this);var e=[];if("string"==typeof t)Vr(this,t)&&(e=e.concat(this.g.get(jr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},te.set=function(t,e){return Fr(this),this.i=null,Vr(this,t=jr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},te.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},te.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var qr=function(t,e){this.h=t,this.g=e};function $r(t){this.l=t||Kr,re.PerformanceNavigationTiming?t=0<(t=re.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(re.g&&re.g.Ga&&re.g.Ga()&&re.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kr=10;function Gr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Wr(t){return t.h?1:t.g?t.g.size:0}function Qr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Yr(t,e){t.g?t.g.add(e):t.h=e}function Jr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Xr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=Xt(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return me(t.i)}function Zr(){}function ti(){this.g=new Zr}function ei(t,e,n){var r=n||"";try{Sr(t,(function(t,n){var i=t;oe(t)&&(i=vn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function ni(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function ri(t){this.l=t.ac||null,this.j=t.jb||!1}function ii(t,e){gn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=si,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}$r.prototype.cancel=function(){var t,e;if(this.i=Xr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Xt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Zr.prototype.stringify=function(t){return re.JSON.stringify(t,void 0)},Zr.prototype.parse=function(t){return re.JSON.parse(t,void 0)},fe(ri,Jn),ri.prototype.g=function(){return new ii(this.l,this.j)},ri.prototype.i=function(t){return function(){return t}}({}),fe(ii,gn);var si=0;function oi(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function ai(t){t.readyState=4,t.l=null,t.j=null,t.A=null,ci(t)}function ci(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(te=ii.prototype).open=function(t,e){if(this.readyState!=si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,ci(this)},te.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||re).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},te.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ai(this)),this.readyState=si},te.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,ci(this)),this.g&&(this.readyState=3,ci(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==re.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;oi(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},te.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ai(this):ci(this),3==this.readyState&&oi(this)}},te.Va=function(t){this.g&&(this.response=this.responseText=t,ai(this))},te.Ua=function(t){this.g&&(this.response=t,ai(this))},te.ga=function(){this.g&&ai(this)},te.setRequestHeader=function(t,e){this.v.append(t,e)},te.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},te.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(ii.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var li=re.JSON.parse;function ui(t){gn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=hi,this.K=this.L=!1}fe(ui,gn);var hi="",di=/^https?$/i,fi=["POST","PUT"];function pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gi(t),yi(t)}function gi(t){t.D||(t.D=!0,mn(t,"complete"),mn(t,"error"))}function mi(t){if(t.h&&void 0!==ne&&(!t.C[1]||4!=wi(t)||2!=t.aa()))if(t.v&&4==wi(t))Ln(t.Ha,0,t);else if(mn(t,"readystatechange"),4==wi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(_r)[1]||null;if(!s&&re.self&&re.self.location){var o=re.self.location.protocol;s=o.substr(0,o.length-1)}i=!di.test(s?s.toLowerCase():"")}e=i}if(e)mn(t,"complete"),mn(t,"success");else{t.m=6;try{var a=2<wi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",gi(t)}}finally{yi(t)}}}function yi(t,e){if(t.g){vi(t);var n=t.g,r=t.C[0]?ie:null;t.g=null,t.C=null,e||mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function vi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(re.clearTimeout(t.A),t.A=null)}function wi(t){return t.g?t.g.readyState:0}function bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hi:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Si(t){var e="";return Qe(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function _i(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Si(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ar(t,e,n))}function Ei(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ti(t){this.Ca=0,this.i=[],this.j=new zn,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Ei("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Ei("baseRetryDelayMs",5e3,t),this.bb=Ei("retryDelaySeedMs",1e4,t),this.$a=Ei("forwardChannelMaxRetries",2,t),this.ta=Ei("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new $r(t&&t.concurrentRequestLimit),this.Fa=new ti,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Ii(t){if(Ci(t),3==t.G){var e=t.U++,n=Tr(t.F);Ar(n,"SID",t.I),Ar(n,"RID",e),Ar(n,"TYPE","terminate"),Ni(t,n),(e=new sr(t,t.j,e,void 0)).K=2,e.v=Rr(Tr(n)),n=!1,re.navigator&&re.navigator.sendBeacon&&(n=re.navigator.sendBeacon(e.v.toString(),"")),!n&&re.Image&&((new Image).src=e.v,n=!0),n||(e.g=Hi(e.l,null),e.g.da(e.v)),e.F=Date.now(),gr(e)}Bi(t)}function ki(t){t.g&&(xi(t),t.g.cancel(),t.g=null)}function Ci(t){ki(t),t.u&&(re.clearTimeout(t.u),t.u=null),Mi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&re.clearTimeout(t.m),t.m=null)}function Ai(t){Gr(t.h)||t.m||(t.m=!0,In(t.Ja,t),t.C=0)}function Ri(t,e){var n;n=e?e.m:t.U++;var r=Tr(t.F);Ar(r,"SID",t.I),Ar(r,"RID",n),Ar(r,"AID",t.T),Ni(t,r),t.o&&t.s&&_i(r,t.o,t.s),n=new sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Li(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Yr(t.h,n),ur(n,r,e)}function Ni(t,e){t.ia&&Qe(t.ia,(function(t,n){Ar(e,n,t)})),t.l&&Sr({},(function(t,n){Ar(e,n,t)}))}function Li(t,e,n){n=Math.min(t.i.length,n);var r=t.l?he(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{ei(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Oi(t){t.g||t.u||(t.Z=1,In(t.Ia,t),t.A=0)}function Di(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=Wn(he(t.Ia,t),zi(t,t.A)),t.A++,!0)}function xi(t){null!=t.B&&(re.clearTimeout(t.B),t.B=null)}function Pi(t){t.g=new sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Tr(t.sa);Ar(e,"RID","rpc"),Ar(e,"SID",t.I),Ar(e,"CI",t.L?"0":"1"),Ar(e,"AID",t.T),Ar(e,"TYPE","xmlhttp"),Ni(t,e),t.o&&t.s&&_i(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Rr(Tr(e)),n.s=null,n.P=!0,hr(n,t)}function Mi(t){null!=t.v&&(re.clearTimeout(t.v),t.v=null)}function Ui(t,e){var n=null;if(t.g==e){Mi(t),xi(t),t.g=null;var r=2}else{if(!Qr(t.h,e))return;n=e.D,Jr(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;mn(r=Hn(),new Gn(r,n)),Ai(t)}else Oi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(Wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=Wn(he(t.Ja,t,e),zi(t,t.C)),t.C++,0)))}(t,e)||2==r&&Di(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:Fi(t,5);break;case 4:Fi(t,10);break;case 3:Fi(t,6);break;default:Fi(t,2)}}function zi(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function Fi(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=he(t.kb,t);n||(n=new Er("//www.google.com/images/cleardot.gif"),re.location&&"http"==re.location.protocol||Ir(n,"https"),Rr(n)),function(t,e){var n=new zn;if(re.Image){var r=new Image;r.onload=de(ni,n,r,"TestLoadImage: loaded",!0,e),r.onerror=de(ni,n,r,"TestLoadImage: error",!1,e),r.onabort=de(ni,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=de(ni,n,r,"TestLoadImage: timeout",!1,e),re.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else Kn(2);t.G=0,t.l&&t.l.va(e),Bi(t),Ci(t)}function Bi(t){if(t.G=0,t.la=[],t.l){var e=Xr(t.h);0==e.length&&0==t.i.length||(ye(t.la,e),ye(t.la,t.i),t.h.i.length=0,me(t.i),t.i.length=0),t.l.ua()}}function Vi(t,e,n){var r=n instanceof Er?Tr(n):new Er(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),kr(r,r.m);else{var i=re.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Er(null,void 0);r&&Ir(s,r),e&&(s.g=e),i&&kr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Ar(r,n,e),Ar(r,"VER",t.ma),Ni(t,r),r}function Hi(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new ui(new ri({jb:!0})):new ui(t.ra)).Ka(t.H),e}function ji(){}function qi(){if(Re&&!(10<=Number(He)))throw Error("Environmental error: no available transport.")}function $i(t,e){gn.call(this),this.g=new Ti(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new Wi(this)}function Ki(t){nr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function Gi(){rr.call(this),this.status=1}function Wi(t){this.g=t}(te=ui.prototype).Ka=function(t){this.L=t},te.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():tr.g(),this.C=this.u?Xn(this.u):Xn(tr),this.g.onreadystatechange=he(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=Xt(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=re.FormData&&t instanceof re.FormData,!(0<=ge(fi,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Xt(n),f=d.next();!f.done;f=d.next()){var p=Zt(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{vi(this),0<this.B&&((this.K=function(t){return Re&&Be()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=he(this.qa,this)):this.A=Ln(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){pi(this,h)}},te.qa=function(){void 0!==ne&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,mn(this,"timeout"),this.abort(8))},te.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,mn(this,"complete"),mn(this,"abort"),yi(this))},te.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),yi(this,!0)),ui.X.M.call(this)},te.Ha=function(){this.s||(this.F||this.v||this.l?mi(this):this.fb())},te.fb=function(){mi(this)},te.aa=function(){try{return 2<wi(this)?this.g.status:-1}catch(t){return-1}},te.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},te.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),li(e)}},te.Ea=function(){return this.m},te.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(te=Ti.prototype).ma=8,te.G=1,te.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Xe(n=Ye(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Li(this,e,r),Ar(i=Tr(this.F),"RID",t),Ar(i,"CVER",22),this.D&&Ar(i,"X-HTTP-Session-Id",this.D),Ni(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Si(n)))+"&"+r:this.o&&_i(i,this.o,n)),Yr(this.h,e),this.Ya&&Ar(i,"TYPE","init"),this.O?(Ar(i,"$req",r),Ar(i,"SID","null"),e.Z=!0,ur(e,i,null)):ur(e,i,r),this.G=2}}else 3==this.G&&(t?Ri(this,t):0==this.i.length||Gr(this.h)||Ri(this))},te.Ia=function(){if(this.u=null,Pi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=Wn(he(this.eb,this),t)}},te.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,Kn(10),ki(this),Pi(this))},te.cb=function(){null!=this.v&&(this.v=null,ki(this),Di(this),Kn(19))},te.kb=function(t){t?(this.j.info("Successfully pinged google.com"),Kn(2)):(this.j.info("Failed to ping google.com"),Kn(1))},(te=ji.prototype).xa=function(){},te.wa=function(){},te.va=function(){},te.ua=function(){},te.Ra=function(){},qi.prototype.g=function(t,e){return new $i(t,e)},fe($i,gn),$i.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;Kn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=Vi(t,null,t.V),Ai(t)},$i.prototype.close=function(){Ii(this.g)},$i.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=vn(t),t=n);e.i.push(new qr(e.ab++,t)),3==e.G&&Ai(e)},$i.prototype.M=function(){this.g.l=null,delete this.j,Ii(this.g),delete this.g,$i.X.M.call(this)},fe(Ki,nr),fe(Gi,rr),fe(Wi,ji),Wi.prototype.xa=function(){mn(this.g,"a")},Wi.prototype.wa=function(t){mn(this.g,new Ki(t))},Wi.prototype.va=function(t){mn(this.g,new Gi)},Wi.prototype.ua=function(){mn(this.g,"b")},qi.prototype.createWebChannel=qi.prototype.g,$i.prototype.send=$i.prototype.u,$i.prototype.open=$i.prototype.m,$i.prototype.close=$i.prototype.close,Qn.NO_ERROR=0,Qn.TIMEOUT=8,Qn.HTTP_ERROR=6,Yn.COMPLETE="complete",Zn.EventType=er,er.OPEN="a",er.CLOSE="b",er.ERROR="c",er.MESSAGE="d",gn.prototype.listen=gn.prototype.N,ui.prototype.listenOnce=ui.prototype.O,ui.prototype.getLastError=ui.prototype.Oa,ui.prototype.getLastErrorCode=ui.prototype.Ea,ui.prototype.getStatus=ui.prototype.aa,ui.prototype.getResponseJson=ui.prototype.Sa,ui.prototype.getResponseText=ui.prototype.fa,ui.prototype.send=ui.prototype.da,ui.prototype.setWithCredentials=ui.prototype.Ka;var Qi=Qn,Yi=Yn,Ji=Bn,Xi=10,Zi=11,ts=ri,es=Zn,ns=ui;const rs="@firebase/firestore";
|
|
318
|
+
*/var Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),zt(Z,tt,Yt),zt(Z,tt,"esm2017"),zt("fire-js","");var Jt=function(t,e){return Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Jt(t,e)};function Xt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var te,ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne=ne||{},re=ee||self;function ie(){}function se(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function oe(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ae="closure_uid_"+(1e9*Math.random()>>>0),ce=0;function le(t,e,n){return t.call.apply(t.bind,arguments)}function ue(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function he(t,e,n){return(he=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?le:ue).apply(null,arguments)}function de(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function fe(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function pe(){this.s=this.s,this.o=this.o}pe.prototype.s=!1,pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ae)&&t[ae]||(t[ae]=++ce))},pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var ge=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function ye(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function ve(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ve.prototype.h=function(){this.defaultPrevented=!0};var we=function(){if(!re.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{re.addEventListener("test",ie,e),re.removeEventListener("test",ie,e)}catch(t){}return t}();function be(t){return/^[\s\xa0]*$/.test(t)}var Se=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _e(t,e){return t<e?-1:t>e?1:0}function Te(){var t=re.navigator;return t&&(t=t.userAgent)?t:""}function Ee(t){return-1!=Te().indexOf(t)}function Ie(t){return Ie[" "](t),t}Ie[" "]=ie;var ke,Ce,Ae=Ee("Opera"),Re=Ee("Trident")||Ee("MSIE"),Ne=Ee("Edge"),Le=Ne||Re,Oe=Ee("Gecko")&&!(-1!=Te().toLowerCase().indexOf("webkit")&&!Ee("Edge"))&&!(Ee("Trident")||Ee("MSIE"))&&!Ee("Edge"),De=-1!=Te().toLowerCase().indexOf("webkit")&&!Ee("Edge");function xe(){var t=re.document;return t?t.documentMode:void 0}t:{var Pe="",Me=(Ce=Te(),Oe?/rv:([^\);]+)(\)|;)/.exec(Ce):Ne?/Edge\/([\d\.]+)/.exec(Ce):Re?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ce):De?/WebKit\/(\S+)/.exec(Ce):Ae?/(?:Version)[ \/]?(\S+)/.exec(Ce):void 0);if(Me&&(Pe=Me?Me[1]:""),Re){var Ue=xe();if(null!=Ue&&Ue>parseFloat(Pe)){ke=String(Ue);break t}}ke=Pe}var ze,Fe={};function Be(){return function(t){var e=Fe;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Se(String(ke)).split("."),n=Se("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=_e(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||_e(0==s[2].length,0==o[2].length)||_e(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(re.document&&Re){var Ve=xe();ze=Ve||(parseInt(ke,10)||void 0)}else ze=void 0;var He=ze;function je(t,e){if(ve.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Oe){t:{try{Ie(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:qe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&je.X.h.call(this)}}fe(je,ve);var qe={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var $e="closure_listenable_"+(1e6*Math.random()|0),Ke=0;function Ge(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++Ke,this.ba=this.ea=!1}function We(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Qe(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ye(t){var e={};for(var n in t)e[n]=t[n];return e}var Je="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Xe(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<Je.length;s++)n=Je[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ze(t){this.src=t,this.g={},this.h=0}function tn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=ge(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(We(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function en(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}Ze.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=en(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new Ge(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var nn="closure_lm_"+(1e6*Math.random()|0),rn={};function sn(t,e,n,r,i){if(r&&r.once)return an(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)sn(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.N(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!1,r,i)}function on(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=oe(i)?!!i.capture:!!i,a=dn(t);if(a||(t[nn]=a=new Ze(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=hn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)we||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(un(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function an(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)an(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.O(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!0,r,i)}function cn(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)cn(t,e[s],n,r,i);else r=oe(r)?!!r.capture:!!r,n=pn(n),t&&t[$e]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=en(s=t.g[e],n,r,i))&&(We(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=dn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=en(e,n,r,i)),(n=-1<t?e[t]:null)&&ln(n))}function ln(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[$e])tn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(un(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=dn(e))?(tn(n,t),0==n.h&&(n.src=null,e[nn]=null)):We(t)}}}function un(t){return t in rn?rn[t]:rn[t]="on"+t}function hn(t,e){if(t.ba)t=!0;else{e=new je(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&ln(t),t=n.call(r,e)}return t}function dn(t){return(t=t[nn])instanceof Ze?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(t){return"function"==typeof t?t:(t[fn]||(t[fn]=function(e){return t.handleEvent(e)}),t[fn])}function gn(){pe.call(this),this.i=new Ze(this),this.P=this,this.I=null}function mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new ve(e,t);else if(e instanceof ve)e.target=e.target||t;else{var i=e;Xe(e=new ve(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=yn(o,r,!0,e)&&i}if(i=yn(o=e.g=t,r,!0,e)&&i,i=yn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=yn(o=e.g=n[s],r,!1,e)&&i}function yn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&tn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}fe(gn,pe),gn.prototype[$e]=!0,gn.prototype.removeEventListener=function(t,e,n,r){cn(this,t,e,n,r)},gn.prototype.M=function(){if(gn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)We(n[r]);delete e.g[t],e.h--}}this.I=null},gn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},gn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vn=re.JSON.stringify;function wn(){var t=Cn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var bn,Sn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=_n.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),_n=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Tn}),(function(t){return t.reset()})),Tn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function En(t){re.setTimeout((function(){throw t}),0)}function In(t,e){bn||function(){var t=re.Promise.resolve(void 0);bn=function(){t.then(An)}}(),kn||(bn(),kn=!0),Cn.add(t,e)}var kn=!1,Cn=new Sn;function An(){for(var t;t=wn();){try{t.h.call(t.g)}catch(t){En(t)}var e=_n;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}kn=!1}function Rn(t,e){gn.call(this),this.h=t||1,this.g=e||re,this.j=he(this.lb,this),this.l=Date.now()}function Nn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ln(t,e,n){if("function"==typeof t)n&&(t=he(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=he(t.handleEvent,t)}return 2147483647<Number(e)?-1:re.setTimeout(t,e||0)}function On(t){t.g=Ln((function(){t.g=null,t.i&&(t.i=!1,On(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}fe(Rn,gn),(te=Rn.prototype).ca=!1,te.R=null,te.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),mn(this,"tick"),this.ca&&(Nn(this),this.start()))}},te.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},te.M=function(){Rn.X.M.call(this),Nn(this),delete this.g};var Dn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Jt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:On(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(re.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(pe);function xn(t){pe.call(this),this.h=t,this.g={}}fe(xn,pe);var Pn=[];function Mn(t,e,n,r){Array.isArray(n)||(n&&(Pn[0]=n.toString()),n=Pn);for(var i=0;i<n.length;i++){var s=sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Un(t){Qe(t.g,(function(t,e){this.g.hasOwnProperty(e)&&ln(t)}),t),t.g={}}function zn(){this.g=!0}function Fn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return vn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}xn.prototype.M=function(){xn.X.M.call(this),Un(this)},xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},zn.prototype.Aa=function(){this.g=!1},zn.prototype.info=function(){};var Bn={},Vn=null;function Hn(){return Vn=Vn||new gn}function jn(t){ve.call(this,Bn.Pa,t)}function qn(t){var e=Hn();mn(e,new jn(e))}function $n(t,e){ve.call(this,Bn.STAT_EVENT,t),this.stat=e}function Kn(t){var e=Hn();mn(e,new $n(e,t))}function Gn(t,e){ve.call(this,Bn.Qa,t),this.size=e}function Wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return re.setTimeout((function(){t()}),e)}Bn.Pa="serverreachability",fe(jn,ve),Bn.STAT_EVENT="statevent",fe($n,ve),Bn.Qa="timingevent",fe(Gn,ve);var Qn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Yn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function Jn(){}function Xn(t){return t.h||(t.h=t.i())}function Zn(){}Jn.prototype.h=null;var tr,er={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function nr(){ve.call(this,"d")}function rr(){ve.call(this,"c")}function ir(){}function sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new xn(this),this.O=ar,t=Le?125:void 0,this.T=new Rn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new or}function or(){this.i=null,this.g="",this.h=!1}fe(nr,ve),fe(rr,ve),fe(ir,Jn),ir.prototype.g=function(){return new XMLHttpRequest},ir.prototype.i=function(){return{}},tr=new ir;var ar=45e3,cr={},lr={};function ur(t,e,n){t.K=1,t.v=Rr(Er(e)),t.s=n,t.P=!0,hr(t,null)}function hr(t,e){t.F=Date.now(),gr(t),t.A=Er(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Hr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new or,t.g=Hi(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Dn(he(t.La,t,t.g),t.N)),Mn(t.S,t.g,"readystatechange",t.ib),e=t.H?Ye(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),qn(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function dr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function fr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=pr(t,n))==lr){4==e&&(t.o=4,Kn(14),i=!1),Fn(t.j,t.m,null,"[Incomplete Response]");break}if(r==cr){t.o=4,Kn(15),Fn(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}Fn(t.j,t.m,r,null),br(t,r)}dr(t)&&r!=lr&&r!=cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Kn(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),xi(e),e.K=!0,Kn(11))):(Fn(t.j,t.m,n,"[Invalid Chunked Response]"),wr(t),vr(t))}function pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?lr:(n=Number(e.substring(n,r)),isNaN(n)?cr:(r+=1)+n>e.length?lr:(e=e.substr(r,n),t.C=r+n,e))}function gr(t){t.V=Date.now()+t.O,mr(t,t.O)}function mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Wn(he(t.gb,t),e)}function yr(t){t.B&&(re.clearTimeout(t.B),t.B=null)}function vr(t){0==t.l.G||t.I||Ui(t.l,t)}function wr(t){yr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Nn(t.T),Un(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Qr(n.h,t)))if(!t.J&&Qr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mi(n),ki(n)}Di(n),Kn(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=Wn(he(n.cb,n),6e3));if(1>=Wr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else Fi(n,11)}else if((t.J||n.g==t)&&Mi(n),!be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(Yr(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Ar(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=Vi(r,r.H?r.ka:null,r.V),f.J){Jr(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(yr(p),gr(p)),r.g=f}else Oi(r);0<n.i.length&&Ai(n)}else"stop"!=s[0]&&"close"!=s[0]||Fi(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?Fi(n,7):Ii(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}qn()}catch(s){}}function Sr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(se(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(te=sr.prototype).setTimeout=function(t){this.O=t},te.ib=function(t){t=t.target;var e=this.L;e&&3==wi(t)?e.l():this.La(t)},te.La=function(t){try{if(t==this.g)t:{var e=wi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Le||this.g&&(this.h.h||this.g.fa()||bi(this.g)))){this.I||4!=e||7==n||qn(),yr(this);var r=this.g.aa();this.Y=r;e:if(dr(this)){var i=bi(this.g);t="";var s=i.length,o=4==wi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){wr(this),vr(this);var a="";break e}this.h.i=new re.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,Kn(12),wr(this),vr(this);break t}Fn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,br(this,r)}this.P?(fr(this,e,a),Le&&this.i&&3==e&&(Mn(this.S,this.T,"tick",this.hb),this.T.start())):(Fn(this.j,this.m,a,null),br(this,a)),4==e&&wr(this),this.i&&!this.I&&(4==e?Ui(this.l,this):(this.i=!1,gr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Kn(12)):(this.o=0,Kn(13)),wr(this),vr(this)}}}catch(e){}},te.hb=function(){if(this.g){var t=wi(this.g),e=this.g.fa();this.C<e.length&&(yr(this),fr(this,t,e),this.i&&4!=t&&gr(this))}},te.cancel=function(){this.I=!0,wr(this)},te.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(qn(),Kn(17)),wr(this),this.o=2,vr(this)):mr(this,this.V-t)};var _r=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Tr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Tr){this.h=void 0!==e?e:t.h,Ir(this,t.j),this.s=t.s,this.g=t.g,kr(this,t.m),this.l=t.l,e=t.i;var n=new zr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Cr(this,n),this.o=t.o}else t&&(n=String(t).match(_r))?(this.h=!!e,Ir(this,n[1]||"",!0),this.s=Nr(n[2]||""),this.g=Nr(n[3]||"",!0),kr(this,n[4]),this.l=Nr(n[5]||"",!0),Cr(this,n[6]||"",!0),this.o=Nr(n[7]||"")):(this.h=!!e,this.i=new zr(null,this.h))}function Er(t){return new Tr(t)}function Ir(t,e,n){t.j=n?Nr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Cr(t,e,n){e instanceof zr?(t.i=e,function(t,e){e&&!t.j&&(Fr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Br(this,e),Hr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Lr(e,Mr)),t.i=new zr(e,t.h))}function Ar(t,e,n){t.i.set(e,n)}function Rr(t){return Ar(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Nr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Lr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Or),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Or(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Tr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Lr(e,Dr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Lr(e,Dr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Lr(n,"/"==n.charAt(0)?Pr:xr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Lr(n,Ur)),t.join("")};var Dr=/[#\/\?@]/g,xr=/[#\?:]/g,Pr=/[#\?]/g,Mr=/[#\?@]/g,Ur=/#/g;function zr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Fr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Br(t,e){Fr(t),e=jr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Vr(t,e){return Fr(t),e=jr(t,e),t.g.has(e)}function Hr(t,e,n){Br(t,e),0<n.length&&(t.i=null,t.g.set(jr(t,e),me(n)),t.h+=n.length)}function jr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(te=zr.prototype).add=function(t,e){Fr(this),this.i=null,t=jr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},te.forEach=function(t,e){Fr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},te.oa=function(){Fr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},te.W=function(t){Fr(this);var e=[];if("string"==typeof t)Vr(this,t)&&(e=e.concat(this.g.get(jr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},te.set=function(t,e){return Fr(this),this.i=null,Vr(this,t=jr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},te.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},te.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var qr=function(t,e){this.h=t,this.g=e};function $r(t){this.l=t||Kr,re.PerformanceNavigationTiming?t=0<(t=re.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(re.g&&re.g.Ga&&re.g.Ga()&&re.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kr=10;function Gr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Wr(t){return t.h?1:t.g?t.g.size:0}function Qr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Yr(t,e){t.g?t.g.add(e):t.h=e}function Jr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Xr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=Xt(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return me(t.i)}function Zr(){}function ti(){this.g=new Zr}function ei(t,e,n){var r=n||"";try{Sr(t,(function(t,n){var i=t;oe(t)&&(i=vn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function ni(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function ri(t){this.l=t.ac||null,this.j=t.jb||!1}function ii(t,e){gn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=si,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}$r.prototype.cancel=function(){var t,e;if(this.i=Xr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Xt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Zr.prototype.stringify=function(t){return re.JSON.stringify(t,void 0)},Zr.prototype.parse=function(t){return re.JSON.parse(t,void 0)},fe(ri,Jn),ri.prototype.g=function(){return new ii(this.l,this.j)},ri.prototype.i=function(t){return function(){return t}}({}),fe(ii,gn);var si=0;function oi(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function ai(t){t.readyState=4,t.l=null,t.j=null,t.A=null,ci(t)}function ci(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(te=ii.prototype).open=function(t,e){if(this.readyState!=si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,ci(this)},te.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||re).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},te.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ai(this)),this.readyState=si},te.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,ci(this)),this.g&&(this.readyState=3,ci(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==re.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;oi(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},te.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?ai(this):ci(this),3==this.readyState&&oi(this)}},te.Va=function(t){this.g&&(this.response=this.responseText=t,ai(this))},te.Ua=function(t){this.g&&(this.response=t,ai(this))},te.ga=function(){this.g&&ai(this)},te.setRequestHeader=function(t,e){this.v.append(t,e)},te.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},te.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(ii.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var li=re.JSON.parse;function ui(t){gn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=hi,this.K=this.L=!1}fe(ui,gn);var hi="",di=/^https?$/i,fi=["POST","PUT"];function pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gi(t),yi(t)}function gi(t){t.D||(t.D=!0,mn(t,"complete"),mn(t,"error"))}function mi(t){if(t.h&&void 0!==ne&&(!t.C[1]||4!=wi(t)||2!=t.aa()))if(t.v&&4==wi(t))Ln(t.Ha,0,t);else if(mn(t,"readystatechange"),4==wi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(_r)[1]||null;if(!s&&re.self&&re.self.location){var o=re.self.location.protocol;s=o.substr(0,o.length-1)}i=!di.test(s?s.toLowerCase():"")}e=i}if(e)mn(t,"complete"),mn(t,"success");else{t.m=6;try{var a=2<wi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",gi(t)}}finally{yi(t)}}}function yi(t,e){if(t.g){vi(t);var n=t.g,r=t.C[0]?ie:null;t.g=null,t.C=null,e||mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function vi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(re.clearTimeout(t.A),t.A=null)}function wi(t){return t.g?t.g.readyState:0}function bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hi:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Si(t){var e="";return Qe(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function _i(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Si(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ar(t,e,n))}function Ti(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ei(t){this.Ca=0,this.i=[],this.j=new zn,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Ti("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Ti("baseRetryDelayMs",5e3,t),this.bb=Ti("retryDelaySeedMs",1e4,t),this.$a=Ti("forwardChannelMaxRetries",2,t),this.ta=Ti("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new $r(t&&t.concurrentRequestLimit),this.Fa=new ti,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Ii(t){if(Ci(t),3==t.G){var e=t.U++,n=Er(t.F);Ar(n,"SID",t.I),Ar(n,"RID",e),Ar(n,"TYPE","terminate"),Ni(t,n),(e=new sr(t,t.j,e,void 0)).K=2,e.v=Rr(Er(n)),n=!1,re.navigator&&re.navigator.sendBeacon&&(n=re.navigator.sendBeacon(e.v.toString(),"")),!n&&re.Image&&((new Image).src=e.v,n=!0),n||(e.g=Hi(e.l,null),e.g.da(e.v)),e.F=Date.now(),gr(e)}Bi(t)}function ki(t){t.g&&(xi(t),t.g.cancel(),t.g=null)}function Ci(t){ki(t),t.u&&(re.clearTimeout(t.u),t.u=null),Mi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&re.clearTimeout(t.m),t.m=null)}function Ai(t){Gr(t.h)||t.m||(t.m=!0,In(t.Ja,t),t.C=0)}function Ri(t,e){var n;n=e?e.m:t.U++;var r=Er(t.F);Ar(r,"SID",t.I),Ar(r,"RID",n),Ar(r,"AID",t.T),Ni(t,r),t.o&&t.s&&_i(r,t.o,t.s),n=new sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Li(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Yr(t.h,n),ur(n,r,e)}function Ni(t,e){t.ia&&Qe(t.ia,(function(t,n){Ar(e,n,t)})),t.l&&Sr({},(function(t,n){Ar(e,n,t)}))}function Li(t,e,n){n=Math.min(t.i.length,n);var r=t.l?he(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{ei(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Oi(t){t.g||t.u||(t.Z=1,In(t.Ia,t),t.A=0)}function Di(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=Wn(he(t.Ia,t),zi(t,t.A)),t.A++,!0)}function xi(t){null!=t.B&&(re.clearTimeout(t.B),t.B=null)}function Pi(t){t.g=new sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Er(t.sa);Ar(e,"RID","rpc"),Ar(e,"SID",t.I),Ar(e,"CI",t.L?"0":"1"),Ar(e,"AID",t.T),Ar(e,"TYPE","xmlhttp"),Ni(t,e),t.o&&t.s&&_i(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Rr(Er(e)),n.s=null,n.P=!0,hr(n,t)}function Mi(t){null!=t.v&&(re.clearTimeout(t.v),t.v=null)}function Ui(t,e){var n=null;if(t.g==e){Mi(t),xi(t),t.g=null;var r=2}else{if(!Qr(t.h,e))return;n=e.D,Jr(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;mn(r=Hn(),new Gn(r,n)),Ai(t)}else Oi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(Wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=Wn(he(t.Ja,t,e),zi(t,t.C)),t.C++,0)))}(t,e)||2==r&&Di(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:Fi(t,5);break;case 4:Fi(t,10);break;case 3:Fi(t,6);break;default:Fi(t,2)}}function zi(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function Fi(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=he(t.kb,t);n||(n=new Tr("//www.google.com/images/cleardot.gif"),re.location&&"http"==re.location.protocol||Ir(n,"https"),Rr(n)),function(t,e){var n=new zn;if(re.Image){var r=new Image;r.onload=de(ni,n,r,"TestLoadImage: loaded",!0,e),r.onerror=de(ni,n,r,"TestLoadImage: error",!1,e),r.onabort=de(ni,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=de(ni,n,r,"TestLoadImage: timeout",!1,e),re.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else Kn(2);t.G=0,t.l&&t.l.va(e),Bi(t),Ci(t)}function Bi(t){if(t.G=0,t.la=[],t.l){var e=Xr(t.h);0==e.length&&0==t.i.length||(ye(t.la,e),ye(t.la,t.i),t.h.i.length=0,me(t.i),t.i.length=0),t.l.ua()}}function Vi(t,e,n){var r=n instanceof Tr?Er(n):new Tr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),kr(r,r.m);else{var i=re.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Tr(null,void 0);r&&Ir(s,r),e&&(s.g=e),i&&kr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Ar(r,n,e),Ar(r,"VER",t.ma),Ni(t,r),r}function Hi(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new ui(new ri({jb:!0})):new ui(t.ra)).Ka(t.H),e}function ji(){}function qi(){if(Re&&!(10<=Number(He)))throw Error("Environmental error: no available transport.")}function $i(t,e){gn.call(this),this.g=new Ei(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new Wi(this)}function Ki(t){nr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function Gi(){rr.call(this),this.status=1}function Wi(t){this.g=t}(te=ui.prototype).Ka=function(t){this.L=t},te.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():tr.g(),this.C=this.u?Xn(this.u):Xn(tr),this.g.onreadystatechange=he(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=Xt(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=re.FormData&&t instanceof re.FormData,!(0<=ge(fi,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Xt(n),f=d.next();!f.done;f=d.next()){var p=Zt(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{vi(this),0<this.B&&((this.K=function(t){return Re&&Be()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=he(this.qa,this)):this.A=Ln(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){pi(this,h)}},te.qa=function(){void 0!==ne&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,mn(this,"timeout"),this.abort(8))},te.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,mn(this,"complete"),mn(this,"abort"),yi(this))},te.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),yi(this,!0)),ui.X.M.call(this)},te.Ha=function(){this.s||(this.F||this.v||this.l?mi(this):this.fb())},te.fb=function(){mi(this)},te.aa=function(){try{return 2<wi(this)?this.g.status:-1}catch(t){return-1}},te.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},te.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),li(e)}},te.Ea=function(){return this.m},te.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(te=Ei.prototype).ma=8,te.G=1,te.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Xe(n=Ye(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Li(this,e,r),Ar(i=Er(this.F),"RID",t),Ar(i,"CVER",22),this.D&&Ar(i,"X-HTTP-Session-Id",this.D),Ni(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Si(n)))+"&"+r:this.o&&_i(i,this.o,n)),Yr(this.h,e),this.Ya&&Ar(i,"TYPE","init"),this.O?(Ar(i,"$req",r),Ar(i,"SID","null"),e.Z=!0,ur(e,i,null)):ur(e,i,r),this.G=2}}else 3==this.G&&(t?Ri(this,t):0==this.i.length||Gr(this.h)||Ri(this))},te.Ia=function(){if(this.u=null,Pi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=Wn(he(this.eb,this),t)}},te.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,Kn(10),ki(this),Pi(this))},te.cb=function(){null!=this.v&&(this.v=null,ki(this),Di(this),Kn(19))},te.kb=function(t){t?(this.j.info("Successfully pinged google.com"),Kn(2)):(this.j.info("Failed to ping google.com"),Kn(1))},(te=ji.prototype).xa=function(){},te.wa=function(){},te.va=function(){},te.ua=function(){},te.Ra=function(){},qi.prototype.g=function(t,e){return new $i(t,e)},fe($i,gn),$i.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;Kn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=Vi(t,null,t.V),Ai(t)},$i.prototype.close=function(){Ii(this.g)},$i.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=vn(t),t=n);e.i.push(new qr(e.ab++,t)),3==e.G&&Ai(e)},$i.prototype.M=function(){this.g.l=null,delete this.j,Ii(this.g),delete this.g,$i.X.M.call(this)},fe(Ki,nr),fe(Gi,rr),fe(Wi,ji),Wi.prototype.xa=function(){mn(this.g,"a")},Wi.prototype.wa=function(t){mn(this.g,new Ki(t))},Wi.prototype.va=function(t){mn(this.g,new Gi)},Wi.prototype.ua=function(){mn(this.g,"b")},qi.prototype.createWebChannel=qi.prototype.g,$i.prototype.send=$i.prototype.u,$i.prototype.open=$i.prototype.m,$i.prototype.close=$i.prototype.close,Qn.NO_ERROR=0,Qn.TIMEOUT=8,Qn.HTTP_ERROR=6,Yn.COMPLETE="complete",Zn.EventType=er,er.OPEN="a",er.CLOSE="b",er.ERROR="c",er.MESSAGE="d",gn.prototype.listen=gn.prototype.N,ui.prototype.listenOnce=ui.prototype.O,ui.prototype.getLastError=ui.prototype.Oa,ui.prototype.getLastErrorCode=ui.prototype.Ea,ui.prototype.getStatus=ui.prototype.aa,ui.prototype.getResponseJson=ui.prototype.Sa,ui.prototype.getResponseText=ui.prototype.fa,ui.prototype.send=ui.prototype.da,ui.prototype.setWithCredentials=ui.prototype.Ka;var Qi=Qn,Yi=Yn,Ji=Bn,Xi=10,Zi=11,ts=ri,es=Zn,ns=ui;const rs="@firebase/firestore";
|
|
319
319
|
/**
|
|
320
320
|
* @license
|
|
321
321
|
* Copyright 2017 Google LLC
|
|
@@ -444,7 +444,7 @@ let ss="9.15.0";
|
|
|
444
444
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
445
445
|
* See the License for the specific language governing permissions and
|
|
446
446
|
* limitations under the License.
|
|
447
|
-
*/class vs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class ws{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(is.UNAUTHENTICATED)))}shutdown(){}}class bs{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Ss{constructor(t){this.t=t,this.currentUser=is.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new ys;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new ys,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{cs("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(cs("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new ys)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(cs("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(fs("string"==typeof e.accessToken),new vs(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return fs(null===t||"string"==typeof t),new is(t)}}class _s{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=is.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(fs(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class
|
|
447
|
+
*/class vs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class ws{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(is.UNAUTHENTICATED)))}shutdown(){}}class bs{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Ss{constructor(t){this.t=t,this.currentUser=is.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new ys;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new ys,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{cs("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(cs("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new ys)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(cs("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(fs("string"==typeof e.accessToken),new vs(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return fs(null===t||"string"==typeof t),new is(t)}}class _s{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=is.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(fs(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Ts{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new _s(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(is.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Es{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Is{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&cs("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,cs("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{cs("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):cs("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(fs("string"==typeof t.token),this.A=t.token,new Es(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
448
448
|
/**
|
|
449
449
|
* @license
|
|
450
450
|
* Copyright 2020 Google LLC
|
|
@@ -734,7 +734,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
734
734
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
735
735
|
* See the License for the specific language governing permissions and
|
|
736
736
|
* limitations under the License.
|
|
737
|
-
*/(t)?9007199254740991:10:ds()}function lo(t,e){if(t===e)return!0;const n=co(t);if(n!==co(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return oo(t).isEqual(oo(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=eo(t.timestampValue),r=eo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return ro(t.bytesValue).isEqual(ro(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return no(t.geoPointValue.latitude)===no(e.geoPointValue.latitude)&&no(t.geoPointValue.longitude)===no(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return no(t.integerValue)===no(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=no(t.doubleValue),r=no(e.doubleValue);return n===r?Xs(n)===Xs(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Rs(t.arrayValue.values||[],e.arrayValue.values||[],lo);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(Ws(n)!==Ws(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!lo(n[t],r[t])))return!1;return!0}(t,e);default:return ds()}}function uo(t,e){return void 0!==(t.values||[]).find((t=>lo(t,e)))}function ho(t,e){if(t===e)return 0;const n=co(t),r=co(e);if(n!==r)return As(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return As(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=no(t.integerValue||t.doubleValue),r=no(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return fo(t.timestampValue,e.timestampValue);case 4:return fo(oo(t),oo(e));case 5:return As(t.stringValue,e.stringValue);case 6:return function(t,e){const n=ro(t),r=ro(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=As(n[t],r[t]);if(0!==e)return e}return As(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=As(no(t.latitude),no(e.latitude));return 0!==n?n:As(no(t.longitude),no(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=ho(n[t],r[t]);if(e)return e}return As(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===ao.mapValue&&e===ao.mapValue)return 0;if(t===ao.mapValue)return 1;if(e===ao.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=As(r[t],s[t]);if(0!==e)return e;const o=ho(n[r[t]],i[s[t]]);if(0!==o)return o}return As(r.length,s.length)}(t.mapValue,e.mapValue);default:throw ds()}}function fo(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return As(t,e);const n=eo(t),r=eo(e),i=As(n.seconds,r.seconds);return 0!==i?i:As(n.nanos,r.nanos)}function po(t){return go(t)}function go(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=eo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?ro(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Ms.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=go(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${go(t.fields[i])}`;return n+"}"}(t.mapValue):ds();var e,n}function mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function yo(t){return!!t&&"integerValue"in t}function vo(t){return!!t&&"arrayValue"in t}function wo(t){return!!t&&"nullValue"in t}function bo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function So(t){return!!t&&"mapValue"in t}function _o(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return Qs(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=_o(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=_o(t.arrayValue.values[n]);return e}return Object.assign({},t)}class
|
|
737
|
+
*/(t)?9007199254740991:10:ds()}function lo(t,e){if(t===e)return!0;const n=co(t);if(n!==co(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return oo(t).isEqual(oo(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=eo(t.timestampValue),r=eo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return ro(t.bytesValue).isEqual(ro(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return no(t.geoPointValue.latitude)===no(e.geoPointValue.latitude)&&no(t.geoPointValue.longitude)===no(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return no(t.integerValue)===no(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=no(t.doubleValue),r=no(e.doubleValue);return n===r?Xs(n)===Xs(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Rs(t.arrayValue.values||[],e.arrayValue.values||[],lo);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(Ws(n)!==Ws(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!lo(n[t],r[t])))return!1;return!0}(t,e);default:return ds()}}function uo(t,e){return void 0!==(t.values||[]).find((t=>lo(t,e)))}function ho(t,e){if(t===e)return 0;const n=co(t),r=co(e);if(n!==r)return As(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return As(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=no(t.integerValue||t.doubleValue),r=no(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return fo(t.timestampValue,e.timestampValue);case 4:return fo(oo(t),oo(e));case 5:return As(t.stringValue,e.stringValue);case 6:return function(t,e){const n=ro(t),r=ro(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=As(n[t],r[t]);if(0!==e)return e}return As(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=As(no(t.latitude),no(e.latitude));return 0!==n?n:As(no(t.longitude),no(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=ho(n[t],r[t]);if(e)return e}return As(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===ao.mapValue&&e===ao.mapValue)return 0;if(t===ao.mapValue)return 1;if(e===ao.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=As(r[t],s[t]);if(0!==e)return e;const o=ho(n[r[t]],i[s[t]]);if(0!==o)return o}return As(r.length,s.length)}(t.mapValue,e.mapValue);default:throw ds()}}function fo(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return As(t,e);const n=eo(t),r=eo(e),i=As(n.seconds,r.seconds);return 0!==i?i:As(n.nanos,r.nanos)}function po(t){return go(t)}function go(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=eo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?ro(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Ms.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=go(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${go(t.fields[i])}`;return n+"}"}(t.mapValue):ds();var e,n}function mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function yo(t){return!!t&&"integerValue"in t}function vo(t){return!!t&&"arrayValue"in t}function wo(t){return!!t&&"nullValue"in t}function bo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function So(t){return!!t&&"mapValue"in t}function _o(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return Qs(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=_o(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=_o(t.arrayValue.values[n]);return e}return Object.assign({},t)}class To{constructor(t,e){this.position=t,this.inclusive=e}}function Eo(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?Ms.comparator(Ms.fromName(o.referenceValue),n.key):ho(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function Io(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!lo(t.position[n],e.position[n]))return!1;return!0}
|
|
738
738
|
/**
|
|
739
739
|
* @license
|
|
740
740
|
* Copyright 2022 Google LLC
|
|
@@ -879,7 +879,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
879
879
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
880
880
|
* See the License for the specific language governing permissions and
|
|
881
881
|
* limitations under the License.
|
|
882
|
-
*/class ra{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ia(t){return new ra(t)}function sa(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function oa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function aa(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ca(t){return null!==t.collectionGroup}function la(t){const e=ps(t);if(null===e.dt){e.dt=[];const t=aa(e),n=oa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new Ho(t)),e.dt.push(new Ho(Ps.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new Ho(Ps.keyField(),t))}}}return e.dt}function ua(t){const e=ps(t);if(!e._t)if("F"===e.limitType)e._t=Zo(e.path,e.collectionGroup,la(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of la(e)){const e="desc"===n.dir?"asc":"desc";t.push(new Ho(n.field,e))}const n=e.endAt?new
|
|
882
|
+
*/class ra{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ia(t){return new ra(t)}function sa(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function oa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function aa(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ca(t){return null!==t.collectionGroup}function la(t){const e=ps(t);if(null===e.dt){e.dt=[];const t=aa(e),n=oa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new Ho(t)),e.dt.push(new Ho(Ps.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new Ho(Ps.keyField(),t))}}}return e.dt}function ua(t){const e=ps(t);if(!e._t)if("F"===e.limitType)e._t=Zo(e.path,e.collectionGroup,la(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of la(e)){const e="desc"===n.dir?"asc":"desc";t.push(new Ho(n.field,e))}const n=e.endAt?new To(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new To(e.startAt.position,e.startAt.inclusive):null;e._t=Zo(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function ha(t,e){e.getFirstInequalityField(),aa(t);const n=t.filters.concat([e]);return new ra(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function da(t,e,n){return new ra(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function fa(t,e){return ea(ua(t),ua(e))&&t.limitType===e.limitType}function pa(t){return`${ta(ua(t))}|lt:${t.limitType}`}function ga(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Do(t))).join(", ")}]`),Js(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>po(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>po(t))).join(",")),`Target(${e})`}(ua(t))}; limitType=${t.limitType})`}function ma(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Ms.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of la(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Eo(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,la(t),e))&&!(t.endAt&&!function(t,e,n){const r=Eo(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,la(t),e))}(t,e)}function ya(t){return(e,n)=>{let r=!1;for(const i of la(t)){const t=va(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function va(t,e,n){const r=t.field.isKeyField()?Ms.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?ho(r,i):ds()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ds()}}
|
|
883
883
|
/**
|
|
884
884
|
* @license
|
|
885
885
|
* Copyright 2020 Google LLC
|
|
@@ -911,7 +911,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
911
911
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
912
912
|
* See the License for the specific language governing permissions and
|
|
913
913
|
* limitations under the License.
|
|
914
|
-
*/class _a{constructor(){this._=void 0}}function
|
|
914
|
+
*/class _a{constructor(){this._=void 0}}function Ta(t,e,n){return t instanceof Ia?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):function(t,e){const n=function(t,e){return t instanceof Na?yo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),r=La(n)+La(t.gt);return yo(n)&&yo(t.gt)?ba(r):wa(t.yt,r)}(t,e)}function Ea(t,e,n){return t instanceof ka?Ca(t,e):t instanceof Aa?Ra(t,e):n}class Ia extends _a{}class ka extends _a{constructor(t){super(),this.elements=t}}function Ca(t,e){const n=Oa(e);for(const e of t.elements)n.some((t=>lo(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Aa extends _a{constructor(t){super(),this.elements=t}}function Ra(t,e){let n=Oa(e);for(const e of t.elements)n=n.filter((t=>!lo(t,e)));return{arrayValue:{values:n}}}class Na extends _a{constructor(t,e){super(),this.yt=t,this.gt=e}}function La(t){return no(t.integerValue||t.doubleValue)}function Oa(t){return vo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Da{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Da}static exists(t){return new Da(void 0,t)}static updateTime(t){return new Da(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function xa(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Pa{}function Ma(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new $a(t.key,Da.none()):new Ba(t.key,t.data,Da.none());{const n=t.data,r=Yo.empty();let i=new Go(Ps.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new Va(t.key,r,new Qo(i.toArray()),Da.none())}}function Ua(t,e,n){t instanceof Ba?function(t,e,n){const r=t.value.clone(),i=ja(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof Va?function(t,e,n){if(!xa(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=ja(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(Ha(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function za(t,e,n,r){return t instanceof Ba?function(t,e,n,r){if(!xa(t.precondition,e))return n;const i=t.value.clone(),s=qa(t.fieldTransforms,r,e);return i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null}(t,e,n,r):t instanceof Va?function(t,e,n,r){if(!xa(t.precondition,e))return n;const i=qa(t.fieldTransforms,r,e),s=e.data;return s.setAll(Ha(t)),s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return xa(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function Fa(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Rs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof ka&&e instanceof ka||t instanceof Aa&&e instanceof Aa?Rs(t.elements,e.elements,lo):t instanceof Na&&e instanceof Na?lo(t.gt,e.gt):t instanceof Ia&&e instanceof Ia}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Ba extends Pa{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class Va extends Pa{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Ha(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function ja(t,e,n){const r=new Map;fs(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,Ea(o,a,n[i]))}return r}function qa(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,Ta(t,s,e))}return r}class $a extends Pa{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
915
915
|
/**
|
|
916
916
|
* @license
|
|
917
917
|
* Copyright 2017 Google LLC
|
|
@@ -1024,7 +1024,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1024
1024
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1025
1025
|
* See the License for the specific language governing permissions and
|
|
1026
1026
|
* limitations under the License.
|
|
1027
|
-
*/const vc={asc:"ASCENDING",desc:"DESCENDING"},wc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},bc={and:"AND",or:"OR"};class Sc{constructor(t,e){this.databaseId=t,this.wt=e}}function _c(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function
|
|
1027
|
+
*/const vc={asc:"ASCENDING",desc:"DESCENDING"},wc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},bc={and:"AND",or:"OR"};class Sc{constructor(t,e){this.databaseId=t,this.wt=e}}function _c(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Tc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Ec(t){return fs(!!t),Ls.fromTimestamp(function(t){const e=eo(t);return new Ns(e.seconds,e.nanos)}(t))}function Ic(t,e){return function(t){return new Ds(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function kc(t){const e=Ds.fromString(t);return fs(Vc(e)),e}function Cc(t,e){const n=kc(e);if(n.get(1)!==t.databaseId.projectId)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ms(gs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ms(Nc(n))}function Ac(t,e){return Ic(t.databaseId,e)}function Rc(t){return new Ds(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Nc(t){return fs(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Lc(t,e){return{documents:[Ac(t,e.path)]}}function Oc(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ac(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ac(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return Bc(Ao.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:zc(t.field),direction:Pc(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||Js(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function Dc(t){let e=function(t){const e=kc(t);return 4===e.length?Ds.emptyPath():Nc(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){fs(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=xc(t);return e instanceof Ao&&No(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new Ho(Fc(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Js(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new To(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new To(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new ra(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function xc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=Fc(t.unaryFilter.field);return Co.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=Fc(t.unaryFilter.field);return Co.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Fc(t.unaryFilter.field);return Co.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Fc(t.unaryFilter.field);return Co.create(i,"!=",{nullValue:"NULL_VALUE"});default:return ds()}}(t):void 0!==t.fieldFilter?function(t){return Co.create(Fc(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return ds()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Ao.create(t.compositeFilter.filters.map((t=>xc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return ds()}}(t.compositeFilter.op))}(t):ds()}function Pc(t){return vc[t]}function Mc(t){return wc[t]}function Uc(t){return bc[t]}function zc(t){return{fieldPath:t.canonicalString()}}function Fc(t){return Ps.fromServerFormat(t.fieldPath)}function Bc(t){return t instanceof Co?function(t){if("=="===t.op){if(bo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NAN"}};if(wo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(bo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NOT_NAN"}};if(wo(t.value))return{unaryFilter:{field:zc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:zc(t.field),op:Mc(t.op),value:t.value}}}(t):t instanceof Ao?function(t){const e=t.getFilters().map((t=>Bc(t)));return 1===e.length?e[0]:{compositeFilter:{op:Uc(t.op),filters:e}}}(t):ds()}function Vc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1028
1028
|
/**
|
|
1029
1029
|
* @license
|
|
1030
1030
|
* Copyright 2017 Google LLC
|
|
@@ -1200,7 +1200,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1200
1200
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1201
1201
|
* See the License for the specific language governing permissions and
|
|
1202
1202
|
* limitations under the License.
|
|
1203
|
-
*/class Zc{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return js.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:
|
|
1203
|
+
*/class Zc{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return js.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Ec(n.createTime)}),js.resolve()}getNamedQuery(t,e){return js.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:Kc(t.bundledQuery),readTime:Ec(t.readTime)}}(e)),js.resolve()}}
|
|
1204
1204
|
/**
|
|
1205
1205
|
* @license
|
|
1206
1206
|
* Copyright 2022 Google LLC
|
|
@@ -1408,7 +1408,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1408
1408
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1409
1409
|
* See the License for the specific language governing permissions and
|
|
1410
1410
|
* limitations under the License.
|
|
1411
|
-
*/class
|
|
1411
|
+
*/class Tl{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
|
|
1412
1412
|
/**
|
|
1413
1413
|
* @license
|
|
1414
1414
|
* Copyright 2017 Google LLC
|
|
@@ -1424,7 +1424,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1424
1424
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1425
1425
|
* See the License for the specific language governing permissions and
|
|
1426
1426
|
* limitations under the License.
|
|
1427
|
-
*/class
|
|
1427
|
+
*/class El extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,i){const s=this.ho(t,e);cs("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(cs("RestConnection","Received: ",t),t)),(e=>{throw us("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+ss,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=_l[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((i,s)=>{const o=new ns;o.setWithCredentials(!0),o.listenOnce(Yi.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case Qi.NO_ERROR:const e=o.getResponseJson();cs("Connection","XHR received:",JSON.stringify(e)),i(e);break;case Qi.TIMEOUT:cs("Connection",'RPC "'+t+'" timed out'),s(new ms(gs.DEADLINE_EXCEEDED,"Request time out"));break;case Qi.HTTP_ERROR:const n=o.getStatus();if(cs("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(gs).indexOf(e)>=0?e:gs.UNKNOWN}(e.status);s(new ms(t,e.message))}else s(new ms(gs.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new ms(gs.UNAVAILABLE,"Connection failed."));break;default:ds()}}finally{cs("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new qi,s=Hn(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new ts({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");cs("Connection","Creating WebChannel: "+a,o);const c=i.createWebChannel(a,o);let l=!1,u=!1;const h=new Tl({Hr:t=>{u?cs("Connection","Not sending because WebChannel is closed:",t):(l||(cs("Connection","Opening WebChannel transport."),c.open(),l=!0),cs("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,es.EventType.OPEN,(()=>{u||cs("Connection","WebChannel transport opened.")})),d(c,es.EventType.CLOSE,(()=>{u||(u=!0,cs("Connection","WebChannel transport closed"),h.io())})),d(c,es.EventType.ERROR,(t=>{u||(u=!0,us("Connection","WebChannel transport errored:",t),h.io(new ms(gs.UNAVAILABLE,"The operation could not be completed")))})),d(c,es.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];fs(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){cs("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=Ga[t];if(void 0!==e)return Qa(e)}(t),n=i.message;void 0===e&&(e=gs.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),u=!0,h.io(new ms(e,n)),c.close()}else cs("Connection","WebChannel received:",n),h.ro(n)}})),d(s,Ji.STAT_EVENT,(t=>{t.stat===Xi?cs("Connection","Detected buffering proxy"):t.stat===Zi&&cs("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function Il(){return"undefined"!=typeof document?document:null}
|
|
1428
1428
|
/**
|
|
1429
1429
|
* @license
|
|
1430
1430
|
* Copyright 2020 Google LLC
|
|
@@ -1456,7 +1456,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1456
1456
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1457
1457
|
* See the License for the specific language governing permissions and
|
|
1458
1458
|
* limitations under the License.
|
|
1459
|
-
*/class Al{constructor(t,e,n,r,i,s,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Cl(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===gs.RESOURCE_EXHAUSTED?(ls(e.toString()),ls("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===gs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new ms(gs.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return cs("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(cs("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Rl extends Al{constructor(t,e,n,r,i,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,s),this.yt=i}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:ds()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(fs(void 0===e||"string"==typeof e),Zs.fromBase64String(e||"")):(fs(void 0===e||e instanceof Uint8Array),Zs.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?gs.UNKNOWN:Qa(t.code);return new ms(e,t.message||"")}(o);n=new fc(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Cc(t,r.document.name),s=
|
|
1459
|
+
*/class Al{constructor(t,e,n,r,i,s,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Cl(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===gs.RESOURCE_EXHAUSTED?(ls(e.toString()),ls("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===gs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new ms(gs.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return cs("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(cs("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Rl extends Al{constructor(t,e,n,r,i,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,s),this.yt=i}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:ds()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(fs(void 0===e||"string"==typeof e),Zs.fromBase64String(e||"")):(fs(void 0===e||e instanceof Uint8Array),Zs.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?gs.UNKNOWN:Qa(t.code);return new ms(e,t.message||"")}(o);n=new fc(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Cc(t,r.document.name),s=Ec(r.document.updateTime),o=r.document.createTime?Ec(r.document.createTime):Ls.min(),a=new Yo({mapValue:{fields:r.document.fields}}),c=Jo.newFoundDocument(i,s,o,a),l=r.targetIds||[],u=r.removedTargetIds||[];n=new hc(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Cc(t,r.document),s=r.readTime?Ec(r.readTime):Ls.min(),o=Jo.newNoDocument(i,s),a=r.removedTargetIds||[];n=new hc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Cc(t,r.document),s=r.removedTargetIds||[];n=new hc([],s,i,null)}else{if(!("filter"in e))return ds();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,i=new Ka(r),s=t.targetId;n=new dc(s,i)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Ls.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Ls.min():e.readTime?Ec(e.readTime):Ls.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Rc(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=na(r)?{documents:Lc(t,r)}:{query:Oc(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Tc(t,e.resumeToken):e.snapshotVersion.compareTo(Ls.min())>0&&(n.readTime=_c(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return ds()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=Rc(this.yt),e.removeTarget=t,this.Bo(e)}}
|
|
1460
1460
|
/**
|
|
1461
1461
|
* @license
|
|
1462
1462
|
* Copyright 2017 Google LLC
|
|
@@ -1600,7 +1600,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1600
1600
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1601
1601
|
* See the License for the specific language governing permissions and
|
|
1602
1602
|
* limitations under the License.
|
|
1603
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new Zl(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Xl,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new cu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Zl.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class hu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class du{constructor(t){this.key=t,this.nc=!1}}class fu{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Ya((t=>pa(t)),fa),this.rc=new Map,this.oc=new Set,this.uc=new qo(Ms.comparator),this.cc=new Map,this.ac=new el,this.hc={},this.lc=new Map,this.fc=Qc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function pu(t,e){const n=function(t){const e=ps(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=mu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=ku.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=vu.bind(null,e),e.sc.Wo=iu.bind(null,e.eventManager),e.sc.wc=su.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=ps(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,js.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new qc(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,ua(e));n.isPrimaryClient&&Pl(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await yl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return Su(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await yl(t.localStore,e,!0),o=new uu(e,s.Hi),a=o.Wu(s.documents),c=uc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);Su(t,n,l.Xu);const u=new hu(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function gu(t,e){const n=ps(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!fa(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ml(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Ml(n.remoteStore,r.targetId),wu(n,r.targetId)})).catch(Hs)):(wu(n,r.targetId),await ml(n.localStore,r.targetId,!0))}async function mu(t,e){const n=ps(t);try{const t=await gl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(fs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?fs(r.nc):t.removedDocuments.size>0&&(fs(r.nc),r.nc=!1))})),await
|
|
1603
|
+
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new Zl(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Xl,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new cu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Zl.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class hu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class du{constructor(t){this.key=t,this.nc=!1}}class fu{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Ya((t=>pa(t)),fa),this.rc=new Map,this.oc=new Set,this.uc=new qo(Ms.comparator),this.cc=new Map,this.ac=new el,this.hc={},this.lc=new Map,this.fc=Qc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function pu(t,e){const n=function(t){const e=ps(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=mu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=ku.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=vu.bind(null,e),e.sc.Wo=iu.bind(null,e.eventManager),e.sc.wc=su.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=ps(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,js.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new qc(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,ua(e));n.isPrimaryClient&&Pl(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await yl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return Su(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await yl(t.localStore,e,!0),o=new uu(e,s.Hi),a=o.Wu(s.documents),c=uc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);Su(t,n,l.Xu);const u=new hu(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function gu(t,e){const n=ps(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!fa(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ml(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Ml(n.remoteStore,r.targetId),wu(n,r.targetId)})).catch(Hs)):(wu(n,r.targetId),await ml(n.localStore,r.targetId,!0))}async function mu(t,e){const n=ps(t);try{const t=await gl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(fs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?fs(r.nc):t.removedDocuments.size>0&&(fs(r.nc),r.nc=!1))})),await Eu(n,t,e)}catch(t){await Hs(t)}}function yu(t,e,n){const r=ps(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=ps(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&ou(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function vu(t,e,n){const r=ps(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new qo(Ms.comparator);t=t.insert(s,Jo.newNoDocument(s,Ls.min()));const n=oc().add(s),i=new lc(Ls.min(),new Map,new Go(As),t,n);await mu(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),Tu(r)}else await ml(r.localStore,e,!1).then((()=>wu(r,e,n))).catch(Hs)}function wu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||bu(t,e)}))}function bu(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(Ml(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Tu(t))}function Su(t,e,n){for(const r of n)r instanceof cu?(t.ac.addReference(r.key,e),_u(t,r)):r instanceof lu?(cs("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||bu(t,r.key)):ds()}function _u(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(cs("SyncEngine","New document in limbo: "+n),t.oc.add(r),Tu(t))}function Tu(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new Ms(Ds.fromString(e)),r=t.fc.next();t.cc.set(r,new du(n)),t.uc=t.uc.insert(n,r),Pl(t.remoteStore,new qc(ua(ia(n.path)),r,2,$s.at))}}async function Eu(t,e,n){const r=ps(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=ul.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=ps(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>js.forEach(e,(e=>js.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>js.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!qs(t))throw t;cs("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function Iu(t,e){const n=ps(t);if(!n.currentUser.isEqual(e)){cs("SyncEngine","User change. New user:",e.toKey());const t=await fl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new ms(gs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Eu(n,t.ji)}}function ku(t,e){const n=ps(t),r=n.cc.get(e);if(r&&r.nc)return oc().add(r.key);{let t=oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Cu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=kl(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new dl(t,e,n,r)}(this.persistence,new hl,t.initialUser,this.yt)}yc(t){return new al(ll.Bs,this.yt)}gc(t){return new wl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Au{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>yu(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Iu.bind(null,this.syncEngine),await async function(t,e){const n=ps(t);e?(n._u.delete(2),await Dl(n)):e||(n._u.add(2),await xl(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new eu}createDatastore(t){const e=kl(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new El(r));var r;return function(t,e,n,r){return new Nl(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>yu(this.syncEngine,t,0),s=Sl.C()?new Sl:new bl,new Ol(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new fu(t,e,n,r,i,s);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=ps(t);cs("RemoteStore","RemoteStore shutting down."),e._u.add(5),await xl(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1604
1604
|
/**
|
|
1605
1605
|
* @license
|
|
1606
1606
|
* Copyright 2017 Google LLC
|
|
@@ -1648,7 +1648,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1648
1648
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1649
1649
|
* See the License for the specific language governing permissions and
|
|
1650
1650
|
* limitations under the License.
|
|
1651
|
-
*/class Mu{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Pu({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new ms(gs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new ms(gs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Pu(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new ws;switch(t.type){case"gapi":const e=t.client;return new
|
|
1651
|
+
*/class Mu{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Pu({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new ms(gs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new ms(gs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Pu(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new ws;switch(t.type){case"gapi":const e=t.client;return new Ts(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new ms(gs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=xu.get(t);e&&(cs("ComponentProvider","Removing Datastore"),xu.delete(t),e.terminate())}(this),Promise.resolve()}}function Uu(t,e,n,r={}){var i;const o=(t=Du(t,Mu))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&us("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=is.MOCK_USER;else{e=function(t,e){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 n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[s(JSON.stringify({alg:"none",type:"JWT"})),s(JSON.stringify(o)),""].join(".")}
|
|
1652
1652
|
/**
|
|
1653
1653
|
* @license
|
|
1654
1654
|
* Copyright 2017 Google LLC
|
|
@@ -1680,7 +1680,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1680
1680
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1681
1681
|
* See the License for the specific language governing permissions and
|
|
1682
1682
|
* limitations under the License.
|
|
1683
|
-
*/class zu{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Bu(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new zu(this.firestore,t,this._key)}}class Fu{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Fu(this.firestore,t,this._query)}}class Bu extends Fu{constructor(t,e,n){super(t,e,ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new zu(this.firestore,null,new Ms(t))}withConverter(t){return new Bu(this.firestore,t,this._path)}}function Vu(t,e,...n){if(t=
|
|
1683
|
+
*/class zu{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Bu(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new zu(this.firestore,t,this._key)}}class Fu{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Fu(this.firestore,t,this._query)}}class Bu extends Fu{constructor(t,e,n){super(t,e,ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new zu(this.firestore,null,new Ms(t))}withConverter(t){return new Bu(this.firestore,t,this._path)}}function Vu(t,e,...n){if(t=E(t),Ru("collection","path",e),t instanceof Mu){const r=Ds.fromString(e,...n);return Lu(r),new Bu(t,null,r)}{if(!(t instanceof zu||t instanceof Bu))throw new ms(gs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ds.fromString(e,...n));return Lu(r),new Bu(t.firestore,null,r)}}function Hu(t,e,...n){if(t=E(t),1===arguments.length&&(e=Cs.R()),Ru("doc","path",e),t instanceof Mu){const r=Ds.fromString(e,...n);return Nu(r),new zu(t,null,new Ms(r))}{if(!(t instanceof zu||t instanceof Bu))throw new ms(gs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ds.fromString(e,...n));return Nu(r),new zu(t.firestore,t instanceof Bu?t.converter:null,new Ms(r))}}
|
|
1684
1684
|
/**
|
|
1685
1685
|
* @license
|
|
1686
1686
|
* Copyright 2020 Google LLC
|
|
@@ -1873,7 +1873,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1873
1873
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1874
1874
|
* See the License for the specific language governing permissions and
|
|
1875
1875
|
* limitations under the License.
|
|
1876
|
-
*/const rh=/^__.*__$/;function ih(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ds()}}class sh{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new sh(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return uh(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(ih(this.sa)&&rh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class oh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||kl(t)}da(t,e,n,r=!1){return new sh({sa:t,methodName:e,fa:n,path:Ps.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function ah(t,e){if(ch(t=
|
|
1876
|
+
*/const rh=/^__.*__$/;function ih(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ds()}}class sh{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new sh(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return uh(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(ih(this.sa)&&rh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class oh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||kl(t)}da(t,e,n,r=!1){return new sh({sa:t,methodName:e,fa:n,path:Ps.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function ah(t,e){if(ch(t=E(t)))return function(t,e,n){if(!ch(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Ou(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("Unsupported field value:",e,t),function(t,e){const n={};return Ys(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Qs(t,((t,r)=>{const i=ah(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}(t,e);if(t instanceof eh)return function(t,e){if(!ih(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=ah(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=E(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Sa(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ns.fromDate(t);return{timestampValue:_c(e.yt,n)}}if(t instanceof Ns){const n=new Ns(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:_c(e.yt,n)}}if(t instanceof nh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Zu)return{bytesValue:Tc(e.yt,t._byteString)};if(t instanceof zu){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ic(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ou(t)}`)}(t,e)}function ch(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ns||t instanceof nh||t instanceof Zu||t instanceof zu||t instanceof eh)}const lh=new RegExp("[~\\*/\\[\\]]");function uh(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new ms(gs.INVALID_ARGUMENT,a+t+c)
|
|
1877
1877
|
/**
|
|
1878
1878
|
* @license
|
|
1879
1879
|
* Copyright 2020 Google LLC
|
|
@@ -1921,7 +1921,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1921
1921
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1922
1922
|
* See the License for the specific language governing permissions and
|
|
1923
1923
|
* limitations under the License.
|
|
1924
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class vh extends mh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vh(t,e,n)}_apply(t){const e=this._parse(t);return
|
|
1924
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class vh extends mh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vh(t,e,n)}_apply(t){const e=this._parse(t);return Th(t._query,e),new Fu(t.firestore,t.converter,ha(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=kl(t._databaseId);return new oh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){_h(o,s);const e=[];for(const n of o)e.push(Sh(r,t,n));a={arrayValue:{values:e}}}else a=Sh(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||_h(o,s),a=function(t,e,n,r=!1){return ah(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Co.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function wh(t,e,n){const r=e,i=fh("where",t);return vh._create(i,r,n)}class bh extends gh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new bh(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Ao.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Th(n,t),n=ha(n,t)}(t._query,e),new Fu(t.firestore,t.converter,ha(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Sh(t,e,n){if("string"==typeof(n=E(n))){if(""===n)throw new ms(gs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ca(e)&&-1!==n.indexOf("/"))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Ds.fromString(n));if(!Ms.isDocumentKey(r))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return mo(t,new Ms(r))}if(n instanceof zu)return mo(t,n._key);throw new ms(gs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ou(n)}.`)}function _h(t,e){if(!Array.isArray(t)||0===t.length)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new ms(gs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Th(t,e){if(e.isInequality()){const n=aa(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const i=oa(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new ms(gs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,i)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new ms(gs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new ms(gs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Eh{convertValue(t,e="none"){switch(co(t)){case 0:return null;case 1:return t.booleanValue;case 2:return no(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(ro(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw ds()}}convertObject(t,e){const n={};return Qs(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new nh(no(t.latitude),no(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=so(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(oo(t));default:return null}}convertTimestamp(t){const e=eo(t);return new Ns(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Ds.fromString(t);fs(Vc(n));const r=new Gs(n.get(1),n.get(3)),i=new Ms(n.popFirst(5));return r.isEqual(e)||ls(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}
|
|
1925
1925
|
/**
|
|
1926
1926
|
* @license
|
|
1927
1927
|
* Copyright 2020 Google LLC
|
|
@@ -1953,7 +1953,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1953
1953
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1954
1954
|
* See the License for the specific language governing permissions and
|
|
1955
1955
|
* limitations under the License.
|
|
1956
|
-
*/function Nh(t){t=Du(t,zu);const e=Du(t.firestore,Qu);return function(t,e,n={}){const r=new ys;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new ju({next:s=>{e.enqueueAndForget((()=>ru(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new ms(gs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new ms(gs.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new au(ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return nu(t,o)}(await Ku(t),t.asyncQueue,e,n,r))),r.promise}(Ju(e),t._key).then((n=>xh(e,t,n)))}class Lh extends
|
|
1956
|
+
*/function Nh(t){t=Du(t,zu);const e=Du(t.firestore,Qu);return function(t,e,n={}){const r=new ys;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new ju({next:s=>{e.enqueueAndForget((()=>ru(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new ms(gs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new ms(gs.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new au(ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return nu(t,o)}(await Ku(t),t.asyncQueue,e,n,r))),r.promise}(Ju(e),t._key).then((n=>xh(e,t,n)))}class Lh extends Eh{constructor(t){super(),this.firestore=t}convertBytes(t){return new Zu(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new zu(this.firestore,null,e)}}function Oh(t){t=Du(t,Fu);const e=Du(t.firestore,Qu),n=Ju(e),r=new Lh(e);return ph(t._query),function(t,e,n={}){const r=new ys;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new ju({next:n=>{e.enqueueAndForget((()=>ru(t,o))),n.fromCache&&"server"===r.source?i.reject(new ms(gs.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:t=>i.reject(t)}),o=new au(n,s,{includeMetadataChanges:!0,Nu:!0});return nu(t,o)}(await Ku(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ah(e,r,t,n)))}function Dh(t,...e){var n,r,i;t=E(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Wu(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(Wu(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,l,u;if(t instanceof zu)l=Du(t.firestore,Qu),u=ia(t._key.path),c={next:n=>{e[o]&&e[o](xh(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Du(t,Fu);l=Du(n.firestore,Qu),u=n._query;const r=new Lh(l);c={next:t=>{e[o]&&e[o](new Ah(l,r,n,t))},error:e[o+1],complete:e[o+2]},ph(t._query)}return function(t,e,n,r){const i=new ju(r),s=new au(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>nu(await Ku(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>ru(await Ku(t),s)))}}(Ju(l),u,a,c)}function xh(t,e,n){const r=n.docs.get(e._key),i=new Lh(t);return new kh(t,i,e._key,r,new Ih(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){ss=Pt,Lt(new I("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new Qu(new Ss(t.getProvider("auth-internal")),new Is(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new ms(gs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Gs(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),zt(rs,"3.8.0",t),zt(rs,"3.8.0","esm2017")}();
|
|
1957
1957
|
/**
|
|
1958
1958
|
* @license
|
|
1959
1959
|
* Copyright 2020 Google LLC
|
|
@@ -2279,7 +2279,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2279
2279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2280
2280
|
* See the License for the specific language governing permissions and
|
|
2281
2281
|
* limitations under the License.
|
|
2282
|
-
*/function _d(t,e){Wh("string"==typeof t||void 0===t,"internal-error",{appName:e})}class
|
|
2282
|
+
*/function _d(t,e){Wh("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Td{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=zh(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new vd(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new wd(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await yd(this,this.stsTokenManager.getToken(this.auth,t));return Wh(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=E(t),r=await n.getIdToken(e),i=md(r);Wh(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:pd(gd(i.auth_time)),issuedAtTime:pd(gd(i.iat)),expirationTime:pd(gd(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=E(t);await bd(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Wh(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){return new Td(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){Wh(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await bd(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await yd(this,async function(t,e){return cd(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,i,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(i=e.phoneNumber)&&void 0!==i?i:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:S,stsTokenManager:_}=e;Wh(v&&_,t,"internal-error");const T=Sd.fromJSON(this.name,_);Wh("string"==typeof v,t,"internal-error"),_d(u,t.name),_d(h,t.name),Wh("boolean"==typeof w,t,"internal-error"),Wh("boolean"==typeof b,t,"internal-error"),_d(d,t.name),_d(f,t.name),_d(p,t.name),_d(g,t.name),_d(m,t.name),_d(y,t.name);const E=new Td({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:T,createdAt:m,lastLoginAt:y});return S&&Array.isArray(S)&&(E.providerData=S.map((t=>Object.assign({},t)))),g&&(E._redirectEventId=g),E}static async _fromIdTokenResponse(t,e,n=!1){const r=new Sd;r.updateFromServerResponse(e);const i=new Td({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await bd(i),i}}
|
|
2283
2283
|
/**
|
|
2284
2284
|
* @license
|
|
2285
2285
|
* Copyright 2019 Google LLC
|
|
@@ -2295,7 +2295,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2295
2295
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2296
2296
|
* See the License for the specific language governing permissions and
|
|
2297
2297
|
* limitations under the License.
|
|
2298
|
-
*/class
|
|
2298
|
+
*/class Ed{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Ed.type="NONE";const Id=Ed;
|
|
2299
2299
|
/**
|
|
2300
2300
|
* @license
|
|
2301
2301
|
* Copyright 2019 Google LLC
|
|
@@ -2311,7 +2311,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2311
2311
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2312
2312
|
* See the License for the specific language governing permissions and
|
|
2313
2313
|
* limitations under the License.
|
|
2314
|
-
*/function kd(t,e,n){return`firebase:${t}:${e}:${n}`}class Cd{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=kd(this.userKey,r.apiKey,i),this.fullPersistenceKey=kd("persistence",r.apiKey,i),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?
|
|
2314
|
+
*/function kd(t,e,n){return`firebase:${t}:${e}:${n}`}class Cd{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=kd(this.userKey,r.apiKey,i),this.fullPersistenceKey=kd("persistence",r.apiKey,i),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?Td._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new Cd(Xh(Id),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let i=r[0]||Xh(Id);const s=kd(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const r=Td._fromJSON(t,e);n!==i&&(o=r),i=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==i)try{await t._remove(s)}catch(t){}}))),new Cd(i,t,n)):new Cd(i,t,n)}}
|
|
2315
2315
|
/**
|
|
2316
2316
|
* @license
|
|
2317
2317
|
* Copyright 2020 Google LLC
|
|
@@ -2376,7 +2376,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2376
2376
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2377
2377
|
* See the License for the specific language governing permissions and
|
|
2378
2378
|
* limitations under the License.
|
|
2379
|
-
*/class Vd{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jd(this),this.idTokenSubscription=new jd(this),this.beforeStateQueue=new Bd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Vh,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xh(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Cd.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Wh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await bd(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?
|
|
2379
|
+
*/class Vd{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jd(this),this.idTokenSubscription=new jd(this),this.beforeStateQueue=new Bd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Vh,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xh(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Cd.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Wh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await bd(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?E(t):null;return e&&Wh(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Wh(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Xh(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Xh(t)||this._popupRedirectResolver;Wh(e,this,"argument-error"),this.redirectPersistenceManager=await Cd.create(this,[Xh(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e),s=this._isInitialized?Promise.resolve():this._initializationPromise;return Wh(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Wh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Fd(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function Hd(t){return E(t)}class jd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Wh(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function qd(t,e,n){const r=Hd(t);Wh(r._canInitEmulator,r,"emulator-config-failed"),Wh(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=$d(e),{host:o,port:a}=function(t){const e=$d(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const t=i[1];return{host:t,port:Kd(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Kd(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2380
2380
|
/**
|
|
2381
2381
|
* @license
|
|
2382
2382
|
* Copyright 2020 Google LLC
|
|
@@ -2639,7 +2639,7 @@ class of extends ef{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2639
2639
|
* See the License for the specific language governing permissions and
|
|
2640
2640
|
* limitations under the License.
|
|
2641
2641
|
*/
|
|
2642
|
-
class af{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const i=await
|
|
2642
|
+
class af{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const i=await Td._fromIdTokenResponse(t,n,r),s=cf(n);return new af({user:i,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=cf(n);return new af({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function cf(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2643
2643
|
/**
|
|
2644
2644
|
* @license
|
|
2645
2645
|
* Copyright 2020 Google LLC
|
|
@@ -2689,7 +2689,7 @@ async function hf(t,e,n=!1){const r="signIn",i=await uf(t,r,e),s=await af._fromI
|
|
|
2689
2689
|
* See the License for the specific language governing permissions and
|
|
2690
2690
|
* limitations under the License.
|
|
2691
2691
|
*/
|
|
2692
|
-
async function df(t,e,n){const r=
|
|
2692
|
+
async function df(t,e,n){const r=E(t),i={requestType:"PASSWORD_RESET",email:e};n&&
|
|
2693
2693
|
/**
|
|
2694
2694
|
* @license
|
|
2695
2695
|
* Copyright 2020 Google LLC
|
|
@@ -2706,7 +2706,7 @@ async function df(t,e,n){const r=T(t),i={requestType:"PASSWORD_RESET",email:e};n
|
|
|
2706
2706
|
* See the License for the specific language governing permissions and
|
|
2707
2707
|
* limitations under the License.
|
|
2708
2708
|
*/
|
|
2709
|
-
function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Wh(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Wh(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Wh(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,i,n),await Wd(r,i)}async function ff(t,e,n){await async function(t,e){return cd(t,"POST","/v1/accounts:resetPassword",ad(t,e))}(
|
|
2709
|
+
function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Wh(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Wh(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Wh(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,i,n),await Wd(r,i)}async function ff(t,e,n){await async function(t,e){return cd(t,"POST","/v1/accounts:resetPassword",ad(t,e))}(E(t),{oobCode:e,newPassword:n})}function pf(t,e,n){return async function(t,e){return hf(Hd(t),e)}(E(t),Zd.credential(e,n))}const gf="__sak";
|
|
2710
2710
|
/**
|
|
2711
2711
|
* @license
|
|
2712
2712
|
* Copyright 2019 Google LLC
|
|
@@ -2820,7 +2820,7 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2820
2820
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2821
2821
|
* See the License for the specific language governing permissions and
|
|
2822
2822
|
* limitations under the License.
|
|
2823
|
-
*/Sf.receivers=[];class
|
|
2823
|
+
*/Sf.receivers=[];class Tf{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=_f("",20);r.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(e.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
|
|
2824
2824
|
/**
|
|
2825
2825
|
* @license
|
|
2826
2826
|
* Copyright 2020 Google LLC
|
|
@@ -2836,7 +2836,7 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2836
2836
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2837
2837
|
* See the License for the specific language governing permissions and
|
|
2838
2838
|
* limitations under the License.
|
|
2839
|
-
*/function
|
|
2839
|
+
*/function Ef(){return window}
|
|
2840
2840
|
/**
|
|
2841
2841
|
* @license
|
|
2842
2842
|
* Copyright 2020 Google LLC.
|
|
@@ -2853,7 +2853,7 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2853
2853
|
* See the License for the specific language governing permissions and
|
|
2854
2854
|
* limitations under the License.
|
|
2855
2855
|
*/
|
|
2856
|
-
function If(){return void 0!==
|
|
2856
|
+
function If(){return void 0!==Ef().WorkerGlobalScope&&"function"==typeof Ef().importScripts}
|
|
2857
2857
|
/**
|
|
2858
2858
|
* @license
|
|
2859
2859
|
* Copyright 2019 Google LLC
|
|
@@ -2870,7 +2870,7 @@ function If(){return void 0!==Tf().WorkerGlobalScope&&"function"==typeof Tf().im
|
|
|
2870
2870
|
* See the License for the specific language governing permissions and
|
|
2871
2871
|
* limitations under the License.
|
|
2872
2872
|
*/
|
|
2873
|
-
const kf="firebaseLocalStorageDb",Cf="firebaseLocalStorage",Af="fbase_key";class Rf{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Nf(t,e){return t.transaction([Cf],e?"readwrite":"readonly").objectStore(Cf)}function Lf(){const t=indexedDB.open(kf,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Cf,{keyPath:Af})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Cf)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(kf);return new Rf(t).toPromise()}(),e(await Lf()))}))}))}async function Of(t,e,n){const r=Nf(t,!0).put({[Af]:e,value:n});return new Rf(r).toPromise()}function Df(t,e){const n=Nf(t,!0).delete(e);return new Rf(n).toPromise()}class xf{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Lf()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return If()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Sf._getInstance(If()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new
|
|
2873
|
+
const kf="firebaseLocalStorageDb",Cf="firebaseLocalStorage",Af="fbase_key";class Rf{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Nf(t,e){return t.transaction([Cf],e?"readwrite":"readonly").objectStore(Cf)}function Lf(){const t=indexedDB.open(kf,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Cf,{keyPath:Af})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Cf)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(kf);return new Rf(t).toPromise()}(),e(await Lf()))}))}))}async function Of(t,e,n){const r=Nf(t,!0).put({[Af]:e,value:n});return new Rf(r).toPromise()}function Df(t,e){const n=Nf(t,!0).delete(e);return new Rf(n).toPromise()}class xf{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Lf()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return If()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Sf._getInstance(If()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new Tf(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Lf();return await Of(t,gf,"1"),await Df(t,gf),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Of(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Nf(t,!1).get(e),r=await new Rf(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Df(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Nf(t,!1).getAll();return new Rf(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:r,value:i}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}xf.type="LOCAL";const Pf=xf;
|
|
2874
2874
|
/**
|
|
2875
2875
|
* @license
|
|
2876
2876
|
* Copyright 2020 Google LLC
|
|
@@ -3051,7 +3051,7 @@ const Xf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Zf=/^https?/;async function tp(t
|
|
|
3051
3051
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3052
3052
|
* See the License for the specific language governing permissions and
|
|
3053
3053
|
* limitations under the License.
|
|
3054
|
-
*/const np=new nd(3e4,6e4);function rp(){const t=
|
|
3054
|
+
*/const np=new nd(3e4,6e4);function rp(){const t=Ef().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function ip(t){return new Promise(((e,n)=>{var r,i,s;function o(){rp(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{rp(),n(Kh(t,"network-request-failed"))},timeout:np.get()})}if(null===(i=null===(r=Ef().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=Ef().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Ef()[e]=()=>{gapi.load?o():n(Kh(t,"network-request-failed"))},Mf(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw sp=null,t}))}let sp=null;
|
|
3055
3055
|
/**
|
|
3056
3056
|
* @license
|
|
3057
3057
|
* Copyright 2020 Google LLC.
|
|
@@ -3068,7 +3068,7 @@ const Xf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Zf=/^https?/;async function tp(t
|
|
|
3068
3068
|
* See the License for the specific language governing permissions and
|
|
3069
3069
|
* limitations under the License.
|
|
3070
3070
|
*/
|
|
3071
|
-
const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},up=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function hp(t){const e=t.config;Wh(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?rd(e,cp):`https://${t.config.authDomain}/${ap}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},i=up.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function dp(t){const e=await function(t){return sp=sp||ip(t),sp}(t),n=
|
|
3071
|
+
const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},up=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function hp(t){const e=t.config;Wh(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?rd(e,cp):`https://${t.config.authDomain}/${ap}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},i=up.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function dp(t){const e=await function(t){return sp=sp||ip(t),sp}(t),n=Ef().gapi;return Wh(n,t,"internal-error"),e.open({where:document.body,url:hp(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:lp,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=Kh(t,"network-request-failed"),s=Ef().setTimeout((()=>{r(i)}),op.get());function o(){Ef().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{r(i)}))}))))}
|
|
3072
3072
|
/**
|
|
3073
3073
|
* @license
|
|
3074
3074
|
* Copyright 2020 Google LLC.
|
|
@@ -3116,7 +3116,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3116
3116
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3117
3117
|
* See the License for the specific language governing permissions and
|
|
3118
3118
|
* limitations under the License.
|
|
3119
|
-
*/(t)}?${w(a).slice(1)}`}const wp="webStorageSupport";const bp=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=bf,this._completeRedirectFn=Wf,this._overrideRedirectResult=Gf}async _openPopup(t,e,n,r){var i;Yh(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return gp(t,vp(t,e,n,Zh(),r),_f())}async _openRedirect(t,e,n,r){var i;return await this._originValidation(t),i=vp(t,e,n,Zh(),r),
|
|
3119
|
+
*/(t)}?${w(a).slice(1)}`}const wp="webStorageSupport";const bp=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=bf,this._completeRedirectFn=Wf,this._overrideRedirectResult=Gf}async _openPopup(t,e,n,r){var i;Yh(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return gp(t,vp(t,e,n,Zh(),r),_f())}async _openRedirect(t,e,n,r){var i;return await this._originValidation(t),i=vp(t,e,n,Zh(),r),Ef().location.href=i,new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Yh(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await dp(t),n=new Qf(t);return e.register("authEvent",(e=>{Wh(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(wp,{type:wp},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[wp];void 0!==i&&e(!!i),$h(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=tp(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return zd()||Nd()||Md()}};var Sp="@firebase/auth",_p="0.21.0";
|
|
3120
3120
|
/**
|
|
3121
3121
|
* @license
|
|
3122
3122
|
* Copyright 2020 Google LLC
|
|
@@ -3133,7 +3133,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3133
3133
|
* See the License for the specific language governing permissions and
|
|
3134
3134
|
* limitations under the License.
|
|
3135
3135
|
*/
|
|
3136
|
-
class
|
|
3136
|
+
class Tp{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Wh(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3137
3137
|
/**
|
|
3138
3138
|
* @license
|
|
3139
3139
|
* Copyright 2020 Google LLC
|
|
@@ -3166,4 +3166,4 @@ class Ep{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3166
3166
|
* See the License for the specific language governing permissions and
|
|
3167
3167
|
* limitations under the License.
|
|
3168
3168
|
*/
|
|
3169
|
-
const Tp=d("authIdTokenMaxAge")||300;let Ip=null;function kp(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;$h(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:bp,persistence:[Pf,vf,bf]}),r=d("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Tp)return;const r=null==e?void 0:e.token;Ip!==r&&(Ip=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=u("auth");return s&&qd(n,`http://${s}`),n}var Cp;Cp="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:i,authDomain:s}=n.options;return((t,n)=>{Wh(i&&!i.includes(":"),"invalid-api-key",{appName:t.name}),Wh(!(null==s?void 0:s.includes(":")),"argument-error",{appName:t.name});const r={apiKey:i,authDomain:s,clientPlatform:Cp,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Fd(Cp)},o=new Vd(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xh);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new Ep(t))(Hd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),zt(Sp,_p,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Cp)),zt(Sp,_p,"esm2017");class Ap extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Rp extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Np extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Lp{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=kp(e),this.auth.setPersistence(vf)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return(await Nh(Hu(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yh(Vu(this.firestore,"users"),wh(new th("__name__"),"==",this.id));return e=Dh(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await pf(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await df(this.auth,t)}async confirmPasswordReset(t,e){await ff(this.auth,t,e)}}class Op{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Dh(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Ph.getInstance().firebase);this.firestore=Yu(t),this.user=new Lp(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=yh(Vu(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Oh(yh(Vu(this.firestore,t),...e))}async getDoc(t,e){const n=Hu(this.firestore,t,e),r=await Nh(n);return r.exists()?r.data():null}}const Dp=t=>{if(t.code===Hh)throw new Error("account has been disabled");throw new Error(t.message)};class xp{static get endpoint(){return Ph.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Pp{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Rp;try{const r=await xp.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Ap;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await xp.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wh("brand_id","==",this.brandId)];r.push(wh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Dp(t)}}async getColorwaySizeAssets(t,e){const n=[wh("brand_id","==",this.brandId)];t&&n.push(wh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Dp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Dp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Dp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Dp(t)}}}var Mp;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Mp||(Mp={}));const Up={[Mp.ACROSS_BACK]:"Across back",[Mp.ACROSS_FRONT]:"Across front",[Mp.ACROSS_SHOULDER]:"Across shoulder",[Mp.ANKLE]:"Ankle",[Mp.ARMEYE]:"Armeye",[Mp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Mp.BACK_CROTCH_LENGTH]:"Back crotch length",[Mp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Mp.BELOW_KNEE]:"Below knee",[Mp.BICEP]:"Bicep",[Mp.BUST]:"Chest/Bust",[Mp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Mp.CALF]:"Calf",[Mp.CB_NECK_TO_WAIST]:"Cb neck to waist",[Mp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Mp.CF_NECK_TO_WAIST]:"Cf neck to waist",[Mp.ELBOW]:"Elbow",[Mp.FOREARM]:"Forearm",[Mp.FRONT_CROTCH_LENGTH]:"Front crotch length",[Mp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Mp.HIGH_HIP]:"High hip",[Mp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Mp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Mp.HSP_TO_BUST_POINT]:"Hsp to bust point",[Mp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Mp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Mp.INSEAM]:"Inseam",[Mp.KNEE]:"Knee",[Mp.LOW_HIP]:"Low hip",[Mp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Mp.MID_NECK]:"Mid neck",[Mp.NECK_AT_BASE]:"Neck at base",[Mp.SHOULDER_DROP]:"Shoulder drop",[Mp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Mp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Mp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Mp.THIGH]:"Thigh",[Mp.TOTAL_RISE_LENGTH]:"Total rise length",[Mp.UNDER_BUST]:"Under bust",[Mp.VERTICAL_TRUNK]:"Vertical trunk",[Mp.WAIST]:"Waist",[Mp.WRIST]:"Wrist"};var zp;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(zp||(zp={}));const Fp={[zp.BLOUSES]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.COATS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.DRESSES]:[Mp.LOW_HIP,Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST],[zp.JACKETS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.PANTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.PUFFERS_AND_PARKAS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.SHORTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.SKIRTS]:[Mp.LOW_HIP,Mp.WAIST],[zp.SWEATERS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.T_SHIRTS_AND_TANKS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP]},Bp={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Vp={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Hp={activewear:{leggings:zp.PANTS,joggers:zp.PANTS,sweatshirts:zp.SWEATERS},dresses:{a_line:zp.DRESSES,bodycon:zp.DRESSES,fit_and_flare:zp.DRESSES,knit:zp.DRESSES,shirt:zp.DRESSES,slip:zp.DRESSES,straight:zp.DRESSES,wrap:zp.DRESSES},jackets_and_coats:{denim_jackets:zp.JACKETS,parkas:zp.PUFFERS_AND_PARKAS,peacoats:zp.COATS,puffer_jackets:zp.PUFFERS_AND_PARKAS,raincoats:zp.COATS,rompers:zp.COATS,shackets:zp.JACKETS,trench_coats:zp.COATS},jeans:{bootcut:zp.PANTS,flared:zp.PANTS,mom:zp.PANTS,relaxed:zp.PANTS,skinny:zp.PANTS,slim:zp.PANTS,straight:zp.PANTS,tapered:zp.PANTS,wide_leg:zp.PANTS},jumpsuits_and_rompers:{boiler_suits:zp.DRESSES,denim:zp.DRESSES,jumpsuits:zp.DRESSES,overalls:zp.DRESSES,rompers:zp.DRESSES,unitards:zp.DRESSES},pants_and_shorts:{cigarette:zp.PANTS,culottes:zp.SHORTS,denim_shorts:zp.SHORTS,flared:zp.PANTS,joggers:zp.PANTS,leggings:zp.PANTS,skinny:zp.PANTS,wide_leg:zp.PANTS},skirts:{a_line_flared:zp.SKIRTS,denim:zp.SKIRTS,knit:zp.SKIRTS,pencil:zp.SKIRTS,pleated:zp.SKIRTS,skater:zp.SKIRTS,slip:zp.SKIRTS,wrap:zp.SKIRTS},suits_and_tailoring:{blazers:zp.JACKETS,suit_jackets:zp.JACKETS,suit_skirts:zp.SKIRTS,suit_trousers:zp.PANTS,suit_vests:zp.SWEATERS,trousers:zp.PANTS},sweaters:{cardigans:zp.SWEATERS,crewnecks:zp.SWEATERS,hoodies_and_zipups:zp.SWEATERS,sweatshirts:zp.SWEATERS,turtlenecks:zp.SWEATERS,v_necks:zp.SWEATERS},tops:{bodysuits:zp.BLOUSES,corsets_and_bustiers:zp.BLOUSES,polos:zp.T_SHIRTS_AND_TANKS,shirts_and_blouses:zp.BLOUSES,t_shirts:zp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zp.T_SHIRTS_AND_TANKS}};var jp;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(jp||(jp={}));const qp={[jp.TOO_TIGHT]:"Too Tight",[jp.TIGHT]:"Tight",[jp.SLIGHTLY_TIGHT]:"Slightly Tight",[jp.PERFECT_FIT]:"Perfect Fit",[jp.SLIGHTLY_LOOSE]:"Slightly Loose",[jp.LOOSE]:"Loose",[jp.OVERSIZED]:"Oversized",[jp.TOO_SHORT]:"Too Short",[jp.SHORT]:"Short",[jp.SLIGHTLY_SHORT]:"Slightly Short",[jp.SLIGHTLY_LONG]:"Slightly Long",[jp.LONG]:"Long",[jp.TOO_LONG]:"Too Long"};var $p;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}($p||($p={}));var Kp=Object.freeze({__proto__:null,get AvatarState(){return $p},get MeasurementLocation(){return Mp},MeasurementLocationName:Up,get Classification(){return zp},ClassificationLocations:Fp,CategoryNames:Bp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Vp,Taxonomy:Hp,get Fit(){return jp},FitNames:qp}),Gp="Back to sign in",Wp="Click here to download the app",Qp="Don't have an account?",Yp="Whoops! Looks like you don't have an avatar yet.",Jp="Email address",Xp="Please enter a valid email address.",Zp="Enter your email address, we will send you a link to reset your password.",tg="Forgot password?",eg="Have an account? Sign in",ng="Your avatar is loading...",rg="Unfortunately, that size is not available for try on.",ig="or",sg="Password",og="Please enter a valid password (at least 7 characters).",ag="Return to Catalog Page",cg="Return to Product Page",lg="Return to site",ug="Please return to The Fitting Room app to create your avatar.",hg="Scan the QR code to download the app",dg="Send",fg="Sign back in",pg="Sign in",gg="Something went wrong. Try again!",mg="You have successfully logged out!",yg="The Fitting Room",vg="Username or password is empty.",wg="Username or password is incorrect.",bg="End size uncertainty with",Sg="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var _g=[],Eg=[];function Tg(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=_g.indexOf(s);-1===o&&(o=_g.push(s)-1,Eg[o]={}),n=Eg[o]&&Eg[o][r]?Eg[o][r]:Eg[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Tg(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});Tg(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});Tg("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});Tg(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});Tg("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}",{});Tg("#tfr-size-recommendations{background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;position:relative;width:100%}#tfr-size-rec-select-container{display:none}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:370px}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);height:40px;justify-content:center}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:2;margin-left:16px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});Tg(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Tg(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});Tg(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}",{});Tg(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const Ig=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ng} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),kg=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content tfr-pt-20 tfr-pb-50">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${bg}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${yg}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},Cg=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Sg}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Wp:hg}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\n </div>\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${eg}</div>\n `}};class Ag{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=kg(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${mg}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${fg}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${lg}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Yp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${ug}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(Ig({timeoutMS:1e4}))}toScan(){this.manager.open(Cg({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${pg}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Jp}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${sg}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${tg}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Qp}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${pg}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Zp}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Jp}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Gp}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${dg}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${cg}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||gg}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${cg}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${rg} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${ig} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${cg}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Rg="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Ng{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!0,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Rg}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="block"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${Rg}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Lg{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Kp.Fit.PERFECT_FIT,Kp.Fit.SLIGHTLY_LOOSE,Kp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Ng(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Kp.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Kp.MeasurementLocationName[t.measurement_location]})))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Og;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Og||(Og={}));class Dg{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new Ag(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Ph.getInstance().setEnv(e),new Pp(t,new Op)))(Number(this.shopId),o),this.tfrSizeRec=new Lg(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(vg);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Xp);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(og);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(wg)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(gg)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Og.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Yp),this.tfrModal.onNotCreated();break;case Og.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Og.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(gg),this.tfrModal.onError(gg)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const xg=async(t,e,n,r={},i={},s="dev")=>{const o=new Dg(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,xg as initFittingRoom};
|
|
3169
|
+
const Ep=d("authIdTokenMaxAge")||300;let Ip=null;function kp(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;$h(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:bp,persistence:[Pf,vf,bf]}),r=d("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Ep)return;const r=null==e?void 0:e.token;Ip!==r&&(Ip=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){E(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){E(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=u("auth");return s&&qd(n,`http://${s}`),n}var Cp;Cp="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:i,authDomain:s}=n.options;return((t,n)=>{Wh(i&&!i.includes(":"),"invalid-api-key",{appName:t.name}),Wh(!(null==s?void 0:s.includes(":")),"argument-error",{appName:t.name});const r={apiKey:i,authDomain:s,clientPlatform:Cp,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Fd(Cp)},o=new Vd(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xh);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new Tp(t))(Hd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),zt(Sp,_p,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Cp)),zt(Sp,_p,"esm2017");class Ap extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Rp extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Np extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Lp{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=kp(e),this.auth.setPersistence(vf)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return(await Nh(Hu(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yh(Vu(this.firestore,"users"),wh(new th("__name__"),"==",this.id));return e=Dh(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await pf(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await df(this.auth,t)}async confirmPasswordReset(t,e){await ff(this.auth,t,e)}}class Op{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Dh(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Ph.getInstance().firebase);this.firestore=Yu(t),this.user=new Lp(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=yh(Vu(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Oh(yh(Vu(this.firestore,t),...e))}async getDoc(t,e){const n=Hu(this.firestore,t,e),r=await Nh(n);return r.exists()?r.data():null}}const Dp=t=>{if(t.code===Hh)throw new Error("account has been disabled");throw new Error(t.message)};class xp{static get endpoint(){return Ph.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Pp{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Rp;try{const r=await xp.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Ap;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await xp.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wh("brand_id","==",this.brandId)];r.push(wh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Dp(t)}}async getColorwaySizeAssets(t,e){const n=[wh("brand_id","==",this.brandId)];t&&n.push(wh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Dp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Dp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Dp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Dp(t)}}}var Mp;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Mp||(Mp={}));const Up={[Mp.ACROSS_BACK]:"Across back",[Mp.ACROSS_FRONT]:"Across front",[Mp.ACROSS_SHOULDER]:"Across shoulder",[Mp.ANKLE]:"Ankle",[Mp.ARMEYE]:"Armeye",[Mp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Mp.BACK_CROTCH_LENGTH]:"Back crotch length",[Mp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Mp.BELOW_KNEE]:"Below knee",[Mp.BICEP]:"Bicep",[Mp.BUST]:"Chest/Bust",[Mp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Mp.CALF]:"Calf",[Mp.CB_NECK_TO_WAIST]:"Cb neck to waist",[Mp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Mp.CF_NECK_TO_WAIST]:"Cf neck to waist",[Mp.ELBOW]:"Elbow",[Mp.FOREARM]:"Forearm",[Mp.FRONT_CROTCH_LENGTH]:"Front crotch length",[Mp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Mp.HIGH_HIP]:"High hip",[Mp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Mp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Mp.HSP_TO_BUST_POINT]:"Hsp to bust point",[Mp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Mp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Mp.INSEAM]:"Inseam",[Mp.KNEE]:"Knee",[Mp.LOW_HIP]:"Low hip",[Mp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Mp.MID_NECK]:"Mid neck",[Mp.NECK_AT_BASE]:"Neck at base",[Mp.SHOULDER_DROP]:"Shoulder drop",[Mp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Mp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Mp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Mp.THIGH]:"Thigh",[Mp.TOTAL_RISE_LENGTH]:"Total rise length",[Mp.UNDER_BUST]:"Under bust",[Mp.VERTICAL_TRUNK]:"Vertical trunk",[Mp.WAIST]:"Waist",[Mp.WRIST]:"Wrist"};var zp;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(zp||(zp={}));const Fp={[zp.BLOUSES]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.COATS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.DRESSES]:[Mp.LOW_HIP,Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST],[zp.JACKETS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.PANTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.PUFFERS_AND_PARKAS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.SHORTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.SKIRTS]:[Mp.LOW_HIP,Mp.WAIST],[zp.SWEATERS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.T_SHIRTS_AND_TANKS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP]},Bp={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Vp={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Hp={activewear:{leggings:zp.PANTS,joggers:zp.PANTS,sweatshirts:zp.SWEATERS},dresses:{a_line:zp.DRESSES,bodycon:zp.DRESSES,fit_and_flare:zp.DRESSES,knit:zp.DRESSES,shirt:zp.DRESSES,slip:zp.DRESSES,straight:zp.DRESSES,wrap:zp.DRESSES},jackets_and_coats:{denim_jackets:zp.JACKETS,parkas:zp.PUFFERS_AND_PARKAS,peacoats:zp.COATS,puffer_jackets:zp.PUFFERS_AND_PARKAS,raincoats:zp.COATS,rompers:zp.COATS,shackets:zp.JACKETS,trench_coats:zp.COATS},jeans:{bootcut:zp.PANTS,flared:zp.PANTS,mom:zp.PANTS,relaxed:zp.PANTS,skinny:zp.PANTS,slim:zp.PANTS,straight:zp.PANTS,tapered:zp.PANTS,wide_leg:zp.PANTS},jumpsuits_and_rompers:{boiler_suits:zp.DRESSES,denim:zp.DRESSES,jumpsuits:zp.DRESSES,overalls:zp.DRESSES,rompers:zp.DRESSES,unitards:zp.DRESSES},pants_and_shorts:{cigarette:zp.PANTS,culottes:zp.SHORTS,denim_shorts:zp.SHORTS,flared:zp.PANTS,joggers:zp.PANTS,leggings:zp.PANTS,skinny:zp.PANTS,wide_leg:zp.PANTS},skirts:{a_line_flared:zp.SKIRTS,denim:zp.SKIRTS,knit:zp.SKIRTS,pencil:zp.SKIRTS,pleated:zp.SKIRTS,skater:zp.SKIRTS,slip:zp.SKIRTS,wrap:zp.SKIRTS},suits_and_tailoring:{blazers:zp.JACKETS,suit_jackets:zp.JACKETS,suit_skirts:zp.SKIRTS,suit_trousers:zp.PANTS,suit_vests:zp.SWEATERS,trousers:zp.PANTS},sweaters:{cardigans:zp.SWEATERS,crewnecks:zp.SWEATERS,hoodies_and_zipups:zp.SWEATERS,sweatshirts:zp.SWEATERS,turtlenecks:zp.SWEATERS,v_necks:zp.SWEATERS},tops:{bodysuits:zp.BLOUSES,corsets_and_bustiers:zp.BLOUSES,polos:zp.T_SHIRTS_AND_TANKS,shirts_and_blouses:zp.BLOUSES,t_shirts:zp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zp.T_SHIRTS_AND_TANKS}};var jp;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(jp||(jp={}));const qp={[jp.TOO_TIGHT]:"Too Tight",[jp.TIGHT]:"Tight",[jp.SLIGHTLY_TIGHT]:"Slightly Tight",[jp.PERFECT_FIT]:"Perfect Fit",[jp.SLIGHTLY_LOOSE]:"Slightly Loose",[jp.LOOSE]:"Loose",[jp.OVERSIZED]:"Oversized",[jp.TOO_SHORT]:"Too Short",[jp.SHORT]:"Short",[jp.SLIGHTLY_SHORT]:"Slightly Short",[jp.SLIGHTLY_LONG]:"Slightly Long",[jp.LONG]:"Long",[jp.TOO_LONG]:"Too Long"};var $p;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}($p||($p={}));var Kp=Object.freeze({__proto__:null,get AvatarState(){return $p},get MeasurementLocation(){return Mp},MeasurementLocationName:Up,get Classification(){return zp},ClassificationLocations:Fp,CategoryNames:Bp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Vp,Taxonomy:Hp,get Fit(){return jp},FitNames:qp}),Gp="Back to sign in",Wp="Click here to download the app",Qp="Don't have an account?",Yp="Whoops! Looks like you don't have an avatar yet.",Jp="Email address",Xp="Please enter a valid email address.",Zp="Enter your email address, we will send you a link to reset your password.",tg="Forgot password?",eg="Have an account? Sign in",ng="Your avatar is loading...",rg="Unfortunately, that size is not available for try on.",ig="or",sg="Password",og="Please enter a valid password (at least 7 characters).",ag="Return to Catalog Page",cg="Return to Product Page",lg="Return to site",ug="Please return to The Fitting Room app to create your avatar.",hg="Scan the QR code to download the app",dg="Send",fg="Sign back in",pg="Sign in",gg="Something went wrong. Try again!",mg="You have successfully logged out!",yg="The Fitting Room",vg="Username or password is empty.",wg="Username or password is incorrect.",bg="End size uncertainty with",Sg="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var _g=[],Tg=[];function Eg(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=_g.indexOf(s);-1===o&&(o=_g.push(s)-1,Tg[o]={}),n=Tg[o]&&Tg[o][r]?Tg[o][r]:Tg[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Eg(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});Eg(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});Eg("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});Eg(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});Eg("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}",{});Eg("#tfr-size-recommendations{background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:370px}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);height:40px;justify-content:center}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:2;margin-left:16px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});Eg(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Eg(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});Eg(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}",{});Eg(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const Ig=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ng} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),kg=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content tfr-pt-20 tfr-pb-50">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${bg}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${yg}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},Cg=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Sg}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Wp:hg}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\n </div>\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${eg}</div>\n `}};class Ag{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=kg(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${mg}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${fg}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${lg}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Yp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${ug}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(Ig({timeoutMS:1e4}))}toScan(){this.manager.open(Cg({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${pg}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Jp}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${sg}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${tg}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Qp}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${pg}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Zp}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Jp}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Gp}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${dg}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${cg}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||gg}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${cg}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${rg} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${ig} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${cg}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Rg="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Ng{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!0,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecSelectContainer.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down")):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Rg}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${Rg}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Lg{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Kp.Fit.PERFECT_FIT,Kp.Fit.SLIGHTLY_LOOSE,Kp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Ng(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Kp.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Kp.MeasurementLocationName[t.measurement_location]})))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Og;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Og||(Og={}));class Dg{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new Ag(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Ph.getInstance().setEnv(e),new Pp(t,new Op)))(Number(this.shopId),o),this.tfrSizeRec=new Lg(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(vg);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Xp);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(og);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(wg)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(gg)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Og.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Yp),this.tfrModal.onNotCreated();break;case Og.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Og.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(gg),this.tfrModal.onError(gg)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const xg=async(t,e,n,r={},i={},s="dev")=>{const o=new Dg(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,xg as initFittingRoom};
|