PageSourceSearch

https://aistiesteettomyys.web.app/build/bundle.js

js aistiesteettomyys.web.app collected 2026-10-03 12:16:05 UTC 441,580 bytes, 2,499 lines download raw bytes

1var app=function(){"use strict";function t(){}const e=t=>t;function n(t,e){for(const n in e)t[n]=e[n];return t}function i(t){return t()}function s(){return Object.create(null)}function r(t){t.forEach(i)}function o(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let l;function u(t,e){return l||(l=document.createElement("a")),l.href=e,t===l.href}function c(e,...n){if(null==e)return t;const i=e.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}function h(t){let e;return c(t,(t=>e=t))(),e}function d(t,e,n){t.$$.on_destroy.push(c(e,n))}function p(t,e,n){return t.set(n),e}const f="undefined"!=typeof window;let m=f?()=>window.performance.now():()=>Date.now(),g=f?t=>requestAnimationFrame(t):t;const v=new Set;function _(t){v.forEach((e=>{e.c(t)||(v.delete(e),e.f())})),0!==v.size&&g(_)}function y(t){let e;return 0===v.size&&g(_),{promise:new Promise((n=>{v.add(e={c:t,f:n})})),abort(){v.delete(e)}}}function k(t,e){t.appendChild(e)}function w(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function b(t){const e=I("style");return function(t,e){k(t.head||t,e)}(w(t),e),e}function T(t,e,n){t.insertBefore(e,n||null)}function C(t){t.parentNode.removeChild(t)}function S(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function I(t){return document.createElement(t)}function E(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function x(t){return document.createTextNode(t)}function N(){return x(" ")}function R(){return x("")}function P(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function O(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function A(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function j(t,e){t.value=null==e?"":e}function $(t,e,n,i){t.style.setProperty(e,n,i?"important":"")}function D(t,e){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e)return void(i.selected=!0)}t.selectedIndex=-1}function M(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}function L(t,e,n=!1){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,!1,e),i}class F{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=I(e.nodeName),this.t=e,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)T(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(C)}}const q=new Set;let U,W=0;function H(t,e,n,i,s,r,o,a=0){const l=16.666/i;let u="{\n";for(let t=0;t<=1;t+=l){const i=e+(n-e)*r(t);u+=100*t+`%{${o(i,1-i)}}\n`}const c=u+`100% {${o(n,1-n)}}\n}`,h=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(c)}_${a}`,d=w(t);q.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=b(t).sheet),f=d.__svelte_rules||(d.__svelte_rules={});f[h]||(f[h]=!0,p.insertRule(`@keyframes ${h} ${c}`,p.cssRules.length));const m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${h} ${i}ms linear ${s}ms 1 both`,W+=1,h}function z(t,e){const n=(t.style.animation||"").split(", "),i=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),s=n.length-i.length;s&&(t.style.animation=i.join(", "),W-=s,W||g((()=>{W||(q.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),q.clear())})))}function V(t){U=t}function B(){if(!U)throw new Error("Function called outside component initialization");return U}function K(t){B().$$.on_mount.push(t)}function G(){const t=B();return(e,n)=>{const i=t.$$.callbacks[e];if(i){const s=L(e,n);i.slice().forEach((e=>{e.call(t,s)}))}}}function Y(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t.call(this,e)))}const J=[],Q=[],X=[],Z=[],tt=Promise.resolve();let et=!1;function nt(){et||(et=!0,tt.then(lt))}function it(){return nt(),tt}function st(t){X.push(t)}function rt(t){Z.push(t)}let ot=!1;const at=new Set;function lt(){if(!ot){ot=!0;do{for(let t=0;t<J.length;t+=1){const e=J[t];V(e),ut(e.$$)}for(V(null),J.length=0;Q.length;)Q.pop()();for(let t=0;t<X.length;t+=1){const e=X[t];at.has(e)||(at.add(e),e())}X.length=0}while(J.length);for(;Z.length;)Z.pop()();et=!1,ot=!1,at.clear()}}
vendor: 4,747 bytes, line 1
1function ut(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(st)}}let ct;function ht(){return ct||(ct=Promise.resolve(),ct.then((()=>{ct=null}))),ct}function dt(t,e,n){t.dispatchEvent(L(`${e?"intro":"outro"}${n}`))}const pt=new Set;let ft;function mt(){ft={r:0,c:[],p:ft}}function gt(){ft.r||r(ft.c),ft=ft.p}function vt(t,e){t&&t.i&&(pt.delete(t),t.i(e))}function _t(t,e,n,i){if(t&&t.o){if(pt.has(t))return;pt.add(t),ft.c.push((()=>{pt.delete(t),i&&(n&&t.d(1),i())})),t.o(e)}}const yt={duration:0};function kt(n,i,s){let r,a,l=i(n,s),u=!1,c=0;function h(){r&&z(n,r)}function d(){const{delay:i=0,duration:s=300,easing:o=e,tick:d=t,css:p}=l||yt;p&&(r=H(n,0,1,s,i,o,p,c++)),d(0,1);const f=m()+i,g=f+s;a&&a.abort(),u=!0,st((()=>dt(n,!0,"start"))),a=y((t=>{if(u){if(t>=g)return d(1,0),dt(n,!0,"end"),h(),u=!1;if(t>=f){const e=o((t-f)/s);d(e,1-e)}}return u}))}let p=!1;return{start(){p||(p=!0,z(n),o(l)?(l=l(),ht().then(d)):d())},invalidate(){p=!1},end(){u&&(h(),u=!1)}}}function wt(n,i,s){let a,l=i(n,s),u=!0;const c=ft;function h(){const{delay:i=0,duration:s=300,easing:o=e,tick:h=t,css:d}=l||yt;d&&(a=H(n,1,0,s,i,o,d));const p=m()+i,f=p+s;st((()=>dt(n,!1,"start"))),y((t=>{if(u){if(t>=f)return h(0,1),dt(n,!1,"end"),--c.r||r(c.c),!1;if(t>=p){const e=o((t-p)/s);h(1-e,e)}}return u}))}return c.r+=1,o(l)?ht().then((()=>{l=l(),h()})):h(),{end(t){t&&l.tick&&l.tick(1,0),u&&(a&&z(n,a),u=!1)}}}function bt(n,i,s,a){let l=i(n,s),u=a?0:1,c=null,h=null,d=null;function p(){d&&z(n,d)}function f(t,e){const n=t.b-u;return e*=Math.abs(n),{a:u,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function g(i){const{delay:s=0,duration:o=300,easing:a=e,tick:g=t,css:v}=l||yt,_={start:m()+s,b:i};i||(_.group=ft,ft.r+=1),c||h?h=_:(v&&(p(),d=H(n,u,i,o,s,a,v)),i&&g(0,1),c=f(_,o),st((()=>dt(n,i,"start"))),y((t=>{if(h&&t>h.start&&(c=f(h,o),h=null,dt(n,c.b,"start"),v&&(p(),d=H(n,u,c.b,c.duration,0,a,l.css))),c)if(t>=c.end)g(u=c.b,1-u),dt(n,c.b,"end"),h||(c.b?p():--c.group.r||r(c.group.c)),c=null;else if(t>=c.start){const e=t-c.start;u=c.a+c.d*a(e/c.duration),g(u,1-u)}return!(!c&&!h)})))}return{run(t){o(l)?ht().then((()=>{l=l(),g(t)})):g(t)},end(){p(),c=h=null}}}function Tt(t,e){const n={},i={},s={$$scope:1};let r=t.length;for(;r--;){const o=t[r],a=e[r];if(a){for(const t in o)t in a||(i[t]=1);for(const t in a)s[t]||(n[t]=a[t],s[t]=1);t[r]=a}else for(const t in o)s[t]=1}for(const t in i)t in n||(n[t]=void 0);return n}function Ct(t){return"object"==typeof t&&null!==t?t:{}}function St(t,e,n){const i=t.$$.props[e];void 0!==i&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function It(t){t&&t.c()}function Et(t,e,n,s){const{fragment:a,on_mount:l,on_destroy:u,after_update:c}=t.$$;a&&a.m(e,n),s||st((()=>{const e=l.map(i).filter(o);u?u.push(...e):r(e),t.$$.on_mount=[]})),c.forEach(st)}function xt(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Nt(e,n,i,o,a,l,u,c=[-1]){const h=U;V(e);const d=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:a,bound:s(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(h?h.$$.context:[])),callbacks:s(),dirty:c,skip_bound:!1,root:n.target||h.$$.root};u&&u(d.root);let p=!1;if(d.ctx=i?i(e,n.props||{},((t,n,...i)=>{const s=i.length?i[0]:n;return d.ctx&&a(d.ctx[t],d.ctx[t]=s)&&(!d.skip_bound&&d.bound[t]&&d.bound[t](s),p&&function(t,e){-1===t.$$.dirty[0]&&(J.push(t),nt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(e,t)),n})):[],d.update(),p=!0,r(d.before_update),d.fragment=!!o&&o(d.ctx),n.target){if(n.hydrate){const t=function(t){return Array.from(t.childNodes)}(n.target);d.fragment&&d.fragment.l(t),t.forEach(C)}else d.fragment&&d.fragment.c();n.intro&&vt(e.$$.fragment),Et(e,n.target,n.anchor,n.customElement),lt()}V(h)}class Rt{$destroy(){xt(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Pt=[];function Ot(t,e){return{subscribe:At(t,e).subscribe}}function At(e,n=t){let i;const s=new Set;function r(t){if(a(e,t)&&(e=t,i)){const t=!Pt.length;for(const t of s)t[1](),Pt.push(t,e);if(t){for(let t=0;t<Pt.length;t+=2)Pt[t][0](Pt[t+1]);Pt.length=0}}}return{set:r,update:function(t){r(t(e))},subscribe:function(o,a=t){const l=[o,a];return s.add(l),1===s.size&&(i=n(r)||t),o(e),()=>{s.delete(l),0===s.size&&(i(),i=null)}}}}function jt(e,n,i){const s=!Array.isArray(e),a=s?[e]:e,l=n.length<2;return Ot(i,(e=>{let i=!1;const u=[];let h=0,d=t;const p=()=>
1{if(h)return;d();const i=n(s?u[0]:u,e);l?e(i):d=o(i)?i:t},f=a.map(((t,e)=>c(t,(t=>{u[e]=t,h&=~(1<<e),i&&p()}),(()=>{h|=1<<e}))));return i=!0,p(),function(){r(f),d()}}))}const $t=["#3dc83d","#7676f4","#e88787","#fca92e"],Dt=["Kuuloaisti","Näköaisti","Tuntoaisti","Hajuaisti"],Mt=["Sense of hearing","Sense of sight","Sense of touch","Sense of smell"],Lt=["hearing","visibility","pan_tool","spa"],Ft=.25,qt=.6,Ut=.85,Wt=["Arvioi tilan akustisia ominaisuuksia","Tilassa kuuluu häiritsevää ääntä...","Tilassa kuuluu häiritsevää ääntä...","Tilassa kuuluu häiritsevää ääntä...","Tilassa kuuluu häiritsevää ääntä...","Tilassa syntyy häiritsevää näköaistimusta...","Tilassa syntyy häiritsevää näköaistimusta...","Tilassa syntyy häiritsevää näköaistimusta...","Arvioi tilan visuaalisia ominaisuuksia","Tilassa syntyy häiritsevää tuntoaistimusta...","Tilassa syntyy häiritsevää tuntoaistimusta...","Tilassa syntyy häiritsevää tuntoaistimusta...","Tilassa on tuntoaistin kannalta hankala","Tilassa on häiritsevä haju, joka johtuu...","Tilassa on häiritsevä haju, joka johtuu...","Tilassa on häiritsevä haju, joka johtuu..."],Ht=["Assess the acoustic properties of the space","There is disturbing noise in the space","There is disturbing noise in the space","There is disturbing noise in the space","There is disturbing noise in the space","There are disturbing visual sensations","There are disturbing visual sensations","There are disturbing visual sensations","Assess the visual properties of the space","There are disturbing touch sensations","There are disturbing touch sensations","There are disturbing touch sensations","The space has something difficult from the viewpoint of the sense of touch","There is a disturbing smell in the space","There is a disturbing smell in the space","There is a disturbing smell in the space"],zt=[{id:"q1-1",value:0,group:1,page:1,type:0,title:"Tilan yleinen akustiikka on heikko",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q1-2",value:0,group:1,page:1,type:0,title:"Tilassa kuuluu häiritsevää taustaääntä",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q1-3",value:0,group:1,page:2,type:0,title:"Pattereista",is
1Full:!1,canSkip:!0,skip:!1,details:""},{id:"q1-4",value:0,group:1,page:2,type:0,title:"Ilmastoinnista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-5",value:0,group:1,page:2,type:0,title:"Valaistuksesta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-6",value:0,group:1,page:2,type:0,title:"It-laitteista tai muista sähkölaitteista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-2b",value:0,group:1,page:3,type:0,title:"Taustaäänet kumuloituvat",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-4b",value:0,group:1,page:3,type:0,title:"Huonekalujen käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-5b",value:0,group:1,page:3,type:0,title:"Ovien käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-2c",value:0,group:1,page:4,type:0,title:"Lattialla käveltäessä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-4c",value:0,group:1,page:4,type:0,title:"Mikrofonin käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-5c",value:0,group:1,page:4,type:0,title:"Ihmisten puheensorinasta tai muusta hälystä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-1d",value:0,group:1,page:5,type:0,title:"Ihmisten arkiaskareista/-tekemisistä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-2d",value:0,group:1,page:5,type:0,title:"Taustamusiikista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-3d",value:0,group:1,page:5,type:0,title:"Rakennuksen info- ja/tai hälytysäänistä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-4d",value:0,group:1,page:5,type:0,title:"Rakennuksen ulkopuolelta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q1-5d",value:0,group:1,page:5,type:1,title:"Tila on erittäin hiljainen",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q2-1",value:0,group:2,page:6,type:0,title:"Yleisestä valaistuksesta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-2",value:0,group:2,page:6,type:0,title:"Yksittäisistä häiritsevistä valoista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-3",value:0,group:2,page:6,type:0,title:"Heijastumista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-1a",value:0,group:2,page:7,type:0,title:"Valojen ja varjojen vaihteluista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-2a",value:0,group:2,page:7,type:0,title:"Isoista peileistä tai lasipinnoista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-3a",value:0,group:2,page:7,type:0,title:"Voimakkaiden värien ja/tai kontrastien käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-4a",value:0,group:2,page:7,type:0,title:"Hyvin yksipuolisten värien käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-5a",value:0,group:2,page:7,type:0,title:"Graafisten kuvioiden käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-1b",value:0,group:2,page:8,type:0,title:"Sekavien pintamateriaalien käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-3b",value:0,group:2,page:8,type:0,title:"Liikkuvasta kuvasta/näkymästä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-4b",value:0,group:2,page:8,type:0,title:"Rakennuksen sekavasta yleisilmeestä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q2-5b",value:0,group:2,page:9,type:0,title:"Tilassa on hankalia syvyyden hahmottamista vaativia paikkoja",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q2-1c",value:0,group:2,page:9,type:1,title:"Tilassa on käytetty selkiyttäviä opasteita/karttoja/ohjaavia viivoja.",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q2-3c",value:0,group:2,page:9,type:1,title:"Tila on kooltaan sopiva käyttötarkoitukseensa",isFull:!0,canSkip:!0,skip:!1,details:""},{id:"q3-2",value:0,group:3,page:10,type:0,title:"Tilan vetoisuudesta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-3",value:0,group:3,page:10,type:0,title:"Käytetyistä pintamateriaaleista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-1a",value:0,group:3,page:11,type:0,title:"Kalusteiden tuntumasta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-2a",value:0,group:3,page:11,type:0,title:"Kalusteiden mittasuhteista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-3a",value:0,group:3,page:11,type:0,title:"Lattiatuntumasta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-4a",value:0,group:3,page:11,type:0,title:"Lattialämmityksestä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-5a",value:0,group:3,page:12,type:0,title:"Tilan ahtaudesta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-1b",value:0,group:3,page:12,type:0,title:"Ulko-oven yhteydessä voimakkaasti puhaltavista ilmastointilaitteista/lämpöverhosta",is
1Full:!1,canSkip:!0,skip:!1,details:""},{id:"q3-2b",value:0,group:3,page:12,type:0,title:"Kuivasta huoneilmasta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-3b",value:0,group:3,page:13,type:0,title:"Suihku",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-4b",value:0,group:3,page:13,type:0,title:"Wc-istuimen huuhtelumekanismi",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q3-5b",value:0,group:3,page:13,type:0,title:"Ovenkahva/-vedin",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-1",value:0,group:4,page:14,type:0,title:"Jostakin yleistuoksusta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-2",value:0,group:4,page:14,type:0,title:"Käytetyistä materiaaleista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-3",value:0,group:4,page:14,type:0,title:"Tuoksuvista kasveista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-4",value:0,group:4,page:14,type:0,title:"Raikastimien käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-1a",value:0,group:4,page:15,type:0,title:"Kynttilöiden polttamisesta",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-2a",value:0,group:4,page:15,type:0,title:"Hajustettujen pesuaineiden käytöstä",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-3a",value:0,group:4,page:15,type:0,title:"Ihmisistä tilassa",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-4a",value:0,group:4,page:15,type:0,title:"Ilmastoinnin kautta tulevista hajuista",isFull:!1,canSkip:!0,skip:!1,details:""},{id:"q4-5a",value:0,group:4,page:15,type:0,title:"Tilassa on muu tunnistamaton tuoksun lähde",isFull:!0,canSkip:!0,skip:!1,details:""}],Vt=["Tilan yleinen akustiikka on heikko","Tilassa kuuluu häiritsevää taustaääntä","Pattereista","Ilmastoinnista","Valaistuksesta","It-laitteista tai muista sähkölaitteista","Taustaäänet kumuloituvat","Huonekalujen käytöstä","Ovien käytöstä","Lattialla käveltäessä","Mikrofonin käytöstä","Ihmisten puheensorinasta tai muusta hälystä","Ihmisten arkiaskareista/-tekemisistä","Taustamusiikista","Rakennuksen info- ja/tai hälytysäänistä","Rakennuksen ulkopuolelta","Tila on erittäin hiljainen","Yleisestä valaistuksesta","Yksittäisistä häiritsevistä valoista","Heijastumista","Valojen ja varjojen vaihteluista","Isoista peileistä tai lasipinnoista","Voimakkaiden värien ja/tai kontrastien käytöstä","Hyvin yksipuolisten värien käytöstä","Graafisten kuvioiden käytöstä","Sekavien pintamateriaalien käytöstä","Liikkuvasta kuvasta/näkymästä","Rakennuksen sekavasta yleisilmeestä","Tilassa on hankalia syvyyden hahmottamista vaativia paikkoja","Tilassa on käytetty selkiyttäviä opasteita/karttoja/ohjaavia viivoja.","Tila on kooltaan sopiva käyttötarkoitukseensa","Tilan vetoisuudesta","Käytetyistä pintamateriaaleista","Kalusteiden tuntumasta","Kalusteiden mittasuhteista","Lattiatuntumasta","Lattialämmityksestä","Tilan ahtaudesta","Ulko-oven yhteydessä voimakkaasti puhaltavista ilmastointilaitteista/lämpöverhosta","Kuivasta huoneilmasta","Suihku","Wc-istuimen huuhtelumekanismi","Ovenkahva/-vedin","Jostakin yleistuoksusta","Käytetyistä materiaaleista","Tuoksuvista kasveista","Raikastimien käytöstä","Kynttilöiden polttamisesta","Hajustettujen pesuaineiden käytöstä","Ihmisistä tilassa","Ilmastoinnin kautta tulevista hajuista","Tilassa on muu tunnistamaton tuoksun lähde"],Bt=["The overall acoustics of the space are poor","There is disturbing background noise in the space","from radiators","from air conditioning","from lighting","from IT equipment or other electrical devices","Background noises are cumulative","from the use of furniture","from the use of doors","from people walking on the floor","from the use of microphones","from people talking or other noise","from people’s daily chores or activities","from background music","from the information and/or alarm sounds of the building","from outside the building","The space is very quiet","from general lighting","from individual disturbing lights","from reflections","from the variations in light and shade","from large mirrors or glass surfaces","from the use of strong colours and/or contrasts","from the use of a very limited range of colours","from the use of graphic patterns","from the use of confusing surface materials","from a moving image/view","from the unclear overall look of the building","There are difficult places in the space that require depth perception","The space is equipped with clarifying signs/maps/guiding lines","The space is of an appropriate size for its intended use","from the draughtiness of the space","from the surface materials used","from the feel of the furniture","from the dimensions of the furniture","from the feel of the floor","from underfloor heating","from lack of space","from air conditioners/heat curtain at the external door with strong winds","from dry indoor air","Shower","Toilet seat flushing mechanism","Door handle/pull","from some general smell","from materials used","from scented plants","from the use of fresheners","from burning c
1andles","from the use of perfumed detergents","from the people in the space","from smells coming through air conditioning","from some other unidentified source of smell in the space"],Kt=[{isShowed:!1,group:1},{isShowed:!1,group:2},{isShowed:!1,group:3},{isShowed:!1,group:4}],Gt=["Ensimmäiseksi kartoitetaan tilojen akustisia ominaisuuksia. Tilan äänimaailma ja akustiikka on tärkeä osa aistiesteetöntä\n    suunnittelua. Koska erilaiset ääniherkkyydet ovat aistiherkkyyksistä yleisimpiä, on asiaan tärkeää kiinnittää huomiota.\n    Aistiesteettömässä tilassa tavoitellaan miellyttävää äänimaisemaa, jossa ei ole liikaa taustamelua tai häiritsevää\n    kaikumista. Monelle aistiherkälle kuuloaistin kannalta kuormittavia ärsykkeitä ovat yllättävät, kovat tai tiettyä taajuutta\n    olevat äänet sekä yleinen hälinä. Ääni kulkee tilassa pääsääntöisesti heijastuen erilaisista pinnoista. Kovat materiaalit ja\n    pinnat heijastavatkin ääntä tehokkaammin kuin pehmeät","Seuraavaksi kartoitetaan tilojen visuaalista ilmettä. Aistiesteettömässä tilassa\n    tavoitellaan harmonista ja selkeää kokonaisuutta. Yleensä suositaan\n    maanläheisiä ja murrettuja sävyjä sekä ylöspäin vaalenevaa värimaailmaa.\n    Epäsuora, tilan hahmottamista tukeva ja säädettävissä oleva valaistus tukee\n    aistiesteettömyyttä. Samoin pyöreät ja ovaalit muodot istuvat hyvin\n    aistiesteettömyyteen. Aistiherkälle näköaistin kannalta kuormittavia ovat\n    monesti hyvin voimakkaat värit, voimakkaat/sekavat pintamateriaalit ja\n    kuvioinnit. Samoin häikäisevät valot ja pinnat tai ihmisvilinä voi tuottaa ei-toivottua\n    näköärsytystä.","Kartoituksen kolmannessa osa-alueessa kartoitetaan tiloja\n    tuntoaistin näkökulmasta. Kalusteiden ja materiaalien valinnassa\n    tuntoaistilla on keskeinen rooli. Tuntoaistin kohdalla pohditaan,\n    miten miellyttävinä ja monipuolisina tilassa olevat materiaalit\n    koetaan. Aistiherkälle tuntoaistin kannalta kuormittavia\n    elementtejä voivat olla kalusteiden vääränlainen mitoitus,\n    ikäväntuntuiset materiaalit (kuten kovin karheat, sähköiset tai\n    kylmäntuntuiset) tai liian lämpimäksi tai kylmäksi koettu\n    sisälämpötila.","Lopuksi kartoitetaan tiloja hajuaistin näkökulmasta. Rakennus- ja sisustusmateriaalit sekä huonekalut ovat yleisimpiä\n    hajujen lähteitä. Muita sisäilmaan vaikuttavia tekijöitä ovat muun muassa ilmanvaihto, rakennustapa, rakennuksen\n    sijainti, tilankäyttäjät sekä sääolot. Hyvä sisäilma vaikuttaa positiivisesti tilankäyttävien viihtyvyyteen, terveyteen sekä\n    vireystilaan.\n    Sisäilmassa olevia hajuja ja tuoksuja on lähes mahdoton välttää kokonaan, mutta jo usein tyydyttävään lopputulokseen\n    päästään pitämällä huolta tilojen siisteydestä ja hygieniasta. Tärkeintä on siis lähtökohtaisesti selvittää hajunlähde ja\n    toimia sen poistamiseksi. Tuoksu- ja hajutekijöissä tulee myös huomioida, etteivät kaikki yksilöt eivät koe niitä\n    kuormittaviksi eivätkä kaikki hajut eivät ole suinkaan vain negatiivisia. Keskimäärin miellyttävimmiksi on koettu etenkin\n    erilaiset luonnosta lähtöisin ovat tuoksut."],Yt=["The first step is to survey the acoustic properties of the space. The sound environment and acoustics of a space are an important part of the sensory-accessible design. As different sound sensitivities are the most common sensory sensitivities, it is very important to pay attention to this issue. The goal for a sensory-accessible space is a pleasant sound soundscape where there isn’t too much background noise or disturbing echoing. Unexpected, loud sounds or sounds of a certain frequency, as well as general noise, can put a strain on the sense of hearing of many sensory-sensitive people. Sound travels in a space generally by reflecting from different surfaces. Hard materials and surfaces reflect sound more intensively than soft ones.","The next step is to survey the visual appearance of the space. The goal for a sensory-accessible space is to create a harmonius and clear overall impression. In general, earthy and broken colours are preferred as well as an upward fading colour scheme.  Indirect lighting that helps the perception of the space and is adjustable supports sensory accessibility. Similarly, round and oval shapes are well suited for sensory accessibility. Strong colours, strong/unclear surface materials and textures often put a strain on the sense of sight of sensory-sensitive people. In the same way, glaring lights and surfaces or a throng of people can cause unwanted visual simulation.","In the third part of the survey, the spaces are surveyed from the viewpoint of the sense of touch. The sense of touch plays a key role in the selection of furniture and materials. When thinking about the sense of touch, one must consider how pleasant and versatile the materials in the space are felt to be. Elements that can put a strain on the sense of touch of sensory-sensitive people may include incorrectly sized furniture, unpleasant materials (such as those that are too rough, electric or c
1old to touch) or indoor temperature that is felt as too warm or too cold. ","Lastly, we survey spaces from the viewpoint of the sense of smell. Construction and interior materials as well as furniture are the most common sources of smells. Other factors influencing indoor air are, for example, ventilation, building design, the location of the building, its users and weather conditions. Good indoor air has a positive effect on the comfort, health and energy of the people using the space. It is almost impossible to completely avoid odours and smells in indoor air, but a satisfactory result can often be reached by just taking care of the cleanliness and hygiene of the spaces. Therefore, the most important thing is to identify the source of the smell and take action to eliminate it. When thinking about odours and smells, one must also keep in mind that not all individuals find them strenuous and not all smells are by any means negative. On average, the most pleasant smells are felt to be scents that come from nature."];function Jt(t,e){if(t){if("en"===e){return t.map(((t,e)=>(t.title=Bt[e],t)))}return t.map(((t,e)=>(t.title=Vt[e],t)))}}const Qt=sessionStorage.getItem("questions"),Xt=Qt?JSON.parse(Qt):null,Zt=localStorage.getItem("craft"),te=Zt?JSON.parse(Zt):null,ee=localStorage.getItem("lang"),ne=ee?JSON.parse(ee):"fi",ie=At(Xt||[...zt]),se=At(te),re=At(!1),oe=At("normal"),ae=At(ne);function le(t){document.querySelector(":root").style.setProperty("--bg-color",t)}function ue(t){const e=[];for(let n=0;n<t.length;n++)t[n].value=0,e.push(t[n]);return e}function ce(t){const e=t-1;return e*e*e+1}function he(t,{delay:n=0,duration:i=400,easing:s=e}={}){const r=+getComputedStyle(t).opacity;return{delay:n,duration:i,easing:s,css:t=>"opacity: "+t*r}}function de(t,{delay:e=0,duration:n=400,easing:i=ce,x:s=0,y:r=0,opacity:o=0}={}){const a=getComputedStyle(t),l=+a.opacity,u="none"===a.transform?"":a.transform,c=l*(1-o);return{delay:e,duration:n,easing:i,css:(t,e)=>`\n\t\t\ttransform: ${u} translate(${(1-t)*s}px, ${(1-t)*r}px);\n\t\t\topacity: ${l-c*e}`}}function pe(t){let e,i,s;const r=[t[2]];var o=t[0];function a(t){let e={};for(let t=0;t<r.length;t+=1)e=n(e,r[t]);return{props:e}}return o&&(e=new o(a()),e.$on("routeEvent",t[7])),{c(){e&&It(e.$$.fragment),i=R()},m(t,n){e&&Et(e,t,n),T(t,i,n),s=!0},p(t,n){const s=4&n?Tt(r,[Ct(t[2])]):{};if(o!==(o=t[0])){if(e){mt();const t=e;_t(t.$$.fragment,1,0,(()=>{xt(t,1)})),gt()}o?(e=new o(a()),e.$on("routeEvent",t[7]),It(e.$$.fragment),vt(e.$$.fragment,1),Et(e,i.parentNode,i)):e=null}else o&&e.$set(s)},i(t){s||(e&&vt(e.$$.fragment,t),s=!0)},o(t){e&&_t(e.$$.fragment,t),s=!1},d(t){t&&C(i),e&&xt(e,t)}}}function fe(t){let e,i,s;const r=[{params:t[1]},t[2]];var o=t[0];function a(t){let e={};for(let t=0;t<r.length;t+=1)e=n(e,r[t]);return{props:e}}return o&&(e=new o(a()),e.$on("routeEvent",t[6])),{c(){e&&It(e.$$.fragment),i=R()},m(t,n){e&&Et(e,t,n),T(t,i,n),s=!0},p(t,n){const s=6&n?Tt(r,[2&n&&{params:t[1]},4&n&&Ct(t[2])]):{};if(o!==(o=t[0])){if(e){mt();const t=e;_t(t.$$.fragment,1,0,(()=>{xt(t,1)})),gt()}o?(e=new o(a()),e.$on("routeEvent",t[6]),It(e.$$.fragment),vt(e.$$.fragment,1),Et(e,i.parentNode,i)):e=null}else o&&e.$set(s)},i(t){s||(e&&vt(e.$$.fragment,t),s=!0)},o(t){e&&_t(e.$$.fragment,t),s=!1},d(t){t&&C(i),e&&xt(e,t)}}}function me(t){let e,n,i,s;const r=[fe,pe],o=[];function a(t,e){return t[1]?0:1}return e=a(t),n=o[e]=r[e](t),{c(){n.c(),i=R()},m(t,n){o[e].m(t,n),T(t,i,n),s=!0},p(t,[s]){let l=e;e=a(t),e===l?o[e].p(t,s):(mt(),_t(o[l],1,1,(()=>{o[l]=null})),gt(),n=o[e],n?n.p(t,s):(n=o[e]=r[e](t),n.c()),vt(n,1),n.m(i.parentNode,i))},i(t){s||(vt(n),s=!0)},o(t){_t(n),s=!1},d(t){o[e].d(t),t&&C(i)}}}function ge(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let i="";return n>-1&&(i=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:i}}ie.subscribe((t=>{sessionStorage.setItem("questions",JSON.stringify(t))})),se.subscribe((t=>{null!==t&&localStorage.setItem("craft",JSON.stringify(t))})),ae.subscribe((t=>{if(null!==t){localStorage.setItem("lang",JSON.stringify(t));let e=[...h(ie)];if("fi"===t){const t=Jt(e,"fi");ie.set(t)}else if("en"===t){const t=Jt(e,"en");ie.set(t)}}}));const ve=Ot(null,(function(t){t(ge());const e=()=>{t(ge())};return window.addEventListener("hashchange",e,!1),function(){window.removeEventListener("hashchange",e,!1)}})),_e=jt(ve,(t=>t.location));jt(ve,(t=>t.querystring));const ye=At(void 0);async function ke(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await it(),history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0,void 0),window.location.hash=("#"==t.charAt(0)?"":"#")+t}function we(t,e,n){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:r=!1}=e;class o{constructor(t,e){if(!e||"function"!=typeof e&&("object"!=typeof e||!0!==e._sveltesparouter))throw Error("Invalid component object");
1if(!t||"string"==typeof t&&(t.length<1||"/"!=t.charAt(0)&&"*"!=t.charAt(0))||"object"==typeof t&&!(t instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:n,keys:i}=function(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,i,s,r,o=[],a="",l=t.split("/");for(l[0]||l.shift();s=l.shift();)"*"===(n=s[0])?(o.push("wild"),a+="/(.*)"):":"===n?(i=s.indexOf("?",1),r=s.indexOf(".",1),o.push(s.substring(1,~i?i:~r?r:s.length)),a+=~i&&!~r?"(?:/([^/]+?))?":"/([^/]+?)",~r&&(a+=(~i?"?":"")+"\\"+s.substring(r))):a+="/"+s;return{keys:o,pattern:new RegExp("^"+a+(e?"(?=$|/)":"/?$"),"i")}}(t);this.path=t,"object"==typeof e&&!0===e._sveltesparouter?(this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}):(this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}),this._pattern=n,this._keys=i}match(t){if(s)if("string"==typeof s){if(!t.startsWith(s))return null;t=t.substr(s.length)||"/"}else if(s instanceof RegExp){const e=t.match(s);if(!e||!e[0])return null;t=t.substr(e[0].length)||"/"}const e=this._pattern.exec(t);if(null===e)return null;if(!1===this._keys)return e;const n={};let i=0;for(;i<this._keys.length;){try{n[this._keys[i]]=decodeURIComponent(e[i+1]||"")||null}catch(t){n[this._keys[i]]=null}i++}return n}async checkConditions(t){for(let e=0;e<this.conditions.length;e++)if(!await this.conditions[e](t))return!1;return!0}}const a=[];i instanceof Map?i.forEach(((t,e)=>{a.push(new o(e,t))}
1)):Object.keys(i).forEach((t=>{a.push(new o(t,i[t]))}));let l=null,u=null,c={};const h=G();async function d(t,e){await it(),h(t,e)}let p=null,f=null;var m;r&&(f=t=>{p=t.state&&t.state.__svelte_spa_router_scrollY?t.state:null},window.addEventListener("popstate",f),m=()=>{p?window.scrollTo(p.__svelte_spa_router_scrollX,p.__svelte_spa_router_scrollY):window.scrollTo(0,0)},B().$$.after_update.push(m));let g=null,v=null;const _=ve.subscribe((async t=>{g=t;let e=0;for(;e<a.length;){const i=a[e].match(t.location);if(!i){e++;continue}const s={route:a[e].path,location:t.location,querystring:t.querystring,userData:a[e].userData,params:i&&"object"==typeof i&&Object.keys(i).length?i:null};if(!await a[e].checkConditions(s))return n(0,l=null),v=null,void d("conditionsFailed",s);d("routeLoading",Object.assign({},s));const r=a[e].component;if(v!=r){r.loading?(n(0,l=r.loading),v=r,n(1,u=r.loadingParams),n(2,c={}),d("routeLoaded",Object.assign({},s,{component:l,name:l.name,params:u}))):(n(0,l=null),v=null);const e=await r();if(t!=g)return;n(0,l=e&&e.default||e),v=r}return i&&"object"==typeof i&&Object.keys(i).length?n(1,u=i):n(1,u=null),n(2,c=a[e].props),void d("routeLoaded",Object.assign({},s,{component:l,name:l.name,params:u})).then((()=>{ye.set(u)}))}n(0,l=null),v=null,ye.set(void 0)}));return function(t){B().$$.on_destroy.push(t)}((()=>{_(),f&&window.removeEventListener("popstate",f)})),t.$$set=t=>{"routes"in t&&n(3,i=t.routes),"prefix"in t&&n(4,s=t.prefix),"restoreScrollState"in t&&n(5,r=t.restoreScrollState)},t.$$.update=()=>{32&t.$$.dirty&&(history.scrollRestoration=r?"manual":"auto")},[l,u,c,i,s,r,function(e){Y.call(this,t,e)},function(e){Y.call(this,t,e)}]}class be extends Rt{constructor(t){super(),Nt(this,t,we,me,a,{routes:3,prefix:4,restoreScrollState:5})}}function Te(t){let e,n,i,s,o,a,l,u,c,h;return{c(){e=I("div"),n=I("label"),n.innerHTML='<span class="label-text settings-label svelte-1d73uv">Valitse kieli / Select language</span>',i=N(),s=I("select"),o=I("option"),o.textContent="suomi",a=I("option"),a.textContent="english",O(n,"class","label"),O(n,"for","lang-menu"),o.__value="fi",o.value=o.__value,a.__value="en",a.value=a.__value,O(s,"class","select select-bordered"),O(s,"id","settings-menu"),$(s,"margin-top","1rem"),$(s,"margin-bottom","1rem"),void 0===t[1]&&st((()=>t[4].call(s))),O(e,"class","settings svelte-1d73uv")},m(r,l){T(r,e,l),k(e,n),k(e,i),k(e,s),k(s,o),k(s,a),D(s,t[1]),u=!0,c||(h=[P(s,"change",t[4]),P(s,"change",t[2])],c=!0)},p(t,e){2&e&&D(s,t[1])},i(t){u||(st((()=>{l||(l=bt(e,he,{duration:200},!0)),l.run(1)})),u=!0)},o(t){l||(l=bt(e,he,{duration:200},!1)),l.run(0),u=!1},d(t){t&&C(e),t&&l&&l.end(),c=!1,r(h)}}}function Ce(t){let e,n,i=t[0]&&Te(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&vt(i,1)):(i=Te(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function Se(t,e,n){let i;d(t,ae,(t=>n(1,i=t)));let{open:s=!1}=e,{icon:r="language"}=e;return t.$$set=t=>{"open"in t&&n(0,s=t.open),"icon"in t&&n(3,r=t.icon)},t.$$.update=()=>{1&t.$$.dirty&&n(3,r=s?"close":"language")},[s,i,function(){n(0,s=!1)},r,function(){i=M(this),ae.set(i)}]}class Ie extends Rt{constructor(t){super(),Nt(this,t,Se,Ce,a,{open:0,icon:3})}}function Ee(t){let e,n,i,s,r;return{c(){e=I("div"),O(e,"class","overlay svelte-gzd5py")},m(n,o){T(n,e,o),i=!0,s||(r=P(e,"click",t[1]),s=!0)},i(t){i||(st((()=>{n||(n=bt(e,he,{duration:200},!0)),n.run(1)})),i=!0)},o(t){n||(n=bt(e,he,{duration:200},!1)),n.run(0),i=!1},d(t){t&&C(e),t&&n&&n.end(),s=!1,r()}}}function xe(t){let e,n,i=t[0]&&Ee(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?1&n&&vt(i,1):(i=Ee(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function Ne(t,e,n){let{show:i=!1}=e;return t.$$set=t=>{"show"in t&&n(0,i=t.show)},[i,function(e){Y.call(this,t,e)}]}class Re extends Rt{constructor(t){super(),Nt(this,t,Ne,xe,a,{show:0})}}function Pe(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,$,D,M,L,F,q,U="fi"===t[3]?"Mustiinpanot":"Notes",W="fi"===t[3]?"Muistiinpanot":"Notes",H="fi"===t[3]?"Peruuta":"Cancel",z="fi"===t[3]?"Tallenna":"Save";return M=new Re({props:{show:t[1]}}),M.$on("click",t[5]),{c(){e=I("div"),n=I("h2"),i=x(U),s=N(),o=I("p"),a=x("("),l=x(t[2]),u=x(")"),c=N(),h=I("div"),d=I("label"),p=I("span"),f=x(W),m=N(),g=I("textarea"),v=N(),_=I("div"),y=I("button"),w=x(H),b=N(),S=I("button"),E=x(z),D=N(),It(M.$$.fragment),O(n,"class","svelte-ftjlae"),O(p,"class","label-text"),O(d,"class","label"),O(d,"for","details"),O(g,"id","details"),O(g,"class","textarea textarea-bordered"),O(h,"class","form-control"),O(y,"class","btn"),O(S,"class","btn btn-primary"),O(_,"class","action svelte-ftjlae"),O(e,"class","svelte-modal svelte-ftjlae")}
1,m(r,C){T(r,e,C),k(e,n),k(n,i),k(e,s),k(e,o),k(o,a),k(o,l),k(o,u),k(e,c),k(e,h),k(h,d),k(d,p),k(p,f),k(h,m),k(h,g),j(g,t[0]),k(e,v),k(e,_),k(_,y),k(y,w),k(_,b),k(_,S),k(S,E),T(r,D,C),Et(M,r,C),L=!0,F||(q=[P(g,"input",t[8]),P(y,"click",t[5]),P(S,"click",t[4])],F=!0)},p(t,e){(!L||8&e)&&U!==(U="fi"===t[3]?"Mustiinpanot":"Notes")&&A(i,U),(!L||4&e)&&A(l,t[2]),(!L||8&e)&&W!==(W="fi"===t[3]?"Muistiinpanot":"Notes")&&A(f,W),1&e&&j(g,t[0]),(!L||8&e)&&H!==(H="fi"===t[3]?"Peruuta":"Cancel")&&A(w,H),(!L||8&e)&&z!==(z="fi"===t[3]?"Tallenna":"Save")&&A(E,z);const n={};2&e&&(n.show=t[1]),M.$set(n)},i(t){L||(st((()=>{$&&$.end(1),R=kt(e,de,{duration:200,y:200}),R.start()})),vt(M.$$.fragment,t),L=!0)},o(t){R&&R.invalidate(),$=wt(e,he,{duration:200}),_t(M.$$.fragment,t),L=!1},d(t){t&&C(e),t&&$&&$.end(),t&&C(D),xt(M,t),F=!1,r(q)}}}function Oe(t){let e,n,i=t[1]&&Pe(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[1]?i?(i.p(t,n),2&n&&vt(i,1)):(i=Pe(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function Ae(t,e,n){let i;d(t,ae,(t=>n(3,i=t)));let s,{details:r=""}=e,{title:o="Muistiinpano"}=e,{text:a="Voit kirjoittaa arvioitavaan kohtaan liittyviä muistiinpanoja tähän"}=e,{buttonText:l="Tallenna"}=e,{open:u=!1}=e;return K((()=>{s=r})),t.$$set=t=>{"details"in t&&n(0,r=t.details),"title"in t&&n(2,o=t.title),"text"in t&&n(6,a=t.text),"buttonText"in t&&n(7,l=t.buttonText),"open"in t&&n(1,u=t.open)},[r,u,o,i,function(){console.log(r),s=r,setTimeout((()=>{n(1,u=!1)}),400)},function(){n(0,r=s),n(1,u=!1)},a,l,function(){r=this.value,n(0,r)}]}class je extends Rt{constructor(t){super(),Nt(this,t,Ae,Oe,a,{details:0,title:2,text:6,buttonText:7,open:1})}}function $e(t){let e,n,i,s,r,o,a,l,u,c,h,d,p,f,m,g=t[0].title+"",v="normal"===t[5]&&De(t),_=t[0].canSkip&&Le(t);function y(t,e){return t[0].details?We:Ue}let w=y(t),b=w(t);return{c(){e=I("div"),n=I("p"),i=x(t[2]),s=x(". "),r=x(g),o=N(),v&&v.c(),a=N(),_&&_.c(),l=N(),u=I("div"),c=I("button"),b.c(),O(n,"class","title svelte-c67o1k"),O(c,"class",h="btn "+(t[0].details?"btn-primary":"btn-ghost")+" btn-sm"),c.disabled=d=!!t[0].skip,O(u,"class","skip-container svelte-c67o1k"),O(e,"class",p="question "+(t[0].skip?"disabled":"")+" svelte-c67o1k"),O(e,"data-name","question")},m(h,d){T(h,e,d),k(e,n),k(n,i),k(n,s),k(n,r),k(e,o),v&&v.m(e,null),k(e,a),_&&_.m(e,null),k(e,l),k(e,u),k(u,c),b.m(c,null),f||(m=P(c,"click",t[16]),f=!0)},p(t,n){4&n&&A(i,t[2]),1&n&&g!==(g=t[0].title+"")&&A(r,g),"normal"===t[5]?v?v.p(t,n):(v=De(t),v.c(),v.m(e,a)):v&&(v.d(1),v=null),t[0].canSkip?_?_.p(t,n):(_=Le(t),_.c(),_.m(e,l)):_&&(_.d(1),_=null),w===(w=y(t))&&b?b.p(t,n):(b.d(1),b=w(t),b&&(b.c(),b.m(c,null))),1&n&&h!==(h="btn "+(t[0].details?"btn-primary":"btn-ghost")+" btn-sm")&&O(c,"class",h),1&n&&d!==(d=!!t[0].skip)&&(c.disabled=d),1&n&&p!==(p="question "+(t[0].skip?"disabled":"")+" svelte-c67o1k")&&O(e,"class",p)},d(t){t&&C(e),v&&v.d(),_&&_.d(),b.d(),f=!1,m()}}}function De(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,j="fi"===t[6]?"Ei":"No",$="fi"===t[6]?"Kyllä":"Yes",D="yes"===t[3]&&Me(t);return{c(){e=I("div"),n=I("label"),i=I("span"),s=x(j),o=N(),a=I("input"),h=N(),d=I("label"),p=I("span"),f=x($),m=N(),g=I("input"),w=N(),D&&D.c(),b=R(),O(i,"class","label-text svelte-c67o1k"),O(a,"type","radio"),O(a,"name",l="radio-"+t[0].id),O(a,"class","radio"),a.__value=u=0===t[0].type?"no":"yes",a.value=a.__value,a.disabled=c=t[0].skip,t[12][0].push(a),O(n,"class","cursor-pointer label radio-select svelte-c67o1k"),O(p,"class","label-text svelte-c67o1k"),O(g,"type","radio"),O(g,"name",v="radio-"+t[0].id),O(g,"class","radio"),g.__value=_=0===t[0].type?"yes":"no",g.value=g.__value,g.disabled=y=t[0].skip,t[12][0].push(g),O(d,"class","cursor-pointer label radio-select svelte-c67o1k"),O(e,"class","radio-container")},m(r,l){T(r,e,l),k(e,n),k(n,i),k(i,s),k(n,o),k(n,a),a.checked=a.__value===t[3],k(e,h),k(e,d),k(d,p),k(p,f),k(d,m),k(d,g),g.checked=g.__value===t[3],T(r,w,l),D&&D.m(r,l),T(r,b,l),S||(E=[P(a,"change",t[11]),P(a,"change",t[8]),P(g,"change",t[13]),P(g,"change",t[8])],S=!0)},p(t,e){64&e&&j!==(j="fi"===t[6]?"Ei":"No")&&A(s,j),1&e&&l!==(l="radio-"+t[0].id)&&O(a,"name",l),1&e&&u!==(u=0===t[0].type?"no":"yes")&&(a.__value=u,a.value=a.__value),1&e&&c!==(c=t[0].skip)&&(a.disabled=c),8&e&&(a.checked=a.__value===t[3]),64&e&&$!==($="fi"===t[6]?"Kyllä":"Yes")&&A(f,$),1&e&&v!==(v="radio-"+t[0].id)&&O(g,"name",v),1&e&&_!==(_=0===t[0].type?"yes":"no")&&(g.__value=_,g.value=g.__value),1&e&&y!==(y=t[0].skip)&&(g.disabled=y),8&e&&(g.checked=g.__value===t[3]),"yes"===t[3]?D?D.p(t,e):(D=Me(t),D.c(),D.m(b.parentNode,b)):D&&(D.d(1),D=null)},d(n){n&&C(e),t[12][0].splice(t[12][0].indexOf(a),1),t[12][0].splice(t[12][0].indexOf(g),1),n&&C(w),D&&D.d(n),n&&C(b),S=!1,r(E)}}}function Me(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S="fi"===t[6]?"Arvioin aistikuorman määrää":"How much sensory overload this causes?",E=t[0].title+"",R="fi"===t[6]?"Vähäinen":"Little",D="fi"===t[6]?"Suuri":"Very much";return{c(){e=I("p"),n=x(S),i=N(),s=I("label"),o=x(E),l=N(),u=I("input"),p=N(),f=I("div"),m=I("span"),g=x(R),v=N(),_=I("span"),y=x(D),O(e,"class","bold"),$(e,"margin","1rem 0"),$(e,"font-weight","500"),O(s,"class","r-label svelte-c67o1k"),O(s,"for",a=t[0].id),O(u,"type","range"),O(u,"class","range range-primary range-auto r-input svelte-c67o1k"),O(u,"step","5"),O(u,"id",c=t[0].id),O(u,"min","10"),O(u,"max","100"),u.disabled=h=t[7]||t[0].skip,u.readOnly=d=t[7]||t[0].skip,O(m,"class","svelte-c67o1k"),O(_,"class","svelte-c67o1k"),O(f,"class","range-info svelte-c67o1k")}
1,m(r,a){T(r,e,a),k(e,n),T(r,i,a),T(r,s,a),k(s,o),T(r,l,a),T(r,u,a),j(u,t[0].value),T(r,p,a),T(r,f,a),k(f,m),k(m,g),k(f,v),k(f,_),k(_,y),w||(b=[P(u,"change",t[14]),P(u,"input",t[14])],w=!0)},p(t,e){64&e&&S!==(S="fi"===t[6]?"Arvioin aistikuorman määrää":"How much sensory overload this causes?")&&A(n,S),1&e&&E!==(E=t[0].title+"")&&A(o,E),1&e&&a!==(a=t[0].id)&&O(s,"for",a),1&e&&c!==(c=t[0].id)&&O(u,"id",c),129&e&&h!==(h=t[7]||t[0].skip)&&(u.disabled=h),129&e&&d!==(d=t[7]||t[0].skip)&&(u.readOnly=d),1&e&&j(u,t[0].value),64&e&&R!==(R="fi"===t[6]?"Vähäinen":"Little")&&A(g,R),64&e&&D!==(D="fi"===t[6]?"Suuri":"Very much")&&A(y,D)},d(t){t&&C(e),t&&C(i),t&&C(s),t&&C(l),t&&C(u),t&&C(p),t&&C(f),w=!1,r(b)}}}function Le(t){let e,n,i,s,r,o,a,l;function u(t,e){return t[0].skip?qe:Fe}let c=u(t),h=c(t);return{c(){e=I("div"),n=I("label"),h.c(),s=N(),r=I("input"),O(n,"for",i="skip-id-"+t[0].id),$(n,"font-size","14px"),O(r,"id",o="skip-id-"+t[0].id),O(r,"type","checkbox"),O(r,"class","checkbox checkbox"),$(r,"margin-left",".5rem"),O(e,"class","skip-container svelte-c67o1k")},m(i,o){T(i,e,o),k(e,n),h.m(n,null),k(e,s),k(e,r),r.checked=t[0].skip,a||(l=P(r,"change",t[15]),a=!0)},p(t,e){c===(c=u(t))&&h?h.p(t,e):(h.d(1),h=c(t),h&&(h.c(),h.m(n,null))),1&e&&i!==(i="skip-id-"+t[0].id)&&O(n,"for",i),1&e&&o!==(o="skip-id-"+t[0].id)&&O(r,"id",o),1&e&&(r.checked=t[0].skip)},d(t){t&&C(e),h.d(),a=!1,l()}}}function Fe(t){let e,n="fi"===t[6]?"Ohita kysymys":"Skip question";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){64&i&&n!==(n="fi"===t[6]?"Ohita kysymys":"Skip question")&&A(e,n)},d(t){t&&C(e)}}}function qe(t){let e,n="fi"===t[6]?"Palauta kysymys":"Show question";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){64&i&&n!==(n="fi"===t[6]?"Palauta kysymys":"Show question")&&A(e,n)},d(t){t&&C(e)}}}function Ue(t){let e,n="fi"===t[6]?"Lisää muistiinpano +":"Add notes +";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){64&i&&n!==(n="fi"===t[6]?"Lisää muistiinpano +":"Add notes +")&&A(e,n)},d(t){t&&C(e)}}}function We(t){let e,n="fi"===t[6]?"Muokkaa muistiinpanoa":"Edit notes";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){64&i&&n!==(n="fi"===t[6]?"Muokkaa muistiinpanoa":"Edit notes")&&A(e,n)},d(t){t&&C(e)}}}function He(t){let e,n,i,s,r,o=t[1]===t[0].page&&$e(t);function a(e){t[17](e)}function l(e){t[18](e)}
1let u={title:t[0].title};return void 0!==t[4]&&(u.open=t[4]),void 0!==t[0].details&&(u.details=t[0].details),n=new je({props:u}),Q.push((()=>St(n,"open",a))),Q.push((()=>St(n,"details",l))),{c(){o&&o.c(),e=N(),It(n.$$.fragment)},m(t,i){o&&o.m(t,i),T(t,e,i),Et(n,t,i),r=!0},p(t,[r]){t[1]===t[0].page?o?o.p(t,r):(o=$e(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null);const a={};1&r&&(a.title=t[0].title),!i&&16&r&&(i=!0,a.open=t[4],rt((()=>i=!1))),!s&&1&r&&(s=!0,a.details=t[0].details,rt((()=>s=!1))),n.$set(a)},i(t){r||(vt(n.$$.fragment,t),r=!0)},o(t){_t(n.$$.fragment,t),r=!1},d(t){o&&o.d(t),t&&C(e),xt(n,t)}}}function ze(t,e,n){let i,s,r;d(t,oe,(t=>n(5,i=t))),d(t,ae,(t=>n(6,s=t))),d(t,re,(t=>n(7,r=t)));let{question:o={}}=e,{page:a=1}=e,{index:l}=e,u=0,c=!1,h=0===o.value?"no":"yes",p=!1;return t.$$set=t=>{"question"in t&&n(0,o=t.question),"page"in t&&n(1,a=t.page),"index"in t&&n(2,l=t.index)},t.$$.update=()=>{1537&t.$$.dirty&&(o.skip?(n(9,u=o.value),n(0,o.value=0,o),n(10,c=!0)):c&&!o.skip&&(n(0,o.value=u,o),n(10,c=!1)))},[o,a,l,h,p,i,s,r,function(){"no"===h?n(0,o.value=0,o):"yes"===h&&n(0,o.value=10,o)},u,c,function(){h=this.__value,n(3,h)},[[]],function(){h=this.__value,n(3,h)},function(){var t;o.value=""===(t=this.value)?null:+t,n(0,o),n(10,c),n(9,u)},function(){o.skip=this.checked,n(0,o),n(10,c),n(9,u)},()=>n(4,p=!0),function(t){p=t,n(4,p)},function(e){t.$$.not_equal(o.details,e)&&(o.details=e,n(0,o),n(10,c),n(9,u))}]}class Ve extends Rt{constructor(t){super(),Nt(this,t,ze,He,a,{question:0,page:1,index:2})}}function Be(e){let n,i,s;return{c(){n=E("svg"),i=E("path"),O(i,"stroke-linecap","round"),O(i,"stroke-linejoin","round"),O(i,"stroke-width","2"),O(i,"d","M9 5l7 7-7 7"),O(n,"xmlns","http://www.w3.org/2000/svg"),O(n,"fill","none"),O(n,"viewBox","0 0 24 24"),O(n,"class",s="inline-block w-6 h-6 ml-2 stroke-current "+("left"===e[0]?"left":"")+" svelte-16tp86g")},m(t,e){T(t,n,e),k(n,i)},p(t,[e]){1&e&&s!==(s="inline-block w-6 h-6 ml-2 stroke-current "+("left"===t[0]?"left":"")+" svelte-16tp86g")&&O(n,"class",s)},i:t,o:t,d(t){t&&C(n)}}}function Ke(t,e,n){let{direction:i="right"}=e;return t.$$set=t=>{"direction"in t&&n(0,i=t.direction)},[i]}class Ge extends Rt{constructor(t){super(),Nt(this,t,Ke,Be,a,{direction:0})}}function Ye(t){let e,n,i,s,r,o,a,l,u,c,h,d,p,f,m="fi"===t[1]?"Ohjeita kyselyn seuraavaan osioon":"Instructions for the next part of the survey",g="fi"===t[1]?"Jatka kyselyä":"Continue";return h=new Ge({}),{c(){e=I("div"),n=I("h3"),i=x(m),s=N(),r=I("p"),o=x(t[2]),a=N(),l=I("button"),u=x(g),c=N(),It(h.$$.fragment),O(r,"class","svelte-1wh33yv"),O(l,"class","btn btn-primary"),O(e,"class","info-container svelte-1wh33yv")},m(m,g){T(m,e,g),k(e,n),k(n,i),k(e,s),k(e,r),k(r,o),k(e,a),k(e,l),k(l,u),k(l,c),Et(h,l,null),d=!0,p||(f=P(l,"click",t[5]),p=!0)},p(t,[e]){(!d||2&e)&&m!==(m="fi"===t[1]?"Ohjeita kyselyn seuraavaan osioon":"Instructions for the next part of the survey")&&A(i,m),(!d||4&e)&&A(o,t[2]),(!d||2&e)&&g!==(g="fi"===t[1]?"Jatka kyselyä":"Continue")&&A(u,g)},i(t){d||(vt(h.$$.fragment,t),d=!0)},o(t){_t(h.$$.fragment,t),d=!1},d(t){t&&C(e),xt(h),p=!1,f()}}}function Je(t,e,n){let i;d(t,ae,(t=>n(1,i=t)));let{group:s}=e,{show:r}=e,o="fi"===i?Gt:Yt,a=o[s-1];K((()=>{window.scrollTo(0,0)}));return t.$$set=t=>{"group"in t&&n(3,s=t.group),"show"in t&&n(0,r=t.show)},t.$$.update=()=>{26&t.$$.dirty&&i&&(n(4,o="fi"===i?Gt:Yt),n(2,a=o[s-1]))},[r,i,a,s,o,()=>n(0,r=!1)]}class Qe extends Rt{constructor(t){super(),Nt(this,t,Je,Ye,a,{group:3,show:0})}}function Xe(t,e,n){const i=t.slice();return i[2]=e[n],i[4]=n,i}function Ze(t){let e,n,i,s,r=t[2].replace("Sense of ","")+"";return{c(){e=I("li"),n=x(r),i=N(),O(e,"class",s="step "+(t[0]>t[4]?"step-primary":"")+" svelte-1nwac5s")},m(t,s){T(t,e,s),k(e,n),k(e,i)},p(t,i){2&i&&r!==(r=t[2].replace("Sense of ","")+"")&&A(n,r),1&i&&s!==(s="step "+(t[0]>t[4]?"step-primary":"")+" svelte-1nwac5s")&&O(e,"class",s)},d(t){t&&C(e)}}}function tn(e){let n,i=e[1],s=[];for(let t=0;t<i.length;t+=1)s[t]=Ze(Xe(e,i,t));return{c(){n=I("ul");for(let t=0;t<s.length;t+=1)s[t].c();O(n,"class","w-full steps svelte-1nwac5s")},m(t,e){T(t,n,e);for(let t=0;t<s.length;t+=1)s[t].m(n,null)},p(t,[e]){if(3&e){let r;for(i=t[1],r=0;r<i.length;r+=1){const o=Xe(t,i,r);s[r]?s[r].p(o,e):(s[r]=Ze(o),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=i.length}},i:t,o:t,d(t){t&&C(n),S(s,t)}}}function en(t,e,n){let{step:i=1}=e,{stepTitles:s=[]}=e;return t.$$set=t=>{"step"in t&&n(0,i=t.step),"stepTitles"in t&&n(1,s=t.stepTitles)},[i,s]}class nn extends Rt{constructor(t){super(),Nt(this,t,en,tn,a,{step:0,stepTitles:1})}}function sn(t){let e,n,i,s,r,o;return{c(){e=I("div"),n=I("p"),i=x(t[1]),O(n,"class","svelte-51b75o"),O(e,"class","toast svelte-51b75o")},m(t,s){T(t,e,s),k(e,n),k(n,i),o=!0},p(t,e){(!o||2&e)&&A(i,t[1])},i(t){o||(st((()=>{r&&r.end(1),s=kt(e,de,{duration:200,y:50}),s.start()})),o=!0)},o(t){s&&s.invalidate(),r=wt(e,de,{duration:200,y:50}),o=!1},d(t){t&&C(e),t&&r&&r.end()}}}function rn(t){let e,n,i=t[0]&&sn(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&vt(i,1)):(i=sn(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function on(t,e,n){let{open:i=!1}=e,{text:s="Vain lukuoikeus"}=e;return t.$$set=t=>{"open"in t&&n(0,i=t.open),"text"in t&&n(1,s=t.text)},[i,s]}class an extends Rt{constructor(t){super(),Nt(this,t,on,rn,a,{open:0,text:1})}}function ln(e){let n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,j,$,D,M,L,F,q,U,W,H="fi"==e[3]?"Tallenna luonnos":"Save survey as draft",z="fi"==e[3]?"Lataa luonnos":"Upload survey",V="fi"==e[3]?"Tyhjennä valinnat":"Clear all answers",B="fi"==e[3]?"Siirry tulokseen":"To results";return{c(){n=I("ul"),i=I("li"),i.innerHTML="<span>Työkalut</span>
1",s=N(),o=I("li"),a=I("a"),l=I("i"),l.textContent="save",u=N(),c=x(H),h=N(),d=I("li"),p=I("a"),f=I("i"),f.textContent="upload",m=N(),g=x(z),y=N(),w=I("li"),b=I("a"),S=I("i"),S.textContent="clear",E=N(),R=x(V),j=N(),$=I("li"),D=I("a"),M=I("i"),M.textContent="bar_chart",L=N(),F=x(B),O(i,"class","menu-title"),O(l,"class","material-icons svelte-mnpep9"),O(a,"href","javascript:void(0)"),O(f,"class","material-icons svelte-mnpep9"),O(p,"disabled",v=!e[2]),O(p,"style",_=e[2]?"":"text-decoration: line-through;"),O(p,"href","javascript:void(0)"),O(S,"class","material-icons svelte-mnpep9"),O(b,"href","javascript:void(0)"),O(M,"class","material-icons svelte-mnpep9"),O(D,"href","/#/results-page"),O(n,"class","menu p-4 shadow-lg bg-base-100 rounded-box tools svelte-mnpep9")},m(t,r){T(t,n,r),k(n,i),k(n,s),k(n,o),k(o,a),k(a,l),k(a,u),k(a,c),k(n,h),k(n,d),k(d,p),k(p,f),k(p,m),k(p,g),k(n,y),k(n,w),k(w,b),k(b,S),k(b,E),k(b,R),k(n,j),k(n,$),k($,D),k(D,M),k(D,L),k(D,F),U||(W=[P(a,"click",e[5]),P(p,"click",e[6]),P(b,"click",e[4])],U=!0)},p(t,e){8&e&&H!==(H="fi"==t[3]?"Tallenna luonnos":"Save survey as draft")&&A(c,H),8&e&&z!==(z="fi"==t[3]?"Lataa luonnos":"Upload survey")&&A(g,z),4&e&&v!==(v=!t[2])&&O(p,"disabled",v),4&e&&_!==(_=t[2]?"":"text-decoration: line-through;")&&O(p,"style",_),8&e&&V!==(V="fi"==t[3]?"Tyhjennä valinnat":"Clear all answers")&&A(R,V),8&e&&B!==(B="fi"==t[3]?"Siirry tulokseen":"To results")&&A(F,B)},i(t){q||st((()=>{q=kt(n,he,{duration:200}),q.start()}))},o:t,d(t){t&&C(n),U=!1,r(W)}}}function un(e){let n,i,s,r,o,a,l,u,c=e[0]&&ln(e);return{c(){n=I("button"),i=E("svg"),s=E("path"),o=N(),c&&c.c(),a=R(),O(s,"stroke-linecap","round"),O(s,"stroke-linejoin","round"),O(s,"stroke-width","2"),O(s,"d","M6 18L18 6M6 6l12 12"),O(i,"xmlns","http://www.w3.org/2000/svg"),O(i,"fill","none"),O(i,"viewBox","0 0 24 24"),O(i,"class","inline-block w-6 h-6 stroke-current"),O(n,"class",r="btn btn-circle btn-lg open-btn "+(e[0]?"":"active")+" svelte-mnpep9")},m(t,r){T(t,n,r),k(n,i),k(i,s),e[8](n),T(t,o,r),c&&c.m(t,r),T(t,a,r),l||(u=P(n,"click",e[7]),l=!0)},p(t,[e]){1&e&&r!==(r="btn btn-circle btn-lg open-btn "+(t[0]?"":"active")+" svelte-mnpep9")&&O(n,"class",r),t[0]?c?(c.p(t,e),1&e&&vt(c,1)):(c=ln(t),c.c(),vt(c,1),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},i(t){vt(c)},o:t,d(t){t&&C(n),e[8](null),t&&C(o),c&&c.d(t),t&&C(a),l=!1,u()}}}function cn(t,e,n){let i,s,r;d(t,se,(t=>n(2,i=t))),d(t,ie,(t=>n(9,s=t))),d(t,ae,(t=>n(3,r=t)));let o,{open:a=!1}=e;function l(t){const{target:e}=t;e!==o&&e.parentNode!==o&&n(0,a=!1)}return t.$$set=t=>{"open"in t&&n(0,a=t.open)},t.$$.update=()=>{1&t.$$.dirty&&(a?document.body.addEventListener("click",l):document.body.removeEventListener("click",l))},[a,o,i,r,function(){confirm("Haluatko varmasti tyhjentää kaikki vastaukset?")&&p(ie,s=ue(s),s)},function(){ie.set(s),p(se,i=s,i)},function(){i&&(p(ie,s=i,s),p(se,i=null,i),localStorage.removeItem("craft"))},function(){n(0,a=!a)},function(t){Q[t?"unshift":"push"]((()=>{o=t,n(1,o)}))}]}class hn extends Rt{constructor(t){super(),Nt(this,t,cn,un,a,{open:0})}}function dn(t,e,n){const i=t.slice();return i[23]=e[n],i[25]=n,i}function pn(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,E,R,j,$,D=Lt[t[0]-1]+"",M=t[4][t[0]-1]+"",L=t[3][t[5]]+"",F="fi"===t[2]?"Edellinen":"Previous",q=t[8],U=[];for(let e=0;e<q.length;e+=1)U[e]=mn(dn(t,q,e));const W=t=>_t(U[t],1,1,(()=>{U[t]=null}));m=new Ge({props:{direction:"left"}});const H=[vn,gn],z=[];function V(t,e){return t[1]===t[9]-1?0:1}return b=V(t),E=z[b]=H[b](t),{c(){e=I("div"),n=I("h2"),i=I("i"),s=x(D),o=N(),a=x(M),l=N(),u=I("h3"),c=x(L),h=N();for(let t=0;t<U.length;t+=1)U[t].c();d=N(),p=I("div"),f=I("button"),It(m.$$.fragment),g=N(),v=x(F),y=N(),w=I("button"),E.c(),O(i,"class","material-icons large-icon"),O(f,"class","btn btn-outline btn-primary"),f.disabled=_=!(t[1]>1),O(w,"class","btn btn-primary"),O(p,"class","buttons"),O(e,"class","questions-container svelte-7kpni5")},m(r,_){T(r,e,_),k(e,n),k(n,i),k(i,s),k(n,o),k(n,a),k(e,l),k(e,u),k(u,c),k(e,h);for(let t=0;t<U.length;t+=1)U[t].m(e,null);k(e,d),k(e,p),k(p,f),Et(m,f,null),k(f,g),k(f,v),k(p,y),k(p,w),z[b].m(w,null),R=!0,j||($=[P(f,"click",t[12]),P(w,"click",t[11])],j=!0)},p(t,n){if((!R||1&n)&&D!==(D=Lt[t[0]-1]+"")&&A(s,D),(!R||17&n)&&M!==(M=t[4][t[0]-1]+"")&&A(a,M),(!R||40&n)&&L!==(L=t[3][t[5]]+"")&&A(c,L),1282&n){let i;for(q=t[8],i=0;i<q.length;i+=1){const s=dn(t,q,i);U[i]?(U[i].p(s,n),vt(U[i],1)):(U[i]=mn(s),U[i].c(),vt(U[i],1),U[i].m(e,d))}for(mt(),i=q.length;i<U.length;i+=1)W(i);gt()}(!R||4&n)&&F!==(F="fi"===t[2]?"Edellinen":"Previous")&&A(v,F),(!R||2&n&&_!==(_=!(t[1]>1)))&&(f.disabled=_);let i=b;b=V(t),b===i?z[b].p(t,n):(mt(),_t(z[i],1,1,(()=>{z[i]=null})),gt(),E=z[b],E?E.p(t,n):(E=z[b]=H[b](t),E.c()),vt(E,1),E.m(w,null))},i(t){if(!R){for(let t=0;t<q.length;t+=1)vt(U[t]);vt(m.$$.fragment,t),vt(E),R=!0}}
1,o(t){U=U.filter(Boolean);for(let t=0;t<U.length;t+=1)_t(U[t]);_t(m.$$.fragment,t),_t(E),R=!1},d(t){t&&C(e),S(U,t),xt(m),z[b].d(),j=!1,r($)}}}function fn(t){let e,n,i;function s(e){t[18](e)}let r={group:t[0]};return void 0!==t[6]&&(r.show=t[6]),e=new Qe({props:r}),Q.push((()=>St(e,"show",s))),{c(){It(e.$$.fragment)},m(t,n){Et(e,t,n),i=!0},p(t,i){const s={};1&i&&(s.group=t[0]),!n&&64&i&&(n=!0,s.show=t[6],rt((()=>n=!1))),e.$set(s)},i(t){i||(vt(e.$$.fragment,t),i=!0)},o(t){_t(e.$$.fragment,t),i=!1},d(t){xt(e,t)}}}function mn(t){let e,n,i,s,r,o=(t[23].page===t[1]?t[10](t[23].group):"")+"";function a(e){t[19](e)}let l={question:t[23],index:t[25]+1};return void 0!==t[1]&&(l.page=t[1]),i=new Ve({props:l}),Q.push((()=>St(i,"page",a))),{c(){e=x(o),n=N(),It(i.$$.fragment)},m(t,s){T(t,e,s),T(t,n,s),Et(i,t,s),r=!0},p(t,n){(!r||258&n)&&o!==(o=(t[23].page===t[1]?t[10](t[23].group):"")+"")&&A(e,o);const a={};256&n&&(a.question=t[23]),!s&&2&n&&(s=!0,a.page=t[1],rt((()=>s=!1))),i.$set(a)},i(t){r||(vt(i.$$.fragment,t),r=!0)},o(t){_t(i.$$.fragment,t),r=!1},d(t){t&&C(e),t&&C(n),xt(i,t)}}}function gn(t){let e,n,i,s,r="fi"===t[2]?"Seuraava":"Next";return i=new Ge({}),{c(){e=x(r),n=N(),It(i.$$.fragment)},m(t,r){T(t,e,r),T(t,n,r),Et(i,t,r),s=!0},p(t,n){(!s||4&n)&&r!==(r="fi"===t[2]?"Seuraava":"Next")&&A(e,r)},i(t){s||(vt(i.$$.fragment,t),s=!0)},o(t){_t(i.$$.fragment,t),s=!1},d(t){t&&C(e),t&&C(n),xt(i,t)}}}function vn(e){let n,i="fi"===e[2]?"Näytä tulokset":"Show results";return{c(){n=x(i)},m(t,e){T(t,n,e)},p(t,e){4&e&&i!==(i="fi"===t[2]?"Näytä tulokset":"Show results")&&A(n,i)},i:t,o:t,d(t){t&&C(n)}}}function _n(t){let e,n,i,s,r,o,a,l,u,c,h,d;function p(e){t[17](e)}let f={stepTitles:t[4]};void 0!==t[0]&&(f.step=t[0]),n=new nn({props:f}),Q.push((()=>St(n,"step",p)));const m=[fn,pn],g=[];function v(t,e){return t[6]?0:1}function _(e){t[20](e)}r=v(t),o=g[r]=m[r](t),l=new hn({});let y={};
1return void 0!==t[7]&&(y.open=t[7]),c=new an({props:y}),Q.push((()=>St(c,"open",_))),{c(){e=I("div"),It(n.$$.fragment),s=N(),o.c(),a=N(),It(l.$$.fragment),u=N(),It(c.$$.fragment),O(e,"class","container")},m(t,i){T(t,e,i),Et(n,e,null),k(e,s),g[r].m(e,null),T(t,a,i),Et(l,t,i),T(t,u,i),Et(c,t,i),d=!0},p(t,[s]){const a={};16&s&&(a.stepTitles=t[4]),!i&&1&s&&(i=!0,a.step=t[0],rt((()=>i=!1))),n.$set(a);let l=r;r=v(t),r===l?g[r].p(t,s):(mt(),_t(g[l],1,1,(()=>{g[l]=null})),gt(),o=g[r],o?o.p(t,s):(o=g[r]=m[r](t),o.c()),vt(o,1),o.m(e,null));const u={};!h&&128&s&&(h=!0,u.open=t[7],rt((()=>h=!1))),c.$set(u)},i(t){d||(vt(n.$$.fragment,t),vt(o),vt(l.$$.fragment,t),vt(c.$$.fragment,t),d=!0)},o(t){_t(n.$$.fragment,t),_t(o),_t(l.$$.fragment,t),_t(c.$$.fragment,t),d=!1},d(t){t&&C(e),xt(n),g[r].d(),t&&C(a),xt(l,t),t&&C(u),xt(c,t)}}}function yn(t,e,n){let i,s,r,o,a;d(t,_e,(t=>n(15,i=t))),d(t,ie,(t=>n(8,s=t))),d(t,se,(t=>n(16,r=t))),d(t,re,(t=>n(22,o=t))),d(t,ae,(t=>n(2,a=t)));let l,{params:u={}}=e,c=[],h=[],p=Wt.length,f=u.group?Number(u.group):1,m=u.page?Number(u.page):1,g=!1,v=o;return K((()=>{le("/form/4/16"===i?"#fff":$t[f-1])})),t.$$set=t=>{"params"in t&&n(13,u=t.params)},t.$$.update=()=>{if(4&t.$$.dirty&&a&&(n(3,c="fi"===a?Wt:Ht),n(4,h="fi"===a?Dt:Mt)),16387&t.$$.dirty&&m){let t=Kt.findIndex((t=>t.group===f));Kt[t].isShowed||(n(14,Kt[t].isShowed=!0,Kt),n(6,g=!0))}2&t.$$.dirty&&n(5,l=m-1),t.$$.dirty,2&t.$$.dirty&&m===p&&ke("/results-info"),32769&t.$$.dirty&&f>=1&&document.body&&le("/form/4/16"===i?"#fff":$t[f-1])},[f,m,a,c,h,l,g,v,s,p,function(t){return n(0,f=t),""},function(){n(1,m+=1),ie.set(s),ke(`/form/${f}/${m}`),window.scrollTo(0,0)},function(){n(1,m-=1),ie.set(s),ke(`/form/${f}/${m}`)},u,Kt,i,r,function(t){f=t,n(0,f)},function(t){g=t,n(6,g),n(1,m),n(14,Kt),n(0,f)},function(t){m=t,n(1,m)},function(t){v=t,n(7,v)}]}class kn extends Rt{constructor(t){super(),Nt(this,t,yn,_n,a,{params:13})}}function wn(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,j,$;return{c(){e=I("div"),n=I("button"),n.textContent="X",i=N(),s=I("h2"),s.textContent="Avaa ladattu tiedosto",o=N(),a=I("p"),l=x("Tiedoston nimi: "),u=x(t[1]),c=N(),h=I("select"),d=I("option"),d.textContent="Valitse käyttöoikeudet",p=I("option"),p.textContent="Katselu",f=I("option"),f.textContent="Katselu ja muokkaus",m=N(),g=I("div"),v=I("button"),v.textContent="Peruuta",_=N(),y=I("button"),w=x("Avaa kysely"),O(n,"class","close-btn svelte-t56cgw"),O(s,"class","svelte-t56cgw"),d.disabled="disabled",d.__value="Valitse käyttöoikeudet",d.value=d.__value,p.__value="read",p.value=p.__value,f.__value="modify",f.value=f.__value,O(h,"class","select select-bordered w-full max-w-xs svelte-t56cgw"),void 0===t[2]&&st((()=>t[5].call(h))),O(v,"class","btn"),O(y,"class","btn btn-primary"),y.disabled=b="read"!==t[2]&&"modify"!==t[2],O(g,"class","action svelte-t56cgw"),O(e,"class","svelte-modal svelte-t56cgw")},m(r,b){T(r,e,b),k(e,n),k(e,i),k(e,s),k(e,o),k(e,a),k(a,l),k(a,u),k(e,c),k(e,h),k(h,d),k(h,p),k(h,f),D(h,t[2]),k(e,m),k(e,g),k(g,v),k(g,_),k(g,y),k(y,w),R=!0,j||($=[P(n,"click",t[3]),P(h,"change",t[5]),P(v,"click",t[3]),P(y,"click",t[6])],j=!0)},p(t,e){(!R||2&e)&&A(u,t[1]),4&e&&D(h,t[2]),(!R||4&e&&b!==(b="read"!==t[2]&&"modify"!==t[2]))&&(y.disabled=b)},i(t){R||(st((()=>{E&&E.end(1),S=kt(e,de,{duration:200,y:200}),S.start()})),R=!0)},o(t){S&&S.invalidate(),E=wt(e,he,{duration:200}),R=!1},d(t){t&&C(e),t&&E&&E.end(),j=!1,r($)}}}function bn(t){let e,n,i=t[0]&&wn(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&vt(i,1)):(i=wn(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function Tn(t,e,n){let i,s;d(t,re,(t=>n(4,i=t))),d(t,ie,(t=>n(7,s=t)));let r,{open:o=!1}=e,{fileName:a=""}=e;return t.$$set=t=>{"open"in t&&n(0,o=t.open),"fileName"in t&&n(1,a=t.fileName)},t.$$.update=()=>{4&t.$$.dirty&&p(re,i="read"===r,i),16&t.$$.dirty&&i&&console.log("Vain luku")},[o,a,r,function(){p(ie,s=zt,s),n(0,o=!1)},i,function(){r=M(this),n(2,r)},()=>ke("/form/1/1")]}class Cn extends Rt{constructor(t){super(),Nt(this,t,Tn,bn,a,{open:0,fileName:1})}}const Sn='        \n<h3 style="margin-top: 2rem;">
1Tervetuloa kartoittamaan tilojen aistiesteettömyyttä</h3>\n<p>\n    Aistiesteettömyydessä ollaan kiinnostuneita siitä, miten miellyttävä ja toimiva ympäristö on aistien näkökulmasta.\n    Aistiesteettömyydessä arvioidaan, millainen ympäristö kuormittaa käyttäjiään tai vastaavasti auttaa palautumaan.\n    Aistiesteettömät ratkaisut auttavat kaikkia, ja osalle ne ovat sujuvan arjen kannalta välttämättömiä. Hienoa, että haluat\n    edistää ympäristön aistiesteettömyyttä!\n\n    <br /><br />\n    <a href="https://lasten-aistiesteettomyys.web.app/" style="color: blue; font-weight: 500;">\n        Siirry lasten versioon\n    </a>\n</p>\n<h4>Näin pääset alkuun:</h4>\n<div>\n    <ul>\n        <li>Valitse aluksi tila tai tilat, joita haluat kartoittaa aistien näkökulmasta </li>\n        <li>Paina alta Aloita kartoitus</li>\n        <li>Sen jälkeen sovellus ohjaa sinua eteenpäin</li>\n    </ul>\n    <p>\n        <b>Huom!</b> Kaikki kysymykset on mahdollista ohittaa valitsemalla Ohita kysymys, \n        jolloin ne eivät vaikuta kartoituksen tulokseen. Ominaisuutta voit käyttää, mikäli \n        kysymys ei kosketa kartoittamaasi tilaa tai ei muutoin sovellus siihen.\n    </p>\n</div>\n\n<p style="font-size: 16px;">\n    <i class="material-icons info-icon">info</i>\n    Voit tarkastella ja/tai muokata laitteellesi tallennettua kartoitusta painamalla alla olevaa Lataa-painiketta.\n</p>\n',In='\n<h3 style="margin-top: 2rem;">Welcome to survey the sensory accessibility of spaces</h3>\n<p>\n    In sensory accessibility, we are interested in how pleasant and functional the environment is from a sensory point of view. \n    Sensory accessibility assesses what kind of environment puts a strain on its users or, conversely, helps them recover. \n    Sensory accessible solutions help everybody, and for some, they are essential for a fluent everyday life. \n    Great that you want to promote the sensory accessibility of environments! \n\n    <br /><br />\n    <a href="https://lasten-aistiesteettomyys.web.app/" style="color: blue; font-weight: 500;">\n        Children\'s version\n    </a>\n</p>\n<h4>Here is how to get started:</h4>\n<div>\n    <ul>\n        <li>Start by selecting a space or spaces   that you want to survey from the sensory accessibility point of view</li>\n        <li>Click on Start the survey below</li>\n        <li>The application will then lead you forward in the survey</li>\n    </ul>\n    <p>\n        <b>NB:</b>
1 All questions can be skipped by selecting Skip question, in which case they do not influence the result \n        of the survey. You can use this feature if the question does not apply to the space you are surveying or is otherwise \n        not applicable.\n    </p>\n</div>\n\n<p style="font-size: 16px;">\n    <i class="material-icons info-icon">info</i>\n    You can view and/or edit the survey saved on your device by clicking <i>Upload</i> button below.\n</p>\n';function En(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,j,D,M,L,q,U,W,H="fi"==t[0]?"Lataa":"Upload",z="fi"==t[0]?"Aloita kartoitus":"Start survey",V="fi"==t[0]?"Anna palautetta":"Feedback";function B(e){t[4](e)}let K={};return void 0!==t[2]&&(K.open=t[2]),M=new Cn({props:K}),Q.push((()=>St(M,"open",B))),{c(){e=I("div"),n=I("div"),i=I("div"),i.innerHTML='<img class="logo svelte-1602ixq" src="eu-logo.png" alt="Vipuvoimaa EU:lta logo"/> \n            <img class="logo svelte-1602ixq" src="eu-logo2.png" alt="Eu-logo"/>',s=N(),o=new F,a=N(),l=I("div"),u=I("input"),c=N(),h=I("button"),d=I("i"),d.textContent="upload",p=N(),f=x(H),m=N(),g=I("a"),v=I("i"),v.textContent="poll",_=N(),y=x(z),w=N(),b=I("div"),S=I("a"),E=I("i"),E.textContent="feedback",R=N(),j=x(V),D=N(),It(M.$$.fragment),O(i,"class","logos svelte-1602ixq"),o.a=a,O(u,"type","file"),u.hidden=!0,O(u,"id","upload"),O(d,"class","material-icons btn-icon"),O(h,"class","btn btn-primary btn-outline"),O(v,"class","material-icons btn-icon"),O(g,"class","btn btn-primary"),O(g,"type","button"),O(g,"href","/#/form/1/1"),O(l,"class","button"),O(E,"class","material-icons"),$(E,"margin-right","0.5rem"),O(S,"class","btn btn-success"),O(S,"type","button"),O(S,"href","https://elomake.samk.fi/lomakkeet/12540/lomake.html"),O(S,"target","_blank"),O(b,"class","button"),$(b,"margin-top","1.5rem"),O(n,"class","main-text-container"),O(e,"class","container")},m(r,C){T(r,e,C),k(e,n),k(n,i),k(n,s),o.m(t[1],n),k(n,a),k(n,l),k(l,u),k(l,c),k(l,h),k(h,d),k(h,p),k(h,f),k(l,m),k(l,g),k(g,v),k(g,_),k(g,y),k(n,w),k(n,b),k(b,S),k(S,E),k(S,R),k(S,j),T(r,D,C),Et(M,r,C),q=!0,U||(W=[P(u,"change",t[3]),P(h,"click",xn)],U=!0)},p(t,[e]){(!q||2&e)&&o.p(t[1]),(!q||1&e)&&H!==(H="fi"==t[0]?"Lataa":"Upload")&&A(f,H),(!q||1&e)&&z!==(z="fi"==t[0]?"Aloita kartoitus":"Start survey")&&A(y,z),(!q||1&e)&&V!==(V="fi"==t[0]?"Anna palautetta":"Feedback")&&A(j,V);const n={};!L&&4&e&&(L=!0,n.open=t[2],rt((()=>L=!1))),M.$set(n)},i(t){q||(vt(M.$$.fragment,t),q=!0)},o(t){_t(M.$$.fragment,t),q=!1},d(t){t&&C(e),t&&C(D),xt(M,t),U=!1,r(W)}
1}}function xn(){document.getElementById("upload").click()}function Nn(t,e,n){let i,s;d(t,ie,(t=>n(6,i=t))),d(t,ae,(t=>n(0,s=t)));let r="en"===s?In:Sn,o=!1;return K((()=>{le("#fffff"),window.scrollTo(0,0)})),t.$$.update=()=>{1&t.$$.dirty&&s&&n(1,r="en"===s?In:Sn)},[s,r,o,function(t){const e=t.target.files[0]?t.target.files[0]:null;if(!e)return;const s=new FileReader;s.onload=function(t){console.log(t);const e=JSON.parse(t.target.result);p(ie,i=e,i),n(2,o=!0)},s.readAsText(e)},function(t){o=t,n(2,o)}]}class Rn extends Rt{constructor(t){super(),Nt(this,t,Nn,En,a,{})}}var Pn=[{title:"Kuuloaistiin liittyvät aistiärsykkeet ",paragraph:"Lähde ja lisätietoa: Aistiesteettömät asumisratkaisut. Koti, jossa on hyvä olla. Saatavissa <a href='https://urn.fi/URN:NBN:fi-fe2019090226330' class='info-link' target='_blank'>täältä</a>",lists:[{title:"",data:["Äänimaailmaa ja tilan akustiikkaa suunnitellessa materiaalivalinnoilla on suuri merkitys. Tasaiset, kovat pinnat heijastavat ääntä, joten niitä tulisi mahdollisuuksien mukaan välttää. Haastavaa on, että laajimmissa pinnoissa kuten lattioissa, seinissä ja katossa käytetään useimmiten juuri tällaisia tasaisia ja kovia pintamateriaaleja. Oikein muotoiltuna ja hyvällä suunnittelulla pinnat kuitenkin saadaan toimimaan kohtalaisen hyvin ääntä hajottavina materiaaleina.","Kalusteiden materiaalivalinnoilla, muotoilulla ja sijoittelulla voidaan edistää olennaisesti tilan miellyttävää akustiikkaa. Hyvä huoneakustiikka muodostetaan tiloissa pääsääntöisesti eri vaimennusmateriaaleilla (kalusteet ja tekstiilit). Materiaalien akustisia ominaisuuksia tarkastellaan niiden absorptiosuhteella, joka ilmaisee materiaalin pinnan kykyä sitoa ääntä. Mitä korkeampi arvo, sitä enemmän materiaali vaimentaa ääniä.","-\tAkustisesti miellyttävässä tilassa tulisi yhdistellä absorptiosuhteeltaan eriarvoisia materiaaleja. Myös materiaalien paksuus vaikuttaa siihen minkälaisia ääniä materiaali vaimentaa. Korkeiden äänien vaimentamiseen riittävät usein ohuetkin materiaalit, kun taas paksut, huokoiset tai rei’itetyt materiaalit vaimentavat erityisen hyvin matalia ääniä."]}]},{title:"Näköaistiin liittyvät aistiärsykkeet ",paragraph:"Lähde ja lisätietoa: Aistiesteettömät asumisratkaisut. Koti, jossa on hyvä olla. Saatavissa <a href='https://urn.fi/URN:NBN:fi-fe2019090226330' class='info-link' target='_blank'>täältä</a> ",lists:[{title:"Valaistus",data:["Ihminen saa valtaosan kaikesta aistitiedosta näköaistinsa kautta. Näin visuaaliset tekijät, kuten vääränlainen valaistus, aiheuttaa aistiherkälle yksilölle helposti kuormitusta. Tällä perusteella valaistus tulee aistiesteettömässä suunnittelussa suunnitella erityisen huolellisesti.","Optimaalinen yleisvalaistus on voimakkuudeltaan riittävä, värilämpötilaltaan neutraali ja valaisee koko tilan tasaisesti jättämättä tilaan suuria kontrastieroja.","Yleisvalaistuksessa valaisimissa voidaan käyttää niin suoraa kuin epäsuoraa valonlähdettä, mutta aistiesteettömässä suunnittelussa kuitenkin suositaan lähtökohtaisesti epäsuoraa valoa. Epäsuoraa valoa tuottavassa valaisimessa valonlähde on piilotettu, eikä se näin ollen aiheuta häiritsevää ja epämiellyttävää häikäisyä."]},{title:"Väritys, kuosit ja vihersisustus",data:["Aistiesteettömyydessä vältetään kokovalkoista sisustusta. Valkoinen tila on heikosti hahmotettava, ja antaa käyttäjällensä näköaistin välityksellä varsin yksitoikkoisen aistikokemuksen. Aistiesteettömässä tilassa suositaan asteittain ylöspäin vaalenevaa väritystä, jossa lattia on asteen tummempi, seinät keskiväriset ja katto vaalea. Tällainen väritys tukee tilan hahmotettavuutta.","Aistiesteettömän tilan värimaailma on harmoninen, selkeä ja johdonmukainen. Väreissä suositaan luonnonläheisiä, murrettuja tai pastellisia sävyjä. Tämänlainen värimaailma luo seesteisen ja rauhoittavan kokonaisuuden.","Värien ohella merkityksellisiä ovat kontrastit. Kontrastieroilla voidaan kätevästi lisätä tilan eri toimintojen hahmotettavuutta, kun eri objektit ja elementit saadaan esimerkiksi erottumaan helpommin taustastaan.","Kovin voimakkaat kuviot voivat aiheuttaa sekavan ja kaaosmaisen vaikutelman ja näin kuormittaa aisteja. Maltilla valittuina ja käytettynä erilaiset kuosit kuitenkin luovat miellyttäviä ja tarpeellisia virikkeitä.","Sisälle tuoduilla viherkasveilla on todettu olevan lukuisia positiivisia terveysvaikutuksia. Viheraltistus aktivoi parasympaattista hermostoamme, alentaa verenpainetta ja sydämensykettä, lievittää lihasjännitystä sekä kivun tuntemusta ja näin ollen myös stressitasojamme."]},{title:"Toimiva pohjaratkaisu ja kalusteiden sijoittelu",data:["Aistiesteettömyyden kannalta on selkeä ja johdonmukainen pohjaratkaisu on tärkeä.","Kalusteille on hyvä jättää tilaa ”hengittää”. Liian a
1htaasti kalustettu tila voi luoda kaaosmaisen vaikutelman. Kalusteiden sijoittelulla luotu hyvä tasapaino tilassa edesauttaa rauhoittavan ja selkeän tunnelman luomisessa.","Toisinaan tilaa on mielekästä jakaa pienempiin osiin. Apuna tilan jakamisessa voidaan käyttää esimerkiksi hyllyköitä, sermejä ja seinäkkeitä, sohvia, mattoja, verhoja ja kasveja. Kalusteilla tilaa rajattaessa on tärkeää kuitenkin huomioida esteettömät kulkuväylät sekä tilan kokonaisvaltainen toimivuus."]}]},{title:"Tuntoaistiin liittyvät aistiärsykkeet",paragraph:"Lähde ja lisätietoa: Aistiesteettömät asumisratkaisut. Koti, jossa on hyvä olla. Saatavissa <a href='https://urn.fi/URN:NBN:fi-fe2019090226330' class='info-link' target='_blank'>täältä</a>",lists:[{title:"",data:["Aistiesteettömän tilan materiaalivalinnoissa suositaan luonnonmateriaaleja. Tutkimusten mukaan sisätiloissa hyödynnetyt luonnonmateriaalit alentavat stressitasoja ja näin tukevat yksilöä stressin säätelyssä.","Luonnonmateriaaleista puu on moninaisten myönteisten ominaisuuksiensa vuoksi hyvä valinta aistiystävällisiä materiaaleja pohdittaessa. Puu on myös antibakteerinen materiaali ja sen työstö- ja käsittelymahdollisuudet ovat lähestulkoon rajattomat. Puu sopii siis hyvin monipuolisesti eri käyttökohteisiin ja tiloihin, niin kalusteissa kuin sisäpintojenkin verhoilussa. Vastaavasti tutkimusten mukaan kovien tai keinotekoisten materiaalien, kuten muovin tai alumiinin, koskettaminen luo kehoon jopa lievän stressirektion.","Tuntoaistiin liittyy kiinteästi myös kalustevalinnat. Kalusteen käyttömukavuudesta puhuttaessa korostuvat etenkin materiaalivalinnat, muotoilu ja mitoitus. Mitä taas kalusteiden muotokieleen tulee, aistiesteettömissä tiloissa vältetään mahdollisuuksien mukaan teräviä kulmia sekä liiallista suoraviivaista muotoilua.","Fysikaalisista tekijöistä lämpötila on tutkimusten mukaan sisäilman tärkein viihtyvyystekijä. Lämpötilojen kokeminen on yksilöllistä, mutta tutkimusten mukaan keskimäärin parhaiten tilassa viihdytään, kun lämpötila on asuinhuoneistossa 21– 22 °C: välillä. Lämpötilaan vaikuttaa olennaisena tekijänä myös vetoisuus. ","Toisinaan tilojen muunneltavuus on tärkeää. Parhaimmillaan käyttäjä voi itse säädellä omaa reviiriään eli sitä, miten lähelle muita hän haluaa mennä tai miten paljon omaa tilaa hän kaipaa ympärilleen. "]}]},{title:"Hajuaistiin liittyvät aistiärsykkeet",paragraph:"Lähde ja lisätietoa: Aistiesteettömät asumisratkaisut. Koti, jossa on hyvä olla. Saatavissa <a href='https://urn.fi/URN:NBN:fi-fe2019090226330' class='info-link' target='_blank'>täältä</a> ",lists:[{title:"",data:["Materiaaleja valitessa on syytä ottaa huomioon, että tuotteet täyttävät vaaditut allergianäkökulmat sekä sosiaali- ja terveysministeriön asumisterveysasetusten mukaiset rajat, eivätkä aiheuta haju- tai muuta ärsytyshaittaa tilankäyttäjille. Aististeettömässä suunnittelussa tuoksumaailma tulisi pitää mahdollisimman mietona ja miellyttävänä.","Sisätilojen voimakkaimmat tuoksut ja hajut ovat useimmiten lähtöisin keittiöstä, vessasta, viemäristöstä, kotieläimistä, tupakoinnista, siivousvälineistä ja -aineista sekä erilaisista tekstiileistä ja pintamateriaaleista. Hajuja ja tuoksuja on lähes mahdoton välttää kokonaan, mutta jo usein tyydyttävään lopputulokseen päästään pitämällä huolta asuintilojen siisteydestä ja hygieniasta. Tärkeintä on siis lähtökohtaisesti selvittää hajunlähde ja toimia sen poistamiseksi","Rakennus- ja sisustusmateriaalit sekä huonekalut ovat yleisimpiä epäpuhtauksien ja hajujen päästölähteitä. Tuotteiden materiaalipäästöt koostuvat pääasiassa valmistusprosessin reaktio- ja hajoamistuotteista sekä liuotin- ja raaka-ainejäämistä","Tuoksu- ja hajutekijöissä tulee myös huomioida, etteivät kaikki yksilöt koe niitä kuormittaviksi eivätkä kaikki hajut ole suinkaan vain negatiivisia. Keskimäärin miellyttävimmiksi on koettu etenkin erilaiset luonnosta lähtöisin ovat tuoksut."]}]}];function On(t,e,n){const i=t.slice();return i[2]=e[n],i}function An(t,e,n){const i=t.slice();return i[5]=e[n],i}function jn(t){let e,n,i=t[5]+"";return{c(){e=I("li"),n=x(i),O(e,"class","svelte-1q3fs93")},m(t,i){T(t,e,i),k(e,n)},p(t,e){1&e&&i!==(i=t[5]+"")&&A(n,i)},d(t){t&&C(e)}}}function $n(t){let e,n,i,s,r=t[2].title+"",o=t[2].data,a=[];for(let e=0;e<o.length;e+=1)a[e]=jn(An(t,o,e));return{c(){e=I("h3"),n=x(r),i=N(),s=I("ul");for(let t=0;t<a.length;t+=1)a[t].c();O(s,"class","svelte-1q3fs93")}
1,m(t,r){T(t,e,r),k(e,n),T(t,i,r),T(t,s,r);for(let t=0;t<a.length;t+=1)a[t].m(s,null)},p(t,e){if(1&e&&r!==(r=t[2].title+"")&&A(n,r),1&e){let n;for(o=t[2].data,n=0;n<o.length;n+=1){const i=An(t,o,n);a[n]?a[n].p(i,e):(a[n]=jn(i),a[n].c(),a[n].m(s,null))}for(;n<a.length;n+=1)a[n].d(1);a.length=o.length}},d(t){t&&C(e),t&&C(i),t&&C(s),S(a,t)}}}function Dn(e){let n,i,s,r,o,a,l,u,c=Pn[e[0]].title+"",h=Pn[e[0]].paragraph+"",d=Pn[e[0]].lists,p=[];for(let t=0;t<d.length;t+=1)p[t]=$n(On(e,d,t));return{c(){n=I("div"),i=I("h2"),s=x(c),r=N();for(let t=0;t<p.length;t+=1)p[t].c();o=N(),a=I("p"),l=N(),u=I("a"),u.textContent="Palaa tuloksiin",O(a,"class","svelte-1q3fs93"),O(u,"href","/#/results-page"),O(u,"class","btn btn-primary btn-outlined"),O(n,"class","info-container svelte-1q3fs93")},m(t,e){T(t,n,e),k(n,i),k(i,s),k(n,r);for(let t=0;t<p.length;t+=1)p[t].m(n,null);k(n,o),k(n,a),a.innerHTML=h,k(n,l),k(n,u)},p(t,[e]){if(1&e&&c!==(c=Pn[t[0]].title+"")&&A(s,c),1&e){let i;for(d=Pn[t[0]].lists,i=0;i<d.length;i+=1){const s=On(t,d,i);p[i]?p[i].p(s,e):(p[i]=$n(s),p[i].c(),p[i].m(n,o))}for(;i<p.length;i+=1)p[i].d(1);p.length=d.length}1&e&&h!==(h=Pn[t[0]].paragraph+"")&&(a.innerHTML=h)},i:t,o:t,d(t){t&&C(n),S(p,t)}}}function Mn(t,e,n){let i;d(t,_e,(t=>n(1,i=t)));let s=0;return K((()=>{le("#fff"),window.scrollTo(0,0)})),t.$$.update=()=>{2&t.$$.dirty&&i&&n(0,s=function(t){const e=t.replace("/info/",""),n=Number(e);return console.log("dataindex",n),isNaN(n)?0:n}(i))},[s,i]}class Ln extends Rt{constructor(t){super(),Nt(this,t,Mn,Dn,a,{})}}function Fn(t,e,n){const i=t.slice();return i[9]=e[n],i[11]=n,i}function qn(t){let e,n,i,s,r,o,a,l,u,c,h,d=t[11]+1+"",p=t[9].value+"";function f(t,e){return t[9].isFull?Wn:Un}let m=f(t),g=m(t),v=t[9].details&&Hn(t);return{c(){e=I("div"),n=I("p"),i=x(d),s=x(".\r\n                    "),g.c(),r=x("\r\n                    ("),o=x(p),a=x("/100)"),l=N(),u=I("progress"),h=N(),v&&v.c(),u.value=c=t[9].value||3,O(u,"min","3"),O(u,"max","100"),O(u,"class","progress width svelte-1fvcwxg"),$(u,"--progress-color",t[5](t[9].value)),O(e,"class","progress-item svelte-1fvcwxg")},m(t,c){T(t,e,c),k(e,n),k(n,i),k(n,s),g.m(n,null),k(n,r),k(n,o),k(n,a),k(e,l),k(e,u),k(e,h),v&&v.m(e,null)},p(t,i){m===(m=f(t))&&g?g.p(t,i):(g.d(1),g=m(t),g&&(g.c(),g.m(n,r))),2&i&&p!==(p=t[9].value+"")&&A(o,p),2&i&&c!==(c=t[9].value||3)&&(u.value=c),2&i&&$(u,"--progress-color",t[5](t[9].value)),t[9].details?v?v.p(t,i):(v=Hn(t),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},d(t){t&&C(e),g.d(),v&&v.d()}}}function Un(t){let e,n,i,s=t[3][t[9].page].replace("...","")+"",r=t[9].title.toLowerCase()+"";return{c(){e=x(s),n=N(),i=x(r)},m(t,s){T(t,e,s),T(t,n,s),T(t,i,s)},p(t,n){10&n&&s!==(s=t[3][t[9].page].replace("...","")+"")&&A(e,s),2&n&&r!==(r=t[9].title.toLowerCase()+"")&&A(i,r)},d(t){t&&C(e),t&&C(n),t&&C(i)}}}function Wn(t){let e,n=t[9].title+"";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){2&i&&n!==(n=t[9].title+"")&&A(e,n)},d(t){t&&C(e)}}}function Hn(t){let e,n,i,s,r,o,a,l,u="fi"===t[2]?"Muistiinpanot":"Notes",c=t[9].details+"";return{c(){e=I("div"),n=I("b"),i=x(u),s=N(),r=I("br"),o=N(),a=I("p"),l=x(c),$(e,"margin-top","1rem")},m(t,u){T(t,e,u),k(e,n),k(n,i),k(e,s),k(e,r),k(e,o),k(e,a),k(a,l)},p(t,e){4&e&&u!==(u="fi"===t[2]?"Muistiinpanot":"Notes")&&A(i,u),2&e&&c!==(c=t[9].details+"")&&A(l,c)},d(t){t&&C(e)}}}function zn(t){let e,n=!t[9].skip&&qn(t);return{c(){n&&n.c(),e=R()},m(t,i){n&&n.m(t,i),T(t,e,i)},p(t,i){t[9].skip?n&&(n.d(1),n=null):n?n.p(t,i):(n=qn(t),n.c(),n.m(e.parentNode,e))},d(t){n&&n.d(t),t&&C(e)}}}function Vn(e){let n,i,s,r,o,a,l,u,c,h="fi"===e[2]?"Kaikki vastaukset kategoriasta":"All answers from category",d=e[4][e[0]].toLowerCase()+"",p="fi"===e[2]?"Palaa yhteenvetoon":"Back to overall points",f=e[1],m=[];for(let t=0;t<f.length;t+=1)m[t]=zn(Fn(e,f,t));return{c(){n=I("div"),i=I("h2"),s=x(h),r=N(),o=x(d),a=N();for(let t=0;t<m.length;t+=1)m[t].c();l=N(),u=I("a"),c=x(p),O(u,"href","/#/results-page"),O(u,"class","btn btn-primary"),O(n,"class","progress-container svelte-1fvcwxg")},m(t,e){T(t,n,e),k(n,i),k(i,s),k(i,r),k(i,o),k(n,a);for(let t=0;t<m.length;t+=1)m[t].m(n,null);k(n,l),k(n,u),k(u,c)},p(t,[e]){if(4&e&&h!==(h="fi"===t[2]?"Kaikki vastaukset kategoriasta":"All answers from category")&&A(s,h),17&e&&d!==(d=t[4][t[0]].toLowerCase()+"")&&A(
1o,d),46&e){let i;for(f=t[1],i=0;i<f.length;i+=1){const s=Fn(t,f,i);m[i]?m[i].p(s,e):(m[i]=zn(s),m[i].c(),m[i].m(n,l))}for(;i<m.length;i+=1)m[i].d(1);m.length=f.length}4&e&&p!==(p="fi"===t[2]?"Palaa yhteenvetoon":"Back to overall points")&&A(c,p)},i:t,o:t,d(t){t&&C(n),S(m,t)}}}function Bn(t,e,n){let i,s,r;d(t,ie,(t=>n(7,i=t))),d(t,_e,(t=>n(8,s=t))),d(t,ae,(t=>n(2,r=t)));let{params:o={}}=e,a="fi"===r?Wt:Ht,l="fi"===r?Dt:Mt,{group:u}=o,c=i.filter((t=>t.group===Number(u)+1));return c.sort(((t,e)=>e.value-t.value)),K((()=>{window.scrollTo(0,0)})),t.$$set=t=>{"params"in t&&n(6,o=t.params)},t.$$.update=()=>{4&t.$$.dirty&&r&&(n(3,a="fi"===r?Wt:Ht),n(4,l="fi"===r?Dt:Mt)),451&t.$$.dirty&&s&&(n(0,u=o.group),n(1,c=i.filter((t=>t.group===Number(u)+1))),c.sort(((t,e)=>e.value-t.value)))},[u,c,r,a,l,function(t){let e="red";return 0!==t&&(t/=100),(t=1-t)<=Ft?e="rgb(255, 51, 51)":t>Ft&&t<qt?e="rgb(255, 170, 51)":t>=qt&&t<Ut?e="rgb(255, 235, 0)":t>=Ut&&(e="rgb(0, 204, 102)"),e},o,i,s]}class Kn extends Rt{constructor(t){super(),Nt(this,t,Bn,Vn,a,{params:6})}}function Gn(t){let e,n,i,s,r,o,a;return{c(){e=I("h3"),e.textContent="Combined effect",n=N(),i=I("p"),i.textContent="Now, at the end of the survey, assess the sensory environment as a whole. Reflect and discuss with other users of the space:",s=N(),r=I("ul"),r.innerHTML='<li class="svelte-3l21uc">What is pleasant and functional from the sensory point of view?</li> \n            <li class="svelte-3l21uc">Is there a quiet space in the assessed site where it is possible to retreat if the sensory load becomes too great – or would there be need for such a space?</li> \n            <li class="svelte-3l21uc">What is the combined effect of the sensory stimuli from the space (note the cumulative effect of the sensory stimuli)?</li>',o=N(),a=I("a"),a.textContent="Show results",$(e,"margin-top","2rem"),O(r,"class","svelte-3l21uc"),O(a,"href","/#/results-page"),O(a,"class","btn btn-primary btn-outlined")},m(t,l){T(t,e,l),T(t,n,l),T(t,i,l),T(t,s,l),T(t,r,l),T(t,o,l),T(t,a,l)},d(t){t&&C(e),t&&C(n),t&&C(i),t&&C(s),t&&C(r),t&&C(o),t&&C(a)}}}function Yn(t){let e,n,i,s,r,o,a;return{c(){e=I("h3"),e.textContent="Yhteisvaikutus",n=N(),i=I("p"),i.textContent="Arvioi vielä kartoituksen päätteeksi aistiympäristöä\r\n            kokonaisuutena. Pohdi ja keskustele muiden tilan\r\n            käyttäjien kanssa:",s=N(),r=I("ul"),r.innerHTML='<li class="svelte-3l21uc">Mikä tiloissa on aistien näkökulmasta\n                miellyttävää ja toimivaa?</li> \n            <li class="svelte-3l21uc">Onko arvioitavassa kohteessa hiljaista tilaa,\n                johon on mahdollista vetäytyä\n                aistikuormituksen kasvaessa liian suureksi – tai\n                olisiko sellaiselle tarvetta?</li> \n            <li class="svelte-3l21uc">Millaisen kokonaisuuden tilan aistiärsykkeet\n                yhdessä muodostavat (huomioikaa\n                aistiärsykkeiden kumuloituva vaikutus)?</li>',o=N(),a=I("a"),a.textContent="Näytä yhteenveto",$(e,"margin-top","2rem"),O(r,"class","svelte-3l21uc"),O(a,"href","/#/results-page"),O(a,"class","btn btn-primary btn-outlined")},m(t,l){T(t,e,l),T(t,n,l),T(t,i,l),T(t,s,l),T(t,r,l),T(t,o,l),T(t,a,l)},d(t){t&&C(e),t&&C(n),t&&C(i),t&&C(s),t&&C(r),t&&C(o),t&&C(a)}}}function Jn(e){let n;function i(t,e){return"fi"===t[0]?Yn:Gn}let s=i(e),r=s(e);return{c(){n=I("div"),r.c(),O(n,"class","info-container svelte-3l21uc")},m(t,e){T(t,n,e),r.m(n,null)},p(t,[e]){s!==(s=i(t))&&(r.d(1),r=s(t),r&&(r.c(),r.m(n,null)))},i:t,o:t,d(t){t&&C(n),r.d()}}}function Qn(t,e,n){let i;return d(t,ae,(t=>n(0,i=t))),[i]}class Xn extends Rt{constructor(t){super(),Nt(this,t,Qn,Jn,a,{})}}function Zn(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,j,M,L,F=("file"===t[4]||"localStorage"===t[4])&&ti(t);return R=new Re({props:{show:t[0]}}),R.$on("click",t[11]),{c(){e=I("div"),n=I("h2"),i=x(t[1]),s=N(),o=I("p"),a=x(t[2]),l=N(),u=I("select"),c=I("option"),c.textContent="Valitse tallennustapa",h=I("option"),h.textContent="Laitteelle tiedostona",d=I("option"),d.textContent="Selaimen muistiin",p=N(),F&&F.c(),f=N(),m=I("div"),g=I("button"),g.textContent="Peruuta",v=N(),_=I("button"),y=x(t[3]),E=N(),It(R.$$.fragment),O(n,"class","svelte-ftjlae"),c.disabled="disabled",c.__value="Valitse tallennustapa",c.value=c.__value,h.__value="file",h.value=h.__value,d.disabled=!0,d.__value="localStorage",d.value=d.__value,$(d,"text-decoration","line-through"),O(u,"class","select select-bordered w-full max-w-xs svelte-ftjlae"),void 0===t[4]&&st((()=>t[8].call(u))),O(g,"class","btn"),O(_,"class","btn btn-primary"),_.disabled=w="file"!==t[4]&&"localStorage"!==t[4],O(m,"class","action svelte-ftjlae"),O(e,"class","svelte-modal svelte-ftjlae")}
1,m(r,w){T(r,e,w),k(e,n),k(n,i),k(e,s),k(e,o),k(o,a),k(e,l),k(e,u),k(u,c),k(u,h),k(u,d),D(u,t[4]),k(e,p),F&&F.m(e,null),k(e,f),k(e,m),k(m,g),k(m,v),k(m,_),k(_,y),T(r,E,w),Et(R,r,w),j=!0,M||(L=[P(u,"change",t[8]),P(g,"click",t[10]),P(_,"click",t[6])],M=!0)},p(t,n){(!j||2&n)&&A(i,t[1]),(!j||4&n)&&A(a,t[2]),16&n&&D(u,t[4]),"file"===t[4]||"localStorage"===t[4]?F?F.p(t,n):(F=ti(t),F.c(),F.m(e,f)):F&&(F.d(1),F=null),(!j||8&n)&&A(y,t[3]),(!j||16&n&&w!==(w="file"!==t[4]&&"localStorage"!==t[4]))&&(_.disabled=w);const s={};1&n&&(s.show=t[0]),R.$set(s)},i(t){j||(st((()=>{S&&S.end(1),b=kt(e,de,{duration:200,y:200}),b.start()})),vt(R.$$.fragment,t),j=!0)},o(t){b&&b.invalidate(),S=wt(e,he,{duration:200}),_t(R.$$.fragment,t),j=!1},d(t){t&&C(e),F&&F.d(),t&&S&&S.end(),t&&C(E),xt(R,t),M=!1,r(L)}}}function ti(t){let e,n,i,s,r,o;return{c(){e=I("div"),n=I("label"),n.innerHTML='<span class="label-text">Tiedoston nimi</span>',i=N(),s=I("input"),O(n,"class","label"),O(n,"for","filename"),O(s,"type","text"),O(s,"id","filename"),O(s,"class","input input-bordered"),O(e,"class","form-control")},m(a,l){T(a,e,l),k(e,n),k(e,i),k(e,s),j(s,t[5]),r||(o=P(s,"input",t[9]),r=!0)},p(t,e){32&e&&s.value!==t[5]&&j(s,t[5])},d(t){t&&C(e),r=!1,o()}}}function ei(t){let e,n,i=t[0]&&Zn(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&vt(i,1)):(i=Zn(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function ni(t,e,n){let i,{onClick:s=function(){}}=e,{title:r="Valitse tallennustapa"}=e,{text:o="Tässä versiossa käytössä on vain laitteelle tallentaminen."}=e,{buttonText:a="Selvä"}=e,{open:l=!1}=e,u="aistikartoitus_vastaukset_"+(new Date).toLocaleDateString().replaceAll(".","-");return t.$$set=t=>{"onClick"in t&&n(7,s=t.onClick),"title"in t&&n(1,r=t.title),"text"in t&&n(2,o=t.text),"buttonText"in t&&n(3,a=t.buttonText),"open"in t&&n(0,l=t.open)},t.$$.update=()=>{16&t.$$.dirty&&i&&console.log(i)},[l,r,o,a,i,u,function(){s(u,i),setTimeout((()=>{n(0,l=!1)}),400)},s,function(){i=M(this),n(4,i)},function(){u=this.value,n(5,u)},()=>n(0,l=!1),()=>n(0,l=!1)]}class ii extends Rt{constructor(t){super(),Nt(this,t,ni,ei,a,{onClick:7,title:1,text:2,buttonText:3,open:0})}}
2/*! For license information please see shifty.js.LICENSE.txt */
3var si,ri,oi=(si=function(t,e){self,t.exports=function(){var t={720:function(t,e,n){n.r(e),n.d(e,{Scene:function(){return Qt},Tweenable:function(){return mt},interpolate:function(){return Vt},processTweens:function(){return ct},setBezierFunction:function(){return Xt},tween:function(){return gt},unsetBezierFunction:function(){return Zt}});var i={};n.r(i),n.d(i,{bounce:function(){return $},bouncePast:function(){return D},easeFrom:function(){return L},easeFromTo:function(){return M},easeInBack:function(){return x},easeInCirc:function(){return C},easeInCubic:function(){return u},easeInExpo:function(){return w},easeInOutBack:function(){return R},easeInOutCirc:function(){return I},easeInOutCubic:function(){return h},easeInOutExpo:function(){return T},easeInOutQuad:function(){return l},easeInOutQuart:function(){return f},easeInOutQuint:function(){return v},easeInOutSine:function(){return k},easeInQuad:function(){return o},easeInQuart:function(){return d},easeInQuint:function(){return m},easeInSine:function(){return _},easeOutBack:function(){return N},easeOutBounce:function(){return E},easeOutCirc:function(){return S},easeOutCubic:function(){return c},easeOutExpo:function(){return b},easeOutQuad:function(){return a},easeOutQuart:function(){return p},easeOutQuint:function(){return g},easeOutSine:function(){return y},easeTo:function(){return F},elastic:function(){return P},linear:function(){return r},swingFrom:function(){return A},swingFromTo:function(){return O},swingTo:function(){return j}});var s={};n.r(s),n.d(s,{afterTween:function(){return Ft},beforeTween:function(){return Lt},doesApply:function(){return Dt},tweenCreated:function(){return Mt}});var r=function(t){return t},o=function(t){return Math.pow(t,2)},a=function(t){return-(Math.pow(t-1,2)-1)},l=function(t){return(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2)},u=function(t){return Math.pow(t,3)},c=function(t){return Math.pow(t-1,3)+1},h=function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},d=function(t){return Math.pow(t,4)},p=function(t){return-(Math.pow(t-1,4)-1)},f=function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},m=function(t){return Math.pow(t,5)},g=function(t){return Math.pow(t-1,5)+1},v=function(t){return(t/=.5)<1?.5*Math.pow(t,5):.5*(Math.pow(t-2,5)+2)},_=function(t){return 1-Math.cos(t*(Math.PI/2))},y=function(t){return Math.sin(t*(Math.PI/2))},k=function(t){return-.5*(Math.cos(Math.PI*t)-1)},w=function(t){return 0===t?0:Math.pow(2,10*(t-1))},b=function(t){return 1===t?1:1-Math.pow(2,-10*t)},T=function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},C=function(t){return-(Math.sqrt(1-t*t)-1)},S=function(t){return Math.sqrt(1-Math.pow(t-1,2))},I=function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},E=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},x=function(t){var e=1.70158;return t*t*((e+1)*t-e)},N=function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},R=function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},P=function(t){return-1*Math.pow(4,-8*t)*Math.sin((6*t-1)*(2*Math.PI)/2)+1},O=function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},A=function(t){var e=1.70158;return t*t*((e+1)*t-e)},j=function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},$=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},D=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?2-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?2-(7.5625*(t-=2.25/2.75)*t+.9375):2-(7.5625*(t-=2.625/2.75)*t+.984375)},M=function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},L=function(t){return Math.pow(t,4)},F=function(t){return Math.pow(t,.25)};function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function W(t){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function H(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function z(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
vendor: 10,669 bytes, line 3
3e%2?H(Object(n),!0).forEach((function(e){V(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function V(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var B,K,G,Y="linear",J="undefined"!=typeof window?window:n.g,Q="afterTween",X="afterTweenEnd",Z="beforeTween",tt="tweenCreated",et="function",nt="string",it=J.requestAnimationFrame||J.webkitRequestAnimationFrame||J.oRequestAnimationFrame||J.msRequestAnimationFrame||J.mozCancelRequestAnimationFrame&&J.mozRequestAnimationFrame||setTimeout,st=function(){},rt=null,ot=null,at=z({},i),lt=function(t,e,n,i,s,r,o){var a,l,u,c=t<r?0:(t-r)/s,h=!1;for(var d in o&&o.call&&(h=!0,a=o(c)),e)h||(a=((l=o[d]).call?l:at[l])(c)),u=n[d],e[d]=u+(i[d]-u)*a;return e},ut=function(t,e){var n=t._timestamp,i=t._currentState,s=t._delay;if(!(e<n+s)){var r=t._duration,o=t._targetState,a=n+s+r,l=e>a?a:e,u=l>=a,c=r-(a-l),h=t._filters.length>0;if(u)return t._render(o,t._data,c),t.stop(!0);h&&t._applyFilter(Z),l<n+s?n=r=l=1:n+=s,lt(l,i,t._originalState,o,r,n,t._easing),h&&t._applyFilter(Q),t._render(i,t._data,c)}},ct=function(){for(var t,e=mt.now(),n=rt;n;)t=n._next,ut(n,e),n=t},ht=Date.now||function(){return+new Date},dt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Y,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=W(e);if(at[e])return at[e];if(i===nt||i===et)for(var s in t)n[s]=e;else for(var r in t)n[r]=e[r]||Y;return n},pt=function(t){t===rt?(rt=t._next)?rt._previous=null:ot=null:t===ot?(ot=t._previous)?ot._next=null:rt=null:(K=t._previous,G=t._next,K._next=G,G._previous=K),t._previous=t._next=null},ft="function"==typeof Promise?Promise:null,mt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;q(this,t),this._config={},this._data={},this._delay=0,this._filters=[],this._next=null,this._previous=null,this._timestamp=null,this._resolve=null,this._reject=null,this._currentState=e||{},this._originalState={},this._targetState={},this._start=st,this._render=st,this._promiseCtor=ft,n&&this.setConfig(n)}var e;return(e=[{key:"_applyFilter",value:function(t){for(var e=this._filters.length;e>0;e--){var n=this._filters[e-e][t];n&&n(this)}}},{key:"tween",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return this._isPlaying&&this.stop(),!e&&this._config||this.setConfig(e),this._pausedAtTime=null,this._timestamp=t.now(),this._start(this.get(),this._data),this._delay&&this._render(this._currentState,this._data,0),this._resume(this._timestamp)}},{key:"setConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this._config;for(var i in e)n[i]=e[i];var s=n.promise,r=void 0===s?this._promiseCtor:s,o=n.start,a=void 0===o?st:o,l=n.finish,u=n.render,c=void 0===u?this._config.step||st:u,h=n.step,d=void 0===h?st:h;this._data=n.data||n.attachment||this._data,this._isPlaying=!1,this._pausedAtTime=null,this._scheduleId=null,this._delay=e.delay||0,this._start=a,this._render=c||d,this._duration=n.duration||500,this._promiseCtor=r,l&&(this._resolve=l);var p=e.from,f=e.to,m=void 0===f?{}:f,g=this._currentState,v=this._originalState,_=this._targetState;for(var y in p)g[y]=p[y];var k=!1;for(var w in g){var b=g[w];k||W(b)!==nt||(k=!0),v[w]=b,_[w]=m.hasOwnProperty(w)?m[w]:b}if(this._easing=dt(this._currentState,n.easing,this._easing),this._filters.length=0,k){for(var T in t.filters)t.filters[T].doesApply(this)&&this._filters.push(t.filters[T]);this._applyFilter(tt)}return this}},{key:"then",value:function(t,e){var n=this;return this._promise=new this._promiseCtor((function(t,e){n._resolve=t,n._reject=e})),this._promise.then(t,e)}},{key:"catch",value:function(t){return this.then().catch(t)}},{key:"get",value:function(){return z({},this._currentState)}},{key:"set",value:function(t){this._currentState=t}},{key:"pause",value:function(){if(this._isPlaying)return this._pausedAtTime=t.now(),this._isPlaying=!1,pt(this),this}},{key:"resume",value:function(){return this._resume()}},{key:"_resume",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.now();return null===this._timestamp?this.tween():this._isPlaying?this._promise:(this._pausedAtTime&&(this._timestamp+=e-this._pausedAtTime,this._pausedAtTime=null),this._isPlaying=!0,null===rt?(rt=this,ot=this):(this._previous=ot,ot._next=this,ot=this),this)}},{key:"seek",value:function(e){e=Math.max(e,0);var n=t.now();return this._timestamp+e===0||(this._timestamp=n-e,ut(this,n)),this}},{key:"stop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._isPlaying)return this;this._isPlaying=!1,pt(this);var e=this._filters.length>0;return t&&(e&&this._applyFilter(Z),lt(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),e&&(this._applyFilter(Q),this._applyFilter(X))),this._resolve&&this._resolve({data:this._data,state:this._currentState,tweenable:this}),this._resolve=null,this._reject=null,this}},{key:"cancel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this._currentState,n=this._data;return this._isPlaying?(this._reject&&this._reject({data:n,state:e,tweenable:this}),this._resolve=null,this._reject=null,this.stop(t)):this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"setScheduleFunction",value:function(e){t.setScheduleFunction(e)}},{key:"data",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t&&(this._data=z({},t)),this._data}},{key:"dispose",value:function(){for(var t in this)delete this[t]}}])&&U(t.prototype,e),t}();function gt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=new mt;return e.tween(t),e.tweenable=e,e}V(mt,"now",(function(){return B})),mt.setScheduleFunction=function(t){return it=t},mt.formulas=at,mt.filters={},function t(){B=ht(),it.call(J,t,16.666666666666668),ct()}();var vt,_t,yt=/(\d|-|\.)/,kt=/([^\-0-9.]+)/g,wt=/[0-9.-]+/g,bt=(vt=wt.source,_t=/,\s*/.source,new RegExp("rgba?\\(".concat(vt).concat(_t).concat(vt).concat(_t).concat(vt,"(").concat(_t).concat(vt,")?\\)"),"g")),Tt=/^.*\(/,Ct=/#([0-9]|[a-f]){3,6}/gi,St="VAL",It=function(t,e){return t.map((function(t,n){return"_".concat(e,"_").concat(n)}))};function Et(t){return parseInt(t,16)}var xt=function(t){return"rgb(".concat((e=t,3===(e=e.replace(/#/,"")).length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[Et(e.substr(0,2)),Et(e.substr(2,2)),Et(e.substr(4,2))]).join(","),")");var e},Nt=function(t,e,n){var i=e.match(t),s=e.replace(t,St);return i&&i.forEach((function(t){return s=s.replace(St,n(t))})),s},Rt=function(t){for(var e in t){var n=t[e];"string"==typeof n&&n.match(Ct)&&(t[e]=Nt(Ct,n,xt))}},Pt=function(t){var e=t.match(wt),n=e.slice(0,3).map(Math.floor),i=t.match(Tt)[0];if(3===e.length)return"".concat(i).concat(n.join(","),")");if(4===e.length)return"".concat(i).concat(n.join(","),",").concat(e[3],")");throw new Error("Invalid rgbChunk: ".concat(t))},Ot=function(t){return t.match(wt)},At=function(t,e){var n={};return e.forEach((function(e){n[e]=t[e],delete t[e]})),n},jt=function(t,e){return e.map((function(e){return t[e]}))},$t=function(t,e){return e.forEach((function(e){return t=t.replace(St,+e.toFixed(4))})),t},Dt=function(t){for(var e in t._currentState)if("string"==typeof t._currentState[e])return!0;return!1};function Mt(t){var e=t._currentState;[e,t._originalState,t._targetState].forEach(Rt),t._tokenData=function(t){var e,n,i={};for(var s in t){var r=t[s];"string"==typeof r&&(i[s]={formatString:(e=r,n=void 0,n=e.match(kt),n?(1===n.length||e.charAt(0).match(yt))&&n.unshift(""):n=["",""],n.join(St)),chunkNames:It(Ot(r),s)})}return i}(e)}function Lt(t){var e=t._currentState,n=t._originalState,i=t._targetState,s=t._easing,r=t._tokenData;!function(t,e){var n=function(n){var i=e[n].chunkNames,s=t[n];if("string"==typeof s){var r=s.split(" "),o=r[r.length-1];i.forEach((function(e,n){return t[e]=r[n]||o}))}else i.forEach((function(e){return t[e]=s}));delete t[n]};for(var i in e)n(i)}(s,r),[e,n,i].forEach((function(t){return function(t,e){var n=function(n){Ot(t[n]).forEach((function(i,s){return t[e[n].chunkNames[s]]=+i})),delete t[n]};for(var i in e)n(i)}(t,r)}))}function Ft(t){var e=t._currentState,n=t._originalState,i=t._targetState,s=t._easing,r=t._tokenData;[e,n,i].forEach((function(t){return function(t,e){for(var n in e){var i=e[n],s=i.chunkNames,r=i.formatString,o=$t(r,jt(At(t,s),s));t[n]=Nt(bt,o,Pt)}}(t,r)})),function(t,e){for(var n in e){var i=e[n].chunkNames,s=t[i[0]];t[n]="string"==typeof s?i.map((function(e){var n=t[e];return delete t[e],n})).join(" "):s}}(s,r)}function qt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Ut(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?qt(Object(n),!0).forEach((function(e){Wt(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Wt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ht=new mt,zt=mt.filters,Vt=function(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=Ut({},t),o=dt(t,i);for(var a in Ht._filters.length=0,Ht.set({}),Ht._currentState=r,Ht._originalState=t,Ht._targetState=e,Ht._easing=o,zt)zt[a].doesApply(Ht)&&Ht._filters.push(zt[a]);Ht._applyFilter("tweenCreated"),Ht._applyFilter("beforeTween");var l=lt(n,r,t,e,1,s,o);return Ht._applyFilter("afterTween"),l};function Bt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function Kt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Yt(t,e){var n=e.get(t);if(!n)throw new TypeError("attempted to get private field on non-instance");return n.get?n.get.call(t):n.value}var Jt=new WeakMap,Qt=function(){function t(){Kt(this,t),Jt.set(this,{writable:!0,value:[]});for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];
3n.forEach(this.add.bind(this))}var e;return(e=[{key:"add",value:function(t){return Yt(this,Jt).push(t),t}},{key:"remove",value:function(t){var e=Yt(this,Jt).indexOf(t);return~e&&Yt(this,Jt).splice(e,1),t}},{key:"empty",value:function(){return this.tweenables.map(this.remove.bind(this))}},{key:"isPlaying",value:function(){return Yt(this,Jt).some((function(t){return t.isPlaying()}))}},{key:"play",value:function(){return Yt(this,Jt).forEach((function(t){return t.tween()})),this}},{key:"pause",value:function(){return Yt(this,Jt).forEach((function(t){return t.pause()})),this}},{key:"resume",value:function(){return Yt(this,Jt).forEach((function(t){return t.resume()})),this}},{key:"stop",value:function(t){return Yt(this,Jt).forEach((function(e){return e.stop(t)})),this}},{key:"tweenables",get:function(){return function(t){if(Array.isArray(t))return Bt(t)}(t=Yt(this,Jt))||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Bt(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t}},{key:"promises",get:function(){return Yt(this,Jt).map((function(t){return t.then()}))}}])&&Gt(t.prototype,e),t}(),Xt=function(t,e,n,i,s){var r=function(t,e,n,i){return function(s){return c=0,h=0,d=0,p=function(t){return((c*t+h)*t+d)*t},f=function(t){return(3*c*t+2*h)*t+d},m=function(t){return t>=0?t:0-t},c=1-(d=3*(r=t))-(h=3*(n-r)-d),a=1-(u=3*(o=e))-(l=3*(i-o)-u),function(t){return((a*t+l)*t+u)*t}(function(t,e){var n,i,s,r,o,a;for(s=t,a=0;a<8;a++){if(r=p(s)-t,m(r)<e)return s;if(o=f(s),m(o)<1e-6)break;s-=r/o}if((s=t)<(n=0))return n;if(s>(i=1))return i;for(;n<i;){if(r=p(s),m(r-t)<e)return s;t>r?n=s:i=s,s=.5*(i-n)+n}return s}(s,.005));var r,o,a,l,u,c,h,d,p,f,m}}(e,n,i,s);return r.displayName=t,r.x1=e,r.y1=n,r.x2=i,r.y2=s,mt.formulas[t]=r},Zt=function(t){return delete mt.formulas[t]};mt.filters.token=s}},e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={exports:{}};return t[i](s,s.exports,n),s.exports}return n.d=function(t,e){for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(720)}()},si(ri={exports:{}},ri.exports),ri.exports),ai="Webkit Moz O ms".split(" ");function li(t,e,n){for(var i=t.style,s=0;s<ai.length;++s){i[ai[s]+ui(e)]=n}i[e]=n}function ui(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ci(t){return!function(t){return"[object Array]"===Object.prototype.toString.call(t)}(t)&&("object"===typeof t&&!!t)}function hi(t,e){for(var n in t){if(t.hasOwnProperty(n))e(t[n],n)}}var di={extend:function t(e,n,i){for(var s in e=e||{},i=i||!1,n=n||{})if(n.hasOwnProperty(s)){var r=e[s],o=n[s];i&&ci(r)&&ci(o)?e[s]=t(r,o,i):e[s]=o}return e},render:function(t,e){var n=t;for(var i in e)if(e.hasOwnProperty(i)){var s=e[i],r=new RegExp("\\{"+i+"\\}","g");n=n.replace(r,s)}return n}
vendor: 8,597 bytes, line 3
3,setStyle:li,setStyles:function(t,e){hi(e,(function(e,n){null!=e&&(ci(e)&&!0===e.prefix?li(t,n,e.value):t.style[n]=e)}))},capitalize:ui,isString:function(t){return"string"==typeof t||t instanceof String},isFunction:function(t){return"function"==typeof t},isObject:ci,forEachObject:hi,floatEquals:function(t,e){return Math.abs(t-e)<.001},removeChildren:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}},pi=oi.Tweenable,fi={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},mi=function t(e,n){if(!(this instanceof t))throw new Error("Constructor was called without new keyword");var i;n=di.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},n),i=di.isString(e)?document.querySelector(e):e,this.path=i,this._opts=n,this._tweenable=null;var s=this.path.getTotalLength();this.path.style.strokeDasharray=s+" "+s,this.set(0)};mi.prototype.value=function(){var t=this._getComputedDashOffset(),e=this.path.getTotalLength();return parseFloat((1-t/e).toFixed(6),10)},mi.prototype.set=function(t){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(t);var e=this._opts.step;if(di.isFunction(e)){var n=this._easing(this._opts.easing);e(this._calculateTo(t,n),this._opts.shape||this,this._opts.attachment)}},mi.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},mi.prototype.animate=function(t,e,n){e=e||{},di.isFunction(e)&&(n=e,e={});var i=di.extend({},e),s=di.extend({},this._opts);e=di.extend(s,e);var r=this._easing(e.easing),o=this._resolveFromAndTo(t,r,i);this.stop(),this.path.getBoundingClientRect();var a=this._getComputedDashOffset(),l=this._progressToOffset(t),u=this;this._tweenable=new pi,this._tweenable.tween({from:di.extend({offset:a},o.from),to:di.extend({offset:l},o.to),duration:e.duration,delay:e.delay,easing:r,step:function(t){u.path.style.strokeDashoffset=t.offset;var n=e.shape||u;e.step(t,n,e.attachment)}}).then((function(t){di.isFunction(n)&&n()}))},mi.prototype._getComputedDashOffset=function(){var t=window.getComputedStyle(this.path,null);return parseFloat(t.getPropertyValue("stroke-dashoffset"),10)},mi.prototype._progressToOffset=function(t){var e=this.path.getTotalLength();return e-t*e},mi.prototype._resolveFromAndTo=function(t,e,n){return n.from&&n.to?{from:n.from,to:n.to}:{from:this._calculateFrom(e),to:this._calculateTo(t,e)}},mi.prototype._calculateFrom=function(t){return oi.interpolate(this._opts.from,this._opts.to,this.value(),t)},mi.prototype._calculateTo=function(t,e){return oi.interpolate(this._opts.from,this._opts.to,t,e)},mi.prototype._stopTween=function(){null!==this._tweenable&&(this._tweenable.stop(),this._tweenable=null)},mi.prototype._easing=function(t){return fi.hasOwnProperty(t)?fi[t]:t};var gi=mi,vi="Object is destroyed",_i=function t(e,n){if(!(this instanceof t))throw new Error("Constructor was called without new keyword");if(0!==arguments.length){this._opts=di.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},n,!0),di.isObject(n)&&void 0!==n.svgStyle&&(this._opts.svgStyle=n.svgStyle),di.isObject(n)&&di.isObject(n.text)&&void 0!==n.text.style&&(this._opts.text.style=n.text.style);var i,s=this._createSvgView(this._opts);if(!(i=di.isString(e)?document.querySelector(e):e))throw new Error("Container does not exist: "+e);this._container=i,this._container.appendChild(s.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&di.setStyles(s.svg,this._opts.svgStyle),this.svg=s.svg,this.path=s.path,this.trail=s.trail,this.text=null;var r=di.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new gi(s.path,r),di.isObject(this._opts.text)&&null!==this._opts.text.value&&this.setText(this._opts.text.value)}};_i.prototype.animate=function(t,e,n){if(null===this._progressPath)throw new Error(vi);this._progressPath.animate(t,e,n)},_i.prototype.stop=function(){if(null===this._progressPath)throw new Error(vi);void 0!==this._progressPath&&this._progressPath.stop()},_i.prototype.pause=function(){if(null===this._progressPath)throw new Error(vi);void 0!==this._progressPath&&this._progressPath._tweenable&&this._progressPath._tweenable.pause()},_i.prototype.resume=function(){if(null===this._progressPath)throw new Error(vi);void 0!==this._progressPath&&this._progressPath._tweenable&&this._progressPath._tweenable.resume()},_i.prototype.destroy=function(){if(null===this._progressPath)throw new Error(vi);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,null!==this.text&&(this.text.parentNode.removeChild(this.text),this.text=null)},_i.prototype.set=function(t){if(null===this._progressPath)throw new Error(vi);this._progressPath.set(t)},_i.prototype.value=function(){if(null===this._progressPath)throw new Error(vi);return void 0===this._progressPath?0:this._progressPath.value()},_i.prototype.setText=function(t){if(null===this._progressPath)throw new Error(vi);null===this.text&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),di.isObject(t)?(di.removeChildren(this.text),this.text.appendChild(t)):this.text.innerHTML=t},_i.prototype._createSvgView=function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(e,t);var n=null;(t.trailColor||t.trailWidth)&&(n=this._createTrail(t),e.appendChild(n));var i=this._createPath(t);return e.appendChild(i),{svg:e,path:i,trail:n}},_i.prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 100")},_i.prototype._createPath=function(t){var e=this._pathString(t);return this._createPathElement(e,t)},_i.prototype._createTrail=function(t){var e=this._trailString(t),n=di.extend({},t);return n.trailColor||(n.trailColor="#eee"),n.trailWidth||(n.trailWidth=n.strokeWidth),n.color=n.trailColor,n.strokeWidth=n.trailWidth,n.fill=null,this._createPathElement(e,n)},_i.prototype._createPathElement=function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",t),n.setAttribute("stroke",e.color),n.setAttribute("stroke-width",e.strokeWidth),e.fill?n.setAttribute("fill",e.fill):n.setAttribute("fill-opacity","0"),n},_i.prototype._createTextContainer=function(t,e){var n=document.createElement("div");n.className=t.text.className;var i=t.text.style;return i&&(t.text.autoStyleContainer&&(e.style.position="relative"),di.setStyles(n,i),i.color||(n.style.color=t.color)),this._initializeTextContainer(t,e,n),n},_i.prototype._initializeTextContainer=function(t,e,n){},_i.prototype._pathString=function(t){throw new Error("Override this function for each progress bar")},_i.prototype._trailString=function(t){throw new Error("Override this function for each progress bar")},_i.prototype._warnContainerAspectRatio=function(t){if(this.containerAspectRatio){var e=window.getComputedStyle(t,null),n=parseFloat(e.getPropertyValue("width"),10),i=parseFloat(e.getPropertyValue("height"),10);di.floatEquals(this.containerAspectRatio,n/i)||(console.warn("Incorrect aspect ratio of container","#"+t.id,"detected:",e.getPropertyValue("width")+"(width)","/",e.getPropertyValue("height")+"(height)","=",n/i),console.warn("Aspect ratio of should be",this.containerAspectRatio))}};var yi=_i,ki=function(t,e){this._pathTemplate="M 0,{center} L 100,{center}",yi.apply(this,arguments)};(ki.prototype=new yi).constructor=ki,ki.prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 "+e.strokeWidth),t.setAttribute("preserveAspectRatio","none")},ki.prototype._pathString=function(t){return di.render(this._pathTemplate,{center:t.strokeWidth/2})},ki.prototype._trailString=function(t){return this._pathString(t)};var wi=ki,bi=function(t,e){this._pathTemplate="M 50,50 m 0,-{radius} a {radius},{radius} 0 1 1 0,{2radius} a {radius},{radius} 0 1 1 0,-{2radius}",this.containerAspectRatio=1,yi.apply(this,arguments)};(bi.prototype=new yi).constructor=bi,bi.prototype._pathString=function(t){var e=t.strokeWidth;t.trailWidth&&t.trailWidth>t.strokeWidth&&(e=t.trailWidth);var n=50-e/2;return di.render(this._pathTemplate,{radius:n,"2radius":2*n})},bi.prototype._trailString=function(t){return this._pathString(t)};var Ti=bi,Ci=function(t,e){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius}
3 0 1 1 {2radius},0",this.containerAspectRatio=2,yi.apply(this,arguments)};(Ci.prototype=new yi).constructor=Ci,Ci.prototype._initializeSvg=function(t,e){t.setAttribute("viewBox","0 0 100 50")},Ci.prototype._initializeTextContainer=function(t,e,n){t.text.style&&(n.style.top="auto",n.style.bottom="0",t.text.alignToBottom?di.setStyle(n,"transform","translate(-50%, 0)"):di.setStyle(n,"transform","translate(-50%, 50%)"))},Ci.prototype._pathString=Ti.prototype._pathString,Ci.prototype._trailString=Ti.prototype._trailString;var Si=Ci,Ii=function(t,e){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",yi.apply(this,arguments)};(Ii.prototype=new yi).constructor=Ii,Ii.prototype._pathString=function(t){var e=100-t.strokeWidth/2;return di.render(this._pathTemplate,{width:e,strokeWidth:t.strokeWidth,halfOfStrokeWidth:t.strokeWidth/2})},Ii.prototype._trailString=function(t){var e=100-t.strokeWidth/2;return di.render(this._trailTemplate,{width:e,strokeWidth:t.strokeWidth,halfOfStrokeWidth:t.strokeWidth/2,startMargin:t.strokeWidth/2-t.trailWidth/2})};var Ei={Line:wi,Circle:Ti,SemiCircle:Si,Square:Ii,Path:gi,Shape:yi,utils:di};function xi(e){let n,i,s,r,o,a,l;return{c(){n=I("div"),i=I("h4"),s=x(e[0]),r=N(),o=I("div"),$(i,"text-align","center"),$(i,"margin-bottom","0.5rem",1),O(o,"class","circle-cont svelte-122kx55"),$(n,"width","fit-content"),$(n,"margin-right",".5rem"),$(n,"margin-bottom","1rem")},m(t,u){T(t,n,u),k(n,i),k(i,s),k(n,r),k(n,o),e[7](o),a||(l=P(o,"click",e[6]),a=!0)},p(t,[e]){1&e&&A(s,t[0])},i:t,o:t,d(t){t&&C(n),e[7](null),a=!1,l()}}}function Ni(t,e,n){let i,{title:s=""}=e,{color:r="green"}=e,{value:o=0}=e,{width:a=150}=e,{chartType:l="turn"}=e;return function(t="normal"){"turn"===t?(n(3,o=1-o),o<=Ft?n(2,r="rgb(255, 51, 51)"):o>Ft&&o<qt?n(2,r="rgb(255, 170, 51)"):o>=qt&&o<Ut?n(2,r="rgb(255, 235, 0)"):o>=Ut&&n(2,r="rgb(0, 204, 102)")):o<=Ft?n(2,r="rgb(0, 204, 102)"):o>Ft&&o<qt?n(2,r="rgb(255, 235, 0)"):o>=qt&&o<Ut?n(2,r="rgb(255, 170, 51)"):o>=Ut&&n(2,r="rgb(255, 51, 51)")}(l),K((()=>{const t=new Ei.Circle(i,{strokeWidth:9,easing:"easeInOut",duration:500,color:r,trailColor:"#eee",trailWidth:1,svgStyle:null});t.setText(Math.round(100*o).toString()),t.animate(o);const e=i.querySelector(".progressbar-text");e.style.color="#333",e.style.fontWeight="500",e.style.fontSize="30px"})),t.$$set=t=>{"title"in t&&n(0,s=t.title),"color"in t&&n(2,r=t.color),"value"in t&&n(3,o=t.value),"width"in t&&n(4,a=t.width),"chartType"in t&&n(5,l=t.chartType)},[s,i,r,o,a,l,function(e){Y.call(this,t,e)},function(t){Q[t?"unshift":"push"]((()=>{i=t,n(1,i)}))}]}class Ri extends Rt{constructor(t){super(),Nt(this,t,Ni,xi,a,{title:0,color:2,value:3,width:4,chartType:5})}}function Pi(t,e,n){const i=t.slice();return i[6]=e[n],i[8]=n,i}function Oi(t){let e,n,i,s,r,o,a=t[1][t[8]]+"";return{c(){e=I("div"),n=I("div"),i=N(),s=I("span"),r=x(a),o=N(),O(n,"class","category-color svelte-1pktcp6"),$(n,"background",t[6]),O(e,"class","category-label svelte-1pktcp6")},m(t,a){T(t,e,a),k(e,n),k(e,i),k(e,s),k(s,r),k(e,o)},p(t,e){1&e&&$(n,"background",t[6]),2&e&&a!==(a=t[1][t[8]]+"")&&A(r,a)},d(t){t&&C(e)}}}function Ai(e){let n,i=e[0],s=[];for(let t=0;t<i.length;t+=1)s[t]=Oi(Pi(e,i,t));return{c(){n=I("div");for(let t=0;t<s.length;t+=1)s[t].c();O(n,"class","category-labels svelte-1pktcp6")},m(t,e){T(t,n,e);for(let t=0;t<s.length;t+=1)s[t].m(n,null)},p(t,[e]){if(3&e){let r;for(i=t[0],r=0;r<i.length;r+=1){const o=Pi(t,i,r);s[r]?s[r].p(o,e):(s[r]=Oi(o),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=i.length}},i:t,o:t,d(t){t&&C(n),S(s,t)}}}function ji(t,e,n){let i;d(t,ae,(t=>n(3,i=t)));let{chartType:s}=e,r=["rgb(255, 51, 51)","rgb(255, 170, 51)","rgb(255, 235, 0)","rgb(0, 204, 102)"],o=["Merkittävästi aistikuormaa","Paljon aistikuormaa","Hieman aistikuormaa","Vähäinen aistikuorma"],a=["Substantial sensory load","Plenty of sensory load","Some sensory load","Little sonsory load"],l="fi"===i?o:a;return"normal"===s&&(r=r.reverse(),l=l.reverse()),t.$$set=t=>{"chartType"in t&&n(2,s=t.chartType)},t.$$.update=()=>{8&t.$$.dirty&&i&&n(1,l="fi"===i?o:a)},[r,l,s,i]}class $i extends Rt{constructor(t){super(),Nt(this,t,ji,Ai,a,{chartType:2})}}function Di(t,e,n){const i=t.slice();return i[6]=e[n],i[8]=n,i}function Mi(t){let e,n;return e=new Ri({props:{title:t[2][t[8]],value:t[6]/100,chartType:Fi}}),e.$on("click",(function(){return t[4](t[8])})),{c(){It(e.$$.fragment)},m(t,i){Et(e,t,i),n=!0},p(n,i){t=n;const s={};4&i&&(s.title=t[2][t[8]]),1&i&&(s.value=t[6]/100),e.$set(s)},i(t){n||(vt(e.$$.fragment,t),n=!0)},o(t){_t(e.$$.fragment,t),n=!1},d(t){xt(e,t)}}}function Li(t){let e,n,i,s,r,o,a,l,u="fi"===t[1]?"Kokonaispisteet":"Overall points",c=t[0],h=[];for(let e=0;e<c.length;e+=1)h[e]=Mi(Di(t,c,e));const d=t=>_t(h[t],1,1,(()=>{h[t]=null}));return a=new $i({props:{chartType:Fi}}),{c(){e=I("div"),n=I("h2"),i=x(u),s=N(),r=I("div");for(let t=0;t<h.length;t+=1)h[t].c();o=N(),It(a.$$.fragment),O(n,"class","chart-title svelte-1aocdmt"),O(r,"class","circle-container svelte-1aocdmt"),O(e,"class","chart-container svelte-1aocdmt")}
3,m(t,u){T(t,e,u),k(e,n),k(n,i),k(e,s),k(e,r);for(let t=0;t<h.length;t+=1)h[t].m(r,null);k(e,o),Et(a,e,null),l=!0},p(t,[e]){if((!l||2&e)&&u!==(u="fi"===t[1]?"Kokonaispisteet":"Overall points")&&A(i,u),13&e){let n;for(c=t[0],n=0;n<c.length;n+=1){const i=Di(t,c,n);h[n]?(h[n].p(i,e),vt(h[n],1)):(h[n]=Mi(i),h[n].c(),vt(h[n],1),h[n].m(r,null))}for(mt(),n=c.length;n<h.length;n+=1)d(n);gt()}},i(t){if(!l){for(let t=0;t<c.length;t+=1)vt(h[t]);vt(a.$$.fragment,t),l=!0}},o(t){h=h.filter(Boolean);for(let t=0;t<h.length;t+=1)_t(h[t]);_t(a.$$.fragment,t),l=!1},d(t){t&&C(e),S(h,t),xt(a)}}}let Fi="turn";function qi(t,e,n){let i;d(t,ae,(t=>n(1,i=t)));let{totalScores:s=[]}=e;const r=G();let o="fi"===i?Dt:Mt;function a(t){r("select",{index:t})}K((()=>{window.scrollTo(0,0)}));return t.$$set=t=>{"totalScores"in t&&n(0,s=t.totalScores)},t.$$.update=()=>{2&t.$$.dirty&&i&&n(2,o="fi"===i?Dt:Mt)},[s,i,o,a,t=>a(t)]}class Ui extends Rt{constructor(t){super(),Nt(this,t,qi,Li,a,{totalScores:0})}}function Wi(t,e,n){const i=t.slice();return i[9]=e[n],i}function Hi(t){let e,n,i,s,r,o,a,l,u,c,h,d,p,f,m="fi"===t[3]?"Katso kaikki...":"See all answers...",g="fi"===t[3]?"Vinkkejä aistiesteettömyyden parantamiseksi":"Tips for improving sensory accessibility",v=0===t[1].length&&zi(t),_=t[1],y=[];for(let e=0;e<_.length;e+=1)y[e]=Yi(Wi(t,_,e));return{c(){e=I("div"),v&&v.c(),n=N(),i=I("ul");for(let t=0;t<y.length;t+=1)y[t].c();s=N(),r=I("a"),o=x(m),l=N(),u=I("div"),c=I("a"),h=I("i"),h.textContent="help",d=N(),p=x(g),O(i,"class","svelte-1v1vn2x"),O(r,"href",a="/#/answers/"+t[2]),O(r,"class","basic-link svelte-1v1vn2x"),O(h,"class","material-icons svelte-1v1vn2x"),O(c,"href",f="/#/info/"+t[2]),O(c,"class","category-link svelte-1v1vn2x"),O(u,"class","link-container svelte-1v1vn2x")},m(t,a){T(t,e,a),v&&v.m(e,null),k(e,n),k(e,i);for(let t=0;t<y.length;t+=1)y[t].m(i,null);k(e,s),k(e,r),k(r,o),k(e,l),k(e,u),k(u,c),k(c,h),k(c,d),k(c,p)},p(t,s){if(0===t[1].length?v?v.p(t,s):(v=zi(t),v.c(),v.m(e,n)):v&&(v.d(1),v=null),106&s){let e;for(_=t[1],e=0;e<_.length;e+=1){const n=Wi(t,_,e);y[e]?y[e].p(n,s):(y[e]=Yi(n),y[e].c(),y[e].m(i,null))}for(;e<y.length;e+=1)y[e].d(1);y.length=_.length}8&s&&m!==(m="fi"===t[3]?"Katso kaikki...":"See all answers...")&&A(o,m),4&s&&a!==(a="/#/answers/"+t[2])&&O(r,"href",a),8&s&&g!==(g="fi"===t[3]?"Vinkkejä aistiesteettömyyden parantamiseksi":"Tips for improving sensory accessibility")&&A(p,g),4&s&&f!==(f="/#/info/"+t[2])&&O(c,"href",f)},d(t){t&&C(e),v&&v.d(),S(y,t)}}}function zi(t){let e,n,i="fi"===t[3]?"Ei näytettäviä kohteita":"Nothing to display";return{c(){e=I("p"),n=x(i),$(e,"margin-top","1rem"),$(e,"font-weight","500")},m(t,i){T(t,e,i),k(e,n)},p(t,e){8&e&&i!==(i="fi"===t[3]?"Ei näytettäviä kohteita":"Nothing to display")&&A(n,i)},d(t){t&&C(e)}}}function Vi(t){let e,n,i,s,r,o,a,l,u,c,h=t[9].value+"";function d(t,e){return t[9].isFull?Bi:Ki}let p=d(t),f=p(t),m=t[9].details&&Gi(t);return{c(){e=I("li"),n=I("div"),i=N(),s=I("div"),f.c(),r=N(),o=I("i"),a=x(h),l=x("/100"),u=N(),m&&m.c(),c=N(),O(n,"class","ball svelte-1v1vn2x"),$(n,"background",t[6](t[9].value)),$(o,"text-decoration","underline"),$(o,"font-size",".8rem"),O(e,"class","svelte-1v1vn2x")},m(t,h){T(t,e,h),k(e,n),k(e,i),k(e,s),f.m(s,null),k(s,r),k(s,o),k(o,a),k(o,l),k(s,u),m&&m.m(s,null),k(e,c)},p(t,e){2&e&&$(n,"background",t[6](t[9].value)),p===(p=d(t))&&f?f.p(t,e):(f.d(1),f=p(t),f&&(f.c(),f.m(s,r))),2&e&&h!==(h=t[9].value+"")&&A(a,h),t[9].details?m?m.p(t,e):(m=Gi(t),m.c(),m.m(s,null)):m&&(m.d(1),m=null)},d(t){t&&C(e),f.d(),m&&m.d()}}}function Bi(t){let e,n=t[9].title+"";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){2&i&&n!==(n=t[9].title+"")&&A(e,n)},d(t){t&&C(e)}}}function Ki(t){let e,n,i,s=t[5][t[9].page-1].replace("...","")+"",r=t[9].title.toLowerCase()+"";return{c(){e=x(s),n=N(),i=x(r)},m(t,s){T(t,e,s),T(t,n,s),T(t,i,s)},p(t,n){34&n&&s!==(s=t[5][t[9].page-1].replace("...","")+"")&&A(e,s),2&n&&r!==(r=t[9].title.toLowerCase()+"")&&A(i,r)},d(t){t&&C(e),t&&C(n),t&&C(i)}}}function Gi(t){let e,n,i,s,r,o,a,l="fi"===t[3]?"Muistiinpanot":"Notes",u=t[9].details+"";return{c(){e=I("div"),n=I("b"),i=x(l),s=N(),r=I("br"),o=N(),a=x(u),$(e,"margin-top","1rem")}
3,m(t,l){T(t,e,l),k(e,n),k(n,i),k(e,s),k(e,r),k(e,o),k(e,a)},p(t,e){8&e&&l!==(l="fi"===t[3]?"Muistiinpanot":"Notes")&&A(i,l),2&e&&u!==(u=t[9].details+"")&&A(a,u)},d(t){t&&C(e)}}}function Yi(t){let e,n=0===t[9].type&&Vi(t);return{c(){n&&n.c(),e=R()},m(t,i){n&&n.m(t,i),T(t,e,i)},p(t,i){0===t[9].type?n?n.p(t,i):(n=Vi(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&C(e)}}}function Ji(e){let n,i,s,o,a,l,u,c,h,d,p,f,m,g=Lt[e[2]]+"",v=e[4][e[2]]+"",_=e[0]?"expand_more":"expand_less",y=e[0]&&Hi(e);return{c(){n=I("div"),i=I("div"),s=I("h3"),o=I("i"),a=x(g),l=N(),u=x(v),c=N(),h=I("i"),d=x(_),p=N(),y&&y.c(),O(o,"class","material-icons svelte-1v1vn2x"),O(s,"class","svelte-1v1vn2x"),O(h,"class","material-icons expand svelte-1v1vn2x"),O(i,"class","title-container svelte-1v1vn2x"),O(n,"data-category",e[2]),O(n,"class","category-info svelte-1v1vn2x")},m(t,r){T(t,n,r),k(n,i),k(i,s),k(s,o),k(o,a),k(s,l),k(s,u),k(i,c),k(i,h),k(h,d),k(n,p),y&&y.m(n,null),f||(m=[P(s,"click",e[7]),P(h,"click",e[8])],f=!0)},p(t,[e]){4&e&&g!==(g=Lt[t[2]]+"")&&A(a,g),20&e&&v!==(v=t[4][t[2]]+"")&&A(u,v),1&e&&_!==(_=t[0]?"expand_more":"expand_less")&&A(d,_),t[0]?y?y.p(t,e):(y=Hi(t),y.c(),y.m(n,null)):y&&(y.d(1),y=null),4&e&&O(n,"data-category",t[2])},i:t,o:t,d(t){t&&C(n),y&&y.d(),f=!1,r(m)}}}function Qi(t,e,n){let i;d(t,ae,(t=>n(3,i=t)));let{scores:s}=e,{index:r=0}=e,{show:o=!0}=e,a="fi"===i?Dt:Mt,l="fi"===i?Wt:Ht;return t.$$set=t=>{"scores"in t&&n(1,s=t.scores),"index"in t&&n(2,r=t.index),"show"in t&&n(0,o=t.show)},t.$$.update=()=>{8&t.$$.dirty&&i&&(n(4,a="fi"===i?Dt:Mt),n(5,l="fi"===i?Wt:Ht))},[o,s,r,i,a,l,function(t){return(t=1-(t/=100))<=Ft?"rgb(255, 51, 51)":t>Ft&&t<qt?"rgb(255, 170, 51)":t>=qt?"rgb(255, 235, 0)":void 0},()=>n(0,o=!o),()=>n(0,o=!o)]}class Xi extends Rt{constructor(t){super(),Nt(this,t,Qi,Ji,a,{scores:1,index:2,show:0})}}function Zi(t,e,n){const i=t.slice();return i[14]=e[n],i[16]=n,i}function ts(t){let e,n;return e=new Ui({props:{totalScores:t[2]}}),e.$on("select",t[7]),{c(){It(e.$$.fragment)},m(t,i){Et(e,t,i),n=!0},p(t,n){const i={};4&n&&(i.totalScores=t[2]),e.$set(i)},i(t){n||(vt(e.$$.fragment,t),n=!0)},o(t){_t(e.$$.fragment,t),n=!1},d(t){xt(e,t)}}}function es(t){let e,n,i,s="fi"==t[0]?"Pienennä kaikki":"Hide all";return{c(){e=I("i"),e.textContent="unfold_less",n=N(),i=x(s),O(e,"class","material-icons svelte-990uri")},m(t,s){T(t,e,s),T(t,n,s),T(t,i,s)},p(t,e){1&e&&s!==(s="fi"==t[0]?"Pienennä kaikki":"Hide all")&&A(i,s)},d(t){t&&C(e),t&&C(n),t&&C(i)}}}function ns(t){let e,n,i,s="fi"==t[0]?"Laajenna kaikki":"Show all";return{c(){e=I("i"),e.textContent="unfold_more",n=N(),i=x(s),O(e,"class","material-icons svelte-990uri")},m(t,s){T(t,e,s),T(t,n,s),T(t,i,s)},p(t,e){1&e&&s!==(s="fi"==t[0]?"Laajenna kaikki":"Show all")&&A(i,s)},d(t){t&&C(e),t&&C(n),t&&C(i)}}}function is(t){let e,n;return e=new Xi({props:{index:t[16],scores:t[14],show:!t[4]}}),{c(){It(e.$$.fragment)},m(t,i){Et(e,t,i),n=!0},p(t,n){const i={};8&n&&(i.scores=t[14]),16&n&&(i.show=!t[4]),e.$set(i)},i(t){n||(vt(e.$$.fragment,t),n=!0)},o(t){_t(e.$$.fragment,t),n=!1},d(t){xt(e,t)}}}function ss(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,E,R,j,D,M,L,F,q,U,W,H="fi"===t[0]?"Tulokset kategorioittain":"Results by category",z="fi"===t[0]?"Tee uudestaan":"Do again",V="fi"===t[0]?"Tallenna":"Save",B="fi"===t[0]?"Anna palautetta":"Give feedback",K=t[2].length>0&&ts(t);function G(t,e){return t[4]?ns:es}let Y=G(t),J=Y(t),X=t[3],Z=[];for(let e=0;e<X.length;e+=1)Z[e]=is(Zi(t,X,e));const tt=t=>_t(Z[t],1,1,(()=>{Z[t]=null}));function et(e){t[10](e)}let nt={onClick:t[5]};return void 0!==t[1]&&(nt.open=t[1]),L=new ii({props:nt}),Q.push((()=>St(L,"open",et))),{c(){K&&K.c(),e=N(),n=I("div"),i=I("h2"),s=x(H),o=N(),a=I("div"),l=I("button"),J.c(),u=N();for(let t=0;t<Z.length;t+=1)Z[t].c();c=N(),h=I("div"),d=I("button"),p=I("i"),p.textContent="redo",f=N(),m=x(z),g=N(),v=I("button"),_=I("i"),_.textContent="save",y=N(),w=x(V),b=N(),E=I("a"),R=I("i"),R.textContent="feedback",j=N(),D=x(B),M=N(),It(L.$$.fragment),O(i,"class","svelte-990uri"),O(l,"class","hide-btn svelte-990uri"),O(a,"class","selections svelte-990uri"),O(n,"class","categories svelte-990uri"),O(p,"class","material-icons svelte-990uri"),O(d,"class","btn btn-outline btn-primary svelte-990uri"),O(_,"class","material-icons svelte-990uri"),O(v,"class","btn btn-primary svelte-990uri"),O(h,"class","buttons evenly"),O(R,"class","material-icons"),$(R,"margin-right","0.5rem"),O(E,"class","btn btn-success feedback-btn svelte-990uri"),O(E,"type","button"),O(E,"href","https://elomake.samk.fi/lomakkeet/12540/lomake.html"),O(E,"target","_blank")},m(r,C){K&&K.m(r,C),T(r,e,C),T(r,n,C),k(n,i),k(i,s),k(n,o),k(n,a),k(a,l),J.m(l,null),k(n,u);for(let t=0;t<Z.length;t+=1)Z[t].m(n,null);T(r,c,C),T(r,h,C),k(h,d),k(d,p),k(d,f),k(d,m),k(h,g),k(h,v),k(v,_),k(v,y),k(v,w),T(r,b,C),T(r,E,C),k(E,R),k(E,j),k(E,D),T(r,M,C),Et(L,r,C),q=!0,U||(W=[P(l,"click",t[8]),P(d,"click",t[6]),P(v,"click",t[9])],U=!0)}
3,p(t,[i]){if(t[2].length>0?K?(K.p(t,i),4&i&&vt(K,1)):(K=ts(t),K.c(),vt(K,1),K.m(e.parentNode,e)):K&&(mt(),_t(K,1,1,(()=>{K=null})),gt()),(!q||1&i)&&H!==(H="fi"===t[0]?"Tulokset kategorioittain":"Results by category")&&A(s,H),Y===(Y=G(t))&&J?J.p(t,i):(J.d(1),J=Y(t),J&&(J.c(),J.m(l,null))),24&i){let e;for(X=t[3],e=0;e<X.length;e+=1){const s=Zi(t,X,e);Z[e]?(Z[e].p(s,i),vt(Z[e],1)):(Z[e]=is(s),Z[e].c(),vt(Z[e],1),Z[e].m(n,null))}for(mt(),e=X.length;e<Z.length;e+=1)tt(e);gt()}(!q||1&i)&&z!==(z="fi"===t[0]?"Tee uudestaan":"Do again")&&A(m,z),(!q||1&i)&&V!==(V="fi"===t[0]?"Tallenna":"Save")&&A(w,V),(!q||1&i)&&B!==(B="fi"===t[0]?"Anna palautetta":"Give feedback")&&A(D,B);const r={};!F&&2&i&&(F=!0,r.open=t[1],rt((()=>F=!1))),L.$set(r)},i(t){if(!q){vt(K);for(let t=0;t<X.length;t+=1)vt(Z[t]);vt(L.$$.fragment,t),q=!0}},o(t){_t(K),Z=Z.filter(Boolean);for(let t=0;t<Z.length;t+=1)_t(Z[t]);_t(L.$$.fragment,t),q=!1},d(t){K&&K.d(t),t&&C(e),t&&C(n),J.d(),S(Z,t),t&&C(c),t&&C(h),t&&C(b),t&&C(E),t&&C(M),xt(L,t),U=!1,r(W)}}}function rs(t,e,n){let i,s;d(t,ie,(t=>n(11,i=t))),d(t,ae,(t=>n(0,s=t)));let r=!1,o=[],a=[[],[],[],[]],l=!1;const u=[[],[],[],[]];function c(){n(2,o=[]),n(3,a=[[],[],[],[]]);const t=function(t){const e=[[],[],[],[]];for(let n=0;n<t.length;n++){let{group:i}=t[n];e[i-1].push(t[n])}return e}(function(t){const e=[...t];return e.sort((function(t,e){return e.value-t.value})),e}(i));for(let e=0;e<t.length;e++){let n,i=t[e];n=5>i.length?i.length:5;for(let t=0;t<n;t++)i[t].value>=5&&!i[t].skip&&a[e].push(i[t])}for(let t=0;t<i.length;t++){let{group:e,value:n,type:s,skip:r}=i[t];0===s&&n>=5&&!r&&u[e-1].push(n)}for(let t=0;t<u.length;t++){let e=u[t],i=0;for(let t=0;t<e.length;t++)i+=e[t];let s=Math.floor(i/e.length);n(2,o[t]=isNaN(s)?0:s,o)}n(2,o),n(3,a)}return t.$$.update=()=>{1&t.$$.dirty&&c()},[s,r,o,a,l,function(t,e){const n=JSON.stringify(i);"file"===e?function(t,e){const n=document.createElement("a"),i=new Blob([t],{type:"application/json"});n.href=URL.createObjectURL(i),n.download=e,n.click()}(n,t):"localStorage"===e&&localStorage.setItem(t,n)},function(){p(ie,i=p(ie,i=ue(i),i),i),group=1,page=1,ke(`/form/${group}/${page}`)},t=>{return e=t.detail.index,void document.querySelector(`[data-category="${e}"]`).scrollIntoView({behavior:"smooth"});var e},()=>n(4,l=!l),()=>n(1,r=!0),function(t){r=t,n(1,r)}]}class os extends Rt{constructor(t){super(),Nt(this,t,rs,ss,a,{})}}
4/**
5     * @license
6     * Copyright 2017 Google LLC
7     *
8     * Licensed under the Apache License, Version 2.0 (the "License");
9     * you may not use this file except in compliance with the License.
10     * You may obtain a copy of the License at
11     *
12     *   http://www.apache.org/licenses/LICENSE-2.0
13     *
14     * Unless required by applicable law or agreed to in writing, software
15     * distributed under the License is distributed on an "AS IS" BASIS,
16     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17     * See the License for the specific language governing permissions and
18     * limitations under the License.
19     */const as=!1,ls="${JSCORE_VERSION}",us=function(t,e){if(!t)throw cs(e)},cs=function(t){return new Error("Firebase Database ("+ls+") INTERNAL ASSERT FAILED: "+t)},hs=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},ds={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_,i=[];for(let e=0;e<t.length;e+=3){const s=t[e],r=e+1<t.length,o=r?t[e+1]:0,a=e+2<t.length,l=a?t[e+2]:0,u=s>>2,c=(3&s)<<4|o>>4;let h=(15&o)<<2|l>>6,d=63&l;a||(d=64,r||(h=64)),i.push(n[u],n[c],n[h],n[d])}return i.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(hs(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const s=t[n++];if(s<128)e[i++]=String.fromCharCode(s);else if(s>191&&s<224){const r=t[n++];e[i++]=String.fromCharCode((31&s)<<6|63&r)}else if(s>239&&s<365){const r=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(r>>10)),e[i++]=String.fromCharCode(56320+(1023&r))}else{const r=t[n++],o=t[n++];
vendor: 4,301 bytes, lines 19-80
19e[i++]=String.fromCharCode((15&s)<<12|(63&r)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let e=0;e<t.length;){const s=n[t.charAt(e++)],r=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==s||null==r||null==o||null==a)throw Error();const l=s<<2|r>>4;if(i.push(l),64!==o){const t=r<<4&240|o>>2;if(i.push(t),64!==a){const t=o<<6&192|a;i.push(t)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},ps=function(t){const e=hs(t);return ds.encodeByteArray(e,!0)},fs=function(t){return ps(t).replace(/\./g,"")},ms=function(t){try{return ds.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
20/**
21     * @license
22     * Copyright 2017 Google LLC
23     *
24     * Licensed under the Apache License, Version 2.0 (the "License");
25     * you may not use this file except in compliance with the License.
26     * You may obtain a copy of the License at
27     *
28     *   http://www.apache.org/licenses/LICENSE-2.0
29     *
30     * Unless required by applicable law or agreed to in writing, software
31     * distributed under the License is distributed on an "AS IS" BASIS,
32     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33     * See the License for the specific language governing permissions and
34     * limitations under the License.
35     */
36/**
37     * @license
38     * Copyright 2017 Google LLC
39     *
40     * Licensed under the Apache License, Version 2.0 (the "License");
41     * you may not use this file except in compliance with the License.
42     * You may obtain a copy of the License at
43     *
44     *   http://www.apache.org/licenses/LICENSE-2.0
45     *
46     * Unless required by applicable law or agreed to in writing, software
47     * distributed under the License is distributed on an "AS IS" BASIS,
48     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49     * See the License for the specific language governing permissions and
50     * limitations under the License.
51     */
52function gs(t){return vs(void 0,t)}function vs(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(const n in e)e.hasOwnProperty(n)&&"__proto__"!==n&&(t[n]=vs(t[n],e[n]));return t}
53/**
54     * @license
55     * Copyright 2017 Google LLC
56     *
57     * Licensed under the Apache License, Version 2.0 (the "License");
58     * you may not use this file except in compliance with the License.
59     * You may obtain a copy of the License at
60     *
61     *   http://www.apache.org/licenses/LICENSE-2.0
62     *
63     * Unless required by applicable law or agreed to in writing, software
64     * distributed under the License is distributed on an "AS IS" BASIS,
65     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66     * See the License for the specific language governing permissions and
67     * limitations under the License.
68     */
69class _s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}
70/**
71     * @license
72     * Copyright 2017 Google LLC
73     *
74     * Licensed under the Apache License, Version 2.0 (the "License");
75     * you may not use this file except in compliance with the License.
76     * You may obtain a copy of the License at
77     *
78     *   http://www.apache.org/licenses/LICENSE-2.0
79     *
80     * Unless required by applicable law or agreed to in writing, softw
80are
81     * distributed under the License is distributed on an "AS IS" BASIS,
82     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83     * See the License for the specific language governing permissions and
84     * limitations under the License.
85     */function ys(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function ks(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ys())}function ws(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function bs(){return!0===as}class Ts extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Ts.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Cs.prototype.create)}}class Cs{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},i=`${this.service}/${t}`,s=this.errors[t],r=s?function(t,e){return t.replace(Ss,((t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${r} (${i}).`;return new Ts(i,o,n)}}const Ss=/\{\$([^}]+)}/g;
86/**
87     * @license
88     * Copyright 2017 Google LLC
89     *
90     * Licensed under the Apache License, Version 2.0 (the "License");
91     * you may not use this file except in compliance with the License.
92     * You may obtain a copy of the License at
93     *
94     *   http://www.apache.org/licenses/LICENSE-2.0
95     *
96     * Unless required by applicable law or agreed to in writing, software
97     * distributed under the License is distributed on an "AS IS" BASIS,
98     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99     * See the License for the specific language governing permissions and
100     * limitations under the License.
101     */function Is(t){return JSON.parse(t)}function Es(t){return JSON.stringify(t)}
102/**
103     * @license
104     * Copyright 2017 Google LLC
105     *
106     * Licensed under the Apache License, Version 2.0 (the "License");
107     * you may not use this file except in compliance with the License.
108     * You may obtain a copy of the License at
109     *
110     *   http://www.apache.org/licenses/LICENSE-2.0
111     *
112     * Unless required by applicable law or agreed to in writing, software
113     * distributed under the License is distributed on an "AS IS" BASIS,
114     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115     * See the License for the specific language governing permissions and
116     * limitations under the License.
117     */const xs=function(t){let e={},n={},i={},s="";try{const r=t.split(".");e=Is(ms(r[0])||""),n=Is(ms(r[1])||""),s=r[2],i=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:i,signature:s}};
118/**
119     * @license
120     * Copyright 2017 Google LLC
121     *
122     * Licensed under the Apache License, Version 2.0 (the "License");
123     * you may not use this file except in compliance with the License.
124     * You may obtain a copy of the License at
125     *
126     *   http://www.apache.org/licenses/LICENSE-2.0
127     *
128     * Unless required by applicable law or agreed to in writing, software
129     * distributed under the License is distributed on an "AS IS" BASIS,
130     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131     * See the License for the specific language governing permissions and
132     * limitations under the License.
133     */
134function Ns(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Rs(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function Ps(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Os(t,e,n){const i={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=e.call(n,t[s],s,t));return i}function As(t,e){if(t===e)return!0;const n=Object.keys(t),i=Object.keys(e);for(const s of n){if(!i.includes(s))return!1;const n=t[s],r=e[s];if(js(n)&&js(r)){if(!As(n,r))return!1}else if(n!==r)return!1}for(const t of i)if(!n.includes(t))return!1;return!0}function js(t){return null!==t&&"object"==typeof t}
135/**
136     * @license
137     * Copyright 2017 Google LLC
138     *
139     * Licensed under the Apache License, Version 2.0 (the "License");
140     * you may not use this file except in compliance with the License.
141     * You may obtain a copy of the License at
142     *
143     *   http://www.apache.org/licenses/LICENSE-2.0
144     *
145     * Unless required by applicable law or agreed to in writing, software
146     * distributed under the License is distributed on an "AS IS" BASIS,
147     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
148     * See the License for the specific language governing permissions and
149     * limitations under the License.
150     */function $s(t){const e=[];for(const[n,i]of Object.entries(t))Array.isArray(i)?i.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}
151/**
152     * @license
153     * Copyright 2017 Google LLC
154     *
155     * Licensed under the Apache License, Version 2.0 (the "License");
156     * you may not use this file except in compliance with the License.
157     * You may obtain a copy of the License at
158     *
159     *   http://www.apache.org/licenses/LICENSE-2.0
160     *
161     * Unless required by applicable law or agreed to in writing, software
162     * distributed under the License is distributed on an "AS IS" BASIS,
163     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164     * See the License for the specific language governing permissions and
165     * limitations under the License.
166     */class Ds{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(t,e){e||(e=0);const n=this.W_;if("string"==typeof t)for(let i=0;i<16;i++)n[i]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(let i=0;i<16;i++)n[i]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(let t=16;t<80;t++){const e=n[t-3]^n[t-8]^n[t-14]^n[t-16];n[t]=4294967295&(e<<1|e>>>31)}let i,s,r=this.chain_[0],o=this.chain_[1],a=this.chain_[2],l=this.chain_[3],u=this.chain_[4];for(let t=0;t<80;t++){t<40?t<20?(i=l^o&(a^l),s=1518500249):(i=o^a^l,s=1859775393):t<60?(i=o&a|l&(o|a),s=2400959708):(i=o^a^l,s=3395469782);const e=(r<<5|r>>>27)+i+u+s+n[t]&4294967295;u=l,l=a,a=4294967295&(o<<30|o>>>2),o=r,r=e}this.chain_[0]=this.chain_[0]+r&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+u&4294967295}update(t,e){if(null==t)return;void 0===e&&(e=t.length);const n=e-this.blockSize;let i=0;const s=this.buf_;let r=this.inbuf_;for(;i<e;){if(0===r)for(;i<=n;)this.compress_(t,i),i+=this.blockSize;if("string"==typeof t){for(;i<e;)if(s[r]=t.charCodeAt(i),++r,++i,r===this.blockSize){this.compress_(s),r=0;break}}else for(;i<e;)if(s[r]=t[i],++r,++i,r===this.blockSize){this.compress_(s),r=0;break}}this.inbuf_=r,this.total_+=e}digest(){const t=[];let e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let t=this.blockSize-1;t>=56;t--)this.buf_[t]=255&e,e/=256;this.compress_(this.buf_);let n=0;for(let e=0;e<5;e++)for(let i=24;i>=0;i-=8)t[n]=this.chain_[e]>>i&255,++n;return t}}class Ms{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 i;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");i=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===i.next&&(i.next=Ls),void 0===i.error&&(i.error=Ls),void 0===i.complete&&(i.complete=Ls);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(t){}})),this.observers.push(i),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(
166delete 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 Ls(){}
167/**
168     * @license
169     * Copyright 2017 Google LLC
170     *
171     * Licensed under the Apache License, Version 2.0 (the "License");
172     * you may not use this file except in compliance with the License.
173     * You may obtain a copy of the License at
174     *
175     *   http://www.apache.org/licenses/LICENSE-2.0
176     *
177     * Unless required by applicable law or agreed to in writing, software
178     * distributed under the License is distributed on an "AS IS" BASIS,
179     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180     * See the License for the specific language governing permissions and
181     * limitations under the License.
182     */
183const Fs=function(t){let e=0;for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);i<128?e++:i<2048?e+=2:i>=55296&&i<=56319?(e+=4,n++):e+=3}return e};
184/**
185     * @license
186     * Copyright 2021 Google LLC
187     *
188     * Licensed under the Apache License, Version 2.0 (the "License");
189     * you may not use this file except in compliance with the License.
190     * You may obtain a copy of the License at
191     *
192     *   http://www.apache.org/licenses/LICENSE-2.0
193     *
194     * Unless required by applicable law or agreed to in writing, software
195     * distributed under the License is distributed on an "AS IS" BASIS,
196     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
197     * See the License for the specific language governing permissions and
198     * limitations under the License.
199     */
200function qs(t){return t&&t._delegate?t._delegate:t}
201/**
202     * @license
203     * Copyright 2022 Google LLC
204     *
205     * Licensed under the Apache License, Version 2.0 (the "License");
206     * you may not use this file except in compliance with the License.
207     * You may obtain a copy of the License at
208     *
209     *   http://www.apache.org/licenses/LICENSE-2.0
210     *
211     * Unless required by applicable law or agreed to in writing, software
212     * distributed under the License is distributed on an "AS IS" BASIS,
213     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214     * See the License for the specific language governing permissions and
215     * limitations under the License.
216     */function Us(t,e){return new Promise(((n,i)=>{t.onsuccess=t=>{n(t.target.result)},t.onerror=t=>{var n;i(`${e}: ${null===(n=t.target.error)||void 0===n?void 0:n.message}`)}}))}class Ws{constructor(t){this._db=t,this.objectStoreNames=this._db.objectStoreNames}transaction(t,e){return new Hs(this._db.transaction.call(this._db,t,e))}createObjectStore(t,e){return new zs(this._db.createObjectStore(t,e))}close(){this._db.close()}}class Hs{constructor(t){this._transaction=t,this.complete=new Promise(((t,e)=>{this._transaction.oncomplete=function(){t()},this._transaction.onerror=()=>{e(this._transaction.error)},this._transaction.onabort=()=>{e(this._transaction.error)}}))}objectStore(t){return new zs(this._transaction.objectStore(t))}}class zs{constructor(t){this._store=t}index(t){return new Vs(this._store.index(t))}createIndex(t,e,n){return new Vs(this._store.createIndex(t,e,n))}get(t){return Us(this._store.get(t),"Error reading from IndexedDB")}put(t,e){return Us(this._store.put(t,e),"Error writing to IndexedDB")}delete(t){return Us(this._store.delete(t),"Error deleting from IndexedDB")}clear(){return Us(this._store.clear(),"Error clearing IndexedDB object store")}}class Vs{constructor(t){this._index=t}get(t){return Us(this._index.get(t),"Error reading from IndexedDB")}}class Bs{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}}
217/**
218     * @license
219     * Copyright 2019 Google LLC
220     *
221     * Licensed under the Apache License, Version 2.0 (the "License");
222     * you may not use this file except in compliance with the License.
223     * You may obtain a copy of the License at
224     *
225     *   http://www.apache.org/licenses/LICENSE-2.0
226     *
227     * Unless required by applicable law or agreed to in writing, software
228     * distributed under the License is distributed on an "AS IS" BASIS,
229     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
230     * See the License for the specific language governing permissions and
231     * limitations under the License.
232     */const Ks="[DEFAULT]";
233/**
234     * @license
235     * Copyright 2019 Google LLC
236     *
237     * Licensed under the Apache License, Version 2.0 (the "License");
238     * you may not use this file except in compliance with the License.
239     * You may obtain a copy of the License at
240     *
241     *   http://www.apache.org/licenses/LICENSE-2.0
242     *
243     * Unless required by applicable law or agreed to in writing, software
244     * distributed under the License is distributed on an "AS IS" BASIS,
245     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
246     * See the License for the specific language governing permissions and
247     * limitations under the License.
248     */class Gs{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new _s;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),i=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(i)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
249/**
250     * @license
251     * Copyright 2019 Google LLC
252     *
253     * Licensed under the Apache License, Version 2.0 (the "License");
254     * you may not use this file except in compliance with the License.
255     * You may obtain a copy of the License at
256     *
257     *   http://www.apache.org/licenses/LICENSE-2.0
258     *
259     * Unless required by applicable law or agreed to in writing, software
260     * distributed under the License is distributed on an "AS IS" BASIS,
261     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
262     * See the License for the specific language governing permissions and
263     * limitations under the License.
264     */(t))try{this.getOrInitializeService({instanceIdentifier:Ks})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t="[DEFAULT]"){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t="[DEFAULT]"){return this.instances.has(t)}getOptions(t="[DEFAULT]"){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(i)}return i}onInit(t,e){var n;const i=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(i,s);const r=this.instances.get(i);return r&&t(r,i),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const i of n)try{i(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(i=t,i===Ks?void 0:i),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var i;return n||null}normalizeInstanceIdentifier(t="[DEFAULT]"){return this.component?this.component.multipleInstances?t:Ks:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Ys{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new Gs(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
265/**
266     * @license
267     * Copyright 2017 Google LLC
268     *
269     * Licensed under the Apache License, Version 2.0 (the "License");
270     * you may not use this file except in compliance with the License.
271     * You may obtain a copy of the License at
272     *
273     *   http://www.apache.org/licenses/LICENSE-2.0
274     *
275     * Unless required by applicable law or agreed to in writing, software
276     * distributed under the License is distributed on an "AS IS" BASIS,
277     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278     * See the License for the specific language governing permissions and
279     * limitations under the License.
280     */var Js;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(Js||(Js={}));const Qs={debug:Js.DEBUG,verbose:Js.VERBOSE,info:Js.INFO,warn:Js.WARN,error:Js.ERROR,silent:Js.SILENT},Xs=Js.INFO,Zs={[Js.DEBUG]:"log",[Js.VERBOSE]:"log",[Js.INFO]:"info",[Js.WARN]:"warn",[Js.ERROR]:"error"},tr=(t,e,...n)=>{if(e<t.logLevel)return;const i=(new Date).toISOString(),s=Zs[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${i}]  ${t.name}:`,...n)};class er{constructor(t){this.name=t,this._logLevel=Xs,this._logHandler=tr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Js))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?Qs[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,Js.DEBUG,...t),this._logHandler(this,Js.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Js.VERBOSE,...t),this._logHandler(this,Js.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Js.INFO,...t),this._logHandler(this,Js.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Js.WARN,...t),this._logHandler(this,Js.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Js.ERROR,...t),this._logHandler(this,Js.ERROR,...t)}}
281/**
282     * @license
283     * Copyright 2019 Google LLC
284     *
285     * Licensed under the Apache License, Version 2.0 (the "License");
286     * you may not use this file except in compliance with the License.
287     * You may obtain a copy of the License at
288     *
289     *   http://www.apache.org/licenses/LICENSE-2.0
290     *
291     * Unless required by applicable law or agreed to in writing, software
292     * distributed under the License is distributed on an "AS IS" BASIS,
293     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
294     * See the License for the specific language governing permissions and
295     * limitations under the License.
296     */class nr{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 ir="@firebase/app",sr="0.7.20",rr=new er("@firebase/app"),or="[DEFAULT]",ar={[ir]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},lr=new Map,ur=new Map;function cr(t,e){try{t.container.addComponent(e)}catch(n){rr.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function hr(t){const e=t.name;if(ur.has(e))return rr.debug(`There were multiple attempts to register component ${e}.`),!1;ur.set(e,t);for(const e of lr.values())cr(e,t);return!0}function dr(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
297/**
298     * @license
299     * Copyright 2019 Google LLC
300     *
301     * Licensed under the Apache License, Version 2.0 (the "License");
302     * you may not use this file except in compliance with the License.
303     * You may obtain a copy of the License at
304     *
305     *   http://www.apache.org/licenses/LICENSE-2.0
306     *
307     * Unless required by applicable law or agreed to in writing, software
308     * distributed under the License is distributed on an "AS IS" BASIS,
309     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310     * See the License for the specific language governing permissions and
311     * limitations under the License.
312     */const pr=new Cs("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}."});
313/**
314     * @license
315     * Copyright 2019 Google LLC
316     *
317     * Licensed under the Apache License, Version 2.0 (the "License");
318     * you may not use this file except in compliance with the License.
319     * You may obtain a copy of the License at
320     *
321     *   http://www.apache.org/licenses/LICENSE-2.0
322     *
323     * Unless required by applicable law or agreed to in writing, software
324     * distributed under the License is distributed on an "AS IS" BASIS,
325     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
326     * See the License for the specific language governing permissions and
327     * limitations under the License.
328     */
329class fr{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Bs("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw pr.create("app-deleted",{appName:this._name})}}
330/**
331     * @license
332     * Copyright 2019 Google LLC
333     *
334     * Licensed under the Apache License, Version 2.0 (the "License");
335     * you may not use this file except in compliance with the License.
336     * You may obtain a copy of the License at
337     *
338     *   http://www.apache.org/licenses/LICENSE-2.0
339     *
340     * Unless required by applicable law or agreed to in writing, software
341     * distributed under the License is distributed on an "AS IS" BASIS,
342     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
343     * See the License for the specific language governing permissions and
344     * limitations under the License.
345     */const mr="9.6.10";function gr(t="[DEFAULT]"){const e=lr.get(t);if(!e)throw pr.create("no-app",{appName:t});return e}function vr(t,e,n){var i;let s=null!==(i=ar[t])&&void 0!==i?i:t;n&&(s+=`-${n}`);const r=s.match(/\s|\//),o=e.match(/\s|\//);if(r||o){const t=[`Unable to register library "${s}" with version "${e}":`];return r&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),r&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void rr.warn(t.join(" "))}hr(new Bs(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
346/**
347     * @license
348     * Copyright 2021 Google LLC
349     *
350     * Licensed under the Apache License, Version 2.0 (the "License");
351     * you may not use this file except in compliance with the License.
352     * You may obtain a copy of the License at
353     *
354     *   http://www.apache.org/licenses/LICENSE-2.0
355     *
356     * Unless required by applicable law or agreed to in writing, software
357     * distributed under the License is distributed on an "AS IS" BASIS,
358     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359     * See the License for the specific language governing permissions and
360     * limitations under the License.
361     */const _r="firebase-heartbeat-store";let yr=null;function kr(){var t,e,n;return yr||(yr=(t="firebase-heartbeat-database",e=1,n=(t,e)=>{0===e&&t.createObjectStore(_r)},new Promise(((i,s)=>{try{const r=indexedDB.open(t,e);r.onsuccess=t=>{i(new Ws(t.target.result))},r.onerror=t=>{var e;s(`Error opening indexedDB: ${null===(e=t.target.error)||void 0===e?void 0:e.message}`)},r.onupgradeneeded=t=>{n(new Ws(r.result),t.oldVersion,t.newVersion,new Hs(r.transaction))}}catch(t){s(`Error opening indexedDB: ${t.message}`)}}))).catch((t=>{throw pr.create("storage-open",{originalErrorMessage:t.message})}))),yr}async function wr(t,e){try{const n=(await kr()).transaction(_r,"readwrite"),i=n.objectStore(_r);return await i.put(e,br(t)),n.complete}catch(t){throw pr.create("storage-set",{originalErrorMessage:t.message})}}function br(t){return`${t.name}!${t.options.appId}`}
362/**
363     * @license
364     * Copyright 2021 Google LLC
365     *
366     * Licensed under the Apache License, Version 2.0 (the "License");
367     * you may not use this file except in compliance with the License.
368     * You may obtain a copy of the License at
369     *
370     *   http://www.apache.org/licenses/LICENSE-2.0
371     *
372     * Unless required by applicable law or agreed to in writing, software
373     * distributed under the License is distributed on an "AS IS" BASIS,
374     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
375     * See the License for the specific language governing permissions and
376     * limitations under the License.
377     */class Tr{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Sr(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=Cr();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}
vendor: 4,667 bytes, lines 377-413
377async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=Cr(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let i=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),Ir(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Ir(n)>e){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),i=fs(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function Cr(){return(new Date).toISOString().substring(0,10)}class Sr{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return"object"==typeof indexedDB&&new Promise(((t,e)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(i);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(i),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{return(await kr()).transaction(_r).objectStore(_r).get(br(t))}catch(t){throw pr.create("storage-get",{originalErrorMessage:t.message})}}(this.app);return t||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return wr(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return wr(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Ir(t){return fs(JSON.stringify({version:2,heartbeats:t})).length}
378/**
379     * @license
380     * Copyright 2019 Google LLC
381     *
382     * Licensed under the Apache License, Version 2.0 (the "License");
383     * you may not use this file except in compliance with the License.
384     * You may obtain a copy of the License at
385     *
386     *   http://www.apache.org/licenses/LICENSE-2.0
387     *
388     * Unless required by applicable law or agreed to in writing, software
389     * distributed under the License is distributed on an "AS IS" BASIS,
390     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
391     * See the License for the specific language governing permissions and
392     * limitations under the License.
393     */var Er;Er="",hr(new Bs("platform-logger",(t=>new nr(t)),"PRIVATE")),hr(new Bs("heartbeat",(t=>new Tr(t)),"PRIVATE")),vr(ir,sr,Er),vr(ir,sr,"esm2017"),vr("fire-js","");
394/*! *****************************************************************************
395    Copyright (c) Microsoft Corporation.
396
397    Permission to use, copy, modify, and/or distribute this software for any
398    purpose with or without fee is hereby granted.
399
400    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
401    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
402    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
403    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
404    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
405    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
406    PERFORMANCE OF THIS SOFTWARE.
407    ***************************************************************************** */
408function xr(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n}function Nr(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}
409/**
410     * @license
411     * Copyright 2020 Google LLC
412     *
413     * Licensed under the Apache License, Version 2.0 (the "License");
414     * you may not use this file except in compliance with the License.
415     * You may obtain a copy of the License at
416     *
417     *   http://www.apache.org/licenses/LICENSE-2.0
418     *
419     * Unless required by applicable law or agreed to in writing, software
420     * distributed under the License is distributed on an "AS IS" BASIS,
421     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
422     * See the License for the specific language governing permissions and
423     * limitations under the License.
424     */
425vr("firebase","9.6.10","app");const Rr=Nr,Pr=new Cs("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Or=new er("@firebase/auth");function Ar(t,...e){Or.logLevel<=Js.ERROR&&Or.error(`Auth (9.6.10): ${t}`,...e)}
426/**
427     * @license
428     * Copyright 2020 Google LLC
429     *
430     * Licensed under the Apache License, Version 2.0 (the "License");
431     * you may not use this file except in compliance with the License.
432     * You may obtain a copy of the License at
433     *
434     *   http://www.apache.org/licenses/LICENSE-2.0
435     *
436     * Unless required by applicable law or agreed to in writing, software
437     * distributed under the License is distributed on an "AS IS" BASIS,
438     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
439     * See the License for the specific language governing permissions and
440     * limitations under the License.
441     */function jr(t,...e){throw Dr(t,...e)}function $r(t,...e){return Dr(t,...e)}function Dr(t,...e){if("string"!=typeof t){const n=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=t.name),t._errorFactory.create(n,...i)}return Pr.create(t,...e)}function Mr(t,e,...n){if(!t)throw Dr(e,...n)}function Lr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ar(e),new Error(e)}function Fr(t,e){t||Lr(e)}
442/**
443     * @license
444     * Copyright 2020 Google LLC
445     *
446     * Licensed under the Apache License, Version 2.0 (the "License");
447     * you may not use this file except in compliance with the License.
448     * You may obtain a copy of the License at
449     *
450     *   http://www.apache.org/licenses/LICENSE-2.0
451     *
452     * Unless required by applicable law or agreed to in writing, software
453     * distributed under the License is distributed on an "AS IS" BASIS,
454     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
455     * See the License for the specific language governing permissions and
456     * limitations under the License.
457     */const qr=new Map;function Ur(t){Fr(t instanceof Function,"Expected a class definition");let e=qr.get(t);return e?(Fr(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,qr.set(t,e),e)}
458/**
459     * @license
460     * Copyright 2020 Google LLC
461     *
462     * Licensed under the Apache License, Version 2.0 (the "License");
463     * you may not use this file except in compliance with the License.
464     * You may obtain a copy of the License at
465     *
466     *   http://www.apache.org/licenses/LICENSE-2.0
467     *
468     * Unless required by applicable law or agreed to in writing, software
469     * distributed under the License is distributed on an "AS IS" BASIS,
470     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
471     * See the License for the specific language governing permissions and
472     * limitations under the License.
473     */
474/**
475     * @license
476     * Copyright 2020 Google LLC
477     *
478     * Licensed under the Apache License, Version 2.0 (the "License");
479     * you may not use this file except in compliance with the License.
480     * You may obtain a copy of the License at
481     *
482     *   http://www.apache.org/licenses/LICENSE-2.0
483     *
484     * Unless required by applicable law or agreed to in writing, software
485     * distributed under the License is distributed on an "AS IS" BASIS,
486     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487     * See the License for the specific language governing permissions and
488     * limitations under the License.
489     */
490function Wr(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Hr(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
491/**
492     * @license
493     * Copyright 2020 Google LLC
494     *
495     * Licensed under the Apache License, Version 2.0 (the "License");
496     * you may not use this file except in compliance with the License.
497     * You may obtain a copy of the License at
498     *
499     *   http://www.apache.org/licenses/LICENSE-2.0
500     *
501     * Unless required by applicable law or agreed to in writing, software
502     * distributed under the License is distributed on an "AS IS" BASIS,
503     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
504     * See the License for the specific language governing permissions and
505     * limitations under the License.
506     */function zr(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Hr()&&"https:"!==Hr()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
507/**
508     * @license
509     * Copyright 2020 Google LLC
510     *
511     * Licensed under the Apache License, Version 2.0 (the "License");
512     * you may not use this file except in compliance with the License.
513     * You may obtain a copy of the License at
514     *
515     *   http://www.apache.org/licenses/LICENSE-2.0
516     *
517     * Unless required by applicable law or agreed to in writing, software
518     * distributed under the License is distributed on an "AS IS" BASIS,
519     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
520     * See the License for the specific language governing permissions and
521     * limitations under the License.
522     */
523class Vr{constructor(t,e){this.shortDelay=t,this.longDelay=e,Fr(e>t,"Short delay should be less than long delay!"),this.isMobile=ks()||ws()}get(){return zr()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
524/**
525     * @license
526     * Copyright 2020 Google LLC
527     *
528     * Licensed under the Apache License, Version 2.0 (the "License");
529     * you may not use this file except in compliance with the License.
530     * You may obtain a copy of the License at
531     *
532     *   http://www.apache.org/licenses/LICENSE-2.0
533     *
534     * Unless required by applicable law or agreed to in writing, software
535     * distributed under the License is distributed on an "AS IS" BASIS,
536     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
537     * See the License for the specific language governing permissions and
538     * limitations under the License.
539     */function Br(t,e){Fr(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
540/**
541     * @license
542     * Copyright 2020 Google LLC
543     *
544     * Licensed under the Apache License, Version 2.0 (the "License");
545     * you may not use this file except in compliance with the License.
546     * You may obtain a copy of the License at
547     *
548     *   http://www.apache.org/licenses/LICENSE-2.0
549     *
550     * Unless required by applicable law or agreed to in writing, software
551     * distributed under the License is distributed on an "AS IS" BASIS,
552     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553     * See the License for the specific language governing permissions and
554     * limitations under the License.
555     */class Kr{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void Lr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void Lr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void Lr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
556/**
557     * @license
558     * Copyright 2020 Google LLC
559     *
560     * Licensed under the Apache License, Version 2.0 (the "License");
561     * you may not use this file except in compliance with the License.
562     * You may obtain a copy of the License at
563     *
564     *   http://www.apache.org/licenses/LICENSE-2.0
565     *
566     * Unless required by applicable law or agreed to in writing, software
567     * distributed under the License is distributed on an "AS IS" BASIS,
568     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569     * See the License for the specific language governing permissions and
570     * limitations under the License.
571     */const Gr={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Yr=new Vr(3e4,6e4);
572/**
573     * @license
574     * Copyright 2020 Google LLC
575     *
576     * Licensed under the Apache License, Version 2.0 (the "License");
577     * you may not use this file except in compliance with the License.
578     * You may obtain a copy of the License at
579     *
580     *   http://www.apache.org/licenses/LICENSE-2.0
581     *
582     * Unless required by applicable law or agreed to in writing, software
583     * distributed under the License is distributed on an "AS IS" BASIS,
584     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
585     * See the License for the specific language governing permissions and
586     * limitations under the License.
587     */function Jr(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Qr(t,e,n,i,s={}){return Xr(t,s,(async()=>{let s={},r={};i&&("GET"===e?r=i:s={body:JSON.stringify(i)});const o=$s(Object.assign({key:t.config.apiKey},r)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Kr.fetch()(to(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Xr(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},Gr),e);try{const e=new eo(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const r=await s.json();if("needConfirmation"in r)throw no(t,"account-exists-with-different-credential",r);if(s.ok&&!("errorMessage"in r))return r;{const e=s.ok?r.errorMessage:r.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw no(t,"credential-already-in-use",r);if("EMAIL_EXISTS"===n)throw no(t,"email-already-in-use",r);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const i=Object.assign(Object.assign({},Rr()),{[e]:n});return new Cs("auth","Firebase",i).create(e,{appName:t.name})}(t,a,o);jr(t,a)}}catch(e){if(e instanceof Ts)throw e;jr(t,"network-request-failed")}}async function Zr(t,e,n,i,s={}){const r=await Qr(t,e,n,i,s);return"mfaPendingCredential"in r&&jr(t,"multi-factor-auth-required",{_serverResponse:r}),r}function to(t,e,n,i){const s=`${e}${n}?${i}`;return t.config.emulator?Br(t.config,s):`${t.config.apiScheme}://${s}`}class eo{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e($r(this.auth,"network-request-failed"))),Yr.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function no(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const s=$r(t,e,i);return s.customData._tokenResponse=n,s}
588/**
589     * @license
590     * Copyright 2020 Google LLC
591     *
592     * Licensed under the Apache License, Version 2.0 (the "License");
593     * you may not use this file except in compliance with the License.
594     * You may obtain a copy of the License at
595     *
596     *   http://www.apache.org/licenses/LICENSE-2.0
597     *
598     * Unless required by applicable law or agreed to in writing, software
599     * distributed under the License is distributed on an "AS IS" BASIS,
600     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
601     * See the License for the specific language governing permissions and
602     * limitations under the License.
603     */
604/**
605     * @license
606     * Copyright 2020 Google LLC
607     *
608     * Licensed under the Apache License, Version 2.0 (the "License");
609     * you may not use this file except in compliance with the License.
610     * You may obtain a copy of the License at
611     *
612     *   http://www.apache.org/licenses/LICENSE-2.0
613     *
614     * Unless required by applicable law or agreed to in writing, software
615     * distributed under the License is distributed on an "AS IS" BASIS,
616     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
617     * See the License for the specific language governing permissions and
618     * limitations under the License.
619     */
620function io(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function so(t){return 1e3*Number(t)}function ro(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return Ar("JWT malformed, contained fewer than 3 sections"),null;try{const t=ms(n);return t?JSON.parse(t):(Ar("Failed to decode base64 JWT payload"),null)}catch(t){return Ar("Caught error parsing JWT payload as JSON",t),null}}
621/**
622     * @license
623     * Copyright 2020 Google LLC
624     *
625     * Licensed under the Apache License, Version 2.0 (the "License");
626     * you may not use this file except in compliance with the License.
627     * You may obtain a copy of the License at
628     *
629     *   http://www.apache.org/licenses/LICENSE-2.0
630     *
631     * Unless required by applicable law or agreed to in writing, software
632     * distributed under the License is distributed on an "AS IS" BASIS,
633     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
634     * See the License for the specific language governing permissions and
635     * limitations under the License.
636     */
637async function oo(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof Ts&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
638/**
639     * @license
640     * Copyright 2020 Google LLC
641     *
642     * Licensed under the Apache License, Version 2.0 (the "License");
643     * you may not use this file except in compliance with the License.
644     * You may obtain a copy of the License at
645     *
646     *   http://www.apache.org/licenses/LICENSE-2.0
647     *
648     * Unless required by applicable law or agreed to in writing, software
649     * distributed under the License is distributed on an "AS IS" BASIS,
650     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
651     * See the License for the specific language governing permissions and
652     * limitations under the License.
653     */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class ao{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===t.code&&this.schedule(!0))}this.schedule()}}
654/**
655     * @license
656     * Copyright 2020 Google LLC
657     *
658     * Licensed under the Apache License, Version 2.0 (the "License");
659     * you may not use this file except in compliance with the License.
660     * You may obtain a copy of the License at
661     *
662     *   http://www.apache.org/licenses/LICENSE-2.0
663     *
664     * Unless required by applicable law or agreed to in writing, software
665     * distributed under the License is distributed on an "AS IS" BASIS,
666     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
667     * See the License for the specific language governing permissions and
668     * limitations under the License.
669     */class lo{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=io(this.lastLoginAt),this.creationTime=io(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
670/**
671     * @license
672     * Copyright 2019 Google LLC
673     *
674     * Licensed under the Apache License, Version 2.0 (the "License");
675     * you may not use this file except in compliance with the License.
676     * You may obtain a copy of the License at
677     *
678     *   http://www.apache.org/licenses/LICENSE-2.0
679     *
680     * Unless required by applicable law or agreed to in writing, software
681     * distributed under the License is distributed on an "AS IS" BASIS,
682     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
683     * See the License for the specific language governing permissions and
684     * limitations under the License.
685     */async function uo(t){var e;const n=t.auth,i=await t.getIdToken(),s=await oo(t,async function(t,e){return Qr(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:i}));Mr(null==s?void 0:s.users.length,n,"internal-error");const r=s.users[0];t._notifyReloadListener(r);const o=(null===(e=r.providerUserInfo)||void 0===e?void 0:e.length)?r.providerUserInfo.map((t=>{var{providerId:e}=t,n=xr(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(l=t.providerData,u=o,[...l.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var l,u;const c=t.isAnonymous,h=!(t.email&&r.passwordHash||(null==a?void 0:a.length)),d=!!c&&h,p={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new lo(r.createdAt,r.lastLoginAt),isAnonymous:d};Object.assign(t,p)}
686/**
687     * @license
688     * Copyright 2020 Google LLC
689     *
690     * Licensed under the Apache License, Version 2.0 (the "License");
691     * you may not use this file except in compliance with the License.
692     * You may obtain a copy of the License at
693     *
694     *   http://www.apache.org/licenses/LICENSE-2.0
695     *
696     * Unless required by applicable law or agreed to in writing, software
697     * distributed under the License is distributed on an "AS IS" BASIS,
698     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
699     * See the License for the specific language governing permissions and
700     * limitations under the License.
701     */
702class co{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Mr(t.idToken,"internal-error"),Mr(void 0!==t.idToken,"internal-error"),Mr(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=ro(t);return Mr(e,"internal-error"),Mr(void 0!==e.exp,"internal-error"),Mr(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return Mr(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:i,expiresIn:s}=await
703/**
704     * @license
705     * Copyright 2020 Google LLC
706     *
707     * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 21,172 bytes, lines 708-821
708     * you may not use this file except in compliance with the License.
709     * You may obtain a copy of the License at
710     *
711     *   http://www.apache.org/licenses/LICENSE-2.0
712     *
713     * Unless required by applicable law or agreed to in writing, software
714     * distributed under the License is distributed on an "AS IS" BASIS,
715     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
716     * See the License for the specific language governing permissions and
717     * limitations under the License.
718     */
719async function(t,e){const n=await Xr(t,{},(async()=>{const n=$s({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,r=to(t,i,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Kr.fetch()(r,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,i,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:i,expirationTime:s}=e,r=new co;return n&&(Mr("string"==typeof n,"internal-error",{appName:t}),r.refreshToken=n),i&&(Mr("string"==typeof i,"internal-error",{appName:t}),r.accessToken=i),s&&(Mr("number"==typeof s,"internal-error",{appName:t}),r.expirationTime=s),r}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new co,this.toJSON())}_performRefresh(){return Lr("not implemented")}}
720/**
721     * @license
722     * Copyright 2020 Google LLC
723     *
724     * Licensed under the Apache License, Version 2.0 (the "License");
725     * you may not use this file except in compliance with the License.
726     * You may obtain a copy of the License at
727     *
728     *   http://www.apache.org/licenses/LICENSE-2.0
729     *
730     * Unless required by applicable law or agreed to in writing, software
731     * distributed under the License is distributed on an "AS IS" BASIS,
732     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
733     * See the License for the specific language governing permissions and
734     * limitations under the License.
735     */function ho(t,e){Mr("string"==typeof t||void 0===t,"internal-error",{appName:e})}class po{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,s=xr(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ao(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new lo(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await oo(this,this.stsTokenManager.getToken(this.auth,t));return Mr(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=qs(t),i=await n.getIdToken(e),s=ro(i);Mr(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const r="object"==typeof s.firebase?s.firebase:void 0,o=null==r?void 0:r.sign_in_provider;return{claims:s,token:i,authTime:io(so(s.auth_time)),issuedAtTime:io(so(s.iat)),expirationTime:io(so(s.exp)),signInProvider:o||null,signInSecondFactor:(null==r?void 0:r.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=qs(t);await uo(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Mr(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 po(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){Mr(!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 uo(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await oo(this,async function(t,e){return Qr(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,i,s,r,o,a,l,u;const c=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(i=e.email)&&void 0!==i?i:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,p=null!==(r=e.photoURL)&&void 0!==r?r:void 0,f=null!==(o=e.tenantId)&&void 0!==o?o:void 0,m=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,g=null!==(l=e.createdAt)&&void 0!==l?l:void 0,v=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:_,emailVerified:y,isAnonymous:k,providerData:w,stsTokenManager:b}=e;Mr(_&&b,t,"internal-error");const T=co.fromJSON(this.name,b);Mr("string"==typeof _,t,"internal-error"),ho(c,t.name),ho(h,t.name),Mr("boolean"==typeof y,t,"internal-error"),Mr("boolean"==typeof k,t,"internal-error"),ho(d,t.name),ho(p,t.name),ho(f,t.name),ho(m,t.name),ho(g,t.name),ho(v,t.name);const C=new po({uid:_,auth:t,email:h,emailVerified:y,displayName:c,isAnonymous:k,photoURL:p,phoneNumber:d,tenantId:f,stsTokenManager:T,createdAt:g,lastLoginAt:v});return w&&Array.isArray(w)&&(C.providerData=w.map((t=>Object.assign({},t)))),m&&(C._redirectEventId=m),C}static async _fromIdTokenResponse(t,e,n=!1){const i=new co;i.updateFromServerResponse(e);const s=new po({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await uo(s),s}}
736/**
737     * @license
738     * Copyright 2019 Google LLC
739     *
740     * Licensed under the Apache License, Version 2.0 (the "License");
741     * you may not use this file except in compliance with the License.
742     * You may obtain a copy of the License at
743     *
744     *   http://www.apache.org/licenses/LICENSE-2.0
745     *
746     * Unless required by applicable law or agreed to in writing, software
747     * distributed under the License is distributed on an "AS IS" BASIS,
748     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
749     * See the License for the specific language governing permissions and
750     * limitations under the License.
751     */class fo{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){}}fo.type="NONE";const mo=fo;
752/**
753     * @license
754     * Copyright 2019 Google LLC
755     *
756     * Licensed under the Apache License, Version 2.0 (the "License");
757     * you may not use this file except in compliance with the License.
758     * You may obtain a copy of the License at
759     *
760     *   http://www.apache.org/licenses/LICENSE-2.0
761     *
762     * Unless required by applicable law or agreed to in writing, software
763     * distributed under the License is distributed on an "AS IS" BASIS,
764     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
765     * See the License for the specific language governing permissions and
766     * limitations under the License.
767     */function go(t,e,n){return`firebase:${t}:${e}:${n}`}class vo{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:i,name:s}=this.auth;this.fullUserKey=go(this.userKey,i.apiKey,s),this.fullPersistenceKey=go("persistence",i.apiKey,s),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?po._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 vo(Ur(mo),t,n);const i=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=i[0]||Ur(mo);const r=go(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(r);if(e){const i=po._fromJSON(t,e);n!==s&&(o=i),s=n;break}}catch(t){}const a=i.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(r,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(r)}catch(t){}}))),new vo(s,t,n)):new vo(s,t,n)}}
768/**
769     * @license
770     * Copyright 2020 Google LLC
771     *
772     * Licensed under the Apache License, Version 2.0 (the "License");
773     * you may not use this file except in compliance with the License.
774     * You may obtain a copy of the License at
775     *
776     *   http://www.apache.org/licenses/LICENSE-2.0
777     *
778     * Unless required by applicable law or agreed to in writing, software
779     * distributed under the License is distributed on an "AS IS" BASIS,
780     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
781     * See the License for the specific language governing permissions and
782     * limitations under the License.
783     */function _o(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bo(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(yo(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Co(e))return"Blackberry";if(So(e))return"Webos";if(ko(e))return"Safari";if((e.includes("chrome/")||wo(e))&&!e.includes("edge/"))return"Chrome";if(To(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function yo(t=ys()){return/firefox\//i.test(t)}function ko(t=ys()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function wo(t=ys()){return/crios\//i.test(t)}function bo(t=ys()){return/iemobile/i.test(t)}function To(t=ys()){return/android/i.test(t)}function Co(t=ys()){return/blackberry/i.test(t)}function So(t=ys()){return/webos/i.test(t)}function Io(t=ys()){return/iphone|ipad|ipod/i.test(t)}function Eo(){return function(){const t=ys();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function xo(t=ys()){return Io(t)||To(t)||So(t)||Co(t)||/windows phone/i.test(t)||bo(t)}
784/**
785     * @license
786     * Copyright 2020 Google LLC
787     *
788     * Licensed under the Apache License, Version 2.0 (the "License");
789     * you may not use this file except in compliance with the License.
790     * You may obtain a copy of the License at
791     *
792     *   http://www.apache.org/licenses/LICENSE-2.0
793     *
794     * Unless required by applicable law or agreed to in writing, software
795     * distributed under the License is distributed on an "AS IS" BASIS,
796     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
797     * See the License for the specific language governing permissions and
798     * limitations under the License.
799     */
800function No(t,e=[]){let n;switch(t){case"Browser":n=_o(ys());break;case"Worker":n=`${_o(ys())}-${t}`;break;default:n=t}return`${n}/JsCore/9.6.10/${e.length?e.join(","):"FirebaseCore-web"}`}
801/**
802     * @license
803     * Copyright 2020 Google LLC
804     *
805     * Licensed under the Apache License, Version 2.0 (the "License");
806     * you may not use this file except in compliance with the License.
807     * You may obtain a copy of the License at
808     *
809     *   http://www.apache.org/licenses/LICENSE-2.0
810     *
811     * Unless required by applicable law or agreed to in writing, software
812     * distributed under the License is distributed on an "AS IS" BASIS,
813     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814     * See the License for the specific language governing permissions and
815     * limitations under the License.
816     */class Ro{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 Oo(this),this.idTokenSubscription=new Oo(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Pr,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=Ur(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await vo.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===(i=this.currentUser)||void 0===i?void 0:i.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):void 0}async initializeCurrentUser(t){var e;let n=await this.assertedPersistence.getCurrentUser();if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==n?void 0:n._redirectEventId,r=await this.tryRedirectSignIn(t);i&&i!==s||!(null==r?void 0:r.user)||(n=r.user)}return n?n._redirectEventId?(Mr(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)):this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}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 uo(t)}catch(t){if("auth/network-request-failed"!==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?qs(t):null;return e&&Mr(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t){if(!this._deleted)return t&&Mr(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Ur(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new Cs("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}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&&Ur(t)||this._popupRedirectResolver;Mr(e,this,"argument-error"),this.redirectPersistenceManager=await vo.create(this,[Ur(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,i){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e),r=this._isInitialized?Promise.resolve():this._initializationPromise;return Mr(r,this,"internal-error"),r.then((()=>s(this.currentUser))),"function"==typeof e?t.addObserver(e,n,i):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 Mr(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=No(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 Po(t){return qs(t)}class Oo{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new Ms(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Mr(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
817/**
818     * @license
819     * Copyright 2020 Google LLC
820     *
821     * Licensed under the Apache License, Version 2.0 (the "License");
822     * you may not use this file except in compliance with the License.
823     * You may obtain a copy of the License at
824     *
825     *   http://www.apache.org/licenses/LICENSE-2.0
826     *
827     * Unless required by applicable law or agreed to in writing, software
828     * distributed under the License is distributed on an "AS IS" BASIS,
829     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830     * See the License for the specific language governing permissions and
831     * limitations under the License.
832     */class Ao{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Lr("not implemented")}_getIdTokenResponse(t){return Lr("not implemented")}_linkToIdToken(t,e){return Lr("not implemented")}_getReauthenticationResolver(t){return Lr("not implemented")}}
833/**
834     * @license
835     * Copyright 2020 Google LLC
836     *
837     * Licensed under the Apache License, Version 2.0 (the "License");
838     * you may not use this file except in compliance with the License.
839     * You may obtain a copy of the License at
840     *
841     *   http://www.apache.org/licenses/LICENSE-2.0
842     *
843     * Unless required by applicable law or agreed to in writing, software
844     * distributed under the License is distributed on an "AS IS" BASIS,
845     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
846     * See the License for the specific language governing permissions and
847     * limitations under the License.
848     */async function jo(t,e){return Zr(t,"POST","/v1/accounts:signInWithIdp",Jr(t,e))}
849/**
850     * @license
851     * Copyright 2020 Google LLC
852     *
853     * Licensed under the Apache License, Version 2.0 (the "License");
854     * you may not use this file except in compliance with the License.
855     * You may obtain a copy of the License at
856     *
857     *   http://www.apache.org/licenses/LICENSE-2.0
858     *
859     * Unless required by applicable law or agreed to in writing, software
860     * distributed under the License is distributed on an "AS IS" BASIS,
861     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862     * See the License for the specific language governing permissions and
863     * limitations under the License.
864     */class $o extends Ao{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new $o(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):jr("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
vendor: 4,210 bytes, lines 864-917
864once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:i}=e,s=xr(e,["providerId","signInMethod"]);if(!n||!i)return null;const r=new $o(n,i);return r.idToken=s.idToken||void 0,r.accessToken=s.accessToken||void 0,r.secret=s.secret,r.nonce=s.nonce,r.pendingToken=s.pendingToken||null,r}_getIdTokenResponse(t){return jo(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,jo(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,jo(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=$s(e)}return t}}
865/**
866     * @license
867     * Copyright 2020 Google LLC
868     *
869     * Licensed under the Apache License, Version 2.0 (the "License");
870     * you may not use this file except in compliance with the License.
871     * You may obtain a copy of the License at
872     *
873     *   http://www.apache.org/licenses/LICENSE-2.0
874     *
875     * Unless required by applicable law or agreed to in writing, software
876     * distributed under the License is distributed on an "AS IS" BASIS,
877     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
878     * See the License for the specific language governing permissions and
879     * limitations under the License.
880     */class Do{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
881/**
882     * @license
883     * Copyright 2019 Google LLC
884     *
885     * Licensed under the Apache License, Version 2.0 (the "License");
886     * you may not use this file except in compliance with the License.
887     * You may obtain a copy of the License at
888     *
889     *   http://www.apache.org/licenses/LICENSE-2.0
890     *
891     * Unless required by applicable law or agreed to in writing, software
892     * distributed under the License is distributed on an "AS IS" BASIS,
893     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
894     * See the License for the specific language governing permissions and
895     * limitations under the License.
896     */class Mo extends Do{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
897/**
898     * @license
899     * Copyright 2020 Google LLC
900     *
901     * Licensed under the Apache License, Version 2.0 (the "License");
902     * you may not use this file except in compliance with the License.
903     * You may obtain a copy of the License at
904     *
905     *   http://www.apache.org/licenses/LICENSE-2.0
906     *
907     * Unless required by applicable law or agreed to in writing, software
908     * distributed under the License is distributed on an "AS IS" BASIS,
909     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
910     * See the License for the specific language governing permissions and
911     * limitations under the License.
912     */class Lo extends Mo{constructor(){super("facebook.com")}static credential(t){return $o._fromParams({providerId:Lo.PROVIDER_ID,signInMethod:Lo.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Lo.credentialFromTaggedObject(t)}static credentialFromError(t){return Lo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Lo.credential(t.oauthAccessToken)}catch(t){return null}}}Lo.FACEBOOK_SIGN_IN_METHOD="facebook.com",Lo.PROVIDER_ID="facebook.com";
913/**
914     * @license
915     * Copyright 2020 Google LLC
916     *
917     * Licensed under the Apache License, Version 2.0 (the "License");
918     * you may not use this file except in compliance with the License.
919     * You may obtain a copy of the License at
920     *
921     *   http://www.apache.org/licenses/LICENSE-2.0
922     *
923     * Unless required by applicable law or agreed to in writing, software
924     * distributed under the License is distributed on an "AS IS" BASIS,
925     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
926     * See the License for the specific language governing permissions and
927     * limitations under the License.
928     */
929class Fo extends Mo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return $o._fromParams({providerId:Fo.PROVIDER_ID,signInMethod:Fo.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Fo.credentialFromTaggedObject(t)}static credentialFromError(t){return Fo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Fo.credential(e,n)}catch(t){return null}}}Fo.GOOGLE_SIGN_IN_METHOD="google.com",Fo.PROVIDER_ID="google.com";
930/**
931     * @license
932     * Copyright 2020 Google LLC
933     *
934     * Licensed under the Apache License, Version 2.0 (the "License");
935     * you may not use this file except in compliance with the License.
936     * You may obtain a copy of the License at
937     *
938     *   http://www.apache.org/licenses/LICENSE-2.0
939     *
940     * Unless required by applicable law or agreed to in writing, software
941     * distributed under the License is distributed on an "AS IS" BASIS,
942     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943     * See the License for the specific language governing permissions and
944     * limitations under the License.
945     */
946class qo extends Mo{constructor(){super("github.com")}static credential(t){return $o._fromParams({providerId:qo.PROVIDER_ID,signInMethod:qo.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return qo.credentialFromTaggedObject(t)}static credentialFromError(t){return qo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return qo.credential(t.oauthAccessToken)}catch(t){return null}}}qo.GITHUB_SIGN_IN_METHOD="github.com",qo.PROVIDER_ID="github.com";
947/**
948     * @license
949     * Copyright 2020 Google LLC
950     *
951     * Licensed under the Apache License, Version 2.0 (the "License");
952     * you may not use this file except in compliance with the License.
953     * You may obtain a copy of the License at
954     *
955     *   http://www.apache.org/licenses/LICENSE-2.0
956     *
957     * Unless required by applicable law or agreed to in writing, software
958     * distributed under the License is distributed on an "AS IS" BASIS,
959     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
960     * See the License for the specific language governing permissions and
961     * limitations under the License.
962     */
963class Uo extends Mo{constructor(){super("twitter.com")}static credential(t,e){return $o._fromParams({providerId:Uo.PROVIDER_ID,signInMethod:Uo.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Uo.credentialFromTaggedObject(t)}static credentialFromError(t){return Uo.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Uo.credential(e,n)}catch(t){return null}}}Uo.TWITTER_SIGN_IN_METHOD="twitter.com",Uo.PROVIDER_ID="twitter.com";
964/**
965     * @license
966     * Copyright 2020 Google LLC
967     *
968     * Licensed under the Apache License, Version 2.0 (the "License");
969     * you may not use this file except in compliance with the License.
970     * You may obtain a copy of the License at
971     *
972     *   http://www.apache.org/licenses/LICENSE-2.0
973     *
974     * Unless required by applicable law or agreed to in writing, softw
974are
975     * distributed under the License is distributed on an "AS IS" BASIS,
976     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
977     * See the License for the specific language governing permissions and
978     * limitations under the License.
979     */
980class Wo{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,i=!1){const s=await po._fromIdTokenResponse(t,n,i),r=Ho(n);return new Wo({user:s,providerId:r,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const i=Ho(n);return new Wo({user:t,providerId:i,_tokenResponse:n,operationType:e})}}function Ho(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
981/**
982     * @license
983     * Copyright 2020 Google LLC
984     *
985     * Licensed under the Apache License, Version 2.0 (the "License");
986     * you may not use this file except in compliance with the License.
987     * You may obtain a copy of the License at
988     *
989     *   http://www.apache.org/licenses/LICENSE-2.0
990     *
991     * Unless required by applicable law or agreed to in writing, software
992     * distributed under the License is distributed on an "AS IS" BASIS,
993     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
994     * See the License for the specific language governing permissions and
995     * limitations under the License.
996     */class zo extends Ts{constructor(t,e,n,i){var s;super(e.code,e.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,zo.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,i){return new zo(t,e,n,i)}}function Vo(t,e,n,i){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw zo._fromErrorAndOperation(t,n,e,i);throw n}))}async function Bo(t,e,n){const i=Po(t),s=await
997/**
998     * @license
999     * Copyright 2020 Google LLC
1000     *
1001     * Licensed under the Apache License, Version 2.0 (the "License");
1002     * you may not use this file except in compliance with the License.
1003     * You may obtain a copy of the License at
1004     *
1005     *   http://www.apache.org/licenses/LICENSE-2.0
1006     *
1007     * Unless required by applicable law or agreed to in writing, software
1008     * distributed under the License is distributed on an "AS IS" BASIS,
1009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010     * See the License for the specific language governing permissions and
1011     * limitations under the License.
1012     */
1013async function(t,e){return Zr(t,"POST","/v1/accounts:signUp",Jr(t,e))}(i,{returnSecureToken:!0,email:e,password:n}),r=await Wo._fromIdTokenResponse(i,"signIn",s);return await i._updateCurrentUser(r.user),r}const Ko="__sak";
1014/**
1015     * @license
1016     * Copyright 2019 Google LLC
1017     *
1018     * Licensed under the Apache License, Version 2.0 (the "License");
1019     * you may not use this file except in compliance with the License.
1020     * You may obtain a copy of the License at
1021     *
1022     *   http://www.apache.org/licenses/LICENSE-2.0
1023     *
1024     * Unless required by applicable law or agreed to in writing, software
1025     * distributed under the License is distributed on an "AS IS" BASIS,
1026     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1027     * See the License for the specific language governing permissions and
1028     * limitations under the License.
1029     */class Go{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Ko,"1"),this.storage.removeItem(Ko),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
1030/**
1031     * @license
1032     * Copyright 2020 Google LLC
1033     *
1034     * Licensed under the Apache License, Version 2.0 (the "License");
1035     * you may not use this file except in compliance with the License.
1036     * You may obtain a copy of the License at
1037     *
1038     *   http://www.apache.org/licenses/LICENSE-2.0
1039     *
1040     * Unless required by applicable law or agreed to in writing, software
1041     * distributed under the License is distributed on an "AS IS" BASIS,
1042     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1043     * See the License for the specific language governing permissions and
1044     * limitations under the License.
1045     */class Yo extends Go{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=ys();return ko(t)||Io(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=xo(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),i=this.localCache[e];n!==i&&t(e,i,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const i=this.storage.getItem(n);if(t.newValue!==i)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const i=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);Eo()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,10):i()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(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.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Yo.type="LOCAL";const Jo=Yo;
1046/**
1047     * @license
1048     * Copyright 2020 Google LLC
1049     *
1050     * Licensed under the Apache License, Version 2.0 (the "License");
1051     * you may not use this file except in compliance with the License.
1052     * You may obtain a copy of the License at
1053     *
1054     *   http://www.apache.org/licenses/LICENSE-2.0
1055     *
1056     * Unless required by applicable law or agreed to in writing, software
1057     * distributed under the License is distributed on an "AS IS" BASIS,
1058     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1059     * See the License for the specific language governing permissions and
1060     * limitations under the License.
1061     */class Qo extends Go{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Qo.type="SESSION";const Xo=Qo;
1062/**
1063     * @license
1064     * Copyright 2019 Google LLC
1065     *
1066     * Licensed under the Apache License, Version 2.0 (the "License");
1067     * you may not use this file except in compliance with the License.
1068     * You may obtain a copy of the License at
1069     *
1070     *   http://www.apache.org/licenses/LICENSE-2.0
1071     *
1072     * Unless required by applicable law or agreed to in writing, softw
vendor: 14,587 bytes, lines 1072-1232
1072are
1073     * distributed under the License is distributed on an "AS IS" BASIS,
1074     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1075     * See the License for the specific language governing permissions and
1076     * limitations under the License.
1077     */
1078/**
1079     * @license
1080     * Copyright 2019 Google LLC
1081     *
1082     * Licensed under the Apache License, Version 2.0 (the "License");
1083     * you may not use this file except in compliance with the License.
1084     * You may obtain a copy of the License at
1085     *
1086     *   http://www.apache.org/licenses/LICENSE-2.0
1087     *
1088     * Unless required by applicable law or agreed to in writing, software
1089     * distributed under the License is distributed on an "AS IS" BASIS,
1090     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1091     * See the License for the specific language governing permissions and
1092     * limitations under the License.
1093     */
1094class Zo{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new Zo(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:i,data:s}=e.data,r=this.handlersMap[i];if(!(null==r?void 0:r.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(r).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
1095/**
1096     * @license
1097     * Copyright 2020 Google LLC
1098     *
1099     * Licensed under the Apache License, Version 2.0 (the "License");
1100     * you may not use this file except in compliance with the License.
1101     * You may obtain a copy of the License at
1102     *
1103     *   http://www.apache.org/licenses/LICENSE-2.0
1104     *
1105     * Unless required by applicable law or agreed to in writing, software
1106     * distributed under the License is distributed on an "AS IS" BASIS,
1107     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1108     * See the License for the specific language governing permissions and
1109     * limitations under the License.
1110     */
1111function ta(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
1112/**
1113     * @license
1114     * Copyright 2019 Google LLC
1115     *
1116     * Licensed under the Apache License, Version 2.0 (the "License");
1117     * you may not use this file except in compliance with the License.
1118     * You may obtain a copy of the License at
1119     *
1120     *   http://www.apache.org/licenses/LICENSE-2.0
1121     *
1122     * Unless required by applicable law or agreed to in writing, software
1123     * distributed under the License is distributed on an "AS IS" BASIS,
1124     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1125     * See the License for the specific language governing permissions and
1126     * limitations under the License.
1127     */Zo.receivers=[];class ea{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 i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,r;return new Promise(((o,a)=>{const l=ta("",20);i.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);r={messageChannel:i,onMessage(t){const e=t;if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(r),i.port1.addEventListener("message",r.onMessage),this.target.postMessage({eventType:t,eventId:l,data:e},[i.port2])})).finally((()=>{r&&this.removeMessageHandler(r)}))}}
1128/**
1129     * @license
1130     * Copyright 2020 Google LLC
1131     *
1132     * Licensed under the Apache License, Version 2.0 (the "License");
1133     * you may not use this file except in compliance with the License.
1134     * You may obtain a copy of the License at
1135     *
1136     *   http://www.apache.org/licenses/LICENSE-2.0
1137     *
1138     * Unless required by applicable law or agreed to in writing, software
1139     * distributed under the License is distributed on an "AS IS" BASIS,
1140     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1141     * See the License for the specific language governing permissions and
1142     * limitations under the License.
1143     */function na(){return window}
1144/**
1145     * @license
1146     * Copyright 2020 Google LLC.
1147     *
1148     * Licensed under the Apache License, Version 2.0 (the "License");
1149     * you may not use this file except in compliance with the License.
1150     * You may obtain a copy of the License at
1151     *
1152     *   http://www.apache.org/licenses/LICENSE-2.0
1153     *
1154     * Unless required by applicable law or agreed to in writing, software
1155     * distributed under the License is distributed on an "AS IS" BASIS,
1156     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1157     * See the License for the specific language governing permissions and
1158     * limitations under the License.
1159     */
1160function ia(){return void 0!==na().WorkerGlobalScope&&"function"==typeof na().importScripts}
1161/**
1162     * @license
1163     * Copyright 2019 Google LLC
1164     *
1165     * Licensed under the Apache License, Version 2.0 (the "License");
1166     * you may not use this file except in compliance with the License.
1167     * You may obtain a copy of the License at
1168     *
1169     *   http://www.apache.org/licenses/LICENSE-2.0
1170     *
1171     * Unless required by applicable law or agreed to in writing, software
1172     * distributed under the License is distributed on an "AS IS" BASIS,
1173     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1174     * See the License for the specific language governing permissions and
1175     * limitations under the License.
1176     */
1177const sa="firebaseLocalStorageDb",ra="firebaseLocalStorage",oa="fbase_key";class aa{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 la(t,e){return t.transaction([ra],e?"readwrite":"readonly").objectStore(ra)}function ua(){const t=indexedDB.open(sa,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(ra,{keyPath:oa})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(ra)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(sa);return new aa(t).toPromise()}(),e(await ua()))}))}))}async function ca(t,e,n){const i=la(t,!0).put({[oa]:e,value:n});return new aa(i).toPromise()}function ha(t,e){const n=la(t,!0).delete(e);return new aa(n).toPromise()}class da{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 ua()),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 ia()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Zo._getInstance(ia()?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 ea(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){var e;if(this.sender&&this.activeServiceWorker&&((null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await ua();return await ca(t,Ko,"1"),await ha(t,Ko),!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=>ca(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=la(t,!1).get(e),i=await new aa(n).toPromise();return void 0===i?null:i.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>ha(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=la(t,!1).getAll();return new aa(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:i,value:s}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),e.push(i));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()}}da.type="LOCAL";const pa=da;
1178/**
1179     * @license
1180     * Copyright 2020 Google LLC
1181     *
1182     * Licensed under the Apache License, Version 2.0 (the "License");
1183     * you may not use this file except in compliance with the License.
1184     * You may obtain a copy of the License at
1185     *
1186     *   http://www.apache.org/licenses/LICENSE-2.0
1187     *
1188     * Unless required by applicable law or agreed to in writing, software
1189     * distributed under the License is distributed on an "AS IS" BASIS,
1190     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1191     * See the License for the specific language governing permissions and
1192     * limitations under the License.
1193     */function fa(t){return new Promise(((e,n)=>{const i=document.createElement("script");var s,r;i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=$r("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.charset="UTF-8",(null!==(r=null===(s=document.getElementsByTagName("head"))||void 0===s?void 0:s[0])&&void 0!==r?r:document).appendChild(i)}))}new Vr(3e4,6e4);
1194/**
1195     * @license
1196     * Copyright 2019 Google LLC
1197     *
1198     * Licensed under the Apache License, Version 2.0 (the "License");
1199     * you may not use this file except in compliance with the License.
1200     * You may obtain a copy of the License at
1201     *
1202     *   http://www.apache.org/licenses/LICENSE-2.0
1203     *
1204     * Unless required by applicable law or agreed to in writing, software
1205     * distributed under the License is distributed on an "AS IS" BASIS,
1206     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1207     * See the License for the specific language governing permissions and
1208     * limitations under the License.
1209     */
1210class ma extends Ao{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return jo(t,this._buildIdpRequest())}_linkToIdToken(t,e){return jo(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return jo(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function ga(t){
1211/**
1212     * @license
1213     * Copyright 2020 Google LLC
1214     *
1215     * Licensed under the Apache License, Version 2.0 (the "License");
1216     * you may not use this file except in compliance with the License.
1217     * You may obtain a copy of the License at
1218     *
1219     *   http://www.apache.org/licenses/LICENSE-2.0
1220     *
1221     * Unless required by applicable law or agreed to in writing, software
1222     * distributed under the License is distributed on an "AS IS" BASIS,
1223     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1224     * See the License for the specific language governing permissions and
1225     * limitations under the License.
1226     */
1227return async function(t,e,n=!1){const i="signIn",s=await Vo(t,i,e),r=await Wo._fromIdTokenResponse(t,i,s);return n||await t._updateCurrentUser(r.user),r}(t.auth,new ma(t),t.bypassAuthState)}function va(t){const{auth:e,user:n}=t;return Mr(n,e,"internal-error"),
1228/**
1229     * @license
1230     * Copyright 2019 Google LLC
1231     *
1232     * Licensed under the Apache License, Version 2.0 (the "License");
1233     * you may not use this file except in compliance with the License.
1234     * You may obtain a copy of the License at
1235     *
1236     *   http://www.apache.org/licenses/LICENSE-2.0
1237     *
1238     * Unless required by applicable law or agreed to in writing, software
1239     * distributed under the License is distributed on an "AS IS" BASIS,
1240     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1241     * See the License for the specific language governing permissions and
1242     * limitations under the License.
1243     */
1244async function(t,e,n=!1){const{auth:i}=t,s="reauthenticate";try{const r=await oo(t,Vo(i,s,e,t),n);Mr(r.idToken,i,"internal-error");const o=ro(r.idToken);Mr(o,i,"internal-error");const{sub:a}=o;return Mr(t.uid===a,i,"user-mismatch"),Wo._forOperation(t,s,r)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&jr(i,"user-mismatch"),t}}(n,new ma(t),t.bypassAuthState)}async function _a(t){const{auth:e,user:n}=t;return Mr(n,e,"internal-error"),async function(t,e,n=!1){const i=await oo(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Wo._forOperation(t,"link",i)}(n,new ma(t),t.bypassAuthState)}
1245/**
1246     * @license
1247     * Copyright 2020 Google LLC
1248     *
1249     * Licensed under the Apache License, Version 2.0 (the "License");
1250     * you may not use this file except in compliance with the License.
1251     * You may obtain a copy of the License at
1252     *
1253     *   http://www.apache.org/licenses/LICENSE-2.0
1254     *
1255     * Unless required by applicable law or agreed to in writing, software
1256     * distributed under the License is distributed on an "AS IS" BASIS,
1257     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1258     * See the License for the specific language governing permissions and
1259     * limitations under the License.
1260     */class ya{constructor(t,e,n,i,s=!1){this.auth=t,this.resolver=n,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:i,tenantId:s,error:r,type:o}=t;if(r)return void this.reject(r);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return ga;case"linkViaPopup":case"linkViaRedirect":return _a;case"reauthViaPopup":case"reauthViaRedirect":return va;default:jr(this.auth,"internal-error")}}resolve(t){Fr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Fr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
1261/**
1262     * @license
1263     * Copyright 2020 Google LLC
1264     *
1265     * Licensed under the Apache License, Version 2.0 (the "License");
1266     * you may not use this file except in compliance with the License.
1267     * You may obtain a copy of the License at
1268     *
1269     *   http://www.apache.org/licenses/LICENSE-2.0
1270     *
1271     * Unless required by applicable law or agreed to in writing, software
1272     * distributed under the License is distributed on an "AS IS" BASIS,
1273     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1274     * See the License for the specific language governing permissions and
1275     * limitations under the License.
1276     */const ka=new Vr(2e3,1e4);class wa extends ya{constructor(t,e,n,i,s){super(t,e,i,s),this.provider=n,this.authWindow=null,this.pollId=null,wa.currentPopupAction&&wa.currentPopupAction.cancel(),wa.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Mr(t,this.auth,"internal-error"),t}async onExecution(){Fr(1===this.filter.length,"Popup operations only handle one event");const t=ta();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject($r(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject($r(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,wa.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject($r(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,ka.get())};t()}}wa.currentPopupAction=null;
1277/**
1278     * @license
1279     * Copyright 2020 Google LLC
1280     *
1281     * Licensed under the Apache License, Version 2.0 (the "License");
1282     * you may not use this file except in compliance with the License.
1283     * You may obtain a copy of the License at
1284     *
1285     *   http://www.apache.org/licenses/LICENSE-2.0
1286     *
1287     * Unless required by applicable law or agreed to in writing, software
1288     * distributed under the License is distributed on an "AS IS" BASIS,
1289     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1290     * See the License for the specific language governing permissions and
1291     * limitations under the License.
1292     */
1293const ba="pendingRedirect",Ta=new Map;class Ca extends ya{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Ta.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return go(ba,t.config.apiKey,t.name)}(e),i=function(t){return Ur(t._redirectPersistence)}(t);if(!await i._isAvailable())return!1;const s="true"===await i._get(n);return await i._remove(n),s}(this.resolver,this.auth),n=e?await super.execute():null;t=()=>Promise.resolve(n)}catch(e){t=()=>Promise.reject(e)}Ta.set(this.auth._key(),t)}return this.bypassAuthState||Ta.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}async function Sa(t,e,n=!1){const i=Po(t),s=
1294/**
1295     * @license
1296     * Copyright 2021 Google LLC
1297     *
1298     * Licensed under the Apache License, Version 2.0 (the "License");
1299     * you may not use this file except in compliance with the License.
1300     * You may obtain a copy of the License at
1301     *
1302     *   http://www.apache.org/licenses/LICENSE-2.0
1303     *
1304     * Unless required by applicable law or agreed to in writing, software
1305     * distributed under the License is distributed on an "AS IS" BASIS,
1306     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1307     * See the License for the specific language governing permissions and
1308     * limitations under the License.
1309     */
1310function(t,e){return e?Ur(e):(Mr(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(i,e),r=new Ca(i,s,n),o=await r.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}
1311/**
1312     * @license
1313     * Copyright 2020 Google LLC
1314     *
1315     * Licensed under the Apache License, Version 2.0 (the "License");
1316     * you may not use this file except in compliance with the License.
1317     * You may obtain a copy of the License at
1318     *
1319     *   http://www.apache.org/licenses/LICENSE-2.0
1320     *
1321     * Unless required by applicable law or agreed to in writing, software
1322     * distributed under the License is distributed on an "AS IS" BASIS,
1323     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1324     * See the License for the specific language governing permissions and
1325     * limitations under the License.
1326     */class Ia{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return xa(t);default:return!1}}
1327/**
1328     * @license
1329     * Copyright 2020 Google LLC
1330     *
1331     * Licensed under the Apache License, Version 2.0 (the "License");
1332     * you may not use this file except in compliance with the License.
1333     * You may obtain a copy of the License at
1334     *
1335     *   http://www.apache.org/licenses/LICENSE-2.0
1336     *
1337     * Unless required by applicable law or agreed to in writing, software
1338     * distributed under the License is distributed on an "AS IS" BASIS,
1339     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1340     * See the License for the specific language governing permissions and
1341     * limitations under the License.
1342     */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!xa(t)){const i=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError($r(this.auth,i))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ea(t))}saveEventToCache(t){this.cachedEventUids.add(Ea(t)),this.lastProcessedEventTime=Date.now()}}function Ea(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function xa({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
1343/**
1344     * @license
1345     * Copyright 2020 Google LLC
1346     *
1347     * Licensed under the Apache License, Version 2.0 (the "License");
1348     * you may not use this file except in compliance with the License.
1349     * You may obtain a copy of the License at
1350     *
1351     *   http://www.apache.org/licenses/LICENSE-2.0
1352     *
1353     * Unless required by applicable law or agreed to in writing, software
1354     * distributed under the License is distributed on an "AS IS" BASIS,
1355     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1356     * See the License for the specific language governing permissions and
1357     * limitations under the License.
1358     */
1359const Na=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ra=/^https?/;async function Pa(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Qr(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Oa(t))return}catch(t){}jr(t,"unauthorized-domain")}function Oa(t){const e=Wr(),{protocol:n,hostname:i}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===i?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===i}if(!Ra.test(n))return!1;if(Na.test(t))return i===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}
1360/**
1361     * @license
1362     * Copyright 2020 Google LLC.
1363     *
1364     * Licensed under the Apache License, Version 2.0 (the "License");
1365     * you may not use this file except in compliance with the License.
1366     * You may obtain a copy of the License at
1367     *
1368     *   http://www.apache.org/licenses/LICENSE-2.0
1369     *
1370     * Unless required by applicable law or agreed to in writing, software
1371     * distributed under the License is distributed on an "AS IS" BASIS,
1372     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1373     * See the License for the specific language governing permissions and
1374     * limitations under the License.
1375     */const Aa=new Vr(3e4,6e4);function ja(){const t=na().___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 $a(t){return new Promise(((e,n)=>{var i,s,r;function o(){ja(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ja(),n($r(t,"network-request-failed"))},timeout:Aa.get()})}if(null===(s=null===(i=na().gapi)||void 0===i?void 0:i.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(r=na().gapi)||void 0===r?void 0:r.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return na()[e]=()=>{gapi.load?o():n($r(t,"network-request-failed"))},fa(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Da=null,t}))}let Da=null;
1376/**
1377     * @license
1378     * Copyright 2020 Google LLC.
1379     *
1380     * Licensed under the Apache License, Version 2.0 (the "License");
1381     * you may not use this file except in compliance with the License.
1382     * You may obtain a copy of the License at
1383     *
1384     *   http://www.apache.org/licenses/LICENSE-2.0
1385     *
1386     * Unless required by applicable law or agreed to in writing, software
1387     * distributed under the License is distributed on an "AS IS" BASIS,
1388     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389     * See the License for the specific language governing permissions and
1390     * limitations under the License.
1391     */
1392const Ma=new Vr(5e3,15e3),La={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Fa=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function qa(t){const e=t.config;Mr(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Br(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,i={apiKey:e.apiKey,appName:t.name,v:mr},s=Fa.get(t.config.apiHost);s&&(i.eid=s);const r=t._getFrameworks();return r.length&&(i.fw=r.join(",")),`${n}?${$s(i).slice(1)}`}async function Ua(t){const e=await function(t){return Da=Da||$a(t),Da}(t),n=na().gapi;return Mr(n,t,"internal-error"),e.open({where:document.body,url:qa(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:La,dontclear:!0},(e=>new Promise((async(n,i)=>{await e.restyle({setHideOnLeave:!1});const s=$r(t,"network-request-failed"),r=na().setTimeout((()=>{i(s)}),Ma.get());function o(){na().clearTimeout(r),n(e)}e.ping(o).then(o,(()=>{i(s)}))}))))}
1393/**
1394     * @license
1395     * Copyright 2020 Google LLC.
1396     *
1397     * Licensed under the Apache License, Version 2.0 (the "License");
1398     * you may not use this file except in compliance with the License.
1399     * You may obtain a copy of the License at
1400     *
1401     *   http://www.apache.org/licenses/LICENSE-2.0
1402     *
1403     * Unless required by applicable law or agreed to in writing, software
1404     * distributed under the License is distributed on an "AS IS" BASIS,
1405     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1406     * See the License for the specific language governing permissions and
1407     * limitations under the License.
1408     */const Wa={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Ha{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function za(t,e,n,i=500,s=600){const r=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const l=Object.assign(Object.assign({},Wa),{width:i.toString(),height:s.toString(),top:r,left:o}),u=ys().toLowerCase();n&&(a=wo(u)?"_blank":n),yo(u)&&(e=e||"http://localhost",l.scrollbars="yes");const c=Object.entries(l).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=ys()){var e;return Io(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}
1409/**
1410     * @license
1411     * Copyright 2021 Google LLC
1412     *
1413     * Licensed under the Apache License, Version 2.0 (the "License");
1414     * you may not use this file except in compliance with the License.
1415     * You may obtain a copy of the License at
1416     *
1417     *   http://www.apache.org/licenses/LICENSE-2.0
1418     *
1419     * Unless required by applicable law or agreed to in writing, software
1420     * distributed under the License is distributed on an "AS IS" BASIS,
1421     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1422     * See the License for the specific language governing permissions and
1423     * limitations under the License.
1424     */(e||"",a),new Ha(null);const h=window.open(e||"",a,c);Mr(h,t,"popup-blocked");try{h.focus()}catch(t){}return new Ha(h)}const Va="__/auth/handler",Ba="emulator/auth/handler";function Ka(t,e,n,i,s,r){Mr(t.config.authDomain,t,"auth-domain-config-required"),Mr(t.config.apiKey,t,"invali
1424d-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:i,v:mr,eventId:s};if(e instanceof Do){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Ps(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(r||{}))o[t]=e}if(e instanceof Mo){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Va}`;return Br(t,Ba)}
1425/**
1426     * @license
1427     * Copyright 2020 Google LLC
1428     *
1429     * Licensed under the Apache License, Version 2.0 (the "License");
1430     * you may not use this file except in compliance with the License.
1431     * You may obtain a copy of the License at
1432     *
1433     *   http://www.apache.org/licenses/LICENSE-2.0
1434     *
1435     * Unless required by applicable law or agreed to in writing, software
1436     * distributed under the License is distributed on an "AS IS" BASIS,
1437     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1438     * See the License for the specific language governing permissions and
1439     * limitations under the License.
1440     */(t)}?${$s(a).slice(1)}`}const Ga="webStorageSupport";const Ya=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Xo,this._completeRedirectFn=Sa}async _openPopup(t,e,n,i){var s;Fr(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return za(t,Ka(t,e,n,Wr(),i),ta())}async _openRedirect(t,e,n,i){var s;return await this._originValidation(t),s=Ka(t,e,n,Wr(),i),na().location.href=s,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):(Fr(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 Ua(t),n=new Ia(t);return e.register("authEvent",(e=>
vendor: 4,444 bytes, lines 1440-1478
1440{Mr(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(Ga,{type:Ga},(n=>{var i;const s=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.webStorageSupport;void 0!==s&&e(!!s),jr(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Pa(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return xo()||ko()||Io()}};var Ja,Qa="@firebase/auth",Xa="0.19.11";
1441/**
1442     * @license
1443     * Copyright 2020 Google LLC
1444     *
1445     * Licensed under the Apache License, Version 2.0 (the "License");
1446     * you may not use this file except in compliance with the License.
1447     * You may obtain a copy of the License at
1448     *
1449     *   http://www.apache.org/licenses/LICENSE-2.0
1450     *
1451     * Unless required by applicable law or agreed to in writing, software
1452     * distributed under the License is distributed on an "AS IS" BASIS,
1453     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1454     * See the License for the specific language governing permissions and
1455     * limitations under the License.
1456     */
1457class Za{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=>{var n;t((null===(n=e)||void 0===n?void 0:n.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(){Mr(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
1458/**
1459     * @license
1460     * Copyright 2020 Google LLC
1461     *
1462     * Licensed under the Apache License, Version 2.0 (the "License");
1463     * you may not use this file except in compliance with the License.
1464     * You may obtain a copy of the License at
1465     *
1466     *   http://www.apache.org/licenses/LICENSE-2.0
1467     *
1468     * Unless required by applicable law or agreed to in writing, software
1469     * distributed under the License is distributed on an "AS IS" BASIS,
1470     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1471     * See the License for the specific language governing permissions and
1472     * limitations under the License.
1473     */Ja="Browser",hr(new Bs("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),{apiKey:s,authDomain:r}=n.options;return((t,n)=>{Mr(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),Mr(!(null==r?void 0:r.includes(":")),"argument-error",{appName:t.name});const i={apiKey:s,authDomain:r,clientPlatform:Ja,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:No(Ja)},o=new Ro(t,n,i);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(Ur);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,i)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),hr(new Bs("auth-internal",(t=>(t=>new Za(t))(Po(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),vr(Qa,Xa,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Ja)),vr(Qa,Xa,"esm2017");const tl="@firebase/database",el="0.12.7";
1474/**
1475     * @license
1476     * Copyright 2019 Google LLC
1477     *
1478     * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 6,890 bytes, lines 1479-1544
1479     * you may not use this file except in compliance with the License.
1480     * You may obtain a copy of the License at
1481     *
1482     *   http://www.apache.org/licenses/LICENSE-2.0
1483     *
1484     * Unless required by applicable law or agreed to in writing, software
1485     * distributed under the License is distributed on an "AS IS" BASIS,
1486     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1487     * See the License for the specific language governing permissions and
1488     * limitations under the License.
1489     */
1490let nl="";
1491/**
1492     * @license
1493     * Copyright 2017 Google LLC
1494     *
1495     * Licensed under the Apache License, Version 2.0 (the "License");
1496     * you may not use this file except in compliance with the License.
1497     * You may obtain a copy of the License at
1498     *
1499     *   http://www.apache.org/licenses/LICENSE-2.0
1500     *
1501     * Unless required by applicable law or agreed to in writing, software
1502     * distributed under the License is distributed on an "AS IS" BASIS,
1503     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1504     * See the License for the specific language governing permissions and
1505     * limitations under the License.
1506     */
1507class il{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Es(e))}get(t){const e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:Is(e)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}
1508/**
1509     * @license
1510     * Copyright 2017 Google LLC
1511     *
1512     * Licensed under the Apache License, Version 2.0 (the "License");
1513     * you may not use this file except in compliance with the License.
1514     * You may obtain a copy of the License at
1515     *
1516     *   http://www.apache.org/licenses/LICENSE-2.0
1517     *
1518     * Unless required by applicable law or agreed to in writing, software
1519     * distributed under the License is distributed on an "AS IS" BASIS,
1520     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1521     * See the License for the specific language governing permissions and
1522     * limitations under the License.
1523     */class sl{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e}get(t){return Ns(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}
1524/**
1525     * @license
1526     * Copyright 2017 Google LLC
1527     *
1528     * Licensed under the Apache License, Version 2.0 (the "License");
1529     * you may not use this file except in compliance with the License.
1530     * You may obtain a copy of the License at
1531     *
1532     *   http://www.apache.org/licenses/LICENSE-2.0
1533     *
1534     * Unless required by applicable law or agreed to in writing, software
1535     * distributed under the License is distributed on an "AS IS" BASIS,
1536     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1537     * See the License for the specific language governing permissions and
1538     * limitations under the License.
1539     */const rl=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){const e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new il(e)}}catch(t){}return new sl},ol=rl("localStorage"),al=rl("sessionStorage"),ll=new er("@firebase/database"),ul=function(){let t=1;return function(){return t++}}(),cl=function(t){const e=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s>=55296&&s<=56319){const e=s-55296;i++,us(i<t.length,"Surrogate pair missing trail surrogate."),s=65536+(e<<10)+(t.charCodeAt(i)-56320)}s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):s<65536?(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e}(t),n=new Ds;n.update(e);const i=n.digest();return ds.encodeByteArray(i)},hl=function(...t){let e="";for(let n=0;n<t.length;n++){const i=t[n];Array.isArray(i)||i&&"object"==typeof i&&"number"==typeof i.length?e+=hl.apply(null,i):e+="object"==typeof i?Es(i):i,e+=" "}return e};let dl=null,pl=!0;const fl=function(...t){var e,n;if(!0===pl&&(pl=!1,null===dl&&!0===al.get("logging_enabled")&&(e=!0,us(!n||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(ll.logLevel=Js.VERBOSE,dl=ll.log.bind(ll),n&&al.set("logging_enabled",!0)):"function"==typeof e?dl=e:(dl=null,al.remove("logging_enabled")))),dl){const e=hl.apply(null,t);dl(e)}},ml=function(t){return function(...e){fl(t,...e)}},gl=function(...t){const e="FIREBASE INTERNAL ERROR: "+hl(...t);ll.error(e)},vl=function(...t){const e=`FIREBASE FATAL ERROR: ${hl(...t)}`;throw ll.error(e),new Error(e)},_l=function(...t){const e="FIREBASE WARNING: "+hl(...t);ll.warn(e)},yl=function(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)},kl="[MIN_NAME]",wl="[MAX_NAME]",bl=function(t,e){if(t===e)return 0;if(t===kl||e===wl)return-1;if(e===kl||t===wl)return 1;{const n=Rl(t),i=Rl(e);return null!==n?null!==i?n-i==0?t.length-e.length:n-i:-1:null!==i?1:t<e?-1:1}},Tl=function(t,e){return t===e?0:t<e?-1:1},Cl=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+Es(e))},Sl=function(t){if("object"!=typeof t||null===t)return Es(t);const e=[];for(const n in t)e.push(n);e.sort();let n="{";for(let i=0;i<e.length;i++)0!==i&&(n+=","),n+=Es(e[i]),n+=":",n+=Sl(t[e[i]]);return n+="}",n},Il=function(t,e){const n=t.length;if(n<=e)return[t];const i=[];for(let s=0;s<n;s+=e)s+e>n?i.push(t.substring(s,n)):i.push(t.substring(s,s+e));return i};function El(t,e){for(const n in t)t.hasOwnProperty(n)&&e(n,t[n])}const xl=function(t){us(!yl(t),"Invalid JSON number");const e=1023;let n,i,s,r,o;0===t?(i=0,s=0,n=1/t==-1/0?1:0):(n=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(r=Math.min(Math.floor(Math.log(t)/Math.LN2),e),i=r+e,s=Math.round(t*Math.pow(2,52-r)-Math.pow(2,52))):(i=0,s=Math.round(t/Math.pow(2,-1074))));const a=[];for(o=52;o;o-=1)a.push(s%2?1:0),s=Math.floor(s/2);for(o=11;o;o-=1)a.push(i%2?1:0),i=Math.floor(i/2);a.push(n?1:0),a.reverse();const l=a.join("");let u="";for(o=0;o<64;o+=8){let t=parseInt(l.substr(o,8),2).toString(16);1===t.length&&(t="0"+t),u+=t}return u.toLowerCase()},Nl=new RegExp("^-?(0*)\\d{1,10}$"),Rl=function(t){if(Nl.test(t)){const e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},Pl=function(t){try{t()}catch(t){setTimeout((()=>{const e=t.stack||"";throw _l("Exception was thrown by user callback.",e),t}),Math.floor(0))}},Ol=function(t,e){const n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n};
1540/**
1541     * @license
1542     * Copyright 2021 Google LLC
1543     *
1544     * Licensed under the Apache License, Version 2.0 (the "License");
1545     * you may not use this file except in compliance with the License.
1546     * You may obtain a copy of the License at
1547     *
1548     *   http://www.apache.org/licenses/LICENSE-2.0
1549     *
1550     * Unless required by applicable law or agreed to in writing, software
1551     * distributed under the License is distributed on an "AS IS" BASIS,
1552     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1553     * See the License for the specific language governing permissions and
1554     * limitations under the License.
1555     */
1556class Al{constructor(t,e){this.appName_=t,this.appCheckProvider=e,this.appCheck=null==e?void 0:e.getImmediate({optional:!0}),this.appCheck||null==e||e.get().then((t=>this.appCheck=t))}getToken(t){return this.appCheck?this.appCheck.getToken(t):new Promise(((e,n)=>{setTimeout((()=>{this.appCheck?this.getToken(t).then(e,n):e(null)}),0)}))}addTokenChangeListener(t){var e;null===(e=this.appCheckProvider)||void 0===e||e.get().then((e=>e.addTokenListener(t)))}notifyForInvalidToken(){_l(`Provided AppCheck credentials for the app named "${this.appName_}" are invalid. This usually indicates your app was not initialized correctly.`)}}
1557/**
1558     * @license
1559     * Copyright 2017 Google LLC
1560     *
1561     * Licensed under the Apache License, Version 2.0 (the "License");
1562     * you may not use this file except in compliance with the License.
1563     * You may obtain a copy of the License at
1564     *
1565     *   http://www.apache.org/licenses/LICENSE-2.0
1566     *
1567     * Unless required by applicable law or agreed to in writing, software
1568     * distributed under the License is distributed on an "AS IS" BASIS,
1569     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1570     * See the License for the specific language governing permissions and
1571     * limitations under the License.
1572     */class jl{constructor(t,e,n){this.appName_=t,this.firebaseOptions_=e,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit((t=>this.auth_=t))}getToken(t){return this.auth_?this.auth_.getToken(t).catch((t=>t&&"auth/token-not-initialized"===t.code?(fl("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t))):new Promise(((e,n)=>{setTimeout((()=>{this.auth_?this.getToken(t).then(e,n):e(null)}),0)}))}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then((e=>e.addAuthTokenListener(t)))}removeTokenChangeListener(t){this.authProvider_.get().then((e=>e.removeAuthTokenListener(t)))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',_l(t)}}class $l{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}$l.OWNER="owner";
1573/**
1574     * @license
1575     * Copyright 2017 Google LLC
1576     *
1577     * Licensed under the Apache License, Version 2.0 (the "License");
1578     * you may not use this file except in compliance with the License.
1579     * You may obtain a copy of the License at
1580     *
1581     *   http://www.apache.org/licenses/LICENSE-2.0
1582     *
1583     * Unless required by applicable law or agreed to in writing, software
1584     * distributed under the License is distributed on an "AS IS" BASIS,
1585     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1586     * See the License for the specific language governing permissions and
1587     * limitations under the License.
1588     */
1589const Dl=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Ml="websocket",Ll="long_polling";
1590/**
1591     * @license
1592     * Copyright 2017 Google LLC
1593     *
1594     * Licensed under the Apache License, Version 2.0 (the "License");
1595     * you may not use this file except in compliance with the License.
1596     * You may obtain a copy of the License at
1597     *
1598     *   http://www.apache.org/licenses/LICENSE-2.0
1599     *
1600     * Unless required by applicable law or agreed to in writing, software
1601     * distributed under the License is distributed on an "AS IS" BASIS,
1602     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1603     * See the License for the specific language governing permissions and
1604     * limitations under the License.
1605     */
1606class Fl{constructor(t,e,n,i,s=!1,r="",o=!1){this.secure=e,this.namespace=n,this.webSocketOnly=i,this.nodeAdmin=s,this.persistenceKey=r,this.includeNamespaceInQueryParams=o,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=ol.get("host:"+t)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&ol.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${e}`}}function ql(t,e,n){let i;if(us("string"==typeof e,"typeof type must == string"),us("object"==typeof n,"typeof params must == object"),e===Ml)i=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==Ll)throw new Error("Unknown connection type: "+e);i=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}(function(t){return t.host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams})(t)&&(n.ns=t.namespace);const s=[];return El(n,((t,e)=>{s.push(t+"="+e)})),i+s.join("&")}
1607/**
1608     * @license
1609     * Copyright 2017 Google LLC
1610     *
1611     * Licensed under the Apache License, Version 2.0 (the "License");
1612     * you may not use this file except in compliance with the License.
1613     * You may obtain a copy of the License at
1614     *
1615     *   http://www.apache.org/licenses/LICENSE-2.0
1616     *
1617     * Unless required by applicable law or agreed to in writing, software
1618     * distributed under the License is distributed on an "AS IS" BASIS,
1619     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1620     * See the License for the specific language governing permissions and
1621     * limitations under the License.
1622     */class Ul{constructor(){this.counters_={}}incrementCounter(t,e=1){Ns(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e}get(){return gs(this.counters_)}}
1623/**
1624     * @license
1625     * Copyright 2017 Google LLC
1626     *
1627     * Licensed under the Apache License, Version 2.0 (the "License");
1628     * you may not use this file except in compliance with the License.
1629     * You may obtain a copy of the License at
1630     *
1631     *   http://www.apache.org/licenses/LICENSE-2.0
1632     *
1633     * Unless required by applicable law or agreed to in writing, software
1634     * distributed under the License is distributed on an "AS IS" BASIS,
1635     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1636     * See the License for the specific language governing permissions and
1637     * limitations under the License.
1638     */const Wl={},Hl={};function zl(t){const e=t.toString();return Wl[e]||(Wl[e]=new Ul),Wl[e]}
1639/**
1640     * @license
1641     * Copyright 2017 Google LLC
1642     *
1643     * Licensed under the Apache License, Version 2.0 (the "License");
1644     * you may not use this file except in compliance with the License.
1645     * You may obtain a copy of the License at
1646     *
1647     *   http://www.apache.org/licenses/LICENSE-2.0
1648     *
1649     * Unless required by applicable law or agreed to in writing, software
1650     * distributed under the License is distributed on an "AS IS" BASIS,
1651     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1652     * See the License for the specific language governing permissions and
1653     * limitations under the License.
1654     */
1655class Vl{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(t,e){for(this.pendingResponses[t]=e;this.pendingResponses[this.currentResponseNum];){const t=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let e=0;e<t.length;++e)t[e]&&Pl((()=>{this.onMessage_(t[e])}));if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}
1656/**
1657     * @license
1658     * Copyright 2017 Google LLC
1659     *
1660     * Licensed under the Apache License, Version 2.0 (the "License");
1661     * you may not use this file except in compliance with the License.
1662     * You may obtain a copy of the License at
1663     *
1664     *   http://www.apache.org/licenses/LICENSE-2.0
1665     *
1666     * Unless required by applicable law or agreed to in writing, software
1667     * distributed under the License is distributed on an "AS IS" BASIS,
1668     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1669     * See the License for the specific language governing permissions and
1670     * limitations under the License.
1671     */const Bl="start";class Kl{constructor(t,e,n,i,s,r,o){this.connId=t,this.repoInfo=e,this.applicationId=n,this.appCheckToken=i,this.authToken=s,this.transportSessionId=r,this.lastSessionId=o,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ml(t),this.stats_=zl(e),this.urlFn=t=>(this.appCheckToken&&(t.ac=this.appCheckToken),ql(e,Ll,t))}open(t,e){this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Vl(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout((()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null}),Math.floor(3e4)),function(t){if("complete"===document.readyState)t();else{let e=!1;const n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",(()=>{"complete"===document.readyState&&n()})),window.attachEvent("onload",n))}}((()=>{if(this.isClosed_)return;this.scriptTagHolder=new Gl(((...t)=>{const[e,n,i,s,r]=t;if(this.incrementIncomingBytes_(t),this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,e===Bl)this.id=n,this.password=i;else{if("close"!==e)throw new Error("Unrecognized command received: "+e);n?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(n,(()=>{this.onClosed_()}))):this.onClosed_()}}),((...t)=>{const[e,n]=t;this.incrementIncomingBytes_(t),this.myPacketOrderer.handleResponse(e,n)}),(()=>{this.onClosed_()}),this.urlFn);const t={start:"t"};t.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=this.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",this.transportSessionId&&(t.s=this.transportSessionId),this.lastSessionId&&(t.ls=this.lastSessionId),this.applicationId&&(t.p=this.applicationId),this.appCheckToken&&(t.ac=this.appCheckToken),"undefined"!=typeof location&&location.hostname&&Dl.test(location.hostname)&&(t.r="f");const e=this.urlFn(t);this.log_("Connecting via long-poll to "+e),this.scriptTagHolder.addTag(e,(()=>{}))}))}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){Kl.forceAllow_=!0}static forceDisallow(){Kl.forceDisallow_=!0}static isAvailable(){return!!Kl.forceAllow_||!(Kl.forceDisallow_||"undefined"==typeof document||null==document.createElement||"object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)||"object"==typeof Windows&&"object"==typeof Windows.UI)}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const e=Es(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);const n=ps(e),i=Il(n,1840);for(let t=0;t<i.length;t++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[t]),this.curSegmentNum++}addDisconnectPingFrame(t,e){this.myDisconnFrame=document.createElement("iframe");const n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(t){const e=Es(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)}}class Gl{constructor(t,e,n,i){this.onDisconnect=n,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=ul(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=e,this.myIFrame=Gl.createI
vendor: 4,330 bytes, lines 1671-1687
1671Frame_();let n="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)){n='<script>document.domain="'+document.domain+'";<\/script>'}const i="<html><body>"+n+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){fl("frame writing exception"),t.stack&&fl(t.stack),fl(t)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||fl("No IE domain setting required")}catch(e){const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout((()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)}),Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;let e=this.urlFn(t),n="",i=0;for(;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+n.length<=1870))break;{const t=this.pendingSegs.shift();n=n+"&seg"+i+"="+t.seg+"&ts"+i+"="+t.ts+"&d"+i+"="+t.d,i++}}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1}enqueueSegment(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,e){this.outstandingRequests.add(e);const n=()=>{this.outstandingRequests.delete(e),this.newRequest_()},i=setTimeout(n,Math.floor(25e3));this.addTag(t,(()=>{clearTimeout(i),n()}))}addTag(t,e){setTimeout((()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const t=n.readyState;t&&"loaded"!==t&&"complete"!==t||(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),e())},n.onerror=()=>{fl("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch(t){}}),Math.floor(1))}}
1672/**
1673     * @license
1674     * Copyright 2017 Google LLC
1675     *
1676     * Licensed under the Apache License, Version 2.0 (the "License");
1677     * you may not use this file except in compliance with the License.
1678     * You may obtain a copy of the License at
1679     *
1680     *   http://www.apache.org/licenses/LICENSE-2.0
1681     *
1682     * Unless required by applicable law or agreed to in writing, software
1683     * distributed under the License is distributed on an "AS IS" BASIS,
1684     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1685     * See the License for the specific language governing permissions and
1686     * limitations under the License.
1687     */let Yl=null;"undefined"!=typeof MozWebSocket?Yl=MozWebSocket:"undefined"!=typeof WebSocket&&(Yl=WebSocket);class Jl{constructor(t,e,n,i,s,r,o){this.connId=t,this.applicationId=n,this.appCheckToken=i,this.authToken=s,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ml(this.connId),this.stats_=zl(e),this.connURL=Jl.connectionURL_(e,r,o,i),this.nodeAdmin=e.nodeAdmin}static connectionURL_(t,e,n,i){const s={v:"5"};return"undefined"!=typeof location&&location.hostname&&Dl.test(location.hostname)&&(s.r="f"),e&&(s.s=e),n&&(s.ls=n),i&&(s.ac=i),ql(t,Ml,s)}open(t,e){this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,ol.set("previous_websocket_failure",!0);try{if(bs());else{const t={headers:{"X-Firebase-GMPID":this.applicationId||"","X-Firebase-AppCheck":this.appCheckToken||""}};this.mySock=new Yl(this.connURL,[],t)}}catch(t){this.log_("Error instantiating WebSocket.");const e=t.message||t.data;return e&&this.log_(e),void this.onClosed_()}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0}
vendor: 4,185 bytes, lines 1687-1715
1687,this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=t=>{this.handleIncomingFrame(t)},this.mySock.onerror=t=>{this.log_("WebSocket error.  Closing connection.");const e=t.message||t.data;e&&this.log_(e),this.onClosed_()}}start(){}static forceDisallow(){Jl.forceDisallow_=!0}static isAvailable(){let t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){const e=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(e);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&null!==Yl&&!Jl.forceDisallow_}static previouslyFailed(){return ol.isInMemoryStorage||!0===ol.get("previous_websocket_failure")}markConnectionHealthy(){ol.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const t=this.frames.join("");this.frames=null;const e=Is(t);this.onMessage(e)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if(us(null===this.frames,"We already have a frame buffer"),t.length<=6){const e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(null===this.mySock)return;const e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{const t=this.extractFrameCount_(e);null!==t&&this.appendFrame_(t)}}send(t){this.resetKeepAlive();const e=Es(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);const n=Il(e,16384);n.length>1&&this.sendString_(String(n.length));for(let t=0;t<n.length;t++)this.sendString_(n[t])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval((()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()}),Math.floor(45e3))}sendString_(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}Jl.responsesRequiredToBeHealthy=2,Jl.healthyTimeout=3e4;
1688/**
1689     * @license
1690     * Copyright 2017 Google LLC
1691     *
1692     * Licensed under the Apache License, Version 2.0 (the "License");
1693     * you may not use this file except in compliance with the License.
1694     * You may obtain a copy of the License at
1695     *
1696     *   http://www.apache.org/licenses/LICENSE-2.0
1697     *
1698     * Unless required by applicable law or agreed to in writing, software
1699     * distributed under the License is distributed on an "AS IS" BASIS,
1700     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1701     * See the License for the specific language governing permissions and
1702     * limitations under the License.
1703     */
1704class Ql{constructor(t){this.initTransports_(t)}static get ALL_TRANSPORTS(){return[Kl,Jl]}initTransports_(t){const e=Jl&&Jl.isAvailable();let n=e&&!Jl.previouslyFailed();if(t.webSocketOnly&&(e||_l("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),n=!0),n)this.transports_=[Jl];else{const t=this.transports_=[];for(const e of Ql.ALL_TRANSPORTS)e&&e.isAvailable()&&t.push(e)}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}
1705/**
1706     * @license
1707     * Copyright 2017 Google LLC
1708     *
1709     * Licensed under the Apache License, Version 2.0 (the "License");
1710     * you may not use this file except in compliance with the License.
1711     * You may obtain a copy of the License at
1712     *
1713     *   http://www.apache.org/licenses/LICENSE-2.0
1714     *
1715     * Unless required by applicable law or agreed to in writing, softw
vendor: 7,310 bytes, lines 1715-1725
1715are
1716     * distributed under the License is distributed on an "AS IS" BASIS,
1717     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1718     * See the License for the specific language governing permissions and
1719     * limitations under the License.
1720     */class Xl{constructor(t,e,n,i,s,r,o,a,l,u){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.appCheckToken_=i,this.authToken_=s,this.onMessage_=r,this.onReady_=o,this.onDisconnect_=a,this.onKill_=l,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ml("c:"+this.id+":"),this.transportManager_=new Ql(e),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const e=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout((()=>{this.conn_&&this.conn_.open(e,n)}),Math.floor(0));const i=t.healthyTimeout||0;i>0&&(this.healthyTimeout_=Ol((()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes.  Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>10240?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes.  Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))}),Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return e=>{t===this.conn_?this.onConnectionLost_(e):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return e=>{2!==this.state_&&(t===this.rx_?this.onPrimaryMessageReceived_(e):t===this.secondaryConn_?this.onSecondaryMessageReceived_(e):this.log_("message on old connection"))}}sendRequest(t){const e={t:"d",d:t};this.sendData_(e)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if("t"in t){const e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const e=Cl("t",t),n=Cl("d",t);if("c"===e)this.onSecondaryControl_(n);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const e=Cl("t",t),n=Cl("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const e=Cl("t",t);if("d"in t){const n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let t=0;t<this.pendingDataMessages.length;++t)this.onDataMessage_(this.pendingDataMessages[t]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?gl("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):gl("Unknown control packet command: "+e)}}onHandshake_(t){const e=t.ts,n=t.v,i=t.h;this.sessionId=t.s,this.repoInfo_.host=i,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&_l("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)}startUpgrade_(t){this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const e=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(e,n),Ol((()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())}),Math.floor(6e4))}onReset_(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.host=t,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,e){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):Ol((()=>{this.sendPingOnPrimaryIfNecessary_()}),Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()}onConnectionLost_(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(ol.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)}close(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}
1721/**
1722     * @license
1723     * Copyright 2017 Google LLC
1724     *
1725     * Licensed under the Apache License, Version 2.0 (the "License");
1726     * you may not use this file except in compliance with the License.
1727     * You may obtain a copy of the License at
1728     *
1729     *   http://www.apache.org/licenses/LICENSE-2.0
1730     *
1731     * Unless required by applicable law or agreed to in writing, software
1732     * distributed under the License is distributed on an "AS IS" BASIS,
1733     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1734     * See the License for the specific language governing permissions and
1735     * limitations under the License.
1736     */class Zl{put(t,e,n,i){}merge(t,e,n,i){}refreshAuthToken(t){}refreshAppCheckToken(t){}onDisconnectPut(t,e,n){}onDisconnectMerge(t,e,n){}onDisconnectCancel(t,e){}reportStats(t){}}
1737/**
1738     * @license
1739     * Copyright 2017 Google LLC
1740     *
1741     * Licensed under the Apache License, Version 2.0 (the "License");
1742     * you may not use this file except in compliance with the License.
1743     * You may obtain a copy of the License at
1744     *
1745     *   http://www.apache.org/licenses/LICENSE-2.0
1746     *
1747     * Unless required by applicable law or agreed to in writing, software
1748     * distributed under the License is distributed on an "AS IS" BASIS,
1749     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1750     * See the License for the specific language governing permissions and
1751     * limitations under the License.
1752     */class tu{constructor(t){this.allowedEvents_=t,this.listeners_={},us(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}trigger(t,...e){if(Array.isArray(this.listeners_[t])){const n=[...this.listeners_[t]];for(let t=0;t<n.length;t++)n[t].callback.apply(n[t].context,e)}}on(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});const i=this.getInitialEvent(t);i&&e.apply(n,i)}off(t,e,n){this.validateEventType_(t);const i=this.listeners_[t]||[];for(let t=0;t<i.length;t++)if(i[t].callback===e&&(!n||n===i[t].context))return void i.splice(t,1)}validateEventType_(t){us(this.allowedEvents_.find((e=>e===t)),"Unknown event: "+t)}}
1753/**
1754     * @license
1755     * Copyright 2017 Google LLC
1756     *
1757     * Licensed under the Apache License, Version 2.0 (the "License");
1758     * you may not use this file except in compliance with the License.
1759     * You may obtain a copy of the License at
1760     *
1761     *   http://www.apache.org/licenses/LICENSE-2.0
1762     *
1763     * Unless required by applicable law or agreed to in writing, software
1764     * distributed under the License is distributed on an "AS IS" BASIS,
1765     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1766     * See the License for the specific language governing permissions and
1767     * limitations under the License.
1768     */class eu extends tu{constructor(){super(["online"]),this.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||ks()||(window.addEventListener("online",(()=>{this.online_||(this.online_=!0,this.trigger("online",!0))}),!1),window.addEventListener("offline",(()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))}),!1))}static getInstance(){return new eu}getInitialEvent(t){return us("online"===t,"Unknown event type: "+t),[this.online_]}currentlyOnline(){return this.online_}}
1769/**
1770     * @license
1771     * Copyright 2017 Google LLC
1772     *
1773     * Licensed under the Apache License, Version 2.0 (the "License");
1774     * you may not use this file except in compliance with the License.
1775     * You may obtain a copy of the License at
1776     *
1777     *   http://www.apache.org/licenses/LICENSE-2.0
1778     *
1779     * Unless required by applicable law or agreed to in writing, software
1780     * distributed under the License is distributed on an "AS IS" BASIS,
1781     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1782     * See the License for the specific language governing permissions and
1783     * limitations under the License.
1784     */class nu{constructor(t,e){if(void 0===e){this.pieces_=t.split("/");let e=0;for(let t=0;t<this.pieces_.length;t++)this.pieces_[t].length>0&&(this.pieces_[e]=this.pieces_[t],e++);this.pieces_.length=e,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}toString(){let t="";for(let e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"}}function iu(){return new nu("")}function su(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ru(t){return t.pieces_.length-t.pieceNum_}function ou(t){let e=t.pieceNum_;return e<t.pieces_.length&&e++,new nu(t.pieces_,e)}function au(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function lu(t,e=0){return t.pieces_.slice(t.pieceNum_+e)}function uu(t){if(t.pieceNum_>=t.pieces_.length)return null;const e=[];for(let n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new nu(e,0)}function cu(t,e){const n=[];for(let e=t.pieceNum_;e<t.pieces_.length;e++)n.push(t.pieces_[e]);if(e instanceof nu)for(let t=e.pieceNum_;t<e.pieces_.length;t++)n.push(e.pieces_[t]);else{const t=e.split("/");for(let e=0;e<t.length;e++)t[e].length>0&&n.push(t[e])}return new nu(n,0)}function hu(t){return t.pieceNum_>=t.pieces_.length}function du(t,e){const n=su(t),i=su(e);if(null===n)return e;if(n===i)return du(ou(t),ou(e));
vendor: 8,958 bytes, lines 1784-1816
1784throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function pu(t,e){if(ru(t)!==ru(e))return!1;for(let n=t.pieceNum_,i=e.pieceNum_;n<=t.pieces_.length;n++,i++)if(t.pieces_[n]!==e.pieces_[i])return!1;return!0}function fu(t,e){let n=t.pieceNum_,i=e.pieceNum_;if(ru(t)>ru(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[i])return!1;++n,++i}return!0}class mu{constructor(t,e){this.errorPrefix_=e,this.parts_=lu(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(let t=0;t<this.parts_.length;t++)this.byteLength_+=Fs(this.parts_[t]);gu(this)}}function gu(t){if(t.byteLength_>768)throw new Error(t.errorPrefix_+"has a key path longer than 768 bytes ("+t.byteLength_+").");if(t.parts_.length>32)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+vu(t))}function vu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}
1785/**
1786     * @license
1787     * Copyright 2017 Google LLC
1788     *
1789     * Licensed under the Apache License, Version 2.0 (the "License");
1790     * you may not use this file except in compliance with the License.
1791     * You may obtain a copy of the License at
1792     *
1793     *   http://www.apache.org/licenses/LICENSE-2.0
1794     *
1795     * Unless required by applicable law or agreed to in writing, software
1796     * distributed under the License is distributed on an "AS IS" BASIS,
1797     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1798     * See the License for the specific language governing permissions and
1799     * limitations under the License.
1800     */class _u extends tu{constructor(){let t,e;super(["visible"]),"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(e="visibilitychange",t="hidden"):void 0!==document.mozHidden?(e="mozvisibilitychange",t="mozHidden"):void 0!==document.msHidden?(e="msvisibilitychange",t="msHidden"):void 0!==document.webkitHidden&&(e="webkitvisibilitychange",t="webkitHidden")),this.visible_=!0,e&&document.addEventListener(e,(()=>{const e=!document[t];e!==this.visible_&&(this.visible_=e,this.trigger("visible",e))}),!1)}static getInstance(){return new _u}getInitialEvent(t){return us("visible"===t,"Unknown event type: "+t),[this.visible_]}}
1801/**
1802     * @license
1803     * Copyright 2017 Google LLC
1804     *
1805     * Licensed under the Apache License, Version 2.0 (the "License");
1806     * you may not use this file except in compliance with the License.
1807     * You may obtain a copy of the License at
1808     *
1809     *   http://www.apache.org/licenses/LICENSE-2.0
1810     *
1811     * Unless required by applicable law or agreed to in writing, software
1812     * distributed under the License is distributed on an "AS IS" BASIS,
1813     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1814     * See the License for the specific language governing permissions and
1815     * limitations under the License.
1816     */const yu=1e3;class ku extends Zl{constructor(t,e,n,i,s,r,o,a){if(super(),this.repoInfo_=t,this.applicationId_=e,this.onDataUpdate_=n,this.onConnectStatus_=i,this.onServerInfoUpdate_=s,this.authTokenProvider_=r,this.appCheckTokenProvider_=o,this.authOverride_=a,this.id=ku.nextPersistentConnectionId_++,this.log_=ml("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=yu,this.maxReconnectDelay_=3e5,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,a&&!bs())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");_u.getInstance().on("visible",this.onVisible_,this),-1===t.host.indexOf("fblocal")&&eu.getInstance().on("online",this.onOnline_,this)}sendRequest(t,e,n){const i=++this.requestNumber_,s={r:i,a:t,b:e};this.log_(Es(s)),us(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(s),n&&(this.requestCBHash_[i]=n)}get(t){this.initConnection_();const e=new _s,n={p:t._path.toString(),q:t._queryObject},i={action:"g",request:n,onComplete:t=>{const i=t.d;"ok"===t.s?(this.onDataUpdate_(n.p,i,!1,null),e.resolve(i)):e.reject(i)}};this.outstandingGets_.push(i),this.outstandingGetCount_++;const s=this.outstandingGets_.length-1;return this.connected_||setTimeout((()=>{const t=this.outstandingGets_[s];void 0!==t&&i===t&&(delete this.outstandingGets_[s],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),this.log_("get "+s+" timed out on connection"),e.reject(new Error("Client is offline.")))}),3e3),this.connected_&&this.sendGet_(s),e.promise}listen(t,e,n,i){this.initConnection_();const s=t._queryIdentifier,r=t._path.toString();this.log_("Listen called for "+r+" "+s),this.listens.has(r)||this.listens.set(r,new Map),us(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),us(!this.listens.get(r).has(s),"listen() called twice for same path/queryId.");const o={onComplete:i,hashFn:e,query:t,tag:n};this.listens.get(r).set(s,o),this.connected_&&this.sendListen_(o)}sendGet_(t){const e=this.outstandingGets_[t];this.sendRequest("g",e.request,(n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),e.onComplete&&e.onComplete(n)}))}sendListen_(t){const e=t.query,n=e._path.toString(),i=e._queryIdentifier;this.log_("Listen on "+n+" for "+i);const s={p:n};t.tag&&(s.q=e._queryObject,s.t=t.tag),s.h=t.hashFn(),this.sendRequest("q",s,(s=>{const r=s.d,o=s.s;ku.warnOnListenWarnings_(r,e);(this.listens.get(n)&&this.listens.get(n).get(i))===t&&(this.log_("listen response",s),"ok"!==o&&this.removeListen_(n,i),t.onComplete&&t.onComplete(o,r))}))}static warnOnListenWarnings_(t,e){if(t&&"object"==typeof t&&Ns(t,"w")){const n=Rs(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const t='".indexOn": "'+e._queryParams.getIndex().toString()+'"',n=e._path.toString();_l(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${t} at ${n} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},(()=>{})),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&40===t.length||function(t){const e=xs(t).claims;return"object"==typeof e&&!0===e.admin}(t))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},(()=>{}))}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,e=function(t){const e=xs(t).claims;return!!e&&"object"==typeof e&&e.hasOwnProperty("iat")}(t)?"auth":"gauth",n={cred:t};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(e,n,(e=>{const n=e.s,i=e.d||"error";this.authToken_===t&&("ok"===n?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(n,i))}))}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},(t=>{const e=t.s,n=t.d||"error";"ok"===e?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(e,n)}))}unlisten(t,e){const n=t._path.toString(),i=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+i),us(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query");this.removeListen_(n,i)&&this.connected_&&this.sendUnlisten_(n,i,t._queryObject,e)}sendUnlisten_(t,e,n,i){this.log_("Unlisten on "+t+" for "+e);const s={p:t};i&&(s.q=n,s.t=i),this.sendRequest("n",s)}onDisconnectPut(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})}onDisconnectMerge(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})}onDisconnectCancel(t,e){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})}sendOnDisconnect_(t,e,n,i){const s={p:e,d:n};this.log_("onDisconnect "+t,s),this.sendRequest(t,s,(t=>
vendor: 8,295 bytes, lines 1816-1838
1816{i&&setTimeout((()=>{i(t.s,t.d)}),Math.floor(0))}))}put(t,e,n,i){this.putInternal("p",t,e,n,i)}merge(t,e,n,i){this.putInternal("m",t,e,n,i)}putInternal(t,e,n,i,s){this.initConnection_();const r={p:e,d:n};void 0!==s&&(r.h=s),this.outstandingPuts_.push({action:t,request:r,onComplete:i}),this.outstandingPutCount_++;const o=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(o):this.log_("Buffering put: "+e)}sendPut_(t){const e=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(e,n,(n=>{this.log_(e+" response",n),delete this.outstandingPuts_[t],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),i&&i(n.s,n.d)}))}reportStats(t){if(this.connected_){const e={c:t};this.log_("reportStats",e),this.sendRequest("s",e,(t=>{if("ok"!==t.s){const e=t.d;this.log_("reportStats","Error sending stats: "+e)}}))}}onDataMessage_(t){if("r"in t){this.log_("from server: "+Es(t));const e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"apc"===t?this.onAppCheckRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):gl("Unrecognized action received from server: "+Es(t)+"\nAre you using the latest client?")}onReady_(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){us(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout((()=>{this.establishConnectionTimer_=null,this.establishConnection_()}),Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=yu,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=yu,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){if(this.visible_){if(this.lastConnectionEstablishedTime_){(new Date).getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=yu),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();const t=(new Date).getTime()-this.lastConnectionAttemptTime_;let e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),e=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+ku.nextConnectionId_++,s=this.lastSessionId;let r=!1,o=null;const a=function(){o?o.close():(r=!0,n())},l=function(t){us(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(t)};this.realtime_={close:a,sendRequest:l};const u=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[a,l]=await Promise.all([this.authTokenProvider_.getToken(u),this.appCheckTokenProvider_.getToken(u)]);r?fl("getToken() completed but was canceled"):(fl("getToken() completed. Creating connection."),this.authToken_=a&&a.accessToken,this.appCheckToken_=l&&l.token,o=new Xl(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,e,n,(t=>{_l(t+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")}),s))}catch(t){this.log_("Failed to get token: "+t),r||(this.repoInfo_.nodeAdmin&&_l(t),a())}}}interrupt(t){fl("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){fl("Resuming connection for reason: "+t),delete this.interruptReasons_[t],Ps(this.interruptReasons_)&&(this.reconnectDelay_=yu,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})}cancelSentTransactions_(){for(let t=0;t<this.outstandingPuts_.length;t++){const e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(t,e){let n;n=e?e.map((t=>Sl(t))).join("$"):"default";const i=this.removeListen_(t,n);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(t,e){const n=new nu(t).toString();let i;if(this.listens.has(n)){const t=this.listens.get(n);i=t.get(e),t.delete(e),0===t.size&&this.listens.delete(n)}else i=void 0;return i}onAuthRevoked_(t,e){fl("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,e){fl("App check token revoked: "+t+"/"+e),this.appCheckToken_=null,this.forceTokenRefresh_=!0,"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const e of t.values())this.sendListen_(e);for(let t=0;t<this.outstandingPuts_.length;t++)this.outstandingPuts_[t]&&this.sendPut_(t);for(;this.onDisconnectRequestQueue_.length;){const t=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(t.action,t.pathString,t.data,t.onComplete)}for(let t=0;t<this.outstandingGets_.length;t++)this.outstandingGets_[t]&&this.sendGet_(t)}sendConnectStats_(){const t={};t["sdk.js."+nl.replace(/\./g,"-")]=1,ks()?t["framework.cordova"]=1:ws()&&(t["framework.reactnative"]=1),this.reportStats(t)}shouldReconnect_(){const t=eu.getInstance().currentlyOnline();return Ps(this.interruptReasons_)&&t}}ku.nextPersistentConnectionId_=0,ku.nextConnectionId_=0;
1817/**
1818     * @license
1819     * Copyright 2017 Google LLC
1820     *
1821     * Licensed under the Apache License, Version 2.0 (the "License");
1822     * you may not use this file except in compliance with the License.
1823     * You may obtain a copy of the License at
1824     *
1825     *   http://www.apache.org/licenses/LICENSE-2.0
1826     *
1827     * Unless required by applicable law or agreed to in writing, software
1828     * distributed under the License is distributed on an "AS IS" BASIS,
1829     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1830     * See the License for the specific language governing permissions and
1831     * limitations under the License.
1832     */
1833class wu{constructor(t,e){this.name=t,this.node=e}static Wrap(t,e){return new wu(t,e)}}
1834/**
1835     * @license
1836     * Copyright 2017 Google LLC
1837     *
1838     * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 5,960 bytes, lines 1839-1881
1839     * you may not use this file except in compliance with the License.
1840     * You may obtain a copy of the License at
1841     *
1842     *   http://www.apache.org/licenses/LICENSE-2.0
1843     *
1844     * Unless required by applicable law or agreed to in writing, software
1845     * distributed under the License is distributed on an "AS IS" BASIS,
1846     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1847     * See the License for the specific language governing permissions and
1848     * limitations under the License.
1849     */class bu{getCompare(){return this.compare.bind(this)}indexedValueChanged(t,e){const n=new wu(kl,t),i=new wu(kl,e);return 0!==this.compare(n,i)}minPost(){return wu.MIN}}
1850/**
1851     * @license
1852     * Copyright 2017 Google LLC
1853     *
1854     * Licensed under the Apache License, Version 2.0 (the "License");
1855     * you may not use this file except in compliance with the License.
1856     * You may obtain a copy of the License at
1857     *
1858     *   http://www.apache.org/licenses/LICENSE-2.0
1859     *
1860     * Unless required by applicable law or agreed to in writing, software
1861     * distributed under the License is distributed on an "AS IS" BASIS,
1862     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1863     * See the License for the specific language governing permissions and
1864     * limitations under the License.
1865     */let Tu;class Cu extends bu{static get __EMPTY_NODE(){return Tu}static set __EMPTY_NODE(t){Tu=t}compare(t,e){return bl(t.name,e.name)}isDefinedOn(t){throw cs("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(t,e){return!1}minPost(){return wu.MIN}maxPost(){return new wu(wl,Tu)}makePost(t,e){return us("string"==typeof t,"KeyIndex indexValue must always be a string."),new wu(t,Tu)}toString(){return".key"}}const Su=new Cu;
1866/**
1867     * @license
1868     * Copyright 2017 Google LLC
1869     *
1870     * Licensed under the Apache License, Version 2.0 (the "License");
1871     * you may not use this file except in compliance with the License.
1872     * You may obtain a copy of the License at
1873     *
1874     *   http://www.apache.org/licenses/LICENSE-2.0
1875     *
1876     * Unless required by applicable law or agreed to in writing, software
1877     * distributed under the License is distributed on an "AS IS" BASIS,
1878     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1879     * See the License for the specific language governing permissions and
1880     * limitations under the License.
1881     */class Iu{constructor(t,e,n,i,s=null){this.isReverse_=i,this.resultGenerator_=s,this.nodeStack_=[];let r=1;for(;!t.isEmpty();)if(t=t,r=e?n(t.key,e):1,i&&(r*=-1),r<0)t=this.isReverse_?t.left:t.right;else{if(0===r){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}getNext(){if(0===this.nodeStack_.length)return null;let t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class Eu{constructor(t,e,n,i,s){this.key=t,this.value=e,this.color=null!=n?n:Eu.RED,this.left=null!=i?i:xu.EMPTY_NODE,this.right=null!=s?s:xu.EMPTY_NODE}copy(t,e,n,i,s){return new Eu(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=s?s:this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let i=this;const s=n(t,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===s?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp_()}removeMin_(){if(this.left.isEmpty())return xu.EMPTY_NODE;let t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,e){let n,i;if(n=this,e(t,n.key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return xu.EMPTY_NODE;i=n.right.min_(),n=n.copy(i.key,i.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,Eu.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,Eu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}
vendor: 26,886 bytes, lines 1881-2082
1881check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}Eu.RED=!0,Eu.BLACK=!1;class xu{constructor(t,e=xu.EMPTY_NODE){this.comparator_=t,this.root_=e}insert(t,e){return new xu(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,Eu.BLACK,null,null))}remove(t){return new xu(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Eu.BLACK,null,null))}get(t){let e,n=this.root_;for(;!n.isEmpty();){if(e=this.comparator_(t,n.key),0===e)return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null}getPredecessorKey(t){let e,n=this.root_,i=null;for(;!n.isEmpty();){if(e=this.comparator_(t,n.key),0===e){if(n.left.isEmpty())return i?i.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(i=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new Iu(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,e){return new Iu(this.root_,t,this.comparator_,!1,e)}getReverseIteratorFrom(t,e){return new Iu(this.root_,t,this.comparator_,!0,e)}getReverseIterator(t){return new Iu(this.root_,null,this.comparator_,!0,t)}}
1882/**
1883     * @license
1884     * Copyright 2017 Google LLC
1885     *
1886     * Licensed under the Apache License, Version 2.0 (the "License");
1887     * you may not use this file except in compliance with the License.
1888     * You may obtain a copy of the License at
1889     *
1890     *   http://www.apache.org/licenses/LICENSE-2.0
1891     *
1892     * Unless required by applicable law or agreed to in writing, software
1893     * distributed under the License is distributed on an "AS IS" BASIS,
1894     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1895     * See the License for the specific language governing permissions and
1896     * limitations under the License.
1897     */
1898function Nu(t,e){return bl(t.name,e.name)}function Ru(t,e){return bl(t,e)}
1899/**
1900     * @license
1901     * Copyright 2017 Google LLC
1902     *
1903     * Licensed under the Apache License, Version 2.0 (the "License");
1904     * you may not use this file except in compliance with the License.
1905     * You may obtain a copy of the License at
1906     *
1907     *   http://www.apache.org/licenses/LICENSE-2.0
1908     *
1909     * Unless required by applicable law or agreed to in writing, software
1910     * distributed under the License is distributed on an "AS IS" BASIS,
1911     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1912     * See the License for the specific language governing permissions and
1913     * limitations under the License.
1914     */let Pu;xu.EMPTY_NODE=new class{copy(t,e,n,i,s){return this}insert(t,e,n){return new Eu(t,e,null)}remove(t,e){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}};const Ou=function(t){return"number"==typeof t?"number:"+xl(t):"string:"+t},Au=function(t){if(t.isLeafNode()){const e=t.val();us("string"==typeof e||"number"==typeof e||"object"==typeof e&&Ns(e,".sv"),"Priority must be a string or number.")}else us(t===Pu||t.isEmpty(),"priority of unexpected type.");us(t===Pu||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};
1915/**
1916     * @license
1917     * Copyright 2017 Google LLC
1918     *
1919     * Licensed under the Apache License, Version 2.0 (the "License");
1920     * you may not use this file except in compliance with the License.
1921     * You may obtain a copy of the License at
1922     *
1923     *   http://www.apache.org/licenses/LICENSE-2.0
1924     *
1925     * Unless required by applicable law or agreed to in writing, software
1926     * distributed under the License is distributed on an "AS IS" BASIS,
1927     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1928     * See the License for the specific language governing permissions and
1929     * limitations under the License.
1930     */
1931let ju,$u,Du;class Mu{constructor(t,e=Mu.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=e,this.lazyHash_=null,us(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Au(this.priorityNode_)}static set __childrenNodeConstructor(t){ju=t}static get __childrenNodeConstructor(){return ju}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Mu(this.value_,t)}getImmediateChild(t){return".priority"===t?this.priorityNode_:Mu.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return hu(t)?this:".priority"===su(t)?this.priorityNode_:Mu.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,e){return null}updateImmediateChild(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:Mu.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)}updateChild(t,e){const n=su(t);return null===n?e:e.isEmpty()&&".priority"!==n?this:(us(".priority"!==n||1===ru(t),".priority must be the last token in a path"),this.updateImmediateChild(n,Mu.__childrenNodeConstructor.EMPTY_NODE.updateChild(ou(t),e)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,e){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+Ou(this.priorityNode_.val())+":");const e=typeof this.value_;t+=e+":",t+="number"===e?xl(this.value_):this.value_,this.lazyHash_=cl(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Mu.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Mu.__childrenNodeConstructor?-1:(us(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const e=typeof t.value_,n=typeof this.value_,i=Mu.VALUE_TYPE_ORDER.indexOf(e),s=Mu.VALUE_TYPE_ORDER.indexOf(n);return us(i>=0,"Unknown leaf type: "+e),us(s>=0,"Unknown leaf type: "+n),i===s?"object"===n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:s-i}withIndex(){return this}isIndexed(){return!0}equals(t){if(t===this)return!0;if(t.isLeafNode()){const e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1}}Mu.VALUE_TYPE_ORDER=["object","boolean","number","string"];const Lu=new class extends bu{compare(t,e){const n=t.node.getPriority(),i=e.node.getPriority(),s=n.compareTo(i);return 0===s?bl(t.name,e.name):s}isDefinedOn(t){return!t.getPriority().isEmpty()}indexedValueChanged(t,e){return!t.getPriority().equals(e.getPriority())}minPost(){return wu.MIN}maxPost(){return new wu(wl,new Mu("[PRIORITY-POST]",Du))}makePost(t,e){const n=$u(t);return new wu(e,new Mu("[PRIORITY-POST]",n))}toString(){return".priority"}},Fu=Math.log(2);
1932/**
1933     * @license
1934     * Copyright 2017 Google LLC
1935     *
1936     * Licensed under the Apache License, Version 2.0 (the "License");
1937     * you may not use this file except in compliance with the License.
1938     * You may obtain a copy of the License at
1939     *
1940     *   http://www.apache.org/licenses/LICENSE-2.0
1941     *
1942     * Unless required by applicable law or agreed to in writing, software
1943     * distributed under the License is distributed on an "AS IS" BASIS,
1944     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1945     * See the License for the specific language governing permissions and
1946     * limitations under the License.
1947     */class qu{constructor(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Fu,10)),this.current_=this.count-1;const n=(i=this.count,parseInt(Array(i+1).join("1"),2));var i;this.bits_=t+1&n}nextBitIsOne(){const t=!(this.bits_&1<<this.current_);return this.current_--,t}}const Uu=function(t,e,n,i){t.sort(e);const s=function(e,i){const r=i-e;let o,a;if(0===r)return null;if(1===r)return o=t[e],a=n?n(o):o,new Eu(a,o.node,Eu.BLACK,null,null);{const l=parseInt(r/2,10)+e,u=s(e,l),c=s(l+1,i);return o=t[l],a=n?n(o):o,new Eu(a,o.node,Eu.BLACK,u,c)}},r=function(e){let i=null,r=null,o=t.length;const a=function(e,i){const r=o-e,a=o;o-=e;const u=s(r+1,a),c=t[r],h=n?n(c):c;l(new Eu(h,c.node,i,null,u))},l=function(t){i?(i.left=t,i=t):(r=t,i=t)};for(let t=0;t<e.count;++t){const n=e.nextBitIsOne(),i=Math.pow(2,e.count-(t+1));n?a(i,Eu.BLACK):(a(i,Eu.BLACK),a(i,Eu.RED))}return r}(new qu(t.length));return new xu(i||e,r)};
1948/**
1949     * @license
1950     * Copyright 2017 Google LLC
1951     *
1952     * Licensed under the Apache License, Version 2.0 (the "License");
1953     * you may not use this file except in compliance with the License.
1954     * You may obtain a copy of the License at
1955     *
1956     *   http://www.apache.org/licenses/LICENSE-2.0
1957     *
1958     * Unless required by applicable law or agreed to in writing, software
1959     * distributed under the License is distributed on an "AS IS" BASIS,
1960     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1961     * See the License for the specific language governing permissions and
1962     * limitations under the License.
1963     */let Wu;const Hu={};class zu{constructor(t,e){this.indexes_=t,this.indexSet_=e}static get Default(){return us(Hu&&Lu,"ChildrenNode.ts has not been loaded"),Wu=Wu||new zu({".priority":Hu},{".priority":Lu}),Wu}get(t){const e=Rs(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof xu?e:null}hasIndex(t){return Ns(this.indexSet_,t.toString())}addIndex(t,e){us(t!==Su,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const n=[];let i=!1;const s=e.getIterator(wu.Wrap);let r,o=s.getNext();for(;o;)i=i||t.isDefinedOn(o.node),n.push(o),o=s.getNext();r=i?Uu(n,t.getCompare()):Hu;const a=t.toString(),l=Object.assign({},this.indexSet_);l[a]=t;const u=Object.assign({},this.indexes_);return u[a]=r,new zu(u,l)}addToIndexes(t,e){const n=Os(this.indexes_,((n,i)=>{const s=Rs(this.indexSet_,i);if(us(s,"Missing index implementation for "+i),n===Hu){if(s.isDefinedOn(t.node)){const n=[],i=e.getIterator(wu.Wrap);let r=i.getNext();for(;r;)r.name!==t.name&&n.push(r),r=i.getNext();return n.push(t),Uu(n,s.getCompare())}return Hu}{const i=e.get(t.name);let s=n;return i&&(s=s.remove(new wu(t.name,i))),s.insert(t,t.node)}}));return new zu(n,this.indexSet_)}removeFromIndexes(t,e){const n=Os(this.indexes_,(n=>{if(n===Hu)return n;{const i=e.get(t.name);return i?n.remove(new wu(t.name,i)):n}}));return new zu(n,this.indexSet_)}}
1964/**
1965     * @license
1966     * Copyright 2017 Google LLC
1967     *
1968     * Licensed under the Apache License, Version 2.0 (the "License");
1969     * you may not use this file except in compliance with the License.
1970     * You may obtain a copy of the License at
1971     *
1972     *   http://www.apache.org/licenses/LICENSE-2.0
1973     *
1974     * Unless required by applicable law or agreed to in writing, software
1975     * distributed under the License is distributed on an "AS IS" BASIS,
1976     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1977     * See the License for the specific language governing permissions and
1978     * limitations under the License.
1979     */let Vu;class Bu{constructor(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Au(this.priorityNode_),this.children_.isEmpty()&&us(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}static get EMPTY_NODE(){return Vu||(Vu=new Bu(new xu(Ru),null,zu.Default))}isLeafNode(){return!1}getPriority(){return this.priorityNode_||Vu}updatePriority(t){return this.children_.isEmpty()?this:new Bu(this.children_,t,this.indexMap_)}getImmediateChild(t){if(".priority"===t)return this.getPriority();{const e=this.children_.get(t);return null===e?Vu:e}}getChild(t){const e=su(t);return null===e?this:this.getImmediateChild(e).getChild(ou(t))}hasChild(t){return null!==this.children_.get(t)}updateImmediateChild(t,e){if(us(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);{const n=new wu(t,e);let i,s;e.isEmpty()?(i=this.children_.remove(t),s=this.indexMap_.removeFromIndexes(n,this.children_)):(i=this.children_.insert(t,e),s=this.indexMap_.addToIndexes(n,this.children_));const r=i.isEmpty()?Vu:this.priorityNode_;return new Bu(i,r,s)}}updateChild(t,e){const n=su(t);if(null===n)return e;{us(".priority"!==su(t)||1===ru(t),".priority must be the last token in a path");const i=this.getImmediateChild(n).updateChild(ou(t),e);return this.updateImmediateChild(n,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const e={};let n=0,i=0,s=!0;if(this.forEachChild(Lu,((r,o)=>{e[r]=o.val(t),n++,s&&Bu.INTEGER_REGEXP_.test(r)?i=Math.max(i,Number(r)):s=!1})),!t&&s&&i<2*n){const t=[];for(const n in e)t[n]=e[n];return t}return t&&!this.getPriority().isEmpty()&&(e[".priority"]=this.getPriority().val()),e}hash(){if(null===this.lazyHash_){let t="";this.getPriority().isEmpty()||(t+="priority:"+Ou(this.getPriority().val())+":"),this.forEachChild(Lu,((e,n)=>{const i=n.hash();""!==i&&(t+=":"+e+":"+i)})),this.lazyHash_=""===t?"":cl(t)}return this.lazyHash_}getPredecessorChildName(t,e,n){const i=this.resolveIndex_(n);if(i){const n=i.getPredecessorKey(new wu(t,e));return n?n.name:null}return this.children_.getPredecessorKey(t)}getFirstChildName(t){const e=this.resolveIndex_(t);if(e){const t=e.minKey();return t&&t.name}return this.children_.minKey()}getFirstChild(t){const e=this.getFirstChildName(t);return e?new wu(e,this.children_.get(e)):null}getLastChildName(t){const e=this.resolveIndex_(t);if(e){const t=e.maxKey();return t&&t.name}return this.children_.maxKey()}getLastChild(t){const e=this.getLastChildName(t);return e?new wu(e,this.children_.get(e)):null}forEachChild(t,e){const n=this.resolveIndex_(t);return n?n.inorderTraversal((t=>e(t.name,t.node))):this.children_.inorderTraversal(e)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,e){const n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,(t=>t));{const n=this.children_.getIteratorFrom(t.name,wu.Wrap);let i=n.peek();for(;null!=i&&e.compare(i,t)<0;)n.getNext(),i=n.peek();return n}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,e){const n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,(t=>t));{const n=this.children_.getReverseIteratorFrom(t.name,wu.Wrap);let i=n.peek();for(;null!=i&&e.compare(i,t)>0;)n.getNext(),i=n.peek();return n}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Ku?-1:0}withIndex(t){if(t===Su||this.indexMap_.hasIndex(t))return this;{const e=this.indexMap_.addIndex(t,this.children_);return new Bu(this.children_,this.priorityNode_,e)}}isIndexed(t){return t===Su||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){const t=this.getIterator(Lu),n=e.getIterator(Lu);let i=t.getNext(),s=n.getNext();for(;i&&s;){if(i.name!==s.name||!i.node.equals(s.node))return!1;i=t.getNext(),s=n.getNext()}return null===i&&null===s}return!1}return!1}}resolveIndex_(t){return t===Su?null:this.indexMap_.get(t.toString())}}Bu.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;const Ku=new class extends Bu{constructor(){super(new xu(Ru),Bu.EMPTY_NODE,zu.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return Bu.EMPTY_NODE}isEmpty(){return!1}};Object.defineProperties(wu,{MIN:{value:new wu(kl,Bu.EMPTY_NODE)},MAX:{value:new wu(wl,Ku)}}),Cu.__EMPTY_NODE=Bu.EMPTY_NODE,Mu.__childrenNodeConstructor=Bu,Pu=Ku,function(t){Du=t}(Ku);function Gu(t,e=null){if(null===t)return Bu.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(e=t[".priority"]),us(null===e||"string"==typeof e||"number"==typeof e||"object"==typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"==typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!=typeof t||".sv"in t){return new Mu(t,Gu(e))}if(t instanceof Array){let n=Bu.EMPTY_NODE;return El(t,((e,i)=>{if(Ns(t,e)&&"."!==e.substring(0,1)){const t=Gu(i);!t.isLeafNode()&&t.isEmpty()||(n=n.updateImmediateChild(e,t))}})),n.updatePriority(Gu(e))}{const n=[];let i=!1;if(El(t,((t,e)=>{if("."!==t.substring(0,1)){const s=Gu(e);s.isEmpty()||(i=i||!s.getPriority().isEmpty(),n.push(new wu(t,s)))}})),0===n.length)return Bu.EMPTY_NODE;const s=Uu(n,Nu,(t=>t.name),Ru);if(i){const t=Uu(n,Lu.getCompare());return new Bu(s,Gu(e),new zu({".priority":t},{".priority":Lu}))}return new Bu(s,Gu(e),zu.Default)}}!function(t){$u=t}(Gu);
1980/**
1981     * @license
1982     * Copyright 2017 Google LLC
1983     *
1984     * Licensed under the Apache License, Version 2.0 (the "License");
1985     * you may not use this file except in compliance with the License.
1986     * You may obtain a copy of the License at
1987     *
1988     *   http://www.apache.org/licenses/LICENSE-2.0
1989     *
1990     * Unless required by applicable law or agreed to in writing, software
1991     * distributed under the License is distributed on an "AS IS" BASIS,
1992     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1993     * See the License for the specific language governing permissions and
1994     * limitations under the License.
1995     */
1996class Yu extends bu{constructor(t){super(),this.indexPath_=t,us(!hu(t)&&".priority"!==su(t),"Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,e){const n=this.extractChild(t.node),i=this.extractChild(e.node),s=n.compareTo(i);return 0===s?bl(t.name,e.name):s}makePost(t,e){const n=Gu(t),i=Bu.EMPTY_NODE.updateChild(this.indexPath_,n);return new wu(e,i)}maxPost(){const t=Bu.EMPTY_NODE.updateChild(this.indexPath_,Ku);return new wu(wl,t)}toString(){return lu(this.indexPath_,0).join("/")}}
1997/**
1998     * @license
1999     * Copyright 2017 Google LLC
2000     *
2001     * Licensed under the Apache License, Version 2.0 (the "License");
2002     * you may not use this file except in compliance with the License.
2003     * You may obtain a copy of the License at
2004     *
2005     *   http://www.apache.org/licenses/LICENSE-2.0
2006     *
2007     * Unless required by applicable law or agreed to in writing, software
2008     * distributed under the License is distributed on an "AS IS" BASIS,
2009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2010     * See the License for the specific language governing permissions and
2011     * limitations under the License.
2012     */const Ju=new class extends bu{compare(t,e){const n=t.node.compareTo(e.node);return 0===n?bl(t.name,e.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,e){return!t.equals(e)}minPost(){return wu.MIN}maxPost(){return wu.MAX}makePost(t,e){const n=Gu(t);return new wu(e,n)}toString(){return".value"}};
2013/**
2014     * @license
2015     * Copyright 2017 Google LLC
2016     *
2017     * Licensed under the Apache License, Version 2.0 (the "License");
2018     * you may not use this file except in compliance with the License.
2019     * You may obtain a copy of the License at
2020     *
2021     *   http://www.apache.org/licenses/LICENSE-2.0
2022     *
2023     * Unless required by applicable law or agreed to in writing, software
2024     * distributed under the License is distributed on an "AS IS" BASIS,
2025     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2026     * See the License for the specific language governing permissions and
2027     * limitations under the License.
2028     */function Qu(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}
2029/**
2030     * @license
2031     * Copyright 2017 Google LLC
2032     *
2033     * Licensed under the Apache License, Version 2.0 (the "License");
2034     * you may not use this file except in compliance with the License.
2035     * You may obtain a copy of the License at
2036     *
2037     *   http://www.apache.org/licenses/LICENSE-2.0
2038     *
2039     * Unless required by applicable law or agreed to in writing, software
2040     * distributed under the License is distributed on an "AS IS" BASIS,
2041     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2042     * See the License for the specific language governing permissions and
2043     * limitations under the License.
2044     */
2045class Xu{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Lu}hasStart(){return this.startSet_}hasStartAfter(){return this.startAfterSet_}hasEndBefore(){return this.endBeforeSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return us(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return us(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:kl}hasEnd(){return this.endSet_}getIndexEndValue(){return us(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return us(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:wl}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return us(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Lu}copy(){const t=new Xu;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function Zu(t){const e={};if(t.isDefault())return e;let n;return t.index_===Lu?n="$priority":t.index_===Ju?n="$value":t.index_===Su?n="$key":(us(t.index_ instanceof Yu,"Unrecognized index type!"),n=t.index_.toString()),e.orderBy=Es(n),t.startSet_&&(e.startAt=Es(t.indexStartValue_),t.startNameSet_&&(e.startAt+=","+Es(t.indexStartName_))),t.endSet_&&(e.endAt=Es(t.indexEndValue_),t.endNameSet_&&(e.endAt+=","+Es(t.indexEndName_))),t.limitSet_&&(t.isViewFromLeft()?e.limitToFirst=t.limit_:e.limitToLast=t.limit_),e}function tc(t){const e={};if(t.startSet_&&(e.sp=t.indexStartValue_,t.startNameSet_&&(e.sn=t.indexStartName_)),t.endSet_&&(e.ep=t.indexEndValue_,t.endNameSet_&&(e.en=t.indexEndName_)),t.limitSet_){e.l=t.limit_;let n=t.viewFrom_;""===n&&(n=t.isViewFromLeft()?"l":"r"),e.vf=n}return t.index_!==Lu&&(e.i=t.index_.toString()),e}
2046/**
2047     * @license
2048     * Copyright 2017 Google LLC
2049     *
2050     * Licensed under the Apache License, Version 2.0 (the "License");
2051     * you may not use this file except in compliance with the License.
2052     * You may obtain a copy of the License at
2053     *
2054     *   http://www.apache.org/licenses/LICENSE-2.0
2055     *
2056     * Unless required by applicable law or agreed to in writing, software
2057     * distributed under the License is distributed on an "AS IS" BASIS,
2058     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2059     * See the License for the specific language governing permissions and
2060     * limitations under the License.
2061     */class ec extends Zl{constructor(t,e,n,i){super(),this.repoInfo_=t,this.onDataUpdate_=e,this.authTokenProvider_=n,this.appCheckTokenProvider_=i,this.log_=ml("p:rest:"),this.listens_={}}reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,e){return void 0!==e?"tag$"+e:(us(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}listen(t,e,n,i){const s=t._path.toString();this.log_("Listen called for "+s+" "+t._queryIdentifier);const r=ec.getListenId_(t,n),o={};this.listens_[r]=o;const a=Zu(t._queryParams);this.restRequest_(s+".json",a,((t,e)=>{let a=e;if(404===t&&(a=null,t=null),null===t&&this.onDataUpdate_(s,a,!1,n),Rs(this.listens_,r)===o){let e;e=t?401===t?"permission_denied":"rest_error:"+t:"ok",i(e,null)}}))}unlisten(t,e){const n=ec.getListenId_(t,e);delete this.listens_[n]}get(t){const e=Zu(t._queryParams),n=t._path.toString(),i=new _s;return this.restRequest_(n+".json",e,((t,e)=>{let s=e;404===t&&(s=null,t=null),null===t?(this.onDataUpdate_(n,s,!1,null),i.resolve(s)):i.reject(new Error(s))})),i.promise}refreshAuthToken(t){}restRequest_(t,e={},n){return e.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then((([i,s])=>{i&&i.accessToken&&(e.auth=i.accessToken),s&&s.token&&(e.ac=s.token);const r=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+$s(e);this.log_("Sending REST request for "+r);const o=new XMLHttpRequest;o.onreadystatechange=()=>{if(n&&4===o.readyState){this.log_("REST Response for "+r+" received. status:",o.status,"response:",o.responseText);let t=null;if(o.status>=200&&o.status<300){try{t=Is(o.responseText)}catch(t){_l("Failed to parse JSON response for "+r+": "+o.responseText)}n(null,t)}else 401!==o.status&&404!==o.status&&_l("Got unsuccessful REST response for "+r+" Status: "+o.status),n(o.status);n=null}},o.open("GET",r,!0),o.send()}))}}
2062/**
2063     * @license
2064     * Copyright 2017 Google LLC
2065     *
2066     * Licensed under the Apache License, Version 2.0 (the "License");
2067     * you may not use this file except in compliance with the License.
2068     * You may obtain a copy of the License at
2069     *
2070     *   http://www.apache.org/licenses/LICENSE-2.0
2071     *
2072     * Unless required by applicable law or agreed to in writing, software
2073     * distributed under the License is distributed on an "AS IS" BASIS,
2074     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2075     * See the License for the specific language governing permissions and
2076     * limitations under the License.
2077     */class nc{constructor(){this.rootNode_=Bu.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)}}
2078/**
2079     * @license
2080     * Copyright 2017 Google LLC
2081     *
2082     * Licensed under the Apache License, Version 2.0 (the "License");
2083     * you may not use this file except in compliance with the License.
2084     * You may obtain a copy of the License at
2085     *
2086     *   http://www.apache.org/licenses/LICENSE-2.0
2087     *
2088     * Unless required by applicable law or agreed to in writing, software
2089     * distributed under the License is distributed on an "AS IS" BASIS,
2090     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2091     * See the License for the specific language governing permissions and
2092     * limitations under the License.
2093     */function ic(){return{value:null,children:new Map}}function sc(t,e,n){if(hu(e))t.value=n,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(e,n);else{const i=su(e);t.children.has(i)||t.children.set(i,ic());sc(t.children.get(i),e=ou(e),n)}}function rc(t,e,n){null!==t.value?n(e,t.value):function(t,e){t.children.forEach(((t,n)=>{e(n,t)}))}
2094/**
2095     * @license
2096     * Copyright 2017 Google LLC
2097     *
2098     * Licensed under the Apache License, Version 2.0 (the "License");
2099     * you may not use this file except in compliance with the License.
2100     * You may obtain a copy of the License at
2101     *
2102     *   http://www.apache.org/licenses/LICENSE-2.0
2103     *
2104     * Unless required by applicable law or agreed to in writing, software
2105     * distributed under the License is distributed on an "AS IS" BASIS,
2106     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2107     * See the License for the specific language governing permissions and
2108     * limitations under the License.
2109     */(t,((t,i)=>{rc(i,new nu(e.toString()+"/"+t),n)}))}class oc{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),e=Object.assign({},t);return this.last_&&El(this.last_,((t,n)=>{e[t]=e[t]-n})),this.last_=t,e}}
2110/**
2111     * @license
2112     * Copyright 2017 Google LLC
2113     *
2114     * Licensed under the Apache License, Version 2.0 (the "License");
2115     * you may not use this file except in compliance with the License.
2116     * You may obtain a copy of the License at
2117     *
2118     *   http://www.apache.org/licenses/LICENSE-2.0
2119     *
2120     * Unless required by applicable law or agreed to in writing, software
2121     * distributed under the License is distributed on an "AS IS" BASIS,
2122     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2123     * See the License for the specific language governing permissions and
2124     * limitations under the License.
2125     */class ac{constructor(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new oc(t);const n=1e4+2e4*Math.random();Ol(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),e={};let n=!1;El(t,((t,i)=>{i>0&&Ns(this.statsToReport_,t)&&(e[t]=i,n=!0)})),n&&this.server_.reportStats(e),Ol(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}
2126/**
2127     * @license
2128     * Copyright 2017 Google LLC
2129     *
2130     * Licensed under the Apache License, Version 2.0 (the "License");
2131     * you may not use this file except in compliance with the License.
2132     * You may obtain a copy of the License at
2133     *
2134     *   http://www.apache.org/licenses/LICENSE-2.0
2135     *
2136     * Unless required by applicable law or agreed to in writing, software
2137     * distributed under the License is distributed on an "AS IS" BASIS,
2138     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2139     * See the License for the specific language governing permissions and
2140     * limitations under the License.
2141     */var lc;function uc(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}
2142/**
2143     * @license
2144     * Copyright 2017 Google LLC
2145     *
2146     * Licensed under the Apache License, Version 2.0 (the "License");
2147     * you may not use this file except in compliance with the License.
2148     * You may obtain a copy of the License at
2149     *
2150     *   http://www.apache.org/licenses/LICENSE-2.0
2151     *
2152     * Unless required by applicable law or agreed to in writing, software
2153     * distributed under the License is distributed on an "AS IS" BASIS,
2154     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2155     * See the License for the specific language governing permissions and
2156     * limitations under the License.
2157     */!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(lc||(lc={}));class cc{constructor(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=lc.ACK_USER_WRITE,this.source={fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}operationForChild(t){if(hu(this.path)){if(null!=this.affectedTree.value)return us(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const e=this.affectedTree.subtree(new nu(t));return new cc(iu(),e,this.revert)}}return us(su(this.path)===t,"operationForChild called for unrelated child."),new cc(ou(this.path),this.affectedTree,this.revert)}}
2158/**
2159     * @license
2160     * Copyright 2017 Google LLC
2161     *
2162     * Licensed under the Apache License, Version 2.0 (the "License");
2163     * you may not use this file except in compliance with the License.
2164     * You may obtain a copy of the License at
2165     *
2166     *   http://www.apache.org/licenses/LICENSE-2.0
2167     *
2168     * Unless required by applicable law or agreed to in writing, software
2169     * distributed under the License is distributed on an "AS IS" BASIS,
2170     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2171     * See the License for the specific language governing permissions and
2172     * limitations under the License.
2173     */class hc{constructor(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=lc.OVERWRITE}operationForChild(t){return hu(this.path)?new hc(this.source,iu(),this.snap.getImmediateChild(t)):new hc(this.source,ou(this.path),this.snap)}}
2174/**
2175     * @license
2176     * Copyright 2017 Google LLC
2177     *
2178     * Licensed under the Apache License, Version 2.0 (the "License");
2179     * you may not use this file except in compliance with the License.
2180     * You may obtain a copy of the License at
2181     *
2182     *   http://www.apache.org/licenses/LICENSE-2.0
2183     *
2184     * Unless required by applicable law or agreed to in writing, software
2185     * distributed under the License is distributed on an "AS IS" BASIS,
2186     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2187     * See the License for the specific language governing permissions and
2188     * limitations under the License.
2189     */class dc{constructor(t,e,n){this.source=t,this.path=e,this.children=n,this.type=lc.MERGE}operationForChild(t){if(hu(this.path)){const e=this.children.subtree(new nu(t));return e.isEmpty()?null:e.value?new hc(this.source,iu(),e.value):new dc(this.source,iu(),e)}return us(su(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new dc(this.source,ou(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}
2190/**
2191     * @license
2192     * Copyright 2017 Google LLC
2193     *
2194     * Licensed under the Apache License, Version 2.0 (the "License");
2195     * you may not use this file except in compliance with the License.
2196     * You may obtain a copy of the License at
2197     *
2198     *   http://www.apache.org/licenses/LICENSE-2.0
2199     *
2200     * Unless required by applicable law or agreed to in writing, software
2201     * distributed under the License is distributed on an "AS IS" BASIS,
2202     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2203     * See the License for the specific language governing permissions and
2204     * limitations under the License.
2205     */class pc{constructor(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(hu(t))return this.isFullyInitialized()&&!this.filtered_;const e=su(t);return this.isCompleteForChild(e)}isCompleteForChild(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)}getNode(){return this.node_}}function fc(t,e,n,i,s,r){const o=i.filter((t=>t.type===n));o.sort(((e,n)=>function(t,e,n){if(null==e.childName||null==n.childName)throw cs("Should only compare child_ events.");const i=new wu(e.childName,e.snapshotNode),s=new wu(n.childName,n.snapshotNode);return t.index_.compare(i,s)}
2206/**
2207     * @license
2208     * Copyright 2017 Google LLC
2209     *
2210     * Licensed under the Apache License, Version 2.0 (the "License");
2211     * you may not use this file except in compliance with the License.
2212     * You may obtain a copy of the License at
2213     *
2214     *   http://www.apache.org/licenses/LICENSE-2.0
2215     *
2216     * Unless required by applicable law or agreed to in writing, software
2217     * distributed under the License is distributed on an "AS IS" BASIS,
2218     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2219     * See the License for the specific language governing permissions and
2220     * limitations under the License.
2221     */(t,e,n))),o.forEach((n=>{const i=function(t,e,n){return"value"===e.type||"child_removed"===e.type||(e.prevName=n.getPredecessorChildName(e.childName,e.snapshotNode,t.index_)),e}(t,n,r);
vendor: 23,572 bytes, lines 2221-2338
2221s.forEach((s=>{s.respondsTo(n.type)&&e.push(s.createEvent(i,t.query_))}))}))}function mc(t,e){return{eventCache:t,serverCache:e}}function gc(t,e,n,i){return mc(new pc(e,n,i),t.serverCache)}function vc(t,e,n,i){return mc(t.eventCache,new pc(e,n,i))}function _c(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function yc(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}
2222/**
2223     * @license
2224     * Copyright 2017 Google LLC
2225     *
2226     * Licensed under the Apache License, Version 2.0 (the "License");
2227     * you may not use this file except in compliance with the License.
2228     * You may obtain a copy of the License at
2229     *
2230     *   http://www.apache.org/licenses/LICENSE-2.0
2231     *
2232     * Unless required by applicable law or agreed to in writing, software
2233     * distributed under the License is distributed on an "AS IS" BASIS,
2234     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2235     * See the License for the specific language governing permissions and
2236     * limitations under the License.
2237     */let kc;class wc{constructor(t,e=(()=>(kc||(kc=new xu(Tl)),kc))()){this.value=t,this.children=e}static fromObject(t){let e=new wc(null);return El(t,((t,n)=>{e=e.set(new nu(t),n)})),e}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,e){if(null!=this.value&&e(this.value))return{path:iu(),value:this.value};if(hu(t))return null;{const n=su(t),i=this.children.get(n);if(null!==i){const s=i.findRootMostMatchingPathAndValue(ou(t),e);if(null!=s){return{path:cu(new nu(n),s.path),value:s.value}}return null}return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,(()=>!0))}subtree(t){if(hu(t))return this;{const e=su(t),n=this.children.get(e);return null!==n?n.subtree(ou(t)):new wc(null)}}set(t,e){if(hu(t))return new wc(e,this.children);{const n=su(t),i=(this.children.get(n)||new wc(null)).set(ou(t),e),s=this.children.insert(n,i);return new wc(this.value,s)}}remove(t){if(hu(t))return this.children.isEmpty()?new wc(null):new wc(null,this.children);{const e=su(t),n=this.children.get(e);if(n){const i=n.remove(ou(t));let s;return s=i.isEmpty()?this.children.remove(e):this.children.insert(e,i),null===this.value&&s.isEmpty()?new wc(null):new wc(this.value,s)}return this}}get(t){if(hu(t))return this.value;{const e=su(t),n=this.children.get(e);return n?n.get(ou(t)):null}}setTree(t,e){if(hu(t))return e;{const n=su(t),i=(this.children.get(n)||new wc(null)).setTree(ou(t),e);let s;return s=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),new wc(this.value,s)}}fold(t){return this.fold_(iu(),t)}fold_(t,e){const n={};return this.children.inorderTraversal(((i,s)=>{n[i]=s.fold_(cu(t,i),e)})),e(t,this.value,n)}findOnPath(t,e){return this.findOnPath_(t,iu(),e)}findOnPath_(t,e,n){const i=!!this.value&&n(e,this.value);if(i)return i;if(hu(t))return null;{const i=su(t),s=this.children.get(i);return s?s.findOnPath_(ou(t),cu(e,i),n):null}}foreachOnPath(t,e){return this.foreachOnPath_(t,iu(),e)}foreachOnPath_(t,e,n){if(hu(t))return this;{this.value&&n(e,this.value);const i=su(t),s=this.children.get(i);return s?s.foreachOnPath_(ou(t),cu(e,i),n):new wc(null)}}foreach(t){this.foreach_(iu(),t)}foreach_(t,e){this.children.inorderTraversal(((n,i)=>{i.foreach_(cu(t,n),e)})),this.value&&e(t,this.value)}foreachChild(t){this.children.inorderTraversal(((e,n)=>{n.value&&t(e,n.value)}))}}
2238/**
2239     * @license
2240     * Copyright 2017 Google LLC
2241     *
2242     * Licensed under the Apache License, Version 2.0 (the "License");
2243     * you may not use this file except in compliance with the License.
2244     * You may obtain a copy of the License at
2245     *
2246     *   http://www.apache.org/licenses/LICENSE-2.0
2247     *
2248     * Unless required by applicable law or agreed to in writing, software
2249     * distributed under the License is distributed on an "AS IS" BASIS,
2250     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2251     * See the License for the specific language governing permissions and
2252     * limitations under the License.
2253     */class bc{constructor(t){this.writeTree_=t}static empty(){return new bc(new wc(null))}}function Tc(t,e,n){if(hu(e))return new bc(new wc(n));{const i=t.writeTree_.findRootMostValueAndPath(e);if(null!=i){const s=i.path;let r=i.value;const o=du(s,e);return r=r.updateChild(o,n),new bc(t.writeTree_.set(s,r))}{const i=new wc(n),s=t.writeTree_.setTree(e,i);return new bc(s)}}}function Cc(t,e,n){let i=t;return El(n,((t,n)=>{i=Tc(i,cu(e,t),n)})),i}function Sc(t,e){if(hu(e))return bc.empty();{const n=t.writeTree_.setTree(e,new wc(null));return new bc(n)}}function Ic(t,e){return null!=Ec(t,e)}function Ec(t,e){const n=t.writeTree_.findRootMostValueAndPath(e);return null!=n?t.writeTree_.get(n.path).getChild(du(n.path,e)):null}function xc(t){const e=[],n=t.writeTree_.value;return null!=n?n.isLeafNode()||n.forEachChild(Lu,((t,n)=>{e.push(new wu(t,n))})):t.writeTree_.children.inorderTraversal(((t,n)=>{null!=n.value&&e.push(new wu(t,n.value))})),e}function Nc(t,e){if(hu(e))return t;{const n=Ec(t,e);return new bc(null!=n?new wc(n):t.writeTree_.subtree(e))}}function Rc(t){return t.writeTree_.isEmpty()}function Pc(t,e){return Oc(iu(),t.writeTree_,e)}function Oc(t,e,n){if(null!=e.value)return n.updateChild(t,e.value);{let i=null;return e.children.inorderTraversal(((e,s)=>{".priority"===e?(us(null!==s.value,"Priority writes must always be leaf nodes"),i=s.value):n=Oc(cu(t,e),s,n)})),n.getChild(t).isEmpty()||null===i||(n=n.updateChild(cu(t,".priority"),i)),n}}
2254/**
2255     * @license
2256     * Copyright 2017 Google LLC
2257     *
2258     * Licensed under the Apache License, Version 2.0 (the "License");
2259     * you may not use this file except in compliance with the License.
2260     * You may obtain a copy of the License at
2261     *
2262     *   http://www.apache.org/licenses/LICENSE-2.0
2263     *
2264     * Unless required by applicable law or agreed to in writing, software
2265     * distributed under the License is distributed on an "AS IS" BASIS,
2266     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2267     * See the License for the specific language governing permissions and
2268     * limitations under the License.
2269     */function Ac(t,e){return Bc(e,t)}function jc(t,e){const n=t.allWrites.findIndex((t=>t.writeId===e));us(n>=0,"removeWrite called with nonexistent writeId.");const i=t.allWrites[n];t.allWrites.splice(n,1);let s=i.visible,r=!1,o=t.allWrites.length-1;for(;s&&o>=0;){const e=t.allWrites[o];e.visible&&(o>=n&&$c(e,i.path)?s=!1:fu(i.path,e.path)&&(r=!0)),o--}if(s){if(r)return function(t){t.visibleWrites=Mc(t.allWrites,Dc,iu()),t.allWrites.length>0?t.lastWriteId=t.allWrites[t.allWrites.length-1].writeId:t.lastWriteId=-1}(t),!0;if(i.snap)t.visibleWrites=Sc(t.visibleWrites,i.path);else{El(i.children,(e=>{t.visibleWrites=Sc(t.visibleWrites,cu(i.path,e))}))}return!0}return!1}function $c(t,e){if(t.snap)return fu(t.path,e);for(const n in t.children)if(t.children.hasOwnProperty(n)&&fu(cu(t.path,n),e))return!0;return!1}function Dc(t){return t.visible}function Mc(t,e,n){let i=bc.empty();for(let s=0;s<t.length;++s){const r=t[s];if(e(r)){const t=r.path;let e;if(r.snap)fu(n,t)?(e=du(n,t),i=Tc(i,e,r.snap)):fu(t,n)&&(e=du(t,n),i=Tc(i,iu(),r.snap.getChild(e)));else{if(!r.children)throw cs("WriteRecord should have .snap or .children");if(fu(n,t))e=du(n,t),i=Cc(i,e,r.children);else if(fu(t,n))if(e=du(t,n),hu(e))i=Cc(i,iu(),r.children);else{const t=Rs(r.children,su(e));if(t){const n=t.getChild(ou(e));i=Tc(i,iu(),n)}}}}}return i}function Lc(t,e,n,i,s){if(i||s){const r=Nc(t.visibleWrites,e);if(!s&&Rc(r))return n;if(s||null!=n||Ic(r,iu())){const r=function(t){return(t.visible||s)&&(!i||!~i.indexOf(t.writeId))&&(fu(t.path,e)||fu(e,t.path))};return Pc(Mc(t.allWrites,r,e),n||Bu.EMPTY_NODE)}return null}{const i=Ec(t.visibleWrites,e);if(null!=i)return i;{const i=Nc(t.visibleWrites,e);if(Rc(i))return n;if(null!=n||Ic(i,iu())){return Pc(i,n||Bu.EMPTY_NODE)}return null}}}function Fc(t,e,n,i){return Lc(t.writeTree,t.treePath,e,n,i)}function qc(t,e){return function(t,e,n){let i=Bu.EMPTY_NODE;const s=Ec(t.visibleWrites,e);if(s)return s.isLeafNode()||s.forEachChild(Lu,((t,e)=>{i=i.updateImmediateChild(t,e)})),i;if(n){const s=Nc(t.visibleWrites,e);return n.forEachChild(Lu,((t,e)=>{const n=Pc(Nc(s,new nu(t)),e);i=i.updateImmediateChild(t,n)})),xc(s).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}return xc(Nc(t.visibleWrites,e)).forEach((t=>{i=i.updateImmediateChild(t.name,t.node)})),i}(t.writeTree,t.treePath,e)}function Uc(t,e,n,i){return function(t,e,n,i,s){us(i||s,"Either existingEventSnap or existingServerSnap must exist");const r=cu(e,n);if(Ic(t.visibleWrites,r))return null;{const e=Nc(t.visibleWrites,r);return Rc(e)?s.getChild(n):Pc(e,s.getChild(n))}}(t.writeTree,t.treePath,e,n,i)}function Wc(t,e){return function(t,e){return Ec(t.visibleWrites,e)}(t.writeTree,cu(t.treePath,e))}function Hc(t,e,n,i,s,r){return function(t,e,n,i,s,r,o){let a;const l=Nc(t.visibleWrites,e),u=Ec(l,iu());if(null!=u)a=u;else{if(null==n)return[];a=Pc(l,n)}if(a=a.withIndex(o),a.isEmpty()||a.isLeafNode())return[];{const t=[],e=o.getCompare(),n=r?a.getReverseIteratorFrom(i,o):a.getIteratorFrom(i,o);let l=n.getNext();for(;l&&t.length<s;)0!==e(l,i)&&t.push(l),l=n.getNext();return t}}(t.writeTree,t.treePath,e,n,i,s,r)}function zc(t,e,n){return function(t,e,n,i){const s=cu(e,n),r=Ec(t.visibleWrites,s);if(null!=r)return r;if(i.isCompleteForChild(n))return Pc(Nc(t.visibleWrites,s),i.getNode().getImmediateChild(n));return null}(t.writeTree,t.treePath,e,n)}function Vc(t,e){return Bc(cu(t.treePath,e),t.writeTree)}function Bc(t,e){return{treePath:t,writeTree:e}}
2270/**
2271     * @license
2272     * Copyright 2017 Google LLC
2273     *
2274     * Licensed under the Apache License, Version 2.0 (the "License");
2275     * you may not use this file except in compliance with the License.
2276     * You may obtain a copy of the License at
2277     *
2278     *   http://www.apache.org/licenses/LICENSE-2.0
2279     *
2280     * Unless required by applicable law or agreed to in writing, software
2281     * distributed under the License is distributed on an "AS IS" BASIS,
2282     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2283     * See the License for the specific language governing permissions and
2284     * limitations under the License.
2285     */class Kc{constructor(){this.changeMap=new Map}trackChildChange(t){const e=t.type,n=t.childName;us("child_added"===e||"child_changed"===e||"child_removed"===e,"Only child changes supported for tracking"),us(".priority"!==n,"Only non-priority child changes can be tracked.");const i=this.changeMap.get(n);if(i){const r=i.type;if("child_added"===e&&"child_removed"===r)this.changeMap.set(n,Qu(n,t.snapshotNode,i.snapshotNode));else if("child_removed"===e&&"child_added"===r)this.changeMap.delete(n);else if("child_removed"===e&&"child_changed"===r)this.changeMap.set(n,(s=n,{type:"child_removed",snapshotNode:i.oldSnap,childName:s}));else if("child_changed"===e&&"child_added"===r)this.changeMap.set(n,function(t,e){return{type:"child_added",snapshotNode:e,childName:t}}(n,t.snapshotNode));else{if("child_changed"!==e||"child_changed"!==r)throw cs("Illegal combination of changes: "+t+" occurred after "+i);this.changeMap.set(n,Qu(n,t.snapshotNode,i.oldSnap))}}else this.changeMap.set(n,t);var s}getChanges(){return Array.from(this.changeMap.values())}}
2286/**
2287     * @license
2288     * Copyright 2017 Google LLC
2289     *
2290     * Licensed under the Apache License, Version 2.0 (the "License");
2291     * you may not use this file except in compliance with the License.
2292     * You may obtain a copy of the License at
2293     *
2294     *   http://www.apache.org/licenses/LICENSE-2.0
2295     *
2296     * Unless required by applicable law or agreed to in writing, software
2297     * distributed under the License is distributed on an "AS IS" BASIS,
2298     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2299     * See the License for the specific language governing permissions and
2300     * limitations under the License.
2301     */const Gc=new class{getCompleteChild(t){return null}getChildAfterChild(t,e,n){return null}};class Yc{constructor(t,e,n=null){this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}getCompleteChild(t){const e=this.viewCache_.eventCache;if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);{const e=null!=this.optCompleteServerCache_?new pc(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return zc(this.writes_,t,e)}}getChildAfterChild(t,e,n){const i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:yc(this.viewCache_),s=Hc(this.writes_,i,e,1,n,t);return 0===s.length?null:s[0]}}function Jc(t,e,n,i,s){const r=new Kc;let o,a;if(n.type===lc.OVERWRITE){const l=n;l.source.fromUser?o=Zc(t,e,l.path,l.snap,i,s,r):(us(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered()&&!hu(l.path),o=Xc(t,e,l.path,l.snap,i,s,a,r))}else if(n.type===lc.MERGE){const l=n;l.source.fromUser?o=function(t,e,n,i,s,r,o){let a=e;return i.foreach(((i,l)=>{const u=cu(n,i);th(e,su(u))&&(a=Zc(t,a,u,l,s,r,o))})),i.foreach(((i,l)=>{const u=cu(n,i);th(e,su(u))||(a=Zc(t,a,u,l,s,r,o))})),a}(t,e,l.path,l.children,i,s,r):(us(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.serverCache.isFiltered(),o=nh(t,e,l.path,l.children,i,s,a,r))}else if(n.type===lc.ACK_USER_WRITE){const a=n;o=a.revert?function(t,e,n,i,s,r){let o;if(null!=Wc(i,n))return e;{const a=new Yc(i,e,s),l=e.eventCache.getNode();let u;if(hu(n)||".priority"===su(n)){let n;if(e.serverCache.isFullyInitialized())n=Fc(i,yc(e));else{const t=e.serverCache.getNode();us(t instanceof Bu,"serverChildren would be complete if leaf node"),n=qc(i,t)}n=n,u=t.filter.updateFullNode(l,n,r)}else{const s=su(n);let c=zc(i,s,e.serverCache);null==c&&e.serverCache.isCompleteForChild(s)&&(c=l.getImmediateChild(s)),u=null!=c?t.filter.updateChild(l,s,c,ou(n),a,r):e.eventCache.getNode().hasChild(s)?t.filter.updateChild(l,s,Bu.EMPTY_NODE,ou(n),a,r):l,u.isEmpty()&&e.serverCache.isFullyInitialized()&&(o=Fc(i,yc(e)),o.isLeafNode()&&(u=t.filter.updateFullNode(u,o,r)))}return o=e.serverCache.isFullyInitialized()||null!=Wc(i,iu()),gc(e,u,o,t.filter.filtersNodes())}}(t,e,a.path,i,s,r):function(t,e,n,i,s,r,o){if(null!=Wc(s,n))return e;const a=e.serverCache.isFiltered(),l=e.serverCache;if(null!=i.value){if(hu(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return Xc(t,e,n,l.getNode().getChild(n),s,r,a,o);if(hu(n)){let i=new wc(null);return l.getNode().forEachChild(Su,((t,e)=>{i=i.set(new nu(t),e)})),nh(t,e,n,i,s,r,a,o)}return e}{let u=new wc(null);return i.foreach(((t,e)=>{const i=cu(n,t);l.isCompleteForPath(i)&&(u=u.set(t,l.getNode().getChild(i)))})),nh(t,e,n,u,s,r,a,o)}}(t,e,a.path,a.affectedTree,i,s,r)}else{if(n.type!==lc.LISTEN_COMPLETE)throw cs("Unknown operation type: "+n.type);o=function(t,e,n,i,s){const r=e.serverCache,o=vc(e,r.getNode(),r.isFullyInitialized()||hu(n),r.isFiltered());return Qc(t,o,n,i,Gc,s)}(t,e,n.path,i,r)}const l=r.getChanges();return function(t,e,n){const i=e.eventCache;if(i.isFullyInitialized()){const s=i.getNode().isLeafNode()||i.getNode().isEmpty(),r=_c(t);(n.length>0||!t.eventCache.isFullyInitialized()||s&&!i.getNode().equals(r)||!i.getNode().getPriority().equals(r.getPriority()))&&n.push({type:"value",snapshotNode:_c(e)})}}(e,o,l),{viewCache:o,changes:l}}function Qc(t,e,n,i,s,r){const o=e.eventCache;if(null!=Wc(i,n))return e;{let a,l;if(hu(n))if(us(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()){const n=yc(e),s=qc(i,n instanceof Bu?n:Bu.EMPTY_NODE);a=t.filter.updateFullNode(e.eventCache.getNode(),s,r)}else{const n=Fc(i,yc(e));a=t.filter.updateFullNode(e.eventCache.getNode(),n,r)}else{const u=su(n);if(".priority"===u){us(1===ru(n),"Can't have a priority with additional path components");const s=o.getNode();l=e.serverCache.getNode();const r=Uc(i,n,s,l);a=null!=r?t.filter.updatePriority(s,r):o.getNode()}else{const c=ou(n);let h;if(o.isCompleteForChild(u)){l=e.serverCache.getNode();const t=Uc(i,n,o.getNode(),l);h=null!=t?o.getNode().getImmediateChild(u).updateChild(c,t):o.getNode().getImmediateChild(u)}else h=zc(i,u,e.serverCache);a=null!=h?t.filter.updateChild(o.getNode(),u,h,c,s,r):o.getNode()}}return gc(e,a,o.isFullyInitialized()||hu(n),t.filter.filtersNodes())}}function Xc(t,e,n,i,s,r,o,a){const l=e.serverCache;let u;const c=o?t.filter:t.filter.getIndexedFilter();if(hu(n))u=c.updateFullNode(l.getNode(),i,null);else if(c.filtersNodes()&&!l.isFiltered()){const t=l.getNode().updateChild(n,i);u=c.updateFullNode(l.getNode(),t,null)}else{const t=su(n);if(!l.isCompleteForPath(n)&&ru(n)>1)return e;const s=ou(n),r=l.getNode().getImmediateChild(t).updateChild(s,i);u=".priority"===t?c.updatePriority(l.getNode(),r):c.updateChild(l.getNode(),t,r,s,Gc,null)}const h=vc(e,u,l.isFullyInitialized()||hu(n),c.filtersNodes());return Qc(t,h,n,s,new Yc(s,h,r),a)}function Zc(t,e,n,i,s,r,o){const a=e.eventCache;let l,u;const c=new Yc(s,e,r);if(hu(n))u=t.filter.updateFullNode(e.eventCache.getNode(),i,o),l=gc(e,u,!0,t.filter.filtersNodes());else{const s=su(n);if(".priority"===s)u=t.filter.updatePriority(e.eventCache.getNode(),i),l=gc(e,u,a.isFullyInitialized(),a.isFiltered());else{const r=ou(n),u=a.getNode().getImmediateChild(s);let h;if(hu(r))h=i;else{const t=c.getCompleteChild(s);h=null!=t?".priority"===au(r)&&t.getChild(uu(r)).isEmpty()?t:t.updateChild(r,i):Bu.EMPTY_NODE}if(u.equals(h))l=e;else{l=gc(e,t.filter.updateChild(a.getNode(),s,h,r,c,o),a.isFullyInitialized(),t.filter.filtersNodes())}}}return l}function th(t,e){return t.eventCache.isCompleteForChild(e)}function eh(t,e,n){return n.foreach(((t,n)=>{e=e.updateChild(t,n)})),e}function nh(t,e,n,i,s,r,o,a){if(e.serverCache.getNode().isEmpty()&&!e.serverCache.isFullyInitialized())return e;let l,u=e;l=hu(n)?i:new wc(null).setTree(n,i);const c=e.serverCache.getNode();return l.children.inorderTraversal(((n,i)=>{if(c.hasChild(n)){const l=eh(0,e.serverCache.getNode().getImmediateChild(n),i);u=Xc(t,u,new nu(n),l,s,r,o,a)}})),l.children.inorderTraversal(((n,i)=>{const l=!e.serverCache.isCompleteForChild(n)&&void 0===i.value;if(!c.hasChild(n)&&!l){const l=eh(0,e.serverCache.getNode().getImmediateChild(n),i);u=Xc(t,u,new nu(n),l,s,r,o,a)}})),u}function ih(t,e){const n=yc(t.viewCache_);return n&&(t.query._queryParams.loadsAllData()||!hu(e)&&!n.getImmediateChild(su(e)).isEmpty())?n.getChild(e):null}function sh(t,e,n,i){e.type===lc.MERGE&&null!==e.source.queryId&&(us(yc(t.viewCache_),"We should always have a full cache before handling merges"),us(_c(t.viewCache_),"Missing event cache, even though we have a server cache"));const s=t.viewCache_,r=Jc(t.processor_,s,e,n,i);var o,a;return o=t.processor_,a=r.viewCache,us(a.eventCache.getNode().isIndexed(o.filter.getIndex()),"Event snap not indexed"),us(a.serverCache.getNode().isIndexed(o.filter.getIndex()),"Server snap not indexed"),us(r.viewCache.serverCache.isFullyInitialized()||!s.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=r.viewCache,function(t,e,n,i){const s=i?[i]:t.eventRegistrations_;return function(t,e,n,i){const s=[],r=[];return e.forEach((e=>{var n;"child_changed"===e.type&&t.index_.indexedValueChanged(e.oldSnap,e.snapshotNode)&&r.push((n=e.childName,{type:"child_moved",snapshotNode:e.snapshotNode,childName:n}))})),fc(t,s,"child_removed",e,i,n),fc(t,s,"child_added",e,i,n),fc(t,s,"child_moved",r,i,n),fc(t,s,"child_changed",e,i,n),fc(t,s,"value",e,i,n),s}(t.eventGenerator_,e,n,s)}
2302/**
2303     * @license
2304     * Copyright 2017 Google LLC
2305     *
2306     * Licensed under the Apache License, Version 2.0 (the "License");
2307     * you may not use this file except in compliance with the License.
2308     * You may obtain a copy of the License at
2309     *
2310     *   http://www.apache.org/licenses/LICENSE-2.0
2311     *
2312     * Unless required by applicable law or agreed to in writing, software
2313     * distributed under the License is distributed on an "AS IS" BASIS,
2314     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2315     * See the License for the specific language governing permissions and
2316     * limitations under the License.
2317     */(t,r.changes,r.viewCache.eventCache.getNode(),null)}let rh,oh;function ah(t,e,n,i){const s=e.source.queryId;if(null!==s){const r=t.views.get(s);return us(null!=r,"SyncTree gave us an op for an invalid query."),sh(r,e,n,i)}{let s=[];for(const r of t.views.values())s=s.concat(sh(r,e,n,i));return s}}function lh(t,e){let n=null;for(const i of t.views.values())n=n||ih(i,e);return n}
2318/**
2319     * @license
2320     * Copyright 2017 Google LLC
2321     *
2322     * Licensed under the Apache License, Version 2.0 (the "License");
2323     * you may not use this file except in compliance with the License.
2324     * You may obtain a copy of the License at
2325     *
2326     *   http://www.apache.org/licenses/LICENSE-2.0
2327     *
2328     * Unless required by applicable law or agreed to in writing, software
2329     * distributed under the License is distributed on an "AS IS" BASIS,
2330     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2331     * See the License for the specific language governing permissions and
2332     * limitations under the License.
2333     */class uh{constructor(t){this.listenProvider_=t,this.syncPointTree_=new wc(null),this.pendingWriteTree_={visibleWrites:bc.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function ch(t,e,n,i,s){return function(t,e,n,i,s){us(i>t.lastWriteId,"Stacking an older write on top of newer ones"),void 0===s&&(s=!0),t.allWrites.push({path:e,snap:n,writeId:i,visible:s}),s&&(t.visibleWrites=Tc(t.visibleWrites,e,n)),t.lastWriteId=i}(t.pendingWriteTree_,e,n,i,s),s?fh(t,new hc({fromUser:!0,fromServer:!1,queryId:null,tagged:!1},e,n)):[]}function hh(t,e,n=!1){const i=function(t,e){for(let n=0;n<t.allWrites.length;n++){const i=t.allWrites[n];if(i.writeId===e)return i}return null}(t.pendingWriteTree_,e);if(jc(t.pendingWriteTree_,e)){let e=new wc(null);return null!=i.snap?e=e.set(iu(),!0):El(i.children,(t=>{e=e.set(new nu(t),!0)})),fh(t,new cc(i.path,e,n))}return[]}function dh(t,e,n){return fh(t,new hc({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},e,n))}function ph(t,e,n){const i=t.pendingWriteTree_,s=t.syncPointTree_.findOnPath(e,((t,n)=>{const i=lh(n,du(t,e));if(i)return i}));return Lc(i,e,s,n,!0)}function fh(t,e){return mh(e,t.syncPointTree_,null,Ac(t.pendingWriteTree_,iu()))}function mh(t,e,n,i){if(hu(t.path))return gh(t,e,n,i);{const s=e.get(iu());null==n&&null!=s&&(n=lh(s,iu()));let r=[];const o=su(t.path),a=t.operationForChild(o),l=e.children.get(o);if(l&&a){const t=n?n.getImmediateChild(o):null,e=Vc(i,o);r=r.concat(mh(a,l,t,e))}return s&&(r=r.concat(ah(s,t,i,n))),r}}function gh(t,e,n,i){const s=e.get(iu());null==n&&null!=s&&(n=lh(s,iu()));let r=[];return e.children.inorderTraversal(((e,s)=>{const o=n?n.getImmediateChild(e):null,a=Vc(i,e),l=t.operationForChild(e);l&&(r=r.concat(gh(l,s,o,a)))})),s&&(r=r.concat(ah(s,t,i,n))),r}function vh(t,e){return t.tagToQueryMap.get(e)}function _h(t){const e=t.indexOf("$");return us(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new nu(t.substr(0,e))}}function yh(t,e,n){const i=t.syncPointTree_.get(e);us(i,"Missing sync point for query tag that we're tracking");return ah(i,n,Ac(t.pendingWriteTree_,e),null)}
2334/**
2335     * @license
2336     * Copyright 2017 Google LLC
2337     *
2338     * Licensed under the Apache License, Version 2.0 (the "License");
2339     * you may not use this file except in compliance with the License.
2340     * You may obtain a copy of the License at
2341     *
2342     *   http://www.apache.org/licenses/LICENSE-2.0
2343     *
2344     * Unless required by applicable law or agreed to in writing, software
2345     * distributed under the License is distributed on an "AS IS" BASIS,
2346     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2347     * See the License for the specific language governing permissions and
2348     * limitations under the License.
2349     */class kh{constructor(t){this.node_=t}getImmediateChild(t){const e=this.node_.getImmediateChild(t);return new kh(e)}node(){return this.node_}}class wh{constructor(t,e){this.syncTree_=t,this.path_=e}getImmediateChild(t){const e=cu(this.path_,t);return new wh(this.syncTree_,e)}node(){return ph(this.syncTree_,this.path_)}}const bh=function(t,e,n){return t&&"object"==typeof t?(us(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?Th(t[".sv"],e,n):"object"==typeof t[".sv"]?Ch(t[".sv"],e):void us(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Th=function(t,e,n){if("timestamp"===t)return n.timestamp;us(!1,"Unexpected server value: "+t)},Ch=function(t,e,n){t.hasOwnProperty("increment")||us(!1,"Unexpected server value: "+JSON.stringify(t,null,2));const i=t.increment;"number"!=typeof i&&us(!1,"Unexpected increment value: "+i);const s=e.node();if(us(null!=s,"Expected ChildrenNode.EMPTY_NODE for nulls"),!s.isLeafNode())return i;const r=s.getValue();return"number"!=typeof r?i:r+i},Sh=function(t,e,n){return Ih(t,new kh(e),n)};function Ih(t,e,n){const i=t.getPriority().val(),s=bh(i,e.getImmediateChild(".priority"),n);let r;if(t.isLeafNode()){const i=t,r=bh(i.getValue(),e,n);return r!==i.getValue()||s!==i.getPriority().val()?new Mu(r,Gu(s)):t}{const i=t;return r=i,s!==i.getPriority().val()&&(r=r.updatePriority(new Mu(s))),i.forEachChild(Lu,((t,i)=>{const s=Ih(i,e.getImmediateChild(t),n);s!==i&&(r=r.updateImmediateChild(t,s))}
2349)),r}}
2350/**
2351     * @license
2352     * Copyright 2017 Google LLC
2353     *
2354     * Licensed under the Apache License, Version 2.0 (the "License");
2355     * you may not use this file except in compliance with the License.
2356     * You may obtain a copy of the License at
2357     *
2358     *   http://www.apache.org/licenses/LICENSE-2.0
2359     *
2360     * Unless required by applicable law or agreed to in writing, software
2361     * distributed under the License is distributed on an "AS IS" BASIS,
2362     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2363     * See the License for the specific language governing permissions and
2364     * limitations under the License.
2365     */class Eh{constructor(t="",e=null,n={children:{},childCount:0}){this.name=t,this.parent=e,this.node=n}}function xh(t,e){let n=e instanceof nu?e:new nu(e),i=t,s=su(n);for(;null!==s;){const t=Rs(i.node.children,s)||{children:{},childCount:0};i=new Eh(s,i,t),n=ou(n),s=su(n)}return i}function Nh(t){return t.node.value}function Rh(t,e){t.node.value=e,$h(t)}function Ph(t){return t.node.childCount>0}function Oh(t,e){El(t.node.children,((n,i)=>{e(new Eh(n,t,i))}))}function Ah(t,e,n,i){n&&!i&&e(t),Oh(t,(t=>{Ah(t,e,!0,i)})),n&&i&&e(t)}function jh(t){return new nu(null===t.parent?t.name:jh(t.parent)+"/"+t.name)}function $h(t){null!==t.parent&&function(t,e,n){const i=function(t){return void 0===Nh(t)&&!Ph(t)}(n),s=Ns(t.node.children,e);i&&s?(delete t.node.children[e],t.node.childCount--,$h(t)):i||s||(t.node.children[e]=n.node,t.node.childCount++,$h(t))}
2366/**
2367     * @license
2368     * Copyright 2017 Google LLC
2369     *
2370     * Licensed under the Apache License, Version 2.0 (the "License");
2371     * you may not use this file except in compliance with the License.
2372     * You may obtain a copy of the License at
2373     *
2374     *   http://www.apache.org/licenses/LICENSE-2.0
2375     *
2376     * Unless required by applicable law or agreed to in writing, software
2377     * distributed under the License is distributed on an "AS IS" BASIS,
2378     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2379     * See the License for the specific language governing permissions and
2380     * limitations under the License.
2381     */(t.parent,t.name,t)}const Dh=/[\[\].#$\/\u0000-\u001F\u007F]/,Mh=/[\[\].#$\u0000-\u001F\u007F]/,Lh=10485760,Fh=function(t){return"string"==typeof t&&0!==t.length&&!Dh.test(t)},qh=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),function(t){return"string"==typeof t&&0!==t.length&&!Mh.test(t)}(t)},Uh=function(t,e,n){const i=n instanceof nu?new mu(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+vu(i));if("function"==typeof e)throw new Error(t+"contains a function "+vu(i)+" with contents = "+e.toString());if(yl(e))throw new Error(t+"contains "+e.toString()+" "+vu(i));if("string"==typeof e&&e.length>Lh/3&&Fs(e)>Lh)throw new Error(t+"contains a string greater than "+"10485760 utf8 bytes "+vu(i)+" ('"+e.substring(0,50)+"...')");if(e&&"object"==typeof e){let n=!1,s=!1;if(El(e,((e,r)=>{if(".value"===e)n=!0;else if(".priority"!==e&&".sv"!==e&&(s=!0,!Fh(e)))throw new Error(t+" contains an invalid key ("+e+") "+vu(i)+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');var o,a;a=e,(o=i).parts_.length>0&&(o.byteLength_+=1),o.parts_.push(a),o.byteLength_+=Fs(a),gu(o),Uh(t,r,i),function(t){const e=t.parts_.pop();t.byteLength_-=Fs(e),t.parts_.length>0&&(t.byteLength_-=1)}(i)}
vendor: 12,637 bytes, lines 2381-2441
2381)),n&&s)throw new Error(t+' contains ".value" child '+vu(i)+" in addition to actual children.")}};
2382/**
2383     * @license
2384     * Copyright 2017 Google LLC
2385     *
2386     * Licensed under the Apache License, Version 2.0 (the "License");
2387     * you may not use this file except in compliance with the License.
2388     * You may obtain a copy of the License at
2389     *
2390     *   http://www.apache.org/licenses/LICENSE-2.0
2391     *
2392     * Unless required by applicable law or agreed to in writing, software
2393     * distributed under the License is distributed on an "AS IS" BASIS,
2394     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2395     * See the License for the specific language governing permissions and
2396     * limitations under the License.
2397     */
2398class Wh{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function Hh(t,e,n){!function(t,e){let n=null;for(let i=0;i<e.length;i++){const s=e[i],r=s.getPath();null===n||pu(r,n.path)||(t.eventLists_.push(n),n=null),null===n&&(n={events:[],path:r}),n.events.push(s)}n&&t.eventLists_.push(n)}(t,n),function(t,e){t.recursionDepth_++;let n=!0;for(let i=0;i<t.eventLists_.length;i++){const s=t.eventLists_[i];if(s){e(s.path)?(zh(t.eventLists_[i]),t.eventLists_[i]=null):n=!1}}n&&(t.eventLists_=[]);t.recursionDepth_--}(t,(t=>fu(t,e)||fu(e,t)))}function zh(t){for(let e=0;e<t.events.length;e++){const n=t.events[e];if(null!==n){t.events[e]=null;const i=n.getEventRunner();dl&&fl("event: "+n.toString()),Pl(i)}}}
2399/**
2400     * @license
2401     * Copyright 2017 Google LLC
2402     *
2403     * Licensed under the Apache License, Version 2.0 (the "License");
2404     * you may not use this file except in compliance with the License.
2405     * You may obtain a copy of the License at
2406     *
2407     *   http://www.apache.org/licenses/LICENSE-2.0
2408     *
2409     * Unless required by applicable law or agreed to in writing, software
2410     * distributed under the License is distributed on an "AS IS" BASIS,
2411     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2412     * See the License for the specific language governing permissions and
2413     * limitations under the License.
2414     */class Vh{constructor(t,e,n,i){this.repoInfo_=t,this.forceRestClient_=e,this.authTokenProvider_=n,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Wh,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=ic(),this.transactionQueueTree_=new Eh,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function Bh(t,e,n){if(t.stats_=zl(t.repoInfo_),t.forceRestClient_||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)t.server_=new ec(t.repoInfo_,((e,n,i,s)=>{Yh(t,e,n,i,s)}),t.authTokenProvider_,t.appCheckProvider_),setTimeout((()=>Jh(t,!0)),0);else{if(null!=n){if("object"!=typeof n)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Es(n)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}t.persistentConnection_=new ku(t.repoInfo_,e,((e,n,i,s)=>{Yh(t,e,n,i,s)}),(e=>{Jh(t,e)}),(e=>{!function(t,e){El(e,((e,n)=>{Qh(t,e,n)}))}(t,e)}),t.authTokenProvider_,t.appCheckProvider_,n),t.server_=t.persistentConnection_}t.authTokenProvider_.addTokenChangeListener((e=>{t.server_.refreshAuthToken(e)})),t.appCheckProvider_.addTokenChangeListener((e=>{t.server_.refreshAppCheckToken(e.token)})),t.statsReporter_=function(t,e){const n=t.toString();return Hl[n]||(Hl[n]=e()),Hl[n]}(t.repoInfo_,(()=>new ac(t.stats_,t.server_))),t.infoData_=new nc,t.infoSyncTree_=new uh({startListening:(e,n,i,s)=>{let r=[];const o=t.infoData_.getNode(e._path);return o.isEmpty()||(r=dh(t.infoSyncTree_,e._path,o),setTimeout((()=>{s("ok")}),0)),r},stopListening:()=>{}}),Qh(t,"connected",!1),t.serverSyncTree_=new uh({startListening:(e,n,i,s)=>(t.server_.listen(e,i,n,((n,i)=>{const r=s(n,i);Hh(t.eventQueue_,e._path,r)})),[]),stopListening:(e,n)=>{t.server_.unlisten(e,n)}})}function Kh(t){const e=t.infoData_.getNode(new nu(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+e}function Gh(t){return(e=(e={timestamp:Kh(t)})||{}).timestamp=e.timestamp||(new Date).getTime(),e;var e}function Yh(t,e,n,i,s){t.dataUpdateCount++;const r=new nu(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;let o=[];if(s)if(i){const e=Os(n,(t=>Gu(t)));o=function(t,e,n,i){const s=vh(t,i);if(s){const i=_h(s),r=i.path,o=i.queryId,a=du(r,e),l=wc.fromObject(n);return yh(t,r,new dc(uc(o),a,l))}return[]}(t.serverSyncTree_,r,e,s)}else{const e=Gu(n);o=function(t,e,n,i){const s=vh(t,i);if(null!=s){const i=_h(s),r=i.path,o=i.queryId,a=du(r,e);return yh(t,r,new hc(uc(o),a,n))}return[]}(t.serverSyncTree_,r,e,s)}else if(i){const e=Os(n,(t=>Gu(t)));o=function(t,e,n){const i=wc.fromObject(n);return fh(t,new dc({fromUser:!1,fromServer:!0,queryId:null,tagged:!1},e,i))}(t.serverSyncTree_,r,e)}else{const e=Gu(n);o=dh(t.serverSyncTree_,r,e)}let a=r;o.length>0&&(a=nd(t,r)),Hh(t.eventQueue_,a,o)}function Jh(t,e){Qh(t,"connected",e),!1===e&&function(t){Zh(t,"onDisconnectEvents");const e=Gh(t),n=ic();rc(t.onDisconnect_,iu(),((i,s)=>{const r=function(t,e,n,i){return Ih(e,new wh(n,t),i)}(i,s,t.serverSyncTree_,e);sc(n,i,r)}));let i=[];rc(n,iu(),((e,n)=>{i=i.concat(dh(t.serverSyncTree_,e,n));const s=function(t,e){const n=jh(id(t,e)),i=xh(t.transactionQueueTree_,e);return function(t,e,n){let i=n?t:t.parent;for(;null!==i;){if(e(i))return!0;i=i.parent}}(i,(e=>{ad(t,e)})),ad(t,i),Ah(i,(e=>{ad(t,e)})),n}(t,e);nd(t,s)})),t.onDisconnect_=ic(),Hh(t.eventQueue_,iu(),i)}(t)}function Qh(t,e,n){const i=new nu("/.info/"+e),s=Gu(n);t.infoData_.updateSnapshot(i,s);const r=dh(t.infoSyncTree_,i,s);Hh(t.eventQueue_,i,r)}function Xh(t){return t.nextWriteId_++}function Zh(t,...e){let n="";t.persistentConnection_&&(n=t.persistentConnection_.id+":"),fl(n,...e)}function td(t,e,n){return ph(t.serverSyncTree_,e,n)||Bu.EMPTY_NODE}function ed(t,e=t.transactionQueueTree_){if(e||od(t,e),Nh(e)){const n=sd(t,e);us(n.length>0,"Sending zero length transaction queue");n.every((t=>0===t.status))&&function(t,e,n){const i=n.map((t=>t.currentWriteId)),s=td(t,e,i);let r=s;const o=s.hash();for(let t=0;t<n.length;t++){const i=n[t];us(0===i.status,"tryToSendTransactionQueue_: items in queue should all be run."),i.status=1,i.retryCount++;const s=du(e,i.path);r=r.updateChild(s,i.currentOutputSnapshotRaw)}const a=r.val(!0),l=e;t.server_.put(l.toString(),a,(i=>{Zh(t,"transaction put response",{path:l.toString(),status:i});let s=[];if("ok"===i){const i=[];for(let e=0;e<n.length;e++)n[e].status=2,s=s.concat(hh(t.serverSyncTree_,n[e].currentWriteId)),n[e].onComplete&&i.push((()=>n[e].onComplete(null,!0,n[e].currentOutputSnapshotResolved))),n[e].unwatcher();od(t,xh(t.transactionQueueTree_,e)),ed(t,t.transactionQueueTree_),Hh(t.eventQueue_,e,s);for(let t=0;t<i.length;t++)Pl(i[t])}else{if("datastale"===i)for(let t=0;t<n.length;t++)3===n[t].status?n[t].status=4:n[t].status=0;else{_l("transaction at "+l.toString()+" failed: "+i);for(let t=0;t<n.length;t++)n[t].status=4,n[t].abortReason=i}nd(t,e)}}),o)}(t,jh(e),n)}else Ph(e)&&Oh(e,(e=>{ed(t,e)}))}function nd(t,e){const n=id(t,e),i=jh(n);return function(t,e,n){if(0===e.length)return;const i=[];let s=[];const r=e.filter((t=>0===t.status)).map((t=>t.currentWriteId));for(let a=0;a<e.length;a++){const l=e[a],u=du(n,l.path);let c,h=!1;if(us(null!==u,"rerunTransactionsUnderNode_: relativePath should not be null."),4===l.status)h=!0,c=l.abortReason,s=s.concat(hh(t.serverSyncTree_,l.currentWriteId,!0));else if(0===l.status)if(l.retryCount>=25)h=!0,c="maxretry",s=s.concat(hh(t.serverSyncTree_,l.currentWriteId,!0));else{const n=td(t,l.path,r);l.currentInputSnapshot=n;const i=e[a].update(n.val());if(void 0!==i){Uh("transaction failed: Data returned ",i,l.path);let e=Gu(i);"object"==typeof i&&null!=i&&Ns(i,".priority")||(e=e.updatePriority(n.getPriority()));const o=l.currentWriteId,a=Gh(t),u=Sh(e,n,a);l.currentOutputSnapshotRaw=e,l.currentOutputSnapshotResolved=u,l.currentWriteId=Xh(t),r.splice(r.indexOf(o),1),s=s.concat(ch(t.serverSyncTree_,l.path,u,l.currentWriteId,l.applyLocally)),s=s.concat(hh(t.serverSyncTree_,o,!0))}else h=!0,c="nodata",s=s.concat(hh(t.serverSyncTree_,l.currentWriteId,!0))}Hh(t.eventQueue_,n,s),s=[],h&&(e[a].status=2,o=e[a].unwatcher,setTimeout(o,Math.floor(0)),e[a].onComplete&&("nodata"===c?i.push((()=>e[a].onComplete(null,!1,e[a].currentInputSnapshot))):i.push((()=>e[a].onComplete(new Error(c),!1,null)))))}var o;od(t,t.transactionQueueTree_);for(let t=0;t<i.length;t++)Pl(i[t]);ed(t,t.transactionQueueTree_)}(t,sd(t,n),i),i}function id(t,e){let n,i=t.transactionQueueTree_;for(n=su(e);null!==n&&void 0===Nh(i);)i=xh(i,n),n=su(e=ou(e));return i}function sd(t,e){const n=[];return rd(t,e,n),n.sort(((t,e)=>t.order-e.order)),n}function rd(t,e,n){const i=Nh(e);if(i)for(let t=0;t<i.length;t++)n.push(i[t]);Oh(e,(e=>{rd(t,e,n)}))}function od(t,e){const n=Nh(e);if(n){let t=0;for(let e=0;e<n.length;e++)2!==n[e].status&&(n[t]=n[e],t++);n.length=t,Rh(e,n.length>0?n:void 0)}Oh(e,(e=>{od(t,e)}))}function ad(t,e){const n=Nh(e);if(n){const i=[];let s=[],r=-1;for(let e=0;e<n.length;e++)3===n[e].status||(1===n[e].status?(us(r===e-1,"All SENT items should be at beginning of queue."),r=e,n[e].status=3,n[e].abortReason="set"):(us(0===n[e].status,"Unexpected transaction status in abort"),n[e].unwatcher(),s=s.concat(hh(t.serverSyncTree_,n[e].currentWriteId,!0)),n[e].onComplete&&i.push(n[e].onComplete.bind(null,new Error("set"),!1,null))));-1===r?Rh(e,void 0):n.length=r+1,Hh(t.eventQueue_,jh(e),s);for(let t=0;t<i.length;t++)Pl(i[t])}}
2415/**
2416     * @license
2417     * Copyright 2017 Google LLC
2418     *
2419     * Licensed under the Apache License, Version 2.0 (the "License");
2420     * you may not use this file except in compliance with the License.
2421     * You may obtain a copy of the License at
2422     *
2423     *   http://www.apache.org/licenses/LICENSE-2.0
2424     *
2425     * Unless required by applicable law or agreed to in writing, software
2426     * distributed under the License is distributed on an "AS IS" BASIS,
2427     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2428     * See the License for the specific language governing permissions and
2429     * limitations under the License.
2430     */const ld=function(t,e){const n=ud(t),i=n.namespace;"firebase.com"===n.domain&&vl(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),i&&"undefined"!==i||"localhost"===n.domain||vl("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&_l("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");const s="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new Fl(n.host,n.secure,i,e,s,"",i!==n.subdomain),path:new nu(n.pathString)}},ud=function(t){let e="",n="",i="",s="",r="",o=!0,a="https",l=443;if("string"==typeof t){let u=t.indexOf("//");u>=0&&(a=t.substring(0,u-1),t=t.substring(u+2));let c=t.indexOf("/");-1===c&&(c=t.length);let h=t.indexOf("?");-1===h&&(h=t.length),e=t.substring(0,Math.min(c,h)),c<h&&(s=function(t){let e="";const n=t.split("/");for(let t=0;t<n.length;t++)if(n[t].length>0){let i=n[t];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(c,h)));const d=function(t){const e={};"?"===t.charAt(0)&&(t=t.substring(1));for(const n of t.split("&")){if(0===n.length)continue;const i=n.split("=");2===i.length?e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):_l(`Invalid query segment '${n}' in query '${t}'`)}return e}(t.substring(Math.min(t.length,h)));u=e.indexOf(":"),u>=0?(o="https"===a||"wss"===a,l=parseInt(e.substring(u+1),10)):u=e.length;const p=e.slice(0,u);if("localhost"===p.toLowerCase())n="localhost";else if(p.split(".").length<=2)n=p;else{const t=e.indexOf(".");i=e.substring(0,t).toLowerCase(),n=e.substring(t+1),r=i}"ns"in d&&(r=d.ns)}return{host:e,port:l,domain:n,subdomain:i,secure:o,scheme:a,pathString:s,namespace:r}};
2431/**
2432     * @license
2433     * Copyright 2020 Google LLC
2434     *
2435     * Licensed under the Apache License, Version 2.0 (the "License");
2436     * you may not use this file except in compliance with the License.
2437     * You may obtain a copy of the License at
2438     *
2439     *   http://www.apache.org/licenses/LICENSE-2.0
2440     *
2441     * Unless required by applicable law or agreed to in writing, softw
2441are
2442     * distributed under the License is distributed on an "AS IS" BASIS,
2443     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2444     * See the License for the specific language governing permissions and
2445     * limitations under the License.
2446     */
2447class cd{constructor(t,e,n,i){this._repo=t,this._path=e,this._queryParams=n,this._orderByCalled=i}get key(){return hu(this._path)?null:au(this._path)}get ref(){return new hd(this._repo,this._path)}get _queryIdentifier(){const t=tc(this._queryParams),e=Sl(t);return"{}"===e?"default":e}get _queryObject(){return tc(this._queryParams)}isEqual(t){if(!((t=qs(t))instanceof cd))return!1;const e=this._repo===t._repo,n=pu(this._path,t._path),i=this._queryIdentifier===t._queryIdentifier;return e&&n&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(t){let e="";for(let n=t.pieceNum_;n<t.pieces_.length;n++)""!==t.pieces_[n]&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}(this._path)}}class hd extends cd{constructor(t,e){super(t,e,new Xu,!1)}get parent(){const t=uu(this._path);return null===t?null:new hd(this._repo,t)}get root(){let t=this;for(;null!==t.parent;)t=t.parent;return t}}!function(t){us(!rh,"__referenceConstructor has already been defined"),rh=t}(hd),function(t){us(!oh,"__referenceConstructor has already been defined"),oh=t}(hd);
2448/**
2449     * @license
2450     * Copyright 2020 Google LLC
2451     *
2452     * Licensed under the Apache License, Version 2.0 (the "License");
2453     * you may not use this file except in compliance with the License.
2454     * You may obtain a copy of the License at
2455     *
2456     *   http://www.apache.org/licenses/LICENSE-2.0
2457     *
2458     * Unless required by applicable law or agreed to in writing, software
2459     * distributed under the License is distributed on an "AS IS" BASIS,
2460     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2461     * See the License for the specific language governing permissions and
2462     * limitations under the License.
2463     */
2464const dd={};function pd(t,e,n,i,s){let r=i||t.options.databaseURL;void 0===r&&(t.options.projectId||vl("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),fl("Using default host for project ",t.options.projectId),r=`${t.options.projectId}-default-rtdb.firebaseio.com`);let o,a,l=ld(r,s),u=l.repoInfo;"undefined"!=typeof process&&(a=process.env.FIREBASE_DATABASE_EMULATOR_HOST),a?(o=!0,r=`http://${a}?ns=${u.namespace}`,l=ld(r,s),u=l.repoInfo):o=!l.repoInfo.secure;const c=s&&o?new $l($l.OWNER):new jl(t.name,t.options,e);!function(t,e){const n=e.path.toString();if("string"!=typeof e.repoInfo.host||0===e.repoInfo.host.length||!Fh(e.repoInfo.namespace)&&"localhost"!==e.repoInfo.host.split(":")[0]||0!==n.length&&!qh(n))throw new Error(function(t,e){return`${t} failed: ${"url"} argument `}(t)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')}("Invalid Firebase Database URL",l),hu(l.path)||vl("Database URL must point to the root of a Firebase Database (not including a child path).");const h=function(t,e,n,i){let s=dd[e.name];s||(s={},dd[e.name]=s);let r=s[t.toURLString()];r&&vl("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.");return r=new Vh(t,false,n,i),s[t.toURLString()]=r,r}(u,t,c,new Al(t.name,n));return new fd(h,t)}class fd{constructor(t,e){this._repoInternal=t,this.app=e,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(Bh(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new hd(this._repo,iu())),this._rootInternal}_delete(){return null!==this._rootInternal&&(!function(t,e){const n=dd[e];n&&n[t.key]===t||vl(`Database ${e}(${t.repoInfo_}) has already been deleted.`),function(t){t.persistentConnection_&&t.persistentConnection_.interrupt("repo_interrupt")}(t),delete n[t.key]}(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){null===this._rootInternal&&vl("Cannot call "+t+" on a deleted database.")}}ku.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},ku.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)},
2465/**
2466     * @license
2467     * Copyright 2021 Google LLC
2468     *
2469     * Licensed under the Apache License, Version 2.0 (the "License");
2470     * you may not use this file except in compliance with the License.
2471     * You may obtain a copy of the License at
2472     *
2473     *   http://www.apache.org/licenses/LICENSE-2.0
2474     *
2475     * Unless required by applicable law or agreed to in writing, software
2476     * distributed under the License is distributed on an "AS IS" BASIS,
2477     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2478     * See the License for the specific language governing permissions and
2479     * limitations under the License.
2480     */
2481function(t){!function(t){nl=t}(mr),hr(new Bs("database",((t,{instanceIdentifier:e})=>pd(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"),t.getProvider("app-check-internal"),e)),"PUBLIC").setMultipleInstances(!0)),vr(tl,el,t),vr(tl,el,"esm2017")}();const md=function(t,e={}){if("object"!=typeof e){e={name:e}}const n=Object.assign({name:or,automaticDataCollectionEnabled:!1},e),i=n.name;if("string"!=typeof i||!i)throw pr.create("bad-app-name",{appName:String(i)});const s=lr.get(i);if(s){if(As(t,s.options)&&As(n,s.config))return s;throw pr.create("duplicate-app",{appName:i})}const r=new Ys(i);for(const t of ur.values())r.addComponent(t);const o=new fr(t,n,r);return lr.set(i,o),o}({apiKey:"AIzaSyDC9qKnCd8tDr_hvID4PFqB9dmqUoJ_GwA",authDomain:"aistiesteettomyys.firebaseapp.com",databaseURL:"https://aistiesteettomyys-default-rtdb.europe-west1.firebasedatabase.app",projectId:"aistiesteettomyys",storageBucket:"aistiesteettomyys.appspot.com",messagingSenderId:"396290473228",appId:"1:396290473228:web:030b88013bac25691a1d29"}),gd=
2482/**
2483     * @license
2484     * Copyright 2021 Google LLC
2485     *
2486     * Licensed under the Apache License, Version 2.0 (the "License");
2487     * you may not use this file except in compliance with the License.
2488     * You may obtain a copy of the License at
2489     *
2490     *   http://www.apache.org/licenses/LICENSE-2.0
2491     *
2492     * Unless required by applicable law or agreed to in writing, software
2493     * distributed under the License is distributed on an "AS IS" BASIS,
2494     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2495     * See the License for the specific language governing permissions and
2496     * limitations under the License.
2497     */
2498function(t=gr()){const e=dr(t,"auth");return e.isInitialized()?e.getImmediate():function(t,e){const n=dr(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(As(n.getOptions(),null!=e?e:{}))return t;jr(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Ya,persistence:[pa,Jo,Xo]})}(md);!function(t=gr(),e){dr(t,"database").getImmediate({identifier:e})}(md);var vd=/^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;function _d(t){let e,n,i,s,r,o,a;return{c(){e=I("div"),n=I("div"),i=E("svg"),s=E("path"),r=N(),o=I("span"),a=x(t[0]),O(s,"stroke-linecap","round"),O(s,"stroke-linejoin","round"),O(s,"stroke-width","2"),O(s,"d","M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"),O(i,"xmlns","http://www.w3.org/2000/svg"),O(i,"class","stroke-current flex-shrink-0 h-6 w-6"),O(i,"fill","none"),O(i,"viewBox","0 0 24 24"),O(e,"class","alert alert-success shadow-lg fixed-alert svelte-1iv36q0")},m(t,l){T(t,e,l),k(e,n),k(n,i),k(i,s),k(n,r),k(n,o),k(o,a)},p(t,e){1&e&&A(a,t[0])},d(t){t&&C(e)}}}function yd(e){let n,i=e[1]&&_d(e);return{c(){i&&i.c(),n=R()},m(t,e){i&&i.m(t,e),T(t,n,e)},p(t,[e]){t[1]?i?i.p(t,e):(i=_d(t),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},i:t,o:t,d(t){i&&i.d(t),t&&C(n)}}}function kd(t,e,n){let{message:i=""}=e,{open:s=!1}=e;return t.$$set=t=>{"message"in t&&n(0,i=t.message),"open"in t&&n(1,s=t.open)},[i,s]}class wd extends Rt{constructor(t){super(),Nt(this,t,kd,yd,a,{message:0,open:1})}}function bd(t){let e,n;return{c(){e=I("p"),n=x(t[7]),O(e,"class","error svelte-vxaesr")},m(t,i){T(t,e,i),k(e,n)},p(t,e){128&e&&A(n,t[7])},d(t){t&&C(e)}}}function Td(t){let e,n;return{c(){e=I("p"),n=x(t[6]),O(e,"class","error svelte-vxaesr")},m(t,i){T(t,e,i),k(e,n)},p(t,e){64&e&&A(n,t[6])},d(t){t&&C(e)}}}function Cd(t){let e,n;return{c(){e=I("p"),n=x(t[8]),O(e,"class","error svelte-vxaesr")},m(t,i){T(t,e,i),k(e,n)},p(t,e){256&e&&A(n,t[8])},d(t){t&&C(e)}}}function Sd(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,R,A,$,D,M,L,F,q,U,W,H,z=t[7]&&bd(t),V=t[6]&&Td(t),B=t[8]&&Cd(t);return q=new wd({props:{open:t[10],message:"Käyttätunnuksen luominen onnistui!"}}),{c(){e=I("div"),n=I("div"),i=I("h1"),i.textContent="Luo käyttäjä",s=N(),o=I("div"),a=I("label"),a.textContent="Sähköpostiosoite",l=N(),u=I("input"),c=N(),z&&z.c(),h=N(),d=I("label"),d.textContent="Salasana",p=N(),f=I("input"),m=N(),g=I("p"),g.textContent="Salasanan tulee olla vähintään 8 merkkiä pitkä",v=N(),_=I("label"),_.textContent="Salasana uudelleen",y=N(),w=I("input"),b=N(),V&&V.c(),S=N(),B&&B.c(),E=N(),R=I("br"),A=N(),$=I("button"),D=x("Luo käyttäjä"),F=N(),It(q.$$.fragment),O(a,"class","label"),O(a,"for","email"),O(u,"type","text"),O(u,"id","email"),O(u,"placeholder","[email protected]"),O(u,"class","input input-bordered input-primary w-full max-w-xs inp svelte-vxaesr"),O(d,"class","label"),O(d,"for","password"),O(f,"type","password"),O(f,"id","password"),O(f,"placeholder","**********"),O(f,"class","input input-bordered input-primary w-full max-w-xs"),O(g,"class","hint svelte-vxaesr"),O(_,"class","label"),O(_,"for","passwordAgain"),O(w,"type","password"),O(w,"id","passwordAgain"),O(w,"placeholder","**********"),O(w,"class","input input-bordered input-primary w-full max-w-xs"),O($,"class",M="btn btn-primary margin-y "+(t[9]?"loading":"")+" svelte-vxaesr"),$.disabled=L=t[7]||t[6],O(o,"class","form-container svelte-vxaesr"),O(n,"class","content-container"),O(e,"class","container")},m(r,C){T(r,e,C),k(e,n),k(n,i),k(n,s),k(n,o),k(o,a),k(o,l),k(o,u),t[16](u),j(u,t[0]),k(o,c),z&&z.m(o,null),k(o,h),k(o,d),k(o,p),k(o,f),t[18](f),j(f,t[1]),k(o,m),k(o,g),k(o,v),k(o,_),k(o,y),k(o,w),t[20](w),j(w,t[2]),k(o,b),V&&V.m(o,null),k(o,S),B&&B.m(o,null),k(o,E),k(o,R),k(o,A),k(o,$),k($,D),T(r,F,C),Et(q,r,C),U=!0,W||(H=[P(u,"input",t[17]),P(u,"blur",t[11]),P(u,"focus",t[13]),P(f,"input",t[19]),P(f,"focus",t[14]),P(w,"input",t[21]),P(w,"blur",t[12]),P($,"click",t[15])],W=!0)},p(t,[e]){1&e&&u.value!==t[0]&&j(u,t[0]),t[7]?z?z.p(t,e):(z=bd(t),z.c(),z.m(o,h)):z&&(z.d(1),z=null),2&e&&f.value!==t[1]&&j(f,t[1]),4&e&&w.value!==t[2]&&j(w,t[2]),t[6]?V?V.p(t,e):(V=Td(t),V.c(),V.m(o,S)):V&&(V.d(1),V=null),t[8]?B?B.p(t,e):(B=Cd(t),B.c(),B.m(
2498o,E)):B&&(B.d(1),B=null),(!U||512&e&&M!==(M="btn btn-primary margin-y "+(t[9]?"loading":"")+" svelte-vxaesr"))&&O($,"class",M),(!U||192&e&&L!==(L=t[7]||t[6]))&&($.disabled=L);const n={};1024&e&&(n.open=t[10]),q.$set(n)},i(t){U||(vt(q.$$.fragment,t),U=!0)},o(t){_t(q.$$.fragment,t),U=!1},d(n){n&&C(e),t[16](null),z&&z.d(),t[18](null),t[20](null),V&&V.d(),B&&B.d(),n&&C(F),xt(q,n),W=!1,r(H)}}}function Id(t,e,n){let i,s,r,o="",a="",l="",u="",c="",h="",d=!1,p=!1;function f(t){n(7,c=t),i.classList.add("input-error")}function m(){n(7,c=""),i.classList.remove("input-error")}function g(t){s.classList.add("input-error"),r.classList.add("input-error"),n(6,u=t)}function v(){n(6,u=""),s.classList.remove("input-error"),r.classList.remove("input-error")}return[o,a,l,i,s,r,u,c,h,d,p,function(){if(o.length<1)return void f("Sähköposti on pakollinen");const t=function(t){if(!t)return!1;if(t.length>254)return!1;if(!vd.test(t))return!1;var e=t.split("@");return!(e[0].length>64||e[1].split(".").some((function(t){return t.length>63})))}(o);t?(m(),i.classList.add("input-success")):f("Sähköpostin muoto on väärä")},function(){a.length<8?g("Salanan tulee olla vähintään 8 merkkiä pitkä"):a!==l?g("Salasanat eivät täsmää"):(v(),s.classList.add("input-success"),r.classList.add("input-success"))},m,v,async function(){n(9,d=!0);const{error:t}=await async function(t,e){const n=function(t,e){const n={error:"",user:null};return t.length<5?(n.error="Sähköpostiosoite puuttuu tai se on liian lyhty",n):e.length<5?(n.error="Salasana puuttuu tai se on liian lyhyt",n):n}(t,e);if(n.error)return n;try{const i=await Bo(gd,t,e);n.user=i.user}catch(t){n.error=t.message}finally{return n}}(o,a);t?n(8,h=t):n(10,p=!0),n(9,d=!1),setTimeout((()=>{n(10,p=!1),ke("add-user-info")}),1500)},function(t){Q[t?"unshift":"push"]((()=>{i=t,n(3,i)}))},function(){o=this.value,n(0,o)},function(t){Q[t?"unshift":"push"]((()=>{s=t,n(4,s)}))},function(){a=this.value,n(1,a)},function(t){Q[t?"unshift":"push"]((()=>{r=t,n(5,r)}))},function(){l=this.value,n(2,l)}]}class Ed extends Rt{constructor(t){super(),Nt(this,t,Id,Sd,a,{})}}function xd(t){let e,n,i,s,r,o,a;return{c(){e=I("div"),n=I("img"),s=N(),r=I("button"),r.innerHTML='Poista kuva\n                        <span class="material-icons delete svelte-3lieu3">delete</span>',O(n,"alt","preview"),u(n.src,i=t[4])||O(n,"src",i),O(n,"class","preview-image svelte-3lieu3"),O(r,"class","btn btn-ghost svelte-3lieu3"),O(e,"class","preview-container svelte-3lieu3")},m(i,l){T(i,e,l),k(e,n),k(e,s),k(e,r),o||(a=P(r,"click",t[9]),o=!0)},p(t,e){16&e&&!u(n.src,i=t[4])&&O(n,"src",i)},d(t){t&&C(e),o=!1,a()}}}function Nd(e){let n;return{c(){n=x("Ei valittua kuvaa")},m(t,e){T(t,n,e)},p:t,d(t){t&&C(n)}}}function Rd(t){let e,n=t[0][0].name+"";return{c(){e=x(n)},m(t,n){T(t,e,n)},p(t,i){1&i&&n!==(n=t[0][0].name+"")&&A(e,n)},d(t){t&&C(e)}}}function Pd(e){let n,i,s,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E,x,R,A,D,M,L=e[4]&&xd(e);function F(t,e){return t[0]?Rd:Nd}let q=F(e),U=q(e);return{c(){n=I("div"),i=I("div"),s=I("h1"),s.textContent="Lisää käyttäjätiedot",o=N(),a=I("div"),l=I("label"),l.textContent="Käyttäjänimi (näytetään käyttäjille)",u=N(),c=I("input"),h=N(),d=I("label"),d.textContent="Sähköpostiosoite",p=N(),f=I("input"),m=N(),g=I("label"),g.textContent="Puhelinnumero",v=N(),_=I("input"),y=N(),w=I("input"),b=N(),L&&L.c(),S=N(),E=I("div"),x=I("p"),U.c(),R=N(),A=I("button"),A.textContent="Valitse profiilikuva",O(l,"class","label"),O(l,"for","username"),O(c,"type","text"),O(c,"id","username"),O(c,"placeholder","esim. Yritys Oy"),O(c,"class","input input-bordered input-primary w-full max-w-xs inp"),O(d,"class","label"),O(d,"for","email"),O(f,"type","text"),O(f,"id","email"),O(f,"placeholder","[email protected]"),O(f,"class","input input-bordered input-primary w-full max-w-xs inp"),O(g,"class","label"),O(g,"for","tel"),O(_,"type","text"),O(_,"inputmode","tel"),O(_,"id","tel"),O(_,"placeholder","+358 50 123 123 23"),O(_,"class","input input-bordered input-primary w-full max-w-xs inp"),O(w,"type","file"),O(w,"id","fileInput"),O(w,"accept","image/*"),$(w,"display","none"),O(x,"class","svelte-3lieu3"),O(A,"class","btn btn-primary"),O(E,"class","file-input svelte-3lieu3"),O(a,"class","form-container svelte-3lieu3"),O(i,"class","content-container"),O(n,"class","container")}
2498,m(t,r){T(t,n,r),k(n,i),k(i,s),k(i,o),k(i,a),k(a,l),k(a,u),k(a,c),j(c,e[1]),k(a,h),k(a,d),k(a,p),k(a,f),j(f,e[2]),k(a,m),k(a,g),k(a,v),k(a,_),j(_,e[3]),k(a,y),k(a,w),k(a,b),L&&L.m(a,null),k(a,S),k(a,E),k(E,x),U.m(x,null),k(E,R),k(E,A),D||(M=[P(c,"input",e[5]),P(f,"input",e[6]),P(_,"input",e[7]),P(w,"change",e[8]),P(A,"click",Od)],D=!0)},p(t,[e]){2&e&&c.value!==t[1]&&j(c,t[1]),4&e&&f.value!==t[2]&&j(f,t[2]),8&e&&_.value!==t[3]&&j(_,t[3]),t[4]?L?L.p(t,e):(L=xd(t),L.c(),L.m(a,S)):L&&(L.d(1),L=null),q===(q=F(t))&&U?U.p(t,e):(U.d(1),U=q(t),U&&(U.c(),U.m(x,null)))},i:t,o:t,d(t){t&&C(n),L&&L.d(),U.d(),D=!1,r(M)}}}function Od(){document.getElementById("fileInput").click()}function Ad(t,e,n){let i,s,r="",o="",a="";return t.$$.update=()=>{1&t.$$.dirty&&(i?function(){const t=new FileReader;t.onload=function(){n(4,s=t.result)},t.readAsDataURL(i[0])}():n(4,s=null))},[i,r,o,a,s,function(){r=this.value,n(1,r)},function(){o=this.value,n(2,o)},function(){a=this.value,n(3,a)},function(){i=this.files,n(0,i)},()=>n(0,i=null)]}class jd extends Rt{constructor(t){super(),Nt(this,t,Ad,Pd,a,{})}}function $d(t){let e,n,i,s,o,a,l,u,c,h,d,p,f,m,g;return p=new Re({props:{show:t[0]}}),p.$on("click",t[4]),{c(){e=I("div"),n=I("label"),n.innerHTML='<b><span class="label-text settings-label">Valitse kieli / Select language</span></b>',i=N(),s=I("select"),o=I("option"),o.textContent="suomi",a=I("option"),a.textContent="english",l=N(),u=I("button"),u.textContent="Valitse / Select",d=N(),It(p.$$.fragment),O(n,"class","label"),O(n,"for","lang"),o.__value="fi",o.value=o.__value,a.__value="en",a.value=a.__value,O(s,"id","lang"),O(s,"class","select select-bordered w-full max-w-xs svelte-fkl5ze"),$(s,"margin-bottom","1.5rem"),void 0===t[1]&&st((()=>t[2].call(s))),O(u,"class","btn btn-primary"),O(e,"class","svelte-modal svelte-fkl5ze")},m(r,c){T(r,e,c),k(e,n),k(e,i),k(e,s),k(s,o),k(s,a),D(s,t[1]),k(e,l),k(e,u),T(r,d,c),Et(p,r,c),f=!0,m||(g=[P(s,"change",t[2]),P(u,"click",t[3])],m=!0)},p(t,e){2&e&&D(s,t[1]);const n={};1&e&&(n.show=t[0]),p.$set(n)},i(t){f||(st((()=>{h&&h.end(1),c=kt(e,de,{duration:200,y:200}),c.start()})),vt(p.$$.fragment,t),f=!0)},o(t){c&&c.invalidate(),h=wt(e,he,{duration:200}),_t(p.$$.fragment,t),f=!1},d(t){t&&C(e),t&&h&&h.end(),t&&C(d),xt(p,t),m=!1,r(g)}}}function Dd(t){let e,n,i=t[0]&&$d(t);return{c(){i&&i.c(),e=R()},m(t,s){i&&i.m(t,s),T(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&vt(i,1)):(i=$d(t),i.c(),vt(i,1),i.m(e.parentNode,e)):i&&(mt(),_t(i,1,1,(()=>{i=null})),gt())},i(t){n||(vt(i),n=!0)},o(t){_t(i),n=!1},d(t){i&&i.d(t),t&&C(e)}}}function Md(t,e,n){let i;d(t,ae,(t=>n(1,i=t)));let{show:s}=e;return t.$$set=t=>{"show"in t&&n(0,s=t.show)},[s,i,function(){i=M(this),ae.set(i)},()=>n(0,s=!1),()=>n(0,s=!1)]}class Ld extends Rt{constructor(t){super(),Nt(this,t,Md,Dd,a,{show:0})}}function Fd(t){let e,n,i,s,r,o,a,l,u,c,h,d,p,f,m,g,v,_,y,w,b,S,E=t[3].toUpperCase()+"";function R(e){t[6](e)}function j(e){t[7](e)}document.title=e="\n\t\t"+("fi"==t[3]?"Aistiesteettömyyssovellus":"Sensory accessibility app")+"\n\t",p=new be({props:{routes:t[4]}});let $={};return void 0!==t[1]&&($.open=t[1]),void 0!==t[2]&&($.icon=t[2]),m=new Ie({props:$}),Q.push((()=>St(m,"open",R))),Q.push((()=>St(m,"icon",j))),y=new Ld({props:{show:t[0]}}),{c(){n=N(),i=I("nav"),s=I("a"),s.innerHTML='<i class="material-icons svelte-1nzlvhc">home</i>',r=N(),o=I("a"),a=x(E),l=N(),u=I("i"),c=x(t[2]),h=N(),d=I("main"),It(p.$$.fragment),f=N(),It(m.$$.fragment),_=N(),It(y.$$.fragment),O(s,"href","/#/"),O(s,"class","svelte-1nzlvhc"),O(u,"class","material-icons svelte-1nzlvhc"),O(o,"href","javascript:void(0)"),O(o,"class","right svelte-1nzlvhc"),O(i,"class","nav svelte-1nzlvhc"),O(d,"class","svelte-1nzlvhc")},m(e,g){T(e,n,g),T(e,i,g),k(i,s),k(i,r),k(i,o),k(o,a),k(o,l),k(o,u),k(u,c),T(e,h,g),T(e,d,g),Et(p,d,null),T(e,f,g),Et(m,e,g),T(e,_,g),Et(y,e,g),w=!0,b||(S=P(o,"click",t[5]),b=!0)},p(t,[n]){(!w||8&n)&&e!==(e="\n\t\t"+("fi"==t[3]?"Aistiesteettömyyssovellus":"Sensory accessibility app")+"\n\t")&&(document.title=e),(!w||8&n)&&E!==(E=t[3].toUpperCase()+"")&&A(a,E),(!w||4&n)&&A(c,t[2]);const i={};!g&&2&n&&(g=!0,i.open=t[1],rt((()=>g=!1))),!v&&4&n&&(v=!0,i.icon=t[2],rt((()=>v=!1))),m.$set(i);const s={};1&n&&(s.show=t[0]),y.$set(s)},i(t){w||(vt(p.$$.fragment,t),vt(m.$$.fragment,t),vt(y.$$.fragment,t),w=!0)},o(t){_t(p.$$.fragment,t),_t(m.$$.fragment,t),_t(y.$$.fragment,t),w=!1},d(t){t&&C(n),t&&C(i),t&&C(h),t&&C(d),xt(p),t&&C(f),xt(m,t),t&&C(_),xt(y,t),b=!1,S()}}}function qd(t,e,n){let i;d(t,ae,(t=>n(3,i=t)));const s={"/":Rn,"/form/:group?/:page?":kn,"/info/:group?":Ln,"/answers/:group":Kn,"/results-info":Xn,"/results-page":os,"/create-user":Ed,"/add-user-info":jd},r=function(){const t=new URLSearchParams(window.location.search),e=Object.fromEntries(t.entries());return!e.lang||"en"!==e.lang&&"fi"!==e.lang?null:e.lang}();let o=!1,a=!1,l="language";null!==r?(p(ae,i=r,i),localStorage.setItem("firstVisit",""+(new Date).getTime())):o=!localStorage.getItem("firstVisit")&&(localStorage.setItem("firstVisit",""+(new Date).getTime()),!0);return[o,a,l,i,s,()=>n(1,a=!a),function(t){a=t,n(1,a)},function(t){l=t,n(2,l)}]}return new class extends Rt{constructor(t){super(),Nt(this,t,qd,Fd,a,{})}}({target:document.body})}();
2499//# sourceMappingURL=bundle.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.