@veltdev/sdk-staging 6.0.0-beta.12 → 6.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/app/models/data/comment-events.data.model.d.ts +10 -0
  2. package/app/utils/enums.d.ts +1 -0
  3. package/{chunk-DAHES7KJ.js → chunk-3H5W2TGU.js} +1 -1
  4. package/{chunk-S4SWAWDX.js → chunk-55YE7G6I.js} +1 -1
  5. package/{chunk-KBKI4VKD.js → chunk-5JIXRA34.js} +1 -1
  6. package/{chunk-HEIW3Q3Z.js → chunk-7MOQQG4Z.js} +1 -1
  7. package/{chunk-NBO7Z72Y.js → chunk-AIQ4EOVH.js} +1 -1
  8. package/{chunk-G4N6XTDS.js → chunk-CZTTDJFW.js} +1 -1
  9. package/{chunk-HZBOX5Z7.js → chunk-DUIGMOMV.js} +1 -1
  10. package/{chunk-IE6GR57U.js → chunk-GHVMD37V.js} +1 -1
  11. package/{chunk-A6QXRF3G.js → chunk-GJ55RHPP.js} +1 -1
  12. package/{chunk-KAYQA4GH.js → chunk-GNMKNWD5.js} +1 -1
  13. package/{chunk-Z54SH2OU.js → chunk-JDZOVFS3.js} +1 -1
  14. package/{chunk-TJFCTUCM.js → chunk-JPM7CIV3.js} +1 -1
  15. package/{chunk-6RA26UDR.js → chunk-JXMMR7DC.js} +1 -1
  16. package/{chunk-2JYR3ESH.js → chunk-MLCIQM44.js} +1 -1
  17. package/{chunk-NVZIS23N.js → chunk-N2SSZ74J.js} +1 -1
  18. package/{chunk-SLIE6W2D.js → chunk-N3AV6IGG.js} +1 -1
  19. package/{chunk-BCSVTVMJ.js → chunk-NFOSJ24G.js} +2 -2
  20. package/{chunk-CECXGS4N.js → chunk-OHH7LESC.js} +1 -1
  21. package/{chunk-6WCUWRDH.js → chunk-OWD3J56P.js} +1 -1
  22. package/{chunk-GW63A52V.js → chunk-P54MO3GU.js} +1 -1
  23. package/{chunk-HRHOJT33.js → chunk-Q2QL77LS.js} +1 -1
  24. package/{chunk-BSYABMZE.js → chunk-SAPJAJDB.js} +1 -1
  25. package/{chunk-UQ2QOHQZ.js → chunk-SG6UCHMH.js} +1 -1
  26. package/{chunk-45CK3G4S.js → chunk-SXYSM6QP.js} +1 -1
  27. package/{chunk-63NMA3AQ.js → chunk-T4D6QD4H.js} +1 -1
  28. package/{chunk-DEGPUOWQ.js → chunk-TVX75U2C.js} +1 -1
  29. package/{chunk-ATB2ZI7G.js → chunk-UF2D32ZI.js} +1 -1
  30. package/{chunk-TNSFEAOB.js → chunk-VMH5N5PO.js} +1 -1
  31. package/{chunk-6ILQARGU.js → chunk-XM2SXO32.js} +1 -1
  32. package/{chunk-WXTTF7HW.js → chunk-XM56PHBZ.js} +1 -1
  33. package/{chunk-ZZK5UGYN.js → chunk-YEQZ76RF.js} +1 -1
  34. package/{chunk-6LUTL3DR.js → chunk-YFZUZKVN.js} +1 -1
  35. package/{chunk-FLGROJQW.js → chunk-Z77RD4H5.js} +1 -1
  36. package/package.json +1 -1
  37. package/velt-activity-log.js +1 -1
  38. package/velt-area.js +1 -1
  39. package/velt-arrow.js +1 -1
  40. package/velt-comment.js +6 -6
  41. package/velt-crdt.js +1 -1
  42. package/velt-cursor.js +1 -1
  43. package/velt-huddle.js +1 -1
  44. package/velt-live-state-sync.js +1 -1
  45. package/velt-notification.js +1 -1
  46. package/velt-presence.js +1 -1
  47. package/velt-reaction.js +1 -1
  48. package/velt-recorder.js +1 -1
  49. package/velt-rewriter.js +1 -1
  50. package/velt-selection.js +1 -1
  51. package/velt-tag.js +1 -1
  52. package/velt-user-invite.js +1 -1
  53. package/velt-user-request.js +1 -1
  54. package/velt-video-player.js +1 -1
  55. package/velt-views.js +1 -1
  56. package/velt.js +2 -2
@@ -2,7 +2,7 @@ var M3=Object.create;var Qp=Object.defineProperty,P3=Object.defineProperties,x3=
2
2
  ${n.map((t,i)=>`${i+1}) ${t.toString()}`).join(`
3
3
  `)}`:"",this.name="UnsubscriptionError",this.errors=n});function vc(r,e){if(r){let n=r.indexOf(e);0<=n&&r.splice(n,1)}}var mt=class r{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:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(let o of n)o.remove(this);else n.remove(this);let{initialTeardown:t}=this;if(Se(t))try{t()}catch(o){e=o instanceof Xp?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{fP(o)}catch(s){e=e??[],s instanceof Xp?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Xp(e)}}add(e){var n;if(e&&e!==this)if(this.closed)fP(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}}_hasParent(e){let{_parentage:n}=this;return n===e||Array.isArray(n)&&n.includes(e)}_addParent(e){let{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e}_removeParent(e){let{_parentage:n}=this;n===e?this._parentage=null:Array.isArray(n)&&vc(n,e)}remove(e){let{_finalizers:n}=this;n&&vc(n,e),e instanceof r&&e._removeParent(this)}};mt.EMPTY=(()=>{let r=new mt;return r.closed=!0,r})();var IS=mt.EMPTY;function Jp(r){return r instanceof mt||r&&"closed"in r&&Se(r.remove)&&Se(r.add)&&Se(r.unsubscribe)}function fP(r){Se(r)?r():r.unsubscribe()}var Ri={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Au={setTimeout(r,e,...n){let{delegate:t}=Au;return t?.setTimeout?t.setTimeout(r,e,...n):setTimeout(r,e,...n)},clearTimeout(r){let{delegate:e}=Au;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function Zp(r){Au.setTimeout(()=>{let{onUnhandledError:e}=Ri;if(e)e(r);else throw r})}function Di(){}var gP=vS("C",void 0,void 0);function mP(r){return vS("E",void 0,r)}function pP(r){return vS("N",r,void 0)}function vS(r,e,n){return{kind:r,value:e,error:n}}var yc=null;function Ru(r){if(Ri.useDeprecatedSynchronousErrorHandling){let e=!yc;if(e&&(yc={errorThrown:!1,error:null}),r(),e){let{errorThrown:n,error:t}=yc;if(yc=null,n)throw t}}else r()}function EP(r){Ri.useDeprecatedSynchronousErrorHandling&&yc&&(yc.errorThrown=!0,yc.error=r)}var Sc=class extends mt{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Jp(e)&&e.add(this)):this.destination=$3}static create(e,n,t){return new Ci(e,n,t)}next(e){this.isStopped?SS(pP(e),this):this._next(e)}error(e){this.isStopped?SS(mP(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?SS(gP,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()}}},B3=Function.prototype.bind;function yS(r,e){return B3.call(r,e)}var AS=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:n}=this;if(n.next)try{n.next(e)}catch(t){eE(t)}}error(e){let{partialObserver:n}=this;if(n.error)try{n.error(e)}catch(t){eE(t)}else eE(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(n){eE(n)}}},Ci=class extends Sc{constructor(e,n,t){super();let i;if(Se(e)||!e)i={next:e??void 0,error:n??void 0,complete:t??void 0};else{let o;this&&Ri.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&yS(e.next,o),error:e.error&&yS(e.error,o),complete:e.complete&&yS(e.complete,o)}):i=e}this.destination=new AS(i)}};function eE(r){Ri.useDeprecatedSynchronousErrorHandling?EP(r):Zp(r)}function G3(r){throw r}function SS(r,e){let{onStoppedNotification:n}=Ri;n&&Au.setTimeout(()=>n(r,e))}var $3={closed:!0,next:Di,error:G3,complete:Di};function _e(r,e,n,t,i){return new RS(r,e,n,t,i)}var RS=class extends Sc{constructor(e,n,t,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=n?function(a){try{n(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:n}=this;super.unsubscribe(),!n&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function Ct(r,e){return ve((n,t)=>{let i=0;n.subscribe(_e(t,o=>r.call(e,o,i++)&&t.next(o)))})}var Du=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Ni(r){return r}function _P(r){return r.length===0?Ni:r.length===1?r[0]:function(n){return r.reduce((t,i)=>i(t),n)}}var me=(()=>{class r{constructor(n){n&&(this._subscribe=n)}lift(n){let t=new r;return t.source=this,t.operator=n,t}subscribe(n,t,i){let o=H3(n)?n:new Ci(n,t,i);return Ru(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(n){try{return this._subscribe(n)}catch(t){n.error(t)}}forEach(n,t){return t=TP(t),new t((i,o)=>{let s=new Ci({next:a=>{try{n(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(n){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(n)}[Du](){return this}pipe(...n){return _P(n)(this)}toPromise(n){return n=TP(n),new n((t,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>t(o))})}}return r.create=e=>new r(e),r})();function TP(r){var e;return(e=r??Ri.Promise)!==null&&e!==void 0?e:Promise}function j3(r){return r&&Se(r.next)&&Se(r.error)&&Se(r.complete)}function H3(r){return r&&r instanceof Sc||j3(r)&&Jp(r)}var Ac=new me(r=>r.complete());function Nt(r){return r<=0?()=>Ac:ve((e,n)=>{let t=0;e.subscribe(_e(n,i=>{++t<=r&&(n.next(i),r<=t&&n.complete())}))})}function DS(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,t=Object.getOwnPropertySymbols(r);i<t.length;i++)e.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(r,t[i])&&(n[t[i]]=r[t[i]]);return n}function vP(r,e,n,t){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=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(r,e||[])).next())})}function IP(r){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&r[e],t=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&t>=r.length&&(r=void 0),{value:r&&r[t++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rc(r){return this instanceof Rc?(this.v=r,this):new Rc(r)}function yP(r,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n.apply(r,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,R){o.push([g,_,T,R])>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 Rc?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 SP(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],n;return e?e.call(r):(r=typeof IP=="function"?IP(r):r[Symbol.iterator](),n={},t("next"),t("throw"),t("return"),n[Symbol.asyncIterator]=function(){return this},n);function t(o){n[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[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 Cu=r=>r&&typeof r.length=="number"&&typeof r!="function";function tE(r){return Se(r?.then)}function nE(r){return Se(r[Du])}function rE(r){return Symbol.asyncIterator&&Se(r?.[Symbol.asyncIterator])}function iE(r){return new TypeError(`You provided ${r!==null&&typeof r=="object"?"an invalid object":`'${r}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function W3(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var oE=W3();function sE(r){return Se(r?.[oE])}function aE(r){return yP(this,arguments,function*(){let n=r.getReader();try{for(;;){let{value:t,done:i}=yield Rc(n.read());if(i)return yield Rc(void 0);yield yield Rc(t)}}finally{n.releaseLock()}})}function cE(r){return Se(r?.getReader)}function Pe(r){if(r instanceof me)return r;if(r!=null){if(nE(r))return z3(r);if(Cu(r))return q3(r);if(tE(r))return K3(r);if(rE(r))return AP(r);if(sE(r))return Y3(r);if(cE(r))return Q3(r)}throw iE(r)}function z3(r){return new me(e=>{let n=r[Du]();if(Se(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function q3(r){return new me(e=>{for(let n=0;n<r.length&&!e.closed;n++)e.next(r[n]);e.complete()})}function K3(r){return new me(e=>{r.then(n=>{e.closed||(e.next(n),e.complete())},n=>e.error(n)).then(null,Zp)})}function Y3(r){return new me(e=>{for(let n of r)if(e.next(n),e.closed)return;e.complete()})}function AP(r){return new me(e=>{X3(r,e).catch(n=>e.error(n))})}function Q3(r){return AP(aE(r))}function X3(r,e){var n,t,i,o;return vP(this,void 0,void 0,function*(){try{for(n=SP(r);t=yield n.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=n.return)&&(yield o.call(n))}finally{if(i)throw i.error}}e.complete()})}function RP(r){return ve((e,n)=>{let t=!1,i=null,o=null,s=!1,a=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let l=i;i=null,n.next(l)}s&&n.complete()},c=()=>{o=null,s&&n.complete()};e.subscribe(_e(n,l=>{t=!0,i=l,o||Pe(r(l)).subscribe(o=_e(n,a,c))},()=>{s=!0,(!t||!o||o.closed)&&n.complete()}))})}var lE=class extends mt{constructor(e,n){super()}schedule(e,n=0){return this}};var Rf={setInterval(r,e,...n){let{delegate:t}=Rf;return t?.setInterval?t.setInterval(r,e,...n):setInterval(r,e,...n)},clearInterval(r){let{delegate:e}=Rf;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var co=class extends lE{constructor(e,n){super(e,n),this.scheduler=e,this.work=n,this.pending=!1}schedule(e,n=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,n)),this.pending=!0,this.delay=n,this.id=(t=this.id)!==null&&t!==void 0?t:this.requestAsyncId(o,this.id,n),this}requestAsyncId(e,n,t=0){return Rf.setInterval(e.flush.bind(e,this),t)}recycleAsyncId(e,n,t=0){if(t!=null&&this.delay===t&&this.pending===!1)return n;n!=null&&Rf.clearInterval(n)}execute(e,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let t=this._execute(e,n);if(t)return t;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,n){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:n}=this,{actions:t}=n;this.work=this.state=this.scheduler=null,this.pending=!1,vc(t,this),e!=null&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,super.unsubscribe()}}};var Dc={now(){return(Dc.delegate||Date).now()},delegate:void 0};var Nu=class r{constructor(e,n=r.now){this.schedulerActionCtor=e,this.now=n}schedule(e,n=0,t){return new this.schedulerActionCtor(this,e).schedule(t,n)}};Nu.now=Dc.now;var lo=class extends Nu{constructor(e,n=Nu.now){super(e,n),this.actions=[],this._active=!1}flush(e){let{actions:n}=this;if(this._active){n.push(e);return}let t;this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,t){for(;e=n.shift();)e.unsubscribe();throw t}}};var Hn=new lo(co),CS=Hn;function uE(r){return r&&Se(r.schedule)}function dE(r){return r instanceof Date&&!isNaN(r)}function Oi(r=0,e,n=CS){let t=-1;return e!=null&&(uE(e)?n=e:t=e),new me(i=>{let o=dE(r)?+r-n.now():r;o<0&&(o=0);let s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=t?this.schedule(void 0,t):i.complete())},o)})}function J3(r,e=Hn){return RP(()=>Oi(r,e))}function NS(r){return r[r.length-1]}function hE(r){return Se(NS(r))?r.pop():void 0}function uo(r){return uE(NS(r))?r.pop():void 0}function DP(r,e){return typeof NS(r)=="number"?r.pop():e}function Wn(r,e,n,t=0,i=!1){let o=e.schedule(function(){n(),i?r.add(this.schedule(null,t)):this.unsubscribe()},t);if(r.add(o),!i)return o}function rs(r){return ve((e,n)=>{let t=null,i=!1,o;t=e.subscribe(_e(n,void 0,void 0,s=>{o=Pe(r(s,rs(r)(e))),t?(t.unsubscribe(),t=null,o.subscribe(n)):i=!0})),i&&(t.unsubscribe(),t=null,o.subscribe(n))})}var{isArray:Z3}=Array,{getPrototypeOf:e6,prototype:t6,keys:n6}=Object;function fE(r){if(r.length===1){let e=r[0];if(Z3(e))return{args:e,keys:null};if(r6(e)){let n=n6(e);return{args:n.map(t=>e[t]),keys:n}}}return{args:r,keys:null}}function r6(r){return r&&typeof r=="object"&&e6(r)===t6}function Ks(r,e=0){return ve((n,t)=>{n.subscribe(_e(t,i=>Wn(t,r,()=>t.next(i),e),()=>Wn(t,r,()=>t.complete(),e),i=>Wn(t,r,()=>t.error(i),e)))})}function Ys(r,e=0){return ve((n,t)=>{t.add(r.schedule(()=>n.subscribe(t),e))})}function CP(r,e){return Pe(r).pipe(Ys(e),Ks(e))}function NP(r,e){return Pe(r).pipe(Ys(e),Ks(e))}function OP(r,e){return new me(n=>{let t=0;return e.schedule(function(){t===r.length?n.complete():(n.next(r[t++]),n.closed||this.schedule())})})}function wP(r,e){return new me(n=>{let t;return Wn(n,e,()=>{t=r[oE](),Wn(n,e,()=>{let i,o;try{({value:i,done:o}=t.next())}catch(s){n.error(s);return}o?n.complete():n.next(i)},0,!0)}),()=>Se(t?.return)&&t.return()})}function gE(r,e){if(!r)throw new Error("Iterable cannot be null");return new me(n=>{Wn(n,e,()=>{let t=r[Symbol.asyncIterator]();Wn(n,e,()=>{t.next().then(i=>{i.done?n.complete():n.next(i.value)})},0,!0)})})}function bP(r,e){return gE(aE(r),e)}function LP(r,e){if(r!=null){if(nE(r))return CP(r,e);if(Cu(r))return OP(r,e);if(tE(r))return NP(r,e);if(rE(r))return gE(r,e);if(sE(r))return wP(r,e);if(cE(r))return bP(r,e)}throw iE(r)}function Fr(r,e){return e?LP(r,e):Pe(r)}function fe(r,e){return ve((n,t)=>{let i=0;n.subscribe(_e(t,o=>{t.next(r.call(e,o,i++))}))})}var{isArray:i6}=Array;function o6(r,e){return i6(e)?r(...e):r(e)}function Ou(r){return fe(e=>o6(r,e))}function mE(r,e){return r.reduce((n,t,i)=>(n[t]=e[i],n),{})}function ti(...r){let e=uo(r),n=hE(r),{args:t,keys:i}=fE(r);if(t.length===0)return Fr([],e);let o=new me(s6(t,e,i?s=>mE(i,s):Ni));return n?o.pipe(Ou(n)):o}function s6(r,e,n=Ni){return t=>{MP(e,()=>{let{length:i}=r,o=new Array(i),s=i,a=i;for(let c=0;c<i;c++)MP(e,()=>{let l=Fr(r[c],e),u=!1;l.subscribe(_e(t,d=>{o[c]=d,u||(u=!0,a--),a||t.next(n(o.slice()))},()=>{--s||t.complete()}))},t)},t)}}function MP(r,e,n){r?Wn(n,r,e):e()}function PP(r,e,n,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;Pe(n(_,u++)).subscribe(_e(e,R=>{i?.(R),o?g(R):e.next(R)},()=>{T=!0},void 0,()=>{if(T)try{for(l--;c.length&&l<t;){let R=c.shift();s?Wn(e,s,()=>p(R)):p(R)}f()}catch(R){e.error(R)}}))};return r.subscribe(_e(e,g,()=>{d=!0,f()})),()=>{a?.()}}function ho(r,e,n=1/0){return Se(e)?ho((t,i)=>fe((o,s)=>e(t,o,i,s))(Pe(r(t,i))),n):(typeof e=="number"&&(n=e),ve((t,i)=>PP(t,i,r,n)))}function xP(r,e,n,t,i){return(o,s)=>{let a=n,c=e,l=0;o.subscribe(_e(s,u=>{let d=l++;c=a?r(c,u,d):(a=!0,u),t&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}function pE(r=1/0){return ho(Ni,r)}function FP(){return pE(1)}function OS(r,e){return Se(e)?ho(r,e,1):ho(r,1)}var kP=qs(r=>function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Ot=(()=>{class r extends me{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(n){let t=new EE(this,this);return t.operator=n,t}_throwIfClosed(){if(this.closed)throw new kP}next(n){Ru(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let t of this.currentObservers)t.next(n)}})}error(n){Ru(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=n;let{observers:t}=this;for(;t.length;)t.shift().error(n)}})}complete(){Ru(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:n}=this;for(;n.length;)n.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0}_trySubscribe(n){return this._throwIfClosed(),super._trySubscribe(n)}_subscribe(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)}_innerSubscribe(n){let{hasError:t,isStopped:i,observers:o}=this;return t||i?IS:(this.currentObservers=null,o.push(n),new mt(()=>{this.currentObservers=null,vc(o,n)}))}_checkFinalizedStatuses(n){let{hasError:t,thrownError:i,isStopped:o}=this;t?n.error(i):o&&n.complete()}asObservable(){let n=new me;return n.source=this,n}}return r.create=(e,n)=>new EE(e,n),r})(),EE=class extends Ot{constructor(e,n){super(),this.destination=e,this.source=n}next(e){var n,t;(t=(n=this.destination)===null||n===void 0?void 0:n.next)===null||t===void 0||t.call(n,e)}error(e){var n,t;(t=(n=this.destination)===null||n===void 0?void 0:n.error)===null||t===void 0||t.call(n,e)}complete(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)}_subscribe(e){var n,t;return(t=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&t!==void 0?t:IS}};function wS(r){return ve((e,n)=>{let t=!1,i=null,o=null,s=()=>{if(o?.unsubscribe(),o=null,t){t=!1;let a=i;i=null,n.next(a)}};e.subscribe(_e(n,a=>{o?.unsubscribe(),t=!0,i=a,o=_e(n,s,Di),Pe(r(a)).subscribe(o)},()=>{s(),n.complete()},void 0,()=>{i=o=null}))})}function wu(r,e=Hn){return ve((n,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+r,u=e.now();if(u<l){i=this.schedule(void 0,l-u),t.add(i);return}a()}n.subscribe(_e(t,l=>{o=l,s=e.now(),i||(i=e.schedule(c,r),t.add(i))},()=>{a(),t.complete()},void 0,()=>{o=i=null}))})}function Qs(...r){return FP()(Fr(r,uo(r)))}function UP(){return ve((r,e)=>{r.subscribe(_e(e,Di))})}function VP(r){return fe(()=>r)}function bS(r,e){return e?n=>Qs(e.pipe(Nt(1),UP()),n.pipe(bS(r))):ho((n,t)=>Pe(r(n,t)).pipe(Nt(1),VP(n)))}function LS(r,e=Hn){let n=Oi(r,e);return bS(()=>n)}function ue(...r){let e=uo(r);return Fr(r,e)}function st(r,e=Ni){return r=r??a6,ve((n,t)=>{let i,o=!0;n.subscribe(_e(t,s=>{let a=e(s);(o||!r(i,a))&&(o=!1,i=a,t.next(s))}))})}function a6(r,e){return r===e}var BP=qs(r=>function(){r(this),this.name="EmptyError",this.message="no elements in sequence"});function Cc(r){return ve((e,n)=>{try{e.subscribe(n)}finally{n.add(r)}})}function GP(){return ve((r,e)=>{let n=null;r._refCount++;let t=_e(e,void 0,void 0,void 0,()=>{if(!r||r._refCount<=0||0<--r._refCount){n=null;return}let i=r._connection,o=n;n=null,i&&(!o||i===o)&&i.unsubscribe(),e.unsubscribe()});r.subscribe(t),t.closed||(n=r.connect())})}var MS=class extends me{constructor(e,n){super(),this.source=e,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,TS(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 mt;let n=this.getSubject();e.add(this.source.subscribe(_e(n,void 0,()=>{this._teardown(),n.complete()},t=>{this._teardown(),n.error(t)},()=>this._teardown()))),e.closed&&(this._connection=null,e=mt.EMPTY)}return e}refCount(){return GP()(this)}};function bu(){return ve((r,e)=>{let n,t=!1;r.subscribe(_e(e,i=>{let o=n;n=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 n=super._subscribe(e);return!n.closed&&e.next(this._value),n}getValue(){let{hasError:e,thrownError:n,_value:t}=this;if(e)throw n;return this._throwIfClosed(),t}next(e){super.next(this._value=e)}};var Nc=class extends Ot{constructor(e=1/0,n=1/0,t=Dc){super(),this._bufferSize=e,this._windowTime=n,this._timestampProvider=t,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=n===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,n)}next(e){let{isStopped:n,_buffer:t,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;n||(t.push(e),!i&&t.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let n=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),n}_trimBuffer(){let{_bufferSize:e,_timestampProvider:n,_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=n.now(),a=0;for(let c=1;c<t.length&&t[c]<=s;c+=2)a=c;a&&t.splice(0,a+1)}}};function c6(r=0,e=Hn){return r<0&&(r=0),Oi(r,r,e)}function _E(r,e){return ve(xP(r,e,arguments.length>=2,!0))}function xS(r={}){let{connector:e=()=>new Ot,resetOnError:n=!0,resetOnComplete:t=!0,resetOnRefCountZero:i=!0}=r;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 ve((_,T)=>{l++,!d&&!u&&f();let R=c=c??e();T.add(()=>{l--,l===0&&!d&&!u&&(a=PS(p,i))}),R.subscribe(T),!s&&l>0&&(s=new Ci({next:b=>R.next(b),error:b=>{d=!0,f(),a=PS(g,n,b),R.error(b)},complete:()=>{u=!0,f(),a=PS(g,t),R.complete()}}),Pe(_).subscribe(s))})(o)}}function PS(r,e,...n){if(e===!0){r();return}if(e===!1)return;let t=new Ci({next:()=>{t.unsubscribe(),r()}});return Pe(e(...n)).subscribe(t)}function l6(r,e,n){let t,i=!1;return r&&typeof r=="object"?{bufferSize:t=1/0,windowTime:e=1/0,refCount:i=!1,scheduler:n}=r:t=r??1/0,xS({connector:()=>new Nc(t,e,n),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function FS(r){return Ct((e,n)=>r<=n)}function u6(r){return ve((e,n)=>{let t=!1,i=_e(n,()=>{i?.unsubscribe(),t=!0},Di);Pe(r).subscribe(i),e.subscribe(_e(n,o=>t&&n.next(o)))})}function Lu(...r){let e=uo(r);return ve((n,t)=>{(e?Qs(r,n,e):Qs(r,n)).subscribe(t)})}function pt(r,e){return ve((n,t)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&t.complete();n.subscribe(_e(t,c=>{i?.unsubscribe();let l=0,u=o++;Pe(r(c,u)).subscribe(i=_e(t,d=>t.next(e?e(c,d,u,l++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function Xs(r){return ve((e,n)=>{Pe(r).subscribe(_e(n,()=>n.complete(),Di)),!n.closed&&e.subscribe(n)})}function d6(r,e=!1){return ve((n,t)=>{let i=0;n.subscribe(_e(t,o=>{let s=r(o,i++);(s||e)&&t.next(o),!s&&t.complete()}))})}function Js(r,e,n){let t=Se(r)||e||n?{next:r,error:e,complete:n}:r;return t?ve((i,o)=>{var s;(s=t.subscribe)===null||s===void 0||s.call(t);let a=!0;i.subscribe(_e(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)}))}):Ni}function $P(r,e){return ve((n,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=Pe(r(p)).subscribe(_e(t,u,d)),g=()=>{if(s){s=!1;let p=a;a=null,t.next(p),!l&&f(p)}};n.subscribe(_e(t,p=>{s=!0,a=p,!(c&&!c.closed)&&(i?g():f(p))},()=>{l=!0,!(o&&s&&c&&!c.closed)&&t.complete()}))})}function h6(r,e=Hn,n){let t=Oi(r,e);return $P(()=>t,n)}var f6=qs(r=>function(n=null){r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n});function g6(r,e){let{first:n,each:t,with:i=m6,scheduler:o=e??Hn,meta:s=null}=dE(r)?{first:r}:typeof r=="number"?{each:r}:r;if(n==null&&t==null)throw new TypeError("No timeout provided.");return ve((a,c)=>{let l,u,d=null,f=0,g=p=>{u=Wn(c,o,()=>{try{l.unsubscribe(),Pe(i({meta:s,lastValue:d,seen:f})).subscribe(c)}catch(_){c.error(_)}},p)};l=a.subscribe(_e(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(n!=null?typeof n=="number"?n:+n-o.now():t)})}function m6(r){throw new f6(r)}function p6(r=Dc){return fe(e=>({value:e,timestamp:r.now()}))}var kS;function TE(){return kS}function fo(r){let e=kS;return kS=r,e}var jP=Symbol("NotFound");function Mu(r){return r===jP||r?.name==="\u0275NotFound"}var zn=null,IE=!1,US=1,E6=null,Rn=Symbol("SIGNAL");function Ae(r){let e=zn;return zn=r,e}function AE(){return zn}var Oc={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 Pu(r){if(IE)throw new Error("");if(zn===null)return;zn.consumerOnSignalRead(r);let e=zn.producersTail;if(e!==void 0&&e.producer===r)return;let n,t=zn.recomputing;if(t&&(n=e!==void 0?e.nextProducer:zn.producers,n!==void 0&&n.producer===r)){zn.producersTail=n,n.lastReadVersion=r.version;return}let i=r.consumersTail;if(i!==void 0&&i.consumer===zn&&(!t||T6(i,zn)))return;let o=ku(zn),s={producer:r,consumer:zn,nextProducer:n,prevConsumer:i,lastReadVersion:r.version,nextConsumer:void 0};zn.producersTail=s,e!==void 0?e.nextProducer=s:zn.producers=s,o&&qP(r,s)}function HP(){US++}function RE(r){if(!(ku(r)&&!r.dirty)&&!(!r.dirty&&r.lastCleanEpoch===US)){if(!r.producerMustRecompute(r)&&!Fu(r)){SE(r);return}r.producerRecomputeValue(r),SE(r)}}function VS(r){if(r.consumers===void 0)return;let e=IE;IE=!0;try{for(let n=r.consumers;n!==void 0;n=n.nextConsumer){let t=n.consumer;t.dirty||_6(t)}}finally{IE=e}}function BS(){return zn?.consumerAllowSignalWrites!==!1}function _6(r){r.dirty=!0,VS(r),r.consumerMarkedDirty?.(r)}function SE(r){r.dirty=!1,r.lastCleanEpoch=US}function wc(r){return r&&WP(r),Ae(r)}function WP(r){r.producersTail=void 0,r.recomputing=!0}function xu(r,e){Ae(e),r&&zP(r)}function zP(r){r.recomputing=!1;let e=r.producersTail,n=e!==void 0?e.nextProducer:r.producers;if(n!==void 0){if(ku(r))do n=GS(n);while(n!==void 0);e!==void 0?e.nextProducer=void 0:r.producers=void 0}}function Fu(r){for(let e=r.producers;e!==void 0;e=e.nextProducer){let n=e.producer,t=e.lastReadVersion;if(t!==n.version||(RE(n),t!==n.version))return!0}return!1}function bc(r){if(ku(r)){let e=r.producers;for(;e!==void 0;)e=GS(e)}r.producers=void 0,r.producersTail=void 0,r.consumers=void 0,r.consumersTail=void 0}function qP(r,e){let n=r.consumersTail,t=ku(r);if(n!==void 0?(e.nextConsumer=n.nextConsumer,n.nextConsumer=e):(e.nextConsumer=void 0,r.consumers=e),e.prevConsumer=n,r.consumersTail=e,!t)for(let i=r.producers;i!==void 0;i=i.nextProducer)qP(i.producer,i)}function GS(r){let e=r.producer,n=r.nextProducer,t=r.nextConsumer,i=r.prevConsumer;if(r.nextConsumer=void 0,r.prevConsumer=void 0,t!==void 0?t.prevConsumer=i:e.consumersTail=i,i!==void 0)i.nextConsumer=t;else if(e.consumers=t,!ku(e)){let o=e.producers;for(;o!==void 0;)o=GS(o)}return n}function ku(r){return r.consumerIsAlwaysLive||r.consumers!==void 0}function DE(r){E6?.(r)}function T6(r,e){let n=e.producersTail;if(n!==void 0){let t=e.producers;do{if(t===r)return!0;if(t===n)break;t=t.nextProducer}while(t!==void 0)}return!1}function CE(r,e){return Object.is(r,e)}function Cf(r,e){let n=Object.create(I6);n.computation=r,e!==void 0&&(n.equal=e);let t=()=>{if(RE(n),Pu(n),n.value===Df)throw n.error;return n.value};return t[Rn]=n,DE(n),t}var vE=Symbol("UNSET"),yE=Symbol("COMPUTING"),Df=Symbol("ERRORED"),I6=le(x({},Oc),{value:vE,dirty:!0,error:null,equal:CE,kind:"computed",producerMustRecompute(r){return r.value===vE||r.value===yE},producerRecomputeValue(r){if(r.value===yE)throw new Error("");let e=r.value;r.value=yE;let n=wc(r),t,i=!1;try{t=r.computation(),Ae(null),i=e!==vE&&e!==Df&&t!==Df&&r.equal(e,t)}catch(o){t=Df,r.error=o}finally{xu(r,n)}if(i){r.value=e;return}r.value=t,r.version++}});function v6(){throw new Error}var KP=v6;function YP(r){KP(r)}function $S(r){KP=r}var y6=null;function jS(r,e){let n=Object.create(NE);n.value=r,e!==void 0&&(n.equal=e);let t=()=>QP(n);return t[Rn]=n,DE(n),[t,s=>Uu(n,s),s=>HS(n,s)]}function QP(r){return Pu(r),r.value}function Uu(r,e){BS()||YP(r),r.equal(r.value,e)||(r.value=e,S6(r))}function HS(r,e){BS()||YP(r),Uu(r,e(r.value))}var NE=le(x({},Oc),{equal:CE,value:void 0,kind:"signal"});function S6(r){r.version++,HP(),VS(r),y6?.(r)}var Vu={schedule(r){let e=requestAnimationFrame,n=cancelAnimationFrame,{delegate:t}=Vu;t&&(e=t.requestAnimationFrame,n=t.cancelAnimationFrame);let i=e(o=>{n=void 0,r(o)});return new mt(()=>n?.(i))},requestAnimationFrame(...r){let{delegate:e}=Vu;return(e?.requestAnimationFrame||requestAnimationFrame)(...r)},cancelAnimationFrame(...r){let{delegate:e}=Vu;return(e?.cancelAnimationFrame||cancelAnimationFrame)(...r)},delegate:void 0};var A6=1,WS,zS={};function XP(r){return r in zS?(delete zS[r],!0):!1}var JP={setImmediate(r){let e=A6++;return zS[e]=!0,WS||(WS=Promise.resolve()),WS.then(()=>XP(e)&&r()),e},clearImmediate(r){XP(r)}};var{setImmediate:R6,clearImmediate:D6}=JP,Nf={setImmediate(...r){let{delegate:e}=Nf;return(e?.setImmediate||R6)(...r)},clearImmediate(r){let{delegate:e}=Nf;return(e?.clearImmediate||D6)(r)},delegate:void 0};var OE=class extends co{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}requestAsyncId(e,n,t=0){return t!==null&&t>0?super.requestAsyncId(e,n,t):(e.actions.push(this),e._scheduled||(e._scheduled=Nf.setImmediate(e.flush.bind(e,void 0))))}recycleAsyncId(e,n,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,n,t);let{actions:o}=e;n!=null&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==n&&(Nf.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))}};var wE=class extends lo{flush(e){this._active=!0;let n=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===n&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===n&&t.shift();)e.unsubscribe();throw i}}};var C6=new wE(OE);var bE=class extends co{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}schedule(e,n=0){return n>0?super.schedule(e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)}execute(e,n){return n>0||this.closed?super.execute(e,n):this._execute(e,n)}requestAsyncId(e,n,t=0){return t!=null&&t>0||t==null&&this.delay>0?super.requestAsyncId(e,n,t):(e.flush(this),0)}};var LE=class extends lo{};var qS=new LE(bE);var ME=class extends co{constructor(e,n){super(e,n),this.scheduler=e,this.work=n}requestAsyncId(e,n,t=0){return t!==null&&t>0?super.requestAsyncId(e,n,t):(e.actions.push(this),e._scheduled||(e._scheduled=Vu.requestAnimationFrame(()=>e.flush(void 0))))}recycleAsyncId(e,n,t=0){var i;if(t!=null?t>0:this.delay>0)return super.recycleAsyncId(e,n,t);let{actions:o}=e;n!=null&&n===e._scheduled&&((i=o[o.length-1])===null||i===void 0?void 0:i.id)!==n&&(Vu.cancelAnimationFrame(n),e._scheduled=void 0)}};var PE=class extends lo{flush(e){this._active=!0;let n;e?n=e.id:(n=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===n&&t.shift());if(this._active=!1,i){for(;(e=t[0])&&e.id===n&&t.shift();)e.unsubscribe();throw i}}};var N6=new PE(ME);function O6(r){return!!r&&(r instanceof me||Se(r.lift)&&Se(r.subscribe))}function w6(r,e){let n=typeof e=="object";return new Promise((t,i)=>{let o=new Ci({next:s=>{t(s),o.unsubscribe()},error:i,complete:()=>{n?t(e.defaultValue):i(new BP)}});r.subscribe(o)})}function KS(r){return new me(e=>{Pe(r()).subscribe(e)})}function b6(...r){let e=hE(r),{args:n,keys:t}=fE(r),i=new me(o=>{let{length:s}=n;if(!s){o.complete();return}let a=new Array(s),c=s,l=s;for(let u=0;u<s;u++){let d=!1;Pe(n[u]).subscribe(_e(o,f=>{d||(d=!0,l--),a[u]=f},()=>c--,void 0,()=>{(!c||!d)&&(l||o.next(t?mE(t,a):a),o.complete())}))}});return e?i.pipe(Ou(e)):i}var L6=["addListener","removeListener"],M6=["addEventListener","removeEventListener"],P6=["on","off"];function go(r,e,n,t){if(Se(n)&&(t=n,n=void 0),t)return go(r,e,n).pipe(Ou(t));let[i,o]=k6(r)?M6.map(s=>a=>r[s](e,a,n)):x6(r)?L6.map(ZP(r,e)):F6(r)?P6.map(ZP(r,e)):[];if(!i&&Cu(r))return ho(s=>go(s,e,n))(Pe(r));if(!i)throw new TypeError("Invalid event target");return new me(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function ZP(r,e){return n=>t=>r[n](e,t)}function x6(r){return Se(r.addListener)&&Se(r.removeListener)}function F6(r){return Se(r.on)&&Se(r.off)}function k6(r){return Se(r.addEventListener)&&Se(r.removeEventListener)}function U6(r,e,n){return KS(()=>r()?e:n)}function Bu(...r){let e=uo(r),n=DP(r,1/0),t=r;return t.length?t.length===1?Pe(t[0]):pE(n)(Fr(t,e)):Ac}function e0(r){let e=Ae(null);try{return r()}finally{Ae(e)}}var t0=le(x({},Oc),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,kind:"effect"});function n0(r){if(r.dirty=!1,r.version>0&&!Fu(r))return;r.version++;let e=wc(r);try{r.cleanup(),r.fn()}finally{xu(r,e)}}var Mc=class{full;major;minor;patch;constructor(e){this.full=e;let n=e.split(".");this.major=n[0],this.minor=n[1],this.patch=n.slice(2).join(".")}},sA=new Mc("20.3.18");var UE="https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss",oe=class extends Error{code;constructor(e,n){super(ta(e,n)),this.code=e}};function V6(r){return`NG0${Math.abs(r)}`}function ta(r,e){return`${V6(r)}${e?": "+e:""}`}var en=globalThis;function Je(r){for(let e in r)if(r[e]===Je)return e;throw Error("")}function o0(r,e){for(let n in e)e.hasOwnProperty(n)&&!r.hasOwnProperty(n)&&(r[n]=e[n])}function os(r){if(typeof r=="string")return r;if(Array.isArray(r))return`[${r.map(os).join(", ")}]`;if(r==null)return""+r;let e=r.overriddenName||r.name;if(e)return`${e}`;let n=r.toString();if(n==null)return""+n;let t=n.indexOf(`
4
4
  `);return t>=0?n.slice(0,t):n}function VE(r,e){return r?e?`${r} ${e}`:r:e||""}var B6=Je({__forward_ref__:Je});function BE(r){return r.__forward_ref__=BE,r.toString=function(){return os(this())},r}function hn(r){return aA(r)?r():r}function aA(r){return typeof r=="function"&&r.hasOwnProperty(B6)&&r.__forward_ref__===BE}function K(r){return{token:r.token,providedIn:r.providedIn||null,factory:r.factory,value:void 0}}function ss(r){return{providers:r.providers||[],imports:r.imports||[]}}function GE(r){return G6(r,$E)}function G6(r,e){return r.hasOwnProperty(e)&&r[e]||null}function $6(r){let e=r?.[$E]??null;return e||null}function QS(r){return r&&r.hasOwnProperty(FE)?r[FE]:null}var $E=Je({\u0275prov:Je}),FE=Je({\u0275inj:Je}),ee=class{_desc;ngMetadataName="InjectionToken";\u0275prov;constructor(e,n){this._desc=e,this.\u0275prov=void 0,typeof n=="number"?this.__NG_ELEMENT_ID__=n:n!==void 0&&(this.\u0275prov=K({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function cA(r){return r&&!!r.\u0275providers}var lA=Je({\u0275cmp:Je}),uA=Je({\u0275dir:Je}),dA=Je({\u0275pipe:Je}),hA=Je({\u0275mod:Je}),wf=Je({\u0275fac:Je}),kc=Je({__NG_ELEMENT_ID__:Je}),r0=Je({__NG_ENV_ID__:Je});function Ur(r){return typeof r=="string"?r:r==null?"":String(r)}function s0(r){return typeof r=="function"?r.name||r.toString():typeof r=="object"&&r!=null&&typeof r.type=="function"?r.type.name||r.type.toString():Ur(r)}var a0=Je({ngErrorCode:Je}),j6=Je({ngErrorMessage:Je}),H6=Je({ngTokenPath:Je});function fA(r,e){return c0("",-200,e)}function jE(r,e){throw new oe(-201,!1)}function c0(r,e,n){let t=new oe(e,r);return t[a0]=e,t[j6]=r,n&&(t[H6]=n),t}function W6(r){return r[a0]}var XS;function l0(){return XS}function sr(r){let e=XS;return XS=r,e}function gA(r,e,n){let t=GE(r);if(t&&t.providedIn=="root")return t.value===void 0?t.value=t.factory():t.value;if(n&8)return null;if(e!==void 0)return e;jE(r,"Injector")}var z6={},Lc=z6,JS="__NG_DI_FLAG__",ZS=class{injector;constructor(e){this.injector=e}retrieve(e,n){let t=Pc(n)||0;try{return this.injector.get(e,t&8?null:Lc,t)}catch(i){if(Mu(i))return i;throw i}}};function q6(r,e=0){let n=TE();if(n===void 0)throw new oe(-203,!1);if(n===null)return gA(r,void 0,e);{let t=K6(e),i=n.retrieve(r,t);if(Mu(i)){if(t.optional)return null;throw i}return i}}function C(r,e=0){return(l0()||q6)(hn(r),e)}function J(r,e){return C(r,Pc(e))}function Pc(r){return typeof r>"u"||typeof r=="number"?r:0|(r.optional&&8)|(r.host&&1)|(r.self&&2)|(r.skipSelf&&4)}function K6(r){return{optional:!!(r&8),host:!!(r&1),self:!!(r&2),skipSelf:!!(r&4)}}function eA(r){let e=[];for(let n=0;n<r.length;n++){let t=hn(r[n]);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=Y6(a);typeof c=="number"?c===-1?i=a.token:o|=c:i=a}e.push(C(i,o))}else e.push(C(t))}return e}function mA(r,e){return r[JS]=e,r.prototype[JS]=e,r}function Y6(r){return r[JS]}function Zs(r,e){let n=r.hasOwnProperty(wf);return n?r[wf]:null}function u0(r,e,n){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let i=r[t],o=e[t];if(n&&(i=n(i),o=n(o)),o!==i)return!1}return!0}function d0(r){return r.flat(Number.POSITIVE_INFINITY)}function HE(r,e){r.forEach(n=>Array.isArray(n)?HE(n,e):e(n))}function pA(r,e,n){e>=r.length?r.push(n):r.splice(e,0,n)}function Mf(r,e){return e>=r.length-1?r.pop():r.splice(e,1)[0]}function h0(r,e){let n=[];for(let t=0;t<r;t++)n.push(e);return n}function f0(r,e,n,t){let i=r.length;if(i==e)r.push(n,t);else if(i===1)r.push(t,r[0]),r[0]=n;else{for(i--,r.push(r[i-1],r[i]);i>e;){let o=i-2;r[i]=r[o],i--}r[e]=n,r[e+1]=t}}function Pf(r,e,n){let t=$u(r,e);return t>=0?r[t|1]=n:(t=~t,f0(r,t,e,n)),t}function WE(r,e){let n=$u(r,e);if(n>=0)return r[n|1]}function $u(r,e){return Q6(r,e,1)}function Q6(r,e,n){let t=0,i=r.length>>n;for(;i!==t;){let o=t+(i-t>>1),s=r[o<<n];if(e===s)return o<<n;s>e?i=o:t=o+1}return~(i<<n)}var wi={},qn=[],na=new ee(""),EA=new ee("",-1),_A=new ee(""),bf=class{get(e,n=Lc){if(n===Lc){let i=c0("",-201);throw i.name="\u0275NotFound",i}return n}};function g0(r){return r[hA]||null}function ra(r){return r[lA]||null}function zE(r){return r[uA]||null}function TA(r){return r[dA]||null}function _r(r){return{\u0275providers:r}}function m0(...r){return{\u0275providers:IA(!0,r),\u0275fromNgModule:!0}}function IA(r,...e){let n=[],t=new Set,i,o=s=>{n.push(s)};return HE(e,s=>{let a=s;kE(a,o,[],t)&&(i||=[],i.push(a))}),i!==void 0&&p0(i,o),n}function p0(r,e){for(let n=0;n<r.length;n++){let{ngModule:t,providers:i}=r[n];vA(i,o=>{e(o,t)})}}function kE(r,e,n,t){if(r=hn(r),!r)return!1;let i=null,o=QS(r),s=!o&&ra(r);if(!o&&!s){let c=r.ngModule;if(o=QS(c),o)i=c;else return!1}else{if(s&&!s.standalone)return!1;i=r}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)kE(l,e,n,t)}}else if(o){if(o.imports!=null&&!a){t.add(i);let l;HE(o.imports,u=>{kE(u,e,n,t)&&(l||=[],l.push(u))}),l!==void 0&&p0(l,e)}if(!a){let l=Zs(i)||(()=>new i);e({provide:i,useFactory:l,deps:qn},i),e({provide:_A,useValue:i,multi:!0},i),e({provide:na,useValue:()=>C(i),multi:!0},i)}let c=o.providers;if(c!=null&&!a){let l=r;vA(c,u=>{e(u,l)})}}else return!1;return i!==r&&r.providers!==void 0}function vA(r,e){for(let n of r)cA(n)&&(n=n.\u0275providers),Array.isArray(n)?vA(n,e):e(n)}var X6=Je({provide:String,useValue:Je});function E0(r){return r!==null&&typeof r=="object"&&X6 in r}function J6(r){return!!(r&&r.useExisting)}function Z6(r){return!!(r&&r.useFactory)}function xc(r){return typeof r=="function"}function _0(r){return!!r.useClass}var xf=new ee(""),xE={},i0={},YS;function ju(){return YS===void 0&&(YS=new bf),YS}var Kn=class{},Fc=class extends Kn{parent;source;scopes;records=new Map;_ngOnDestroyHooks=new Set;_onDestroyHooks=[];get destroyed(){return this._destroyed}_destroyed=!1;injectorDefTypes;constructor(e,n,t,i){super(),this.parent=n,this.source=t,this.scopes=i,nA(e,s=>this.processProvider(s)),this.records.set(EA,Gu(void 0,this)),i.has("environment")&&this.records.set(Kn,Gu(void 0,this));let o=this.records.get(xf);o!=null&&typeof o.value=="string"&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(_A,qn,{self:!0}))}retrieve(e,n){let t=Pc(n)||0;try{return this.get(e,Lc,t)}catch(i){if(Mu(i))return i;throw i}}destroy(){Of(this),this._destroyed=!0;let e=Ae(null);try{for(let t of this._ngOnDestroyHooks)t.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let t of n)t()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Ae(e)}}onDestroy(e){return Of(this),this._onDestroyHooks.push(e),()=>this.removeOnDestroy(e)}runInContext(e){Of(this);let n=fo(this),t=sr(void 0),i;try{return e()}finally{fo(n),sr(t)}}get(e,n=Lc,t){if(Of(this),e.hasOwnProperty(r0))return e[r0](this);let i=Pc(t),o,s=fo(this),a=sr(void 0);try{if(!(i&4)){let l=this.records.get(e);if(l===void 0){let u=i4(e)&&GE(e);u&&this.injectableDefInScope(u)?l=Gu(tA(e),xE):l=null,this.records.set(e,l)}if(l!=null)return this.hydrate(e,l,i)}let c=i&2?ju():this.parent;return n=i&8&&n===Lc?null:n,c.get(e,n)}catch(c){let l=W6(c);throw l===-200||l===-201?new oe(l,null):c}finally{sr(a),fo(s)}}resolveInjectorInitializers(){let e=Ae(null),n=fo(this),t=sr(void 0),i;try{let o=this.get(na,qn,{self:!0});for(let s of o)s()}finally{fo(n),sr(t),Ae(e)}}toString(){let e=[],n=this.records;for(let t of n.keys())e.push(os(t));return`R3Injector[${e.join(", ")}]`}processProvider(e){e=hn(e);let n=xc(e)?e:hn(e&&e.provide),t=t4(e);if(!xc(e)&&e.multi===!0){let i=this.records.get(n);i||(i=Gu(void 0,xE,!0),i.factory=()=>eA(i.multi),this.records.set(n,i)),n=e,i.multi.push(e)}this.records.set(n,t)}hydrate(e,n,t){let i=Ae(null);try{if(n.value===i0)throw fA(os(e));return n.value===xE&&(n.value=i0,n.value=n.factory(void 0,t)),typeof n.value=="object"&&n.value&&r4(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{Ae(i)}}injectableDefInScope(e){if(!e.providedIn)return!1;let n=hn(e.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(e){let n=this._onDestroyHooks.indexOf(e);n!==-1&&this._onDestroyHooks.splice(n,1)}};function tA(r){let e=GE(r),n=e!==null?e.factory:Zs(r);if(n!==null)return n;if(r instanceof ee)throw new oe(204,!1);if(r instanceof Function)return e4(r);throw new oe(204,!1)}function e4(r){if(r.length>0)throw new oe(204,!1);let n=$6(r);return n!==null?()=>n.factory(r):()=>new r}function t4(r){if(E0(r))return Gu(void 0,r.useValue);{let e=yA(r);return Gu(e,xE)}}function yA(r,e,n){let t;if(xc(r)){let i=hn(r);return Zs(i)||tA(i)}else if(E0(r))t=()=>hn(r.useValue);else if(Z6(r))t=()=>r.useFactory(...eA(r.deps||[]));else if(J6(r))t=(i,o)=>C(hn(r.useExisting),o!==void 0&&o&8?8:void 0);else{let i=hn(r&&(r.useClass||r.provide));if(n4(r))t=()=>new i(...eA(r.deps));else return Zs(i)||tA(i)}return t}function Of(r){if(r.destroyed)throw new oe(205,!1)}function Gu(r,e,n=!1){return{factory:r,value:e,multi:n?[]:void 0}}function n4(r){return!!r.deps}function r4(r){return r!==null&&typeof r=="object"&&typeof r.ngOnDestroy=="function"}function i4(r){return typeof r=="function"||typeof r=="object"&&r.ngMetadataName==="InjectionToken"}function nA(r,e){for(let n of r)Array.isArray(n)?nA(n,e):n&&cA(n)?nA(n.\u0275providers,e):e(n)}function mo(r,e){let n;r instanceof Fc?(Of(r),n=r):n=new ZS(r);let t,i=fo(n),o=sr(void 0);try{return e()}finally{fo(i),sr(o)}}function SA(){return l0()!==void 0||TE()!=null}var bi=0,Te=1,Re=2,fn=3,ri=4,ar=5,Uc=6,Hu=7,$t=8,as=9,po=10,Ze=11,Wu=12,AA=13,Vc=14,Yn=15,ia=16,Bc=17,Eo=18,Ff=19,RA=20,is=21,qE=22,cs=23,Vr=24,Gc=25,$c=26,et=27,T0=1,DA=6,oa=7,kf=8,jc=9,jt=10;function _o(r){return Array.isArray(r)&&typeof r[T0]=="object"}function Li(r){return Array.isArray(r)&&r[T0]===!0}function CA(r){return(r.flags&4)!==0}function ls(r){return r.componentOffset>-1}function zu(r){return(r.flags&1)===1}function Mi(r){return!!r.template}function qu(r){return(r[Re]&512)!==0}function Hc(r){return(r[Re]&256)===256}var NA="svg",I0="math";function ii(r){for(;Array.isArray(r);)r=r[bi];return r}function OA(r,e){return ii(e[r])}function oi(r,e){return ii(e[r.index])}function Uf(r,e){return r.data[e]}function Wc(r,e){return r[e]}function Vf(r,e,n,t){n>=r.data.length&&(r.data[n]=null,r.blueprint[n]=null),e[n]=t}function si(r,e){let n=e[r];return _o(n)?n:n[bi]}function v0(r){return(r[Re]&4)===4}function KE(r){return(r[Re]&128)===128}function y0(r){return Li(r[fn])}function Br(r,e){return e==null?null:r[e]}function wA(r){r[Bc]=0}function YE(r){r[Re]&1024||(r[Re]|=1024,KE(r)&&sa(r))}function S0(r,e){for(;r>0;)e=e[Vc],r--;return e}function Ku(r){return!!(r[Re]&9216||r[Vr]?.dirty)}function QE(r){r[po].changeDetectionScheduler?.notify(8),r[Re]&64&&(r[Re]|=1024),Ku(r)&&sa(r)}function sa(r){r[po].changeDetectionScheduler?.notify(0);let e=ea(r);for(;e!==null&&!(e[Re]&8192||(e[Re]|=8192,!KE(e)));)e=ea(e)}function bA(r,e){if(Hc(r))throw new oe(911,!1);r[is]===null&&(r[is]=[]),r[is].push(e)}function A0(r,e){if(r[is]===null)return;let n=r[is].indexOf(e);n!==-1&&r[is].splice(n,1)}function ea(r){let e=r[fn];return Li(e)?e[fn]:e}function LA(r){return r[Hu]??=[]}function MA(r){return r.cleanup??=[]}function R0(r,e,n,t){let i=LA(e);i.push(n),r.firstCreatePass&&MA(r).push(t,i.length-1)}var be={lFrame:k0(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var rA=!1;function D0(){return be.lFrame.elementDepthCount}function C0(){be.lFrame.elementDepthCount++}function PA(){be.lFrame.elementDepthCount--}function XE(){return be.bindingsEnabled}function xA(){return be.skipHydrationRootTNode!==null}function FA(r){return be.skipHydrationRootTNode===r}function kA(){be.skipHydrationRootTNode=null}function ce(){return be.lFrame.lView}function tt(){return be.lFrame.tView}function N0(r){return be.lFrame.contextLView=r,r[$t]}function O0(r){return be.lFrame.contextLView=null,r}function gn(){let r=UA();for(;r!==null&&r.type===64;)r=r.parent;return r}function UA(){return be.lFrame.currentTNode}function w0(){let r=be.lFrame,e=r.currentTNode;return r.isParent?e:e.parent}function zc(r,e){let n=be.lFrame;n.currentTNode=r,n.isParent=e}function VA(){return be.lFrame.isParent}function BA(){be.lFrame.isParent=!1}function GA(){return be.lFrame.contextLView}function $A(){return rA}function Yu(r){let e=rA;return rA=r,e}function cr(){let r=be.lFrame,e=r.bindingRootIndex;return e===-1&&(e=r.bindingRootIndex=r.tView.bindingStartIndex),e}function jA(){return be.lFrame.bindingIndex}function b0(r){return be.lFrame.bindingIndex=r}function To(){return be.lFrame.bindingIndex++}function Bf(r){let e=be.lFrame,n=e.bindingIndex;return e.bindingIndex=e.bindingIndex+r,n}function L0(){return be.lFrame.inI18n}function M0(r,e){let n=be.lFrame;n.bindingIndex=n.bindingRootIndex=r,JE(e)}function P0(){return be.lFrame.currentDirectiveIndex}function JE(r){be.lFrame.currentDirectiveIndex=r}function x0(r){let e=be.lFrame.currentDirectiveIndex;return e===-1?null:r[e]}function ZE(){return be.lFrame.currentQueryIndex}function Gf(r){be.lFrame.currentQueryIndex=r}function o4(r){let e=r[Te];return e.type===2?e.declTNode:e.type===1?r[ar]:null}function HA(r,e,n){if(n&4){let i=e,o=r;for(;i=i.parent,i===null&&!(n&1);)if(i=o4(o),i===null||(o=o[Vc],i.type&10))break;if(i===null)return!1;e=i,r=o}let t=be.lFrame=F0();return t.currentTNode=e,t.lView=r,!0}function e_(r){let e=F0(),n=r[Te];be.lFrame=e,e.currentTNode=n.firstChild,e.lView=r,e.tView=n,e.contextLView=r,e.bindingIndex=n.bindingStartIndex,e.inI18n=!1}function F0(){let r=be.lFrame,e=r===null?null:r.child;return e===null?k0(r):e}function k0(r){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:r,child:null,inI18n:!1};return r!==null&&(r.child=e),e}function U0(){let r=be.lFrame;return be.lFrame=r.parent,r.currentTNode=null,r.lView=null,r}var WA=U0;function t_(){let r=U0();r.isParent=!0,r.tView=null,r.selectedIndex=-1,r.contextLView=null,r.elementDepthCount=0,r.currentDirectiveIndex=-1,r.currentNamespace=null,r.bindingRootIndex=-1,r.bindingIndex=-1,r.currentQueryIndex=0}function V0(r){return(be.lFrame.contextLView=S0(r,be.lFrame.contextLView))[$t]}function ai(){return be.lFrame.selectedIndex}function aa(r){be.lFrame.selectedIndex=r}function Qu(){let r=be.lFrame;return Uf(r.tView,r.selectedIndex)}function B0(){be.lFrame.currentNamespace=NA}function G0(){s4()}function s4(){be.lFrame.currentNamespace=null}function $0(){return be.lFrame.currentNamespace}var j0=!0;function n_(){return j0}function $f(r){j0=r}function iA(r,e=null,n=null,t){let i=zA(r,e,n,t);return i.resolveInjectorInitializers(),i}function zA(r,e=null,n=null,t,i=new Set){let o=[n||qn,m0(r)];return t=t||(typeof r=="object"?void 0:os(r)),new Fc(o,e||ju(),t||null,i)}var ut=class r{static THROW_IF_NOT_FOUND=Lc;static NULL=new bf;static create(e,n){if(Array.isArray(e))return iA({name:""},n,e,"");{let t=e.name??"";return iA({name:t},e.parent,e.providers,t)}}static \u0275prov=K({token:r,providedIn:"any",factory:()=>C(EA)});static __NG_ELEMENT_ID__=-1},Dn=new ee(""),lr=(()=>{class r{static __NG_ELEMENT_ID__=a4;static __NG_ENV_ID__=n=>n}return r})(),Lf=class extends lr{_lView;constructor(e){super(),this._lView=e}get destroyed(){return Hc(this._lView)}onDestroy(e){let n=this._lView;return bA(n,e),()=>A0(n,e)}};function a4(){return new Lf(ce())}var kr=class{_console=console;handleError(e){this._console.error("ERROR",e)}},Io=new ee("",{providedIn:"root",factory:()=>{let r=J(Kn),e;return n=>{r.destroyed&&!e?setTimeout(()=>{throw n}):(e??=r.get(kr),e.handleError(n))}}}),H0={provide:na,useValue:()=>{J(kr)},multi:!0};function vo(r){return typeof r=="function"&&r[Rn]!==void 0}function qc(r,e){let[n,t,i]=jS(r,e?.equal),o=n,s=o[Rn];return o.set=t,o.update=i,o.asReadonly=qA.bind(o),o}function qA(){let r=this[Rn];if(r.readonlyFn===void 0){let e=()=>this();e[Rn]=r,r.readonlyFn=e}return r.readonlyFn}function KA(r){return vo(r)&&typeof r.set=="function"}var Xu=(()=>{class r{view;node;constructor(n,t){this.view=n,this.node=t}static __NG_ELEMENT_ID__=c4}return r})();function c4(){return new Xu(ce(),gn())}var ni=class{},Ju=new ee("",{providedIn:"root",factory:()=>!1});var YA=new ee(""),r_=new ee(""),ca=(()=>{class r{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 me(n=>{n.next(!1),n.complete()}):this.pendingTask}add(){!this.hasPendingTasks&&!this.destroyed&&this.pendingTask.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),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:r,providedIn:"root",factory:()=>new r})}return r})(),yo=(()=>{class r{internalPendingTasks=J(ca);scheduler=J(ni);errorHandler=J(Io);add(){let n=this.internalPendingTasks.add();return()=>{this.internalPendingTasks.has(n)&&(this.scheduler.notify(11),this.internalPendingTasks.remove(n))}}run(n){let t=this.add();n().catch(this.errorHandler).finally(t)}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})();function Kc(...r){}var jf=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:()=>new oA})}return r})(),oA=class{dirtyEffectCount=0;queues=new Map;add(e){this.enqueue(e),this.schedule(e)}schedule(e){e.dirty&&this.dirtyEffectCount++}remove(e){let n=e.zone,t=this.queues.get(n);t.has(e)&&(t.delete(e),e.dirty&&this.dirtyEffectCount--)}enqueue(e){let n=e.zone;this.queues.has(n)||this.queues.set(n,new Set);let t=this.queues.get(n);t.has(e)||t.add(e)}flush(){for(;this.dirtyEffectCount>0;){let e=!1;for(let[n,t]of this.queues)n===null?e||=this.flushQueue(t):e||=n.run(()=>this.flushQueue(t));e||(this.dirtyEffectCount=0)}}flushQueue(e){let n=!1;for(let t of e)t.dirty&&(this.dirtyEffectCount--,n=!0,t.run());return n}};function hd(r){return{toString:r}.toString()}var i_="__parameters__";function m4(r){return function(...n){if(r){let t=r(...n);for(let i in t)this[i]=t[i]}}}function Cx(r,e,n){return hd(()=>{let t=m4(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(i_)?c[i_]:Object.defineProperty(c,i_,{value:[]})[i_];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),c}}return i.prototype.ngMetadataName=r,i.annotationCls=i,i})}var p4=mA(Cx("Inject",r=>({token:r})),-1),pn=mA(Cx("Optional"),8);function Nx(r){let e=en.ng;if(e&&e.\u0275compilerFacade)return e.\u0275compilerFacade;throw new Error("JIT compiler unavailable")}function E4(r){return typeof r=="function"}var p_=class{previousValue;currentValue;firstChange;constructor(e,n,t){this.previousValue=e,this.currentValue=n,this.firstChange=t}isFirstChange(){return this.firstChange}};function Ox(r,e,n,t){e!==null?e.applyValueToInputSignal(e,t):r[n]=t}var zR=(()=>{let r=()=>wx;return r.ngInherit=!0,r})();function wx(r){return r.type.prototype.ngOnChanges&&(r.setInput=T4),_4}function _4(){let r=Lx(this),e=r?.current;if(e){let n=r.previous;if(n===wi)r.previous=e;else for(let t in e)n[t]=e[t];r.current=null,this.ngOnChanges(e)}}function T4(r,e,n,t,i){let o=this.declaredInputs[t],s=Lx(r)||I4(r,{previous:wi,current:null}),a=s.current||(s.current={}),c=s.previous,l=c[o];a[o]=new p_(l&&l.currentValue,n,c===wi),Ox(r,e,i,n)}var bx="__ngSimpleChanges__";function Lx(r){return r[bx]||null}function I4(r,e){return r[bx]=e}var W0=[];var dt=function(r,e=null,n){for(let t=0;t<W0.length;t++){let i=W0[t];i(r,e,n)}};function v4(r,e,n){let{ngOnChanges:t,ngOnInit:i,ngDoCheck:o}=e.type.prototype;if(t){let s=wx(e);(n.preOrderHooks??=[]).push(r,s),(n.preOrderCheckHooks??=[]).push(r,s)}i&&(n.preOrderHooks??=[]).push(0-r,i),o&&((n.preOrderHooks??=[]).push(r,o),(n.preOrderCheckHooks??=[]).push(r,o))}function Mx(r,e){for(let n=e.directiveStart,t=e.directiveEnd;n<t;n++){let o=r.data[n].type.prototype,{ngAfterContentInit:s,ngAfterContentChecked:a,ngAfterViewInit:c,ngAfterViewChecked:l,ngOnDestroy:u}=o;s&&(r.contentHooks??=[]).push(-n,s),a&&((r.contentHooks??=[]).push(n,a),(r.contentCheckHooks??=[]).push(n,a)),c&&(r.viewHooks??=[]).push(-n,c),l&&((r.viewHooks??=[]).push(n,l),(r.viewCheckHooks??=[]).push(n,l)),u!=null&&(r.destroyHooks??=[]).push(n,u)}}function d_(r,e,n){Px(r,e,3,n)}function h_(r,e,n,t){(r[Re]&3)===n&&Px(r,e,n,t)}function QA(r,e){let n=r[Re];(n&3)===e&&(n&=16383,n+=1,r[Re]=n)}function Px(r,e,n,t){let i=t!==void 0?r[Bc]&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&&(r[Bc]+=65536),(a<o||o==-1)&&(y4(r,n,e,c),r[Bc]=(r[Bc]&4294901760)+c+2),c++}function z0(r,e){dt(4,r,e);let n=Ae(null);try{e.call(r)}finally{Ae(n),dt(5,r,e)}}function y4(r,e,n,t){let i=n[t]<0,o=n[t+1],s=i?-n[t]:n[t],a=r[s];i?r[Re]>>14<r[Bc]>>16&&(r[Re]&3)===e&&(r[Re]+=16384,z0(a,o)):z0(a,o)}var ed=-1,Qc=class{factory;name;injectImpl;resolving=!1;canSeeViewProviders;multi;componentProviders;index;providerFactory;constructor(e,n,t,i){this.factory=e,this.name=i,this.canSeeViewProviders=n,this.injectImpl=t}};function S4(r){return(r.flags&8)!==0}function A4(r){return(r.flags&16)!==0}function R4(r,e,n){let t=0;for(;t<n.length;){let i=n[t];if(typeof i=="number"){if(i!==0)break;t++;let o=n[t++],s=n[t++],a=n[t++];r.setAttribute(e,s,a,o)}else{let o=i,s=n[++t];C4(o)?r.setProperty(e,o,s):r.setAttribute(e,o,s),t++}}return t}function D4(r){return r===3||r===4||r===6}function C4(r){return r.charCodeAt(0)===64}function td(r,e){if(!(e===null||e.length===0))if(r===null||r.length===0)r=e.slice();else{let n=-1;for(let t=0;t<e.length;t++){let i=e[t];typeof i=="number"?n=i:n===0||(n===-1||n===2?q0(r,n,i,null,e[++t]):q0(r,n,i,null,null))}}return r}function q0(r,e,n,t,i){let o=0,s=r.length;if(e===-1)s=-1;else for(;o<r.length;){let a=r[o++];if(typeof a=="number"){if(a===e){s=-1;break}else if(a>e){s=o-1;break}}}for(;o<r.length;){let a=r[o];if(typeof a=="number")break;if(a===n){i!==null&&(r[o+1]=i);return}o++,i!==null&&o++}s!==-1&&(r.splice(s,0,e),o=s+1),r.splice(o++,0,n),i!==null&&r.splice(o++,0,i)}function xx(r){return r!==ed}function E_(r){return r&32767}function N4(r){return r>>16}function __(r,e){let n=N4(r),t=e;for(;n>0;)t=t[Vc],n--;return t}var aR=!0;function T_(r){let e=aR;return aR=r,e}var O4=256,Fx=O4-1,kx=5,w4=0,So={};function b4(r,e,n){let t;typeof n=="string"?t=n.charCodeAt(0)||0:n.hasOwnProperty(kc)&&(t=n[kc]),t==null&&(t=n[kc]=w4++);let i=t&Fx,o=1<<i;e.data[r+(i>>kx)]|=o}function I_(r,e){let n=Ux(r,e);if(n!==-1)return n;let t=e[Te];t.firstCreatePass&&(r.injectorIndex=e.length,XA(t.data,r),XA(e,null),XA(t.blueprint,null));let i=qR(r,e),o=r.injectorIndex;if(xx(i)){let s=E_(i),a=__(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 XA(r,e){r.push(0,0,0,0,0,0,0,0,e)}function Ux(r,e){return r.injectorIndex===-1||r.parent&&r.parent.injectorIndex===r.injectorIndex||e[r.injectorIndex+8]===null?-1:r.injectorIndex}function qR(r,e){if(r.parent&&r.parent.injectorIndex!==-1)return r.parent.injectorIndex;let n=0,t=null,i=e;for(;i!==null;){if(t=jx(i),t===null)return ed;if(n++,i=i[Vc],t.injectorIndex!==-1)return t.injectorIndex|n<<16}return ed}function cR(r,e,n){b4(r,e,n)}function Vx(r,e,n){if(n&8||r!==void 0)return r;jE(e,"NodeInjector")}function Bx(r,e,n,t){if(n&8&&t===void 0&&(t=null),(n&3)===0){let i=r[as],o=sr(void 0);try{return i?i.get(e,t,n&8):gA(e,t,n&8)}finally{sr(o)}}return Vx(t,e,n)}function Gx(r,e,n,t=0,i){if(r!==null){if(e[Re]&2048&&!(t&2)){let s=F4(r,e,n,t,So);if(s!==So)return s}let o=$x(r,e,n,t,So);if(o!==So)return o}return Bx(e,n,t,i)}function $x(r,e,n,t,i){let o=M4(n);if(typeof o=="function"){if(!HA(e,r,t))return t&1?Vx(i,n,t):Bx(e,n,t,i);try{let s;if(s=o(t),s==null&&!(t&8))jE(n);else return s}finally{WA()}}else if(typeof o=="number"){let s=null,a=Ux(r,e),c=ed,l=t&1?e[Yn][ar]:null;for((a===-1||t&4)&&(c=a===-1?qR(r,e):e[a+8],c===ed||!Y0(t,!1)?a=-1:(s=e[Te],a=E_(c),e=__(c,e)));a!==-1;){let u=e[Te];if(K0(o,a,u.data)){let d=L4(a,e,n,s,t,l);if(d!==So)return d}c=e[a+8],c!==ed&&Y0(t,e[Te].data[a+8]===l)&&K0(o,a,e)?(s=u,a=E_(c),e=__(c,e)):a=-1}}return i}function L4(r,e,n,t,i,o){let s=e[Te],a=s.data[r+8],c=t==null?ls(a)&&aR:t!=s&&(a.type&3)!==0,l=i&1&&o===a,u=f_(a,s,n,c,l);return u!==null?zf(e,s,u,a,i):So}function f_(r,e,n,t,i){let o=r.providerIndexes,s=e.data,a=o&1048575,c=r.directiveStart,l=r.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&&n===p||g>=c&&p.type===n)return g}if(i){let g=s[c];if(g&&Mi(g)&&g.type===n)return c}return null}function zf(r,e,n,t,i){let o=r[n],s=e.data;if(o instanceof Qc){let a=o;if(a.resolving){let g=s0(s[n]);throw fA(g)}let c=T_(a.canSeeViewProviders);a.resolving=!0;let l=s[n].type||s[n],u,d=a.injectImpl?sr(a.injectImpl):null,f=HA(r,t,0);try{o=r[n]=a.factory(void 0,i,s,r,t),e.firstCreatePass&&n>=t.directiveStart&&v4(n,s[n],e)}finally{d!==null&&sr(d),T_(c),a.resolving=!1,WA()}}return o}function M4(r){if(typeof r=="string")return r.charCodeAt(0)||0;let e=r.hasOwnProperty(kc)?r[kc]:void 0;return typeof e=="number"?e>=0?e&Fx:P4:e}function K0(r,e,n){let t=1<<r;return!!(n[e+(r>>kx)]&t)}function Y0(r,e){return!(r&2)&&!(r&1&&e)}var Yc=class{_tNode;_lView;constructor(e,n){this._tNode=e,this._lView=n}get(e,n,t){return Gx(this._tNode,this._lView,e,Pc(t),n)}};function P4(){return new Yc(gn(),ce())}function x4(r){return hd(()=>{let e=r.prototype.constructor,n=e[wf]||lR(e),t=Object.prototype,i=Object.getPrototypeOf(r.prototype).constructor;for(;i&&i!==t;){let o=i[wf]||lR(i);if(o&&o!==n)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function lR(r){return aA(r)?()=>{let e=lR(hn(r));return e&&e()}:Zs(r)}function F4(r,e,n,t,i){let o=r,s=e;for(;o!==null&&s!==null&&s[Re]&2048&&!qu(s);){let a=$x(o,s,n,t|2,So);if(a!==So)return a;let c=o.parent;if(!c){let l=s[RA];if(l){let u=l.get(n,So,t);if(u!==So)return u}c=jx(s),s=s[Vc]}o=c}return i}function jx(r){let e=r[Te],n=e.type;return n===2?e.declTNode:n===1?r[ar]:null}function k4(){return fd(gn(),ce())}function fd(r,e){return new ua(oi(r,e))}var ua=(()=>{class r{nativeElement;constructor(n){this.nativeElement=n}static __NG_ELEMENT_ID__=k4}return r})();function Hx(r){return r instanceof ua?r.nativeElement:r}function U4(){return this._results[Symbol.iterator]()}var v_=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,n){return this._results.reduce(e,n)}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,n){this.dirty=!1;let t=d0(e);(this._changesDetected=!u0(this._results,t,n))&&(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]=U4};function Wx(r){return(r.flags&128)===128}var KR=(function(r){return r[r.OnPush=0]="OnPush",r[r.Default=1]="Default",r})(KR||{}),zx=new Map,V4=0;function B4(){return V4++}function G4(r){zx.set(r[Ff],r)}function uR(r){zx.delete(r[Ff])}var Q0="__ngContext__";function nd(r,e){_o(e)?(r[Q0]=e[Ff],G4(e)):r[Q0]=e}function qx(r){return Yx(r[Wu])}function Kx(r){return Yx(r[ri])}function Yx(r){for(;r!==null&&!Li(r);)r=r[ri];return r}var dR;function YR(r){dR=r}function QR(){if(dR!==void 0)return dR;if(typeof document<"u")return document;throw new oe(210,!1)}var k_=new ee("",{providedIn:"root",factory:()=>$4}),$4="ng",U_=new ee(""),gs=new ee("",{providedIn:"platform",factory:()=>"unknown"});var j4=new ee(""),gd=new ee("",{providedIn:"root",factory:()=>QR().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});var H4="h",W4="b";var Qx="r";var Xx="di";var Jx=!1,Zx=new ee("",{providedIn:"root",factory:()=>Jx});var z4=(r,e,n,t)=>{};function q4(r,e,n,t){z4(r,e,n,t)}function V_(r){return(r.flags&32)===32}var K4=()=>null;function eF(r,e,n=!1){return K4(r,e,n)}function tF(r,e){let n=r.contentQueries;if(n!==null){let t=Ae(null);try{for(let i=0;i<n.length;i+=2){let o=n[i],s=n[i+1];if(s!==-1){let a=r.data[s];Gf(o),a.contentQueries(2,e[s],s)}}}finally{Ae(t)}}}function hR(r,e,n){Gf(0);let t=Ae(null);try{e(r,n)}finally{Ae(t)}}function XR(r,e,n){if(CA(e)){let t=Ae(null);try{let i=e.directiveStart,o=e.directiveEnd;for(let s=i;s<o;s++){let a=r.data[s];if(a.contentQueries){let c=n[s];a.contentQueries(1,c,s)}}}finally{Ae(t)}}}var ds=(function(r){return r[r.Emulated=0]="Emulated",r[r.None=2]="None",r[r.ShadowDom=3]="ShadowDom",r})(ds||{});var o_;function Y4(){if(o_===void 0&&(o_=null,en.trustedTypes))try{o_=en.trustedTypes.createPolicy("angular",{createHTML:r=>r,createScript:r=>r,createScriptURL:r=>r})}catch{}return o_}function B_(r){return Y4()?.createHTML(r)||r}var s_;function Q4(){if(s_===void 0&&(s_=null,en.trustedTypes))try{s_=en.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:r=>r,createScript:r=>r,createScriptURL:r=>r})}catch{}return s_}function X0(r){return Q4()?.createHTML(r)||r}var hs=class{changingThisBreaksApplicationSecurity;constructor(e){this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${UE})`}},fR=class extends hs{getTypeName(){return"HTML"}},gR=class extends hs{getTypeName(){return"Style"}},mR=class extends hs{getTypeName(){return"Script"}},pR=class extends hs{getTypeName(){return"URL"}},ER=class extends hs{getTypeName(){return"ResourceURL"}};function Gr(r){return r instanceof hs?r.changingThisBreaksApplicationSecurity:r}function Ro(r,e){let n=nF(r);if(n!=null&&n!==e){if(n==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${n} (see ${UE})`)}return n===e}function nF(r){return r instanceof hs&&r.getTypeName()||null}function JR(r){return new fR(r)}function ZR(r){return new gR(r)}function eD(r){return new mR(r)}function tD(r){return new pR(r)}function nD(r){return new ER(r)}function X4(r){let e=new TR(r);return J4()?new _R(e):e}var _R=class{inertDocumentHelper;constructor(e){this.inertDocumentHelper=e}getInertBodyElement(e){e="<body><remove></remove>"+e;try{let n=new window.DOMParser().parseFromString(B_(e),"text/html").body;return n===null?this.inertDocumentHelper.getInertBodyElement(e):(n.firstChild?.remove(),n)}catch{return null}}},TR=class{defaultDoc;inertDocument;constructor(e){this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let n=this.inertDocument.createElement("template");return n.innerHTML=B_(e),n}};function J4(){try{return!!new window.DOMParser().parseFromString(B_(""),"text/html")}catch{return!1}}var Z4=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function Qf(r){return r=String(r),r.match(Z4)?r:"unsafe:"+r}function ms(r){let e={};for(let n of r.split(","))e[n]=!0;return e}function Xf(...r){let e={};for(let n of r)for(let t in n)n.hasOwnProperty(t)&&(e[t]=!0);return e}var rF=ms("area,br,col,hr,img,wbr"),iF=ms("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),oF=ms("rp,rt"),eq=Xf(oF,iF),tq=Xf(iF,ms("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")),nq=Xf(oF,ms("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")),J0=Xf(rF,tq,nq,eq),sF=ms("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),rq=ms("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"),iq=ms("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"),oq=Xf(sF,rq,iq),sq=ms("script,style,template");var IR=class{sanitizedSomething=!1;buf=[];sanitizeChildren(e){let n=e.firstChild,t=!0,i=[];for(;n;){if(n.nodeType===Node.ELEMENT_NODE?t=this.startElement(n):n.nodeType===Node.TEXT_NODE?this.chars(n.nodeValue):this.sanitizedSomething=!0,t&&n.firstChild){i.push(n),n=lq(n);continue}for(;n;){n.nodeType===Node.ELEMENT_NODE&&this.endElement(n);let o=cq(n);if(o){n=o;break}n=i.pop()}}return this.buf.join("")}startElement(e){let n=Z0(e).toLowerCase();if(!J0.hasOwnProperty(n))return this.sanitizedSomething=!0,!sq.hasOwnProperty(n);this.buf.push("<"),this.buf.push(n);let t=e.attributes;for(let i=0;i<t.length;i++){let o=t.item(i),s=o.name,a=s.toLowerCase();if(!oq.hasOwnProperty(a)){this.sanitizedSomething=!0;continue}let c=o.value;sF[a]&&(c=Qf(c)),this.buf.push(" ",s,'="',ex(c),'"')}return this.buf.push(">"),!0}endElement(e){let n=Z0(e).toLowerCase();J0.hasOwnProperty(n)&&!rF.hasOwnProperty(n)&&(this.buf.push("</"),this.buf.push(n),this.buf.push(">"))}chars(e){this.buf.push(ex(e))}};function aq(r,e){return(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function cq(r){let e=r.nextSibling;if(e&&r!==e.previousSibling)throw aF(e);return e}function lq(r){let e=r.firstChild;if(e&&aq(r,e))throw aF(e);return e}function Z0(r){let e=r.nodeName;return typeof e=="string"?e:"FORM"}function aF(r){return new Error(`Failed to sanitize html because the element is clobbered: ${r.outerHTML}`)}var uq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,dq=/([^\#-~ |!])/g;function ex(r){return r.replace(/&/g,"&amp;").replace(uq,function(e){let n=e.charCodeAt(0),t=e.charCodeAt(1);return"&#"+((n-55296)*1024+(t-56320)+65536)+";"}).replace(dq,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}var a_;function G_(r,e){let n=null;try{a_=a_||X4(r);let t=e?String(e):"";n=a_.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=n.innerHTML,n=a_.getInertBodyElement(t)}while(t!==o);let a=new IR().sanitizeChildren(tx(n)||n);return B_(a)}finally{if(n){let t=tx(n)||n;for(;t.firstChild;)t.firstChild.remove()}}}function tx(r){return"content"in r&&hq(r)?r.content:null}function hq(r){return r.nodeType===Node.ELEMENT_NODE&&r.nodeName==="TEMPLATE"}var fq=/^>|^->|<!--|-->|--!>|<!-$/g,gq=/(<|>)/g,mq="\u200B$1\u200B";function pq(r){return r.replace(fq,e=>e.replace(gq,mq))}function Eq(r,e){return r.createText(e)}function _q(r,e,n){r.setValue(e,n)}function Tq(r,e){return r.createComment(pq(e))}function cF(r,e,n){return r.createElement(e,n)}function y_(r,e,n,t,i){r.insertBefore(e,n,t,i)}function lF(r,e,n){r.appendChild(e,n)}function nx(r,e,n,t,i){t!==null?y_(r,e,n,t,i):lF(r,e,n)}function uF(r,e,n,t){r.removeChild(null,e,n,t)}function Iq(r,e,n){r.setAttribute(e,"style",n)}function vq(r,e,n){n===""?r.removeAttribute(e,"class"):r.setAttribute(e,"class",n)}function dF(r,e,n){let{mergedAttrs:t,classes:i,styles:o}=n;t!==null&&R4(r,e,t),i!==null&&vq(r,e,i),o!==null&&Iq(r,e,o)}var ci=(function(r){return r[r.NONE=0]="NONE",r[r.HTML=1]="HTML",r[r.STYLE=2]="STYLE",r[r.SCRIPT=3]="SCRIPT",r[r.URL=4]="URL",r[r.RESOURCE_URL=5]="RESOURCE_URL",r})(ci||{});function yq(r){let e=rD();return e?X0(e.sanitize(ci.HTML,r)||""):Ro(r,"HTML")?X0(Gr(r)):G_(QR(),Ur(r))}function Sq(r){let e=rD();return e?e.sanitize(ci.STYLE,r)||"":Ro(r,"Style")?Gr(r):Ur(r)}function Aq(r){let e=rD();return e?e.sanitize(ci.URL,r)||"":Ro(r,"URL")?Gr(r):Qf(Ur(r))}function rD(){let r=ce();return r&&r[po].sanitizer}function Rq(r){return r.ownerDocument.defaultView}function Dq(r){return r.ownerDocument}function Cq(r){return r instanceof Function?r():r}function Nq(r,e,n){let t=r.length;for(;;){let i=r.indexOf(e,n);if(i===-1)return i;if(i===0||r.charCodeAt(i-1)<=32){let o=e.length;if(i+o===t||r.charCodeAt(i+o)<=32)return i}n=i+1}}var hF="ng-template";function Oq(r,e,n,t){let i=0;if(t){for(;i<e.length&&typeof e[i]=="string";i+=2)if(e[i]==="class"&&Nq(e[i+1].toLowerCase(),n,0)!==-1)return!0}else if(iD(r))return!1;if(i=e.indexOf(1,i),i>-1){let o;for(;++i<e.length&&typeof(o=e[i])=="string";)if(o.toLowerCase()===n)return!0}return!1}function iD(r){return r.type===4&&r.value!==hF}function wq(r,e,n){let t=r.type===4&&!n?hF:r.value;return e===t}function bq(r,e,n){let t=4,i=r.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&&!Pi(t)&&!Pi(c))return!1;if(s&&Pi(c))continue;s=!1,t=c|t&1;continue}if(!s)if(t&4){if(t=2|t&1,c!==""&&!wq(r,c,n)||c===""&&e.length===1){if(Pi(t))return!1;s=!0}}else if(t&8){if(i===null||!Oq(r,i,c,n)){if(Pi(t))return!1;s=!0}}else{let l=e[++a],u=Lq(c,i,iD(r),n);if(u===-1){if(Pi(t))return!1;s=!0;continue}if(l!==""){let d;if(u>o?d="":d=i[u+1].toLowerCase(),t&2&&l!==d){if(Pi(t))return!1;s=!0}}}}return Pi(t)||s}function Pi(r){return(r&1)===0}function Lq(r,e,n,t){if(e===null)return-1;let i=0;if(t||!n){let o=!1;for(;i<e.length;){let s=e[i];if(s===r)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 xq(e,r)}function fF(r,e,n=!1){for(let t=0;t<e.length;t++)if(bq(r,e[t],n))return!0;return!1}function Mq(r){let e=r.attrs;if(e!=null){let n=e.indexOf(5);if((n&1)===0)return e[n+1]}return null}function Pq(r){for(let e=0;e<r.length;e++){let n=r[e];if(D4(n))return e}return r.length}function xq(r,e){let n=r.indexOf(4);if(n>-1)for(n++;n<r.length;){let t=r[n];if(typeof t=="number")return-1;if(t===e)return n;n++}return-1}function Fq(r,e){e:for(let n=0;n<e.length;n++){let t=e[n];if(r.length===t.length){for(let i=0;i<r.length;i++)if(r[i]!==t[i])continue e;return!0}}return!1}function rx(r,e){return r?":not("+e.trim()+")":e}function kq(r){let e=r[0],n=1,t=2,i="",o=!1;for(;n<r.length;){let s=r[n];if(typeof s=="string")if(t&2){let a=r[++n];i+="["+s+(a.length>0?'="'+a+'"':"")+"]"}else t&8?i+="."+s:t&4&&(i+=" "+s);else i!==""&&!Pi(s)&&(e+=rx(o,i),i=""),t=s,o=o||!Pi(t);n++}return i!==""&&(e+=rx(o,i)),e}function Uq(r){return r.map(kq).join(",")}function Vq(r){let e=[],n=[],t=1,i=2;for(;t<r.length;){let o=r[t];if(typeof o=="string")i===2?o!==""&&e.push(o,r[++t]):i===8&&n.push(o);else{if(!Pi(i))break;i=o}t++}return n.length&&e.push(1,...n),e}var Cn={};function oD(r,e,n,t,i,o,s,a,c,l,u){let d=et+t,f=d+i,g=Bq(d,f),p=typeof l=="function"?l():l;return g[Te]={type:r,blueprint:g,template:n,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 Bq(r,e){let n=[];for(let t=0;t<e;t++)n.push(t<r?null:Cn);return n}function Gq(r){let e=r.tView;return e===null||e.incompleteFirstPass?r.tView=oD(1,null,r.template,r.decls,r.vars,r.directiveDefs,r.pipeDefs,r.viewQuery,r.schemas,r.consts,r.id):e}function sD(r,e,n,t,i,o,s,a,c,l,u){let d=e.blueprint.slice();return d[bi]=i,d[Re]=t|4|128|8|64|1024,(l!==null||r&&r[Re]&2048)&&(d[Re]|=2048),wA(d),d[fn]=d[Vc]=r,d[$t]=n,d[po]=s||r&&r[po],d[Ze]=a||r&&r[Ze],d[as]=c||r&&r[as]||null,d[ar]=o,d[Ff]=B4(),d[Uc]=u,d[RA]=l,d[Yn]=e.type==2?r[Yn]:d,d}function $q(r,e,n){let t=oi(e,r),i=Gq(n),o=r[po].rendererFactory,s=aD(r,sD(r,i,null,gF(n),t,e,null,o.createRenderer(t,n),null,null,null));return r[e.index]=s}function gF(r){let e=16;return r.signals?e=4096:r.onPush&&(e=64),e}function mF(r,e,n,t){if(n===0)return-1;let i=e.length;for(let o=0;o<n;o++)e.push(t),r.blueprint.push(t),r.data.push(null);return i}function aD(r,e){return r[Wu]?r[AA][ri]=e:r[Wu]=e,r[AA]=e,e}function jq(r=1){pF(tt(),ce(),ai()+r,!1)}function pF(r,e,n,t){if(!t)if((e[Re]&3)===3){let o=r.preOrderCheckHooks;o!==null&&d_(e,o,n)}else{let o=r.preOrderHooks;o!==null&&h_(e,o,0,n)}aa(n)}var $_=(function(r){return r[r.None=0]="None",r[r.SignalBased=1]="SignalBased",r[r.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",r})($_||{});function vR(r,e,n,t){let i=Ae(null);try{let[o,s,a]=r.inputs[n],c=null;(s&$_.SignalBased)!==0&&(c=e[o][Rn]),c!==null&&c.transformFn!==void 0?t=c.transformFn(t):a!==null&&(t=a.call(e,t)),r.setInput!==null?r.setInput(e,c,t,n,o):Ox(e,c,o,t)}finally{Ae(i)}}var xi=(function(r){return r[r.Important=1]="Important",r[r.DashCase=2]="DashCase",r})(xi||{}),Hq;function cD(r,e){return Hq(r,e)}var Xc=new Set,j_=(function(r){return r[r.CHANGE_DETECTION=0]="CHANGE_DETECTION",r[r.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",r})(j_||{}),el=new ee(""),ix=new Set;function ps(r){ix.has(r)||(ix.add(r),performance?.mark?.("mark_feature_usage",{detail:{feature:r}}))}var EF=!1,yR=class extends Ot{__isAsync;destroyRef=void 0;pendingTasks=void 0;constructor(e=!1){super(),this.__isAsync=e,SA()&&(this.destroyRef=J(lr,{optional:!0})??void 0,this.pendingTasks=J(ca,{optional:!0})??void 0)}emit(e){let n=Ae(null);try{super.next(e)}finally{Ae(n)}}subscribe(e,n,t){let i=e,o=n||(()=>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 mt&&e.add(a),a}wrapInTimeout(e){return n=>{let t=this.pendingTasks?.add();setTimeout(()=>{try{e(n)}finally{t!==void 0&&this.pendingTasks?.remove(t)}})}}},us=yR;function _F(r){let e,n;function t(){r=Kc;try{n!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(n),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{r(),t()}),typeof requestAnimationFrame=="function"&&(n=requestAnimationFrame(()=>{r(),t()})),()=>t()}function ox(r){return queueMicrotask(()=>r()),()=>{r=Kc}}var lD="isAngularZone",S_=lD+"_ID",Wq=0,Me=class r{hasPendingMacrotasks=!1;hasPendingMicrotasks=!1;isStable=!0;onUnstable=new us(!1);onMicrotaskEmpty=new us(!1);onStable=new us(!1);onError=new us(!1);constructor(e){let{enableLongStackTrace:n=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:i=!1,scheduleInRootZone:o=EF}=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)),n&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!i&&t,s.shouldCoalesceRunChangeDetection=i,s.callbackScheduled=!1,s.scheduleInRootZone=o,Kq(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(lD)===!0}static assertInAngularZone(){if(!r.isInAngularZone())throw new oe(909,!1)}static assertNotInAngularZone(){if(r.isInAngularZone())throw new oe(909,!1)}run(e,n,t){return this._inner.run(e,n,t)}runTask(e,n,t,i){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,e,zq,Kc,Kc);try{return o.runTask(s,n,t)}finally{o.cancelTask(s)}}runGuarded(e,n,t){return this._inner.runGuarded(e,n,t)}runOutsideAngular(e){return this._outer.run(e)}},zq={};function uD(r){if(r._nesting==0&&!r.hasPendingMicrotasks&&!r.isStable)try{r._nesting++,r.onMicrotaskEmpty.emit(null)}finally{if(r._nesting--,!r.hasPendingMicrotasks)try{r.runOutsideAngular(()=>r.onStable.emit(null))}finally{r.isStable=!0}}}function qq(r){if(r.isCheckStableRunning||r.callbackScheduled)return;r.callbackScheduled=!0;function e(){_F(()=>{r.callbackScheduled=!1,SR(r),r.isCheckStableRunning=!0,uD(r),r.isCheckStableRunning=!1})}r.scheduleInRootZone?Zone.root.run(()=>{e()}):r._outer.run(()=>{e()}),SR(r)}function Kq(r){let e=()=>{qq(r)},n=Wq++;r._inner=r._inner.fork({name:"angular",properties:{[lD]:!0,[S_]:n,[S_+n]:!0},onInvokeTask:(t,i,o,s,a,c)=>{if(Yq(c))return t.invokeTask(o,s,a,c);try{return sx(r),t.invokeTask(o,s,a,c)}finally{(r.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||r.shouldCoalesceRunChangeDetection)&&e(),ax(r)}},onInvoke:(t,i,o,s,a,c,l)=>{try{return sx(r),t.invoke(o,s,a,c,l)}finally{r.shouldCoalesceRunChangeDetection&&!r.callbackScheduled&&!Qq(c)&&e(),ax(r)}},onHasTask:(t,i,o,s)=>{t.hasTask(o,s),i===o&&(s.change=="microTask"?(r._hasPendingMicrotasks=s.microTask,SR(r),uD(r)):s.change=="macroTask"&&(r.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,i,o,s)=>(t.handleError(o,s),r.runOutsideAngular(()=>r.onError.emit(s)),!1)})}function SR(r){r._hasPendingMicrotasks||(r.shouldCoalesceEventChangeDetection||r.shouldCoalesceRunChangeDetection)&&r.callbackScheduled===!0?r.hasPendingMicrotasks=!0:r.hasPendingMicrotasks=!1}function sx(r){r._nesting++,r.isStable&&(r.isStable=!1,r.onUnstable.emit(null))}function ax(r){r._nesting--,uD(r)}var rd=class{hasPendingMicrotasks=!1;hasPendingMacrotasks=!1;isStable=!0;onUnstable=new us;onMicrotaskEmpty=new us;onStable=new us;onError=new us;run(e,n,t){return e.apply(n,t)}runGuarded(e,n,t){return e.apply(n,t)}runOutsideAngular(e){return e()}runTask(e,n,t,i){return e.apply(n,t)}};function Yq(r){return TF(r,"__ignore_ng_zone__")}function Qq(r){return TF(r,"__scheduler_tick__")}function TF(r,e){return!Array.isArray(r)||r.length!==1?!1:r[0]?.data?.[e]===!0}function IF(r="zone.js",e){return r==="noop"?new rd:r==="zone.js"?new Me(e):r}var dD=(()=>{class r{impl=null;execute(){this.impl?.execute()}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})(),vF=[0,1,2,3],yF=(()=>{class r{ngZone=J(Me);scheduler=J(ni);errorHandler=J(kr,{optional:!0});sequences=new Set;deferredRegistrations=new Set;executing=!1;constructor(){J(el,{optional:!0})}execute(){let n=this.sequences.size>0;n&&dt(16),this.executing=!0;for(let t of vF)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(),n&&dt(17)}register(n){let{view:t}=n;t!==void 0?((t[Gc]??=[]).push(n),sa(t),t[Re]|=8192):this.executing?this.deferredRegistrations.add(n):this.addSequence(n)}addSequence(n){this.sequences.add(n),this.scheduler.notify(7)}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,t){return t?t.run(j_.AFTER_NEXT_RENDER,n):n()}static \u0275prov=K({token:r,providedIn:"root",factory:()=>new r})}return r})(),A_=class{impl;hooks;view;once;snapshot;erroredOrDestroyed=!1;pipelinedValue=void 0;unregisterOnDestroy;constructor(e,n,t,i,o,s=null){this.impl=e,this.hooks=n,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?.[Gc];e&&(this.view[Gc]=e.filter(n=>n!==this))}};function Xq(r,e){let n=e?.injector??J(ut);return ps("NgAfterNextRender"),Zq(r,n,e,!0)}function Jq(r){return r instanceof Function?[void 0,void 0,r,void 0]:[r.earlyRead,r.write,r.mixedReadWrite,r.read]}function Zq(r,e,n,t){let i=e.get(dD);i.impl??=e.get(yF);let o=e.get(el,null,{optional:!0}),s=n?.manualCleanup!==!0?e.get(lr):null,a=e.get(Xu,null,{optional:!0}),c=new A_(i.impl,Jq(r),a?.view,t,s,o?.snapshot(null));return i.impl.register(c),c}var SF=new ee("",{providedIn:"root",factory:()=>({queue:new Set,isScheduled:!1,scheduler:null})});function AF(r,e,n){let t=r.get(SF);if(Array.isArray(e))for(let i of e)t.queue.add(i),n?.detachedLeaveAnimationFns?.push(i);else t.queue.add(e),n?.detachedLeaveAnimationFns?.push(e);t.scheduler&&t.scheduler(r)}function e8(r,e){let n=r.get(SF);if(e.detachedLeaveAnimationFns){for(let t of e.detachedLeaveAnimationFns)n.queue.delete(t);e.detachedLeaveAnimationFns=void 0}}function t8(r,e){for(let[n,t]of e)AF(r,t.animateFns)}function cx(r,e,n,t){let i=r?.[$c]?.enter;e!==null&&i&&i.has(n.index)&&t8(t,i)}function Zu(r,e,n,t,i,o,s,a){if(i!=null){let c,l=!1;Li(i)?c=i:_o(i)&&(l=!0,i=i[bi]);let u=ii(i);r===0&&t!==null?(cx(a,t,o,n),s==null?lF(e,t,u):y_(e,t,u,s||null,!0)):r===1&&t!==null?(cx(a,t,o,n),y_(e,t,u,s||null,!0)):r===2?lx(a,o,n,d=>{uF(e,u,l,d)}):r===3&&lx(a,o,n,()=>{e.destroyNode(u)}),c!=null&&h8(e,r,n,c,o,t,s)}}function n8(r,e){RF(r,e),e[bi]=null,e[ar]=null}function r8(r,e,n,t,i,o){t[bi]=i,t[ar]=e,W_(r,t,n,1,i,o)}function RF(r,e){e[po].changeDetectionScheduler?.notify(9),W_(r,e,e[Ze],2,null,null)}function i8(r){let e=r[Wu];if(!e)return JA(r[Te],r);for(;e;){let n=null;if(_o(e))n=e[Wu];else{let t=e[jt];t&&(n=t)}if(!n){for(;e&&!e[ri]&&e!==r;)_o(e)&&JA(e[Te],e),e=e[fn];e===null&&(e=r),_o(e)&&JA(e[Te],e),n=e&&e[ri]}e=n}}function hD(r,e){let n=r[jc],t=n.indexOf(e);n.splice(t,1)}function H_(r,e){if(Hc(e))return;let n=e[Ze];n.destroyNode&&W_(r,e,n,3,null,null),i8(e)}function JA(r,e){if(Hc(e))return;let n=Ae(null);try{e[Re]&=-129,e[Re]|=256,e[Vr]&&bc(e[Vr]),a8(r,e),s8(r,e),e[Te].type===1&&e[Ze].destroy();let t=e[ia];if(t!==null&&Li(e[fn])){t!==e[fn]&&hD(t,e);let i=e[Eo];i!==null&&i.detachView(r)}uR(e)}finally{Ae(n)}}function lx(r,e,n,t){let i=r?.[$c];if(i==null||i.leave==null||!i.leave.has(e.index))return t(!1);r&&Xc.add(r),AF(n,()=>{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),o8(r,t)}else r&&Xc.delete(r),t(!1)},i)}function o8(r,e){let n=r[$c]?.running;if(n){n.then(()=>{r[$c].running=void 0,Xc.delete(r),e(!0)});return}e(!1)}function s8(r,e){let n=r.cleanup,t=e[Hu];if(n!==null)for(let s=0;s<n.length-1;s+=2)if(typeof n[s]=="string"){let a=n[s+3];a>=0?t[a]():t[-a].unsubscribe(),s+=2}else{let a=t[n[s+1]];n[s].call(a)}t!==null&&(e[Hu]=null);let i=e[is];if(i!==null){e[is]=null;for(let s=0;s<i.length;s++){let a=i[s];a()}}let o=e[cs];if(o!==null){e[cs]=null;for(let s of o)s.destroy()}}function a8(r,e){let n;if(r!=null&&(n=r.destroyHooks)!=null)for(let t=0;t<n.length;t+=2){let i=e[n[t]];if(!(i instanceof Qc)){let o=n[t+1];if(Array.isArray(o))for(let s=0;s<o.length;s+=2){let a=i[o[s]],c=o[s+1];dt(4,a,c);try{c.call(a)}finally{dt(5,a,c)}}else{dt(4,i,o);try{o.call(i)}finally{dt(5,i,o)}}}}}function DF(r,e,n){return c8(r,e.parent,n)}function c8(r,e,n){let t=e;for(;t!==null&&t.type&168;)e=t,t=e.parent;if(t===null)return n[bi];if(ls(t)){let{encapsulation:i}=r.data[t.directiveStart+t.componentOffset];if(i===ds.None||i===ds.Emulated)return null}return oi(t,n)}function CF(r,e,n){return u8(r,e,n)}function l8(r,e,n){return r.type&40?oi(r,n):null}var u8=l8,ux;function fD(r,e,n,t){let i=DF(r,t,e),o=e[Ze],s=t.parent||e[ar],a=CF(s,t,e);if(i!=null)if(Array.isArray(n))for(let c=0;c<n.length;c++)nx(o,i,n[c],a,!1);else nx(o,i,n,a,!1);ux!==void 0&&ux(o,t,e,n,i)}function Hf(r,e){if(e!==null){let n=e.type;if(n&3)return oi(e,r);if(n&4)return AR(-1,r[e.index]);if(n&8){let t=e.child;if(t!==null)return Hf(r,t);{let i=r[e.index];return Li(i)?AR(-1,i):ii(i)}}else{if(n&128)return Hf(r,e.next);if(n&32)return cD(e,r)()||ii(r[e.index]);{let t=NF(r,e);if(t!==null){if(Array.isArray(t))return t[0];let i=ea(r[Yn]);return Hf(i,t)}else return Hf(r,e.next)}}}return null}function NF(r,e){if(e!==null){let t=r[Yn][ar],i=e.projection;return t.projection[i]}return null}function AR(r,e){let n=jt+r+1;if(n<e.length){let t=e[n],i=t[Te].firstChild;if(i!==null)return Hf(t,i)}return e[oa]}function gD(r,e,n,t,i,o,s){for(;n!=null;){let a=t[as];if(n.type===128){n=n.next;continue}let c=t[n.index],l=n.type;if(s&&e===0&&(c&&nd(ii(c),t),n.flags|=2),!V_(n))if(l&8)gD(r,e,n.child,t,i,o,!1),Zu(e,r,a,i,c,n,o,t);else if(l&32){let u=cD(n,t),d;for(;d=u();)Zu(e,r,a,i,d,n,o,t);Zu(e,r,a,i,c,n,o,t)}else l&16?OF(r,e,t,n,i,o):Zu(e,r,a,i,c,n,o,t);n=s?n.projectionNext:n.next}}function W_(r,e,n,t,i,o){gD(n,t,r.firstChild,e,i,o,!1)}function d8(r,e,n){let t=e[Ze],i=DF(r,n,e),o=n.parent||e[ar],s=CF(o,n,e);OF(t,0,e,n,i,s)}function OF(r,e,n,t,i,o){let s=n[Yn],c=s[ar].projection[t.projection];if(Array.isArray(c))for(let l=0;l<c.length;l++){let u=c[l];Zu(e,r,n[as],i,u,t,o,n)}else{let l=c,u=s[fn];Wx(t)&&(l.flags|=128),gD(r,e,l,u,i,o,!0)}}function h8(r,e,n,t,i,o,s){let a=t[oa],c=ii(t);a!==c&&Zu(e,r,n,o,a,i,s);for(let l=jt;l<t.length;l++){let u=t[l];W_(u[Te],u,r,e,o,a)}}function f8(r,e,n,t,i){if(e)i?r.addClass(n,t):r.removeClass(n,t);else{let o=t.indexOf("-")===-1?void 0:xi.DashCase;i==null?r.removeStyle(n,t,o):(typeof i=="string"&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=xi.Important),r.setStyle(n,t,i,o))}}function wF(r,e,n,t,i){let o=ai(),s=t&2;try{aa(-1),s&&e.length>et&&pF(r,e,et,!1),dt(s?2:0,i,n),n(t,i)}finally{aa(o),dt(s?3:1,i,n)}}function z_(r,e,n){_8(r,e,n),(n.flags&64)===64&&T8(r,e,n)}function Jf(r,e,n=oi){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?n(e,r):r[s];r[i++]=a}}}function g8(r,e,n,t){let o=t.get(Zx,Jx)||n===ds.ShadowDom,s=r.selectRootElement(e,o);return m8(s),s}function m8(r){p8(r)}var p8=()=>null;function E8(r){return r==="class"?"className":r==="for"?"htmlFor":r==="formaction"?"formAction":r==="innerHtml"?"innerHTML":r==="readonly"?"readOnly":r==="tabindex"?"tabIndex":r}function bF(r,e,n,t,i,o){let s=e[Te];if(q_(r,s,e,n,t)){ls(r)&&MF(e,r.index);return}r.type&3&&(n=E8(n)),LF(r,e,n,t,i,o)}function LF(r,e,n,t,i,o){if(r.type&3){let s=oi(r,e);t=o!=null?o(t,r.value||"",n):t,i.setProperty(s,n,t)}else r.type&12}function MF(r,e){let n=si(e,r);n[Re]&16||(n[Re]|=64)}function _8(r,e,n){let t=n.directiveStart,i=n.directiveEnd;ls(n)&&$q(e,n,r.data[t+n.componentOffset]),r.firstCreatePass||I_(n,e);let o=n.initialInputs;for(let s=t;s<i;s++){let a=r.data[s],c=zf(e,r,s,n);if(nd(c,e),o!==null&&y8(e,s-t,c,a,n,o),Mi(a)){let l=si(n.index,e);l[$t]=zf(e,r,s,n)}}}function T8(r,e,n){let t=n.directiveStart,i=n.directiveEnd,o=n.index,s=P0();try{aa(o);for(let a=t;a<i;a++){let c=r.data[a],l=e[a];JE(a),(c.hostBindings!==null||c.hostVars!==0||c.hostAttrs!==null)&&I8(c,l)}}finally{aa(-1),JE(s)}}function I8(r,e){r.hostBindings!==null&&r.hostBindings(1,e)}function mD(r,e){let n=r.directiveRegistry,t=null;if(n)for(let i=0;i<n.length;i++){let o=n[i];fF(e,o.selectors,!1)&&(t??=[],Mi(o)?t.unshift(o):t.push(o))}return t}function v8(r,e,n,t,i,o){let s=oi(r,e);PF(e[Ze],s,o,r.value,n,t,i)}function PF(r,e,n,t,i,o,s){if(o==null)r.removeAttribute(e,i,n);else{let a=s==null?Ur(o):s(o,t||"",i);r.setAttribute(e,i,a,n)}}function y8(r,e,n,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];vR(t,n,c,l)}}function pD(r,e,n,t,i){let o=et+n,s=e[Te],a=i(s,e,r,t,n);e[o]=a,zc(r,!0);let c=r.type===2;return c?(dF(e[Ze],a,r),(D0()===0||zu(r))&&nd(a,e),C0()):nd(a,e),n_()&&(!c||!V_(r))&&fD(s,e,a,r),r}function ED(r){let e=r;return VA()?BA():(e=e.parent,zc(e,!1)),e}function S8(r,e){let n=r[as];if(!n)return;let t;try{t=n.get(Io,null)}catch{t=null}t?.(e)}function q_(r,e,n,t,i){let o=r.inputs?.[t],s=r.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];vR(d,n[l],u,i),a=!0}if(o)for(let c of o){let l=n[c],u=e.data[c];vR(u,l,t,i),a=!0}return a}function A8(r,e){let n=si(e,r),t=n[Te];R8(t,n);let i=n[bi];i!==null&&n[Uc]===null&&(n[Uc]=eF(i,n[as])),dt(18),_D(t,n,n[$t]),dt(19,n[$t])}function R8(r,e){for(let n=e.length;n<r.blueprint.length;n++)e.push(r.blueprint[n])}function _D(r,e,n){e_(e);try{let t=r.viewQuery;t!==null&&hR(1,t,n);let i=r.template;i!==null&&wF(r,e,i,1,n),r.firstCreatePass&&(r.firstCreatePass=!1),e[Eo]?.finishViewCreation(r),r.staticContentQueries&&tF(r,e),r.staticViewQueries&&hR(2,r.viewQuery,n);let o=r.components;o!==null&&D8(e,o)}catch(t){throw r.firstCreatePass&&(r.incompleteFirstPass=!0,r.firstCreatePass=!1),t}finally{e[Re]&=-5,t_()}}function D8(r,e){for(let n=0;n<e.length;n++)A8(r,e[n])}function Zf(r,e,n,t){let i=Ae(null);try{let o=e.tView,a=r[Re]&4096?4096:16,c=sD(r,o,n,a,null,e,null,null,t?.injector??null,t?.embeddedViewInjector??null,t?.dehydratedView??null),l=r[e.index];c[ia]=l;let u=r[Eo];return u!==null&&(c[Eo]=u.createEmbeddedView(o)),_D(o,c,n),c}finally{Ae(i)}}function id(r,e){return!e||e.firstChild===null||Wx(r)}function qf(r,e,n,t,i=!1){for(;n!==null;){if(n.type===128){n=i?n.projectionNext:n.next;continue}let o=e[n.index];o!==null&&t.push(ii(o)),Li(o)&&xF(o,t);let s=n.type;if(s&8)qf(r,e,n.child,t);else if(s&32){let a=cD(n,e),c;for(;c=a();)t.push(c)}else if(s&16){let a=NF(e,n);if(Array.isArray(a))t.push(...a);else{let c=ea(e[Yn]);qf(c[Te],c,a,t,!0)}}n=i?n.projectionNext:n.next}return t}function xF(r,e){for(let n=jt;n<r.length;n++){let t=r[n],i=t[Te].firstChild;i!==null&&qf(t[Te],t,i,e)}r[oa]!==r[bi]&&e.push(r[oa])}function FF(r){if(r[Gc]!==null){for(let e of r[Gc])e.impl.addSequence(e);r[Gc].length=0}}var kF=[];function C8(r){return r[Vr]??N8(r)}function N8(r){let e=kF.pop()??Object.create(w8);return e.lView=r,e}function O8(r){r.lView[Vr]!==r&&(r.lView=null,kF.push(r))}var w8=le(x({},Oc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:r=>{sa(r.lView)},consumerOnSignalRead(){this.lView[Vr]=this}});function b8(r){let e=r[Vr]??Object.create(L8);return e.lView=r,e}var L8=le(x({},Oc),{consumerIsAlwaysLive:!0,kind:"template",consumerMarkedDirty:r=>{let e=ea(r.lView);for(;e&&!UF(e[Te]);)e=ea(e);e&&YE(e)},consumerOnSignalRead(){this.lView[Vr]=this}});function UF(r){return r.type!==2}function VF(r){if(r[cs]===null)return;let e=!0;for(;e;){let n=!1;for(let t of r[cs])t.dirty&&(n=!0,t.zone===null||Zone.current===t.zone?t.run():t.zone.run(()=>t.run()));e=n&&!!(r[Re]&8192)}}var M8=100;function BF(r,e=0){let t=r[po].rendererFactory,i=!1;i||t.begin?.();try{P8(r,e)}finally{i||t.end?.()}}function P8(r,e){let n=$A();try{Yu(!0),RR(r,e);let t=0;for(;Ku(r);){if(t===M8)throw new oe(103,!1);t++,RR(r,1)}}finally{Yu(n)}}function x8(r,e,n,t){if(Hc(e))return;let i=e[Re],o=!1,s=!1;e_(e);let a=!0,c=null,l=null;o||(UF(r)?(l=C8(e),c=wc(l)):AE()===null?(a=!1,l=b8(e),c=wc(l)):e[Vr]&&(bc(e[Vr]),e[Vr]=null));try{wA(e),b0(r.bindingStartIndex),n!==null&&wF(r,e,n,2,t);let u=(i&3)===3;if(!o)if(u){let g=r.preOrderCheckHooks;g!==null&&d_(e,g,null)}else{let g=r.preOrderHooks;g!==null&&h_(e,g,0,null),QA(e,0)}if(s||F8(e),VF(e),GF(e,0),r.contentQueries!==null&&tF(r,e),!o)if(u){let g=r.contentCheckHooks;g!==null&&d_(e,g)}else{let g=r.contentHooks;g!==null&&h_(e,g,1),QA(e,1)}U8(r,e);let d=r.components;d!==null&&jF(e,d,0);let f=r.viewQuery;if(f!==null&&hR(2,f,t),!o)if(u){let g=r.viewCheckHooks;g!==null&&d_(e,g)}else{let g=r.viewHooks;g!==null&&h_(e,g,2),QA(e,2)}if(r.firstUpdatePass===!0&&(r.firstUpdatePass=!1),e[qE]){for(let g of e[qE])g();e[qE]=null}o||(FF(e),e[Re]&=-73)}catch(u){throw o||sa(e),u}finally{l!==null&&(xu(l,c),a&&O8(l)),t_()}}function GF(r,e){for(let n=qx(r);n!==null;n=Kx(n))for(let t=jt;t<n.length;t++){let i=n[t];$F(i,e)}}function F8(r){for(let e=qx(r);e!==null;e=Kx(e)){if(!(e[Re]&2))continue;let n=e[jc];for(let t=0;t<n.length;t++){let i=n[t];YE(i)}}}function k8(r,e,n){dt(18);let t=si(e,r);$F(t,n),dt(19,t[$t])}function $F(r,e){KE(r)&&RR(r,e)}function RR(r,e){let t=r[Te],i=r[Re],o=r[Vr],s=!!(e===0&&i&16);if(s||=!!(i&64&&e===0),s||=!!(i&1024),s||=!!(o?.dirty&&Fu(o)),s||=!1,o&&(o.dirty=!1),r[Re]&=-9217,s)x8(t,r,t.template,r[$t]);else if(i&8192){let a=Ae(null);try{VF(r),GF(r,1);let c=t.components;c!==null&&jF(r,c,1),FF(r)}finally{Ae(a)}}}function jF(r,e,n){for(let t=0;t<e.length;t++)k8(r,e[t],n)}function U8(r,e){let n=r.hostBindingOpCodes;if(n!==null)try{for(let t=0;t<n.length;t++){let i=n[t];if(i<0)aa(~i);else{let o=i,s=n[++t],a=n[++t];M0(s,o);let c=e[o];dt(24,c),a(2,c),dt(25,c)}}}finally{aa(-1)}}function TD(r,e){let n=$A()?64:1088;for(r[po].changeDetectionScheduler?.notify(e);r;){r[Re]|=n;let t=ea(r);if(qu(r)&&!t)return r;r=t}return null}function HF(r,e,n,t){return[r,!0,0,e,null,t,null,n,null,null]}function WF(r,e){let n=jt+e;if(n<r.length)return r[n]}function eg(r,e,n,t=!0){let i=e[Te];if(V8(i,e,r,n),t){let s=AR(n,r),a=e[Ze],c=a.parentNode(r[oa]);c!==null&&r8(i,r[ar],a,e,c,s)}let o=e[Uc];o!==null&&o.firstChild!==null&&(o.firstChild=null)}function zF(r,e){let n=Kf(r,e);return n!==void 0&&H_(n[Te],n),n}function Kf(r,e){if(r.length<=jt)return;let n=jt+e,t=r[n];if(t){let i=t[ia];i!==null&&i!==r&&hD(i,t),e>0&&(r[n-1][ri]=t[ri]);let o=Mf(r,jt+e);n8(t[Te],t);let s=o[Eo];s!==null&&s.detachView(o[Te]),t[fn]=null,t[ri]=null,t[Re]&=-129}return t}function V8(r,e,n,t){let i=jt+t,o=n.length;t>0&&(n[i-1][ri]=e),t<o-jt?(e[ri]=n[i],pA(n,jt+t,e)):(n.push(e),e[ri]=null),e[fn]=n;let s=e[ia];s!==null&&n!==s&&qF(s,e);let a=e[Eo];a!==null&&a.insertView(r),QE(e),e[Re]|=128}function qF(r,e){let n=r[jc],t=e[fn];if(_o(t))r[Re]|=2;else{let i=t[fn][Yn];e[Yn]!==i&&(r[Re]|=2)}n===null?r[jc]=[e]:n.push(e)}var la=class{_lView;_cdRefInjectingView;_appRef=null;_attachedToViewContainer=!1;exhaustive;get rootNodes(){let e=this._lView,n=e[Te];return qf(n,e,n.firstChild,[])}constructor(e,n){this._lView=e,this._cdRefInjectingView=n}get context(){return this._lView[$t]}set context(e){this._lView[$t]=e}get destroyed(){return Hc(this._lView)}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){let e=this._lView[fn];if(Li(e)){let n=e[kf],t=n?n.indexOf(this):-1;t>-1&&(Kf(e,t),Mf(n,t))}this._attachedToViewContainer=!1}H_(this._lView[Te],this._lView)}onDestroy(e){bA(this._lView,e)}markForCheck(){TD(this._cdRefInjectingView||this._lView,4)}detach(){this._lView[Re]&=-129}reattach(){QE(this._lView),this._lView[Re]|=128}detectChanges(){this._lView[Re]|=1024,BF(this._lView)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new oe(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=qu(this._lView),n=this._lView[ia];n!==null&&!e&&hD(n,this._lView),RF(this._lView[Te],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new oe(902,!1);this._appRef=e;let n=qu(this._lView),t=this._lView[ia];t!==null&&!n&&qF(t,this._lView),QE(this._lView)}};function B8(r){return Ku(r._lView)||!!(r._lView[Re]&64)}function G8(r){YE(r._lView)}var Ao=(()=>{class r{_declarationLView;_declarationTContainer;elementRef;static __NG_ELEMENT_ID__=$8;constructor(n,t,i){this._declarationLView=n,this._declarationTContainer=t,this.elementRef=i}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(n,t){return this.createEmbeddedViewImpl(n,t)}createEmbeddedViewImpl(n,t,i){let o=Zf(this._declarationLView,this._declarationTContainer,n,{embeddedViewInjector:t,dehydratedView:i});return new la(o)}}return r})();function $8(){return K_(gn(),ce())}function K_(r,e){return r.type&4?new Ao(e,r,fd(r,e)):null}function tl(r,e,n,t,i){let o=r.data[e];if(o===null)o=j8(r,e,n,t,i),L0()&&(o.flags|=32);else if(o.type&64){o.type=n,o.value=t,o.attrs=i;let s=w0();o.injectorIndex=s===null?-1:s.injectorIndex}return zc(o,!0),o}function j8(r,e,n,t,i){let o=UA(),s=VA(),a=s?o:o&&o.parent,c=r.data[e]=W8(r,a,n,e,t,i);return H8(r,c,o,s),c}function H8(r,e,n,t){r.firstChild===null&&(r.firstChild=e),n!==null&&(t?n.child==null&&e.parent!==null&&(n.child=e):n.next===null&&(n.next=e,e.prev=n))}function W8(r,e,n,t,i,o){let s=e?e.injectorIndex:-1,a=0;return xA()&&(a|=128),{type:n,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 Xpe=new RegExp(`^(\\d+)*(${W4}|${H4})*(.*)`);function z8(r){let e=r[DA]??[],t=r[fn][Ze],i=[];for(let o of e)o.data[Xx]!==void 0?i.push(o):q8(o,t);r[DA]=i}function q8(r,e){let n=0,t=r.firstChild;if(t){let i=r.data[Qx];for(;n<i;){let o=t.nextSibling;uF(e,t,!1),t=o,n++}}}var K8=()=>null,Y8=()=>null;function R_(r,e){return K8(r,e)}function KF(r,e,n){return Y8(r,e,n)}var YF=class{},Y_=class{},DR=class{resolveComponentFactory(e){throw new oe(917,!1)}},tg=class{static NULL=new DR},fs=class{},Q_=(()=>{class r{destroyNode=null;static __NG_ELEMENT_ID__=()=>Q8()}return r})();function Q8(){let r=ce(),e=gn(),n=si(e.index,r);return(_o(n)?n:r)[Ze]}var QF=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:()=>null})}return r})();var g_={},CR=class{injector;parentInjector;constructor(e,n){this.injector=e,this.parentInjector=n}get(e,n,t){let i=this.injector.get(e,g_,t);return i!==g_||n===g_?i:this.parentInjector.get(e,n,t)}};function D_(r,e,n){let t=n?r.styles:null,i=n?r.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=VE(i,a);else if(o==2){let c=a,l=e[++s];t=VE(t,c+": "+l+";")}}n?r.styles=t:r.stylesWithoutHost=t,n?r.classes=i:r.classesWithoutHost=i}function ht(r,e=0){let n=ce();if(n===null)return C(r,e);let t=gn();return Gx(t,n,hn(r),e)}function X8(){let r="invalid";throw new Error(r)}function XF(r,e,n,t,i){let o=t===null?null:{"":-1},s=i(r,n);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}e5(r,e,n,a,o,c,l)}o!==null&&t!==null&&J8(n,t,o)}function J8(r,e,n){let t=r.localNames=[];for(let i=0;i<e.length;i+=2){let o=n[e[i+1]];if(o==null)throw new oe(-301,!1);t.push(e[i],o)}}function Z8(r,e,n){e.componentOffset=n,(r.components??=[]).push(e.index)}function e5(r,e,n,t,i,o,s){let a=t.length,c=!1;for(let f=0;f<a;f++){let g=t[f];!c&&Mi(g)&&(c=!0,Z8(r,n,f)),cR(I_(n,e),r,g.type)}s5(n,r.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=mF(r,e,a,null);a>0&&(n.directiveToIndex=new Map);for(let f=0;f<a;f++){let g=t[f];if(n.mergedAttrs=td(n.mergedAttrs,g.hostAttrs),n5(r,n,e,d,g),o5(d,g,i),s!==null&&s.has(g)){let[_,T]=s.get(g);n.directiveToIndex.set(g.type,[d,_+n.directiveStart,T+n.directiveStart])}else(o===null||!o.has(g))&&n.directiveToIndex.set(g.type,d);g.contentQueries!==null&&(n.flags|=4),(g.hostBindings!==null||g.hostAttrs!==null||g.hostVars!==0)&&(n.flags|=64);let p=g.type.prototype;!l&&(p.ngOnChanges||p.ngOnInit||p.ngDoCheck)&&((r.preOrderHooks??=[]).push(n.index),l=!0),!u&&(p.ngOnChanges||p.ngDoCheck)&&((r.preOrderCheckHooks??=[]).push(n.index),u=!0),d++}t5(r,n,o)}function t5(r,e,n){for(let t=e.directiveStart;t<e.directiveEnd;t++){let i=r.data[t];if(n===null||!n.has(i))dx(0,e,i,t),dx(1,e,i,t),fx(e,t,!1);else{let o=n.get(i);hx(0,e,o,t),hx(1,e,o,t),fx(e,t,!0)}}}function dx(r,e,n,t){let i=r===0?n.inputs:n.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s;r===0?s=e.inputs??={}:s=e.outputs??={},s[o]??=[],s[o].push(t),JF(e,o)}}function hx(r,e,n,t){let i=r===0?n.inputs:n.outputs;for(let o in i)if(i.hasOwnProperty(o)){let s=i[o],a;r===0?a=e.hostDirectiveInputs??={}:a=e.hostDirectiveOutputs??={},a[s]??=[],a[s].push(t,o),JF(e,s)}}function JF(r,e){e==="class"?r.flags|=8:e==="style"&&(r.flags|=16)}function fx(r,e,n){let{attrs:t,inputs:i,hostDirectiveInputs:o}=r;if(t===null||!n&&i===null||n&&o===null||iD(r)){r.initialInputs??=[],r.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(!n&&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(n&&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}r.initialInputs??=[],r.initialInputs.push(s)}function n5(r,e,n,t,i){r.data[t]=i;let o=i.factory||(i.factory=Zs(i.type,!0)),s=new Qc(o,Mi(i),ht,null);r.blueprint[t]=s,n[t]=s,r5(r,e,t,mF(r,n,i.hostVars,Cn),i)}function r5(r,e,n,t,i){let o=i.hostBindings;if(o){let s=r.hostBindingOpCodes;s===null&&(s=r.hostBindingOpCodes=[]);let a=~e.index;i5(s)!=a&&s.push(a),s.push(n,t,o)}}function i5(r){let e=r.length;for(;e>0;){let n=r[--e];if(typeof n=="number"&&n<0)return n}return 0}function o5(r,e,n){if(n){if(e.exportAs)for(let t=0;t<e.exportAs.length;t++)n[e.exportAs[t]]=r;Mi(e)&&(n[""]=r)}}function s5(r,e,n){r.flags|=1,r.directiveStart=e,r.directiveEnd=e+n,r.providerIndexes=e}function ID(r,e,n,t,i,o,s,a){let c=e[Te],l=c.consts,u=Br(l,s),d=tl(c,r,n,t,u);return o&&XF(c,e,d,Br(l,a),i),d.mergedAttrs=td(d.mergedAttrs,d.attrs),d.attrs!==null&&D_(d,d.attrs,!1),d.mergedAttrs!==null&&D_(d,d.mergedAttrs,!0),c.queries!==null&&c.queries.elementStart(c,d),d}function vD(r,e){Mx(r,e),CA(e)&&r.queries.elementEnd(e)}function a5(r,e,n,t,i,o){let s=e.consts,a=Br(s,i),c=tl(e,r,n,t,a);if(c.mergedAttrs=td(c.mergedAttrs,c.attrs),o!=null){let l=Br(s,o);c.localNames=[];for(let u=0;u<l.length;u+=2)c.localNames.push(l[u],-1)}return c.attrs!==null&&D_(c,c.attrs,!1),c.mergedAttrs!==null&&D_(c,c.mergedAttrs,!0),e.queries!==null&&e.queries.elementStart(e,c),c}function yD(r){return X_(r)?Array.isArray(r)||!(r instanceof Map)&&Symbol.iterator in r:!1}function ZF(r,e){if(Array.isArray(r))for(let n=0;n<r.length;n++)e(r[n]);else{let n=r[Symbol.iterator](),t;for(;!(t=n.next()).done;)e(t.value)}}function X_(r){return r!==null&&(typeof r=="function"||typeof r=="object")}function Do(r,e,n){return r[e]=n}function ng(r,e){return r[e]}function xn(r,e,n){if(n===Cn)return!1;let t=r[e];return Object.is(t,n)?!1:(r[e]=n,!0)}function od(r,e,n,t){let i=xn(r,e,n);return xn(r,e+1,t)||i}function SD(r,e,n,t,i){let o=od(r,e,n,t);return xn(r,e+2,i)||o}function sd(r,e,n,t,i,o){let s=od(r,e,n,t);return od(r,e+2,i,o)||s}function m_(r,e,n){return function t(i){let o=ls(r)?si(r.index,e):e;TD(o,5);let s=e[$t],a=gx(e,s,n,i),c=t.__ngNextListenerFn__;for(;c;)a=gx(e,s,c,i)&&a,c=c.__ngNextListenerFn__;return a}}function gx(r,e,n,t){let i=Ae(null);try{return dt(6,e,n),n(t)!==!1}catch(o){return S8(r,o),!1}finally{dt(7,e,n),Ae(i)}}function ek(r,e,n,t,i,o,s,a){let c=zu(r),l=!1,u=null;if(!t&&c&&(u=l5(e,n,o,r.index)),u!==null){let d=u.__ngLastListenerFn__||u;d.__ngNextListenerFn__=s,u.__ngLastListenerFn__=s,l=!0}else{let d=oi(r,n),f=t?t(d):d;q4(n,f,o,a);let g=i.listen(f,o,a);if(!c5(o)){let p=t?_=>t(ii(_[r.index])):r.index;tk(p,e,n,o,a,g,!1)}}return l}function c5(r){return r.startsWith("animation")||r.startsWith("transition")}function l5(r,e,n,t){let i=r.cleanup;if(i!=null)for(let o=0;o<i.length-1;o+=2){let s=i[o];if(s===n&&i[o+1]===t){let a=e[Hu],c=i[o+2];return a&&a.length>c?a[c]:null}typeof s=="string"&&(o+=2)}return null}function tk(r,e,n,t,i,o,s){let a=e.firstCreatePass?MA(e):null,c=LA(n),l=c.length;c.push(i,o),a&&a.push(t,r,l,(l+1)*(s?-1:1))}function mx(r,e,n,t,i,o){let s=e[n],a=e[Te],l=a.data[n].outputs[t],d=s[l].subscribe(o);tk(r.index,a,e,i,o,d,!0)}var NR=Symbol("BINDING");var C_=class extends tg{ngModule;constructor(e){super(),this.ngModule=e}resolveComponentFactory(e){let n=ra(e);return new ad(n,this.ngModule)}};function u5(r){return Object.keys(r).map(e=>{let[n,t,i]=r[e],o={propName:n,templateName:e,isSignal:(t&$_.SignalBased)!==0};return i&&(o.transform=i),o})}function d5(r){return Object.keys(r).map(e=>({propName:r[e],templateName:e}))}function h5(r,e,n){let t=e instanceof Kn?e:e?.injector;return t&&r.getStandaloneInjector!==null&&(t=r.getStandaloneInjector(t)||t),t?new CR(n,t):n}function f5(r){let e=r.get(fs,null);if(e===null)throw new oe(407,!1);let n=r.get(QF,null),t=r.get(ni,null);return{rendererFactory:e,sanitizer:n,changeDetectionScheduler:t,ngReflect:!1}}function g5(r,e){let n=nk(r);return cF(e,n,n==="svg"?NA:n==="math"?I0:null)}function nk(r){return(r.selectors[0][0]||"div").toLowerCase()}var ad=class extends Y_{componentDef;ngModule;selector;componentType;ngContentSelectors;isBoundToModule;cachedInputs=null;cachedOutputs=null;get inputs(){return this.cachedInputs??=u5(this.componentDef.inputs),this.cachedInputs}get outputs(){return this.cachedOutputs??=d5(this.componentDef.outputs),this.cachedOutputs}constructor(e,n){super(),this.componentDef=e,this.ngModule=n,this.componentType=e.type,this.selector=Uq(e.selectors),this.ngContentSelectors=e.ngContentSelectors??[],this.isBoundToModule=!!n}create(e,n,t,i,o,s){dt(22);let a=Ae(null);try{let c=this.componentDef,l=m5(t,c,s,o),u=h5(c,i||this.ngModule,e),d=f5(u),f=d.rendererFactory.createRenderer(null,c),g=t?g8(f,t,c.encapsulation,u):g5(c,f),p=s?.some(px)||o?.some(R=>typeof R!="function"&&R.bindings.some(px)),_=sD(null,l,null,512|gF(c),null,null,d,f,u,null,eF(g,u,!0));_[et]=g,e_(_);let T=null;try{let R=ID(et,_,2,"#host",()=>l.directiveRegistry,!0,0);dF(f,g,R),nd(g,_),z_(l,_,R),XR(l,R,_),vD(l,R),n!==void 0&&E5(R,this.ngContentSelectors,n),T=si(R.index,_),_[$t]=T[$t],_D(l,_,null)}catch(R){throw T!==null&&uR(T),uR(_),R}finally{dt(23),t_()}return new N_(this.componentType,_,!!p)}finally{Ae(a)}}};function m5(r,e,n,t){let i=r?["ng-version","20.3.18"]:Vq(e.selectors[0]),o=null,s=null,a=0;if(n)for(let u of n)a+=u[NR].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[NR].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=zE(d);c.push(f)}return oD(0,null,p5(o,s),1,a,c,null,null,null,[i],null)}function p5(r,e){return!r&&!e?null:n=>{if(n&1&&r)for(let t of r)t.create();if(n&2&&e)for(let t of e)t.update()}}function px(r){let e=r[NR].kind;return e==="input"||e==="twoWay"}var N_=class extends YF{_rootLView;_hasInputBindings;instance;hostView;changeDetectorRef;componentType;location;previousInputValues=null;_tNode;constructor(e,n,t){super(),this._rootLView=n,this._hasInputBindings=t,this._tNode=Uf(n[Te],et),this.location=fd(this._tNode,n),this.instance=si(this._tNode.index,n)[$t],this.hostView=this.changeDetectorRef=new la(n,void 0),this.componentType=e}setInput(e,n){this._hasInputBindings;let t=this._tNode;if(this.previousInputValues??=new Map,this.previousInputValues.has(e)&&Object.is(this.previousInputValues.get(e),n))return;let i=this._rootLView,o=q_(t,i[Te],i,e,n);this.previousInputValues.set(e,n);let s=si(t.index,i);TD(s,1)}get injector(){return new Yc(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}};function E5(r,e,n){let t=r.projection=[];for(let i=0;i<e.length;i++){let o=n[i];t.push(o!=null&&o.length?Array.from(o):null)}}var Co=(()=>{class r{static __NG_ELEMENT_ID__=_5}return r})();function _5(){let r=gn();return ik(r,ce())}var T5=Co,rk=class extends T5{_lContainer;_hostTNode;_hostLView;constructor(e,n,t){super(),this._lContainer=e,this._hostTNode=n,this._hostLView=t}get element(){return fd(this._hostTNode,this._hostLView)}get injector(){return new Yc(this._hostTNode,this._hostLView)}get parentInjector(){let e=qR(this._hostTNode,this._hostLView);if(xx(e)){let n=__(e,this._hostLView),t=E_(e),i=n[Te].data[t+8];return new Yc(i,n)}else return new Yc(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){let n=Ex(this._lContainer);return n!==null&&n[e]||null}get length(){return this._lContainer.length-jt}createEmbeddedView(e,n,t){let i,o;typeof t=="number"?i=t:t!=null&&(i=t.index,o=t.injector);let s=R_(this._lContainer,e.ssrId),a=e.createEmbeddedViewImpl(n||{},o,s);return this.insertImpl(a,i,id(this._hostTNode,s)),a}createComponent(e,n,t,i,o,s,a){let c=e&&!E4(e),l;if(c)l=n;else{let T=n||{};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 ad(ra(e)),d=t||this.parentInjector;if(!o&&u.ngModule==null){let R=(c?d:this.parentInjector).get(Kn,null);R&&(o=R)}let f=ra(u.componentType??{}),g=R_(this._lContainer,f?.id??null),p=g?.firstChild??null,_=u.create(d,i,p,o,s,a);return this.insertImpl(_.hostView,l,id(this._hostTNode,g)),_}insert(e,n){return this.insertImpl(e,n,!0)}insertImpl(e,n,t){let i=e._lView;if(y0(i)){let a=this.indexOf(e);if(a!==-1)this.detach(a);else{let c=i[fn],l=new rk(c,c[ar],c[fn]);l.detach(l.indexOf(e))}}let o=this._adjustIndex(n),s=this._lContainer;return eg(s,i,o,t),e.attachToViewContainerRef(),pA(ZA(s),o,e),e}move(e,n){return this.insert(e,n)}indexOf(e){let n=Ex(this._lContainer);return n!==null?n.indexOf(e):-1}remove(e){let n=this._adjustIndex(e,-1),t=Kf(this._lContainer,n);t&&(Mf(ZA(this._lContainer),n),H_(t[Te],t))}detach(e){let n=this._adjustIndex(e,-1),t=Kf(this._lContainer,n);return t&&Mf(ZA(this._lContainer),n)!=null?new la(t):null}_adjustIndex(e,n=0){return e??this.length+n}};function Ex(r){return r[kf]}function ZA(r){return r[kf]||(r[kf]=[])}function ik(r,e){let n,t=e[r.index];return Li(t)?n=t:(n=HF(t,e,null,r),e[r.index]=n,aD(e,n)),v5(n,e,r,t),new rk(n,r,e)}function I5(r,e){let n=r[Ze],t=n.createComment(""),i=oi(e,r),o=n.parentNode(i);return y_(n,o,t,n.nextSibling(i),!1),t}var v5=A5,y5=()=>!1;function S5(r,e,n){return y5(r,e,n)}function A5(r,e,n,t){if(r[oa])return;let i;n.type&8?i=ii(t):i=I5(e,n),r[oa]=i}var OR=class r{queryList;matches=null;constructor(e){this.queryList=e}clone(){return new r(this.queryList)}setDirty(){this.queryList.setDirty()}},wR=class r{queries;constructor(e=[]){this.queries=e}createEmbeddedView(e){let n=e.queries;if(n!==null){let t=e.contentQueries!==null?e.contentQueries[0]:n.length,i=[];for(let o=0;o<t;o++){let s=n.getByIndex(o),a=this.queries[s.indexInDeclarationView];i.push(a.clone())}return new r(i)}return null}insertView(e){this.dirtyQueriesWithMatches(e)}detachView(e){this.dirtyQueriesWithMatches(e)}finishViewCreation(e){this.dirtyQueriesWithMatches(e)}dirtyQueriesWithMatches(e){for(let n=0;n<this.queries.length;n++)RD(e,n).matches!==null&&this.queries[n].setDirty()}},O_=class{flags;read;predicate;constructor(e,n,t=null){this.flags=n,this.read=t,typeof e=="string"?this.predicate=w5(e):this.predicate=e}},bR=class r{queries;constructor(e=[]){this.queries=e}elementStart(e,n){for(let t=0;t<this.queries.length;t++)this.queries[t].elementStart(e,n)}elementEnd(e){for(let n=0;n<this.queries.length;n++)this.queries[n].elementEnd(e)}embeddedTView(e){let n=null;for(let t=0;t<this.length;t++){let i=n!==null?n.length:0,o=this.getByIndex(t).embeddedTView(e,i);o&&(o.indexInDeclarationView=t,n!==null?n.push(o):n=[o])}return n!==null?new r(n):null}template(e,n){for(let t=0;t<this.queries.length;t++)this.queries[t].template(e,n)}getByIndex(e){return this.queries[e]}get length(){return this.queries.length}track(e){this.queries.push(e)}},LR=class r{metadata;matches=null;indexInDeclarationView=-1;crossesNgTemplate=!1;_declarationNodeIndex;_appliesToNextNode=!0;constructor(e,n=-1){this.metadata=e,this._declarationNodeIndex=n}elementStart(e,n){this.isApplyingToNode(n)&&this.matchTNode(e,n)}elementEnd(e){this._declarationNodeIndex===e.index&&(this._appliesToNextNode=!1)}template(e,n){this.elementStart(e,n)}embeddedTView(e,n){return this.isApplyingToNode(e)?(this.crossesNgTemplate=!0,this.addMatch(-e.index,n),new r(this.metadata)):null}isApplyingToNode(e){if(this._appliesToNextNode&&(this.metadata.flags&1)!==1){let n=this._declarationNodeIndex,t=e.parent;for(;t!==null&&t.type&8&&t.index!==n;)t=t.parent;return n===(t!==null?t.index:-1)}return this._appliesToNextNode}matchTNode(e,n){let t=this.metadata.predicate;if(Array.isArray(t))for(let i=0;i<t.length;i++){let o=t[i];this.matchTNodeWithReadOption(e,n,R5(n,o)),this.matchTNodeWithReadOption(e,n,f_(n,e,o,!1,!1))}else t===Ao?n.type&4&&this.matchTNodeWithReadOption(e,n,-1):this.matchTNodeWithReadOption(e,n,f_(n,e,t,!1,!1))}matchTNodeWithReadOption(e,n,t){if(t!==null){let i=this.metadata.read;if(i!==null)if(i===ua||i===Co||i===Ao&&n.type&4)this.addMatch(n.index,-2);else{let o=f_(n,e,i,!1,!1);o!==null&&this.addMatch(n.index,o)}else this.addMatch(n.index,t)}}addMatch(e,n){this.matches===null?this.matches=[e,n]:this.matches.push(e,n)}};function R5(r,e){let n=r.localNames;if(n!==null){for(let t=0;t<n.length;t+=2)if(n[t]===e)return n[t+1]}return null}function D5(r,e){return r.type&11?fd(r,e):r.type&4?K_(r,e):null}function C5(r,e,n,t){return n===-1?D5(e,r):n===-2?N5(r,e,t):zf(r,r[Te],n,e)}function N5(r,e,n){if(n===ua)return fd(e,r);if(n===Ao)return K_(e,r);if(n===Co)return ik(e,r)}function ok(r,e,n,t){let i=e[Eo].queries[t];if(i.matches===null){let o=r.data,s=n.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(C5(e,u,s[c+1],n.metadata.read))}}i.matches=a}return i.matches}function MR(r,e,n,t){let i=r.queries.getByIndex(n),o=i.matches;if(o!==null){let s=ok(r,e,i,n);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[ia]===f[fn]&&MR(f[Te],f,l,t)}if(u[jc]!==null){let d=u[jc];for(let f=0;f<d.length;f++){let g=d[f];MR(g[Te],g,l,t)}}}}}return t}function AD(r,e){return r[Eo].queries[e].queryList}function sk(r,e,n){let t=new v_((n&4)===4);return R0(r,e,t,t.destroy),(e[Eo]??=new wR).queries.push(new OR(t))-1}function ak(r,e,n){let t=tt();return t.firstCreatePass&&(ck(t,new O_(r,e,n),-1),(e&2)===2&&(t.staticViewQueries=!0)),sk(t,ce(),e)}function O5(r,e,n,t){let i=tt();if(i.firstCreatePass){let o=gn();ck(i,new O_(e,n,t),o.index),b5(i,r),(n&2)===2&&(i.staticContentQueries=!0)}return sk(i,ce(),n)}function w5(r){return r.split(",").map(e=>e.trim())}function ck(r,e,n){r.queries===null&&(r.queries=new bR),r.queries.track(new LR(e,n))}function b5(r,e){let n=r.contentQueries||(r.contentQueries=[]),t=n.length?n[n.length-1]:-1;e!==t&&n.push(r.queries.length-1,e)}function RD(r,e){return r.queries.getByIndex(e)}function lk(r,e){let n=r[Te],t=RD(n,e);return t.crossesNgTemplate?MR(n,r,e,[]):ok(n,r,t,e)}function uk(r,e,n){let t,i=Cf(()=>{t._dirtyCounter();let o=M5(t,r);if(e&&o===void 0)throw new oe(-951,!1);return o});return t=i[Rn],t._dirtyCounter=qc(0),t._flatValue=void 0,i}function dk(r){return uk(!0,!1,r)}function hk(r){return uk(!0,!0,r)}function L5(r,e){let n=r[Rn];n._lView=ce(),n._queryIndex=e,n._queryList=AD(n._lView,e),n._queryList.onDirty(()=>n._dirtyCounter.update(t=>t+1))}function M5(r,e){let n=r._lView,t=r._queryIndex;if(n===void 0||t===void 0||n[Re]&4)return e?void 0:qn;let i=AD(n,t),o=lk(n,t);return i.reset(o,Hx),e?i.first:i._changesDetected||r._flatValue===void 0?r._flatValue=i.toArray():r._flatValue}function fk(r){let e=[],n=new Map;function t(i){let o=n.get(i);if(!o){let s=r(i);n.set(i,o=s.then(a=>x5(i,a)))}return o}return w_.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(()=>F5(o));e.push(c)}),gk(),Promise.all(e).then(()=>{})}var w_=new Map,P5=new Set;function gk(){let r=w_;return w_=new Map,r}function mk(){return w_.size===0}function x5(r,e){return typeof e=="string"?e:e.status!==void 0&&e.status!==200?Promise.reject(new oe(918,!1)):e.text()}function F5(r){P5.delete(r)}var Jc=class{},pk=class{};function Ek(r,e){return new cd(r,e??null,[])}var cd=class extends Jc{ngModuleType;_parent;_bootstrapComponents=[];_r3Injector;instance;destroyCbs=[];componentFactoryResolver=new C_(this);constructor(e,n,t,i=!0){super(),this.ngModuleType=e,this._parent=n;let o=g0(e);this._bootstrapComponents=Cq(o.bootstrap),this._r3Injector=zA(e,n,[{provide:Jc,useValue:this},{provide:tg,useValue:this.componentFactoryResolver},...t],os(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(n=>n()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}},b_=class extends pk{moduleType;constructor(e){super(),this.moduleType=e}create(e){return new cd(this.moduleType,e,[])}};function _k(r,e,n){return new cd(r,e,n,!1)}var L_=class extends Jc{injector;componentFactoryResolver=new C_(this);instance=null;constructor(e){super();let n=new Fc([...e.providers,{provide:Jc,useValue:this},{provide:tg,useValue:this.componentFactoryResolver}],e.parent||ju(),e.debugName,new Set(["environment"]));this.injector=n,e.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(e){this.injector.onDestroy(e)}};function Tk(r,e,n=null){return new L_({providers:r,parent:e,debugName:n,runEnvironmentInitializers:!0}).injector}var k5=(()=>{class r{_injector;cachedInjectors=new Map;constructor(n){this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let t=IA(!1,n.type),i=t.length>0?Tk([t],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}static \u0275prov=K({token:r,providedIn:"environment",factory:()=>new r(C(Kn))})}return r})();function U5(r){return hd(()=>{let e=vk(r),n=le(x({},e),{decls:r.decls,vars:r.vars,template:r.template,consts:r.consts||null,ngContentSelectors:r.ngContentSelectors,onPush:r.changeDetection===KR.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&r.dependencies||null,getStandaloneInjector:e.standalone?i=>i.get(k5).getOrCreateStandaloneInjector(n):null,getExternalStyles:null,signals:r.signals??!1,data:r.data||{},encapsulation:r.encapsulation||ds.Emulated,styles:r.styles||qn,_:null,schemas:r.schemas||null,tView:null,id:""});e.standalone&&ps("NgStandalone"),yk(n);let t=r.dependencies;return n.directiveDefs=M_(t,Ik),n.pipeDefs=M_(t,TA),n.id=G5(n),n})}function Ik(r){return ra(r)||zE(r)}function da(r){return hd(()=>({type:r.type,bootstrap:r.bootstrap||qn,declarations:r.declarations||qn,imports:r.imports||qn,exports:r.exports||qn,transitiveCompileScopes:null,schemas:r.schemas||null,id:r.id||null}))}function V5(r,e){if(r==null)return wi;let n={};for(let t in r)if(r.hasOwnProperty(t)){let i=r[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=$_.None,c=null),n[o]=[t,a,c],e[o]=s}return n}function B5(r){if(r==null)return wi;let e={};for(let n in r)r.hasOwnProperty(n)&&(e[r[n]]=n);return e}function No(r){return hd(()=>{let e=vk(r);return yk(e),e})}function rg(r){return{type:r.type,name:r.name,factory:null,pure:r.pure!==!1,standalone:r.standalone??!0,onDestroy:r.type.prototype.ngOnDestroy||null}}function vk(r){let e={};return{type:r.type,providersResolver:null,factory:null,hostBindings:r.hostBindings||null,hostVars:r.hostVars||0,hostAttrs:r.hostAttrs||null,contentQueries:r.contentQueries||null,declaredInputs:e,inputConfig:r.inputs||wi,exportAs:r.exportAs||null,standalone:r.standalone??!0,signals:r.signals===!0,selectors:r.selectors||qn,viewQuery:r.viewQuery||null,features:r.features||null,setInput:null,resolveHostDirectives:null,hostDirectives:null,inputs:V5(r.inputs,e),outputs:B5(r.outputs),debugInfo:null}}function yk(r){r.features?.forEach(e=>e(r))}function M_(r,e){return r?()=>{let n=typeof r=="function"?r():r,t=[];for(let i of n){let o=e(i);o!==null&&t.push(o)}return t}:null}function G5(r){let e=0,n=typeof r.consts=="function"?"":r.consts,t=[r.selectors,r.ngContentSelectors,r.hostVars,r.hostAttrs,n,r.vars,r.decls,r.encapsulation,r.standalone,r.signals,r.exportAs,JSON.stringify(r.inputs),JSON.stringify(r.outputs),Object.getOwnPropertyNames(r.type.prototype),!!r.contentQueries,!!r.viewQuery];for(let o of t.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function $5(r){return Object.getPrototypeOf(r.prototype).constructor}function Sk(r){let e=$5(r.type),n=!0,t=[r];for(;e;){let i;if(Mi(r))i=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new oe(903,!1);i=e.\u0275dir}if(i){if(n){t.push(i);let s=r;s.inputs=eR(r.inputs),s.declaredInputs=eR(r.declaredInputs),s.outputs=eR(r.outputs);let a=i.hostBindings;a&&q5(r,a);let c=i.viewQuery,l=i.contentQueries;if(c&&W5(r,c),l&&z5(r,l),j5(r,i),o0(r.outputs,i.outputs),Mi(i)&&i.data.animation){let u=r.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(r),a===Sk&&(n=!1)}}e=Object.getPrototypeOf(e)}H5(t)}function j5(r,e){for(let n in e.inputs){if(!e.inputs.hasOwnProperty(n)||r.inputs.hasOwnProperty(n))continue;let t=e.inputs[n];t!==void 0&&(r.inputs[n]=t,r.declaredInputs[n]=e.declaredInputs[n])}}function H5(r){let e=0,n=null;for(let t=r.length-1;t>=0;t--){let i=r[t];i.hostVars=e+=i.hostVars,i.hostAttrs=td(i.hostAttrs,n=td(n,i.hostAttrs))}}function eR(r){return r===wi?{}:r===qn?[]:r}function W5(r,e){let n=r.viewQuery;n?r.viewQuery=(t,i)=>{e(t,i),n(t,i)}:r.viewQuery=e}function z5(r,e){let n=r.contentQueries;n?r.contentQueries=(t,i,o)=>{e(t,i,o),n(t,i,o)}:r.contentQueries=e}function q5(r,e){let n=r.hostBindings;n?r.hostBindings=(t,i)=>{e(t,i),n(t,i)}:r.hostBindings=e}function K5(r){let e=n=>{let t=Array.isArray(r);n.hostDirectives===null?(n.resolveHostDirectives=Y5,n.hostDirectives=t?r.map(PR):[r]):t?n.hostDirectives.unshift(...r.map(PR)):n.hostDirectives.unshift(r)};return e.ngInherit=!0,e}function Y5(r){let e=[],n=!1,t=null,i=null;for(let o=0;o<r.length;o++){let s=r[o];if(s.hostDirectives!==null){let a=e.length;t??=new Map,i??=new Map,Ak(s,e,t),i.set(s,[a,e.length-1])}o===0&&Mi(s)&&(n=!0,e.push(s))}for(let o=n?1:0;o<r.length;o++)e.push(r[o]);return[e,t,i]}function Ak(r,e,n){if(r.hostDirectives!==null)for(let t of r.hostDirectives)if(typeof t=="function"){let i=t();for(let o of i)_x(PR(o),e,n)}else _x(t,e,n)}function _x(r,e,n){let t=zE(r.directive);Q5(t.declaredInputs,r.inputs),Ak(t,e,n),n.set(t,r),e.push(t)}function PR(r){return typeof r=="function"?{directive:hn(r),inputs:wi,outputs:wi}:{directive:hn(r.directive),inputs:Tx(r.inputs),outputs:Tx(r.outputs)}}function Tx(r){if(r===void 0||r.length===0)return wi;let e={};for(let n=0;n<r.length;n+=2)e[r[n]]=r[n+1];return e}function Q5(r,e){for(let n in e)if(e.hasOwnProperty(n)){let t=e[n],i=r[n];r[t]=i}}function Rk(r,e,n,t,i,o,s,a){if(n.firstCreatePass){r.mergedAttrs=td(r.mergedAttrs,r.attrs);let u=r.tView=oD(2,r,i,o,s,n.directiveRegistry,n.pipeRegistry,null,n.schemas,n.consts,null);n.queries!==null&&(n.queries.template(n,r),u.queries=n.queries.embeddedTView(r))}a&&(r.flags|=a),zc(r,!1);let c=J5(n,e,r,t);n_()&&fD(n,e,c,r),nd(c,e);let l=HF(c,e,c,r);e[t+et]=l,aD(e,l),S5(l,r,e)}function X5(r,e,n,t,i,o,s,a,c,l,u){let d=n+et,f;return e.firstCreatePass?(f=tl(e,d,4,s||null,a||null),XE()&&XF(e,r,f,Br(e.consts,l),mD),Mx(e,f)):f=e.data[d],Rk(f,r,e,n,t,i,o,c),zu(f)&&z_(e,r,f),l!=null&&Jf(r,f,u),f}function ld(r,e,n,t,i,o,s,a,c,l,u){let d=n+et,f;if(e.firstCreatePass){if(f=tl(e,d,4,s||null,a||null),l!=null){let g=Br(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 Rk(f,r,e,n,t,i,o,c),l!=null&&Jf(r,f,u),f}function Dk(r,e,n,t,i,o,s,a){let c=ce(),l=tt(),u=Br(l.consts,o);return X5(c,l,r,e,n,t,i,u,void 0,s,a),Dk}function Ck(r,e,n,t,i,o,s,a){let c=ce(),l=tt(),u=Br(l.consts,o);return ld(c,l,r,e,n,t,i,u,void 0,s,a),Ck}var J5=Z5;function Z5(r,e,n,t){return $f(!0),e[Ze].createComment("")}var J_=new ee(""),md=new ee(""),ig=(()=>{class r{_ngZone;registry;_isZoneStable=!0;_callbacks=[];_taskTrackingZone=null;_destroyRef;constructor(n,t,i){this._ngZone=n,this.registry=t,SA()&&(this._destroyRef=J(lr,{optional:!0})??void 0),DD||(Nk(i),i.addToWindow(t)),this._watchAngularEvents(),n.run(()=>{this._taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){let n=this._ngZone.onUnstable.subscribe({next:()=>{this._isZoneStable=!1}}),t=this._ngZone.runOutsideAngular(()=>this._ngZone.onStable.subscribe({next:()=>{Me.assertNotInAngularZone(),queueMicrotask(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}}));this._destroyRef?.onDestroy(()=>{n.unsubscribe(),t.unsubscribe()})}isStable(){return this._isZoneStable&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())queueMicrotask(()=>{for(;this._callbacks.length!==0;){let n=this._callbacks.pop();clearTimeout(n.timeoutId),n.doneCb()}});else{let n=this.getPendingTasks();this._callbacks=this._callbacks.filter(t=>t.updateCb&&t.updateCb(n)?(clearTimeout(t.timeoutId),!1):!0)}}getPendingTasks(){return this._taskTrackingZone?this._taskTrackingZone.macroTasks.map(n=>({source:n.source,creationLocation:n.creationLocation,data:n.data})):[]}addCallback(n,t,i){let o=-1;t&&t>0&&(o=setTimeout(()=>{this._callbacks=this._callbacks.filter(s=>s.timeoutId!==o),n()},t)),this._callbacks.push({doneCb:n,timeoutId:o,updateCb:i})}whenStable(n,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(n,t,i),this._runCallbacksIfReady()}registerApplication(n){this.registry.registerApplication(n,this)}unregisterApplication(n){this.registry.unregisterApplication(n)}findProviders(n,t,i){return[]}static \u0275fac=function(t){return new(t||r)(C(Me),C(og),C(md))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),og=(()=>{class r{_applications=new Map;registerApplication(n,t){this._applications.set(n,t)}unregisterApplication(n){this._applications.delete(n)}unregisterAllApplications(){this._applications.clear()}getTestability(n){return this._applications.get(n)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(n,t=!0){return DD?.findTestabilityInTree(this,n,t)??null}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"platform"})}return r})();function Nk(r){DD=r}var DD;function Z_(r){return!!r&&typeof r.then=="function"}function CD(r){return!!r&&typeof r.subscribe=="function"}var Ok=new ee("");var ND=(()=>{class r{resolve;reject;initialized=!1;done=!1;donePromise=new Promise((n,t)=>{this.resolve=n,this.reject=t});appInits=J(Ok,{optional:!0})??[];injector=J(ut);constructor(){}runInitializers(){if(this.initialized)return;let n=[];for(let i of this.appInits){let o=mo(this.injector,i);if(Z_(o))n.push(o);else if(CD(o)){let s=new Promise((a,c)=>{o.subscribe({complete:a,error:c})});n.push(s)}}let t=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{t()}).catch(i=>{this.reject(i)}),n.length===0&&t(),this.initialized=!0}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),wk=new ee("");function bk(){$S(()=>{let r="";throw new oe(600,r)})}function Lk(r){return r.isBoundToModule}var e9=10;function OD(r,e){return Array.isArray(e)?e.reduce(OD,r):x(x({},r),e)}var ha=(()=>{class r{_runningTick=!1;_destroyed=!1;_destroyListeners=[];_views=[];internalErrorHandler=J(Io);afterRenderManager=J(dD);zonelessEnabled=J(Ju);rootEffectScheduler=J(jf);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=J(ca);get isStable(){return this.internalPendingTask.hasPendingTasksObservable.pipe(fe(n=>!n))}constructor(){J(el,{optional:!0})}whenStable(){let n;return new Promise(t=>{n=this.isStable.subscribe({next:i=>{i&&t()}})}).finally(()=>{n.unsubscribe()})}_injector=J(Kn);_rendererFactory=null;get injector(){return this._injector}bootstrap(n,t){return this.bootstrapImpl(n,t)}bootstrapImpl(n,t,i=ut.NULL){return this._injector.get(Me).run(()=>{dt(10);let s=n instanceof Y_;if(!this._injector.get(ND).done){let p="";throw new oe(405,p)}let c;s?c=n:c=this._injector.get(tg).resolveComponentFactory(n),this.componentTypes.push(c.componentType);let l=Lk(c)?void 0:this._injector.get(Jc),u=t||c.selector,d=c.create(i,[],u,l),f=d.location.nativeElement,g=d.injector.get(J_,null);return g?.registerApplication(f),d.onDestroy(()=>{this.detachView(d.hostView),Wf(this.components,d),g?.unregisterApplication(f)}),this._loadComponent(d),dt(11,d),d})}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}_tick(){dt(12),this.tracingSnapshot!==null?this.tracingSnapshot.run(j_.CHANGE_DETECTION,this.tickImpl):this.tickImpl()}tickImpl=()=>{if(this._runningTick)throw new oe(101,!1);let n=Ae(null);try{this._runningTick=!0,this.synchronize()}finally{this._runningTick=!1,this.tracingSnapshot?.dispose(),this.tracingSnapshot=null,Ae(n),this.afterTick.next(),dt(13)}};synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(fs,null,{optional:!0}));let n=0;for(;this.dirtyFlags!==0&&n++<e9;)dt(14),this.synchronizeOnce(),dt(15)}synchronizeOnce(){this.dirtyFlags&16&&(this.dirtyFlags&=-17,this.rootEffectScheduler.flush());let n=!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&&!Ku(i))continue;let o=t&&!this.zonelessEnabled?0:1;BF(i,o),n=!0}if(this.dirtyFlags&=-5,this.syncDirtyFlagsWithViews(),this.dirtyFlags&23)return}n||(this._rendererFactory?.begin?.(),this._rendererFactory?.end?.()),this.dirtyFlags&8&&(this.dirtyFlags&=-9,this.afterRenderManager.execute()),this.syncDirtyFlagsWithViews()}syncDirtyFlagsWithViews(){if(this.allViews.some(({_lView:n})=>Ku(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let t=n;this._views.push(t),t.attachToAppRef(this)}detachView(n){let t=n;Wf(this._views,t),t.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView);try{this.tick()}catch(i){this.internalErrorHandler(i)}this.components.push(n),this._injector.get(wk,[]).forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Wf(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new oe(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function Wf(r,e){let n=r.indexOf(e);n>-1&&r.splice(n,1)}function Mk(r,e){let n=ce(),t=To();if(xn(n,t,e)){let i=tt(),o=Qu();if(q_(o,i,n,r,e))ls(o)&&MF(n,o.index);else{let a=oi(o,n);PF(n[Ze],a,null,o.value,r,e,null)}}return Mk}function Pk(r,e,n,t){let i=ce(),o=To();if(xn(i,o,e)){let s=tt(),a=Qu();v8(a,i,r,e,n,t)}return Pk}var iEe=typeof document<"u"&&typeof document?.documentElement?.getAnimations=="function";function t9(){return ce()[Yn][$t]}var xR=class{destroy(e){}updateValue(e,n){}swap(e,n){let t=Math.min(e,n),i=Math.max(e,n),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,n){this.attach(n,this.detach(e))}};function tR(r,e,n,t,i){return r===n&&Object.is(e,t)?1:Object.is(i(r,e),i(n,t))?-1:0}function n9(r,e,n){let t,i,o=0,s=r.length-1,a=void 0;if(Array.isArray(e)){let c=e.length-1;for(;o<=s&&o<=c;){let l=r.at(o),u=e[o],d=tR(o,l,o,u,n);if(d!==0){d<0&&r.updateValue(o,u),o++;continue}let f=r.at(s),g=e[c],p=tR(s,f,c,g,n);if(p!==0){p<0&&r.updateValue(s,g),s--,c--;continue}let _=n(o,l),T=n(s,f),R=n(o,u);if(Object.is(R,T)){let b=n(c,g);Object.is(b,_)?(r.swap(o,s),r.updateValue(s,g),c--,s--):r.move(s,o),r.updateValue(o,u),o++;continue}if(t??=new P_,i??=vx(r,o,s,n),FR(r,t,o,R))r.updateValue(o,u),o++,s++;else if(i.has(R))t.set(_,r.detach(o)),s--;else{let b=r.create(o,e[o]);r.attach(o,b),o++,s++}}for(;o<=c;)Ix(r,t,n,o,e[o]),o++}else if(e!=null){let c=e[Symbol.iterator](),l=c.next();for(;!l.done&&o<=s;){let u=r.at(o),d=l.value,f=tR(o,u,o,d,n);if(f!==0)f<0&&r.updateValue(o,d),o++,l=c.next();else{t??=new P_,i??=vx(r,o,s,n);let g=n(o,d);if(FR(r,t,o,g))r.updateValue(o,d),o++,s++,l=c.next();else if(!i.has(g))r.attach(o,r.create(o,d)),o++,s++,l=c.next();else{let p=n(o,u);t.set(p,r.detach(o)),s--}}}for(;!l.done;)Ix(r,t,n,r.length,l.value),l=c.next()}for(;o<=s;)r.destroy(r.detach(s--));t?.forEach(c=>{r.destroy(c)})}function FR(r,e,n,t){return e!==void 0&&e.has(t)?(r.attach(n,e.get(t)),e.delete(t),!0):!1}function Ix(r,e,n,t,i){if(FR(r,e,t,n(t,i)))r.updateValue(t,i);else{let o=r.create(t,i);r.attach(t,o)}}function vx(r,e,n,t){let i=new Set;for(let o=e;o<=n;o++)i.add(t(o,r.at(o)));return i}var P_=class{kvMap=new Map;_vMap=void 0;has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let n=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(n)?(this.kvMap.set(e,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,n){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,n)}else this.kvMap.set(e,n)}forEach(e){for(let[n,t]of this.kvMap)if(e(t,n),this._vMap!==void 0){let i=this._vMap;for(;i.has(t);)t=i.get(t),e(t,n)}}};function r9(r,e,n,t,i,o,s,a){ps("NgControlFlow");let c=ce(),l=tt(),u=Br(l.consts,o);return ld(c,l,r,e,n,t,i,u,256,s,a),wD}function wD(r,e,n,t,i,o,s,a){ps("NgControlFlow");let c=ce(),l=tt(),u=Br(l.consts,o);return ld(c,l,r,e,n,t,i,u,512,s,a),wD}function i9(r,e){ps("NgControlFlow");let n=ce(),t=To(),i=n[t]!==Cn?n[t]:-1,o=i!==-1?x_(n,et+i):void 0,s=0;if(xn(n,t,r)){let a=Ae(null);try{if(o!==void 0&&zF(o,s),r!==-1){let c=et+r,l=x_(n,c),u=BR(n[Te],c),d=KF(l,u,n),f=Zf(n,u,e,{dehydratedView:d});eg(l,f,s,id(u,d))}}finally{Ae(a)}}else if(o!==void 0){let a=WF(o,s);a!==void 0&&(a[$t]=e)}}var kR=class{lContainer;$implicit;$index;constructor(e,n,t){this.lContainer=e,this.$implicit=n,this.$index=t}get $count(){return this.lContainer.length-jt}};function o9(r){return r}function s9(r,e){return e}var UR=class{hasEmptyBlock;trackByFn;liveCollection;constructor(e,n,t){this.hasEmptyBlock=e,this.trackByFn=n,this.liveCollection=t}};function a9(r,e,n,t,i,o,s,a,c,l,u,d,f){ps("NgControlFlow");let g=ce(),p=tt(),_=c!==void 0,T=ce(),R=a?s.bind(T[Yn][$t]):s,b=new UR(_,R);T[et+r]=b,ld(g,p,r+1,e,n,t,i,Br(p.consts,o),256),_&&ld(g,p,r+2,c,l,u,d,Br(p.consts,f),512)}var VR=class extends xR{lContainer;hostLView;templateTNode;operationsCounter=void 0;needsIndexUpdate=!1;constructor(e,n,t){super(),this.lContainer=e,this.hostLView=n,this.templateTNode=t}get length(){return this.lContainer.length-jt}at(e){return this.getLView(e)[$t].$implicit}attach(e,n){let t=n[Uc];this.needsIndexUpdate||=e!==this.length,eg(this.lContainer,n,e,id(this.templateTNode,t)),l9(this.lContainer,e)}detach(e){return this.needsIndexUpdate||=e!==this.length-1,u9(this.lContainer,e),d9(this.lContainer,e)}create(e,n){let t=R_(this.lContainer,this.templateTNode.tView.ssrId),i=Zf(this.hostLView,this.templateTNode,new kR(this.lContainer,n,e),{dehydratedView:t});return this.operationsCounter?.recordCreate(),i}destroy(e){H_(e[Te],e),this.operationsCounter?.recordDestroy()}updateValue(e,n){this.getLView(e)[$t].$implicit=n}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 h9(this.lContainer,e)}};function c9(r){let e=Ae(null),n=ai();try{let t=ce(),i=t[Te],o=t[n],s=n+1,a=x_(t,s);if(o.liveCollection===void 0){let l=BR(i,s);o.liveCollection=new VR(a,t,l)}else o.liveCollection.reset();let c=o.liveCollection;if(n9(c,r,o.trackByFn),c.updateIndexes(),o.hasEmptyBlock){let l=To(),u=c.length===0;if(xn(t,l,u)){let d=n+2,f=x_(t,d);if(u){let g=BR(i,d),p=KF(f,g,t),_=Zf(t,g,void 0,{dehydratedView:p});eg(f,_,0,id(g,p))}else i.firstUpdatePass&&z8(f),zF(f,0)}}}finally{Ae(e)}}function x_(r,e){return r[e]}function l9(r,e){if(r.length<=jt)return;let n=jt+e,t=r[n],i=t?t[$c]:void 0;if(t&&i&&i.detachedLeaveAnimationFns&&i.detachedLeaveAnimationFns.length>0){let o=t[as];e8(o,i),Xc.delete(t),i.detachedLeaveAnimationFns=void 0}}function u9(r,e){if(r.length<=jt)return;let n=jt+e,t=r[n],i=t?t[$c]:void 0;i&&i.leave&&i.leave.size>0&&(i.detachedLeaveAnimationFns=[])}function d9(r,e){return Kf(r,e)}function h9(r,e){return WF(r,e)}function BR(r,e){return Uf(r,e)}function xk(r,e,n){let t=ce(),i=To();if(xn(t,i,e)){let o=tt(),s=Qu();bF(s,t,r,e,t[Ze],n)}return xk}function GR(r,e,n,t,i){q_(e,r,n,i?"class":"style",t)}function bD(r,e,n,t){let i=ce(),o=i[Te],s=r+et,a=o.firstCreatePass?ID(s,i,2,e,mD,XE(),n,t):o.data[s];if(pD(a,i,r,e,Uk),zu(a)){let c=i[Te];z_(c,i,a),XR(c,a,i)}return t!=null&&Jf(i,a),bD}function LD(){let r=tt(),e=gn(),n=ED(e);return r.firstCreatePass&&vD(r,n),FA(n)&&kA(),PA(),n.classesWithoutHost!=null&&S4(n)&&GR(r,n,ce(),n.classesWithoutHost,!0),n.stylesWithoutHost!=null&&A4(n)&&GR(r,n,ce(),n.stylesWithoutHost,!1),LD}function Fk(r,e,n,t){return bD(r,e,n,t),LD(),Fk}function MD(r,e,n,t){let i=ce(),o=i[Te],s=r+et,a=o.firstCreatePass?a5(s,o,2,e,n,t):o.data[s];return pD(a,i,r,e,Uk),t!=null&&Jf(i,a),MD}function PD(){let r=gn(),e=ED(r);return FA(e)&&kA(),PA(),PD}function kk(r,e,n,t){return MD(r,e,n,t),PD(),kk}var Uk=(r,e,n,t,i)=>($f(!0),cF(e[Ze],t,$0()));function xD(r,e,n){let t=ce(),i=t[Te],o=r+et,s=i.firstCreatePass?ID(o,t,8,"ng-container",mD,XE(),e,n):i.data[o];if(pD(s,t,r,"ng-container",f9),zu(s)){let a=t[Te];z_(a,t,s),XR(a,s,t)}return n!=null&&Jf(t,s),xD}function FD(){let r=tt(),e=gn(),n=ED(e);return r.firstCreatePass&&vD(r,n),FD}function Vk(r,e,n){return xD(r,e,n),FD(),Vk}var f9=(r,e,n,t,i)=>($f(!0),Tq(e[Ze],""));function g9(){return ce()}function Bk(r,e,n){let t=ce(),i=To();if(xn(t,i,e)){let o=tt(),s=Qu();LF(s,t,r,e,t[Ze],n)}return Bk}var c_=void 0;function m9(r){let e=Math.floor(Math.abs(r)),n=r.toString().replace(/^[^.]*\.?/,"").length;return e===1&&n===0?1:5}var p9=["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"]],c_,[["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"]],c_,[["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}",c_,"{1} 'at' {0}",c_],[".",",",";","%","+","-","E","\xD7","\u2030","\u221E","NaN",":"],["#,##0.###","#,##0%","\xA4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",m9],nR={};function $r(r){let e=E9(r),n=yx(e);if(n)return n;let t=e.split("-")[0];if(n=yx(t),n)return n;if(t==="en")return p9;throw new oe(701,!1)}function yx(r){return r in nR||(nR[r]=en.ng&&en.ng.common&&en.ng.common.locales&&en.ng.common.locales[r]),nR[r]}var Yt=(function(r){return r[r.LocaleId=0]="LocaleId",r[r.DayPeriodsFormat=1]="DayPeriodsFormat",r[r.DayPeriodsStandalone=2]="DayPeriodsStandalone",r[r.DaysFormat=3]="DaysFormat",r[r.DaysStandalone=4]="DaysStandalone",r[r.MonthsFormat=5]="MonthsFormat",r[r.MonthsStandalone=6]="MonthsStandalone",r[r.Eras=7]="Eras",r[r.FirstDayOfWeek=8]="FirstDayOfWeek",r[r.WeekendRange=9]="WeekendRange",r[r.DateFormat=10]="DateFormat",r[r.TimeFormat=11]="TimeFormat",r[r.DateTimeFormat=12]="DateTimeFormat",r[r.NumberSymbols=13]="NumberSymbols",r[r.NumberFormats=14]="NumberFormats",r[r.CurrencyCode=15]="CurrencyCode",r[r.CurrencySymbol=16]="CurrencySymbol",r[r.CurrencyName=17]="CurrencyName",r[r.Currencies=18]="Currencies",r[r.Directionality=19]="Directionality",r[r.PluralCase=20]="PluralCase",r[r.ExtraData=21]="ExtraData",r})(Yt||{});function E9(r){return r.toLowerCase().replace(/_/g,"-")}var sg="en-US";var _9=sg;function Gk(r){typeof r=="string"&&(_9=r.toLowerCase().replace(/_/g,"-"))}function $k(r,e,n){let t=ce(),i=tt(),o=gn();return Hk(i,t,t[Ze],o,r,e,n),$k}function jk(r,e,n){let t=ce(),i=tt(),o=gn();return(o.type&3||n)&&ek(o,i,t,n,t[Ze],r,e,m_(o,t,e)),jk}function Hk(r,e,n,t,i,o,s){let a=!0,c=null;if((t.type&3||s)&&(c??=m_(t,e,o),ek(t,r,e,s,n,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??=m_(t,e,o),mx(t,e,f,g,i,c)}if(l&&l.length)for(let d of l)c??=m_(t,e,o),mx(t,e,d,i,i,c)}}function T9(r=1){return V0(r)}function I9(r,e){let n=null,t=Mq(r);for(let i=0;i<e.length;i++){let o=e[i];if(o==="*"){n=i;continue}if(t===null?fF(r,o,!0):Fq(t,o))return i}return n}function v9(r){let e=ce()[Yn][ar];if(!e.projection){let n=r?r.length:1,t=e.projection=h0(n,null),i=t.slice(),o=e.child;for(;o!==null;){if(o.type!==128){let s=r?I9(o,r):0;s!==null&&(i[s]?i[s].projectionNext=o:t[s]=o,i[s]=o)}o=o.next}}}function y9(r,e=0,n,t,i,o){let s=ce(),a=tt(),c=t?r+1:null;c!==null&&ld(s,a,c,t,i,o,null,n);let l=tl(a,et+r,16,null,n||null);l.projection===null&&(l.projection=e),BA();let d=!s[Uc]||xA();s[Yn][ar].projection[l.projection]===null&&c!==null?S9(s,a,c):d&&!V_(l)&&d8(a,s,l)}function S9(r,e,n){let t=et+n,i=e.data[t],o=r[t],s=R_(o,i.tView.ssrId),a=Zf(r,i,void 0,{dehydratedView:s});eg(o,a,0,id(i,s))}function A9(r,e,n,t){O5(r,e,n,t)}function R9(r,e,n){ak(r,e,n)}function D9(r){let e=ce(),n=tt(),t=ZE();Gf(t+1);let i=RD(n,t);if(r.dirty&&v0(e)===((i.metadata.flags&2)===2)){if(i.matches===null)r.reset([]);else{let o=lk(e,t);r.reset(o,Hx),r.notifyOnChanges()}return!0}return!1}function C9(){return AD(ce(),ZE())}function N9(r,e,n,t){L5(r,ak(e,n,t))}function O9(r=1){Gf(ZE()+r)}function w9(r){let e=GA();return Wc(e,et+r)}function l_(r,e){return r<<17|e<<2}function Zc(r){return r>>17&32767}function b9(r){return(r&2)==2}function L9(r,e){return r&131071|e<<17}function $R(r){return r|2}function ud(r){return(r&131068)>>2}function rR(r,e){return r&-131069|e<<2}function M9(r){return(r&1)===1}function jR(r){return r|1}function P9(r,e,n,t,i,o){let s=o?e.classBindings:e.styleBindings,a=Zc(s),c=ud(s);r[t]=n;let l=!1,u;if(Array.isArray(n)){let d=n;u=d[1],(u===null||$u(d,u)>0)&&(l=!0)}else u=n;if(i)if(c!==0){let f=Zc(r[a+1]);r[t+1]=l_(f,a),f!==0&&(r[f+1]=rR(r[f+1],t)),r[a+1]=L9(r[a+1],t)}else r[t+1]=l_(a,0),a!==0&&(r[a+1]=rR(r[a+1],t)),a=t;else r[t+1]=l_(c,0),a===0?a=t:r[c+1]=rR(r[c+1],t),c=t;l&&(r[t+1]=$R(r[t+1])),Sx(r,u,t,!0),Sx(r,u,t,!1),x9(e,u,r,t,o),s=l_(a,c),o?e.classBindings=s:e.styleBindings=s}function x9(r,e,n,t,i){let o=i?r.residualClasses:r.residualStyles;o!=null&&typeof e=="string"&&$u(o,e)>=0&&(n[t+1]=jR(n[t+1]))}function Sx(r,e,n,t){let i=r[n+1],o=e===null,s=t?Zc(i):ud(i),a=!1;for(;s!==0&&(a===!1||o);){let c=r[s],l=r[s+1];F9(c,e)&&(a=!0,r[s+1]=t?jR(l):$R(l)),s=t?Zc(l):ud(l)}a&&(r[n+1]=t?$R(i):jR(i))}function F9(r,e){return r===null||e==null||(Array.isArray(r)?r[1]:r)===e?!0:Array.isArray(r)&&typeof e=="string"?$u(r,e)>=0:!1}var mn={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function Wk(r){return r.substring(mn.key,mn.keyEnd)}function k9(r){return r.substring(mn.value,mn.valueEnd)}function U9(r){return Kk(r),zk(r,dd(r,0,mn.textEnd))}function zk(r,e){let n=mn.textEnd;return n===e?-1:(e=mn.keyEnd=B9(r,mn.key=e,n),dd(r,e,n))}function V9(r){return Kk(r),qk(r,dd(r,0,mn.textEnd))}function qk(r,e){let n=mn.textEnd,t=mn.key=dd(r,e,n);return n===t?-1:(t=mn.keyEnd=G9(r,t,n),t=Ax(r,t,n,58),t=mn.value=dd(r,t,n),t=mn.valueEnd=$9(r,t,n),Ax(r,t,n,59))}function Kk(r){mn.key=0,mn.keyEnd=0,mn.value=0,mn.valueEnd=0,mn.textEnd=r.length}function dd(r,e,n){for(;e<n&&r.charCodeAt(e)<=32;)e++;return e}function B9(r,e,n){for(;e<n&&r.charCodeAt(e)>32;)e++;return e}function G9(r,e,n){let t;for(;e<n&&((t=r.charCodeAt(e))===45||t===95||(t&-33)>=65&&(t&-33)<=90||t>=48&&t<=57);)e++;return e}function Ax(r,e,n,t){return e=dd(r,e,n),e<n&&e++,e}function $9(r,e,n){let t=-1,i=-1,o=-1,s=e,a=s;for(;s<n;){let c=r.charCodeAt(s++);if(c===59)return a;c===34||c===39?a=s=Rx(r,c,s,n):e===s-4&&o===85&&i===82&&t===76&&c===40?a=s=Rx(r,41,s,n):c>32&&(a=s),o=i,i=t,t=c&-33}return a}function Rx(r,e,n,t){let i=-1,o=n;for(;o<t;){let s=r.charCodeAt(o++);if(s==e&&i!==92)return o;s==92&&i===92?i=0:i=s}throw new Error}function Yk(r,e,n){return Xk(r,e,n,!1),Yk}function Qk(r,e){return Xk(r,e,null,!0),Qk}function j9(r){Jk(tU,H9,r,!1)}function H9(r,e){for(let n=V9(e);n>=0;n=qk(e,n))tU(r,Wk(e),k9(e))}function W9(r){Jk(J9,z9,r,!0)}function z9(r,e){for(let n=U9(e);n>=0;n=zk(e,n))Pf(r,Wk(e),!0)}function Xk(r,e,n,t){let i=ce(),o=tt(),s=Bf(2);if(o.firstUpdatePass&&eU(o,r,s,t),e!==Cn&&xn(i,s,e)){let a=o.data[ai()];nU(o,a,i,i[Ze],r,i[s+1]=eK(e,n),t,s)}}function Jk(r,e,n,t){let i=tt(),o=Bf(2);i.firstUpdatePass&&eU(i,null,o,t);let s=ce();if(n!==Cn&&xn(s,o,n)){let a=i.data[ai()];if(rU(a,t)&&!Zk(i,o)){let c=t?a.classesWithoutHost:a.stylesWithoutHost;c!==null&&(n=VE(c,n||"")),GR(i,a,s,n,t)}else Z9(i,a,s,s[Ze],s[o+1],s[o+1]=X9(r,e,n),t,o)}}function Zk(r,e){return e>=r.expandoStartIndex}function eU(r,e,n,t){let i=r.data;if(i[n+1]===null){let o=i[ai()],s=Zk(r,n);rU(o,t)&&e===null&&!s&&(e=!1),e=q9(i,o,e,t),P9(i,o,e,n,s,t)}}function q9(r,e,n,t){let i=x0(r),o=t?e.residualClasses:e.residualStyles;if(i===null)(t?e.classBindings:e.styleBindings)===0&&(n=iR(null,r,e,n,t),n=Yf(n,e.attrs,t),o=null);else{let s=e.directiveStylingLast;if(s===-1||r[s]!==i)if(n=iR(i,r,e,n,t),o===null){let c=K9(r,e,t);c!==void 0&&Array.isArray(c)&&(c=iR(null,r,e,c[1],t),c=Yf(c,e.attrs,t),Y9(r,e,t,c))}else o=Q9(r,e,t)}return o!==void 0&&(t?e.residualClasses=o:e.residualStyles=o),n}function K9(r,e,n){let t=n?e.classBindings:e.styleBindings;if(ud(t)!==0)return r[Zc(t)]}function Y9(r,e,n,t){let i=n?e.classBindings:e.styleBindings;r[Zc(i)]=t}function Q9(r,e,n){let t,i=e.directiveEnd;for(let o=1+e.directiveStylingLast;o<i;o++){let s=r[o].hostAttrs;t=Yf(t,s,n)}return Yf(t,e.attrs,n)}function iR(r,e,n,t,i){let o=null,s=n.directiveEnd,a=n.directiveStylingLast;for(a===-1?a=n.directiveStart:a++;a<s&&(o=e[a],t=Yf(t,o.hostAttrs,i),o!==r);)a++;return r!==null&&(n.directiveStylingLast=a),t}function Yf(r,e,n){let t=n?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(r)||(r=r===void 0?[]:["",r]),Pf(r,s,n?!0:e[++o]))}return r===void 0?null:r}function X9(r,e,n){if(n==null||n==="")return qn;let t=[],i=Gr(n);if(Array.isArray(i))for(let o=0;o<i.length;o++)r(t,i[o],!0);else if(typeof i=="object")for(let o in i)i.hasOwnProperty(o)&&r(t,o,i[o]);else typeof i=="string"&&e(t,i);return t}function tU(r,e,n){Pf(r,e,Gr(n))}function J9(r,e,n){let t=String(e);t!==""&&!t.includes(" ")&&Pf(r,t,n)}function Z9(r,e,n,t,i,o,s,a){i===Cn&&(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&&nU(r,e,n,t,p,_,s,a),u=c<i.length?i[c]:null,d=l<o.length?o[l]:null}}function nU(r,e,n,t,i,o,s,a){if(!(e.type&3))return;let c=r.data,l=c[a+1],u=M9(l)?Dx(c,e,n,i,ud(l),s):void 0;if(!F_(u)){F_(o)||b9(l)&&(o=Dx(c,null,n,i,a,s));let d=OA(ai(),n);f8(t,s,d,i,o)}}function Dx(r,e,n,t,i,o){let s=e===null,a;for(;i>0;){let c=r[i],l=Array.isArray(c),u=l?c[1]:c,d=u===null,f=n[i+1];f===Cn&&(f=d?qn:void 0);let g=d?WE(f,t):u===t?f:void 0;if(l&&!F_(g)&&(g=WE(c,t)),F_(g)&&(a=g,s))return a;let p=r[i+1];i=s?Zc(p):ud(p)}if(e!==null){let c=o?e.residualClasses:e.residualStyles;c!=null&&(a=WE(c,t))}return a}function F_(r){return r!==void 0}function eK(r,e){return r==null||r===""||(typeof e=="string"?r=r+e:typeof r=="object"&&(r=os(Gr(r)))),r}function rU(r,e){return(r.flags&(e?8:16))!==0}function tK(r,e=""){let n=ce(),t=tt(),i=r+et,o=t.firstCreatePass?tl(t,i,1,e,null):t.data[i],s=nK(t,n,o,e,r);n[i]=s,n_()&&fD(t,n,s,o),zc(o,!1)}var nK=(r,e,n,t,i)=>($f(!0),Eq(e[Ze],t));function iU(r,e,n,t=""){return xn(r,To(),n)?e+Ur(n)+t:Cn}function rK(r,e,n,t,i,o=""){let s=jA(),a=od(r,s,n,i);return Bf(2),a?e+Ur(n)+t+Ur(i)+o:Cn}function iK(r,e,n,t,i,o,s,a=""){let c=jA(),l=SD(r,c,n,i,s);return Bf(3),l?e+Ur(n)+t+Ur(i)+o+Ur(s)+a:Cn}function oU(r){return kD("",r),oU}function kD(r,e,n){let t=ce(),i=iU(t,r,e,n);return i!==Cn&&UD(t,ai(),i),kD}function sU(r,e,n,t,i){let o=ce(),s=rK(o,r,e,n,t,i);return s!==Cn&&UD(o,ai(),s),sU}function aU(r,e,n,t,i,o,s){let a=ce(),c=iK(a,r,e,n,t,i,o,s);return c!==Cn&&UD(a,ai(),c),aU}function UD(r,e,n){let t=OA(e,r);_q(r[Ze],t,n)}function cU(r,e,n){KA(e)&&(e=e());let t=ce(),i=To();if(xn(t,i,e)){let o=tt(),s=Qu();bF(s,t,r,e,t[Ze],n)}return cU}function oK(r,e){let n=KA(r);return n&&r.set(e),n}function lU(r,e){let n=ce(),t=tt(),i=gn();return Hk(t,n,n[Ze],i,r,e),lU}var uU={};function dU(r){let e=tt(),n=ce(),t=r+et,i=tl(e,t,128,null,null);return zc(i,!1),Vf(e,n,t,uU),dU}function sK(r){ps("NgLet");let e=tt(),n=ce(),t=ai();return Vf(e,n,t,r),r}function aK(r){let e=GA(),n=Wc(e,et+r);if(n===uU)throw new oe(314,!1);return n}function cK(r){return xn(ce(),To(),r)?Ur(r):Cn}function lK(r,e,n=""){return iU(ce(),r,e,n)}function uK(r,e,n){let t=tt();if(t.firstCreatePass){let i=Mi(r);HR(n,t.data,t.blueprint,i,!0),HR(e,t.data,t.blueprint,i,!1)}}function HR(r,e,n,t,i){if(r=hn(r),Array.isArray(r))for(let o=0;o<r.length;o++)HR(r[o],e,n,t,i);else{let o=tt(),s=ce(),a=gn(),c=xc(r)?r:hn(r.provide),l=yA(r),u=a.providerIndexes&1048575,d=a.directiveStart,f=a.providerIndexes>>20;if(xc(r)||!r.multi){let g=new Qc(l,i,ht,null),p=sR(c,e,i?u:u+f,d);p===-1?(cR(I_(a,s),o,c),oR(o,r,e.length),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(g),s.push(g)):(n[p]=g,s[p]=g)}else{let g=sR(c,e,u+f,d),p=sR(c,e,u,u+f),_=g>=0&&n[g],T=p>=0&&n[p];if(i&&!T||!i&&!_){cR(I_(a,s),o,c);let R=fK(i?hK:dK,n.length,i,t,l,r);!i&&T&&(n[p].providerFactory=R),oR(o,r,e.length,0),e.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(R),s.push(R)}else{let R=hU(n[i?p:g],l,!i&&t);oR(o,r,g>-1?g:p,R)}!i&&t&&T&&n[p].componentProviders++}}}function oR(r,e,n,t){let i=xc(e),o=_0(e);if(i||o){let c=(o?hn(e.useClass):e).prototype.ngOnDestroy;if(c){let l=r.destroyHooks||(r.destroyHooks=[]);if(!i&&e.multi){let u=l.indexOf(n);u===-1?l.push(n,[t,c]):l[u+1].push(t,c)}else l.push(n,c)}}}function hU(r,e,n){return n&&r.componentProviders++,r.multi.push(e)-1}function sR(r,e,n,t){for(let i=n;i<t;i++)if(e[i]===r)return i;return-1}function dK(r,e,n,t,i){return WR(this.multi,[])}function hK(r,e,n,t,i){let o=this.multi,s;if(this.providerFactory){let a=this.providerFactory.componentProviders,c=zf(t,t[Te],this.providerFactory.index,i);s=c.slice(0,a),WR(o,s);for(let l=a;l<c.length;l++)s.push(c[l])}else s=[],WR(o,s);return s}function WR(r,e){for(let n=0;n<r.length;n++){let t=r[n];e.push(t())}return e}function fK(r,e,n,t,i,o){let s=new Qc(r,n,ht,null);return s.multi=[],s.index=e,s.componentProviders=0,hU(s,i,t&&!n),s}function gK(r,e=[]){return n=>{n.providersResolver=(t,i)=>uK(t,i?i(r):r,e)}}function mK(r,e,n){let t=r.\u0275cmp;t.directiveDefs=M_(e,Ik),t.pipeDefs=M_(n,TA)}function pK(r,e,n){let t=cr()+r,i=ce();return i[t]===Cn?Do(i,t,n?e.call(n):e()):ng(i,t)}function EK(r,e,n,t){return fU(ce(),cr(),r,e,n,t)}function _K(r,e,n,t,i){return gU(ce(),cr(),r,e,n,t,i)}function TK(r,e,n,t,i,o){return mU(ce(),cr(),r,e,n,t,i,o)}function IK(r,e,n,t,i,o,s){return DK(ce(),cr(),r,e,n,t,i,o,s)}function vK(r,e,n,t,i,o,s,a){let c=cr()+r,l=ce(),u=sd(l,c,n,t,i,o);return xn(l,c+4,s)||u?Do(l,c+5,a?e.call(a,n,t,i,o,s):e(n,t,i,o,s)):ng(l,c+5)}function yK(r,e,n,t,i,o,s,a,c){let l=cr()+r,u=ce(),d=sd(u,l,n,t,i,o);return od(u,l+4,s,a)||d?Do(u,l+6,c?e.call(c,n,t,i,o,s,a):e(n,t,i,o,s,a)):ng(u,l+6)}function SK(r,e,n,t,i,o,s,a,c,l){let u=cr()+r,d=ce(),f=sd(d,u,n,t,i,o);return SD(d,u+4,s,a,c)||f?Do(d,u+7,l?e.call(l,n,t,i,o,s,a,c):e(n,t,i,o,s,a,c)):ng(d,u+7)}function AK(r,e,n,t,i,o,s,a,c,l,u){let d=cr()+r,f=ce(),g=sd(f,d,n,t,i,o);return sd(f,d+4,s,a,c,l)||g?Do(f,d+8,u?e.call(u,n,t,i,o,s,a,c,l):e(n,t,i,o,s,a,c,l)):ng(f,d+8)}function RK(r,e,n,t){return pU(ce(),cr(),r,e,n,t)}function ag(r,e){let n=r[e];return n===Cn?void 0:n}function fU(r,e,n,t,i,o){let s=e+n;return xn(r,s,i)?Do(r,s+1,o?t.call(o,i):t(i)):ag(r,s+1)}function gU(r,e,n,t,i,o,s){let a=e+n;return od(r,a,i,o)?Do(r,a+2,s?t.call(s,i,o):t(i,o)):ag(r,a+2)}function mU(r,e,n,t,i,o,s,a){let c=e+n;return SD(r,c,i,o,s)?Do(r,c+3,a?t.call(a,i,o,s):t(i,o,s)):ag(r,c+3)}function DK(r,e,n,t,i,o,s,a,c){let l=e+n;return sd(r,l,i,o,s,a)?Do(r,l+4,c?t.call(c,i,o,s,a):t(i,o,s,a)):ag(r,l+4)}function pU(r,e,n,t,i,o){let s=e+n,a=!1;for(let c=0;c<i.length;c++)xn(r,s++,i[c])&&(a=!0);return a?Do(r,s,t.apply(o,i)):ag(r,s)}function CK(r,e){let n=tt(),t,i=r+et;n.firstCreatePass?(t=NK(e,n.pipeRegistry),n.data[i]=t,t.onDestroy&&(n.destroyHooks??=[]).push(i,t.onDestroy)):t=n.data[i];let o=t.factory||(t.factory=Zs(t.type,!0)),s,a=sr(ht);try{let c=T_(!1),l=o();return T_(c),Vf(n,ce(),i,l),l}finally{sr(a)}}function NK(r,e){if(e)for(let n=e.length-1;n>=0;n--){let t=e[n];if(r===t.name)return t}}function OK(r,e,n){let t=r+et,i=ce(),o=Wc(i,t);return eT(i,t)?fU(i,cr(),e,o.transform,n,o):o.transform(n)}function wK(r,e,n,t){let i=r+et,o=ce(),s=Wc(o,i);return eT(o,i)?gU(o,cr(),e,s.transform,n,t,s):s.transform(n,t)}function bK(r,e,n,t,i){let o=r+et,s=ce(),a=Wc(s,o);return eT(s,o)?mU(s,cr(),e,a.transform,n,t,i,a):a.transform(n,t,i)}function LK(r,e,n){let t=r+et,i=ce(),o=Wc(i,t);return eT(i,t)?pU(i,cr(),e,o.transform,n,o):o.transform.apply(o,n)}function eT(r,e){return r[Te].data[e].pure}function MK(r,e){return K_(r,e)}var u_=null;function EU(r){u_!==null&&(r.defaultEncapsulation!==u_.defaultEncapsulation||r.preserveWhitespaces!==u_.preserveWhitespaces)||(u_=r)}var _U=new ee("");var PK=(()=>{class r{zone=J(Me);changeDetectionScheduler=J(ni);applicationRef=J(ha);applicationErrorHandler=J(Io);_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(n){this.applicationErrorHandler(n)}})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function TU({ngZoneFactory:r,ignoreChangesOutsideZone:e,scheduleInRootZone:n}){return r??=()=>new Me(le(x({},VD()),{scheduleInRootZone:n})),[{provide:Me,useFactory:r},{provide:na,multi:!0,useFactory:()=>{let t=J(PK,{optional:!0});return()=>t.initialize()}},{provide:na,multi:!0,useFactory:()=>{let t=J(xK);return()=>{t.initialize()}}},e===!0?{provide:YA,useValue:!0}:[],{provide:r_,useValue:n??EF},{provide:Io,useFactory:()=>{let t=J(Me),i=J(Kn),o;return s=>{t.runOutsideAngular(()=>{i.destroyed&&!o?setTimeout(()=>{throw s}):(o??=i.get(kr),o.handleError(s))})}}}]}function VD(r){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:r?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:r?.runCoalescing??!1}}var xK=(()=>{class r{subscription=new mt;initialized=!1;zone=J(Me);pendingTasks=J(ca);initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{Me.assertNotInAngularZone(),queueMicrotask(()=>{n!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{Me.assertInAngularZone(),n??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var BD=(()=>{class r{applicationErrorHandler=J(Io);appRef=J(ha);taskService=J(ca);ngZone=J(Me);zonelessEnabled=J(Ju);tracing=J(el,{optional:!0});disableScheduling=J(YA,{optional:!0})??!1;zoneIsDefined=typeof Zone<"u"&&!!Zone.root.run;schedulerTickApplyArgs=[{data:{__scheduler_tick__:!0}}];subscriptions=new mt;angularZoneId=this.zoneIsDefined?this.ngZone._inner?.get(S_):null;scheduleInRootZone=!this.zonelessEnabled&&this.zoneIsDefined&&(J(r_,{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 rd||!this.zoneIsDefined)}notify(n){if(!this.zonelessEnabled&&n===5)return;let t=!1;switch(n){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?ox:_F;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>i(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>i(()=>this.tick()))}shouldScheduleTick(n){return!(this.disableScheduling&&!n||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(S_+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 n=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(t){this.taskService.remove(n),this.applicationErrorHandler(t)}finally{this.cleanup()}this.useMicrotaskScheduler=!0,ox(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(n)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){if(this.runningTick=!1,this.cancelScheduledCallback?.(),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let n=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(n)}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function FK(){return ps("NgZoneless"),_r([{provide:ni,useExisting:BD},{provide:Me,useClass:rd},{provide:Ju,useValue:!0},{provide:r_,useValue:!1},[]])}function kK(){return typeof $localize<"u"&&$localize.locale||sg}var cg=new ee("",{providedIn:"root",factory:()=>J(cg,{optional:!0,skipSelf:!0})||kK()});var tT=class{destroyed=!1;listeners=null;errorHandler=J(kr,{optional:!0});destroyRef=J(lr);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 n=this.listeners?.indexOf(e);n!==void 0&&n!==-1&&this.listeners?.splice(n,1)}}}emit(e){if(this.destroyed){console.warn(ta(953,!1));return}if(this.listeners===null)return;let n=Ae(null);try{for(let t of this.listeners)try{t(e)}catch(i){this.errorHandler?.handleError(i)}}finally{Ae(n)}}};function lg(r){return e0(r)}function ug(r,e){return Cf(r,e?.equal)}var GD=class{[Rn];constructor(e){this[Rn]=e}destroy(){this[Rn].destroy()}};function $D(r,e){let n=e?.injector??J(ut),t=e?.manualCleanup!==!0?n.get(lr):null,i,o=n.get(Xu,null,{optional:!0}),s=n.get(ni);return o!==null?(i=BK(o.view,s,r),t instanceof Lf&&t._lView===o.view&&(t=null)):i=GK(r,n.get(jf),s),i.injector=n,t!==null&&(i.onDestroyFn=t.onDestroy(()=>i.destroy())),new GD(i)}var IU=le(x({},t0),{cleanupFns:void 0,zone:null,onDestroyFn:Kc,run(){let r=Yu(!1);try{n0(this)}finally{Yu(r)}},cleanup(){if(!this.cleanupFns?.length)return;let r=Ae(null);try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[],Ae(r)}}}),UK=le(x({},IU),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(12)},destroy(){bc(this),this.onDestroyFn(),this.cleanup(),this.scheduler.remove(this)}}),VK=le(x({},IU),{consumerMarkedDirty(){this.view[Re]|=8192,sa(this.view),this.notifier.notify(13)},destroy(){bc(this),this.onDestroyFn(),this.cleanup(),this.view[cs]?.delete(this)}});function BK(r,e,n){let t=Object.create(VK);return t.view=r,t.zone=typeof Zone<"u"?Zone.current:null,t.notifier=e,t.fn=vU(t,n),r[cs]??=new Set,r[cs].add(t),t.consumerMarkedDirty(t),t}function GK(r,e,n){let t=Object.create(UK);return t.fn=vU(t,r),t.scheduler=e,t.notifier=n,t.zone=typeof Zone<"u"?Zone.current:null,t.scheduler.add(t),t.notifier.notify(12),t}function vU(r,e){return()=>{e(n=>(r.cleanupFns??=[]).push(n))}}var OU=Symbol("InputSignalNode#UNSET"),ZK=le(x({},NE),{transformFn:void 0,applyValueToInputSignal(r,e){Uu(r,e)}});function wU(r,e){let n=Object.create(ZK);n.value=r,n.transformFn=e?.transform;function t(){if(Pu(n),n.value===OU){let i=null;throw new oe(-950,i)}return n.value}return t[Rn]=n,t}var eY=new ee("");eY.__NG_ELEMENT_ID__=r=>{let e=gn();if(e===null)throw new oe(204,!1);if(e.type&2)return e.value;if(r&8)return null;throw new oe(204,!1)};function _ye(r){return new tT}function yU(r,e){return wU(r,e)}function tY(r){return wU(OU,r)}var Tye=(yU.required=tY,yU);function SU(r,e){return dk(e)}function nY(r,e){return hk(e)}var Iye=(SU.required=nY,SU);function rY(r,e,n){let t=new b_(n);return Promise.resolve(t)}function AU(r){for(let e=r.length-1;e>=0;e--)if(r[e]!==void 0)return r[e]}var nT=new ee(""),iY=new ee("");function dg(r){return!r.moduleRef}function oY(r){let e=dg(r)?r.r3Injector:r.moduleRef.injector,n=e.get(Me);return n.run(()=>{dg(r)?r.r3Injector.resolveInjectorInitializers():r.moduleRef.resolveInjectorInitializers();let t=e.get(Io),i;if(n.runOutsideAngular(()=>{i=n.onError.subscribe({next:t})}),dg(r)){let o=()=>e.destroy(),s=r.platformInjector.get(nT);s.add(o),e.onDestroy(()=>{i.unsubscribe(),s.delete(o)})}else{let o=()=>r.moduleRef.destroy(),s=r.platformInjector.get(nT);s.add(o),r.moduleRef.onDestroy(()=>{Wf(r.allPlatformModules,r.moduleRef),i.unsubscribe(),s.delete(o)})}return aY(t,n,()=>{let o=e.get(ca),s=o.add(),a=e.get(ND);return a.runInitializers(),a.donePromise.then(()=>{let c=e.get(cg,sg);if(Gk(c||sg),!e.get(iY,!0))return dg(r)?e.get(ha):(r.allPlatformModules.push(r.moduleRef),r.moduleRef);if(dg(r)){let u=e.get(ha);return r.rootComponent!==void 0&&u.bootstrap(r.rootComponent),u}else return bU?.(r.moduleRef,r.allPlatformModules),r.moduleRef}).finally(()=>{o.remove(s)})})})}var bU;function RU(){bU=sY}function sY(r,e){let n=r.injector.get(ha);if(r._bootstrapComponents.length>0)r._bootstrapComponents.forEach(t=>n.bootstrap(t));else if(r.instance.ngDoBootstrap)r.instance.ngDoBootstrap(n);else throw new oe(-403,!1);e.push(r)}function aY(r,e,n){try{let t=n();return Z_(t)?t.catch(i=>{throw e.runOutsideAngular(()=>r(i)),i}):t}catch(t){throw e.runOutsideAngular(()=>r(t)),t}}var LU=(()=>{class r{_injector;_modules=[];_destroyListeners=[];_destroyed=!1;constructor(n){this._injector=n}bootstrapModuleFactory(n,t){let i=t?.scheduleInRootZone,o=()=>IF(t?.ngZone,le(x({},VD({eventCoalescing:t?.ngZoneEventCoalescing,runCoalescing:t?.ngZoneRunCoalescing})),{scheduleInRootZone:i})),s=t?.ignoreChangesOutsideZone,a=[TU({ngZoneFactory:o,ignoreChangesOutsideZone:s}),{provide:ni,useExisting:BD},H0],c=_k(n.moduleType,this.injector,a);return RU(),oY({moduleRef:c,allPlatformModules:this._modules,platformInjector:this.injector})}bootstrapModule(n,t=[]){let i=OD({},t);return RU(),rY(this.injector,i,n).then(o=>this.bootstrapModuleFactory(o,i))}onDestroy(n){this._destroyListeners.push(n)}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 n=this._injector.get(nT,null);n&&(n.forEach(t=>t()),n.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}static \u0275fac=function(t){return new(t||r)(C(ut))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"platform"})}return r})(),QD=null;function cY(r){if(JD())throw new oe(400,!1);bk(),QD=r;let e=r.get(LU);return dY(r),e}function XD(r,e,n=[]){let t=`Platform: ${e}`,i=new ee(t);return(o=[])=>{let s=JD();if(!s){let a=[...n,...o,{provide:i,useValue:!0}];s=r?.(a)??cY(lY(a,t))}return uY(i)}}function lY(r=[],e){return ut.create({name:e,providers:[{provide:xf,useValue:"platform"},{provide:nT,useValue:new Set([()=>QD=null])},...r]})}function uY(r){let e=JD();if(!e)throw new oe(-401,!1);return e}function JD(){return QD?.get(LU)??null}function dY(r){let e=r.get(U_,null);mo(r,()=>{e?.forEach(n=>n())})}function ZD(){return!1}var hY=(()=>{class r{static __NG_ELEMENT_ID__=fY}return r})();function fY(r){return gY(gn(),ce(),(r&16)===16)}function gY(r,e,n){if(ls(r)&&!n){let t=si(r.index,e);return new la(t,t)}else if(r.type&175){let t=e[Yn];return new la(t,e)}return null}var jD=class{constructor(){}supports(e){return yD(e)}create(e){return new HD(e)}},mY=(r,e)=>e,HD=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||mY}forEachItem(e){let n;for(n=this._itHead;n!==null;n=n._next)e(n)}forEachOperation(e){let n=this._itHead,t=this._removalsHead,i=0,o=null;for(;n||t;){let s=!t||n&&n.currentIndex<DU(t,i,o)?n:t,a=DU(s,i,o),c=s.currentIndex;if(s===t)i--,t=t._nextRemoved;else if(n=n._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 n;for(n=this._previousItHead;n!==null;n=n._nextPrevious)e(n)}forEachAddedItem(e){let n;for(n=this._additionsHead;n!==null;n=n._nextAdded)e(n)}forEachMovedItem(e){let n;for(n=this._movesHead;n!==null;n=n._nextMoved)e(n)}forEachRemovedItem(e){let n;for(n=this._removalsHead;n!==null;n=n._nextRemoved)e(n)}forEachIdentityChange(e){let n;for(n=this._identityChangesHead;n!==null;n=n._nextIdentityChange)e(n)}diff(e){if(e==null&&(e=[]),!yD(e))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let n=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),n===null||!Object.is(n.trackById,s)?(n=this._mismatch(n,o,s,a),t=!0):(t&&(n=this._verifyReinsertion(n,o,s,a)),Object.is(n.item,o)||this._addIdentityChange(n,o)),n=n._next}else i=0,ZF(e,a=>{s=this._trackByFn(i,a),n===null||!Object.is(n.trackById,s)?(n=this._mismatch(n,a,s,i),t=!0):(t&&(n=this._verifyReinsertion(n,a,s,i)),Object.is(n.item,a)||this._addIdentityChange(n,a)),n=n._next,i++}),this.length=i;return this._truncate(n),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,n,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,n)||this._addIdentityChange(e,n),this._reinsertAfter(e,o,i)):(e=this._linkedRecords===null?null:this._linkedRecords.get(t,i),e!==null?(Object.is(e.item,n)||this._addIdentityChange(e,n),this._moveAfter(e,o,i)):e=this._addAfter(new WD(n,t),o,i)),e}_verifyReinsertion(e,n,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 n=e._next;this._addToRemovals(this._unlink(e)),e=n}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,n,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,n,t),this._addToMoves(e,t),e}_moveAfter(e,n,t){return this._unlink(e),this._insertAfter(e,n,t),this._addToMoves(e,t),e}_addAfter(e,n,t){return this._insertAfter(e,n,t),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,n,t){let i=n===null?this._itHead:n._next;return e._next=i,e._prev=n,i===null?this._itTail=e:i._prev=e,n===null?this._itHead=e:n._next=e,this._linkedRecords===null&&(this._linkedRecords=new rT),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 n=e._prev,t=e._next;return n===null?this._itHead=t:n._next=t,t===null?this._itTail=n:t._prev=n,e}_addToMoves(e,n){return e.previousIndex===n||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new rT),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,n){return e.item=n,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},WD=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,n){this.item=e,this.trackById=n}},zD=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,n){let t;for(t=this._head;t!==null;t=t._nextDup)if((n===null||n<=t.currentIndex)&&Object.is(t.trackById,e))return t;return null}remove(e){let n=e._prevDup,t=e._nextDup;return n===null?this._head=t:n._nextDup=t,t===null?this._tail=n:t._prevDup=n,this._head===null}},rT=class{map=new Map;put(e){let n=e.trackById,t=this.map.get(n);t||(t=new zD,this.map.set(n,t)),t.add(e)}get(e,n){let t=e,i=this.map.get(t);return i?i.get(e,n):null}remove(e){let n=e.trackById;return this.map.get(n).remove(e)&&this.map.delete(n),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function DU(r,e,n){let t=r.previousIndex;if(t===null)return t;let i=0;return n&&t<n.length&&(i=n[t]),t+e+i}var qD=class{constructor(){}supports(e){return e instanceof Map||X_(e)}create(){return new KD}},KD=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 n;for(n=this._mapHead;n!==null;n=n._next)e(n)}forEachPreviousItem(e){let n;for(n=this._previousMapHead;n!==null;n=n._nextPrevious)e(n)}forEachChangedItem(e){let n;for(n=this._changesHead;n!==null;n=n._nextChanged)e(n)}forEachAddedItem(e){let n;for(n=this._additionsHead;n!==null;n=n._nextAdded)e(n)}forEachRemovedItem(e){let n;for(n=this._removalsHead;n!==null;n=n._nextRemoved)e(n)}diff(e){if(!e)e=new Map;else if(!(e instanceof Map||X_(e)))throw new oe(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let n=this._mapHead;if(this._appendAfter=null,this._forEach(e,(t,i)=>{if(n&&n.key===i)this._maybeAddToChanges(n,t),this._appendAfter=n,n=n._next;else{let o=this._getOrCreateRecordForKey(i,t);n=this._insertBeforeOrAppend(n,o)}}),n){n._prev&&(n._prev._next=null),this._removalsHead=n;for(let t=n;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,n){if(e){let t=e._prev;return n._next=e,n._prev=t,e._prev=n,t&&(t._next=n),e===this._mapHead&&(this._mapHead=n),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=n,n._prev=this._appendAfter):this._mapHead=n,this._appendAfter=n,null}_getOrCreateRecordForKey(e,n){if(this._records.has(e)){let i=this._records.get(e);this._maybeAddToChanges(i,n);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 YD(e);return this._records.set(e,t),t.currentValue=n,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,n){Object.is(n,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=n,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,n){e instanceof Map?e.forEach(n):Object.keys(e).forEach(t=>n(e[t],t))}},YD=class{key;previousValue=null;currentValue=null;_nextPrevious=null;_next=null;_prev=null;_nextAdded=null;_nextRemoved=null;_nextChanged=null;constructor(e){this.key=e}};function CU(){return new eC([new jD])}var eC=(()=>{class r{factories;static \u0275prov=K({token:r,providedIn:"root",factory:CU});constructor(n){this.factories=n}static create(n,t){if(t!=null){let i=t.factories.slice();n=n.concat(i)}return new r(n)}static extend(n){return{provide:r,useFactory:()=>{let t=J(r,{optional:!0,skipSelf:!0});return r.create(n,t||CU())}}}find(n){let t=this.factories.find(i=>i.supports(n));if(t!=null)return t;throw new oe(901,!1)}}return r})();function NU(){return new iT([new qD])}var iT=(()=>{class r{static \u0275prov=K({token:r,providedIn:"root",factory:NU});factories;constructor(n){this.factories=n}static create(n,t){if(t){let i=t.factories.slice();n=n.concat(i)}return new r(n)}static extend(n){return{provide:r,useFactory:()=>{let t=J(r,{optional:!0,skipSelf:!0});return r.create(n,t||NU())}}}find(n){let t=this.factories.find(i=>i.supports(n));if(t)return t;throw new oe(901,!1)}}return r})();var MU=XD(null,"core",[]),PU=(()=>{class r{constructor(n){}static \u0275fac=function(t){return new(t||r)(C(ha))};static \u0275mod=da({type:r});static \u0275inj=ss({})}return r})();function vye(r){return typeof r=="boolean"?r:r!=null&&r!=="false"}function yye(r,e=NaN){return!isNaN(parseFloat(r))&&!isNaN(Number(r))?Number(r):e}function Sye(r,e){let n=ra(r),t=e.elementInjector||ju();return new ad(n).create(t,e.projectableNodes,e.hostElement,e.environmentInjector,e.directives,e.bindings)}var kU=null;function Oo(){return kU}function tC(r){kU??=r}var hg=class{},nC=(()=>{class r{historyGo(n){throw new Error("")}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>J(UU),providedIn:"platform"})}return r})();var UU=(()=>{class r extends nC{_location;_history;_doc=J(Dn);constructor(){super(),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return Oo().getBaseHref(this._doc)}onPopState(n){let t=Oo().getGlobalEventTarget(this._doc,"window");return t.addEventListener("popstate",n,!1),()=>t.removeEventListener("popstate",n)}onHashChange(n){let t=Oo().getGlobalEventTarget(this._doc,"window");return t.addEventListener("hashchange",n,!1),()=>t.removeEventListener("hashchange",n)}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(n){this._location.pathname=n}pushState(n,t,i){this._history.pushState(n,t,i)}replaceState(n,t,i){this._history.replaceState(n,t,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(n=0){this._history.go(n)}getState(){return this._history.state}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>new r,providedIn:"platform"})}return r})();function VU(r,e){return r?e?r.endsWith("/")?e.startsWith("/")?r+e.slice(1):r+e:e.startsWith("/")?r+e:`${r}/${e}`:r:e}function xU(r){let e=r.search(/#|\?|$/);return r[e-1]==="/"?r.slice(0,e-1)+r.slice(e):r}function fa(r){return r&&r[0]!=="?"?`?${r}`:r}var oT=(()=>{class r{historyGo(n){throw new Error("")}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:()=>J(GU),providedIn:"root"})}return r})(),BU=new ee(""),GU=(()=>{class r extends oT{_platformLocation;_baseHref;_removeListenerFns=[];constructor(n,t){super(),this._platformLocation=n,this._baseHref=t??this._platformLocation.getBaseHrefFromDOM()??J(Dn).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}prepareExternalUrl(n){return VU(this._baseHref,n)}path(n=!1){let t=this._platformLocation.pathname+fa(this._platformLocation.search),i=this._platformLocation.hash;return i&&n?`${t}${i}`:t}pushState(n,t,i,o){let s=this.prepareExternalUrl(i+fa(o));this._platformLocation.pushState(n,t,s)}replaceState(n,t,i,o){let s=this.prepareExternalUrl(i+fa(o));this._platformLocation.replaceState(n,t,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static \u0275fac=function(t){return new(t||r)(C(nC),C(BU,8))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),$U=(()=>{class r{_subject=new Ot;_basePath;_locationStrategy;_urlChangeListeners=[];_urlChangeSubscription=null;constructor(n){this._locationStrategy=n;let t=this._locationStrategy.getBaseHref();this._basePath=_Y(xU(FU(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(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,t=""){return this.path()==this.normalize(n+fa(t))}normalize(n){return r.stripTrailingSlash(EY(this._basePath,FU(n)))}prepareExternalUrl(n){return n&&n[0]!=="/"&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,t="",i=null){this._locationStrategy.pushState(i,"",n,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+fa(t)),i)}replaceState(n,t="",i=null){this._locationStrategy.replaceState(i,"",n,t),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+fa(t)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){this._locationStrategy.historyGo?.(n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??=this.subscribe(t=>{this._notifyUrlChangeListeners(t.url,t.state)}),()=>{let t=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(t,1),this._urlChangeListeners.length===0&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",t){this._urlChangeListeners.forEach(i=>i(n,t))}subscribe(n,t,i){return this._subject.subscribe({next:n,error:t??void 0,complete:i??void 0})}static normalizeQueryParams=fa;static joinWithSlash=VU;static stripTrailingSlash=xU;static \u0275fac=function(t){return new(t||r)(C(oT))};static \u0275prov=K({token:r,factory:()=>pY(),providedIn:"root"})}return r})();function pY(){return new $U(C(oT))}function EY(r,e){if(!r||!e.startsWith(r))return e;let n=e.substring(r.length);return n===""||["/",";","?","#"].includes(n[0])?n:e}function FU(r){return r.replace(/\/index.html$/,"")}function _Y(r){if(new RegExp("^(https?:)?//").test(r)){let[,n]=r.split(/\/\/[^\/]+/);return n}return r}var Qn=(function(r){return r[r.Format=0]="Format",r[r.Standalone=1]="Standalone",r})(Qn||{}),at=(function(r){return r[r.Narrow=0]="Narrow",r[r.Abbreviated=1]="Abbreviated",r[r.Wide=2]="Wide",r[r.Short=3]="Short",r})(at||{}),Tr=(function(r){return r[r.Short=0]="Short",r[r.Medium=1]="Medium",r[r.Long=2]="Long",r[r.Full=3]="Full",r})(Tr||{}),_s={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 KU(r){return $r(r)[Yt.LocaleId]}function YU(r,e,n){let t=$r(r),i=[t[Yt.DayPeriodsFormat],t[Yt.DayPeriodsStandalone]],o=li(i,e);return li(o,n)}function QU(r,e,n){let t=$r(r),i=[t[Yt.DaysFormat],t[Yt.DaysStandalone]],o=li(i,e);return li(o,n)}function XU(r,e,n){let t=$r(r),i=[t[Yt.MonthsFormat],t[Yt.MonthsStandalone]],o=li(i,e);return li(o,n)}function JU(r,e){let t=$r(r)[Yt.Eras];return li(t,e)}function fg(r,e){let n=$r(r);return li(n[Yt.DateFormat],e)}function gg(r,e){let n=$r(r);return li(n[Yt.TimeFormat],e)}function mg(r,e){let t=$r(r)[Yt.DateTimeFormat];return li(t,e)}function pg(r,e){let n=$r(r),t=n[Yt.NumberSymbols][e];if(typeof t>"u"){if(e===_s.CurrencyDecimal)return n[Yt.NumberSymbols][_s.Decimal];if(e===_s.CurrencyGroup)return n[Yt.NumberSymbols][_s.Group]}return t}function ZU(r){if(!r[Yt.ExtraData])throw new oe(2303,!1)}function e1(r){let e=$r(r);return ZU(e),(e[Yt.ExtraData][2]||[]).map(t=>typeof t=="string"?rC(t):[rC(t[0]),rC(t[1])])}function t1(r,e,n){let t=$r(r);ZU(t);let i=[t[Yt.ExtraData][0],t[Yt.ExtraData][1]],o=li(i,e)||[];return li(o,n)||[]}function li(r,e){for(let n=e;n>-1;n--)if(typeof r[n]<"u")return r[n];throw new oe(2304,!1)}function rC(r){let[e,n]=r.split(":");return{hours:+e,minutes:+n}}var TY=/^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/,sT={},IY=/((?:[^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 n1(r,e,n,t){let i=OY(r);e=Es(n,e)||e;let s=[],a;for(;e;)if(a=IY.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=i1(t,c),i=NY(i,t));let l="";return s.forEach(u=>{let d=DY(u);l+=d?d(i,n,c):u==="''"?"'":u.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),l}function dT(r,e,n){let t=new Date(0);return t.setFullYear(r,e,n),t.setHours(0,0,0),t}function Es(r,e){let n=KU(r);if(sT[n]??={},sT[n][e])return sT[n][e];let t="";switch(e){case"shortDate":t=fg(r,Tr.Short);break;case"mediumDate":t=fg(r,Tr.Medium);break;case"longDate":t=fg(r,Tr.Long);break;case"fullDate":t=fg(r,Tr.Full);break;case"shortTime":t=gg(r,Tr.Short);break;case"mediumTime":t=gg(r,Tr.Medium);break;case"longTime":t=gg(r,Tr.Long);break;case"fullTime":t=gg(r,Tr.Full);break;case"short":let i=Es(r,"shortTime"),o=Es(r,"shortDate");t=aT(mg(r,Tr.Short),[i,o]);break;case"medium":let s=Es(r,"mediumTime"),a=Es(r,"mediumDate");t=aT(mg(r,Tr.Medium),[s,a]);break;case"long":let c=Es(r,"longTime"),l=Es(r,"longDate");t=aT(mg(r,Tr.Long),[c,l]);break;case"full":let u=Es(r,"fullTime"),d=Es(r,"fullDate");t=aT(mg(r,Tr.Full),[u,d]);break}return t&&(sT[n][e]=t),t}function aT(r,e){return e&&(r=r.replace(/\{([^}]+)}/g,function(n,t){return e!=null&&t in e?e[t]:n})),r}function Fi(r,e,n="-",t,i){let o="";(r<0||i&&r<=0)&&(i?r=-r+1:(r=-r,o=n));let s=String(r);for(;s.length<e;)s="0"+s;return t&&(s=s.slice(s.length-e)),o+s}function vY(r,e){return Fi(r,3).substring(0,e)}function tn(r,e,n=0,t=!1,i=!1){return function(o,s){let a=yY(r,o);if((n>0||a>-n)&&(a+=n),r===3)a===0&&n===-12&&(a=12);else if(r===6)return vY(a,e);let c=pg(s,_s.MinusSign);return Fi(a,e,c,t,i)}}function yY(r,e){switch(r){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 Et(r,e,n=Qn.Format,t=!1){return function(i,o){return SY(i,o,r,e,n,t)}}function SY(r,e,n,t,i,o){switch(n){case 2:return XU(e,i,t)[r.getMonth()];case 1:return QU(e,i,t)[r.getDay()];case 0:let s=r.getHours(),a=r.getMinutes();if(o){let l=e1(e),u=t1(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 YU(e,i,t)[s<12?0:1];case 3:return JU(e,t)[r.getFullYear()<=0?0:1];default:let c=n;throw new oe(2302,!1)}}function cT(r){return function(e,n,t){let i=-1*t,o=pg(n,_s.MinusSign),s=i>0?Math.floor(i/60):Math.ceil(i/60);switch(r){case 0:return(i>=0?"+":"")+Fi(s,2,o)+Fi(Math.abs(i%60),2,o);case 1:return"GMT"+(i>=0?"+":"")+Fi(s,1,o);case 2:return"GMT"+(i>=0?"+":"")+Fi(s,2,o)+":"+Fi(Math.abs(i%60),2,o);case 3:return t===0?"Z":(i>=0?"+":"")+Fi(s,2,o)+":"+Fi(Math.abs(i%60),2,o);default:throw new oe(2310,!1)}}}var AY=0,uT=4;function RY(r){let e=dT(r,AY,1).getDay();return dT(r,0,1+(e<=uT?uT:uT+7)-e)}function r1(r){let e=r.getDay(),n=e===0?-3:uT-e;return dT(r.getFullYear(),r.getMonth(),r.getDate()+n)}function iC(r,e=!1){return function(n,t){let i;if(e){let o=new Date(n.getFullYear(),n.getMonth(),1).getDay()-1,s=n.getDate();i=1+Math.floor((s+o)/7)}else{let o=r1(n),s=RY(o.getFullYear()),a=o.getTime()-s.getTime();i=1+Math.round(a/6048e5)}return Fi(i,r,pg(t,_s.MinusSign))}}function lT(r,e=!1){return function(n,t){let o=r1(n).getFullYear();return Fi(o,r,pg(t,_s.MinusSign),e)}}var oC={};function DY(r){if(oC[r])return oC[r];let e;switch(r){case"G":case"GG":case"GGG":e=Et(3,at.Abbreviated);break;case"GGGG":e=Et(3,at.Wide);break;case"GGGGG":e=Et(3,at.Narrow);break;case"y":e=tn(0,1,0,!1,!0);break;case"yy":e=tn(0,2,0,!0,!0);break;case"yyy":e=tn(0,3,0,!1,!0);break;case"yyyy":e=tn(0,4,0,!1,!0);break;case"Y":e=lT(1);break;case"YY":e=lT(2,!0);break;case"YYY":e=lT(3);break;case"YYYY":e=lT(4);break;case"M":case"L":e=tn(1,1,1);break;case"MM":case"LL":e=tn(1,2,1);break;case"MMM":e=Et(2,at.Abbreviated);break;case"MMMM":e=Et(2,at.Wide);break;case"MMMMM":e=Et(2,at.Narrow);break;case"LLL":e=Et(2,at.Abbreviated,Qn.Standalone);break;case"LLLL":e=Et(2,at.Wide,Qn.Standalone);break;case"LLLLL":e=Et(2,at.Narrow,Qn.Standalone);break;case"w":e=iC(1);break;case"ww":e=iC(2);break;case"W":e=iC(1,!0);break;case"d":e=tn(2,1);break;case"dd":e=tn(2,2);break;case"c":case"cc":e=tn(7,1);break;case"ccc":e=Et(1,at.Abbreviated,Qn.Standalone);break;case"cccc":e=Et(1,at.Wide,Qn.Standalone);break;case"ccccc":e=Et(1,at.Narrow,Qn.Standalone);break;case"cccccc":e=Et(1,at.Short,Qn.Standalone);break;case"E":case"EE":case"EEE":e=Et(1,at.Abbreviated);break;case"EEEE":e=Et(1,at.Wide);break;case"EEEEE":e=Et(1,at.Narrow);break;case"EEEEEE":e=Et(1,at.Short);break;case"a":case"aa":case"aaa":e=Et(0,at.Abbreviated);break;case"aaaa":e=Et(0,at.Wide);break;case"aaaaa":e=Et(0,at.Narrow);break;case"b":case"bb":case"bbb":e=Et(0,at.Abbreviated,Qn.Standalone,!0);break;case"bbbb":e=Et(0,at.Wide,Qn.Standalone,!0);break;case"bbbbb":e=Et(0,at.Narrow,Qn.Standalone,!0);break;case"B":case"BB":case"BBB":e=Et(0,at.Abbreviated,Qn.Format,!0);break;case"BBBB":e=Et(0,at.Wide,Qn.Format,!0);break;case"BBBBB":e=Et(0,at.Narrow,Qn.Format,!0);break;case"h":e=tn(3,1,-12);break;case"hh":e=tn(3,2,-12);break;case"H":e=tn(3,1);break;case"HH":e=tn(3,2);break;case"m":e=tn(4,1);break;case"mm":e=tn(4,2);break;case"s":e=tn(5,1);break;case"ss":e=tn(5,2);break;case"S":e=tn(6,1);break;case"SS":e=tn(6,2);break;case"SSS":e=tn(6,3);break;case"Z":case"ZZ":case"ZZZ":e=cT(0);break;case"ZZZZZ":e=cT(3);break;case"O":case"OO":case"OOO":case"z":case"zz":case"zzz":e=cT(1);break;case"OOOO":case"ZZZZ":case"zzzz":e=cT(2);break;default:return null}return oC[r]=e,e}function i1(r,e){r=r.replace(/:/g,"");let n=Date.parse("Jan 01, 1970 00:00:00 "+r)/6e4;return isNaN(n)?e:n}function CY(r,e){return r=new Date(r.getTime()),r.setMinutes(r.getMinutes()+e),r}function NY(r,e,n){let i=r.getTimezoneOffset(),o=i1(e,i);return CY(r,-1*(o-i))}function OY(r){if(jU(r))return r;if(typeof r=="number"&&!isNaN(r))return new Date(r);if(typeof r=="string"){if(r=r.trim(),/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(r)){let[i,o=1,s=1]=r.split("-").map(a=>+a);return dT(i,o-1,s)}let n=parseFloat(r);if(!isNaN(r-n))return new Date(n);let t;if(t=r.match(TY))return wY(t)}let e=new Date(r);if(!jU(e))throw new oe(2311,!1);return e}function wY(r){let e=new Date(0),n=0,t=0,i=r[8]?e.setUTCFullYear:e.setFullYear,o=r[8]?e.setUTCHours:e.setHours;r[9]&&(n=Number(r[9]+r[10]),t=Number(r[9]+r[11])),i.call(e,Number(r[1]),Number(r[2])-1,Number(r[3]));let s=Number(r[4]||0)-n,a=Number(r[5]||0)-t,c=Number(r[6]||0),l=Math.floor(parseFloat("0."+(r[7]||0))*1e3);return o.call(e,s,a,c,l),e}function jU(r){return r instanceof Date&&!isNaN(r.valueOf())}var sC=/\s+/,HU=[],bY=(()=>{class r{_ngEl;_renderer;initialClasses=HU;rawClass;stateMap=new Map;constructor(n,t){this._ngEl=n,this._renderer=t}set klass(n){this.initialClasses=n!=null?n.trim().split(sC):HU}set ngClass(n){this.rawClass=typeof n=="string"?n.trim().split(sC):n}ngDoCheck(){for(let t of this.initialClasses)this._updateState(t,!0);let n=this.rawClass;if(Array.isArray(n)||n instanceof Set)for(let t of n)this._updateState(t,!0);else if(n!=null)for(let t of Object.keys(n))this._updateState(t,!!n[t]);this._applyStateDiff()}_updateState(n,t){let i=this.stateMap.get(n);i!==void 0?(i.enabled!==t&&(i.changed=!0,i.enabled=t),i.touched=!0):this.stateMap.set(n,{enabled:t,changed:!0,touched:!0})}_applyStateDiff(){for(let n of this.stateMap){let t=n[0],i=n[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(n,t){n=n.trim(),n.length>0&&n.split(sC).forEach(i=>{t?this._renderer.addClass(this._ngEl.nativeElement,i):this._renderer.removeClass(this._ngEl.nativeElement,i)})}static \u0275fac=function(t){return new(t||r)(ht(ua),ht(Q_))};static \u0275dir=No({type:r,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}})}return r})();var hT=class{$implicit;ngForOf;index;count;constructor(e,n,t,i){this.$implicit=e,this.ngForOf=n,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}},o1=(()=>{class r{_viewContainer;_template;_differs;set ngForOf(n){this._ngForOf=n,this._ngForOfDirty=!0}set ngForTrackBy(n){this._trackByFn=n}get ngForTrackBy(){return this._trackByFn}_ngForOf=null;_ngForOfDirty=!0;_differ=null;_trackByFn;constructor(n,t,i){this._viewContainer=n,this._template=t,this._differs=i}set ngForTemplate(n){n&&(this._template=n)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let n=this._ngForOf;!this._differ&&n&&(this._differ=this._differs.find(n).create(this.ngForTrackBy))}if(this._differ){let n=this._differ.diff(this._ngForOf);n&&this._applyChanges(n)}}_applyChanges(n){let t=this._viewContainer;n.forEachOperation((i,o,s)=>{if(i.previousIndex==null)t.createEmbeddedView(this._template,new hT(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),WU(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}n.forEachIdentityChange(i=>{let o=t.get(i.currentIndex);WU(o,i)})}static ngTemplateContextGuard(n,t){return!0}static \u0275fac=function(t){return new(t||r)(ht(Co),ht(Ao),ht(eC))};static \u0275dir=No({type:r,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}})}return r})();function WU(r,e){r.context.$implicit=e.item}var LY=(()=>{class r{_viewContainer;_context=new fT;_thenTemplateRef=null;_elseTemplateRef=null;_thenViewRef=null;_elseViewRef=null;constructor(n,t){this._viewContainer=n,this._thenTemplateRef=t}set ngIf(n){this._context.$implicit=this._context.ngIf=n,this._updateView()}set ngIfThen(n){zU(n,!1),this._thenTemplateRef=n,this._thenViewRef=null,this._updateView()}set ngIfElse(n){zU(n,!1),this._elseTemplateRef=n,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(n,t){return!0}static \u0275fac=function(t){return new(t||r)(ht(Co),ht(Ao))};static \u0275dir=No({type:r,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}})}return r})(),fT=class{$implicit=null;ngIf=null};function zU(r,e){if(r&&!r.createEmbeddedView)throw new oe(2020,!1)}var gT=class{_viewContainerRef;_templateRef;_created=!1;constructor(e,n){this._viewContainerRef=e,this._templateRef=n}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()}},aC=(()=>{class r{_defaultViews=[];_defaultUsed=!1;_caseCount=0;_lastCaseCheckIndex=0;_lastCasesMatched=!1;_ngSwitch;set ngSwitch(n){this._ngSwitch=n,this._caseCount===0&&this._updateDefaultCases(!0)}_addCase(){return this._caseCount++}_addDefault(n){this._defaultViews.push(n)}_matchCase(n){let t=n===this._ngSwitch;return this._lastCasesMatched||=t,this._lastCaseCheckIndex++,this._lastCaseCheckIndex===this._caseCount&&(this._updateDefaultCases(!this._lastCasesMatched),this._lastCaseCheckIndex=0,this._lastCasesMatched=!1),t}_updateDefaultCases(n){if(this._defaultViews.length>0&&n!==this._defaultUsed){this._defaultUsed=n;for(let t of this._defaultViews)t.enforceState(n)}}static \u0275fac=function(t){return new(t||r)};static \u0275dir=No({type:r,selectors:[["","ngSwitch",""]],inputs:{ngSwitch:"ngSwitch"}})}return r})(),MY=(()=>{class r{ngSwitch;_view;ngSwitchCase;constructor(n,t,i){this.ngSwitch=i,i._addCase(),this._view=new gT(n,t)}ngDoCheck(){this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase))}static \u0275fac=function(t){return new(t||r)(ht(Co),ht(Ao),ht(aC,9))};static \u0275dir=No({type:r,selectors:[["","ngSwitchCase",""]],inputs:{ngSwitchCase:"ngSwitchCase"}})}return r})(),PY=(()=>{class r{constructor(n,t,i){i._addDefault(new gT(n,t))}static \u0275fac=function(t){return new(t||r)(ht(Co),ht(Ao),ht(aC,9))};static \u0275dir=No({type:r,selectors:[["","ngSwitchDefault",""]]})}return r})();var xY=(()=>{class r{_ngEl;_differs;_renderer;_ngStyle=null;_differ=null;constructor(n,t,i){this._ngEl=n,this._differs=t,this._renderer=i}set ngStyle(n){this._ngStyle=n,!this._differ&&n&&(this._differ=this._differs.find(n).create())}ngDoCheck(){if(this._differ){let n=this._differ.diff(this._ngStyle);n&&this._applyChanges(n)}}_setStyle(n,t){let[i,o]=n.split("."),s=i.indexOf("-")===-1?void 0:xi.DashCase;t!=null?this._renderer.setStyle(this._ngEl.nativeElement,i,o?`${t}${o}`:t,s):this._renderer.removeStyle(this._ngEl.nativeElement,i,s)}_applyChanges(n){n.forEachRemovedItem(t=>this._setStyle(t.key,null)),n.forEachAddedItem(t=>this._setStyle(t.key,t.currentValue)),n.forEachChangedItem(t=>this._setStyle(t.key,t.currentValue))}static \u0275fac=function(t){return new(t||r)(ht(ua),ht(iT),ht(Q_))};static \u0275dir=No({type:r,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}})}return r})(),FY=(()=>{class r{_viewContainerRef;_viewRef=null;ngTemplateOutletContext=null;ngTemplateOutlet=null;ngTemplateOutletInjector=null;constructor(n){this._viewContainerRef=n}ngOnChanges(n){if(this._shouldRecreateView(n)){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(n){return!!n.ngTemplateOutlet||!!n.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(n,t,i)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,t,i):!1,get:(n,t,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,t,i)}})}static \u0275fac=function(t){return new(t||r)(ht(Co))};static \u0275dir=No({type:r,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[zR]})}return r})();function s1(r,e){return new oe(2100,!1)}var kY=/(?:[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,UY=(()=>{class r{transform(n){if(n==null)return null;if(typeof n!="string")throw s1(r,n);return n.replace(kY,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}static \u0275fac=function(t){return new(t||r)};static \u0275pipe=rg({name:"titlecase",type:r,pure:!0})}return r})();var VY="mediumDate",a1=new ee(""),c1=new ee(""),BY=(()=>{class r{locale;defaultTimezone;defaultOptions;constructor(n,t,i){this.locale=n,this.defaultTimezone=t,this.defaultOptions=i}transform(n,t,i,o){if(n==null||n===""||n!==n)return null;try{let s=t??this.defaultOptions?.dateFormat??VY,a=i??this.defaultOptions?.timezone??this.defaultTimezone??void 0;return n1(n,s,o||this.locale,a)}catch(s){throw s1(r,s.message)}}static \u0275fac=function(t){return new(t||r)(ht(cg,16),ht(a1,24),ht(c1,24))};static \u0275pipe=rg({name:"date",type:r,pure:!0})}return r})();function GY(r,e){return{key:r,value:e}}var $Y=(()=>{class r{differs;constructor(n){this.differs=n}differ;keyValues=[];compareFn=qU;transform(n,t=qU){if(!n||!(n instanceof Map)&&typeof n!="object")return null;this.differ??=this.differs.find(n).create();let i=this.differ.diff(n),o=t!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(s=>{this.keyValues.push(GY(s.key,s.currentValue))})),(i||o)&&(t&&this.keyValues.sort(t),this.compareFn=t),this.keyValues}static \u0275fac=function(t){return new(t||r)(ht(iT,16))};static \u0275pipe=rg({name:"keyvalue",type:r,pure:!1})}return r})();function qU(r,e){let n=r.key,t=e.key;if(n===t)return 0;if(n==null)return 1;if(t==null)return-1;if(typeof n=="string"&&typeof t=="string")return n<t?-1:1;if(typeof n=="number"&&typeof t=="number")return n-t;if(typeof n=="boolean"&&typeof t=="boolean")return n<t?-1:1;let i=String(n),o=String(t);return i==o?0:i<o?-1:1}var cC=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275mod=da({type:r});static \u0275inj=ss({})}return r})();function Eg(r,e){e=encodeURIComponent(e);for(let n of r.split(";")){let t=n.indexOf("="),[i,o]=t==-1?[n,""]:[n.slice(0,t),n.slice(t+1)];if(i.trim()===e)return decodeURIComponent(o)}return null}var nl=class{};var lC="browser";function l1(r){return r===lC}var _g=class{_doc;constructor(e){this._doc=e}manager},mT=(()=>{class r extends _g{constructor(n){super(n)}supports(n){return!0}addEventListener(n,t,i,o){return n.addEventListener(t,i,o),()=>this.removeEventListener(n,t,i,o)}removeEventListener(n,t,i,o){return n.removeEventListener(t,i,o)}static \u0275fac=function(t){return new(t||r)(C(Dn))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),ET=new ee(""),gC=(()=>{class r{_zone;_plugins;_eventNameToPlugin=new Map;constructor(n,t){this._zone=t,n.forEach(s=>{s.manager=this});let i=n.filter(s=>!(s instanceof mT));this._plugins=i.slice().reverse();let o=n.find(s=>s instanceof mT);o&&this._plugins.push(o)}addEventListener(n,t,i,o){return this._findPluginFor(t).addEventListener(n,t,i,o)}getZone(){return this._zone}_findPluginFor(n){let t=this._eventNameToPlugin.get(n);if(t)return t;if(t=this._plugins.find(o=>o.supports(n)),!t)throw new oe(5101,!1);return this._eventNameToPlugin.set(n,t),t}static \u0275fac=function(t){return new(t||r)(C(ET),C(Me))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),uC="ng-app-id";function u1(r){for(let e of r)e.remove()}function d1(r,e){let n=e.createElement("style");return n.textContent=r,n}function jY(r,e,n,t){let i=r.head?.querySelectorAll(`style[${uC}="${e}"],link[${uC}="${e}"]`);if(i)for(let o of i)o.removeAttribute(uC),o instanceof HTMLLinkElement?t.set(o.href.slice(o.href.lastIndexOf("/")+1),{usage:0,elements:[o]}):o.textContent&&n.set(o.textContent,{usage:0,elements:[o]})}function hC(r,e){let n=e.createElement("link");return n.setAttribute("rel","stylesheet"),n.setAttribute("href",r),n}var mC=(()=>{class r{doc;appId;nonce;inline=new Map;external=new Map;hosts=new Set;constructor(n,t,i,o={}){this.doc=n,this.appId=t,this.nonce=i,jY(n,t,this.inline,this.external),this.hosts.add(n.head)}addStyles(n,t){for(let i of n)this.addUsage(i,this.inline,d1);t?.forEach(i=>this.addUsage(i,this.external,hC))}removeStyles(n,t){for(let i of n)this.removeUsage(i,this.inline);t?.forEach(i=>this.removeUsage(i,this.external))}addUsage(n,t,i){let o=t.get(n);o?o.usage++:t.set(n,{usage:1,elements:[...this.hosts].map(s=>this.addElement(s,i(n,this.doc)))})}removeUsage(n,t){let i=t.get(n);i&&(i.usage--,i.usage<=0&&(u1(i.elements),t.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])u1(n);this.hosts.clear()}addHost(n){this.hosts.add(n);for(let[t,{elements:i}]of this.inline)i.push(this.addElement(n,d1(t,this.doc)));for(let[t,{elements:i}]of this.external)i.push(this.addElement(n,hC(t,this.doc)))}removeHost(n){this.hosts.delete(n)}addElement(n,t){return this.nonce&&t.setAttribute("nonce",this.nonce),n.appendChild(t)}static \u0275fac=function(t){return new(t||r)(C(Dn),C(k_),C(gd,8),C(gs))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),dC={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"},pC=/%COMP%/g;var f1="%COMP%",HY=`_nghost-${f1}`,WY=`_ngcontent-${f1}`,zY=!0,qY=new ee("",{providedIn:"root",factory:()=>zY});function KY(r){return WY.replace(pC,r)}function YY(r){return HY.replace(pC,r)}function g1(r,e){return e.map(n=>n.replace(pC,r))}var EC=(()=>{class r{eventManager;sharedStylesHost;appId;removeStylesOnCompDestroy;doc;ngZone;nonce;tracingService;rendererByCompId=new Map;defaultRenderer;platformIsServer;constructor(n,t,i,o,s,a,c=null,l=null){this.eventManager=n,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 Tg(n,s,a,this.platformIsServer,this.tracingService)}createRenderer(n,t){if(!n||!t)return this.defaultRenderer;let i=this.getOrCreateRenderer(n,t);return i instanceof pT?i.applyToHost(n):i instanceof Ig&&i.applyStyles(),i}getOrCreateRenderer(n,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 ds.Emulated:o=new pT(c,l,t,this.appId,u,s,a,d,f);break;case ds.ShadowDom:return new fC(c,l,n,t,s,a,this.nonce,d,f);default:o=new Ig(c,l,t,u,s,a,d,f);break}i.set(t.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}componentReplaced(n){this.rendererByCompId.delete(n)}static \u0275fac=function(t){return new(t||r)(C(gC),C(mC),C(k_),C(qY),C(Dn),C(Me),C(gd),C(el,8))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),Tg=class{eventManager;doc;ngZone;platformIsServer;tracingService;data=Object.create(null);throwOnSyntheticProps=!0;constructor(e,n,t,i,o){this.eventManager=e,this.doc=n,this.ngZone=t,this.platformIsServer=i,this.tracingService=o}destroy(){}destroyNode=null;createElement(e,n){return n?this.doc.createElementNS(dC[n]||n,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,n){(h1(e)?e.content:e).appendChild(n)}insertBefore(e,n,t){e&&(h1(e)?e.content:e).insertBefore(n,t)}removeChild(e,n){n.remove()}selectRootElement(e,n){let t=typeof e=="string"?this.doc.querySelector(e):e;if(!t)throw new oe(-5104,!1);return n||(t.textContent=""),t}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,n,t,i){if(i){n=i+":"+n;let o=dC[i];o?e.setAttributeNS(o,n,t):e.setAttribute(n,t)}else e.setAttribute(n,t)}removeAttribute(e,n,t){if(t){let i=dC[t];i?e.removeAttributeNS(i,n):e.removeAttribute(`${t}:${n}`)}else e.removeAttribute(n)}addClass(e,n){e.classList.add(n)}removeClass(e,n){e.classList.remove(n)}setStyle(e,n,t,i){i&(xi.DashCase|xi.Important)?e.style.setProperty(n,t,i&xi.Important?"important":""):e.style[n]=t}removeStyle(e,n,t){t&xi.DashCase?e.style.removeProperty(n):e.style[n]=""}setProperty(e,n,t){e!=null&&(e[n]=t)}setValue(e,n){e.nodeValue=n}listen(e,n,t,i){if(typeof e=="string"&&(e=Oo().getGlobalEventTarget(this.doc,e),!e))throw new oe(5102,!1);let o=this.decoratePreventDefault(t);return this.tracingService?.wrapEventListener&&(o=this.tracingService.wrapEventListener(e,n,o)),this.eventManager.addEventListener(e,n,o,i)}decoratePreventDefault(e){return n=>{if(n==="__ngUnwrap__")return e;e(n)===!1&&n.preventDefault()}}};function h1(r){return r.tagName==="TEMPLATE"&&r.content!==void 0}var fC=class extends Tg{sharedStylesHost;hostEl;shadowRoot;constructor(e,n,t,i,o,s,a,c,l){super(e,o,s,c,l),this.sharedStylesHost=n,this.hostEl=t,this.shadowRoot=t.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let u=i.styles;u=g1(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=hC(f,o);a&&g.setAttribute("nonce",a),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}appendChild(e,n){return super.appendChild(this.nodeOrShadowRoot(e),n)}insertBefore(e,n,t){return super.insertBefore(this.nodeOrShadowRoot(e),n,t)}removeChild(e,n){return super.removeChild(null,n)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},Ig=class extends Tg{sharedStylesHost;removeStylesOnCompDestroy;styles;styleUrls;constructor(e,n,t,i,o,s,a,c,l){super(e,o,s,a,c),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i;let u=t.styles;this.styles=l?g1(l,u):u,this.styleUrls=t.getExternalStyles?.(l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&Xc.size===0&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},pT=class extends Ig{contentAttr;hostAttr;constructor(e,n,t,i,o,s,a,c,l){let u=i+"-"+t.id;super(e,n,t,o,s,a,c,l,u),this.contentAttr=KY(u),this.hostAttr=YY(u)}applyToHost(e){this.applyStyles(),this.setAttribute(e,this.hostAttr,"")}createElement(e,n){let t=super.createElement(e,n);return super.setAttribute(t,this.contentAttr,""),t}};var _T=class r extends hg{supportsDOMEvents=!0;static makeCurrent(){tC(new r)}onAndCancel(e,n,t,i){return e.addEventListener(n,t,i),()=>{e.removeEventListener(n,t,i)}}dispatchEvent(e,n){e.dispatchEvent(n)}remove(e){e.remove()}createElement(e,n){return n=n||this.getDefaultDocument(),n.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,n){return n==="window"?window:n==="document"?e:n==="body"?e.body:null}getBaseHref(e){let n=QY();return n==null?null:XY(n)}resetBaseElement(){vg=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return Eg(document.cookie,e)}},vg=null;function QY(){return vg=vg||document.head.querySelector("base"),vg?vg.getAttribute("href"):null}function XY(r){return new URL(r,document.baseURI).pathname}var TT=class{addToWindow(e){en.getAngularTestability=(t,i=!0)=>{let o=e.findTestabilityInTree(t,i);if(o==null)throw new oe(5103,!1);return o},en.getAllAngularTestabilities=()=>e.getAllTestabilities(),en.getAllAngularRootElements=()=>e.getAllRootElements();let n=t=>{let i=en.getAllAngularTestabilities(),o=i.length,s=function(){o--,o==0&&t()};i.forEach(a=>{a.whenStable(s)})};en.frameworkStabilizers||(en.frameworkStabilizers=[]),en.frameworkStabilizers.push(n)}findTestabilityInTree(e,n,t){if(n==null)return null;let i=e.getTestability(n);return i??(t?Oo().isShadowRoot(n)?this.findTestabilityInTree(e,n.host,!0):this.findTestabilityInTree(e,n.parentElement,!0):null)}},JY=(()=>{class r{build(){return new XMLHttpRequest}static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),m1=["alt","control","meta","shift"],ZY={"\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"},e7={alt:r=>r.altKey,control:r=>r.ctrlKey,meta:r=>r.metaKey,shift:r=>r.shiftKey},p1=(()=>{class r extends _g{constructor(n){super(n)}supports(n){return r.parseEventName(n)!=null}addEventListener(n,t,i,o){let s=r.parseEventName(t),a=r.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Oo().onAndCancel(n,s.domEventName,a,o))}static parseEventName(n){let t=n.toLowerCase().split("."),i=t.shift();if(t.length===0||!(i==="keydown"||i==="keyup"))return null;let o=r._normalizeKey(t.pop()),s="",a=t.indexOf("code");if(a>-1&&(t.splice(a,1),s="code."),m1.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(n,t){let i=ZY[n.key]||n.key,o="";return t.indexOf("code.")>-1&&(i=n.code,o="code."),i==null||!i?!1:(i=i.toLowerCase(),i===" "?i="space":i==="."&&(i="dot"),m1.forEach(s=>{if(s!==i){let a=e7[s];a(n)&&(o+=s+".")}}),o+=i,o===t)}static eventCallback(n,t,i){return o=>{r.matchEventFullKeyCode(o,n)&&i.runGuarded(()=>t(o))}}static _normalizeKey(n){return n==="esc"?"escape":n}static \u0275fac=function(t){return new(t||r)(C(Dn))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();function t7(){_T.makeCurrent()}function n7(){return new kr}function r7(){return YR(document),document}var i7=[{provide:gs,useValue:lC},{provide:U_,useValue:t7,multi:!0},{provide:Dn,useFactory:r7}],o7=XD(MU,"browser",i7);var s7=[{provide:md,useClass:TT},{provide:J_,useClass:ig,deps:[Me,og,md]},{provide:ig,useClass:ig,deps:[Me,og,md]}],a7=[{provide:xf,useValue:"root"},{provide:kr,useFactory:n7},{provide:ET,useClass:mT,multi:!0,deps:[Dn]},{provide:ET,useClass:p1,multi:!0,deps:[Dn]},EC,mC,gC,{provide:fs,useExisting:EC},{provide:nl,useClass:JY},[]],c7=(()=>{class r{constructor(){}static \u0275fac=function(t){return new(t||r)};static \u0275mod=da({type:r});static \u0275inj=ss({providers:[...a7,...s7],imports:[cC,PU]})}return r})();var _d=class{},yg=class{},ga=class r{headers;normalizedNames=new Map;lazyInit;lazyUpdate=null;constructor(e){e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(`
5
- `).forEach(n=>{let t=n.indexOf(":");if(t>0){let i=n.slice(0,t),o=n.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((n,t)=>{this.addHeaderEntry(t,n)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([n,t])=>{this.setHeaderEntries(n,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let n=this.headers.get(e.toLowerCase());return n&&n.length>0?n[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,n){return this.clone({name:e,value:n,op:"a"})}set(e,n){return this.clone({name:e,value:n,op:"s"})}delete(e,n){return this.clone({name:e,value:n,op:"d"})}maybeSetNormalizedName(e,n){this.normalizedNames.has(n)||this.normalizedNames.set(n,e)}init(){this.lazyInit&&(this.lazyInit instanceof r?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(n=>{this.headers.set(n,e.headers.get(n)),this.normalizedNames.set(n,e.normalizedNames.get(n))})}clone(e){let n=new r;return n.lazyInit=this.lazyInit&&this.lazyInit instanceof r?this.lazyInit:this,n.lazyUpdate=(this.lazyUpdate||[]).concat([e]),n}applyUpdate(e){let n=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,n);let i=(e.op==="a"?this.headers.get(n):void 0)||[];i.push(...t),this.headers.set(n,i);break;case"d":let o=e.value;if(!o)this.headers.delete(n),this.normalizedNames.delete(n);else{let s=this.headers.get(n);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(n),this.normalizedNames.delete(n)):this.headers.set(n,s)}break}}addHeaderEntry(e,n){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(n):this.headers.set(t,[n])}setHeaderEntries(e,n){let t=(Array.isArray(n)?n:[n]).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(n=>e(this.normalizedNames.get(n),this.headers.get(n)))}};var vT=class{encodeKey(e){return E1(e)}encodeValue(e){return E1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function l7(r,e){let n=new Map;return r.length>0&&r.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=n.get(s)||[];c.push(a),n.set(s,c)}),n}var u7=/%(\d[a-f0-9])/gi,d7={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function E1(r){return encodeURIComponent(r).replace(u7,(e,n)=>d7[n]??e)}function IT(r){return`${r}`}var Ts=class r{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new vT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=l7(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(n=>{let t=e.fromObject[n],i=Array.isArray(t)?t.map(IT):[IT(t)];this.map.set(n,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let n=this.map.get(e);return n?n[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,n){return this.clone({param:e,value:n,op:"a"})}appendAll(e){let n=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{n.push({param:t,value:o,op:"a"})}):n.push({param:t,value:i,op:"a"})}),this.clone(n)}set(e,n){return this.clone({param:e,value:n,op:"s"})}delete(e,n){return this.clone({param:e,value:n,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let n=this.encoder.encodeKey(e);return this.map.get(e).map(t=>n+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let n=new r({encoder:this.encoder});return n.cloneFrom=this.cloneFrom||this,n.updates=(this.updates||[]).concat(e),n}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 n=(e.op==="a"?this.map.get(e.param):void 0)||[];n.push(IT(e.value)),this.map.set(e.param,n);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(IT(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 yT=class{map=new Map;set(e,n){return this.map.set(e,n),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 h7(r){switch(r){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function _1(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer}function T1(r){return typeof Blob<"u"&&r instanceof Blob}function I1(r){return typeof FormData<"u"&&r instanceof FormData}function f7(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}var v1="Content-Type",y1="Accept",A1="X-Request-URL",R1="text/plain",D1="application/json",g7=`${D1}, ${R1}, */*`,pd=class r{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,n,t,i){this.url=n,this.method=e.toUpperCase();let o;if(h7(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 ga,this.context??=new yT,!this.params)this.params=new Ts,this.urlWithParams=n;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=n;else{let a=n.indexOf("?"),c=a===-1?"?":a<n.length-1?"&":"";this.urlWithParams=n+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||_1(this.body)||T1(this.body)||I1(this.body)||f7(this.body)?this.body:this.body instanceof Ts?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||I1(this.body)?null:T1(this.body)?this.body.type||null:_1(this.body)?null:typeof this.body=="string"?R1:this.body instanceof Ts?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?D1:null}clone(e={}){let n=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,R=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((F,U)=>F.set(U,e.setHeaders[U]),b)),e.setParams&&(G=Object.keys(e.setParams).reduce((F,U)=>F.set(U,e.setParams[U]),G)),new r(n,t,_,{params:G,headers:b,context:M,reportProgress:R,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},rl=(function(r){return r[r.Sent=0]="Sent",r[r.UploadProgress=1]="UploadProgress",r[r.ResponseHeader=2]="ResponseHeader",r[r.DownloadProgress=3]="DownloadProgress",r[r.Response=4]="Response",r[r.User=5]="User",r})(rl||{}),Td=class{headers;status;statusText;url;ok;type;redirected;constructor(e,n=200,t="OK"){this.headers=e.headers||new ga,this.status=e.status!==void 0?e.status:n,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},ST=class r extends Td{constructor(e={}){super(e)}type=rl.ResponseHeader;clone(e={}){return new r({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})}},Sg=class r extends Td{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=rl.Response;clone(e={}){return new r({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})}},Ed=class extends Td{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}},m7=200,p7=204;function _C(r,e){return{body:e,headers:r.headers,context:r.context,observe:r.observe,params:r.params,reportProgress:r.reportProgress,responseType:r.responseType,withCredentials:r.withCredentials,credentials:r.credentials,transferCache:r.transferCache,timeout:r.timeout,keepalive:r.keepalive,priority:r.priority,cache:r.cache,mode:r.mode,redirect:r.redirect,integrity:r.integrity,referrer:r.referrer}}var C1=(()=>{class r{handler;constructor(n){this.handler=n}request(n,t,i={}){let o;if(n instanceof pd)o=n;else{let c;i.headers instanceof ga?c=i.headers:c=new ga(i.headers);let l;i.params&&(i.params instanceof Ts?l=i.params:l=new Ts({fromObject:i.params})),o=new pd(n,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(OS(c=>this.handler.handle(c)));if(n instanceof pd||i.observe==="events")return s;let a=s.pipe(Ct(c=>c instanceof Sg));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(n,t={}){return this.request("DELETE",n,t)}get(n,t={}){return this.request("GET",n,t)}head(n,t={}){return this.request("HEAD",n,t)}jsonp(n,t){return this.request("JSONP",n,{params:new Ts().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(n,t={}){return this.request("OPTIONS",n,t)}patch(n,t,i={}){return this.request("PATCH",n,_C(i,t))}post(n,t,i={}){return this.request("POST",n,_C(i,t))}put(n,t,i={}){return this.request("PUT",n,_C(i,t))}static \u0275fac=function(t){return new(t||r)(C(_d))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var E7=new ee("");function N1(r,e){return e(r)}function _7(r,e){return(n,t)=>e.intercept(n,{handle:i=>r(i,t)})}function T7(r,e,n){return(t,i)=>mo(n,()=>e(t,o=>r(o,i)))}var O1=new ee(""),IC=new ee(""),w1=new ee(""),vC=new ee("",{providedIn:"root",factory:()=>!0});function I7(){let r=null;return(e,n)=>{r===null&&(r=(J(O1,{optional:!0})??[]).reduceRight(_7,N1));let t=J(yo);if(J(vC)){let o=t.add();return r(e,n).pipe(Cc(o))}else return r(e,n)}}var AT=(()=>{class r extends _d{backend;injector;chain=null;pendingTasks=J(yo);contributeToStability=J(vC);constructor(n,t){super(),this.backend=n,this.injector=t}handle(n){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(IC),...this.injector.get(w1,[])]));this.chain=t.reduceRight((i,o)=>T7(i,o,this.injector),N1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(n,i=>this.backend.handle(i)).pipe(Cc(t))}else return this.chain(n,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||r)(C(yg),C(Kn))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var v7=/^\)\]\}',?\n/,y7=RegExp(`^${A1}:`,"m");function S7(r){return"responseURL"in r&&r.responseURL?r.responseURL:y7.test(r.getAllResponseHeaders())?r.getResponseHeader(A1):null}var TC=(()=>{class r{xhrFactory;constructor(n){this.xhrFactory=n}handle(n){if(n.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return ue(null).pipe(pt(()=>new me(o=>{let s=t.build();if(s.open(n.method,n.urlWithParams),n.withCredentials&&(s.withCredentials=!0),n.headers.forEach((T,R)=>s.setRequestHeader(T,R.join(","))),n.headers.has(y1)||s.setRequestHeader(y1,g7),!n.headers.has(v1)){let T=n.detectContentTypeHeader();T!==null&&s.setRequestHeader(v1,T)}if(n.timeout&&(s.timeout=n.timeout),n.responseType){let T=n.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=n.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",R=new ga(s.getAllResponseHeaders()),b=S7(s)||n.url;return c=new ST({headers:R,status:s.status,statusText:T,url:b}),c},u=()=>{let{headers:T,status:R,statusText:b,url:G}=l(),M=null;R!==p7&&(M=typeof s.response>"u"?s.responseText:s.response),R===0&&(R=M?m7:0);let F=R>=200&&R<300;if(n.responseType==="json"&&typeof M=="string"){let U=M;M=M.replace(v7,"");try{M=M!==""?JSON.parse(M):null}catch(S){M=U,F&&(F=!1,M={error:S,text:M})}}F?(o.next(new Sg({body:M,headers:T,status:R,statusText:b,url:G||void 0})),o.complete()):o.error(new Ed({error:M,headers:T,status:R,statusText:b,url:G||void 0}))},d=T=>{let{url:R}=l(),b=new Ed({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:R||void 0});o.error(b)},f=d;n.timeout&&(f=T=>{let{url:R}=l(),b=new Ed({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:R||void 0});o.error(b)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let R={type:rl.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(R.total=T.total),n.responseType==="text"&&s.responseText&&(R.partialText=s.responseText),o.next(R)},_=T=>{let R={type:rl.UploadProgress,loaded:T.loaded};T.lengthComputable&&(R.total=T.total),o.next(R)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),n.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:rl.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),n.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||r)(C(nl))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),b1=new ee(""),A7="XSRF-TOKEN",R7=new ee("",{providedIn:"root",factory:()=>A7}),D7="X-XSRF-TOKEN",C7=new ee("",{providedIn:"root",factory:()=>D7}),Ag=class{},N7=(()=>{class r{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(n,t){this.doc=n,this.cookieName=t}getToken(){let n=this.doc.cookie||"";return n!==this.lastCookieString&&(this.parseCount++,this.lastToken=Eg(n,this.cookieName),this.lastCookieString=n),this.lastToken}static \u0275fac=function(t){return new(t||r)(C(Dn),C(R7))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),O7=/^(?:https?:)?\/\//i;function w7(r,e){if(!J(b1)||r.method==="GET"||r.method==="HEAD"||O7.test(r.url))return e(r);let n=J(Ag).getToken(),t=J(C7);return n!=null&&!r.headers.has(t)&&(r=r.clone({headers:r.headers.set(t,n)})),e(r)}var yC=(function(r){return r[r.Interceptors=0]="Interceptors",r[r.LegacyInterceptors=1]="LegacyInterceptors",r[r.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",r[r.NoXsrfProtection=3]="NoXsrfProtection",r[r.JsonpSupport=4]="JsonpSupport",r[r.RequestsMadeViaParent=5]="RequestsMadeViaParent",r[r.Fetch=6]="Fetch",r})(yC||{});function b7(r,e){return{\u0275kind:r,\u0275providers:e}}function L7(...r){let e=[C1,TC,AT,{provide:_d,useExisting:AT},{provide:yg,useFactory:()=>J(E7,{optional:!0})??J(TC)},{provide:IC,useValue:w7,multi:!0},{provide:b1,useValue:!0},{provide:Ag,useClass:N7}];for(let n of r)e.push(...n.\u0275providers);return _r(e)}var S1=new ee("");function M7(){return b7(yC.LegacyInterceptors,[{provide:S1,useFactory:I7},{provide:IC,useExisting:S1,multi:!0}])}var SC=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:function(t){let i=null;return t?i=new(t||r):i=C(P7),i},providedIn:"root"})}return r})(),P7=(()=>{class r extends SC{_doc;constructor(n){super(),this._doc=n}sanitize(n,t){if(t==null)return null;switch(n){case ci.NONE:return t;case ci.HTML:return Ro(t,"HTML")?Gr(t):G_(this._doc,String(t)).toString();case ci.STYLE:return Ro(t,"Style")?Gr(t):t;case ci.SCRIPT:if(Ro(t,"Script"))return Gr(t);throw new oe(5200,!1);case ci.URL:return Ro(t,"URL")?Gr(t):Qf(String(t));case ci.RESOURCE_URL:if(Ro(t,"ResourceURL"))return Gr(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(n){return JR(n)}bypassSecurityTrustStyle(n){return ZR(n)}bypassSecurityTrustScript(n){return eD(n)}bypassSecurityTrustUrl(n){return tD(n)}bypassSecurityTrustResourceUrl(n){return nD(n)}static \u0275fac=function(t){return new(t||r)(C(Dn))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var En={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 ye={NEWLY_ADDED:"newlyAdded",ADDED:"added",UPDATED:"updated",DELETED:"deleted",APPROVED:"approved",ASSIGNED:"assigned",STATUS_CHANGED:"statusChanged",PRIORITY_CHANGED:"priorityChanged",ACCESS_MODE_CHANGED:"accessModeChanged",CUSTOM_LIST_CHANGED:"customListChanged",ACCEPTED:"accepted",REJECTED:"rejected",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},nn={COMMENT_ANNOTATION_ADD:"comment_annotation.add",COMMENT_ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_DELETE:"comment.delete",COMMENT_UPDATE:"comment.update",REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete",ATTACHMENT_ADD:"attachment.add",ATTACHMENT_DELETE:"attachment.delete",RECORDER_ANNOTATION_ADD:"recorder_annotation.add",RECORDER_ANNOTATION_UPDATE:"recorder_annotation.update",RECORDER_ANNOTATION_DELETE:"recorder_annotation.delete",ACTIVITY_SAVE:"activity.save"},ur={STATUS_CHANGE:"comment_annotation.status_change",PRIORITY_CHANGE:"comment_annotation.priority_change",ASSIGN:"comment_annotation.assign",ACCESS_MODE_CHANGE:"comment_annotation.access_mode_change",CUSTOM_LIST_CHANGE:"comment_annotation.custom_list_change",APPROVE:"comment_annotation.approve",ACCEPT:"comment.accept",REJECT:"comment.reject",SUGGESTION_ACCEPT:"comment_annotation.suggestion_accept",SUGGESTION_REJECT:"comment_annotation.suggestion_reject",REACTION_ADD:"comment.reaction_add",REACTION_DELETE:"comment.reaction_delete",SUBSCRIBE:"comment_annotation.subscribe",UNSUBSCRIBE:"comment_annotation.unsubscribe"},GAe={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"},$Ae={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"},jAe={TEXT_SELECTED:"textSelected"},HAe={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"},WAe={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"},zAe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},qAe={SETTINGS_UPDATED:"settingsUpdated"},KAe={UPDATE_DATA:"updateData"},F7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(F7||{}),k7=(function(r){return r.INVITE="invite",r.REMOVE="remove",r})(k7||{}),U7=(function(r){return r.CREATED="created",r.JOINED="joined",r})(U7||{}),V7=(function(r){return r.UPDATE_DATA="updateData",r})(V7||{}),RT=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(RT||{}),B7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r})(B7||{}),YAe={ADDED:"added",UPDATED:"updated",DELETED:"deleted"},G7=(function(r){return r.FIRST_VIEWED="firstViewed",r})(G7||{}),AC=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.ACTIVITY="activity",r.VIEWS="views",r.USER_INVITE="userInvite",r.USER_REQUEST="userRequest",r.VIDEO_PLAYER="videoPlayer",r.CRDT="crdt",r})(AC||{}),$7=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.AREA_COMMENT="areaComment",r.INLINE_COMMENT="inlineComment",r.COMMENT_SIDEBAR="commentSidebar",r})($7||{}),jr=(function(r){return r.DESKTOP="Desktop",r.MOBILE="Mobile",r.TABLET="Tablet",r.MONITOR="Monitor",r.UNKNOWN="Unknown",r})(jr||{}),Id=(function(r){return r.PORTRAIT="portrait",r.LANDSCAPE="landscape",r.UNKNOWN="unknown",r})(Id||{}),DT=(function(r){return r.Portrait="(orientation: portrait)",r.Landscape="(orientation: landscape)",r})(DT||{}),j7=(function(r){return r.DIFFERENT_DEVICE="differentDevice",r.ELEMENT_DELETED="elementDeleted",r})(j7||{}),vd=(function(r){return r.ADMIN="Admin",r.COMMENTER="Commenter",r})(vd||{}),xt={PUBLIC:"public",RESTRICTED:"restricted",ORGANIZATION_PRIVATE:"organizationPrivate"},H7=(function(r){return r.DEFAULT="default",r.DYNAMIC_ID="dynamicId",r})(H7||{}),CT={PUBLIC:"public",PRIVATE:"private"},W7=(function(r){return r.MINIMAL="minimal",r.VERBOSE="verbose",r})(W7||{}),z7=(function(r){return r.DEFAULT="default",r.EXPANDED="expanded",r})(z7||{}),q7=(function(r){return r.TOTAL="total",r.UNREAD="unread",r})(q7||{}),QAe={ONLINE:"online",OFFLINE:"offline",PENDING_INIT:"pendingInit",PENDING_DATA:"pendingData"},XAe={ALL:"all",ORGANIZATION:"organization",ORGANIZATION_USER_GROUP:"organizationUserGroup",DOCUMENT:"document",FOLDER:"folder"},JAe={AND:"and",OR:"or"},K7=(function(r){return r.RESTRICTED_SELF="restrictedSelf",r.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",r.ORGANIZATION_PRIVATE="organizationPrivate",r.PUBLIC="public",r})(K7||{});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(n=>{let t=n.indexOf(":");if(t>0){let i=n.slice(0,t),o=n.slice(t+1).trim();this.addHeaderEntry(i,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((n,t)=>{this.addHeaderEntry(t,n)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([n,t])=>{this.setHeaderEntries(n,t)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let n=this.headers.get(e.toLowerCase());return n&&n.length>0?n[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,n){return this.clone({name:e,value:n,op:"a"})}set(e,n){return this.clone({name:e,value:n,op:"s"})}delete(e,n){return this.clone({name:e,value:n,op:"d"})}maybeSetNormalizedName(e,n){this.normalizedNames.has(n)||this.normalizedNames.set(n,e)}init(){this.lazyInit&&(this.lazyInit instanceof r?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(n=>{this.headers.set(n,e.headers.get(n)),this.normalizedNames.set(n,e.normalizedNames.get(n))})}clone(e){let n=new r;return n.lazyInit=this.lazyInit&&this.lazyInit instanceof r?this.lazyInit:this,n.lazyUpdate=(this.lazyUpdate||[]).concat([e]),n}applyUpdate(e){let n=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,n);let i=(e.op==="a"?this.headers.get(n):void 0)||[];i.push(...t),this.headers.set(n,i);break;case"d":let o=e.value;if(!o)this.headers.delete(n),this.normalizedNames.delete(n);else{let s=this.headers.get(n);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(n),this.normalizedNames.delete(n)):this.headers.set(n,s)}break}}addHeaderEntry(e,n){let t=e.toLowerCase();this.maybeSetNormalizedName(e,t),this.headers.has(t)?this.headers.get(t).push(n):this.headers.set(t,[n])}setHeaderEntries(e,n){let t=(Array.isArray(n)?n:[n]).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(n=>e(this.normalizedNames.get(n),this.headers.get(n)))}};var vT=class{encodeKey(e){return E1(e)}encodeValue(e){return E1(e)}decodeKey(e){return decodeURIComponent(e)}decodeValue(e){return decodeURIComponent(e)}};function l7(r,e){let n=new Map;return r.length>0&&r.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=n.get(s)||[];c.push(a),n.set(s,c)}),n}var u7=/%(\d[a-f0-9])/gi,d7={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function E1(r){return encodeURIComponent(r).replace(u7,(e,n)=>d7[n]??e)}function IT(r){return`${r}`}var Ts=class r{map;encoder;updates=null;cloneFrom=null;constructor(e={}){if(this.encoder=e.encoder||new vT,e.fromString){if(e.fromObject)throw new oe(2805,!1);this.map=l7(e.fromString,this.encoder)}else e.fromObject?(this.map=new Map,Object.keys(e.fromObject).forEach(n=>{let t=e.fromObject[n],i=Array.isArray(t)?t.map(IT):[IT(t)];this.map.set(n,i)})):this.map=null}has(e){return this.init(),this.map.has(e)}get(e){this.init();let n=this.map.get(e);return n?n[0]:null}getAll(e){return this.init(),this.map.get(e)||null}keys(){return this.init(),Array.from(this.map.keys())}append(e,n){return this.clone({param:e,value:n,op:"a"})}appendAll(e){let n=[];return Object.keys(e).forEach(t=>{let i=e[t];Array.isArray(i)?i.forEach(o=>{n.push({param:t,value:o,op:"a"})}):n.push({param:t,value:i,op:"a"})}),this.clone(n)}set(e,n){return this.clone({param:e,value:n,op:"s"})}delete(e,n){return this.clone({param:e,value:n,op:"d"})}toString(){return this.init(),this.keys().map(e=>{let n=this.encoder.encodeKey(e);return this.map.get(e).map(t=>n+"="+this.encoder.encodeValue(t)).join("&")}).filter(e=>e!=="").join("&")}clone(e){let n=new r({encoder:this.encoder});return n.cloneFrom=this.cloneFrom||this,n.updates=(this.updates||[]).concat(e),n}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 n=(e.op==="a"?this.map.get(e.param):void 0)||[];n.push(IT(e.value)),this.map.set(e.param,n);break;case"d":if(e.value!==void 0){let t=this.map.get(e.param)||[],i=t.indexOf(IT(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 yT=class{map=new Map;set(e,n){return this.map.set(e,n),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 h7(r){switch(r){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}function _1(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer}function T1(r){return typeof Blob<"u"&&r instanceof Blob}function I1(r){return typeof FormData<"u"&&r instanceof FormData}function f7(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}var v1="Content-Type",y1="Accept",A1="X-Request-URL",R1="text/plain",D1="application/json",g7=`${D1}, ${R1}, */*`,pd=class r{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,n,t,i){this.url=n,this.method=e.toUpperCase();let o;if(h7(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 ga,this.context??=new yT,!this.params)this.params=new Ts,this.urlWithParams=n;else{let s=this.params.toString();if(s.length===0)this.urlWithParams=n;else{let a=n.indexOf("?"),c=a===-1?"?":a<n.length-1?"&":"";this.urlWithParams=n+c+s}}}serializeBody(){return this.body===null?null:typeof this.body=="string"||_1(this.body)||T1(this.body)||I1(this.body)||f7(this.body)?this.body:this.body instanceof Ts?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||I1(this.body)?null:T1(this.body)?this.body.type||null:_1(this.body)?null:typeof this.body=="string"?R1:this.body instanceof Ts?"application/x-www-form-urlencoded;charset=UTF-8":typeof this.body=="object"||typeof this.body=="number"||typeof this.body=="boolean"?D1:null}clone(e={}){let n=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,R=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((F,U)=>F.set(U,e.setHeaders[U]),b)),e.setParams&&(G=Object.keys(e.setParams).reduce((F,U)=>F.set(U,e.setParams[U]),G)),new r(n,t,_,{params:G,headers:b,context:M,reportProgress:R,responseType:i,withCredentials:T,transferCache:g,keepalive:o,cache:a,priority:s,timeout:p,mode:c,redirect:l,credentials:u,referrer:d,integrity:f})}},rl=(function(r){return r[r.Sent=0]="Sent",r[r.UploadProgress=1]="UploadProgress",r[r.ResponseHeader=2]="ResponseHeader",r[r.DownloadProgress=3]="DownloadProgress",r[r.Response=4]="Response",r[r.User=5]="User",r})(rl||{}),Td=class{headers;status;statusText;url;ok;type;redirected;constructor(e,n=200,t="OK"){this.headers=e.headers||new ga,this.status=e.status!==void 0?e.status:n,this.statusText=e.statusText||t,this.url=e.url||null,this.redirected=e.redirected,this.ok=this.status>=200&&this.status<300}},ST=class r extends Td{constructor(e={}){super(e)}type=rl.ResponseHeader;clone(e={}){return new r({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})}},Sg=class r extends Td{body;constructor(e={}){super(e),this.body=e.body!==void 0?e.body:null}type=rl.Response;clone(e={}){return new r({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})}},Ed=class extends Td{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}},m7=200,p7=204;function _C(r,e){return{body:e,headers:r.headers,context:r.context,observe:r.observe,params:r.params,reportProgress:r.reportProgress,responseType:r.responseType,withCredentials:r.withCredentials,credentials:r.credentials,transferCache:r.transferCache,timeout:r.timeout,keepalive:r.keepalive,priority:r.priority,cache:r.cache,mode:r.mode,redirect:r.redirect,integrity:r.integrity,referrer:r.referrer}}var C1=(()=>{class r{handler;constructor(n){this.handler=n}request(n,t,i={}){let o;if(n instanceof pd)o=n;else{let c;i.headers instanceof ga?c=i.headers:c=new ga(i.headers);let l;i.params&&(i.params instanceof Ts?l=i.params:l=new Ts({fromObject:i.params})),o=new pd(n,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(OS(c=>this.handler.handle(c)));if(n instanceof pd||i.observe==="events")return s;let a=s.pipe(Ct(c=>c instanceof Sg));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(n,t={}){return this.request("DELETE",n,t)}get(n,t={}){return this.request("GET",n,t)}head(n,t={}){return this.request("HEAD",n,t)}jsonp(n,t){return this.request("JSONP",n,{params:new Ts().append(t,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(n,t={}){return this.request("OPTIONS",n,t)}patch(n,t,i={}){return this.request("PATCH",n,_C(i,t))}post(n,t,i={}){return this.request("POST",n,_C(i,t))}put(n,t,i={}){return this.request("PUT",n,_C(i,t))}static \u0275fac=function(t){return new(t||r)(C(_d))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var E7=new ee("");function N1(r,e){return e(r)}function _7(r,e){return(n,t)=>e.intercept(n,{handle:i=>r(i,t)})}function T7(r,e,n){return(t,i)=>mo(n,()=>e(t,o=>r(o,i)))}var O1=new ee(""),IC=new ee(""),w1=new ee(""),vC=new ee("",{providedIn:"root",factory:()=>!0});function I7(){let r=null;return(e,n)=>{r===null&&(r=(J(O1,{optional:!0})??[]).reduceRight(_7,N1));let t=J(yo);if(J(vC)){let o=t.add();return r(e,n).pipe(Cc(o))}else return r(e,n)}}var AT=(()=>{class r extends _d{backend;injector;chain=null;pendingTasks=J(yo);contributeToStability=J(vC);constructor(n,t){super(),this.backend=n,this.injector=t}handle(n){if(this.chain===null){let t=Array.from(new Set([...this.injector.get(IC),...this.injector.get(w1,[])]));this.chain=t.reduceRight((i,o)=>T7(i,o,this.injector),N1)}if(this.contributeToStability){let t=this.pendingTasks.add();return this.chain(n,i=>this.backend.handle(i)).pipe(Cc(t))}else return this.chain(n,t=>this.backend.handle(t))}static \u0275fac=function(t){return new(t||r)(C(yg),C(Kn))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})();var v7=/^\)\]\}',?\n/,y7=RegExp(`^${A1}:`,"m");function S7(r){return"responseURL"in r&&r.responseURL?r.responseURL:y7.test(r.getAllResponseHeaders())?r.getResponseHeader(A1):null}var TC=(()=>{class r{xhrFactory;constructor(n){this.xhrFactory=n}handle(n){if(n.method==="JSONP")throw new oe(-2800,!1);let t=this.xhrFactory;return ue(null).pipe(pt(()=>new me(o=>{let s=t.build();if(s.open(n.method,n.urlWithParams),n.withCredentials&&(s.withCredentials=!0),n.headers.forEach((T,R)=>s.setRequestHeader(T,R.join(","))),n.headers.has(y1)||s.setRequestHeader(y1,g7),!n.headers.has(v1)){let T=n.detectContentTypeHeader();T!==null&&s.setRequestHeader(v1,T)}if(n.timeout&&(s.timeout=n.timeout),n.responseType){let T=n.responseType.toLowerCase();s.responseType=T!=="json"?T:"text"}let a=n.serializeBody(),c=null,l=()=>{if(c!==null)return c;let T=s.statusText||"OK",R=new ga(s.getAllResponseHeaders()),b=S7(s)||n.url;return c=new ST({headers:R,status:s.status,statusText:T,url:b}),c},u=()=>{let{headers:T,status:R,statusText:b,url:G}=l(),M=null;R!==p7&&(M=typeof s.response>"u"?s.responseText:s.response),R===0&&(R=M?m7:0);let F=R>=200&&R<300;if(n.responseType==="json"&&typeof M=="string"){let U=M;M=M.replace(v7,"");try{M=M!==""?JSON.parse(M):null}catch(S){M=U,F&&(F=!1,M={error:S,text:M})}}F?(o.next(new Sg({body:M,headers:T,status:R,statusText:b,url:G||void 0})),o.complete()):o.error(new Ed({error:M,headers:T,status:R,statusText:b,url:G||void 0}))},d=T=>{let{url:R}=l(),b=new Ed({error:T,status:s.status||0,statusText:s.statusText||"Unknown Error",url:R||void 0});o.error(b)},f=d;n.timeout&&(f=T=>{let{url:R}=l(),b=new Ed({error:new DOMException("Request timed out","TimeoutError"),status:s.status||0,statusText:s.statusText||"Request timeout",url:R||void 0});o.error(b)});let g=!1,p=T=>{g||(o.next(l()),g=!0);let R={type:rl.DownloadProgress,loaded:T.loaded};T.lengthComputable&&(R.total=T.total),n.responseType==="text"&&s.responseText&&(R.partialText=s.responseText),o.next(R)},_=T=>{let R={type:rl.UploadProgress,loaded:T.loaded};T.lengthComputable&&(R.total=T.total),o.next(R)};return s.addEventListener("load",u),s.addEventListener("error",d),s.addEventListener("timeout",f),s.addEventListener("abort",d),n.reportProgress&&(s.addEventListener("progress",p),a!==null&&s.upload&&s.upload.addEventListener("progress",_)),s.send(a),o.next({type:rl.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",u),s.removeEventListener("timeout",f),n.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||r)(C(nl))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),b1=new ee(""),A7="XSRF-TOKEN",R7=new ee("",{providedIn:"root",factory:()=>A7}),D7="X-XSRF-TOKEN",C7=new ee("",{providedIn:"root",factory:()=>D7}),Ag=class{},N7=(()=>{class r{doc;cookieName;lastCookieString="";lastToken=null;parseCount=0;constructor(n,t){this.doc=n,this.cookieName=t}getToken(){let n=this.doc.cookie||"";return n!==this.lastCookieString&&(this.parseCount++,this.lastToken=Eg(n,this.cookieName),this.lastCookieString=n),this.lastToken}static \u0275fac=function(t){return new(t||r)(C(Dn),C(R7))};static \u0275prov=K({token:r,factory:r.\u0275fac})}return r})(),O7=/^(?:https?:)?\/\//i;function w7(r,e){if(!J(b1)||r.method==="GET"||r.method==="HEAD"||O7.test(r.url))return e(r);let n=J(Ag).getToken(),t=J(C7);return n!=null&&!r.headers.has(t)&&(r=r.clone({headers:r.headers.set(t,n)})),e(r)}var yC=(function(r){return r[r.Interceptors=0]="Interceptors",r[r.LegacyInterceptors=1]="LegacyInterceptors",r[r.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",r[r.NoXsrfProtection=3]="NoXsrfProtection",r[r.JsonpSupport=4]="JsonpSupport",r[r.RequestsMadeViaParent=5]="RequestsMadeViaParent",r[r.Fetch=6]="Fetch",r})(yC||{});function b7(r,e){return{\u0275kind:r,\u0275providers:e}}function L7(...r){let e=[C1,TC,AT,{provide:_d,useExisting:AT},{provide:yg,useFactory:()=>J(E7,{optional:!0})??J(TC)},{provide:IC,useValue:w7,multi:!0},{provide:b1,useValue:!0},{provide:Ag,useClass:N7}];for(let n of r)e.push(...n.\u0275providers);return _r(e)}var S1=new ee("");function M7(){return b7(yC.LegacyInterceptors,[{provide:S1,useFactory:I7},{provide:IC,useExisting:S1,multi:!0}])}var SC=(()=>{class r{static \u0275fac=function(t){return new(t||r)};static \u0275prov=K({token:r,factory:function(t){let i=null;return t?i=new(t||r):i=C(P7),i},providedIn:"root"})}return r})(),P7=(()=>{class r extends SC{_doc;constructor(n){super(),this._doc=n}sanitize(n,t){if(t==null)return null;switch(n){case ci.NONE:return t;case ci.HTML:return Ro(t,"HTML")?Gr(t):G_(this._doc,String(t)).toString();case ci.STYLE:return Ro(t,"Style")?Gr(t):t;case ci.SCRIPT:if(Ro(t,"Script"))return Gr(t);throw new oe(5200,!1);case ci.URL:return Ro(t,"URL")?Gr(t):Qf(String(t));case ci.RESOURCE_URL:if(Ro(t,"ResourceURL"))return Gr(t);throw new oe(5201,!1);default:throw new oe(5202,!1)}}bypassSecurityTrustHtml(n){return JR(n)}bypassSecurityTrustStyle(n){return ZR(n)}bypassSecurityTrustScript(n){return eD(n)}bypassSecurityTrustUrl(n){return tD(n)}bypassSecurityTrustResourceUrl(n){return nD(n)}static \u0275fac=function(t){return new(t||r)(C(Dn))};static \u0275prov=K({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var En={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 ye={NEWLY_ADDED:"newlyAdded",ADDED:"added",UPDATED:"updated",DELETED:"deleted",APPROVED:"approved",ASSIGNED:"assigned",STATUS_CHANGED:"statusChanged",PRIORITY_CHANGED:"priorityChanged",ACCESS_MODE_CHANGED:"accessModeChanged",CUSTOM_LIST_CHANGED:"customListChanged",ACCEPTED:"accepted",REJECTED:"rejected",REACTION_ADDED:"reactionAdded",REACTION_DELETED:"reactionDeleted",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",SUGGESTION_ACCEPTED:"suggestionAccepted",SUGGESTION_REJECTED:"suggestionRejected"},nn={COMMENT_ANNOTATION_ADD:"comment_annotation.add",COMMENT_ANNOTATION_DELETE:"comment_annotation.delete",COMMENT_ADD:"comment.add",COMMENT_DELETE:"comment.delete",COMMENT_UPDATE:"comment.update",REACTION_ADD:"reaction.add",REACTION_DELETE:"reaction.delete",ATTACHMENT_ADD:"attachment.add",ATTACHMENT_DELETE:"attachment.delete",RECORDER_ANNOTATION_ADD:"recorder_annotation.add",RECORDER_ANNOTATION_UPDATE:"recorder_annotation.update",RECORDER_ANNOTATION_DELETE:"recorder_annotation.delete",ACTIVITY_SAVE:"activity.save"},ur={STATUS_CHANGE:"comment_annotation.status_change",PRIORITY_CHANGE:"comment_annotation.priority_change",ASSIGN:"comment_annotation.assign",ACCESS_MODE_CHANGE:"comment_annotation.access_mode_change",CUSTOM_LIST_CHANGE:"comment_annotation.custom_list_change",APPROVE:"comment_annotation.approve",ACCEPT:"comment.accept",REJECT:"comment.reject",SUGGESTION_ACCEPT:"comment_annotation.suggestion_accept",SUGGESTION_REJECT:"comment_annotation.suggestion_reject",REACTION_ADD:"comment.reaction_add",REACTION_DELETE:"comment.reaction_delete",SUBSCRIBE:"comment_annotation.subscribe",UNSUBSCRIBE:"comment_annotation.unsubscribe"},GAe={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",FULLSCREEN_CLICK:"fullscreenClick",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"},$Ae={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"},jAe={TEXT_SELECTED:"textSelected"},HAe={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"},WAe={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"},zAe={MULTIPLE_USERS_ONLINE:"multipleUsersOnline",USER_STATE_CHANGE:"userStateChange"},qAe={SETTINGS_UPDATED:"settingsUpdated"},KAe={UPDATE_DATA:"updateData"},F7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(F7||{}),k7=(function(r){return r.INVITE="invite",r.REMOVE="remove",r})(k7||{}),U7=(function(r){return r.CREATED="created",r.JOINED="joined",r})(U7||{}),V7=(function(r){return r.UPDATE_DATA="updateData",r})(V7||{}),RT=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r.APPROVED="approved",r.RESOLVED="resolved",r})(RT||{}),B7=(function(r){return r.ADDED="added",r.UPDATED="updated",r.DELETED="deleted",r})(B7||{}),YAe={ADDED:"added",UPDATED:"updated",DELETED:"deleted"},G7=(function(r){return r.FIRST_VIEWED="firstViewed",r})(G7||{}),AC=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.ACTIVITY="activity",r.VIEWS="views",r.USER_INVITE="userInvite",r.USER_REQUEST="userRequest",r.VIDEO_PLAYER="videoPlayer",r.CRDT="crdt",r})(AC||{}),$7=(function(r){return r.AREA="area",r.ARROW="arrow",r.AUDIO_HUDDLE="audioHuddle",r.COMMENT="comment",r.MULTI_THREAD="multiThread",r.CURSOR="cursor",r.HUDDLE="huddle",r.LIVE_STATE_SYNC="liveStateSync",r.PRESENCE="presence",r.TAG="tag",r.RECORDER="recorder",r.REWRITER="rewriter",r.LIVE_SELECTION="liveSelection",r.NOTIFICATION="notification",r.REACTION="reaction",r.AREA_COMMENT="areaComment",r.INLINE_COMMENT="inlineComment",r.COMMENT_SIDEBAR="commentSidebar",r})($7||{}),jr=(function(r){return r.DESKTOP="Desktop",r.MOBILE="Mobile",r.TABLET="Tablet",r.MONITOR="Monitor",r.UNKNOWN="Unknown",r})(jr||{}),Id=(function(r){return r.PORTRAIT="portrait",r.LANDSCAPE="landscape",r.UNKNOWN="unknown",r})(Id||{}),DT=(function(r){return r.Portrait="(orientation: portrait)",r.Landscape="(orientation: landscape)",r})(DT||{}),j7=(function(r){return r.DIFFERENT_DEVICE="differentDevice",r.ELEMENT_DELETED="elementDeleted",r})(j7||{}),vd=(function(r){return r.ADMIN="Admin",r.COMMENTER="Commenter",r})(vd||{}),xt={PUBLIC:"public",RESTRICTED:"restricted",ORGANIZATION_PRIVATE:"organizationPrivate"},H7=(function(r){return r.DEFAULT="default",r.DYNAMIC_ID="dynamicId",r})(H7||{}),CT={PUBLIC:"public",PRIVATE:"private"},W7=(function(r){return r.MINIMAL="minimal",r.VERBOSE="verbose",r})(W7||{}),z7=(function(r){return r.DEFAULT="default",r.EXPANDED="expanded",r})(z7||{}),q7=(function(r){return r.TOTAL="total",r.UNREAD="unread",r})(q7||{}),QAe={ONLINE:"online",OFFLINE:"offline",PENDING_INIT:"pendingInit",PENDING_DATA:"pendingData"},XAe={ALL:"all",ORGANIZATION:"organization",ORGANIZATION_USER_GROUP:"organizationUserGroup",DOCUMENT:"document",FOLDER:"folder"},JAe={AND:"and",OR:"or"},K7=(function(r){return r.RESTRICTED_SELF="restrictedSelf",r.RESTRICTED_SELECTED_PEOPLE="restrictedSelectedPeople",r.ORGANIZATION_PRIVATE="organizationPrivate",r.PUBLIC="public",r})(K7||{});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"
@@ -164,4 +164,4 @@ This typically indicates that your device does not have a healthy Internet conne
164
164
  `+e.join(`
165
165
  `)+`
166
166
  )`}copy(e,n){let t=new r;return t.comparator=this.comparator,t.keyedMap=e,t.sortedSet=n,t}};var Sy=class{constructor(){this.fa=new Rt(ie.comparator)}track(e){let n=e.doc.key,t=this.fa.get(n);t?e.type!==0&&t.type===3?this.fa=this.fa.insert(n,e):e.type===3&&t.type!==1?this.fa=this.fa.insert(n,{type:t.type,doc:e.doc}):e.type===2&&t.type===2?this.fa=this.fa.insert(n,{type:2,doc:e.doc}):e.type===2&&t.type===0?this.fa=this.fa.insert(n,{type:0,doc:e.doc}):e.type===1&&t.type===0?this.fa=this.fa.remove(n):e.type===1&&t.type===2?this.fa=this.fa.insert(n,{type:1,doc:t.doc}):e.type===0&&t.type===1?this.fa=this.fa.insert(n,{type:2,doc:e.doc}):ae(63341,{At:e,ga:t}):this.fa=this.fa.insert(n,e)}pa(){let e=[];return this.fa.inorderTraversal((n,t)=>{e.push(t)}),e}},Bh=class r{constructor(e,n,t,i,o,s,a,c,l){this.query=e,this.docs=n,this.oldDocs=t,this.docChanges=i,this.mutatedKeys=o,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=l}static fromInitialDocuments(e,n,t,i,o){let s=[];return n.forEach(a=>{s.push({type:0,doc:a})}),new r(e,n,yy.emptySet(n),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)&&Gy(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let n=this.docChanges,t=e.docChanges;if(n.length!==t.length)return!1;for(let i=0;i<n.length;i++)if(n[i].type!==t[i].type||!n[i].doc.isEqual(t[i].doc))return!1;return!0}};var SL=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}},AL=class{constructor(){this.queries=TH(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(n,t){let i=de(n),o=i.queries;i.queries=TH(),o.forEach((s,a)=>{for(let c of a.wa)c.onError(t)})})(this,new Q(j.ABORTED,"Firestore shutting down"))}};function TH(){return new Xi(r=>hW(r),Gy)}function vM(r,e){return I(this,null,function*(){let n=de(r),t=3,i=e.query,o=n.queries.get(i);o?!o.Sa()&&e.ba()&&(t=2):(o=new SL,t=e.ba()?0:1);try{switch(t){case 0:o.ya=yield n.onListen(i,!0);break;case 1:o.ya=yield n.onListen(i,!1);break;case 2:yield n.onFirstRemoteStoreListen(i)}}catch(s){let a=IM(s,`Initialization of query '${fh(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,o),o.wa.push(e),e.va(n.onlineState),o.ya&&e.Ca(o.ya)&&SM(n)})}function yM(r,e){return I(this,null,function*(){let n=de(r),t=e.query,i=3,o=n.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 n.queries.delete(t),n.onUnlisten(t,!0);case 1:return n.queries.delete(t),n.onUnlisten(t,!1);case 2:return n.onLastRemoteStoreUnlisten(t);default:return}})}function Woe(r,e){let n=de(r),t=!1;for(let i of e){let o=i.query,s=n.queries.get(o);if(s){for(let a of s.wa)a.Ca(i)&&(t=!0);s.ya=i}}t&&SM(n)}function zoe(r,e,n){let t=de(r),i=t.queries.get(e);if(i)for(let o of i.wa)o.onError(n);t.queries.delete(e)}function SM(r){r.Da.forEach(e=>{e.next()})}var RL,IH;(IH=RL||(RL={})).Fa="default",IH.Cache="cache";var Tp=class{constructor(e,n,t){this.query=e,this.Ma=n,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 Bh(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),n=!0):this.Ba(e,this.onlineState)&&(this.La(e),n=!0),this.Oa=e,n}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let n=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),n=!0),n}Ba(e,n){if(!e.fromCache||!this.ba())return!0;let t=n!=="Offline";return(!this.options.ka||!t)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Na(e){if(e.docChanges.length>0)return!0;let n=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}La(e){e=Bh.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==RL.Cache}};var Ay=class{constructor(e){this.key=e}},Ry=class{constructor(e){this.key=e}},DL=class{constructor(e,n){this.query=e,this.Ha=n,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=Ve(),this.mutatedKeys=Ve(),this.Xa=gW(e),this.eu=new yy(this.Xa)}get tu(){return this.Ha}nu(e,n){let t=n?n.ru:new Sy,i=n?n.eu:this.eu,o=n?n.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=Op(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,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,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=n&&!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 Bh(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 Sy,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(n=>this.Ha=this.Ha.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ha=this.Ha.delete(n)),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 n=[];return e.forEach(t=>{this.Za.has(t)||n.push(new Ry(t))}),this.Za.forEach(t=>{e.has(t)||n.push(new Ay(t))}),n}uu(e){this.Ha=e.qs,this.Za=Ve();let n=this.nu(e.documents);return this.applyChanges(n,!0)}cu(){return Bh.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},Kh="SyncEngine",CL=class{constructor(e,n,t){this.query=e,this.targetId=n,this.view=t}},NL=class{constructor(e){this.key=e,this.lu=!1}},OL=class{constructor(e,n,t,i,o,s){this.localStore=e,this.remoteStore=n,this.eventManager=t,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new Xi(a=>hW(a),Gy),this.Tu=new Map,this.Iu=new Set,this.du=new Rt(ie.comparator),this.Eu=new Map,this.Au=new mp,this.Ru={},this.Vu=new Map,this.mu=kh.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function qoe(r,e,n=!0){return I(this,null,function*(){let t=Wy(r),i,o=t.Pu.get(e);return o?(t.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield uz(t,e,n,!0),i})}function Koe(r,e){return I(this,null,function*(){let n=Wy(r);yield uz(n,e,!0,!1)})}function uz(r,e,n,t){return I(this,null,function*(){let i=yield my(r.localStore,Jr(e)),o=i.targetId,s=r.sharedClientState.addLocalQueryTarget(o,n),a;return t&&(a=yield AM(r,e,o,s==="current",i.resumeToken)),r.isPrimaryClient&&n&&Hy(r.remoteStore,i),a})}function AM(r,e,n,t,i){return I(this,null,function*(){r.gu=(d,f,g)=>(function(_,T,R,b){return I(this,null,function*(){let G=T.view.nu(R);G.Ds&&(G=yield cL(_.localStore,T.query,!1).then(({documents:S})=>T.view.nu(S,G)));let M=b&&b.targetChanges.get(T.targetId),F=b&&b.targetMismatches.get(T.targetId)!=null,U=T.view.applyChanges(G,_.isPrimaryClient,M,F);return wL(_,T.targetId,U._u),U.snapshot})})(r,d,f,g);let o=yield cL(r.localStore,e,!0),s=new DL(e,o.qs),a=s.nu(o.documents),c=dp.createSynthesizedTargetChangeForCurrentChange(n,t&&r.onlineState!=="Offline",i),l=s.applyChanges(a,r.isPrimaryClient,c);wL(r,n,l._u);let u=new CL(e,n,s);return r.Pu.set(e,u),r.Tu.has(n)?r.Tu.get(n).push(e):r.Tu.set(n,[e]),l.snapshot})}function Yoe(r,e,n){return I(this,null,function*(){let t=de(r),i=t.Pu.get(e),o=t.Tu.get(i.targetId);if(o.length>1)return t.Tu.set(i.targetId,o.filter(s=>!Gy(s,e))),void t.Pu.delete(e);t.isPrimaryClient?(t.sharedClientState.removeLocalQueryTarget(i.targetId),t.sharedClientState.isActiveQueryTarget(i.targetId)||(yield Uh(t.localStore,i.targetId,!1).then(()=>{t.sharedClientState.clearQueryState(i.targetId),n&&Vh(t.remoteStore,i.targetId),Gh(t,i.targetId)}).catch(Za))):(Gh(t,i.targetId),yield Uh(t.localStore,i.targetId,!0))})}function Qoe(r,e){return I(this,null,function*(){let n=de(r),t=n.Pu.get(e),i=n.Tu.get(t.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(t.targetId),Vh(n.remoteStore,t.targetId))})}function Xoe(r,e,n){return I(this,null,function*(){let t=NM(r);try{let i=yield(function(s,a){let c=de(s),l=Mt.now(),u=a.reduce((g,p)=>g.add(p.key),Ve()),d,f;return c.persistence.runTransaction("Locally write mutations","readwrite",g=>{let p=Xr(),_=Ve();return c.Os.getEntries(g,u).next(T=>{p=T,p.forEach((R,b)=>{b.isValidDocument()||(_=_.add(R))})}).next(()=>c.localDocuments.getOverlayedDocuments(g,p)).next(T=>{d=T;let R=[];for(let b of a){let G=loe(b,d.get(b.key).overlayedDocument);G!=null&&R.push(new Ji(b.key,G,iW(G.value.mapValue),Gn.exists(!0)))}return c.mutationQueue.addMutationBatch(g,l,R,a)}).next(T=>{f=T;let R=T.applyToLocalDocumentSet(d,_);return c.documentOverlayCache.saveOverlays(g,T.batchId,R)})}).then(()=>({batchId:f.batchId,changes:pW(d)}))})(t.localStore,e);t.sharedClientState.addPendingMutation(i.batchId),(function(s,a,c){let l=s.Ru[s.currentUser.toKey()];l||(l=new Rt(De)),l=l.insert(a,c),s.Ru[s.currentUser.toKey()]=l})(t,i.batchId,n),yield nc(t,i.changes),yield zh(t.remoteStore)}catch(i){let o=IM(i,"Failed to persist write");n.reject(o)}})}function dz(r,e){return I(this,null,function*(){let n=de(r);try{let t=yield boe(n.localStore,e);e.targetChanges.forEach((i,o)=>{let s=n.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 nc(n,t,e)}catch(t){yield Za(t)}})}function vH(r,e,n){let t=de(r);if(t.isPrimaryClient&&n===0||!t.isPrimaryClient&&n===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&&SM(c)})(t.eventManager,e),i.length&&t.hu.J_(i),t.onlineState=e,t.isPrimaryClient&&t.sharedClientState.setOnlineState(e)}}function Joe(r,e,n){return I(this,null,function*(){let t=de(r);t.sharedClientState.updateQueryState(e,"rejected",n);let i=t.Eu.get(e),o=i&&i.key;if(o){let s=new Rt(ie.comparator);s=s.insert(o,vn.newNoDocument(o,pe.min()));let a=Ve().add(o),c=new up(pe.min(),new Map,new Rt(De),s,a);yield dz(t,c),t.du=t.du.remove(o),t.Eu.delete(e),CM(t)}else yield Uh(t.localStore,e,!1).then(()=>Gh(t,e,n)).catch(Za)})}function Zoe(r,e){return I(this,null,function*(){let n=de(r),t=e.batch.batchId;try{let i=yield woe(n.localStore,e);DM(n,t,null),RM(n,t),n.sharedClientState.updateMutationState(t,"acknowledged"),yield nc(n,i)}catch(i){yield Za(i)}})}function ese(r,e,n){return I(this,null,function*(){let t=de(r);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);DM(t,e,n),RM(t,e),t.sharedClientState.updateMutationState(e,"rejected",n),yield nc(t,i)}catch(i){yield Za(i)}})}function RM(r,e){(r.Vu.get(e)||[]).forEach(n=>{n.resolve()}),r.Vu.delete(e)}function DM(r,e,n){let t=de(r),i=t.Ru[t.currentUser.toKey()];if(i){let o=i.get(e);o&&(n?o.reject(n):o.resolve(),i=i.remove(e)),t.Ru[t.currentUser.toKey()]=i}}function Gh(r,e,n=null){r.sharedClientState.removeLocalQueryTarget(e);for(let t of r.Tu.get(e))r.Pu.delete(t),n&&r.hu.pu(t,n);r.Tu.delete(e),r.isPrimaryClient&&r.Au.zr(e).forEach(t=>{r.Au.containsKey(t)||hz(r,t)})}function hz(r,e){r.Iu.delete(e.path.canonicalString());let n=r.du.get(e);n!==null&&(Vh(r.remoteStore,n),r.du=r.du.remove(e),r.Eu.delete(n),CM(r))}function wL(r,e,n){for(let t of n)t instanceof Ay?(r.Au.addReference(t.key,e),tse(r,t)):t instanceof Ry?(X(Kh,"Document no longer in limbo: "+t.key),r.Au.removeReference(t.key,e),r.Au.containsKey(t.key)||hz(r,t.key)):ae(19791,{yu:t})}function tse(r,e){let n=e.key,t=n.path.canonicalString();r.du.get(n)||r.Iu.has(t)||(X(Kh,"New document in limbo: "+n),r.Iu.add(t),CM(r))}function CM(r){for(;r.Iu.size>0&&r.du.size<r.maxConcurrentLimboResolutions;){let e=r.Iu.values().next().value;r.Iu.delete(e);let n=new ie(We.fromString(e)),t=r.mu.next();r.Eu.set(t,new NL(n)),r.du=r.du.insert(n,t),Hy(r.remoteStore,new Fh(Jr(Np(n.path)),t,"TargetPurposeLimboResolution",Yr.ue))}}function nc(r,e,n){return I(this,null,function*(){let t=de(r),i=[],o=[],s=[];t.Pu.isEmpty()||(t.Pu.forEach((a,c)=>{s.push(t.gu(c,e,n).then(l=>{var u;if((l||n)&&t.isPrimaryClient){let d=l?!l.fromCache:(u=n?.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=oL.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(!ec(d))throw d;X(pM,"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 nse(r,e){return I(this,null,function*(){let n=de(r);if(!n.currentUser.isEqual(e)){X(Kh,"User change. New user:",e.toKey());let t=yield QW(n.localStore,e);n.currentUser=e,(function(o,s){o.Vu.forEach(a=>{a.forEach(c=>{c.reject(new Q(j.CANCELLED,s))})}),o.Vu.clear()})(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),yield nc(n,t.Bs)}})}function rse(r,e){let n=de(r),t=n.Eu.get(e);if(t&&t.lu)return Ve().add(t.key);{let i=Ve(),o=n.Tu.get(e);if(!o)return i;for(let s of o){let a=n.Pu.get(s);i=i.unionWith(a.view.tu)}return i}}function ise(r,e){return I(this,null,function*(){let n=de(r),t=yield cL(n.localStore,e.query,!0),i=e.view.uu(t);return n.isPrimaryClient&&wL(n,e.targetId,i._u),i})}function ose(r,e){return I(this,null,function*(){let n=de(r);return ZW(n.localStore,e).then(t=>nc(n,t))})}function sse(r,e,n,t){return I(this,null,function*(){let i=de(r),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?(n==="pending"?yield zh(i.remoteStore):n==="acknowledged"||n==="rejected"?(DM(i,e,t||null),RM(i,e),(function(a,c){de(de(a).mutationQueue).rr(c)})(i.localStore,e)):ae(6720,"Unknown batchState",{wu:n}),yield nc(i,o)):X(Kh,"Cannot apply mutation batch with id: "+e)})}function ase(r,e){return I(this,null,function*(){let n=de(r);if(Wy(n),NM(n),e===!0&&n.fu!==!0){let t=n.sharedClientState.getAllActiveQueryTargets(),i=yield yH(n,t.toArray());n.fu=!0,yield vL(n.remoteStore,!0);for(let o of i)Hy(n.remoteStore,o)}else if(e===!1&&n.fu!==!1){let t=[],i=Promise.resolve();n.Tu.forEach((o,s)=>{n.sharedClientState.isLocalQueryTarget(s)?t.push(s):i=i.then(()=>(Gh(n,s),Uh(n.localStore,s,!0))),Vh(n.remoteStore,s)}),yield i,yield yH(n,t),(function(s){let a=de(s);a.Eu.forEach((c,l)=>{Vh(a.remoteStore,l)}),a.Au.jr(),a.Eu=new Map,a.du=new Rt(ie.comparator)})(n),n.fu=!1,yield vL(n.remoteStore,!1)}})}function yH(r,e,n){return I(this,null,function*(){let t=de(r),i=[],o=[];for(let s of e){let a,c=t.Tu.get(s);if(c&&c.length!==0){a=yield my(t.localStore,Jr(c[0]));for(let l of c){let u=t.Pu.get(l),d=yield ise(t,u);d.snapshot&&o.push(d.snapshot)}}else{let l=yield JW(t.localStore,s);a=yield my(t.localStore,l),yield AM(t,fz(l),s,!1,a.resumeToken)}i.push(a)}return t.hu.J_(o),i})}function fz(r){return uW(r.path,r.collectionGroup,r.orderBy,r.filters,r.limit,"F",r.startAt,r.endAt)}function cse(r){return(function(n){return de(de(n).persistence).Ps()})(de(r).localStore)}function lse(r,e,n,t){return I(this,null,function*(){let i=de(r);if(i.fu)return void X(Kh,"Ignoring unexpected query state notification.");let o=i.Tu.get(e);if(o&&o.length>0)switch(n){case"current":case"not-current":{let s=yield ZW(i.localStore,fW(o[0])),a=up.createSynthesizedRemoteEventForCurrentChange(e,n==="current",un.EMPTY_BYTE_STRING);yield nc(i,s,a);break}case"rejected":yield Uh(i.localStore,e,!0),Gh(i,e,t);break;default:ae(64155,n)}})}function use(r,e,n){return I(this,null,function*(){let t=Wy(r);if(t.fu){for(let i of e){if(t.Tu.has(i)&&t.sharedClientState.isActiveQueryTarget(i)){X(Kh,"Adding an already active target "+i);continue}let o=yield JW(t.localStore,i),s=yield my(t.localStore,o);yield AM(t,fz(o),s.targetId,!1,s.resumeToken),Hy(t.remoteStore,s)}for(let i of n)t.Tu.has(i)&&(yield Uh(t.localStore,i,!1).then(()=>{Vh(t.remoteStore,i),Gh(t,i)}).catch(Za))}})}function Wy(r){let e=de(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=dz.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=rse.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Joe.bind(null,e),e.hu.J_=Woe.bind(null,e.eventManager),e.hu.pu=zoe.bind(null,e.eventManager),e}function NM(r){let e=de(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Zoe.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ese.bind(null,e),e}var OM=(()=>{class r{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(n){return I(this,null,function*(){this.serializer=$y(n.databaseInfo.databaseId),this.sharedClientState=this.bu(n),this.persistence=this.Du(n),yield this.persistence.start(),this.localStore=this.vu(n),this.gcScheduler=this.Cu(n,this.localStore),this.indexBackfillerScheduler=this.Fu(n,this.localStore)})}Cu(n,t){return null}Fu(n,t){return null}vu(n){return YW(this.persistence,new gy,n.initialUser,this.serializer)}Du(n){return new pp(hy.Vi,this.serializer)}bu(n){return new _y}terminate(){return I(this,null,function*(){var n,t;(n=this.gcScheduler)===null||n===void 0||n.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return r.provider={build:()=>new r},r})(),bL=class extends OM{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,n){he(this.persistence.referenceDelegate instanceof fy,46915);let t=this.persistence.referenceDelegate.garbageCollector;return new ly(t,e.asyncQueue,n)}Du(e){let n=this.cacheSizeBytes!==void 0?Or.withCacheSize(this.cacheSizeBytes):Or.DEFAULT;return new pp(t=>fy.Vi(t,n),this.serializer)}},Dy=class r extends OM{constructor(e,n,t){super(),this.Mu=e,this.cacheSizeBytes=n,this.forceOwnership=t,this.kind="persistent",this.synchronizeTabs=!1}initialize(e){return I(this,null,function*(){yield Ic(r.prototype,this,"initialize").call(this,e),yield this.Mu.initialize(this,e),yield NM(this.Mu.syncEngine),yield zh(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 YW(this.persistence,new gy,e.initialUser,this.serializer)}Cu(e,n){let t=this.persistence.referenceDelegate.garbageCollector;return new ly(t,e.asyncQueue,n)}Fu(e,n){let t=new nb(n,this.persistence);return new tb(e.asyncQueue,t)}Du(e){let n=KW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),t=this.cacheSizeBytes!==void 0?Or.withCacheSize(this.cacheSizeBytes):Or.DEFAULT;return new iL(this.synchronizeTabs,n,e.clientId,t,e.asyncQueue,iz(),kv(),this.serializer,this.sharedClientState,!!this.forceOwnership)}bu(e){return new _y}},LL=class r extends Dy{constructor(e,n){super(e,n,!1),this.Mu=e,this.cacheSizeBytes=n,this.synchronizeTabs=!0}initialize(e){return I(this,null,function*(){yield Ic(r.prototype,this,"initialize").call(this,e);let n=this.Mu.syncEngine;this.sharedClientState instanceof Ym&&(this.sharedClientState.syncEngine={Do:sse.bind(null,n),vo:lse.bind(null,n),Co:use.bind(null,n),Ps:cse.bind(null,n),bo:ose.bind(null,n)},yield this.sharedClientState.start()),yield this.persistence.ji(t=>I(this,null,function*(){yield ase(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 n=iz();if(!Ym.C(n))throw new Q(j.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");let t=KW(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Ym(n,e.asyncQueue,t,e.clientId,e.initialUser)}},wM=(()=>{class r{initialize(n,t){return I(this,null,function*(){this.localStore||(this.localStore=n.localStore,this.sharedClientState=n.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!n.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>vH(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=nse.bind(null,this.syncEngine),yield vL(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(n){return(function(){return new AL})()}createDatastore(n){let t=$y(n.databaseInfo.databaseId),i=(function(s){return new gL(s)})(n.databaseInfo);return(function(s,a,c,l){return new _L(s,a,c,l)})(n.authCredentials,n.appCheckCredentials,i,t)}createRemoteStore(n){return(function(i,o,s,a,c){return new IL(i,o,s,a,c)})(this.localStore,this.datastore,n.asyncQueue,t=>vH(this.syncEngine,t,0),(function(){return Ty.C()?new Ty:new uL})())}createSyncEngine(n,t){return(function(o,s,a,c,l,u,d){let f=new OL(o,s,a,c,l,u);return d&&(f.fu=!0),f})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,n.initialUser,n.maxConcurrentLimboResolutions,t)}terminate(){return I(this,null,function*(){var n,t;yield(function(o){return I(this,null,function*(){let s=de(o);X(iu,"RemoteStore shutting down."),s.Ia.add(5),yield wp(s),s.Ea.shutdown(),s.Aa.set("Unknown")})})(this.remoteStore),(n=this.datastore)===null||n===void 0||n.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()})}}return r.provider={build:()=>new r},r})();var Ip=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):Qt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,n){setTimeout(()=>{this.muted||e(n)},0)}};var ML=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 n=yield(function(i,o){return I(this,null,function*(){let s=de(i),a={documents:o.map(d=>hp(s.serializer,d))},c=yield s.Jo("BatchGetDocuments",s.serializer.databaseId,We.emptyPath(),a,o.length),l=new Map;c.forEach(d=>{let f=poe(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 n.forEach(t=>this.recordVersion(t)),n})}set(e,n){this.write(n.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,n){try{this.write(n.toMutation(e,this.preconditionForUpdate(e)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(e.toString())}delete(e){this.write(new tu(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(n=>{e.delete(n.key.toString())}),e.forEach((n,t)=>{let i=ie.fromPath(t);this.mutations.push(new ap(i,this.precondition(i)))}),yield(function(t,i){return I(this,null,function*(){let o=de(t),s={writes:i.map(a=>fp(o.serializer,a))};yield o.Wo("Commit",o.serializer.databaseId,We.emptyPath(),s)})})(this.datastore,this.mutations),this.committed=!0})}recordVersion(e){let n;if(e.isFoundDocument())n=e.version;else{if(!e.isNoDocument())throw ae(50498,{Wu:e.constructor.name});n=pe.min()}let t=this.readVersions.get(e.key.toString());if(t){if(!n.isEqual(t))throw new Q(j.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),n)}precondition(e){let n=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&n?n.isEqual(pe.min())?Gn.exists(!1):Gn.updateTime(n):Gn.none()}preconditionForUpdate(e){let n=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&n){if(n.isEqual(pe.min()))throw new Q(j.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Gn.updateTime(n)}return Gn.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};var PL=class{constructor(e,n,t,i,o){this.asyncQueue=e,this.datastore=n,this.options=t,this.updateFunction=i,this.deferred=o,this.Gu=t.maxAttempts,this.F_=new _p(this.asyncQueue,"transaction_retry")}zu(){this.Gu-=1,this.ju()}ju(){this.F_.g_(()=>I(this,null,function*(){let e=new ML(this.datastore),n=this.Ju(e);n&&n.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 n=this.updateFunction(e);return!Rp(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(n){return this.deferred.reject(n),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 n=e.code;return n==="aborted"||n==="failed-precondition"||n==="already-exists"||!RW(n)}return!1}};var Ja="FirestoreClient",xL=class{constructor(e,n,t,i,o){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=t,this.databaseInfo=i,this.user=cn.UNAUTHENTICATED,this.clientId=Qm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(t,s=>I(this,null,function*(){X(Ja,"Received user=",s.uid),yield this.authCredentialListener(s),this.user=s})),this.appCheckCredentials.start(t,s=>(X(Ja,"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 wr;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(n){let t=IM(n,"Failed to shutdown persistence");e.reject(t)}})),e.promise}};function Hw(r,e){return I(this,null,function*(){r.asyncQueue.verifyOperationInProgress(),X(Ja,"Initializing OfflineComponentProvider");let n=r.configuration;yield e.initialize(n);let t=n.initialUser;r.setCredentialChangeListener(i=>I(null,null,function*(){t.isEqual(i)||(yield QW(e.localStore,i),t=i)})),e.persistence.setDatabaseDeletedListener(()=>{Ps("Terminating Firestore due to IndexedDb database deletion"),r.terminate().then(()=>{X("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{Ps("Terminating Firestore due to IndexedDb database deletion failed",i)})}),r._offlineComponents=e})}function SH(r,e){return I(this,null,function*(){r.asyncQueue.verifyOperationInProgress();let n=yield dse(r);X(Ja,"Initializing OnlineComponentProvider"),yield e.initialize(n,r.configuration),r.setCredentialChangeListener(t=>_H(e.remoteStore,t)),r.setAppCheckTokenChangeListener((t,i)=>_H(e.remoteStore,i)),r._onlineComponents=e})}function dse(r){return I(this,null,function*(){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){X(Ja,"Using user provided OfflineComponentProvider");try{yield Hw(r,r._uninitializedComponentsProvider._offline)}catch(e){let n=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})(n))throw n;Ps("Error using user provided cache. Falling back to memory cache: "+n),yield Hw(r,new OM)}}else X(Ja,"Using default OfflineComponentProvider"),yield Hw(r,new bL(void 0));return r._offlineComponents})}function bM(r){return I(this,null,function*(){return r._onlineComponents||(r._uninitializedComponentsProvider?(X(Ja,"Using user provided OnlineComponentProvider"),yield SH(r,r._uninitializedComponentsProvider._online)):(X(Ja,"Using default OnlineComponentProvider"),yield SH(r,new wM))),r._onlineComponents})}function hse(r){return bM(r).then(e=>e.syncEngine)}function gz(r){return bM(r).then(e=>e.datastore)}function Cy(r){return I(this,null,function*(){let e=yield bM(r),n=e.eventManager;return n.onListen=qoe.bind(null,e.syncEngine),n.onUnlisten=Yoe.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=Koe.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=Qoe.bind(null,e.syncEngine),n})}function fse(r,e,n={}){let t=new wr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new Ip({next:f=>{u.Ou(),s.enqueueAndForget(()=>yM(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 Tp(Np(a.path),u,{includeMetadataChanges:!0,ka:!0});return vM(o,d)})(yield Cy(r),r.asyncQueue,e,n,t)})),t.promise}function gse(r,e,n={}){let t=new wr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return(function(o,s,a,c,l){let u=new Ip({next:f=>{u.Ou(),s.enqueueAndForget(()=>yM(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 Tp(a,u,{includeMetadataChanges:!0,ka:!0});return vM(o,d)})(yield Cy(r),r.asyncQueue,e,n,t)})),t.promise}function mse(r,e,n){let t=new wr;return r.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){try{let i=yield gz(r);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,Jie(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,R)=>(T[f[R]]=_[R],T),{})})})(i,e,n))}catch(i){t.reject(i)}})),t.promise}function mz(r){let e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}var AH=new Map;var pz="firestore.googleapis.com",RH=!0,Ny=class{constructor(e){var n,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=pz,this.ssl=RH}else this.host=e.host,this.ssl=(n=e.ssl)!==null&&n!==void 0?n:RH;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=GW;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<WW)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=mz((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}},ou=class{constructor(e,n,t,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=t,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ny({}),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 Ny(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(t){if(!t)return new Ww;switch(t.type){case"firstParty":return new Yw(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(n){let t=AH.get(n);t&&(X("ComponentProvider","Removing Datastore"),AH.delete(n),t.terminate())})(this),Promise.resolve()}};function Ez(r,e,n,t={}){var i;r=br(r,ou);let o=Wr(e),s=r._getSettings(),a=Object.assign(Object.assign({},s),{emulatorOptions:r._getEmulatorOptions()}),c=`${e}:${n}`;o&&(pa(`https://${c}`),ul("Firestore",!0)),s.host!==pz&&s.host!==c&&Ps("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(!$i(l,a)&&(r._setSettings(l),t.mockUserToken)){let u,d;if(typeof t.mockUserToken=="string")u=t.mockUserToken,d=cn.MOCK_USER;else{u=nI(t.mockUserToken,(i=r._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)}r._authCredentials=new zw(new Uv(u,d))}}var Zi=class r{constructor(e,n,t){this.converter=n,this._query=t,this.type="query",this.firestore=e}withConverter(e){return new r(this.firestore,e,this._query)}},yn=class r{constructor(e,n,t){this.converter=n,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 Ga(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new r(this.firestore,e,this._key)}toJSON(){return{type:r._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,t){if(Ap(n,r._jsonSchema))return new r(e,t||null,new ie(We.fromString(n.referencePath)))}};yn._jsonSchemaVersion="firestore/documentReference/1.0",yn._jsonSchema={type:ln("string",yn._jsonSchemaVersion),referencePath:ln("string")};var Ga=class r extends Zi{constructor(e,n,t){super(e,n,Np(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 yn(this.firestore,null,new ie(e))}withConverter(e){return new r(this.firestore,e,this._path)}};function _z(r,e,...n){if(r=Ge(r),eM("collection","path",e),r instanceof ou){let t=We.fromString(e,...n);return I2(t),new Ga(r,null,t)}{if(!(r instanceof yn||r instanceof Ga))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=r._path.child(We.fromString(e,...n));return I2(t),new Ga(r.firestore,null,t)}}function Tz(r,e){if(r=br(r,ou),eM("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 Zi(r,null,(function(t){return new qo(We.emptyPath(),t)})(e))}function Iz(r,e,...n){if(r=Ge(r),arguments.length===1&&(e=Qm.newId()),eM("doc","path",e),r instanceof ou){let t=We.fromString(e,...n);return T2(t),new yn(r,null,new ie(t))}{if(!(r instanceof yn||r instanceof Ga))throw new Q(j.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let t=r._path.child(We.fromString(e,...n));return T2(t),new yn(r.firestore,r instanceof Ga?r.converter:null,new ie(t))}}var DH="AsyncQueue",Oy=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 _p(this,"async_queue_retry"),this.oc=()=>{let t=kv();t&&X(DH,"Visibility state changed to "+t.visibilityState),this.F_.y_()},this._c=e;let n=kv();n&&typeof n.addEventListener=="function"&&n.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 n=kv();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let n=new wr;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.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(!ec(e))throw e;X(DH,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(e){let n=this._c.then(()=>(this.nc=!0,e().catch(t=>{throw this.tc=t,this.nc=!1,Qt("INTERNAL UNHANDLED ERROR: ",CH(t)),t}).then(t=>(this.nc=!1,t))));return this._c=n,n}enqueueAfterDelay(e,n,t){this.ac(),this.sc.indexOf(e)>-1&&(n=0);let i=yL.createAndSchedule(this,e,n,t,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&ae(47125,{hc:CH(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 n of this.ec)if(n.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((n,t)=>n.targetTimeMs-t.targetTimeMs);for(let n of this.ec)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let n=this.ec.indexOf(e);this.ec.splice(n,1)}};function CH(r){let e=r.message||"";return r.stack&&(e=r.stack.includes(r.message)?r.stack:r.message+`
167
- `+r.stack),e}function NH(r){return(function(n,t){if(typeof n!="object"||n===null)return!1;let i=n;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(r,["next","error","complete"])}var eo=class extends ou{constructor(e,n,t,i){super(e,n,t,i),this.type="firestore",this._queue=new Oy,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Oy(e),this._firestoreClient=void 0,yield e}})}};function zy(r,e,n){n||(n=ip);let t=xo(r,"firestore");if(t.isInitialized(n)){let i=t.getImmediate({identifier:n}),o=t.getOptions(n);if($i(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<WW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&Wr(e.host)&&pa(e.host),t.initialize({options:e,instanceIdentifier:n})}function Yh(r,e){let n=typeof r=="object"?r:Rr(),t=typeof r=="string"?r:e||ip,i=xo(n,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=Pd("firestore");o&&Ez(i,...o)}return i}function Qh(r){if(r._terminated)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||pse(r),r._firestoreClient}function pse(r){var e,n,t;let i=r._freezeSettings(),o=(function(a,c,l,u){return new sb(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,mz(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,i);r._componentsProvider||!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(r._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),r._firestoreClient=new xL(r._authCredentials,r._appCheckCredentials,r._queue,o,r._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(r._componentsProvider))}var FL=class{constructor(e="count",n){this._internalFieldPath=n,this.type="AggregateField",this.aggregateType=e}},kL=class{constructor(e,n,t){this._userDataWriter=n,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Ms=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(un.fromBase64String(e))}catch(n){throw new Q(j.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new r(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:r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ap(e,r._jsonSchema))return r.fromBase64String(e.bytes)}};Ms._jsonSchemaVersion="firestore/bytes/1.0",Ms._jsonSchema={type:ln("string",Ms._jsonSchemaVersion),bytes:ln("string")};var $h=class{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new Q(j.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new In(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var vp=class{constructor(e){this._methodName=e}};var $a=class r{constructor(e,n){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(n)||n<-180||n>180)throw new Q(j.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return De(this._lat,e._lat)||De(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:r._jsonSchemaVersion}}static fromJSON(e){if(Ap(e,r._jsonSchema))return new r(e.latitude,e.longitude)}};$a._jsonSchemaVersion="firestore/geoPoint/1.0",$a._jsonSchema={type:ln("string",$a._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};var ja=class r{constructor(e){this._values=(e||[]).map(n=>n)}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:r._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ap(e,r._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(n=>typeof n=="number"))return new r(e.vectorValues);throw new Q(j.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};ja._jsonSchemaVersion="firestore/vectorValue/1.0",ja._jsonSchema={type:ln("string",ja._jsonSchemaVersion),vectorValues:ln("object")};var Ese=/^__.*__$/,UL=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return this.fieldMask!==null?new Ji(e,this.data,this.fieldMask,n,this.fieldTransforms):new Qa(e,this.data,n,this.fieldTransforms)}},wy=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return new Ji(e,this.data,this.fieldMask,n,this.fieldTransforms)}};function vz(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:r})}}var VL=class r{constructor(e,n,t,i,o,s){this.settings=e,this.databaseId=n,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 r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.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 Ly(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.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(vz(this.Ec)&&Ese.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},BL=class{constructor(e,n,t){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=t||$y(e)}Dc(e,n,t,i=!1){return new VL({Ec:e,methodName:n,bc:t,path:In.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function qy(r){let e=r._freezeSettings(),n=$y(r._databaseId);return new BL(r._databaseId,!!e.ignoreUndefinedProperties,n)}function yz(r,e,n,t,i,o={}){let s=r.Dc(o.merge||o.mergeFields?2:0,e,n,i);LM("Data must be an object, but it was:",s,t);let a=Az(t,s),c,l;if(o.merge)c=new Qr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=GL(e,d,n);if(!s.contains(f))throw new Q(j.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);Dz(u,f)||u.push(f)}c=new Qr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new UL(new rr(a),c,l)}var by=class r extends vp{_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 r}};function _se(r,e,n,t){let i=r.Dc(1,e,n);LM("Data must be an object, but it was:",i,t);let o=[],s=rr.empty();tc(t,(c,l)=>{let u=MM(e,c,n);l=Ge(l);let d=i.gc(u);if(l instanceof by)o.push(u);else{let f=bp(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new Qr(o);return new wy(s,a,i.fieldTransforms)}function Tse(r,e,n,t,i,o){let s=r.Dc(1,e,n),a=[GL(e,t,n)],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(GL(e,o[f])),c.push(o[f+1]);let l=[],u=rr.empty();for(let f=a.length-1;f>=0;--f)if(!Dz(l,a[f])){let g=a[f],p=c[f];p=Ge(p);let _=s.gc(g);if(p instanceof by)l.push(g);else{let T=bp(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new Qr(l);return new wy(u,d,s.fieldTransforms)}function Sz(r,e,n,t=!1){return bp(n,r.Dc(t?4:3,e))}function bp(r,e){if(Rz(r=Ge(r)))return LM("Unsupported field value:",e,r),Az(r,e);if(r instanceof vp)return(function(t,i){if(!vz(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)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r 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=bp(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(r,e)}return(function(t,i){if((t=Ge(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return ioe(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=Mt.fromDate(t);return{timestampValue:xh(i.serializer,o)}}if(t instanceof Mt){let o=new Mt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:xh(i.serializer,o)}}if(t instanceof $a)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Ms)return{bytesValue:CW(i.serializer,t._byteString)};if(t instanceof yn){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:fM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof ja)return(function(s,a){return{mapValue:{fields:{[aM]:{stringValue:cM},[wh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return hM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${Py(t)}`)})(r,e)}function Az(r,e){let n={};return QH(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):tc(r,(t,i)=>{let o=bp(i,e.Vc(t));o!=null&&(n[t]=o)}),{mapValue:{fields:n}}}function Rz(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof Mt||r instanceof $a||r instanceof Ms||r instanceof yn||r instanceof vp||r instanceof ja)}function LM(r,e,n){if(!Rz(n)||!PH(n)){let t=Py(n);throw t==="an object"?e.wc(r+" a custom object"):e.wc(r+" "+t)}}function GL(r,e,n){if((e=Ge(e))instanceof $h)return e._internalPath;if(typeof e=="string")return MM(r,e);throw Ly("Field path arguments must be of type string or ",r,!1,void 0,n)}var Ise=new RegExp("[~\\*/\\[\\]]");function MM(r,e,n){if(e.search(Ise)>=0)throw Ly(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,n);try{return new $h(...e.split("."))._internalPath}catch{throw Ly(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,n)}}function Ly(r,e,n,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;n&&(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+r+c)}function Dz(r,e){return r.some(n=>n.isEqual(e))}var su=class{constructor(e,n,t,i,o){this._firestore=e,this._userDataWriter=n,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new yn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new $L(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 n=this._document.data.field(Ky("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}},$L=class extends su{data(){return super.data()}};function Ky(r,e){return typeof e=="string"?MM(r,e):e instanceof $h?e._internalPath:e._delegate._internalPath}function Cz(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new Q(j.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var yp=class{},jh=class extends yp{};function Nz(r,e,...n){let t=[];e instanceof yp&&t.push(e),t=t.concat(n),(function(o){let s=o.filter(c=>c instanceof Hh).length,a=o.filter(c=>c instanceof Sp).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)r=i._apply(r);return r}var Sp=class r extends jh{constructor(e,n,t){super(),this._field=e,this._op=n,this._value=t,this.type="where"}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=this._parse(e);return xz(e._query,n),new Zi(e.firestore,e.converter,Tb(e._query,n))}_parse(e){let n=qy(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"){wH(d,u);let p=[];for(let _ of d)p.push(OH(c,o,_));f={arrayValue:{values:p}}}else f=OH(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||wH(d,u),f=Sz(a,s,d,u==="in"||u==="not-in");return $e.create(l,u,f)})(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}};function Oz(r,e,n){let t=e,i=Ky("where",r);return Sp._create(i,t,n)}var Hh=class r extends yp{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new r(e,n)}_parse(e){let n=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return n.length===1?n[0]:rt.create(n,this._getOperator())}_apply(e){let n=this._parse(e);return n.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)xz(s,c),s=Tb(s,c)})(e._query,n),new Zi(e.firestore,e.converter,Tb(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function wz(...r){return r.forEach(e=>Fz("or",e)),Hh._create("or",r)}function bz(...r){return r.forEach(e=>Fz("and",e)),Hh._create("and",r)}var jL=class r extends jh{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new r(e,n)}_apply(e){let n=(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 Xl(o,s)})(e._query,this._field,this._direction);return new Zi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new qo(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,n))}};function Lz(r,e="asc"){let n=e,t=Ky("orderBy",r);return jL._create(t,n)}var HL=class r extends jh{constructor(e,n,t){super(),this.type=e,this._limit=n,this._limitType=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){return new Zi(e.firestore,e.converter,Jv(e._query,this._limit,this._limitType))}};function Mz(r){return Iie("limit",r),HL._create("limit",r,"F")}var WL=class r extends jh{constructor(e,n,t){super(),this.type=e,this._docOrFields=n,this._inclusive=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=vse(e,this.type,this._docOrFields,this._inclusive);return new Zi(e.firestore,e.converter,(function(i,o){return new qo(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,n))}};function Pz(...r){return WL._create("startAfter",r,!1)}function vse(r,e,n,t){if(n[0]=Ge(n[0]),n[0]instanceof su)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 _h(o))if(d.field.isKeyField())u.push(Ql(s,c.key));else{let f=c.data.field(d.field);if(Uy(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 zo(u,l)})(r._query,r.firestore._databaseId,e,n[0]._document,t);{let i=qy(r.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(!uM(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 R=new ie(T);g.push(Ql(a,R))}else{let T=Sz(c,l,_);g.push(T)}}return new zo(g,d)})(r._query,r.firestore._databaseId,i,e,n,t)}}function OH(r,e,n){if(typeof(n=Ge(n))=="string"){if(n==="")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(!uM(e)&&n.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let t=e.path.child(We.fromString(n));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 Ql(r,new ie(t))}if(n instanceof yn)return Ql(r,n._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: ${Py(n)}.`)}function wH(r,e){if(!Array.isArray(r)||r.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function xz(r,e){let n=(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})(r.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(n!==null)throw n===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 '${n.toString()}' filters.`)}function Fz(r,e){if(!(e instanceof Sp||e instanceof Hh))throw new Q(j.INVALID_ARGUMENT,`Function ${r}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var My=class{convertValue(e,n="none"){switch(za(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Lt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Fs(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){let t={};return tc(e,(i,o)=>{t[i]=this.convertValue(o,n)}),t}convertVectorValue(e){var n,t,i;let o=(i=(t=(n=e.fields)===null||n===void 0?void 0:n[wh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>Lt(s.doubleValue));return new ja(o)}convertGeoPoint(e){return new $a(Lt(e.latitude),Lt(e.longitude))}convertArray(e,n){return(e.values||[]).map(t=>this.convertValue(t,n))}convertServerTimestamp(e,n){switch(n){case"previous":let t=Vy(e);return t==null?null:this.convertValue(t,n);case"estimate":return this.convertTimestamp(rp(e));default:return null}}convertTimestamp(e){let n=xs(e);return new Mt(n.seconds,n.nanos)}convertDocumentKey(e,n){let t=We.fromString(e);he(FW(t),9688,{name:e});let i=new Oh(t.get(1),t.get(3)),o=new ie(t.popFirst(5));return i.isEqual(n)||Qt(`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 (${n.projectId}/${n.database}) instead.`),o}};function kz(r,e,n){let t;return t=r?n&&(n.merge||n.mergeFields)?r.toFirestore(e,n):r.toFirestore(e):e,t}var zL=class extends My{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ms(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new yn(this.firestore,null,n)}};function yse(){return new FL("count")}var Ba=class{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ha=class r extends su{constructor(e,n,t,i,o,s){super(e,n,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 n=new Ih(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){let t=this._document.data.field(Ky("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,n.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,n={};return n.type=r._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}};Ha._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ha._jsonSchema={type:ln("string",Ha._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};var Ih=class extends Ha{data(e={}){return super.data(e)}},Yl=class r{constructor(e,n,t,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new Ba(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(t=>{e.call(n,new Ih(this._firestore,this._userDataWriter,t.key,t,new Ba(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let n=!!e.includeMetadataChanges;if(n&&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===n||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new Ih(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Ba(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 Ih(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Ba(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:Sse(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,n),this._cachedChangesIncludeMetadataChanges=n),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=r._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Qm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(n.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 Sse(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:r})}}function Uz(r){r=br(r,yn);let e=br(r.firestore,eo);return fse(Qh(e),r._key).then(n=>Hz(e,r,n))}Yl._jsonSchemaVersion="firestore/querySnapshot/1.0",Yl._jsonSchema={type:ln("string",Yl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};var au=class extends My{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ms(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new yn(this.firestore,null,n)}};function Vz(r){r=br(r,Zi);let e=br(r.firestore,eo),n=Qh(e),t=new au(e);return Cz(r._query),gse(n,r._query).then(i=>new Yl(e,t,r,i))}function Bz(r,e,n){r=br(r,yn);let t=br(r.firestore,eo),i=kz(r.converter,e,n);return jz(t,[yz(qy(t),"setDoc",r._key,i,r.converter!==null,n).toMutation(r._key,Gn.none())])}function Gz(r){return jz(br(r.firestore,eo),[new tu(r._key,Gn.none())])}function $z(r,...e){var n,t,i;r=Ge(r);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||NH(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(NH(e[s])){let d=e[s];e[s]=(n=d.next)===null||n===void 0?void 0:n.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(r instanceof yn)l=br(r.firestore,eo),u=Np(r._key.path),c={next:d=>{e[s]&&e[s](Hz(l,r,d))},error:e[s+1],complete:e[s+2]};else{let d=br(r,Zi);l=br(d.firestore,eo),u=d._query;let f=new au(l);c={next:g=>{e[s]&&e[s](new Yl(l,f,d,g))},error:e[s+1],complete:e[s+2]},Cz(r._query)}return(function(f,g,p,_){let T=new Ip(_),R=new Tp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return vM(yield Cy(f),R)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return yM(yield Cy(f),R)}))}})(Qh(l),u,a,c)}function jz(r,e){return(function(t,i){let o=new wr;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return Xoe(yield hse(t),i,o)})),o.promise})(Qh(r),e)}function Hz(r,e,n){let t=n.docs.get(e._key),i=new au(r);return new Ha(r,i,e._key,t,new Ba(n.hasPendingWrites,n.fromCache),e.converter)}function Wz(r){return zz(r,{count:yse()})}function zz(r,e){let n=br(r.firestore,eo),t=Qh(n),i=qie(e,(o,s)=>new Sb(s,o.aggregateType,o._internalFieldPath));return mse(t,r._query,i).then(o=>(function(a,c,l){let u=new au(a);return new kL(c,u,l)})(n,r,o))}var qL=class{constructor(e){let n;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),n=e.tabManager):(n=Ase(void 0),n._initialize(e)),this._onlineComponentProvider=n._onlineComponentProvider,this._offlineComponentProvider=n._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function PM(r){return new qL(r)}var KL=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=wM.provider,this._offlineComponentProvider={build:n=>new Dy(n,e?.cacheSizeBytes,this.forceOwnership)}}},YL=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=wM.provider,this._offlineComponentProvider={build:n=>new LL(n,e?.cacheSizeBytes)}}};function Ase(r){return new KL(r?.forceOwnership)}function xM(){return new YL}var Rse={maxAttempts:5};function Gm(r,e){if((r=Ge(r)).firestore!==e)throw new Q(j.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}var QL=class{constructor(e,n){this._firestore=e,this._transaction=n,this._dataReader=qy(e)}get(e){let n=Gm(e,this._firestore),t=new zL(this._firestore);return this._transaction.lookup([n._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new su(this._firestore,t,o.key,o,n.converter);if(o.isNoDocument())return new su(this._firestore,t,n._key,null,n.converter);throw ae(18433,{doc:o})})}set(e,n,t){let i=Gm(e,this._firestore),o=kz(i.converter,n,t),s=yz(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,n,t,...i){let o=Gm(e,this._firestore),s;return s=typeof(n=Ge(n))=="string"||n instanceof $h?Tse(this._dataReader,"Transaction.update",o._key,n,t,i):_se(this._dataReader,"Transaction.update",o._key,n),this._transaction.update(o._key,s),this}delete(e){let n=Gm(e,this._firestore);return this._transaction.delete(n._key),this}};var XL=class extends QL{constructor(e,n){super(e,n),this._firestore=e}get(e){let n=Gm(e,this._firestore),t=new au(this._firestore);return super.get(e).then(i=>new Ha(this._firestore,t,n._key,i._document,new Ba(!1,!1),n.converter))}};function qz(r,e,n){r=br(r,eo);let t=Object.assign(Object.assign({},Rse),n);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 wr;return o.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){let l=yield gz(o);new PL(o.asyncQueue,l,a,s,c).zu()})),c.promise})(Qh(r),i=>e(new XL(r,i)),t)}(function(e,n=!0){(function(i){Wh=i})(Ia),hr(new Tn("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new eo(new qw(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 Oh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:n},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Qe(m2,p2,e),Qe(m2,p2,"esm2017")})();var Yy=Ee(bz,!0,2);var Qy=Ee(_z,!0,2),Kz=Ee(Tz,!0,2);var Yz=Ee(Gz,!0,2);var Lp=Ee(Iz,!0,2);var Qz=Ee(Wz,!0),FM=Ee(Uz,!0);var Xz=Ee(Vz,!0);var Dse=Ee(Mz,!0,2);var Jz=Ee($z,!0);var Cse=Ee(wz,!0,2),Nse=Ee(Lz,!0,2),Zz=Ee(Nz,!0,2);var e3=Ee(qz,!0),t3=Ee(Bz,!0,2);var Ose=Ee(Pz,!0,2);var Ii=Ee(Oz,!0,2);var rc=(()=>{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=NV(c,a.v1DbHost),a?.forceLongPolling&&Tw());let l=eh(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)(C(Nr),C(Zn),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Ko=(()=>{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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.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:_t.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(([F,U])=>{let S=this.commentAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:_t.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||Z();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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:_t.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:_t.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||Z();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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?Nn(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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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:nn.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:nn.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:_t.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:_t.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Yo=(()=>{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.fieldsToRemove=[],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),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove||[]))})}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)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.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:Tt.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(([F,U])=>{let S=this.reactionAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Tt.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||Z();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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:nn.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:Tt.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:Tt.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||Z();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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?Nn(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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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:nn.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:nn.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:Tt.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:Tt.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Xh=(()=>{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||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:wo.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=_S(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:wo.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:wo.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:wo.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||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:wo.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield kt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:nn.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:nn.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:wo.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:wo.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||Z(),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:wo.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var ic=(()=>{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.fieldsToRemove=[],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||[]),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove||[]),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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:It.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:It.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(([F,U])=>{let S=this.recorderAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:It.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||Z();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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:It.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:It.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||Z();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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?Nn(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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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:nn.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:nn.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:It.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:It.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:It.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}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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)(C(vt),C(ge),C(bt),C(Xh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Zy=class{};var Jh=(()=>{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.endpointsService=J(Fo),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(yd).subscribe(_=>{this.commentService=_??void 0}),U1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(wS(()=>Oi(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=JT(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=JT(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=JT(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:Un.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))&&Bi(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=XT(this.getOptionsFromDocumentPaths()??{})??{};return!t.every(u=>a.includes(u.id))||!Bi(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=`${vr(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:Un.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:Un.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(st(Ft))}getProcessedDocContext(){return BV(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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield wd({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:ma(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:Ui.ORGANIZATION,source:Jn.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:Ui.FOLDER,source:Jn.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:Ui.DOCUMENT,source:Jn.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&GV({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:Ui.CONTEXT,source:Jn.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===Ui.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=$V({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=Z();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Jn.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:Jn.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===vs.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===vs.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===vs.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===vs.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===vs.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===vs.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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield wd({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,XT(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=Z();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=XT(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:Un.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=`${vr(t)}`,l=o?.folderId,u=o?.folderId?bo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?Vi(i):s?.organizationId:void 0,_=Z(),T=Rd.SET_DOCUMENTS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:_t.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let R=Z(),b=Dd.SET_DOCUMENTS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:R,moduleName:b,methodName:Tt.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let G=Z(),M=Cd.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:It.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:R,moduleName:b}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.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 F=new jT,U=new Zy;F.clientDocumentId=t,U.clientDocumentId=t,F.folderId=l,U.folderId=l,F.locationId=d,U.locationId=d,F.allDocuments=f,F.optimisticPermissions=g,U.allDocuments=f,U.optimisticPermissions=g,F.veltFolderId=u,U.veltFolderId=u,F.documentId=c,U.documentId=c,p&&(F.organizationId=p,F.clientOrganizationId=i??s?.clientOrganizationId,U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId);let S=`${this.apiKey}`,A=`apiKey/${this.apiKey}`;p&&(S=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`,A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`),U.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,U.document=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,F.presence=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,F.cursor=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,F.comment=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,U.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,F.multiThread=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,U.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,F.tag=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,F.area=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,U.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,F.arrow=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,F.selection=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,F.audioHuddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,F.huddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,F.recorder=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,U.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,F.flock=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,F.syncVideoPlayer=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,F.liveState=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,F.liveStateSingleEditorMode=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,F.reaction=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,U.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,F.crdt=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,U.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,F.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,F.views=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,U.notificationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,U.documentViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,U.locationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,F.notifications=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,F.metadata=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,F.users=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.documentIam=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.groupContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,F.globalContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,F.logins=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,F.userFeedback=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,F.userReportBugs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,F.userContactUs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(F.organizationMetadata=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,F.organizationIam=`${S}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.organizationGroups=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,F.organizationNotifications=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(F.organizationNotificationsWithDocumentId=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,F.heartbeatByDocument=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),F.organizationNotificationsLastNotificationTimestamp=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,F.organizationNotificationsUsers=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.heartbeat=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),U.organizationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,U.users=`${A}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,U.documentUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,U.notificationDocs=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,U.notificationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(F),this.firestorePaths$.next(U),F?.clientOrganizationId&&F?.organizationId&&!(F?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&F?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:F?.organizationId,clientOrganizationId:F?.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:Un.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:Un.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===vs.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(rs(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`${vr(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${Vi(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:Un.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:Un.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:Un.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=Od(l),f=vr(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=Od(l),f=vr(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(R=>{let b=g[R];b.location?.id===d.id&&(f=x(x({},b.location),d),delete g?.[R])});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:Un.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:Un.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:Un.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:Un.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:Un.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:Un.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 WT;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===vs.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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield wd({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 $T;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=Mg(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}),Bi(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 HT;u.locationId=l?.locationId,u.veltLocationId=PC(l?.location?.id??""),u.location=l?.location,u.pageInfo=Mg(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"?vr(JSON.stringify(Od(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),st(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||{}),st(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),st(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||{}),st(Ft))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(st(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=Hr(),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=bo(t?.folderId);o.push(Ii("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ii("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=bo(t?.folderId);o.push(Ii("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ii("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=ys(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=ma(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=bo(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=>ma(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=PC(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:ys(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=bo(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:[Ii("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(pt(t=>t?this.documentPaths$.pipe(pt(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),st((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?xt.RESTRICTED:xt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:xt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),xt.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 xt.PUBLIC:o.features.all.restricted=!1;break;case xt.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)(C(bt),C(Nr),C(rc),C(yv),C(Zn),C(ge),C(Ko),C(Yo),C(ic),C(vt),C(fr),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();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 mt,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),pt(()=>this.getUnresolvedUsers$().pipe(Ct(c=>c.length>0),wu(300),Nt(20),pt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[Yy(Ii("user.userId","in",c.slice(0,20)))]}}).pipe(fe(u=>u?.data),Js(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||Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:Fn.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={};try{let R,b=new Promise((G,M)=>{R=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(R)}),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:Fn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(R){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",R,{userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:Fn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:R,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{g?.forEach(R=>{if(!T[R]){let b=new Set([...this.getUnresolvedUsers(),R]);this.unresolvedUsers.next(Array.from(b)),T[R]={userId:R,name:`User ${R}`}}})}Object.entries(T).forEach(([R,b])=>{b&&(f[R]=T?.[R],p[R]=T?.[R])})}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||Z();return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Fn.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:[Ii("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:[Yy(Ii("userId","in",_),Ii("veltResourceId","in",T))]}}))??[])||[]}catch(R){return this.loggingService.catch(`Error in batch ${u+1}:`,R),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,R)=>T===R.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;"),ti([this.userById$,this.customContactUserById$]).pipe(fe(([t,i])=>this.applyContactOverlay(t,i)),st(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 F=this.userIdByEmailCache[M];F?c[M]=F: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||Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:Fn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,R=new Promise((M,F)=>{T=setTimeout(()=>{F(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,R]);return Object.entries(M).forEach(([F,U])=>{U&&(this.userIdByEmailCache[F]=U,c[F]=U,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:U,name:F,email:F},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:Fn.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:Fn.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)(C(bt),C(Nr),C(vt),C(Jh),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var oc=class{static getFirestoreProdDbName(e,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(n){return H.error("Error in isTestingDb:",n),!1}}};var eS=(()=>{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.endpointsService=J(Fo),this.notificationActionTypeMap={[ye.NEWLY_ADDED]:nn.COMMENT_ANNOTATION_ADD,[ye.ADDED]:nn.COMMENT_ADD,[ye.UPDATED]:nn.COMMENT_UPDATE,[ye.DELETED]:nn.COMMENT_DELETE},this.additionalEventTypeMap={[ye.STATUS_CHANGED]:ur.STATUS_CHANGE,[ye.PRIORITY_CHANGED]:ur.PRIORITY_CHANGE,[ye.ASSIGNED]:ur.ASSIGN,[ye.ACCESS_MODE_CHANGED]:ur.ACCESS_MODE_CHANGE,[ye.CUSTOM_LIST_CHANGED]:ur.CUSTOM_LIST_CHANGE,[ye.APPROVED]:ur.APPROVE,[ye.ACCEPTED]:ur.ACCEPT,[ye.REJECTED]:ur.REJECT,[ye.SUGGESTION_ACCEPTED]:ur.SUGGESTION_ACCEPT,[ye.SUGGESTION_REJECTED]:ur.SUGGESTION_REJECT,[ye.REACTION_ADDED]:ur.REACTION_ADD,[ye.REACTION_DELETED]:ur.REACTION_DELETE,[ye.SUBSCRIBED]:ur.SUBSCRIBE,[ye.UNSUBSCRIBED]:ur.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(al(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(al(`@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?!Bi(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 BT;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=Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:Fn.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=al(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:Nn(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(U=>{t?.[U]&&(p[M][U]=t[U],delete t[U])}),l?.length)for(let U of l)t?.[U]!==void 0&&(p[M][U]=JSON.parse(JSON.stringify(t[U])));t.comments?.forEach(U=>{if(U.commentId){let S;a&&(S={},U.attachments?.forEach(A=>{S[A.attachmentId]={attachmentId:A.attachmentId,name:A.name,url:A.url}})),p[M].comments[U.commentId]=x(x(x(x(x(x({commentId:U.commentId},U?.commentHtml&&{commentHtml:U?.commentHtml}),U?.commentText&&{commentText:U?.commentText}),S&&{attachments:S}),U?.from&&{from:U?.from}),U?.to&&{to:U?.to}),U?.taggedUserContacts&&{taggedUserContacts:U?.taggedUserContacts})}}),T=this.isCommentsDataChanged(p[M],M);let F=new VT;Object.assign(F,t),c?.length>0&&c.forEach(U=>{U in t||delete F[U]}),F.comments=t.comments?.map(U=>this.stripCommentsFromAnnotationData({comment:U}))||[],_=F}let R=_?.comments?.find(M=>M.commentId===o);R?.isDraft&&(u=_?.comments?.length&&_?.comments?.length>0?nn.COMMENT_ADD:nn.COMMENT_ANNOTATION_ADD);let b=!!i&&!!this.notificationActionTypeMap?.[i],G=!!d&&!!_&&!b&&!R?.isDraft&&g.includes(d);return G&&(u=d),{strippedData:T&&(i&&this.notificationActionTypeMap?.[i]||R?.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(al(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:Ui.DOCUMENT,source:Jn.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:Ui.CONTEXT,source:Jn.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let u=Z();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Jn.SET_NOTIFICATIONS,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let d=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:u,methodName:Jn.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=QT(this.authService.getFirebaseConfig()?.firebaseOptions),u=Cr(this.functions,yr({url:this.endpointsService.getSetEncryptedDataUrl(l),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(R=>R?.commentId===_);T&&(o.targetAnnotationData=T)}try{let T=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??ye.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=oc.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:this.endpointsService.getNotificationsDbUrl(),feature:"comment",eventType:s??"PATCH",sdkVersion:Hr(),deniedForYouUsers:f,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},p=yield cl(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)(C(ge),C(zt),C(Nr),C(fr),C(Zn),C(Ko),C(Xh),C(vt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var tS=(()=>{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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.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:dr.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(([F,U])=>{let S=this.activityById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:dr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:dr.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||Z();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:dr.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:dr.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:dr.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||Z();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:dr.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var nS=(()=>{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,this.endpointsService=J(Fo)}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=QT(this.authService.getFirebaseConfig()?.firebaseOptions),c=Cr(this.functions,yr({url:this.endpointsService.getSetEncryptedDataUrl(a),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=oc.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:Hr()},f=yield cl(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?!Bi(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={},o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(t&&t.annotationId){let s=t.annotationId;if(i[s]=x({annotationId:s,metadata:Nn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),o?.length>0)for(let c of o)t?.[c]!==void 0&&(i[s][c]=t[c],delete t[c]);if(!this.isReactionDataChanged(i[s],s))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);if(i){i.icon&&(t.icon=i.icon);let o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(o?.length>0)for(let s of o)i?.[s]!==void 0&&(t[s]=i[s])}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(C(ge),C(zt),C(Nr),C(fr),C(Zn),C(Yo))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var rS=(()=>{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,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=Nn(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?Nn(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?Nn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ui)?.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 Dg.RECORDING_ADD:return`${i} added a recording`;case Dg.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 Cg.REACTION_ADD:return`${i} added a reaction`;case Cg.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??ye.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(ui)?.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(ui)?.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(ui)?.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===ye.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 ye.NEWLY_ADDED:return xe.ANNOTATION_ADD;case ye.ADDED:return xe.COMMENT_ADD;case ye.UPDATED:return xe.COMMENT_UPDATE;case ye.DELETED:return xe.COMMENT_DELETE;case ye.STATUS_CHANGED:return xe.STATUS_CHANGE;case ye.PRIORITY_CHANGED:return xe.PRIORITY_CHANGE;case ye.ASSIGNED:return xe.ASSIGN;case ye.ACCESS_MODE_CHANGED:return xe.ACCESS_MODE_CHANGE;case ye.CUSTOM_LIST_CHANGED:return xe.CUSTOM_LIST_CHANGE;case ye.APPROVED:return xe.APPROVE;case ye.ACCEPTED:return xe.ACCEPT;case ye.REJECTED:return xe.REJECT;case ye.SUGGESTION_ACCEPTED:return xe.SUGGESTION_ACCEPT;case ye.SUGGESTION_REJECTED:return xe.SUGGESTION_REJECT;case ye.REACTION_ADDED:return xe.REACTION_ADD;case ye.REACTION_DELETED:return xe.REACTION_DELETE;case ye.SUBSCRIBED:return xe.SUBSCRIBE;case ye.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 RT.ADDED:return Dg.RECORDING_ADD;case RT.DELETED:return Dg.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 Cg.REACTION_ADD;case"delete":return Cg.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 ye.NEWLY_ADDED:case ye.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case ye.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case ye.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case ye.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case ye.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case ye.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case ye.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case ye.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(ui)?.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)(C(ge),C(zt),C(eS),C(nS),C(Ko),C(Yo),C(ic),C(tS),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var iS=class{constructor({apiKey:e,documentId:n,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=ma(s)),a&&(this.organizationId=ys(a)),i&&(this.folderId=i,this.veltFolderId=bo(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 s3=(()=>{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=Z(),s=ol.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:Fn.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)(C(vt),C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var oS=(()=>{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 U=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.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||[])],R=[],b=[],G=[];for(let U of T)_[U]||(this.inFlightRequests.has(U)?(R.push(this.inFlightRequests.get(U)),b.push(U)):G.push(U));let M=le(x({},t),{notificationIds:G});I(this,null,function*(){try{if(R.length>0&&(yield Promise.allSettled(R)),G.length>0){let U=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:M}});let S,A=new Promise(w=>{S=w});for(let w of G)this.inFlightRequests.set(w,A.then(P=>P?.[w]));let N=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(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:w,request:M}}),this.loggingService.catch(w?.message??"Error in NotificationResolverService resolveNotifications:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield N)||{},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 w={};Object.entries(p).forEach(([P,k])=>{let O=this.notificationById$.value?.[P];O?O&&JSON.stringify(O)!==JSON.stringify(k)&&(w[P]=k):w[P]=k}),Object.keys(w).length>0&&this.notificationById$.next(x(x({},this.notificationById$.getValue()),w)),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:w,request:M}}),d(w)}catch(w){S({});for(let k of G)this.inFlightRequests.delete(k);let P=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:w,request:M}}),c||f(w),d(p)}}else u(),d({})}catch(U){u();let S=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:U,request:M}}),f(U)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||Z();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:kn.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||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:kn.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:kn.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:kn.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||Z();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kn.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var xp=class{constructor({apiKey:e,documentId:n,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=ma(i)),o&&(this.organizationId=ys(o)),s&&(this.folderId=s,this.veltFolderId=bo(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 c3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var l3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var u3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var d3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var h3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var f3=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,R,b,G,M,F,U){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=R,this.recorderAnnotationsResolverService=b,this.notificationResolverService=G,this.activityResolverService=M,this.serviceBook=F,this.attachmentResolverService=U}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 xp({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 xp({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 iS({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=Z(),a=Rd.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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=Z(),a=Dd.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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=Z(),a=Cd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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(NT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(OT)?.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(ki)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ki)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(wT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ui)?.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(bT)?.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=Z(),R=ol.GET_USERS;this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Fn.FORMAT_RESPONSE,source:"internal",moduleName:R,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:R}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:R})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(ki)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(R=>!this.notificationResolverService.getNotificationById(R)));break}default:_=[]}if(_?.length){let T=Z(),R=OC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:kn.FORMAT_RESPONSE,moduleName:R,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:R}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:R})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let R=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let R=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),R=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}default:_=[]}if(_?.length){let T=Z(),R=Rd.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.FORMAT_RESPONSE,moduleName:R,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:R}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:R})}}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 R=[];for(let b of _)b?.id&&!this.activityResolverService.getActivityById(b.id)&&R.push(b.id);if(R.length){let b=Z(),G=wC.GET_ACTIVITIES;this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.FORMAT_RESPONSE,moduleName:G,source:"internal",payload:{activityIds:R,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.activityResolverService.resolveActivities({request:{activityIds:R,organizationId:T},uniqueId:b,moduleName:G})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let R=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(R=R.filter(b=>!this.reactionAnnotationsResolverService.getAnnotationById(b)),R.length){let b=Z(),G=Dd.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:G,source:"internal",payload:{reactionAnnotationIds:R,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let R=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(R=R.filter(b=>!this.recorderAnnotationsResolverService.getAnnotationById(b)),R.length){let b=Z(),G=Cd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:G,source:"internal",payload:{recorderAnnotationIds:R,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:R,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(ki);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(ki);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}}),st(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(ui);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(ki);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(NT);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(OT);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(ki);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(ki);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(wT);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(ui);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(bT);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}}),st(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}}),st(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}}),st(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}}),st(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}}),st(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(ui)?.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 HV(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return WV(i);case"recorder":return zV(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(OT);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(NT);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(ui)?.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(bT)?.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(wT);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)(C(rS),C(c3),C(eS),C(l3),C(vt),C(s3),C(ge),C(u3),C(nS),C(d3),C(h3),C(zt),C(Jh),C(Ko),C(Yo),C(ic),C(oS),C(tS),C(di),C(Xh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var kse={comment:{mode:"persistent",scope:"doc"},notification:{mode:"persistent",scope:"user"},notificationIndex:{mode:"persistent",scope:"user"},presence:{mode:"ephemeral",scope:"doc"},liveState:{mode:"ephemeral",scope:"doc"},cursor:{mode:"ephemeral",scope:"doc"},huddle:{mode:"ephemeral",scope:"doc"},syncVideoPlayer:{mode:"ephemeral",scope:"doc"},heartbeat:{mode:"ephemeral",scope:"org"},flockSession:{mode:"ephemeral",scope:"doc"},selection:{mode:"ephemeral",scope:"doc"}};function g3(r){return kse[r]}var it={getDatabase:eh,ref:th,query:Gj,get:bm,set:Hj,update:Wj,remove:$j,push:Bj,runTransaction:jj,onValue:Aw,onChildAdded:Fj,onChildChanged:kj,onChildRemoved:Uj,off:xj,objectVal:Mj,listVal:Lj,stateChanges:Pj,onDisconnect:Vj},m3=(()=>{let e=class e{constructor(t,i){this.databaseService=t,this.loggingService=i}getServerTimeOffset(){return I(this,null,function*(){try{let t=this.databaseService.getDbValue();if(!t)return 0;let o=(yield bm(th(t,e.SERVER_TIME_OFFSET_PATH)))?.val();return typeof o=="number"?o:0}catch(t){return this.loggingService.catch("Error in FirebaseRealtimeAdapter getServerTimeOffset: ",t),0}})}onServerTimeOffset(t){let i=null,o=null;try{o=this.databaseService.getDb().subscribe(s=>{if(s){let a=th(s,e.SERVER_TIME_OFFSET_PATH);i=Aw(a,c=>{try{t(c?.val())}catch(l){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset callback: ",l)}})}})}catch(s){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset: ",s)}return()=>{try{i&&(i(),i=null),o?.unsubscribe(),o=null}catch(s){this.loggingService.catch("Error tearing down FirebaseRealtimeAdapter onServerTimeOffset: ",s)}}}getChannelTag(t){return g3(t)}getDatabaseInstance(t){return t?it.getDatabase(void 0,t):it.getDatabase()}rtdbRef(t,i){return it.ref(t,i)}rtdbQueryRef(t,...i){return it.query(t,...i)}rtdbGet(t){return it.get(t)}rtdbSet(t,i,o){return this.getChannelTag(t),it.set(i,o)}rtdbUpdate(t,i,o){return this.getChannelTag(t),it.update(i,o)}rtdbRemove(t,i){return this.getChannelTag(t),it.remove(i)}rtdbPush(t,i,o){return this.getChannelTag(t),o===void 0?it.push(i):it.push(i,o)}rtdbRunTransaction(t,i,o){return this.getChannelTag(t),it.runTransaction(i,o)}rtdbOnValue(t,i,o,s,a){return this.getChannelTag(t),typeof s=="function"?a?it.onValue(i,o,s,a):it.onValue(i,o,s):s?it.onValue(i,o,s):it.onValue(i,o)}rtdbOnChildAdded(t,i,o,s){return this.getChannelTag(t),s?it.onChildAdded(i,o,s):it.onChildAdded(i,o)}rtdbOnChildChanged(t,i,o,s){return this.getChannelTag(t),s?it.onChildChanged(i,o,s):it.onChildChanged(i,o)}rtdbOnChildRemoved(t,i,o,s){return this.getChannelTag(t),s?it.onChildRemoved(i,o,s):it.onChildRemoved(i,o)}rtdbOff(t,i,o){it.off(t,i,o)}rtdbObjectVal$(t,i){return this.getChannelTag(t),it.objectVal(i)}rtdbListVal$(t,i){return this.getChannelTag(t),it.listVal(i)}rtdbStateChanges$(t,i){return this.getChannelTag(t),it.stateChanges(i)}rtdbOnDisconnectSet(t,i,o){return this.getChannelTag(t),it.onDisconnect(i).set(o)}rtdbOnDisconnectUpdate(t,i,o){return this.getChannelTag(t),it.onDisconnect(i).update(o)}rtdbOnDisconnectRemove(t,i){return this.getChannelTag(t),it.onDisconnect(i).remove()}rtdbOnDisconnectCancel(t,i){return this.getChannelTag(t),it.onDisconnect(i).cancel()}subscribe(t,i,o,s){return{unsubscribe:()=>{}}}publish(t,i,o){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.publish wiring deferred to Phase A"}})}presence(t,i){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.presence wiring deferred to Phase A"}})}onDisconnect(t,i){return I(this,null,function*(){return()=>{}})}};e.SERVER_TIME_OFFSET_PATH=".info/serverTimeOffset",e.\u0275fac=function(i){return new(i||e)(C(rc),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var sS=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{ti([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")||En?.firebaseLogLevel||"silent";JL(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=oc.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=PM({tabManager:xM()}));try{this.firestore$.next(zy(Rr(),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(Yh(l))}}else if(c)try{let d=Rr(),f=zy(d,{localCache:PM({tabManager:xM()})},l);this.firestore$.next(f)}catch{this.firestore$.next(Yh(l))}else this.firestore$.next(Yh(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||Yh("DocumentIdDb");if(t){let i=Qy(t,"generateDocumentId");return Lp(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(C(Zn),C(Nr),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Zr={doc:Lp,collection:Qy,collectionGroup:Kz,query:Zz,getDoc:FM,getDocs:Xz,getCountFromServer:Qz,setDoc:t3,deleteDoc:Yz,onSnapshot:Jz,runTransaction:e3},E3=(()=>{let e=class e{constructor(t,i,o){this.firestoreService=t,this.databaseService=i,this.loggingService=o}read(t){return I(this,null,function*(){if((t.store??"firestore")==="rtdb"){let a=this.databaseService.getDbValue();return a?{data:(yield bm(th(a,t.location)))?.val()}:{data:void 0}}let o=this.firestoreService.getFirestoreValue();return o?{data:(yield FM(Lp(o,t.location)))?.data()}:{data:void 0}})}runTransaction(t){return I(this,null,function*(){return t()})}firestoreDoc(t,i){return Zr.doc(t,i)}firestoreCollection(t,i){return Zr.collection(t,i)}firestoreCollectionGroup(t,i){return Zr.collectionGroup(t,i)}firestoreQuery(t,...i){return Zr.query(t,...i)}firestoreGetDoc(t){return Zr.getDoc(t)}firestoreGetDocs(t){return Zr.getDocs(t)}firestoreGetCountFromServer(t){return Zr.getCountFromServer(t)}firestoreSetDoc(t,i,o){return o?Zr.setDoc(t,i,o):Zr.setDoc(t,i)}firestoreDeleteDoc(t){return Zr.deleteDoc(t)}firestoreOnSnapshot(t,i,o){return o?Zr.onSnapshot(t,i,o):Zr.onSnapshot(t,i)}firestoreRunTransaction(t,i){return Zr.runTransaction(t,i)}addComment(t){return this.deferred("addComment")}editComment(t){return this.deferred("editComment")}deleteComment(t){return this.deferred("deleteComment")}setCommentResolved(t){return this.deferred("setCommentResolved")}setCommentMetadata(t){return this.deferred("setCommentMetadata")}bumpCommentViews(t){return this.deferred("bumpCommentViews")}markCommentThreadRead(t){return this.deferred("markCommentThreadRead")}markNotificationRead(t){return this.deferred("markNotificationRead")}addNotification(t){return this.deferred("addNotification")}deleteNotification(t){return this.deferred("deleteNotification")}updateNotification(t){return this.deferred("updateNotification")}updatePresence(t){return this.deferred("updatePresence")}grantAccess(t){return this.deferred("grantAccess")}revokeAccess(t){return this.deferred("revokeAccess")}getAccess(t){return this.deferred("getAccess")}upsertOrgUserProfile(t){return this.deferred("upsertOrgUserProfile")}upsertDocMetadata(t){return this.deferred("upsertDocMetadata")}upsertOrgMetadata(t){return this.deferred("upsertOrgMetadata")}createActivity(t){return this.deferred("createActivity")}deferred(t){return this.loggingService.warn(`[WB] FirebaseDbAdapter.${t} called but write-op wiring is deferred to Phase A (self-hosting Step 0). The SDK uses its existing direct write path in Step 0.`),Promise.resolve({ok:!1,code:"unimplemented",message:`FirebaseDbAdapter.${t} wiring deferred to Phase A`})}};e.\u0275fac=function(i){return new(i||e)(C(sS),C(rc),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var _3=(()=>{let e=class e{allow(){return Promise.resolve({allow:!0})}canRead(t){return I(this,null,function*(){return this.allow()})}canWrite(t){return I(this,null,function*(){return this.allow()})}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var zUe=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,R,b,G,M){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=R,this.realtimeAdapter=b,this.dbAdapter=G,this.authzAdapter=M,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.serverTimeOffsetUnsub=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(xT).subscribe(F=>{this.activityService=F??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(F=>{F&&(this.db=F)})),this.serverTimeOffsetUnsub=this.realtimeAdapter.onServerTimeOffset(F=>{this.offset=F}),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(F=>{F&&(this.firestore=F)}))}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.serverTimeOffsetUnsub&&(this.serverTimeOffsetUnsub(),this.serverTimeOffsetUnsub=null),this.unsubscribeFromObservables()}setupOnDisconnect(t,i,o){return I(this,null,function*(){try{if(this.db){let s=this.realtimeAdapter.rtdbRef(this.db,t);return this.realtimeAdapter.rtdbOnDisconnectUpdate(o??"commondb",s,i)}return Promise.resolve()}catch(s){return this.loggingService.catch("Error in setupOnDisconnect:",s),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){ti([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ct(([i,o])=>!!i),Nt(1),Js(([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=this.realtimeAdapter.rtdbRef(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=this.dbAdapter.firestoreDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield this.realtimeAdapter.rtdbSet(t,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=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,R=>I(this,null,function*(){R.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,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 this.realtimeAdapter.rtdbUpdate(t,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=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,R=>I(this,null,function*(){R.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRemove(t,l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:kn.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else yield this.dbAdapter.firestoreDeleteDoc(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=Z()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),Z()||"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=this.dbAdapter.firestoreCollection(this.firestore,o);i?.useCollectionGroup&&(s=this.dbAdapter.firestoreCollectionGroup(this.firestore,o));let a=i?.firestoreQuery??[],c=this.dbAdapter.firestoreQuery(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield this.dbAdapter.firestoreGetCountFromServer(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 this.dbAdapter.firestoreGetDocs(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=this.realtimeAdapter.rtdbRef(this.db,o),a=i?.rtdbQuery??[],c=this.realtimeAdapter.rtdbQueryRef(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield this.realtimeAdapter.rtdbGet(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),[]}})}buildAuthzRequest(t,i){return{feature:t,scope:"doc",resourceId:i?.id!=null?String(i.id):void 0,apiKey:i?.apiKey??this.configService.getApiKey()??void 0,organizationId:i?.organizationId!=null?String(i.organizationId):void 0,documentId:i?.documentId!=null?String(i.documentId):void 0}}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),{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"firestore",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"rtdb",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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 ti([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)),pt(([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 me(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 me(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({})}}),Cc(()=>{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 me(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(pt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),pt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):ue(c)),pt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):ue(c)),pt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):ue(c)),st(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=this.dbAdapter.firestoreCollection(t,i);if(a?.useCollectionGroup&&(l=this.dbAdapter.firestoreCollectionGroup(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=this.dbAdapter.firestoreQuery(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")),this.dbAdapter.firestoreOnSnapshot(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=this.dbAdapter.firestoreDoc(t,i);return this.dbAdapter.firestoreOnSnapshot(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=this.realtimeAdapter.rtdbRef(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=this.realtimeAdapter.rtdbQueryRef(a,...c)}return this.objectValFromChildEvents(a,t).pipe(rs(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))),pt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),pt(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=this.realtimeAdapter.rtdbPush(t,a.dbRef);yield this.realtimeAdapter.rtdbSet(t,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 me(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=this.realtimeAdapter.rtdbRef(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)}};this.realtimeAdapter.rtdbOnChildAdded(t,g,_,T);let R=this.realtimeAdapter.rtdbOnValue(t,g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{R&&typeof R=="function"&&R(),this.realtimeAdapter.rtdbOff(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 me(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(!Bi(T,c)){let R=JSON.parse(JSON.stringify(T));c=R,o.next(R)}}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 R=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=R,o.next(R),a=!0}}catch{}};this.realtimeAdapter.rtdbOnChildAdded(i,t,d,l),this.realtimeAdapter.rtdbOnChildChanged(i,t,f,l),this.realtimeAdapter.rtdbOnChildRemoved(i,t,g,l);let _=this.realtimeAdapter.rtdbOnValue(i,t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),this.realtimeAdapter.rtdbOff(t,"child_added",d),this.realtimeAdapter.rtdbOff(t,"child_changed",f),this.realtimeAdapter.rtdbOff(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(C(rS),C(Nr),C(f3),C(vt),C(ge),C(sS),C(rc),C(Zn),C(Jh),C(zt),C(Ko),C(Yo),C(ic),C(oS),C(di),C(m3),C(E3),C(_3))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{x as a,le as b,_S as c,Gse as d,$se as e,jse as f,I as g,mt as h,me as i,MS as j,Ot as k,Y as l,Nc as m,C6 as n,N6 as o,Ac as p,Fr as q,ue as r,O6 as s,w6 as t,g6 as u,fe as v,ti as w,KS as x,b6 as y,go as z,U6 as A,Oi as B,c6 as C,Bu as D,Ct as E,J3 as F,rs as G,OS as H,wu as I,Nt as J,LS as K,st as L,bu as M,_E as N,xS as O,l6 as P,FS as Q,u6 as R,Lu as S,pt as T,Xs as U,d6 as V,Js as W,h6 as X,p6 as Y,oe as Z,BE as _,K as $,ss as aa,ee as ba,C as ca,J as da,_r as ea,Kn as fa,mo as ga,N0 as ha,O0 as ia,B0 as ja,G0 as ka,ut as la,Dn as ma,lr as na,kr as oa,vo as pa,qc as qa,ni as ra,p4 as sa,pn as ta,zR as ua,x4 as va,ua as wa,v_ as xa,k_ as ya,j4 as za,yq as Aa,Sq as Ba,Aq as Ca,Rq as Da,Dq as Ea,jq as Fa,us as Ga,Me as Ha,Xq as Ia,B8 as Ja,G8 as Ka,Ao as La,tg as Ma,fs as Na,Q_ as Oa,ht as Pa,X8 as Qa,Co as Ra,Jc as Sa,Ek as Ta,U5 as Ua,da as Va,No as Wa,rg as Xa,Sk as Ya,K5 as Za,Dk as _a,Ck as $a,Z_ as ab,ha as bb,Mk as cb,Pk as db,t9 as eb,r9 as fb,i9 as gb,o9 as hb,s9 as ib,a9 as jb,c9 as kb,xk as lb,bD as mb,LD as nb,Fk as ob,MD as pb,PD as qb,kk as rb,xD as sb,FD as tb,Vk as ub,g9 as vb,Bk as wb,$k as xb,jk as yb,T9 as zb,v9 as Ab,y9 as Bb,A9 as Cb,R9 as Db,D9 as Eb,C9 as Fb,N9 as Gb,O9 as Hb,w9 as Ib,Yk as Jb,Qk as Kb,j9 as Lb,W9 as Mb,tK as Nb,oU as Ob,kD as Pb,sU as Qb,aU as Rb,cU as Sb,oK as Tb,lU as Ub,dU as Vb,sK as Wb,aK as Xb,cK as Yb,lK as Zb,gK as _b,mK as $b,pK as ac,EK as bc,_K as cc,TK as dc,IK as ec,vK as fc,yK as gc,SK as hc,AK as ic,RK as jc,CK as kc,OK as lc,wK as mc,bK as nc,LK as oc,MK as pc,FK as qc,lg as rc,ug as sc,$D as tc,_ye as uc,Tye as vc,Iye as wc,hY as xc,eC as yc,vye as zc,yye as Ac,Sye as Bc,Oo as Cc,$U as Dc,bY as Ec,o1 as Fc,LY as Gc,aC as Hc,MY as Ic,PY as Jc,xY as Kc,FY as Lc,UY as Mc,BY as Nc,$Y as Oc,cC as Pc,EC as Qc,o7 as Rc,c7 as Sc,C1 as Tc,L7 as Uc,M7 as Vc,SC as Wc,V1 as Xc,CC as Yc,Pd as Zc,Wr as _c,pa as $c,nI as ad,ul as bd,Sr as cd,Ge as dd,Tn as ed,hr as fd,xo as gd,Ar as hd,Ia as id,Rr as jd,Qe as kd,wX as ld,Qbe as md,Xbe as nd,Jbe as od,ji as pd,va as qd,As as rd,Hi as sd,Ee as td,Wi as ud,Rs as vd,pLe as wd,ELe as xd,_Le as yd,Sa as zd,ZJ as Ad,tZ as Bd,gZ as Cd,pl as Dd,El as Ed,ePe as Fd,tPe as Gd,V0e as Hd,Lre as Id,B0e as Jd,Mre as Kd,Pre as Ld,xre as Md,fr as Nd,TPe as Od,IPe as Pd,vPe as Qd,$1 as Rd,J7 as Sd,Ng as Td,En as Ud,H as Vd,ye as Wd,nn as Xd,GAe as Yd,$Ae as Zd,jAe as _d,HAe as $d,$ as ae,WAe as be,zAe as ce,qAe as de,KAe as ee,F7 as fe,k7 as ge,U7 as he,V7 as ie,RT as je,B7 as ke,YAe as le,G7 as me,AC as ne,$7 as oe,jr as pe,DT as qe,j7 as re,vd as se,xt as te,H7 as ue,CT as ve,W7 as we,z7 as xe,q7 as ye,QAe as ze,XAe as Ae,JAe as Be,K7 as Ce,v as De,F1 as Ee,wRe as Fe,Ad as Ge,PRe as He,xRe as Ie,hi as Je,wt as Ke,j1 as Le,H1 as Me,uDe as Ne,dDe as Oe,VT as Pe,NC as Qe,BT as Re,Fn as Se,ol as Te,wo as Ue,q1 as Ve,K1 as We,Y1 as Xe,Is as Ye,FDe as Ze,Jn as _e,Ui as $e,Q1 as af,X1 as bf,J1 as cf,Z1 as df,eV as ef,tV as ff,nV as gf,rV as hf,iV as if,oV as jf,sV as kf,_Ce as lf,TCe as mf,aV as nf,bC as of,cV as pf,lV as qf,dV as rf,JCe as sf,vs as tf,Z7 as uf,eQ as vf,ewe as wf,CV as xf,NV as yf,dwe as zf,vr as Af,Vi as Bf,ma as Cf,ys as Df,bo as Ef,hwe as Ff,fwe as Gf,gwe as Hf,mwe as If,pwe as Jf,Ewe as Kf,_we as Lf,wV as Mf,Z as Nf,Twe as Of,bV as Pf,Od as Qf,vV as Rf,yV as Sf,nQ as Tf,rQ as Uf,cl as Vf,xC as Wf,Iwe as Xf,Lo as Yf,vwe as Zf,Lg as _f,Bi as $f,ywe as ag,FC as bg,al as cg,sQ as dg,qT as eg,Swe as fg,Awe as gg,MV as hg,Mg as ig,aQ as jg,cQ as kg,lQ as lg,uQ as mg,dQ as ng,Hr as og,Rwe as pg,MC as qg,Dwe as rg,fQ as sg,Cwe as tg,Nwe as ug,xV as vg,Owe as wg,wwe as xg,bwe as yg,Lwe as zg,Mwe as Ag,Pwe as Bg,xwe as Cg,zT as Dg,Fwe as Eg,kwe as Fg,Uwe as Gg,Vwe as Hg,Bwe as Ig,Gwe as Jg,$we as Kg,jwe as Lg,Hwe as Mg,Wwe as Ng,zwe as Og,qwe as Pg,Kwe as Qg,Ywe as Rg,Qwe as Sg,Xwe as Tg,Jwe as Ug,Zwe as Vg,ebe as Wg,tbe as Xg,nbe as Yg,rbe as Zg,ibe as _g,obe as $g,sbe as ah,EQ as bh,abe as ch,cbe as dh,lbe as eh,AV as fh,ube as gh,dbe as hh,Ft as ih,Nn as jh,hbe as kh,kt as lh,Ht as mh,fbe as nh,GV as oh,wd as ph,UC as qh,yr as rh,gbe as sh,RV as th,L as uh,Cr as vh,NT as wh,rRe as xh,iRe as yh,ki as zh,oRe as Ah,OT as Bh,sRe as Ch,aRe as Dh,wT as Eh,cRe as Fh,bT as Gh,lRe as Hh,LT as Ih,uRe as Jh,ui as Kh,dRe as Lh,yd as Mh,hRe as Nh,fRe as Oh,gRe as Ph,mRe as Qh,pRe as Rh,ERe as Sh,_Re as Th,MT as Uh,TRe as Vh,IRe as Wh,PT as Xh,xT as Yh,L1 as Zh,M1 as _h,P1 as $h,di as ai,bt as bi,ge as ci,Zn as di,Fee as ei,PPe as fi,Fo as gi,qj as hi,vt as ii,vv as ji,yv as ki,Nr as li,Yy as mi,Dse as ni,Cse as oi,Nse as pi,Ose as qi,Ii as ri,rc as si,Ko as ti,Yo as ui,Xh as vi,ic as wi,Jh as xi,zt as yi,eS as zi,tS as Ai,rS as Bi,iS as Ci,s3 as Di,oS as Ei,f3 as Fi,m3 as Gi,zUe as Hi};
167
+ `+r.stack),e}function NH(r){return(function(n,t){if(typeof n!="object"||n===null)return!1;let i=n;for(let o of t)if(o in i&&typeof i[o]=="function")return!0;return!1})(r,["next","error","complete"])}var eo=class extends ou{constructor(e,n,t,i){super(e,n,t,i),this.type="firestore",this._queue=new Oy,this._persistenceKey=i?.name||"[DEFAULT]"}_terminate(){return I(this,null,function*(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new Oy(e),this._firestoreClient=void 0,yield e}})}};function zy(r,e,n){n||(n=ip);let t=xo(r,"firestore");if(t.isInitialized(n)){let i=t.getImmediate({identifier:n}),o=t.getOptions(n);if($i(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<WW)throw new Q(j.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&Wr(e.host)&&pa(e.host),t.initialize({options:e,instanceIdentifier:n})}function Yh(r,e){let n=typeof r=="object"?r:Rr(),t=typeof r=="string"?r:e||ip,i=xo(n,"firestore").getImmediate({identifier:t});if(!i._initialized){let o=Pd("firestore");o&&Ez(i,...o)}return i}function Qh(r){if(r._terminated)throw new Q(j.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||pse(r),r._firestoreClient}function pse(r){var e,n,t;let i=r._freezeSettings(),o=(function(a,c,l,u){return new sb(a,c,l,u.host,u.ssl,u.experimentalForceLongPolling,u.experimentalAutoDetectLongPolling,mz(u.experimentalLongPollingOptions),u.useFetchStreams,u.isUsingEmulator)})(r._databaseId,((e=r._app)===null||e===void 0?void 0:e.options.appId)||"",r._persistenceKey,i);r._componentsProvider||!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((t=i.localCache)===null||t===void 0)&&t._onlineComponentProvider)&&(r._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),r._firestoreClient=new xL(r._authCredentials,r._appCheckCredentials,r._queue,o,r._componentsProvider&&(function(a){let c=a?._online.build();return{_offline:a?._offline.build(c),_online:c}})(r._componentsProvider))}var FL=class{constructor(e="count",n){this._internalFieldPath=n,this.type="AggregateField",this.aggregateType=e}},kL=class{constructor(e,n,t){this._userDataWriter=n,this._data=t,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}};var Ms=class r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new r(un.fromBase64String(e))}catch(n){throw new Q(j.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new r(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:r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ap(e,r._jsonSchema))return r.fromBase64String(e.bytes)}};Ms._jsonSchemaVersion="firestore/bytes/1.0",Ms._jsonSchema={type:ln("string",Ms._jsonSchemaVersion),bytes:ln("string")};var $h=class{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new Q(j.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new In(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};var vp=class{constructor(e){this._methodName=e}};var $a=class r{constructor(e,n){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(n)||n<-180||n>180)throw new Q(j.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return De(this._lat,e._lat)||De(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:r._jsonSchemaVersion}}static fromJSON(e){if(Ap(e,r._jsonSchema))return new r(e.latitude,e.longitude)}};$a._jsonSchemaVersion="firestore/geoPoint/1.0",$a._jsonSchema={type:ln("string",$a._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};var ja=class r{constructor(e){this._values=(e||[]).map(n=>n)}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:r._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ap(e,r._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(n=>typeof n=="number"))return new r(e.vectorValues);throw new Q(j.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};ja._jsonSchemaVersion="firestore/vectorValue/1.0",ja._jsonSchema={type:ln("string",ja._jsonSchemaVersion),vectorValues:ln("object")};var Ese=/^__.*__$/,UL=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return this.fieldMask!==null?new Ji(e,this.data,this.fieldMask,n,this.fieldTransforms):new Qa(e,this.data,n,this.fieldTransforms)}},wy=class{constructor(e,n,t){this.data=e,this.fieldMask=n,this.fieldTransforms=t}toMutation(e,n){return new Ji(e,this.data,this.fieldMask,n,this.fieldTransforms)}};function vz(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ae(40011,{Ec:r})}}var VL=class r{constructor(e,n,t,i,o,s){this.settings=e,this.databaseId=n,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 r(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Rc({path:t,mc:!1});return i.fc(e),i}gc(e){var n;let t=(n=this.path)===null||n===void 0?void 0:n.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 Ly(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.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(vz(this.Ec)&&Ese.test(e))throw this.wc('Document fields cannot begin and end with "__"')}},BL=class{constructor(e,n,t){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=t||$y(e)}Dc(e,n,t,i=!1){return new VL({Ec:e,methodName:n,bc:t,path:In.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function qy(r){let e=r._freezeSettings(),n=$y(r._databaseId);return new BL(r._databaseId,!!e.ignoreUndefinedProperties,n)}function yz(r,e,n,t,i,o={}){let s=r.Dc(o.merge||o.mergeFields?2:0,e,n,i);LM("Data must be an object, but it was:",s,t);let a=Az(t,s),c,l;if(o.merge)c=new Qr(s.fieldMask),l=s.fieldTransforms;else if(o.mergeFields){let u=[];for(let d of o.mergeFields){let f=GL(e,d,n);if(!s.contains(f))throw new Q(j.INVALID_ARGUMENT,`Field '${f}' is specified in your field mask but missing from your input data.`);Dz(u,f)||u.push(f)}c=new Qr(u),l=s.fieldTransforms.filter(d=>c.covers(d.field))}else c=null,l=s.fieldTransforms;return new UL(new rr(a),c,l)}var by=class r extends vp{_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 r}};function _se(r,e,n,t){let i=r.Dc(1,e,n);LM("Data must be an object, but it was:",i,t);let o=[],s=rr.empty();tc(t,(c,l)=>{let u=MM(e,c,n);l=Ge(l);let d=i.gc(u);if(l instanceof by)o.push(u);else{let f=bp(l,d);f!=null&&(o.push(u),s.set(u,f))}});let a=new Qr(o);return new wy(s,a,i.fieldTransforms)}function Tse(r,e,n,t,i,o){let s=r.Dc(1,e,n),a=[GL(e,t,n)],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(GL(e,o[f])),c.push(o[f+1]);let l=[],u=rr.empty();for(let f=a.length-1;f>=0;--f)if(!Dz(l,a[f])){let g=a[f],p=c[f];p=Ge(p);let _=s.gc(g);if(p instanceof by)l.push(g);else{let T=bp(p,_);T!=null&&(l.push(g),u.set(g,T))}}let d=new Qr(l);return new wy(u,d,s.fieldTransforms)}function Sz(r,e,n,t=!1){return bp(n,r.Dc(t?4:3,e))}function bp(r,e){if(Rz(r=Ge(r)))return LM("Unsupported field value:",e,r),Az(r,e);if(r instanceof vp)return(function(t,i){if(!vz(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)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r 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=bp(a,i.yc(s));c==null&&(c={nullValue:"NULL_VALUE"}),o.push(c),s++}return{arrayValue:{values:o}}})(r,e)}return(function(t,i){if((t=Ge(t))===null)return{nullValue:"NULL_VALUE"};if(typeof t=="number")return ioe(i.serializer,t);if(typeof t=="boolean")return{booleanValue:t};if(typeof t=="string")return{stringValue:t};if(t instanceof Date){let o=Mt.fromDate(t);return{timestampValue:xh(i.serializer,o)}}if(t instanceof Mt){let o=new Mt(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:xh(i.serializer,o)}}if(t instanceof $a)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Ms)return{bytesValue:CW(i.serializer,t._byteString)};if(t instanceof yn){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:fM(t.firestore._databaseId||i.databaseId,t._key.path)}}if(t instanceof ja)return(function(s,a){return{mapValue:{fields:{[aM]:{stringValue:cM},[wh]:{arrayValue:{values:s.toArray().map(l=>{if(typeof l!="number")throw a.wc("VectorValues must only contain numeric values.");return hM(a.serializer,l)})}}}}}})(t,i);throw i.wc(`Unsupported field value: ${Py(t)}`)})(r,e)}function Az(r,e){let n={};return QH(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):tc(r,(t,i)=>{let o=bp(i,e.Vc(t));o!=null&&(n[t]=o)}),{mapValue:{fields:n}}}function Rz(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof Mt||r instanceof $a||r instanceof Ms||r instanceof yn||r instanceof vp||r instanceof ja)}function LM(r,e,n){if(!Rz(n)||!PH(n)){let t=Py(n);throw t==="an object"?e.wc(r+" a custom object"):e.wc(r+" "+t)}}function GL(r,e,n){if((e=Ge(e))instanceof $h)return e._internalPath;if(typeof e=="string")return MM(r,e);throw Ly("Field path arguments must be of type string or ",r,!1,void 0,n)}var Ise=new RegExp("[~\\*/\\[\\]]");function MM(r,e,n){if(e.search(Ise)>=0)throw Ly(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,n);try{return new $h(...e.split("."))._internalPath}catch{throw Ly(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,n)}}function Ly(r,e,n,t,i){let o=t&&!t.isEmpty(),s=i!==void 0,a=`Function ${e}() called with invalid data`;n&&(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+r+c)}function Dz(r,e){return r.some(n=>n.isEqual(e))}var su=class{constructor(e,n,t,i,o){this._firestore=e,this._userDataWriter=n,this._key=t,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new yn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new $L(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 n=this._document.data.field(Ky("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}},$L=class extends su{data(){return super.data()}};function Ky(r,e){return typeof e=="string"?MM(r,e):e instanceof $h?e._internalPath:e._delegate._internalPath}function Cz(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new Q(j.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var yp=class{},jh=class extends yp{};function Nz(r,e,...n){let t=[];e instanceof yp&&t.push(e),t=t.concat(n),(function(o){let s=o.filter(c=>c instanceof Hh).length,a=o.filter(c=>c instanceof Sp).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)r=i._apply(r);return r}var Sp=class r extends jh{constructor(e,n,t){super(),this._field=e,this._op=n,this._value=t,this.type="where"}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=this._parse(e);return xz(e._query,n),new Zi(e.firestore,e.converter,Tb(e._query,n))}_parse(e){let n=qy(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"){wH(d,u);let p=[];for(let _ of d)p.push(OH(c,o,_));f={arrayValue:{values:p}}}else f=OH(c,o,d)}else u!=="in"&&u!=="not-in"&&u!=="array-contains-any"||wH(d,u),f=Sz(a,s,d,u==="in"||u==="not-in");return $e.create(l,u,f)})(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}};function Oz(r,e,n){let t=e,i=Ky("where",r);return Sp._create(i,t,n)}var Hh=class r extends yp{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new r(e,n)}_parse(e){let n=this._queryConstraints.map(t=>t._parse(e)).filter(t=>t.getFilters().length>0);return n.length===1?n[0]:rt.create(n,this._getOperator())}_apply(e){let n=this._parse(e);return n.getFilters().length===0?e:((function(i,o){let s=i,a=o.getFlattenedFilters();for(let c of a)xz(s,c),s=Tb(s,c)})(e._query,n),new Zi(e.firestore,e.converter,Tb(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};function wz(...r){return r.forEach(e=>Fz("or",e)),Hh._create("or",r)}function bz(...r){return r.forEach(e=>Fz("and",e)),Hh._create("and",r)}var jL=class r extends jh{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new r(e,n)}_apply(e){let n=(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 Xl(o,s)})(e._query,this._field,this._direction);return new Zi(e.firestore,e.converter,(function(i,o){let s=i.explicitOrderBy.concat([o]);return new qo(i.path,i.collectionGroup,s,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(e._query,n))}};function Lz(r,e="asc"){let n=e,t=Ky("orderBy",r);return jL._create(t,n)}var HL=class r extends jh{constructor(e,n,t){super(),this.type=e,this._limit=n,this._limitType=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){return new Zi(e.firestore,e.converter,Jv(e._query,this._limit,this._limitType))}};function Mz(r){return Iie("limit",r),HL._create("limit",r,"F")}var WL=class r extends jh{constructor(e,n,t){super(),this.type=e,this._docOrFields=n,this._inclusive=t}static _create(e,n,t){return new r(e,n,t)}_apply(e){let n=vse(e,this.type,this._docOrFields,this._inclusive);return new Zi(e.firestore,e.converter,(function(i,o){return new qo(i.path,i.collectionGroup,i.explicitOrderBy.slice(),i.filters.slice(),i.limit,i.limitType,o,i.endAt)})(e._query,n))}};function Pz(...r){return WL._create("startAfter",r,!1)}function vse(r,e,n,t){if(n[0]=Ge(n[0]),n[0]instanceof su)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 _h(o))if(d.field.isKeyField())u.push(Ql(s,c.key));else{let f=c.data.field(d.field);if(Uy(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 zo(u,l)})(r._query,r.firestore._databaseId,e,n[0]._document,t);{let i=qy(r.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(!uM(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 R=new ie(T);g.push(Ql(a,R))}else{let T=Sz(c,l,_);g.push(T)}}return new zo(g,d)})(r._query,r.firestore._databaseId,i,e,n,t)}}function OH(r,e,n){if(typeof(n=Ge(n))=="string"){if(n==="")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(!uM(e)&&n.indexOf("/")!==-1)throw new Q(j.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let t=e.path.child(We.fromString(n));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 Ql(r,new ie(t))}if(n instanceof yn)return Ql(r,n._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: ${Py(n)}.`)}function wH(r,e){if(!Array.isArray(r)||r.length===0)throw new Q(j.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function xz(r,e){let n=(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})(r.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(n!==null)throw n===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 '${n.toString()}' filters.`)}function Fz(r,e){if(!(e instanceof Sp||e instanceof Hh))throw new Q(j.INVALID_ARGUMENT,`Function ${r}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}var My=class{convertValue(e,n="none"){switch(za(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Lt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Fs(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw ae(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){let t={};return tc(e,(i,o)=>{t[i]=this.convertValue(o,n)}),t}convertVectorValue(e){var n,t,i;let o=(i=(t=(n=e.fields)===null||n===void 0?void 0:n[wh].arrayValue)===null||t===void 0?void 0:t.values)===null||i===void 0?void 0:i.map(s=>Lt(s.doubleValue));return new ja(o)}convertGeoPoint(e){return new $a(Lt(e.latitude),Lt(e.longitude))}convertArray(e,n){return(e.values||[]).map(t=>this.convertValue(t,n))}convertServerTimestamp(e,n){switch(n){case"previous":let t=Vy(e);return t==null?null:this.convertValue(t,n);case"estimate":return this.convertTimestamp(rp(e));default:return null}}convertTimestamp(e){let n=xs(e);return new Mt(n.seconds,n.nanos)}convertDocumentKey(e,n){let t=We.fromString(e);he(FW(t),9688,{name:e});let i=new Oh(t.get(1),t.get(3)),o=new ie(t.popFirst(5));return i.isEqual(n)||Qt(`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 (${n.projectId}/${n.database}) instead.`),o}};function kz(r,e,n){let t;return t=r?n&&(n.merge||n.mergeFields)?r.toFirestore(e,n):r.toFirestore(e):e,t}var zL=class extends My{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ms(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new yn(this.firestore,null,n)}};function yse(){return new FL("count")}var Ba=class{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Ha=class r extends su{constructor(e,n,t,i,o,s){super(e,n,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 n=new Ih(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){let t=this._document.data.field(Ky("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t,n.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,n={};return n.type=r._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}};Ha._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ha._jsonSchema={type:ln("string",Ha._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};var Ih=class extends Ha{data(e={}){return super.data(e)}},Yl=class r{constructor(e,n,t,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new Ba(i.hasPendingWrites,i.fromCache),this.query=t}get docs(){let e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(t=>{e.call(n,new Ih(this._firestore,this._userDataWriter,t.key,t,new Ba(this._snapshot.mutatedKeys.has(t.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let n=!!e.includeMetadataChanges;if(n&&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===n||(this._cachedChanges=(function(i,o){if(i._snapshot.oldDocs.isEmpty()){let s=0;return i._snapshot.docChanges.map(a=>{let c=new Ih(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Ba(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 Ih(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Ba(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:Sse(a.type),doc:c,oldIndex:l,newIndex:u}})}})(this,n),this._cachedChangesIncludeMetadataChanges=n),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=r._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Qm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],t=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(n.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 Sse(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ae(61501,{type:r})}}function Uz(r){r=br(r,yn);let e=br(r.firestore,eo);return fse(Qh(e),r._key).then(n=>Hz(e,r,n))}Yl._jsonSchemaVersion="firestore/querySnapshot/1.0",Yl._jsonSchema={type:ln("string",Yl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};var au=class extends My{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ms(e)}convertReference(e){let n=this.convertDocumentKey(e,this.firestore._databaseId);return new yn(this.firestore,null,n)}};function Vz(r){r=br(r,Zi);let e=br(r.firestore,eo),n=Qh(e),t=new au(e);return Cz(r._query),gse(n,r._query).then(i=>new Yl(e,t,r,i))}function Bz(r,e,n){r=br(r,yn);let t=br(r.firestore,eo),i=kz(r.converter,e,n);return jz(t,[yz(qy(t),"setDoc",r._key,i,r.converter!==null,n).toMutation(r._key,Gn.none())])}function Gz(r){return jz(br(r.firestore,eo),[new tu(r._key,Gn.none())])}function $z(r,...e){var n,t,i;r=Ge(r);let o={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||NH(e[s])||(o=e[s++]);let a={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(NH(e[s])){let d=e[s];e[s]=(n=d.next)===null||n===void 0?void 0:n.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(r instanceof yn)l=br(r.firestore,eo),u=Np(r._key.path),c={next:d=>{e[s]&&e[s](Hz(l,r,d))},error:e[s+1],complete:e[s+2]};else{let d=br(r,Zi);l=br(d.firestore,eo),u=d._query;let f=new au(l);c={next:g=>{e[s]&&e[s](new Yl(l,f,d,g))},error:e[s+1],complete:e[s+2]},Cz(r._query)}return(function(f,g,p,_){let T=new Ip(_),R=new Tp(g,T,p);return f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return vM(yield Cy(f),R)})),()=>{T.Ou(),f.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return yM(yield Cy(f),R)}))}})(Qh(l),u,a,c)}function jz(r,e){return(function(t,i){let o=new wr;return t.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){return Xoe(yield hse(t),i,o)})),o.promise})(Qh(r),e)}function Hz(r,e,n){let t=n.docs.get(e._key),i=new au(r);return new Ha(r,i,e._key,t,new Ba(n.hasPendingWrites,n.fromCache),e.converter)}function Wz(r){return zz(r,{count:yse()})}function zz(r,e){let n=br(r.firestore,eo),t=Qh(n),i=qie(e,(o,s)=>new Sb(s,o.aggregateType,o._internalFieldPath));return mse(t,r._query,i).then(o=>(function(a,c,l){let u=new au(a);return new kL(c,u,l)})(n,r,o))}var qL=class{constructor(e){let n;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),n=e.tabManager):(n=Ase(void 0),n._initialize(e)),this._onlineComponentProvider=n._onlineComponentProvider,this._offlineComponentProvider=n._offlineComponentProvider}toJSON(){return{kind:this.kind}}};function PM(r){return new qL(r)}var KL=class{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=wM.provider,this._offlineComponentProvider={build:n=>new Dy(n,e?.cacheSizeBytes,this.forceOwnership)}}},YL=class{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=wM.provider,this._offlineComponentProvider={build:n=>new LL(n,e?.cacheSizeBytes)}}};function Ase(r){return new KL(r?.forceOwnership)}function xM(){return new YL}var Rse={maxAttempts:5};function Gm(r,e){if((r=Ge(r)).firestore!==e)throw new Q(j.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}var QL=class{constructor(e,n){this._firestore=e,this._transaction=n,this._dataReader=qy(e)}get(e){let n=Gm(e,this._firestore),t=new zL(this._firestore);return this._transaction.lookup([n._key]).then(i=>{if(!i||i.length!==1)return ae(24041);let o=i[0];if(o.isFoundDocument())return new su(this._firestore,t,o.key,o,n.converter);if(o.isNoDocument())return new su(this._firestore,t,n._key,null,n.converter);throw ae(18433,{doc:o})})}set(e,n,t){let i=Gm(e,this._firestore),o=kz(i.converter,n,t),s=yz(this._dataReader,"Transaction.set",i._key,o,i.converter!==null,t);return this._transaction.set(i._key,s),this}update(e,n,t,...i){let o=Gm(e,this._firestore),s;return s=typeof(n=Ge(n))=="string"||n instanceof $h?Tse(this._dataReader,"Transaction.update",o._key,n,t,i):_se(this._dataReader,"Transaction.update",o._key,n),this._transaction.update(o._key,s),this}delete(e){let n=Gm(e,this._firestore);return this._transaction.delete(n._key),this}};var XL=class extends QL{constructor(e,n){super(e,n),this._firestore=e}get(e){let n=Gm(e,this._firestore),t=new au(this._firestore);return super.get(e).then(i=>new Ha(this._firestore,t,n._key,i._document,new Ba(!1,!1),n.converter))}};function qz(r,e,n){r=br(r,eo);let t=Object.assign(Object.assign({},Rse),n);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 wr;return o.asyncQueue.enqueueAndForget(()=>I(null,null,function*(){let l=yield gz(o);new PL(o.asyncQueue,l,a,s,c).zu()})),c.promise})(Qh(r),i=>e(new XL(r,i)),t)}(function(e,n=!0){(function(i){Wh=i})(Ia),hr(new Tn("firestore",(t,{instanceIdentifier:i,options:o})=>{let s=t.getProvider("app").getImmediate(),a=new eo(new qw(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 Oh(l.options.projectId,u)})(s,i),s);return o=Object.assign({useFetchStreams:n},o),a._setSettings(o),a},"PUBLIC").setMultipleInstances(!0)),Qe(m2,p2,e),Qe(m2,p2,"esm2017")})();var Yy=Ee(bz,!0,2);var Qy=Ee(_z,!0,2),Kz=Ee(Tz,!0,2);var Yz=Ee(Gz,!0,2);var Lp=Ee(Iz,!0,2);var Qz=Ee(Wz,!0),FM=Ee(Uz,!0);var Xz=Ee(Vz,!0);var Dse=Ee(Mz,!0,2);var Jz=Ee($z,!0);var Cse=Ee(wz,!0,2),Nse=Ee(Lz,!0,2),Zz=Ee(Nz,!0,2);var e3=Ee(qz,!0),t3=Ee(Bz,!0,2);var Ose=Ee(Pz,!0,2);var Ii=Ee(Oz,!0,2);var rc=(()=>{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=NV(c,a.v1DbHost),a?.forceLongPolling&&Tw());let l=eh(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)(C(Nr),C(Zn),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Ko=(()=>{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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:_t.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:_t.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(([F,U])=>{let S=this.commentAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:_t.RESOLVE_COMMENT_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:_t.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||Z();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:_t.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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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:_t.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:_t.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||Z();return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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?Nn(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||Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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:nn.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:nn.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:_t.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:_t.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:_t.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Yo=(()=>{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.fieldsToRemove=[],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),s.config?.fieldsToRemove&&(this.fieldsToRemove=s.config.fieldsToRemove||[]))})}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)}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in ReactionAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.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:Tt.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(([F,U])=>{let S=this.reactionAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:Tt.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||Z();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:Tt.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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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:nn.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:Tt.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:Tt.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||Z();return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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?Nn(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||Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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:nn.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:nn.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:Tt.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:Tt.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:Tt.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Xh=(()=>{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||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:c,methodName:wo.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=_S(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:wo.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:wo.SAVE_ATTACHMENT,source:"internal",payload:{result:l,request:t}}),l}catch(s){this.loggingService.warn("Error in AttachmentResolverService saveAttachment:",s);let a=i||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:wo.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||Z();this.coreActionsService.triggerAction($.ATTACHMENT_RESOLVER,{event:L.Events.Resolver.ATTACHMENT_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:g,methodName:wo.DELETE_ATTACHMENT,source:"internal",payload:{attachmentId:t,metadata:d}});let p=yield kt(()=>{if(u?.config?.deleteConfig?.url){let _={attachmentId:t,metadata:d,event:nn.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:nn.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:wo.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:wo.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||Z(),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:wo.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var ic=(()=>{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.fieldsToRemove=[],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||[]),a.config?.fieldsToRemove&&(this.fieldsToRemove=a.config.fieldsToRemove||[]),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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:It.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:It.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(([F,U])=>{let S=this.recorderAnnotationById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:It.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||Z();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:It.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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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:It.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:It.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||Z();return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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?Nn(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||Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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:nn.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:nn.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:It.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:It.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||Z(),c=i?Nn(i):void 0;return this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:It.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}}getFieldsToRemove(){try{return this.fieldsToRemove}catch(t){return this.loggingService.catch("Error in RecorderAnnotationsResolverService getFieldsToRemove:",t),this.fieldsToRemove}}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)(C(vt),C(ge),C(bt),C(Xh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Zy=class{};var Jh=(()=>{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.endpointsService=J(Fo),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(yd).subscribe(_=>{this.commentService=_??void 0}),U1(()=>this.documentPaths$.value?.clientDocumentId),this.setDocumentIdSubject.pipe(wS(()=>Oi(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=JT(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=JT(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=JT(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:Un.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))&&Bi(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=XT(this.getOptionsFromDocumentPaths()??{})??{};return!t.every(u=>a.includes(u.id))||!Bi(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=`${vr(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:Un.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:Un.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(st(Ft))}getProcessedDocContext(){return BV(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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));(yield wd({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:ma(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:Ui.ORGANIZATION,source:Jn.SET_DOCUMENTS,organizationId:t.organizationId,context:t?.context}}),t.folderId&&s.push({userId:o.userId,resource:{id:t.folderId,type:Ui.FOLDER,source:Jn.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:Ui.DOCUMENT,source:Jn.SET_DOCUMENTS,organizationId:t?.organizationId??o?.clientOrganizationId??"",context:t?.context},t?.folderId&&{parentFolderId:t.folderId})})}),t?.context&&this.userPermissionService?.getIsContextEnabled()&&GV({input:t?.context}).forEach(c=>{let l=JSON.stringify(c.access);s.push({userId:o.userId,resource:{id:l,type:Ui.CONTEXT,source:Jn.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===Ui.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=$V({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=Z();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Jn.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:Jn.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===vs.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===vs.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===vs.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===vs.PERMISSION_DENIED&&l.push(u)}),a&&c?.[o.userId]?.organization?.[a]?.errorCode===vs.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===vs.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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield wd({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,XT(i))){o==="external"&&this.loggingService.catch("setDocuments called with previous request");return}let c=Z();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=XT(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:Un.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=`${vr(t)}`,l=o?.folderId,u=o?.folderId?bo(o?.folderId):void 0,d=o?.locationId,f=o?.allDocuments,g=o?.optimisticPermissions,p=s?.organizationId?i?Vi(i):s?.organizationId:void 0,_=Z(),T=Rd.SET_DOCUMENTS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:_,methodName:_t.INIT_DOCUMENTS,moduleName:T,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let R=Z(),b=Dd.SET_DOCUMENTS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:R,moduleName:b,methodName:Tt.INIT_DOCUMENTS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}});let G=Z(),M=Cd.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:It.RESOLVE_RECORDER_ANNOTATIONS,source:"internal",payload:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""}}),yield Promise.allSettled([this.commentResolverService.resolveCommentAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:_,moduleName:T}),this.reactionResolverService.resolveReactionAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.clientDocumentId),organizationId:i??s?.clientOrganizationId??""},uniqueId:R,moduleName:b}),this.recorderResolverService.resolveRecorderAnnotations({request:{documentIds:this.documentIds$.value.map(F=>F.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 F=new jT,U=new Zy;F.clientDocumentId=t,U.clientDocumentId=t,F.folderId=l,U.folderId=l,F.locationId=d,U.locationId=d,F.allDocuments=f,F.optimisticPermissions=g,U.allDocuments=f,U.optimisticPermissions=g,F.veltFolderId=u,U.veltFolderId=u,F.documentId=c,U.documentId=c,p&&(F.organizationId=p,F.clientOrganizationId=i??s?.clientOrganizationId,U.organizationId=p,U.clientOrganizationId=i??s?.clientOrganizationId);let S=`${this.apiKey}`,A=`apiKey/${this.apiKey}`;p&&(S=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`,A=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}/${F.organizationId}`),U.organization=`apiKey/${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATIONS}`,U.document=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}`,F.presence=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_PRESENCE}/`,F.cursor=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CURSOR}/`,F.comment=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}/`,U.comment=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_COMMENT}`,F.multiThread=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}/`,U.multiThread=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_MULTI_THREAD}`,F.tag=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_TAG}/`,F.area=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}/`,U.area=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AREA}`,F.arrow=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_ARROW}/`,F.selection=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SELECTION}/`,F.audioHuddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_AUDIO_HUDDLE}/`,F.huddle=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_HUDDLE}/`,F.recorder=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}/`,U.recorder=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_RECORDER}`,F.flock=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_FOLLOW_ALONG}/`,F.syncVideoPlayer=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_SYNC_VIDEO_PLAYER}/`,F.liveState=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/`,F.liveStateSingleEditorMode=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LIVE_STATE}/default/singleEditorMode`,F.reaction=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}/`,U.reaction=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_REACTION}`,F.crdt=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}/`,U.crdt=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_CRDT}`,F.customerMetadata=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_CUSTOMER_METADATA}/`,F.views=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_VIEWS}/`,U.notificationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_VIEWS}`,U.documentViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_VIEWS}`,U.locationViews=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_LOCATION_VIEWS}`,F.notifications=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATIONS}/`,F.metadata=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_METADATA}/`,F.users=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.documentIam=`${S}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.workspaceIam=`${this.apiKey}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.groupContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GROUPS}/`,F.globalContacts=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_GLOBAL}/`,F.logins=`${S}/${v.FIREBASE_PARTIAL_PATH_CONTACTS}/${v.FIREBASE_PARTIAL_PATH_LOGINS}/`,F.userFeedback=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_FEEDBACK}/`,F.userReportBugs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_BUGS}/`,F.userContactUs=`${S}/${v.FIREBASE_PARTIAL_PATH_USER_REQUESTS}/${v.FIREBASE_PARTIAL_PATH_CONTACT_US}/`,p&&(F.organizationMetadata=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_METADATA}/`,F.organizationIam=`${S}/${v.FIREBASE_PARTIAL_PATH_IAM}/`,F.organizationGroups=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_GROUPS}/`,F.organizationNotifications=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/`,c&&(F.organizationNotificationsWithDocumentId=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/`,F.heartbeatByDocument=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT_BY_DOCUMENT}/${c}/`),F.organizationNotificationsLastNotificationTimestamp=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_LAST_NOTIFICATION_TIMESTAMP}/${v.FIREBASE_PARTIAL_PATH_DOCS}/`,F.organizationNotificationsUsers=`${S}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_NOTIFICATIONS}/${v.FIREBASE_PARTIAL_PATH_USERS}/`,F.heartbeat=`${S}/${v.FIREBASE_PARTIAL_PATH_HEARTBEAT}/`),U.organizationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_ORGANIZATION_USERS}`,U.users=`${A}/${v.FIREBASE_PARTIAL_PATH_CENTRAL_USERS}`,U.documentUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_DOCS}/${c}/${v.FIREBASE_PARTIAL_PATH_DOCUMENT_USERS}`,U.notificationDocs=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_DOCS}`,U.notificationUsers=`${A}/${v.FIREBASE_PARTIAL_PATH_NOTIFICATION_USERS}`,this.documentPaths$.next(F),this.firestorePaths$.next(U),F?.clientOrganizationId&&F?.organizationId&&!(F?.clientOrganizationId===this.getOrganizationConfig()?.clientOrganizationId&&F?.organizationId===this.getOrganizationConfig()?.organizationId)&&this.setOrganizationConfig({organizationId:F?.organizationId,clientOrganizationId:F?.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:Un.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:Un.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===vs.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(rs(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`${vr(t)}`}catch(i){return this.loggingService.catch("Error in generateDocumentId: ",i),""}}generateOrganizationId(t){try{return`${Vi(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:Un.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:Un.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:Un.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=Od(l),f=vr(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=Od(l),f=vr(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(R=>{let b=g[R];b.location?.id===d.id&&(f=x(x({},b.location),d),delete g?.[R])});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:Un.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:Un.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:Un.REMOVE_LOCATION,payload:{locations:[t]}}),t?this.removeLocationsImpl([t],i):i==="external"&&this.removeLocationsImpl(void 0,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:Un.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:Un.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:Un.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 WT;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===vs.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=Cr(this.functions,yr({url:this.endpointsService.getCloudFunctionUrl("sdkProxy"),apiProxyDomain:this.configService?.getApiProxyDomain()}));yield wd({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 $T;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=Mg(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}),Bi(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 HT;u.locationId=l?.locationId,u.veltLocationId=PC(l?.location?.id??""),u.location=l?.location,u.pageInfo=Mg(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"?vr(JSON.stringify(Od(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),st(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||{}),st(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),st(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||{}),st(Ft))}getCustomerMetadata(){return this.customerMetadata$.value}getCustomerMetadata$(){return this.customerMetadata$.asObservable()}getOrganizationConfig$(){return this.organizationConfig$.asObservable().pipe(st(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=Hr(),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=bo(t?.folderId);o.push(Ii("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ii("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=bo(t?.folderId);o.push(Ii("metadata.veltFolderId","==",a))}return t?.documentIds?.length&&!t?.allDocuments&&o.push(Ii("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=ys(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=ma(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=bo(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=>ma(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=PC(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:ys(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=bo(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:[Ii("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(pt(t=>t?this.documentPaths$.pipe(pt(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),st((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?xt.RESTRICTED:xt.PUBLIC:t&&t.documentAccessType?t.documentAccessType:xt.PUBLIC}catch(i){return this.loggingService.catch("Error in DocService getDocumentAccessType:",i),xt.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 xt.PUBLIC:o.features.all.restricted=!1;break;case xt.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)(C(bt),C(Nr),C(rc),C(yv),C(Zn),C(ge),C(Ko),C(Yo),C(ic),C(vt),C(fr),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();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 mt,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),pt(()=>this.getUnresolvedUsers$().pipe(Ct(c=>c.length>0),wu(300),Nt(20),pt(c=>{let l=this.docService.getOrganizationConfig()?.organizationId;return this.commonDbService?this.commonDbService?.dbListener({feature:"allOrganizationUsers",properties:{organizationId:l,isCollection:!0,useQuery:!0,firestoreQuery:[Yy(Ii("user.userId","in",c.slice(0,20)))]}}).pipe(fe(u=>u?.data),Js(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||Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:_,moduleName:l,methodName:Fn.RESOLVE_USERS,source:"internal",payload:{userIds:g,organizationId:s,feature:o,forceResolve:i,skipUserCheck:a,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}});let T={};try{let R,b=new Promise((G,M)=>{R=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(R)}),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:Fn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{result:T,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}catch(R){this.loggingService.catch("Error in UsersService resolveUsers getUsers:",R,{userIds:g}),this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:_,methodName:Fn.RESOLVE_USERS,moduleName:l,source:"internal",payload:{error:R,userIds:g,externalUserDataProviderAvailable:this.externalUserDataProviderAvailable()}})}finally{g?.forEach(R=>{if(!T[R]){let b=new Set([...this.getUnresolvedUsers(),R]);this.unresolvedUsers.next(Array.from(b)),T[R]={userId:R,name:`User ${R}`}}})}Object.entries(T).forEach(([R,b])=>{b&&(f[R]=T?.[R],p[R]=T?.[R])})}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||Z();return this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:f,methodName:Fn.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:[Ii("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:[Yy(Ii("userId","in",_),Ii("veltResourceId","in",T))]}}))??[])||[]}catch(R){return this.loggingService.catch(`Error in batch ${u+1}:`,R),[]}});for(let _ of a)for(let T of c)l.push(d(_,T)),u++;return(yield Promise.all(l)).flat().filter((_,T,R)=>T===R.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;"),ti([this.userById$,this.customContactUserById$]).pipe(fe(([t,i])=>this.applyContactOverlay(t,i)),st(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 F=this.userIdByEmailCache[M];F?c[M]=F: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||Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:p,methodName:Fn.RESOLVE_USER_IDS_BY_EMAIL,source:"internal",payload:{emails:l,organizationId:u,documentId:d,folderId:f}});let _=s.config?.resolveTimeout||this.resolveTimeout,T,R=new Promise((M,F)=>{T=setTimeout(()=>{F(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,R]);return Object.entries(M).forEach(([F,U])=>{U&&(this.userIdByEmailCache[F]=U,c[F]=U,this.externalUserDataProviderAvailable()||this.docService.addUserInfoToOrganization({organizationId:this.docService.getOrganizationConfig()?.clientOrganizationId??"",user:{userId:U,name:F,email:F},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:Fn.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:Fn.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)(C(bt),C(Nr),C(vt),C(Jh),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var oc=class{static getFirestoreProdDbName(e,n){return n?.databaseURL?.includes("snippyly-plugin.firebaseio.com")||n?.databaseURL?.includes("snippyly-plugin-staging.firebaseio.com")?"sfdb":n?.storeDbId??(this.isTestingDb(n?.databaseURL??"")?"sdktest":`apikey${e.toLowerCase()}`)}static isTestingDb(e){try{return e.includes("-test")}catch(n){return H.error("Error in isTestingDb:",n),!1}}};var eS=(()=>{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.endpointsService=J(Fo),this.notificationActionTypeMap={[ye.NEWLY_ADDED]:nn.COMMENT_ANNOTATION_ADD,[ye.ADDED]:nn.COMMENT_ADD,[ye.UPDATED]:nn.COMMENT_UPDATE,[ye.DELETED]:nn.COMMENT_DELETE},this.additionalEventTypeMap={[ye.STATUS_CHANGED]:ur.STATUS_CHANGE,[ye.PRIORITY_CHANGED]:ur.PRIORITY_CHANGE,[ye.ASSIGNED]:ur.ASSIGN,[ye.ACCESS_MODE_CHANGED]:ur.ACCESS_MODE_CHANGE,[ye.CUSTOM_LIST_CHANGED]:ur.CUSTOM_LIST_CHANGE,[ye.APPROVED]:ur.APPROVE,[ye.ACCEPTED]:ur.ACCEPT,[ye.REJECTED]:ur.REJECT,[ye.SUGGESTION_ACCEPTED]:ur.SUGGESTION_ACCEPT,[ye.SUGGESTION_REJECTED]:ur.SUGGESTION_REJECT,[ye.REACTION_ADDED]:ur.REACTION_ADD,[ye.REACTION_DELETED]:ur.REACTION_DELETE,[ye.SUBSCRIBED]:ur.SUBSCRIBE,[ye.UNSUBSCRIBED]:ur.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(al(`{{${s.userId}}}`),"g");i.commentText?.includes(`@User ${s.userId}`)&&(a=new RegExp(al(`@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?!Bi(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 BT;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=Z();this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.EMAIL_USER_ID_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:o,methodName:Fn.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=al(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:Nn(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(U=>{t?.[U]&&(p[M][U]=t[U],delete t[U])}),l?.length)for(let U of l)t?.[U]!==void 0&&(p[M][U]=JSON.parse(JSON.stringify(t[U])));t.comments?.forEach(U=>{if(U.commentId){let S;a&&(S={},U.attachments?.forEach(A=>{S[A.attachmentId]={attachmentId:A.attachmentId,name:A.name,url:A.url}})),p[M].comments[U.commentId]=x(x(x(x(x(x({commentId:U.commentId},U?.commentHtml&&{commentHtml:U?.commentHtml}),U?.commentText&&{commentText:U?.commentText}),S&&{attachments:S}),U?.from&&{from:U?.from}),U?.to&&{to:U?.to}),U?.taggedUserContacts&&{taggedUserContacts:U?.taggedUserContacts})}}),T=this.isCommentsDataChanged(p[M],M);let F=new VT;Object.assign(F,t),c?.length>0&&c.forEach(U=>{U in t||delete F[U]}),F.comments=t.comments?.map(U=>this.stripCommentsFromAnnotationData({comment:U}))||[],_=F}let R=_?.comments?.find(M=>M.commentId===o);R?.isDraft&&(u=_?.comments?.length&&_?.comments?.length>0?nn.COMMENT_ADD:nn.COMMENT_ANNOTATION_ADD);let b=!!i&&!!this.notificationActionTypeMap?.[i],G=!!d&&!!_&&!b&&!R?.isDraft&&g.includes(d);return G&&(u=d),{strippedData:T&&(i&&this.notificationActionTypeMap?.[i]||R?.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(al(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:Ui.DOCUMENT,source:Jn.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:Ui.CONTEXT,source:Jn.SET_NOTIFICATIONS,organizationId:t?.metadata?.clientOrganizationId??"",context:{access:c}}})}});let u=Z();this.coreActionsService.triggerAction($.PERMISSION_PROVIDER,{event:L.Events.PermissionProvider.RESOURCE_ACCESS_REQUEST_FORMED,methodName:Jn.SET_NOTIFICATIONS,uniqueId:u,timestamp:new Date().getTime(),source:"internal",payload:{requests:l}});let d=yield this.userPermissionService?.onResourceAccessRequired({requests:l,uniqueId:u,methodName:Jn.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=QT(this.authService.getFirebaseConfig()?.firebaseOptions),u=Cr(this.functions,yr({url:this.endpointsService.getSetEncryptedDataUrl(l),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(R=>R?.commentId===_);T&&(o.targetAnnotationData=T)}try{let T=yield this.stripCommentAnnotationData({data:o.annotationData,actionType:o?.actionType??ye.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=oc.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:this.endpointsService.getNotificationsDbUrl(),feature:"comment",eventType:s??"PATCH",sdkVersion:Hr(),deniedForYouUsers:f,isPermissionProviderUsed:this.userPermissionService?.isPermissionProviderAvailable(),isCommentResolverUsed:this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable(),isSettingsConfigByOrganization:this.notificationService?.getSettingsConfigByOrganization(),isCrossOrganizationEnabled:this.notificationService?.getCrossOrganizationConfig()?.enabled,metadata:a},p=yield cl(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)(C(ge),C(zt),C(Nr),C(fr),C(Zn),C(Ko),C(Xh),C(vt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var tS=(()=>{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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.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:dr.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(([F,U])=>{let S=this.activityById$.value?.[F];S?S&&JSON.stringify(S)!==JSON.stringify(U)&&(M[F]=U):M[F]=U}),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:dr.RESOLVE_ACTIVITIES,moduleName:o,source:"internal",payload:{result:M,request:T}}),d(M)}catch(M){let F=i||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:F,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:G,methodName:dr.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||Z();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:dr.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||Z();this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:s,methodName:dr.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:dr.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:dr.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||Z();return this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_SAVE_ERROR,timestamp:new Date().getTime(),uniqueId:s,methodName:dr.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var nS=(()=>{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,this.endpointsService=J(Fo)}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=QT(this.authService.getFirebaseConfig()?.firebaseOptions),c=Cr(this.functions,yr({url:this.endpointsService.getSetEncryptedDataUrl(a),apiProxyDomain:this.configService?.getApiProxyDomain()}),{timeout:1200*1e3}),l=oc.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:Hr()},f=yield cl(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?!Bi(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={},o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(t&&t.annotationId){let s=t.annotationId;if(i[s]=x({annotationId:s,metadata:Nn(t.metadata??{}),icon:t.icon},t?.from&&{from:t?.from}),o?.length>0)for(let c of o)t?.[c]!==void 0&&(i[s][c]=t[c],delete t[c]);if(!this.isReactionDataChanged(i[s],s))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);if(i){i.icon&&(t.icon=i.icon);let o=this.reactionAnnotationsResolverService.getFieldsToRemove();if(o?.length>0)for(let s of o)i?.[s]!==void 0&&(t[s]=i[s])}return t}catch(i){return this.loggingService.catch("Error in ReactionUtilsService mergeStrippedDataWithReactionAnnotations:",i),t}}};e.\u0275fac=function(i){return new(i||e)(C(ge),C(zt),C(Nr),C(fr),C(Zn),C(Yo))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var rS=(()=>{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,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=Nn(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?Nn(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?Nn(t.metadata):void 0},a=JSON.parse(JSON.stringify(t.entityData));if(i){let c=this.serviceBook.get(ui)?.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 Dg.RECORDING_ADD:return`${i} added a recording`;case Dg.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 Cg.REACTION_ADD:return`${i} added a reaction`;case Cg.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??ye.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(ui)?.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(ui)?.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(ui)?.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===ye.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 ye.NEWLY_ADDED:return xe.ANNOTATION_ADD;case ye.ADDED:return xe.COMMENT_ADD;case ye.UPDATED:return xe.COMMENT_UPDATE;case ye.DELETED:return xe.COMMENT_DELETE;case ye.STATUS_CHANGED:return xe.STATUS_CHANGE;case ye.PRIORITY_CHANGED:return xe.PRIORITY_CHANGE;case ye.ASSIGNED:return xe.ASSIGN;case ye.ACCESS_MODE_CHANGED:return xe.ACCESS_MODE_CHANGE;case ye.CUSTOM_LIST_CHANGED:return xe.CUSTOM_LIST_CHANGE;case ye.APPROVED:return xe.APPROVE;case ye.ACCEPTED:return xe.ACCEPT;case ye.REJECTED:return xe.REJECT;case ye.SUGGESTION_ACCEPTED:return xe.SUGGESTION_ACCEPT;case ye.SUGGESTION_REJECTED:return xe.SUGGESTION_REJECT;case ye.REACTION_ADDED:return xe.REACTION_ADD;case ye.REACTION_DELETED:return xe.REACTION_DELETE;case ye.SUBSCRIBED:return xe.SUBSCRIBE;case ye.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 RT.ADDED:return Dg.RECORDING_ADD;case RT.DELETED:return Dg.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 Cg.REACTION_ADD;case"delete":return Cg.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 ye.NEWLY_ADDED:case ye.ADDED:s.commentText={from:null,to:i?.commentText??null};break;case ye.UPDATED:s.commentText={from:o?.oldCommentText??null,to:i?.commentText??null};break;case ye.DELETED:s.commentText={from:i?.commentText??null,to:null};break;case ye.STATUS_CHANGED:s.status={from:o?.oldStatus??null,to:o?.newStatus??null};break;case ye.PRIORITY_CHANGED:s.priority={from:o?.oldPriority??null,to:o?.newPriority??null};break;case ye.ASSIGNED:{s.assignedTo={from:o?.oldAssignedTo??null,to:o?.newAssignedTo??null};break}case ye.ACCESS_MODE_CHANGED:s.accessMode={from:o?.oldAccessMode??null,to:o?.newAccessMode??null};break;case ye.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(ui)?.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)(C(ge),C(zt),C(eS),C(nS),C(Ko),C(Yo),C(ic),C(tS),C(di))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var iS=class{constructor({apiKey:e,documentId:n,organizationId:t,folderId:i,veltFolderId:o,clientDocumentId:s,clientOrganizationId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.folderId=i,this.veltFolderId=o,this.clientDocumentId=s,this.clientOrganizationId=a,s&&(this.documentId=ma(s)),a&&(this.organizationId=ys(a)),i&&(this.folderId=i,this.veltFolderId=bo(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 s3=(()=>{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=Z(),s=ol.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:Fn.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)(C(vt),C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var oS=(()=>{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 U=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.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||[])],R=[],b=[],G=[];for(let U of T)_[U]||(this.inFlightRequests.has(U)?(R.push(this.inFlightRequests.get(U)),b.push(U)):G.push(U));let M=le(x({},t),{notificationIds:G});I(this,null,function*(){try{if(R.length>0&&(yield Promise.allSettled(R)),G.length>0){let U=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{request:M}});let S,A=new Promise(w=>{S=w});for(let w of G)this.inFlightRequests.set(w,A.then(P=>P?.[w]));let N=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(w=>c?{}:(u(),w&&w.statusCode!==200?(this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:w,request:M}}),this.loggingService.catch(w?.message??"Error in NotificationResolverService resolveNotifications:"),{}):w?.data)).catch(w=>{throw u(),w});try{p=(yield N)||{},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 w={};Object.entries(p).forEach(([P,k])=>{let O=this.notificationById$.value?.[P];O?O&&JSON.stringify(O)!==JSON.stringify(k)&&(w[P]=k):w[P]=k}),Object.keys(w).length>0&&this.notificationById$.next(x(x({},this.notificationById$.getValue()),w)),this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_RESULT,timestamp:new Date().getTime(),uniqueId:U,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{result:w,request:M}}),d(w)}catch(w){S({});for(let k of G)this.inFlightRequests.delete(k);let P=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:P,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:w,request:M}}),c||f(w),d(p)}}else u(),d({})}catch(U){u();let S=i||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:S,methodName:kn.RESOLVE_NOTIFICATIONS,moduleName:o,source:"internal",payload:{error:U,request:M}}),f(U)}})})}catch(a){this.loggingService.catch("Error in NotificationResolverService resolveNotifications:",a);let c=i||Z();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_ERROR,timestamp:new Date().getTime(),uniqueId:c,methodName:kn.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||Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_TRIGGERED,timestamp:new Date().getTime(),uniqueId:a,methodName:kn.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:kn.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:kn.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||Z();return this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_ERROR,timestamp:new Date().getTime(),uniqueId:a,methodName:kn.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)(C(vt),C(ge),C(bt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var xp=class{constructor({apiKey:e,documentId:n,organizationId:t,clientDocumentId:i,clientOrganizationId:o,folderId:s,veltFolderId:a}){this.paths={},this.apiKey=e,this.documentId=n,this.organizationId=t,this.veltFolderId=a,i&&(this.documentId=ma(i)),o&&(this.organizationId=ys(o)),s&&(this.folderId=s,this.veltFolderId=bo(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 c3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var l3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var u3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var d3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var h3=(()=>{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)(C(ge),C(zt))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var f3=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,R,b,G,M,F,U){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=R,this.recorderAnnotationsResolverService=b,this.notificationResolverService=G,this.activityResolverService=M,this.serviceBook=F,this.attachmentResolverService=U}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 xp({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 xp({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 iS({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=Z(),a=Rd.GET_COMMENT_ANNOTATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:_t.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=Z(),a=Dd.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:Tt.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=Z(),a=Cd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:s,methodName:It.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(NT)?.getUserIdsToResolveFromArrowAnnotations(Object.values(i))??[]);break}case"allCursors":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(OT)?.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(ki)?.getUserIdsToResolveFromNotifications(Array.isArray(i)?i:Object.values(i))??[]);break}case"allUserNotifications":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ki)?.getUserIdsToResolveFromNotifications(Object.values(i))??[]);break}case"allPresence":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(wT)?.getUserIdsToResolveFromPresenceUsers(Object.values(i))??[]);break}case"allRecorders":{i&&typeof i=="object"&&!Array.isArray(i)&&(_=this.serviceBook.get(ui)?.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(bT)?.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=Z(),R=ol.GET_USERS;this.coreActionsService.triggerAction($.USER_RESOLVER,{event:L.Events.Resolver.USER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Fn.FORMAT_RESPONSE,source:"internal",moduleName:R,payload:{userIds:_,feature:t,forceResolve:a}}),s?yield this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:R}):this.usersService.resolveUsers({userIds:_,forceResolve:a,feature:t,organizationId:o,uniqueId:T,moduleName:R})}}if(this.notificationResolverService.notificationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":case"allUserNotifications":{i&&typeof i=="object"&&(_=this.serviceBook.get(ki)?.getCustomNotificationIdsToResolve(i)??[],_=_.filter(R=>!this.notificationResolverService.getNotificationById(R)));break}default:_=[]}if(_?.length){let T=Z(),R=OC.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:kn.FORMAT_RESPONSE,moduleName:R,source:"internal",payload:{notificationIds:_,organizationId:p,shouldNotificationResolverAwait:l}}),l?yield this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:R}):this.notificationResolverService.resolveNotifications({request:{notificationIds:_,organizationId:p},uniqueId:T,moduleName:R})}}if(this.commentAnnotationsResolverService.commentAnnotationDataProviderAvailable()){let _=[];switch(t){case"allDocNotifications":{if(i&&typeof i=="object"){let R=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allUserNotifications":{if(i&&typeof i=="object"&&!Array.isArray(i)){let R=this.serviceBook.get(ki)?.getTargetAnnotationIdsFromNotifications(i)??[];_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}case"allActivities":{if(i&&typeof i=="object"){let T=Array.isArray(i)?i:Object.values(i),R=this.activityUtilsService.getEntityIdsToResolveFromActivities(T,"comment");_=[..._,...R],_=_.filter(b=>!this.commentAnnotationsResolverService.getCommentAnnotationById(b))}break}default:_=[]}if(_?.length){let T=Z(),R=Rd.GET_NOTIFICATIONS;this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.FORMAT_RESPONSE,moduleName:R,source:"internal",payload:{commentAnnotationIds:_,organizationId:p,shouldCommentAnnotationsResolverAwait:c}}),c?yield this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:R}):this.commentAnnotationsResolverService.resolveCommentAnnotations({request:{commentAnnotationIds:_,organizationId:p},uniqueId:T,moduleName:R})}}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 R=[];for(let b of _)b?.id&&!this.activityResolverService.getActivityById(b.id)&&R.push(b.id);if(R.length){let b=Z(),G=wC.GET_ACTIVITIES;this.coreActionsService.triggerAction($.ACTIVITY_RESOLVER,{event:L.Events.Resolver.ACTIVITY_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:dr.FORMAT_RESPONSE,moduleName:G,source:"internal",payload:{activityIds:R,organizationId:T,shouldActivityResolverAwait:u}}),u?yield this.activityResolverService.resolveActivities({request:{activityIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.activityResolverService.resolveActivities({request:{activityIds:R,organizationId:T},uniqueId:b,moduleName:G})}}if(this.reactionAnnotationsResolverService.reactionAnnotationDataProviderAvailable()){let R=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"reaction");if(R=R.filter(b=>!this.reactionAnnotationsResolverService.getAnnotationById(b)),R.length){let b=Z(),G=Dd.GET_REACTION_ANNOTATIONS;this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:Tt.RESOLVE_REACTION_ANNOTATIONS,moduleName:G,source:"internal",payload:{reactionAnnotationIds:R,organizationId:T,shouldReactionResolverAwait:d}}),d?yield this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.reactionAnnotationsResolverService.resolveReactionAnnotations({request:{reactionAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G})}}if(this.recorderAnnotationsResolverService.recorderAnnotationDataProviderAvailable()){let R=this.activityUtilsService.getEntityIdsToResolveFromActivities(_,"recorder");if(R=R.filter(b=>!this.recorderAnnotationsResolverService.getAnnotationById(b)),R.length){let b=Z(),G=Cd.GET_RECORDER_ANNOTATIONS;this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_RESOLUTION_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:b,methodName:It.RESOLVE_RECORDER_ANNOTATIONS,moduleName:G,source:"internal",payload:{recorderAnnotationIds:R,organizationId:T,shouldRecorderResolverAwait:f}}),f?yield this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:R,organizationId:T},uniqueId:b,moduleName:G}):this.recorderAnnotationsResolverService.resolveRecorderAnnotations({request:{recorderAnnotationIds:R,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(ki);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(ki);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}}),st(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(ui);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(ki);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(NT);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(OT);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(ki);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(ki);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(wT);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(ui);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(bT);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}}),st(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}}),st(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}}),st(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}}),st(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}}),st(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(ui)?.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 HV(i,{stripAttachmentFiles:this.attachmentResolverService.attachmentDataProviderAvailable()});case"reaction":return WV(i);case"recorder":return zV(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(OT);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(NT);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(ui)?.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(bT)?.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(wT);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)(C(rS),C(c3),C(eS),C(l3),C(vt),C(s3),C(ge),C(u3),C(nS),C(d3),C(h3),C(zt),C(Jh),C(Ko),C(Yo),C(ic),C(oS),C(tS),C(di),C(Xh))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var kse={comment:{mode:"persistent",scope:"doc"},notification:{mode:"persistent",scope:"user"},notificationIndex:{mode:"persistent",scope:"user"},presence:{mode:"ephemeral",scope:"doc"},liveState:{mode:"ephemeral",scope:"doc"},cursor:{mode:"ephemeral",scope:"doc"},huddle:{mode:"ephemeral",scope:"doc"},syncVideoPlayer:{mode:"ephemeral",scope:"doc"},heartbeat:{mode:"ephemeral",scope:"org"},flockSession:{mode:"ephemeral",scope:"doc"},selection:{mode:"ephemeral",scope:"doc"}};function g3(r){return kse[r]}var it={getDatabase:eh,ref:th,query:Gj,get:bm,set:Hj,update:Wj,remove:$j,push:Bj,runTransaction:jj,onValue:Aw,onChildAdded:Fj,onChildChanged:kj,onChildRemoved:Uj,off:xj,objectVal:Mj,listVal:Lj,stateChanges:Pj,onDisconnect:Vj},m3=(()=>{let e=class e{constructor(t,i){this.databaseService=t,this.loggingService=i}getServerTimeOffset(){return I(this,null,function*(){try{let t=this.databaseService.getDbValue();if(!t)return 0;let o=(yield bm(th(t,e.SERVER_TIME_OFFSET_PATH)))?.val();return typeof o=="number"?o:0}catch(t){return this.loggingService.catch("Error in FirebaseRealtimeAdapter getServerTimeOffset: ",t),0}})}onServerTimeOffset(t){let i=null,o=null;try{o=this.databaseService.getDb().subscribe(s=>{if(s){let a=th(s,e.SERVER_TIME_OFFSET_PATH);i=Aw(a,c=>{try{t(c?.val())}catch(l){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset callback: ",l)}})}})}catch(s){this.loggingService.catch("Error in FirebaseRealtimeAdapter onServerTimeOffset: ",s)}return()=>{try{i&&(i(),i=null),o?.unsubscribe(),o=null}catch(s){this.loggingService.catch("Error tearing down FirebaseRealtimeAdapter onServerTimeOffset: ",s)}}}getChannelTag(t){return g3(t)}getDatabaseInstance(t){return t?it.getDatabase(void 0,t):it.getDatabase()}rtdbRef(t,i){return it.ref(t,i)}rtdbQueryRef(t,...i){return it.query(t,...i)}rtdbGet(t){return it.get(t)}rtdbSet(t,i,o){return this.getChannelTag(t),it.set(i,o)}rtdbUpdate(t,i,o){return this.getChannelTag(t),it.update(i,o)}rtdbRemove(t,i){return this.getChannelTag(t),it.remove(i)}rtdbPush(t,i,o){return this.getChannelTag(t),o===void 0?it.push(i):it.push(i,o)}rtdbRunTransaction(t,i,o){return this.getChannelTag(t),it.runTransaction(i,o)}rtdbOnValue(t,i,o,s,a){return this.getChannelTag(t),typeof s=="function"?a?it.onValue(i,o,s,a):it.onValue(i,o,s):s?it.onValue(i,o,s):it.onValue(i,o)}rtdbOnChildAdded(t,i,o,s){return this.getChannelTag(t),s?it.onChildAdded(i,o,s):it.onChildAdded(i,o)}rtdbOnChildChanged(t,i,o,s){return this.getChannelTag(t),s?it.onChildChanged(i,o,s):it.onChildChanged(i,o)}rtdbOnChildRemoved(t,i,o,s){return this.getChannelTag(t),s?it.onChildRemoved(i,o,s):it.onChildRemoved(i,o)}rtdbOff(t,i,o){it.off(t,i,o)}rtdbObjectVal$(t,i){return this.getChannelTag(t),it.objectVal(i)}rtdbListVal$(t,i){return this.getChannelTag(t),it.listVal(i)}rtdbStateChanges$(t,i){return this.getChannelTag(t),it.stateChanges(i)}rtdbOnDisconnectSet(t,i,o){return this.getChannelTag(t),it.onDisconnect(i).set(o)}rtdbOnDisconnectUpdate(t,i,o){return this.getChannelTag(t),it.onDisconnect(i).update(o)}rtdbOnDisconnectRemove(t,i){return this.getChannelTag(t),it.onDisconnect(i).remove()}rtdbOnDisconnectCancel(t,i){return this.getChannelTag(t),it.onDisconnect(i).cancel()}subscribe(t,i,o,s){return{unsubscribe:()=>{}}}publish(t,i,o){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.publish wiring deferred to Phase A"}})}presence(t,i){return I(this,null,function*(){return{ok:!1,code:"unimplemented",message:"RealtimeAdapter.presence wiring deferred to Phase A"}})}onDisconnect(t,i){return I(this,null,function*(){return()=>{}})}};e.SERVER_TIME_OFFSET_PATH=".info/serverTimeOffset",e.\u0275fac=function(i){return new(i||e)(C(rc),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var sS=(()=>{let e=class e{constructor(t,i,o){this.configService=t,this.authService=i,this.loggingService=o,this.firestore$=new Y(null);try{ti([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")||En?.firebaseLogLevel||"silent";JL(d)}catch(d){this.loggingService.catch("Error in FirestoreService setLogLevel: ",d)}let l=oc.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=PM({tabManager:xM()}));try{this.firestore$.next(zy(Rr(),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(Yh(l))}}else if(c)try{let d=Rr(),f=zy(d,{localCache:PM({tabManager:xM()})},l);this.firestore$.next(f)}catch{this.firestore$.next(Yh(l))}else this.firestore$.next(Yh(l))}},s=>{})}catch{}}getFirestore(){return this.firestore$.asObservable()}getFirestoreValue(){return this.firestore$.value}generateFirestoreDocumentId(){try{let t=this.getFirestoreValue()||Yh("DocumentIdDb");if(t){let i=Qy(t,"generateDocumentId");return Lp(i).id}return}catch(t){this.loggingService.catch("Error in FirestoreService generateFirestoreDocumentId: ",t);return}}};e.\u0275fac=function(i){return new(i||e)(C(Zn),C(Nr),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var Zr={doc:Lp,collection:Qy,collectionGroup:Kz,query:Zz,getDoc:FM,getDocs:Xz,getCountFromServer:Qz,setDoc:t3,deleteDoc:Yz,onSnapshot:Jz,runTransaction:e3},E3=(()=>{let e=class e{constructor(t,i,o){this.firestoreService=t,this.databaseService=i,this.loggingService=o}read(t){return I(this,null,function*(){if((t.store??"firestore")==="rtdb"){let a=this.databaseService.getDbValue();return a?{data:(yield bm(th(a,t.location)))?.val()}:{data:void 0}}let o=this.firestoreService.getFirestoreValue();return o?{data:(yield FM(Lp(o,t.location)))?.data()}:{data:void 0}})}runTransaction(t){return I(this,null,function*(){return t()})}firestoreDoc(t,i){return Zr.doc(t,i)}firestoreCollection(t,i){return Zr.collection(t,i)}firestoreCollectionGroup(t,i){return Zr.collectionGroup(t,i)}firestoreQuery(t,...i){return Zr.query(t,...i)}firestoreGetDoc(t){return Zr.getDoc(t)}firestoreGetDocs(t){return Zr.getDocs(t)}firestoreGetCountFromServer(t){return Zr.getCountFromServer(t)}firestoreSetDoc(t,i,o){return o?Zr.setDoc(t,i,o):Zr.setDoc(t,i)}firestoreDeleteDoc(t){return Zr.deleteDoc(t)}firestoreOnSnapshot(t,i,o){return o?Zr.onSnapshot(t,i,o):Zr.onSnapshot(t,i)}firestoreRunTransaction(t,i){return Zr.runTransaction(t,i)}addComment(t){return this.deferred("addComment")}editComment(t){return this.deferred("editComment")}deleteComment(t){return this.deferred("deleteComment")}setCommentResolved(t){return this.deferred("setCommentResolved")}setCommentMetadata(t){return this.deferred("setCommentMetadata")}bumpCommentViews(t){return this.deferred("bumpCommentViews")}markCommentThreadRead(t){return this.deferred("markCommentThreadRead")}markNotificationRead(t){return this.deferred("markNotificationRead")}addNotification(t){return this.deferred("addNotification")}deleteNotification(t){return this.deferred("deleteNotification")}updateNotification(t){return this.deferred("updateNotification")}updatePresence(t){return this.deferred("updatePresence")}grantAccess(t){return this.deferred("grantAccess")}revokeAccess(t){return this.deferred("revokeAccess")}getAccess(t){return this.deferred("getAccess")}upsertOrgUserProfile(t){return this.deferred("upsertOrgUserProfile")}upsertDocMetadata(t){return this.deferred("upsertDocMetadata")}upsertOrgMetadata(t){return this.deferred("upsertOrgMetadata")}createActivity(t){return this.deferred("createActivity")}deferred(t){return this.loggingService.warn(`[WB] FirebaseDbAdapter.${t} called but write-op wiring is deferred to Phase A (self-hosting Step 0). The SDK uses its existing direct write path in Step 0.`),Promise.resolve({ok:!1,code:"unimplemented",message:`FirebaseDbAdapter.${t} wiring deferred to Phase A`})}};e.\u0275fac=function(i){return new(i||e)(C(sS),C(rc),C(ge))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var _3=(()=>{let e=class e{allow(){return Promise.resolve({allow:!0})}canRead(t){return I(this,null,function*(){return this.allow()})}canWrite(t){return I(this,null,function*(){return this.allow()})}};e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();var zUe=(()=>{let e=class e{constructor(t,i,o,s,a,c,l,u,d,f,g,p,_,T,R,b,G,M){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=R,this.realtimeAdapter=b,this.dbAdapter=G,this.authzAdapter=M,this.offset=0,this.db=null,this.firestore=null,this.subscriptions=[],this.offsetListener=null,this.serverTimeOffsetUnsub=null,this.observablesCache={},this.firestoreSubscriptions={},this.rtdbSubscriptions={},this.loggingService.log("%c[WB] Creating CLASS: CommonDbService","color: blue;"),this.serviceBook.observe(xT).subscribe(F=>{this.activityService=F??void 0}),this.docService.setCommonDbService(this),this.authService.setCommonDbService(this),this.usersService.setCommonDbService(this),this.subscriptions.push(this.databaseService.getDb().subscribe(F=>{F&&(this.db=F)})),this.serverTimeOffsetUnsub=this.realtimeAdapter.onServerTimeOffset(F=>{this.offset=F}),this.subscriptions.push(this.firestoreService.getFirestore().subscribe(F=>{F&&(this.firestore=F)}))}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.serverTimeOffsetUnsub&&(this.serverTimeOffsetUnsub(),this.serverTimeOffsetUnsub=null),this.unsubscribeFromObservables()}setupOnDisconnect(t,i,o){return I(this,null,function*(){try{if(this.db){let s=this.realtimeAdapter.rtdbRef(this.db,t);return this.realtimeAdapter.rtdbOnDisconnectUpdate(o??"commondb",s,i)}return Promise.resolve()}catch(s){return this.loggingService.catch("Error in setupOnDisconnect:",s),Promise.resolve()}})}getOffset(){return this.offset}getServerTimestamp(){return new Date().getTime()+this.getOffset()}subscribeToServices(t){ti([this.databaseService.getDb(),this.firestoreService.getFirestore()]).pipe(Ct(([i,o])=>!!i),Nt(1),Js(([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=this.realtimeAdapter.rtdbRef(l,`${g}`))}catch{this.loggingService.catch("Error in dbRef")}try{f?.includes("/organizations")&&u&&f&&(_=this.dbAdapter.firestoreDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,u.dbRef,()=>JSON.parse(JSON.stringify(d))):yield this.realtimeAdapter.rtdbSet(t,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=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,R=>I(this,null,function*(){R.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRunTransaction(t,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 this.realtimeAdapter.rtdbUpdate(t,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=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_SAVE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:T,methodName:It.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 this.dbAdapter.firestoreRunTransaction(this.firestore,R=>I(this,null,function*(){R.set(u.firestoreRef,JSON.parse(JSON.stringify(g)))})))}else yield this.dbAdapter.firestoreSetDoc(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 this.realtimeAdapter.rtdbRemove(t,l.dbRef));try{if(l.firestoreRef&&!i?.skipFirestore)if(t==="comment"){let u=null,d=Z();this.coreActionsService.triggerAction($.COMMENT_RESOLVER,{event:L.Events.Resolver.COMMENT_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:_t.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=Z();this.coreActionsService.triggerAction($.REACTION_RESOLVER,{event:L.Events.Resolver.REACTION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:Tt.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=Z();this.coreActionsService.triggerAction($.RECORDER_RESOLVER,{event:L.Events.Resolver.RECORDER_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:It.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else if(t==="userNotification"){let u=null,d=Z();this.coreActionsService.triggerAction($.NOTIFICATION_RESOLVER,{event:L.Events.Resolver.NOTIFICATION_DELETE_REQUEST_FORMED,timestamp:new Date().getTime(),uniqueId:d,methodName:kn.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 this.dbAdapter.firestoreDeleteDoc(l.firestoreRef))}else yield this.dbAdapter.firestoreDeleteDoc(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=Z()),t||"noDocumentId"}catch(t){return this.loggingService.catch("Error in generateFirestoreDocumentId:",t),Z()||"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=this.dbAdapter.firestoreCollection(this.firestore,o);i?.useCollectionGroup&&(s=this.dbAdapter.firestoreCollectionGroup(this.firestore,o));let a=i?.firestoreQuery??[],c=this.dbAdapter.firestoreQuery(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];if(i?.getCount)try{let l=yield this.dbAdapter.firestoreGetCountFromServer(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 this.dbAdapter.firestoreGetDocs(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=this.realtimeAdapter.rtdbRef(this.db,o),a=i?.rtdbQuery??[],c=this.realtimeAdapter.rtdbQueryRef(s,...a);if(!this.authService.getUser()&&!i?.skipUserCheck)return[];let l=yield this.realtimeAdapter.rtdbGet(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),[]}})}buildAuthzRequest(t,i){return{feature:t,scope:"doc",resourceId:i?.id!=null?String(i.id):void 0,apiKey:i?.apiKey??this.configService.getApiKey()??void 0,organizationId:i?.organizationId!=null?String(i.organizationId):void 0,documentId:i?.documentId!=null?String(i.documentId):void 0}}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),{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"firestore",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&!i?.suppressError&&this.loggingService.catch(`Error in getDoc for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No document found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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{};if(!(yield this.authzAdapter.canRead(this.buildAuthzRequest(t,i))).allow)return{};let l=yield this.dbAdapter.read({feature:t,scope:"doc",location:a,store:"rtdb",field:i?.field,suppressError:i?.suppressError}).catch(d=>(this.authService.getUser()&&this.loggingService.catch(`Error in get for ${t}`,d),this.commonDbUtilsService.getErrorForGetRequests({feature:t,error:d})));if(l){if(l?.errorCode)return l}else return this.loggingService.warn(`[WB] No data found at ${a}`),{};let u=l.data;return i?.field?u?.[i.field]??{}:u??{}}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 ti([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)),pt(([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 me(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 me(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({})}}),Cc(()=>{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 me(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(pt(c=>this.commonDbUtilsService.mergeUsersWithData$({feature:t,data:c})),pt(c=>["allComments","allUserNotifications"].includes(t)?this.commonDbUtilsService.mergeCommentAnnotationsWithData$({data:c,feature:t}):ue(c)),pt(c=>["allReactions"].includes(t)?this.commonDbUtilsService.mergeReactionAnnotationsWithData$({data:c,feature:t}):ue(c)),pt(c=>["allRecorders"].includes(t)?this.commonDbUtilsService.mergeRecorderAnnotationsWithData$({data:c,feature:t}):ue(c)),st(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=this.dbAdapter.firestoreCollection(t,i);if(a?.useCollectionGroup&&(l=this.dbAdapter.firestoreCollectionGroup(t,i)),a?.useQuery&&a?.firestoreQuery){let f=a?.firestoreQuery??[];l=this.dbAdapter.firestoreQuery(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")),this.dbAdapter.firestoreOnSnapshot(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=this.dbAdapter.firestoreDoc(t,i);return this.dbAdapter.firestoreOnSnapshot(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=this.realtimeAdapter.rtdbRef(o,s);if(i?.useQuery&&i?.rtdbQuery){let c=i?.rtdbQuery??[];a=this.realtimeAdapter.rtdbQueryRef(a,...c)}return this.objectValFromChildEvents(a,t).pipe(rs(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))),pt(c=>this.commonDbUtilsService.modifyData({feature:t,data:c})),pt(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=this.realtimeAdapter.rtdbPush(t,a.dbRef);yield this.realtimeAdapter.rtdbSet(t,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 me(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=this.realtimeAdapter.rtdbRef(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)}};this.realtimeAdapter.rtdbOnChildAdded(t,g,_,T);let R=this.realtimeAdapter.rtdbOnValue(t,g,()=>{p=!0},T,{onlyOnce:!0});a=()=>{try{R&&typeof R=="function"&&R(),this.realtimeAdapter.rtdbOff(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 me(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(!Bi(T,c)){let R=JSON.parse(JSON.stringify(T));c=R,o.next(R)}}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 R=s&&typeof s=="object"?JSON.parse(JSON.stringify(s)):{};c=R,o.next(R),a=!0}}catch{}};this.realtimeAdapter.rtdbOnChildAdded(i,t,d,l),this.realtimeAdapter.rtdbOnChildChanged(i,t,f,l),this.realtimeAdapter.rtdbOnChildRemoved(i,t,g,l);let _=this.realtimeAdapter.rtdbOnValue(i,t,p,l,{onlyOnce:!0});return()=>{try{_&&typeof _=="function"&&_(),this.realtimeAdapter.rtdbOff(t,"child_added",d),this.realtimeAdapter.rtdbOff(t,"child_changed",f),this.realtimeAdapter.rtdbOff(t,"child_removed",g)}catch{}}})}};e.\u0275fac=function(i){return new(i||e)(C(rS),C(Nr),C(f3),C(vt),C(ge),C(sS),C(rc),C(Zn),C(Jh),C(zt),C(Ko),C(Yo),C(ic),C(oS),C(di),C(m3),C(E3),C(_3))},e.\u0275prov=K({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{x as a,le as b,_S as c,Gse as d,$se as e,jse as f,I as g,mt as h,me as i,MS as j,Ot as k,Y as l,Nc as m,C6 as n,N6 as o,Ac as p,Fr as q,ue as r,O6 as s,w6 as t,g6 as u,fe as v,ti as w,KS as x,b6 as y,go as z,U6 as A,Oi as B,c6 as C,Bu as D,Ct as E,J3 as F,rs as G,OS as H,wu as I,Nt as J,LS as K,st as L,bu as M,_E as N,xS as O,l6 as P,FS as Q,u6 as R,Lu as S,pt as T,Xs as U,d6 as V,Js as W,h6 as X,p6 as Y,oe as Z,BE as _,K as $,ss as aa,ee as ba,C as ca,J as da,_r as ea,Kn as fa,mo as ga,N0 as ha,O0 as ia,B0 as ja,G0 as ka,ut as la,Dn as ma,lr as na,kr as oa,vo as pa,qc as qa,ni as ra,p4 as sa,pn as ta,zR as ua,x4 as va,ua as wa,v_ as xa,k_ as ya,j4 as za,yq as Aa,Sq as Ba,Aq as Ca,Rq as Da,Dq as Ea,jq as Fa,us as Ga,Me as Ha,Xq as Ia,B8 as Ja,G8 as Ka,Ao as La,tg as Ma,fs as Na,Q_ as Oa,ht as Pa,X8 as Qa,Co as Ra,Jc as Sa,Ek as Ta,U5 as Ua,da as Va,No as Wa,rg as Xa,Sk as Ya,K5 as Za,Dk as _a,Ck as $a,Z_ as ab,ha as bb,Mk as cb,Pk as db,t9 as eb,r9 as fb,i9 as gb,o9 as hb,s9 as ib,a9 as jb,c9 as kb,xk as lb,bD as mb,LD as nb,Fk as ob,MD as pb,PD as qb,kk as rb,xD as sb,FD as tb,Vk as ub,g9 as vb,Bk as wb,$k as xb,jk as yb,T9 as zb,v9 as Ab,y9 as Bb,A9 as Cb,R9 as Db,D9 as Eb,C9 as Fb,N9 as Gb,O9 as Hb,w9 as Ib,Yk as Jb,Qk as Kb,j9 as Lb,W9 as Mb,tK as Nb,oU as Ob,kD as Pb,sU as Qb,aU as Rb,cU as Sb,oK as Tb,lU as Ub,dU as Vb,sK as Wb,aK as Xb,cK as Yb,lK as Zb,gK as _b,mK as $b,pK as ac,EK as bc,_K as cc,TK as dc,IK as ec,vK as fc,yK as gc,SK as hc,AK as ic,RK as jc,CK as kc,OK as lc,wK as mc,bK as nc,LK as oc,MK as pc,FK as qc,lg as rc,ug as sc,$D as tc,_ye as uc,Tye as vc,Iye as wc,hY as xc,eC as yc,vye as zc,yye as Ac,Sye as Bc,Oo as Cc,$U as Dc,bY as Ec,o1 as Fc,LY as Gc,aC as Hc,MY as Ic,PY as Jc,xY as Kc,FY as Lc,UY as Mc,BY as Nc,$Y as Oc,cC as Pc,EC as Qc,o7 as Rc,c7 as Sc,C1 as Tc,L7 as Uc,M7 as Vc,SC as Wc,V1 as Xc,CC as Yc,Pd as Zc,Wr as _c,pa as $c,nI as ad,ul as bd,Sr as cd,Ge as dd,Tn as ed,hr as fd,xo as gd,Ar as hd,Ia as id,Rr as jd,Qe as kd,wX as ld,Qbe as md,Xbe as nd,Jbe as od,ji as pd,va as qd,As as rd,Hi as sd,Ee as td,Wi as ud,Rs as vd,pLe as wd,ELe as xd,_Le as yd,Sa as zd,ZJ as Ad,tZ as Bd,gZ as Cd,pl as Dd,El as Ed,ePe as Fd,tPe as Gd,V0e as Hd,Lre as Id,B0e as Jd,Mre as Kd,Pre as Ld,xre as Md,fr as Nd,TPe as Od,IPe as Pd,vPe as Qd,$1 as Rd,J7 as Sd,Ng as Td,En as Ud,H as Vd,ye as Wd,nn as Xd,GAe as Yd,$Ae as Zd,jAe as _d,HAe as $d,$ as ae,WAe as be,zAe as ce,qAe as de,KAe as ee,F7 as fe,k7 as ge,U7 as he,V7 as ie,RT as je,B7 as ke,YAe as le,G7 as me,AC as ne,$7 as oe,jr as pe,DT as qe,j7 as re,vd as se,xt as te,H7 as ue,CT as ve,W7 as we,z7 as xe,q7 as ye,QAe as ze,XAe as Ae,JAe as Be,K7 as Ce,v as De,F1 as Ee,wRe as Fe,Ad as Ge,PRe as He,xRe as Ie,hi as Je,wt as Ke,j1 as Le,H1 as Me,uDe as Ne,dDe as Oe,VT as Pe,NC as Qe,BT as Re,Fn as Se,ol as Te,wo as Ue,q1 as Ve,K1 as We,Y1 as Xe,Is as Ye,FDe as Ze,Jn as _e,Ui as $e,Q1 as af,X1 as bf,J1 as cf,Z1 as df,eV as ef,tV as ff,nV as gf,rV as hf,iV as if,oV as jf,sV as kf,_Ce as lf,TCe as mf,aV as nf,bC as of,cV as pf,lV as qf,dV as rf,JCe as sf,vs as tf,Z7 as uf,eQ as vf,ewe as wf,CV as xf,NV as yf,dwe as zf,vr as Af,Vi as Bf,ma as Cf,ys as Df,bo as Ef,hwe as Ff,fwe as Gf,gwe as Hf,mwe as If,pwe as Jf,Ewe as Kf,_we as Lf,wV as Mf,Z as Nf,Twe as Of,bV as Pf,Od as Qf,vV as Rf,yV as Sf,nQ as Tf,rQ as Uf,cl as Vf,xC as Wf,Iwe as Xf,Lo as Yf,vwe as Zf,Lg as _f,Bi as $f,ywe as ag,FC as bg,al as cg,sQ as dg,qT as eg,Swe as fg,Awe as gg,MV as hg,Mg as ig,aQ as jg,cQ as kg,lQ as lg,uQ as mg,dQ as ng,Hr as og,Rwe as pg,MC as qg,Dwe as rg,fQ as sg,Cwe as tg,Nwe as ug,xV as vg,Owe as wg,wwe as xg,bwe as yg,Lwe as zg,Mwe as Ag,Pwe as Bg,xwe as Cg,zT as Dg,Fwe as Eg,kwe as Fg,Uwe as Gg,Vwe as Hg,Bwe as Ig,Gwe as Jg,$we as Kg,jwe as Lg,Hwe as Mg,Wwe as Ng,zwe as Og,qwe as Pg,Kwe as Qg,Ywe as Rg,Qwe as Sg,Xwe as Tg,Jwe as Ug,Zwe as Vg,ebe as Wg,tbe as Xg,nbe as Yg,rbe as Zg,ibe as _g,obe as $g,sbe as ah,EQ as bh,abe as ch,cbe as dh,lbe as eh,AV as fh,ube as gh,dbe as hh,Ft as ih,Nn as jh,hbe as kh,kt as lh,Ht as mh,fbe as nh,GV as oh,wd as ph,UC as qh,yr as rh,gbe as sh,RV as th,L as uh,Cr as vh,NT as wh,rRe as xh,iRe as yh,ki as zh,oRe as Ah,OT as Bh,sRe as Ch,aRe as Dh,wT as Eh,cRe as Fh,bT as Gh,lRe as Hh,LT as Ih,uRe as Jh,ui as Kh,dRe as Lh,yd as Mh,hRe as Nh,fRe as Oh,gRe as Ph,mRe as Qh,pRe as Rh,ERe as Sh,_Re as Th,MT as Uh,TRe as Vh,IRe as Wh,PT as Xh,xT as Yh,L1 as Zh,M1 as _h,P1 as $h,di as ai,bt as bi,ge as ci,Zn as di,Fee as ei,PPe as fi,Fo as gi,qj as hi,vt as ii,vv as ji,yv as ki,Nr as li,Yy as mi,Dse as ni,Cse as oi,Nse as pi,Ose as qi,Ii as ri,rc as si,Ko as ti,Yo as ui,Xh as vi,ic as wi,Jh as xi,zt as yi,eS as zi,tS as Ai,rS as Bi,iS as Ci,s3 as Di,oS as Ei,f3 as Fi,m3 as Gi,zUe as Hi};