whipdesk 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.cjs +8220 -6587
- package/dist/mobile-web/assets/index-C1gDHBib.css +1 -0
- package/dist/mobile-web/assets/index-YSgNjLfG.js +2 -0
- package/dist/mobile-web/assets/index.esm-B3ZTr43m.js +1 -0
- package/dist/mobile-web/assets/index.esm-BgjPHsdM.js +1 -0
- package/dist/mobile-web/assets/index.esm-CmSagqpw.js +1 -0
- package/dist/mobile-web/assets/index.esm-Di8jSGaG.js +4 -0
- package/dist/mobile-web/assets/index.esm-mXKu2C3o.js +1 -0
- package/dist/mobile-web/assets/index.esm-wogdVWd2.js +30 -0
- package/dist/mobile-web/index.html +2 -2
- package/package.json +9 -9
- package/dist/mobile-web/assets/index-7VFGQkgi.css +0 -1
- package/dist/mobile-web/assets/index-ChOsBFZF.js +0 -2
- package/dist/mobile-web/assets/index.esm-B3nnhxdY.js +0 -1144
- package/dist/mobile-web/assets/index.esm-C6Dwpirr.js +0 -16
- package/dist/mobile-web/assets/index.esm-DOt1fDqh.js +0 -1636
- package/dist/mobile-web/assets/index.esm-DYB-Ijb5.js +0 -2287
- package/dist/mobile-web/assets/index.esm-ES8aBvqn.js +0 -599
- package/dist/mobile-web/assets/index.esm2017-B0pGzpCg.js +0 -481
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{A as e,B as t,L as n,N as r,U as i,Z as a,_ as o,c as s,g as c,n as l,o as u,p as d,s as f,tt as p,u as ee,v as te,x as m,z as ne}from"./index.esm-B3ZTr43m.js";var re=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},ie={},ae;(function(){var e;function t(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.C=Array(this.blockSize),this.o=this.h=0,this.u()}t(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(e,t,n){n||=0;let r=Array(16);if(typeof t==`string`)for(var i=0;i<16;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;i<16;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];let a=e.g[3],o;o=t+(a^n&(i^a))+r[0]+3614090360&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[1]+3905402710&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[2]+606105819&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[4]+4118548399&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[5]+1200080426&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[6]+2821735955&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[8]+1770035416&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[9]+2336552879&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[10]+4294925233&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[12]+1804603682&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[13]+4254626195&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[14]+2792965006&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(i^a&(n^i))+r[1]+4129170786&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[6]+3225465664&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[11]+643717713&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[5]+3593408605&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[10]+38016083&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[15]+3634488961&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[9]+568446438&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[14]+3275163606&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[3]+4107603335&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[13]+2850285829&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[2]+4243563512&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[7]+1735328473&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(n^i^a)+r[5]+4294588738&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[8]+2272392833&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[11]+1839030562&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[1]+2763975236&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[4]+1272893353&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[7]+4139469664&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[13]+681279174&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[0]+3936430074&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[3]+3572445317&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[9]+3654602809&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[12]+3873151461&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[15]+530742520&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(i^(n|~a))+r[0]+4096336452&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[7]+1126891415&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[14]+2878612391&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[12]+1700485571&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[3]+2399980690&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[10]+4293915773&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[8]+1873313359&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[15]+4264355552&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[6]+2734768916&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[4]+4149444226&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[11]+3174756917&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[2]+718787259&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}r.prototype.v=function(e,t){t===void 0&&(t=e.length);let n=t-this.blockSize,r=this.C,a=this.h,o=0;for(;o<t;){if(a==0)for(;o<=n;)i(this,e,o),o+=this.blockSize;if(typeof e==`string`){for(;o<t;)if(r[a++]=e.charCodeAt(o++),a==this.blockSize){i(this,r),a=0;break}}else for(;o<t;)if(r[a++]=e[o++],a==this.blockSize){i(this,r),a=0;break}}this.h=a,this.o+=t},r.prototype.A=function(){var e=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=this.o*8;for(var n=e.length-8;n<e.length;++n)e[n]=t&255,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};function a(e,t){var n=s;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}function o(e,t){this.h=t;let n=[],r=!0;for(let i=e.length-1;i>=0;i--){let a=e[i]|0;r&&a==t||(n[i]=a,r=!1)}this.g=n}var s={};function c(e){return-128<=e&&e<128?a(e,function(e){return new o([e|0],e<0?-1:0)}):new o([e|0],e<0?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return d;if(e<0)return m(l(-e));let t=[],n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new o(t,0)}function u(e,t){if(e.length==0)throw Error(`number format error: empty string`);if(t||=10,t<2||36<t)throw Error(`radix out of range: `+t);if(e.charAt(0)==`-`)return m(u(e.substring(1),t));if(e.indexOf(`-`)>=0)throw Error(`number format error: interior "-" character`);let n=l(t**8),r=d;for(let a=0;a<e.length;a+=8){var i=Math.min(8,e.length-a);let o=parseInt(e.substring(a,a+i),t);i<8?(i=l(t**+i),r=r.j(i).add(l(o))):(r=r.j(n),r=r.add(l(o)))}return r}var d=c(0),f=c(1),p=c(16777216);e=o.prototype,e.m=function(){if(te(this))return-m(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){let r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(e||=10,e<2||36<e)throw Error(`radix out of range: `+e);if(ee(this))return`0`;if(te(this))return`-`+m(this).toString(e);let t=l(e**6);var n=this;let r=``;for(;;){let i=se(n,t).g;n=ne(n,i.j(t));let a=((n.g.length>0?n.g[0]:n.h)>>>0).toString(e);if(n=i,ee(n))return a+r;for(;a.length<6;)a=`0`+a;r=a+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h};function ee(e){if(e.h!=0)return!1;for(let t=0;t<e.g.length;t++)if(e.g[t]!=0)return!1;return!0}function te(e){return e.h==-1}e.l=function(e){return e=ne(this,e),te(e)?-1:+!ee(e)};function m(e){let t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new o(n,~e.h).add(f)}e.abs=function(){return te(this)?m(this):this},e.add=function(e){let t=Math.max(this.g.length,e.g.length),n=[],r=0;for(let i=0;i<=t;i++){let t=r+(this.i(i)&65535)+(e.i(i)&65535),a=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=a>>>16,t&=65535,a&=65535,n[i]=a<<16|t}return new o(n,n[n.length-1]&-2147483648?-1:0)};function ne(e,t){return e.add(m(t))}e.j=function(e){if(ee(this)||ee(e))return d;if(te(this))return te(e)?m(this).j(m(e)):m(m(this).j(e));if(te(e))return m(this.j(m(e)));if(this.l(p)<0&&e.l(p)<0)return l(this.m()*e.m());let t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){let i=this.i(r)>>>16,a=this.i(r)&65535,o=e.i(t)>>>16,s=e.i(t)&65535;n[2*r+2*t]+=a*s,re(n,2*r+2*t),n[2*r+2*t+1]+=i*s,re(n,2*r+2*t+1),n[2*r+2*t+1]+=a*o,re(n,2*r+2*t+1),n[2*r+2*t+2]+=i*o,re(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new o(n,0)};function re(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function oe(e,t){this.g=e,this.h=t}function se(e,t){if(ee(t))throw Error(`division by zero`);if(ee(e))return new oe(d,d);if(te(e))return t=se(m(e),t),new oe(m(t.g),m(t.h));if(te(t))return t=se(e,m(t)),new oe(m(t.g),t.h);if(e.g.length>30){if(te(e)||te(t))throw Error(`slowDivide_ only works with positive integers.`);for(var n=f,r=t;r.l(e)<=0;)n=ce(n),r=ce(r);var i=le(n,1),a=le(r,1);for(r=le(r,2),n=le(n,2);!ee(r);){var o=a.add(r);o.l(e)<=0&&(i=i.add(n),a=o),r=le(r,1),n=le(n,1)}return t=ne(e,i.j(t)),new oe(i,t)}for(i=d;e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=Math.ceil(Math.log(n)/Math.LN2),r=r<=48?1:2**(r-48),a=l(n),o=a.j(t);te(o)||o.l(e)>0;)n-=r,a=l(n),o=a.j(t);ee(a)&&(a=f),i=i.add(a),e=ne(e,o)}return new oe(i,e)}e.B=function(e){return se(this,e).h},e.and=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new o(n,this.h&e.h)},e.or=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new o(n,this.h|e.h)},e.xor=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new o(n,this.h^e.h)};function ce(e){let t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new o(n,e.h)}function le(e,t){let n=t>>5;t%=32;let r=e.g.length-n,i=[];for(let a=0;a<r;a++)i[a]=t>0?e.i(a+n)>>>t|e.i(a+n+1)<<32-t:e.i(a+n);return new o(i,e.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,ie.Md5=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=u,ae=ie.Integer=o}).apply(re===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:re);var oe=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},se={},ce,le,ue,de,fe,pe,me,he;(function(){var e,t=Object.defineProperty;function n(e){e=[typeof globalThis==`object`&&globalThis,e,typeof window==`object`&&window,typeof self==`object`&&self,typeof oe==`object`&&oe];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error(`Cannot find global object`)}var r=n(this);function i(e,n){if(n)a:{var i=r;e=e.split(`.`);for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break a;i=i[o]}e=e[e.length-1],a=i[e],n=n(a),n!=a&&n!=null&&t(i,e,{configurable:!0,writable:!0,value:n})}}i(`Symbol.dispose`,function(e){return e||Symbol(`Symbol.dispose`)}),i(`Array.prototype.values`,function(e){return e||function(){return this[Symbol.iterator]()}}),i(`Object.entries`,function(e){return e||function(e){var t=[],n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,e[n]]);return t}});var a=a||{},o=this||self;function s(e){var t=typeof e;return t==`object`&&e!=null||t==`function`}function c(e,t,n){return e.call.apply(e.bind,arguments)}function l(e,t,n){return l=c,l.apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function d(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}var f=typeof AsyncContext<`u`&&typeof AsyncContext.Snapshot==`function`?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function p(e){let t=e.length;if(t>0){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function ee(e,t){for(let t=1;t<arguments.length;t++){let r=arguments[t];var n=typeof r;if(n=n==`object`?r?Array.isArray(r)?`array`:n:`null`:n,n==`array`||n==`object`&&typeof r.length==`number`){n=e.length||0;let t=r.length||0;e.length=n+t;for(let i=0;i<t;i++)e[n+i]=r[i]}else e.push(r)}}class te{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function m(e){o.setTimeout(()=>{throw e},0)}function ne(){var e=ge;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}class re{constructor(){this.h=this.g=null}add(e,t){let n=ie.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var ie=new te(()=>new ae,e=>e.reset());class ae{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let h,g=!1,ge=new re,_=()=>{let e=Promise.resolve(void 0);h=()=>{e.then(v)}};function v(){for(var e;e=ne();){try{e.h.call(e.g)}catch(e){m(e)}var t=ie;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}g=!1}function _e(){this.u=this.u,this.C=this.C}_e.prototype.u=!1,_e.prototype.dispose=function(){this.u||(this.u=!0,this.N())},_e.prototype[Symbol.dispose]=function(){this.dispose()},_e.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function y(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}y.prototype.h=function(){this.defaultPrevented=!0};var ve=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};o.addEventListener(`test`,e,t),o.removeEventListener(`test`,e,t)}catch{}return e}();function ye(e){return/^[\s\xa0]*$/.test(e)}function be(e,t){y.call(this,e?e.type:``),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key=``,this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType=``,this.i=null,e&&this.init(e,t)}d(be,y),be.prototype.init=function(e,t){let n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget,t||(n==`mouseover`?t=e.fromElement:n==`mouseout`&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=r.clientX===void 0?r.pageX:r.clientX,this.clientY=r.clientY===void 0?r.pageY:r.clientY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX===void 0?e.pageX:e.clientX,this.clientY=e.clientY===void 0?e.pageY:e.clientY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||``,this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&be.Z.h.call(this)},be.prototype.h=function(){be.Z.h.call(this);let e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var xe=`closure_listenable_`+(Math.random()*1e6|0),b=0;function Se(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++b,this.da=this.fa=!1}function Ce(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function we(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function Te(e,t){for(let n in e)t.call(void 0,e[n],n,e)}function Ee(e){let t={};for(let n in e)t[n]=e[n];return t}let De=`constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf`.split(` `);function Oe(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<De.length;t++)n=De[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function x(e){this.src=e,this.g={},this.h=0}x.prototype.add=function(e,t,n,r,i){let a=e.toString();e=this.g[a],e||(e=this.g[a]=[],this.h++);let o=C(e,t,r,i);return o>-1?(t=e[o],n||(t.fa=!1)):(t=new Se(t,this.src,a,!!r,i),t.fa=n,e.push(t)),t};function S(e,t){let n=t.type;if(n in e.g){var r=e.g[n],i=Array.prototype.indexOf.call(r,t,void 0),a;(a=i>=0)&&Array.prototype.splice.call(r,i,1),a&&(Ce(t),e.g[n].length==0&&(delete e.g[n],e.h--))}}function C(e,t,n,r){for(let i=0;i<e.length;++i){let a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}var ke=`closure_lm_`+(Math.random()*1e6|0),Ae={};function je(e,t,n,r,i){if(r&&r.once)return Ne(e,t,n,r,i);if(Array.isArray(t)){for(let a=0;a<t.length;a++)je(e,t[a],n,r,i);return null}return n=Be(n),e&&e[xe]?e.J(t,n,s(r)?!!r.capture:!!r,i):Me(e,t,n,!1,r,i)}function Me(e,t,n,r,i,a){if(!t)throw Error(`Invalid event type`);let o=s(i)?!!i.capture:!!i,c=Re(e);if(c||(e[ke]=c=new x(e)),n=c.add(t,n,r,o,a),n.proxy)return n;if(r=w(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)ve||(i=o),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(Ie(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error(`addEventListener and attachEvent are unavailable.`);return n}function w(){function e(n){return t.call(e.src,e.listener,n)}let t=Le;return e}function Ne(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)Ne(e,t[a],n,r,i);return null}return n=Be(n),e&&e[xe]?e.K(t,n,s(r)?!!r.capture:!!r,i):Me(e,t,n,!0,r,i)}function Pe(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)Pe(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=Be(n),e&&e[xe]?(e=e.i,a=String(t).toString(),a in e.g&&(t=e.g[a],n=C(t,n,r,i),n>-1&&(Ce(t[n]),Array.prototype.splice.call(t,n,1),t.length==0&&(delete e.g[a],e.h--)))):(e&&=Re(e))&&(t=e.g[t.toString()],e=-1,t&&(e=C(t,n,r,i)),(n=e>-1?t[e]:null)&&Fe(n))}function Fe(e){if(typeof e!=`number`&&e&&!e.da){var t=e.src;if(t&&t[xe])S(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Ie(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Re(t))?(S(n,e),n.h==0&&(n.src=null,t[ke]=null)):Ce(e)}}}function Ie(e){return e in Ae?Ae[e]:Ae[e]=`on`+e}function Le(e,t){if(e.da)e=!0;else{t=new be(t,this);let n=e.listener,r=e.ha||e.src;e.fa&&Fe(e),e=n.call(r,t)}return e}function Re(e){return e=e[ke],e instanceof x?e:null}var ze=`__closure_events_fn_`+(Math.random()*1e9>>>0);function Be(e){return typeof e==`function`?e:(e[ze]||(e[ze]=function(t){return e.handleEvent(t)}),e[ze])}function T(){_e.call(this),this.i=new x(this),this.M=this,this.G=null}d(T,_e),T.prototype[xe]=!0,T.prototype.removeEventListener=function(e,t,n,r){Pe(this,e,t,n,r)};function E(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,typeof t==`string`)t=new y(t,e);else if(t instanceof y)t.target=t.target||e;else{var i=t;t=new y(r,e),Oe(t,i)}i=!0;let a,o;if(n)for(o=n.length-1;o>=0;o--)a=t.g=n[o],i=Ve(a,r,!0,t)&&i;if(a=t.g=e,i=Ve(a,r,!0,t)&&i,i=Ve(a,r,!1,t)&&i,n)for(o=0;o<n.length;o++)a=t.g=n[o],i=Ve(a,r,!1,t)&&i}T.prototype.N=function(){if(T.Z.N.call(this),this.i){var e=this.i;for(let t in e.g){let n=e.g[t];for(let e=0;e<n.length;e++)Ce(n[e]);delete e.g[t],e.h--}}this.G=null},T.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},T.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};function Ve(e,t,n,r){if(t=e.i.g[String(t)],!t)return!0;t=t.concat();let i=!0;for(let a=0;a<t.length;++a){let o=t[a];if(o&&!o.da&&o.capture==n){let t=o.listener,n=o.ha||o.src;o.fa&&S(e.i,o),i=t.call(n,r)!==!1&&i}}return i&&!r.defaultPrevented}function He(e,t){if(typeof e!=`function`)if(e&&typeof e.handleEvent==`function`)e=l(e.handleEvent,e);else throw Error(`Invalid listener argument`);return Number(t)>2147483647?-1:o.setTimeout(e,t||0)}function Ue(e){e.g=He(()=>{e.g=null,e.i&&(e.i=!1,Ue(e))},e.l);let t=e.h;e.h=null,e.m.apply(null,t)}class We extends _e{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:Ue(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Ge(e){_e.call(this),this.h=e,this.g={}}d(Ge,_e);var Ke=[];function qe(e){we(e.g,function(e,t){this.g.hasOwnProperty(t)&&Fe(e)},e),e.g={}}Ge.prototype.N=function(){Ge.Z.N.call(this),qe(this)},Ge.prototype.handleEvent=function(){throw Error(`EventHandler.handleEvent not implemented`)};var Je=o.JSON.stringify,Ye=o.JSON.parse,Xe=class{stringify(e){return o.JSON.stringify(e,void 0)}parse(e){return o.JSON.parse(e,void 0)}};function Ze(){}function Qe(){}var $e={OPEN:`a`,hb:`b`,ERROR:`c`,tb:`d`};function et(){y.call(this,`d`)}d(et,y);function tt(){y.call(this,`c`)}d(tt,y);var nt={},rt=null;function it(){return rt||=new T}nt.Ia=`serverreachability`;function at(e){y.call(this,nt.Ia,e)}d(at,y);function D(e){let t=it();E(t,new at(t))}nt.STAT_EVENT=`statevent`;function ot(e,t){y.call(this,nt.STAT_EVENT,e),this.stat=t}d(ot,y);function st(e){let t=it();E(t,new ot(t,e))}nt.Ja=`timingevent`;function ct(e,t){y.call(this,nt.Ja,e),this.size=t}d(ct,y);function lt(e,t){if(typeof e!=`function`)throw Error(`Fn must not be null and must be a function`);return o.setTimeout(function(){e()},t)}function O(){this.g=!0}O.prototype.ua=function(){this.g=!1};function ut(e,t,n,r,i,a){e.info(function(){if(e.g)if(a){var o=``,s=a.split(`&`);for(let e=0;e<s.length;e++){var c=s[e].split(`=`);if(c.length>1){let e=c[0];c=c[1];let t=e.split(`_`);o=t.length>=2&&t[1]==`type`?o+(e+`=`+c+`&`):o+(e+`=redacted&`)}}}else o=null;else o=a;return`XMLHTTP REQ (`+r+`) [attempt `+i+`]: `+t+`
|
|
2
|
+
`+n+`
|
|
3
|
+
`+o})}function dt(e,t,n,r,i,a,o){e.info(function(){return`XMLHTTP RESP (`+r+`) [ attempt `+i+`]: `+t+`
|
|
4
|
+
`+n+`
|
|
5
|
+
`+a+` `+o})}function ft(e,t,n,r){e.info(function(){return`XMLHTTP TEXT (`+t+`): `+pt(e,n)+(r?` `+r:``)})}function k(e,t){e.info(function(){return`TIMEOUT: `+t})}O.prototype.info=function(){};function pt(e,t){if(!e.g)return t;if(!t)return null;try{let a=JSON.parse(t);if(a){for(e=0;e<a.length;e++)if(Array.isArray(a[e])){var n=a[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var i=r[0];if(i!=`noop`&&i!=`stop`&&i!=`close`)for(let e=1;e<r.length;e++)r[e]=``}}}}return Je(a)}catch{return t}}var A={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},j={ib:`complete`,Fb:`success`,ERROR:`error`,Ga:`abort`,xb:`ready`,yb:`readystatechange`,TIMEOUT:`timeout`,sb:`incrementaldata`,wb:`progress`,lb:`downloadprogress`,Nb:`uploadprogress`},M;function N(){}d(N,Ze),N.prototype.g=function(){return new XMLHttpRequest},M=new N;function mt(e){return encodeURIComponent(String(e))}function ht(e){var t=1;e=e.split(`:`);let n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(`:`)),n}function gt(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new Ge(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new _t}function _t(){this.i=null,this.g=``,this.h=!1}var vt={},yt={};function bt(e,t,n){e.M=1,e.A=z(zt(t)),e.u=n,e.R=!0,xt(e,null)}function xt(e,t){e.F=Date.now(),P(e),e.B=zt(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),$t(n.i,`t`,r),e.C=0,n=e.j.L,e.h=new _t,e.g=G(e.j,n?t:null,!e.u),e.P>0&&(e.O=new We(l(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var i=`readystatechange`;Array.isArray(i)||(i&&(Ke[0]=i.toString()),i=Ke);for(let e=0;e<i.length;e++){let a=je(n,i[e],r||t.handleEvent,!1,t.h||t);if(!a)break;t.g[a.key]=a}t=e.J?Ee(e.J):{},e.u?(e.v||=`POST`,t[`Content-Type`]=`application/x-www-form-urlencoded`,e.g.ea(e.B,e.v,e.u,t)):(e.v=`GET`,e.g.ea(e.B,e.v,null,t)),D(),ut(e.i,e.v,e.B,e.l,e.S,e.u)}gt.prototype.ba=function(e){e=e.target;let t=this.O;t&&xn(e)==3?t.j():this.Y(e)},gt.prototype.Y=function(e){try{if(e==this.g)a:{let s=xn(this.g),c=this.g.ya(),l=this.g.ca();if(!(s<3)&&(s!=3||this.g&&(this.h.h||this.g.la()||Sn(this.g)))){this.K||s!=4||c==7||D(c==8||l<=0?3:2),Et(this);var t=this.g.ca();this.X=t;var n=St(this);if(this.o=t==200,dt(this.i,this.v,this.B,this.l,this.S,s,t),this.o){if(this.U&&!this.L){b:{if(this.g){var r,i=this.g;if((r=i.g?i.g.getResponseHeader(`X-HTTP-Initial-Response`):null)&&!ye(r)){var a=r;break b}}a=null}if(e=a)ft(this.i,this.l,e,`Initial handshake response via X-HTTP-Initial-Response`),this.L=!0,kt(this,e);else{this.o=!1,this.m=3,st(12),Ot(this),Dt(this);break a}}if(this.R){e=!0;let t;for(;!this.K&&this.C<n.length;)if(t=wt(this,n),t==yt){s==4&&(this.m=4,st(14),e=!1),ft(this.i,this.l,null,`[Incomplete Response]`);break}else if(t==vt){this.m=4,st(15),ft(this.i,this.l,n,`[Invalid Chunk]`),e=!1;break}else ft(this.i,this.l,t,null),kt(this,t);if(Ct(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),s!=4||n.length!=0||this.h.h||(this.m=1,st(16),e=!1),this.o=this.o&&e,!e)ft(this.i,this.l,n,`[Invalid Chunked Response]`),Ot(this),Dt(this);else if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info(`Great, no buffering proxy detected. Bytes received: `+n.length),Fn(o),o.P=!0,st(11))}}else ft(this.i,this.l,n,null),kt(this,n);s==4&&Ot(this),this.o&&!this.K&&(s==4?Rn(this.j,this):(this.o=!1,P(this)))}else U(this.g),t==400&&n.indexOf(`Unknown SID`)>0?(this.m=3,st(12)):(this.m=0,st(13)),Ot(this),Dt(this)}}}catch{}};function St(e){if(!Ct(e))return e.g.la();let t=Sn(e.g);if(t===``)return``;let n=``,r=t.length,i=xn(e.g)==4;if(!e.h.i){if(typeof TextDecoder>`u`)return Ot(e),Dt(e),``;e.h.i=new o.TextDecoder}for(let a=0;a<r;a++)e.h.h=!0,n+=e.h.i.decode(t[a],{stream:!(i&&a==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}function Ct(e){return e.g?e.v==`GET`&&e.M!=2&&e.j.Aa:!1}function wt(e,t){var n=e.C,r=t.indexOf(`
|
|
6
|
+
`,n);return r==-1?yt:(n=Number(t.substring(n,r)),isNaN(n)?vt:(r+=1,r+n>t.length?yt:(t=t.slice(r,r+n),e.C=r+n,t)))}gt.prototype.cancel=function(){this.K=!0,Ot(this)};function P(e){e.T=Date.now()+e.H,Tt(e,e.H)}function Tt(e,t){if(e.D!=null)throw Error(`WatchDog timer not null`);e.D=lt(l(e.aa,e),t)}function Et(e){e.D&&=(o.clearTimeout(e.D),null)}gt.prototype.aa=function(){this.D=null;let e=Date.now();e-this.T>=0?(k(this.i,this.B),this.M!=2&&(D(),st(17)),Ot(this),this.m=2,Dt(this)):Tt(this,this.T-e)};function Dt(e){e.j.I==0||e.K||Rn(e.j,e)}function Ot(e){Et(e);var t=e.O;t&&typeof t.dispose==`function`&&t.dispose(),e.O=null,qe(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function kt(e,t){try{var n=e.j;if(n.I!=0&&(n.g==e||Nt(n.h,e))){if(!e.L&&Nt(n.h,e)&&n.I==3){try{var r=n.Ba.g.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){a:if(!n.v){if(n.g)if(n.g.F+3e3<e.F)Ln(n),En(n);else break a;Pn(n),st(18)}}else n.xa=i[1],0<n.xa-n.K&&i[2]<37500&&n.F&&n.A==0&&!n.C&&(n.C=lt(l(n.Va,n),6e3));Mt(n.h)<=1&&n.ta&&(n.ta=void 0)}else Bn(n,11)}else if((e.L||n.g==e)&&Ln(n),!ye(t))for(i=n.Ba.g.parse(t),t=0;t<i.length;t++){let l=i[t],u=l[0];if(!(u<=n.K))if(n.K=u,l=l[1],n.I==2)if(l[0]==`c`){n.M=l[1],n.ba=l[2];let t=l[3];t!=null&&(n.ka=t,n.j.info(`VER=`+n.ka));let i=l[4];i!=null&&(n.za=i,n.j.info(`SVER=`+n.za));let u=l[5];u!=null&&typeof u==`number`&&u>0&&(r=1.5*u,n.O=r,n.j.info(`backChannelRequestTimeoutMs_=`+r)),r=n;let d=e.g;if(d){let e=d.g?d.g.getResponseHeader(`X-Client-Wire-Protocol`):null;if(e){var a=r.h;a.g||e.indexOf(`spdy`)==-1&&e.indexOf(`quic`)==-1&&e.indexOf(`h2`)==-1||(a.j=a.l,a.g=new Set,a.h&&=(I(a,a.h),null))}if(r.G){let e=d.g?d.g.getResponseHeader(`X-HTTP-Session-Id`):null;e&&(r.wa=e,R(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info(`Handshake RTT: `+n.T+`ms`)),r=n;var o=e;if(r.na=W(r,r.L?r.ba:null,r.W),o.L){Pt(r.h,o);var s=o,c=r.O;c&&(s.H=c),s.D&&(Et(s),P(s)),r.g=o}else Nn(r);n.i.length>0&&On(n)}else l[0]!=`stop`&&l[0]!=`close`||Bn(n,7);else n.I==3&&(l[0]==`stop`||l[0]==`close`?l[0]==`stop`?Bn(n,7):Tn(n):l[0]!=`noop`&&n.l&&n.l.qa(l),n.A=0)}}D(4)}catch{}}var At=class{constructor(e,t){this.g=e,this.map=t}};function jt(e){this.l=e||10,o.PerformanceNavigationTiming?(e=o.performance.getEntriesByType(`navigation`),e=e.length>0&&(e[0].nextHopProtocol==`hq`||e[0].nextHopProtocol==`h2`)):e=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function F(e){return e.h?!0:e.g?e.g.size>=e.j:!1}function Mt(e){return e.h?1:e.g?e.g.size:0}function Nt(e,t){return e.h?e.h==t:e.g?e.g.has(t):!1}function I(e,t){e.g?e.g.add(t):e.h=t}function Pt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}jt.prototype.cancel=function(){if(this.i=Ft(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let e of this.g.values())e.cancel();this.g.clear()}};function Ft(e){if(e.h!=null)return e.i.concat(e.h.G);if(e.g!=null&&e.g.size!==0){let t=e.i;for(let n of e.g.values())t=t.concat(n.G);return t}return p(e.i)}var It=RegExp(`^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$`);function Lt(e,t){if(e){e=e.split(`&`);for(let n=0;n<e.length;n++){let r=e[n].indexOf(`=`),i,a=null;r>=0?(i=e[n].substring(0,r),a=e[n].substring(r+1)):i=e[n],t(i,a?decodeURIComponent(a.replace(/\+/g,` `)):``)}}}function Rt(e){this.g=this.o=this.j=``,this.u=null,this.m=this.h=``,this.l=!1;let t;e instanceof Rt?(this.l=e.l,L(this,e.j),this.o=e.o,this.g=e.g,Bt(this,e.u),this.h=e.h,Vt(this,en(e.i)),this.m=e.m):e&&(t=String(e).match(It))?(this.l=!1,L(this,t[1]||``,!0),this.o=B(t[2]||``),this.g=B(t[3]||``,!0),Bt(this,t[4]),this.h=B(t[5]||``,!0),Vt(this,t[6]||``,!0),this.m=B(t[7]||``)):(this.l=!1,this.i=new Yt(null,this.l))}Rt.prototype.toString=function(){let e=[];var t=this.j;t&&e.push(Ht(t,Wt,!0),`:`);var n=this.g;return(n||t==`file`)&&(e.push(`//`),(t=this.o)&&e.push(Ht(t,Wt,!0),`@`),e.push(mt(n).replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),n=this.u,n!=null&&e.push(`:`,String(n))),(n=this.h)&&(this.g&&n.charAt(0)!=`/`&&e.push(`/`),e.push(Ht(n,n.charAt(0)==`/`?Kt:Gt,!0))),(n=this.i.toString())&&e.push(`?`,n),(n=this.m)&&e.push(`#`,Ht(n,Jt)),e.join(``)},Rt.prototype.resolve=function(e){let t=zt(this),n=!!e.j;n?L(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=e.u!=null;var r=e.h;if(n)Bt(t,e.u);else if(n=!!e.h){if(r.charAt(0)!=`/`)if(this.g&&!this.h)r=`/`+r;else{var i=t.h.lastIndexOf(`/`);i!=-1&&(r=t.h.slice(0,i+1)+r)}if(i=r,i==`..`||i==`.`)r=``;else if(i.indexOf(`./`)!=-1||i.indexOf(`/.`)!=-1){r=i.lastIndexOf(`/`,0)==0,i=i.split(`/`);let e=[];for(let t=0;t<i.length;){let n=i[t++];n==`.`?r&&t==i.length&&e.push(``):n==`..`?((e.length>1||e.length==1&&e[0]!=``)&&e.pop(),r&&t==i.length&&e.push(``)):(e.push(n),r=!0)}r=e.join(`/`)}else r=i}return n?t.h=r:n=e.i.toString()!==``,n?Vt(t,en(e.i)):n=!!e.m,n&&(t.m=e.m),t};function zt(e){return new Rt(e)}function L(e,t,n){e.j=n?B(t,!0):t,e.j&&=e.j.replace(/:$/,``)}function Bt(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error(`Bad port number `+t);e.u=t}else e.u=null}function Vt(e,t,n){t instanceof Yt?(e.i=t,nn(e.i,e.l)):(n||(t=Ht(t,qt)),e.i=new Yt(t,e.l))}function R(e,t,n){e.i.set(t,n)}function z(e){return R(e,`zx`,Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),e}function B(e,t){return e?t?decodeURI(e.replace(/%25/g,`%2525`)):decodeURIComponent(e):``}function Ht(e,t,n){return typeof e==`string`?(e=encodeURI(e).replace(t,Ut),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),e):null}function Ut(e){return e=e.charCodeAt(0),`%`+(e>>4&15).toString(16)+(e&15).toString(16)}var Wt=/[#\/\?@]/g,Gt=/[#\?:]/g,Kt=/[#\?]/g,qt=/[#\?@]/g,Jt=/#/g;function Yt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Xt(e){e.g||(e.g=new Map,e.h=0,e.i&&Lt(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g,` `)),n)}))}e=Yt.prototype,e.add=function(e,t){Xt(this),this.i=null,e=tn(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this};function V(e,t){Xt(e),t=tn(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Zt(e,t){return Xt(e),t=tn(e,t),e.g.has(t)}e.forEach=function(e,t){Xt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)};function Qt(e,t){Xt(e);let n=[];if(typeof t==`string`)Zt(e,t)&&(n=n.concat(e.g.get(tn(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}e.set=function(e,t){return Xt(this),this.i=null,e=tn(this,e),Zt(this,e)&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e?(e=Qt(this,e),e.length>0?String(e[0]):t):t};function $t(e,t,n){V(e,t),n.length>0&&(e.i=null,e.g.set(tn(e,t),p(n)),e.h+=n.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return``;let e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];let i=mt(n);n=Qt(this,n);for(let t=0;t<n.length;t++){let r=i;n[t]!==``&&(r+=`=`+mt(n[t])),e.push(r)}}return this.i=e.join(`&`)};function en(e){let t=new Yt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function tn(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function nn(e,t){t&&!e.j&&(Xt(e),e.i=null,e.g.forEach(function(e,t){let n=t.toLowerCase();t!=n&&(V(this,t),$t(this,n,e))},e)),e.j=t}function rn(e,t){let n=new O;if(o.Image){let r=new Image;r.onload=u(on,n,`TestLoadImage: loaded`,!0,t,r),r.onerror=u(on,n,`TestLoadImage: error`,!1,t,r),r.onabort=u(on,n,`TestLoadImage: abort`,!1,t,r),r.ontimeout=u(on,n,`TestLoadImage: timeout`,!1,t,r),o.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function an(e,t){let n=new O,r=new AbortController,i=setTimeout(()=>{r.abort(),on(n,`TestPingServer: timeout`,!1,t)},1e4);fetch(e,{signal:r.signal}).then(e=>{clearTimeout(i),e.ok?on(n,`TestPingServer: ok`,!0,t):on(n,`TestPingServer: server error`,!1,t)}).catch(()=>{clearTimeout(i),on(n,`TestPingServer: error`,!1,t)})}function on(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch{}}function sn(){this.g=new Xe}function cn(e){this.i=e.Sb||null,this.h=e.ab||!1}d(cn,Ze),cn.prototype.g=function(){return new ln(this.i,this.h)};function ln(e,t){T.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText=``,this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F=`GET`,this.D=``,this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(ln,T),e=ln.prototype,e.open=function(e,t){if(this.readyState!=0)throw this.abort(),Error(`Error reopening a connection`);this.F=e,this.D=t,this.readyState=1,fn(this)},e.send=function(e){if(this.readyState!=1)throw this.abort(),Error(`need to call open() first. `);if(this.v.signal.aborted)throw this.abort(),Error(`Request was aborted.`);this.g=!0;let t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||o).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText=``,this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel(`Request was aborted.`).catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,dn(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,fn(this)),this.g&&(this.readyState=3,fn(this),this.g)))if(this.responseType===`arraybuffer`)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(o.ReadableStream!==void 0&&`body`in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error(`responseType must be empty for "streamBinaryChunks" mode responses.`);this.response=[]}else this.response=this.responseText=``,this.B=new TextDecoder;un(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))};function un(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array;(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?dn(this):fn(this),this.readyState==3&&un(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,dn(this))},e.Na=function(e){this.g&&(this.response=e,dn(this))},e.ga=function(){this.g&&dn(this)};function dn(e){e.readyState=4,e.l=null,e.j=null,e.B=null,fn(e)}e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||``},e.getAllResponseHeaders=function(){if(!this.h)return``;let e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+`: `+n[1]),n=t.next();return e.join(`\r
|
|
7
|
+
`)};function fn(e){e.onreadystatechange&&e.onreadystatechange.call(e)}Object.defineProperty(ln.prototype,"withCredentials",{get:function(){return this.m===`include`},set:function(e){this.m=e?`include`:`same-origin`}});function pn(e){let t=``;return we(e,function(e,n){t+=n,t+=`:`,t+=e,t+=`\r
|
|
8
|
+
`}),t}function mn(e,t,n){a:{for(r in n){var r=!1;break a}r=!0}r||(n=pn(n),typeof e==`string`||R(e,t,n))}function H(e){T.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D=``,this.o=0,this.l=``,this.j=this.B=this.v=this.A=!1,this.m=null,this.F=``,this.H=!1}d(H,T);var hn=/^https?$/i,gn=[`POST`,`PUT`];e=H.prototype,e.Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error(`[goog.net.XhrIo] Object is active with another request=`+this.D+`; newUri=`+e);t=t?t.toUpperCase():`GET`,this.D=e,this.l=``,this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():M.g(),this.g.onreadystatechange=f(l(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){_n(this,e);return}if(e=n||``,n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys==`function`&&typeof r.get==`function`)for(let e of r.keys())n.set(e,r.get(e));else throw Error(`Unknown input type for opt_headers: `+String(r));r=Array.from(n.keys()).find(e=>e.toLowerCase()==`content-type`),i=o.FormData&&e instanceof o.FormData,!(Array.prototype.indexOf.call(gn,t,void 0)>=0)||r||i||n.set(`Content-Type`,`application/x-www-form-urlencoded;charset=utf-8`);for(let[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),`withCredentials`in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&=(clearTimeout(this.m),null),this.v=!0,this.g.send(e),this.v=!1}catch(e){_n(this,e)}};function _n(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,vn(e),bn(e)}function vn(e){e.A||(e.A=!0,E(e,`complete`),E(e,`error`))}e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,E(this,`complete`),E(this,`abort`),bn(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),bn(this,!0)),H.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?yn(this):this.Xa())},e.Xa=function(){yn(this)};function yn(e){if(e.h&&a!==void 0){if(e.v&&xn(e)==4)setTimeout(e.Ca.bind(e),0);else if(E(e,`readystatechange`),xn(e)==4){e.h=!1;try{let a=e.ca();a:switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break a;default:t=!1}var n;if(!(n=t)){var r;if(r=a===0){let t=String(e.D).match(It)[1]||null;!t&&o.self&&o.self.location&&(t=o.self.location.protocol.slice(0,-1)),r=!hn.test(t?t.toLowerCase():``)}n=r}if(n)E(e,`complete`),E(e,`success`);else{e.o=6;try{var i=xn(e)>2?e.g.statusText:``}catch{i=``}e.l=i+` [`+e.ca()+`]`,vn(e)}}finally{bn(e)}}}}function bn(e,t){if(e.g){e.m&&=(clearTimeout(e.m),null);let n=e.g;e.g=null,t||E(e,`ready`);try{n.onreadystatechange=null}catch{}}}e.isActive=function(){return!!this.g};function xn(e){return e.g?e.g.readyState:0}e.ca=function(){try{return xn(this)>2?this.g.status:-1}catch{return-1}},e.la=function(){try{return this.g?this.g.responseText:``}catch{return``}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Ye(t)}};function Sn(e){try{if(!e.g)return null;if(`response`in e.g)return e.g.response;switch(e.F){case``:case`text`:return e.g.responseText;case`arraybuffer`:if(`mozResponseArrayBuffer`in e.g)return e.g.mozResponseArrayBuffer}return null}catch{return null}}function U(e){let t={};e=(e.g&&xn(e)>=2&&e.g.getAllResponseHeaders()||``).split(`\r
|
|
9
|
+
`);for(let r=0;r<e.length;r++){if(ye(e[r]))continue;var n=ht(e[r]);let i=n[0];if(n=n[1],typeof n!=`string`)continue;n=n.trim();let a=t[i]||[];t[i]=a,a.push(n)}Te(t,function(e){return e.join(`, `)})}e.ya=function(){return this.o},e.Ha=function(){return typeof this.l==`string`?this.l:String(this.l)};function Cn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function wn(e){this.za=0,this.i=[],this.j=new O,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Cn(`failFast`,!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Cn(`baseRetryDelayMs`,5e3,e),this.Za=Cn(`retryDelaySeedMs`,1e4,e),this.Ta=Cn(`forwardChannelMaxRetries`,2,e),this.va=Cn(`forwardChannelRequestTimeoutMs`,2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M=``,this.h=new jt(e&&e.concurrentRequestLimit),this.Ba=new sn,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}e=wn.prototype,e.ka=8,e.I=1,e.connect=function(e,t,n,r){st(0),this.W=e,this.H=t||{},n&&r!==void 0&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=W(this,null,this.W),On(this)};function Tn(e){if(Dn(e),e.I==3){var t=e.V++,n=zt(e.J);if(R(n,`SID`,e.M),R(n,`RID`,t),R(n,`TYPE`,`terminate`),jn(e,n),t=new gt(e,e.j,t),t.M=2,t.A=z(zt(n)),n=!1,o.navigator&&o.navigator.sendBeacon)try{n=o.navigator.sendBeacon(t.A.toString(),``)}catch{}!n&&o.Image&&(new Image().src=t.A,n=!0),n||(t.g=G(t.j,null),t.g.ea(t.A)),t.F=Date.now(),P(t)}Vn(e)}function En(e){e.g&&=(Fn(e),e.g.cancel(),null)}function Dn(e){En(e),e.v&&=(o.clearTimeout(e.v),null),Ln(e),e.h.cancel(),e.m&&=(typeof e.m==`number`&&o.clearTimeout(e.m),null)}function On(e){if(!F(e.h)&&!e.m){e.m=!0;var t=e.Ea;h||_(),g||=(h(),!0),ge.add(t,e),e.D=0}}function kn(e,t){return Mt(e.h)>=e.h.j-+!!e.m?!1:e.m?(e.i=t.G.concat(e.i),!0):e.I==1||e.I==2||e.D>=(e.Sa?0:e.Ta)?!1:(e.m=lt(l(e.Ea,e,t),zn(e,e.D)),e.D++,!0)}e.Ea=function(e){if(this.m)if(this.m=null,this.I==1){if(!e){this.V=Math.floor(Math.random()*1e5),e=this.V++;let i=new gt(this,this.j,e),a=this.o;if(this.U&&(a?(a=Ee(a),Oe(a,this.U)):a=this.U),this.u!==null||this.R||(i.J=a,a=null),this.S)a:{for(var t=0,n=0;n<this.i.length;n++){b:{var r=this.i[n];if(`__data__`in r.map&&(r=r.map.__data__,typeof r==`string`)){r=r.length;break b}r=void 0}if(r===void 0)break;if(t+=r,t>4096){t=n;break a}if(t===4096||n===this.i.length-1){t=n+1;break a}}t=1e3}else t=1e3;t=Mn(this,i,t),n=zt(this.J),R(n,`RID`,e),R(n,`CVER`,22),this.G&&R(n,`X-HTTP-Session-Id`,this.G),jn(this,n),a&&(this.R?t=`headers=`+mt(pn(a))+`&`+t:this.u&&mn(n,this.u,a)),I(this.h,i),this.Ra&&R(n,`TYPE`,`init`),this.S?(R(n,`$req`,t),R(n,`SID`,`null`),i.U=!0,bt(i,n,null)):bt(i,n,t),this.I=2}}else this.I==3&&(e?An(this,e):this.i.length==0||F(this.h)||An(this))};function An(e,t){var n=t?t.l:e.V++;let r=zt(e.J);R(r,`SID`,e.M),R(r,`RID`,n),R(r,`AID`,e.K),jn(e,r),e.u&&e.o&&mn(r,e.u,e.o),n=new gt(e,e.j,n,e.D+1),e.u===null&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Mn(e,n,1e3),n.H=Math.round(e.va*.5)+Math.round(e.va*.5*Math.random()),I(e.h,n),bt(n,r,t)}function jn(e,t){e.H&&we(e.H,function(e,n){R(t,n,e)}),e.l&&we({},function(e,n){R(t,n,e)})}function Mn(e,t,n){n=Math.min(e.i.length,n);let r=e.l?l(e.l.Ka,e.l,e):null;a:{var i=e.i;let t=-1;for(;;){let e=[`count=`+n];t==-1?n>0?(t=i[0].g,e.push(`ofs=`+t)):t=0:e.push(`ofs=`+t);let c=!0;for(let l=0;l<n;l++){var a=i[l].g;let n=i[l].map;if(a-=t,a<0)t=Math.max(0,i[l].g-100),c=!1;else try{a=`req`+a+`_`||``;try{var o=n instanceof Map?n:Object.entries(n);for(let[t,n]of o){let r=n;s(n)&&(r=Je(n)),e.push(a+t+`=`+encodeURIComponent(r))}}catch(t){throw e.push(a+`type=_badmap`),t}}catch{r&&r(n)}}if(c){o=e.join(`&`);break a}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function Nn(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;h||_(),g||=(h(),!0),ge.add(t,e),e.A=0}}function Pn(e){return e.g||e.v||e.A>=3?!1:(e.Y++,e.v=lt(l(e.Da,e),zn(e,e.A)),e.A++,!0)}e.Da=function(){if(this.v=null,In(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var e=4*this.T;this.j.info(`BP detection timer enabled: `+e),this.B=lt(l(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info(`BP detection timeout reached.`),this.j.info(`Buffering proxy detected and switch to long-polling!`),this.F=!1,this.P=!0,st(10),En(this),In(this))};function Fn(e){e.B!=null&&(o.clearTimeout(e.B),e.B=null)}function In(e){e.g=new gt(e,e.j,`rpc`,e.Y),e.u===null&&(e.g.J=e.o),e.g.P=0;var t=zt(e.na);R(t,`RID`,`rpc`),R(t,`SID`,e.M),R(t,`AID`,e.K),R(t,`CI`,e.F?`0`:`1`),!e.F&&e.ia&&R(t,`TO`,e.ia),R(t,`TYPE`,`xmlhttp`),jn(e,t),e.u&&e.o&&mn(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=z(zt(t)),n.u=null,n.R=!0,xt(n,e)}e.Va=function(){this.C!=null&&(this.C=null,En(this),Pn(this),st(19))};function Ln(e){e.C!=null&&(o.clearTimeout(e.C),e.C=null)}function Rn(e,t){var n=null;if(e.g==t){Ln(e),Fn(e),e.g=null;var r=2}else if(Nt(e.h,t))n=t.G,Pt(e.h,t),r=1;else return;if(e.I!=0){if(t.o)if(r==1){n=t.u?t.u.length:0,t=Date.now()-t.F;var i=e.D;r=it(),E(r,new ct(r,n)),On(e)}else Nn(e);else if(i=t.m,i==3||i==0&&t.X>0||!(r==1&&kn(e,t)||r==2&&Pn(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),i){case 1:Bn(e,5);break;case 4:Bn(e,10);break;case 3:Bn(e,6);break;default:Bn(e,2)}}}function zn(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function Bn(e,t){if(e.j.info(`Error code `+t),t==2){var n=l(e.bb,e),r=e.Ua;let t=!r;r=new Rt(r||`//www.google.com/images/cleardot.gif`),o.location&&o.location.protocol==`http`||L(r,`https`),z(r),t?rn(r.toString(),n):an(r.toString(),n)}else st(2);e.I=0,e.l&&e.l.pa(t),Vn(e),Dn(e)}e.bb=function(e){e?(this.j.info(`Successfully pinged google.com`),st(2)):(this.j.info(`Failed to ping google.com`),st(1))};function Vn(e){if(e.I=0,e.ja=[],e.l){let t=Ft(e.h);(t.length!=0||e.i.length!=0)&&(ee(e.ja,t),ee(e.ja,e.i),e.h.i.length=0,p(e.i),e.i.length=0),e.l.oa()}}function W(e,t,n){var r=n instanceof Rt?zt(n):new Rt(n);if(r.g!=``)t&&(r.g=t+`.`+r.g),Bt(r,r.u);else{var i=o.location;r=i.protocol,t=t?t+`.`+i.hostname:i.hostname,i=+i.port;let e=new Rt(null);r&&L(e,r),t&&(e.g=t),i&&Bt(e,i),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&R(r,n,t),R(r,`VER`,e.ka),jn(e,r),r}function G(e,t,n){if(t&&!e.L)throw Error(`Can't create secondary domain capable XhrIo object.`);return t=e.Aa&&!e.ma?new H(new cn({ab:n})):new H(e.ma),t.Fa(e.L),t}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function Hn(){}e=Hn.prototype,e.ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){};function Un(){}Un.prototype.g=function(e,t){return new K(e,t)};function K(e,t){T.call(this),this.g=new wn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e[`X-Client-Protocol`]=`webchannel`:e={"X-Client-Protocol":`webchannel`}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e[`X-WebChannel-Content-Type`]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e[`X-WebChannel-Client-Profile`]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!ye(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t&&=t.httpSessionIdParam)&&!ye(t)&&(this.g.G=t,e=this.h,e!==null&&t in e&&(e=this.h,t in e&&delete e[t])),this.j=new Kn(this)}d(K,T),K.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},K.prototype.close=function(){Tn(this.g)},K.prototype.o=function(e){var t=this.g;if(typeof e==`string`){var n={};n.__data__=e,e=n}else this.v&&(n={},n.__data__=Je(e),e=n);t.i.push(new At(t.Ya++,e)),t.I==3&&On(t)},K.prototype.N=function(){this.g.l=null,delete this.j,Tn(this.g),delete this.g,K.Z.N.call(this)};function Wn(e){et.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){a:{for(let n in t){e=n;break a}e=void 0}(this.i=e)&&(e=this.i,t=t!==null&&e in t?t[e]:void 0),this.data=t}else this.data=e}d(Wn,et);function Gn(){tt.call(this),this.status=1}d(Gn,tt);function Kn(e){this.g=e}d(Kn,Hn),Kn.prototype.ra=function(){E(this.g,`a`)},Kn.prototype.qa=function(e){E(this.g,new Wn(e))},Kn.prototype.pa=function(e){E(this.g,new Gn)},Kn.prototype.oa=function(){E(this.g,`b`)},Un.prototype.createWebChannel=Un.prototype.g,K.prototype.send=K.prototype.o,K.prototype.open=K.prototype.m,K.prototype.close=K.prototype.close,he=se.createWebChannelTransport=function(){return new Un},me=se.getStatEventTarget=function(){return it()},pe=se.Event=nt,fe=se.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},A.NO_ERROR=0,A.TIMEOUT=8,A.HTTP_ERROR=6,de=se.ErrorCode=A,j.COMPLETE=`complete`,ue=se.EventType=j,Qe.EventType=$e,$e.OPEN=`a`,$e.CLOSE=`b`,$e.ERROR=`c`,$e.MESSAGE=`d`,T.prototype.listen=T.prototype.J,le=se.WebChannel=Qe,se.FetchXmlHttpFactory=cn,H.prototype.listenOnce=H.prototype.K,H.prototype.getLastError=H.prototype.Ha,H.prototype.getLastErrorCode=H.prototype.ya,H.prototype.getStatus=H.prototype.ca,H.prototype.getResponseJson=H.prototype.La,H.prototype.getResponseText=H.prototype.la,H.prototype.send=H.prototype.ea,H.prototype.setWithCredentials=H.prototype.Fa,ce=se.XhrIo=H}).apply(oe===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:oe);var h=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},g=class{static CODES=new Map([[`\x07`,7],[`\b`,8],[` `,9],[`
|
|
10
|
+
`,10],[`\v`,11],[`\f`,12],[`\r`,13],[` `,32],[`"`,34],[`$`,36],[`&`,38],[`(`,40],[`)`,41],[`*`,42],[`+`,43],[`-`,45],[`.`,46],[`0`,48],[`1`,49],[`2`,50],[`3`,51],[`4`,52],[`5`,53],[`6`,54],[`7`,55],[`8`,56],[`9`,57],[`:`,58],[`<`,60],[`>`,62],[`?`,63],[`A`,65],[`B`,66],[`C`,67],[`F`,70],[`P`,80],[`Q`,81],[`U`,85],[`Z`,90],[`[`,91],[`\\`,92],[`]`,93],[`^`,94],[`_`,95],[`a`,97],[`b`,98],[`f`,102],[`i`,105],[`m`,109],[`n`,110],[`r`,114],[`s`,115],[`t`,116],[`v`,118],[`x`,120],[`z`,122],[`{`,123],[`|`,124],[`}`,125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}},ge=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,1],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,120275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,1],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=new Map([[`C`,e.C],[`Cc`,e.Cc],[`Cf`,e.Cf],[`Co`,e.Co],[`Cs`,e.Cs],[`L`,e.L],[`Ll`,e.Ll],[`Lm`,e.Lm],[`Lo`,e.Lo],[`Lt`,e.Lt],[`Lu`,e.Lu],[`M`,e.M],[`Mc`,e.Mc],[`Me`,e.Me],[`Mn`,e.Mn],[`N`,e.N],[`Nd`,e.Nd],[`Nl`,e.Nl],[`No`,e.No],[`P`,e.P],[`Pc`,e.Pc],[`Pd`,e.Pd],[`Pe`,e.Pe],[`Pf`,e.Pf],[`Pi`,e.Pi],[`Po`,e.Po],[`Ps`,e.Ps],[`S`,e.S],[`Sc`,e.Sc],[`Sk`,e.Sk],[`Sm`,e.Sm],[`So`,e.So],[`Z`,e.Z],[`Zl`,e.Zl],[`Zp`,e.Zp],[`Zs`,e.Zs]]);static SCRIPTS=new Map([[`Adlam`,e.Adlam],[`Ahom`,e.Ahom],[`Anatolian_Hieroglyphs`,e.Anatolian_Hieroglyphs],[`Arabic`,e.Arabic],[`Armenian`,e.Armenian],[`Avestan`,e.Avestan],[`Balinese`,e.Balinese],[`Bamum`,e.Bamum],[`Bassa_Vah`,e.Bassa_Vah],[`Batak`,e.Batak],[`Bengali`,e.Bengali],[`Bhaiksuki`,e.Bhaiksuki],[`Bopomofo`,e.Bopomofo],[`Brahmi`,e.Brahmi],[`Braille`,e.Braille],[`Buginese`,e.Buginese],[`Buhid`,e.Buhid],[`Canadian_Aboriginal`,e.Canadian_Aboriginal],[`Carian`,e.Carian],[`Caucasian_Albanian`,e.Caucasian_Albanian],[`Chakma`,e.Chakma],[`Cham`,e.Cham],[`Cherokee`,e.Cherokee],[`Chorasmian`,e.Chorasmian],[`Common`,e.Common],[`Coptic`,e.Coptic],[`Cuneiform`,e.Cuneiform],[`Cypriot`,e.Cypriot],[`Cypro_Minoan`,e.Cypro_Minoan],[`Cyrillic`,e.Cyrillic],[`Deseret`,e.Deseret],[`Devanagari`,e.Devanagari],[`Dives_Akuru`,e.Dives_Akuru],[`Dogra`,e.Dogra],[`Duployan`,e.Duployan],[`Egyptian_Hieroglyphs`,e.Egyptian_Hieroglyphs],[`Elbasan`,e.Elbasan],[`Elymaic`,e.Elymaic],[`Ethiopic`,e.Ethiopic],[`Georgian`,e.Georgian],[`Glagolitic`,e.Glagolitic],[`Gothic`,e.Gothic],[`Grantha`,e.Grantha],[`Greek`,e.Greek],[`Gujarati`,e.Gujarati],[`Gunjala_Gondi`,e.Gunjala_Gondi],[`Gurmukhi`,e.Gurmukhi],[`Han`,e.Han],[`Hangul`,e.Hangul],[`Hanifi_Rohingya`,e.Hanifi_Rohingya],[`Hanunoo`,e.Hanunoo],[`Hatran`,e.Hatran],[`Hebrew`,e.Hebrew],[`Hiragana`,e.Hiragana],[`Imperial_Aramaic`,e.Imperial_Aramaic],[`Inherited`,e.Inherited],[`Inscriptional_Pahlavi`,e.Inscriptional_Pahlavi],[`Inscriptional_Parthian`,e.Inscriptional_Parthian],[`Javanese`,e.Javanese],[`Kaithi`,e.Kaithi],[`Kannada`,e.Kannada],[`Katakana`,e.Katakana],[`Kawi`,e.Kawi],[`Kayah_Li`,e.Kayah_Li],[`Kharoshthi`,e.Kharoshthi],[`Khitan_Small_Script`,e.Khitan_Small_Script],[`Khmer`,e.Khmer],[`Khojki`,e.Khojki],[`Khudawadi`,e.Khudawadi],[`Lao`,e.Lao],[`Latin`,e.Latin],[`Lepcha`,e.Lepcha],[`Limbu`,e.Limbu],[`Linear_A`,e.Linear_A],[`Linear_B`,e.Linear_B],[`Lisu`,e.Lisu],[`Lycian`,e.Lycian],[`Lydian`,e.Lydian],[`Mahajani`,e.Mahajani],[`Makasar`,e.Makasar],[`Malayalam`,e.Malayalam],[`Mandaic`,e.Mandaic],[`Manichaean`,e.Manichaean],[`Marchen`,e.Marchen],[`Masaram_Gondi`,e.Masaram_Gondi],[`Medefaidrin`,e.Medefaidrin],[`Meetei_Mayek`,e.Meetei_Mayek],[`Mende_Kikakui`,e.Mende_Kikakui],[`Meroitic_Cursive`,e.Meroitic_Cursive],[`Meroitic_Hieroglyphs`,e.Meroitic_Hieroglyphs],[`Miao`,e.Miao],[`Modi`,e.Modi],[`Mongolian`,e.Mongolian],[`Mro`,e.Mro],[`Multani`,e.Multani],[`Myanmar`,e.Myanmar],[`Nabataean`,e.Nabataean],[`Nag_Mundari`,e.Nag_Mundari],[`Nandinagari`,e.Nandinagari],[`New_Tai_Lue`,e.New_Tai_Lue],[`Newa`,e.Newa],[`Nko`,e.Nko],[`Nushu`,e.Nushu],[`Nyiakeng_Puachue_Hmong`,e.Nyiakeng_Puachue_Hmong],[`Ogham`,e.Ogham],[`Ol_Chiki`,e.Ol_Chiki],[`Old_Hungarian`,e.Old_Hungarian],[`Old_Italic`,e.Old_Italic],[`Old_North_Arabian`,e.Old_North_Arabian],[`Old_Permic`,e.Old_Permic],[`Old_Persian`,e.Old_Persian],[`Old_Sogdian`,e.Old_Sogdian],[`Old_South_Arabian`,e.Old_South_Arabian],[`Old_Turkic`,e.Old_Turkic],[`Old_Uyghur`,e.Old_Uyghur],[`Oriya`,e.Oriya],[`Osage`,e.Osage],[`Osmanya`,e.Osmanya],[`Pahawh_Hmong`,e.Pahawh_Hmong],[`Palmyrene`,e.Palmyrene],[`Pau_Cin_Hau`,e.Pau_Cin_Hau],[`Phags_Pa`,e.Phags_Pa],[`Phoenician`,e.Phoenician],[`Psalter_Pahlavi`,e.Psalter_Pahlavi],[`Rejang`,e.Rejang],[`Runic`,e.Runic],[`Samaritan`,e.Samaritan],[`Saurashtra`,e.Saurashtra],[`Sharada`,e.Sharada],[`Shavian`,e.Shavian],[`Siddham`,e.Siddham],[`SignWriting`,e.SignWriting],[`Sinhala`,e.Sinhala],[`Sogdian`,e.Sogdian],[`Sora_Sompeng`,e.Sora_Sompeng],[`Soyombo`,e.Soyombo],[`Sundanese`,e.Sundanese],[`Syloti_Nagri`,e.Syloti_Nagri],[`Syriac`,e.Syriac],[`Tagalog`,e.Tagalog],[`Tagbanwa`,e.Tagbanwa],[`Tai_Le`,e.Tai_Le],[`Tai_Tham`,e.Tai_Tham],[`Tai_Viet`,e.Tai_Viet],[`Takri`,e.Takri],[`Tamil`,e.Tamil],[`Tangsa`,e.Tangsa],[`Tangut`,e.Tangut],[`Telugu`,e.Telugu],[`Thaana`,e.Thaana],[`Thai`,e.Thai],[`Tibetan`,e.Tibetan],[`Tifinagh`,e.Tifinagh],[`Tirhuta`,e.Tirhuta],[`Toto`,e.Toto],[`Ugaritic`,e.Ugaritic],[`Vai`,e.Vai],[`Vithkuqi`,e.Vithkuqi],[`Wancho`,e.Wancho],[`Warang_Citi`,e.Warang_Citi],[`Yezidi`,e.Yezidi],[`Yi`,e.Yi],[`Zanabazar_Square`,e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([[`L`,e.foldL],[`Ll`,e.foldLl],[`Lt`,e.foldLt],[`Lu`,e.foldLu],[`M`,e.foldM],[`Mn`,e.foldMn]]);static FOLD_SCRIPT=new Map([[`Common`,e.foldCommon],[`Greek`,e.foldGreek],[`Inherited`,e.foldInherited]])},_=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e[i];if(a[0]<=t&&t<=a[1])return(t-a[0])%a[2]===0;t<a[0]?r=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return t<n[0]?!1:(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(ge.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(ge.L,e)||this.is(ge.M,e)||this.is(ge.N,e)||this.is(ge.P,e)||this.is(ge.S,e)}static simpleFold(e){if(ge.CASE_ORBIT.has(e))return ge.CASE_ORBIT.get(e);let t=g.toLowerCase(e);return t===e?g.toUpperCase(e):t}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)&&(e|=32),g.CODES.get(`A`)<=t&&t<=g.CODES.get(`Z`)&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}},v=class{static METACHARACTERS=`\\.+*?()|[]{}^$`;static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)||g.CODES.get(`a`)<=e&&e<=g.CODES.get(`z`)||g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)}static unhex(e){return g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)?e-g.CODES.get(`0`):g.CODES.get(`a`)<=e&&e<=g.CODES.get(`f`)?e-g.CODES.get(`a`)+10:g.CODES.get(`A`)<=e&&e<=g.CODES.get(`F`)?e-g.CODES.get(`A`)+10:-1}static escapeRune(e){let t=``;if(_.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+=`\\`),t+=String.fromCodePoint(e);else switch(e){case g.CODES.get(`"`):t+=`\\"`;break;case g.CODES.get(`\\`):t+=`\\\\`;break;case g.CODES.get(` `):t+=`\\t`;break;case g.CODES.get(`
|
|
11
|
+
`):t+=`\\n`;break;case g.CODES.get(`\r`):t+=`\\r`;break;case g.CODES.get(`\b`):t+=`\\b`;break;case g.CODES.get(`\f`):t+=`\\f`;break;default:{let n=e.toString(16);e<256?(t+=`\\x`,n.length===1&&(t+=`0`),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split(``).map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return g.CODES.get(`a`)<=e&&e<=g.CODES.get(`z`)||g.CODES.get(`A`)<=e&&e<=g.CODES.get(`Z`)||g.CODES.get(`0`)<=e&&e<=g.CODES.get(`9`)||e===g.CODES.get(`_`)}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===g.CODES.get(`
|
|
12
|
+
`)&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===g.CODES.get(`
|
|
13
|
+
`)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)===this.isWordRune(t)?n|=this.EMPTY_NO_WORD_BOUNDARY:n|=this.EMPTY_WORD_BOUNDARY,n}static quoteMeta(e){return e.split(``).map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join(``)}static charCount(e){return e>_.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder(`utf-8`).decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)}}},_e=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t+r;n[i]=a,n[a]=i}return Object.freeze(n)},y=class e{static Encoding=_e([`UTF_16`,`UTF_8`]);getEncoding(){throw Error(`not implemented`)}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},ve=class extends y{constructor(e=null){super(),this.bytes=e}getEncoding(){return y.Encoding.UTF_8}asCharSequence(){return v.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},ye=class extends y{constructor(e=null){super(),this.charSequence=e}getEncoding(){return y.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split(``).map(e=>e.codePointAt(0))}length(){return this.charSequence.length}},be=class{static utf16(e){return new ye(e)}static utf8(e){return Array.isArray(e)?new ve(e):new ve(v.stringToUtf8ByteArray(e))}},xe=class extends Error{constructor(e){super(e),this.name=`RE2JSException`}},b=class extends xe{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name=`RE2JSSyntaxException`,this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Se=class extends xe{constructor(e){super(e),this.name=`RE2JSCompileException`}},Ce=class extends xe{constructor(e){super(e),this.name=`RE2JSGroupException`}},we=class extends xe{constructor(e){super(e),this.name=`RE2JSFlagsException`}},Te=class{static quoteReplacement(e){return e.indexOf(`\\`)<0&&e.indexOf(`$`)<0?e:e.split(``).map(e=>{let t=e.codePointAt(0);return t===g.CODES[`\\`]||t===g.CODES.$?`\\${e}`:e}).join(``)}constructor(e,t){if(e===null)throw Error(`pattern is null`);this.patternInput=e;let n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof y?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(be.utf8(t)):this.resetMatcherInput(be.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw Error(`input is null`);return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Ce(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Ce(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Ce(`group '${e}' not found`);e=t}let t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new Ce(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new Ce(`perhaps no match attempted`);if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new Ce(`inconsistency in matching group data`);this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,h.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,h.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new Ce(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,h.UNANCHORED)}genMatch(e,t){let n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?v.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n=``,r=this.start(),i=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++){if(e.codePointAt(i)===g.CODES.get(`\\`)){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===g.CODES.get(`$`)){let a=e.codePointAt(i+1);if(g.CODES.get(`0`)<=a&&a<=g.CODES.get(`9`)){let o=a-g.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<g.CODES.get(`0`)||a>g.CODES.get(`9`)||o*10+a-g.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-g.CODES.get(`0`);if(o>this.patternGroupCount)throw new Ce(`n > number of groups: ${o}`);let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===g.CODES.get(`{`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==g.CODES.get(`}`)&&e.codePointAt(r)!==g.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==g.CODES.get(`}`))throw new Ce(`named capture group is missing trailing '}'`);let a=e.substring(i+1,r);t+=this.group(a),n=r+1}}}return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++)if(e.codePointAt(i)===g.CODES.get(`$`)){let a=e.codePointAt(i+1);if(g.CODES.get(`$`)===a){n<i&&(t+=e.substring(n,i)),t+=`$`,i++,n=i+1;continue}else if(g.CODES.get(`&`)===a){n<i&&(t+=e.substring(n,i));let r=this.group(0);r===null?t+=`$&`:t+=r,i++,n=i+1;continue}else if(g.CODES.get(`1`)<=a&&a<=g.CODES.get(`9`)){let o=a-g.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<g.CODES.get(`0`)||a>g.CODES.get(`9`)||o*10+a-g.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-g.CODES.get(`0`);if(o>this.patternGroupCount){t+=`$${o}`,n=i,i--;continue}let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===g.CODES.get(`<`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==g.CODES.get(`>`)&&e.codePointAt(r)!==g.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==g.CODES.get(`>`)){t+=e.substring(i-1,r+1),n=r+1;continue}let a=e.substring(i+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,a)?t+=this.group(a):t+=`$<${a}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r=``;for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}},Ee=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},De=class extends Ee{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return Ee.EOF();let t=this.bytes[e++]&255;return t&128?(t&224)==192?(t&=31,e>=this.end?Ee.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)==224?(t&=15,e+1>=this.end?Ee.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t&=7,e+2>=this.end?Ee.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4)):t<<3|1}index(e,t){t+=this.start;let n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&(this.bytes[n]&192)==128;)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}let n=e<this.end?this.step(e)>>3:-1;return v.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(r===0)return-1;let i=e.length;for(let a=n;a<=i-r;a++)for(let n=0;n<r&&e[a+n]===t[n];n++)if(n===r-1)return a;return-1}},Oe=class extends Ee{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){let t=this.charSequence.codePointAt(e);return t<<3|v.charCount(t)}else return Ee.EOF()}index(e,t){t+=this.start;let n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;let t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return v.emptyOpContext(t,n)}},x=class{static fromUTF8(e,t=0,n=e.length){return new De(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new Oe(e,t,n)}},S=class e{static Op=_e([`NO_MATCH`,`EMPTY_MATCH`,`LITERAL`,`CHAR_CLASS`,`ANY_CHAR_NOT_NL`,`ANY_CHAR`,`BEGIN_LINE`,`END_LINE`,`BEGIN_TEXT`,`END_TEXT`,`WORD_BOUNDARY`,`NO_WORD_BOUNDARY`,`CAPTURE`,`STAR`,`PLUS`,`QUEST`,`REPEAT`,`CONCAT`,`ALTERNATE`,`LEFT_PAREN`,`VERTICAL_BAR`]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===g.CODES.get(`-`)?`\\`:``}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t=``;switch(this.op){case e.Op.NO_MATCH:t+=`[^\\x00-\\x{10FFFF}]`;break;case e.Op.EMPTY_MATCH:t+=`(?:)`;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+=`*`;break;case e.Op.PLUS:t+=`+`;break;case e.Op.QUEST:t+=`?`;break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=`,`,this.max>=0&&(t+=this.max)),t+=`}`;break}(this.flags&h.NON_GREEDY)!==0&&(t+=`?`);break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e=``;for(let n of this.subs)t+=e,e=`|`,t+=n.appendTo();break}case e.Op.LITERAL:(this.flags&h.FOLD_CASE)!==0&&(t+=`(?i:`);for(let e of this.runes)t+=v.escapeRune(e);(this.flags&h.FOLD_CASE)!==0&&(t+=`)`);break;case e.Op.ANY_CHAR_NOT_NL:t+=`(?-s:.)`;break;case e.Op.ANY_CHAR:t+=`(?s:.)`;break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+=`(`:t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=`)`;break;case e.Op.BEGIN_TEXT:t+=`\\A`;break;case e.Op.END_TEXT:(this.flags&h.WAS_DOLLAR)===0?t+=`\\z`:t+=`(?-m:$)`;break;case e.Op.BEGIN_LINE:t+=`^`;break;case e.Op.END_LINE:t+=`$`;break;case e.Op.WORD_BOUNDARY:t+=`\\b`;break;case e.Op.NO_WORD_BOUNDARY:t+=`\\B`;break;case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+=`[invalid char class]`;break}if(t+=`[`,this.runes.length===0)t+=`^\\x00-\\x{10FFFF}`;else if(this.runes[0]===0&&this.runes[this.runes.length-1]===_.MAX_RUNE){t+=`^`;for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,i=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=v.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=v.escapeRune(i))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],i=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=v.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=v.escapeRune(i))}t+=`]`;break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let e of this.subs){let n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&h.WAS_DOLLAR)!==(t.flags&h.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&h.NON_GREEDY)!==(t.flags&h.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&h.NON_GREEDY)!==(t.flags&h.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}return!0}},C=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t=`"`;for(let n of e)t+=v.escapeRune(n);return t+=`"`,t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){let t=this.runes[0];return(this.arg&h.FOLD_CASE)===0?e===t:_.equalsIgnoreCase(t,e)}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){let r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return`match`;case e.FAIL:return`fail`;case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?`rune <null>`:[`rune `,e.escapeRunes(this.runes),(this.arg&h.FOLD_CASE)===0?``:`/i`,` -> `,this.out].join(``);case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw Error(`unhandled case in Inst.toString`)}}},ke=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new C(e))}skipNop(e){let t=this.inst[e];for(;t.op===C.NOP||t.op===C.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e=``,t=this.skipNop(this.start);if(!C.isRuneOp(t.op)||t.runes.length!==1)return[t.op===C.MATCH,e];for(;C.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&h.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===C.MATCH,e]}startCond(){let e=0,t=this.start;loop:for(;;){let n=this.inst[t];switch(n.op){case C.EMPTY_WIDTH:e|=n.arg;break;case C.FAIL:return-1;case C.CAPTURE:case C.NOP:break;default:break loop}t=n.out}return e}next(e){let t=this.inst[e>>1];return e&1?t.arg:t.out}patch(e,t){for(;e!==0;){let n=this.inst[e>>1];e&1?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){let e=this.next(n);if(e===0)break;n=e}let r=this.inst[n>>1];return n&1?r.arg=t:r.out=t,e}toString(){let e=``;for(let t=0;t<this.inst.length;t++){let n=e.length;e+=t,t===this.start&&(e+=`*`),e+=` `.substring(e.length-n),e+=this.inst[t],e+=`
|
|
14
|
+
`}return e}},Ae=class{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}},je=class e{static ANY_RUNE_NOT_NL(){return[0,g.CODES.get(`
|
|
15
|
+
`)-1,g.CODES.get(`
|
|
16
|
+
`)+1,_.MAX_RUNE]}static ANY_RUNE(){return[0,_.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(C.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new ke,this.newInst(C.FAIL)}newInst(e){return this.prog.addInst(e),new Ae(this.prog.numInst()-1,0,!0)}nop(){let e=this.newInst(C.NOP);return e.out=e.i<<1,e}fail(){return new Ae}cap(e){let t=this.newInst(C.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new Ae(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){let n=this.newInst(C.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new Ae(e.i,this.loop(e,t).out,e.nullable)}empty(e){let t=this.newInst(C.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){let n=this.newInst(C.RUNE);n.nullable=!1;let r=this.prog.getInst(n.i);return r.runes=e,t&=h.FOLD_CASE,(e.length!==1||_.simpleFold(e[0])===e[0])&&(t&=~h.FOLD_CASE),r.arg=t,n.out=n.i<<1,(t&h.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?r.op=C.RUNE1:e.length===2&&e[0]===0&&e[1]===_.MAX_RUNE?r.op=C.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===g.CODES.get(`
|
|
17
|
+
`)-1&&e[2]===g.CODES.get(`
|
|
18
|
+
`)+1&&e[3]===_.MAX_RUNE&&(r.op=C.RUNE_ANY_NOT_NL),n}compile(t){switch(t.op){case S.Op.NO_MATCH:return this.fail();case S.Op.EMPTY_MATCH:return this.nop();case S.Op.LITERAL:if(t.runes.length===0)return this.nop();{let e=null;for(let n of t.runes){let r=this.rune([n],t.flags);e=e===null?r:this.cat(e,r)}return e}case S.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case S.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case S.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case S.Op.BEGIN_LINE:return this.empty(v.EMPTY_BEGIN_LINE);case S.Op.END_LINE:return this.empty(v.EMPTY_END_LINE);case S.Op.BEGIN_TEXT:return this.empty(v.EMPTY_BEGIN_TEXT);case S.Op.END_TEXT:return this.empty(v.EMPTY_END_TEXT);case S.Op.WORD_BOUNDARY:return this.empty(v.EMPTY_WORD_BOUNDARY);case S.Op.NO_WORD_BOUNDARY:return this.empty(v.EMPTY_NO_WORD_BOUNDARY);case S.Op.CAPTURE:{let e=this.cap(t.cap<<1),n=this.compile(t.subs[0]),r=this.cap(t.cap<<1|1);return this.cat(this.cat(e,n),r)}case S.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&h.NON_GREEDY)!==0);case S.Op.CONCAT:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.cat(e,t)}return e}case S.Op.ALTERNATE:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.alt(e,t)}return e}default:throw new Se(`regexp: unhandled case in compile`)}}},Me=class e{static simplify(t){if(t===null)return null;switch(t.op){case S.Op.CAPTURE:case S.Op.CONCAT:case S.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let i=t.subs[r],a=e.simplify(i);n===t&&a!==i&&(n=S.fromRegexp(t),n.runes=null,n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=a)}return n}case S.Op.STAR:case S.Op.PLUS:case S.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case S.Op.REPEAT:{if(t.min===0&&t.max===0)return new S(S.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(S.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(S.Op.PLUS,t.flags,n,null);let r=new S(S.Op.CONCAT),i=[];for(let e=0;e<t.min-1;e++)i.push(n);return i.push(e.simplify1(S.Op.PLUS,t.flags,n,null)),r.subs=i.slice(0),r}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let e=0;e<t.min;e++)r.push(n)}if(t.max>t.min){let i=e.simplify1(S.Op.QUEST,t.flags,n,null);for(let r=t.min+1;r<t.max;r++){let r=new S(S.Op.CONCAT);r.subs=[n,i],i=e.simplify1(S.Op.QUEST,t.flags,r,null)}if(r===null)return i;r.push(i)}if(r!==null){let e=new S(S.Op.CONCAT);return e.subs=r.slice(0),e}return new S(S.Op.NO_MATCH)}}return t}static simplify1(e,t,n,r){return n.op===S.Op.EMPTY_MATCH||e===n.op&&(t&h.NON_GREEDY)===(n.flags&h.NON_GREEDY)?n:r!==null&&r.op===e&&(r.flags&h.NON_GREEDY)===(t&h.NON_GREEDY)&&n===r.subs[0]?r:(r=new S(e),r.flags=t,r.subs=[n],r)}},w=class{constructor(e,t){this.sign=e,this.cls=t}},Ne=[48,57],Pe=[9,10,12,13,32,32],Fe=[48,57,65,90,95,95,97,122],Ie=new Map([[`\\d`,new w(1,Ne)],[`\\D`,new w(-1,Ne)],[`\\s`,new w(1,Pe)],[`\\S`,new w(-1,Pe)],[`\\w`,new w(1,Fe)],[`\\W`,new w(-1,Fe)]]),Le=[48,57,65,90,97,122],Re=[65,90,97,122],ze=[0,127],Be=[9,9,32,32],T=[0,31,127,127],E=[48,57],Ve=[33,126],He=[97,122],Ue=[32,126],We=[33,47,58,64,91,96,123,126],Ge=[9,13,32,32],Ke=[65,90],qe=[48,57,65,90,95,95,97,122],Je=[48,57,65,70,97,102],Ye=new Map([[`[:alnum:]`,new w(1,Le)],[`[:^alnum:]`,new w(-1,Le)],[`[:alpha:]`,new w(1,Re)],[`[:^alpha:]`,new w(-1,Re)],[`[:ascii:]`,new w(1,ze)],[`[:^ascii:]`,new w(-1,ze)],[`[:blank:]`,new w(1,Be)],[`[:^blank:]`,new w(-1,Be)],[`[:cntrl:]`,new w(1,T)],[`[:^cntrl:]`,new w(-1,T)],[`[:digit:]`,new w(1,E)],[`[:^digit:]`,new w(-1,E)],[`[:graph:]`,new w(1,Ve)],[`[:^graph:]`,new w(-1,Ve)],[`[:lower:]`,new w(1,He)],[`[:^lower:]`,new w(-1,He)],[`[:print:]`,new w(1,Ue)],[`[:^print:]`,new w(-1,Ue)],[`[:punct:]`,new w(1,We)],[`[:^punct:]`,new w(-1,We)],[`[:space:]`,new w(1,Ge)],[`[:^space:]`,new w(-1,Ge)],[`[:upper:]`,new w(1,Ke)],[`[:^upper:]`,new w(-1,Ke)],[`[:word:]`,new w(1,qe)],[`[:^word:]`,new w(-1,qe)],[`[:xdigit:]`,new w(1,Je)],[`[:^xdigit:]`,new w(-1,Je)]]),Xe=class e{static charClassToString(e,t){let n=`[`;for(let r=0;r<t;r+=2){r>0&&(n+=` `);let t=e[r],i=e[r+1];t===i?n+=`0x${t.toString(16)}`:n+=`0x${t.toString(16)}-0x${i.toString(16)}`}return n+=`]`,n}static cmp(e,t,n,r){let i=e[t]-n;return i===0?r-e[t+1]:i}static qsortIntPair(t,n,r){let i=((n+r)/2|0)&-2,a=t[i],o=t[i+1],s=n,c=r;for(;s<=c;){for(;s<r&&e.cmp(t,s,a,o)<0;)s+=2;for(;c>n&&e.cmp(t,c,a,o)>0;)c-=2;if(s<=c){if(s!==c){let e=t[s];t[s]=t[c],t[c]=e,e=t[s+1],t[s+1]=t[c+1],t[c+1]=e}s+=2,c-=2}}n<c&&e.qsortIntPair(t,n,c),s<r&&e.qsortIntPair(t,s,r)}constructor(e=v.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let e=2;e<this.len;e+=2){let n=this.r[e],r=this.r[e+1];if(n<=this.r[t-1]+1){r>this.r[t-1]&&(this.r[t-1]=r);continue}this.r[t]=n,this.r[t+1]=r,t+=2}return this.len=t,this}appendLiteral(e,t){return(t&h.FOLD_CASE)===0?this.appendRange(e,e):this.appendFoldedRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let r=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=_.MIN_FOLD&&t>=_.MAX_FOLD||t<_.MIN_FOLD||e>_.MAX_FOLD)return this.appendRange(e,t);e<_.MIN_FOLD&&(this.appendRange(e,_.MIN_FOLD-1),e=_.MIN_FOLD),t>_.MAX_FOLD&&(this.appendRange(_.MAX_FOLD+1,t),t=_.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=_.simpleFold(n);e!==n;e=_.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=i+1}return t<=_.MAX_RUNE&&this.appendRange(t,_.MAX_RUNE),this}appendTable(e){for(let t of e){let e=t[0],n=t[1],r=t[2];if(r===1){this.appendRange(e,n);continue}for(let t=e;t<=n;t+=r)this.appendRange(t,t)}return this}appendNegatedTable(e){let t=0;for(let n of e){let e=n[0],r=n[1],i=n[2];if(i===1){t<=e-1&&this.appendRange(t,e-1),t=r+1;continue}for(let n=e;n<=r;n+=i)t<=n-1&&this.appendRange(t,n-1),t=n+1}return t<=_.MAX_RUNE&&this.appendRange(t,_.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){let r=this.r[n],i=this.r[n+1];e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=i+1}return this.len=t,e<=_.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=_.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},Ze=class e{static of(t,n){return new e(t,n)}constructor(e,t){this.first=e,this.second=t}},Qe=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){let e=this.str.codePointAt(this.position);return this.position+=v.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},$e=class e{static ERR_INTERNAL_ERROR=`regexp/syntax: internal error`;static ERR_INVALID_CHAR_RANGE=`invalid character class range`;static ERR_INVALID_ESCAPE=`invalid escape sequence`;static ERR_INVALID_NAMED_CAPTURE=`invalid named capture`;static ERR_INVALID_PERL_OP=`invalid or unsupported Perl syntax`;static ERR_INVALID_REPEAT_OP=`invalid nested repetition operator`;static ERR_INVALID_REPEAT_SIZE=`invalid repeat count`;static ERR_MISSING_BRACKET=`missing closing ]`;static ERR_MISSING_PAREN=`missing closing )`;static ERR_MISSING_REPEAT_ARGUMENT=`missing argument to repetition operator`;static ERR_TRAILING_BACKSLASH=`trailing backslash at end of expression`;static ERR_DUPLICATE_NAMED_CAPTURE=`duplicate capture group name`;static ANY_TABLE(){return[[0,_.MAX_RUNE,1]]}static unicodeTable(t){return t===`Any`?Ze.of(e.ANY_TABLE(),e.ANY_TABLE()):ge.CATEGORIES.has(t)?Ze.of(ge.CATEGORIES.get(t),ge.FOLD_CATEGORIES.get(t)):ge.SCRIPTS.has(t)?Ze.of(ge.SCRIPTS.get(t),ge.FOLD_SCRIPT.get(t)):null}static minFoldRune(e){if(e<_.MIN_FOLD||e>_.MAX_FOLD)return e;let t=e,n=e;for(e=_.simpleFold(e);e!==n;e=_.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===S.Op.EMPTY_MATCH)return null;if(e.op===S.Op.CONCAT&&e.subs.length>0){let t=e.subs[0];return t.op===S.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){let n=new S(S.Op.LITERAL);return n.flags=t,n.runes=v.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt(`{`))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let i;if(!t.lookingAt(`,`))i=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt(`}`))i=-1;else if((i=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt(`}`))return-1;if(t.skip(1),r<0||r>1e3||i===-2||i>1e3||i>=0&&r>i)throw new b(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|i&_.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n!==g.CODES.get(`_`)&&!v.isalnum(n))return!1}return!0}static parseInt(e){let t=e.pos();for(;e.more()&&e.peek()>=g.CODES.get(`0`)&&e.peek()<=g.CODES.get(`9`);)e.skip(1);let n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===g.CODES.get(`0`)?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===S.Op.LITERAL&&e.runes.length===1||e.op===S.Op.CHAR_CLASS||e.op===S.Op.ANY_CHAR_NOT_NL||e.op===S.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case S.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case S.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case S.Op.ANY_CHAR_NOT_NL:return t!==g.CODES.get(`
|
|
19
|
+
`);case S.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case S.Op.ANY_CHAR:break;case S.Op.ANY_CHAR_NOT_NL:e.matchRune(n,g.CODES.get(`
|
|
20
|
+
`))&&(t.op=S.Op.ANY_CHAR);break;case S.Op.CHAR_CLASS:n.op===S.Op.LITERAL?t.runes=new Xe(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Xe(t.runes).appendClass(n.runes).toArray();break;case S.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=S.Op.CHAR_CLASS,t.runes=new Xe().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new b(e.ERR_TRAILING_BACKSLASH);let r=t.pop();bigswitch:switch(r){case g.CODES.get(`1`):case g.CODES.get(`2`):case g.CODES.get(`3`):case g.CODES.get(`4`):case g.CODES.get(`5`):case g.CODES.get(`6`):case g.CODES.get(`7`):if(!t.more()||t.peek()<g.CODES.get(`0`)||t.peek()>g.CODES.get(`7`))break;case g.CODES.get(`0`):{let e=r-g.CODES.get(`0`);for(let n=1;n<3&&!(!t.more()||t.peek()<g.CODES.get(`0`)||t.peek()>g.CODES.get(`7`));n++)e=e*8+t.peek()-g.CODES.get(`0`),t.skip(1);return e}case g.CODES.get(`x`):{if(!t.more())break;if(r=t.pop(),r===g.CODES.get(`{`)){let e=0,n=0;for(;;){if(!t.more())break bigswitch;if(r=t.pop(),r===g.CODES.get(`}`))break;let i=v.unhex(r);if(i<0||(n=n*16+i,n>_.MAX_RUNE))break bigswitch;e++}if(e===0)break bigswitch;return n}let e=v.unhex(r);if(!t.more())break;r=t.pop();let n=v.unhex(r);if(e<0||n<0)break;return e*16+n}case g.CODES.get(`a`):return g.CODES.get(`\x07`);case g.CODES.get(`f`):return g.CODES.get(`\f`);case g.CODES.get(`n`):return g.CODES.get(`
|
|
21
|
+
`);case g.CODES.get(`r`):return g.CODES.get(`\r`);case g.CODES.get(`t`):return g.CODES.get(` `);case g.CODES.get(`v`):return g.CODES.get(`\v`);default:if(!v.isalnum(r))return r;break}throw new b(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new b(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt(`\\`)?e.parseEscape(t):t.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new S(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){let e=this.stack.length,t=e;for(;t>0&&!S.isPseudoOp(this.stack[t-1].op);)t--;let n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===S.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&~h.FOLD_CASE))return null;e.op=S.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&~h.FOLD_CASE}else if(e.op===S.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&_.simpleFold(e.runes[0])===e.runes[2]&&_.simpleFold(e.runes[2])===e.runes[0]||e.op===S.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&_.simpleFold(e.runes[0])===e.runes[1]&&_.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|h.FOLD_CASE))return null;e.op=S.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|h.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let i=this.stack[r-1],a=this.stack[r-2];return i.op!==S.Op.LITERAL||a.op!==S.Op.LITERAL||(i.flags&h.FOLD_CASE)!==(a.flags&h.FOLD_CASE)?!1:(a.runes=e.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=n,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,n){let r=this.newRegexp(S.Op.LITERAL);return r.flags=n,(n&h.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){let t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,r,i,a,o){let s=this.flags;if((s&h.PERL_X)!==0&&(a.more()&&a.lookingAt(`?`)&&(a.skip(1),s^=h.NON_GREEDY),o!==-1))throw new b(e.ERR_INVALID_REPEAT_OP,a.from(o));let c=this.stack.length;if(c===0)throw new b(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let l=this.stack[c-1];if(S.isPseudoOp(l.op))throw new b(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.newRegexp(t);u.min=n,u.max=r,u.flags=s,u.subs=[l],this.stack[c-1]=u}concat(){this.maybeConcat(-1,0);let e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(S.Op.EMPTY_MATCH)):this.push(this.collapse(e,S.Op.CONCAT))}alternate(){let e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(S.Op.NO_MATCH)):this.push(this.collapse(e,S.Op.ALTERNATE))}cleanAlt(e){e.op===S.Op.CHAR_CLASS&&(e.runes=new Xe(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===_.MAX_RUNE?(e.runes=null,e.op=S.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===g.CODES.get(`
|
|
22
|
+
`)-1&&e.runes[2]===g.CODES.get(`
|
|
23
|
+
`)+1&&e.runes[3]===_.MAX_RUNE&&(e.runes=null,e.op=S.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=Array(n).fill(null),i=0;for(let n of e)n.op===t?(r.splice(i,n.subs.length,...n.subs),i+=n.subs.length,this.reuse(n)):r[i++]=n;let a=this.newRegexp(t);if(a.subs=r,t===S.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let e=a;a=a.subs[0],this.reuse(e)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,i=0,a=null,o=0,s=0,c=0;for(let e=0;e<=r;e++){let l=null,u=0,d=0;if(e<r){let r=t[n+e];if(r.op===S.Op.CONCAT&&r.subs.length>0&&(r=r.subs[0]),r.op===S.Op.LITERAL&&(l=r.runes,u=r.runes.length,d=r.flags&h.FOLD_CASE),d===s){let e=0;for(;e<o&&e<u&&a[e]===l[e];)e++;if(e>0){o=e;continue}}}if(e!==c)if(e===c+1)t[i++]=t[n+c];else{let r=this.newRegexp(S.Op.LITERAL);r.flags=s,r.runes=a.slice(0,o);for(let r=c;r<e;r++)t[n+r]=this.removeLeadingString(t[n+r],o);let l=this.collapse(t.slice(n+c,n+e),S.Op.ALTERNATE),u=this.newRegexp(S.Op.CONCAT);u.subs=[r,l],t[i++]=u}c=e,a=l,o=u,s=d}r=i,n=0,c=0,i=0;let l=null;for(let a=0;a<=r;a++){let o=null;if(!(a<r&&(o=e.leadingRegexp(t[n+a]),l!==null&&l.equals(o)&&(e.isCharClass(l)||l.op===S.Op.REPEAT&&l.min===l.max&&e.isCharClass(l.subs[0]))))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let e=l;for(let e=c;e<a;e++){let r=e!==c;t[n+e]=this.removeLeadingRegexp(t[n+e],r)}let r=this.collapse(t.slice(n+c,n+a),S.Op.ALTERNATE),o=this.newRegexp(S.Op.CONCAT);o.subs=[e,r],t[i++]=o}c=a,l=o}}r=i,n=0,c=0,i=0;for(let a=0;a<=r;a++)if(!(a<r&&e.isCharClass(t[n+a]))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let r=c;for(let e=c+1;e<a;e++){let i=t[n+r],a=t[n+e];(i.op<a.op||i.op===a.op&&(i.runes===null?0:i.runes.length)<(a.runes===null?0:a.runes.length))&&(r=e)}let o=t[n+c];t[n+c]=t[n+r],t[n+r]=o;for(let r=c+1;r<a;r++)e.mergeCharClass(t[n+c],t[n+r]),this.reuse(t[n+r]);this.cleanAlt(t[n+c]),t[i++]=t[n+c]}a<r&&(t[i++]=t[n+a]),c=a+1}r=i,n=0,c=0,i=0;for(let e=0;e<r;++e)e+1<r&&t[n+e].op===S.Op.EMPTY_MATCH&&t[n+e+1].op===S.Op.EMPTY_MATCH||(t[i++]=t[n+e]);return r=i,n=0,t.slice(n,r)}removeLeadingString(e,t){if(e.op===S.Op.CONCAT&&e.subs.length>0){let n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===S.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=S.Op.EMPTY_MATCH,e.subs=null;break;case 2:{let t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===S.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=S.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===S.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=S.Op.EMPTY_MATCH,e.subs=S.emptySubs();break;case 1:{let t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(S.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&h.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,i=new Qe(this.wholeRegexp);for(;i.more();){let a=-1;bigswitch:switch(i.peek()){case g.CODES.get(`(`):if((this.flags&h.PERL_X)!==0&&i.lookingAt(`(?`)){this.parsePerlFlags(i);break}this.op(S.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case g.CODES.get(`|`):this.parseVerticalBar(),i.skip(1);break;case g.CODES.get(`)`):this.parseRightParen(),i.skip(1);break;case g.CODES.get(`^`):(this.flags&h.ONE_LINE)===0?this.op(S.Op.BEGIN_LINE):this.op(S.Op.BEGIN_TEXT),i.skip(1);break;case g.CODES.get(`$`):(this.flags&h.ONE_LINE)===0?this.op(S.Op.END_LINE):this.op(S.Op.END_TEXT).flags|=h.WAS_DOLLAR,i.skip(1);break;case g.CODES.get(`.`):(this.flags&h.DOT_NL)===0?this.op(S.Op.ANY_CHAR_NOT_NL):this.op(S.Op.ANY_CHAR),i.skip(1);break;case g.CODES.get(`[`):this.parseClass(i);break;case g.CODES.get(`*`):case g.CODES.get(`+`):case g.CODES.get(`?`):{a=i.pos();let e=null;switch(i.pop()){case g.CODES.get(`*`):e=S.Op.STAR;break;case g.CODES.get(`+`):e=S.Op.PLUS;break;case g.CODES.get(`?`):e=S.Op.QUEST;break}this.repeat(e,n,r,a,i,t);break}case g.CODES.get(`{`):{a=i.pos();let o=e.parseRepeat(i);if(o<0){i.rewindTo(a),this.literal(i.pop());break}n=o>>16,r=(o&_.MAX_BMP)<<16>>16,this.repeat(S.Op.REPEAT,n,r,a,i,t);break}case g.CODES.get(`\\`):{let t=i.pos();if(i.skip(1),(this.flags&h.PERL_X)!==0&&i.more())switch(i.pop()){case g.CODES.get(`A`):this.op(S.Op.BEGIN_TEXT);break bigswitch;case g.CODES.get(`b`):this.op(S.Op.WORD_BOUNDARY);break bigswitch;case g.CODES.get(`B`):this.op(S.Op.NO_WORD_BOUNDARY);break bigswitch;case g.CODES.get(`C`):throw new b(e.ERR_INVALID_ESCAPE,`\\C`);case g.CODES.get(`Q`):{let e=i.rest(),t=e.indexOf(`\\E`);t>=0&&(e=e.substring(0,t)),i.skipString(e),i.skipString(`\\E`);let n=0;for(;n<e.length;){let t=e.codePointAt(n);this.literal(t),n+=v.charCount(t)}break bigswitch}case g.CODES.get(`z`):this.op(S.Op.END_TEXT);break bigswitch;default:i.rewindTo(t);break}let n=this.newRegexp(S.Op.CHAR_CLASS);if(n.flags=this.flags,i.lookingAt(`\\p`)||i.lookingAt(`\\P`)){let e=new Xe;if(this.parseUnicodeClass(i,e)){n.runes=e.toArray(),this.push(n);break bigswitch}}let r=new Xe;if(this.parsePerlClassEscape(i,r)){n.runes=r.toArray(),this.push(n);break bigswitch}i.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(i));break}default:this.literal(i.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new b(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith(`(?P<`)||r.startsWith(`(?<`)){let n=r.charAt(2)===`P`?4:3,i=r.indexOf(`>`);if(i<0)throw new b(e.ERR_INVALID_NAMED_CAPTURE,r);let a=r.substring(n,i);if(t.skipString(a),t.skip(n+1),!e.isValidCaptureName(a))throw new b(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,i+1));let o=this.op(S.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[a])throw new b(e.ERR_DUPLICATE_NAMED_CAPTURE,a);this.namedGroups[a]=this.numCap,o.name=a;return}t.skip(2);let i=this.flags,a=1,o=!1;loop:for(;t.more();){let e=t.pop();switch(e){case g.CODES.get(`i`):i|=h.FOLD_CASE,o=!0;break;case g.CODES.get(`m`):i&=~h.ONE_LINE,o=!0;break;case g.CODES.get(`s`):i|=h.DOT_NL,o=!0;break;case g.CODES.get(`U`):i|=h.NON_GREEDY,o=!0;break;case g.CODES.get(`-`):if(a<0)break loop;a=-1,i=~i,o=!1;break;case g.CODES.get(`:`):case g.CODES.get(`)`):if(a<0){if(!o)break loop;i=~i}e===g.CODES.get(`:`)&&this.op(S.Op.LEFT_PAREN),this.flags=i;return;default:break loop}}throw new b(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(S.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===S.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let e=r;r=n,n=e,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let e=this.stack[t-1],n=this.stack[t-2];if(n.op===S.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new b(e.ERR_INTERNAL_ERROR,`stack underflow`);let t=this.pop(),n=this.pop();if(n.op!==S.Op.LEFT_PAREN)throw new b(e.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=S.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){let n=e.pos();if((this.flags&h.PERL_X)===0||!e.more()||e.pop()!==g.CODES.get(`\\`)||!e.more())return!1;e.pop();let r=e.from(n),i=Ie.has(r)?Ie.get(r):null;return i===null?!1:(t.appendGroup(i,(this.flags&h.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),i=r.indexOf(`:]`);if(i<0)return!1;let a=r.substring(0,i+2);t.skipString(a);let o=Ye.has(a)?Ye.get(a):null;if(o===null)throw new b(e.ERR_INVALID_CHAR_RANGE,a);return n.appendGroup(o,(this.flags&h.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&h.UNICODE_GROUPS)===0||!t.lookingAt(`\\p`)&&!t.lookingAt(`\\P`))return!1;t.skip(1);let i=1,a=t.pop();if(a===g.CODES.get(`P`)&&(i=-1),!t.more())throw t.rewindTo(r),new b(e.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let o;if(a!==g.CODES.get(`{`))o=v.runeToString(a);else{let n=t.rest(),i=n.indexOf(`}`);if(i<0)throw t.rewindTo(r),new b(e.ERR_INVALID_CHAR_RANGE,t.rest());o=n.substring(0,i),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===g.CODES.get(`^`)&&(i=0-i,o=o.substring(1));let s=e.unicodeTable(o);if(s===null)throw new b(e.ERR_INVALID_CHAR_RANGE,t.from(r));let c=s.first,l=s.second;if((this.flags&h.FOLD_CASE)===0||l===null)n.appendTableWithSign(c,i);else{let e=new Xe().appendTable(c).appendTable(l).cleanClass().toArray();n.appendClassWithSign(e,i)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(S.Op.CHAR_CLASS);r.flags=this.flags;let i=new Xe,a=1;t.more()&&t.lookingAt(`^`)&&(a=-1,t.skip(1),(this.flags&h.CLASS_NL)===0&&i.appendRange(g.CODES.get(`
|
|
24
|
+
`),g.CODES.get(`
|
|
25
|
+
`)));let o=!0;for(;!t.more()||t.peek()!==g.CODES.get(`]`)||o;){if(t.more()&&t.lookingAt(`-`)&&(this.flags&h.PERL_X)===0&&!o){let r=t.rest();if(r===`-`||!r.startsWith(`-]`))throw t.rewindTo(n),new b(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let r=t.pos();if(t.lookingAt(`[:`)){if(this.parseNamedClass(t,i))continue;t.rewindTo(r)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(r);let a=e.parseClassChar(t,n),s=a;if(t.more()&&t.lookingAt(`-`)){if(t.skip(1),t.more()&&t.lookingAt(`]`))t.skip(-1);else if(s=e.parseClassChar(t,n),s<a)throw new b(e.ERR_INVALID_CHAR_RANGE,t.from(r))}(this.flags&h.FOLD_CASE)===0?i.appendRange(a,s):i.appendFoldedRange(a,s)}t.skip(1),i.cleanClass(),a<0&&i.negateClass(),r.runes=i.toArray(),this.push(r)}},et=class{constructor(){this.inst=null,this.cap=[]}},tt=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){let t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e=`{`;for(let t=0;t<this.size;t++)t!==0&&(e+=`, `),e+=this.densePcs[t];return e+=`}`,e}},nt=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new tt(n.prog.numInst()),n.q1=new tt(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?v.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new et,t.inst=e,t}freeQueue(e,t=0){let n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,r)));for(let n=t;n<e.size;n++){let t=e.denseThreads[n];t!==null&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){let r=this.re2.cond;if(r===v.EMPTY_ALL||(n===h.ANCHOR_START||n===h.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,o=e.step(t),s=o>>3,c=o&7,l=-1,u=0;o!==Ee.EOF()&&(o=e.step(t+c),l=o>>3,u=o&7);let d;for(d=t===0?v.emptyOpContext(-1,s):e.context(t);;){if(i.isEmpty()){if((r&v.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&l!==this.re2.prefixRune&&e.canCheckPrefix()){let n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),s=o>>3,c=o&7,o=e.step(t+c),l=o>>3,u=o&7}}!this.matched&&(t===0||n===h.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,d,null));let f=t+c;if(d=e.context(f),this.step(i,a,t,f,s,d,n,t===e.endPos()),c===0||this.ncap===0&&this.matched)break;t+=c,s=l,c=u,s!==-1&&(o=e.step(t+c),l=o>>3,u=o&7);let p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,i,a,o,s){let c=this.re2.longest;for(let l=0;l<e.size;l++){let u=e.denseThreads[l];if(u===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<u.cap[0]){this.freeThread(u);continue}let d=u.inst,f=!1;switch(d.op){case C.MATCH:if(o===h.ANCHOR_BOTH&&!s)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(u.cap[1]=n,this.matchcap=u.cap.slice(0,this.ncap)),c||this.freeQueue(e,l+1),this.matched=!0;break;case C.RUNE:f=d.matchRune(i);break;case C.RUNE1:f=i===d.runes[0];break;case C.RUNE_ANY:f=!0;break;case C.RUNE_ANY_NOT_NL:f=i!==g.CODES.get(`
|
|
26
|
+
`);break;default:throw Error(`bad inst`)}f&&(u=this.add(t,d.out,r,u.cap,a,u)),u!==null&&(this.freeThread(u),e.denseThreads[l]=null)}e.clear()}add(e,t,n,r,i,a){if(t===0||e.contains(t))return a;let o=e.add(t),s=this.prog.inst[t];switch(s.op){case C.FAIL:break;case C.ALT:case C.ALT_MATCH:a=this.add(e,s.out,n,r,i,a),a=this.add(e,s.arg,n,r,i,a);break;case C.EMPTY_WIDTH:(s.arg&~i)===0&&(a=this.add(e,s.out,n,r,i,a));break;case C.NOP:a=this.add(e,s.out,n,r,i,a);break;case C.CAPTURE:if(s.arg<this.ncap){let t=r[s.arg];r[s.arg]=n,this.add(e,s.out,n,r,i,null),r[s.arg]=t}else a=this.add(e,s.out,n,r,i,a);break;case C.MATCH:case C.RUNE:case C.RUNE1:case C.RUNE_ANY:case C.RUNE_ANY_NOT_NL:a===null?a=this.alloc(s):a.inst=s,this.ncap>0&&a.cap!==r&&(a.cap=r.slice(0,this.ncap)),e.denseThreads[o]=a,a=null;break;default:throw Error(`unhandled`)}return a}},rt=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}},it=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,h.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,h.POSIX,!0)}static compileImpl(t,n,r){let i=$e.parse(t,n),a=i.maxCap();i=Me.simplify(i);let o=je.compileRegexp(i),s=new e(t,o,a,r),[c,l]=o.prefix();return s.prefixComplete=c,s.prefix=l,s.prefixUTF8=v.stringToUtf8ByteArray(s.prefix),s.prefix.length>0&&(s.prefixRune=s.prefix.codePointAt(0)),s.namedGroups=i.namedGroups,s}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new rt}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=nt.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let i=this.get(),a=!1;i?i.next!==null&&(i=nt.fromMachine(i),a=!0):(i=nt.fromRE2(this),a=!0),i.init(r);let o=i.match(e,t,n)?i.submatches():null;return this.put(i,a),o}match(e){return this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,0)!==null}matchWithGroup(e,t,n,r,i){return e instanceof y||(e=be.utf16(e)),this.matchMachineInput(e,t,n,r,i)}matchMachineInput(e,t,n,r,i){if(t>n)return[!1,null];let a=e.isUTF16Encoding()?x.fromUTF16(e.asCharSequence(),0,n):x.fromUTF8(e.asBytes(),0,n),o=this.doExecute(a,t,r,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(e){return this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,i=0,a=``,o=x.fromUTF16(e),s=0;for(;i<=e.length;){let c=this.doExecute(o,i,h.UNANCHORED,2);if(c===null||c.length===0)break;a+=e.substring(r,c[0]),(c[1]>r||c[0]===0)&&(a+=t(e.substring(c[0],c[1])),s++),r=c[1];let l=o.step(i)&7;if(i+l>c[1]?i+=l:i+1>c[1]?i++:i=c[1],s>=n)break}return a+=e.substring(r),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[],i=e.endPos();t<0&&(t=i+1);let a=0,o=0,s=-1;for(;o<t&&a<=i;){let t=this.doExecute(e,a,h.UNANCHORED,this.prog.numCap);if(t===null||t.length===0)break;let c=!0;if(t[1]===a){t[0]===s&&(c=!1);let n=e.step(a);n<0?a=i+1:a+=n&7}else a=t[1];s=t[1],c&&(r.push(n(this.pad(t))),o++)}return r}findUTF8(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){let t=this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,2);return t===null?``:e.substring(t[0],t[1])}findIndex(e){return this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,2)}findUTF8Submatch(e){let t=this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(x.fromUTF8(e),0,h.UNANCHORED,this.prog.numCap))}findSubmatch(e){let t=this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(x.fromUTF16(e),0,h.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){let n=this.allMatches(x.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return n.length===0?null:n}findAllUTF8Index(e,t){let n=this.allMatches(x.fromUTF8(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAll(e,t){let n=this.allMatches(x.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return n.length===0?null:n}findAllIndex(e,t){let n=this.allMatches(x.fromUTF16(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){let n=this.allMatches(x.fromUTF8(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){let n=this.allMatches(x.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){let n=this.allMatches(x.fromUTF16(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllSubmatchIndex(e,t){let n=this.allMatches(x.fromUTF16(e),t);return n.length===0?null:n}},at=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return v.quoteMeta(e)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new we(`Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH`);let i=h.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(i&=~h.UNICODE_GROUPS);let a=new e(t,n);return a.re2Input=it.compileImpl(r,i,(n&e.LONGEST_MATCH)!==0),a}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw Error(`pattern is null`);if(r==null)throw Error(`re2 is null`);let i=new e(t,n);return i.re2Input=r,i}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=be.utf8(e)),new Te(this,e)}split(e,t=0){let n=this.matcher(e),r=[],i=0,a=0;for(;n.find();){if(a===0&&n.end()===0){a=n.end();continue}if(t>0&&r.length===t-1)break;if(a===n.start()){if(t===0){i+=1,a=n.end();continue}}else for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.start())),a=n.end()}if(t===0&&a!==n.inputLength()){for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.inputLength()))}return(t!==0||r.length===0)&&r.push(n.substring(a,n.inputLength())),r}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}},D=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?`uid:`+this.uid:`anonymous-user`}isEqual(e){return e.uid===this.uid}};D.UNAUTHENTICATED=new D(null),D.GOOGLE_CREDENTIALS=new D(`google-credentials-uid`),D.FIRST_PARTY=new D(`first-party-uid`),D.MOCK_USER=new D(`mock-user`);var ot=`12.15.0`;function st(e){ot=e}var ct=new o(`@firebase/firestore`);function lt(){return ct.logLevel}function O(e,...t){if(ct.logLevel<=c.DEBUG){let n=t.map(ft);ct.debug(`Firestore (${ot}): ${e}`,...n)}}function ut(e,...t){if(ct.logLevel<=c.ERROR){let n=t.map(ft);ct.error(`Firestore (${ot}): ${e}`,...n)}}function dt(e,...t){if(ct.logLevel<=c.WARN){let n=t.map(ft);ct.warn(`Firestore (${ot}): ${e}`,...n)}}function ft(e){if(typeof e==`string`)return e;try{return function(e){return JSON.stringify(e)}(e)}catch{return e}}function k(e,t,n){let r=`Unexpected state`;typeof t==`string`?r=t:n=t,pt(e,r,n)}function pt(e,t,n){let r=`FIRESTORE (${ot}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(n!==void 0)try{r+=` CONTEXT: `+JSON.stringify(n)}catch{r+=` CONTEXT: `+n}throw ut(r),Error(r)}function A(e,t,n,r){let i=`Unexpected state`;typeof n==`string`?i=n:r=n,e||pt(t,i,r)}function j(e,t){return e}var M={OK:`ok`,CANCELLED:`cancelled`,UNKNOWN:`unknown`,INVALID_ARGUMENT:`invalid-argument`,DEADLINE_EXCEEDED:`deadline-exceeded`,NOT_FOUND:`not-found`,ALREADY_EXISTS:`already-exists`,PERMISSION_DENIED:`permission-denied`,UNAUTHENTICATED:`unauthenticated`,RESOURCE_EXHAUSTED:`resource-exhausted`,FAILED_PRECONDITION:`failed-precondition`,ABORTED:`aborted`,OUT_OF_RANGE:`out-of-range`,UNIMPLEMENTED:`unimplemented`,INTERNAL:`internal`,UNAVAILABLE:`unavailable`,DATA_LOSS:`data-loss`},N=class extends m{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}},mt=class{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}},ht=class{constructor(e,t){this.user=t,this.type=`OAuth`,this.headers=new Map,this.headers.set(`Authorization`,`Bearer ${e}`)}},gt=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(D.UNAUTHENTICATED)))}shutdown(){}},_t=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}},vt=class{constructor(e){this.t=e,this.currentUser=D.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){A(this.o===void 0,42304);let n=this.i,r=e=>this.i===n?Promise.resolve():(n=this.i,t(e)),i=new mt;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new mt,e.enqueueRetryable((()=>r(this.currentUser)))};let a=()=>{let t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},o=e=>{O(`FirebaseAuthCredentialsProvider`,`Auth detected`),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(O(`FirebaseAuthCredentialsProvider`,`Auth not yet detected`),i.resolve(),i=new mt)}}),0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i===e?t?(A(typeof t.accessToken==`string`,31837,{l:t}),new ht(t.accessToken,this.currentUser)):null:(O(`FirebaseAuthCredentialsProvider`,`getToken aborted due to token change.`),this.getToken()))):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return A(e===null||typeof e==`string`,2055,{h:e}),new D(e)}},yt=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type=`FirstParty`,this.user=D.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set(`X-Goog-AuthUser`,this.T);let e=this.A();return e&&this.I.set(`Authorization`,e),this.P&&this.I.set(`X-Goog-Iam-Authorization-Token`,this.P),this.I}},bt=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new yt(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(D.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},xt=class{constructor(e){this.value=e,this.type=`AppCheck`,this.headers=new Map,e&&e.length>0&&this.headers.set(`x-firebase-appcheck`,this.value)}},St=class{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,f(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){A(this.o===void 0,3512);let n=e=>{e.error!=null&&O(`FirebaseAppCheckTokenProvider`,`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.m;return this.m=e.token,O(`FirebaseAppCheckTokenProvider`,`Received ${n?`new`:`existing`} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};let r=e=>{O(`FirebaseAppCheckTokenProvider`,`AppCheck detected`),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?r(e):O(`FirebaseAppCheckTokenProvider`,`AppCheck not yet detected`)}}),0)}getToken(){if(this.p)return Promise.resolve(new xt(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(A(typeof e.token==`string`,44558,{tokenResult:e}),this.m=e.token,new xt(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Ct(e){let t=typeof self<`u`&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues==`function`)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}var wt=class{static newId(){let e=``;for(;e.length<20;){let t=Ct(40);for(let n=0;n<t.length;++n)e.length<20&&t[n]<248&&(e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(t[n]%62))}return e}};function P(e,t){return e<t?-1:+(e>t)}function Tt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e.charAt(r),i=t.charAt(r);if(n!==i)return Ot(n)===Ot(i)?P(n,i):Ot(n)?1:-1}return P(e.length,t.length)}var Et=55296,Dt=57343;function Ot(e){let t=e.charCodeAt(0);return t>=Et&&t<=Dt}function kt(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}var At=`__name__`,jt=class e{constructor(e,t,n){t===void 0?t=0:t>e.length&&k(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&k(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(t){return e.comparator(this,t)===0}child(t){let n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((e=>{n.push(e)})):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,n){let r=Math.min(t.length,n.length);for(let i=0;i<r;i++){let r=e.compareSegments(t.get(i),n.get(i));if(r!==0)return r}return P(t.length,n.length)}static compareSegments(t,n){let r=e.isNumericId(t),i=e.isNumericId(n);return r&&!i?-1:!r&&i?1:r&&i?e.extractNumericId(t).compare(e.extractNumericId(n)):Tt(t,n)}static isNumericId(e){return e.startsWith(`__id`)&&e.endsWith(`__`)}static extractNumericId(e){return ae.fromString(e.substring(4,e.length-2))}},F=class e extends jt{construct(t,n,r){return new e(t,n,r)}canonicalString(){return this.toArray().join(`/`)}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join(`/`)}static fromString(...t){let n=[];for(let e of t){if(e.indexOf(`//`)>=0)throw new N(M.INVALID_ARGUMENT,`Invalid segment (${e}). Paths must not contain // in them.`);n.push(...e.split(`/`).filter((e=>e.length>0)))}return new e(n)}static emptyPath(){return new e([])}},Mt=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Nt=class e extends jt{construct(t,n,r){return new e(t,n,r)}static isValidIdentifier(e){return Mt.test(e)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(`.`)}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===At}static keyField(){return new e([At])}static fromServerFormat(t){let n=[],r=``,i=0,a=()=>{if(r.length===0)throw new N(M.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=``},o=!1;for(;i<t.length;){let e=t[i];if(e===`\\`){if(i+1===t.length)throw new N(M.INVALID_ARGUMENT,`Path has trailing escape character: `+t);let e=t[i+1];if(e!==`\\`&&e!==`.`&&e!=="`")throw new N(M.INVALID_ARGUMENT,`Path has invalid escape sequence: `+t);r+=e,i+=2}else e==="`"?(o=!o,i++):e!==`.`||o?(r+=e,i++):(a(),i++)}if(a(),o)throw new N(M.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)}static emptyPath(){return new e([])}},I=class e{constructor(e){this.path=e}static fromPath(t){return new e(F.fromString(t))}static fromName(t){return new e(F.fromString(t).popFirst(5))}static empty(){return new e(F.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&F.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return F.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(t){return new e(new F(t.slice()))}};function Pt(e,t,n){if(!n)throw new N(M.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Ft(e,t,n,r){if(!0===t&&!0===r)throw new N(M.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function It(e){if(!I.isDocumentKey(e))throw new N(M.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Lt(e){return typeof e==`object`&&!!e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Rt(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`string`)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`)return``+e;if(typeof e==`object`){if(e instanceof Array)return`an array`;{let t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:`an object`}}return typeof e==`function`?`a function`:k(12329,{type:typeof e})}function zt(e,t){if(`_delegate`in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new N(M.INVALID_ARGUMENT,`Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?`);{let n=Rt(e);throw new N(M.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function L(e,t){let n={typeString:e};return t&&(n.value=t),n}function Bt(e,t){if(!Lt(e))throw new N(M.INVALID_ARGUMENT,`JSON must be an object`);let n;for(let r in t)if(t[r]){let i=t[r].typeString,a=`value`in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}let o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(a!==void 0&&o!==a.value){n=`Expected '${r}' field to equal '${a.value}'`;break}}if(n)throw new N(M.INVALID_ARGUMENT,n);return!0}var Vt=-62135596800,R=1e6,z=class e{static now(){return e.fromMillis(Date.now())}static fromDate(t){return e.fromMillis(t.getTime())}static fromMillis(t){let n=Math.floor(t/1e3),r=Math.floor((t-1e3*n)*R);return new e(n,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new N(M.INVALID_ARGUMENT,`Timestamp nanoseconds out of range: `+t);if(e<Vt||e>=253402300800)throw new N(M.INVALID_ARGUMENT,`Timestamp seconds out of range: `+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/R}_compareTo(e){return this.seconds===e.seconds?P(this.nanoseconds,e.nanoseconds):P(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return`Timestamp(seconds=`+this.seconds+`, nanoseconds=`+this.nanoseconds+`)`}toJSON(){return{type:e._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(Bt(t,e._jsonSchema))return new e(t.seconds,t.nanoseconds)}valueOf(){let e=this.seconds-Vt;return String(e).padStart(12,`0`)+`.`+String(this.nanoseconds).padStart(9,`0`)}};z._jsonSchemaVersion=`firestore/timestamp/1.0`,z._jsonSchema={type:L(`string`,z._jsonSchemaVersion),seconds:L(`number`),nanoseconds:L(`number`)};var B=class e{static fromTimestamp(t){return new e(t)}static min(){return new e(new z(0,0))}static max(){return new e(new z(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return`SnapshotVersion(`+this.timestamp.toString()+`)`}toTimestamp(){return this.timestamp}},Ht=-1,Ut=class{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}};Ut.UNKNOWN_ID=-1;function Wt(e,t){let n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1;return new Kt(B.fromTimestamp(r===1e9?new z(n+1,0):new z(n,r)),I.empty(),t)}function Gt(e){return new Kt(e.readTime,e.key,Ht)}var Kt=class e{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new e(B.min(),I.empty(),Ht)}static max(){return new e(B.max(),I.empty(),Ht)}};function qt(e,t){let n=e.readTime.compareTo(t.readTime);return n===0?(n=I.comparator(e.documentKey,t.documentKey),n===0?P(e.largestBatchId,t.largestBatchId):n):n}var Jt=`The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.`,Yt=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function Xt(e){if(e.code!==M.FAILED_PRECONDITION||e.message!==Jt)throw e;O(`LocalStore`,`Unexpectedly lost primary lease`)}var V=class e{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(t,n){return this.callbackAttached&&k(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(((e,r)=>{this.nextCallback=n=>{this.wrapSuccess(t,n).next(e,r)},this.catchCallback=t=>{this.wrapFailure(n,t).next(e,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(t){try{let n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}wrapSuccess(t,n){return t?this.wrapUserFunction((()=>t(n))):e.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction((()=>t(n))):e.reject(n)}static resolve(t){return new e(((e,n)=>{e(t)}))}static reject(t){return new e(((e,n)=>{n(t)}))}static waitFor(t){return new e(((e,n)=>{let r=0,i=0,a=!1;t.forEach((t=>{++r,t.next((()=>{++i,a&&i===r&&e()}),(e=>n(e)))})),a=!0,i===r&&e()}))}static or(t){let n=e.resolve(!1);for(let r of t)n=n.next((t=>t?e.resolve(t):r()));return n}static forEach(e,t){let n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(t,n){return new e(((e,r)=>{let i=t.length,a=Array(i),o=0;for(let s=0;s<i;s++){let c=s;n(t[c]).next((t=>{a[c]=t,++o,o===i&&e(a)}),(e=>r(e)))}}))}static doWhile(t,n){return new e(((e,r)=>{let i=()=>{!0===t()?n().next((()=>{i()}),r):e()};i()}))}};function Zt(e){let t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(`.`).slice(0,2).join(`.`):`-1`;return Number(n)}function Qt(e){return e.name===`IndexedDbTransactionError`}var $t=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};$t.ce=-1;var en=-1;function tn(e){return e==null}function nn(e){return e===0&&1/e==-1/0}function rn(e){return typeof e==`number`&&Number.isInteger(e)&&!nn(e)&&e<=2**53-1&&e>=-(2**53-1)}function an(e){return typeof e==`string`}var on=``;function sn(e){let t=``;for(let n=0;n<e.length;n++)t.length>0&&(t=ln(t)),t=cn(e.get(n),t);return ln(t)}function cn(e,t){let n=t,r=e.length;for(let t=0;t<r;t++){let r=e.charAt(t);switch(r){case`\0`:n+=``;break;case on:n+=``;break;default:n+=r}}return n}function ln(e){return e+``}var un=class e{constructor(e,t){this.comparator=e,this.root=t||fn.EMPTY}insert(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,fn.BLACK,null,null))}remove(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,fn.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let r=this.comparator(e,n.key);if(r===0)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){let e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(`, `)}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new dn(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new dn(this.root,e,this.comparator,!1)}getReverseIterator(){return new dn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new dn(this.root,e,this.comparator,!0)}},dn=class{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(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(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},fn=class e{constructor(t,n,r,i,a){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??e.EMPTY,this.right=a??e.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,r,i,a){return new e(t??this.key,n??this.value,r??this.color,i??this.left,a??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}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(e,t,n){let r=this,i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):i===0?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return e.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(t,i.key)===0){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){let t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return 2**this.check()<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw k(43730,{key:this.key,value:this.value});if(this.right.isRed())throw k(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw k(27949);return e+ +!this.isRed()}};fn.EMPTY=null,fn.RED=!0,fn.BLACK=!1,fn.EMPTY=new class{constructor(){this.size=0}get key(){throw k(57766)}get value(){throw k(16141)}get color(){throw k(16727)}get left(){throw k(29726)}get right(){throw k(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new fn(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var pn=class e{constructor(e){this.comparator=e,this.data=new un(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=t===void 0?this.data.getIterator():this.data.getIteratorFrom(t);n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new mn(this.data.getIterator())}getIteratorFrom(e){return new mn(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.data.getIterator(),r=t.data.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(this.comparator(e,t)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((t=>{e.push(t)})),e}toString(){let e=[];return this.forEach((t=>e.push(t))),`SortedSet(`+e.toString()+`)`}copy(t){let n=new e(this.comparator);return n.data=t,n}},mn=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}},H=class e{constructor(e){this.fields=e,e.sort(Nt.comparator)}static empty(){return new e([])}unionWith(t){let n=new pn(Nt.comparator);for(let e of this.fields)n=n.add(e);for(let e of t)n=n.add(e);return new e(n.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return kt(this.fields,e.fields,((e,t)=>e.isEqual(t)))}};function hn(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function gn(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function _n(e,t){let n=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t(e[r],r,e));return n}function vn(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var yn=class extends Error{constructor(){super(...arguments),this.name=`Base64DecodeError`}},bn=class e{constructor(e){this.binaryString=e}static fromBase64String(t){let n=function(e){try{return atob(e)}catch(e){throw typeof DOMException<`u`&&e instanceof DOMException?new yn(`Invalid base64 string: `+e):e}}(t);return new e(n)}static fromUint8Array(t){let n=function(e){let t=``;for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return P(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};bn.EMPTY_BYTE_STRING=new bn(``);var xn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Sn(e){if(A(!!e,39018),typeof e==`string`){let t=0,n=xn.exec(e);if(A(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+`000000000`).substr(0,9),t=Number(e)}let r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:U(e.seconds),nanos:U(e.nanos)}}function U(e){return typeof e==`number`?e:typeof e==`string`?Number(e):0}function Cn(e){return typeof e==`string`?bn.fromBase64String(e):bn.fromUint8Array(e)}var wn=`server_timestamp`,Tn=`__type__`,En=`__previous_value__`,Dn=`__local_write_time__`;function On(e){return(e?.mapValue?.fields||{})[Tn]?.stringValue===wn}function kn(e){let t=e.mapValue.fields[En];return On(t)?kn(t):t}function An(e){let t=Sn(e.mapValue.fields[Dn].timestampValue);return new z(t.seconds,t.nanos)}var jn=class{constructor(e,t,n,r,i,a,o,s,c,l,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=o,this.longPollingOptions=s,this.useFetchStreams=c,this.isUsingEmulator=l,this.apiKey=u}},Mn=`(default)`,Nn=class e{constructor(e,t){this.projectId=e,this.database=t||Mn}static empty(){return new e(``,``)}get isDefaultDatabase(){return this.database===Mn}isEqual(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}};function Pn(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,[`projectId`]))throw new N(M.INVALID_ARGUMENT,`"projectId" not provided in firebase.initializeApp.`);return new Nn(e.options.projectId,t)}var Fn=`__type__`,In=`__max__`,Ln={mapValue:{fields:{__type__:{stringValue:In}}}},Rn=`__vector__`,zn=`value`,Bn={nullValue:`NULL_VALUE`},Vn={booleanValue:!0},W={booleanValue:!1};function G(e){return`nullValue`in e?0:`booleanValue`in e?1:`integerValue`in e||`doubleValue`in e?2:`timestampValue`in e?3:`stringValue`in e?5:`bytesValue`in e?6:`referenceValue`in e?7:`geoPointValue`in e?8:`arrayValue`in e?9:`mapValue`in e?On(e)?4:ar(e)?9007199254740991:nr(e)?10:11:k(28295,{value:e})}function Hn(e,t,n){if(e===t)return!0;let r=G(e);if(r!==G(t))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return An(e).isEqual(An(t));case 3:return function(e,t){if(typeof e.timestampValue==`string`&&typeof t.timestampValue==`string`&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=Sn(e.timestampValue),r=Sn(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Cn(e.bytesValue).isEqual(Cn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return U(e.geoPointValue.latitude)===U(t.geoPointValue.latitude)&&U(e.geoPointValue.longitude)===U(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if(`integerValue`in e&&`integerValue`in t)return U(e.integerValue)===U(t.integerValue);let r,i;if(`doubleValue`in e&&`doubleValue`in t)r=U(e.doubleValue),i=U(t.doubleValue);else{if(!n?.Ee)return!1;r=U(e.integerValue??e.doubleValue),i=U(t.integerValue??t.doubleValue)}return r===i?!!n?.he||nn(r)===nn(i):!!(n===void 0||n.Te)&&isNaN(r)&&isNaN(i)}(e,t,n);case 9:return kt(e.arrayValue.values||[],t.arrayValue.values||[],((e,t)=>Hn(e,t,n)));case 10:case 11:return function(e,t,n){let r=e.mapValue.fields||{},i=t.mapValue.fields||{};if(hn(r)!==hn(i))return!1;for(let e in r)if(r.hasOwnProperty(e)&&(i[e]===void 0||!Hn(r[e],i[e],n)))return!1;return!0}(e,t,n);default:return k(52216,{left:e})}}function Un(e,t){return(e.values||[]).find((e=>Hn(e,t)))!==void 0}function K(e,t){if(e===t)return 0;let n=G(e),r=G(t);if(n!==r)return P(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return P(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=U(e.integerValue||e.doubleValue),r=U(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Wn(e.timestampValue,t.timestampValue);case 4:return Wn(An(e),An(t));case 5:return Tt(e.stringValue,t.stringValue);case 6:return function(e,t){let n=Cn(e),r=Cn(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split(`/`),r=t.split(`/`);for(let e=0;e<n.length&&e<r.length;e++){let t=P(n[e],r[e]);if(t!==0)return t}return P(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=P(U(e.latitude),U(t.latitude));return n===0?P(U(e.longitude),U(t.longitude)):n}(e.geoPointValue,t.geoPointValue);case 9:return Gn(e.arrayValue,t.arrayValue);case 10:return function(e,t){let n=e.fields||{},r=t.fields||{},i=n[zn]?.arrayValue,a=r[zn]?.arrayValue,o=P(i?.values?.length||0,a?.values?.length||0);return o===0?Gn(i,a):o}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Ln.mapValue&&t===Ln.mapValue)return 0;if(e===Ln.mapValue)return 1;if(t===Ln.mapValue)return-1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(let e=0;e<r.length&&e<a.length;++e){let t=Tt(r[e],a[e]);if(t!==0)return t;let o=K(n[r[e]],i[a[e]]);if(o!==0)return o}return P(r.length,a.length)}(e.mapValue,t.mapValue);default:throw k(23264,{Pe:n})}}function Wn(e,t){if(typeof e==`string`&&typeof t==`string`&&e.length===t.length)return P(e,t);let n=Sn(e),r=Sn(t),i=P(n.seconds,r.seconds);return i===0?P(n.nanos,r.nanos):i}function Gn(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=K(n[e],r[e]);if(t!==void 0&&t!==0)return t}return P(n.length,r.length)}function Kn(e){return qn(e)}function qn(e){return`nullValue`in e?`null`:`booleanValue`in e?``+e.booleanValue:`integerValue`in e?``+e.integerValue:`doubleValue`in e?``+e.doubleValue:`timestampValue`in e?function(e){let t=Sn(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):`stringValue`in e?e.stringValue:`bytesValue`in e?function(e){return Cn(e).toBase64()}(e.bytesValue):`referenceValue`in e?function(e){return I.fromName(e).toString()}(e.referenceValue):`geoPointValue`in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):`arrayValue`in e?function(e){let t=`[`,n=!0;for(let r of e.values||[])n?n=!1:t+=`,`,t+=qn(r);return t+`]`}(e.arrayValue):`mapValue`in e?function(e){let t=Object.keys(e.fields||{}).sort(),n=`{`,r=!0;for(let i of t)r?r=!1:n+=`,`,n+=`${i}:${qn(e.fields[i])}`;return n+`}`}(e.mapValue):k(61005,{value:e})}function Jn(e){switch(G(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let t=kn(e);return t?16+Jn(t):16;case 5:return 2*e.stringValue.length;case 6:return Cn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce(((e,t)=>e+Jn(t)),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return gn(e.fields,((e,n)=>{t+=e.length+Jn(n)})),t}(e.mapValue);default:throw k(13486,{value:e})}}function Yn(e){return!!e&&`integerValue`in e}function Xn(e){return!!e&&`doubleValue`in e}function Zn(e){return Yn(e)||Xn(e)}function Qn(e){return!!e&&`arrayValue`in e}function $n(e){return!!e&&`nullValue`in e}function er(e){return!!e&&`doubleValue`in e&&isNaN(Number(e.doubleValue))}function tr(e){return!!e&&`mapValue`in e}function nr(e){return(e?.mapValue?.fields||{})[Fn]?.stringValue===Rn}function rr(e){return(e?.mapValue?.fields||{})[zn]?.arrayValue}function ir(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&typeof e.timestampValue==`object`)return{timestampValue:{...e.timestampValue}};if(e.mapValue){let t={mapValue:{fields:{}}};return gn(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=ir(n))),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=ir(e.arrayValue.values[n]);return t}return{...e}}function ar(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===In}var or=class e{constructor(e){this.value=e}static empty(){return new e({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!tr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ir(t)}setAll(e){let t=Nt.emptyPath(),n={},r=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=ir(e):r.push(i.lastSegment())}));let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());tr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Hn(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];tr(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){gn(t,((t,n)=>e[t]=n));for(let t of n)delete e[t]}clone(){return new e(ir(this.value))}};function sr(e){let t=[];return gn(e.fields,((e,n)=>{let r=new Nt([e]);if(tr(n)){let e=sr(n.mapValue).fields;if(e.length===0)t.push(r);else for(let n of e)t.push(r.child(n))}else t.push(r)})),new H(t)}function cr(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:`NaN`};if(t===1/0)return{doubleValue:`Infinity`};if(t===-1/0)return{doubleValue:`-Infinity`}}return{doubleValue:nn(t)?`-0`:t}}function lr(e){return{integerValue:``+e}}function ur(e,t,n){return Number.isInteger(t)&&n?.preferIntegers||rn(t)?lr(t):cr(e,t)}var dr=class{constructor(){this._=void 0}};function fr(e,t,n){return e instanceof hr?function(e,t){let n={fields:{[Tn]:{stringValue:wn},[Dn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&On(t)&&(t=kn(t)),t&&(n.fields[En]=t),{mapValue:n}}(n,t):e instanceof gr?_r(e,t):e instanceof vr?yr(e,t):e instanceof xr?function(e,t){let n=mr(e,t),r=Tr(n)+Tr(e.Re);return Yn(n)&&Yn(e.Re)?lr(r):cr(e.serializer,r)}(e,t):e instanceof Sr?function(e,t){return wr(e,t,Math.min)}(e,t):e instanceof Cr?function(e,t){return wr(e,t,Math.max)}(e,t):void 0}function pr(e,t,n){return e instanceof gr?_r(e,t):e instanceof vr?yr(e,t):n}function mr(e,t){return e instanceof xr?Zn(t)?t:{integerValue:0}:null}var hr=class extends dr{},gr=class extends dr{constructor(e){super(),this.elements=e}};function _r(e,t){let n=Er(t);for(let t of e.elements)n.some((e=>Hn(e,t)))||n.push(t);return{arrayValue:{values:n}}}var vr=class extends dr{constructor(e){super(),this.elements=e}};function yr(e,t){let n=Er(t);for(let t of e.elements)n=n.filter((e=>!Hn(e,t)));return{arrayValue:{values:n}}}var br=class extends dr{constructor(e,t){super(),this.serializer=e,this.Re=t}},xr=class extends br{},Sr=class extends br{},Cr=class extends br{};function wr(e,t,n){if(!Zn(t))return e.Re;let r=n(Tr(t),Tr(e.Re));return Yn(t)&&Yn(e.Re)?lr(r):cr(e.serializer,r)}function Tr(e){return U(e.integerValue||e.doubleValue)}function Er(e){return Qn(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var Dr=class{constructor(e,t){this.field=e,this.transform=t}};function Or(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof gr&&t instanceof gr||e instanceof vr&&t instanceof vr?kt(e.elements,t.elements,Hn):e instanceof xr&&t instanceof xr||e instanceof Sr&&t instanceof Sr||e instanceof Cr&&t instanceof Cr?Hn(e.Re,t.Re):e instanceof hr&&t instanceof hr}(e.transform,t.transform)}var kr=class{constructor(e,t){this.version=e,this.transformResults=t}},Ar=class e{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new e}static exists(t){return new e(void 0,t)}static updateTime(t){return new e(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function jr(e,t){return e.updateTime===void 0?e.exists===void 0||e.exists===t.isFoundDocument():t.isFoundDocument()&&t.version.isEqual(e.updateTime)}var Mr=class{};function Nr(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new Ur(e.key,Ar.none()):new Rr(e.key,e.data,Ar.none());{let n=e.data,r=or.empty(),i=new pn(Nt.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);t===null&&e.length>1&&(e=e.popLast(),t=n.field(e)),t===null?r.delete(e):r.set(e,t),i=i.add(e)}return new zr(e.key,r,new H(i.toArray()),Ar.none())}}function Pr(e,t,n){e instanceof Rr?function(e,t,n){let r=e.value.clone(),i=Vr(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof zr?function(e,t,n){if(!jr(e.precondition,t))return void t.convertToUnknownDocument(n.version);let r=Vr(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Br(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Fr(e,t,n,r){return e instanceof Rr?function(e,t,n,r){if(!jr(e.precondition,t))return n;let i=e.value.clone(),a=Hr(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof zr?function(e,t,n,r){if(!jr(e.precondition,t))return n;let i=Hr(e.fieldTransforms,r,t),a=t.data;return a.setAll(Br(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),n===null?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return jr(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Ir(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=mr(r.transform,e||null);i!=null&&(n===null&&(n=or.empty()),n.set(r.field,i))}return n||null}function Lr(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return e===void 0&&t===void 0||!(!e||!t)&&kt(e,t,((e,t)=>Or(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var Rr=class extends Mr{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}},zr=class extends Mr{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function Br(e){let t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){let r=e.data.field(n);t.set(n,r)}})),t}function Vr(e,t,n){let r=new Map;A(e.length===n.length,32656,{Ie:n.length,Ae:e.length});for(let i=0;i<n.length;i++){let a=e[i],o=a.transform,s=t.data.field(a.field);r.set(a.field,pr(o,s,n[i]))}return r}function Hr(e,t,n){let r=new Map;for(let i of e){let e=i.transform,a=n.data.field(i.field);r.set(i.field,fr(e,a,t))}return r}var Ur=class extends Mr{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Wr=class extends Mr{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}},Gr=class{constructor(e,t){this.position=e,this.inclusive=t}};function Kr(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let a=t[i],o=e.position[i];if(r=a.field.isKeyField()?I.comparator(I.fromName(o.referenceValue),n.key):K(o,n.data.field(a.field)),a.dir===`desc`&&(r*=-1),r!==0)break}return r}function qr(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Hn(e.position[n],t.position[n]))return!1;return!0}var Jr=class{},Yr=class e extends Jr{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(t,n,r){return t.isKeyField()?n===`in`||n===`not-in`?this.createKeyFieldInFilter(t,n,r):new ri(t,n,r):n===`array-contains`?new si(t,r):n===`in`?new ci(t,r):n===`not-in`?new li(t,r):n===`array-contains-any`?new ui(t,r):new e(t,n,r)}static createKeyFieldInFilter(e,t,n){return t===`in`?new ii(e,n):new ai(e,n)}matches(e){let t=e.data.field(this.field);return this.op===`!=`?t!==null&&t.nullValue===void 0&&this.matchesComparison(K(t,this.value)):t!==null&&G(this.value)===G(t)&&this.matchesComparison(K(t,this.value))}matchesComparison(e){switch(this.op){case`<`:return e<0;case`<=`:return e<=0;case`==`:return e===0;case`!=`:return e!==0;case`>`:return e>0;case`>=`:return e>=0;default:return k(47266,{operator:this.op})}}isInequality(){return[`<`,`<=`,`>`,`>=`,`!=`,`not-in`].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},Xr=class e extends Jr{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(t,n){return new e(t,n)}matches(e){return Zr(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}};function Zr(e){return e.op===`and`}function Qr(e){return $r(e)&&Zr(e)}function $r(e){for(let t of e.filters)if(t instanceof Xr)return!1;return!0}function ei(e){if(e instanceof Yr)return e.field.canonicalString()+e.op.toString()+Kn(e.value);if(Qr(e))return e.filters.map((e=>ei(e))).join(`,`);{let t=e.filters.map((e=>ei(e))).join(`,`);return`${e.op}(${t})`}}function ti(e,t){return e instanceof Yr?function(e,t){return t instanceof Yr&&e.op===t.op&&e.field.isEqual(t.field)&&Hn(e.value,t.value)}(e,t):e instanceof Xr?function(e,t){return t instanceof Xr&&e.op===t.op&&e.filters.length===t.filters.length?e.filters.reduce(((e,n,r)=>e&&ti(n,t.filters[r])),!0):!1}(e,t):void k(19439)}function ni(e){return e instanceof Yr?function(e){return`${e.field.canonicalString()} ${e.op} ${Kn(e.value)}`}(e):e instanceof Xr?function(e){return e.op.toString()+` {`+e.getFilters().map(ni).join(` ,`)+`}`}(e):`Filter`}var ri=class extends Yr{constructor(e,t,n){super(e,t,n),this.key=I.fromName(n.referenceValue)}matches(e){let t=I.comparator(e.key,this.key);return this.matchesComparison(t)}},ii=class extends Yr{constructor(e,t){super(e,`in`,t),this.keys=oi(`in`,t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}},ai=class extends Yr{constructor(e,t){super(e,`not-in`,t),this.keys=oi(`not-in`,t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}};function oi(e,t){return(t.arrayValue?.values||[]).map((e=>I.fromName(e.referenceValue)))}var si=class extends Yr{constructor(e,t){super(e,`array-contains`,t)}matches(e){let t=e.data.field(this.field);return Qn(t)&&Un(t.arrayValue,this.value)}},ci=class extends Yr{constructor(e,t){super(e,`in`,t)}matches(e){let t=e.data.field(this.field);return t!==null&&Un(this.value.arrayValue,t)}},li=class extends Yr{constructor(e,t){super(e,`not-in`,t)}matches(e){if(Un(this.value.arrayValue,{nullValue:`NULL_VALUE`}))return!1;let t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Un(this.value.arrayValue,t)}},ui=class extends Yr{constructor(e,t){super(e,`array-contains-any`,t)}matches(e){let t=e.data.field(this.field);return!(!Qn(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Un(this.value.arrayValue,e)))}},di=class{constructor(e,t=`asc`){this.field=e,this.dir=t}};function fi(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var pi=class e{constructor(e,t,n,r,i,a,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=a,this.documentState=o}static newInvalidDocument(t){return new e(t,0,B.min(),B.min(),B.min(),or.empty(),0)}static newFoundDocument(t,n,r,i){return new e(t,1,n,B.min(),r,i,0)}static newNoDocument(t,n){return new e(t,2,n,B.min(),B.min(),or.empty(),0)}static newUnknownDocument(t,n){return new e(t,3,n,B.min(),B.min(),or.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(B.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=or.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=or.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=B.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}},mi=class{constructor(e,t=null,n=[],r=[],i=null,a=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=a,this.endAt=o,this.de=null}};function hi(e,t=null,n=[],r=[],i=null,a=null,o=null){return new mi(e,t,n,r,i,a,o)}function gi(e){let t=j(e);if(t.de===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+=`|cg:`+t.collectionGroup),e+=`|f:`,e+=t.filters.map((e=>ei(e))).join(`,`),e+=`|ob:`,e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(`,`),tn(t.limit)||(e+=`|l:`,e+=t.limit),t.startAt&&(e+=`|lb:`,e+=t.startAt.inclusive?`b:`:`a:`,e+=t.startAt.position.map((e=>Kn(e))).join(`,`)),t.endAt&&(e+=`|ub:`,e+=t.endAt.inclusive?`a:`:`b:`,e+=t.endAt.position.map((e=>Kn(e))).join(`,`)),t.de=e}return t.de}function _i(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!fi(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!ti(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!qr(e.startAt,t.startAt)&&qr(e.endAt,t.endAt)}function vi(e){return!!e.isCorePipeline}var yi=class{constructor(e,t=null,n=[],r=[],i=null,a=`F`,o=null,s=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=a,this.startAt=o,this.endAt=s,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}};function bi(e,t,n,r,i,a,o,s){return new yi(e,t,n,r,i,a,o,s)}function xi(e){return new yi(e)}function Si(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function Ci(e){return I.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}function wi(e){return e.collectionGroup!==null}function Ti(e){let t=j(e);if(t.fe===null){t.fe=[];let e=new Set;for(let n of t.explicitOrderBy)t.fe.push(n),e.add(n.field.canonicalString());let n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:`asc`;(function(e){let t=new pn(Nt.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t})(t).forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.fe.push(new di(r,n))})),e.has(Nt.keyField().canonicalString())||t.fe.push(new di(Nt.keyField(),n))}return t.fe}function Ei(e){let t=j(e);return t.me||=Di(t,Ti(e)),t.me}function Di(e,t){if(e.limitType===`F`)return hi(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{let t=e.dir===`desc`?`asc`:`desc`;return new di(e.field,t)}));let n=e.endAt?new Gr(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Gr(e.startAt.position,e.startAt.inclusive):null;return hi(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function Oi(e,t,n){return new yi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function ki(e,t){return _i(Ei(e),Ei(t))&&e.limitType===t.limitType}function Ai(e){return`Query(target=${function(e){let t=e.path.canonicalString();return e.collectionGroup!==null&&(t+=` collectionGroup=`+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>ni(e))).join(`, `)}]`),tn(e.limit)||(t+=`, limit: `+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(`, `)}]`),e.startAt&&(t+=`, startAt: `,t+=e.startAt.inclusive?`b:`:`a:`,t+=e.startAt.position.map((e=>Kn(e))).join(`,`)),e.endAt&&(t+=`, endAt: `,t+=e.endAt.inclusive?`a:`:`b:`,t+=e.endAt.position.map((e=>Kn(e))).join(`,`)),`Target(${t})`}(Ei(e))}; limitType=${e.limitType})`}function ji(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return e.collectionGroup===null?I.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n):t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n)}(e,t)&&function(e,t){for(let n of Ti(e))if(!n.field.isKeyField()&&t.data.field(n.field)===null)return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){let r=Kr(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Ti(e),t)||e.endAt&&!function(e,t,n){let r=Kr(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Ti(e),t))}(e,t)}function Mi(e){return(t,n)=>{let r=!1;for(let i of Ti(e)){let e=Ni(i,t,n);if(e!==0)return e;r||=i.field.isKeyField()}return 0}}function Ni(e,t,n){let r=e.field.isKeyField()?I.comparator(t.key,n.key):function(e,t,n){let r=t.data.field(e),i=n.data.field(e);return r!==null&&i!==null?K(r,i):k(42886)}(e.field,t,n);switch(e.dir){case`asc`:return r;case`desc`:return-1*r;default:return k(19790,{direction:e.dir})}}var q,J;function Pi(e){switch(e){case M.OK:return k(64938);case M.CANCELLED:case M.UNKNOWN:case M.DEADLINE_EXCEEDED:case M.RESOURCE_EXHAUSTED:case M.INTERNAL:case M.UNAVAILABLE:case M.UNAUTHENTICATED:return!1;case M.INVALID_ARGUMENT:case M.NOT_FOUND:case M.ALREADY_EXISTS:case M.PERMISSION_DENIED:case M.FAILED_PRECONDITION:case M.ABORTED:case M.OUT_OF_RANGE:case M.UNIMPLEMENTED:case M.DATA_LOSS:return!0;default:return k(15467,{code:e})}}function Fi(e){if(e===void 0)return ut(`GRPC error has no .code`),M.UNKNOWN;switch(e){case q.OK:return M.OK;case q.CANCELLED:return M.CANCELLED;case q.UNKNOWN:return M.UNKNOWN;case q.DEADLINE_EXCEEDED:return M.DEADLINE_EXCEEDED;case q.RESOURCE_EXHAUSTED:return M.RESOURCE_EXHAUSTED;case q.INTERNAL:return M.INTERNAL;case q.UNAVAILABLE:return M.UNAVAILABLE;case q.UNAUTHENTICATED:return M.UNAUTHENTICATED;case q.INVALID_ARGUMENT:return M.INVALID_ARGUMENT;case q.NOT_FOUND:return M.NOT_FOUND;case q.ALREADY_EXISTS:return M.ALREADY_EXISTS;case q.PERMISSION_DENIED:return M.PERMISSION_DENIED;case q.FAILED_PRECONDITION:return M.FAILED_PRECONDITION;case q.ABORTED:return M.ABORTED;case q.OUT_OF_RANGE:return M.OUT_OF_RANGE;case q.UNIMPLEMENTED:return M.UNIMPLEMENTED;case q.DATA_LOSS:return M.DATA_LOSS;default:return k(39323,{code:e})}}(J=q||={})[J.OK=0]=`OK`,J[J.CANCELLED=1]=`CANCELLED`,J[J.UNKNOWN=2]=`UNKNOWN`,J[J.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,J[J.DEADLINE_EXCEEDED=4]=`DEADLINE_EXCEEDED`,J[J.NOT_FOUND=5]=`NOT_FOUND`,J[J.ALREADY_EXISTS=6]=`ALREADY_EXISTS`,J[J.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,J[J.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,J[J.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,J[J.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,J[J.ABORTED=10]=`ABORTED`,J[J.OUT_OF_RANGE=11]=`OUT_OF_RANGE`,J[J.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,J[J.INTERNAL=13]=`INTERNAL`,J[J.UNAVAILABLE=14]=`UNAVAILABLE`,J[J.DATA_LOSS=15]=`DATA_LOSS`;var Ii=class{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return n.length===1?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){gn(this.inner,((t,n)=>{for(let[t,r]of n)e(t,r)}))}isEmpty(){return vn(this.inner)}size(){return this.innerSize}},Li=new un(I.comparator);function Ri(){return Li}var zi=new un(I.comparator);function Bi(...e){let t=zi;for(let n of e)t=t.insert(n.key,n);return t}function Vi(e){let t=zi;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function Hi(){return Wi()}function Ui(){return Wi()}function Wi(){return new Ii((e=>e.toString()),((e,t)=>e.isEqual(t)))}var Gi=new un(I.comparator),Ki=new pn(I.comparator);function qi(...e){let t=Ki;for(let n of e)t=t.add(n);return t}var Ji=new pn(P);function Yi(){return Ji}new ae([4294967295,4294967295],0);var Xi=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function Zi(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,``).replace(`Z`,``)}.${(`000000000`+t.nanoseconds).slice(-9)}Z`:{seconds:``+t.seconds,nanos:t.nanoseconds}}function Qi(e){let t=Sn(e);return new z(t.seconds,t.nanos)}function $i(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function ea(e,t){return Zi(e,t.toTimestamp())}function ta(e){return A(!!e,49232),B.fromTimestamp(Qi(e))}function na(e,t){return ra(e,t).canonicalString()}function ra(e,t){let n=function(e){return new F([`projects`,e.projectId,`databases`,e.database])}(e).child(`documents`);return t===void 0?n:n.child(t)}function ia(e){let t=F.fromString(e);return A(ga(t),10190,{key:t.toString()}),t}function aa(e,t){return na(e.databaseId,t.path)}function oa(e){let t=ia(e);return t.length===4?F.emptyPath():ca(t)}function sa(e){return new F([`projects`,e.databaseId.projectId,`databases`,e.databaseId.database]).canonicalString()}function ca(e){return A(e.length>4&&e.get(4)===`documents`,29091,{key:e.toString()}),e.popFirst(5)}function la(e,t,n){return{name:aa(e,t),fields:n.value.mapValue.fields}}function ua(e,t){let n;if(t instanceof Rr)n={update:la(e,t.key,t.value)};else if(t instanceof Ur)n={delete:aa(e,t.key)};else if(t instanceof zr)n={update:la(e,t.key,t.data),updateMask:ha(t.fieldMask)};else{if(!(t instanceof Wr))return k(16599,{gt:t.type});n={verify:aa(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){let n=t.transform;if(n instanceof hr)return{fieldPath:t.field.canonicalString(),setToServerValue:`REQUEST_TIME`};if(n instanceof gr)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof vr)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof xr)return{fieldPath:t.field.canonicalString(),increment:n.Re};if(n instanceof Sr)return{fieldPath:t.field.canonicalString(),minimum:n.Re};if(n instanceof Cr)return{fieldPath:t.field.canonicalString(),maximum:n.Re};throw k(20930,{transform:t.transform})}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return t.updateTime===void 0?t.exists===void 0?k(27497):{exists:t.exists}:{updateTime:ea(e,t.updateTime)}}(e,t.precondition)),n}function da(e,t){return e&&e.length>0?(A(t!==void 0,14353),e.map((e=>function(e,t){let n=e.updateTime?ta(e.updateTime):ta(t);return n.isEqual(B.min())&&(n=ta(t)),new kr(n,e.transformResults||[])}(e,t)))):[]}function fa(e){let t=oa(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){A(r===1,65062);let e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let a=[];n.where&&(a=function(e){let t=pa(e);return t instanceof Xr&&Qr(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map((e=>function(e){return new di(ma(e.field),function(e){switch(e){case`ASCENDING`:return`asc`;case`DESCENDING`:return`desc`;default:return}}(e.direction))}(e)))}(n.orderBy));let s=null;n.limit&&(s=function(e){let t;return t=typeof e==`object`?e.value:e,tn(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){let t=!!e.before;return new Gr(e.values||[],t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){let t=!e.before;return new Gr(e.values||[],t)}(n.endAt)),bi(t,i,o,a,s,`F`,c,l)}function pa(e){return e.unaryFilter===void 0?e.fieldFilter===void 0?e.compositeFilter===void 0?k(30097,{filter:e}):function(e){return Xr.create(e.compositeFilter.filters.map((e=>pa(e))),function(e){switch(e){case`AND`:return`and`;case`OR`:return`or`;default:return k(1026)}}(e.compositeFilter.op))}(e):function(e){return Yr.create(ma(e.fieldFilter.field),function(e){switch(e){case`EQUAL`:return`==`;case`NOT_EQUAL`:return`!=`;case`GREATER_THAN`:return`>`;case`GREATER_THAN_OR_EQUAL`:return`>=`;case`LESS_THAN`:return`<`;case`LESS_THAN_OR_EQUAL`:return`<=`;case`ARRAY_CONTAINS`:return`array-contains`;case`IN`:return`in`;case`NOT_IN`:return`not-in`;case`ARRAY_CONTAINS_ANY`:return`array-contains-any`;case`OPERATOR_UNSPECIFIED`:return k(58110);default:return k(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):function(e){switch(e.unaryFilter.op){case`IS_NAN`:let t=ma(e.unaryFilter.field);return Yr.create(t,`==`,{doubleValue:NaN});case`IS_NULL`:let n=ma(e.unaryFilter.field);return Yr.create(n,`==`,{nullValue:`NULL_VALUE`});case`IS_NOT_NAN`:let r=ma(e.unaryFilter.field);return Yr.create(r,`!=`,{doubleValue:NaN});case`IS_NOT_NULL`:let i=ma(e.unaryFilter.field);return Yr.create(i,`!=`,{nullValue:`NULL_VALUE`});case`OPERATOR_UNSPECIFIED`:return k(61313);default:return k(60726)}}(e)}function ma(e){return Nt.fromServerFormat(e.fieldPath)}function ha(e){let t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function ga(e){return e.length>=4&&e.get(0)===`projects`&&e.get(2)===`databases`}function _a(e){return!!e&&typeof e._toProto==`function`&&e._protoValueType===`ProtoValue`}function va(e,t){let n={fields:{}};return t.forEach(((t,r)=>{if(typeof r!=`string`)throw Error(`Cannot encode map with non-string key: ${r}`);n.fields[r]=t._toProto(e)})),{mapValue:n}}function ya(e){return{stringValue:e}}function ba(e){return new Xi(e,!0)}var xa=class e{constructor(e){this._byteString=e}static fromBase64String(t){try{return new e(bn.fromBase64String(t))}catch(e){throw new N(M.INVALID_ARGUMENT,`Failed to construct data from Base64 string: `+e)}}static fromUint8Array(t){return new e(bn.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return`Bytes(base64: `+this.toBase64()+`)`}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:e._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(Bt(t,e._jsonSchema))return e.fromBase64String(t.bytes)}};xa._jsonSchemaVersion=`firestore/bytes/1.0`,xa._jsonSchema={type:L(`string`,xa._jsonSchemaVersion),bytes:L(`string`)};var Sa=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new N(M.INVALID_ARGUMENT,`Invalid field name at argument $(i + 1). Field names must not be empty.`);this._internalPath=new Nt(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};function Ca(){return new Sa(At)}var wa=class{constructor(e){this._methodName=e}},Ta=class e{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new N(M.INVALID_ARGUMENT,`Latitude must be a number between -90 and 90, but was: `+e);if(!isFinite(t)||t<-180||t>180)throw new N(M.INVALID_ARGUMENT,`Longitude must be a number between -180 and 180, but was: `+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return P(this._lat,e._lat)||P(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:e._jsonSchemaVersion}}static fromJSON(t){if(Bt(t,e._jsonSchema))return new e(t.latitude,t.longitude)}};function Ea(e){let t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}Ta._jsonSchemaVersion=`firestore/geoPoint/1.0`,Ta._jsonSchema={type:L(`string`,Ta._jsonSchemaVersion),latitude:L(`number`),longitude:L(`number`)};var Da=class{bt(e){}shutdown(){}},Oa=`ConnectivityMonitor`,ka=class{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener(`online`,this.vt),window.removeEventListener(`offline`,this.Dt)}Ft(){window.addEventListener(`online`,this.vt),window.addEventListener(`offline`,this.Dt)}St(){O(Oa,`Network connectivity changed: AVAILABLE`);for(let e of this.Ct)e(0)}xt(){O(Oa,`Network connectivity changed: UNAVAILABLE`);for(let e of this.Ct)e(1)}static C(){return typeof window<`u`&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}},Aa=null;function ja(){return Aa===null?Aa=function(){return 268435456+Math.round(2147483648*Math.random())}():Aa++,`0x`+Aa.toString(16)}var Ma=`RestConnection`,Na={BatchGetDocuments:`batchGet`,Commit:`commit`,RunQuery:`runQuery`,RunAggregationQuery:`runAggregationQuery`,ExecutePipeline:`executePipeline`},Pa=class{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?`https`:`http`,n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Mt=t+`://`+e.host,this.Nt=`projects/${n}/databases/${r}`,this.Lt=this.databaseId.database===Mn?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Bt(e,t,n,r,a){let o=ja(),s=this.Ut(e,t.toUriEncodedString());O(Ma,`Sending RPC '${e}' ${o}:`,s,n);let c={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(c,r,a);let{host:l}=new URL(s),u=i(l);return this.qt(e,s,c,n,u).then((t=>(O(Ma,`Received RPC '${e}' ${o}: `,t),t)),(t=>{throw dt(Ma,`RPC '${e}' ${o} failed with error: `,t,`url: `,s,`request:`,n),t}))}$t(e,t,n,r,i,a){return this.Bt(e,t,n,r,i)}kt(e,t,n){e[`X-Goog-Api-Client`]=function(){return`gl-js/ fire/`+ot}(),e[`Content-Type`]=`text/plain`,this.databaseInfo.appId&&(e[`X-Firebase-GMPID`]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}Ut(e,t){let n=Na[e],r=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}},Fa=class{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}},Ia=`WebChannelConnection`,La=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))},Ra=class e extends Pa{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){e.sn||=(La(me(),pe.STAT_EVENT,(e=>{e.stat===fe.PROXY?O(Ia,`STAT_EVENT: detected buffering proxy`):e.stat===fe.NOPROXY&&O(Ia,`STAT_EVENT: detected no buffering proxy`)})),!0)}qt(e,t,n,r,i){let a=ja();return new Promise(((i,o)=>{let s=new ce;s.setWithCredentials(!0),s.listenOnce(ue.COMPLETE,(()=>{try{switch(s.getLastErrorCode()){case de.NO_ERROR:let t=s.getResponseJson();O(Ia,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(t)),i(t);break;case de.TIMEOUT:O(Ia,`RPC '${e}' ${a} timed out`),o(new N(M.DEADLINE_EXCEEDED,`Request time out`));break;case de.HTTP_ERROR:let n=s.getStatus();if(O(Ia,`RPC '${e}' ${a} failed with status:`,n,`response text:`,s.getResponseText()),n>0){let e=s.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=e?.error;t&&t.status&&t.message?o(new N(function(e){let t=e.toLowerCase().replace(/_/g,`-`);return Object.values(M).indexOf(t)>=0?t:M.UNKNOWN}(t.status),t.message)):o(new N(M.UNKNOWN,`Server responded with status `+s.getStatus()))}else o(new N(M.UNAVAILABLE,`Connection failed.`));break;default:k(9055,{_n:e,streamId:a,an:s.getLastErrorCode(),un:s.getLastError()})}}finally{O(Ia,`RPC '${e}' ${a} completed.`)}}));let c=JSON.stringify(r);O(Ia,`RPC '${e}' ${a} sending request:`,r),s.send(t,`POST`,c,n,15)}))}cn(t,n,r){let i=ja(),a=[this.Mt,`/`,`google.firestore.v1.Firestore`,`/`,t,`/channel`],o=this.createWebChannelTransport(),s={httpSessionIdParam:`gsessionid`,initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(s.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(s.useFetchStreams=!0),this.kt(s.initMessageHeaders,n,r),s.encodeInitMessageHeaders=!0;let l=a.join(``);O(Ia,`Creating RPC '${t}' stream ${i}: ${l}`,s);let u=o.createWebChannel(l,s);this.En(u);let d=!1,f=!1,p=new Fa({Kt:e=>{f?O(Ia,`Not sending because RPC '${t}' stream ${i} is closed:`,e):(d||=(O(Ia,`Opening RPC '${t}' stream ${i} transport.`),u.open(),!0),O(Ia,`RPC '${t}' stream ${i} sending:`,e),u.send(e))},Wt:()=>u.close()});return La(u,le.EventType.OPEN,(()=>{f||(O(Ia,`RPC '${t}' stream ${i} transport opened.`),p.Zt())})),La(u,le.EventType.CLOSE,(()=>{f||(f=!0,O(Ia,`RPC '${t}' stream ${i} transport closed`),p.en(),this.hn(u))})),La(u,le.EventType.ERROR,(e=>{f||(f=!0,dt(Ia,`RPC '${t}' stream ${i} transport errored. Name:`,e.name,`Message:`,e.message),p.en(new N(M.UNAVAILABLE,`The operation could not be completed`)))})),La(u,le.EventType.MESSAGE,(e=>{if(!f){let n=e.data[0];A(!!n,16349);let r=n,a=r?.error||r[0]?.error;if(a){O(Ia,`RPC '${t}' stream ${i} received error:`,a);let e=a.status,n=function(e){let t=q[e];if(t!==void 0)return Fi(t)}(e),r=a.message;e===`NOT_FOUND`&&r.includes(`database`)&&r.includes(`does not exist`)&&r.includes(this.databaseId.database)&&dt(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),n===void 0&&(n=M.INTERNAL,r=`Unknown error status: `+e+` with message `+a.message),f=!0,p.en(new N(n,r)),u.close()}else O(Ia,`RPC '${t}' stream ${i} received:`,n),p.tn(n)}})),e.rn(),setTimeout((()=>{p.Xt()}),0),p}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e[`x-goog-api-key`]=this.databaseInfo.apiKey)}createWebChannelTransport(){return he()}};function za(e){return new Ra(e)}Ra.sn=!1;var Ba=class{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=r,this.In=i,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();let t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),r=Math.max(0,t-n);r>0&&O(`ExponentialBackoff`,`Backing off for ${r} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,r,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}},Va=`PersistentStream`,Ha=class{constructor(e,t,n,r,i,a,o,s){this.Tn=e,this.yn=n,this.wn=r,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=o,this.listener=s,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new Ba(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state===4?this.On():this.auth()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&=(this.vn.cancel(),null)}kn(){this.Sn&&=(this.Sn.cancel(),null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e===4?t&&t.code===M.RESOURCE_EXHAUSTED?(ut(t.toString()),ut(`Using maximum backoff delay to prevent overloading the backend.`),this.xn.fn()):t&&t.code===M.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()):this.xn.reset(),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;let e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.bn===t&&this.Kn(e,n)}),(t=>{e((()=>{let e=new N(M.UNKNOWN,`Fetching auth token failed: `+t.message);return this.Wn(e)}))}))}Kn(e,t){let n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{n((()=>this.listener.Qt()))})),this.stream.zt((()=>{n((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((e=>{n((()=>this.Wn(e)))})),this.stream.onMessage((e=>{n((()=>++this.Dn==1?this.Gn(e):this.onNext(e)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return O(Va,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(O(Va,`stream callback skipped by getCloseGuardedDispatcher.`),Promise.resolve())))}}},Ua=class extends Ha{constructor(e,t,n,r,i,a){super(e,`write_stream_connection_backoff`,`write_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn(`Write`,e,t)}Gn(e){return A(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,A(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){A(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();let t=da(e.writeResults,e.commitTime),n=ta(e.commitTime);return this.listener.Xn(n,t)}er(){let e={};e.database=sa(this.serializer),this.Bn(e)}Yn(e){let t={streamToken:this.lastStreamToken,writes:e.map((e=>ua(this.serializer,e)))};this.Bn(t)}},Wa=class{},Ga=class extends Wa{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.tr=!1}nr(){if(this.tr)throw new N(M.FAILED_PRECONDITION,`The client has already been terminated.`)}Bt(e,t,n,r){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Bt(e,ra(t,n),r,i,a))).catch((e=>{throw e.name===`FirebaseError`?(e.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new N(M.UNKNOWN,e.toString())}))}$t(e,t,n,r,i){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,o])=>this.connection.$t(e,ra(t,n),r,a,o,i))).catch((e=>{throw e.name===`FirebaseError`?(e.code===M.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new N(M.UNKNOWN,e.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}};function Ka(e,t,n,r){return new Ga(e,t,n,r)}var qa=`ComponentProvider`,Ja=new Map;function Ya(e,t,n,r,i){return new jn(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,Ea(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,r)}var Xa={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Za=41943040,Qa=class e{static withCacheSize(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}};Qa.DEFAULT_COLLECTION_PERCENTILE=10,Qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Qa.DEFAULT=new Qa(Za,Qa.DEFAULT_COLLECTION_PERCENTILE,Qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Qa.DISABLED=new Qa(-1,0,0);var $a=`LruGarbageCollector`,eo=1048576;function to([e,t],[n,r]){let i=P(e,n);return i===0?P(t,r):i}var no=class{constructor(e){this.rr=e,this.buffer=new pn(to),this.ir=0}sr(){return++this.ir}_r(e){let t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();to(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}},ro=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&=(this.ar.cancel(),null)}get started(){return this.ar!==null}ur(e){O($a,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay(`lru_garbage_collection`,e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){Qt(e)?O($a,`Ignoring IndexedDB error during garbage collection: `,e):await Xt(e)}await this.ur(3e5)}))}},io=class{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((e=>Math.floor(t/100*e)))}nthSequenceNumber(e,t){if(t===0)return V.resolve($t.ce);let n=new no(t);return this.cr.forEachTarget(e,(e=>n._r(e.sequenceNumber))).next((()=>this.cr.Er(e,(e=>n._r(e))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(O(`LruGarbageCollector`,`Garbage collection skipped; disabled`),V.resolve(Xa)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(O(`LruGarbageCollector`,`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Xa):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,r,i,a,o,s,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((t=>(t>this.params.maximumSequenceNumbersToCollect?(O(`LruGarbageCollector`,`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),this.nthSequenceNumber(e,r)))).next((r=>(n=r,o=Date.now(),this.removeTargets(e,n,t)))).next((t=>(i=t,s=Date.now(),this.removeOrphanedDocuments(e,n)))).next((e=>(l=Date.now(),lt()<=c.DEBUG&&O(`LruGarbageCollector`,`LRU Garbage Collection\n\tCounted targets in ${a-u}ms\n\tDetermined least recently used ${r} in `+(o-a)+`ms
|
|
27
|
+
\tRemoved ${i} targets in `+(s-o)+`ms
|
|
28
|
+
\tRemoved ${e} documents in `+(l-s)+`ms
|
|
29
|
+
Total Duration: ${l-u}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e}))))}};function ao(e,t){return new io(e,t)}var oo=`firestore.googleapis.com`,so=!0,co=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new N(M.INVALID_ARGUMENT,`Can't provide ssl option if host option is not set`);this.host=oo,this.ssl=so}else this.host=e.host,this.ssl=e.ssl??so;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=Za;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<eo)throw new N(M.INVALID_ARGUMENT,`cacheSizeBytes must be at least 1048576`);this.cacheSizeBytes=e.cacheSizeBytes}Ft(`experimentalForceLongPolling`,e.experimentalForceLongPolling,`experimentalAutoDetectLongPolling`,e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Ea(e.experimentalLongPollingOptions??{}),function(e){if(e.timeoutSeconds!==void 0){if(isNaN(e.timeoutSeconds))throw new N(M.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new N(M.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new N(M.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},lo=class{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type=`firestore-lite`,this._persistenceKey=`(lite)`,this._settings=new co({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask=`notTerminated`}get app(){if(!this._app)throw new N(M.FAILED_PRECONDITION,`Firestore was not initialized using the Firebase SDK. 'app' is not available`);return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!==`notTerminated`}_setSettings(e){if(this._settingsFrozen)throw new N(M.FAILED_PRECONDITION,`Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.`);this._settings=new co(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(e){if(!e)return new gt;switch(e.type){case`firstParty`:return new bt(e.sessionIndex||`0`,e.iamToken||null,e.authTokenFactory||null);case`provider`:return e.client;default:throw new N(M.INVALID_ARGUMENT,`makeAuthCredentialsProvider failed due to invalid credential type`)}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask===`notTerminated`&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask===`notTerminated`?await this._terminate():this._terminateTask=`notTerminated`}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=Ja.get(e);t&&(O(qa,`Removing Datastore`),Ja.delete(e),t.terminate())}(this),Promise.resolve()}};function uo(t,n,a,o={}){t=zt(t,lo);let s=i(n),c=t._getSettings(),l={...c,emulatorOptions:t._getEmulatorOptions()},u=`${n}:${a}`;s&&p(`https://${u}`),c.host!==oo&&c.host!==u&&dt(`Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.`);let d={...c,host:u,ssl:s,emulatorOptions:o};if(!r(d,l)&&(t._setSettings(d),o.mockUserToken)){let n,r;if(typeof o.mockUserToken==`string`)n=o.mockUserToken,r=D.MOCK_USER;else{n=e(o.mockUserToken,t._app?.options.projectId);let i=o.mockUserToken.sub||o.mockUserToken.user_id;if(!i)throw new N(M.INVALID_ARGUMENT,`mockUserToken must contain 'sub' or 'user_id' field!`);r=new D(i)}t._authCredentials=new _t(new ht(n,r))}}var fo=class e{constructor(e,t,n){this.converter=t,this._query=n,this.type=`query`,this.firestore=e}withConverter(t){return new e(this.firestore,t,this._query)}},po=class e{constructor(e,t,n){this.converter=t,this._key=n,this.type=`document`,this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new mo(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new e(this.firestore,t,this._key)}toJSON(){return{type:e._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,n,r){if(Bt(n,e._jsonSchema))return new e(t,r||null,new I(F.fromString(n.referencePath)))}};po._jsonSchemaVersion=`firestore/documentReference/1.0`,po._jsonSchema={type:L(`string`,po._jsonSchemaVersion),referencePath:L(`string`)};var mo=class e extends fo{constructor(e,t,n){super(e,t,xi(n)),this._path=n,this.type=`collection`}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new po(this.firestore,null,new I(e))}withConverter(t){return new e(this.firestore,t,this._path)}};function ho(e,t,...n){if(e=ne(e),arguments.length===1&&(t=wt.newId()),Pt(`doc`,`path`,t),e instanceof lo){let r=F.fromString(t,...n);return It(r),new po(e,null,new I(r))}{if(!(e instanceof po||e instanceof mo))throw new N(M.INVALID_ARGUMENT,`Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(F.fromString(t,...n));return It(r),new po(e.firestore,e instanceof mo?e.converter:null,new I(r))}}var go=class e{constructor(e){this._values=(e||[]).map((e=>e))}toArray(){return this._values.map((e=>e))}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:e._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(Bt(t,e._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every((e=>typeof e==`number`)))return new e(t.vectorValues);throw new N(M.INVALID_ARGUMENT,`Expected 'vectorValues' field to be a number array`)}}};go._jsonSchemaVersion=`firestore/vectorValue/1.0`,go._jsonSchema={type:L(`string`,go._jsonSchemaVersion),vectorValues:L(`object`)};var _o=/^__.*__$/,vo=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask===null?new Rr(e,this.data,t,this.fieldTransforms):new zr(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function yo(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw k(40011,{dataSource:e})}}var bo=class e{constructor(e,t,n,r,i,a){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(t){return new e({...this.settings,...t},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePathSegment(e),n}childContextForFieldPath(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePath(),n}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return No(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError(`Document fields must not be empty`);if(yo(this.dataSource)&&_o.test(e))throw this.createError(`Document fields cannot begin and end with "__"`)}},xo=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||ba(e)}createContext(e,t,n,r=!1){return new bo({dataSource:e,methodName:t,targetDoc:n,path:Nt.emptyPath(),arrayElement:!1,hasConverter:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function So(e){let t=e._freezeSettings(),n=ba(e._databaseId);return new xo(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Co(e,t,n,r,i,a={}){let o=e.createContext(a.merge||a.mergeFields?2:0,t,n,i);ko(`Data must be an object, but it was:`,o,r);let s=Do(r,o),c,l;if(a.merge)c=new H(o.fieldMask),l=o.fieldTransforms;else if(a.mergeFields){let e=[];for(let r of a.mergeFields){let i=Ao(t,r,n);if(!o.contains(i))throw new N(M.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);Po(e,i)||e.push(i)}c=new H(e),l=o.fieldTransforms.filter((e=>c.covers(e.field)))}else c=null,l=o.fieldTransforms;return new vo(new or(s),c,l)}var wo=class e extends wa{_toFieldTransform(e){return new Dr(e.path,new hr)}isEqual(t){return t instanceof e}},To=class e extends wa{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){let t=new xr(e.serializer,ur(e.serializer,this.Pr));return new Dr(e.path,t)}isEqual(t){return t instanceof e&&(this.Pr===t.Pr||Number.isNaN(this.Pr)&&Number.isNaN(t.Pr))}};function Eo(e,t,n){if(Oo(e=ne(e)))return ko(`Unsupported field value:`,t,e),Do(e,t);if(e instanceof wa)return function(e,t){if(!yo(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&t.dataSource!==4)throw t.createError(`Nested arrays are not supported`);return function(e,t){let n=[],r=0;for(let i of e){let e=Eo(i,t.childContextForArray(r));e??={nullValue:`NULL_VALUE`},n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t,n){if((e=ne(e))===null)return{nullValue:`NULL_VALUE`};if(typeof e==`number`)return ur(t.serializer,e,n);if(typeof e==`boolean`)return{booleanValue:e};if(typeof e==`string`)return{stringValue:e};if(e instanceof Date){let n=z.fromDate(e);return{timestampValue:Zi(t.serializer,n)}}if(e instanceof z){let n=new z(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Zi(t.serializer,n)}}if(e instanceof Ta)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof xa)return{bytesValue:$i(t.serializer,e._byteString)};if(e instanceof po){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.createError(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:na(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof go)return function(e,t){let n=e instanceof go?e.toArray():e;return{mapValue:{fields:{[Fn]:{stringValue:Rn},[zn]:{arrayValue:{values:n.map((e=>{if(typeof e!=`number`)throw t.createError(`VectorValues must only contain numeric values.`);return cr(t.serializer,e)}))}}}}}}(e,t);if(_a(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${Rt(e)}`)}(e,t,n)}function Do(e,t){let n={};return vn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):gn(e,((e,r)=>{let i=Eo(r,t.childContextForField(e));i!=null&&(n[e]=i)})),{mapValue:{fields:n}}}function Oo(e){return!(typeof e!=`object`||!e||e instanceof Array||e instanceof Date||e instanceof z||e instanceof Ta||e instanceof xa||e instanceof po||e instanceof wa||e instanceof go||_a(e))}function ko(e,t,n){if(!Oo(n)||!Lt(n)){let r=Rt(n);throw r===`an object`?t.createError(e+` a custom object`):t.createError(e+` `+r)}}function Ao(e,t,n){if((t=ne(t))instanceof Sa)return t._internalPath;if(typeof t==`string`)return Mo(e,t);throw No(`Field path arguments must be of type string or `,e,!1,void 0,n)}var jo=RegExp(`[~\\*/\\[\\]]`);function Mo(e,t,n){if(t.search(jo)>=0)throw No(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new Sa(...t.split(`.`))._internalPath}catch{throw No(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function No(e,t,n,r,i){let a=r&&!r.isEmpty(),o=i!==void 0,s=`Function ${t}() called with invalid data`;n&&(s+=" (via `toFirestore()`)"),s+=`. `;let c=``;return(a||o)&&(c+=` (found`,a&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=`)`),new N(M.INVALID_ARGUMENT,s+e+c)}function Po(e,t){return e.some((e=>e.isEqual(t)))}function Fo(e){return typeof e._readUserData==`function`}var Io=class e{constructor(e){this.optionDefinitions=e}_getKnownOptions(t,n){let r=or.empty();for(let i in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(i)){let a=this.optionDefinitions[i];if(i in t){let o=t[i],s;a.nestedOptions&&Lt(o)?s={mapValue:{fields:new e(a.nestedOptions).getOptionsProto(n,o)}}:o&&(s=Eo(o,n)??void 0),s&&r.set(Nt.fromServerFormat(a.serverName),s)}}return r}getOptionsProto(e,t,n){let r=this._getKnownOptions(t,e);if(n){let t=new Map(_n(n,((t,n)=>[Nt.fromServerFormat(n),t===void 0?null:Eo(t,e)])));r.setAll(t)}return r.value.mapValue.fields??{}}};function Lo(e){return typeof e==`object`&&!!e&&!!(`nullValue`in e&&(e.nullValue===null||e.nullValue===`NULL_VALUE`)||`booleanValue`in e&&(e.booleanValue===null||typeof e.booleanValue==`boolean`)||`integerValue`in e&&(e.integerValue===null||typeof e.integerValue==`number`||typeof e.integerValue==`string`)||`doubleValue`in e&&(e.doubleValue===null||typeof e.doubleValue==`number`)||`timestampValue`in e&&(e.timestampValue===null||function(e){return typeof e==`object`&&!!e&&`seconds`in e&&(e.seconds===null||typeof e.seconds==`number`||typeof e.seconds==`string`)&&`nanos`in e&&(e.nanos===null||typeof e.nanos==`number`)}(e.timestampValue))||`stringValue`in e&&(e.stringValue===null||typeof e.stringValue==`string`)||`bytesValue`in e&&(e.bytesValue===null||e.bytesValue instanceof Uint8Array)||`referenceValue`in e&&(e.referenceValue===null||typeof e.referenceValue==`string`)||`geoPointValue`in e&&(e.geoPointValue===null||function(e){return typeof e==`object`&&!!e&&`latitude`in e&&(e.latitude===null||typeof e.latitude==`number`)&&`longitude`in e&&(e.longitude===null||typeof e.longitude==`number`)}(e.geoPointValue))||`arrayValue`in e&&(e.arrayValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`values`in e)||e.values!==null&&!Array.isArray(e.values))}(e.arrayValue))||`mapValue`in e&&(e.mapValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`fields`in e)||e.fields!==null&&!Lt(e.fields))}(e.mapValue))||`fieldReferenceValue`in e&&(e.fieldReferenceValue===null||typeof e.fieldReferenceValue==`string`)||`functionValue`in e&&(e.functionValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`name`in e)||e.name!==null&&typeof e.name!=`string`||!(`args`in e)||e.args!==null&&!Array.isArray(e.args))}(e.functionValue))||`pipelineValue`in e&&(e.pipelineValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`stages`in e)||e.stages!==null&&!Array.isArray(e.stages))}(e.pipelineValue)))}function Ro(){return new wo(`serverTimestamp`)}function zo(e){return new To(`increment`,e)}function Bo(e){return new go(e)}function Y(e){let t;return e instanceof Uo?e:(t=Lt(e)?is(e):e instanceof Array?as(e):$o(e,void 0),t)}function Vo(e){if(e instanceof Uo)return e;if(e instanceof go)return Qo(e);if(Array.isArray(e))return Qo(Bo(e));throw Error(`Unsupported value: `+typeof e)}function Ho(e){return an(e)?Yo(e):Y(e)}var Uo=class{constructor(){this._protoValueType=`ProtoValue`}add(e){return new X(`add`,[this,Y(e)],`add`)}asBoolean(){if(this instanceof es)return this;if(this instanceof Zo)return new ns(this);if(this instanceof Jo)return new rs(this);if(this instanceof X)return new ts(this);throw new N(`invalid-argument`,`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new X(`subtract`,[this,Y(e)],`subtract`)}multiply(e){return new X(`multiply`,[this,Y(e)],`multiply`)}divide(e){return new X(`divide`,[this,Y(e)],`divide`)}mod(e){return new X(`mod`,[this,Y(e)],`mod`)}equal(e){return new X(`equal`,[this,Y(e)],`equal`).asBoolean()}notEqual(e){return new X(`not_equal`,[this,Y(e)],`notEqual`).asBoolean()}lessThan(e){return new X(`less_than`,[this,Y(e)],`lessThan`).asBoolean()}lessThanOrEqual(e){return new X(`less_than_or_equal`,[this,Y(e)],`lessThanOrEqual`).asBoolean()}greaterThan(e){return new X(`greater_than`,[this,Y(e)],`greaterThan`).asBoolean()}greaterThanOrEqual(e){return new X(`greater_than_or_equal`,[this,Y(e)],`greaterThanOrEqual`).asBoolean()}arrayConcat(e,...t){let n=[e,...t].map((e=>Y(e)));return new X(`array_concat`,[this,...n],`arrayConcat`)}arrayContains(e){return new X(`array_contains`,[this,Y(e)],`arrayContains`).asBoolean()}arrayContainsAll(e){let t=Array.isArray(e)?new qo(e.map(Y),`arrayContainsAll`):e;return new X(`array_contains_all`,[this,t],`arrayContainsAll`).asBoolean()}arrayContainsAny(e){let t=Array.isArray(e)?new qo(e.map(Y),`arrayContainsAny`):e;return new X(`array_contains_any`,[this,t],`arrayContainsAny`).asBoolean()}arrayReverse(){return new X(`array_reverse`,[this])}arrayLength(){return new X(`array_length`,[this],`arrayLength`)}equalAny(e){let t=Array.isArray(e)?new qo(e.map(Y),`equalAny`):e;return new X(`equal_any`,[this,t],`equalAny`).asBoolean()}notEqualAny(e){let t=Array.isArray(e)?new qo(e.map(Y),`notEqualAny`):e;return new X(`not_equal_any`,[this,t],`notEqualAny`).asBoolean()}exists(){return new X(`exists`,[this],`exists`).asBoolean()}charLength(){return new X(`char_length`,[this],`charLength`)}like(e){return new X(`like`,[this,Y(e)],`like`).asBoolean()}regexContains(e){return new X(`regex_contains`,[this,Y(e)],`regexContains`).asBoolean()}regexFind(e){return new X(`regex_find`,[this,Y(e)],`regexFind`)}regexFindAll(e){return new X(`regex_find_all`,[this,Y(e)],`regexFindAll`)}regexMatch(e){return new X(`regex_match`,[this,Y(e)],`regexMatch`).asBoolean()}stringContains(e){return new X(`string_contains`,[this,Y(e)],`stringContains`).asBoolean()}startsWith(e){return new X(`starts_with`,[this,Y(e)],`startsWith`).asBoolean()}endsWith(e){return new X(`ends_with`,[this,Y(e)],`endsWith`).asBoolean()}toLower(){return new X(`to_lower`,[this],`toLower`)}toUpper(){return new X(`to_upper`,[this],`toUpper`)}trim(e){let t=[this];return e&&t.push(Y(e)),new X(`trim`,t,`trim`)}ltrim(e){let t=[this];return e&&t.push(Y(e)),new X(`ltrim`,t,`ltrim`)}rtrim(e){let t=[this];return e&&t.push(Y(e)),new X(`rtrim`,t,`rtrim`)}type(){return new X(`type`,[this])}isType(e){return new X(`is_type`,[this,Qo(e)],`isType`).asBoolean()}stringConcat(e,...t){let n=[e,...t].map(Y);return new X(`string_concat`,[this,...n],`stringConcat`)}stringIndexOf(e){return new X(`string_index_of`,[this,Y(e)],`stringIndexOf`)}stringRepeat(e){return new X(`string_repeat`,[this,Y(e)],`stringRepeat`)}stringReplaceAll(e,t){return new X(`string_replace_all`,[this,Y(e),Y(t)],`stringReplaceAll`)}stringReplaceOne(e,t){return new X(`string_replace_one`,[this,Y(e),Y(t)],`stringReplaceOne`)}concat(e,...t){let n=[e,...t].map(Y);return new X(`concat`,[this,...n],`concat`)}reverse(){return new X(`reverse`,[this],`reverse`)}arrayFilter(e,t){return new X(`array_filter`,[this,Y(e),t],`arrayFilter`)}arrayTransform(e,t){return new X(`array_transform`,[this,Y(e),t],`arrayTransform`)}arrayTransformWithIndex(e,t,n){return new X(`array_transform`,[this,Y(e),Y(t),n],`arrayTransformWithIndex`)}arraySlice(e,t){let n=[this,Y(e)];return t!==void 0&&n.push(Y(t)),new X(`array_slice`,n,`arraySlice`)}arrayFirst(){return new X(`array_first`,[this],`arrayFirst`)}arrayFirstN(e){return new X(`array_first_n`,[this,Y(e)],`arrayFirstN`)}arrayLast(){return new X(`array_last`,[this],`arrayLast`)}arrayLastN(e){return new X(`array_last_n`,[this,Y(e)],`arrayLastN`)}arrayMaximum(){return new X(`maximum`,[this],`arrayMaximum`)}arrayMaximumN(e){return new X(`maximum_n`,[this,Y(e)],`arrayMaximumN`)}arrayMinimum(){return new X(`minimum`,[this],`arrayMinimum`)}arrayMinimumN(e){return new X(`minimum_n`,[this,Y(e)],`arrayMinimumN`)}arrayIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`first`)],`arrayIndexOf`)}arrayLastIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`last`)],`arrayLastIndexOf`)}arrayIndexOfAll(e){return new X(`array_index_of_all`,[this,Y(e)],`arrayIndexOfAll`)}byteLength(){return new X(`byte_length`,[this],`byteLength`)}ceil(){return new X(`ceil`,[this])}floor(){return new X(`floor`,[this])}abs(){return new X(`abs`,[this])}exp(){return new X(`exp`,[this])}mapGet(e){return new X(`map_get`,[this,Qo(e)],`mapGet`)}mapSet(e,t,...n){return new X(`map_set`,[this,Y(e),Y(t),...n.map(Y)],`mapSet`)}mapKeys(){return new X(`map_keys`,[this],`mapKeys`)}mapValues(){return new X(`map_values`,[this],`mapValues`)}mapEntries(){return new X(`map_entries`,[this],`mapEntries`)}getField(e){return new X(`get_field`,[this,Y(e)],`get_field`)}count(){return Wo._create(`count`,[this],`count`)}sum(){return Wo._create(`sum`,[this],`sum`)}average(){return Wo._create(`average`,[this],`average`)}minimum(){return Wo._create(`minimum`,[this],`minimum`)}maximum(){return Wo._create(`maximum`,[this],`maximum`)}first(){return Wo._create(`first`,[this],`first`)}last(){return Wo._create(`last`,[this],`last`)}arrayAgg(){return Wo._create(`array_agg`,[this],`arrayAgg`)}arrayAggDistinct(){return Wo._create(`array_agg_distinct`,[this],`arrayAggDistinct`)}countDistinct(){return Wo._create(`count_distinct`,[this],`countDistinct`)}logicalMaximum(e,...t){let n=[e,...t];return new X(`maximum`,[this,...n.map(Y)],`logicalMaximum`)}logicalMinimum(e,...t){let n=[e,...t];return new X(`minimum`,[this,...n.map(Y)],`minimum`)}vectorLength(){return new X(`vector_length`,[this],`vectorLength`)}cosineDistance(e){return new X(`cosine_distance`,[this,Vo(e)],`cosineDistance`)}dotProduct(e){return new X(`dot_product`,[this,Vo(e)],`dotProduct`)}euclideanDistance(e){return new X(`euclidean_distance`,[this,Vo(e)],`euclideanDistance`)}unixMicrosToTimestamp(){return new X(`unix_micros_to_timestamp`,[this],`unixMicrosToTimestamp`)}timestampToUnixMicros(){return new X(`timestamp_to_unix_micros`,[this],`timestampToUnixMicros`)}unixMillisToTimestamp(){return new X(`unix_millis_to_timestamp`,[this],`unixMillisToTimestamp`)}timestampToUnixMillis(){return new X(`timestamp_to_unix_millis`,[this],`timestampToUnixMillis`)}unixSecondsToTimestamp(){return new X(`unix_seconds_to_timestamp`,[this],`unixSecondsToTimestamp`)}timestampToUnixSeconds(){return new X(`timestamp_to_unix_seconds`,[this],`timestampToUnixSeconds`)}timestampAdd(e,t){return new X(`timestamp_add`,[this,Y(e),Y(t)],`timestampAdd`)}timestampSubtract(e,t){return new X(`timestamp_subtract`,[this,Y(e),Y(t)],`timestampSubtract`)}timestampDiff(e,t){return new X(`timestamp_diff`,[this,Ho(e),Y(t)],`timestampDiff`)}timestampExtract(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_extract`,n,`timestampExtract`)}documentId(){return new X(`document_id`,[this],`documentId`)}parent(){return new X(`parent`,[this],`parent`)}substring(e,t){let n=Y(e);return new X(`substring`,t===void 0?[this,n]:[this,n,Y(t)],`substring`)}arrayGet(e){return new X(`array_get`,[this,Y(e)],`arrayGet`)}isError(){return new X(`is_error`,[this],`isError`).asBoolean()}ifError(e){let t=new X(`if_error`,[this,Y(e)],`ifError`);return e instanceof es?t.asBoolean():t}isAbsent(){return new X(`is_absent`,[this],`isAbsent`).asBoolean()}mapRemove(e){return new X(`map_remove`,[this,Y(e)],`mapRemove`)}mapMerge(e,...t){let n=Y(e),r=t.map(Y);return new X(`map_merge`,[this,n,...r],`mapMerge`)}pow(e){return new X(`pow`,[this,Y(e)])}trunc(e){return e===void 0?new X(`trunc`,[this]):new X(`trunc`,[this,Y(e)],`trunc`)}round(e){return e===void 0?new X(`round`,[this]):new X(`round`,[this,Y(e)],`round`)}collectionId(){return new X(`collection_id`,[this])}length(){return new X(`length`,[this])}ln(){return new X(`ln`,[this])}sqrt(){return new X(`sqrt`,[this])}stringReverse(){return new X(`string_reverse`,[this])}ifAbsent(e){return new X(`if_absent`,[this,Y(e)],`ifAbsent`)}ifNull(e){return new X(`if_null`,[this,Y(e)],`ifNull`)}coalesce(e,...t){return new X(`coalesce`,[this,Y(e),...t.map(Y)],`coalesce`)}join(e){return new X(`join`,[this,Y(e)],`join`)}log10(){return new X(`log10`,[this])}arraySum(){return new X(`sum`,[this])}split(e){return new X(`split`,[this,Y(e)])}timestampTruncate(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_trunc`,n)}ascending(){return os(this)}descending(){return ss(this)}as(e){return new Ko(this,e,`as`)}},Wo=class e{constructor(e,t){this.name=e,this.params=t,this.exprType=`AggregateFunction`,this._protoValueType=`ProtoValue`}static _create(t,n,r){let i=new e(t,n);return i._methodName=r,i}as(e){return new Go(this,e,`as`)}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e)))}},Go=class{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}},Ko=class{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType=`AliasedExpression`,this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}},qo=class extends Uo{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType=`ListOfExpressions`}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}},Jo=class extends Uo{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType=`Field`,this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new X(`geo_distance`,[this,Y(e)],`geoDistance`)}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}};function Yo(e){return Xo(e,`field`)}function Xo(e,t){return new Jo(typeof e==`string`?At===e?Ca()._internalPath:Ao(`field`,e):e._internalPath,t)}var Zo=class e extends Uo{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType=`Constant`}static _fromProto(t){let n=new e(t,void 0);return n._protoValue=t,n}_toProto(e){return A(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,Lo(this._protoValue)||(this._protoValue=Eo(this.value,e))}};function Qo(e,t){return $o(e,`constant`)}function $o(e,t){let n=new Zo(e,t);return typeof e==`boolean`?new ns(n):n}var X=class extends Uo{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.expressionType=`Function`,this._optionsProto=void 0,n!==void 0&&(this._methodName=n),r!==void 0&&(this._options=r)}get _optionsUtil(){return new Io({})}_toProto(e){let t={functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}},es=class e extends Uo{get _methodName(){return this._expr._methodName}countIf(){return Wo._create(`count_if`,[this],`countIf`)}not(){return new X(`not`,[this],`not`).asBoolean()}conditional(e,t){return new X(`conditional`,[this,e,t],`conditional`)}ifError(t){let n=Y(t),r=new X(`if_error`,[this,n],`ifError`);return n instanceof e?r.asBoolean():r}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}},ts=class extends es{constructor(e){super(),this._expr=e,this.expressionType=`Function`}},ns=class extends es{constructor(e){super(),this._expr=e,this.expressionType=`Constant`}_getValue(){return this._expr._getValue()}},rs=class extends es{constructor(e){super(),this._expr=e,this.expressionType=`Field`}};function is(e,t){let n=[];for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];n.push(Qo(t)),n.push(Y(r))}return new X(`map`,n,`map`)}function as(e){return function(e,t){return new X(`array`,e.map((e=>Y(e))),t)}(e,`array`)}function os(e){return new cs(Ho(e),`ascending`,`ascending`)}function ss(e){return new cs(Ho(e),`descending`,`descending`)}var cs=class{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType=`ProtoValue`}_toProto(e){return{mapValue:{fields:{direction:ya(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}},ls=class{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}},us=class extends ls{get _name(){return`add_fields`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[va(e,this.fields)]}}_readUserData(e){super._readUserData(e),Cs(this.fields,e)}},ds=class extends ls{get _name(){return`aggregate`}get _optionsUtil(){return new Io({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[va(e,this.accumulators),va(e,this.groups)]}}_readUserData(e){super._readUserData(e),Cs(this.groups,e),Cs(this.accumulators,e)}},fs=class extends ls{get _name(){return`distinct`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[va(e,this.groups)]}}_readUserData(e){super._readUserData(e),Cs(this.groups,e)}},ps=class extends ls{get _name(){return`collection`}get _optionsUtil(){return new Io({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.Vr=e.startsWith(`/`)?e:`/`+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}},ms=class extends ls{get _name(){return`collection_group`}get _optionsUtil(){return new Io({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:``},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}},hs=class extends ls{get _name(){return`database`}get _optionsUtil(){return new Io({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}},gs=class extends ls{get _name(){return`documents`}get _optionsUtil(){return new Io({})}constructor(e,t){if(super(t),!e||e.length===0)throw new N(M.INVALID_ARGUMENT,`Empty document paths are not allowed in DocumentsSource`);let n=e.map((e=>e.startsWith(`/`)?e:`/`+e)),r=new Set(n);if(r.size!==n.length)throw new N(M.INVALID_ARGUMENT,`Duplicate document paths are not allowed in DocumentsSource`);this.dr=n,this.mr=r}_toProto(e){return{...super._toProto(e),args:this.dr.map((e=>({referenceValue:e})))}}_readUserData(e){super._readUserData(e)}},_s=class extends ls{get _name(){return`where`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Cs(this.condition,e)}},vs=class extends ls{get _name(){return`limit`}get _optionsUtil(){return new Io({})}constructor(e,t){A(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[ur(e,this.limit)]}}},ys=class extends ls{get _name(){return`offset`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[ur(e,this.offset)]}}},bs=class extends ls{get _name(){return`select`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[va(e,this.selections)]}}_readUserData(e){super._readUserData(e),Cs(this.selections,e)}},xs=class extends ls{get _name(){return`sort`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),Cs(this.orderings,e)}},Ss=class e extends ls{get _name(){return`replace_with`}get _optionsUtil(){return new Io({})}constructor(e,t){super(t),this.map=e}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),ya(e.pr)]}}_readUserData(e){super._readUserData(e),Cs(this.map,e)}};Ss.pr=`full_replace`;function Cs(e,t){return Fo(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach((e=>e._readUserData(t))):Object.values(e).forEach((e=>e._readUserData(t))),e}var ws=class{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Es(this)}getPipelineCollectionGroup(){return Ds(this)}getPipelineCollectionId(){return Os(this)}getPipelineDocuments(){return ks(this)}getPipelineFlavor(){return function(e){let t=`exact`;return e.stages.forEach(((n,r)=>{n._name!==fs.name&&n._name!==ds.name||(t=`keyless`),n._name===bs.name&&t===`exact`&&(t=`augmented`),n._name===us.name&&r<e.stages.length-1&&t===`exact`&&(t=`augmented`)})),t}(this)}getPipelineSourceType(){return Ts(this)}};function Ts(e){let t=e.stages[0];return t instanceof ps||t instanceof ms||t instanceof hs||t instanceof gs?t._name:`unknown`}function Es(e){if(Ts(e)===`collection`)return e.stages[0].Vr}function Ds(e){if(Ts(e)===`collection_group`)return e.stages[0].collectionId}function Os(e){switch(Ts(e)){case`collection`:return F.fromString(Es(e)).lastSegment();case`collection_group`:return Ds(e);default:return}}function ks(e){if(Ts(e)===`documents`)return e.stages[0].dr}var Z=class e{constructor(e,t){this.type=e,this.value=t}static vr(){return new e(`ERROR`,void 0)}static Sr(){return new e(`UNSET`,void 0)}static Dr(){return new e(`NULL`,Bn)}static newValue(t){return $n(t)?new e(`NULL`,Bn):function(e){return!!e&&`booleanValue`in e}(t)?new e(`BOOLEAN`,t):Yn(t)?new e(`INT`,t):Xn(t)?new e(`DOUBLE`,t):function(e){return!!e&&`timestampValue`in e&&!!e.timestampValue}(t)?new e(`TIMESTAMP`,t):function(e){return!!e&&`stringValue`in e}(t)?new e(`STRING`,t):function(e){return!!e&&`bytesValue`in e}(t)?new e(`BYTES`,t):t.referenceValue?new e(`REFERENCE`,t):t.geoPointValue?new e(`GEO_POINT`,t):Qn(t)?new e(`ARRAY`,t):nr(t)?new e(`VECTOR`,t):tr(t)?new e(`MAP`,t):new e(`ERROR`,void 0)}Cr(){return this.type===`ERROR`||this.type===`UNSET`}Fr(){return this.type===`NULL`}};function As(e){if(!e.Cr())return e.value}function js(e){return e instanceof es?e._expr:e}function Q(e){if((e=js(e))instanceof Jo)return new Ms(e);if(e instanceof Zo)return new Ns(e);if(e instanceof qo)return new Ps(e);if(e instanceof X){if(e.name===`add`)return new Vs(e);if(e.name===`subtract`)return new Hs(e);if(e.name===`multiply`)return new Us(e);if(e.name===`divide`)return new Ws(e);if(e.name===`mod`)return new Gs(e);if(e.name===`and`)return new Ks(e);if(e.name===`equal`)return new cc(e);if(e.name===`not_equal`)return new lc(e);if(e.name===`less_than`)return new uc(e);if(e.name===`less_than_or_equal`)return new dc(e);if(e.name===`greater_than`)return new fc(e);if(e.name===`greater_than_or_equal`)return new pc(e);if(e.name===`array_concat`)return new mc(e);if(e.name===`array_reverse`)return new hc(e);if(e.name===`array_contains`)return new gc(e);if(e.name===`array_contains_all`)return new _c(e);if(e.name===`array_contains_any`)return new vc(e);if(e.name===`array_length`)return new yc(e);if(e.name===`array_element`)return new bc(e);if(e.name===`equal_any`)return new Xs(e);if(e.name===`not_equal_any`)return new Zs(e);if(e.name===`is_nan`)return new Qs(e);if(e.name===`is_not_nan`)return new $s(e);if(e.name===`is_null`)return new ec(e);if(e.name===`is_not_null`)return new tc(e);if(e.name===`is_error`)return new nc(e);if(e.name===`exists`)return new rc(e);if(e.name===`not`)return new qs(e);if(e.name===`or`)return new Js(e);if(e.name===`xor`)return new Ys(e);if(e.name===`conditional`)return new ic(e);if(e.name===`maximum`)return new ac(e);if(e.name===`minimum`)return new oc(e);if(e.name===`reverse`)return new xc(e);if(e.name===`replace_first`)return new Sc(e);if(e.name===`replace_all`)return new Cc(e);if(e.name===`char_length`)return new wc(e);if(e.name===`byte_length`)return new Tc(e);if(e.name===`like`)return new Dc(e);if(e.name===`regex_contains`)return new Oc(e);if(e.name===`regex_match`)return new kc(e);if(e.name===`string_contains`)return new Ac(e);if(e.name===`starts_with`)return new jc(e);if(e.name===`ends_with`)return new Mc(e);if(e.name===`to_lower`)return new Nc(e);if(e.name===`to_upper`)return new Pc(e);if(e.name===`trim`)return new Fc(e);if(e.name===`string_concat`)return new Ic(e);if(e.name===`map_get`)return new Lc(e);if(e.name===`cosine_distance`)return new zc(e);if(e.name===`dot_product`)return new Bc(e);if(e.name===`euclidean_distance`)return new Vc(e);if(e.name===`vector_length`)return new Hc(e);if(e.name===`unix_micros_to_timestamp`)return new rl(e);if(e.name===`timestamp_to_unix_micros`)return new sl(e);if(e.name===`unix_millis_to_timestamp`)return new il(e);if(e.name===`timestamp_to_unix_millis`)return new cl(e);if(e.name===`unix_seconds_to_timestamp`)return new al(e);if(e.name===`timestamp_to_unix_seconds`)return new ll(e);if(e.name===`timestamp_add`)return new dl(e);if(e.name===`timestamp_subtract`)return new fl(e)}throw Error(`Unknown Expr : ${e}`)}var Ms=class{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===At)return Z.newValue({referenceValue:aa(e.serializer,t.key)});if(this.expr.fieldName===`__update_time__`)return Z.newValue({timestampValue:ea(e.serializer,t.version)});if(this.expr.fieldName===`__create_time__`)return Z.newValue({timestampValue:ea(e.serializer,t.createTime)});let n=t.data.field(this.expr._fieldPath);return n?On(n)?Z.newValue(function(e,t){if(e.serverTimestampBehavior===`estimate`)return{timestampValue:ea(e.serializer,B.fromTimestamp(An(t)))};if(e.serverTimestampBehavior===`previous`){let e=kn(t);if(e)return e}return{nullValue:`NULL_VALUE`}}(e,n)):Z.newValue(n):Z.Sr()}},Ns=class{constructor(e){this.expr=e}evaluate(e,t){return Z.newValue(this.expr._getValue())}},Ps=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.Rr.map((n=>Q(n).evaluate(e,t)));return n.some((e=>e.Cr()))?Z.vr():Z.newValue({arrayValue:{values:n.map((e=>e.value))}})}};function Fs(e){return Xn(e)?Number(e.doubleValue):Number(e.integerValue)}function Is(e){return BigInt(e.integerValue)}var Ls=BigInt(`0x7fffffffffffffff`),Rs=-BigInt(`0x8000000000000000`),zs=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length>=2,24778);let n=Q(this.expr.params[0]).evaluate(e,t),r=Q(this.expr.params[1]).evaluate(e,t),i=this.Or(n,r);for(let n of this.expr.params.slice(2)){let r=Q(n).evaluate(e,t);i=this.Or(i,r)}return i}Or(e,t){if(e.Cr()||t.Cr())return Z.vr();if(e.Fr()||t.Fr())return Z.Dr();let n=e.value,r=t.value;if(!Xn(n)&&!Yn(n)||!Xn(r)&&!Yn(r))return Z.vr();if(Xn(n)||Xn(r)){let e=this.Mr(n,r);return e?Z.newValue(e):Z.vr()}if(Yn(n)&&Yn(r)){let e=this.Nr(n,r);return e===void 0?Z.vr():typeof e==`number`?Z.newValue({doubleValue:e}):e<Rs||e>Ls?Z.vr():Z.newValue({integerValue:`${e}`})}return Z.vr()}};function Bs(e,t){return G(e)===G(t)?er(e)||er(t)?`NOT_EQ`:$n(e)&&$n(t)?`EQ`:$n(e)||$n(t)?`NULL`:Qn(e)&&Qn(t)?function(e,t){if(e.values?.length!==t.values?.length)return`NOT_EQ`;let n=!1;for(let r=0;r<(e.values?.length??0);r++){let i=e.values[r],a=t.values[r];switch(Bs(i,a)){case`EQ`:break;case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:n=!0;break;default:k(44609,{Lr:i,Br:a})}}return n?`NULL`:`EQ`}(e.arrayValue,t.arrayValue):nr(e)&&nr(t)||tr(e)&&tr(t)?function(e,t){let n=e.fields||{},r=t.fields||{};if(hn(n)!==hn(r))return`NOT_EQ`;let i=!1;for(let e in n)if(n.hasOwnProperty(e)){if(r[e]===void 0)return`NOT_EQ`;switch(Bs(n[e],r[e])){case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:i=!0}}return i?`NULL`:`EQ`}(e.mapValue,t.mapValue):function(e,t){return Hn(e,t,{Te:!1,Ee:!0,he:!0})}(e,t)?`EQ`:`NOT_EQ`:`TYPE_MISMATCH`}var Vs=class extends zs{Nr(e,t){return Is(e)+Is(t)}Mr(e,t){return{doubleValue:Fs(e)+Fs(t)}}},Hs=class extends zs{constructor(e){super(e),this.expr=e}Nr(e,t){return Is(e)-Is(t)}Mr(e,t){return{doubleValue:Fs(e)-Fs(t)}}},Us=class extends zs{constructor(e){super(e),this.expr=e}Nr(e,t){return Is(e)*Is(t)}Mr(e,t){return{doubleValue:Fs(e)*Fs(t)}}},Ws=class extends zs{constructor(e){super(e),this.expr=e}Nr(e,t){let n=Is(t);if(n!==BigInt(0))return Is(e)/n}Mr(e,t){let n=Fs(t);return n===0?{doubleValue:nn(n)?-1/0:1/0}:{doubleValue:Fs(e)/n}}},Gs=class extends zs{constructor(e){super(e),this.expr=e}Nr(e,t){let n=Is(t);if(n!==BigInt(0))return Is(e)%n}Mr(e,t){let n=Fs(t);if(n!==0)return{doubleValue:Fs(e)%n}}},Ks=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(!a.value?.booleanValue)return Z.newValue(W);break;case`NULL`:r=!0;break;default:n=!0}}return n?Z.vr():r?Z.Dr():Z.newValue(Vn)}},qs=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,9634);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return Z.newValue({booleanValue:!n.value?.booleanValue});case`NULL`:return Z.Dr();default:return Z.vr()}}},Js=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(a.value?.booleanValue)return Z.newValue(Vn);break;case`NULL`:r=!0;break;default:n=!0}}return n?Z.vr():r?Z.Dr():Z.newValue(W)}},Ys=class e{constructor(e){this.expr=e}evaluate(t,n){let r=!1,i=!1;for(let a of this.expr.params){let o=Q(a).evaluate(t,n);switch(o.type){case`BOOLEAN`:r=e.xor(r,!!o.value?.booleanValue);break;case`NULL`:i=!0;break;default:return Z.vr()}}return i?Z.Dr():Z.newValue({booleanValue:r})}static xor(e,t){return(e||t)&&!(e&&t)}},Xs=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,55094);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`NULL`:n=!0;break;case`ERROR`:case`UNSET`:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();for(let e of i.value?.arrayValue?.values??[])switch($n(r.value)&&$n(e)?`EQ`:Bs(r.value,e)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:k(44608,{value:r.value,candidate:e})}return n?Z.Dr():Z.newValue(W)}},Zs=class{constructor(e){this.expr=e}evaluate(e,t){return new qs(new X(`not`,[new X(`equal_any`,this.expr.params)])).evaluate(e,t)}},Qs=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,23322);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return Z.newValue(W);case`DOUBLE`:return Z.newValue({booleanValue:isNaN(Fs(n.value))});case`NULL`:return Z.Dr();default:return Z.vr()}}},$s=class{constructor(e){this.expr=e}evaluate(e,t){return A(this.expr.params.length===1,50406),new qs(new X(`not`,[new X(`is_nan`,this.expr.params)])).evaluate(e,t)}},ec=class{constructor(e){this.expr=e}evaluate(e,t){switch(A(this.expr.params.length===1,23123),Q(this.expr.params[0]).evaluate(e,t).type){case`NULL`:return Z.newValue(Vn);case`UNSET`:case`ERROR`:return Z.vr();default:return Z.newValue(W)}}},tc=class{constructor(e){this.expr=e}evaluate(e,t){return A(this.expr.params.length===1,23167),new qs(new X(`not`,[new X(`is_null`,this.expr.params)])).evaluate(e,t)}},nc=class{constructor(e){this.expr=e}evaluate(e,t){return A(this.expr.params.length===1,5228),Q(this.expr.params[0]).evaluate(e,t).type===`ERROR`?Z.newValue(Vn):Z.newValue(W)}},rc=class{constructor(e){this.expr=e}evaluate(e,t){switch(A(this.expr.params.length===1,6877),Q(this.expr.params[0]).evaluate(e,t).type){case`ERROR`:return Z.vr();case`UNSET`:return Z.newValue(W);default:return Z.newValue(Vn)}}},ic=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===3,11706);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return n.value?.booleanValue?Q(this.expr.params[1]).evaluate(e,t):Q(this.expr.params[2]).evaluate(e,t);case`NULL`:return Q(this.expr.params[2]).evaluate(e,t);default:return Z.vr()}}},ac=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||K(e.value,r.value)>0?e:r}return r===void 0?Z.Dr():r}},oc=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||K(e.value,r.value)<0?e:r}return r===void 0?Z.Dr():r}},sc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`ERROR`:case`UNSET`:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);switch(r.type){case`ERROR`:case`UNSET`:return Z.vr()}return this.Ur(n,r)}},cc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return Z.newValue(Vn);if(e.Fr()||t.Fr()||er(e.value)||er(t.value)||G(e.value)!==G(t.value))return Z.newValue(W);switch(Bs(e.value,t.value)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:return Z.newValue(W);case`NULL`:return Z.Dr();default:k(44615,{left:e,right:t})}}},lc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){switch(Bs(e.value,t.value)){case`EQ`:return Z.newValue(W);case`NOT_EQ`:case`TYPE_MISMATCH`:return Z.newValue(Vn);case`NULL`:return Z.Dr();default:k(44614,{left:e,right:t})}}},uc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||er(e.value)||er(t.value)?Z.newValue(W):Z.newValue({booleanValue:K(e.value,t.value)<0})}},dc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||er(e.value)||er(t.value)?Z.newValue(W):Bs(e.value,t.value)===`EQ`?Z.newValue(Vn):Z.newValue({booleanValue:K(e.value,t.value)<0})}},fc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||er(e.value)||er(t.value)?Z.newValue(W):Z.newValue({booleanValue:K(e.value,t.value)>0})}},pc=class extends sc{constructor(e){super(e),this.expr=e}Ur(e,t){return G(e.value)!==G(t.value)||er(e.value)||er(t.value)?Z.newValue(W):Bs(e.value,t.value)===`EQ`?Z.newValue(Vn):Z.newValue({booleanValue:K(e.value,t.value)>0})}},mc=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},hc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,216);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:{let e=n.value.arrayValue?.values??[];return Z.newValue({arrayValue:{values:[...e].reverse()}})}default:return Z.vr()}}},gc=class{constructor(e){this.expr=e}evaluate(e,t){return A(this.expr.params.length===2,52884),new Xs(new X(`eq_any`,[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}},_c=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,1392);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of a){let t=!1;n=!1;for(let r of o){switch($n(e)&&$n(r)?`EQ`:Bs(e,r)){case`EQ`:t=!0;break;case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:k(44613,{value:r,search:e})}if(t)break}if(!t)return Z.newValue(W)}return Z.newValue(Vn)}},vc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,2680);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of o)for(let t of a)switch($n(e)&&$n(t)?`EQ`:Bs(e,t)){case`EQ`:return Z.newValue(Vn);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:k(44608,{value:e,search:t})}return n?Z.Dr():Z.newValue(W)}},yc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,38605);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:return Z.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Z.vr()}}},bc=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},xc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,1508);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`BYTES`:{let e=n.value?.bytesValue;if(typeof e==`string`){let t=bn.fromBase64String(e).toUint8Array();return t.reverse(),Z.newValue({bytesValue:bn.fromUint8Array(t).toBase64()})}return Z.newValue({bytesValue:new Uint8Array(e).reverse()})}case`STRING`:{let e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:`grapheme`}).segment(e),r=Array.from(t,(e=>e.segment)).reverse();return Z.newValue({stringValue:r.join(``)})}default:return Z.vr()}}},Sc=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},Cc=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},wc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,19400);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r<=65535)if(r>=55296&&r<=57343)if(r<=56319){let r=e.codePointAt(n+1);r!==void 0&&r>=56320&&r<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(r<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}default:return Z.vr()}}},Tc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,8486);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BYTES`:{let e=n.value?.bytesValue;return typeof e==`string`?Z.newValue({integerValue:bn.fromBase64String(e).toUint8Array().length}):Z.newValue({integerValue:new Uint8Array(e).length})}case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r>=55296&&r<=57343){if(!(r<=56319))return;{let r=e.codePointAt(n+1);if(r===void 0||!(r>=56320&&r<=57343))return;t+=4,n++}}else if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r<=65535)t+=3;else{if(!(r<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}case`NULL`:return Z.Dr();default:return Z.vr()}}},Ec=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}return n?Z.Dr():this.kr(r.value?.stringValue,i.value?.stringValue)}},Dc=class extends Ec{kr(e,t){try{let n=function(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);switch(r){case`_`:t+=`.`;break;case`%`:t+=`.*`;break;case`\\`:case`.`:case`*`:case`?`:case`+`:case`^`:case`$`:case`|`:case`(`:case`)`:case`[`:case`]`:case`{`:case`}`:t+=`\\`+r;break;default:t+=r}}return`^`+t+`$`}(t),r=at.compile(n);return Z.newValue({booleanValue:r.matches(e)})}catch(e){return dt(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),Z.vr()}}},Oc=class extends Ec{kr(e,t){try{let n=at.compile(t);return Z.newValue({booleanValue:n.matcher(e).find()})}catch{return dt(`Invalid regex pattern found in regex_contains: ${t}, returning error`),Z.vr()}}},kc=class extends Ec{kr(e,t){try{return Z.newValue({booleanValue:at.compile(t).matches(e)})}catch{return dt(`Invalid regex pattern found in regex_match: ${t}, returning error`),Z.vr()}}},Ac=class extends Ec{kr(e,t){return Z.newValue({booleanValue:e.includes(t)})}},jc=class extends Ec{kr(e,t){return Z.newValue({booleanValue:e.startsWith(t)})}},Mc=class extends Ec{kr(e,t){return Z.newValue({booleanValue:e.endsWith(t)})}},Nc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,29079);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},Pc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,60487);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},Fc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,28544);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.trim()});case`NULL`:return Z.Dr();default:return Z.vr()}}},Ic=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r=``,i=!1;for(let e of n)switch(e.type){case`STRING`:r+=e.value.stringValue;break;case`NULL`:i=!0;break;default:return Z.vr()}return i?Z.Dr():Z.newValue({stringValue:r})}},Lc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,4483);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`UNSET`:return Z.Sr();case`MAP`:break;default:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);if(r.type!==`STRING`)return Z.vr();let i=n.value?.mapValue?.fields?.[r.value?.stringValue];return i===void 0?Z.Sr():Z.newValue(i)}},Rc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=rr(r.value),o=rr(i.value);if(a===void 0||o===void 0||a.values?.length!==o.values?.length)return Z.vr();let s=this.qr(a,o);return s===void 0||isNaN(s)?Z.vr():Z.newValue({doubleValue:s})}},zc=class extends Rc{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return;let i=0,a=0,o=0;for(let e=0;e<n.length;e++){if(!Zn(n[e])||!Zn(r[e]))return;let t=Fs(n[e]),s=Fs(r[e]);i+=t*s,a+=t*t,o+=s*s}let s=Math.sqrt(a)*Math.sqrt(o);if(s!==0)return 1-Math.max(-1,Math.min(1,i/s))}},Bc=class extends Rc{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!Zn(n[e])||!Zn(r[e]))return;i+=Fs(n[e])*Fs(r[e])}return i}},Vc=class extends Rc{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!Zn(n[e])||!Zn(r[e]))return;let t=Fs(n[e]),a=Fs(r[e]);i+=(t-a)**2}return Math.sqrt(i)}},Hc=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,39044);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`VECTOR`:{let e=rr(n.value);return Z.newValue({integerValue:e?.values?.length??0})}case`NULL`:return Z.Dr();default:return Z.vr()}}},Uc=BigInt(-62135596800),Wc=BigInt(253402300799),Gc=BigInt(1e3),Kc=BigInt(1e6),qc=Uc*Gc,Jc=Wc*Gc+BigInt(999),Yc=Uc*Kc,Xc=Wc*Kc+BigInt(999999);function Zc(e){return e>=Yc&&e<=Xc}function Qc(e){return e>=Uc&&e<=Wc}function $c(e,t){let n=BigInt(e);return!(n<Uc||n>Wc)&&!(t<0||t>=1e9)&&(n!==Uc||t===0)&&!(n===Wc&&t>999999999)}function el(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function tl(e){return BigInt(e.seconds)*Kc+BigInt(Math.trunc(e.nanoseconds/1e3))}var nl=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return this.toTimestamp(BigInt(n.value.integerValue));case`NULL`:return Z.Dr();default:return Z.vr()}}},rl=class extends nl{toTimestamp(e){if(!Zc(e))return Z.vr();let t=Number(e/Kc),n=Number(e%Kc*BigInt(1e3)),r=el(t,n);return t=r.seconds,n=r.nanos,$c(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},il=class extends nl{toTimestamp(e){if(!function(e){return e>=qc&&e<=Jc}(e))return Z.vr();let t=Number(e/Gc),n=Number(e%Gc*BigInt(1e6)),r=el(t,n);return t=r.seconds,n=r.nanos,$c(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},al=class extends nl{toTimestamp(e){if(!Qc(e))return Z.vr();let t=Number(e);return Z.newValue({timestampValue:{seconds:t,nanos:0}})}},ol=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`TIMESTAMP`:break;case`NULL`:return Z.Dr();default:return Z.vr()}let r=Qi(n.value.timestampValue);return $c(r.seconds,r.nanoseconds)?this.$r(r):Z.vr()}},sl=class extends ol{$r(e){let t=tl(e);return Zc(t)?Z.newValue({integerValue:`${t.toString()}`}):Z.vr()}},cl=class extends ol{$r(e){let t=tl(e),n=t/BigInt(1e3),r=t%BigInt(1e3);return n>BigInt(0)||r===BigInt(0)?Z.newValue({integerValue:n.toString()}):Z.newValue({integerValue:(n-BigInt(1)).toString()})}},ll=class extends ol{$r(e){let t=BigInt(e.seconds);return Qc(t)?Z.newValue({integerValue:t.toString()}):Z.vr()}},ul=class{constructor(e){this.expr=e}evaluate(e,t){A(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`TIMESTAMP`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t),a;switch(i.type){case`STRING`:if(a=function(e){switch(e){case`microsecond`:return`microsecond`;case`millisecond`:return`millisecond`;case`second`:return`second`;case`minute`:return`minute`;case`hour`:return`hour`;case`day`:return`day`;default:return}}(i.value.stringValue),a===void 0)return Z.vr();break;case`NULL`:n=!0;break;default:return Z.vr()}let o=Q(this.expr.params[2]).evaluate(e,t);switch(o.type){case`INT`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let s=BigInt(o.value.integerValue),c;try{switch(a){case`microsecond`:c=s;break;case`millisecond`:c=s*BigInt(1e3);break;case`second`:c=s*BigInt(1e6);break;case`minute`:c=s*BigInt(6e7);break;case`hour`:c=s*BigInt(36e8);break;case`day`:c=s*BigInt(864e8);break;default:return Z.vr()}if(a!==`microsecond`&&s!==BigInt(0)&&c/s!==BigInt(this.Kr(a)))return Z.vr()}catch(e){return dt(`Error during timestamp arithmetic: ${e}`),Z.vr()}let l=Qi(r.value.timestampValue);if(!$c(l.seconds,l.nanoseconds))return Z.vr();let u=tl(l),d=this.Wr(u,c);if(!Zc(d))return Z.vr();let f=Number(d/Kc),p=d%Kc,ee=Number((p<0?p+Kc:p)*BigInt(1e3)),te=p<0?f-1:f;return $c(te,ee)?Z.newValue({timestampValue:{seconds:te,nanos:ee}}):Z.vr()}Kr(e){switch(e){case`millisecond`:return 1e3;case`second`:return 1e6;case`minute`:return 6e7;case`hour`:return 36e8;case`day`:return 864e8;default:return 1}}},dl=class extends ul{Wr(e,t){return e+t}},fl=class extends ul{Wr(e,t){return e-t}};function pl(e){if((e=js(e))instanceof Jo)return`fld(${e.fieldName})`;if(e instanceof Zo)return`cst(${function(e){return e===null?`null`:typeof e==`number`?e.toString():typeof e==`string`?`"${e}"`:e instanceof po?`ref(${e.path})`:e instanceof go?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof X)return`fn(${e.name},[${e.params.map(pl).join(`,`)}])`;if(e.expressionType===`ListOfExpressions`)return`list([${e.Rr.map(pl).join(`,`)}])`;throw Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function ml(e){if(e instanceof us)return`${e._name}(${hl(e.fields)})`;if(e instanceof ds){let t=`${e._name}(${hl(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${hl(e.groups)})`),t}if(e instanceof fs)return`${e._name}(${hl(e.groups)})`;if(e instanceof ps)return`${e._name}(${e.Vr})`;if(e instanceof ms)return`${e._name}(${e.collectionId})`;if(e instanceof hs)return`${e._name}()`;if(e instanceof gs)return`${e._name}(${e.dr.sort()})`;if(e instanceof _s)return`${e._name}(${pl(e.condition)})`;if(e instanceof vs)return`${e._name}(${e.limit})`;if(e instanceof xs)return`${e._name}(${function(e){return e.map((e=>`${pl(e.expr)}${e.direction}`)).join(`,`)}(e.orderings)})`;throw Error(`Unrecognized stage ${e._name}`)}function hl(e){return`${Array.from(e.entries()).sort().map((([e,t])=>`${e}=${pl(t)}`)).join(`,`)}`}function gl(e){return e.stages.map((e=>ml(e))).join(`|`)}function _l(e,t){return gl(e)===gl(t)}function vl(e){return e instanceof ws}function yl(e){return vl(e)?gl(e):Ai(e)}function bl(e){return vl(e)?gl(e):function(e){return`${gi(Ei(e))}|lt:${e.limitType}`}(e)}function xl(e,t){return e instanceof ws&&t instanceof ws?_l(e,t):!(e instanceof ws&&!(t instanceof ws)||!(e instanceof ws)&&t instanceof ws)&&ki(e,t)}function Sl(e){return vi(e)?gl(e):gi(e)}function Cl(e,t){return e instanceof ws&&t instanceof ws?_l(e,t):!(e instanceof ws&&!(t instanceof ws)||!(e instanceof ws)&&t instanceof ws)&&_i(e,t)}var wl=class{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];r.key.isEqual(e.key)&&Pr(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=Fr(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=Fr(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=Ui();return this.mutations.forEach((r=>{let i=e.get(r.key),a=i.overlayedDocument,o=this.applyToLocalView(a,i.mutatedFields);o=t.has(r.key)?null:o;let s=Nr(a,o);s!==null&&n.set(r.key,s),a.isValidDocument()||a.convertToNoDocument(B.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),qi())}isEqual(e){return this.batchId===e.batchId&&kt(this.mutations,e.mutations,((e,t)=>Lr(e,t)))&&kt(this.baseMutations,e.baseMutations,((e,t)=>Lr(e,t)))}},Tl=class e{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(t,n,r){A(t.mutations.length===r.length,58842,{Qr:t.mutations.length,Gr:r.length});let i=function(){return Gi}(),a=t.mutations;for(let e=0;e<a.length;e++)i=i.insert(a[e].key,r[e].version);return new e(t,n,r,i)}},El=class{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}},Dl=class{constructor(e){this.zr=e}};function Ol(e){let t=fa({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType===`LAST`?Oi(t,t.limit,`L`):t}var kl=class{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if(`nullValue`in e)this.ei(t,5);else if(`booleanValue`in e)this.ei(t,10),t.ti(+!!e.booleanValue);else if(`integerValue`in e)this.ei(t,15),t.ti(U(e.integerValue));else if(`doubleValue`in e){let n=U(e.doubleValue);isNaN(n)?this.ei(t,13):(this.ei(t,15),nn(n)?t.ti(0):t.ti(n))}else if(`timestampValue`in e){let n=e.timestampValue;this.ei(t,20),typeof n==`string`&&(n=Sn(n)),t.ni(`${n.seconds||``}`),t.ti(n.nanos||0)}else if(`stringValue`in e)this.ri(e.stringValue,t),this.ii(t);else if(`bytesValue`in e)this.ei(t,30),t.si(Cn(e.bytesValue)),this.ii(t);else if(`referenceValue`in e)this._i(e.referenceValue,t);else if(`geoPointValue`in e){let n=e.geoPointValue;this.ei(t,45),t.ti(n.latitude||0),t.ti(n.longitude||0)}else`mapValue`in e?ar(e)?this.ei(t,2**53-1):nr(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):`arrayValue`in e?(this.ui(e.arrayValue,t),this.ii(t)):k(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){let n=e.fields||{};this.ei(t,55);for(let e of Object.keys(n))this.ri(e,t),this.Zr(n[e],t)}oi(e,t){let n=e.fields||{};this.ei(t,53);let r=zn,i=n[r].arrayValue?.values?.length||0;this.ei(t,15),t.ti(U(i)),this.ri(r,t),this.Zr(n[r],t)}ui(e,t){let n=e.values||[];this.ei(t,50);for(let e of n)this.Zr(e,t)}_i(e,t){this.ei(t,37),I.fromName(e).path.forEach((e=>{this.ei(t,60),this.li(e,t)}))}ei(e,t){e.ti(t)}ii(e){e.ti(2)}};kl.Ei=new kl;var Al=class{constructor(){this.Hi=new jl}addToCollectionParentIndex(e,t){return this.Hi.add(t),V.resolve()}getCollectionParents(e,t){return V.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return V.resolve()}deleteFieldIndex(e,t){return V.resolve()}deleteAllFieldIndexes(e){return V.resolve()}createTargetIndexes(e,t){return V.resolve()}getDocumentsMatchingTarget(e,t){return V.resolve(null)}getIndexType(e,t){return V.resolve(0)}getFieldIndexes(e,t){return V.resolve([])}getNextCollectionGroupToUpdate(e){return V.resolve(null)}getMinOffset(e,t){return V.resolve(Kt.min())}getMinOffsetFromCollectionGroup(e,t){return V.resolve(Kt.min())}updateCollectionGroup(e,t,n){return V.resolve()}updateIndexEntries(e,t){return V.resolve()}},jl=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new pn(F.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new pn(F.comparator)).toArray()}},Ml=class e{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new e(0)}static Cs(){return new e(-1)}};function Nl(e,t){let n=t;for(let t of e.stages)n=Fl({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}function Pl(e,t){return Nl(e,[t]).length>0}function Fl(e,t,n){if(t instanceof ps)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.Vr))}(0,t,n);if(t instanceof _s)return function(e,t,n){return n.filter((n=>{let r=As(Q(t.condition).evaluate(e,n));return r!==void 0&&Hn(r,Vn)}))}(e,t,n);if(t instanceof ms)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId))}(0,t,n);if(t instanceof hs)return function(e,t,n){return n.filter((e=>e.isFoundDocument()))}(0,0,n);if(t instanceof gs)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&t.mr.has(e.key.path.toStringWithLeadingSlash())))}(0,t,n);if(t instanceof vs)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof xs)return function(e,t,n){let r=t.orderings.map((e=>({ks:Q(e.expr),direction:e.direction})));return[...n].sort(((t,n)=>{for(let{ks:i,direction:a}of r){let r=As(i.evaluate(e,t)),o=As(i.evaluate(e,n)),s=K(r??Bn,o??Bn);if(s!==0)return a===`ascending`?s:-s}return 0}))}(e,t,n);throw Error(`Unknown stage: ${t._name}`)}function Il(e){let t=function(e){for(let t=e.stages.length-1;t>=0;t--){let n=e.stages[t];if(n instanceof xs)return n.orderings}throw Error(`Pipeline must contain at least one Sort stage`)}(e);return(n,r)=>{for(let i of t){let t=As(Q(i.expr).evaluate({serializer:e.serializer},n)),a=As(Q(i.expr).evaluate({serializer:e.serializer},r)),o=K(t||Bn,a||Bn);if(o!==0)return i.direction===`ascending`?o:-o}return 0}}var Ll=class{constructor(){this.changes=new Ii((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,pi.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n===void 0?this.getFromCache(e,t):V.resolve(n)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}},Rl=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}},zl=class{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(n!==null&&Fr(n.mutation,e,H.empty(),z.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,qi()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=qi()){let r=Hi();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=Bi();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){let n=Hi();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,qi())))}populateOverlays(e,t,n){let r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=Ri(),a=Wi(),o=function(){return Wi()}();return t.forEach(((e,t)=>{let o=n.get(t.key);r.has(t.key)&&(o===void 0||o.mutation instanceof zr)?i=i.insert(t.key,t):o===void 0?a.set(t.key,H.empty()):(a.set(t.key,o.mutation.getFieldMask()),Fr(o.mutation,t,o.mutation.getFieldMask(),z.now()))})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>a.set(e,t))),t.forEach(((e,t)=>o.set(e,new Rl(t,a.get(e)??null)))),o)))}recalculateAndSaveOverlays(e,t){let n=Wi(),r=new un(((e,t)=>e-t)),i=qi();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(let i of e)i.keys().forEach((e=>{let a=t.get(e);if(a===null)return;let o=n.get(e)||H.empty();o=i.applyToLocalView(a,o),n.set(e,o);let s=(r.get(i.batchId)||qi()).add(e);r=r.insert(i.batchId,s)}))})).next((()=>{let a=[],o=r.getReverseIterator();for(;o.hasNext();){let r=o.getNext(),s=r.key,c=r.value,l=Ui();c.forEach((e=>{if(!i.has(e)){let r=Nr(t.get(e),n.get(e));r!==null&&l.set(e,r),i=i.add(e)}})),a.push(this.documentOverlayCache.saveOverlays(e,s,l))}return V.waitFor(a)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return vl(t)?this.getDocumentsMatchingPipeline(e,t,n,r):Ci(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):wi(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{let a=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):V.resolve(Hi()),o=Ht,s=i;return a.next((t=>V.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?V.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{s=s.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,s,t,qi()))).next((e=>({batchId:o,changes:Vi(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new I(t)).next((e=>{let t=Bi();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,a=Bi();return this.indexManager.getCollectionParents(e,i).next((o=>V.forEach(o,(o=>{let s=function(e,t){return new yi(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return this.getDocumentsMatchingCollectionQuery(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>ji(t,e)))))}getDocumentsMatchingPipeline(e,t,n,r){if(Ts(t)===`collection_group`){let i=Ds(t),a=Bi();return this.indexManager.getCollectionParents(e,i).next((o=>V.forEach(o,(o=>{let s=function(e,t){let n=e.stages.map((e=>e instanceof ms?new ps(t.canonicalString(),{}):e));return new ws(e.serializer,n)}(t,o.child(i));return this.getDocumentsMatchingPipeline(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}{let i;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next((a=>{switch(i=a,Ts(t)){case`collection`:return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r);case`documents`:let a=qi();for(let e of ks(t))a=a.add(I.fromPath(e));return this.remoteDocumentCache.getEntries(e,a);case`database`:return this.remoteDocumentCache.getAllEntries(e);default:throw new N(`invalid-argument`,`Invalid pipeline source to execute offline: ${gl(t)}`)}})).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>Pl(t,e)))))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach(((e,n)=>{let r=n.getKey();t.get(r)===null&&(t=t.insert(r,pi.newInvalidDocument(r)))}));let r=Bi();return t.forEach(((t,i)=>{let a=e.get(t);a!==void 0&&Fr(a.mutation,i,H.empty(),z.now()),n(i)&&(r=r.insert(t,i))})),r}getOverlaysForPipeline(e,t,n){switch(Ts(t)){case`collection`:return this.documentOverlayCache.getOverlaysForCollection(e,F.fromString(Es(t)),n);case`collection_group`:throw new N(`invalid-argument`,`Unexpected collection group pipeline: ${gl(t)}`);case`documents`:return this.documentOverlayCache.getOverlays(e,ks(t).map((e=>I.fromPath(e))));case`database`:return this.documentOverlayCache.getAllOverlays(e,n);default:throw new N(`invalid-argument`,`Failed to get overlays for pipeline: ${gl(t)}`)}}},Bl=class{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return V.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:ta(e.createTime)}}(t)),V.resolve()}getNamedQuery(e,t){return V.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,function(e){return{name:e.name,query:Ol(e.bundledQuery),readTime:ta(e.readTime)}}(t)),V.resolve()}},Vl=class{constructor(){this.overlays=new un(I.comparator),this.Ys=new Map}getOverlay(e,t){return V.resolve(this.overlays.get(t))}getOverlays(e,t){let n=Hi();return V.forEach(t,(t=>this.getOverlay(e,t).next((e=>{e!==null&&n.set(t,e)})))).next((()=>n))}getAllOverlays(e,t){let n=Hi();return this.overlays.forEach(((e,r)=>{r.largestBatchId>t&&n.set(e,r)})),V.resolve(n)}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.Hr(e,t,r)})),V.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.Ys.get(n);return r!==void 0&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.Ys.delete(n)),V.resolve()}getOverlaysForCollection(e,t,n){let r=Hi(),i=t.length+1,a=new I(t.child(``)),o=this.overlays.getIteratorFrom(a);for(;o.hasNext();){let e=o.getNext().value,a=e.getKey();if(!t.isPrefixOf(a.path))break;a.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return V.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new un(((e,t)=>e-t)),a=this.overlays.getIterator();for(;a.hasNext();){let e=a.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);t===null&&(t=Hi(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=Hi(),s=i.getIterator();for(;s.hasNext()&&(s.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=r)););return V.resolve(o)}Hr(e,t,n){let r=this.overlays.get(n.key);if(r!==null){let e=this.Ys.get(r.largestBatchId).delete(n.key);this.Ys.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new El(t,n));let i=this.Ys.get(t);i===void 0&&(i=qi(),this.Ys.set(t,i)),this.Ys.set(t,i.add(n.key))}},Hl=class{constructor(){this.sessionToken=bn.EMPTY_BYTE_STRING}getSessionToken(e){return V.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,V.resolve()}},Ul=class{constructor(){this.Zs=new pn($.Xs),this.e_=new pn($.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){let n=new $(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}n_(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.r_(new $(e,t))}i_(e,t){e.forEach((e=>this.removeReference(e,t)))}s_(e){let t=new I(new F([])),n=new $(t,e),r=new $(t,e+1),i=[];return this.e_.forEachInRange([n,r],(e=>{this.r_(e),i.push(e.key)})),i}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){let t=new I(new F([])),n=new $(t,e),r=new $(t,e+1),i=qi();return this.e_.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){let t=new $(e,0),n=this.Zs.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},$=class{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return I.comparator(e.key,t.key)||P(e.a_,t.a_)}static t_(e,t){return P(e.a_,t.a_)||I.comparator(e.key,t.key)}},Wl=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new pn($.Xs)}checkEmpty(e){return V.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,r){let i=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new wl(i,t,n,r);this.mutationQueue.push(a);for(let t of r)this.u_=this.u_.add(new $(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return V.resolve(a)}lookupMutationBatch(e,t){return V.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,r=this.l_(n),i=r<0?0:r;return V.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return V.resolve(this.mutationQueue.length===0?en:this.gs-1)}getAllMutationBatches(e){return V.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new $(t,0),r=new $(t,1/0),i=[];return this.u_.forEachInRange([n,r],(e=>{let t=this.c_(e.a_);i.push(t)})),V.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new pn(P);return t.forEach((e=>{let t=new $(e,0),r=new $(e,1/0);this.u_.forEachInRange([t,r],(e=>{n=n.add(e.a_)}))})),V.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;I.isDocumentKey(i)||(i=i.child(``));let a=new $(new I(i),0),o=new pn(P);return this.u_.forEachWhile((e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.a_)),!0)}),a),V.resolve(this.E_(o))}E_(e){let t=[];return e.forEach((e=>{let n=this.c_(e);n!==null&&t.push(n)})),t}removeMutationBatch(e,t){A(this.h_(t.batchId,`removed`)===0,55003),this.mutationQueue.shift();let n=this.u_;return V.forEach(t.mutations,(r=>{let i=new $(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.u_=n}))}bs(e){}containsKey(e,t){let n=new $(t,0),r=this.u_.firstAfterOrEqual(n);return V.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,V.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){let t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}},Gl=class{constructor(e){this.T_=e,this.docs=function(){return new un(I.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return V.resolve(n?n.document.mutableCopy():pi.newInvalidDocument(t))}getEntries(e,t){let n=Ri();return t.forEach((e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():pi.newInvalidDocument(e))})),V.resolve(n)}getAllEntries(e){let t=Ri();return this.docs.forEach(((e,n)=>{t=t.insert(e,n.document)})),V.resolve(t)}getDocumentsMatchingQuery(e,t,n,r){let i,a;vl(t)?(i=F.fromString(Es(t)),a=e=>Pl(t,e)):(i=t.path,a=e=>ji(t,e));let o=Ri(),s=new I(i.child(`__id-9223372036854775808__`)),c=this.docs.getIteratorFrom(s);for(;c.hasNext();){let{key:e,value:{document:t}}=c.getNext();if(!i.isPrefixOf(e.path))break;e.path.length>i.length+1||qt(Gt(t),n)<=0||(r.has(t.key)||a(t))&&(o=o.insert(t.key,t.mutableCopy()))}return V.resolve(o)}getAllFromCollectionGroup(e,t,n,r){k(9500)}P_(e,t){return V.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Kl(this)}getSize(e){return V.resolve(this.size)}},Kl=class extends Ll{constructor(e){super(),this.zs=e}applyChanges(e){let t=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.zs.addEntry(e,r)):this.zs.removeEntry(n)})),V.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}},ql=class{constructor(e){this.persistence=e,this.R_=new Ii((e=>Sl(e)),Cl),this.lastRemoteSnapshotVersion=B.min(),this.highestTargetId=0,this.I_=0,this.A_=new Ul,this.targetCount=0,this.V_=Ml.xs()}forEachTarget(e,t){return this.R_.forEach(((e,n)=>t(n))),V.resolve()}getLastRemoteSnapshotVersion(e){return V.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return V.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),V.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),V.resolve()}Ms(e){this.R_.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.V_=new Ml(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,V.resolve()}updateTargetData(e,t){return this.Ms(t),V.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),--this.targetCount,V.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.R_.forEach(((a,o)=>{o.sequenceNumber<=t&&n.get(o.targetId)===null&&(this.R_.delete(a),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)})),V.waitFor(i).next((()=>r))}getTargetCount(e){return V.resolve(this.targetCount)}getTargetData(e,t){let n=this.R_.get(t)||null;return V.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),V.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),V.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),V.resolve()}getMatchingKeysForTargetId(e,t){let n=this.A_.o_(t);return V.resolve(n)}containsKey(e,t){return V.resolve(this.A_.containsKey(t))}},Jl=class{constructor(e,t){this.d_={},this.overlays={},this.f_=new $t(0),this.m_=!1,this.m_=!0,this.p_=new Hl,this.referenceDelegate=e(this),this.g_=new ql(this),this.indexManager=new Al,this.remoteDocumentCache=function(e){return new Gl(e)}((e=>this.referenceDelegate.y_(e))),this.serializer=new Dl(t),this.w_=new Bl(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Vl,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new Wl(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){O(`MemoryPersistence`,`Starting transaction:`,e);let r=new Yl(this.f_.next());return this.referenceDelegate.b_(),n(r).next((e=>this.referenceDelegate.v_(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}S_(e,t){return V.or(Object.values(this.d_).map((n=>()=>n.containsKey(e,t))))}},Yl=class extends Yt{constructor(e){super(),this.currentSequenceNumber=e}},Xl=class e{constructor(e){this.persistence=e,this.D_=new Ul,this.x_=null}static C_(t){return new e(t)}get F_(){if(this.x_)return this.x_;throw k(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),V.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),V.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),V.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach((e=>this.F_.add(e.toString())));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.F_.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return V.forEach(this.F_,(n=>{let r=I.fromPath(n);return this.O_(e,r).next((e=>{e||t.removeEntry(r,B.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((e=>{e?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return V.or([()=>V.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}},Zl=class e{constructor(e,t){this.persistence=e,this.M_=new Ii((e=>sn(e.path)),((e,t)=>e.isEqual(t))),this.garbageCollector=ao(this,t)}static C_(t,n){return new e(t,n)}b_(){}v_(e){return V.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){let t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((e=>t.next((t=>e+t))))}Ls(e){let t=0;return this.Er(e,(e=>{t++})).next((()=>t))}Er(e,t){return V.forEach(this.M_,((n,r)=>this.Us(e,n,r).next((e=>e?V.resolve():t(r)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.P_(e,(r=>this.Us(e,r,t).next((e=>{e||(n++,i.removeEntry(r,B.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),V.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),V.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),V.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),V.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Jn(e.data.value)),t}Us(e,t,n){return V.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.M_.get(t);return V.resolve(e!==void 0&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}},Ql=class e{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=r}static vo(t,n){let r=qi(),i=qi();for(let e of n.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new e(t,n.fromCache,r,i)}};function $l(e,t){return I.comparator(e.key,t.key)}var eu=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}},tu=class{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=function(){return a()?8:Zt(t())>0?6:4}()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.Oo(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.Mo(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;let n=new eu;return this.No(e,t,n).next((r=>{if(i.result=r,this.Do)return this.Lo(e,t,n,r.size)}))})).next((()=>i.result))}Lo(e,t,n,r){return vl(t)?V.resolve():n.documentReadCount<this.xo?(lt()<=c.DEBUG&&O(`QueryEngine`,`SDK will not create cache indexes for query:`,Ai(t),`since it only creates cache indexes for collection contains`,`more than or equal to`,this.xo,`documents`),V.resolve()):(lt()<=c.DEBUG&&O(`QueryEngine`,`Query:`,Ai(t),`scans`,n.documentReadCount,`local documents and returns`,r,`documents as results.`),n.documentReadCount>this.Co*r?(lt()<=c.DEBUG&&O(`QueryEngine`,`The SDK decides to create cache indexes for query:`,Ai(t),`as using cache indexes may help improve performance.`),this.indexManager.createTargetIndexes(e,Ei(t))):V.resolve())}Oo(e,t){if(vl(t))return V.resolve(null);let n=t;if(Si(n))return V.resolve(null);let r=Ei(n);return this.indexManager.getIndexType(e,r).next((t=>t===0?null:(n.limit!==null&&t===1&&(n=Oi(n,null,`F`),r=Ei(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next((t=>{let i=qi(...t);return this.Fo.getDocuments(e,i).next((t=>this.indexManager.getMinOffset(e,r).next((r=>{let a=this.Bo(n,t);return this.Uo(n,a,i,r.readTime)?this.Oo(e,Oi(n,null,`F`)):this.ko(e,a,n,r)}))))})))))}Mo(e,t,n,r){return(vl(t)?function(e){for(let t of e.stages){if(t instanceof vs||t instanceof ys)return!1;if(t instanceof _s){if(t.condition instanceof ts&&t.condition._expr.name===`exists`&&t.condition._expr.params[0]instanceof Jo&&t.condition._expr.params[0].fieldName===At)continue;return!1}}return!0}(t):Si(t))||r.isEqual(B.min())?V.resolve(null):this.Fo.getDocuments(e,n).next((i=>{let a=this.Bo(t,i);return this.Uo(t,a,n,r)?V.resolve(null):(lt()<=c.DEBUG&&O(`QueryEngine`,`Re-using previous result from %s to execute query: %s`,r.toString(),yl(t)),this.ko(e,a,t,Wt(r,Ht)).next((e=>e)))}))}Bo(e,t){let n,r;return vl(e)?(n=new pn($l),r=t=>Pl(e,t)):(n=new pn(Mi(e)),r=t=>ji(e,t)),t.forEach(((e,t)=>{r(t)&&(n=n.add(t))})),n}Uo(e,t,n,r){if(vl(e))return function(e){return e.stages.some((e=>e instanceof vs||e instanceof ys))}(e);if(e.limit===null)return!1;if(n.size!==t.size)return!0;let i=e.limitType===`F`?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}No(e,t,n){return lt()<=c.DEBUG&&O(`QueryEngine`,`Using full collection scan to execute query:`,yl(t)),this.Fo.getDocumentsMatchingQuery(e,t,Kt.min(),n)}ko(e,t,n,r){return this.Fo.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}},nu=`LocalStore`,ru=class{constructor(e,t,n,r){this.persistence=e,this.qo=t,this.serializer=r,this.$o=new un(P),this.Ko=new Ii((e=>Sl(e)),Cl),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new zl(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction(`Collect garbage`,`readwrite-primary`,(t=>e.collect(t,this.$o)))}};function iu(e,t,n,r){return new ru(e,t,n,r)}async function au(e,t){let n=j(e);return await n.persistence.runTransaction(`Handle user change`,`readonly`,(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n.Go(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{let i=[],a=[],o=qi();for(let e of r){i.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}for(let e of t){a.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({zo:e,removedBatchIds:i,addedBatchIds:a})))}))}))}function ou(e,t){let n=j(e);return n.persistence.runTransaction(`Acknowledge batch`,`readwrite-primary`,(e=>{let r=t.batch.keys(),i=n.Qo.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){let i=n.batch,a=i.keys(),o=V.resolve();return a.forEach((e=>{o=o.next((()=>r.getEntry(t,e))).next((t=>{let a=n.docVersions.get(e);A(a!==null,48541),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),o.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=qi();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,r)))}))}function su(e){let t=j(e);return t.persistence.runTransaction(`Get last remote snapshot version`,`readonly`,(e=>t.g_.getLastRemoteSnapshotVersion(e)))}function cu(e,t){let n=j(e);return n.persistence.runTransaction(`Get next mutation batch`,`readonly`,(e=>(t===void 0&&(t=en),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}var lu=class{constructor(){this.activeTargetIds=Yi()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},uu=class{constructor(){this.Ua=new lu,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||`not-current`}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new lu,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};function du(){return typeof document<`u`?document:null}var fu=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state=`Unknown`,this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa(`Unknown`),this.$a=this.asyncQueue.enqueueAfterDelay(`online_state_timeout`,1e4,(()=>(this.$a=null,this.Ga(`Backend didn't respond within 10 seconds.`),this.Qa(`Offline`),Promise.resolve()))))}za(e){this.state===`Online`?this.Qa(`Unknown`):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa(`Offline`)))}set(e){this.ja(),this.qa=0,e===`Online`&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){let t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(ut(t),this.Ka=!1):O(`OnlineStateTracker`,t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}},pu=`RemoteStore`,mu=class{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new Ml(1e3),this.eu=new Ml(1001),this.tu=new Set,this.nu=[],this.ru=i,this.ru.bt((e=>{n.enqueueAndForget((async()=>{_u(this)&&(O(pu,`Restarting streams for network reachability change.`),await async function(e){let t=j(e);t.tu.add(4),await gu(t),t.iu.set(`Unknown`),t.tu.delete(4),await hu(t)}(this))}))})),this.iu=new fu(n,r)}};async function hu(e){if(_u(e))for(let t of e.nu)await t(!0)}async function gu(e){for(let t of e.nu)await t(!1)}function _u(e){return j(e).tu.size===0}async function vu(e,t,n){if(!Qt(t))throw t;e.tu.add(1),await gu(e),e.iu.set(`Offline`),n||=()=>su(e.localStore),e.asyncQueue.enqueueRetryable((async()=>{O(pu,`Retrying IndexedDB access`),await n(),e.tu.delete(1),await hu(e)}))}function yu(e,t){return t().catch((n=>vu(e,n,t)))}async function bu(e){let t=j(e),n=ju(t),r=t.Ha.length>0?t.Ha[t.Ha.length-1].batchId:en;for(;xu(t);)try{let e=await cu(t.localStore,r);if(e===null){t.Ha.length===0&&n.Nn();break}r=e.batchId,Su(t,e)}catch(e){await vu(t,e)}Cu(t)&&wu(t)}function xu(e){return _u(e)&&e.Ha.length<10}function Su(e,t){e.Ha.push(t);let n=ju(e);n.Fn()&&n.Jn&&n.Yn(t.mutations)}function Cu(e){return _u(e)&&!ju(e).Cn()&&e.Ha.length>0}function wu(e){ju(e).start()}async function Tu(e){ju(e).er()}async function Eu(e){let t=ju(e);for(let n of e.Ha)t.Yn(n.mutations)}async function Du(e,t,n){let r=e.Ha.shift(),i=Tl.from(r,t,n);await yu(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await bu(e)}async function Ou(e,t){t&&ju(e).Jn&&await async function(e,t){if(function(e){return Pi(e)&&e!==M.ABORTED}(t.code)){let n=e.Ha.shift();ju(e).Mn(),await yu(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await bu(e)}}(e,t),Cu(e)&&wu(e)}async function ku(e,t){let n=j(e);n.asyncQueue.verifyOperationInProgress(),O(pu,`RemoteStore received new credentials`);let r=_u(n);n.tu.add(3),await gu(n),r&&n.iu.set(`Unknown`),await n.remoteSyncer.handleCredentialChange(t),n.tu.delete(3),await hu(n)}async function Au(e,t){let n=j(e);t?(n.tu.delete(2),await hu(n)):t||(n.tu.add(2),await gu(n),n.iu.set(`Unknown`))}function ju(e){return e.ou||(e.ou=function(e,t,n){let r=j(e);return r.nr(),new Ua(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:()=>Promise.resolve(),zt:Tu.bind(null,e),Ht:Ou.bind(null,e),Zn:Eu.bind(null,e),Xn:Du.bind(null,e)}),e.nu.push((async t=>{t?(e.ou.Mn(),await bu(e)):(await e.ou.stop(),e.Ha.length>0&&(O(pu,`Stopping write stream with ${e.Ha.length} pending writes`),e.Ha=[]))}))),e.ou}var Mu=class e{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new mt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,n,r,i,a){let o=Date.now()+r,s=new e(t,n,o,i,a);return s.start(r),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new N(M.CANCELLED,`Operation cancelled`+(e?`: `+e:``))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle===null?Promise.resolve():(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e))))))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function Nu(e,t){if(ut(`AsyncQueue`,`${t}: ${e}`),Qt(e))return new N(M.UNAVAILABLE,`${t}: ${e}`);throw e}var Pu=class{constructor(){this.queries=Fu(),this.onlineState=`Unknown`,this.Pu=new Set}terminate(){(function(e,t){let n=j(e),r=n.queries;n.queries=Fu(),r.forEach(((e,n)=>{for(let e of n.Eu)e.onError(t)}))})(this,new N(M.ABORTED,`Firestore shutting down`))}};function Fu(){return new Ii((e=>bl(e)),xl)}function Iu(e){e.Pu.forEach((e=>{e.next()}))}var Lu;(function(e){e.Default=`default`,e.Cache=`cache`})(Lu||={});var Ru=`SyncEngine`,zu=class{constructor(e,t,n,r,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Xu={},this.ec=new Ii((e=>bl(e)),xl),this.tc=new Map,this.nc=new Set,this.rc=new un(I.comparator),this.sc=new Map,this._c=new Ul,this.oc={},this.ac=new Map,this.uc=Ml.Cs(),this.onlineState=`Unknown`,this.cc=void 0}get isPrimaryClient(){return!0===this.cc}};async function Bu(e,t,n){let r=Ju(e);try{let e=await function(e,t){let n=j(e),r=z.now(),i=t.reduce(((e,t)=>e.add(t.key)),qi()),a,o;return n.persistence.runTransaction(`Locally write mutations`,`readwrite`,(e=>{let s=Ri(),c=qi();return n.Qo.getEntries(e,i).next((e=>{s=e,s.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,s))).next((i=>{a=i;let o=[];for(let e of t){let t=Ir(e,a.get(e.key).overlayedDocument);t!=null&&o.push(new zr(e.key,t,sr(t.value.mapValue),Ar.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)})).next((t=>{o=t;let r=t.applyToLocalDocumentSet(a,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Vi(a)})))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.oc[e.currentUser.toKey()];r||=new un(P),r=r.insert(t,n),e.oc[e.currentUser.toKey()]=r}(r,e.batchId,n),await Ku(r,e.changes),await bu(r.remoteStore)}catch(e){let t=Nu(e,`Failed to persist write`);n.reject(t)}}function Vu(e,t,n){let r=j(e);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){let e=[];r.ec.forEach(((n,r)=>{let i=r.view.Ru(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){let n=j(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(let e of n.Eu)e.Ru(t)&&(r=!0)})),r&&Iu(n)}(r.eventManager,t),e.length&&r.Xu.zn(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function Hu(e,t){let n=j(e),r=t.batch.batchId;try{let e=await ou(n.localStore,t);Gu(n,r,null),Wu(n,r),n.sharedClientState.updateMutationState(r,`acknowledged`),await Ku(n,e)}catch(e){await Xt(e)}}async function Uu(e,t,n){let r=j(e);try{let e=await function(e,t){let n=j(e);return n.persistence.runTransaction(`Reject batch`,`readwrite-primary`,(e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(A(t!==null,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);Gu(r,t,n),Wu(r,t),r.sharedClientState.updateMutationState(t,`rejected`,n),await Ku(r,e)}catch(e){await Xt(e)}}function Wu(e,t){(e.ac.get(t)||[]).forEach((e=>{e.resolve()})),e.ac.delete(t)}function Gu(e,t,n){let r=j(e),i=r.oc[r.currentUser.toKey()];if(i){let e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.oc[r.currentUser.toKey()]=i}}async function Ku(e,t,n){let r=j(e),i=[],a=[],o=[];r.ec.isEmpty()||(r.ec.forEach(((e,s)=>{o.push(r.lc(s,t,n).then((e=>{if((e||n)&&r.isPrimaryClient){let t=e?!e.fromCache:n?.targetChanges.get(s.targetId)?.current;r.sharedClientState.updateQueryState(s.targetId,t?`current`:`not-current`)}if(e){i.push(e);let t=Ql.vo(s.targetId,e);a.push(t)}})))})),await Promise.all(o),r.Xu.zn(i),await async function(e,t){let n=j(e);try{await n.persistence.runTransaction(`notifyLocalViewChanges`,`readwrite`,(e=>V.forEach(t,(t=>V.forEach(t.wo,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>V.forEach(t.bo,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!Qt(e))throw e;O(nu,`Failed to update sequence numbers: `+e)}for(let e of t){let t=e.targetId;if(!e.fromCache){let e=n.$o.get(t),r=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(r);n.$o=n.$o.insert(t,i)}}}(r.localStore,a))}async function qu(e,t){let n=j(e);if(!n.currentUser.isEqual(t)){O(Ru,`User change. New user:`,t.toKey());let e=await au(n.localStore,t);n.currentUser=t,function(e,t){e.ac.forEach((e=>{e.forEach((e=>{e.reject(new N(M.CANCELLED,t))}))})),e.ac.clear()}(n,`'waitForPendingWrites' promise is rejected due to a user change.`),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ku(n,e.zo)}}function Ju(e){let t=j(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Hu.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Uu.bind(null,t),t}var Yu=class{constructor(){this.kind=`memory`,this.synchronizeTabs=!1}async initialize(e){this.serializer=ba(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return iu(this.persistence,new tu,e.initialUser,this.serializer)}Ic(e){return new Jl(Xl.C_,this.serializer)}Rc(e){return new uu}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};Yu.provider={build:()=>new Yu};var Xu=class extends Yu{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){A(this.persistence.referenceDelegate instanceof Zl,46915);let n=this.persistence.referenceDelegate.garbageCollector;return new ro(n,e.asyncQueue,t)}Ic(e){let t=this.cacheSizeBytes===void 0?Qa.DEFAULT:Qa.withCacheSize(this.cacheSizeBytes);return new Jl((e=>Zl.C_(e,t)),this.serializer)}},Zu=class{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Vu(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=qu.bind(null,this.syncEngine),await Au(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new Pu}()}createDatastore(e){let t=ba(e.databaseInfo.databaseId),n=za(e.databaseInfo);return Ka(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new mu(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>Vu(this.syncEngine,e,0)),function(){return ka.C()?new ka:new Da}())}createSyncEngine(e,t){return function(e,t,n,r,i,a,o){let s=new zu(e,t,n,r,i,a);return o&&(s.cc=!0),s}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){let t=j(e);O(pu,`RemoteStore shutting down.`),t.tu.add(5),await gu(t),t.ru.shutdown(),t.iu.set(`Unknown`)}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};Zu.provider={build:()=>new Zu};var Qu=`FirestoreClient`,$u=class{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=D.UNAUTHENTICATED,this.clientId=wt.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async e=>{O(Qu,`Received user=`,e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(O(Qu,`Received new app check token=`,e),this.appCheckCredentialListener(e,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new mt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){let n=Nu(t,`Failed to shutdown persistence`);e.reject(n)}})),e.promise}};async function ed(e,t){e.asyncQueue.verifyOperationInProgress(),O(Qu,`Initializing OfflineComponentProvider`);let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await au(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function td(e,t){e.asyncQueue.verifyOperationInProgress();let n=await nd(e);O(Qu,`Initializing OnlineComponentProvider`),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>ku(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>ku(t.remoteStore,n))),e._onlineComponents=t}async function nd(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){O(Qu,`Using user provided OfflineComponentProvider`);try{await ed(e,e._uninitializedComponentsProvider._offline)}catch(t){let n=t;if(!function(e){return e.name===`FirebaseError`?e.code===M.FAILED_PRECONDITION||e.code===M.UNIMPLEMENTED:!(typeof DOMException<`u`&&e instanceof DOMException)||e.code===22||e.code===20||e.code===11}(n))throw n;dt(`Error using user provided cache. Falling back to memory cache: `+n),await ed(e,new Yu)}}else O(Qu,`Using default OfflineComponentProvider`),await ed(e,new Xu(void 0));return e._offlineComponents}async function rd(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(O(Qu,`Using user provided OnlineComponentProvider`),await td(e,e._uninitializedComponentsProvider._online)):(O(Qu,`Using default OnlineComponentProvider`),await td(e,new Zu))),e._onlineComponents}function id(e){return rd(e).then((e=>e.syncEngine))}function ad(e,t){let n=new mt;return e.asyncQueue.enqueueAndForget((async()=>Bu(await id(e),t,n))),n.promise}var od=`AsyncQueue`,sd=class{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new Ba(this,`async_queue_retry`),this.jc=()=>{let e=du();e&&O(od,`Visibility state changed to `+e.visibilityState),this.xn.gn()},this.Hc=e;let t=du();t&&typeof t.addEventListener==`function`&&t.addEventListener(`visibilitychange`,this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;let t=du();t&&typeof t.removeEventListener==`function`&&t.removeEventListener(`visibilitychange`,this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));let t=new mt;return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!Qt(e))throw e;O(od,`Operation failed with retryable error: `+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){let t=this.Hc.then((()=>(this.Qc=!0,e().catch((e=>{throw this.Wc=e,this.Qc=!1,ut(`INTERNAL UNHANDLED ERROR: `,cd(e)),e})).then((e=>(this.Qc=!1,e))))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);let r=Mu.createAndSchedule(this,e,t,n,(e=>this.Xc(e)));return this.Kc.push(r),r}Jc(){this.Wc&&k(47125,{el:cd(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(let t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(let t of this.Kc)if(t.skipDelay(),e!==`all`&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){let t=this.Kc.indexOf(e);this.Kc.splice(t,1)}};function cd(e){let t=e.message||``;return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+`
|
|
30
|
+
`+e.stack),t}var ld=class extends lo{constructor(e,t,n,r){super(e,t,n,r),this.type=`firestore`,this._queue=new sd,this._persistenceKey=r?.name||`[DEFAULT]`}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new sd(e),this._firestoreClient=void 0,await e}}};function ud(e,t){let r=typeof e==`object`?e:ee(),i=typeof e==`string`?e:t||Mn,a=u(r,`firestore`).getImmediate({identifier:i});if(!a._initialized){let e=n(`firestore`);e&&uo(a,...e)}return a}function dd(e){if(e._terminated)throw new N(M.FAILED_PRECONDITION,`The client has already been terminated.`);return e._firestoreClient||fd(e),e._firestoreClient}function fd(e){let t=e._freezeSettings(),n=Ya(e._databaseId,e._app?.options.appId||``,e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new $u(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){let t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}var pd=`@firebase/firestore`,md=`4.16.0`,hd=class{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new po(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new gd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){let t=this._document.data.field(Ao(`DocumentSnapshot.get`,e));if(t!==null)return this._userDataWriter.convertValue(t)}}},gd=class extends hd{data(){return super.data()}};function _d(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}var vd=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},yd=class e extends hd{constructor(e,t,n,r,i,a){super(e,t,n,r,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new bd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(Ao(`DocumentSnapshot.get`,e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new N(M.FAILED_PRECONDITION,`DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t=this._document,n={};return n.type=e._jsonSchemaVersion,n.bundle=``,n.bundleSource=`DocumentSnapshot`,n.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,`previous`),n.bundle=(this._firestore,this.ref.path,`NOT SUPPORTED`),n)}};yd._jsonSchemaVersion=`firestore/documentSnapshot/1.0`,yd._jsonSchema={type:L(`string`,yd._jsonSchemaVersion),bundleSource:L(`string`,`DocumentSnapshot`),bundleName:L(`string`),bundle:L(`string`)};var bd=class extends yd{data(e={}){return super.data(e)}},xd=class e{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new vd(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){let e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new bd(this._firestore,this._userDataWriter,n.key,n,new vd(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new N(M.INVALID_ARGUMENT,`To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().`);return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{vl(e._snapshot.query)?Il(e._snapshot.query):e.query._query;let r=new bd(e._firestore,e._userDataWriter,n.doc.key,n.doc,new vd(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:`added`,doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||e.type!==3)).map((t=>{let r=new bd(e._firestore,e._userDataWriter,t.doc.key,t.doc,new vd(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return t.type!==0&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),t.type!==1&&(n=n.add(t.doc),a=n.indexOf(t.doc.key)),{type:Sd(t.type),doc:r,oldIndex:i,newIndex:a}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new N(M.FAILED_PRECONDITION,`QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t={};t.type=e._jsonSchemaVersion,t.bundleSource=`QuerySnapshot`,t.bundleName=wt.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],r=[],i=[];return this.docs.forEach((e=>{e._document!==null&&(n.push(e._document),r.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,`previous`)),i.push(e.ref.path))})),t.bundle=(this._firestore,this.query._query,t.bundleName,`NOT SUPPORTED`),t}};function Sd(e){switch(e){case 0:return`added`;case 2:case 3:return`modified`;case 1:return`removed`;default:return k(61501,{type:e})}}xd._jsonSchemaVersion=`firestore/querySnapshot/1.0`,xd._jsonSchema={type:L(`string`,xd._jsonSchemaVersion),bundleSource:L(`string`,`QuerySnapshot`),bundleName:L(`string`),bundle:L(`string`)};function Cd(e,t,n){e=zt(e,po);let r=zt(e.firestore,ld),i=_d(e.converter,t,n);return wd(r,[Co(So(r),`setDoc`,e._key,i,e.converter!==null,n).toMutation(e._key,Ar.none())])}function wd(e,t){return ad(dd(e),t)}(function(e,t=!0){st(l),s(new te(`firestore`,((e,{instanceIdentifier:n,options:r})=>{let i=e.getProvider(`app`).getImmediate(),a=new ld(new vt(e.getProvider(`auth-internal`)),new St(i,e.getProvider(`app-check-internal`)),Pn(i,n),i);return r={useFetchStreams:t,...r},a._setSettings(r),a}),`PUBLIC`).setMultipleInstances(!0)),d(pd,md,e),d(pd,md,`esm2020`)})();export{ho as doc,ud as getFirestore,zo as increment,Ro as serverTimestamp,Cd as setDoc};
|