@veltdev/sdk-staging 6.0.0-beta.1 → 6.0.0-beta.3
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/app/models/data/comment-events.data.model.d.ts +29 -0
- package/app/utils/enums.d.ts +4 -0
- package/{chunk-JFRM6MNS.js → chunk-3BBCVKQ5.js} +1 -1
- package/{chunk-2KJNXU43.js → chunk-3NQO7KT2.js} +1 -1
- package/{chunk-7ZOGXD6Z.js → chunk-4ICELJP6.js} +1 -1
- package/{chunk-5FKOPJVO.js → chunk-4ZCY365X.js} +1 -1
- package/{chunk-6SOP2T3L.js → chunk-5WUV64V6.js} +1 -1
- package/{chunk-TXOYHDVN.js → chunk-5Y3GWVF6.js} +1 -1
- package/{chunk-UJMFCXYS.js → chunk-AHFE2P66.js} +1 -1
- package/{chunk-XMYVEF74.js → chunk-B53CSXPI.js} +1 -1
- package/{chunk-QE2MK6NF.js → chunk-D5GNGKKF.js} +1 -1
- package/{chunk-SALUJBOS.js → chunk-DNCQDV54.js} +1 -1
- package/{chunk-5B5CQEDX.js → chunk-DVSWAW3V.js} +1 -1
- package/{chunk-Q7BPHHBS.js → chunk-FGJMQQP7.js} +1 -1
- package/{chunk-USRSVPHC.js → chunk-JBQSOLQ4.js} +1 -1
- package/{chunk-BLIJMW4Z.js → chunk-K2RBYFUJ.js} +1 -1
- package/{chunk-BY627CV6.js → chunk-LE6ADPBN.js} +1 -1
- package/{chunk-7W553TUZ.js → chunk-LHFXU553.js} +1 -1
- package/{chunk-WANCOUQO.js → chunk-M3Z3OPKG.js} +1 -1
- package/{chunk-APIRNTKO.js → chunk-MTS7WSOI.js} +1 -1
- package/{chunk-25GEE4UD.js → chunk-NRZ34IWA.js} +1 -1
- package/{chunk-BG6MNCDK.js → chunk-OPFSWVO4.js} +1 -1
- package/{chunk-2HGBJS2C.js → chunk-PFQD3ZHE.js} +1 -1
- package/{chunk-DX4SZFHQ.js → chunk-PLHC4BWM.js} +1 -1
- package/{chunk-VFAO7EZK.js → chunk-PRJU4HJ5.js} +1 -1
- package/{chunk-ZVY2YW2G.js → chunk-QJJZ7GBM.js} +1 -1
- package/{chunk-YBQBSGLX.js → chunk-QMH32YWC.js} +1 -1
- package/{chunk-447SWJD2.js → chunk-S6JEPTGO.js} +1 -1
- package/{chunk-Y6QKEGWK.js → chunk-S7XRWLIA.js} +1 -1
- package/{chunk-J6J7I3SW.js → chunk-SYNPZ2XP.js} +1 -1
- package/{chunk-AOHSD4YE.js → chunk-TMURKDBH.js} +1 -1
- package/{chunk-AVMLJMVU.js → chunk-TO3QMX6L.js} +1 -1
- package/{chunk-N4SGYLNB.js → chunk-TV5S4EJP.js} +1 -1
- package/{chunk-IXZIBE27.js → chunk-X7A6MBGM.js} +1 -1
- package/{chunk-JWLHBAMV.js → chunk-YTPDG6FY.js} +9 -9
- package/package.json +1 -1
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +1 -1
- package/velt-comment.js +6 -6
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +1 -1
- package/velt-huddle.js +1 -1
- package/velt-live-state-sync.js +1 -1
- package/velt-notification.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +1 -1
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +1 -1
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +1 -1
- package/velt.js +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m3=Object.create;var jp=Object.defineProperty,p3=Object.defineProperties,E3=Object.getOwnPropertyDescriptor,_3=Object.getOwnPropertyDescriptors,T3=Object.getOwnPropertyNames,$p=Object.getOwnPropertySymbols,fP=Object.getPrototypeOf,uS=Object.prototype.hasOwnProperty,gP=Object.prototype.propertyIsEnumerable,I3=Reflect.get;var hP=(n,e,r)=>e in n?jp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,x=(n,e)=>{for(var r in e||={})uS.call(e,r)&&hP(n,r,e[r]);if($p)for(var r of $p(e))gP.call(e,r)&&hP(n,r,e[r]);return n},le=(n,e)=>p3(n,_3(e));var dS=(n,e)=>{var r={};for(var t in n)uS.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&$p)for(var t of $p(n))e.indexOf(t)<0&&gP.call(n,t)&&(r[t]=n[t]);return r};var pse=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ese=(n,e)=>{for(var r in e)jp(n,r,{get:e[r],enumerable:!0})},v3=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T3(e))!uS.call(n,i)&&i!==r&&jp(n,i,{get:()=>e[i],enumerable:!(t=E3(e,i))||t.enumerable});return n};var _se=(n,e,r)=>(r=n!=null?m3(fP(n)):{},v3(e||!n||!n.__esModule?jp(r,"default",{value:n,enumerable:!0}):r,n));var pc=(n,e,r)=>I3(fP(n),r,e);var I=(n,e,r)=>new Promise((t,i)=>{var o=c=>{try{a(r.next(c))}catch(l){i(l)}},s=c=>{try{a(r.throw(c))}catch(l){i(l)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(o,s);a((r=r.apply(n,e)).next())});function Se(n){return typeof n=="function"}function hS(n){return Se(n?.lift)}function ye(n){return e=>{if(hS(e))return e.lift(function(r){try{return n(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function js(n){let r=n(t=>{Error.call(t),t.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Hp=js(n=>function(r){n(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
2
2
|
${r.map((t,i)=>`${i+1}) ${t.toString()}`).join(`
|
|
3
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function Ec(n,e){if(n){let r=n.indexOf(e);0<=r&&n.splice(r,1)}}var gt=class n{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:t}=this;if(Se(t))try{t()}catch(o){e=o instanceof Hp?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{mP(o)}catch(s){e=e??[],s instanceof Hp?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Hp(e)}}add(e){var r;if(e&&e!==this)if(this.closed)mP(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&Ec(r,e)}remove(e){let{_finalizers:r}=this;r&&Ec(r,e),e instanceof n&&e._removeParent(this)}};gt.EMPTY=(()=>{let n=new gt;return n.closed=!0,n})();var fS=gt.EMPTY;function Wp(n){return n instanceof gt||n&&"closed"in n&&Se(n.remove)&&Se(n.add)&&Se(n.unsubscribe)}function mP(n){Se(n)?n():n.unsubscribe()}var Si={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var _u={setTimeout(n,e,...r){let{delegate:t}=_u;return t?.setTimeout?t.setTimeout(n,e,...r):setTimeout(n,e,...r)},clearTimeout(n){let{delegate:e}=_u;return(e?.clearTimeout||clearTimeout)(n)},delegate:void 0};function zp(n){_u.setTimeout(()=>{let{onUnhandledError:e}=Si;if(e)e(n);else throw n})}function Ai(){}var pP=gS("C",void 0,void 0);function EP(n){return gS("E",void 0,n)}function _P(n){return gS("N",n,void 0)}function gS(n,e,r){return{kind:n,value:e,error:r}}var _c=null;function Tu(n){if(Si.useDeprecatedSynchronousErrorHandling){let e=!_c;if(e&&(_c={errorThrown:!1,error:null}),n(),e){let{errorThrown:r,error:t}=_c;if(_c=null,r)throw t}}else n()}function TP(n){Si.useDeprecatedSynchronousErrorHandling&&_c&&(_c.errorThrown=!0,_c.error=n)}var Tc=class extends gt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Wp(e)&&e.add(this)):this.destination=Az}static create(e,r,t){return new Di(e,r,t)}next(e){this.isStopped?pS(_P(e),this):this._next(e)}error(e){this.isStopped?pS(EP(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?pS(pP,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},yz=Function.prototype.bind;function mS(n,e){return yz.call(n,e)}var ES=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(t){qp(t)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(t){qp(t)}else qp(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){qp(r)}}},Di=class extends Tc{constructor(e,r,t){super();let i;if(Se(e)||!e)i={next:e??void 0,error:r??void 0,complete:t??void 0};else{let o;this&&Si.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&mS(e.next,o),error:e.error&&mS(e.error,o),complete:e.complete&&mS(e.complete,o)}):i=e}this.destination=new ES(i)}};function qp(n){Si.useDeprecatedSynchronousErrorHandling?TP(n):zp(n)}function Sz(n){throw n}function pS(n,e){let{onStoppedNotification:r}=Si;r&&_u.setTimeout(()=>r(n,e))}var Az={closed:!0,next:Ai,error:Sz,complete:Ai};function Ee(n,e,r,t,i){return new _S(n,e,r,t,i)}var _S=class extends Tc{constructor(e,r,t,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=t?function(){try{t()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function Ct(n,e){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>n.call(e,o,i++)&&t.next(o)))})}var Iu=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ri(n){return n}function IP(n){return n.length===0?Ri:n.length===1?n[0]:function(r){return n.reduce((t,i)=>i(t),r)}}var ge=(()=>{class n{constructor(r){r&&(this._subscribe=r)}lift(r){let t=new n;return t.source=this,t.operator=r,t}subscribe(r,t,i){let o=Rz(r)?r:new Di(r,t,i);return Tu(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(t){r.error(t)}}forEach(r,t){return t=vP(t),new t((i,o)=>{let s=new Di({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)}[Iu](){return this}pipe(...r){return IP(r)(this)}toPromise(r){return r=vP(r),new r((t,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>t(o))})}}return n.create=e=>new n(e),n})();function vP(n){var e;return(e=n??Si.Promise)!==null&&e!==void 0?e:Promise}function Dz(n){return n&&Se(n.next)&&Se(n.error)&&Se(n.complete)}function Rz(n){return n&&n instanceof Tc||Dz(n)&&Wp(n)}var Ic=new ge(n=>n.complete());function Nt(n){return n<=0?()=>Ic:ye((e,r)=>{let t=0;e.subscribe(Ee(r,i=>{++t<=n&&(r.next(i),n<=t&&r.complete())}))})}function TS(n,e){var r={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(n);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(n,t[i])&&(r[t[i]]=n[t[i]]);return r}function SP(n,e,r,t){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(t.next(u))}catch(d){s(d)}}function c(u){try{l(t.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((t=t.apply(n,e||[])).next())})}function yP(n){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&n[e],t=0;if(r)return r.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&t>=n.length&&(n=void 0),{value:n&&n[t++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vc(n){return this instanceof vc?(this.v=n,this):new vc(n)}function AP(n,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r.apply(n,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(p){return Promise.resolve(p).then(g,d)}}function a(g,p){t[g]&&(i[g]=function(_){return new Promise(function(T,D){o.push([g,_,T,D])>1||c(g,_)})},p&&(i[g]=p(i[g])))}function c(g,p){try{l(t[g](p))}catch(_){f(o[0][3],_)}}function l(g){g.value instanceof vc?Promise.resolve(g.value.v).then(u,d):f(o[0][2],g)}function u(g){c("next",g)}function d(g){c("throw",g)}function f(g,p){g(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function DP(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],r;return e?e.call(n):(n=typeof yP=="function"?yP(n):n[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r);function t(o){r[o]=n[o]&&function(s){return new Promise(function(a,c){s=n[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var vu=n=>n&&typeof n.length=="number"&&typeof n!="function";function Kp(n){return Se(n?.then)}function Yp(n){return Se(n[Iu])}function Qp(n){return Symbol.asyncIterator&&Se(n?.[Symbol.asyncIterator])}function Xp(n){return new TypeError(`You provided ${n!==null&&typeof n=="object"?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Cz(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Jp=Cz();function Zp(n){return Se(n?.[Jp])}function eE(n){return AP(this,arguments,function*(){let r=n.getReader();try{for(;;){let{value:t,done:i}=yield vc(r.read());if(i)return yield vc(void 0);yield yield vc(t)}}finally{r.releaseLock()}})}function tE(n){return Se(n?.getReader)}function Me(n){if(n instanceof ge)return n;if(n!=null){if(Yp(n))return Nz(n);if(vu(n))return Oz(n);if(Kp(n))return wz(n);if(Qp(n))return RP(n);if(Zp(n))return bz(n);if(tE(n))return Lz(n)}throw Xp(n)}function Nz(n){return new ge(e=>{let r=n[Iu]();if(Se(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Oz(n){return new ge(e=>{for(let r=0;r<n.length&&!e.closed;r++)e.next(n[r]);e.complete()})}function wz(n){return new ge(e=>{n.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,zp)})}function bz(n){return new ge(e=>{for(let r of n)if(e.next(r),e.closed)return;e.complete()})}function RP(n){return new ge(e=>{Mz(n,e).catch(r=>e.error(r))})}function Lz(n){return RP(eE(n))}function Mz(n,e){var r,t,i,o;return SP(this,void 0,void 0,function*(){try{for(r=DP(n);t=yield r.next(),!t.done;){let s=t.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{t&&!t.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function CP(n){return ye((e,r)=>{let t=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let l=i;i=null,r.next(l)}s&&r.complete()},c=()=>{o=null,s&&r.complete()};e.subscribe(Ee(r,l=>{t=!0,i=l,o||Me(n(l)).subscribe(o=Ee(r,a,c))},()=>{s=!0,(!t||!o||o.closed)&&r.complete()}))})}var nE=class extends gt{constructor(e,r){super()}schedule(e,r=0){return this}};var Tf={setInterval(n,e,...r){let{delegate:t}=Tf;return t?.setInterval?t.setInterval(n,e,...r):setInterval(n,e,...r)},clearInterval(n){let{delegate:e}=Tf;return(e?.clearInterval||clearInterval)(n)},delegate:void 0};var so=class extends nE{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var t;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(t=this.id)!==null&&t!==void 0?t:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,t=0){return Tf.setInterval(e.flush.bind(e,this),t)}recycleAsyncId(e,r,t=0){if(t!=null&&this.delay===t&&this.pending===!1)return r;r!=null&&Tf.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let t=this._execute(e,r);if(t)return t;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let t=!1,i;try{this.work(e)}catch(o){t=!0,i=o||new Error("Scheduled action threw falsy error")}if(t)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:t}=r;this.work=this.state=this.scheduler=null,this.pending=!1,Ec(t,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var yc={now(){return(yc.delegate||Date).now()},delegate:void 0};var yu=class n{constructor(e,r=n.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,t){return new this.schedulerActionCtor(this,e).schedule(t,r)}};yu.now=yc.now;var ao=class extends yu{constructor(e,r=yu.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let t;this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}}};var Hn=new ao(so),IS=Hn;function rE(n){return n&&Se(n.schedule)}function iE(n){return n instanceof Date&&!isNaN(n)}function Ci(n=0,e,r=IS){let t=-1;return e!=null&&(rE(e)?r=e:t=e),new ge(i=>{let o=iE(n)?+n-r.now():n;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=t?this.schedule(void 0,t):i.complete())},o)})}function Pz(n,e=Hn){return CP(()=>Ci(n,e))}function vS(n){return n[n.length-1]}function oE(n){return Se(vS(n))?n.pop():void 0}function co(n){return rE(vS(n))?n.pop():void 0}function NP(n,e){return typeof vS(n)=="number"?n.pop():e}function Wn(n,e,r,t=0,i=!1){let o=e.schedule(function(){r(),i?n.add(this.schedule(null,t)):this.unsubscribe()},t);if(n.add(o),!i)return o}function ts(n){return ye((e,r)=>{let t=null,i=!1,o;t=e.subscribe(Ee(r,void 0,void 0,s=>{o=Me(n(s,ts(n)(e))),t?(t.unsubscribe(),t=null,o.subscribe(r)):i=!0})),i&&(t.unsubscribe(),t=null,o.subscribe(r))})}var{isArray:xz}=Array,{getPrototypeOf:Fz,prototype:kz,keys:Uz}=Object;function sE(n){if(n.length===1){let e=n[0];if(xz(e))return{args:e,keys:null};if(Vz(e)){let r=Uz(e);return{args:r.map(t=>e[t]),keys:r}}}return{args:n,keys:null}}function Vz(n){return n&&typeof n=="object"&&Fz(n)===kz}function Hs(n,e=0){return ye((r,t)=>{r.subscribe(Ee(t,i=>Wn(t,n,()=>t.next(i),e),()=>Wn(t,n,()=>t.complete(),e),i=>Wn(t,n,()=>t.error(i),e)))})}function Ws(n,e=0){return ye((r,t)=>{t.add(n.schedule(()=>r.subscribe(t),e))})}function OP(n,e){return Me(n).pipe(Ws(e),Hs(e))}function wP(n,e){return Me(n).pipe(Ws(e),Hs(e))}function bP(n,e){return new ge(r=>{let t=0;return e.schedule(function(){t===n.length?r.complete():(r.next(n[t++]),r.closed||this.schedule())})})}function LP(n,e){return new ge(r=>{let t;return Wn(r,e,()=>{t=n[Jp](),Wn(r,e,()=>{let i,o;try{({value:i,done:o}=t.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>Se(t?.return)&&t.return()})}function aE(n,e){if(!n)throw new Error("Iterable cannot be null");return new ge(r=>{Wn(r,e,()=>{let t=n[Symbol.asyncIterator]();Wn(r,e,()=>{t.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function MP(n,e){return aE(eE(n),e)}function PP(n,e){if(n!=null){if(Yp(n))return OP(n,e);if(vu(n))return bP(n,e);if(Kp(n))return wP(n,e);if(Qp(n))return aE(n,e);if(Zp(n))return LP(n,e);if(tE(n))return MP(n,e)}throw Xp(n)}function xr(n,e){return e?PP(n,e):Me(n)}function fe(n,e){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{t.next(n.call(e,o,i++))}))})}var{isArray:Bz}=Array;function Gz(n,e){return Bz(e)?n(...e):n(e)}function Su(n){return fe(e=>Gz(n,e))}function cE(n,e){return n.reduce((r,t,i)=>(r[t]=e[i],r),{})}function Zr(...n){let e=co(n),r=oE(n),{args:t,keys:i}=sE(n);if(t.length===0)return xr([],e);let o=new ge($z(t,e,i?s=>cE(i,s):Ri));return r?o.pipe(Su(r)):o}function $z(n,e,r=Ri){return t=>{xP(e,()=>{let{length:i}=n,o=new Array(i),s=i,a=i;for(let c=0;c<i;c++)xP(e,()=>{let l=xr(n[c],e),u=!1;l.subscribe(Ee(t,d=>{o[c]=d,u||(u=!0,a--),a||t.next(r(o.slice()))},()=>{--s||t.complete()}))},t)},t)}}function xP(n,e,r){n?Wn(r,n,e):e()}function FP(n,e,r,t,i,o,s,a){let c=[],l=0,u=0,d=!1,f=()=>{d&&!c.length&&!l&&e.complete()},g=_=>l<t?p(_):c.push(_),p=_=>{o&&e.next(_),l++;let T=!1;Me(r(_,u++)).subscribe(Ee(e,D=>{i?.(D),o?g(D):e.next(D)},()=>{T=!0},void 0,()=>{if(T)try{for(l--;c.length&&l<t;){let D=c.shift();s?Wn(e,s,()=>p(D)):p(D)}f()}catch(D){e.error(D)}}))};return n.subscribe(Ee(e,g,()=>{d=!0,f()})),()=>{a?.()}}function lo(n,e,r=1/0){return Se(e)?lo((t,i)=>fe((o,s)=>e(t,o,i,s))(Me(n(t,i))),r):(typeof e=="number"&&(r=e),ye((t,i)=>FP(t,i,n,r)))}function kP(n,e,r,t,i){return(o,s)=>{let a=r,c=e,l=0;o.subscribe(Ee(s,u=>{let d=l++;c=a?n(c,u,d):(a=!0,u),t&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}function lE(n=1/0){return lo(Ri,n)}function UP(){return lE(1)}function yS(n,e){return Se(e)?lo(n,e,1):lo(n,1)}var VP=js(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ot=(()=>{class n extends ge{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let t=new uE(this,this);return t.operator=r,t}_throwIfClosed(){if(this.closed)throw new VP}next(r){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let t of this.currentObservers)t.next(r)}})}error(r){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:t}=this;for(;t.length;)t.shift().error(r)}})}complete(){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:t,isStopped:i,observers:o}=this;return t||i?fS:(this.currentObservers=null,o.push(r),new gt(()=>{this.currentObservers=null,Ec(o,r)}))}_checkFinalizedStatuses(r){let{hasError:t,thrownError:i,isStopped:o}=this;t?r.error(i):o&&r.complete()}asObservable(){let r=new ge;return r.source=this,r}}return n.create=(e,r)=>new uE(e,r),n})(),uE=class extends Ot{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.next)===null||t===void 0||t.call(r,e)}error(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.error)===null||t===void 0||t.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,t;return(t=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&t!==void 0?t:fS}};function SS(n){return ye((e,r)=>{let t=!1,i=null,o=null,s=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let a=i;i=null,r.next(a)}};e.subscribe(Ee(r,a=>{o?.unsubscribe(),t=!0,i=a,o=Ee(r,s,Ai),Me(n(a)).subscribe(o)},()=>{s(),r.complete()},void 0,()=>{i=o=null}))})}function Au(n,e=Hn){return ye((r,t)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let l=o;o=null,t.next(l)}};function c(){let l=s+n,u=e.now();if(u<l){i=this.schedule(void 0,l-u),t.add(i);return}a()}r.subscribe(Ee(t,l=>{o=l,s=e.now(),i||(i=e.schedule(c,n),t.add(i))},()=>{a(),t.complete()},void 0,()=>{o=i=null}))})}function zs(...n){return UP()(xr(n,co(n)))}function BP(){return ye((n,e)=>{n.subscribe(Ee(e,Ai))})}function GP(n){return fe(()=>n)}function AS(n,e){return e?r=>zs(e.pipe(Nt(1),BP()),r.pipe(AS(n))):lo((r,t)=>Me(n(r,t)).pipe(Nt(1),GP(r)))}function DS(n,e=Hn){let r=Ci(n,e);return AS(()=>r)}function ue(...n){let e=co(n);return xr(n,e)}function it(n,e=Ri){return n=n??jz,ye((r,t)=>{let i,o=!0;r.subscribe(Ee(t,s=>{let a=e(s);(o||!n(i,a))&&(o=!1,i=a,t.next(s))}))})}function jz(n,e){return n===e}var $P=js(n=>function(){n(this),this.name="EmptyError",this.message="no elements in sequence"});function Sc(n){return ye((e,r)=>{try{e.subscribe(r)}finally{r.add(n)}})}function jP(){return ye((n,e)=>{let r=null;n._refCount++;let t=Ee(e,void 0,void 0,void 0,()=>{if(!n||n._refCount<=0||0<--n._refCount){r=null;return}let i=n._connection,o=r;r=null,i&&(!o||i===o)&&i.unsubscribe(),e.unsubscribe()});n.subscribe(t),t.closed||(r=n.connect())})}var RS=class extends ge{constructor(e,r){super(),this.source=e,this.subjectFactory=r,this._subject=null,this._refCount=0,this._connection=null,hS(e)&&(this.lift=e.lift)}_subscribe(e){return this.getSubject().subscribe(e)}getSubject(){let e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:e}=this;this._subject=this._connection=null,e?.unsubscribe()}connect(){let e=this._connection;if(!e){e=this._connection=new gt;let r=this.getSubject();e.add(this.source.subscribe(Ee(r,void 0,()=>{this._teardown(),r.complete()},t=>{this._teardown(),r.error(t)},()=>this._teardown()))),e.closed&&(this._connection=null,e=gt.EMPTY)}return e}refCount(){return jP()(this)}};function Du(){return ye((n,e)=>{let r,t=!1;n.subscribe(Ee(e,i=>{let o=r;r=i,t&&e.next([o,i]),t=!0}))})}var Y=class extends Ot{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:t}=this;if(e)throw r;return this._throwIfClosed(),t}next(e){super.next(this._value=e)}};var Ac=class extends Ot{constructor(e=1/0,r=1/0,t=yc){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=t,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:t,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(t.push(e),!i&&t.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:t,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=t?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:t,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<t.length&&t.splice(0,t.length-o),!i){let s=r.now(),a=0;for(let c=1;c<t.length&&t[c]<=s;c+=2)a=c;a&&t.splice(0,a+1)}}};function Hz(n=0,e=Hn){return n<0&&(n=0),Ci(n,n,e)}function dE(n,e){return ye(kP(n,e,arguments.length>=2,!0))}function NS(n={}){let{connector:e=()=>new Ot,resetOnError:r=!0,resetOnComplete:t=!0,resetOnRefCountZero:i=!0}=n;return o=>{let s,a,c,l=0,u=!1,d=!1,f=()=>{a?.unsubscribe(),a=void 0},g=()=>{f(),s=c=void 0,u=d=!1},p=()=>{let _=s;g(),_?.unsubscribe()};return ye((_,T)=>{l++,!d&&!u&&f();let D=c=c??e();T.add(()=>{l--,l===0&&!d&&!u&&(a=CS(p,i))}),D.subscribe(T),!s&&l>0&&(s=new Di({next:b=>D.next(b),error:b=>{d=!0,f(),a=CS(g,r,b),D.error(b)},complete:()=>{u=!0,f(),a=CS(g,t),D.complete()}}),Me(_).subscribe(s))})(o)}}function CS(n,e,...r){if(e===!0){n();return}if(e===!1)return;let t=new Di({next:()=>{t.unsubscribe(),n()}});return Me(e(...r)).subscribe(t)}function Wz(n,e,r){let t,i=!1;return n&&typeof n=="object"?{bufferSize:t=1/0,windowTime:e=1/0,refCount:i=!1,scheduler:r}=n:t=n??1/0,NS({connector:()=>new Ac(t,e,r),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function OS(n){return Ct((e,r)=>n<=r)}function zz(n){return ye((e,r)=>{let t=!1,i=Ee(r,()=>{i?.unsubscribe(),t=!0},Ai);Me(n).subscribe(i),e.subscribe(Ee(r,o=>t&&r.next(o)))})}function Ru(...n){let e=co(n);return ye((r,t)=>{(e?zs(n,r,e):zs(n,r)).subscribe(t)})}function mt(n,e){return ye((r,t)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&t.complete();r.subscribe(Ee(t,c=>{i?.unsubscribe();let l=0,u=o++;Me(n(c,u)).subscribe(i=Ee(t,d=>t.next(e?e(c,d,u,l++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function qs(n){return ye((e,r)=>{Me(n).subscribe(Ee(r,()=>r.complete(),Ai)),!r.closed&&e.subscribe(r)})}function qz(n,e=!1){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{let s=n(o,i++);(s||e)&&t.next(o),!s&&t.complete()}))})}function Ks(n,e,r){let t=Se(n)||e||r?{next:n,error:e,complete:r}:n;return t?ye((i,o)=>{var s;(s=t.subscribe)===null||s===void 0||s.call(t);let a=!0;i.subscribe(Ee(o,c=>{var l;(l=t.next)===null||l===void 0||l.call(t,c),o.next(c)},()=>{var c;a=!1,(c=t.complete)===null||c===void 0||c.call(t),o.complete()},c=>{var l;a=!1,(l=t.error)===null||l===void 0||l.call(t,c),o.error(c)},()=>{var c,l;a&&((c=t.unsubscribe)===null||c===void 0||c.call(t)),(l=t.finalize)===null||l===void 0||l.call(t)}))}):Ri}function HP(n,e){return ye((r,t)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,l=!1,u=()=>{c?.unsubscribe(),c=null,o&&(g(),l&&t.complete())},d=()=>{c=null,l&&t.complete()},f=p=>c=Me(n(p)).subscribe(Ee(t,u,d)),g=()=>{if(s){s=!1;let p=a;a=null,t.next(p),!l&&f(p)}};r.subscribe(Ee(t,p=>{s=!0,a=p,!(c&&!c.closed)&&(i?g():f(p))},()=>{l=!0,!(o&&s&&c&&!c.closed)&&t.complete()}))})}function Kz(n,e=Hn,r){let t=Ci(n,e);return HP(()=>t,r)}var Yz=js(n=>function(r=null){n(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r});function Qz(n,e){let{first:r,each:t,with:i=Xz,scheduler:o=e??Hn,meta:s=null}=iE(n)?{first:n}:typeof n=="number"?{each:n}:n;if(r==null&&t==null)throw new TypeError("No timeout provided.");return ye((a,c)=>{let l,u,d=null,f=0,g=p=>{u=Wn(c,o,()=>{try{l.unsubscribe(),Me(i({meta:s,lastValue:d,seen:f})).subscribe(c)}catch(_){c.error(_)}},p)};l=a.subscribe(Ee(c,p=>{u?.unsubscribe(),f++,c.next(d=p),t>0&&g(t)},void 0,void 0,()=>{u?.closed||u?.unsubscribe(),d=null})),!f&&g(r!=null?typeof r=="number"?r:+r-o.now():t)})}function Xz(n){throw new Yz(n)}function Jz(n=yc){return fe(e=>({value:e,timestamp:n.now()}))}var wS;function hE(){return wS}function uo(n){let e=wS;return wS=n,e}var WP=Symbol("NotFound");function Cu(n){return n===WP||n?.name==="\u0275NotFound"}var zn=null,fE=!1,bS=1,Zz=null,An=Symbol("SIGNAL");function Ae(n){let e=zn;return zn=n,e}function EE(){return zn}var Dc={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Nu(n){if(fE)throw new Error("");if(zn===null)return;zn.consumerOnSignalRead(n);let e=zn.producersTail;if(e!==void 0&&e.producer===n)return;let r,t=zn.recomputing;if(t&&(r=e!==void 0?e.nextProducer:zn.producers,r!==void 0&&r.producer===n)){zn.producersTail=r,r.lastReadVersion=n.version;return}let i=n.consumersTail;if(i!==void 0&&i.consumer===zn&&(!t||t6(i,zn)))return;let o=bu(zn),s={producer:n,consumer:zn,nextProducer:r,prevConsumer:i,lastReadVersion:n.version,nextConsumer:void 0};zn.producersTail=s,e!==void 0?e.nextProducer=s:zn.producers=s,o&&YP(n,s)}function zP(){bS++}function _E(n){if(!(bu(n)&&!n.dirty)&&!(!n.dirty&&n.lastCleanEpoch===bS)){if(!n.producerMustRecompute(n)&&!wu(n)){pE(n);return}n.producerRecomputeValue(n),pE(n)}}function LS(n){if(n.consumers===void 0)return;let e=fE;fE=!0;try{for(let r=n.consumers;r!==void 0;r=r.nextConsumer){let t=r.consumer;t.dirty||e6(t)}}finally{fE=e}}function MS(){return zn?.consumerAllowSignalWrites!==!1}function e6(n){n.dirty=!0,LS(n),n.consumerMarkedDirty?.(n)}function pE(n){n.dirty=!1,n.lastCleanEpoch=bS}function Rc(n){return n&&qP(n),Ae(n)}function qP(n){n.producersTail=void 0,n.recomputing=!0}function Ou(n,e){Ae(e),n&&KP(n)}function KP(n){n.recomputing=!1;let e=n.producersTail,r=e!==void 0?e.nextProducer:n.producers;if(r!==void 0){if(bu(n))do r=PS(r);while(r!==void 0);e!==void 0?e.nextProducer=void 0:n.producers=void 0}}function wu(n){for(let e=n.producers;e!==void 0;e=e.nextProducer){let r=e.producer,t=e.lastReadVersion;if(t!==r.version||(_E(r),t!==r.version))return!0}return!1}function Cc(n){if(bu(n)){let e=n.producers;for(;e!==void 0;)e=PS(e)}n.producers=void 0,n.producersTail=void 0,n.consumers=void 0,n.consumersTail=void 0}function YP(n,e){let r=n.consumersTail,t=bu(n);if(r!==void 0?(e.nextConsumer=r.nextConsumer,r.nextConsumer=e):(e.nextConsumer=void 0,n.consumers=e),e.prevConsumer=r,n.consumersTail=e,!t)for(let i=n.producers;i!==void 0;i=i.nextProducer)YP(i.producer,i)}function PS(n){let e=n.producer,r=n.nextProducer,t=n.nextConsumer,i=n.prevConsumer;if(n.nextConsumer=void 0,n.prevConsumer=void 0,t!==void 0?t.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=t;else if(e.consumers=t,!bu(e)){let o=e.producers;for(;o!==void 0;)o=PS(o)}return r}function bu(n){return n.consumerIsAlwaysLive||n.consumers!==void 0}function TE(n){Zz?.(n)}function t6(n,e){let r=e.producersTail;if(r!==void 0){let t=e.producers;do{if(t===n)return!0;if(t===r)break;t=t.nextProducer}while(t!==void 0)}return!1}function IE(n,e){return Object.is(n,e)}function vf(n,e){let r=Object.create(n6);r.computation=n,e!==void 0&&(r.equal=e);let t=()=>{if(_E(r),Nu(r),r.value===If)throw r.error;return r.value};return t[An]=r,TE(r),t}var gE=Symbol("UNSET"),mE=Symbol("COMPUTING"),If=Symbol("ERRORED"),n6=le(x({},Dc),{value:gE,dirty:!0,error:null,equal:IE,kind:"computed",producerMustRecompute(n){return n.value===gE||n.value===mE},producerRecomputeValue(n){if(n.value===mE)throw new Error("");let e=n.value;n.value=mE;let r=Rc(n),t,i=!1;try{t=n.computation(),Ae(null),i=e!==gE&&e!==If&&t!==If&&n.equal(e,t)}catch(o){t=If,n.error=o}finally{Ou(n,r)}if(i){n.value=e;return}n.value=t,n.version++}});function r6(){throw new Error}var QP=r6;function XP(n){QP(n)}function xS(n){QP=n}var i6=null;function FS(n,e){let r=Object.create(vE);r.value=n,e!==void 0&&(r.equal=e);let t=()=>JP(r);return t[An]=r,TE(r),[t,s=>Lu(r,s),s=>kS(r,s)]}function JP(n){return Nu(n),n.value}function Lu(n,e){MS()||XP(n),n.equal(n.value,e)||(n.value=e,o6(n))}function kS(n,e){MS()||XP(n),Lu(n,e(n.value))}var vE=le(x({},Dc),{equal:IE,value:void 0,kind:"signal"});function o6(n){n.version++,zP(),LS(n),i6?.(n)}var Mu={schedule(n){let e=requestAnimationFrame,r=cancelAnimationFrame,{delegate:t}=Mu;t&&(e=t.requestAnimationFrame,r=t.cancelAnimationFrame);let i=e(o=>{r=void 0,n(o)});return new gt(()=>r?.(i))},requestAnimationFrame(...n){let{delegate:e}=Mu;return(e?.requestAnimationFrame||requestAnimationFrame)(...n)},cancelAnimationFrame(...n){let{delegate:e}=Mu;return(e?.cancelAnimationFrame||cancelAnimationFrame)(...n)},delegate:void 0};var s6=1,US,VS={};function ZP(n){return n in VS?(delete VS[n],!0):!1}var e0={setImmediate(n){let e=s6++;return VS[e]=!0,US||(US=Promise.resolve()),US.then(()=>ZP(e)&&n()),e},clearImmediate(n){ZP(n)}};var{setImmediate:a6,clearImmediate:c6}=e0,yf={setImmediate(...n){let{delegate:e}=yf;return(e?.setImmediate||a6)(...n)},clearImmediate(n){let{delegate:e}=yf;return(e?.clearImmediate||c6)(n)},delegate:void 0};var yE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=yf.setImmediate(e.flush.bind(e,void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(yf.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))}};var SE=class extends ao{flush(e){this._active=!0;let r=this._scheduled;this._scheduled=void 0;let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var l6=new SE(yE);var AE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}schedule(e,r=0){return r>0?super.schedule(e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)}execute(e,r){return r>0||this.closed?super.execute(e,r):this._execute(e,r)}requestAsyncId(e,r,t=0){return t!=null&&t>0||t==null&&this.delay>0?super.requestAsyncId(e,r,t):(e.flush(this),0)}};var DE=class extends ao{};var BS=new DE(AE);var RE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=Mu.requestAnimationFrame(()=>e.flush(void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&r===e._scheduled&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(Mu.cancelAnimationFrame(r),e._scheduled=void 0)}};var CE=class extends ao{flush(e){this._active=!0;let r;e?r=e.id:(r=this._scheduled,this._scheduled=void 0);let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var u6=new CE(RE);function d6(n){return!!n&&(n instanceof ge||Se(n.lift)&&Se(n.subscribe))}function h6(n,e){let r=typeof e=="object";return new Promise((t,i)=>{let o=new Di({next:s=>{t(s),o.unsubscribe()},error:i,complete:()=>{r?t(e.defaultValue):i(new $P)}});n.subscribe(o)})}function GS(n){return new ge(e=>{Me(n()).subscribe(e)})}function f6(...n){let e=oE(n),{args:r,keys:t}=sE(n),i=new ge(o=>{let{length:s}=r;if(!s){o.complete();return}let a=new Array(s),c=s,l=s;for(let u=0;u<s;u++){let d=!1;Me(r[u]).subscribe(Ee(o,f=>{d||(d=!0,l--),a[u]=f},()=>c--,void 0,()=>{(!c||!d)&&(l||o.next(t?cE(t,a):a),o.complete())}))}});return e?i.pipe(Su(e)):i}var g6=["addListener","removeListener"],m6=["addEventListener","removeEventListener"],p6=["on","off"];function ho(n,e,r,t){if(Se(r)&&(t=r,r=void 0),t)return ho(n,e,r).pipe(Su(t));let[i,o]=T6(n)?m6.map(s=>a=>n[s](e,a,r)):E6(n)?g6.map(t0(n,e)):_6(n)?p6.map(t0(n,e)):[];if(!i&&vu(n))return lo(s=>ho(s,e,r))(Me(n));if(!i)throw new TypeError("Invalid event target");return new ge(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function t0(n,e){return r=>t=>n[r](e,t)}function E6(n){return Se(n.addListener)&&Se(n.removeListener)}function _6(n){return Se(n.on)&&Se(n.off)}function T6(n){return Se(n.addEventListener)&&Se(n.removeEventListener)}function I6(n,e,r){return GS(()=>n()?e:r)}function Pu(...n){let e=co(n),r=NP(n,1/0),t=n;return t.length?t.length===1?Me(t[0]):lE(r)(xr(t,e)):Ic}function n0(n){let e=Ae(null);try{return n()}finally{Ae(e)}}var r0=le(x({},Dc),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function i0(n){if(n.dirty=!1,n.version>0&&!wu(n))return;n.version++;let e=Rc(n);try{n.cleanup(),n.fn()}finally{Ou(n,e)}}var Oc=class{full;major;minor;patch;constructor(e){this.full=e;let r=e.split(".");this.major=r[0],this.minor=r[1],this.patch=r.slice(2).join(".")}},ZS=new Oc("20.3.18");var bE="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",oe=class extends Error{code;constructor(e,r){super(Xs(e,r)),this.code=e}};function v6(n){return`NG0${Math.abs(n)}`}function Xs(n,e){return`${v6(n)}${e?": "+e:""}`}var tn=globalThis;function Je(n){for(let e in n)if(n[e]===Je)return e;throw Error("")}function a0(n,e){for(let r in e)e.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(n[r]=e[r])}function rs(n){if(typeof n=="string")return n;if(Array.isArray(n))return`[${n.map(rs).join(", ")}]`;if(n==null)return""+n;let e=n.overriddenName||n.name;if(e)return`${e}`;let r=n.toString();if(r==null)return""+r;let t=r.indexOf(`
|
|
3
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function Ec(n,e){if(n){let r=n.indexOf(e);0<=r&&n.splice(r,1)}}var gt=class n{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:t}=this;if(Se(t))try{t()}catch(o){e=o instanceof Hp?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{mP(o)}catch(s){e=e??[],s instanceof Hp?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Hp(e)}}add(e){var r;if(e&&e!==this)if(this.closed)mP(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&Ec(r,e)}remove(e){let{_finalizers:r}=this;r&&Ec(r,e),e instanceof n&&e._removeParent(this)}};gt.EMPTY=(()=>{let n=new gt;return n.closed=!0,n})();var fS=gt.EMPTY;function Wp(n){return n instanceof gt||n&&"closed"in n&&Se(n.remove)&&Se(n.add)&&Se(n.unsubscribe)}function mP(n){Se(n)?n():n.unsubscribe()}var Si={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var _u={setTimeout(n,e,...r){let{delegate:t}=_u;return t?.setTimeout?t.setTimeout(n,e,...r):setTimeout(n,e,...r)},clearTimeout(n){let{delegate:e}=_u;return(e?.clearTimeout||clearTimeout)(n)},delegate:void 0};function zp(n){_u.setTimeout(()=>{let{onUnhandledError:e}=Si;if(e)e(n);else throw n})}function Ai(){}var pP=gS("C",void 0,void 0);function EP(n){return gS("E",void 0,n)}function _P(n){return gS("N",n,void 0)}function gS(n,e,r){return{kind:n,value:e,error:r}}var _c=null;function Tu(n){if(Si.useDeprecatedSynchronousErrorHandling){let e=!_c;if(e&&(_c={errorThrown:!1,error:null}),n(),e){let{errorThrown:r,error:t}=_c;if(_c=null,r)throw t}}else n()}function TP(n){Si.useDeprecatedSynchronousErrorHandling&&_c&&(_c.errorThrown=!0,_c.error=n)}var Tc=class extends gt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Wp(e)&&e.add(this)):this.destination=A3}static create(e,r,t){return new Di(e,r,t)}next(e){this.isStopped?pS(_P(e),this):this._next(e)}error(e){this.isStopped?pS(EP(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?pS(pP,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},y3=Function.prototype.bind;function mS(n,e){return y3.call(n,e)}var ES=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(t){qp(t)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(t){qp(t)}else qp(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){qp(r)}}},Di=class extends Tc{constructor(e,r,t){super();let i;if(Se(e)||!e)i={next:e??void 0,error:r??void 0,complete:t??void 0};else{let o;this&&Si.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&mS(e.next,o),error:e.error&&mS(e.error,o),complete:e.complete&&mS(e.complete,o)}):i=e}this.destination=new ES(i)}};function qp(n){Si.useDeprecatedSynchronousErrorHandling?TP(n):zp(n)}function S3(n){throw n}function pS(n,e){let{onStoppedNotification:r}=Si;r&&_u.setTimeout(()=>r(n,e))}var A3={closed:!0,next:Ai,error:S3,complete:Ai};function Ee(n,e,r,t,i){return new _S(n,e,r,t,i)}var _S=class extends Tc{constructor(e,r,t,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=t?function(){try{t()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function Ct(n,e){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>n.call(e,o,i++)&&t.next(o)))})}var Iu=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ri(n){return n}function IP(n){return n.length===0?Ri:n.length===1?n[0]:function(r){return n.reduce((t,i)=>i(t),r)}}var ge=(()=>{class n{constructor(r){r&&(this._subscribe=r)}lift(r){let t=new n;return t.source=this,t.operator=r,t}subscribe(r,t,i){let o=R3(r)?r:new Di(r,t,i);return Tu(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(t){r.error(t)}}forEach(r,t){return t=vP(t),new t((i,o)=>{let s=new Di({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(r)}[Iu](){return this}pipe(...r){return IP(r)(this)}toPromise(r){return r=vP(r),new r((t,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>t(o))})}}return n.create=e=>new n(e),n})();function vP(n){var e;return(e=n??Si.Promise)!==null&&e!==void 0?e:Promise}function D3(n){return n&&Se(n.next)&&Se(n.error)&&Se(n.complete)}function R3(n){return n&&n instanceof Tc||D3(n)&&Wp(n)}var Ic=new ge(n=>n.complete());function Nt(n){return n<=0?()=>Ic:ye((e,r)=>{let t=0;e.subscribe(Ee(r,i=>{++t<=n&&(r.next(i),n<=t&&r.complete())}))})}function TS(n,e){var r={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(r[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(n);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(n,t[i])&&(r[t[i]]=n[t[i]]);return r}function SP(n,e,r,t){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(t.next(u))}catch(d){s(d)}}function c(u){try{l(t.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((t=t.apply(n,e||[])).next())})}function yP(n){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&n[e],t=0;if(r)return r.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&t>=n.length&&(n=void 0),{value:n&&n[t++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vc(n){return this instanceof vc?(this.v=n,this):new vc(n)}function AP(n,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r.apply(n,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(g){return function(p){return Promise.resolve(p).then(g,d)}}function a(g,p){t[g]&&(i[g]=function(_){return new Promise(function(T,D){o.push([g,_,T,D])>1||c(g,_)})},p&&(i[g]=p(i[g])))}function c(g,p){try{l(t[g](p))}catch(_){f(o[0][3],_)}}function l(g){g.value instanceof vc?Promise.resolve(g.value.v).then(u,d):f(o[0][2],g)}function u(g){c("next",g)}function d(g){c("throw",g)}function f(g,p){g(p),o.shift(),o.length&&c(o[0][0],o[0][1])}}function DP(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],r;return e?e.call(n):(n=typeof yP=="function"?yP(n):n[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r);function t(o){r[o]=n[o]&&function(s){return new Promise(function(a,c){s=n[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var vu=n=>n&&typeof n.length=="number"&&typeof n!="function";function Kp(n){return Se(n?.then)}function Yp(n){return Se(n[Iu])}function Qp(n){return Symbol.asyncIterator&&Se(n?.[Symbol.asyncIterator])}function Xp(n){return new TypeError(`You provided ${n!==null&&typeof n=="object"?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function C3(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Jp=C3();function Zp(n){return Se(n?.[Jp])}function eE(n){return AP(this,arguments,function*(){let r=n.getReader();try{for(;;){let{value:t,done:i}=yield vc(r.read());if(i)return yield vc(void 0);yield yield vc(t)}}finally{r.releaseLock()}})}function tE(n){return Se(n?.getReader)}function Me(n){if(n instanceof ge)return n;if(n!=null){if(Yp(n))return N3(n);if(vu(n))return O3(n);if(Kp(n))return w3(n);if(Qp(n))return RP(n);if(Zp(n))return b3(n);if(tE(n))return L3(n)}throw Xp(n)}function N3(n){return new ge(e=>{let r=n[Iu]();if(Se(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function O3(n){return new ge(e=>{for(let r=0;r<n.length&&!e.closed;r++)e.next(n[r]);e.complete()})}function w3(n){return new ge(e=>{n.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,zp)})}function b3(n){return new ge(e=>{for(let r of n)if(e.next(r),e.closed)return;e.complete()})}function RP(n){return new ge(e=>{M3(n,e).catch(r=>e.error(r))})}function L3(n){return RP(eE(n))}function M3(n,e){var r,t,i,o;return SP(this,void 0,void 0,function*(){try{for(r=DP(n);t=yield r.next(),!t.done;){let s=t.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{t&&!t.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function CP(n){return ye((e,r)=>{let t=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let l=i;i=null,r.next(l)}s&&r.complete()},c=()=>{o=null,s&&r.complete()};e.subscribe(Ee(r,l=>{t=!0,i=l,o||Me(n(l)).subscribe(o=Ee(r,a,c))},()=>{s=!0,(!t||!o||o.closed)&&r.complete()}))})}var nE=class extends gt{constructor(e,r){super()}schedule(e,r=0){return this}};var Tf={setInterval(n,e,...r){let{delegate:t}=Tf;return t?.setInterval?t.setInterval(n,e,...r):setInterval(n,e,...r)},clearInterval(n){let{delegate:e}=Tf;return(e?.clearInterval||clearInterval)(n)},delegate:void 0};var so=class extends nE{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var t;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(t=this.id)!==null&&t!==void 0?t:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,t=0){return Tf.setInterval(e.flush.bind(e,this),t)}recycleAsyncId(e,r,t=0){if(t!=null&&this.delay===t&&this.pending===!1)return r;r!=null&&Tf.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let t=this._execute(e,r);if(t)return t;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let t=!1,i;try{this.work(e)}catch(o){t=!0,i=o||new Error("Scheduled action threw falsy error")}if(t)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:t}=r;this.work=this.state=this.scheduler=null,this.pending=!1,Ec(t,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var yc={now(){return(yc.delegate||Date).now()},delegate:void 0};var yu=class n{constructor(e,r=n.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,t){return new this.schedulerActionCtor(this,e).schedule(t,r)}};yu.now=yc.now;var ao=class extends yu{constructor(e,r=yu.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let t;this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}}};var Hn=new ao(so),IS=Hn;function rE(n){return n&&Se(n.schedule)}function iE(n){return n instanceof Date&&!isNaN(n)}function Ci(n=0,e,r=IS){let t=-1;return e!=null&&(rE(e)?r=e:t=e),new ge(i=>{let o=iE(n)?+n-r.now():n;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=t?this.schedule(void 0,t):i.complete())},o)})}function P3(n,e=Hn){return CP(()=>Ci(n,e))}function vS(n){return n[n.length-1]}function oE(n){return Se(vS(n))?n.pop():void 0}function co(n){return rE(vS(n))?n.pop():void 0}function NP(n,e){return typeof vS(n)=="number"?n.pop():e}function Wn(n,e,r,t=0,i=!1){let o=e.schedule(function(){r(),i?n.add(this.schedule(null,t)):this.unsubscribe()},t);if(n.add(o),!i)return o}function ts(n){return ye((e,r)=>{let t=null,i=!1,o;t=e.subscribe(Ee(r,void 0,void 0,s=>{o=Me(n(s,ts(n)(e))),t?(t.unsubscribe(),t=null,o.subscribe(r)):i=!0})),i&&(t.unsubscribe(),t=null,o.subscribe(r))})}var{isArray:x3}=Array,{getPrototypeOf:F3,prototype:k3,keys:U3}=Object;function sE(n){if(n.length===1){let e=n[0];if(x3(e))return{args:e,keys:null};if(V3(e)){let r=U3(e);return{args:r.map(t=>e[t]),keys:r}}}return{args:n,keys:null}}function V3(n){return n&&typeof n=="object"&&F3(n)===k3}function Hs(n,e=0){return ye((r,t)=>{r.subscribe(Ee(t,i=>Wn(t,n,()=>t.next(i),e),()=>Wn(t,n,()=>t.complete(),e),i=>Wn(t,n,()=>t.error(i),e)))})}function Ws(n,e=0){return ye((r,t)=>{t.add(n.schedule(()=>r.subscribe(t),e))})}function OP(n,e){return Me(n).pipe(Ws(e),Hs(e))}function wP(n,e){return Me(n).pipe(Ws(e),Hs(e))}function bP(n,e){return new ge(r=>{let t=0;return e.schedule(function(){t===n.length?r.complete():(r.next(n[t++]),r.closed||this.schedule())})})}function LP(n,e){return new ge(r=>{let t;return Wn(r,e,()=>{t=n[Jp](),Wn(r,e,()=>{let i,o;try{({value:i,done:o}=t.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>Se(t?.return)&&t.return()})}function aE(n,e){if(!n)throw new Error("Iterable cannot be null");return new ge(r=>{Wn(r,e,()=>{let t=n[Symbol.asyncIterator]();Wn(r,e,()=>{t.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function MP(n,e){return aE(eE(n),e)}function PP(n,e){if(n!=null){if(Yp(n))return OP(n,e);if(vu(n))return bP(n,e);if(Kp(n))return wP(n,e);if(Qp(n))return aE(n,e);if(Zp(n))return LP(n,e);if(tE(n))return MP(n,e)}throw Xp(n)}function xr(n,e){return e?PP(n,e):Me(n)}function fe(n,e){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{t.next(n.call(e,o,i++))}))})}var{isArray:B3}=Array;function G3(n,e){return B3(e)?n(...e):n(e)}function Su(n){return fe(e=>G3(n,e))}function cE(n,e){return n.reduce((r,t,i)=>(r[t]=e[i],r),{})}function Zr(...n){let e=co(n),r=oE(n),{args:t,keys:i}=sE(n);if(t.length===0)return xr([],e);let o=new ge($3(t,e,i?s=>cE(i,s):Ri));return r?o.pipe(Su(r)):o}function $3(n,e,r=Ri){return t=>{xP(e,()=>{let{length:i}=n,o=new Array(i),s=i,a=i;for(let c=0;c<i;c++)xP(e,()=>{let l=xr(n[c],e),u=!1;l.subscribe(Ee(t,d=>{o[c]=d,u||(u=!0,a--),a||t.next(r(o.slice()))},()=>{--s||t.complete()}))},t)},t)}}function xP(n,e,r){n?Wn(r,n,e):e()}function FP(n,e,r,t,i,o,s,a){let c=[],l=0,u=0,d=!1,f=()=>{d&&!c.length&&!l&&e.complete()},g=_=>l<t?p(_):c.push(_),p=_=>{o&&e.next(_),l++;let T=!1;Me(r(_,u++)).subscribe(Ee(e,D=>{i?.(D),o?g(D):e.next(D)},()=>{T=!0},void 0,()=>{if(T)try{for(l--;c.length&&l<t;){let D=c.shift();s?Wn(e,s,()=>p(D)):p(D)}f()}catch(D){e.error(D)}}))};return n.subscribe(Ee(e,g,()=>{d=!0,f()})),()=>{a?.()}}function lo(n,e,r=1/0){return Se(e)?lo((t,i)=>fe((o,s)=>e(t,o,i,s))(Me(n(t,i))),r):(typeof e=="number"&&(r=e),ye((t,i)=>FP(t,i,n,r)))}function kP(n,e,r,t,i){return(o,s)=>{let a=r,c=e,l=0;o.subscribe(Ee(s,u=>{let d=l++;c=a?n(c,u,d):(a=!0,u),t&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}function lE(n=1/0){return lo(Ri,n)}function UP(){return lE(1)}function yS(n,e){return Se(e)?lo(n,e,1):lo(n,1)}var VP=js(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ot=(()=>{class n extends ge{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let t=new uE(this,this);return t.operator=r,t}_throwIfClosed(){if(this.closed)throw new VP}next(r){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let t of this.currentObservers)t.next(r)}})}error(r){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:t}=this;for(;t.length;)t.shift().error(r)}})}complete(){Tu(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:t,isStopped:i,observers:o}=this;return t||i?fS:(this.currentObservers=null,o.push(r),new gt(()=>{this.currentObservers=null,Ec(o,r)}))}_checkFinalizedStatuses(r){let{hasError:t,thrownError:i,isStopped:o}=this;t?r.error(i):o&&r.complete()}asObservable(){let r=new ge;return r.source=this,r}}return n.create=(e,r)=>new uE(e,r),n})(),uE=class extends Ot{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.next)===null||t===void 0||t.call(r,e)}error(e){var r,t;(t=(r=this.destination)===null||r===void 0?void 0:r.error)===null||t===void 0||t.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,t;return(t=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&t!==void 0?t:fS}};function SS(n){return ye((e,r)=>{let t=!1,i=null,o=null,s=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let a=i;i=null,r.next(a)}};e.subscribe(Ee(r,a=>{o?.unsubscribe(),t=!0,i=a,o=Ee(r,s,Ai),Me(n(a)).subscribe(o)},()=>{s(),r.complete()},void 0,()=>{i=o=null}))})}function Au(n,e=Hn){return ye((r,t)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let l=o;o=null,t.next(l)}};function c(){let l=s+n,u=e.now();if(u<l){i=this.schedule(void 0,l-u),t.add(i);return}a()}r.subscribe(Ee(t,l=>{o=l,s=e.now(),i||(i=e.schedule(c,n),t.add(i))},()=>{a(),t.complete()},void 0,()=>{o=i=null}))})}function zs(...n){return UP()(xr(n,co(n)))}function BP(){return ye((n,e)=>{n.subscribe(Ee(e,Ai))})}function GP(n){return fe(()=>n)}function AS(n,e){return e?r=>zs(e.pipe(Nt(1),BP()),r.pipe(AS(n))):lo((r,t)=>Me(n(r,t)).pipe(Nt(1),GP(r)))}function DS(n,e=Hn){let r=Ci(n,e);return AS(()=>r)}function ue(...n){let e=co(n);return xr(n,e)}function it(n,e=Ri){return n=n??j3,ye((r,t)=>{let i,o=!0;r.subscribe(Ee(t,s=>{let a=e(s);(o||!n(i,a))&&(o=!1,i=a,t.next(s))}))})}function j3(n,e){return n===e}var $P=js(n=>function(){n(this),this.name="EmptyError",this.message="no elements in sequence"});function Sc(n){return ye((e,r)=>{try{e.subscribe(r)}finally{r.add(n)}})}function jP(){return ye((n,e)=>{let r=null;n._refCount++;let t=Ee(e,void 0,void 0,void 0,()=>{if(!n||n._refCount<=0||0<--n._refCount){r=null;return}let i=n._connection,o=r;r=null,i&&(!o||i===o)&&i.unsubscribe(),e.unsubscribe()});n.subscribe(t),t.closed||(r=n.connect())})}var RS=class extends ge{constructor(e,r){super(),this.source=e,this.subjectFactory=r,this._subject=null,this._refCount=0,this._connection=null,hS(e)&&(this.lift=e.lift)}_subscribe(e){return this.getSubject().subscribe(e)}getSubject(){let e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:e}=this;this._subject=this._connection=null,e?.unsubscribe()}connect(){let e=this._connection;if(!e){e=this._connection=new gt;let r=this.getSubject();e.add(this.source.subscribe(Ee(r,void 0,()=>{this._teardown(),r.complete()},t=>{this._teardown(),r.error(t)},()=>this._teardown()))),e.closed&&(this._connection=null,e=gt.EMPTY)}return e}refCount(){return jP()(this)}};function Du(){return ye((n,e)=>{let r,t=!1;n.subscribe(Ee(e,i=>{let o=r;r=i,t&&e.next([o,i]),t=!0}))})}var Y=class extends Ot{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:t}=this;if(e)throw r;return this._throwIfClosed(),t}next(e){super.next(this._value=e)}};var Ac=class extends Ot{constructor(e=1/0,r=1/0,t=yc){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=t,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:t,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(t.push(e),!i&&t.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:t,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=t?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:t,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<t.length&&t.splice(0,t.length-o),!i){let s=r.now(),a=0;for(let c=1;c<t.length&&t[c]<=s;c+=2)a=c;a&&t.splice(0,a+1)}}};function H3(n=0,e=Hn){return n<0&&(n=0),Ci(n,n,e)}function dE(n,e){return ye(kP(n,e,arguments.length>=2,!0))}function NS(n={}){let{connector:e=()=>new Ot,resetOnError:r=!0,resetOnComplete:t=!0,resetOnRefCountZero:i=!0}=n;return o=>{let s,a,c,l=0,u=!1,d=!1,f=()=>{a?.unsubscribe(),a=void 0},g=()=>{f(),s=c=void 0,u=d=!1},p=()=>{let _=s;g(),_?.unsubscribe()};return ye((_,T)=>{l++,!d&&!u&&f();let D=c=c??e();T.add(()=>{l--,l===0&&!d&&!u&&(a=CS(p,i))}),D.subscribe(T),!s&&l>0&&(s=new Di({next:b=>D.next(b),error:b=>{d=!0,f(),a=CS(g,r,b),D.error(b)},complete:()=>{u=!0,f(),a=CS(g,t),D.complete()}}),Me(_).subscribe(s))})(o)}}function CS(n,e,...r){if(e===!0){n();return}if(e===!1)return;let t=new Di({next:()=>{t.unsubscribe(),n()}});return Me(e(...r)).subscribe(t)}function W3(n,e,r){let t,i=!1;return n&&typeof n=="object"?{bufferSize:t=1/0,windowTime:e=1/0,refCount:i=!1,scheduler:r}=n:t=n??1/0,NS({connector:()=>new Ac(t,e,r),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function OS(n){return Ct((e,r)=>n<=r)}function z3(n){return ye((e,r)=>{let t=!1,i=Ee(r,()=>{i?.unsubscribe(),t=!0},Ai);Me(n).subscribe(i),e.subscribe(Ee(r,o=>t&&r.next(o)))})}function Ru(...n){let e=co(n);return ye((r,t)=>{(e?zs(n,r,e):zs(n,r)).subscribe(t)})}function mt(n,e){return ye((r,t)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&t.complete();r.subscribe(Ee(t,c=>{i?.unsubscribe();let l=0,u=o++;Me(n(c,u)).subscribe(i=Ee(t,d=>t.next(e?e(c,d,u,l++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function qs(n){return ye((e,r)=>{Me(n).subscribe(Ee(r,()=>r.complete(),Ai)),!r.closed&&e.subscribe(r)})}function q3(n,e=!1){return ye((r,t)=>{let i=0;r.subscribe(Ee(t,o=>{let s=n(o,i++);(s||e)&&t.next(o),!s&&t.complete()}))})}function Ks(n,e,r){let t=Se(n)||e||r?{next:n,error:e,complete:r}:n;return t?ye((i,o)=>{var s;(s=t.subscribe)===null||s===void 0||s.call(t);let a=!0;i.subscribe(Ee(o,c=>{var l;(l=t.next)===null||l===void 0||l.call(t,c),o.next(c)},()=>{var c;a=!1,(c=t.complete)===null||c===void 0||c.call(t),o.complete()},c=>{var l;a=!1,(l=t.error)===null||l===void 0||l.call(t,c),o.error(c)},()=>{var c,l;a&&((c=t.unsubscribe)===null||c===void 0||c.call(t)),(l=t.finalize)===null||l===void 0||l.call(t)}))}):Ri}function HP(n,e){return ye((r,t)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,l=!1,u=()=>{c?.unsubscribe(),c=null,o&&(g(),l&&t.complete())},d=()=>{c=null,l&&t.complete()},f=p=>c=Me(n(p)).subscribe(Ee(t,u,d)),g=()=>{if(s){s=!1;let p=a;a=null,t.next(p),!l&&f(p)}};r.subscribe(Ee(t,p=>{s=!0,a=p,!(c&&!c.closed)&&(i?g():f(p))},()=>{l=!0,!(o&&s&&c&&!c.closed)&&t.complete()}))})}function K3(n,e=Hn,r){let t=Ci(n,e);return HP(()=>t,r)}var Y3=js(n=>function(r=null){n(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r});function Q3(n,e){let{first:r,each:t,with:i=X3,scheduler:o=e??Hn,meta:s=null}=iE(n)?{first:n}:typeof n=="number"?{each:n}:n;if(r==null&&t==null)throw new TypeError("No timeout provided.");return ye((a,c)=>{let l,u,d=null,f=0,g=p=>{u=Wn(c,o,()=>{try{l.unsubscribe(),Me(i({meta:s,lastValue:d,seen:f})).subscribe(c)}catch(_){c.error(_)}},p)};l=a.subscribe(Ee(c,p=>{u?.unsubscribe(),f++,c.next(d=p),t>0&&g(t)},void 0,void 0,()=>{u?.closed||u?.unsubscribe(),d=null})),!f&&g(r!=null?typeof r=="number"?r:+r-o.now():t)})}function X3(n){throw new Y3(n)}function J3(n=yc){return fe(e=>({value:e,timestamp:n.now()}))}var wS;function hE(){return wS}function uo(n){let e=wS;return wS=n,e}var WP=Symbol("NotFound");function Cu(n){return n===WP||n?.name==="\u0275NotFound"}var zn=null,fE=!1,bS=1,Z3=null,An=Symbol("SIGNAL");function Ae(n){let e=zn;return zn=n,e}function EE(){return zn}var Dc={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Nu(n){if(fE)throw new Error("");if(zn===null)return;zn.consumerOnSignalRead(n);let e=zn.producersTail;if(e!==void 0&&e.producer===n)return;let r,t=zn.recomputing;if(t&&(r=e!==void 0?e.nextProducer:zn.producers,r!==void 0&&r.producer===n)){zn.producersTail=r,r.lastReadVersion=n.version;return}let i=n.consumersTail;if(i!==void 0&&i.consumer===zn&&(!t||t6(i,zn)))return;let o=bu(zn),s={producer:n,consumer:zn,nextProducer:r,prevConsumer:i,lastReadVersion:n.version,nextConsumer:void 0};zn.producersTail=s,e!==void 0?e.nextProducer=s:zn.producers=s,o&&YP(n,s)}function zP(){bS++}function _E(n){if(!(bu(n)&&!n.dirty)&&!(!n.dirty&&n.lastCleanEpoch===bS)){if(!n.producerMustRecompute(n)&&!wu(n)){pE(n);return}n.producerRecomputeValue(n),pE(n)}}function LS(n){if(n.consumers===void 0)return;let e=fE;fE=!0;try{for(let r=n.consumers;r!==void 0;r=r.nextConsumer){let t=r.consumer;t.dirty||e6(t)}}finally{fE=e}}function MS(){return zn?.consumerAllowSignalWrites!==!1}function e6(n){n.dirty=!0,LS(n),n.consumerMarkedDirty?.(n)}function pE(n){n.dirty=!1,n.lastCleanEpoch=bS}function Rc(n){return n&&qP(n),Ae(n)}function qP(n){n.producersTail=void 0,n.recomputing=!0}function Ou(n,e){Ae(e),n&&KP(n)}function KP(n){n.recomputing=!1;let e=n.producersTail,r=e!==void 0?e.nextProducer:n.producers;if(r!==void 0){if(bu(n))do r=PS(r);while(r!==void 0);e!==void 0?e.nextProducer=void 0:n.producers=void 0}}function wu(n){for(let e=n.producers;e!==void 0;e=e.nextProducer){let r=e.producer,t=e.lastReadVersion;if(t!==r.version||(_E(r),t!==r.version))return!0}return!1}function Cc(n){if(bu(n)){let e=n.producers;for(;e!==void 0;)e=PS(e)}n.producers=void 0,n.producersTail=void 0,n.consumers=void 0,n.consumersTail=void 0}function YP(n,e){let r=n.consumersTail,t=bu(n);if(r!==void 0?(e.nextConsumer=r.nextConsumer,r.nextConsumer=e):(e.nextConsumer=void 0,n.consumers=e),e.prevConsumer=r,n.consumersTail=e,!t)for(let i=n.producers;i!==void 0;i=i.nextProducer)YP(i.producer,i)}function PS(n){let e=n.producer,r=n.nextProducer,t=n.nextConsumer,i=n.prevConsumer;if(n.nextConsumer=void 0,n.prevConsumer=void 0,t!==void 0?t.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=t;else if(e.consumers=t,!bu(e)){let o=e.producers;for(;o!==void 0;)o=PS(o)}return r}function bu(n){return n.consumerIsAlwaysLive||n.consumers!==void 0}function TE(n){Z3?.(n)}function t6(n,e){let r=e.producersTail;if(r!==void 0){let t=e.producers;do{if(t===n)return!0;if(t===r)break;t=t.nextProducer}while(t!==void 0)}return!1}function IE(n,e){return Object.is(n,e)}function vf(n,e){let r=Object.create(n6);r.computation=n,e!==void 0&&(r.equal=e);let t=()=>{if(_E(r),Nu(r),r.value===If)throw r.error;return r.value};return t[An]=r,TE(r),t}var gE=Symbol("UNSET"),mE=Symbol("COMPUTING"),If=Symbol("ERRORED"),n6=le(x({},Dc),{value:gE,dirty:!0,error:null,equal:IE,kind:"computed",producerMustRecompute(n){return n.value===gE||n.value===mE},producerRecomputeValue(n){if(n.value===mE)throw new Error("");let e=n.value;n.value=mE;let r=Rc(n),t,i=!1;try{t=n.computation(),Ae(null),i=e!==gE&&e!==If&&t!==If&&n.equal(e,t)}catch(o){t=If,n.error=o}finally{Ou(n,r)}if(i){n.value=e;return}n.value=t,n.version++}});function r6(){throw new Error}var QP=r6;function XP(n){QP(n)}function xS(n){QP=n}var i6=null;function FS(n,e){let r=Object.create(vE);r.value=n,e!==void 0&&(r.equal=e);let t=()=>JP(r);return t[An]=r,TE(r),[t,s=>Lu(r,s),s=>kS(r,s)]}function JP(n){return Nu(n),n.value}function Lu(n,e){MS()||XP(n),n.equal(n.value,e)||(n.value=e,o6(n))}function kS(n,e){MS()||XP(n),Lu(n,e(n.value))}var vE=le(x({},Dc),{equal:IE,value:void 0,kind:"signal"});function o6(n){n.version++,zP(),LS(n),i6?.(n)}var Mu={schedule(n){let e=requestAnimationFrame,r=cancelAnimationFrame,{delegate:t}=Mu;t&&(e=t.requestAnimationFrame,r=t.cancelAnimationFrame);let i=e(o=>{r=void 0,n(o)});return new gt(()=>r?.(i))},requestAnimationFrame(...n){let{delegate:e}=Mu;return(e?.requestAnimationFrame||requestAnimationFrame)(...n)},cancelAnimationFrame(...n){let{delegate:e}=Mu;return(e?.cancelAnimationFrame||cancelAnimationFrame)(...n)},delegate:void 0};var s6=1,US,VS={};function ZP(n){return n in VS?(delete VS[n],!0):!1}var e0={setImmediate(n){let e=s6++;return VS[e]=!0,US||(US=Promise.resolve()),US.then(()=>ZP(e)&&n()),e},clearImmediate(n){ZP(n)}};var{setImmediate:a6,clearImmediate:c6}=e0,yf={setImmediate(...n){let{delegate:e}=yf;return(e?.setImmediate||a6)(...n)},clearImmediate(n){let{delegate:e}=yf;return(e?.clearImmediate||c6)(n)},delegate:void 0};var yE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=yf.setImmediate(e.flush.bind(e,void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(yf.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))}};var SE=class extends ao{flush(e){this._active=!0;let r=this._scheduled;this._scheduled=void 0;let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var l6=new SE(yE);var AE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}schedule(e,r=0){return r>0?super.schedule(e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)}execute(e,r){return r>0||this.closed?super.execute(e,r):this._execute(e,r)}requestAsyncId(e,r,t=0){return t!=null&&t>0||t==null&&this.delay>0?super.requestAsyncId(e,r,t):(e.flush(this),0)}};var DE=class extends ao{};var BS=new DE(AE);var RE=class extends so{constructor(e,r){super(e,r),this.scheduler=e,this.work=r}requestAsyncId(e,r,t=0){return t!==null&&t>0?super.requestAsyncId(e,r,t):(e.actions.push(this),e._scheduled||(e._scheduled=Mu.requestAnimationFrame(()=>e.flush(void 0))))}recycleAsyncId(e,r,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,r,t);let{actions:o}=e;r!=null&&r===e._scheduled&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==r&&(Mu.cancelAnimationFrame(r),e._scheduled=void 0)}};var CE=class extends ao{flush(e){this._active=!0;let r;e?r=e.id:(r=this._scheduled,this._scheduled=void 0);let{actions:t}=this,i;e=e||t.shift();do if(i=e.execute(e.state,e.delay))break;while((e=t[0])&&e.id===r&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===r&&t.shift();)e.unsubscribe();throw i}}};var u6=new CE(RE);function d6(n){return!!n&&(n instanceof ge||Se(n.lift)&&Se(n.subscribe))}function h6(n,e){let r=typeof e=="object";return new Promise((t,i)=>{let o=new Di({next:s=>{t(s),o.unsubscribe()},error:i,complete:()=>{r?t(e.defaultValue):i(new $P)}});n.subscribe(o)})}function GS(n){return new ge(e=>{Me(n()).subscribe(e)})}function f6(...n){let e=oE(n),{args:r,keys:t}=sE(n),i=new ge(o=>{let{length:s}=r;if(!s){o.complete();return}let a=new Array(s),c=s,l=s;for(let u=0;u<s;u++){let d=!1;Me(r[u]).subscribe(Ee(o,f=>{d||(d=!0,l--),a[u]=f},()=>c--,void 0,()=>{(!c||!d)&&(l||o.next(t?cE(t,a):a),o.complete())}))}});return e?i.pipe(Su(e)):i}var g6=["addListener","removeListener"],m6=["addEventListener","removeEventListener"],p6=["on","off"];function ho(n,e,r,t){if(Se(r)&&(t=r,r=void 0),t)return ho(n,e,r).pipe(Su(t));let[i,o]=T6(n)?m6.map(s=>a=>n[s](e,a,r)):E6(n)?g6.map(t0(n,e)):_6(n)?p6.map(t0(n,e)):[];if(!i&&vu(n))return lo(s=>ho(s,e,r))(Me(n));if(!i)throw new TypeError("Invalid event target");return new ge(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function t0(n,e){return r=>t=>n[r](e,t)}function E6(n){return Se(n.addListener)&&Se(n.removeListener)}function _6(n){return Se(n.on)&&Se(n.off)}function T6(n){return Se(n.addEventListener)&&Se(n.removeEventListener)}function I6(n,e,r){return GS(()=>n()?e:r)}function Pu(...n){let e=co(n),r=NP(n,1/0),t=n;return t.length?t.length===1?Me(t[0]):lE(r)(xr(t,e)):Ic}function n0(n){let e=Ae(null);try{return n()}finally{Ae(e)}}var r0=le(x({},Dc),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function i0(n){if(n.dirty=!1,n.version>0&&!wu(n))return;n.version++;let e=Rc(n);try{n.cleanup(),n.fn()}finally{Ou(n,e)}}var Oc=class{full;major;minor;patch;constructor(e){this.full=e;let r=e.split(".");this.major=r[0],this.minor=r[1],this.patch=r.slice(2).join(".")}},ZS=new Oc("20.3.18");var bE="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",oe=class extends Error{code;constructor(e,r){super(Xs(e,r)),this.code=e}};function v6(n){return`NG0${Math.abs(n)}`}function Xs(n,e){return`${v6(n)}${e?": "+e:""}`}var tn=globalThis;function Je(n){for(let e in n)if(n[e]===Je)return e;throw Error("")}function a0(n,e){for(let r in e)e.hasOwnProperty(r)&&!n.hasOwnProperty(r)&&(n[r]=e[r])}function rs(n){if(typeof n=="string")return n;if(Array.isArray(n))return`[${n.map(rs).join(", ")}]`;if(n==null)return""+n;let e=n.overriddenName||n.name;if(e)return`${e}`;let r=n.toString();if(r==null)return""+r;let t=r.indexOf(`
|
|
4
4
|
`);return t>=0?r.slice(0,t):r}function LE(n,e){return n?e?`${n} ${e}`:n:e||""}var y6=Je({__forward_ref__:Je});function ME(n){return n.__forward_ref__=ME,n.toString=function(){return rs(this())},n}function hn(n){return eA(n)?n():n}function eA(n){return typeof n=="function"&&n.hasOwnProperty(y6)&&n.__forward_ref__===ME}function K(n){return{token:n.token,providedIn:n.providedIn||null,factory:n.factory,value:void 0}}function is(n){return{providers:n.providers||[],imports:n.imports||[]}}function PE(n){return S6(n,xE)}function S6(n,e){return n.hasOwnProperty(e)&&n[e]||null}function A6(n){let e=n?.[xE]??null;return e||null}function jS(n){return n&&n.hasOwnProperty(OE)?n[OE]:null}var xE=Je({\u0275prov:Je}),OE=Je({\u0275inj:Je}),Z=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,r){this._desc=e,this.\u0275prov=void 0,typeof r=="number"?this.__NG_ELEMENT_ID__=r:r!==void 0&&(this.\u0275prov=K({token:this,providedIn:r.providedIn||"root",factory:r.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function tA(n){return n&&!!n.\u0275providers}var nA=Je({\u0275cmp:Je}),rA=Je({\u0275dir:Je}),iA=Je({\u0275pipe:Je}),oA=Je({\u0275mod:Je}),Af=Je({\u0275fac:Je}),Mc=Je({__NG_ELEMENT_ID__:Je}),o0=Je({__NG_ENV_ID__:Je});function kr(n){return typeof n=="string"?n:n==null?"":String(n)}function c0(n){return typeof n=="function"?n.name||n.toString():typeof n=="object"&&n!=null&&typeof n.type=="function"?n.type.name||n.type.toString():kr(n)}var l0=Je({ngErrorCode:Je}),D6=Je({ngErrorMessage:Je}),R6=Je({ngTokenPath:Je});function sA(n,e){return u0("",-200,e)}function FE(n,e){throw new oe(-201,!1)}function u0(n,e,r){let t=new oe(e,n);return t[l0]=e,t[D6]=n,r&&(t[R6]=r),t}function C6(n){return n[l0]}var HS;function d0(){return HS}function or(n){let e=HS;return HS=n,e}function aA(n,e,r){let t=PE(n);if(t&&t.providedIn=="root")return t.value===void 0?t.value=t.factory():t.value;if(r&8)return null;if(e!==void 0)return e;FE(n,"Injector")}var N6={},Nc=N6,WS="__NG_DI_FLAG__",zS=class{injector;constructor(e){this.injector=e}retrieve(e,r){let t=wc(r)||0;try{return this.injector.get(e,t&8?null:Nc,t)}catch(i){if(Cu(i))return i;throw i}}};function O6(n,e=0){let r=hE();if(r===void 0)throw new oe(-203,!1);if(r===null)return aA(n,void 0,e);{let t=w6(e),i=r.retrieve(n,t);if(Cu(i)){if(t.optional)return null;throw i}return i}}function w(n,e=0){return(d0()||O6)(hn(n),e)}function ne(n,e){return w(n,wc(e))}function wc(n){return typeof n>"u"||typeof n=="number"?n:0|(n.optional&&8)|(n.host&&1)|(n.self&&2)|(n.skipSelf&&4)}function w6(n){return{optional:!!(n&8),host:!!(n&1),self:!!(n&2),skipSelf:!!(n&4)}}function qS(n){let e=[];for(let r=0;r<n.length;r++){let t=hn(n[r]);if(Array.isArray(t)){if(t.length===0)throw new oe(900,!1);let i,o=0;for(let s=0;s<t.length;s++){let a=t[s],c=b6(a);typeof c=="number"?c===-1?i=a.token:o|=c:i=a}e.push(w(i,o))}else e.push(w(t))}return e}function cA(n,e){return n[WS]=e,n.prototype[WS]=e,n}function b6(n){return n[WS]}function Ys(n,e){let r=n.hasOwnProperty(Af);return r?n[Af]:null}function h0(n,e,r){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],o=e[t];if(r&&(i=r(i),o=r(o)),o!==i)return!1}return!0}function f0(n){return n.flat(Number.POSITIVE_INFINITY)}function kE(n,e){n.forEach(r=>Array.isArray(r)?kE(r,e):e(r))}function lA(n,e,r){e>=n.length?n.push(r):n.splice(e,0,r)}function Cf(n,e){return e>=n.length-1?n.pop():n.splice(e,1)[0]}function g0(n,e){let r=[];for(let t=0;t<n;t++)r.push(e);return r}function m0(n,e,r,t){let i=n.length;if(i==e)n.push(r,t);else if(i===1)n.push(t,n[0]),n[0]=r;else{for(i--,n.push(n[i-1],n[i]);i>e;){let o=i-2;n[i]=n[o],i--}n[e]=r,n[e+1]=t}}function Nf(n,e,r){let t=Fu(n,e);return t>=0?n[t|1]=r:(t=~t,m0(n,t,e,r)),t}function UE(n,e){let r=Fu(n,e);if(r>=0)return n[r|1]}function Fu(n,e){return L6(n,e,1)}function L6(n,e,r){let t=0,i=n.length>>r;for(;i!==t;){let o=t+(i-t>>1),s=n[o<<r];if(e===s)return o<<r;s>e?i=o:t=o+1}return~(i<<r)}var Ni={},qn=[],Js=new Z(""),uA=new Z("",-1),dA=new Z(""),Df=class{get(e,r=Nc){if(r===Nc){let i=u0("",-201);throw i.name="\u0275NotFound",i}return r}};function p0(n){return n[oA]||null}function Zs(n){return n[nA]||null}function VE(n){return n[rA]||null}function hA(n){return n[iA]||null}function pr(n){return{\u0275providers:n}}function E0(...n){return{\u0275providers:fA(!0,n),\u0275fromNgModule:!0}}function fA(n,...e){let r=[],t=new Set,i,o=s=>{r.push(s)};return kE(e,s=>{let a=s;wE(a,o,[],t)&&(i||=[],i.push(a))}),i!==void 0&&_0(i,o),r}function _0(n,e){for(let r=0;r<n.length;r++){let{ngModule:t,providers:i}=n[r];gA(i,o=>{e(o,t)})}}function wE(n,e,r,t){if(n=hn(n),!n)return!1;let i=null,o=jS(n),s=!o&&Zs(n);if(!o&&!s){let c=n.ngModule;if(o=jS(c),o)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=n}let a=t.has(i);if(s){if(a)return!1;if(t.add(i),s.dependencies){let c=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let l of c)wE(l,e,r,t)}}else if(o){if(o.imports!=null&&!a){t.add(i);let l;kE(o.imports,u=>{wE(u,e,r,t)&&(l||=[],l.push(u))}),l!==void 0&&_0(l,e)}if(!a){let l=Ys(i)||(()=>new i);e({provide:i,useFactory:l,deps:qn},i),e({provide:dA,useValue:i,multi:!0},i),e({provide:Js,useValue:()=>w(i),multi:!0},i)}let c=o.providers;if(c!=null&&!a){let l=n;gA(c,u=>{e(u,l)})}}else return!1;return i!==n&&n.providers!==void 0}function gA(n,e){for(let r of n)tA(r)&&(r=r.\u0275providers),Array.isArray(r)?gA(r,e):e(r)}var M6=Je({provide:String,useValue:Je});function T0(n){return n!==null&&typeof n=="object"&&M6 in n}function P6(n){return!!(n&&n.useExisting)}function x6(n){return!!(n&&n.useFactory)}function bc(n){return typeof n=="function"}function I0(n){return!!n.useClass}var Of=new Z(""),NE={},s0={},$S;function ku(){return $S===void 0&&($S=new Df),$S}var Kn=class{},Lc=class extends Kn{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,r,t,i){super(),this.parent=r,this.source=t,this.scopes=i,YS(e,s=>this.processProvider(s)),this.records.set(uA,xu(void 0,this)),i.has("environment")&&this.records.set(Kn,xu(void 0,this));let o=this.records.get(Of);o!=null&&typeof o.value=="string"&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(dA,qn,{self:!0}))}retrieve(e,r){let t=wc(r)||0;try{return this.get(e,Nc,t)}catch(i){if(Cu(i))return i;throw i}}destroy(){Sf(this),this._destroyed=!0;let e=Ae(null);try{for(let t of this._ngOnDestroyHooks)t.ngOnDestroy();let r=this._onDestroyHooks;this._onDestroyHooks=[];for(let t of r)t()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Ae(e)}}onDestroy(e){return Sf(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){Sf(this);let r=uo(this),t=or(void 0),i;try{return e()}finally{uo(r),or(t)}}get(e,r=Nc,t){if(Sf(this),e.hasOwnProperty(o0))return e[o0](this);let i=wc(t),o,s=uo(this),a=or(void 0);try{if(!(i&4)){let l=this.records.get(e);if(l===void 0){let u=B6(e)&&PE(e);u&&this.injectableDefInScope(u)?l=xu(KS(e),NE):l=null,this.records.set(e,l)}if(l!=null)return this.hydrate(e,l,i)}let c=i&2?ku():this.parent;return r=i&8&&r===Nc?null:r,c.get(e,r)}catch(c){let l=C6(c);throw l===-200||l===-201?new oe(l,null):c}finally{or(a),uo(s)}}resolveInjectorInitializers(){let e=Ae(null),r=uo(this),t=or(void 0),i;try{let o=this.get(Js,qn,{self:!0});for(let s of o)s()}finally{uo(r),or(t),Ae(e)}}toString(){let e=[],r=this.records;for(let t of r.keys())e.push(rs(t));return`R3Injector[${e.join(", ")}]`}processProvider(e){e=hn(e);let r=bc(e)?e:hn(e&&e.provide),t=k6(e);if(!bc(e)&&e.multi===!0){let i=this.records.get(r);i||(i=xu(void 0,NE,!0),i.factory=()=>qS(i.multi),this.records.set(r,i)),r=e,i.multi.push(e)}this.records.set(r,t)}hydrate(e,r,t){let i=Ae(null);try{if(r.value===s0)throw sA(rs(e));return r.value===NE&&(r.value=s0,r.value=r.factory(void 0,t)),typeof r.value=="object"&&r.value&&V6(r.value)&&this._ngOnDestroyHooks.add(r.value),r.value}finally{Ae(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let r=hn(e.providedIn);return typeof r=="string"?r==="any"||this.scopes.has(r):this.injectorDefTypes.has(r)}removeOnDestroy(e){let r=this._onDestroyHooks.indexOf(e);r!==-1&&this._onDestroyHooks.splice(r,1)}};function KS(n){let e=PE(n),r=e!==null?e.factory:Ys(n);if(r!==null)return r;if(n instanceof Z)throw new oe(204,!1);if(n instanceof Function)return F6(n);throw new oe(204,!1)}function F6(n){if(n.length>0)throw new oe(204,!1);let r=A6(n);return r!==null?()=>r.factory(n):()=>new n}function k6(n){if(T0(n))return xu(void 0,n.useValue);{let e=mA(n);return xu(e,NE)}}function mA(n,e,r){let t;if(bc(n)){let i=hn(n);return Ys(i)||KS(i)}else if(T0(n))t=()=>hn(n.useValue);else if(x6(n))t=()=>n.useFactory(...qS(n.deps||[]));else if(P6(n))t=(i,o)=>w(hn(n.useExisting),o!==void 0&&o&8?8:void 0);else{let i=hn(n&&(n.useClass||n.provide));if(U6(n))t=()=>new i(...qS(n.deps));else return Ys(i)||KS(i)}return t}function Sf(n){if(n.destroyed)throw new oe(205,!1)}function xu(n,e,r=!1){return{factory:n,value:e,multi:r?[]:void 0}}function U6(n){return!!n.deps}function V6(n){return n!==null&&typeof n=="object"&&typeof n.ngOnDestroy=="function"}function B6(n){return typeof n=="function"||typeof n=="object"&&n.ngMetadataName==="InjectionToken"}function YS(n,e){for(let r of n)Array.isArray(r)?YS(r,e):r&&tA(r)?YS(r.\u0275providers,e):e(r)}function fo(n,e){let r;n instanceof Lc?(Sf(n),r=n):r=new zS(n);let t,i=uo(r),o=or(void 0);try{return e()}finally{uo(i),or(o)}}function pA(){return d0()!==void 0||hE()!=null}var Oi=0,Te=1,De=2,fn=3,ti=4,sr=5,Pc=6,Uu=7,$t=8,os=9,go=10,Ze=11,Vu=12,EA=13,xc=14,Yn=15,ea=16,Fc=17,mo=18,wf=19,_A=20,ns=21,BE=22,ss=23,Ur=24,kc=25,Uc=26,et=27,v0=1,TA=6,ta=7,bf=8,Vc=9,jt=10;function po(n){return Array.isArray(n)&&typeof n[v0]=="object"}function wi(n){return Array.isArray(n)&&n[v0]===!0}function IA(n){return(n.flags&4)!==0}function as(n){return n.componentOffset>-1}function Bu(n){return(n.flags&1)===1}function bi(n){return!!n.template}function Gu(n){return(n[De]&512)!==0}function Bc(n){return(n[De]&256)===256}var vA="svg",y0="math";function ni(n){for(;Array.isArray(n);)n=n[Oi];return n}function yA(n,e){return ni(e[n])}function ri(n,e){return ni(e[n.index])}function Lf(n,e){return n.data[e]}function Gc(n,e){return n[e]}function Mf(n,e,r,t){r>=n.data.length&&(n.data[r]=null,n.blueprint[r]=null),e[r]=t}function ii(n,e){let r=e[n];return po(r)?r:r[Oi]}function S0(n){return(n[De]&4)===4}function GE(n){return(n[De]&128)===128}function A0(n){return wi(n[fn])}function Vr(n,e){return e==null?null:n[e]}function SA(n){n[Fc]=0}function $E(n){n[De]&1024||(n[De]|=1024,GE(n)&&na(n))}function D0(n,e){for(;n>0;)e=e[xc],n--;return e}function $u(n){return!!(n[De]&9216||n[Ur]?.dirty)}function jE(n){n[go].changeDetectionScheduler?.notify(8),n[De]&64&&(n[De]|=1024),$u(n)&&na(n)}function na(n){n[go].changeDetectionScheduler?.notify(0);let e=Qs(n);for(;e!==null&&!(e[De]&8192||(e[De]|=8192,!GE(e)));)e=Qs(e)}function AA(n,e){if(Bc(n))throw new oe(911,!1);n[ns]===null&&(n[ns]=[]),n[ns].push(e)}function R0(n,e){if(n[ns]===null)return;let r=n[ns].indexOf(e);r!==-1&&n[ns].splice(r,1)}function Qs(n){let e=n[fn];return wi(e)?e[fn]:e}function DA(n){return n[Uu]??=[]}function RA(n){return n.cleanup??=[]}function C0(n,e,r,t){let i=DA(e);i.push(r),n.firstCreatePass&&RA(n).push(t,i.length-1)}var we={lFrame:V0(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var QS=!1;function N0(){return we.lFrame.elementDepthCount}function O0(){we.lFrame.elementDepthCount++}function CA(){we.lFrame.elementDepthCount--}function HE(){return we.bindingsEnabled}function NA(){return we.skipHydrationRootTNode!==null}function OA(n){return we.skipHydrationRootTNode===n}function wA(){we.skipHydrationRootTNode=null}function ce(){return we.lFrame.lView}function tt(){return we.lFrame.tView}function w0(n){return we.lFrame.contextLView=n,n[$t]}function b0(n){return we.lFrame.contextLView=null,n}function gn(){let n=bA();for(;n!==null&&n.type===64;)n=n.parent;return n}function bA(){return we.lFrame.currentTNode}function L0(){let n=we.lFrame,e=n.currentTNode;return n.isParent?e:e.parent}function $c(n,e){let r=we.lFrame;r.currentTNode=n,r.isParent=e}function LA(){return we.lFrame.isParent}function MA(){we.lFrame.isParent=!1}function PA(){return we.lFrame.contextLView}function xA(){return QS}function ju(n){let e=QS;return QS=n,e}function ar(){let n=we.lFrame,e=n.bindingRootIndex;return e===-1&&(e=n.bindingRootIndex=n.tView.bindingStartIndex),e}function FA(){return we.lFrame.bindingIndex}function M0(n){return we.lFrame.bindingIndex=n}function Eo(){return we.lFrame.bindingIndex++}function Pf(n){let e=we.lFrame,r=e.bindingIndex;return e.bindingIndex=e.bindingIndex+n,r}function P0(){return we.lFrame.inI18n}function x0(n,e){let r=we.lFrame;r.bindingIndex=r.bindingRootIndex=n,WE(e)}function F0(){return we.lFrame.currentDirectiveIndex}function WE(n){we.lFrame.currentDirectiveIndex=n}function k0(n){let e=we.lFrame.currentDirectiveIndex;return e===-1?null:n[e]}function zE(){return we.lFrame.currentQueryIndex}function xf(n){we.lFrame.currentQueryIndex=n}function G6(n){let e=n[Te];return e.type===2?e.declTNode:e.type===1?n[sr]:null}function kA(n,e,r){if(r&4){let i=e,o=n;for(;i=i.parent,i===null&&!(r&1);)if(i=G6(o),i===null||(o=o[xc],i.type&10))break;if(i===null)return!1;e=i,n=o}let t=we.lFrame=U0();return t.currentTNode=e,t.lView=n,!0}function qE(n){let e=U0(),r=n[Te];we.lFrame=e,e.currentTNode=r.firstChild,e.lView=n,e.tView=r,e.contextLView=n,e.bindingIndex=r.bindingStartIndex,e.inI18n=!1}function U0(){let n=we.lFrame,e=n===null?null:n.child;return e===null?V0(n):e}function V0(n){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:n,child:null,inI18n:!1};return n!==null&&(n.child=e),e}function B0(){let n=we.lFrame;return we.lFrame=n.parent,n.currentTNode=null,n.lView=null,n}var UA=B0;function KE(){let n=B0();n.isParent=!0,n.tView=null,n.selectedIndex=-1,n.contextLView=null,n.elementDepthCount=0,n.currentDirectiveIndex=-1,n.currentNamespace=null,n.bindingRootIndex=-1,n.bindingIndex=-1,n.currentQueryIndex=0}function G0(n){return(we.lFrame.contextLView=D0(n,we.lFrame.contextLView))[$t]}function oi(){return we.lFrame.selectedIndex}function ra(n){we.lFrame.selectedIndex=n}function Hu(){let n=we.lFrame;return Lf(n.tView,n.selectedIndex)}function $0(){we.lFrame.currentNamespace=vA}function j0(){$6()}function $6(){we.lFrame.currentNamespace=null}function H0(){return we.lFrame.currentNamespace}var W0=!0;function YE(){return W0}function Ff(n){W0=n}function XS(n,e=null,r=null,t){let i=VA(n,e,r,t);return i.resolveInjectorInitializers(),i}function VA(n,e=null,r=null,t,i=new Set){let o=[r||qn,E0(n)];return t=t||(typeof n=="object"?void 0:rs(n)),new Lc(o,e||ku(),t||null,i)}var St=class n{static THROW_IF_NOT_FOUND=Nc;static NULL=new Df;static create(e,r){if(Array.isArray(e))return XS({name:""},r,e,"");{let t=e.name??"";return XS({name:t},e.parent,e.providers,t)}}static \u0275prov=K({token:n,providedIn:"any",factory:()=>w(uA)});static __NG_ELEMENT_ID__=-1},Dn=new Z(""),cr=(()=>{class n{static __NG_ELEMENT_ID__=j6;static __NG_ENV_ID__=r=>r}return n})(),Rf=class extends cr{_lView;constructor(e){super(),this._lView=e}get destroyed(){return Bc(this._lView)}onDestroy(e){let r=this._lView;return AA(r,e),()=>R0(r,e)}};function j6(){return new Rf(ce())}var Fr=class{_console=console;handleError(e){this._console.error("ERROR",e)}},_o=new Z("",{providedIn:"root",factory:()=>{let n=ne(Kn),e;return r=>{n.destroyed&&!e?setTimeout(()=>{throw r}):(e??=n.get(Fr),e.handleError(r))}}}),z0={provide:Js,useValue:()=>{ne(Fr)},multi:!0};function To(n){return typeof n=="function"&&n[An]!==void 0}function jc(n,e){let[r,t,i]=FS(n,e?.equal),o=r,s=o[An];return o.set=t,o.update=i,o.asReadonly=BA.bind(o),o}function BA(){let n=this[An];if(n.readonlyFn===void 0){let e=()=>this();e[An]=n,n.readonlyFn=e}return n.readonlyFn}function GA(n){return To(n)&&typeof n.set=="function"}var Wu=(()=>{class n{view;node;constructor(r,t){this.view=r,this.node=t}static __NG_ELEMENT_ID__=H6}return n})();function H6(){return new Wu(ce(),gn())}var ei=class{},zu=new Z("",{providedIn:"root",factory:()=>!1});var $A=new Z(""),QE=new Z(""),ia=(()=>{class n{taskId=0;pendingTasks=new Set;destroyed=!1;pendingTask=new Y(!1);get hasPendingTasks(){return this.destroyed?!1:this.pendingTask.value}get hasPendingTasksObservable(){return this.destroyed?new ge(r=>{r.next(!1),r.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let r=this.taskId++;return this.pendingTasks.add(r),r}has(r){return this.pendingTasks.has(r)}remove(r){this.pendingTasks.delete(r),this.pendingTasks.size===0&&this.hasPendingTasks&&this.pendingTask.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this.hasPendingTasks&&this.pendingTask.next(!1),this.destroyed=!0,this.pendingTask.unsubscribe()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),Io=(()=>{class n{internalPendingTasks=ne(ia);scheduler=ne(ei);errorHandler=ne(_o);add(){let r=this.internalPendingTasks.add();return()=>{this.internalPendingTasks.has(r)&&(this.scheduler.notify(11),this.internalPendingTasks.remove(r))}}run(r){let t=this.add();r().catch(this.errorHandler).finally(t)}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})();function Hc(...n){}var kf=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:()=>new JS})}return n})(),JS=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let r=e.zone,t=this.queues.get(r);t.has(e)&&(t.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let r=e.zone;this.queues.has(r)||this.queues.set(r,new Set);let t=this.queues.get(r);t.has(e)||t.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[r,t]of this.queues)r===null?e||=this.flushQueue(t):e||=r.run(()=>this.flushQueue(t));e||(this.dirtyEffectCount=0)}}flushQueue(e){let r=!1;for(let t of e)t.dirty&&(this.dirtyEffectCount--,r=!0,t.run());return r}};function sd(n){return{toString:n}.toString()}var XE="__parameters__";function X6(n){return function(...r){if(n){let t=n(...r);for(let i in t)this[i]=t[i]}}}function Ox(n,e,r){return sd(()=>{let t=X6(e);function i(...o){if(this instanceof i)return t.apply(this,o),this;let s=new i(...o);return a.annotation=s,a;function a(c,l,u){let d=c.hasOwnProperty(XE)?c[XE]:Object.defineProperty(c,XE,{value:[]})[XE];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),c}}return i.prototype.ngMetadataName=n,i.annotationCls=i,i})}var J6=cA(Ox("Inject",n=>({token:n})),-1),pn=cA(Ox("Optional"),8);function wx(n){let e=tn.ng;if(e&&e.\u0275compilerFacade)return e.\u0275compilerFacade;throw new Error("JIT compiler unavailable")}function Z6(n){return typeof n=="function"}var l_=class{previousValue;currentValue;firstChange;constructor(e,r,t){this.previousValue=e,this.currentValue=r,this.firstChange=t}isFirstChange(){return this.firstChange}};function bx(n,e,r,t){e!==null?e.applyValueToInputSignal(e,t):n[r]=t}var VD=(()=>{let n=()=>Lx;return n.ngInherit=!0,n})();function Lx(n){return n.type.prototype.ngOnChanges&&(n.setInput=t4),e4}function e4(){let n=Px(this),e=n?.current;if(e){let r=n.previous;if(r===Ni)n.previous=e;else for(let t in e)r[t]=e[t];n.current=null,this.ngOnChanges(e)}}function t4(n,e,r,t,i){let o=this.declaredInputs[t],s=Px(n)||n4(n,{previous:Ni,current:null}),a=s.current||(s.current={}),c=s.previous,l=c[o];a[o]=new l_(l&&l.currentValue,r,c===Ni),bx(n,e,i,r)}var Mx="__ngSimpleChanges__";function Px(n){return n[Mx]||null}function n4(n,e){return n[Mx]=e}var q0=[];var lt=function(n,e=null,r){for(let t=0;t<q0.length;t++){let i=q0[t];i(n,e,r)}};function r4(n,e,r){let{ngOnChanges:t,ngOnInit:i,ngDoCheck:o}=e.type.prototype;if(t){let s=Lx(e);(r.preOrderHooks??=[]).push(n,s),(r.preOrderCheckHooks??=[]).push(n,s)}i&&(r.preOrderHooks??=[]).push(0-n,i),o&&((r.preOrderHooks??=[]).push(n,o),(r.preOrderCheckHooks??=[]).push(n,o))}function xx(n,e){for(let r=e.directiveStart,t=e.directiveEnd;r<t;r++){let o=n.data[r].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:l,ngOnDestroy:u}=o;s&&(n.contentHooks??=[]).push(-r,s),a&&((n.contentHooks??=[]).push(r,a),(n.contentCheckHooks??=[]).push(r,a)),c&&(n.viewHooks??=[]).push(-r,c),l&&((n.viewHooks??=[]).push(r,l),(n.viewCheckHooks??=[]).push(r,l)),u!=null&&(n.destroyHooks??=[]).push(r,u)}}function i_(n,e,r){Fx(n,e,3,r)}function o_(n,e,r,t){(n[De]&3)===r&&Fx(n,e,r,t)}function jA(n,e){let r=n[De];(r&3)===e&&(r&=16383,r+=1,n[De]=r)}function Fx(n,e,r,t){let i=t!==void 0?n[Fc]&65535:0,o=t??-1,s=e.length-1,a=0;for(let c=i;c<s;c++)if(typeof e[c+1]=="number"){if(a=e[c],t!=null&&a>=t)break}else e[c]<0&&(n[Fc]+=65536),(a<o||o==-1)&&(i4(n,r,e,c),n[Fc]=(n[Fc]&4294901760)+c+2),c++}function K0(n,e){lt(4,n,e);let r=Ae(null);try{e.call(n)}finally{Ae(r),lt(5,n,e)}}function i4(n,e,r,t){let i=r[t]<0,o=r[t+1],s=i?-r[t]:r[t],a=n[s];i?n[De]>>14<n[Fc]>>16&&(n[De]&3)===e&&(n[De]+=16384,K0(a,o)):K0(a,o)}var Ku=-1,zc=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,r,t,i){this.factory=e,this.name=i,this.canSeeViewProviders=r,this.injectImpl=t}};function o4(n){return(n.flags&8)!==0}function s4(n){return(n.flags&16)!==0}function a4(n,e,r){let t=0;for(;t<r.length;){let i=r[t];if(typeof i=="number"){if(i!==0)break;t++;let o=r[t++],s=r[t++],a=r[t++];n.setAttribute(e,s,a,o)}else{let o=i,s=r[++t];l4(o)?n.setProperty(e,o,s):n.setAttribute(e,o,s),t++}}return t}function c4(n){return n===3||n===4||n===6}function l4(n){return n.charCodeAt(0)===64}function Yu(n,e){if(!(e===null||e.length===0))if(n===null||n.length===0)n=e.slice();else{let r=-1;for(let t=0;t<e.length;t++){let i=e[t];typeof i=="number"?r=i:r===0||(r===-1||r===2?Y0(n,r,i,null,e[++t]):Y0(n,r,i,null,null))}}return n}function Y0(n,e,r,t,i){let o=0,s=n.length;if(e===-1)s=-1;else for(;o<n.length;){let a=n[o++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=o-1;break}}}for(;o<n.length;){let a=n[o];if(typeof a=="number")break;if(a===r){i!==null&&(n[o+1]=i);return}o++,i!==null&&o++}s!==-1&&(n.splice(s,0,e),o=s+1),n.splice(o++,0,r),i!==null&&n.splice(o++,0,i)}function kx(n){return n!==Ku}function u_(n){return n&32767}function u4(n){return n>>16}function d_(n,e){let r=u4(n),t=e;for(;r>0;)t=t[xc],r--;return t}var eD=!0;function h_(n){let e=eD;return eD=n,e}var d4=256,Ux=d4-1,Vx=5,h4=0,vo={};function f4(n,e,r){let t;typeof r=="string"?t=r.charCodeAt(0)||0:r.hasOwnProperty(Mc)&&(t=r[Mc]),t==null&&(t=r[Mc]=h4++);let i=t&Ux,o=1<<i;e.data[n+(i>>Vx)]|=o}function f_(n,e){let r=Bx(n,e);if(r!==-1)return r;let t=e[Te];t.firstCreatePass&&(n.injectorIndex=e.length,HA(t.data,n),HA(e,null),HA(t.blueprint,null));let i=BD(n,e),o=n.injectorIndex;if(kx(i)){let s=u_(i),a=d_(i,e),c=a[Te].data;for(let l=0;l<8;l++)e[o+l]=a[s+l]|c[s+l]}return e[o+8]=i,o}function HA(n,e){n.push(0,0,0,0,0,0,0,0,e)}function Bx(n,e){return n.injectorIndex===-1||n.parent&&n.parent.injectorIndex===n.injectorIndex||e[n.injectorIndex+8]===null?-1:n.injectorIndex}function BD(n,e){if(n.parent&&n.parent.injectorIndex!==-1)return n.parent.injectorIndex;let r=0,t=null,i=e;for(;i!==null;){if(t=Wx(i),t===null)return Ku;if(r++,i=i[xc],t.injectorIndex!==-1)return t.injectorIndex|r<<16}return Ku}function tD(n,e,r){f4(n,e,r)}function Gx(n,e,r){if(r&8||n!==void 0)return n;FE(e,"NodeInjector")}function $x(n,e,r,t){if(r&8&&t===void 0&&(t=null),(r&3)===0){let i=n[os],o=or(void 0);try{return i?i.get(e,t,r&8):aA(e,t,r&8)}finally{or(o)}}return Gx(t,e,r)}function jx(n,e,r,t=0,i){if(n!==null){if(e[De]&2048&&!(t&2)){let s=_4(n,e,r,t,vo);if(s!==vo)return s}let o=Hx(n,e,r,t,vo);if(o!==vo)return o}return $x(e,r,t,i)}function Hx(n,e,r,t,i){let o=m4(r);if(typeof o=="function"){if(!kA(e,n,t))return t&1?Gx(i,r,t):$x(e,r,t,i);try{let s;if(s=o(t),s==null&&!(t&8))FE(r);else return s}finally{UA()}}else if(typeof o=="number"){let s=null,a=Bx(n,e),c=Ku,l=t&1?e[Yn][sr]:null;for((a===-1||t&4)&&(c=a===-1?BD(n,e):e[a+8],c===Ku||!X0(t,!1)?a=-1:(s=e[Te],a=u_(c),e=d_(c,e)));a!==-1;){let u=e[Te];if(Q0(o,a,u.data)){let d=g4(a,e,r,s,t,l);if(d!==vo)return d}c=e[a+8],c!==Ku&&X0(t,e[Te].data[a+8]===l)&&Q0(o,a,e)?(s=u,a=u_(c),e=d_(c,e)):a=-1}}return i}function g4(n,e,r,t,i,o){let s=e[Te],a=s.data[n+8],c=t==null?as(a)&&eD:t!=s&&(a.type&3)!==0,l=i&1&&o===a,u=s_(a,s,r,c,l);return u!==null?Bf(e,s,u,a,i):vo}function s_(n,e,r,t,i){let o=n.providerIndexes,s=e.data,a=o&1048575,c=n.directiveStart,l=n.directiveEnd,u=o>>20,d=t?a:a+u,f=i?a+u:l;for(let g=d;g<f;g++){let p=s[g];if(g<c&&r===p||g>=c&&p.type===r)return g}if(i){let g=s[c];if(g&&bi(g)&&g.type===r)return c}return null}function Bf(n,e,r,t,i){let o=n[r],s=e.data;if(o instanceof zc){let a=o;if(a.resolving){let g=c0(s[r]);throw sA(g)}let c=h_(a.canSeeViewProviders);a.resolving=!0;let l=s[r].type||s[r],u,d=a.injectImpl?or(a.injectImpl):null,f=kA(n,t,0);try{o=n[r]=a.factory(void 0,i,s,n,t),e.firstCreatePass&&r>=t.directiveStart&&r4(r,s[r],e)}finally{d!==null&&or(d),h_(c),a.resolving=!1,UA()}}return o}function m4(n){if(typeof n=="string")return n.charCodeAt(0)||0;let e=n.hasOwnProperty(Mc)?n[Mc]:void 0;return typeof e=="number"?e>=0?e&Ux:p4:e}function Q0(n,e,r){let t=1<<n;return!!(r[e+(n>>Vx)]&t)}function X0(n,e){return!(n&2)&&!(n&1&&e)}var Wc=class{_tNode;_lView;constructor(e,r){this._tNode=e,this._lView=r}get(e,r,t){return jx(this._tNode,this._lView,e,wc(t),r)}};function p4(){return new Wc(gn(),ce())}function E4(n){return sd(()=>{let e=n.prototype.constructor,r=e[Af]||nD(e),t=Object.prototype,i=Object.getPrototypeOf(n.prototype).constructor;for(;i&&i!==t;){let o=i[Af]||nD(i);if(o&&o!==r)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function nD(n){return eA(n)?()=>{let e=nD(hn(n));return e&&e()}:Ys(n)}function _4(n,e,r,t,i){let o=n,s=e;for(;o!==null&&s!==null&&s[De]&2048&&!Gu(s);){let a=Hx(o,s,r,t|2,vo);if(a!==vo)return a;let c=o.parent;if(!c){let l=s[_A];if(l){let u=l.get(r,vo,t);if(u!==vo)return u}c=Wx(s),s=s[xc]}o=c}return i}function Wx(n){let e=n[Te],r=e.type;return r===2?e.declTNode:r===1?n[sr]:null}function T4(){return ad(gn(),ce())}function ad(n,e){return new sa(ri(n,e))}var sa=(()=>{class n{nativeElement;constructor(r){this.nativeElement=r}static __NG_ELEMENT_ID__=T4}return n})();function zx(n){return n instanceof sa?n.nativeElement:n}function I4(){return this._results[Symbol.iterator]()}var g_=class{_emitDistinctChangesOnly;dirty=!0;_onDirty=void 0;_results=[];_changesDetected=!1;_changes=void 0;length=0;first=void 0;last=void 0;get changes(){return this._changes??=new Ot}constructor(e=!1){this._emitDistinctChangesOnly=e}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,r){return this._results.reduce(e,r)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,r){this.dirty=!1;let t=f0(e);(this._changesDetected=!h0(this._results,t,r))&&(this._results=t,this.length=t.length,this.last=t[this.length-1],this.first=t[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){this.dirty=!0,this._onDirty?.()}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}[Symbol.iterator]=I4};function qx(n){return(n.flags&128)===128}var GD=(function(n){return n[n.OnPush=0]="OnPush",n[n.Default=1]="Default",n})(GD||{}),Kx=new Map,v4=0;function y4(){return v4++}function S4(n){Kx.set(n[wf],n)}function rD(n){Kx.delete(n[wf])}var J0="__ngContext__";function Qu(n,e){po(e)?(n[J0]=e[wf],S4(e)):n[J0]=e}function Yx(n){return Xx(n[Vu])}function Qx(n){return Xx(n[ti])}function Xx(n){for(;n!==null&&!wi(n);)n=n[ti];return n}var iD;function $D(n){iD=n}function jD(){if(iD!==void 0)return iD;if(typeof document<"u")return document;throw new oe(210,!1)}var w_=new Z("",{providedIn:"root",factory:()=>A4}),A4="ng",b_=new Z(""),hs=new Z("",{providedIn:"platform",factory:()=>"unknown"});var D4=new Z(""),cd=new Z("",{providedIn:"root",factory:()=>jD().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var R4="h",C4="b";var Jx="r";var Zx="di";var eF=!1,tF=new Z("",{providedIn:"root",factory:()=>eF});var N4=(n,e,r,t)=>{};function O4(n,e,r,t){N4(n,e,r,t)}function L_(n){return(n.flags&32)===32}var w4=()=>null;function nF(n,e,r=!1){return w4(n,e,r)}function rF(n,e){let r=n.contentQueries;if(r!==null){let t=Ae(null);try{for(let i=0;i<r.length;i+=2){let o=r[i],s=r[i+1];if(s!==-1){let a=n.data[s];xf(o),a.contentQueries(2,e[s],s)}}}finally{Ae(t)}}}function oD(n,e,r){xf(0);let t=Ae(null);try{e(n,r)}finally{Ae(t)}}function HD(n,e,r){if(IA(e)){let t=Ae(null);try{let i=e.directiveStart,o=e.directiveEnd;for(let s=i;s<o;s++){let a=n.data[s];if(a.contentQueries){let c=r[s];a.contentQueries(1,c,s)}}}finally{Ae(t)}}}var ls=(function(n){return n[n.Emulated=0]="Emulated",n[n.None=2]="None",n[n.ShadowDom=3]="ShadowDom",n})(ls||{});var JE;function b4(){if(JE===void 0&&(JE=null,tn.trustedTypes))try{JE=tn.trustedTypes.createPolicy("angular",{createHTML:n=>n,createScript:n=>n,createScriptURL:n=>n})}catch{}return JE}function M_(n){return b4()?.createHTML(n)||n}var ZE;function L4(){if(ZE===void 0&&(ZE=null,tn.trustedTypes))try{ZE=tn.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:n=>n,createScript:n=>n,createScriptURL:n=>n})}catch{}return ZE}function Z0(n){return L4()?.createHTML(n)||n}var us=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${bE})`}},sD=class extends us{getTypeName(){return"HTML"}},aD=class extends us{getTypeName(){return"Style"}},cD=class extends us{getTypeName(){return"Script"}},lD=class extends us{getTypeName(){return"URL"}},uD=class extends us{getTypeName(){return"ResourceURL"}};function Br(n){return n instanceof us?n.changingThisBreaksApplicationSecurity:n}function So(n,e){let r=iF(n);if(r!=null&&r!==e){if(r==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${r} (see ${bE})`)}return r===e}function iF(n){return n instanceof us&&n.getTypeName()||null}function WD(n){return new sD(n)}function zD(n){return new aD(n)}function qD(n){return new cD(n)}function KD(n){return new lD(n)}function YD(n){return new uD(n)}function M4(n){let e=new hD(n);return P4()?new dD(e):e}var dD=class{inertDocumentHelper;constructor(e){this.inertDocumentHelper=e}getInertBodyElement(e){e="<body><remove></remove>"+e;try{let r=new window.DOMParser().parseFromString(M_(e),"text/html").body;return r===null?this.inertDocumentHelper.getInertBodyElement(e):(r.firstChild?.remove(),r)}catch{return null}}},hD=class{defaultDoc;inertDocument;constructor(e){this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let r=this.inertDocument.createElement("template");return r.innerHTML=M_(e),r}};function P4(){try{return!!new window.DOMParser().parseFromString(M_(""),"text/html")}catch{return!1}}var x4=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function Hf(n){return n=String(n),n.match(x4)?n:"unsafe:"+n}function fs(n){let e={};for(let r of n.split(","))e[r]=!0;return e}function Wf(...n){let e={};for(let r of n)for(let t in r)r.hasOwnProperty(t)&&(e[t]=!0);return e}var oF=fs("area,br,col,hr,img,wbr"),sF=fs("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),aF=fs("rp,rt"),F4=Wf(aF,sF),k4=Wf(sF,fs("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")),U4=Wf(aF,fs("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")),ex=Wf(oF,k4,U4,F4),cF=fs("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),V4=fs("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"),B4=fs("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"),G4=Wf(cF,V4,B4),$4=fs("script,style,template");var fD=class{sanitizedSomething=!1;buf=[];sanitizeChildren(e){let r=e.firstChild,t=!0,i=[];for(;r;){if(r.nodeType===Node.ELEMENT_NODE?t=this.startElement(r):r.nodeType===Node.TEXT_NODE?this.chars(r.nodeValue):this.sanitizedSomething=!0,t&&r.firstChild){i.push(r),r=W4(r);continue}for(;r;){r.nodeType===Node.ELEMENT_NODE&&this.endElement(r);let o=H4(r);if(o){r=o;break}r=i.pop()}}return this.buf.join("")}startElement(e){let r=tx(e).toLowerCase();if(!ex.hasOwnProperty(r))return this.sanitizedSomething=!0,!$4.hasOwnProperty(r);this.buf.push("<"),this.buf.push(r);let t=e.attributes;for(let i=0;i<t.length;i++){let o=t.item(i),s=o.name,a=s.toLowerCase();if(!G4.hasOwnProperty(a)){this.sanitizedSomething=!0;continue}let c=o.value;cF[a]&&(c=Hf(c)),this.buf.push(" ",s,'="',nx(c),'"')}return this.buf.push(">"),!0}endElement(e){let r=tx(e).toLowerCase();ex.hasOwnProperty(r)&&!oF.hasOwnProperty(r)&&(this.buf.push("</"),this.buf.push(r),this.buf.push(">"))}chars(e){this.buf.push(nx(e))}};function j4(n,e){return(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function H4(n){let e=n.nextSibling;if(e&&n!==e.previousSibling)throw lF(e);return e}function W4(n){let e=n.firstChild;if(e&&j4(n,e))throw lF(e);return e}function tx(n){let e=n.nodeName;return typeof e=="string"?e:"FORM"}function lF(n){return new Error(`Failed to sanitize html because the element is clobbered: ${n.outerHTML}`)}var z4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,q4=/([^\#-~ |!])/g;function nx(n){return n.replace(/&/g,"&").replace(z4,function(e){let r=e.charCodeAt(0),t=e.charCodeAt(1);return"&#"+((r-55296)*1024+(t-56320)+65536)+";"}).replace(q4,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}var e_;function P_(n,e){let r=null;try{e_=e_||M4(n);let t=e?String(e):"";r=e_.getInertBodyElement(t);let i=5,o=t;do{if(i===0)throw new Error("Failed to sanitize html because the input is unstable");i--,t=o,o=r.innerHTML,r=e_.getInertBodyElement(t)}while(t!==o);let a=new fD().sanitizeChildren(rx(r)||r);return M_(a)}finally{if(r){let t=rx(r)||r;for(;t.firstChild;)t.firstChild.remove()}}}function rx(n){return"content"in n&&K4(n)?n.content:null}function K4(n){return n.nodeType===Node.ELEMENT_NODE&&n.nodeName==="TEMPLATE"}var Y4=/^>|^->|<!--|-->|--!>|<!-$/g,Q4=/(<|>)/g,X4="\u200B$1\u200B";function J4(n){return n.replace(Y4,e=>e.replace(Q4,X4))}function Z4(n,e){return n.createText(e)}function eq(n,e,r){n.setValue(e,r)}function tq(n,e){return n.createComment(J4(e))}function uF(n,e,r){return n.createElement(e,r)}function m_(n,e,r,t,i){n.insertBefore(e,r,t,i)}function dF(n,e,r){n.appendChild(e,r)}function ix(n,e,r,t,i){t!==null?m_(n,e,r,t,i):dF(n,e,r)}function hF(n,e,r,t){n.removeChild(null,e,r,t)}function nq(n,e,r){n.setAttribute(e,"style",r)}function rq(n,e,r){r===""?n.removeAttribute(e,"class"):n.setAttribute(e,"class",r)}function fF(n,e,r){let{mergedAttrs:t,classes:i,styles:o}=r;t!==null&&a4(n,e,t),i!==null&&rq(n,e,i),o!==null&&nq(n,e,o)}var si=(function(n){return n[n.NONE=0]="NONE",n[n.HTML=1]="HTML",n[n.STYLE=2]="STYLE",n[n.SCRIPT=3]="SCRIPT",n[n.URL=4]="URL",n[n.RESOURCE_URL=5]="RESOURCE_URL",n})(si||{});function iq(n){let e=QD();return e?Z0(e.sanitize(si.HTML,n)||""):So(n,"HTML")?Z0(Br(n)):P_(jD(),kr(n))}function oq(n){let e=QD();return e?e.sanitize(si.STYLE,n)||"":So(n,"Style")?Br(n):kr(n)}function sq(n){let e=QD();return e?e.sanitize(si.URL,n)||"":So(n,"URL")?Br(n):Hf(kr(n))}function QD(){let n=ce();return n&&n[go].sanitizer}function aq(n){return n.ownerDocument.defaultView}function cq(n){return n.ownerDocument}function lq(n){return n instanceof Function?n():n}function uq(n,e,r){let t=n.length;for(;;){let i=n.indexOf(e,r);if(i===-1)return i;if(i===0||n.charCodeAt(i-1)<=32){let o=e.length;if(i+o===t||n.charCodeAt(i+o)<=32)return i}r=i+1}}var gF="ng-template";function dq(n,e,r,t){let i=0;if(t){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&uq(e[i+1].toLowerCase(),r,0)!==-1)return!0}else if(XD(n))return!1;if(i=e.indexOf(1,i),i>-1){let o;for(;++i<e.length&&typeof(o=e[i])=="string";)if(o.toLowerCase()===r)return!0}return!1}function XD(n){return n.type===4&&n.value!==gF}function hq(n,e,r){let t=n.type===4&&!r?gF:n.value;return e===t}function fq(n,e,r){let t=4,i=n.attrs,o=i!==null?pq(i):0,s=!1;for(let a=0;a<e.length;a++){let c=e[a];if(typeof c=="number"){if(!s&&!Li(t)&&!Li(c))return!1;if(s&&Li(c))continue;s=!1,t=c|t&1;continue}if(!s)if(t&4){if(t=2|t&1,c!==""&&!hq(n,c,r)||c===""&&e.length===1){if(Li(t))return!1;s=!0}}else if(t&8){if(i===null||!dq(n,i,c,r)){if(Li(t))return!1;s=!0}}else{let l=e[++a],u=gq(c,i,XD(n),r);if(u===-1){if(Li(t))return!1;s=!0;continue}if(l!==""){let d;if(u>o?d="":d=i[u+1].toLowerCase(),t&2&&l!==d){if(Li(t))return!1;s=!0}}}}return Li(t)||s}function Li(n){return(n&1)===0}function gq(n,e,r,t){if(e===null)return-1;let i=0;if(t||!r){let o=!1;for(;i<e.length;){let s=e[i];if(s===n)return i;if(s===3||s===6)o=!0;else if(s===1||s===2){let a=e[++i];for(;typeof a=="string";)a=e[++i];continue}else{if(s===4)break;if(s===0){i+=4;continue}}i+=o?1:2}return-1}else return Eq(e,n)}function mF(n,e,r=!1){for(let t=0;t<e.length;t++)if(fq(n,e[t],r))return!0;return!1}function mq(n){let e=n.attrs;if(e!=null){let r=e.indexOf(5);if((r&1)===0)return e[r+1]}return null}function pq(n){for(let e=0;e<n.length;e++){let r=n[e];if(c4(r))return e}return n.length}function Eq(n,e){let r=n.indexOf(4);if(r>-1)for(r++;r<n.length;){let t=n[r];if(typeof t=="number")return-1;if(t===e)return r;r++}return-1}function _q(n,e){e:for(let r=0;r<e.length;r++){let t=e[r];if(n.length===t.length){for(let i=0;i<n.length;i++)if(n[i]!==t[i])continue e;return!0}}return!1}function ox(n,e){return n?":not("+e.trim()+")":e}function Tq(n){let e=n[0],r=1,t=2,i="",o=!1;for(;r<n.length;){let s=n[r];if(typeof s=="string")if(t&2){let a=n[++r];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else t&8?i+="."+s:t&4&&(i+=" "+s);else i!==""&&!Li(s)&&(e+=ox(o,i),i=""),t=s,o=o||!Li(t);r++}return i!==""&&(e+=ox(o,i)),e}function Iq(n){return n.map(Tq).join(",")}function vq(n){let e=[],r=[],t=1,i=2;for(;t<n.length;){let o=n[t];if(typeof o=="string")i===2?o!==""&&e.push(o,n[++t]):i===8&&r.push(o);else{if(!Li(i))break;i=o}t++}return r.length&&e.push(1,...r),e}var Rn={};function JD(n,e,r,t,i,o,s,a,c,l,u){let d=et+t,f=d+i,g=yq(d,f),p=typeof l=="function"?l():l;return g[Te]={type:n,blueprint:g,template:r,queries:null,viewQuery:a,declTNode:e,data:g.slice().fill(null,d),bindingStartIndex:d,expandoStartIndex:f,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:typeof o=="function"?o():o,pipeRegistry:typeof s=="function"?s():s,firstChild:null,schemas:c,consts:p,incompleteFirstPass:!1,ssrId:u}}function yq(n,e){let r=[];for(let t=0;t<e;t++)r.push(t<n?null:Rn);return r}function Sq(n){let e=n.tView;return e===null||e.incompleteFirstPass?n.tView=JD(1,null,n.template,n.decls,n.vars,n.directiveDefs,n.pipeDefs,n.viewQuery,n.schemas,n.consts,n.id):e}function ZD(n,e,r,t,i,o,s,a,c,l,u){let d=e.blueprint.slice();return d[Oi]=i,d[De]=t|4|128|8|64|1024,(l!==null||n&&n[De]&2048)&&(d[De]|=2048),SA(d),d[fn]=d[xc]=n,d[$t]=r,d[go]=s||n&&n[go],d[Ze]=a||n&&n[Ze],d[os]=c||n&&n[os]||null,d[sr]=o,d[wf]=y4(),d[Pc]=u,d[_A]=l,d[Yn]=e.type==2?n[Yn]:d,d}function Aq(n,e,r){let t=ri(e,n),i=Sq(r),o=n[go].rendererFactory,s=eR(n,ZD(n,i,null,pF(r),t,e,null,o.createRenderer(t,r),null,null,null));return n[e.index]=s}function pF(n){let e=16;return n.signals?e=4096:n.onPush&&(e=64),e}function EF(n,e,r,t){if(r===0)return-1;let i=e.length;for(let o=0;o<r;o++)e.push(t),n.blueprint.push(t),n.data.push(null);return i}function eR(n,e){return n[Vu]?n[EA][ti]=e:n[Vu]=e,n[EA]=e,e}function Dq(n=1){_F(tt(),ce(),oi()+n,!1)}function _F(n,e,r,t){if(!t)if((e[De]&3)===3){let o=n.preOrderCheckHooks;o!==null&&i_(e,o,r)}else{let o=n.preOrderHooks;o!==null&&o_(e,o,0,r)}ra(r)}var x_=(function(n){return n[n.None=0]="None",n[n.SignalBased=1]="SignalBased",n[n.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",n})(x_||{});function gD(n,e,r,t){let i=Ae(null);try{let[o,s,a]=n.inputs[r],c=null;(s&x_.SignalBased)!==0&&(c=e[o][An]),c!==null&&c.transformFn!==void 0?t=c.transformFn(t):a!==null&&(t=a.call(e,t)),n.setInput!==null?n.setInput(e,c,t,r,o):bx(e,c,o,t)}finally{Ae(i)}}var Mi=(function(n){return n[n.Important=1]="Important",n[n.DashCase=2]="DashCase",n})(Mi||{}),Rq;function tR(n,e){return Rq(n,e)}var qc=new Set,F_=(function(n){return n[n.CHANGE_DETECTION=0]="CHANGE_DETECTION",n[n.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",n})(F_||{}),Qc=new Z(""),sx=new Set;function gs(n){sx.has(n)||(sx.add(n),performance?.mark?.("mark_feature_usage",{detail:{feature:n}}))}var TF=!1,mD=class extends Ot{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,pA()&&(this.destroyRef=ne(cr,{optional:!0})??void 0,this.pendingTasks=ne(ia,{optional:!0})??void 0)}emit(e){let r=Ae(null);try{super.next(e)}finally{Ae(r)}}subscribe(e,r,t){let i=e,o=r||(()=>null),s=t;if(e&&typeof e=="object"){let c=e;i=c.next?.bind(c),o=c.error?.bind(c),s=c.complete?.bind(c)}this.__isAsync&&(o=this.wrapInTimeout(o),i&&(i=this.wrapInTimeout(i)),s&&(s=this.wrapInTimeout(s)));let a=super.subscribe({next:i,error:o,complete:s});return e instanceof gt&&e.add(a),a}wrapInTimeout(e){return r=>{let t=this.pendingTasks?.add();setTimeout(()=>{try{e(r)}finally{t!==void 0&&this.pendingTasks?.remove(t)}})}}},cs=mD;function IF(n){let e,r;function t(){n=Hc;try{r!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(r),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{n(),t()}),typeof requestAnimationFrame=="function"&&(r=requestAnimationFrame(()=>{n(),t()})),()=>t()}function ax(n){return queueMicrotask(()=>n()),()=>{n=Hc}}var nR="isAngularZone",p_=nR+"_ID",Cq=0,Le=class n{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new cs(!1);onMicrotaskEmpty=new cs(!1);onStable=new cs(!1);onError=new cs(!1);constructor(e){let{enableLongStackTrace:r=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:o=TF}=e;if(typeof Zone>"u")throw new oe(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),r&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&t,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=o,wq(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(nR)===!0}static assertInAngularZone(){if(!n.isInAngularZone())throw new oe(909,!1)}static assertNotInAngularZone(){if(n.isInAngularZone())throw new oe(909,!1)}run(e,r,t){return this._inner.run(e,r,t)}runTask(e,r,t,i){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,e,Nq,Hc,Hc);try{return o.runTask(s,r,t)}finally{o.cancelTask(s)}}runGuarded(e,r,t){return this._inner.runGuarded(e,r,t)}runOutsideAngular(e){return this._outer.run(e)}},Nq={};function rR(n){if(n._nesting==0&&!n.hasPendingMicrotasks&&!n.isStable)try{n._nesting++,n.onMicrotaskEmpty.emit(null)}finally{if(n._nesting--,!n.hasPendingMicrotasks)try{n.runOutsideAngular(()=>n.onStable.emit(null))}finally{n.isStable=!0}}}function Oq(n){if(n.isCheckStableRunning||n.callbackScheduled)return;n.callbackScheduled=!0;function e(){IF(()=>{n.callbackScheduled=!1,pD(n),n.isCheckStableRunning=!0,rR(n),n.isCheckStableRunning=!1})}n.scheduleInRootZone?Zone.root.run(()=>{e()}):n._outer.run(()=>{e()}),pD(n)}function wq(n){let e=()=>{Oq(n)},r=Cq++;n._inner=n._inner.fork({name:"angular",properties:{[nR]:!0,[p_]:r,[p_+r]:!0},onInvokeTask:(t,i,o,s,a,c)=>{if(bq(c))return t.invokeTask(o,s,a,c);try{return cx(n),t.invokeTask(o,s,a,c)}finally{(n.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||n.shouldCoalesceRunChangeDetection)&&e(),lx(n)}},onInvoke:(t,i,o,s,a,c,l)=>{try{return cx(n),t.invoke(o,s,a,c,l)}finally{n.shouldCoalesceRunChangeDetection&&!n.callbackScheduled&&!Lq(c)&&e(),lx(n)}},onHasTask:(t,i,o,s)=>{t.hasTask(o,s),i===o&&(s.change=="microTask"?(n._hasPendingMicrotasks=s.microTask,pD(n),rR(n)):s.change=="macroTask"&&(n.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,i,o,s)=>(t.handleError(o,s),n.runOutsideAngular(()=>n.onError.emit(s)),!1)})}function pD(n){n._hasPendingMicrotasks||(n.shouldCoalesceEventChangeDetection||n.shouldCoalesceRunChangeDetection)&&n.callbackScheduled===!0?n.hasPendingMicrotasks=!0:n.hasPendingMicrotasks=!1}function cx(n){n._nesting++,n.isStable&&(n.isStable=!1,n.onUnstable.emit(null))}function lx(n){n._nesting--,rR(n)}var Xu=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new cs;onMicrotaskEmpty=new cs;onStable=new cs;onError=new cs;run(e,r,t){return e.apply(r,t)}runGuarded(e,r,t){return e.apply(r,t)}runOutsideAngular(e){return e()}runTask(e,r,t,i){return e.apply(r,t)}};function bq(n){return vF(n,"__ignore_ng_zone__")}function Lq(n){return vF(n,"__scheduler_tick__")}function vF(n,e){return!Array.isArray(n)||n.length!==1?!1:n[0]?.data?.[e]===!0}function yF(n="zone.js",e){return n==="noop"?new Xu:n==="zone.js"?new Le(e):n}var iR=(()=>{class n{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),SF=[0,1,2,3],AF=(()=>{class n{ngZone=ne(Le);scheduler=ne(ei);errorHandler=ne(Fr,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){ne(Qc,{optional:!0})}execute(){let r=this.sequences.size>0;r&<(16),this.executing=!0;for(let t of SF)for(let i of this.sequences)if(!(i.erroredOrDestroyed||!i.hooks[t]))try{i.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>{let o=i.hooks[t];return o(i.pipelinedValue)},i.snapshot))}catch(o){i.erroredOrDestroyed=!0,this.errorHandler?.handleError(o)}this.executing=!1;for(let t of this.sequences)t.afterRun(),t.once&&(this.sequences.delete(t),t.destroy());for(let t of this.deferredRegistrations)this.sequences.add(t);this.deferredRegistrations.size>0&&this.scheduler.notify(7),this.deferredRegistrations.clear(),r&<(17)}register(r){let{view:t}=r;t!==void 0?((t[kc]??=[]).push(r),na(t),t[De]|=8192):this.executing?this.deferredRegistrations.add(r):this.addSequence(r)}addSequence(r){this.sequences.add(r),this.scheduler.notify(7)}unregister(r){this.executing&&this.sequences.has(r)?(r.erroredOrDestroyed=!0,r.pipelinedValue=void 0,r.once=!0):(this.sequences.delete(r),this.deferredRegistrations.delete(r))}maybeTrace(r,t){return t?t.run(F_.AFTER_NEXT_RENDER,r):r()}static \u0275prov=K({token:n,providedIn:"root",factory:()=>new n})}return n})(),E_=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,r,t,i,o,s=null){this.impl=e,this.hooks=r,this.view=t,this.once=i,this.snapshot=s,this.unregisterOnDestroy=o?.onDestroy(()=>this.destroy())}afterRun(){this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,this.snapshot?.dispose(),this.snapshot=null}destroy(){this.impl.unregister(this),this.unregisterOnDestroy?.();let e=this.view?.[kc];e&&(this.view[kc]=e.filter(r=>r!==this))}};function Mq(n,e){let r=e?.injector??ne(St);return gs("NgAfterNextRender"),xq(n,r,e,!0)}function Pq(n){return n instanceof Function?[void 0,void 0,n,void 0]:[n.earlyRead,n.write,n.mixedReadWrite,n.read]}function xq(n,e,r,t){let i=e.get(iR);i.impl??=e.get(AF);let o=e.get(Qc,null,{optional:!0}),s=r?.manualCleanup!==!0?e.get(cr):null,a=e.get(Wu,null,{optional:!0}),c=new E_(i.impl,Pq(n),a?.view,t,s,o?.snapshot(null));return i.impl.register(c),c}var DF=new Z("",{providedIn:"root",factory:()=>({queue:new Set,isScheduled:!1,scheduler:null})});function RF(n,e,r){let t=n.get(DF);if(Array.isArray(e))for(let i of e)t.queue.add(i),r?.detachedLeaveAnimationFns?.push(i);else t.queue.add(e),r?.detachedLeaveAnimationFns?.push(e);t.scheduler&&t.scheduler(n)}function Fq(n,e){let r=n.get(DF);if(e.detachedLeaveAnimationFns){for(let t of e.detachedLeaveAnimationFns)r.queue.delete(t);e.detachedLeaveAnimationFns=void 0}}function kq(n,e){for(let[r,t]of e)RF(n,t.animateFns)}function ux(n,e,r,t){let i=n?.[Uc]?.enter;e!==null&&i&&i.has(r.index)&&kq(t,i)}function qu(n,e,r,t,i,o,s,a){if(i!=null){let c,l=!1;wi(i)?c=i:po(i)&&(l=!0,i=i[Oi]);let u=ni(i);n===0&&t!==null?(ux(a,t,o,r),s==null?dF(e,t,u):m_(e,t,u,s||null,!0)):n===1&&t!==null?(ux(a,t,o,r),m_(e,t,u,s||null,!0)):n===2?dx(a,o,r,d=>{hF(e,u,l,d)}):n===3&&dx(a,o,r,()=>{e.destroyNode(u)}),c!=null&&Kq(e,n,r,c,o,t,s)}}function Uq(n,e){CF(n,e),e[Oi]=null,e[sr]=null}function Vq(n,e,r,t,i,o){t[Oi]=i,t[sr]=e,U_(n,t,r,1,i,o)}function CF(n,e){e[go].changeDetectionScheduler?.notify(9),U_(n,e,e[Ze],2,null,null)}function Bq(n){let e=n[Vu];if(!e)return WA(n[Te],n);for(;e;){let r=null;if(po(e))r=e[Vu];else{let t=e[jt];t&&(r=t)}if(!r){for(;e&&!e[ti]&&e!==n;)po(e)&&WA(e[Te],e),e=e[fn];e===null&&(e=n),po(e)&&WA(e[Te],e),r=e&&e[ti]}e=r}}function oR(n,e){let r=n[Vc],t=r.indexOf(e);r.splice(t,1)}function k_(n,e){if(Bc(e))return;let r=e[Ze];r.destroyNode&&U_(n,e,r,3,null,null),Bq(e)}function WA(n,e){if(Bc(e))return;let r=Ae(null);try{e[De]&=-129,e[De]|=256,e[Ur]&&Cc(e[Ur]),jq(n,e),$q(n,e),e[Te].type===1&&e[Ze].destroy();let t=e[ea];if(t!==null&&wi(e[fn])){t!==e[fn]&&oR(t,e);let i=e[mo];i!==null&&i.detachView(n)}rD(e)}finally{Ae(r)}}function dx(n,e,r,t){let i=n?.[Uc];if(i==null||i.leave==null||!i.leave.has(e.index))return t(!1);n&&qc.add(n),RF(r,()=>{if(i.leave&&i.leave.has(e.index)){let s=i.leave.get(e.index),a=[];if(s){for(let c=0;c<s.animateFns.length;c++){let l=s.animateFns[c],{promise:u}=l();a.push(u)}i.detachedLeaveAnimationFns=void 0}i.running=Promise.allSettled(a),Gq(n,t)}else n&&qc.delete(n),t(!1)},i)}function Gq(n,e){let r=n[Uc]?.running;if(r){r.then(()=>{n[Uc].running=void 0,qc.delete(n),e(!0)});return}e(!1)}function $q(n,e){let r=n.cleanup,t=e[Uu];if(r!==null)for(let s=0;s<r.length-1;s+=2)if(typeof r[s]=="string"){let a=r[s+3];a>=0?t[a]():t[-a].unsubscribe(),s+=2}else{let a=t[r[s+1]];r[s].call(a)}t!==null&&(e[Uu]=null);let i=e[ns];if(i!==null){e[ns]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let o=e[ss];if(o!==null){e[ss]=null;for(let s of o)s.destroy()}}function jq(n,e){let r;if(n!=null&&(r=n.destroyHooks)!=null)for(let t=0;t<r.length;t+=2){let i=e[r[t]];if(!(i instanceof zc)){let o=r[t+1];if(Array.isArray(o))for(let s=0;s<o.length;s+=2){let a=i[o[s]],c=o[s+1];lt(4,a,c);try{c.call(a)}finally{lt(5,a,c)}}else{lt(4,i,o);try{o.call(i)}finally{lt(5,i,o)}}}}}function NF(n,e,r){return Hq(n,e.parent,r)}function Hq(n,e,r){let t=e;for(;t!==null&&t.type&168;)e=t,t=e.parent;if(t===null)return r[Oi];if(as(t)){let{encapsulation:i}=n.data[t.directiveStart+t.componentOffset];if(i===ls.None||i===ls.Emulated)return null}return ri(t,r)}function OF(n,e,r){return zq(n,e,r)}function Wq(n,e,r){return n.type&40?ri(n,r):null}var zq=Wq,hx;function sR(n,e,r,t){let i=NF(n,t,e),o=e[Ze],s=t.parent||e[sr],a=OF(s,t,e);if(i!=null)if(Array.isArray(r))for(let c=0;c<r.length;c++)ix(o,i,r[c],a,!1);else ix(o,i,r,a,!1);hx!==void 0&&hx(o,t,e,r,i)}function Uf(n,e){if(e!==null){let r=e.type;if(r&3)return ri(e,n);if(r&4)return ED(-1,n[e.index]);if(r&8){let t=e.child;if(t!==null)return Uf(n,t);{let i=n[e.index];return wi(i)?ED(-1,i):ni(i)}}else{if(r&128)return Uf(n,e.next);if(r&32)return tR(e,n)()||ni(n[e.index]);{let t=wF(n,e);if(t!==null){if(Array.isArray(t))return t[0];let i=Qs(n[Yn]);return Uf(i,t)}else return Uf(n,e.next)}}}return null}function wF(n,e){if(e!==null){let t=n[Yn][sr],i=e.projection;return t.projection[i]}return null}function ED(n,e){let r=jt+n+1;if(r<e.length){let t=e[r],i=t[Te].firstChild;if(i!==null)return Uf(t,i)}return e[ta]}function aR(n,e,r,t,i,o,s){for(;r!=null;){let a=t[os];if(r.type===128){r=r.next;continue}let c=t[r.index],l=r.type;if(s&&e===0&&(c&&Qu(ni(c),t),r.flags|=2),!L_(r))if(l&8)aR(n,e,r.child,t,i,o,!1),qu(e,n,a,i,c,r,o,t);else if(l&32){let u=tR(r,t),d;for(;d=u();)qu(e,n,a,i,d,r,o,t);qu(e,n,a,i,c,r,o,t)}else l&16?bF(n,e,t,r,i,o):qu(e,n,a,i,c,r,o,t);r=s?r.projectionNext:r.next}}function U_(n,e,r,t,i,o){aR(r,t,n.firstChild,e,i,o,!1)}function qq(n,e,r){let t=e[Ze],i=NF(n,r,e),o=r.parent||e[sr],s=OF(o,r,e);bF(t,0,e,r,i,s)}function bF(n,e,r,t,i,o){let s=r[Yn],c=s[sr].projection[t.projection];if(Array.isArray(c))for(let l=0;l<c.length;l++){let u=c[l];qu(e,n,r[os],i,u,t,o,r)}else{let l=c,u=s[fn];qx(t)&&(l.flags|=128),aR(n,e,l,u,i,o,!0)}}function Kq(n,e,r,t,i,o,s){let a=t[ta],c=ni(t);a!==c&&qu(e,n,r,o,a,i,s);for(let l=jt;l<t.length;l++){let u=t[l];U_(u[Te],u,n,e,o,a)}}function Yq(n,e,r,t,i){if(e)i?n.addClass(r,t):n.removeClass(r,t);else{let o=t.indexOf("-")===-1?void 0:Mi.DashCase;i==null?n.removeStyle(r,t,o):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=Mi.Important),n.setStyle(r,t,i,o))}}function LF(n,e,r,t,i){let o=oi(),s=t&2;try{ra(-1),s&&e.length>et&&_F(n,e,et,!1),lt(s?2:0,i,r),r(t,i)}finally{ra(o),lt(s?3:1,i,r)}}function V_(n,e,r){e8(n,e,r),(r.flags&64)===64&&t8(n,e,r)}function zf(n,e,r=ri){let t=e.localNames;if(t!==null){let i=e.index+1;for(let o=0;o<t.length;o+=2){let s=t[o+1],a=s===-1?r(e,n):n[s];n[i++]=a}}}function Qq(n,e,r,t){let o=t.get(tF,eF)||r===ls.ShadowDom,s=n.selectRootElement(e,o);return Xq(s),s}function Xq(n){Jq(n)}var Jq=()=>null;function Zq(n){return n==="class"?"className":n==="for"?"htmlFor":n==="formaction"?"formAction":n==="innerHtml"?"innerHTML":n==="readonly"?"readOnly":n==="tabindex"?"tabIndex":n}function MF(n,e,r,t,i,o){let s=e[Te];if(B_(n,s,e,r,t)){as(n)&&xF(e,n.index);return}n.type&3&&(r=Zq(r)),PF(n,e,r,t,i,o)}function PF(n,e,r,t,i,o){if(n.type&3){let s=ri(n,e);t=o!=null?o(t,n.value||"",r):t,i.setProperty(s,r,t)}else n.type&12}function xF(n,e){let r=ii(e,n);r[De]&16||(r[De]|=64)}function e8(n,e,r){let t=r.directiveStart,i=r.directiveEnd;as(r)&&Aq(e,r,n.data[t+r.componentOffset]),n.firstCreatePass||f_(r,e);let o=r.initialInputs;for(let s=t;s<i;s++){let a=n.data[s],c=Bf(e,n,s,r);if(Qu(c,e),o!==null&&i8(e,s-t,c,a,r,o),bi(a)){let l=ii(r.index,e);l[$t]=Bf(e,n,s,r)}}}function t8(n,e,r){let t=r.directiveStart,i=r.directiveEnd,o=r.index,s=F0();try{ra(o);for(let a=t;a<i;a++){let c=n.data[a],l=e[a];WE(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&n8(c,l)}}finally{ra(-1),WE(s)}}function n8(n,e){n.hostBindings!==null&&n.hostBindings(1,e)}function cR(n,e){let r=n.directiveRegistry,t=null;if(r)for(let i=0;i<r.length;i++){let o=r[i];mF(e,o.selectors,!1)&&(t??=[],bi(o)?t.unshift(o):t.push(o))}return t}function r8(n,e,r,t,i,o){let s=ri(n,e);FF(e[Ze],s,o,n.value,r,t,i)}function FF(n,e,r,t,i,o,s){if(o==null)n.removeAttribute(e,i,r);else{let a=s==null?kr(o):s(o,t||"",i);n.setAttribute(e,i,a,r)}}function i8(n,e,r,t,i,o){let s=o[e];if(s!==null)for(let a=0;a<s.length;a+=2){let c=s[a],l=s[a+1];gD(t,r,c,l)}}function lR(n,e,r,t,i){let o=et+r,s=e[Te],a=i(s,e,n,t,r);e[o]=a,$c(n,!0);let c=n.type===2;return c?(fF(e[Ze],a,n),(N0()===0||Bu(n))&&Qu(a,e),O0()):Qu(a,e),YE()&&(!c||!L_(n))&&sR(s,e,a,n),n}function uR(n){let e=n;return LA()?MA():(e=e.parent,$c(e,!1)),e}function o8(n,e){let r=n[os];if(!r)return;let t;try{t=r.get(_o,null)}catch{t=null}t?.(e)}function B_(n,e,r,t,i){let o=n.inputs?.[t],s=n.hostDirectiveInputs?.[t],a=!1;if(s)for(let c=0;c<s.length;c+=2){let l=s[c],u=s[c+1],d=e.data[l];gD(d,r[l],u,i),a=!0}if(o)for(let c of o){let l=r[c],u=e.data[c];gD(u,l,t,i),a=!0}return a}function s8(n,e){let r=ii(e,n),t=r[Te];a8(t,r);let i=r[Oi];i!==null&&r[Pc]===null&&(r[Pc]=nF(i,r[os])),lt(18),dR(t,r,r[$t]),lt(19,r[$t])}function a8(n,e){for(let r=e.length;r<n.blueprint.length;r++)e.push(n.blueprint[r])}function dR(n,e,r){qE(e);try{let t=n.viewQuery;t!==null&&oD(1,t,r);let i=n.template;i!==null&&LF(n,e,i,1,r),n.firstCreatePass&&(n.firstCreatePass=!1),e[mo]?.finishViewCreation(n),n.staticContentQueries&&rF(n,e),n.staticViewQueries&&oD(2,n.viewQuery,r);let o=n.components;o!==null&&c8(e,o)}catch(t){throw n.firstCreatePass&&(n.incompleteFirstPass=!0,n.firstCreatePass=!1),t}finally{e[De]&=-5,KE()}}function c8(n,e){for(let r=0;r<e.length;r++)s8(n,e[r])}function qf(n,e,r,t){let i=Ae(null);try{let o=e.tView,a=n[De]&4096?4096:16,c=ZD(n,o,r,a,null,e,null,null,t?.injector??null,t?.embeddedViewInjector??null,t?.dehydratedView??null),l=n[e.index];c[ea]=l;let u=n[mo];return u!==null&&(c[mo]=u.createEmbeddedView(o)),dR(o,c,r),c}finally{Ae(i)}}function Ju(n,e){return!e||e.firstChild===null||qx(n)}function Gf(n,e,r,t,i=!1){for(;r!==null;){if(r.type===128){r=i?r.projectionNext:r.next;continue}let o=e[r.index];o!==null&&t.push(ni(o)),wi(o)&&kF(o,t);let s=r.type;if(s&8)Gf(n,e,r.child,t);else if(s&32){let a=tR(r,e),c;for(;c=a();)t.push(c)}else if(s&16){let a=wF(e,r);if(Array.isArray(a))t.push(...a);else{let c=Qs(e[Yn]);Gf(c[Te],c,a,t,!0)}}r=i?r.projectionNext:r.next}return t}function kF(n,e){for(let r=jt;r<n.length;r++){let t=n[r],i=t[Te].firstChild;i!==null&&Gf(t[Te],t,i,e)}n[ta]!==n[Oi]&&e.push(n[ta])}function UF(n){if(n[kc]!==null){for(let e of n[kc])e.impl.addSequence(e);n[kc].length=0}}var VF=[];function l8(n){return n[Ur]??u8(n)}function u8(n){let e=VF.pop()??Object.create(h8);return e.lView=n,e}function d8(n){n.lView[Ur]!==n&&(n.lView=null,VF.push(n))}var h8=le(x({},Dc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:n=>{na(n.lView)},consumerOnSignalRead(){this.lView[Ur]=this}});function f8(n){let e=n[Ur]??Object.create(g8);return e.lView=n,e}var g8=le(x({},Dc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:n=>{let e=Qs(n.lView);for(;e&&!BF(e[Te]);)e=Qs(e);e&&$E(e)},consumerOnSignalRead(){this.lView[Ur]=this}});function BF(n){return n.type!==2}function GF(n){if(n[ss]===null)return;let e=!0;for(;e;){let r=!1;for(let t of n[ss])t.dirty&&(r=!0,t.zone===null||Zone.current===t.zone?t.run():t.zone.run(()=>t.run()));e=r&&!!(n[De]&8192)}}var m8=100;function $F(n,e=0){let t=n[go].rendererFactory,i=!1;i||t.begin?.();try{p8(n,e)}finally{i||t.end?.()}}function p8(n,e){let r=xA();try{ju(!0),_D(n,e);let t=0;for(;$u(n);){if(t===m8)throw new oe(103,!1);t++,_D(n,1)}}finally{ju(r)}}function E8(n,e,r,t){if(Bc(e))return;let i=e[De],o=!1,s=!1;qE(e);let a=!0,c=null,l=null;o||(BF(n)?(l=l8(e),c=Rc(l)):EE()===null?(a=!1,l=f8(e),c=Rc(l)):e[Ur]&&(Cc(e[Ur]),e[Ur]=null));try{SA(e),M0(n.bindingStartIndex),r!==null&&LF(n,e,r,2,t);let u=(i&3)===3;if(!o)if(u){let g=n.preOrderCheckHooks;g!==null&&i_(e,g,null)}else{let g=n.preOrderHooks;g!==null&&o_(e,g,0,null),jA(e,0)}if(s||_8(e),GF(e),jF(e,0),n.contentQueries!==null&&rF(n,e),!o)if(u){let g=n.contentCheckHooks;g!==null&&i_(e,g)}else{let g=n.contentHooks;g!==null&&o_(e,g,1),jA(e,1)}I8(n,e);let d=n.components;d!==null&&WF(e,d,0);let f=n.viewQuery;if(f!==null&&oD(2,f,t),!o)if(u){let g=n.viewCheckHooks;g!==null&&i_(e,g)}else{let g=n.viewHooks;g!==null&&o_(e,g,2),jA(e,2)}if(n.firstUpdatePass===!0&&(n.firstUpdatePass=!1),e[BE]){for(let g of e[BE])g();e[BE]=null}o||(UF(e),e[De]&=-73)}catch(u){throw o||na(e),u}finally{l!==null&&(Ou(l,c),a&&d8(l)),KE()}}function jF(n,e){for(let r=Yx(n);r!==null;r=Qx(r))for(let t=jt;t<r.length;t++){let i=r[t];HF(i,e)}}function _8(n){for(let e=Yx(n);e!==null;e=Qx(e)){if(!(e[De]&2))continue;let r=e[Vc];for(let t=0;t<r.length;t++){let i=r[t];$E(i)}}}function T8(n,e,r){lt(18);let t=ii(e,n);HF(t,r),lt(19,t[$t])}function HF(n,e){GE(n)&&_D(n,e)}function _D(n,e){let t=n[Te],i=n[De],o=n[Ur],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(o?.dirty&&wu(o)),s||=!1,o&&(o.dirty=!1),n[De]&=-9217,s)E8(t,n,t.template,n[$t]);else if(i&8192){let a=Ae(null);try{GF(n),jF(n,1);let c=t.components;c!==null&&WF(n,c,1),UF(n)}finally{Ae(a)}}}function WF(n,e,r){for(let t=0;t<e.length;t++)T8(n,e[t],r)}function I8(n,e){let r=n.hostBindingOpCodes;if(r!==null)try{for(let t=0;t<r.length;t++){let i=r[t];if(i<0)ra(~i);else{let o=i,s=r[++t],a=r[++t];x0(s,o);let c=e[o];lt(24,c),a(2,c),lt(25,c)}}}finally{ra(-1)}}function hR(n,e){let r=xA()?64:1088;for(n[go].changeDetectionScheduler?.notify(e);n;){n[De]|=r;let t=Qs(n);if(Gu(n)&&!t)return n;n=t}return null}function zF(n,e,r,t){return[n,!0,0,e,null,t,null,r,null,null]}function qF(n,e){let r=jt+e;if(r<n.length)return n[r]}function Kf(n,e,r,t=!0){let i=e[Te];if(v8(i,e,n,r),t){let s=ED(r,n),a=e[Ze],c=a.parentNode(n[ta]);c!==null&&Vq(i,n[sr],a,e,c,s)}let o=e[Pc];o!==null&&o.firstChild!==null&&(o.firstChild=null)}function KF(n,e){let r=$f(n,e);return r!==void 0&&k_(r[Te],r),r}function $f(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r];if(t){let i=t[ea];i!==null&&i!==n&&oR(i,t),e>0&&(n[r-1][ti]=t[ti]);let o=Cf(n,jt+e);Uq(t[Te],t);let s=o[mo];s!==null&&s.detachView(o[Te]),t[fn]=null,t[ti]=null,t[De]&=-129}return t}function v8(n,e,r,t){let i=jt+t,o=r.length;t>0&&(r[i-1][ti]=e),t<o-jt?(e[ti]=r[i],lA(r,jt+t,e)):(r.push(e),e[ti]=null),e[fn]=r;let s=e[ea];s!==null&&r!==s&&YF(s,e);let a=e[mo];a!==null&&a.insertView(n),jE(e),e[De]|=128}function YF(n,e){let r=n[Vc],t=e[fn];if(po(t))n[De]|=2;else{let i=t[fn][Yn];e[Yn]!==i&&(n[De]|=2)}r===null?n[Vc]=[e]:r.push(e)}var oa=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,r=e[Te];return Gf(r,e,r.firstChild,[])}constructor(e,r){this._lView=e,this._cdRefInjectingView=r}get context(){return this._lView[$t]}set context(e){this._lView[$t]=e}get destroyed(){return Bc(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[fn];if(wi(e)){let r=e[bf],t=r?r.indexOf(this):-1;t>-1&&($f(e,t),Cf(r,t))}this._attachedToViewContainer=!1}k_(this._lView[Te],this._lView)}onDestroy(e){AA(this._lView,e)}markForCheck(){hR(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[De]&=-129}reattach(){jE(this._lView),this._lView[De]|=128}detectChanges(){this._lView[De]|=1024,$F(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new oe(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=Gu(this._lView),r=this._lView[ea];r!==null&&!e&&oR(r,this._lView),CF(this._lView[Te],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new oe(902,!1);this._appRef=e;let r=Gu(this._lView),t=this._lView[ea];t!==null&&!r&&YF(t,this._lView),jE(this._lView)}};function y8(n){return $u(n._lView)||!!(n._lView[De]&64)}function S8(n){$E(n._lView)}var yo=(()=>{class n{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=A8;constructor(r,t,i){this._declarationLView=r,this._declarationTContainer=t,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(r,t){return this.createEmbeddedViewImpl(r,t)}createEmbeddedViewImpl(r,t,i){let o=qf(this._declarationLView,this._declarationTContainer,r,{embeddedViewInjector:t,dehydratedView:i});return new oa(o)}}return n})();function A8(){return G_(gn(),ce())}function G_(n,e){return n.type&4?new yo(e,n,ad(n,e)):null}function Xc(n,e,r,t,i){let o=n.data[e];if(o===null)o=D8(n,e,r,t,i),P0()&&(o.flags|=32);else if(o.type&64){o.type=r,o.value=t,o.attrs=i;let s=L0();o.injectorIndex=s===null?-1:s.injectorIndex}return $c(o,!0),o}function D8(n,e,r,t,i){let o=bA(),s=LA(),a=s?o:o&&o.parent,c=n.data[e]=C8(n,a,r,e,t,i);return R8(n,c,o,s),c}function R8(n,e,r,t){n.firstChild===null&&(n.firstChild=e),r!==null&&(t?r.child==null&&e.parent!==null&&(r.child=e):r.next===null&&(r.next=e,e.prev=r))}function C8(n,e,r,t,i,o){let s=e?e.injectorIndex:-1,a=0;return NA()&&(a|=128),{type:r,index:t,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,propertyBindings:null,flags:a,providerIndexes:0,value:i,attrs:o,mergedAttrs:null,localNames:null,initialInputs:null,inputs:null,hostDirectiveInputs:null,outputs:null,hostDirectiveOutputs:null,directiveToIndex:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}var Rpe=new RegExp(`^(\\d+)*(${C4}|${R4})*(.*)`);function N8(n){let e=n[TA]??[],t=n[fn][Ze],i=[];for(let o of e)o.data[Zx]!==void 0?i.push(o):O8(o,t);n[TA]=i}function O8(n,e){let r=0,t=n.firstChild;if(t){let i=n.data[Jx];for(;r<i;){let o=t.nextSibling;hF(e,t,!1),t=o,r++}}}var w8=()=>null,b8=()=>null;function __(n,e){return w8(n,e)}function QF(n,e,r){return b8(n,e,r)}var XF=class{},$_=class{},TD=class{resolveComponentFactory(e){throw new oe(917,!1)}},Yf=class{static NULL=new TD},ds=class{},j_=(()=>{class n{destroyNode=null;static __NG_ELEMENT_ID__=()=>L8()}return n})();function L8(){let n=ce(),e=gn(),r=ii(e.index,n);return(po(r)?r:n)[Ze]}var JF=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:()=>null})}return n})();var a_={},ID=class{injector;parentInjector;constructor(e,r){this.injector=e,this.parentInjector=r}get(e,r,t){let i=this.injector.get(e,a_,t);return i!==a_||r===a_?i:this.parentInjector.get(e,r,t)}};function T_(n,e,r){let t=r?n.styles:null,i=r?n.classes:null,o=0;if(e!==null)for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")o=a;else if(o==1)i=LE(i,a);else if(o==2){let c=a,l=e[++s];t=LE(t,c+": "+l+";")}}r?n.styles=t:n.stylesWithoutHost=t,r?n.classes=i:n.classesWithoutHost=i}function ut(n,e=0){let r=ce();if(r===null)return w(n,e);let t=gn();return jx(t,r,hn(n),e)}function M8(){let n="invalid";throw new Error(n)}function ZF(n,e,r,t,i){let o=t===null?null:{"":-1},s=i(n,r);if(s!==null){let a=s,c=null,l=null;for(let u of s)if(u.resolveHostDirectives!==null){[a,c,l]=u.resolveHostDirectives(s);break}F8(n,e,r,a,o,c,l)}o!==null&&t!==null&&P8(r,t,o)}function P8(n,e,r){let t=n.localNames=[];for(let i=0;i<e.length;i+=2){let o=r[e[i+1]];if(o==null)throw new oe(-301,!1);t.push(e[i],o)}}function x8(n,e,r){e.componentOffset=r,(n.components??=[]).push(e.index)}function F8(n,e,r,t,i,o,s){let a=t.length,c=!1;for(let f=0;f<a;f++){let g=t[f];!c&&bi(g)&&(c=!0,x8(n,r,f)),tD(f_(r,e),n,g.type)}$8(r,n.data.length,a);for(let f=0;f<a;f++){let g=t[f];g.providersResolver&&g.providersResolver(g)}let l=!1,u=!1,d=EF(n,e,a,null);a>0&&(r.directiveToIndex=new Map);for(let f=0;f<a;f++){let g=t[f];if(r.mergedAttrs=Yu(r.mergedAttrs,g.hostAttrs),U8(n,r,e,d,g),G8(d,g,i),s!==null&&s.has(g)){let[_,T]=s.get(g);r.directiveToIndex.set(g.type,[d,_+r.directiveStart,T+r.directiveStart])}else(o===null||!o.has(g))&&r.directiveToIndex.set(g.type,d);g.contentQueries!==null&&(r.flags|=4),(g.hostBindings!==null||g.hostAttrs!==null||g.hostVars!==0)&&(r.flags|=64);let p=g.type.prototype;!l&&(p.ngOnChanges||p.ngOnInit||p.ngDoCheck)&&((n.preOrderHooks??=[]).push(r.index),l=!0),!u&&(p.ngOnChanges||p.ngDoCheck)&&((n.preOrderCheckHooks??=[]).push(r.index),u=!0),d++}k8(n,r,o)}function k8(n,e,r){for(let t=e.directiveStart;t<e.directiveEnd;t++){let i=n.data[t];if(r===null||!r.has(i))fx(0,e,i,t),fx(1,e,i,t),mx(e,t,!1);else{let o=r.get(i);gx(0,e,o,t),gx(1,e,o,t),mx(e,t,!0)}}}function fx(n,e,r,t){let i=n===0?r.inputs:r.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s;n===0?s=e.inputs??={}:s=e.outputs??={},s[o]??=[],s[o].push(t),ek(e,o)}}function gx(n,e,r,t){let i=n===0?r.inputs:r.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o],a;n===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(t,o),ek(e,s)}}function ek(n,e){e==="class"?n.flags|=8:e==="style"&&(n.flags|=16)}function mx(n,e,r){let{attrs:t,inputs:i,hostDirectiveInputs:o}=n;if(t===null||!r&&i===null||r&&o===null||XD(n)){n.initialInputs??=[],n.initialInputs.push(null);return}let s=null,a=0;for(;a<t.length;){let c=t[a];if(c===0){a+=4;continue}else if(c===5){a+=2;continue}else if(typeof c=="number")break;if(!r&&i.hasOwnProperty(c)){let l=i[c];for(let u of l)if(u===e){s??=[],s.push(c,t[a+1]);break}}else if(r&&o.hasOwnProperty(c)){let l=o[c];for(let u=0;u<l.length;u+=2)if(l[u]===e){s??=[],s.push(l[u+1],t[a+1]);break}}a+=2}n.initialInputs??=[],n.initialInputs.push(s)}function U8(n,e,r,t,i){n.data[t]=i;let o=i.factory||(i.factory=Ys(i.type,!0)),s=new zc(o,bi(i),ut,null);n.blueprint[t]=s,r[t]=s,V8(n,e,t,EF(n,r,i.hostVars,Rn),i)}function V8(n,e,r,t,i){let o=i.hostBindings;if(o){let s=n.hostBindingOpCodes;s===null&&(s=n.hostBindingOpCodes=[]);let a=~e.index;B8(s)!=a&&s.push(a),s.push(r,t,o)}}function B8(n){let e=n.length;for(;e>0;){let r=n[--e];if(typeof r=="number"&&r<0)return r}return 0}function G8(n,e,r){if(r){if(e.exportAs)for(let t=0;t<e.exportAs.length;t++)r[e.exportAs[t]]=n;bi(e)&&(r[""]=n)}}function $8(n,e,r){n.flags|=1,n.directiveStart=e,n.directiveEnd=e+r,n.providerIndexes=e}function fR(n,e,r,t,i,o,s,a){let c=e[Te],l=c.consts,u=Vr(l,s),d=Xc(c,n,r,t,u);return o&&ZF(c,e,d,Vr(l,a),i),d.mergedAttrs=Yu(d.mergedAttrs,d.attrs),d.attrs!==null&&T_(d,d.attrs,!1),d.mergedAttrs!==null&&T_(d,d.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,d),d}function gR(n,e){xx(n,e),IA(e)&&n.queries.elementEnd(e)}function j8(n,e,r,t,i,o){let s=e.consts,a=Vr(s,i),c=Xc(e,n,r,t,a);if(c.mergedAttrs=Yu(c.mergedAttrs,c.attrs),o!=null){let l=Vr(s,o);c.localNames=[];for(let u=0;u<l.length;u+=2)c.localNames.push(l[u],-1)}return c.attrs!==null&&T_(c,c.attrs,!1),c.mergedAttrs!==null&&T_(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}function mR(n){return H_(n)?Array.isArray(n)||!(n instanceof Map)&&Symbol.iterator in n:!1}function tk(n,e){if(Array.isArray(n))for(let r=0;r<n.length;r++)e(n[r]);else{let r=n[Symbol.iterator](),t;for(;!(t=r.next()).done;)e(t.value)}}function H_(n){return n!==null&&(typeof n=="function"||typeof n=="object")}function Ao(n,e,r){return n[e]=r}function Qf(n,e){return n[e]}function Pn(n,e,r){if(r===Rn)return!1;let t=n[e];return Object.is(t,r)?!1:(n[e]=r,!0)}function Zu(n,e,r,t){let i=Pn(n,e,r);return Pn(n,e+1,t)||i}function pR(n,e,r,t,i){let o=Zu(n,e,r,t);return Pn(n,e+2,i)||o}function ed(n,e,r,t,i,o){let s=Zu(n,e,r,t);return Zu(n,e+2,i,o)||s}function c_(n,e,r){return function t(i){let o=as(n)?ii(n.index,e):e;hR(o,5);let s=e[$t],a=px(e,s,r,i),c=t.__ngNextListenerFn__;for(;c;)a=px(e,s,c,i)&&a,c=c.__ngNextListenerFn__;return a}}function px(n,e,r,t){let i=Ae(null);try{return lt(6,e,r),r(t)!==!1}catch(o){return o8(n,o),!1}finally{lt(7,e,r),Ae(i)}}function nk(n,e,r,t,i,o,s,a){let c=Bu(n),l=!1,u=null;if(!t&&c&&(u=W8(e,r,o,n.index)),u!==null){let d=u.__ngLastListenerFn__||u;d.__ngNextListenerFn__=s,u.__ngLastListenerFn__=s,l=!0}else{let d=ri(n,r),f=t?t(d):d;O4(r,f,o,a);let g=i.listen(f,o,a);if(!H8(o)){let p=t?_=>t(ni(_[n.index])):n.index;rk(p,e,r,o,a,g,!1)}}return l}function H8(n){return n.startsWith("animation")||n.startsWith("transition")}function W8(n,e,r,t){let i=n.cleanup;if(i!=null)for(let o=0;o<i.length-1;o+=2){let s=i[o];if(s===r&&i[o+1]===t){let a=e[Uu],c=i[o+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(o+=2)}return null}function rk(n,e,r,t,i,o,s){let a=e.firstCreatePass?RA(e):null,c=DA(r),l=c.length;c.push(i,o),a&&a.push(t,n,l,(l+1)*(s?-1:1))}function Ex(n,e,r,t,i,o){let s=e[r],a=e[Te],l=a.data[r].outputs[t],d=s[l].subscribe(o);rk(n.index,a,e,i,o,d,!0)}var vD=Symbol("BINDING");var I_=class extends Yf{ngModule;constructor(e){super(),this.ngModule=e}resolveComponentFactory(e){let r=Zs(e);return new td(r,this.ngModule)}};function z8(n){return Object.keys(n).map(e=>{let[r,t,i]=n[e],o={propName:r,templateName:e,isSignal:(t&x_.SignalBased)!==0};return i&&(o.transform=i),o})}function q8(n){return Object.keys(n).map(e=>({propName:n[e],templateName:e}))}function K8(n,e,r){let t=e instanceof Kn?e:e?.injector;return t&&n.getStandaloneInjector!==null&&(t=n.getStandaloneInjector(t)||t),t?new ID(r,t):r}function Y8(n){let e=n.get(ds,null);if(e===null)throw new oe(407,!1);let r=n.get(JF,null),t=n.get(ei,null);return{rendererFactory:e,sanitizer:r,changeDetectionScheduler:t,ngReflect:!1}}function Q8(n,e){let r=ik(n);return uF(e,r,r==="svg"?vA:r==="math"?y0:null)}function ik(n){return(n.selectors[0][0]||"div").toLowerCase()}var td=class extends $_{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=z8(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=q8(this.componentDef.outputs),this.cachedOutputs}constructor(e,r){super(),this.componentDef=e,this.ngModule=r,this.componentType=e.type,this.selector=Iq(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!r}create(e,r,t,i,o,s){lt(22);let a=Ae(null);try{let c=this.componentDef,l=X8(t,c,s,o),u=K8(c,i||this.ngModule,e),d=Y8(u),f=d.rendererFactory.createRenderer(null,c),g=t?Qq(f,t,c.encapsulation,u):Q8(c,f),p=s?.some(_x)||o?.some(D=>typeof D!="function"&&D.bindings.some(_x)),_=ZD(null,l,null,512|pF(c),null,null,d,f,u,null,nF(g,u,!0));_[et]=g,qE(_);let T=null;try{let D=fR(et,_,2,"#host",()=>l.directiveRegistry,!0,0);fF(f,g,D),Qu(g,_),V_(l,_,D),HD(l,D,_),gR(l,D),r!==void 0&&Z8(D,this.ngContentSelectors,r),T=ii(D.index,_),_[$t]=T[$t],dR(l,_,null)}catch(D){throw T!==null&&rD(T),rD(_),D}finally{lt(23),KE()}return new v_(this.componentType,_,!!p)}finally{Ae(a)}}};function X8(n,e,r,t){let i=n?["ng-version","20.3.18"]:vq(e.selectors[0]),o=null,s=null,a=0;if(r)for(let u of r)a+=u[vD].requiredVars,u.create&&(u.targetIdx=0,(o??=[]).push(u)),u.update&&(u.targetIdx=0,(s??=[]).push(u));if(t)for(let u=0;u<t.length;u++){let d=t[u];if(typeof d!="function")for(let f of d.bindings){a+=f[vD].requiredVars;let g=u+1;f.create&&(f.targetIdx=g,(o??=[]).push(f)),f.update&&(f.targetIdx=g,(s??=[]).push(f))}}let c=[e];if(t)for(let u of t){let d=typeof u=="function"?u:u.type,f=VE(d);c.push(f)}return JD(0,null,J8(o,s),1,a,c,null,null,null,[i],null)}function J8(n,e){return!n&&!e?null:r=>{if(r&1&&n)for(let t of n)t.create();if(r&2&&e)for(let t of e)t.update()}}function _x(n){let e=n[vD].kind;return e==="input"||e==="twoWay"}var v_=class extends XF{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,r,t){super(),this._rootLView=r,this._hasInputBindings=t,this._tNode=Lf(r[Te],et),this.location=ad(this._tNode,r),this.instance=ii(this._tNode.index,r)[$t],this.hostView=this.changeDetectorRef=new oa(r,void 0),this.componentType=e}setInput(e,r){this._hasInputBindings;let t=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),r))return;let i=this._rootLView,o=B_(t,i[Te],i,e,r);this.previousInputValues.set(e,r);let s=ii(t.index,i);hR(s,1)}get injector(){return new Wc(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function Z8(n,e,r){let t=n.projection=[];for(let i=0;i<e.length;i++){let o=r[i];t.push(o!=null&&o.length?Array.from(o):null)}}var Do=(()=>{class n{static __NG_ELEMENT_ID__=e5}return n})();function e5(){let n=gn();return sk(n,ce())}var t5=Do,ok=class extends t5{_lContainer;_hostTNode;_hostLView;constructor(e,r,t){super(),this._lContainer=e,this._hostTNode=r,this._hostLView=t}get element(){return ad(this._hostTNode,this._hostLView)}get injector(){return new Wc(this._hostTNode,this._hostLView)}get parentInjector(){let e=BD(this._hostTNode,this._hostLView);if(kx(e)){let r=d_(e,this._hostLView),t=u_(e),i=r[Te].data[t+8];return new Wc(i,r)}else return new Wc(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let r=Tx(this._lContainer);return r!==null&&r[e]||null}get length(){return this._lContainer.length-jt}createEmbeddedView(e,r,t){let i,o;typeof t=="number"?i=t:t!=null&&(i=t.index,o=t.injector);let s=__(this._lContainer,e.ssrId),a=e.createEmbeddedViewImpl(r||{},o,s);return this.insertImpl(a,i,Ju(this._hostTNode,s)),a}createComponent(e,r,t,i,o,s,a){let c=e&&!Z6(e),l;if(c)l=r;else{let T=r||{};l=T.index,t=T.injector,i=T.projectableNodes,o=T.environmentInjector||T.ngModuleRef,s=T.directives,a=T.bindings}let u=c?e:new td(Zs(e)),d=t||this.parentInjector;if(!o&&u.ngModule==null){let D=(c?d:this.parentInjector).get(Kn,null);D&&(o=D)}let f=Zs(u.componentType??{}),g=__(this._lContainer,f?.id??null),p=g?.firstChild??null,_=u.create(d,i,p,o,s,a);return this.insertImpl(_.hostView,l,Ju(this._hostTNode,g)),_}insert(e,r){return this.insertImpl(e,r,!0)}insertImpl(e,r,t){let i=e._lView;if(A0(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[fn],l=new ok(c,c[sr],c[fn]);l.detach(l.indexOf(e))}}let o=this._adjustIndex(r),s=this._lContainer;return Kf(s,i,o,t),e.attachToViewContainerRef(),lA(zA(s),o,e),e}move(e,r){return this.insert(e,r)}indexOf(e){let r=Tx(this._lContainer);return r!==null?r.indexOf(e):-1}remove(e){let r=this._adjustIndex(e,-1),t=$f(this._lContainer,r);t&&(Cf(zA(this._lContainer),r),k_(t[Te],t))}detach(e){let r=this._adjustIndex(e,-1),t=$f(this._lContainer,r);return t&&Cf(zA(this._lContainer),r)!=null?new oa(t):null}_adjustIndex(e,r=0){return e??this.length+r}};function Tx(n){return n[bf]}function zA(n){return n[bf]||(n[bf]=[])}function sk(n,e){let r,t=e[n.index];return wi(t)?r=t:(r=zF(t,e,null,n),e[n.index]=r,eR(e,r)),r5(r,e,n,t),new ok(r,n,e)}function n5(n,e){let r=n[Ze],t=r.createComment(""),i=ri(e,n),o=r.parentNode(i);return m_(r,o,t,r.nextSibling(i),!1),t}var r5=s5,i5=()=>!1;function o5(n,e,r){return i5(n,e,r)}function s5(n,e,r,t){if(n[ta])return;let i;r.type&8?i=ni(t):i=n5(e,r),n[ta]=i}var yD=class n{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new n(this.queryList)}setDirty(){this.queryList.setDirty()}},SD=class n{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let r=e.queries;if(r!==null){let t=e.contentQueries!==null?e.contentQueries[0]:r.length,i=[];for(let o=0;o<t;o++){let s=r.getByIndex(o),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new n(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let r=0;r<this.queries.length;r++)_R(e,r).matches!==null&&this.queries[r].setDirty()}},y_=class{flags;read;predicate;constructor(e,r,t=null){this.flags=r,this.read=t,typeof e=="string"?this.predicate=h5(e):this.predicate=e}},AD=class n{queries;constructor(e=[]){this.queries=e}elementStart(e,r){for(let t=0;t<this.queries.length;t++)this.queries[t].elementStart(e,r)}elementEnd(e){for(let r=0;r<this.queries.length;r++)this.queries[r].elementEnd(e)}embeddedTView(e){let r=null;for(let t=0;t<this.length;t++){let i=r!==null?r.length:0,o=this.getByIndex(t).embeddedTView(e,i);o&&(o.indexInDeclarationView=t,r!==null?r.push(o):r=[o])}return r!==null?new n(r):null}template(e,r){for(let t=0;t<this.queries.length;t++)this.queries[t].template(e,r)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},DD=class n{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,r=-1){this.metadata=e,this._declarationNodeIndex=r}elementStart(e,r){this.isApplyingToNode(r)&&this.matchTNode(e,r)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,r){this.elementStart(e,r)}embeddedTView(e,r){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,r),new n(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let r=this._declarationNodeIndex,t=e.parent;for(;t!==null&&t.type&8&&t.index!==r;)t=t.parent;return r===(t!==null?t.index:-1)}return this._appliesToNextNode}matchTNode(e,r){let t=this.metadata.predicate;if(Array.isArray(t))for(let i=0;i<t.length;i++){let o=t[i];this.matchTNodeWithReadOption(e,r,a5(r,o)),this.matchTNodeWithReadOption(e,r,s_(r,e,o,!1,!1))}else t===yo?r.type&4&&this.matchTNodeWithReadOption(e,r,-1):this.matchTNodeWithReadOption(e,r,s_(r,e,t,!1,!1))}matchTNodeWithReadOption(e,r,t){if(t!==null){let i=this.metadata.read;if(i!==null)if(i===sa||i===Do||i===yo&&r.type&4)this.addMatch(r.index,-2);else{let o=s_(r,e,i,!1,!1);o!==null&&this.addMatch(r.index,o)}else this.addMatch(r.index,t)}}addMatch(e,r){this.matches===null?this.matches=[e,r]:this.matches.push(e,r)}};function a5(n,e){let r=n.localNames;if(r!==null){for(let t=0;t<r.length;t+=2)if(r[t]===e)return r[t+1]}return null}function c5(n,e){return n.type&11?ad(n,e):n.type&4?G_(n,e):null}function l5(n,e,r,t){return r===-1?c5(e,n):r===-2?u5(n,e,t):Bf(n,n[Te],r,e)}function u5(n,e,r){if(r===sa)return ad(e,n);if(r===yo)return G_(e,n);if(r===Do)return sk(e,n)}function ak(n,e,r,t){let i=e[mo].queries[t];if(i.matches===null){let o=n.data,s=r.matches,a=[];for(let c=0;s!==null&&c<s.length;c+=2){let l=s[c];if(l<0)a.push(null);else{let u=o[l];a.push(l5(e,u,s[c+1],r.metadata.read))}}i.matches=a}return i.matches}function RD(n,e,r,t){let i=n.queries.getByIndex(r),o=i.matches;if(o!==null){let s=ak(n,e,i,r);for(let a=0;a<o.length;a+=2){let c=o[a];if(c>0)t.push(s[a/2]);else{let l=o[a+1],u=e[-c];for(let d=jt;d<u.length;d++){let f=u[d];f[ea]===f[fn]&&RD(f[Te],f,l,t)}if(u[Vc]!==null){let d=u[Vc];for(let f=0;f<d.length;f++){let g=d[f];RD(g[Te],g,l,t)}}}}}return t}function ER(n,e){return n[mo].queries[e].queryList}function ck(n,e,r){let t=new g_((r&4)===4);return C0(n,e,t,t.destroy),(e[mo]??=new SD).queries.push(new yD(t))-1}function lk(n,e,r){let t=tt();return t.firstCreatePass&&(uk(t,new y_(n,e,r),-1),(e&2)===2&&(t.staticViewQueries=!0)),ck(t,ce(),e)}function d5(n,e,r,t){let i=tt();if(i.firstCreatePass){let o=gn();uk(i,new y_(e,r,t),o.index),f5(i,n),(r&2)===2&&(i.staticContentQueries=!0)}return ck(i,ce(),r)}function h5(n){return n.split(",").map(e=>e.trim())}function uk(n,e,r){n.queries===null&&(n.queries=new AD),n.queries.track(new DD(e,r))}function f5(n,e){let r=n.contentQueries||(n.contentQueries=[]),t=r.length?r[r.length-1]:-1;e!==t&&r.push(n.queries.length-1,e)}function _R(n,e){return n.queries.getByIndex(e)}function dk(n,e){let r=n[Te],t=_R(r,e);return t.crossesNgTemplate?RD(r,n,e,[]):ak(r,n,t,e)}function hk(n,e,r){let t,i=vf(()=>{t._dirtyCounter();let o=m5(t,n);if(e&&o===void 0)throw new oe(-951,!1);return o});return t=i[An],t._dirtyCounter=jc(0),t._flatValue=void 0,i}function fk(n){return hk(!0,!1,n)}function gk(n){return hk(!0,!0,n)}function g5(n,e){let r=n[An];r._lView=ce(),r._queryIndex=e,r._queryList=ER(r._lView,e),r._queryList.onDirty(()=>r._dirtyCounter.update(t=>t+1))}function m5(n,e){let r=n._lView,t=n._queryIndex;if(r===void 0||t===void 0||r[De]&4)return e?void 0:qn;let i=ER(r,t),o=dk(r,t);return i.reset(o,zx),e?i.first:i._changesDetected||n._flatValue===void 0?n._flatValue=i.toArray():n._flatValue}function mk(n){let e=[],r=new Map;function t(i){let o=r.get(i);if(!o){let s=n(i);r.set(i,o=s.then(a=>E5(i,a)))}return o}return S_.forEach((i,o)=>{let s=[];i.templateUrl&&s.push(t(i.templateUrl).then(l=>{i.template=l}));let a=typeof i.styles=="string"?[i.styles]:i.styles||[];if(i.styles=a,i.styleUrl&&i.styleUrls?.length)throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple");if(i.styleUrls?.length){let l=i.styles.length,u=i.styleUrls;i.styleUrls.forEach((d,f)=>{a.push(""),s.push(t(d).then(g=>{a[l+f]=g,u.splice(u.indexOf(d),1),u.length==0&&(i.styleUrls=void 0)}))})}else i.styleUrl&&s.push(t(i.styleUrl).then(l=>{a.push(l),i.styleUrl=void 0}));let c=Promise.all(s).then(()=>_5(o));e.push(c)}),pk(),Promise.all(e).then(()=>{})}var S_=new Map,p5=new Set;function pk(){let n=S_;return S_=new Map,n}function Ek(){return S_.size===0}function E5(n,e){return typeof e=="string"?e:e.status!==void 0&&e.status!==200?Promise.reject(new oe(918,!1)):e.text()}function _5(n){p5.delete(n)}var Kc=class{},_k=class{};function Tk(n,e){return new nd(n,e??null,[])}var nd=class extends Kc{ngModuleType;_parent;_bootstrapComponents=[];_r3Injector;instance;destroyCbs=[];componentFactoryResolver=new I_(this);constructor(e,r,t,i=!0){super(),this.ngModuleType=e,this._parent=r;let o=p0(e);this._bootstrapComponents=lq(o.bootstrap),this._r3Injector=VA(e,r,[{provide:Kc,useValue:this},{provide:Yf,useValue:this.componentFactoryResolver},...t],rs(e),new Set(["environment"])),i&&this.resolveInjectorInitializers()}resolveInjectorInitializers(){this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(this.ngModuleType)}get injector(){return this._r3Injector}destroy(){let e=this._r3Injector;!e.destroyed&&e.destroy(),this.destroyCbs.forEach(r=>r()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}},A_=class extends _k{moduleType;constructor(e){super(),this.moduleType=e}create(e){return new nd(this.moduleType,e,[])}};function Ik(n,e,r){return new nd(n,e,r,!1)}var D_=class extends Kc{injector;componentFactoryResolver=new I_(this);instance=null;constructor(e){super();let r=new Lc([...e.providers,{provide:Kc,useValue:this},{provide:Yf,useValue:this.componentFactoryResolver}],e.parent||ku(),e.debugName,new Set(["environment"]));this.injector=r,e.runEnvironmentInitializers&&r.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function vk(n,e,r=null){return new D_({providers:n,parent:e,debugName:r,runEnvironmentInitializers:!0}).injector}var T5=(()=>{class n{_injector;cachedInjectors=new Map;constructor(r){this._injector=r}getOrCreateStandaloneInjector(r){if(!r.standalone)return null;if(!this.cachedInjectors.has(r)){let t=fA(!1,r.type),i=t.length>0?vk([t],this._injector,`Standalone[${r.type.name}]`):null;this.cachedInjectors.set(r,i)}return this.cachedInjectors.get(r)}ngOnDestroy(){try{for(let r of this.cachedInjectors.values())r!==null&&r.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:n,providedIn:"environment",factory:()=>new n(w(Kn))})}return n})();function I5(n){return sd(()=>{let e=Sk(n),r=le(x({},e),{decls:n.decls,vars:n.vars,template:n.template,consts:n.consts||null,ngContentSelectors:n.ngContentSelectors,onPush:n.changeDetection===GD.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&n.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(T5).getOrCreateStandaloneInjector(r):null,getExternalStyles:null,signals:n.signals??!1,data:n.data||{},encapsulation:n.encapsulation||ls.Emulated,styles:n.styles||qn,_:null,schemas:n.schemas||null,tView:null,id:""});e.standalone&&gs("NgStandalone"),Ak(r);let t=n.dependencies;return r.directiveDefs=R_(t,yk),r.pipeDefs=R_(t,hA),r.id=S5(r),r})}function yk(n){return Zs(n)||VE(n)}function aa(n){return sd(()=>({type:n.type,bootstrap:n.bootstrap||qn,declarations:n.declarations||qn,imports:n.imports||qn,exports:n.exports||qn,transitiveCompileScopes:null,schemas:n.schemas||null,id:n.id||null}))}function v5(n,e){if(n==null)return Ni;let r={};for(let t in n)if(n.hasOwnProperty(t)){let i=n[t],o,s,a,c;Array.isArray(i)?(a=i[0],o=i[1],s=i[2]??o,c=i[3]||null):(o=i,s=i,a=x_.None,c=null),r[o]=[t,a,c],e[o]=s}return r}function y5(n){if(n==null)return Ni;let e={};for(let r in n)n.hasOwnProperty(r)&&(e[n[r]]=r);return e}function Ro(n){return sd(()=>{let e=Sk(n);return Ak(e),e})}function Xf(n){return{type:n.type,name:n.name,factory:null,pure:n.pure!==!1,standalone:n.standalone??!0,onDestroy:n.type.prototype.ngOnDestroy||null}}function Sk(n){let e={};return{type:n.type,providersResolver:null,factory:null,hostBindings:n.hostBindings||null,hostVars:n.hostVars||0,hostAttrs:n.hostAttrs||null,contentQueries:n.contentQueries||null,declaredInputs:e,inputConfig:n.inputs||Ni,exportAs:n.exportAs||null,standalone:n.standalone??!0,signals:n.signals===!0,selectors:n.selectors||qn,viewQuery:n.viewQuery||null,features:n.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,inputs:v5(n.inputs,e),outputs:y5(n.outputs),debugInfo:null}}function Ak(n){n.features?.forEach(e=>e(n))}function R_(n,e){return n?()=>{let r=typeof n=="function"?n():n,t=[];for(let i of r){let o=e(i);o!==null&&t.push(o)}return t}:null}function S5(n){let e=0,r=typeof n.consts=="function"?"":n.consts,t=[n.selectors,n.ngContentSelectors,n.hostVars,n.hostAttrs,r,n.vars,n.decls,n.encapsulation,n.standalone,n.signals,n.exportAs,JSON.stringify(n.inputs),JSON.stringify(n.outputs),Object.getOwnPropertyNames(n.type.prototype),!!n.contentQueries,!!n.viewQuery];for(let o of t.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function A5(n){return Object.getPrototypeOf(n.prototype).constructor}function Dk(n){let e=A5(n.type),r=!0,t=[n];for(;e;){let i;if(bi(n))i=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new oe(903,!1);i=e.\u0275dir}if(i){if(r){t.push(i);let s=n;s.inputs=qA(n.inputs),s.declaredInputs=qA(n.declaredInputs),s.outputs=qA(n.outputs);let a=i.hostBindings;a&&O5(n,a);let c=i.viewQuery,l=i.contentQueries;if(c&&C5(n,c),l&&N5(n,l),D5(n,i),a0(n.outputs,i.outputs),bi(i)&&i.data.animation){let u=n.data;u.animation=(u.animation||[]).concat(i.data.animation)}}let o=i.features;if(o)for(let s=0;s<o.length;s++){let a=o[s];a&&a.ngInherit&&a(n),a===Dk&&(r=!1)}}e=Object.getPrototypeOf(e)}R5(t)}function D5(n,e){for(let r in e.inputs){if(!e.inputs.hasOwnProperty(r)||n.inputs.hasOwnProperty(r))continue;let t=e.inputs[r];t!==void 0&&(n.inputs[r]=t,n.declaredInputs[r]=e.declaredInputs[r])}}function R5(n){let e=0,r=null;for(let t=n.length-1;t>=0;t--){let i=n[t];i.hostVars=e+=i.hostVars,i.hostAttrs=Yu(i.hostAttrs,r=Yu(r,i.hostAttrs))}}function qA(n){return n===Ni?{}:n===qn?[]:n}function C5(n,e){let r=n.viewQuery;r?n.viewQuery=(t,i)=>{e(t,i),r(t,i)}:n.viewQuery=e}function N5(n,e){let r=n.contentQueries;r?n.contentQueries=(t,i,o)=>{e(t,i,o),r(t,i,o)}:n.contentQueries=e}function O5(n,e){let r=n.hostBindings;r?n.hostBindings=(t,i)=>{e(t,i),r(t,i)}:n.hostBindings=e}function w5(n){let e=r=>{let t=Array.isArray(n);r.hostDirectives===null?(r.resolveHostDirectives=b5,r.hostDirectives=t?n.map(CD):[n]):t?r.hostDirectives.unshift(...n.map(CD)):r.hostDirectives.unshift(n)};return e.ngInherit=!0,e}function b5(n){let e=[],r=!1,t=null,i=null;for(let o=0;o<n.length;o++){let s=n[o];if(s.hostDirectives!==null){let a=e.length;t??=new Map,i??=new Map,Rk(s,e,t),i.set(s,[a,e.length-1])}o===0&&bi(s)&&(r=!0,e.push(s))}for(let o=r?1:0;o<n.length;o++)e.push(n[o]);return[e,t,i]}function Rk(n,e,r){if(n.hostDirectives!==null)for(let t of n.hostDirectives)if(typeof t=="function"){let i=t();for(let o of i)Ix(CD(o),e,r)}else Ix(t,e,r)}function Ix(n,e,r){let t=VE(n.directive);L5(t.declaredInputs,n.inputs),Rk(t,e,r),r.set(t,n),e.push(t)}function CD(n){return typeof n=="function"?{directive:hn(n),inputs:Ni,outputs:Ni}:{directive:hn(n.directive),inputs:vx(n.inputs),outputs:vx(n.outputs)}}function vx(n){if(n===void 0||n.length===0)return Ni;let e={};for(let r=0;r<n.length;r+=2)e[n[r]]=n[r+1];return e}function L5(n,e){for(let r in e)if(e.hasOwnProperty(r)){let t=e[r],i=n[r];n[t]=i}}function Ck(n,e,r,t,i,o,s,a){if(r.firstCreatePass){n.mergedAttrs=Yu(n.mergedAttrs,n.attrs);let u=n.tView=JD(2,n,i,o,s,r.directiveRegistry,r.pipeRegistry,null,r.schemas,r.consts,null);r.queries!==null&&(r.queries.template(r,n),u.queries=r.queries.embeddedTView(n))}a&&(n.flags|=a),$c(n,!1);let c=P5(r,e,n,t);YE()&&sR(r,e,c,n),Qu(c,e);let l=zF(c,e,c,n);e[t+et]=l,eR(e,l),o5(l,n,e)}function M5(n,e,r,t,i,o,s,a,c,l,u){let d=r+et,f;return e.firstCreatePass?(f=Xc(e,d,4,s||null,a||null),HE()&&ZF(e,n,f,Vr(e.consts,l),cR),xx(e,f)):f=e.data[d],Ck(f,n,e,r,t,i,o,c),Bu(f)&&V_(e,n,f),l!=null&&zf(n,f,u),f}function rd(n,e,r,t,i,o,s,a,c,l,u){let d=r+et,f;if(e.firstCreatePass){if(f=Xc(e,d,4,s||null,a||null),l!=null){let g=Vr(e.consts,l);f.localNames=[];for(let p=0;p<g.length;p+=2)f.localNames.push(g[p],-1)}}else f=e.data[d];return Ck(f,n,e,r,t,i,o,c),l!=null&&zf(n,f,u),f}function Nk(n,e,r,t,i,o,s,a){let c=ce(),l=tt(),u=Vr(l.consts,o);return M5(c,l,n,e,r,t,i,u,void 0,s,a),Nk}function Ok(n,e,r,t,i,o,s,a){let c=ce(),l=tt(),u=Vr(l.consts,o);return rd(c,l,n,e,r,t,i,u,void 0,s,a),Ok}var P5=x5;function x5(n,e,r,t){return Ff(!0),e[Ze].createComment("")}var W_=new Z(""),ld=new Z(""),Jf=(()=>{class n{_ngZone;registry;_isZoneStable=!0;_callbacks=[];_taskTrackingZone=null;_destroyRef;constructor(r,t,i){this._ngZone=r,this.registry=t,pA()&&(this._destroyRef=ne(cr,{optional:!0})??void 0),TR||(wk(i),i.addToWindow(t)),this._watchAngularEvents(),r.run(()=>{this._taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){let r=this._ngZone.onUnstable.subscribe({next:()=>{this._isZoneStable=!1}}),t=this._ngZone.runOutsideAngular(()=>this._ngZone.onStable.subscribe({next:()=>{Le.assertNotInAngularZone(),queueMicrotask(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}}));this._destroyRef?.onDestroy(()=>{r.unsubscribe(),t.unsubscribe()})}isStable(){return this._isZoneStable&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())queueMicrotask(()=>{for(;this._callbacks.length!==0;){let r=this._callbacks.pop();clearTimeout(r.timeoutId),r.doneCb()}});else{let r=this.getPendingTasks();this._callbacks=this._callbacks.filter(t=>t.updateCb&&t.updateCb(r)?(clearTimeout(t.timeoutId),!1):!0)}}getPendingTasks(){return this._taskTrackingZone?this._taskTrackingZone.macroTasks.map(r=>({source:r.source,creationLocation:r.creationLocation,data:r.data})):[]}addCallback(r,t,i){let o=-1;t&&t>0&&(o=setTimeout(()=>{this._callbacks=this._callbacks.filter(s=>s.timeoutId!==o),r()},t)),this._callbacks.push({doneCb:r,timeoutId:o,updateCb:i})}whenStable(r,t,i){if(i&&!this._taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(r,t,i),this._runCallbacksIfReady()}registerApplication(r){this.registry.registerApplication(r,this)}unregisterApplication(r){this.registry.unregisterApplication(r)}findProviders(r,t,i){return[]}static \u0275fac=function(t){return new(t||n)(w(Le),w(Zf),w(ld))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),Zf=(()=>{class n{_applications=new Map;registerApplication(r,t){this._applications.set(r,t)}unregisterApplication(r){this._applications.delete(r)}unregisterAllApplications(){this._applications.clear()}getTestability(r){return this._applications.get(r)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(r,t=!0){return TR?.findTestabilityInTree(this,r,t)??null}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"platform"})}return n})();function wk(n){TR=n}var TR;function z_(n){return!!n&&typeof n.then=="function"}function IR(n){return!!n&&typeof n.subscribe=="function"}var bk=new Z("");var vR=(()=>{class n{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((r,t)=>{this.resolve=r,this.reject=t});appInits=ne(bk,{optional:!0})??[];injector=ne(St);constructor(){}runInitializers(){if(this.initialized)return;let r=[];for(let i of this.appInits){let o=fo(this.injector,i);if(z_(o))r.push(o);else if(IR(o)){let s=new Promise((a,c)=>{o.subscribe({complete:a,error:c})});r.push(s)}}let t=()=>{this.done=!0,this.resolve()};Promise.all(r).then(()=>{t()}).catch(i=>{this.reject(i)}),r.length===0&&t(),this.initialized=!0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Lk=new Z("");function Mk(){xS(()=>{let n="";throw new oe(600,n)})}function Pk(n){return n.isBoundToModule}var F5=10;function yR(n,e){return Array.isArray(e)?e.reduce(yR,n):x(x({},n),e)}var ca=(()=>{class n{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=ne(_o);afterRenderManager=ne(iR);zonelessEnabled=ne(zu);rootEffectScheduler=ne(kf);dirtyFlags=0;tracingSnapshot=null;allTestViews=new Set;autoDetectTestViews=new Set;includeAllTestViews=!1;afterTick=new Ot;get allViews(){return[...(this.includeAllTestViews?this.allTestViews:this.autoDetectTestViews).keys(),...this._views]}get destroyed(){return this._destroyed}componentTypes=[];components=[];internalPendingTask=ne(ia);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(fe(r=>!r))}constructor(){ne(Qc,{optional:!0})}whenStable(){let r;return new Promise(t=>{r=this.isStable.subscribe({next:i=>{i&&t()}})}).finally(()=>{r.unsubscribe()})}_injector=ne(Kn);_rendererFactory=null;get injector(){return this._injector}bootstrap(r,t){return this.bootstrapImpl(r,t)}bootstrapImpl(r,t,i=St.NULL){return this._injector.get(Le).run(()=>{lt(10);let s=r instanceof $_;if(!this._injector.get(vR).done){let p="";throw new oe(405,p)}let c;s?c=r:c=this._injector.get(Yf).resolveComponentFactory(r),this.componentTypes.push(c.componentType);let l=Pk(c)?void 0:this._injector.get(Kc),u=t||c.selector,d=c.create(i,[],u,l),f=d.location.nativeElement,g=d.injector.get(W_,null);return g?.registerApplication(f),d.onDestroy(()=>{this.detachView(d.hostView),Vf(this.components,d),g?.unregisterApplication(f)}),this._loadComponent(d),lt(11,d),d})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){lt(12),this.tracingSnapshot!==null?this.tracingSnapshot.run(F_.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw new oe(101,!1);let r=Ae(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,Ae(r),this.afterTick.next(),lt(13)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(ds,null,{optional:!0}));let r=0;for(;this.dirtyFlags!==0&&r++<F5;)lt(14),this.synchronizeOnce(),lt(15)}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let r=!1;if(this.dirtyFlags&7){let t=!!(this.dirtyFlags&1);this.dirtyFlags&=-8,this.dirtyFlags|=8;for(let{_lView:i}of this.allViews){if(!t&&!$u(i))continue;let o=t&&!this.zonelessEnabled?0:1;$F(i,o),r=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}r||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:r})=>$u(r))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(r){let t=r;this._views.push(t),t.attachToAppRef(this)}detachView(r){let t=r;Vf(this._views,t),t.detachFromAppRef()}_loadComponent(r){this.attachView(r.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(r),this._injector.get(Lk,[]).forEach(i=>i(r))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(r=>r()),this._views.slice().forEach(r=>r.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(r){return this._destroyListeners.push(r),()=>Vf(this._destroyListeners,r)}destroy(){if(this._destroyed)throw new oe(406,!1);let r=this._injector;r.destroy&&!r.destroyed&&r.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Vf(n,e){let r=n.indexOf(e);r>-1&&n.splice(r,1)}function xk(n,e){let r=ce(),t=Eo();if(Pn(r,t,e)){let i=tt(),o=Hu();if(B_(o,i,r,n,e))as(o)&&xF(r,o.index);else{let a=ri(o,r);FF(r[Ze],a,null,o.value,n,e,null)}}return xk}function Fk(n,e,r,t){let i=ce(),o=Eo();if(Pn(i,o,e)){let s=tt(),a=Hu();r8(a,i,n,e,r,t)}return Fk}var Mpe=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";function k5(){return ce()[Yn][$t]}var ND=class{destroy(e){}updateValue(e,r){}swap(e,r){let t=Math.min(e,r),i=Math.max(e,r),o=this.detach(i);if(i-t>1){let s=this.detach(t);this.attach(t,o),this.attach(i,s)}else this.attach(t,o)}move(e,r){this.attach(r,this.detach(e))}};function KA(n,e,r,t,i){return n===r&&Object.is(e,t)?1:Object.is(i(n,e),i(r,t))?-1:0}function U5(n,e,r){let t,i,o=0,s=n.length-1,a=void 0;if(Array.isArray(e)){let c=e.length-1;for(;o<=s&&o<=c;){let l=n.at(o),u=e[o],d=KA(o,l,o,u,r);if(d!==0){d<0&&n.updateValue(o,u),o++;continue}let f=n.at(s),g=e[c],p=KA(s,f,c,g,r);if(p!==0){p<0&&n.updateValue(s,g),s--,c--;continue}let _=r(o,l),T=r(s,f),D=r(o,u);if(Object.is(D,T)){let b=r(c,g);Object.is(b,_)?(n.swap(o,s),n.updateValue(s,g),c--,s--):n.move(s,o),n.updateValue(o,u),o++;continue}if(t??=new C_,i??=Sx(n,o,s,r),OD(n,t,o,D))n.updateValue(o,u),o++,s++;else if(i.has(D))t.set(_,n.detach(o)),s--;else{let b=n.create(o,e[o]);n.attach(o,b),o++,s++}}for(;o<=c;)yx(n,t,r,o,e[o]),o++}else if(e!=null){let c=e[Symbol.iterator](),l=c.next();for(;!l.done&&o<=s;){let u=n.at(o),d=l.value,f=KA(o,u,o,d,r);if(f!==0)f<0&&n.updateValue(o,d),o++,l=c.next();else{t??=new C_,i??=Sx(n,o,s,r);let g=r(o,d);if(OD(n,t,o,g))n.updateValue(o,d),o++,s++,l=c.next();else if(!i.has(g))n.attach(o,n.create(o,d)),o++,s++,l=c.next();else{let p=r(o,u);t.set(p,n.detach(o)),s--}}}for(;!l.done;)yx(n,t,r,n.length,l.value),l=c.next()}for(;o<=s;)n.destroy(n.detach(s--));t?.forEach(c=>{n.destroy(c)})}function OD(n,e,r,t){return e!==void 0&&e.has(t)?(n.attach(r,e.get(t)),e.delete(t),!0):!1}function yx(n,e,r,t,i){if(OD(n,e,t,r(t,i)))n.updateValue(t,i);else{let o=n.create(t,i);n.attach(t,o)}}function Sx(n,e,r,t){let i=new Set;for(let o=e;o<=r;o++)i.add(t(o,n.at(o)));return i}var C_=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let r=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(r)?(this.kvMap.set(e,this._vMap.get(r)),this._vMap.delete(r)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,r){if(this.kvMap.has(e)){let t=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let i=this._vMap;for(;i.has(t);)t=i.get(t);i.set(t,r)}else this.kvMap.set(e,r)}forEach(e){for(let[r,t]of this.kvMap)if(e(t,r),this._vMap!==void 0){let i=this._vMap;for(;i.has(t);)t=i.get(t),e(t,r)}}};function V5(n,e,r,t,i,o,s,a){gs("NgControlFlow");let c=ce(),l=tt(),u=Vr(l.consts,o);return rd(c,l,n,e,r,t,i,u,256,s,a),SR}function SR(n,e,r,t,i,o,s,a){gs("NgControlFlow");let c=ce(),l=tt(),u=Vr(l.consts,o);return rd(c,l,n,e,r,t,i,u,512,s,a),SR}function B5(n,e){gs("NgControlFlow");let r=ce(),t=Eo(),i=r[t]!==Rn?r[t]:-1,o=i!==-1?N_(r,et+i):void 0,s=0;if(Pn(r,t,n)){let a=Ae(null);try{if(o!==void 0&&KF(o,s),n!==-1){let c=et+n,l=N_(r,c),u=MD(r[Te],c),d=QF(l,u,r),f=qf(r,u,e,{dehydratedView:d});Kf(l,f,s,Ju(u,d))}}finally{Ae(a)}}else if(o!==void 0){let a=qF(o,s);a!==void 0&&(a[$t]=e)}}var wD=class{lContainer;$implicit;$index;constructor(e,r,t){this.lContainer=e,this.$implicit=r,this.$index=t}get $count(){return this.lContainer.length-jt}};function G5(n){return n}function $5(n,e){return e}var bD=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,r,t){this.hasEmptyBlock=e,this.trackByFn=r,this.liveCollection=t}};function j5(n,e,r,t,i,o,s,a,c,l,u,d,f){gs("NgControlFlow");let g=ce(),p=tt(),_=c!==void 0,T=ce(),D=a?s.bind(T[Yn][$t]):s,b=new bD(_,D);T[et+n]=b,rd(g,p,n+1,e,r,t,i,Vr(p.consts,o),256),_&&rd(g,p,n+2,c,l,u,d,Vr(p.consts,f),512)}var LD=class extends ND{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,r,t){super(),this.lContainer=e,this.hostLView=r,this.templateTNode=t}get length(){return this.lContainer.length-jt}at(e){return this.getLView(e)[$t].$implicit}attach(e,r){let t=r[Pc];this.needsIndexUpdate||=e!==this.length,Kf(this.lContainer,r,e,Ju(this.templateTNode,t)),W5(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,z5(this.lContainer,e),q5(this.lContainer,e)}create(e,r){let t=__(this.lContainer,this.templateTNode.tView.ssrId),i=qf(this.hostLView,this.templateTNode,new wD(this.lContainer,r,e),{dehydratedView:t});return this.operationsCounter?.recordCreate(),i}destroy(e){k_(e[Te],e),this.operationsCounter?.recordDestroy()}updateValue(e,r){this.getLView(e)[$t].$implicit=r}reset(){this.needsIndexUpdate=!1,this.operationsCounter?.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let e=0;e<this.length;e++)this.getLView(e)[$t].$index=e}getLView(e){return K5(this.lContainer,e)}};function H5(n){let e=Ae(null),r=oi();try{let t=ce(),i=t[Te],o=t[r],s=r+1,a=N_(t,s);if(o.liveCollection===void 0){let l=MD(i,s);o.liveCollection=new LD(a,t,l)}else o.liveCollection.reset();let c=o.liveCollection;if(U5(c,n,o.trackByFn),c.updateIndexes(),o.hasEmptyBlock){let l=Eo(),u=c.length===0;if(Pn(t,l,u)){let d=r+2,f=N_(t,d);if(u){let g=MD(i,d),p=QF(f,g,t),_=qf(t,g,void 0,{dehydratedView:p});Kf(f,_,0,Ju(g,p))}else i.firstUpdatePass&&N8(f),KF(f,0)}}}finally{Ae(e)}}function N_(n,e){return n[e]}function W5(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r],i=t?t[Uc]:void 0;if(t&&i&&i.detachedLeaveAnimationFns&&i.detachedLeaveAnimationFns.length>0){let o=t[os];Fq(o,i),qc.delete(t),i.detachedLeaveAnimationFns=void 0}}function z5(n,e){if(n.length<=jt)return;let r=jt+e,t=n[r],i=t?t[Uc]:void 0;i&&i.leave&&i.leave.size>0&&(i.detachedLeaveAnimationFns=[])}function q5(n,e){return $f(n,e)}function K5(n,e){return qF(n,e)}function MD(n,e){return Lf(n,e)}function kk(n,e,r){let t=ce(),i=Eo();if(Pn(t,i,e)){let o=tt(),s=Hu();MF(s,t,n,e,t[Ze],r)}return kk}function PD(n,e,r,t,i){B_(e,n,r,i?"class":"style",t)}function AR(n,e,r,t){let i=ce(),o=i[Te],s=n+et,a=o.firstCreatePass?fR(s,i,2,e,cR,HE(),r,t):o.data[s];if(lR(a,i,n,e,Bk),Bu(a)){let c=i[Te];V_(c,i,a),HD(c,a,i)}return t!=null&&zf(i,a),AR}function DR(){let n=tt(),e=gn(),r=uR(e);return n.firstCreatePass&&gR(n,r),OA(r)&&wA(),CA(),r.classesWithoutHost!=null&&o4(r)&&PD(n,r,ce(),r.classesWithoutHost,!0),r.stylesWithoutHost!=null&&s4(r)&&PD(n,r,ce(),r.stylesWithoutHost,!1),DR}function Uk(n,e,r,t){return AR(n,e,r,t),DR(),Uk}function RR(n,e,r,t){let i=ce(),o=i[Te],s=n+et,a=o.firstCreatePass?j8(s,o,2,e,r,t):o.data[s];return lR(a,i,n,e,Bk),t!=null&&zf(i,a),RR}function CR(){let n=gn(),e=uR(n);return OA(e)&&wA(),CA(),CR}function Vk(n,e,r,t){return RR(n,e,r,t),CR(),Vk}var Bk=(n,e,r,t,i)=>(Ff(!0),uF(e[Ze],t,H0()));function NR(n,e,r){let t=ce(),i=t[Te],o=n+et,s=i.firstCreatePass?fR(o,t,8,"ng-container",cR,HE(),e,r):i.data[o];if(lR(s,t,n,"ng-container",Y5),Bu(s)){let a=t[Te];V_(a,t,s),HD(a,s,t)}return r!=null&&zf(t,s),NR}function OR(){let n=tt(),e=gn(),r=uR(e);return n.firstCreatePass&&gR(n,r),OR}function Gk(n,e,r){return NR(n,e,r),OR(),Gk}var Y5=(n,e,r,t,i)=>(Ff(!0),tq(e[Ze],""));function Q5(){return ce()}function $k(n,e,r){let t=ce(),i=Eo();if(Pn(t,i,e)){let o=tt(),s=Hu();PF(s,t,n,e,t[Ze],r)}return $k}var t_=void 0;function X5(n){let e=Math.floor(Math.abs(n)),r=n.toString().replace(/^[^.]*\.?/,"").length;return e===1&&r===0?1:5}var J5=["en",[["a","p"],["AM","PM"]],[["AM","PM"]],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],t_,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],t_,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm a","h:mm:ss a","h:mm:ss a z","h:mm:ss a zzzz"],["{1}, {0}",t_,"{1} 'at' {0}",t_],[".",",",";","%","+","-","E","\xD7","\u2030","\u221E","NaN",":"],["#,##0.###","#,##0%","\xA4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",X5],YA={};function Gr(n){let e=Z5(n),r=Ax(e);if(r)return r;let t=e.split("-")[0];if(r=Ax(t),r)return r;if(t==="en")return J5;throw new oe(701,!1)}function Ax(n){return n in YA||(YA[n]=tn.ng&&tn.ng.common&&tn.ng.common.locales&&tn.ng.common.locales[n]),YA[n]}var Yt=(function(n){return n[n.LocaleId=0]="LocaleId",n[n.DayPeriodsFormat=1]="DayPeriodsFormat",n[n.DayPeriodsStandalone=2]="DayPeriodsStandalone",n[n.DaysFormat=3]="DaysFormat",n[n.DaysStandalone=4]="DaysStandalone",n[n.MonthsFormat=5]="MonthsFormat",n[n.MonthsStandalone=6]="MonthsStandalone",n[n.Eras=7]="Eras",n[n.FirstDayOfWeek=8]="FirstDayOfWeek",n[n.WeekendRange=9]="WeekendRange",n[n.DateFormat=10]="DateFormat",n[n.TimeFormat=11]="TimeFormat",n[n.DateTimeFormat=12]="DateTimeFormat",n[n.NumberSymbols=13]="NumberSymbols",n[n.NumberFormats=14]="NumberFormats",n[n.CurrencyCode=15]="CurrencyCode",n[n.CurrencySymbol=16]="CurrencySymbol",n[n.CurrencyName=17]="CurrencyName",n[n.Currencies=18]="Currencies",n[n.Directionality=19]="Directionality",n[n.PluralCase=20]="PluralCase",n[n.ExtraData=21]="ExtraData",n})(Yt||{});function Z5(n){return n.toLowerCase().replace(/_/g,"-")}var eg="en-US";var e9=eg;function jk(n){typeof n=="string"&&(e9=n.toLowerCase().replace(/_/g,"-"))}function Hk(n,e,r){let t=ce(),i=tt(),o=gn();return zk(i,t,t[Ze],o,n,e,r),Hk}function Wk(n,e,r){let t=ce(),i=tt(),o=gn();return(o.type&3||r)&&nk(o,i,t,r,t[Ze],n,e,c_(o,t,e)),Wk}function zk(n,e,r,t,i,o,s){let a=!0,c=null;if((t.type&3||s)&&(c??=c_(t,e,o),nk(t,n,e,s,r,i,o,c)&&(a=!1)),a){let l=t.outputs?.[i],u=t.hostDirectiveOutputs?.[i];if(u&&u.length)for(let d=0;d<u.length;d+=2){let f=u[d],g=u[d+1];c??=c_(t,e,o),Ex(t,e,f,g,i,c)}if(l&&l.length)for(let d of l)c??=c_(t,e,o),Ex(t,e,d,i,i,c)}}function t9(n=1){return G0(n)}function n9(n,e){let r=null,t=mq(n);for(let i=0;i<e.length;i++){let o=e[i];if(o==="*"){r=i;continue}if(t===null?mF(n,o,!0):_q(t,o))return i}return r}function r9(n){let e=ce()[Yn][sr];if(!e.projection){let r=n?n.length:1,t=e.projection=g0(r,null),i=t.slice(),o=e.child;for(;o!==null;){if(o.type!==128){let s=n?n9(o,n):0;s!==null&&(i[s]?i[s].projectionNext=o:t[s]=o,i[s]=o)}o=o.next}}}function i9(n,e=0,r,t,i,o){let s=ce(),a=tt(),c=t?n+1:null;c!==null&&rd(s,a,c,t,i,o,null,r);let l=Xc(a,et+n,16,null,r||null);l.projection===null&&(l.projection=e),MA();let d=!s[Pc]||NA();s[Yn][sr].projection[l.projection]===null&&c!==null?o9(s,a,c):d&&!L_(l)&&qq(a,s,l)}function o9(n,e,r){let t=et+r,i=e.data[t],o=n[t],s=__(o,i.tView.ssrId),a=qf(n,i,void 0,{dehydratedView:s});Kf(o,a,0,Ju(i,s))}function s9(n,e,r,t){d5(n,e,r,t)}function a9(n,e,r){lk(n,e,r)}function c9(n){let e=ce(),r=tt(),t=zE();xf(t+1);let i=_R(r,t);if(n.dirty&&S0(e)===((i.metadata.flags&2)===2)){if(i.matches===null)n.reset([]);else{let o=dk(e,t);n.reset(o,zx),n.notifyOnChanges()}return!0}return!1}function l9(){return ER(ce(),zE())}function u9(n,e,r,t){g5(n,lk(e,r,t))}function d9(n=1){xf(zE()+n)}function h9(n){let e=PA();return Gc(e,et+n)}function n_(n,e){return n<<17|e<<2}function Yc(n){return n>>17&32767}function f9(n){return(n&2)==2}function g9(n,e){return n&131071|e<<17}function xD(n){return n|2}function id(n){return(n&131068)>>2}function QA(n,e){return n&-131069|e<<2}function m9(n){return(n&1)===1}function FD(n){return n|1}function p9(n,e,r,t,i,o){let s=o?e.classBindings:e.styleBindings,a=Yc(s),c=id(s);n[t]=r;let l=!1,u;if(Array.isArray(r)){let d=r;u=d[1],(u===null||Fu(d,u)>0)&&(l=!0)}else u=r;if(i)if(c!==0){let f=Yc(n[a+1]);n[t+1]=n_(f,a),f!==0&&(n[f+1]=QA(n[f+1],t)),n[a+1]=g9(n[a+1],t)}else n[t+1]=n_(a,0),a!==0&&(n[a+1]=QA(n[a+1],t)),a=t;else n[t+1]=n_(c,0),a===0?a=t:n[c+1]=QA(n[c+1],t),c=t;l&&(n[t+1]=xD(n[t+1])),Dx(n,u,t,!0),Dx(n,u,t,!1),E9(e,u,n,t,o),s=n_(a,c),o?e.classBindings=s:e.styleBindings=s}function E9(n,e,r,t,i){let o=i?n.residualClasses:n.residualStyles;o!=null&&typeof e=="string"&&Fu(o,e)>=0&&(r[t+1]=FD(r[t+1]))}function Dx(n,e,r,t){let i=n[r+1],o=e===null,s=t?Yc(i):id(i),a=!1;for(;s!==0&&(a===!1||o);){let c=n[s],l=n[s+1];_9(c,e)&&(a=!0,n[s+1]=t?FD(l):xD(l)),s=t?Yc(l):id(l)}a&&(n[r+1]=t?xD(i):FD(i))}function _9(n,e){return n===null||e==null||(Array.isArray(n)?n[1]:n)===e?!0:Array.isArray(n)&&typeof e=="string"?Fu(n,e)>=0:!1}var mn={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function qk(n){return n.substring(mn.key,mn.keyEnd)}function T9(n){return n.substring(mn.value,mn.valueEnd)}function I9(n){return Qk(n),Kk(n,od(n,0,mn.textEnd))}function Kk(n,e){let r=mn.textEnd;return r===e?-1:(e=mn.keyEnd=y9(n,mn.key=e,r),od(n,e,r))}function v9(n){return Qk(n),Yk(n,od(n,0,mn.textEnd))}function Yk(n,e){let r=mn.textEnd,t=mn.key=od(n,e,r);return r===t?-1:(t=mn.keyEnd=S9(n,t,r),t=Rx(n,t,r,58),t=mn.value=od(n,t,r),t=mn.valueEnd=A9(n,t,r),Rx(n,t,r,59))}function Qk(n){mn.key=0,mn.keyEnd=0,mn.value=0,mn.valueEnd=0,mn.textEnd=n.length}function od(n,e,r){for(;e<r&&n.charCodeAt(e)<=32;)e++;return e}function y9(n,e,r){for(;e<r&&n.charCodeAt(e)>32;)e++;return e}function S9(n,e,r){let t;for(;e<r&&((t=n.charCodeAt(e))===45||t===95||(t&-33)>=65&&(t&-33)<=90||t>=48&&t<=57);)e++;return e}function Rx(n,e,r,t){return e=od(n,e,r),e<r&&e++,e}function A9(n,e,r){let t=-1,i=-1,o=-1,s=e,a=s;for(;s<r;){let c=n.charCodeAt(s++);if(c===59)return a;c===34||c===39?a=s=Cx(n,c,s,r):e===s-4&&o===85&&i===82&&t===76&&c===40?a=s=Cx(n,41,s,r):c>32&&(a=s),o=i,i=t,t=c&-33}return a}function Cx(n,e,r,t){let i=-1,o=r;for(;o<t;){let s=n.charCodeAt(o++);if(s==e&&i!==92)return o;s==92&&i===92?i=0:i=s}throw new Error}function Xk(n,e,r){return Zk(n,e,r,!1),Xk}function Jk(n,e){return Zk(n,e,null,!0),Jk}function D9(n){eU(rU,R9,n,!1)}function R9(n,e){for(let r=v9(e);r>=0;r=Yk(e,r))rU(n,qk(e),T9(e))}function C9(n){eU(P9,N9,n,!0)}function N9(n,e){for(let r=I9(e);r>=0;r=Kk(e,r))Nf(n,qk(e),!0)}function Zk(n,e,r,t){let i=ce(),o=tt(),s=Pf(2);if(o.firstUpdatePass&&nU(o,n,s,t),e!==Rn&&Pn(i,s,e)){let a=o.data[oi()];iU(o,a,i,i[Ze],n,i[s+1]=F9(e,r),t,s)}}function eU(n,e,r,t){let i=tt(),o=Pf(2);i.firstUpdatePass&&nU(i,null,o,t);let s=ce();if(r!==Rn&&Pn(s,o,r)){let a=i.data[oi()];if(oU(a,t)&&!tU(i,o)){let c=t?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(r=LE(c,r||"")),PD(i,a,s,r,t)}else x9(i,a,s,s[Ze],s[o+1],s[o+1]=M9(n,e,r),t,o)}}function tU(n,e){return e>=n.expandoStartIndex}function nU(n,e,r,t){let i=n.data;if(i[r+1]===null){let o=i[oi()],s=tU(n,r);oU(o,t)&&e===null&&!s&&(e=!1),e=O9(i,o,e,t),p9(i,o,e,r,s,t)}}function O9(n,e,r,t){let i=k0(n),o=t?e.residualClasses:e.residualStyles;if(i===null)(t?e.classBindings:e.styleBindings)===0&&(r=XA(null,n,e,r,t),r=jf(r,e.attrs,t),o=null);else{let s=e.directiveStylingLast;if(s===-1||n[s]!==i)if(r=XA(i,n,e,r,t),o===null){let c=w9(n,e,t);c!==void 0&&Array.isArray(c)&&(c=XA(null,n,e,c[1],t),c=jf(c,e.attrs,t),b9(n,e,t,c))}else o=L9(n,e,t)}return o!==void 0&&(t?e.residualClasses=o:e.residualStyles=o),r}function w9(n,e,r){let t=r?e.classBindings:e.styleBindings;if(id(t)!==0)return n[Yc(t)]}function b9(n,e,r,t){let i=r?e.classBindings:e.styleBindings;n[Yc(i)]=t}function L9(n,e,r){let t,i=e.directiveEnd;for(let o=1+e.directiveStylingLast;o<i;o++){let s=n[o].hostAttrs;t=jf(t,s,r)}return jf(t,e.attrs,r)}function XA(n,e,r,t,i){let o=null,s=r.directiveEnd,a=r.directiveStylingLast;for(a===-1?a=r.directiveStart:a++;a<s&&(o=e[a],t=jf(t,o.hostAttrs,i),o!==n);)a++;return n!==null&&(r.directiveStylingLast=a),t}function jf(n,e,r){let t=r?1:2,i=-1;if(e!==null)for(let o=0;o<e.length;o++){let s=e[o];typeof s=="number"?i=s:i===t&&(Array.isArray(n)||(n=n===void 0?[]:["",n]),Nf(n,s,r?!0:e[++o]))}return n===void 0?null:n}function M9(n,e,r){if(r==null||r==="")return qn;let t=[],i=Br(r);if(Array.isArray(i))for(let o=0;o<i.length;o++)n(t,i[o],!0);else if(typeof i=="object")for(let o in i)i.hasOwnProperty(o)&&n(t,o,i[o]);else typeof i=="string"&&e(t,i);return t}function rU(n,e,r){Nf(n,e,Br(r))}function P9(n,e,r){let t=String(e);t!==""&&!t.includes(" ")&&Nf(n,t,r)}function x9(n,e,r,t,i,o,s,a){i===Rn&&(i=qn);let c=0,l=0,u=0<i.length?i[0]:null,d=0<o.length?o[0]:null;for(;u!==null||d!==null;){let f=c<i.length?i[c+1]:void 0,g=l<o.length?o[l+1]:void 0,p=null,_;u===d?(c+=2,l+=2,f!==g&&(p=d,_=g)):d===null||u!==null&&u<d?(c+=2,p=u):(l+=2,p=d,_=g),p!==null&&iU(n,e,r,t,p,_,s,a),u=c<i.length?i[c]:null,d=l<o.length?o[l]:null}}function iU(n,e,r,t,i,o,s,a){if(!(e.type&3))return;let c=n.data,l=c[a+1],u=m9(l)?Nx(c,e,r,i,id(l),s):void 0;if(!O_(u)){O_(o)||f9(l)&&(o=Nx(c,null,r,i,a,s));let d=yA(oi(),r);Yq(t,s,d,i,o)}}function Nx(n,e,r,t,i,o){let s=e===null,a;for(;i>0;){let c=n[i],l=Array.isArray(c),u=l?c[1]:c,d=u===null,f=r[i+1];f===Rn&&(f=d?qn:void 0);let g=d?UE(f,t):u===t?f:void 0;if(l&&!O_(g)&&(g=UE(c,t)),O_(g)&&(a=g,s))return a;let p=n[i+1];i=s?Yc(p):id(p)}if(e!==null){let c=o?e.residualClasses:e.residualStyles;c!=null&&(a=UE(c,t))}return a}function O_(n){return n!==void 0}function F9(n,e){return n==null||n===""||(typeof e=="string"?n=n+e:typeof n=="object"&&(n=rs(Br(n)))),n}function oU(n,e){return(n.flags&(e?8:16))!==0}function k9(n,e=""){let r=ce(),t=tt(),i=n+et,o=t.firstCreatePass?Xc(t,i,1,e,null):t.data[i],s=U9(t,r,o,e,n);r[i]=s,YE()&&sR(t,r,s,o),$c(o,!1)}var U9=(n,e,r,t,i)=>(Ff(!0),Z4(e[Ze],t));function sU(n,e,r,t=""){return Pn(n,Eo(),r)?e+kr(r)+t:Rn}function V9(n,e,r,t,i,o=""){let s=FA(),a=Zu(n,s,r,i);return Pf(2),a?e+kr(r)+t+kr(i)+o:Rn}function B9(n,e,r,t,i,o,s,a=""){let c=FA(),l=pR(n,c,r,i,s);return Pf(3),l?e+kr(r)+t+kr(i)+o+kr(s)+a:Rn}function aU(n){return wR("",n),aU}function wR(n,e,r){let t=ce(),i=sU(t,n,e,r);return i!==Rn&&bR(t,oi(),i),wR}function cU(n,e,r,t,i){let o=ce(),s=V9(o,n,e,r,t,i);return s!==Rn&&bR(o,oi(),s),cU}function lU(n,e,r,t,i,o,s){let a=ce(),c=B9(a,n,e,r,t,i,o,s);return c!==Rn&&bR(a,oi(),c),lU}function bR(n,e,r){let t=yA(e,n);eq(n[Ze],t,r)}function uU(n,e,r){GA(e)&&(e=e());let t=ce(),i=Eo();if(Pn(t,i,e)){let o=tt(),s=Hu();MF(s,t,n,e,t[Ze],r)}return uU}function G9(n,e){let r=GA(n);return r&&n.set(e),r}function dU(n,e){let r=ce(),t=tt(),i=gn();return zk(t,r,r[Ze],i,n,e),dU}var hU={};function fU(n){let e=tt(),r=ce(),t=n+et,i=Xc(e,t,128,null,null);return $c(i,!1),Mf(e,r,t,hU),fU}function $9(n){gs("NgLet");let e=tt(),r=ce(),t=oi();return Mf(e,r,t,n),n}function j9(n){let e=PA(),r=Gc(e,et+n);if(r===hU)throw new oe(314,!1);return r}function H9(n){return Pn(ce(),Eo(),n)?kr(n):Rn}function W9(n,e,r=""){return sU(ce(),n,e,r)}function z9(n,e,r){let t=tt();if(t.firstCreatePass){let i=bi(n);kD(r,t.data,t.blueprint,i,!0),kD(e,t.data,t.blueprint,i,!1)}}function kD(n,e,r,t,i){if(n=hn(n),Array.isArray(n))for(let o=0;o<n.length;o++)kD(n[o],e,r,t,i);else{let o=tt(),s=ce(),a=gn(),c=bc(n)?n:hn(n.provide),l=mA(n),u=a.providerIndexes&1048575,d=a.directiveStart,f=a.providerIndexes>>20;if(bc(n)||!n.multi){let g=new zc(l,i,ut,null),p=ZA(c,e,i?u:u+f,d);p===-1?(tD(f_(a,s),o,c),JA(o,n,e.length),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),r.push(g),s.push(g)):(r[p]=g,s[p]=g)}else{let g=ZA(c,e,u+f,d),p=ZA(c,e,u,u+f),_=g>=0&&r[g],T=p>=0&&r[p];if(i&&!T||!i&&!_){tD(f_(a,s),o,c);let D=Y9(i?K9:q9,r.length,i,t,l,n);!i&&T&&(r[p].providerFactory=D),JA(o,n,e.length,0),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),r.push(D),s.push(D)}else{let D=gU(r[i?p:g],l,!i&&t);JA(o,n,g>-1?g:p,D)}!i&&t&&T&&r[p].componentProviders++}}}function JA(n,e,r,t){let i=bc(e),o=I0(e);if(i||o){let c=(o?hn(e.useClass):e).prototype.ngOnDestroy;if(c){let l=n.destroyHooks||(n.destroyHooks=[]);if(!i&&e.multi){let u=l.indexOf(r);u===-1?l.push(r,[t,c]):l[u+1].push(t,c)}else l.push(r,c)}}}function gU(n,e,r){return r&&n.componentProviders++,n.multi.push(e)-1}function ZA(n,e,r,t){for(let i=r;i<t;i++)if(e[i]===n)return i;return-1}function q9(n,e,r,t,i){return UD(this.multi,[])}function K9(n,e,r,t,i){let o=this.multi,s;if(this.providerFactory){let a=this.providerFactory.componentProviders,c=Bf(t,t[Te],this.providerFactory.index,i);s=c.slice(0,a),UD(o,s);for(let l=a;l<c.length;l++)s.push(c[l])}else s=[],UD(o,s);return s}function UD(n,e){for(let r=0;r<n.length;r++){let t=n[r];e.push(t())}return e}function Y9(n,e,r,t,i,o){let s=new zc(n,r,ut,null);return s.multi=[],s.index=e,s.componentProviders=0,gU(s,i,t&&!r),s}function Q9(n,e=[]){return r=>{r.providersResolver=(t,i)=>z9(t,i?i(n):n,e)}}function X9(n,e,r){let t=n.\u0275cmp;t.directiveDefs=R_(e,yk),t.pipeDefs=R_(r,hA)}function J9(n,e,r){let t=ar()+n,i=ce();return i[t]===Rn?Ao(i,t,r?e.call(r):e()):Qf(i,t)}function Z9(n,e,r,t){return mU(ce(),ar(),n,e,r,t)}function eK(n,e,r,t,i){return pU(ce(),ar(),n,e,r,t,i)}function tK(n,e,r,t,i,o){return EU(ce(),ar(),n,e,r,t,i,o)}function nK(n,e,r,t,i,o,s){return cK(ce(),ar(),n,e,r,t,i,o,s)}function rK(n,e,r,t,i,o,s,a){let c=ar()+n,l=ce(),u=ed(l,c,r,t,i,o);return Pn(l,c+4,s)||u?Ao(l,c+5,a?e.call(a,r,t,i,o,s):e(r,t,i,o,s)):Qf(l,c+5)}function iK(n,e,r,t,i,o,s,a,c){let l=ar()+n,u=ce(),d=ed(u,l,r,t,i,o);return Zu(u,l+4,s,a)||d?Ao(u,l+6,c?e.call(c,r,t,i,o,s,a):e(r,t,i,o,s,a)):Qf(u,l+6)}function oK(n,e,r,t,i,o,s,a,c,l){let u=ar()+n,d=ce(),f=ed(d,u,r,t,i,o);return pR(d,u+4,s,a,c)||f?Ao(d,u+7,l?e.call(l,r,t,i,o,s,a,c):e(r,t,i,o,s,a,c)):Qf(d,u+7)}function sK(n,e,r,t,i,o,s,a,c,l,u){let d=ar()+n,f=ce(),g=ed(f,d,r,t,i,o);return ed(f,d+4,s,a,c,l)||g?Ao(f,d+8,u?e.call(u,r,t,i,o,s,a,c,l):e(r,t,i,o,s,a,c,l)):Qf(f,d+8)}function aK(n,e,r,t){return _U(ce(),ar(),n,e,r,t)}function tg(n,e){let r=n[e];return r===Rn?void 0:r}function mU(n,e,r,t,i,o){let s=e+r;return Pn(n,s,i)?Ao(n,s+1,o?t.call(o,i):t(i)):tg(n,s+1)}function pU(n,e,r,t,i,o,s){let a=e+r;return Zu(n,a,i,o)?Ao(n,a+2,s?t.call(s,i,o):t(i,o)):tg(n,a+2)}function EU(n,e,r,t,i,o,s,a){let c=e+r;return pR(n,c,i,o,s)?Ao(n,c+3,a?t.call(a,i,o,s):t(i,o,s)):tg(n,c+3)}function cK(n,e,r,t,i,o,s,a,c){let l=e+r;return ed(n,l,i,o,s,a)?Ao(n,l+4,c?t.call(c,i,o,s,a):t(i,o,s,a)):tg(n,l+4)}function _U(n,e,r,t,i,o){let s=e+r,a=!1;for(let c=0;c<i.length;c++)Pn(n,s++,i[c])&&(a=!0);return a?Ao(n,s,t.apply(o,i)):tg(n,s)}function lK(n,e){let r=tt(),t,i=n+et;r.firstCreatePass?(t=uK(e,r.pipeRegistry),r.data[i]=t,t.onDestroy&&(r.destroyHooks??=[]).push(i,t.onDestroy)):t=r.data[i];let o=t.factory||(t.factory=Ys(t.type,!0)),s,a=or(ut);try{let c=h_(!1),l=o();return h_(c),Mf(r,ce(),i,l),l}finally{or(a)}}function uK(n,e){if(e)for(let r=e.length-1;r>=0;r--){let t=e[r];if(n===t.name)return t}}function dK(n,e,r){let t=n+et,i=ce(),o=Gc(i,t);return q_(i,t)?mU(i,ar(),e,o.transform,r,o):o.transform(r)}function hK(n,e,r,t){let i=n+et,o=ce(),s=Gc(o,i);return q_(o,i)?pU(o,ar(),e,s.transform,r,t,s):s.transform(r,t)}function fK(n,e,r,t,i){let o=n+et,s=ce(),a=Gc(s,o);return q_(s,o)?EU(s,ar(),e,a.transform,r,t,i,a):a.transform(r,t,i)}function gK(n,e,r){let t=n+et,i=ce(),o=Gc(i,t);return q_(i,t)?_U(i,ar(),e,o.transform,r,o):o.transform.apply(o,r)}function q_(n,e){return n[Te].data[e].pure}function mK(n,e){return G_(n,e)}var r_=null;function TU(n){r_!==null&&(n.defaultEncapsulation!==r_.defaultEncapsulation||n.preserveWhitespaces!==r_.preserveWhitespaces)||(r_=n)}var IU=new Z("");var pK=(()=>{class n{zone=ne(Le);changeDetectionScheduler=ne(ei);applicationRef=ne(ca);applicationErrorHandler=ne(_o);_onMicrotaskEmptySubscription;initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.changeDetectionScheduler.runningTick||this.zone.run(()=>{try{this.applicationRef.dirtyFlags|=1,this.applicationRef._tick()}catch(r){this.applicationErrorHandler(r)}})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function vU({ngZoneFactory:n,ignoreChangesOutsideZone:e,scheduleInRootZone:r}){return n??=()=>new Le(le(x({},LR()),{scheduleInRootZone:r})),[{provide:Le,useFactory:n},{provide:Js,multi:!0,useFactory:()=>{let t=ne(pK,{optional:!0});return()=>t.initialize()}},{provide:Js,multi:!0,useFactory:()=>{let t=ne(EK);return()=>{t.initialize()}}},e===!0?{provide:$A,useValue:!0}:[],{provide:QE,useValue:r??TF},{provide:_o,useFactory:()=>{let t=ne(Le),i=ne(Kn),o;return s=>{t.runOutsideAngular(()=>{i.destroyed&&!o?setTimeout(()=>{throw s}):(o??=i.get(Fr),o.handleError(s))})}}}]}function LR(n){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:n?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:n?.runCoalescing??!1}}var EK=(()=>{class n{subscription=new gt;initialized=!1;zone=ne(Le);pendingTasks=ne(ia);initialize(){if(this.initialized)return;this.initialized=!0;let r=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(r=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{Le.assertNotInAngularZone(),queueMicrotask(()=>{r!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(r),r=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{Le.assertInAngularZone(),r??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var MR=(()=>{class n{applicationErrorHandler=ne(_o);appRef=ne(ca);taskService=ne(ia);ngZone=ne(Le);zonelessEnabled=ne(zu);tracing=ne(Qc,{optional:!0});disableScheduling=ne($A,{optional:!0})??!1;zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new gt;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(p_):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(ne(QE,{optional:!0})??!1);cancelScheduledCallback=null;useMicrotaskScheduler=!1;runningTick=!1;pendingRenderTaskId=null;constructor(){this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{this.runningTick||this.cleanup()})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()})),this.disableScheduling||=!this.zonelessEnabled&&(this.ngZone instanceof Xu||!this.zoneIsDefined)}notify(r){if(!this.zonelessEnabled&&r===5)return;let t=!1;switch(r){case 0:{this.appRef.dirtyFlags|=2;break}case 3:case 2:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 6:{this.appRef.dirtyFlags|=2,t=!0;break}case 12:{this.appRef.dirtyFlags|=16,t=!0;break}case 13:{this.appRef.dirtyFlags|=2,t=!0;break}case 11:{t=!0;break}default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=this.tracing?.snapshot(this.appRef.tracingSnapshot)??null,!this.shouldScheduleTick(t))return;let i=this.useMicrotaskScheduler?ax:IF;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>i(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>i(()=>this.tick()))}shouldScheduleTick(r){return!(this.disableScheduling&&!r||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(p_+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let r=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(t){this.taskService.remove(r),this.applicationErrorHandler(t)}finally{this.cleanup()}this.useMicrotaskScheduler=!0,ax(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(r)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let r=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(r)}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function _K(){return gs("NgZoneless"),pr([{provide:ei,useExisting:MR},{provide:Le,useClass:Xu},{provide:zu,useValue:!0},{provide:QE,useValue:!1},[]])}function TK(){return typeof $localize<"u"&&$localize.locale||eg}var ng=new Z("",{providedIn:"root",factory:()=>ne(ng,{optional:!0,skipSelf:!0})||TK()});var K_=class{destroyed=!1;listeners=null;errorHandler=ne(Fr,{optional:!0});destroyRef=ne(cr);constructor(){this.destroyRef.onDestroy(()=>{this.destroyed=!0,this.listeners=null})}subscribe(e){if(this.destroyed)throw new oe(953,!1);return(this.listeners??=[]).push(e),{unsubscribe:()=>{let r=this.listeners?.indexOf(e);r!==void 0&&r!==-1&&this.listeners?.splice(r,1)}}}emit(e){if(this.destroyed){console.warn(Xs(953,!1));return}if(this.listeners===null)return;let r=Ae(null);try{for(let t of this.listeners)try{t(e)}catch(i){this.errorHandler?.handleError(i)}}finally{Ae(r)}}};function rg(n){return n0(n)}function ig(n,e){return vf(n,e?.equal)}var PR=class{[An];constructor(e){this[An]=e}destroy(){this[An].destroy()}};function xR(n,e){let r=e?.injector??ne(St),t=e?.manualCleanup!==!0?r.get(cr):null,i,o=r.get(Wu,null,{optional:!0}),s=r.get(ei);return o!==null?(i=yK(o.view,s,n),t instanceof Rf&&t._lView===o.view&&(t=null)):i=SK(n,r.get(kf),s),i.injector=r,t!==null&&(i.onDestroyFn=t.onDestroy(()=>i.destroy())),new PR(i)}var yU=le(x({},r0),{cleanupFns:void 0,zone:null,onDestroyFn:Hc,run(){let n=ju(!1);try{i0(this)}finally{ju(n)}},cleanup(){if(!this.cleanupFns?.length)return;let n=Ae(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],Ae(n)}}}),IK=le(x({},yU),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){Cc(this),this.onDestroyFn(),this.cleanup(),this.scheduler.remove(this)}}),vK=le(x({},yU),{consumerMarkedDirty(){this.view[De]|=8192,na(this.view),this.notifier.notify(13)},destroy(){Cc(this),this.onDestroyFn(),this.cleanup(),this.view[ss]?.delete(this)}});function yK(n,e,r){let t=Object.create(vK);return t.view=n,t.zone=typeof Zone<"u"?Zone.current:null,t.notifier=e,t.fn=SU(t,r),n[ss]??=new Set,n[ss].add(t),t.consumerMarkedDirty(t),t}function SK(n,e,r){let t=Object.create(IK);return t.fn=SU(t,n),t.scheduler=e,t.notifier=r,t.zone=typeof Zone<"u"?Zone.current:null,t.scheduler.add(t),t.notifier.notify(12),t}function SU(n,e){return()=>{e(r=>(n.cleanupFns??=[]).push(r))}}var bU=Symbol("InputSignalNode#UNSET"),xK=le(x({},vE),{transformFn:void 0,applyValueToInputSignal(n,e){Lu(n,e)}});function LU(n,e){let r=Object.create(xK);r.value=n,r.transformFn=e?.transform;function t(){if(Nu(r),r.value===bU){let i=null;throw new oe(-950,i)}return r.value}return t[An]=r,t}var FK=new Z("");FK.__NG_ELEMENT_ID__=n=>{let e=gn();if(e===null)throw new oe(204,!1);if(e.type&2)return e.value;if(n&8)return null;throw new oe(204,!1)};function qve(n){return new K_}function AU(n,e){return LU(n,e)}function kK(n){return LU(bU,n)}var Kve=(AU.required=kK,AU);function DU(n,e){return fk(e)}function UK(n,e){return gk(e)}var Yve=(DU.required=UK,DU);function VK(n,e,r){let t=new A_(r);return Promise.resolve(t)}function RU(n){for(let e=n.length-1;e>=0;e--)if(n[e]!==void 0)return n[e]}var Y_=new Z(""),BK=new Z("");function og(n){return!n.moduleRef}function GK(n){let e=og(n)?n.r3Injector:n.moduleRef.injector,r=e.get(Le);return r.run(()=>{og(n)?n.r3Injector.resolveInjectorInitializers():n.moduleRef.resolveInjectorInitializers();let t=e.get(_o),i;if(r.runOutsideAngular(()=>{i=r.onError.subscribe({next:t})}),og(n)){let o=()=>e.destroy(),s=n.platformInjector.get(Y_);s.add(o),e.onDestroy(()=>{i.unsubscribe(),s.delete(o)})}else{let o=()=>n.moduleRef.destroy(),s=n.platformInjector.get(Y_);s.add(o),n.moduleRef.onDestroy(()=>{Vf(n.allPlatformModules,n.moduleRef),i.unsubscribe(),s.delete(o)})}return jK(t,r,()=>{let o=e.get(ia),s=o.add(),a=e.get(vR);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(ng,eg);if(jk(c||eg),!e.get(BK,!0))return og(n)?e.get(ca):(n.allPlatformModules.push(n.moduleRef),n.moduleRef);if(og(n)){let u=e.get(ca);return n.rootComponent!==void 0&&u.bootstrap(n.rootComponent),u}else return MU?.(n.moduleRef,n.allPlatformModules),n.moduleRef}).finally(()=>{o.remove(s)})})})}var MU;function CU(){MU=$K}function $K(n,e){let r=n.injector.get(ca);if(n._bootstrapComponents.length>0)n._bootstrapComponents.forEach(t=>r.bootstrap(t));else if(n.instance.ngDoBootstrap)n.instance.ngDoBootstrap(r);else throw new oe(-403,!1);e.push(n)}function jK(n,e,r){try{let t=r();return z_(t)?t.catch(i=>{throw e.runOutsideAngular(()=>n(i)),i}):t}catch(t){throw e.runOutsideAngular(()=>n(t)),t}}var PU=(()=>{class n{_injector;_modules=[];_destroyListeners=[];_destroyed=!1;constructor(r){this._injector=r}bootstrapModuleFactory(r,t){let i=t?.scheduleInRootZone,o=()=>yF(t?.ngZone,le(x({},LR({eventCoalescing:t?.ngZoneEventCoalescing,runCoalescing:t?.ngZoneRunCoalescing})),{scheduleInRootZone:i})),s=t?.ignoreChangesOutsideZone,a=[vU({ngZoneFactory:o,ignoreChangesOutsideZone:s}),{provide:ei,useExisting:MR},z0],c=Ik(r.moduleType,this.injector,a);return CU(),GK({moduleRef:c,allPlatformModules:this._modules,platformInjector:this.injector})}bootstrapModule(r,t=[]){let i=yR({},t);return CU(),VK(this.injector,i,r).then(o=>this.bootstrapModuleFactory(o,i))}onDestroy(r){this._destroyListeners.push(r)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new oe(404,!1);this._modules.slice().forEach(t=>t.destroy()),this._destroyListeners.forEach(t=>t());let r=this._injector.get(Y_,null);r&&(r.forEach(t=>t()),r.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}static \u0275fac=function(t){return new(t||n)(w(St))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"platform"})}return n})(),jR=null;function HK(n){if(WR())throw new oe(400,!1);Mk(),jR=n;let e=n.get(PU);return qK(n),e}function HR(n,e,r=[]){let t=`Platform: ${e}`,i=new Z(t);return(o=[])=>{let s=WR();if(!s){let a=[...r,...o,{provide:i,useValue:!0}];s=n?.(a)??HK(WK(a,t))}return zK(i)}}function WK(n=[],e){return St.create({name:e,providers:[{provide:Of,useValue:"platform"},{provide:Y_,useValue:new Set([()=>jR=null])},...n]})}function zK(n){let e=WR();if(!e)throw new oe(-401,!1);return e}function WR(){return jR?.get(PU)??null}function qK(n){let e=n.get(b_,null);fo(n,()=>{e?.forEach(r=>r())})}function zR(){return!1}var KK=(()=>{class n{static __NG_ELEMENT_ID__=YK}return n})();function YK(n){return QK(gn(),ce(),(n&16)===16)}function QK(n,e,r){if(as(n)&&!r){let t=ii(n.index,e);return new oa(t,t)}else if(n.type&175){let t=e[Yn];return new oa(t,e)}return null}var FR=class{constructor(){}supports(e){return mR(e)}create(e){return new kR(e)}},XK=(n,e)=>e,kR=class{length=0;collection;_linkedRecords=null;_unlinkedRecords=null;_previousItHead=null;_itHead=null;_itTail=null;_additionsHead=null;_additionsTail=null;_movesHead=null;_movesTail=null;_removalsHead=null;_removalsTail=null;_identityChangesHead=null;_identityChangesTail=null;_trackByFn;constructor(e){this._trackByFn=e||XK}forEachItem(e){let r;for(r=this._itHead;r!==null;r=r._next)e(r)}forEachOperation(e){let r=this._itHead,t=this._removalsHead,i=0,o=null;for(;r||t;){let s=!t||r&&r.currentIndex<NU(t,i,o)?r:t,a=NU(s,i,o),c=s.currentIndex;if(s===t)i--,t=t._nextRemoved;else if(r=r._next,s.previousIndex==null)i++;else{o||(o=[]);let l=a-i,u=c-i;if(l!=u){for(let f=0;f<l;f++){let g=f<o.length?o[f]:o[f]=0,p=g+f;u<=p&&p<l&&(o[f]=g+1)}let d=s.previousIndex;o[d]=u-l}}a!==c&&e(s,a,c)}}forEachPreviousItem(e){let r;for(r=this._previousItHead;r!==null;r=r._nextPrevious)e(r)}forEachAddedItem(e){let r;for(r=this._additionsHead;r!==null;r=r._nextAdded)e(r)}forEachMovedItem(e){let r;for(r=this._movesHead;r!==null;r=r._nextMoved)e(r)}forEachRemovedItem(e){let r;for(r=this._removalsHead;r!==null;r=r._nextRemoved)e(r)}forEachIdentityChange(e){let r;for(r=this._identityChangesHead;r!==null;r=r._nextIdentityChange)e(r)}diff(e){if(e==null&&(e=[]),!mR(e))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let r=this._itHead,t=!1,i,o,s;if(Array.isArray(e)){this.length=e.length;for(let a=0;a<this.length;a++)o=e[a],s=this._trackByFn(a,o),r===null||!Object.is(r.trackById,s)?(r=this._mismatch(r,o,s,a),t=!0):(t&&(r=this._verifyReinsertion(r,o,s,a)),Object.is(r.item,o)||this._addIdentityChange(r,o)),r=r._next}else i=0,tk(e,a=>{s=this._trackByFn(i,a),r===null||!Object.is(r.trackById,s)?(r=this._mismatch(r,a,s,i),t=!0):(t&&(r=this._verifyReinsertion(r,a,s,i)),Object.is(r.item,a)||this._addIdentityChange(r,a)),r=r._next,i++}),this.length=i;return this._truncate(r),this.collection=e,this.isDirty}get isDirty(){return this._additionsHead!==null||this._movesHead!==null||this._removalsHead!==null||this._identityChangesHead!==null}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;e!==null;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;e!==null;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,r,t,i){let o;return e===null?o=this._itTail:(o=e._prev,this._remove(e)),e=this._unlinkedRecords===null?null:this._unlinkedRecords.get(t,null),e!==null?(Object.is(e.item,r)||this._addIdentityChange(e,r),this._reinsertAfter(e,o,i)):(e=this._linkedRecords===null?null:this._linkedRecords.get(t,i),e!==null?(Object.is(e.item,r)||this._addIdentityChange(e,r),this._moveAfter(e,o,i)):e=this._addAfter(new UR(r,t),o,i)),e}_verifyReinsertion(e,r,t,i){let o=this._unlinkedRecords===null?null:this._unlinkedRecords.get(t,null);return o!==null?e=this._reinsertAfter(o,e._prev,i):e.currentIndex!=i&&(e.currentIndex=i,this._addToMoves(e,i)),e}_truncate(e){for(;e!==null;){let r=e._next;this._addToRemovals(this._unlink(e)),e=r}this._unlinkedRecords!==null&&this._unlinkedRecords.clear(),this._additionsTail!==null&&(this._additionsTail._nextAdded=null),this._movesTail!==null&&(this._movesTail._nextMoved=null),this._itTail!==null&&(this._itTail._next=null),this._removalsTail!==null&&(this._removalsTail._nextRemoved=null),this._identityChangesTail!==null&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,r,t){this._unlinkedRecords!==null&&this._unlinkedRecords.remove(e);let i=e._prevRemoved,o=e._nextRemoved;return i===null?this._removalsHead=o:i._nextRemoved=o,o===null?this._removalsTail=i:o._prevRemoved=i,this._insertAfter(e,r,t),this._addToMoves(e,t),e}_moveAfter(e,r,t){return this._unlink(e),this._insertAfter(e,r,t),this._addToMoves(e,t),e}_addAfter(e,r,t){return this._insertAfter(e,r,t),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,r,t){let i=r===null?this._itHead:r._next;return e._next=i,e._prev=r,i===null?this._itTail=e:i._prev=e,r===null?this._itHead=e:r._next=e,this._linkedRecords===null&&(this._linkedRecords=new Q_),this._linkedRecords.put(e),e.currentIndex=t,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){this._linkedRecords!==null&&this._linkedRecords.remove(e);let r=e._prev,t=e._next;return r===null?this._itHead=t:r._next=t,t===null?this._itTail=r:t._prev=r,e}_addToMoves(e,r){return e.previousIndex===r||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new Q_),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,this._removalsTail===null?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,r){return e.item=r,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},UR=class{item;trackById;currentIndex=null;previousIndex=null;_nextPrevious=null;_prev=null;_next=null;_prevDup=null;_nextDup=null;_prevRemoved=null;_nextRemoved=null;_nextAdded=null;_nextMoved=null;_nextIdentityChange=null;constructor(e,r){this.item=e,this.trackById=r}},VR=class{_head=null;_tail=null;add(e){this._head===null?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,r){let t;for(t=this._head;t!==null;t=t._nextDup)if((r===null||r<=t.currentIndex)&&Object.is(t.trackById,e))return t;return null}remove(e){let r=e._prevDup,t=e._nextDup;return r===null?this._head=t:r._nextDup=t,t===null?this._tail=r:t._prevDup=r,this._head===null}},Q_=class{map=new Map;put(e){let r=e.trackById,t=this.map.get(r);t||(t=new VR,this.map.set(r,t)),t.add(e)}get(e,r){let t=e,i=this.map.get(t);return i?i.get(e,r):null}remove(e){let r=e.trackById;return this.map.get(r).remove(e)&&this.map.delete(r),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function NU(n,e,r){let t=n.previousIndex;if(t===null)return t;let i=0;return r&&t<r.length&&(i=r[t]),t+e+i}var BR=class{constructor(){}supports(e){return e instanceof Map||H_(e)}create(){return new GR}},GR=class{_records=new Map;_mapHead=null;_appendAfter=null;_previousMapHead=null;_changesHead=null;_changesTail=null;_additionsHead=null;_additionsTail=null;_removalsHead=null;_removalsTail=null;get isDirty(){return this._additionsHead!==null||this._changesHead!==null||this._removalsHead!==null}forEachItem(e){let r;for(r=this._mapHead;r!==null;r=r._next)e(r)}forEachPreviousItem(e){let r;for(r=this._previousMapHead;r!==null;r=r._nextPrevious)e(r)}forEachChangedItem(e){let r;for(r=this._changesHead;r!==null;r=r._nextChanged)e(r)}forEachAddedItem(e){let r;for(r=this._additionsHead;r!==null;r=r._nextAdded)e(r)}forEachRemovedItem(e){let r;for(r=this._removalsHead;r!==null;r=r._nextRemoved)e(r)}diff(e){if(!e)e=new Map;else if(!(e instanceof Map||H_(e)))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let r=this._mapHead;if(this._appendAfter=null,this._forEach(e,(t,i)=>{if(r&&r.key===i)this._maybeAddToChanges(r,t),this._appendAfter=r,r=r._next;else{let o=this._getOrCreateRecordForKey(i,t);r=this._insertBeforeOrAppend(r,o)}}),r){r._prev&&(r._prev._next=null),this._removalsHead=r;for(let t=r;t!==null;t=t._nextRemoved)t===this._mapHead&&(this._mapHead=null),this._records.delete(t.key),t._nextRemoved=t._next,t.previousValue=t.currentValue,t.currentValue=null,t._prev=null,t._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(e,r){if(e){let t=e._prev;return r._next=e,r._prev=t,e._prev=r,t&&(t._next=r),e===this._mapHead&&(this._mapHead=r),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=r,r._prev=this._appendAfter):this._mapHead=r,this._appendAfter=r,null}_getOrCreateRecordForKey(e,r){if(this._records.has(e)){let i=this._records.get(e);this._maybeAddToChanges(i,r);let o=i._prev,s=i._next;return o&&(o._next=s),s&&(s._prev=o),i._next=null,i._prev=null,i}let t=new $R(e);return this._records.set(e,t),t.currentValue=r,this._addToAdditions(t),t}_reset(){if(this.isDirty){let e;for(this._previousMapHead=this._mapHead,e=this._previousMapHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._changesHead;e!==null;e=e._nextChanged)e.previousValue=e.currentValue;for(e=this._additionsHead;e!=null;e=e._nextAdded)e.previousValue=e.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(e,r){Object.is(r,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=r,this._addToChanges(e))}_addToAdditions(e){this._additionsHead===null?this._additionsHead=this._additionsTail=e:(this._additionsTail._nextAdded=e,this._additionsTail=e)}_addToChanges(e){this._changesHead===null?this._changesHead=this._changesTail=e:(this._changesTail._nextChanged=e,this._changesTail=e)}_forEach(e,r){e instanceof Map?e.forEach(r):Object.keys(e).forEach(t=>r(e[t],t))}},$R=class{key;previousValue=null;currentValue=null;_nextPrevious=null;_next=null;_prev=null;_nextAdded=null;_nextRemoved=null;_nextChanged=null;constructor(e){this.key=e}};function OU(){return new qR([new FR])}var qR=(()=>{class n{factories;static \u0275prov=K({token:n,providedIn:"root",factory:OU});constructor(r){this.factories=r}static create(r,t){if(t!=null){let i=t.factories.slice();r=r.concat(i)}return new n(r)}static extend(r){return{provide:n,useFactory:()=>{let t=ne(n,{optional:!0,skipSelf:!0});return n.create(r,t||OU())}}}find(r){let t=this.factories.find(i=>i.supports(r));if(t!=null)return t;throw new oe(901,!1)}}return n})();function wU(){return new X_([new BR])}var X_=(()=>{class n{static \u0275prov=K({token:n,providedIn:"root",factory:wU});factories;constructor(r){this.factories=r}static create(r,t){if(t){let i=t.factories.slice();r=r.concat(i)}return new n(r)}static extend(r){return{provide:n,useFactory:()=>{let t=ne(n,{optional:!0,skipSelf:!0});return n.create(r,t||wU())}}}find(r){let t=this.factories.find(i=>i.supports(r));if(t)return t;throw new oe(901,!1)}}return n})();var xU=HR(null,"core",[]),FU=(()=>{class n{constructor(r){}static \u0275fac=function(t){return new(t||n)(w(ca))};static \u0275mod=aa({type:n});static \u0275inj=is({})}return n})();function Qve(n){return typeof n=="boolean"?n:n!=null&&n!=="false"}function Xve(n,e=NaN){return!isNaN(parseFloat(n))&&!isNaN(Number(n))?Number(n):e}function Jve(n,e){let r=Zs(n),t=e.elementInjector||ku();return new td(r).create(t,e.projectableNodes,e.hostElement,e.environmentInjector,e.directives,e.bindings)}var VU=null;function Co(){return VU}function KR(n){VU??=n}var sg=class{},YR=(()=>{class n{historyGo(r){throw new Error("")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>ne(BU),providedIn:"platform"})}return n})();var BU=(()=>{class n extends YR{_location;_history;_doc=ne(Dn);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return Co().getBaseHref(this._doc)}onPopState(r){let t=Co().getGlobalEventTarget(this._doc,"window");return t.addEventListener("popstate",r,!1),()=>t.removeEventListener("popstate",r)}onHashChange(r){let t=Co().getGlobalEventTarget(this._doc,"window");return t.addEventListener("hashchange",r,!1),()=>t.removeEventListener("hashchange",r)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(r){this._location.pathname=r}pushState(r,t,i){this._history.pushState(r,t,i)}replaceState(r,t,i){this._history.replaceState(r,t,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(r=0){this._history.go(r)}getState(){return this._history.state}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>new n,providedIn:"platform"})}return n})();function GU(n,e){return n?e?n.endsWith("/")?e.startsWith("/")?n+e.slice(1):n+e:e.startsWith("/")?n+e:`${n}/${e}`:n:e}function kU(n){let e=n.search(/#|\?|$/);return n[e-1]==="/"?n.slice(0,e-1)+n.slice(e):n}function la(n){return n&&n[0]!=="?"?`?${n}`:n}var J_=(()=>{class n{historyGo(r){throw new Error("")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:()=>ne(jU),providedIn:"root"})}return n})(),$U=new Z(""),jU=(()=>{class n extends J_{_platformLocation;_baseHref;_removeListenerFns=[];constructor(r,t){super(),this._platformLocation=r,this._baseHref=t??this._platformLocation.getBaseHrefFromDOM()??ne(Dn).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(r){this._removeListenerFns.push(this._platformLocation.onPopState(r),this._platformLocation.onHashChange(r))}getBaseHref(){return this._baseHref}prepareExternalUrl(r){return GU(this._baseHref,r)}path(r=!1){let t=this._platformLocation.pathname+la(this._platformLocation.search),i=this._platformLocation.hash;return i&&r?`${t}${i}`:t}pushState(r,t,i,o){let s=this.prepareExternalUrl(i+la(o));this._platformLocation.pushState(r,t,s)}replaceState(r,t,i,o){let s=this.prepareExternalUrl(i+la(o));this._platformLocation.replaceState(r,t,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(r=0){this._platformLocation.historyGo?.(r)}static \u0275fac=function(t){return new(t||n)(w(YR),w($U,8))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),HU=(()=>{class n{_subject=new Ot;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(r){this._locationStrategy=r;let t=this._locationStrategy.getBaseHref();this._basePath=eY(kU(UU(t))),this._locationStrategy.onPopState(i=>{this._subject.next({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(r=!1){return this.normalize(this._locationStrategy.path(r))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(r,t=""){return this.path()==this.normalize(r+la(t))}normalize(r){return n.stripTrailingSlash(ZK(this._basePath,UU(r)))}prepareExternalUrl(r){return r&&r[0]!=="/"&&(r="/"+r),this._locationStrategy.prepareExternalUrl(r)}go(r,t="",i=null){this._locationStrategy.pushState(i,"",r,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(r+la(t)),i)}replaceState(r,t="",i=null){this._locationStrategy.replaceState(i,"",r,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(r+la(t)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(r=0){this._locationStrategy.historyGo?.(r)}onUrlChange(r){return this._urlChangeListeners.push(r),this._urlChangeSubscription??=this.subscribe(t=>{this._notifyUrlChangeListeners(t.url,t.state)}),()=>{let t=this._urlChangeListeners.indexOf(r);this._urlChangeListeners.splice(t,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(r="",t){this._urlChangeListeners.forEach(i=>i(r,t))}subscribe(r,t,i){return this._subject.subscribe({next:r,error:t??void 0,complete:i??void 0})}static normalizeQueryParams=la;static joinWithSlash=GU;static stripTrailingSlash=kU;static \u0275fac=function(t){return new(t||n)(w(J_))};static \u0275prov=K({token:n,factory:()=>JK(),providedIn:"root"})}return n})();function JK(){return new HU(w(J_))}function ZK(n,e){if(!n||!e.startsWith(n))return e;let r=e.substring(n.length);return r===""||["/",";","?","#"].includes(r[0])?r:e}function UU(n){return n.replace(/\/index.html$/,"")}function eY(n){if(new RegExp("^(https?:)?//").test(n)){let[,r]=n.split(/\/\/[^\/]+/);return r}return n}var Qn=(function(n){return n[n.Format=0]="Format",n[n.Standalone=1]="Standalone",n})(Qn||{}),ot=(function(n){return n[n.Narrow=0]="Narrow",n[n.Abbreviated=1]="Abbreviated",n[n.Wide=2]="Wide",n[n.Short=3]="Short",n})(ot||{}),Er=(function(n){return n[n.Short=0]="Short",n[n.Medium=1]="Medium",n[n.Long=2]="Long",n[n.Full=3]="Full",n})(Er||{}),ps={Decimal:0,Group:1,List:2,PercentSign:3,PlusSign:4,MinusSign:5,Exponential:6,SuperscriptingExponent:7,PerMille:8,Infinity:9,NaN:10,TimeSeparator:11,CurrencyDecimal:12,CurrencyGroup:13};function QU(n){return Gr(n)[Yt.LocaleId]}function XU(n,e,r){let t=Gr(n),i=[t[Yt.DayPeriodsFormat],t[Yt.DayPeriodsStandalone]],o=ai(i,e);return ai(o,r)}function JU(n,e,r){let t=Gr(n),i=[t[Yt.DaysFormat],t[Yt.DaysStandalone]],o=ai(i,e);return ai(o,r)}function ZU(n,e,r){let t=Gr(n),i=[t[Yt.MonthsFormat],t[Yt.MonthsStandalone]],o=ai(i,e);return ai(o,r)}function e1(n,e){let t=Gr(n)[Yt.Eras];return ai(t,e)}function ag(n,e){let r=Gr(n);return ai(r[Yt.DateFormat],e)}function cg(n,e){let r=Gr(n);return ai(r[Yt.TimeFormat],e)}function lg(n,e){let t=Gr(n)[Yt.DateTimeFormat];return ai(t,e)}function ug(n,e){let r=Gr(n),t=r[Yt.NumberSymbols][e];if(typeof t>"u"){if(e===ps.CurrencyDecimal)return r[Yt.NumberSymbols][ps.Decimal];if(e===ps.CurrencyGroup)return r[Yt.NumberSymbols][ps.Group]}return t}function t1(n){if(!n[Yt.ExtraData])throw new oe(2303,!1)}function n1(n){let e=Gr(n);return t1(e),(e[Yt.ExtraData][2]||[]).map(t=>typeof t=="string"?QR(t):[QR(t[0]),QR(t[1])])}function r1(n,e,r){let t=Gr(n);t1(t);let i=[t[Yt.ExtraData][0],t[Yt.ExtraData][1]],o=ai(i,e)||[];return ai(o,r)||[]}function ai(n,e){for(let r=e;r>-1;r--)if(typeof n[r]<"u")return n[r];throw new oe(2304,!1)}function QR(n){let[e,r]=n.split(":");return{hours:+e,minutes:+r}}var tY=/^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/,Z_={},nY=/((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;function i1(n,e,r,t){let i=dY(n);e=ms(r,e)||e;let s=[],a;for(;e;)if(a=nY.exec(e),a){s=s.concat(a.slice(1));let u=s.pop();if(!u)break;e=u}else{s.push(e);break}let c=i.getTimezoneOffset();t&&(c=s1(t,c),i=uY(i,t));let l="";return s.forEach(u=>{let d=cY(u);l+=d?d(i,r,c):u==="''"?"'":u.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}function iT(n,e,r){let t=new Date(0);return t.setFullYear(n,e,r),t.setHours(0,0,0),t}function ms(n,e){let r=QU(n);if(Z_[r]??={},Z_[r][e])return Z_[r][e];let t="";switch(e){case"shortDate":t=ag(n,Er.Short);break;case"mediumDate":t=ag(n,Er.Medium);break;case"longDate":t=ag(n,Er.Long);break;case"fullDate":t=ag(n,Er.Full);break;case"shortTime":t=cg(n,Er.Short);break;case"mediumTime":t=cg(n,Er.Medium);break;case"longTime":t=cg(n,Er.Long);break;case"fullTime":t=cg(n,Er.Full);break;case"short":let i=ms(n,"shortTime"),o=ms(n,"shortDate");t=eT(lg(n,Er.Short),[i,o]);break;case"medium":let s=ms(n,"mediumTime"),a=ms(n,"mediumDate");t=eT(lg(n,Er.Medium),[s,a]);break;case"long":let c=ms(n,"longTime"),l=ms(n,"longDate");t=eT(lg(n,Er.Long),[c,l]);break;case"full":let u=ms(n,"fullTime"),d=ms(n,"fullDate");t=eT(lg(n,Er.Full),[u,d]);break}return t&&(Z_[r][e]=t),t}function eT(n,e){return e&&(n=n.replace(/\{([^}]+)}/g,function(r,t){return e!=null&&t in e?e[t]:r})),n}function Pi(n,e,r="-",t,i){let o="";(n<0||i&&n<=0)&&(i?n=-n+1:(n=-n,o=r));let s=String(n);for(;s.length<e;)s="0"+s;return t&&(s=s.slice(s.length-e)),o+s}function rY(n,e){return Pi(n,3).substring(0,e)}function nn(n,e,r=0,t=!1,i=!1){return function(o,s){let a=iY(n,o);if((r>0||a>-r)&&(a+=r),n===3)a===0&&r===-12&&(a=12);else if(n===6)return rY(a,e);let c=ug(s,ps.MinusSign);return Pi(a,e,c,t,i)}}function iY(n,e){switch(n){case 0:return e.getFullYear();case 1:return e.getMonth();case 2:return e.getDate();case 3:return e.getHours();case 4:return e.getMinutes();case 5:return e.getSeconds();case 6:return e.getMilliseconds();case 7:return e.getDay();default:throw new oe(2301,!1)}}function pt(n,e,r=Qn.Format,t=!1){return function(i,o){return oY(i,o,n,e,r,t)}}function oY(n,e,r,t,i,o){switch(r){case 2:return ZU(e,i,t)[n.getMonth()];case 1:return JU(e,i,t)[n.getDay()];case 0:let s=n.getHours(),a=n.getMinutes();if(o){let l=n1(e),u=r1(e,i,t),d=l.findIndex(f=>{if(Array.isArray(f)){let[g,p]=f,_=s>=g.hours&&a>=g.minutes,T=s<p.hours||s===p.hours&&a<p.minutes;if(g.hours<p.hours){if(_&&T)return!0}else if(_||T)return!0}else if(f.hours===s&&f.minutes===a)return!0;return!1});if(d!==-1)return u[d]}return XU(e,i,t)[s<12?0:1];case 3:return e1(e,t)[n.getFullYear()<=0?0:1];default:let c=r;throw new oe(2302,!1)}}function tT(n){return function(e,r,t){let i=-1*t,o=ug(r,ps.MinusSign),s=i>0?Math.floor(i/60):Math.ceil(i/60);switch(n){case 0:return(i>=0?"+":"")+Pi(s,2,o)+Pi(Math.abs(i%60),2,o);case 1:return"GMT"+(i>=0?"+":"")+Pi(s,1,o);case 2:return"GMT"+(i>=0?"+":"")+Pi(s,2,o)+":"+Pi(Math.abs(i%60),2,o);case 3:return t===0?"Z":(i>=0?"+":"")+Pi(s,2,o)+":"+Pi(Math.abs(i%60),2,o);default:throw new oe(2310,!1)}}}var sY=0,rT=4;function aY(n){let e=iT(n,sY,1).getDay();return iT(n,0,1+(e<=rT?rT:rT+7)-e)}function o1(n){let e=n.getDay(),r=e===0?-3:rT-e;return iT(n.getFullYear(),n.getMonth(),n.getDate()+r)}function XR(n,e=!1){return function(r,t){let i;if(e){let o=new Date(r.getFullYear(),r.getMonth(),1).getDay()-1,s=r.getDate();i=1+Math.floor((s+o)/7)}else{let o=o1(r),s=aY(o.getFullYear()),a=o.getTime()-s.getTime();i=1+Math.round(a/6048e5)}return Pi(i,n,ug(t,ps.MinusSign))}}function nT(n,e=!1){return function(r,t){let o=o1(r).getFullYear();return Pi(o,n,ug(t,ps.MinusSign),e)}}var JR={};function cY(n){if(JR[n])return JR[n];let e;switch(n){case"G":case"GG":case"GGG":e=pt(3,ot.Abbreviated);break;case"GGGG":e=pt(3,ot.Wide);break;case"GGGGG":e=pt(3,ot.Narrow);break;case"y":e=nn(0,1,0,!1,!0);break;case"yy":e=nn(0,2,0,!0,!0);break;case"yyy":e=nn(0,3,0,!1,!0);break;case"yyyy":e=nn(0,4,0,!1,!0);break;case"Y":e=nT(1);break;case"YY":e=nT(2,!0);break;case"YYY":e=nT(3);break;case"YYYY":e=nT(4);break;case"M":case"L":e=nn(1,1,1);break;case"MM":case"LL":e=nn(1,2,1);break;case"MMM":e=pt(2,ot.Abbreviated);break;case"MMMM":e=pt(2,ot.Wide);break;case"MMMMM":e=pt(2,ot.Narrow);break;case"LLL":e=pt(2,ot.Abbreviated,Qn.Standalone);break;case"LLLL":e=pt(2,ot.Wide,Qn.Standalone);break;case"LLLLL":e=pt(2,ot.Narrow,Qn.Standalone);break;case"w":e=XR(1);break;case"ww":e=XR(2);break;case"W":e=XR(1,!0);break;case"d":e=nn(2,1);break;case"dd":e=nn(2,2);break;case"c":case"cc":e=nn(7,1);break;case"ccc":e=pt(1,ot.Abbreviated,Qn.Standalone);break;case"cccc":e=pt(1,ot.Wide,Qn.Standalone);break;case"ccccc":e=pt(1,ot.Narrow,Qn.Standalone);break;case"cccccc":e=pt(1,ot.Short,Qn.Standalone);break;case"E":case"EE":case"EEE":e=pt(1,ot.Abbreviated);break;case"EEEE":e=pt(1,ot.Wide);break;case"EEEEE":e=pt(1,ot.Narrow);break;case"EEEEEE":e=pt(1,ot.Short);break;case"a":case"aa":case"aaa":e=pt(0,ot.Abbreviated);break;case"aaaa":e=pt(0,ot.Wide);break;case"aaaaa":e=pt(0,ot.Narrow);break;case"b":case"bb":case"bbb":e=pt(0,ot.Abbreviated,Qn.Standalone,!0);break;case"bbbb":e=pt(0,ot.Wide,Qn.Standalone,!0);break;case"bbbbb":e=pt(0,ot.Narrow,Qn.Standalone,!0);break;case"B":case"BB":case"BBB":e=pt(0,ot.Abbreviated,Qn.Format,!0);break;case"BBBB":e=pt(0,ot.Wide,Qn.Format,!0);break;case"BBBBB":e=pt(0,ot.Narrow,Qn.Format,!0);break;case"h":e=nn(3,1,-12);break;case"hh":e=nn(3,2,-12);break;case"H":e=nn(3,1);break;case"HH":e=nn(3,2);break;case"m":e=nn(4,1);break;case"mm":e=nn(4,2);break;case"s":e=nn(5,1);break;case"ss":e=nn(5,2);break;case"S":e=nn(6,1);break;case"SS":e=nn(6,2);break;case"SSS":e=nn(6,3);break;case"Z":case"ZZ":case"ZZZ":e=tT(0);break;case"ZZZZZ":e=tT(3);break;case"O":case"OO":case"OOO":case"z":case"zz":case"zzz":e=tT(1);break;case"OOOO":case"ZZZZ":case"zzzz":e=tT(2);break;default:return null}return JR[n]=e,e}function s1(n,e){n=n.replace(/:/g,"");let r=Date.parse("Jan 01, 1970 00:00:00 "+n)/6e4;return isNaN(r)?e:r}function lY(n,e){return n=new Date(n.getTime()),n.setMinutes(n.getMinutes()+e),n}function uY(n,e,r){let i=n.getTimezoneOffset(),o=s1(e,i);return lY(n,-1*(o-i))}function dY(n){if(WU(n))return n;if(typeof n=="number"&&!isNaN(n))return new Date(n);if(typeof n=="string"){if(n=n.trim(),/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(n)){let[i,o=1,s=1]=n.split("-").map(a=>+a);return iT(i,o-1,s)}let r=parseFloat(n);if(!isNaN(n-r))return new Date(r);let t;if(t=n.match(tY))return hY(t)}let e=new Date(n);if(!WU(e))throw new oe(2311,!1);return e}function hY(n){let e=new Date(0),r=0,t=0,i=n[8]?e.setUTCFullYear:e.setFullYear,o=n[8]?e.setUTCHours:e.setHours;n[9]&&(r=Number(n[9]+n[10]),t=Number(n[9]+n[11])),i.call(e,Number(n[1]),Number(n[2])-1,Number(n[3]));let s=Number(n[4]||0)-r,a=Number(n[5]||0)-t,c=Number(n[6]||0),l=Math.floor(parseFloat("0."+(n[7]||0))*1e3);return o.call(e,s,a,c,l),e}function WU(n){return n instanceof Date&&!isNaN(n.valueOf())}var ZR=/\s+/,zU=[],fY=(()=>{class n{_ngEl;_renderer;initialClasses=zU;rawClass;stateMap=new Map;constructor(r,t){this._ngEl=r,this._renderer=t}set klass(r){this.initialClasses=r!=null?r.trim().split(ZR):zU}set ngClass(r){this.rawClass=typeof r=="string"?r.trim().split(ZR):r}ngDoCheck(){for(let t of this.initialClasses)this._updateState(t,!0);let r=this.rawClass;if(Array.isArray(r)||r instanceof Set)for(let t of r)this._updateState(t,!0);else if(r!=null)for(let t of Object.keys(r))this._updateState(t,!!r[t]);this._applyStateDiff()}_updateState(r,t){let i=this.stateMap.get(r);i!==void 0?(i.enabled!==t&&(i.changed=!0,i.enabled=t),i.touched=!0):this.stateMap.set(r,{enabled:t,changed:!0,touched:!0})}_applyStateDiff(){for(let r of this.stateMap){let t=r[0],i=r[1];i.changed?(this._toggleClass(t,i.enabled),i.changed=!1):i.touched||(i.enabled&&this._toggleClass(t,!1),this.stateMap.delete(t)),i.touched=!1}}_toggleClass(r,t){r=r.trim(),r.length>0&&r.split(ZR).forEach(i=>{t?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(t){return new(t||n)(ut(sa),ut(j_))};static \u0275dir=Ro({type:n,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return n})();var oT=class{$implicit;ngForOf;index;count;constructor(e,r,t,i){this.$implicit=e,this.ngForOf=r,this.index=t,this.count=i}get first(){return this.index===0}get last(){return this.index===this.count-1}get even(){return this.index%2===0}get odd(){return!this.even}},a1=(()=>{class n{_viewContainer;_template;_differs;set ngForOf(r){this._ngForOf=r,this._ngForOfDirty=!0}set ngForTrackBy(r){this._trackByFn=r}get ngForTrackBy(){return this._trackByFn}_ngForOf=null;_ngForOfDirty=!0;_differ=null;_trackByFn;constructor(r,t,i){this._viewContainer=r,this._template=t,this._differs=i}set ngForTemplate(r){r&&(this._template=r)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let r=this._ngForOf;!this._differ&&r&&(this._differ=this._differs.find(r).create(this.ngForTrackBy))}if(this._differ){let r=this._differ.diff(this._ngForOf);r&&this._applyChanges(r)}}_applyChanges(r){let t=this._viewContainer;r.forEachOperation((i,o,s)=>{if(i.previousIndex==null)t.createEmbeddedView(this._template,new oT(i.item,this._ngForOf,-1,-1),s===null?void 0:s);else if(s==null)t.remove(o===null?void 0:o);else if(o!==null){let a=t.get(o);t.move(a,s),qU(a,i)}});for(let i=0,o=t.length;i<o;i++){let a=t.get(i).context;a.index=i,a.count=o,a.ngForOf=this._ngForOf}r.forEachIdentityChange(i=>{let o=t.get(i.currentIndex);qU(o,i)})}static ngTemplateContextGuard(r,t){return!0}static \u0275fac=function(t){return new(t||n)(ut(Do),ut(yo),ut(qR))};static \u0275dir=Ro({type:n,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}})}return n})();function qU(n,e){n.context.$implicit=e.item}var gY=(()=>{class n{_viewContainer;_context=new sT;_thenTemplateRef=null;_elseTemplateRef=null;_thenViewRef=null;_elseViewRef=null;constructor(r,t){this._viewContainer=r,this._thenTemplateRef=t}set ngIf(r){this._context.$implicit=this._context.ngIf=r,this._updateView()}set ngIfThen(r){KU(r,!1),this._thenTemplateRef=r,this._thenViewRef=null,this._updateView()}set ngIfElse(r){KU(r,!1),this._elseTemplateRef=r,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngIfUseIfTypeGuard;static ngTemplateGuard_ngIf;static ngTemplateContextGuard(r,t){return!0}static \u0275fac=function(t){return new(t||n)(ut(Do),ut(yo))};static \u0275dir=Ro({type:n,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}})}return n})(),sT=class{$implicit=null;ngIf=null};function KU(n,e){if(n&&!n.createEmbeddedView)throw new oe(2020,!1)}var aT=class{_viewContainerRef;_templateRef;_created=!1;constructor(e,r){this._viewContainerRef=e,this._templateRef=r}create(){this._created=!0,this._viewContainerRef.createEmbeddedView(this._templateRef)}destroy(){this._created=!1,this._viewContainerRef.clear()}enforceState(e){e&&!this._created?this.create():!e&&this._created&&this.destroy()}},eC=(()=>{class n{_defaultViews=[];_defaultUsed=!1;_caseCount=0;_lastCaseCheckIndex=0;_lastCasesMatched=!1;_ngSwitch;set ngSwitch(r){this._ngSwitch=r,this._caseCount===0&&this._updateDefaultCases(!0)}_addCase(){return this._caseCount++}_addDefault(r){this._defaultViews.push(r)}_matchCase(r){let t=r===this._ngSwitch;return this._lastCasesMatched||=t,this._lastCaseCheckIndex++,this._lastCaseCheckIndex===this._caseCount&&(this._updateDefaultCases(!this._lastCasesMatched),this._lastCaseCheckIndex=0,this._lastCasesMatched=!1),t}_updateDefaultCases(r){if(this._defaultViews.length>0&&r!==this._defaultUsed){this._defaultUsed=r;for(let t of this._defaultViews)t.enforceState(r)}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Ro({type:n,selectors:[["","ngSwitch",""]],inputs:{ngSwitch:"ngSwitch"}})}return n})(),mY=(()=>{class n{ngSwitch;_view;ngSwitchCase;constructor(r,t,i){this.ngSwitch=i,i._addCase(),this._view=new aT(r,t)}ngDoCheck(){this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase))}static \u0275fac=function(t){return new(t||n)(ut(Do),ut(yo),ut(eC,9))};static \u0275dir=Ro({type:n,selectors:[["","ngSwitchCase",""]],inputs:{ngSwitchCase:"ngSwitchCase"}})}return n})(),pY=(()=>{class n{constructor(r,t,i){i._addDefault(new aT(r,t))}static \u0275fac=function(t){return new(t||n)(ut(Do),ut(yo),ut(eC,9))};static \u0275dir=Ro({type:n,selectors:[["","ngSwitchDefault",""]]})}return n})();var EY=(()=>{class n{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(r,t,i){this._ngEl=r,this._differs=t,this._renderer=i}set ngStyle(r){this._ngStyle=r,!this._differ&&r&&(this._differ=this._differs.find(r).create())}ngDoCheck(){if(this._differ){let r=this._differ.diff(this._ngStyle);r&&this._applyChanges(r)}}_setStyle(r,t){let[i,o]=r.split("."),s=i.indexOf("-")===-1?void 0:Mi.DashCase;t!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,o?`${t}${o}`:t,s):this._renderer.removeStyle(this._ngEl.nativeElement,i,s)}_applyChanges(r){r.forEachRemovedItem(t=>this._setStyle(t.key,null)),r.forEachAddedItem(t=>this._setStyle(t.key,t.currentValue)),r.forEachChangedItem(t=>this._setStyle(t.key,t.currentValue))}static \u0275fac=function(t){return new(t||n)(ut(sa),ut(X_),ut(j_))};static \u0275dir=Ro({type:n,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return n})(),_Y=(()=>{class n{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(r){this._viewContainerRef=r}ngOnChanges(r){if(this._shouldRecreateView(r)){let t=this._viewContainerRef;if(this._viewRef&&t.remove(t.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let i=this._createContextForwardProxy();this._viewRef=t.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(r){return!!r.ngTemplateOutlet||!!r.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(r,t,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,t,i):!1,get:(r,t,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,t,i)}})}static \u0275fac=function(t){return new(t||n)(ut(Do))};static \u0275dir=Ro({type:n,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[VD]})}return n})();function c1(n,e){return new oe(2100,!1)}var TY=/(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])\S*/g,IY=(()=>{class n{transform(r){if(r==null)return null;if(typeof r!="string")throw c1(n,r);return r.replace(TY,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Xf({name:"titlecase",type:n,pure:!0})}return n})();var vY="mediumDate",l1=new Z(""),u1=new Z(""),yY=(()=>{class n{locale;defaultTimezone;defaultOptions;constructor(r,t,i){this.locale=r,this.defaultTimezone=t,this.defaultOptions=i}transform(r,t,i,o){if(r==null||r===""||r!==r)return null;try{let s=t??this.defaultOptions?.dateFormat??vY,a=i??this.defaultOptions?.timezone??this.defaultTimezone??void 0;return i1(r,s,o||this.locale,a)}catch(s){throw c1(n,s.message)}}static \u0275fac=function(t){return new(t||n)(ut(ng,16),ut(l1,24),ut(u1,24))};static \u0275pipe=Xf({name:"date",type:n,pure:!0})}return n})();function SY(n,e){return{key:n,value:e}}var AY=(()=>{class n{differs;constructor(r){this.differs=r}differ;keyValues=[];compareFn=YU;transform(r,t=YU){if(!r||!(r instanceof Map)&&typeof r!="object")return null;this.differ??=this.differs.find(r).create();let i=this.differ.diff(r),o=t!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(s=>{this.keyValues.push(SY(s.key,s.currentValue))})),(i||o)&&(t&&this.keyValues.sort(t),this.compareFn=t),this.keyValues}static \u0275fac=function(t){return new(t||n)(ut(X_,16))};static \u0275pipe=Xf({name:"keyvalue",type:n,pure:!1})}return n})();function YU(n,e){let r=n.key,t=e.key;if(r===t)return 0;if(r==null)return 1;if(t==null)return-1;if(typeof r=="string"&&typeof t=="string")return r<t?-1:1;if(typeof r=="number"&&typeof t=="number")return r-t;if(typeof r=="boolean"&&typeof t=="boolean")return r<t?-1:1;let i=String(r),o=String(t);return i==o?0:i<o?-1:1}var tC=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=aa({type:n});static \u0275inj=is({})}return n})();function dg(n,e){e=encodeURIComponent(e);for(let r of n.split(";")){let t=r.indexOf("="),[i,o]=t==-1?[r,""]:[r.slice(0,t),r.slice(t+1)];if(i.trim()===e)return decodeURIComponent(o)}return null}var Jc=class{};var nC="browser";function d1(n){return n===nC}var hg=class{_doc;constructor(e){this._doc=e}manager},cT=(()=>{class n extends hg{constructor(r){super(r)}supports(r){return!0}addEventListener(r,t,i,o){return r.addEventListener(t,i,o),()=>this.removeEventListener(r,t,i,o)}removeEventListener(r,t,i,o){return r.removeEventListener(t,i,o)}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),uT=new Z(""),aC=(()=>{class n{_zone;_plugins;_eventNameToPlugin=new Map;constructor(r,t){this._zone=t,r.forEach(s=>{s.manager=this});let i=r.filter(s=>!(s instanceof cT));this._plugins=i.slice().reverse();let o=r.find(s=>s instanceof cT);o&&this._plugins.push(o)}addEventListener(r,t,i,o){return this._findPluginFor(t).addEventListener(r,t,i,o)}getZone(){return this._zone}_findPluginFor(r){let t=this._eventNameToPlugin.get(r);if(t)return t;if(t=this._plugins.find(o=>o.supports(r)),!t)throw new oe(5101,!1);return this._eventNameToPlugin.set(r,t),t}static \u0275fac=function(t){return new(t||n)(w(uT),w(Le))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),rC="ng-app-id";function h1(n){for(let e of n)e.remove()}function f1(n,e){let r=e.createElement("style");return r.textContent=n,r}function DY(n,e,r,t){let i=n.head?.querySelectorAll(`style[${rC}="${e}"],link[${rC}="${e}"]`);if(i)for(let o of i)o.removeAttribute(rC),o instanceof HTMLLinkElement?t.set(o.href.slice(o.href.lastIndexOf("/")+1),{usage:0,elements:[o]}):o.textContent&&r.set(o.textContent,{usage:0,elements:[o]})}function oC(n,e){let r=e.createElement("link");return r.setAttribute("rel","stylesheet"),r.setAttribute("href",n),r}var cC=(()=>{class n{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(r,t,i,o={}){this.doc=r,this.appId=t,this.nonce=i,DY(r,t,this.inline,this.external),this.hosts.add(r.head)}addStyles(r,t){for(let i of r)this.addUsage(i,this.inline,f1);t?.forEach(i=>this.addUsage(i,this.external,oC))}removeStyles(r,t){for(let i of r)this.removeUsage(i,this.inline);t?.forEach(i=>this.removeUsage(i,this.external))}addUsage(r,t,i){let o=t.get(r);o?o.usage++:t.set(r,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(r,this.doc)))})}removeUsage(r,t){let i=t.get(r);i&&(i.usage--,i.usage<=0&&(h1(i.elements),t.delete(r)))}ngOnDestroy(){for(let[,{elements:r}]of[...this.inline,...this.external])h1(r);this.hosts.clear()}addHost(r){this.hosts.add(r);for(let[t,{elements:i}]of this.inline)i.push(this.addElement(r,f1(t,this.doc)));for(let[t,{elements:i}]of this.external)i.push(this.addElement(r,oC(t,this.doc)))}removeHost(r){this.hosts.delete(r)}addElement(r,t){return this.nonce&&t.setAttribute("nonce",this.nonce),r.appendChild(t)}static \u0275fac=function(t){return new(t||n)(w(Dn),w(w_),w(cd,8),w(hs))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),iC={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},lC=/%COMP%/g;var m1="%COMP%",RY=`_nghost-${m1}`,CY=`_ngcontent-${m1}`,NY=!0,OY=new Z("",{providedIn:"root",factory:()=>NY});function wY(n){return CY.replace(lC,n)}function bY(n){return RY.replace(lC,n)}function p1(n,e){return e.map(r=>r.replace(lC,n))}var uC=(()=>{class n{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;platformIsServer;constructor(r,t,i,o,s,a,c=null,l=null){this.eventManager=r,this.sharedStylesHost=t,this.appId=i,this.removeStylesOnCompDestroy=o,this.doc=s,this.ngZone=a,this.nonce=c,this.tracingService=l,this.platformIsServer=!1,this.defaultRenderer=new fg(r,s,a,this.platformIsServer,this.tracingService)}createRenderer(r,t){if(!r||!t)return this.defaultRenderer;let i=this.getOrCreateRenderer(r,t);return i instanceof lT?i.applyToHost(r):i instanceof gg&&i.applyStyles(),i}getOrCreateRenderer(r,t){let i=this.rendererByCompId,o=i.get(t.id);if(!o){let s=this.doc,a=this.ngZone,c=this.eventManager,l=this.sharedStylesHost,u=this.removeStylesOnCompDestroy,d=this.platformIsServer,f=this.tracingService;switch(t.encapsulation){case ls.Emulated:o=new lT(c,l,t,this.appId,u,s,a,d,f);break;case ls.ShadowDom:return new sC(c,l,r,t,s,a,this.nonce,d,f);default:o=new gg(c,l,t,u,s,a,d,f);break}i.set(t.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(r){this.rendererByCompId.delete(r)}static \u0275fac=function(t){return new(t||n)(w(aC),w(cC),w(w_),w(OY),w(Dn),w(Le),w(cd),w(Qc,8))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),fg=class{eventManager;doc;ngZone;platformIsServer;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,r,t,i,o){this.eventManager=e,this.doc=r,this.ngZone=t,this.platformIsServer=i,this.tracingService=o}destroy(){}destroyNode=null;createElement(e,r){return r?this.doc.createElementNS(iC[r]||r,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,r){(g1(e)?e.content:e).appendChild(r)}insertBefore(e,r,t){e&&(g1(e)?e.content:e).insertBefore(r,t)}removeChild(e,r){r.remove()}selectRootElement(e,r){let t=typeof e=="string"?this.doc.querySelector(e):e;if(!t)throw new oe(-5104,!1);return r||(t.textContent=""),t}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,r,t,i){if(i){r=i+":"+r;let o=iC[i];o?e.setAttributeNS(o,r,t):e.setAttribute(r,t)}else e.setAttribute(r,t)}removeAttribute(e,r,t){if(t){let i=iC[t];i?e.removeAttributeNS(i,r):e.removeAttribute(`${t}:${r}`)}else e.removeAttribute(r)}addClass(e,r){e.classList.add(r)}removeClass(e,r){e.classList.remove(r)}setStyle(e,r,t,i){i&(Mi.DashCase|Mi.Important)?e.style.setProperty(r,t,i&Mi.Important?"important":""):e.style[r]=t}removeStyle(e,r,t){t&Mi.DashCase?e.style.removeProperty(r):e.style[r]=""}setProperty(e,r,t){e!=null&&(e[r]=t)}setValue(e,r){e.nodeValue=r}listen(e,r,t,i){if(typeof e=="string"&&(e=Co().getGlobalEventTarget(this.doc,e),!e))throw new oe(5102,!1);let o=this.decoratePreventDefault(t);return this.tracingService?.wrapEventListener&&(o=this.tracingService.wrapEventListener(e,r,o)),this.eventManager.addEventListener(e,r,o,i)}decoratePreventDefault(e){return r=>{if(r==="__ngUnwrap__")return e;e(r)===!1&&r.preventDefault()}}};function g1(n){return n.tagName==="TEMPLATE"&&n.content!==void 0}var sC=class extends fg{sharedStylesHost;hostEl;shadowRoot;constructor(e,r,t,i,o,s,a,c,l){super(e,o,s,c,l),this.sharedStylesHost=r,this.hostEl=t,this.shadowRoot=t.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let u=i.styles;u=p1(i.id,u);for(let f of u){let g=document.createElement("style");a&&g.setAttribute("nonce",a),g.textContent=f,this.shadowRoot.appendChild(g)}let d=i.getExternalStyles?.();if(d)for(let f of d){let g=oC(f,o);a&&g.setAttribute("nonce",a),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,r){return super.appendChild(this.nodeOrShadowRoot(e),r)}insertBefore(e,r,t){return super.insertBefore(this.nodeOrShadowRoot(e),r,t)}removeChild(e,r){return super.removeChild(null,r)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},gg=class extends fg{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,r,t,i,o,s,a,c,l){super(e,o,s,a,c),this.sharedStylesHost=r,this.removeStylesOnCompDestroy=i;let u=t.styles;this.styles=l?p1(l,u):u,this.styleUrls=t.getExternalStyles?.(l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&qc.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},lT=class extends gg{contentAttr;hostAttr;constructor(e,r,t,i,o,s,a,c,l){let u=i+"-"+t.id;super(e,r,t,o,s,a,c,l,u),this.contentAttr=wY(u),this.hostAttr=bY(u)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,r){let t=super.createElement(e,r);return super.setAttribute(t,this.contentAttr,""),t}};var dT=class n extends sg{supportsDOMEvents=!0;static makeCurrent(){KR(new n)}onAndCancel(e,r,t,i){return e.addEventListener(r,t,i),()=>{e.removeEventListener(r,t,i)}}dispatchEvent(e,r){e.dispatchEvent(r)}remove(e){e.remove()}createElement(e,r){return r=r||this.getDefaultDocument(),r.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,r){return r==="window"?window:r==="document"?e:r==="body"?e.body:null}getBaseHref(e){let r=LY();return r==null?null:MY(r)}resetBaseElement(){mg=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return dg(document.cookie,e)}},mg=null;function LY(){return mg=mg||document.head.querySelector("base"),mg?mg.getAttribute("href"):null}function MY(n){return new URL(n,document.baseURI).pathname}var hT=class{addToWindow(e){tn.getAngularTestability=(t,i=!0)=>{let o=e.findTestabilityInTree(t,i);if(o==null)throw new oe(5103,!1);return o},tn.getAllAngularTestabilities=()=>e.getAllTestabilities(),tn.getAllAngularRootElements=()=>e.getAllRootElements();let r=t=>{let i=tn.getAllAngularTestabilities(),o=i.length,s=function(){o--,o==0&&t()};i.forEach(a=>{a.whenStable(s)})};tn.frameworkStabilizers||(tn.frameworkStabilizers=[]),tn.frameworkStabilizers.push(r)}findTestabilityInTree(e,r,t){if(r==null)return null;let i=e.getTestability(r);return i??(t?Co().isShadowRoot(r)?this.findTestabilityInTree(e,r.host,!0):this.findTestabilityInTree(e,r.parentElement,!0):null)}},PY=(()=>{class n{build(){return new XMLHttpRequest}static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),E1=["alt","control","meta","shift"],xY={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},FY={alt:n=>n.altKey,control:n=>n.ctrlKey,meta:n=>n.metaKey,shift:n=>n.shiftKey},_1=(()=>{class n extends hg{constructor(r){super(r)}supports(r){return n.parseEventName(r)!=null}addEventListener(r,t,i,o){let s=n.parseEventName(t),a=n.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Co().onAndCancel(r,s.domEventName,a,o))}static parseEventName(r){let t=r.toLowerCase().split("."),i=t.shift();if(t.length===0||!(i==="keydown"||i==="keyup"))return null;let o=n._normalizeKey(t.pop()),s="",a=t.indexOf("code");if(a>-1&&(t.splice(a,1),s="code."),E1.forEach(l=>{let u=t.indexOf(l);u>-1&&(t.splice(u,1),s+=l+".")}),s+=o,t.length!=0||o.length===0)return null;let c={};return c.domEventName=i,c.fullKey=s,c}static matchEventFullKeyCode(r,t){let i=xY[r.key]||r.key,o="";return t.indexOf("code.")>-1&&(i=r.code,o="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),E1.forEach(s=>{if(s!==i){let a=FY[s];a(r)&&(o+=s+".")}}),o+=i,o===t)}static eventCallback(r,t,i){return o=>{n.matchEventFullKeyCode(o,r)&&i.runGuarded(()=>t(o))}}static _normalizeKey(r){return r==="esc"?"escape":r}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();function kY(){dT.makeCurrent()}function UY(){return new Fr}function VY(){return $D(document),document}var BY=[{provide:hs,useValue:nC},{provide:b_,useValue:kY,multi:!0},{provide:Dn,useFactory:VY}],GY=HR(xU,"browser",BY);var $Y=[{provide:ld,useClass:hT},{provide:W_,useClass:Jf,deps:[Le,Zf,ld]},{provide:Jf,useClass:Jf,deps:[Le,Zf,ld]}],jY=[{provide:Of,useValue:"root"},{provide:Fr,useFactory:UY},{provide:uT,useClass:cT,multi:!0,deps:[Dn]},{provide:uT,useClass:_1,multi:!0,deps:[Dn]},uC,cC,aC,{provide:ds,useExisting:uC},{provide:Jc,useClass:PY},[]],HY=(()=>{class n{constructor(){}static \u0275fac=function(t){return new(t||n)};static \u0275mod=aa({type:n});static \u0275inj=is({providers:[...jY,...$Y],imports:[tC,FU]})}return n})();var hd=class{},pg=class{},ua=class n{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(e){e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(`
|
|
5
|
-
`).forEach(r=>{let t=r.indexOf(":");if(t>0){let i=r.slice(0,t),o=r.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((r,t)=>{this.addHeaderEntry(t,r)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([r,t])=>{this.setHeaderEntries(r,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let r=this.headers.get(e.toLowerCase());return r&&r.length>0?r[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,r){return this.clone({name:e,value:r,op:"a"})}set(e,r){return this.clone({name:e,value:r,op:"s"})}delete(e,r){return this.clone({name:e,value:r,op:"d"})}maybeSetNormalizedName(e,r){this.normalizedNames.has(r)||this.normalizedNames.set(r,e)}init(){this.lazyInit&&(this.lazyInit instanceof n?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(e=>this.applyUpdate(e)),this.lazyUpdate=null))}copyFrom(e){e.init(),Array.from(e.headers.keys()).forEach(r=>{this.headers.set(r,e.headers.get(r)),this.normalizedNames.set(r,e.normalizedNames.get(r))})}clone(e){let r=new n;return r.lazyInit=this.lazyInit&&this.lazyInit instanceof n?this.lazyInit:this,r.lazyUpdate=(this.lazyUpdate||[]).concat([e]),r}applyUpdate(e){let r=e.name.toLowerCase();switch(e.op){case"a":case"s":let t=e.value;if(typeof t=="string"&&(t=[t]),t.length===0)return;this.maybeSetNormalizedName(e.name,r);let i=(e.op==="a"?this.headers.get(r):void 0)||[];i.push(...t),this.headers.set(r,i);break;case"d":let o=e.value;if(!o)this.headers.delete(r),this.normalizedNames.delete(r);else{let s=this.headers.get(r);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(r),this.normalizedNames.delete(r)):this.headers.set(r,s)}break}}addHeaderEntry(e,r){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(r):this.headers.set(t,[r])}setHeaderEntries(e,r){let t=(Array.isArray(r)?r:[r]).map(o=>o.toString()),i=e.toLowerCase();this.headers.set(i,t),this.maybeSetNormalizedName(e,i)}forEach(e){this.init(),Array.from(this.normalizedNames.keys()).forEach(r=>e(this.normalizedNames.get(r),this.headers.get(r)))}};var gT=class{encodeKey(e){return T1(e)}encodeValue(e){return T1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function WY(n,e){let r=new Map;return n.length>0&&n.replace(/^\?/,"").split("&").forEach(i=>{let o=i.indexOf("="),[s,a]=o==-1?[e.decodeKey(i),""]:[e.decodeKey(i.slice(0,o)),e.decodeValue(i.slice(o+1))],c=r.get(s)||[];c.push(a),r.set(s,c)}),r}var zY=/%(\d[a-f0-9])/gi,qY={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function T1(n){return encodeURIComponent(n).replace(zY,(e,r)=>qY[r]??e)}function fT(n){return`${n}`}var Es=class n{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new gT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=WY(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(r=>{let t=e.fromObject[r],i=Array.isArray(t)?t.map(fT):[fT(t)];this.map.set(r,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let r=this.map.get(e);return r?r[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,r){return this.clone({param:e,value:r,op:"a"})}appendAll(e){let r=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{r.push({param:t,value:o,op:"a"})}):r.push({param:t,value:i,op:"a"})}),this.clone(r)}set(e,r){return this.clone({param:e,value:r,op:"s"})}delete(e,r){return this.clone({param:e,value:r,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let r=this.encoder.encodeKey(e);return this.map.get(e).map(t=>r+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let r=new n({encoder:this.encoder});return r.cloneFrom=this.cloneFrom||this,r.updates=(this.updates||[]).concat(e),r}init(){this.map===null&&(this.map=new Map),this.cloneFrom!==null&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(e=>this.map.set(e,this.cloneFrom.map.get(e))),this.updates.forEach(e=>{switch(e.op){case"a":case"s":let r=(e.op==="a"?this.map.get(e.param):void 0)||[];r.push(fT(e.value)),this.map.set(e.param,r);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(fT(e.value));i!==-1&&t.splice(i,1),t.length>0?this.map.set(e.param,t):this.map.delete(e.param)}else{this.map.delete(e.param);break}}}),this.cloneFrom=this.updates=null)}};var mT=class{map=new Map;set(e,r){return this.map.set(e,r),this}get(e){return this.map.has(e)||this.map.set(e,e.defaultValue()),this.map.get(e)}delete(e){return this.map.delete(e),this}has(e){return this.map.has(e)}keys(){return this.map.keys()}};function KY(n){switch(n){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function I1(n){return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer}function v1(n){return typeof Blob<"u"&&n instanceof Blob}function y1(n){return typeof FormData<"u"&&n instanceof FormData}function YY(n){return typeof URLSearchParams<"u"&&n instanceof URLSearchParams}var S1="Content-Type",A1="Accept",R1="X-Request-URL",C1="text/plain",N1="application/json",QY=`${N1}, ${C1}, */*`,ud=class n{url;body=null;headers;context;reportProgress=!1;withCredentials=!1;credentials;keepalive=!1;cache;priority;mode;redirect;referrer;integrity;responseType="json";method;params;urlWithParams;transferCache;timeout;constructor(e,r,t,i){this.url=r,this.method=e.toUpperCase();let o;if(KY(this.method)||i?(this.body=t!==void 0?t:null,o=i):o=t,o){if(this.reportProgress=!!o.reportProgress,this.withCredentials=!!o.withCredentials,this.keepalive=!!o.keepalive,o.responseType&&(this.responseType=o.responseType),o.headers&&(this.headers=o.headers),o.context&&(this.context=o.context),o.params&&(this.params=o.params),o.priority&&(this.priority=o.priority),o.cache&&(this.cache=o.cache),o.credentials&&(this.credentials=o.credentials),typeof o.timeout=="number"){if(o.timeout<1||!Number.isInteger(o.timeout))throw new oe(2822,"");this.timeout=o.timeout}o.mode&&(this.mode=o.mode),o.redirect&&(this.redirect=o.redirect),o.integrity&&(this.integrity=o.integrity),o.referrer&&(this.referrer=o.referrer),this.transferCache=o.transferCache}if(this.headers??=new ua,this.context??=new mT,!this.params)this.params=new Es,this.urlWithParams=r;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=r;else{let a=r.indexOf("?"),c=a===-1?"?":a<r.length-1?"&":"";this.urlWithParams=r+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||I1(this.body)||v1(this.body)||y1(this.body)||YY(this.body)?this.body:this.body instanceof Es?this.body.toString():typeof this.body=="object"||typeof this.body=="boolean"||Array.isArray(this.body)?JSON.stringify(this.body):this.body.toString()}detectContentTypeHeader(){return this.body===null||y1(this.body)?null:v1(this.body)?this.body.type||null:I1(this.body)?null:typeof this.body=="string"?C1:this.body instanceof Es?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?N1:null}clone(e={}){let r=e.method||this.method,t=e.url||this.url,i=e.responseType||this.responseType,o=e.keepalive??this.keepalive,s=e.priority||this.priority,a=e.cache||this.cache,c=e.mode||this.mode,l=e.redirect||this.redirect,u=e.credentials||this.credentials,d=e.referrer||this.referrer,f=e.integrity||this.integrity,g=e.transferCache??this.transferCache,p=e.timeout??this.timeout,_=e.body!==void 0?e.body:this.body,T=e.withCredentials??this.withCredentials,D=e.reportProgress??this.reportProgress,b=e.headers||this.headers,G=e.params||this.params,M=e.context??this.context;return e.setHeaders!==void 0&&(b=Object.keys(e.setHeaders).reduce((U,k)=>U.set(k,e.setHeaders[k]),b)),e.setParams&&(G=Object.keys(e.setParams).reduce((U,k)=>U.set(k,e.setParams[k]),G)),new n(r,t,_,{params:G,headers:b,context:M,reportProgress:D,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},Zc=(function(n){return n[n.Sent=0]="Sent",n[n.UploadProgress=1]="UploadProgress",n[n.ResponseHeader=2]="ResponseHeader",n[n.DownloadProgress=3]="DownloadProgress",n[n.Response=4]="Response",n[n.User=5]="User",n})(Zc||{}),fd=class{headers;status;statusText;url;ok;type;redirected;constructor(e,r=200,t="OK"){this.headers=e.headers||new ua,this.status=e.status!==void 0?e.status:r,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},pT=class n extends fd{constructor(e={}){super(e)}type=Zc.ResponseHeader;clone(e={}){return new n({headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0})}},Eg=class n extends fd{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=Zc.Response;clone(e={}){return new n({body:e.body!==void 0?e.body:this.body,headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0,redirected:e.redirected??this.redirected})}},dd=class extends fd{name="HttpErrorResponse";message;error;ok=!1;constructor(e){super(e,0,"Unknown Error"),this.status>=200&&this.status<300?this.message=`Http failure during parsing for ${e.url||"(unknown url)"}`:this.message=`Http failure response for ${e.url||"(unknown url)"}: ${e.status} ${e.statusText}`,this.error=e.error||null}},XY=200,JY=204;function dC(n,e){return{body:e,headers:n.headers,context:n.context,observe:n.observe,params:n.params,reportProgress:n.reportProgress,responseType:n.responseType,withCredentials:n.withCredentials,credentials:n.credentials,transferCache:n.transferCache,timeout:n.timeout,keepalive:n.keepalive,priority:n.priority,cache:n.cache,mode:n.mode,redirect:n.redirect,integrity:n.integrity,referrer:n.referrer}}var O1=(()=>{class n{handler;constructor(r){this.handler=r}request(r,t,i={}){let o;if(r instanceof ud)o=r;else{let c;i.headers instanceof ua?c=i.headers:c=new ua(i.headers);let l;i.params&&(i.params instanceof Es?l=i.params:l=new Es({fromObject:i.params})),o=new ud(r,t,i.body!==void 0?i.body:null,{headers:c,context:i.context,params:l,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache,keepalive:i.keepalive,priority:i.priority,cache:i.cache,mode:i.mode,redirect:i.redirect,credentials:i.credentials,referrer:i.referrer,integrity:i.integrity,timeout:i.timeout})}let s=ue(o).pipe(yS(c=>this.handler.handle(c)));if(r instanceof ud||i.observe==="events")return s;let a=s.pipe(Ct(c=>c instanceof Eg));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof ArrayBuffer))throw new oe(2806,!1);return c.body}));case"blob":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof Blob))throw new oe(2807,!1);return c.body}));case"text":return a.pipe(fe(c=>{if(c.body!==null&&typeof c.body!="string")throw new oe(2808,!1);return c.body}));default:return a.pipe(fe(c=>c.body))}case"response":return a;default:throw new oe(2809,!1)}}delete(r,t={}){return this.request("DELETE",r,t)}get(r,t={}){return this.request("GET",r,t)}head(r,t={}){return this.request("HEAD",r,t)}jsonp(r,t){return this.request("JSONP",r,{params:new Es().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(r,t={}){return this.request("OPTIONS",r,t)}patch(r,t,i={}){return this.request("PATCH",r,dC(i,t))}post(r,t,i={}){return this.request("POST",r,dC(i,t))}put(r,t,i={}){return this.request("PUT",r,dC(i,t))}static \u0275fac=function(t){return new(t||n)(w(hd))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var ZY=new Z("");function w1(n,e){return e(n)}function e7(n,e){return(r,t)=>e.intercept(r,{handle:i=>n(i,t)})}function t7(n,e,r){return(t,i)=>fo(r,()=>e(t,o=>n(o,i)))}var b1=new Z(""),fC=new Z(""),L1=new Z(""),gC=new Z("",{providedIn:"root",factory:()=>!0});function n7(){let n=null;return(e,r)=>{n===null&&(n=(ne(b1,{optional:!0})??[]).reduceRight(e7,w1));let t=ne(Io);if(ne(gC)){let o=t.add();return n(e,r).pipe(Sc(o))}else return n(e,r)}}var ET=(()=>{class n extends hd{backend;injector;chain=null;pendingTasks=ne(Io);contributeToStability=ne(gC);constructor(r,t){super(),this.backend=r,this.injector=t}handle(r){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(fC),...this.injector.get(L1,[])]));this.chain=t.reduceRight((i,o)=>t7(i,o,this.injector),w1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(r,i=>this.backend.handle(i)).pipe(Sc(t))}else return this.chain(r,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||n)(w(pg),w(Kn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var r7=/^\)\]\}',?\n/,i7=RegExp(`^${R1}:`,"m");function o7(n){return"responseURL"in n&&n.responseURL?n.responseURL:i7.test(n.getAllResponseHeaders())?n.getResponseHeader(R1):null}var hC=(()=>{class n{xhrFactory;constructor(r){this.xhrFactory=r}handle(r){if(r.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return ue(null).pipe(mt(()=>new ge(o=>{let s=t.build();if(s.open(r.method,r.urlWithParams),r.withCredentials&&(s.withCredentials=!0),r.headers.forEach((T,D)=>s.setRequestHeader(T,D.join(","))),r.headers.has(A1)||s.setRequestHeader(A1,QY),!r.headers.has(S1)){let T=r.detectContentTypeHeader();T!==null&&s.setRequestHeader(S1,T)}if(r.timeout&&(s.timeout=r.timeout),r.responseType){let T=r.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=r.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",D=new ua(s.getAllResponseHeaders()),b=o7(s)||r.url;return c=new pT({headers:D,status:s.status,statusText:T,url:b}),c},u=()=>{let{headers:T,status:D,statusText:b,url:G}=l(),M=null;D!==JY&&(M=typeof s.response>"u"?s.responseText:s.response),D===0&&(D=M?XY:0);let U=D>=200&&D<300;if(r.responseType==="json"&&typeof M=="string"){let k=M;M=M.replace(r7,"");try{M=M!==""?JSON.parse(M):null}catch(S){M=k,U&&(U=!1,M={error:S,text:M})}}U?(o.next(new Eg({body:M,headers:T,status:D,statusText:b,url:G||void 0})),o.complete()):o.error(new dd({error:M,headers:T,status:D,statusText:b,url:G||void 0}))},d=T=>{let{url:D}=l(),b=new dd({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:D||void 0});o.error(b)},f=d;r.timeout&&(f=T=>{let{url:D}=l(),b=new dd({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:D||void 0});o.error(b)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let D={type:Zc.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),r.responseType==="text"&&s.responseText&&(D.partialText=s.responseText),o.next(D)},_=T=>{let D={type:Zc.UploadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),o.next(D)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),r.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:Zc.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),r.reportProgress&&(s.removeEventListener("progress",p),a!==null&&s.upload&&s.upload.removeEventListener("progress",_)),s.readyState!==s.DONE&&s.abort()}})))}static \u0275fac=function(t){return new(t||n)(w(Jc))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),M1=new Z(""),s7="XSRF-TOKEN",a7=new Z("",{providedIn:"root",factory:()=>s7}),c7="X-XSRF-TOKEN",l7=new Z("",{providedIn:"root",factory:()=>c7}),_g=class{},u7=(()=>{class n{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(r,t){this.doc=r,this.cookieName=t}getToken(){let r=this.doc.cookie||"";return r!==this.lastCookieString&&(this.parseCount++,this.lastToken=dg(r,this.cookieName),this.lastCookieString=r),this.lastToken}static \u0275fac=function(t){return new(t||n)(w(Dn),w(a7))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),d7=/^(?:https?:)?\/\//i;function h7(n,e){if(!ne(M1)||n.method==="GET"||n.method==="HEAD"||d7.test(n.url))return e(n);let r=ne(_g).getToken(),t=ne(l7);return r!=null&&!n.headers.has(t)&&(n=n.clone({headers:n.headers.set(t,r)})),e(n)}var mC=(function(n){return n[n.Interceptors=0]="Interceptors",n[n.LegacyInterceptors=1]="LegacyInterceptors",n[n.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",n[n.NoXsrfProtection=3]="NoXsrfProtection",n[n.JsonpSupport=4]="JsonpSupport",n[n.RequestsMadeViaParent=5]="RequestsMadeViaParent",n[n.Fetch=6]="Fetch",n})(mC||{});function f7(n,e){return{\u0275kind:n,\u0275providers:e}}function g7(...n){let e=[O1,hC,ET,{provide:hd,useExisting:ET},{provide:pg,useFactory:()=>ne(ZY,{optional:!0})??ne(hC)},{provide:fC,useValue:h7,multi:!0},{provide:M1,useValue:!0},{provide:_g,useClass:u7}];for(let r of n)e.push(...r.\u0275providers);return pr(e)}var D1=new Z("");function m7(){return f7(mC.LegacyInterceptors,[{provide:D1,useFactory:n7},{provide:fC,useExisting:D1,multi:!0}])}var pC=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:function(t){let i=null;return t?i=new(t||n):i=w(p7),i},providedIn:"root"})}return n})(),p7=(()=>{class n extends pC{_doc;constructor(r){super(),this._doc=r}sanitize(r,t){if(t==null)return null;switch(r){case si.NONE:return t;case si.HTML:return So(t,"HTML")?Br(t):P_(this._doc,String(t)).toString();case si.STYLE:return So(t,"Style")?Br(t):t;case si.SCRIPT:if(So(t,"Script"))return Br(t);throw new oe(5200,!1);case si.URL:return So(t,"URL")?Br(t):Hf(String(t));case si.RESOURCE_URL:if(So(t,"ResourceURL"))return Br(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(r){return WD(r)}bypassSecurityTrustStyle(r){return zD(r)}bypassSecurityTrustScript(r){return qD(r)}bypassSecurityTrustUrl(r){return KD(r)}bypassSecurityTrustResourceUrl(r){return YD(r)}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var st={production:!1,staging:!0,firebaseLogLevel:"error",firebaseConfig:{apiKey:"AIzaSyAzcW2n1JhY_zhkXmuFcwe550AkwmYeJ0w",authDomain:"snipply-sdk-staging.firebaseapp.com",projectId:"snipply-sdk-staging",storageBucket:"snipply-sdk-staging.appspot.com",messagingSenderId:"877538579326",appId:"1:877538579326:web:f793f73f2b7dc770c4992f"},firebaseNotificationsDatabaseURL:"https://snipply-sdk-staging-notifications.firebaseio.com",segmentAnalyticsWriteKey:"ndJ0KZs5LkL6jny5a43FXXQkTF5bgPFt",useEmulators:!1,debugMode:!1,cloudFunction:{sa:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",getIceServers:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/geticeservers",validateClient:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/validateclient",convertRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/convertrecordingv2",chatgptCompletion:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/chatgptcompletion",rewriterAskAi:"https://staging.velt.dev/v2/rewriter/ask-ai",whisperTranscription:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/whispertranscription",getPlanDetails:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getplandetails",getAllowedDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getalloweddocuments",getNotificationsForDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getnotificationsfordocuments",videoBackend:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/videobackend",processRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/processrecording",sdkProxy:"https://staging.velt.dev/v2/core/a",screenshot:"https://staging.velt.dev/v2/screenshots/capture",usCentral1:{setEncryptedData:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/setencrypteddata"},asiaSouthEast1:{setEncryptedData:"https://asia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau"},europeWest1:{setEncryptedData:"https://europe-west1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataeu"},asiaNorthEast1:{setEncryptedData:"https://asia-northeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddatajp"},australiaSouthEast1:{setEncryptedData:"https://australia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau1"}}};var Ie=(function(n){return n.NEWLY_ADDED="newlyAdded",n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.ASSIGNED="assigned",n.STATUS_CHANGED="statusChanged",n.PRIORITY_CHANGED="priorityChanged",n.ACCESS_MODE_CHANGED="accessModeChanged",n.CUSTOM_LIST_CHANGED="customListChanged",n.ACCEPTED="accepted",n.REJECTED="rejected",n.REACTION_ADDED="reactionAdded",n.REACTION_DELETED="reactionDeleted",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",n.SUGGESTION_ACCEPTED="suggestionAccepted",n.SUGGESTION_REJECTED="suggestionRejected",n})(Ie||{}),Qt=(function(n){return n.COMMENT_ANNOTATION_ADD="comment_annotation.add",n.COMMENT_ANNOTATION_DELETE="comment_annotation.delete",n.COMMENT_ADD="comment.add",n.COMMENT_DELETE="comment.delete",n.COMMENT_UPDATE="comment.update",n.REACTION_ADD="reaction.add",n.REACTION_DELETE="reaction.delete",n.ATTACHMENT_ADD="attachment.add",n.ATTACHMENT_DELETE="attachment.delete",n.RECORDER_ANNOTATION_ADD="recorder_annotation.add",n.RECORDER_ANNOTATION_UPDATE="recorder_annotation.update",n.RECORDER_ANNOTATION_DELETE="recorder_annotation.delete",n.ACTIVITY_SAVE="activity.save",n})(Qt||{}),Xn=(function(n){return n.STATUS_CHANGE="comment_annotation.status_change",n.PRIORITY_CHANGE="comment_annotation.priority_change",n.ASSIGN="comment_annotation.assign",n.ACCESS_MODE_CHANGE="comment_annotation.access_mode_change",n.CUSTOM_LIST_CHANGE="comment_annotation.custom_list_change",n.APPROVE="comment_annotation.approve",n.ACCEPT="comment.accept",n.REJECT="comment.reject",n.SUGGESTION_ACCEPT="comment_annotation.suggestion_accept",n.SUGGESTION_REJECT="comment_annotation.suggestion_reject",n.REACTION_ADD="comment.reaction_add",n.REACTION_DELETE="comment.reaction_delete",n.SUBSCRIBE="comment_annotation.subscribe",n.UNSUBSCRIBE="comment_annotation.unsubscribe",n})(Xn||{}),pAe={ADD_COMMENT_ANNOTATION:"addCommentAnnotation",ADD_COMMENT_ANNOTATION_DRAFT:"addCommentAnnotationDraft",DELETE_COMMENT_ANNOTATION:"deleteCommentAnnotation",APPROVE_COMMENT_ANNOTATION:"approveCommentAnnotation",ACCEPT_COMMENT_ANNOTATION:"acceptCommentAnnotation",REJECT_COMMENT_ANNOTATION:"rejectCommentAnnotation",SUBSCRIBE_COMMENT_ANNOTATION:"subscribeCommentAnnotation",UNSUBSCRIBE_COMMENT_ANNOTATION:"unsubscribeCommentAnnotation",ASSIGN_USER:"assignUser",UPDATE_STATUS:"updateStatus",UPDATE_PRIORITY:"updatePriority",UPDATE_ACCESS:"updateAccess",RESOLVE_COMMENT:"resolveComment",ADD_COMMENT:"addComment",ADD_COMMENT_DRAFT:"addCommentDraft",UPDATE_COMMENT:"updateComment",DELETE_COMMENT:"deleteComment",ADD_ATTACHMENT:"addAttachment",DELETE_ATTACHMENT:"deleteAttachment",DELETE_RECORDING:"deleteRecording",COPY_LINK:"copyLink",ADD_REACTION:"addReaction",DELETE_REACTION:"deleteReaction",TOGGLE_REACTION:"toggleReaction",COMMENT_SIDEBAR_DATA_INIT:"commentSidebarDataInit",COMMENT_SIDEBAR_DATA_UPDATE:"commentSidebarDataUpdate",AUTOCOMPLETE_SEARCH:"autocompleteSearch",COMPOSER_CLICKED:"composerClicked",COMPOSER_TEXT_CHANGE:"composerTextChange",LINK_CLICKED:"linkClicked",COMMENT_PIN_CLICKED:"commentPinClicked",COMMENT_BUBBLE_CLICKED:"commentBubbleClicked",COMMENT_TOOL_CLICK:"commentToolClick",COMMENT_TOOL_CLICKED:"commentToolClicked",SIDEBAR_BUTTON_CLICK:"sidebarButtonClick",SIDEBAR_BUTTON_CLICKED:"sidebarButtonClicked",ATTACHMENT_DOWNLOAD_CLICKED:"attachmentDownloadClicked",COMMENT_SAVED:"commentSaved",COMMENT_SAVE_TRIGGERED:"commentSaveTriggered",VISIBILITY_OPTION_CLICKED:"visibilityOptionClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},EAe={TRANSCRIPTION_DONE:"transcriptionDone",RECORDING_DONE:"recordingDone",RECORDING_EDIT_DONE:"recordingEditDone",DELETE_RECORDING:"deleteRecording",ERROR:"error",RECORDING_SAVE_INITIATED:"recordingSaveInitiated",RECORDING_STARTED:"recordingStarted",RECORDING_PAUSED:"recordingPaused",RECORDING_RESUMED:"recordingResumed",RECORDING_CANCELLED:"recordingCancelled",RECORDING_STOPPED:"recordingStopped",RECORDING_DONE_LOCAL:"recordingDoneLocal"},_Ae={TEXT_SELECTED:"textSelected"},TAe={SUGGESTION_CREATED:"suggestionCreated",SUGGESTION_APPROVED:"suggestionApproved",SUGGESTION_REJECTED:"suggestionRejected",SUGGESTION_STALE:"suggestionStale",TARGET_EDIT_START:"targetEditStart",TARGET_EDIT_COMMIT:"targetEditCommit"},$={PERMISSION_PROVIDER:"permissionProvider",USER_RESOLVER:"userResolver",COMMENT_RESOLVER:"commentResolver",ATTACHMENT_RESOLVER:"attachmentResolver",REACTION_RESOLVER:"reactionResolver",RECORDER_RESOLVER:"recorderResolver",NOTIFICATION_RESOLVER:"notificationResolver",ACTIVITY_RESOLVER:"activityResolver",VELT_BUTTON_CLICK:"veltButtonClick",USER_UPDATE:"userUpdate",INIT_UPDATE:"initUpdate",DOCUMENT_INIT:"documentInit",ERROR:"error"},IAe={ACCESS_REQUESTED:"accessRequested",ACCESS_REQUEST_CANCELED:"accessRequestCanceled",ACCESS_ACCEPTED:"accessAccepted",ACCESS_REJECTED:"accessRejected",EDITOR_ASSIGNED:"editorAssigned",VIEWER_ASSIGNED:"viewerAssigned",EDITOR_ON_DIFFERENT_TAB_DETECTED:"editorOnDifferentTabDetected"},vAe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},yAe={SETTINGS_UPDATED:"settingsUpdated"},SAe={UPDATE_DATA:"updateData"},_7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(_7||{}),T7=(function(n){return n.INVITE="invite",n.REMOVE="remove",n})(T7||{}),I7=(function(n){return n.CREATED="created",n.JOINED="joined",n})(I7||{}),v7=(function(n){return n.UPDATE_DATA="updateData",n})(v7||{}),_T=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(_T||{}),y7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(y7||{}),S7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(S7||{}),A7=(function(n){return n.FIRST_VIEWED="firstViewed",n})(A7||{}),EC=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.ACTIVITY="activity",n.VIEWS="views",n.USER_INVITE="userInvite",n.USER_REQUEST="userRequest",n.VIDEO_PLAYER="videoPlayer",n.CRDT="crdt",n})(EC||{}),D7=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.AREA_COMMENT="areaComment",n.INLINE_COMMENT="inlineComment",n.COMMENT_SIDEBAR="commentSidebar",n})(D7||{}),$r=(function(n){return n.DESKTOP="Desktop",n.MOBILE="Mobile",n.TABLET="Tablet",n.MONITOR="Monitor",n.UNKNOWN="Unknown",n})($r||{}),gd=(function(n){return n.PORTRAIT="portrait",n.LANDSCAPE="landscape",n.UNKNOWN="unknown",n})(gd||{}),TT=(function(n){return n.Portrait="(orientation: portrait)",n.Landscape="(orientation: landscape)",n})(TT||{}),R7=(function(n){return n.DIFFERENT_DEVICE="differentDevice",n.ELEMENT_DELETED="elementDeleted",n})(R7||{}),md=(function(n){return n.ADMIN="Admin",n.COMMENTER="Commenter",n})(md||{}),wt=(function(n){return n.PUBLIC="public",n.RESTRICTED="restricted",n.ORGANIZATION_PRIVATE="organizationPrivate",n})(wt||{}),C7=(function(n){return n.DEFAULT="default",n.DYNAMIC_ID="dynamicId",n})(C7||{}),Tg=(function(n){return n.PUBLIC="public",n.PRIVATE="private",n})(Tg||{}),N7=(function(n){return n.MINIMAL="minimal",n.VERBOSE="verbose",n})(N7||{}),O7=(function(n){return n.DEFAULT="default",n.EXPANDED="expanded",n})(O7||{}),w7=(function(n){return n.TOTAL="total",n.UNREAD="unread",n})(w7||{}),b7=(function(n){return n.ONLINE="online",n.OFFLINE="offline",n.PENDING_INIT="pendingInit",n.PENDING_DATA="pendingData",n})(b7||{}),L7=(function(n){return n.ALL="all",n.ORGANIZATION="organization",n.ORGANIZATION_USER_GROUP="organizationUserGroup",n.DOCUMENT="document",n.FOLDER="folder",n})(L7||{}),M7=(function(n){return n.AND="and",n.OR="or",n})(M7||{}),P7=(function(n){return n.RESTRICTED_SELF="restrictedSelf",n.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",n.ORGANIZATION_PRIVATE="organizationPrivate",n.PUBLIC="public",n})(P7||{});var q=class q{};q.SNIPPYLY_HOST_URL_PROD="https://snippyly.com",q.SNIPPYLY_HOST_URL_STAGING="https://snippyly-staging.web.app",q.USER_TYPE_ANONYMOUS="anonymous",q.USER_TYPE_SIGNED_IN="signedIn",q.LOCALSTORAGE_DATA_ID="snippylytempdata",q.NO_ORGANIZATION_ID="veltNoOrganization",q.DEFAULT_QUERY_HASH="default",q.LISTENER_BATCH_SIZE=5,q.LISTENER_CONTEXT_BATCH_SIZE=25,q.DEFAULT_VELT_CONTEXT="default:velt",q.VISIBILITY_SELF_PREFIX="__velt_private_self:",q.FIREBASE_PARTIAL_PATH_ORGANIZATIONS="organizations",q.FIREBASE_PARTIAL_PATH_FOLDERS="folders",q.FIREBASE_PARTIAL_PATH_DOCS="docs",q.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS="documentConfigurations",q.FIREBASE_PARTIAL_PATH_PRESENCE="presence",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS="orgIamUsers",q.FIREBASE_PARTIAL_PATH_CENTRAL_USERS="users",q.FIREBASE_PARTIAL_PATH_FOLDER_USERS="folderIamUsers",q.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS="docIamUsers",q.FIREBASE_PARTIAL_PATH_CURSOR="cursor",q.FIREBASE_PARTIAL_PATH_ARROW="arrow",q.FIREBASE_PARTIAL_PATH_AREA="area",q.FIREBASE_PARTIAL_PATH_COMMENT="comment",q.FIREBASE_PARTIAL_PATH_LOCATION="location",q.FIREBASE_PARTIAL_PATH_MULTI_THREAD="multiThread",q.FIREBASE_PARTIAL_PATH_TAG="tag",q.FIREBASE_PARTIAL_PATH_SELECTION="selection",q.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE="audioHuddle",q.FIREBASE_PARTIAL_PATH_HUDDLE="huddle",q.FIREBASE_PARTIAL_PATH_CONTACTS="contacts",q.FIREBASE_PARTIAL_PATH_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS="notificationsDocs",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS="notificationsUsers",q.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION="notificationsDocs__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION="notificationsUsers__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX="userNotificationIndex",q.FIREBASE_PARTIAL_PATH_GLOBAL="global",q.FIREBASE_PARTIAL_PATH_LOGINS="logins",q.FIREBASE_PARTIAL_PATH_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_LOCATIONS="locations",q.FIREBASE_PARTIAL_PATH_RECORDER="recorder",q.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG="flock",q.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER="syncVideoPlayer",q.FIREBASE_PARTIAL_PATH_LIVE_STATE="liveState",q.FIREBASE_PARTIAL_PATH_IAM="iam",q.FIREBASE_PARTIAL_PATH_REACTION="reaction",q.FIREBASE_PARTIAL_PATH_CRDT="crdt",q.FIREBASE_PARTIAL_PATH_VIEWS="views",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS="notificationViews",q.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS="documentViews",q.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS="locationViews",q.FIREBASE_PARTIAL_PATH_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP="lastNotificationTimestamp",q.FIREBASE_PARTIAL_PATH_ACTIVITIES="activities",q.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP="lastActivityTimestamp",q.FIREBASE_PARTIAL_PATH_HEARTBEAT="heartbeat",q.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT="heartbeatByDocument",q.FIREBASE_PARTIAL_PATH_USERS="users",q.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS="permissions",q.FIREBASE_PARTIAL_PATH_USER_REQUESTS="userRequests",q.FIREBASE_PARTIAL_PATH_FEEDBACK="feedback",q.FIREBASE_PARTIAL_PATH_BUGS="bugs",q.FIREBASE_PARTIAL_PATH_CONTACT_US="contactUs",q.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA="metadata",q.PRESENCE_STATUS_ONLINE="online",q.PRESENCE_STATUS_OFFLINE="offline",q.PRESENCE_STATUS_AWAY="away",q.IMG_URL_NOT_FOUND="https://snippyly.com/assets/icons/anon-user.svg",q.IMG_CLASS_NOT_FOUND="presence-avatar-image-small",q.AVATAR_COLOR_LIST=["#a259fe","#9746ff","#19bcfe","#FE8947","#2c83fc","#0dcf82","#ffcb00","#ff7162","#FFD600","#A5A7FE","#67DBF4","#FDA192"],q.TEXT_COLOR_MAP={"#a259fe":"#ffffff","#9746ff":"#ffffff","#19bcfe":"#ffffff","#FE8947":"#ffffff","#2c83fc":"#ffffff","#0dcf82":"#141416","#ffcb00":"#141416","#ff7162":"#ffffff","#FFD600":"#141416","#A5A7FE":"#141416","#67DBF4":"#141416","#FDA192":"#141416"},q.UNREAD_COMMENTS_CHECK_FROM_DATE="2024-02-05",q.DEFAULT_ANNOTATION_COLOR="#a259fe",q.REGEX_EMAIL=/(\+|@)+([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,q.REGEX_URL=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)(?::[0-9]+)?((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_0-9]*)#?(?:[\.\!\/\\\w0-9=]*))?)/gi,q.REGEX_URL_FOR_USER_NAME=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,q.REGEX_SPECIAL_CHARS=/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,q.SNIPPYLY_HIGHLIGHT="snippyly-highlight",q.SNIPPYLY_HIGHLIGHT_PREVIEW="snippyly-highlight-preview",q.SNIPPYLY_HIGHLIGHT_USER="snippyly-highlight-user",q.SNIPPYLY_HIGHLIGHT_USER_NAME="snippyly-highlight-user-name",q.SNIPPYLY_HIGHLIGHT_USER_TEXT="snippyly-highlight-user-text",q.VELT_LIVE_SELECTION_ON_ELEMENT="velt-live-selection-on-element",q.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT="velt-live-selection-on-element-default",q.VELT_LIVE_SELECTION_ON_TEXT="velt-live-selection-on-text",q.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT="velt-live-selection-on-text-default",q.VELT_IGNORE_CHANGE_DETECTION="velt-ignore-change-detection",q.VELT_CUSTOM_CSS="velt-custom-css",q.TAGS={SNIPPYLY_ROOT:"snippyly-root",SNIPPYLY_PRESENCE:"snippyly-presence",SNIPPYLY_CURSOR:"snippyly-cursor",SNIPPYLY_COMMENT_TOOL:"snippyly-comment-tool",SNIPPYLY_COMMENTS:"snippyly-comments",SNIPPYLY_TAG_TOOL:"snippyly-tag-tool",SNIPPYLY_TAGS:"snippyly-tags",SNIPPYLY_RECORDER_NOTES:"snippyly-recorder-notes",SNIPPYLY_RECORDER_CONTROL_PANEL:"snippyly-recorder-control-panel",SNIPPYLY_RECORDER_CONTROL_PANEL_INTERNAL:"snippyly-recorder-control-panel-internal",SNIPPYLY_RECORDER_PLAYER:"snippyly-recorder-player",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",SNIPPYLY_COMMENT_TEXT_PORTAL:"snippyly-comment-text-portal",SNIPPYLY_COMMENT_TEXT:"snippyly-comment-text",SNIPPYLY_COMMENTS_SIDEBAR:"snippyly-comments-sidebar",SNIPPYLY_COMMENT_BUBBLE:"snippyly-comment-bubble",SNIPPYLY_HIGHLIGHT_USER_TEXT:"snippyly-highlight-user-text",SNIPPYLY_AUDIO_HUDDLE:"snippyly-audio-huddle",SNIPPYLY_VIDEO_HUDDLE:"snippyly-video-huddle",SNIPPYLY_HUDDLE:"snippyly-huddle",SNIPPYLY_HUDDLE_TOOL:"snippyly-huddle-tool",SNIPPYLY_RECORDER_TOOL:"snippyly-recorder-tool",SNIPPYLY_PLUGIN:"snippyly-plugin",SNIPPYLY_MENU:"snippyly-menu",SNIPPYLY_COMMENT_DIALOG:"snippyly-comment-dialog",SNIPPYLY_SIDEBAR_BUTTON:"snippyly-sidebar-button",SNIPPYLY_REWRITER:"snippyly-rewriter",SNIPPYLY_USER_INVITE_TOOL:"snippyly-user-invite-tool",SNIPPYLY_USER_REQUEST_TOOL:"snippyly-user-request-tool",SNIPPYLY_USER_AVATAR:"snippyly-user-avatar",SNIPPYLY_ARROW_TOOL:"snippyly-arrow-tool",SNIPPYLY_ARROWS:"snippyly-arrows",SNIPPYLY_AREA_TOOL:"snippyly-area-tool",SNIPPYLY_AREAS:"snippyly-areas",VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",VELT_TAG_TOOL:"velt-tag-tool",VELT_TAGS:"velt-tags",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_RECORDER_CONTROL_PANEL_EMBED:"velt-recorder-control-panel-embed",SNIPPYLY_RECORDER_CONTROL_PANEL_EMBED:"snippyly-recorder-control-panel-embed",VELT_RECORDER_PLAYER:"velt-recorder-player",VELT_RECORDER_PLAYER_EMBED:"velt-recorder-player-embed",SNIPPYLY_RECORDER_PLAYER_EMBED:"snippyly-recorder-player-embed",VELT_VIDEO_EDITOR:"velt-video-editor",VELT_TEXT_HIGHLIGHT:"velt-text-highlight",VELT_COMMENT_TEXT_PORTAL:"velt-comment-text-portal",VELT_COMMENTS_SIDEBAR:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_COMMENT_SIDEBAR_SKELETON_V2:"velt-comment-sidebar-skeleton-v2",VELT_COMMENT_SIDEBAR_PANEL_V2:"velt-comment-sidebar-panel-v2",VELT_COMMENT_SIDEBAR_LIST_V2:"velt-comment-sidebar-list-v2",VELT_COMMENT_SIDEBAR_LIST_ITEM_V2:"velt-comment-sidebar-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_V2:"velt-comment-sidebar-filter-dropdown-content-list-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-content-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_INDICATOR_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-indicator-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_COUNT_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-count-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_V2:"velt-comment-sidebar-filter-dropdown-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_TRIGGER_V2:"velt-comment-sidebar-filter-dropdown-trigger-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2:"velt-comment-sidebar-filter-button-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2_APPLIED_ICON:"velt-comment-sidebar-filter-button-v2-applied-icon",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2:"velt-comment-sidebar-filter-container-v2",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION:"velt-comment-sidebar-filter-container-v2-section",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_FIELD:"velt-comment-sidebar-filter-container-v2-section-field",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LIST:"velt-comment-sidebar-filter-container-v2-section-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LABEL:"velt-comment-sidebar-filter-container-v2-section-label",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL:"velt-comment-sidebar-filter-container-v2-section-control",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_LIST:"velt-comment-sidebar-filter-container-v2-section-option-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION:"velt-comment-sidebar-filter-container-v2-section-option",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_CHECKBOX:"velt-comment-sidebar-filter-container-v2-section-option-checkbox",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_VALUE:"velt-comment-sidebar-filter-container-v2-section-control-value",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP:"velt-comment-sidebar-filter-container-v2-section-control-chip",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP_LIST:"velt-comment-sidebar-filter-container-v2-section-control-chip-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_SEARCH:"velt-comment-sidebar-filter-container-v2-section-control-search",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHEVRON:"velt-comment-sidebar-filter-container-v2-section-control-chevron",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_NAME:"velt-comment-sidebar-filter-container-v2-section-option-name",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_COUNT:"velt-comment-sidebar-filter-container-v2-section-option-count",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_TITLE:"velt-comment-sidebar-filter-container-v2-title",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_CLOSE_BUTTON:"velt-comment-sidebar-filter-container-v2-close-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_GROUP_BY:"velt-comment-sidebar-filter-container-v2-group-by",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_RESET_BUTTON:"velt-comment-sidebar-filter-container-v2-reset-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_APPLY_BUTTON:"velt-comment-sidebar-filter-container-v2-apply-button",VELT_COMMENT_SIDEBAR_SEARCH_V2:"velt-comment-sidebar-search-v2",VELT_COMMENT_SIDEBAR_SEARCH_V2_ICON:"velt-comment-sidebar-search-v2-icon",VELT_COMMENT_SIDEBAR_SEARCH_V2_INPUT:"velt-comment-sidebar-search-v2-input",VELT_COMMENT_SIDEBAR_FULLSCREEN_BUTTON_V2:"velt-comment-sidebar-fullscreen-button-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2:"velt-comment-sidebar-list-group-header-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_LABEL:"velt-comment-sidebar-list-group-header-v2-label",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_COUNT:"velt-comment-sidebar-list-group-header-v2-count",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_SEPARATOR:"velt-comment-sidebar-list-group-header-v2-separator",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_CHEVRON:"velt-comment-sidebar-list-group-header-v2-chevron",VELT_COMMENT_SIDEBAR_HEADER_V2:"velt-comment-sidebar-header-v2",VELT_COMMENT_SIDEBAR_CLOSE_BUTTON_V2:"velt-comment-sidebar-close-button-v2",VELT_COMMENT_SIDEBAR_EMPTY_PLACEHOLDER_V2:"velt-comment-sidebar-empty-placeholder-v2",VELT_COMMENT_SIDEBAR_RESET_FILTER_BUTTON_V2:"velt-comment-sidebar-reset-filter-button-v2",VELT_COMMENT_SIDEBAR_PAGE_MODE_COMPOSER_V2:"velt-comment-sidebar-page-mode-composer-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_V2:"velt-comment-sidebar-focused-thread-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_BACK_BUTTON_V2:"velt-comment-sidebar-focused-thread-back-button-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_DIALOG_CONTAINER_V2:"velt-comment-sidebar-focused-thread-dialog-container-v2",VELT_COMMENT_BUBBLE:"velt-comment-bubble",VELT_COMMENT_BUBBLE_AVATAR:"velt-comment-bubble-avatar",VELT_COMMENT_BUBBLE_COMMENTS_COUNT:"velt-comment-bubble-comments-count",VELT_COMMENT_BUBBLE_UNREAD_ICON:"velt-comment-bubble-unread-icon",VELT_COMMENT_THREAD:"velt-comment-thread",VELT_COMMENT_PIN:"velt-comment-pin",VELT_COMMENT_PIN_EMBED:"velt-comment-pin-embed",SNIPPYLY_COMMENT_PIN_EMBED:"snippyly-comment-pin-embed",VELT_COMMENT_PIN_NUMBER:"velt-comment-pin-number",VELT_COMMENT_PIN_INDEX:"velt-comment-pin-index",VELT_COMMENT_PIN_TRIANGLE:"velt-comment-pin-triangle",VELT_COMMENT_PIN_PRIVATE_COMMENT_INDICATOR:"velt-comment-pin-private-comment-indicator",VELT_COMMENT_PIN_GHOST_COMMENT_INDICATOR:"velt-comment-pin-ghost-comment-indicator",VELT_COMMENT_PIN_UNREAD_COMMENT_INDICATOR:"velt-comment-pin-unread-comment-indicator",VELT_SIDEBAR_BUTTON_ICON:"velt-sidebar-button-icon",VELT_SIDEBAR_BUTTON_COMMENTS_COUNT:"velt-sidebar-button-comments-count",VELT_SIDEBAR_BUTTON_UNREAD_ICON:"velt-sidebar-button-unread-icon",VELT_COMMENT_TEXT:"velt-comment-text",VELT_CHART_COMMENT:"velt-chart-comment",VELT_CANVAS_COMMENT:"velt-canvas-comment",VELT_INLINE_COMMENTS_SECTION:"velt-inline-comments-section",VELT_INLINE_COMMENTS_SECTION_SKELETON:"velt-inline-comments-section-skeleton",VELT_INLINE_COMMENTS_SECTION_PANEL:"velt-inline-comments-section-panel",VELT_INLINE_COMMENTS_SECTION_LIST:"velt-inline-comments-section-list",VELT_INLINE_COMMENTS_SECTION_COMPOSER_CONTAINER:"velt-inline-comments-section-composer-container",VELT_INLINE_COMMENTS_SECTION_COMMENT_COUNT:"velt-inline-comments-section-comment-count",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN:"velt-inline-comments-section-sorting-dropdown",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER:"velt-inline-comments-section-sorting-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-sorting-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_ICON:"velt-inline-comments-section-sorting-dropdown-trigger-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT:"velt-inline-comments-section-sorting-dropdown-content",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM:"velt-inline-comments-section-sorting-dropdown-content-item",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_ICON:"velt-inline-comments-section-sorting-dropdown-content-item-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_TICK:"velt-inline-comments-section-sorting-dropdown-content-item-tick",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_NAME:"velt-inline-comments-section-sorting-dropdown-content-item-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN:"velt-inline-comments-section-filter-dropdown",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER:"velt-inline-comments-section-filter-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-filter-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_ARROW:"velt-inline-comments-section-filter-dropdown-trigger-arrow",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT:"velt-inline-comments-section-filter-dropdown-content",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST:"velt-inline-comments-section-filter-dropdown-content-list",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM:"velt-inline-comments-section-filter-dropdown-content-list-item",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_CHECKBOX:"velt-inline-comments-section-filter-dropdown-content-list-item-checkbox",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL:"velt-inline-comments-section-filter-dropdown-content-list-item-label",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_APPLY_BUTTON:"velt-inline-comments-section-filter-dropdown-content-apply-button",VELT_COMMENTS_MINIMAP:"velt-comments-minimap",VELT_HIGHLIGHT_USER_TEXT:"velt-highlight-user-text",VELT_AUDIO_HUDDLE:"velt-audio-huddle",VELT_VIDEO_HUDDLE:"velt-video-huddle",VELT_HUDDLE:"velt-huddle",VELT_HUDDLE_TOOL:"velt-huddle-tool",VELT_RECORDER_TOOL:"velt-recorder-tool",SUPERFLOW_TOOLBAR:"superflow-toolbar",VELT_MENU:"velt-menu",VELT_COMMENT_DIALOG:"velt-comment-dialog-internal",VELT_SIDEBAR_BUTTON:"velt-sidebar-button",VELT_COMMENTS_SIDEBAR_BUTTON:"velt-comments-sidebar-button",VELT_REWRITER:"velt-rewriter",VELT_USER_INVITE_TOOL:"velt-user-invite-tool",VELT_USER_REQUEST_TOOL:"velt-user-request-tool",VELT_USER_AVATAR:"velt-user-avatar",VELT_ARROW_TOOL:"velt-arrow-tool",VELT_ARROWS:"velt-arrows",VELT_AREA_TOOL:"velt-area-tool",VELT_AREAS:"velt-areas",VELT_INLINE_COMMENT:"velt-inline-comment",VELT_VIDEO_PLAYER:"velt-video-player",VELT_VIDEO_COMMENTS_TIMELINE:"velt-comment-player-timeline",VELT_REACTION_TOOL:"velt-reaction-tool",SNIPPYLY_REACTION_TOOL:"snippyly-reaction-tool",VELT_REACTION_PIN:"velt-reaction-pin",SNIPPYLY_REACTION_PIN:"snippyly-reaction-pin",VELT_INLINE_REACTIONS_SECTION:"velt-inline-reactions-section",SNIPPYLY_INLINE_REACTIONS_SECTION:"snippyly-inline-reactions-section",VELT_VIEW_ANALYTICS:"velt-view-analytics",VELT_NOTIFICATIONS_TOOL:"velt-notifications-tool",VELT_NOTIFICATIONS_TOOL_ICON:"velt-notifications-tool-icon",VELT_NOTIFICATIONS_TOOL_UNREAD_ICON:"velt-notifications-tool-unread-icon",VELT_NOTIFICATIONS_TOOL_LABEL:"velt-notifications-tool-label",VELT_NOTIFICATIONS_TOOL_UNREAD_COUNT:"velt-notifications-tool-unread-count",VELT_NOTIFICATIONS_PANEL:"velt-notifications-panel",VELT_NOTIFICATIONS_PANEL_TITLE:"velt-notifications-panel-title",VELT_NOTIFICATIONS_PANEL_TITLE_TEXT:"velt-notifications-panel-title-text",VELT_NOTIFICATIONS_PANEL_HEADER:"velt-notifications-panel-header",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_FOR_YOU:"velt-notifications-panel-header-tab-for-you",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_PEOPLE:"velt-notifications-panel-header-tab-people",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_DOCUMENTS:"velt-notifications-panel-header-tab-documents",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_ALL:"velt-notifications-panel-header-tab-all",VELT_NOTIFICATIONS_PANEL_CONTENT:"velt-notifications-panel-content",VELT_NOTIFICATIONS_PANEL_CONTENT_FOR_YOU:"velt-notifications-panel-content-for-you",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL:"velt-notifications-panel-content-all",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE:"velt-notifications-panel-content-people",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS:"velt-notifications-panel-content-documents",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST:"velt-notifications-panel-content-list",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM:"velt-notifications-panel-content-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_AVATAR:"velt-notifications-panel-content-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_UNREAD:"velt-notifications-panel-content-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_HEADLINE:"velt-notifications-panel-content-list-item-headline",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_BODY:"velt-notifications-panel-content-list-item-body",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_FILE_NAME:"velt-notifications-panel-content-list-item-file-name",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_TIME:"velt-notifications-panel-content-list-item-time",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST:"velt-notifications-panel-content-all-list",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM:"velt-notifications-panel-content-all-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_LABEL:"velt-notifications-panel-content-all-list-item-label",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_CONTENT:"velt-notifications-panel-content-all-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST:"velt-notifications-panel-content-people-list",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM:"velt-notifications-panel-content-people-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_AVATAR:"velt-notifications-panel-content-people-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_NAME:"velt-notifications-panel-content-people-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_COUNT:"velt-notifications-panel-content-people-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_CONTENT:"velt-notifications-panel-content-people-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST:"velt-notifications-panel-content-documents-list",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM:"velt-notifications-panel-content-documents-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_NAME:"velt-notifications-panel-content-documents-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_COUNT:"velt-notifications-panel-content-documents-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_CONTENT:"velt-notifications-panel-content-documents-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_UNREAD:"velt-notifications-panel-content-documents-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LOAD_MORE:"velt-notifications-panel-content-load-more",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_READ_CONTAINER:"velt-notifications-panel-content-all-read-container",VELT_NOTIFICATIONS_PANEL_CLOSE_BUTTON:"velt-notifications-panel-close-button",VELT_NOTIFICATIONS_PANEL_READ_ALL_BUTTON:"velt-notifications-panel-read-all-button",VELT_NOTIFICATIONS_PANEL_VIEW_ALL_BUTTON:"velt-notifications-panel-view-all-button",VELT_NOTIFICATIONS_PANEL_SKELETON:"velt-notifications-panel-skeleton",VELT_NOTIFICATIONS_PANEL_SETTINGS_BUTTON:"velt-notifications-panel-settings-button",VELT_NOTIFICATIONS_PANEL_SETTINGS:"velt-notifications-panel-settings",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER:"velt-notifications-panel-settings-header",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER_TITLE:"velt-notifications-panel-settings-header-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_TITLE:"velt-notifications-panel-settings-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_DESCRIPTION:"velt-notifications-panel-settings-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_LIST:"velt-notifications-panel-settings-list",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TITLE:"velt-notifications-panel-settings-mute-all-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_DESCRIPTION:"velt-notifications-panel-settings-mute-all-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TOGGLE:"velt-notifications-panel-settings-mute-all-toggle",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION:"velt-notifications-panel-settings-accordion",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER:"velt-notifications-panel-settings-accordion-trigger",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_LABEL:"velt-notifications-panel-settings-accordion-trigger-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_ICON:"velt-notifications-panel-settings-accordion-trigger-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_SELECTED_VALUE:"velt-notifications-panel-settings-accordion-trigger-selected-value",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT:"velt-notifications-panel-settings-accordion-content",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM:"velt-notifications-panel-settings-accordion-content-item",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_LABEL:"velt-notifications-panel-settings-accordion-content-item-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_ICON:"velt-notifications-panel-settings-accordion-content-item-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_BACK_BUTTON:"velt-notifications-panel-settings-back-button",VELT_NOTIFICATIONS_PANEL_SETTINGS_FOOTER:"velt-notifications-panel-settings-footer",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel",VELT_WIREFRAME:"velt-wireframe",VELT_AUTOCOMPLETE:"velt-autocomplete",VELT_AUTOCOMPLETE_PANEL:"velt-autocomplete-panel",VELT_AUTOCOMPLETE_OPTION:"velt-autocomplete-option",VELT_AUTOCOMPLETE_OPTION_ICON:"velt-autocomplete-option-icon",VELT_AUTOCOMPLETE_OPTION_NAME:"velt-autocomplete-option-name",VELT_AUTOCOMPLETE_OPTION_DESCRIPTION:"velt-autocomplete-option-description",VELT_AUTOCOMPLETE_OPTION_ERROR_ICON:"velt-autocomplete-option-error-icon",VELT_AUTOCOMPLETE_GROUP_OPTION:"velt-autocomplete-group-option",VELT_AUTOCOMPLETE_TOOL:"velt-autocomplete-tool",VELT_AUTOCOMPLETE_EMPTY:"velt-autocomplete-empty",VELT_AUTOCOMPLETE_CHIP:"velt-autocomplete-chip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP:"velt-autocomplete-chip-tooltip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_ICON:"velt-autocomplete-chip-tooltip-icon",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_NAME:"velt-autocomplete-chip-tooltip-name",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_DESCRIPTION:"velt-autocomplete-chip-tooltip-description",VELT_AUTOCOMPLETE_CONTEXT_WRAPPER:"velt-autocomplete-context-wrapper",VELT_ACTIVITY_LOG:"velt-activity-log",VELT_ACTIVITY_LOG_HEADER:"velt-activity-log-header",VELT_ACTIVITY_LOG_HEADER_TITLE:"velt-activity-log-header-title",VELT_ACTIVITY_LOG_HEADER_CLOSE_BUTTON:"velt-activity-log-header-close-button",VELT_ACTIVITY_LOG_HEADER_FILTER:"velt-activity-log-header-filter",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER:"velt-activity-log-header-filter-trigger",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_LABEL:"velt-activity-log-header-filter-trigger-label",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_ICON:"velt-activity-log-header-filter-trigger-icon",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT:"velt-activity-log-header-filter-content",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM:"velt-activity-log-header-filter-content-item",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_LABEL:"velt-activity-log-header-filter-content-item-label",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_ICON:"velt-activity-log-header-filter-content-item-icon",VELT_ACTIVITY_LOG_LOADING:"velt-activity-log-loading",VELT_ACTIVITY_LOG_LIST:"velt-activity-log-list",VELT_ACTIVITY_LOG_LIST_DATE_GROUP:"velt-activity-log-list-date-group",VELT_ACTIVITY_LOG_LIST_DATE_GROUP_LABEL:"velt-activity-log-list-date-group-label",VELT_ACTIVITY_LOG_LIST_ITEM:"velt-activity-log-list-item",VELT_ACTIVITY_LOG_LIST_ITEM_ICON:"velt-activity-log-list-item-icon",VELT_ACTIVITY_LOG_LIST_ITEM_AVATAR:"velt-activity-log-list-item-avatar",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT:"velt-activity-log-list-item-content",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_USER:"velt-activity-log-list-item-content-user",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_ACTION:"velt-activity-log-list-item-content-action",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_TARGET:"velt-activity-log-list-item-content-target",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_DETAIL:"velt-activity-log-list-item-content-detail",VELT_ACTIVITY_LOG_LIST_ITEM_TIME:"velt-activity-log-list-item-time",VELT_ACTIVITY_LOG_LIST_SHOW_MORE:"velt-activity-log-list-show-more",VELT_ACTIVITY_LOG_EMPTY:"velt-activity-log-empty",VELT_ACTIVITY_LOG_CONTEXT_WRAPPER:"velt-activity-log-context-wrapper",VELT_COMMENT_DIALOG_VISIBILITY_BANNER:"velt-comment-dialog-visibility-banner",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_ICON:"velt-comment-dialog-visibility-banner-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_TEXT:"velt-comment-dialog-visibility-banner-text",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN:"velt-comment-dialog-visibility-banner-dropdown",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER:"velt-comment-dialog-visibility-banner-dropdown-trigger",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_LABEL:"velt-comment-dialog-visibility-banner-dropdown-trigger-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_ITEM:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_REMAINING_COUNT:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-remaining-count",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_ICON:"velt-comment-dialog-visibility-banner-dropdown-trigger-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT:"velt-comment-dialog-visibility-banner-dropdown-content",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM:"velt-comment-dialog-visibility-banner-dropdown-content-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_ICON:"velt-comment-dialog-visibility-banner-dropdown-content-item-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_LABEL:"velt-comment-dialog-visibility-banner-dropdown-content-item-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_USER_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-user-picker",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ORG_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-org-picker",VELT_COMMENT_COMPOSER:"velt-comment-composer",VELT_SKELETON_LOADER:"velt-skeleton-loader",VELT_SHADOW_DOM_INTERNAL:"velt-shadow-dom-internal",VELT_SINGLE_EDITOR_MODE_PANEL:"velt-single-editor-mode-panel",VELT_MULTI_THREAD_COMMENT_DIALOG:"velt-multi-thread-comment-dialog",VELT_MULTI_THREAD_COMMENT_DIALOG_LIST:"velt-multi-thread-comment-dialog-list",VELT_MULTI_THREAD_COMMENT_DIALOG_PANEL:"velt-multi-thread-comment-dialog-panel",VELT_MULTI_THREAD_COMMENT_DIALOG_COMPOSER_CONTAINER:"velt-multi-thread-comment-dialog-composer-container",VELT_MULTI_THREAD_COMMENT_DIALOG_COMMENT_COUNT:"velt-multi-thread-comment-dialog-comment-count",VELT_MULTI_THREAD_COMMENT_DIALOG_EMPTY_PLACEHOLDER:"velt-multi-thread-comment-dialog-empty-placeholder",VELT_MULTI_THREAD_COMMENT_DIALOG_CLOSE_BUTTON:"velt-multi-thread-comment-dialog-close-button",VELT_MULTI_THREAD_COMMENT_DIALOG_NEW_THREAD_BUTTON:"velt-multi-thread-comment-dialog-new-thread-button",VELT_MULTI_THREAD_COMMENT_DIALOG_RESET_FILTER_BUTTON:"velt-multi-thread-comment-dialog-reset-filter-button",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-filter-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_ALL:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-all",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_READ:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_RESOLVED:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-resolved",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SELECTED_ICON:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-selected-icon",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_DATE:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-date",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-actions-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_READ:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_RESOLVED:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-resolved",VELT_TEXT_COMMENT:"velt-text-comment",VELT_TEXT_COMMENT_TOOL:"velt-text-comment-tool",VELT_TEXT_COMMENT_TOOLBAR:"velt-text-comment-toolbar",VELT_TEXT_COMMENT_TOOLBAR_COMMENT_ANNOTATION:"velt-text-comment-toolbar-comment-annotation",VELT_TEXT_COMMENT_TOOLBAR_DIVIDER:"velt-text-comment-toolbar-divider",VELT_TEXT_COMMENT_TOOLBAR_COPYWRITER:"velt-text-comment-toolbar-copywriter",VELT_TEXT_COMMENT_TOOLBAR_GENERIC:"velt-text-comment-toolbar-generic"},q.ATTRIBUTES={VELT_COMMENT_CONTAINER:"data-velt-comment-container",VELT_TARGET_COMMENT_ELEMENT_ID:"data-velt-target-comment-element-id",VELT_COMMENT_TYPE:"data-velt-comment-type",TARGET_INLINE_COMMENT_ELEMENT_ID:"target-inline-comment-element-id",TARGET_COMMENT_ELEMENT_ID:"target-comment-element-id",TARGET_ELEMENT_ID:"target-element-id",VELT_ID:"data-velt-id",VELT_ELEMENT:"data-velt-element",VELT_SCREEN_RECORDER_PANEL:"data-velt-screen-recorder-panel",VELT_SOURCE_ID:"data-velt-source-id",VELT_ANNOTATION_ID:"data-velt-annotation-id",VELT_ANNOTATION_IDS:"data-velt-annotation-ids",VELT_COMMENT_PIN_HOST:"data-velt-comment-pin-host",VELT_COMMENT_PIN_HOST_STATIC:"data-velt-comment-pin-host-static",VELT_COMMENT_DISABLED:"data-velt-comment-disabled",VELT_MANUAL_COMMENT_CONTAINER:"data-velt-manual-comment-container",VELT_COMMENT_PIN_ACTIVE:"data-velt-comment-pin-active",VELT_INLINE_COMMENT_SECTION_CONFIG:"data-velt-inline-comment-section-config",VELT_TARGET_INLINE_COMMENT_ELEMENT_ID:"data-velt-target-inline-comment-element-id",VELT_TAG_PIN_HOST:"data-velt-tag-pin-host",VELT_TAG_PIN_HOST_STATIC:"data-velt-tag-pin-host-static",VELT_TAG_DISABLED:"data-velt-tag-disabled",VELT_RECORDER_PIN_HOST:"data-velt-recorder-pin-host",VELT_RECORDER_PIN_HOST_STATIC:"data-velt-recorder-pin-host-static",VELT_RECORDER_DISABLED:"data-velt-recorder-disabled",VELT_ANNOTATION_DRAFT:"data-velt-annotation-draft",VELT_ANNOTATION_EDIT_COMMENT:"data-velt-annotation-edit-comment",VELT_DOCUMENT_ID:"data-velt-document-id",VELT_LOCATION:"data-velt-location",VELT_LOCATION_ID:"data-velt-location-id",VELT_THEME:"data-velt-theme",VELT_IGNORE:"data-velt-ignore",EMBED_MODE:"embed-mode",DEFAULT_CURSOR:"default-cursor",VELT_HUDDLE_ON_CURSOR_MODE:"data-velt-huddle-on-cursor-mode",VELT_SELECTION_ENABLED:"data-live-selection-enabled",VELT_LIVE_SELECTION_ENABLED:"data-velt-live-selection-enabled",VELT_LIVE_SELECTION_USER_INDICATOR_POSITION:"data-velt-live-selection-user-indicator-position",VELT_LIVE_SELECTION_USER_INDICATOR_TYPE:"data-velt-live-selection-user-indicator-type",VELT_SELECTION_CONFIG:"data-live-selection-config",VELT_POPOVER_MODE:"data-velt-popover-mode",VELT_ELEMENT_CACHE_ID:"data-velt-cache-id",VELT_ARROW_PIN_HOST:"data-velt-arrow-pin-host",VELT_ARROW_PIN_HOST_STATIC:"data-velt-arrow-pin-host-static",VELT_ARROW_DISABLED:"data-velt-arrow-disabled",VELT_AREA_PIN_HOST:"data-velt-area-pin-host",VELT_AREA_PIN_HOST_STATIC:"data-velt-area-pin-host-static",VELT_AREA_DISABLED:"data-velt-area-disabled",VELT_AREA_PIN_ACTIVE:"data-velt-area-pin-active",VELT_SUGGESTION_TARGET:"data-velt-suggestion-target",VELT_ONGOING_RECORDING:"data-velt-ongoing-recording",VELT_COMMENT_RECORDING:"data-velt-comment-recording",SYNC_VIDEO_PLAYER_ID:"data-sync-video-player-id",SYNC_VIDEO_PLAYER:"data-sync-video-player",VELT_INLINE_COMMENT_ID:"inline-comment-id",VELT_PDF_VIEWER:"data-velt-pdf-viewer",VELT_SYNC_STATE:"data-velt-sync-state",VELT_SYNC_ACCESS:"data-velt-sync-access",VELT_SYNC_ACCESS_AUTO:"data-velt-sync-access-auto",VELT_SYNC_ACCESS_DISABLED:"data-velt-sync-access-disabled",VELT_SINGLE_EDITOR_MODE_CONTAINER:"data-velt-single-editor-mode-container",VELT_IFRAME_CONTAINER:"data-velt-iframe-container",VELT_IFRAME_CONTAINER_STATIC:"data-velt-iframe-container-static",VELT_IS_FIRST_COMPONENT:"data-velt-is-first-component",VELT_DOWNLOAD_BUTTON:"velt-download-button",VELT_COMMENT_DIALOG_PORTAL_INTERNAL:"velt-comment-dialog-portal-internal",ANNOTATION_ID:"annotation-id",MULTI_THREAD_ANNOTATION_ID:"multi-thread-annotation-id",SLATE_EDITOR:"data-slate-editor"},q.INJECTION_STYLE_PROPS={VELT_AVATAR_COLOR:"data-velt-avatar-color",VELT_COMMENT_PRIORITY_COLOR:"data-velt-priority-color"},q.BODY_CLASSES={VELT_PIN_DRAGGING:"velt-pin-dragging"},q.INJECTION_ATTRIBUTES={VELT_AVATAR_IMG:"data-velt-avatar-img",VELT_COMMENT_LENGTH:"data-velt-comment-thread-length"},q.SESSION_STORAGE={SNIPPYLY_AUTO_SELECT_ANNOTATION_ID:"snippylyAutoSelectAnnotationId",SNIPPYLY_SELECTED_ANNOTATION_ID:"snippylySelectedAnnotationId",SNIPPYLY_COMMENT_SIDEBAR_FILTERS:"snippylyCommentSidebarFilters",SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY:"snippylyCommentSidebarGroupBy",SNIPPYLY_COMMENT_DIALOG_AUTO_POPULATE_TEXT:"snippylyCommentDialogAutoPopulateText",SNIPPYLY_HUDDLE_DATA:"snippylyHuddleData",VELT_TAB_ID:"veltTabId",VELT_COMMENT_SIDEBAR_FILTERS_RESET:"veltCommentSidebarFiltersReset",VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE:"veltCommentSidebarCustomActionsState",VELT_CURSOR_MULTIPLE_USERS_DETECTED:"veltCursorMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_DETECTED:"veltPresenceMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_ONLINE:"veltPresenceMultipleUsersOnline",VELT_CUSTOM_PRIORITY_MAP:"veltCustomPriorityMap",VELT_CUSTOM_STATUS_MAP:"veltCustomStatusMap",VELT_CUSTOM_CATEGORY_MAP:"veltCustomCategoryMap"},q.LOCAL_STORAGE={SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS:"snippylyDefaultMediaSourceOptions",SNIPPYLY_QUEUED_COMMENT:"snippylyQueuedComment",VELT_USER:"_vu",VELT_IDENTIFY_USER:"_viu",VELT_USER_FORCE_RE_LOGGED_IN:"_vurli",VELT_VERSION:"_vv",VELT_ADVANCED_QUERIES:"_vadq",VELT_COMMENT_VIEWS_MIGRATED:"_vcvm",VELT_AUTH_PROXY_HOST:"_vaph"},q.NON_NESTABLE_ELEMENTS={img:!0,video:!0,audio:!0,input:!0,meter:!0,progress:!0,select:!0,textarea:!0,svg:!0,"lottie-player":!0,"ng-lottie":!0,canvas:!0,hr:!0,iframe:!0},q.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS={svg:!0},q.SELECTION_ENABLED_ELEMENTS={input:!0,textarea:!0,select:!0,button:!0},q.URL_PARAMS={REVIEW_MODE:"review",REVIEW_DOC_ID:"sreviewId",SNIPPYLY_USER:"snippyly-user",COMMENT_ID:"scommentId",TAG_ID:"stagId",RECORDER_ID:"srecorderId",PROJECT_INSTALL:"sprojectInstall"},q.VELT_BASE_REM_UNIT="--velt-base-rem-unit",q.VELT_VIEWPORT_WIDTH="--legacy-velt-viewport-width",q.VELT_VIEWPORT_HEIGHT="--legacy-velt-viewport-height",q.VELT_SELECTION_COLOR="--velt-selection-color",q.VELT_MIN_ARROW_LENGTH=100,q.VELT_ARROW_VIEWPORT_PADDING=20,q.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME=5,q.CURSOR={COMMENT_PIN:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==') 0 31, auto",TAG_PIN:"url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==') 16 16, auto",ARROW_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0, auto",AREA_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 16 0, auto"},q.VIDEO_POSTER_DEFAULT_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURQAAAAEAAKSl0/gAAAAxSURBVFjD7dBBDQAgCABARjKjGZUofi0Ac+4uwkUAAAAAAMCIpYD/bQVNSsEtFfCaA8vLAaMbkVUtAAAAAElFTkSuQmCC",q.HUDDLE_TYPE_CONFIGS={audio:{audio:!0,video:!1,presentation:!1},video:{audio:!0,video:!0,presentation:!1},presentation:{audio:!1,video:!1,presentation:!0}},q.RecorderModes={VIDEO:"video",AUDIO:"audio",SCREEN:"screen",ALL:"all"},q.CommentAnnotationStatusMap={OPEN:{id:"OPEN",name:"Open",color:"var(--velt-accent, #625DF5)",lightColor:"var(--velt-accent-light, #E7E8FA)",type:"default",svg:`
|
|
5
|
+
`).forEach(r=>{let t=r.indexOf(":");if(t>0){let i=r.slice(0,t),o=r.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((r,t)=>{this.addHeaderEntry(t,r)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([r,t])=>{this.setHeaderEntries(r,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let r=this.headers.get(e.toLowerCase());return r&&r.length>0?r[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,r){return this.clone({name:e,value:r,op:"a"})}set(e,r){return this.clone({name:e,value:r,op:"s"})}delete(e,r){return this.clone({name:e,value:r,op:"d"})}maybeSetNormalizedName(e,r){this.normalizedNames.has(r)||this.normalizedNames.set(r,e)}init(){this.lazyInit&&(this.lazyInit instanceof n?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(e=>this.applyUpdate(e)),this.lazyUpdate=null))}copyFrom(e){e.init(),Array.from(e.headers.keys()).forEach(r=>{this.headers.set(r,e.headers.get(r)),this.normalizedNames.set(r,e.normalizedNames.get(r))})}clone(e){let r=new n;return r.lazyInit=this.lazyInit&&this.lazyInit instanceof n?this.lazyInit:this,r.lazyUpdate=(this.lazyUpdate||[]).concat([e]),r}applyUpdate(e){let r=e.name.toLowerCase();switch(e.op){case"a":case"s":let t=e.value;if(typeof t=="string"&&(t=[t]),t.length===0)return;this.maybeSetNormalizedName(e.name,r);let i=(e.op==="a"?this.headers.get(r):void 0)||[];i.push(...t),this.headers.set(r,i);break;case"d":let o=e.value;if(!o)this.headers.delete(r),this.normalizedNames.delete(r);else{let s=this.headers.get(r);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(r),this.normalizedNames.delete(r)):this.headers.set(r,s)}break}}addHeaderEntry(e,r){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(r):this.headers.set(t,[r])}setHeaderEntries(e,r){let t=(Array.isArray(r)?r:[r]).map(o=>o.toString()),i=e.toLowerCase();this.headers.set(i,t),this.maybeSetNormalizedName(e,i)}forEach(e){this.init(),Array.from(this.normalizedNames.keys()).forEach(r=>e(this.normalizedNames.get(r),this.headers.get(r)))}};var gT=class{encodeKey(e){return T1(e)}encodeValue(e){return T1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function WY(n,e){let r=new Map;return n.length>0&&n.replace(/^\?/,"").split("&").forEach(i=>{let o=i.indexOf("="),[s,a]=o==-1?[e.decodeKey(i),""]:[e.decodeKey(i.slice(0,o)),e.decodeValue(i.slice(o+1))],c=r.get(s)||[];c.push(a),r.set(s,c)}),r}var zY=/%(\d[a-f0-9])/gi,qY={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function T1(n){return encodeURIComponent(n).replace(zY,(e,r)=>qY[r]??e)}function fT(n){return`${n}`}var Es=class n{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new gT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=WY(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(r=>{let t=e.fromObject[r],i=Array.isArray(t)?t.map(fT):[fT(t)];this.map.set(r,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let r=this.map.get(e);return r?r[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,r){return this.clone({param:e,value:r,op:"a"})}appendAll(e){let r=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{r.push({param:t,value:o,op:"a"})}):r.push({param:t,value:i,op:"a"})}),this.clone(r)}set(e,r){return this.clone({param:e,value:r,op:"s"})}delete(e,r){return this.clone({param:e,value:r,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let r=this.encoder.encodeKey(e);return this.map.get(e).map(t=>r+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let r=new n({encoder:this.encoder});return r.cloneFrom=this.cloneFrom||this,r.updates=(this.updates||[]).concat(e),r}init(){this.map===null&&(this.map=new Map),this.cloneFrom!==null&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(e=>this.map.set(e,this.cloneFrom.map.get(e))),this.updates.forEach(e=>{switch(e.op){case"a":case"s":let r=(e.op==="a"?this.map.get(e.param):void 0)||[];r.push(fT(e.value)),this.map.set(e.param,r);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(fT(e.value));i!==-1&&t.splice(i,1),t.length>0?this.map.set(e.param,t):this.map.delete(e.param)}else{this.map.delete(e.param);break}}}),this.cloneFrom=this.updates=null)}};var mT=class{map=new Map;set(e,r){return this.map.set(e,r),this}get(e){return this.map.has(e)||this.map.set(e,e.defaultValue()),this.map.get(e)}delete(e){return this.map.delete(e),this}has(e){return this.map.has(e)}keys(){return this.map.keys()}};function KY(n){switch(n){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function I1(n){return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer}function v1(n){return typeof Blob<"u"&&n instanceof Blob}function y1(n){return typeof FormData<"u"&&n instanceof FormData}function YY(n){return typeof URLSearchParams<"u"&&n instanceof URLSearchParams}var S1="Content-Type",A1="Accept",R1="X-Request-URL",C1="text/plain",N1="application/json",QY=`${N1}, ${C1}, */*`,ud=class n{url;body=null;headers;context;reportProgress=!1;withCredentials=!1;credentials;keepalive=!1;cache;priority;mode;redirect;referrer;integrity;responseType="json";method;params;urlWithParams;transferCache;timeout;constructor(e,r,t,i){this.url=r,this.method=e.toUpperCase();let o;if(KY(this.method)||i?(this.body=t!==void 0?t:null,o=i):o=t,o){if(this.reportProgress=!!o.reportProgress,this.withCredentials=!!o.withCredentials,this.keepalive=!!o.keepalive,o.responseType&&(this.responseType=o.responseType),o.headers&&(this.headers=o.headers),o.context&&(this.context=o.context),o.params&&(this.params=o.params),o.priority&&(this.priority=o.priority),o.cache&&(this.cache=o.cache),o.credentials&&(this.credentials=o.credentials),typeof o.timeout=="number"){if(o.timeout<1||!Number.isInteger(o.timeout))throw new oe(2822,"");this.timeout=o.timeout}o.mode&&(this.mode=o.mode),o.redirect&&(this.redirect=o.redirect),o.integrity&&(this.integrity=o.integrity),o.referrer&&(this.referrer=o.referrer),this.transferCache=o.transferCache}if(this.headers??=new ua,this.context??=new mT,!this.params)this.params=new Es,this.urlWithParams=r;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=r;else{let a=r.indexOf("?"),c=a===-1?"?":a<r.length-1?"&":"";this.urlWithParams=r+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||I1(this.body)||v1(this.body)||y1(this.body)||YY(this.body)?this.body:this.body instanceof Es?this.body.toString():typeof this.body=="object"||typeof this.body=="boolean"||Array.isArray(this.body)?JSON.stringify(this.body):this.body.toString()}detectContentTypeHeader(){return this.body===null||y1(this.body)?null:v1(this.body)?this.body.type||null:I1(this.body)?null:typeof this.body=="string"?C1:this.body instanceof Es?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?N1:null}clone(e={}){let r=e.method||this.method,t=e.url||this.url,i=e.responseType||this.responseType,o=e.keepalive??this.keepalive,s=e.priority||this.priority,a=e.cache||this.cache,c=e.mode||this.mode,l=e.redirect||this.redirect,u=e.credentials||this.credentials,d=e.referrer||this.referrer,f=e.integrity||this.integrity,g=e.transferCache??this.transferCache,p=e.timeout??this.timeout,_=e.body!==void 0?e.body:this.body,T=e.withCredentials??this.withCredentials,D=e.reportProgress??this.reportProgress,b=e.headers||this.headers,G=e.params||this.params,M=e.context??this.context;return e.setHeaders!==void 0&&(b=Object.keys(e.setHeaders).reduce((U,k)=>U.set(k,e.setHeaders[k]),b)),e.setParams&&(G=Object.keys(e.setParams).reduce((U,k)=>U.set(k,e.setParams[k]),G)),new n(r,t,_,{params:G,headers:b,context:M,reportProgress:D,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},Zc=(function(n){return n[n.Sent=0]="Sent",n[n.UploadProgress=1]="UploadProgress",n[n.ResponseHeader=2]="ResponseHeader",n[n.DownloadProgress=3]="DownloadProgress",n[n.Response=4]="Response",n[n.User=5]="User",n})(Zc||{}),fd=class{headers;status;statusText;url;ok;type;redirected;constructor(e,r=200,t="OK"){this.headers=e.headers||new ua,this.status=e.status!==void 0?e.status:r,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},pT=class n extends fd{constructor(e={}){super(e)}type=Zc.ResponseHeader;clone(e={}){return new n({headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0})}},Eg=class n extends fd{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=Zc.Response;clone(e={}){return new n({body:e.body!==void 0?e.body:this.body,headers:e.headers||this.headers,status:e.status!==void 0?e.status:this.status,statusText:e.statusText||this.statusText,url:e.url||this.url||void 0,redirected:e.redirected??this.redirected})}},dd=class extends fd{name="HttpErrorResponse";message;error;ok=!1;constructor(e){super(e,0,"Unknown Error"),this.status>=200&&this.status<300?this.message=`Http failure during parsing for ${e.url||"(unknown url)"}`:this.message=`Http failure response for ${e.url||"(unknown url)"}: ${e.status} ${e.statusText}`,this.error=e.error||null}},XY=200,JY=204;function dC(n,e){return{body:e,headers:n.headers,context:n.context,observe:n.observe,params:n.params,reportProgress:n.reportProgress,responseType:n.responseType,withCredentials:n.withCredentials,credentials:n.credentials,transferCache:n.transferCache,timeout:n.timeout,keepalive:n.keepalive,priority:n.priority,cache:n.cache,mode:n.mode,redirect:n.redirect,integrity:n.integrity,referrer:n.referrer}}var O1=(()=>{class n{handler;constructor(r){this.handler=r}request(r,t,i={}){let o;if(r instanceof ud)o=r;else{let c;i.headers instanceof ua?c=i.headers:c=new ua(i.headers);let l;i.params&&(i.params instanceof Es?l=i.params:l=new Es({fromObject:i.params})),o=new ud(r,t,i.body!==void 0?i.body:null,{headers:c,context:i.context,params:l,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache,keepalive:i.keepalive,priority:i.priority,cache:i.cache,mode:i.mode,redirect:i.redirect,credentials:i.credentials,referrer:i.referrer,integrity:i.integrity,timeout:i.timeout})}let s=ue(o).pipe(yS(c=>this.handler.handle(c)));if(r instanceof ud||i.observe==="events")return s;let a=s.pipe(Ct(c=>c instanceof Eg));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof ArrayBuffer))throw new oe(2806,!1);return c.body}));case"blob":return a.pipe(fe(c=>{if(c.body!==null&&!(c.body instanceof Blob))throw new oe(2807,!1);return c.body}));case"text":return a.pipe(fe(c=>{if(c.body!==null&&typeof c.body!="string")throw new oe(2808,!1);return c.body}));default:return a.pipe(fe(c=>c.body))}case"response":return a;default:throw new oe(2809,!1)}}delete(r,t={}){return this.request("DELETE",r,t)}get(r,t={}){return this.request("GET",r,t)}head(r,t={}){return this.request("HEAD",r,t)}jsonp(r,t){return this.request("JSONP",r,{params:new Es().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(r,t={}){return this.request("OPTIONS",r,t)}patch(r,t,i={}){return this.request("PATCH",r,dC(i,t))}post(r,t,i={}){return this.request("POST",r,dC(i,t))}put(r,t,i={}){return this.request("PUT",r,dC(i,t))}static \u0275fac=function(t){return new(t||n)(w(hd))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var ZY=new Z("");function w1(n,e){return e(n)}function e7(n,e){return(r,t)=>e.intercept(r,{handle:i=>n(i,t)})}function t7(n,e,r){return(t,i)=>fo(r,()=>e(t,o=>n(o,i)))}var b1=new Z(""),fC=new Z(""),L1=new Z(""),gC=new Z("",{providedIn:"root",factory:()=>!0});function n7(){let n=null;return(e,r)=>{n===null&&(n=(ne(b1,{optional:!0})??[]).reduceRight(e7,w1));let t=ne(Io);if(ne(gC)){let o=t.add();return n(e,r).pipe(Sc(o))}else return n(e,r)}}var ET=(()=>{class n extends hd{backend;injector;chain=null;pendingTasks=ne(Io);contributeToStability=ne(gC);constructor(r,t){super(),this.backend=r,this.injector=t}handle(r){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(fC),...this.injector.get(L1,[])]));this.chain=t.reduceRight((i,o)=>t7(i,o,this.injector),w1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(r,i=>this.backend.handle(i)).pipe(Sc(t))}else return this.chain(r,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||n)(w(pg),w(Kn))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})();var r7=/^\)\]\}',?\n/,i7=RegExp(`^${R1}:`,"m");function o7(n){return"responseURL"in n&&n.responseURL?n.responseURL:i7.test(n.getAllResponseHeaders())?n.getResponseHeader(R1):null}var hC=(()=>{class n{xhrFactory;constructor(r){this.xhrFactory=r}handle(r){if(r.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return ue(null).pipe(mt(()=>new ge(o=>{let s=t.build();if(s.open(r.method,r.urlWithParams),r.withCredentials&&(s.withCredentials=!0),r.headers.forEach((T,D)=>s.setRequestHeader(T,D.join(","))),r.headers.has(A1)||s.setRequestHeader(A1,QY),!r.headers.has(S1)){let T=r.detectContentTypeHeader();T!==null&&s.setRequestHeader(S1,T)}if(r.timeout&&(s.timeout=r.timeout),r.responseType){let T=r.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=r.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",D=new ua(s.getAllResponseHeaders()),b=o7(s)||r.url;return c=new pT({headers:D,status:s.status,statusText:T,url:b}),c},u=()=>{let{headers:T,status:D,statusText:b,url:G}=l(),M=null;D!==JY&&(M=typeof s.response>"u"?s.responseText:s.response),D===0&&(D=M?XY:0);let U=D>=200&&D<300;if(r.responseType==="json"&&typeof M=="string"){let k=M;M=M.replace(r7,"");try{M=M!==""?JSON.parse(M):null}catch(S){M=k,U&&(U=!1,M={error:S,text:M})}}U?(o.next(new Eg({body:M,headers:T,status:D,statusText:b,url:G||void 0})),o.complete()):o.error(new dd({error:M,headers:T,status:D,statusText:b,url:G||void 0}))},d=T=>{let{url:D}=l(),b=new dd({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:D||void 0});o.error(b)},f=d;r.timeout&&(f=T=>{let{url:D}=l(),b=new dd({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:D||void 0});o.error(b)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let D={type:Zc.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),r.responseType==="text"&&s.responseText&&(D.partialText=s.responseText),o.next(D)},_=T=>{let D={type:Zc.UploadProgress,loaded:T.loaded};T.lengthComputable&&(D.total=T.total),o.next(D)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),r.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:Zc.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),r.reportProgress&&(s.removeEventListener("progress",p),a!==null&&s.upload&&s.upload.removeEventListener("progress",_)),s.readyState!==s.DONE&&s.abort()}})))}static \u0275fac=function(t){return new(t||n)(w(Jc))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),M1=new Z(""),s7="XSRF-TOKEN",a7=new Z("",{providedIn:"root",factory:()=>s7}),c7="X-XSRF-TOKEN",l7=new Z("",{providedIn:"root",factory:()=>c7}),_g=class{},u7=(()=>{class n{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(r,t){this.doc=r,this.cookieName=t}getToken(){let r=this.doc.cookie||"";return r!==this.lastCookieString&&(this.parseCount++,this.lastToken=dg(r,this.cookieName),this.lastCookieString=r),this.lastToken}static \u0275fac=function(t){return new(t||n)(w(Dn),w(a7))};static \u0275prov=K({token:n,factory:n.\u0275fac})}return n})(),d7=/^(?:https?:)?\/\//i;function h7(n,e){if(!ne(M1)||n.method==="GET"||n.method==="HEAD"||d7.test(n.url))return e(n);let r=ne(_g).getToken(),t=ne(l7);return r!=null&&!n.headers.has(t)&&(n=n.clone({headers:n.headers.set(t,r)})),e(n)}var mC=(function(n){return n[n.Interceptors=0]="Interceptors",n[n.LegacyInterceptors=1]="LegacyInterceptors",n[n.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",n[n.NoXsrfProtection=3]="NoXsrfProtection",n[n.JsonpSupport=4]="JsonpSupport",n[n.RequestsMadeViaParent=5]="RequestsMadeViaParent",n[n.Fetch=6]="Fetch",n})(mC||{});function f7(n,e){return{\u0275kind:n,\u0275providers:e}}function g7(...n){let e=[O1,hC,ET,{provide:hd,useExisting:ET},{provide:pg,useFactory:()=>ne(ZY,{optional:!0})??ne(hC)},{provide:fC,useValue:h7,multi:!0},{provide:M1,useValue:!0},{provide:_g,useClass:u7}];for(let r of n)e.push(...r.\u0275providers);return pr(e)}var D1=new Z("");function m7(){return f7(mC.LegacyInterceptors,[{provide:D1,useFactory:n7},{provide:fC,useExisting:D1,multi:!0}])}var pC=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275prov=K({token:n,factory:function(t){let i=null;return t?i=new(t||n):i=w(p7),i},providedIn:"root"})}return n})(),p7=(()=>{class n extends pC{_doc;constructor(r){super(),this._doc=r}sanitize(r,t){if(t==null)return null;switch(r){case si.NONE:return t;case si.HTML:return So(t,"HTML")?Br(t):P_(this._doc,String(t)).toString();case si.STYLE:return So(t,"Style")?Br(t):t;case si.SCRIPT:if(So(t,"Script"))return Br(t);throw new oe(5200,!1);case si.URL:return So(t,"URL")?Br(t):Hf(String(t));case si.RESOURCE_URL:if(So(t,"ResourceURL"))return Br(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(r){return WD(r)}bypassSecurityTrustStyle(r){return zD(r)}bypassSecurityTrustScript(r){return qD(r)}bypassSecurityTrustUrl(r){return KD(r)}bypassSecurityTrustResourceUrl(r){return YD(r)}static \u0275fac=function(t){return new(t||n)(w(Dn))};static \u0275prov=K({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var st={production:!1,staging:!0,firebaseLogLevel:"error",firebaseConfig:{apiKey:"AIzaSyAzcW2n1JhY_zhkXmuFcwe550AkwmYeJ0w",authDomain:"snipply-sdk-staging.firebaseapp.com",projectId:"snipply-sdk-staging",storageBucket:"snipply-sdk-staging.appspot.com",messagingSenderId:"877538579326",appId:"1:877538579326:web:f793f73f2b7dc770c4992f"},firebaseNotificationsDatabaseURL:"https://snipply-sdk-staging-notifications.firebaseio.com",segmentAnalyticsWriteKey:"ndJ0KZs5LkL6jny5a43FXXQkTF5bgPFt",useEmulators:!1,debugMode:!1,cloudFunction:{sa:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",getIceServers:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/geticeservers",validateClient:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/validateclient",convertRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/convertrecordingv2",chatgptCompletion:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/chatgptcompletion",rewriterAskAi:"https://staging.velt.dev/v2/rewriter/ask-ai",whisperTranscription:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/whispertranscription",getPlanDetails:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getplandetails",getAllowedDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getalloweddocuments",getNotificationsForDocuments:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/getnotificationsfordocuments",videoBackend:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/videobackend",processRecording:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/processrecording",sdkProxy:"https://staging.velt.dev/v2/core/a",screenshot:"https://staging.velt.dev/v2/screenshots/capture",usCentral1:{setEncryptedData:"https://us-central1-snipply-sdk-staging.cloudfunctions.net/setencrypteddata"},asiaSouthEast1:{setEncryptedData:"https://asia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau"},europeWest1:{setEncryptedData:"https://europe-west1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataeu"},asiaNorthEast1:{setEncryptedData:"https://asia-northeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddatajp"},australiaSouthEast1:{setEncryptedData:"https://australia-southeast1-snipply-sdk-staging.cloudfunctions.net/setencrypteddataau1"}}};var Ie=(function(n){return n.NEWLY_ADDED="newlyAdded",n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.ASSIGNED="assigned",n.STATUS_CHANGED="statusChanged",n.PRIORITY_CHANGED="priorityChanged",n.ACCESS_MODE_CHANGED="accessModeChanged",n.CUSTOM_LIST_CHANGED="customListChanged",n.ACCEPTED="accepted",n.REJECTED="rejected",n.REACTION_ADDED="reactionAdded",n.REACTION_DELETED="reactionDeleted",n.SUBSCRIBED="subscribed",n.UNSUBSCRIBED="unsubscribed",n.SUGGESTION_ACCEPTED="suggestionAccepted",n.SUGGESTION_REJECTED="suggestionRejected",n})(Ie||{}),Qt=(function(n){return n.COMMENT_ANNOTATION_ADD="comment_annotation.add",n.COMMENT_ANNOTATION_DELETE="comment_annotation.delete",n.COMMENT_ADD="comment.add",n.COMMENT_DELETE="comment.delete",n.COMMENT_UPDATE="comment.update",n.REACTION_ADD="reaction.add",n.REACTION_DELETE="reaction.delete",n.ATTACHMENT_ADD="attachment.add",n.ATTACHMENT_DELETE="attachment.delete",n.RECORDER_ANNOTATION_ADD="recorder_annotation.add",n.RECORDER_ANNOTATION_UPDATE="recorder_annotation.update",n.RECORDER_ANNOTATION_DELETE="recorder_annotation.delete",n.ACTIVITY_SAVE="activity.save",n})(Qt||{}),Xn=(function(n){return n.STATUS_CHANGE="comment_annotation.status_change",n.PRIORITY_CHANGE="comment_annotation.priority_change",n.ASSIGN="comment_annotation.assign",n.ACCESS_MODE_CHANGE="comment_annotation.access_mode_change",n.CUSTOM_LIST_CHANGE="comment_annotation.custom_list_change",n.APPROVE="comment_annotation.approve",n.ACCEPT="comment.accept",n.REJECT="comment.reject",n.SUGGESTION_ACCEPT="comment_annotation.suggestion_accept",n.SUGGESTION_REJECT="comment_annotation.suggestion_reject",n.REACTION_ADD="comment.reaction_add",n.REACTION_DELETE="comment.reaction_delete",n.SUBSCRIBE="comment_annotation.subscribe",n.UNSUBSCRIBE="comment_annotation.unsubscribe",n})(Xn||{}),pAe={ADD_COMMENT_ANNOTATION:"addCommentAnnotation",ADD_COMMENT_ANNOTATION_DRAFT:"addCommentAnnotationDraft",DELETE_COMMENT_ANNOTATION:"deleteCommentAnnotation",APPROVE_COMMENT_ANNOTATION:"approveCommentAnnotation",ACCEPT_COMMENT_ANNOTATION:"acceptCommentAnnotation",REJECT_COMMENT_ANNOTATION:"rejectCommentAnnotation",SUBSCRIBE_COMMENT_ANNOTATION:"subscribeCommentAnnotation",UNSUBSCRIBE_COMMENT_ANNOTATION:"unsubscribeCommentAnnotation",ASSIGN_USER:"assignUser",UPDATE_STATUS:"updateStatus",UPDATE_PRIORITY:"updatePriority",UPDATE_ACCESS:"updateAccess",RESOLVE_COMMENT:"resolveComment",ADD_COMMENT:"addComment",ADD_COMMENT_DRAFT:"addCommentDraft",UPDATE_COMMENT:"updateComment",DELETE_COMMENT:"deleteComment",ADD_ATTACHMENT:"addAttachment",DELETE_ATTACHMENT:"deleteAttachment",DELETE_RECORDING:"deleteRecording",COPY_LINK:"copyLink",ADD_REACTION:"addReaction",DELETE_REACTION:"deleteReaction",TOGGLE_REACTION:"toggleReaction",COMMENT_SIDEBAR_DATA_INIT:"commentSidebarDataInit",COMMENT_SIDEBAR_DATA_UPDATE:"commentSidebarDataUpdate",AUTOCOMPLETE_SEARCH:"autocompleteSearch",COMPOSER_CLICKED:"composerClicked",COMPOSER_TEXT_CHANGE:"composerTextChange",LINK_CLICKED:"linkClicked",COMMENT_PIN_CLICKED:"commentPinClicked",COMMENT_BUBBLE_CLICKED:"commentBubbleClicked",COMMENT_TOOL_CLICK:"commentToolClick",COMMENT_TOOL_CLICKED:"commentToolClicked",SIDEBAR_BUTTON_CLICK:"sidebarButtonClick",SIDEBAR_BUTTON_CLICKED:"sidebarButtonClicked",SIDEBAR_OPEN:"sidebarOpen",SIDEBAR_CLOSE:"sidebarClose",COMMENT_CLICK:"commentClick",COMMENT_NAVIGATION_BUTTON_CLICK:"commentNavigationButtonClick",ATTACHMENT_DOWNLOAD_CLICKED:"attachmentDownloadClicked",COMMENT_SAVED:"commentSaved",COMMENT_SAVE_TRIGGERED:"commentSaveTriggered",VISIBILITY_OPTION_CLICKED:"visibilityOptionClicked",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},EAe={TRANSCRIPTION_DONE:"transcriptionDone",RECORDING_DONE:"recordingDone",RECORDING_EDIT_DONE:"recordingEditDone",DELETE_RECORDING:"deleteRecording",ERROR:"error",RECORDING_SAVE_INITIATED:"recordingSaveInitiated",RECORDING_STARTED:"recordingStarted",RECORDING_PAUSED:"recordingPaused",RECORDING_RESUMED:"recordingResumed",RECORDING_CANCELLED:"recordingCancelled",RECORDING_STOPPED:"recordingStopped",RECORDING_DONE_LOCAL:"recordingDoneLocal"},_Ae={TEXT_SELECTED:"textSelected"},TAe={SUGGESTION_CREATED:"suggestionCreated",SUGGESTION_APPROVED:"suggestionApproved",SUGGESTION_REJECTED:"suggestionRejected",SUGGESTION_STALE:"suggestionStale",TARGET_EDIT_START:"targetEditStart",TARGET_EDIT_COMMIT:"targetEditCommit"},$={PERMISSION_PROVIDER:"permissionProvider",USER_RESOLVER:"userResolver",COMMENT_RESOLVER:"commentResolver",ATTACHMENT_RESOLVER:"attachmentResolver",REACTION_RESOLVER:"reactionResolver",RECORDER_RESOLVER:"recorderResolver",NOTIFICATION_RESOLVER:"notificationResolver",ACTIVITY_RESOLVER:"activityResolver",VELT_BUTTON_CLICK:"veltButtonClick",USER_UPDATE:"userUpdate",INIT_UPDATE:"initUpdate",DOCUMENT_INIT:"documentInit",ERROR:"error"},IAe={ACCESS_REQUESTED:"accessRequested",ACCESS_REQUEST_CANCELED:"accessRequestCanceled",ACCESS_ACCEPTED:"accessAccepted",ACCESS_REJECTED:"accessRejected",EDITOR_ASSIGNED:"editorAssigned",VIEWER_ASSIGNED:"viewerAssigned",EDITOR_ON_DIFFERENT_TAB_DETECTED:"editorOnDifferentTabDetected"},vAe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},yAe={SETTINGS_UPDATED:"settingsUpdated"},SAe={UPDATE_DATA:"updateData"},_7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(_7||{}),T7=(function(n){return n.INVITE="invite",n.REMOVE="remove",n})(T7||{}),I7=(function(n){return n.CREATED="created",n.JOINED="joined",n})(I7||{}),v7=(function(n){return n.UPDATE_DATA="updateData",n})(v7||{}),_T=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n.APPROVED="approved",n.RESOLVED="resolved",n})(_T||{}),y7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(y7||{}),S7=(function(n){return n.ADDED="added",n.UPDATED="updated",n.DELETED="deleted",n})(S7||{}),A7=(function(n){return n.FIRST_VIEWED="firstViewed",n})(A7||{}),EC=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.ACTIVITY="activity",n.VIEWS="views",n.USER_INVITE="userInvite",n.USER_REQUEST="userRequest",n.VIDEO_PLAYER="videoPlayer",n.CRDT="crdt",n})(EC||{}),D7=(function(n){return n.AREA="area",n.ARROW="arrow",n.AUDIO_HUDDLE="audioHuddle",n.COMMENT="comment",n.MULTI_THREAD="multiThread",n.CURSOR="cursor",n.HUDDLE="huddle",n.LIVE_STATE_SYNC="liveStateSync",n.PRESENCE="presence",n.TAG="tag",n.RECORDER="recorder",n.REWRITER="rewriter",n.LIVE_SELECTION="liveSelection",n.NOTIFICATION="notification",n.REACTION="reaction",n.AREA_COMMENT="areaComment",n.INLINE_COMMENT="inlineComment",n.COMMENT_SIDEBAR="commentSidebar",n})(D7||{}),$r=(function(n){return n.DESKTOP="Desktop",n.MOBILE="Mobile",n.TABLET="Tablet",n.MONITOR="Monitor",n.UNKNOWN="Unknown",n})($r||{}),gd=(function(n){return n.PORTRAIT="portrait",n.LANDSCAPE="landscape",n.UNKNOWN="unknown",n})(gd||{}),TT=(function(n){return n.Portrait="(orientation: portrait)",n.Landscape="(orientation: landscape)",n})(TT||{}),R7=(function(n){return n.DIFFERENT_DEVICE="differentDevice",n.ELEMENT_DELETED="elementDeleted",n})(R7||{}),md=(function(n){return n.ADMIN="Admin",n.COMMENTER="Commenter",n})(md||{}),wt=(function(n){return n.PUBLIC="public",n.RESTRICTED="restricted",n.ORGANIZATION_PRIVATE="organizationPrivate",n})(wt||{}),C7=(function(n){return n.DEFAULT="default",n.DYNAMIC_ID="dynamicId",n})(C7||{}),Tg=(function(n){return n.PUBLIC="public",n.PRIVATE="private",n})(Tg||{}),N7=(function(n){return n.MINIMAL="minimal",n.VERBOSE="verbose",n})(N7||{}),O7=(function(n){return n.DEFAULT="default",n.EXPANDED="expanded",n})(O7||{}),w7=(function(n){return n.TOTAL="total",n.UNREAD="unread",n})(w7||{}),b7=(function(n){return n.ONLINE="online",n.OFFLINE="offline",n.PENDING_INIT="pendingInit",n.PENDING_DATA="pendingData",n})(b7||{}),L7=(function(n){return n.ALL="all",n.ORGANIZATION="organization",n.ORGANIZATION_USER_GROUP="organizationUserGroup",n.DOCUMENT="document",n.FOLDER="folder",n})(L7||{}),M7=(function(n){return n.AND="and",n.OR="or",n})(M7||{}),P7=(function(n){return n.RESTRICTED_SELF="restrictedSelf",n.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",n.ORGANIZATION_PRIVATE="organizationPrivate",n.PUBLIC="public",n})(P7||{});var q=class q{};q.SNIPPYLY_HOST_URL_PROD="https://snippyly.com",q.SNIPPYLY_HOST_URL_STAGING="https://snippyly-staging.web.app",q.USER_TYPE_ANONYMOUS="anonymous",q.USER_TYPE_SIGNED_IN="signedIn",q.LOCALSTORAGE_DATA_ID="snippylytempdata",q.NO_ORGANIZATION_ID="veltNoOrganization",q.DEFAULT_QUERY_HASH="default",q.LISTENER_BATCH_SIZE=5,q.LISTENER_CONTEXT_BATCH_SIZE=25,q.DEFAULT_VELT_CONTEXT="default:velt",q.VISIBILITY_SELF_PREFIX="__velt_private_self:",q.FIREBASE_PARTIAL_PATH_ORGANIZATIONS="organizations",q.FIREBASE_PARTIAL_PATH_FOLDERS="folders",q.FIREBASE_PARTIAL_PATH_DOCS="docs",q.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS="documentConfigurations",q.FIREBASE_PARTIAL_PATH_PRESENCE="presence",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS="orgIamUsers",q.FIREBASE_PARTIAL_PATH_CENTRAL_USERS="users",q.FIREBASE_PARTIAL_PATH_FOLDER_USERS="folderIamUsers",q.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS="docIamUsers",q.FIREBASE_PARTIAL_PATH_CURSOR="cursor",q.FIREBASE_PARTIAL_PATH_ARROW="arrow",q.FIREBASE_PARTIAL_PATH_AREA="area",q.FIREBASE_PARTIAL_PATH_COMMENT="comment",q.FIREBASE_PARTIAL_PATH_LOCATION="location",q.FIREBASE_PARTIAL_PATH_MULTI_THREAD="multiThread",q.FIREBASE_PARTIAL_PATH_TAG="tag",q.FIREBASE_PARTIAL_PATH_SELECTION="selection",q.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE="audioHuddle",q.FIREBASE_PARTIAL_PATH_HUDDLE="huddle",q.FIREBASE_PARTIAL_PATH_CONTACTS="contacts",q.FIREBASE_PARTIAL_PATH_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS="notificationsDocs",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS="notificationsUsers",q.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION="notificationsDocs__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION="notificationsUsers__notification",q.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX="userNotificationIndex",q.FIREBASE_PARTIAL_PATH_GLOBAL="global",q.FIREBASE_PARTIAL_PATH_LOGINS="logins",q.FIREBASE_PARTIAL_PATH_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA="metadata",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS="groups",q.FIREBASE_PARTIAL_PATH_LOCATIONS="locations",q.FIREBASE_PARTIAL_PATH_RECORDER="recorder",q.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG="flock",q.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER="syncVideoPlayer",q.FIREBASE_PARTIAL_PATH_LIVE_STATE="liveState",q.FIREBASE_PARTIAL_PATH_IAM="iam",q.FIREBASE_PARTIAL_PATH_REACTION="reaction",q.FIREBASE_PARTIAL_PATH_CRDT="crdt",q.FIREBASE_PARTIAL_PATH_VIEWS="views",q.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS="notificationViews",q.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS="documentViews",q.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS="locationViews",q.FIREBASE_PARTIAL_PATH_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS="notifications",q.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP="lastNotificationTimestamp",q.FIREBASE_PARTIAL_PATH_ACTIVITIES="activities",q.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP="lastActivityTimestamp",q.FIREBASE_PARTIAL_PATH_HEARTBEAT="heartbeat",q.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT="heartbeatByDocument",q.FIREBASE_PARTIAL_PATH_USERS="users",q.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS="permissions",q.FIREBASE_PARTIAL_PATH_USER_REQUESTS="userRequests",q.FIREBASE_PARTIAL_PATH_FEEDBACK="feedback",q.FIREBASE_PARTIAL_PATH_BUGS="bugs",q.FIREBASE_PARTIAL_PATH_CONTACT_US="contactUs",q.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA="metadata",q.PRESENCE_STATUS_ONLINE="online",q.PRESENCE_STATUS_OFFLINE="offline",q.PRESENCE_STATUS_AWAY="away",q.IMG_URL_NOT_FOUND="https://snippyly.com/assets/icons/anon-user.svg",q.IMG_CLASS_NOT_FOUND="presence-avatar-image-small",q.AVATAR_COLOR_LIST=["#a259fe","#9746ff","#19bcfe","#FE8947","#2c83fc","#0dcf82","#ffcb00","#ff7162","#FFD600","#A5A7FE","#67DBF4","#FDA192"],q.TEXT_COLOR_MAP={"#a259fe":"#ffffff","#9746ff":"#ffffff","#19bcfe":"#ffffff","#FE8947":"#ffffff","#2c83fc":"#ffffff","#0dcf82":"#141416","#ffcb00":"#141416","#ff7162":"#ffffff","#FFD600":"#141416","#A5A7FE":"#141416","#67DBF4":"#141416","#FDA192":"#141416"},q.UNREAD_COMMENTS_CHECK_FROM_DATE="2024-02-05",q.DEFAULT_ANNOTATION_COLOR="#a259fe",q.REGEX_EMAIL=/(\+|@)+([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi,q.REGEX_URL=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)(?::[0-9]+)?((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_0-9]*)#?(?:[\.\!\/\\\w0-9=]*))?)/gi,q.REGEX_URL_FOR_USER_NAME=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi,q.REGEX_SPECIAL_CHARS=/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/,q.SNIPPYLY_HIGHLIGHT="snippyly-highlight",q.SNIPPYLY_HIGHLIGHT_PREVIEW="snippyly-highlight-preview",q.SNIPPYLY_HIGHLIGHT_USER="snippyly-highlight-user",q.SNIPPYLY_HIGHLIGHT_USER_NAME="snippyly-highlight-user-name",q.SNIPPYLY_HIGHLIGHT_USER_TEXT="snippyly-highlight-user-text",q.VELT_LIVE_SELECTION_ON_ELEMENT="velt-live-selection-on-element",q.VELT_LIVE_SELECTION_ON_ELEMENT_DEFAULT="velt-live-selection-on-element-default",q.VELT_LIVE_SELECTION_ON_TEXT="velt-live-selection-on-text",q.VELT_LIVE_SELECTION_ON_TEXT_DEFAULT="velt-live-selection-on-text-default",q.VELT_IGNORE_CHANGE_DETECTION="velt-ignore-change-detection",q.VELT_CUSTOM_CSS="velt-custom-css",q.TAGS={SNIPPYLY_ROOT:"snippyly-root",SNIPPYLY_PRESENCE:"snippyly-presence",SNIPPYLY_CURSOR:"snippyly-cursor",SNIPPYLY_COMMENT_TOOL:"snippyly-comment-tool",SNIPPYLY_COMMENTS:"snippyly-comments",SNIPPYLY_TAG_TOOL:"snippyly-tag-tool",SNIPPYLY_TAGS:"snippyly-tags",SNIPPYLY_RECORDER_NOTES:"snippyly-recorder-notes",SNIPPYLY_RECORDER_CONTROL_PANEL:"snippyly-recorder-control-panel",SNIPPYLY_RECORDER_CONTROL_PANEL_INTERNAL:"snippyly-recorder-control-panel-internal",SNIPPYLY_RECORDER_PLAYER:"snippyly-recorder-player",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",SNIPPYLY_COMMENT_TEXT_PORTAL:"snippyly-comment-text-portal",SNIPPYLY_COMMENT_TEXT:"snippyly-comment-text",SNIPPYLY_COMMENTS_SIDEBAR:"snippyly-comments-sidebar",SNIPPYLY_COMMENT_BUBBLE:"snippyly-comment-bubble",SNIPPYLY_HIGHLIGHT_USER_TEXT:"snippyly-highlight-user-text",SNIPPYLY_AUDIO_HUDDLE:"snippyly-audio-huddle",SNIPPYLY_VIDEO_HUDDLE:"snippyly-video-huddle",SNIPPYLY_HUDDLE:"snippyly-huddle",SNIPPYLY_HUDDLE_TOOL:"snippyly-huddle-tool",SNIPPYLY_RECORDER_TOOL:"snippyly-recorder-tool",SNIPPYLY_PLUGIN:"snippyly-plugin",SNIPPYLY_MENU:"snippyly-menu",SNIPPYLY_COMMENT_DIALOG:"snippyly-comment-dialog",SNIPPYLY_SIDEBAR_BUTTON:"snippyly-sidebar-button",SNIPPYLY_REWRITER:"snippyly-rewriter",SNIPPYLY_USER_INVITE_TOOL:"snippyly-user-invite-tool",SNIPPYLY_USER_REQUEST_TOOL:"snippyly-user-request-tool",SNIPPYLY_USER_AVATAR:"snippyly-user-avatar",SNIPPYLY_ARROW_TOOL:"snippyly-arrow-tool",SNIPPYLY_ARROWS:"snippyly-arrows",SNIPPYLY_AREA_TOOL:"snippyly-area-tool",SNIPPYLY_AREAS:"snippyly-areas",VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",VELT_TAG_TOOL:"velt-tag-tool",VELT_TAGS:"velt-tags",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_RECORDER_CONTROL_PANEL_EMBED:"velt-recorder-control-panel-embed",SNIPPYLY_RECORDER_CONTROL_PANEL_EMBED:"snippyly-recorder-control-panel-embed",VELT_RECORDER_PLAYER:"velt-recorder-player",VELT_RECORDER_PLAYER_EMBED:"velt-recorder-player-embed",SNIPPYLY_RECORDER_PLAYER_EMBED:"snippyly-recorder-player-embed",VELT_VIDEO_EDITOR:"velt-video-editor",VELT_TEXT_HIGHLIGHT:"velt-text-highlight",VELT_COMMENT_TEXT_PORTAL:"velt-comment-text-portal",VELT_COMMENTS_SIDEBAR:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_COMMENT_SIDEBAR_SKELETON_V2:"velt-comment-sidebar-skeleton-v2",VELT_COMMENT_SIDEBAR_PANEL_V2:"velt-comment-sidebar-panel-v2",VELT_COMMENT_SIDEBAR_LIST_V2:"velt-comment-sidebar-list-v2",VELT_COMMENT_SIDEBAR_LIST_ITEM_V2:"velt-comment-sidebar-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_V2:"velt-comment-sidebar-filter-dropdown-content-list-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_CATEGORY_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-list-category-content-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_INDICATOR_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-indicator-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-label-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_LIST_ITEM_COUNT_V2:"velt-comment-sidebar-filter-dropdown-content-list-item-count-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_V2:"velt-comment-sidebar-filter-dropdown-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_TRIGGER_V2:"velt-comment-sidebar-filter-dropdown-trigger-v2",VELT_COMMENT_SIDEBAR_FILTER_DROPDOWN_CONTENT_V2:"velt-comment-sidebar-filter-dropdown-content-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2:"velt-comment-sidebar-filter-button-v2",VELT_COMMENT_SIDEBAR_FILTER_BUTTON_V2_APPLIED_ICON:"velt-comment-sidebar-filter-button-v2-applied-icon",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2:"velt-comment-sidebar-filter-container-v2",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION:"velt-comment-sidebar-filter-container-v2-section",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_FIELD:"velt-comment-sidebar-filter-container-v2-section-field",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LIST:"velt-comment-sidebar-filter-container-v2-section-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_LABEL:"velt-comment-sidebar-filter-container-v2-section-label",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL:"velt-comment-sidebar-filter-container-v2-section-control",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_LIST:"velt-comment-sidebar-filter-container-v2-section-option-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION:"velt-comment-sidebar-filter-container-v2-section-option",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_CHECKBOX:"velt-comment-sidebar-filter-container-v2-section-option-checkbox",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_VALUE:"velt-comment-sidebar-filter-container-v2-section-control-value",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP:"velt-comment-sidebar-filter-container-v2-section-control-chip",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHIP_LIST:"velt-comment-sidebar-filter-container-v2-section-control-chip-list",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_SEARCH:"velt-comment-sidebar-filter-container-v2-section-control-search",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_CONTROL_CHEVRON:"velt-comment-sidebar-filter-container-v2-section-control-chevron",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_NAME:"velt-comment-sidebar-filter-container-v2-section-option-name",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_SECTION_OPTION_COUNT:"velt-comment-sidebar-filter-container-v2-section-option-count",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_TITLE:"velt-comment-sidebar-filter-container-v2-title",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_CLOSE_BUTTON:"velt-comment-sidebar-filter-container-v2-close-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_GROUP_BY:"velt-comment-sidebar-filter-container-v2-group-by",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_RESET_BUTTON:"velt-comment-sidebar-filter-container-v2-reset-button",VELT_COMMENT_SIDEBAR_FILTER_CONTAINER_V2_APPLY_BUTTON:"velt-comment-sidebar-filter-container-v2-apply-button",VELT_COMMENT_SIDEBAR_SEARCH_V2:"velt-comment-sidebar-search-v2",VELT_COMMENT_SIDEBAR_SEARCH_V2_ICON:"velt-comment-sidebar-search-v2-icon",VELT_COMMENT_SIDEBAR_SEARCH_V2_INPUT:"velt-comment-sidebar-search-v2-input",VELT_COMMENT_SIDEBAR_FULLSCREEN_BUTTON_V2:"velt-comment-sidebar-fullscreen-button-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2:"velt-comment-sidebar-list-group-header-v2",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_LABEL:"velt-comment-sidebar-list-group-header-v2-label",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_COUNT:"velt-comment-sidebar-list-group-header-v2-count",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_SEPARATOR:"velt-comment-sidebar-list-group-header-v2-separator",VELT_COMMENT_SIDEBAR_LIST_GROUP_HEADER_V2_CHEVRON:"velt-comment-sidebar-list-group-header-v2-chevron",VELT_COMMENT_SIDEBAR_HEADER_V2:"velt-comment-sidebar-header-v2",VELT_COMMENT_SIDEBAR_CLOSE_BUTTON_V2:"velt-comment-sidebar-close-button-v2",VELT_COMMENT_SIDEBAR_EMPTY_PLACEHOLDER_V2:"velt-comment-sidebar-empty-placeholder-v2",VELT_COMMENT_SIDEBAR_RESET_FILTER_BUTTON_V2:"velt-comment-sidebar-reset-filter-button-v2",VELT_COMMENT_SIDEBAR_PAGE_MODE_COMPOSER_V2:"velt-comment-sidebar-page-mode-composer-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_V2:"velt-comment-sidebar-focused-thread-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_BACK_BUTTON_V2:"velt-comment-sidebar-focused-thread-back-button-v2",VELT_COMMENT_SIDEBAR_FOCUSED_THREAD_DIALOG_CONTAINER_V2:"velt-comment-sidebar-focused-thread-dialog-container-v2",VELT_COMMENT_BUBBLE:"velt-comment-bubble",VELT_COMMENT_BUBBLE_AVATAR:"velt-comment-bubble-avatar",VELT_COMMENT_BUBBLE_COMMENTS_COUNT:"velt-comment-bubble-comments-count",VELT_COMMENT_BUBBLE_UNREAD_ICON:"velt-comment-bubble-unread-icon",VELT_COMMENT_THREAD:"velt-comment-thread",VELT_COMMENT_PIN:"velt-comment-pin",VELT_COMMENT_PIN_EMBED:"velt-comment-pin-embed",SNIPPYLY_COMMENT_PIN_EMBED:"snippyly-comment-pin-embed",VELT_COMMENT_PIN_NUMBER:"velt-comment-pin-number",VELT_COMMENT_PIN_INDEX:"velt-comment-pin-index",VELT_COMMENT_PIN_TRIANGLE:"velt-comment-pin-triangle",VELT_COMMENT_PIN_PRIVATE_COMMENT_INDICATOR:"velt-comment-pin-private-comment-indicator",VELT_COMMENT_PIN_GHOST_COMMENT_INDICATOR:"velt-comment-pin-ghost-comment-indicator",VELT_COMMENT_PIN_UNREAD_COMMENT_INDICATOR:"velt-comment-pin-unread-comment-indicator",VELT_SIDEBAR_BUTTON_ICON:"velt-sidebar-button-icon",VELT_SIDEBAR_BUTTON_COMMENTS_COUNT:"velt-sidebar-button-comments-count",VELT_SIDEBAR_BUTTON_UNREAD_ICON:"velt-sidebar-button-unread-icon",VELT_COMMENT_TEXT:"velt-comment-text",VELT_CHART_COMMENT:"velt-chart-comment",VELT_CANVAS_COMMENT:"velt-canvas-comment",VELT_INLINE_COMMENTS_SECTION:"velt-inline-comments-section",VELT_INLINE_COMMENTS_SECTION_SKELETON:"velt-inline-comments-section-skeleton",VELT_INLINE_COMMENTS_SECTION_PANEL:"velt-inline-comments-section-panel",VELT_INLINE_COMMENTS_SECTION_LIST:"velt-inline-comments-section-list",VELT_INLINE_COMMENTS_SECTION_COMPOSER_CONTAINER:"velt-inline-comments-section-composer-container",VELT_INLINE_COMMENTS_SECTION_COMMENT_COUNT:"velt-inline-comments-section-comment-count",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN:"velt-inline-comments-section-sorting-dropdown",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER:"velt-inline-comments-section-sorting-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-sorting-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_TRIGGER_ICON:"velt-inline-comments-section-sorting-dropdown-trigger-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT:"velt-inline-comments-section-sorting-dropdown-content",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM:"velt-inline-comments-section-sorting-dropdown-content-item",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_ICON:"velt-inline-comments-section-sorting-dropdown-content-item-icon",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_TICK:"velt-inline-comments-section-sorting-dropdown-content-item-tick",VELT_INLINE_COMMENTS_SECTION_SORTING_DROPDOWN_CONTENT_ITEM_NAME:"velt-inline-comments-section-sorting-dropdown-content-item-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN:"velt-inline-comments-section-filter-dropdown",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER:"velt-inline-comments-section-filter-dropdown-trigger",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_NAME:"velt-inline-comments-section-filter-dropdown-trigger-name",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_TRIGGER_ARROW:"velt-inline-comments-section-filter-dropdown-trigger-arrow",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT:"velt-inline-comments-section-filter-dropdown-content",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST:"velt-inline-comments-section-filter-dropdown-content-list",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM:"velt-inline-comments-section-filter-dropdown-content-list-item",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_CHECKBOX:"velt-inline-comments-section-filter-dropdown-content-list-item-checkbox",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_LIST_ITEM_LABEL:"velt-inline-comments-section-filter-dropdown-content-list-item-label",VELT_INLINE_COMMENTS_SECTION_FILTER_DROPDOWN_CONTENT_APPLY_BUTTON:"velt-inline-comments-section-filter-dropdown-content-apply-button",VELT_COMMENTS_MINIMAP:"velt-comments-minimap",VELT_HIGHLIGHT_USER_TEXT:"velt-highlight-user-text",VELT_AUDIO_HUDDLE:"velt-audio-huddle",VELT_VIDEO_HUDDLE:"velt-video-huddle",VELT_HUDDLE:"velt-huddle",VELT_HUDDLE_TOOL:"velt-huddle-tool",VELT_RECORDER_TOOL:"velt-recorder-tool",SUPERFLOW_TOOLBAR:"superflow-toolbar",VELT_MENU:"velt-menu",VELT_COMMENT_DIALOG:"velt-comment-dialog-internal",VELT_SIDEBAR_BUTTON:"velt-sidebar-button",VELT_COMMENTS_SIDEBAR_BUTTON:"velt-comments-sidebar-button",VELT_REWRITER:"velt-rewriter",VELT_USER_INVITE_TOOL:"velt-user-invite-tool",VELT_USER_REQUEST_TOOL:"velt-user-request-tool",VELT_USER_AVATAR:"velt-user-avatar",VELT_ARROW_TOOL:"velt-arrow-tool",VELT_ARROWS:"velt-arrows",VELT_AREA_TOOL:"velt-area-tool",VELT_AREAS:"velt-areas",VELT_INLINE_COMMENT:"velt-inline-comment",VELT_VIDEO_PLAYER:"velt-video-player",VELT_VIDEO_COMMENTS_TIMELINE:"velt-comment-player-timeline",VELT_REACTION_TOOL:"velt-reaction-tool",SNIPPYLY_REACTION_TOOL:"snippyly-reaction-tool",VELT_REACTION_PIN:"velt-reaction-pin",SNIPPYLY_REACTION_PIN:"snippyly-reaction-pin",VELT_INLINE_REACTIONS_SECTION:"velt-inline-reactions-section",SNIPPYLY_INLINE_REACTIONS_SECTION:"snippyly-inline-reactions-section",VELT_VIEW_ANALYTICS:"velt-view-analytics",VELT_NOTIFICATIONS_TOOL:"velt-notifications-tool",VELT_NOTIFICATIONS_TOOL_ICON:"velt-notifications-tool-icon",VELT_NOTIFICATIONS_TOOL_UNREAD_ICON:"velt-notifications-tool-unread-icon",VELT_NOTIFICATIONS_TOOL_LABEL:"velt-notifications-tool-label",VELT_NOTIFICATIONS_TOOL_UNREAD_COUNT:"velt-notifications-tool-unread-count",VELT_NOTIFICATIONS_PANEL:"velt-notifications-panel",VELT_NOTIFICATIONS_PANEL_TITLE:"velt-notifications-panel-title",VELT_NOTIFICATIONS_PANEL_TITLE_TEXT:"velt-notifications-panel-title-text",VELT_NOTIFICATIONS_PANEL_HEADER:"velt-notifications-panel-header",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_FOR_YOU:"velt-notifications-panel-header-tab-for-you",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_PEOPLE:"velt-notifications-panel-header-tab-people",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_DOCUMENTS:"velt-notifications-panel-header-tab-documents",VELT_NOTIFICATIONS_PANEL_HEADER_TAB_ALL:"velt-notifications-panel-header-tab-all",VELT_NOTIFICATIONS_PANEL_CONTENT:"velt-notifications-panel-content",VELT_NOTIFICATIONS_PANEL_CONTENT_FOR_YOU:"velt-notifications-panel-content-for-you",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL:"velt-notifications-panel-content-all",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE:"velt-notifications-panel-content-people",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS:"velt-notifications-panel-content-documents",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST:"velt-notifications-panel-content-list",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM:"velt-notifications-panel-content-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_AVATAR:"velt-notifications-panel-content-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_UNREAD:"velt-notifications-panel-content-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_HEADLINE:"velt-notifications-panel-content-list-item-headline",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_BODY:"velt-notifications-panel-content-list-item-body",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_FILE_NAME:"velt-notifications-panel-content-list-item-file-name",VELT_NOTIFICATIONS_PANEL_CONTENT_LIST_ITEM_TIME:"velt-notifications-panel-content-list-item-time",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST:"velt-notifications-panel-content-all-list",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM:"velt-notifications-panel-content-all-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_LABEL:"velt-notifications-panel-content-all-list-item-label",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_LIST_ITEM_CONTENT:"velt-notifications-panel-content-all-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST:"velt-notifications-panel-content-people-list",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM:"velt-notifications-panel-content-people-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_AVATAR:"velt-notifications-panel-content-people-list-item-avatar",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_NAME:"velt-notifications-panel-content-people-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_COUNT:"velt-notifications-panel-content-people-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_PEOPLE_LIST_ITEM_CONTENT:"velt-notifications-panel-content-people-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST:"velt-notifications-panel-content-documents-list",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM:"velt-notifications-panel-content-documents-list-item",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_NAME:"velt-notifications-panel-content-documents-list-item-name",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_COUNT:"velt-notifications-panel-content-documents-list-item-count",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_CONTENT:"velt-notifications-panel-content-documents-list-item-content",VELT_NOTIFICATIONS_PANEL_CONTENT_DOCUMENTS_LIST_ITEM_UNREAD:"velt-notifications-panel-content-documents-list-item-unread",VELT_NOTIFICATIONS_PANEL_CONTENT_LOAD_MORE:"velt-notifications-panel-content-load-more",VELT_NOTIFICATIONS_PANEL_CONTENT_ALL_READ_CONTAINER:"velt-notifications-panel-content-all-read-container",VELT_NOTIFICATIONS_PANEL_CLOSE_BUTTON:"velt-notifications-panel-close-button",VELT_NOTIFICATIONS_PANEL_READ_ALL_BUTTON:"velt-notifications-panel-read-all-button",VELT_NOTIFICATIONS_PANEL_VIEW_ALL_BUTTON:"velt-notifications-panel-view-all-button",VELT_NOTIFICATIONS_PANEL_SKELETON:"velt-notifications-panel-skeleton",VELT_NOTIFICATIONS_PANEL_SETTINGS_BUTTON:"velt-notifications-panel-settings-button",VELT_NOTIFICATIONS_PANEL_SETTINGS:"velt-notifications-panel-settings",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER:"velt-notifications-panel-settings-header",VELT_NOTIFICATIONS_PANEL_SETTINGS_HEADER_TITLE:"velt-notifications-panel-settings-header-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_TITLE:"velt-notifications-panel-settings-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_DESCRIPTION:"velt-notifications-panel-settings-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_LIST:"velt-notifications-panel-settings-list",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TITLE:"velt-notifications-panel-settings-mute-all-title",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_DESCRIPTION:"velt-notifications-panel-settings-mute-all-description",VELT_NOTIFICATIONS_PANEL_SETTINGS_MUTE_ALL_TOGGLE:"velt-notifications-panel-settings-mute-all-toggle",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION:"velt-notifications-panel-settings-accordion",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER:"velt-notifications-panel-settings-accordion-trigger",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_LABEL:"velt-notifications-panel-settings-accordion-trigger-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_ICON:"velt-notifications-panel-settings-accordion-trigger-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_TRIGGER_SELECTED_VALUE:"velt-notifications-panel-settings-accordion-trigger-selected-value",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT:"velt-notifications-panel-settings-accordion-content",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM:"velt-notifications-panel-settings-accordion-content-item",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_LABEL:"velt-notifications-panel-settings-accordion-content-item-label",VELT_NOTIFICATIONS_PANEL_SETTINGS_ACCORDION_CONTENT_ITEM_ICON:"velt-notifications-panel-settings-accordion-content-item-icon",VELT_NOTIFICATIONS_PANEL_SETTINGS_BACK_BUTTON:"velt-notifications-panel-settings-back-button",VELT_NOTIFICATIONS_PANEL_SETTINGS_FOOTER:"velt-notifications-panel-settings-footer",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel",VELT_WIREFRAME:"velt-wireframe",VELT_AUTOCOMPLETE:"velt-autocomplete",VELT_AUTOCOMPLETE_PANEL:"velt-autocomplete-panel",VELT_AUTOCOMPLETE_OPTION:"velt-autocomplete-option",VELT_AUTOCOMPLETE_OPTION_ICON:"velt-autocomplete-option-icon",VELT_AUTOCOMPLETE_OPTION_NAME:"velt-autocomplete-option-name",VELT_AUTOCOMPLETE_OPTION_DESCRIPTION:"velt-autocomplete-option-description",VELT_AUTOCOMPLETE_OPTION_ERROR_ICON:"velt-autocomplete-option-error-icon",VELT_AUTOCOMPLETE_GROUP_OPTION:"velt-autocomplete-group-option",VELT_AUTOCOMPLETE_TOOL:"velt-autocomplete-tool",VELT_AUTOCOMPLETE_EMPTY:"velt-autocomplete-empty",VELT_AUTOCOMPLETE_CHIP:"velt-autocomplete-chip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP:"velt-autocomplete-chip-tooltip",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_ICON:"velt-autocomplete-chip-tooltip-icon",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_NAME:"velt-autocomplete-chip-tooltip-name",VELT_AUTOCOMPLETE_CHIP_TOOLTIP_DESCRIPTION:"velt-autocomplete-chip-tooltip-description",VELT_AUTOCOMPLETE_CONTEXT_WRAPPER:"velt-autocomplete-context-wrapper",VELT_ACTIVITY_LOG:"velt-activity-log",VELT_ACTIVITY_LOG_HEADER:"velt-activity-log-header",VELT_ACTIVITY_LOG_HEADER_TITLE:"velt-activity-log-header-title",VELT_ACTIVITY_LOG_HEADER_CLOSE_BUTTON:"velt-activity-log-header-close-button",VELT_ACTIVITY_LOG_HEADER_FILTER:"velt-activity-log-header-filter",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER:"velt-activity-log-header-filter-trigger",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_LABEL:"velt-activity-log-header-filter-trigger-label",VELT_ACTIVITY_LOG_HEADER_FILTER_TRIGGER_ICON:"velt-activity-log-header-filter-trigger-icon",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT:"velt-activity-log-header-filter-content",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM:"velt-activity-log-header-filter-content-item",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_LABEL:"velt-activity-log-header-filter-content-item-label",VELT_ACTIVITY_LOG_HEADER_FILTER_CONTENT_ITEM_ICON:"velt-activity-log-header-filter-content-item-icon",VELT_ACTIVITY_LOG_LOADING:"velt-activity-log-loading",VELT_ACTIVITY_LOG_LIST:"velt-activity-log-list",VELT_ACTIVITY_LOG_LIST_DATE_GROUP:"velt-activity-log-list-date-group",VELT_ACTIVITY_LOG_LIST_DATE_GROUP_LABEL:"velt-activity-log-list-date-group-label",VELT_ACTIVITY_LOG_LIST_ITEM:"velt-activity-log-list-item",VELT_ACTIVITY_LOG_LIST_ITEM_ICON:"velt-activity-log-list-item-icon",VELT_ACTIVITY_LOG_LIST_ITEM_AVATAR:"velt-activity-log-list-item-avatar",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT:"velt-activity-log-list-item-content",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_USER:"velt-activity-log-list-item-content-user",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_ACTION:"velt-activity-log-list-item-content-action",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_TARGET:"velt-activity-log-list-item-content-target",VELT_ACTIVITY_LOG_LIST_ITEM_CONTENT_DETAIL:"velt-activity-log-list-item-content-detail",VELT_ACTIVITY_LOG_LIST_ITEM_TIME:"velt-activity-log-list-item-time",VELT_ACTIVITY_LOG_LIST_SHOW_MORE:"velt-activity-log-list-show-more",VELT_ACTIVITY_LOG_EMPTY:"velt-activity-log-empty",VELT_ACTIVITY_LOG_CONTEXT_WRAPPER:"velt-activity-log-context-wrapper",VELT_COMMENT_DIALOG_VISIBILITY_BANNER:"velt-comment-dialog-visibility-banner",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_ICON:"velt-comment-dialog-visibility-banner-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_TEXT:"velt-comment-dialog-visibility-banner-text",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN:"velt-comment-dialog-visibility-banner-dropdown",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER:"velt-comment-dialog-visibility-banner-dropdown-trigger",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_LABEL:"velt-comment-dialog-visibility-banner-dropdown-trigger-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_ITEM:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_AVATAR_LIST_REMAINING_COUNT:"velt-comment-dialog-visibility-banner-dropdown-trigger-avatar-list-remaining-count",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_TRIGGER_ICON:"velt-comment-dialog-visibility-banner-dropdown-trigger-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT:"velt-comment-dialog-visibility-banner-dropdown-content",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM:"velt-comment-dialog-visibility-banner-dropdown-content-item",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_ICON:"velt-comment-dialog-visibility-banner-dropdown-content-item-icon",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ITEM_LABEL:"velt-comment-dialog-visibility-banner-dropdown-content-item-label",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_USER_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-user-picker",VELT_COMMENT_DIALOG_VISIBILITY_BANNER_DROPDOWN_CONTENT_ORG_PICKER:"velt-comment-dialog-visibility-banner-dropdown-content-org-picker",VELT_COMMENT_COMPOSER:"velt-comment-composer",VELT_SKELETON_LOADER:"velt-skeleton-loader",VELT_SHADOW_DOM_INTERNAL:"velt-shadow-dom-internal",VELT_SINGLE_EDITOR_MODE_PANEL:"velt-single-editor-mode-panel",VELT_MULTI_THREAD_COMMENT_DIALOG:"velt-multi-thread-comment-dialog",VELT_MULTI_THREAD_COMMENT_DIALOG_LIST:"velt-multi-thread-comment-dialog-list",VELT_MULTI_THREAD_COMMENT_DIALOG_PANEL:"velt-multi-thread-comment-dialog-panel",VELT_MULTI_THREAD_COMMENT_DIALOG_COMPOSER_CONTAINER:"velt-multi-thread-comment-dialog-composer-container",VELT_MULTI_THREAD_COMMENT_DIALOG_COMMENT_COUNT:"velt-multi-thread-comment-dialog-comment-count",VELT_MULTI_THREAD_COMMENT_DIALOG_EMPTY_PLACEHOLDER:"velt-multi-thread-comment-dialog-empty-placeholder",VELT_MULTI_THREAD_COMMENT_DIALOG_CLOSE_BUTTON:"velt-multi-thread-comment-dialog-close-button",VELT_MULTI_THREAD_COMMENT_DIALOG_NEW_THREAD_BUTTON:"velt-multi-thread-comment-dialog-new-thread-button",VELT_MULTI_THREAD_COMMENT_DIALOG_RESET_FILTER_BUTTON:"velt-multi-thread-comment-dialog-reset-filter-button",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-filter-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_ALL:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-all",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_READ:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_RESOLVED:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-resolved",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_FILTER_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-filter-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SELECTED_ICON:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-selected-icon",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_DATE:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-date",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_FILTER_DROPDOWN_CONTENT_SORT_UNREAD:"velt-multi-thread-comment-dialog-minimal-filter-dropdown-content-sort-unread",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN:"velt-multi-thread-comment-dialog-minimal-actions-dropdown",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_TRIGGER:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-trigger",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_READ:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-read",VELT_MULTI_THREAD_COMMENT_DIALOG_MINIMAL_ACTIONS_DROPDOWN_CONTENT_MARK_ALL_RESOLVED:"velt-multi-thread-comment-dialog-minimal-actions-dropdown-content-mark-all-resolved",VELT_TEXT_COMMENT:"velt-text-comment",VELT_TEXT_COMMENT_TOOL:"velt-text-comment-tool",VELT_TEXT_COMMENT_TOOLBAR:"velt-text-comment-toolbar",VELT_TEXT_COMMENT_TOOLBAR_COMMENT_ANNOTATION:"velt-text-comment-toolbar-comment-annotation",VELT_TEXT_COMMENT_TOOLBAR_DIVIDER:"velt-text-comment-toolbar-divider",VELT_TEXT_COMMENT_TOOLBAR_COPYWRITER:"velt-text-comment-toolbar-copywriter",VELT_TEXT_COMMENT_TOOLBAR_GENERIC:"velt-text-comment-toolbar-generic"},q.ATTRIBUTES={VELT_COMMENT_CONTAINER:"data-velt-comment-container",VELT_TARGET_COMMENT_ELEMENT_ID:"data-velt-target-comment-element-id",VELT_COMMENT_TYPE:"data-velt-comment-type",TARGET_INLINE_COMMENT_ELEMENT_ID:"target-inline-comment-element-id",TARGET_COMMENT_ELEMENT_ID:"target-comment-element-id",TARGET_ELEMENT_ID:"target-element-id",VELT_ID:"data-velt-id",VELT_ELEMENT:"data-velt-element",VELT_SCREEN_RECORDER_PANEL:"data-velt-screen-recorder-panel",VELT_SOURCE_ID:"data-velt-source-id",VELT_ANNOTATION_ID:"data-velt-annotation-id",VELT_ANNOTATION_IDS:"data-velt-annotation-ids",VELT_COMMENT_PIN_HOST:"data-velt-comment-pin-host",VELT_COMMENT_PIN_HOST_STATIC:"data-velt-comment-pin-host-static",VELT_COMMENT_DISABLED:"data-velt-comment-disabled",VELT_MANUAL_COMMENT_CONTAINER:"data-velt-manual-comment-container",VELT_COMMENT_PIN_ACTIVE:"data-velt-comment-pin-active",VELT_INLINE_COMMENT_SECTION_CONFIG:"data-velt-inline-comment-section-config",VELT_TARGET_INLINE_COMMENT_ELEMENT_ID:"data-velt-target-inline-comment-element-id",VELT_TAG_PIN_HOST:"data-velt-tag-pin-host",VELT_TAG_PIN_HOST_STATIC:"data-velt-tag-pin-host-static",VELT_TAG_DISABLED:"data-velt-tag-disabled",VELT_RECORDER_PIN_HOST:"data-velt-recorder-pin-host",VELT_RECORDER_PIN_HOST_STATIC:"data-velt-recorder-pin-host-static",VELT_RECORDER_DISABLED:"data-velt-recorder-disabled",VELT_ANNOTATION_DRAFT:"data-velt-annotation-draft",VELT_ANNOTATION_EDIT_COMMENT:"data-velt-annotation-edit-comment",VELT_DOCUMENT_ID:"data-velt-document-id",VELT_LOCATION:"data-velt-location",VELT_LOCATION_ID:"data-velt-location-id",VELT_THEME:"data-velt-theme",VELT_IGNORE:"data-velt-ignore",EMBED_MODE:"embed-mode",DEFAULT_CURSOR:"default-cursor",VELT_HUDDLE_ON_CURSOR_MODE:"data-velt-huddle-on-cursor-mode",VELT_SELECTION_ENABLED:"data-live-selection-enabled",VELT_LIVE_SELECTION_ENABLED:"data-velt-live-selection-enabled",VELT_LIVE_SELECTION_USER_INDICATOR_POSITION:"data-velt-live-selection-user-indicator-position",VELT_LIVE_SELECTION_USER_INDICATOR_TYPE:"data-velt-live-selection-user-indicator-type",VELT_SELECTION_CONFIG:"data-live-selection-config",VELT_POPOVER_MODE:"data-velt-popover-mode",VELT_ELEMENT_CACHE_ID:"data-velt-cache-id",VELT_ARROW_PIN_HOST:"data-velt-arrow-pin-host",VELT_ARROW_PIN_HOST_STATIC:"data-velt-arrow-pin-host-static",VELT_ARROW_DISABLED:"data-velt-arrow-disabled",VELT_AREA_PIN_HOST:"data-velt-area-pin-host",VELT_AREA_PIN_HOST_STATIC:"data-velt-area-pin-host-static",VELT_AREA_DISABLED:"data-velt-area-disabled",VELT_AREA_PIN_ACTIVE:"data-velt-area-pin-active",VELT_SUGGESTION_TARGET:"data-velt-suggestion-target",VELT_ONGOING_RECORDING:"data-velt-ongoing-recording",VELT_COMMENT_RECORDING:"data-velt-comment-recording",SYNC_VIDEO_PLAYER_ID:"data-sync-video-player-id",SYNC_VIDEO_PLAYER:"data-sync-video-player",VELT_INLINE_COMMENT_ID:"inline-comment-id",VELT_PDF_VIEWER:"data-velt-pdf-viewer",VELT_SYNC_STATE:"data-velt-sync-state",VELT_SYNC_ACCESS:"data-velt-sync-access",VELT_SYNC_ACCESS_AUTO:"data-velt-sync-access-auto",VELT_SYNC_ACCESS_DISABLED:"data-velt-sync-access-disabled",VELT_SINGLE_EDITOR_MODE_CONTAINER:"data-velt-single-editor-mode-container",VELT_IFRAME_CONTAINER:"data-velt-iframe-container",VELT_IFRAME_CONTAINER_STATIC:"data-velt-iframe-container-static",VELT_IS_FIRST_COMPONENT:"data-velt-is-first-component",VELT_DOWNLOAD_BUTTON:"velt-download-button",VELT_COMMENT_DIALOG_PORTAL_INTERNAL:"velt-comment-dialog-portal-internal",ANNOTATION_ID:"annotation-id",MULTI_THREAD_ANNOTATION_ID:"multi-thread-annotation-id",SLATE_EDITOR:"data-slate-editor"},q.INJECTION_STYLE_PROPS={VELT_AVATAR_COLOR:"data-velt-avatar-color",VELT_COMMENT_PRIORITY_COLOR:"data-velt-priority-color"},q.BODY_CLASSES={VELT_PIN_DRAGGING:"velt-pin-dragging"},q.INJECTION_ATTRIBUTES={VELT_AVATAR_IMG:"data-velt-avatar-img",VELT_COMMENT_LENGTH:"data-velt-comment-thread-length"},q.SESSION_STORAGE={SNIPPYLY_AUTO_SELECT_ANNOTATION_ID:"snippylyAutoSelectAnnotationId",SNIPPYLY_SELECTED_ANNOTATION_ID:"snippylySelectedAnnotationId",SNIPPYLY_COMMENT_SIDEBAR_FILTERS:"snippylyCommentSidebarFilters",SNIPPYLY_COMMENT_SIDEBAR_GROUP_BY:"snippylyCommentSidebarGroupBy",SNIPPYLY_COMMENT_DIALOG_AUTO_POPULATE_TEXT:"snippylyCommentDialogAutoPopulateText",SNIPPYLY_HUDDLE_DATA:"snippylyHuddleData",VELT_TAB_ID:"veltTabId",VELT_COMMENT_SIDEBAR_FILTERS_RESET:"veltCommentSidebarFiltersReset",VELT_COMMENT_SIDEBAR_CUSTOM_ACTIONS_STATE:"veltCommentSidebarCustomActionsState",VELT_CURSOR_MULTIPLE_USERS_DETECTED:"veltCursorMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_DETECTED:"veltPresenceMultipleUsersDetected",VELT_PRESENCE_MULTIPLE_USERS_ONLINE:"veltPresenceMultipleUsersOnline",VELT_CUSTOM_PRIORITY_MAP:"veltCustomPriorityMap",VELT_CUSTOM_STATUS_MAP:"veltCustomStatusMap",VELT_CUSTOM_CATEGORY_MAP:"veltCustomCategoryMap"},q.LOCAL_STORAGE={SNIPPYLY_DEFAULT_MEDIA_SOURCE_OPTIONS:"snippylyDefaultMediaSourceOptions",SNIPPYLY_QUEUED_COMMENT:"snippylyQueuedComment",VELT_USER:"_vu",VELT_IDENTIFY_USER:"_viu",VELT_USER_FORCE_RE_LOGGED_IN:"_vurli",VELT_VERSION:"_vv",VELT_ADVANCED_QUERIES:"_vadq",VELT_COMMENT_VIEWS_MIGRATED:"_vcvm",VELT_AUTH_PROXY_HOST:"_vaph"},q.NON_NESTABLE_ELEMENTS={img:!0,video:!0,audio:!0,input:!0,meter:!0,progress:!0,select:!0,textarea:!0,svg:!0,"lottie-player":!0,"ng-lottie":!0,canvas:!0,hr:!0,iframe:!0},q.INGNORE_MUTATION_OBSERVER_CHANGE_TAGS={svg:!0},q.SELECTION_ENABLED_ELEMENTS={input:!0,textarea:!0,select:!0,button:!0},q.URL_PARAMS={REVIEW_MODE:"review",REVIEW_DOC_ID:"sreviewId",SNIPPYLY_USER:"snippyly-user",COMMENT_ID:"scommentId",TAG_ID:"stagId",RECORDER_ID:"srecorderId",PROJECT_INSTALL:"sprojectInstall"},q.VELT_BASE_REM_UNIT="--velt-base-rem-unit",q.VELT_VIEWPORT_WIDTH="--legacy-velt-viewport-width",q.VELT_VIEWPORT_HEIGHT="--legacy-velt-viewport-height",q.VELT_SELECTION_COLOR="--velt-selection-color",q.VELT_MIN_ARROW_LENGTH=100,q.VELT_ARROW_VIEWPORT_PADDING=20,q.LIVE_STATE_REQUEST_EDITOR_ACCESS_WAIT_TIME=5,q.CURSOR={COMMENT_PIN:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0iIzYyNURGNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9InBhdGgtMS1pbnNpZGUtMV8yMDMyXzIzNjgxIiBmaWxsPSJ3aGl0ZSI+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiLz4KPC9tYXNrPgo8cGF0aCBkPSJNMC4zNTI5NDEgMThDMC4xNTgwMTcgMTggLTYuOTA3MTVlLTA5IDE3Ljg0MiAtMS41NDI3NWUtMDggMTcuNjQ3MUwtMy45MzQwMmUtMDcgOUMtNi4xMDY3M2UtMDcgNC4wMjk0NCA0LjAyOTQ0IC0xLjc2MTMyZS0wNyA5IC0zLjkzNDAyZS0wN1YtMy45MzQwMmUtMDdDMTMuOTcwNiAtNi4xMDY3M2UtMDcgMTggNC4wMjk0NCAxOCA5VjlDMTggMTMuOTcwNiAxMy45NzA2IDE4IDkgMThMMC4zNTI5NDEgMThaIiBmaWxsPSIjMTQxNDE2Ii8+CjxwYXRoIGQ9Ik0wLjM1Mjk0MSAxOEMwLjE1ODAxNyAxOCAtNi45MDcxNWUtMDkgMTcuODQyIC0xLjU0Mjc1ZS0wOCAxNy42NDcxTC0zLjkzNDAyZS0wNyA5Qy02LjEwNjczZS0wNyA0LjAyOTQ0IDQuMDI5NDQgLTEuNzYxMzJlLTA3IDkgLTMuOTM0MDJlLTA3Vi0zLjkzNDAyZS0wN0MxMy45NzA2IC02LjEwNjczZS0wNyAxOCA0LjAyOTQ0IDE4IDlWOUMxOCAxMy45NzA2IDEzLjk3MDYgMTggOSAxOEwwLjM1Mjk0MSAxOFoiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMiIgbWFzaz0idXJsKCNwYXRoLTEtaW5zaWRlLTFfMjAzMl8yMzY4MSkiLz4KPC9zdmc+Cg==') 0 31, auto",TAG_PIN:"url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczpieD0iaHR0cHM6Ly9ib3h5LXN2Zy5jb20iPgogIDxlbGxpcHNlIHN0eWxlPSJzdHJva2U6IHJnYigwLCAwLCAwKTsgZmlsbDogcmdiKDE2MiwgODksIDI1NCk7IHBhaW50LW9yZGVyOiBmaWxsOyBzdHJva2Utd2lkdGg6IDBweDsiIGN4PSIxNiIgY3k9IjE2IiByeD0iMTYiIHJ5PSIxNiIvPgogIDxwYXRoIGQ9Ik0gOS4zMzMgMjIgQyA5LjMzMyAyMiA4IDIyIDggMjAuNjY3IEMgOCAxOS4zMzMgOS4zMzMgMTUuMzMzIDE2IDE1LjMzMyBDIDIyLjY2NyAxNS4zMzMgMjQgMTkuMzMzIDI0IDIwLjY2NyBDIDI0IDIyIDIyLjY2NyAyMiAyMi42NjcgMjIgTCA5LjMzMyAyMiBaIE0gMTYgMTQgQyAxOS4wNzkgMTQgMjEuMDA0IDEwLjY2NyAxOS40NjQgOCBDIDE4Ljc1IDYuNzYyIDE3LjQyOSA2IDE2IDYgQyAxMi45MjEgNiAxMC45OTYgOS4zMzMgMTIuNTM2IDEyIEMgMTMuMjUgMTMuMjM3IDE0LjU3MSAxNCAxNiAxNCBaIiBzdHlsZT0iZmlsbDogcmdiKDI1NSwgMjU1LCAyNTUpOyIgYng6b3JpZ2luPSIwLjUgMC41Ii8+Cjwvc3ZnPg==') 16 16, auto",ARROW_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 15 0, auto",AREA_PIN:"url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTUiIHZpZXdCb3g9IjAgMCAxNiAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMy44MDU0IDEwLjAyMDdDMTQuNTQxMiA5Ljk5MTMxIDE1LjExMzggOS4zNzA5OCAxNS4wODQzIDguNjM1MThMMTQuODMwNiAyLjI4OTM5QzE0LjgwMjggMS41OTQ4NiAxNC4yNDYxIDEuMDM4MTkgMTMuNTUxNiAxLjAxMDQxTDcuMjA1NzEgMC43NTY1MzdDNi40Njk5MiAwLjcyNzEwMiA1Ljg0OTU4IDEuMjk5NzIgNS44MjAxNSAyLjAzNTUxQzUuNzkwNzEgMi43NzEzIDYuMzYzMzMgMy4zOTE2NCA3LjA5OTEyIDMuNDIxMDdMMTAuNDAyMSAzLjU1MzIxTDEuMjQxNzcgMTIuNzEzNkMwLjcyMTA2NyAxMy4yMzQzIDAuNzIxMDY3IDE0LjA3ODUgMS4yNDE3NyAxNC41OTkyQzEuNzYyNDYgMTUuMTE5OSAyLjYwNjY4IDE1LjExOTkgMy4xMjczOCAxNC41OTkyTDEyLjI4NzcgNS40Mzg4NkwxMi40MTk4IDguNzQxNzVDMTIuNDQ5MiA5LjQ3NzU0IDEzLjA2OTYgMTAuMDUwMiAxMy44MDU0IDEwLjAyMDdaIiBmaWxsPSIjOEY5NUIyIi8+Cjwvc3ZnPgo=) 16 0, auto"},q.VIDEO_POSTER_DEFAULT_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADIAQMAAABoEU4WAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURQAAAAEAAKSl0/gAAAAxSURBVFjD7dBBDQAgCABARjKjGZUofi0Ac+4uwkUAAAAAAMCIpYD/bQVNSsEtFfCaA8vLAaMbkVUtAAAAAElFTkSuQmCC",q.HUDDLE_TYPE_CONFIGS={audio:{audio:!0,video:!1,presentation:!1},video:{audio:!0,video:!0,presentation:!1},presentation:{audio:!1,video:!1,presentation:!0}},q.RecorderModes={VIDEO:"video",AUDIO:"audio",SCREEN:"screen",ALL:"all"},q.CommentAnnotationStatusMap={OPEN:{id:"OPEN",name:"Open",color:"var(--velt-accent, #625DF5)",lightColor:"var(--velt-accent-light, #E7E8FA)",type:"default",svg:`
|
|
6
6
|
<svg
|
|
7
7
|
width="16"
|
|
8
8
|
height="16"
|
|
@@ -147,11 +147,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
147
147
|
`+E+`
|
|
148
148
|
`+re})}function Rt(h,m,E,y,V,W,re){h.info(function(){return"XMLHTTP RESP ("+y+") [ attempt "+V+"]: "+m+`
|
|
149
149
|
`+E+`
|
|
150
|
-
`+W+" "+re})}function Lr(h,m,E,y){h.info(function(){return"XMLHTTP TEXT ("+m+"): "+Mp(h,E)+(y?" "+y:"")})}function rS(h,m){h.info(function(){return"TIMEOUT: "+m})}hc.prototype.info=function(){};function Mp(h,m){if(!h.g)return m;if(!m)return null;try{var E=JSON.parse(m);if(E){for(h=0;h<E.length;h++)if(Array.isArray(E[h])){var y=E[h];if(!(2>y.length)){var V=y[1];if(Array.isArray(V)&&!(1>V.length)){var W=V[0];if(W!="noop"&&W!="stop"&&W!="close")for(var re=1;re<V.length;re++)V[re]=""}}}}return ro(E)}catch{return m}}var Bs={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},ef={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},hu;function fu(){}p(fu,cu),fu.prototype.g=function(){return new XMLHttpRequest},fu.prototype.i=function(){return{}},hu=new fu;function en(h,m,E,y){this.j=h,this.i=m,this.l=E,this.R=y||1,this.U=new xs(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new tf}function tf(){this.i=null,this.g="",this.h=!1}var io={},nf={};function rf(h,m,E){h.L=1,h.v=Pp(Ye(m)),h.m=E,h.P=!0,of(h,null)}function of(h,m){h.F=Date.now(),Xo(h),h.A=Ye(h.v);var E=h.A,y=h.R;Array.isArray(y)||(y=[String(y)]),HM(E.i,"t",y),h.C=0,E=h.j.J,h.h=new tf,h.g=cP(h.j,E?m:null,!h.m),0<h.O&&(h.M=new bp(f(h.Y,h,h.g),h.O)),m=h.U,E=h.g,y=h.ca;var V="readystatechange";Array.isArray(V)||(V&&(su[0]=V.toString()),V=su);for(var W=0;W<V.length;W++){var re=Ps(E,V[W],y||m.handleEvent,!1,m.h||m);if(!re)break;m.g[re.key]=re}m=h.H?A(h.H):{},h.m?(h.u||(h.u="POST"),m["Content-Type"]="application/x-www-form-urlencoded",h.g.ea(h.A,h.u,h.m,m)):(h.u="GET",h.g.ea(h.A,h.u,null,m)),dc(),nS(h.i,h.u,h.A,h.l,h.R,h.m)}en.prototype.ca=function(h){h=h.target;let m=this.M;m&&es(h)==3?m.j():this.Y(h)},en.prototype.Y=function(h){try{if(h==this.g)e:{let jn=es(this.g);var m=this.g.Ba();let Eu=this.g.Z();if(!(3>jn)&&(jn!=3||this.g&&(this.h.h||this.g.oa()||XM(this.g)))){this.J||jn!=4||m==7||(m==8||0>=Eu?dc(3):dc(2)),Zo(this);var E=this.g.Z();this.X=E;t:if(sf(this)){var y=XM(this.g);h="";var V=y.length,W=es(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){oo(this),ir(this);var re="";break t}this.h.i=new a.TextDecoder}for(m=0;m<V;m++)this.h.h=!0,h+=this.h.i.decode(y[m],{stream:!(W&&m==V-1)});y.length=0,this.h.g+=h,this.C=0,re=this.h.g}else re=this.g.oa();if(this.o=E==200,Rt(this.i,this.u,this.A,this.l,this.R,jn,E),this.o){if(this.T&&!this.K){t:{if(this.g){var ct,Mn=this.g;if((ct=Mn.g?Mn.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!b(ct)){var ze=ct;break t}}ze=null}if(E=ze)Lr(this.i,this.l,E,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,gu(this,E);else{this.o=!1,this.s=3,dn(12),oo(this),ir(this);break e}}if(this.P){E=!0;let yi;for(;!this.J&&this.C<re.length;)if(yi=af(this,re),yi==nf){jn==4&&(this.s=4,dn(14),E=!1),Lr(this.i,this.l,null,"[Incomplete Response]");break}else if(yi==io){this.s=4,dn(15),Lr(this.i,this.l,re,"[Invalid Chunk]"),E=!1;break}else Lr(this.i,this.l,yi,null),gu(this,yi);if(sf(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),jn!=4||re.length!=0||this.h.h||(this.s=1,dn(16),E=!1),this.o=this.o&&E,!E)Lr(this.i,this.l,re,"[Invalid Chunked Response]"),oo(this),ir(this);else if(0<re.length&&!this.W){this.W=!0;var $n=this.j;$n.g==this&&$n.ba&&!$n.M&&($n.j.info("Great, no buffering proxy detected. Bytes received: "+re.length),cS($n),$n.M=!0,dn(11))}}else Lr(this.i,this.l,re,null),gu(this,re);jn==4&&oo(this),this.o&&!this.J&&(jn==4?iP(this.j,this):(this.o=!1,Xo(this)))}else
|
|
151
|
-
`,E);return y==-1?nf:(E=Number(m.substring(E,y)),isNaN(E)?io:(y+=1,y+E>m.length?nf:(m=m.slice(y,y+E),h.C=y+E,m)))}en.prototype.cancel=function(){this.J=!0,oo(this)};function Xo(h){h.S=Date.now()+h.I,Jo(h,h.I)}function Jo(h,m){if(h.B!=null)throw Error("WatchDog timer not null");h.B=vi(f(h.ba,h),m)}function Zo(h){h.B&&(a.clearTimeout(h.B),h.B=null)}en.prototype.ba=function(){this.B=null;let h=Date.now();0<=h-this.S?(rS(this.i,this.A),this.L!=2&&(dc(),dn(17)),oo(this),this.s=2,ir(this)):Jo(this,this.S-h)};function ir(h){h.j.G==0||h.J||iP(h.j,h)}function oo(h){Zo(h);var m=h.M;m&&typeof m.ma=="function"&&m.ma(),h.M=null,au(h.U),h.g&&(m=h.g,h.g=null,m.abort(),m.ma())}function gu(h,m){try{var E=h.j;if(E.G!=0&&(E.g==h||gc(E.h,h))){if(!h.K&&gc(E.h,h)&&E.G==3){try{var y=E.Da.g.parse(m)}catch{y=null}if(Array.isArray(y)&&y.length==3){var V=y;if(V[0]==0){e:if(!E.u){if(E.g)if(E.g.F+3e3<h.F)Vp(E),kp(E);else break e;aS(E),dn(18)}}else E.za=V[1],0<E.za-E.T&&37500>V[2]&&E.F&&E.v==0&&!E.C&&(E.C=vi(f(E.Za,E),6e3));if(1>=fc(E.h)&&E.ca){try{E.ca()}catch{}E.ca=void 0}}else mc(E,11)}else if((h.K||E.g==h)&&Vp(E),!b(m))for(V=E.Da.g.parse(m),m=0;m<V.length;m++){let ze=V[m];if(E.T=ze[0],ze=ze[1],E.G==2)if(ze[0]=="c"){E.K=ze[1],E.ia=ze[2];let $n=ze[3];$n!=null&&(E.la=$n,E.j.info("VER="+E.la));let jn=ze[4];jn!=null&&(E.Aa=jn,E.j.info("SVER="+E.Aa));let Eu=ze[5];Eu!=null&&typeof Eu=="number"&&0<Eu&&(y=1.5*Eu,E.L=y,E.j.info("backChannelRequestTimeoutMs_="+y)),y=E;let yi=h.g;if(yi){let Gp=yi.g?yi.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Gp){var W=y.h;W.g||Gp.indexOf("spdy")==-1&&Gp.indexOf("quic")==-1&&Gp.indexOf("h2")==-1||(W.j=W.l,W.g=new Set,W.h&&(se(W,W.h),W.h=null))}if(y.D){let lS=yi.g?yi.g.getResponseHeader("X-HTTP-Session-Id"):null;lS&&(y.ya=lS,rt(y.I,y.D,lS))}}E.G=3,E.l&&E.l.ua(),E.ba&&(E.R=Date.now()-h.F,E.j.info("Handshake RTT: "+E.R+"ms")),y=E;var re=h;if(y.qa=aP(y,y.J?y.ia:null,y.W),re.K){R(y.h,re);var ct=re,Mn=y.L;Mn&&(ct.I=Mn),ct.B&&(Zo(ct),Xo(ct)),y.g=re}else nP(y);0<E.i.length&&Up(E)}else ze[0]!="stop"&&ze[0]!="close"||mc(E,7);else E.G==3&&(ze[0]=="stop"||ze[0]=="close"?ze[0]=="stop"?mc(E,7):sS(E):ze[0]!="noop"&&E.l&&E.l.ta(ze),E.v=0)}}dc(4)}catch{}}var iS=class{constructor(h,m){this.g=h,this.map=m}};function cf(h){this.l=h||10,a.PerformanceNavigationTiming?(h=a.performance.getEntriesByType("navigation"),h=0<h.length&&(h[0].nextHopProtocol=="hq"||h[0].nextHopProtocol=="h2")):h=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=h?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function lf(h){return h.h?!0:h.g?h.g.size>=h.j:!1}function fc(h){return h.h?1:h.g?h.g.size:0}function gc(h,m){return h.h?h.h==m:h.g?h.g.has(m):!1}function se(h,m){h.g?h.g.add(m):h.h=m}function R(h,m){h.h&&h.h==m?h.h=null:h.g&&h.g.has(m)&&h.g.delete(m)}cf.prototype.cancel=function(){if(this.i=z(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let h of this.g.values())h.cancel();this.g.clear()}};function z(h){if(h.h!=null)return h.i.concat(h.h.D);if(h.g!=null&&h.g.size!==0){let m=h.i;for(let E of h.g.values())m=m.concat(E.D);return m}return _(h.i)}function te(h){if(h.V&&typeof h.V=="function")return h.V();if(typeof Map<"u"&&h instanceof Map||typeof Set<"u"&&h instanceof Set)return Array.from(h.values());if(typeof h=="string")return h.split("");if(c(h)){for(var m=[],E=h.length,y=0;y<E;y++)m.push(h[y]);return m}m=[],E=0;for(y in h)m[E++]=h[y];return m}function ve(h){if(h.na&&typeof h.na=="function")return h.na();if(!h.V||typeof h.V!="function"){if(typeof Map<"u"&&h instanceof Map)return Array.from(h.keys());if(!(typeof Set<"u"&&h instanceof Set)){if(c(h)||typeof h=="string"){var m=[];h=h.length;for(var E=0;E<h;E++)m.push(E);return m}m=[],E=0;for(let y in h)m[E++]=y;return m}}}function Ce(h,m){if(h.forEach&&typeof h.forEach=="function")h.forEach(m,void 0);else if(c(h)||typeof h=="string")Array.prototype.forEach.call(h,m,void 0);else for(var E=ve(h),y=te(h),V=y.length,W=0;W<V;W++)m.call(void 0,y[W],E&&E[W],h)}var Ne=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Kt(h,m){if(h){h=h.split("&");for(var E=0;E<h.length;E++){var y=h[E].indexOf("="),V=null;if(0<=y){var W=h[E].substring(0,y);V=h[E].substring(y+1)}else W=h[E];m(W,V?decodeURIComponent(V.replace(/\+/g," ")):"")}}}function je(h){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,h instanceof je){this.h=h.h,Mr(this,h.j),this.o=h.o,this.g=h.g,xt(this,h.s),this.l=h.l;var m=h.i,E=new ff;E.i=m.i,m.g&&(E.g=new Map(m.g),E.h=m.h),uf(this,E),this.m=h.m}else h&&(m=String(h).match(Ne))?(this.h=!1,Mr(this,m[1]||"",!0),this.o=df(m[2]||""),this.g=df(m[3]||"",!0),xt(this,m[4]),this.l=df(m[5]||"",!0),uf(this,m[6]||"",!0),this.m=df(m[7]||"")):(this.h=!1,this.i=new ff(null,this.h))}je.prototype.toString=function(){var h=[],m=this.j;m&&h.push(hf(m,GM,!0),":");var E=this.g;return(E||m=="file")&&(h.push("//"),(m=this.o)&&h.push(hf(m,GM,!0),"@"),h.push(encodeURIComponent(String(E)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),E=this.s,E!=null&&h.push(":",String(E))),(E=this.l)&&(this.g&&E.charAt(0)!="/"&&h.push("/"),h.push(hf(E,E.charAt(0)=="/"?rz:nz,!0))),(E=this.i.toString())&&h.push("?",E),(E=this.m)&&h.push("#",hf(E,oz)),h.join("")};function Ye(h){return new je(h)}function Mr(h,m,E){h.j=E?df(m,!0):m,h.j&&(h.j=h.j.replace(/:$/,""))}function xt(h,m){if(m){if(m=Number(m),isNaN(m)||0>m)throw Error("Bad port number "+m);h.s=m}else h.s=null}function uf(h,m,E){m instanceof ff?(h.i=m,sz(h.i,h.h)):(E||(m=hf(m,iz)),h.i=new ff(m,h.h))}function rt(h,m,E){h.i.set(m,E)}function Pp(h){return rt(h,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),h}function df(h,m){return h?m?decodeURI(h.replace(/%25/g,"%2525")):decodeURIComponent(h):""}function hf(h,m,E){return typeof h=="string"?(h=encodeURI(h).replace(m,tz),E&&(h=h.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h):null}function tz(h){return h=h.charCodeAt(0),"%"+(h>>4&15).toString(16)+(h&15).toString(16)}var GM=/[#\/\?@]/g,nz=/[#\?:]/g,rz=/[#\?]/g,iz=/[#\?@]/g,oz=/#/g;function ff(h,m){this.h=this.g=null,this.i=h||null,this.j=!!m}function Gs(h){h.g||(h.g=new Map,h.h=0,h.i&&Kt(h.i,function(m,E){h.add(decodeURIComponent(m.replace(/\+/g," ")),E)}))}n=ff.prototype,n.add=function(h,m){Gs(this),this.i=null,h=mu(this,h);var E=this.g.get(h);return E||this.g.set(h,E=[]),E.push(m),this.h+=1,this};function $M(h,m){Gs(h),m=mu(h,m),h.g.has(m)&&(h.i=null,h.h-=h.g.get(m).length,h.g.delete(m))}function jM(h,m){return Gs(h),m=mu(h,m),h.g.has(m)}n.forEach=function(h,m){Gs(this),this.g.forEach(function(E,y){E.forEach(function(V){h.call(m,V,y,this)},this)},this)},n.na=function(){Gs(this);let h=Array.from(this.g.values()),m=Array.from(this.g.keys()),E=[];for(let y=0;y<m.length;y++){let V=h[y];for(let W=0;W<V.length;W++)E.push(m[y])}return E},n.V=function(h){Gs(this);let m=[];if(typeof h=="string")jM(this,h)&&(m=m.concat(this.g.get(mu(this,h))));else{h=Array.from(this.g.values());for(let E=0;E<h.length;E++)m=m.concat(h[E])}return m},n.set=function(h,m){return Gs(this),this.i=null,h=mu(this,h),jM(this,h)&&(this.h-=this.g.get(h).length),this.g.set(h,[m]),this.h+=1,this},n.get=function(h,m){return h?(h=this.V(h),0<h.length?String(h[0]):m):m};function HM(h,m,E){$M(h,m),0<E.length&&(h.i=null,h.g.set(mu(h,m),_(E)),h.h+=E.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let h=[],m=Array.from(this.g.keys());for(var E=0;E<m.length;E++){var y=m[E];let W=encodeURIComponent(String(y)),re=this.V(y);for(y=0;y<re.length;y++){var V=W;re[y]!==""&&(V+="="+encodeURIComponent(String(re[y]))),h.push(V)}}return this.i=h.join("&")};function mu(h,m){return m=String(m),h.j&&(m=m.toLowerCase()),m}function sz(h,m){m&&!h.j&&(Gs(h),h.i=null,h.g.forEach(function(E,y){var V=y.toLowerCase();y!=V&&($M(this,y),HM(this,V,E))},h)),h.j=m}function az(h,m){let E=new hc;if(a.Image){let y=new Image;y.onload=g($s,E,"TestLoadImage: loaded",!0,m,y),y.onerror=g($s,E,"TestLoadImage: error",!1,m,y),y.onabort=g($s,E,"TestLoadImage: abort",!1,m,y),y.ontimeout=g($s,E,"TestLoadImage: timeout",!1,m,y),a.setTimeout(function(){y.ontimeout&&y.ontimeout()},1e4),y.src=h}else m(!1)}function cz(h,m){let E=new hc,y=new AbortController,V=setTimeout(()=>{y.abort(),$s(E,"TestPingServer: timeout",!1,m)},1e4);fetch(h,{signal:y.signal}).then(W=>{clearTimeout(V),W.ok?$s(E,"TestPingServer: ok",!0,m):$s(E,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(V),$s(E,"TestPingServer: error",!1,m)})}function $s(h,m,E,y,V){try{V&&(V.onload=null,V.onerror=null,V.onabort=null,V.ontimeout=null),y(E)}catch{}}function lz(){this.g=new Jh}function uz(h,m,E){let y=E||"";try{Ce(h,function(V,W){let re=V;l(V)&&(re=ro(V)),m.push(y+W+"="+encodeURIComponent(re))})}catch(V){throw m.push(y+"type="+encodeURIComponent("_badmap")),V}}function gf(h){this.l=h.Ub||null,this.j=h.eb||!1}p(gf,cu),gf.prototype.g=function(){return new xp(this.l,this.j)},gf.prototype.i=(function(h){return function(){return h}})({});function xp(h,m){Zt.call(this),this.D=h,this.o=m,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}p(xp,Zt),n=xp.prototype,n.open=function(h,m){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=h,this.A=m,this.readyState=1,pf(this)},n.send=function(h){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let m={headers:this.u,method:this.B,credentials:this.m,cache:void 0};h&&(m.body=h),(this.D||a).fetch(new Request(this.A,m)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,mf(this)),this.readyState=0},n.Sa=function(h){if(this.g&&(this.l=h,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=h.headers,this.readyState=2,pf(this)),this.g&&(this.readyState=3,pf(this),this.g)))if(this.responseType==="arraybuffer")h.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in h){if(this.j=h.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.v=new TextDecoder;WM(this)}else h.text().then(this.Ra.bind(this),this.ga.bind(this))};function WM(h){h.j.read().then(h.Pa.bind(h)).catch(h.ga.bind(h))}n.Pa=function(h){if(this.g){if(this.o&&h.value)this.response.push(h.value);else if(!this.o){var m=h.value?h.value:new Uint8Array(0);(m=this.v.decode(m,{stream:!h.done}))&&(this.response=this.responseText+=m)}h.done?mf(this):pf(this),this.readyState==3&&WM(this)}},n.Ra=function(h){this.g&&(this.response=this.responseText=h,mf(this))},n.Qa=function(h){this.g&&(this.response=h,mf(this))},n.ga=function(){this.g&&mf(this)};function mf(h){h.readyState=4,h.l=null,h.j=null,h.v=null,pf(h)}n.setRequestHeader=function(h,m){this.u.append(h,m)},n.getResponseHeader=function(h){return this.h&&this.h.get(h.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let h=[],m=this.h.entries();for(var E=m.next();!E.done;)E=E.value,h.push(E[0]+": "+E[1]),E=m.next();return h.join(`\r
|
|
150
|
+
`+W+" "+re})}function Lr(h,m,E,y){h.info(function(){return"XMLHTTP TEXT ("+m+"): "+Mp(h,E)+(y?" "+y:"")})}function rS(h,m){h.info(function(){return"TIMEOUT: "+m})}hc.prototype.info=function(){};function Mp(h,m){if(!h.g)return m;if(!m)return null;try{var E=JSON.parse(m);if(E){for(h=0;h<E.length;h++)if(Array.isArray(E[h])){var y=E[h];if(!(2>y.length)){var V=y[1];if(Array.isArray(V)&&!(1>V.length)){var W=V[0];if(W!="noop"&&W!="stop"&&W!="close")for(var re=1;re<V.length;re++)V[re]=""}}}}return ro(E)}catch{return m}}var Bs={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},ef={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},hu;function fu(){}p(fu,cu),fu.prototype.g=function(){return new XMLHttpRequest},fu.prototype.i=function(){return{}},hu=new fu;function en(h,m,E,y){this.j=h,this.i=m,this.l=E,this.R=y||1,this.U=new xs(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new tf}function tf(){this.i=null,this.g="",this.h=!1}var io={},nf={};function rf(h,m,E){h.L=1,h.v=Pp(Ye(m)),h.m=E,h.P=!0,of(h,null)}function of(h,m){h.F=Date.now(),Xo(h),h.A=Ye(h.v);var E=h.A,y=h.R;Array.isArray(y)||(y=[String(y)]),HM(E.i,"t",y),h.C=0,E=h.j.J,h.h=new tf,h.g=cP(h.j,E?m:null,!h.m),0<h.O&&(h.M=new bp(f(h.Y,h,h.g),h.O)),m=h.U,E=h.g,y=h.ca;var V="readystatechange";Array.isArray(V)||(V&&(su[0]=V.toString()),V=su);for(var W=0;W<V.length;W++){var re=Ps(E,V[W],y||m.handleEvent,!1,m.h||m);if(!re)break;m.g[re.key]=re}m=h.H?A(h.H):{},h.m?(h.u||(h.u="POST"),m["Content-Type"]="application/x-www-form-urlencoded",h.g.ea(h.A,h.u,h.m,m)):(h.u="GET",h.g.ea(h.A,h.u,null,m)),dc(),nS(h.i,h.u,h.A,h.l,h.R,h.m)}en.prototype.ca=function(h){h=h.target;let m=this.M;m&&es(h)==3?m.j():this.Y(h)},en.prototype.Y=function(h){try{if(h==this.g)e:{let jn=es(this.g);var m=this.g.Ba();let Eu=this.g.Z();if(!(3>jn)&&(jn!=3||this.g&&(this.h.h||this.g.oa()||XM(this.g)))){this.J||jn!=4||m==7||(m==8||0>=Eu?dc(3):dc(2)),Zo(this);var E=this.g.Z();this.X=E;t:if(sf(this)){var y=XM(this.g);h="";var V=y.length,W=es(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){oo(this),ir(this);var re="";break t}this.h.i=new a.TextDecoder}for(m=0;m<V;m++)this.h.h=!0,h+=this.h.i.decode(y[m],{stream:!(W&&m==V-1)});y.length=0,this.h.g+=h,this.C=0,re=this.h.g}else re=this.g.oa();if(this.o=E==200,Rt(this.i,this.u,this.A,this.l,this.R,jn,E),this.o){if(this.T&&!this.K){t:{if(this.g){var ct,Mn=this.g;if((ct=Mn.g?Mn.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!b(ct)){var ze=ct;break t}}ze=null}if(E=ze)Lr(this.i,this.l,E,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,gu(this,E);else{this.o=!1,this.s=3,dn(12),oo(this),ir(this);break e}}if(this.P){E=!0;let yi;for(;!this.J&&this.C<re.length;)if(yi=af(this,re),yi==nf){jn==4&&(this.s=4,dn(14),E=!1),Lr(this.i,this.l,null,"[Incomplete Response]");break}else if(yi==io){this.s=4,dn(15),Lr(this.i,this.l,re,"[Invalid Chunk]"),E=!1;break}else Lr(this.i,this.l,yi,null),gu(this,yi);if(sf(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),jn!=4||re.length!=0||this.h.h||(this.s=1,dn(16),E=!1),this.o=this.o&&E,!E)Lr(this.i,this.l,re,"[Invalid Chunked Response]"),oo(this),ir(this);else if(0<re.length&&!this.W){this.W=!0;var $n=this.j;$n.g==this&&$n.ba&&!$n.M&&($n.j.info("Great, no buffering proxy detected. Bytes received: "+re.length),cS($n),$n.M=!0,dn(11))}}else Lr(this.i,this.l,re,null),gu(this,re);jn==4&&oo(this),this.o&&!this.J&&(jn==4?iP(this.j,this):(this.o=!1,Xo(this)))}else f3(this.g),E==400&&0<re.indexOf("Unknown SID")?(this.s=3,dn(12)):(this.s=0,dn(13)),oo(this),ir(this)}}}catch{}};function sf(h){return h.g?h.u=="GET"&&h.L!=2&&h.j.Ca:!1}function af(h,m){var E=h.C,y=m.indexOf(`
|
|
151
|
+
`,E);return y==-1?nf:(E=Number(m.substring(E,y)),isNaN(E)?io:(y+=1,y+E>m.length?nf:(m=m.slice(y,y+E),h.C=y+E,m)))}en.prototype.cancel=function(){this.J=!0,oo(this)};function Xo(h){h.S=Date.now()+h.I,Jo(h,h.I)}function Jo(h,m){if(h.B!=null)throw Error("WatchDog timer not null");h.B=vi(f(h.ba,h),m)}function Zo(h){h.B&&(a.clearTimeout(h.B),h.B=null)}en.prototype.ba=function(){this.B=null;let h=Date.now();0<=h-this.S?(rS(this.i,this.A),this.L!=2&&(dc(),dn(17)),oo(this),this.s=2,ir(this)):Jo(this,this.S-h)};function ir(h){h.j.G==0||h.J||iP(h.j,h)}function oo(h){Zo(h);var m=h.M;m&&typeof m.ma=="function"&&m.ma(),h.M=null,au(h.U),h.g&&(m=h.g,h.g=null,m.abort(),m.ma())}function gu(h,m){try{var E=h.j;if(E.G!=0&&(E.g==h||gc(E.h,h))){if(!h.K&&gc(E.h,h)&&E.G==3){try{var y=E.Da.g.parse(m)}catch{y=null}if(Array.isArray(y)&&y.length==3){var V=y;if(V[0]==0){e:if(!E.u){if(E.g)if(E.g.F+3e3<h.F)Vp(E),kp(E);else break e;aS(E),dn(18)}}else E.za=V[1],0<E.za-E.T&&37500>V[2]&&E.F&&E.v==0&&!E.C&&(E.C=vi(f(E.Za,E),6e3));if(1>=fc(E.h)&&E.ca){try{E.ca()}catch{}E.ca=void 0}}else mc(E,11)}else if((h.K||E.g==h)&&Vp(E),!b(m))for(V=E.Da.g.parse(m),m=0;m<V.length;m++){let ze=V[m];if(E.T=ze[0],ze=ze[1],E.G==2)if(ze[0]=="c"){E.K=ze[1],E.ia=ze[2];let $n=ze[3];$n!=null&&(E.la=$n,E.j.info("VER="+E.la));let jn=ze[4];jn!=null&&(E.Aa=jn,E.j.info("SVER="+E.Aa));let Eu=ze[5];Eu!=null&&typeof Eu=="number"&&0<Eu&&(y=1.5*Eu,E.L=y,E.j.info("backChannelRequestTimeoutMs_="+y)),y=E;let yi=h.g;if(yi){let Gp=yi.g?yi.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Gp){var W=y.h;W.g||Gp.indexOf("spdy")==-1&&Gp.indexOf("quic")==-1&&Gp.indexOf("h2")==-1||(W.j=W.l,W.g=new Set,W.h&&(se(W,W.h),W.h=null))}if(y.D){let lS=yi.g?yi.g.getResponseHeader("X-HTTP-Session-Id"):null;lS&&(y.ya=lS,rt(y.I,y.D,lS))}}E.G=3,E.l&&E.l.ua(),E.ba&&(E.R=Date.now()-h.F,E.j.info("Handshake RTT: "+E.R+"ms")),y=E;var re=h;if(y.qa=aP(y,y.J?y.ia:null,y.W),re.K){R(y.h,re);var ct=re,Mn=y.L;Mn&&(ct.I=Mn),ct.B&&(Zo(ct),Xo(ct)),y.g=re}else nP(y);0<E.i.length&&Up(E)}else ze[0]!="stop"&&ze[0]!="close"||mc(E,7);else E.G==3&&(ze[0]=="stop"||ze[0]=="close"?ze[0]=="stop"?mc(E,7):sS(E):ze[0]!="noop"&&E.l&&E.l.ta(ze),E.v=0)}}dc(4)}catch{}}var iS=class{constructor(h,m){this.g=h,this.map=m}};function cf(h){this.l=h||10,a.PerformanceNavigationTiming?(h=a.performance.getEntriesByType("navigation"),h=0<h.length&&(h[0].nextHopProtocol=="hq"||h[0].nextHopProtocol=="h2")):h=!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.chrome.loadTimes().wasFetchedViaSpdy),this.j=h?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function lf(h){return h.h?!0:h.g?h.g.size>=h.j:!1}function fc(h){return h.h?1:h.g?h.g.size:0}function gc(h,m){return h.h?h.h==m:h.g?h.g.has(m):!1}function se(h,m){h.g?h.g.add(m):h.h=m}function R(h,m){h.h&&h.h==m?h.h=null:h.g&&h.g.has(m)&&h.g.delete(m)}cf.prototype.cancel=function(){if(this.i=z(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let h of this.g.values())h.cancel();this.g.clear()}};function z(h){if(h.h!=null)return h.i.concat(h.h.D);if(h.g!=null&&h.g.size!==0){let m=h.i;for(let E of h.g.values())m=m.concat(E.D);return m}return _(h.i)}function te(h){if(h.V&&typeof h.V=="function")return h.V();if(typeof Map<"u"&&h instanceof Map||typeof Set<"u"&&h instanceof Set)return Array.from(h.values());if(typeof h=="string")return h.split("");if(c(h)){for(var m=[],E=h.length,y=0;y<E;y++)m.push(h[y]);return m}m=[],E=0;for(y in h)m[E++]=h[y];return m}function ve(h){if(h.na&&typeof h.na=="function")return h.na();if(!h.V||typeof h.V!="function"){if(typeof Map<"u"&&h instanceof Map)return Array.from(h.keys());if(!(typeof Set<"u"&&h instanceof Set)){if(c(h)||typeof h=="string"){var m=[];h=h.length;for(var E=0;E<h;E++)m.push(E);return m}m=[],E=0;for(let y in h)m[E++]=y;return m}}}function Ce(h,m){if(h.forEach&&typeof h.forEach=="function")h.forEach(m,void 0);else if(c(h)||typeof h=="string")Array.prototype.forEach.call(h,m,void 0);else for(var E=ve(h),y=te(h),V=y.length,W=0;W<V;W++)m.call(void 0,y[W],E&&E[W],h)}var Ne=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Kt(h,m){if(h){h=h.split("&");for(var E=0;E<h.length;E++){var y=h[E].indexOf("="),V=null;if(0<=y){var W=h[E].substring(0,y);V=h[E].substring(y+1)}else W=h[E];m(W,V?decodeURIComponent(V.replace(/\+/g," ")):"")}}}function je(h){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,h instanceof je){this.h=h.h,Mr(this,h.j),this.o=h.o,this.g=h.g,xt(this,h.s),this.l=h.l;var m=h.i,E=new ff;E.i=m.i,m.g&&(E.g=new Map(m.g),E.h=m.h),uf(this,E),this.m=h.m}else h&&(m=String(h).match(Ne))?(this.h=!1,Mr(this,m[1]||"",!0),this.o=df(m[2]||""),this.g=df(m[3]||"",!0),xt(this,m[4]),this.l=df(m[5]||"",!0),uf(this,m[6]||"",!0),this.m=df(m[7]||"")):(this.h=!1,this.i=new ff(null,this.h))}je.prototype.toString=function(){var h=[],m=this.j;m&&h.push(hf(m,GM,!0),":");var E=this.g;return(E||m=="file")&&(h.push("//"),(m=this.o)&&h.push(hf(m,GM,!0),"@"),h.push(encodeURIComponent(String(E)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),E=this.s,E!=null&&h.push(":",String(E))),(E=this.l)&&(this.g&&E.charAt(0)!="/"&&h.push("/"),h.push(hf(E,E.charAt(0)=="/"?r3:n3,!0))),(E=this.i.toString())&&h.push("?",E),(E=this.m)&&h.push("#",hf(E,o3)),h.join("")};function Ye(h){return new je(h)}function Mr(h,m,E){h.j=E?df(m,!0):m,h.j&&(h.j=h.j.replace(/:$/,""))}function xt(h,m){if(m){if(m=Number(m),isNaN(m)||0>m)throw Error("Bad port number "+m);h.s=m}else h.s=null}function uf(h,m,E){m instanceof ff?(h.i=m,s3(h.i,h.h)):(E||(m=hf(m,i3)),h.i=new ff(m,h.h))}function rt(h,m,E){h.i.set(m,E)}function Pp(h){return rt(h,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),h}function df(h,m){return h?m?decodeURI(h.replace(/%25/g,"%2525")):decodeURIComponent(h):""}function hf(h,m,E){return typeof h=="string"?(h=encodeURI(h).replace(m,t3),E&&(h=h.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h):null}function t3(h){return h=h.charCodeAt(0),"%"+(h>>4&15).toString(16)+(h&15).toString(16)}var GM=/[#\/\?@]/g,n3=/[#\?:]/g,r3=/[#\?]/g,i3=/[#\?@]/g,o3=/#/g;function ff(h,m){this.h=this.g=null,this.i=h||null,this.j=!!m}function Gs(h){h.g||(h.g=new Map,h.h=0,h.i&&Kt(h.i,function(m,E){h.add(decodeURIComponent(m.replace(/\+/g," ")),E)}))}n=ff.prototype,n.add=function(h,m){Gs(this),this.i=null,h=mu(this,h);var E=this.g.get(h);return E||this.g.set(h,E=[]),E.push(m),this.h+=1,this};function $M(h,m){Gs(h),m=mu(h,m),h.g.has(m)&&(h.i=null,h.h-=h.g.get(m).length,h.g.delete(m))}function jM(h,m){return Gs(h),m=mu(h,m),h.g.has(m)}n.forEach=function(h,m){Gs(this),this.g.forEach(function(E,y){E.forEach(function(V){h.call(m,V,y,this)},this)},this)},n.na=function(){Gs(this);let h=Array.from(this.g.values()),m=Array.from(this.g.keys()),E=[];for(let y=0;y<m.length;y++){let V=h[y];for(let W=0;W<V.length;W++)E.push(m[y])}return E},n.V=function(h){Gs(this);let m=[];if(typeof h=="string")jM(this,h)&&(m=m.concat(this.g.get(mu(this,h))));else{h=Array.from(this.g.values());for(let E=0;E<h.length;E++)m=m.concat(h[E])}return m},n.set=function(h,m){return Gs(this),this.i=null,h=mu(this,h),jM(this,h)&&(this.h-=this.g.get(h).length),this.g.set(h,[m]),this.h+=1,this},n.get=function(h,m){return h?(h=this.V(h),0<h.length?String(h[0]):m):m};function HM(h,m,E){$M(h,m),0<E.length&&(h.i=null,h.g.set(mu(h,m),_(E)),h.h+=E.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let h=[],m=Array.from(this.g.keys());for(var E=0;E<m.length;E++){var y=m[E];let W=encodeURIComponent(String(y)),re=this.V(y);for(y=0;y<re.length;y++){var V=W;re[y]!==""&&(V+="="+encodeURIComponent(String(re[y]))),h.push(V)}}return this.i=h.join("&")};function mu(h,m){return m=String(m),h.j&&(m=m.toLowerCase()),m}function s3(h,m){m&&!h.j&&(Gs(h),h.i=null,h.g.forEach(function(E,y){var V=y.toLowerCase();y!=V&&($M(this,y),HM(this,V,E))},h)),h.j=m}function a3(h,m){let E=new hc;if(a.Image){let y=new Image;y.onload=g($s,E,"TestLoadImage: loaded",!0,m,y),y.onerror=g($s,E,"TestLoadImage: error",!1,m,y),y.onabort=g($s,E,"TestLoadImage: abort",!1,m,y),y.ontimeout=g($s,E,"TestLoadImage: timeout",!1,m,y),a.setTimeout(function(){y.ontimeout&&y.ontimeout()},1e4),y.src=h}else m(!1)}function c3(h,m){let E=new hc,y=new AbortController,V=setTimeout(()=>{y.abort(),$s(E,"TestPingServer: timeout",!1,m)},1e4);fetch(h,{signal:y.signal}).then(W=>{clearTimeout(V),W.ok?$s(E,"TestPingServer: ok",!0,m):$s(E,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(V),$s(E,"TestPingServer: error",!1,m)})}function $s(h,m,E,y,V){try{V&&(V.onload=null,V.onerror=null,V.onabort=null,V.ontimeout=null),y(E)}catch{}}function l3(){this.g=new Jh}function u3(h,m,E){let y=E||"";try{Ce(h,function(V,W){let re=V;l(V)&&(re=ro(V)),m.push(y+W+"="+encodeURIComponent(re))})}catch(V){throw m.push(y+"type="+encodeURIComponent("_badmap")),V}}function gf(h){this.l=h.Ub||null,this.j=h.eb||!1}p(gf,cu),gf.prototype.g=function(){return new xp(this.l,this.j)},gf.prototype.i=(function(h){return function(){return h}})({});function xp(h,m){Zt.call(this),this.D=h,this.o=m,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}p(xp,Zt),n=xp.prototype,n.open=function(h,m){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=h,this.A=m,this.readyState=1,pf(this)},n.send=function(h){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let m={headers:this.u,method:this.B,credentials:this.m,cache:void 0};h&&(m.body=h),(this.D||a).fetch(new Request(this.A,m)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,mf(this)),this.readyState=0},n.Sa=function(h){if(this.g&&(this.l=h,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=h.headers,this.readyState=2,pf(this)),this.g&&(this.readyState=3,pf(this),this.g)))if(this.responseType==="arraybuffer")h.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof a.ReadableStream<"u"&&"body"in h){if(this.j=h.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.v=new TextDecoder;WM(this)}else h.text().then(this.Ra.bind(this),this.ga.bind(this))};function WM(h){h.j.read().then(h.Pa.bind(h)).catch(h.ga.bind(h))}n.Pa=function(h){if(this.g){if(this.o&&h.value)this.response.push(h.value);else if(!this.o){var m=h.value?h.value:new Uint8Array(0);(m=this.v.decode(m,{stream:!h.done}))&&(this.response=this.responseText+=m)}h.done?mf(this):pf(this),this.readyState==3&&WM(this)}},n.Ra=function(h){this.g&&(this.response=this.responseText=h,mf(this))},n.Qa=function(h){this.g&&(this.response=h,mf(this))},n.ga=function(){this.g&&mf(this)};function mf(h){h.readyState=4,h.l=null,h.j=null,h.v=null,pf(h)}n.setRequestHeader=function(h,m){this.u.append(h,m)},n.getResponseHeader=function(h){return this.h&&this.h.get(h.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let h=[],m=this.h.entries();for(var E=m.next();!E.done;)E=E.value,h.push(E[0]+": "+E[1]),E=m.next();return h.join(`\r
|
|
152
152
|
`)};function pf(h){h.onreadystatechange&&h.onreadystatechange.call(h)}Object.defineProperty(xp.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(h){this.m=h?"include":"same-origin"}});function zM(h){let m="";return k(h,function(E,y){m+=y,m+=":",m+=E,m+=`\r
|
|
153
|
-
`}),m}function oS(h,m,E){e:{for(y in E){var y=!1;break e}y=!0}y||(E=zM(E),typeof h=="string"?E!=null&&encodeURIComponent(String(E)):rt(h,m,E))}function Gt(h){Zt.call(this),this.headers=new Map,this.o=h||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}p(Gt,Zt);var
|
|
154
|
-
`);for(let y=0;y<h.length;y++){if(b(h[y]))continue;var E=P(h[y]);let V=E[0];if(E=E[1],typeof E!="string")continue;E=E.trim();let W=m[V]||[];m[V]=W,W.push(E)}S(m,function(y){return y.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Ef(h,m,E){return E&&E.internalChannelParams&&E.internalChannelParams[h]||m}function JM(h){this.Aa=0,this.i=[],this.j=new hc,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Ef("failFast",!1,h),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Ef("baseRetryDelayMs",5e3,h),this.cb=Ef("retryDelaySeedMs",1e4,h),this.Wa=Ef("forwardChannelMaxRetries",2,h),this.wa=Ef("forwardChannelRequestTimeoutMs",2e4,h),this.pa=h&&h.xmlHttpFactory||void 0,this.Xa=h&&h.Tb||void 0,this.Ca=h&&h.useFetchStreams||!1,this.L=void 0,this.J=h&&h.supportsCrossDomainXhr||!1,this.K="",this.h=new cf(h&&h.concurrentRequestLimit),this.Da=new lz,this.P=h&&h.fastHandshake||!1,this.O=h&&h.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=h&&h.Rb||!1,h&&h.xa&&this.j.xa(),h&&h.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&h&&h.detectBufferingProxy||!1,this.ja=void 0,h&&h.longPollingTimeout&&0<h.longPollingTimeout&&(this.ja=h.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=JM.prototype,n.la=8,n.G=1,n.connect=function(h,m,E,y){dn(0),this.W=h,this.H=m||{},E&&y!==void 0&&(this.H.OSID=E,this.H.OAID=y),this.F=this.X,this.I=aP(this,null,this.W),Up(this)};function sS(h){if(ZM(h),h.G==3){var m=h.U++,E=Ye(h.I);if(rt(E,"SID",h.K),rt(E,"RID",m),rt(E,"TYPE","terminate"),_f(h,E),m=new en(h,h.j,m),m.L=2,m.v=Pp(Ye(E)),E=!1,a.navigator&&a.navigator.sendBeacon)try{E=a.navigator.sendBeacon(m.v.toString(),"")}catch{}!E&&a.Image&&(new Image().src=m.v,E=!0),E||(m.g=cP(m.j,null),m.g.ea(m.v)),m.F=Date.now(),Xo(m)}sP(h)}function kp(h){h.g&&(cS(h),h.g.cancel(),h.g=null)}function ZM(h){kp(h),h.u&&(a.clearTimeout(h.u),h.u=null),Vp(h),h.h.cancel(),h.s&&(typeof h.s=="number"&&a.clearTimeout(h.s),h.s=null)}function Up(h){if(!lf(h.h)&&!h.s){h.s=!0;var m=h.Ga;Ms||Op(),nc||(Ms(),nc=!0),Kh.add(m,h),h.B=0}}function gz(h,m){return fc(h.h)>=h.h.j-(h.s?1:0)?!1:h.s?(h.i=m.D.concat(h.i),!0):h.G==1||h.G==2||h.B>=(h.Va?0:h.Wa)?!1:(h.s=vi(f(h.Ga,h,m),oP(h,h.B)),h.B++,!0)}n.Ga=function(h){if(this.s)if(this.s=null,this.G==1){if(!h){this.U=Math.floor(1e5*Math.random()),h=this.U++;let V=new en(this,this.j,h),W=this.o;if(this.S&&(W?(W=A(W),O(W,this.S)):W=this.S),this.m!==null||this.O||(V.H=W,W=null),this.P)e:{for(var m=0,E=0;E<this.i.length;E++){t:{var y=this.i[E];if("__data__"in y.map&&(y=y.map.__data__,typeof y=="string")){y=y.length;break t}y=void 0}if(y===void 0)break;if(m+=y,4096<m){m=E;break e}if(m===4096||E===this.i.length-1){m=E+1;break e}}m=1e3}else m=1e3;m=tP(this,V,m),E=Ye(this.I),rt(E,"RID",h),rt(E,"CVER",22),this.D&&rt(E,"X-HTTP-Session-Id",this.D),_f(this,E),W&&(this.O?m="headers="+encodeURIComponent(String(zM(W)))+"&"+m:this.m&&oS(E,this.m,W)),se(this.h,V),this.Ua&&rt(E,"TYPE","init"),this.P?(rt(E,"$req",m),rt(E,"SID","null"),V.T=!0,rf(V,E,null)):rf(V,E,m),this.G=2}}else this.G==3&&(h?eP(this,h):this.i.length==0||lf(this.h)||eP(this))};function eP(h,m){var E;m?E=m.l:E=h.U++;let y=Ye(h.I);rt(y,"SID",h.K),rt(y,"RID",E),rt(y,"AID",h.T),_f(h,y),h.m&&h.o&&oS(y,h.m,h.o),E=new en(h,h.j,E,h.B+1),h.m===null&&(E.H=h.o),m&&(h.i=m.D.concat(h.i)),m=tP(h,E,1e3),E.I=Math.round(.5*h.wa)+Math.round(.5*h.wa*Math.random()),se(h.h,E),rf(E,y,m)}function _f(h,m){h.H&&k(h.H,function(E,y){rt(m,y,E)}),h.l&&Ce({},function(E,y){rt(m,y,E)})}function tP(h,m,E){E=Math.min(h.i.length,E);var y=h.l?f(h.l.Na,h.l,h):null;e:{var V=h.i;let W=-1;for(;;){let re=["count="+E];W==-1?0<E?(W=V[0].g,re.push("ofs="+W)):W=0:re.push("ofs="+W);let ct=!0;for(let Mn=0;Mn<E;Mn++){let ze=V[Mn].g,$n=V[Mn].map;if(ze-=W,0>ze)W=Math.max(0,V[Mn].g-100),ct=!1;else try{uz($n,re,"req"+ze+"_")}catch{y&&y($n)}}if(ct){y=re.join("&");break e}}}return h=h.i.splice(0,E),m.D=h,y}function nP(h){if(!h.g&&!h.u){h.Y=1;var m=h.Fa;Ms||Op(),nc||(Ms(),nc=!0),Kh.add(m,h),h.v=0}}function aS(h){return h.g||h.u||3<=h.v?!1:(h.Y++,h.u=vi(f(h.Fa,h),oP(h,h.v)),h.v++,!0)}n.Fa=function(){if(this.u=null,rP(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var h=2*this.R;this.j.info("BP detection timer enabled: "+h),this.A=vi(f(this.ab,this),h)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,dn(10),kp(this),rP(this))};function cS(h){h.A!=null&&(a.clearTimeout(h.A),h.A=null)}function rP(h){h.g=new en(h,h.j,"rpc",h.Y),h.m===null&&(h.g.H=h.o),h.g.O=0;var m=Ye(h.qa);rt(m,"RID","rpc"),rt(m,"SID",h.K),rt(m,"AID",h.T),rt(m,"CI",h.F?"0":"1"),!h.F&&h.ja&&rt(m,"TO",h.ja),rt(m,"TYPE","xmlhttp"),_f(h,m),h.m&&h.o&&oS(m,h.m,h.o),h.L&&(h.g.I=h.L);var E=h.g;h=h.ia,E.L=1,E.v=Pp(Ye(m)),E.m=null,E.P=!0,of(E,h)}n.Za=function(){this.C!=null&&(this.C=null,kp(this),aS(this),dn(19))};function Vp(h){h.C!=null&&(a.clearTimeout(h.C),h.C=null)}function iP(h,m){var E=null;if(h.g==m){Vp(h),cS(h),h.g=null;var y=2}else if(gc(h.h,m))E=m.D,R(h.h,m),y=1;else return;if(h.G!=0){if(m.o)if(y==1){E=m.m?m.m.length:0,m=Date.now()-m.F;var V=h.B;y=Vs(),Bt(y,new Lp(y,E)),Up(h)}else nP(h);else if(V=m.s,V==3||V==0&&0<m.X||!(y==1&&gz(h,m)||y==2&&aS(h)))switch(E&&0<E.length&&(m=h.h,m.i=m.i.concat(E)),V){case 1:mc(h,5);break;case 4:mc(h,10);break;case 3:mc(h,6);break;default:mc(h,2)}}}function oP(h,m){let E=h.Ta+Math.floor(Math.random()*h.cb);return h.isActive()||(E*=2),E*m}function mc(h,m){if(h.j.info("Error code "+m),m==2){var E=f(h.fb,h),y=h.Xa;let V=!y;y=new je(y||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||Mr(y,"https"),Pp(y),V?az(y.toString(),E):cz(y.toString(),E)}else dn(2);h.G=0,h.l&&h.l.sa(m),sP(h),ZM(h)}n.fb=function(h){h?(this.j.info("Successfully pinged google.com"),dn(2)):(this.j.info("Failed to ping google.com"),dn(1))};function sP(h){if(h.G=0,h.ka=[],h.l){let m=z(h.h);(m.length!=0||h.i.length!=0)&&(T(h.ka,m),T(h.ka,h.i),h.h.i.length=0,_(h.i),h.i.length=0),h.l.ra()}}function aP(h,m,E){var y=E instanceof je?Ye(E):new je(E);if(y.g!="")m&&(y.g=m+"."+y.g),xt(y,y.s);else{var V=a.location;y=V.protocol,m=m?m+"."+V.hostname:V.hostname,V=+V.port;var W=new je(null);y&&Mr(W,y),m&&(W.g=m),V&&xt(W,V),E&&(W.l=E),y=W}return E=h.D,m=h.ya,E&&m&&rt(y,E,m),rt(y,"VER",h.la),_f(h,y),y}function cP(h,m,E){if(m&&!h.J)throw Error("Can't create secondary domain capable XhrIo object.");return m=h.Ca&&!h.pa?new Gt(new gf({eb:E})):new Gt(h.pa),m.Ha(h.J),m}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function lP(){}n=lP.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Bp(){}Bp.prototype.g=function(h,m){return new Pr(h,m)};function Pr(h,m){Zt.call(this),this.g=new JM(m),this.l=h,this.h=m&&m.messageUrlParams||null,h=m&&m.messageHeaders||null,m&&m.clientProtocolHeaderRequired&&(h?h["X-Client-Protocol"]="webchannel":h={"X-Client-Protocol":"webchannel"}),this.g.o=h,h=m&&m.initMessageHeaders||null,m&&m.messageContentType&&(h?h["X-WebChannel-Content-Type"]=m.messageContentType:h={"X-WebChannel-Content-Type":m.messageContentType}),m&&m.va&&(h?h["X-WebChannel-Client-Profile"]=m.va:h={"X-WebChannel-Client-Profile":m.va}),this.g.S=h,(h=m&&m.Sb)&&!b(h)&&(this.g.m=h),this.v=m&&m.supportsCrossDomainXhr||!1,this.u=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!b(m)&&(this.g.D=m,h=this.h,h!==null&&m in h&&(h=this.h,m in h&&delete h[m])),this.j=new pu(this)}p(Pr,Zt),Pr.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Pr.prototype.close=function(){sS(this.g)},Pr.prototype.o=function(h){var m=this.g;if(typeof h=="string"){var E={};E.__data__=h,h=E}else this.u&&(E={},E.__data__=ro(h),h=E);m.i.push(new iS(m.Ya++,h)),m.G==3&&Up(m)},Pr.prototype.N=function(){this.g.l=null,delete this.j,sS(this.g),delete this.g,Pr.aa.N.call(this)};function uP(h){ks.call(this),h.__headers__&&(this.headers=h.__headers__,this.statusCode=h.__status__,delete h.__headers__,delete h.__status__);var m=h.__sm__;if(m){e:{for(let E in m){h=E;break e}h=void 0}(this.i=h)&&(h=this.i,m=m!==null&&h in m?m[h]:void 0),this.data=m}else this.data=h}p(uP,ks);function dP(){Us.call(this),this.status=1}p(dP,Us);function pu(h){this.g=h}p(pu,lP),pu.prototype.ua=function(){Bt(this.g,"a")},pu.prototype.ta=function(h){Bt(this.g,new uP(h))},pu.prototype.sa=function(h){Bt(this.g,new dP)},pu.prototype.ra=function(){Bt(this.g,"b")},Bp.prototype.createWebChannel=Bp.prototype.g,Pr.prototype.send=Pr.prototype.o,Pr.prototype.open=Pr.prototype.m,Pr.prototype.close=Pr.prototype.close,Pw=Rs.createWebChannelTransport=function(){return new Bp},Mw=Rs.getStatEventTarget=function(){return Vs()},Lw=Rs.Event=Sn,Tv=Rs.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Bs.NO_ERROR=0,Bs.TIMEOUT=8,Bs.HTTP_ERROR=6,Cm=Rs.ErrorCode=Bs,ef.COMPLETE="complete",bw=Rs.EventType=ef,lu.EventType=Fs,Fs.OPEN="a",Fs.CLOSE="b",Fs.ERROR="c",Fs.MESSAGE="d",Zt.prototype.listen=Zt.prototype.K,Jd=Rs.WebChannel=lu,Xre=Rs.FetchXmlHttpFactory=gf,Gt.prototype.listenOnce=Gt.prototype.L,Gt.prototype.getLastError=Gt.prototype.Ka,Gt.prototype.getLastErrorCode=Gt.prototype.Ba,Gt.prototype.getStatus=Gt.prototype.Z,Gt.prototype.getResponseJson=Gt.prototype.Oa,Gt.prototype.getResponseText=Gt.prototype.oa,Gt.prototype.send=Gt.prototype.ea,Gt.prototype.setWithCredentials=Gt.prototype.Ha,ww=Rs.XhrIo=Gt}).apply(typeof _v<"u"?_v:typeof self<"u"?self:typeof window<"u"?window:{});var oj="@firebase/firestore",sj="4.8.0";var cn=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}};cn.UNAUTHENTICATED=new cn(null),cn.GOOGLE_CREDENTIALS=new cn("google-credentials-uid"),cn.FIRST_PARTY=new cn("first-party-uid"),cn.MOCK_USER=new cn("mock-user");var Uh="11.10.0";var $a=new fi("@firebase/firestore");function oh(){return $a.logLevel}function YL(n){$a.setLogLevel(n)}function X(n,...e){if($a.logLevel<=Fe.DEBUG){let r=e.map(QL);$a.debug(`Firestore (${Uh}): ${n}`,...r)}}function Xt(n,...e){if($a.logLevel<=Fe.ERROR){let r=e.map(QL);$a.error(`Firestore (${Uh}): ${n}`,...r)}}function ws(n,...e){if($a.logLevel<=Fe.WARN){let r=e.map(QL);$a.warn(`Firestore (${Uh}): ${n}`,...r)}}function QL(n){if(typeof n=="string")return n;try{return(function(r){return JSON.stringify(r)})(n)}catch{return n}}function ae(n,e,r){let t="Unexpected state";typeof e=="string"?t=e:r=e,vH(n,t,r)}function vH(n,e,r){let t=`FIRESTORE (${Uh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(r!==void 0)try{t+=" CONTEXT: "+JSON.stringify(r)}catch{t+=" CONTEXT: "+r}throw Xt(t),new Error(t)}function he(n,e,r,t){let i="Unexpected state";typeof r=="string"?i=r:t=r,n||vH(e,i,t)}function de(n,e){return n}var j={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"},Q=class extends vr{constructor(e,r){super(e,r),this.code=e,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Or=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}};var Mv=class{constructor(e,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},$w=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,r){e.enqueueRetryable(()=>r(cn.UNAUTHENTICATED))}shutdown(){}},jw=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,r){this.changeListener=r,e.enqueueRetryable(()=>r(this.token.user))}shutdown(){this.changeListener=null}},Hw=class{constructor(e){this.t=e,this.currentUser=cn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,r){he(this.o===void 0,42304);let t=this.i,i=c=>this.i!==t?(t=this.i,r(c)):Promise.resolve(),o=new Or;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new Or,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let c=o;e.enqueueRetryable(()=>I(this,null,function*(){yield c.promise,yield i(this.currentUser)}))},a=c=>{X("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){let c=this.t.getImmediate({optional:!0});c?a(c):(X("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new Or)}},0),s()}getToken(){let e=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then(t=>this.i!==e?(X("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(he(typeof t.accessToken=="string",31837,{l:t}),new Mv(t.accessToken,this.currentUser)):null):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 he(e===null||typeof e=="string",2055,{h:e}),new cn(e)}},Ww=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t,this.type="FirstParty",this.user=cn.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},zw=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t}getToken(){return Promise.resolve(new Ww(this.P,this.T,this.I))}start(e,r){e.enqueueRetryable(()=>r(cn.FIRST_PARTY))}shutdown(){}invalidateToken(){}},Pv=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)}},qw=class{constructor(e,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,yr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,r){he(this.o===void 0,3512);let t=o=>{o.error!=null&&X("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${o.error.message}`);let s=o.token!==this.m;return this.m=o.token,X("FirebaseAppCheckTokenProvider",`Received ${s?"new":"existing"} token.`),s?r(o.token):Promise.resolve()};this.o=o=>{e.enqueueRetryable(()=>t(o))};let i=o=>{X("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=o,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(o=>i(o)),setTimeout(()=>{if(!this.appCheck){let o=this.V.getImmediate({optional:!0});o?i(o):X("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Pv(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(r=>r?(he(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new Pv(r.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Jre(n){let e=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(r);else for(let t=0;t<n;t++)r[t]=Math.floor(256*Math.random());return r}function yH(){return new TextEncoder}var jm=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=62*Math.floor(4.129032258064516),t="";for(;t.length<20;){let i=Jre(40);for(let o=0;o<i.length;++o)t.length<20&&i[o]<r&&(t+=e.charAt(i[o]%62))}return t}};function Re(n,e){return n<e?-1:n>e?1:0}function Kw(n,e){let r=0;for(;r<n.length&&r<e.length;){let t=n.codePointAt(r),i=e.codePointAt(r);if(t!==i){if(t<128&&i<128)return Re(t,i);{let o=yH(),s=Zre(o.encode(aj(n,r)),o.encode(aj(e,r)));return s!==0?s:Re(t,i)}}r+=t>65535?2:1}return Re(n.length,e.length)}function aj(n,e){return n.codePointAt(e)>65535?n.substring(e,e+2):n.substring(e,e+1)}function Zre(n,e){for(let r=0;r<n.length&&r<e.length;++r)if(n[r]!==e[r])return Re(n[r],e[r]);return Re(n.length,e.length)}function gh(n,e,r){return n.length===e.length&&n.every((t,i)=>r(t,e[i]))}function SH(n){return n+"\0"}var cj="__name__",xv=class n{constructor(e,r,t){r===void 0?r=0:r>e.length&&ae(637,{offset:r,range:e.length}),t===void 0?t=e.length-r:t>e.length-r&&ae(1746,{length:t,range:e.length-r}),this.segments=e,this.offset=r,this.len=t}get length(){return this.len}isEqual(e){return n.comparator(this,e)===0}child(e){let r=this.segments.slice(this.offset,this.limit());return e instanceof n?e.forEach(t=>{r.push(t)}):r.push(e),this.construct(r)}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 r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}forEach(e){for(let r=this.offset,t=this.limit();r<t;r++)e(this.segments[r])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,r){let t=Math.min(e.length,r.length);for(let i=0;i<t;i++){let o=n.compareSegments(e.get(i),r.get(i));if(o!==0)return o}return Re(e.length,r.length)}static compareSegments(e,r){let t=n.isNumericId(e),i=n.isNumericId(r);return t&&!i?-1:!t&&i?1:t&&i?n.extractNumericId(e).compare(n.extractNumericId(r)):Kw(e,r)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ds.fromString(e.substring(4,e.length-2))}},We=class n extends xv{construct(e,r,t){return new n(e,r,t)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let r=[];for(let t of e){if(t.indexOf("//")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);r.push(...t.split("/").filter(i=>i.length>0))}return new n(r)}static emptyPath(){return new n([])}},eie=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Tn=class n extends xv{construct(e,r,t){return new n(e,r,t)}static isValidIdentifier(e){return eie.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===cj}static keyField(){return new n([cj])}static fromServerFormat(e){let r=[],t="",i=0,o=()=>{if(t.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(t),t=""},s=!1;for(;i<e.length;){let a=e[i];if(a==="\\"){if(i+1===e.length)throw new Q(j.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[i+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new Q(j.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);t+=c,i+=2}else a==="`"?(s=!s,i++):a!=="."||s?(t+=a,i++):(o(),i++)}if(o(),s)throw new Q(j.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(r)}static emptyPath(){return new n([])}};var ie=class n{constructor(e){this.path=e}static fromPath(e){return new n(We.fromString(e))}static fromName(e){return new n(We.fromString(e).popFirst(5))}static empty(){return new n(We.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&&We.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,r){return We.comparator(e.path,r.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new n(new We(e.slice()))}};function XL(n,e,r){if(!r)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function tie(n,e,r,t){if(e===!0&&t===!0)throw new Q(j.INVALID_ARGUMENT,`${n} and ${r} cannot be used together.`)}function lj(n){if(!ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function uj(n){if(ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function AH(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}function Oy(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{let e=(function(t){return t.constructor?t.constructor.name:null})(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":ae(12329,{type:typeof n})}function wr(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new Q(j.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=Oy(n);throw new Q(j.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${r}`)}}return n}function nie(n,e){if(e<=0)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}function ln(n,e){let r={typeString:n};return e&&(r.value=e),r}function Ep(n,e){if(!AH(n))throw new Q(j.INVALID_ARGUMENT,"JSON must be an object");let r;for(let t in e)if(e[t]){let i=e[t].typeString,o="value"in e[t]?{value:e[t].value}:void 0;if(!(t in n)){r=`JSON missing required field: '${t}'`;break}let s=n[t];if(i&&typeof s!==i){r=`JSON field '${t}' must be a ${i}.`;break}if(o!==void 0&&s!==o.value){r=`Expected '${t}' field to equal '${o.value}'`;break}}if(r)throw new Q(j.INVALID_ARGUMENT,r);return!0}var dj=-62135596800,hj=1e6,Pt=class n{static now(){return n.fromMillis(Date.now())}static fromDate(e){return n.fromMillis(e.getTime())}static fromMillis(e){let r=Math.floor(e/1e3),t=Math.floor((e-1e3*r)*hj);return new n(r,t)}constructor(e,r){if(this.seconds=e,this.nanoseconds=r,r<0)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(e<dj)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/hj}_compareTo(e){return this.seconds===e.seconds?Re(this.nanoseconds,e.nanoseconds):Re(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:n._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ep(e,n._jsonSchema))return new n(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-dj;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};Pt._jsonSchemaVersion="firestore/timestamp/1.0",Pt._jsonSchema={type:ln("string",Pt._jsonSchemaVersion),seconds:ln("number"),nanoseconds:ln("number")};var me=class n{static fromTimestamp(e){return new n(e)}static min(){return new n(new Pt(0,0))}static max(){return new n(new Pt(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}};var mh=-1,ph=class{constructor(e,r,t,i){this.indexId=e,this.collectionGroup=r,this.fields=t,this.indexState=i}};function Yw(n){return n.fields.find(e=>e.kind===2)}function Ll(n){return n.fields.filter(e=>e.kind!==2)}ph.UNKNOWN_ID=-1;var uh=class{constructor(e,r){this.fieldPath=e,this.kind=r}};var Hm=class n{constructor(e,r){this.sequenceNumber=e,this.offset=r}static empty(){return new n(0,_i.min())}};function DH(n,e){let r=n.toTimestamp().seconds,t=n.toTimestamp().nanoseconds+1,i=me.fromTimestamp(t===1e9?new Pt(r+1,0):new Pt(r,t));return new _i(i,ie.empty(),e)}function RH(n){return new _i(n.readTime,n.key,mh)}var _i=class n{constructor(e,r,t){this.readTime=e,this.documentKey=r,this.largestBatchId=t}static min(){return new n(me.min(),ie.empty(),mh)}static max(){return new n(me.max(),ie.empty(),mh)}};function JL(n,e){let r=n.readTime.compareTo(e.readTime);return r!==0?r:(r=ie.comparator(n.documentKey,e.documentKey),r!==0?r:Re(n.largestBatchId,e.largestBatchId))}var CH="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Fv=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};function Qa(n){return I(this,null,function*(){if(n.code!==j.FAILED_PRECONDITION||n.message!==CH)throw n;X("LocalStore","Unexpectedly lost primary lease")})}var B=class n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)},r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)})}catch(e){return this.next(void 0,e)}next(e,r){return this.callbackAttached&&ae(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(e,this.result):new n((t,i)=>{this.nextCallback=o=>{this.wrapSuccess(e,o).next(t,i)},this.catchCallback=o=>{this.wrapFailure(r,o).next(t,i)}})}toPromise(){return new Promise((e,r)=>{this.next(e,r)})}wrapUserFunction(e){try{let r=e();return r instanceof n?r:n.resolve(r)}catch(r){return n.reject(r)}}wrapSuccess(e,r){return e?this.wrapUserFunction(()=>e(r)):n.resolve(r)}wrapFailure(e,r){return e?this.wrapUserFunction(()=>e(r)):n.reject(r)}static resolve(e){return new n((r,t)=>{r(e)})}static reject(e){return new n((r,t)=>{t(e)})}static waitFor(e){return new n((r,t)=>{let i=0,o=0,s=!1;e.forEach(a=>{++i,a.next(()=>{++o,s&&o===i&&r()},c=>t(c))}),s=!0,o===i&&r()})}static or(e){let r=n.resolve(!1);for(let t of e)r=r.next(i=>i?n.resolve(i):t());return r}static forEach(e,r){let t=[];return e.forEach((i,o)=>{t.push(r.call(this,i,o))}),this.waitFor(t)}static mapArray(e,r){return new n((t,i)=>{let o=e.length,s=new Array(o),a=0;for(let c=0;c<o;c++){let l=c;r(e[l]).next(u=>{s[l]=u,++a,a===o&&t(s)},u=>i(u))}})}static doWhile(e,r){return new n((t,i)=>{let o=()=>{e()===!0?r().next(()=>{o()},i):t()};o()})}};var qr="SimpleDb",kv=class n{static open(e,r,t,i){try{return new n(r,e.transaction(i,t))}catch(o){throw new Bl(r,o)}}constructor(e,r){this.action=e,this.transaction=r,this.aborted=!1,this.S=new Or,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{r.error?this.S.reject(new Bl(e,r.error)):this.S.resolve()},this.transaction.onerror=t=>{let i=ZL(t.target.error);this.S.reject(new Bl(e,i))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(X(qr,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}v(){let e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){let r=this.transaction.objectStore(e);return new Xw(r)}},Eh=class n{static delete(e){return X(qr,"Removing database:",e),Pl(zT().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!Od())return!1;if(n.F())return!0;let e=En(),r=n.M(e),t=0<r&&r<10,i=NH(e),o=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||t||o)}static F(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.O)==="YES"}static N(e,r){return e.store(r)}static M(e){let r=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=r?r[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,r,t){this.name=e,this.version=r,this.B=t,this.L=null,n.M(En())===12.2&&Xt("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}k(e){return I(this,null,function*(){return this.db||(X(qr,"Opening database:",this.name),this.db=yield new Promise((r,t)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=o=>{let s=o.target.result;r(s)},i.onblocked=()=>{t(new Bl(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=o=>{let s=o.target.error;s.name==="VersionError"?t(new Q(j.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):s.name==="InvalidStateError"?t(new Q(j.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+s)):t(new Bl(e,s))},i.onupgradeneeded=o=>{X(qr,'Database "'+this.name+'" requires upgrade from version:',o.oldVersion);let s=o.target.result;if(this.L!==null&&this.L!==o.oldVersion)throw new Error(`refusing to open IndexedDB database due to potential corruption of the IndexedDB database data; this corruption could be caused by clicking the "clear site data" button in a web browser; try reloading the web page to re-initialize the IndexedDB database: lastClosedDbVersion=${this.L}, event.oldVersion=${o.oldVersion}, event.newVersion=${o.newVersion}, db.version=${s.version}`);this.B.q(s,i.transaction,o.oldVersion,this.version).next(()=>{X(qr,"Database upgrade to version "+this.version+" complete")})}}),this.db.addEventListener("close",r=>{let t=r.target;this.L=t.version},{passive:!0})),this.db.addEventListener("versionchange",r=>{var t;r.newVersion===null&&(ws('Received "versionchange" event with newVersion===null; notifying the registered DatabaseDeletedListener, if any'),(t=this.databaseDeletedListener)===null||t===void 0||t.call(this))},{passive:!0}),this.db})}setDatabaseDeletedListener(e){if(this.databaseDeletedListener)throw new Error("setDatabaseDeletedListener() may only be called once, and it has already been called");this.databaseDeletedListener=e}runTransaction(e,r,t,i){return I(this,null,function*(){let o=r==="readonly",s=0;for(;;){++s;try{this.db=yield this.k(e);let a=kv.open(this.db,e,o?"readonly":"readwrite",t),c=i(a).next(l=>(a.v(),l)).catch(l=>(a.abort(l),B.reject(l))).toPromise();return c.catch(()=>{}),yield a.D,c}catch(a){let c=a,l=c.name!=="FirebaseError"&&s<3;if(X(qr,"Transaction failed with error:",c.message,"Retrying:",l),this.close(),!l)return Promise.reject(c)}}})}close(){this.db&&this.db.close(),this.db=void 0}};function NH(n){let e=n.match(/Android ([\d.]+)/i),r=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(r)}var Qw=class{constructor(e){this.$=e,this.U=!1,this.K=null}get isDone(){return this.U}get W(){return this.K}set cursor(e){this.$=e}done(){this.U=!0}G(e){this.K=e}delete(){return Pl(this.$.delete())}},Bl=class extends Q{constructor(e,r){super(j.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${r}`),this.name="IndexedDbTransactionError"}};function Xa(n){return n.name==="IndexedDbTransactionError"}var Xw=class{constructor(e){this.store=e}put(e,r){let t;return r!==void 0?(X(qr,"PUT",this.store.name,e,r),t=this.store.put(r,e)):(X(qr,"PUT",this.store.name,"<auto-key>",e),t=this.store.put(e)),Pl(t)}add(e){return X(qr,"ADD",this.store.name,e,e),Pl(this.store.add(e))}get(e){return Pl(this.store.get(e)).next(r=>(r===void 0&&(r=null),X(qr,"GET",this.store.name,e,r),r))}delete(e){return X(qr,"DELETE",this.store.name,e),Pl(this.store.delete(e))}count(){return X(qr,"COUNT",this.store.name),Pl(this.store.count())}j(e,r){let t=this.options(e,r),i=t.index?this.store.index(t.index):this.store;if(typeof i.getAll=="function"){let o=i.getAll(t.range);return new B((s,a)=>{o.onerror=c=>{a(c.target.error)},o.onsuccess=c=>{s(c.target.result)}})}{let o=this.cursor(t),s=[];return this.J(o,(a,c)=>{s.push(c)}).next(()=>s)}}H(e,r){let t=this.store.getAll(e,r===null?void 0:r);return new B((i,o)=>{t.onerror=s=>{o(s.target.error)},t.onsuccess=s=>{i(s.target.result)}})}Y(e,r){X(qr,"DELETE ALL",this.store.name);let t=this.options(e,r);t.Z=!1;let i=this.cursor(t);return this.J(i,(o,s,a)=>a.delete())}X(e,r){let t;r?t=e:(t={},r=e);let i=this.cursor(t);return this.J(i,r)}ee(e){let r=this.cursor({});return new B((t,i)=>{r.onerror=o=>{let s=ZL(o.target.error);i(s)},r.onsuccess=o=>{let s=o.target.result;s?e(s.primaryKey,s.value).next(a=>{a?s.continue():t()}):t()}})}J(e,r){let t=[];return new B((i,o)=>{e.onerror=s=>{o(s.target.error)},e.onsuccess=s=>{let a=s.target.result;if(!a)return void i();let c=new Qw(a),l=r(a.primaryKey,a.value,c);if(l instanceof B){let u=l.catch(d=>(c.done(),B.reject(d)));t.push(u)}c.isDone?i():c.W===null?a.continue():a.continue(c.W)}}).next(()=>B.waitFor(t))}options(e,r){let t;return e!==void 0&&(typeof e=="string"?t=e:r=e),{index:t,range:r}}cursor(e){let r="next";if(e.reverse&&(r="prev"),e.index){let t=this.store.index(e.index);return e.Z?t.openKeyCursor(e.range,r):t.openCursor(e.range,r)}return this.store.openCursor(e.range,r)}};function Pl(n){return new B((e,r)=>{n.onsuccess=t=>{let i=t.target.result;e(i)},n.onerror=t=>{let i=ZL(t.target.error);r(i)}})}var fj=!1;function ZL(n){let e=Eh.M(En());if(e>=12.2&&e<13){let r="An internal error was encountered in the Indexed Database server";if(n.message.indexOf(r)>=0){let t=new Q("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${r}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return fj||(fj=!0,setTimeout(()=>{throw t},0)),t}}return n}var xm="IndexBackfiller",Jw=class{constructor(e,r){this.asyncQueue=e,this.te=r,this.task=null}start(){this.ne(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}ne(e){X(xm,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,()=>I(this,null,function*(){this.task=null;try{let r=yield this.te.re();X(xm,`Documents written: ${r}`)}catch(r){Xa(r)?X(xm,"Ignoring IndexedDB error during index backfill: ",r):yield Qa(r)}yield this.ne(6e4)}))}},Zw=class{constructor(e,r){this.localStore=e,this.persistence=r}re(e=50){return I(this,null,function*(){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",r=>this.ie(r,e))})}ie(e,r){let t=new Set,i=r,o=!0;return B.doWhile(()=>o===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(s=>{if(s!==null&&!t.has(s))return X(xm,`Processing collection: ${s}`),this.se(e,s,i).next(a=>{i-=a,t.add(s)});o=!1})).next(()=>r-i)}se(e,r,t){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,r).next(i=>this.localStore.localDocuments.getNextDocuments(e,r,i,t).next(o=>{let s=o.changes;return this.localStore.indexManager.updateIndexEntries(e,s).next(()=>this.oe(i,o)).next(a=>(X(xm,`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,r,a))).next(()=>s.size)}))}oe(e,r){let t=e;return r.changes.forEach((i,o)=>{let s=RH(o);JL(s,t)>0&&(t=s)}),new _i(t.readTime,t.documentKey,Math.max(r.batchId,e.largestBatchId))}};var Kr=(()=>{class n{constructor(r,t){this.previousValue=r,t&&(t.sequenceNumberHandler=i=>this._e(i),this.ae=i=>t.writeSequenceNumber(i))}_e(r){return this.previousValue=Math.max(r,this.previousValue),this.previousValue}next(){let r=++this.previousValue;return this.ae&&this.ae(r),r}}n.ue=-1;return n})(),Gl=-1;function _p(n){return n==null}function Wm(n){return n===0&&1/n==-1/0}function OH(n){return typeof n=="number"&&Number.isInteger(n)&&!Wm(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}var Uv="";function rr(n){let e="";for(let r=0;r<n.length;r++)e.length>0&&(e=gj(e)),e=rie(n.get(r),e);return gj(e)}function rie(n,e){let r=e,t=n.length;for(let i=0;i<t;i++){let o=n.charAt(i);switch(o){case"\0":r+="";break;case Uv:r+="";break;default:r+=o}}return r}function gj(n){return n+Uv+""}function Bo(n){let e=n.length;if(he(e>=2,64408,{path:n}),e===2)return he(n.charAt(0)===Uv&&n.charAt(1)==="",56145,{path:n}),We.emptyPath();let r=e-2,t=[],i="";for(let o=0;o<e;){let s=n.indexOf(Uv,o);switch((s<0||s>r)&&ae(50515,{path:n}),n.charAt(s+1)){case"":let a=n.substring(o,s),c;i.length===0?c=a:(i+=a,c=i,i=""),t.push(c);break;case"":i+=n.substring(o,s),i+="\0";break;case"":i+=n.substring(o,s+1);break;default:ae(61167,{path:n})}o=s+2}return new We(t)}var Ml="remoteDocuments",Tp="owner",Zd="owner",zm="mutationQueues",iie="userId",qi="mutations",mj="batchId",Ul="userMutationsIndex",pj=["userId","batchId"];function Dv(n,e){return[n,rr(e)]}function wH(n,e,r){return[n,rr(e),r]}var oie={},_h="documentMutations",Vv="remoteDocumentsV14",sie=["prefixPath","collectionGroup","readTime","documentId"],Rv="documentKeyIndex",aie=["prefixPath","collectionGroup","documentId"],bH="collectionGroupIndex",cie=["collectionGroup","readTime","prefixPath","documentId"],qm="remoteDocumentGlobal",eb="remoteDocumentGlobalKey",Th="targets",LH="queryTargetsIndex",lie=["canonicalId","targetId"],Ih="targetDocuments",uie=["targetId","path"],eM="documentTargetsIndex",die=["path","targetId"],Bv="targetGlobalKey",$l="targetGlobal",Km="collectionParents",hie=["collectionId","parent"],vh="clientMetadata",fie="clientId",wy="bundles",gie="bundleId",by="namedQueries",mie="name",tM="indexConfiguration",pie="indexId",tb="collectionGroupIndex",Eie="collectionGroup",Fm="indexState",_ie=["indexId","uid"],MH="sequenceNumberIndex",Tie=["uid","sequenceNumber"],km="indexEntries",Iie=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],PH="documentKeyIndex",vie=["indexId","uid","orderedDocumentKey"],Ly="documentOverlays",yie=["userId","collectionPath","documentId"],nb="collectionPathOverlayIndex",Sie=["userId","collectionPath","largestBatchId"],xH="collectionGroupOverlayIndex",Aie=["userId","collectionGroup","largestBatchId"],nM="globals",Die="name",FH=[zm,qi,_h,Ml,Th,Tp,$l,Ih,vh,qm,Km,wy,by],Rie=[...FH,Ly],kH=[zm,qi,_h,Vv,Th,Tp,$l,Ih,vh,qm,Km,wy,by,Ly],UH=kH,rM=[...UH,tM,Fm,km],Cie=rM,VH=[...rM,nM],Nie=VH;var Ym=class extends Fv{constructor(e,r){super(),this.ce=e,this.currentSequenceNumber=r}};function yn(n,e){let r=de(n);return Eh.N(r.ce,e)}function Ej(n){let e=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e++;return e}function Ja(n,e){for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e(r,n[r])}function Oie(n,e){let r=[];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.push(e(n[t],t,n));return r}function BH(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}var Dt=class n{constructor(e,r){this.comparator=e,this.root=r||$o.EMPTY}insert(e,r){return new n(this.comparator,this.root.insert(e,r,this.comparator).copy(null,null,$o.BLACK,null,null))}remove(e){return new n(this.comparator,this.root.remove(e,this.comparator).copy(null,null,$o.BLACK,null,null))}get(e){let r=this.root;for(;!r.isEmpty();){let t=this.comparator(e,r.key);if(t===0)return r.value;t<0?r=r.left:t>0&&(r=r.right)}return null}indexOf(e){let r=0,t=this.root;for(;!t.isEmpty();){let i=this.comparator(e,t.key);if(i===0)return r+t.left.size;i<0?t=t.left:(r+=t.left.size+1,t=t.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((r,t)=>(e(r,t),!1))}toString(){let e=[];return this.inorderTraversal((r,t)=>(e.push(`${r}:${t}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new lh(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new lh(this.root,e,this.comparator,!1)}getReverseIterator(){return new lh(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new lh(this.root,e,this.comparator,!0)}},lh=class{constructor(e,r,t,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!e.isEmpty();)if(o=r?t(e.key,r):1,r&&i&&(o*=-1),o<0)e=this.isReverse?e.left:e.right;else{if(o===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),r={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 r}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}}},$o=class n{constructor(e,r,t,i,o){this.key=e,this.value=r,this.color=t??n.RED,this.left=i??n.EMPTY,this.right=o??n.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,r,t,i,o){return new n(e??this.key,r??this.value,t??this.color,i??this.left,o??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,r,t){let i=this,o=t(e,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(e,r,t),null):o===0?i.copy(null,r,null,null,null):i.copy(null,null,null,null,i.right.insert(e,r,t)),i.fixUp()}removeMin(){if(this.left.isEmpty())return n.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,r){let t,i=this;if(r(e,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(e,r),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),r(e,i.key)===0){if(i.right.isEmpty())return n.EMPTY;t=i.right.min(),i=i.copy(t.key,t.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,r))}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 e=this.copy(null,null,n.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,n.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,r)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ae(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ae(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw ae(27949);return e+(this.isRed()?0:1)}};$o.EMPTY=null,$o.RED=!0,$o.BLACK=!1;$o.EMPTY=new class{constructor(){this.size=0}get key(){throw ae(57766)}get value(){throw ae(16141)}get color(){throw ae(16727)}get left(){throw ae(29726)}get right(){throw ae(36894)}copy(e,r,t,i,o){return this}insert(e,r,t){return new $o(e,r)}remove(e,r){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 at=class n{constructor(e){this.comparator=e,this.data=new Dt(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((r,t)=>(e(r),!1))}forEachInRange(e,r){let t=this.data.getIteratorFrom(e[0]);for(;t.hasNext();){let i=t.getNext();if(this.comparator(i.key,e[1])>=0)return;r(i.key)}}forEachWhile(e,r){let t;for(t=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();t.hasNext();)if(!e(t.getNext().key))return}firstAfterOrEqual(e){let r=this.data.getIteratorFrom(e);return r.hasNext()?r.getNext().key:null}getIterator(){return new Gv(this.data.getIterator())}getIteratorFrom(e){return new Gv(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 r=this;return r.size<e.size&&(r=e,e=this),e.forEach(t=>{r=r.add(t)}),r}isEqual(e){if(!(e instanceof n)||this.size!==e.size)return!1;let r=this.data.getIterator(),t=e.data.getIterator();for(;r.hasNext();){let i=r.getNext().key,o=t.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){let e=[];return this.forEach(r=>{e.push(r)}),e}toString(){let e=[];return this.forEach(r=>e.push(r)),"SortedSet("+e.toString()+")"}copy(e){let r=new n(this.comparator);return r.data=e,r}},Gv=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};function eh(n){return n.hasNext()?n.getNext():void 0}var Yr=class n{constructor(e){this.fields=e,e.sort(Tn.comparator)}static empty(){return new n([])}unionWith(e){let r=new at(Tn.comparator);for(let t of this.fields)r=r.add(t);for(let t of e)r=r.add(t);return new n(r.toArray())}covers(e){for(let r of this.fields)if(r.isPrefixOf(e))return!0;return!1}isEqual(e){return gh(this.fields,e.fields,(r,t)=>r.isEqual(t))}};var $v=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var un=class n{constructor(e){this.binaryString=e}static fromBase64String(e){let r=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new $v("Invalid base64 string: "+o):o}})(e);return new n(r)}static fromUint8Array(e){let r=(function(i){let o="";for(let s=0;s<i.length;++s)o+=String.fromCharCode(i[s]);return o})(e);return new n(r)}[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(r){return btoa(r)})(this.binaryString)}toUint8Array(){return(function(r){let t=new Uint8Array(r.length);for(let i=0;i<r.length;i++)t[i]=r.charCodeAt(i);return t})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Re(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};un.EMPTY_BYTE_STRING=new un("");var wie=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bs(n){if(he(!!n,39018),typeof n=="string"){let e=0,r=wie.exec(n);if(he(!!r,46558,{timestamp:n}),r[1]){let i=r[1];i=(i+"000000000").substr(0,9),e=Number(i)}let t=new Date(n);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}return{seconds:Mt(n.seconds),nanos:Mt(n.nanos)}}function Mt(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Ls(n){return typeof n=="string"?un.fromBase64String(n):un.fromUint8Array(n)}var GH="server_timestamp",$H="__type__",jH="__previous_value__",HH="__local_write_time__";function My(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[$H])===null||r===void 0?void 0:r.stringValue)===GH}function Py(n){let e=n.mapValue.fields[jH];return My(e)?Py(e):e}function Qm(n){let e=bs(n.mapValue.fields[HH].timestampValue);return new Pt(e.seconds,e.nanos)}var rb=class{constructor(e,r,t,i,o,s,a,c,l,u){this.databaseId=e,this.appId=r,this.persistenceKey=t,this.host=i,this.ssl=o,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=l,this.isUsingEmulator=u}},Xm="(default)",yh=class n{constructor(e,r){this.projectId=e,this.database=r||Xm}static empty(){return new n("","")}get isDefaultDatabase(){return this.database===Xm}isEqual(e){return e instanceof n&&e.projectId===this.projectId&&e.database===this.database}};var iM="__type__",WH="__max__",Fa={mapValue:{fields:{__type__:{stringValue:WH}}}},oM="__vector__",Sh="value",Cv={nullValue:"NULL_VALUE"};function ja(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?My(n)?4:zH(n)?9007199254740991:xy(n)?10:11:ae(28295,{value:n})}function jo(n,e){if(n===e)return!0;let r=ja(n);if(r!==ja(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return Qm(n).isEqual(Qm(e));case 3:return(function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;let s=bs(i.timestampValue),a=bs(o.timestampValue);return s.seconds===a.seconds&&s.nanos===a.nanos})(n,e);case 5:return n.stringValue===e.stringValue;case 6:return(function(i,o){return Ls(i.bytesValue).isEqual(Ls(o.bytesValue))})(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return(function(i,o){return Mt(i.geoPointValue.latitude)===Mt(o.geoPointValue.latitude)&&Mt(i.geoPointValue.longitude)===Mt(o.geoPointValue.longitude)})(n,e);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return Mt(i.integerValue)===Mt(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){let s=Mt(i.doubleValue),a=Mt(o.doubleValue);return s===a?Wm(s)===Wm(a):isNaN(s)&&isNaN(a)}return!1})(n,e);case 9:return gh(n.arrayValue.values||[],e.arrayValue.values||[],jo);case 10:case 11:return(function(i,o){let s=i.mapValue.fields||{},a=o.mapValue.fields||{};if(Ej(s)!==Ej(a))return!1;for(let c in s)if(s.hasOwnProperty(c)&&(a[c]===void 0||!jo(s[c],a[c])))return!1;return!0})(n,e);default:return ae(52216,{left:n})}}function Jm(n,e){return(n.values||[]).find(r=>jo(r,e))!==void 0}function Ha(n,e){if(n===e)return 0;let r=ja(n),t=ja(e);if(r!==t)return Re(r,t);switch(r){case 0:case 9007199254740991:return 0;case 1:return Re(n.booleanValue,e.booleanValue);case 2:return(function(o,s){let a=Mt(o.integerValue||o.doubleValue),c=Mt(s.integerValue||s.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1})(n,e);case 3:return _j(n.timestampValue,e.timestampValue);case 4:return _j(Qm(n),Qm(e));case 5:return Kw(n.stringValue,e.stringValue);case 6:return(function(o,s){let a=Ls(o),c=Ls(s);return a.compareTo(c)})(n.bytesValue,e.bytesValue);case 7:return(function(o,s){let a=o.split("/"),c=s.split("/");for(let l=0;l<a.length&&l<c.length;l++){let u=Re(a[l],c[l]);if(u!==0)return u}return Re(a.length,c.length)})(n.referenceValue,e.referenceValue);case 8:return(function(o,s){let a=Re(Mt(o.latitude),Mt(s.latitude));return a!==0?a:Re(Mt(o.longitude),Mt(s.longitude))})(n.geoPointValue,e.geoPointValue);case 9:return Tj(n.arrayValue,e.arrayValue);case 10:return(function(o,s){var a,c,l,u;let d=o.fields||{},f=s.fields||{},g=(a=d[Sh])===null||a===void 0?void 0:a.arrayValue,p=(c=f[Sh])===null||c===void 0?void 0:c.arrayValue,_=Re(((l=g?.values)===null||l===void 0?void 0:l.length)||0,((u=p?.values)===null||u===void 0?void 0:u.length)||0);return _!==0?_:Tj(g,p)})(n.mapValue,e.mapValue);case 11:return(function(o,s){if(o===Fa.mapValue&&s===Fa.mapValue)return 0;if(o===Fa.mapValue)return 1;if(s===Fa.mapValue)return-1;let a=o.fields||{},c=Object.keys(a),l=s.fields||{},u=Object.keys(l);c.sort(),u.sort();for(let d=0;d<c.length&&d<u.length;++d){let f=Kw(c[d],u[d]);if(f!==0)return f;let g=Ha(a[c[d]],l[u[d]]);if(g!==0)return g}return Re(c.length,u.length)})(n.mapValue,e.mapValue);default:throw ae(23264,{le:r})}}function _j(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return Re(n,e);let r=bs(n),t=bs(e),i=Re(r.seconds,t.seconds);return i!==0?i:Re(r.nanos,t.nanos)}function Tj(n,e){let r=n.values||[],t=e.values||[];for(let i=0;i<r.length&&i<t.length;++i){let o=Ha(r[i],t[i]);if(o)return o}return Re(r.length,t.length)}function Ah(n){return ib(n)}function ib(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?(function(r){let t=bs(r);return`time(${t.seconds},${t.nanos})`})(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?(function(r){return Ls(r).toBase64()})(n.bytesValue):"referenceValue"in n?(function(r){return ie.fromName(r).toString()})(n.referenceValue):"geoPointValue"in n?(function(r){return`geo(${r.latitude},${r.longitude})`})(n.geoPointValue):"arrayValue"in n?(function(r){let t="[",i=!0;for(let o of r.values||[])i?i=!1:t+=",",t+=ib(o);return t+"]"})(n.arrayValue):"mapValue"in n?(function(r){let t=Object.keys(r.fields||{}).sort(),i="{",o=!0;for(let s of t)o?o=!1:i+=",",i+=`${s}:${ib(r.fields[s])}`;return i+"}"})(n.mapValue):ae(61005,{value:n})}function Nv(n){switch(ja(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=Py(n);return e?16+Nv(e):16;case 5:return 2*n.stringValue.length;case 6:return Ls(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return(function(t){return(t.values||[]).reduce((i,o)=>i+Nv(o),0)})(n.arrayValue);case 10:case 11:return(function(t){let i=0;return Ja(t.fields,(o,s)=>{i+=o.length+Nv(s)}),i})(n.mapValue);default:throw ae(13486,{value:n})}}function Hl(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function ob(n){return!!n&&"integerValue"in n}function Zm(n){return!!n&&"arrayValue"in n}function Ij(n){return!!n&&"nullValue"in n}function vj(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Ov(n){return!!n&&"mapValue"in n}function xy(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[iM])===null||r===void 0?void 0:r.stringValue)===oM}function Um(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){let e={mapValue:{fields:{}}};return Ja(n.mapValue.fields,(r,t)=>e.mapValue.fields[r]=Um(t)),e}if(n.arrayValue){let e={arrayValue:{values:[]}};for(let r=0;r<(n.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=Um(n.arrayValue.values[r]);return e}return Object.assign({},n)}function zH(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===WH}var qH={mapValue:{fields:{[iM]:{stringValue:oM},[Sh]:{arrayValue:{}}}}};function bie(n){return"nullValue"in n?Cv:"booleanValue"in n?{booleanValue:!1}:"integerValue"in n||"doubleValue"in n?{doubleValue:NaN}:"timestampValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in n?{stringValue:""}:"bytesValue"in n?{bytesValue:""}:"referenceValue"in n?Hl(yh.empty(),ie.empty()):"geoPointValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in n?{arrayValue:{}}:"mapValue"in n?xy(n)?qH:{mapValue:{}}:ae(35942,{value:n})}function Lie(n){return"nullValue"in n?{booleanValue:!1}:"booleanValue"in n?{doubleValue:NaN}:"integerValue"in n||"doubleValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in n?{stringValue:""}:"stringValue"in n?{bytesValue:""}:"bytesValue"in n?Hl(yh.empty(),ie.empty()):"referenceValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in n?{arrayValue:{}}:"arrayValue"in n?qH:"mapValue"in n?xy(n)?{mapValue:{}}:Fa:ae(61959,{value:n})}function yj(n,e){let r=Ha(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?-1:!n.inclusive&&e.inclusive?1:0}function Sj(n,e){let r=Ha(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?1:!n.inclusive&&e.inclusive?-1:0}var nr=class n{constructor(e){this.value=e}static empty(){return new n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let r=this.value;for(let t=0;t<e.length-1;++t)if(r=(r.mapValue.fields||{})[e.get(t)],!Ov(r))return null;return r=(r.mapValue.fields||{})[e.lastSegment()],r||null}}set(e,r){this.getFieldsMap(e.popLast())[e.lastSegment()]=Um(r)}setAll(e){let r=Tn.emptyPath(),t={},i=[];e.forEach((s,a)=>{if(!r.isImmediateParentOf(a)){let c=this.getFieldsMap(r);this.applyChanges(c,t,i),t={},i=[],r=a.popLast()}s?t[a.lastSegment()]=Um(s):i.push(a.lastSegment())});let o=this.getFieldsMap(r);this.applyChanges(o,t,i)}delete(e){let r=this.field(e.popLast());Ov(r)&&r.mapValue.fields&&delete r.mapValue.fields[e.lastSegment()]}isEqual(e){return jo(this.value,e.value)}getFieldsMap(e){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let t=0;t<e.length;++t){let i=r.mapValue.fields[e.get(t)];Ov(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},r.mapValue.fields[e.get(t)]=i),r=i}return r.mapValue.fields}applyChanges(e,r,t){Ja(r,(i,o)=>e[i]=o);for(let i of t)delete e[i]}clone(){return new n(Um(this.value))}};function KH(n){let e=[];return Ja(n.fields,(r,t)=>{let i=new Tn([r]);if(Ov(t)){let o=KH(t.mapValue).fields;if(o.length===0)e.push(i);else for(let s of o)e.push(i.child(s))}else e.push(i)}),new Yr(e)}var In=class n{constructor(e,r,t,i,o,s,a){this.key=e,this.documentType=r,this.version=t,this.readTime=i,this.createTime=o,this.data=s,this.documentState=a}static newInvalidDocument(e){return new n(e,0,me.min(),me.min(),me.min(),nr.empty(),0)}static newFoundDocument(e,r,t,i){return new n(e,1,r,me.min(),t,i,0)}static newNoDocument(e,r){return new n(e,2,r,me.min(),me.min(),nr.empty(),0)}static newUnknownDocument(e,r){return new n(e,3,r,me.min(),me.min(),nr.empty(),2)}convertToFoundDocument(e,r){return!this.createTime.isEqual(me.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=nr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=nr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=me.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(e){return e instanceof n&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new n(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}})`}};var Ho=class{constructor(e,r){this.position=e,this.inclusive=r}};function Aj(n,e,r){let t=0;for(let i=0;i<n.position.length;i++){let o=e[i],s=n.position[i];if(o.field.isKeyField()?t=ie.comparator(ie.fromName(s.referenceValue),r.key):t=Ha(s,r.data.field(o.field)),o.dir==="desc"&&(t*=-1),t!==0)break}return t}function Dj(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let r=0;r<n.position.length;r++)if(!jo(n.position[r],e.position[r]))return!1;return!0}var Wl=class{constructor(e,r="asc"){this.field=e,this.dir=r}};function Mie(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}var jv=class{},$e=class n extends jv{constructor(e,r,t){super(),this.field=e,this.op=r,this.value=t}static create(e,r,t){return e.isKeyField()?r==="in"||r==="not-in"?this.createKeyFieldInFilter(e,r,t):new cb(e,r,t):r==="array-contains"?new db(e,t):r==="in"?new Hv(e,t):r==="not-in"?new hb(e,t):r==="array-contains-any"?new fb(e,t):new n(e,r,t)}static createKeyFieldInFilter(e,r,t){return r==="in"?new lb(e,t):new ub(e,t)}matches(e){let r=e.data.field(this.field);return this.op==="!="?r!==null&&r.nullValue===void 0&&this.matchesComparison(Ha(r,this.value)):r!==null&&ja(this.value)===ja(r)&&this.matchesComparison(Ha(r,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 ae(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},nt=class n extends jv{constructor(e,r){super(),this.filters=e,this.op=r,this.he=null}static create(e,r){return new n(e,r)}matches(e){return Dh(this)?this.filters.find(r=>!r.matches(e))===void 0:this.filters.find(r=>r.matches(e))!==void 0}getFlattenedFilters(){return this.he!==null||(this.he=this.filters.reduce((e,r)=>e.concat(r.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}};function Dh(n){return n.op==="and"}function sb(n){return n.op==="or"}function sM(n){return YH(n)&&Dh(n)}function YH(n){for(let e of n.filters)if(e instanceof nt)return!1;return!0}function ab(n){if(n instanceof $e)return n.field.canonicalString()+n.op.toString()+Ah(n.value);if(sM(n))return n.filters.map(e=>ab(e)).join(",");{let e=n.filters.map(r=>ab(r)).join(",");return`${n.op}(${e})`}}function QH(n,e){return n instanceof $e?(function(t,i){return i instanceof $e&&t.op===i.op&&t.field.isEqual(i.field)&&jo(t.value,i.value)})(n,e):n instanceof nt?(function(t,i){return i instanceof nt&&t.op===i.op&&t.filters.length===i.filters.length?t.filters.reduce((o,s,a)=>o&&QH(s,i.filters[a]),!0):!1})(n,e):void ae(19439)}function XH(n,e){let r=n.filters.concat(e);return nt.create(r,n.op)}function JH(n){return n instanceof $e?(function(r){return`${r.field.canonicalString()} ${r.op} ${Ah(r.value)}`})(n):n instanceof nt?(function(r){return r.op.toString()+" {"+r.getFilters().map(JH).join(" ,")+"}"})(n):"Filter"}var cb=class extends $e{constructor(e,r,t){super(e,r,t),this.key=ie.fromName(t.referenceValue)}matches(e){let r=ie.comparator(e.key,this.key);return this.matchesComparison(r)}},lb=class extends $e{constructor(e,r){super(e,"in",r),this.keys=ZH("in",r)}matches(e){return this.keys.some(r=>r.isEqual(e.key))}},ub=class extends $e{constructor(e,r){super(e,"not-in",r),this.keys=ZH("not-in",r)}matches(e){return!this.keys.some(r=>r.isEqual(e.key))}};function ZH(n,e){var r;return(((r=e.arrayValue)===null||r===void 0?void 0:r.values)||[]).map(t=>ie.fromName(t.referenceValue))}var db=class extends $e{constructor(e,r){super(e,"array-contains",r)}matches(e){let r=e.data.field(this.field);return Zm(r)&&Jm(r.arrayValue,this.value)}},Hv=class extends $e{constructor(e,r){super(e,"in",r)}matches(e){let r=e.data.field(this.field);return r!==null&&Jm(this.value.arrayValue,r)}},hb=class extends $e{constructor(e,r){super(e,"not-in",r)}matches(e){if(Jm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let r=e.data.field(this.field);return r!==null&&r.nullValue===void 0&&!Jm(this.value.arrayValue,r)}},fb=class extends $e{constructor(e,r){super(e,"array-contains-any",r)}matches(e){let r=e.data.field(this.field);return!(!Zm(r)||!r.arrayValue.values)&&r.arrayValue.values.some(t=>Jm(this.value.arrayValue,t))}};var gb=class{constructor(e,r=null,t=[],i=[],o=null,s=null,a=null){this.path=e,this.collectionGroup=r,this.orderBy=t,this.filters=i,this.limit=o,this.startAt=s,this.endAt=a,this.Pe=null}};function mb(n,e=null,r=[],t=[],i=null,o=null,s=null){return new gb(n,e,r,t,i,o,s)}function zl(n){let e=de(n);if(e.Pe===null){let r=e.path.canonicalString();e.collectionGroup!==null&&(r+="|cg:"+e.collectionGroup),r+="|f:",r+=e.filters.map(t=>ab(t)).join(","),r+="|ob:",r+=e.orderBy.map(t=>(function(o){return o.field.canonicalString()+o.dir})(t)).join(","),_p(e.limit)||(r+="|l:",r+=e.limit),e.startAt&&(r+="|lb:",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map(t=>Ah(t)).join(",")),e.endAt&&(r+="|ub:",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map(t=>Ah(t)).join(",")),e.Pe=r}return e.Pe}function Ip(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let r=0;r<n.orderBy.length;r++)if(!Mie(n.orderBy[r],e.orderBy[r]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let r=0;r<n.filters.length;r++)if(!QH(n.filters[r],e.filters[r]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Dj(n.startAt,e.startAt)&&Dj(n.endAt,e.endAt)}function Wv(n){return ie.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function zv(n,e){return n.filters.filter(r=>r instanceof $e&&r.field.isEqual(e))}function Rj(n,e,r){let t=Cv,i=!0;for(let o of zv(n,e)){let s=Cv,a=!0;switch(o.op){case"<":case"<=":s=bie(o.value);break;case"==":case"in":case">=":s=o.value;break;case">":s=o.value,a=!1;break;case"!=":case"not-in":s=Cv}yj({value:t,inclusive:i},{value:s,inclusive:a})<0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];yj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})<0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}function Cj(n,e,r){let t=Fa,i=!0;for(let o of zv(n,e)){let s=Fa,a=!0;switch(o.op){case">=":case">":s=Lie(o.value),a=!1;break;case"==":case"in":case"<=":s=o.value;break;case"<":s=o.value,a=!1;break;case"!=":case"not-in":s=Fa}Sj({value:t,inclusive:i},{value:s,inclusive:a})>0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];Sj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})>0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}var Wo=class{constructor(e,r=null,t=[],i=[],o=null,s="F",a=null,c=null){this.path=e,this.collectionGroup=r,this.explicitOrderBy=t,this.filters=i,this.limit=o,this.limitType=s,this.startAt=a,this.endAt=c,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}};function eW(n,e,r,t,i,o,s,a){return new Wo(n,e,r,t,i,o,s,a)}function vp(n){return new Wo(n)}function Nj(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function aM(n){return n.collectionGroup!==null}function dh(n){let e=de(n);if(e.Te===null){e.Te=[];let r=new Set;for(let o of e.explicitOrderBy)e.Te.push(o),r.add(o.field.canonicalString());let t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(s){let a=new at(Tn.comparator);return s.filters.forEach(c=>{c.getFlattenedFilters().forEach(l=>{l.isInequality()&&(a=a.add(l.field))})}),a})(e).forEach(o=>{r.has(o.canonicalString())||o.isKeyField()||e.Te.push(new Wl(o,t))}),r.has(Tn.keyField().canonicalString())||e.Te.push(new Wl(Tn.keyField(),t))}return e.Te}function Xr(n){let e=de(n);return e.Ie||(e.Ie=tW(e,dh(n))),e.Ie}function Pie(n){let e=de(n);return e.de||(e.de=tW(e,n.explicitOrderBy)),e.de}function tW(n,e){if(n.limitType==="F")return mb(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(i=>{let o=i.dir==="desc"?"asc":"desc";return new Wl(i.field,o)});let r=n.endAt?new Ho(n.endAt.position,n.endAt.inclusive):null,t=n.startAt?new Ho(n.startAt.position,n.startAt.inclusive):null;return mb(n.path,n.collectionGroup,e,n.filters,n.limit,r,t)}}function pb(n,e){let r=n.filters.concat([e]);return new Wo(n.path,n.collectionGroup,n.explicitOrderBy.slice(),r,n.limit,n.limitType,n.startAt,n.endAt)}function qv(n,e,r){return new Wo(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,r,n.startAt,n.endAt)}function Fy(n,e){return Ip(Xr(n),Xr(e))&&n.limitType===e.limitType}function nW(n){return`${zl(Xr(n))}|lt:${n.limitType}`}function sh(n){return`Query(target=${(function(r){let t=r.path.canonicalString();return r.collectionGroup!==null&&(t+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(t+=`, filters: [${r.filters.map(i=>JH(i)).join(", ")}]`),_p(r.limit)||(t+=", limit: "+r.limit),r.orderBy.length>0&&(t+=`, orderBy: [${r.orderBy.map(i=>(function(s){return`${s.field.canonicalString()} (${s.dir})`})(i)).join(", ")}]`),r.startAt&&(t+=", startAt: ",t+=r.startAt.inclusive?"b:":"a:",t+=r.startAt.position.map(i=>Ah(i)).join(",")),r.endAt&&(t+=", endAt: ",t+=r.endAt.inclusive?"a:":"b:",t+=r.endAt.position.map(i=>Ah(i)).join(",")),`Target(${t})`})(Xr(n))}; limitType=${n.limitType})`}function yp(n,e){return e.isFoundDocument()&&(function(t,i){let o=i.key.path;return t.collectionGroup!==null?i.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(o):ie.isDocumentKey(t.path)?t.path.isEqual(o):t.path.isImmediateParentOf(o)})(n,e)&&(function(t,i){for(let o of dh(t))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(n,e)&&(function(t,i){for(let o of t.filters)if(!o.matches(i))return!1;return!0})(n,e)&&(function(t,i){return!(t.startAt&&!(function(s,a,c){let l=Aj(s,a,c);return s.inclusive?l<=0:l<0})(t.startAt,dh(t),i)||t.endAt&&!(function(s,a,c){let l=Aj(s,a,c);return s.inclusive?l>=0:l>0})(t.endAt,dh(t),i))})(n,e)}function rW(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function iW(n){return(e,r)=>{let t=!1;for(let i of dh(n)){let o=xie(i,e,r);if(o!==0)return o;t=t||i.field.isKeyField()}return 0}}function xie(n,e,r){let t=n.field.isKeyField()?ie.comparator(e.key,r.key):(function(o,s,a){let c=s.data.field(o),l=a.data.field(o);return c!==null&&l!==null?Ha(c,l):ae(42886)})(n.field,e,r);switch(n.dir){case"asc":return t;case"desc":return-1*t;default:return ae(19790,{direction:n.dir})}}var Ki=class{constructor(e,r){this.mapKeyFn=e,this.equalsFn=r,this.inner={},this.innerSize=0}get(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t!==void 0){for(let[i,o]of t)if(this.equalsFn(i,e))return o}}has(e){return this.get(e)!==void 0}set(e,r){let t=this.mapKeyFn(e),i=this.inner[t];if(i===void 0)return this.inner[t]=[[e,r]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],e))return void(i[o]=[e,r]);i.push([e,r]),this.innerSize++}delete(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t===void 0)return!1;for(let i=0;i<t.length;i++)if(this.equalsFn(t[i][0],e))return t.length===1?delete this.inner[r]:t.splice(i,1),this.innerSize--,!0;return!1}forEach(e){Ja(this.inner,(r,t)=>{for(let[i,o]of t)e(i,o)})}isEmpty(){return BH(this.inner)}size(){return this.innerSize}};var Fie=new Dt(ie.comparator);function Qr(){return Fie}var oW=new Dt(ie.comparator);function Lm(...n){let e=oW;for(let r of n)e=e.insert(r.key,r);return e}function sW(n){let e=oW;return n.forEach((r,t)=>e=e.insert(r,t.overlayedDocument)),e}function Go(){return Vm()}function aW(){return Vm()}function Vm(){return new Ki(n=>n.toString(),(n,e)=>n.isEqual(e))}var kie=new Dt(ie.comparator),Uie=new at(ie.comparator);function Ve(...n){let e=Uie;for(let r of n)e=e.add(r);return e}var Vie=new at(Re);function cM(){return Vie}function lM(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Wm(e)?"-0":e}}function cW(n){return{integerValue:""+n}}function Bie(n,e){return OH(e)?cW(e):lM(n,e)}var Rh=class{constructor(){this._=void 0}};function Gie(n,e,r){return n instanceof ql?(function(i,o){let s={fields:{[$H]:{stringValue:GH},[HH]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&My(o)&&(o=Py(o)),o&&(s.fields[jH]=o),{mapValue:s}})(r,e):n instanceof Wa?uW(n,e):n instanceof za?dW(n,e):(function(i,o){let s=lW(i,o),a=Oj(s)+Oj(i.Ee);return ob(s)&&ob(i.Ee)?cW(a):lM(i.serializer,a)})(n,e)}function $ie(n,e,r){return n instanceof Wa?uW(n,e):n instanceof za?dW(n,e):r}function lW(n,e){return n instanceof Kl?(function(t){return ob(t)||(function(o){return!!o&&"doubleValue"in o})(t)})(e)?e:{integerValue:0}:null}var ql=class extends Rh{},Wa=class extends Rh{constructor(e){super(),this.elements=e}};function uW(n,e){let r=hW(e);for(let t of n.elements)r.some(i=>jo(i,t))||r.push(t);return{arrayValue:{values:r}}}var za=class extends Rh{constructor(e){super(),this.elements=e}};function dW(n,e){let r=hW(e);for(let t of n.elements)r=r.filter(i=>!jo(i,t));return{arrayValue:{values:r}}}var Kl=class extends Rh{constructor(e,r){super(),this.serializer=e,this.Ee=r}};function Oj(n){return Mt(n.integerValue||n.doubleValue)}function hW(n){return Zm(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}var Eb=class{constructor(e,r){this.field=e,this.transform=r}};function jie(n,e){return n.field.isEqual(e.field)&&(function(t,i){return t instanceof Wa&&i instanceof Wa||t instanceof za&&i instanceof za?gh(t.elements,i.elements,jo):t instanceof Kl&&i instanceof Kl?jo(t.Ee,i.Ee):t instanceof ql&&i instanceof ql})(n.transform,e.transform)}var _b=class{constructor(e,r){this.version=e,this.transformResults=r}},Gn=class n{constructor(e,r){this.updateTime=e,this.exists=r}static none(){return new n}static exists(e){return new n(void 0,e)}static updateTime(e){return new n(e)}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 wv(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}var Ch=class{};function fW(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Yl(n.key,Gn.none()):new qa(n.key,n.data,Gn.none());{let r=n.data,t=nr.empty(),i=new at(Tn.comparator);for(let o of e.fields)if(!i.has(o)){let s=r.field(o);s===null&&o.length>1&&(o=o.popLast(),s=r.field(o)),s===null?t.delete(o):t.set(o,s),i=i.add(o)}return new Yi(n.key,t,new Yr(i.toArray()),Gn.none())}}function Hie(n,e,r){n instanceof qa?(function(i,o,s){let a=i.value.clone(),c=bj(i.fieldTransforms,o,s.transformResults);a.setAll(c),o.convertToFoundDocument(s.version,a).setHasCommittedMutations()})(n,e,r):n instanceof Yi?(function(i,o,s){if(!wv(i.precondition,o))return void o.convertToUnknownDocument(s.version);let a=bj(i.fieldTransforms,o,s.transformResults),c=o.data;c.setAll(gW(i)),c.setAll(a),o.convertToFoundDocument(s.version,c).setHasCommittedMutations()})(n,e,r):(function(i,o,s){o.convertToNoDocument(s.version).setHasCommittedMutations()})(0,e,r)}function Bm(n,e,r,t){return n instanceof qa?(function(o,s,a,c){if(!wv(o.precondition,s))return a;let l=o.value.clone(),u=Lj(o.fieldTransforms,c,s);return l.setAll(u),s.convertToFoundDocument(s.version,l).setHasLocalMutations(),null})(n,e,r,t):n instanceof Yi?(function(o,s,a,c){if(!wv(o.precondition,s))return a;let l=Lj(o.fieldTransforms,c,s),u=s.data;return u.setAll(gW(o)),u.setAll(l),s.convertToFoundDocument(s.version,u).setHasLocalMutations(),a===null?null:a.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map(d=>d.field))})(n,e,r,t):(function(o,s,a){return wv(o.precondition,s)?(s.convertToNoDocument(s.version).setHasLocalMutations(),null):a})(n,e,r)}function Wie(n,e){let r=null;for(let t of n.fieldTransforms){let i=e.data.field(t.field),o=lW(t.transform,i||null);o!=null&&(r===null&&(r=nr.empty()),r.set(t.field,o))}return r||null}function wj(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!(function(t,i){return t===void 0&&i===void 0||!(!t||!i)&&gh(t,i,(o,s)=>jie(o,s))})(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}var qa=class extends Ch{constructor(e,r,t,i=[]){super(),this.key=e,this.value=r,this.precondition=t,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},Yi=class extends Ch{constructor(e,r,t,i,o=[]){super(),this.key=e,this.data=r,this.fieldMask=t,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}};function gW(n){let e=new Map;return n.fieldMask.fields.forEach(r=>{if(!r.isEmpty()){let t=n.data.field(r);e.set(r,t)}}),e}function bj(n,e,r){let t=new Map;he(n.length===r.length,32656,{Ae:r.length,Re:n.length});for(let i=0;i<r.length;i++){let o=n[i],s=o.transform,a=e.data.field(o.field);t.set(o.field,$ie(s,a,r[i]))}return t}function Lj(n,e,r){let t=new Map;for(let i of n){let o=i.transform,s=r.data.field(i.field);t.set(i.field,Gie(o,s,e))}return t}var Yl=class extends Ch{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},ep=class extends Ch{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var tp=class{constructor(e,r,t,i){this.batchId=e,this.localWriteTime=r,this.baseMutations=t,this.mutations=i}applyToRemoteDocument(e,r){let t=r.mutationResults;for(let i=0;i<this.mutations.length;i++){let o=this.mutations[i];o.key.isEqual(e.key)&&Hie(o,e,t[i])}}applyToLocalView(e,r){for(let t of this.baseMutations)t.key.isEqual(e.key)&&(r=Bm(t,e,r,this.localWriteTime));for(let t of this.mutations)t.key.isEqual(e.key)&&(r=Bm(t,e,r,this.localWriteTime));return r}applyToLocalDocumentSet(e,r){let t=aW();return this.mutations.forEach(i=>{let o=e.get(i.key),s=o.overlayedDocument,a=this.applyToLocalView(s,o.mutatedFields);a=r.has(i.key)?null:a;let c=fW(s,a);c!==null&&t.set(i.key,c),s.isValidDocument()||s.convertToNoDocument(me.min())}),t}keys(){return this.mutations.reduce((e,r)=>e.add(r.key),Ve())}isEqual(e){return this.batchId===e.batchId&&gh(this.mutations,e.mutations,(r,t)=>wj(r,t))&&gh(this.baseMutations,e.baseMutations,(r,t)=>wj(r,t))}},Tb=class n{constructor(e,r,t,i){this.batch=e,this.commitVersion=r,this.mutationResults=t,this.docVersions=i}static from(e,r,t){he(e.mutations.length===t.length,58842,{Ve:e.mutations.length,me:t.length});let i=(function(){return kie})(),o=e.mutations;for(let s=0;s<o.length;s++)i=i.insert(o[s].key,t[s].version);return new n(e,r,t,i)}};var np=class{constructor(e,r){this.largestBatchId=e,this.mutation=r}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
153
|
+
`}),m}function oS(h,m,E){e:{for(y in E){var y=!1;break e}y=!0}y||(E=zM(E),typeof h=="string"?E!=null&&encodeURIComponent(String(E)):rt(h,m,E))}function Gt(h){Zt.call(this),this.headers=new Map,this.o=h||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}p(Gt,Zt);var d3=/^https?$/i,h3=["POST","PUT"];n=Gt.prototype,n.Ha=function(h){this.J=h},n.ea=function(h,m,E,y){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+h);m=m?m.toUpperCase():"GET",this.D=h,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():hu.g(),this.v=this.o?Zh(this.o):Zh(hu),this.g.onreadystatechange=f(this.Ea,this);try{this.B=!0,this.g.open(m,String(h),!0),this.B=!1}catch(W){qM(this,W);return}if(h=E||"",E=new Map(this.headers),y)if(Object.getPrototypeOf(y)===Object.prototype)for(var V in y)E.set(V,y[V]);else if(typeof y.keys=="function"&&typeof y.get=="function")for(let W of y.keys())E.set(W,y.get(W));else throw Error("Unknown input type for opt_headers: "+String(y));y=Array.from(E.keys()).find(W=>W.toLowerCase()=="content-type"),V=a.FormData&&h instanceof a.FormData,!(0<=Array.prototype.indexOf.call(h3,m,void 0))||y||V||E.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[W,re]of E)this.g.setRequestHeader(W,re);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{QM(this),this.u=!0,this.g.send(h),this.u=!1}catch(W){qM(this,W)}};function qM(h,m){h.h=!1,h.g&&(h.j=!0,h.g.abort(),h.j=!1),h.l=m,h.m=5,KM(h),Fp(h)}function KM(h){h.A||(h.A=!0,Bt(h,"complete"),Bt(h,"error"))}n.abort=function(h){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=h||7,Bt(this,"complete"),Bt(this,"abort"),Fp(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Fp(this,!0)),Gt.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?YM(this):this.bb())},n.bb=function(){YM(this)};function YM(h){if(h.h&&typeof s<"u"&&(!h.v[1]||es(h)!=4||h.Z()!=2)){if(h.u&&es(h)==4)uc(h.Ea,0,h);else if(Bt(h,"readystatechange"),es(h)==4){h.h=!1;try{let re=h.Z();e:switch(re){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var m=!0;break e;default:m=!1}var E;if(!(E=m)){var y;if(y=re===0){var V=String(h.D).match(Ne)[1]||null;!V&&a.self&&a.self.location&&(V=a.self.location.protocol.slice(0,-1)),y=!d3.test(V?V.toLowerCase():"")}E=y}if(E)Bt(h,"complete"),Bt(h,"success");else{h.m=6;try{var W=2<es(h)?h.g.statusText:""}catch{W=""}h.l=W+" ["+h.Z()+"]",KM(h)}}finally{Fp(h)}}}}function Fp(h,m){if(h.g){QM(h);let E=h.g,y=h.v[0]?()=>{}:null;h.g=null,h.v=null,m||Bt(h,"ready");try{E.onreadystatechange=y}catch{}}}function QM(h){h.I&&(a.clearTimeout(h.I),h.I=null)}n.isActive=function(){return!!this.g};function es(h){return h.g?h.g.readyState:0}n.Z=function(){try{return 2<es(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(h){if(this.g){var m=this.g.responseText;return h&&m.indexOf(h)==0&&(m=m.substring(h.length)),Jr(m)}};function XM(h){try{if(!h.g)return null;if("response"in h.g)return h.g.response;switch(h.H){case"":case"text":return h.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in h.g)return h.g.mozResponseArrayBuffer}return null}catch{return null}}function f3(h){let m={};h=(h.g&&2<=es(h)&&h.g.getAllResponseHeaders()||"").split(`\r
|
|
154
|
+
`);for(let y=0;y<h.length;y++){if(b(h[y]))continue;var E=P(h[y]);let V=E[0];if(E=E[1],typeof E!="string")continue;E=E.trim();let W=m[V]||[];m[V]=W,W.push(E)}S(m,function(y){return y.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Ef(h,m,E){return E&&E.internalChannelParams&&E.internalChannelParams[h]||m}function JM(h){this.Aa=0,this.i=[],this.j=new hc,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Ef("failFast",!1,h),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Ef("baseRetryDelayMs",5e3,h),this.cb=Ef("retryDelaySeedMs",1e4,h),this.Wa=Ef("forwardChannelMaxRetries",2,h),this.wa=Ef("forwardChannelRequestTimeoutMs",2e4,h),this.pa=h&&h.xmlHttpFactory||void 0,this.Xa=h&&h.Tb||void 0,this.Ca=h&&h.useFetchStreams||!1,this.L=void 0,this.J=h&&h.supportsCrossDomainXhr||!1,this.K="",this.h=new cf(h&&h.concurrentRequestLimit),this.Da=new l3,this.P=h&&h.fastHandshake||!1,this.O=h&&h.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=h&&h.Rb||!1,h&&h.xa&&this.j.xa(),h&&h.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&h&&h.detectBufferingProxy||!1,this.ja=void 0,h&&h.longPollingTimeout&&0<h.longPollingTimeout&&(this.ja=h.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=JM.prototype,n.la=8,n.G=1,n.connect=function(h,m,E,y){dn(0),this.W=h,this.H=m||{},E&&y!==void 0&&(this.H.OSID=E,this.H.OAID=y),this.F=this.X,this.I=aP(this,null,this.W),Up(this)};function sS(h){if(ZM(h),h.G==3){var m=h.U++,E=Ye(h.I);if(rt(E,"SID",h.K),rt(E,"RID",m),rt(E,"TYPE","terminate"),_f(h,E),m=new en(h,h.j,m),m.L=2,m.v=Pp(Ye(E)),E=!1,a.navigator&&a.navigator.sendBeacon)try{E=a.navigator.sendBeacon(m.v.toString(),"")}catch{}!E&&a.Image&&(new Image().src=m.v,E=!0),E||(m.g=cP(m.j,null),m.g.ea(m.v)),m.F=Date.now(),Xo(m)}sP(h)}function kp(h){h.g&&(cS(h),h.g.cancel(),h.g=null)}function ZM(h){kp(h),h.u&&(a.clearTimeout(h.u),h.u=null),Vp(h),h.h.cancel(),h.s&&(typeof h.s=="number"&&a.clearTimeout(h.s),h.s=null)}function Up(h){if(!lf(h.h)&&!h.s){h.s=!0;var m=h.Ga;Ms||Op(),nc||(Ms(),nc=!0),Kh.add(m,h),h.B=0}}function g3(h,m){return fc(h.h)>=h.h.j-(h.s?1:0)?!1:h.s?(h.i=m.D.concat(h.i),!0):h.G==1||h.G==2||h.B>=(h.Va?0:h.Wa)?!1:(h.s=vi(f(h.Ga,h,m),oP(h,h.B)),h.B++,!0)}n.Ga=function(h){if(this.s)if(this.s=null,this.G==1){if(!h){this.U=Math.floor(1e5*Math.random()),h=this.U++;let V=new en(this,this.j,h),W=this.o;if(this.S&&(W?(W=A(W),O(W,this.S)):W=this.S),this.m!==null||this.O||(V.H=W,W=null),this.P)e:{for(var m=0,E=0;E<this.i.length;E++){t:{var y=this.i[E];if("__data__"in y.map&&(y=y.map.__data__,typeof y=="string")){y=y.length;break t}y=void 0}if(y===void 0)break;if(m+=y,4096<m){m=E;break e}if(m===4096||E===this.i.length-1){m=E+1;break e}}m=1e3}else m=1e3;m=tP(this,V,m),E=Ye(this.I),rt(E,"RID",h),rt(E,"CVER",22),this.D&&rt(E,"X-HTTP-Session-Id",this.D),_f(this,E),W&&(this.O?m="headers="+encodeURIComponent(String(zM(W)))+"&"+m:this.m&&oS(E,this.m,W)),se(this.h,V),this.Ua&&rt(E,"TYPE","init"),this.P?(rt(E,"$req",m),rt(E,"SID","null"),V.T=!0,rf(V,E,null)):rf(V,E,m),this.G=2}}else this.G==3&&(h?eP(this,h):this.i.length==0||lf(this.h)||eP(this))};function eP(h,m){var E;m?E=m.l:E=h.U++;let y=Ye(h.I);rt(y,"SID",h.K),rt(y,"RID",E),rt(y,"AID",h.T),_f(h,y),h.m&&h.o&&oS(y,h.m,h.o),E=new en(h,h.j,E,h.B+1),h.m===null&&(E.H=h.o),m&&(h.i=m.D.concat(h.i)),m=tP(h,E,1e3),E.I=Math.round(.5*h.wa)+Math.round(.5*h.wa*Math.random()),se(h.h,E),rf(E,y,m)}function _f(h,m){h.H&&k(h.H,function(E,y){rt(m,y,E)}),h.l&&Ce({},function(E,y){rt(m,y,E)})}function tP(h,m,E){E=Math.min(h.i.length,E);var y=h.l?f(h.l.Na,h.l,h):null;e:{var V=h.i;let W=-1;for(;;){let re=["count="+E];W==-1?0<E?(W=V[0].g,re.push("ofs="+W)):W=0:re.push("ofs="+W);let ct=!0;for(let Mn=0;Mn<E;Mn++){let ze=V[Mn].g,$n=V[Mn].map;if(ze-=W,0>ze)W=Math.max(0,V[Mn].g-100),ct=!1;else try{u3($n,re,"req"+ze+"_")}catch{y&&y($n)}}if(ct){y=re.join("&");break e}}}return h=h.i.splice(0,E),m.D=h,y}function nP(h){if(!h.g&&!h.u){h.Y=1;var m=h.Fa;Ms||Op(),nc||(Ms(),nc=!0),Kh.add(m,h),h.v=0}}function aS(h){return h.g||h.u||3<=h.v?!1:(h.Y++,h.u=vi(f(h.Fa,h),oP(h,h.v)),h.v++,!0)}n.Fa=function(){if(this.u=null,rP(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var h=2*this.R;this.j.info("BP detection timer enabled: "+h),this.A=vi(f(this.ab,this),h)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,dn(10),kp(this),rP(this))};function cS(h){h.A!=null&&(a.clearTimeout(h.A),h.A=null)}function rP(h){h.g=new en(h,h.j,"rpc",h.Y),h.m===null&&(h.g.H=h.o),h.g.O=0;var m=Ye(h.qa);rt(m,"RID","rpc"),rt(m,"SID",h.K),rt(m,"AID",h.T),rt(m,"CI",h.F?"0":"1"),!h.F&&h.ja&&rt(m,"TO",h.ja),rt(m,"TYPE","xmlhttp"),_f(h,m),h.m&&h.o&&oS(m,h.m,h.o),h.L&&(h.g.I=h.L);var E=h.g;h=h.ia,E.L=1,E.v=Pp(Ye(m)),E.m=null,E.P=!0,of(E,h)}n.Za=function(){this.C!=null&&(this.C=null,kp(this),aS(this),dn(19))};function Vp(h){h.C!=null&&(a.clearTimeout(h.C),h.C=null)}function iP(h,m){var E=null;if(h.g==m){Vp(h),cS(h),h.g=null;var y=2}else if(gc(h.h,m))E=m.D,R(h.h,m),y=1;else return;if(h.G!=0){if(m.o)if(y==1){E=m.m?m.m.length:0,m=Date.now()-m.F;var V=h.B;y=Vs(),Bt(y,new Lp(y,E)),Up(h)}else nP(h);else if(V=m.s,V==3||V==0&&0<m.X||!(y==1&&g3(h,m)||y==2&&aS(h)))switch(E&&0<E.length&&(m=h.h,m.i=m.i.concat(E)),V){case 1:mc(h,5);break;case 4:mc(h,10);break;case 3:mc(h,6);break;default:mc(h,2)}}}function oP(h,m){let E=h.Ta+Math.floor(Math.random()*h.cb);return h.isActive()||(E*=2),E*m}function mc(h,m){if(h.j.info("Error code "+m),m==2){var E=f(h.fb,h),y=h.Xa;let V=!y;y=new je(y||"//www.google.com/images/cleardot.gif"),a.location&&a.location.protocol=="http"||Mr(y,"https"),Pp(y),V?a3(y.toString(),E):c3(y.toString(),E)}else dn(2);h.G=0,h.l&&h.l.sa(m),sP(h),ZM(h)}n.fb=function(h){h?(this.j.info("Successfully pinged google.com"),dn(2)):(this.j.info("Failed to ping google.com"),dn(1))};function sP(h){if(h.G=0,h.ka=[],h.l){let m=z(h.h);(m.length!=0||h.i.length!=0)&&(T(h.ka,m),T(h.ka,h.i),h.h.i.length=0,_(h.i),h.i.length=0),h.l.ra()}}function aP(h,m,E){var y=E instanceof je?Ye(E):new je(E);if(y.g!="")m&&(y.g=m+"."+y.g),xt(y,y.s);else{var V=a.location;y=V.protocol,m=m?m+"."+V.hostname:V.hostname,V=+V.port;var W=new je(null);y&&Mr(W,y),m&&(W.g=m),V&&xt(W,V),E&&(W.l=E),y=W}return E=h.D,m=h.ya,E&&m&&rt(y,E,m),rt(y,"VER",h.la),_f(h,y),y}function cP(h,m,E){if(m&&!h.J)throw Error("Can't create secondary domain capable XhrIo object.");return m=h.Ca&&!h.pa?new Gt(new gf({eb:E})):new Gt(h.pa),m.Ha(h.J),m}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function lP(){}n=lP.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Bp(){}Bp.prototype.g=function(h,m){return new Pr(h,m)};function Pr(h,m){Zt.call(this),this.g=new JM(m),this.l=h,this.h=m&&m.messageUrlParams||null,h=m&&m.messageHeaders||null,m&&m.clientProtocolHeaderRequired&&(h?h["X-Client-Protocol"]="webchannel":h={"X-Client-Protocol":"webchannel"}),this.g.o=h,h=m&&m.initMessageHeaders||null,m&&m.messageContentType&&(h?h["X-WebChannel-Content-Type"]=m.messageContentType:h={"X-WebChannel-Content-Type":m.messageContentType}),m&&m.va&&(h?h["X-WebChannel-Client-Profile"]=m.va:h={"X-WebChannel-Client-Profile":m.va}),this.g.S=h,(h=m&&m.Sb)&&!b(h)&&(this.g.m=h),this.v=m&&m.supportsCrossDomainXhr||!1,this.u=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!b(m)&&(this.g.D=m,h=this.h,h!==null&&m in h&&(h=this.h,m in h&&delete h[m])),this.j=new pu(this)}p(Pr,Zt),Pr.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Pr.prototype.close=function(){sS(this.g)},Pr.prototype.o=function(h){var m=this.g;if(typeof h=="string"){var E={};E.__data__=h,h=E}else this.u&&(E={},E.__data__=ro(h),h=E);m.i.push(new iS(m.Ya++,h)),m.G==3&&Up(m)},Pr.prototype.N=function(){this.g.l=null,delete this.j,sS(this.g),delete this.g,Pr.aa.N.call(this)};function uP(h){ks.call(this),h.__headers__&&(this.headers=h.__headers__,this.statusCode=h.__status__,delete h.__headers__,delete h.__status__);var m=h.__sm__;if(m){e:{for(let E in m){h=E;break e}h=void 0}(this.i=h)&&(h=this.i,m=m!==null&&h in m?m[h]:void 0),this.data=m}else this.data=h}p(uP,ks);function dP(){Us.call(this),this.status=1}p(dP,Us);function pu(h){this.g=h}p(pu,lP),pu.prototype.ua=function(){Bt(this.g,"a")},pu.prototype.ta=function(h){Bt(this.g,new uP(h))},pu.prototype.sa=function(h){Bt(this.g,new dP)},pu.prototype.ra=function(){Bt(this.g,"b")},Bp.prototype.createWebChannel=Bp.prototype.g,Pr.prototype.send=Pr.prototype.o,Pr.prototype.open=Pr.prototype.m,Pr.prototype.close=Pr.prototype.close,Pw=Rs.createWebChannelTransport=function(){return new Bp},Mw=Rs.getStatEventTarget=function(){return Vs()},Lw=Rs.Event=Sn,Tv=Rs.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Bs.NO_ERROR=0,Bs.TIMEOUT=8,Bs.HTTP_ERROR=6,Cm=Rs.ErrorCode=Bs,ef.COMPLETE="complete",bw=Rs.EventType=ef,lu.EventType=Fs,Fs.OPEN="a",Fs.CLOSE="b",Fs.ERROR="c",Fs.MESSAGE="d",Zt.prototype.listen=Zt.prototype.K,Jd=Rs.WebChannel=lu,Xre=Rs.FetchXmlHttpFactory=gf,Gt.prototype.listenOnce=Gt.prototype.L,Gt.prototype.getLastError=Gt.prototype.Ka,Gt.prototype.getLastErrorCode=Gt.prototype.Ba,Gt.prototype.getStatus=Gt.prototype.Z,Gt.prototype.getResponseJson=Gt.prototype.Oa,Gt.prototype.getResponseText=Gt.prototype.oa,Gt.prototype.send=Gt.prototype.ea,Gt.prototype.setWithCredentials=Gt.prototype.Ha,ww=Rs.XhrIo=Gt}).apply(typeof _v<"u"?_v:typeof self<"u"?self:typeof window<"u"?window:{});var oj="@firebase/firestore",sj="4.8.0";var cn=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}};cn.UNAUTHENTICATED=new cn(null),cn.GOOGLE_CREDENTIALS=new cn("google-credentials-uid"),cn.FIRST_PARTY=new cn("first-party-uid"),cn.MOCK_USER=new cn("mock-user");var Uh="11.10.0";var $a=new fi("@firebase/firestore");function oh(){return $a.logLevel}function YL(n){$a.setLogLevel(n)}function X(n,...e){if($a.logLevel<=Fe.DEBUG){let r=e.map(QL);$a.debug(`Firestore (${Uh}): ${n}`,...r)}}function Xt(n,...e){if($a.logLevel<=Fe.ERROR){let r=e.map(QL);$a.error(`Firestore (${Uh}): ${n}`,...r)}}function ws(n,...e){if($a.logLevel<=Fe.WARN){let r=e.map(QL);$a.warn(`Firestore (${Uh}): ${n}`,...r)}}function QL(n){if(typeof n=="string")return n;try{return(function(r){return JSON.stringify(r)})(n)}catch{return n}}function ae(n,e,r){let t="Unexpected state";typeof e=="string"?t=e:r=e,vH(n,t,r)}function vH(n,e,r){let t=`FIRESTORE (${Uh}) INTERNAL ASSERTION FAILED: ${e} (ID: ${n.toString(16)})`;if(r!==void 0)try{t+=" CONTEXT: "+JSON.stringify(r)}catch{t+=" CONTEXT: "+r}throw Xt(t),new Error(t)}function he(n,e,r,t){let i="Unexpected state";typeof r=="string"?i=r:t=r,n||vH(e,i,t)}function de(n,e){return n}var j={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"},Q=class extends vr{constructor(e,r){super(e,r),this.code=e,this.message=r,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}};var Or=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=e,this.reject=r})}};var Mv=class{constructor(e,r){this.user=r,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}},$w=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,r){e.enqueueRetryable(()=>r(cn.UNAUTHENTICATED))}shutdown(){}},jw=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,r){this.changeListener=r,e.enqueueRetryable(()=>r(this.token.user))}shutdown(){this.changeListener=null}},Hw=class{constructor(e){this.t=e,this.currentUser=cn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,r){he(this.o===void 0,42304);let t=this.i,i=c=>this.i!==t?(t=this.i,r(c)):Promise.resolve(),o=new Or;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new Or,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let c=o;e.enqueueRetryable(()=>I(this,null,function*(){yield c.promise,yield i(this.currentUser)}))},a=c=>{X("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){let c=this.t.getImmediate({optional:!0});c?a(c):(X("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new Or)}},0),s()}getToken(){let e=this.i,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then(t=>this.i!==e?(X("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(he(typeof t.accessToken=="string",31837,{l:t}),new Mv(t.accessToken,this.currentUser)):null):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 he(e===null||typeof e=="string",2055,{h:e}),new cn(e)}},Ww=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t,this.type="FirstParty",this.user=cn.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},zw=class{constructor(e,r,t){this.P=e,this.T=r,this.I=t}getToken(){return Promise.resolve(new Ww(this.P,this.T,this.I))}start(e,r){e.enqueueRetryable(()=>r(cn.FIRST_PARTY))}shutdown(){}invalidateToken(){}},Pv=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)}},qw=class{constructor(e,r){this.V=r,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,yr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,r){he(this.o===void 0,3512);let t=o=>{o.error!=null&&X("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${o.error.message}`);let s=o.token!==this.m;return this.m=o.token,X("FirebaseAppCheckTokenProvider",`Received ${s?"new":"existing"} token.`),s?r(o.token):Promise.resolve()};this.o=o=>{e.enqueueRetryable(()=>t(o))};let i=o=>{X("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=o,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(o=>i(o)),setTimeout(()=>{if(!this.appCheck){let o=this.V.getImmediate({optional:!0});o?i(o):X("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Pv(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(r=>r?(he(typeof r.token=="string",44558,{tokenResult:r}),this.m=r.token,new Pv(r.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Jre(n){let e=typeof self<"u"&&(self.crypto||self.msCrypto),r=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(r);else for(let t=0;t<n;t++)r[t]=Math.floor(256*Math.random());return r}function yH(){return new TextEncoder}var jm=class{static newId(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=62*Math.floor(4.129032258064516),t="";for(;t.length<20;){let i=Jre(40);for(let o=0;o<i.length;++o)t.length<20&&i[o]<r&&(t+=e.charAt(i[o]%62))}return t}};function Re(n,e){return n<e?-1:n>e?1:0}function Kw(n,e){let r=0;for(;r<n.length&&r<e.length;){let t=n.codePointAt(r),i=e.codePointAt(r);if(t!==i){if(t<128&&i<128)return Re(t,i);{let o=yH(),s=Zre(o.encode(aj(n,r)),o.encode(aj(e,r)));return s!==0?s:Re(t,i)}}r+=t>65535?2:1}return Re(n.length,e.length)}function aj(n,e){return n.codePointAt(e)>65535?n.substring(e,e+2):n.substring(e,e+1)}function Zre(n,e){for(let r=0;r<n.length&&r<e.length;++r)if(n[r]!==e[r])return Re(n[r],e[r]);return Re(n.length,e.length)}function gh(n,e,r){return n.length===e.length&&n.every((t,i)=>r(t,e[i]))}function SH(n){return n+"\0"}var cj="__name__",xv=class n{constructor(e,r,t){r===void 0?r=0:r>e.length&&ae(637,{offset:r,range:e.length}),t===void 0?t=e.length-r:t>e.length-r&&ae(1746,{length:t,range:e.length-r}),this.segments=e,this.offset=r,this.len=t}get length(){return this.len}isEqual(e){return n.comparator(this,e)===0}child(e){let r=this.segments.slice(this.offset,this.limit());return e instanceof n?e.forEach(t=>{r.push(t)}):r.push(e),this.construct(r)}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 r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let r=0;r<this.length;r++)if(this.get(r)!==e.get(r))return!1;return!0}forEach(e){for(let r=this.offset,t=this.limit();r<t;r++)e(this.segments[r])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,r){let t=Math.min(e.length,r.length);for(let i=0;i<t;i++){let o=n.compareSegments(e.get(i),r.get(i));if(o!==0)return o}return Re(e.length,r.length)}static compareSegments(e,r){let t=n.isNumericId(e),i=n.isNumericId(r);return t&&!i?-1:!t&&i?1:t&&i?n.extractNumericId(e).compare(n.extractNumericId(r)):Kw(e,r)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Ds.fromString(e.substring(4,e.length-2))}},We=class n extends xv{construct(e,r,t){return new n(e,r,t)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let r=[];for(let t of e){if(t.indexOf("//")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);r.push(...t.split("/").filter(i=>i.length>0))}return new n(r)}static emptyPath(){return new n([])}},eie=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Tn=class n extends xv{construct(e,r,t){return new n(e,r,t)}static isValidIdentifier(e){return eie.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===cj}static keyField(){return new n([cj])}static fromServerFormat(e){let r=[],t="",i=0,o=()=>{if(t.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);r.push(t),t=""},s=!1;for(;i<e.length;){let a=e[i];if(a==="\\"){if(i+1===e.length)throw new Q(j.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let c=e[i+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new Q(j.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);t+=c,i+=2}else a==="`"?(s=!s,i++):a!=="."||s?(t+=a,i++):(o(),i++)}if(o(),s)throw new Q(j.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(r)}static emptyPath(){return new n([])}};var ie=class n{constructor(e){this.path=e}static fromPath(e){return new n(We.fromString(e))}static fromName(e){return new n(We.fromString(e).popFirst(5))}static empty(){return new n(We.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&&We.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,r){return We.comparator(e.path,r.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new n(new We(e.slice()))}};function XL(n,e,r){if(!r)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function tie(n,e,r,t){if(e===!0&&t===!0)throw new Q(j.INVALID_ARGUMENT,`${n} and ${r} cannot be used together.`)}function lj(n){if(!ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function uj(n){if(ie.isDocumentKey(n))throw new Q(j.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function AH(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Object.getPrototypeOf(n)===null)}function Oy(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{let e=(function(t){return t.constructor?t.constructor.name:null})(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":ae(12329,{type:typeof n})}function wr(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new Q(j.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=Oy(n);throw new Q(j.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${r}`)}}return n}function nie(n,e){if(e<=0)throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}function ln(n,e){let r={typeString:n};return e&&(r.value=e),r}function Ep(n,e){if(!AH(n))throw new Q(j.INVALID_ARGUMENT,"JSON must be an object");let r;for(let t in e)if(e[t]){let i=e[t].typeString,o="value"in e[t]?{value:e[t].value}:void 0;if(!(t in n)){r=`JSON missing required field: '${t}'`;break}let s=n[t];if(i&&typeof s!==i){r=`JSON field '${t}' must be a ${i}.`;break}if(o!==void 0&&s!==o.value){r=`Expected '${t}' field to equal '${o.value}'`;break}}if(r)throw new Q(j.INVALID_ARGUMENT,r);return!0}var dj=-62135596800,hj=1e6,Pt=class n{static now(){return n.fromMillis(Date.now())}static fromDate(e){return n.fromMillis(e.getTime())}static fromMillis(e){let r=Math.floor(e/1e3),t=Math.floor((e-1e3*r)*hj);return new n(r,t)}constructor(e,r){if(this.seconds=e,this.nanoseconds=r,r<0)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(r>=1e9)throw new Q(j.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+r);if(e<dj)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Q(j.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/hj}_compareTo(e){return this.seconds===e.seconds?Re(this.nanoseconds,e.nanoseconds):Re(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:n._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ep(e,n._jsonSchema))return new n(e.seconds,e.nanoseconds)}valueOf(){let e=this.seconds-dj;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};Pt._jsonSchemaVersion="firestore/timestamp/1.0",Pt._jsonSchema={type:ln("string",Pt._jsonSchemaVersion),seconds:ln("number"),nanoseconds:ln("number")};var me=class n{static fromTimestamp(e){return new n(e)}static min(){return new n(new Pt(0,0))}static max(){return new n(new Pt(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}};var mh=-1,ph=class{constructor(e,r,t,i){this.indexId=e,this.collectionGroup=r,this.fields=t,this.indexState=i}};function Yw(n){return n.fields.find(e=>e.kind===2)}function Ll(n){return n.fields.filter(e=>e.kind!==2)}ph.UNKNOWN_ID=-1;var uh=class{constructor(e,r){this.fieldPath=e,this.kind=r}};var Hm=class n{constructor(e,r){this.sequenceNumber=e,this.offset=r}static empty(){return new n(0,_i.min())}};function DH(n,e){let r=n.toTimestamp().seconds,t=n.toTimestamp().nanoseconds+1,i=me.fromTimestamp(t===1e9?new Pt(r+1,0):new Pt(r,t));return new _i(i,ie.empty(),e)}function RH(n){return new _i(n.readTime,n.key,mh)}var _i=class n{constructor(e,r,t){this.readTime=e,this.documentKey=r,this.largestBatchId=t}static min(){return new n(me.min(),ie.empty(),mh)}static max(){return new n(me.max(),ie.empty(),mh)}};function JL(n,e){let r=n.readTime.compareTo(e.readTime);return r!==0?r:(r=ie.comparator(n.documentKey,e.documentKey),r!==0?r:Re(n.largestBatchId,e.largestBatchId))}var CH="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Fv=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}};function Qa(n){return I(this,null,function*(){if(n.code!==j.FAILED_PRECONDITION||n.message!==CH)throw n;X("LocalStore","Unexpectedly lost primary lease")})}var B=class n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(r=>{this.isDone=!0,this.result=r,this.nextCallback&&this.nextCallback(r)},r=>{this.isDone=!0,this.error=r,this.catchCallback&&this.catchCallback(r)})}catch(e){return this.next(void 0,e)}next(e,r){return this.callbackAttached&&ae(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(r,this.error):this.wrapSuccess(e,this.result):new n((t,i)=>{this.nextCallback=o=>{this.wrapSuccess(e,o).next(t,i)},this.catchCallback=o=>{this.wrapFailure(r,o).next(t,i)}})}toPromise(){return new Promise((e,r)=>{this.next(e,r)})}wrapUserFunction(e){try{let r=e();return r instanceof n?r:n.resolve(r)}catch(r){return n.reject(r)}}wrapSuccess(e,r){return e?this.wrapUserFunction(()=>e(r)):n.resolve(r)}wrapFailure(e,r){return e?this.wrapUserFunction(()=>e(r)):n.reject(r)}static resolve(e){return new n((r,t)=>{r(e)})}static reject(e){return new n((r,t)=>{t(e)})}static waitFor(e){return new n((r,t)=>{let i=0,o=0,s=!1;e.forEach(a=>{++i,a.next(()=>{++o,s&&o===i&&r()},c=>t(c))}),s=!0,o===i&&r()})}static or(e){let r=n.resolve(!1);for(let t of e)r=r.next(i=>i?n.resolve(i):t());return r}static forEach(e,r){let t=[];return e.forEach((i,o)=>{t.push(r.call(this,i,o))}),this.waitFor(t)}static mapArray(e,r){return new n((t,i)=>{let o=e.length,s=new Array(o),a=0;for(let c=0;c<o;c++){let l=c;r(e[l]).next(u=>{s[l]=u,++a,a===o&&t(s)},u=>i(u))}})}static doWhile(e,r){return new n((t,i)=>{let o=()=>{e()===!0?r().next(()=>{o()},i):t()};o()})}};var qr="SimpleDb",kv=class n{static open(e,r,t,i){try{return new n(r,e.transaction(i,t))}catch(o){throw new Bl(r,o)}}constructor(e,r){this.action=e,this.transaction=r,this.aborted=!1,this.S=new Or,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{r.error?this.S.reject(new Bl(e,r.error)):this.S.resolve()},this.transaction.onerror=t=>{let i=ZL(t.target.error);this.S.reject(new Bl(e,i))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(X(qr,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}v(){let e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){let r=this.transaction.objectStore(e);return new Xw(r)}},Eh=class n{static delete(e){return X(qr,"Removing database:",e),Pl(zT().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!Od())return!1;if(n.F())return!0;let e=En(),r=n.M(e),t=0<r&&r<10,i=NH(e),o=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||t||o)}static F(){var e;return typeof process<"u"&&((e=process.__PRIVATE_env)===null||e===void 0?void 0:e.O)==="YES"}static N(e,r){return e.store(r)}static M(e){let r=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=r?r[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,r,t){this.name=e,this.version=r,this.B=t,this.L=null,n.M(En())===12.2&&Xt("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}k(e){return I(this,null,function*(){return this.db||(X(qr,"Opening database:",this.name),this.db=yield new Promise((r,t)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=o=>{let s=o.target.result;r(s)},i.onblocked=()=>{t(new Bl(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=o=>{let s=o.target.error;s.name==="VersionError"?t(new Q(j.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):s.name==="InvalidStateError"?t(new Q(j.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+s)):t(new Bl(e,s))},i.onupgradeneeded=o=>{X(qr,'Database "'+this.name+'" requires upgrade from version:',o.oldVersion);let s=o.target.result;if(this.L!==null&&this.L!==o.oldVersion)throw new Error(`refusing to open IndexedDB database due to potential corruption of the IndexedDB database data; this corruption could be caused by clicking the "clear site data" button in a web browser; try reloading the web page to re-initialize the IndexedDB database: lastClosedDbVersion=${this.L}, event.oldVersion=${o.oldVersion}, event.newVersion=${o.newVersion}, db.version=${s.version}`);this.B.q(s,i.transaction,o.oldVersion,this.version).next(()=>{X(qr,"Database upgrade to version "+this.version+" complete")})}}),this.db.addEventListener("close",r=>{let t=r.target;this.L=t.version},{passive:!0})),this.db.addEventListener("versionchange",r=>{var t;r.newVersion===null&&(ws('Received "versionchange" event with newVersion===null; notifying the registered DatabaseDeletedListener, if any'),(t=this.databaseDeletedListener)===null||t===void 0||t.call(this))},{passive:!0}),this.db})}setDatabaseDeletedListener(e){if(this.databaseDeletedListener)throw new Error("setDatabaseDeletedListener() may only be called once, and it has already been called");this.databaseDeletedListener=e}runTransaction(e,r,t,i){return I(this,null,function*(){let o=r==="readonly",s=0;for(;;){++s;try{this.db=yield this.k(e);let a=kv.open(this.db,e,o?"readonly":"readwrite",t),c=i(a).next(l=>(a.v(),l)).catch(l=>(a.abort(l),B.reject(l))).toPromise();return c.catch(()=>{}),yield a.D,c}catch(a){let c=a,l=c.name!=="FirebaseError"&&s<3;if(X(qr,"Transaction failed with error:",c.message,"Retrying:",l),this.close(),!l)return Promise.reject(c)}}})}close(){this.db&&this.db.close(),this.db=void 0}};function NH(n){let e=n.match(/Android ([\d.]+)/i),r=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(r)}var Qw=class{constructor(e){this.$=e,this.U=!1,this.K=null}get isDone(){return this.U}get W(){return this.K}set cursor(e){this.$=e}done(){this.U=!0}G(e){this.K=e}delete(){return Pl(this.$.delete())}},Bl=class extends Q{constructor(e,r){super(j.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${r}`),this.name="IndexedDbTransactionError"}};function Xa(n){return n.name==="IndexedDbTransactionError"}var Xw=class{constructor(e){this.store=e}put(e,r){let t;return r!==void 0?(X(qr,"PUT",this.store.name,e,r),t=this.store.put(r,e)):(X(qr,"PUT",this.store.name,"<auto-key>",e),t=this.store.put(e)),Pl(t)}add(e){return X(qr,"ADD",this.store.name,e,e),Pl(this.store.add(e))}get(e){return Pl(this.store.get(e)).next(r=>(r===void 0&&(r=null),X(qr,"GET",this.store.name,e,r),r))}delete(e){return X(qr,"DELETE",this.store.name,e),Pl(this.store.delete(e))}count(){return X(qr,"COUNT",this.store.name),Pl(this.store.count())}j(e,r){let t=this.options(e,r),i=t.index?this.store.index(t.index):this.store;if(typeof i.getAll=="function"){let o=i.getAll(t.range);return new B((s,a)=>{o.onerror=c=>{a(c.target.error)},o.onsuccess=c=>{s(c.target.result)}})}{let o=this.cursor(t),s=[];return this.J(o,(a,c)=>{s.push(c)}).next(()=>s)}}H(e,r){let t=this.store.getAll(e,r===null?void 0:r);return new B((i,o)=>{t.onerror=s=>{o(s.target.error)},t.onsuccess=s=>{i(s.target.result)}})}Y(e,r){X(qr,"DELETE ALL",this.store.name);let t=this.options(e,r);t.Z=!1;let i=this.cursor(t);return this.J(i,(o,s,a)=>a.delete())}X(e,r){let t;r?t=e:(t={},r=e);let i=this.cursor(t);return this.J(i,r)}ee(e){let r=this.cursor({});return new B((t,i)=>{r.onerror=o=>{let s=ZL(o.target.error);i(s)},r.onsuccess=o=>{let s=o.target.result;s?e(s.primaryKey,s.value).next(a=>{a?s.continue():t()}):t()}})}J(e,r){let t=[];return new B((i,o)=>{e.onerror=s=>{o(s.target.error)},e.onsuccess=s=>{let a=s.target.result;if(!a)return void i();let c=new Qw(a),l=r(a.primaryKey,a.value,c);if(l instanceof B){let u=l.catch(d=>(c.done(),B.reject(d)));t.push(u)}c.isDone?i():c.W===null?a.continue():a.continue(c.W)}}).next(()=>B.waitFor(t))}options(e,r){let t;return e!==void 0&&(typeof e=="string"?t=e:r=e),{index:t,range:r}}cursor(e){let r="next";if(e.reverse&&(r="prev"),e.index){let t=this.store.index(e.index);return e.Z?t.openKeyCursor(e.range,r):t.openCursor(e.range,r)}return this.store.openCursor(e.range,r)}};function Pl(n){return new B((e,r)=>{n.onsuccess=t=>{let i=t.target.result;e(i)},n.onerror=t=>{let i=ZL(t.target.error);r(i)}})}var fj=!1;function ZL(n){let e=Eh.M(En());if(e>=12.2&&e<13){let r="An internal error was encountered in the Indexed Database server";if(n.message.indexOf(r)>=0){let t=new Q("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${r}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return fj||(fj=!0,setTimeout(()=>{throw t},0)),t}}return n}var xm="IndexBackfiller",Jw=class{constructor(e,r){this.asyncQueue=e,this.te=r,this.task=null}start(){this.ne(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}ne(e){X(xm,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,()=>I(this,null,function*(){this.task=null;try{let r=yield this.te.re();X(xm,`Documents written: ${r}`)}catch(r){Xa(r)?X(xm,"Ignoring IndexedDB error during index backfill: ",r):yield Qa(r)}yield this.ne(6e4)}))}},Zw=class{constructor(e,r){this.localStore=e,this.persistence=r}re(e=50){return I(this,null,function*(){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",r=>this.ie(r,e))})}ie(e,r){let t=new Set,i=r,o=!0;return B.doWhile(()=>o===!0&&i>0,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(s=>{if(s!==null&&!t.has(s))return X(xm,`Processing collection: ${s}`),this.se(e,s,i).next(a=>{i-=a,t.add(s)});o=!1})).next(()=>r-i)}se(e,r,t){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,r).next(i=>this.localStore.localDocuments.getNextDocuments(e,r,i,t).next(o=>{let s=o.changes;return this.localStore.indexManager.updateIndexEntries(e,s).next(()=>this.oe(i,o)).next(a=>(X(xm,`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,r,a))).next(()=>s.size)}))}oe(e,r){let t=e;return r.changes.forEach((i,o)=>{let s=RH(o);JL(s,t)>0&&(t=s)}),new _i(t.readTime,t.documentKey,Math.max(r.batchId,e.largestBatchId))}};var Kr=(()=>{class n{constructor(r,t){this.previousValue=r,t&&(t.sequenceNumberHandler=i=>this._e(i),this.ae=i=>t.writeSequenceNumber(i))}_e(r){return this.previousValue=Math.max(r,this.previousValue),this.previousValue}next(){let r=++this.previousValue;return this.ae&&this.ae(r),r}}n.ue=-1;return n})(),Gl=-1;function _p(n){return n==null}function Wm(n){return n===0&&1/n==-1/0}function OH(n){return typeof n=="number"&&Number.isInteger(n)&&!Wm(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}var Uv="";function rr(n){let e="";for(let r=0;r<n.length;r++)e.length>0&&(e=gj(e)),e=rie(n.get(r),e);return gj(e)}function rie(n,e){let r=e,t=n.length;for(let i=0;i<t;i++){let o=n.charAt(i);switch(o){case"\0":r+="";break;case Uv:r+="";break;default:r+=o}}return r}function gj(n){return n+Uv+""}function Bo(n){let e=n.length;if(he(e>=2,64408,{path:n}),e===2)return he(n.charAt(0)===Uv&&n.charAt(1)==="",56145,{path:n}),We.emptyPath();let r=e-2,t=[],i="";for(let o=0;o<e;){let s=n.indexOf(Uv,o);switch((s<0||s>r)&&ae(50515,{path:n}),n.charAt(s+1)){case"":let a=n.substring(o,s),c;i.length===0?c=a:(i+=a,c=i,i=""),t.push(c);break;case"":i+=n.substring(o,s),i+="\0";break;case"":i+=n.substring(o,s+1);break;default:ae(61167,{path:n})}o=s+2}return new We(t)}var Ml="remoteDocuments",Tp="owner",Zd="owner",zm="mutationQueues",iie="userId",qi="mutations",mj="batchId",Ul="userMutationsIndex",pj=["userId","batchId"];function Dv(n,e){return[n,rr(e)]}function wH(n,e,r){return[n,rr(e),r]}var oie={},_h="documentMutations",Vv="remoteDocumentsV14",sie=["prefixPath","collectionGroup","readTime","documentId"],Rv="documentKeyIndex",aie=["prefixPath","collectionGroup","documentId"],bH="collectionGroupIndex",cie=["collectionGroup","readTime","prefixPath","documentId"],qm="remoteDocumentGlobal",eb="remoteDocumentGlobalKey",Th="targets",LH="queryTargetsIndex",lie=["canonicalId","targetId"],Ih="targetDocuments",uie=["targetId","path"],eM="documentTargetsIndex",die=["path","targetId"],Bv="targetGlobalKey",$l="targetGlobal",Km="collectionParents",hie=["collectionId","parent"],vh="clientMetadata",fie="clientId",wy="bundles",gie="bundleId",by="namedQueries",mie="name",tM="indexConfiguration",pie="indexId",tb="collectionGroupIndex",Eie="collectionGroup",Fm="indexState",_ie=["indexId","uid"],MH="sequenceNumberIndex",Tie=["uid","sequenceNumber"],km="indexEntries",Iie=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],PH="documentKeyIndex",vie=["indexId","uid","orderedDocumentKey"],Ly="documentOverlays",yie=["userId","collectionPath","documentId"],nb="collectionPathOverlayIndex",Sie=["userId","collectionPath","largestBatchId"],xH="collectionGroupOverlayIndex",Aie=["userId","collectionGroup","largestBatchId"],nM="globals",Die="name",FH=[zm,qi,_h,Ml,Th,Tp,$l,Ih,vh,qm,Km,wy,by],Rie=[...FH,Ly],kH=[zm,qi,_h,Vv,Th,Tp,$l,Ih,vh,qm,Km,wy,by,Ly],UH=kH,rM=[...UH,tM,Fm,km],Cie=rM,VH=[...rM,nM],Nie=VH;var Ym=class extends Fv{constructor(e,r){super(),this.ce=e,this.currentSequenceNumber=r}};function yn(n,e){let r=de(n);return Eh.N(r.ce,e)}function Ej(n){let e=0;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e++;return e}function Ja(n,e){for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&e(r,n[r])}function Oie(n,e){let r=[];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.push(e(n[t],t,n));return r}function BH(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}var Dt=class n{constructor(e,r){this.comparator=e,this.root=r||$o.EMPTY}insert(e,r){return new n(this.comparator,this.root.insert(e,r,this.comparator).copy(null,null,$o.BLACK,null,null))}remove(e){return new n(this.comparator,this.root.remove(e,this.comparator).copy(null,null,$o.BLACK,null,null))}get(e){let r=this.root;for(;!r.isEmpty();){let t=this.comparator(e,r.key);if(t===0)return r.value;t<0?r=r.left:t>0&&(r=r.right)}return null}indexOf(e){let r=0,t=this.root;for(;!t.isEmpty();){let i=this.comparator(e,t.key);if(i===0)return r+t.left.size;i<0?t=t.left:(r+=t.left.size+1,t=t.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((r,t)=>(e(r,t),!1))}toString(){let e=[];return this.inorderTraversal((r,t)=>(e.push(`${r}:${t}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new lh(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new lh(this.root,e,this.comparator,!1)}getReverseIterator(){return new lh(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new lh(this.root,e,this.comparator,!0)}},lh=class{constructor(e,r,t,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!e.isEmpty();)if(o=r?t(e.key,r):1,r&&i&&(o*=-1),o<0)e=this.isReverse?e.left:e.right;else{if(o===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),r={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 r}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}}},$o=class n{constructor(e,r,t,i,o){this.key=e,this.value=r,this.color=t??n.RED,this.left=i??n.EMPTY,this.right=o??n.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,r,t,i,o){return new n(e??this.key,r??this.value,t??this.color,i??this.left,o??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,r,t){let i=this,o=t(e,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(e,r,t),null):o===0?i.copy(null,r,null,null,null):i.copy(null,null,null,null,i.right.insert(e,r,t)),i.fixUp()}removeMin(){if(this.left.isEmpty())return n.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,r){let t,i=this;if(r(e,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(e,r),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),r(e,i.key)===0){if(i.right.isEmpty())return n.EMPTY;t=i.right.min(),i=i.copy(t.key,t.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,r))}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 e=this.copy(null,null,n.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,n.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,r)}checkMaxDepth(){let e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw ae(43730,{key:this.key,value:this.value});if(this.right.isRed())throw ae(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw ae(27949);return e+(this.isRed()?0:1)}};$o.EMPTY=null,$o.RED=!0,$o.BLACK=!1;$o.EMPTY=new class{constructor(){this.size=0}get key(){throw ae(57766)}get value(){throw ae(16141)}get color(){throw ae(16727)}get left(){throw ae(29726)}get right(){throw ae(36894)}copy(e,r,t,i,o){return this}insert(e,r,t){return new $o(e,r)}remove(e,r){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 at=class n{constructor(e){this.comparator=e,this.data=new Dt(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((r,t)=>(e(r),!1))}forEachInRange(e,r){let t=this.data.getIteratorFrom(e[0]);for(;t.hasNext();){let i=t.getNext();if(this.comparator(i.key,e[1])>=0)return;r(i.key)}}forEachWhile(e,r){let t;for(t=r!==void 0?this.data.getIteratorFrom(r):this.data.getIterator();t.hasNext();)if(!e(t.getNext().key))return}firstAfterOrEqual(e){let r=this.data.getIteratorFrom(e);return r.hasNext()?r.getNext().key:null}getIterator(){return new Gv(this.data.getIterator())}getIteratorFrom(e){return new Gv(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 r=this;return r.size<e.size&&(r=e,e=this),e.forEach(t=>{r=r.add(t)}),r}isEqual(e){if(!(e instanceof n)||this.size!==e.size)return!1;let r=this.data.getIterator(),t=e.data.getIterator();for(;r.hasNext();){let i=r.getNext().key,o=t.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){let e=[];return this.forEach(r=>{e.push(r)}),e}toString(){let e=[];return this.forEach(r=>e.push(r)),"SortedSet("+e.toString()+")"}copy(e){let r=new n(this.comparator);return r.data=e,r}},Gv=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};function eh(n){return n.hasNext()?n.getNext():void 0}var Yr=class n{constructor(e){this.fields=e,e.sort(Tn.comparator)}static empty(){return new n([])}unionWith(e){let r=new at(Tn.comparator);for(let t of this.fields)r=r.add(t);for(let t of e)r=r.add(t);return new n(r.toArray())}covers(e){for(let r of this.fields)if(r.isPrefixOf(e))return!0;return!1}isEqual(e){return gh(this.fields,e.fields,(r,t)=>r.isEqual(t))}};var $v=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var un=class n{constructor(e){this.binaryString=e}static fromBase64String(e){let r=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new $v("Invalid base64 string: "+o):o}})(e);return new n(r)}static fromUint8Array(e){let r=(function(i){let o="";for(let s=0;s<i.length;++s)o+=String.fromCharCode(i[s]);return o})(e);return new n(r)}[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(r){return btoa(r)})(this.binaryString)}toUint8Array(){return(function(r){let t=new Uint8Array(r.length);for(let i=0;i<r.length;i++)t[i]=r.charCodeAt(i);return t})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Re(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};un.EMPTY_BYTE_STRING=new un("");var wie=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bs(n){if(he(!!n,39018),typeof n=="string"){let e=0,r=wie.exec(n);if(he(!!r,46558,{timestamp:n}),r[1]){let i=r[1];i=(i+"000000000").substr(0,9),e=Number(i)}let t=new Date(n);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}return{seconds:Mt(n.seconds),nanos:Mt(n.nanos)}}function Mt(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Ls(n){return typeof n=="string"?un.fromBase64String(n):un.fromUint8Array(n)}var GH="server_timestamp",$H="__type__",jH="__previous_value__",HH="__local_write_time__";function My(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[$H])===null||r===void 0?void 0:r.stringValue)===GH}function Py(n){let e=n.mapValue.fields[jH];return My(e)?Py(e):e}function Qm(n){let e=bs(n.mapValue.fields[HH].timestampValue);return new Pt(e.seconds,e.nanos)}var rb=class{constructor(e,r,t,i,o,s,a,c,l,u){this.databaseId=e,this.appId=r,this.persistenceKey=t,this.host=i,this.ssl=o,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=l,this.isUsingEmulator=u}},Xm="(default)",yh=class n{constructor(e,r){this.projectId=e,this.database=r||Xm}static empty(){return new n("","")}get isDefaultDatabase(){return this.database===Xm}isEqual(e){return e instanceof n&&e.projectId===this.projectId&&e.database===this.database}};var iM="__type__",WH="__max__",Fa={mapValue:{fields:{__type__:{stringValue:WH}}}},oM="__vector__",Sh="value",Cv={nullValue:"NULL_VALUE"};function ja(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?My(n)?4:zH(n)?9007199254740991:xy(n)?10:11:ae(28295,{value:n})}function jo(n,e){if(n===e)return!0;let r=ja(n);if(r!==ja(e))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return Qm(n).isEqual(Qm(e));case 3:return(function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;let s=bs(i.timestampValue),a=bs(o.timestampValue);return s.seconds===a.seconds&&s.nanos===a.nanos})(n,e);case 5:return n.stringValue===e.stringValue;case 6:return(function(i,o){return Ls(i.bytesValue).isEqual(Ls(o.bytesValue))})(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return(function(i,o){return Mt(i.geoPointValue.latitude)===Mt(o.geoPointValue.latitude)&&Mt(i.geoPointValue.longitude)===Mt(o.geoPointValue.longitude)})(n,e);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return Mt(i.integerValue)===Mt(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){let s=Mt(i.doubleValue),a=Mt(o.doubleValue);return s===a?Wm(s)===Wm(a):isNaN(s)&&isNaN(a)}return!1})(n,e);case 9:return gh(n.arrayValue.values||[],e.arrayValue.values||[],jo);case 10:case 11:return(function(i,o){let s=i.mapValue.fields||{},a=o.mapValue.fields||{};if(Ej(s)!==Ej(a))return!1;for(let c in s)if(s.hasOwnProperty(c)&&(a[c]===void 0||!jo(s[c],a[c])))return!1;return!0})(n,e);default:return ae(52216,{left:n})}}function Jm(n,e){return(n.values||[]).find(r=>jo(r,e))!==void 0}function Ha(n,e){if(n===e)return 0;let r=ja(n),t=ja(e);if(r!==t)return Re(r,t);switch(r){case 0:case 9007199254740991:return 0;case 1:return Re(n.booleanValue,e.booleanValue);case 2:return(function(o,s){let a=Mt(o.integerValue||o.doubleValue),c=Mt(s.integerValue||s.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1})(n,e);case 3:return _j(n.timestampValue,e.timestampValue);case 4:return _j(Qm(n),Qm(e));case 5:return Kw(n.stringValue,e.stringValue);case 6:return(function(o,s){let a=Ls(o),c=Ls(s);return a.compareTo(c)})(n.bytesValue,e.bytesValue);case 7:return(function(o,s){let a=o.split("/"),c=s.split("/");for(let l=0;l<a.length&&l<c.length;l++){let u=Re(a[l],c[l]);if(u!==0)return u}return Re(a.length,c.length)})(n.referenceValue,e.referenceValue);case 8:return(function(o,s){let a=Re(Mt(o.latitude),Mt(s.latitude));return a!==0?a:Re(Mt(o.longitude),Mt(s.longitude))})(n.geoPointValue,e.geoPointValue);case 9:return Tj(n.arrayValue,e.arrayValue);case 10:return(function(o,s){var a,c,l,u;let d=o.fields||{},f=s.fields||{},g=(a=d[Sh])===null||a===void 0?void 0:a.arrayValue,p=(c=f[Sh])===null||c===void 0?void 0:c.arrayValue,_=Re(((l=g?.values)===null||l===void 0?void 0:l.length)||0,((u=p?.values)===null||u===void 0?void 0:u.length)||0);return _!==0?_:Tj(g,p)})(n.mapValue,e.mapValue);case 11:return(function(o,s){if(o===Fa.mapValue&&s===Fa.mapValue)return 0;if(o===Fa.mapValue)return 1;if(s===Fa.mapValue)return-1;let a=o.fields||{},c=Object.keys(a),l=s.fields||{},u=Object.keys(l);c.sort(),u.sort();for(let d=0;d<c.length&&d<u.length;++d){let f=Kw(c[d],u[d]);if(f!==0)return f;let g=Ha(a[c[d]],l[u[d]]);if(g!==0)return g}return Re(c.length,u.length)})(n.mapValue,e.mapValue);default:throw ae(23264,{le:r})}}function _j(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return Re(n,e);let r=bs(n),t=bs(e),i=Re(r.seconds,t.seconds);return i!==0?i:Re(r.nanos,t.nanos)}function Tj(n,e){let r=n.values||[],t=e.values||[];for(let i=0;i<r.length&&i<t.length;++i){let o=Ha(r[i],t[i]);if(o)return o}return Re(r.length,t.length)}function Ah(n){return ib(n)}function ib(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?(function(r){let t=bs(r);return`time(${t.seconds},${t.nanos})`})(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?(function(r){return Ls(r).toBase64()})(n.bytesValue):"referenceValue"in n?(function(r){return ie.fromName(r).toString()})(n.referenceValue):"geoPointValue"in n?(function(r){return`geo(${r.latitude},${r.longitude})`})(n.geoPointValue):"arrayValue"in n?(function(r){let t="[",i=!0;for(let o of r.values||[])i?i=!1:t+=",",t+=ib(o);return t+"]"})(n.arrayValue):"mapValue"in n?(function(r){let t=Object.keys(r.fields||{}).sort(),i="{",o=!0;for(let s of t)o?o=!1:i+=",",i+=`${s}:${ib(r.fields[s])}`;return i+"}"})(n.mapValue):ae(61005,{value:n})}function Nv(n){switch(ja(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let e=Py(n);return e?16+Nv(e):16;case 5:return 2*n.stringValue.length;case 6:return Ls(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return(function(t){return(t.values||[]).reduce((i,o)=>i+Nv(o),0)})(n.arrayValue);case 10:case 11:return(function(t){let i=0;return Ja(t.fields,(o,s)=>{i+=o.length+Nv(s)}),i})(n.mapValue);default:throw ae(13486,{value:n})}}function Hl(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function ob(n){return!!n&&"integerValue"in n}function Zm(n){return!!n&&"arrayValue"in n}function Ij(n){return!!n&&"nullValue"in n}function vj(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Ov(n){return!!n&&"mapValue"in n}function xy(n){var e,r;return((r=(((e=n?.mapValue)===null||e===void 0?void 0:e.fields)||{})[iM])===null||r===void 0?void 0:r.stringValue)===oM}function Um(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){let e={mapValue:{fields:{}}};return Ja(n.mapValue.fields,(r,t)=>e.mapValue.fields[r]=Um(t)),e}if(n.arrayValue){let e={arrayValue:{values:[]}};for(let r=0;r<(n.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=Um(n.arrayValue.values[r]);return e}return Object.assign({},n)}function zH(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===WH}var qH={mapValue:{fields:{[iM]:{stringValue:oM},[Sh]:{arrayValue:{}}}}};function bie(n){return"nullValue"in n?Cv:"booleanValue"in n?{booleanValue:!1}:"integerValue"in n||"doubleValue"in n?{doubleValue:NaN}:"timestampValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in n?{stringValue:""}:"bytesValue"in n?{bytesValue:""}:"referenceValue"in n?Hl(yh.empty(),ie.empty()):"geoPointValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in n?{arrayValue:{}}:"mapValue"in n?xy(n)?qH:{mapValue:{}}:ae(35942,{value:n})}function Lie(n){return"nullValue"in n?{booleanValue:!1}:"booleanValue"in n?{doubleValue:NaN}:"integerValue"in n||"doubleValue"in n?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in n?{stringValue:""}:"stringValue"in n?{bytesValue:""}:"bytesValue"in n?Hl(yh.empty(),ie.empty()):"referenceValue"in n?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in n?{arrayValue:{}}:"arrayValue"in n?qH:"mapValue"in n?xy(n)?{mapValue:{}}:Fa:ae(61959,{value:n})}function yj(n,e){let r=Ha(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?-1:!n.inclusive&&e.inclusive?1:0}function Sj(n,e){let r=Ha(n.value,e.value);return r!==0?r:n.inclusive&&!e.inclusive?1:!n.inclusive&&e.inclusive?-1:0}var nr=class n{constructor(e){this.value=e}static empty(){return new n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let r=this.value;for(let t=0;t<e.length-1;++t)if(r=(r.mapValue.fields||{})[e.get(t)],!Ov(r))return null;return r=(r.mapValue.fields||{})[e.lastSegment()],r||null}}set(e,r){this.getFieldsMap(e.popLast())[e.lastSegment()]=Um(r)}setAll(e){let r=Tn.emptyPath(),t={},i=[];e.forEach((s,a)=>{if(!r.isImmediateParentOf(a)){let c=this.getFieldsMap(r);this.applyChanges(c,t,i),t={},i=[],r=a.popLast()}s?t[a.lastSegment()]=Um(s):i.push(a.lastSegment())});let o=this.getFieldsMap(r);this.applyChanges(o,t,i)}delete(e){let r=this.field(e.popLast());Ov(r)&&r.mapValue.fields&&delete r.mapValue.fields[e.lastSegment()]}isEqual(e){return jo(this.value,e.value)}getFieldsMap(e){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let t=0;t<e.length;++t){let i=r.mapValue.fields[e.get(t)];Ov(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},r.mapValue.fields[e.get(t)]=i),r=i}return r.mapValue.fields}applyChanges(e,r,t){Ja(r,(i,o)=>e[i]=o);for(let i of t)delete e[i]}clone(){return new n(Um(this.value))}};function KH(n){let e=[];return Ja(n.fields,(r,t)=>{let i=new Tn([r]);if(Ov(t)){let o=KH(t.mapValue).fields;if(o.length===0)e.push(i);else for(let s of o)e.push(i.child(s))}else e.push(i)}),new Yr(e)}var In=class n{constructor(e,r,t,i,o,s,a){this.key=e,this.documentType=r,this.version=t,this.readTime=i,this.createTime=o,this.data=s,this.documentState=a}static newInvalidDocument(e){return new n(e,0,me.min(),me.min(),me.min(),nr.empty(),0)}static newFoundDocument(e,r,t,i){return new n(e,1,r,me.min(),t,i,0)}static newNoDocument(e,r){return new n(e,2,r,me.min(),me.min(),nr.empty(),0)}static newUnknownDocument(e,r){return new n(e,3,r,me.min(),me.min(),nr.empty(),2)}convertToFoundDocument(e,r){return!this.createTime.isEqual(me.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=r,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=nr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=nr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=me.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(e){return e instanceof n&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new n(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}})`}};var Ho=class{constructor(e,r){this.position=e,this.inclusive=r}};function Aj(n,e,r){let t=0;for(let i=0;i<n.position.length;i++){let o=e[i],s=n.position[i];if(o.field.isKeyField()?t=ie.comparator(ie.fromName(s.referenceValue),r.key):t=Ha(s,r.data.field(o.field)),o.dir==="desc"&&(t*=-1),t!==0)break}return t}function Dj(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let r=0;r<n.position.length;r++)if(!jo(n.position[r],e.position[r]))return!1;return!0}var Wl=class{constructor(e,r="asc"){this.field=e,this.dir=r}};function Mie(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}var jv=class{},$e=class n extends jv{constructor(e,r,t){super(),this.field=e,this.op=r,this.value=t}static create(e,r,t){return e.isKeyField()?r==="in"||r==="not-in"?this.createKeyFieldInFilter(e,r,t):new cb(e,r,t):r==="array-contains"?new db(e,t):r==="in"?new Hv(e,t):r==="not-in"?new hb(e,t):r==="array-contains-any"?new fb(e,t):new n(e,r,t)}static createKeyFieldInFilter(e,r,t){return r==="in"?new lb(e,t):new ub(e,t)}matches(e){let r=e.data.field(this.field);return this.op==="!="?r!==null&&r.nullValue===void 0&&this.matchesComparison(Ha(r,this.value)):r!==null&&ja(this.value)===ja(r)&&this.matchesComparison(Ha(r,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 ae(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},nt=class n extends jv{constructor(e,r){super(),this.filters=e,this.op=r,this.he=null}static create(e,r){return new n(e,r)}matches(e){return Dh(this)?this.filters.find(r=>!r.matches(e))===void 0:this.filters.find(r=>r.matches(e))!==void 0}getFlattenedFilters(){return this.he!==null||(this.he=this.filters.reduce((e,r)=>e.concat(r.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}};function Dh(n){return n.op==="and"}function sb(n){return n.op==="or"}function sM(n){return YH(n)&&Dh(n)}function YH(n){for(let e of n.filters)if(e instanceof nt)return!1;return!0}function ab(n){if(n instanceof $e)return n.field.canonicalString()+n.op.toString()+Ah(n.value);if(sM(n))return n.filters.map(e=>ab(e)).join(",");{let e=n.filters.map(r=>ab(r)).join(",");return`${n.op}(${e})`}}function QH(n,e){return n instanceof $e?(function(t,i){return i instanceof $e&&t.op===i.op&&t.field.isEqual(i.field)&&jo(t.value,i.value)})(n,e):n instanceof nt?(function(t,i){return i instanceof nt&&t.op===i.op&&t.filters.length===i.filters.length?t.filters.reduce((o,s,a)=>o&&QH(s,i.filters[a]),!0):!1})(n,e):void ae(19439)}function XH(n,e){let r=n.filters.concat(e);return nt.create(r,n.op)}function JH(n){return n instanceof $e?(function(r){return`${r.field.canonicalString()} ${r.op} ${Ah(r.value)}`})(n):n instanceof nt?(function(r){return r.op.toString()+" {"+r.getFilters().map(JH).join(" ,")+"}"})(n):"Filter"}var cb=class extends $e{constructor(e,r,t){super(e,r,t),this.key=ie.fromName(t.referenceValue)}matches(e){let r=ie.comparator(e.key,this.key);return this.matchesComparison(r)}},lb=class extends $e{constructor(e,r){super(e,"in",r),this.keys=ZH("in",r)}matches(e){return this.keys.some(r=>r.isEqual(e.key))}},ub=class extends $e{constructor(e,r){super(e,"not-in",r),this.keys=ZH("not-in",r)}matches(e){return!this.keys.some(r=>r.isEqual(e.key))}};function ZH(n,e){var r;return(((r=e.arrayValue)===null||r===void 0?void 0:r.values)||[]).map(t=>ie.fromName(t.referenceValue))}var db=class extends $e{constructor(e,r){super(e,"array-contains",r)}matches(e){let r=e.data.field(this.field);return Zm(r)&&Jm(r.arrayValue,this.value)}},Hv=class extends $e{constructor(e,r){super(e,"in",r)}matches(e){let r=e.data.field(this.field);return r!==null&&Jm(this.value.arrayValue,r)}},hb=class extends $e{constructor(e,r){super(e,"not-in",r)}matches(e){if(Jm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let r=e.data.field(this.field);return r!==null&&r.nullValue===void 0&&!Jm(this.value.arrayValue,r)}},fb=class extends $e{constructor(e,r){super(e,"array-contains-any",r)}matches(e){let r=e.data.field(this.field);return!(!Zm(r)||!r.arrayValue.values)&&r.arrayValue.values.some(t=>Jm(this.value.arrayValue,t))}};var gb=class{constructor(e,r=null,t=[],i=[],o=null,s=null,a=null){this.path=e,this.collectionGroup=r,this.orderBy=t,this.filters=i,this.limit=o,this.startAt=s,this.endAt=a,this.Pe=null}};function mb(n,e=null,r=[],t=[],i=null,o=null,s=null){return new gb(n,e,r,t,i,o,s)}function zl(n){let e=de(n);if(e.Pe===null){let r=e.path.canonicalString();e.collectionGroup!==null&&(r+="|cg:"+e.collectionGroup),r+="|f:",r+=e.filters.map(t=>ab(t)).join(","),r+="|ob:",r+=e.orderBy.map(t=>(function(o){return o.field.canonicalString()+o.dir})(t)).join(","),_p(e.limit)||(r+="|l:",r+=e.limit),e.startAt&&(r+="|lb:",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map(t=>Ah(t)).join(",")),e.endAt&&(r+="|ub:",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map(t=>Ah(t)).join(",")),e.Pe=r}return e.Pe}function Ip(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let r=0;r<n.orderBy.length;r++)if(!Mie(n.orderBy[r],e.orderBy[r]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let r=0;r<n.filters.length;r++)if(!QH(n.filters[r],e.filters[r]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Dj(n.startAt,e.startAt)&&Dj(n.endAt,e.endAt)}function Wv(n){return ie.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}function zv(n,e){return n.filters.filter(r=>r instanceof $e&&r.field.isEqual(e))}function Rj(n,e,r){let t=Cv,i=!0;for(let o of zv(n,e)){let s=Cv,a=!0;switch(o.op){case"<":case"<=":s=bie(o.value);break;case"==":case"in":case">=":s=o.value;break;case">":s=o.value,a=!1;break;case"!=":case"not-in":s=Cv}yj({value:t,inclusive:i},{value:s,inclusive:a})<0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];yj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})<0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}function Cj(n,e,r){let t=Fa,i=!0;for(let o of zv(n,e)){let s=Fa,a=!0;switch(o.op){case">=":case">":s=Lie(o.value),a=!1;break;case"==":case"in":case"<=":s=o.value;break;case"<":s=o.value,a=!1;break;case"!=":case"not-in":s=Fa}Sj({value:t,inclusive:i},{value:s,inclusive:a})>0&&(t=s,i=a)}if(r!==null){for(let o=0;o<n.orderBy.length;++o)if(n.orderBy[o].field.isEqual(e)){let s=r.position[o];Sj({value:t,inclusive:i},{value:s,inclusive:r.inclusive})>0&&(t=s,i=r.inclusive);break}}return{value:t,inclusive:i}}var Wo=class{constructor(e,r=null,t=[],i=[],o=null,s="F",a=null,c=null){this.path=e,this.collectionGroup=r,this.explicitOrderBy=t,this.filters=i,this.limit=o,this.limitType=s,this.startAt=a,this.endAt=c,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}};function eW(n,e,r,t,i,o,s,a){return new Wo(n,e,r,t,i,o,s,a)}function vp(n){return new Wo(n)}function Nj(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function aM(n){return n.collectionGroup!==null}function dh(n){let e=de(n);if(e.Te===null){e.Te=[];let r=new Set;for(let o of e.explicitOrderBy)e.Te.push(o),r.add(o.field.canonicalString());let t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(s){let a=new at(Tn.comparator);return s.filters.forEach(c=>{c.getFlattenedFilters().forEach(l=>{l.isInequality()&&(a=a.add(l.field))})}),a})(e).forEach(o=>{r.has(o.canonicalString())||o.isKeyField()||e.Te.push(new Wl(o,t))}),r.has(Tn.keyField().canonicalString())||e.Te.push(new Wl(Tn.keyField(),t))}return e.Te}function Xr(n){let e=de(n);return e.Ie||(e.Ie=tW(e,dh(n))),e.Ie}function Pie(n){let e=de(n);return e.de||(e.de=tW(e,n.explicitOrderBy)),e.de}function tW(n,e){if(n.limitType==="F")return mb(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(i=>{let o=i.dir==="desc"?"asc":"desc";return new Wl(i.field,o)});let r=n.endAt?new Ho(n.endAt.position,n.endAt.inclusive):null,t=n.startAt?new Ho(n.startAt.position,n.startAt.inclusive):null;return mb(n.path,n.collectionGroup,e,n.filters,n.limit,r,t)}}function pb(n,e){let r=n.filters.concat([e]);return new Wo(n.path,n.collectionGroup,n.explicitOrderBy.slice(),r,n.limit,n.limitType,n.startAt,n.endAt)}function qv(n,e,r){return new Wo(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,r,n.startAt,n.endAt)}function Fy(n,e){return Ip(Xr(n),Xr(e))&&n.limitType===e.limitType}function nW(n){return`${zl(Xr(n))}|lt:${n.limitType}`}function sh(n){return`Query(target=${(function(r){let t=r.path.canonicalString();return r.collectionGroup!==null&&(t+=" collectionGroup="+r.collectionGroup),r.filters.length>0&&(t+=`, filters: [${r.filters.map(i=>JH(i)).join(", ")}]`),_p(r.limit)||(t+=", limit: "+r.limit),r.orderBy.length>0&&(t+=`, orderBy: [${r.orderBy.map(i=>(function(s){return`${s.field.canonicalString()} (${s.dir})`})(i)).join(", ")}]`),r.startAt&&(t+=", startAt: ",t+=r.startAt.inclusive?"b:":"a:",t+=r.startAt.position.map(i=>Ah(i)).join(",")),r.endAt&&(t+=", endAt: ",t+=r.endAt.inclusive?"a:":"b:",t+=r.endAt.position.map(i=>Ah(i)).join(",")),`Target(${t})`})(Xr(n))}; limitType=${n.limitType})`}function yp(n,e){return e.isFoundDocument()&&(function(t,i){let o=i.key.path;return t.collectionGroup!==null?i.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(o):ie.isDocumentKey(t.path)?t.path.isEqual(o):t.path.isImmediateParentOf(o)})(n,e)&&(function(t,i){for(let o of dh(t))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(n,e)&&(function(t,i){for(let o of t.filters)if(!o.matches(i))return!1;return!0})(n,e)&&(function(t,i){return!(t.startAt&&!(function(s,a,c){let l=Aj(s,a,c);return s.inclusive?l<=0:l<0})(t.startAt,dh(t),i)||t.endAt&&!(function(s,a,c){let l=Aj(s,a,c);return s.inclusive?l>=0:l>0})(t.endAt,dh(t),i))})(n,e)}function rW(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function iW(n){return(e,r)=>{let t=!1;for(let i of dh(n)){let o=xie(i,e,r);if(o!==0)return o;t=t||i.field.isKeyField()}return 0}}function xie(n,e,r){let t=n.field.isKeyField()?ie.comparator(e.key,r.key):(function(o,s,a){let c=s.data.field(o),l=a.data.field(o);return c!==null&&l!==null?Ha(c,l):ae(42886)})(n.field,e,r);switch(n.dir){case"asc":return t;case"desc":return-1*t;default:return ae(19790,{direction:n.dir})}}var Ki=class{constructor(e,r){this.mapKeyFn=e,this.equalsFn=r,this.inner={},this.innerSize=0}get(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t!==void 0){for(let[i,o]of t)if(this.equalsFn(i,e))return o}}has(e){return this.get(e)!==void 0}set(e,r){let t=this.mapKeyFn(e),i=this.inner[t];if(i===void 0)return this.inner[t]=[[e,r]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],e))return void(i[o]=[e,r]);i.push([e,r]),this.innerSize++}delete(e){let r=this.mapKeyFn(e),t=this.inner[r];if(t===void 0)return!1;for(let i=0;i<t.length;i++)if(this.equalsFn(t[i][0],e))return t.length===1?delete this.inner[r]:t.splice(i,1),this.innerSize--,!0;return!1}forEach(e){Ja(this.inner,(r,t)=>{for(let[i,o]of t)e(i,o)})}isEmpty(){return BH(this.inner)}size(){return this.innerSize}};var Fie=new Dt(ie.comparator);function Qr(){return Fie}var oW=new Dt(ie.comparator);function Lm(...n){let e=oW;for(let r of n)e=e.insert(r.key,r);return e}function sW(n){let e=oW;return n.forEach((r,t)=>e=e.insert(r,t.overlayedDocument)),e}function Go(){return Vm()}function aW(){return Vm()}function Vm(){return new Ki(n=>n.toString(),(n,e)=>n.isEqual(e))}var kie=new Dt(ie.comparator),Uie=new at(ie.comparator);function Ve(...n){let e=Uie;for(let r of n)e=e.add(r);return e}var Vie=new at(Re);function cM(){return Vie}function lM(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Wm(e)?"-0":e}}function cW(n){return{integerValue:""+n}}function Bie(n,e){return OH(e)?cW(e):lM(n,e)}var Rh=class{constructor(){this._=void 0}};function Gie(n,e,r){return n instanceof ql?(function(i,o){let s={fields:{[$H]:{stringValue:GH},[HH]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&My(o)&&(o=Py(o)),o&&(s.fields[jH]=o),{mapValue:s}})(r,e):n instanceof Wa?uW(n,e):n instanceof za?dW(n,e):(function(i,o){let s=lW(i,o),a=Oj(s)+Oj(i.Ee);return ob(s)&&ob(i.Ee)?cW(a):lM(i.serializer,a)})(n,e)}function $ie(n,e,r){return n instanceof Wa?uW(n,e):n instanceof za?dW(n,e):r}function lW(n,e){return n instanceof Kl?(function(t){return ob(t)||(function(o){return!!o&&"doubleValue"in o})(t)})(e)?e:{integerValue:0}:null}var ql=class extends Rh{},Wa=class extends Rh{constructor(e){super(),this.elements=e}};function uW(n,e){let r=hW(e);for(let t of n.elements)r.some(i=>jo(i,t))||r.push(t);return{arrayValue:{values:r}}}var za=class extends Rh{constructor(e){super(),this.elements=e}};function dW(n,e){let r=hW(e);for(let t of n.elements)r=r.filter(i=>!jo(i,t));return{arrayValue:{values:r}}}var Kl=class extends Rh{constructor(e,r){super(),this.serializer=e,this.Ee=r}};function Oj(n){return Mt(n.integerValue||n.doubleValue)}function hW(n){return Zm(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}var Eb=class{constructor(e,r){this.field=e,this.transform=r}};function jie(n,e){return n.field.isEqual(e.field)&&(function(t,i){return t instanceof Wa&&i instanceof Wa||t instanceof za&&i instanceof za?gh(t.elements,i.elements,jo):t instanceof Kl&&i instanceof Kl?jo(t.Ee,i.Ee):t instanceof ql&&i instanceof ql})(n.transform,e.transform)}var _b=class{constructor(e,r){this.version=e,this.transformResults=r}},Gn=class n{constructor(e,r){this.updateTime=e,this.exists=r}static none(){return new n}static exists(e){return new n(void 0,e)}static updateTime(e){return new n(e)}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 wv(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}var Ch=class{};function fW(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Yl(n.key,Gn.none()):new qa(n.key,n.data,Gn.none());{let r=n.data,t=nr.empty(),i=new at(Tn.comparator);for(let o of e.fields)if(!i.has(o)){let s=r.field(o);s===null&&o.length>1&&(o=o.popLast(),s=r.field(o)),s===null?t.delete(o):t.set(o,s),i=i.add(o)}return new Yi(n.key,t,new Yr(i.toArray()),Gn.none())}}function Hie(n,e,r){n instanceof qa?(function(i,o,s){let a=i.value.clone(),c=bj(i.fieldTransforms,o,s.transformResults);a.setAll(c),o.convertToFoundDocument(s.version,a).setHasCommittedMutations()})(n,e,r):n instanceof Yi?(function(i,o,s){if(!wv(i.precondition,o))return void o.convertToUnknownDocument(s.version);let a=bj(i.fieldTransforms,o,s.transformResults),c=o.data;c.setAll(gW(i)),c.setAll(a),o.convertToFoundDocument(s.version,c).setHasCommittedMutations()})(n,e,r):(function(i,o,s){o.convertToNoDocument(s.version).setHasCommittedMutations()})(0,e,r)}function Bm(n,e,r,t){return n instanceof qa?(function(o,s,a,c){if(!wv(o.precondition,s))return a;let l=o.value.clone(),u=Lj(o.fieldTransforms,c,s);return l.setAll(u),s.convertToFoundDocument(s.version,l).setHasLocalMutations(),null})(n,e,r,t):n instanceof Yi?(function(o,s,a,c){if(!wv(o.precondition,s))return a;let l=Lj(o.fieldTransforms,c,s),u=s.data;return u.setAll(gW(o)),u.setAll(l),s.convertToFoundDocument(s.version,u).setHasLocalMutations(),a===null?null:a.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map(d=>d.field))})(n,e,r,t):(function(o,s,a){return wv(o.precondition,s)?(s.convertToNoDocument(s.version).setHasLocalMutations(),null):a})(n,e,r)}function Wie(n,e){let r=null;for(let t of n.fieldTransforms){let i=e.data.field(t.field),o=lW(t.transform,i||null);o!=null&&(r===null&&(r=nr.empty()),r.set(t.field,o))}return r||null}function wj(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!(function(t,i){return t===void 0&&i===void 0||!(!t||!i)&&gh(t,i,(o,s)=>jie(o,s))})(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}var qa=class extends Ch{constructor(e,r,t,i=[]){super(),this.key=e,this.value=r,this.precondition=t,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},Yi=class extends Ch{constructor(e,r,t,i,o=[]){super(),this.key=e,this.data=r,this.fieldMask=t,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}};function gW(n){let e=new Map;return n.fieldMask.fields.forEach(r=>{if(!r.isEmpty()){let t=n.data.field(r);e.set(r,t)}}),e}function bj(n,e,r){let t=new Map;he(n.length===r.length,32656,{Ae:r.length,Re:n.length});for(let i=0;i<r.length;i++){let o=n[i],s=o.transform,a=e.data.field(o.field);t.set(o.field,$ie(s,a,r[i]))}return t}function Lj(n,e,r){let t=new Map;for(let i of n){let o=i.transform,s=r.data.field(i.field);t.set(i.field,Gie(o,s,e))}return t}var Yl=class extends Ch{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},ep=class extends Ch{constructor(e,r){super(),this.key=e,this.precondition=r,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var tp=class{constructor(e,r,t,i){this.batchId=e,this.localWriteTime=r,this.baseMutations=t,this.mutations=i}applyToRemoteDocument(e,r){let t=r.mutationResults;for(let i=0;i<this.mutations.length;i++){let o=this.mutations[i];o.key.isEqual(e.key)&&Hie(o,e,t[i])}}applyToLocalView(e,r){for(let t of this.baseMutations)t.key.isEqual(e.key)&&(r=Bm(t,e,r,this.localWriteTime));for(let t of this.mutations)t.key.isEqual(e.key)&&(r=Bm(t,e,r,this.localWriteTime));return r}applyToLocalDocumentSet(e,r){let t=aW();return this.mutations.forEach(i=>{let o=e.get(i.key),s=o.overlayedDocument,a=this.applyToLocalView(s,o.mutatedFields);a=r.has(i.key)?null:a;let c=fW(s,a);c!==null&&t.set(i.key,c),s.isValidDocument()||s.convertToNoDocument(me.min())}),t}keys(){return this.mutations.reduce((e,r)=>e.add(r.key),Ve())}isEqual(e){return this.batchId===e.batchId&&gh(this.mutations,e.mutations,(r,t)=>wj(r,t))&&gh(this.baseMutations,e.baseMutations,(r,t)=>wj(r,t))}},Tb=class n{constructor(e,r,t,i){this.batch=e,this.commitVersion=r,this.mutationResults=t,this.docVersions=i}static from(e,r,t){he(e.mutations.length===t.length,58842,{Ve:e.mutations.length,me:t.length});let i=(function(){return kie})(),o=e.mutations;for(let s=0;s<o.length;s++)i=i.insert(o[s].key,t[s].version);return new n(e,r,t,i)}};var np=class{constructor(e,r){this.largestBatchId=e,this.mutation=r}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
155
155
|
largestBatchId: ${this.largestBatchId},
|
|
156
156
|
mutation: ${this.mutation.toString()}
|
|
157
157
|
}`}};var Ib=class{constructor(e,r,t){this.alias=e,this.aggregateType=r,this.fieldPath=t}};var vb=class{constructor(e,r){this.count=e,this.unchangedNames=r}};var sn,He;function mW(n){switch(n){case j.OK:return ae(64938);case j.CANCELLED:case j.UNKNOWN:case j.DEADLINE_EXCEEDED:case j.RESOURCE_EXHAUSTED:case j.INTERNAL:case j.UNAVAILABLE:case j.UNAUTHENTICATED:return!1;case j.INVALID_ARGUMENT:case j.NOT_FOUND:case j.ALREADY_EXISTS:case j.PERMISSION_DENIED:case j.FAILED_PRECONDITION:case j.ABORTED:case j.OUT_OF_RANGE:case j.UNIMPLEMENTED:case j.DATA_LOSS:return!0;default:return ae(15467,{code:n})}}function pW(n){if(n===void 0)return Xt("GRPC error has no .code"),j.UNKNOWN;switch(n){case sn.OK:return j.OK;case sn.CANCELLED:return j.CANCELLED;case sn.UNKNOWN:return j.UNKNOWN;case sn.DEADLINE_EXCEEDED:return j.DEADLINE_EXCEEDED;case sn.RESOURCE_EXHAUSTED:return j.RESOURCE_EXHAUSTED;case sn.INTERNAL:return j.INTERNAL;case sn.UNAVAILABLE:return j.UNAVAILABLE;case sn.UNAUTHENTICATED:return j.UNAUTHENTICATED;case sn.INVALID_ARGUMENT:return j.INVALID_ARGUMENT;case sn.NOT_FOUND:return j.NOT_FOUND;case sn.ALREADY_EXISTS:return j.ALREADY_EXISTS;case sn.PERMISSION_DENIED:return j.PERMISSION_DENIED;case sn.FAILED_PRECONDITION:return j.FAILED_PRECONDITION;case sn.ABORTED:return j.ABORTED;case sn.OUT_OF_RANGE:return j.OUT_OF_RANGE;case sn.UNIMPLEMENTED:return j.UNIMPLEMENTED;case sn.DATA_LOSS:return j.DATA_LOSS;default:return ae(39323,{code:n})}}(He=sn||(sn={}))[He.OK=0]="OK",He[He.CANCELLED=1]="CANCELLED",He[He.UNKNOWN=2]="UNKNOWN",He[He.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",He[He.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",He[He.NOT_FOUND=5]="NOT_FOUND",He[He.ALREADY_EXISTS=6]="ALREADY_EXISTS",He[He.PERMISSION_DENIED=7]="PERMISSION_DENIED",He[He.UNAUTHENTICATED=16]="UNAUTHENTICATED",He[He.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",He[He.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",He[He.ABORTED=10]="ABORTED",He[He.OUT_OF_RANGE=11]="OUT_OF_RANGE",He[He.UNIMPLEMENTED=12]="UNIMPLEMENTED",He[He.INTERNAL=13]="INTERNAL",He[He.UNAVAILABLE=14]="UNAVAILABLE",He[He.DATA_LOSS=15]="DATA_LOSS";var Mj=null;var zie=new Ds([4294967295,4294967295],0);function Pj(n){let e=yH().encode(n),r=new Ow;return r.update(e),new Uint8Array(r.digest())}function xj(n){let e=new DataView(n.buffer),r=e.getUint32(0,!0),t=e.getUint32(4,!0),i=e.getUint32(8,!0),o=e.getUint32(12,!0);return[new Ds([r,t],0),new Ds([i,o],0)]}var yb=class n{constructor(e,r,t){if(this.bitmap=e,this.padding=r,this.hashCount=t,r<0||r>=8)throw new Vl(`Invalid padding: ${r}`);if(t<0)throw new Vl(`Invalid hash count: ${t}`);if(e.length>0&&this.hashCount===0)throw new Vl(`Invalid hash count: ${t}`);if(e.length===0&&r!==0)throw new Vl(`Invalid padding when bitmap length is 0: ${r}`);this.fe=8*e.length-r,this.ge=Ds.fromNumber(this.fe)}pe(e,r,t){let i=e.add(r.multiply(Ds.fromNumber(t)));return i.compare(zie)===1&&(i=new Ds([i.getBits(0),i.getBits(1)],0)),i.modulo(this.ge).toNumber()}ye(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.fe===0)return!1;let r=Pj(e),[t,i]=xj(r);for(let o=0;o<this.hashCount;o++){let s=this.pe(t,i,o);if(!this.ye(s))return!1}return!0}static create(e,r,t){let i=e%8==0?0:8-e%8,o=new Uint8Array(Math.ceil(e/8)),s=new n(o,i,r);return t.forEach(a=>s.insert(a)),s}insert(e){if(this.fe===0)return;let r=Pj(e),[t,i]=xj(r);for(let o=0;o<this.hashCount;o++){let s=this.pe(t,i,o);this.we(s)}}we(e){let r=Math.floor(e/8),t=e%8;this.bitmap[r]|=1<<t}},Vl=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var rp=class n{constructor(e,r,t,i,o){this.snapshotVersion=e,this.targetChanges=r,this.targetMismatches=t,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,r,t){let i=new Map;return i.set(e,ip.createSynthesizedTargetChangeForCurrentChange(e,r,t)),new n(me.min(),i,new Dt(Re),Qr(),Ve())}},ip=class n{constructor(e,r,t,i,o){this.resumeToken=e,this.current=r,this.addedDocuments=t,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(e,r,t){return new n(t,r,Ve(),Ve(),Ve())}};var hh=class{constructor(e,r,t,i){this.Se=e,this.removedTargetIds=r,this.key=t,this.be=i}},Kv=class{constructor(e,r){this.targetId=e,this.De=r}},Yv=class{constructor(e,r,t=un.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=r,this.resumeToken=t,this.cause=i}},Qv=class{constructor(){this.ve=0,this.Ce=Fj(),this.Fe=un.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return this.ve!==0}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=Ve(),r=Ve(),t=Ve();return this.Ce.forEach((i,o)=>{switch(o){case 0:e=e.add(i);break;case 2:r=r.add(i);break;case 1:t=t.add(i);break;default:ae(38017,{changeType:o})}}),new ip(this.Fe,this.Me,e,r,t)}ke(){this.xe=!1,this.Ce=Fj()}qe(e,r){this.xe=!0,this.Ce=this.Ce.insert(e,r)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,he(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}},Sb=class{constructor(e){this.We=e,this.Ge=new Map,this.ze=Qr(),this.je=Iv(),this.Je=Iv(),this.He=new Dt(Re)}Ye(e){for(let r of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(r,e.be):this.Xe(r,e.key,e.be);for(let r of e.removedTargetIds)this.Xe(r,e.key,e.be)}et(e){this.forEachTarget(e,r=>{let t=this.tt(r);switch(e.state){case 0:this.nt(r)&&t.Be(e.resumeToken);break;case 1:t.Ue(),t.Oe||t.ke(),t.Be(e.resumeToken);break;case 2:t.Ue(),t.Oe||this.removeTarget(r);break;case 3:this.nt(r)&&(t.Ke(),t.Be(e.resumeToken));break;case 4:this.nt(r)&&(this.rt(r),t.Be(e.resumeToken));break;default:ae(56790,{state:e.state})}})}forEachTarget(e,r){e.targetIds.length>0?e.targetIds.forEach(r):this.Ge.forEach((t,i)=>{this.nt(i)&&r(i)})}it(e){let r=e.targetId,t=e.De.count,i=this.st(r);if(i){let o=i.target;if(Wv(o))if(t===0){let s=new ie(o.path);this.Xe(r,s,In.newNoDocument(s,me.min()))}else he(t===1,20013,{expectedCount:t});else{let s=this.ot(r);if(s!==t){let a=this._t(e),c=a?this.ut(a,e,s):1;if(c!==0){this.rt(r);let l=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(r,l)}Mj?.ct((function(u,d,f,g,p){var _,T,D,b,G,M;let U={localCacheCount:u,existenceFilterCount:d.count,databaseId:f.database,projectId:f.projectId},k=d.unchangedNames;return k&&(U.bloomFilter={applied:p===0,hashCount:(_=k?.hashCount)!==null&&_!==void 0?_:0,bitmapLength:(b=(D=(T=k?.bits)===null||T===void 0?void 0:T.bitmap)===null||D===void 0?void 0:D.length)!==null&&b!==void 0?b:0,padding:(M=(G=k?.bits)===null||G===void 0?void 0:G.padding)!==null&&M!==void 0?M:0,mightContain:S=>{var A;return(A=g?.mightContain(S))!==null&&A!==void 0&&A}}),U})(s,e.De,this.We.lt(),a,c))}}}}_t(e){let r=e.De.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:t="",padding:i=0},hashCount:o=0}=r,s,a;try{s=Ls(t).toUint8Array()}catch(c){if(c instanceof $v)return ws("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new yb(s,i,o)}catch(c){return ws(c instanceof Vl?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.fe===0?null:a}ut(e,r,t){return r.De.count===t-this.ht(e,r.targetId)?0:2}ht(e,r){let t=this.We.getRemoteKeysForTarget(r),i=0;return t.forEach(o=>{let s=this.We.lt(),a=`projects/${s.projectId}/databases/${s.database}/documents/${o.path.canonicalString()}`;e.mightContain(a)||(this.Xe(r,o,null),i++)}),i}Pt(e){let r=new Map;this.Ge.forEach((o,s)=>{let a=this.st(s);if(a){if(o.current&&Wv(a.target)){let c=new ie(a.target.path);this.Tt(c).has(s)||this.It(s,c)||this.Xe(s,c,In.newNoDocument(c,e))}o.Ne&&(r.set(s,o.Le()),o.ke())}});let t=Ve();this.Je.forEach((o,s)=>{let a=!0;s.forEachWhile(c=>{let l=this.st(c);return!l||l.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(t=t.add(o))}),this.ze.forEach((o,s)=>s.setReadTime(e));let i=new rp(e,r,this.He,this.ze,t);return this.ze=Qr(),this.je=Iv(),this.Je=Iv(),this.He=new Dt(Re),i}Ze(e,r){if(!this.nt(e))return;let t=this.It(e,r.key)?2:0;this.tt(e).qe(r.key,t),this.ze=this.ze.insert(r.key,r),this.je=this.je.insert(r.key,this.Tt(r.key).add(e)),this.Je=this.Je.insert(r.key,this.dt(r.key).add(e))}Xe(e,r,t){if(!this.nt(e))return;let i=this.tt(e);this.It(e,r)?i.qe(r,1):i.Qe(r),this.Je=this.Je.insert(r,this.dt(r).delete(e)),this.Je=this.Je.insert(r,this.dt(r).add(e)),t&&(this.ze=this.ze.insert(r,t))}removeTarget(e){this.Ge.delete(e)}ot(e){let r=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let r=this.Ge.get(e);return r||(r=new Qv,this.Ge.set(e,r)),r}dt(e){let r=this.Je.get(e);return r||(r=new at(Re),this.Je=this.Je.insert(e,r)),r}Tt(e){let r=this.je.get(e);return r||(r=new at(Re),this.je=this.je.insert(e,r)),r}nt(e){let r=this.st(e)!==null;return r||X("WatchChangeAggregator","Detected inactive target",e),r}st(e){let r=this.Ge.get(e);return r&&r.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new Qv),this.We.getRemoteKeysForTarget(e).forEach(r=>{this.Xe(e,r,null)})}It(e,r){return this.We.getRemoteKeysForTarget(e).has(r)}};function Iv(){return new Dt(ie.comparator)}function Fj(){return new Dt(ie.comparator)}var qie={asc:"ASCENDING",desc:"DESCENDING"},Kie={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Yie={and:"AND",or:"OR"},Ab=class{constructor(e,r){this.databaseId=e,this.useProto3Json=r}};function Db(n,e){return n.useProto3Json||_p(e)?e:{value:e}}function Nh(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function EW(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function Qie(n,e){return Nh(n,e.toTimestamp())}function Ln(n){return he(!!n,49232),me.fromTimestamp((function(r){let t=bs(r);return new Pt(t.seconds,t.nanos)})(n))}function uM(n,e){return Rb(n,e).canonicalString()}function Rb(n,e){let r=(function(i){return new We(["projects",i.projectId,"databases",i.database])})(n).child("documents");return e===void 0?r:r.child(e)}function _W(n){let e=We.fromString(n);return he(RW(e),10190,{key:e.toString()}),e}function op(n,e){return uM(n.databaseId,e.path)}function Ns(n,e){let r=_W(e);if(r.get(1)!==n.databaseId.projectId)throw new Q(j.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+n.databaseId.projectId);if(r.get(3)!==n.databaseId.database)throw new Q(j.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+n.databaseId.database);return new ie(vW(r))}function TW(n,e){return uM(n.databaseId,e)}function IW(n){let e=_W(n);return e.length===4?We.emptyPath():vW(e)}function Cb(n){return new We(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function vW(n){return he(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function kj(n,e,r){return{name:op(n,e),fields:r.value.mapValue.fields}}function Xie(n,e,r){let t=Ns(n,e.name),i=Ln(e.updateTime),o=e.createTime?Ln(e.createTime):me.min(),s=new nr({mapValue:{fields:e.fields}}),a=In.newFoundDocument(t,i,o,s);return r&&a.setHasCommittedMutations(),r?a.setHasCommittedMutations():a}function Jie(n,e){return"found"in e?(function(t,i){he(!!i.found,43571),i.found.name,i.found.updateTime;let o=Ns(t,i.found.name),s=Ln(i.found.updateTime),a=i.found.createTime?Ln(i.found.createTime):me.min(),c=new nr({mapValue:{fields:i.found.fields}});return In.newFoundDocument(o,s,a,c)})(n,e):"missing"in e?(function(t,i){he(!!i.missing,3894),he(!!i.readTime,22933);let o=Ns(t,i.missing),s=Ln(i.readTime);return In.newNoDocument(o,s)})(n,e):ae(7234,{result:e})}function Zie(n,e){let r;if("targetChange"in e){e.targetChange;let t=(function(l){return l==="NO_CHANGE"?0:l==="ADD"?1:l==="REMOVE"?2:l==="CURRENT"?3:l==="RESET"?4:ae(39313,{state:l})})(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=(function(l,u){return l.useProto3Json?(he(u===void 0||typeof u=="string",58123),un.fromBase64String(u||"")):(he(u===void 0||u instanceof Buffer||u instanceof Uint8Array,16193),un.fromUint8Array(u||new Uint8Array))})(n,e.targetChange.resumeToken),s=e.targetChange.cause,a=s&&(function(l){let u=l.code===void 0?j.UNKNOWN:pW(l.code);return new Q(u,l.message||"")})(s);r=new Yv(t,i,o,a||null)}else if("documentChange"in e){e.documentChange;let t=e.documentChange;t.document,t.document.name,t.document.updateTime;let i=Ns(n,t.document.name),o=Ln(t.document.updateTime),s=t.document.createTime?Ln(t.document.createTime):me.min(),a=new nr({mapValue:{fields:t.document.fields}}),c=In.newFoundDocument(i,o,s,a),l=t.targetIds||[],u=t.removedTargetIds||[];r=new hh(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;let t=e.documentDelete;t.document;let i=Ns(n,t.document),o=t.readTime?Ln(t.readTime):me.min(),s=In.newNoDocument(i,o),a=t.removedTargetIds||[];r=new hh([],a,s.key,s)}else if("documentRemove"in e){e.documentRemove;let t=e.documentRemove;t.document;let i=Ns(n,t.document),o=t.removedTargetIds||[];r=new hh([],o,i,null)}else{if(!("filter"in e))return ae(11601,{At:e});{e.filter;let t=e.filter;t.targetId;let{count:i=0,unchangedNames:o}=t,s=new vb(i,o),a=t.targetId;r=new Kv(a,s)}}return r}function sp(n,e){let r;if(e instanceof qa)r={update:kj(n,e.key,e.value)};else if(e instanceof Yl)r={delete:op(n,e.key)};else if(e instanceof Yi)r={update:kj(n,e.key,e.data),updateMask:soe(e.fieldMask)};else{if(!(e instanceof ep))return ae(16599,{Rt:e.type});r={verify:op(n,e.key)}}return e.fieldTransforms.length>0&&(r.updateTransforms=e.fieldTransforms.map(t=>(function(o,s){let a=s.transform;if(a instanceof ql)return{fieldPath:s.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Wa)return{fieldPath:s.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof za)return{fieldPath:s.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Kl)return{fieldPath:s.field.canonicalString(),increment:a.Ee};throw ae(20930,{transform:s.transform})})(0,t))),e.precondition.isNone||(r.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:Qie(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:ae(27497)})(n,e.precondition)),r}function Nb(n,e){let r=e.currentDocument?(function(o){return o.updateTime!==void 0?Gn.updateTime(Ln(o.updateTime)):o.exists!==void 0?Gn.exists(o.exists):Gn.none()})(e.currentDocument):Gn.none(),t=e.updateTransforms?e.updateTransforms.map(i=>(function(s,a){let c=null;if("setToServerValue"in a)he(a.setToServerValue==="REQUEST_TIME",16630,{proto:a}),c=new ql;else if("appendMissingElements"in a){let u=a.appendMissingElements.values||[];c=new Wa(u)}else if("removeAllFromArray"in a){let u=a.removeAllFromArray.values||[];c=new za(u)}else"increment"in a?c=new Kl(s,a.increment):ae(16584,{proto:a});let l=Tn.fromServerFormat(a.fieldPath);return new Eb(l,c)})(n,i)):[];if(e.update){e.update.name;let i=Ns(n,e.update.name),o=new nr({mapValue:{fields:e.update.fields}});if(e.updateMask){let s=(function(c){let l=c.fieldPaths||[];return new Yr(l.map(u=>Tn.fromServerFormat(u)))})(e.updateMask);return new Yi(i,o,s,r,t)}return new qa(i,o,r,t)}if(e.delete){let i=Ns(n,e.delete);return new Yl(i,r)}if(e.verify){let i=Ns(n,e.verify);return new ep(i,r)}return ae(1463,{proto:e})}function eoe(n,e){return n&&n.length>0?(he(e!==void 0,14353),n.map(r=>(function(i,o){let s=i.updateTime?Ln(i.updateTime):Ln(o);return s.isEqual(me.min())&&(s=Ln(o)),new _b(s,i.transformResults||[])})(r,e))):[]}function yW(n,e){return{documents:[TW(n,e.path)]}}function dM(n,e){let r={structuredQuery:{}},t=e.path,i;e.collectionGroup!==null?(i=t,r.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=t.popLast(),r.structuredQuery.from=[{collectionId:t.lastSegment()}]),r.parent=TW(n,i);let o=(function(l){if(l.length!==0)return DW(nt.create(l,"and"))})(e.filters);o&&(r.structuredQuery.where=o);let s=(function(l){if(l.length!==0)return l.map(u=>(function(f){return{field:Pa(f.field),direction:roe(f.dir)}})(u))})(e.orderBy);s&&(r.structuredQuery.orderBy=s);let a=Db(n,e.limit);return a!==null&&(r.structuredQuery.limit=a),e.startAt&&(r.structuredQuery.startAt=(function(l){return{before:l.inclusive,values:l.position}})(e.startAt)),e.endAt&&(r.structuredQuery.endAt=(function(l){return{before:!l.inclusive,values:l.position}})(e.endAt)),{Vt:r,parent:i}}function toe(n,e,r,t){let{Vt:i,parent:o}=dM(n,e),s={},a=[],c=0;return r.forEach(l=>{let u=t?l.alias:"aggregate_"+c++;s[u]=l.alias,l.aggregateType==="count"?a.push({alias:u,count:{}}):l.aggregateType==="avg"?a.push({alias:u,avg:{field:Pa(l.fieldPath)}}):l.aggregateType==="sum"&&a.push({alias:u,sum:{field:Pa(l.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:a,structuredQuery:i.structuredQuery},parent:i.parent},ft:s,parent:o}}function SW(n){let e=IW(n.parent),r=n.structuredQuery,t=r.from?r.from.length:0,i=null;if(t>0){he(t===1,65062);let u=r.from[0];u.allDescendants?i=u.collectionId:e=e.child(u.collectionId)}let o=[];r.where&&(o=(function(d){let f=AW(d);return f instanceof nt&&sM(f)?f.getFilters():[f]})(r.where));let s=[];r.orderBy&&(s=(function(d){return d.map(f=>(function(p){return new Wl(ah(p.field),(function(T){switch(T){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(p.direction))})(f))})(r.orderBy));let a=null;r.limit&&(a=(function(d){let f;return f=typeof d=="object"?d.value:d,_p(f)?null:f})(r.limit));let c=null;r.startAt&&(c=(function(d){let f=!!d.before,g=d.values||[];return new Ho(g,f)})(r.startAt));let l=null;return r.endAt&&(l=(function(d){let f=!d.before,g=d.values||[];return new Ho(g,f)})(r.endAt)),eW(e,i,s,o,a,"F",c,l)}function noe(n,e){let r=(function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ae(28987,{purpose:i})}})(e.purpose);return r==null?null:{"goog-listen-tags":r}}function AW(n){return n.unaryFilter!==void 0?(function(r){switch(r.unaryFilter.op){case"IS_NAN":let t=ah(r.unaryFilter.field);return $e.create(t,"==",{doubleValue:NaN});case"IS_NULL":let i=ah(r.unaryFilter.field);return $e.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let o=ah(r.unaryFilter.field);return $e.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let s=ah(r.unaryFilter.field);return $e.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return ae(61313);default:return ae(60726)}})(n):n.fieldFilter!==void 0?(function(r){return $e.create(ah(r.fieldFilter.field),(function(i){switch(i){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 ae(58110);default:return ae(50506)}})(r.fieldFilter.op),r.fieldFilter.value)})(n):n.compositeFilter!==void 0?(function(r){return nt.create(r.compositeFilter.filters.map(t=>AW(t)),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return ae(1026)}})(r.compositeFilter.op))})(n):ae(30097,{filter:n})}function roe(n){return qie[n]}function ioe(n){return Kie[n]}function ooe(n){return Yie[n]}function Pa(n){return{fieldPath:n.canonicalString()}}function ah(n){return Tn.fromServerFormat(n.fieldPath)}function DW(n){return n instanceof $e?(function(r){if(r.op==="=="){if(vj(r.value))return{unaryFilter:{field:Pa(r.field),op:"IS_NAN"}};if(Ij(r.value))return{unaryFilter:{field:Pa(r.field),op:"IS_NULL"}}}else if(r.op==="!="){if(vj(r.value))return{unaryFilter:{field:Pa(r.field),op:"IS_NOT_NAN"}};if(Ij(r.value))return{unaryFilter:{field:Pa(r.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Pa(r.field),op:ioe(r.op),value:r.value}}})(n):n instanceof nt?(function(r){let t=r.getFilters().map(i=>DW(i));return t.length===1?t[0]:{compositeFilter:{op:ooe(r.op),filters:t}}})(n):ae(54877,{filter:n})}function soe(n){let e=[];return n.fields.forEach(r=>e.push(r.canonicalString())),{fieldPaths:e}}function RW(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}var Oh=class n{constructor(e,r,t,i,o=me.min(),s=me.min(),a=un.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=r,this.purpose=t,this.sequenceNumber=i,this.snapshotVersion=o,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new n(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,r){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,r,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}};var Xv=class{constructor(e){this.gt=e}};function aoe(n,e){let r;if(e.document)r=Xie(n.gt,e.document,!!e.hasCommittedMutations);else if(e.noDocument){let t=ie.fromSegments(e.noDocument.path),i=Xl(e.noDocument.readTime);r=In.newNoDocument(t,i),e.hasCommittedMutations&&r.setHasCommittedMutations()}else{if(!e.unknownDocument)return ae(56709);{let t=ie.fromSegments(e.unknownDocument.path),i=Xl(e.unknownDocument.version);r=In.newUnknownDocument(t,i)}}return e.readTime&&r.setReadTime((function(i){let o=new Pt(i[0],i[1]);return me.fromTimestamp(o)})(e.readTime)),r}function Uj(n,e){let r=e.key,t={prefixPath:r.getCollectionPath().popLast().toArray(),collectionGroup:r.collectionGroup,documentId:r.path.lastSegment(),readTime:Jv(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())t.document=(function(o,s){return{name:op(o,s.key),fields:s.data.value.mapValue.fields,updateTime:Nh(o,s.version.toTimestamp()),createTime:Nh(o,s.createTime.toTimestamp())}})(n.gt,e);else if(e.isNoDocument())t.noDocument={path:r.path.toArray(),readTime:Ql(e.version)};else{if(!e.isUnknownDocument())return ae(57904,{document:e});t.unknownDocument={path:r.path.toArray(),version:Ql(e.version)}}return t}function Jv(n){let e=n.toTimestamp();return[e.seconds,e.nanoseconds]}function Ql(n){let e=n.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function Xl(n){let e=new Pt(n.seconds,n.nanoseconds);return me.fromTimestamp(e)}function xl(n,e){let r=(e.baseMutations||[]).map(o=>Nb(n.gt,o));for(let o=0;o<e.mutations.length-1;++o){let s=e.mutations[o];if(o+1<e.mutations.length&&e.mutations[o+1].transform!==void 0){let a=e.mutations[o+1];s.updateTransforms=a.transform.fieldTransforms,e.mutations.splice(o+1,1),++o}}let t=e.mutations.map(o=>Nb(n.gt,o)),i=Pt.fromMillis(e.localWriteTimeMs);return new tp(e.batchId,i,r,t)}function Mm(n){let e=Xl(n.readTime),r=n.lastLimboFreeSnapshotVersion!==void 0?Xl(n.lastLimboFreeSnapshotVersion):me.min(),t;return t=(function(o){return o.documents!==void 0})(n.query)?(function(o){let s=o.documents.length;return he(s===1,1966,{count:s}),Xr(vp(IW(o.documents[0])))})(n.query):(function(o){return Xr(SW(o))})(n.query),new Oh(t,n.targetId,"TargetPurposeListen",n.lastListenSequenceNumber,e,r,un.fromBase64String(n.resumeToken))}function CW(n,e){let r=Ql(e.snapshotVersion),t=Ql(e.lastLimboFreeSnapshotVersion),i;i=Wv(e.target)?yW(n.gt,e.target):dM(n.gt,e.target).Vt;let o=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:zl(e.target),readTime:r,resumeToken:o,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:t,query:i}}function NW(n){let e=SW({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?qv(e,e.limit,"L"):e}function xw(n,e){return new np(e.largestBatchId,Nb(n.gt,e.overlayMutation))}function Vj(n,e){let r=e.path.lastSegment();return[n,rr(e.path.popLast()),r]}function Bj(n,e,r,t){return{indexId:n,uid:e,sequenceNumber:r,readTime:Ql(t.readTime),documentKey:rr(t.documentKey.path),largestBatchId:t.largestBatchId}}var Ob=class{getBundleMetadata(e,r){return Gj(e).get(r).next(t=>{if(t)return(function(o){return{id:o.bundleId,createTime:Xl(o.createTime),version:o.version}})(t)})}saveBundleMetadata(e,r){return Gj(e).put((function(i){return{bundleId:i.id,createTime:Ql(Ln(i.createTime)),version:i.version}})(r))}getNamedQuery(e,r){return $j(e).get(r).next(t=>{if(t)return(function(o){return{name:o.name,query:NW(o.bundledQuery),readTime:Xl(o.readTime)}})(t)})}saveNamedQuery(e,r){return $j(e).put((function(i){return{name:i.name,readTime:Ql(Ln(i.readTime)),bundledQuery:i.bundledQuery}})(r))}};function Gj(n){return yn(n,wy)}function $j(n){return yn(n,by)}var Zv=class n{constructor(e,r){this.serializer=e,this.userId=r}static yt(e,r){let t=r.uid||"";return new n(e,t)}getOverlay(e,r){return Nm(e).get(Vj(this.userId,r)).next(t=>t?xw(this.serializer,t):null)}getOverlays(e,r){let t=Go();return B.forEach(r,i=>this.getOverlay(e,i).next(o=>{o!==null&&t.set(i,o)})).next(()=>t)}saveOverlays(e,r,t){let i=[];return t.forEach((o,s)=>{let a=new np(r,s);i.push(this.wt(e,a))}),B.waitFor(i)}removeOverlaysForBatchId(e,r,t){let i=new Set;r.forEach(s=>i.add(rr(s.getCollectionPath())));let o=[];return i.forEach(s=>{let a=IDBKeyRange.bound([this.userId,s,t],[this.userId,s,t+1],!1,!0);o.push(Nm(e).Y(nb,a))}),B.waitFor(o)}getOverlaysForCollection(e,r,t){let i=Go(),o=rr(r),s=IDBKeyRange.bound([this.userId,o,t],[this.userId,o,Number.POSITIVE_INFINITY],!0);return Nm(e).j(nb,s).next(a=>{for(let c of a){let l=xw(this.serializer,c);i.set(l.getKey(),l)}return i})}getOverlaysForCollectionGroup(e,r,t,i){let o=Go(),s,a=IDBKeyRange.bound([this.userId,r,t],[this.userId,r,Number.POSITIVE_INFINITY],!0);return Nm(e).X({index:xH,range:a},(c,l,u)=>{let d=xw(this.serializer,l);o.size()<i||d.largestBatchId===s?(o.set(d.getKey(),d),s=d.largestBatchId):u.done()}).next(()=>o)}wt(e,r){return Nm(e).put((function(i,o,s){let[a,c,l]=Vj(o,s.mutation.key);return{userId:o,collectionPath:c,documentId:l,collectionGroup:s.mutation.key.getCollectionGroup(),largestBatchId:s.largestBatchId,overlayMutation:sp(i.gt,s.mutation)}})(this.serializer,this.userId,r))}};function Nm(n){return yn(n,Ly)}var wb=class{St(e){return yn(e,nM)}getSessionToken(e){return this.St(e).get("sessionToken").next(r=>{let t=r?.value;return t?un.fromUint8Array(t):un.EMPTY_BYTE_STRING})}setSessionToken(e,r){return this.St(e).put({name:"sessionToken",value:r.toUint8Array()})}};var Cs=class{constructor(){}bt(e,r){this.Dt(e,r),r.vt()}Dt(e,r){if("nullValue"in e)this.Ct(r,5);else if("booleanValue"in e)this.Ct(r,10),r.Ft(e.booleanValue?1:0);else if("integerValue"in e)this.Ct(r,15),r.Ft(Mt(e.integerValue));else if("doubleValue"in e){let t=Mt(e.doubleValue);isNaN(t)?this.Ct(r,13):(this.Ct(r,15),Wm(t)?r.Ft(0):r.Ft(t))}else if("timestampValue"in e){let t=e.timestampValue;this.Ct(r,20),typeof t=="string"&&(t=bs(t)),r.Mt(`${t.seconds||""}`),r.Ft(t.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,r),this.Ot(r);else if("bytesValue"in e)this.Ct(r,30),r.Nt(Ls(e.bytesValue)),this.Ot(r);else if("referenceValue"in e)this.Bt(e.referenceValue,r);else if("geoPointValue"in e){let t=e.geoPointValue;this.Ct(r,45),r.Ft(t.latitude||0),r.Ft(t.longitude||0)}else"mapValue"in e?zH(e)?this.Ct(r,Number.MAX_SAFE_INTEGER):xy(e)?this.Lt(e.mapValue,r):(this.kt(e.mapValue,r),this.Ot(r)):"arrayValue"in e?(this.qt(e.arrayValue,r),this.Ot(r)):ae(19022,{Qt:e})}xt(e,r){this.Ct(r,25),this.$t(e,r)}$t(e,r){r.Mt(e)}kt(e,r){let t=e.fields||{};this.Ct(r,55);for(let i of Object.keys(t))this.xt(i,r),this.Dt(t[i],r)}Lt(e,r){var t,i;let o=e.fields||{};this.Ct(r,53);let s=Sh,a=((i=(t=o[s].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.length)||0;this.Ct(r,15),r.Ft(Mt(a)),this.xt(s,r),this.Dt(o[s],r)}qt(e,r){let t=e.values||[];this.Ct(r,50);for(let i of t)this.Dt(i,r)}Bt(e,r){this.Ct(r,37),ie.fromName(e).path.forEach(t=>{this.Ct(r,60),this.$t(t,r)})}Ct(e,r){e.Ft(r)}Ot(e){e.Ft(2)}};Cs.Ut=new Cs;var th=255;function coe(n){if(n===0)return 8;let e=0;return n>>4||(e+=4,n<<=4),n>>6||(e+=2,n<<=2),n>>7||(e+=1),e}function jj(n){let e=64-(function(t){let i=0;for(let o=0;o<8;++o){let s=coe(255&t[o]);if(i+=s,s!==8)break}return i})(n);return Math.ceil(e/8)}var bb=class{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Kt(e){let r=e[Symbol.iterator](),t=r.next();for(;!t.done;)this.Wt(t.value),t=r.next();this.Gt()}zt(e){let r=e[Symbol.iterator](),t=r.next();for(;!t.done;)this.jt(t.value),t=r.next();this.Jt()}Ht(e){for(let r of e){let t=r.charCodeAt(0);if(t<128)this.Wt(t);else if(t<2048)this.Wt(960|t>>>6),this.Wt(128|63&t);else if(r<"\uD800"||"\uDBFF"<r)this.Wt(480|t>>>12),this.Wt(128|63&t>>>6),this.Wt(128|63&t);else{let i=r.codePointAt(0);this.Wt(240|i>>>18),this.Wt(128|63&i>>>12),this.Wt(128|63&i>>>6),this.Wt(128|63&i)}}this.Gt()}Yt(e){for(let r of e){let t=r.charCodeAt(0);if(t<128)this.jt(t);else if(t<2048)this.jt(960|t>>>6),this.jt(128|63&t);else if(r<"\uD800"||"\uDBFF"<r)this.jt(480|t>>>12),this.jt(128|63&t>>>6),this.jt(128|63&t);else{let i=r.codePointAt(0);this.jt(240|i>>>18),this.jt(128|63&i>>>12),this.jt(128|63&i>>>6),this.jt(128|63&i)}}this.Jt()}Zt(e){let r=this.Xt(e),t=jj(r);this.en(1+t),this.buffer[this.position++]=255&t;for(let i=r.length-t;i<r.length;++i)this.buffer[this.position++]=255&r[i]}tn(e){let r=this.Xt(e),t=jj(r);this.en(1+t),this.buffer[this.position++]=~(255&t);for(let i=r.length-t;i<r.length;++i)this.buffer[this.position++]=~(255&r[i])}nn(){this.rn(th),this.rn(255)}sn(){this._n(th),this._n(255)}reset(){this.position=0}seed(e){this.en(e.length),this.buffer.set(e,this.position),this.position+=e.length}an(){return this.buffer.slice(0,this.position)}Xt(e){let r=(function(o){let s=new DataView(new ArrayBuffer(8));return s.setFloat64(0,o,!1),new Uint8Array(s.buffer)})(e),t=!!(128&r[0]);r[0]^=t?255:128;for(let i=1;i<r.length;++i)r[i]^=t?255:0;return r}Wt(e){let r=255&e;r===0?(this.rn(0),this.rn(255)):r===th?(this.rn(th),this.rn(0)):this.rn(r)}jt(e){let r=255&e;r===0?(this._n(0),this._n(255)):r===th?(this._n(th),this._n(0)):this._n(e)}Gt(){this.rn(0),this.rn(1)}Jt(){this._n(0),this._n(1)}rn(e){this.en(1),this.buffer[this.position++]=e}_n(e){this.en(1),this.buffer[this.position++]=~e}en(e){let r=e+this.position;if(r<=this.buffer.length)return;let t=2*this.buffer.length;t<r&&(t=r);let i=new Uint8Array(t);i.set(this.buffer),this.buffer=i}},Lb=class{constructor(e){this.un=e}Nt(e){this.un.Kt(e)}Mt(e){this.un.Ht(e)}Ft(e){this.un.Zt(e)}vt(){this.un.nn()}},Mb=class{constructor(e){this.un=e}Nt(e){this.un.zt(e)}Mt(e){this.un.Yt(e)}Ft(e){this.un.tn(e)}vt(){this.un.sn()}},Fl=class{constructor(){this.un=new bb,this.cn=new Lb(this.un),this.ln=new Mb(this.un)}seed(e){this.un.seed(e)}hn(e){return e===0?this.cn:this.ln}an(){return this.un.an()}reset(){this.un.reset()}};var kl=class n{constructor(e,r,t,i){this.Pn=e,this.Tn=r,this.In=t,this.dn=i}En(){let e=this.dn.length,r=e===0||this.dn[e-1]===255?e+1:e,t=new Uint8Array(r);return t.set(this.dn,0),r!==e?t.set([0],this.dn.length):++t[t.length-1],new n(this.Pn,this.Tn,this.In,t)}An(e,r,t){return{indexId:this.Pn,uid:e,arrayValue:bv(this.In),directionalValue:bv(this.dn),orderedDocumentKey:bv(r),documentKey:t.path.toArray()}}Rn(e,r,t){let i=this.An(e,r,t);return[i.indexId,i.uid,i.arrayValue,i.directionalValue,i.orderedDocumentKey,i.documentKey]}};function ba(n,e){let r=n.Pn-e.Pn;return r!==0?r:(r=Hj(n.In,e.In),r!==0?r:(r=Hj(n.dn,e.dn),r!==0?r:ie.comparator(n.Tn,e.Tn)))}function Hj(n,e){for(let r=0;r<n.length&&r<e.length;++r){let t=n[r]-e[r];if(t!==0)return t}return n.length-e.length}function bv(n){return VC()?(function(r){let t="";for(let i=0;i<r.length;i++)t+=String.fromCharCode(r[i]);return t})(n):n}function Wj(n){return typeof n!="string"?n:(function(r){let t=new Uint8Array(r.length);for(let i=0;i<r.length;i++)t[i]=r.charCodeAt(i);return t})(n)}var ey=class{constructor(e){this.Vn=new at((r,t)=>Tn.comparator(r.field,t.field)),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.mn=e.orderBy,this.fn=[];for(let r of e.filters){let t=r;t.isInequality()?this.Vn=this.Vn.add(t):this.fn.push(t)}}get gn(){return this.Vn.size>1}pn(e){if(he(e.collectionGroup===this.collectionId,49279),this.gn)return!1;let r=Yw(e);if(r!==void 0&&!this.yn(r))return!1;let t=Ll(e),i=new Set,o=0,s=0;for(;o<t.length&&this.yn(t[o]);++o)i=i.add(t[o].fieldPath.canonicalString());if(o===t.length)return!0;if(this.Vn.size>0){let a=this.Vn.getIterator().getNext();if(!i.has(a.field.canonicalString())){let c=t[o];if(!this.wn(a,c)||!this.Sn(this.mn[s++],c))return!1}++o}for(;o<t.length;++o){let a=t[o];if(s>=this.mn.length||!this.Sn(this.mn[s++],a))return!1}return!0}bn(){if(this.gn)return null;let e=new at(Tn.comparator),r=[];for(let t of this.fn)if(!t.field.isKeyField())if(t.op==="array-contains"||t.op==="array-contains-any")r.push(new uh(t.field,2));else{if(e.has(t.field))continue;e=e.add(t.field),r.push(new uh(t.field,0))}for(let t of this.mn)t.field.isKeyField()||e.has(t.field)||(e=e.add(t.field),r.push(new uh(t.field,t.dir==="asc"?0:1)));return new ph(ph.UNKNOWN_ID,this.collectionId,r,Hm.empty())}yn(e){for(let r of this.fn)if(this.wn(r,e))return!0;return!1}wn(e,r){if(e===void 0||!e.field.isEqual(r.fieldPath))return!1;let t=e.op==="array-contains"||e.op==="array-contains-any";return r.kind===2===t}Sn(e,r){return!!e.field.isEqual(r.fieldPath)&&(r.kind===0&&e.dir==="asc"||r.kind===1&&e.dir==="desc")}};function OW(n){var e,r;if(he(n instanceof $e||n instanceof nt,20012),n instanceof $e){if(n instanceof Hv){let i=((r=(e=n.value.arrayValue)===null||e===void 0?void 0:e.values)===null||r===void 0?void 0:r.map(o=>$e.create(n.field,"==",o)))||[];return nt.create(i,"or")}return n}let t=n.filters.map(i=>OW(i));return nt.create(t,n.op)}function loe(n){if(n.getFilters().length===0)return[];let e=Fb(OW(n));return he(wW(e),7391),Pb(e)||xb(e)?[e]:e.getFilters()}function Pb(n){return n instanceof $e}function xb(n){return n instanceof nt&&sM(n)}function wW(n){return Pb(n)||xb(n)||(function(r){if(r instanceof nt&&sb(r)){for(let t of r.getFilters())if(!Pb(t)&&!xb(t))return!1;return!0}return!1})(n)}function Fb(n){if(he(n instanceof $e||n instanceof nt,34018),n instanceof $e)return n;if(n.filters.length===1)return Fb(n.filters[0]);let e=n.filters.map(t=>Fb(t)),r=nt.create(e,n.op);return r=ty(r),wW(r)?r:(he(r instanceof nt,64498),he(Dh(r),40251),he(r.filters.length>1,57927),r.filters.reduce((t,i)=>hM(t,i)))}function hM(n,e){let r;return he(n instanceof $e||n instanceof nt,38388),he(e instanceof $e||e instanceof nt,25473),r=n instanceof $e?e instanceof $e?(function(i,o){return nt.create([i,o],"and")})(n,e):zj(n,e):e instanceof $e?zj(e,n):(function(i,o){if(he(i.filters.length>0&&o.filters.length>0,48005),Dh(i)&&Dh(o))return XH(i,o.getFilters());let s=sb(i)?i:o,a=sb(i)?o:i,c=s.filters.map(l=>hM(l,a));return nt.create(c,"or")})(n,e),ty(r)}function zj(n,e){if(Dh(e))return XH(e,n.getFilters());{let r=e.filters.map(t=>hM(n,t));return nt.create(r,"or")}}function ty(n){if(he(n instanceof $e||n instanceof nt,11850),n instanceof $e)return n;let e=n.getFilters();if(e.length===1)return ty(e[0]);if(YH(n))return n;let r=e.map(i=>ty(i)),t=[];return r.forEach(i=>{i instanceof $e?t.push(i):i instanceof nt&&(i.op===n.op?t.push(...i.filters):t.push(i))}),t.length===1?t[0]:nt.create(t,n.op)}var kb=class{constructor(){this.Dn=new ap}addToCollectionParentIndex(e,r){return this.Dn.add(r),B.resolve()}getCollectionParents(e,r){return B.resolve(this.Dn.getEntries(r))}addFieldIndex(e,r){return B.resolve()}deleteFieldIndex(e,r){return B.resolve()}deleteAllFieldIndexes(e){return B.resolve()}createTargetIndexes(e,r){return B.resolve()}getDocumentsMatchingTarget(e,r){return B.resolve(null)}getIndexType(e,r){return B.resolve(0)}getFieldIndexes(e,r){return B.resolve([])}getNextCollectionGroupToUpdate(e){return B.resolve(null)}getMinOffset(e,r){return B.resolve(_i.min())}getMinOffsetFromCollectionGroup(e,r){return B.resolve(_i.min())}updateCollectionGroup(e,r,t){return B.resolve()}updateIndexEntries(e,r){return B.resolve()}},ap=class{constructor(){this.index={}}add(e){let r=e.lastSegment(),t=e.popLast(),i=this.index[r]||new at(We.comparator),o=!i.has(t);return this.index[r]=i.add(t),o}has(e){let r=e.lastSegment(),t=e.popLast(),i=this.index[r];return i&&i.has(t)}getEntries(e){return(this.index[e]||new at(We.comparator)).toArray()}};var qj="IndexedDbIndexManager",vv=new Uint8Array(0),Ub=class{constructor(e,r){this.databaseId=r,this.vn=new ap,this.Cn=new Ki(t=>zl(t),(t,i)=>Ip(t,i)),this.uid=e.uid||""}addToCollectionParentIndex(e,r){if(!this.vn.has(r)){let t=r.lastSegment(),i=r.popLast();e.addOnCommittedListener(()=>{this.vn.add(r)});let o={collectionId:t,parent:rr(i)};return Kj(e).put(o)}return B.resolve()}getCollectionParents(e,r){let t=[],i=IDBKeyRange.bound([r,""],[SH(r),""],!1,!0);return Kj(e).j(i).next(o=>{for(let s of o){if(s.collectionId!==r)break;t.push(Bo(s.parent))}return t})}addFieldIndex(e,r){let t=Om(e),i=(function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map(c=>[c.fieldPath.canonicalString(),c.kind])}})(r);delete i.indexId;let o=t.add(i);if(r.indexState){let s=rh(e);return o.next(a=>{s.put(Bj(a,this.uid,r.indexState.sequenceNumber,r.indexState.offset))})}return o.next()}deleteFieldIndex(e,r){let t=Om(e),i=rh(e),o=nh(e);return t.delete(r.indexId).next(()=>i.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0))).next(()=>o.delete(IDBKeyRange.bound([r.indexId],[r.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){let r=Om(e),t=nh(e),i=rh(e);return r.Y().next(()=>t.Y()).next(()=>i.Y())}createTargetIndexes(e,r){return B.forEach(this.Fn(r),t=>this.getIndexType(e,t).next(i=>{if(i===0||i===1){let o=new ey(t).bn();if(o!=null)return this.addFieldIndex(e,o)}}))}getDocumentsMatchingTarget(e,r){let t=nh(e),i=!0,o=new Map;return B.forEach(this.Fn(r),s=>this.Mn(e,s).next(a=>{i&&(i=!!a),o.set(s,a)})).next(()=>{if(i){let s=Ve(),a=[];return B.forEach(o,(c,l)=>{X(qj,`Using index ${(function(G){return`id=${G.indexId}|cg=${G.collectionGroup}|f=${G.fields.map(M=>`${M.fieldPath}:${M.kind}`).join(",")}`})(c)} to execute ${zl(r)}`);let u=(function(G,M){let U=Yw(M);if(U===void 0)return null;for(let k of zv(G,U.fieldPath))switch(k.op){case"array-contains-any":return k.value.arrayValue.values||[];case"array-contains":return[k.value]}return null})(l,c),d=(function(G,M){let U=new Map;for(let k of Ll(M))for(let S of zv(G,k.fieldPath))switch(S.op){case"==":case"in":U.set(k.fieldPath.canonicalString(),S.value);break;case"not-in":case"!=":return U.set(k.fieldPath.canonicalString(),S.value),Array.from(U.values())}return null})(l,c),f=(function(G,M){let U=[],k=!0;for(let S of Ll(M)){let A=S.kind===0?Rj(G,S.fieldPath,G.startAt):Cj(G,S.fieldPath,G.startAt);U.push(A.value),k&&(k=A.inclusive)}return new Ho(U,k)})(l,c),g=(function(G,M){let U=[],k=!0;for(let S of Ll(M)){let A=S.kind===0?Cj(G,S.fieldPath,G.endAt):Rj(G,S.fieldPath,G.endAt);U.push(A.value),k&&(k=A.inclusive)}return new Ho(U,k)})(l,c),p=this.xn(c,l,f),_=this.xn(c,l,g),T=this.On(c,l,d),D=this.Nn(c.indexId,u,p,f.inclusive,_,g.inclusive,T);return B.forEach(D,b=>t.H(b,r.limit).next(G=>{G.forEach(M=>{let U=ie.fromSegments(M.documentKey);s.has(U)||(s=s.add(U),a.push(U))})}))}).next(()=>a)}return B.resolve(null)})}Fn(e){let r=this.Cn.get(e);return r||(e.filters.length===0?r=[e]:r=loe(nt.create(e.filters,"and")).map(t=>mb(e.path,e.collectionGroup,e.orderBy,t.getFilters(),e.limit,e.startAt,e.endAt)),this.Cn.set(e,r),r)}Nn(e,r,t,i,o,s,a){let c=(r!=null?r.length:1)*Math.max(t.length,o.length),l=c/(r!=null?r.length:1),u=[];for(let d=0;d<c;++d){let f=r?this.Bn(r[d/l]):vv,g=this.Ln(e,f,t[d%l],i),p=this.kn(e,f,o[d%l],s),_=a.map(T=>this.Ln(e,f,T,!0));u.push(...this.createRange(g,p,_))}return u}Ln(e,r,t,i){let o=new kl(e,ie.empty(),r,t);return i?o:o.En()}kn(e,r,t,i){let o=new kl(e,ie.empty(),r,t);return i?o.En():o}Mn(e,r){let t=new ey(r),i=r.collectionGroup!=null?r.collectionGroup:r.path.lastSegment();return this.getFieldIndexes(e,i).next(o=>{let s=null;for(let a of o)t.pn(a)&&(!s||a.fields.length>s.fields.length)&&(s=a);return s})}getIndexType(e,r){let t=2,i=this.Fn(r);return B.forEach(i,o=>this.Mn(e,o).next(s=>{s?t!==0&&s.fields.length<(function(c){let l=new at(Tn.comparator),u=!1;for(let d of c.filters)for(let f of d.getFlattenedFilters())f.field.isKeyField()||(f.op==="array-contains"||f.op==="array-contains-any"?u=!0:l=l.add(f.field));for(let d of c.orderBy)d.field.isKeyField()||(l=l.add(d.field));return l.size+(u?1:0)})(o)&&(t=1):t=0})).next(()=>(function(s){return s.limit!==null})(r)&&i.length>1&&t===2?1:t)}qn(e,r){let t=new Fl;for(let i of Ll(e)){let o=r.data.field(i.fieldPath);if(o==null)return null;let s=t.hn(i.kind);Cs.Ut.bt(o,s)}return t.an()}Bn(e){let r=new Fl;return Cs.Ut.bt(e,r.hn(0)),r.an()}Qn(e,r){let t=new Fl;return Cs.Ut.bt(Hl(this.databaseId,r),t.hn((function(o){let s=Ll(o);return s.length===0?0:s[s.length-1].kind})(e))),t.an()}On(e,r,t){if(t===null)return[];let i=[];i.push(new Fl);let o=0;for(let s of Ll(e)){let a=t[o++];for(let c of i)if(this.$n(r,s.fieldPath)&&Zm(a))i=this.Un(i,s,a);else{let l=c.hn(s.kind);Cs.Ut.bt(a,l)}}return this.Kn(i)}xn(e,r,t){return this.On(e,r,t.position)}Kn(e){let r=[];for(let t=0;t<e.length;++t)r[t]=e[t].an();return r}Un(e,r,t){let i=[...e],o=[];for(let s of t.arrayValue.values||[])for(let a of i){let c=new Fl;c.seed(a.an()),Cs.Ut.bt(s,c.hn(r.kind)),o.push(c)}return o}$n(e,r){return!!e.filters.find(t=>t instanceof $e&&t.field.isEqual(r)&&(t.op==="in"||t.op==="not-in"))}getFieldIndexes(e,r){let t=Om(e),i=rh(e);return(r?t.j(tb,IDBKeyRange.bound(r,r)):t.j()).next(o=>{let s=[];return B.forEach(o,a=>i.get([a.indexId,this.uid]).next(c=>{s.push((function(u,d){let f=d?new Hm(d.sequenceNumber,new _i(Xl(d.readTime),new ie(Bo(d.documentKey)),d.largestBatchId)):Hm.empty(),g=u.fields.map(([p,_])=>new uh(Tn.fromServerFormat(p),_));return new ph(u.indexId,u.collectionGroup,g,f)})(a,c))})).next(()=>s)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(r=>r.length===0?null:(r.sort((t,i)=>{let o=t.indexState.sequenceNumber-i.indexState.sequenceNumber;return o!==0?o:Re(t.collectionGroup,i.collectionGroup)}),r[0].collectionGroup))}updateCollectionGroup(e,r,t){let i=Om(e),o=rh(e);return this.Wn(e).next(s=>i.j(tb,IDBKeyRange.bound(r,r)).next(a=>B.forEach(a,c=>o.put(Bj(c.indexId,this.uid,s,t)))))}updateIndexEntries(e,r){let t=new Map;return B.forEach(r,(i,o)=>{let s=t.get(i.collectionGroup);return(s?B.resolve(s):this.getFieldIndexes(e,i.collectionGroup)).next(a=>(t.set(i.collectionGroup,a),B.forEach(a,c=>this.Gn(e,i,c).next(l=>{let u=this.zn(o,c);return l.isEqual(u)?B.resolve():this.jn(e,o,c,l,u)}))))})}Jn(e,r,t,i){return nh(e).put(i.An(this.uid,this.Qn(t,r.key),r.key))}Hn(e,r,t,i){return nh(e).delete(i.Rn(this.uid,this.Qn(t,r.key),r.key))}Gn(e,r,t){let i=nh(e),o=new at(ba);return i.X({index:PH,range:IDBKeyRange.only([t.indexId,this.uid,bv(this.Qn(t,r))])},(s,a)=>{o=o.add(new kl(t.indexId,r,Wj(a.arrayValue),Wj(a.directionalValue)))}).next(()=>o)}zn(e,r){let t=new at(ba),i=this.qn(r,e);if(i==null)return t;let o=Yw(r);if(o!=null){let s=e.data.field(o.fieldPath);if(Zm(s))for(let a of s.arrayValue.values||[])t=t.add(new kl(r.indexId,e.key,this.Bn(a),i))}else t=t.add(new kl(r.indexId,e.key,vv,i));return t}jn(e,r,t,i,o){X(qj,"Updating index entries for document '%s'",r.key);let s=[];return(function(c,l,u,d,f){let g=c.getIterator(),p=l.getIterator(),_=eh(g),T=eh(p);for(;_||T;){let D=!1,b=!1;if(_&&T){let G=u(_,T);G<0?b=!0:G>0&&(D=!0)}else _!=null?b=!0:D=!0;D?(d(T),T=eh(p)):b?(f(_),_=eh(g)):(_=eh(g),T=eh(p))}})(i,o,ba,a=>{s.push(this.Jn(e,r,t,a))},a=>{s.push(this.Hn(e,r,t,a))}),B.waitFor(s)}Wn(e){let r=1;return rh(e).X({index:MH,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(t,i,o)=>{o.done(),r=i.sequenceNumber+1}).next(()=>r)}createRange(e,r,t){t=t.sort((s,a)=>ba(s,a)).filter((s,a,c)=>!a||ba(s,c[a-1])!==0);let i=[];i.push(e);for(let s of t){let a=ba(s,e),c=ba(s,r);if(a===0)i[0]=e.En();else if(a>0&&c<0)i.push(s),i.push(s.En());else if(c>0)break}i.push(r);let o=[];for(let s=0;s<i.length;s+=2){if(this.Yn(i[s],i[s+1]))return[];let a=i[s].Rn(this.uid,vv,ie.empty()),c=i[s+1].Rn(this.uid,vv,ie.empty());o.push(IDBKeyRange.bound(a,c))}return o}Yn(e,r){return ba(e,r)>0}getMinOffsetFromCollectionGroup(e,r){return this.getFieldIndexes(e,r).next(Yj)}getMinOffset(e,r){return B.mapArray(this.Fn(r),t=>this.Mn(e,t).next(i=>i||ae(44426))).next(Yj)}};function Kj(n){return yn(n,Km)}function nh(n){return yn(n,km)}function Om(n){return yn(n,tM)}function rh(n){return yn(n,Fm)}function Yj(n){he(n.length!==0,28825);let e=n[0].indexState.offset,r=e.largestBatchId;for(let t=1;t<n.length;t++){let i=n[t].indexState.offset;JL(i,e)<0&&(e=i),r<i.largestBatchId&&(r=i.largestBatchId)}return new _i(e.readTime,e.documentKey,r)}var Qj={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},bW=41943040,Nr=class n{static withCacheSize(e){return new n(e,n.DEFAULT_COLLECTION_PERCENTILE,n.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,r,t){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=r,this.maximumSequenceNumbersToCollect=t}};function LW(n,e,r){let t=n.store(qi),i=n.store(_h),o=[],s=IDBKeyRange.only(r.batchId),a=0,c=t.X({range:s},(u,d,f)=>(a++,f.delete()));o.push(c.next(()=>{he(a===1,47070,{batchId:r.batchId})}));let l=[];for(let u of r.mutations){let d=wH(e,u.key.path,r.batchId);o.push(i.delete(d)),l.push(u.key)}return B.waitFor(o).next(()=>l)}function ny(n){if(!n)return 0;let e;if(n.document)e=n.document;else if(n.unknownDocument)e=n.unknownDocument;else{if(!n.noDocument)throw ae(14731);e=n.noDocument}return JSON.stringify(e).length}Nr.DEFAULT_COLLECTION_PERCENTILE=10,Nr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Nr.DEFAULT=new Nr(bW,Nr.DEFAULT_COLLECTION_PERCENTILE,Nr.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Nr.DISABLED=new Nr(-1,0,0);var ry=class n{constructor(e,r,t,i){this.userId=e,this.serializer=r,this.indexManager=t,this.referenceDelegate=i,this.Zn={}}static yt(e,r,t,i){he(e.uid!=="",64387);let o=e.isAuthenticated()?e.uid:"";return new n(o,r,t,i)}checkEmpty(e){let r=!0,t=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return La(e).X({index:Ul,range:t},(i,o,s)=>{r=!1,s.done()}).next(()=>r)}addMutationBatch(e,r,t,i){let o=ch(e),s=La(e);return s.add({}).next(a=>{he(typeof a=="number",49019);let c=new tp(a,r,t,i),l=(function(g,p,_){let T=_.baseMutations.map(b=>sp(g.gt,b)),D=_.mutations.map(b=>sp(g.gt,b));return{userId:p,batchId:_.batchId,localWriteTimeMs:_.localWriteTime.toMillis(),baseMutations:T,mutations:D}})(this.serializer,this.userId,c),u=[],d=new at((f,g)=>Re(f.canonicalString(),g.canonicalString()));for(let f of i){let g=wH(this.userId,f.key.path,a);d=d.add(f.key.path.popLast()),u.push(s.put(l)),u.push(o.put(g,oie))}return d.forEach(f=>{u.push(this.indexManager.addToCollectionParentIndex(e,f))}),e.addOnCommittedListener(()=>{this.Zn[a]=c.keys()}),B.waitFor(u).next(()=>c)})}lookupMutationBatch(e,r){return La(e).get(r).next(t=>t?(he(t.userId===this.userId,48,"Unexpected user for mutation batch",{userId:t.userId,batchId:r}),xl(this.serializer,t)):null)}Xn(e,r){return this.Zn[r]?B.resolve(this.Zn[r]):this.lookupMutationBatch(e,r).next(t=>{if(t){let i=t.keys();return this.Zn[r]=i,i}return null})}getNextMutationBatchAfterBatchId(e,r){let t=r+1,i=IDBKeyRange.lowerBound([this.userId,t]),o=null;return La(e).X({index:Ul,range:i},(s,a,c)=>{a.userId===this.userId&&(he(a.batchId>=t,47524,{er:t}),o=xl(this.serializer,a)),c.done()}).next(()=>o)}getHighestUnacknowledgedBatchId(e){let r=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),t=Gl;return La(e).X({index:Ul,range:r,reverse:!0},(i,o,s)=>{t=o.batchId,s.done()}).next(()=>t)}getAllMutationBatches(e){let r=IDBKeyRange.bound([this.userId,Gl],[this.userId,Number.POSITIVE_INFINITY]);return La(e).j(Ul,r).next(t=>t.map(i=>xl(this.serializer,i)))}getAllMutationBatchesAffectingDocumentKey(e,r){let t=Dv(this.userId,r.path),i=IDBKeyRange.lowerBound(t),o=[];return ch(e).X({range:i},(s,a,c)=>{let[l,u,d]=s,f=Bo(u);if(l===this.userId&&r.path.isEqual(f))return La(e).get(d).next(g=>{if(!g)throw ae(61480,{tr:s,batchId:d});he(g.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:g.userId,batchId:d}),o.push(xl(this.serializer,g))});c.done()}).next(()=>o)}getAllMutationBatchesAffectingDocumentKeys(e,r){let t=new at(Re),i=[];return r.forEach(o=>{let s=Dv(this.userId,o.path),a=IDBKeyRange.lowerBound(s),c=ch(e).X({range:a},(l,u,d)=>{let[f,g,p]=l,_=Bo(g);f===this.userId&&o.path.isEqual(_)?t=t.add(p):d.done()});i.push(c)}),B.waitFor(i).next(()=>this.nr(e,t))}getAllMutationBatchesAffectingQuery(e,r){let t=r.path,i=t.length+1,o=Dv(this.userId,t),s=IDBKeyRange.lowerBound(o),a=new at(Re);return ch(e).X({range:s},(c,l,u)=>{let[d,f,g]=c,p=Bo(f);d===this.userId&&t.isPrefixOf(p)?p.length===i&&(a=a.add(g)):u.done()}).next(()=>this.nr(e,a))}nr(e,r){let t=[],i=[];return r.forEach(o=>{i.push(La(e).get(o).next(s=>{if(s===null)throw ae(35274,{batchId:o});he(s.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:s.userId,batchId:o}),t.push(xl(this.serializer,s))}))}),B.waitFor(i).next(()=>t)}removeMutationBatch(e,r){return LW(e.ce,this.userId,r).next(t=>(e.addOnCommittedListener(()=>{this.rr(r.batchId)}),B.forEach(t,i=>this.referenceDelegate.markPotentiallyOrphaned(e,i))))}rr(e){delete this.Zn[e]}performConsistencyCheck(e){return this.checkEmpty(e).next(r=>{if(!r)return B.resolve();let t=IDBKeyRange.lowerBound((function(s){return[s]})(this.userId)),i=[];return ch(e).X({range:t},(o,s,a)=>{if(o[0]===this.userId){let c=Bo(o[1]);i.push(c)}else a.done()}).next(()=>{he(i.length===0,56720,{ir:i.map(o=>o.canonicalString())})})})}containsKey(e,r){return MW(e,this.userId,r)}sr(e){return PW(e).get(this.userId).next(r=>r||{userId:this.userId,lastAcknowledgedBatchId:Gl,lastStreamToken:""})}};function MW(n,e,r){let t=Dv(e,r.path),i=t[1],o=IDBKeyRange.lowerBound(t),s=!1;return ch(n).X({range:o,Z:!0},(a,c,l)=>{let[u,d,f]=a;u===e&&d===i&&(s=!0),l.done()}).next(()=>s)}function La(n){return yn(n,qi)}function ch(n){return yn(n,_h)}function PW(n){return yn(n,zm)}var wh=class n{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new n(0)}static ur(){return new n(-1)}};var Vb=class{constructor(e,r){this.referenceDelegate=e,this.serializer=r}allocateTargetId(e){return this.cr(e).next(r=>{let t=new wh(r.highestTargetId);return r.highestTargetId=t.next(),this.lr(e,r).next(()=>r.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.cr(e).next(r=>me.fromTimestamp(new Pt(r.lastRemoteSnapshotVersion.seconds,r.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.cr(e).next(r=>r.highestListenSequenceNumber)}setTargetsMetadata(e,r,t){return this.cr(e).next(i=>(i.highestListenSequenceNumber=r,t&&(i.lastRemoteSnapshotVersion=t.toTimestamp()),r>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=r),this.lr(e,i)))}addTargetData(e,r){return this.hr(e,r).next(()=>this.cr(e).next(t=>(t.targetCount+=1,this.Pr(r,t),this.lr(e,t))))}updateTargetData(e,r){return this.hr(e,r)}removeTargetData(e,r){return this.removeMatchingKeysForTargetId(e,r.targetId).next(()=>ih(e).delete(r.targetId)).next(()=>this.cr(e)).next(t=>(he(t.targetCount>0,8065),t.targetCount-=1,this.lr(e,t)))}removeTargets(e,r,t){let i=0,o=[];return ih(e).X((s,a)=>{let c=Mm(a);c.sequenceNumber<=r&&t.get(c.targetId)===null&&(i++,o.push(this.removeTargetData(e,c)))}).next(()=>B.waitFor(o)).next(()=>i)}forEachTarget(e,r){return ih(e).X((t,i)=>{let o=Mm(i);r(o)})}cr(e){return Xj(e).get(Bv).next(r=>(he(r!==null,2888),r))}lr(e,r){return Xj(e).put(Bv,r)}hr(e,r){return ih(e).put(CW(this.serializer,r))}Pr(e,r){let t=!1;return e.targetId>r.highestTargetId&&(r.highestTargetId=e.targetId,t=!0),e.sequenceNumber>r.highestListenSequenceNumber&&(r.highestListenSequenceNumber=e.sequenceNumber,t=!0),t}getTargetCount(e){return this.cr(e).next(r=>r.targetCount)}getTargetData(e,r){let t=zl(r),i=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Number.POSITIVE_INFINITY]),o=null;return ih(e).X({range:i,index:LH},(s,a,c)=>{let l=Mm(a);Ip(r,l.target)&&(o=l,c.done())}).next(()=>o)}addMatchingKeys(e,r,t){let i=[],o=xa(e);return r.forEach(s=>{let a=rr(s.path);i.push(o.put({targetId:t,path:a})),i.push(this.referenceDelegate.addReference(e,t,s))}),B.waitFor(i)}removeMatchingKeys(e,r,t){let i=xa(e);return B.forEach(r,o=>{let s=rr(o.path);return B.waitFor([i.delete([t,s]),this.referenceDelegate.removeReference(e,t,o)])})}removeMatchingKeysForTargetId(e,r){let t=xa(e),i=IDBKeyRange.bound([r],[r+1],!1,!0);return t.delete(i)}getMatchingKeysForTargetId(e,r){let t=IDBKeyRange.bound([r],[r+1],!1,!0),i=xa(e),o=Ve();return i.X({range:t,Z:!0},(s,a,c)=>{let l=Bo(s[1]),u=new ie(l);o=o.add(u)}).next(()=>o)}containsKey(e,r){let t=rr(r.path),i=IDBKeyRange.bound([t],[SH(t)],!1,!0),o=0;return xa(e).X({index:eM,Z:!0,range:i},([s,a],c,l)=>{s!==0&&(o++,l.done())}).next(()=>o>0)}Et(e,r){return ih(e).get(r).next(t=>t?Mm(t):null)}};function ih(n){return yn(n,Th)}function Xj(n){return yn(n,$l)}function xa(n){return yn(n,Ih)}var Jj="LruGarbageCollector",xW=1048576;function Zj([n,e],[r,t]){let i=Re(n,r);return i===0?Re(e,t):i}var Bb=class{constructor(e){this.Tr=e,this.buffer=new at(Zj),this.Ir=0}dr(){return++this.Ir}Er(e){let r=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(r);else{let t=this.buffer.last();Zj(r,t)<0&&(this.buffer=this.buffer.delete(t).add(r))}}get maxValue(){return this.buffer.last()[0]}},iy=class{constructor(e,r,t){this.garbageCollector=e,this.asyncQueue=r,this.localStore=t,this.Ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return this.Ar!==null}Rr(e){X(Jj,`Garbage collection scheduled in ${e}ms`),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,()=>I(this,null,function*(){this.Ar=null;try{yield this.localStore.collectGarbage(this.garbageCollector)}catch(r){Xa(r)?X(Jj,"Ignoring IndexedDB error during garbage collection: ",r):yield Qa(r)}yield this.Rr(3e5)}))}},Gb=class{constructor(e,r){this.Vr=e,this.params=r}calculateTargetCount(e,r){return this.Vr.mr(e).next(t=>Math.floor(r/100*t))}nthSequenceNumber(e,r){if(r===0)return B.resolve(Kr.ue);let t=new Bb(r);return this.Vr.forEachTarget(e,i=>t.Er(i.sequenceNumber)).next(()=>this.Vr.gr(e,i=>t.Er(i))).next(()=>t.maxValue)}removeTargets(e,r,t){return this.Vr.removeTargets(e,r,t)}removeOrphanedDocuments(e,r){return this.Vr.removeOrphanedDocuments(e,r)}collect(e,r){return this.params.cacheSizeCollectionThreshold===-1?(X("LruGarbageCollector","Garbage collection skipped; disabled"),B.resolve(Qj)):this.getCacheSize(e).next(t=>t<this.params.cacheSizeCollectionThreshold?(X("LruGarbageCollector",`Garbage collection skipped; Cache size ${t} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Qj):this.pr(e,r))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,r){let t,i,o,s,a,c,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(d=>(d>this.params.maximumSequenceNumbersToCollect?(X("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${d}`),i=this.params.maximumSequenceNumbersToCollect):i=d,s=Date.now(),this.nthSequenceNumber(e,i))).next(d=>(t=d,a=Date.now(),this.removeTargets(e,t,r))).next(d=>(o=d,c=Date.now(),this.removeOrphanedDocuments(e,t))).next(d=>(l=Date.now(),oh()<=Fe.DEBUG&&X("LruGarbageCollector",`LRU Garbage Collection
|
|
@@ -163,5 +163,5 @@ Total Duration: ${l-u}ms`),B.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
163
163
|
This 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._a?(Xt(r),this._a=!1):X("OnlineStateTracker",r)}ha(){this.oa!==null&&(this.oa.cancel(),this.oa=null)}};var Jl="RemoteStore",EL=class{constructor(e,r,t,i,o){this.localStore=e,this.datastore=r,this.asyncQueue=t,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=o,this.Ea.xo(s=>{t.enqueueAndForget(()=>I(this,null,function*(){nu(this)&&(X(Jl,"Restarting streams for network reachability change."),yield(function(c){return I(this,null,function*(){let l=de(c);l.Ia.add(4),yield Sp(l),l.Aa.set("Unknown"),l.Ia.delete(4),yield Uy(l)})})(this))}))}),this.Aa=new pL(t,i)}};function Uy(n){return I(this,null,function*(){if(nu(n))for(let e of n.da)yield e(!0)})}function Sp(n){return I(this,null,function*(){for(let e of n.da)yield e(!1)})}function Vy(n,e){let r=de(n);r.Ta.has(e.targetId)||(r.Ta.set(e.targetId,e),pM(r)?mM(r):Bh(r).x_()&&gM(r,e))}function Lh(n,e){let r=de(n),t=Bh(r);r.Ta.delete(e),t.x_()&&YW(r,e),r.Ta.size===0&&(t.x_()?t.B_():nu(r)&&r.Aa.set("Unknown"))}function gM(n,e){if(n.Ra.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(me.min())>0){let r=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(r)}Bh(n).H_(e)}function YW(n,e){n.Ra.$e(e),Bh(n).Y_(e)}function mM(n){n.Ra=new Sb({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),Et:e=>n.Ta.get(e)||null,lt:()=>n.datastore.serializer.databaseId}),Bh(n).start(),n.Aa.aa()}function pM(n){return nu(n)&&!Bh(n).M_()&&n.Ta.size>0}function nu(n){return de(n).Ia.size===0}function QW(n){n.Ra=void 0}function Eoe(n){return I(this,null,function*(){n.Aa.set("Online")})}function _oe(n){return I(this,null,function*(){n.Ta.forEach((e,r)=>{gM(n,e)})})}function Toe(n,e){return I(this,null,function*(){QW(n),pM(n)?(n.Aa.la(e),mM(n)):n.Aa.set("Unknown")})}function Ioe(n,e,r){return I(this,null,function*(){if(n.Aa.set("Online"),e instanceof Yv&&e.state===2&&e.cause)try{yield(function(i,o){return I(this,null,function*(){let s=o.cause;for(let a of o.targetIds)i.Ta.has(a)&&(yield i.remoteSyncer.rejectListen(a,s),i.Ta.delete(a),i.Ra.removeTarget(a))})})(n,e)}catch(t){X(Jl,"Failed to remove targets %s: %s ",e.targetIds.join(","),t),yield py(n,t)}else if(e instanceof hh?n.Ra.Ye(e):e instanceof Kv?n.Ra.it(e):n.Ra.et(e),!r.isEqual(me.min()))try{let t=yield GW(n.localStore);r.compareTo(t)>=0&&(yield(function(o,s){let a=o.Ra.Pt(s);return a.targetChanges.forEach((c,l)=>{if(c.resumeToken.approximateByteSize()>0){let u=o.Ta.get(l);u&&o.Ta.set(l,u.withResumeToken(c.resumeToken,s))}}),a.targetMismatches.forEach((c,l)=>{let u=o.Ta.get(c);if(!u)return;o.Ta.set(c,u.withResumeToken(un.EMPTY_BYTE_STRING,u.snapshotVersion)),YW(o,c);let d=new Oh(u.target,c,l,u.sequenceNumber);gM(o,d)}),o.remoteSyncer.applyRemoteEvent(a)})(n,r))}catch(t){X(Jl,"Failed to raise snapshot:",t),yield py(n,t)}})}function py(n,e,r){return I(this,null,function*(){if(!Xa(e))throw e;n.Ia.add(1),yield Sp(n),n.Aa.set("Offline"),r||(r=()=>GW(n.localStore)),n.asyncQueue.enqueueRetryable(()=>I(null,null,function*(){X(Jl,"Retrying IndexedDB access"),yield r(),n.Ia.delete(1),yield Uy(n)}))})}function XW(n,e){return e().catch(r=>py(n,r,e))}function Vh(n){return I(this,null,function*(){let e=de(n),r=Ka(e),t=e.Pa.length>0?e.Pa[e.Pa.length-1].batchId:Gl;for(;voe(e);)try{let i=yield moe(e.localStore,t);if(i===null){e.Pa.length===0&&r.B_();break}t=i.batchId,yoe(e,i)}catch(i){yield py(e,i)}JW(e)&&ZW(e)})}function voe(n){return nu(n)&&n.Pa.length<10}function yoe(n,e){n.Pa.push(e);let r=Ka(n);r.x_()&&r.Z_&&r.X_(e.mutations)}function JW(n){return nu(n)&&!Ka(n).M_()&&n.Pa.length>0}function ZW(n){Ka(n).start()}function Soe(n){return I(this,null,function*(){Ka(n).na()})}function Aoe(n){return I(this,null,function*(){let e=Ka(n);for(let r of n.Pa)e.X_(r.mutations)})}function Doe(n,e,r){return I(this,null,function*(){let t=n.Pa.shift(),i=Tb.from(t,e,r);yield XW(n,()=>n.remoteSyncer.applySuccessfulWrite(i)),yield Vh(n)})}function Roe(n,e){return I(this,null,function*(){e&&Ka(n).Z_&&(yield(function(t,i){return I(this,null,function*(){if((function(s){return mW(s)&&s!==j.ABORTED})(i.code)){let o=t.Pa.shift();Ka(t).N_(),yield XW(t,()=>t.remoteSyncer.rejectFailedWrite(o.batchId,i)),yield Vh(t)}})})(n,e)),JW(n)&&ZW(n)})}function cH(n,e){return I(this,null,function*(){let r=de(n);r.asyncQueue.verifyOperationInProgress(),X(Jl,"RemoteStore received new credentials");let t=nu(r);r.Ia.add(3),yield Sp(r),t&&r.Aa.set("Unknown"),yield r.remoteSyncer.handleCredentialChange(e),r.Ia.delete(3),yield Uy(r)})}function _L(n,e){return I(this,null,function*(){let r=de(n);e?(r.Ia.delete(2),yield Uy(r)):e||(r.Ia.add(2),yield Sp(r),r.Aa.set("Unknown"))})}function Bh(n){return n.Va||(n.Va=(function(r,t,i){let o=de(r);return o.ia(),new hL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:Eoe.bind(null,n),e_:_oe.bind(null,n),n_:Toe.bind(null,n),J_:Ioe.bind(null,n)}),n.da.push(e=>I(null,null,function*(){e?(n.Va.N_(),pM(n)?mM(n):n.Aa.set("Unknown")):(yield n.Va.stop(),QW(n))}))),n.Va}function Ka(n){return n.ma||(n.ma=(function(r,t,i){let o=de(r);return o.ia(),new fL(t,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:()=>Promise.resolve(),e_:Soe.bind(null,n),n_:Roe.bind(null,n),ea:Aoe.bind(null,n),ta:Doe.bind(null,n)}),n.da.push(e=>I(null,null,function*(){e?(n.ma.N_(),yield Vh(n)):(yield n.ma.stop(),n.Pa.length>0&&(X(Jl,`Stopping write stream with ${n.Pa.length} pending writes`),n.Pa=[]))}))),n.ma}var TL=class n{constructor(e,r,t,i,o){this.asyncQueue=e,this.timerId=r,this.targetTimeMs=t,this.op=i,this.removalCallback=o,this.deferred=new Or,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(s=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,r,t,i,o){let s=Date.now()+t,a=new n(e,r,s,i,o);return a.start(t),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new Q(j.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function EM(n,e){if(Xt("AsyncQueue",`${e}: ${n}`),Xa(n))return new Q(j.UNAVAILABLE,`${e}: ${n}`);throw n}var Ey=class n{static emptySet(e){return new n(e.comparator)}constructor(e){this.comparator=e?(r,t)=>e(r,t)||ie.comparator(r.key,t.key):(r,t)=>ie.comparator(r.key,t.key),this.keyedMap=Lm(),this.sortedSet=new Dt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let r=this.keyedMap.get(e);return r?this.sortedSet.indexOf(r):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((r,t)=>(e(r),!1))}add(e){let r=this.delete(e.key);return r.copy(r.keyedMap.insert(e.key,e),r.sortedSet.insert(e,null))}delete(e){let r=this.get(e);return r?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(r)):this}isEqual(e){if(!(e instanceof n)||this.size!==e.size)return!1;let r=this.sortedSet.getIterator(),t=e.sortedSet.getIterator();for(;r.hasNext();){let i=r.getNext().key,o=t.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){let e=[];return this.forEach(r=>{e.push(r.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
|
|
164
164
|
`+e.join(`
|
|
165
165
|
`)+`
|
|
166
|
-
)`}copy(e,r){let t=new n;return t.comparator=this.comparator,t.keyedMap=e,t.sortedSet=r,t}};var _y=class{constructor(){this.fa=new Dt(ie.comparator)}track(e){let r=e.doc.key,t=this.fa.get(r);t?e.type!==0&&t.type===3?this.fa=this.fa.insert(r,e):e.type===3&&t.type!==1?this.fa=this.fa.insert(r,{type:t.type,doc:e.doc}):e.type===2&&t.type===2?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):e.type===2&&t.type===0?this.fa=this.fa.insert(r,{type:0,doc:e.doc}):e.type===1&&t.type===0?this.fa=this.fa.remove(r):e.type===1&&t.type===2?this.fa=this.fa.insert(r,{type:1,doc:t.doc}):e.type===0&&t.type===1?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):ae(63341,{At:e,ga:t}):this.fa=this.fa.insert(r,e)}pa(){let e=[];return this.fa.inorderTraversal((r,t)=>{e.push(t)}),e}},Mh=class n{constructor(e,r,t,i,o,s,a,c,l){this.query=e,this.docs=r,this.oldDocs=t,this.docChanges=i,this.mutatedKeys=o,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,r,t,i,o){let s=[];return r.forEach(a=>{s.push({type:0,doc:a})}),new n(e,r,Ey.emptySet(r),s,t,i,!0,!1,o)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Fy(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let r=this.docChanges,t=e.docChanges;if(r.length!==t.length)return!1;for(let i=0;i<r.length;i++)if(r[i].type!==t[i].type||!r[i].doc.isEqual(t[i].doc))return!1;return!0}};var IL=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}},vL=class{constructor(){this.queries=lH(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(r,t){let i=de(r),o=i.queries;i.queries=lH(),o.forEach((s,a)=>{for(let c of a.wa)c.onError(t)})})(this,new Q(j.ABORTED,"Firestore shutting down"))}};function lH(){return new Ki(n=>nW(n),Fy)}function _M(n,e){return I(this,null,function*(){let r=de(n),t=3,i=e.query,o=r.queries.get(i);o?!o.Sa()&&e.ba()&&(t=2):(o=new IL,t=e.ba()?0:1);try{switch(t){case 0:o.ya=yield r.onListen(i,!0);break;case 1:o.ya=yield r.onListen(i,!1);break;case 2:yield r.onFirstRemoteStoreListen(i)}}catch(s){let a=EM(s,`Initialization of query '${sh(e.query)}' failed`);return void e.onError(a)}r.queries.set(i,o),o.wa.push(e),e.va(r.onlineState),o.ya&&e.Ca(o.ya)&&IM(r)})}function TM(n,e){return I(this,null,function*(){let r=de(n),t=e.query,i=3,o=r.queries.get(t);if(o){let s=o.wa.indexOf(e);s>=0&&(o.wa.splice(s,1),o.wa.length===0?i=e.ba()?0:1:!o.Sa()&&e.ba()&&(i=2))}switch(i){case 0:return r.queries.delete(t),r.onUnlisten(t,!0);case 1:return r.queries.delete(t),r.onUnlisten(t,!1);case 2:return r.onLastRemoteStoreUnlisten(t);default:return}})}function Coe(n,e){let r=de(n),t=!1;for(let i of e){let o=i.query,s=r.queries.get(o);if(s){for(let a of s.wa)a.Ca(i)&&(t=!0);s.ya=i}}t&&IM(r)}function Noe(n,e,r){let t=de(n),i=t.queries.get(e);if(i)for(let o of i.wa)o.onError(r);t.queries.delete(e)}function IM(n){n.Da.forEach(e=>{e.next()})}var yL,uH;(uH=yL||(yL={})).Fa="default",uH.Cache="cache";var hp=class{constructor(e,r,t){this.query=e,this.Ma=r,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=t||{}}Ca(e){if(!this.options.includeMetadataChanges){let t=[];for(let i of e.docChanges)i.type!==3&&t.push(i);e=new Mh(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let r=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),r=!0):this.Ba(e,this.onlineState)&&(this.La(e),r=!0),this.Oa=e,r}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let r=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),r=!0),r}Ba(e,r){if(!e.fromCache||!this.ba())return!0;let t=r!=="Offline";return(!this.options.ka||!t)&&(!e.docs.isEmpty()||e.hasCachedResults||r==="Offline")}Na(e){if(e.docChanges.length>0)return!0;let r=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}La(e){e=Mh.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==yL.Cache}};var Ty=class{constructor(e){this.key=e}},Iy=class{constructor(e){this.key=e}},SL=class{constructor(e,r){this.query=e,this.Ha=r,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=Ve(),this.mutatedKeys=Ve(),this.Xa=iW(e),this.eu=new Ey(this.Xa)}get tu(){return this.Ha}nu(e,r){let t=r?r.ru:new _y,i=r?r.eu:this.eu,o=r?r.mutatedKeys:this.mutatedKeys,s=i,a=!1,c=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,l=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((u,d)=>{let f=i.get(u),g=yp(this.query,d)?d:null,p=!!f&&this.mutatedKeys.has(f.key),_=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations),T=!1;f&&g?f.data.isEqual(g.data)?p!==_&&(t.track({type:3,doc:g}),T=!0):this.iu(f,g)||(t.track({type:2,doc:g}),T=!0,(c&&this.Xa(g,c)>0||l&&this.Xa(g,l)<0)&&(a=!0)):!f&&g?(t.track({type:0,doc:g}),T=!0):f&&!g&&(t.track({type:1,doc:f}),T=!0,(c||l)&&(a=!0)),T&&(g?(s=s.add(g),o=_?o.add(u):o.delete(u)):(s=s.delete(u),o=o.delete(u)))}),this.query.limit!==null)for(;s.size>this.query.limit;){let u=this.query.limitType==="F"?s.last():s.first();s=s.delete(u.key),o=o.delete(u.key),t.track({type:1,doc:u})}return{eu:s,ru:t,Ds:a,mutatedKeys:o}}iu(e,r){return e.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(e,r,t,i){let o=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;let s=e.ru.pa();s.sort((u,d)=>(function(g,p){let _=T=>{switch(T){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ae(20277,{At:T})}};return _(g)-_(p)})(u.type,d.type)||this.Xa(u.doc,d.doc)),this.su(t),i=i!=null&&i;let a=r&&!i?this.ou():[],c=this.Za.size===0&&this.current&&!i?1:0,l=c!==this.Ya;return this.Ya=c,s.length!==0||l?{snapshot:new Mh(this.query,e.eu,o,s,e.mutatedKeys,c===0,l,!1,!!t&&t.resumeToken.approximateByteSize()>0),_u:a}:{_u:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new _y,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(r=>this.Ha=this.Ha.add(r)),e.modifiedDocuments.forEach(r=>{}),e.removedDocuments.forEach(r=>this.Ha=this.Ha.delete(r)),this.current=e.current)}ou(){if(!this.current)return[];let e=this.Za;this.Za=Ve(),this.eu.forEach(t=>{this.au(t.key)&&(this.Za=this.Za.add(t.key))});let r=[];return e.forEach(t=>{this.Za.has(t)||r.push(new Iy(t))}),this.Za.forEach(t=>{e.has(t)||r.push(new Ty(t))}),r}uu(e){this.Ha=e.qs,this.Za=Ve();let r=this.nu(e.documents);return this.applyChanges(r,!0)}cu(){return Mh.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},Gh="SyncEngine",AL=class{constructor(e,r,t){this.query=e,this.targetId=r,this.view=t}},DL=class{constructor(e){this.key=e,this.lu=!1}},RL=class{constructor(e,r,t,i,o,s){this.localStore=e,this.remoteStore=r,this.eventManager=t,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new Ki(a=>nW(a),Fy),this.Tu=new Map,this.Iu=new Set,this.du=new Dt(ie.comparator),this.Eu=new Map,this.Au=new cp,this.Ru={},this.Vu=new Map,this.mu=wh.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function Ooe(n,e,r=!0){return I(this,null,function*(){let t=By(n),i,o=t.Pu.get(e);return o?(t.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield e3(t,e,r,!0),i})}function woe(n,e){return I(this,null,function*(){let r=By(n);yield e3(r,e,!0,!1)})}function e3(n,e,r,t){return I(this,null,function*(){let i=yield uy(n.localStore,Xr(e)),o=i.targetId,s=n.sharedClientState.addLocalQueryTarget(o,r),a;return t&&(a=yield vM(n,e,o,s==="current",i.resumeToken)),n.isPrimaryClient&&r&&Vy(n.remoteStore,i),a})}function vM(n,e,r,t,i){return I(this,null,function*(){n.gu=(d,f,g)=>(function(_,T,D,b){return I(this,null,function*(){let G=T.view.nu(D);G.Ds&&(G=yield oL(_.localStore,T.query,!1).then(({documents:S})=>T.view.nu(S,G)));let M=b&&b.targetChanges.get(T.targetId),U=b&&b.targetMismatches.get(T.targetId)!=null,k=T.view.applyChanges(G,_.isPrimaryClient,M,U);return CL(_,T.targetId,k._u),k.snapshot})})(n,d,f,g);let o=yield oL(n.localStore,e,!0),s=new SL(e,o.qs),a=s.nu(o.documents),c=ip.createSynthesizedTargetChangeForCurrentChange(r,t&&n.onlineState!=="Offline",i),l=s.applyChanges(a,n.isPrimaryClient,c);CL(n,r,l._u);let u=new AL(e,r,s);return n.Pu.set(e,u),n.Tu.has(r)?n.Tu.get(r).push(e):n.Tu.set(r,[e]),l.snapshot})}function boe(n,e,r){return I(this,null,function*(){let t=de(n),i=t.Pu.get(e),o=t.Tu.get(i.targetId);if(o.length>1)return t.Tu.set(i.targetId,o.filter(s=>!Fy(s,e))),void t.Pu.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(i.targetId),t.sharedClientState.isActiveQueryTarget(i.targetId)||(yield bh(t.localStore,i.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(i.targetId),r&&Lh(t.remoteStore,i.targetId),Ph(t,i.targetId)}).catch(Qa))):(Ph(t,i.targetId),yield bh(t.localStore,i.targetId,!0))})}function Loe(n,e){return I(this,null,function*(){let r=de(n),t=r.Pu.get(e),i=r.Tu.get(t.targetId);r.isPrimaryClient&&i.length===1&&(r.sharedClientState.removeLocalQueryTarget(t.targetId),Lh(r.remoteStore,t.targetId))})}function Moe(n,e,r){return I(this,null,function*(){let t=DM(n);try{let i=yield(function(s,a){let c=de(s),l=Pt.now(),u=a.reduce((g,p)=>g.add(p.key),Ve()),d,f;return c.persistence.runTransaction("Locally write mutations","readwrite",g=>{let p=Qr(),_=Ve();return c.Os.getEntries(g,u).next(T=>{p=T,p.forEach((D,b)=>{b.isValidDocument()||(_=_.add(D))})}).next(()=>c.localDocuments.getOverlayedDocuments(g,p)).next(T=>{d=T;let D=[];for(let b of a){let G=Wie(b,d.get(b.key).overlayedDocument);G!=null&&D.push(new Yi(b.key,G,KH(G.value.mapValue),Gn.exists(!0)))}return c.mutationQueue.addMutationBatch(g,l,D,a)}).next(T=>{f=T;let D=T.applyToLocalDocumentSet(d,_);return c.documentOverlayCache.saveOverlays(g,T.batchId,D)})}).then(()=>({batchId:f.batchId,changes:sW(d)}))})(t.localStore,e);t.sharedClientState.addPendingMutation(i.batchId),(function(s,a,c){let l=s.Ru[s.currentUser.toKey()];l||(l=new Dt(Re)),l=l.insert(a,c),s.Ru[s.currentUser.toKey()]=l})(t,i.batchId,r),yield Za(t,i.changes),yield Vh(t.remoteStore)}catch(i){let o=EM(i,"Failed to persist write");r.reject(o)}})}function t3(n,e){return I(this,null,function*(){let r=de(n);try{let t=yield foe(r.localStore,e);e.targetChanges.forEach((i,o)=>{let s=r.Eu.get(o);s&&(he(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?s.lu=!0:i.modifiedDocuments.size>0?he(s.lu,14607):i.removedDocuments.size>0&&(he(s.lu,42227),s.lu=!1))}),yield Za(r,t,e)}catch(t){yield Qa(t)}})}function dH(n,e,r){let t=de(n);if(t.isPrimaryClient&&r===0||!t.isPrimaryClient&&r===1){let i=[];t.Pu.forEach((o,s)=>{let a=s.view.va(e);a.snapshot&&i.push(a.snapshot)}),(function(s,a){let c=de(s);c.onlineState=a;let l=!1;c.queries.forEach((u,d)=>{for(let f of d.wa)f.va(a)&&(l=!0)}),l&&IM(c)})(t.eventManager,e),i.length&&t.hu.J_(i),t.onlineState=e,t.isPrimaryClient&&t.sharedClientState.setOnlineState(e)}}function Poe(n,e,r){return I(this,null,function*(){let t=de(n);t.sharedClientState.updateQueryState(e,"rejected",r);let i=t.Eu.get(e),o=i&&i.key;if(o){let s=new Dt(ie.comparator);s=s.insert(o,In.newNoDocument(o,me.min()));let a=Ve().add(o),c=new rp(me.min(),new Map,new Dt(Re),s,a);yield t3(t,c),t.du=t.du.remove(o),t.Eu.delete(e),AM(t)}else yield bh(t.localStore,e,!1).then(()=>Ph(t,e,r)).catch(Qa)})}function xoe(n,e){return I(this,null,function*(){let r=de(n),t=e.batch.batchId;try{let i=yield hoe(r.localStore,e);SM(r,t,null),yM(r,t),r.sharedClientState.updateMutationState(t,"acknowledged"),yield Za(r,i)}catch(i){yield Qa(i)}})}function Foe(n,e,r){return I(this,null,function*(){let t=de(n);try{let i=yield(function(s,a){let c=de(s);return c.persistence.runTransaction("Reject batch","readwrite-primary",l=>{let u;return c.mutationQueue.lookupMutationBatch(l,a).next(d=>(he(d!==null,37113),u=d.keys(),c.mutationQueue.removeMutationBatch(l,d))).next(()=>c.mutationQueue.performConsistencyCheck(l)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(l,u,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(l,u)).next(()=>c.localDocuments.getDocuments(l,u))})})(t.localStore,e);SM(t,e,r),yM(t,e),t.sharedClientState.updateMutationState(e,"rejected",r),yield Za(t,i)}catch(i){yield Qa(i)}})}function yM(n,e){(n.Vu.get(e)||[]).forEach(r=>{r.resolve()}),n.Vu.delete(e)}function SM(n,e,r){let t=de(n),i=t.Ru[t.currentUser.toKey()];if(i){let o=i.get(e);o&&(r?o.reject(r):o.resolve(),i=i.remove(e)),t.Ru[t.currentUser.toKey()]=i}}function Ph(n,e,r=null){n.sharedClientState.removeLocalQueryTarget(e);for(let t of n.Tu.get(e))n.Pu.delete(t),r&&n.hu.pu(t,r);n.Tu.delete(e),n.isPrimaryClient&&n.Au.zr(e).forEach(t=>{n.Au.containsKey(t)||n3(n,t)})}function n3(n,e){n.Iu.delete(e.path.canonicalString());let r=n.du.get(e);r!==null&&(Lh(n.remoteStore,r),n.du=n.du.remove(e),n.Eu.delete(r),AM(n))}function CL(n,e,r){for(let t of r)t instanceof Ty?(n.Au.addReference(t.key,e),koe(n,t)):t instanceof Iy?(X(Gh,"Document no longer in limbo: "+t.key),n.Au.removeReference(t.key,e),n.Au.containsKey(t.key)||n3(n,t.key)):ae(19791,{yu:t})}function koe(n,e){let r=e.key,t=r.path.canonicalString();n.du.get(r)||n.Iu.has(t)||(X(Gh,"New document in limbo: "+r),n.Iu.add(t),AM(n))}function AM(n){for(;n.Iu.size>0&&n.du.size<n.maxConcurrentLimboResolutions;){let e=n.Iu.values().next().value;n.Iu.delete(e);let r=new ie(We.fromString(e)),t=n.mu.next();n.Eu.set(t,new DL(r)),n.du=n.du.insert(r,t),Vy(n.remoteStore,new Oh(Xr(vp(r.path)),t,"TargetPurposeLimboResolution",Kr.ue))}}function Za(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[],s=[];t.Pu.isEmpty()||(t.Pu.forEach((a,c)=>{s.push(t.gu(c,e,r).then(l=>{var u;if((l||r)&&t.isPrimaryClient){let d=l?!l.fromCache:(u=r?.targetChanges.get(c.targetId))===null||u===void 0?void 0:u.current;t.sharedClientState.updateQueryState(c.targetId,d?"current":"not-current")}if(l){i.push(l);let d=nL.Es(c.targetId,l);o.push(d)}}))}),yield Promise.all(s),t.hu.J_(i),yield(function(c,l){return I(this,null,function*(){let u=de(c);try{yield u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>B.forEach(l,f=>B.forEach(f.Is,g=>u.persistence.referenceDelegate.addReference(d,f.targetId,g)).next(()=>B.forEach(f.ds,g=>u.persistence.referenceDelegate.removeReference(d,f.targetId,g)))))}catch(d){if(!Xa(d))throw d;X(fM,"Failed to update sequence numbers: "+d)}for(let d of l){let f=d.targetId;if(!d.fromCache){let g=u.Fs.get(f),p=g.snapshotVersion,_=g.withLastLimboFreeSnapshotVersion(p);u.Fs=u.Fs.insert(f,_)}}})})(t.localStore,o))})}function Uoe(n,e){return I(this,null,function*(){let r=de(n);if(!r.currentUser.isEqual(e)){X(Gh,"User change. New user:",e.toKey());let t=yield BW(r.localStore,e);r.currentUser=e,(function(o,s){o.Vu.forEach(a=>{a.forEach(c=>{c.reject(new Q(j.CANCELLED,s))})}),o.Vu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),yield Za(r,t.Bs)}})}function Voe(n,e){let r=de(n),t=r.Eu.get(e);if(t&&t.lu)return Ve().add(t.key);{let i=Ve(),o=r.Tu.get(e);if(!o)return i;for(let s of o){let a=r.Pu.get(s);i=i.unionWith(a.view.tu)}return i}}function Boe(n,e){return I(this,null,function*(){let r=de(n),t=yield oL(r.localStore,e.query,!0),i=e.view.uu(t);return r.isPrimaryClient&&CL(r,e.targetId,i._u),i})}function Goe(n,e){return I(this,null,function*(){let r=de(n);return jW(r.localStore,e).then(t=>Za(r,t))})}function $oe(n,e,r,t){return I(this,null,function*(){let i=de(n),o=yield(function(a,c){let l=de(a),u=de(l.mutationQueue);return l.persistence.runTransaction("Lookup mutation documents","readonly",d=>u.Xn(d,c).next(f=>f?l.localDocuments.getDocuments(d,f):B.resolve(null)))})(i.localStore,e);o!==null?(r==="pending"?yield Vh(i.remoteStore):r==="acknowledged"||r==="rejected"?(SM(i,e,t||null),yM(i,e),(function(a,c){de(de(a).mutationQueue).rr(c)})(i.localStore,e)):ae(6720,"Unknown batchState",{wu:r}),yield Za(i,o)):X(Gh,"Cannot apply mutation batch with id: "+e)})}function joe(n,e){return I(this,null,function*(){let r=de(n);if(By(r),DM(r),e===!0&&r.fu!==!0){let t=r.sharedClientState.getAllActiveQueryTargets(),i=yield hH(r,t.toArray());r.fu=!0,yield _L(r.remoteStore,!0);for(let o of i)Vy(r.remoteStore,o)}else if(e===!1&&r.fu!==!1){let t=[],i=Promise.resolve();r.Tu.forEach((o,s)=>{r.sharedClientState.isLocalQueryTarget(s)?t.push(s):i=i.then(()=>(Ph(r,s),bh(r.localStore,s,!0))),Lh(r.remoteStore,s)}),yield i,yield hH(r,t),(function(s){let a=de(s);a.Eu.forEach((c,l)=>{Lh(a.remoteStore,l)}),a.Au.jr(),a.Eu=new Map,a.du=new Dt(ie.comparator)})(r),r.fu=!1,yield _L(r.remoteStore,!1)}})}function hH(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[];for(let s of e){let a,c=t.Tu.get(s);if(c&&c.length!==0){a=yield uy(t.localStore,Xr(c[0]));for(let l of c){let u=t.Pu.get(l),d=yield Boe(t,u);d.snapshot&&o.push(d.snapshot)}}else{let l=yield $W(t.localStore,s);a=yield uy(t.localStore,l),yield vM(t,r3(l),s,!1,a.resumeToken)}i.push(a)}return t.hu.J_(o),i})}function r3(n){return eW(n.path,n.collectionGroup,n.orderBy,n.filters,n.limit,"F",n.startAt,n.endAt)}function Hoe(n){return(function(r){return de(de(r).persistence).Ps()})(de(n).localStore)}function Woe(n,e,r,t){return I(this,null,function*(){let i=de(n);if(i.fu)return void X(Gh,"Ignoring unexpected query state notification.");let o=i.Tu.get(e);if(o&&o.length>0)switch(r){case"current":case"not-current":{let s=yield jW(i.localStore,rW(o[0])),a=rp.createSynthesizedRemoteEventForCurrentChange(e,r==="current",un.EMPTY_BYTE_STRING);yield Za(i,s,a);break}case"rejected":yield bh(i.localStore,e,!0),Ph(i,e,t);break;default:ae(64155,r)}})}function zoe(n,e,r){return I(this,null,function*(){let t=By(n);if(t.fu){for(let i of e){if(t.Tu.has(i)&&t.sharedClientState.isActiveQueryTarget(i)){X(Gh,"Adding an already active target "+i);continue}let o=yield $W(t.localStore,i),s=yield uy(t.localStore,o);yield vM(t,r3(o),s.targetId,!1,s.resumeToken),Vy(t.remoteStore,s)}for(let i of r)t.Tu.has(i)&&(yield bh(t.localStore,i,!1).then(()=>{Lh(t.remoteStore,i),Ph(t,i)}).catch(Qa))}})}function By(n){let e=de(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=t3.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Voe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Poe.bind(null,e),e.hu.J_=Coe.bind(null,e.eventManager),e.hu.pu=Noe.bind(null,e.eventManager),e}function DM(n){let e=de(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=xoe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Foe.bind(null,e),e}var RM=(()=>{class n{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(r){return I(this,null,function*(){this.serializer=ky(r.databaseInfo.databaseId),this.sharedClientState=this.bu(r),this.persistence=this.Du(r),yield this.persistence.start(),this.localStore=this.vu(r),this.gcScheduler=this.Cu(r,this.localStore),this.indexBackfillerScheduler=this.Fu(r,this.localStore)})}Cu(r,t){return null}Fu(r,t){return null}vu(r){return VW(this.persistence,new ly,r.initialUser,this.serializer)}Du(r){return new lp(ay.Vi,this.serializer)}bu(r){return new fy}terminate(){return I(this,null,function*(){var r,t;(r=this.gcScheduler)===null||r===void 0||r.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return n.provider={build:()=>new n},n})(),NL=class extends RM{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,r){he(this.persistence.referenceDelegate instanceof cy,46915);let t=this.persistence.referenceDelegate.garbageCollector;return new iy(t,e.asyncQueue,r)}Du(e){let r=this.cacheSizeBytes!==void 0?Nr.withCacheSize(this.cacheSizeBytes):Nr.DEFAULT;return new lp(t=>cy.Vi(t,r),this.serializer)}},vy=class n extends RM{constructor(e,r,t){super(),this.Mu=e,this.cacheSizeBytes=r,this.forceOwnership=t,this.kind="persistent",this.synchronizeTabs=!1}initialize(e){return I(this,null,function*(){yield pc(n.prototype,this,"initialize").call(this,e),yield this.Mu.initialize(this,e),yield DM(this.Mu.syncEngine),yield Vh(this.Mu.remoteStore),yield this.persistence.ji(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))})}vu(e){return VW(this.persistence,new ly,e.initialUser,this.serializer)}Cu(e,r){let t=this.persistence.referenceDelegate.garbageCollector;return new iy(t,e.asyncQueue,r)}Fu(e,r){let t=new Zw(r,this.persistence);return new Jw(e.asyncQueue,t)}Du(e){let r=UW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),t=this.cacheSizeBytes!==void 0?Nr.withCacheSize(this.cacheSizeBytes):Nr.DEFAULT;return new tL(this.synchronizeTabs,r,e.clientId,t,e.asyncQueue,KW(),Lv(),this.serializer,this.sharedClientState,!!this.forceOwnership)}bu(e){return new fy}},OL=class n extends vy{constructor(e,r){super(e,r,!1),this.Mu=e,this.cacheSizeBytes=r,this.synchronizeTabs=!0}initialize(e){return I(this,null,function*(){yield pc(n.prototype,this,"initialize").call(this,e);let r=this.Mu.syncEngine;this.sharedClientState instanceof $m&&(this.sharedClientState.syncEngine={Do:$oe.bind(null,r),vo:Woe.bind(null,r),Co:zoe.bind(null,r),Ps:Hoe.bind(null,r),bo:Goe.bind(null,r)},yield this.sharedClientState.start()),yield this.persistence.ji(t=>I(this,null,function*(){yield joe(this.Mu.syncEngine,t),this.gcScheduler&&(t&&!this.gcScheduler.started?this.gcScheduler.start():t||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(t&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():t||this.indexBackfillerScheduler.stop())}))})}bu(e){let r=KW();if(!$m.C(r))throw new Q(j.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let t=UW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new $m(r,e.asyncQueue,t,e.clientId,e.initialUser)}},CM=(()=>{class n{initialize(r,t){return I(this,null,function*(){this.localStore||(this.localStore=r.localStore,this.sharedClientState=r.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!r.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>dH(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=Uoe.bind(null,this.syncEngine),yield _L(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(r){return(function(){return new vL})()}createDatastore(r){let t=ky(r.databaseInfo.databaseId),i=(function(s){return new dL(s)})(r.databaseInfo);return(function(s,a,c,l){return new mL(s,a,c,l)})(r.authCredentials,r.appCheckCredentials,i,t)}createRemoteStore(r){return(function(i,o,s,a,c){return new EL(i,o,s,a,c)})(this.localStore,this.datastore,r.asyncQueue,t=>dH(this.syncEngine,t,0),(function(){return gy.C()?new gy:new aL})())}createSyncEngine(r,t){return(function(o,s,a,c,l,u,d){let f=new RL(o,s,a,c,l,u);return d&&(f.fu=!0),f})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,r.initialUser,r.maxConcurrentLimboResolutions,t)}terminate(){return I(this,null,function*(){var r,t;yield(function(o){return I(this,null,function*(){let s=de(o);X(Jl,"RemoteStore shutting down."),s.Ia.add(5),yield Sp(s),s.Ea.shutdown(),s.Aa.set("Unknown")})})(this.remoteStore),(r=this.datastore)===null||r===void 0||r.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()})}}return n.provider={build:()=>new n},n})();var fp=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):Xt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,r){setTimeout(()=>{this.muted||e(r)},0)}};var wL=class{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}lookup(e){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new Q(j.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let r=yield(function(i,o){return I(this,null,function*(){let s=de(i),a={documents:o.map(d=>op(s.serializer,d))},c=yield s.Jo("BatchGetDocuments",s.serializer.databaseId,We.emptyPath(),a,o.length),l=new Map;c.forEach(d=>{let f=Jie(s.serializer,d);l.set(f.key.toString(),f)});let u=[];return o.forEach(d=>{let f=l.get(d.toString());he(!!f,55234,{key:d}),u.push(f)}),u})})(this.datastore,e);return r.forEach(t=>this.recordVersion(t)),r})}set(e,r){this.write(r.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,r){try{this.write(r.toMutation(e,this.preconditionForUpdate(e)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(e.toString())}delete(e){this.write(new Yl(e,this.precondition(e))),this.writtenDocs.add(e.toString())}commit(){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;let e=this.readVersions;this.mutations.forEach(r=>{e.delete(r.key.toString())}),e.forEach((r,t)=>{let i=ie.fromPath(t);this.mutations.push(new ep(i,this.precondition(i)))}),yield(function(t,i){return I(this,null,function*(){let o=de(t),s={writes:i.map(a=>sp(o.serializer,a))};yield o.Wo("Commit",o.serializer.databaseId,We.emptyPath(),s)})})(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let r;if(e.isFoundDocument())r=e.version;else{if(!e.isNoDocument())throw ae(50498,{Wu:e.constructor.name});r=me.min()}let t=this.readVersions.get(e.key.toString());if(t){if(!r.isEqual(t))throw new Q(j.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),r)}precondition(e){let r=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&r?r.isEqual(me.min())?Gn.exists(!1):Gn.updateTime(r):Gn.none()}preconditionForUpdate(e){let r=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&r){if(r.isEqual(me.min()))throw new Q(j.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Gn.updateTime(r)}return Gn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var bL=class{constructor(e,r,t,i,o){this.asyncQueue=e,this.datastore=r,this.options=t,this.updateFunction=i,this.deferred=o,this.Gu=t.maxAttempts,this.F_=new dp(this.asyncQueue,"transaction_retry")}zu(){this.Gu-=1,this.ju()}ju(){this.F_.g_(()=>I(this,null,function*(){let e=new wL(this.datastore),r=this.Ju(e);r&&r.then(t=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(t)}).catch(i=>{this.Hu(i)}))}).catch(t=>{this.Hu(t)})}))}Ju(e){try{let r=this.updateFunction(e);return!_p(r)&&r.catch&&r.then?r:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.deferred.reject(r),null}}Hu(e){this.Gu>0&&this.Yu(e)?(this.Gu-=1,this.asyncQueue.enqueueAndForget(()=>(this.ju(),Promise.resolve()))):this.deferred.reject(e)}Yu(e){if(e.name==="FirebaseError"){let r=e.code;return r==="aborted"||r==="failed-precondition"||r==="already-exists"||!mW(r)}return!1}};var Ya="FirestoreClient",LL=class{constructor(e,r,t,i,o){this.authCredentials=e,this.appCheckCredentials=r,this.asyncQueue=t,this.databaseInfo=i,this.user=cn.UNAUTHENTICATED,this.clientId=jm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(t,s=>I(this,null,function*(){X(Ya,"Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(t,s=>(X(Ya,"Received new app check token=",s),this.appCheckCredentialListener(s,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 Or;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(()=>I(this,null,function*(){try{this._onlineComponents&&(yield this._onlineComponents.terminate()),this._offlineComponents&&(yield this._offlineComponents.terminate()),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(r){let t=EM(r,"Failed to shutdown persistence");e.reject(t)}})),e.promise}};function Gw(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress(),X(Ya,"Initializing OfflineComponentProvider");let r=n.configuration;yield e.initialize(r);let t=r.initialUser;n.setCredentialChangeListener(i=>I(null,null,function*(){t.isEqual(i)||(yield BW(e.localStore,i),t=i)})),e.persistence.setDatabaseDeletedListener(()=>{ws("Terminating Firestore due to IndexedDb database deletion"),n.terminate().then(()=>{X("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{ws("Terminating Firestore due to IndexedDb database deletion failed",i)})}),n._offlineComponents=e})}function fH(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress();let r=yield qoe(n);X(Ya,"Initializing OnlineComponentProvider"),yield e.initialize(r,n.configuration),n.setCredentialChangeListener(t=>cH(e.remoteStore,t)),n.setAppCheckTokenChangeListener((t,i)=>cH(e.remoteStore,i)),n._onlineComponents=e})}function qoe(n){return I(this,null,function*(){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){X(Ya,"Using user provided OfflineComponentProvider");try{yield Gw(n,n._uninitializedComponentsProvider._offline)}catch(e){let r=e;if(!(function(i){return i.name==="FirebaseError"?i.code===j.FAILED_PRECONDITION||i.code===j.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(r))throw r;ws("Error using user provided cache. Falling back to memory cache: "+r),yield Gw(n,new RM)}}else X(Ya,"Using default OfflineComponentProvider"),yield Gw(n,new NL(void 0));return n._offlineComponents})}function NM(n){return I(this,null,function*(){return n._onlineComponents||(n._uninitializedComponentsProvider?(X(Ya,"Using user provided OnlineComponentProvider"),yield fH(n,n._uninitializedComponentsProvider._online)):(X(Ya,"Using default OnlineComponentProvider"),yield fH(n,new CM))),n._onlineComponents})}function Koe(n){return NM(n).then(e=>e.syncEngine)}function i3(n){return NM(n).then(e=>e.datastore)}function yy(n){return I(this,null,function*(){let e=yield NM(n),r=e.eventManager;return r.onListen=Ooe.bind(null,e.syncEngine),r.onUnlisten=boe.bind(null,e.syncEngine),r.onFirstRemoteStoreListen=woe.bind(null,e.syncEngine),r.onLastRemoteStoreUnlisten=Loe.bind(null,e.syncEngine),r})}function Yoe(n,e,r={}){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new fp({next:f=>{u.Ou(),s.enqueueAndForget(()=>TM(o,d));let g=f.docs.has(a);!g&&f.fromCache?l.reject(new Q(j.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&c&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new hp(vp(a.path),u,{includeMetadataChanges:!0,ka:!0});return _M(o,d)})(yield yy(n),n.asyncQueue,e,r,t)})),t.promise}function Qoe(n,e,r={}){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new fp({next:f=>{u.Ou(),s.enqueueAndForget(()=>TM(o,d)),f.fromCache&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new hp(a,u,{includeMetadataChanges:!0,ka:!0});return _M(o,d)})(yield yy(n),n.asyncQueue,e,r,t)})),t.promise}function Xoe(n,e,r){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){try{let i=yield i3(n);t.resolve((function(s,a,c){return I(this,null,function*(){var l;let u=de(s),{request:d,ft:f,parent:g}=toe(u.serializer,Pie(a),c);u.connection.Qo||delete d.parent;let p=(yield u.Jo("RunAggregationQuery",u.serializer.databaseId,g,d,1)).filter(T=>!!T.result);he(p.length===1,64727);let _=(l=p[0].result)===null||l===void 0?void 0:l.aggregateFields;return Object.keys(_).reduce((T,D)=>(T[f[D]]=_[D],T),{})})})(i,e,r))}catch(i){t.reject(i)}})),t.promise}function o3(n){let e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}var gH=new Map;var s3="firestore.googleapis.com",mH=!0,Sy=class{constructor(e){var r,t;if(e.host===void 0){if(e.ssl!==void 0)throw new Q(j.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=s3,this.ssl=mH}else this.host=e.host,this.ssl=(r=e.ssl)!==null&&r!==void 0?r:mH;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=bW;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<xW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}tie("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=o3((t=e.experimentalLongPollingOptions)!==null&&t!==void 0?t:{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.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(t,i){return t.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Zl=class{constructor(e,r,t,i){this._authCredentials=e,this._appCheckCredentials=r,this._databaseId=t,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Sy({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Q(j.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 Q(j.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 Sy(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(t){if(!t)return new $w;switch(t.type){case"firstParty":return new zw(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Q(j.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}_restart(){return I(this,null,function*(){this._terminateTask==="notTerminated"?yield this._terminate():this._terminateTask="notTerminated"})}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){let t=gH.get(r);t&&(X("ComponentProvider","Removing Datastore"),gH.delete(r),t.terminate())})(this),Promise.resolve()}};function a3(n,e,r,t={}){var i;n=wr(n,Zl);let o=Hr(e),s=n._getSettings(),a=Object.assign(Object.assign({},s),{emulatorOptions:n._getEmulatorOptions()}),c=`${e}:${r}`;o&&(ha(`https://${c}`),sl("Firestore",!0)),s.host!==s3&&s.host!==c&&ws("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let l=Object.assign(Object.assign({},s),{host:c,ssl:o,emulatorOptions:t});if(!Vi(l,a)&&(n._setSettings(l),t.mockUserToken)){let u,d;if(typeof t.mockUserToken=="string")u=t.mockUserToken,d=cn.MOCK_USER;else{u=KT(t.mockUserToken,(i=n._app)===null||i===void 0?void 0:i.options.projectId);let f=t.mockUserToken.sub||t.mockUserToken.user_id;if(!f)throw new Q(j.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new cn(f)}n._authCredentials=new jw(new Mv(u,d))}}var Qi=class n{constructor(e,r,t){this.converter=r,this._query=t,this.type="query",this.firestore=e}withConverter(e){return new n(this.firestore,e,this._query)}},vn=class n{constructor(e,r,t){this.converter=r,this._key=t,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 Ua(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new n(this.firestore,e,this._key)}toJSON(){return{type:n._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,r,t){if(Ep(r,n._jsonSchema))return new n(e,t||null,new ie(We.fromString(r.referencePath)))}};vn._jsonSchemaVersion="firestore/documentReference/1.0",vn._jsonSchema={type:ln("string",vn._jsonSchemaVersion),referencePath:ln("string")};var Ua=class n extends Qi{constructor(e,r,t){super(e,r,vp(t)),this._path=t,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 vn(this.firestore,null,new ie(e))}withConverter(e){return new n(this.firestore,e,this._path)}};function c3(n,e,...r){if(n=Ge(n),XL("collection","path",e),n instanceof Zl){let t=We.fromString(e,...r);return uj(t),new Ua(n,null,t)}{if(!(n instanceof vn||n instanceof Ua))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return uj(t),new Ua(n.firestore,null,t)}}function l3(n,e){if(n=wr(n,Zl),XL("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Qi(n,null,(function(t){return new Wo(We.emptyPath(),t)})(e))}function u3(n,e,...r){if(n=Ge(n),arguments.length===1&&(e=jm.newId()),XL("doc","path",e),n instanceof Zl){let t=We.fromString(e,...r);return lj(t),new vn(n,null,new ie(t))}{if(!(n instanceof vn||n instanceof Ua))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return lj(t),new vn(n.firestore,n instanceof Ua?n.converter:null,new ie(t))}}var pH="AsyncQueue",Ay=class{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new dp(this,"async_queue_retry"),this.oc=()=>{let t=Lv();t&&X(pH,"Visibility state changed to "+t.visibilityState),this.F_.y_()},this._c=e;let r=Lv();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;let r=Lv();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let r=new Or;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(r.resolve,r.reject),r.promise)).then(()=>r.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}cc(){return I(this,null,function*(){if(this.Zu.length!==0){try{yield this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!Xa(e))throw e;X(pH,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(e){let r=this._c.then(()=>(this.nc=!0,e().catch(t=>{throw this.tc=t,this.nc=!1,Xt("INTERNAL UNHANDLED ERROR: ",EH(t)),t}).then(t=>(this.nc=!1,t))));return this._c=r,r}enqueueAfterDelay(e,r,t){this.ac(),this.sc.indexOf(e)>-1&&(r=0);let i=TL.createAndSchedule(this,e,r,t,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&ae(47125,{hc:EH(this.tc)})}verifyOperationInProgress(){}Pc(){return I(this,null,function*(){let e;do e=this._c,yield e;while(e!==this._c)})}Tc(e){for(let r of this.ec)if(r.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((r,t)=>r.targetTimeMs-t.targetTimeMs);for(let r of this.ec)if(r.skipDelay(),e!=="all"&&r.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let r=this.ec.indexOf(e);this.ec.splice(r,1)}};function EH(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
|
|
167
|
-
`+n.stack),e}function _H(n){return(function(r,t){if(typeof r!="object"||r===null)return!1;let i=r;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(n,["next","error","complete"])}var Xi=class extends Zl{constructor(e,r,t,i){super(e,r,t,i),this.type="firestore",this._queue=new Ay,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Ay(e),this._firestoreClient=void 0,yield e}})}};function Gy(n,e,r){r||(r=Xm);let t=Po(n,"firestore");if(t.isInitialized(r)){let i=t.getImmediate({identifier:r}),o=t.getOptions(r);if(Vi(o,e))return i;throw new Q(j.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new Q(j.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<xW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&Hr(e.host)&&ha(e.host),t.initialize({options:e,instanceIdentifier:r})}function $h(n,e){let r=typeof n=="object"?n:Sr(),t=typeof n=="string"?n:e||Xm,i=Po(r,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=Nd("firestore");o&&a3(i,...o)}return i}function jh(n){if(n._terminated)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Joe(n),n._firestoreClient}function Joe(n){var e,r,t;let i=n._freezeSettings(),o=(function(a,c,l,u){return new rb(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,o3(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,i);n._componentsProvider||!((r=i.localCache)===null||r===void 0)&&r._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(n._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),n._firestoreClient=new LL(n._authCredentials,n._appCheckCredentials,n._queue,o,n._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(n._componentsProvider))}var ML=class{constructor(e="count",r){this._internalFieldPath=r,this.type="AggregateField",this.aggregateType=e}},PL=class{constructor(e,r,t){this._userDataWriter=r,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Os=class n{constructor(e){this._byteString=e}static fromBase64String(e){try{return new n(un.fromBase64String(e))}catch(r){throw new Q(j.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+r)}}static fromUint8Array(e){return new n(un.fromUint8Array(e))}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:n._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ep(e,n._jsonSchema))return n.fromBase64String(e.bytes)}};Os._jsonSchemaVersion="firestore/bytes/1.0",Os._jsonSchema={type:ln("string",Os._jsonSchemaVersion),bytes:ln("string")};var xh=class{constructor(...e){for(let r=0;r<e.length;++r)if(e[r].length===0)throw new Q(j.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Tn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var gp=class{constructor(e){this._methodName=e}};var Va=class n{constructor(e,r){if(!isFinite(e)||e<-90||e>90)throw new Q(j.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(r)||r<-180||r>180)throw new Q(j.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=e,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Re(this._lat,e._lat)||Re(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:n._jsonSchemaVersion}}static fromJSON(e){if(Ep(e,n._jsonSchema))return new n(e.latitude,e.longitude)}};Va._jsonSchemaVersion="firestore/geoPoint/1.0",Va._jsonSchema={type:ln("string",Va._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};var Ba=class n{constructor(e){this._values=(e||[]).map(r=>r)}toArray(){return this._values.map(e=>e)}isEqual(e){return(function(t,i){if(t.length!==i.length)return!1;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!1;return!0})(this._values,e._values)}toJSON(){return{type:n._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ep(e,n._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(r=>typeof r=="number"))return new n(e.vectorValues);throw new Q(j.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};Ba._jsonSchemaVersion="firestore/vectorValue/1.0",Ba._jsonSchema={type:ln("string",Ba._jsonSchemaVersion),vectorValues:ln("object")};var Zoe=/^__.*__$/,xL=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return this.fieldMask!==null?new Yi(e,this.data,this.fieldMask,r,this.fieldTransforms):new qa(e,this.data,r,this.fieldTransforms)}},Dy=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return new Yi(e,this.data,this.fieldMask,r,this.fieldTransforms)}};function d3(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:n})}}var FL=class n{constructor(e,r,t,i,o,s){this.settings=e,this.databaseId=r,this.serializer=t,this.ignoreUndefinedProperties=i,o===void 0&&this.Ac(),this.fieldTransforms=o||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new n(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Cy(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(r=>e.isPrefixOf(r))!==void 0||this.fieldTransforms.find(r=>e.isPrefixOf(r.field))!==void 0}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(e.length===0)throw this.wc("Document fields must not be empty");if(d3(this.Ec)&&Zoe.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},kL=class{constructor(e,r,t){this.databaseId=e,this.ignoreUndefinedProperties=r,this.serializer=t||ky(e)}Dc(e,r,t,i=!1){return new FL({Ec:e,methodName:r,bc:t,path:Tn.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function $y(n){let e=n._freezeSettings(),r=ky(n._databaseId);return new kL(n._databaseId,!!e.ignoreUndefinedProperties,r)}function h3(n,e,r,t,i,o={}){let s=n.Dc(o.merge||o.mergeFields?2:0,e,r,i);OM("Data must be an object, but it was:",s,t);let a=g3(t,s),c,l;if(o.merge)c=new Yr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=UL(e,d,r);if(!s.contains(f))throw new Q(j.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);p3(u,f)||u.push(f)}c=new Yr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new xL(new nr(a),c,l)}var Ry=class n extends gp{_toFieldTransform(e){if(e.Ec!==2)throw e.Ec===1?e.wc(`${this._methodName}() can only appear at the top level of your update data`):e.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof n}};function ese(n,e,r,t){let i=n.Dc(1,e,r);OM("Data must be an object, but it was:",i,t);let o=[],s=nr.empty();Ja(t,(c,l)=>{let u=wM(e,c,r);l=Ge(l);let d=i.gc(u);if(l instanceof Ry)o.push(u);else{let f=Ap(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new Yr(o);return new Dy(s,a,i.fieldTransforms)}function tse(n,e,r,t,i,o){let s=n.Dc(1,e,r),a=[UL(e,t,r)],c=[i];if(o.length%2!=0)throw new Q(j.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<o.length;f+=2)a.push(UL(e,o[f])),c.push(o[f+1]);let l=[],u=nr.empty();for(let f=a.length-1;f>=0;--f)if(!p3(l,a[f])){let g=a[f],p=c[f];p=Ge(p);let _=s.gc(g);if(p instanceof Ry)l.push(g);else{let T=Ap(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new Yr(l);return new Dy(u,d,s.fieldTransforms)}function f3(n,e,r,t=!1){return Ap(r,n.Dc(t?4:3,e))}function Ap(n,e){if(m3(n=Ge(n)))return OM("Unsupported field value:",e,n),g3(n,e);if(n instanceof gp)return(function(t,i){if(!d3(i.Ec))throw i.wc(`${t._methodName}() can only be used with update() and set()`);if(!i.path)throw i.wc(`${t._methodName}() is not currently supported inside arrays`);let o=t._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.mc&&e.Ec!==4)throw e.wc("Nested arrays are not supported");return(function(t,i){let o=[],s=0;for(let a of t){let c=Ap(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(n,e)}return(function(t,i){if((t=Ge(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return Bie(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=Pt.fromDate(t);return{timestampValue:Nh(i.serializer,o)}}if(t instanceof Pt){let o=new Pt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Nh(i.serializer,o)}}if(t instanceof Va)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Os)return{bytesValue:EW(i.serializer,t._byteString)};if(t instanceof vn){let o=i.databaseId,s=t.firestore._databaseId;if(!s.isEqual(o))throw i.wc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${o.projectId}/${o.database}`);return{referenceValue:uM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof Ba)return(function(s,a){return{mapValue:{fields:{[iM]:{stringValue:oM},[Sh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return lM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${Oy(t)}`)})(n,e)}function g3(n,e){let r={};return BH(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ja(n,(t,i)=>{let o=Ap(i,e.Vc(t));o!=null&&(r[t]=o)}),{mapValue:{fields:r}}}function m3(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof Pt||n instanceof Va||n instanceof Os||n instanceof vn||n instanceof gp||n instanceof Ba)}function OM(n,e,r){if(!m3(r)||!AH(r)){let t=Oy(r);throw t==="an object"?e.wc(n+" a custom object"):e.wc(n+" "+t)}}function UL(n,e,r){if((e=Ge(e))instanceof xh)return e._internalPath;if(typeof e=="string")return wM(n,e);throw Cy("Field path arguments must be of type string or ",n,!1,void 0,r)}var nse=new RegExp("[~\\*/\\[\\]]");function wM(n,e,r){if(e.search(nse)>=0)throw Cy(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,r);try{return new xh(...e.split("."))._internalPath}catch{throw Cy(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,r)}}function Cy(n,e,r,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;r&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(o||s)&&(c+=" (found",o&&(c+=` in field ${t}`),s&&(c+=` in document ${i}`),c+=")"),new Q(j.INVALID_ARGUMENT,a+n+c)}function p3(n,e){return n.some(r=>r.isEqual(e))}var eu=class{constructor(e,r,t,i,o){this._firestore=e,this._userDataWriter=r,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new vn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new VL(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let r=this._document.data.field(jy("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r)}}},VL=class extends eu{data(){return super.data()}};function jy(n,e){return typeof e=="string"?wM(n,e):e instanceof xh?e._internalPath:e._delegate._internalPath}function E3(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new Q(j.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var mp=class{},Fh=class extends mp{};function _3(n,e,...r){let t=[];e instanceof mp&&t.push(e),t=t.concat(r),(function(o){let s=o.filter(c=>c instanceof kh).length,a=o.filter(c=>c instanceof pp).length;if(s>1||s>0&&a>0)throw new Q(j.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(t);for(let i of t)n=i._apply(n);return n}var pp=class n extends Fh{constructor(e,r,t){super(),this._field=e,this._op=r,this._value=t,this.type="where"}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=this._parse(e);return D3(e._query,r),new Qi(e.firestore,e.converter,pb(e._query,r))}_parse(e){let r=$y(e.firestore);return(function(o,s,a,c,l,u,d){let f;if(l.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new Q(j.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){IH(d,u);let p=[];for(let _ of d)p.push(TH(c,o,_));f={arrayValue:{values:p}}}else f=TH(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||IH(d,u),f=f3(a,s,d,u==="in"||u==="not-in");return $e.create(l,u,f)})(e._query,"where",r,e.firestore._databaseId,this._field,this._op,this._value)}};function T3(n,e,r){let t=e,i=jy("where",n);return pp._create(i,t,r)}var kh=class n extends mp{constructor(e,r){super(),this.type=e,this._queryConstraints=r}static _create(e,r){return new n(e,r)}_parse(e){let r=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return r.length===1?r[0]:nt.create(r,this._getOperator())}_apply(e){let r=this._parse(e);return r.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)D3(s,c),s=pb(s,c)})(e._query,r),new Qi(e.firestore,e.converter,pb(e._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function I3(...n){return n.forEach(e=>R3("or",e)),kh._create("or",n)}function v3(...n){return n.forEach(e=>R3("and",e)),kh._create("and",n)}var BL=class n extends Fh{constructor(e,r){super(),this._field=e,this._direction=r,this.type="orderBy"}static _create(e,r){return new n(e,r)}_apply(e){let r=(function(i,o,s){if(i.startAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Wl(o,s)})(e._query,this._field,this._direction);return new Qi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new Wo(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,r))}};function y3(n,e="asc"){let r=e,t=jy("orderBy",n);return BL._create(t,r)}var GL=class n extends Fh{constructor(e,r,t){super(),this.type=e,this._limit=r,this._limitType=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){return new Qi(e.firestore,e.converter,qv(e._query,this._limit,this._limitType))}};function S3(n){return nie("limit",n),GL._create("limit",n,"F")}var $L=class n extends Fh{constructor(e,r,t){super(),this.type=e,this._docOrFields=r,this._inclusive=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=rse(e,this.type,this._docOrFields,this._inclusive);return new Qi(e.firestore,e.converter,(function(i,o){return new Wo(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,r))}};function A3(...n){return $L._create("startAfter",n,!1)}function rse(n,e,r,t){if(r[0]=Ge(r[0]),r[0]instanceof eu)return(function(o,s,a,c,l){if(!c)throw new Q(j.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);let u=[];for(let d of dh(o))if(d.field.isKeyField())u.push(Hl(s,c.key));else{let f=c.data.field(d.field);if(My(f))throw new Q(j.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+d.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(f===null){let g=d.field.canonicalString();throw new Q(j.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${g}' (used as the orderBy) does not exist.`)}u.push(f)}return new Ho(u,l)})(n._query,n.firestore._databaseId,e,r[0]._document,t);{let i=$y(n.firestore);return(function(s,a,c,l,u,d){let f=s.explicitOrderBy;if(u.length>f.length)throw new Q(j.INVALID_ARGUMENT,`Too many arguments provided to ${l}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);let g=[];for(let p=0;p<u.length;p++){let _=u[p];if(f[p].field.isKeyField()){if(typeof _!="string")throw new Q(j.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${l}(), but got a ${typeof _}`);if(!aM(s)&&_.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${l}() must be a plain document ID, but '${_}' contains a slash.`);let T=s.path.child(We.fromString(_));if(!ie.isDocumentKey(T))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${l}() must result in a valid document path, but '${T}' is not because it contains an odd number of segments.`);let D=new ie(T);g.push(Hl(a,D))}else{let T=f3(c,l,_);g.push(T)}}return new Ho(g,d)})(n._query,n.firestore._databaseId,i,e,r,t)}}function TH(n,e,r){if(typeof(r=Ge(r))=="string"){if(r==="")throw new Q(j.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!aM(e)&&r.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let t=e.path.child(We.fromString(r));if(!ie.isDocumentKey(t))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${t}' is not because it has an odd number of segments (${t.length}).`);return Hl(n,new ie(t))}if(r instanceof vn)return Hl(n,r._key);throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Oy(r)}.`)}function IH(n,e){if(!Array.isArray(n)||n.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function D3(n,e){let r=(function(i,o){for(let s of i)for(let a of s.getFlattenedFilters())if(o.indexOf(a.op)>=0)return a.op;return null})(n.filters,(function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(r!==null)throw r===e.op?new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`)}function R3(n,e){if(!(e instanceof pp||e instanceof kh))throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var Ny=class{convertValue(e,r="none"){switch(ja(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Mt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,r);case 5:return e.stringValue;case 6:return this.convertBytes(Ls(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,r);case 11:return this.convertObject(e.mapValue,r);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,r){return this.convertObjectMap(e.fields,r)}convertObjectMap(e,r="none"){let t={};return Ja(e,(i,o)=>{t[i]=this.convertValue(o,r)}),t}convertVectorValue(e){var r,t,i;let o=(i=(t=(r=e.fields)===null||r===void 0?void 0:r[Sh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>Mt(s.doubleValue));return new Ba(o)}convertGeoPoint(e){return new Va(Mt(e.latitude),Mt(e.longitude))}convertArray(e,r){return(e.values||[]).map(t=>this.convertValue(t,r))}convertServerTimestamp(e,r){switch(r){case"previous":let t=Py(e);return t==null?null:this.convertValue(t,r);case"estimate":return this.convertTimestamp(Qm(e));default:return null}}convertTimestamp(e){let r=bs(e);return new Pt(r.seconds,r.nanos)}convertDocumentKey(e,r){let t=We.fromString(e);he(RW(t),9688,{name:e});let i=new yh(t.get(1),t.get(3)),o=new ie(t.popFirst(5));return i.isEqual(r)||Xt(`Document ${o} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${r.projectId}/${r.database}) instead.`),o}};function C3(n,e,r){let t;return t=n?r&&(r.merge||r.mergeFields)?n.toFirestore(e,r):n.toFirestore(e):e,t}var jL=class extends Ny{constructor(e){super(),this.firestore=e}convertBytes(e){return new Os(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function ise(){return new ML("count")}var ka=class{constructor(e,r){this.hasPendingWrites=e,this.fromCache=r}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ga=class n extends eu{constructor(e,r,t,i,o,s){super(e,r,t,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=o}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let r=new fh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,r={}){if(this._document){let t=this._document.data.field(jy("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,r={};return r.type=n._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}};Ga._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ga._jsonSchema={type:ln("string",Ga._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};var fh=class extends Ga{data(e={}){return super.data(e)}},jl=class n{constructor(e,r,t,i){this._firestore=e,this._userDataWriter=r,this._snapshot=i,this.metadata=new ka(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(r=>e.push(r)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,r){this._snapshot.docs.forEach(t=>{e.call(r,new fh(this._firestore,this._userDataWriter,t.key,t,new ka(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let r=!!e.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new Q(j.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new fh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new ka(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:s++}})}{let s=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>o||a.type!==3).map(a=>{let c=new fh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new ka(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter),l=-1,u=-1;return a.type!==0&&(l=s.indexOf(a.doc.key),s=s.delete(a.doc.key)),a.type!==1&&(s=s.add(a.doc),u=s.indexOf(a.doc.key)),{type:ose(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=n._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=jm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let r=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(r.push(o._document),t.push(this._userDataWriter.convertObjectMap(o._document.data.value.mapValue.fields,"previous")),i.push(o.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function ose(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:n})}}function N3(n){n=wr(n,vn);let e=wr(n.firestore,Xi);return Yoe(jh(e),n._key).then(r=>P3(e,n,r))}jl._jsonSchemaVersion="firestore/querySnapshot/1.0",jl._jsonSchema={type:ln("string",jl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};var tu=class extends Ny{constructor(e){super(),this.firestore=e}convertBytes(e){return new Os(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function O3(n){n=wr(n,Qi);let e=wr(n.firestore,Xi),r=jh(e),t=new tu(e);return E3(n._query),Qoe(r,n._query).then(i=>new jl(e,t,n,i))}function w3(n,e,r){n=wr(n,vn);let t=wr(n.firestore,Xi),i=C3(n.converter,e,r);return M3(t,[h3($y(t),"setDoc",n._key,i,n.converter!==null,r).toMutation(n._key,Gn.none())])}function b3(n){return M3(wr(n.firestore,Xi),[new Yl(n._key,Gn.none())])}function L3(n,...e){var r,t,i;n=Ge(n);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||_H(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(_H(e[s])){let d=e[s];e[s]=(r=d.next)===null||r===void 0?void 0:r.bind(d),e[s+1]=(t=d.error)===null||t===void 0?void 0:t.bind(d),e[s+2]=(i=d.complete)===null||i===void 0?void 0:i.bind(d)}let c,l,u;if(n instanceof vn)l=wr(n.firestore,Xi),u=vp(n._key.path),c={next:d=>{e[s]&&e[s](P3(l,n,d))},error:e[s+1],complete:e[s+2]};else{let d=wr(n,Qi);l=wr(d.firestore,Xi),u=d._query;let f=new tu(l);c={next:g=>{e[s]&&e[s](new jl(l,f,d,g))},error:e[s+1],complete:e[s+2]},E3(n._query)}return(function(f,g,p,_){let T=new fp(_),D=new hp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return _M(yield yy(f),D)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return TM(yield yy(f),D)}))}})(jh(l),u,a,c)}function M3(n,e){return(function(t,i){let o=new Or;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return Moe(yield Koe(t),i,o)})),o.promise})(jh(n),e)}function P3(n,e,r){let t=r.docs.get(e._key),i=new tu(n);return new Ga(n,i,e._key,t,new ka(r.hasPendingWrites,r.fromCache),e.converter)}function x3(n){return F3(n,{count:ise()})}function F3(n,e){let r=wr(n.firestore,Xi),t=jh(r),i=Oie(e,(o,s)=>new Ib(s,o.aggregateType,o._internalFieldPath));return Xoe(t,n._query,i).then(o=>(function(a,c,l){let u=new tu(a);return new PL(c,u,l)})(r,n,o))}var HL=class{constructor(e){let r;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),r=e.tabManager):(r=sse(void 0),r._initialize(e)),this._onlineComponentProvider=r._onlineComponentProvider,this._offlineComponentProvider=r._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function bM(n){return new HL(n)}var WL=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=CM.provider,this._offlineComponentProvider={build:r=>new vy(r,e?.cacheSizeBytes,this.forceOwnership)}}},zL=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=CM.provider,this._offlineComponentProvider={build:r=>new OL(r,e?.cacheSizeBytes)}}};function sse(n){return new WL(n?.forceOwnership)}function LM(){return new zL}var ase={maxAttempts:5};function Pm(n,e){if((n=Ge(n)).firestore!==e)throw new Q(j.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}var qL=class{constructor(e,r){this._firestore=e,this._transaction=r,this._dataReader=$y(e)}get(e){let r=Pm(e,this._firestore),t=new jL(this._firestore);return this._transaction.lookup([r._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new eu(this._firestore,t,o.key,o,r.converter);if(o.isNoDocument())return new eu(this._firestore,t,r._key,null,r.converter);throw ae(18433,{doc:o})})}set(e,r,t){let i=Pm(e,this._firestore),o=C3(i.converter,r,t),s=h3(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,r,t,...i){let o=Pm(e,this._firestore),s;return s=typeof(r=Ge(r))=="string"||r instanceof xh?tse(this._dataReader,"Transaction.update",o._key,r,t,i):ese(this._dataReader,"Transaction.update",o._key,r),this._transaction.update(o._key,s),this}delete(e){let r=Pm(e,this._firestore);return this._transaction.delete(r._key),this}};var KL=class extends qL{constructor(e,r){super(e,r),this._firestore=e}get(e){let r=Pm(e,this._firestore),t=new tu(this._firestore);return super.get(e).then(i=>new Ga(this._firestore,t,r._key,i._document,new ka(!1,!1),r.converter))}};function k3(n,e,r){n=wr(n,Xi);let t=Object.assign(Object.assign({},ase),r);return(function(o){if(o.maxAttempts<1)throw new Q(j.INVALID_ARGUMENT,"Max attempts must be at least 1")})(t),(function(o,s,a){let c=new Or;return o.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){let l=yield i3(o);new bL(o.asyncQueue,l,a,s,c).zu()})),c.promise})(jh(n),i=>e(new KL(n,i)),t)}(function(e,r=!0){(function(i){Uh=i})(pa),ur(new _n("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new Xi(new Hw(t.getProvider("auth-internal")),new qw(s,t.getProvider("app-check-internal")),(function(l,u){if(!Object.prototype.hasOwnProperty.apply(l.options,["projectId"]))throw new Q(j.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:r},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Qe(oj,sj,e),Qe(oj,sj,"esm2017")})();var MM=pe(v3,!0,2);var Dp=pe(c3,!0,2),PM=pe(l3,!0,2);var Hy=pe(b3,!0,2);var Hh=pe(u3,!0,2);var U3=pe(x3,!0),V3=pe(N3,!0);var B3=pe(O3,!0);var Lxe=pe(S3,!0,2);var xM=pe(L3,!0);var Mxe=pe(I3,!0,2),Pxe=pe(y3,!0,2),FM=pe(_3,!0,2);var kM=pe(k3,!0),UM=pe(w3,!0,2);var xxe=pe(A3,!0,2);var Ji=pe(T3,!0,2);var Wy=(()=>{let e=class e{constructor(t,i,o){this.authService=t,this.configService=i,this.loggingService=o,this.db$=new Y(null);try{this.authService.getFirebaseConfig$().subscribe(s=>{if(s){let a=this.configService.getProxyConfig(),c=s.firebaseOptions.databaseURL;a?.v1DbHost&&c&&(c=OV(c,a.v1DbHost),a?.forceLongPolling&&hw());let l=dv(void 0,c);a?.v1DbHost&&c&&this.lockDatabaseHost(l),this.db$.next(l)}},s=>{this.loggingService.catch("Error in DatabaseService constructor: ",s)})}catch(s){this.loggingService.catch("Error in DatabaseService constructor:",s)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}lockDatabaseHost(t){try{let o=t?._repo?.repoInfo_;if(o){let s=o.host;Object.defineProperty(o,"host",{get:()=>s,set:()=>{},configurable:!0}),o.internalHost=s}}catch(i){this.loggingService.catch("Error in DatabaseService lockDatabaseHost: ",i)}}};e.\u0275fac=function(i){return new(i||e)(w(Cr),w(Rr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new Y(null),this.commentAnnotationById$=new Y({}),this.fieldsToRemove=[],this.additionalFields=[],this.additionalSaveEvents=[],this.getCommentAnnotationById=s=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove),s.config?.additionalFields&&(this.additionalFields=s.config.additionalFields||[]),this.additionalSaveEvents=(s.config?.additionalSaveEvents||[]).map(a=>a?.event).filter(a=>!!a))})}catch(s){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.commentAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",t)}}resolveCommentAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:t}}),f(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.commentAnnotationIds||[])],T=le(x({},t),{commentAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.commentAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.commentAnnotationById$.next(x(x({},this.commentAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveCommentAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let o=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=x(x({},a),t.commentAnnotation);let c=this.getTargetComment(t.commentAnnotation,t.commentId),l=yield kt(()=>{if(o?.config?.saveConfig?.url){let u={commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,u,!1,o.config.saveConfig.credentials)}return o?.save?.({commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveCommentAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(t.commentAnnotation),eventType:t.eventType,commentId:t.commentId}),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}getTargetComment(t,i){if(!(!i||!t))for(let o of Object.values(t)){let s=o?.comments?.[i];if(s)return s}}deleteCommentAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let s=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.commentAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteCommentAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:s,commentAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}getAdditionalSaveEvents(){try{return this.additionalSaveEvents}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalSaveEvents:",t),this.additionalSaveEvents}}setCommentAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting comment annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var qo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new Y(null),this.reactionAnnotationById$=new Y({}),this.getReactionAnnotationById=s=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.reactionAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",t)}}resolveReactionAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:t}}),f(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.reactionAnnotationIds||[])],T=le(x({},t),{reactionAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.reactionAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.reactionAnnotationById$.next(x(x({},this.reactionAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveReactionAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let o=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=x(x({},a),t);let c={reactionAnnotation:t,event:Qt.REACTION_ADD,metadata:Object.values(t??{})?.[0]?.metadata},l=yield kt(()=>o?.config?.saveConfig?.url?Ht(o.config.saveConfig.url,o.config.saveConfig.headers,c,!1,o.config.saveConfig.credentials):o?.save?.(c)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(t),eventType:c.event}),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let s=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),c=i??a?.[t]?.metadata,l=c?Cn(c):void 0,u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.reactionAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE})||Promise.resolve(void 0)},"deleteReactionAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:s,reactionAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting reaction annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Wh=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.providers=new Map,this.retrySaveConfigs=new Map,this.retryDeleteConfigs=new Map,this.defaultRetryConfig={retryCount:0,retryDelay:0,revertOnFailure:!1};try{this.loggingService.log("AttachmentResolverService initialized")}catch(s){this.loggingService.catch("Error in AttachmentResolverService constructor:",s)}}getProvider(t){try{let i=t||"default";return this.providers.get(i)||void 0}catch(i){this.loggingService.catch("Error in AttachmentResolverService getProvider:",i);return}}getRetrySaveConfig(t){let i=t||"default";return this.retrySaveConfigs.get(i)||this.defaultRetryConfig}getRetryDeleteConfig(t){let i=t||"default";return this.retryDeleteConfigs.get(i)||this.defaultRetryConfig}makeAttachmentConfigBasedRequest(t,i,o,s,a){return I(this,null,function*(){try{let c=typeof i=="function"?yield i():i||{},l=new FormData;l.append("file",o);let u={attachment:{attachmentId:s.attachment.attachmentId,name:s.attachment.name,mimeType:s.attachment.mimeType},metadata:s.metadata,event:s.event};l.append("request",JSON.stringify(u));let d={};Object.entries(c).forEach(([p,_])=>{p.toLowerCase()!=="content-type"&&(d[p]=_)});let f=yield fetch(t,x({method:"POST",headers:d,body:l},a?{credentials:a}:{}));return f.ok?{data:(yield f.json())?.data??{},success:!0,statusCode:200}:(H.catch(`Error in makeAttachmentConfigBasedRequest: ${f.status} ${f.statusText}`),{data:{},success:!1,statusCode:f.status})}catch(c){return H.catch("Error in makeAttachmentConfigBasedRequest:",c),{data:{},success:!1,statusCode:500}}})}saveAttachment(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let s=this.getProvider(o);if(!this.attachmentDataProviderAvailable(o))throw new Error("Attachment save data provider not available");let a=this.getRetrySaveConfig(o),c=i||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{request:t}});let l=yield kt(()=>I(this,null,function*(){if(s?.config?.saveConfig?.url){let u=t.attachment,{file:d}=u,f=dS(u,["file"]);return this.makeAttachmentConfigBasedRequest(s.config.saveConfig.url,s.config.saveConfig.headers,d,{attachment:f,event:t.eventType,metadata:t.attachment.metadata},s.config.saveConfig.credentials)}return s?.save?.({attachment:t.attachment,event:t.eventType,metadata:t.attachment.metadata})||Promise.resolve(void 0)}),"saveAttachment",a);if(l?.statusCode!==200){this.loggingService.catch(l?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:t}});return}return this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:t.attachment.attachmentId,eventType:t.eventType}),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{error:s,request:t}});return}})}deleteAttachment(a,c,l){return I(this,arguments,function*({attachmentId:t,metadata:i},o,s){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let u=this.getProvider(s);if(!this.attachmentDataProviderAvailable(s))throw new Error("Attachment delete data provider not available");let d=i?x({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0,f=this.getRetryDeleteConfig(s),g=o||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield kt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE};return Ht(u.config.deleteConfig.url,u.config.deleteConfig.headers,_,!1,u.config.deleteConfig.credentials)}return u?.delete?.({attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE})||Promise.resolve(void 0)},"deleteAttachment",f);return p?.statusCode!==200?(this.loggingService.catch(p?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{error:p,attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:t}),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:f.revertOnFailure,isSuccess:!0},attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!0})}catch(u){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",u);let d=this.getRetryDeleteConfig(s),f=o||J(),g=i?x({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0;return this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{error:u,attachmentId:t,metadata:g}}),{revertOnFailure:d.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(t,i="default"){try{if(t){this.loggingService.log(`Setting attachment data provider for scope: ${i}`);let o=t.config,s=[{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(s.forEach(({method:c,configKey:l})=>{let u=o?.[l]?.url,d=c in t&&typeof t[c]=="function";!u&&!d&&a.push(c)}),a.length>0){let c=`DataProviders.attachment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(c);return}else this.providers.set(i,t),t.config?.saveRetryConfig&&this.retrySaveConfigs.set(i,t.config.saveRetryConfig),t.config?.deleteRetryConfig&&this.retryDeleteConfigs.set(i,t.config.deleteRetryConfig)}}catch(o){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",o)}}attachmentDataProviderAvailable(t){try{let i=t||"default";return this.providers.has(i)}catch(i){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",i),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var ec=(()=>{let e=class e{constructor(t,i,o,s){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.attachmentResolverService=s,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.recorderAnnotationDataProvider$=new Y(null),this.recorderAnnotationById$=new Y({}),this.additionalFields=[],this.uploadChunks=!1,this.getRecorderAnnotationById=a=>{try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.value?.[a]:void 0}catch(c){this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationById:",c);return}};try{this.loggingService.log("RecorderAnnotationsResolverService initialized"),this.recorderAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.additionalFields&&(this.additionalFields=a.config.additionalFields||[]),this.uploadChunks=a.uploadChunks??!1)})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService constructor:",a)}}getProvider(){try{let t=this.recorderAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.recorderAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService ngOnDestroy:",t)}}resolveRecorderAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: resolveRecorderAnnotations","color: green;"),!this.recorderAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Recorder annotation resolution timeout"),request:t}}),f(new Error("Recorder annotation resolution timeout"))}},this.recorderAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.recorderAnnotationIds||[])],T=le(x({},t),{recorderAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getRecorderAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_GET,{sourceMethod:"resolveRecorderAnnotations",source:"sdk",recorderAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.recorderAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.recorderAnnotationById$.next(x(x({},this.recorderAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveRecorderAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: saveRecorderAnnotation","color: green;");let o=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.recorderAnnotationById$.getValue()));this.recorderAnnotationById$._value=x(x({},a),t.recorderAnnotation);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}return o?.save?.({recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveRecorderAnnotation",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in RecorderAnnotationsResolverService saveRecorderAnnotation:"),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_SAVE,{sourceMethod:"saveRecorderAnnotation",source:"sdk",recorderAnnotationIds:Object.keys(t.recorderAnnotation),eventType:t.eventType}),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in RecorderAnnotationsResolverService saveRecorderAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteRecorderAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: deleteRecorderAnnotation","color: green;");let s=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation delete data provider not available");let a=this.recorderAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{recorderAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.recorderAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteRecorderAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:"),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:g,recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_DELETE,{sourceMethod:"deleteRecorderAnnotation",source:"sdk",recorderAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:s,recorderAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getRecorderAnnotationsById$(){try{return this.recorderAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: getRecorderAnnotationsById$","color: green;"),this.recorderAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService getAnnotationById:",i);return}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}shouldUploadChunks(){return this.uploadChunks}shouldUploadFullRecording(){return this.recorderAnnotationDataProviderAvailable()&&!this.uploadChunks}setRecorderAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting recorder annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.recorder is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else t.storage&&this.attachmentResolverService.setAttachmentDataProvider(t.storage,"recorder"),this.attachmentResolverService.attachmentDataProviderAvailable("recorder")||this.loggingService.catch("Recording resolver is configured without storage resolver. Recording files (chunks, thumbnails) will be stored on Velt's infrastructure. Configure storage resolver for full self-hosting.",void 0,void 0,!0),this.recorderAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService setRecorderAnnotationDataProvider:",i)}}recorderAnnotationDataProviderAvailable(){try{return!!this.recorderAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService recorderAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt),w(Wh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var qy=class{};var zh=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p){this.analyticsService=t,this.authService=i,this.databaseService=o,this.domService=s,this.configService=a,this.loggingService=c,this.commentResolverService=l,this.reactionResolverService=u,this.recorderResolverService=d,this.coreActionsService=f,this.functions=g,this.serviceBook=p,this.documentPaths$=new Y(null),this.docContext$=new Y(null),this.documentIds$=new Y([]),this.organizationConfig$=new Y(null),this.firestorePaths$=new Y(null),this.location$=new Y(null),this.excludedLocationIds$=new Y([]),this.organizationMetadata$=new Y(null),this.documentMetadata$=new Y(null),this.locationMetadata$=new Y(null),this.customerMetadata$=new Y(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new Y({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new Y({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Ot,this.DEBOUNCE_TIME=5e3,this.currentDebounceTime=this.DEBOUNCE_TIME,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.pendingDocumentIds=[],this.pendingOptions={},this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.serviceBook.observe(pd).subscribe(_=>{this.commentService=_??void 0}),B1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(SS(()=>Ci(this.currentDebounceTime))).subscribe({next:_=>I(this,null,function*(){try{yield this.setDocumentIdImpl(_.documentId,_.clientOrganizationId,_.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:_=>{this.loggingService.catch("Error in setDocumentId subscription:",_),this.queueSize--}}),this.databaseService.getDb().pipe(Ct(_=>!!_),Nt(1)).subscribe(_=>{_&&(this.db=_)}),this.configService.getApiKey$().subscribe(_=>{if(this.apiKey=_,this.apiKey){if(!this.isCustomDocId){let T=HT(window.location.href);this.currentUrl=T}this.analyticsService.updateDefaultProperties({apiKey:_})}}),this.authService.getUser$().subscribe(_=>I(this,null,function*(){if(_&&(this.analyticsService.updateDefaultProperties({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&_?.organizationId&&this.documentPaths$.value?.organizationId!==_?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(T=>({id:T.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),_?.organizationId&&_?.clientOrganizationId)){let T={organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId};this.getOrganizationConfig()||this.setOrganizationConfig({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),yield this.updateOrganizationMetadata(T)}})),this.documentPaths$.subscribe(_=>{let T={documentId:_?.documentId,clientDocumentId:_?.clientDocumentId,folderId:_?.folderId,allDocuments:_?.allDocuments,veltFolderId:_?.veltFolderId};_?.organizationId&&(T.organizationId=_.organizationId,T.clientOrganizationId=_.clientOrganizationId),this.analyticsService.updateDefaultProperties(T),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(_=>{this.analyticsService.updateDefaultProperties({clientLocation:_?.location,locationId:_?.locationId})}),this.organizationMetadata$.subscribe(_=>{this.authService.setUserOrganization(_?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Ct(_=>!!_),Nt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(_){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}},_=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(_){this.loggingService.catch("Error in DocService constructor:",_)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{organizationId:this.documentPaths$.value?.clientOrganizationId,folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,optimisticPermissions:this.documentPaths$.value?.optimisticPermissions}:null}catch(t){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",t),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.setOrganizationConfig(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftDocuments=this.documentIds$.value.map(t=>({id:t.clientDocumentId})),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(t=>t.location)].filter(t=>t!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(t){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",t)}}setUsersService(t){try{this.usersService=t}catch(i){this.loggingService.catch("Error in setUsersService:",i)}}setCommonDbService(t){try{this.commonDbService=t}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setUserPermissionService(t){try{this.userPermissionService=t}catch(i){this.loggingService.catch("Error in setUserPermissionService:",i)}}setCommentService(t){try{this.commentService=t}catch(i){this.loggingService.catch("Error in setCommentService:",i)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let t=HT(location.href);this.currentUrl!==t&&(this.currentUrl=t,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowPopstate: ",t)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let t=HT(location.href);this.currentUrl!==t&&(this.currentUrl=t,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowClick: ",t)}}setDocument(a){return I(this,arguments,function*({documentId:t,documentMetadata:i,options:o,source:s="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),s==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,documentMetadata:i,methodName:"setDocument",source:s}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:s,payload:{documentId:t,documentMetadata:i,options:o}}),yield this.setDocumentsImpl({documents:[{id:t,metadata:i}],options:x({organizationId:i?.organizationId},o??{}),source:s})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}shouldSetDocumentsAgain(t,i={}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;"),this.pendingDocumentIds.length>0&&t.length===this.pendingDocumentIds.length&&t.every(d=>this.pendingDocumentIds.includes(d.id))&&ki(i,this.pendingOptions))return!1;let o=this.documentPaths$.value?.clientDocumentId,s=i?.rootDocumentId??t[0]?.id,a=this.documentIds$.value.map(u=>u.clientDocumentId),c=jT(this.getOptionsFromDocumentPaths()??{})??{};return!t.every(u=>a.includes(u.id))||!ki(c,i)||o!==s}catch(o){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",o),!0}}getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:i=!1}){try{let o=[];return t.forEach(s=>{let a=s.id,c=`${Tr(a)}`;i&&s?.metadata&&typeof s.metadata=="object"&&(this.clientDocumentMetadataMap[a]=s.metadata),o.push({documentId:c,clientDocumentId:a})}),o}catch(o){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",o),[]}}setDocuments(a){return I(this,arguments,function*({documents:t,options:i,source:o="internal",skipPermissionValidation:s=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:t,options:i,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:o,payload:{documents:t,options:i}}),yield this.setDocumentsImpl({documents:t,options:i??{},source:o,skipPermissionValidation:s})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}setRootDocument(o){return I(this,arguments,function*({document:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:kn.SET_ROOT_DOCUMENT,source:i,payload:{document:t}});let s=this.getOptionsFromDocumentPaths()??{},a=this.documentIds$.value.map(c=>c.clientDocumentId);if(!a.includes(t.id)){let c=[...a.map(u=>({id:u})),{id:t.id}],l=this.getDocumentIdsFromDocuments({documents:c,setClientDocumentMetadataMap:!0});this.documentIds$.next(l)}yield this.setDocumentIdImpl(t.id,this.documentPaths$.value?.clientOrganizationId,s)}catch(s){this.loggingService.catch("Error in DocService setRootDocument:",s)}})}setDocContext(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let i=JSON.parse(JSON.stringify(t??null));this.docContext$.next(i)}catch(i){this.loggingService.catch("Error in setDocContext: ",i)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(it(Ft))}getProcessedDocContext(){return GV(this.getDocContext())}filterRelevantDocuments(s){return I(this,arguments,function*({options:t,documentIds:i,skipPermissionValidation:o=!1}){try{let a=this.authService.getUser();return!a||!this.commonDbService?.shouldUseFirestore()||(i=yield this.fetchDocumentsFromFolder(t,i,a),yield this.handlePermissionProvider(t,i,a),i=yield this.filterDocumentsByPermissions(t,i,a,o),i=i.slice(0,50)),i}catch(a){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",a),i}})}fetchDocumentsFromFolder(t,i,o){return I(this,null,function*(){if(!t?.folderId||!t?.allDocuments)return i;try{let s=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Ad({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:t?.organizationId??o?.clientOrganizationId,folderId:t?.folderId}},getSdkProxy:s,userId:o?.userId??""}))?.data?.forEach(c=>{i.find(l=>l.clientDocumentId===c.id)||i.push({documentId:da(c.id),clientDocumentId:c.id})})}catch(s){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",s)}return i})}buildPermissionRequests(t,i,o){try{let s=[];return t.organizationId&&t.organizationId!==o.clientOrganizationId&&s.push({userId:o.userId,resource:{id:t.organizationId,type:di.ORGANIZATION,source:Un.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:di.FOLDER,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context}}),i&&i.forEach(a=>{s.push({userId:o.userId,resource:x({id:a.clientDocumentId,type:di.DOCUMENT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&$V({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:di.CONTEXT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:c}})}),s}catch(s){return this.loggingService.catch("Error in buildPermissionRequests:",s),[]}}processAccessibleContexts(t,i){try{if(!t?.success||!t?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let o=t.data.filter(s=>s.type===di.CONTEXT&&s.hasAccess).map(s=>s.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(o??"nil"))),o?.length){let s=i.filter(c=>o.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),a=jV({input:s});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(a??"nil"))),a?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(a??"nil"))),this.setDocContext(a))}}catch(o){this.loggingService.catch("Error in processAccessibleContexts:",o)}}handlePermissionProvider(t,i,o){return I(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let s=this.buildPermissionRequests(t,i,o),a=J();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_DOCUMENTS,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:s}}),this.userPermissionService?.cancelPendingRevokes(s);let c=yield this.userPermissionService?.onResourceAccessRequired({requests:s,uniqueId:a,methodName:Un.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(c??"nil")),"requests:",JSON.parse(JSON.stringify(s??"nil"))),this.processAccessibleContexts(c,s)}catch(s){this.loggingService.catch("Error in handlePermissionProvider:",s)}})}filterDocumentsByPermissions(t,i,o,s=!1){return I(this,null,function*(){if(s)return i;if(this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil"))),!(t?.optimisticPermissions!==!1))return yield this.validateAndFilterPermissions(t,i,o);let c=this.currentValidationToken,l=[...i];return c&&this.validatePermissionsInBackground(t,i,o,c),l})}validateAndFilterPermissions(t,i,o){return I(this,null,function*(){try{let s=t?.organizationId??o?.clientOrganizationId,a=yield this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:i.map(u=>u.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]});if(!a)return i;this.userPermissionService?.setCurrentUserPermissions(a),s&&a?.[o.userId]?.organization?.[s]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),t?.folderId&&a?.[o.userId]?.folders?.[t?.folderId]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0);let c=new Set;Object.entries(a?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===Oo.PERMISSION_DENIED&&c.add(u)}),c.size>0&&(this.loggingService.catch(`User does not have access to documents: ${[...c].join(", ")}`,void 0,void 0,!0),this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"validateAndFilterPermissions",message:"Access denied to documents in strict validation mode",documentIds:[...c],userId:o.userId,timestamp:new Date().getTime()}));let l=i.filter(u=>!c.has(u.clientDocumentId));return l.length===0&&i.length>0&&this.loggingService.catch("Error in validateAndFilterPermissions: All documents provided are denied"),l}catch(s){return this.loggingService.catch("Error in validateAndFilterPermissions:",s),i}})}validatePermissionsInBackground(t,i,o,s){let a=t?.organizationId??o?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:a,documentIds:i.map(c=>c.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]}).then(c=>{if(this.currentValidationToken===s&&c){this.userPermissionService?.setCurrentUserPermissions(c);let l=[];Object.entries(c?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===Oo.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${a}`,void 0,void 0,!0),t?.folderId&&c?.[o.userId]?.folders?.[t?.folderId]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0),l.length>0&&(this.loggingService.catch(`User does not have access to documents: ${l.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(l,o,s))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(t,i,o){try{if(this.currentValidationToken!==o)return;let s=this.documentPaths$.value;this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:t,userId:i.userId,timestamp:new Date().getTime()});let a=this.documentIds$.value||[],c=a.filter(l=>!t.includes(l.clientDocumentId));c.length!==a.length&&(c.length>0?this.setDocuments({documents:c.map(l=>({id:l.clientDocumentId})),options:{organizationId:s?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:t,userId:i.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(s){this.loggingService.catch("Error in handleDeniedDocumentAccess:",s)}}addUserInfoToOrganization(a){return I(this,arguments,function*({organizationId:t,user:i,notificationsConfig:o,currentUserId:s}){try{let c=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Ad({data:x({type:"addUserInfoToOrganization",metadata:{organizationId:t},user:this.usersService?.externalUserDataProviderAvailable()?{userId:i?.userId}:i},o&&{notificationsConfig:o}),getSdkProxy:c,userId:s??i?.userId??""})}catch(c){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",c)}})}setDocumentsImpl(a){return I(this,arguments,function*({documents:t,options:i,source:o,skipPermissionValidation:s=!1}){try{if(this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(t??"nil")),"options:",JSON.parse(JSON.stringify(i??"nil"))),!this.shouldSetDocumentsAgain(t,jT(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=J();this.currentValidationToken=c;let l=this.getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:!0});if(l?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let u=this.authService.getUser();if(!u){this.draftDocuments=t,this.draftOptions=i;return}this.pendingDocumentIds=t.map(f=>f.id),this.pendingOptions=jT(i)??{},this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.clientOrganizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let d=i?.organizationId??u?.clientOrganizationId;if(d&&this.addUserInfoToOrganization({organizationId:d,user:u}),l=yield this.filterRelevantDocuments({options:i,documentIds:l,skipPermissionValidation:s}),this.documentIds$.next(l),l?.length){let f=l[0]?.clientDocumentId;i?.rootDocumentId&&l.find(g=>g.clientDocumentId===i?.rootDocumentId)&&(f=i?.rootDocumentId),yield this.debounceSetDocuments({documentId:f,clientOrganizationId:i?.organizationId,options:i})}this.pendingDocumentIds=[],this.pendingOptions={};return}catch(c){this.pendingDocumentIds=[],this.pendingOptions={},this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}setDocumentId(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,clientOrganizationId:i,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENT_ID,source:o,payload:{documentId:t,clientOrganizationId:i}}),yield this.setDocumentsImpl({documents:[{id:t}],options:{organizationId:i},source:o})}catch(a){this.loggingService.catch("Error in setDocumentId:",a);return}})}debounceSetDocuments(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,options:o}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let a=o?.debounceTime??this.DEBOUNCE_TIME;this.currentDebounceTime=a;let c=Date.now(),l=c-this.lastSetDocumentIdCallTime,u=c-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=c,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||l>a&&u>a){yield this.setDocumentIdImpl(t,i,o),this.lastSetDocumentIdExecutionTime=c;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:t,clientOrganizationId:i,options:o??void 0});return}catch(a){this.loggingService.catch("Error in debounceSetDocuments:",a)}})}setDocumentIdImpl(t,i,o){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let s=this.authService.getUser();if(!s)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let a=this.currentDocumentId;if(this.apiKey){let c=`${Tr(t)}`,l=o?.folderId,u=o?.folderId?wo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?Fi(i):s?.organizationId:void 0,_=J(),T=Td.SET_DOCUMENTS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:Et.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let D=J(),b=Id.SET_DOCUMENTS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:D,moduleName:b,methodName:_t.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let G=J(),M=vd.GET_RECORDER_ANNOTATIONS;if(this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:G,moduleName:M,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:D,moduleName:b}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:G,moduleName:M})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==p){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let U=new xT,k=new qy;U.clientDocumentId=t,k.clientDocumentId=t,U.folderId=l,k.folderId=l,U.locationId=d,k.locationId=d,U.allDocuments=f,U.optimisticPermissions=g,k.allDocuments=f,k.optimisticPermissions=g,U.veltFolderId=u,k.veltFolderId=u,U.documentId=c,k.documentId=c,p&&(U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId,k.organizationId=p,k.clientOrganizationId=i??s?.clientOrganizationId);let S=`${this.apiKey}`,A=`apiKey/${this.apiKey}`;p&&(S=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`,A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`),k.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,k.document=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,U.presence=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,U.cursor=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,U.comment=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,k.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,U.multiThread=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,k.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,U.tag=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,U.area=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,k.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,U.arrow=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,U.selection=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,U.audioHuddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,U.huddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,U.recorder=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,k.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,U.flock=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,U.syncVideoPlayer=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,U.liveState=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,U.liveStateSingleEditorMode=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,U.reaction=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,k.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,U.crdt=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,k.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,U.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,U.views=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,k.notificationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,k.documentViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,k.locationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,U.notifications=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,U.metadata=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,U.users=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.documentIam=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.groupContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,U.globalContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,U.logins=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,U.userFeedback=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,U.userReportBugs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,U.userContactUs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(U.organizationMetadata=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,U.organizationIam=`${S}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.organizationGroups=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,U.organizationNotifications=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(U.organizationNotificationsWithDocumentId=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,U.heartbeatByDocument=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),U.organizationNotificationsLastNotificationTimestamp=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,U.organizationNotificationsUsers=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.heartbeat=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),k.organizationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,k.users=`${A}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,k.documentUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,k.notificationDocs=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,k.notificationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(U),this.firestorePaths$.next(k),U?.clientOrganizationId&&U?.organizationId&&!(U?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&U?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:U?.organizationId,clientOrganizationId:U?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),a&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:t}}),this.analyticsService.trackEvent(L.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:t},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(s){this.loggingService.catch("Error in setDocumentIdImpl: ",s)}})}unsetDocumentId({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:t}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:kn.UNSET_DOCUMENT_ID,source:t}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocumentId: ",o)}}unsetDocumentImpl({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{let o=JSON.parse(JSON.stringify(this.documentIds$.value??[])),s=JSON.parse(JSON.stringify(this.documentPaths$.value?.folderId??"")),a=this.getDocContext();this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),i&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.locations$.next({}),this.documentIds$.next([]),this.setDocContext(null),this.userPermissionService?.revokeAccessOnDocumentUnset({documentIds:o,folderId:s,context:a}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:t}),this.analyticsService.trackEvent(L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:t==="external"?"User unset document id":"System unset document id",source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetDocumentImpl: ",o)}}unsetDocuments({source:t,unsetDocumentPaths:i=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:t}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:t,methodName:kn.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocuments: ",o)}}addPreDocumentIdChangeFunction(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(t,i)}catch(o){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",o)}}callPreDocumentIdChangeFunctions(t){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,o]of this.preDocumentIdChangeFunctions)try{yield o(t)}catch(s){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",s)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig()),this.db&&t?.organizationId){let i=t?.organizationId,o=t?.clientOrganizationId,s=this.authService.getUser()?.userId??"",a=yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o});if(s&&a?.[s]?.organization?.[o]?.errorCode===Oo.PERMISSION_DENIED)return;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:i,field:"metadata"}}).then(c=>{c&&!c?.errorCode&&this.organizationMetadata$.next(le(x({},this.organizationMetadata$.value),{[i]:c}))}).catch(c=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",c)})}}catch(i){this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)}})}fetchDocumentMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,o=this.documentMetadata$.value;if(t=t.filter(s=>!o?.[s.documentId]),t?.some(s=>!s?.documentId||!s?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let s=i?.folderId,a=[],c={organizationId:i?.clientOrganizationId,folderId:s},l=[],u=20;for(let f=0;f<t.length;f+=u)l.push(t.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchDocuments(g))});let d={};a.length>0&&(yield Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=p.metadata)})}),this.setAllDocumentMetadata(x(x({},this.documentMetadata$.value),d))}).catch(f=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",f)}))}else o?.[i?.documentId??t?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??t?.[0]?.documentId,skipObjectValues:!0}}).then(s=>{s?.documentId&&this.setDocumentMetadata(s.documentId,s)}).catch(s=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",s)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}})}fetchLocationMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,i=this.documentIds$.value,o=t?.folderId,s=t?.allDocuments,a=[],c={organizationId:t?.clientOrganizationId,folderId:o,allDocuments:s},l=[],u=20;for(let f=0;f<i.length;f+=u)l.push(i.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchLocations(g))});let d=this.locationMetadata$.value??{};a.length>0&&Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=le(x({},d?.[p.metadata.documentId]??{}),{[p.location.id]:p}))})}),Object.keys(d||{}).length>0&&this.locationMetadata$.next(d)}).catch(f=>{this.loggingService.catch("Error in fetchLocationMetadata: ",f)})}}catch(t){this.loggingService.catch("Error in fetchLocationMetadata: ",t)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(ts(i=>ue(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(t){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",t)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(fe(t=>t?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(t){try{return`${Tr(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${Fi(t)}`}catch(i){return this.loggingService.catch("Error in generateOrganizationId: ",i),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:void 0,methodName:"setLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:kn.SET_LOCATION,payload:{locations:[t],options:void 0}}),this.setLocationsImpl({locations:[t]})}catch(s){this.loggingService.catch("Error in setLocation: ",s)}})}setLocations(s){return I(this,arguments,function*({locations:t,options:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:t,options:i,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.SET_LOCATIONS,source:o,payload:{locations:t,options:i}}),this.setLocationsImpl({locations:t,options:i})}catch(a){this.loggingService.catch("Error in setLocations: ",a)}})}getValidLocations(t){try{let i=[];return t&&Array.isArray(t)&&t.forEach(o=>{if(o&&typeof o=="object"){let s=!0;o?.version&&(!o?.version?.id||!o?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${o?.id}, If you're setting version then add id and name fields to version object.`),s=!1),s&&i.push(o)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return t}setRootLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:t,methodName:"setRootLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:kn.SET_ROOT_LOCATION,source:i,payload:{location:t}});let s=Object.values(this.locations$.value).map(a=>a.location).filter(a=>String(a.id)!==String(t.id));this.setLocationsImpl({locations:[t,...s],options:{rootLocationId:t.id}})}catch(s){this.loggingService.catch("Error in DocService setRootLocation:",s)}})}setLocationsImpl({locations:t,options:i}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),t.length===0)return;if(!this.authService.getUser()){!i?.appendLocation&&t.length>0&&(this.draftLocationMap.options=le(x(x({},this.draftLocationMap.options??{}),i??{}),{rootLocationId:t[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...t],this.draftLocationMap.options=x(x({},this.draftLocationMap.options),i);return}let s=this.getValidLocations(t),a=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(d=>d.location.id)].filter(d=>d!==void 0);let l;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(l=s.find(d=>d.id===i?.rootLocationId),!l)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(i?.appendLocation){if(l){let d=Sd(l),f=Tr(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}}else{l||(l=s[0]);let d=Sd(l),f=Tr(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}let u=[];return s.slice(i?.appendLocation?0:1).forEach(d=>{if(d.id!==this.location$.value?.location.id){let f=x({},d),g=this.locations$.value;d?.id&&Object.keys(g).forEach(D=>{let b=g[D];b.location?.id===d.id&&(f=x(x({},b.location),d),delete g?.[D])});let p=this.genarateLocationId(f),_={locationId:p,location:f};f.id&&a.push({locationId:p,location:f}),u.push(_);let T=le(x({},g),{[p]:_});this.locations$.next(T)}}),this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:kn.SET_LOCATIONS,payload:{locations:s,options:i}}),this.analyticsService.trackEvent(L.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:s,options:i},!0,this.getUserIdForAnalytics()),u}catch(o){this.loggingService.catch("Error in setLocationImpl: ",o);return}}addLocation({location:t,source:i="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:{appendLocation:!0},methodName:"addLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.ADD_LOCATION,source:i,payload:{locations:[t],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[t],options:{appendLocation:!0}})}catch(o){this.loggingService.catch("Error in DocService addLocation:",o);return}}removeLocation({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[t],methodName:"removeLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:kn.REMOVE_LOCATION,payload:{locations:[t]}}),t&&this.removeLocationsImpl([t],i)}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}removeLocations({locations:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t,methodName:"removeLocations",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:kn.REMOVE_LOCATIONS,source:i,payload:{locations:t}}),this.removeLocationsImpl(t,i)}catch(o){this.loggingService.catch("Error in removeLocations: ",o)}}removeLocationsImpl(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),t?t.forEach(o=>{let s=this.genarateLocationId(o);this.getLocation()?.locationId===s&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==o.id))),this.removeCustomLocation(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}unsetLocationIds(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:kn.UNSET_LOCATION_IDS,source:i,payload:{locationIds:t}}),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:t},methodName:"unsetLocationIds",message:"System unset location ids",source:i},!0,this.getUserIdForAnalytics()),t?.length?t.forEach(o=>{this.getLocation()?.location.id===o&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==o))),this.removeCustomLocationId(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:kn.REMOVE_LOCATIONS_SUCCESS,source:i,payload:{locationIds:t}}),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetLocationIds: ",o)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(t){try{this.excludedLocationIds$.next([...t])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(t){return this.loggingService.catch("Error in getExcludedLocationIds$: ",t),ue([])}}updateOrganizationMetadata(t){return I(this,null,function*(){try{!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig());let i=t?.organizationId,o=t?.clientOrganizationId,s=this.documentPaths$.value;if(this.db&&i&&s?.documentId){if(this.organizationMetadata$.value?.[i])return;let c=new kT;c.apiKey=this.configService?.getApiKey()??"",c.organizationId=i,c.clientOrganizationId=o;let l=this.authService.getUser()?.userId??"",u=o?yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o}):null;!!(l&&o&&u?.[l]?.organization?.[o]?.errorCode===Oo.PERMISSION_DENIED)?this.loggingService.log(`%c[WB] updateOrganizationMetadata skipped \u2014 user does not have access to organization: ${o}`,"color: orange;"):this.userPermissionService?.hasEditAccess({organizationId:i})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(c)),properties:{organizationId:i,documentId:s?.documentId??""}})),yield this.fetchOrganizationMetadata(t)}}catch(i){this.loggingService.catch("Error in updateOrganizationMetadata: ",i)}})}updateFolderMetadata(){return I(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let t=this.documentPaths$.value;if(!t?.veltFolderId||!t?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:t?.organizationId??"",folderId:t?.veltFolderId??""}}))?.metadata){let o={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:t?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let s=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Ad({methodName:"createFolder",data:{type:"createFolder",metadata:o},getSdkProxy:s,userId:this.authService.getUser()?.userId??""})}}}}catch(t){this.loggingService.catch("Error in updateFolderMetadata: ",t)}})}updateDocumentMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let i=this.getDocumentIds();i.find(s=>s.documentId===t.documentId)||i.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});let o=i.map(s=>I(this,null,function*(){let a=new PT;this.clientDocumentMetadataMap?.[s.clientDocumentId]&&(a=x(x({},this.clientDocumentMetadataMap[s.clientDocumentId]),a)),a.apiKey=this.configService?.getApiKey()??"",a.documentId=s.documentId,a.clientDocumentId=s.clientDocumentId,a.organizationId=t.organizationId,a.clientOrganizationId=t.clientOrganizationId,a.pageInfo=Cg(s.clientDocumentId);let c=t?.folderId,l=t?.veltFolderId;a?.pageInfo?.deviceInfo&&delete a?.pageInfo?.deviceInfo;let u=!0,d=this.documentMetadata$.value?.[s.documentId];if(c&&l){let f=this.getDocumentMetadata(s?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}}));f?.clientDocumentId&&!f?.errorCode?f?.folderId&&(f?.folderId!==c||f?.veltFolderId!==l)?(this.loggingService.catch(`Folder id mismatch for document ${s?.clientDocumentId??""}`),u=!1):f?.folderId===c?(c&&(a.folderId=c),l&&(a.veltFolderId=l)):(this.loggingService.catch(`Document ${s?.clientDocumentId??""} is not in the folder ${c??""}`),u=!1):(c&&(a.folderId=c),l&&(a.veltFolderId=l))}if(d){let f={};Object.entries(a).forEach(([g,p])=>{f[g]=p}),ki(f,d)&&(u=!1)}u&&this.userPermissionService?.hasEditAccess({documentId:s?.documentId??"",folderId:t?.allDocuments&&t?.veltFolderId?t?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:t?.organizationId??"",documentId:s?.documentId??""}}))}));yield Promise.allSettled(o),yield this.fetchDocumentMetadata(i)}}}catch(t){this.loggingService.catch("Error in updateDocumentMetadata: ",t)}})}updateDocumentLocationMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let o=this.getDocumentIds();o.find(s=>s.documentId===i.documentId)||o.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let s of o){let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}});a?.errorCode&&(a={});let c=[];for(let l of t){let u=new FT;u.locationId=l?.locationId,u.veltLocationId=CC(l?.location?.id??""),u.location=l?.location,u.pageInfo=Cg(s?.clientDocumentId),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let d=le(x({},a),{[v.FIREBASE_PARTIAL_PATH_LOCATIONS]:le(x({},a[v.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[l?.locationId]:u})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??""}}));let f=this.locationMetadata$.value;if(f||(f={}),l?.location?.id){let g=f?.[s.documentId],p=g?.[l?.location?.id??""];f&&(g||(f[s.documentId]={}),p||(f[s.documentId][l?.location?.id??""]={}),f[s.documentId][l?.location?.id??""]=le(x({},p),{location:l?.location})),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}}yield Promise.allSettled(c)}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(t){try{return t&&typeof t=="object"?Tr(JSON.stringify(Sd(t))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(t,i="internal"){try{let o=this.genarateLocationId(t),s=this.locations$.value;s[o]&&(delete s[o],this.locations$.next(x({},s)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==t.id)))}catch(o){this.loggingService.catch("Error in DocService removeLocation:",o)}}removeCustomLocationId(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let o=this.locations$.value;Object.entries(o).forEach(([s,a])=>{a.location.id===t&&(delete o[s],this.locations$.next(x({},o)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.id!==t)))})}catch(o){this.loggingService.catch("Error in DocService removeCustomLocationId:",o)}}getLocationByClientLocationId(t){try{let i=this.getLocation()?.location;if(i?.id===t)return i;{let o=this.getLocations();Object.keys(o).forEach(s=>{let a=o[s];a.location?.id===t&&(i=a.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let t=this.locations$.value,i=document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}]`),o=[];i.forEach(s=>{let a=s.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(a){let c=JSON.parse(a),l=this.genarateLocationId(c);o.push(l)}}),Object.keys(t).forEach(s=>{let a=t[s];o.includes(a.locationId)||delete t[s]}),this.locations$.next(x({},t))}catch(t){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",t)}}getLocations$(){try{return this.locations$.asObservable()}catch(t){return this.loggingService.catch("Error in DocService getLocations$:",t),ue({})}}getLocations(){try{return this.locations$.value}catch(t){return this.loggingService.catch("Error in DocService getLocations:",t),{}}}getLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(t?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)?i=t:i=t.closest(`[${v.ATTRIBUTES.VELT_LOCATION}]`),i){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o){let s=JSON.parse(o);return{locationId:this.genarateLocationId(s),location:s}}}return null}catch(i){return this.loggingService.catch("Error in DocService getLocationFromElement:",i),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let t={};return document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(o=>{if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let s=this.getLocationFromElement(o);s?.locationId&&(t[s.locationId]={element:o,location:s})}else if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let s=o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(s){let a=this.getLocationByClientLocationId(s);a?.locationId&&(t[a.locationId]={element:o,location:a});let c={id:s},l=this.genarateLocationId(c);t[s]={element:o,location:{locationId:l,location:c}}}}}),t}catch(t){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",t),{}}}getAdditionLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=t?.closest(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o)return JSON.parse(o)}else if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(o)return{id:o}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(t){try{return t?.closest(`[${v.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(v.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(t){try{return t?this.documentMetadata$.value?.[t]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata$(t){return this.getAllDocumentMetadataMap$().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let t=this.documentMetadata$.value||{},i={},o=this.documentPaths$.value?.veltFolderId,s=this.documentPaths$.value?.allDocuments;if(o&&s)Object.values(t).forEach(a=>{a?.documentId&&a?.veltFolderId===o&&(i[a.documentId]=a)});else{let a=this.documentIds$.value;if(a?.length)a.forEach(c=>{let l=t?.[c.documentId];l&&(i[c.documentId]=l)});else if(this.documentPaths$.value?.documentId){let c=t?.[this.documentPaths$.value?.documentId];c&&(i[this.documentPaths$.value?.documentId]=c)}}return Object.values(i)}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",t),[]}}getDocumentMetadata$(t){return this.documentMetadata$.asObservable().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}setDocumentMetadata(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let o=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));o[t]=i,this.documentMetadata$.next(o)}catch(o){this.loggingService.catch("Error in DocService setDocumentMetadata:",o)}}setAllDocumentMetadata(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(t)}catch(i){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",i)}}getOrganizationMetadata(t){return this.organizationMetadata$.value?.[t]||null}getOrganizationMetadata$(t){return this.organizationMetadata$.asObservable().pipe(fe(i=>i?.[t]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(it(Ft))}getOrganizationConfig(){return this.organizationConfig$.value}setOrganizationConfig(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setOrganizationConfig","color: green;");let i=JSON.parse(JSON.stringify(t));this.organizationConfig$.next(i)}catch(i){return this.loggingService.catch("Error in DocService setOrganizationConfig:",i),!1}return!0}getMetadataFromType(t,i){try{switch(t){case"area":return;case"comment":return i?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(i.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return i?.commentAnnotationId?this.commentService?.getAnnotationById(i.commentAnnotationId)?.metadata:void 0;default:return}}catch(o){this.loggingService.catch("Error in DocService getMetadataFromType:",o);return}}getDefaultMetadata({clientDocumentId:t,documentId:i}){try{let o=this.documentPaths$.value;if(!o)return;let s=t||o.clientDocumentId,a=i||o.documentId,c=this.getDocumentMetadata(a);if(!c)return;let l=c?.folderId,u=c?.veltFolderId;return x(x({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:s,clientOrganizationId:o.clientOrganizationId,documentId:a,organizationId:o.organizationId},l?{folderId:l}:{}),u?{veltFolderId:u}:{})}catch(o){this.loggingService.catch("Error in DocService getDefaultMetadata:",o);return}}getBaseMetadata(t,i){try{let o,s;i?.element?o=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(o=i.clientDocumentId),o&&(s=this.generateDocumentId(o));let a=this.getMetadataFromType(t,i),c=this.getDefaultMetadata({clientDocumentId:o,documentId:s}),l=a||c||{};return l.sdkVersion=jr(),l}catch(o){return this.loggingService.catch("Error in DocService getBaseMetadata:",o),{}}}getServerId({documentId:t,organizationId:i}){try{return t&&(t=this.generateDocumentId(t)),i&&(i=this.generateOrganizationId(i)),{documentId:t,organizationId:i}}catch(o){return this.loggingService.catch("Error in DocService getServerId:",o),null}}fetchDocuments(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(t?.folderId){let a=wo(t?.folderId);o.push(Ji("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ji("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(t?.folderId){let a=wo(t?.folderId);o.push(Ji("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ji("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(t){return I(this,null,function*(){try{if(typeof t=="object"&&(t=JSON.parse(JSON.stringify(t??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,documents:s,folderId:a}=t;if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let c=Ts(o);if(!s||s.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let l=[],u=this.documentMetadata$.value??{};for(let d of s)if(d?.documentId){d.organizationId=c,d.clientOrganizationId=o,d.clientDocumentId=d.documentId;let f=da(d.documentId);d.documentId=f,d.apiKey=this.configService.getApiKey()??void 0,(a||this.documentPaths$.value?.folderId)&&(d.folderId=a||this.documentPaths$.value?.folderId,d.veltFolderId=wo(a||this.documentPaths$.value?.folderId||""));let g=()=>{if(a&&this.documentPaths$.value?.folderId&&a!==this.documentPaths$.value?.folderId)return;let _=u?.[f];_?u[f]=x(x({},_),d):u[f]=d},p=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:f,organizationId:c,field:"metadata"}});if(p?.errorCode&&(p={}),p&&p.apiKey&&p.folderId&&a&&p.folderId!=d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists with different folderId: ${p.folderId}`);continue}if(p&&p.apiKey&&!p.folderId&&d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists, move this document to folder with REST API`);continue}g(),d&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:d?.documentId??""})&&l.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{organizationId:c,documentId:f}}))}yield Promise.all(l),this.setAllDocumentMetadata(u)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,locations:s,documentIds:a}=t;if((!a||a.length===0)&&(a=this.documentIds$.value.map(d=>d.clientDocumentId)??[],a.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!s||s.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=a.map(d=>da(d)),l=[],u=this.locationMetadata$.value;u||(u={}),c.forEach(d=>{s.forEach(f=>{let g=this.location$.value;if(f?.id===g?.location?.id&&this.location$.next({locationId:g?.locationId,location:f}),f?.id){delete f?.metadata;let p=CC(f.id),_=u?.[d],T=_?.[f.id];u&&(_||(u[d]={}),T||(u[d][f.id]={}),u[d][f.id]=le(x({},T),{location:f})),f&&this.commonDbService&&l.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:f})),properties:{organizationId:Ts(o),documentId:d,id:p}}))}})}),yield Promise.all(l),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let s=[],a=this.generateOrganizationId(t?.organizationId);if(t?.folderId){let c=wo(t?.folderId);o=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}}),o&&(o=[o]),s=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[Ji("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}})}else o=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}});return{data:o,parentFolders:s}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(mt(t=>t?this.documentPaths$.pipe(mt(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(fe(o=>o?.data?.docIamConfig??o?.data),it((o,s)=>JSON.stringify(o??{})===JSON.stringify(s??{}))):ue(null))):ue(null)))}getDocumentAccessType(t){try{return t&&t.features&&t.features.all?t.features.all.restricted?wt.RESTRICTED:wt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:wt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),wt.PUBLIC}}changeDocumentAccessType(t){return I(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let o=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});if(o?.errorCode)return;switch(delete o.documentAccessType,o.features||(o.features={}),o.features.all||(o.features.all={}),t){case wt.PUBLIC:o.features.all.restricted=!1;break;case wt.RESTRICTED:o.features.all.restricted=!0,o.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(o)),properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}}catch(i){this.loggingService.catch("Error in DocService changeDocumentAccessType:",i)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(t){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",t),""}}setUIState(t){try{this.uiState.next(x(x({},this.uiState.value),t))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Cr),w(Wy),w(Ev),w(Rr),w(_e),w(zo),w(qo),w(ec),w(It),w(dr),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zt=(()=>{let e=class e{constructor(t,i,o,s,a){this.analyticsService=t,this.authService=i,this.coreActionsService=o,this.docService=s,this.loggingService=a,this.resolveOrganizationUsers=new Y(!0),this.resolveFolderUsers=new Y(!0),this.resolveDocumentUsers=new Y(!0),this.unresolvedUsers=new Y([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new gt,this.userDataProvider$=new Y(null),this.anonymousUserDataProvider$=new Y(null),this.userIdByEmailCache={},this.userById$=new Y({}),this.customContactUserById$=new Y({}),this.userByIdCalled$=new Y({}),this.pendingResolutions=new Set,this.getUserById=c=>{try{let l=this.userById$.value?.[c],u=this.customContactUserById$.value?.[c];return u?l?x(x({},l),u):u:l}catch(l){this.loggingService.catch("Error in UsersService getUserById:",l);return}};try{this.docService.setUsersService(this),this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Ct(c=>!!c),mt(()=>this.getUnresolvedUsers$().pipe(Ct(c=>c.length>0),Au(300),Nt(20),mt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[MM(Ji("user.userId","in",c.slice(0,20)))]}}).pipe(fe(u=>u?.data),Ks(u=>{if(u&&typeof u=="object"){delete u.undefined,delete u.null;let d=Object.values(u??{});this.setUserByIds(d.map(g=>g.user));let f=c.filter(g=>!d.some(p=>p.user.userId===g));f.length!==c.length&&this.setUnresolvedUsers(f)}})):ue([])})))).subscribe()}catch(c){this.loggingService.catch("Error in UsersService constructor:",c)}}setCommonDbService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=t}catch(i){this.loggingService.catch("Error in UsersService setCommonDbService:",i)}}setContactService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactService","color: green;"),this.contactService=t}catch(i){this.loggingService.catch("Error in UsersService setContactService:",i)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(t){this.loggingService.catch("Error in UsersService ngOnDestroy:",t)}}isResolverForFeatureDisabled(t){let i=this.userDataProvider$.getValue();try{switch(t){case"allOrganizationUsers":return i?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return i?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return i?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(o){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",o),!1}}resolveUsers(u){return I(this,arguments,function*({userIds:t,forceResolve:i,feature:o,organizationId:s,skipUserCheck:a=!1,uniqueId:c,moduleName:l}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let d=!1;if(o&&(d=this.isResolverForFeatureDisabled(o)),d)return{};{let f={},g=[],p={};if(t?.forEach(_=>{let T=this.getUserById(_);T?f[_]=T:this.userByIdCalled$.getValue()[_]?i&&g.push(_):(g.push(_),this.userByIdCalled$.next(le(x({},this.userByIdCalled$.getValue()),{[_]:!0})))}),g.length>0){let _=c||J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:xn.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={};try{let D,b=new Promise((G,M)=>{D=setTimeout(()=>{M(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});T=yield Promise.race([this.getUsersFromDB({userIds:g,organizationId:s,skipUserCheck:a}).finally(()=>{clearTimeout(D)}),b]),this.analyticsService.trackEvent(L.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(D){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",D,{userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:D,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{g?.forEach(D=>{if(!T[D]){let b=new Set([...this.getUnresolvedUsers(),D]);this.unresolvedUsers.next(Array.from(b)),T[D]={userId:D,name:`User ${D}`}}})}Object.entries(T).forEach(([D,b])=>{b&&(f[D]=T?.[D],p[D]=T?.[D])})}return Object.keys(p).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(p)),this.mergeUsersIntoStore(Object.values(p)),Object.keys(p).forEach(_=>{let T=this.getUserById(_);T&&(f[_]=T)})),f}}catch(d){this.loggingService.catch("Error in UsersService resolveUsers:",d);let f=c||J();return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:d,userIds:t,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(t){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",t),[]}}setUnresolvedUsers(t){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(t)){let i=JSON.parse(JSON.stringify(t));this.unresolvedUsers.next(i)}}catch(i){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",i)}}getUsersFromDB(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let a=this.userDataProvider$.getValue();if(a){if(a.config?.getConfig?.url){if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return this.loggingService.catch("Error in getUsersFromDB: organizationId is required when using getConfig"),{};let d={organizationId:i,userIds:t},f=yield Ht(a.config.getConfig.url,a.config.getConfig.headers,d,!0,a.config.getConfig.credentials);return f.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${f.statusCode}. Message: ${f.message||"Unknown error"}`),{}):f.data??{}}let u=yield a.get(t);if(u&&typeof u=="object"&&"success"in u&&"statusCode"in u&&typeof u.success=="boolean"&&typeof u.statusCode=="number"){let d=u;return d.statusCode===200&&d.data?d.data:(this.loggingService.catch(`Error in getUsersFromDB: provider returned error response with statusCode ${d.statusCode}`),{})}return u}if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:t,organizationId:i,skipUserCheck:o}))??[];this.contactService?.setResolvedUsers(c.flat());let l={};return c.forEach(u=>{u.forEach(d=>{d?.user?.userId&&(l[d.user.userId]=d.user)})}),l}catch(a){return this.loggingService.catch("Error in UsersService getUsersFromDB:",a),{}}})}getUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){try{if(!t?.length)return[];let a=[];for(let u=0;u<t.length;u+=30)a.push(t.slice(u,u+30));let c=a.map((u,d)=>I(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[Ji("user.userId","in",u)],skipUserCheck:o}}))||[]}catch(f){return this.loggingService.catch(`Error in batch ${d+1}:`,f),[]}}));return yield Promise.all(c)}catch(a){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",a),[]}})}getTemporaryUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,resourceIds:o}){try{if(!t?.length||!o?.length)return[];let a=[];for(let _=0;_<t.length;_+=30)a.push(t.slice(_,_+30));let c=[];for(let _=0;_<o.length;_+=30)c.push(o.slice(_,_+30));let l=[],u=0,d=(_,T)=>I(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[MM(Ji("userId","in",_),Ji("veltResourceId","in",T))]}}))??[])||[]}catch(D){return this.loggingService.catch(`Error in batch ${u+1}:`,D),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,D)=>T===D.findIndex(b=>b.userId===_.userId&&b.resourceId===_.resourceId))}catch(a){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",a),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),Zr([this.userById$,this.customContactUserById$]).pipe(fe(([t,i])=>this.applyContactOverlay(t,i)),it(Ft))}catch(t){return this.loggingService.catch("Error in UsersService getUserById$:",t),ue({})}}applyContactOverlay(t,i){let o=x({},t??{});return Object.entries(i??{}).forEach(([s,a])=>{o[s]=x(x({},o[s]??{}),a)}),o}setUserByIds(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;"),this.mergeUsersIntoStore(t)}catch(i){this.loggingService.catch("Error in UsersService setUserByIds:",i)}}setContactListUsers(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactListUsers","color: green;");let i={};(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=JSON.parse(JSON.stringify(o)))}),this.customContactUserById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService setContactListUsers:",i)}}getContactListUser(t){try{return this.customContactUserById$.value?.[t]}catch(i){this.loggingService.catch("Error in UsersService getContactListUser:",i);return}}mergeUsersIntoStore(t){try{let i=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=x(x({},i?.[s]??{}),o))}),this.userById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService mergeUsersIntoStore:",i)}}setUserDataProvider(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;");let i=t.config?.getConfig?.url,o="get"in t&&typeof t.get=="function";if(!i&&!o){this.loggingService.catch("DataProviders.user is invalid. The get method is missing or is not a function (and no getConfig provided).");return}this.userDataProvider$.next(t),t.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),t.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),t.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}setAnonymousUserDataProvider(t){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setAnonymousUserDataProvider","color: green;"),!("resolveUserIdsByEmail"in t)||typeof t.resolveUserIdsByEmail!="function"){this.loggingService.catch("setAnonymousUserDataProvider is invalid. The resolveUserIdsByEmail method is missing or is not a function.");return}this.anonymousUserDataProvider$.next(t)}catch(i){this.loggingService.catch("Error in UsersService setAnonymousUserDataProvider:",i)}}resolveUserIdsByEmail(o){return I(this,arguments,function*({emails:t,uniqueId:i}){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUserIdsByEmail","color: green;"),!t?.length)return{};let s=this.anonymousUserDataProvider$.getValue();if(!s||typeof s.resolveUserIdsByEmail!="function")return{};let a=[...new Set(t.filter(M=>!!M))];if(a.length===0)return{};let c={},l=[];if(a.forEach(M=>{let U=this.userIdByEmailCache[M];U?c[M]=U:l.push(M)}),l.length===0)return c;let u=this.docService.getOrganizationConfig()?.clientOrganizationId||"",d=this.docService.getDocumentPaths()?.clientDocumentId||"",f=this.docService.getDocumentPaths()?.folderId||"",g={organizationId:u,documentId:d,folderId:f,emails:l},p=i||J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,D=new Promise((M,U)=>{T=setTimeout(()=>{U(new Error("resolveUserIdsByEmail timeout"))},_)}),b=s.config?.getRetryConfig||{retryCount:0,retryDelay:0},G=I(this,null,function*(){try{let M=yield kt(()=>s.resolveUserIdsByEmail(g),"resolveUserIdsByEmail",b);return M?.statusCode===200&&M?.data?M.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${M?.statusCode}. Message: ${M?.message||"Unknown error"}`),{})}finally{clearTimeout(T)}});try{let M=yield Promise.race([G,D]);return Object.entries(M).forEach(([U,k])=>{k&&(this.userIdByEmailCache[U]=k,c[U]=k,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:k,name:U,email:U},currentUserId:this.authService.getUser()?.userId??""}).catch(S=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",S)}))}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:M,emails:l}}),c}catch(M){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",M),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:M,emails:l}}),c}}catch(s){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail:",s),{}}})}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",t),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(t){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Cr),w(It),w(zh),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var tc=class{static getFirestoreProdDbName(e,r){return r?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||r?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":r?.storeDbId??(this.isTestingDb(r?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(r){return H.error("Error in isTestingDb:",r),!1}}};var Ky=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.commentAnnotationsResolverService=c,this.attachmentResolverService=l,this.coreActionsService=u,this.notificationActionTypeMap={[Ie.NEWLY_ADDED]:Qt.COMMENT_ANNOTATION_ADD,[Ie.ADDED]:Qt.COMMENT_ADD,[Ie.UPDATED]:Qt.COMMENT_UPDATE,[Ie.DELETED]:Qt.COMMENT_DELETE},this.additionalEventTypeMap={[Ie.STATUS_CHANGED]:Xn.STATUS_CHANGE,[Ie.PRIORITY_CHANGED]:Xn.PRIORITY_CHANGE,[Ie.ASSIGNED]:Xn.ASSIGN,[Ie.ACCESS_MODE_CHANGED]:Xn.ACCESS_MODE_CHANGE,[Ie.CUSTOM_LIST_CHANGED]:Xn.CUSTOM_LIST_CHANGE,[Ie.APPROVED]:Xn.APPROVE,[Ie.ACCEPTED]:Xn.ACCEPT,[Ie.REJECTED]:Xn.REJECT,[Ie.SUGGESTION_ACCEPTED]:Xn.SUGGESTION_ACCEPT,[Ie.SUGGESTION_REJECTED]:Xn.SUGGESTION_REJECT,[Ie.REACTION_ADDED]:Xn.REACTION_ADD,[Ie.REACTION_DELETED]:Xn.REACTION_DELETE,[Ie.SUBSCRIBED]:Xn.SUBSCRIBE,[Ie.UNSUBSCRIBED]:Xn.UNSUBSCRIBE}}setNotificationService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}setUserPermissionService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",i)}}getUserIdsToResolveFromComments(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let o of t){if(o?.from?.userId&&i.add(o?.from?.userId),o?.comments)for(let s of o?.comments){if(s?.from?.userId&&i.add(s?.from?.userId),s?.to)for(let a of s?.to)a?.userId&&i.add(a?.userId);if(s?.taggedUserContacts)for(let a of s?.taggedUserContacts)a?.userId&&i.add(a?.userId)}if(o?.assignedTo?.userId&&i.add(o?.assignedTo?.userId),o?.resolvedByUserId&&i.add(o?.resolvedByUserId),o?.suggestion?.resolvedBy?.userId&&i.add(o?.suggestion?.resolvedBy?.userId),o?.subscribedUsers)for(let s of Object.values(o?.subscribedUsers))s.user.userId&&i.add(s.user.userId);if(o?.unsubscribedUsers)for(let s of Object.values(o?.unsubscribedUsers))s.user.userId&&i.add(s.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.suggestion?.resolvedBy?.userId){let i=this.usersService.getUserById(t?.suggestion?.resolvedBy?.userId);i&&(t.suggestion.resolvedBy=i)}if(t?.comments)for(let i of t?.comments){if(i?.from?.userId){let s=this.usersService.getUserById(i?.from?.userId);s&&(i.from=s)}i?.to&&(i.to=i?.to?.map(s=>{if(s?.userId){let a=this.usersService.getUserById(s?.userId);if(a)return x(x({},s),a)}return s})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(s=>{if(s?.contact){let a=this.usersService.getUserById(s?.contact?.userId);a&&(s.contact=a,(a?.name||a?.email)&&(s.text=`@${a?.name||a?.email}`))}return s}));let o=i?.taggedUserContacts?.filter((s,a,c)=>c.findIndex(l=>l.text===s.text)===a)||[];o.sort((s,a)=>(a.text?.length||0)-(s.text?.length||0)),o.forEach(s=>{if(s?.text){let a=new RegExp(rl(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(rl(`@User ${s.userId}`),"g")),i.commentText=i.commentText?.replaceAll(a,s.text),i.commentHtml=i.commentHtml?.replaceAll(a,s.text)}})}if(t?.assignedTo?.userId){let i=this.usersService.getUserById(t?.assignedTo?.userId);i&&(t.assignedTo=i)}if(t?.resolvedByUserId){let i=this.usersService.getUserById(t?.resolvedByUserId);i&&(t.resolvedByUser=i)}if(t?.subscribedUsers)for(let i of Object.values(t?.subscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.subscribedUsers?.id?.user&&(t.subscribedUsers.id.user=o)}if(t?.unsubscribedUsers)for(let i of Object.values(t?.unsubscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.unsubscribedUsers?.id?.user&&(t.unsubscribedUsers.id.user=o)}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),t}}formatCommentData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),t?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),t?.viewedBy&&delete t.viewedBy,t?.unread!==void 0&&delete t.unread,t?.resolvedByUser!==void 0&&delete t.resolvedByUser,t?.comments&&t.comments.forEach(i=>{i?.reactionAnnotations&&delete i.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.assignedTo?.userId&&(t.assignedTo={userId:t.assignedTo.userId}),t?.subscribedUsers)for(let i of Object.keys(t?.subscribedUsers))t.subscribedUsers[i].user={userId:t?.subscribedUsers[i].user.userId};if(t?.unsubscribedUsers)for(let i of Object.keys(t?.unsubscribedUsers))t.unsubscribedUsers[i].user={userId:t?.unsubscribedUsers[i].user.userId};t?.suggestion?.resolvedBy?.userId&&(t.suggestion.resolvedBy={userId:t.suggestion.resolvedBy.userId})}return t?.comments&&(t.comments=t?.comments?.map(i=>this.formatCommentThreadData(i))),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),t}}mergeStrippedDataWithCommentAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t?.annotationId),o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove();return i&&(t?.comments?.forEach(a=>{let c=i?.comments?.[a?.commentId];if(c){a.commentHtml=c?.commentHtml,a.commentText=c?.commentText;let l=c?.attachments;o&&l&&a.attachments?.forEach(u=>{let d=u?.attachmentId;l?.[d]&&(u.name=l?.[d]?.name,u.url=l?.[d]?.url)})}}),i?.targetTextRange?.text&&t?.targetTextRange&&(t.targetTextRange.text=i?.targetTextRange?.text),s?.length>0&&s.forEach(a=>{i?.[a]&&(t[a]=i[a])})),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),t}}mergeLocationWithCommentAnnotations(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let o=t?.location?.id,s=t?.metadata?.documentId;if(!o||!s)return t;let a=i?.[s]?.[o];return a&&(t.location=a?.location),t}catch(o){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",o),t}}isCommentsDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let o=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return o?!ki(t,o):!0}catch(o){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",o),!0}}stripCommentsFromAnnotationData({comment:t}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let i=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!i)return t;let o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=new LT;if(Object.assign(s,t),s.isCommentResolverUsed=i,o){let a=s.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));s.attachments=a}return delete s?.commentHtml,delete s?.commentText,s}catch(i){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",i),t}}resolveTaggedUserEmails(t){return I(this,null,function*(){try{let i=new Set;if(t.comments?.forEach(o=>{o.taggedUserContacts?.forEach(s=>{s?.contact?.email&&!s?.userId&&i.add(s.contact.email)}),o.to?.forEach(s=>{s?.email&&!s?.userId&&i.add(s.email)})}),i.size>0){let o=J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:Array.from(i)}});let s=yield this.usersService.resolveUserIdsByEmail({emails:Array.from(i),uniqueId:o});Object.keys(s).length>0&&t.comments?.forEach(a=>{a.taggedUserContacts?.forEach(c=>{if(c?.contact?.email&&!c?.userId){let l=s[c.contact.email];if(l){let u=c.text;if(u){let d=rl(u),f=new RegExp(d,"g");a.commentText&&(a.commentText=a.commentText.replace(f,`{{${l}}}`)),a.commentHtml&&(a.commentHtml=a.commentHtml.replace(f,`{{${l}}}`))}c.userId=l,c.contact.userId=l,delete c.contact?.email,delete c.contact?.visibility,c.text=""}}}),a.to=a.to?.map(c=>{if(c?.email&&!c?.userId){let l=s[c.email];if(l)return delete c?.email,delete c?.visibility,le(x({},c),{userId:l})}return c})})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService resolveTaggedUserEmails:",i),t}})}stripCommentAnnotationData(s){return I(this,arguments,function*({data:t,actionType:i,commentId:o}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),t=yield this.resolveTaggedUserEmails(t),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),c=this.commentAnnotationsResolverService.getFieldsToRemove(),l=this.commentAnnotationsResolverService.getAdditionalFields(),u,d;i&&(u=this.notificationActionTypeMap?.[i],d=this.additionalEventTypeMap?.[i]);let f=this.commentAnnotationsResolverService.getAdditionalSaveEvents(),g=Array.isArray(f)?f:[],p={},_=null,T=!1;if(t&&t.annotationId){let M=t.annotationId;if(p[M]=x(x(x(x({annotationId:M,metadata:Cn(t.metadata??{}),comments:{}},t?.from&&{from:t?.from}),t?.assignedTo&&{assignedTo:t?.assignedTo}),t?.resolvedByUserId&&{resolvedByUserId:t?.resolvedByUserId}),t?.targetTextRange?.text&&{targetTextRange:{text:t?.targetTextRange?.text}}),delete t?.targetTextRange?.text,c?.length>0&&c.forEach(k=>{t?.[k]&&(p[M][k]=t[k],delete t[k])}),l?.length)for(let k of l)t?.[k]!==void 0&&(p[M][k]=JSON.parse(JSON.stringify(t[k])));t.comments?.forEach(k=>{if(k.commentId){let S;a&&(S={},k.attachments?.forEach(A=>{S[A.attachmentId]={attachmentId:A.attachmentId,name:A.name,url:A.url}})),p[M].comments[k.commentId]=x(x(x(x(x(x({commentId:k.commentId},k?.commentHtml&&{commentHtml:k?.commentHtml}),k?.commentText&&{commentText:k?.commentText}),S&&{attachments:S}),k?.from&&{from:k?.from}),k?.to&&{to:k?.to}),k?.taggedUserContacts&&{taggedUserContacts:k?.taggedUserContacts})}}),T=this.isCommentsDataChanged(p[M],M);let U=new bT;Object.assign(U,t),c?.length>0&&c.forEach(k=>{k in t||delete U[k]}),U.comments=t.comments?.map(k=>this.stripCommentsFromAnnotationData({comment:k}))||[],_=U}let D=_?.comments?.find(M=>M.commentId===o);D?.isDraft&&(u=_?.comments?.length&&_?.comments?.length>0?Qt.COMMENT_ADD:Qt.COMMENT_ANNOTATION_ADD);let b=!!i&&!!this.notificationActionTypeMap?.[i],G=!!d&&!!_&&!b&&!D?.isDraft&&g.includes(d);return G&&(u=d),{strippedData:T&&(i&&this.notificationActionTypeMap?.[i]||D?.isDraft)||G?p:null,originalData:_,eventType:u}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{strippedData:null,originalData:null}}})}formatCommentThreadData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to&&(t.to=t?.to?.map(o=>o?.userId?{userId:o.userId}:o)),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(o=>o?.contact?.userId?le(x({},o),{contact:{userId:o.contact.userId}}):o));let i=t?.taggedUserContacts?.filter((o,s,a)=>a.findIndex(c=>c.text===o.text)===s)||[];i.sort((o,s)=>(s.text?.length||0)-(o.text?.length||0)),i.forEach(o=>{if(o?.text&&o?.contact?.userId){let s=new RegExp(rl(o.text),"g");t.commentText=t.commentText?.replaceAll(s,a=>`{{${o.userId}}}`),t.commentHtml=t.commentHtml?.replaceAll(s,a=>`{{${o.userId}}}`)}}),i.forEach(o=>{o?.text&&o?.contact?.userId&&(o.text="")})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),t}}getDeniedForYouUsers(i){return I(this,arguments,function*({extraData:t}){try{let o=Object.values(t?.annotationData?.subscribedUsers||{}).map(a=>a.user.userId)??[],s=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&o.length){let a=t?.metadata?.clientDocumentId,c=t?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()?t?.annotationData?.context?.access:null,l=[];o.forEach(f=>{if(l.push({userId:f,resource:{id:a,type:di.DOCUMENT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:c?{access:c}:void 0}}),c){let g=JSON.stringify(c);l.push({userId:f,resource:{id:g,type:di.CONTEXT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let u=J();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_NOTIFICATIONS,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let d=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:u,methodName:Un.SET_NOTIFICATIONS});d?.success&&d?.data?.length&&d.data.forEach(f=>{f.hasAccess||s.push(f.userId)})}return s}catch(o){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",o),[]}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let l=$T(this.authService.getFirebaseConfig()?.firebaseOptions),u=Dr(this.functions,Ir({url:st.cloudFunction?.[l]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=t;let _=o?.targetAnnotationData?.commentId;if(_){let T=t?.comments?.find(D=>D?.commentId===_);T&&(o.targetAnnotationData=T)}try{let T=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??Ie.NEWLY_ADDED});T?.originalData&&(o.annotationData=this.formatCommentData(T.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(T){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",T)}}let d=tc.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),f=yield this.getDeniedForYouUsers({extraData:o}),g={path:i??"",data:t??{},dbId:d??"",notificationData:o||void 0,notificationURL:st.firebaseNotificationsDatabaseURL,feature:"comment",eventType:s??"PATCH",sdkVersion:jr(),deniedForYouUsers:f,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},p=yield il(g,this.authService.getUser()?.userId??"");yield u({veltData:p})}catch(l){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",l)}})}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Cr),w(dr),w(Rr),w(zo),w(Wh),w(It))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Yy=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.activityDataProvider$=new Y(null),this.activityById$=new Y({}),this.fieldsToRemove=[],this.getActivityById=s=>{try{return this.activityDataProviderAvailable()?this.activityById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ActivityResolverService getActivityById:",a);return}};try{this.loggingService.log("ActivityResolverService initialized"),this.activityDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove))})}catch(s){this.loggingService.catch("Error in ActivityResolverService constructor:",s)}}getProvider(){try{let t=this.activityDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ActivityResolverService getProvider:",t);return}}ngOnDestroy(){try{this.activityById$.next({})}catch(t){this.loggingService.catch("Error in ActivityResolverService ngOnDestroy:",t)}}resolveActivities(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: resolveActivities","color: green;"),!this.activityDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:new Error("Activity resolution timeout"),request:t}}),f(new Error("Activity resolution timeout"))}},this.activityDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.activityIds||[])],T=le(x({},t),{activityIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"resolveActivities",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in ActivityResolverService resolveActivities:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_GET,{sourceMethod:"resolveActivities",source:"sdk",activityIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.activityById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.activityById$.next(x(x({},this.activityById$.getValue()),M)),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ActivityResolverService resolveActivities:",a);let c=i||J();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveActivity(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: saveActivity","color: green;");let o=this.getProvider();if(!this.activityDataProviderAvailable())throw new Error("Activity save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.activityById$.getValue()));this.activityById$._value=x(x({},a),t.activity);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}return o?.save?.({activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveActivity",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.activityById$._value=a),this.loggingService.catch(c?.message??"Error in ActivityResolverService saveActivity:"),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_SAVE,{sourceMethod:"saveActivity",source:"sdk",activityIds:Object.keys(t.activity),event:t.event}),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ActivityResolverService saveActivity:",o);let s=i||J();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}}})}getActivitiesById$(){try{return this.activityDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: getActivitiesById$","color: green;"),this.activityById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ActivityResolverService getActivitiesById$:",t),ue(void 0)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ActivityResolverService getFieldsToRemove:",t),this.fieldsToRemove}}setActivityDataProvider(t){try{if(t){this.loggingService.log("Setting activity data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.activity is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.activityDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ActivityResolverService setActivityDataProvider:",i)}}activityDataProviderAvailable(){try{return!!this.activityDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ActivityResolverService activityDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Qy=(()=>{let e=class e{constructor(t,i,o,s,a,c){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o?.from?.userId),o?.reactions?.length)for(let s of o?.reactions)s?.from?.userId&&i.add(s?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{let a=$T(this.authService.getFirebaseConfig()?.firebaseOptions),c=Dr(this.functions,Ir({url:st.cloudFunction?.[a]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=tc.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",d={path:i??"",data:t??{},dbId:l??"",feature:"reaction",eventType:o??"PATCH",sdkVersion:jr()},f=yield il(d,u);yield c({veltData:f})}catch(a){this.loggingService.catch("Error in handleReactionEncryption:",a)}})}mergeReactionWithUser(t){try{if(this.usersService.userDataProviderAvailable()){if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.reactions?.length){for(let i of t?.reactions)if(i?.from?.userId){let o=this.usersService.getUserById(i?.from?.userId);o&&(i.from=o)}}}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),t}}formatReactionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t.reactions=t?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),t}}isReactionDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let o=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return o?!ki(t,o):!0}catch(o){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",o),!0}}stripReactionAnnotationData(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let i={};if(t&&t.annotationId){let o=t.annotationId;if(i[o]=x({annotationId:o,metadata:Cn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),!this.isReactionDataChanged(i[o],o))return{strippedData:null,originalData:t};delete t?.icon,t.isReactionResolverUsed=!0}return{strippedData:i,originalData:t}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return t;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(t?.annotationId);return i&&i.icon&&(t.icon=i.icon),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Cr),w(dr),w(Rr),w(qo))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Xy=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d){this.loggingService=t,this.usersService=i,this.commentUtilsService=o,this.reactionUtilsService=s,this.commentAnnotationsResolverService=a,this.reactionAnnotationsResolverService=c,this.recorderAnnotationsResolverService=l,this.activityResolverService=u,this.serviceBook=d}getActivityDisplayMessage(t){try{switch(t.featureType){case"comment":return this.getCommentDisplayMessage(t);case"recorder":return this.getRecorderDisplayMessage(t);case"reaction":return this.getReactionDisplayMessage(t);case"crdt":return this.getCrdtDisplayMessage(t);case"custom":return t.displayMessageTemplate&&t.displayMessageTemplateData?this.resolveTemplate(t.displayMessageTemplate,t.displayMessageTemplateData):"";default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getActivityDisplayMessage:",i),""}}resolveTemplate(t,i){try{return t.replace(/\{\{([\w.]+)\}\}/g,(o,s)=>{let a=s.split(".").reduce((c,l)=>{if(c!=null&&typeof c=="object")return c[l]},i);return a!=null?String(a):""})}catch(o){return this.loggingService.catch("Error in ActivityUtilsService resolveTemplate:",o),t}}buildActivityDataFromExtraData(t){try{let{feature:i,extraData:o}=t;if(!o?.actionType)return null;switch(i){case"comment":return this.buildCommentActivityData({commentAnnotation:o.annotationData,targetComment:o.targetAnnotationData,actionType:o.actionType,otherFields:o});case"recorder":return this.buildRecorderActivityData(o);case"reaction":return this.buildReactionActivityData(o);default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildActivityDataFromExtraData:",i),null}}stripActivityPII(t){return I(this,null,function*(){try{let i=JSON.parse(JSON.stringify(t));if(delete i.displayMessage,!this.usersService.userDataProviderAvailable())return{strippedActivity:i};i.actionUser?.userId&&(i.actionUser={userId:i.actionUser.userId}),i.changes&&this.stripUsersFromChanges(i.changes),i.displayMessageTemplateData&&this.stripUsersFromTemplateData(i.displayMessageTemplateData);let o=this.extractCommentChangesForResolver(i),s=this.extractFeatureEntityDataForResolver(i);yield this.stripFeatureSpecificPII(i);let a=this.extractActivityResolverData(i);return o&&(a?a.changes=x(x({},a.changes),o.changes):a=o),s&&(a?(s.entityData!==void 0&&(a.entityData=s.entityData),s.entityTargetData!==void 0&&(a.entityTargetData=s.entityTargetData)):a=s),a&&(i.isActivityResolverUsed=!0),{strippedActivity:i,activityResolverData:a}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripActivityPII:",i),{strippedActivity:t}}})}mergeActivityWithUser(t){try{if(!this.usersService.userDataProviderAvailable())return t;if(t=JSON.parse(JSON.stringify(t)),t.actionUser?.userId){let i=this.usersService.getUserById(t.actionUser.userId);i&&(t.actionUser=i)}return t.changes&&this.rehydrateUsersInChanges(t.changes),t.displayMessageTemplateData&&this.rehydrateUsersInTemplateData(t.displayMessageTemplateData),this.rehydrateFeatureSpecificUserData(t),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithUser:",i),t}}mergeActivityWithFeatureData(t){try{switch(t.featureType){case"comment":return this.mergeActivityWithCommentAnnotationData(t);case"reaction":return this.mergeActivityWithReactionData(t);case"recorder":return this.mergeActivityWithRecorderData(t);default:return t}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithFeatureData:",i),t}}getUserIdsToResolveFromActivities(t){try{let i=new Set;for(let o of t){if(o.actionUser?.userId&&i.add(o.actionUser.userId),o.changes)for(let s of Object.values(o.changes))s&&(this.extractUserIdFromValue(s.from,i),this.extractUserIdFromValue(s.to,i));if(o.displayMessageTemplateData)for(let s of Object.values(o.displayMessageTemplateData))this.extractUserIdFromValue(s,i);this.extractFeatureSpecificUserIds(o,i)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getUserIdsToResolveFromActivities:",i),[]}}getEntityIdsToResolveFromActivities(t,i){try{let o=new Set;for(let s of t)if(!(i&&s.featureType!==i))switch(s.featureType){case"comment":case"reaction":case"recorder":s.targetEntityId&&o.add(s.targetEntityId);break}return Array.from(o)}catch(o){return this.loggingService.catch("Error in ActivityUtilsService getEntityIdsToResolveFromActivities:",o),[]}}stripFeatureSpecificPII(t){return I(this,null,function*(){try{switch(t.featureType){case"comment":yield this.stripCommentPII(t);break;case"reaction":this.stripReactionPII(t);break;case"recorder":this.stripRecorderPII(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripFeatureSpecificPII:",i)}})}extractActivityResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return;let i={id:t.id},o=!1;if(t.featureType==="custom"){let s=this.activityResolverService.getFieldsToRemove();for(let a of s)a in t&&t[a]!==void 0&&(i[a]=t[a],delete t[a],o=!0)}return t.metadata&&(i.metadata=Cn(t.metadata)),o?i:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractActivityResolverData:",i);return}}extractCommentChangesForResolver(t){try{return!this.activityResolverService.activityDataProviderAvailable()||t.featureType!=="comment"||!t.changes?.commentText?void 0:{id:t.id,changes:{commentText:t.changes.commentText},metadata:t.metadata?Cn(t.metadata):void 0}}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractCommentChangesForResolver:",i);return}}extractFeatureEntityDataForResolver(t){try{if(!this.activityResolverService.activityDataProviderAvailable()||!t.entityData)return;let i=t.featureType==="recorder"&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable(),o=t.featureType==="reaction"&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable();if(!i&&!o)return;let s={id:t.id,metadata:t.metadata?Cn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:a});if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}if(o){let c=this.reactionUtilsService.stripReactionAnnotationData(a);if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}return s.entityData?s:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractFeatureEntityDataForResolver:",i);return}}mergeActivityWithResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return t;let i=this.activityResolverService.getActivityById(t.id);if(!i)return t;i.changes&&(t.changes||(t.changes={}),Object.assign(t.changes,i.changes)),i.entityData!==void 0&&(t.entityData=i.entityData),i.entityTargetData!==void 0&&(t.entityTargetData=i.entityTargetData),i.displayMessageTemplateData&&(t.displayMessageTemplateData||(t.displayMessageTemplateData={}),Object.assign(t.displayMessageTemplateData,i.displayMessageTemplateData));let o=new Set(["id","metadata","changes","entityData","entityTargetData","displayMessageTemplateData"]);for(let[s,a]of Object.entries(i))!o.has(s)&&a!==void 0&&(t[s]=a);return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithResolverData:",i),t}}rehydrateFeatureSpecificUserData(t){try{switch(t.featureType){case"comment":this.rehydrateCommentUserData(t);break;case"reaction":this.rehydrateReactionUserData(t);break;case"recorder":this.rehydrateRecorderUserData(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateFeatureSpecificUserData:",i)}}getCommentDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case xe.ANNOTATION_ADD:return`${i} added a comment`;case xe.COMMENT_ADD:return`${i} replied to a comment`;case xe.COMMENT_UPDATE:return`${i} edited a comment`;case xe.COMMENT_DELETE:return`${i} deleted a comment`;case xe.ANNOTATION_DELETE:return`${i} deleted a comment thread`;case xe.STATUS_CHANGE:{let o=t.changes?.status,s=o?.from?.name,a=o?.to?.name;return s&&a?`${i} changed status from ${s} to ${a}`:`${i} changed the status`}case xe.PRIORITY_CHANGE:{let o=t.changes?.priority,s=o?.to;if(!s)return`${i} removed the priority`;let a=typeof s=="object"?s?.name:String(s),c=o?.from,l=c&&typeof c=="object"?c?.name:c?String(c):null;return l&&a?`${i} changed priority from ${l} to ${a}`:`${i} changed priority to ${a}`}case xe.ASSIGN:{let s=t.changes?.assignedTo?.to;return s&&typeof s=="object"&&s.name?`${i} assigned to ${s.name}`:`${i} assigned the comment`}case xe.ACCESS_MODE_CHANGE:{let s=t.changes?.accessMode?.to;return s?`${i} changed access to ${s}`:`${i} changed the access mode`}case xe.CUSTOM_LIST_CHANGE:return`${i} changed the custom list`;case xe.APPROVE:return`${i} approved the comment`;case xe.ACCEPT:case xe.SUGGESTION_ACCEPT:return`${i} accepted a suggestion`;case xe.REJECT:case xe.SUGGESTION_REJECT:return`${i} rejected a suggestion`;case xe.REACTION_ADD:return`${i} reacted to a comment`;case xe.REACTION_DELETE:return`${i} removed a reaction`;case xe.SUBSCRIBE:return`${i} subscribed to the thread`;case xe.UNSUBSCRIBE:return`${i} unsubscribed from the thread`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCommentDisplayMessage:",i),""}}getRecorderDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case vg.RECORDING_ADD:return`${i} added a recording`;case vg.RECORDING_DELETE:return`${i} deleted a recording`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getRecorderDisplayMessage:",i),""}}getReactionDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case yg.REACTION_ADD:return`${i} added a reaction`;case yg.REACTION_DELETE:return`${i} removed a reaction`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getReactionDisplayMessage:",i),""}}getCrdtDisplayMessage(t){try{let i=t.actionUser?.name??"Someone",s=t.entityData?.editCount??0,a=t.targetEntityId??"unknown";return`${i} made ${s} edit${s!==1?"s":""} to editor ${a}`}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCrdtDisplayMessage:",i),""}}stripCommentPII(t){return I(this,null,function*(){try{let i=yield this.commentUtilsService.stripCommentAnnotationData({data:t.entityData,actionType:t.eventType??Ie.NEWLY_ADDED});i?.originalData&&(t.entityData=this.commentUtilsService.formatCommentData(i.originalData)),t.entityTargetData&&(t.entityTargetData=this.commentUtilsService.formatCommentThreadData(this.commentUtilsService.stripCommentsFromAnnotationData({comment:t.entityTargetData}))),this.activityResolverService.activityDataProviderAvailable()&&t.changes?.commentText&&delete t.changes.commentText}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripCommentPII:",i)}})}rehydrateCommentUserData(t){try{t.entityData&&this.commentUtilsService.mergeCommentWithUser(t.entityData),t.entityTargetData&&(this.rehydrateUserInObject(t.entityTargetData,"from"),this.rehydrateUsersInArray(t.entityTargetData,"to"),this.rehydrateUsersInArray(t.entityTargetData,"taggedUserContacts"))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateCommentUserData:",i)}}stripReactionPII(t){try{if(!t.entityData)return;this.activityResolverService.activityDataProviderAvailable()&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionUtilsService.stripReactionAnnotationData(t.entityData),t.entityData=this.reactionUtilsService.formatReactionData(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripReactionPII:",i)}}rehydrateReactionUserData(t){try{if(!t.entityData)return;this.reactionUtilsService.mergeReactionWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateReactionUserData:",i)}}stripRecorderPII(t){try{if(!t.entityData)return;if(this.activityResolverService.activityDataProviderAvailable()&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:t.entityData});return}let i=t.entityData;if(this.usersService.userDataProviderAvailable()){i.from&&typeof i.from=="object"&&"userId"in i.from&&(i.from={userId:i.from.userId});let o=i.transcription;o?.from&&typeof o.from=="object"&&"userId"in o.from&&(o.from={userId:o.from.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripRecorderPII:",i)}}rehydrateRecorderUserData(t){try{if(!t.entityData)return;this.serviceBook.get(ci)?.mergeRecorderWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateRecorderUserData:",i)}}mergeActivityWithCommentAnnotationData(t){try{if(!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t.targetEntityId);if(!i)return t;let o=t.entityData?.comments;if(Array.isArray(o))for(let s of o){let a=s?.commentId;if(a==null)continue;let c=i.comments?.[String(a)];c&&(c.commentText&&(s.commentText=c.commentText),c.commentHtml&&(s.commentHtml=c.commentHtml))}if(t.targetSubEntityId&&t.entityTargetData){let s=i.comments?.[t.targetSubEntityId];if(s){let a=t.entityTargetData;s.commentText&&(a.commentText=s.commentText),s.commentHtml&&(a.commentHtml=s.commentHtml)}}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithCommentAnnotationData:",i),t}}mergeActivityWithReactionData(t){try{return!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithReactionData:",i),t}}mergeActivityWithRecorderData(t){try{return!this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.serviceBook.get(ci)?.mergeStrippedDataWithRecorderAnnotation(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithRecorderData:",i),t}}buildCommentActivityData(t){try{let{commentAnnotation:i,targetComment:o,actionType:s,otherFields:a}=t,c=i,l=o,u=s===Ie.DELETED&&a?.isAnnotationDelete?xe.ANNOTATION_DELETE:this.mapCommentStatusToActionType(s);if(!u)return null;let d=c?.annotationId;if(!d)return null;let f=l?.commentId,g=this.buildCommentChanges(s,l,a);return{featureType:"comment",actionType:u,targetEntityId:d,eventType:s,targetSubEntityId:f??null,changes:Object.keys(g).length>0?g:void 0,entityData:i,entityTargetData:o??void 0}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildCommentActivityData:",i),null}}mapCommentStatusToActionType(t){try{switch(t){case Ie.NEWLY_ADDED:return xe.ANNOTATION_ADD;case Ie.ADDED:return xe.COMMENT_ADD;case Ie.UPDATED:return xe.COMMENT_UPDATE;case Ie.DELETED:return xe.COMMENT_DELETE;case Ie.STATUS_CHANGED:return xe.STATUS_CHANGE;case Ie.PRIORITY_CHANGED:return xe.PRIORITY_CHANGE;case Ie.ASSIGNED:return xe.ASSIGN;case Ie.ACCESS_MODE_CHANGED:return xe.ACCESS_MODE_CHANGE;case Ie.CUSTOM_LIST_CHANGED:return xe.CUSTOM_LIST_CHANGE;case Ie.APPROVED:return xe.APPROVE;case Ie.ACCEPTED:return xe.ACCEPT;case Ie.REJECTED:return xe.REJECT;case Ie.SUGGESTION_ACCEPTED:return xe.SUGGESTION_ACCEPT;case Ie.SUGGESTION_REJECTED:return xe.SUGGESTION_REJECT;case Ie.REACTION_ADDED:return xe.REACTION_ADD;case Ie.REACTION_DELETED:return xe.REACTION_DELETE;case Ie.SUBSCRIBED:return xe.SUBSCRIBE;case Ie.UNSUBSCRIBED:return xe.UNSUBSCRIBE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapCommentStatusToActionType:",i),null}}buildRecorderActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapRecorderStatusToActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"recorder",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildRecorderActivityData:",i),null}}mapRecorderStatusToActionType(t){try{switch(t){case _T.ADDED:return vg.RECORDING_ADD;case _T.DELETED:return vg.RECORDING_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapRecorderStatusToActionType:",i),null}}buildReactionActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapReactionActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"reaction",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildReactionActivityData:",i),null}}mapReactionActionType(t){try{switch(t){case"add":return yg.REACTION_ADD;case"delete":return yg.REACTION_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapReactionActionType:",i),null}}buildCommentChanges(t,i,o){try{let s={};switch(t){case Ie.NEWLY_ADDED:case Ie.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case Ie.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case Ie.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case Ie.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case Ie.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case Ie.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case Ie.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case Ie.CUSTOM_LIST_CHANGED:s.customList={from:o?.oldCustomList??null,to:o?.newCustomList??null};break}return s}catch(s){return this.loggingService.catch("Error in ActivityUtilsService buildCommentChanges:",s),{}}}extractFeatureSpecificUserIds(t,i){try{switch(t.featureType){case"comment":this.extractCommentActivityUserIds(t,i);break;case"reaction":this.extractReactionActivityUserIds(t,i);break;case"recorder":this.extractRecorderActivityUserIds(t,i);break}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractFeatureSpecificUserIds:",o)}}extractCommentActivityUserIds(t,i){try{if(t.entityData){let o=this.commentUtilsService.getUserIdsToResolveFromComments([t.entityData]);for(let s of o)i.add(s)}if(t.entityTargetData){let o=t.entityTargetData;if(this.extractUserIdFromValue(o.from,i),Array.isArray(o.to))for(let s of o.to)this.extractUserIdFromValue(s,i);if(Array.isArray(o.taggedUserContacts))for(let s of o.taggedUserContacts)this.extractUserIdFromValue(s,i)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractCommentActivityUserIds:",o)}}extractReactionActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.reactionUtilsService.getUserIdsToResolveFromReactions([t.entityData]);for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractReactionActivityUserIds:",o)}}extractRecorderActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.serviceBook.get(ci)?.getUserIdsToResolveFromRecorders([t.entityData])??[];for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractRecorderActivityUserIds:",o)}}stripUsersFromChanges(t){try{for(let i of Object.keys(t)){let o=t[i];o&&(o.from=this.stripUserIfPresent(o.from),o.to=this.stripUserIfPresent(o.to))}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromChanges:",i)}}stripUserIfPresent(t){try{return t&&typeof t=="object"&&"userId"in t?{userId:t.userId}:t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripUserIfPresent:",i),t}}stripUsersFromTemplateData(t){try{for(let i of Object.keys(t)){let o=t[i];o&&typeof o=="object"&&"userId"in o&&(t[i]={userId:o.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromTemplateData:",i)}}rehydrateUsersInChanges(t){try{for(let i of Object.values(t))i&&(i.from=this.rehydrateIfUser(i.from),i.to=this.rehydrateIfUser(i.to))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInChanges:",i)}}rehydrateIfUser(t){try{if(t&&typeof t=="object"&&"userId"in t){let i=t.userId;return this.usersService.getUserById(i)??t}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService rehydrateIfUser:",i),t}}rehydrateUsersInTemplateData(t){try{for(let i of Object.keys(t))t[i]=this.rehydrateIfUser(t[i])}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInTemplateData:",i)}}rehydrateUserInObject(t,i){try{let o=t[i];if(o&&typeof o=="object"&&"userId"in o){let s=o.userId,a=this.usersService.getUserById(s);a&&(t[i]=a)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUserInObject:",o)}}rehydrateUsersInArray(t,i){try{let o=t[i];Array.isArray(o)&&(t[i]=o.map(s=>this.rehydrateIfUser(s)))}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInArray:",o)}}extractUserIdFromValue(t,i){try{if(t&&typeof t=="object"&&"userId"in t){let o=t.userId;typeof o=="string"&&i.add(o)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractUserIdFromValue:",o)}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Ky),w(Qy),w(zo),w(qo),w(ec),w(Yy),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Jy=class{constructor({apiKey:e,documentId:r,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=da(s)),a&&(this.organizationId=Ts(a)),i&&(this.folderId=i,this.veltFolderId=wo(i)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`${this.apiKey}`;this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${e}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var z3=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.usersService=o}getUserIdsToResolveFromLiveStateCustom(t){try{let i=new Set;return t?.updatedBy&&i.add(t?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(t){try{if(t?.updatedBy?.userId){let i=this.usersService.getUserById(t?.updatedBy?.userId);i&&(t.updatedBy=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),t}}formatLiveStateCustomData(t){try{return this.usersService.userDataProviderAvailable()&&t?.updatedBy&&(t.updatedBy={userId:t.updatedBy.userId}),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),t}}getUserIdsToResolveFromLiveStateCustoms(t){try{let i=new Set;for(let o of t)o?.updatedBy?.userId&&i.add(o?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(t){try{let i=new Set;return t?.default?.singleEditorMode?.editor?.userId&&i.add(t?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(t){try{let i=new Set;return t?.editor?.userId&&i.add(t?.editor?.userId),t?.requestEditorAccess?.user?.userId&&i.add(t?.requestEditorAccess?.user?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",i),[]}}mergeLiveStateWithUser(t){try{if(t?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.editor?.userId);i&&(t.default.singleEditorMode.editor=i)}if(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(t.default.singleEditorMode.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),t}}mergeSingleEditorLiveStateDataWithUser(t){try{if(t?.editor?.userId){let i=this.usersService.getUserById(t?.editor?.userId);i&&(t.editor=i)}if(t?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.requestEditorAccess?.user?.userId);i&&(t.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",i),t}}resolveAndMergeSingleEditorLiveStateDataWithUser(t){return I(this,null,function*(){try{let i=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:t}});if(i.length){let o=J(),s=tl.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,moduleName:s,source:"internal",payload:{userIds:i}}),yield this.usersService.resolveUsers({userIds:i,uniqueId:o,moduleName:s}),this.mergeSingleEditorLiveStateDataWithUser(t)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",i),t}})}formatLiveStateSingleEditorModeData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.editor?.userId&&(t.editor={userId:t.editor.userId}),t?.requestEditorAccess?.user?.userId&&(t.requestEditorAccess.user={userId:t.requestEditorAccess.user.userId})),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),t}}mergeLiveStateCustomsWithUsers(t){try{for(let i of t)if(i?.updatedBy?.userId){let o=this.usersService.getUserById(i?.updatedBy?.userId);o&&(i.updatedBy=o)}return t}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Zy=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.notificationDataProvider$=new Y(null),this.notificationById$=new Y({}),this.inFlightRequests=new Map,this.getNotificationById=s=>{try{return this.notificationDataProviderAvailable()?this.notificationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in NotificationResolverService getNotificationById:",a);return}};try{this.loggingService.log("NotificationResolverService initialized"),this.notificationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in NotificationResolverService constructor:",s)}}getProvider(){try{let t=this.notificationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in NotificationResolverService getProvider:",t);return}}ngOnDestroy(){try{this.notificationById$.next({})}catch(t){this.loggingService.catch("Error in NotificationResolverService ngOnDestroy:",t)}}resolveNotifications(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: resolveNotifications","color: green;"),!this.notificationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let k=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:new Error("Notification resolution timeout"),request:t}}),f(new Error("Notification resolution timeout"))}},this.notificationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=this.notificationById$.getValue()||{},T=[...new Set(t.notificationIds||[])],D=[],b=[],G=[];for(let k of T)_[k]||(this.inFlightRequests.has(k)?(D.push(this.inFlightRequests.get(k)),b.push(k)):G.push(k));let M=le(x({},t),{notificationIds:G});I(this,null,function*(){try{if(D.length>0&&(yield Promise.allSettled(D)),G.length>0){let k=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:M}});let S,A=new Promise(O=>{S=O});for(let O of G)this.inFlightRequests.set(O,A.then(P=>P?.[O]));let C=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,M,!0,g.config.getConfig.credentials):g?.get?.(M)||Promise.resolve(void 0),"getNotifications",this.retryGetConfig).then(O=>c?{}:(u(),O&&O.statusCode!==200?(this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:M}}),this.loggingService.catch(O?.message??"Error in NotificationResolverService resolveNotifications:"),{}):O?.data)).catch(O=>{throw u(),O});try{p=(yield C)||{},S(p);for(let P of G)this.inFlightRequests.delete(P);this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_GET,{sourceMethod:"resolveNotifications",source:"sdk",notificationIds:G});let O={};Object.entries(p).forEach(([P,F])=>{let N=this.notificationById$.value?.[P];N?N&&JSON.stringify(N)!==JSON.stringify(F)&&(O[P]=F):O[P]=F}),Object.keys(O).length>0&&this.notificationById$.next(x(x({},this.notificationById$.getValue()),O)),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:M}}),d(O)}catch(O){S({});for(let F of G)this.inFlightRequests.delete(F);let P=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:O,request:M}}),c||f(O),d(p)}}else u(),d({})}catch(k){u();let S=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:k,request:M}}),f(k)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||J();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}deleteNotification(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: deleteNotification","color: green;");let s=this.getProvider();if(!this.notificationDataProviderAvailable())throw new Error("Notification delete data provider not available");let a=o||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{notificationId:t,organizationId:i}});let c=this.notificationById$.getValue(),l=x({},c);delete l?.[t],this.notificationById$._value=l;let u={notificationId:t,organizationId:i},d=yield kt(()=>s?.config?.deleteConfig?.url?Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1,s.config.deleteConfig.credentials):s?.delete?.(u)||Promise.resolve(void 0),"deleteNotification",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.notificationById$._value=c),this.loggingService.catch(d?.message??"Error in NotificationResolverService deleteNotification:"),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:d,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_DELETE,{sourceMethod:"deleteNotification",source:"sdk",notificationId:t}),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in NotificationResolverService deleteNotification:",s);let a=o||J();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:s,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getNotificationsById$(){try{return this.notificationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: getNotificationsById$","color: green;"),this.notificationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in NotificationResolverService getNotificationsById$:",t),ue(void 0)}}setNotificationDataProvider(t){try{if(t){this.loggingService.log("Setting notification data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.notification is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.notificationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in NotificationResolverService setNotificationDataProvider:",i)}}notificationDataProviderAvailable(){try{return!!this.notificationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in NotificationResolverService notificationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Np=class{constructor({apiKey:e,documentId:r,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=da(i)),o&&(this.organizationId=Ts(o)),s&&(this.folderId=s,this.veltFolderId=wo(s)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`apiKey/${this.apiKey}`;this.paths.activities=`${e}/${v.FIREBASE_PARTIAL_PATH_ACTIVITIES}`,this.paths.userNotificationIndex=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX}`,this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=e,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.lastActivityTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP}`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${v.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get userNotificationIndex(){return this.paths.userNotificationIndex}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get activities(){return this.paths.activities?this.paths.activities:this.throwError("Activities path is not available.")}get lastActivityTimestamp(){return this.paths.lastActivityTimestamp?this.paths.lastActivityTimestamp:this.throwError("LastActivityTimestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var K3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(t){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(t){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),t}}formatAreaData(t){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Y3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromUserIamData(t){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(t?.length)for(let o of t)o?.user?.userId&&i.add(o?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(t){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);if(i){let o=i;t?.user&&typeof t.user=="object"&&(o=x(x({},o),t.user));let s=this.usersService.getContactListUser(t.user.userId);s&&(o=x(x({},o),s)),t=le(x({},t),{user:o})}}return t}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Q3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromMultiThreads(t){try{let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),t}}formatMultiThreadData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.commentAnnotationsMap&&(t.commentAnnotationsMap=null)),t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var X3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromSelections(t){try{let i=new Set;for(let o of t)o?.user?.userId&&i.add(o.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(t){try{if(t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);i&&(t.user=i)}return t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),t}}formatSelectionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.user?.userId&&(t.user={userId:t.user.userId}),t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var J3=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromTags(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o.from.userId),o?.to?.length)for(let s of o.to)s?.userId&&i.add(s.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t?.to?.length&&(t.to=t.to.map(i=>{if(i?.userId){let o=this.usersService.getUserById(i?.userId);o&&(i=o)}return i})),t}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),t}}formatTagData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to?.length&&(t.to=t.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),t}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Z3=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D,b,G,M,U,k){this.activityUtilsService=t,this.areaUtilsService=i,this.commentUtilsService=o,this.contactUtilsService=s,this.coreActionsService=a,this.liveStateUtilsService=c,this.loggingService=l,this.multiThreadUtilsService=u,this.reactionUtilsService=d,this.selectionUtilsService=f,this.tagUtilsService=g,this.usersService=p,this.docService=_,this.commentAnnotationsResolverService=T,this.reactionAnnotationsResolverService=D,this.recorderAnnotationsResolverService=b,this.notificationResolverService=G,this.activityResolverService=M,this.serviceBook=U,this.attachmentResolverService=k}getErrorForGetRequests({feature:t,error:i}){try{switch(t){case"apiKeyMetadata":case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(i?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",o),null}}getFirestorePath({feature:t,properties:i,documentPaths:o,apiKey:s}){try{if(!s)return;if(t==="userNotificationIndex"){if(!i?.id)return;let d=new Np({apiKey:s});return d?.userNotificationIndex?`${d.userNotificationIndex}/${i.id}`:void 0}let{documentId:a,organizationId:c,folderId:l}=i;if(!c&&(c=o?.organizationId,!c))return;let u=new Np({apiKey:s,documentId:a?`${a}`:"",organizationId:c?`${c}`:"",veltFolderId:l?`${l}`:void 0});switch(t){case"userConfig":return i?.userId&&u?.userConfig?`${u?.userConfig}/${i?.userId}${i?.documentId?`/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:""}`:void 0;case"allPermissionsUsers":return u?.permissionsUsers?`${u?.permissionsUsers}`:void 0;case"comment":return i?.documentId&&i?.id&&u?.comment?`${u?.comment}/${i?.id}`:void 0;case"allComments":return i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"multiThread":return i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}/${i?.id}`:void 0;case"allMultiThreads":return i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}`:void 0;case"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${i?.id}`:void 0;case"activity":return i?.id&&u?.activities?`${u?.activities}/${i?.id}`:void 0;case"allActivities":return u?.activities?`${u?.activities}`:void 0;case"allLastActivityTimestamp":return u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}`:void 0;case"lastActivityTimestamp":return i?.id&&u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}/${i?.id}`:void 0;case"area":return i?.documentId&&i?.id&&u?.area?`${u?.area}/${i?.id}`:void 0;case"allAreas":return i?.documentId&&u?.area?`${u?.area}`:void 0;case"allDocuments":return u?.document?`${u?.document}`:void 0;case"allLocations":return u?.location?`${u?.location}`:void 0;case"allFolders":return u?.folder?`${u?.folder}`:void 0;case"folder":return u?.folder&&i.folderId?`${u?.folder}/${i.folderId}`:void 0;case"documentUserAccess":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"reaction":return i?.documentId&&i?.id&&u?.reaction?`${u?.reaction}/${i?.id}`:void 0;case"allReactions":return i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}`:void 0;case"allRecorders":return i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"recorderTrackEvent":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"apiKeyMetadata":return s?`apiKey/${s}`:void 0;case"organizationMetadata":return u?.organization?`${u?.organization}`:void 0;case"documentIam":case"documentMetadata":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"folderMetadata":return i?.folderId&&u?.folder?`${u?.folder}/${i?.folderId}`:void 0;case"locationMetadata":return i?.documentId&&u?.location&&i?.id?`${u?.location}/${i?.id}`:void 0;case"documentUser":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"allDocumentUsers":return u?.users?`${u?.users}`:void 0;case"allFolderUsers":return u?.users?`${u?.users}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.users?`${u?.users}`:void 0;case"notificationViewsTimestamp":return i?.documentId&&i?.id&&u?.notificationViews?`${u?.notificationViews}/${i?.id}`:void 0;case"allDocumentViews":return i?.documentId&&u?.documentViews?`${u?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return i?.documentId&&i?.id&&u?.documentViews?`${u?.documentViews}/${i?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return i?.documentId&&i?.id&&u?.locationViews?`${u?.locationViews}/${i?.id}`:void 0;case"allLocationViews":return i?.documentId&&u?.locationViews?`${u?.locationViews}`:void 0;case"allDocNotifications":return i?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.docNotification?`${u?.docNotification}/${i?.id}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allUserNotifications":return i?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${t}`)}}catch(a){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",a);return}}getFirestoreCollectionGroupPath(t){try{switch(t){case"allComments":return v.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return v.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return v.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return v.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return v.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return v.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return v.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return v.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${t}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:t,properties:i,defaultDocumentPaths:o,apiKey:s,useFirestore:a}){try{if(!s)return;let{documentId:c,organizationId:l}=i;l||(l=o?.organizationId);let u=new Jy({apiKey:s,documentId:c?`${c}`:"",organizationId:l?`${l}`:""});switch(t){case"userConfig":return i?.userId&&i?.documentId&&u?.userConfig?`${u?.userConfig}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"allComments":return!a&&i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"allGlobalContacts":return i?.documentId&&u?.globalContacts?`${u?.globalContacts}`:void 0;case"globalContacts":return i?.documentId&&i?.userId&&u?.globalContacts?`${u?.globalContacts}${i?.userId}`:void 0;case"groupContacts":return i?.documentId&&i?.groupId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}`:void 0;case"groupContactsUser":return i?.documentId&&i?.groupId&&i?.userId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}/${i?.userId}`:void 0;case"allLoginContacts":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}/contacts`:void 0;case"allLogins":return i?.documentId&&u?.logins?`${u?.logins}`:void 0;case"logins":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}`:void 0;case"customerMetadata":return u?.customerMetadata?`${u?.customerMetadata}`:void 0;case"allArrows":return i?.documentId&&u?.arrow?`${u?.arrow}`:void 0;case"arrow":return i?.documentId&&u?.arrow&&i.id?`${u?.arrow}${i.id}`:void 0;case"allCursors":return i?.documentId&&u?.cursor?`${u?.cursor}`:void 0;case"cursor":return i?.documentId&&u?.cursor&&i.id?`${u?.cursor}${i.id}`:void 0;case"flockUser":return i?.documentId&&u?.flock&&i.id?`${u?.flock}users/${i.id}`:void 0;case"flockSession":return i?.documentId&&u?.flock&&i.id?`${u?.flock}sessions/${i.id}`:void 0;case"allHuddleAttendees":return i?.documentId&&u?.huddle?`${u?.huddle}attendees`:void 0;case"huddleAttendee":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}`:void 0;case"huddleAttendeeState":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}/state`:void 0;case"allHuddleInvitees":return i?.documentId&&u?.huddle?`${u?.huddle}invitees`:void 0;case"huddleConnection":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}connections/${i.id}`:void 0;case"huddleIceCandidate":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}iceCandidates/${i.id}`:void 0;case"allHuddleIceCandidates":return i?.documentId&&u?.huddle?`${u?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return i?.documentId&&u?.huddle?`${u?.huddle}messages`:void 0;case"huddleMessage":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}messages/${i.id}`:void 0;case"allLiveStates":return i?.documentId&&u?.liveState?`${u?.liveState}`:void 0;case"allLiveStateCustoms":return i?.documentId&&u?.liveState?`${u?.liveState}custom`:void 0;case"liveStateCustom":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}custom/${i.id}`:void 0;case"liveStateSingleEditorMode":return i?.documentId&&u?.liveStateSingleEditorMode?`${u?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}default/autoSyncState/history/${i.id}`:void 0;case"presence":return i?.documentId&&u?.presence&&i?.userId?`${u?.presence}${i?.userId}`:void 0;case"allPresence":return i?.documentId&&u?.presence?`${u?.presence}`:void 0;case"workspaceIam":return u?.workspaceIam?`${u?.workspaceIam}`:void 0;case"selection":return i?.documentId&&u?.selection&&i?.userId?`${u?.selection}${i?.userId}`:void 0;case"allSelections":return i?.documentId&&u?.selection?`${u?.selection}`:void 0;case"syncVideoPlayer":return i?.documentId&&u?.syncVideoPlayer?`${u?.syncVideoPlayer}`:void 0;case"allTags":return i?.documentId&&u?.tag?`${u?.tag}`:void 0;case"tag":return i?.documentId&&u?.tag&&i?.id?`${u?.tag}${i?.id}`:void 0;case"userContactUs":return i?.documentId&&u?.userContactUs?`${u?.userContactUs}`:void 0;case"userFeedback":return i?.documentId&&u?.userFeedback?`${u?.userFeedback}`:void 0;case"userReportBug":return i?.documentId&&u?.userReportBugs?`${u?.userReportBugs}`:void 0;case"comment":return!a&&i?.documentId&&i?.id&&u?.comment?`${u?.comment}${i?.id}`:void 0;case"allMultiThreads":return!a&&i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return!a&&i?.documentId&&u?.crdt?`${u?.crdt}`:void 0;case"crdtData":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/data`:void 0;case"crdtSyncState":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/state`:void 0;case"crdtSyncPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence/${i.userId}`:void 0;case"allCrdtSyncPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence`:void 0;case"crdtPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence/${i.userId}`:void 0;case"allCrdtPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence`:void 0;case"crdtVersion":return i?.documentId&&u?.crdt&&i?.id&&i?.versionId?`${u?.crdt}/${i?.id}/versions/${i?.versionId}`:void 0;case"crdtVersions":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/versions`:void 0;case"crdtMessages":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/messages`:void 0;case"crdtMessage":return i?.documentId&&u?.crdt&&i?.id&&i?.messageId?`${u?.crdt}/${i?.id}/messages/${i?.messageId}`:void 0;case"crdtSnapshot":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/snapshot`:void 0;case"multiThread":return!a&&i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!a&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!a&&i?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"allDocuments":return!a&&u?.docs&&i?.documentId?`${u?.docs}/${i?.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!a&&i?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!a&&i?.id&&u?.area?`${u?.area}${i?.id}`:void 0;case"folder":return!a&&i?.folderId&&u?.folder?`${u?.folder}${i?.folderId}`:void 0;case"documentUserAccess":return!a&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!a&&i?.documentId&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!a&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!a&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!a&&i?.id&&u?.reaction?`${u?.reaction}${i?.id}`:void 0;case"allReactions":return!a&&i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!a&&i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}${i?.id}`:void 0;case"allRecorders":return!a&&i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!a&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"heartbeat":return i?.id&&u?.heartbeat?`${u?.heartbeat}${i?.id}`:void 0;case"allHeartbeats":return u?.heartbeat?`${u?.heartbeat}`:void 0;case"heartbeatByDocument":return i?.id&&u?.heartbeatByDocument?`${u?.heartbeatByDocument}${i?.id}`:void 0;case"allHeartbeatsByDocument":return u?.heartbeatByDocument?`${u?.heartbeatByDocument}`:void 0;case"documentAccessType":return!a&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!a&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocumentViews":return!a&&i?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!a&&i?.documentId&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}`:void 0;case"allLocationViews":return!a&&i?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!a&&i?.id&&i?.user&&u?.views?`${u?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/location`:void 0;case"location":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}locationViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return i?.userId&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}/${i?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${t}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(o){return I(this,arguments,function*({data:t,feature:i}){try{if(t&&t?.length>0)switch(i){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let s=J(),a=Td.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:a,source:"internal",payload:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let s=J(),a=Id.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:a,source:"internal",payload:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allRecorders":{if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let s=J(),a=vd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:a,source:"internal",payload:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}default:break}}catch(s){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,s)}})}formatResponse(g){return I(this,arguments,function*({feature:t,data:i,organizationId:o,shouldAwait:s=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:c=!1,shouldNotificationResolverAwait:l=!1,shouldActivityResolverAwait:u=!1,shouldReactionResolverAwait:d=!1,shouldRecorderResolverAwait:f=!1}){try{let p=o??this.docService.getDocumentPaths()?.clientOrganizationId??"";if(this.usersService.userDataProviderAvailable()){let _=[];switch(t){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(IT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(vT)?.getUserIdsToResolveFromCursorUsers(Object.values(i))??[]);break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(xi)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(xi)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(yT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ci)?.getUserIdsToResolveFromRecorders(Object.values(i))??[]);break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ST)?.getUserIdsToResolveFromHuddleAttendees(Object.values(i))??[]);break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"liveStateSingleEditorMode":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}case"allActivities":{i&&typeof i=="object"&&(_=this.activityUtilsService.getUserIdsToResolveFromActivities(Array.isArray(i)?i:Object.values(i)));break}default:_=[]}if(_?.length){let T=J(),D=tl.GET_USERS;this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:xn.FORMAT_RESPONSE,source:"internal",moduleName:D,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(xi)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(D=>!this.notificationResolverService.getNotificationById(D)));break}default:_=[]}if(_?.length){let T=J(),D=yC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Fn.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let D=this.serviceBook.get(xi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let D=this.serviceBook.get(xi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),D=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}default:_=[]}if(_?.length){let T=J(),D=Td.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}if(t==="allActivities"&&i&&typeof i=="object"){let _=Array.isArray(i)?i:Object.values(i),T=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(this.activityResolverService.activityDataProviderAvailable()){let D=[];for(let b of _)b?.id&&!this.activityResolverService.getActivityById(b.id)&&D.push(b.id);if(D.length){let b=J(),G=SC.GET_ACTIVITIES;this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.FORMAT_RESPONSE,moduleName:G,source:"internal",payload:{activityIds:D,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:b,moduleName:G})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(D=D.filter(b=>!this.reactionAnnotationsResolverService.getAnnotationById(b)),D.length){let b=J(),G=Id.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:G,source:"internal",payload:{reactionAnnotationIds:D,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(D=D.filter(b=>!this.recorderAnnotationsResolverService.getAnnotationById(b)),D.length){let b=J(),G=vd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:G,source:"internal",payload:{recorderAnnotationIds:D,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G})}}}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(a),o),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(xi);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithNotification(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",o),t}}mergeActivityResolverWithData({data:t,feature:i}){try{return this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeActivityResolverWithData","color: green;"),this.activityResolverService.activityDataProviderAvailable()&&i==="allActivities"&&Array.isArray(t)?t.map(o=>this.activityUtilsService.mergeActivityWithResolverData(o)):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeActivityResolverWithData:",o),t}}mergeNotificationsWithResolvedData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeNotificationsWithResolvedData","color: green;"),this.notificationResolverService.notificationDataProviderAvailable())switch(i){case"allDocNotifications":case"allUserNotifications":{let o=this.serviceBook.get(xi);return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeResolvedNotificationData(c):c,s),{}):Array.isArray(t)?t.map(s=>o?o.mergeResolvedNotificationData(s):s):t}default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeNotificationsWithResolvedData:",o),t}}mergeNotificationsWithResolvedData$({data:t,feature:i}){try{return this.notificationResolverService.getNotificationsById$().pipe(fe(()=>{let o=this.mergeNotificationsWithResolvedData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeNotificationsWithResolvedData$:",o),ue(t)}}mergeReactionAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(a),o),{}):t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",o),t}}mergeRecorderAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeRecorderAnnotationsWithData","color: green;"),this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable())switch(i){case"allRecorders":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(ci);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithRecorderAnnotation(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeRecorderAnnotationsWithData:",o),t}}mergeActivitiesWithFeatureData(t){return Array.isArray(t)?t.map(i=>this.activityUtilsService.mergeActivityWithFeatureData(i)):t}mergeLocationMetadataWithData({data:t,feature:i,locationMetadata:o}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),o&&typeof o=="object"&&!Array.isArray(o))switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,o),s),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let s=this.serviceBook.get(xi);return Object.entries(t).reduce((a,[c,l])=>(a[c]=s?s.mergeLocationWithNotification(l,o):l,a),{})}else return t;default:return t}return t}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",s),t}}mergeUsersWithData({feature:t,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(t){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.areaUtilsService.mergeAreaWithUser(a),o),{}):i;case"allArrows":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(IT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeArrowWithUser(c):c,s),{})}else return i;case"allCursors":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(vT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeCursorUserWithUser(c):c,s),{})}else return i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeCommentWithUser(a),o),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.multiThreadUtilsService.mergeMultiThreadWithUser(a),o),{}):i;case"allDocNotifications":if(i&&typeof i=="object"){let o=this.serviceBook.get(xi);return i?.map(s=>o?o.mergeNotificationWithUser(s):s)}else return i;case"allUserNotifications":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(xi);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeNotificationWithUser(c):c,s),{})}else return i;case"allPresence":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(yT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergePresenceUserWithUser(c):c,s),{})}else return i;case"allRecorders":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(ci);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeRecorderWithUser(c):c,s),{})}else return i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeReactionWithUser(a),o),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.tagUtilsService.mergeTagWithUser(a),o),{}):i;case"allHuddleAttendees":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(ST);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?.mergeHuddleAttendeeWithUser(c)??c,s),{})}else return i;case"liveStateCustom":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(i):i;case"allLiveStateCustoms":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(a),o),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"liveStateSingleEditorMode":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.selectionUtilsService.mergeSelectionWithUser(a),o),{}):i;case"allActivities":return Array.isArray(i)?i.map(o=>this.activityUtilsService.mergeActivityWithUser(o)):i;default:return i}return i}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",o),i}}mergeCommentAnnotationsWithData$({data:t,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(fe(()=>{let o=this.mergeCommentAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),ue(t)}}mergeReactionAnnotationsWithData$({data:t,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(fe(()=>{let o=this.mergeReactionAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),ue(t)}}mergeRecorderAnnotationsWithData$({data:t,feature:i}){try{return this.recorderAnnotationsResolverService.getRecorderAnnotationsById$().pipe(fe(()=>{let o=this.mergeRecorderAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeRecorderAnnotationsWithData:",o),ue(t)}}mergeUsersWithData$({feature:t,data:i}){try{return this.usersService.getUserById$().pipe(fe(()=>{let o=this.mergeUsersWithData({feature:t,data:i?.data??{}});return typeof o=="object"?{data:JSON.parse(JSON.stringify(o)),operation:i?.operation??null}:{data:o,operation:i?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${t}:`,o),ue(i)}}mergeLocationMetadataWithData$({data:t,feature:i}){try{return this.docService.getLocationMetadata$().pipe(fe(o=>{let s=this.mergeLocationMetadataWithData({data:t?.data??{},feature:i,locationMetadata:o});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,o),ue(t)}}handleDataStripping(a){return I(this,arguments,function*({feature:t,data:i,actionType:o,commentId:s}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),t){case"comment":{let c=yield this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:o,commentId:s});return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()})}case"reaction":{let c=this.reactionUtilsService.stripReactionAnnotationData(i);return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()})}case"recorder":{let c=this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:i,actionType:o})??{originalData:i,strippedData:null};return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()})}default:return{originalData:i,strippedData:null}}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",c),{originalData:i,strippedData:null}}})}filterOriginalDataForVeltDb({feature:t,result:i,providerAvailable:o}){try{return!o||!i||i.originalData===null||i.originalData===void 0?i:le(x({},i),{originalData:this.applyVeltDbFieldFilter(t,i.originalData)})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService filterOriginalDataForVeltDb:",s),i}}applyVeltDbFieldFilter(t,i){switch(t){case"comment":return WV(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return zV(i);case"recorder":return qV(i);default:return i}}formatData({feature:t,data:i,properties:o,offset:s,isRealtimeDb:a}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof i=="object"&&(i=JSON.parse(JSON.stringify(i)));let c=new Date().getTime()+s;switch(t){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return a?i:{metadata:i};case"documentCommentMetadata":return i;case"cursor":{let l=this.serviceBook.get(vT);return l?l.formatCursorUserData(i):i}case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":{let l=this.serviceBook.get(IT);return l?l.formatArrowData(i):i}case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(i);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(i);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(i);case"reaction":return this.reactionUtilsService.formatReactionData(i);case"recorder":return this.serviceBook.get(ci)?.formatRecorderData(i,c)??i;case"notificationViewsTimestamp":return{views:{[o.user??""]:i}};case"documentUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"documentDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"documentMetadataViews":return a?i:{metadata:i};case"huddleMessage":return this.serviceBook.get(ST)?.formatHuddleMessageData(i)??i;case"locationMetadataViews":return a?i:{metadata:i};case"locationUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"locationDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"locationViews":return a?i:{location:i};case"docNotificationViews":return a?i:{views:i.views};case"userNotificationViews":return a?i:{views:i.views};case"presence":{let l=this.serviceBook.get(yT);return l?l.formatPresenceUserData(i):i}case"selection":return this.selectionUtilsService.formatSelectionData(i);case"tag":return this.tagUtilsService.formatTagData(i);default:return i}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),i}}modifyAndSetData(a){return I(this,arguments,function*({feature:t,data:i,subscriber:o,operation:s=null}){try{let c=yield this.modifyData({feature:t,data:i});o.next({data:c,operation:s})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:t,change:i,cache:o}){try{if(t==="allReactions"||t==="allComments"){if(i.type==="removed")return!Object.keys(o??{}).includes(i.doc.id);if(o?.[i.doc.id]){let s=i.doc.data(),a=o?.[i.doc.id];return s?.lastUpdated===a?.lastUpdated}}return!1}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",s),!1}}modifyData(o){return I(this,arguments,function*({feature:t,data:i}){try{return yield this.formatResponse({feature:t,data:i})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",s),i}})}addMetadata(t,i){try{return t&&typeof t=="object"&&!Array.isArray(t)?le(x({},t),{metadata:t?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",o),t}}setDataInLocal(l){return I(this,arguments,function*({feature:t,data:i,observablesCache:o,eventType:s,id:a,operation:c=null}){try{let d={comment:"allComments",reaction:"allReactions"}[t];if(!d)return null;let f=i?.metadata?.documentId,g=i?.metadata?.veltFolderId;return Object.keys(o).filter(p=>p.includes(d)&&(!f||p.includes(f)||g&&p.includes(g))).forEach(p=>{let _=o[p]?.subject?.getValue()??{};s==="DELETE"?a&&_?.data?.[a]&&(delete _?.data?.[a],o[p]?.subject&&o[p].subject.next({data:_?.data,operation:c})):o[p]?.subject?.next({data:le(x({},_?.data),{[i?.annotationId]:i}),operation:c})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a})}catch(l){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",l),t}})}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:t,firestorePath:i,eventType:o})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",a),t}})}rtdbDefaultTransactionCallback(t,i){try{let o=x({},t||{});return Object.entries(i).forEach(([s,a])=>{a==null?delete o[s]:o[s]=a}),o}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",o),t}}};e.\u0275fac=function(i){return new(i||e)(w(Xy),w(K3),w(Ky),w(Y3),w(It),w(z3),w(_e),w(Q3),w(Qy),w(X3),w(J3),w(zt),w(zh),w(zo),w(qo),w(ec),w(Zy),w(Yy),w(li),w(Wh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var ez=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{Zr([this.authService.getFirebaseConfig$(),this.configService.getApiKey$(),this.configService.getFirestorePersistentCacheEnabled$()]).pipe(Ct(([s,a])=>!!s&&!!a),Nt(1)).subscribe(([s,a,c])=>{if(s&&a&&s?.firebaseOptions?.storeDbId){try{let d=sessionStorage?.getItem("veltFirestoreLogLevel")||st?.firebaseLogLevel||"silent";YL(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=tc.getFirestoreProdDbName(a,s.firebaseOptions),u=this.configService.getProxyConfig();if(u?.v2DbHost){let d={host:u.v2DbHost,ssl:!0};u.forceLongPolling?d.experimentalForceLongPolling=!0:d.experimentalAutoDetectLongPolling=!0,c&&(d.localCache=bM({tabManager:LM()}));try{this.firestore$.next(Gy(Sr(),d,l))}catch(f){this.loggingService.catch("Firestore proxy: initializeFirestore failed, falling back to existing instance. Proxy settings may not be applied: ",f),this.firestore$.next($h(l))}}else if(c)try{let d=Sr(),f=Gy(d,{localCache:bM({tabManager:LM()})},l);this.firestore$.next(f)}catch{this.firestore$.next($h(l))}else this.firestore$.next($h(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||$h("DocumentIdDb");if(t){let i=Dp(t,"generateDocumentId");return Hh(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(w(Rr),w(Cr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var jke=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D){this.activityUtilsService=t,this.authService=i,this.commonDbUtilsService=o,this.coreActionsService=s,this.loggingService=a,this.firestoreService=c,this.databaseService=l,this.configService=u,this.docService=d,this.usersService=f,this.commentAnnotationsResolverService=g,this.reactionAnnotationsResolverService=p,this.recorderAnnotationsResolverService=_,this.notificationResolverService=T,this.serviceBook=D,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(CT).subscribe(b=>{this.activityService=b??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(b=>{if(b){this.db=b;let G=wa(b,".info/serverTimeOffset");this.offsetListener=gv(G,M=>{let U=M.val();this.offset=U})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(b=>{b&&(this.firestore=b)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([t,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(t){this.loggingService.catch("Error in unsubscribeFromObservables:",t)}}ngOnDestroy(){this.subscriptions.forEach(t=>t.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(t,i){return I(this,null,function*(){try{if(this.db){let o=wa(this.db,t);return M2(o).update(i)}return Promise.resolve()}catch(o){return this.loggingService.catch("Error in setupOnDisconnect:",o),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){Zr([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ct(([i,o])=>!!i),Nt(1),Ks(([i,o])=>{t({db:i,firestore:o})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(t,i,o,s,a,c){return I(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${t}`,"color: red;");return}return this.subscribeToServices(d=>I(this,[d],function*({db:l,firestore:u}){let f;i?.skipFirestore||(f=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let g=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!l){this.loggingService.warn(`%c[WB] No database or firestore found for ${t}`,"color: red;");return}try{let p,_;try{g&&(p=wa(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=Hh(u,`${f}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield o({dbRef:p,firestoreRef:_,data:s,firestorePath:f}),c&&c({firestoreAvailable:!!u})}catch(p){this.loggingService.catch(`Error in ${t} operation: `,p),a&&a(p)}}))}catch(l){this.loggingService.catch("Error in performDatabaseOperation:",l)}})}setData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Iw(u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield vw(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??o?.targetCommentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield kM(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield UM(u.firestoreRef,d)}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in setData for ${t}`,u)}})}updateData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef&&!o?.skipRtdb){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Iw(u.dbRef,f=>{let g;return o?.rtdbTransactionCallback?g=o.rtdbTransactionCallback(f,d):g=this.commonDbUtilsService.rtdbDefaultTransactionCallback(f,d),JSON.parse(JSON.stringify(g))}):yield F2(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield kM(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield UM(u.firestoreRef,d,{merge:!0})}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in updateData for ${t}`,u)}})}createActivityFromExtraData(t,i){try{if(!i?.actionType||!this.activityService)return;let o=this.activityUtilsService.buildActivityDataFromExtraData({feature:t,extraData:i});o&&this.activityService.createActivity(o)}catch(o){this.loggingService.catch("Error in CommonDbService createActivityFromExtraData:",o)}}deleteData(c){return I(this,arguments,function*({feature:t,properties:i,callback:o,errorCallback:s,extraData:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${t}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:t,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.createActivityFromExtraData(t,a),this.performDatabaseOperation(t,i,l=>I(this,null,function*(){l.dbRef&&(yield x2(l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_DATA,source:"internal",payload:{commentAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE",metadata:i?.metadata}))}else if(t==="reaction"){let u=null,d=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE"}))}else if(t==="recorder"){let u=null,d=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_DATA,source:"internal",payload:{recorderAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.recorderAnnotationsResolverService.deleteRecorderAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield Hy(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Fn.DELETE_DATA,source:"internal",payload:{notificationId:i?.id??"",organizationId:i?.organizationId??""}}),u=yield this.notificationResolverService.deleteNotification(String(i?.id??""),this.docService.getDocumentPaths()?.clientOrganizationId??"",d),(u?.isSuccess||u===null)&&(yield Hy(l.firestoreRef))}else yield Hy(l.firestoreRef)}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${t}`,u)}}),void 0,s,o)}catch(l){this.loggingService.catch(`Error in deleteData for ${t}`,l)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(t){return this.loggingService.catch("Error in shouldUseFirestore:",t),!1}}generateDocumentId(){try{let t=this.firestoreService.generateFirestoreDocumentId();return t||(t=J()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),J()||"noDocumentId"}}queryData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();return!t||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):s?yield this.handleFirestoreQuery(t,i):yield this.handleRtdbQuery(t,i)}catch(s){return this.loggingService.catch(`Error in queryData for ${t}`,s),[]}})}handleFirestoreQuery(t,i){return I(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let o=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),[];try{let s=Dp(this.firestore,o);i?.useCollectionGroup&&(s=PM(this.firestore,o));let a=i?.firestoreQuery??[],c=FM(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield U3(c).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,u),null));return l?l.data().count:0}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,l),0}else try{let l=yield B3(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,d),null));if(!l)return[];let u=l.docs.map(d=>d.data());try{return yield this.commonDbUtilsService.modifyData({feature:t,data:u})}catch(d){return this.loggingService.catch(`Error in modifyData for ${t}`,d),u}}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,l),[]}}catch(s){return this.loggingService.catch(`Error in Firestore query for ${t}:`,s),[]}}catch(o){return this.loggingService.catch(`Error in Firestore query for ${t}:`,o),[]}})}handleRtdbQuery(t,i){return I(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let o=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No database path found for ${t}`),[];try{let s=wa(this.db,o),a=i?.rtdbQuery??[],c=Tw(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield Ew(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),null));if(!l)return[];let u=l.val();return u?i?.skipObjectValues?u:Object.values(u??{}):[]}catch(s){return this.loggingService.catch(`Error in RTDB query for ${t}:`,s),[]}})}getData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();if(i?.skipFirestore&&(s=!1),!t||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(s&&this.firestore){let a=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield V3(Hh(this.firestore,a)).catch(u=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let l=c.data();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${t}:`,c),{}}}if(this.db){let a=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${t}`),{};try{if(!this.authService.getUser())return{};let c=yield Ew(wa(this.db,a)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let l=c.val();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${t}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(s){return this.loggingService.catch("Unexpected error in getData:",s),{}}})}dbListener({feature:t,properties:i}){let o=this.shouldUseFirestore();i?.skipFirestore&&(o=!1);let s=`${t}-${JSON.stringify(i)}`;return Zr([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Ct(a=>!!a))]).pipe(Ct(([a,c])=>a?o&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${t}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${t}`),!1)),mt(([a,c])=>{try{if(o&&c){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleFirestoreListener(t,i,c).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.firestoreSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.firestoreSubscriptions[s]?.unsubscribe(),delete this.firestoreSubscriptions[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache[s]))}})}else if(a){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleRealtimeDbListener(t,i,a).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.rtdbSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.rtdbSubscriptions[s]?.unsubscribe(),delete this.rtdbSubscriptions?.[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache?.[s]))}})}return ue({})}catch(l){return this.loggingService.catch(`Error setting up listener for ${t}:`,l),ue({})}}),Sc(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${t} and key ${s}`)}))}handleFirestoreListener(t,i,o){let s=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),a=`${t}-${JSON.stringify(i)}`;return s?new ge(c=>{let l=i.isCollection?this.setupCollectionListener(o,s,t,c,i):this.setupDocumentListener(o,s,t,c,i);return()=>{c.complete(),c.unsubscribe(),l(),this.observablesCache[a]?.subject?.complete(),this.observablesCache[a]?.subject?.unsubscribe(),delete this.observablesCache[a]}}).pipe(mt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),mt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):ue(c)),it(Ft)):(this.loggingService.warn(`[WB] No firestore path found for ${t} and key ${a}`),ue({}))}setupCollectionListener(t,i,o,s,a){let c=`${o}-${JSON.stringify(a)}`,l=Dp(t,i);if(a?.useCollectionGroup&&(l=PM(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=FM(l,...f)}let u=!0,d=[];return o==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",i,"feature:",o,"properties:",JSON.stringify(a??"nil")),xM(l,f=>{try{let g=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),p=null,_=!1;f?.docChanges()?.length?f.docChanges().forEach(T=>{["allComments","allReactions","allRecorders"].includes(o)&&!u&&T.type!=="removed"&&d.push(T.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:o,change:T,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(_=!0,Object.assign(g,this.handleCollectionChange(T,g)),T.type==="removed"&&(p||(p={type:T.type,ids:[]}),p.ids.push(T.doc.id)))}):_=!0,_&&(["allComments","allReactions","allRecorders"].includes(o)&&d?.length&&(this.commonDbUtilsService.resolveAnnotations({data:d,feature:o}),d=[]),this.commonDbUtilsService.modifyAndSetData({feature:o,data:g,subscriber:s,operation:p})),u=!1}catch(g){this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,g),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(g,o,s)}},f=>{this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,f),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(f,o,s)})}handleCollectionChange(t,i){switch(t.type){case"added":case"modified":i[t.doc.id]=t.doc.data();break;case"removed":delete i?.[t.doc.id];break}return i}setupDocumentListener(t,i,o,s,a){let c=Hh(t,i);return xM(c,l=>{try{let u=l.data()||{};a?.field&&(u=u?.[a?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:o,data:u,subscriber:s,operation:null})}catch(u){this.handleListenerError(u,o,s)}},l=>this.handleListenerError(l,o,s))}handleListenerError(t,i,o){this.loggingService.catch(`Firestore listener error for ${i}:`,t)}handleRealtimeDbListener(t,i,o){let s=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${t}`),ue({});let a=wa(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=Tw(a,...c)}return this.objectValFromChildEvents(a,t).pipe(ts(c=>(this.loggingService.catch(`RTDB listener error for ${t}:`,c),ue({}))),fe(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((u,[d,f])=>(u[d]=this.commonDbUtilsService.addMetadata(f,i),u),{}):this.commonDbUtilsService.addMetadata(c,i))),mt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),mt(c=>this.usersService.getUserById$().pipe(fe(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:t,data:c}),operation:null})))))}pushData(s){return I(this,arguments,function*({feature:t,properties:i,data:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: pushData for ${t}`,"color: green;"),this.performDatabaseOperation(t,i,a=>I(this,null,function*(){if(a.dbRef){let c=P2(a.dbRef);yield vw(c,JSON.parse(JSON.stringify(a.data)))}}),o)}catch(a){this.loggingService.catch(`Error in pushData for ${t}`,a)}})}streamChildAdded({feature:t,properties:i,afterTs:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: streamChildAdded for ${t}`,"color: green;"),new ge(s=>{let a=null,c=!1,l=({db:u})=>{if(!u||c||!this.authService.getUser())return;let d=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:!1});if(!d)return;let g=wa(u,d),p=!1,_=b=>{try{let G=b.val();if(p){if(o!=null&&G?.timestamp!=null&&G.timestamp<=o)return;s.next(G)}}catch(G){this.loggingService.catch(`streamChildAdded onChildAdded callback error for ${t}:`,G)}},T=b=>{try{this.loggingService.catch(`streamChildAdded error for ${t}:`,b),s.error(b)}catch(G){this.loggingService.catch(`streamChildAdded onError handler error for ${t}:`,G)}};_w(g,_,T);let D=gv(g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{D&&typeof D=="function"&&D(),Am(g,"child_added",_)}catch(b){this.loggingService.catch(`streamChildAdded cleanup error for ${t}:`,b)}}};return this.subscribeToServices(l),()=>{c=!0,a&&a()}})}catch(s){return this.loggingService.catch(`Error in streamChildAdded for ${t}`,s),ue(null)}}objectValFromChildEvents(t,i){return new ge(o=>{let s={},a=!1,c=null,l=T=>{try{this.loggingService.catch(`Realtime DB listener error for ${i}:`,T),o.error(T)}catch{}},u=T=>{try{if(!ki(T,c)){let D=JSON.parse(JSON.stringify(T));c=D,o.next(D)}}catch{}},d=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(x({},s)))}catch{}},f=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(x({},s)))}catch{}},g=T=>{try{T.key&&(delete s[T.key],a&&u(x({},s)))}catch{}},p=T=>{try{if(!a){let D=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=D,o.next(D),a=!0}}catch{}};_w(t,d,l),b2(t,f,l),L2(t,g,l);let _=gv(t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),Am(t,"child_added",d),Am(t,"child_changed",f),Am(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(w(Xy),w(Cr),w(Z3),w(It),w(_e),w(ez),w(Wy),w(Rr),w(zh),w(zt),w(zo),w(qo),w(ec),w(Zy),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();export{x as a,le as b,dS as c,pse as d,Ese as e,_se as f,I as g,gt as h,ge as i,RS as j,Ot as k,Y as l,Ac as m,l6 as n,u6 as o,Ic as p,xr as q,ue as r,d6 as s,h6 as t,Qz as u,fe as v,Zr as w,GS as x,f6 as y,ho as z,I6 as A,Ci as B,Hz as C,Pu as D,Ct as E,Pz as F,ts as G,yS as H,Au as I,Nt as J,DS as K,it as L,Du as M,dE as N,NS as O,Wz as P,OS as Q,zz as R,Ru as S,mt as T,qs as U,qz as V,Ks as W,Kz as X,Jz as Y,oe as Z,ME as _,K as $,is as aa,Z as ba,w as ca,ne as da,pr as ea,Kn as fa,fo as ga,w0 as ha,b0 as ia,$0 as ja,j0 as ka,St as la,Dn as ma,cr as na,Fr as oa,To as pa,jc as qa,ei as ra,J6 as sa,pn as ta,VD as ua,E4 as va,sa as wa,g_ as xa,w_ as ya,D4 as za,iq as Aa,oq as Ba,sq as Ca,aq as Da,cq as Ea,Dq as Fa,cs as Ga,Le as Ha,Mq as Ia,y8 as Ja,S8 as Ka,yo as La,Yf as Ma,ds as Na,j_ as Oa,ut as Pa,M8 as Qa,Do as Ra,Kc as Sa,Tk as Ta,I5 as Ua,aa as Va,Ro as Wa,Xf as Xa,Dk as Ya,w5 as Za,Nk as _a,Ok as $a,z_ as ab,ca as bb,xk as cb,Fk as db,k5 as eb,V5 as fb,B5 as gb,G5 as hb,$5 as ib,j5 as jb,H5 as kb,kk as lb,AR as mb,DR as nb,Uk as ob,RR as pb,CR as qb,Vk as rb,NR as sb,OR as tb,Gk as ub,Q5 as vb,$k as wb,Hk as xb,Wk as yb,t9 as zb,r9 as Ab,i9 as Bb,s9 as Cb,a9 as Db,c9 as Eb,l9 as Fb,u9 as Gb,d9 as Hb,h9 as Ib,Xk as Jb,Jk as Kb,D9 as Lb,C9 as Mb,k9 as Nb,aU as Ob,wR as Pb,cU as Qb,lU as Rb,uU as Sb,G9 as Tb,dU as Ub,fU as Vb,$9 as Wb,j9 as Xb,H9 as Yb,W9 as Zb,Q9 as _b,X9 as $b,J9 as ac,Z9 as bc,eK as cc,tK as dc,nK as ec,rK as fc,iK as gc,oK as hc,sK as ic,aK as jc,lK as kc,dK as lc,hK as mc,fK as nc,gK as oc,mK as pc,_K as qc,rg as rc,ig as sc,xR as tc,qve as uc,Kve as vc,Yve as wc,KK as xc,qR as yc,Qve as zc,Xve as Ac,Jve as Bc,Co as Cc,HU as Dc,fY as Ec,a1 as Fc,gY as Gc,eC as Hc,mY as Ic,pY as Jc,EY as Kc,_Y as Lc,IY as Mc,yY as Nc,AY as Oc,tC as Pc,uC as Qc,GY as Rc,HY as Sc,O1 as Tc,g7 as Uc,m7 as Vc,pC as Wc,G1 as Xc,IC as Yc,Nd as Zc,Hr as _c,ha as $c,KT as ad,sl as bd,vr as cd,Ge as dd,_n as ed,ur as fd,Po as gd,yr as hd,pa as id,Sr as jd,Qe as kd,IX as ld,pbe as md,Ebe as nd,_be as od,Bi as pd,Ea as qd,vs as rd,Gi as sd,pe as td,$i as ud,ys as vd,Fbe as wd,kbe as xd,Ube as yd,Ta as zd,jJ as Ad,WJ as Bd,iZ as Cd,hl as Dd,fl as Ed,IMe as Fd,bd as Gd,EI as Hd,vMe as Id,g2 as Jd,dv as Kd,GPe as Ld,$Pe as Md,jPe as Nd,HPe as Od,WPe as Pd,zPe as Qd,qPe as Rd,M2 as Sd,gv as Td,KPe as Ud,P2 as Vd,wa as Wd,x2 as Xd,Iw as Yd,vw as Zd,YPe as _d,F2 as $d,dr as ae,VMe as be,BMe as ce,GMe as de,Dr as ee,H1 as fe,U7 as ge,Sg as he,st as ie,L as je,Ie as ke,Qt as le,pAe as me,EAe as ne,_Ae as oe,TAe as pe,$ as qe,IAe as re,vAe as se,yAe as te,SAe as ue,_7 as ve,T7 as we,I7 as xe,v7 as ye,_T as ze,y7 as Ae,S7 as Be,A7 as Ce,EC as De,D7 as Ee,$r as Fe,TT as Ge,R7 as He,md as Ie,wt as Je,C7 as Ke,Tg as Le,N7 as Me,O7 as Ne,w7 as Oe,b7 as Pe,L7 as Qe,M7 as Re,P7 as Se,v as Te,U1 as Ue,tDe as Ve,_d as We,H as Xe,oDe as Ye,sDe as Ze,ui as _e,bt as $e,W1 as af,z1 as bf,xDe as cf,FDe as df,bT as ef,vC as ff,LT as gf,xn as hf,tl as if,No as jf,Y1 as kf,Q1 as lf,X1 as mf,_s as nf,V7 as of,Un as pf,di as qf,J1 as rf,Z1 as sf,eV as tf,tV as uf,nV as vf,rV as wf,iV as xf,oV as yf,sV as zf,aV as Af,cV as Bf,B7 as Cf,G7 as Df,lV as Ef,AC as Ff,uV as Gf,dV as Hf,fV as If,$7 as Jf,Oo as Kf,j7 as Lf,H7 as Mf,vOe as Nf,OV as Of,Tr as Pf,Fi as Qf,da as Rf,Ts as Sf,wo as Tf,LOe as Uf,MOe as Vf,POe as Wf,xOe as Xf,FOe as Yf,kOe as Zf,UOe as _f,bV as $f,J as ag,VOe as bg,LV as cg,Sd as dg,SV as eg,AV as fg,z7 as gg,q7 as hg,il as ig,NC as jg,BOe as kg,bo as lg,GOe as mg,Rg as ng,ki as og,$Oe as pg,OC as qg,rl as rg,Q7 as sg,VT as tg,jOe as ug,HOe as vg,PV as wg,Cg as xg,X7 as yg,J7 as zg,Z7 as Ag,eQ as Bg,tQ as Cg,jr as Dg,WOe as Eg,RC as Fg,zOe as Gg,rQ as Hg,qOe as Ig,KOe as Jg,FV as Kg,YOe as Lg,QOe as Mg,XOe as Ng,JOe as Og,ZOe as Pg,ewe as Qg,twe as Rg,UT as Sg,nwe as Tg,rwe as Ug,iwe as Vg,owe as Wg,swe as Xg,awe as Yg,cwe as Zg,lwe as _g,uwe as $g,dwe as ah,hwe as bh,fwe as ch,gwe as dh,mwe as eh,pwe as fh,Ewe as gh,_we as hh,Twe as ih,Iwe as jh,vwe as kh,ywe as lh,Swe as mh,Awe as nh,Dwe as oh,Rwe as ph,aQ as qh,Cwe as rh,Nwe as sh,Owe as th,RV as uh,wwe as vh,bwe as wh,Ft as xh,Cn as yh,Lwe as zh,kt as Ah,Ht as Bh,Mwe as Ch,$V as Dh,Ad as Eh,bC as Fh,Ir as Gh,Pwe as Hh,CV as Ih,IT as Jh,NAe as Kh,OAe as Lh,xi as Mh,wAe as Nh,vT as Oh,bAe as Ph,LAe as Qh,yT as Rh,MAe as Sh,ST as Th,PAe as Uh,AT as Vh,xAe as Wh,ci as Xh,FAe as Yh,pd as Zh,kAe as _h,UAe as $h,VAe as ai,BAe as bi,GAe as ci,$Ae as di,jAe as ei,DT as fi,HAe as gi,WAe as hi,RT as ii,CT as ji,P1 as ki,x1 as li,F1 as mi,li as ni,Lt as oi,_e as pi,Rr as qi,U2 as ri,It as si,pv as ti,Ev as ui,Cr as vi,MM as wi,Lxe as xi,Mxe as yi,Pxe as zi,xxe as Ai,Ji as Bi,Wy as Ci,zo as Di,qo as Ei,Wh as Fi,ec as Gi,zh as Hi,zt as Ii,Ky as Ji,Yy as Ki,Xy as Li,Jy as Mi,z3 as Ni,Zy as Oi,Z3 as Pi,jke as Qi};
|
|
166
|
+
)`}copy(e,r){let t=new n;return t.comparator=this.comparator,t.keyedMap=e,t.sortedSet=r,t}};var _y=class{constructor(){this.fa=new Dt(ie.comparator)}track(e){let r=e.doc.key,t=this.fa.get(r);t?e.type!==0&&t.type===3?this.fa=this.fa.insert(r,e):e.type===3&&t.type!==1?this.fa=this.fa.insert(r,{type:t.type,doc:e.doc}):e.type===2&&t.type===2?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):e.type===2&&t.type===0?this.fa=this.fa.insert(r,{type:0,doc:e.doc}):e.type===1&&t.type===0?this.fa=this.fa.remove(r):e.type===1&&t.type===2?this.fa=this.fa.insert(r,{type:1,doc:t.doc}):e.type===0&&t.type===1?this.fa=this.fa.insert(r,{type:2,doc:e.doc}):ae(63341,{At:e,ga:t}):this.fa=this.fa.insert(r,e)}pa(){let e=[];return this.fa.inorderTraversal((r,t)=>{e.push(t)}),e}},Mh=class n{constructor(e,r,t,i,o,s,a,c,l){this.query=e,this.docs=r,this.oldDocs=t,this.docChanges=i,this.mutatedKeys=o,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,r,t,i,o){let s=[];return r.forEach(a=>{s.push({type:0,doc:a})}),new n(e,r,Ey.emptySet(r),s,t,i,!0,!1,o)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Fy(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let r=this.docChanges,t=e.docChanges;if(r.length!==t.length)return!1;for(let i=0;i<r.length;i++)if(r[i].type!==t[i].type||!r[i].doc.isEqual(t[i].doc))return!1;return!0}};var IL=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}},vL=class{constructor(){this.queries=lH(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(r,t){let i=de(r),o=i.queries;i.queries=lH(),o.forEach((s,a)=>{for(let c of a.wa)c.onError(t)})})(this,new Q(j.ABORTED,"Firestore shutting down"))}};function lH(){return new Ki(n=>nW(n),Fy)}function _M(n,e){return I(this,null,function*(){let r=de(n),t=3,i=e.query,o=r.queries.get(i);o?!o.Sa()&&e.ba()&&(t=2):(o=new IL,t=e.ba()?0:1);try{switch(t){case 0:o.ya=yield r.onListen(i,!0);break;case 1:o.ya=yield r.onListen(i,!1);break;case 2:yield r.onFirstRemoteStoreListen(i)}}catch(s){let a=EM(s,`Initialization of query '${sh(e.query)}' failed`);return void e.onError(a)}r.queries.set(i,o),o.wa.push(e),e.va(r.onlineState),o.ya&&e.Ca(o.ya)&&IM(r)})}function TM(n,e){return I(this,null,function*(){let r=de(n),t=e.query,i=3,o=r.queries.get(t);if(o){let s=o.wa.indexOf(e);s>=0&&(o.wa.splice(s,1),o.wa.length===0?i=e.ba()?0:1:!o.Sa()&&e.ba()&&(i=2))}switch(i){case 0:return r.queries.delete(t),r.onUnlisten(t,!0);case 1:return r.queries.delete(t),r.onUnlisten(t,!1);case 2:return r.onLastRemoteStoreUnlisten(t);default:return}})}function Coe(n,e){let r=de(n),t=!1;for(let i of e){let o=i.query,s=r.queries.get(o);if(s){for(let a of s.wa)a.Ca(i)&&(t=!0);s.ya=i}}t&&IM(r)}function Noe(n,e,r){let t=de(n),i=t.queries.get(e);if(i)for(let o of i.wa)o.onError(r);t.queries.delete(e)}function IM(n){n.Da.forEach(e=>{e.next()})}var yL,uH;(uH=yL||(yL={})).Fa="default",uH.Cache="cache";var hp=class{constructor(e,r,t){this.query=e,this.Ma=r,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=t||{}}Ca(e){if(!this.options.includeMetadataChanges){let t=[];for(let i of e.docChanges)i.type!==3&&t.push(i);e=new Mh(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let r=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),r=!0):this.Ba(e,this.onlineState)&&(this.La(e),r=!0),this.Oa=e,r}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let r=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),r=!0),r}Ba(e,r){if(!e.fromCache||!this.ba())return!0;let t=r!=="Offline";return(!this.options.ka||!t)&&(!e.docs.isEmpty()||e.hasCachedResults||r==="Offline")}Na(e){if(e.docChanges.length>0)return!0;let r=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!r)&&this.options.includeMetadataChanges===!0}La(e){e=Mh.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==yL.Cache}};var Ty=class{constructor(e){this.key=e}},Iy=class{constructor(e){this.key=e}},SL=class{constructor(e,r){this.query=e,this.Ha=r,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=Ve(),this.mutatedKeys=Ve(),this.Xa=iW(e),this.eu=new Ey(this.Xa)}get tu(){return this.Ha}nu(e,r){let t=r?r.ru:new _y,i=r?r.eu:this.eu,o=r?r.mutatedKeys:this.mutatedKeys,s=i,a=!1,c=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,l=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((u,d)=>{let f=i.get(u),g=yp(this.query,d)?d:null,p=!!f&&this.mutatedKeys.has(f.key),_=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations),T=!1;f&&g?f.data.isEqual(g.data)?p!==_&&(t.track({type:3,doc:g}),T=!0):this.iu(f,g)||(t.track({type:2,doc:g}),T=!0,(c&&this.Xa(g,c)>0||l&&this.Xa(g,l)<0)&&(a=!0)):!f&&g?(t.track({type:0,doc:g}),T=!0):f&&!g&&(t.track({type:1,doc:f}),T=!0,(c||l)&&(a=!0)),T&&(g?(s=s.add(g),o=_?o.add(u):o.delete(u)):(s=s.delete(u),o=o.delete(u)))}),this.query.limit!==null)for(;s.size>this.query.limit;){let u=this.query.limitType==="F"?s.last():s.first();s=s.delete(u.key),o=o.delete(u.key),t.track({type:1,doc:u})}return{eu:s,ru:t,Ds:a,mutatedKeys:o}}iu(e,r){return e.hasLocalMutations&&r.hasCommittedMutations&&!r.hasLocalMutations}applyChanges(e,r,t,i){let o=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;let s=e.ru.pa();s.sort((u,d)=>(function(g,p){let _=T=>{switch(T){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ae(20277,{At:T})}};return _(g)-_(p)})(u.type,d.type)||this.Xa(u.doc,d.doc)),this.su(t),i=i!=null&&i;let a=r&&!i?this.ou():[],c=this.Za.size===0&&this.current&&!i?1:0,l=c!==this.Ya;return this.Ya=c,s.length!==0||l?{snapshot:new Mh(this.query,e.eu,o,s,e.mutatedKeys,c===0,l,!1,!!t&&t.resumeToken.approximateByteSize()>0),_u:a}:{_u:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new _y,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(r=>this.Ha=this.Ha.add(r)),e.modifiedDocuments.forEach(r=>{}),e.removedDocuments.forEach(r=>this.Ha=this.Ha.delete(r)),this.current=e.current)}ou(){if(!this.current)return[];let e=this.Za;this.Za=Ve(),this.eu.forEach(t=>{this.au(t.key)&&(this.Za=this.Za.add(t.key))});let r=[];return e.forEach(t=>{this.Za.has(t)||r.push(new Iy(t))}),this.Za.forEach(t=>{e.has(t)||r.push(new Ty(t))}),r}uu(e){this.Ha=e.qs,this.Za=Ve();let r=this.nu(e.documents);return this.applyChanges(r,!0)}cu(){return Mh.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},Gh="SyncEngine",AL=class{constructor(e,r,t){this.query=e,this.targetId=r,this.view=t}},DL=class{constructor(e){this.key=e,this.lu=!1}},RL=class{constructor(e,r,t,i,o,s){this.localStore=e,this.remoteStore=r,this.eventManager=t,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new Ki(a=>nW(a),Fy),this.Tu=new Map,this.Iu=new Set,this.du=new Dt(ie.comparator),this.Eu=new Map,this.Au=new cp,this.Ru={},this.Vu=new Map,this.mu=wh.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function Ooe(n,e,r=!0){return I(this,null,function*(){let t=By(n),i,o=t.Pu.get(e);return o?(t.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield ez(t,e,r,!0),i})}function woe(n,e){return I(this,null,function*(){let r=By(n);yield ez(r,e,!0,!1)})}function ez(n,e,r,t){return I(this,null,function*(){let i=yield uy(n.localStore,Xr(e)),o=i.targetId,s=n.sharedClientState.addLocalQueryTarget(o,r),a;return t&&(a=yield vM(n,e,o,s==="current",i.resumeToken)),n.isPrimaryClient&&r&&Vy(n.remoteStore,i),a})}function vM(n,e,r,t,i){return I(this,null,function*(){n.gu=(d,f,g)=>(function(_,T,D,b){return I(this,null,function*(){let G=T.view.nu(D);G.Ds&&(G=yield oL(_.localStore,T.query,!1).then(({documents:S})=>T.view.nu(S,G)));let M=b&&b.targetChanges.get(T.targetId),U=b&&b.targetMismatches.get(T.targetId)!=null,k=T.view.applyChanges(G,_.isPrimaryClient,M,U);return CL(_,T.targetId,k._u),k.snapshot})})(n,d,f,g);let o=yield oL(n.localStore,e,!0),s=new SL(e,o.qs),a=s.nu(o.documents),c=ip.createSynthesizedTargetChangeForCurrentChange(r,t&&n.onlineState!=="Offline",i),l=s.applyChanges(a,n.isPrimaryClient,c);CL(n,r,l._u);let u=new AL(e,r,s);return n.Pu.set(e,u),n.Tu.has(r)?n.Tu.get(r).push(e):n.Tu.set(r,[e]),l.snapshot})}function boe(n,e,r){return I(this,null,function*(){let t=de(n),i=t.Pu.get(e),o=t.Tu.get(i.targetId);if(o.length>1)return t.Tu.set(i.targetId,o.filter(s=>!Fy(s,e))),void t.Pu.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(i.targetId),t.sharedClientState.isActiveQueryTarget(i.targetId)||(yield bh(t.localStore,i.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(i.targetId),r&&Lh(t.remoteStore,i.targetId),Ph(t,i.targetId)}).catch(Qa))):(Ph(t,i.targetId),yield bh(t.localStore,i.targetId,!0))})}function Loe(n,e){return I(this,null,function*(){let r=de(n),t=r.Pu.get(e),i=r.Tu.get(t.targetId);r.isPrimaryClient&&i.length===1&&(r.sharedClientState.removeLocalQueryTarget(t.targetId),Lh(r.remoteStore,t.targetId))})}function Moe(n,e,r){return I(this,null,function*(){let t=DM(n);try{let i=yield(function(s,a){let c=de(s),l=Pt.now(),u=a.reduce((g,p)=>g.add(p.key),Ve()),d,f;return c.persistence.runTransaction("Locally write mutations","readwrite",g=>{let p=Qr(),_=Ve();return c.Os.getEntries(g,u).next(T=>{p=T,p.forEach((D,b)=>{b.isValidDocument()||(_=_.add(D))})}).next(()=>c.localDocuments.getOverlayedDocuments(g,p)).next(T=>{d=T;let D=[];for(let b of a){let G=Wie(b,d.get(b.key).overlayedDocument);G!=null&&D.push(new Yi(b.key,G,KH(G.value.mapValue),Gn.exists(!0)))}return c.mutationQueue.addMutationBatch(g,l,D,a)}).next(T=>{f=T;let D=T.applyToLocalDocumentSet(d,_);return c.documentOverlayCache.saveOverlays(g,T.batchId,D)})}).then(()=>({batchId:f.batchId,changes:sW(d)}))})(t.localStore,e);t.sharedClientState.addPendingMutation(i.batchId),(function(s,a,c){let l=s.Ru[s.currentUser.toKey()];l||(l=new Dt(Re)),l=l.insert(a,c),s.Ru[s.currentUser.toKey()]=l})(t,i.batchId,r),yield Za(t,i.changes),yield Vh(t.remoteStore)}catch(i){let o=EM(i,"Failed to persist write");r.reject(o)}})}function tz(n,e){return I(this,null,function*(){let r=de(n);try{let t=yield foe(r.localStore,e);e.targetChanges.forEach((i,o)=>{let s=r.Eu.get(o);s&&(he(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?s.lu=!0:i.modifiedDocuments.size>0?he(s.lu,14607):i.removedDocuments.size>0&&(he(s.lu,42227),s.lu=!1))}),yield Za(r,t,e)}catch(t){yield Qa(t)}})}function dH(n,e,r){let t=de(n);if(t.isPrimaryClient&&r===0||!t.isPrimaryClient&&r===1){let i=[];t.Pu.forEach((o,s)=>{let a=s.view.va(e);a.snapshot&&i.push(a.snapshot)}),(function(s,a){let c=de(s);c.onlineState=a;let l=!1;c.queries.forEach((u,d)=>{for(let f of d.wa)f.va(a)&&(l=!0)}),l&&IM(c)})(t.eventManager,e),i.length&&t.hu.J_(i),t.onlineState=e,t.isPrimaryClient&&t.sharedClientState.setOnlineState(e)}}function Poe(n,e,r){return I(this,null,function*(){let t=de(n);t.sharedClientState.updateQueryState(e,"rejected",r);let i=t.Eu.get(e),o=i&&i.key;if(o){let s=new Dt(ie.comparator);s=s.insert(o,In.newNoDocument(o,me.min()));let a=Ve().add(o),c=new rp(me.min(),new Map,new Dt(Re),s,a);yield tz(t,c),t.du=t.du.remove(o),t.Eu.delete(e),AM(t)}else yield bh(t.localStore,e,!1).then(()=>Ph(t,e,r)).catch(Qa)})}function xoe(n,e){return I(this,null,function*(){let r=de(n),t=e.batch.batchId;try{let i=yield hoe(r.localStore,e);SM(r,t,null),yM(r,t),r.sharedClientState.updateMutationState(t,"acknowledged"),yield Za(r,i)}catch(i){yield Qa(i)}})}function Foe(n,e,r){return I(this,null,function*(){let t=de(n);try{let i=yield(function(s,a){let c=de(s);return c.persistence.runTransaction("Reject batch","readwrite-primary",l=>{let u;return c.mutationQueue.lookupMutationBatch(l,a).next(d=>(he(d!==null,37113),u=d.keys(),c.mutationQueue.removeMutationBatch(l,d))).next(()=>c.mutationQueue.performConsistencyCheck(l)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(l,u,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(l,u)).next(()=>c.localDocuments.getDocuments(l,u))})})(t.localStore,e);SM(t,e,r),yM(t,e),t.sharedClientState.updateMutationState(e,"rejected",r),yield Za(t,i)}catch(i){yield Qa(i)}})}function yM(n,e){(n.Vu.get(e)||[]).forEach(r=>{r.resolve()}),n.Vu.delete(e)}function SM(n,e,r){let t=de(n),i=t.Ru[t.currentUser.toKey()];if(i){let o=i.get(e);o&&(r?o.reject(r):o.resolve(),i=i.remove(e)),t.Ru[t.currentUser.toKey()]=i}}function Ph(n,e,r=null){n.sharedClientState.removeLocalQueryTarget(e);for(let t of n.Tu.get(e))n.Pu.delete(t),r&&n.hu.pu(t,r);n.Tu.delete(e),n.isPrimaryClient&&n.Au.zr(e).forEach(t=>{n.Au.containsKey(t)||nz(n,t)})}function nz(n,e){n.Iu.delete(e.path.canonicalString());let r=n.du.get(e);r!==null&&(Lh(n.remoteStore,r),n.du=n.du.remove(e),n.Eu.delete(r),AM(n))}function CL(n,e,r){for(let t of r)t instanceof Ty?(n.Au.addReference(t.key,e),koe(n,t)):t instanceof Iy?(X(Gh,"Document no longer in limbo: "+t.key),n.Au.removeReference(t.key,e),n.Au.containsKey(t.key)||nz(n,t.key)):ae(19791,{yu:t})}function koe(n,e){let r=e.key,t=r.path.canonicalString();n.du.get(r)||n.Iu.has(t)||(X(Gh,"New document in limbo: "+r),n.Iu.add(t),AM(n))}function AM(n){for(;n.Iu.size>0&&n.du.size<n.maxConcurrentLimboResolutions;){let e=n.Iu.values().next().value;n.Iu.delete(e);let r=new ie(We.fromString(e)),t=n.mu.next();n.Eu.set(t,new DL(r)),n.du=n.du.insert(r,t),Vy(n.remoteStore,new Oh(Xr(vp(r.path)),t,"TargetPurposeLimboResolution",Kr.ue))}}function Za(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[],s=[];t.Pu.isEmpty()||(t.Pu.forEach((a,c)=>{s.push(t.gu(c,e,r).then(l=>{var u;if((l||r)&&t.isPrimaryClient){let d=l?!l.fromCache:(u=r?.targetChanges.get(c.targetId))===null||u===void 0?void 0:u.current;t.sharedClientState.updateQueryState(c.targetId,d?"current":"not-current")}if(l){i.push(l);let d=nL.Es(c.targetId,l);o.push(d)}}))}),yield Promise.all(s),t.hu.J_(i),yield(function(c,l){return I(this,null,function*(){let u=de(c);try{yield u.persistence.runTransaction("notifyLocalViewChanges","readwrite",d=>B.forEach(l,f=>B.forEach(f.Is,g=>u.persistence.referenceDelegate.addReference(d,f.targetId,g)).next(()=>B.forEach(f.ds,g=>u.persistence.referenceDelegate.removeReference(d,f.targetId,g)))))}catch(d){if(!Xa(d))throw d;X(fM,"Failed to update sequence numbers: "+d)}for(let d of l){let f=d.targetId;if(!d.fromCache){let g=u.Fs.get(f),p=g.snapshotVersion,_=g.withLastLimboFreeSnapshotVersion(p);u.Fs=u.Fs.insert(f,_)}}})})(t.localStore,o))})}function Uoe(n,e){return I(this,null,function*(){let r=de(n);if(!r.currentUser.isEqual(e)){X(Gh,"User change. New user:",e.toKey());let t=yield BW(r.localStore,e);r.currentUser=e,(function(o,s){o.Vu.forEach(a=>{a.forEach(c=>{c.reject(new Q(j.CANCELLED,s))})}),o.Vu.clear()})(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),yield Za(r,t.Bs)}})}function Voe(n,e){let r=de(n),t=r.Eu.get(e);if(t&&t.lu)return Ve().add(t.key);{let i=Ve(),o=r.Tu.get(e);if(!o)return i;for(let s of o){let a=r.Pu.get(s);i=i.unionWith(a.view.tu)}return i}}function Boe(n,e){return I(this,null,function*(){let r=de(n),t=yield oL(r.localStore,e.query,!0),i=e.view.uu(t);return r.isPrimaryClient&&CL(r,e.targetId,i._u),i})}function Goe(n,e){return I(this,null,function*(){let r=de(n);return jW(r.localStore,e).then(t=>Za(r,t))})}function $oe(n,e,r,t){return I(this,null,function*(){let i=de(n),o=yield(function(a,c){let l=de(a),u=de(l.mutationQueue);return l.persistence.runTransaction("Lookup mutation documents","readonly",d=>u.Xn(d,c).next(f=>f?l.localDocuments.getDocuments(d,f):B.resolve(null)))})(i.localStore,e);o!==null?(r==="pending"?yield Vh(i.remoteStore):r==="acknowledged"||r==="rejected"?(SM(i,e,t||null),yM(i,e),(function(a,c){de(de(a).mutationQueue).rr(c)})(i.localStore,e)):ae(6720,"Unknown batchState",{wu:r}),yield Za(i,o)):X(Gh,"Cannot apply mutation batch with id: "+e)})}function joe(n,e){return I(this,null,function*(){let r=de(n);if(By(r),DM(r),e===!0&&r.fu!==!0){let t=r.sharedClientState.getAllActiveQueryTargets(),i=yield hH(r,t.toArray());r.fu=!0,yield _L(r.remoteStore,!0);for(let o of i)Vy(r.remoteStore,o)}else if(e===!1&&r.fu!==!1){let t=[],i=Promise.resolve();r.Tu.forEach((o,s)=>{r.sharedClientState.isLocalQueryTarget(s)?t.push(s):i=i.then(()=>(Ph(r,s),bh(r.localStore,s,!0))),Lh(r.remoteStore,s)}),yield i,yield hH(r,t),(function(s){let a=de(s);a.Eu.forEach((c,l)=>{Lh(a.remoteStore,l)}),a.Au.jr(),a.Eu=new Map,a.du=new Dt(ie.comparator)})(r),r.fu=!1,yield _L(r.remoteStore,!1)}})}function hH(n,e,r){return I(this,null,function*(){let t=de(n),i=[],o=[];for(let s of e){let a,c=t.Tu.get(s);if(c&&c.length!==0){a=yield uy(t.localStore,Xr(c[0]));for(let l of c){let u=t.Pu.get(l),d=yield Boe(t,u);d.snapshot&&o.push(d.snapshot)}}else{let l=yield $W(t.localStore,s);a=yield uy(t.localStore,l),yield vM(t,rz(l),s,!1,a.resumeToken)}i.push(a)}return t.hu.J_(o),i})}function rz(n){return eW(n.path,n.collectionGroup,n.orderBy,n.filters,n.limit,"F",n.startAt,n.endAt)}function Hoe(n){return(function(r){return de(de(r).persistence).Ps()})(de(n).localStore)}function Woe(n,e,r,t){return I(this,null,function*(){let i=de(n);if(i.fu)return void X(Gh,"Ignoring unexpected query state notification.");let o=i.Tu.get(e);if(o&&o.length>0)switch(r){case"current":case"not-current":{let s=yield jW(i.localStore,rW(o[0])),a=rp.createSynthesizedRemoteEventForCurrentChange(e,r==="current",un.EMPTY_BYTE_STRING);yield Za(i,s,a);break}case"rejected":yield bh(i.localStore,e,!0),Ph(i,e,t);break;default:ae(64155,r)}})}function zoe(n,e,r){return I(this,null,function*(){let t=By(n);if(t.fu){for(let i of e){if(t.Tu.has(i)&&t.sharedClientState.isActiveQueryTarget(i)){X(Gh,"Adding an already active target "+i);continue}let o=yield $W(t.localStore,i),s=yield uy(t.localStore,o);yield vM(t,rz(o),s.targetId,!1,s.resumeToken),Vy(t.remoteStore,s)}for(let i of r)t.Tu.has(i)&&(yield bh(t.localStore,i,!1).then(()=>{Lh(t.remoteStore,i),Ph(t,i)}).catch(Qa))}})}function By(n){let e=de(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=tz.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Voe.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Poe.bind(null,e),e.hu.J_=Coe.bind(null,e.eventManager),e.hu.pu=Noe.bind(null,e.eventManager),e}function DM(n){let e=de(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=xoe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Foe.bind(null,e),e}var RM=(()=>{class n{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(r){return I(this,null,function*(){this.serializer=ky(r.databaseInfo.databaseId),this.sharedClientState=this.bu(r),this.persistence=this.Du(r),yield this.persistence.start(),this.localStore=this.vu(r),this.gcScheduler=this.Cu(r,this.localStore),this.indexBackfillerScheduler=this.Fu(r,this.localStore)})}Cu(r,t){return null}Fu(r,t){return null}vu(r){return VW(this.persistence,new ly,r.initialUser,this.serializer)}Du(r){return new lp(ay.Vi,this.serializer)}bu(r){return new fy}terminate(){return I(this,null,function*(){var r,t;(r=this.gcScheduler)===null||r===void 0||r.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return n.provider={build:()=>new n},n})(),NL=class extends RM{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,r){he(this.persistence.referenceDelegate instanceof cy,46915);let t=this.persistence.referenceDelegate.garbageCollector;return new iy(t,e.asyncQueue,r)}Du(e){let r=this.cacheSizeBytes!==void 0?Nr.withCacheSize(this.cacheSizeBytes):Nr.DEFAULT;return new lp(t=>cy.Vi(t,r),this.serializer)}},vy=class n extends RM{constructor(e,r,t){super(),this.Mu=e,this.cacheSizeBytes=r,this.forceOwnership=t,this.kind="persistent",this.synchronizeTabs=!1}initialize(e){return I(this,null,function*(){yield pc(n.prototype,this,"initialize").call(this,e),yield this.Mu.initialize(this,e),yield DM(this.Mu.syncEngine),yield Vh(this.Mu.remoteStore),yield this.persistence.ji(()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve()))})}vu(e){return VW(this.persistence,new ly,e.initialUser,this.serializer)}Cu(e,r){let t=this.persistence.referenceDelegate.garbageCollector;return new iy(t,e.asyncQueue,r)}Fu(e,r){let t=new Zw(r,this.persistence);return new Jw(e.asyncQueue,t)}Du(e){let r=UW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),t=this.cacheSizeBytes!==void 0?Nr.withCacheSize(this.cacheSizeBytes):Nr.DEFAULT;return new tL(this.synchronizeTabs,r,e.clientId,t,e.asyncQueue,KW(),Lv(),this.serializer,this.sharedClientState,!!this.forceOwnership)}bu(e){return new fy}},OL=class n extends vy{constructor(e,r){super(e,r,!1),this.Mu=e,this.cacheSizeBytes=r,this.synchronizeTabs=!0}initialize(e){return I(this,null,function*(){yield pc(n.prototype,this,"initialize").call(this,e);let r=this.Mu.syncEngine;this.sharedClientState instanceof $m&&(this.sharedClientState.syncEngine={Do:$oe.bind(null,r),vo:Woe.bind(null,r),Co:zoe.bind(null,r),Ps:Hoe.bind(null,r),bo:Goe.bind(null,r)},yield this.sharedClientState.start()),yield this.persistence.ji(t=>I(this,null,function*(){yield joe(this.Mu.syncEngine,t),this.gcScheduler&&(t&&!this.gcScheduler.started?this.gcScheduler.start():t||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(t&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():t||this.indexBackfillerScheduler.stop())}))})}bu(e){let r=KW();if(!$m.C(r))throw new Q(j.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let t=UW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new $m(r,e.asyncQueue,t,e.clientId,e.initialUser)}},CM=(()=>{class n{initialize(r,t){return I(this,null,function*(){this.localStore||(this.localStore=r.localStore,this.sharedClientState=r.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!r.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>dH(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=Uoe.bind(null,this.syncEngine),yield _L(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(r){return(function(){return new vL})()}createDatastore(r){let t=ky(r.databaseInfo.databaseId),i=(function(s){return new dL(s)})(r.databaseInfo);return(function(s,a,c,l){return new mL(s,a,c,l)})(r.authCredentials,r.appCheckCredentials,i,t)}createRemoteStore(r){return(function(i,o,s,a,c){return new EL(i,o,s,a,c)})(this.localStore,this.datastore,r.asyncQueue,t=>dH(this.syncEngine,t,0),(function(){return gy.C()?new gy:new aL})())}createSyncEngine(r,t){return(function(o,s,a,c,l,u,d){let f=new RL(o,s,a,c,l,u);return d&&(f.fu=!0),f})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,r.initialUser,r.maxConcurrentLimboResolutions,t)}terminate(){return I(this,null,function*(){var r,t;yield(function(o){return I(this,null,function*(){let s=de(o);X(Jl,"RemoteStore shutting down."),s.Ia.add(5),yield Sp(s),s.Ea.shutdown(),s.Aa.set("Unknown")})})(this.remoteStore),(r=this.datastore)===null||r===void 0||r.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()})}}return n.provider={build:()=>new n},n})();var fp=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):Xt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,r){setTimeout(()=>{this.muted||e(r)},0)}};var wL=class{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}lookup(e){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new Q(j.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let r=yield(function(i,o){return I(this,null,function*(){let s=de(i),a={documents:o.map(d=>op(s.serializer,d))},c=yield s.Jo("BatchGetDocuments",s.serializer.databaseId,We.emptyPath(),a,o.length),l=new Map;c.forEach(d=>{let f=Jie(s.serializer,d);l.set(f.key.toString(),f)});let u=[];return o.forEach(d=>{let f=l.get(d.toString());he(!!f,55234,{key:d}),u.push(f)}),u})})(this.datastore,e);return r.forEach(t=>this.recordVersion(t)),r})}set(e,r){this.write(r.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,r){try{this.write(r.toMutation(e,this.preconditionForUpdate(e)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(e.toString())}delete(e){this.write(new Yl(e,this.precondition(e))),this.writtenDocs.add(e.toString())}commit(){return I(this,null,function*(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;let e=this.readVersions;this.mutations.forEach(r=>{e.delete(r.key.toString())}),e.forEach((r,t)=>{let i=ie.fromPath(t);this.mutations.push(new ep(i,this.precondition(i)))}),yield(function(t,i){return I(this,null,function*(){let o=de(t),s={writes:i.map(a=>sp(o.serializer,a))};yield o.Wo("Commit",o.serializer.databaseId,We.emptyPath(),s)})})(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let r;if(e.isFoundDocument())r=e.version;else{if(!e.isNoDocument())throw ae(50498,{Wu:e.constructor.name});r=me.min()}let t=this.readVersions.get(e.key.toString());if(t){if(!r.isEqual(t))throw new Q(j.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),r)}precondition(e){let r=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&r?r.isEqual(me.min())?Gn.exists(!1):Gn.updateTime(r):Gn.none()}preconditionForUpdate(e){let r=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&r){if(r.isEqual(me.min()))throw new Q(j.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Gn.updateTime(r)}return Gn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var bL=class{constructor(e,r,t,i,o){this.asyncQueue=e,this.datastore=r,this.options=t,this.updateFunction=i,this.deferred=o,this.Gu=t.maxAttempts,this.F_=new dp(this.asyncQueue,"transaction_retry")}zu(){this.Gu-=1,this.ju()}ju(){this.F_.g_(()=>I(this,null,function*(){let e=new wL(this.datastore),r=this.Ju(e);r&&r.then(t=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(t)}).catch(i=>{this.Hu(i)}))}).catch(t=>{this.Hu(t)})}))}Ju(e){try{let r=this.updateFunction(e);return!_p(r)&&r.catch&&r.then?r:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.deferred.reject(r),null}}Hu(e){this.Gu>0&&this.Yu(e)?(this.Gu-=1,this.asyncQueue.enqueueAndForget(()=>(this.ju(),Promise.resolve()))):this.deferred.reject(e)}Yu(e){if(e.name==="FirebaseError"){let r=e.code;return r==="aborted"||r==="failed-precondition"||r==="already-exists"||!mW(r)}return!1}};var Ya="FirestoreClient",LL=class{constructor(e,r,t,i,o){this.authCredentials=e,this.appCheckCredentials=r,this.asyncQueue=t,this.databaseInfo=i,this.user=cn.UNAUTHENTICATED,this.clientId=jm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(t,s=>I(this,null,function*(){X(Ya,"Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(t,s=>(X(Ya,"Received new app check token=",s),this.appCheckCredentialListener(s,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 Or;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(()=>I(this,null,function*(){try{this._onlineComponents&&(yield this._onlineComponents.terminate()),this._offlineComponents&&(yield this._offlineComponents.terminate()),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(r){let t=EM(r,"Failed to shutdown persistence");e.reject(t)}})),e.promise}};function Gw(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress(),X(Ya,"Initializing OfflineComponentProvider");let r=n.configuration;yield e.initialize(r);let t=r.initialUser;n.setCredentialChangeListener(i=>I(null,null,function*(){t.isEqual(i)||(yield BW(e.localStore,i),t=i)})),e.persistence.setDatabaseDeletedListener(()=>{ws("Terminating Firestore due to IndexedDb database deletion"),n.terminate().then(()=>{X("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{ws("Terminating Firestore due to IndexedDb database deletion failed",i)})}),n._offlineComponents=e})}function fH(n,e){return I(this,null,function*(){n.asyncQueue.verifyOperationInProgress();let r=yield qoe(n);X(Ya,"Initializing OnlineComponentProvider"),yield e.initialize(r,n.configuration),n.setCredentialChangeListener(t=>cH(e.remoteStore,t)),n.setAppCheckTokenChangeListener((t,i)=>cH(e.remoteStore,i)),n._onlineComponents=e})}function qoe(n){return I(this,null,function*(){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){X(Ya,"Using user provided OfflineComponentProvider");try{yield Gw(n,n._uninitializedComponentsProvider._offline)}catch(e){let r=e;if(!(function(i){return i.name==="FirebaseError"?i.code===j.FAILED_PRECONDITION||i.code===j.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(r))throw r;ws("Error using user provided cache. Falling back to memory cache: "+r),yield Gw(n,new RM)}}else X(Ya,"Using default OfflineComponentProvider"),yield Gw(n,new NL(void 0));return n._offlineComponents})}function NM(n){return I(this,null,function*(){return n._onlineComponents||(n._uninitializedComponentsProvider?(X(Ya,"Using user provided OnlineComponentProvider"),yield fH(n,n._uninitializedComponentsProvider._online)):(X(Ya,"Using default OnlineComponentProvider"),yield fH(n,new CM))),n._onlineComponents})}function Koe(n){return NM(n).then(e=>e.syncEngine)}function iz(n){return NM(n).then(e=>e.datastore)}function yy(n){return I(this,null,function*(){let e=yield NM(n),r=e.eventManager;return r.onListen=Ooe.bind(null,e.syncEngine),r.onUnlisten=boe.bind(null,e.syncEngine),r.onFirstRemoteStoreListen=woe.bind(null,e.syncEngine),r.onLastRemoteStoreUnlisten=Loe.bind(null,e.syncEngine),r})}function Yoe(n,e,r={}){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new fp({next:f=>{u.Ou(),s.enqueueAndForget(()=>TM(o,d));let g=f.docs.has(a);!g&&f.fromCache?l.reject(new Q(j.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&f.fromCache&&c&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new hp(vp(a.path),u,{includeMetadataChanges:!0,ka:!0});return _M(o,d)})(yield yy(n),n.asyncQueue,e,r,t)})),t.promise}function Qoe(n,e,r={}){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new fp({next:f=>{u.Ou(),s.enqueueAndForget(()=>TM(o,d)),f.fromCache&&c.source==="server"?l.reject(new Q(j.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):l.resolve(f)},error:f=>l.reject(f)}),d=new hp(a,u,{includeMetadataChanges:!0,ka:!0});return _M(o,d)})(yield yy(n),n.asyncQueue,e,r,t)})),t.promise}function Xoe(n,e,r){let t=new Or;return n.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){try{let i=yield iz(n);t.resolve((function(s,a,c){return I(this,null,function*(){var l;let u=de(s),{request:d,ft:f,parent:g}=toe(u.serializer,Pie(a),c);u.connection.Qo||delete d.parent;let p=(yield u.Jo("RunAggregationQuery",u.serializer.databaseId,g,d,1)).filter(T=>!!T.result);he(p.length===1,64727);let _=(l=p[0].result)===null||l===void 0?void 0:l.aggregateFields;return Object.keys(_).reduce((T,D)=>(T[f[D]]=_[D],T),{})})})(i,e,r))}catch(i){t.reject(i)}})),t.promise}function oz(n){let e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}var gH=new Map;var sz="firestore.googleapis.com",mH=!0,Sy=class{constructor(e){var r,t;if(e.host===void 0){if(e.ssl!==void 0)throw new Q(j.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=sz,this.ssl=mH}else this.host=e.host,this.ssl=(r=e.ssl)!==null&&r!==void 0?r:mH;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=bW;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<xW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}tie("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=oz((t=e.experimentalLongPollingOptions)!==null&&t!==void 0?t:{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new Q(j.INVALID_ARGUMENT,`invalid long polling timeout: ${o.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(t,i){return t.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},Zl=class{constructor(e,r,t,i){this._authCredentials=e,this._appCheckCredentials=r,this._databaseId=t,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Sy({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Q(j.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 Q(j.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 Sy(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(t){if(!t)return new $w;switch(t.type){case"firstParty":return new zw(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Q(j.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}_restart(){return I(this,null,function*(){this._terminateTask==="notTerminated"?yield this._terminate():this._terminateTask="notTerminated"})}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(r){let t=gH.get(r);t&&(X("ComponentProvider","Removing Datastore"),gH.delete(r),t.terminate())})(this),Promise.resolve()}};function az(n,e,r,t={}){var i;n=wr(n,Zl);let o=Hr(e),s=n._getSettings(),a=Object.assign(Object.assign({},s),{emulatorOptions:n._getEmulatorOptions()}),c=`${e}:${r}`;o&&(ha(`https://${c}`),sl("Firestore",!0)),s.host!==sz&&s.host!==c&&ws("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let l=Object.assign(Object.assign({},s),{host:c,ssl:o,emulatorOptions:t});if(!Vi(l,a)&&(n._setSettings(l),t.mockUserToken)){let u,d;if(typeof t.mockUserToken=="string")u=t.mockUserToken,d=cn.MOCK_USER;else{u=KT(t.mockUserToken,(i=n._app)===null||i===void 0?void 0:i.options.projectId);let f=t.mockUserToken.sub||t.mockUserToken.user_id;if(!f)throw new Q(j.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new cn(f)}n._authCredentials=new jw(new Mv(u,d))}}var Qi=class n{constructor(e,r,t){this.converter=r,this._query=t,this.type="query",this.firestore=e}withConverter(e){return new n(this.firestore,e,this._query)}},vn=class n{constructor(e,r,t){this.converter=r,this._key=t,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 Ua(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new n(this.firestore,e,this._key)}toJSON(){return{type:n._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,r,t){if(Ep(r,n._jsonSchema))return new n(e,t||null,new ie(We.fromString(r.referencePath)))}};vn._jsonSchemaVersion="firestore/documentReference/1.0",vn._jsonSchema={type:ln("string",vn._jsonSchemaVersion),referencePath:ln("string")};var Ua=class n extends Qi{constructor(e,r,t){super(e,r,vp(t)),this._path=t,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 vn(this.firestore,null,new ie(e))}withConverter(e){return new n(this.firestore,e,this._path)}};function cz(n,e,...r){if(n=Ge(n),XL("collection","path",e),n instanceof Zl){let t=We.fromString(e,...r);return uj(t),new Ua(n,null,t)}{if(!(n instanceof vn||n instanceof Ua))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return uj(t),new Ua(n.firestore,null,t)}}function lz(n,e){if(n=wr(n,Zl),XL("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new Q(j.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Qi(n,null,(function(t){return new Wo(We.emptyPath(),t)})(e))}function uz(n,e,...r){if(n=Ge(n),arguments.length===1&&(e=jm.newId()),XL("doc","path",e),n instanceof Zl){let t=We.fromString(e,...r);return lj(t),new vn(n,null,new ie(t))}{if(!(n instanceof vn||n instanceof Ua))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=n._path.child(We.fromString(e,...r));return lj(t),new vn(n.firestore,n instanceof Ua?n.converter:null,new ie(t))}}var pH="AsyncQueue",Ay=class{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new dp(this,"async_queue_retry"),this.oc=()=>{let t=Lv();t&&X(pH,"Visibility state changed to "+t.visibilityState),this.F_.y_()},this._c=e;let r=Lv();r&&typeof r.addEventListener=="function"&&r.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;let r=Lv();r&&typeof r.removeEventListener=="function"&&r.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let r=new Or;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(r.resolve,r.reject),r.promise)).then(()=>r.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}cc(){return I(this,null,function*(){if(this.Zu.length!==0){try{yield this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!Xa(e))throw e;X(pH,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(e){let r=this._c.then(()=>(this.nc=!0,e().catch(t=>{throw this.tc=t,this.nc=!1,Xt("INTERNAL UNHANDLED ERROR: ",EH(t)),t}).then(t=>(this.nc=!1,t))));return this._c=r,r}enqueueAfterDelay(e,r,t){this.ac(),this.sc.indexOf(e)>-1&&(r=0);let i=TL.createAndSchedule(this,e,r,t,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&ae(47125,{hc:EH(this.tc)})}verifyOperationInProgress(){}Pc(){return I(this,null,function*(){let e;do e=this._c,yield e;while(e!==this._c)})}Tc(e){for(let r of this.ec)if(r.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((r,t)=>r.targetTimeMs-t.targetTimeMs);for(let r of this.ec)if(r.skipDelay(),e!=="all"&&r.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let r=this.ec.indexOf(e);this.ec.splice(r,1)}};function EH(n){let e=n.message||"";return n.stack&&(e=n.stack.includes(n.message)?n.stack:n.message+`
|
|
167
|
+
`+n.stack),e}function _H(n){return(function(r,t){if(typeof r!="object"||r===null)return!1;let i=r;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(n,["next","error","complete"])}var Xi=class extends Zl{constructor(e,r,t,i){super(e,r,t,i),this.type="firestore",this._queue=new Ay,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Ay(e),this._firestoreClient=void 0,yield e}})}};function Gy(n,e,r){r||(r=Xm);let t=Po(n,"firestore");if(t.isInitialized(r)){let i=t.getImmediate({identifier:r}),o=t.getOptions(r);if(Vi(o,e))return i;throw new Q(j.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new Q(j.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<xW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&Hr(e.host)&&ha(e.host),t.initialize({options:e,instanceIdentifier:r})}function $h(n,e){let r=typeof n=="object"?n:Sr(),t=typeof n=="string"?n:e||Xm,i=Po(r,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=Nd("firestore");o&&az(i,...o)}return i}function jh(n){if(n._terminated)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Joe(n),n._firestoreClient}function Joe(n){var e,r,t;let i=n._freezeSettings(),o=(function(a,c,l,u){return new rb(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,oz(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,i);n._componentsProvider||!((r=i.localCache)===null||r===void 0)&&r._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(n._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),n._firestoreClient=new LL(n._authCredentials,n._appCheckCredentials,n._queue,o,n._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(n._componentsProvider))}var ML=class{constructor(e="count",r){this._internalFieldPath=r,this.type="AggregateField",this.aggregateType=e}},PL=class{constructor(e,r,t){this._userDataWriter=r,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Os=class n{constructor(e){this._byteString=e}static fromBase64String(e){try{return new n(un.fromBase64String(e))}catch(r){throw new Q(j.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+r)}}static fromUint8Array(e){return new n(un.fromUint8Array(e))}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:n._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ep(e,n._jsonSchema))return n.fromBase64String(e.bytes)}};Os._jsonSchemaVersion="firestore/bytes/1.0",Os._jsonSchema={type:ln("string",Os._jsonSchemaVersion),bytes:ln("string")};var xh=class{constructor(...e){for(let r=0;r<e.length;++r)if(e[r].length===0)throw new Q(j.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Tn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var gp=class{constructor(e){this._methodName=e}};var Va=class n{constructor(e,r){if(!isFinite(e)||e<-90||e>90)throw new Q(j.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(r)||r<-180||r>180)throw new Q(j.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+r);this._lat=e,this._long=r}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Re(this._lat,e._lat)||Re(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:n._jsonSchemaVersion}}static fromJSON(e){if(Ep(e,n._jsonSchema))return new n(e.latitude,e.longitude)}};Va._jsonSchemaVersion="firestore/geoPoint/1.0",Va._jsonSchema={type:ln("string",Va._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};var Ba=class n{constructor(e){this._values=(e||[]).map(r=>r)}toArray(){return this._values.map(e=>e)}isEqual(e){return(function(t,i){if(t.length!==i.length)return!1;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!1;return!0})(this._values,e._values)}toJSON(){return{type:n._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ep(e,n._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(r=>typeof r=="number"))return new n(e.vectorValues);throw new Q(j.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};Ba._jsonSchemaVersion="firestore/vectorValue/1.0",Ba._jsonSchema={type:ln("string",Ba._jsonSchemaVersion),vectorValues:ln("object")};var Zoe=/^__.*__$/,xL=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return this.fieldMask!==null?new Yi(e,this.data,this.fieldMask,r,this.fieldTransforms):new qa(e,this.data,r,this.fieldTransforms)}},Dy=class{constructor(e,r,t){this.data=e,this.fieldMask=r,this.fieldTransforms=t}toMutation(e,r){return new Yi(e,this.data,this.fieldMask,r,this.fieldTransforms)}};function dz(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:n})}}var FL=class n{constructor(e,r,t,i,o,s){this.settings=e,this.databaseId=r,this.serializer=t,this.ignoreUndefinedProperties=i,o===void 0&&this.Ac(),this.fieldTransforms=o||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new n(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var r;let t=(r=this.path)===null||r===void 0?void 0:r.child(e),i=this.Rc({path:t,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Cy(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(r=>e.isPrefixOf(r))!==void 0||this.fieldTransforms.find(r=>e.isPrefixOf(r.field))!==void 0}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(e.length===0)throw this.wc("Document fields must not be empty");if(dz(this.Ec)&&Zoe.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},kL=class{constructor(e,r,t){this.databaseId=e,this.ignoreUndefinedProperties=r,this.serializer=t||ky(e)}Dc(e,r,t,i=!1){return new FL({Ec:e,methodName:r,bc:t,path:Tn.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function $y(n){let e=n._freezeSettings(),r=ky(n._databaseId);return new kL(n._databaseId,!!e.ignoreUndefinedProperties,r)}function hz(n,e,r,t,i,o={}){let s=n.Dc(o.merge||o.mergeFields?2:0,e,r,i);OM("Data must be an object, but it was:",s,t);let a=gz(t,s),c,l;if(o.merge)c=new Yr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=UL(e,d,r);if(!s.contains(f))throw new Q(j.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);pz(u,f)||u.push(f)}c=new Yr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new xL(new nr(a),c,l)}var Ry=class n extends gp{_toFieldTransform(e){if(e.Ec!==2)throw e.Ec===1?e.wc(`${this._methodName}() can only appear at the top level of your update data`):e.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof n}};function ese(n,e,r,t){let i=n.Dc(1,e,r);OM("Data must be an object, but it was:",i,t);let o=[],s=nr.empty();Ja(t,(c,l)=>{let u=wM(e,c,r);l=Ge(l);let d=i.gc(u);if(l instanceof Ry)o.push(u);else{let f=Ap(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new Yr(o);return new Dy(s,a,i.fieldTransforms)}function tse(n,e,r,t,i,o){let s=n.Dc(1,e,r),a=[UL(e,t,r)],c=[i];if(o.length%2!=0)throw new Q(j.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let f=0;f<o.length;f+=2)a.push(UL(e,o[f])),c.push(o[f+1]);let l=[],u=nr.empty();for(let f=a.length-1;f>=0;--f)if(!pz(l,a[f])){let g=a[f],p=c[f];p=Ge(p);let _=s.gc(g);if(p instanceof Ry)l.push(g);else{let T=Ap(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new Yr(l);return new Dy(u,d,s.fieldTransforms)}function fz(n,e,r,t=!1){return Ap(r,n.Dc(t?4:3,e))}function Ap(n,e){if(mz(n=Ge(n)))return OM("Unsupported field value:",e,n),gz(n,e);if(n instanceof gp)return(function(t,i){if(!dz(i.Ec))throw i.wc(`${t._methodName}() can only be used with update() and set()`);if(!i.path)throw i.wc(`${t._methodName}() is not currently supported inside arrays`);let o=t._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.mc&&e.Ec!==4)throw e.wc("Nested arrays are not supported");return(function(t,i){let o=[],s=0;for(let a of t){let c=Ap(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(n,e)}return(function(t,i){if((t=Ge(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return Bie(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=Pt.fromDate(t);return{timestampValue:Nh(i.serializer,o)}}if(t instanceof Pt){let o=new Pt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Nh(i.serializer,o)}}if(t instanceof Va)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Os)return{bytesValue:EW(i.serializer,t._byteString)};if(t instanceof vn){let o=i.databaseId,s=t.firestore._databaseId;if(!s.isEqual(o))throw i.wc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${o.projectId}/${o.database}`);return{referenceValue:uM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof Ba)return(function(s,a){return{mapValue:{fields:{[iM]:{stringValue:oM},[Sh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return lM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${Oy(t)}`)})(n,e)}function gz(n,e){let r={};return BH(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ja(n,(t,i)=>{let o=Ap(i,e.Vc(t));o!=null&&(r[t]=o)}),{mapValue:{fields:r}}}function mz(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof Pt||n instanceof Va||n instanceof Os||n instanceof vn||n instanceof gp||n instanceof Ba)}function OM(n,e,r){if(!mz(r)||!AH(r)){let t=Oy(r);throw t==="an object"?e.wc(n+" a custom object"):e.wc(n+" "+t)}}function UL(n,e,r){if((e=Ge(e))instanceof xh)return e._internalPath;if(typeof e=="string")return wM(n,e);throw Cy("Field path arguments must be of type string or ",n,!1,void 0,r)}var nse=new RegExp("[~\\*/\\[\\]]");function wM(n,e,r){if(e.search(nse)>=0)throw Cy(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,r);try{return new xh(...e.split("."))._internalPath}catch{throw Cy(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,r)}}function Cy(n,e,r,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;r&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(o||s)&&(c+=" (found",o&&(c+=` in field ${t}`),s&&(c+=` in document ${i}`),c+=")"),new Q(j.INVALID_ARGUMENT,a+n+c)}function pz(n,e){return n.some(r=>r.isEqual(e))}var eu=class{constructor(e,r,t,i,o){this._firestore=e,this._userDataWriter=r,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new vn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new VL(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let r=this._document.data.field(jy("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r)}}},VL=class extends eu{data(){return super.data()}};function jy(n,e){return typeof e=="string"?wM(n,e):e instanceof xh?e._internalPath:e._delegate._internalPath}function Ez(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new Q(j.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var mp=class{},Fh=class extends mp{};function _z(n,e,...r){let t=[];e instanceof mp&&t.push(e),t=t.concat(r),(function(o){let s=o.filter(c=>c instanceof kh).length,a=o.filter(c=>c instanceof pp).length;if(s>1||s>0&&a>0)throw new Q(j.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(t);for(let i of t)n=i._apply(n);return n}var pp=class n extends Fh{constructor(e,r,t){super(),this._field=e,this._op=r,this._value=t,this.type="where"}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=this._parse(e);return Dz(e._query,r),new Qi(e.firestore,e.converter,pb(e._query,r))}_parse(e){let r=$y(e.firestore);return(function(o,s,a,c,l,u,d){let f;if(l.isKeyField()){if(u==="array-contains"||u==="array-contains-any")throw new Q(j.INVALID_ARGUMENT,`Invalid Query. You can't perform '${u}' queries on documentId().`);if(u==="in"||u==="not-in"){IH(d,u);let p=[];for(let _ of d)p.push(TH(c,o,_));f={arrayValue:{values:p}}}else f=TH(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||IH(d,u),f=fz(a,s,d,u==="in"||u==="not-in");return $e.create(l,u,f)})(e._query,"where",r,e.firestore._databaseId,this._field,this._op,this._value)}};function Tz(n,e,r){let t=e,i=jy("where",n);return pp._create(i,t,r)}var kh=class n extends mp{constructor(e,r){super(),this.type=e,this._queryConstraints=r}static _create(e,r){return new n(e,r)}_parse(e){let r=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return r.length===1?r[0]:nt.create(r,this._getOperator())}_apply(e){let r=this._parse(e);return r.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)Dz(s,c),s=pb(s,c)})(e._query,r),new Qi(e.firestore,e.converter,pb(e._query,r)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function Iz(...n){return n.forEach(e=>Rz("or",e)),kh._create("or",n)}function vz(...n){return n.forEach(e=>Rz("and",e)),kh._create("and",n)}var BL=class n extends Fh{constructor(e,r){super(),this._field=e,this._direction=r,this.type="orderBy"}static _create(e,r){return new n(e,r)}_apply(e){let r=(function(i,o,s){if(i.startAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new Q(j.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Wl(o,s)})(e._query,this._field,this._direction);return new Qi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new Wo(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,r))}};function yz(n,e="asc"){let r=e,t=jy("orderBy",n);return BL._create(t,r)}var GL=class n extends Fh{constructor(e,r,t){super(),this.type=e,this._limit=r,this._limitType=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){return new Qi(e.firestore,e.converter,qv(e._query,this._limit,this._limitType))}};function Sz(n){return nie("limit",n),GL._create("limit",n,"F")}var $L=class n extends Fh{constructor(e,r,t){super(),this.type=e,this._docOrFields=r,this._inclusive=t}static _create(e,r,t){return new n(e,r,t)}_apply(e){let r=rse(e,this.type,this._docOrFields,this._inclusive);return new Qi(e.firestore,e.converter,(function(i,o){return new Wo(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,r))}};function Az(...n){return $L._create("startAfter",n,!1)}function rse(n,e,r,t){if(r[0]=Ge(r[0]),r[0]instanceof eu)return(function(o,s,a,c,l){if(!c)throw new Q(j.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);let u=[];for(let d of dh(o))if(d.field.isKeyField())u.push(Hl(s,c.key));else{let f=c.data.field(d.field);if(My(f))throw new Q(j.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+d.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(f===null){let g=d.field.canonicalString();throw new Q(j.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${g}' (used as the orderBy) does not exist.`)}u.push(f)}return new Ho(u,l)})(n._query,n.firestore._databaseId,e,r[0]._document,t);{let i=$y(n.firestore);return(function(s,a,c,l,u,d){let f=s.explicitOrderBy;if(u.length>f.length)throw new Q(j.INVALID_ARGUMENT,`Too many arguments provided to ${l}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);let g=[];for(let p=0;p<u.length;p++){let _=u[p];if(f[p].field.isKeyField()){if(typeof _!="string")throw new Q(j.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${l}(), but got a ${typeof _}`);if(!aM(s)&&_.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${l}() must be a plain document ID, but '${_}' contains a slash.`);let T=s.path.child(We.fromString(_));if(!ie.isDocumentKey(T))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${l}() must result in a valid document path, but '${T}' is not because it contains an odd number of segments.`);let D=new ie(T);g.push(Hl(a,D))}else{let T=fz(c,l,_);g.push(T)}}return new Ho(g,d)})(n._query,n.firestore._databaseId,i,e,r,t)}}function TH(n,e,r){if(typeof(r=Ge(r))=="string"){if(r==="")throw new Q(j.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!aM(e)&&r.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let t=e.path.child(We.fromString(r));if(!ie.isDocumentKey(t))throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${t}' is not because it has an odd number of segments (${t.length}).`);return Hl(n,new ie(t))}if(r instanceof vn)return Hl(n,r._key);throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Oy(r)}.`)}function IH(n,e){if(!Array.isArray(n)||n.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Dz(n,e){let r=(function(i,o){for(let s of i)for(let a of s.getFlattenedFilters())if(o.indexOf(a.op)>=0)return a.op;return null})(n.filters,(function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(e.op));if(r!==null)throw r===e.op?new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Q(j.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${r.toString()}' filters.`)}function Rz(n,e){if(!(e instanceof pp||e instanceof kh))throw new Q(j.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var Ny=class{convertValue(e,r="none"){switch(ja(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Mt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,r);case 5:return e.stringValue;case 6:return this.convertBytes(Ls(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,r);case 11:return this.convertObject(e.mapValue,r);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,r){return this.convertObjectMap(e.fields,r)}convertObjectMap(e,r="none"){let t={};return Ja(e,(i,o)=>{t[i]=this.convertValue(o,r)}),t}convertVectorValue(e){var r,t,i;let o=(i=(t=(r=e.fields)===null||r===void 0?void 0:r[Sh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>Mt(s.doubleValue));return new Ba(o)}convertGeoPoint(e){return new Va(Mt(e.latitude),Mt(e.longitude))}convertArray(e,r){return(e.values||[]).map(t=>this.convertValue(t,r))}convertServerTimestamp(e,r){switch(r){case"previous":let t=Py(e);return t==null?null:this.convertValue(t,r);case"estimate":return this.convertTimestamp(Qm(e));default:return null}}convertTimestamp(e){let r=bs(e);return new Pt(r.seconds,r.nanos)}convertDocumentKey(e,r){let t=We.fromString(e);he(RW(t),9688,{name:e});let i=new yh(t.get(1),t.get(3)),o=new ie(t.popFirst(5));return i.isEqual(r)||Xt(`Document ${o} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${r.projectId}/${r.database}) instead.`),o}};function Cz(n,e,r){let t;return t=n?r&&(r.merge||r.mergeFields)?n.toFirestore(e,r):n.toFirestore(e):e,t}var jL=class extends Ny{constructor(e){super(),this.firestore=e}convertBytes(e){return new Os(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function ise(){return new ML("count")}var ka=class{constructor(e,r){this.hasPendingWrites=e,this.fromCache=r}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ga=class n extends eu{constructor(e,r,t,i,o,s){super(e,r,t,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=o}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let r=new fh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(r,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,r={}){if(this._document){let t=this._document.data.field(jy("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,r.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,r={};return r.type=n._jsonSchemaVersion,r.bundle="",r.bundleSource="DocumentSnapshot",r.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?r:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),r.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),r)}};Ga._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ga._jsonSchema={type:ln("string",Ga._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};var fh=class extends Ga{data(e={}){return super.data(e)}},jl=class n{constructor(e,r,t,i){this._firestore=e,this._userDataWriter=r,this._snapshot=i,this.metadata=new ka(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(r=>e.push(r)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,r){this._snapshot.docs.forEach(t=>{e.call(r,new fh(this._firestore,this._userDataWriter,t.key,t,new ka(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let r=!!e.includeMetadataChanges;if(r&&this._snapshot.excludesMetadataChanges)throw new Q(j.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===r||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new fh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new ka(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:s++}})}{let s=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>o||a.type!==3).map(a=>{let c=new fh(i._firestore,i._userDataWriter,a.doc.key,a.doc,new ka(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter),l=-1,u=-1;return a.type!==0&&(l=s.indexOf(a.doc.key),s=s.delete(a.doc.key)),a.type!==1&&(s=s.add(a.doc),u=s.indexOf(a.doc.key)),{type:ose(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,r),this._cachedChangesIncludeMetadataChanges=r),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Q(j.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=n._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=jm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let r=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(r.push(o._document),t.push(this._userDataWriter.convertObjectMap(o._document.data.value.mapValue.fields,"previous")),i.push(o.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}};function ose(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:n})}}function Nz(n){n=wr(n,vn);let e=wr(n.firestore,Xi);return Yoe(jh(e),n._key).then(r=>Pz(e,n,r))}jl._jsonSchemaVersion="firestore/querySnapshot/1.0",jl._jsonSchema={type:ln("string",jl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};var tu=class extends Ny{constructor(e){super(),this.firestore=e}convertBytes(e){return new Os(e)}convertReference(e){let r=this.convertDocumentKey(e,this.firestore._databaseId);return new vn(this.firestore,null,r)}};function Oz(n){n=wr(n,Qi);let e=wr(n.firestore,Xi),r=jh(e),t=new tu(e);return Ez(n._query),Qoe(r,n._query).then(i=>new jl(e,t,n,i))}function wz(n,e,r){n=wr(n,vn);let t=wr(n.firestore,Xi),i=Cz(n.converter,e,r);return Mz(t,[hz($y(t),"setDoc",n._key,i,n.converter!==null,r).toMutation(n._key,Gn.none())])}function bz(n){return Mz(wr(n.firestore,Xi),[new Yl(n._key,Gn.none())])}function Lz(n,...e){var r,t,i;n=Ge(n);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||_H(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(_H(e[s])){let d=e[s];e[s]=(r=d.next)===null||r===void 0?void 0:r.bind(d),e[s+1]=(t=d.error)===null||t===void 0?void 0:t.bind(d),e[s+2]=(i=d.complete)===null||i===void 0?void 0:i.bind(d)}let c,l,u;if(n instanceof vn)l=wr(n.firestore,Xi),u=vp(n._key.path),c={next:d=>{e[s]&&e[s](Pz(l,n,d))},error:e[s+1],complete:e[s+2]};else{let d=wr(n,Qi);l=wr(d.firestore,Xi),u=d._query;let f=new tu(l);c={next:g=>{e[s]&&e[s](new jl(l,f,d,g))},error:e[s+1],complete:e[s+2]},Ez(n._query)}return(function(f,g,p,_){let T=new fp(_),D=new hp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return _M(yield yy(f),D)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return TM(yield yy(f),D)}))}})(jh(l),u,a,c)}function Mz(n,e){return(function(t,i){let o=new Or;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return Moe(yield Koe(t),i,o)})),o.promise})(jh(n),e)}function Pz(n,e,r){let t=r.docs.get(e._key),i=new tu(n);return new Ga(n,i,e._key,t,new ka(r.hasPendingWrites,r.fromCache),e.converter)}function xz(n){return Fz(n,{count:ise()})}function Fz(n,e){let r=wr(n.firestore,Xi),t=jh(r),i=Oie(e,(o,s)=>new Ib(s,o.aggregateType,o._internalFieldPath));return Xoe(t,n._query,i).then(o=>(function(a,c,l){let u=new tu(a);return new PL(c,u,l)})(r,n,o))}var HL=class{constructor(e){let r;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),r=e.tabManager):(r=sse(void 0),r._initialize(e)),this._onlineComponentProvider=r._onlineComponentProvider,this._offlineComponentProvider=r._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function bM(n){return new HL(n)}var WL=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=CM.provider,this._offlineComponentProvider={build:r=>new vy(r,e?.cacheSizeBytes,this.forceOwnership)}}},zL=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=CM.provider,this._offlineComponentProvider={build:r=>new OL(r,e?.cacheSizeBytes)}}};function sse(n){return new WL(n?.forceOwnership)}function LM(){return new zL}var ase={maxAttempts:5};function Pm(n,e){if((n=Ge(n)).firestore!==e)throw new Q(j.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}var qL=class{constructor(e,r){this._firestore=e,this._transaction=r,this._dataReader=$y(e)}get(e){let r=Pm(e,this._firestore),t=new jL(this._firestore);return this._transaction.lookup([r._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new eu(this._firestore,t,o.key,o,r.converter);if(o.isNoDocument())return new eu(this._firestore,t,r._key,null,r.converter);throw ae(18433,{doc:o})})}set(e,r,t){let i=Pm(e,this._firestore),o=Cz(i.converter,r,t),s=hz(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,r,t,...i){let o=Pm(e,this._firestore),s;return s=typeof(r=Ge(r))=="string"||r instanceof xh?tse(this._dataReader,"Transaction.update",o._key,r,t,i):ese(this._dataReader,"Transaction.update",o._key,r),this._transaction.update(o._key,s),this}delete(e){let r=Pm(e,this._firestore);return this._transaction.delete(r._key),this}};var KL=class extends qL{constructor(e,r){super(e,r),this._firestore=e}get(e){let r=Pm(e,this._firestore),t=new tu(this._firestore);return super.get(e).then(i=>new Ga(this._firestore,t,r._key,i._document,new ka(!1,!1),r.converter))}};function kz(n,e,r){n=wr(n,Xi);let t=Object.assign(Object.assign({},ase),r);return(function(o){if(o.maxAttempts<1)throw new Q(j.INVALID_ARGUMENT,"Max attempts must be at least 1")})(t),(function(o,s,a){let c=new Or;return o.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){let l=yield iz(o);new bL(o.asyncQueue,l,a,s,c).zu()})),c.promise})(jh(n),i=>e(new KL(n,i)),t)}(function(e,r=!0){(function(i){Uh=i})(pa),ur(new _n("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new Xi(new Hw(t.getProvider("auth-internal")),new qw(s,t.getProvider("app-check-internal")),(function(l,u){if(!Object.prototype.hasOwnProperty.apply(l.options,["projectId"]))throw new Q(j.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:r},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Qe(oj,sj,e),Qe(oj,sj,"esm2017")})();var MM=pe(vz,!0,2);var Dp=pe(cz,!0,2),PM=pe(lz,!0,2);var Hy=pe(bz,!0,2);var Hh=pe(uz,!0,2);var Uz=pe(xz,!0),Vz=pe(Nz,!0);var Bz=pe(Oz,!0);var Lxe=pe(Sz,!0,2);var xM=pe(Lz,!0);var Mxe=pe(Iz,!0,2),Pxe=pe(yz,!0,2),FM=pe(_z,!0,2);var kM=pe(kz,!0),UM=pe(wz,!0,2);var xxe=pe(Az,!0,2);var Ji=pe(Tz,!0,2);var Wy=(()=>{let e=class e{constructor(t,i,o){this.authService=t,this.configService=i,this.loggingService=o,this.db$=new Y(null);try{this.authService.getFirebaseConfig$().subscribe(s=>{if(s){let a=this.configService.getProxyConfig(),c=s.firebaseOptions.databaseURL;a?.v1DbHost&&c&&(c=OV(c,a.v1DbHost),a?.forceLongPolling&&hw());let l=dv(void 0,c);a?.v1DbHost&&c&&this.lockDatabaseHost(l),this.db$.next(l)}},s=>{this.loggingService.catch("Error in DatabaseService constructor: ",s)})}catch(s){this.loggingService.catch("Error in DatabaseService constructor:",s)}}getDb(){return this.db$.asObservable()}getDbValue(){return this.db$.getValue()}lockDatabaseHost(t){try{let o=t?._repo?.repoInfo_;if(o){let s=o.host;Object.defineProperty(o,"host",{get:()=>s,set:()=>{},configurable:!0}),o.internalHost=s}}catch(i){this.loggingService.catch("Error in DatabaseService lockDatabaseHost: ",i)}}};e.\u0275fac=function(i){return new(i||e)(w(Cr),w(Rr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.commentAnnotationDataProvider$=new Y(null),this.commentAnnotationById$=new Y({}),this.fieldsToRemove=[],this.additionalFields=[],this.additionalSaveEvents=[],this.getCommentAnnotationById=s=>{try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationById:",a);return}};try{this.loggingService.log("CommentAnnotationsResolverService initialized"),this.commentAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove),s.config?.additionalFields&&(this.additionalFields=s.config.additionalFields||[]),this.additionalSaveEvents=(s.config?.additionalSaveEvents||[]).map(a=>a?.event).filter(a=>!!a))})}catch(s){this.loggingService.catch("Error in CommentAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.commentAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.commentAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in CommentAnnotationsResolverService ngOnDestroy:",t)}}resolveCommentAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: resolveCommentAnnotations","color: green;"),!this.commentAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Comment annotation resolution timeout"),request:t}}),f(new Error("Comment annotation resolution timeout"))}},this.commentAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.commentAnnotationIds||[])],T=le(x({},t),{commentAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getCommentAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in CommentAnnotationsResolverService resolveCommentAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_GET,{sourceMethod:"resolveCommentAnnotations",source:"sdk",commentAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.commentAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.commentAnnotationById$.next(x(x({},this.commentAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in CommentAnnotationsResolverService resolveCommentAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveCommentAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: saveCommentAnnotation","color: green;");let o=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.commentAnnotationById$.getValue()));this.commentAnnotationById$._value=x(x({},a),t.commentAnnotation);let c=this.getTargetComment(t.commentAnnotation,t.commentId),l=yield kt(()=>{if(o?.config?.saveConfig?.url){let u={commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,u,!1,o.config.saveConfig.credentials)}return o?.save?.({commentAnnotation:t.commentAnnotation,event:t.eventType,commentId:t.commentId,targetComment:c,metadata:Object.values(t.commentAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveCommentAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in CommentAnnotationsResolverService saveCommentAnnotation:"),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_SAVE,{sourceMethod:"saveCommentAnnotation",source:"sdk",commentAnnotationIds:Object.keys(t.commentAnnotation),eventType:t.eventType,commentId:t.commentId}),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in CommentAnnotationsResolverService saveCommentAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.SAVE_COMMENT_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}getTargetComment(t,i){if(!(!i||!t))for(let o of Object.values(t)){let s=o?.comments?.[i];if(s)return s}}deleteCommentAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: deleteCommentAnnotation","color: green;");let s=this.getProvider();if(!this.commentAnnotationDataProviderAvailable())throw new Error("Comment annotation delete data provider not available");let a=this.commentAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{commentAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.commentAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({commentAnnotationId:t.toString(),metadata:u,event:Qt.COMMENT_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteCommentAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.commentAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in CommentAnnotationsResolverService deleteCommentAnnotation:"),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:g,commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.COMMENT_RESOLVER_DELETE,{sourceMethod:"deleteCommentAnnotation",source:"sdk",commentAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},commentAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in CommentAnnotationsResolverService deleteCommentAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Et.DELETE_COMMENT_ANNOTATION,source:"internal",payload:{error:s,commentAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getCommentAnnotationsById$(){try{return this.commentAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling CommentAnnotationsResolverService FUNCTION: getCommentAnnotationsById$","color: green;"),this.commentAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getCommentAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.commentAnnotationDataProviderAvailable()?this.commentAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService getAnnotationById:",i);return}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}getAdditionalSaveEvents(){try{return this.additionalSaveEvents}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService getAdditionalSaveEvents:",t),this.additionalSaveEvents}}setCommentAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting comment annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.comment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.commentAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in CommentAnnotationsResolverService setCommentAnnotationDataProvider:",i)}}commentAnnotationDataProviderAvailable(){try{return!!this.commentAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in CommentAnnotationsResolverService commentAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var qo=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.reactionAnnotationDataProvider$=new Y(null),this.reactionAnnotationById$=new Y({}),this.getReactionAnnotationById=s=>{try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationById:",a);return}};try{this.loggingService.log("ReactionAnnotationsResolverService initialized"),this.reactionAnnotationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in ReactionAnnotationsResolverService constructor:",s)}}getProvider(){try{let t=this.reactionAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.reactionAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in ReactionAnnotationsResolverService ngOnDestroy:",t)}}resolveReactionAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: resolveReactionAnnotations","color: green;"),!this.reactionAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Reaction annotation resolution timeout"),request:t}}),f(new Error("Reaction annotation resolution timeout"))}},this.reactionAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.reactionAnnotationIds||[])],T=le(x({},t),{reactionAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length||t.folderId){let b=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getReactionAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in ReactionAnnotationsResolverService resolveReactionAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_GET,{sourceMethod:"resolveReactionAnnotations",source:"sdk",reactionAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.reactionAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.reactionAnnotationById$.next(x(x({},this.reactionAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ReactionAnnotationsResolverService resolveReactionAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveReactionAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: saveReactionAnnotation","color: green;");let o=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue()));this.reactionAnnotationById$._value=x(x({},a),t);let c={reactionAnnotation:t,event:Qt.REACTION_ADD,metadata:Object.values(t??{})?.[0]?.metadata},l=yield kt(()=>o?.config?.saveConfig?.url?Ht(o.config.saveConfig.url,o.config.saveConfig.headers,c,!1,o.config.saveConfig.credentials):o?.save?.(c)||Promise.resolve(void 0),"saveReactionAnnotation",this.retrySaveConfig);return l&&l.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(l?.message??"Error in ReactionAnnotationsResolverService saveReactionAnnotation:"),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:l,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_SAVE,{sourceMethod:"saveReactionAnnotation",source:"sdk",reactionAnnotationIds:Object.keys(t),eventType:c.event}),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ReactionAnnotationsResolverService saveReactionAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.SAVE_REACTION_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteReactionAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: deleteReactionAnnotation","color: green;");let s=this.getProvider();if(!this.reactionAnnotationDataProviderAvailable())throw new Error("Reaction annotation delete data provider not available");let a=JSON.parse(JSON.stringify(this.reactionAnnotationById$.getValue())),c=i??a?.[t]?.metadata,l=c?Cn(c):void 0,u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{reactionAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.reactionAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({reactionAnnotationId:t.toString(),metadata:u,event:Qt.REACTION_DELETE})||Promise.resolve(void 0)},"deleteReactionAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.reactionAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in ReactionAnnotationsResolverService deleteReactionAnnotation:"),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:g,reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.REACTION_RESOLVER_DELETE,{sourceMethod:"deleteReactionAnnotation",source:"sdk",reactionAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},reactionAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in ReactionAnnotationsResolverService deleteReactionAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.DELETE_REACTION_ANNOTATION,source:"internal",payload:{error:s,reactionAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getReactionAnnotationsById$(){try{return this.reactionAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ReactionAnnotationsResolverService FUNCTION: getReactionAnnotationsById$","color: green;"),this.reactionAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getReactionAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.reactionAnnotationDataProviderAvailable()?this.reactionAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService getAnnotationById:",i);return}}setReactionAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting reaction annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.reaction is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.reactionAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ReactionAnnotationsResolverService setReactionAnnotationDataProvider:",i)}}reactionAnnotationDataProviderAvailable(){try{return!!this.reactionAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService reactionAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Wh=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.providers=new Map,this.retrySaveConfigs=new Map,this.retryDeleteConfigs=new Map,this.defaultRetryConfig={retryCount:0,retryDelay:0,revertOnFailure:!1};try{this.loggingService.log("AttachmentResolverService initialized")}catch(s){this.loggingService.catch("Error in AttachmentResolverService constructor:",s)}}getProvider(t){try{let i=t||"default";return this.providers.get(i)||void 0}catch(i){this.loggingService.catch("Error in AttachmentResolverService getProvider:",i);return}}getRetrySaveConfig(t){let i=t||"default";return this.retrySaveConfigs.get(i)||this.defaultRetryConfig}getRetryDeleteConfig(t){let i=t||"default";return this.retryDeleteConfigs.get(i)||this.defaultRetryConfig}makeAttachmentConfigBasedRequest(t,i,o,s,a){return I(this,null,function*(){try{let c=typeof i=="function"?yield i():i||{},l=new FormData;l.append("file",o);let u={attachment:{attachmentId:s.attachment.attachmentId,name:s.attachment.name,mimeType:s.attachment.mimeType},metadata:s.metadata,event:s.event};l.append("request",JSON.stringify(u));let d={};Object.entries(c).forEach(([p,_])=>{p.toLowerCase()!=="content-type"&&(d[p]=_)});let f=yield fetch(t,x({method:"POST",headers:d,body:l},a?{credentials:a}:{}));return f.ok?{data:(yield f.json())?.data??{},success:!0,statusCode:200}:(H.catch(`Error in makeAttachmentConfigBasedRequest: ${f.status} ${f.statusText}`),{data:{},success:!1,statusCode:f.status})}catch(c){return H.catch("Error in makeAttachmentConfigBasedRequest:",c),{data:{},success:!1,statusCode:500}}})}saveAttachment(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: saveAttachment","color: green;");let s=this.getProvider(o);if(!this.attachmentDataProviderAvailable(o))throw new Error("Attachment save data provider not available");let a=this.getRetrySaveConfig(o),c=i||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{request:t}});let l=yield kt(()=>I(this,null,function*(){if(s?.config?.saveConfig?.url){let u=t.attachment,{file:d}=u,f=dS(u,["file"]);return this.makeAttachmentConfigBasedRequest(s.config.saveConfig.url,s.config.saveConfig.headers,d,{attachment:f,event:t.eventType,metadata:t.attachment.metadata},s.config.saveConfig.credentials)}return s?.save?.({attachment:t.attachment,event:t.eventType,metadata:t.attachment.metadata})||Promise.resolve(void 0)}),"saveAttachment",a);if(l?.statusCode!==200){this.loggingService.catch(l?.message??"Error in AttachmentResolverService saveAttachment:"),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{error:l,request:t}});return}return this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_SAVE,{sourceMethod:"saveAttachment",source:"sdk",attachmentId:t.attachment.attachmentId,eventType:t.eventType}),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:c,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:No.SAVE_ATTACHMENT,source:"internal",payload:{error:s,request:t}});return}})}deleteAttachment(a,c,l){return I(this,arguments,function*({attachmentId:t,metadata:i},o,s){try{this.loggingService.log("%c[WB] Calling AttachmentResolverService FUNCTION: deleteAttachment","color: green;");let u=this.getProvider(s);if(!this.attachmentDataProviderAvailable(s))throw new Error("Attachment delete data provider not available");let d=i?x({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0,f=this.getRetryDeleteConfig(s),g=o||J();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield kt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE};return Ht(u.config.deleteConfig.url,u.config.deleteConfig.headers,_,!1,u.config.deleteConfig.credentials)}return u?.delete?.({attachmentId:t,metadata:d,event:Qt.ATTACHMENT_DELETE})||Promise.resolve(void 0)},"deleteAttachment",f);return p?.statusCode!==200?(this.loggingService.catch(p?.message??"Error in AttachmentResolverService deleteAttachment:"),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{error:p,attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ATTACHMENT_RESOLVER_DELETE,{sourceMethod:"deleteAttachment",source:"sdk",attachmentId:t}),this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:g,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{result:{revertOnFailure:f.revertOnFailure,isSuccess:!0},attachmentId:t,metadata:d}}),{revertOnFailure:f.revertOnFailure,isSuccess:!0})}catch(u){this.loggingService.warn("Error in AttachmentResolverService deleteAttachment:",u);let d=this.getRetryDeleteConfig(s),f=o||J(),g=i?x({apiKey:i.apiKey??null,documentId:i.documentId??null,organizationId:i.organizationId??null},i.folderId&&{folderId:i.folderId}):void 0;return this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:No.DELETE_ATTACHMENT,source:"internal",payload:{error:u,attachmentId:t,metadata:g}}),{revertOnFailure:d.revertOnFailure,isSuccess:!0}}})}setAttachmentDataProvider(t,i="default"){try{if(t){this.loggingService.log(`Setting attachment data provider for scope: ${i}`);let o=t.config,s=[{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],a=[];if(s.forEach(({method:c,configKey:l})=>{let u=o?.[l]?.url,d=c in t&&typeof t[c]=="function";!u&&!d&&a.push(c)}),a.length>0){let c=`DataProviders.attachment is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${a.join(", ")}.`;this.loggingService.catch(c);return}else this.providers.set(i,t),t.config?.saveRetryConfig&&this.retrySaveConfigs.set(i,t.config.saveRetryConfig),t.config?.deleteRetryConfig&&this.retryDeleteConfigs.set(i,t.config.deleteRetryConfig)}}catch(o){this.loggingService.catch("Error in AttachmentResolverService setAttachmentDataProvider:",o)}}attachmentDataProviderAvailable(t){try{let i=t||"default";return this.providers.has(i)}catch(i){return this.loggingService.catch("Error in AttachmentResolverService attachmentDataProviderAvailable:",i),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var ec=(()=>{let e=class e{constructor(t,i,o,s){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.attachmentResolverService=s,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.recorderAnnotationDataProvider$=new Y(null),this.recorderAnnotationById$=new Y({}),this.additionalFields=[],this.uploadChunks=!1,this.getRecorderAnnotationById=a=>{try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.value?.[a]:void 0}catch(c){this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationById:",c);return}};try{this.loggingService.log("RecorderAnnotationsResolverService initialized"),this.recorderAnnotationDataProvider$.subscribe(a=>{a&&(a.config?.resolveTimeout&&(this.resolveTimeout=a.config.resolveTimeout),a.config?.saveRetryConfig&&(this.retrySaveConfig=a.config.saveRetryConfig),a.config?.deleteRetryConfig&&(this.retryDeleteConfig=a.config.deleteRetryConfig),a.config?.getRetryConfig&&(this.retryGetConfig=a.config.getRetryConfig),a.config?.additionalFields&&(this.additionalFields=a.config.additionalFields||[]),this.uploadChunks=a.uploadChunks??!1)})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService constructor:",a)}}getProvider(){try{let t=this.recorderAnnotationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService getProvider:",t);return}}ngOnDestroy(){try{this.recorderAnnotationById$.next({})}catch(t){this.loggingService.catch("Error in RecorderAnnotationsResolverService ngOnDestroy:",t)}}resolveRecorderAnnotations(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: resolveRecorderAnnotations","color: green;"),!this.recorderAnnotationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:new Error("Recorder annotation resolution timeout"),request:t}}),f(new Error("Recorder annotation resolution timeout"))}},this.recorderAnnotationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.recorderAnnotationIds||[])],T=le(x({},t),{recorderAnnotationIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"getRecorderAnnotations",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_GET,{sourceMethod:"resolveRecorderAnnotations",source:"sdk",recorderAnnotationIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.recorderAnnotationById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.recorderAnnotationById$.next(x(x({},this.recorderAnnotationById$.getValue()),M)),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in RecorderAnnotationsResolverService resolveRecorderAnnotations:",a);let c=i||J();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveRecorderAnnotation(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: saveRecorderAnnotation","color: green;");let o=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.recorderAnnotationById$.getValue()));this.recorderAnnotationById$._value=x(x({},a),t.recorderAnnotation);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}return o?.save?.({recorderAnnotation:t.recorderAnnotation,event:t.eventType,metadata:Object.values(t.recorderAnnotation??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveRecorderAnnotation",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(c?.message??"Error in RecorderAnnotationsResolverService saveRecorderAnnotation:"),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_SAVE,{sourceMethod:"saveRecorderAnnotation",source:"sdk",recorderAnnotationIds:Object.keys(t.recorderAnnotation),eventType:t.eventType}),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in RecorderAnnotationsResolverService saveRecorderAnnotation:",o);let s=i||J();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.SAVE_RECORDER_ANNOTATION,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0}}})}deleteRecorderAnnotation(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: deleteRecorderAnnotation","color: green;");let s=this.getProvider();if(!this.recorderAnnotationDataProviderAvailable())throw new Error("Recorder annotation delete data provider not available");let a=this.recorderAnnotationById$.getValue(),l=a?.[t]?.metadata??(i?Cn(i):void 0),u=l?x({apiKey:l.apiKey??null,documentId:l.documentId??null,organizationId:l.organizationId??null},l.folderId&&{folderId:l.folderId}):void 0,d=o||J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{recorderAnnotationId:t.toString(),metadata:u}});let f=x({},a);delete f?.[t],this.recorderAnnotationById$._value=f;let g=yield kt(()=>{if(s?.config?.deleteConfig?.url){let p={recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE};return Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,p,!1,s.config.deleteConfig.credentials)}return s?.delete?.({recorderAnnotationId:t.toString(),metadata:u,event:Qt.RECORDER_ANNOTATION_DELETE})||Promise.resolve(void 0)},"deleteRecorderAnnotation",this.retryDeleteConfig);return g&&g.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.recorderAnnotationById$._value=a),this.loggingService.catch(g?.message??"Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:"),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:g,recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.RECORDER_RESOLVER_DELETE,{sourceMethod:"deleteRecorderAnnotation",source:"sdk",recorderAnnotationId:t.toString()}),this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},recorderAnnotationId:t.toString(),metadata:u}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in RecorderAnnotationsResolverService deleteRecorderAnnotation:",s);let a=o||J(),c=i?Cn(i):void 0;return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.DELETE_RECORDER_ANNOTATION,source:"internal",payload:{error:s,recorderAnnotationId:t.toString(),metadata:c}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getRecorderAnnotationsById$(){try{return this.recorderAnnotationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling RecorderAnnotationsResolverService FUNCTION: getRecorderAnnotationsById$","color: green;"),this.recorderAnnotationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getRecorderAnnotationsById$:",t),ue(void 0)}}getAnnotationById(t){try{return this.recorderAnnotationDataProviderAvailable()?this.recorderAnnotationById$.getValue()?.[t]:void 0}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService getAnnotationById:",i);return}}getAdditionalFields(){try{return this.additionalFields}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getAdditionalFields:",t),this.additionalFields}}shouldUploadChunks(){return this.uploadChunks}shouldUploadFullRecording(){return this.recorderAnnotationDataProviderAvailable()&&!this.uploadChunks}setRecorderAnnotationDataProvider(t){try{if(t){this.loggingService.log("Setting recorder annotation data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.recorder is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else t.storage&&this.attachmentResolverService.setAttachmentDataProvider(t.storage,"recorder"),this.attachmentResolverService.attachmentDataProviderAvailable("recorder")||this.loggingService.catch("Recording resolver is configured without storage resolver. Recording files (chunks, thumbnails) will be stored on Velt's infrastructure. Configure storage resolver for full self-hosting.",void 0,void 0,!0),this.recorderAnnotationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in RecorderAnnotationsResolverService setRecorderAnnotationDataProvider:",i)}}recorderAnnotationDataProviderAvailable(){try{return!!this.recorderAnnotationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService recorderAnnotationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt),w(Wh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var qy=class{};var zh=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p){this.analyticsService=t,this.authService=i,this.databaseService=o,this.domService=s,this.configService=a,this.loggingService=c,this.commentResolverService=l,this.reactionResolverService=u,this.recorderResolverService=d,this.coreActionsService=f,this.functions=g,this.serviceBook=p,this.documentPaths$=new Y(null),this.docContext$=new Y(null),this.documentIds$=new Y([]),this.organizationConfig$=new Y(null),this.firestorePaths$=new Y(null),this.location$=new Y(null),this.excludedLocationIds$=new Y([]),this.organizationMetadata$=new Y(null),this.documentMetadata$=new Y(null),this.locationMetadata$=new Y(null),this.customerMetadata$=new Y(null),this.currentDocumentId=null,this.isCustomDocId=!1,this.locations$=new Y({}),this.preDocumentIdChangeFunctions=new Map,this.draftDocuments=[],this.clientDocumentMetadataMap={},this.uiState=new Y({}),this.lastSetDocumentIdExecutionTime=0,this.lastSetDocumentIdCallTime=0,this.setDocumentIdSubject=new Ot,this.DEBOUNCE_TIME=5e3,this.currentDebounceTime=this.DEBOUNCE_TIME,this.MAX_QUEUE_SIZE=100,this.queueSize=0,this.isDocumentIdInDebounceQueue=!1,this.currentValidationToken=null,this.pendingDocumentIds=[],this.pendingOptions={},this.draftLocationMap={locations:[],options:void 0};try{this.loggingService.log("%c[WB] Creating CLASS: DocService","color: blue;"),this.domService.setDocService(this),this.authService.setDocService(this),this.serviceBook.observe(pd).subscribe(_=>{this.commentService=_??void 0}),B1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(SS(()=>Ci(this.currentDebounceTime))).subscribe({next:_=>I(this,null,function*(){try{yield this.setDocumentIdImpl(_.documentId,_.clientOrganizationId,_.options),this.lastSetDocumentIdExecutionTime=Date.now(),this.isDocumentIdInDebounceQueue=!1,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"})),this.draftLocationMap={locations:[],options:void 0}}finally{this.queueSize--}}),error:_=>{this.loggingService.catch("Error in setDocumentId subscription:",_),this.queueSize--}}),this.databaseService.getDb().pipe(Ct(_=>!!_),Nt(1)).subscribe(_=>{_&&(this.db=_)}),this.configService.getApiKey$().subscribe(_=>{if(this.apiKey=_,this.apiKey){if(!this.isCustomDocId){let T=HT(window.location.href);this.currentUrl=T}this.analyticsService.updateDefaultProperties({apiKey:_})}}),this.authService.getUser$().subscribe(_=>I(this,null,function*(){if(_&&(this.analyticsService.updateDefaultProperties({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),this.draftDocuments?.length?(yield this.setDocuments({documents:this.draftDocuments,options:this.draftOptions??void 0,source:"internal"}),this.draftDocuments=[],this.draftOptions=void 0,this.draftLocationMap.locations.length&&(yield this.setLocations({locations:this.draftLocationMap.locations,options:this.draftLocationMap.options,source:"internal"}).then(()=>this.draftLocationMap={locations:[],options:void 0}))):this.documentPaths$?.value&&_?.organizationId&&this.documentPaths$.value?.organizationId!==_?.organizationId&&(yield this.setDocuments({documents:this.documentIds$.value.length?this.documentIds$.value.map(T=>({id:T.clientDocumentId})):[{id:this.documentPaths$.value?.clientDocumentId}],options:void 0,source:"internal"})),setTimeout(()=>{this.documentPaths$.value||this.loggingService.catch("Error in DocService constructor:","Please set document id to continue.")},1e4),_?.organizationId&&_?.clientOrganizationId)){let T={organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId};this.getOrganizationConfig()||this.setOrganizationConfig({organizationId:_?.organizationId,clientOrganizationId:_?.clientOrganizationId}),yield this.updateOrganizationMetadata(T)}})),this.documentPaths$.subscribe(_=>{let T={documentId:_?.documentId,clientDocumentId:_?.clientDocumentId,folderId:_?.folderId,allDocuments:_?.allDocuments,veltFolderId:_?.veltFolderId};_?.organizationId&&(T.organizationId=_.organizationId,T.clientOrganizationId=_.clientOrganizationId),this.analyticsService.updateDefaultProperties(T),this.domService.resetSelectedAnnotationsMap()}),this.location$.subscribe(_=>{this.analyticsService.updateDefaultProperties({clientLocation:_?.location,locationId:_?.locationId})}),this.organizationMetadata$.subscribe(_=>{this.authService.setUserOrganization(_?.[this.documentPaths$.value?.organizationId])}),this.documentPaths$.pipe(Ct(_=>!!_),Nt(1)).subscribe(()=>{try{this.subscribeToCustomerMetadata()}catch(_){this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}},_=>{this.loggingService.catch("Error in DocService subscribeToCustomerMetadata:",_)}),this.loggingService.log("%c[WB] Creating CLASS: DocService 2","color: blue;"),this.onWindowPopstate(),this.onWindowClick()}catch(_){this.loggingService.catch("Error in DocService constructor:",_)}}getOptionsFromDocumentPaths(){try{return this.documentPaths$.value?{organizationId:this.documentPaths$.value?.clientOrganizationId,folderId:this.documentPaths$.value?.folderId,allDocuments:this.documentPaths$.value?.allDocuments,locationId:this.documentPaths$.value?.locationId,optimisticPermissions:this.documentPaths$.value?.optimisticPermissions}:null}catch(t){return this.loggingService.catch("Error in getOptionsFromDocumentPaths:",t),null}}clearCacheOnUserCascade(){this.loggingService.log("%c[WB] Calling FUNCTION: clearCacheOnUserCascade in DocService","color: green;");try{this.setOrganizationConfig(null),this.organizationMetadata$.next(null),this.customerMetadata$.next(null),this.customerMetadataSubscription?.unsubscribe(),this.documentPaths$.value&&(this.draftOptions=this.getOptionsFromDocumentPaths(),this.draftDocuments=this.documentIds$.value.map(t=>({id:t.clientDocumentId})),this.draftLocationMap={locations:[this.location$.value?.location??null,...Object.values(this.locations$.value||{}).map(t=>t.location)].filter(t=>t!==null),options:{rootLocationId:this.location$.value?.location?.id}},this.currentDocumentId=null,this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.unsetDocuments({source:"internal"})}catch(t){this.loggingService.catch("Error in DocService clearCacheOnUserCascade: ",t)}}setUsersService(t){try{this.usersService=t}catch(i){this.loggingService.catch("Error in setUsersService:",i)}}setCommonDbService(t){try{this.commonDbService=t}catch(i){this.loggingService.catch("Error in setCommonDbService:",i)}}setUserPermissionService(t){try{this.userPermissionService=t}catch(i){this.loggingService.catch("Error in setUserPermissionService:",i)}}setCommentService(t){try{this.commentService=t}catch(i){this.loggingService.catch("Error in setCommentService:",i)}}onWindowPopstate(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowPopstate","color: green;");try{this.domService.onWindowPopState$().subscribe(()=>{this.loggingService.log("location",location.href);let t=HT(location.href);this.currentUrl!==t&&(this.currentUrl=t,!this.isCustomDocId&&this.apiKey&&this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowPopstate subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowPopstate: ",t)}}onWindowClick(){this.loggingService.log("%c[WB] Calling FUNCTION: onWindowClick","color: green;");try{this.domService.onWindowClick$().subscribe(()=>{let t=HT(location.href);this.currentUrl!==t&&(this.currentUrl=t,this.isCustomDocId||this.loggingService.log("current url in doc service",this.currentUrl))},t=>{this.loggingService.catch("Error in DocService onWindowClick subscription: ",t)})}catch(t){this.loggingService.catch("Error in onWindowClick: ",t)}}setDocument(a){return I(this,arguments,function*({documentId:t,documentMetadata:i,options:o,source:s="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocument","color: green;"),s==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,documentMetadata:i,methodName:"setDocument",source:s}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:s,payload:{documentId:t,documentMetadata:i,options:o}}),yield this.setDocumentsImpl({documents:[{id:t,metadata:i}],options:x({organizationId:i?.organizationId},o??{}),source:s})}catch(c){this.loggingService.catch("Error in DocService setDocument:",c)}})}shouldSetDocumentsAgain(t,i={}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: shouldSetDocumentsAgain","color: green;"),this.pendingDocumentIds.length>0&&t.length===this.pendingDocumentIds.length&&t.every(d=>this.pendingDocumentIds.includes(d.id))&&ki(i,this.pendingOptions))return!1;let o=this.documentPaths$.value?.clientDocumentId,s=i?.rootDocumentId??t[0]?.id,a=this.documentIds$.value.map(u=>u.clientDocumentId),c=jT(this.getOptionsFromDocumentPaths()??{})??{};return!t.every(u=>a.includes(u.id))||!ki(c,i)||o!==s}catch(o){return this.loggingService.catch("Error in DocService shouldSetDocumentsAgain:",o),!0}}getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:i=!1}){try{let o=[];return t.forEach(s=>{let a=s.id,c=`${Tr(a)}`;i&&s?.metadata&&typeof s.metadata=="object"&&(this.clientDocumentMetadataMap[a]=s.metadata),o.push({documentId:c,clientDocumentId:a})}),o}catch(o){return this.loggingService.catch("Error in DocService getDocumentIdsFromDocuments:",o),[]}}setDocuments(a){return I(this,arguments,function*({documents:t,options:i,source:o="internal",skipPermissionValidation:s=!1}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocuments","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{documents:t,options:i,methodName:"setDocuments",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENTS,source:o,payload:{documents:t,options:i}}),yield this.setDocumentsImpl({documents:t,options:i??{},source:o,skipPermissionValidation:s})}catch(c){this.loggingService.catch("Error in DocService setDocuments:",c)}})}setRootDocument(o){return I(this,arguments,function*({document:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootDocument","color: green;"),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_DOCUMENT_TRIGGERED,methodName:kn.SET_ROOT_DOCUMENT,source:i,payload:{document:t}});let s=this.getOptionsFromDocumentPaths()??{},a=this.documentIds$.value.map(c=>c.clientDocumentId);if(!a.includes(t.id)){let c=[...a.map(u=>({id:u})),{id:t.id}],l=this.getDocumentIdsFromDocuments({documents:c,setClientDocumentMetadataMap:!0});this.documentIds$.next(l)}yield this.setDocumentIdImpl(t.id,this.documentPaths$.value?.clientOrganizationId,s)}catch(s){this.loggingService.catch("Error in DocService setRootDocument:",s)}})}setDocContext(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocContext","color: green;");let i=JSON.parse(JSON.stringify(t??null));this.docContext$.next(i)}catch(i){this.loggingService.catch("Error in setDocContext: ",i)}}getDocContext(){return this.docContext$.getValue()}getDocContext$(){return this.docContext$.asObservable().pipe(it(Ft))}getProcessedDocContext(){return GV(this.getDocContext())}filterRelevantDocuments(s){return I(this,arguments,function*({options:t,documentIds:i,skipPermissionValidation:o=!1}){try{let a=this.authService.getUser();return!a||!this.commonDbService?.shouldUseFirestore()||(i=yield this.fetchDocumentsFromFolder(t,i,a),yield this.handlePermissionProvider(t,i,a),i=yield this.filterDocumentsByPermissions(t,i,a,o),i=i.slice(0,50)),i}catch(a){return this.loggingService.catch("Error in DocService filterRelevantDocuments:",a),i}})}fetchDocumentsFromFolder(t,i,o){return I(this,null,function*(){if(!t?.folderId||!t?.allDocuments)return i;try{let s=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield Ad({methodName:"getDocuments",data:{type:"getDocuments",metadata:{organizationId:t?.organizationId??o?.clientOrganizationId,folderId:t?.folderId}},getSdkProxy:s,userId:o?.userId??""}))?.data?.forEach(c=>{i.find(l=>l.clientDocumentId===c.id)||i.push({documentId:da(c.id),clientDocumentId:c.id})})}catch(s){this.loggingService.warn("Error in DocService fetchDocumentsFromFolder:",s)}return i})}buildPermissionRequests(t,i,o){try{let s=[];return t.organizationId&&t.organizationId!==o.clientOrganizationId&&s.push({userId:o.userId,resource:{id:t.organizationId,type:di.ORGANIZATION,source:Un.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:di.FOLDER,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context}}),i&&i.forEach(a=>{s.push({userId:o.userId,resource:x({id:a.clientDocumentId,type:di.DOCUMENT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&$V({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:di.CONTEXT,source:Un.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:c}})}),s}catch(s){return this.loggingService.catch("Error in buildPermissionRequests:",s),[]}}processAccessibleContexts(t,i){try{if(!t?.success||!t?.data?.length||!this.userPermissionService?.getIsContextEnabled())return;let o=t.data.filter(s=>s.type===di.CONTEXT&&s.hasAccess).map(s=>s.resourceId);if(this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContextIds:",JSON.parse(JSON.stringify(o??"nil"))),o?.length){let s=i.filter(c=>o.includes(c.resource.id)).map(c=>c.resource.context).filter(c=>!!c),a=jV({input:s});this.loggingService.logContext("[CONTEXT] processAccessibleContexts called with accessibleContext:",JSON.parse(JSON.stringify(a??"nil"))),a?.access&&(this.loggingService.logContext("[CONTEXT] setting accessibleContext in docContext:",JSON.parse(JSON.stringify(a??"nil"))),this.setDocContext(a))}}catch(o){this.loggingService.catch("Error in processAccessibleContexts:",o)}}handlePermissionProvider(t,i,o){return I(this,null,function*(){if(this.userPermissionService?.isPermissionProviderAvailable())try{this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil")));let s=this.buildPermissionRequests(t,i,o),a=J();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_DOCUMENTS,uniqueId:a,timestamp:new Date().getTime(),source:"internal",payload:{requests:s}}),this.userPermissionService?.cancelPendingRevokes(s);let c=yield this.userPermissionService?.onResourceAccessRequired({requests:s,uniqueId:a,methodName:Un.SET_DOCUMENTS,fromCache:!1});this.loggingService.logContext("[CONTEXT] handlePermissionProvider called with res:",JSON.parse(JSON.stringify(c??"nil")),"requests:",JSON.parse(JSON.stringify(s??"nil"))),this.processAccessibleContexts(c,s)}catch(s){this.loggingService.catch("Error in handlePermissionProvider:",s)}})}filterDocumentsByPermissions(t,i,o,s=!1){return I(this,null,function*(){if(s)return i;if(this.loggingService.logContext("[CONTEXT] filterDocumentsByPermissions called with options:",JSON.parse(JSON.stringify(t??"nil")),"documentIds:",JSON.parse(JSON.stringify(i??"nil")),"user:",JSON.parse(JSON.stringify(o??"nil"))),!(t?.optimisticPermissions!==!1))return yield this.validateAndFilterPermissions(t,i,o);let c=this.currentValidationToken,l=[...i];return c&&this.validatePermissionsInBackground(t,i,o,c),l})}validateAndFilterPermissions(t,i,o){return I(this,null,function*(){try{let s=t?.organizationId??o?.clientOrganizationId,a=yield this.userPermissionService?.getUserPermissions({organizationId:s,documentIds:i.map(u=>u.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]});if(!a)return i;this.userPermissionService?.setCurrentUserPermissions(a),s&&a?.[o.userId]?.organization?.[s]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${s}`,void 0,void 0,!0),t?.folderId&&a?.[o.userId]?.folders?.[t?.folderId]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0);let c=new Set;Object.entries(a?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===Oo.PERMISSION_DENIED&&c.add(u)}),c.size>0&&(this.loggingService.catch(`User does not have access to documents: ${[...c].join(", ")}`,void 0,void 0,!0),this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"validateAndFilterPermissions",message:"Access denied to documents in strict validation mode",documentIds:[...c],userId:o.userId,timestamp:new Date().getTime()}));let l=i.filter(u=>!c.has(u.clientDocumentId));return l.length===0&&i.length>0&&this.loggingService.catch("Error in validateAndFilterPermissions: All documents provided are denied"),l}catch(s){return this.loggingService.catch("Error in validateAndFilterPermissions:",s),i}})}validatePermissionsInBackground(t,i,o,s){let a=t?.organizationId??o?.clientOrganizationId;this.userPermissionService?.getUserPermissions({organizationId:a,documentIds:i.map(c=>c.clientDocumentId),folderIds:t?.folderId?[t?.folderId]:[]}).then(c=>{if(this.currentValidationToken===s&&c){this.userPermissionService?.setCurrentUserPermissions(c);let l=[];Object.entries(c?.[o.userId]?.documents??{}).forEach(([u,d])=>{d?.errorCode===Oo.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to organization: ${a}`,void 0,void 0,!0),t?.folderId&&c?.[o.userId]?.folders?.[t?.folderId]?.errorCode===Oo.PERMISSION_DENIED&&this.loggingService.catch(`User does not have access to folder: ${t?.folderId}`,void 0,void 0,!0),l.length>0&&(this.loggingService.catch(`User does not have access to documents: ${l.join(", ")}`,void 0,void 0,!0),this.handleDeniedDocumentAccess(l,o,s))}}).catch(c=>{this.loggingService.catch("Error in background permission validation:",c)})}handleDeniedDocumentAccess(t,i,o){try{if(this.currentValidationToken!==o)return;let s=this.documentPaths$.value;this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"Access denied to document after optimistic load",documentIds:t,userId:i.userId,timestamp:new Date().getTime()});let a=this.documentIds$.value||[],c=a.filter(l=>!t.includes(l.clientDocumentId));c.length!==a.length&&(c.length>0?this.setDocuments({documents:c.map(l=>({id:l.clientDocumentId})),options:{organizationId:s?.clientOrganizationId},source:"internal",skipPermissionValidation:!0}):(this.loggingService.catch("Error in DocService handleDeniedDocumentAccess: Documents provided are all denied"),this.coreActionsService.triggerAction($.ERROR,{event:L.Events.Core.SDK_ERROR,sourceMethod:"handleDeniedDocumentAccess",message:"All documents provided are denied",documentIds:t,userId:i.userId,timestamp:new Date().getTime()}),this.unsetDocuments({source:"internal"})))}catch(s){this.loggingService.catch("Error in handleDeniedDocumentAccess:",s)}}addUserInfoToOrganization(a){return I(this,arguments,function*({organizationId:t,user:i,notificationsConfig:o,currentUserId:s}){try{let c=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Ad({data:x({type:"addUserInfoToOrganization",metadata:{organizationId:t},user:this.usersService?.externalUserDataProviderAvailable()?{userId:i?.userId}:i},o&&{notificationsConfig:o}),getSdkProxy:c,userId:s??i?.userId??""})}catch(c){this.loggingService.warn("Error in DocService addUserInfoToOrganization:",c)}})}setDocumentsImpl(a){return I(this,arguments,function*({documents:t,options:i,source:o,skipPermissionValidation:s=!1}){try{if(this.loggingService.logContext("[CONTEXT] setDocumentsImpl called with documents:",JSON.parse(JSON.stringify(t??"nil")),"options:",JSON.parse(JSON.stringify(i??"nil"))),!this.shouldSetDocumentsAgain(t,jT(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=J();this.currentValidationToken=c;let l=this.getDocumentIdsFromDocuments({documents:t,setClientDocumentMetadataMap:!0});if(l?.length===0){this.loggingService.warn("Minimum one document must be set in setDocuments");return}let u=this.authService.getUser();if(!u){this.draftDocuments=t,this.draftOptions=i;return}this.pendingDocumentIds=t.map(f=>f.id),this.pendingOptions=jT(i)??{},this.documentPaths$.value?.organizationId&&i?.organizationId&&this.documentPaths$.value?.clientOrganizationId!==i?.organizationId?this.authService.resetServicesCache():this.unsetDocuments({source:"internal",unsetDocumentPaths:!1});let d=i?.organizationId??u?.clientOrganizationId;if(d&&this.addUserInfoToOrganization({organizationId:d,user:u}),l=yield this.filterRelevantDocuments({options:i,documentIds:l,skipPermissionValidation:s}),this.documentIds$.next(l),l?.length){let f=l[0]?.clientDocumentId;i?.rootDocumentId&&l.find(g=>g.clientDocumentId===i?.rootDocumentId)&&(f=i?.rootDocumentId),yield this.debounceSetDocuments({documentId:f,clientOrganizationId:i?.organizationId,options:i})}this.pendingDocumentIds=[],this.pendingOptions={};return}catch(c){this.pendingDocumentIds=[],this.pendingOptions={},this.loggingService.catch("Error in DocService setDocumentsImpl:",c)}})}setDocumentId(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentId","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_DOCUMENTS_TRIGGERED,{payload:{id:t,clientOrganizationId:i,methodName:"setDocumentId",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_DOCUMENTS_TRIGGERED,methodName:kn.SET_DOCUMENT_ID,source:o,payload:{documentId:t,clientOrganizationId:i}}),yield this.setDocumentsImpl({documents:[{id:t}],options:{organizationId:i},source:o})}catch(a){this.loggingService.catch("Error in setDocumentId:",a);return}})}debounceSetDocuments(s){return I(this,arguments,function*({documentId:t,clientOrganizationId:i,options:o}){try{this.loggingService.log("%c[WB] Calling FUNCTION: debounceSetDocuments","color: green;");let a=o?.debounceTime??this.DEBOUNCE_TIME;this.currentDebounceTime=a;let c=Date.now(),l=c-this.lastSetDocumentIdCallTime,u=c-this.lastSetDocumentIdExecutionTime;if(this.lastSetDocumentIdCallTime=c,this.queueSize>=this.MAX_QUEUE_SIZE){this.loggingService.warn("SetDocumentId queue size exceeded limit");return}if(!this.documentPaths$.value&&!this.isDocumentIdInDebounceQueue||l>a&&u>a){yield this.setDocumentIdImpl(t,i,o),this.lastSetDocumentIdExecutionTime=c;return}this.documentPaths$.next(null),this.isDocumentIdInDebounceQueue=!0,this.draftLocationMap={locations:[],options:void 0},this.queueSize++,this.setDocumentIdSubject.next({documentId:t,clientOrganizationId:i,options:o??void 0});return}catch(a){this.loggingService.catch("Error in debounceSetDocuments:",a)}})}setDocumentIdImpl(t,i,o){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentIdImpl","color: green;");try{let s=this.authService.getUser();if(!s)return;this.currentDocumentId&&this.documentPaths$.value&&(yield this.callPreDocumentIdChangeFunctions(this.documentPaths$.value));let a=this.currentDocumentId;if(this.apiKey){let c=`${Tr(t)}`,l=o?.folderId,u=o?.folderId?wo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?Fi(i):s?.organizationId:void 0,_=J(),T=Td.SET_DOCUMENTS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:Et.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let D=J(),b=Id.SET_DOCUMENTS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:D,moduleName:b,methodName:_t.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let G=J(),M=vd.GET_RECORDER_ANNOTATIONS;if(this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:G,moduleName:M,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:D,moduleName:b}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(U=>U.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:G,moduleName:M})]),this.currentDocumentId!==c||this.documentPaths$.value?.organizationId!==p){this.loggingService.log("setting new docid"),this.currentDocumentId=c;let U=new xT,k=new qy;U.clientDocumentId=t,k.clientDocumentId=t,U.folderId=l,k.folderId=l,U.locationId=d,k.locationId=d,U.allDocuments=f,U.optimisticPermissions=g,k.allDocuments=f,k.optimisticPermissions=g,U.veltFolderId=u,k.veltFolderId=u,U.documentId=c,k.documentId=c,p&&(U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId,k.organizationId=p,k.clientOrganizationId=i??s?.clientOrganizationId);let S=`${this.apiKey}`,A=`apiKey/${this.apiKey}`;p&&(S=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`,A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${U.organizationId}`),k.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,k.document=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,U.presence=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,U.cursor=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,U.comment=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,k.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,U.multiThread=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,k.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,U.tag=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,U.area=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,k.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,U.arrow=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,U.selection=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,U.audioHuddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,U.huddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,U.recorder=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,k.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,U.flock=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,U.syncVideoPlayer=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,U.liveState=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,U.liveStateSingleEditorMode=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,U.reaction=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,k.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,U.crdt=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,k.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,U.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,U.views=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,k.notificationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,k.documentViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,k.locationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,U.notifications=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,U.metadata=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,U.users=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.documentIam=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.groupContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,U.globalContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,U.logins=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,U.userFeedback=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,U.userReportBugs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,U.userContactUs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(U.organizationMetadata=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,U.organizationIam=`${S}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,U.organizationGroups=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,U.organizationNotifications=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(U.organizationNotificationsWithDocumentId=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,U.heartbeatByDocument=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),U.organizationNotificationsLastNotificationTimestamp=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,U.organizationNotificationsUsers=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,U.heartbeat=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),k.organizationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,k.users=`${A}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,k.documentUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,k.notificationDocs=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,k.notificationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(U),this.firestorePaths$.next(k),U?.clientOrganizationId&&U?.organizationId&&!(U?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&U?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:U?.organizationId,clientOrganizationId:U?.clientOrganizationId}),Promise.allSettled([this.updateFolderMetadata(),this.updateDocumentMetadata(),this.fetchLocationMetadata(),this.updateOrganizationMetadata()]),a&&this.location$.value&&this.removeLocation({}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.SET_DOCUMENTS_SUCCESS,payload:{documentId:c,clientDocumentId:t}}),this.analyticsService.trackEvent(L.Events.Doc.SET_DOCUMENTS_SUCCESS,{documentId:c,clientDocumentId:t},!0,this.getUserIdForAnalytics())}}else this.loggingService.catch("Error in setDocumentIdImpl: API key is not provided.")}catch(s){this.loggingService.catch("Error in setDocumentIdImpl: ",s)}})}unsetDocumentId({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentId","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocumentId",source:t}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,methodName:kn.UNSET_DOCUMENT_ID,source:t}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocumentId: ",o)}}unsetDocumentImpl({source:t,unsetDocumentPaths:i}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocumentImpl","color: green;");try{let o=JSON.parse(JSON.stringify(this.documentIds$.value??[])),s=JSON.parse(JSON.stringify(this.documentPaths$.value?.folderId??"")),a=this.getDocContext();this.currentDocumentId&&this.documentPaths$.value&&this.callPreDocumentIdChangeFunctions(this.documentPaths$.value),i&&(this.documentPaths$.next(null),this.firestorePaths$.next(null)),this.currentDocumentId=null,this.location$.next(null),this.excludedLocationIds$.next([]),this.documentMetadata$.next(null),this.locationMetadata$.next(null),this.locations$.next({}),this.documentIds$.next([]),this.setDocContext(null),this.userPermissionService?.revokeAccessOnDocumentUnset({documentIds:o,folderId:s,context:a}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,source:t}),this.analyticsService.trackEvent(L.Events.Doc.UNSET_DOCUMENTS_SUCCESS,{documentId:this.currentDocumentId,documentMetadata:this.documentMetadata$.value?.[this.currentDocumentId??""],message:t==="external"?"User unset document id":"System unset document id",source:t},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetDocumentImpl: ",o)}}unsetDocuments({source:t,unsetDocumentPaths:i=!0}){this.loggingService.log("%c[WB] Calling FUNCTION: unsetDocuments","color: green;");try{t==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_DOCUMENTS_TRIGGERED,{payload:{methodName:"unsetDocuments",source:t}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.UNSET_DOCUMENTS_TRIGGERED,source:t,methodName:kn.UNSET_DOCUMENTS}),this.unsetDocumentImpl({source:t,unsetDocumentPaths:i})}catch(o){this.loggingService.catch("Error in unsetDocuments: ",o)}}addPreDocumentIdChangeFunction(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: addPreDocumentIdChangeFunction","color: green;"),this.preDocumentIdChangeFunctions.set(t,i)}catch(o){this.loggingService.catch("Error in addPreDocumentIdChangeFunction: ",o)}}callPreDocumentIdChangeFunctions(t){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling FUNCTION: callPreDocumentIdChangeFunctions","color: green;");for(let[i,o]of this.preDocumentIdChangeFunctions)try{yield o(t)}catch(s){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",s)}}catch(i){this.loggingService.catch("Error in callPreDocumentIdChangeFunctions: ",i)}})}fetchOrganizationMetadata(t){return I(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: fetchOrganizationMetadata","color: green;");try{if(!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig()),this.db&&t?.organizationId){let i=t?.organizationId,o=t?.clientOrganizationId,s=this.authService.getUser()?.userId??"",a=yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o});if(s&&a?.[s]?.organization?.[o]?.errorCode===Oo.PERMISSION_DENIED)return;yield this.commonDbService?.getData({feature:"organizationMetadata",properties:{apiKey:this.apiKey??"",organizationId:i,field:"metadata"}}).then(c=>{c&&!c?.errorCode&&this.organizationMetadata$.next(le(x({},this.organizationMetadata$.value),{[i]:c}))}).catch(c=>{this.loggingService.catch("Error in fetchOrganizationMetadata: ",c)})}}catch(i){this.loggingService.catch("Error in fetchOrganizationMetadata: ",i)}})}fetchDocumentMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value,o=this.documentMetadata$.value;if(t=t.filter(s=>!o?.[s.documentId]),t?.some(s=>!s?.documentId||!s?.clientDocumentId)||!i)return;if(this.commonDbService?.shouldUseFirestore()){let s=i?.folderId,a=[],c={organizationId:i?.clientOrganizationId,folderId:s},l=[],u=20;for(let f=0;f<t.length;f+=u)l.push(t.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchDocuments(g))});let d={};a.length>0&&(yield Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=p.metadata)})}),this.setAllDocumentMetadata(x(x({},this.documentMetadata$.value),d))}).catch(f=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",f)}))}else o?.[i?.documentId??t?.[0]?.documentId]||this.commonDbService?.queryData({feature:"allDocuments",properties:{apiKey:this.apiKey??"",organizationId:i?.organizationId,documentId:i?.documentId??t?.[0]?.documentId,skipObjectValues:!0}}).then(s=>{s?.documentId&&this.setDocumentMetadata(s.documentId,s)}).catch(s=>{this.loggingService.catch("Error in fetchDocumentMetadata: ",s)})}}catch(i){this.loggingService.catch("Error in fetchDocumentMetadata: ",i)}})}fetchLocationMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value,i=this.documentIds$.value,o=t?.folderId,s=t?.allDocuments,a=[],c={organizationId:t?.clientOrganizationId,folderId:o,allDocuments:s},l=[],u=20;for(let f=0;f<i.length;f+=u)l.push(i.slice(f,f+u));l.forEach(f=>{let g=JSON.parse(JSON.stringify(c));g.documentIds=f.map(p=>p.clientDocumentId),a.push(this.fetchLocations(g))});let d=this.locationMetadata$.value??{};a.length>0&&Promise.all(a).then(f=>{f?.forEach(g=>{g?.forEach(p=>{p?.metadata?.documentId&&(d[p.metadata.documentId]=le(x({},d?.[p.metadata.documentId]??{}),{[p.location.id]:p}))})}),Object.keys(d||{}).length>0&&this.locationMetadata$.next(d)}).catch(f=>{this.loggingService.catch("Error in fetchLocationMetadata: ",f)})}}catch(t){this.loggingService.catch("Error in fetchLocationMetadata: ",t)}})}getLocationMetadatas(){return this.locationMetadata$.value}subscribeToCustomerMetadata(){this.loggingService.log("%c[WB] Calling FUNCTION: subscribeToCustomerMetadata","color: green;");try{if(this.customerMetadataSubscription)return;this.db&&this.authService.getUser()&&this.documentPaths$.value&&(this.customerMetadataSubscription=this.commonDbService?.dbListener({feature:"customerMetadata",properties:{skipFirestore:!0}}).pipe(ts(i=>ue(null))).subscribe(i=>{this.customerMetadata$.next(i?.data)}))}catch(t){this.loggingService.catch("Error in subscribeToCustomerMetadata: ",t)}}getDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentId","color: green;"),this.documentPaths$.value?.documentId}getClientDocumentId(){return this.loggingService.log("%c[WB] Calling FUNCTION: getClientDocumentId","color: green;"),this.documentPaths$.value?.clientDocumentId}getDocumentIds$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds$","color: green;"),this.documentIds$.asObservable().pipe(fe(t=>t?.slice()))}getDocumentIds(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentIds","color: green;"),this.documentIds$.value?.slice()}getLocationMetadata$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocationMetadata$","color: green;"),this.locationMetadata$.asObservable().pipe()}getDocumentPaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths$","color: green;"),this.documentPaths$.asObservable()}getFirestorePaths$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths$","color: green;"),this.firestorePaths$.asObservable()}getDocumentPaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.documentPaths$.value}generateDocumentId(t){try{return`${Tr(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${Fi(t)}`}catch(i){return this.loggingService.catch("Error in generateOrganizationId: ",i),""}}getFirestorePaths(){return this.loggingService.log("%c[WB] Calling FUNCTION: getFirestorePaths","color: green;"),this.firestorePaths$.value}setLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:void 0,methodName:"setLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,source:i,methodName:kn.SET_LOCATION,payload:{locations:[t],options:void 0}}),this.setLocationsImpl({locations:[t]})}catch(s){this.loggingService.catch("Error in setLocation: ",s)}})}setLocations(s){return I(this,arguments,function*({locations:t,options:i,source:o="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setLocations","color: green;"),o==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:t,options:i,methodName:"setLocations",source:o}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.SET_LOCATIONS,source:o,payload:{locations:t,options:i}}),this.setLocationsImpl({locations:t,options:i})}catch(a){this.loggingService.catch("Error in setLocations: ",a)}})}getValidLocations(t){try{let i=[];return t&&Array.isArray(t)&&t.forEach(o=>{if(o&&typeof o=="object"){let s=!0;o?.version&&(!o?.version?.id||!o?.version?.name)&&(this.loggingService.catch(`Error in setting location for locationId: ${o?.id}, If you're setting version then add id and name fields to version object.`),s=!1),s&&i.push(o)}}),i}catch(i){this.loggingService.catch("Error in getValidLocations: ",i)}return t}setRootLocation(o){return I(this,arguments,function*({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: setRootLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,{payload:{location:t,methodName:"setRootLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_ROOT_LOCATION_TRIGGERED,methodName:kn.SET_ROOT_LOCATION,source:i,payload:{location:t}});let s=Object.values(this.locations$.value).map(a=>a.location).filter(a=>String(a.id)!==String(t.id));this.setLocationsImpl({locations:[t,...s],options:{rootLocationId:t.id}})}catch(s){this.loggingService.catch("Error in DocService setRootLocation:",s)}})}setLocationsImpl({locations:t,options:i}){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: setLocationsImpl","color: green;"),t.length===0)return;if(!this.authService.getUser()){!i?.appendLocation&&t.length>0&&(this.draftLocationMap.options=le(x(x({},this.draftLocationMap.options??{}),i??{}),{rootLocationId:t[0].id})),this.draftLocationMap.locations=[...this.draftLocationMap.locations,...t],this.draftLocationMap.options=x(x({},this.draftLocationMap.options),i);return}let s=this.getValidLocations(t),a=[],c=[];this.location$.value?.location.id&&c.push(this.location$.value?.location.id),c=[...c,...Object.values(this.locations$.value).map(d=>d.location.id)].filter(d=>d!==void 0);let l;if(i?.rootLocationId&&i?.rootLocationId!==this.location$.value?.location.id&&(l=s.find(d=>d.id===i?.rootLocationId),!l)){this.loggingService.catch(`Error in setting locations, rootLocationId: ${i?.rootLocationId} not found in locations.`);return}if(i?.appendLocation){if(l){let d=Sd(l),f=Tr(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}}else{l||(l=s[0]);let d=Sd(l),f=Tr(JSON.stringify(d));d.id&&a.push({locationId:f,location:d}),this.location$.next({locationId:f,location:d})}let u=[];return s.slice(i?.appendLocation?0:1).forEach(d=>{if(d.id!==this.location$.value?.location.id){let f=x({},d),g=this.locations$.value;d?.id&&Object.keys(g).forEach(D=>{let b=g[D];b.location?.id===d.id&&(f=x(x({},b.location),d),delete g?.[D])});let p=this.genarateLocationId(f),_={locationId:p,location:f};f.id&&a.push({locationId:p,location:f}),u.push(_);let T=le(x({},g),{[p]:_});this.locations$.next(T)}}),this.updateDocumentLocationMetadata(a),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.SET_LOCATIONS_SUCCESS,methodName:kn.SET_LOCATIONS,payload:{locations:s,options:i}}),this.analyticsService.trackEvent(L.Events.Doc.SET_LOCATIONS_SUCCESS,{locations:s,options:i},!0,this.getUserIdForAnalytics()),u}catch(o){this.loggingService.catch("Error in setLocationImpl: ",o);return}}addLocation({location:t,source:i="internal"}){try{return this.loggingService.log("%c[WB] Calling FUNCTION: addLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.SET_LOCATIONS_TRIGGERED,{payload:{locations:[t],options:{appendLocation:!0},methodName:"addLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.SET_LOCATIONS_TRIGGERED,methodName:kn.ADD_LOCATION,source:i,payload:{locations:[t],options:{appendLocation:!0}}}),this.setLocationsImpl({locations:[t],options:{appendLocation:!0}})}catch(o){this.loggingService.catch("Error in DocService addLocation:",o);return}}removeLocation({location:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocation","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:[t],methodName:"removeLocation",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,source:i,methodName:kn.REMOVE_LOCATION,payload:{locations:[t]}}),t&&this.removeLocationsImpl([t],i)}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}removeLocations({locations:t,source:i="internal"}){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t,methodName:"removeLocations",source:i}}),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,methodName:kn.REMOVE_LOCATIONS,source:i,payload:{locations:t}}),this.removeLocationsImpl(t,i)}catch(o){this.loggingService.catch("Error in removeLocations: ",o)}}removeLocationsImpl(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeLocations","color: green;"),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.REMOVE_LOCATIONS_TRIGGERED,{payload:{locations:t},methodName:"removeLocations",message:"System removed locations",source:i},!0,this.getUserIdForAnalytics()),t?t.forEach(o=>{let s=this.genarateLocationId(o);this.getLocation()?.locationId===s&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==o.id))),this.removeCustomLocation(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locations:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in removeLocation: ",o)}}unsetLocationIds(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: unsetLocationIds","color: green;"),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Core.UNSET_LOCATIONS_TRIGGERED,methodName:kn.UNSET_LOCATION_IDS,source:i,payload:{locationIds:t}}),i==="internal"&&this.analyticsService.trackEvent(L.Events.Core.UNSET_LOCATIONS_TRIGGERED,{payload:{locationIds:t},methodName:"unsetLocationIds",message:"System unset location ids",source:i},!0,this.getUserIdForAnalytics()),t?.length?t.forEach(o=>{this.getLocation()?.location.id===o&&(this.location$.next(null),i!=="internal"&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(s=>s.id!==o))),this.removeCustomLocationId(o)}):(this.location$.next(null),this.locations$.next({}),i!=="internal"&&(this.draftLocationMap.options=void 0,this.draftLocationMap.locations=[])),this.coreActionsService.triggerAction($.INIT_UPDATE,{event:L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,methodName:kn.REMOVE_LOCATIONS_SUCCESS,source:i,payload:{locationIds:t}}),this.analyticsService.trackEvent(L.Events.Doc.REMOVE_LOCATIONS_SUCCESS,{payload:{locationIds:t},source:i},!0,this.getUserIdForAnalytics())}catch(o){this.loggingService.catch("Error in unsetLocationIds: ",o)}}getLocation$(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.asObservable()}getLocation(){return this.loggingService.log("%c[WB] Calling FUNCTION: getLocation$","color: green;"),this.location$.value?JSON.parse(JSON.stringify(this.location$.value)):null}excludeLocationIds(t){try{this.excludedLocationIds$.next([...t])}catch(i){this.loggingService.catch("Error in excludeLocationIds: ",i)}}getExcludedLocationIds$(){try{return this.excludedLocationIds$.asObservable()}catch(t){return this.loggingService.catch("Error in getExcludedLocationIds$: ",t),ue([])}}updateOrganizationMetadata(t){return I(this,null,function*(){try{!t&&this.getOrganizationConfig()&&(t=this.getOrganizationConfig());let i=t?.organizationId,o=t?.clientOrganizationId,s=this.documentPaths$.value;if(this.db&&i&&s?.documentId){if(this.organizationMetadata$.value?.[i])return;let c=new kT;c.apiKey=this.configService?.getApiKey()??"",c.organizationId=i,c.clientOrganizationId=o;let l=this.authService.getUser()?.userId??"",u=o?yield this.userPermissionService?.getUserPermissionsFromCacheOrFetch({organizationId:o}):null;!!(l&&o&&u?.[l]?.organization?.[o]?.errorCode===Oo.PERMISSION_DENIED)?this.loggingService.log(`%c[WB] updateOrganizationMetadata skipped \u2014 user does not have access to organization: ${o}`,"color: orange;"):this.userPermissionService?.hasEditAccess({organizationId:i})&&(yield this.commonDbService?.updateData({feature:"organizationMetadata",data:JSON.parse(JSON.stringify(c)),properties:{organizationId:i,documentId:s?.documentId??""}})),yield this.fetchOrganizationMetadata(t)}}catch(i){this.loggingService.catch("Error in updateOrganizationMetadata: ",i)}})}updateFolderMetadata(){return I(this,null,function*(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: updateFolderMetadata","color: green;"),this.db&&this.authService.getUser()&&this.documentPaths$.value?.folderId){let t=this.documentPaths$.value;if(!t?.veltFolderId||!t?.organizationId)return;if(!(yield this.commonDbService?.getData({feature:"folderMetadata",properties:{organizationId:t?.organizationId??"",folderId:t?.veltFolderId??""}}))?.metadata){let o={folderId:this.documentPaths$.value?.folderId,clientOrganizationId:t?.clientOrganizationId,parentFolderId:"root"};if(this.userPermissionService?.hasEditAccess({folderId:this.documentPaths$.value?.veltFolderId??""})){let s=Dr(this.functions,Ir({url:st?.cloudFunction?.sdkProxy,apiProxyDomain:this.configService?.getApiProxyDomain()}));yield Ad({methodName:"createFolder",data:{type:"createFolder",metadata:o},getSdkProxy:s,userId:this.authService.getUser()?.userId??""})}}}}catch(t){this.loggingService.catch("Error in updateFolderMetadata: ",t)}})}updateDocumentMetadata(){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let t=this.documentPaths$.value;if(t){let i=this.getDocumentIds();i.find(s=>s.documentId===t.documentId)||i.push({documentId:t.documentId??"",clientDocumentId:t.clientDocumentId??""});let o=i.map(s=>I(this,null,function*(){let a=new PT;this.clientDocumentMetadataMap?.[s.clientDocumentId]&&(a=x(x({},this.clientDocumentMetadataMap[s.clientDocumentId]),a)),a.apiKey=this.configService?.getApiKey()??"",a.documentId=s.documentId,a.clientDocumentId=s.clientDocumentId,a.organizationId=t.organizationId,a.clientOrganizationId=t.clientOrganizationId,a.pageInfo=Cg(s.clientDocumentId);let c=t?.folderId,l=t?.veltFolderId;a?.pageInfo?.deviceInfo&&delete a?.pageInfo?.deviceInfo;let u=!0,d=this.documentMetadata$.value?.[s.documentId];if(c&&l){let f=this.getDocumentMetadata(s?.documentId??"")??(yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:t?.organizationId??"",field:"metadata"}}));f?.clientDocumentId&&!f?.errorCode?f?.folderId&&(f?.folderId!==c||f?.veltFolderId!==l)?(this.loggingService.catch(`Folder id mismatch for document ${s?.clientDocumentId??""}`),u=!1):f?.folderId===c?(c&&(a.folderId=c),l&&(a.veltFolderId=l)):(this.loggingService.catch(`Document ${s?.clientDocumentId??""} is not in the folder ${c??""}`),u=!1):(c&&(a.folderId=c),l&&(a.veltFolderId=l))}if(d){let f={};Object.entries(a).forEach(([g,p])=>{f[g]=p}),ki(f,d)&&(u=!1)}u&&this.userPermissionService?.hasEditAccess({documentId:s?.documentId??"",folderId:t?.allDocuments&&t?.veltFolderId?t?.veltFolderId:void 0})&&(yield this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(a)),properties:{organizationId:t?.organizationId??"",documentId:s?.documentId??""}}))}));yield Promise.allSettled(o),yield this.fetchDocumentMetadata(i)}}}catch(t){this.loggingService.catch("Error in updateDocumentMetadata: ",t)}})}updateDocumentLocationMetadata(t){return I(this,null,function*(){try{if(this.db&&this.authService.getUser()){let i=this.documentPaths$.value;if(i){let o=this.getDocumentIds();o.find(s=>s.documentId===i.documentId)||o.push({documentId:i.documentId??"",clientDocumentId:i.clientDocumentId??""});for(let s of o){let a=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??"",field:"metadata"}});a?.errorCode&&(a={});let c=[];for(let l of t){let u=new FT;u.locationId=l?.locationId,u.veltLocationId=CC(l?.location?.id??""),u.location=l?.location,u.pageInfo=Cg(s?.clientDocumentId),u?.pageInfo?.deviceInfo&&delete u?.pageInfo?.deviceInfo;let d=le(x({},a),{[v.FIREBASE_PARTIAL_PATH_LOCATIONS]:le(x({},a[v.FIREBASE_PARTIAL_PATH_LOCATIONS]??{}),{[l?.locationId]:u})});this.commonDbService?.shouldUseFirestore()||c.push(this.commonDbService?.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{documentId:s?.documentId??"",organizationId:i?.organizationId??""}}));let f=this.locationMetadata$.value;if(f||(f={}),l?.location?.id){let g=f?.[s.documentId],p=g?.[l?.location?.id??""];f&&(g||(f[s.documentId]={}),p||(f[s.documentId][l?.location?.id??""]={}),f[s.documentId][l?.location?.id??""]=le(x({},p),{location:l?.location})),Object.keys(f||{}).length>0&&this.locationMetadata$.next(f)}}yield Promise.allSettled(c)}}}}catch(i){this.loggingService.catch("Error in updateDocumentLocationMetadata: ",i)}})}genarateLocationId(t){try{return t&&typeof t=="object"?Tr(JSON.stringify(Sd(t))):0}catch(i){return this.loggingService.catch("Error in genarateLocationId: ",i),0}}removeCustomLocation(t,i="internal"){try{let o=this.genarateLocationId(t),s=this.locations$.value;s[o]&&(delete s[o],this.locations$.next(x({},s)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(a=>a.id!==t.id)))}catch(o){this.loggingService.catch("Error in DocService removeLocation:",o)}}removeCustomLocationId(t,i="internal"){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomLocationId","color: green;");let o=this.locations$.value;Object.entries(o).forEach(([s,a])=>{a.location.id===t&&(delete o[s],this.locations$.next(x({},o)),i!=="internal"&&this.isDocumentIdInDebounceQueue&&(this.draftLocationMap.locations=this.draftLocationMap.locations.filter(c=>c.id!==t)))})}catch(o){this.loggingService.catch("Error in DocService removeCustomLocationId:",o)}}getLocationByClientLocationId(t){try{let i=this.getLocation()?.location;if(i?.id===t)return i;{let o=this.getLocations();Object.keys(o).forEach(s=>{let a=o[s];a.location?.id===t&&(i=a.location)})}return i}catch(i){this.loggingService.catch("Error in DocService getLocationByClientLocationId:",i);return}}removeLocationIfNotInDom(){try{let t=this.locations$.value,i=document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}]`),o=[];i.forEach(s=>{let a=s.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(a){let c=JSON.parse(a),l=this.genarateLocationId(c);o.push(l)}}),Object.keys(t).forEach(s=>{let a=t[s];o.includes(a.locationId)||delete t[s]}),this.locations$.next(x({},t))}catch(t){this.loggingService.catch("Error in DocService removeLocationIfNotInDom:",t)}}getLocations$(){try{return this.locations$.asObservable()}catch(t){return this.loggingService.catch("Error in DocService getLocations$:",t),ue({})}}getLocations(){try{return this.locations$.value}catch(t){return this.loggingService.catch("Error in DocService getLocations:",t),{}}}getLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getLocationFromElement","color: green;");let i=null;if(t?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)?i=t:i=t.closest(`[${v.ATTRIBUTES.VELT_LOCATION}]`),i){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o){let s=JSON.parse(o);return{locationId:this.genarateLocationId(s),location:s}}}return null}catch(i){return this.loggingService.catch("Error in DocService getLocationFromElement:",i),null}}getElementMapWithLocation(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getElementMapWithLocation","color: green;");let t={};return document.querySelectorAll(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`).forEach(o=>{if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let s=this.getLocationFromElement(o);s?.locationId&&(t[s.locationId]={element:o,location:s})}else if(o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let s=o.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(s){let a=this.getLocationByClientLocationId(s);a?.locationId&&(t[a.locationId]={element:o,location:a});let c={id:s},l=this.genarateLocationId(c);t[s]={element:o,location:{locationId:l,location:c}}}}}),t}catch(t){return this.loggingService.catch("Error in DocService getElementMapWithLocation:",t),{}}}getAdditionLocationFromElement(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: getAdditionLocationFromElement","color: green;");let i;if(i=t?.closest(`[${v.ATTRIBUTES.VELT_LOCATION}], [${v.ATTRIBUTES.VELT_LOCATION_ID}]`),i){if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION);if(o)return JSON.parse(o)}else if(i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID)){let o=i?.getAttribute(v.ATTRIBUTES.VELT_LOCATION_ID);if(o)return{id:o}}}return null}catch(i){return this.loggingService.catch("Error in DocService getAdditionLocationFromElement:",i),null}}getAdditionalDocumentIdFromElement(t){try{return t?.closest(`[${v.ATTRIBUTES.VELT_DOCUMENT_ID}]`)?.getAttribute(v.ATTRIBUTES.VELT_DOCUMENT_ID)||null}catch(i){return this.loggingService.catch("Error in DocService getAdditionalDocumentIdFromElement:",i),null}}getDocumentMetadata(t){try{return t?this.documentMetadata$.value?.[t]||null:this.documentMetadata$.value?.[this.documentPaths$.value?.documentId??""]||null}catch(i){return this.loggingService.catch("Error in DocService getDocumentMetadata:",i),null}}getAllDocumentMetadata$(t){return this.getAllDocumentMetadataMap$().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}getAllDocumentMetadata(){try{return Object.values(this.documentMetadata$.value||{})}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),[]}}getAllDocumentMetadataMap$(){return this.documentMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getAllDocumentMetadataMap(){try{return this.documentMetadata$.value||{}}catch(t){return this.loggingService.catch("Error in DocService getAllDocumentMetadata:",t),{}}}getDocumentMetadataOfAvailableDocuments(){try{this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentMetadataOfAvailableDocuments","color: green;");let t=this.documentMetadata$.value||{},i={},o=this.documentPaths$.value?.veltFolderId,s=this.documentPaths$.value?.allDocuments;if(o&&s)Object.values(t).forEach(a=>{a?.documentId&&a?.veltFolderId===o&&(i[a.documentId]=a)});else{let a=this.documentIds$.value;if(a?.length)a.forEach(c=>{let l=t?.[c.documentId];l&&(i[c.documentId]=l)});else if(this.documentPaths$.value?.documentId){let c=t?.[this.documentPaths$.value?.documentId];c&&(i[this.documentPaths$.value?.documentId]=c)}}return Object.values(i)}catch(t){return this.loggingService.catch("Error in DocService getDocumentMetadataOfAvailableDocuments:",t),[]}}getDocumentMetadata$(t){return this.documentMetadata$.asObservable().pipe(fe(i=>i?.[t??this.documentPaths$.value?.documentId??""]||null),it(Ft))}setDocumentMetadata(t,i){try{this.loggingService.log("%c[WB] Calling FUNCTION: setDocumentMetadata","color: green;");let o=JSON.parse(JSON.stringify(this.documentMetadata$.value??{}));o[t]=i,this.documentMetadata$.next(o)}catch(o){this.loggingService.catch("Error in DocService setDocumentMetadata:",o)}}setAllDocumentMetadata(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setAllDocumentMetadata","color: green;"),this.documentMetadata$.next(t)}catch(i){this.loggingService.catch("Error in DocService setAllDocumentMetadata:",i)}}getOrganizationMetadata(t){return this.organizationMetadata$.value?.[t]||null}getOrganizationMetadata$(t){return this.organizationMetadata$.asObservable().pipe(fe(i=>i?.[t]||null))}getOrganizationMetadataMap$(){return this.organizationMetadata$.asObservable().pipe(fe(t=>t||{}),it(Ft))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(it(Ft))}getOrganizationConfig(){return this.organizationConfig$.value}setOrganizationConfig(t){try{this.loggingService.log("%c[WB] Calling FUNCTION: setOrganizationConfig","color: green;");let i=JSON.parse(JSON.stringify(t));this.organizationConfig$.next(i)}catch(i){return this.loggingService.catch("Error in DocService setOrganizationConfig:",i),!1}return!0}getMetadataFromType(t,i){try{switch(t){case"area":return;case"comment":return i?.multiThreadAnnotationId?this.commentService?.getMultiThreadAnnotationById(i.multiThreadAnnotationId)?.metadata:void 0;case"reaction":case"recorder":return i?.commentAnnotationId?this.commentService?.getAnnotationById(i.commentAnnotationId)?.metadata:void 0;default:return}}catch(o){this.loggingService.catch("Error in DocService getMetadataFromType:",o);return}}getDefaultMetadata({clientDocumentId:t,documentId:i}){try{let o=this.documentPaths$.value;if(!o)return;let s=t||o.clientDocumentId,a=i||o.documentId,c=this.getDocumentMetadata(a);if(!c)return;let l=c?.folderId,u=c?.veltFolderId;return x(x({apiKey:this.configService.getApiKey()??void 0,clientDocumentId:s,clientOrganizationId:o.clientOrganizationId,documentId:a,organizationId:o.organizationId},l?{folderId:l}:{}),u?{veltFolderId:u}:{})}catch(o){this.loggingService.catch("Error in DocService getDefaultMetadata:",o);return}}getBaseMetadata(t,i){try{let o,s;i?.element?o=this.getAdditionalDocumentIdFromElement(i.element)||void 0:i?.clientDocumentId&&(o=i.clientDocumentId),o&&(s=this.generateDocumentId(o));let a=this.getMetadataFromType(t,i),c=this.getDefaultMetadata({clientDocumentId:o,documentId:s}),l=a||c||{};return l.sdkVersion=jr(),l}catch(o){return this.loggingService.catch("Error in DocService getBaseMetadata:",o),{}}}getServerId({documentId:t,organizationId:i}){try{return t&&(t=this.generateDocumentId(t)),i&&(i=this.generateOrganizationId(i)),{documentId:t,organizationId:i}}catch(o){return this.loggingService.catch("Error in DocService getServerId:",o),null}}fetchDocuments(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchDocuments: organizationId is required"),[];if(t?.folderId){let a=wo(t?.folderId);o.push(Ji("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ji("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allDocuments",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchDocuments:",i),[]}})}fetchLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.commonDbService?.shouldUseFirestore()&&this.loggingService.catch("Error in fetchLocations: organizationId is required"),[];if(t?.folderId){let a=wo(t?.folderId);o.push(Ji("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ji("metadata.documentId","in",t?.documentIds?.map(a=>this.generateDocumentId(a)).slice(0,30))),yield this.commonDbService?.queryData({feature:"allLocations",properties:{firestoreQuery:o,apiKey:this.apiKey??"",organizationId:this.generateOrganizationId(t?.organizationId)??this.documentPaths$.value?.organizationId,documentId:this.documentPaths$.value?.documentId}})}catch(i){return this.loggingService.catch("Error in DocService fetchLocations:",i),[]}})}updateDocuments(t){return I(this,null,function*(){try{if(typeof t=="object"&&(t=JSON.parse(JSON.stringify(t??{}))),!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,documents:s,folderId:a}=t;if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateDocuments: organizationId is required"),[];let c=Ts(o);if(!s||s.length===0)return this.loggingService.catch("Error in updateDocuments: documents is required"),[];let l=[],u=this.documentMetadata$.value??{};for(let d of s)if(d?.documentId){d.organizationId=c,d.clientOrganizationId=o,d.clientDocumentId=d.documentId;let f=da(d.documentId);d.documentId=f,d.apiKey=this.configService.getApiKey()??void 0,(a||this.documentPaths$.value?.folderId)&&(d.folderId=a||this.documentPaths$.value?.folderId,d.veltFolderId=wo(a||this.documentPaths$.value?.folderId||""));let g=()=>{if(a&&this.documentPaths$.value?.folderId&&a!==this.documentPaths$.value?.folderId)return;let _=u?.[f];_?u[f]=x(x({},_),d):u[f]=d},p=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:f,organizationId:c,field:"metadata"}});if(p?.errorCode&&(p={}),p&&p.apiKey&&p.folderId&&a&&p.folderId!=d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists with different folderId: ${p.folderId}`);continue}if(p&&p.apiKey&&!p.folderId&&d.folderId){this.loggingService.catch(`Error in updateDocuments: document ${d.clientDocumentId} already exists, move this document to folder with REST API`);continue}g(),d&&this.commonDbService&&this.userPermissionService?.hasEditAccess({documentId:d?.documentId??""})&&l.push(this.commonDbService.updateData({feature:"documentMetadata",data:JSON.parse(JSON.stringify(d)),properties:{organizationId:c,documentId:f}}))}yield Promise.all(l),this.setAllDocumentMetadata(u)}catch(i){return this.loggingService.catch("Error in DocService updateDocuments:",i),[]}})}updateLocations(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let{organizationId:o,locations:s,documentIds:a}=t;if((!a||a.length===0)&&(a=this.documentIds$.value.map(d=>d.clientDocumentId)??[],a.length===0))return this.loggingService.catch("Error in updateLocations: documentId is required"),[];if(!o&&(o=this.documentPaths$.value?.clientOrganizationId,!o))return this.loggingService.catch("Error in updateLocations: organizationId is required"),[];if(!s||s.length===0)return this.loggingService.catch("Error in updateLocations: locations is required"),[];let c=a.map(d=>da(d)),l=[],u=this.locationMetadata$.value;u||(u={}),c.forEach(d=>{s.forEach(f=>{let g=this.location$.value;if(f?.id===g?.location?.id&&this.location$.next({locationId:g?.locationId,location:f}),f?.id){delete f?.metadata;let p=CC(f.id),_=u?.[d],T=_?.[f.id];u&&(_||(u[d]={}),T||(u[d][f.id]={}),u[d][f.id]=le(x({},T),{location:f})),f&&this.commonDbService&&l.push(this.commonDbService.updateData({feature:"locationMetadata",data:JSON.parse(JSON.stringify({location:f})),properties:{organizationId:Ts(o),documentId:d,id:p}}))}})}),yield Promise.all(l),Object.keys(u||{}).length>0&&this.locationMetadata$.next(u)}catch(i){return this.loggingService.catch("Error in DocService updateLocations:",i),[]}})}fetchFolders(t){return I(this,null,function*(){try{if(!this.authService.getUser())return this.loggingService.catch("User not found. Ensure Identify method is called.",void 0,void 0,!0),[];let o=[];if(!t?.organizationId)return this.loggingService.catch("Error in fetchFolders: organizationId is required"),{data:[],parentFolders:[]};let s=[],a=this.generateOrganizationId(t?.organizationId);if(t?.folderId){let c=wo(t?.folderId);o=yield this.commonDbService?.getData({feature:"folder",properties:{folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}}),o&&(o=[o]),s=yield this.commonDbService?.queryData({feature:"allFolders",properties:{firestoreQuery:[Ji("metadata.veltParentFolderId","==",c)],folderId:c,apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}})}else o=yield this.commonDbService?.queryData({feature:"allFolders",properties:{apiKey:this.apiKey??"",organizationId:a,documentId:this.documentPaths$.value?.documentId}});return{data:o,parentFolders:s}}catch(i){return this.loggingService.catch("Error in DocService getFoldersRequest:",i),{data:[],parentFolders:[]}}})}getDocumentIam$(){return this.authService.getUser$().pipe(mt(t=>t?this.documentPaths$.pipe(mt(i=>i?.documentIam?this.commonDbService?.dbListener({feature:"documentIam",properties:{documentId:i.documentId,organizationId:i.organizationId,isCollection:!1}}).pipe(fe(o=>o?.data?.docIamConfig??o?.data),it((o,s)=>JSON.stringify(o??{})===JSON.stringify(s??{}))):ue(null))):ue(null)))}getDocumentAccessType(t){try{return t&&t.features&&t.features.all?t.features.all.restricted?wt.RESTRICTED:wt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:wt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),wt.PUBLIC}}changeDocumentAccessType(t){return I(this,null,function*(){try{let i=this.documentPaths$.value;if(i){let o=yield this.commonDbService?.getData({feature:"documentMetadata",properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??"",field:"docIamConfig"}});if(o?.errorCode)return;switch(delete o.documentAccessType,o.features||(o.features={}),o.features.all||(o.features.all={}),t){case wt.PUBLIC:o.features.all.restricted=!1;break;case wt.RESTRICTED:o.features.all.restricted=!0,o.features.all.guestMode=!1;break;default:break}this.commonDbService?.updateData({feature:"documentAccessType",data:JSON.parse(JSON.stringify(o)),properties:{documentId:i?.documentId??"",organizationId:i?.organizationId??""}})}}catch(i){this.loggingService.catch("Error in DocService changeDocumentAccessType:",i)}})}getUserIdForAnalytics(){try{return this.authService?.getAuthUser()?.uid||""}catch(t){return this.loggingService.catch("Error in DocService getUserIdForAnalytics:",t),""}}setUIState(t){try{this.uiState.next(x(x({},this.uiState.value),t))}catch(i){this.loggingService.catch("Error in DocService setUIState:",i)}}getUIState$(){return this.uiState.asObservable()}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Cr),w(Wy),w(Ev),w(Rr),w(_e),w(zo),w(qo),w(ec),w(It),w(dr),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var zt=(()=>{let e=class e{constructor(t,i,o,s,a){this.analyticsService=t,this.authService=i,this.coreActionsService=o,this.docService=s,this.loggingService=a,this.resolveOrganizationUsers=new Y(!0),this.resolveFolderUsers=new Y(!0),this.resolveDocumentUsers=new Y(!0),this.unresolvedUsers=new Y([]),this.resolveTimeout=60*1e3,this.resolveAttempts=new Map,this.subscriptions=new gt,this.userDataProvider$=new Y(null),this.anonymousUserDataProvider$=new Y(null),this.userIdByEmailCache={},this.userById$=new Y({}),this.customContactUserById$=new Y({}),this.userByIdCalled$=new Y({}),this.pendingResolutions=new Set,this.getUserById=c=>{try{let l=this.userById$.value?.[c],u=this.customContactUserById$.value?.[c];return u?l?x(x({},l),u):u:l}catch(l){this.loggingService.catch("Error in UsersService getUserById:",l);return}};try{this.docService.setUsersService(this),this.analyticsService.setUserService(this),this.authService.setUsersService(this),this.docService.getDocumentPaths$().pipe(Ct(c=>!!c),mt(()=>this.getUnresolvedUsers$().pipe(Ct(c=>c.length>0),Au(300),Nt(20),mt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[MM(Ji("user.userId","in",c.slice(0,20)))]}}).pipe(fe(u=>u?.data),Ks(u=>{if(u&&typeof u=="object"){delete u.undefined,delete u.null;let d=Object.values(u??{});this.setUserByIds(d.map(g=>g.user));let f=c.filter(g=>!d.some(p=>p.user.userId===g));f.length!==c.length&&this.setUnresolvedUsers(f)}})):ue([])})))).subscribe()}catch(c){this.loggingService.catch("Error in UsersService constructor:",c)}}setCommonDbService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setCommonDbService","color: green;"),this.commonDbService=t}catch(i){this.loggingService.catch("Error in UsersService setCommonDbService:",i)}}setContactService(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactService","color: green;"),this.contactService=t}catch(i){this.loggingService.catch("Error in UsersService setContactService:",i)}}ngOnDestroy(){try{this.subscriptions.unsubscribe(),this.pendingResolutions.clear(),this.resolveAttempts.clear()}catch(t){this.loggingService.catch("Error in UsersService ngOnDestroy:",t)}}isResolverForFeatureDisabled(t){let i=this.userDataProvider$.getValue();try{switch(t){case"allOrganizationUsers":return i?!this.resolveOrganizationUsers.value:!0;case"allFolderUsers":return i?!this.resolveFolderUsers.value:!0;case"allDocumentUsers":return i?!this.resolveDocumentUsers.value:!0;default:return!1}}catch(o){return this.loggingService.catch("Error in UsersService isResolverForFeatureDisabled:",o),!1}}resolveUsers(u){return I(this,arguments,function*({userIds:t,forceResolve:i,feature:o,organizationId:s,skipUserCheck:a=!1,uniqueId:c,moduleName:l}){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUsers","color: green;");let d=!1;if(o&&(d=this.isResolverForFeatureDisabled(o)),d)return{};{let f={},g=[],p={};if(t?.forEach(_=>{let T=this.getUserById(_);T?f[_]=T:this.userByIdCalled$.getValue()[_]?i&&g.push(_):(g.push(_),this.userByIdCalled$.next(le(x({},this.userByIdCalled$.getValue()),{[_]:!0})))}),g.length>0){let _=c||J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:xn.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={};try{let D,b=new Promise((G,M)=>{D=setTimeout(()=>{M(new Error("User resolution timeout"))},this.userDataProvider$.getValue()?.config?.resolveTimeout||this.userDataProvider$.getValue()?.resolveTimeout||this.resolveTimeout)});T=yield Promise.race([this.getUsersFromDB({userIds:g,organizationId:s,skipUserCheck:a}).finally(()=>{clearTimeout(D)}),b]),this.analyticsService.trackEvent(L.Events.Resolver.USER_RESOLVER_GET,{sourceMethod:"resolveUsers",source:"sdk",userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(D){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",D,{userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:D,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{g?.forEach(D=>{if(!T[D]){let b=new Set([...this.getUnresolvedUsers(),D]);this.unresolvedUsers.next(Array.from(b)),T[D]={userId:D,name:`User ${D}`}}})}Object.entries(T).forEach(([D,b])=>{b&&(f[D]=T?.[D],p[D]=T?.[D])})}return Object.keys(p).length>0&&(this.authService.setOptionalPropertiesToUsers(Object.values(p)),this.mergeUsersIntoStore(Object.values(p)),Object.keys(p).forEach(_=>{let T=this.getUserById(_);T&&(f[_]=T)})),f}}catch(d){this.loggingService.catch("Error in UsersService resolveUsers:",d);let f=c||J();return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:xn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:d,userIds:t,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}}),{}}})}getUnresolvedUsers$(){return this.unresolvedUsers.asObservable()}getUnresolvedUsers(){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUnresolvedUsers","color: green;");try{return JSON.parse(JSON.stringify(this.unresolvedUsers.getValue()))}catch(t){return this.loggingService.catch("Error in UsersService getUnresolvedUsers:",t),[]}}setUnresolvedUsers(t){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUnresolvedUsers","color: green;");try{if(Array.isArray(t)){let i=JSON.parse(JSON.stringify(t));this.unresolvedUsers.next(i)}}catch(i){this.loggingService.catch("Error in UsersService setUnresolvedUsers:",i)}}getUsersFromDB(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUsersFromDB","color: green;");try{let a=this.userDataProvider$.getValue();if(a){if(a.config?.getConfig?.url){if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return this.loggingService.catch("Error in getUsersFromDB: organizationId is required when using getConfig"),{};let d={organizationId:i,userIds:t},f=yield Ht(a.config.getConfig.url,a.config.getConfig.headers,d,!0,a.config.getConfig.credentials);return f.statusCode!==200?(this.loggingService.catch(`Error in getUsersFromDB: config-based request failed with statusCode ${f.statusCode}. Message: ${f.message||"Unknown error"}`),{}):f.data??{}}let u=yield a.get(t);if(u&&typeof u=="object"&&"success"in u&&"statusCode"in u&&typeof u.success=="boolean"&&typeof u.statusCode=="number"){let d=u;return d.statusCode===200&&d.data?d.data:(this.loggingService.catch(`Error in getUsersFromDB: provider returned error response with statusCode ${d.statusCode}`),{})}return u}if(i||(i=this.docService.getOrganizationConfig()?.organizationId),!i)return{};let c=(yield this.getUsersFromDBWithBatching({userIds:t,organizationId:i,skipUserCheck:o}))??[];this.contactService?.setResolvedUsers(c.flat());let l={};return c.forEach(u=>{u.forEach(d=>{d?.user?.userId&&(l[d.user.userId]=d.user)})}),l}catch(a){return this.loggingService.catch("Error in UsersService getUsersFromDB:",a),{}}})}getUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,skipUserCheck:o=!1}){try{if(!t?.length)return[];let a=[];for(let u=0;u<t.length;u+=30)a.push(t.slice(u,u+30));let c=a.map((u,d)=>I(this,null,function*(){try{return(yield this.commonDbService?.queryData({feature:"allOrganizationUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[Ji("user.userId","in",u)],skipUserCheck:o}}))||[]}catch(f){return this.loggingService.catch(`Error in batch ${d+1}:`,f),[]}}));return yield Promise.all(c)}catch(a){return this.loggingService.catch("Error in getUsersFromDBWithBatching:",a),[]}})}getTemporaryUsersFromDBWithBatching(s){return I(this,arguments,function*({userIds:t,organizationId:i,resourceIds:o}){try{if(!t?.length||!o?.length)return[];let a=[];for(let _=0;_<t.length;_+=30)a.push(t.slice(_,_+30));let c=[];for(let _=0;_<o.length;_+=30)c.push(o.slice(_,_+30));let l=[],u=0,d=(_,T)=>I(this,null,function*(){try{return((yield this.commonDbService?.queryData({feature:"allPermissionsUsers",properties:{organizationId:i,useCollectionGroup:!1,isCollection:!0,firestoreQuery:[MM(Ji("userId","in",_),Ji("veltResourceId","in",T))]}}))??[])||[]}catch(D){return this.loggingService.catch(`Error in batch ${u+1}:`,D),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,D)=>T===D.findIndex(b=>b.userId===_.userId&&b.resourceId===_.resourceId))}catch(a){return this.loggingService.catch("Error in getTemporaryUsersFromDBWithBatching:",a),[]}})}getResolveOrganizationUsers$(){return this.resolveOrganizationUsers.asObservable()}getResolveFolderUsers$(){return this.resolveFolderUsers.asObservable()}getResolveDocumentUsers$(){return this.resolveDocumentUsers.asObservable()}getUserById$(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: getUserById$","color: green;"),Zr([this.userById$,this.customContactUserById$]).pipe(fe(([t,i])=>this.applyContactOverlay(t,i)),it(Ft))}catch(t){return this.loggingService.catch("Error in UsersService getUserById$:",t),ue({})}}applyContactOverlay(t,i){let o=x({},t??{});return Object.entries(i??{}).forEach(([s,a])=>{o[s]=x(x({},o[s]??{}),a)}),o}setUserByIds(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserByIds","color: green;"),this.mergeUsersIntoStore(t)}catch(i){this.loggingService.catch("Error in UsersService setUserByIds:",i)}}setContactListUsers(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setContactListUsers","color: green;");let i={};(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=JSON.parse(JSON.stringify(o)))}),this.customContactUserById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService setContactListUsers:",i)}}getContactListUser(t){try{return this.customContactUserById$.value?.[t]}catch(i){this.loggingService.catch("Error in UsersService getContactListUser:",i);return}}mergeUsersIntoStore(t){try{let i=JSON.parse(JSON.stringify(this.userById$.getValue()??{}));(t??[]).forEach(o=>{let s=o?.userId;s&&(i[s]=x(x({},i?.[s]??{}),o))}),this.userById$.next(i)}catch(i){this.loggingService.catch("Error in UsersService mergeUsersIntoStore:",i)}}setUserDataProvider(t){try{this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setUserDataProvider","color: green;");let i=t.config?.getConfig?.url,o="get"in t&&typeof t.get=="function";if(!i&&!o){this.loggingService.catch("DataProviders.user is invalid. The get method is missing or is not a function (and no getConfig provided).");return}this.userDataProvider$.next(t),t.config?.resolveUsersConfig?.organization===!1?this.resolveOrganizationUsers.next(!1):this.resolveOrganizationUsers.next(!0),t.config?.resolveUsersConfig?.folder===!1?this.resolveFolderUsers.next(!1):this.resolveFolderUsers.next(!0),t.config?.resolveUsersConfig?.document===!1?this.resolveDocumentUsers.next(!1):this.resolveDocumentUsers.next(!0)}catch(i){this.loggingService.catch("Error in UsersService setUserDataProvider:",i)}}setAnonymousUserDataProvider(t){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: setAnonymousUserDataProvider","color: green;"),!("resolveUserIdsByEmail"in t)||typeof t.resolveUserIdsByEmail!="function"){this.loggingService.catch("setAnonymousUserDataProvider is invalid. The resolveUserIdsByEmail method is missing or is not a function.");return}this.anonymousUserDataProvider$.next(t)}catch(i){this.loggingService.catch("Error in UsersService setAnonymousUserDataProvider:",i)}}resolveUserIdsByEmail(o){return I(this,arguments,function*({emails:t,uniqueId:i}){try{if(this.loggingService.log("%c[WB] Calling UsersService FUNCTION: resolveUserIdsByEmail","color: green;"),!t?.length)return{};let s=this.anonymousUserDataProvider$.getValue();if(!s||typeof s.resolveUserIdsByEmail!="function")return{};let a=[...new Set(t.filter(M=>!!M))];if(a.length===0)return{};let c={},l=[];if(a.forEach(M=>{let U=this.userIdByEmailCache[M];U?c[M]=U:l.push(M)}),l.length===0)return c;let u=this.docService.getOrganizationConfig()?.clientOrganizationId||"",d=this.docService.getDocumentPaths()?.clientDocumentId||"",f=this.docService.getDocumentPaths()?.folderId||"",g={organizationId:u,documentId:d,folderId:f,emails:l},p=i||J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,D=new Promise((M,U)=>{T=setTimeout(()=>{U(new Error("resolveUserIdsByEmail timeout"))},_)}),b=s.config?.getRetryConfig||{retryCount:0,retryDelay:0},G=I(this,null,function*(){try{let M=yield kt(()=>s.resolveUserIdsByEmail(g),"resolveUserIdsByEmail",b);return M?.statusCode===200&&M?.data?M.data:(this.loggingService.catch(`Error in resolveUserIdsByEmail: provider returned statusCode ${M?.statusCode}. Message: ${M?.message||"Unknown error"}`),{})}finally{clearTimeout(T)}});try{let M=yield Promise.race([G,D]);return Object.entries(M).forEach(([U,k])=>{k&&(this.userIdByEmailCache[U]=k,c[U]=k,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:k,name:U,email:U},currentUserId:this.authService.getUser()?.userId??""}).catch(S=>{this.loggingService.catch("Error in UsersService resolveUserIdsByEmail addUserInfoToOrganization:",S)}))}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{result:M,emails:l}}),c}catch(M){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail (timeout/race):",M),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:p,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{error:M,emails:l}}),c}}catch(s){return this.loggingService.catch("Error in UsersService resolveUserIdsByEmail:",s),{}}})}externalUserDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: externalUserDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()&&!!this.userDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in UsersService externalUserDataProviderAvailable:",t),!1}}userDataProviderAvailable(){try{return this.loggingService.log("%c[WB] Calling UsersService FUNCTION: userDataProviderAvailable","color: green;"),!!this.commonDbService?.shouldUseFirestore()}catch(t){return this.loggingService.catch("Error in UsersService userDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(Lt),w(Cr),w(It),w(zh),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var tc=class{static getFirestoreProdDbName(e,r){return r?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||r?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":r?.storeDbId??(this.isTestingDb(r?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(r){return H.error("Error in isTestingDb:",r),!1}}};var Ky=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.commentAnnotationsResolverService=c,this.attachmentResolverService=l,this.coreActionsService=u,this.notificationActionTypeMap={[Ie.NEWLY_ADDED]:Qt.COMMENT_ANNOTATION_ADD,[Ie.ADDED]:Qt.COMMENT_ADD,[Ie.UPDATED]:Qt.COMMENT_UPDATE,[Ie.DELETED]:Qt.COMMENT_DELETE},this.additionalEventTypeMap={[Ie.STATUS_CHANGED]:Xn.STATUS_CHANGE,[Ie.PRIORITY_CHANGED]:Xn.PRIORITY_CHANGE,[Ie.ASSIGNED]:Xn.ASSIGN,[Ie.ACCESS_MODE_CHANGED]:Xn.ACCESS_MODE_CHANGE,[Ie.CUSTOM_LIST_CHANGED]:Xn.CUSTOM_LIST_CHANGE,[Ie.APPROVED]:Xn.APPROVE,[Ie.ACCEPTED]:Xn.ACCEPT,[Ie.REJECTED]:Xn.REJECT,[Ie.SUGGESTION_ACCEPTED]:Xn.SUGGESTION_ACCEPT,[Ie.SUGGESTION_REJECTED]:Xn.SUGGESTION_REJECT,[Ie.REACTION_ADDED]:Xn.REACTION_ADD,[Ie.REACTION_DELETED]:Xn.REACTION_DELETE,[Ie.SUBSCRIBED]:Xn.SUBSCRIBE,[Ie.UNSUBSCRIBED]:Xn.UNSUBSCRIBE}}setNotificationService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setNotificationService","color: green;"),this.notificationService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setNotificationService: ",i)}}setUserPermissionService(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: setUserPermissionService","color: green;"),this.userPermissionService=t}catch(i){this.loggingService.catch("Error in CommentUtilsService setUserPermissionService: ",i)}}getUserIdsToResolveFromComments(t){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: getUserIdsToResolveFromComments","color: green;");let i=new Set;for(let o of t){if(o?.from?.userId&&i.add(o?.from?.userId),o?.comments)for(let s of o?.comments){if(s?.from?.userId&&i.add(s?.from?.userId),s?.to)for(let a of s?.to)a?.userId&&i.add(a?.userId);if(s?.taggedUserContacts)for(let a of s?.taggedUserContacts)a?.userId&&i.add(a?.userId)}if(o?.assignedTo?.userId&&i.add(o?.assignedTo?.userId),o?.resolvedByUserId&&i.add(o?.resolvedByUserId),o?.suggestion?.resolvedBy?.userId&&i.add(o?.suggestion?.resolvedBy?.userId),o?.subscribedUsers)for(let s of Object.values(o?.subscribedUsers))s.user.userId&&i.add(s.user.userId);if(o?.unsubscribedUsers)for(let s of Object.values(o?.unsubscribedUsers))s.user.userId&&i.add(s.user.userId)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in CommentUtilsService getUserIdsToResolveFromComments:",i),[]}}mergeCommentWithUser(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeCommentWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.suggestion?.resolvedBy?.userId){let i=this.usersService.getUserById(t?.suggestion?.resolvedBy?.userId);i&&(t.suggestion.resolvedBy=i)}if(t?.comments)for(let i of t?.comments){if(i?.from?.userId){let s=this.usersService.getUserById(i?.from?.userId);s&&(i.from=s)}i?.to&&(i.to=i?.to?.map(s=>{if(s?.userId){let a=this.usersService.getUserById(s?.userId);if(a)return x(x({},s),a)}return s})),i?.taggedUserContacts&&(i.taggedUserContacts=i?.taggedUserContacts?.map(s=>{if(s?.contact){let a=this.usersService.getUserById(s?.contact?.userId);a&&(s.contact=a,(a?.name||a?.email)&&(s.text=`@${a?.name||a?.email}`))}return s}));let o=i?.taggedUserContacts?.filter((s,a,c)=>c.findIndex(l=>l.text===s.text)===a)||[];o.sort((s,a)=>(a.text?.length||0)-(s.text?.length||0)),o.forEach(s=>{if(s?.text){let a=new RegExp(rl(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(rl(`@User ${s.userId}`),"g")),i.commentText=i.commentText?.replaceAll(a,s.text),i.commentHtml=i.commentHtml?.replaceAll(a,s.text)}})}if(t?.assignedTo?.userId){let i=this.usersService.getUserById(t?.assignedTo?.userId);i&&(t.assignedTo=i)}if(t?.resolvedByUserId){let i=this.usersService.getUserById(t?.resolvedByUserId);i&&(t.resolvedByUser=i)}if(t?.subscribedUsers)for(let i of Object.values(t?.subscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.subscribedUsers?.id?.user&&(t.subscribedUsers.id.user=o)}if(t?.unsubscribedUsers)for(let i of Object.values(t?.unsubscribedUsers)){let o=this.usersService.getUserById(i.user.userId);o&&t?.unsubscribedUsers?.id?.user&&(t.unsubscribedUsers.id.user=o)}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeCommentWithUser:",i),t}}formatCommentData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentData","color: green;"),t?.comments?.forEach(i=>{i?.commentText&&i?.commentText?.length>0&&(i.isCommentTextAvailable=!0)}),t?.viewedBy&&delete t.viewedBy,t?.unread!==void 0&&delete t.unread,t?.resolvedByUser!==void 0&&delete t.resolvedByUser,t?.comments&&t.comments.forEach(i=>{i?.reactionAnnotations&&delete i.reactionAnnotations}),this.usersService.userDataProviderAvailable()){if(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.assignedTo?.userId&&(t.assignedTo={userId:t.assignedTo.userId}),t?.subscribedUsers)for(let i of Object.keys(t?.subscribedUsers))t.subscribedUsers[i].user={userId:t?.subscribedUsers[i].user.userId};if(t?.unsubscribedUsers)for(let i of Object.keys(t?.unsubscribedUsers))t.unsubscribedUsers[i].user={userId:t?.unsubscribedUsers[i].user.userId};t?.suggestion?.resolvedBy?.userId&&(t.suggestion.resolvedBy={userId:t.suggestion.resolvedBy.userId})}return t?.comments&&(t.comments=t?.comments?.map(i=>this.formatCommentThreadData(i))),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentData:",i),t}}mergeStrippedDataWithCommentAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeStrippedDataWithCommentAnnotations","color: green;"),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t?.annotationId),o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=this.commentAnnotationsResolverService.getFieldsToRemove();return i&&(t?.comments?.forEach(a=>{let c=i?.comments?.[a?.commentId];if(c){a.commentHtml=c?.commentHtml,a.commentText=c?.commentText;let l=c?.attachments;o&&l&&a.attachments?.forEach(u=>{let d=u?.attachmentId;l?.[d]&&(u.name=l?.[d]?.name,u.url=l?.[d]?.url)})}}),i?.targetTextRange?.text&&t?.targetTextRange&&(t.targetTextRange.text=i?.targetTextRange?.text),s?.length>0&&s.forEach(a=>{i?.[a]&&(t[a]=i[a])})),t}catch(i){return this.loggingService.catch("Error in CommentUtilsService mergeStrippedDataWithCommentAnnotations:",i),t}}mergeLocationWithCommentAnnotations(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: mergeLocationWithCommentAnnotations","color: green;");let o=t?.location?.id,s=t?.metadata?.documentId;if(!o||!s)return t;let a=i?.[s]?.[o];return a&&(t.location=a?.location),t}catch(o){return this.loggingService.catch("Error in CommentUtilsService mergeLocationWithCommentAnnotations:",o),t}}isCommentsDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: isCommentsDataChanged","color: green;");let o=this.commentAnnotationsResolverService.getCommentAnnotationById(i);return o?!ki(t,o):!0}catch(o){return this.loggingService.catch("Error in CommentUtilsService isCommentsDataChanged:",o),!0}}stripCommentsFromAnnotationData({comment:t}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentsFromAnnotationData","color: green;");let i=this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable();if(!i)return t;let o=this.attachmentResolverService.attachmentDataProviderAvailable(),s=new LT;if(Object.assign(s,t),s.isCommentResolverUsed=i,o){let a=s.attachments?.map(c=>(c.isAttachmentResolverUsed=!0,delete c?.name,delete c?.url,c));s.attachments=a}return delete s?.commentHtml,delete s?.commentText,s}catch(i){return this.loggingService.catch("Error in CommentUtilsService stripCommentsFromAnnotationData:",i),t}}resolveTaggedUserEmails(t){return I(this,null,function*(){try{let i=new Set;if(t.comments?.forEach(o=>{o.taggedUserContacts?.forEach(s=>{s?.contact?.email&&!s?.userId&&i.add(s.contact.email)}),o.to?.forEach(s=>{s?.email&&!s?.userId&&i.add(s.email)})}),i.size>0){let o=J();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:Array.from(i)}});let s=yield this.usersService.resolveUserIdsByEmail({emails:Array.from(i),uniqueId:o});Object.keys(s).length>0&&t.comments?.forEach(a=>{a.taggedUserContacts?.forEach(c=>{if(c?.contact?.email&&!c?.userId){let l=s[c.contact.email];if(l){let u=c.text;if(u){let d=rl(u),f=new RegExp(d,"g");a.commentText&&(a.commentText=a.commentText.replace(f,`{{${l}}}`)),a.commentHtml&&(a.commentHtml=a.commentHtml.replace(f,`{{${l}}}`))}c.userId=l,c.contact.userId=l,delete c.contact?.email,delete c.contact?.visibility,c.text=""}}}),a.to=a.to?.map(c=>{if(c?.email&&!c?.userId){let l=s[c.email];if(l)return delete c?.email,delete c?.visibility,le(x({},c),{userId:l})}return c})})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService resolveTaggedUserEmails:",i),t}})}stripCommentAnnotationData(s){return I(this,arguments,function*({data:t,actionType:i,commentId:o}){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: stripCommentAnnotationData","color: green;"),t=yield this.resolveTaggedUserEmails(t),!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let a=this.attachmentResolverService.attachmentDataProviderAvailable(),c=this.commentAnnotationsResolverService.getFieldsToRemove(),l=this.commentAnnotationsResolverService.getAdditionalFields(),u,d;i&&(u=this.notificationActionTypeMap?.[i],d=this.additionalEventTypeMap?.[i]);let f=this.commentAnnotationsResolverService.getAdditionalSaveEvents(),g=Array.isArray(f)?f:[],p={},_=null,T=!1;if(t&&t.annotationId){let M=t.annotationId;if(p[M]=x(x(x(x({annotationId:M,metadata:Cn(t.metadata??{}),comments:{}},t?.from&&{from:t?.from}),t?.assignedTo&&{assignedTo:t?.assignedTo}),t?.resolvedByUserId&&{resolvedByUserId:t?.resolvedByUserId}),t?.targetTextRange?.text&&{targetTextRange:{text:t?.targetTextRange?.text}}),delete t?.targetTextRange?.text,c?.length>0&&c.forEach(k=>{t?.[k]&&(p[M][k]=t[k],delete t[k])}),l?.length)for(let k of l)t?.[k]!==void 0&&(p[M][k]=JSON.parse(JSON.stringify(t[k])));t.comments?.forEach(k=>{if(k.commentId){let S;a&&(S={},k.attachments?.forEach(A=>{S[A.attachmentId]={attachmentId:A.attachmentId,name:A.name,url:A.url}})),p[M].comments[k.commentId]=x(x(x(x(x(x({commentId:k.commentId},k?.commentHtml&&{commentHtml:k?.commentHtml}),k?.commentText&&{commentText:k?.commentText}),S&&{attachments:S}),k?.from&&{from:k?.from}),k?.to&&{to:k?.to}),k?.taggedUserContacts&&{taggedUserContacts:k?.taggedUserContacts})}}),T=this.isCommentsDataChanged(p[M],M);let U=new bT;Object.assign(U,t),c?.length>0&&c.forEach(k=>{k in t||delete U[k]}),U.comments=t.comments?.map(k=>this.stripCommentsFromAnnotationData({comment:k}))||[],_=U}let D=_?.comments?.find(M=>M.commentId===o);D?.isDraft&&(u=_?.comments?.length&&_?.comments?.length>0?Qt.COMMENT_ADD:Qt.COMMENT_ANNOTATION_ADD);let b=!!i&&!!this.notificationActionTypeMap?.[i],G=!!d&&!!_&&!b&&!D?.isDraft&&g.includes(d);return G&&(u=d),{strippedData:T&&(i&&this.notificationActionTypeMap?.[i]||D?.isDraft)||G?p:null,originalData:_,eventType:u}}catch(a){return this.loggingService.catch("Error in CommentAnnotationsResolverService stripCommentAnnotationData:",a),{strippedData:null,originalData:null}}})}formatCommentThreadData(t){try{if(this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: formatCommentThreadData","color: green;"),this.usersService.userDataProviderAvailable()){t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to&&(t.to=t?.to?.map(o=>o?.userId?{userId:o.userId}:o)),t?.taggedUserContacts&&(t.taggedUserContacts=t?.taggedUserContacts?.map(o=>o?.contact?.userId?le(x({},o),{contact:{userId:o.contact.userId}}):o));let i=t?.taggedUserContacts?.filter((o,s,a)=>a.findIndex(c=>c.text===o.text)===s)||[];i.sort((o,s)=>(s.text?.length||0)-(o.text?.length||0)),i.forEach(o=>{if(o?.text&&o?.contact?.userId){let s=new RegExp(rl(o.text),"g");t.commentText=t.commentText?.replaceAll(s,a=>`{{${o.userId}}}`),t.commentHtml=t.commentHtml?.replaceAll(s,a=>`{{${o.userId}}}`)}}),i.forEach(o=>{o?.text&&o?.contact?.userId&&(o.text="")})}return t}catch(i){return this.loggingService.catch("Error in CommentUtilsService formatCommentThreadData:",i),t}}getDeniedForYouUsers(i){return I(this,arguments,function*({extraData:t}){try{let o=Object.values(t?.annotationData?.subscribedUsers||{}).map(a=>a.user.userId)??[],s=[];if(this.userPermissionService?.isPermissionProviderAvailable()&&o.length){let a=t?.metadata?.clientDocumentId,c=t?.annotationData?.context?.access&&this.userPermissionService?.getIsContextEnabled()?t?.annotationData?.context?.access:null,l=[];o.forEach(f=>{if(l.push({userId:f,resource:{id:a,type:di.DOCUMENT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:c?{access:c}:void 0}}),c){let g=JSON.stringify(c);l.push({userId:f,resource:{id:g,type:di.CONTEXT,source:Un.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let u=J();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Un.SET_NOTIFICATIONS,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let d=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:u,methodName:Un.SET_NOTIFICATIONS});d?.success&&d?.data?.length&&d.data.forEach(f=>{f.hasAccess||s.push(f.userId)})}return s}catch(o){return this.loggingService.catch("Error in CommentUtilsService getDeniedForYouUsers:",o),[]}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{this.loggingService.log("%c[WB] Calling CommentUtilsService FUNCTION: handleCommentEncryption","color: green;");let l=$T(this.authService.getFirebaseConfig()?.firebaseOptions),u=Dr(this.functions,Ir({url:st.cloudFunction?.[l]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3});if(o){o=this.notificationService?.processNotificationData(o),o.annotationData=t;let _=o?.targetAnnotationData?.commentId;if(_){let T=t?.comments?.find(D=>D?.commentId===_);T&&(o.targetAnnotationData=T)}try{let T=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??Ie.NEWLY_ADDED});T?.originalData&&(o.annotationData=this.formatCommentData(T.originalData)),o?.targetAnnotationData&&(o.targetAnnotationData=this.formatCommentThreadData(this.stripCommentsFromAnnotationData({comment:o.targetAnnotationData})))}catch(T){this.loggingService.warn("Error in CommentUtilsService handleCommentEncryption:",T)}}let d=tc.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),f=yield this.getDeniedForYouUsers({extraData:o}),g={path:i??"",data:t??{},dbId:d??"",notificationData:o||void 0,notificationURL:st.firebaseNotificationsDatabaseURL,feature:"comment",eventType:s??"PATCH",sdkVersion:jr(),deniedForYouUsers:f,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},p=yield il(g,this.authService.getUser()?.userId??"");yield u({veltData:p})}catch(l){this.loggingService.catch("Error in CommentUtilsService handleCommentEncryption:",l)}})}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Cr),w(dr),w(Rr),w(zo),w(Wh),w(It))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Yy=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retrySaveConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.activityDataProvider$=new Y(null),this.activityById$=new Y({}),this.fieldsToRemove=[],this.getActivityById=s=>{try{return this.activityDataProviderAvailable()?this.activityById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in ActivityResolverService getActivityById:",a);return}};try{this.loggingService.log("ActivityResolverService initialized"),this.activityDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.saveRetryConfig&&(this.retrySaveConfig=s.config.saveRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove))})}catch(s){this.loggingService.catch("Error in ActivityResolverService constructor:",s)}}getProvider(){try{let t=this.activityDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in ActivityResolverService getProvider:",t);return}}ngOnDestroy(){try{this.activityById$.next({})}catch(t){this.loggingService.catch("Error in ActivityResolverService ngOnDestroy:",t)}}resolveActivities(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: resolveActivities","color: green;"),!this.activityDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let b=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:new Error("Activity resolution timeout"),request:t}}),f(new Error("Activity resolution timeout"))}},this.activityDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=[...new Set(t.activityIds||[])],T=le(x({},t),{activityIds:_});I(this,null,function*(){try{if(_.length>0||t.documentIds?.length){let b=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{request:T}});let G=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,T,!0,g.config.getConfig.credentials):g?.get?.(T)||Promise.resolve(void 0),"resolveActivities",this.retryGetConfig).then(M=>c?{}:(u(),M&&M.statusCode!==200?(this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),this.loggingService.catch(M?.message??"Error in ActivityResolverService resolveActivities:"),{}):M?.data)).catch(M=>{throw u(),M});try{p=(yield G)||{},this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_GET,{sourceMethod:"resolveActivities",source:"sdk",activityIds:_});let M={};Object.entries(p).forEach(([U,k])=>{let S=this.activityById$.value?.[U];S?S&&JSON.stringify(S)!==JSON.stringify(k)&&(M[U]=k):M[U]=k}),Object.keys(M).length>0&&this.activityById$.next(x(x({},this.activityById$.getValue()),M)),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let U=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:M,request:T}}),c||f(M),d(p)}}else u(),d({})}catch(b){u();let G=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:b,request:T}}),f(b)}})})}catch(a){this.loggingService.catch("Error in ActivityResolverService resolveActivities:",a);let c=i||J();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:lr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}saveActivity(t,i){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: saveActivity","color: green;");let o=this.getProvider();if(!this.activityDataProviderAvailable())throw new Error("Activity save data provider not available");let s=i||J();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{request:t}});let a=JSON.parse(JSON.stringify(this.activityById$.getValue()));this.activityById$._value=x(x({},a),t.activity);let c=yield kt(()=>{if(o?.config?.saveConfig?.url){let l={activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata};return Ht(o.config.saveConfig.url,o.config.saveConfig.headers,l,!1,o.config.saveConfig.credentials)}return o?.save?.({activity:t.activity,event:t.event,metadata:Object.values(t.activity??{})?.[0]?.metadata})||Promise.resolve(void 0)},"saveActivity",this.retrySaveConfig);return c&&c.statusCode!==200?(this.retrySaveConfig.revertOnFailure&&(this.activityById$._value=a),this.loggingService.catch(c?.message??"Error in ActivityResolverService saveActivity:"),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{error:c,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.ACTIVITY_RESOLVER_SAVE,{sourceMethod:"saveActivity",source:"sdk",activityIds:Object.keys(t.activity),event:t.event}),this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_RESULT,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{result:{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0},request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!0})}catch(o){this.loggingService.warn("Error in ActivityResolverService saveActivity:",o);let s=i||J();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:lr.SAVE_ACTIVITY,source:"internal",payload:{error:o,request:t}}),{revertOnFailure:this.retrySaveConfig.revertOnFailure,isSuccess:!1}}})}getActivitiesById$(){try{return this.activityDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling ActivityResolverService FUNCTION: getActivitiesById$","color: green;"),this.activityById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in ActivityResolverService getActivitiesById$:",t),ue(void 0)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ActivityResolverService getFieldsToRemove:",t),this.fieldsToRemove}}setActivityDataProvider(t){try{if(t){this.loggingService.log("Setting activity data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"save",configKey:"saveConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.activity is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.activityDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in ActivityResolverService setActivityDataProvider:",i)}}activityDataProviderAvailable(){try{return!!this.activityDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in ActivityResolverService activityDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Qy=(()=>{let e=class e{constructor(t,i,o,s,a,c){this.loggingService=t,this.usersService=i,this.authService=o,this.functions=s,this.configService=a,this.reactionAnnotationsResolverService=c}getUserIdsToResolveFromReactions(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o?.from?.userId),o?.reactions?.length)for(let s of o?.reactions)s?.from?.userId&&i.add(s?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ReactionUtilsService getUserIdsToResolveFromRecorders:",i),[]}}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{let a=$T(this.authService.getFirebaseConfig()?.firebaseOptions),c=Dr(this.functions,Ir({url:st.cloudFunction?.[a]?.setEncryptedData,apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=tc.getFirestoreProdDbName(this.configService.getApiKey()??"",this.authService.getFirebaseConfig()?.firebaseOptions),u=this.authService.getUser()?.userId??"",d={path:i??"",data:t??{},dbId:l??"",feature:"reaction",eventType:o??"PATCH",sdkVersion:jr()},f=yield il(d,u);yield c({veltData:f})}catch(a){this.loggingService.catch("Error in handleReactionEncryption:",a)}})}mergeReactionWithUser(t){try{if(this.usersService.userDataProviderAvailable()){if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}if(t?.reactions?.length){for(let i of t?.reactions)if(i?.from?.userId){let o=this.usersService.getUserById(i?.from?.userId);o&&(i.from=o)}}}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeReactionWithUser:",i),t}}formatReactionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t.reactions=t?.reactions?.map(i=>(this.usersService.userDataProviderAvailable()&&i?.from?.userId&&(i.from={userId:i.from.userId}),i)),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService formatReactionData:",i),t}}isReactionDataChanged(t,i){try{this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: isReactionDataChanged","color: green;");let o=this.reactionAnnotationsResolverService.getReactionAnnotationById(i);return o?!ki(t,o):!0}catch(o){return this.loggingService.catch("Error in ReactionUtilsService isReactionDataChanged:",o),!0}}stripReactionAnnotationData(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: stripReactionAnnotationData","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return{originalData:t,strippedData:null};let i={};if(t&&t.annotationId){let o=t.annotationId;if(i[o]=x({annotationId:o,metadata:Cn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),!this.isReactionDataChanged(i[o],o))return{strippedData:null,originalData:t};delete t?.icon,t.isReactionResolverUsed=!0}return{strippedData:i,originalData:t}}catch(i){return this.loggingService.catch("Error in ReactionUtilsService stripReactionAnnotationData:",i),{strippedData:null,originalData:null}}}mergeStrippedDataWithReactionAnnotations(t){try{if(this.loggingService.log("%c[WB] Calling ReactionUtilsService FUNCTION: mergeStrippedDataWithReactionAnnotations","color: green;"),!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())return t;let i=this.reactionAnnotationsResolverService.getReactionAnnotationById(t?.annotationId);return i&&i.icon&&(t.icon=i.icon),t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Cr),w(dr),w(Rr),w(qo))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Xy=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d){this.loggingService=t,this.usersService=i,this.commentUtilsService=o,this.reactionUtilsService=s,this.commentAnnotationsResolverService=a,this.reactionAnnotationsResolverService=c,this.recorderAnnotationsResolverService=l,this.activityResolverService=u,this.serviceBook=d}getActivityDisplayMessage(t){try{switch(t.featureType){case"comment":return this.getCommentDisplayMessage(t);case"recorder":return this.getRecorderDisplayMessage(t);case"reaction":return this.getReactionDisplayMessage(t);case"crdt":return this.getCrdtDisplayMessage(t);case"custom":return t.displayMessageTemplate&&t.displayMessageTemplateData?this.resolveTemplate(t.displayMessageTemplate,t.displayMessageTemplateData):"";default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getActivityDisplayMessage:",i),""}}resolveTemplate(t,i){try{return t.replace(/\{\{([\w.]+)\}\}/g,(o,s)=>{let a=s.split(".").reduce((c,l)=>{if(c!=null&&typeof c=="object")return c[l]},i);return a!=null?String(a):""})}catch(o){return this.loggingService.catch("Error in ActivityUtilsService resolveTemplate:",o),t}}buildActivityDataFromExtraData(t){try{let{feature:i,extraData:o}=t;if(!o?.actionType)return null;switch(i){case"comment":return this.buildCommentActivityData({commentAnnotation:o.annotationData,targetComment:o.targetAnnotationData,actionType:o.actionType,otherFields:o});case"recorder":return this.buildRecorderActivityData(o);case"reaction":return this.buildReactionActivityData(o);default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildActivityDataFromExtraData:",i),null}}stripActivityPII(t){return I(this,null,function*(){try{let i=JSON.parse(JSON.stringify(t));if(delete i.displayMessage,!this.usersService.userDataProviderAvailable())return{strippedActivity:i};i.actionUser?.userId&&(i.actionUser={userId:i.actionUser.userId}),i.changes&&this.stripUsersFromChanges(i.changes),i.displayMessageTemplateData&&this.stripUsersFromTemplateData(i.displayMessageTemplateData);let o=this.extractCommentChangesForResolver(i),s=this.extractFeatureEntityDataForResolver(i);yield this.stripFeatureSpecificPII(i);let a=this.extractActivityResolverData(i);return o&&(a?a.changes=x(x({},a.changes),o.changes):a=o),s&&(a?(s.entityData!==void 0&&(a.entityData=s.entityData),s.entityTargetData!==void 0&&(a.entityTargetData=s.entityTargetData)):a=s),a&&(i.isActivityResolverUsed=!0),{strippedActivity:i,activityResolverData:a}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripActivityPII:",i),{strippedActivity:t}}})}mergeActivityWithUser(t){try{if(!this.usersService.userDataProviderAvailable())return t;if(t=JSON.parse(JSON.stringify(t)),t.actionUser?.userId){let i=this.usersService.getUserById(t.actionUser.userId);i&&(t.actionUser=i)}return t.changes&&this.rehydrateUsersInChanges(t.changes),t.displayMessageTemplateData&&this.rehydrateUsersInTemplateData(t.displayMessageTemplateData),this.rehydrateFeatureSpecificUserData(t),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithUser:",i),t}}mergeActivityWithFeatureData(t){try{switch(t.featureType){case"comment":return this.mergeActivityWithCommentAnnotationData(t);case"reaction":return this.mergeActivityWithReactionData(t);case"recorder":return this.mergeActivityWithRecorderData(t);default:return t}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithFeatureData:",i),t}}getUserIdsToResolveFromActivities(t){try{let i=new Set;for(let o of t){if(o.actionUser?.userId&&i.add(o.actionUser.userId),o.changes)for(let s of Object.values(o.changes))s&&(this.extractUserIdFromValue(s.from,i),this.extractUserIdFromValue(s.to,i));if(o.displayMessageTemplateData)for(let s of Object.values(o.displayMessageTemplateData))this.extractUserIdFromValue(s,i);this.extractFeatureSpecificUserIds(o,i)}return Array.from(i)}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getUserIdsToResolveFromActivities:",i),[]}}getEntityIdsToResolveFromActivities(t,i){try{let o=new Set;for(let s of t)if(!(i&&s.featureType!==i))switch(s.featureType){case"comment":case"reaction":case"recorder":s.targetEntityId&&o.add(s.targetEntityId);break}return Array.from(o)}catch(o){return this.loggingService.catch("Error in ActivityUtilsService getEntityIdsToResolveFromActivities:",o),[]}}stripFeatureSpecificPII(t){return I(this,null,function*(){try{switch(t.featureType){case"comment":yield this.stripCommentPII(t);break;case"reaction":this.stripReactionPII(t);break;case"recorder":this.stripRecorderPII(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripFeatureSpecificPII:",i)}})}extractActivityResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return;let i={id:t.id},o=!1;if(t.featureType==="custom"){let s=this.activityResolverService.getFieldsToRemove();for(let a of s)a in t&&t[a]!==void 0&&(i[a]=t[a],delete t[a],o=!0)}return t.metadata&&(i.metadata=Cn(t.metadata)),o?i:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractActivityResolverData:",i);return}}extractCommentChangesForResolver(t){try{return!this.activityResolverService.activityDataProviderAvailable()||t.featureType!=="comment"||!t.changes?.commentText?void 0:{id:t.id,changes:{commentText:t.changes.commentText},metadata:t.metadata?Cn(t.metadata):void 0}}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractCommentChangesForResolver:",i);return}}extractFeatureEntityDataForResolver(t){try{if(!this.activityResolverService.activityDataProviderAvailable()||!t.entityData)return;let i=t.featureType==="recorder"&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable(),o=t.featureType==="reaction"&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable();if(!i&&!o)return;let s={id:t.id,metadata:t.metadata?Cn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:a});if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}if(o){let c=this.reactionUtilsService.stripReactionAnnotationData(a);if(c?.strippedData){let l=Object.keys(c.strippedData)[0];l&&(s.entityData=c.strippedData[l])}}return s.entityData?s:void 0}catch(i){this.loggingService.catch("Error in ActivityUtilsService extractFeatureEntityDataForResolver:",i);return}}mergeActivityWithResolverData(t){try{if(!this.activityResolverService.activityDataProviderAvailable())return t;let i=this.activityResolverService.getActivityById(t.id);if(!i)return t;i.changes&&(t.changes||(t.changes={}),Object.assign(t.changes,i.changes)),i.entityData!==void 0&&(t.entityData=i.entityData),i.entityTargetData!==void 0&&(t.entityTargetData=i.entityTargetData),i.displayMessageTemplateData&&(t.displayMessageTemplateData||(t.displayMessageTemplateData={}),Object.assign(t.displayMessageTemplateData,i.displayMessageTemplateData));let o=new Set(["id","metadata","changes","entityData","entityTargetData","displayMessageTemplateData"]);for(let[s,a]of Object.entries(i))!o.has(s)&&a!==void 0&&(t[s]=a);return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithResolverData:",i),t}}rehydrateFeatureSpecificUserData(t){try{switch(t.featureType){case"comment":this.rehydrateCommentUserData(t);break;case"reaction":this.rehydrateReactionUserData(t);break;case"recorder":this.rehydrateRecorderUserData(t);break}}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateFeatureSpecificUserData:",i)}}getCommentDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case xe.ANNOTATION_ADD:return`${i} added a comment`;case xe.COMMENT_ADD:return`${i} replied to a comment`;case xe.COMMENT_UPDATE:return`${i} edited a comment`;case xe.COMMENT_DELETE:return`${i} deleted a comment`;case xe.ANNOTATION_DELETE:return`${i} deleted a comment thread`;case xe.STATUS_CHANGE:{let o=t.changes?.status,s=o?.from?.name,a=o?.to?.name;return s&&a?`${i} changed status from ${s} to ${a}`:`${i} changed the status`}case xe.PRIORITY_CHANGE:{let o=t.changes?.priority,s=o?.to;if(!s)return`${i} removed the priority`;let a=typeof s=="object"?s?.name:String(s),c=o?.from,l=c&&typeof c=="object"?c?.name:c?String(c):null;return l&&a?`${i} changed priority from ${l} to ${a}`:`${i} changed priority to ${a}`}case xe.ASSIGN:{let s=t.changes?.assignedTo?.to;return s&&typeof s=="object"&&s.name?`${i} assigned to ${s.name}`:`${i} assigned the comment`}case xe.ACCESS_MODE_CHANGE:{let s=t.changes?.accessMode?.to;return s?`${i} changed access to ${s}`:`${i} changed the access mode`}case xe.CUSTOM_LIST_CHANGE:return`${i} changed the custom list`;case xe.APPROVE:return`${i} approved the comment`;case xe.ACCEPT:case xe.SUGGESTION_ACCEPT:return`${i} accepted a suggestion`;case xe.REJECT:case xe.SUGGESTION_REJECT:return`${i} rejected a suggestion`;case xe.REACTION_ADD:return`${i} reacted to a comment`;case xe.REACTION_DELETE:return`${i} removed a reaction`;case xe.SUBSCRIBE:return`${i} subscribed to the thread`;case xe.UNSUBSCRIBE:return`${i} unsubscribed from the thread`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCommentDisplayMessage:",i),""}}getRecorderDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case vg.RECORDING_ADD:return`${i} added a recording`;case vg.RECORDING_DELETE:return`${i} deleted a recording`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getRecorderDisplayMessage:",i),""}}getReactionDisplayMessage(t){try{let i=t.actionUser?.name??"Someone";switch(t.actionType){case yg.REACTION_ADD:return`${i} added a reaction`;case yg.REACTION_DELETE:return`${i} removed a reaction`;default:return""}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getReactionDisplayMessage:",i),""}}getCrdtDisplayMessage(t){try{let i=t.actionUser?.name??"Someone",s=t.entityData?.editCount??0,a=t.targetEntityId??"unknown";return`${i} made ${s} edit${s!==1?"s":""} to editor ${a}`}catch(i){return this.loggingService.catch("Error in ActivityUtilsService getCrdtDisplayMessage:",i),""}}stripCommentPII(t){return I(this,null,function*(){try{let i=yield this.commentUtilsService.stripCommentAnnotationData({data:t.entityData,actionType:t.eventType??Ie.NEWLY_ADDED});i?.originalData&&(t.entityData=this.commentUtilsService.formatCommentData(i.originalData)),t.entityTargetData&&(t.entityTargetData=this.commentUtilsService.formatCommentThreadData(this.commentUtilsService.stripCommentsFromAnnotationData({comment:t.entityTargetData}))),this.activityResolverService.activityDataProviderAvailable()&&t.changes?.commentText&&delete t.changes.commentText}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripCommentPII:",i)}})}rehydrateCommentUserData(t){try{t.entityData&&this.commentUtilsService.mergeCommentWithUser(t.entityData),t.entityTargetData&&(this.rehydrateUserInObject(t.entityTargetData,"from"),this.rehydrateUsersInArray(t.entityTargetData,"to"),this.rehydrateUsersInArray(t.entityTargetData,"taggedUserContacts"))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateCommentUserData:",i)}}stripReactionPII(t){try{if(!t.entityData)return;this.activityResolverService.activityDataProviderAvailable()&&this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()&&this.reactionUtilsService.stripReactionAnnotationData(t.entityData),t.entityData=this.reactionUtilsService.formatReactionData(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripReactionPII:",i)}}rehydrateReactionUserData(t){try{if(!t.entityData)return;this.reactionUtilsService.mergeReactionWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateReactionUserData:",i)}}stripRecorderPII(t){try{if(!t.entityData)return;if(this.activityResolverService.activityDataProviderAvailable()&&this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:t.entityData});return}let i=t.entityData;if(this.usersService.userDataProviderAvailable()){i.from&&typeof i.from=="object"&&"userId"in i.from&&(i.from={userId:i.from.userId});let o=i.transcription;o?.from&&typeof o.from=="object"&&"userId"in o.from&&(o.from={userId:o.from.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripRecorderPII:",i)}}rehydrateRecorderUserData(t){try{if(!t.entityData)return;this.serviceBook.get(ci)?.mergeRecorderWithUser(t.entityData)}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateRecorderUserData:",i)}}mergeActivityWithCommentAnnotationData(t){try{if(!this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())return t;let i=this.commentAnnotationsResolverService.getAnnotationById(t.targetEntityId);if(!i)return t;let o=t.entityData?.comments;if(Array.isArray(o))for(let s of o){let a=s?.commentId;if(a==null)continue;let c=i.comments?.[String(a)];c&&(c.commentText&&(s.commentText=c.commentText),c.commentHtml&&(s.commentHtml=c.commentHtml))}if(t.targetSubEntityId&&t.entityTargetData){let s=i.comments?.[t.targetSubEntityId];if(s){let a=t.entityTargetData;s.commentText&&(a.commentText=s.commentText),s.commentHtml&&(a.commentHtml=s.commentHtml)}}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithCommentAnnotationData:",i),t}}mergeActivityWithReactionData(t){try{return!this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithReactionData:",i),t}}mergeActivityWithRecorderData(t){try{return!this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()||!t.targetEntityId||!t.entityData||this.serviceBook.get(ci)?.mergeStrippedDataWithRecorderAnnotation(t.entityData),t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mergeActivityWithRecorderData:",i),t}}buildCommentActivityData(t){try{let{commentAnnotation:i,targetComment:o,actionType:s,otherFields:a}=t,c=i,l=o,u=s===Ie.DELETED&&a?.isAnnotationDelete?xe.ANNOTATION_DELETE:this.mapCommentStatusToActionType(s);if(!u)return null;let d=c?.annotationId;if(!d)return null;let f=l?.commentId,g=this.buildCommentChanges(s,l,a);return{featureType:"comment",actionType:u,targetEntityId:d,eventType:s,targetSubEntityId:f??null,changes:Object.keys(g).length>0?g:void 0,entityData:i,entityTargetData:o??void 0}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildCommentActivityData:",i),null}}mapCommentStatusToActionType(t){try{switch(t){case Ie.NEWLY_ADDED:return xe.ANNOTATION_ADD;case Ie.ADDED:return xe.COMMENT_ADD;case Ie.UPDATED:return xe.COMMENT_UPDATE;case Ie.DELETED:return xe.COMMENT_DELETE;case Ie.STATUS_CHANGED:return xe.STATUS_CHANGE;case Ie.PRIORITY_CHANGED:return xe.PRIORITY_CHANGE;case Ie.ASSIGNED:return xe.ASSIGN;case Ie.ACCESS_MODE_CHANGED:return xe.ACCESS_MODE_CHANGE;case Ie.CUSTOM_LIST_CHANGED:return xe.CUSTOM_LIST_CHANGE;case Ie.APPROVED:return xe.APPROVE;case Ie.ACCEPTED:return xe.ACCEPT;case Ie.REJECTED:return xe.REJECT;case Ie.SUGGESTION_ACCEPTED:return xe.SUGGESTION_ACCEPT;case Ie.SUGGESTION_REJECTED:return xe.SUGGESTION_REJECT;case Ie.REACTION_ADDED:return xe.REACTION_ADD;case Ie.REACTION_DELETED:return xe.REACTION_DELETE;case Ie.SUBSCRIBED:return xe.SUBSCRIBE;case Ie.UNSUBSCRIBED:return xe.UNSUBSCRIBE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapCommentStatusToActionType:",i),null}}buildRecorderActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapRecorderStatusToActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"recorder",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildRecorderActivityData:",i),null}}mapRecorderStatusToActionType(t){try{switch(t){case _T.ADDED:return vg.RECORDING_ADD;case _T.DELETED:return vg.RECORDING_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapRecorderStatusToActionType:",i),null}}buildReactionActivityData(t){try{let i=t.annotationData,o=t.actionType,s=this.mapReactionActionType(o);if(!s)return null;let a=i?.annotationId;return a?{featureType:"reaction",actionType:s,targetEntityId:a,entityData:i}:null}catch(i){return this.loggingService.catch("Error in ActivityUtilsService buildReactionActivityData:",i),null}}mapReactionActionType(t){try{switch(t){case"add":return yg.REACTION_ADD;case"delete":return yg.REACTION_DELETE;default:return null}}catch(i){return this.loggingService.catch("Error in ActivityUtilsService mapReactionActionType:",i),null}}buildCommentChanges(t,i,o){try{let s={};switch(t){case Ie.NEWLY_ADDED:case Ie.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case Ie.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case Ie.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case Ie.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case Ie.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case Ie.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case Ie.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case Ie.CUSTOM_LIST_CHANGED:s.customList={from:o?.oldCustomList??null,to:o?.newCustomList??null};break}return s}catch(s){return this.loggingService.catch("Error in ActivityUtilsService buildCommentChanges:",s),{}}}extractFeatureSpecificUserIds(t,i){try{switch(t.featureType){case"comment":this.extractCommentActivityUserIds(t,i);break;case"reaction":this.extractReactionActivityUserIds(t,i);break;case"recorder":this.extractRecorderActivityUserIds(t,i);break}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractFeatureSpecificUserIds:",o)}}extractCommentActivityUserIds(t,i){try{if(t.entityData){let o=this.commentUtilsService.getUserIdsToResolveFromComments([t.entityData]);for(let s of o)i.add(s)}if(t.entityTargetData){let o=t.entityTargetData;if(this.extractUserIdFromValue(o.from,i),Array.isArray(o.to))for(let s of o.to)this.extractUserIdFromValue(s,i);if(Array.isArray(o.taggedUserContacts))for(let s of o.taggedUserContacts)this.extractUserIdFromValue(s,i)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractCommentActivityUserIds:",o)}}extractReactionActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.reactionUtilsService.getUserIdsToResolveFromReactions([t.entityData]);for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractReactionActivityUserIds:",o)}}extractRecorderActivityUserIds(t,i){try{if(!t.entityData)return;let o=this.serviceBook.get(ci)?.getUserIdsToResolveFromRecorders([t.entityData])??[];for(let s of o)i.add(s)}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractRecorderActivityUserIds:",o)}}stripUsersFromChanges(t){try{for(let i of Object.keys(t)){let o=t[i];o&&(o.from=this.stripUserIfPresent(o.from),o.to=this.stripUserIfPresent(o.to))}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromChanges:",i)}}stripUserIfPresent(t){try{return t&&typeof t=="object"&&"userId"in t?{userId:t.userId}:t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService stripUserIfPresent:",i),t}}stripUsersFromTemplateData(t){try{for(let i of Object.keys(t)){let o=t[i];o&&typeof o=="object"&&"userId"in o&&(t[i]={userId:o.userId})}}catch(i){this.loggingService.catch("Error in ActivityUtilsService stripUsersFromTemplateData:",i)}}rehydrateUsersInChanges(t){try{for(let i of Object.values(t))i&&(i.from=this.rehydrateIfUser(i.from),i.to=this.rehydrateIfUser(i.to))}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInChanges:",i)}}rehydrateIfUser(t){try{if(t&&typeof t=="object"&&"userId"in t){let i=t.userId;return this.usersService.getUserById(i)??t}return t}catch(i){return this.loggingService.catch("Error in ActivityUtilsService rehydrateIfUser:",i),t}}rehydrateUsersInTemplateData(t){try{for(let i of Object.keys(t))t[i]=this.rehydrateIfUser(t[i])}catch(i){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInTemplateData:",i)}}rehydrateUserInObject(t,i){try{let o=t[i];if(o&&typeof o=="object"&&"userId"in o){let s=o.userId,a=this.usersService.getUserById(s);a&&(t[i]=a)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUserInObject:",o)}}rehydrateUsersInArray(t,i){try{let o=t[i];Array.isArray(o)&&(t[i]=o.map(s=>this.rehydrateIfUser(s)))}catch(o){this.loggingService.catch("Error in ActivityUtilsService rehydrateUsersInArray:",o)}}extractUserIdFromValue(t,i){try{if(t&&typeof t=="object"&&"userId"in t){let o=t.userId;typeof o=="string"&&i.add(o)}}catch(o){this.loggingService.catch("Error in ActivityUtilsService extractUserIdFromValue:",o)}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt),w(Ky),w(Qy),w(zo),w(qo),w(ec),w(Yy),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Jy=class{constructor({apiKey:e,documentId:r,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=da(s)),a&&(this.organizationId=Ts(a)),i&&(this.folderId=i,this.veltFolderId=wo(i)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`${this.apiKey}`;this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`),this.documentId&&(this.paths.docs=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/`,this.paths.presence=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,this.paths.cursor=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,this.paths.tag=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,this.paths.arrow=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,this.paths.selection=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,this.paths.audioHuddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,this.paths.huddle=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,this.paths.flock=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,this.paths.syncVideoPlayer=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,this.paths.liveState=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,this.paths.liveStateSingleEditorMode=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,this.paths.views=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,this.paths.notifications=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,this.paths.metadata=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.documentIam=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`),this.paths.customerMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,this.paths.groupContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,this.paths.globalContacts=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,this.paths.logins=`${e}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,this.paths.userFeedback=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,this.paths.userReportBugs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,this.paths.userContactUs=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,this.organizationId&&(this.paths.organizationMetadata=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,this.paths.organizationIam=`${e}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,this.paths.organizationNotifications=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,this.documentId&&(this.paths.organizationNotificationsWithDocumentId=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/`,this.paths.heartbeatByDocument=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${this.documentId}/`),this.paths.organizationNotificationsLastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,this.paths.organizationNotificationsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,this.paths.heartbeat=`${e}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),this.paths.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`}}catch{}}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("User config path is not available.")}get workspaceIam(){return this.paths.workspaceIam?this.paths.workspaceIam:this.throwError("Workspace IAM path is not available.")}get docs(){return this.paths.docs?this.paths.docs:this.throwError("Docs path is not available.")}get presence(){return this.paths.presence?this.paths.presence:this.throwError("Presence path is not available.")}get cursor(){return this.paths.cursor?this.paths.cursor:this.throwError("Cursor path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get arrow(){return this.paths.arrow?this.paths.arrow:this.throwError("Arrow path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get tag(){return this.paths.tag?this.paths.tag:this.throwError("Tag path is not available.")}get selection(){return this.paths.selection?this.paths.selection:this.throwError("Selection path is not available.")}get audioHuddle(){return this.paths.audioHuddle?this.paths.audioHuddle:this.throwError("Audio huddle path is not available.")}get huddle(){return this.paths.huddle?this.paths.huddle:this.throwError("Huddle path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get flock(){return this.paths.flock?this.paths.flock:this.throwError("Flock path is not available.")}get syncVideoPlayer(){return this.paths.syncVideoPlayer?this.paths.syncVideoPlayer:this.throwError("Sync video player path is not available.")}get liveState(){return this.paths.liveState?this.paths.liveState:this.throwError("Live state path is not available.")}get liveStateSingleEditorMode(){return this.paths.liveStateSingleEditorMode?this.paths.liveStateSingleEditorMode:this.throwError("Live state single editor mode path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get views(){return this.paths.views?this.paths.views:this.throwError("Views path is not available.")}get notifications(){return this.paths.notifications?this.paths.notifications:this.throwError("Notifications path is not available.")}get metadata(){return this.paths.metadata?this.paths.metadata:this.throwError("Metadata path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get documentIam(){return this.paths.documentIam?this.paths.documentIam:this.throwError("Document IAM path is not available.")}get organizationMetadata(){return this.paths.organizationMetadata?this.paths.organizationMetadata:this.throwError("Organization metadata path is not available.")}get organizationIam(){return this.paths.organizationIam?this.paths.organizationIam:this.throwError("Organization IAM path is not available.")}get customerMetadata(){return this.paths.customerMetadata?this.paths.customerMetadata:this.throwError("Customer metadata path is not available.")}get groupContacts(){return this.paths.groupContacts?this.paths.groupContacts:this.throwError("Group contacts path is not available.")}get globalContacts(){return this.paths.globalContacts?this.paths.globalContacts:this.throwError("Global contacts path is not available.")}get logins(){return this.paths.logins?this.paths.logins:this.throwError("Logins path is not available.")}get userFeedback(){return this.paths.userFeedback?this.paths.userFeedback:this.throwError("User feedback path is not available.")}get userReportBugs(){return this.paths.userReportBugs?this.paths.userReportBugs:this.throwError("User report bugs path is not available.")}get userContactUs(){return this.paths.userContactUs?this.paths.userContactUs:this.throwError("User contact us path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("Organization groups path is not available.")}get heartbeat(){return this.paths.heartbeat?this.paths.heartbeat:this.throwError("Heartbeat path is not available.")}get heartbeatByDocument(){return this.paths.heartbeatByDocument?this.paths.heartbeatByDocument:this.throwError("Heartbeat by document path is not available.")}get organizationNotifications(){return this.paths.organizationNotifications?this.paths.organizationNotifications:this.throwError("Organization notifications path is not available.")}get organizationNotificationsWithDocumentId(){return this.paths.organizationNotificationsWithDocumentId?this.paths.organizationNotificationsWithDocumentId:this.throwError("Organization notifications with document id path is not available.")}get organizationNotificationsUsers(){return this.paths.organizationNotificationsUsers?this.paths.organizationNotificationsUsers:this.throwError("Organization notifications users path is not available.")}get organizationNotificationsLastNotificationTimestamp(){return this.paths.organizationNotificationsLastNotificationTimestamp?this.paths.organizationNotificationsLastNotificationTimestamp:this.throwError("Organization notifications last notification timestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var zz=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.usersService=o}getUserIdsToResolveFromLiveStateCustom(t){try{let i=new Set;return t?.updatedBy&&i.add(t?.updatedBy?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustom:",i),[]}}mergeLiveStateCustomWithUser(t){try{if(t?.updatedBy?.userId){let i=this.usersService.getUserById(t?.updatedBy?.userId);i&&(t.updatedBy=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateCustomWithUser:",i),t}}formatLiveStateCustomData(t){try{return this.usersService.userDataProviderAvailable()&&t?.updatedBy&&(t.updatedBy={userId:t.updatedBy.userId}),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateCustomData:",i),t}}getUserIdsToResolveFromLiveStateCustoms(t){try{let i=new Set;for(let o of t)o?.updatedBy?.userId&&i.add(o?.updatedBy?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateCustoms:",i),[]}}getUserIdsToResolveFromLiveStates(t){try{let i=new Set;return t?.default?.singleEditorMode?.editor?.userId&&i.add(t?.default?.singleEditorMode?.editor?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStates:",i),[]}}getUserIdsToResolveFromLiveStateSingleEditorMode(t){try{let i=new Set;return t?.editor?.userId&&i.add(t?.editor?.userId),t?.requestEditorAccess?.user?.userId&&i.add(t?.requestEditorAccess?.user?.userId),Array.from(i)}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService getUserIdsToResolveFromLiveStateSingleEditorMode:",i),[]}}mergeLiveStateWithUser(t){try{if(t?.default?.singleEditorMode?.editor?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.editor?.userId);i&&(t.default.singleEditorMode.editor=i)}if(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.default?.singleEditorMode?.requestEditorAccess?.user?.userId);i&&(t.default.singleEditorMode.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeLiveStateWithUser:",i),t}}mergeSingleEditorLiveStateDataWithUser(t){try{if(t?.editor?.userId){let i=this.usersService.getUserById(t?.editor?.userId);i&&(t.editor=i)}if(t?.requestEditorAccess?.user?.userId){let i=this.usersService.getUserById(t?.requestEditorAccess?.user?.userId);i&&(t.requestEditorAccess.user=i)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService mergeSingleEditorLiveStateDataWithUser:",i),t}}resolveAndMergeSingleEditorLiveStateDataWithUser(t){return I(this,null,function*(){try{let i=this.getUserIdsToResolveFromLiveStates({default:{singleEditorMode:t}});if(i.length){let o=J(),s=tl.GET_SINGLE_EDITOR_USERS;return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:xn.RESOLVE_AND_MERGE_SINGLE_EDITOR_LIVE_STATE_DATA_WITH_USER,moduleName:s,source:"internal",payload:{userIds:i}}),yield this.usersService.resolveUsers({userIds:i,uniqueId:o,moduleName:s}),this.mergeSingleEditorLiveStateDataWithUser(t)}return t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService resolveAndMergeSingleEditorLiveStateDataWithUser:",i),t}})}formatLiveStateSingleEditorModeData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.editor?.userId&&(t.editor={userId:t.editor.userId}),t?.requestEditorAccess?.user?.userId&&(t.requestEditorAccess.user={userId:t.requestEditorAccess.user.userId})),t}catch(i){return this.loggingService.catch("Error in LiveStateUtilsService formatLiveStateSingleEditorModeData:",i),t}}mergeLiveStateCustomsWithUsers(t){try{for(let i of t)if(i?.updatedBy?.userId){let o=this.usersService.getUserById(i?.updatedBy?.userId);o&&(i.updatedBy=o)}return t}catch(i){return this.loggingService.catch("Error in mergeLiveStateCustomsWithUsers:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Zy=(()=>{let e=class e{constructor(t,i,o){this.coreActionsService=t,this.loggingService=i,this.analyticsService=o,this.resolveTimeout=60*1e3,this.retryDeleteConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.retryGetConfig={retryCount:0,retryDelay:0,revertOnFailure:!1},this.notificationDataProvider$=new Y(null),this.notificationById$=new Y({}),this.inFlightRequests=new Map,this.getNotificationById=s=>{try{return this.notificationDataProviderAvailable()?this.notificationById$.value?.[s]:void 0}catch(a){this.loggingService.catch("Error in NotificationResolverService getNotificationById:",a);return}};try{this.loggingService.log("NotificationResolverService initialized"),this.notificationDataProvider$.subscribe(s=>{s&&(s.config?.resolveTimeout&&(this.resolveTimeout=s.config.resolveTimeout),s.config?.deleteRetryConfig&&(this.retryDeleteConfig=s.config.deleteRetryConfig),s.config?.getRetryConfig&&(this.retryGetConfig=s.config.getRetryConfig))})}catch(s){this.loggingService.catch("Error in NotificationResolverService constructor:",s)}}getProvider(){try{let t=this.notificationDataProvider$.getValue();return t||void 0}catch(t){this.loggingService.catch("Error in NotificationResolverService getProvider:",t);return}}ngOnDestroy(){try{this.notificationById$.next({})}catch(t){this.loggingService.catch("Error in NotificationResolverService ngOnDestroy:",t)}}resolveNotifications(s){return I(this,arguments,function*({request:t,uniqueId:i,moduleName:o}){try{if(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: resolveNotifications","color: green;"),!this.notificationDataProviderAvailable())return{};let a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0,l=!0)};return new Promise((d,f)=>{a=setTimeout(()=>{if(!l){c=!0,u();let k=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:new Error("Notification resolution timeout"),request:t}}),f(new Error("Notification resolution timeout"))}},this.notificationDataProvider$.value?.config?.resolveTimeout||this.resolveTimeout);let g=this.getProvider();if(!g)return u(),d({});let p={},_=this.notificationById$.getValue()||{},T=[...new Set(t.notificationIds||[])],D=[],b=[],G=[];for(let k of T)_[k]||(this.inFlightRequests.has(k)?(D.push(this.inFlightRequests.get(k)),b.push(k)):G.push(k));let M=le(x({},t),{notificationIds:G});I(this,null,function*(){try{if(D.length>0&&(yield Promise.allSettled(D)),G.length>0){let k=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:M}});let S,A=new Promise(O=>{S=O});for(let O of G)this.inFlightRequests.set(O,A.then(P=>P?.[O]));let C=kt(()=>g?.config?.getConfig?.url?Ht(g.config.getConfig.url,g.config.getConfig.headers,M,!0,g.config.getConfig.credentials):g?.get?.(M)||Promise.resolve(void 0),"getNotifications",this.retryGetConfig).then(O=>c?{}:(u(),O&&O.statusCode!==200?(this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:M}}),this.loggingService.catch(O?.message??"Error in NotificationResolverService resolveNotifications:"),{}):O?.data)).catch(O=>{throw u(),O});try{p=(yield C)||{},S(p);for(let P of G)this.inFlightRequests.delete(P);this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_GET,{sourceMethod:"resolveNotifications",source:"sdk",notificationIds:G});let O={};Object.entries(p).forEach(([P,F])=>{let N=this.notificationById$.value?.[P];N?N&&JSON.stringify(N)!==JSON.stringify(F)&&(O[P]=F):O[P]=F}),Object.keys(O).length>0&&this.notificationById$.next(x(x({},this.notificationById$.getValue()),O)),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:k,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:O,request:M}}),d(O)}catch(O){S({});for(let F of G)this.inFlightRequests.delete(F);let P=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:O,request:M}}),c||f(O),d(p)}}else u(),d({})}catch(k){u();let S=i||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:k,request:M}}),f(k)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||J();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Fn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:a,request:t}}),{}}})}deleteNotification(t,i,o){return I(this,null,function*(){try{this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: deleteNotification","color: green;");let s=this.getProvider();if(!this.notificationDataProviderAvailable())throw new Error("Notification delete data provider not available");let a=o||J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{notificationId:t,organizationId:i}});let c=this.notificationById$.getValue(),l=x({},c);delete l?.[t],this.notificationById$._value=l;let u={notificationId:t,organizationId:i},d=yield kt(()=>s?.config?.deleteConfig?.url?Ht(s.config.deleteConfig.url,s.config.deleteConfig.headers,u,!1,s.config.deleteConfig.credentials):s?.delete?.(u)||Promise.resolve(void 0),"deleteNotification",this.retryDeleteConfig);return d&&d.statusCode!==200?(this.retryDeleteConfig.revertOnFailure&&(this.notificationById$._value=c),this.loggingService.catch(d?.message??"Error in NotificationResolverService deleteNotification:"),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:d,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!1}):(this.analyticsService.trackEvent(L.Events.Resolver.NOTIFICATION_RESOLVER_DELETE,{sourceMethod:"deleteNotification",source:"sdk",notificationId:t}),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_RESULT,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{result:{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0},notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0})}catch(s){this.loggingService.warn("Error in NotificationResolverService deleteNotification:",s);let a=o||J();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Fn.DELETE_NOTIFICATION,source:"internal",payload:{error:s,notificationId:t,organizationId:i}}),{revertOnFailure:this.retryDeleteConfig.revertOnFailure,isSuccess:!0}}})}getNotificationsById$(){try{return this.notificationDataProviderAvailable()?(this.loggingService.log("%c[WB] Calling NotificationResolverService FUNCTION: getNotificationsById$","color: green;"),this.notificationById$.asObservable()):ue(void 0)}catch(t){return this.loggingService.catch("Error in NotificationResolverService getNotificationsById$:",t),ue(void 0)}}setNotificationDataProvider(t){try{if(t){this.loggingService.log("Setting notification data provider");let i=t.config,o=[{method:"get",configKey:"getConfig"},{method:"delete",configKey:"deleteConfig"}],s=[];if(o.forEach(({method:a,configKey:c})=>{let l=i?.[c]?.url,u=a in t&&typeof t[a]=="function";!l&&!u&&s.push(a)}),s.length>0){let a=`DataProviders.notification is invalid. The following methods are missing or are not functions (and no corresponding config provided): ${s.join(", ")}.`;this.loggingService.catch(a);return}else this.notificationDataProvider$.next(t)}}catch(i){this.loggingService.catch("Error in NotificationResolverService setNotificationDataProvider:",i)}}notificationDataProviderAvailable(){try{return!!this.notificationDataProvider$.getValue()}catch(t){return this.loggingService.catch("Error in NotificationResolverService notificationDataProviderAvailable:",t),!1}}};e.\u0275fac=function(i){return new(i||e)(w(It),w(_e),w(Lt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Np=class{constructor({apiKey:e,documentId:r,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=r,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=da(i)),o&&(this.organizationId=Ts(o)),s&&(this.folderId=s,this.veltFolderId=wo(s)),this.generateDocumentPaths()}generateDocumentPaths(){try{if(this.paths.clientDocumentId=this.clientDocumentId,this.paths.documentId=this.documentId,this.organizationId&&(this.paths.organizationId=this.organizationId,this.paths.clientOrganizationId=this.clientOrganizationId),this.veltFolderId&&(this.paths.folderId=this.folderId,this.paths.veltFolderId=this.veltFolderId),this.apiKey){let e=`apiKey/${this.apiKey}`;this.paths.activities=`${e}/${v.FIREBASE_PARTIAL_PATH_ACTIVITIES}`,this.paths.userNotificationIndex=`${e}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION_INDEX}`,this.organizationId&&(e=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${this.paths.organizationId}`,this.paths.organization=e,this.paths.folder=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}`,this.paths.organizationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,this.paths.users=`${e}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,this.paths.notificationDocs=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,this.paths.notificationUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.paths.organizationGroups=`${e}/${v.FIREBASE_PARTIAL_PATH_GROUPS}`,this.paths.lastNotificationTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}`,this.paths.lastActivityTimestamp=`${e}/${v.FIREBASE_PARTIAL_PATH_LAST_ACTIVITY_TIMESTAMP}`,this.paths.userConfig=`${e}/${v.FIREBASE_PARTIAL_PATH_USERS}`,this.paths.permissionsUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_PERMISSIONS_USERS}`),this.veltFolderId&&(this.paths.folderUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_FOLDERS}/${this.veltFolderId}/${v.FIREBASE_PARTIAL_PATH_FOLDER_USERS}`),this.documentId&&(this.paths.document=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,this.paths.comment=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,this.paths.location=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION}`,this.paths.multiThread=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,this.paths.area=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_AREA}`,this.paths.recorder=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,this.paths.reaction=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,this.paths.crdt=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,this.paths.notificationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,this.paths.documentViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,this.paths.locationViews=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,this.paths.documentUsers=`${e}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,this.paths.docNotification=`${this.paths.notificationDocs}/${this.documentId}/${v.FIREBASE_PARTIAL_PATH_DOC_NOTIFICATION}`)}}catch{}}get userNotificationIndex(){return this.paths.userNotificationIndex}get permissionsUsers(){return this.paths.permissionsUsers?this.paths.permissionsUsers:this.throwError("PermissionsUsers path is not available.")}get users(){return this.paths.users?this.paths.users:this.throwError("Users path is not available.")}get userConfig(){return this.paths.userConfig?this.paths.userConfig:this.throwError("UserConfig path is not available.")}get folder(){return this.paths.folder?this.paths.folder:this.throwError("Folder path is not available.")}get lastNotificationTimestamp(){return this.paths.lastNotificationTimestamp?this.paths.lastNotificationTimestamp:this.throwError("LastNotificationTimestamp path is not available.")}get organizationGroups(){return this.paths.organizationGroups?this.paths.organizationGroups:this.throwError("organizationGroups path is not available.")}get docNotification(){return this.paths.docNotification?this.paths.docNotification:this.throwError("DocNotification path is not available.")}get organization(){return this.paths.organization?this.paths.organization:this.throwError("Organization path is not available.")}get document(){return this.paths.document?this.paths.document:this.throwError("Document path is not available.")}get location(){return this.paths.location?this.paths.location:this.throwError("Location path is not available.")}get area(){return this.paths.area?this.paths.area:this.throwError("Area path is not available.")}get comment(){return this.paths.comment?this.paths.comment:this.throwError("Comment path is not available.")}get documentViews(){return this.paths.documentViews?this.paths.documentViews:this.throwError("DocumentViews path is not available.")}get locationViews(){return this.paths.locationViews?this.paths.locationViews:this.throwError("LocationViews path is not available.")}get notificationViews(){return this.paths.notificationViews?this.paths.notificationViews:this.throwError("NotificationViews path is not available.")}get documentUsers(){return this.paths.documentUsers?this.paths.documentUsers:this.throwError("DocumentUsers path is not available.")}get folderUsers(){return this.paths.folderUsers?this.paths.folderUsers:this.throwError("FolderUsers path is not available.")}get organizationUsers(){return this.paths.organizationUsers?this.paths.organizationUsers:this.throwError("OrganizationUsers path is not available.")}get notificationDocs(){return this.paths.notificationDocs?this.paths.notificationDocs:this.throwError("NotificationDocs path is not available.")}get notificationUsers(){return this.paths.notificationUsers?this.paths.notificationUsers:this.throwError("NotificationUsers path is not available.")}get multiThread(){return this.paths.multiThread?this.paths.multiThread:this.throwError("Multi thread path is not available.")}get recorder(){return this.paths.recorder?this.paths.recorder:this.throwError("Recorder path is not available.")}get reaction(){return this.paths.reaction?this.paths.reaction:this.throwError("Reaction path is not available.")}get crdt(){return this.paths.crdt?this.paths.crdt:this.throwError("CRDT path is not available.")}get activities(){return this.paths.activities?this.paths.activities:this.throwError("Activities path is not available.")}get lastActivityTimestamp(){return this.paths.lastActivityTimestamp?this.paths.lastActivityTimestamp:this.throwError("LastActivityTimestamp path is not available.")}throwError(e){throw{type:"DocumentPaths",message:e,metadata:{apiKey:this.apiKey,documentId:this.documentId,organizationId:this.organizationId}}}};var Kz=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromAreaAnnotations(t){try{this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: getUserIdsToResolveFromAreaAnnotations","color: green;");let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in AreaUtilsService getUserIdsToResolveFromAreaAnnotations:",i),[]}}mergeAreaWithUser(t){try{if(this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: mergeAreaWithUser","color: green;"),t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in AreaUtilsService mergeAreaWithUser:",i),t}}formatAreaData(t){try{return this.loggingService.log("%c[WB] Calling AreaUtilsService FUNCTION: formatAreaData","color: green;"),this.usersService.userDataProviderAvailable()&&t?.from?.userId&&(t.from={userId:t.from.userId}),t}catch(i){return this.loggingService.catch("Error in AreaUtilsService formatAreaData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Yz=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromUserIamData(t){try{this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: getUserIdsToResolveFromUserIamData","color: green;");let i=new Set;if(t?.length)for(let o of t)o?.user?.userId&&i.add(o?.user?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in ContactUtilsService getUserIdsToResolveFromUserIamData: ",i),[]}}mergeUserIamWithUser(t){try{if(this.loggingService.log("%c[WB] Calling ContactUtilsService FUNCTION: mergeUserIamWithUser","color: green;"),t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);if(i){let o=i;t?.user&&typeof t.user=="object"&&(o=x(x({},o),t.user));let s=this.usersService.getContactListUser(t.user.userId);s&&(o=x(x({},o),s)),t=le(x({},t),{user:o})}}return t}catch(i){return this.loggingService.catch("Error in ContactUtilsService mergeUserIamWithUser: ",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Qz=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromMultiThreads(t){try{let i=new Set;for(let o of t)o?.from?.userId&&i.add(o?.from?.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService getUserIdsToResolveFromMultiThreads:",i),[]}}mergeMultiThreadWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService mergeMultiThreadWithUser:",i),t}}formatMultiThreadData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.commentAnnotationsMap&&(t.commentAnnotationsMap=null)),t}catch(i){return this.loggingService.catch("Error in MultiThreadUtilsService formatMultiThreadData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Xz=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromSelections(t){try{let i=new Set;for(let o of t)o?.user?.userId&&i.add(o.user.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in SelectionUtilsService getUserIdsToResolveFromSelections:",i),[]}}mergeSelectionWithUser(t){try{if(t?.user?.userId){let i=this.usersService.getUserById(t?.user?.userId);i&&(t.user=i)}return t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService mergeSelectionWithUser:",i),t}}formatSelectionData(t){try{return this.usersService.userDataProviderAvailable()&&t?.user?.userId&&(t.user={userId:t.user.userId}),t}catch(i){return this.loggingService.catch("Error in SelectionUtilsService formatSelectionData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Jz=(()=>{let e=class e{constructor(t,i){this.loggingService=t,this.usersService=i}getUserIdsToResolveFromTags(t){try{let i=new Set;for(let o of t)if(o?.from?.userId&&i.add(o.from.userId),o?.to?.length)for(let s of o.to)s?.userId&&i.add(s.userId);return Array.from(i)}catch(i){return this.loggingService.catch("Error in TagUtilsService getUserIdsToResolveFromTags:",i),[]}}mergeTagWithUser(t){try{if(t?.from?.userId){let i=this.usersService.getUserById(t?.from?.userId);i&&(t.from=i)}return t?.to?.length&&(t.to=t.to.map(i=>{if(i?.userId){let o=this.usersService.getUserById(i?.userId);o&&(i=o)}return i})),t}catch(i){return this.loggingService.catch("Error in TagUtilsService mergeTagWithUser:",i),t}}formatTagData(t){try{return this.usersService.userDataProviderAvailable()&&(t?.from?.userId&&(t.from={userId:t.from.userId}),t?.to?.length&&(t.to=t.to.map(i=>(i?.userId&&(i={userId:i.userId}),i)))),t}catch(i){return this.loggingService.catch("Error in TagUtilsService formatTagData:",i),t}}};e.\u0275fac=function(i){return new(i||e)(w(_e),w(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var Zz=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D,b,G,M,U,k){this.activityUtilsService=t,this.areaUtilsService=i,this.commentUtilsService=o,this.contactUtilsService=s,this.coreActionsService=a,this.liveStateUtilsService=c,this.loggingService=l,this.multiThreadUtilsService=u,this.reactionUtilsService=d,this.selectionUtilsService=f,this.tagUtilsService=g,this.usersService=p,this.docService=_,this.commentAnnotationsResolverService=T,this.reactionAnnotationsResolverService=D,this.recorderAnnotationsResolverService=b,this.notificationResolverService=G,this.activityResolverService=M,this.serviceBook=U,this.attachmentResolverService=k}getErrorForGetRequests({feature:t,error:i}){try{switch(t){case"apiKeyMetadata":case"organizationMetadata":case"documentMetadata":case"folderMetadata":return(i?.message??"")?.includes("Missing or insufficient permissions.")?{errorCode:"PERMISSION_DENIED"}:null;default:return null}}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService getErrorForGetRequests:",o),null}}getFirestorePath({feature:t,properties:i,documentPaths:o,apiKey:s}){try{if(!s)return;if(t==="userNotificationIndex"){if(!i?.id)return;let d=new Np({apiKey:s});return d?.userNotificationIndex?`${d.userNotificationIndex}/${i.id}`:void 0}let{documentId:a,organizationId:c,folderId:l}=i;if(!c&&(c=o?.organizationId,!c))return;let u=new Np({apiKey:s,documentId:a?`${a}`:"",organizationId:c?`${c}`:"",veltFolderId:l?`${l}`:void 0});switch(t){case"userConfig":return i?.userId&&u?.userConfig?`${u?.userConfig}/${i?.userId}${i?.documentId?`/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:""}`:void 0;case"allPermissionsUsers":return u?.permissionsUsers?`${u?.permissionsUsers}`:void 0;case"comment":return i?.documentId&&i?.id&&u?.comment?`${u?.comment}/${i?.id}`:void 0;case"allComments":return i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"multiThread":return i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}/${i?.id}`:void 0;case"allMultiThreads":return i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}`:void 0;case"allLastNotificationTimestamp":return u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return i?.id&&u?.lastNotificationTimestamp?`${u?.lastNotificationTimestamp}/${i?.id}`:void 0;case"activity":return i?.id&&u?.activities?`${u?.activities}/${i?.id}`:void 0;case"allActivities":return u?.activities?`${u?.activities}`:void 0;case"allLastActivityTimestamp":return u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}`:void 0;case"lastActivityTimestamp":return i?.id&&u?.lastActivityTimestamp?`${u?.lastActivityTimestamp}/${i?.id}`:void 0;case"area":return i?.documentId&&i?.id&&u?.area?`${u?.area}/${i?.id}`:void 0;case"allAreas":return i?.documentId&&u?.area?`${u?.area}`:void 0;case"allDocuments":return u?.document?`${u?.document}`:void 0;case"allLocations":return u?.location?`${u?.location}`:void 0;case"allFolders":return u?.folder?`${u?.folder}`:void 0;case"folder":return u?.folder&&i.folderId?`${u?.folder}/${i.folderId}`:void 0;case"documentUserAccess":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"reaction":return i?.documentId&&i?.id&&u?.reaction?`${u?.reaction}/${i?.id}`:void 0;case"allReactions":return i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}`:void 0;case"allRecorders":return i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"recorderTrackEvent":return i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}/${i?.id}/trackRecorderEvent`:void 0;case"documentAccessType":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"apiKeyMetadata":return s?`apiKey/${s}`:void 0;case"organizationMetadata":return u?.organization?`${u?.organization}`:void 0;case"documentIam":case"documentMetadata":return i?.documentId&&u?.document?`${u?.document}/${i?.documentId}`:void 0;case"folderMetadata":return i?.folderId&&u?.folder?`${u?.folder}/${i?.folderId}`:void 0;case"locationMetadata":return i?.documentId&&u?.location&&i?.id?`${u?.location}/${i?.id}`:void 0;case"documentUser":return i?.documentId&&i?.id&&u?.documentUsers?`${u?.documentUsers}/${i?.id}`:void 0;case"allDocumentUsers":return u?.users?`${u?.users}`:void 0;case"allFolderUsers":return u?.users?`${u?.users}`:void 0;case"allOrganizationGroups":return u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return u?.users?`${u?.users}`:void 0;case"notificationViewsTimestamp":return i?.documentId&&i?.id&&u?.notificationViews?`${u?.notificationViews}/${i?.id}`:void 0;case"allDocumentViews":return i?.documentId&&u?.documentViews?`${u?.documentViews}`:void 0;case"documentViews":case"documentMetadataViews":case"documentDayViews":case"documentUsersViews":return i?.documentId&&i?.id&&u?.documentViews?`${u?.documentViews}/${i?.id}`:void 0;case"locationDayViews":case"locationUsersViews":case"locationViews":case"locationMetadataViews":case"location":return i?.documentId&&i?.id&&u?.locationViews?`${u?.locationViews}/${i?.id}`:void 0;case"allLocationViews":return i?.documentId&&u?.locationViews?`${u?.locationViews}`:void 0;case"allDocNotifications":return i?.documentId&&u?.docNotification?`${u?.docNotification}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.docNotification?`${u?.docNotification}/${i?.id}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}/${i?.id}`:void 0;case"allUserNotifications":return i?.userId&&u?.notificationUsers?`${u?.notificationUsers}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_USER_NOTIFICATION}`:void 0;default:throw new Error(`Unknown feature: ${t}`)}}catch(a){this.loggingService.catch("Error in CommonDbUtilsService getFirestorePath:",a);return}}getFirestoreCollectionGroupPath(t){try{switch(t){case"allComments":return v.FIREBASE_PARTIAL_PATH_COMMENT;case"allDocuments":return v.FIREBASE_PARTIAL_PATH_DOCS;case"allLocations":return v.FIREBASE_PARTIAL_PATH_LOCATION;case"allMultiThreads":return v.FIREBASE_PARTIAL_PATH_MULTI_THREAD;case"allAreas":return v.FIREBASE_PARTIAL_PATH_AREA;case"allReactions":return v.FIREBASE_PARTIAL_PATH_REACTION;case"allRecorders":return v.FIREBASE_PARTIAL_PATH_RECORDER;case"allDocumentViews":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS;case"allLocationViews":return v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS;case"allDocumentUsers":return v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS;case"allFolderUsers":return v.FIREBASE_PARTIAL_PATH_FOLDER_USERS;default:throw new Error(`Unknown feature: ${t}`)}}catch(i){this.loggingService.catch("Error in CommonDbUtilsService getFirestoreCollectionGroupPath:",i);return}}getDocumentPath({feature:t,properties:i,defaultDocumentPaths:o,apiKey:s,useFirestore:a}){try{if(!s)return;let{documentId:c,organizationId:l}=i;l||(l=o?.organizationId);let u=new Jy({apiKey:s,documentId:c?`${c}`:"",organizationId:l?`${l}`:""});switch(t){case"userConfig":return i?.userId&&i?.documentId&&u?.userConfig?`${u?.userConfig}/${i?.userId}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_CONFIGURATIONS}/${i?.documentId}`:void 0;case"allComments":return!a&&i?.documentId&&u?.comment?`${u?.comment}`:void 0;case"allGlobalContacts":return i?.documentId&&u?.globalContacts?`${u?.globalContacts}`:void 0;case"globalContacts":return i?.documentId&&i?.userId&&u?.globalContacts?`${u?.globalContacts}${i?.userId}`:void 0;case"groupContacts":return i?.documentId&&i?.groupId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}`:void 0;case"groupContactsUser":return i?.documentId&&i?.groupId&&i?.userId&&u?.groupContacts?`${u?.groupContacts}${i?.groupId}/${i?.userId}`:void 0;case"allLoginContacts":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}/contacts`:void 0;case"allLogins":return i?.documentId&&u?.logins?`${u?.logins}`:void 0;case"logins":return i?.documentId&&i?.userId&&u?.logins?`${u?.logins}${i?.userId}`:void 0;case"customerMetadata":return u?.customerMetadata?`${u?.customerMetadata}`:void 0;case"allArrows":return i?.documentId&&u?.arrow?`${u?.arrow}`:void 0;case"arrow":return i?.documentId&&u?.arrow&&i.id?`${u?.arrow}${i.id}`:void 0;case"allCursors":return i?.documentId&&u?.cursor?`${u?.cursor}`:void 0;case"cursor":return i?.documentId&&u?.cursor&&i.id?`${u?.cursor}${i.id}`:void 0;case"flockUser":return i?.documentId&&u?.flock&&i.id?`${u?.flock}users/${i.id}`:void 0;case"flockSession":return i?.documentId&&u?.flock&&i.id?`${u?.flock}sessions/${i.id}`:void 0;case"allHuddleAttendees":return i?.documentId&&u?.huddle?`${u?.huddle}attendees`:void 0;case"huddleAttendee":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}`:void 0;case"huddleAttendeeState":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}attendees/${i.id}/state`:void 0;case"allHuddleInvitees":return i?.documentId&&u?.huddle?`${u?.huddle}invitees`:void 0;case"huddleConnection":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}connections/${i.id}`:void 0;case"huddleIceCandidate":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}iceCandidates/${i.id}`:void 0;case"allHuddleIceCandidates":return i?.documentId&&u?.huddle?`${u?.huddle}iceCandidates`:void 0;case"allHuddleMessages":return i?.documentId&&u?.huddle?`${u?.huddle}messages`:void 0;case"huddleMessage":return i?.documentId&&u?.huddle&&i.id?`${u?.huddle}messages/${i.id}`:void 0;case"allLiveStates":return i?.documentId&&u?.liveState?`${u?.liveState}`:void 0;case"allLiveStateCustoms":return i?.documentId&&u?.liveState?`${u?.liveState}custom`:void 0;case"liveStateCustom":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}custom/${i.id}`:void 0;case"liveStateSingleEditorMode":return i?.documentId&&u?.liveStateSingleEditorMode?`${u?.liveStateSingleEditorMode}`:void 0;case"liveStateAutoSyncState":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState`:void 0;case"liveStateAutoSyncStateCurrent":return i?.documentId&&u?.liveState?`${u?.liveState}default/autoSyncState/current`:void 0;case"liveStateAutoSyncStateHistoryId":return i?.documentId&&u?.liveState&&i?.id?`${u?.liveState}default/autoSyncState/history/${i.id}`:void 0;case"presence":return i?.documentId&&u?.presence&&i?.userId?`${u?.presence}${i?.userId}`:void 0;case"allPresence":return i?.documentId&&u?.presence?`${u?.presence}`:void 0;case"workspaceIam":return u?.workspaceIam?`${u?.workspaceIam}`:void 0;case"selection":return i?.documentId&&u?.selection&&i?.userId?`${u?.selection}${i?.userId}`:void 0;case"allSelections":return i?.documentId&&u?.selection?`${u?.selection}`:void 0;case"syncVideoPlayer":return i?.documentId&&u?.syncVideoPlayer?`${u?.syncVideoPlayer}`:void 0;case"allTags":return i?.documentId&&u?.tag?`${u?.tag}`:void 0;case"tag":return i?.documentId&&u?.tag&&i?.id?`${u?.tag}${i?.id}`:void 0;case"userContactUs":return i?.documentId&&u?.userContactUs?`${u?.userContactUs}`:void 0;case"userFeedback":return i?.documentId&&u?.userFeedback?`${u?.userFeedback}`:void 0;case"userReportBug":return i?.documentId&&u?.userReportBugs?`${u?.userReportBugs}`:void 0;case"comment":return!a&&i?.documentId&&i?.id&&u?.comment?`${u?.comment}${i?.id}`:void 0;case"allMultiThreads":return!a&&i?.documentId&&u?.multiThread?`${u?.multiThread}`:void 0;case"crdt":return!a&&i?.documentId&&u?.crdt?`${u?.crdt}`:void 0;case"crdtData":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/data`:void 0;case"crdtSyncState":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/state`:void 0;case"crdtSyncPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence/${i.userId}`:void 0;case"allCrdtSyncPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/sync/presence`:void 0;case"crdtPresence":return i?.documentId&&i.userId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence/${i.userId}`:void 0;case"allCrdtPresence":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/presence`:void 0;case"crdtVersion":return i?.documentId&&u?.crdt&&i?.id&&i?.versionId?`${u?.crdt}/${i?.id}/versions/${i?.versionId}`:void 0;case"crdtVersions":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/versions`:void 0;case"crdtMessages":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/messages`:void 0;case"crdtMessage":return i?.documentId&&u?.crdt&&i?.id&&i?.messageId?`${u?.crdt}/${i?.id}/messages/${i?.messageId}`:void 0;case"crdtSnapshot":return i?.documentId&&u?.crdt&&i?.id?`${u?.crdt}/${i?.id}/snapshot`:void 0;case"multiThread":return!a&&i?.documentId&&i?.id&&u?.multiThread?`${u?.multiThread}${i?.id}`:void 0;case"allLastNotificationTimestamp":return!a&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}`:void 0;case"lastNotificationTimestamp":return!a&&i?.id&&u?.organizationNotificationsLastNotificationTimestamp?`${u?.organizationNotificationsLastNotificationTimestamp}${i?.id}`:void 0;case"documentIam":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}`:void 0;case"allDocuments":return!a&&u?.docs&&i?.documentId?`${u?.docs}/${i?.documentId}/${v.FIREBASE_PARTIAL_PATH_METADATA}`:void 0;case"allAreas":return!a&&i?.documentId&&u?.area?`${u?.area}`:void 0;case"area":return!a&&i?.id&&u?.area?`${u?.area}${i?.id}`:void 0;case"folder":return!a&&i?.folderId&&u?.folder?`${u?.folder}${i?.folderId}`:void 0;case"documentUserAccess":return!a&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"documentUser":return!a&&i?.documentId&&i?.id&&u?.documentIam?`${u?.documentIam}users/${i?.id}`:void 0;case"allDocumentUsers":return!a&&i?.documentId&&u?.documentIam?`${u?.documentIam}users/`:void 0;case"allOrganizationGroups":return!a&&u?.organizationGroups?`${u?.organizationGroups}`:void 0;case"allOrganizationUsers":return!a&&u?.organizationIam?`${u?.organizationIam}users/`:void 0;case"reaction":return!a&&i?.id&&u?.reaction?`${u?.reaction}${i?.id}`:void 0;case"allReactions":return!a&&i?.documentId&&u?.reaction?`${u?.reaction}`:void 0;case"recorder":return!a&&i?.documentId&&i?.id&&u?.recorder?`${u?.recorder}${i?.id}`:void 0;case"allRecorders":return!a&&i?.documentId&&u?.recorder?`${u?.recorder}`:void 0;case"organizationMetadata":return!a&&u?.organizationMetadata?`${u?.organizationMetadata}`:void 0;case"heartbeat":return i?.id&&u?.heartbeat?`${u?.heartbeat}${i?.id}`:void 0;case"allHeartbeats":return u?.heartbeat?`${u?.heartbeat}`:void 0;case"heartbeatByDocument":return i?.id&&u?.heartbeatByDocument?`${u?.heartbeatByDocument}${i?.id}`:void 0;case"allHeartbeatsByDocument":return u?.heartbeatByDocument?`${u?.heartbeatByDocument}`:void 0;case"documentAccessType":return!a&&u?.documentIam?`${u?.documentIam}`:void 0;case"documentMetadata":return!a&&i?.documentId&&u?.metadata?`${u?.metadata}`:void 0;case"allDocumentViews":return!a&&i?.documentId&&u?.views?`${u?.views}documentViews/`:void 0;case"documentViews":return!a&&i?.documentId&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}`:void 0;case"allLocationViews":return!a&&i?.documentId&&u?.views?`${u?.views}locationViews/`:void 0;case"notificationViewsTimestamp":return!a&&i?.id&&i?.user&&u?.views?`${u?.views}notification/${i?.id}/views/${i?.user}`:void 0;case"documentUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}documentViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"documentMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}documentViews/${i?.id}/metadata`:void 0;case"documentDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}documentViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"locationViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/location`:void 0;case"location":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}`:void 0;case"locationUsersViews":return!a&&i?.id&&i?.user&&i?.date&&u?.views?`${u?.views}locationViews/${i?.id}/users/${i?.user}/${i?.date}`:void 0;case"locationMetadataViews":return!a&&i?.id&&u?.views?`${u?.views}locationViews/${i?.id}/metadata`:void 0;case"locationDayViews":return!a&&i?.id&&i?.date&&i?.user&&u?.views?`${u?.views}locationViews/${i?.id}/day/${i?.date}/${i?.user}`:void 0;case"docNotificationViews":case"docNotification":return i?.documentId&&i?.id&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}${i?.id}`:void 0;case"allDocNotifications":return i?.documentId&&u?.organizationNotificationsWithDocumentId?`${u?.organizationNotificationsWithDocumentId}`:void 0;case"allUserNotifications":return i?.userId&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}`:void 0;case"userNotificationViews":case"userNotification":return i?.userId&&i?.id&&u?.organizationNotificationsUsers?`${u?.organizationNotificationsUsers}${i?.userId}/${i?.id}`:void 0;case"locationMetadata":return;case"allLocations":return;case"folderMetadata":return;case"allPermissionsUsers":return;default:throw new Error(`Unknown feature: ${t}`)}}catch(c){this.loggingService.catch("Error in CommonDbUtilsService getDocumentPath:",c);return}}resolveAnnotations(o){return I(this,arguments,function*({data:t,feature:i}){try{if(t&&t?.length>0)switch(i){case"allComments":{if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let s=J(),a=Td.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Et.RESOLVE_COMMENT_ANNOTATIONS,moduleName:a,source:"internal",payload:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allReactions":{if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let s=J(),a=Id.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:a,source:"internal",payload:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}case"allRecorders":{if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let s=J(),a=vd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:a,source:"internal",payload:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""}}),this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:t,organizationId:this.docService.getDocumentPaths()?.clientOrganizationId??""},uniqueId:s,moduleName:a})}break}default:break}}catch(s){this.loggingService.catch(`Error in CommonDbUtilsService resolveAnnotations: ${i}`,s)}})}formatResponse(g){return I(this,arguments,function*({feature:t,data:i,organizationId:o,shouldAwait:s=!1,forceResolve:a=!1,shouldCommentAnnotationsResolverAwait:c=!1,shouldNotificationResolverAwait:l=!1,shouldActivityResolverAwait:u=!1,shouldReactionResolverAwait:d=!1,shouldRecorderResolverAwait:f=!1}){try{let p=o??this.docService.getDocumentPaths()?.clientOrganizationId??this.docService.getOrganizationConfig()?.clientOrganizationId??"";if(this.usersService.userDataProviderAvailable()){let _=[];switch(t){case"allAreas":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.areaUtilsService.getUserIdsToResolveFromAreaAnnotations(Object.values(i)));break}case"allArrows":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(IT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(vT)?.getUserIdsToResolveFromCursorUsers(Object.values(i))??[]);break}case"allComments":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.commentUtilsService.getUserIdsToResolveFromComments(Object.values(i)));break}case"allDocumentUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allFolderUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allOrganizationUsers":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.contactUtilsService.getUserIdsToResolveFromUserIamData(Object.values(i)));break}case"allMultiThreads":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.multiThreadUtilsService.getUserIdsToResolveFromMultiThreads(Object.values(i)));break}case"allDocNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(xi)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(xi)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(yT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ci)?.getUserIdsToResolveFromRecorders(Object.values(i))??[]);break}case"allReactions":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.reactionUtilsService.getUserIdsToResolveFromReactions(Object.values(i)));break}case"allTags":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.tagUtilsService.getUserIdsToResolveFromTags(Object.values(i)));break}case"allHuddleAttendees":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ST)?.getUserIdsToResolveFromHuddleAttendees(Object.values(i))??[]);break}case"liveStateCustom":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustom(i));break}case"allLiveStateCustoms":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateCustoms(Object.values(i)));break}case"allLiveStates":{i&&typeof i=="object"&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStates(i));break}case"liveStateSingleEditorMode":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.liveStateUtilsService.getUserIdsToResolveFromLiveStateSingleEditorMode(i));break}case"allSelections":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.selectionUtilsService.getUserIdsToResolveFromSelections(Object.values(i)));break}case"allActivities":{i&&typeof i=="object"&&(_=this.activityUtilsService.getUserIdsToResolveFromActivities(Array.isArray(i)?i:Object.values(i)));break}default:_=[]}if(_?.length){let T=J(),D=tl.GET_USERS;this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:xn.FORMAT_RESPONSE,source:"internal",moduleName:D,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:D})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(xi)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(D=>!this.notificationResolverService.getNotificationById(D)));break}default:_=[]}if(_?.length){let T=J(),D=yC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Fn.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let D=this.serviceBook.get(xi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let D=this.serviceBook.get(xi)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),D=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...D],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}default:_=[]}if(_?.length){let T=J(),D=Td.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.FORMAT_RESPONSE,moduleName:D,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:D})}}if(t==="allActivities"&&i&&typeof i=="object"){let _=Array.isArray(i)?i:Object.values(i),T=this.docService.getDocumentPaths()?.clientOrganizationId??"";if(this.activityResolverService.activityDataProviderAvailable()){let D=[];for(let b of _)b?.id&&!this.activityResolverService.getActivityById(b.id)&&D.push(b.id);if(D.length){let b=J(),G=SC.GET_ACTIVITIES;this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:lr.FORMAT_RESPONSE,moduleName:G,source:"internal",payload:{activityIds:D,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.activityResolverService.resolveActivities({request:{activityIds:D,organizationId:T},uniqueId:b,moduleName:G})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(D=D.filter(b=>!this.reactionAnnotationsResolverService.getAnnotationById(b)),D.length){let b=J(),G=Id.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.RESOLVE_REACTION_ANNOTATIONS,moduleName:G,source:"internal",payload:{reactionAnnotationIds:D,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let D=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(D=D.filter(b=>!this.recorderAnnotationsResolverService.getAnnotationById(b)),D.length){let b=J(),G=vd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_RECORDER_ANNOTATIONS,moduleName:G,source:"internal",payload:{recorderAnnotationIds:D,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:D,organizationId:T},uniqueId:b,moduleName:G})}}}return i}catch(p){return this.loggingService.catch("Error in CommonDbUtilsService formatResponse:",p),i}})}mergeCommentAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeCommentAnnotationsWithData","color: green;"),this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable())switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeStrippedDataWithCommentAnnotations(a),o),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(xi);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithNotification(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeCommentAnnotationsWithData:",o),t}}mergeActivityResolverWithData({data:t,feature:i}){try{return this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeActivityResolverWithData","color: green;"),this.activityResolverService.activityDataProviderAvailable()&&i==="allActivities"&&Array.isArray(t)?t.map(o=>this.activityUtilsService.mergeActivityWithResolverData(o)):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeActivityResolverWithData:",o),t}}mergeNotificationsWithResolvedData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeNotificationsWithResolvedData","color: green;"),this.notificationResolverService.notificationDataProviderAvailable())switch(i){case"allDocNotifications":case"allUserNotifications":{let o=this.serviceBook.get(xi);return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeResolvedNotificationData(c):c,s),{}):Array.isArray(t)?t.map(s=>o?o.mergeResolvedNotificationData(s):s):t}default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeNotificationsWithResolvedData:",o),t}}mergeNotificationsWithResolvedData$({data:t,feature:i}){try{return this.notificationResolverService.getNotificationsById$().pipe(fe(()=>{let o=this.mergeNotificationsWithResolvedData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeNotificationsWithResolvedData$:",o),ue(t)}}mergeReactionAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeReactionAnnotationsWithData","color: green;"),this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable())switch(i){case"allReactions":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeStrippedDataWithReactionAnnotations(a),o),{}):t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeReactionAnnotationsWithData:",o),t}}mergeRecorderAnnotationsWithData({data:t,feature:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeRecorderAnnotationsWithData","color: green;"),this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable())switch(i){case"allRecorders":if(t&&typeof t=="object"&&!Array.isArray(t)){let o=this.serviceBook.get(ci);return Object.entries(t).reduce((s,[a,c])=>(s[a]=o?o.mergeStrippedDataWithRecorderAnnotation(c):c,s),{})}else return t;case"allActivities":return this.mergeActivitiesWithFeatureData(t);default:return t}return t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeRecorderAnnotationsWithData:",o),t}}mergeActivitiesWithFeatureData(t){return Array.isArray(t)?t.map(i=>this.activityUtilsService.mergeActivityWithFeatureData(i)):t}mergeLocationMetadataWithData({data:t,feature:i,locationMetadata:o}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeLocationMetadataWithData","color: green;"),o&&typeof o=="object"&&!Array.isArray(o))switch(i){case"allComments":return t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).reduce((s,[a,c])=>(s[a]=this.commentUtilsService.mergeLocationWithCommentAnnotations(c,o),s),{}):t;case"allDocNotifications":case"allUserNotifications":if(t&&typeof t=="object"&&!Array.isArray(t)){let s=this.serviceBook.get(xi);return Object.entries(t).reduce((a,[c,l])=>(a[c]=s?s.mergeLocationWithNotification(l,o):l,a),{})}else return t;default:return t}return t}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService mergeLocationMetadataWithData:",s),t}}mergeUsersWithData({feature:t,data:i}){try{if(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: mergeUsersWithData","color: green;"),this.usersService.userDataProviderAvailable())switch(t){case"allAreas":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.areaUtilsService.mergeAreaWithUser(a),o),{}):i;case"allArrows":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(IT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeArrowWithUser(c):c,s),{})}else return i;case"allCursors":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(vT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeCursorUserWithUser(c):c,s),{})}else return i;case"allComments":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.commentUtilsService.mergeCommentWithUser(a),o),{}):i;case"allDocumentUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allFolderUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allOrganizationUsers":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.contactUtilsService.mergeUserIamWithUser(a),o),{}):i;case"allMultiThreads":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.multiThreadUtilsService.mergeMultiThreadWithUser(a),o),{}):i;case"allDocNotifications":if(i&&typeof i=="object"){let o=this.serviceBook.get(xi);return i?.map(s=>o?o.mergeNotificationWithUser(s):s)}else return i;case"allUserNotifications":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(xi);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeNotificationWithUser(c):c,s),{})}else return i;case"allPresence":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(yT);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergePresenceUserWithUser(c):c,s),{})}else return i;case"allRecorders":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(ci);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?o.mergeRecorderWithUser(c):c,s),{})}else return i;case"allReactions":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.reactionUtilsService.mergeReactionWithUser(a),o),{}):i;case"allTags":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.tagUtilsService.mergeTagWithUser(a),o),{}):i;case"allHuddleAttendees":if(i&&typeof i=="object"&&!Array.isArray(i)){let o=this.serviceBook.get(ST);return Object.entries(i).reduce((s,[a,c])=>(s[a]=o?.mergeHuddleAttendeeWithUser(c)??c,s),{})}else return i;case"liveStateCustom":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeLiveStateCustomWithUser(i):i;case"allLiveStateCustoms":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.liveStateUtilsService.mergeLiveStateCustomWithUser(a),o),{}):i;case"allLiveStates":return i&&typeof i=="object"?this.liveStateUtilsService.mergeLiveStateWithUser(i):i;case"liveStateSingleEditorMode":return i&&typeof i=="object"&&!Array.isArray(i)?this.liveStateUtilsService.mergeSingleEditorLiveStateDataWithUser(i):i;case"allSelections":return i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).reduce((o,[s,a])=>(o[s]=this.selectionUtilsService.mergeSelectionWithUser(a),o),{}):i;case"allActivities":return Array.isArray(i)?i.map(o=>this.activityUtilsService.mergeActivityWithUser(o)):i;default:return i}return i}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService mergeUsersWithData:",o),i}}mergeCommentAnnotationsWithData$({data:t,feature:i}){try{return this.commentAnnotationsResolverService.getCommentAnnotationsById$().pipe(fe(()=>{let o=this.mergeCommentAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeCommentAnnotationsWithData:",o),ue(t)}}mergeReactionAnnotationsWithData$({data:t,feature:i}){try{return this.reactionAnnotationsResolverService.getReactionAnnotationsById$().pipe(fe(()=>{let o=this.mergeReactionAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeReactionAnnotationsWithData:",o),ue(t)}}mergeRecorderAnnotationsWithData$({data:t,feature:i}){try{return this.recorderAnnotationsResolverService.getRecorderAnnotationsById$().pipe(fe(()=>{let o=this.mergeRecorderAnnotationsWithData({data:t?.data??{},feature:i}),s=this.mergeUsersWithData({feature:i,data:o??{}});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch("Error in mergeRecorderAnnotationsWithData:",o),ue(t)}}mergeUsersWithData$({feature:t,data:i}){try{return this.usersService.getUserById$().pipe(fe(()=>{let o=this.mergeUsersWithData({feature:t,data:i?.data??{}});return typeof o=="object"?{data:JSON.parse(JSON.stringify(o)),operation:i?.operation??null}:{data:o,operation:i?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeUsersWithData for ${t}:`,o),ue(i)}}mergeLocationMetadataWithData$({data:t,feature:i}){try{return this.docService.getLocationMetadata$().pipe(fe(o=>{let s=this.mergeLocationMetadataWithData({data:t?.data??{},feature:i,locationMetadata:o});return typeof s=="object"?{data:JSON.parse(JSON.stringify(s)),operation:t?.operation??null}:{data:s,operation:t?.operation??null}}),it(Ft))}catch(o){return this.loggingService.catch(`Error in mergeLocationMetadataWithData for ${i}:`,o),ue(t)}}handleDataStripping(a){return I(this,arguments,function*({feature:t,data:i,actionType:o,commentId:s}){try{switch(this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: handleDataStripping","color: green;"),t){case"comment":{let c=yield this.commentUtilsService.stripCommentAnnotationData({data:i,actionType:o,commentId:s});return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()})}case"reaction":{let c=this.reactionUtilsService.stripReactionAnnotationData(i);return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()})}case"recorder":{let c=this.serviceBook.get(ci)?.stripRecorderAnnotationData({data:i,actionType:o})??{originalData:i,strippedData:null};return this.filterOriginalDataForVeltDb({feature:t,result:c,providerAvailable:this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()})}default:return{originalData:i,strippedData:null}}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService handleDataStripping:",c),{originalData:i,strippedData:null}}})}filterOriginalDataForVeltDb({feature:t,result:i,providerAvailable:o}){try{return!o||!i||i.originalData===null||i.originalData===void 0?i:le(x({},i),{originalData:this.applyVeltDbFieldFilter(t,i.originalData)})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService filterOriginalDataForVeltDb:",s),i}}applyVeltDbFieldFilter(t,i){switch(t){case"comment":return WV(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return zV(i);case"recorder":return qV(i);default:return i}}formatData({feature:t,data:i,properties:o,offset:s,isRealtimeDb:a}){try{this.loggingService.log("%c[WB] Calling CommonDbUtilsService FUNCTION: formatData","color: green;"),typeof i=="object"&&(i=JSON.parse(JSON.stringify(i)));let c=new Date().getTime()+s;switch(t){case"documentAccessType":return delete i?.users,{docIamConfig:i};case"organizationMetadata":case"documentMetadata":return a?i:{metadata:i};case"documentCommentMetadata":return i;case"cursor":{let l=this.serviceBook.get(vT);return l?l.formatCursorUserData(i):i}case"comment":return this.commentUtilsService.formatCommentData(i);case"area":return this.areaUtilsService.formatAreaData(i);case"arrow":{let l=this.serviceBook.get(IT);return l?l.formatArrowData(i):i}case"liveStateCustom":return this.liveStateUtilsService.formatLiveStateCustomData(i);case"liveStateSingleEditorMode":return this.liveStateUtilsService.formatLiveStateSingleEditorModeData(i);case"multiThread":return this.multiThreadUtilsService.formatMultiThreadData(i);case"reaction":return this.reactionUtilsService.formatReactionData(i);case"recorder":return this.serviceBook.get(ci)?.formatRecorderData(i,c)??i;case"notificationViewsTimestamp":return{views:{[o.user??""]:i}};case"documentUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"documentDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"documentMetadataViews":return a?i:{metadata:i};case"huddleMessage":return this.serviceBook.get(ST)?.formatHuddleMessageData(i)??i;case"locationMetadataViews":return a?i:{metadata:i};case"locationUsersViews":return a?i:{users:{[o.user??""]:{[o.date??""]:i}}};case"locationDayViews":return a?i:{day:{[o.date??""]:{[o.user??""]:i}}};case"locationViews":return a?i:{location:i};case"docNotificationViews":return a?i:{views:i.views};case"userNotificationViews":return a?i:{views:i.views};case"presence":{let l=this.serviceBook.get(yT);return l?l.formatPresenceUserData(i):i}case"selection":return this.selectionUtilsService.formatSelectionData(i);case"tag":return this.tagUtilsService.formatTagData(i);default:return i}}catch(c){return this.loggingService.catch("Error in CommonDbUtilsService formatData:",c),i}}modifyAndSetData(a){return I(this,arguments,function*({feature:t,data:i,subscriber:o,operation:s=null}){try{let c=yield this.modifyData({feature:t,data:i});o.next({data:c,operation:s})}catch(c){this.loggingService.catch("Error in CommonDbUtilsService modifyAndSetData:",c)}})}isDataAlreadyProcessedInLocalCache({feature:t,change:i,cache:o}){try{if(t==="allReactions"||t==="allComments"){if(i.type==="removed")return!Object.keys(o??{}).includes(i.doc.id);if(o?.[i.doc.id]){let s=i.doc.data(),a=o?.[i.doc.id];return s?.lastUpdated===a?.lastUpdated}}return!1}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService isDataAlreadyProcessedInLocalCache:",s),!1}}modifyData(o){return I(this,arguments,function*({feature:t,data:i}){try{return yield this.formatResponse({feature:t,data:i})}catch(s){return this.loggingService.catch("Error in CommonDbUtilsService modifyData:",s),i}})}addMetadata(t,i){try{return t&&typeof t=="object"&&!Array.isArray(t)?le(x({},t),{metadata:t?.metadata??{documentId:i?.documentId,organizationId:i?.organizationId,apiKey:i?.apiKey}}):t}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService addMetadata:",o),t}}setDataInLocal(l){return I(this,arguments,function*({feature:t,data:i,observablesCache:o,eventType:s,id:a,operation:c=null}){try{let d={comment:"allComments",reaction:"allReactions"}[t];if(!d)return null;let f=i?.metadata?.documentId,g=i?.metadata?.veltFolderId;return Object.keys(o).filter(p=>p.includes(d)&&(!f||p.includes(f)||g&&p.includes(g))).forEach(p=>{let _=o[p]?.subject?.getValue()??{};s==="DELETE"?a&&_?.data?.[a]&&(delete _?.data?.[a],o[p]?.subject&&o[p].subject.next({data:_?.data,operation:c})):o[p]?.subject?.next({data:le(x({},_?.data),{[i?.annotationId]:i}),operation:c})}),null}catch(u){return this.loggingService.catch("Error in CommonDbUtilsService setDataInLocal:",u),null}})}handleCommentEncryption(c){return I(this,arguments,function*({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a}){try{return yield this.commentUtilsService.handleCommentEncryption({data:t,firestorePath:i,extraData:o,eventType:s,metadata:a})}catch(l){return this.loggingService.catch("Error in CommonDbUtilsService handleCommentEncryption:",l),t}})}handleReactionEncryption(s){return I(this,arguments,function*({data:t,firestorePath:i,eventType:o}){try{return yield this.reactionUtilsService.handleReactionEncryption({data:t,firestorePath:i,eventType:o})}catch(a){return this.loggingService.catch("Error in CommonDbUtilsService handleReactionEncryption:",a),t}})}rtdbDefaultTransactionCallback(t,i){try{let o=x({},t||{});return Object.entries(i).forEach(([s,a])=>{a==null?delete o[s]:o[s]=a}),o}catch(o){return this.loggingService.catch("Error in CommonDbUtilsService rtdbDefaultTransactionCallback:",o),t}}};e.\u0275fac=function(i){return new(i||e)(w(Xy),w(Kz),w(Ky),w(Yz),w(It),w(zz),w(_e),w(Qz),w(Qy),w(Xz),w(Jz),w(zt),w(zh),w(zo),w(qo),w(ec),w(Zy),w(Yy),w(li),w(Wh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var e3=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{Zr([this.authService.getFirebaseConfig$(),this.configService.getApiKey$(),this.configService.getFirestorePersistentCacheEnabled$()]).pipe(Ct(([s,a])=>!!s&&!!a),Nt(1)).subscribe(([s,a,c])=>{if(s&&a&&s?.firebaseOptions?.storeDbId){try{let d=sessionStorage?.getItem("veltFirestoreLogLevel")||st?.firebaseLogLevel||"silent";YL(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=tc.getFirestoreProdDbName(a,s.firebaseOptions),u=this.configService.getProxyConfig();if(u?.v2DbHost){let d={host:u.v2DbHost,ssl:!0};u.forceLongPolling?d.experimentalForceLongPolling=!0:d.experimentalAutoDetectLongPolling=!0,c&&(d.localCache=bM({tabManager:LM()}));try{this.firestore$.next(Gy(Sr(),d,l))}catch(f){this.loggingService.catch("Firestore proxy: initializeFirestore failed, falling back to existing instance. Proxy settings may not be applied: ",f),this.firestore$.next($h(l))}}else if(c)try{let d=Sr(),f=Gy(d,{localCache:bM({tabManager:LM()})},l);this.firestore$.next(f)}catch{this.firestore$.next($h(l))}else this.firestore$.next($h(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||$h("DocumentIdDb");if(t){let i=Dp(t,"generateDocumentId");return Hh(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(w(Rr),w(Cr),w(_e))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();var jke=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,D){this.activityUtilsService=t,this.authService=i,this.commonDbUtilsService=o,this.coreActionsService=s,this.loggingService=a,this.firestoreService=c,this.databaseService=l,this.configService=u,this.docService=d,this.usersService=f,this.commentAnnotationsResolverService=g,this.reactionAnnotationsResolverService=p,this.recorderAnnotationsResolverService=_,this.notificationResolverService=T,this.serviceBook=D,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(CT).subscribe(b=>{this.activityService=b??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(b=>{if(b){this.db=b;let G=wa(b,".info/serverTimeOffset");this.offsetListener=gv(G,M=>{let U=M.val();this.offset=U})}})),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(b=>{b&&(this.firestore=b)}))}unsubscribeFromObservables(){try{Object.values(this.firestoreSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.values(this.rtdbSubscriptions??{}).forEach(t=>{t?.unsubscribe()}),Object.entries(this.observablesCache??{}).forEach(([t,i])=>{i?.subject?.complete(),i?.subject?.unsubscribe()}),this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={}}catch(t){this.loggingService.catch("Error in unsubscribeFromObservables:",t)}}ngOnDestroy(){this.subscriptions.forEach(t=>t.unsubscribe()),this.offsetListener&&this.offsetListener(),this.unsubscribeFromObservables()}setupOnDisconnect(t,i){return I(this,null,function*(){try{if(this.db){let o=wa(this.db,t);return M2(o).update(i)}return Promise.resolve()}catch(o){return this.loggingService.catch("Error in setupOnDisconnect:",o),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){Zr([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ct(([i,o])=>!!i),Nt(1),Ks(([i,o])=>{t({db:i,firestore:o})})).subscribe({error:i=>{this.loggingService.catch("Error in CommonDbService subscription: ",i)}})}performDatabaseOperation(t,i,o,s,a,c){return I(this,null,function*(){try{if(!i){this.loggingService.warn(`%c[WB] No properties found for ${t}`,"color: red;");return}return this.subscribeToServices(d=>I(this,[d],function*({db:l,firestore:u}){let f;i?.skipFirestore||(f=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}));let g=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:this.shouldUseFirestore()});if(!l){this.loggingService.warn(`%c[WB] No database or firestore found for ${t}`,"color: red;");return}try{let p,_;try{g&&(p=wa(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=Hh(u,`${f}`))}catch{this.loggingService.catch("Error in docRef")}if(!this.authService.getUser())return;yield o({dbRef:p,firestoreRef:_,data:s,firestorePath:f}),c&&c({firestoreAvailable:!!u})}catch(p){this.loggingService.catch(`Error in ${t} operation: `,p),a&&a(p)}}))}catch(l){this.loggingService.catch("Error in performDatabaseOperation:",l)}})}setData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: setData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Iw(u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield vw(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId??o?.targetCommentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.SET_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield kM(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield UM(u.firestoreRef,d)}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in setData for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in setData for ${t}`,u)}})}updateData(l){return I(this,arguments,function*({feature:t,data:i,properties:o,callback:s,errorCallback:a,extraData:c}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: updateData for ${t}`,"color: green;"),this.shouldUseFirestore()&&i?.metadata&&!i?.metadata?.apiKey?void 0:(this.commonDbUtilsService.setDataInLocal({feature:t,data:i,observablesCache:this.observablesCache,operation:null}),this.createActivityFromExtraData(t,c),this.performDatabaseOperation(t,o,u=>I(this,null,function*(){if(u.dbRef&&!o?.skipRtdb){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset(),isRealtimeDb:!0});o?.rtdbTransaction?yield Iw(u.dbRef,f=>{let g;return o?.rtdbTransactionCallback?g=o.rtdbTransactionCallback(f,d):g=this.commonDbUtilsService.rtdbDefaultTransactionCallback(f,d),JSON.parse(JSON.stringify(g))}):yield F2(u.dbRef,JSON.parse(JSON.stringify(d)))}try{if(u.firestoreRef&&u.data&&!o?.skipFirestore){let d=this.commonDbUtilsService.formatData({feature:t,data:u.data,properties:o,offset:this.getOffset()});typeof d=="object"&&(d=JSON.parse(JSON.stringify(d)));let{strippedData:f,originalData:g,eventType:p}=yield this.commonDbUtilsService.handleDataStripping({feature:t,data:d,actionType:c?.actionType,commentId:c?.targetAnnotationData?.commentId});if(t==="comment"){let _=null,T=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Et.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g,eventType:p,commentId:c?.targetAnnotationData?.commentId}}),f&&(_=yield this.commentAnnotationsResolverService.saveCommentAnnotation({commentAnnotation:f,eventType:p,commentId:c?.targetAnnotationData?.commentId},T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({data:g,firestorePath:u.firestorePath??"",extraData:c,metadata:o?.metadata}))}else if(t==="reaction"){let _=null,T=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.reactionAnnotationsResolverService.saveReactionAnnotation(f,T)),g&&(_?.isSuccess||_===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({data:g,firestorePath:u.firestorePath??""}))}else if(t==="recorder"){let _=null,T=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.UPDATE_DATA,source:"internal",payload:{strippedData:f,originalData:g}}),f&&(_=yield this.recorderAnnotationsResolverService.saveRecorderAnnotation({recorderAnnotation:f,eventType:p},T)),g&&(_?.isSuccess||_===null)&&this.firestore&&(yield kM(this.firestore,D=>I(this,null,function*(){D.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield UM(u.firestoreRef,d,{merge:!0})}}catch(d){this.authService.getUser()&&this.loggingService.catch(`Error in updateDoc for ${t}`,d)}}),i,a,s))}catch(u){this.loggingService.catch(`Error in updateData for ${t}`,u)}})}createActivityFromExtraData(t,i){try{if(!i?.actionType||!this.activityService)return;let o=this.activityUtilsService.buildActivityDataFromExtraData({feature:t,extraData:i});o&&this.activityService.createActivity(o)}catch(o){this.loggingService.catch("Error in CommonDbService createActivityFromExtraData:",o)}}deleteData(c){return I(this,arguments,function*({feature:t,properties:i,callback:o,errorCallback:s,extraData:a}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: deleteData for ${t}`,"color: green;"),this.commonDbUtilsService.setDataInLocal({feature:t,observablesCache:this.observablesCache,eventType:"DELETE",id:i?.id,operation:{type:"removed",ids:[i?.id]}}),this.createActivityFromExtraData(t,a),this.performDatabaseOperation(t,i,l=>I(this,null,function*(){l.dbRef&&(yield x2(l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=J();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Et.DELETE_DATA,source:"internal",payload:{commentAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.commentAnnotationsResolverService.deleteCommentAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleCommentEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE",metadata:i?.metadata}))}else if(t==="reaction"){let u=null,d=J();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.DELETE_DATA,source:"internal",payload:{reactionAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.reactionAnnotationsResolverService.deleteReactionAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield this.commonDbUtilsService.handleReactionEncryption({firestorePath:l.firestorePath??"",eventType:"DELETE"}))}else if(t==="recorder"){let u=null,d=J();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.DELETE_DATA,source:"internal",payload:{recorderAnnotationId:i?.id??"",metadata:i?.metadata}}),u=yield this.recorderAnnotationsResolverService.deleteRecorderAnnotation(i?.id??"",i?.metadata,d),(u?.isSuccess||u===null)&&(yield Hy(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=J();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Fn.DELETE_DATA,source:"internal",payload:{notificationId:i?.id??"",organizationId:i?.organizationId??""}}),u=yield this.notificationResolverService.deleteNotification(String(i?.id??""),this.docService.getDocumentPaths()?.clientOrganizationId??"",d),(u?.isSuccess||u===null)&&(yield Hy(l.firestoreRef))}else yield Hy(l.firestoreRef)}catch(u){this.authService.getUser()&&this.loggingService.catch(`Error in deleteData for ${t}`,u)}}),void 0,s,o)}catch(l){this.loggingService.catch(`Error in deleteData for ${t}`,l)}})}shouldUseFirestore(){try{return this.authService.getAdvancedQueriesEnabled()}catch(t){return this.loggingService.catch("Error in shouldUseFirestore:",t),!1}}generateDocumentId(){try{let t=this.firestoreService.generateFirestoreDocumentId();return t||(t=J()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),J()||"noDocumentId"}}queryData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();return!t||!i?(this.loggingService.warn("[WB] Missing required parameters in queryData"),[]):s?yield this.handleFirestoreQuery(t,i):yield this.handleRtdbQuery(t,i)}catch(s){return this.loggingService.catch(`Error in queryData for ${t}`,s),[]}})}handleFirestoreQuery(t,i){return I(this,null,function*(){try{if(!this.firestore)return this.loggingService.warn("[WB] Firestore not initialized"),[];let o=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),[];try{let s=Dp(this.firestore,o);i?.useCollectionGroup&&(s=PM(this.firestore,o));let a=i?.firestoreQuery??[],c=FM(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield Uz(c).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,u),null));return l?l.data().count:0}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getCountFromServer for ${t}`,l),0}else try{let l=yield Bz(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,d),null));if(!l)return[];let u=l.docs.map(d=>d.data());try{return yield this.commonDbUtilsService.modifyData({feature:t,data:u})}catch(d){return this.loggingService.catch(`Error in modifyData for ${t}`,d),u}}catch(l){return this.authService.getUser()&&this.loggingService.catch(`Error in getDocs for ${t}`,l),[]}}catch(s){return this.loggingService.catch(`Error in Firestore query for ${t}:`,s),[]}}catch(o){return this.loggingService.catch(`Error in Firestore query for ${t}:`,o),[]}})}handleRtdbQuery(t,i){return I(this,null,function*(){if(!this.db)return this.loggingService.warn("[WB] Realtime Database not initialized"),[];let o=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!o)return this.loggingService.warn(`[WB] No database path found for ${t}`),[];try{let s=wa(this.db,o),a=i?.rtdbQuery??[],c=Tw(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield Ew(c).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),null));if(!l)return[];let u=l.val();return u?i?.skipObjectValues?u:Object.values(u??{}):[]}catch(s){return this.loggingService.catch(`Error in RTDB query for ${t}:`,s),[]}})}getData(o){return I(this,arguments,function*({feature:t,properties:i}){try{let s=this.shouldUseFirestore();if(i?.skipFirestore&&(s=!1),!t||!i)return this.loggingService.warn("[WB] Missing required parameters in getData"),{};if(s&&this.firestore){let a=this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No firestore path found for ${t}`),{};try{if(!this.authService.getUser())return this.loggingService.catch("User not set. [source: getData]",void 0,void 0,!0),{};let c=yield Vz(Hh(this.firestore,a)).catch(u=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let l=c.data();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching Firestore data for ${t}:`,c),{}}}if(this.db){let a=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!a)return this.loggingService.warn(`[WB] No database path found for ${t}`),{};try{if(!this.authService.getUser())return{};let c=yield Ew(wa(this.db,a)).catch(u=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,u),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:u})));if(c){if(c?.errorCode)return c}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let l=c.val();return i?.field?l?.[i.field]??{}:l??{}}catch(c){return this.loggingService.catch(`Error fetching RTDB data for ${t}:`,c),{}}}return this.loggingService.warn("[WB] No database connection available"),{}}catch(s){return this.loggingService.catch("Unexpected error in getData:",s),{}}})}dbListener({feature:t,properties:i}){let o=this.shouldUseFirestore();i?.skipFirestore&&(o=!1);let s=`${t}-${JSON.stringify(i)}`;return Zr([this.databaseService.getDb(),this.firestoreService.getFirestore(),this.authService.getUser$().pipe(Ct(a=>!!a))]).pipe(Ct(([a,c])=>a?o&&!c?(this.loggingService.warn(`[WB] Firestore requested but not available for ${t}`),!1):!0:(this.loggingService.warn(`[WB] No database found for ${t}`),!1)),mt(([a,c])=>{try{if(o&&c){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleFirestoreListener(t,i,c).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.firestoreSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.firestoreSubscriptions[s]?.unsubscribe(),delete this.firestoreSubscriptions[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache[s]))}})}else if(a){if(!!!this.observablesCache[s]){this.observablesCache[s]={subject:new Y({}),count:0};let d=this.handleRealtimeDbListener(t,i,a).subscribe(f=>{this.observablesCache[s]?.subject?.next(f)},f=>this.observablesCache[s]?.subject?.error(f));this.rtdbSubscriptions[s]=d}return new ge(u=>{let d=this.observablesCache[s]?.subject?.subscribe(f=>u.next(f),f=>u.error(f),()=>u.complete());return this.observablesCache[s].count+=1,()=>{d?.unsubscribe(),this.observablesCache[s]&&(this.observablesCache[s].count-=1,this.observablesCache[s].count<=0&&(this.rtdbSubscriptions[s]?.unsubscribe(),delete this.rtdbSubscriptions?.[s],this.observablesCache[s]?.subject?.complete(),delete this.observablesCache?.[s]))}})}return ue({})}catch(l){return this.loggingService.catch(`Error setting up listener for ${t}:`,l),ue({})}}),Sc(()=>{this.loggingService.log(`[WB] Cleaning up listener for ${t} and key ${s}`)}))}handleFirestoreListener(t,i,o){let s=i?.useCollectionGroup?this.commonDbUtilsService.getFirestoreCollectionGroupPath(t):this.commonDbUtilsService.getFirestorePath({feature:t,properties:i,documentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()}),a=`${t}-${JSON.stringify(i)}`;return s?new ge(c=>{let l=i.isCollection?this.setupCollectionListener(o,s,t,c,i):this.setupDocumentListener(o,s,t,c,i);return()=>{c.complete(),c.unsubscribe(),l(),this.observablesCache[a]?.subject?.complete(),this.observablesCache[a]?.subject?.unsubscribe(),delete this.observablesCache[a]}}).pipe(mt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),mt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):ue(c)),mt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):ue(c)),it(Ft)):(this.loggingService.warn(`[WB] No firestore path found for ${t} and key ${a}`),ue({}))}setupCollectionListener(t,i,o,s,a){let c=`${o}-${JSON.stringify(a)}`,l=Dp(t,i);if(a?.useCollectionGroup&&(l=PM(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=FM(l,...f)}let u=!0,d=[];return o==="allComments"&&this.loggingService.logContext("[CONTEXT] setupCollectionListener called with path:",i,"feature:",o,"properties:",JSON.stringify(a??"nil")),xM(l,f=>{try{let g=JSON.parse(JSON.stringify(this.observablesCache[c]?.subject?.getValue()?.data??{})),p=null,_=!1;f?.docChanges()?.length?f.docChanges().forEach(T=>{["allComments","allReactions","allRecorders"].includes(o)&&!u&&T.type!=="removed"&&d.push(T.doc.id),this.commonDbUtilsService.isDataAlreadyProcessedInLocalCache({feature:o,change:T,cache:this.observablesCache[c]?.subject?.getValue()?.data??{}})||(_=!0,Object.assign(g,this.handleCollectionChange(T,g)),T.type==="removed"&&(p||(p={type:T.type,ids:[]}),p.ids.push(T.doc.id)))}):_=!0,_&&(["allComments","allReactions","allRecorders"].includes(o)&&d?.length&&(this.commonDbUtilsService.resolveAnnotations({data:d,feature:o}),d=[]),this.commonDbUtilsService.modifyAndSetData({feature:o,data:g,subscriber:s,operation:p})),u=!1}catch(g){this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,g),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(g,o,s)}},f=>{this.loggingService.logContext(`[ERROR] Firestore listener error for feature ${o}:`,f),this.loggingService.logContext(`[ERROR] Firestore listener error for properties ${JSON.stringify(a??"nil")}:`),this.loggingService.logContext(`[ERROR] Firestore listener error for user ${JSON.stringify(this.authService.getUser()??"nil")}:`),this.handleListenerError(f,o,s)})}handleCollectionChange(t,i){switch(t.type){case"added":case"modified":i[t.doc.id]=t.doc.data();break;case"removed":delete i?.[t.doc.id];break}return i}setupDocumentListener(t,i,o,s,a){let c=Hh(t,i);return xM(c,l=>{try{let u=l.data()||{};a?.field&&(u=u?.[a?.field]??{}),this.commonDbUtilsService.modifyAndSetData({feature:o,data:u,subscriber:s,operation:null})}catch(u){this.handleListenerError(u,o,s)}},l=>this.handleListenerError(l,o,s))}handleListenerError(t,i,o){this.loggingService.catch(`Firestore listener error for ${i}:`,t)}handleRealtimeDbListener(t,i,o){let s=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey()});if(!s)return this.loggingService.warn(`[WB] No database path found for ${t}`),ue({});let a=wa(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=Tw(a,...c)}return this.objectValFromChildEvents(a,t).pipe(ts(c=>(this.loggingService.catch(`RTDB listener error for ${t}:`,c),ue({}))),fe(c=>(c===null&&(c={}),c&&typeof c=="object"?Object.entries(c??{}).reduce((u,[d,f])=>(u[d]=this.commonDbUtilsService.addMetadata(f,i),u),{}):this.commonDbUtilsService.addMetadata(c,i))),mt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),mt(c=>this.usersService.getUserById$().pipe(fe(()=>({data:this.commonDbUtilsService.mergeUsersWithData({feature:t,data:c}),operation:null})))))}pushData(s){return I(this,arguments,function*({feature:t,properties:i,data:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: pushData for ${t}`,"color: green;"),this.performDatabaseOperation(t,i,a=>I(this,null,function*(){if(a.dbRef){let c=P2(a.dbRef);yield vw(c,JSON.parse(JSON.stringify(a.data)))}}),o)}catch(a){this.loggingService.catch(`Error in pushData for ${t}`,a)}})}streamChildAdded({feature:t,properties:i,afterTs:o}){try{return this.loggingService.log(`%c[WB] Calling FUNCTION: streamChildAdded for ${t}`,"color: green;"),new ge(s=>{let a=null,c=!1,l=({db:u})=>{if(!u||c||!this.authService.getUser())return;let d=this.commonDbUtilsService.getDocumentPath({feature:t,properties:i,defaultDocumentPaths:this.docService.getDocumentPaths(),apiKey:i.apiKey??this.configService.getApiKey(),useFirestore:!1});if(!d)return;let g=wa(u,d),p=!1,_=b=>{try{let G=b.val();if(p){if(o!=null&&G?.timestamp!=null&&G.timestamp<=o)return;s.next(G)}}catch(G){this.loggingService.catch(`streamChildAdded onChildAdded callback error for ${t}:`,G)}},T=b=>{try{this.loggingService.catch(`streamChildAdded error for ${t}:`,b),s.error(b)}catch(G){this.loggingService.catch(`streamChildAdded onError handler error for ${t}:`,G)}};_w(g,_,T);let D=gv(g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{D&&typeof D=="function"&&D(),Am(g,"child_added",_)}catch(b){this.loggingService.catch(`streamChildAdded cleanup error for ${t}:`,b)}}};return this.subscribeToServices(l),()=>{c=!0,a&&a()}})}catch(s){return this.loggingService.catch(`Error in streamChildAdded for ${t}`,s),ue(null)}}objectValFromChildEvents(t,i){return new ge(o=>{let s={},a=!1,c=null,l=T=>{try{this.loggingService.catch(`Realtime DB listener error for ${i}:`,T),o.error(T)}catch{}},u=T=>{try{if(!ki(T,c)){let D=JSON.parse(JSON.stringify(T));c=D,o.next(D)}}catch{}},d=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(x({},s)))}catch{}},f=T=>{try{T.key&&(s[T.key]=T.val(),a&&u(x({},s)))}catch{}},g=T=>{try{T.key&&(delete s[T.key],a&&u(x({},s)))}catch{}},p=T=>{try{if(!a){let D=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=D,o.next(D),a=!0}}catch{}};_w(t,d,l),b2(t,f,l),L2(t,g,l);let _=gv(t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),Am(t,"child_added",d),Am(t,"child_changed",f),Am(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(w(Xy),w(Cr),w(Zz),w(It),w(_e),w(e3),w(Wy),w(Rr),w(zh),w(zt),w(zo),w(qo),w(ec),w(Zy),w(li))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();export{x as a,le as b,dS as c,pse as d,Ese as e,_se as f,I as g,gt as h,ge as i,RS as j,Ot as k,Y as l,Ac as m,l6 as n,u6 as o,Ic as p,xr as q,ue as r,d6 as s,h6 as t,Q3 as u,fe as v,Zr as w,GS as x,f6 as y,ho as z,I6 as A,Ci as B,H3 as C,Pu as D,Ct as E,P3 as F,ts as G,yS as H,Au as I,Nt as J,DS as K,it as L,Du as M,dE as N,NS as O,W3 as P,OS as Q,z3 as R,Ru as S,mt as T,qs as U,q3 as V,Ks as W,K3 as X,J3 as Y,oe as Z,ME as _,K as $,is as aa,Z as ba,w as ca,ne as da,pr as ea,Kn as fa,fo as ga,w0 as ha,b0 as ia,$0 as ja,j0 as ka,St as la,Dn as ma,cr as na,Fr as oa,To as pa,jc as qa,ei as ra,J6 as sa,pn as ta,VD as ua,E4 as va,sa as wa,g_ as xa,w_ as ya,D4 as za,iq as Aa,oq as Ba,sq as Ca,aq as Da,cq as Ea,Dq as Fa,cs as Ga,Le as Ha,Mq as Ia,y8 as Ja,S8 as Ka,yo as La,Yf as Ma,ds as Na,j_ as Oa,ut as Pa,M8 as Qa,Do as Ra,Kc as Sa,Tk as Ta,I5 as Ua,aa as Va,Ro as Wa,Xf as Xa,Dk as Ya,w5 as Za,Nk as _a,Ok as $a,z_ as ab,ca as bb,xk as cb,Fk as db,k5 as eb,V5 as fb,B5 as gb,G5 as hb,$5 as ib,j5 as jb,H5 as kb,kk as lb,AR as mb,DR as nb,Uk as ob,RR as pb,CR as qb,Vk as rb,NR as sb,OR as tb,Gk as ub,Q5 as vb,$k as wb,Hk as xb,Wk as yb,t9 as zb,r9 as Ab,i9 as Bb,s9 as Cb,a9 as Db,c9 as Eb,l9 as Fb,u9 as Gb,d9 as Hb,h9 as Ib,Xk as Jb,Jk as Kb,D9 as Lb,C9 as Mb,k9 as Nb,aU as Ob,wR as Pb,cU as Qb,lU as Rb,uU as Sb,G9 as Tb,dU as Ub,fU as Vb,$9 as Wb,j9 as Xb,H9 as Yb,W9 as Zb,Q9 as _b,X9 as $b,J9 as ac,Z9 as bc,eK as cc,tK as dc,nK as ec,rK as fc,iK as gc,oK as hc,sK as ic,aK as jc,lK as kc,dK as lc,hK as mc,fK as nc,gK as oc,mK as pc,_K as qc,rg as rc,ig as sc,xR as tc,qve as uc,Kve as vc,Yve as wc,KK as xc,qR as yc,Qve as zc,Xve as Ac,Jve as Bc,Co as Cc,HU as Dc,fY as Ec,a1 as Fc,gY as Gc,eC as Hc,mY as Ic,pY as Jc,EY as Kc,_Y as Lc,IY as Mc,yY as Nc,AY as Oc,tC as Pc,uC as Qc,GY as Rc,HY as Sc,O1 as Tc,g7 as Uc,m7 as Vc,pC as Wc,G1 as Xc,IC as Yc,Nd as Zc,Hr as _c,ha as $c,KT as ad,sl as bd,vr as cd,Ge as dd,_n as ed,ur as fd,Po as gd,yr as hd,pa as id,Sr as jd,Qe as kd,IX as ld,pbe as md,Ebe as nd,_be as od,Bi as pd,Ea as qd,vs as rd,Gi as sd,pe as td,$i as ud,ys as vd,Fbe as wd,kbe as xd,Ube as yd,Ta as zd,jJ as Ad,WJ as Bd,iZ as Cd,hl as Dd,fl as Ed,IMe as Fd,bd as Gd,EI as Hd,vMe as Id,g2 as Jd,dv as Kd,GPe as Ld,$Pe as Md,jPe as Nd,HPe as Od,WPe as Pd,zPe as Qd,qPe as Rd,M2 as Sd,gv as Td,KPe as Ud,P2 as Vd,wa as Wd,x2 as Xd,Iw as Yd,vw as Zd,YPe as _d,F2 as $d,dr as ae,VMe as be,BMe as ce,GMe as de,Dr as ee,H1 as fe,U7 as ge,Sg as he,st as ie,L as je,Ie as ke,Qt as le,pAe as me,EAe as ne,_Ae as oe,TAe as pe,$ as qe,IAe as re,vAe as se,yAe as te,SAe as ue,_7 as ve,T7 as we,I7 as xe,v7 as ye,_T as ze,y7 as Ae,S7 as Be,A7 as Ce,EC as De,D7 as Ee,$r as Fe,TT as Ge,R7 as He,md as Ie,wt as Je,C7 as Ke,Tg as Le,N7 as Me,O7 as Ne,w7 as Oe,b7 as Pe,L7 as Qe,M7 as Re,P7 as Se,v as Te,U1 as Ue,tDe as Ve,_d as We,H as Xe,oDe as Ye,sDe as Ze,ui as _e,bt as $e,W1 as af,z1 as bf,xDe as cf,FDe as df,bT as ef,vC as ff,LT as gf,xn as hf,tl as if,No as jf,Y1 as kf,Q1 as lf,X1 as mf,_s as nf,V7 as of,Un as pf,di as qf,J1 as rf,Z1 as sf,eV as tf,tV as uf,nV as vf,rV as wf,iV as xf,oV as yf,sV as zf,aV as Af,cV as Bf,B7 as Cf,G7 as Df,lV as Ef,AC as Ff,uV as Gf,dV as Hf,fV as If,$7 as Jf,Oo as Kf,j7 as Lf,H7 as Mf,vOe as Nf,OV as Of,Tr as Pf,Fi as Qf,da as Rf,Ts as Sf,wo as Tf,LOe as Uf,MOe as Vf,POe as Wf,xOe as Xf,FOe as Yf,kOe as Zf,UOe as _f,bV as $f,J as ag,VOe as bg,LV as cg,Sd as dg,SV as eg,AV as fg,z7 as gg,q7 as hg,il as ig,NC as jg,BOe as kg,bo as lg,GOe as mg,Rg as ng,ki as og,$Oe as pg,OC as qg,rl as rg,Q7 as sg,VT as tg,jOe as ug,HOe as vg,PV as wg,Cg as xg,X7 as yg,J7 as zg,Z7 as Ag,eQ as Bg,tQ as Cg,jr as Dg,WOe as Eg,RC as Fg,zOe as Gg,rQ as Hg,qOe as Ig,KOe as Jg,FV as Kg,YOe as Lg,QOe as Mg,XOe as Ng,JOe as Og,ZOe as Pg,ewe as Qg,twe as Rg,UT as Sg,nwe as Tg,rwe as Ug,iwe as Vg,owe as Wg,swe as Xg,awe as Yg,cwe as Zg,lwe as _g,uwe as $g,dwe as ah,hwe as bh,fwe as ch,gwe as dh,mwe as eh,pwe as fh,Ewe as gh,_we as hh,Twe as ih,Iwe as jh,vwe as kh,ywe as lh,Swe as mh,Awe as nh,Dwe as oh,Rwe as ph,aQ as qh,Cwe as rh,Nwe as sh,Owe as th,RV as uh,wwe as vh,bwe as wh,Ft as xh,Cn as yh,Lwe as zh,kt as Ah,Ht as Bh,Mwe as Ch,$V as Dh,Ad as Eh,bC as Fh,Ir as Gh,Pwe as Hh,CV as Ih,IT as Jh,NAe as Kh,OAe as Lh,xi as Mh,wAe as Nh,vT as Oh,bAe as Ph,LAe as Qh,yT as Rh,MAe as Sh,ST as Th,PAe as Uh,AT as Vh,xAe as Wh,ci as Xh,FAe as Yh,pd as Zh,kAe as _h,UAe as $h,VAe as ai,BAe as bi,GAe as ci,$Ae as di,jAe as ei,DT as fi,HAe as gi,WAe as hi,RT as ii,CT as ji,P1 as ki,x1 as li,F1 as mi,li as ni,Lt as oi,_e as pi,Rr as qi,U2 as ri,It as si,pv as ti,Ev as ui,Cr as vi,MM as wi,Lxe as xi,Mxe as yi,Pxe as zi,xxe as Ai,Ji as Bi,Wy as Ci,zo as Di,qo as Ei,Wh as Fi,ec as Gi,zh as Hi,zt as Ii,Ky as Ji,Yy as Ki,Xy as Li,Jy as Mi,zz as Ni,Zy as Oi,Zz as Pi,jke as Qi};
|