diff --git a/assets/__bundle-2aa1a987-DWRDgB8b.js b/assets/__bundle-2aa1a987-CMNsz-_m.js similarity index 98% rename from assets/__bundle-2aa1a987-DWRDgB8b.js rename to assets/__bundle-2aa1a987-CMNsz-_m.js index 36ff2095d..74f9b77ff 100644 --- a/assets/__bundle-2aa1a987-DWRDgB8b.js +++ b/assets/__bundle-2aa1a987-CMNsz-_m.js @@ -1 +1 @@ -import{c as F}from"./index-CU1i2Szq.js";function I(s,h){for(var b=0;bc[u]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var A={},T;T=function(){function s(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function h(t,r){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var n,e=c(t);if(r){var o=c(this).constructor;n=Reflect.construct(e,arguments,o)}else n=e.apply(this,arguments);return function(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(i)}(this,n)}}function O(){return O=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,r,n){var e=function(i,a){for(;!Object.prototype.hasOwnProperty.call(i,a)&&(i=c(i))!==null;);return i}(t,r);if(e){var o=Object.getOwnPropertyDescriptor(e,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},O.apply(this,arguments)}var _=function(){function t(){s(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return b(t,[{key:"addEventListener",value:function(r,n,e){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:e})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var e=this.listeners[r],o=0,i=e.length;o"u")(e=new Error("This operation was aborted")).name="AbortError";else try{e=new DOMException("signal is aborted without reason")}catch{(e=new Error("This operation was aborted")).name="AbortError"}this.signal.reason=e,this.signal.dispatchEvent(n)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();function E(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}typeof Symbol<"u"&&Symbol.toStringTag&&(m.prototype[Symbol.toStringTag]="AbortController",w.prototype[Symbol.toStringTag]="AbortSignal"),function(t){if(E(t))if(t.fetch){var r=function(o){typeof o=="function"&&(o={fetch:o});var i=o,a=i.fetch,P=i.Request,g=P===void 0?a.Request:P,C=i.AbortController,R=i.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,L=R!==void 0&&R;if(!E({fetch:a,Request:g,AbortController:C,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:L}))return{fetch:a,Request:p};var p=g;(p&&!p.prototype.hasOwnProperty("signal")||L)&&((p=function(d,l){var y;l&&l.signal&&(y=l.signal,delete l.signal);var v=new g(d,l);return y&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),v}).prototype=g.prototype);var j=a;return{fetch:function(d,l){var y=p&&p.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(y){var v;try{v=new DOMException("Aborted","AbortError")}catch{(v=new Error("Aborted")).name="AbortError"}if(y.aborted)return Promise.reject(v);var k=new Promise(function(q,N){y.addEventListener("abort",function(){return N(v)},{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([k,j(d,l)])}return j(d,l)},Request:p}}(t),n=r.fetch,e=r.Request;t.fetch=n,t.Request=e,Object.defineProperty(t,"AbortController",{writable:!0,enumerable:!1,configurable:!0,value:m}),Object.defineProperty(t,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:w})}else console.warn("fetch() is not available, cannot install abortcontroller-polyfill")}(typeof self<"u"?self:F)},T();const x=I({__proto__:null,default:A},[A]);export{x as _}; +import{c as F}from"./index-CJmidR1i.js";function I(s,h){for(var b=0;bc[u]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var A={},T;T=function(){function s(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function h(t,r){for(var n=0;n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var n,e=c(t);if(r){var o=c(this).constructor;n=Reflect.construct(e,arguments,o)}else n=e.apply(this,arguments);return function(i,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(i)}(this,n)}}function O(){return O=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,r,n){var e=function(i,a){for(;!Object.prototype.hasOwnProperty.call(i,a)&&(i=c(i))!==null;);return i}(t,r);if(e){var o=Object.getOwnPropertyDescriptor(e,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},O.apply(this,arguments)}var _=function(){function t(){s(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return b(t,[{key:"addEventListener",value:function(r,n,e){r in this.listeners||(this.listeners[r]=[]),this.listeners[r].push({callback:n,options:e})}},{key:"removeEventListener",value:function(r,n){if(r in this.listeners){for(var e=this.listeners[r],o=0,i=e.length;o"u")(e=new Error("This operation was aborted")).name="AbortError";else try{e=new DOMException("signal is aborted without reason")}catch{(e=new Error("This operation was aborted")).name="AbortError"}this.signal.reason=e,this.signal.dispatchEvent(n)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();function E(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof t.Request=="function"&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}typeof Symbol<"u"&&Symbol.toStringTag&&(m.prototype[Symbol.toStringTag]="AbortController",w.prototype[Symbol.toStringTag]="AbortSignal"),function(t){if(E(t))if(t.fetch){var r=function(o){typeof o=="function"&&(o={fetch:o});var i=o,a=i.fetch,P=i.Request,g=P===void 0?a.Request:P,C=i.AbortController,R=i.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,L=R!==void 0&&R;if(!E({fetch:a,Request:g,AbortController:C,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:L}))return{fetch:a,Request:p};var p=g;(p&&!p.prototype.hasOwnProperty("signal")||L)&&((p=function(d,l){var y;l&&l.signal&&(y=l.signal,delete l.signal);var v=new g(d,l);return y&&Object.defineProperty(v,"signal",{writable:!1,enumerable:!1,configurable:!0,value:y}),v}).prototype=g.prototype);var j=a;return{fetch:function(d,l){var y=p&&p.prototype.isPrototypeOf(d)?d.signal:l?l.signal:void 0;if(y){var v;try{v=new DOMException("Aborted","AbortError")}catch{(v=new Error("Aborted")).name="AbortError"}if(y.aborted)return Promise.reject(v);var k=new Promise(function(q,N){y.addEventListener("abort",function(){return N(v)},{once:!0})});return l&&l.signal&&delete l.signal,Promise.race([k,j(d,l)])}return j(d,l)},Request:p}}(t),n=r.fetch,e=r.Request;t.fetch=n,t.Request=e,Object.defineProperty(t,"AbortController",{writable:!0,enumerable:!1,configurable:!0,value:m}),Object.defineProperty(t,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:w})}else console.warn("fetch() is not available, cannot install abortcontroller-polyfill")}(typeof self<"u"?self:F)},T();const x=I({__proto__:null,default:A},[A]);export{x as _}; diff --git a/assets/__bundle-347d730c-dsIj7YNg.js b/assets/__bundle-347d730c-DeB8rVlp.js similarity index 99% rename from assets/__bundle-347d730c-dsIj7YNg.js rename to assets/__bundle-347d730c-DeB8rVlp.js index 97a734a1e..4a17f7518 100644 --- a/assets/__bundle-347d730c-dsIj7YNg.js +++ b/assets/__bundle-347d730c-DeB8rVlp.js @@ -1,2 +1,2 @@ -import{c as g}from"./index-CU1i2Szq.js";function H(e,t){for(var o=0;os[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var x={},u=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{},P="URLSearchParams"in u,D="Symbol"in u&&"iterator"in Symbol,m="FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),j="FormData"in u,_="ArrayBuffer"in u;if(_)var L=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function(e){return e&&L.indexOf(Object.prototype.toString.call(e))>-1};function y(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function v(e){var t={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return D&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,o){this.append(o,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function A(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function S(e){return new Promise(function(t,o){e.onload=function(){t(e.result)},e.onerror=function(){o(e.error)}})}function N(e){var t=new FileReader,o=S(t);return t.readAsArrayBuffer(e),o}function U(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:m&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:j&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:P&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():_&&m&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=U(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(e)||q(e))?this._bodyArrayBuffer=U(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):P&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var e=A(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=A(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(m)return this.blob().then(N);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,o,s,n,r=A(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,o=S(t),s=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=s?s[1]:"utf-8",t.readAsText(e,n),o;if(this._bodyArrayBuffer)return Promise.resolve(function(w){for(var c=new Uint8Array(w),a=new Array(c.length),h=0;h-1?s:o),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in u)return new AbortController().signal}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!(this.method!=="GET"&&this.method!=="HEAD"||t.cache!=="no-store"&&t.cache!=="no-cache")){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function G(e){var t=new FormData;return e.trim().split("&").forEach(function(o){if(o){var s=o.split("="),n=s.shift().replace(/\+/g," "),r=s.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(r))}}),t}function f(e,t){if(!(this instanceof f))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},R.call(d.prototype),R.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var M=[301,302,303,307,308];f.redirect=function(e,t){if(M.indexOf(t)===-1)throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})};var p=u.DOMException;try{new p}catch{(p=function(t,o){this.message=t,this.name=o;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),p.prototype.constructor=p}function T(e,t){return new Promise(function(o,s){var n=new d(e,t);if(n.signal&&n.signal.aborted)return s(new p("Aborted","AbortError"));var r=new XMLHttpRequest;function w(){r.abort()}if(r.onload=function(){var a,h,b={statusText:r.statusText,headers:(a=r.getAllResponseHeaders()||"",h=new i,a.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(l){return l.indexOf(` +import{c as g}from"./index-CJmidR1i.js";function H(e,t){for(var o=0;os[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var x={},u=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{},P="URLSearchParams"in u,D="Symbol"in u&&"iterator"in Symbol,m="FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),j="FormData"in u,_="ArrayBuffer"in u;if(_)var L=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],q=ArrayBuffer.isView||function(e){return e&&L.indexOf(Object.prototype.toString.call(e))>-1};function y(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e==="")throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function E(e){return typeof e!="string"&&(e=String(e)),e}function v(e){var t={next:function(){var o=e.shift();return{done:o===void 0,value:o}}};return D&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(t,o){this.append(o,t)},this):Array.isArray(e)?e.forEach(function(t){if(t.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function A(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function S(e){return new Promise(function(t,o){e.onload=function(){t(e.result)},e.onerror=function(){o(e.error)}})}function N(e){var t=new FileReader,o=S(t);return t.readAsArrayBuffer(e),o}function U(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e=="string"?this._bodyText=e:m&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:j&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:P&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():_&&m&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=U(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(e)||q(e))?this._bodyArrayBuffer=U(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof e=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):P&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var e=A(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=A(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(m)return this.blob().then(N);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,o,s,n,r=A(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,o=S(t),s=/charset=([A-Za-z0-9_-]+)/.exec(e.type),n=s?s[1]:"utf-8",t.readAsText(e,n),o;if(this._bodyArrayBuffer)return Promise.resolve(function(w){for(var c=new Uint8Array(w),a=new Array(c.length),h=0;h-1?s:o),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in u)return new AbortController().signal}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!(this.method!=="GET"&&this.method!=="HEAD"||t.cache!=="no-store"&&t.cache!=="no-cache")){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function G(e){var t=new FormData;return e.trim().split("&").forEach(function(o){if(o){var s=o.split("="),n=s.shift().replace(/\+/g," "),r=s.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(r))}}),t}function f(e,t){if(!(this instanceof f))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?"":""+t.statusText,this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},R.call(d.prototype),R.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var M=[301,302,303,307,308];f.redirect=function(e,t){if(M.indexOf(t)===-1)throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})};var p=u.DOMException;try{new p}catch{(p=function(t,o){this.message=t,this.name=o;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),p.prototype.constructor=p}function T(e,t){return new Promise(function(o,s){var n=new d(e,t);if(n.signal&&n.signal.aborted)return s(new p("Aborted","AbortError"));var r=new XMLHttpRequest;function w(){r.abort()}if(r.onload=function(){var a,h,b={statusText:r.statusText,headers:(a=r.getAllResponseHeaders()||"",h=new i,a.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(l){return l.indexOf(` `)===0?l.substr(1,l.length):l}).forEach(function(l){var B=l.split(":"),O=B.shift().trim();if(O){var I=B.join(":").trim();try{h.append(O,I)}catch(C){console.warn("Response "+C.message)}}}),h)};n.url.indexOf("file://")===0&&(r.status<200||r.status>599)?b.status=200:b.status=r.status,b.url="responseURL"in r?r.responseURL:b.headers.get("X-Request-URL");var F="response"in r?r.response:r.responseText;setTimeout(function(){o(new f(F,b))},0)},r.onerror=function(){setTimeout(function(){s(new TypeError("Network request failed"))},0)},r.ontimeout=function(){setTimeout(function(){s(new TypeError("Network request timed out"))},0)},r.onabort=function(){setTimeout(function(){s(new p("Aborted","AbortError"))},0)},r.open(n.method,function(a){try{return a===""&&u.location.href?u.location.href:a}catch{return a}}(n.url),!0),n.credentials==="include"?r.withCredentials=!0:n.credentials==="omit"&&(r.withCredentials=!1),"responseType"in r&&(m?r.responseType="blob":_&&(r.responseType="arraybuffer")),t&&typeof t.headers=="object"&&!(t.headers instanceof i||u.Headers&&t.headers instanceof u.Headers)){var c=[];Object.getOwnPropertyNames(t.headers).forEach(function(a){c.push(y(a)),r.setRequestHeader(a,E(t.headers[a]))}),n.headers.forEach(function(a,h){c.indexOf(h)===-1&&r.setRequestHeader(h,a)})}else n.headers.forEach(function(a,h){r.setRequestHeader(h,a)});n.signal&&(n.signal.addEventListener("abort",w),r.onreadystatechange=function(){r.readyState===4&&n.signal.removeEventListener("abort",w)}),r.send(n._bodyInit===void 0?null:n._bodyInit)})}T.polyfill=!0,u.fetch||(u.fetch=T,u.Headers=i,u.Request=d,u.Response=f),(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof g<"u"&&g||{fetch:null}).fetch=T;const V=H({__proto__:null,default:x},[x]);export{V as _}; diff --git a/assets/__bundle-c839c84a-DKk4eUg2.js b/assets/__bundle-c839c84a-ByicuUPg.js similarity index 95% rename from assets/__bundle-c839c84a-DKk4eUg2.js rename to assets/__bundle-c839c84a-ByicuUPg.js index 84e2f59ea..d42492c07 100644 --- a/assets/__bundle-c839c84a-DKk4eUg2.js +++ b/assets/__bundle-c839c84a-ByicuUPg.js @@ -1 +1 @@ -import{j as y,v as s,R as L,x as g,M,X,z as b,J as I}from"./index-CU1i2Szq.js";var N=function(i,n){return new Promise(function(w,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),a=d.dispatcher,m=d.logger,p=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,c=n.data,x=c===void 0?"":c,l=n.uploadProgressHandler,h=!1,e=new XMLHttpRequest;e.open(E,R),Object.keys(f).forEach(function(t){e.setRequestHeader(t,f[t])}),l&&e.upload.addEventListener("progress",function(t){t.lengthComputable?l(p,t.loaded,t.total):m.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(s.requestCanceled)},e.onerror=function(t){r(s.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!h)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);w(new L(i,t))}catch{r(s.networkError)}else try{var q=JSON.parse(e.responseText);if(q){var o=new s(q);if(o.isSessionExpiredError){if(a.dispatch(new g({reason:o.code})),!(e instanceof M)){var v=new X;return a.dispatch(new b({request:e,deferred:v,error:o})),v.promise}}else o.isSessionInvalidatedError&&a.dispatch(new g({reason:o.code}));r(o)}else r(s.requestFailed)}catch{r(s.requestFailed)}},a.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==p||(h=!0,e.abort()))}),e.send(x)}else r(s.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; +import{j as y,v as s,R as L,x as g,M,X,z as b,J as I}from"./index-CJmidR1i.js";var N=function(i,n){return new Promise(function(w,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),a=d.dispatcher,m=d.logger,p=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,c=n.data,x=c===void 0?"":c,l=n.uploadProgressHandler,h=!1,e=new XMLHttpRequest;e.open(E,R),Object.keys(f).forEach(function(t){e.setRequestHeader(t,f[t])}),l&&e.upload.addEventListener("progress",function(t){t.lengthComputable?l(p,t.loaded,t.total):m.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(s.requestCanceled)},e.onerror=function(t){r(s.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!h)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);w(new L(i,t))}catch{r(s.networkError)}else try{var q=JSON.parse(e.responseText);if(q){var o=new s(q);if(o.isSessionExpiredError){if(a.dispatch(new g({reason:o.code})),!(e instanceof M)){var v=new X;return a.dispatch(new b({request:e,deferred:v,error:o})),v.promise}}else o.isSessionInvalidatedError&&a.dispatch(new g({reason:o.code}));r(o)}else r(s.requestFailed)}catch{r(s.requestFailed)}},a.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==p||(h=!0,e.abort()))}),e.send(x)}else r(s.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; diff --git a/assets/index-CU1i2Szq.js b/assets/index-CJmidR1i.js similarity index 95% rename from assets/index-CU1i2Szq.js rename to assets/index-CJmidR1i.js index e02ece0a6..d80ed199c 100644 --- a/assets/index-CU1i2Szq.js +++ b/assets/index-CJmidR1i.js @@ -1,4 +1,4 @@ -(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var Tj=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Af(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AE={exports:{}},Mf={},ME={exports:{}},ht={};/** +(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var Tj=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function If(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AE={exports:{}},Af={},ME={exports:{}},ht={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Bc=Symbol.for("react.element"),sw=Symbol.for("react.portal"),ow=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),lw=Symbol.for("react.profiler"),uw=Symbol.for("react.provider"),cw=Symbol.for("react.context"),dw=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),fw=Symbol.for("react.memo"),pw=Symbol.for("react.lazy"),Ag=Symbol.iterator;function _w(e){return e===null||typeof e!="object"?null:(e=Ag&&e[Ag]||e["@@iterator"],typeof e=="function"?e:null)}var xE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},OE=Object.assign,kE={};function zl(e,n,t){this.props=e,this.context=n,this.refs=kE,this.updater=t||xE}zl.prototype.isReactComponent={};zl.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")};zl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function RE(){}RE.prototype=zl.prototype;function Dm(e,n,t){this.props=e,this.context=n,this.refs=kE,this.updater=t||xE}var Um=Dm.prototype=new RE;Um.constructor=Dm;OE(Um,zl.prototype);Um.isPureReactComponent=!0;var Mg=Array.isArray,LE=Object.prototype.hasOwnProperty,Pm={current:null},DE={key:!0,ref:!0,__self:!0,__source:!0};function UE(e,n,t){var r,i={},s=null,o=null;if(n!=null)for(r in n.ref!==void 0&&(o=n.ref),n.key!==void 0&&(s=""+n.key),n)LE.call(n,r)&&!DE.hasOwnProperty(r)&&(i[r]=n[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kp=Object.prototype.hasOwnProperty,Aw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Og={},kg={};function Mw(e){return Kp.call(kg,e)?!0:Kp.call(Og,e)?!1:Aw.test(e)?kg[e]=!0:(Og[e]=!0,!1)}function xw(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ow(e,n,t,r){if(n===null||typeof n>"u"||xw(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function Hr(e,n,t,r,i,s,o){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=s,this.removeEmptyString=o}var mr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mr[e]=new Hr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];mr[n]=new Hr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){mr[e]=new Hr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mr[e]=new Hr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mr[e]=new Hr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){mr[e]=new Hr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){mr[e]=new Hr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){mr[e]=new Hr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){mr[e]=new Hr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Hm=/[\-:]([a-z])/g;function jm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){mr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!1,!1)});mr.xlinkHref=new Hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){mr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bm(e,n,t,r){var i=mr.hasOwnProperty(n)?mr[n]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kp=Object.prototype.hasOwnProperty,Aw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Og={},kg={};function Mw(e){return Kp.call(kg,e)?!0:Kp.call(Og,e)?!1:Aw.test(e)?kg[e]=!0:(Og[e]=!0,!1)}function xw(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ow(e,n,t,r){if(n===null||typeof n>"u"||xw(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function Hr(e,n,t,r,i,s,o){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=s,this.removeEmptyString=o}var mr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mr[e]=new Hr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];mr[n]=new Hr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){mr[e]=new Hr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mr[e]=new Hr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mr[e]=new Hr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){mr[e]=new Hr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){mr[e]=new Hr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){mr[e]=new Hr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){mr[e]=new Hr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Hm=/[\-:]([a-z])/g;function jm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(Hm,jm);mr[n]=new Hr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){mr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!1,!1)});mr.xlinkHref=new Hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){mr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bm(e,n,t,r){var i=mr.hasOwnProperty(n)?mr[n]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{M0=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?bu(e):""}function kw(e){switch(e.tag){case 5:return bu(e.type);case 16:return bu("Lazy");case 13:return bu("Suspense");case 19:return bu("SuspenseList");case 0:case 2:case 15:return e=x0(e.type,!1),e;case 11:return e=x0(e.type.render,!1),e;case 1:return e=x0(e.type,!0),e;default:return""}}function Xp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ja:return"Fragment";case Xa:return"Portal";case Qp:return"Profiler";case $m:return"StrictMode";case Yp:return"Suspense";case Zp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zE:return(e.displayName||"Context")+".Consumer";case GE:return(e._context.displayName||"Context")+".Provider";case Gm:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zm:return n=e.displayName||null,n!==null?n:Xp(e.type)||"Memo";case Js:n=e._payload,e=e._init;try{return Xp(e(n))}catch{}}return null}function Rw(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xp(n);case 8:return n===$m?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Mo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qE(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Lw(e){var n=qE(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function od(e){e._valueTracker||(e._valueTracker=Lw(e))}function WE(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=qE(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function Ch(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jp(e,n){var t=n.checked;return an({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Lg(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=Mo(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function KE(e,n){n=n.checked,n!=null&&Bm(e,"checked",n,!1)}function e_(e,n){KE(e,n);var t=Mo(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?t_(e,n.type,t):n.hasOwnProperty("defaultValue")&&t_(e,n.type,Mo(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Dg(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function t_(e,n,t){(n!=="number"||Ch(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var Cu=Array.isArray;function _l(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=ad.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function pc(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Lu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dw=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(e){Dw.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Lu[n]=Lu[e]})});function XE(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Lu.hasOwnProperty(e)&&Lu[e]?(""+n).trim():n+"px"}function JE(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=XE(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var Uw=an({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function i_(e,n){if(n){if(Uw[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(Te(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(Te(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(Te(61))}if(n.style!=null&&typeof n.style!="object")throw Error(Te(62))}}function s_(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var o_=null;function Vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a_=null,ml=null,vl=null;function Fg(e){if(e=zc(e)){if(typeof a_!="function")throw Error(Te(280));var n=e.stateNode;n&&(n=Lf(n),a_(e.stateNode,e.type,n))}}function e3(e){ml?vl?vl.push(e):vl=[e]:ml=e}function t3(){if(ml){var e=ml,n=vl;if(vl=ml=null,Fg(e),n)for(e=0;e>>=0,e===0?32:31-(Ww(e)/Kw|0)|0}var ld=64,ud=4194304;function Su(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nh(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=Su(a):(s&=o,s!==0&&(r=Su(s)))}else o=t&~i,o!==0?r=Su(o):s!==0&&(r=Su(s));if(r===0)return 0;if(n!==0&&n!==r&&!(n&i)&&(i=r&-r,s=n&-n,i>=s||i===16&&(s&4194240)!==0))return n;if(r&4&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function $c(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Vi(n),e[n]=t}function Xw(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Uu),Wg=" ",Kg=!1;function b3(e,n){switch(e){case"keyup":return NN.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function C3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var el=!1;function AN(e,n){switch(e){case"compositionend":return C3(n);case"keypress":return n.which!==32?null:(Kg=!0,Wg);case"textInput":return e=n.data,e===Wg&&Kg?null:e;default:return null}}function MN(e,n){if(el)return e==="compositionend"||!Jm&&b3(e,n)?(e=y3(),Xd=Ym=ao=null,el=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Xg(t)}}function N3(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?N3(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function I3(){for(var e=window,n=Ch();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Ch(e.document)}return n}function ev(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function FN(e){var n=I3(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&N3(t.ownerDocument.documentElement,t)){if(r!==null&&ev(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Jg(t,s);var o=Jg(t,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(n=n.createRange(),n.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(n),e.extend(o.node,o.offset)):(n.setEnd(o.node,o.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,tl=null,f_=null,Fu=null,p_=!1;function e2(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;p_||tl==null||tl!==Ch(r)||(r=tl,"selectionStart"in r&&ev(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fu&&Ec(Fu,r)||(Fu=r,r=Mh(f_,"onSelect"),0il||(e.current=E_[il],E_[il]=null,il--)}function $t(e,n){il++,E_[il]=e.current,e.current=n}var xo={},Nr=Lo(xo),qr=Lo(!1),ga=xo;function wl(e,n){var t=e.type.contextTypes;if(!t)return xo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=n[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=i),i}function Wr(e){return e=e.childContextTypes,e!=null}function Oh(){qt(qr),qt(Nr)}function a2(e,n,t){if(Nr.current!==xo)throw Error(Te(168));$t(Nr,n),$t(qr,t)}function U3(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in n))throw Error(Te(108,Rw(e)||"Unknown",i));return an({},t,r)}function kh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xo,ga=Nr.current,$t(Nr,e),$t(qr,qr.current),!0}function l2(e,n,t){var r=e.stateNode;if(!r)throw Error(Te(169));t?(e=U3(e,n,ga),r.__reactInternalMemoizedMergedChildContext=e,qt(qr),qt(Nr),$t(Nr,e)):qt(qr),$t(qr,t)}var As=null,Df=!1,z0=!1;function P3(e){As===null?As=[e]:As.push(e)}function YN(e){Df=!0,P3(e)}function Do(){if(!z0&&As!==null){z0=!0;var e=0,n=At;try{var t=As;for(At=1;e>=o,i-=o,ks=1<<32-Vi(n)+i|t<R?(A=I,I=null):A=I.sibling;var x=h(v,I,E[R],S);if(x===null){I===null&&(I=A);break}e&&I&&x.alternate===null&&n(v,I),_=s(x,_,R),N===null?w=x:N.sibling=x,N=x,I=A}if(R===E.length)return t(v,I),Xt&&$o(v,R),w;if(I===null){for(;RR?(A=I,I=null):A=I.sibling;var U=h(v,I,x.value,S);if(U===null){I===null&&(I=A);break}e&&I&&U.alternate===null&&n(v,I),_=s(U,_,R),N===null?w=U:N.sibling=U,N=U,I=A}if(x.done)return t(v,I),Xt&&$o(v,R),w;if(I===null){for(;!x.done;R++,x=E.next())x=d(v,x.value,S),x!==null&&(_=s(x,_,R),N===null?w=x:N.sibling=x,N=x);return Xt&&$o(v,R),w}for(I=r(v,I);!x.done;R++,x=E.next())x=f(I,v,R,x.value,S),x!==null&&(e&&x.alternate!==null&&I.delete(x.key===null?R:x.key),_=s(x,_,R),N===null?w=x:N.sibling=x,N=x);return e&&I.forEach(function(q){return n(v,q)}),Xt&&$o(v,R),w}function b(v,_,E,S){if(typeof E=="object"&&E!==null&&E.type===Ja&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case sd:e:{for(var w=E.key,N=_;N!==null;){if(N.key===w){if(w=E.type,w===Ja){if(N.tag===7){t(v,N.sibling),_=i(N,E.props.children),_.return=v,v=_;break e}}else if(N.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Js&&d2(w)===N.type){t(v,N.sibling),_=i(N,E.props),_.ref=iu(v,N,E),_.return=v,v=_;break e}t(v,N);break}else n(v,N);N=N.sibling}E.type===Ja?(_=da(E.props.children,v.mode,S,E.key),_.return=v,v=_):(S=oh(E.type,E.key,E.props,null,v.mode,S),S.ref=iu(v,_,E),S.return=v,v=S)}return o(v);case Xa:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(v,_.sibling),_=i(_,E.children||[]),_.return=v,v=_;break e}else{t(v,_);break}else n(v,_);_=_.sibling}_=X0(E,v.mode,S),_.return=v,v=_}return o(v);case Js:return N=E._init,b(v,_,N(E._payload),S)}if(Cu(E))return p(v,_,E,S);if(Jl(E))return m(v,_,E,S);md(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(v,_.sibling),_=i(_,E),_.return=v,v=_):(t(v,_),_=Z0(E,v.mode,S),_.return=v,v=_),o(v)):t(v,_)}return b}var Il=B3(!0),$3=B3(!1),Dh=Lo(null),Uh=null,al=null,iv=null;function sv(){iv=al=Uh=null}function ov(e){var n=Dh.current;qt(Dh),e._currentValue=n}function S_(e,n,t){for(;e!==null;){var r=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,r!==null&&(r.childLanes|=n)):r!==null&&(r.childLanes&n)!==n&&(r.childLanes|=n),e===t)break;e=e.return}}function yl(e,n){Uh=e,iv=al=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(Vr=!0),e.firstContext=null)}function Mi(e){var n=e._currentValue;if(iv!==e)if(e={context:e,memoizedValue:n,next:null},al===null){if(Uh===null)throw Error(Te(308));al=e,Uh.dependencies={lanes:0,firstContext:e}}else al=al.next=e;return n}var Jo=null;function av(e){Jo===null?Jo=[e]:Jo.push(e)}function G3(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,av(n)):(t.next=i.next,i.next=t),n.interleaved=t,js(e,r)}function js(e,n){e.lanes|=n;var t=e.alternate;for(t!==null&&(t.lanes|=n),t=e,e=e.return;e!==null;)e.childLanes|=n,t=e.alternate,t!==null&&(t.childLanes|=n),t=e,e=e.return;return t.tag===3?t.stateNode:null}var eo=!1;function lv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function z3(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ds(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function mo(e,n,t){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,pt&2){var i=r.pending;return i===null?n.next=n:(n.next=i.next,i.next=n),r.pending=n,js(e,t)}return i=r.interleaved,i===null?(n.next=n,av(r)):(n.next=i.next,i.next=n),r.interleaved=n,js(e,t)}function eh(e,n,t){if(n=n.updateQueue,n!==null&&(n=n.shared,(t&4194240)!==0)){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Wm(e,t)}}function h2(e,n){var t=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=n:s=s.next=n}else i=s=n;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=t;return}e=t.lastBaseUpdate,e===null?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}function Ph(e,n,t,r){var i=e.updateQueue;eo=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,c=u=l=null,a=s;do{var h=a.lane,f=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,m=a;switch(h=n,f=t,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,h=typeof p=="function"?p.call(f,d,h):p,h==null)break e;d=an({},d,h);break e;case 2:eo=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=d):c=c.next=f,o|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,n=i.shared.interleaved,n!==null){i=n;do o|=i.lane,i=i.next;while(i!==n)}else s===null&&(i.shared.lanes=0);ba|=o,e.lanes=o,e.memoizedState=d}}function f2(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=q0.transition;q0.transition={};try{e(!1),n()}finally{At=t,q0.transition=r}}function ab(){return xi().memoizedState}function eI(e,n,t){var r=go(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},lb(e))ub(n,t);else if(t=G3(e,n,t,r),t!==null){var i=Dr();qi(t,e,r,i),cb(t,n,r)}}function tI(e,n,t){var r=go(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(lb(e))ub(n,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=n.lastRenderedReducer,s!==null))try{var o=n.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,Ki(a,o)){var l=n.interleaved;l===null?(i.next=i,av(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=G3(e,n,i,r),t!==null&&(i=Dr(),qi(t,e,r,i),cb(t,n,r))}}function lb(e){var n=e.alternate;return e===on||n!==null&&n===on}function ub(e,n){Hu=Hh=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function cb(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Wm(e,t)}}var jh={readContext:Mi,useCallback:yr,useContext:yr,useEffect:yr,useImperativeHandle:yr,useInsertionEffect:yr,useLayoutEffect:yr,useMemo:yr,useReducer:yr,useRef:yr,useState:yr,useDebugValue:yr,useDeferredValue:yr,useTransition:yr,useMutableSource:yr,useSyncExternalStore:yr,useId:yr,unstable_isNewReconciler:!1},nI={readContext:Mi,useCallback:function(e,n){return ts().memoizedState=[e,n===void 0?null:n],e},useContext:Mi,useEffect:_2,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,nh(4194308,4,nb.bind(null,n,e),t)},useLayoutEffect:function(e,n){return nh(4194308,4,e,n)},useInsertionEffect:function(e,n){return nh(4,2,e,n)},useMemo:function(e,n){var t=ts();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=ts();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=eI.bind(null,on,e),[r.memoizedState,e]},useRef:function(e){var n=ts();return e={current:e},n.memoizedState=e},useState:p2,useDebugValue:mv,useDeferredValue:function(e){return ts().memoizedState=e},useTransition:function(){var e=p2(!1),n=e[0];return e=JN.bind(null,e[1]),ts().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=on,i=ts();if(Xt){if(t===void 0)throw Error(Te(407));t=t()}else{if(t=n(),tr===null)throw Error(Te(349));Ea&30||K3(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,_2(Y3.bind(null,r,s,e),[e]),r.flags|=2048,Ac(9,Q3.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=ts(),n=tr.identifierPrefix;if(Xt){var t=Rs,r=ks;t=(r&~(1<<32-Vi(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=Nc++,0")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{M0=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?bu(e):""}function kw(e){switch(e.tag){case 5:return bu(e.type);case 16:return bu("Lazy");case 13:return bu("Suspense");case 19:return bu("SuspenseList");case 0:case 2:case 15:return e=x0(e.type,!1),e;case 11:return e=x0(e.type.render,!1),e;case 1:return e=x0(e.type,!0),e;default:return""}}function Xp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ja:return"Fragment";case Xa:return"Portal";case Qp:return"Profiler";case $m:return"StrictMode";case Yp:return"Suspense";case Zp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zE:return(e.displayName||"Context")+".Consumer";case GE:return(e._context.displayName||"Context")+".Provider";case Gm:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case zm:return n=e.displayName||null,n!==null?n:Xp(e.type)||"Memo";case Js:n=e._payload,e=e._init;try{return Xp(e(n))}catch{}}return null}function Rw(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xp(n);case 8:return n===$m?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Mo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qE(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Lw(e){var n=qE(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function sd(e){e._valueTracker||(e._valueTracker=Lw(e))}function WE(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=qE(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function bh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jp(e,n){var t=n.checked;return an({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Lg(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=Mo(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function KE(e,n){n=n.checked,n!=null&&Bm(e,"checked",n,!1)}function e_(e,n){KE(e,n);var t=Mo(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?t_(e,n.type,t):n.hasOwnProperty("defaultValue")&&t_(e,n.type,Mo(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Dg(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function t_(e,n,t){(n!=="number"||bh(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var Cu=Array.isArray;function _l(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=od.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function pc(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Lu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dw=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(e){Dw.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Lu[n]=Lu[e]})});function XE(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Lu.hasOwnProperty(e)&&Lu[e]?(""+n).trim():n+"px"}function JE(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=XE(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var Uw=an({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function i_(e,n){if(n){if(Uw[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(Te(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(Te(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(Te(61))}if(n.style!=null&&typeof n.style!="object")throw Error(Te(62))}}function s_(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var o_=null;function Vm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var a_=null,ml=null,vl=null;function Fg(e){if(e=zc(e)){if(typeof a_!="function")throw Error(Te(280));var n=e.stateNode;n&&(n=Rf(n),a_(e.stateNode,e.type,n))}}function e3(e){ml?vl?vl.push(e):vl=[e]:ml=e}function t3(){if(ml){var e=ml,n=vl;if(vl=ml=null,Fg(e),n)for(e=0;e>>=0,e===0?32:31-(Ww(e)/Kw|0)|0}var ad=64,ld=4194304;function Su(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wh(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=Su(a):(s&=o,s!==0&&(r=Su(s)))}else o=t&~i,o!==0?r=Su(o):s!==0&&(r=Su(s));if(r===0)return 0;if(n!==0&&n!==r&&!(n&i)&&(i=r&-r,s=n&-n,i>=s||i===16&&(s&4194240)!==0))return n;if(r&4&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function $c(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Vi(n),e[n]=t}function Xw(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Uu),Wg=" ",Kg=!1;function b3(e,n){switch(e){case"keyup":return NN.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function C3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var el=!1;function AN(e,n){switch(e){case"compositionend":return C3(n);case"keypress":return n.which!==32?null:(Kg=!0,Wg);case"textInput":return e=n.data,e===Wg&&Kg?null:e;default:return null}}function MN(e,n){if(el)return e==="compositionend"||!Jm&&b3(e,n)?(e=y3(),Zd=Ym=ao=null,el=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Xg(t)}}function N3(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?N3(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function I3(){for(var e=window,n=bh();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=bh(e.document)}return n}function ev(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function FN(e){var n=I3(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&N3(t.ownerDocument.documentElement,t)){if(r!==null&&ev(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Jg(t,s);var o=Jg(t,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(n=n.createRange(),n.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(n),e.extend(o.node,o.offset)):(n.setEnd(o.node,o.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,tl=null,f_=null,Fu=null,p_=!1;function e2(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;p_||tl==null||tl!==bh(r)||(r=tl,"selectionStart"in r&&ev(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fu&&Ec(Fu,r)||(Fu=r,r=Ah(f_,"onSelect"),0il||(e.current=E_[il],E_[il]=null,il--)}function $t(e,n){il++,E_[il]=e.current,e.current=n}var xo={},Nr=Lo(xo),qr=Lo(!1),ga=xo;function wl(e,n){var t=e.type.contextTypes;if(!t)return xo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=n[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=i),i}function Wr(e){return e=e.childContextTypes,e!=null}function xh(){qt(qr),qt(Nr)}function a2(e,n,t){if(Nr.current!==xo)throw Error(Te(168));$t(Nr,n),$t(qr,t)}function U3(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in n))throw Error(Te(108,Rw(e)||"Unknown",i));return an({},t,r)}function Oh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xo,ga=Nr.current,$t(Nr,e),$t(qr,qr.current),!0}function l2(e,n,t){var r=e.stateNode;if(!r)throw Error(Te(169));t?(e=U3(e,n,ga),r.__reactInternalMemoizedMergedChildContext=e,qt(qr),qt(Nr),$t(Nr,e)):qt(qr),$t(qr,t)}var As=null,Lf=!1,z0=!1;function P3(e){As===null?As=[e]:As.push(e)}function YN(e){Lf=!0,P3(e)}function Do(){if(!z0&&As!==null){z0=!0;var e=0,n=At;try{var t=As;for(At=1;e>=o,i-=o,ks=1<<32-Vi(n)+i|t<R?(A=I,I=null):A=I.sibling;var x=h(v,I,E[R],S);if(x===null){I===null&&(I=A);break}e&&I&&x.alternate===null&&n(v,I),_=s(x,_,R),N===null?w=x:N.sibling=x,N=x,I=A}if(R===E.length)return t(v,I),Xt&&$o(v,R),w;if(I===null){for(;RR?(A=I,I=null):A=I.sibling;var U=h(v,I,x.value,S);if(U===null){I===null&&(I=A);break}e&&I&&U.alternate===null&&n(v,I),_=s(U,_,R),N===null?w=U:N.sibling=U,N=U,I=A}if(x.done)return t(v,I),Xt&&$o(v,R),w;if(I===null){for(;!x.done;R++,x=E.next())x=d(v,x.value,S),x!==null&&(_=s(x,_,R),N===null?w=x:N.sibling=x,N=x);return Xt&&$o(v,R),w}for(I=r(v,I);!x.done;R++,x=E.next())x=f(I,v,R,x.value,S),x!==null&&(e&&x.alternate!==null&&I.delete(x.key===null?R:x.key),_=s(x,_,R),N===null?w=x:N.sibling=x,N=x);return e&&I.forEach(function(q){return n(v,q)}),Xt&&$o(v,R),w}function b(v,_,E,S){if(typeof E=="object"&&E!==null&&E.type===Ja&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case id:e:{for(var w=E.key,N=_;N!==null;){if(N.key===w){if(w=E.type,w===Ja){if(N.tag===7){t(v,N.sibling),_=i(N,E.props.children),_.return=v,v=_;break e}}else if(N.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Js&&d2(w)===N.type){t(v,N.sibling),_=i(N,E.props),_.ref=iu(v,N,E),_.return=v,v=_;break e}t(v,N);break}else n(v,N);N=N.sibling}E.type===Ja?(_=da(E.props.children,v.mode,S,E.key),_.return=v,v=_):(S=sh(E.type,E.key,E.props,null,v.mode,S),S.ref=iu(v,_,E),S.return=v,v=S)}return o(v);case Xa:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(v,_.sibling),_=i(_,E.children||[]),_.return=v,v=_;break e}else{t(v,_);break}else n(v,_);_=_.sibling}_=X0(E,v.mode,S),_.return=v,v=_}return o(v);case Js:return N=E._init,b(v,_,N(E._payload),S)}if(Cu(E))return p(v,_,E,S);if(Jl(E))return m(v,_,E,S);_d(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(v,_.sibling),_=i(_,E),_.return=v,v=_):(t(v,_),_=Z0(E,v.mode,S),_.return=v,v=_),o(v)):t(v,_)}return b}var Il=B3(!0),$3=B3(!1),Lh=Lo(null),Dh=null,al=null,iv=null;function sv(){iv=al=Dh=null}function ov(e){var n=Lh.current;qt(Lh),e._currentValue=n}function S_(e,n,t){for(;e!==null;){var r=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,r!==null&&(r.childLanes|=n)):r!==null&&(r.childLanes&n)!==n&&(r.childLanes|=n),e===t)break;e=e.return}}function yl(e,n){Dh=e,iv=al=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(Vr=!0),e.firstContext=null)}function Mi(e){var n=e._currentValue;if(iv!==e)if(e={context:e,memoizedValue:n,next:null},al===null){if(Dh===null)throw Error(Te(308));al=e,Dh.dependencies={lanes:0,firstContext:e}}else al=al.next=e;return n}var Jo=null;function av(e){Jo===null?Jo=[e]:Jo.push(e)}function G3(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,av(n)):(t.next=i.next,i.next=t),n.interleaved=t,js(e,r)}function js(e,n){e.lanes|=n;var t=e.alternate;for(t!==null&&(t.lanes|=n),t=e,e=e.return;e!==null;)e.childLanes|=n,t=e.alternate,t!==null&&(t.childLanes|=n),t=e,e=e.return;return t.tag===3?t.stateNode:null}var eo=!1;function lv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function z3(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ds(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function mo(e,n,t){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,pt&2){var i=r.pending;return i===null?n.next=n:(n.next=i.next,i.next=n),r.pending=n,js(e,t)}return i=r.interleaved,i===null?(n.next=n,av(r)):(n.next=i.next,i.next=n),r.interleaved=n,js(e,t)}function Jd(e,n,t){if(n=n.updateQueue,n!==null&&(n=n.shared,(t&4194240)!==0)){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Wm(e,t)}}function h2(e,n){var t=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=n:s=s.next=n}else i=s=n;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=t;return}e=t.lastBaseUpdate,e===null?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}function Uh(e,n,t,r){var i=e.updateQueue;eo=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,c=u=l=null,a=s;do{var h=a.lane,f=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,m=a;switch(h=n,f=t,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,h=typeof p=="function"?p.call(f,d,h):p,h==null)break e;d=an({},d,h);break e;case 2:eo=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=f,l=d):c=c.next=f,o|=h;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;h=a,a=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,n=i.shared.interleaved,n!==null){i=n;do o|=i.lane,i=i.next;while(i!==n)}else s===null&&(i.shared.lanes=0);ba|=o,e.lanes=o,e.memoizedState=d}}function f2(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=q0.transition;q0.transition={};try{e(!1),n()}finally{At=t,q0.transition=r}}function ab(){return xi().memoizedState}function eI(e,n,t){var r=go(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},lb(e))ub(n,t);else if(t=G3(e,n,t,r),t!==null){var i=Dr();qi(t,e,r,i),cb(t,n,r)}}function tI(e,n,t){var r=go(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(lb(e))ub(n,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=n.lastRenderedReducer,s!==null))try{var o=n.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,Ki(a,o)){var l=n.interleaved;l===null?(i.next=i,av(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=G3(e,n,i,r),t!==null&&(i=Dr(),qi(t,e,r,i),cb(t,n,r))}}function lb(e){var n=e.alternate;return e===on||n!==null&&n===on}function ub(e,n){Hu=Fh=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function cb(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Wm(e,t)}}var Hh={readContext:Mi,useCallback:yr,useContext:yr,useEffect:yr,useImperativeHandle:yr,useInsertionEffect:yr,useLayoutEffect:yr,useMemo:yr,useReducer:yr,useRef:yr,useState:yr,useDebugValue:yr,useDeferredValue:yr,useTransition:yr,useMutableSource:yr,useSyncExternalStore:yr,useId:yr,unstable_isNewReconciler:!1},nI={readContext:Mi,useCallback:function(e,n){return ts().memoizedState=[e,n===void 0?null:n],e},useContext:Mi,useEffect:_2,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,th(4194308,4,nb.bind(null,n,e),t)},useLayoutEffect:function(e,n){return th(4194308,4,e,n)},useInsertionEffect:function(e,n){return th(4,2,e,n)},useMemo:function(e,n){var t=ts();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=ts();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=eI.bind(null,on,e),[r.memoizedState,e]},useRef:function(e){var n=ts();return e={current:e},n.memoizedState=e},useState:p2,useDebugValue:mv,useDeferredValue:function(e){return ts().memoizedState=e},useTransition:function(){var e=p2(!1),n=e[0];return e=JN.bind(null,e[1]),ts().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=on,i=ts();if(Xt){if(t===void 0)throw Error(Te(407));t=t()}else{if(t=n(),tr===null)throw Error(Te(349));Ea&30||K3(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,_2(Y3.bind(null,r,s,e),[e]),r.flags|=2048,Ac(9,Q3.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=ts(),n=tr.identifierPrefix;if(Xt){var t=Rs,r=ks;t=(r&~(1<<32-Vi(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=Nc++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(t,{is:r.is}):(e=o.createElement(t),t==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,t),e[os]=n,e[Sc]=r,Eb(e,n,!1,!1),n.stateNode=e;e:{switch(o=s_(t,r),t){case"dialog":Gt("cancel",e),Gt("close",e),i=r;break;case"iframe":case"object":case"embed":Gt("load",e),i=r;break;case"video":case"audio":for(i=0;ixl&&(n.flags|=128,r=!0,su(s,!1),n.lanes=4194304)}else{if(!r)if(e=Fh(o),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),su(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Xt)return Er(n),null}else 2*Mn()-s.renderingStartTime>xl&&t!==1073741824&&(n.flags|=128,r=!0,su(s,!1),n.lanes=4194304);s.isBackwards?(o.sibling=n.child,n.child=o):(t=s.last,t!==null?t.sibling=o:n.child=o,s.last=o)}return s.tail!==null?(n=s.tail,s.rendering=n,s.tail=n.sibling,s.renderingStartTime=Mn(),n.sibling=null,t=sn.current,$t(sn,r?t&1|2:t&1),n):(Er(n),null);case 22:case 23:return Cv(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?ei&1073741824&&(Er(n),n.subtreeFlags&6&&(n.flags|=8192)):Er(n),null;case 24:return null;case 25:return null}throw Error(Te(156,n.tag))}function cI(e,n){switch(nv(n),n.tag){case 1:return Wr(n.type)&&Oh(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Al(),qt(qr),qt(Nr),dv(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return cv(n),null;case 13:if(qt(sn),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(Te(340));Nl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return qt(sn),null;case 4:return Al(),null;case 10:return ov(n.type._context),null;case 22:case 23:return Cv(),null;case 24:return null;default:return null}}var gd=!1,Sr=!1,dI=typeof WeakSet=="function"?WeakSet:Set,He=null;function ll(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){pn(e,n,r)}else t.current=null}function k_(e,n,t){try{t()}catch(r){pn(e,n,r)}}var N2=!1;function hI(e,n){if(__=Ih,e=I3(),ev(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==t||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===e)break t;if(h===t&&++u===i&&(a=o),h===s&&++c===r&&(l=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(m_={focusedElem:e,selectionRange:t},Ih=!1,He=n;He!==null;)if(n=He,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,He=e;else for(;He!==null;){n=He;try{var p=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,v=n.stateNode,_=v.getSnapshotBeforeUpdate(n.elementType===n.type?m:Bi(n.type,m),b);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var E=n.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Te(163))}}catch(S){pn(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,He=e;break}He=n.return}return p=N2,N2=!1,p}function ju(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&k_(n,t,s)}i=i.next}while(i!==r)}}function Ff(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function R_(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function Sb(e){var n=e.alternate;n!==null&&(e.alternate=null,Sb(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[os],delete n[Sc],delete n[y_],delete n[KN],delete n[QN])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tb(e){return e.tag===5||e.tag===3||e.tag===4}function I2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function L_(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=xh));else if(r!==4&&(e=e.child,e!==null))for(L_(e,n,t),e=e.sibling;e!==null;)L_(e,n,t),e=e.sibling}function D_(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(D_(e,n,t),e=e.sibling;e!==null;)D_(e,n,t),e=e.sibling}var ur=null,$i=!1;function Ws(e,n,t){for(t=t.child;t!==null;)wb(e,n,t),t=t.sibling}function wb(e,n,t){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(xf,t)}catch{}switch(t.tag){case 5:Sr||ll(t,n);case 6:var r=ur,i=$i;ur=null,Ws(e,n,t),ur=r,$i=i,ur!==null&&($i?(e=ur,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):ur.removeChild(t.stateNode));break;case 18:ur!==null&&($i?(e=ur,t=t.stateNode,e.nodeType===8?G0(e.parentNode,t):e.nodeType===1&&G0(e,t),gc(e)):G0(ur,t.stateNode));break;case 4:r=ur,i=$i,ur=t.stateNode.containerInfo,$i=!0,Ws(e,n,t),ur=r,$i=i;break;case 0:case 11:case 14:case 15:if(!Sr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&k_(t,n,o),i=i.next}while(i!==r)}Ws(e,n,t);break;case 1:if(!Sr&&(ll(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){pn(t,n,a)}Ws(e,n,t);break;case 21:Ws(e,n,t);break;case 22:t.mode&1?(Sr=(r=Sr)||t.memoizedState!==null,Ws(e,n,t),Sr=r):Ws(e,n,t);break;default:Ws(e,n,t)}}function A2(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new dI),n.forEach(function(r){var i=bI.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Di(e,n){var t=n.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Mn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pI(r/1960))-r,10e?16:e,lo===null)var r=!1;else{if(e=lo,lo=null,Gh=0,pt&6)throw Error(Te(331));var i=pt;for(pt|=4,He=e.current;He!==null;){var s=He,o=s.child;if(He.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lMn()-Ev?ca(e,0):yv|=t),Kr(e,n)}function Rb(e,n){n===0&&(e.mode&1?(n=ud,ud<<=1,!(ud&130023424)&&(ud=4194304)):n=1);var t=Dr();e=js(e,n),e!==null&&($c(e,n,t),Kr(e,t))}function EI(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Rb(e,t)}function bI(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Te(314))}r!==null&&r.delete(n),Rb(e,t)}var Lb;Lb=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||qr.current)Vr=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return Vr=!1,lI(e,n,t);Vr=!!(e.flags&131072)}else Vr=!1,Xt&&n.flags&1048576&&F3(n,Lh,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;rh(e,n),e=n.pendingProps;var i=wl(n,Nr.current);yl(n,t),i=fv(null,n,r,e,i,t);var s=pv();return n.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Wr(r)?(s=!0,kh(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,lv(n),i.updater=Pf,n.stateNode=i,i._reactInternals=n,w_(n,r,e,t),n=A_(null,n,r,!0,s,t)):(n.tag=0,Xt&&s&&tv(n),xr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(rh(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=SI(r),e=Bi(r,e),i){case 0:n=I_(null,n,r,e,t);break e;case 1:n=S2(null,n,r,e,t);break e;case 11:n=b2(null,n,r,e,t);break e;case 14:n=C2(null,n,r,Bi(r.type,e),t);break e}throw Error(Te(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),I_(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),S2(e,n,r,i,t);case 3:e:{if(vb(n),e===null)throw Error(Te(387));r=n.pendingProps,s=n.memoizedState,i=s.element,z3(e,n),Ph(n,r,null,t);var o=n.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},n.updateQueue.baseState=s,n.memoizedState=s,n.flags&256){i=Ml(Error(Te(423)),n),n=T2(e,n,r,t,i);break e}else if(r!==i){i=Ml(Error(Te(424)),n),n=T2(e,n,r,t,i);break e}else for(oi=_o(n.stateNode.containerInfo.firstChild),li=n,Xt=!0,Gi=null,t=$3(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Nl(),r===i){n=Bs(e,n,t);break e}xr(e,n,r,t)}n=n.child}return n;case 5:return V3(n),e===null&&C_(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,v_(r,i)?o=null:s!==null&&v_(r,s)&&(n.flags|=32),mb(e,n),xr(e,n,o,t),n.child;case 6:return e===null&&C_(n),null;case 13:return gb(e,n,t);case 4:return uv(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=Il(n,null,r,t):xr(e,n,r,t),n.child;case 11:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),b2(e,n,r,i,t);case 7:return xr(e,n,n.pendingProps,t),n.child;case 8:return xr(e,n,n.pendingProps.children,t),n.child;case 12:return xr(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,i=n.pendingProps,s=n.memoizedProps,o=i.value,$t(Dh,r._currentValue),r._currentValue=o,s!==null)if(Ki(s.value,o)){if(s.children===i.children&&!qr.current){n=Bs(e,n,t);break e}}else for(s=n.child,s!==null&&(s.return=n);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Ds(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),S_(s.return,t,n),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===n.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Te(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),S_(o,t,n),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===n){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}xr(e,n,i.children,t),n=n.child}return n;case 9:return i=n.type,r=n.pendingProps.children,yl(n,t),i=Mi(i),r=r(i),n.flags|=1,xr(e,n,r,t),n.child;case 14:return r=n.type,i=Bi(r,n.pendingProps),i=Bi(r.type,i),C2(e,n,r,i,t);case 15:return pb(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),rh(e,n),n.tag=1,Wr(r)?(e=!0,kh(n)):e=!1,yl(n,t),db(n,r,i),w_(n,r,i,t),A_(null,n,r,!0,e,t);case 19:return yb(e,n,t);case 22:return _b(e,n,t)}throw Error(Te(156,n.tag))};function Db(e,n){return l3(e,n)}function CI(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ni(e,n,t,r){return new CI(e,n,t,r)}function Tv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function SI(e){if(typeof e=="function")return Tv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Gm)return 11;if(e===zm)return 14}return 2}function yo(e,n){var t=e.alternate;return t===null?(t=Ni(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function oh(e,n,t,r,i,s){var o=2;if(r=e,typeof e=="function")Tv(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ja:return da(t.children,i,s,n);case $m:o=8,i|=8;break;case Qp:return e=Ni(12,t,n,i|2),e.elementType=Qp,e.lanes=s,e;case Yp:return e=Ni(13,t,n,i),e.elementType=Yp,e.lanes=s,e;case Zp:return e=Ni(19,t,n,i),e.elementType=Zp,e.lanes=s,e;case VE:return jf(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case GE:o=10;break e;case zE:o=9;break e;case Gm:o=11;break e;case zm:o=14;break e;case Js:o=16,r=null;break e}throw Error(Te(130,e==null?e:typeof e,""))}return n=Ni(o,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function da(e,n,t,r){return e=Ni(7,e,r,n),e.lanes=t,e}function jf(e,n,t,r){return e=Ni(22,e,r,n),e.elementType=VE,e.lanes=t,e.stateNode={isHidden:!1},e}function Z0(e,n,t){return e=Ni(6,e,null,n),e.lanes=t,e}function X0(e,n,t){return n=Ni(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function TI(e,n,t,r,i){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=k0(0),this.expirationTimes=k0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=k0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wv(e,n,t,r,i,s,o,a,l){return e=new TI(e,n,t,a,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=Ni(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},lv(s),e}function wI(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hb)}catch(e){console.error(e)}}Hb(),HE.exports=hi;var qc=HE.exports;const jb=Af(qc);var U2=qc;Wp.createRoot=U2.createRoot,Wp.hydrateRoot=U2.hydrateRoot;var Bb={exports:{}},Mt={};/** @license React v16.13.1 +`+s.stack}return{value:e,source:n,stack:i,digest:null}}function Q0(e,n,t){return{value:e,source:null,stack:t??null,digest:n??null}}function N_(e,n){try{console.error(n.value)}catch(t){setTimeout(function(){throw t})}}var sI=typeof WeakMap=="function"?WeakMap:Map;function hb(e,n,t){t=Ds(-1,t),t.tag=3,t.payload={element:null};var r=n.value;return t.callback=function(){Bh||(Bh=!0,U_=r),N_(e,n)},t}function fb(e,n,t){t=Ds(-1,t),t.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=n.value;t.payload=function(){return r(i)},t.callback=function(){N_(e,n)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){N_(e,n),typeof r!="function"&&(vo===null?vo=new Set([this]):vo.add(this));var o=n.stack;this.componentDidCatch(n.value,{componentStack:o!==null?o:""})}),t}function g2(e,n,t){var r=e.pingCache;if(r===null){r=e.pingCache=new sI;var i=new Set;r.set(n,i)}else i=r.get(n),i===void 0&&(i=new Set,r.set(n,i));i.has(t)||(i.add(t),e=yI.bind(null,e,n,t),n.then(e,e))}function y2(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function E2(e,n,t,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===n?e.flags|=65536:(e.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(n=Ds(-1,1),n.tag=2,mo(t,n,1))),t.lanes|=1),e)}var oI=Gs.ReactCurrentOwner,Vr=!1;function xr(e,n,t,r){n.child=e===null?$3(n,null,t,r):Il(n,e.child,t,r)}function b2(e,n,t,r,i){t=t.render;var s=n.ref;return yl(n,i),r=fv(e,n,t,r,s,i),t=pv(),e!==null&&!Vr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,Bs(e,n,i)):(Xt&&t&&tv(n),n.flags|=1,xr(e,n,r,i),n.child)}function C2(e,n,t,r,i){if(e===null){var s=t.type;return typeof s=="function"&&!Tv(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(n.tag=15,n.type=s,pb(e,n,s,r,i)):(e=sh(t.type,null,r,n,n.mode,i),e.ref=n.ref,e.return=n,n.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Ec,t(o,r)&&e.ref===n.ref)return Bs(e,n,i)}return n.flags|=1,e=yo(s,r),e.ref=n.ref,e.return=n,n.child=e}function pb(e,n,t,r,i){if(e!==null){var s=e.memoizedProps;if(Ec(s,r)&&e.ref===n.ref)if(Vr=!1,n.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Vr=!0);else return n.lanes=e.lanes,Bs(e,n,i)}return I_(e,n,t,r,i)}function _b(e,n,t){var r=n.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(n.mode&1))n.memoizedState={baseLanes:0,cachePool:null,transitions:null},$t(ul,ei),ei|=t;else{if(!(t&1073741824))return e=s!==null?s.baseLanes|t:t,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,$t(ul,ei),ei|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,$t(ul,ei),ei|=r}else s!==null?(r=s.baseLanes|t,n.memoizedState=null):r=t,$t(ul,ei),ei|=r;return xr(e,n,i,t),n.child}function mb(e,n){var t=n.ref;(e===null&&t!==null||e!==null&&e.ref!==t)&&(n.flags|=512,n.flags|=2097152)}function I_(e,n,t,r,i){var s=Wr(t)?ga:Nr.current;return s=wl(n,s),yl(n,i),t=fv(e,n,t,r,s,i),r=pv(),e!==null&&!Vr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,Bs(e,n,i)):(Xt&&r&&tv(n),n.flags|=1,xr(e,n,t,i),n.child)}function S2(e,n,t,r,i){if(Wr(t)){var s=!0;Oh(n)}else s=!1;if(yl(n,i),n.stateNode===null)nh(e,n),db(n,t,r),w_(n,t,r,i),r=!0;else if(e===null){var o=n.stateNode,a=n.memoizedProps;o.props=a;var l=o.context,u=t.contextType;typeof u=="object"&&u!==null?u=Mi(u):(u=Wr(t)?ga:Nr.current,u=wl(n,u));var c=t.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&v2(n,o,r,u),eo=!1;var h=n.memoizedState;o.state=h,Uh(n,r,o,i),l=n.memoizedState,a!==r||h!==l||qr.current||eo?(typeof c=="function"&&(T_(n,t,c,r),l=n.memoizedState),(a=eo||m2(n,t,a,r,h,l,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(n.flags|=4194308)):(typeof o.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=r,n.memoizedState=l),o.props=r,o.state=l,o.context=u,r=a):(typeof o.componentDidMount=="function"&&(n.flags|=4194308),r=!1)}else{o=n.stateNode,z3(e,n),a=n.memoizedProps,u=n.type===n.elementType?a:Bi(n.type,a),o.props=u,d=n.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Mi(l):(l=Wr(t)?ga:Nr.current,l=wl(n,l));var f=t.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||h!==l)&&v2(n,o,r,l),eo=!1,h=n.memoizedState,o.state=h,Uh(n,r,o,i);var p=n.memoizedState;a!==d||h!==p||qr.current||eo?(typeof f=="function"&&(T_(n,t,f,r),p=n.memoizedState),(u=eo||m2(n,t,u,r,h,p,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,l)),typeof o.componentDidUpdate=="function"&&(n.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(n.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(n.flags|=1024),n.memoizedProps=r,n.memoizedState=p),o.props=r,o.state=p,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(n.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(n.flags|=1024),r=!1)}return A_(e,n,t,r,s,i)}function A_(e,n,t,r,i,s){mb(e,n);var o=(n.flags&128)!==0;if(!r&&!o)return i&&l2(n,t,!1),Bs(e,n,s);r=n.stateNode,oI.current=n;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return n.flags|=1,e!==null&&o?(n.child=Il(n,e.child,null,s),n.child=Il(n,null,a,s)):xr(e,n,a,s),n.memoizedState=r.state,i&&l2(n,t,!0),n.child}function vb(e){var n=e.stateNode;n.pendingContext?a2(e,n.pendingContext,n.pendingContext!==n.context):n.context&&a2(e,n.context,!1),uv(e,n.containerInfo)}function T2(e,n,t,r,i){return Nl(),rv(i),n.flags|=256,xr(e,n,t,r),n.child}var M_={dehydrated:null,treeContext:null,retryLane:0};function x_(e){return{baseLanes:e,cachePool:null,transitions:null}}function gb(e,n,t){var r=n.pendingProps,i=sn.current,s=!1,o=(n.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),$t(sn,i&1),e===null)return C_(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(n.mode&1?e.data==="$!"?n.lanes=8:n.lanes=1073741824:n.lanes=1,null):(o=r.children,e=r.fallback,s?(r=n.mode,s=n.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Hf(o,r,0,null),e=da(e,r,t,null),s.return=n,e.return=n,s.sibling=e,n.child=s,n.child.memoizedState=x_(t),n.memoizedState=M_,e):vv(n,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return aI(e,n,o,r,a,i,t);if(s){s=r.fallback,o=n.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&n.child!==i?(r=n.child,r.childLanes=0,r.pendingProps=l,n.deletions=null):(r=yo(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=yo(a,s):(s=da(s,o,t,null),s.flags|=2),s.return=n,r.return=n,r.sibling=s,n.child=r,r=s,s=n.child,o=e.child.memoizedState,o=o===null?x_(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~t,n.memoizedState=M_,r}return s=e.child,e=s.sibling,r=yo(s,{mode:"visible",children:r.children}),!(n.mode&1)&&(r.lanes=t),r.return=n,r.sibling=null,e!==null&&(t=n.deletions,t===null?(n.deletions=[e],n.flags|=16):t.push(e)),n.child=r,n.memoizedState=null,r}function vv(e,n){return n=Hf({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function md(e,n,t,r){return r!==null&&rv(r),Il(n,e.child,null,t),e=vv(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function aI(e,n,t,r,i,s,o){if(t)return n.flags&256?(n.flags&=-257,r=Q0(Error(Te(422))),md(e,n,o,r)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(s=r.fallback,i=n.mode,r=Hf({mode:"visible",children:r.children},i,0,null),s=da(s,i,o,null),s.flags|=2,r.return=n,s.return=n,r.sibling=s,n.child=r,n.mode&1&&Il(n,e.child,null,o),n.child.memoizedState=x_(o),n.memoizedState=M_,s);if(!(n.mode&1))return md(e,n,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Te(419)),r=Q0(s,r,void 0),md(e,n,o,r)}if(a=(o&e.childLanes)!==0,Vr||a){if(r=tr,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,js(e,i),qi(r,e,i,-1))}return Sv(),r=Q0(Error(Te(421))),md(e,n,o,r)}return i.data==="$?"?(n.flags|=128,n.child=e.child,n=EI.bind(null,e),i._reactRetry=n,null):(e=s.treeContext,oi=_o(i.nextSibling),li=n,Xt=!0,Gi=null,e!==null&&(Ei[bi++]=ks,Ei[bi++]=Rs,Ei[bi++]=ya,ks=e.id,Rs=e.overflow,ya=n),n=vv(n,r.children),n.flags|=4096,n)}function w2(e,n,t){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n),S_(e.return,n,t)}function Y0(e,n,t,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=n,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function yb(e,n,t){var r=n.pendingProps,i=r.revealOrder,s=r.tail;if(xr(e,n,r.children,t),r=sn.current,r&2)r=r&1|2,n.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&w2(e,t,n);else if(e.tag===19)w2(e,t,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if($t(sn,r),!(n.mode&1))n.memoizedState=null;else switch(i){case"forwards":for(t=n.child,i=null;t!==null;)e=t.alternate,e!==null&&Ph(e)===null&&(i=t),t=t.sibling;t=i,t===null?(i=n.child,n.child=null):(i=t.sibling,t.sibling=null),Y0(n,!1,i,t,s);break;case"backwards":for(t=null,i=n.child,n.child=null;i!==null;){if(e=i.alternate,e!==null&&Ph(e)===null){n.child=i;break}e=i.sibling,i.sibling=t,t=i,i=e}Y0(n,!0,t,null,s);break;case"together":Y0(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function nh(e,n){!(n.mode&1)&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Bs(e,n,t){if(e!==null&&(n.dependencies=e.dependencies),ba|=n.lanes,!(t&n.childLanes))return null;if(e!==null&&n.child!==e.child)throw Error(Te(153));if(n.child!==null){for(e=n.child,t=yo(e,e.pendingProps),n.child=t,t.return=n;e.sibling!==null;)e=e.sibling,t=t.sibling=yo(e,e.pendingProps),t.return=n;t.sibling=null}return n.child}function lI(e,n,t){switch(n.tag){case 3:vb(n),Nl();break;case 5:V3(n);break;case 1:Wr(n.type)&&Oh(n);break;case 4:uv(n,n.stateNode.containerInfo);break;case 10:var r=n.type._context,i=n.memoizedProps.value;$t(Lh,r._currentValue),r._currentValue=i;break;case 13:if(r=n.memoizedState,r!==null)return r.dehydrated!==null?($t(sn,sn.current&1),n.flags|=128,null):t&n.child.childLanes?gb(e,n,t):($t(sn,sn.current&1),e=Bs(e,n,t),e!==null?e.sibling:null);$t(sn,sn.current&1);break;case 19:if(r=(t&n.childLanes)!==0,e.flags&128){if(r)return yb(e,n,t);n.flags|=128}if(i=n.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),$t(sn,sn.current),r)break;return null;case 22:case 23:return n.lanes=0,_b(e,n,t)}return Bs(e,n,t)}var Eb,O_,bb,Cb;Eb=function(e,n){for(var t=n.child;t!==null;){if(t.tag===5||t.tag===6)e.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break;for(;t.sibling===null;){if(t.return===null||t.return===n)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};O_=function(){};bb=function(e,n,t,r){var i=e.memoizedProps;if(i!==r){e=n.stateNode,ea(ps.current);var s=null;switch(t){case"input":i=Jp(e,i),r=Jp(e,r),s=[];break;case"select":i=an({},i,{value:void 0}),r=an({},r,{value:void 0}),s=[];break;case"textarea":i=n_(e,i),r=n_(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Mh)}i_(t,r);var o;t=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var a=i[u];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(fc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(u,t)),t=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(fc.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Gt("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}t&&(s=s||[]).push("style",t);var u=s;(n.updateQueue=u)&&(n.flags|=4)}};Cb=function(e,n,t,r){t!==r&&(n.flags|=4)};function su(e,n){if(!Xt)switch(e.tailMode){case"hidden":n=e.tail;for(var t=null;n!==null;)n.alternate!==null&&(t=n),n=n.sibling;t===null?e.tail=null:t.sibling=null;break;case"collapsed":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Er(e){var n=e.alternate!==null&&e.alternate.child===e.child,t=0,r=0;if(n)for(var i=e.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=t,n}function uI(e,n,t){var r=n.pendingProps;switch(nv(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Er(n),null;case 1:return Wr(n.type)&&xh(),Er(n),null;case 3:return r=n.stateNode,Al(),qt(qr),qt(Nr),dv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(pd(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&!(n.flags&256)||(n.flags|=1024,Gi!==null&&(H_(Gi),Gi=null))),O_(e,n),Er(n),null;case 5:cv(n);var i=ea(wc.current);if(t=n.type,e!==null&&n.stateNode!=null)bb(e,n,t,r,i),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!r){if(n.stateNode===null)throw Error(Te(166));return Er(n),null}if(e=ea(ps.current),pd(n)){r=n.stateNode,t=n.type;var s=n.memoizedProps;switch(r[os]=n,r[Sc]=s,e=(n.mode&1)!==0,t){case"dialog":Gt("cancel",r),Gt("close",r);break;case"iframe":case"object":case"embed":Gt("load",r);break;case"video":case"audio":for(i=0;i<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(t,{is:r.is}):(e=o.createElement(t),t==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,t),e[os]=n,e[Sc]=r,Eb(e,n,!1,!1),n.stateNode=e;e:{switch(o=s_(t,r),t){case"dialog":Gt("cancel",e),Gt("close",e),i=r;break;case"iframe":case"object":case"embed":Gt("load",e),i=r;break;case"video":case"audio":for(i=0;ixl&&(n.flags|=128,r=!0,su(s,!1),n.lanes=4194304)}else{if(!r)if(e=Ph(o),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),su(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Xt)return Er(n),null}else 2*Mn()-s.renderingStartTime>xl&&t!==1073741824&&(n.flags|=128,r=!0,su(s,!1),n.lanes=4194304);s.isBackwards?(o.sibling=n.child,n.child=o):(t=s.last,t!==null?t.sibling=o:n.child=o,s.last=o)}return s.tail!==null?(n=s.tail,s.rendering=n,s.tail=n.sibling,s.renderingStartTime=Mn(),n.sibling=null,t=sn.current,$t(sn,r?t&1|2:t&1),n):(Er(n),null);case 22:case 23:return Cv(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?ei&1073741824&&(Er(n),n.subtreeFlags&6&&(n.flags|=8192)):Er(n),null;case 24:return null;case 25:return null}throw Error(Te(156,n.tag))}function cI(e,n){switch(nv(n),n.tag){case 1:return Wr(n.type)&&xh(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Al(),qt(qr),qt(Nr),dv(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return cv(n),null;case 13:if(qt(sn),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(Te(340));Nl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return qt(sn),null;case 4:return Al(),null;case 10:return ov(n.type._context),null;case 22:case 23:return Cv(),null;case 24:return null;default:return null}}var vd=!1,Sr=!1,dI=typeof WeakSet=="function"?WeakSet:Set,He=null;function ll(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){pn(e,n,r)}else t.current=null}function k_(e,n,t){try{t()}catch(r){pn(e,n,r)}}var N2=!1;function hI(e,n){if(__=Nh,e=I3(),ev(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,u=0,c=0,d=e,h=null;t:for(;;){for(var f;d!==t||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===e)break t;if(h===t&&++u===i&&(a=o),h===s&&++c===r&&(l=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(m_={focusedElem:e,selectionRange:t},Nh=!1,He=n;He!==null;)if(n=He,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,He=e;else for(;He!==null;){n=He;try{var p=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,b=p.memoizedState,v=n.stateNode,_=v.getSnapshotBeforeUpdate(n.elementType===n.type?m:Bi(n.type,m),b);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var E=n.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Te(163))}}catch(S){pn(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,He=e;break}He=n.return}return p=N2,N2=!1,p}function ju(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&k_(n,t,s)}i=i.next}while(i!==r)}}function Pf(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function R_(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function Sb(e){var n=e.alternate;n!==null&&(e.alternate=null,Sb(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[os],delete n[Sc],delete n[y_],delete n[KN],delete n[QN])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tb(e){return e.tag===5||e.tag===3||e.tag===4}function I2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function L_(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=Mh));else if(r!==4&&(e=e.child,e!==null))for(L_(e,n,t),e=e.sibling;e!==null;)L_(e,n,t),e=e.sibling}function D_(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(D_(e,n,t),e=e.sibling;e!==null;)D_(e,n,t),e=e.sibling}var ur=null,$i=!1;function Ws(e,n,t){for(t=t.child;t!==null;)wb(e,n,t),t=t.sibling}function wb(e,n,t){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(Mf,t)}catch{}switch(t.tag){case 5:Sr||ll(t,n);case 6:var r=ur,i=$i;ur=null,Ws(e,n,t),ur=r,$i=i,ur!==null&&($i?(e=ur,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):ur.removeChild(t.stateNode));break;case 18:ur!==null&&($i?(e=ur,t=t.stateNode,e.nodeType===8?G0(e.parentNode,t):e.nodeType===1&&G0(e,t),gc(e)):G0(ur,t.stateNode));break;case 4:r=ur,i=$i,ur=t.stateNode.containerInfo,$i=!0,Ws(e,n,t),ur=r,$i=i;break;case 0:case 11:case 14:case 15:if(!Sr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&k_(t,n,o),i=i.next}while(i!==r)}Ws(e,n,t);break;case 1:if(!Sr&&(ll(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){pn(t,n,a)}Ws(e,n,t);break;case 21:Ws(e,n,t);break;case 22:t.mode&1?(Sr=(r=Sr)||t.memoizedState!==null,Ws(e,n,t),Sr=r):Ws(e,n,t);break;default:Ws(e,n,t)}}function A2(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new dI),n.forEach(function(r){var i=bI.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Di(e,n){var t=n.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Mn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pI(r/1960))-r,10e?16:e,lo===null)var r=!1;else{if(e=lo,lo=null,$h=0,pt&6)throw Error(Te(331));var i=pt;for(pt|=4,He=e.current;He!==null;){var s=He,o=s.child;if(He.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lMn()-Ev?ca(e,0):yv|=t),Kr(e,n)}function Rb(e,n){n===0&&(e.mode&1?(n=ld,ld<<=1,!(ld&130023424)&&(ld=4194304)):n=1);var t=Dr();e=js(e,n),e!==null&&($c(e,n,t),Kr(e,t))}function EI(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Rb(e,t)}function bI(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Te(314))}r!==null&&r.delete(n),Rb(e,t)}var Lb;Lb=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||qr.current)Vr=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return Vr=!1,lI(e,n,t);Vr=!!(e.flags&131072)}else Vr=!1,Xt&&n.flags&1048576&&F3(n,Rh,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;nh(e,n),e=n.pendingProps;var i=wl(n,Nr.current);yl(n,t),i=fv(null,n,r,e,i,t);var s=pv();return n.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Wr(r)?(s=!0,Oh(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,lv(n),i.updater=Uf,n.stateNode=i,i._reactInternals=n,w_(n,r,e,t),n=A_(null,n,r,!0,s,t)):(n.tag=0,Xt&&s&&tv(n),xr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(nh(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=SI(r),e=Bi(r,e),i){case 0:n=I_(null,n,r,e,t);break e;case 1:n=S2(null,n,r,e,t);break e;case 11:n=b2(null,n,r,e,t);break e;case 14:n=C2(null,n,r,Bi(r.type,e),t);break e}throw Error(Te(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),I_(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),S2(e,n,r,i,t);case 3:e:{if(vb(n),e===null)throw Error(Te(387));r=n.pendingProps,s=n.memoizedState,i=s.element,z3(e,n),Uh(n,r,null,t);var o=n.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},n.updateQueue.baseState=s,n.memoizedState=s,n.flags&256){i=Ml(Error(Te(423)),n),n=T2(e,n,r,t,i);break e}else if(r!==i){i=Ml(Error(Te(424)),n),n=T2(e,n,r,t,i);break e}else for(oi=_o(n.stateNode.containerInfo.firstChild),li=n,Xt=!0,Gi=null,t=$3(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Nl(),r===i){n=Bs(e,n,t);break e}xr(e,n,r,t)}n=n.child}return n;case 5:return V3(n),e===null&&C_(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,v_(r,i)?o=null:s!==null&&v_(r,s)&&(n.flags|=32),mb(e,n),xr(e,n,o,t),n.child;case 6:return e===null&&C_(n),null;case 13:return gb(e,n,t);case 4:return uv(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=Il(n,null,r,t):xr(e,n,r,t),n.child;case 11:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),b2(e,n,r,i,t);case 7:return xr(e,n,n.pendingProps,t),n.child;case 8:return xr(e,n,n.pendingProps.children,t),n.child;case 12:return xr(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,i=n.pendingProps,s=n.memoizedProps,o=i.value,$t(Lh,r._currentValue),r._currentValue=o,s!==null)if(Ki(s.value,o)){if(s.children===i.children&&!qr.current){n=Bs(e,n,t);break e}}else for(s=n.child,s!==null&&(s.return=n);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Ds(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),S_(s.return,t,n),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===n.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Te(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),S_(o,t,n),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===n){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}xr(e,n,i.children,t),n=n.child}return n;case 9:return i=n.type,r=n.pendingProps.children,yl(n,t),i=Mi(i),r=r(i),n.flags|=1,xr(e,n,r,t),n.child;case 14:return r=n.type,i=Bi(r,n.pendingProps),i=Bi(r.type,i),C2(e,n,r,i,t);case 15:return pb(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:Bi(r,i),nh(e,n),n.tag=1,Wr(r)?(e=!0,Oh(n)):e=!1,yl(n,t),db(n,r,i),w_(n,r,i,t),A_(null,n,r,!0,e,t);case 19:return yb(e,n,t);case 22:return _b(e,n,t)}throw Error(Te(156,n.tag))};function Db(e,n){return l3(e,n)}function CI(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ni(e,n,t,r){return new CI(e,n,t,r)}function Tv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function SI(e){if(typeof e=="function")return Tv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Gm)return 11;if(e===zm)return 14}return 2}function yo(e,n){var t=e.alternate;return t===null?(t=Ni(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function sh(e,n,t,r,i,s){var o=2;if(r=e,typeof e=="function")Tv(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ja:return da(t.children,i,s,n);case $m:o=8,i|=8;break;case Qp:return e=Ni(12,t,n,i|2),e.elementType=Qp,e.lanes=s,e;case Yp:return e=Ni(13,t,n,i),e.elementType=Yp,e.lanes=s,e;case Zp:return e=Ni(19,t,n,i),e.elementType=Zp,e.lanes=s,e;case VE:return Hf(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case GE:o=10;break e;case zE:o=9;break e;case Gm:o=11;break e;case zm:o=14;break e;case Js:o=16,r=null;break e}throw Error(Te(130,e==null?e:typeof e,""))}return n=Ni(o,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function da(e,n,t,r){return e=Ni(7,e,r,n),e.lanes=t,e}function Hf(e,n,t,r){return e=Ni(22,e,r,n),e.elementType=VE,e.lanes=t,e.stateNode={isHidden:!1},e}function Z0(e,n,t){return e=Ni(6,e,null,n),e.lanes=t,e}function X0(e,n,t){return n=Ni(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function TI(e,n,t,r,i){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=k0(0),this.expirationTimes=k0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=k0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function wv(e,n,t,r,i,s,o,a,l){return e=new TI(e,n,t,a,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=Ni(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},lv(s),e}function wI(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hb)}catch(e){console.error(e)}}Hb(),HE.exports=hi;var qc=HE.exports;const jb=If(qc);var U2=qc;Wp.createRoot=U2.createRoot,Wp.hydrateRoot=U2.hydrateRoot;var Bb={exports:{}},Mt={};/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var rr=typeof Symbol=="function"&&Symbol.for,Mv=rr?Symbol.for("react.element"):60103,xv=rr?Symbol.for("react.portal"):60106,Vf=rr?Symbol.for("react.fragment"):60107,qf=rr?Symbol.for("react.strict_mode"):60108,Wf=rr?Symbol.for("react.profiler"):60114,Kf=rr?Symbol.for("react.provider"):60109,Qf=rr?Symbol.for("react.context"):60110,Ov=rr?Symbol.for("react.async_mode"):60111,Yf=rr?Symbol.for("react.concurrent_mode"):60111,Zf=rr?Symbol.for("react.forward_ref"):60112,Xf=rr?Symbol.for("react.suspense"):60113,xI=rr?Symbol.for("react.suspense_list"):60120,Jf=rr?Symbol.for("react.memo"):60115,e0=rr?Symbol.for("react.lazy"):60116,OI=rr?Symbol.for("react.block"):60121,kI=rr?Symbol.for("react.fundamental"):60117,RI=rr?Symbol.for("react.responder"):60118,LI=rr?Symbol.for("react.scope"):60119;function pi(e){if(typeof e=="object"&&e!==null){var n=e.$$typeof;switch(n){case Mv:switch(e=e.type,e){case Ov:case Yf:case Vf:case Wf:case qf:case Xf:return e;default:switch(e=e&&e.$$typeof,e){case Qf:case Zf:case e0:case Jf:case Kf:return e;default:return n}}case xv:return n}}}function $b(e){return pi(e)===Yf}Mt.AsyncMode=Ov;Mt.ConcurrentMode=Yf;Mt.ContextConsumer=Qf;Mt.ContextProvider=Kf;Mt.Element=Mv;Mt.ForwardRef=Zf;Mt.Fragment=Vf;Mt.Lazy=e0;Mt.Memo=Jf;Mt.Portal=xv;Mt.Profiler=Wf;Mt.StrictMode=qf;Mt.Suspense=Xf;Mt.isAsyncMode=function(e){return $b(e)||pi(e)===Ov};Mt.isConcurrentMode=$b;Mt.isContextConsumer=function(e){return pi(e)===Qf};Mt.isContextProvider=function(e){return pi(e)===Kf};Mt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Mv};Mt.isForwardRef=function(e){return pi(e)===Zf};Mt.isFragment=function(e){return pi(e)===Vf};Mt.isLazy=function(e){return pi(e)===e0};Mt.isMemo=function(e){return pi(e)===Jf};Mt.isPortal=function(e){return pi(e)===xv};Mt.isProfiler=function(e){return pi(e)===Wf};Mt.isStrictMode=function(e){return pi(e)===qf};Mt.isSuspense=function(e){return pi(e)===Xf};Mt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Vf||e===Yf||e===Wf||e===qf||e===Xf||e===xI||typeof e=="object"&&e!==null&&(e.$$typeof===e0||e.$$typeof===Jf||e.$$typeof===Kf||e.$$typeof===Qf||e.$$typeof===Zf||e.$$typeof===kI||e.$$typeof===RI||e.$$typeof===LI||e.$$typeof===OI)};Mt.typeOf=pi;Bb.exports=Mt;var kv=Bb.exports,DI=function(n,t,r,i){var s=r?r.call(i,n,t):void 0;if(s!==void 0)return!!s;if(n===t)return!0;if(typeof n!="object"||!n||typeof t!="object"||!t)return!1;var o=Object.keys(n),a=Object.keys(t);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),u=0;uye)&&(le=(ne=ne.replace(" ",":")).length),0ue&&(ue=(oe=oe.trim()).charCodeAt(0)),ue){case 38:return oe.replace(v,"$1"+Z.trim());case 58:return Z.trim()+oe.replace(v,"$1"+Z.trim());default:if(0<1*ee&&0B.charCodeAt(8))break;case 115:$=$.replace(B,"-webkit-"+B)+";"+$;break;case 207:case 102:$=$.replace(B,"-webkit-"+(102ee.charCodeAt(0)&&(ee=ee.trim()),we=ee,ee=[we],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var ZI=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}var n=e.prototype;return n.indexOfGroup=function(t){for(var r=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,s=i.length,o=s;t>=o;)(o<<=1)<0&&Sa(16,""+t);this.groupSizes=new Uint32Array(o),this.groupSizes.set(i),this.length=o;for(var a=s;a=this.length||this.groupSizes[t]===0)return r;for(var i=this.groupSizes[t],s=this.indexOfGroup(t),o=s+i,a=s;a=Gu&&(Gu=n+1),ah.set(e,n),Wh.set(n,e)},e4="style["+kl+'][data-styled-version="5.3.11"]',t4=new RegExp("^"+kl+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),n4=function(e,n,t){for(var r,i=t.split(","),s=0,o=i.length;s=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(kl))return c}}(t),s=i!==void 0?i.nextSibling:null;r.setAttribute(kl,"active"),r.setAttribute("data-styled-version","5.3.11");var o=i4();return o&&r.setAttribute("nonce",o),t.insertBefore(r,s),r},s4=function(){function e(t){var r=this.element=Vb(t);r.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var s=document.styleSheets,o=0,a=s.length;o=0){var i=document.createTextNode(r),s=this.nodes[t];return this.element.insertBefore(i,s||null),this.length++,!0}return!1},n.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},n.getRule=function(t){return t0&&(d+=h+",")}),s+=""+u+c+'{content:"'+d+`"}/*!sc*/ -`}}}return s}(this)},e}(),u4=/(a)(d)/gi,z2=function(e){return String.fromCharCode(e+(e>25?39:97))};function B_(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=z2(n%52)+t;return(z2(n%52)+t).replace(u4,"$1-$2")}var cl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},Wb=function(e){return cl(5381,e)};function c4(e){for(var n=0;n>>0);if(!t.hasNameForId(i,a)){var l=r(o,"."+a,void 0,i);t.insertRules(i,a,l)}s.push(a),this.staticRulesId=a}else{for(var u=this.rules.length,c=cl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var v=r(d,"."+b,void 0,i);t.insertRules(i,b,v)}s.push(b)}}return s.join(" ")},e}(),f4=/^\s*\/\/.*$/gm,p4=[":","[",".","#"];function Kb(e){var n,t,r,i,s=e===void 0?Eo:e,o=s.options,a=o===void 0?Eo:o,l=s.plugins,u=l===void 0?qh:l,c=new PI(a),d=[],h=function(m){function b(v){if(v)try{m(v+"}")}catch{}}return function(v,_,E,S,w,N,I,R,A,x){switch(v){case 1:if(A===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(R===0)return _+"/*|*/";break;case 3:switch(R){case 102:case 112:return m(E[0]+_),"";default:return _+(x===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(b)}}}(function(m){d.push(m)}),f=function(m,b,v){return b===0&&p4.indexOf(v[t.length])!==-1||v.match(i)?m:"."+n};function p(m,b,v,_){_===void 0&&(_="&");var E=m.replace(f4,""),S=b&&v?v+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(v||!b?"":b,S)}return c.use([].concat(u,[function(m,b,v){m===2&&v.length&&v[0].lastIndexOf(t)>0&&(v[0]=v[0].replace(r,f))},h,function(m){if(m===-2){var b=d;return d=[],b}}])),p.hash=u.length?u.reduce(function(m,b){return b.name||Sa(15),cl(m,b.name)},5381).toString():"",p}var Pv=It.createContext();Pv.Consumer;var Fv=It.createContext(),_4=(Fv.Consumer,new qb),$_=Kb();function Qb(){return D.useContext(Pv)||_4}function m4(){return D.useContext(Fv)||$_}function v4(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=Qb(),s=D.useMemo(function(){var a=i;return e.sheet?a=e.sheet:e.target&&(a=a.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(a=a.reconstructWithOptions({useCSSOMInjection:!1})),a},[e.disableCSSOMInjection,e.sheet,e.target]),o=D.useMemo(function(){return Kb({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){UI(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),It.createElement(Pv.Provider,{value:s},It.createElement(Fv.Provider,{value:o},e.children))}var Yb=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=$_);var o=r.name+s.hash;i.hasNameForId(r.id,o)||i.insertRules(r.id,o,s(r.rules,o,"@keyframes"))},this.toString=function(){return Sa(12,String(r.name))},this.name=n,this.id="sc-keyframes-"+n,this.rules=t}return e.prototype.getName=function(n){return n===void 0&&(n=$_),this.name+n.hash},e}(),g4=/([A-Z])/,y4=/([A-Z])/g,E4=/^ms-/,b4=function(e){return"-"+e.toLowerCase()};function V2(e){return g4.test(e)?e.replace(y4,b4).replace(E4,"-ms-"):e}var q2=function(e){return e==null||e===!1||e===""};function Rl(e,n,t,r){if(Array.isArray(e)){for(var i,s=[],o=0,a=e.length;o1?n-1:0),r=1;r?@[\\\]^`{|}~-]+/g,T4=/(^-|-$)/g;function J0(e){return e.replace(S4,"-").replace(T4,"")}var Zb=function(e){return B_(Wb(e)>>>0)};function Cd(e){return typeof e=="string"&&!0}var G_=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},w4=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function N4(e,n,t){var r=e[t];G_(n)&&G_(r)?Xb(r,n):e[t]=n}function Xb(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(x[R]=N[R]);return x}(n,["componentId"]),w=E&&E+"-"+(Cd(_)?_:J0($2(_)));return Jb(_,ds({},S,{attrs:h,componentId:w}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?Xb({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&QI(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var Ce=function(e){return function n(t,r,i){if(i===void 0&&(i=Eo),!kv.isValidElementType(r))return Sa(1,String(r));var s=function(){return t(r,i,Oo.apply(void 0,arguments))};return s.withConfig=function(o){return n(t,r,ds({},i,{},o))},s.attrs=function(o){return n(t,r,ds({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},s}(Jb,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){Ce[e]=Ce(e)});function A4(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(t.map(a=>{if(a=O4(a),a in K2)return;K2[a]=!0;const l=a.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":x4,l||(c.as="script",c.crossOrigin=""),c.href=a,o&&c.setAttribute("nonce",o),document.head.appendChild(c),l)return new Promise((d,h)=>{c.addEventListener("load",d),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>n()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};var z_=function(e,n){return z_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},z_(e,n)};function T(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}z_(e,n),e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var M=function(){return M=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0&&i[i.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ae(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var r,i,s=t.call(e),o=[];try{for(;(n===void 0||n-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(t=s.return)&&t.call(s)}finally{if(i)throw i.error}}return o}function Pe(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&R4.indexOf(e)>=0},Kh=function(e){return e>0&&L4.indexOf(e)>=0},fr=function(e,n){if(n===void 0&&(n=!1),n&&Wc(e))return!0;var t=typeof e=="object"&&e!==null&&e.hasOwnProperty("name")&&typeof e.name=="string"&&e.hasOwnProperty("uri")&&typeof e.uri=="string"&&e.hasOwnProperty("type")&&typeof e.type=="string";if(!t){if(typeof Blob<"u")return e instanceof Blob;if(typeof File<"u")return e instanceof File}return t},P4=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=Pe([],Ae(e),!1).sort(),r=Pe([],Ae(n),!1).sort(),i=0;i=1e3&&n<=9e3&&(this._typingIndicatorThrottle=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketResponseTimeout",{get:function(){return this._websocketResponseTimeout},set:function(n){k("number",n)&&n>=5e3&&n<=3e4&&(this._websocketResponseTimeout=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionTokenRefreshTimeout",{get:function(){return this._sessionTokenRefreshTimeout},set:function(n){k("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),rC={encrypt:function(e){return e},decrypt:function(e){return e}},Y2=function(){function e(n){var t=n.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:Pe([],Ae(this._preference.keys()),!1)})];case 1:return n.sent(),[2]}})})},e.prototype.init=function(n,t){var r;return t===void 0&&(t=1),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return this._version=t,this._keysAddress=n,i="".concat(n,".metadata.version"),[4,this._store.get(i)];case 1:return s=p.sent(),[4,this._store.get(n)];case 2:return o=(r=p.sent())!==null&&r!==void 0?r:[],!s||s.versiond.channel.messageCollectionLastAccessedAt?1:-1},this._maxSize=Math.max(i,64),a?(this._clearOrder=o,this._customClearOrderComparator=a):this._clearOrder=zu.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=u}return Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrder",{get:function(){return this._clearOrder},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var n;return this._clearOrder===zu.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:(n=this._customClearOrderComparator)!==null&&n!==void 0?n:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();(function(e){e.FEED="feed",e.CHAT="chat"})(Oc||(Oc={}));var Ze,Ii,as,bt,er,Ll,nr,Dn,Qi,ut,Z2,q_,W_,j4=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),$s=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})},X2=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=$s()}return e.prototype._register=function(n,t,r){var i;return n in this._container||(this._container[n]=new Map),(i=this._container[n])===null||i===void 0||i.set(this.key,{occurence:t,handler:r}),this},e.prototype.on=function(n,t){return this._register(n,-1,t)},e.prototype.once=function(n,t){return this._register(n,1,t)},e.prototype.close=function(){var n=this;Object.keys(this._container).forEach(function(t){var r;(r=n._container[t])===null||r===void 0||r.delete(n.key)})},e}(),Ra=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new X2({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new X2({container:this._container}).once(n,t)},e.prototype.dispatch=function(n,t){var r,i,s=this._container[n];if(s){var o=[];try{for(var a=ve(s.keys()),l=a.next();!l.done;l=a.next()){var u=l.value,c=s.get(u);c.handler(t),c.occurence>0&&(c.occurence--,c.occurence===0&&o.push(u))}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}o.forEach(function(d){return s.delete(d)})}},e}(),B4=function(){function e(){this._dispatcher=new Ra}return e.prototype.on=function(n){return this._dispatcher.on("event",n)},e.prototype.once=function(n){return this._dispatcher.once("event",n)},e.prototype.dispatch=function(n){this._dispatcher.dispatch("event",n)},e}(),Tt=function(){},Ee=function(e){var n={};return e&&Object.keys(e).forEach(function(t){e[t]===void 0||Number.isNaN(e[t])||e[t]===null||(n[t]=e[t])}),n},Ne=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=Pe([],Ae(e),!1),t=0;tye)&&(le=(ne=ne.replace(" ",":")).length),0ue&&(ue=(oe=oe.trim()).charCodeAt(0)),ue){case 38:return oe.replace(v,"$1"+Z.trim());case 58:return Z.trim()+oe.replace(v,"$1"+Z.trim());default:if(0<1*ee&&0B.charCodeAt(8))break;case 115:$=$.replace(B,"-webkit-"+B)+";"+$;break;case 207:case 102:$=$.replace(B,"-webkit-"+(102ee.charCodeAt(0)&&(ee=ee.trim()),we=ee,ee=[we],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var ZI=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}var n=e.prototype;return n.indexOfGroup=function(t){for(var r=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,s=i.length,o=s;t>=o;)(o<<=1)<0&&Sa(16,""+t);this.groupSizes=new Uint32Array(o),this.groupSizes.set(i),this.length=o;for(var a=s;a=this.length||this.groupSizes[t]===0)return r;for(var i=this.groupSizes[t],s=this.indexOfGroup(t),o=s+i,a=s;a=Gu&&(Gu=n+1),oh.set(e,n),qh.set(n,e)},e4="style["+kl+'][data-styled-version="5.3.11"]',t4=new RegExp("^"+kl+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),n4=function(e,n,t){for(var r,i=t.split(","),s=0,o=i.length;s=0;u--){var c=l[u];if(c&&c.nodeType===1&&c.hasAttribute(kl))return c}}(t),s=i!==void 0?i.nextSibling:null;r.setAttribute(kl,"active"),r.setAttribute("data-styled-version","5.3.11");var o=i4();return o&&r.setAttribute("nonce",o),t.insertBefore(r,s),r},s4=function(){function e(t){var r=this.element=Vb(t);r.appendChild(document.createTextNode("")),this.sheet=function(i){if(i.sheet)return i.sheet;for(var s=document.styleSheets,o=0,a=s.length;o=0){var i=document.createTextNode(r),s=this.nodes[t];return this.element.insertBefore(i,s||null),this.length++,!0}return!1},n.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},n.getRule=function(t){return t0&&(d+=h+",")}),s+=""+u+c+'{content:"'+d+`"}/*!sc*/ +`}}}return s}(this)},e}(),u4=/(a)(d)/gi,z2=function(e){return String.fromCharCode(e+(e>25?39:97))};function B_(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=z2(n%52)+t;return(z2(n%52)+t).replace(u4,"$1-$2")}var cl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},Wb=function(e){return cl(5381,e)};function c4(e){for(var n=0;n>>0);if(!t.hasNameForId(i,a)){var l=r(o,"."+a,void 0,i);t.insertRules(i,a,l)}s.push(a),this.staticRulesId=a}else{for(var u=this.rules.length,c=cl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var v=r(d,"."+b,void 0,i);t.insertRules(i,b,v)}s.push(b)}}return s.join(" ")},e}(),f4=/^\s*\/\/.*$/gm,p4=[":","[",".","#"];function Kb(e){var n,t,r,i,s=e===void 0?Eo:e,o=s.options,a=o===void 0?Eo:o,l=s.plugins,u=l===void 0?Vh:l,c=new PI(a),d=[],h=function(m){function b(v){if(v)try{m(v+"}")}catch{}}return function(v,_,E,S,w,N,I,R,A,x){switch(v){case 1:if(A===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(R===0)return _+"/*|*/";break;case 3:switch(R){case 102:case 112:return m(E[0]+_),"";default:return _+(x===0?"/*|*/":"")}case-2:_.split("/*|*/}").forEach(b)}}}(function(m){d.push(m)}),f=function(m,b,v){return b===0&&p4.indexOf(v[t.length])!==-1||v.match(i)?m:"."+n};function p(m,b,v,_){_===void 0&&(_="&");var E=m.replace(f4,""),S=b&&v?v+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(v||!b?"":b,S)}return c.use([].concat(u,[function(m,b,v){m===2&&v.length&&v[0].lastIndexOf(t)>0&&(v[0]=v[0].replace(r,f))},h,function(m){if(m===-2){var b=d;return d=[],b}}])),p.hash=u.length?u.reduce(function(m,b){return b.name||Sa(15),cl(m,b.name)},5381).toString():"",p}var Pv=It.createContext();Pv.Consumer;var Fv=It.createContext(),_4=(Fv.Consumer,new qb),$_=Kb();function Qb(){return D.useContext(Pv)||_4}function m4(){return D.useContext(Fv)||$_}function v4(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=Qb(),s=D.useMemo(function(){var a=i;return e.sheet?a=e.sheet:e.target&&(a=a.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(a=a.reconstructWithOptions({useCSSOMInjection:!1})),a},[e.disableCSSOMInjection,e.sheet,e.target]),o=D.useMemo(function(){return Kb({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){UI(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),It.createElement(Pv.Provider,{value:s},It.createElement(Fv.Provider,{value:o},e.children))}var Yb=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=$_);var o=r.name+s.hash;i.hasNameForId(r.id,o)||i.insertRules(r.id,o,s(r.rules,o,"@keyframes"))},this.toString=function(){return Sa(12,String(r.name))},this.name=n,this.id="sc-keyframes-"+n,this.rules=t}return e.prototype.getName=function(n){return n===void 0&&(n=$_),this.name+n.hash},e}(),g4=/([A-Z])/,y4=/([A-Z])/g,E4=/^ms-/,b4=function(e){return"-"+e.toLowerCase()};function V2(e){return g4.test(e)?e.replace(y4,b4).replace(E4,"-ms-"):e}var q2=function(e){return e==null||e===!1||e===""};function Rl(e,n,t,r){if(Array.isArray(e)){for(var i,s=[],o=0,a=e.length;o1?n-1:0),r=1;r?@[\\\]^`{|}~-]+/g,T4=/(^-|-$)/g;function J0(e){return e.replace(S4,"-").replace(T4,"")}var Zb=function(e){return B_(Wb(e)>>>0)};function bd(e){return typeof e=="string"&&!0}var G_=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},w4=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function N4(e,n,t){var r=e[t];G_(n)&&G_(r)?Xb(r,n):e[t]=n}function Xb(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(x[R]=N[R]);return x}(n,["componentId"]),w=E&&E+"-"+(bd(_)?_:J0($2(_)));return Jb(_,ds({},S,{attrs:h,componentId:w}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?Xb({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&QI(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var Ce=function(e){return function n(t,r,i){if(i===void 0&&(i=Eo),!kv.isValidElementType(r))return Sa(1,String(r));var s=function(){return t(r,i,Oo.apply(void 0,arguments))};return s.withConfig=function(o){return n(t,r,ds({},i,{},o))},s.attrs=function(o){return n(t,r,ds({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},s}(Jb,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(e){Ce[e]=Ce(e)});function A4(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.all(t.map(a=>{if(a=O4(a),a in K2)return;K2[a]=!0;const l=a.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":x4,l||(c.as="script",c.crossOrigin=""),c.href=a,o&&c.setAttribute("nonce",o),document.head.appendChild(c),l)return new Promise((d,h)=>{c.addEventListener("load",d),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>n()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};var z_=function(e,n){return z_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},z_(e,n)};function T(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}z_(e,n),e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var M=function(){return M=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0&&i[i.length-1])||c[0]!==6&&c[0]!==2)){o=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ae(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var r,i,s=t.call(e),o=[];try{for(;(n===void 0||n-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(t=s.return)&&t.call(s)}finally{if(i)throw i.error}}return o}function Pe(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&R4.indexOf(e)>=0},Wh=function(e){return e>0&&L4.indexOf(e)>=0},fr=function(e,n){if(n===void 0&&(n=!1),n&&Wc(e))return!0;var t=typeof e=="object"&&e!==null&&e.hasOwnProperty("name")&&typeof e.name=="string"&&e.hasOwnProperty("uri")&&typeof e.uri=="string"&&e.hasOwnProperty("type")&&typeof e.type=="string";if(!t){if(typeof Blob<"u")return e instanceof Blob;if(typeof File<"u")return e instanceof File}return t},P4=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=Pe([],Ae(e),!1).sort(),r=Pe([],Ae(n),!1).sort(),i=0;i=1e3&&n<=9e3&&(this._typingIndicatorThrottle=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketResponseTimeout",{get:function(){return this._websocketResponseTimeout},set:function(n){k("number",n)&&n>=5e3&&n<=3e4&&(this._websocketResponseTimeout=n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionTokenRefreshTimeout",{get:function(){return this._sessionTokenRefreshTimeout},set:function(n){k("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),rC={encrypt:function(e){return e},decrypt:function(e){return e}},Y2=function(){function e(n){var t=n.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:Pe([],Ae(this._preference.keys()),!1)})];case 1:return n.sent(),[2]}})})},e.prototype.init=function(n,t){var r;return t===void 0&&(t=1),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return this._version=t,this._keysAddress=n,i="".concat(n,".metadata.version"),[4,this._store.get(i)];case 1:return s=p.sent(),[4,this._store.get(n)];case 2:return o=(r=p.sent())!==null&&r!==void 0?r:[],!s||s.versiond.channel.messageCollectionLastAccessedAt?1:-1},this._maxSize=Math.max(i,64),a?(this._clearOrder=o,this._customClearOrderComparator=a):this._clearOrder=zu.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=u}return Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrder",{get:function(){return this._clearOrder},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var n;return this._clearOrder===zu.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:(n=this._customClearOrderComparator)!==null&&n!==void 0?n:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();(function(e){e.FEED="feed",e.CHAT="chat"})(Oc||(Oc={}));var Ze,Ii,as,bt,er,Ll,nr,Dn,Qi,ut,Z2,q_,W_,j4=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),$s=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})},X2=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=$s()}return e.prototype._register=function(n,t,r){var i;return n in this._container||(this._container[n]=new Map),(i=this._container[n])===null||i===void 0||i.set(this.key,{occurence:t,handler:r}),this},e.prototype.on=function(n,t){return this._register(n,-1,t)},e.prototype.once=function(n,t){return this._register(n,1,t)},e.prototype.close=function(){var n=this;Object.keys(this._container).forEach(function(t){var r;(r=n._container[t])===null||r===void 0||r.delete(n.key)})},e}(),Ra=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new X2({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new X2({container:this._container}).once(n,t)},e.prototype.dispatch=function(n,t){var r,i,s=this._container[n];if(s){var o=[];try{for(var a=ve(s.keys()),l=a.next();!l.done;l=a.next()){var u=l.value,c=s.get(u);c.handler(t),c.occurence>0&&(c.occurence--,c.occurence===0&&o.push(u))}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}o.forEach(function(d){return s.delete(d)})}},e}(),B4=function(){function e(){this._dispatcher=new Ra}return e.prototype.on=function(n){return this._dispatcher.on("event",n)},e.prototype.once=function(n){return this._dispatcher.once("event",n)},e.prototype.dispatch=function(n){this._dispatcher.dispatch("event",n)},e}(),Tt=function(){},Ee=function(e){var n={};return e&&Object.keys(e).forEach(function(t){e[t]===void 0||Number.isNaN(e[t])||e[t]===null||(n[t]=e[t])}),n},Ne=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=Pe([],Ae(e),!1),t=0;t"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},J2=function(){return!(typeof navigator>"u"||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(function(e){e.CHAT="chat",e.CALLS="calls",e.DESK="desk",e.LIVE="live",e.UIKIT_CHAT="uikit-chat",e.UIKIT_LIVE="uikit-live"})(Vu||(Vu={})),function(e){e.ANDROID="android",e.IOS="ios",e.JS="js",e.UNREAL="unreal",e.UNITY="unity",e.REACT_NATIVE="react-native",e.FLUTTER="flutter"}(ha||(ha={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(Ci||(Ci={}));var eA="^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",Qh=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=Q_()?ha.REACT_NATIVE:ha.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(bo.SDK_VERSION),device_os_platform:J2()?"mobile-web":"web",os_version:bo.OS_VERSION};if(n){var i=n.sendbirdExtensions,s=n.deviceOS,o=n.customData,a=o===void 0?{}:o;s.version&&(r.os_version=s.version),s.platform&&(r.device_os_platform=s.platform),i.length>0&&(r.extension_sdk_info=i.map(function(l){var u=l.product,c=l.platform,d=l.version;return"".concat(u,"/").concat(c,"/").concat(d)}).join(",")),Object.keys(r).forEach(function(l){return delete a[l]}),Object.keys(a).length>0&&(r=M(M({},r),a))}return Object.entries(r).map(function(l){var u=Ae(l,2),c=u[0],d=u[1];return"".concat(c,"=").concat(d)}).join("&")},e.userAgentWithExtension=function(n){var t=Q_()?"reactnative":"JS",r=n.sb_syncmanager?"s".concat(n.sb_syncmanager):"",i=n.sb_uikit?"u".concat(n.sb_uikit):"",s=n["device-os-platform"]?"o".concat(n["device-os-platform"]):J2()?"omobile-web":"oweb";return"".concat(t,"/c").concat(bo.SDK_VERSION,"/").concat(r,"/").concat(i,"/").concat(s)},e}(),Tr=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=function(r){t(r)}})},Yh=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return T(n,e),n}(Tt),dC=function(e){function n(t){var r=e.call(this)||this;return r.method=Q.DELETE,r.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=Ee({mesg_token:t.messageToken})),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var tA=function(e){function n(t,r,i){var s,o=this;return(o=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,o.channelType=i.channel_type,o.messageId=Number(i.msg_id),o.silent=i.silent,o.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,o.senderId=(s=i.sender_id)!==null&&s!==void 0?s:void 0,o}return T(n,e),n}(mt),nA=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=n,this._session=r,this._sdkState=i,this._dispatcher=s,this._dispatcher.on(function(c){c instanceof Y4&&u.cancel(c.requestId)}),this._logger=o,this._shouldImportFetchCompat=l}return e.prototype._createHeader=function(n,t){var r=this._sdkState,i=r.appId,s=r.appVersion,o=r.sendbirdRuntimeEnvironment,a=M(M({},n.headers),{SendBird:"JS,".concat(bo.OS_VERSION,",").concat(bo.SDK_VERSION,",").concat(i).concat(s?",".concat(s):""),"SB-User-Agent":Qh.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":Qh.sendbirdSdkUserAgentWithExtension(o)});return t||(a["Content-Type"]="application/json; charset=utf-8"),n.requireAuth&&!n.hasSessionKey&&this._session.hasSession&&(a["Session-Key"]=this._session.sessionKey),a["App-Id"]=i,this._session&&this._session.authToken&&(a["Access-Token"]=this._session.authToken),a},e.prototype._statLogApiResult=function(n,t,r){this._dispatcher.dispatch(new Bv(new jt({type:yt.API_RESULT,data:{endpoint:n.path,method:n.method,success:!r,latency:Date.now()-t,error_code:r==null?void 0:r.code,error_description:r==null?void 0:r.message}})))},e.prototype._isBodyRequired=function(n){var t=n.method;return t!==Q.GET&&(t!==Q.DELETE||n instanceof dC)},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w;return g(this,function(N){switch(N.label){case 0:t=n.path,r=n.method,i=n.uploadProgressHandler,s=this._isBodyRequired(n),o=this._sdkState.api,a="".concat(o.host).concat(t).concat(s?"":n.query),l=s?n.payload:null,u=this._createHeader(n,l instanceof FormData?l:void 0),c=new AbortController,d=c.signal,this._abortControl.set(n.requestId,c),h=Date.now(),N.label=1;case 1:return N.trys.push([1,13,,14]),i?[4,tp(()=>import("./__bundle-c839c84a-DKk4eUg2.js"),[])]:[3,6];case 2:f=N.sent().xmlHttpRequest,N.label=3;case 3:return N.trys.push([3,5,,6]),[4,f(this._iid,{requestId:n.requestId,method:n.method,url:a,headers:u,data:l??void 0,uploadProgressHandler:i})];case 4:return p=N.sent(),this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,p];case 5:if(!((m=N.sent())instanceof L&&m.code===Ie.XMLHTTPREQUEST_NOT_SUPPORTED))throw m;return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),[3,6];case 6:return this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{fetch:null}).fetch=null),typeof AbortController<"u"?[3,8]:[4,tp(()=>import("./__bundle-2aa1a987-DWRDgB8b.js").then(I=>I._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,tp(()=>import("./__bundle-347d730c-dsIj7YNg.js").then(I=>I._),[])];case 9:N.sent(),N.label=10;case 10:return[4,fetch(a,{method:r,body:l,headers:u,signal:d})];case 11:return[4,(b=N.sent()).json()];case 12:if(v=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new ae(this._iid,v)];if(v){if((_=new L(v)).isSessionExpiredError){if(this._dispatcher.dispatch(new Ul({reason:_.code})),!(n instanceof jv))return E=new Tr,this._dispatcher.dispatch(new cC({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Ul({reason:_.code})),_}throw L.requestFailed;case 13:throw S=N.sent(),this._statLogApiResult(n,h,S),S instanceof L?(this._logger.debug("fail api request",S),S):(S==null?void 0:S.name)==="AbortError"?L.requestCanceled:(w=L.networkError,this._logger.debug("fail api request",w),w);case 14:return[2]}})})},e.prototype.cancel=function(n){this._abortControl.has(n)&&(this._abortControl.get(n).abort(),this._abortControl.delete(n)),this._dispatcher.dispatch(new Yh({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=ve(this._abortControl.values()),i=r.next();!i.done;i=r.next())i.value.abort()}catch(s){n={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}this._abortControl.clear(),this._dispatcher.dispatch(new Yh({}))},e}(),qe=function(){};function Wl(e){let n=e.length;for(;--n>=0;)e[n]=0}const $v=256,hC=286,qu=30,Wu=15,Y_=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),lh=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),rA=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),e1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=new Array(576);Wl(ws);const Ku=new Array(60);Wl(Ku);const kc=new Array(512);Wl(kc);const Qu=new Array(256);Wl(Qu);const Gv=new Array(29);Wl(Gv);const Zh=new Array(qu);function np(e,n,t,r,i){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let t1,n1,r1;function rp(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Wl(Zh);const fC=e=>e<256?kc[e]:kc[256+(e>>>7)],Rc=(e,n)=>{e.pending_buf[e.pending++]=255&n,e.pending_buf[e.pending++]=n>>>8&255},zr=(e,n,t)=>{e.bi_valid>16-t?(e.bi_buf|=n<>16-e.bi_valid,e.bi_valid+=t-16):(e.bi_buf|=n<{zr(e,t[2*n],t[2*n+1])},pC=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},_C=(e,n,t)=>{const r=new Array(16);let i,s,o=0;for(i=1;i<=Wu;i++)o=o+t[i-1]<<1,r[i]=o;for(s=0;s<=n;s++){let a=e[2*s+1];a!==0&&(e[2*s]=pC(r[a]++,a))}},mC=e=>{let n;for(n=0;n{e.bi_valid>8?Rc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},i1=(e,n,t,r)=>{const i=2*n,s=2*t;return e[i]{const r=e.heap[t];let i=t<<1;for(;i<=e.heap_len&&(i{let r,i,s,o,a=0;if(e.sym_next!==0)do r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],r===0?ls(e,i,n):(s=Qu[i],ls(e,s+$v+1,n),o=Y_[s],o!==0&&(i-=Gv[s],zr(e,i,o)),r--,s=fC(r),ls(e,s,t),o=lh[s],o!==0&&(r-=Zh[s],zr(e,r,o)));while(a{const t=n.dyn_tree,r=n.stat_desc.static_tree,i=n.stat_desc.has_stree,s=n.stat_desc.elems;let o,a,l,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o>1;o>=1;o--)ip(e,t,o);l=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ip(e,t,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,t[2*l]=t[2*o]+t[2*a],e.depth[l]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,t[2*o+1]=t[2*a+1]=l,e.heap[1]=l++,ip(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((c,d)=>{const h=d.dyn_tree,f=d.max_code,p=d.stat_desc.static_tree,m=d.stat_desc.has_stree,b=d.stat_desc.extra_bits,v=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,w,N,I,R,A=0;for(N=0;N<=Wu;N++)c.bl_count[N]=0;for(h[2*c.heap[c.heap_max]+1]=0,E=c.heap_max+1;E<573;E++)S=c.heap[E],N=h[2*h[2*S+1]+1]+1,N>_&&(N=_,A++),h[2*S+1]=N,S>f||(c.bl_count[N]++,I=0,S>=v&&(I=b[S-v]),R=h[2*S],c.opt_len+=R*(N+I),m&&(c.static_len+=R*(p[2*S+1]+I)));if(A!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,A-=2}while(A>0);for(N=_;N!==0;N--)for(S=c.bl_count[N];S!==0;)w=c.heap[--E],w>f||(h[2*w+1]!==N&&(c.opt_len+=(N-h[2*w+1])*h[2*w],h[2*w+1]=N),S--)}})(e,n),_C(t,u,e.bl_count)},o1=(e,n,t)=>{let r,i,s=-1,o=n[1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),n[2*(t+1)+1]=65535,r=0;r<=t;r++)i=o,o=n[2*(r+1)+1],++a{let r,i,s=-1,o=n[1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),r=0;r<=t;r++)if(i=o,o=n[2*(r+1)+1],!(++a{zr(e,0+(r?1:0),3),vC(e),Rc(e,t),Rc(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var iA=(e,n,t,r)=>{let i,s,o=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=(a=>{let l,u=4093624447;for(l=0;l<=31;l++,u>>>=1)if(1&u&&a.dyn_ltree[2*l]!==0)return 0;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return 1;for(l=32;l<$v;l++)if(a.dyn_ltree[2*l]!==0)return 1;return 0})(e)),sp(e,e.l_desc),sp(e,e.d_desc),o=(a=>{let l;for(o1(a,a.dyn_ltree,a.l_desc.max_code),o1(a,a.dyn_dtree,a.d_desc.max_code),sp(a,a.bl_desc),l=18;l>=3&&a.bl_tree[2*e1[l]+1]===0;l--);return a.opt_len+=3*(l+1)+5+5+4,l})(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&n!==-1?gC(e,n,t,r):e.strategy===4||s===i?(zr(e,2+(r?1:0),3),s1(e,ws,Ku)):(zr(e,4+(r?1:0),3),((a,l,u,c)=>{let d;for(zr(a,l-257,5),zr(a,u-1,5),zr(a,c-4,4),d=0;d{l1||((()=>{let n,t,r,i,s;const o=new Array(16);for(r=0,i=0;i<28;i++)for(Gv[i]=r,n=0;n<1<>=7;i(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[2*t]++:(e.matches++,n--,e.dyn_ltree[2*(Qu[t]+$v+1)]++,e.dyn_dtree[2*fC(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{zr(e,2,3),ls(e,256,ws),(n=>{n.bi_valid===16?(Rc(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=255&n.bi_buf,n.bi_buf>>=8,n.bi_valid-=8)})(e)}},Yu=(e,n,t,r)=>{let i=65535&e,s=e>>>16&65535,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+n[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16};const oA=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var Zn=(e,n,t,r)=>{const i=oA,s=r+t;e^=-1;for(let o=r;o>>8^i[255&(e^n[o])];return~e},Ta={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},La={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aA,_tr_stored_block:Z_,_tr_flush_block:lA,_tr_tally:Co,_tr_align:uA}=sA,{Z_NO_FLUSH:So,Z_PARTIAL_FLUSH:cA,Z_FULL_FLUSH:dA,Z_FINISH:Si,Z_BLOCK:u1,Z_OK:ar,Z_STREAM_END:c1,Z_STREAM_ERROR:ns,Z_DATA_ERROR:hA,Z_BUF_ERROR:op,Z_DEFAULT_COMPRESSION:fA,Z_FILTERED:pA,Z_HUFFMAN_ONLY:Sd,Z_RLE:_A,Z_FIXED:mA,Z_DEFAULT_STRATEGY:vA,Z_UNKNOWN:gA,Z_DEFLATED:Xh}=La,na=258,_s=262,bl=42,Wo=113,wu=666,Ko=(e,n)=>(e.msg=Ta[n],n),d1=e=>2*e-(e>4?9:0),so=e=>{let n=e.length;for(;--n>=0;)e[n]=0},yA=e=>{let n,t,r,i=e.w_size;n=e.hash_size,r=n;do t=e.head[--r],e.head[r]=t>=i?t-i:0;while(--n);n=i,r=n;do t=e.prev[--r],e.prev[r]=t>=i?t-i:0;while(--n)};let To=(e,n,t)=>(n<{const n=e.state;let t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},ni=(e,n)=>{lA(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,Jr(e.strm)},gt=(e,n)=>{e.pending_buf[e.pending++]=n},lu=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=255&n},X_=(e,n,t,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,n.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=Yu(e.adler,n,i,t):e.state.wrap===2&&(e.adler=Zn(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},yC=(e,n)=>{let t,r,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-_s?e.strstart-(e.w_size-_s):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+na;let f=u[s+o-1],p=u[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do if(t=n,u[t+o]===p&&u[t+o-1]===f&&u[t]===u[s]&&u[++t]===u[s+1]){s+=2,t++;do;while(u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&so){if(e.match_start=n,o=r,r>=a)break;f=u[s+o-1],p=u[s+o]}}while((n=d[n&c])>l&&--i!=0);return o<=e.lookahead?o:e.lookahead},dl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-_s)&&(e.window.set(e.window.subarray(n,n+n-r),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),yA(e),r+=n),e.strm.avail_in===0)break;if(t=X_(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=To(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=To(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<_s&&e.strm.avail_in!==0)},EC=(e,n)=>{let t,r,i,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(t=65535,i=e.bi_valid+42>>3,e.strm.avail_outr+e.strm.avail_in&&(t=r+e.strm.avail_in),t>i&&(t=i),t>8,e.pending_buf[e.pending-2]=~t,e.pending_buf[e.pending-1]=~t>>8,Jr(e.strm),r&&(r>t&&(r=t),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,t-=r),t&&(X_(e.strm,e.strm.output,e.strm.next_out,t),e.strm.next_out+=t,e.strm.avail_out-=t,e.strm.total_out+=t)}while(o===0);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(X_(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,s=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=s||(r||n===Si)&&n!==So&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,o=n===Si&&e.strm.avail_in===0&&t===r?1:0,Z_(e,e.block_start,t,o),e.block_start+=t,Jr(e.strm)),o?3:1)},ap=(e,n)=>{let t,r;for(;;){if(e.lookahead<_s){if(dl(e),e.lookahead<_s&&n===So)return 1;if(e.lookahead===0)break}if(t=0,e.lookahead>=3&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-_s&&(e.match_length=yC(e,t)),e.match_length>=3)if(r=Co(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=To(e,e.ins_h,e.window[e.strstart+1]);else r=Co(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(ni(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Si?(ni(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ni(e,!1),e.strm.avail_out===0)?1:2},Va=(e,n)=>{let t,r,i;for(;;){if(e.lookahead<_s){if(dl(e),e.lookahead<_s&&n===So)return 1;if(e.lookahead===0)break}if(t=0,e.lookahead>=3&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,t!==0&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Co(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(ni(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=Co(e,0,e.window[e.strstart-1]),r&&ni(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Co(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,n===Si?(ni(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ni(e,!1),e.strm.avail_out===0)?1:2};function es(e,n,t,r,i){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=r,this.func=i}const Nu=[new es(0,0,0,0,EC),new es(4,4,8,4,ap),new es(4,5,16,8,ap),new es(4,6,32,32,ap),new es(4,4,16,16,Va),new es(8,16,32,32,Va),new es(8,16,128,128,Va),new es(8,32,128,256,Va),new es(32,128,258,1024,Va),new es(32,258,258,4096,Va)];function EA(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Xh,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),so(this.dyn_ltree),so(this.dyn_dtree),so(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),so(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),so(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Iu=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.status!==bl&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Wo&&n.status!==wu?1:0},bC=e=>{if(Iu(e))return Ko(e,ns);e.total_in=e.total_out=0,e.data_type=gA;const n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?57:n.wrap?bl:Wo,e.adler=n.wrap===2?0:1,n.last_flush=-2,aA(n),ar},CC=e=>{const n=bC(e);var t;return n===ar&&((t=e.state).window_size=2*t.w_size,so(t.head),t.max_lazy_match=Nu[t.level].max_lazy,t.good_match=Nu[t.level].good_length,t.nice_match=Nu[t.level].nice_length,t.max_chain_length=Nu[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n},h1=(e,n,t,r,i,s)=>{if(!e)return ns;let o=1;if(n===fA&&(n=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||t!==Xh||r<8||r>15||n<0||n>9||s<0||s>mA||r===8&&o!==1)return Ko(e,ns);r===8&&(r=9);const a=new EA;return e.state=a,a.strm=e,a.status=bl,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<h1(e,n,Xh,15,8,vA),deflateInit2:h1,deflateReset:CC,deflateResetKeep:bC,deflateSetHeader:(e,n)=>Iu(e)||e.state.wrap!==2?ns:(e.state.gzhead=n,ar),deflate:(e,n)=>{if(Iu(e)||n>u1||n<0)return e?Ko(e,ns):ns;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===wu&&n!==Si)return Ko(e,e.avail_out===0?op:ns);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(Jr(e),e.avail_out===0)return t.last_flush=-1,ar}else if(e.avail_in===0&&d1(n)<=d1(r)&&n!==Si)return Ko(e,op);if(t.status===wu&&e.avail_in!==0)return Ko(e,op);if(t.status===bl&&t.wrap===0&&(t.status=Wo),t.status===bl){let i=Xh+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Sd||t.level<2?0:t.level<6?1:t.level===6?2:3,i|=s<<6,t.strstart!==0&&(i|=32),i+=31-i%31,lu(t,i),t.strstart!==0&&(lu(t,e.adler>>>16),lu(t,65535&e.adler)),e.adler=1,t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(t.status===57){if(e.adler=0,gt(t,31),gt(t,139),gt(t,8),t.gzhead)gt(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),gt(t,255&t.gzhead.time),gt(t,t.gzhead.time>>8&255),gt(t,t.gzhead.time>>16&255),gt(t,t.gzhead.time>>24&255),gt(t,t.level===9?2:t.strategy>=Sd||t.level<2?4:0),gt(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(gt(t,255&t.gzhead.extra.length),gt(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=Zn(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(gt(t,0),gt(t,0),gt(t,0),gt(t,0),gt(t,0),gt(t,t.level===9?2:t.strategy>=Sd||t.level<2?4:0),gt(t,3),t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(t.status===69){if(t.gzhead.extra){let i=t.pending,s=(65535&t.gzhead.extra.length)-t.gzindex;for(;t.pending+s>t.pending_buf_size;){let a=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=a,Jr(e),t.pending!==0)return t.last_flush=-1,ar;i=0,s-=a}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending+=s,t.gzhead.hcrc&&t.pending>i&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=73}if(t.status===73){if(t.gzhead.name){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),Jr(e),t.pending!==0)return t.last_flush=-1,ar;s=0}i=t.gzindexs&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=91}if(t.status===91){if(t.gzhead.comment){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),Jr(e),t.pending!==0)return t.last_flush=-1,ar;s=0}i=t.gzindexs&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s))}t.status=103}if(t.status===103){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Jr(e),t.pending!==0))return t.last_flush=-1,ar;gt(t,255&e.adler),gt(t,e.adler>>8&255),e.adler=0}if(t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(e.avail_in!==0||t.lookahead!==0||n!==So&&t.status!==wu){let i=t.level===0?EC(t,n):t.strategy===Sd?((s,o)=>{let a;for(;;){if(s.lookahead===0&&(dl(s),s.lookahead===0)){if(o===So)return 1;break}if(s.match_length=0,a=Co(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,a&&(ni(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Si?(ni(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ni(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===_A?((s,o)=>{let a,l,u,c;const d=s.window;for(;;){if(s.lookahead<=na){if(dl(s),s.lookahead<=na&&o===So)return 1;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=3&&s.strstart>0&&(u=s.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){c=s.strstart+na;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&us.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=3?(a=Co(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(a=Co(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),a&&(ni(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Si?(ni(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ni(s,!1),s.strm.avail_out===0)?1:2})(t,n):Nu[t.level].func(t,n);if(i!==3&&i!==4||(t.status=wu),i===1||i===3)return e.avail_out===0&&(t.last_flush=-1),ar;if(i===2&&(n===cA?uA(t):n!==u1&&(Z_(t,0,0,!1),n===dA&&(so(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Jr(e),e.avail_out===0))return t.last_flush=-1,ar}return n!==Si?ar:t.wrap<=0?c1:(t.wrap===2?(gt(t,255&e.adler),gt(t,e.adler>>8&255),gt(t,e.adler>>16&255),gt(t,e.adler>>24&255),gt(t,255&e.total_in),gt(t,e.total_in>>8&255),gt(t,e.total_in>>16&255),gt(t,e.total_in>>24&255)):(lu(t,e.adler>>>16),lu(t,65535&e.adler)),Jr(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ar:c1)},deflateEnd:e=>{if(Iu(e))return ns;const n=e.state.status;return e.state=null,n===Wo?Ko(e,hA):ar},deflateSetDictionary:(e,n)=>{let t=n.length;if(Iu(e))return ns;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bl||r.lookahead)return ns;if(i===1&&(e.adler=Yu(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(so(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(n.subarray(t-r.w_size,t),0),n=l,t=r.w_size}const s=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,dl(r);r.lookahead>=3;){let l=r.strstart,u=r.lookahead-2;do r.ins_h=To(r,r.ins_h,r.window[l+3-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=2,dl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,e.input=a,e.avail_in=s,r.wrap=i,ar},deflateInfo:"pako deflate (from Nodeca project)"};const bA=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var t0={assign:function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const r in t)bA(t,r)&&(e[r]=t[r])}}return e},flattenChunks:e=>{let n=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Lc[254]=Lc[254]=1;var Dc={string2buf:e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,r,i,s,o=e.length,a=0;for(i=0;i>>6,n[s++]=128|63&t):t<65536?(n[s++]=224|t>>>12,n[s++]=128|t>>>6&63,n[s++]=128|63&t):(n[s++]=240|t>>>18,n[s++]=128|t>>>12&63,n[s++]=128|t>>>6&63,n[s++]=128|63&t);return n},buf2string:(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let r,i;const s=new Array(2*t);for(i=0,r=0;r4)s[i++]=65533,r+=a-1;else{for(o&=a===2?31:a===3?15:7;a>1&&r1?s[i++]=65533:o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|1023&o)}}return((o,a)=>{if(a<65534&&o.subarray&&SC)return String.fromCharCode.apply(null,o.length===a?o:o.subarray(0,a));let l="";for(let u=0;u{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+Lc[e[t]]>n?t:n}},TC=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const wC=Object.prototype.toString,{Z_NO_FLUSH:CA,Z_SYNC_FLUSH:SA,Z_FULL_FLUSH:TA,Z_FINISH:wA,Z_OK:Jh,Z_STREAM_END:NA,Z_DEFAULT_COMPRESSION:IA,Z_DEFAULT_STRATEGY:AA,Z_DEFLATED:MA}=La;function Xu(e){this.options=t0.assign({level:IA,method:MA,chunkSize:16384,windowBits:15,memLevel:8,strategy:AA},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TC,this.strm.avail_out=0;let t=Zu.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==Jh)throw new Error(Ta[t]);if(n.header&&Zu.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?Dc.string2buf(n.dictionary):wC.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=Zu.deflateSetDictionary(this.strm,r),t!==Jh)throw new Error(Ta[t]);this._dict_set=!0}}function lp(e,n){const t=new Xu(n);if(t.push(e,!0),t.err)throw t.msg||Ta[t.err];return t.result}Xu.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=n===~~n?n:n===!0?wA:CA,typeof e=="string"?t.input=Dc.string2buf(e):wC.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;)if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(s===SA||s===TA)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=Zu.deflate(t,s),i===NA)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Zu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Jh;if(t.avail_out!==0){if(s>0&&t.next_out>0)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else if(t.avail_in===0)break}else this.onData(t.output)}return!0},Xu.prototype.onData=function(e){this.chunks.push(e)},Xu.prototype.onEnd=function(e){e===Jh&&(this.result=t0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var xA={Deflate:Xu,deflate:lp,deflateRaw:function(e,n){return(n=n||{}).raw=!0,lp(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,lp(e,n)},constants:La};const Td=16209;var OA=function(e,n){let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A;const x=e.state;t=e.next_in,R=e.input,r=t+(e.avail_in-5),i=e.next_out,A=e.output,s=i-(n-e.avail_out),o=i+(e.avail_out-257),a=x.dmax,l=x.wsize,u=x.whave,c=x.wnext,d=x.window,h=x.hold,f=x.bits,p=x.lencode,m=x.distcode,b=(1<>>24,h>>>=E,f-=E,E=_>>>16&255,E===0)A[i++]=65535&_;else{if(!(16&E)){if(64&E){if(32&E){x.mode=16191;break e}e.msg="invalid literal/length code",x.mode=Td;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=R[t++]<>>24,h>>>=E,f-=E,E=_>>>16&255,16&E){if(w=65535&_,E&=15,fa){e.msg="invalid distance too far back",x.mode=Td;break e}if(h>>>=E,f-=E,E=i-s,w>E){if(E=w-E,E>u&&x.sane){e.msg="invalid distance too far back",x.mode=Td;break e}if(N=0,I=d,c===0){if(N+=l-E,E2;)A[i++]=I[N++],A[i++]=I[N++],A[i++]=I[N++],S-=3;S&&(A[i++]=I[N++],S>1&&(A[i++]=I[N++]))}else{N=i-w;do A[i++]=A[N++],A[i++]=A[N++],A[i++]=A[N++],S-=3;while(S>2);S&&(A[i++]=A[N++],S>1&&(A[i++]=A[N++]))}break}if(64&E){e.msg="invalid distance code",x.mode=Td;break e}_=m[(65535&_)+(h&(1<>3,t-=S,f-=S<<3,h&=(1<{const l=a.bits;let u,c,d,h,f,p,m=0,b=0,v=0,_=0,E=0,S=0,w=0,N=0,I=0,R=0,A=null;const x=new Uint16Array(16),U=new Uint16Array(16);let q,P,X,z=null;for(m=0;m<=wd;m++)x[m]=0;for(b=0;b=1&&x[_]===0;_--);if(E>_&&(E=_),_===0)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(v=1;v<_&&x[v]===0;v++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&I>592)return 1;for(;;){q=m-w,o[b]+1=p?(P=z[o[b]-p],X=A[o[b]-p]):(P=96,X=0),u=1<>w)+c]=q<<24|P<<16|X;while(c!==0);for(u=1<>=1;if(u!==0?(R&=u-1,R+=u):R=0,b++,--x[m]==0){if(m===_)break;m=n[t+o[b]]}if(m>E&&(R&h)!==d){for(w===0&&(w=E),f+=v,S=m-w,N=1<852||e===2&&I>592)return 1;d=R&h,i[d]=E<<24|S<<16|f-s}}return R!==0&&(i[f+R]=m-w<<24|64<<16),a.bits=E,0};const{Z_FINISH:f1,Z_BLOCK:UA,Z_TREES:Nd,Z_OK:Qo,Z_STREAM_END:PA,Z_NEED_DICT:FA,Z_STREAM_ERROR:yi,Z_DATA_ERROR:p1,Z_MEM_ERROR:_1,Z_BUF_ERROR:HA,Z_DEFLATED:m1}=La,n0=16180,Id=16190,Es=16191,up=16192,cp=16194,Ad=16199,Md=16200,dp=16206,Qt=16209,v1=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function jA(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ra=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},NC=e=>{if(ra(e))return yi;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=n0,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,Qo},IC=e=>{if(ra(e))return yi;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,NC(e)},AC=(e,n)=>{let t;if(ra(e))return yi;const r=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?yi:(r.window!==null&&r.wbits!==n&&(r.window=null),r.wrap=t,r.wbits=n,IC(e))},g1=(e,n)=>{if(!e)return yi;const t=new jA;e.state=t,t.strm=e,t.window=null,t.mode=n0;const r=AC(e,n);return r!==Qo&&(e.state=null),r};let hp,fp,y1=!0;const BA=e=>{if(y1){hp=new Int32Array(512),fp=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(Ju(1,e.lens,0,288,hp,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Ju(2,e.lens,0,32,fp,0,e.work,{bits:5}),y1=!1}e.lencode=hp,e.lenbits=9,e.distcode=fp,e.distbits=5},E1=(e,n,t,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(s.window.set(n.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(n.subarray(t-r,t-r+i),s.wnext),(r-=i)?(s.window.set(n.subarray(t-r,t),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whaveg1(e,15),inflateInit2:g1,inflate:(e,n)=>{let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R=0;const A=new Uint8Array(4);let x,U;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ra(e)||!e.output||!e.input&&e.avail_in!==0)return yi;t=e.state,t.mode===Es&&(t.mode=up),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,a=e.avail_in,u=t.hold,c=t.bits,d=a,h=l,I=Qo;e:for(;;)switch(t.mode){case n0:if(t.wrap===0){t.mode=up;break}for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Zn(t.check,A,2,0),u=0,c=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",t.mode=Qt;break}if((15&u)!==m1){e.msg="unknown compression method",t.mode=Qt;break}if(u>>>=4,c-=4,N=8+(15&u),t.wbits===0&&(t.wbits=N),N>15||N>t.wbits){e.msg="invalid window size",t.mode=Qt;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0,t.mode=16182;case 16182:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,t.check=Zn(t.check,A,4,0)),u=0,c=0,t.mode=16183;case 16183:for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>8),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0,t.mode=16184;case 16184:if(1024&t.flags){for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(f=t.length,f>a&&(f=a),f&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(s,s+f),N)),512&t.flags&&4&t.wrap&&(t.check=Zn(t.check,r,f,s)),a-=f,s+=f,t.length-=f),t.length))break e;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(a===0)break e;f=0;do N=r[s+f++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N));while(N&&f>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=Es;break;case 16189:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=dp;break}for(;c<3;){if(a===0)break e;a--,u+=r[s++]<>>=1,c-=1,3&u){case 0:t.mode=16193;break;case 1:if(BA(t),t.mode=Ad,n===Nd){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=Qt}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(a===0)break e;a--,u+=r[s++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=Qt;break}if(t.length=65535&u,u=0,c=0,t.mode=cp,n===Nd)break e;case cp:t.mode=16195;case 16195:if(f=t.length,f){if(f>a&&(f=a),f>l&&(f=l),f===0)break e;i.set(r.subarray(s,s+f),o),a-=f,s+=f,l-=f,o+=f,t.length-=f;break}t.mode=Es;break;case 16196:for(;c<14;){if(a===0)break e;a--,u+=r[s++]<>>=5,c-=5,t.ndist=1+(31&u),u>>>=5,c-=5,t.ncode=4+(15&u),u>>>=4,c-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=Qt;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[q[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,x={bits:t.lenbits},I=Ju(0,t.lens,0,19,t.lencode,0,t.work,x),t.lenbits=x.bits,I){e.msg="invalid code lengths set",t.mode=Qt;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=b,c-=b,t.lens[t.have++]=_;else{if(_===16){for(U=b+2;c>>=b,c-=b,t.have===0){e.msg="invalid bit length repeat",t.mode=Qt;break}N=t.lens[t.have-1],f=3+(3&u),u>>>=2,c-=2}else if(_===17){for(U=b+3;c>>=b,c-=b,N=0,f=3+(7&u),u>>>=3,c-=3}else{for(U=b+7;c>>=b,c-=b,N=0,f=11+(127&u),u>>>=7,c-=7}if(t.have+f>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=Qt;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===Qt)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=Qt;break}if(t.lenbits=9,x={bits:t.lenbits},I=Ju(1,t.lens,0,t.nlen,t.lencode,0,t.work,x),t.lenbits=x.bits,I){e.msg="invalid literal/lengths set",t.mode=Qt;break}if(t.distbits=6,t.distcode=t.distdyn,x={bits:t.distbits},I=Ju(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,x),t.distbits=x.bits,I){e.msg="invalid distances set",t.mode=Qt;break}if(t.mode=Ad,n===Nd)break e;case Ad:t.mode=Md;case Md:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=a,t.hold=u,t.bits=c,OA(e,h),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,a=e.avail_in,u=t.hold,c=t.bits,t.mode===Es&&(t.back=-1);break}for(t.back=0;R=t.lencode[u&(1<>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=R>>>24,v=R>>>16&255,_=65535&R,!(E+b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,t.length=_,v===0){t.mode=16205;break}if(32&v){t.back=-1,t.mode=Es;break}if(64&v){e.msg="invalid literal/length code",t.mode=Qt;break}t.extra=15&v,t.mode=16201;case 16201:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;R=t.distcode[u&(1<>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=R>>>24,v=R>>>16&255,_=65535&R,!(E+b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,64&v){e.msg="invalid distance code",t.mode=Qt;break}t.offset=_,t.extra=15&v,t.mode=16203;case 16203:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=Qt;break}t.mode=16204;case 16204:if(l===0)break e;if(f=h-l,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=Qt;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,p=o-t.offset,f=t.length;f>l&&(f=l),l-=f,t.length-=f;do i[o++]=m[p++];while(--f);t.length===0&&(t.mode=Md);break;case 16205:if(l===0)break e;i[o++]=t.length,l--,t.mode=Md;break;case dp:if(t.wrap){for(;c<32;){if(a===0)break e;a--,u|=r[s++]<{if(ra(e))return yi;let n=e.state;return n.window&&(n.window=null),e.state=null,Qo},inflateGetHeader:(e,n)=>{if(ra(e))return yi;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,Qo):yi},inflateSetDictionary:(e,n)=>{const t=n.length;let r,i,s;return ra(e)?yi:(r=e.state,r.wrap!==0&&r.mode!==Id?yi:r.mode===Id&&(i=1,i=Yu(i,n,t,0),i!==r.check)?p1:(s=E1(e,n,t,t),s?(r.mode=16210,_1):(r.havedict=1,Qo)))},inflateInfo:"pako inflate (from Nodeca project)"},$A=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const MC=Object.prototype.toString,{Z_NO_FLUSH:GA,Z_FINISH:zA,Z_OK:ec,Z_STREAM_END:pp,Z_NEED_DICT:_p,Z_STREAM_ERROR:VA,Z_DATA_ERROR:b1,Z_MEM_ERROR:qA}=La;function tc(e){this.options=t0.assign({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(15&n.windowBits||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TC,this.strm.avail_out=0;let t=Ms.inflateInit2(this.strm,n.windowBits);if(t!==ec)throw new Error(Ta[t]);if(this.header=new $A,Ms.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Dc.string2buf(n.dictionary):MC.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Ms.inflateSetDictionary(this.strm,n.dictionary),t!==ec)))throw new Error(Ta[t])}function mp(e,n){const t=new tc(n);if(t.push(e),t.err)throw t.msg||Ta[t.err];return t.result}tc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=n===~~n?n:n===!0?zA:GA,MC.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),s=Ms.inflate(t,o),s===_p&&i&&(s=Ms.inflateSetDictionary(t,i),s===ec?s=Ms.inflate(t,o):s===b1&&(s=_p));t.avail_in>0&&s===pp&&t.state.wrap>0&&e[t.next_in]!==0;)Ms.inflateReset(t),s=Ms.inflate(t,o);switch(s){case VA:case b1:case _p:case qA:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===pp))if(this.options.to==="string"){let l=Dc.utf8border(t.output,t.next_out),u=t.next_out-l,c=Dc.buf2string(t.output,l);t.next_out=u,t.avail_out=r-u,u&&t.output.set(t.output.subarray(l,l+u),0),this.onData(c)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(s!==ec||a!==0){if(s===pp)return s=Ms.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},tc.prototype.onData=function(e){this.chunks.push(e)},tc.prototype.onEnd=function(e){e===ec&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=t0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var WA={Inflate:tc,inflate:mp,inflateRaw:function(e,n){return(n=n||{}).raw=!0,mp(e,n)},ungzip:mp,constants:La};const{Deflate:KA,deflate:QA,deflateRaw:YA,gzip:ZA}=xA,{Inflate:XA,inflate:JA,inflateRaw:e6,ungzip:t6}=WA;var us,n6={Deflate:KA,deflate:QA,deflateRaw:YA,gzip:ZA,Inflate:XA,inflate:JA,inflateRaw:e6,ungzip:t6,constants:La},C1=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){return n=n6.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(us||(us={}));var st,r6=function(e){function n(t,r){var i=r.sdkState,s=r.dispatcher,o=r.logger,a=e.call(this)||this;return a.lastActive=0,a._iid=t,a._sdkState=i,a._dispatcher=s,a._logger=o,a}return T(n,e),Object.defineProperty(n.prototype,"isOpen",{get:function(){return this.connectionState===us.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return us.CONNECTING;case 1:return us.OPEN}return us.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ws",{get:function(){var t;return(t=this._ws)!==null&&t!==void 0?t:null},enumerable:!1,configurable:!0}),n.prototype._handleMessage=function(t){var r=this;t.split(` -`).forEach(function(i){if(i){var s=mt.createFromRawMessage(r._iid,i);if(r._logger.debug("receive websocket event",s),s.code==="LOGI")r.dispatch("message",s);else if(s.code==="PONG")r.dispatch("pong");else if(s.code==="EXPR"){if(s.payload){var o=new Ul(s.payload);o.expiresIn>=0&&r._dispatcher.dispatch(o)}}else s.code==="NOOP"||r.dispatch("message",s)}})},n.prototype.connect=function(t,r){var i=this;r===void 0&&(r=""),this._ws=new WebSocket(t,encodeURIComponent(r)),this._ws.onopen=function(){i._logger.debug("websocket open"),i.dispatch("open")},this._ws.onmessage=function(s){return y(i,void 0,void 0,function(){var o,a,l,u,c=this;return g(this,function(d){switch(d.label){case 0:return!((u=this._sdkState.websocket)===null||u===void 0)&&u.compression?s.data instanceof Blob?((o=new FileReader).readAsArrayBuffer(s.data),o.onloadend=function(){return y(c,void 0,void 0,function(){var h,f;return g(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,C1(o.result)];case 1:return h=p.sent(),this._handleMessage(h),[3,3];case 2:return f=p.sent(),this.error(f),[3,3];case 3:return[2]}})})},[3,7]):[3,1]:[3,8];case 1:if(!(s.data instanceof ArrayBuffer))return[3,6];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,C1(new Uint8Array(s.data))];case 3:return a=d.sent(),this._handleMessage(a),[3,5];case 4:return l=d.sent(),this.error(l),[3,5];case 5:return[3,7];case 6:typeof s.data=="string"&&this._handleMessage(s.data),d.label=7;case 7:return[3,9];case 8:this._handleMessage(s.data),d.label=9;case 9:return[2]}})})},this._ws.onerror=function(){i._logger.debug("websocket error"),i.dispatch("error",L.networkError)},this._ws.onclose=function(){i._logger.debug("websocket close"),i.dispatch("close")},this.lastActive=Date.now()},n.prototype.disconnect=function(){var t=this;return new Promise(function(r){t._logger.debug("websocket disconnect"),t._ws?(t._ws.onopen=qe,t._ws.onmessage=qe,t._ws.onerror=qe,t.connectionState!==us.CLOSED?(t._ws.onclose=function(){t.dispatch("close"),r()},t._ws.close(),t._ws=void 0):r()):r()})},n.prototype.send=function(t){if(!this._ws)throw L.connectionClosed;t.code!=="PING"?this.dispatch("ping-refresh"):this._logger.debug("send ping",t),this._ws.send(t.convertToMessage())},n.prototype.error=function(t){this._logger.debug("websocket error",t),this.dispatch("error",t)},n}(Ra),xC=function(e){function n(t){var r=t.all,i=t.feed,s=t.custom_types,o=t.ts,a=e.call(this)||this;return a.all=r,a.feed=i,a.customTypes=s,a.ts=o,a}return T(n,e),n}(Tt),i6=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._ackStateMap=new Map,this._sdkState=i,this._dispatcher=s,this._logger=o,this.apiClient=new nA(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this.websocketClient=new r6(n,{sdkState:i,dispatcher:s,logger:o}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new xC(c.payload.unread_cnt)),c.requestId){if(u._ackStateMap.has(c.requestId)){var d=u._ackStateMap.get(c.requestId);c.code!=="EROR"?d.resolve(c):d.reject(new L({code:c.payload.code,message:c.payload.message}))}}else u._dispatcher.dispatch(c)}).on("close",function(){u._ackStateMap.forEach(function(c){c.reject(L.connectionClosed)}),u._ackStateMap.clear()})}return e.prototype._sendApiRequest=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.apiClient.send(n)];case 1:return[2,t.sent()]}})})},e.prototype._sendWebsocketRequest=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(o){if(!this._sdkState.websocket)throw L.connectionRequired;if(t=new Tr,n.ackRequired){i=function(a,l){s._ackStateMap.has(n.requestId)&&(s._ackStateMap.delete(n.requestId),r&&(clearTimeout(r),r=null),a?(s._logger.debug("fail websocket request",n.requestId,a),t.reject(a)):(s._logger.debug("receive websocket ack",n.requestId,n),s._logger.debug("receive websocket ack",l),t.resolve(l)))};try{r=setTimeout(function(){return i(L.noAckTimeout)},this._sdkState.websocket.responseTimeout),this._ackStateMap.set(n.requestId,{resolve:function(a){return i(void 0,a)},reject:function(a){return i(a)}}),this.websocketClient.send(n)}catch(a){i(a)}}else try{this.websocketClient.send(n),t.resolve()}catch(a){t.reject(a)}return[2,t.promise]})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return n instanceof Y?[4,this._sendApiRequest(n)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return n instanceof wr?[4,this._sendWebsocketRequest(n)]:[3,4];case 4:throw L.invalidParameters}})})},e.prototype.cancel=function(n){this.apiClient.cancel(n)},e.prototype.cancelAll=function(){this.apiClient.cancelAll()},e}();(function(e){e[e.NONE=0]="NONE",e[e.INITIALIZED=1]="INITIALIZED",e[e.CONNECTING=2]="CONNECTING",e[e.CONNECTED=3]="CONNECTED",e[e.RECONNECTING=4]="RECONNECTING",e[e.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",e[e.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",e[e.LOGOUT=7]="LOGOUT"})(st||(st={}));var ia,sa,_i=function(e){function n(t){var r=t.stateType,i=e.call(this)||this;return i.stateType=r,i}return T(n,e),n}(Tt),OC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),J_=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),kC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),S1=function(){function e(n){var t,r,i,s;this.isEnabled=(t=n.enabled)!==null&&t!==void 0&&t,this.feedChannels=(r=n.feed_channels)!==null&&r!==void 0?r:{},this.templateListToken=(i=n.template_list_token)!==null&&i!==void 0?i:null,this.settingsUpdatedAt=(s=n.settings_updated_at)!==null&&s!==void 0?s:0}return e.payloadify=function(n){return Ee(Ne({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),zv=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},T1=function(){function e(n){var t;this.lastUpdatedAt=(t=n.last_updated_at)!==null&&t!==void 0?t:0}return e.payloadify=function(n){return Ee(Ne({last_updated_at:n.lastUpdatedAt}))},e}(),w1=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return Ee(Ne({template_list_token:n.token}))},e}(),xd=function(){function e(n){n===void 0&&(n={min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}),this.minStatCount=n.min_stat_count,this.minInterval=1e3*n.min_interval,this.maxStatCountPerRequest=n.max_stat_count_per_request,this.lowerThreshold=n.lower_threshold,this.requestDelayRange=1e3*n.request_delay_range}return e.payloadify=function(n){return Ee(Ne({min_stat_count:n.minStatCount,min_interval:n.minInterval/1e3,max_stat_count_per_request:n.maxStatCountPerRequest,lower_threshold:n.lowerThreshold,request_delay_range:n.requestDelayRange/1e3}))},e}(),vp=function(){function e(n){n===void 0&&(n={default:{min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}}),this.default=new xd(n.default),this.realTime=new xd(n.realtime)}return e.payloadify=function(n){return Ee(Ne({default:xd.payloadify(n.default),realtime:xd.payloadify(n.realTime)}))},e}(),N1=1048576,s6=5;(function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"})(ia||(ia={})),function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"}(sa||(sa={}));var I1=function(){function e(n){var t,r,i,s,o,a,l;n===void 0&&(n={}),this.emojiHash=n.emoji_hash||"",this.uploadSizeLimit=n.file_upload_size_limit?n.file_upload_size_limit*N1:Number.MAX_SAFE_INTEGER,this.useReaction=!!n.use_reaction,this.applicationAttributes=(t=n.application_attributes)!==null&&t!==void 0?t:[],this.premiumFeatureList=(r=n.premium_feature_list)!==null&&r!==void 0?r:[],this.deviceTokenCache=this.applicationAttributes.includes("sdk_device_token_cache"),this.enabledChannelMemberShipHistory=this.applicationAttributes.includes("channel_membership_history"),this.multipleFilesMessageFileCountLimit=(i=n.multiple_file_send_max_size)!==null&&i!==void 0?i:5,this.allowSdkStatsUpload=(s=n.allow_sdk_log_ingestion)===null||s===void 0||s,this.unreadCountThreadingPolicy=(o=n.unread_cnt_threading_policy)!==null&&o!==void 0?o:ia.NONE,this.lastMessageThreadingPolicy=(a=n.last_msg_threading_policy)!==null&&a!==void 0?a:sa.NONE,this.uikitConfigInfo=new T1((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new S1(n.notifications):null,this.messageTemplateInfo=n.message_template?new w1(n.message_template):null,this.statConfigInfo=n.log_publish_config?new vp(n.log_publish_config):new vp}return e.payloadify=function(n){return Ee(Ne({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/N1,application_attributes:n.applicationAttributes,premium_feature_list:n.premiumFeatureList,use_reaction:n.useReaction,allow_sdk_log_ingestion:n.allowSdkStatsUpload,unread_cnt_threading_policy:n.unreadCountThreadingPolicy,last_msg_threading_policy:n.lastMessageThreadingPolicy,uikit_config:n.uikitConfigInfo?T1.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?S1.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?w1.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?vp.payloadify(n.statConfigInfo):null}))},e}(),Wn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),o6=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(r,"/metadata"),s.params={metadata:i},s}return T(n,e),n}(Y),a6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return T(n,e),n}(ae),l6=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(r,"/metadata"),o.params={metadata:i,upsert:s},o}return T(n,e),n}(Y),u6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return T(n,e),n}(ae),c6=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(r,"/metadata/").concat(i),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var d6=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(r,"/metadata"),i}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var hl,Kc=function(e,n){var t=JSON.parse(JSON.stringify(e));return t._iid&&delete t._iid,n&&n(t),t},fa=function(e,n){var t=JSON.parse(JSON.stringify(e));return t},K=function(e){return{do:function(n){e||n()},throw:function(n){if(!e)throw n}}};(function(e){e.ONLINE="online",e.OFFLINE="offline",e.NON_AVAILABLE="nonavailable"})(hl||(hl={}));var Pl,Ke=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t)||this).userId=(s=(i=r.guest_id)!==null&&i!==void 0?i:r.user_id)!==null&&s!==void 0?s:"",b.nickname=(a=(o=r.nickname)!==null&&o!==void 0?o:r.name)!==null&&a!==void 0?a:"",b.plainProfileUrl=(u=(l=r.profile_url)!==null&&l!==void 0?l:r.image)!==null&&u!==void 0?u:"",b.requireAuth=(c=r.require_auth_for_profile_image)!==null&&c!==void 0&&c,b.metaData=(d=r.metadata)!==null&&d!==void 0?d:{},b.connectionStatus=hl.NON_AVAILABLE,Ge(hl,r.is_online)?b.connectionStatus=r.is_online:k("boolean",r.is_online)&&(b.connectionStatus=r.is_online?hl.ONLINE:hl.OFFLINE),b.isActive=(h=r.is_active)===null||h===void 0||h,b.lastSeenAt=(f=r.last_seen_at)!==null&&f!==void 0?f:null,b.preferredLanguages=r.preferred_languages?Pe([],Ae(r.preferred_languages),!1):null,b.friendDiscoveryKey=(p=r.friend_discovery_key)!==null&&p!==void 0?p:null,b.friendName=(m=r.friend_name)!==null&&m!==void 0?m:null,b}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{user_id:t.userId,nickname:t.nickname,profile_url:t.plainProfileUrl,require_auth_for_profile_image:t.requireAuth,metadata:t.metaData,is_online:t.connectionStatus,is_active:t.isActive,last_seen_at:t.lastSeenAt,preferred_languages:t.preferredLanguages,friend_discovery_key:t.friendDiscoveryKey,friend_name:t.friendName})))},Object.defineProperty(n.prototype,"profileUrl",{get:function(){var t=O.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainProfileUrl,"?auth=").concat(t.ekey):this.plainProfileUrl},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return Kc(this)},n.prototype._isValidMetaData=function(t){return!Array.isArray(t)&&Object.keys(t).length>0&&Object.keys(t).map(function(r){return t[r]}).every(function(r){return k("string",r)})},n.prototype._applyMetaData=function(t,r){var i=this;r===void 0&&(r=!1),Object.keys(t).forEach(function(s){r?delete i.metaData[s]:i.metaData[s]=t[s]})},n.prototype.createMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(this._isValidMetaData(t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new o6({userId:i.userId,metadata:t}),[4,s.send(o)];case 1:return a=u.sent(),l=a.as(a6).metaData,this._applyMetaData(l),[2,this.metaData]}})})},n.prototype.updateMetaData=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(this._isValidMetaData(t)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new l6({userId:s.userId,metadata:t,upsert:r}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(u6).metadata,this._applyMetaData(u),[2,this.metaData]}})})},n.prototype.deleteMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(k("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new c6({userId:i.userId,metadataKey:t}),[4,s.send(o)];case 1:return l.sent(),this._applyMetaData(((a={})[t]=!0,a),!0),[2,this.metaData]}})})},n.prototype.deleteAllMetaData=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new d6({userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.metaData={},[2]}})})},n}(Wn),RC=function(e){function n(t){var r=t.userProfile,i=e.call(this)||this;return i.userProfile=r,i}return T(n,e),n}(Tt),em=function(){function e(n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b;this._iid=n,this.appInfo=new I1(t),this.user=new Ke(n,t),this.connectedAt=(r=t.login_ts)!==null&&r!==void 0?r:0,this.firstConnectedAt=0,this.pingInterval=(i=t.ping_interval)!==null&&i!==void 0?i:15e3,this.pongTimeout=(s=t.pong_timeout)!==null&&s!==void 0?s:5e3,this.reconnectInterval=(a=(o=t.reconnect)===null||o===void 0?void 0:o.interval)!==null&&a!==void 0?a:3e3,this.reconnectMaxInterval=(u=(l=t.reconnect)===null||l===void 0?void 0:l.max_interval)!==null&&u!==void 0?u:6e4,this.reconnectRetryCount=(d=(c=t.reconnect)===null||c===void 0?void 0:c.retry_cnt)!==null&&d!==void 0?d:5,this.reconnectIntervalMultiple=(f=(h=t.reconnect)===null||h===void 0?void 0:h.mul)!==null&&f!==void 0?f:2,this.maxUnreadCountOnSuperGroup=(p=t.max_unread_cnt_on_super_group)!==null&&p!==void 0?p:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=(m=t.concurrent_call_limit)!==null&&m!==void 0?m:5,this.backOffDelay=(b=t.back_off_delay)!==null&&b!==void 0?b:100}return e.payloadify=function(n){return Ee(Ne(M(M(M({},Ke.payloadify(n.user)),I1.payloadify(n.appInfo)),{login_ts:n.connectedAt,ping_interval:n.pingInterval,pong_timeout:n.pongTimeout,reconnect:{interval:n.reconnectInterval,max_interval:n.reconnectMaxInterval,retry_cnt:n.reconnectRetryCount,mul:n.reconnectIntervalMultiple},max_unread_cnt_on_super_group:n.maxUnreadCountOnSuperGroup,profile_image_encryption:n.profileImageEncryption,concurrent_call_limit:n.concurrentCallLimit,back_off_delay:n.backOffDelay})))},e.prototype.apply=function(){var n=this.reconnectInterval,t=this.reconnectMaxInterval,r=this.reconnectIntervalMultiple,i=O.of(this._iid);i.sdkState.websocket&&(i.sdkState.websocket.pingInterval=1e3*this.pingInterval,i.sdkState.websocket.pongTimeout=1e3*this.pongTimeout,i.sdkState.websocket.reconnectMaxRetry=this.reconnectRetryCount,i.sdkState.websocket.reconnectRetryStrategy={calcTimeout:function(s){return s>0?1e3*Math.min(n*Math.pow(r,s-1),t):10}}),i.appInfo=this.appInfo,i.sessionManager.currentUser=this.user,i.connectedAt=this.connectedAt,this.firstConnectedAt||(i.firstConnectedAt=this.connectedAt),i.maxSuperGroupChannelUnreadCount=this.maxUnreadCountOnSuperGroup,i.concurrentCallLimit=this.concurrentCallLimit,i.backOffDelay=this.backOffDelay,i.dispatcher.dispatch(new RC({userProfile:this}))},e}(),LC=function(e){function n(t){var r=t.request,i=r===void 0||r,s=t.features,o=s===void 0?{}:s,a=t.options,l=a===void 0?{}:a,u=t.statConfigInfo,c=e.call(this)||this;return c.request=i,c.features=M({localCache:!0,notification:!0},o),c.options=M({ingestion:!0},l),c.statConfigInfo=u,c}return T(n,e),n}(Tt),uh=function(e){function n(t,r,i){var s,o,a,l,u=this;return(u=e.call(this,t,r,i)||this).error=null,u.services=[],u.userProfile=new em(t,i),u.deviceTokenLastDeletedAt=(s=i.device_token_last_deleted_at)!==null&&s!==void 0?s:0,u.key=(o=i.key)!==null&&o!==void 0?o:"",u.ekey=(a=i.ekey)!==null&&a!==void 0?a:"",u.error=i.error?new L(i):null,u.services=(l=i.services)!==null&&l!==void 0?l:[],u}return T(n,e),n.asError=function(t){return new n("","LOGI",M({user_id:"",error:!0},t))},n.prototype.applyTo=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return this.error?[3,4]:(r=O.of(t))?(i=r.sessionManager,s=r.dispatcher,[4,i.login(this)]):[3,2];case 1:return o.sent(),this.userProfile.apply(),s.dispatch(new LC({request:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"),features:{localCache:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"),notification:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish")},options:{ingestion:this.userProfile.appInfo.allowSdkStatsUpload},statConfigInfo:this.userProfile.appInfo.statConfigInfo})),[3,3];case 2:throw L.lostInstance;case 3:return[3,5];case 4:throw this.error;case 5:return[2]}})})},n}(mt),Da=function(){function e(){this.type=st.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnect=function(n,t){return t.error,t.autoReconnect,t.cause,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onLogout=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e}(),De=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e()];case 1:return t.sent(),[3,3];case 2:if(!((n=t.sent())instanceof L))throw n;return n.throwOutside(),[3,3];case 3:return[2]}})})},Ot=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:case 2:return n.sent(),[3,3];case 3:return[2]}})})},wo=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this)||this).type=st.LOGOUT,i.name="logout",i._wasPreviouslyConnected=(r=t.wasPreviouslyConnected)===null||r===void 0||r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r,i,s=this;return g(this,function(o){switch(o.label){case 0:return r=Date.now(),i=t.sdkState.userId,[4,t.logout()];case 1:return o.sent(),[4,t.changeState(new Vv,r)];case 2:return o.sent(),this._wasPreviouslyConnected&&De(function(){return y(s,void 0,void 0,function(){return g(this,function(a){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(Da),r0=function(e){function n(){var t=e.call(this)||this;return t.type=st.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.disconnect()];case 1:return r.sent(),[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new s0({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new tf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new wo,r)];case 1:return i.sent(),[2]}})})},n}(Da),ef=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=st.INTERNAL_DISCONNECTED,i.name="internaldisconnected",i._autoReconnect=!1,i._autoReconnect=r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.disconnect()];case 1:return i.sent(),this._autoReconnect?[4,t.changeState(new tf,r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new s0({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new tf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new r0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new wo,r)];case 1:return i.sent(),[2]}})})},n}(Da),Or=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},DC=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),i0=function(e,n,t){return t===void 0&&(t=new DC),y(void 0,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:r=0,i=null,s=function(c){return i=c??new Error("Halted")},o=function(){r=0},u.label=1;case 1:if(!(n===-1||r=this._stateUpdatedAt?(this._currentState=t,this._stateUpdatedAt=r,this._dispatcher.dispatch(new _i({stateType:t.type})),this._logger.debug("connection state changes to ".concat(t.name)),[4,this._currentState.run(this)]):[3,2];case 1:return i.sent(),[2,!0];case 2:return[2,!1]}})})},n.prototype._tryResolveConnectionRequest=function(){var t;return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=this._unresolvedLogi,this._websocketClient.isOpen&&r?(this._unresolvedLogi=void 0,r.error?[3,2]:[4,r.applyTo(this._iid)]):[3,3];case 1:return i.sent(),this._statLogConnection(),(t=this._pinger)===null||t===void 0||t.start(),this._connectionRequestQueue.forEach(function(s){return s.resolve()}),this._connectionRequestQueue=[],this.sdkState.appState="foreground",[3,3];case 2:this._sessionManager.session.authToken=void 0,(r.error.isSessionExpiredError||r.error.isSessionInvalidatedError)&&this._dispatcher.dispatch(new Ul({reason:r.error.code})),this._rejectConnectionRequest(r.error),i.label=3;case 3:return[2]}})})},n.prototype._rejectConnectionRequest=function(t){var r;if((r=this._pinger)===null||r===void 0||r.stop(),this.clearLoginTimer(),this._connectionRequestQueue.length>0){var i=this._connectionRequestQueue;this._connectionRequestQueue=[],i.forEach(function(s){return s.reject(t)}),this._statLogConnection(t)}},n.prototype._url=function(){var t,r=this.sdkState,i=r.appId,s=r.appVersion,o=r.userId,a=r.extensions,l=r.sendbirdRuntimeEnvironment,u=this.cacheContext.localCacheEnabled,c=this._sessionManager.session,d=(t=this.sdkState.websocket)===null||t===void 0?void 0:t.compression,h=!!(a??{}).sb_uikit,f=Qh.userAgentWithExtension(a);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(bo.OS_VERSION),"&sv=").concat(encodeURIComponent(bo.SDK_VERSION),"&ai=").concat(i).concat(s?"&av=".concat(s):"").concat(c.hasSession?"":"&user_id=".concat(encodeURIComponent(o)),"&pmce=").concat(d?1:0,"&active=1&device_token_types=").concat(encodeURIComponent(["gcm","huawei","apns"].join(",")),"&SB-User-Agent=").concat(f,"&SB-SDK-User-Agent=").concat(encodeURIComponent(Qh.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(PC))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(u?1:0,"&include_poll_details=1").concat(h?"&uikit_config=1":"")},n.prototype._statLogConnection=function(t){var r;this._dispatcher.dispatch(new Bv(new jt({type:yt.WEBSOCKET_CONNECT,data:{host_url:(r=this.sdkState.websocket)===null||r===void 0?void 0:r.host,success:!t,latency:Date.now()-this._connectingAt,error_code:t==null?void 0:t.code,error_description:t==null?void 0:t.message}})))},n.prototype.connect=function(t){var r;return t===void 0&&(t=""),y(this,void 0,void 0,function(){var i,s,o,a=this;return g(this,function(l){return this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(L.connectionCanceled)),i=this._url(),s=new Tr,this._connectionRequestQueue.push(s),this._connectionRequestQueue.length===1&&(this._connectingAt=Date.now(),this._loginTimer=setTimeout(function(){a._loginTimer=void 0,a._rejectConnectionRequest(L.loginTimeout)},(r=this.sdkState.websocket)===null||r===void 0?void 0:r.responseTimeout),o=this._sessionManager.session,t&&(o.authToken=t),o.sessionKey||o.authToken?this._websocketClient.connect(i,JSON.stringify(o.hasSession?{auth:o.sessionKey}:{token:o.authToken})):this._websocketClient.connect(i,JSON.stringify({}))),[2,s.promise]})})},n.prototype.cancelConnectForRetry=function(){this._dispatcher.dispatch(uh.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._websocketClient.disconnect()];case 1:return t.sent(),[2]}})})},n.prototype.logout=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.sdkState.userId=void 0,this._unresolvedLogi=void 0,[4,this.disconnect()];case 1:return t.sent(),[4,this._sessionManager.clear()];case 2:return t.sent(),[2]}})})},n.prototype.clearLoginTimer=function(){this._loginTimer&&(clearTimeout(this._loginTimer),this._loginTimer=void 0)},n}(Ra),FC=function(e){function n(t){var r=t.appId,i=t.userId,s=t.services,o=t.includeUIKitConfig,a=o!==void 0&&o,l=t.localCacheEnabled,u=l===void 0||l,c=t.expiringSession,d=c===void 0||c,h=e.call(this)||this;return h.path="".concat(Xe,"/").concat(i,"/login"),h.method=Q.POST,h.params=Ee({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(PC),uikit_config:a,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return T(n,e),n}(Y),m6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new uh(t,"LOGI",r),i}return T(n,e),n}(ae);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(to||(to={}));var Ut,M1,v6=[jv,FC],g6=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._currentConnectionStateType=st.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new i6(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this._session=r,this._logger=o,this._dispatcher=s,this._dispatcher.on(function(c){var d,h,f,p;if(c instanceof _i){var m=c.stateType;switch(u._currentConnectionStateType=m,m){case st.CONNECTED:u._resolveLazyCallQueue();break;case st.INITIALIZED:case st.INTERNAL_DISCONNECTED:case st.EXTERNAL_DISCONNECTED:case st.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof OC)!((p=u._session.services)===null||p===void 0)&&p.includes(Oc.CHAT)||u._resolveLazyCallQueue(to.API);else if(c instanceof J_||c instanceof kC)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof cC){var b=c.request,v=c.deferred,_=c.error;try{for(var E=ve(v6),S=E.next();!S.done;S=E.next())if(b instanceof S.value)return void v.reject(_)}catch(w){d={error:w}}finally{try{S&&!S.done&&(h=E.return)&&h.call(E)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:b,deferred:v})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===st.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===st.CONNECTING||this._currentConnectionStateType===st.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case to.ALL:t=null;break;case to.WEBSOCKET:t=wr;break;case to.API:t=Y}var s=!1;return this._lazyCallQueue.forEach(function(o){!t||o.command instanceof t||(s=!0),s?i.push(o):r.push(o)}),[r,i]},e.prototype._resolveLazyCallQueue=function(n){var t=this;n===void 0&&(n=to.ALL);var r=Ae(this._classifyLazyCallQueueByScope(n),2),i=r[0],s=r[1];this._lazyCallQueue=s,i.forEach(function(o){return y(t,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:a=o.command,l=o.deferred,(u=o.timeout)&&clearTimeout(u),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.send(a)];case 2:return c=h.sent(),l.resolve(c),[3,4];case 3:return d=h.sent(),l.reject(d),[3,4];case 4:return[2]}})})})},e.prototype._rejectLazyCallQueue=function(n,t){var r=this;t===void 0&&(t=to.ALL);var i=Ae(this._classifyLazyCallQueueByScope(t),2),s=i[0],o=i[1];this._lazyCallQueue=o,s.forEach(function(a){return y(r,void 0,void 0,function(){var l,u;return g(this,function(c){return l=a.deferred,u=a.timeout,clearTimeout(u),l.reject(n),[2]})})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return n instanceof wr?this.isReady?(this._logger.debug("send websocket request",n),[4,this.commandRouter.send(n)]):[3,2]:[3,4];case 1:case 5:case 7:return[2,s.sent()];case 2:if(this.isLazyCallActivated)return this._logger.debug("wait websocket request",n),t=new Tr,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw this._logger.debug("fail websocket request"),L.connectionRequired;case 3:case 9:return[3,11];case 4:return n instanceof Y?this._session.hasSession?(this._logger.debug("send api request",n),[4,this.commandRouter.send(n)]):[3,6]:[3,10];case 6:return n.hasSessionKey?(this._logger.debug("send api request with tmp session key",n),[4,this.commandRouter.send(n)]):[3,8];case 8:if(this.isLazyCallActivated)return this._logger.debug("wait api request",n),t=new Tr,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw r=L.connectionRequired,this._logger.debug("fail api request",r),r;case 10:throw L.invalidCommand;case 11:return[2]}})})},e.prototype.forceSend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof wr||n instanceof Y?[4,this.commandRouter.send(n)]:[3,2];case 1:return[2,t.sent()];case 2:throw L.invalidCommand}})})},e.prototype.timeout=function(n){this._logger.debug("timeout request",n);var t=this._lazyCallQueue.findIndex(function(r){return r.command.requestId===n});t>-1&&(this._lazyCallQueue[t].deferred.reject(L.connectionRequired),this._lazyCallQueue.splice(t,1))},e.prototype.cancel=function(n){this._logger.debug("cancel api request",n),this.commandRouter.cancel(n)},e.prototype.cancelAll=function(){this._logger.debug("cancel all api requests"),this.commandRouter.cancelAll()},e}(),gp="sendbird@devicetokens",yp=function(){function e(n){var t=n.type,r=n.token,i=n.device_os,s=n.device_manufacturer,o=n.system_push_enabled;this.type=t,this.token=r,this.deviceOS=i,this.deviceManufacturer=s,this.systemPushEnabled=o}return e.payloadify=function(n){return Ee(Ne({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),Ep=new WeakMap,y6=function(e){function n(t){var r=t._iid,i=t.session,s=t.cacheContext,o=t.sdkState,a=t.dispatcher,l=t.requestQueue,u=t.logger,c=t.pushNotificationAckManager,d=e.call(this)||this;return d._currentConnectionStateType=st.INITIALIZED,d._isRefreshingAuthToken=!1,d.currentUser=null,d.session=i,d._iid=r,d._cacheContext=s,d._sdkState=o,d._dispatcher=a,d._requestQueue=l,d._logger=u,d._pushNotificationAckManager=c,d._deviceTokens=[],d._dispatcher.on(function(h){var f,p,m;if(h instanceof _i){var b=h.stateType;d._currentConnectionStateType=b}else h instanceof Ul&&d.handler&&!d.isSessionKeyRefreshing&&(!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(v){if(Lr(v)&&d._sdkState.appState==="foreground")throw v}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(v){if(Lr(v)&&d._sdkState.appState==="foreground")throw v}))))}),d}return T(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return Ep.get(this)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokens",{get:function(){return this._deviceTokens},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokenLastDeletedAt",{get:function(){return this._deviceTokenLastDeletedAt},enumerable:!1,configurable:!0}),n.prototype.indexOfDeviceToken=function(t,r){return this._deviceTokens.findIndex(function(i){return i.type===t&&i.token===r})},n.prototype.hasDeviceToken=function(t,r){return this.indexOfDeviceToken(t,r)>=0},n.prototype.createRefreshWebsocketCommand=function(t,r){return new Z4({authToken:t,expiringSession:!0,requestId:r})},n.prototype._refreshSessionKeyByWebSocket=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return r=this.createRefreshWebsocketCommand(t),[4,this._requestQueue.forceSend(r)];case 1:if(i=l.sent(),s=i.as(J4),o=s.newKey,a=s.error)throw a;return this.session.sessionKey=o??this.session.sessionKey,[2]}})})},n.prototype._refreshSessionKeyByApi=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return r=new jv({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,i0(function(o){return y(i,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(r)];case 1:return a=h.sent(),l=a.as(X4),u=l.key,c=l.services,this.session.sessionKey=u,this.session.services=c,[3,3];case 2:if(d=h.sent(),!this._isSessionRelatedError(d))throw d;return o(d),[3,3];case 3:return[2]}})})},3)];case 1:return s.sent(),[2]}})})},n.prototype._refreshSessionKey=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var i,s;return g(this,function(o){switch(o.label){case 0:if(this._currentConnectionStateType!==st.CONNECTED)return[3,8];o.label=1;case 1:return o.trys.push([1,3,,8]),[4,this._refreshSessionKeyByWebSocket(t)];case 2:return o.sent(),this.complete(),[2];case 3:i=o.sent(),o.label=4;case 4:return o.trys.push([4,6,,7]),[4,this._handleSessionRefreshError(i,r)];case 5:return o.sent(),[2];case 6:return o.sent(),[3,7];case 7:return[3,8];case 8:return o.trys.push([8,10,,12]),[4,this._refreshSessionKeyByApi(t)];case 9:return o.sent(),this.complete(),[3,12];case 10:return s=o.sent(),[4,this._handleSessionRefreshError(s,r)];case 11:return o.sent(),[3,12];case 12:return[2]}})})},n.prototype._receiveNewAuthToken=function(){var t,r=this,i=new Tr;if(this._isRefreshingAuthToken=!0,this.session.sessionKey=void 0,this.session.authToken=void 0,(t=this.handler)===null||t===void 0?void 0:t.onSessionTokenRequired){var s=null,o=function(){s&&(clearTimeout(s),s=null)},a=function(u){o(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.resolve(u))},l=function(u){o(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.reject(u))};s=setTimeout(function(){return l()},1e3*this._sdkState.sessionTokenRefreshTimeout),De(function(){return y(r,void 0,void 0,function(){var u;return g(this,function(c){return!((u=this.handler)===null||u===void 0)&&u.onSessionTokenRequired&&this.handler.onSessionTokenRequired(a,l),[2]})})})}else i.resolve(null);return i.promise},n.prototype._handleSessionRefreshError=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Ie.APPLICATION_NOT_FOUND)?(this.session.authToken=void 0,r?[4,this._receiveNewAuthToken()]:[3,6]):[3,6];case 1:return(i=s.sent())?(this.session.authToken=i,[4,this._refreshSessionKey(this.session.authToken,!1)]):[3,3];case 2:return s.sent(),this.complete(),[3,5];case 3:return[4,this.clear()];case 4:s.sent(),s.label=5;case 5:return[2];case 6:throw t}})})},n.prototype._isSessionRelatedError=function(t){return t instanceof L&&(t.isSessionExpiredError||t.isSessionInvalidatedError)},Object.defineProperty(n.prototype,"isSessionKeyRefreshing",{get:function(){return this.session.isRefreshing},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRefreshingAuthToken",{get:function(){return this._isRefreshingAuthToken},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionExpiring",{get:function(){return!!this.handler},enumerable:!1,configurable:!0}),n.prototype.authenticateFeed=function(t,r){var i;return y(this,void 0,void 0,function(){var s,o,a;return g(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new FC({appId:this._sdkState.appId,userId:t,services:[Oc.FEED],includeUIKitConfig:!!((i=this._sdkState.extensions)!==null&&i!==void 0?i:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:!r||this.isSessionExpiring}),[4,this._requestQueue.commandRouter.send(s)];case 1:return o=l.sent(),(a=o.as(m6).logi).error?[3,3]:[4,a.applyTo(this._iid)];case 2:return l.sent(),[3,4];case 3:throw a.error;case 4:return[2]}})})},n.prototype.login=function(t){var r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return i=t.key,s=t.ekey,o=t.services,a=t.userProfile,l=t.deviceTokenLastDeletedAt,u=l===void 0?0:l,this.session.sessionKey=i,this.session.services=o,Ep.set(this,s),this._deviceTokenCacheEnabled=(r=a==null?void 0:a.appInfo)===null||r===void 0?void 0:r.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(gp)]:[3,5];case 1:return!(d=h.sent())||d.lastDeletedAt0&&(this.queue=this.queue.concat(this.flushWaitQueue),this.flushWaitQueue=[])},e.prototype._isDuplicateStat=function(n){var t=this._sentLogStats.find(function(r){var i;return r.channelUrl===n.data.channel_url&&r.messageId===((i=n.data.notificationId)!==null&&i!==void 0?i:n.data.message_id)&&r.action===n.data.action});return t||this._sentLogStats.push({channelUrl:n.data.channel_url,messageId:n.data.message_id,action:n.data.action}),!!t},e.prototype._flush=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:if(t=!0,!(n.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),r=Pe([],Ae(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new E6({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=Pe([],Ae(n),!1).slice(r.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(s=o.sent())instanceof L?s.code!==Ie.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=Ut.DISABLED,[3,7];case 6:s.code===Ie.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=Ut.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},e.prototype._save=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Pe(Pe([],Ae(this.queue),!1),Ae(this.flushWaitQueue),!1),[4,this.cacheContext.preference.set(this.key,{deviceId:this.logInfo.deviceId,statLogs:n.map(function(r){return jt.payloadify(r)}),generation:this.logInfo.generation++,lastFlushedAt:this.logInfo.lastFlushedAt})];case 1:return t.sent(),[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.queue=[],this.flushWaitQueue=[],this.logInfo.generation=1,this._save(),[2]})})},e}(),Fl=function(e){function n(t){var r,i,s,o,a=t.type,l=t.data,u=t.ts,c=u===void 0?Date.now():u,d=e.call(this,{type:a,data:l,ts:c})||this;return d.date=new Date(c),d.key="".concat((r=d.date,i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),o=String(r.getDate()).padStart(2,"0"),"".concat(i).concat(s).concat(o)),"_").concat(a),d}return T(n,e),n}(jt),b6=function(e){function n(t){var r=t.deviceId,i=t.cacheContext,s=t.requestQueue;return e.call(this,{deviceId:r,cacheContext:i,requestQueue:s})||this}return T(n,e),Object.defineProperty(n.prototype,"_isSendable",{get:function(){return this.queue.length!==0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".daily")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){return new jt({type:i.stat_type,ts:i.ts,data:i.data})}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?Ut.ENABLED:Ut.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ut.DISABLED,[4,this.clear()];case 2:l.sent(),l.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:i=l.sent(),s=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),o=0,l.label=5;case 5:return o=this.statConfig.minStatCount&&this.queue.length>this.statConfig.lowerThreshold||this.logInfo.lastFlushedAt>0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".realtime")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){var s;return i.data=Ee(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new jt({type:i.stat_type,ts:i.ts,data:i.data})}),this._sentLogStats=this.queue.map(function(i){var s;return{channelUrl:i.data.channelUrl,messageId:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,action:i.data.action}}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?Ut.ENABLED:Ut.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ut.DISABLED,[4,this.clear()];case 2:s.sent(),s.label=3;case 3:return this.isEnabled&&this._isSendable?(i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),[4,Or(i)]):[3,6];case 4:return s.sent(),[4,this._flush(this.queue)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},n.prototype.put=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.enabledState===Ut.DISABLED?[2,!0]:(r=this.enabledState===Ut.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===Ut.PENDING?[3,2]:[4,this._save()]));case 1:i.sent(),i.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this.isEnabled&&this._isSendable?[4,this._flush(r)]:[3,4]):[3,4];case 3:return[2,i.sent()];case 4:return[2,!0]}})})},n}(qv),T6=function(){function e(n){var t=n.cacheContext,r=n.requestQueue,i=n.dispatcher,s=n.logger;this._collectRequestStat=!0,this._collectFeatureLocalCacheStat=!0,this._collectionNotificationStat=!0,this._retryCount=0,this.deviceId=$s(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new b6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new C6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new S6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue})}return e.prototype._migration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return[4,this.cacheContext.preference.get(this.key)];case 1:return(n=s.sent())?(t=[],n.statLogs.forEach(function(o){o.stat_type===yt.FEATURE_LOCALCACHE&&t.push(new jt({type:o.stat_type,ts:o.ts,data:o.data}))}),[4,this.cacheContext.preference.set(this.key+".daily",{deviceId:n.deviceId,statLogs:t.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(o){o.stat_type!==yt.FEATURE_LOCALCACHE&&o.stat_type!==yt.NOTIFICATION&&(o.stat_type===yt.FEATURE_LOCALCACHE_EVENT&&(o.data=M({message_init_policy:"",starting_point:0},o.data)),r.push(new jt({type:o.stat_type,ts:o.ts,data:o.data})))}),[4,this.cacheContext.preference.set(this.key+".default",{deviceId:n.deviceId,statLogs:r.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(o){var a;o.stat_type===yt.NOTIFICATION&&(o.data=Ee(M(M({},o.data),{message_id:(a=o.data.notificationId)!==null&&a!==void 0?a:o.data.message_id,notificationId:void 0})),i.push(new jt({type:o.stat_type,ts:o.ts,data:o.data})))}),[4,this.cacheContext.preference.set(this.key+".realtime",{deviceId:n.deviceId,statLogs:i.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 4:return s.sent(),[4,this.cacheContext.preference.remove(this.key)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},e.prototype.init=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this.key=n,[4,this._migration()];case 1:return r.sent(),[4,this._dailyStatCollector.init(this.key)];case 2:return r.sent(),[4,this._defaultStatCollector.init(this.key)];case 3:return r.sent(),[4,this._realTimeStatCollector.init(this.key)];case 4:return r.sent(),this.commandEventContext||(this.commandEventContext=this.dispatcher.on(function(i){return y(t,void 0,void 0,function(){var s,o,a,l,u,c;return g(this,function(d){return i instanceof Bv?(s=i.statLog,this.put(s)):i instanceof LC&&(o=i.request,a=i.features,l=i.options,u=i.statConfigInfo,this._retryCount=0,this._collectRequestStat=o,this._collectFeatureLocalCacheStat=a==null?void 0:a.localCache,this._collectionNotificationStat=a==null?void 0:a.notification,this._statConfig=u,this._dailyStatCollector.setConfig(this._statConfig.default,{localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._defaultStatCollector.setConfig(this._statConfig.default,{requestStat:this._collectRequestStat,localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._realTimeStatCollector.setConfig((c=this._statConfig.realTime)!==null&&c!==void 0?c:this._statConfig.default,{notificationStat:this._collectionNotificationStat,enabledStat:l.ingestion})),[2]})})})),[2]}})})},e.prototype.put=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=!0,n instanceof Fl?this._collectFeatureLocalCacheStat?[4,this._dailyStatCollector.put(n)]:[3,2]:[3,3];case 1:t=r.sent(),r.label=2;case 2:return[3,13];case 3:switch(n.type){case yt.API_RESULT:case yt.WEBSOCKET_CONNECT:return[3,4];case yt.FEATURE_LOCALCACHE:case yt.FEATURE_LOCALCACHE_EVENT:return[3,7];case yt.NOTIFICATION:return[3,10]}return[3,13];case 4:return this._collectRequestStat?[4,this._defaultStatCollector.put(n)]:[3,6];case 5:t=r.sent(),r.label=6;case 6:return[3,13];case 7:return this._collectFeatureLocalCacheStat?[4,this._defaultStatCollector.put(n)]:[3,9];case 8:t=r.sent(),r.label=9;case 9:return[3,13];case 10:return this._collectionNotificationStat?[4,this._realTimeStatCollector.put(n)]:[3,12];case 11:t=r.sent(),r.label=12;case 12:return[3,13];case 13:return t?this._retryCount=0:(this._retryCount++,this._retryCount>20&&(this._dailyStatCollector.enabledState=Ut.COLLECT_ONLY,this._defaultStatCollector.enabledState=Ut.COLLECT_ONLY,this._realTimeStatCollector.enabledState=Ut.COLLECT_ONLY,this.logger.debug(L.statLogUploadLimitExceededError))),[2]}})})},e.prototype.close=function(){this.commandEventContext&&(this.commandEventContext.close(),this.commandEventContext=void 0)},e}();(function(e){e.DELIVERY_RECEIPT="delivery_receipt",e.PUSH_ACKNOWLEDGEMENT="push_acknowledgement"})(nf||(nf={}));var G,w6=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._pushAckedCache={},t}return T(n,e),n.prototype.isAcked=function(t,r){var i,s="".concat(t,"_").concat(r);return(i=this._pushAckedCache[s])!==null&&i!==void 0&&i},n.prototype.markAsAcked=function(t,r){var i="".concat(t,"_").concat(r);this._pushAckedCache[i]=!0},n.prototype.clear=function(){O.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},n.prototype.parseData=function(t){var r,i,s,o,a=O.of(this._iid).logger,l=t.sendbird;if(typeof l=="string")try{l=JSON.parse(l)}catch{throw a.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError}if(!l||typeof l!="object")throw a.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError;var u=(r=l.push_tracking_id)!==null&&r!==void 0?r:"",c=l.notification_message_id,d=l.notification_channel_key,h=l.notification_template_key,f=l.notification_event_deadline,p=(i=l.session_key)!==null&&i!==void 0?i:{},m=(s=p==null?void 0:p.key)!==null&&s!==void 0?s:"",b=(o=p==null?void 0:p.topics)!==null&&o!==void 0?o:[];if(typeof u!="string"||u.length===0)throw a.info("push tracking id is not available"),L.malformedDataError;if(typeof c!="string"||c.length===0)throw a.info("message id is not available"),L.malformedDataError;return{pushTrackingId:u,sessionKey:m,sessionTopics:b,messageId:c,channelKey:d,templateKey:h,notificationEventDeadline:f}},n}(Wn),Fo={},O=function(){function e(n,t){var r,i,s,o,a,l,u,c,d;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!Fo[n]){Fo[n]=this;var h=(r=t.options)!==null&&r!==void 0?r:new nC,f=this.sdkState={appId:t.appId,appVersion:(i=t.appVersion)!==null&&i!==void 0?i:"",appState:"foreground",userId:void 0,extensions:{},api:{host:(s=t.apiHost)!==null&&s!==void 0?s:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:(o=t.websocketHost)!==null&&o!==void 0?o:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new DC,responseTimeout:h.websocketResponseTimeout},sessionTokenRefreshTimeout:h.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var p=this.logger=t.logger;this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map;var m=this.cacheContext=new F4({encryption:t.encryption,store:t.store,localCacheEnabled:(a=t.localCacheEnabled)!==null&&a!==void 0&&a,localCacheConfig:(l=t.localCacheConfig)!==null&&l!==void 0?l:new iC});this.debugMode=(u=t.debugMode)!==null&&u!==void 0&&u,this.maxSuperGroupChannelUnreadCount=bo.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=h.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=h.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=h.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var b=this.dispatcher=new B4,v=new j4;this.requestQueue=new g6(n,{session:v,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new w6(n),this.sessionManager=new y6({_iid:n,session:v,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new h6(n,{sdkState:f,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:b,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:(c=t.disableWebSocketCloseEventHandling)!==null&&c!==void 0&&c,logger:p}),this.statManager=new T6({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=(d=t.appStateToggleEnabled)===null||d===void 0||d}return Fo[n]}return e.of=function(n){if(Fo[n])return Fo[n];throw L.lostInstance},e.clear=function(n){Fo[n]&&delete Fo[n]},e.prototype.hasExtension=function(n){return this.sdkState.extensions&&this.sdkState.extensions[n]},e}(),Wv=function(){function e(){}return e.prototype.init=function(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,o=t.requestQueue,a=t.logger;t.onlineDetector;var l=t.cacheContext;this._iid=n,this._cacheContext=l,this._sdkState=r,this._dispatcher=i,this._sessionManager=s,this._requestQueue=o,this._logger=a},e}();(function(e){e.UNKNOWN="UNKNOWN",e.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",e.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",e.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",e.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",e.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",e.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",e.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",e.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",e.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",e.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",e.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",e.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",e.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",e.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",e.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",e.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",e.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",e.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",e.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",e.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",e.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",e.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",e.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",e.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",e.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",e.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",e.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",e.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",e.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",e.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",e.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",e.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",e.REQUEST_CHANNEL="REQUEST_CHANNEL",e.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",e.REFRESH_CHANNEL="REFRESH_CHANNEL",e.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",e.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",e.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",e.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",e.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",e.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",e.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",e.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",e.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",e.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",e.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",e.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",e.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",e.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",e.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",e.REQUEST_MESSAGE="REQUEST_MESSAGE",e.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",e.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",e.EVENT_POLL_VOTED="EVENT_POLL_VOTED",e.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",e.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",e.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",e.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",e.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",e.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",e.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",e.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",e.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",e.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",e.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED"})(G||(G={}));var Hl;M({},G);var Ns=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===G.SYNC_MESSAGE_FILL||e===G.SYNC_MESSAGE_CHANGELOGS||e===G.SYNC_POLL_CHANGELOGS},Et=function(e){function n(t){var r=t.messages,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.messages=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),Kv=function(e){function n(t){var r=t.messageIds,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.messageIds=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),jC=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.event=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),BC=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.event=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),$C=function(e){function n(t){var r=t.reqId,i=t.source,s=e.call(this)||this;return s.reqId=r,s.source=i,s}return T(n,e),n}(Tt),GC=function(e){function n(t){var r=t.polls,i=t.source,s=e.call(this)||this;return s.polls=r,s.source=i,s}return T(n,e),n}(Tt),zC=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(Tt),Qv=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(Tt);(function(e){e.OPEN="open",e.CLOSED="closed"})(Hl||(Hl={}));var N6="removed",tm=function(e){switch(e){case"open":return Hl.OPEN;case"closed":return Hl.CLOSED;default:return null}},VC=function(e){return!e||!!e.text&&k("string",e.text)},ch=function(e){function n(t,r){var i,s,o,a,l,u,c,d=this;return(d=e.call(this,t)||this).pollId=0,d.id=0,d.text=null,d.voteCount=0,d.createdBy=null,d.createdAt=0,d.updatedAt=0,d._lastVotedAt=0,d.pollId=(i=r.poll_id)!==null&&i!==void 0?i:0,d.id=(s=r.id)!==null&&s!==void 0?s:0,d.text=(o=r.text)!==null&&o!==void 0?o:null,d.voteCount=(a=r.vote_count)!==null&&a!==void 0?a:0,d.createdBy=(l=r.created_by)!==null&&l!==void 0?l:null,d.createdAt=(u=r.created_at)!==null&&u!==void 0?u:0,d.updatedAt=(c=r.updated_at)!==null&&c!==void 0?c:0,d}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},n}(Wn),Oi=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v=this;return(v=e.call(this,t)||this).id=0,v.title=null,v.createdAt=0,v.updatedAt=0,v.closeAt=-1,v.status=Hl.CLOSED,v.messageId=0,v.data=null,v.voterCount=-1,v.options=[],v.createdBy=null,v.allowUserSuggestion=!1,v.allowMultipleVotes=!1,v.votedPollOptionIds=[],v.id=(i=r.id)!==null&&i!==void 0?i:0,v.title=(s=r.title)!==null&&s!==void 0?s:null,v.createdAt=(o=r.created_at)!==null&&o!==void 0?o:0,v.updatedAt=(a=r.updated_at)!==null&&a!==void 0?a:0,v.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,v.status=(u=tm(r.status))!==null&&u!==void 0?u:Hl.CLOSED,v.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,v.data=(d=r.data)!==null&&d!==void 0?d:null,v.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,v.options=r.options?r.options.map(function(_){return new ch(v._iid,_)}):[],v.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,v.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,v.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,v.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],v}return T(n,e),n.prototype._applyPollUpdatePayload=function(t){var r,i,s,o,a,l,u,c,d=this;this.title=(r=t.title)!==null&&r!==void 0?r:this.title,this.updatedAt=(i=t.updated_at)!==null&&i!==void 0?i:this.updatedAt,this.closeAt=(s=t.close_at)!==null&&s!==void 0?s:this.closeAt,this.status=(o=tm(t.status))!==null&&o!==void 0?o:this.status,this.data=(a=t.data)!==null&&a!==void 0?a:this.data,this.voterCount=(l=t.voter_count)!==null&&l!==void 0?l:this.voterCount,t.options&&(this.options=t.options.map(function(h){return new ch(d._iid,h)}),this.votedPollOptionIds=t.options.filter(function(h){return h.vote_count>0}).map(function(h){return h.id})),this.allowUserSuggestion=(u=t.allow_user_suggestion)!==null&&u!==void 0?u:this.allowUserSuggestion,this.allowMultipleVotes=(c=t.allow_multiple_votes)!==null&&c!==void 0?c:this.allowMultipleVotes},n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(r){return ch.payloadify(r)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},n.prototype.applyPollUpdateEvent=function(t){var r=t._payload.poll;return!(!r||this.id!==r.id||r.updated_at-1){var u=r[l];o>=u._lastVotedAt&&(u.voteCount=a.vote_count,u._lastVotedAt=o)}}),s.req_id&&s.voted_option_ids&&(this.votedPollOptionIds=s.voted_option_ids),typeof s.voter_count=="number"&&(this.voterCount=s.voter_count),!0},n.prototype.serialize=function(){return Kc(this)},n}(Wn),Uo=function(){function e(n,t){var r;this.limit=20,this._isLoading=!1,this._hasNext=!0,this._token="",this._iid=n,this.limit=(r=t.limit)!==null&&r!==void 0?r:20}return Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),e.prototype._validate=function(){return k("number",this.limit)&&this.limit>0},e}(),zs=function(e){function n(t,r,i,s){var o=e.call(this,t,s)||this;return o.channelUrl=r,o.channelType=i,o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl)&&Ge(Ze,this.channelType)},n}(Uo),I6=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},A6=function(e){function n(t){var r=t.title,i=t.optionTexts,s=t.data,o=t.allowUserSuggestion,a=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Q.POST,u.path=Yi,u.params={title:r,options:i,data:s,allow_user_suggestion:o,allow_multiple_votes:a,close_at:l},u}return T(n,e),n}(Y),M6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),x6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(Yi,"/").concat(encodeURIComponent(s)),o.params={channel_url:r,channel_type:i},o}return T(n,e),n}(Y),O6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),k6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.pollOptionId,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o)),a.params={channel_url:r,channel_type:i},a}return T(n,e),n}(Y),R6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new ch(t,r),i}return T(n,e),n}(ae),L6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),a.params=Ee({change_ts:s,token:o}),a}return T(n,e),n}(Y),D6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedPolls=r.updated.map(function(s){return function(o,a){return new Oi(o,a)}(t,s)}),i.deletedPollIds=r.deleted.map(function(s){return s}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(ae),U6={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},qC=function(e){return k("string",e.title)&&(n=e.optionTexts,We("string",n)&&n.every(function(t){return t.trim()!==""}))&&VC(e.data)&&k("boolean",e.allowUserSuggestion,!0)&&k("boolean",e.allowMultipleVotes,!0)&&k("number",e.closeAt,!0);var n},P6={channelUrl:"",channelType:Ze.BASE,pollId:0,pollOptionId:0},WC=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ge(Ze,e.channelType)&&k("number",e.pollId)&&e.pollId>0&&k("number",e.pollOptionId)&&e.pollOptionId>0},F6={channelUrl:"",channelType:Ze.BASE,pollId:0},KC=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ge(Ze,e.channelType)&&k("number",e.pollId)},x1={},rf=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,o=t.requestQueue,a=t.logger;this._iid=n,this._sdkState=r,this._sessionManager=s,this._requestQueue=o,this._dispatcher=i,this._logger=a,x1[n]=this}return e.of=function(n){return x1[n]},e.prototype.buildPollFromSerializedData=function(n){var t=fa(n);return new Oi(this._iid,Oi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(KC(n)).throw(L.invalidParameters),t=new x6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(O6).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(qC(n)).throw(L.invalidParameters),t=new A6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(M6).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(WC(n)).throw(L.invalidParameters),t=new k6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(R6).pollOption]}})})},e.prototype.getPollChangeLogs=function(n,t,r,i){return i===void 0&&(i=G.SYNC_POLL_CHANGELOGS),y(this,void 0,void 0,function(){var s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return s=new L6(Ne({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null})),[4,this._requestQueue.send(s)];case 1:return o=h.sent(),a=o.as(D6),l=a.updatedPolls,u=a.deletedPollIds,c=a.hasMore,d=a.nextToken,l.length>0&&this._dispatcher.dispatch(new GC({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),H6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,o=t.limit,a=e.call(this)||this;return a.method=Q.GET,a.path=Yi,a.params={channel_url:r,channel_type:i,token:s,limit:o},a}return T(n,e),n}(Y),j6=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).polls=((i=r.polls)!==null&&i!==void 0?i:[]).map(function(o){return new Oi(t,o)}),s.token=r.next,s}return T(n,e),n}(ae),QC=function(e){function n(t,r){return e.call(this,t,r.channelUrl,r.channelType,r)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new H6(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(j6),o=s.polls,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),B6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.pollOptionId,a=t.token,l=t.limit,u=e.call(this)||this;return u.method=Q.GET,u.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o),"/voters"),u.params={channel_url:r,channel_type:i,token:a,limit:l},u}return T(n,e),n}(Y),$6=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).voters=((i=r.voters)!==null&&i!==void 0?i:[]).map(function(o){return new Ke(t,o)}),s.token=r.next,s}return T(n,e),n}(ae),YC=function(e){function n(t,r){var i=e.call(this,t,r.channelUrl,r.channelType,r)||this;return i.pollId=r.pollId,i.pollOptionId=r.pollOptionId,i}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("number",this.pollId)&&k("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new B6(M(M({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as($6),o=s.voters,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),Uc,Vs=function(){function e(n,t,r){var i,s;this.width=0,this.height=0,this.realWidth=0,this.realHeight=0,this._requireAuth=!1,this._iid=n,this.plainUrl=t.url,this.width=t.width,this.height=t.height,this.realWidth=(i=t.real_width)!==null&&i!==void 0?i:t.width,this.realHeight=(s=t.real_height)!==null&&s!==void 0?s:t.height,this._requireAuth=r}return e.payloadify=function(n){return Ee(Ne(n instanceof e?{url:n.plainUrl,width:n.width,height:n.height,real_width:n.realWidth,real_height:n.realHeight}:{url:"",width:n.maxWidth,height:n.maxHeight,real_width:0,real_height:0}))},Object.defineProperty(e.prototype,"url",{get:function(){var n=O.of(this._iid).sessionManager;return this._requireAuth&&n.ekey?"".concat(this.plainUrl,"?auth=").concat(n.ekey):this.plainUrl},enumerable:!1,configurable:!0}),e}(),sf=function(e){function n(t){var r=e.call(this)||this;if(r.method=Q.POST,r.path="".concat($4),r.params=Ee({file:t.file,channel_url:t.channelUrl}),t.thumbnailSizes)for(var i=0;i0:void 0,u.lastRepliedAt=(a=r.last_replied_at)!==null&&a!==void 0?a:0,u.updatedAt=(l=r.updated_at)!==null&&l!==void 0?l:0,u}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{reply_count:t.replyCount,unread_message_count:t.unreadReplyCount,member_count:t.memberCount,most_replies:Array.isArray(t.mostRepliedUsers)?t.mostRepliedUsers.map(function(r){return Ke.payloadify(r)}):[],push_enabled:typeof t.isPushNotificationEnabled=="boolean"?t.isPushNotificationEnabled?1:0:void 0,last_replied_at:t.lastRepliedAt,updated_at:t.updatedAt})))},Object.defineProperty(n.prototype,"_isUpdateRequired",{get:function(){return this.unreadReplyCount===void 0||this.isPushNotificationEnabled===void 0},enumerable:!1,configurable:!0}),n.prototype._updateFrom=function(t){var r,i;this.unreadReplyCount=(r=t.unreadReplyCount)!==null&&r!==void 0?r:this.unreadReplyCount,this.isPushNotificationEnabled=(i=t.isPushNotificationEnabled)!==null&&i!==void 0?i:this.isPushNotificationEnabled},n}(Wn);(function(e){e.ADD="add",e.DELETE="delete"})(Uc||(Uc={}));var no,Yv=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=k("string",e.msg_id)?parseInt(e.msg_id):e.msg_id,t=e.user_id,r=e.operation?e.operation.toLowerCase():null,i=e.reaction,s=e.updated_at;n&&k("string",t)&&k("string",r)&&Ge(Uc,r)&&k("string",i)&&i&&k("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},Od=function(){function e(n){var t,r,i,s=n.key,o=(i=Pe([],Ae(n.user_ids),!1))!==null&&i!==void 0?i:[],a=n.updated_at;k("string",s)&&s&&We("string",o)&&o.length>0&&k("number",a)&&(this.key=s,this.userIds=o,this.updatedAt=a);var l={};try{for(var u=ve(this.userIds),c=u.next();!c.done;c=u.next())l[c.value]=this.updatedAt}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this._version=l}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.userIds.length===0},enumerable:!1,configurable:!0}),e.payloadify=function(n){return Ee(Ne({key:n.key,user_ids:n.userIds,updated_at:n.updatedAt}))},e.prototype.applyEvent=function(n){if(n.key===this.key&&this.updatedAt<=n.updatedAt){if(!this._version[n.userId]||this._version[n.userId]<=n.updatedAt){var t=this.userIds.indexOf(n.userId);switch(n.operation){case Uc.ADD:t<0&&this.userIds.push(n.userId);break;case Uc.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),O1=function(){function e(n){this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,this.url=n.url,n.secure_url&&(this.secureUrl=n.secure_url),n.type&&(this.type=n.type),n.width&&(this.width=n.width),n.height&&(this.height=n.height),n.alt&&(this.alt=n.alt)}return e.payloadify=function(n){var t,r;return Ee(Ne({url:n.url,secure_url:n.secureUrl,type:n.type,width:(t=n.width)!==null&&t!==void 0?t:0,height:(r=n.height)!==null&&r!==void 0?r:0,alt:n.alt}))},e}(),k1=function(){function e(n){this.title=null,this.url=null,this.description=null,this.defaultImage=null,n["og:title"]&&(this.title=n["og:title"]),n["og:url"]&&(this.url=n["og:url"]),n["og:description"]&&(this.description=n["og:description"]),n["og:image"]&&(this.defaultImage=new O1(n["og:image"]))}return e.payloadify=function(n){return Ee(Ne({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?O1.payloadify(n.defaultImage):null}))},e}(),ki=function(){function e(n){var t,r;this.volume=0,this.name=(t=n.name)!==null&&t!==void 0?t:"default",this.volume=(r=n.volume)!==null&&r!==void 0?r:1}return e.prototype.serialize=function(){return{name:this.name,volume:this.volume}},e.payloadify=function(n){return Ee(Ne({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(no||(no={}));var R1,pa=function(){function e(n){this.id=n.id,this.rating=n.rating,this.comment=n.comment}return e.parseFeedbackStatusFromPayload=function(n){return n&&n.id!==null&&n.rating!==null?"SUBMITTED":"NOT_APPLICABLE"},e.payloadify=function(n){return Ee(Ne({id:n.id,rating:n.rating,comment:n.comment}))},e}(),jl=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isBlockedByMe=!1,s.role=Ge(Ii,r.role)?r.role:Ii.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ke),pr=function(){function e(n){this.key=n.key,this.value=We("string",n.value)?Pe([],Ae(n.value),!1):[]}return e.payloadify=function(n){var t;return Ee(Ne({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),ZC=function(e){switch(e){case bt.BASE:return"";case bt.USER:return"MESG";case bt.FILE:return"FILE";case bt.ADMIN:return"ADMM"}},XC=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p=this;(p=e.call(this,t)||this).channelType=Ze.BASE,p.messageType=bt.BASE,p.mentionType=null,p.mentionedUsers=null,p.mentionedUserIds=null,p.metaArrays=[],p.extendedMessage={},p.createdAt=0,p.updatedAt=0,p.channelUrl=r.channel_url,p.channelType=Ge(Ze,r.channel_type)?r.channel_type:Ze.GROUP,r.channel&&(r.channel.channel_url&&(p.channelUrl=r.channel.channel_url),r.channel.channel_type&&(p.channelType=r.channel.channel_type)),p.data=(i=r.data)!==null&&i!==void 0?i:"",p.customType=(s=r.custom_type)!==null&&s!==void 0?s:"",p.mentionType=Ge(nr,r.mention_type)?r.mention_type:null,p.mentionedUsers=r.mentioned_users?r.mentioned_users.map(function(E){return new Ke(p._iid,E)}):null,p.mentionedUserIds=(o=r.mentioned_user_ids)!==null&&o!==void 0?o:null,p.mentionedUsers&&!p.mentionedUserIds&&(p.mentionedUserIds=p.mentionedUsers.map(function(E){return E.userId})),p.mentionedMessageTemplate=(a=r.mentioned_message_template)!==null&&a!==void 0?a:"";var m=(l=r.metaarray)!==null&&l!==void 0?l:{},b=(u=r.metaarray_key_order)!==null&&u!==void 0?u:Object.keys(m).sort(function(E,S){return E.localeCompare(S)});p.metaArrays=[];for(var v=0;v0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return this.fields.every(function(n){return n.isSubmittable})},enumerable:!1,configurable:!0}),e.prototype.getFieldAnswer=function(n){var t;return(t=this.answers)===null||t===void 0?void 0:t[n]},e.payloadify=function(n){var t;return Ee(Ne({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return JC.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),JC=function(){function e(n){this.key=n.key,this.inputType=n.input_type,this.title=n.title,this.required=n.required,this.regex=n.regex,this.placeholder=n.placeholder,this.fieldKey=n.key}return e.prototype.isValid=function(n){if(!this.regex)return!0;try{return new RegExp(this.regex).test(n)}catch{return!0}},Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return!(this.temporaryAnswer!=null&&!this.isValid(this.temporaryAnswer)||this.required&&this.temporaryAnswer==null)},enumerable:!1,configurable:!0}),e.payloadify=function(n){var t;return Ee(Ne({key:(t=n.fieldKey)!==null&&t!==void 0?t:n.key,input_type:n.inputType,title:n.title,required:n.required,regex:n.regex,placeholder:n.placeholder}))},e}(),eS=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",o.channelType=(s=r.channel_type)!==null&&s!==void 0?s:Ze.GROUP,o.reader=new Ke(o._iid,r.user),o.readAt=r.ts,o}return T(n,e),n}(Wn),G6=function(e){function n(t){var r=t.channelUrl;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r}})||this}return T(n,e),n}(wr);(function(e){function n(t){var r=e.call(this)||this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.notificationIds;return r.method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=Ee(Ne({user_id:o,message_ids:a})),r}return T(n,e),n})(Y);var tS=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new eS(t,i),s}return T(n,e),n}(mt);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.readAt=r.ts,i.unreadMessageCount=r.unread_message_count,i}return T(n,e),n})(ae);var z6=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r,parent_message_id:i}})||this}return T(n,e),n}(wr),V6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.pushEnabled,a=e.call(this)||this;return a.method=Q.PUT,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/thread_push"),a.params={push_enabled:o},a}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var L1=function(e){function n(t){var r=e.call(this)||this;return r.method=Q.POST,r.path="".concat(ir,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=Ee({forms:t.forms}),r}return T(n,e),n}(Y),q6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.rating,a=t.comment,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks"),l.params={rating:o,comment:a},l}return T(n,e),n}(Y),W6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}return T(n,e),n}(ae),K6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.feedbackId,a=t.rating,l=t.comment,u=e.call(this)||this;return u.method=Q.PUT,u.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),u.params={rating:a,comment:l},u}return T(n,e),n}(Y),Q6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}return T(n,e),n}(ae),Y6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.feedbackId,a=e.call(this)||this;return a.method=Q.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),a}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}T(n,e)})(ae);var uo,ri,nm=function(e){function n(t,r){var i,s,o,a,l,u=this;return(u=e.call(this,t)||this).plainUrl="",u.fileName=null,u.mimeType=null,u.fileSize=0,u.thumbnails=[],u._requireAuth=!1,u.plainUrl=(i=r.url)!==null&&i!==void 0?i:"",u.fileName=(s=r.file_name)!==null&&s!==void 0?s:null,u.mimeType=(o=r.file_type)!==null&&o!==void 0?o:null,u.fileSize=(a=r.file_size)!==null&&a!==void 0?a:0,u._requireAuth=(l=r.require_auth)!==null&&l!==void 0&&l,u.thumbnails=r.thumbnails?r.thumbnails.map(function(c){var d;return new Vs(u._iid,typeof c=="string"?{url:c,width:0,height:0}:M(M({},c),{url:((d=c.url)!==null&&d!==void 0?d:"").split("auth=")[0]}),u._requireAuth)}):[],u}return T(n,e),n.payloadify=function(t){var r;return Ee(Ne({url:t.plainUrl,file_name:t.fileName,file_type:t.mimeType,file_size:t.fileSize,thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){var s;return{url:((s=i.plainUrl)!==null&&s!==void 0?s:"").split("auth=")[0],width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),require_auth:t._requireAuth}))},Object.defineProperty(n.prototype,"url",{get:function(){var t=O.of(this._iid).sessionManager;return this._requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n}(Wn),nS=function(e){var n=e.channelUrl,t=e.channelType,r=e.parentMessage;this.channelUrl=n,this.channelType=t,this.parentMessage=r};(function(e){e.PENDING="pending",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled"})(uo||(uo={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(ri||(ri={}));var oa,dr=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p=this;return(p=e.call(this,t,r)||this).parentMessage=null,p.silent=!1,p.isOperatorMessage=!1,p.threadInfo=null,p.reactions=[],p.appleCriticalAlertOptions=null,p.scheduledInfo=null,p.suggestedReplies=null,p.myFeedback=null,p.myFeedbackStatus="NOT_APPLICABLE",p.forms=null,p._isContinuousMessages=!1,p._scheduledStatus=null,p.messageId=(s=(i=r.msg_id)!==null&&i!==void 0?i:r.message_id)!==null&&s!==void 0?s:0,p.parentMessageId=(o=typeof r.parent_message_id=="string"?parseInt(r.parent_message_id):r.parent_message_id)!==null&&o!==void 0?o:0,p.threadInfo=r.thread_info?new af(p._iid,r.thread_info):null,p.reactions=r.reactions?r.reactions.map(function(m){return new Od(m)}):[],p.ogMetaData=r.og_tag?new k1(r.og_tag):null,p.silent=(a=r.silent)!==null&&a!==void 0&&a,p.isOperatorMessage=(l=r.is_op_msg)!==null&&l!==void 0&&l,p.appleCriticalAlertOptions=r.apple_critical_alert_options?new ki(r.apple_critical_alert_options):null,typeof r.scheduled_message_id=="number"&&typeof r.scheduled_at=="number"&&r.scheduled_status&&(p.scheduledInfo={scheduledMessageId:r.scheduled_message_id,scheduledAt:r.scheduled_at},p._scheduledStatus=r.scheduled_status),p._isContinuousMessages=(u=r.is_continuous_messages)!==null&&u!==void 0&&u,p.myFeedback=!((c=r.feedback)===null||c===void 0)&&c.id?new pa(r.feedback):null,p.myFeedbackStatus=(d=r.my_feedback_status)!==null&&d!==void 0?d:pa.parseFeedbackStatusFromPayload(r.feedback),p.suggestedReplies=(f=(h=r.extended_message_payload)===null||h===void 0?void 0:h.suggested_replies)!==null&&f!==void 0?f:null,p.forms=kd.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(m){return new kd(p.messageId,m.key,m.fields.map(function(b){return new JC(b)}))}):null,p}return T(n,e),n.payloadify=function(t){var r,i;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?af.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return Od.payloadify(s)}),og_tag:t.ogMetaData?k1.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,scheduled_message_id:(r=t.scheduledInfo)===null||r===void 0?void 0:r.scheduledMessageId,scheduled_at:(i=t.scheduledInfo)===null||i===void 0?void 0:i.scheduledAt,scheduled_status:t._scheduledStatus,feedback:t.myFeedback?pa.payloadify(t.myFeedback):null,my_feedback_status:t.myFeedbackStatus,forms:t.forms?t.forms.map(function(s){return kd.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return Ee(Ne({type:ZC(t.messageType),ts:t.createdAt,user:t.sender?jl.payloadify(t.sender):null,message:t.message,file:{url:t.plainUrl,name:t.name,type:t.type,require_auth:t.requireAuth},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(r){return nm.payloadify(r)}):null}))},n.prototype.isIdentical=function(t){return this.messageId===t.messageId},n.prototype.applyThreadInfoUpdateEvent=function(t){return this.messageId===t.targetMessageId&&(t.threadInfo._isUpdateRequired&&this.threadInfo&&t.threadInfo._updateFrom(this.threadInfo),this.threadInfo=t.threadInfo,!0)},n.prototype.applyReactionEvent=function(t){if(this.messageId===t.messageId){for(var r=!1,i=0;i=r)return this.parentMessage=t,!0}return!1},n.prototype._triggerThreadInfoUpdatedEvent=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){return(t=O.of(this._iid).dispatcher).dispatch(new nS({channelType:Ze.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),[2]})})},n.prototype.markThreadAsRead=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new z6({channelUrl:this.channelUrl,messageId:this.messageId}),[4,t.send(r)];case 1:return i.sent(),this.threadInfo&&this.threadInfo.unreadReplyCount!==0?(this.threadInfo.unreadReplyCount=0,[4,this._triggerThreadInfoUpdatedEvent()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.setPushNotificationEnabled=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=O.of(this._iid).requestQueue,i=new V6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,pushEnabled:t}),[4,r.send(i)];case 1:return s.sent(),this.threadInfo&&this.threadInfo.isPushNotificationEnabled!==t&&(this.threadInfo.isPushNotificationEnabled=t),[2]}})})},n.prototype.submitForm=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:if(K(t.form&&t.form instanceof kd||k("string",t.formId)&&k("object",t.answers)).throw(L.invalidParameters),r=O.of(this._iid),i=r.requestQueue,s=r.sdkState,o=r.logger,!t.form)return[3,2];if(!(a=t.form).isSubmittable)throw new L({code:Ie.INVALID_PARAMETER,message:"The given form is not submittable."});if(a.isSubmitted)throw new L({code:Ie.INVALID_PARAMETER,message:"The given form is already submitted."});if(a.messageId!=this.messageId)throw new L({code:Ie.INVALID_PARAMETER,message:"This form does not belong to the message."});return l=a.fields.reduce(function(d,h){return d[h.key]=h.temporaryAnswer,d},{}),u=new L1({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:a.key,data:l}]}),[4,i.send(u)];case 1:return c.sent(),[3,4];case 2:return t.formId&&t.answers?(o.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."),u=new L1({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:t.formId,data:t.answers}]}),[4,i.send(u)]):[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}})})},n.prototype.submitFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new q6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,rating:t.rating,comment:t.comment}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(W6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_ADDED})),[2]}})})},n.prototype.updateFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new K6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t.id,rating:t.rating,comment:t.comment}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(Q6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_UPDATED})),[2]}})})},n.prototype.deleteFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new Y6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t}),[4,i.send(o)];case 1:return a.sent(),this.myFeedback=null,this.myFeedbackStatus="NO_FEEDBACK",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(XC),Dt=function(e){function n(t,r){var i,s,o,a,l=this;if((l=e.call(this,t,r)||this).reqId="",l.replyToChannel=!1,l.errorCode=0,l.sender=r.user?new jl(l._iid,r.user):r.sender_id,l.reqId=(s=(i=r.req_id)!==null&&i!==void 0?i:r.request_id)!==null&&s!==void 0?s:"",l.replyToChannel=(o=r.is_reply_to_channel)!==null&&o!==void 0&&o,r.request_state&&Ge(ut,r.request_state)&&(l.sendingStatus=r.request_state),!l.sendingStatus)if(l.messageId>0)l.sendingStatus=ut.SUCCEEDED;else if(l.scheduledInfo)switch(r.scheduled_status&&(l._scheduledStatus=r.scheduled_status),r.scheduled_status){case ri.SENT:case ri.IN_QUEUE:l.sendingStatus=ut.SUCCEEDED;break;case ri.PENDING:l.sendingStatus=ut.SCHEDULED;break;case ri.FAILED:case ri.REMOVED:l.sendingStatus=ut.FAILED;break;case ri.CANCELED:l.sendingStatus=ut.CANCELED}else l.sendingStatus=ut.PENDING;return l.errorCode=(a=r.error_code)!==null&&a!==void 0?a:0,l._messageToken=r.mesg_token,l}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{user:jl.payloadify(t.sender),req_id:t.reqId,is_reply_to_channel:t.replyToChannel,request_state:t.sendingStatus,error_code:t.errorCode,mesg_token:t._messageToken})))},Object.defineProperty(n.prototype,"isResendable",{get:function(){return(this.sendingStatus===ut.FAILED||this.sendingStatus===ut.CANCELED)&&U4(this.errorCode)},enumerable:!1,configurable:!0}),n.prototype.isIdentical=function(t){return this.messageId>0&&t.messageId>0?this.messageId===t.messageId:this.reqId===t.reqId},n}(dr),Qc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:er.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},o0=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ge(er,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)},Bl=function(e){function n(t,r){var i,s,o,a,l=this;if((l=e.call(this,t,r)||this).translations={},l.message=(i=r.message)!==null&&i!==void 0?i:"",l.messageType=bt.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=vr(t,Ee(Ne(M(M({},u),{message_id:l.parentMessageId,channel_url:l.channelUrl,channel_type:l.channelType,file:u.file,url:(o=u.file)===null||o===void 0?void 0:o.url,require_auth:(a=u.file)===null||a===void 0?void 0:a.require_auth}))))}return l}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&o0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(dr),D1=function(){function e(n){var t,r;this.detail={},this.type=(t=n.type)!==null&&t!==void 0?t:"",this.vendor=(r=n.vendor)!==null&&r!==void 0?r:"",n.detail&&k("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return Ee(Ne({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),U1=function(){function e(n){this.status=n.status,n.original_message_info&&(this.originalMessageInfo={createdAt:n.original_message_info.ts,messageId:n.original_message_info.id})}return e.payloadify=function(n){return Ee({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),Jn=function(e){function n(t,r){var i,s,o,a,l,u,c,d=this;if((d=e.call(this,t,r)||this).message="",d.messageParams=null,d.translations={},d.translationTargetLanguages=[],d.messageSurvivalSeconds=-1,d.plugins=[],d._poll=null,d.message=r.message,d.messageType=bt.USER,d.translations=(o=r.translations)!==null&&o!==void 0?o:{},d.translationTargetLanguages=(a=r.target_langs)!==null&&a!==void 0?a:[],Object.keys(d.translations).length===0&&d.translationTargetLanguages.length>0)try{for(var h=ve(d.translationTargetLanguages),f=h.next();!f.done;f=h.next()){var p=f.value;d.translations[p]=""}}catch(b){i={error:b}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.messageSurvivalSeconds=(l=r.message_survival_seconds)!==null&&l!==void 0?l:-1,d.plugins=r.plugins?r.plugins.map(function(b){return new D1(b)}):[],d._poll=r.poll?new Oi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=vr(t,Ee(Ne(M(M({},m),{created_at:m.ts,message_id:d.parentMessageId,channel_url:d.channelUrl,channel_type:d.channelType,file:m.file,url:(u=m.file)===null||u===void 0?void 0:u.url,require_auth:(c=m.file)===null||c===void 0?void 0:c.require_auth}))))}return r.review_info&&(d.messageReviewInfo=new U1(r.review_info)),d}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,message_survival_seconds:t.messageSurvivalSeconds,plugins:t.plugins.map(function(r){return D1.payloadify(r)}),poll:t._poll?Oi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?U1.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&o0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.prototype.applyPoll=function(t){return!(this._poll&&this._poll.id===t.id&&this._poll.updatedAt>t.updatedAt)&&(this._poll=t,!0)},Object.defineProperty(n.prototype,"poll",{get:function(){return this._poll},enumerable:!1,configurable:!0}),n}(Dt),ai=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h=this;if((h=e.call(this,t,r)||this).messageParams=null,h.fileInfoList=[],h.messageSurvivalSeconds=-1,h.messageType=bt.FILE,h.data=(o=(s=(i=r.file)===null||i===void 0?void 0:i.data)!==null&&s!==void 0?s:r.custom)!==null&&o!==void 0?o:"",h.fileInfoList=(l=(a=r.files)===null||a===void 0?void 0:a.map(function(p){return new nm(t,p)}))!==null&&l!==void 0?l:[],h.messageSurvivalSeconds=(u=r.message_survival_seconds)!==null&&u!==void 0?u:-1,r.parent_message_info){var f=r.parent_message_info;h.parentMessage=vr(t,Ee(Ne(M(M({},f),{created_at:f.ts,message_id:h.parentMessageId,channel_url:h.channelUrl,channel_type:h.channelType,file:f.file,url:(c=f.file)===null||c===void 0?void 0:c.url,require_auth:(d=f.file)===null||d===void 0?void 0:d.require_auth}))))}return h}return T(n,e),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&o0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.payloadify=function(t){var r,i,s,o,a,l;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{file:{name:(i=(r=t.fileInfoList[0])===null||r===void 0?void 0:r.fileName)!==null&&i!==void 0?i:"",size:(o=(s=t.fileInfoList[0])===null||s===void 0?void 0:s.fileSize)!==null&&o!==void 0?o:0,type:(l=(a=t.fileInfoList[0])===null||a===void 0?void 0:a.mimeType)!==null&&l!==void 0?l:"",data:t.data},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(u){return nm.payloadify(u)}):null,message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n._isMultipleFilesMessagePayload=function(t){var r=t.files;return Array.isArray(r)&&r.length>=2},n._isMultipleFilesMessageSerializedData=function(t){var r=t.fileInfoList;return Array.isArray(r)},n}(Dt);(function(e){e.SENT="SENT",e.READ="READ"})(oa||(oa={}));var wa=function(e){function n(t,r){var i,s,o=this;if((o=e.call(this,t,r)||this).notificationData=null,o.notificationId=r.notification_message_id,o.messageType=bt.ADMIN,o.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:oa.SENT,o.priority=(s=r.priority)!==null&&s!==void 0?s:q_.NORMAL,o.notificationEventDeadline=r.notification_event_deadline,o.extendedMessage.sub_type===0)try{var a=JSON.parse(o.extendedMessage.sub_data),l=a.label,u=a.tags,c=u===void 0?[]:u,d=a.template_key,h=a.template_variables;o.notificationData={label:l,tags:c,templateKey:d,templateVariables:h}}catch{}return o}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{notification_message_id:t.notificationId,message_status:t.messageStatus,priority:t.priority,notification_event_deadline:t.notificationEventDeadline})))},n.prototype.isIdentical=function(t){return this.notificationId===t.notificationId},n}(XC),P1=function(e){if(e.notificationId)return wa.payloadify(e);switch(e.messageType){case bt.USER:return Jn.payloadify(e);case bt.FILE:return e.fileInfoList?ai.payloadify(e):Zt.payloadify(e);case bt.ADMIN:return Bl.payloadify(e);default:throw L.unknown}},vr=function(e,n){if(n.notification_message_id)return new wa(e,n);switch(n.type){case"MESG":return new Jn(e,n);case"FILE":return ai._isMultipleFilesMessagePayload(n)?new ai(e,n):new Zt(e,n);case"ADMM":case"BRDM":return new Bl(e,n);default:return null}},Zt=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=bt.FILE;var E=r.file;if(_.plainUrl=((s=(i=E==null?void 0:E.url)!==null&&i!==void 0?i:r.url)!==null&&s!==void 0?s:"").split("?auth=")[0],_.name=(a=(o=E==null?void 0:E.name)!==null&&o!==void 0?o:r.name)!==null&&a!==void 0?a:"File",_.size=(u=(l=E==null?void 0:E.size)!==null&&l!==void 0?l:r.size)!==null&&u!==void 0?u:0,_.data=(d=(c=E==null?void 0:E.data)!==null&&c!==void 0?c:r.custom)!==null&&d!==void 0?d:"",_.type=E?(h=E.type)!==null&&h!==void 0?h:"":(f=r.type)!==null&&f!==void 0?f:"",_.requireAuth=(p=r.require_auth)!==null&&p!==void 0&&p,_.thumbnails=r.thumbnails?r.thumbnails.map(function(w){var N;return new Vs(_._iid,typeof w=="string"?{url:w,width:0,height:0}:M(M({},w),{url:((N=w.url)!==null&&N!==void 0?N:"").split("auth=")[0]}),_.requireAuth)}):[],_.messageSurvivalSeconds=(m=r.message_survival_seconds)!==null&&m!==void 0?m:-1,r.parent_message_info){var S=r.parent_message_info;_.parentMessage=vr(t,Ee(Ne(M(M({},S),{created_at:S.ts,message_id:_.parentMessageId,channel_url:_.channelUrl,channel_type:_.channelType,file:S.file,url:(b=S.file)===null||b===void 0?void 0:b.url,require_auth:(v=S.file)===null||v===void 0?void 0:v.require_auth}))))}return _}return T(n,e),n.payloadify=function(t){var r;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{url:t.plainUrl,require_auth:t.requireAuth,file:{name:t.name,size:t.size,type:t.type,data:t.data},thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{url:i.plainUrl,width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},Object.defineProperty(n.prototype,"url",{get:function(){var t=O.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&o0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Dt),lf=function(e){function n(t,r){var i=r.file,s=r.fileUrl,o=r.fileName,a=r.fileSize,l=r.mimeType,u=r.thumbnailSizes,c=r._uploadedMetaData,d=r._thumbnails,h=e.call(this,t)||this;return h._plainUrl=s,h.file=i,h.fileName=o,h.fileSize=a,h.mimeType=l,h.thumbnailSizes=u,h._uploadedMetaData=c,h._thumbnails=d,h}return T(n,e),n.getPlainUrl=function(t){return t instanceof n?t._plainUrl:t.fileUrl},Object.defineProperty(n.prototype,"fileUrl",{get:function(){var t,r=O.of(this._iid).sessionManager;return this._plainUrl&&(!((t=this._uploadedMetaData)===null||t===void 0)&&t.requireAuth)&&r.ekey?"".concat(this._plainUrl,"?auth=").concat(r.ekey):this._plainUrl},set:function(t){this._plainUrl=t},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return{file:this.file,fileUrl:this._plainUrl,fileName:this.fileName,fileSize:this.fileSize,mimeType:this.mimeType,thumbnailSizes:this.thumbnailSizes,_thumbnails:this._thumbnails,_uploadedMetaData:this._uploadedMetaData}},n}(Wn),Z6=function(e){function n(t){var r,i,s,o,a=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(l){return l.userId}))),e.call(this,{code:"FILE",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,files:t.files?iS(t.files):null,url:t.url,name:(r=t.fileName)!==null&&r!==void 0?r:"",type:(i=t.mimeType)!==null&&i!==void 0?i:"",size:(s=t.fileSize)!==null&&s!==void 0?s:0,custom:t.data,custom_type:t.customType,thumbnails:(o=t._thumbnails)===null||o===void 0?void 0:o.map(function(l){return Vs.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:a,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Qi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,pin_message:t.isPinnedMessage}))})||this}return T(n,e),n}(wr),X6=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(a){return a.userId}))),s.method=Q.POST,s.path="".concat(Je(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=Ee(Ne({message_type:bt.FILE,user_id:t.userId,files:t.files?iS(t.files):null,url:t.fileUrl,mention_type:t.mentionType,mentioned_user_ids:o,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,data:t.data,custom_type:t.customType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(a){return Vs.payloadify(a)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(a){return pr.payloadify(a)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return T(n,e),n}(Y),rS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"FILE",i)||this).message=i.files&&i.files.length>=2?new ai(t,i):new Zt(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),J6=function(e){function n(t,r){var i,s,o,a,l=this;(l=e.call(this,t,r)||this).message=r.files&&r.files.length>=2?new ai(t,r):new Zt(t,r);var u=O.of(t).sdkState;return l.isMentioned=Dl(l.message.mentionType,(o=(i=l.message.mentionedUserIds)!==null&&i!==void 0?i:(s=l.message.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}))!==null&&o!==void 0?o:[],u.userId),l.forceUpdateLastMessage=(a=r.force_update_last_message)!==null&&a!==void 0&&a,l}return T(n,e),n}(ae);function iS(e){return e.map(function(n){var t,r;return Ee(Ne({url:lf.getPlainUrl(n),file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:(t=n._thumbnails)===null||t===void 0?void 0:t.map(function(i){return Vs.payloadify(i)}),require_auth:(r=n._uploadedMetaData)===null||r===void 0?void 0:r.requireAuth}))})}var Sn;(function(e){e[e.PENDING=0]="PENDING",e[e.UPLOADING=1]="UPLOADING",e[e.UPLOADED=2]="UPLOADED",e[e.SENDING=3]="SENDING",e[e.FAILED=4]="FAILED"})(Sn||(Sn={}));var eM=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=t.onlineDetector,a=t.cacheContext,l=this;this._queueMap=new Map,this._iid=n,this._sdkState=r,this._requestQueue=s,this._cacheContext=a,this._dispatcher=i,this._dispatcher.on(function(u){u instanceof _i&&(l._connectionState=u.stateType)}),this._onlineDetector=o}return Object.defineProperty(e.prototype,"_shouldSendThroughWebSocket",{get:function(){return this._connectionState===st.CONNECTED||this._connectionState===st.CONNECTING||this._connectionState===st.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new Z6(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=o.sent(),[2,s.as(rS).message];case 2:return i=new X6(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=o.sent(),[2,s.as(J6).message]}})})},e.prototype._createSendFileMessageRequestParams=function(n,t){var r=M(M({},t.params),{channelUrl:n.url,channelType:n.channelType,reqId:t.requestId,url:""});if(t.multipleFileUploadInfo){var i=t.params;r.files=i.fileInfoList}else i=t.params,r.url=i.fileUrl,r.requireAuth=i.requireAuth;return r},e.prototype._resolveMessageQueue=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:if(!(r=this._queueMap.get(n.url)))return[3,21];if(r.isResolving)return[3,20];r.isResolving=!0,i=[],s=!0,b.label=1;case 1:b.trys.push([1,15,16,17]),o=ve(r.messageQueue),a=o.next(),b.label=2;case 2:if(a.done)return[3,14];switch(l=a.value,l.state){case Sn.PENDING:case Sn.UPLOADING:return[3,3];case Sn.UPLOADED:return[3,4];case Sn.FAILED:return[3,12]}return[3,13];case 3:return s=!1,i.push(l),[3,13];case 4:if(!s)return[3,10];b.label=5;case 5:return b.trys.push([5,8,,9]),l.state=Sn.SENDING,[4,this._sendFileMessage(n,l)];case 6:return u=b.sent(),l.deferred.resolve(u),[4,Or(100)];case 7:return b.sent(),[3,9];case 8:return c=b.sent(),l.deferred.reject(c),[3,9];case 9:return[3,11];case 10:i.push(l),b.label=11;case 11:return[3,13];case 12:return d=(t=l.error)!==null&&t!==void 0?t:L.unknown,l.deferred.reject(d.code===Ie.REQUEST_CANCELED?L.fileUploadCanceled:d),[3,13];case 13:return a=o.next(),[3,2];case 14:return[3,17];case 15:return h=b.sent(),p={error:h},[3,17];case 16:try{a&&!a.done&&(m=o.return)&&m.call(o)}finally{if(p)throw p.error}return[7];case 17:return f=r.isResolveRequestPending,r.messageQueue=i,r.isResolving=!1,r.isResolveRequestPending=!1,f?[4,this._resolveMessageQueue(n)]:[3,19];case 18:b.sent(),b.label=19;case 19:return[3,21];case 20:r.isResolveRequestPending=!0,b.label=21;case 21:return[2]}})})},e.prototype._uploadNextPendingItem=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return(r=this._queueMap.get(n.url))&&(i=r.messageQueue.find(function(p){return p.state===Sn.PENDING}))?i.multipleFileUploadInfo?(s=i.multipleFileUploadInfo,o=s.uploadIndex,a=s.uploadCount,l=s.requestHandler,h=i.params,u=h.fileInfoList[o],!fr(u.file)||!((t=u._uploadedMetaData)===null||t===void 0)&&t.isUploaded?[3,2]:[4,this._tryUploadNextItemAndUpdateItemState(n,r,i)]):[3,4]:[3,9];case 1:return f.sent(),[3,3];case 2:i.state=o=0&&n.uploadQueue.splice(r,1)},e.prototype._uploadNextFileForSingleFileItemAndUpdateParams=function(n,t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m,b;return g(this,function(v){switch(v.label){case 0:return a=new sf({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(a)];case 1:return l=v.sent(),u=l.as(of),c=u.url,d=u.fileSize,h=d===void 0?r.fileSize:d,f=u.thumbnails,p=f===void 0?[]:f,m=u.requireAuth,b=m!==void 0&&m,r.fileName=(i=r.fileName)!==null&&i!==void 0?i:r.file.name,r.mimeType=(s=r.mimeType)!==null&&s!==void 0?s:r.file.type,r.fileSize=(o=r.fileSize)!==null&&o!==void 0?o:r.file.size,r.fileUrl=c,r.fileSize=h,r.requireAuth=b,r._thumbnails=p,[2]}})})},e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams=function(n,t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return a=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[a],u=new sf({file:l.file,channelUrl:n.url,thumbnailSizes:l.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(u)];case 1:return c=_.sent(),d=c.as(of),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,v=b!==void 0&&b,l.fileName=(i=l.fileName)!==null&&i!==void 0?i:l.file.name,l.mimeType=(s=l.mimeType)!==null&&s!==void 0?s:l.file.type,l.fileSize=(o=l.fileSize)!==null&&o!==void 0?o:l.file.size,l.file=void 0,l.fileUrl=h,l.fileSize=p,l._thumbnails=m,l._uploadedMetaData=M(M({},l._uploadedMetaData),{requireAuth:v,isUploaded:!0}),l instanceof lf||(r.fileInfoList[a]=new lf(this._iid,l)),[2]}})})},e.prototype.request=function(n,t,r,i){return i===void 0&&(i={}),y(this,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){return this._queueMap.has(n.url)||(s={messageQueue:[],uploadQueue:[],isResolving:!1,isResolveRequestPending:!1},this._queueMap.set(n.url,s)),o=this._queueMap.get(n.url),a=new Tr,l={requestId:t,params:r,state:Sn.PENDING,deferred:a},function(d){return"fileInfoList"in d}(r)&&(u=M({uploadIndex:0,uploadCount:r.fileInfoList.length},i),l.multipleFileUploadInfo=u),o.messageQueue.push(l),this._uploadNextPendingItem(n),[2,a.promise]})})},e.prototype.cancel=function(n,t){var r,i,s=this._queueMap.get(n.url);if(s){var o=t?[s.messageQueue.find(function(p){return p.requestId===t})]:Pe([],Ae(s.messageQueue),!1);try{for(var a=ve(o),l=a.next();!l.done;l=a.next()){var u=l.value;if(u)switch(u.state){case Sn.PENDING:if(u.state=Sn.FAILED,u.error=L.requestCanceled,u.multipleFileUploadInfo&&!u.multipleFileUploadInfo.isCopy){var c=u.multipleFileUploadInfo,d=c.uploadIndex,h=c.requestHandler,f=u.params.fileInfoList[d];h==null||h._triggerOnFileUploaded(u.requestId,d,f,L.fileUploadCanceled)}this._resolveMessageQueue(n);break;case Sn.UPLOADING:this._requestQueue.cancel(u.requestId),this._dispatcher.dispatch(new Yh({requestId:u.requestId}))}}}catch(p){r={error:p}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else t&&(this._requestQueue.cancel(t),this._dispatcher.dispatch(new Yh({requestId:t})))},e}(),rm,nc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:er.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Dn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},F1=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ge(er,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&Ge(Dn,e.replyType)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)&&k("boolean",e.showSubchannelMessagesOnly)},im={replyType:Dn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},H1=function(e){return Ge(Dn,e.replyType)&&k("boolean",e.includeReactions)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)},tM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.includeMetaArray,a=t.includeReactions,l=t.includeThreadInfo,u=t.includeParentMessageInfo,c=e.call(this)||this;return c.method=Q.GET,c.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s)),c.params={is_sdk:!0,with_sorted_meta_array:o,include_reactions:a,include_thread_info:l,include_parent_message_info:u,include_poll_details:!0},c}return T(n,e),n}(Y),nM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?vr(t,M({},r)):null,i}return T(n,e),n}(ae),Rd=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=t.prevResultSize,l=t.nextResultSize,u=t.isInclusive,c=t.reverse,d=t.messageTypeFilter,h=t.customTypesFilter,f=t.senderUserIdsFilter,p=t.replyType,m=t.includeMetaArray,b=t.includeReactions,v=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,w=t.checkingHasNext,N=t.checkingContinuousMessages,I=e.call(this)||this;return I.method=Q.GET,I.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages"),I.params=Ee(Ne({is_sdk:!0,prev_limit:a,next_limit:l,include:u,reverse:c,message_ts:s,message_id:o,message_type:d??null,custom_types:h,sender_ids:f,include_reply_type:p,with_sorted_meta_array:m,include_reactions:b,parent_message_id:v,include_thread_info:_,include_parent_message_info:E,show_subchannel_message_only:S,include_poll_details:!0,checking_has_next:w,checking_continuous_messages:N})),I}return T(n,e),n}(Y),Ld=function(e){function n(t,r){var i=e.call(this,t,r)||this;return r.is_continuous_messages!==void 0&&(i.isContinuousMessages=r.is_continuous_messages),r.has_next!==void 0&&(i.hasNext=r.has_next),i.messages=r.messages.map(function(s){return vr(t,s)}),i}return T(n,e),n}(ae),rM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=t.replyType,l=t.includeMetaArray,u=t.includeReactions,c=t.includeThreadInfo,d=t.includeParentMessageInfo,h=e.call(this)||this;return h.method=Q.GET,h.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/changelogs"),h.params={change_ts:s,token:o,with_sorted_meta_array:l,include_reactions:u,include_thread_info:c,include_reply_type:a,include_parent_message_info:d,include_poll_details:!0},h}return T(n,e),n}(Y),iM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return vr(t,s)}),i.deletedMessagesInfo=r.deleted.map(function(s){return{messageId:s.message_id,deletedAt:s.deleted_at}}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(ae),sM=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(ir,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return T(n,e),n}(Y),oM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?vr(t,M({},r)):null,i}return T(n,e),n}(ae);(function(e){e.MUTED="muted",e.BANNED="banned"})(rm||(rm={}));var j1=function(){function e(n){var t,r,i,s;this.restrictionType=null,Ge(rm,n.restriction_type)&&(this.restrictionType=n.restriction_type),this.description=(t=n.description)!==null&&t!==void 0?t:null,this.endAt=(i=(r=n.end_at)!==null&&r!==void 0?r:n.muted_end_at)!==null&&i!==void 0?i:-1,this.remainingDuration=(s=n.remaining_duration)!==null&&s!==void 0?s:-1}return e.payloadify=function(n){return Ee(Ne({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),Ua=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new j1(r),i}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),j1.payloadify(t.restrictionInfo))))},n}(Ke);(function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isMuted=!1,s.isMuted=(i=r.is_muted)!==null&&i!==void 0&&i,s}return T(n,e),n})(Ke);var Br=function(){function e(){this._onPending=qe,this._onFailed=qe,this._onSucceeded=qe}return e.prototype._trigger=function(n){switch(n==null?void 0:n.sendingStatus){case ut.PENDING:n.errorCode===0&&this._onPending(n);break;case ut.SCHEDULED:case ut.SUCCEEDED:this._onSucceeded(n)}},e.prototype._triggerFailed=function(n,t){switch(t==null?void 0:t.sendingStatus){case ut.FAILED:case ut.CANCELED:this._onFailed(n,t.scheduledInfo?null:t)}},e.prototype.onPending=function(n){return this._onPending=n,this},e.prototype.onFailed=function(n){return this._onFailed=n,this},e.prototype.onSucceeded=function(n){return this._onSucceeded=n,this},e}(),a0={data:void 0,customType:void 0,mentionType:nr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,parentMessageId:void 0,isReplyToChannel:!1,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0,isPinnedMessage:!1},l0=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ge(nr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&We(pr,e.metaArrays,!0)&&k("number",e.parentMessageId,!0)&&k("boolean",e.isReplyToChannel)&&Ge(Qi,e.pushNotificationDeliveryOption,!0)&&k(ki,e.appleCriticalAlertOptions,!0)&&k("boolean",e.isPinnedMessage,!0)},B1=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},sS=M(M({},a0),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function oS(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),translationTargetLanguages:Object.keys(e.translations),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var _a,sm=function(e){var n;return Ee(Ne({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,mentionedMessageTemplate:e.mentionedMessageTemplate,metaArrays:e.metaArrays,pollId:(n=e.poll)===null||n===void 0?void 0:n.id,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,message:e.message,translationTargetLanguages:Object.keys(e.translations),extendedMessagePayload:e.extendedMessagePayload}))},aS=function(e){return l0(e)&&k("string",e.message)&&We("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)&&k("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(_a||(_a={}));var dh=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},bp=function(e){return e===_a.BLOB||e===_a.FILE},$1=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},G1=M(M({},a0),{file:void 0,fileKey:void 0,fileUrl:void 0,fileName:void 0,fileType:void 0,fileSize:void 0,mimeType:void 0,thumbnailSizes:void 0,requireAuth:!1});function lS(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{fileUrl:e.plainUrl,fileName:e.name,fileSize:e.size,mimeType:e.type,mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(s){return s.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(i=e.thumbnails)===null||i===void 0?void 0:i.map(function(s){return{maxWidth:s.width,maxHeight:s.height}}),requireAuth:e.requireAuth,isPinnedMessage:!1,_thumbnails:e.thumbnails}))}var rc,om=function(e,n){var t;return e.messageParams?(!e.url&&fr(n)&&(e.messageParams.file=n),e.messageParams):Ee(Ne({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,metaArrays:e.metaArrays,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,file:n,fileUrl:e.url,fileName:e.name,fileSize:e.size,mimeType:e.type,thumbnailSizes:(t=e.thumbnails)===null||t===void 0?void 0:t.map(function(r){return{maxWidth:r.width,maxHeight:r.height}})}))},z1=function(e){return l0(e)&&(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},Zv={data:void 0,customType:void 0,mentionType:nr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},Xv=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ge(nr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&We(pr,e.metaArrays,!0)&&Ge(Qi,e.pushNotificationDeliveryOption,!0)&&k(ki,e.appleCriticalAlertOptions,!0)},uS=M(M({},Zv),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),cS=function(e){return Xv(e)&&k("string",e.message,!0)&&We("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)},aM=M({},Zv),lM=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,o=t.limit,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(i),"/").concat(encodeURIComponent(r),"/operators"),a.params={token:s,limit:o},a}return T(n,e),n}(Y),uM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.operators=r.operators.map(function(s){return new Ke(t,s)}),i.token=r.next,i}return T(n,e),n}(ae),cM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=O.of(this._iid).requestQueue,i=new lM(M(M({},this),{channelUrl:this.channelUrl,token:this._token})),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(uM),a=o.operators,l=o.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,a];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),dM=function(e){function n(t,r,i,s){var o,a,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t,r,i,s)||this).reverse=!1,b.messageTypeFilter=er.ALL,b.customTypesFilter=null,b.senderUserIdsFilter=null,b.replyType=Dn.NONE,b.includeMetaArray=!1,b.includeReactions=!1,b.includeParentMessageInfo=!1,b.includeThreadInfo=!1,b.showSubchannelMessagesOnly=!1,b._edge=Number.MAX_SAFE_INTEGER,b.reverse=(o=s.reverse)!==null&&o!==void 0&&o,b.messageTypeFilter=(a=s.messageTypeFilter)!==null&&a!==void 0?a:er.ALL,b.customTypesFilter=(l=s.customTypesFilter)!==null&&l!==void 0?l:null,b.senderUserIdsFilter=(u=s.senderUserIdsFilter)!==null&&u!==void 0?u:null,b.replyType=(c=s.replyType)!==null&&c!==void 0?c:Dn.NONE,b.includeMetaArray=(d=s.includeMetaArray)!==null&&d!==void 0&&d,b.includeReactions=(h=s.includeReactions)!==null&&h!==void 0&&h,b.includeParentMessageInfo=(f=s.includeParentMessageInfo)!==null&&f!==void 0&&f,b.includeThreadInfo=(p=s.includeThreadInfo)!==null&&p!==void 0&&p,b.showSubchannelMessagesOnly=(m=s.showSubchannelMessagesOnly)!==null&&m!==void 0&&m,b}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.reverse)&&Ge(er,this.messageTypeFilter)&&Ge(Dn,this.replyType)&&We("string",this.customTypesFilter,!0)&&We("string",this.senderUserIdsFilter,!0)&&k("boolean",this.includeMetaArray)&&k("boolean",this.includeReactions)&&k("boolean",this.includeParentMessageInfo)&&k("boolean",this.includeThreadInfo)&&k("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,An.of(this._iid).getMessagesByTimestamp(this.channelUrl,this.channelType,this._edge,Ne({prevResultSize:this.limit,nextResultSize:0,isInclusive:!1,reverse:this.reverse,messageTypeFilter:this.messageTypeFilter,customTypesFilter:this.customTypesFilter,replyType:this.replyType,senderUserIdsFilter:this.senderUserIdsFilter,includeReactions:this.includeReactions,includeMetaArray:this.includeMetaArray,includeParentMessageInfo:this.includeParentMessageInfo,includeThreadInfo:this.includeThreadInfo,showSubchannelMessagesOnly:this.showSubchannelMessagesOnly}))]):[3,2]:[3,5];case 1:return t=r.sent(),this._edge=Math.min.apply(Math,Pe([Number.MAX_SAFE_INTEGER],Ae(t.map(function(i){return i.createdAt})),!1)),this._hasNext=t.length>=this.limit,this._isLoading=!1,[2,t];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),hM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.limit,a=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:o,token:a},r}return T(n,e),n}(Y),fM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.mutedUsers=[];var s=r.next,o=r.muted_list;return i.token=s,o&&o.length>0&&(i.mutedUsers=o.map(function(a){return new Ua(t,a)})),i}return T(n,e),n}(ae),pM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new hM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(fM),o=s.mutedUsers,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),_M=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.limit,a=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=Ee({limit:o,token:a}),r}return T(n,e),n}(Y),mM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.bannedUsers=[];var s=r.next,o=r.banned_list;return i.token=s,o&&o.length>0&&(i.bannedUsers=o.map(function(a){return new Ua(t,a.user)})),i}return T(n,e),n}(ae),vM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new _M(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(mM),o=s.bannedUsers,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(rc||(rc={}));var gM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var yM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var EM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(o),r}return T(n,e),n}(Y),bM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.isMuted=!1,i.startAt=0,i.endAt=0;var s=r.is_muted,o=r.start_at,a=r.end_at,l=r.remaining_duration,u=r.description;return i.isMuted=s,i.startAt=o,i.endAt=a,i.remainingDuration=l,i.description=u,i}return T(n,e),n}(ae),V1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:o,include_ts:!0},r}return T(n,e),n}(Y),q1=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,o=r.ts;return i.metadata=s,i.ts=o,i}return T(n,e),n}(ae),CM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0},r}return T(n,e),n}(Y),SM=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t,r)||this).metaData=(i=r.metadata)!==null&&i!==void 0?i:{},o.ts=(s=r.ts)!==null&&s!==void 0?s:null,o}return T(n,e),n}(ae),TM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata,a=t.upsert;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0,upsert:a!=null&&a},r}return T(n,e),n}(Y),wM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,o=r.ts;return i.metadata=s,i.ts=o,i}return T(n,e),n}(ae),NM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(mt),IM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(o),r.params={include_ts:!0},r}return T(n,e),n}(Y),AM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(ae),MM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return T(n,e),n}(Y),xM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(ae),W1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:o},r}return T(n,e),n}(Y),K1=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),OM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o},r}return T(n,e),n}(Y),kM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),Cp=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter,a=t.upsert,l=a!==void 0&&a,u=t.mode,c=u===void 0?"set":u;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o,upsert:l,mode:c},r}return T(n,e),n}(Y),Sp=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),RM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(mt),LM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(o),r.params={},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var DM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var UM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.seconds,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={user_id:o,seconds:a,description:l},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var PM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),FM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var HM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),jM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.seconds,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=Ee({user_id:o,seconds:a,description:l}),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var BM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),i.data.member_count&&(s.memberCount=i.data.member_count),i.data.joined_member_count&&(s.joinedMemberCount=i.data.joined_member_count),s}return T(n,e),n}(mt),$M=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var GM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),Q1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.freezing;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:o},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var zM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.freeze=i.data.freeze,s}return T(n,e),n}(mt),VM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(lC(s),"/").concat(encodeURIComponent(i)),r.params={report_category:o,reporting_user_id:a,report_description:l},r}return T(n,e),n}(Y),qM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.offendingUserId,u=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(K_,"/users/").concat(l),r.params={channel_url:i,channel_type:s===Ze.OPEN?"open_channels":"group_channels",report_category:o,reporting_user_id:a,report_description:u},r}return T(n,e),n}(Y),WM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.offendingUserId,u=t.messageId,c=t.description,d=t.messageToken;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(lC(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=Ee({report_category:o,reporting_user_id:a,report_description:c,offending_user_id:l,mesg_token:d}),r}return T(n,e),n}(Y),KM=function(e){function n(t){var r=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MESG",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Qi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,poll_id:t.pollId,pin_message:t.isPinnedMessage,extended_message_payload:t.extendedMessagePayload}))})||this}return T(n,e),n}(wr),dS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new Jn(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),Y1=function(e){function n(t){var r=null;return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MEDI",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,msg_id:t.messageId,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return T(n,e),n}(wr),am=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"MEDI",i)||this).message=new Jn(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),Z1=function(e){function n(t){var r=null;return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"FEDI",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,msg_id:t.messageId,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,apple_critical_alert_options:t.appleCriticalAlertOptions}))})||this}return T(n,e),n}(wr),lm=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"FEDI",i)||this).message=new Zt(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),QM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.reactionKey,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(Y),YM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Yv(r),i}return T(n,e),n}(ae),ZM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.reactionKey,a=e.call(this)||this;return a.method=Q.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(Y),XM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Yv(M({},r)),i}return T(n,e),n}(ae),JM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.translationTargetLanguages,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s),"/translation"),a.params={target_langs:o},a}return T(n,e),n}(Y),ex=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}return T(n,e),n}(ae),tx=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(l){return l.userId})));var o=t.channelType,a=t.channelUrl;return i.method=Q.POST,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages"),i.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(l){return pr.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Y),hS=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}return T(n,e),n}(ae),nx=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(u){return u.userId})));var a=t.channelType,l=t.channelUrl;return s.method=Q.POST,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(u){return Vs.payloadify(u)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:o,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(u){return pr.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return T(n,e),n}(Y),rx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Zt(t,r),i}return T(n,e),n}(ae),ix=function(e){function n(t){var r=t.pollId,i=t.title,s=t.data,o=t.allowUserSuggestion,a=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Q.PUT,u.path="".concat(Yi,"/").concat(encodeURIComponent(r)),u.params={title:i,data:s,allow_user_suggestion:o,allow_multiple_votes:a,close_at:l},u}return T(n,e),n}(Y),sx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),ox=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Yi,"/").concat(encodeURIComponent(r)),i}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var ax=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Q.PUT,i.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/close"),i}return T(n,e),n}(Y),lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),ux=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.optionText,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options"),a.params={channel_url:r,channel_type:i,text:o},a}return T(n,e),n}(Y),cx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),dx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),o.params={text:s},o}return T(n,e),n}(Y),hx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),fx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var px=function(e){function n(t){var r=t.reqId,i=t.channelType,s=t.channelUrl,o=t.pollId,a=t.pollOptionIds;return e.call(this,{code:"VOTE",ackRequired:!0,payload:Ee({req_id:r,channel_type:i===Ze.OPEN?"open_channels":"group_channels",channel_url:s,poll_id:o,option_ids:a})})||this}return T(n,e),n}(wr),fS=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new I6(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(mt),pS=100,_S="GroupChannel",_x="url",mS=100,um="Message",mx="messageId",vS="NotificationMessage",vx="notificationId",gx="Poll",yx="pollId",Ex="FeedChannel",bx="url";function Cx(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{isReplyToChannel:!1,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,isPinnedMessage:!1,fileInfoList:e.fileInfoList.map(function(i){var s;return{fileUrl:i.plainUrl,fileName:i.fileName,fileSize:i.fileSize,mimeType:i.mimeType,thumbnailSizes:(s=i.thumbnails)===null||s===void 0?void 0:s.map(function(o){return{maxWidth:o.width,maxHeight:o.height}}),_thumbnails:i.thumbnails,_uploadedMetaData:{requireAuth:i._requireAuth,isUploaded:!0}}})}))}var Yn,Sx=M(M({},a0),{fileInfoList:[]}),Tx=function(e){return(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},hh=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._onFileUploaded=qe,t}return T(n,e),n.prototype._triggerOnFileUploaded=function(t,r,i,s){this._onFileUploaded(t,r,i,s)},n.prototype.onFileUploaded=function(t){return this._onFileUploaded=t,this},n.prototype.onPending=function(t){return e.prototype.onPending.call(this,t),this},n.prototype.onFailed=function(t){return e.prototype.onFailed.call(this,t),this},n.prototype.onSucceeded=function(t){return e.prototype.onSucceeded.call(this,t),this},n}(Br),wx=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(Yn||(Yn={}));var St,X1=function(e){function n(t,r){var i,s,o,a,l,u,c=this;return(c=e.call(this,t)||this)._name="",c._createdAt=0,c.channelType=Ze.BASE,c.coverUrl="",c.customType="",c.data="",c.isFrozen=!1,c.isEphemeral=!1,c.creator=null,c._messageCollectionLastAccessedAt=0,c._url=r.channel_url,c._name=(i=r.name)!==null&&i!==void 0?i:"",c._createdAt=1e3*r.created_at,c.coverUrl=(s=r.cover_url)!==null&&s!==void 0?s:"",c.customType=(o=r.custom_type)!==null&&o!==void 0?o:"",c.data=(a=r.data)!==null&&a!==void 0?a:"",c.isFrozen=(l=r.freeze)!==null&&l!==void 0&&l,c.isEphemeral=(u=r.is_ephemeral)!==null&&u!==void 0&&u,c.creator=r.created_by?new Ke(c._iid,r.created_by):null,r.metadata&&Object.keys(r.metadata).length>0&&r.ts&&(c._cachedMetaData=new Map,Object.keys(r.metadata).forEach(function(d){c._cachedMetaData.set(d,{value:r.metadata[d],isRemoved:!1,updatedAt:r.ts})})),c}return T(n,e),Object.defineProperty(n.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"createdAt",{get:function(){return this._createdAt},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return M(M({},this),{url:this._url,name:this._name,createdAt:this._createdAt})},n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{channel_url:t.url,name:t.name,cover_url:t.coverUrl,custom_type:t.customType,data:t.data,freeze:t.isFrozen,is_ephemeral:t.isEphemeral,created_by:t.creator?Ke.payloadify(t.creator):null,created_at:t.createdAt/1e3})))},n.prototype.isGroupChannel=function(){return this.channelType===Ze.GROUP},n.prototype.isOpenChannel=function(){return this.channelType===Ze.OPEN},n.prototype.isFeedChannel=function(){return this.channelType===Ze.FEED},Object.defineProperty(n.prototype,"cachedMetaData",{get:function(){var t={};return this._cachedMetaData&&this._cachedMetaData.forEach(function(r,i){r.isRemoved||(t[i]=r.value)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"messageCollectionLastAccessedAt",{get:function(){return this._messageCollectionLastAccessedAt},enumerable:!1,configurable:!0}),n.prototype._updateMessageCollectionLastAccessedAt=function(){this._messageCollectionLastAccessedAt=Date.now()},n.prototype._update=function(t){var r=Ee(t);Object.assign(this,r)},n.prototype._upsertCachedMetaData=function(t,r){var i=this;Object.keys(t).forEach(function(s){i._cachedMetaData||(i._cachedMetaData=new Map);var o=i._cachedMetaData.get(s);(!o||o.updatedAt<=r)&&i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})})},n.prototype._updateCachedMetaData=function(t,r){var i=this;this._cachedMetaData?this._cachedMetaData.forEach(function(s,o){var a;s.updatedAt<=r&&i._cachedMetaData.set(o,{value:(a=t[o])!==null&&a!==void 0?a:s.value,isRemoved:!t[o],updatedAt:r})}):(this._cachedMetaData=new Map,Object.keys(t).forEach(function(s){i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})}))},n.prototype._removeFromCachedMetaData=function(t,r){var i=this;this._cachedMetaData&&t.forEach(function(s){var o=i._cachedMetaData.get(s);o&&o.updatedAt0&&We("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new JM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(ex).message]}})})},n.prototype._createScheduledUserMessage=function(t,r){var i=this,s=O.of(this._iid).requestQueue,o=Date.now(),a=this._generateRequestId();Or(2).then(function(){var u=i._createPendingScheduledUserMessage(t,a,o);De(function(){return y(i,void 0,void 0,function(){return g(this,function(c){return[2,r._trigger(u)]})})})});var l=new tx(M({reqId:a,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(hS).message;De(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(Lr(u))throw u;Or(2).then(function(){var c=i._createPendingScheduledUserMessage(t,a,o);i._markMessageAsFailed(c,u),De(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},G1),t);return K(z1(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},Sx),t),s=O.of(this._iid);K(function(a,l){return l===void 0&&(l=s6),l0(a)&&Array.isArray(a.fileInfoList)&&a.fileInfoList.length>=2&&a.fileInfoList.length<=l&&a.fileInfoList.every(function(u){return Tx(u)})}(i,(r=s.appInfo)===null||r===void 0?void 0:r.multipleFilesMessageFileCountLimit)).throw(L.invalidParameters);var o=!!t.fileInfoList.find(function(a){var l=s.appInfo.uploadSizeLimit;return a.file instanceof Blob&&a.file.size>l||a.fileSize>l});return K(!o).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=Yn.SEND);var o=O.of(this._iid).dispatcher,a=An.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Br;return Or(2).then(function(){var d=s._createPendingFileMessage(t,l,u);o.dispatch(new Et({messages:[d],source:r===Yn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t).then(function(h){o.dispatch(new Et({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(Lr(h))throw h;Or(2).then(function(){var f=s._createPendingFileMessage(t,l,u),p=O.of(s._iid).cacheContext,m=p.localCacheEnabled&&p.localCacheConfig.enableAutoResend&&Kh(h.code);s._markMessageAsFailed(f,h,m),o.dispatch(new Et({messages:[f],source:f.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:h.code===Ie.FILE_UPLOAD_CANCEL_FAILED?G.LOCAL_MESSAGE_CANCELED:G.EVENT_MESSAGE_SENT_FAILED})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){K(t instanceof Zt&&!!t.messageParams).throw(L.invalidParameters);var r=O.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,Yn.SEND,t.reqId).onFailed(function(i){r.debug("autoResendFileMessage failed",i)}).onSucceeded(function(i){r.debug("autoResendFileMessage success",i)})},n.prototype._sendMultipleFilesMessage=function(t,r,i){var s=this,o=O.of(this._iid).dispatcher,a=An.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new hh;return Or(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);o.dispatch(new Et({messages:[d],source:r===Yn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t,{requestHandler:c,isCopy:r===Yn.COPY}).then(function(h){o.dispatch(new Et({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(Lr(h))throw h;Or(2).then(function(){var f=s._createPendingMultipleFilesMessage(t,l,u);s._markMessageAsFailed(f,h),o.dispatch(new Et({messages:[f],source:G.EVENT_MESSAGE_SENT_FAILED})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(p){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._createScheduledFileMessage=function(t,r,i,s){var o=this,a=O.of(this._iid).requestQueue,l=new nx(M(M({reqId:i,channelType:this.channelType,channelUrl:this.url},t),{fileUrl:t.fileUrl,requireAuth:t.requireAuth}));a.send(l).then(function(u){var c=u.as(rx).message;De(function(){return y(o,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(Lr(u))throw u;Or(2).then(function(){var c=o._createPendingScheduledFileMessage(t,i,s);o._markMessageAsFailed(c,u),De(function(){return y(o,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;K(t.every(function(u){return z1(M(M({},G1),u))})).throw(L.invalidParameters);var s=new Br;try{for(var o=ve(t),a=o.next();!a.done;a=o.next()){var l=a.value;this.sendFileMessage(l).onPending(function(u){return s._trigger(u)}).onFailed(function(u,c){return s._triggerFailed(u,c)}).onSucceeded(function(u){return s._trigger(u)})}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s},n.prototype.resendFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){return i=this._validateFailedFileMessageHasFile(t,r),K(t instanceof Zt&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Tr,o=om(t,r),this._sendFileMessage(o,Yn.RESEND,t.reqId).onFailed(function(l){return s.reject(l)}).onSucceeded(function(l){return s.resolve(l)}),[2,s.promise]})})},n.prototype.resendMessage=function(t,r){var i,s;if(K(t instanceof Dt&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:sm(t);return this._sendUserMessage(o,Yn.RESEND,t.reqId)}if(t.isFileMessage()){var a=this._validateFailedFileMessageHasFile(t,r);return K(a).throw(L.invalidParameters),o=(s=t.messageParams)!==null&&s!==void 0?s:om(t,r),this._sendFileMessage(o,Yn.RESEND,t.reqId)}if(t.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=M(M({},aM),r),K(k("number",t)&&function(u){return Xv(u)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new Z1(M({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:i.metaArrays?{array:i.metaArrays,mode:"add",upsert:!0}:void 0},i)),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(lm).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return r=O.of(this._iid).requestQueue,i=$s(),(s=new sf({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:i})).uploadProgressHandler=t.progressHandler,t.uploadStartedHandler&&t.uploadStartedHandler(i),[4,r.send(s)];case 1:return o=c.sent(),a=o.as(of),l=a.url,u=a.thumbnails,[2,{requestId:i,url:l,thumbnails:u}]}})})},n.prototype.cancelUploadingFileMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),An.of(this._iid).fileMessageQueue.cancel(this,t),[2,!0]})})},n.prototype.copyFileMessage=function(t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l;return g(this,function(u){return K(t instanceof n&&r instanceof Zt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),a=new Tr,l=Ne(M(M({},r),{fileUrl:r.url,fileName:r.name,fileSize:r.size,mimeType:r.type,mentionType:r.mentionType,mentionedUserIds:(i=r.mentionedUserIds)!==null&&i!==void 0?i:(s=r.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(o=r.thumbnails)===null||o===void 0?void 0:o.map(function(c){return{maxWidth:c.width,maxHeight:c.height}}),requireAuth:r.requireAuth,isPinnedMessage:!1})),t._sendFileMessage(l).onSucceeded(function(c){return a.resolve(c)}).onFailed(function(c){return a.reject(c)}),[2,a.promise]})})},n.prototype.copyMessage=function(t,r){K(t instanceof n&&r instanceof Dt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){K(!i.poll).throw(L.notSupportedError);var o=oS(i);return s._sendUserMessage(o)}if(i.isFileMessage())return o=lS(i),s._sendFileMessage(o);if(r.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return K(t instanceof dr).throw(L.invalidParameters),t.messageId>0?(r=O.of(this._iid).requestQueue,i=new dC({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Dt?t._messageToken:void 0}),[4,r.send(i)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.addReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(t instanceof dr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new QM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(YM).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(t instanceof dr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ZM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(XM).reactionEvent]}})})},n.prototype._updateUserMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new Y1({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(am).message,a.dispatch(new Et({messages:[d],source:G.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype._updateFileMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new Z1({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(lm).message,a.dispatch(new Et({messages:[d],source:G.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype.createMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return K(t instanceof dr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new pr({key:o})}),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,i,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"add",!0)]})})},n.prototype.deleteMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return K(t instanceof dr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new pr({key:o})}),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,i,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"remove",!0)]})})},n.prototype.addMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return K(t instanceof dr&&t.messageId>0&&r.every(function(s){return s instanceof pr})).throw(L.invalidParameters),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,r,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"add",!0)]})})},n.prototype.removeMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return K(t instanceof dr&&t.messageId>0&&r.every(function(s){return s instanceof pr})).throw(L.invalidParameters),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,r,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"remove",!0)]})})},n.prototype.report=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(Ge(rc,t)&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new VM({channelUrl:this.url,channelType:this.channelType,userId:s.userId,category:t,description:r}),[4,o.send(a)];case 1:return l.sent(),[2]}})})},n.prototype.reportUser=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(t instanceof Ke&&Ge(rc,r)&&k("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new qM({channelUrl:this.url,channelType:this.channelType,userId:o.userId,offendingUserId:t.userId,category:r,description:i}),[4,a.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.reportMessage=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(t instanceof Dt&&Ge(rc,r)&&k("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new WM({channelUrl:this.url,channelType:this.channelType,userId:o.userId,offendingUserId:t.sender.userId,messageId:t.messageId,category:r,description:i,messageToken:t._messageToken}),[4,a.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.updatePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("number",t)&&function(l){return k("string",l.title,!0)&&VC(l.data)&&k("boolean",l.allowUserSuggestion,!0)&&k("boolean",l.allowMultipleVotes,!0)&&k("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ix(M({pollId:t},r)),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(sx).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=k("number",t),K(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ox({pollId:t}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},n.prototype.closePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=k("number",t),K(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ax({pollId:t}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(lx).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=k("number",t)&&k("string",r)&&r.trim()!=="",K(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ux({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(cx).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return s=k("number",t)&&k("number",r)&&k("string",i)&&i.trim()!=="",K(s).throw(L.invalidParameters),o=O.of(this._iid).requestQueue,a=new dx({pollId:t,pollOptionId:r,optionText:i}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(hx).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return i=k("number",t)&&k("number",r),K(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new fx({pollId:t,pollOptionId:r}),[4,s.send(o)];case 1:return a.sent(),[2]}})})},n.prototype.votePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return i=k("number",t)&&We("number",r),K(i).throw(L.invalidParameters),s=O.of(this._iid),o=s.requestQueue,a=s.dispatcher,l=new px({reqId:this._generateRequestId(),channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionIds:r}),[4,o.send(l)];case 1:return u=d.sent(),c=u.as(fS).event,a.dispatch(new Qv({event:c,source:G.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("number",t)).throw(L.invalidParameters),[4,rf.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.getPollChangeLogsSinceToken=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("string",t,!0)),[4,rf.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.createPollListQuery=function(t){return t===void 0&&(t=10),new QC(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new YC(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Wn),gS=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onConnected=qe,this.onReconnectStarted=qe,this.onReconnectSucceeded=qe,this.onReconnectFailed=qe,this.onDisconnected=qe}),J1=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onSessionExpired=qe,this.onSessionTokenRequired=function(e){return e(null)},this.onSessionError=qe,this.onSessionRefreshed=qe,this.onSessionClosed=qe}),Nx=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onFriendsDiscovered=qe,this.onTotalUnreadMessageCountChanged=qe,this.onTotalUnreadMessageCountUpdated=qe}),Ix=function(e){function n(t){var r=t.limit,i=t.token,s=t.userIdsFilter,o=t.metaDataKeyFilter,a=t.metaDataValuesFilter,l=t.nicknameStartsWithFilter,u=e.call(this)||this;return u.method=Q.GET,u.path=Xe,u.params=Ee({limit:r,token:i,user_ids:s,metadatakey:o,metadatavalues_in:a,nickname_startswith:l}),u}return T(n,e),n}(Y),Ax=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),Mx=function(e){function n(t,r){var i,s,o,a=this;return(a=e.call(this,t,r)||this).userIdsFilter=null,a.metaDataKeyFilter=null,a.metaDataValuesFilter=null,a.nicknameStartsWithFilter=null,a.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,a.metaDataKeyFilter=(s=r.metaDataKeyFilter)!==null&&s!==void 0?s:null,a.metaDataValuesFilter=(o=r.metaDataValuesFilter)!==null&&o!==void 0?o:null,a.nicknameStartsWithFilter=r.nicknameStartsWithFilter||null,a}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&We("string",this.userIdsFilter,!0)&&k("string",this.metaDataKeyFilter,!0)&&We("string",this.metaDataValuesFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new Ix(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Ax),o=s.users,a=s.next,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),xx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=t.userIdsFilter,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(r,"/block"),a.params=Ee({limit:i,token:s,user_ids:o}),a}return T(n,e),n}(Y),Ox=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),kx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).userIdsFilter=null,s.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,s}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&We("string",this.userIdsFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new xx(Ne(M(M({},this),{userId:r.userId,token:this._token}))),[4,i.send(s)]):[3,2]:[3,5];case 1:return o=c.sent(),a=o.as(Ox),l=a.users,u=a.next,this._token=u,this._hasNext=!!u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),Rx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),o.params={limit:i,token:s},o}return T(n,e),n}(Y),Lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.hasMore=r.has_more,i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),Dx=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Rx(M(M({},this),{userId:r.userId,token:this._token})),[4,i.send(s)]):[3,2]:[3,5];case 1:return o=d.sent(),a=o.as(Lx),l=a.users,u=a.hasMore,c=a.next,this._token=c,this._hasNext=u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),Dd={},Yc=function(){function e(n){var t=n.dbname,r=n.itemSizeLimit,i=r===void 0?1048576:r,s=n.cacheLimit,o=s===void 0?256:s,a=n.blockHashBase,l=a===void 0?2:a,u=n.blockHashMultiplier,c=u===void 0?10:u,d=n.blockHashConstant,h=d===void 0?11:d,f=n.transactionApplyDelay,p=f===void 0?200:f,m=n.disableLogger,b=m!==void 0&&m;return Dd[t]||(this.itemSizeLimit=i,this.cacheLimit=o,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,Dd[t]=this),Dd[t]}return e.get=function(n){return Dd[n]},e}();(function(e){e[e.UNKNOWN_ERROR=6e7]="UNKNOWN_ERROR",e[e.STORE_NOT_DEFINED=61001e3]="STORE_NOT_DEFINED",e[e.STORE_NOT_AVAILABLE=61001001]="STORE_NOT_AVAILABLE",e[e.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING=61001002]="STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING",e[e.STORE_IS_FULL=61001003]="STORE_IS_FULL",e[e.STORE_NOT_INITIALIZED=61001004]="STORE_NOT_INITIALIZED",e[e.STORE_INVALID_KEY_TYPE=61002e3]="STORE_INVALID_KEY_TYPE",e[e.STORE_BROKEN_INTEGRITY=61002001]="STORE_BROKEN_INTEGRITY",e[e.STORE_BROKEN_BLOB=61002002]="STORE_BROKEN_BLOB",e[e.STORE_ENCRYPTION_INVALID=61002003]="STORE_ENCRYPTION_INVALID",e[e.STORE_ITEM_SIZE_LIMIT_EXCEEDED=61017e3]="STORE_ITEM_SIZE_LIMIT_EXCEEDED",e[e.STORE_READ_FAILED=61017001]="STORE_READ_FAILED",e[e.STORE_WRITE_FAILED=61017002]="STORE_WRITE_FAILED",e[e.DATABASE_SCHEMA_NOT_ON_UPGRADE=62002e3]="DATABASE_SCHEMA_NOT_ON_UPGRADE",e[e.COLLECTION_NOT_READY=63001e3]="COLLECTION_NOT_READY",e[e.COLLECTION_KEY_NOT_MATCH=63002e3]="COLLECTION_KEY_NOT_MATCH",e[e.COLLECTION_QUERY_NOT_VALID=63002001]="COLLECTION_QUERY_NOT_VALID",e[e.COLLECTION_KEY_NOT_FOUND=63004e3]="COLLECTION_KEY_NOT_FOUND",e[e.COLLECTION_KEY_NOT_GIVEN=63004001]="COLLECTION_KEY_NOT_GIVEN",e[e.COLLECTION_INSERT_DUPLICATE=63009e3]="COLLECTION_INSERT_DUPLICATE",e[e.COLLECTION_WRITE_FAILED=63017e3]="COLLECTION_WRITE_FAILED",e[e.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED=63017001]="COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED",e[e.INDEX_TABLE_IS_REQUIRED=65001e3]="INDEX_TABLE_IS_REQUIRED",e[e.INDEX_TYPE_NOT_MATCH=65002e3]="INDEX_TYPE_NOT_MATCH",e[e.COMPARE_TYPE_NOT_MATCH=69002001]="COMPARE_TYPE_NOT_MATCH",e[e.CIRCULAR_REFERENCE_FOUND=69002002]="CIRCULAR_REFERENCE_FOUND"})(St||(St={}));var aa,it=function(e){function n(t){var r=t.code,i=r===void 0?St.UNKNOWN_ERROR:r,s=t.message,o=s===void 0?"Unknown error occurred.":s,a=e.call(this,o)||this;return a.code=i,Object.setPrototypeOf(a,n.prototype),a}return T(n,e),Object.defineProperty(n,"storeNotDefined",{get:function(){return new n({code:St.STORE_NOT_DEFINED,message:"Store is not defined. Specify the store on NestDB()"})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailable",{get:function(){return new n({code:St.STORE_NOT_AVAILABLE,message:"Store is not available. Check your environment settings."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailableInPrivateBrowsing",{get:function(){return new n({code:St.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING,message:"Store is not available because it is in private browsing."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeIsFull",{get:function(){return new n({code:St.STORE_IS_FULL,message:"Store is full."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotInitialized",{get:function(){return new n({code:St.STORE_NOT_INITIALIZED,message:"Store is not initialized."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeKeyTypeIsInvalid",{get:function(){return new n({code:St.STORE_INVALID_KEY_TYPE,message:"Store key should be string type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenIntegrity",{get:function(){return new n({code:St.STORE_BROKEN_INTEGRITY,message:"Data should be in a store but it does not. Integrity is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenBlob",{get:function(){return new n({code:St.STORE_BROKEN_BLOB,message:"Data should be in a store but it does not. Blob data is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeEncryptionInvalid",{get:function(){return new n({code:St.STORE_ENCRYPTION_INVALID,message:"Encryption algorithm has changed. All the store should reset."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeItemSizeExceeded",{get:function(){return new n({code:St.STORE_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that the store allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeReadFailed",{get:function(){return new n({code:St.STORE_READ_FAILED,message:"Failed to read from store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeWriteFailed",{get:function(){return new n({code:St.STORE_WRITE_FAILED,message:"Failed to write to store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"databaseSchemaNotOnUpgrade",{get:function(){return new n({code:St.DATABASE_SCHEMA_NOT_ON_UPGRADE,message:"Committing schema is not allowed when upgrade is not running."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionNotReady",{get:function(){return new n({code:St.COLLECTION_NOT_READY,message:"Collection is not ready due to an error during initialization."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotMatch",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_MATCH,message:"keyName of collection could not change."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionQueryNotValid",{get:function(){return new n({code:St.COLLECTION_QUERY_NOT_VALID,message:"Query parameter is not a valid format."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionInsertDuplicate",{get:function(){return new n({code:St.COLLECTION_INSERT_DUPLICATE,message:"The key already exists."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotFound",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_FOUND,message:"The key is not found."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotGiven",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_GIVEN,message:"The item should contain [keyName] property."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionWriteFailed",{get:function(){return new n({code:St.COLLECTION_WRITE_FAILED,message:"Failed to write an item."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionItemSizeExceeded",{get:function(){return new n({code:St.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that a collection allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTableIsRequired",{get:function(){return new n({code:St.INDEX_TABLE_IS_REQUIRED,message:"Index table is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTypesNotMatch",{get:function(){return new n({code:St.INDEX_TYPE_NOT_MATCH,message:"Indexed column should have primitive type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"compareTypesNotMatch",{get:function(){return new n({code:St.COMPARE_TYPE_NOT_MATCH,message:"Values to compare have different types."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularReferenceFound",{get:function(){return new n({code:St.CIRCULAR_REFERENCE_FOUND,message:"Cannot handle circular referenced object."})},enumerable:!1,configurable:!0}),n}(Error);(function(e){e.INIT="init",e.READY="ready",e.CLOSED="closed"})(aa||(aa={}));var ey,kr=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw it.circularReferenceFound;n.set(e,!0);var t=void 0;if(Array.isArray(e))t=e.map(function(i){return kr(i,n)});else if(e instanceof RegExp)t=e;else if(e instanceof Date)t=e;else for(var r in t={},e)t[r]=kr(e[r],n);return n.delete(e),t}return e},Ls=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw it.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},ty=function(e,n){for(var t=0,r=0;r>>0)%n},Ud=function(e){return new Promise(function(n){setTimeout(function(){return n()},e)})},ma=function(e,n){if(!n)return!1;if(typeof e!="function"){for(var t in e)if(["/and","&&"].includes(t)){if(e[t].some(function(l){return!ma(l,n)}))return!1}else if(["/or","||"].includes(t)){if(e[t].every(function(l){return!ma(l,n)}))return!1}else if(t==="/where"){if(!(0,e[t])(n))return!1}else{var r=t;if(typeof e[r]=="object"){var i=e[r];for(var s in i)switch(s){case"/eq":case"=":if((o=n[r])!==(a=i[s]))return!1;break;case"/neq":case"!=":if((o=n[r])===(a=i[s]))return!1;break;case"/gt":case">":var o=n[r],a=i[s];if(!(Ls(o,a)>0))return!1;break;case"/gte":case">=":if(o=n[r],a=i[s],!(Ls(o,a)>=0))return!1;break;case"/lt":case"<":if(o=n[r],a=i[s],!(Ls(o,a)<0))return!1;break;case"/lte":case"<=":if(o=n[r],a=i[s],!(Ls(o,a)<=0))return!1;break;case"/in":if(o=n[r],!(a=i[s]).includes(o))return!1;break;case"/nin":if(o=n[r],(a=i[s]).includes(o))return!1;break;case"/contain":if(o=n[r],a=i[s],!o.includes(a))return!1;break;case"/regex":if(o=n[r],!(a=i[s]).test(o))return!1;break;case"/where":if(o=n[r],!(0,i[s])(o))return!1}}else if(typeof e[r]=="function"){if(!e[r](n[r]))return!1}else if(e[r]!==n[r])return!1}return!0}return e(n)},Au=function(){},ny=function(){return Promise.resolve()},Ux=function(e){return e},ry=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(ey||(ey={}));var va,hr,rs,Px=function(){function e(n){var t=n.initialPrevValue,r=t===void 0?null:t,i=n.initialNextValue,s=i===void 0?null:i,o=n.iterator,a=n.map,l=a===void 0?Ux:a,u=n.backward,c=u===void 0?ny:u,d=n.forward,h=d===void 0?ny:d,f=n.complete,p=f===void 0?Au:f;this._prevValue=r,this._nextValue=s,this._error=null,this._map=l,this._backward=c,this._forward=h,this._iterator=o,this._complete=p}return Object.defineProperty(e.prototype,"prevValue",{get:function(){return this._map(this._prevValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextValue",{get:function(){return this._map(this._nextValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return!!this._prevValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return!!this._nextValue},enumerable:!1,configurable:!0}),e.prototype.prev=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasPrevious)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._prevValue,t=this,[4,this._backward()];case 2:return t._prevValue=i.sent()||null,this._nextValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.next=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasNext)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._nextValue,t=this,[4,this._forward()];case 2:return t._nextValue=i.sent()||null,this._prevValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.stop=function(){this._prevValue=null,this._nextValue=null,this._complete()},e}(),cm=function(){function e(n){var t=n.condition,r=t===void 0?{}:t,i=n.backward,s=i!==void 0&&i,o=n.blockManager,a=n.indexer;this.condition=r,this.backward=s,this._blockManager=o,this._indexer=a}return e.prototype.findOptimizedStartPosition=function(){var n=this,t=["=","/eq",">",">=","/gt","/gte"],r=["=","/eq","<","<=","/lt","/lte"];if(this.backward){var i=this._indexer.origin.length-1;if(typeof this.condition!="function")for(var s in this._indexer.fields){var o=this._indexer.fields[s],a=1;if(o[0]==="-"&&(o=o.slice(1),a=-1),this.condition[o]){if(typeof this.condition[o]=="object"){var l=a>0?r:t;for(var u in this.condition[o])if(l.includes(u)){for(var c=i;c>=0;c--)if(a*Ls(this._indexer.origin[c].columnValues[s],this.condition[o][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(a*Ls(this._indexer.origin[c].columnValues[s],this.condition[o])<=0){i=c;break}}}return Math.min(i+1,this._indexer.origin.length-1)}var d=0;if(typeof this.condition!="function")for(var h=function(m){var b=f._indexer.fields[m],v=1;if(b[0]==="-"&&(b=b.slice(1),v=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((v>0?t:r).includes(E)){for(var S=d;S=0){d=S;break}}});else for(var _=d;_=0){d=_;break}}},f=this,s=0;s"u"?[3,4]:[4,fetch(r)]):[3,5];case 2:return[4,d.sent().blob()];case 3:return[2,d.sent()];case 4:for(s=[],o=atob(r.split(",")[1]),a=0;a-1){var i=this._items[r];return t===rs.PERSISTENT&&(i.state=hr.PERSISTENT),t!==rs.NO_CACHE&&this.put(i),i}return null},e.prototype.put=function(n){var t,r;if(this._limit>0){var i=this._items.map(function(d){return d.key}).indexOf(n.key);if(i>-1)sy.includes(this._items[i].state)&&sy.includes(n.state)?(this._items.splice(i,1),this._items.push(n)):(this._items[i].state=n.state,this._items[i].value=n.value);else{this._items.push(n);var s=this._items.filter(function(d){return d.state===hr.VOLATILE}),o=s.length-this._limit;if(o>0){var a=[];try{for(var l=ve(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===hr.VOLATILE&&o>0?o--:a.push(c)}}catch(d){t={error:d}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}this._items=a}}}},e.prototype.remove=function(n){var t=this._items.map(function(r){return r.key}).indexOf(n);t>-1&&this._items.splice(t,1)},e.prototype.clearByCondition=function(n){this._items=this._items.filter(function(t){return!n(t)})},e.prototype.clear=function(n){n===void 0&&(n=!1),this._items=n?[]:this._items.filter(function(t){return t.state!==hr.VOLATILE})},e}(),jx=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.store;this._requests=[],this._onCommit=new Map,this._onWrite=new Map,this._onError=new Map,this.dbname=t,this.collectionName=r,this.metadataKey=function(s,o){return"".concat(Na(s,o),"/trans.metadata")}(t,r),this.recordsetKey=function(s,o){return"".concat(Na(s,o),"/trans.recordset")}(t,r),this._store=i}return Object.defineProperty(e.prototype,"generation",{get:function(){return this._metadata?this._metadata.generation:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestCount",{get:function(){return this._requests.length},enumerable:!1,configurable:!0}),e.prototype._getReducedRecordset=function(n){return n===void 0&&(n=[]),y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,Pe([],Ae(n),!1)),[2,this._reduceRecordSet(t)]}})})},e.prototype._reduceRecordSet=function(n){for(var t=[],r={},i=n.length-1;i>=0;i--){for(var s=n[i],o=[],a=s.requests.length-1;a>=0;a--){var l=s.requests[a],u=l.data;r[u.key]||(o.unshift(l),r[u.key]=!0)}o.length>0&&(s.requests=o,t.unshift(s))}return t},e.prototype._applyRecord=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:r=Ti.get(this.dbname),i=t.generation,s=t.requests,o=null,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this._store.setMany(s.map(function(f){return M(M({},f.data),{generation:i})}))];case 2:for(a=h.sent(),l=0;l0))return[3,4];for(t=[],r={},l=n.length-1;l>=0;l--)i=n[l],c=i.data,r[c.key]||(r[c.key]=!0,t.unshift(i));return s={generation:this.generation,requests:t},[4,this._getReducedRecordset([s])];case 1:return o=p.sent(),[4,this._store.set({key:this.recordsetKey,value:o})];case 2:return p.sent(),this._metadata.generation++,[4,this._store.set({key:this.metadataKey,value:this._metadata})];case 3:for(p.sent(),a=Ti.get(this.dbname),l=0;l0?(i=this.createBlockId(n,r),[4,t.find(this._store,i)]):[3,4];case 2:if((s=a.sent())&&(o=fh.createFromCacheItem(s),o==null?void 0:o.getItemByKey(n)))return[2,o];a.label=3;case 3:return r--,[3,1];case 4:return[2,null]}})})},e.prototype.getFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return[2,(t=r.sent())?t.getItemByKey(n):null]}})})},e.prototype.putToBlock=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return r=Yc.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Ti.get(this.dbname).find(this._store,i)];case 1:return o=l.sent(),(a=o?fh.createFromCacheItem(o):new fh({blockId:i,keyName:this.keyName,items:[],limit:s}))!=null&&a.add(t)?(this._transaction.requestWrite({key:a.blockId,value:a.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.removeFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return(t=r.sent())&&t.remove(n)?(this._transaction.requestWrite({key:t.blockId,value:t.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.clearAllBlocks=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=hm(this.dbname,this.collectionName),[4,this._store.getAllKeys()];case 1:return t=i.sent(),r=t.filter(function(s){return s.startsWith(n)}),[4,this._store.removeMany(r)];case 2:return i.sent(),[4,this._transaction.clear()];case 3:return i.sent(),Ti.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),qa={},Ks=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.fields,o=n.transaction,a=n.store,l=this;this._origin=[],this._table=[];var u=function(c,d,h){return"".concat(Na(c,d),"/index.").concat(h)}(t,r,s.join(">"));return qa[u]||(this.dbname=t,this.collectionName=r,this.keyName=i,this.fields=s,this.indexerKey=u,this._transaction=o,this._store=a,this._transaction.on(va.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(va.ERROR,this.indexerKey,function(){return l.abort()})),qa[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in qa)delete qa[n]},e.prototype._addItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Ae(this.indexOf(r),2),s=i[0];return i[1]?!this._table[s].keys.includes(t)&&(this._table[s].keys.push(t),!0):(this._table.splice(s,0,{columnValues:r,keys:[t]}),!0)},e.prototype._removeItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Ae(this.indexOf(r),2),s=i[0];if(i[1]){var o=this._table[s].keys.indexOf(t);if(o>-1)return this._table[s].keys.splice(o,1),this._table[s].keys.length===0&&this._table.splice(s,1),!0}return!1},Object.defineProperty(e.prototype,"origin",{get:function(){return this._origin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"table",{get:function(){return this._table},enumerable:!1,configurable:!0}),e.prototype.getColumnValues=function(n){var t,r,i,s,o=[];try{for(var a=ve(this.fields),l=a.next();!l.done;l=a.next()){var u=l.value;if(u[0]==="-"&&(u=u.slice(1)),i=n[u],s=void 0,s=typeof i,i!==null&&s!=="undefined"&&s!=="boolean"&&s!=="number"&&s!=="string")throw it.indexTypesNotMatch;o.push(n[u])}}catch(c){t={error:c}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},e.prototype.diff=function(n,t){for(var r in this.fields){var i=this.fields[r][0]==="-"?-1:1,s=Ls(n[r],t[r]);if(s!==0)return i*s}return 0},e.prototype.indexOf=function(n){if(this._table.length>0){for(var t=0,r=this._table.length-1;t<=r;){var i=Math.floor((t+r)/2),s=this.diff(n,this._table[i].columnValues);if(s>0)t=i+1;else{if(!(s<0))return[i,!0];r=i-1}}return[t,!1]}return[0,!1]},e.prototype.ensure=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return[4,(n=Ti.get(this.dbname)).find(this._store,this.indexerKey,rs.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=hm(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=ve(i),o=s.next(),_.label=4;case 4:return o.done?[3,7]:(a=o.value).startsWith(r)?[4,n.find(this._store,a,rs.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=fh.createFromCacheItem(l))try{for(b=void 0,c=ve(u.items),d=c.next();!d.done;d=c.next())h=d.value,this._addItem(h)}catch(E){b={error:E}}finally{try{d&&!d.done&&(v=c.return)&&v.call(c)}finally{if(b)throw b.error}}_.label=6;case 6:return o=s.next(),[3,4];case 7:return[3,10];case 8:return f=_.sent(),p={error:f},[3,10];case 9:try{o&&!o.done&&(m=s.return)&&m.call(s)}finally{if(p)throw p.error}return[7];case 10:return this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[3,12];case 11:this._origin=t.value,this._table=kr(this._origin),_.label=12;case 12:return qa[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return Ti.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete qa[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._addItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.removeItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._removeItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this._table=[],this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.commit=function(){this._origin=this._table,this._table=kr(this._origin)},e.prototype.abort=function(){this._table=kr(this._origin)},e}(),uf=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},oy=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})};(function(e){e[e.PROCESSING=0]="PROCESSING",e[e.DONE=1]="DONE"})(ic||(ic={})),function(e){e.NEWNODE="newnode",e.REMOVENODE="removenode",e.CLAIM_HOST="claimhost",e.SYNC_HOST="synchost",e.REQUEST_LOCK="requestlock",e.ACQUIRE_LOCK="acquirelock",e.RELEASE_LOCK="releaselock"}(lr||(lr={}));var Hi,wp={},Jv=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=ic.PROCESSING,this._queue=[],this._activationQueue=[],wp[n]&&!t.forceCreate||(this.nodeId=oy(),this.key=n,uf()&&(t.startAsInvisible?this.registerNode():document.visibilityState==="visible"?this.claimHost():this.registerNode(),document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&r.claimHost()}),window.addEventListener("message",function(i){var s,o,a=i.data;if(a!=null&&a.isNestDbMessage){var l=a.nodeId,u=a.requestId,c=a.key,d=a.op,h=a.data;if(l!==r.nodeId&&c===r.key)switch(d){case lr.NEWNODE:r._sendSync();break;case lr.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case lr.SYNC_HOST:if(!r.isInSync){r._activationTimeout&&clearTimeout(r._activationTimeout);var f=h,p=f.currentItemRequestId,m=f.queue,b=function(S){var w=r._queue.findIndex(function(N){return N.requestId===S.requestId});w<0&&r._requestLock({isNestDbMessage:!0,nodeId:S.nodeId,requestId:S.requestId,key:r.key,op:lr.REQUEST_LOCK,ts:S.ts})};try{for(var v=ve(m),_=v.next();!_.done;_=v.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(o=v.return)&&o.call(v)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case lr.REMOVENODE:r._queue=r._queue.filter(function(S){return S.nodeId!==a.nodeId}),r._currentItem&&r._currentItem.nodeId===a.nodeId&&(r._currentItem=void 0,r._acquire(r._queue[0]));break;case lr.REQUEST_LOCK:r._requestLock(a);break;case lr.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case lr.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(lr.REMOVENODE)})),wp[n]=this),wp[n]}return Object.defineProperty(e.prototype,"locked",{get:function(){return!!this._currentItem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isHost",{get:function(){return this._hostId===this.nodeId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInSync",{get:function(){return this._state==ic.DONE},enumerable:!1,configurable:!0}),e.prototype._send=function(n,t){var r;t===void 0&&(t={});var i={isNestDbMessage:!0,nodeId:this.nodeId,requestId:(r=t==null?void 0:t.requestId)!==null&&r!==void 0?r:oy(),key:this.key,op:n,data:t.data,ts:Date.now()};return uf()&&window.postMessage(i,"*"),i},e.prototype._acquire=function(n){n?(this._currentItem=n,this._currentItem.onAcquired&&this._currentItem.onAcquired(n.requestId)):this._currentItem=void 0},e.prototype._release=function(n){if(this._currentItem&&this._currentItem.requestId===n){var t=this._currentItem;this._currentItem=void 0,t.nodeId===this.nodeId&&this._send(lr.RELEASE_LOCK,{requestId:t.requestId});var r=this._queue.findIndex(function(i){return i.requestId===n});r>-1&&this._queue.splice(r,1),t.onReleased&&t.onReleased(n)}},e.prototype._requestLock=function(n){var t=this;return new Promise(function(r){var i={nodeId:n.nodeId,requestId:n.requestId,ts:n.ts,onAcquired:function(a){t.isHost&&t._send(lr.ACQUIRE_LOCK,{requestId:a}),r()},onReleased:function(){t._acquire(t._queue[0])}},s=!1;for(var o in t._queue)if(t._queue[o].ts>i.ts){t._queue.splice(parseInt(o),0,i),s=!0;break}s||t._queue.push(i),t._currentItem||t._acquire(t._queue[0])})},e.prototype._sendSync=function(){var n;this.isHost&&this._send(lr.SYNC_HOST,{data:{currentItemRequestId:(n=this._currentItem)===null||n===void 0?void 0:n.requestId,queue:this._queue.map(function(t){return{nodeId:t.nodeId,requestId:t.requestId,ts:t.ts}})}})},e.prototype._waitUntilSyncCompleted=function(){return y(this,void 0,void 0,function(){var n=this;return g(this,function(t){return this.isHost&&!this.isInSync?[2,new Promise(function(r){n._activationQueue.push(r)})]:[2]})})},e.prototype._waitSync=function(){var n=this;this.isInSync||(this._activationTimeout=setTimeout(function(){n._completeSync()},8))},e.prototype._completeSync=function(){this.isInSync||(this._state=ic.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(lr.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(lr.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(lr.REQUEST_LOCK),[4,this._requestLock(n)];case 2:return t.sent(),[2]}})})},e.prototype.unlock=function(){var n;!((n=this._currentItem)===null||n===void 0)&&n.requestId&&this._release(this._currentItem.requestId)},e}(),Np=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.keyHash,o=n.indexes,a=n.store,l=this;this._state=aa.INIT,this._indexers=[],this.dbname=t,this.name=r,this.keyName=i,this.indexes=Pe([[i]],Ae(o.filter(function(u){return Ks.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=a,this._mutex=new Jv(function(u,c){return"".concat(Na(u,c),".lock")}(t,r)),this._blobContainer=new Hx({dbname:t,collectionName:r,store:a}),this._transaction=new jx({dbname:t,collectionName:r,store:a})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Tp(n,t),[4,r.get(i)];case 1:return[2,s.sent()]}})})},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return this._state===aa.READY},enumerable:!1,configurable:!0}),e.prototype.init=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l,u,c,d,h,f,p,m=this;return g(this,function(b){switch(b.label){case 0:return[4,this._mutex.lock()];case 1:b.sent(),b.label=2;case 2:return b.trys.push([2,9,,10]),n=Yc.get(this.dbname),[4,e.metadataOf(this.dbname,this.name,this._store)];case 3:return t=b.sent(),this._metadata=t||{keyName:this.keyName,blockLevel:1,blockHashBase:n.blockHashBase,blockHashMultiplier:n.blockHashMultiplier,blockHashConstant:n.blockHashConstant,indexes:this.indexes},[4,this._transaction.init()];case 4:b.sent(),this._blockManager=new Bx({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=Pe([],Ae(this.indexes),!1),i=[],s=r.map(function(v){return Ks.createKey(v)}),o=t?t.indexes.map(function(v){return Ks.createKey(v)}):[];try{for(a=ve(o),l=a.next();!l.done;l=a.next())u=l.value,s.includes(u)||i.push(Ks.parseKey(u))}catch(v){f={error:v}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,Pe([],Ae(r.map(function(v){var _=new Ks({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,Pe([],Ae(i.map(function(v){return new Ks({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store}).drop()})),!1)),[4,Promise.all(c)];case 5:return b.sent(),[4,this._transaction.commit()];case 6:return b.sent(),s.sort().join(",")===o.sort().join(",")?[3,8]:(d=Tp(this.dbname,this.name),this._metadata.indexes=r,[4,this._store.set({key:d,value:this._metadata})]);case 7:b.sent(),b.label=8;case 8:return this._state=aa.READY,this._mutex.unlock(),[3,10];case 9:throw h=b.sent(),this._mutex.unlock(),h;case 10:return[2]}})})},e.prototype.close=function(){this._state=aa.CLOSED},e.prototype._hasPropertyOfKeyName=function(n){var t=n[this.keyName];return typeof t=="string"&&!!t},e.prototype._getIndexerBy=function(n){var t,r;n===void 0&&(n=null),n||(n=[this.keyName]);var i=Ks.createKey(n);try{for(var s=ve(this._indexers),o=s.next();!o.done;o=s.next()){var a=o.value;if(i===Ks.createKey(a.fields))return a}}catch(l){t={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw it.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Tp(this.dbname,this.name),this._metadata.blockLevel++,[4,this._store.set({key:n,value:this._metadata})];case 1:return t.sent(),[2]}})})},e.prototype._requestInsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return l.sent()?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return l.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return l.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:l.sent(),l.label=5;case 5:l.trys.push([5,10,11,12]),r=ve(this._indexers),i=r.next(),l.label=6;case 6:return i.done?[3,9]:[4,i.value.addItem(n)];case 7:l.sent(),l.label=8;case 8:return i=r.next(),[3,6];case 9:return[3,12];case 10:return s=l.sent(),o={error:s},[3,12];case 11:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}return[7];case 12:return[3,14];case 13:throw it.collectionInsertDuplicate;case 14:return[2]}})})},e.prototype._requestUpsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=m.sent())?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return m.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return m.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:m.sent(),m.label=5;case 5:m.trys.push([5,10,11,12]),i=ve(this._indexers),s=i.next(),m.label=6;case 6:return s.done?[3,9]:[4,(u=s.value).addItem(n)];case 7:m.sent(),m.label=8;case 8:return s=i.next(),[3,6];case 9:return[3,12];case 10:return o=m.sent(),d={error:o},[3,12];case 11:try{s&&!s.done&&(h=i.return)&&h.call(i)}finally{if(d)throw d.error}return[7];case 12:return[3,23];case 13:return[4,this._blockManager.putToBlock(t,n)];case 14:m.sent(),m.label=15;case 15:m.trys.push([15,21,22,23]),a=ve(this._indexers),l=a.next(),m.label=16;case 16:return l.done?[3,20]:(u=l.value).diff(u.getColumnValues(r),u.getColumnValues(n))===0?[3,19]:[4,u.removeItem(r)];case 17:return m.sent(),[4,u.addItem(n)];case 18:m.sent(),m.label=19;case 19:return l=a.next(),[3,16];case 20:return[3,23];case 21:return c=m.sent(),f={error:c},[3,23];case 22:try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}return[7];case 23:return[2]}})})},e.prototype._requestUpdate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=c.sent())?[4,this._blockManager.putToBlock(t,n)]:[3,11];case 2:c.sent(),c.label=3;case 3:c.trys.push([3,9,10,11]),i=ve(this._indexers),s=i.next(),c.label=4;case 4:return s.done?[3,8]:(o=s.value).diff(o.getColumnValues(r),o.getColumnValues(n))===0?[3,7]:[4,o.removeItem(r)];case 5:return c.sent(),[4,o.addItem(n)];case 6:c.sent(),c.label=7;case 7:return s=i.next(),[3,4];case 8:return[3,11];case 9:return a=c.sent(),l={error:a},[3,11];case 10:try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}return[7];case 11:return[2]}})})},e.prototype._requestRemove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return[4,this._blockManager.getFromBlock(n)];case 1:return(t=l.sent())?[4,this._blockManager.removeFromBlock(n)]:[3,10];case 2:l.sent(),l.label=3;case 3:l.trys.push([3,8,9,10]),r=ve(this._indexers),i=r.next(),l.label=4;case 4:return i.done?[3,7]:[4,i.value.removeItem(t)];case 5:l.sent(),l.label=6;case 6:return i=r.next(),[3,4];case 7:return[3,10];case 8:return s=l.sent(),o={error:s},[3,10];case 9:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}return[7];case 10:return[2]}})})},e.prototype._requestClear=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return[4,this._blockManager.clearAllBlocks()];case 1:o.sent(),o.label=2;case 2:o.trys.push([2,7,8,9]),n=ve(this._indexers),t=n.next(),o.label=3;case 3:return t.done?[3,6]:[4,t.value.clear()];case 4:o.sent(),o.label=5;case 5:return t=n.next(),[3,3];case 6:return[3,9];case 7:return r=o.sent(),i={error:r},[3,9];case 8:try{t&&!t.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}return[7];case 9:return[2]}})})},e.prototype.getByKey=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,6];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this._blockManager.getFromBlock(n)];case 3:return t=i.sent(),this._mutex.unlock(),[2,kr(t)];case 4:throw r=i.sent(),this._mutex.unlock(),r;case 5:return[3,7];case 6:throw it.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new Fx({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw it.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestInsert(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.insertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw it.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ve(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestInsert(kr(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),a={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return o=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),o;case 14:return[3,16];case 15:throw it.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestUpsert(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.upsertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw it.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ve(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestUpsert(kr(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),a={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return o=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),o;case 14:return[3,16];case 15:throw it.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestUpdate(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.updateIf=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v=this;return g(this,function(_){switch(_.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,16];case 1:_.sent(),_.label=2;case 2:return _.trys.push([2,13,,15]),r=n.where,i=r===void 0?{}:r,s=n.index,o=s===void 0?null:s,a=n.backward,l=a!==void 0&&a,u=[],[4,new cm({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(o)}).each(function(E){return y(v,void 0,void 0,function(){var S,w;return g(this,function(N){if(E.error)throw E.stop(),E.error;if(E.hasNext){if(S=E.nextValue,ma(i,S)&&t.set){if(typeof t.set!="function")for(w in t.set)S[w]=t.set[w];else t.set(S);u.push(S)}E.next()}else E.stop();return[2]})})})];case 3:_.sent(),_.label=4;case 4:_.trys.push([4,9,10,11]),c=ve(u),d=c.next(),_.label=5;case 5:return d.done?[3,8]:(h=d.value,[4,this._requestUpdate(kr(h))]);case 6:_.sent(),_.label=7;case 7:return d=c.next(),[3,5];case 8:return[3,11];case 9:return f=_.sent(),m={error:f},[3,11];case 10:try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(m)throw m.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return _.sent(),this._mutex.unlock(),[2,u];case 13:return p=_.sent(),[4,this._transaction.clear()];case 14:throw _.sent(),this._mutex.unlock(),p;case 15:return[3,17];case 16:throw this._transaction.clear(),it.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,5,,7]),[4,this._requestRemove(n)];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[3,7];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.removeIf=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:v.sent(),v.label=2;case 2:return v.trys.push([2,13,,14]),t=n.where,r=t===void 0?{}:t,i=n.index,s=i===void 0?null:i,o=n.backward,a=o!==void 0&&o,l=[],[4,new cm({condition:r,blockManager:this._blockManager,backward:a,indexer:this._getIndexerBy(s)}).each(function(_){return y(b,void 0,void 0,function(){var E,S;return g(this,function(w){if(_.error)throw _.stop(),_.error;return _.hasNext?(E=_.nextValue,ma(r,E)&&(S=E[this.keyName],l.push(S)),_.next()):_.stop(),[2]})})})];case 3:v.sent(),v.label=4;case 4:v.trys.push([4,9,10,11]),u=ve(l),c=u.next(),v.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:v.sent(),v.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=v.sent(),p={error:h},[3,11];case 10:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(p)throw p.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return v.sent(),this._mutex.unlock(),[2,l];case 13:throw f=v.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),it.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this._requestClear()];case 3:return t.sent(),[4,this._transaction.commit()];case 4:return t.sent(),this._mutex.unlock(),[3,7];case 5:return n=t.sent(),[4,this._transaction.clear()];case 6:throw t.sent(),this._mutex.unlock(),n;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.get(n)];case 1:return[2,t.sent()]}})})},e.prototype.saveBlob=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._blobContainer.save(n,t)];case 1:return[2,r.sent()]}})})},e.prototype.removeBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.remove(n)];case 1:return t.sent(),[2]}})})},e.prototype.removeAllBlobs=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),Ip="[NESTDB]",Fd=!0,zo=function(){function e(){}return e.off=function(){Fd=!1},e.log=function(){for(var n=[],t=0;t1?[4,Promise.all(this._generateShardPostfixArray(s==null?void 0:s.shards).map(function(c){return y(l,void 0,void 0,function(){var d,h;return g(this,function(f){switch(f.label){case 0:return c>0?(d=this._getRawKey(n,".".concat(c)),[4,this._getRaw(d)]):[3,2];case 1:if(!(h=f.sent()))throw it.storeBrokenIntegrity;return[2,h.data];case 2:return[2,i]}})})}))]:[3,4];case 3:return a=u.sent(),[3,5];case 4:a=[i],u.label=5;case 5:return o=a,[2,this.encryption.decrypt(JSON.parse(o.join("")))];case 6:return u.sent(),[2,null];case 7:return[2,null]}})})},e.prototype.set=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=this._shardify(n),[4,this._setRaw(t)];case 1:return r.sent(),[2,M({},n.value)]}})})},e.prototype.setMany=function(n){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,Pe([],Ae(n.map(function(s){return r._shardify(s)})),!1)))];case 1:return i.sent(),[2,n.map(function(s){return s.value})]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(o){switch(o.label){case 0:return t=this._getRawKey(n,".0"),[4,this._getRaw(t)];case 1:return(r=o.sent())?(i=r.metadata,[4,this._removeRaw(this._generateShardPostfixArray(i==null?void 0:i.shards).map(function(a){return s._getRawKey(n,".".concat(a))}))]):[3,3];case 2:return o.sent(),[2,!0];case 3:return[2,!1]}})})},e.prototype.removeMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return g(this,function(v){switch(v.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=v.sent())&&(b=m.metadata,t.push.apply(t,Pe([],Ae(i._generateShardPostfixArray(b==null?void 0:b.shards).map(function(_){return d._getRawKey(f,".".concat(_))})),!1))),[2]}})},i=this,h.label=1;case 1:h.trys.push([1,6,7,8]),s=ve(n),o=s.next(),h.label=2;case 2:return o.done?[3,5]:(a=o.value,[5,r(a)]);case 3:h.sent(),h.label=4;case 4:return o=s.next(),[3,2];case 5:return[3,8];case 6:return l=h.sent(),u={error:l},[3,8];case 7:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 8:return t.length>0?[4,this._removeRaw(t)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2,n]}})})},e}(),Ir={},Yo=function(e){function n(t){t===void 0&&(t={});var r,i=this;i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:4194304}))||this;var s=t.delay,o=s===void 0?1:s;return i.delay=o,i.observer={},i}return T(n,e),Object.defineProperty(n.prototype,"rawData",{get:function(){return Ir[this.dbname]},set:function(t){Ir[this.dbname]=t},enumerable:!1,configurable:!0}),n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(Ir[this.dbname])return[2,Object.keys(Ir[this.dbname])];throw it.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Ir[this.dbname]?[4,Ud(this.delay)]:[3,2];case 1:return r.sent(),[2,Ir[this.dbname][t]?M({key:t},Ir[this.dbname][t]):null];case 2:throw it.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return Ir[this.dbname]?[4,Ud(this.delay)]:[3,2];case 1:d.sent();try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,o=s.key,a=s.data,l=s.metadata,Ir[this.dbname][o]=Object.freeze({data:a,metadata:l})}catch(h){u={error:h}}finally{try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}}return[3,3];case 2:throw it.storeNotAvailable;case 3:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return Ir[this.dbname]?[4,Ud(this.delay)]:[3,2];case 1:l.sent();try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,Ir[this.dbname][s]&&delete Ir[this.dbname][s]}catch(u){o={error:u}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[3,3];case 2:throw it.storeNotAvailable;case 3:return[2]}})})},n.prototype.observe=function(t,r,i){var s=this;this.observer[t]||(this.observer[t]={}),r.forEach(function(o){return s.observer[t][o]=i})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,Ir[this.dbname]||(Ir[this.dbname]={}),[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.set=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){if((r=this.observer[t.key])&&typeof r.set=="function"&&(i=r.set()))throw i;return[2,e.prototype.set.call(this,t)]})})},n.prototype.setMany=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){try{for(r=ve(t),i=r.next();!i.done;i=r.next())if(s=i.value,(o=this.observer[s.key])&&typeof o.set=="function"&&(a=o.set()))throw a}catch(d){l={error:d}}finally{try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}}return[2,e.prototype.setMany.call(this,t)]})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,Ud(this.delay)];case 1:return t.sent(),Ir[this.dbname]={},[2]}})})},n}(u0),ay="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Hi||(Hi={}));var is,Gx=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:104857600}))||this)._storeName=ay,i._state=Hi.UNINITIALIZED,i._openJobQueue=[],i._window=typeof window<"u"?window:void 0,i._indexedDb=i._window?i._window.indexedDB||i._window.mozIndexedDB||i._window.webkitIndexedDB||i._window.msIndexedDB:void 0,i}return T(n,e),Object.defineProperty(n.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.prototype.isTransactionInactiveError=function(t){return t instanceof Error&&t.message.includes("The transaction is inactive")},n.prototype._putToObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,o){var a=t.put(r);a.addEventListener("success",function(l){s(l.target.result)}),a.addEventListener("error",function(){o("Failed to write.")})})]})})},n.prototype._deleteFromObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,o){var a=t.delete(r);a.addEventListener("success",function(){return s(r)}),a.addEventListener("error",function(l){return o(l.target.error)})})]})})},n.prototype._openDatabase=function(t){var r=this;return new Promise(function(i,s){if(r._indexedDb){r._state=Hi.OPENING;var o=r._indexedDb.open(t);o.addEventListener("upgradeneeded",function(a){a.target.result.createObjectStore(ay,{keyPath:"key"})}),o.addEventListener("success",function(a){r._state=Hi.OPEN,r._database=a.target.result,r._openJobQueue.forEach(function(l){return l()}),r._openJobQueue=[],r._database.onclose=function(){r._database=void 0,r._state=Hi.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),o.addEventListener("error",function(a){r._state=Hi.UNINITIALIZED,s(a.target.error)})}else s(it.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this._database?[2,this._database.transaction(this._storeName,t).objectStore(this._storeName)]:[3,1];case 1:switch(this._state){case Hi.UNINITIALIZED:case Hi.OPEN:return[3,2];case Hi.OPENING:case Hi.CLOSED:return[3,3]}return[3,4];case 2:throw it.storeNotInitialized;case 3:return[2,new Promise(function(s){r._openJobQueue.push(function(){return s(r._getObjectStore(t))})})];case 4:return[4,this._getObjectStore(t)];case 5:return[2,i.sent()]}})})},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var o=t.getAllKeys();o.addEventListener("success",function(a){i(a.target.result)}),o.addEventListener("error",function(a){return s(a.target.error)})})];case 2:return[2,r.sent()]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return r=i.sent(),[4,new Promise(function(s,o){var a=r.get(t);a.addEventListener("success",function(l){var u;s((u=l==null?void 0:l.target)===null||u===void 0?void 0:u.result)}),a.addEventListener("error",function(l){return o(l.target.error)})})];case 2:return[2,i.sent()]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._putToObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ve(t),o=s.next(),h.label=6;case 6:return o.done?[3,9]:(a=o.value,[4,this._putToObjectStore(r,a)]);case 7:h.sent(),h.label=8;case 8:return o=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._deleteFromObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ve(t),o=s.next(),h.label=6;case 6:return o.done?[3,9]:(a=o.value,[4,this._deleteFromObjectStore(r,a)]);case 7:h.sent(),h.label=8;case 8:return o=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._triggerDatabaseClose=function(){this._database&&this._database.onclose&&this._database.onclose(new Event("dummy"))},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:if(!((t=typeof window<"u"?window:null)!=null&&t.indexedDB||t!=null&&t.mozIndexedDB||t!=null&&t.webkitIndexedDB||t!=null&&t.msIndexedDB))return[3,6];if(this._indexedDb=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,!this._window||!uf())return[3,4];if(!(uf()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw it.storeNotAvailableInPrivateBrowsing;return[3,3];case 1:return[4,new Promise(function(s,o){if(r._indexedDb)try{var a=r._indexedDb.open("_testMozilla");a.onerror=function(){return o(it.storeNotAvailableInPrivateBrowsing)},a.onsuccess=function(l){if(l.target.result.close(),r._indexedDb){var u=r._indexedDb.deleteDatabase("_testMozilla");u.onerror=function(){return s()},u.onsuccess=function(){return s()}}else o(it.storeNotAvailable)}}catch{o(it.storeNotAvailableInPrivateBrowsing)}else o(it.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw it.storeNotAvailable;case 5:return[3,7];case 6:throw it.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this.checkAvailability()];case 1:return r.sent(),[4,this._openDatabase(t)];case 2:return r.sent(),[4,this._resetIfEncryptionChanged()];case 3:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var o=t.clear();o.addEventListener("success",function(){return i()}),o.addEventListener("error",function(a){return s(a.target.error)})})];case 2:return[2,r.sent()]}})})},n}(u0),zx=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,o=s===void 0?2097152:s,a=k4(t,["AsyncStorage","itemSizeLimit"]);return(r=e.call(this,M(M({},a),{itemSizeLimit:o}))||this)._asyncStorage=i,r}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getItem(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:r=[];try{for(i=ve(t),s=i.next();!s.done;s=i.next())o=s.value,a=o.key,o.data.length<=this.adjustedItemSizeLimit&&r.push([this._getActualKey(a),JSON.stringify(o)])}catch(d){l={error:d}}finally{try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}}return[4,this._asyncStorage.multiSet(r)];case 1:return c.sent(),[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.multiRemove(t.map(function(s){return r._getActualKey(s)}))];case 1:return i.sent(),[2]}})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._asyncStorage)throw it.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(u0),Vx=function(e){function n(t){var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:6291456}))||this)._mmkv=t.MMKV,i}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getString(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,o=s.key,s.data.length<=this.adjustedItemSizeLimit&&this._mmkv.set(this._getActualKey(o),JSON.stringify(s))}catch(c){a={error:c}}finally{try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}}return[2]})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,this._mmkv.delete(this._getActualKey(s))}catch(u){o={error:u}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2]})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._mmkv)throw it.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(u0);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(is||(is={}));var xs,qx=function(){function e(n){var t=n.name,r=n.version,i=n.store,s=n.config;this.name=t,this._version=r,this._state=is.INIT,this._config=s||new Yc({dbname:t}),this._store=i,this._event={success:Au,error:Au,storeReplaced:Au,upgrade:ry},this._collections=new Map,this._globalMutex=new Jv("".concat(this.name,".lock")),this._config.disableLogger&&zo.off(),new Ti({dbname:t,limit:this._config.cacheLimit})}return Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.estimateUsage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.usage()];case 1:return[2,r.sent()]}})}))];case 1:return[2,n.sent()]}var t})})},e.prototype.commitSchema=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this._state!==is.OPENING?[3,2]:[4,Promise.all(n.map(function(i){return y(t,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return s=i.collectionName,o=i.keyName,a=i.index,l=a===void 0?[]:a,this._collections.has(s)||this._collections.set(s,new Np({dbname:this.name,collectionName:s,keyName:o,indexes:l,store:this._store})),(u=this._collections.get(s))?[4,u.init()]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})}))];case 1:return r.sent(),[3,3];case 2:throw it.databaseSchemaNotOnUpgrade;case 3:return[2]}})})},e.prototype.open=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:return[4,this._globalMutex.lock()];case 1:if(a.sent(),this._state===is.OPENED)return[3,12];this._state=is.OPENING,a.label=2;case 2:return a.trys.push([2,5,,12]),[4,this._store.init(this.name)];case 3:return a.sent(),l=this.name,t="".concat(dm(l),".metadata"),r={version:0,collectionNames:[]},[4,this._store.get(t)];case 4:return i=(n=a.sent())!==null&&n!==void 0?n:r,[2,new Promise(function(u,c){var d=function(f){i.version0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.senderUserIdsFilter&&this.senderUserIdsFilter.length>0&&(!(n instanceof Dt)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof dr)switch(this.replyType){case Dn.NONE:if(n.parentMessageId>0)return!1;break;case Dn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Dt&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(zn||(zn={}));var sc,hs=function(e){switch(e){case zn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case zn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},Kx=function(){return["channelUrl","-createdAt","-notificationId"]},Qx=M(M({},sS),{scheduledAt:void 0}),Yx=function(e){return aS(e)&&k("number",e.scheduledAt,!0)},Zx=M(M({},a0),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),Xx=function(e){return l0(e)&&k("number",e.scheduledAt)&&(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},yS="UnsentMessage",Jx="reqId",Hd={},Ia=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new Jv("unsendmessagecache.lock"),Hd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Hd[t]&&!r||(Hd[t]=new n(t)),Hd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(yS);if(!r)throw L.databaseError;return r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){if(t.messageId>0)throw L.invalidParameters;var r,i=M({},t.serialize());return t instanceof Jn?(t.messageParams&&(i.messageParams=B1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},B1(r)),{scheduledAt:r.scheduledAt})))):t instanceof Zt?(t.messageParams&&(i.messageParams=$1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},$1(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof ai&&t.messageParams&&(i.messageParams=function(s){return Ee({fileInfoList:s.fileInfoList,isReplyToChannel:s.isReplyToChannel,pushNotificationDeliveryOption:s.pushNotificationDeliveryOption})}(t.messageParams)),i},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype._deserializeWithMessageCreateParams=function(t){var r,i,s;return y(this,void 0,void 0,function(){var o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return o=An.of(this._iid),a=this._deserialize(t),t.messageParams?a instanceof Jn?(u=t.messageParams,a.messageParams=o.buildUserMessageCreateParamsFromSerializedData(u,a),[3,6]):[3,1]:[3,6];case 1:return a instanceof Zt?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&bp((r=u.fileType)!==null&&r!==void 0?r:"")?(l=u,[4,this.collection.getBlob(u.fileKey)]):[3,3]:[3,4];case 2:l.file=(i=f.sent())!==null&&i!==void 0?i:void 0,f.label=3;case 3:return a.messageParams=o.buildFileMessageCreateParamsFromSerializedData(u,a),[3,6];case 4:return a instanceof ai&&(u=t.messageParams)&&u.fileInfoList?(a.messageParams=o.buildMultipleFilesMessageCreateParamsFromSerializedData(u,a),[4,Promise.all(a.messageParams.fileInfoList.map(function(p){return y(h,void 0,void 0,function(){var m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&bp((_=(v=p._uploadedMetaData)===null||v===void 0?void 0:v.fileType)!==null&&_!==void 0?_:"")?(m=p,[4,this.collection.getBlob(p._uploadedMetaData.fileKey)]):[3,2];case 1:m.file=(E=S.sent())!==null&&E!==void 0?E:void 0,S.label=2;case 2:return[2]}})})}))]):[3,6];case 5:f.sent(),f.label=6;case 6:return a.scheduledInfo&&t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams?a instanceof Jn?(c=t.scheduledInfo.scheduledMessageParams,a.scheduledInfo.scheduledMessageParams=o.buildScheduledUserMessageCreateParamsFromSerializedData(c,a),[3,10]):[3,7]:[3,10];case 7:return a instanceof Zt?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&bp(c.fileType)?(d=c,[4,this.collection.getBlob(c.fileKey)]):[3,9]:[3,10];case 8:d.file=(s=f.sent())!==null&&s!==void 0?s:void 0,f.label=9;case 9:a.scheduledInfo.scheduledMessageParams=o.buildScheduledFileMessageCreateParamsFromSerializedData(c,a),f.label=10;case 10:return[2,a]}})})},n.prototype._getFileInfoBlobKey=function(t,r){return"".concat(t,".").concat(r)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserializeWithMessageCreateParams(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.filter,s=i===void 0?new vs:i,o=t.order,a=o===void 0?zn.CHANNEL_LATEST:o,l=t.sendingStatus,u=t.backward,c=u!==void 0&&u,d=t.parentMessageId;return y(this,void 0,void 0,function(){var h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(h=hs(a),f={"/where":function(_){return!!(a!==zn.NEWEST_CHILD_MESSAGE||d&&_.parentMessageId!==0&&_.parentMessageId===d)&&s.match(b._deserialize(_))}},r&&(f.channelUrl=r),l&&(f.sendingStatus=l),p={where:f,index:h,backward:c},[4,this.collection.query(p)]):[3,3];case 1:return[4,v.sent().fetch({})];case 2:return m=v.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return g(this,function(E){switch(E.label){case 0:return[4,this._deserializeWithMessageCreateParams(_)];case 1:return[2,E.sent()]}})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new vs),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:zn.NEWEST_CHILD_MESSAGE,channelUrl:t.channelUrl,backward:!1,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o;return g(this,function(a){switch(a.label){case 0:return s instanceof Zt||s instanceof ai?[4,this._mutex.lock()]:[3,4];case 1:return a.sent(),[4,this.saveBlob(s)];case 2:return a.sent(),[4,this._mutex.unlock()];case 3:a.sent(),a.label=4;case 4:return o=this._serialize(s),[4,this.collection.upsertOne(o)];case 5:return a.sent(),[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o;return g(this,function(a){switch(a.label){case 0:return o=[],s.threadInfo&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:o=a.sent(),a.label=2;case 2:return o.length>0?(o.forEach(function(l){return l.applyParentMessage(s)}),[4,this.upsert(o)]):[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t}})]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.saveBlob=function(t){return y(this,void 0,void 0,function(){var r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:return t instanceof Zt?t.messageParams&&(s=t.messageParams).file&&dh(s.file)?[4,this.collection.saveBlob(s.file,t.reqId)]:[3,2]:[3,5];case 1:i=a.sent(),s.fileKey=i,s.fileType=_a.BLOB,a.label=2;case 2:return t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(r=t.scheduledInfo.scheduledMessageParams).file&&dh(r.file)?[4,this.collection.saveBlob(r.file,t.reqId)]:[3,4];case 3:i=a.sent(),r.fileKey=i,r.fileType=_a.BLOB,a.label=4;case 4:return[3,7];case 5:return t instanceof ai&&(s=t.messageParams)&&s.fileInfoList&&Array.isArray(s.fileInfoList)?[4,Promise.all(s.fileInfoList.map(function(l,u){return y(o,void 0,void 0,function(){var c;return g(this,function(d){switch(d.label){case 0:return l.file&&dh(l.file)?[4,this.collection.saveBlob(l.file,this._getFileInfoBlobKey(t.reqId,u))]:[3,2];case 1:c=d.sent(),l._uploadedMetaData||(l._uploadedMetaData={}),l._uploadedMetaData.fileKey=c,l._uploadedMetaData.fileType=_a.BLOB,d.label=2;case 2:return[2]}})})}))]:[3,7];case 6:a.sent(),a.label=7;case 7:return[2]}})})},n}(Wn),jd={},Cl=function(e){function n(t){var r=e.call(this,t)||this;return jd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return O.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Ia.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),jd[t]&&!r||(jd[t]=new n(t)),jd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(um)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M(M({},t.serialize()),{messageId:"".concat(t.messageId)})},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,o=s===void 0?100:s,a=t.filter,l=a===void 0?new vs:a,u=t.order,c=u===void 0?zn.CHANNEL_LATEST:u,d=t.backward,h=d!==void 0&&d,f=t.parentMessageId,p=t.isPollOnly,m=p!==void 0&&p,b=t.exactMatch,v=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,w,N,I=this;return g(this,function(R){switch(R.label){case 0:return this.localCacheEnabled?(S=hs(c),w={where:{channelUrl:r,"/where":function(A){if(i)switch(c){case zn.CHANNEL_LATEST:if(v&&A.createdAt!==i)return!1;if(h){if(E&&A.createdAti||!E&&A.createdAt>=i)return!1;break;case zn.NEWEST_CHILD_MESSAGE:if(!f||A.parentMessageId===0||A.parentMessageId!==f)return!1}return!(m&&!A._poll)&&l.match(I._deserialize(A))}},index:S,backward:h},[4,this.collection.query(w)]):[3,3];case 1:return[4,R.sent().fetch({limit:o??void 0})];case 2:return N=R.sent(),[2,Promise.all(N.map(function(A){return y(I,void 0,void 0,function(){return g(this,function(x){return[2,this._deserialize(A)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new vs),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({channelUrl:t.channelUrl,token:Date.now(),limit:null,backward:!1,filter:r,order:zn.NEWEST_CHILD_MESSAGE,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){var r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return this.localCacheEnabled?[4,this.saveBlobs(t)]:[3,13];case 1:f.sent(),f.label=2;case 2:f.trys.push([2,7,8,9]),i=ve(t),s=i.next(),f.label=3;case 3:return s.done?[3,6]:(o=s.value,!((r=o.threadInfo)===null||r===void 0)&&r._isUpdateRequired?[4,this.get(o.messageId)]:[3,5]);case 4:(a=f.sent())!=null&&a.threadInfo&&o.threadInfo._updateFrom(a.threadInfo),f.label=5;case 5:return s=i.next(),[3,3];case 6:return[3,9];case 7:return l=f.sent(),c={error:l},[3,9];case 8:try{s&&!s.done&&(d=i.return)&&d.call(i)}finally{if(c)throw c.error}return[7];case 9:return u=t.map(function(p){return h._serialize(p)}),[4,this.collection.upsertMany(u)];case 10:return f.sent(),[4,this.upsertChildMessages(t)];case 11:return f.sent(),[4,this._unsentMessageCache.upsertChildMessages(t)];case 12:f.sent(),f.label=13;case 13:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o,a;return g(this,function(l){switch(l.label){case 0:return o=[],!((a=s.threadInfo)===null||a===void 0)&&a.replyCount&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:o=l.sent(),l.label=2;case 2:return o.length>0?(o.forEach(function(u){return u.applyParentMessage(s)}),[4,this.upsert(o)]):[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove("".concat(s))]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:hs(zn.CHANNEL_LATEST)})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:hs(zn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,o=this;return g(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=hs(zn.CHANNEL_LATEST),[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=o._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,a.sent()];case 2:return[2,0]}})})},n.prototype.saveBlobs=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o,a;return g(this,function(l){switch(l.label){case 0:return s instanceof Zt&&s.messageParams&&(o=s.messageParams).file&&dh(o.file)?[4,this.collection.saveBlob(o.file,s.reqId)]:[3,2];case 1:a=l.sent(),o.fileKey=a,l.label=2;case 2:return[2]}})})}))];case 1:return i.sent(),[2]}})})},n.prototype._getGroupChannelPreferenceSize=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=0,[4,(i=this._cacheContext.preference).get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 1:return s=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 2:return o=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 3:return a=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 4:return l=u.sent(),s&&(r+=JSON.stringify(s).length),o&&(r+=JSON.stringify(o).length),a&&(r+=JSON.stringify(a).length),l&&(r+=JSON.stringify(l).length),[2,r]}})})},n}(Wn),Bd={},eO=function(e){function n(t){var r=e.call(this,t)||this;return Bd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return O.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Bd[t]&&!r||(Bd[t]=new n(t)),Bd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(vS)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M({},t.serialize())},n.prototype._deserialize=function(t){return An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey(t)]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,o=s===void 0?100:s,a=t.filter,l=a===void 0?new vs:a,u=t.backward,c=u!==void 0&&u,d=t.exactMatch,h=d!==void 0&&d,f=t.inclusive,p=f===void 0||f;return y(this,void 0,void 0,function(){var m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(m={where:{channelUrl:r,"/where":function(_){if(i){if(h&&_.createdAt!==i)return!1;if(c){if(p&&_.createdAti||!p&&_.createdAt>=i)return!1}return l.match(b._deserialize(_))}},index:["channelUrl","-createdAt","-notificationId"],backward:c},[4,this.collection.query(m)]):[3,3];case 1:return[4,v.sent().fetch({limit:o??void 0})];case 2:return[2,v.sent().map(function(_){return b._deserialize(_)})];case 3:return[2,[]]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return this.localCacheEnabled?(r=t.map(function(o){return i._serialize(o)}),[4,this.collection.upsertMany(r)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.markAsReadByTimestamp=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,messageStatus:oa.SENT,createdAt:{"<":r}}},{set:{messageStatus:oa.READ}})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.markAsReadByMessageIds=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,notificationId:{"/in":r},messageStatus:oa.SENT}},{set:{messageStatus:oa.READ}})]:[3,2];case 1:return[2,i.sent().length];case 2:return[2,0]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:["channelUrl","-createdAt","-notificationId"]})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:hs(zn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,o=this;return g(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=["channelUrl","-createdAt","-notificationId"],[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=o._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,a.sent()];case 2:return[2,0]}})})},n}(Wn),uu={},ES=function(e){function n(t){var r=e.call(this,t)||this;return r._observers=new Map,r._dispatcherContext=r._dispatcher.on(function(i){return y(r,void 0,void 0,function(){var s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R=this;return g(this,function(A){switch(A.label){case 0:return i instanceof Et?(s=i.messages,I=i.source,c=i.isWebSocketEventComing,o=s.filter(function(x){return x instanceof dr&&x.channelType!==Ze.OPEN&&x.messageId>0}),a=s.filter(function(x){return x instanceof dr&&x.channelType!==Ze.OPEN&&x.messageId===0}),l=s.filter(function(x){return x instanceof wa}),o.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(o)];case 1:return x.sent(),[4,this._unsentMessageCache.remove(o.map(function(U){return U instanceof Dt?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return x.sent(),[2]}})})})]:[3,2]):[3,7];case 1:A.sent(),c||this._broadcastUpdateEvent(o,I),A.label=2;case 2:return a.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.upsert(a)];case 1:return x.sent(),[2]}})})})]:[3,4];case 3:A.sent(),c||this._broadcastUpdateEvent(a,I),A.label=4;case 4:return l.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return x.sent(),[2]}})})})]:[3,6];case 5:A.sent(),c||this._broadcastUpdateEvent(l,I),A.label=6;case 6:return[3,24];case 7:return i instanceof Kv?(u=i.messageIds,I=i.source,c=i.isWebSocketEventComing,d=u.filter(function(x){return typeof x=="number"}),h=u.filter(function(x){return typeof x=="string"}),[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return d.length>0?[4,this._messageCache.remove(d)]:[3,2];case 1:x.sent(),x.label=2;case 2:return h.length>0?[4,this._notificationCache.remove(h)]:[3,4];case 3:x.sent(),x.label=4;case 4:return[2]}})})})]):[3,9];case 8:return A.sent(),c||this._broadcastRemoveEvent(u,I),[3,24];case 9:return i instanceof $C?(f=i.reqId,I=i.source,[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.remove([f])];case 1:return x.sent(),[2]}})})})]):[3,11];case 10:return A.sent(),this._broadcastRemoveUnsentEvent(f,I),[3,24];case 11:return i instanceof GC?(p=i.polls,I=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(x){return x.messageId}),[4,Promise.all(m.map(function(x){return R._messageCache.get(x)}))]):[3,14]):[3,15];case 12:return(b=A.sent().filter(function(x){return x})).length>0&&p.forEach(function(x){var U=b.find(function(q){return q.messageId===x.messageId});U&&U.applyPoll(x)}),[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,x.sent()]}})})})];case 13:A.sent(),A.label=14;case 14:return this._broadcastPollChangeLogEvent(p,I),[3,24];case 15:return i instanceof zC?(v=i.event,I=i.source,[4,this._messageCache.get(v.messageId)]):[3,19];case 16:return(_=A.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(v)?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,x.sent()]}})})})]:[3,18];case 17:A.sent(),A.label=18;case 18:return this._broadcastPollUpdateEvent(v,I),[3,24];case 19:return i instanceof Qv?(E=i.event,I=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=A.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,x.sent()]}})})})]:[3,22];case 21:A.sent(),A.label=22;case 22:return this._broadcastPollVoteEvent(E,I),[3,24];case 23:i instanceof jC?(w=i.event,I=i.source,w.messageId>0&&this._broadcastReactionUpdateEvent(w,I)):i instanceof BC&&(N=i.event,I=i.source,this._broadcastThreadUpdateEvent(N,I)),A.label=24;case 24:return[2]}})})}),r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_dispatcher",{get:function(){return O.of(this._iid).dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_messageCache",{get:function(){return Cl.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Ia.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return eO.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){var i;return r===void 0&&(r=!1),uu[t]&&!r||(uu[t]&&((i=uu[t]._dispatcherContext)===null||i===void 0||i.close()),uu[t]=new n(t)),uu[t]},n.prototype._broadcastUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onUpdate&&l.onUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollChangeLogEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollChangeLogUpdate&&l.onPollChangeLogUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollUpdate&&l.onPollUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollVoteEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollVote&&l.onPollVote(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onRemove&&l.onRemove(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveUnsentEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onRemoveUnsent&&l.onRemoveUnsent(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastReactionUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onReactionUpdate&&l.onReactionUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastThreadUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onThreadInfoUpdate&&l.onThreadInfoUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype.subscribe=function(t,r){this._observers.set(t,r)},n.prototype.unsubscribe=function(t){this._observers.delete(t)},n.prototype.unsubscribeAll=function(){this._observers.clear()},n}(Wn),tO=function(e){function n(t){var r=this,i=t.reverse,s=i!==void 0&&i,o=t.limit,a=o===void 0?20:o,l=t.keys,u=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(aC),r.params=Ee({token:u,limit:a,reverse:s,order:W_.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return T(n,e),n}(Y),nO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.next,o=r.has_more,a=o!==void 0&&o,l=r.templates;return i.nextToken=s,i.hasMore=a,i.templates=l.map(function(u){return{template:JSON.stringify(u)}}),i}return T(n,e),n}(ae),rO=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(aC,"/").concat(i),r}return T(n,e),n}(Y),iO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.template=JSON.stringify(r),i}return T(n,e),n}(ae),ly={},An=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=t.onlineDetector,a=t.cacheContext;this._iid=n,this._sdkState=r,this._requestQueue=s,this._dispatcher=i,this._cacheContext=a,Cl.of(n),Ia.of(n),ES.of(n),this.fileMessageQueue=new eM(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:o,cacheContext:a}),ly[n]=this}return e.of=function(n){return ly[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=fa(n);if(t.notificationId)return new wa(this._iid,wa.payloadify(t));switch(t.messageType){case bt.USER:return new Jn(this._iid,Jn.payloadify(t));case bt.FILE:return ai._isMultipleFilesMessageSerializedData(t)?new ai(this._iid,ai.payloadify(t)):new Zt(this._iid,Zt.payloadify(t));case bt.ADMIN:return new Bl(this._iid,Bl.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return Ee(Ne({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,message:t.message,translationTargetLanguages:Object.keys(t.translations),pollId:n.pollId}))},e.prototype.buildFileMessageCreateParamsFromSerializedData=function(n,t){var r;return Ee(Ne({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,file:n.file,fileKey:n.fileKey,fileUrl:t.plainUrl,fileName:t.name,fileSize:t.size,mimeType:t.type,thumbnailSizes:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{maxWidth:i.width,maxHeight:i.height}}),fileType:n.fileType,requireAuth:t.requireAuth}))},e.prototype.buildMultipleFilesMessageCreateParamsFromSerializedData=function(n,t){var r=this;return Ee({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,fileInfoList:n.fileInfoList.map(function(i){return new lf(r._iid,i)})})},e.prototype.buildScheduledUserMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildUserMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildScheduledFileMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildFileMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildSenderFromSerializedData=function(n){var t=fa(n);return new jl(this._iid,jl.payloadify(t))},e.prototype.getMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new tM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(nM).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new sM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(oM).message]}})})},e.prototype.getMessagesByMessageId=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var o,a,l;return g(this,function(u){switch(u.label){case 0:return o=new Rd(M(M({channelType:t,channelUrl:n,token:String(r)},nc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Ld).messages,this._dispatcher.dispatch(new Et({messages:l,source:s})),[2,l]}})})},e.prototype.getMessagesByTimestamp=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var o,a,l;return g(this,function(u){switch(u.label){case 0:return o=new Rd(M(M({channelType:t,channelUrl:n,timestamp:r},nc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Ld).messages,this._dispatcher.dispatch(new Et({messages:l,source:s})),[2,l]}})})},e.prototype._getMessagesByTimestampForCollection=function(n,t,r,i,s,o,a){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return l=new Rd(M(M(M({channelType:t,channelUrl:n,timestamp:r},nc),i),{checkingHasNext:o,checkingContinuousMessages:a})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as(Ld),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new Et({messages:d,source:s})),[2,{messages:d,isContinuousMessages:h,hasNext:f}]}})})},e.prototype.getThreadedMessagesByTimestamp=function(n,t,r,i){return i===void 0&&(i=G.REQUEST_THREADED_MESSAGE),y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return s=new Rd(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},Qc),r),{replyType:Dn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return o=u.sent(),a=o.as(Ld).messages,(l=a.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new Et({messages:l,source:i})),[2,{parentMessage:a[0],threadedMessages:l}]}})})},e.prototype.getMessageTemplatesByToken=function(n,t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=new tO(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(nO),o=s.hasMore,a=s.nextToken,l=s.templates,[2,{hasMore:o,token:a,templates:l}]}})})},e.prototype.getMessageTemplate=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new rO({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(iO).template}]}})})},e.prototype.getMessageChangelogs=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE_CHANGELOGS),y(this,void 0,void 0,function(){var o,a,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return o=new rM(Ee(Ne(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},im),i)))),[4,this._requestQueue.send(o)];case 1:return a=p.sent(),l=a.as(iM),u=l.updatedMessages,c=l.deletedMessagesInfo,d=l.hasMore,h=l.nextToken,f=c.map(function(m){return m.messageId}),u.length>0&&this._dispatcher.dispatch(new Et({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new Kv({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),bS=function(e){function n(t,r){var i=e.call(this,t)||this;i.targetMessageId=0;var s=r.thread_info,o=r.parent_message_id,a=r.channel_url,l=r.channel_type;return s&&k("object",s)&&k("number",o)&&k("string",a)&&k("string",l)&&(i.threadInfo=new af(t,s),i.targetMessageId=o,i.channelUrl=a,i.channelType=l),i}return T(n,e),n}(Wn),sO={channelUrl:"",channelType:Ze.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},oO=function(e){function n(t){var r=t.channelCustomType,i=t.keyword,s=t.limit,o=t.reverse,a=t.exactMatch,l=t.channelUrl,u=t.order,c=t.messageTimestampFrom,d=t.messageTimestampTo,h=t.advancedQuery,f=t.targetFields,p=t.nextToken,m=e.call(this)||this;return m.method=Q.GET,m.path="".concat(V4,"/messages"),m.params={custom_type:r,query:i,limit:s,reverse:o,exact_match:a,channel_url:l,message_ts_from:c,message_ts_to:d,sort_field:u,advanced_query:h,target_fields:f,after:p},m}return T(n,e),n}(Y),aO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return vr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return T(n,e),n}(ae);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(sc||(sc={}));var lO=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f=this;return(f=e.call(this,t,r)||this).keyword="",f.reverse=!1,f.exactMatch=!1,f.channelUrl="",f.channelCustomType="",f.messageTimestampFrom=null,f.messageTimestampTo=null,f.order=sc.SCORE,f.advancedQuery=!1,f.targetFields=null,f._nextToken="",f.totalCount=-1,f.keyword=r.keyword,f.reverse=(i=r.reverse)!==null&&i!==void 0&&i,f.exactMatch=(s=r.exactMatch)!==null&&s!==void 0&&s,f.channelUrl=(o=r.channelUrl)!==null&&o!==void 0?o:"",f.channelCustomType=(a=r.channelCustomType)!==null&&a!==void 0?a:"",f.messageTimestampFrom=(l=r.messageTimestampFrom)!==null&&l!==void 0?l:null,f.messageTimestampTo=(u=r.messageTimestampTo)!==null&&u!==void 0?u:null,f.order=(c=r.order)!==null&&c!==void 0?c:sc.SCORE,f.advancedQuery=(d=r.advancedQuery)!==null&&d!==void 0&&d,f.targetFields=(h=r.targetFields)!==null&&h!==void 0?h:null,f}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.keyword)&&this.keyword.length>0&&k("boolean",this.reverse)&&k("boolean",this.exactMatch)&&k("string",this.channelUrl)&&k("string",this.channelCustomType)&&(k("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(k("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&Ge(sc,this.order)&&k("boolean",this.advancedQuery)&&We("string",this.targetFields,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new oO(Ne(M(M({},this),{nextToken:this._nextToken?this._nextToken:null}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=c.sent(),s=i.as(aO),o=s.messages,a=s.hasNext,l=s.nextToken,u=s.totalCount,this._nextToken=l,this._hasNext=a,this._isLoading=!1,this.totalCount=u,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),uO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.limit,o=t.token,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),a.params=Ee(Ne({limit:s,token:o})),a}return T(n,e),n}(Y),cO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.next,i.messages=r.messages.map(function(s){return vr(t,s)}),i}return T(n,e),n}(ae),dO=function(e){function n(t,r,i,s){var o=e.call(this,t,r,i,s)||this;return o._edge="",o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new uO({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(cO),o=s.messages,a=s.token,this._edge=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),hO={channelUrl:"",scheduledMessageId:0},fO={reverse:!1,limit:20},pO=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="message",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new An(t,{sdkState:i,dispatcher:s,requestQueue:a,onlineDetector:u,cacheContext:c})},n.prototype.buildMessageFromSerializedData=function(t){return this._manager.buildMessageFromSerializedData(t)},n.prototype.buildSenderFromSerializedData=function(t){return this._manager.buildSenderFromSerializedData(t)},n.prototype.getMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=M(M({},sO),t),K(function(o){return k("string",o.channelUrl)&&Ge(Ze,o.channelType)&&k("number",o.messageId)&&k("boolean",o.includeReactions,!0)&&k("boolean",o.includeMetaArray,!0)&&k("boolean",o.includeParentMessageInfo,!0)&&k("boolean",o.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof dr||i instanceof wa||i===null)return[2,i];throw"Unknown message type is given."}})})},n.prototype.getScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},hO),t),K(function(s){return k("string",s.channelUrl)&&s.channelUrl!==""&&k("number",s.scheduledMessageId)&&s.scheduledMessageId>0}(r)).throw(L.invalidParameters),[2,this._manager.getScheduledMessage(r)]})})},n.prototype.getMessageTemplatesByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){return i=M(M({},fO),r),K(k("string",t,!0)&&function(o){return k("boolean",o.reverse,!0)&&k("number",o.limit,!0)&&We("string",o.keys,!0)}(i)).throw(L.invalidParameters),[2,this._manager.getMessageTemplatesByToken(t,i)]})})},n.prototype.getMessageTemplate=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(Wv),Pt,oc,fm;(function(e){e.LATEST_LAST_MESSAGE="latest_last_message",e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"})(Pt||(Pt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(oc||(oc={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(fm||(fm={}));var Pc,ph=function(e){switch(e){case Pt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case Pt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case Pt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},CS=function(e){function n(t){var r=t.message,i=e.call(this)||this;return i.message=r,i}return T(n,e),n}(Tt),uy={},Mu=function(){function e(n,t){var r=t.localCacheEnabled,i=t.enableAutoResend,s=t.dispatcher,o=t.sdkState,a=t.logger,l=this;this._iid=n,uy[n]=this,this._localCacheEnabled=r,this._enableAutoResend=i,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=s,this._logger=a,this._sdkState=o,this._localCacheEnabled&&s.on(function(u){if(u instanceof _i)switch(u.stateType){case st.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case st.INTERNAL_DISCONNECTED:case st.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return uy[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=a.sent();try{for(t=ve(n),r=t.next();!r.done;r=t.next())(i=r.value).errorCode===0&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",i.reqId),i.sendingStatus=ut.FAILED,i.errorCode=Ie.ACK_TIMEOUT,this._dispatcher.dispatch(new Et({messages:[i],source:G.LOCAL_MESSAGE_FAILED})))}catch(l){s={error:l}}finally{try{r&&!r.done&&(o=t.return)&&o.call(t)}finally{if(s)throw s.error}}return[2]}})})},e.prototype.processAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=ve(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&Kh(i.errorCode)&&(s=new Date().getTime(),o=i.createdAt+2592e5,this._enableAutoResend&&s<=o?this._autoResendQueue.map(function(c){return c.reqId}).indexOf(i.reqId)<0&&this._autoResendQueue.push(i):(this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(o).toLocaleString()),i.sendingStatus=ut.FAILED,this._dispatcher.dispatch(new Et({messages:[i],source:G.LOCAL_MESSAGE_FAILED}))))}catch(c){a={error:c}}finally{try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}}return[2]}})})},e.prototype.completeCurrentAndProcessNextAutoResend=function(n){if(this._localCacheEnabled&&this._enableAutoResend&&(n.sendingStatus===ut.SUCCEEDED||n.sendingStatus===ut.FAILED&&!Kh(n.errorCode))){var t=this.indexOf(n);t>=0&&this._autoResendQueue.splice(t,1),t===0&&this._processNextAutoResend()}},e.prototype._fetchAllCachedPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Ia.of(this._iid),(t=new vs).replyType=Dn.ALL,[4,n.fetch({sendingStatus:ut.PENDING,backward:!0,filter:t})];case 1:return[2,r.sent()]}})})},e.prototype.indexOf=function(n){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId):-1},e.prototype._isNotInQueue=function(n){return this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId)===-1},e.prototype._processNextAutoResend=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){if(this._localCacheEnabled&&this._enableAutoResend&&this._sdkState.appState==="foreground")try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),n=this._autoResendQueue[0],this._dispatcher.dispatch(new CS({message:n})),this._logger.debug("processing auto-resend for message request id: ",n.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(r){this._logger.warn("process auto-resend error: ",r),this._isProcessingAutoResend=!1}return[2]})})},e}();(function(e){e[e.USER_BLOCK=20001]="USER_BLOCK",e[e.USER_UNBLOCK=2e4]="USER_UNBLOCK",e[e.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED"})(Pc||(Pc={}));var cf=function(){function e(n){this.category=n.cat,this.data=n.data}return e.getDataAsUserBlockEvent=function(n,t){var r=t.data,i=r.blocker,s=r.blockee;return{blocker:new Ke(n,i),blockee:new Ke(n,s)}},e.getDataAsFriendDiscoveredEvent=function(n,t){var r=t.data.friend_discoveries;return{friendDiscoveries:Array.isArray(r)?r.map(function(i){return new Ke(n,i)}):[]}},e}(),SS=function(e){function n(t,r){var i=r.userId,s=e.call(this)||this;return s._iid=t,s.userId=i,s}return T(n,e),n}(Tt),TS=function(e){function n(){return e.call(this)||this}return T(n,e),n}(Tt),wS=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new cf(i),s}return T(n,e),n}(mt),_O=function(e,n){this.pollId=0,this.messageId=0,this.pollId=n.poll.id,this.messageId=n.poll.message_id,this._iid=e,this._payload=n},Yt;(function(e){e[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED"})(Yt||(Yt={}));var mO=function(){function e(n){var t;this.channelUrl=n.channel_url,this.channelType=n.channel_type,this.category=n.cat,this.data=(t=n.data)!==null&&t!==void 0?t:{},this.ts=n.ts}return Object.defineProperty(e.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===Ze.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===Ze.OPEN},enumerable:!1,configurable:!0}),e}(),Kl=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.event=new mO(i),s}return T(n,e),n}(mt),vO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data.operators,a=o===void 0?[]:o;return s.operators=a.map(function(l){return new Ke(s._iid,l)}),s}return T(n,e),n}(Kl),gO=function(e){function n(t,r){var i=e.call(this,t)||this;return i._logger=r.logger,i._sdkState=r.sdkState,i._sessionManager=r.sessionManager,i._requestQueue=r.requestQueue,i._dispatcher=r.dispatcher,i._cacheContext=r.cacheContext,i._channelType=r.channelType,i}return T(n,e),Object.defineProperty(n.prototype,"_messageBroadcast",{get:function(){return ES.of(this._iid)},enumerable:!1,configurable:!0}),n.prototype.subscribeMessageEvent=function(t,r){this._messageBroadcast.subscribe(t,r)},n.prototype.unsubscribeMessageEvent=function(t){this._messageBroadcast.unsubscribe(t)},n.prototype.getMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return y(this,void 0,void 0,function(){return g(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},n}(Wn),yO=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"ADMM",i)||this).message=new Bl(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),EO=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"AEDI",i)||this).message=new Bl(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),bO=function(e){function n(t,r,i){var s=e.call(this,t,"MRCT",i)||this;return s.channelUrl=i.channel_url,s.channelType=i.channel_type,s.event=new Yv(i),s}return T(n,e),n}(mt),CO=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new bS(t,i),s}return T(n,e),n}(mt),SO=function(e){function n(t,r,i){var s=e.call(this,t,"MCNT",i)||this;return s.groupChannelMemberCounts=i.group_channels.map(function(o){return{channelUrl:o.channel_url,memberCount:o.member_count,joinedMemberCount:o.joined_member_count,updatedAt:o.ts}}),s.openChannelMemberCounts=i.open_channels.map(function(o){return{channelUrl:o.channel_url,participantCount:o.participant_count,updatedAt:o.ts}}),s}return T(n,e),n}(mt),TO=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new _O(t,i),s.status=tm(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(mt),Bt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(Bt||(Bt={}));var ms,Rr,Ur,No,zi,df,Us,Fc,ii=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.state=null,i.role=null,i.isMuted=!1,i.isBlockedByMe=!1,i.isBlockingMe=!1,i.state=Ge(Bt,r.state)?r.state:null,i.role=Ge(Ii,r.role)?r.role:null,typeof r.is_muted=="boolean"&&(i.isMuted=r.is_muted),typeof r.is_blocked_by_me=="boolean"&&(i.isBlockedByMe=r.is_blocked_by_me),typeof r.is_blocking_me=="boolean"&&(i.isBlockingMe=r.is_blocking_me),i}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{state:t.state,role:t.role,is_muted:t.isMuted,is_blocked_by_me:t.isBlockedByMe,is_blocking_me:t.isBlockingMe})))},n}(Ua),wO=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",o.channelType=(s=r.channel_type)!==null&&s!==void 0?s:Ze.GROUP,o.member=new Ke(o._iid,r.user),o.deliveryAt=r.ts,o}return T(n,e),n}(Wn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(ms||(ms={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(Rr||(Rr={})),function(e){e.ALL="all",e.SUPER="super",e.NON_SUPER="nonsuper",e.BROADCAST_ONLY="broadcast_only",e.EXCLUSIVE_ONLY="exclusive_only"}(Ur||(Ur={})),function(e){e.ALL="all",e.UNREAD_MESSAGE="unread_message"}(No||(No={})),function(e){e.ALL="all",e.UNHIDDEN="unhidden_only",e.HIDDEN="hidden_only",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(zi||(zi={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(df||(df={})),function(e){e.AND="AND",e.OR="OR"}(Us||(Us={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(Fc||(Fc={}));var Tn,NS=function(){function e(n){var t,r,i,s,o,a,l,u,c,d,h,f,p,m;this._searchFilter=null,this._userIdsFilter=null,this.includeEmpty=(t=n==null?void 0:n.includeEmpty)!==null&&t!==void 0&&t,this.nicknameContainsFilter=(r=n==null?void 0:n.nicknameContainsFilter)!==null&&r!==void 0?r:null,this.nicknameStartsWithFilter=(i=n==null?void 0:n.nicknameStartsWithFilter)!==null&&i!==void 0?i:null,this.nicknameExactMatchFilter=(s=n==null?void 0:n.nicknameExactMatchFilter)!==null&&s!==void 0?s:null,this.channelNameContainsFilter=(o=n==null?void 0:n.channelNameContainsFilter)!==null&&o!==void 0?o:"",this.myMemberStateFilter=(a=n==null?void 0:n.myMemberStateFilter)!==null&&a!==void 0?a:Rr.ALL,this.customTypesFilter=(l=n==null?void 0:n.customTypesFilter)!==null&&l!==void 0?l:null,this.channelUrlsFilter=(u=n==null?void 0:n.channelUrlsFilter)!==null&&u!==void 0?u:null,this.superChannelFilter=(c=n==null?void 0:n.superChannelFilter)!==null&&c!==void 0?c:Ur.ALL,this.publicChannelFilter=(d=n==null?void 0:n.publicChannelFilter)!==null&&d!==void 0?d:ms.ALL,this.customTypeStartsWithFilter=(h=n==null?void 0:n.customTypeStartsWithFilter)!==null&&h!==void 0?h:null,this.unreadChannelFilter=(f=n==null?void 0:n.unreadChannelFilter)!==null&&f!==void 0?f:No.ALL,this.hiddenChannelFilter=(p=n==null?void 0:n.hiddenChannelFilter)!==null&&p!==void 0?p:zi.UNHIDDEN,this.includeFrozen=(m=n==null?void 0:n.includeFrozen)===null||m===void 0||m,n!=null&&n.createdAfter&&(this.createdAfter=n.createdAfter),n!=null&&n.createdBefore&&(this.createdBefore=n.createdBefore)}return e.prototype._isFriend=function(n){return!(!n||!n.friendDiscoveryKey&&!n.friendName)},Object.defineProperty(e.prototype,"searchFilter",{get:function(){return this._searchFilter},enumerable:!1,configurable:!0}),e.prototype.setSearchFilter=function(n,t){Array.isArray(n)&&n.length!==0&&typeof t=="string"&&t&&(this._searchFilter={query:t,fields:n})},Object.defineProperty(e.prototype,"userIdsFilter",{get:function(){return this._userIdsFilter},enumerable:!1,configurable:!0}),e.prototype.setUserIdsFilter=function(n,t,r){r===void 0&&(r=Us.AND),this._userIdsFilter={userIds:n,includeMode:t,queryType:r}},e.prototype.clone=function(){var n,t=new e;this.searchFilter&&t.setSearchFilter(this.searchFilter.fields,(n=this.searchFilter.query)!==null&&n!==void 0?n:void 0),this.userIdsFilter&&t.setUserIdsFilter(this.userIdsFilter.userIds,this.userIdsFilter.includeMode,this.userIdsFilter.queryType);var r=JSON.parse(JSON.stringify(this));return Object.keys(r).forEach(function(i){t[i]=r[i]}),t},e.prototype.match=function(n,t){if(this._searchFilter){var r=this._searchFilter,i=r.query,s=r.fields;if(i&&s&&s.length>0&&!s.some(function(p){switch(p){case Fc.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case Fc.MEMBER_NICKNAME:return n.members.some(function(m){return m.nickname.toLowerCase().includes(i.toLowerCase())});default:return!0}}))return!1}if(this._userIdsFilter){var o=this._userIdsFilter,a=o.userIds,l=o.includeMode,u=o.queryType,c=n.members.map(function(p){return p.userId});if(l){if(a.length>0)switch(u){case Us.AND:if(a.some(function(p){return!c.includes(p)}))return!1;break;case Us.OR:if(a.every(function(p){return!c.includes(p)}))return!1}}else if(a.includes(t)||a.push(t),n.members.length>a.length||!P4(a,c))return!1}if(!this.includeEmpty&&!n.lastMessage||!this.includeFrozen&&n.isFrozen||this.customTypesFilter&&this.customTypesFilter.length>0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.customTypeStartsWithFilter&&!new RegExp("^".concat(this.customTypeStartsWithFilter)).test(n.customType)||this.channelNameContainsFilter&&!n.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase()))return!1;if(this.nicknameContainsFilter){var d=this.nicknameContainsFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().includes(d)}))return!1}if(this.nicknameStartsWithFilter){var h=this.nicknameStartsWithFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().startsWith(h)}))return!1}if(this.nicknameExactMatchFilter){var f=this.nicknameExactMatchFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase()!=f}))return!1}if(this.channelUrlsFilter&&this.channelUrlsFilter.length>0&&!this.channelUrlsFilter.includes(n.url))return!1;if(this.myMemberStateFilter)switch(this.myMemberStateFilter){case Rr.ALL:if(n.myMemberState==="none")return!1;break;case Rr.JOINED:if(n.myMemberState!=="joined")return!1;break;case Rr.INVITED:if(n.myMemberState!=="invited")return!1;break;case Rr.INVITED_BY_FRIEND:if(n.myMemberState!=="invited"||!this._isFriend(n.inviter))return!1;break;case Rr.INVITED_BY_NON_FRIEND:if(n.myMemberState!=="invited"||this._isFriend(n.inviter))return!1}if(this.hiddenChannelFilter)switch(this.hiddenChannelFilter){case zi.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case zi.HIDDEN:if(!n.isHidden)return!1;break;case zi.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case zi.HIDDEN_PREVENT_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_prevent_auto_unhide")return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===No.UNREAD_MESSAGE&&n.unreadMessageCount===0)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case ms.PUBLIC:if(!n.isPublic)return!1;break;case ms.PRIVATE:if(n.isPublic)return!1}if(this.superChannelFilter)switch(this.superChannelFilter){case Ur.SUPER:if(!n.isSuper)return!1;break;case Ur.NON_SUPER:if(n.isSuper)return!1}return!(this.createdAfter&&n.createdAtthis.createdBefore)},e}(),NO=function(e){function n(t,r){var i=r.sdkState,s=r.cacheContext,o=e.call(this,t)||this;return o._channels=new Map,o._sdkState=i,o._cacheContext=s,o}return T(n,e),Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(_S)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t,r){return r===void 0&&(r=0),M(M({},t.serialize()),{lastMessageUpdatedAt:t.lastMessage?t.lastMessage.createdAt:0,syncIndex:r})},n.prototype._deserialize=function(t){return Nn.of(this._iid).buildGroupChannelFromSerializedData(t)},Object.defineProperty(n.prototype,"channels",{get:function(){return Pe([],Ae(this._channels.values()),!1)},enumerable:!1,configurable:!0}),n.prototype.isCachedInMemory=function(t){return this._channels.has(t)},n.prototype.filterOffsetChanged=function(t){var r=this;return t.filter(function(i){if(r._channels.has(i.url))return r._channels.get(i.url).messageOffsetTimestamp0||h&&h===E.url)return!1;break;case Pt.CHRONOLOGICAL:if(!a&&E.createdAt>r||a&&E.createdAtr||a&&E.lastMessageUpdatedAtu._messageCollectionLastAccessedAt&&Object.assign(u,{_messageCollectionLastAccessedAt:void 0}),u.cachedMetaData&&r&&(c._updateCachedMetaData(u.cachedMetaData,r),Object.assign(u,{_cachedMetaData:void 0})),c._update(u),i.push(c)}else a._channels.set(u.url,u),i.push(u)}),!this.localCacheEnabled)return[3,2];for(s=[],o=0;o0?[4,this.upsert(s)]:[3,2];case 1:R.sent(),R.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!0)];case 1:return i.sent(),[2]}})})},n.prototype.unblock=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!1)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(t,r){return r===void 0&&(r=Pe([],Ae(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=ve(r),o=s.next(),h.label=2;case 2:return o.done?[3,5]:(a=o.value,[4,this.get(a)]);case 3:(l=h.sent())!=null&&l._updateUnreadMemberState(this._sdkState.userId,t)&&(l._updateUnreadCount(0,0),i.push(l)),h.label=4;case 4:return o=s.next(),[3,2];case 5:return[3,8];case 6:return u=h.sent(),c={error:u},[3,8];case 7:try{o&&!o.done&&(d=s.return)&&d.call(s)}finally{if(c)throw c.error}return[7];case 8:return i.length>0?[4,this.upsert(i)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2]}})})},n}(Wn),_h={invitedUserIds:void 0,channelUrl:void 0,coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isSuper:void 0,isBroadcast:void 0,isExclusive:void 0,isPublic:void 0,isDiscoverable:void 0,isStrict:void 0,isEphemeral:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},pm=function(e){return We("string",e.invitedUserIds,!0)&&k("string",e.channelUrl,!0)&&k("string",e.coverUrl,!0)&&(fr(e.coverImage)||k("string",e.coverImage,!0))&&k("boolean",e.isDistinct,!0)&&k("boolean",e.isSuper,!0)&&k("boolean",e.isBroadcast,!0)&&k("boolean",e.isExclusive,!0)&&k("boolean",e.isPublic,!0)&&k("boolean",e.isStrict,!0)&&k("boolean",e.isDiscoverable,!0)&&k("boolean",e.isEphemeral,!0)&&k("string",e.accessCode,!0)&&k("string",e.name,!0)&&k("string",e.data,!0)&&k("string",e.customType,!0)&&We("string",e.operatorUserIds,!0)&&k("number",e.messageSurvivalSeconds,!0)},hf={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},_m=function(e){return We("string",e.customTypes,!0)&&k("boolean",e.includeEmpty)&&k("boolean",e.includeFrozen)&&k("boolean",e.includeChatNotification)},IS={myMemberStateFilter:Rr.ALL},AS=function(e){return Ge(Rr,e.myMemberStateFilter)};(function(e){e.GROUP_CHANNEL_UNREAD_MENTION_COUNT="group_channel_unread_mention_count",e.NONSUPER_UNREAD_MENTION_COUNT="non_super_group_channel_unread_mention_count",e.SUPER_UNREAD_MENTION_COUNT="super_group_channel_unread_mention_count",e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT="group_channel_unread_message_count",e.NONSUPER_UNREAD_MESSAGE_COUNT="non_super_group_channel_unread_message_count",e.SUPER_UNREAD_MESSAGE_COUNT="super_group_channel_unread_message_count",e.GROUP_CHANNEL_INVITATION_COUNT="group_channel_invitation_count",e.NONSUPER_INVITATION_COUNT="non_super_group_channel_invitation_count",e.SUPER_INVITATION_COUNT="super_group_channel_invitation_count"})(Tn||(Tn={}));var IO={keys:[]},AO={channelCustomTypesFilter:void 0,superChannelFilter:Ur.ALL},MO=function(e){return We("string",e.channelCustomTypesFilter,!0)&&Ge(Ur,e.superChannelFilter)},xO={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:er.ALL};M({},G);var mh=function(e){return e.startsWith("EVENT_")||e===G.SYNC_CHANNEL_CHANGELOGS||e===G.REFRESH_CHANNEL},Ve=function(e){function n(t){var r=t.channels,i=t.context,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=t.ts,l=e.call(this)||this;return l.channels=r,l.context=i,l.isWebSocketEventComing=o,l.ts=a,l}return T(n,e),n}(Tt),Ss=function(e){function n(t){var r=t.channelUrls,i=t.context,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.channelUrls=r,a.context=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),OO=function(){function e(n){var t=n.groupChannelCache,r=n.messageCache,i=n.unsentMessageCache,s=n.dispatcher,o=this;this._observers=new Map,s.on(function(a){return y(o,void 0,void 0,function(){var l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x=this;return g(this,function(U){switch(U.label){case 0:if(!(a instanceof Ve))return[3,19];if(l=a.channels,S=a.context,w=a.isWebSocketEventComing,u=l.filter(function(q){return q instanceof di}),S.source!==G.EVENT_CHANNEL_RESET_HISTORY&&S.source!==G.EVENT_CHANNEL_HIDDEN)return[3,9];U.label=1;case 1:U.trys.push([1,6,7,8]),c=ve(u),d=c.next(),U.label=2;case 2:return d.done?[3,5]:(b=d.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 3:U.sent(),U.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return h=U.sent(),N={error:h},[3,8];case 7:try{d&&!d.done&&(I=c.return)&&I.call(c)}finally{if(N)throw N.error}return[7];case 8:return[3,17];case 9:f=t.filterOffsetChanged(u),U.label=10;case 10:U.trys.push([10,15,16,17]),p=ve(f),m=p.next(),U.label=11;case 11:return m.done?[3,14]:(b=m.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 12:U.sent(),U.label=13;case 13:return m=p.next(),[3,11];case 14:return[3,17];case 15:return v=U.sent(),R={error:v},[3,17];case 16:try{m&&!m.done&&(A=p.return)&&A.call(p)}finally{if(R)throw R.error}return[7];case 17:return[4,t.upsert(u,a.ts)];case 18:return _=U.sent(),w||this._broadcastUpdateEvent(_,S),[3,24];case 19:return a instanceof Ss?(E=a.channelUrls,S=a.context,w=a.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,Ot(function(){return y(x,void 0,void 0,function(){var q,P,X,z,H,Se;return g(this,function(V){switch(V.label){case 0:V.trys.push([0,6,7,8]),q=ve(E),P=q.next(),V.label=1;case 1:return P.done?[3,5]:(X=P.value,[4,r.removeMessagesOfChannel(X)]);case 2:return V.sent(),[4,i.removeMessagesOfChannel(X)];case 3:V.sent(),V.label=4;case 4:return P=q.next(),[3,1];case 5:return[3,8];case 6:return z=V.sent(),H={error:z},[3,8];case 7:try{P&&!P.done&&(Se=q.return)&&Se.call(q)}finally{if(H)throw H.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),w||this._broadcastRemoveEvent(E,S),[3,24];case 22:return a instanceof SS?[4,t.fetch({token:Number.MAX_SAFE_INTEGER,limit:Number.MAX_SAFE_INTEGER})]:[3,24];case 23:U.sent(),U.label=24;case 24:return[2]}})})})}return e.prototype._broadcastUpdateEvent=function(n,t){var r,i;try{for(var s=ve(this._observers.values()),o=s.next();!o.done;o=s.next()){var a=o.value;a.onUpdate&&a.onUpdate(n,t)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype._broadcastRemoveEvent=function(n,t){var r,i;try{for(var s=ve(this._observers.values()),o=s.next();!o.done;o=s.next()){var a=o.value;a.onRemove&&a.onRemove(n,t)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.subscribe=function(n,t){this._observers.set(n,t)},e.prototype.unsubscribe=function(n){this._observers.delete(n)},e.prototype.unsubscribeAll=function(){this._observers.clear()},e}(),kO=function(e){function n(t){var r=t.userId,i=t.ts,s=t.token,o=t.filter,a=t.includeChatNotification,l=a!==void 0&&a,u=e.call(this)||this,c=M(M({},hf),o),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Q.GET,u.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=Ee(Ne({show_delivery_receipt:!0,show_member:!0,show_read_receipt:!0,change_ts:i||null,token:s,custom_types:d,show_empty:h,show_frozen:f,include_chat_notification:l})),u}return T(n,e),n}(Y),RO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedChannels=r.updated.map(function(s){return new di(t,Object.assign(s,{ts:r.ts}))}),i.deletedChannelUrls=r.deleted,i.hasMore=r.has_more,i.token=r.next,i.ts=r.ts,i}return T(n,e),n}(ae),mm=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(i?G4:ir,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return T(n,e),n}(Y),vm=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),Wa={includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1,channelUrlsFilter:void 0,customTypesFilter:void 0,customTypeStartsWithFilter:void 0,nicknameContainsFilter:void 0,nicknameStartsWithFilter:void 0,nicknameExactMatchFilter:void 0,channelNameContainsFilter:void 0,myMemberStateFilter:Rr.ALL,unreadChannelFilter:No.ALL,superChannelFilter:Ur.ALL,publicChannelFilter:ms.ALL,hiddenChannelFilter:zi.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:Us.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:Pt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},LO=function(e){function n(t){var r=this,i=t.userId,s=t.token,o=t.limit,a=t.order,l=t.includeEmpty,u=t.myMemberStateFilter,c=t.superChannelFilter,d=t.publicChannelFilter,h=t.unreadChannelFilter,f=t.nicknameContainsFilter,p=t.nicknameStartsWithFilter,m=t.nicknameExactMatchFilter,b=t.channelNameContainsFilter,v=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,w=t.metadataOrderKeyFilter,N=t.metadataKey,I=t.metadataValues,R=t.metadataValueStartsWith,A=t.includeFrozen,x=t.includeMetaData,U=t.searchFilter,q=t.userIdsFilter,P=t.includeChatNotification,X=P!==void 0&&P,z=t.includeLeftChannel,H=z!==void 0&&z,Se=t.createdAfter,V=t.createdBefore;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Xe,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=Ee({token:s,limit:o,order:a??Wa.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Wa.includeEmpty,member_state_filter:u??Wa.myMemberStateFilter,super_mode:c??Wa.superChannelFilter,public_mode:d??Wa.publicChannelFilter,unread_filter:h??Wa.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:v,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:w,metadata_key:N,metadata_values:I,metadata_value_startswith:R,show_frozen:A,show_metadata:x,include_chat_notification:X,include_left_channel:H,created_after:Se,created_before:V}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),q&&q.userIds&&q.userIds.length>0&&(q.includeMode?(r.params.members_include_in=q.userIds,r.params.query_type=q.queryType.toUpperCase()):r.params.members_exactly_in=q.userIds),r}return T(n,e),n}(Y),DO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,o=r.channels,a=r.ts;return i.token=s,o&&o.length>0&&(i.channels=o.map(function(l){return l.ts=a,new di(t,l)})),i.ts=a??0,i}return T(n,e),n}(ae),UO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.myMemberStateFilter;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:o??Rr.ALL},s}return T(n,e),n}(Y),PO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.groupChannelCount=r.group_channel_count,i}return T(n,e),n}(ae),FO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.keys;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=Ee({item_keys:o}),s}return T(n,e),n}(Y),HO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return typeof r[Tn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]=="number"&&(i.groupChannelUnreadMentionCount=r[Tn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]),typeof r[Tn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]=="number"&&(i.groupChannelUnreadMessageCount=r[Tn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]),typeof r[Tn.GROUP_CHANNEL_INVITATION_COUNT]=="number"&&(i.groupChannelInvitationCount=r[Tn.GROUP_CHANNEL_INVITATION_COUNT]),typeof r[Tn.SUPER_UNREAD_MENTION_COUNT]=="number"&&(i.superGroupChannelUnreadMentionCount=r[Tn.SUPER_UNREAD_MENTION_COUNT]),typeof r[Tn.SUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.superGroupChannelUnreadMessageCount=r[Tn.SUPER_UNREAD_MESSAGE_COUNT]),typeof r[Tn.SUPER_INVITATION_COUNT]=="number"&&(i.superGroupChannelInvitationCount=r[Tn.SUPER_INVITATION_COUNT]),typeof r[Tn.NONSUPER_UNREAD_MENTION_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMentionCount=r[Tn.NONSUPER_UNREAD_MENTION_COUNT]),typeof r[Tn.NONSUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMessageCount=r[Tn.NONSUPER_UNREAD_MESSAGE_COUNT]),typeof r[Tn.NONSUPER_INVITATION_COUNT]=="number"&&(i.nonSuperGroupChannelInvitationCount=r[Tn.NONSUPER_INVITATION_COUNT]),i}return T(n,e),n}(ae),jO=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return T(n,e),n}(Y),BO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i}return T(n,e),n}(ae),$O=function(e){function n(t){var r=t.userId,i=t.filter,s=t.includeFeedChannel,o=s!==void 0&&s,a=e.call(this)||this,l=i.channelCustomTypesFilter,u=i.superChannelFilter;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_message_count"),a.params={super_mode:u??Ur.ALL,custom_types:l,include_feed_channel:o},a}return T(n,e),n}(Y),GO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i.unreadFeedCount=r.unread_feed_count,i}return T(n,e),n}(ae),zO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(oC,"/count"),o.params={channel_url:r,status:qO(i)},s&&(o.params.message_type=s),o}return T(n,e),n}(Y),VO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.count=r.count,i}return T(n,e),n}(ae),qO=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case uo.PENDING:n.push(ri.PENDING);break;case uo.SENT:n.push(ri.IN_QUEUE),n.push(ri.SENT);break;case uo.CANCELED:n.push(ri.CANCELED);break;case uo.FAILED:n.push(ri.FAILED)}}),n},WO=function(e){function n(t){var r=this,i=t.userId,s=t.channelUrl,o=t.coverUrl,a=t.coverImage,l=t.isDistinct,u=t.isSuper,c=t.isBroadcast,d=t.isPublic,h=t.isExclusive,f=t.isDiscoverable,p=t.isStrict,m=t.isEphemeral,b=t.accessCode,v=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,w=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Q.POST,r.path=ir,r.params=Ee({user_ids:Pe([i],Ae(w??[]),!1).filter(function(I,R,A){return R===A.indexOf(I)}),channel_url:s,cover_url:o,cover_file:a,is_distinct:l,is_super:u,is_broadcast:c,is_exclusive:h,is_public:d,is_discoverable:f,strict:p,is_ephemeral:m,access_code:b,name:v,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return T(n,e),n}(Y),KO=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).channel=new di(t,r),s.isCreated=(i=r.is_created)===null||i===void 0||i,s}return T(n,e),n}(ae),cy=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var QO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(Y),YO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),ZO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u,d=o.users,h=d===void 0?null:d;return s.memberCount=l,s.joinedMemberCount=c,s.members=Array.isArray(h)?h.map(function(f){return new ii(t,f)}):[new ii(t,i.data)],s}return T(n,e),n}(Kl),XO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:o},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var JO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u;return s.memberCount=l,s.joinedMemberCount=c,s.member=new ii(s._iid,i.data),s}return T(n,e),n}(Kl),ek=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return T(n,e),n}(Y),tk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),nk=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this;s.inviter=null;var o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u,d=o.inviter,h=o.invitees,f=h===void 0?[]:h;return s.memberCount=l,s.joinedMemberCount=c,d&&Object.keys(d).length>0&&(s.inviter=new Ke(t,d)),s.invitees=f.map(function(p){return new ii(t,p)}),s}return T(n,e),n}(Kl),rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Bt.NONE,i}T(n,e)})(ae);var ik=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=o.joined_member_count,u=o.inviter,c=o.invitee;return s.memberCount=a??0,s.joinedMemberCount=l??0,s.inviter=new Ke(t,u),s.invitee=new ii(t,c),s}return T(n,e),n}(Kl),gm={hidePreviousMessages:!1,allowAutoUnhide:!0},sk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.hidePreviousMessages,a=t.allowAutoUnhide;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:o??gm.hidePreviousMessages,allow_auto_unhide:a??gm.allowAutoUnhide},r}return T(n,e),n}(Y),ok=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(ae),ak=function(e){function n(t,r,i){var s,o,a,l=this;return(l=e.call(this,t,"SYEV",i)||this).allowAutoUnhide=null,l.hidePreviousMessages=null,l.messageOffsetTimestamp=null,i.data&&(l.allowAutoUnhide=(s=i.data.allow_auto_unhide)!==null&&s!==void 0?s:null,l.hidePreviousMessages=(o=i.data.hide_previous_messages)!==null&&o!==void 0?o:null),l.messageOffsetTimestamp=(a=i.ts_message_offset)!==null&&a!==void 0?a:null,l}return T(n,e),n}(mt),lk=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPST",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(wr),uk=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ke(t,i.data),s}return T(n,e),n}(mt),ck=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPEN",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(wr),dk=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ke(t,i.data),s}return T(n,e),n}(mt),hk=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"MACK",ackRequired:!1,payload:{channel_url:r,msg_id:i}})||this}return T(n,e),n}(wr),MS=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U=this;return(U=e.call(this,t,r)||this).includeEmpty=!1,U.includeFrozen=!0,U.includeMetaData=!0,U.includeChatNotification=!1,U.channelUrlsFilter=null,U.customTypesFilter=null,U.customTypeStartsWithFilter=null,U.nicknameContainsFilter=null,U.nicknameStartsWithFilter=null,U.nicknameExactMatchFilter=null,U.channelNameContainsFilter="",U.myMemberStateFilter=Rr.ALL,U.unreadChannelFilter=No.ALL,U.superChannelFilter=Ur.ALL,U.publicChannelFilter=ms.ALL,U.hiddenChannelFilter=zi.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:Us.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=Pt.LATEST_LAST_MESSAGE,U.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,U.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,U.includeMetaData=(o=r.includeMetaData)===null||o===void 0||o,U.includeChatNotification=(a=r.includeChatNotification)!==null&&a!==void 0&&a,U.channelUrlsFilter=(l=r.channelUrlsFilter)!==null&&l!==void 0?l:null,U.customTypesFilter=(u=r.customTypesFilter)!==null&&u!==void 0?u:null,U.customTypeStartsWithFilter=(c=r.customTypeStartsWithFilter)!==null&&c!==void 0?c:"",U.nicknameContainsFilter=(d=r.nicknameContainsFilter)!==null&&d!==void 0?d:null,U.nicknameStartsWithFilter=(h=r.nicknameStartsWithFilter)!==null&&h!==void 0?h:null,U.nicknameExactMatchFilter=(f=r.nicknameExactMatchFilter)!==null&&f!==void 0?f:null,U.channelNameContainsFilter=(p=r.channelNameContainsFilter)!==null&&p!==void 0?p:"",U.myMemberStateFilter=(m=r.myMemberStateFilter)!==null&&m!==void 0?m:Rr.ALL,U.unreadChannelFilter=(b=r.unreadChannelFilter)!==null&&b!==void 0?b:No.ALL,U.superChannelFilter=(v=r.superChannelFilter)!==null&&v!==void 0?v:Ur.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:ms.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:zi.UNHIDDEN,U.searchFilter=(S=r.searchFilter)!==null&&S!==void 0?S:{fields:[],query:null},U.userIdsFilter=(w=r.userIdsFilter)!==null&&w!==void 0?w:{userIds:[],includeMode:!0,queryType:Us.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(I=r.metadataValues)!==null&&I!==void 0?I:null,U.metadataOrderKeyFilter=(R=r.metadataOrderKeyFilter)!==null&&R!==void 0?R:null,U.metadataValueStartsWith=(A=r.metadataValueStartsWith)!==null&&A!==void 0?A:null,U.order=(x=r.order)!==null&&x!==void 0?x:Pt.LATEST_LAST_MESSAGE,r.createdAfter&&(U.createdAfter=r.createdAfter),r.createdBefore&&(U.createdBefore=r.createdBefore),U}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter)&&k("string",this.nicknameContainsFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)&&k("string",this.nicknameExactMatchFilter,!0)&&Ge(Rr,this.myMemberStateFilter)&&Ge(Ur,this.superChannelFilter)&&Ge(ms,this.publicChannelFilter)&&Ge(No,this.unreadChannelFilter)&&Ge(zi,this.hiddenChannelFilter)&&We(Fc,this.searchFilter.fields)&&k("string",this.searchFilter.query,!0)&&We("string",this.userIdsFilter.userIds)&&k("boolean",this.userIdsFilter.includeMode)&&Ge(Us,this.userIdsFilter.queryType)&&Ge(Pt,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)&&Q2(this.createdAfter,!0)&&Q2(this.createdBefore,!0)},n.prototype.serialize=function(){return Kc(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ne(M({},this)),this.limit,G.REQUEST_CHANNEL,!0)]):[3,2]:[3,5];case 1:return t=s.sent(),r=t.channels,i=t.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,r];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),fk=function(e){function n(t,r,i){var s,o=this;return(o=e.call(this,t,"SYEV",i)||this).pinnedMessageIds=[],o.latestPinnedMessage=null,o.ts=0,i.data&&(o.pinnedMessageIds=(s=i.data.pinned_message_ids)!==null&&s!==void 0?s:[],o.latestPinnedMessage=i.data.latest_pinned_message?vr(t,M({},i.data.latest_pinned_message)):null),o.ts=i.ts,o}return T(n,e),n}(mt),pk=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(ir,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=Ee({userId:i}),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var Is,_k=function(e){function n(t,r,i){var s=e.call(this,t,"DLVR",i)||this;return s.channelUrl=i.channel_url,s.deliveredStateUpdate=i.updated,s}return T(n,e),n}(mt),cs=function(){function e(n){var t=n.top,r=t===void 0?Number.MAX_SAFE_INTEGER:t,i=n.bottom,s=i===void 0?0:i;this.top=r,this.bottom=s}return e.prototype.includes=function(){for(var n=this,t=[],r=0;r0&&je.onMentionReceived&&je.onMentionReceived(m,f)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=6;case 6:return[3,79];case 7:return S=t.as(tA),be=S.channelUrl,$e=S.channelType,w=S.messageId,N=S.silent,I=S.messageCreatedAt,R=S.senderId,$e!==Ze.GROUP?[3,9]:[4,this.getChannel(be,!0)];case 8:A=Ye.sent(),x=R===this._sdkState.userId,N||x||I>0&&A.myLastRead0&&A._updateUnreadCount(A.unreadMessageCount-1,0),this._dispatcher.dispatch(new Kv({messageIds:[w],source:G.EVENT_MESSAGE_DELETED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onMessageDeleted&&je.onMessageDeleted(A,w)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=9;case 9:return[3,79];case 10:return(U=t.as(tS).readStatus).channelType!==Ze.GROUP?[3,12]:(H=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:q=Ye.sent(),H&&q._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?H?(q.unreadMessageCount>0||q.unreadMentionCount>0)&&(q._updateUnreadCount(0,0),this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})):q.unreadMessageCount!==0&&q.unreadMentionCount!==0||(this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})):(this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onUnreadMemberStatusUpdated&&je.onUnreadMemberStatusUpdated(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),Ye.label=12;case 12:return[3,79];case 13:return P=t.as(_k),be=P.channelUrl,X=P.deliveredStateUpdate,z=X===void 0?{}:X,H=this._groupChannelCache.isCachedInMemory(be),[4,this.getChannel(be,!0)];case 14:return Se=Ye.sent(),H&&Object.keys(z).forEach(function(W){Se._updateUndeliveredMemberState(W,z[W])}),Object.keys(z).some(function(W){return W!==lt._sdkState.userId})&&(this._dispatcher.dispatch(new Ve({channels:[Se],context:{source:G.EVENT_CHANNEL_DELIVERED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onUndeliveredMemberStatusUpdated&&je.onUndeliveredMemberStatusUpdated(Se)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),[3,79];case 15:return V=t.as(bO),be=V.channelUrl,$e=V.channelType,J=V.event,$e!==Ze.GROUP?[3,18]:[4,this.getChannel(be,!0)];case 16:return re=Ye.sent(),[4,this.getMessageFromCache(J.messageId)];case 17:(oe=Ye.sent())?oe instanceof dr&&(oe.applyReactionEvent(J),this._dispatcher.dispatch(new Et({messages:[oe],source:G.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new jC({event:J,source:G.EVENT_MESSAGE_REACTION_UPDATED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onReactionUpdated&&je.onReactionUpdated(re,J)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=18;case 18:return[3,79];case 19:return(we=t.as(CO).event).channelType!==Ze.GROUP?[3,22]:[4,this.getChannel(we.channelUrl,!0)];case 20:return Z=Ye.sent(),[4,this.getMessageFromCache(we.targetMessageId)];case 21:(oe=Ye.sent())?oe instanceof dr&&(oe.applyThreadInfoUpdateEvent(we),this._dispatcher.dispatch(new Et({messages:[oe],source:G.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new BC({event:we,source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onThreadInfoUpdated&&je.onThreadInfoUpdated(Z,we)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=22;case 22:return[3,79];case 23:ee=t.as(SO).groupChannelMemberCounts,ue=[],Ye.label=24;case 24:Ye.trys.push([24,29,30,31]),$=ve(ee),ke=$.next(),Ye.label=25;case 25:return ke.done?[3,28]:(B=ke.value,be=B.channelUrl,nn=B.memberCount,rn=B.joinedMemberCount,se=B.updatedAt,[4,this.getChannelFromCache(be)]);case 26:(ce=Ye.sent())&&ce._setLatestMemberCount(nn,rn,se)&&ue.push(ce),Ye.label=27;case 27:return ke=$.next(),[3,25];case 28:return[3,31];case 29:return ye=Ye.sent(),S0={error:ye},[3,31];case 30:try{ke&&!ke.done&&(Tg=$.return)&&Tg.call($)}finally{if(S0)throw S0.error}return[7];case 31:return ue.length>0&&(this._dispatcher.dispatch(new Ve({channels:ue,context:{source:G.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelMemberCountChanged&&je.onChannelMemberCountChanged(ue)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),[3,79];case 32:return ie=t.as(TO),de=ie.event,he=ie.status,be=ie.channelUrl,$e=ie.channelType,be&&$e===Ze.GROUP?[4,this.getChannel(be,!0)]:[3,34];case 33:me=Ye.sent(),this._dispatcher.dispatch(new zC({event:de,source:G.EVENT_POLL_UPDATED})),De(he===N6?function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollDeleted&&je.onPollDeleted(me,de.pollId)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}:function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollUpdated&&je.onPollUpdated(me,de)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=34;case 34:return[3,79];case 35:return _e=t.as(fS),fe=_e.event,be=_e.channelUrl,$e=_e.channelType,be&&$e===Ze.GROUP?[4,this.getChannel(be,!0)]:[3,37];case 36:le=Ye.sent(),this._dispatcher.dispatch(new Qv({event:fe,source:G.EVENT_POLL_VOTED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollVoted&&je.onPollVoted(le,fe)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=37;case 37:return[3,79];case 38:if(!(te=t.as(Kl).event).isGroupChannelEvent)return[3,77];switch(te.category){case Yt.CHANNEL_JOIN:return[3,39];case Yt.CHANNEL_LEAVE:return[3,41];case Yt.CHANNEL_OPERATOR_UPDATE:return[3,45];case Yt.CHANNEL_INVITE:return[3,47];case Yt.CHANNEL_DECLINE_INVITE:return[3,49];case Yt.TYPING_START:case Yt.TYPING_END:return[3,51];case Yt.USER_CHANNEL_MUTE:case Yt.USER_CHANNEL_UNMUTE:return[3,53];case Yt.USER_CHANNEL_BAN:return[3,55];case Yt.USER_CHANNEL_UNBAN:return[3,59];case Yt.CHANNEL_FREEZE:case Yt.CHANNEL_UNFREEZE:return[3,61];case Yt.CHANNEL_HIDE:return[3,63];case Yt.CHANNEL_UNHIDE:return[3,65];case Yt.CHANNEL_DELETED:return[3,67];case Yt.CHANNEL_PROP_CHANGED:return[3,69];case Yt.CHANNEL_META_DATA_CHANGED:return[3,71];case Yt.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case Yt.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(te.channelUrl,!0)];case 40:return Me=Ye.sent(),Re=t.as(ZO),ne=Re.memberCount,Oe=Re.joinedMemberCount,nt=Re.members,Qe=!1,nt.forEach(function(W){Me.isExclusive||Me.isSuper||Me.isBroadcast?Qe=Qe||Me._setLatestMemberCount(ne,Oe,te.ts):(W.state=Bt.JOINED,Me.addMember(W,te.ts),lt._updateJoinedMemberCount(Me)),W.userId===lt._sdkState.userId&&(Me.myMemberState=Bt.JOINED)}),this._dispatcher.dispatch(new Ve({channels:[Me],context:{source:G.EVENT_CHANNEL_JOINED,users:nt}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){var je,Le;try{for(var Be=ve(nt),Lt=Be.next();!Lt.done;Lt=Be.next()){var ct=Lt.value;j.onUserJoined&&j.onUserJoined(Me,ct)}}catch(iw){je={error:iw}}finally{try{Lt&&!Lt.done&&(Le=Be.return)&&Le.call(Be)}finally{if(je)throw je.error}}Me.isBroadcast&&Qe&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Me])}),[2]})})}),[3,77];case 41:return(Hn=this._leftChannels.get(te.channelUrl))?(at=Hn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(te.channelUrl,!0)];case 43:at=Ye.sent(),Ye.label=44;case 44:return Fe=at,Ft=t.as(JO),nn=Ft.memberCount,rn=Ft.joinedMemberCount,_t=Ft.member,ln=!1,kt=O.of(this._iid).appInfo,Fe.isExclusive||Fe.isSuper||Fe.isBroadcast?ln=Fe._setLatestMemberCount(nn,rn,te.ts):(kt!=null&&kt.enabledChannelMemberShipHistory?((Wt=Fe.members.find(function(W){return W.userId===_t.userId}))&&(Wt.state=Bt.LEFT),Fe.memberCount=nn):Fe.removeMember(_t),this._updateJoinedMemberCount(Fe)),_t.userId===this._sdkState.userId?(Fe.myMemberState=Bt.NONE,Fe.invitedAt=0,Fe.joinedAt=0,Fe._updateUnreadCount(0,0),Fe.isPublic?this._dispatcher.dispatch(new Ve({channels:[Fe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})):(this._markAsLeave(Fe),this._dispatcher.dispatch(new Ss({channelUrls:[Fe.url],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})))):this._dispatcher.dispatch(new Ve({channels:[Fe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(Fe,_t),Fe.isBroadcast&&ln&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Fe])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(te.channelUrl,!0)];case 46:Jt=Ye.sent(),Ct=t.as(vO).operators,en=Ct.map(function(W){return W.userId});try{for(tn=ve(Jt.members),xn=tn.next();!xn.done;xn=tn.next())(Kt=xn.value).role=en.includes(Kt.userId)?Ii.OPERATOR:Ii.NONE}catch(W){T0={error:W}}finally{try{xn&&!xn.done&&(wg=tn.return)&&wg.call(tn)}finally{if(T0)throw T0.error}}return Jt.myRole=en.includes(this._sdkState.userId)?Ii.OPERATOR:Ii.NONE,this._dispatcher.dispatch(new Ve({channels:[Jt],context:{source:G.EVENT_CHANNEL_OPERATOR_UPDATED,operators:Ct}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(Jt,Ct)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(te.channelUrl,!0)];case 48:Ht=Ye.sent(),ft=t.as(nk),nn=ft.memberCount,rn=ft.joinedMemberCount,un=ft.inviter,(Un=ft.invitees).forEach(function(W){return W.state=Bt.INVITED});try{for(Pn=ve(Un),gn=Pn.next();!gn.done;gn=Pn.next())Fn=gn.value,Ht.isExclusive||Ht.isSuper||Ht.isBroadcast?Ht._setLatestMemberCount(nn,rn,te.ts):Ht.addMember(Fn,te.ts),this._sdkState.userId===Fn.userId&&(Ht.hiddenState=cr.UNHIDDEN,Ht.myMemberState!==Bt.JOINED&&(Ht.myMemberState=Bt.INVITED),Ht.invitedAt=te.ts)}catch(W){w0={error:W}}finally{try{gn&&!gn.done&&(Ng=Pn.return)&&Ng.call(Pn)}finally{if(w0)throw w0.error}}return this._dispatcher.dispatch(new Ve({channels:[Ht],context:{source:G.EVENT_CHANNEL_INVITED,inviter:un,invitees:Un}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Ht,un,Un)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(te.channelUrl,!0)];case 50:return xt=Ye.sent(),On=t.as(ik),nn=On.memberCount,rn=On.joinedMemberCount,kn=On.inviter,yn=On.invitee,xt.isExclusive||xt.isSuper||xt.isBroadcast?xt._setLatestMemberCount(nn,rn,te.ts):xt.removeMember(yn),this._sdkState.userId===yn.userId?(xt.invitedAt=0,xt.myMemberState=Bt.NONE,xt.isPublic?this._dispatcher.dispatch(new Ve({channels:[xt],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})):this._dispatcher.dispatch(new Ss({channelUrls:[xt.url],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}}))):this._dispatcher.dispatch(new Ve({channels:[xt],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(xt,kn,yn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(te.channelUrl,!0)];case 52:return wt=Ye.sent(),Rn=te.category===Yt.TYPING_START,sr=t.as(Rn?uk:dk).user,wt._updateTypingStatus(sr,Rn?te.ts:0),this._dispatcher.dispatch(new Ve({channels:[wt],context:{source:G.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(wt)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(te.channelUrl,!0)];case 54:cn=Ye.sent(),En=te.category===Yt.USER_CHANNEL_MUTE,(bn=t.as(En?PM:HM).user).userId===this._sdkState.userId&&(cn.myMutedState=En?as.MUTED:as.UNMUTED,cn._myMutedRemainingTime=bn.restrictionInfo.remainingDuration);try{for(Rt=ve(cn.members),Cn=Rt.next();!Cn.done;Cn=Rt.next())if((Kt=Cn.value).userId===bn.userId){Kt.isMuted=En;break}}catch(W){N0={error:W}}finally{try{Cn&&!Cn.done&&(Ig=Rt.return)&&Ig.call(Rt)}finally{if(N0)throw N0.error}}return this._dispatcher.dispatch(new Ve({channels:[cn],context:{source:En?G.EVENT_CHANNEL_MUTED:G.EVENT_CHANNEL_UNMUTED,user:bn}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){En?j.onUserMuted&&j.onUserMuted(cn,bn):j.onUserUnmuted&&j.onUserUnmuted(cn,bn)}),[2]})})}),[3,77];case 55:return(Hn=this._leftChannels.get(te.channelUrl))?(or=Hn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(te.channelUrl,!0)];case 57:or=Ye.sent(),Ye.label=58;case 58:return jn=or,this._markAsLeave(jn),Ue=t.as(BM).user,Ue.userId===this._sdkState.userId&&this._dispatcher.dispatch(new Ss({channelUrls:[jn.url],context:{source:G.EVENT_CHANNEL_BANNED,user:Ue}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(jn,Ue)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(te.channelUrl,!0)];case 60:return F=Ye.sent(),pe=t.as(GM).user,pe.userId===this._sdkState.userId&&this._dispatcher.dispatch(new Ss({channelUrls:[F.url],context:{source:G.EVENT_CHANNEL_UNBANNED,user:pe}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,pe)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(te.channelUrl,!0)];case 62:return xe=Ye.sent(),ze=t.as(zM).freeze,xe.isFrozen=ze,this._dispatcher.dispatch(new Ve({channels:[xe],context:{source:ze?G.EVENT_CHANNEL_FROZEN:G.EVENT_CHANNEL_UNFROZEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){ze?j.onChannelFrozen&&j.onChannelFrozen(xe):j.onChannelUnfrozen&&j.onChannelUnfrozen(xe)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(te.channelUrl,!0)];case 64:return vt=Ye.sent(),dn=t.as(ak),Kn=dn.allowAutoUnhide,Qn=dn.hidePreviousMessages,ys=dn.messageOffsetTimestamp,Kn!==null&&(vt.hiddenState=Kn?cr.HIDDEN_ALLOW_AUTO_UNHIDE:cr.HIDDEN_PREVENT_AUTO_UNHIDE),Qn!==null&&Qn&&vt._updateUnreadCount(0,0),ys!==null&&(vt.messageOffsetTimestamp=ys),this._dispatcher.dispatch(new Ve({channels:[vt],context:{source:G.EVENT_CHANNEL_HIDDEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(vt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(te.channelUrl,!0)];case 66:return(Bn=Ye.sent()).hiddenState=cr.UNHIDDEN,this._dispatcher.dispatch(new Ve({channels:[Bn],context:{source:G.EVENT_CHANNEL_UNHIDDEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Bn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(te.channelUrl,!0)];case 68:return Ha=Ye.sent(),this._dispatcher.dispatch(new Ss({channelUrls:[te.channelUrl],context:{source:G.EVENT_CHANNEL_DELETED}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(Ha.url,Ha.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(te.channelUrl,!0)];case 70:return ja=Ye.sent(),this._dispatcher.dispatch(new Ve({channels:[ja],context:{source:G.EVENT_CHANNEL_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(ja)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(te.channelUrl,!0)];case 72:return Xi=Ye.sent(),Jc=t.as(NM),Ba=Jc.created,$a=Jc.updated,Ga=Jc.deleted,Ba&&(Xi._upsertCachedMetaData(Ba,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_CREATED,metaData:Ba}}))),$a&&(Xi._upsertCachedMetaData($a,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_UPDATED,metaData:$a}}))),Ga&&(Xi._removeFromCachedMetaData(Ga,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:Ga}}))),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){Ba&&j.onMetaDataCreated&&j.onMetaDataCreated(Xi,Ba),$a&&j.onMetaDataUpdated&&j.onMetaDataUpdated(Xi,$a),Ga&&j.onMetaDataDeleted&&j.onMetaDataDeleted(Xi,Ga)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(te.channelUrl,!0)];case 74:return Po=Ye.sent(),ed=t.as(RM),Yl=ed.created,Zl=ed.updated,Xl=ed.deleted,Yl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:Yl}})),Zl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Zl}})),Xl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:Xl}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){Yl&&j.onMetaCounterCreated&&j.onMetaCounterCreated(Po,Yl),Zl&&j.onMetaCounterUpdated&&j.onMetaCounterUpdated(Po,Zl),Xl&&j.onMetaCounterDeleted&&j.onMetaCounterDeleted(Po,Xl)}),[2]})})}),[3,77];case 75:return[4,this.getChannel(te.channelUrl,!0)];case 76:return qs=Ye.sent(),td=t.as(fk),Eg=td.pinnedMessageIds,bg=td.latestPinnedMessage,(Cg=td.ts)>qs._pinnedMessagesUpdatedAt&&(qs.pinnedMessageIds=Eg,qs.lastPinnedMessage=bg,qs._pinnedMessagesUpdatedAt=Cg,this._dispatcher.dispatch(new Ve({channels:[qs],context:{source:G.EVENT_PINNED_MESSAGE_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(qs)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(qs)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((g0=t.as(wS).event).category){case Pc.USER_BLOCK:y0=cf.getDataAsUserBlockEvent(this._iid,g0),nd=y0.blocker,rd=y0.blockee,this._groupChannelCache.block(nd.userId,rd.userId);break;case Pc.USER_UNBLOCK:E0=cf.getDataAsUserBlockEvent(this._iid,g0),nd=E0.blocker,rd=E0.blockee,this._groupChannelCache.unblock(nd.userId,rd.userId)}return[3,79];case 79:return[3,81];case 80:if(b0=Ye.sent(),Lr(b0))throw b0;return[3,81];case 81:return[2]}})})},n.prototype._markAsLeave=function(t){var r,i=this,s=(r=this._leftChannels.get(t.url))!==null&&r!==void 0?r:{channel:t,ref:0};s.ref++,this._leftChannels.set(t.url,s),setTimeout(function(){s.ref--,s.ref===0&&i._leftChannels.delete(t.url)},1e4)},n.prototype.addHandler=function(t,r){this._groupChannelHandlers.set(t,r)},n.prototype.removeHandler=function(t){this._groupChannelHandlers.delete(t)},n.prototype.clearHandler=function(){this._groupChannelHandlers.clear()},n.prototype.subscribeChannelEvent=function(t,r){this._groupChannelBroadcast.subscribe(t,r)},n.prototype.unsubscribeChannelEvent=function(t){this._groupChannelBroadcast.unsubscribe(t)},n.prototype._updateJoinedMemberCount=function(t){t.joinedMemberCount=t.members.filter(function(r){return r.state===Bt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:K(k("string",t)).throw(L.invalidParameters),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getChannelFromCache(t)];case 2:return(i=s.sent())?[2,i]:[3,4];case 3:return s.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(t,r)];case 5:return[2,s.sent()]}})})},n.prototype.getChannelWithoutCache=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(k("string",t)).throw(L.invalidParameters),i=new mm({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),o=s.as(vm).channel,a=o.unreadMessageCount,l=o.unreadMentionCount,o.myCountPreference){case ti.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case ti.UNREAD_MENTION_COUNT_ONLY:a=0;break;case ti.OFF:a=0,l=0}return o._updateUnreadCount(a,l),[4,this.upsertChannelsToCache([o])];case 2:return[2,u.sent()[0]]}})})},n.prototype.refreshChannel=function(t,r,i){return r===void 0&&(r=!0),i===void 0&&(i=G.REFRESH_CHANNEL),y(this,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new mm({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return o=c.sent(),(a=o.as(vm).channel).myMemberState!==Bt.NONE?[3,2]:(this._dispatcher.dispatch(new Ss({channelUrls:[a.url],context:{source:i}})),[3,4]);case 2:return[4,this.upsertChannelsToCache([a])];case 3:l=c.sent(),this._dispatcher.dispatch(new Ve({channels:l,context:{source:i}})),c.label=4;case 4:return[3,6];case 5:return(u=c.sent()).code!==Ie.NON_AUTHORIZED&&u.code!==Ie.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new Ss({channelUrls:[t],context:{source:i}})),[3,6];case 6:return[2]}})})},n.prototype.getMyGroupChannels=function(t,r,i,s,o){return s===void 0&&(s=G.REQUEST_CHANNEL),o===void 0&&(o=!1),y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:return r.createdAfter&&(r.createdAfter=Math.floor(r.createdAfter/1e3)),r.createdBefore&&(r.createdBefore=Math.floor(r.createdBefore/1e3)),a=!1,o&&(l=O.of(this._iid),u=l.appInfo,(c=l.cacheContext)&&!c.localCacheEnabled&&(u!=null&&u.enabledChannelMemberShipHistory)&&(u!=null&&u.applicationAttributes.includes("left_user_view_support"))&&(a=!0)),d=new LO(M(M({},r),{userId:this._sdkState.userId,token:t,limit:i,includeLeftChannel:o&&a})),[4,this._requestQueue.send(d)];case 1:return h=b.sent(),f=h.as(DO),p=f.channels,m=f.token,this._dispatcher.dispatch(new Ve({channels:p,context:{source:s}})),[2,{channels:p,token:m}]}})})},n.prototype.getMyGroupChannelChangeLogs=function(t,r,i){return i===void 0&&(i=G.REQUEST_CHANNEL_CHANGELOGS),y(this,void 0,void 0,function(){var s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return s=M(M({},hf),r),K((k("string",t)||k("number",t))&&_m(s)).throw(L.invalidParameters),o=new kO(Ne({userId:this._sdkState.userId,ts:typeof t=="number"?t:null,token:typeof t=="string"?t:null,filter:s})),[4,this._requestQueue.send(o)];case 1:return a=f.sent(),l=a.as(RO),u=l.updatedChannels,c=l.deletedChannelUrls,d=l.hasMore,h=l.ts,u.length>0&&this._dispatcher.dispatch(new Ve({channels:u,context:{source:i},ts:h})),c.length>0&&this._dispatcher.dispatch(new Ss({channelUrls:c,context:{source:i}})),[2,{updatedChannels:u,deletedChannelUrls:c,hasMore:d,token:l.token}]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=M(M({},IS),t),K(AS(r)).throw(L.invalidParameters),i=new UO({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),[2,s.as(PO).groupChannelCount]}})})},n.prototype.getUnreadItemCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_;return g(this,function(E){switch(E.label){case 0:return r=M(M({},IO),t),K(function(S){return We(Tn,S.keys)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new FO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=E.sent(),u=l.as(HO),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,v=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,Ee({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:v,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new jO({userId:r.userId}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(BO).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=M(M({},AO),t),K(MO(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new $O({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(GO).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=M(M({},xO),t),K(function(l){return k("string",l.channelUrl,!0)&&We(uo,l.scheduledStatus,!0)&&Ge(er,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new zO(r),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(VO).count]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){var t=O.of(this._iid).subscribedUnreadMessageCount;return t.all>=0?t.all:0},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){var t=0,r=O.of(this._iid).subscribedUnreadMessageCount;return Object.keys(r.customTypes).forEach(function(i){t+=r.customTypes[i]}),t},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){var r;return(r=O.of(this._iid).subscribedUnreadMessageCount.customTypes[t])!==null&&r!==void 0?r:0},n.prototype.createChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=M(M({},_h),t),K(pm(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new WO(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),o=s.as(KO).channel,[4,this.upsertChannelsToCache([o])];case 2:return a.sent(),[2,o]}})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return t=Date.now(),K(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new cy({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=ve(i),o=s.next();!o.done;o=s.next())(a=o.value)._updateUnreadMemberState(this._sdkState.userId,t),a._updateUnreadCount(0,0)}catch(d){l={error:d}}finally{try{o&&!o.done&&(u=s.return)&&u.call(s)}finally{if(l)throw l.error}}return i.length>0?[4,this.upsertChannelsToCache(i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return[2]}})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return r=Date.now(),K(We("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new cy({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,o=[];try{for(a=ve(s),l=a.next();!l.done;l=a.next())u=l.value,t.includes(u.url)&&(u._updateUnreadMemberState(this._sdkState.userId,r),u._updateUnreadCount(0,0),o.push(u))}catch(f){c={error:f}}finally{try{l&&!l.done&&(d=a.return)&&d.call(a)}finally{if(c)throw c.error}}return o.length>0?[4,this.upsertChannelsToCache(o)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[2]}})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n.prototype.getMessageFromCache=function(t){var r;return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._messageCache.get(t)];case 1:return[2,(r=i.sent())!==null&&r!==void 0?r:null]}})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){switch(s.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,filter:i,exactMatch:!0})];case 1:return[2,s.sent()]}})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return o===void 0&&(o=mS),a===void 0&&(a=!0),y(this,void 0,void 0,function(){return g(this,function(l){switch(l.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:o,filter:s,backward:i==="next",inclusive:a})];case 1:return[2,l.sent()]}})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:s,filter:i,backward:!1,isPollOnly:!0})];case 1:return[2,o.sent()]}})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,this._messageCache.countBetween(t,r,new cs({top:i,bottom:s}))];case 1:return[2,o.sent()]}})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._unsentMessageCache.fetch({channelUrl:t,filter:r})];case 1:return[2,i.sent()]}})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(gO),Zr=function(e,n){return n instanceof Dt?e.findIndex(function(t){return t instanceof Dt&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},cu=function(e,n){return e.findIndex(function(t){return t instanceof dr?t.messageId===n:t instanceof wa?t.notificationId===n:void 0})},Ap=function(e,n){if(e.length>0){for(var t=0,r=e.length-1,i=Math.floor((t+r)/2);t0)r=i,i=Math.floor((t+r)/2);else{if(!(s<0))return i;t=i+1,i=Math.floor((t+r)/2)}}return e[i].createdAt>n.createdAt?i:i+1}return e.length};(function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.END=2]="END"})(Is||(Is={}));var ff,ko=function(e){function n(t,r,i,s){var o=e.call(this)||this;return o._state=Is.IDLE,o._retryCount=0,o._retryLimit=3,o.priority=0,o._worker=r,o}return T(n,e),Object.defineProperty(n.prototype,"isIdle",{get:function(){return this._state===Is.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===Is.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===Is.END},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),n.prototype._run=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:if(!this.isRunning)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._worker(t)];case 2:return r=s.sent(),this._retryCount=0,this.dispatch("progress",r),r.hasNext?this._run(r.nextToken):this.end(),[3,4];case 3:return i=s.sent(),this.dispatch("error",i),this._retryCount0&&(E=_.map(function(X){return X.createdAt}),!((x=this._metadata)===null||x===void 0)&&(w=x.range).intersect.apply(w,Pe([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new cs({top:Math.min.apply(Math,Pe([],Ae(E),!1)),bottom:Math.max.apply(Math,Pe([],Ae(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(v.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(P){return P.createdAt}),!((A=this._metadata)===null||A===void 0)&&(w=A.range).intersect.apply(w,Pe([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new cs({top:Math.min.apply(Math,Pe([],Ae(E),!1)),bottom:Math.max.apply(Math,Pe([],Ae(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit,this._metadata&&(v.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",v),[4,this.saveMetadata()];case 4:return q.sent(),[3,7];case 5:throw S=q.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:r.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:(U=(x=d.localCacheConfig)===null||x===void 0?void 0:x.maxSize)!==null&&U!==void 0?U:0,use_local_cache:d.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[2,v]}})})}),this._connectionEventContext=h.on(function(b){b instanceof _i&&(b.stateType===st.CONNECTED?o.resume():o.pause())})}return e.of=function(n,t){return Ui[n]||(Ui[n]={}),Ui[n][t.url]||(Ui[n][t.url]=new e({_iid:n,channel:t})),Ui[n][t.url].ref++,Ui[n][t.url]},e.clear=function(n,t){Ui[n]&&Ui[n][t]&&(Ui[n][t].close(),delete Ui[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new cs({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousComplete",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.previousComplete)},enumerable:!1,configurable:!0}),e.prototype.isWrappingMessages=function(n){var t;return(t=this.range)===null||t===void 0?void 0:t.includes.apply(t,Pe([],Ae(n.map(function(r){return r.createdAt})),!1))},e.prototype.extendRange=function(n){var t;this._metadata&&(t=this._metadata.range).extends.apply(t,Pe([],Ae(n.map(function(r){return r.createdAt})),!1))},e.prototype.loadMetadata=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:t=r.sent(),this._metadata=t?{range:new cs(t.range),previousComplete:t.previousComplete}:{range:new cs({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(n){var t,r,i,s;n===void 0&&(n=Date.now());var o=O.of(this._iid),a=o.logger;o.sessionManager.session.hasSession&&(a.debug("message background sync resume()"),this._prevSyncLoopCount=0,this._metadata&&this._metadata.previousComplete||this._prevSync.start((r=(t=this._metadata)===null||t===void 0?void 0:t.range.top)!==null&&r!==void 0?r:n),this._nextSync.start((s=(i=this._metadata)===null||i===void 0?void 0:i.range.bottom)!==null&&s!==void 0?s:n))},e.prototype.pause=function(){O.of(this._iid).logger.debug("message background sync stop()"),this._prevSync.stop(),this._nextSync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Ui[this._iid][this._channel.url])},e}(),Pi={},vk=function(){function e(n){var t=n._iid,r=n.channel,i=n.includeParams,s=this;this.ref=0,this._iid=t,this._channel=r,this._includeParams=i;var o,a,l=O.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(o=c.userId,a=r.url,"sendbird:".concat(o,"@groupchannel/").concat(a,"/message/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/message/changelogs")}(c.userId,this._channel.url);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:w.sent(),u.debug("message changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),w.label=2;case 2:return w.trys.push([2,5,,8]),[4,An.of(this._iid).getMessageChangelogs(this._channel.url,this._channel.channelType,this._metadata.token,M({replyType:Dn.ALL},this._includeParams),G.SYNC_MESSAGE_CHANGELOGS)];case 3:return p=w.sent(),m=p.updatedMessages,b=p.deletedMessageIds,v=p.hasMore,_=p.token,f.hasNext=v,f.nextToken=_,(m.length>0||b.length>0)&&this._metadata&&(this._metadata.token=_),u.debug("message changelog sync progress",f),[4,this.saveMetadata()];case 4:return w.sent(),[3,8];case 5:return E=w.sent(),u.debug("message changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:w.sent(),w.label=7;case 7:throw E;case 8:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Pi[n]||(Pi[n]={}),Pi[n][t.url]||(Pi[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),Pi[n][t.url].ref++,Pi[n][t.url]},e.clear=function(n,t){Pi[n]&&Pi[n][t]&&(Pi[n][t].close(),delete Pi[n])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=O.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n=O.of(this._iid),t=n.logger;n.sessionManager.session.hasSession&&(t.debug("message changelog sync resume()"),this._sync.start(0))},e.prototype.pause=function(){O.of(this._iid).logger.debug("message changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Pi[this._iid][this._channel.url])},e}(),jo={},gk=function(){function e(n){var t=n._iid,r=n.channel,i=n.hasPollMessage,s=this;this.ref=0,this._iid=t,this._channel=r;var o,a,l=O.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(o=c.userId,a=r.url,"sendbird:".concat(o,"@groupchannel/").concat(a,"/poll/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/poll/changelogs")}(c.userId,this._channel.url);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return w.sent(),u.debug("poll changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),(p=!this._metadata||!this._metadata.token)?[4,i()]:[3,3];case 2:p=!w.sent(),w.label=3;case 3:if(p)return[2,{hasNext:!1,nextToken:0}];this._metadata||(m=O.of(this._iid).firstConnectedAt,this._metadata={token:m}),w.label=4;case 4:return w.trys.push([4,7,,10]),[4,rf.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=w.sent(),v=b.hasMore,_=b.token,f.hasNext=v,f.nextToken=_,this._metadata.token=_,u.debug("poll changelog sync progress",f),[4,this.saveMetadata()];case 6:return w.sent(),[3,10];case 7:return E=w.sent(),u.debug("poll changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,9];case 8:w.sent(),w.label=9;case 9:throw E;case 10:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return jo[n]||(jo[n]={}),jo[n][t.url]||(jo[n][t.url]=new e({_iid:n,channel:t,hasPollMessage:r})),jo[n][t.url].ref++,jo[n][t.url]},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata=n?{token:n.token}:void 0,t.label=2;case 2:return[2]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){O.of(this._iid).logger.debug("poll changelog sync resume()"),this._sync.start(0)},e.prototype.pause=function(){O.of(this._iid).logger.debug("poll changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete jo[this._iid][this._channel.url])},e}(),yk=function(e){function n(t){var r,i,s,o,a,l,u,c,d,h,f=this;return(f=e.call(this)||this).method=Q.GET,f.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=Ee({prev_start_ts:t.prevStart,prev_end_ts:t.prevEnd,prev_cache_count:t.prevCount,next_start_ts:t.nextStart,next_end_ts:t.nextEnd,next_cache_count:t.nextCount,huge_gap_threshold:(r=t.threshold)!==null&&r!==void 0?r:null,reverse:!0,custom_types:(i=t.customTypes)!==null&&i!==void 0?i:["*"],message_type:(s=t.messageType)!==null&&s!==void 0?s:null,include_reply_type:(o=t.replyType)!==null&&o!==void 0?o:Dn.NONE,include_reactions:(a=t.includeReactions)===null||a===void 0||a,include_meta_array:(l=t.includeMetaArray)===null||l===void 0||l,include_thread_info:(u=t.includeThreadInfo)===null||u===void 0||u,include_parent_message_info:(c=t.includeParentMessageInfo)===null||c===void 0||c,with_sorted_meta_array:(d=t.includeMetaArray)===null||d===void 0||d,show_subchannel_messages_only:(h=t.showSubchannelMessagesOnly)!==null&&h!==void 0&&h,include_poll_details:!0,checking_continuous_messages:t.checkingContinuousMessages}),f}return T(n,e),n}(Y),Ek=function(e){function n(t,r){var i,s,o,a,l,u,c=this;return(c=e.call(this,t,r)||this).isHugeGap=r.is_huge_gap,c.prevMessages=((i=r.prev_messages)!==null&&i!==void 0?i:[]).map(function(d){return vr(t,d)}),c.prevHasMore=(s=r.prev_hasmore)!==null&&s!==void 0&&s,c.isContinuousPrevMessages=(o=r.is_continuous_prev_messages)!==null&&o!==void 0&&o,c.nextMessages=((a=r.next_messages)!==null&&a!==void 0?a:[]).map(function(d){return vr(t,d)}),c.nextHasmore=(l=r.next_hasmore)!==null&&l!==void 0&&l,c.isContinuousNextMessages=(u=r.is_continuous_next_messages)!==null&&u!==void 0&&u,c}return T(n,e),n}(ae),dy={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(ff||(ff={}));var ac,lc,uc,bk=function(){function e(){this._onCacheResult=qe,this._onApiResult=qe}return e.prototype._invokeResponse=function(n,t,r){var i=this;De(function(){return y(i,void 0,void 0,function(){return g(this,function(s){switch(n){case"local":this._onCacheResult(t,r);break;case"remote":this._onApiResult(t,r)}return[2]})})})},e.prototype.onCacheResult=function(n){return this._onCacheResult=n,this},e.prototype.onApiResult=function(n){return this._onApiResult=n,this},e}(),Ck=function(){function e(n,t){var r=t.filter,i=t.startingPoint,s=t.limit,o=t.prevResultLimit,a=t.nextResultLimit,l=t.channel,u=t.channelManager,c=t.disableBackgroundSync,d=c!==void 0&&c,h=this;this._messages=[],this._unsentMessages=[],this._isLoadingPrevious=!1,this._isLoadingNext=!1,this._iid=n,this._key="mc-".concat($s()),this._isDisposed=!1,this.filter=r??new vs,this._channel=l,this._syncRange=new cs({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||mS,this._prevResultLimit=o??Math.floor(this._limit/2),this._nextResultLimit=a??Math.floor(this._limit/2),this._channelManager=u,this._channelManager.subscribeChannelEvent(this._key,{onUpdate:function(v,_){var E=_.source,S=v.findIndex(function(w){return w.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(v[S]),h.channel._runIfHandleableWithGroupChannel(function(w){switch(E){case G.EVENT_CHANNEL_UPDATED:for(var N=!1,I=0;I=w.messageOffsetTimestamp){N=!0;var R=I;if(R>0){var A=h._messages.splice(0,R);h._removeMessagesFromView(A.map(function(q){return h.keyOf(q)}),G.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(q){return h.keyOf(q)}),G.EVENT_MESSAGE_OFFSET_UPDATED);break;case G.EVENT_CHANNEL_UNMUTED:var x=O.of(h._iid).sdkState,U=_.user;x.userId===U.userId&&h._clearCheckMyMutedTimer();break;case G.EVENT_CHANNEL_MUTED:x=O.of(h._iid).sdkState,U=_.user,x.userId===U.userId&&w._myMutedRemainingTime!==-1&&h._startCheckMyMutedTimer(w._myMutedRemainingTime);break;case G.EVENT_CHANNEL_LEFT:w.isPublic&&h._clearCheckMyMutedTimer()}De(function(){return y(h,void 0,void 0,function(){var q;return g(this,function(P){return mh(E)&&(!((q=this._handler)===null||q===void 0)&&q.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(v[S],E))},onRemove:function(v,_){var E=v.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),De(function(){return y(h,void 0,void 0,function(){var S;return g(this,function(w){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(v[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(v,_){var E,S,w=[],N=[];try{for(var I=ve(v),R=I.next();!R.done;R=I.next()){var A=R.value;A.channelUrl===h._channel.url&&(h.filter.match(A)?w.push(A):N.push(h.keyOf(A)))}}catch(x){E={error:x}}finally{try{R&&!R.done&&(S=I.return)&&S.call(I)}finally{if(E)throw E.error}}if(Ns(_)){if(w.length>0)switch(_){case G.LOCAL_MESSAGE_CANCELED:case G.LOCAL_MESSAGE_RESEND_STARTED:case G.EVENT_MESSAGE_SENT_FAILED:case G.EVENT_MESSAGE_SENT_SUCCESS:case G.EVENT_MESSAGE_UPDATED:case G.EVENT_MESSAGE_THREADINFO_UPDATED:case G.EVENT_MESSAGE_REACTION_UPDATED:case G.EVENT_MESSAGE_FEEDBACK_ADDED:case G.EVENT_MESSAGE_FEEDBACK_UPDATED:case G.EVENT_MESSAGE_FEEDBACK_DELETED:case G.SYNC_MESSAGE_CHANGELOGS:h._updateMessagesToView(w,_);break;case G.EVENT_MESSAGE_SENT_PENDING:h._addMessagesToView(w,_);break;case G.EVENT_MESSAGE_RECEIVED:h.hasNext||h._addMessagesToView(w,_);break;case G.SYNC_MESSAGE_FILL:h._addMessagesToView(w,_)}N.length>0&&h._removeMessagesFromView(N,_)}h._postprocessMessageUpdateEvent(v,_)},onRemove:function(v,_){h._removeMessagesFromView(v,_),h._postprocessMessageRemoveEvent(v)},onRemoveUnsent:function(v,_){h._removeUnsentMessageFromView(v,_)},onPollChangeLogUpdate:function(v,_){h._updatePollsToView(v,_)},onPollUpdate:function(v,_){h._applyPollUpdateEventToView(v,_)},onPollVote:function(v,_){h._applyPollVoteEventToView(v,_)},onReactionUpdate:function(v,_){h._applyReactionEventToView(v,_)},onThreadInfoUpdate:function(v,_){h._applyThreadInfoEventToView(v,_)}});var f=O.of(this._iid),p=f.cacheContext,m=f.dispatcher;this._channel._updateMessageCollectionLastAccessedAt(),m.dispatch(new Ve({channels:[this._channel],context:{source:G.CHANNEL_LASTACCESSEDAT_UPDATED}})),!d&&this._shouldStartBackgroundSync()&&(this._backgroundSync=mk.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=vk.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=gk.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new ko(this._key,function(v){return y(h,void 0,void 0,function(){var _,E,S,w,N,I,R;return g(this,function(A){switch(A.label){case 0:return[4,this._getRemoteMessages(v,{prevLimit:this._prevResultLimit,source:G.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=A.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(w=Math.min.apply(Math,Pe([],Ae(E.map(function(x){return x.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:E.length>=this._prevResultLimit&&this.viewTop0?(w=Math.max.apply(Math,Pe([],Ae(E.map(function(x){return x.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:!(E.length>=this._nextResultLimit&&this._hasNext)||this.viewBottom>w,nextToken:this._syncRange.bottom}]):(b.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(R=(I=p.localCacheConfig)===null||I===void 0?void 0:I.maxSize)!==null&&R!==void 0?R:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(v){if(v instanceof _i)switch(v.stateType){case st.CONNECTED:Ot(function(){return y(h,void 0,void 0,function(){return g(this,function(_){return this._activate(),[2]})})});break;case st.LOGOUT:h.dispose();break;default:h._clearCheckMyMutedTimer(),h._prevFill.stop(),h._nextFill.stop()}});var b=O.of(this._iid).statManager;b.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{message:!0}}}))}return e.prototype.keyOf=function(n){return 0},Object.defineProperty(e.prototype,"changelogIncludeParams",{get:function(){return{includeReactions:!0,includeThreadInfo:!0,includeMetaArray:!0,includeParentMessageInfo:!0}},enumerable:!1,configurable:!0}),e.prototype._postprocessChannelUpdateEvent=function(n,t){},e.prototype._postprocessChannelRemoveEvent=function(n){},e.prototype._postprocessMessageUpdateEvent=function(n,t){},e.prototype._postprocessMessageRemoveEvent=function(n){},Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"succeededMessages",{get:function(){return Pe([],Ae(this._messages),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"failedMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ut.FAILED})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ut.PENDING})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return this._hasPrevious},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewTop",{get:function(){return Math.min.apply(Math,Pe(Pe([],Ae(this._messages.map(function(n){return n.createdAt})),!1),[Number.MAX_SAFE_INTEGER],!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewBottom",{get:function(){return Math.max.apply(Math,Pe(Pe([],Ae(this._messages.map(function(n){return n.createdAt})),!1),[0],!1))},enumerable:!1,configurable:!0}),e.prototype._activate=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return O.of(this._iid).logger.debug("check huge gap"),this._checkHugeGap(),[4,this._refreshChannel(G.SYNC_CHANNEL_CHANGELOGS)];case 1:return n.sent(),[2]}})})},e.prototype._replaceChannelOfCollection=function(n){this._channel.isGroupChannel()?this._channel=n:this._channel.isFeedChannel()&&(this._channel._groupChannel=n._groupChannel)},e.prototype._shouldStartBackgroundSync=function(){var n=O.of(this._iid).cacheContext;return this.channel.isGroupChannel()?n.localCacheEnabled&&!this.channel.isSuper:n.localCacheEnabled},e.prototype._setBaseMessageCollectionHandler=function(n){this._handler=n},e.prototype._filterUnderOffsetMessage=function(n){return n},e.prototype._updateChildMessagesInView=function(n){var t=[];return this._messages.forEach(function(r){r instanceof dr&&r.parentMessageId===n.messageId&&r.applyParentMessage(n)&&t.push(r)}),t},e.prototype._updatePollsToView=function(n,t){var r,i,s=this,o=[];try{for(var a=ve(n),l=a.next();!l.done;l=a.next()){var u=l.value,c=cu(this._messages,u.messageId);if(c>=0){var d=this._messages[c];d.isUserMessage()&&d.applyPoll(u),o.push(d)}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o.length>0&&Ns(t)&&De(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},o.length>0&&((p=(f=this._handler).onMessagesUpdated)===null||p===void 0||p.call(f,h,this.channel,o)),[2]})})}),o},e.prototype._applyPollUpdateEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollUpdateEvent(n)&&Ns(t)&&De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})})}},e.prototype._applyPollVoteEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollVoteEvent(n)&&Ns(t)&&De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})})}},e.prototype._applyReactionEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&Ns(t)&&(s.applyReactionEvent(n),De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})}))}},e.prototype._applyThreadInfoEventToView=function(n,t){var r=this,i=cu(this._messages,n.targetMessageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&Ns(t)&&(s.applyThreadInfoUpdateEvent(n),De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})}))}},e.prototype._removeMessagesFromView=function(n,t){var r,i,s=this,o=[],a=[],l=function(h){var f=u._messages.findIndex(function(m){return s.keyOf(m)===h});if(f>=0){var p=u._messages[f];o.push(u.keyOf(p)),a.push(p),u._messages.splice(f,1)}},u=this;try{for(var c=ve(n),d=c.next();!d.done;d=c.next())l(d.value)}catch(h){r={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return Ns(t)&&a.length>0&&De(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},(p=(f=this._handler)===null||f===void 0?void 0:f.onMessagesDeleted)===null||p===void 0||p.call(f,h,this.channel,o,a),[2]})})}),o},e.prototype._removeUnsentMessageFromView=function(n,t){var r=this._unsentMessages.findIndex(function(i){return i.reqId===n});r>=0&&this._unsentMessages.splice(r,1)},e.prototype._getLocalMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,o=s===void 0?0:s,a=t.inclusive,l=a===void 0||a;return y(this,void 0,void 0,function(){var u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return u=[],l?[4,this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url,n,this.filter)]:[3,2];case 1:u=p.sent(),p.label=2;case 2:return i>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"prev",this.filter,i,!1)]:[3,4];case 3:return d=p.sent(),[3,5];case 4:d=[],p.label=5;case 5:return c=d,o>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"next",this.filter,o,!1)]:[3,7];case 6:return f=p.sent(),[3,8];case 7:f=[],p.label=8;case 8:return h=f,[2,Pe(Pe(Pe([],Ae(u),!1),Ae(c),!1),Ae(h),!1).sort(function(m,b){return b.createdAt-m.createdAt})]}})})},e.prototype._getRemoteMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,o=s===void 0?0:s,a=t.source,l=a===void 0?G.REQUEST_MESSAGE:a,u=t.reverse,c=u!==void 0&&u,d=t.checkingHasNext,h=d!==void 0&&d,f=t.checkingContinuousMessages,p=f!==void 0&&f;return y(this,void 0,void 0,function(){var m,b;return g(this,function(v){switch(v.label){case 0:return m=An.of(this._iid),i>0||o>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ne(M(M(M({},this.filter),dy),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:o})),l,h,p)]:[3,2];case 1:return b=v.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},v.label=3;case 3:return[2,b]}})})},e.prototype._checkHugeGap=function(){var n,t,r,i,s;return y(this,void 0,void 0,function(){var o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z=this;return g(this,function(H){switch(H.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=o.cacheContext,c=o.statManager,d=o.logger,this._messages.length>0?(h=this._syncRange.top,f=this.viewTop,p=this._syncRange.bottom,m=this.hasNext?this.viewBottom:Number.MAX_SAFE_INTEGER,[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,f,h)]):[3,8];case 1:return b=H.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:v=H.sent(),H.label=3;case 3:return H.trys.push([3,5,6,7]),[4,i0(function(){return y(z,void 0,void 0,function(){var Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he=this;return g(this,function(me){switch(me.label){case 0:return Se=new yk(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:v,checkingContinuousMessages:u.localCacheEnabled},this.filter),dy)),[4,l.send(Se)];case 1:return V=me.sent(),J=V.as(Ek),re=J.isHugeGap,we=J.prevMessages,Z=we===void 0?[]:we,oe=J.prevHasMore,ee=J.isContinuousPrevMessages,ue=J.nextMessages,$=ue===void 0?[]:ue,ke=J.nextHasmore,B=J.isContinuousNextMessages,re?De(function(){return y(he,void 0,void 0,function(){var _e;return g(this,function(fe){return!((_e=this._handler)===null||_e===void 0)&&_e.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(se=this.viewTop,ce=this.viewBottom,ye=Math.min.apply(Math,Pe([Number.MAX_SAFE_INTEGER,se],Ae(Z.map(function(_e){return _e.createdAt})),!1)),ie=Math.max.apply(Math,Pe([0,ce],Ae($.map(function(_e){return _e.createdAt})),!1)),a.dispatch(new Et({messages:Z,source:G.SYNC_MESSAGE_FILL})),a.dispatch(new Et({messages:$,source:G.SYNC_MESSAGE_FILL})),this._syncRange.extends(ye,ie),(ee||B)&&((de=this._backgroundSync)===null||de===void 0||de.range.extends(ye,ie)),oe&&this._prevFill.start(ye),ke&&this._nextFill.start(ie)),[2]}})})},1)];case 4:return H.sent(),[3,7];case 5:return _=H.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(t=(n=u.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[3,13];case 8:E=Date.now(),H.label=9;case 9:return H.trys.push([9,11,12,13]),[4,this._getRemoteMessages(E,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,source:G.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:u.localCacheEnabled})];case 10:if(S=H.sent(),w=S.messages,N=S.isContinuousMessages,I=S.hasNext,w.length>0){for(R=w.map(function(Se){return Se.createdAt}),A=0,x=0,U=0;U=E&&x++;this._hasPrevious=A>=this._prevResultLimit,this._hasNext=I??x>=this._nextResultLimit,(X=this._syncRange).extends.apply(X,Pe([],Ae(R),!1)),N&&((r=this._backgroundSync)===null||r===void 0||r.range.extends(this._syncRange.top,this._syncRange.bottom)),this._addMessagesToView(w,G.SYNC_MESSAGE_FILL)}else this._hasPrevious=!1,this._hasNext=!1;return[3,13];case 11:return(P=H.sent())instanceof L&&P.code===Ie.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(s=(i=u.localCacheConfig)===null||i===void 0?void 0:i.maxSize)!==null&&s!==void 0?s:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 13:return[2]}})})},e.prototype._loadUnsentMessages=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=this,[4,this._channelManager.getUnsentMessagesFromCache(this._channel.url,this.filter)];case 1:return n._unsentMessages=t.sent(),[2]}})})},e.prototype._hasPollMessage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._channelManager.getPollMessagesFromCache(this._channel.url,Date.now()+6e5,this.filter,1)];case 1:return n.sent().length>0?[2,!0]:[2,!1]}})})},e.prototype._refreshChannel=function(n){var t=this;Ot(function(){return y(t,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._channelManager.refreshChannel(this.channel.url,!0,n)];case 1:return r.sent(),[2]}})})})},e.prototype._startCheckMyMutedTimer=function(n){var t=this;this._clearCheckMyMutedTimer(),this._checkMyMutedStateTimer=setTimeout(function(){return y(t,void 0,void 0,function(){var r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:this._checkMyMutedStateTimer=void 0,r=!0,a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,this._channel.getMyMutedInfo()];case 2:return i=a.sent(),r=!i.isMuted,[3,5];case 3:return a.sent(),r=!0,[3,5];case 4:return r&&(s=O.of(this._iid).sessionManager,this.channel._runIfHandleableWithGroupChannel(function(l){var u,c;l.myMutedState=as.UNMUTED;var d={source:G.EVENT_CHANNEL_UNMUTED,user:s.currentUser};(c=(u=o._handler)===null||u===void 0?void 0:u.onChannelUpdated)===null||c===void 0||c.call(u,d,o.channel)})),[7];case 5:return[2]}})})},n+1e3)},e.prototype._clearCheckMyMutedTimer=function(){this._checkMyMutedStateTimer&&(clearTimeout(this._checkMyMutedStateTimer),this._checkMyMutedStateTimer=void 0)},e.prototype.initialize=function(n){var t=this,r=new bk;this._messages=[],this._unsentMessages=[],this._syncRange=new cs({}),this._hasNext=!0,this._hasPrevious=!0,this._refreshChannel(G.REFRESH_CHANNEL);var i=O.of(this._iid),s=i.cacheContext,o=i.statManager;return n===ff.CACHE_AND_REPLACE_BY_API&&this._getLocalMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit}).then(function(a){return y(t,void 0,void 0,function(){var l;return g(this,function(u){switch(u.label){case 0:return l=this._filterUnderOffsetMessage(a),this._addMessagesToView(l,G.REQUEST_MESSAGE),[4,this._loadUnsentMessages()];case 1:return u.sent(),r._invokeResponse("local",null,l),[2]}})})}).catch(function(a){if(Lr(a))throw a;r._invokeResponse("local",a,null)}).finally(function(){var a=O.of(t._iid).cacheContext;t._getRemoteMessages(t._startingPoint,{prevLimit:t._prevResultLimit,nextLimit:t._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:a.localCacheEnabled}).then(function(l){var u,c,d,h,f,p,m=l.messages,b=l.isContinuousMessages,v=l.hasNext,_=t._filterUnderOffsetMessage(m),E=!0;if(t._messages.length===_.length){for(var S=t._messages.map(function(x){return t.keyOf(x)}),w=0;w<_.length;w++)if(!S.includes(t.keyOf(_[w]))){E=!1;break}}else E=!1;if(t._messages=[],_.length>0){var N=_.map(function(x){return x.createdAt}),I=0,R=0;for(w=0;wt._startingPoint&&R++}t._hasPrevious=I>=t._prevResultLimit,t._hasNext=v??R>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,Pe([],Ae(_.map(function(x){return x.createdAt})),!1)),b&&((c=t._backgroundSync)===null||c===void 0||c.range.extends(t._syncRange.top,t._syncRange.bottom)),t._addMessagesToView(_,G.REQUEST_MESSAGE)}else t._hasPrevious=!1,t._hasNext=!1;o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:E?"cache_hit":"cache_miss",max_db_size:(h=(d=a.localCacheConfig)===null||d===void 0?void 0:d.maxSize)!==null&&h!==void 0?h:0,message_init_policy:n,use_local_cache:a.localCacheEnabled,collection_id:t._key}})),o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:"cache_fetch",max_db_size:(p=(f=a.localCacheConfig)===null||f===void 0?void 0:f.maxSize)!==null&&p!==void 0?p:0,message_init_policy:n,use_local_cache:a.localCacheEnabled,collection_id:t._key}})),r._invokeResponse("remote",null,_)}).catch(function(l){if(Lr(l))throw l;r._invokeResponse("remote",l,null)})}),o.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:s.localCacheEnabled,collection_interface:{message_init_policy:n}}})),r},e.prototype.loadPrevious=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=O.of(this._iid),s=i.cacheContext,o=i.statManager,a=i.logger,this._hasPrevious?this._isLoadingPrevious?(a.warn("Messages are already fetching."),[2,[]]):(this._isLoadingPrevious=!0,l=this.viewTop,u=[],[4,Ot(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{prevLimit:this._prevResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._prevResultLimit,o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Ot(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w=this;return g(this,function(N){switch(N.label){case 0:return p=O.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{prevLimit:this._prevResultLimit,reverse:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=N.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Pe([],Ae(u.map(function(I){return I.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(I){return Zr(w._messages,I)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:"cache_fetch",max_db_size:(S=(E=p.localCacheConfig)===null||E===void 0?void 0:E.maxSize)!==null&&S!==void 0?S:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,G.REQUEST_MESSAGE),[3,4];case 3:this._hasPrevious=u.length>=this._prevResultLimit,u.length>0&&this._addMessagesToView(u,G.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingPrevious=!1,[2,u]}})})},e.prototype.loadNext=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=O.of(this._iid),s=i.cacheContext,o=i.statManager,a=i.logger,this._hasNext?this._isLoadingNext?(a.warn("Messages are already fetching."),[2,[]]):(this._isLoadingNext=!0,l=this.viewBottom,u=[],[4,Ot(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{nextLimit:this._nextResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._nextResultLimit,o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Ot(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w,N=this;return g(this,function(I){switch(I.label){case 0:return p=O.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=I.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Pe([],Ae(u.map(function(R){return R.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(R){return Zr(N._messages,R)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:"cache_fetch",max_db_size:(w=(S=p.localCacheConfig)===null||S===void 0?void 0:S.maxSize)!==null&&w!==void 0?w:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,G.REQUEST_MESSAGE),[3,4];case 3:this._hasNext=u.length>=this._nextResultLimit,u.length>0&&this._addMessagesToView(u,G.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingNext=!1,[2,u]}})})},e.prototype.removeFailedMessage=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return[4,this._channelManager.removeFailedMessageFromCache(n)];case 1:return r.sent(),(t=this._unsentMessages.findIndex(function(i){return i.reqId===n}))>-1&&this._unsentMessages.splice(t,1),[2]}})})},e.prototype.dispose=function(){var n,t,r,i=this;if(!this._isDisposed){this._isDisposed=!0;var s=O.of(this._iid),o=s.cacheContext,a=s.dispatcher;this._messages=[],this._clearCheckMyMutedTimer(),this._channel._runIfHandleableWithGroupChannel(function(l){l.myMemberState!==Bt.NONE&&(i._channel._updateMessageCollectionLastAccessedAt(),a.dispatch(new Ve({channels:[i._channel],context:{source:G.CHANNEL_LASTACCESSEDAT_UPDATED}})))}),o.localCacheEnabled&&(this._prevFill.stop(),this._nextFill.stop()),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._pollChangelogSync)===null||r===void 0||r.close(),this._channelManager.unsubscribeChannelEvent(this._key),this._channelManager.unsubscribeMessageEvent(this._key),this._connectionEventContext&&this._connectionEventContext.close()}},e}(),Sk=function(e){function n(t,r){return e.call(this,t,M(M({},r),{channelManager:Nn.of(t)}))||this}return T(n,e),n.prototype.keyOf=function(t){return t.messageId},n.prototype.initialize=function(t){var r=this;return Ot(function(){return y(r,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})}),e.prototype.initialize.call(this,t)},n.prototype.setMessageCollectionHandler=function(t){this._setBaseMessageCollectionHandler(t)},n.prototype._activate=function(){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,Ot(function(){return y(t,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})})];case 2:return r.sent(),[2]}})})},n.prototype._addMessagesToView=function(t,r){var i,s,o=this,a=this._filterUnderOffsetMessage(t),l=[],u=[];try{for(var c=ve(a),d=c.next();!d.done;d=c.next()){var h=d.value;if(r===G.SYNC_MESSAGE_FILL)if(h.messageId>0){if((b=Zr(this._messages,h))<0){Zr(this._unsentMessages,h)<0&&l.push(h);var f=Ap(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Dt&&(b=Zr(this._unsentMessages,h))<0&&Zr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=Zr(this._messages,h))<0){var p=Zr(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=Ap(this._messages,h),this._messages.splice(f,0,h)}else u.push(h),this._messages[b]=h;if(h.updatedAt>0){var m=this._updateChildMessagesInView(h);u.push.apply(u,Pe([],Ae(m),!1))}}else if(h instanceof Dt){var b;(b=Zr(this._unsentMessages,h))<0?Zr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(v){i={error:v}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}Ns(r)&&De(function(){return y(o,void 0,void 0,function(){var v,_,E,S,w;return g(this,function(N){return v={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,v,this.channel,l)),u.length>0&&((w=(S=this._handler)===null||S===void 0?void 0:S.onMessagesUpdated)===null||w===void 0||w.call(S,v,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,o=this,a=[],l=[],u=[];try{for(var c=ve(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=Zr(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=Zr(this._unsentMessages,f);if(p>=0){var m=Ae(this._unsentMessages.splice(p,1),1)[0];if(this.hasNext&&m)u.push(m);else{l.push(f);var b=Ap(this._messages,f);this._messages.splice(b,0,f)}}else{var v=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,Pe([],Ae(v),!1))&&!this._hasNext)&&a.push(f)}}else f instanceof Dt&&(h=Zr(this._unsentMessages,f))>=0&&(l.push(f),this._unsentMessages[h]=f)}}catch(_){i={error:_}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return Ns(r)&&De(function(){return y(o,void 0,void 0,function(){var _,E,S,w,N;return g(this,function(I){return _={source:r},l.length>0?(S=(E=this._handler)===null||E===void 0?void 0:E.onMessagesUpdated)===null||S===void 0||S.call(E,_,this.channel,l):u.length>0?(N=(w=this._handler)===null||w===void 0?void 0:w.onMessagesDeleted)===null||N===void 0||N.call(w,_,this.channel,[],u):a.length>0&&this._addMessagesToView(a,r),[2]})})}),l},n}(Ck),Tk={coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isPublic:void 0,isDiscoverable:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},wk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.token,o=t.limit,a=t.order,l=t.mutedMemberFilter,u=t.memberStateFilter,c=t.nicknameStartsWithFilter,d=t.operatorFilter;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/members"),r.params={token:s,limit:o,order:a,muted_member_filter:l,member_state_filter:u,nickname_startswith:c,operator_filter:d,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0},r}return T(n,e),n}(Y),Nk=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.members=[];var s=r.next,o=r.members;return i.token=s,o&&o.length>0&&(i.members=o.map(function(a){return new ii(t,a)})),i}return T(n,e),n}(ae);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(ac||(ac={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(lc||(lc={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(uc||(uc={}));var Ik=function(e){function n(t,r,i){var s,o,a,l,u=this;return(u=e.call(this,t,r,Ze.GROUP,i)||this).mutedMemberFilter=ac.ALL,u.memberStateFilter=uc.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=df.ALL,u.order=lc.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:ac.ALL,u.memberStateFilter=(o=i.memberStateFilter)!==null&&o!==void 0?o:uc.ALL,u.nicknameStartsWithFilter=(a=i.nicknameStartsWithFilter)!==null&&a!==void 0?a:null,u.order=(l=i.order)!==null&&l!==void 0?l:lc.MEMBER_NICKNAME_ALPHABETICAL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Ge(ac,this.mutedMemberFilter)&&Ge(uc,this.memberStateFilter)&&(k("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&Ge(df,this.operatorFilter)&&Ge(lc,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new wk(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Nk),o=s.members,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),Ak=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(Y),Mk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Bt.JOINED,i}return T(n,e),n}(ae),xk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.isDistinct,o=t.isPublic,a=t.isDiscoverable,l=t.coverUrl,u=t.coverImage,c=t.accessCode,d=t.name,h=t.data,f=t.customType,p=t.operatorUserIds,m=t.messageSurvivalSeconds;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i)),r.params=Ee({is_distinct:s,is_public:o,is_discoverable:a,name:d,data:h,custom_type:f,cover_url:l,cover_file:u,access_code:c,operator_ids:p,message_survival_seconds:m}),r}return T(n,e),n}(Y),Ok=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),kk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(ir,"/").concat(encodeURIComponent(i)),r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var Rk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/hide"),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var Lk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),o.params={count_preference:s},o}return T(n,e),n}(Y),Dk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.countPreference=r.count_preference,i}return T(n,e),n}(ae),Uk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return T(n,e),n}(Y),Pk=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(ae),Fk=M(M({},Zv),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),Hk=M(M({},uS),{scheduledAt:void 0}),jk=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(c){return c.userId})));var a=t.channelType,l=t.channelUrl,u=t.scheduledMessageId;return s.method=Q.PUT,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(c){return Vs.payloadify(c)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:o,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(c){return pr.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return T(n,e),n}(Y),Bk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Zt(t,r),i}return T(n,e),n}(ae),$k=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(u){return u.userId})));var o=t.channelType,a=t.channelUrl,l=t.scheduledMessageId;return i.method=Q.PUT,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(u){return pr.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}T(n,e)})(ae);var Gk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Q.DELETE,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y),zk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Q.POST,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o),"/send_now"),r}return T(n,e),n}(Y),Vk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),o.params={push_trigger_option:s},o}return T(n,e),n}(Y),qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(ae),Wk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y),Kk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(ae),Qk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Q.POST,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var Yk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Q.DELETE,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var ti,cr,Zk=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=vr(t,r.message),i}return T(n,e),n}(Wn),Xk=function(e){function n(t){var r=this,i=t.channelType,s=t.channelUrl,o=t.limit,a=t.token,l=t.includeReactions,u=t.includeMetaArray,c=t.includeParentMessageInfo,d=t.includeThreadInfo,h=t.includePollDetails;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=Ee({limit:o,token:a,include_reactions:l,with_sorted_meta_array:u,include_thread_info:d,include_parent_message_info:c,include_poll_details:h}),r}return T(n,e),n}(Y),Jk=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.pinned_messages,o=r.has_more,a=r.next;return i.pinnedMessages=s.map(function(l){return new Zk(t,l)}),i.hasMore=o,i.token=a,i}return T(n,e),n}(ae),eR=function(e){function n(t,r,i,s){var o=e.call(this,t,r,i,s)||this;return o.includeMetaArray=s.includeMetaArray,o.includeReactions=s.includeReactions,o.includeParentMessageInfo=s.includeParentMessageInfo,o.includeThreadInfo=s.includeThreadInfo,o.includePollDetails=s.includePollDetails,o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeMetaArray,!0)&&k("boolean",this.includeReactions,!0)&&k("boolean",this.includeParentMessageInfo,!0)&&k("boolean",this.includeThreadInfo,!0)&&k("boolean",this.includePollDetails,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new Xk(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(Jk),o=s.pinnedMessages,a=s.hasMore,l=s.token,this._token=l,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs);(function(e){e.ALL="all",e.UNREAD_MESSAGE_COUNT_ONLY="unread_message_count_only",e.UNREAD_MENTION_COUNT_ONLY="unread_mention_count_only",e.OFF="off"})(ti||(ti={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(cr||(cr={}));var di=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A=this;return(A=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,A._undeliveredMemberStateMap=new Map,A._typingStatus=new Map,A._lastMemberCountUpdated=0,A._typingStarted=0,A._typingEnded=0,A.isDistinct=!1,A.isSuper=!1,A.isBroadcast=!1,A.isExclusive=!1,A.isPublic=!1,A.isDiscoverable=!0,A.isChatNotification=!1,A.isAccessCodeRequired=!1,A.isPushEnabled=!1,A.unreadMessageCount=0,A.unreadMentionCount=0,A.totalUnreadReplyCount=0,A.members=[],A.memberCount=0,A.joinedMemberCount=0,A.hiddenState=cr.UNHIDDEN,A.lastMessage=null,A.messageOffsetTimestamp=0,A.messageSurvivalSeconds=-1,A.myMemberState=Bt.NONE,A.myRole=Ii.NONE,A.myMutedState=as.UNMUTED,A.myLastRead=0,A.myCountPreference=ti.ALL,A.myPushTriggerOption=ta.DEFAULT,A.inviter=null,A.invitedAt=0,A.joinedAt=0,A.pinnedMessageIds=[],A.lastPinnedMessage=null,A._pinnedMessagesUpdatedAt=0,A._myMutedRemainingTime=-1,A.channelType=Ze.GROUP,A.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,A.isSuper=(o=r.is_super)!==null&&o!==void 0&&o,A.isBroadcast=(a=r.is_broadcast)!==null&&a!==void 0&&a,A.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,A.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,A.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:A.isPublic,A.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,A.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,A.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=A.members).push.apply(i,Pe([],Ae(r.members.map(function(x){return new ii(A._iid,x)})),!1)),A.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,A.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,A.hiddenState=Ge(cr,r.hidden_state)?r.hidden_state:cr.UNHIDDEN,A.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,A.messageSurvivalSeconds=(v=r.message_survival_seconds)!==null&&v!==void 0?v:-1,A.lastMessage=r.last_message?vr(A._iid,M({channel_type:A.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(x){k("number",r.read_receipt[x])&&A._updateUnreadMemberState(x,r.read_receipt[x])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(x){k("number",r.delivery_receipt[x])&&A._updateUndeliveredMemberState(x,r.delivery_receipt[x])}),A.myMemberState=Ge(Bt,r.member_state)?r.member_state:Bt.NONE,A.myRole=Ge(Ii,r.my_role)?r.my_role:Ii.NONE,Ge(as,r.is_muted)?A.myMutedState=r.is_muted:k("boolean",r.is_muted)?A.myMutedState=r.is_muted?as.MUTED:as.UNMUTED:A.myMutedState=as.UNMUTED,A.myCountPreference=Ge(ti,r.count_preference)?r.count_preference:ti.ALL,A.myPushTriggerOption=Ge(ta,r.push_trigger_option)?r.push_trigger_option:ta.ALL,A.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,A.inviter=r.inviter?new Ke(A._iid,r.inviter):null,A.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,A.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,A._updateUnreadCount((w=r.unread_message_count)!==null&&w!==void 0?w:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),A.totalUnreadReplyCount=(I=r.total_unread_thread_message_count)!==null&&I!==void 0?I:0,A.pinnedMessageIds=(R=r.pinned_message_ids)!==null&&R!==void 0?R:[],A.lastPinnedMessage=r.latest_pinned_message?vr(A._iid,M({channel_type:A.channelType},r.latest_pinned_message)):null,A}return T(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==cr.UNHIDDEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTyping",{get:function(){return this._typingStatus.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUnreadMemberState",{get:function(){var t,r,i={};try{for(var s=ve(this._unreadMemberStateMap),o=s.next();!o.done;o=s.next()){var a=Ae(o.value,2),l=a[0],u=a[1];i[l]=u}}catch(c){t={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUndeliveredMemberState",{get:function(){var t,r,i={};try{for(var s=ve(this._undeliveredMemberStateMap),o=s.next();!o.done;o=s.next()){var a=Ae(o.value,2),l=a[0],u=a[1];i[l]=u}}catch(c){t={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{is_access_code_required:t.isAccessCodeRequired,is_distinct:t.isDistinct,is_super:t.isSuper,is_broadcast:t.isBroadcast,is_exclusive:t.isExclusive,is_public:t.isPublic,is_discoverable:t.isDiscoverable,is_muted:t.myMutedState,is_push_enabled:t.isPushEnabled,unread_message_count:t.unreadMessageCount,unread_mention_count:t.unreadMentionCount,total_unread_thread_message_count:t.totalUnreadReplyCount,push_trigger_option:t.myPushTriggerOption,count_preference:t.myCountPreference,hidden_state:t.hiddenState,member_count:t.memberCount,joined_member_count:t.joinedMemberCount,member_state:t.myMemberState,my_role:t.myRole,user_last_read:t.myLastRead,ts_message_offset:t.messageOffsetTimestamp,message_survival_seconds:t.messageSurvivalSeconds,read_receipt:t.cachedUnreadMemberState,delivery_receipt:t.cachedUndeliveredMemberState,members:t.members.map(function(r){return ii.payloadify(r)}),last_message:t.lastMessage?P1(t.lastMessage):null,inviter:t.inviter?Ke.payloadify(t.inviter):null,invited_at:t.invitedAt,joined_ts:t.joinedAt,pinned_message_ids:t.pinnedMessageIds,latest_pinned_message:t.lastPinnedMessage?P1(t.lastPinnedMessage):null})))},n.prototype._shouldUpdateLastMessageWith=function(t){if(t.silent)return!1;var r=O.of(this._iid).appInfo;switch(r==null?void 0:r.lastMessageThreadingPolicy){case sa.NONE:case sa.INCLUDE_REPLY:break;case sa.EXCLUDE_REPLY:if(t.parentMessageId>0)return!1;break;case sa.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Dt&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt0)return!1;break;case ia.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Dt&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!0},n.prototype._updateLastMessage=function(t){return!!this._shouldUpdateLastMessageWith(t)&&(this.lastMessage=t,!0)},n.prototype._updateUnreadCount=function(t,r){if(typeof t=="number"&&t>=0)if(this.myCountPreference===ti.ALL||this.myCountPreference===ti.UNREAD_MESSAGE_COUNT_ONLY)if(this.isExclusive||this.isSuper||this.isBroadcast){var i=O.of(this._iid).maxSuperGroupChannelUnreadCount;this.unreadMessageCount=i&&t>=i?i:t}else this.unreadMessageCount=t;else this.unreadMessageCount=0;else this.unreadMessageCount=0;typeof r=="number"&&r>=0&&(this.myCountPreference===ti.ALL||this.myCountPreference===ti.UNREAD_MENTION_COUNT_ONLY)?this.unreadMentionCount=r:this.unreadMentionCount=0},n.prototype._updateUnreadMemberState=function(t,r){var i=this._unreadMemberStateMap.get(t);return(!i||i0?this._typingStatus.set(t.userId,{user:t,ts:r}):this._typingStatus.delete(t.userId)},n.prototype._clearTypingStatus=function(){this._typingStatus.clear(),this._typingStarted=0,this._typingEnded=0},n.prototype._setLatestMemberCount=function(t,r,i){var s=!1;return i>=this._lastMemberCountUpdated&&(this._lastMemberCountUpdated=i,s=t!==this.memberCount||r!==this.joinedMemberCount,this.memberCount=t,this.joinedMemberCount=r),s},n.prototype.isReadMessage=function(t){var r=O.of(this._iid).sdkState,i=this._unreadMemberStateMap.get(r.userId);return!!i&&i>=t.createdAt},n.prototype.serialize=function(){var t=this;return Kc(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new Sk(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new Ik(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new dO(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new eR(this._iid,this.url,this.channelType,t)},n.prototype.addMember=function(t,r){if(r===void 0&&(r=0),!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var i=this.members.findIndex(function(o){return o.userId===t.userId});if(i>-1){var s=this.members[i];s.state===Bt.JOINED&&(t.state=s.state),this.members.splice(i,1),this.memberCount--}this.members.push(t),this.memberCount++,this._updateUnreadMemberState(t.userId,r),this._updateUndeliveredMemberState(t.userId,r)}},n.prototype.removeMember=function(t){if(!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var r=t instanceof ii?t.userId:t,i=this.members.findIndex(function(s){return s.userId===r});if(i>-1)return this.members.splice(i,1),this.memberCount--,!0}return!1},n.prototype.getUnreadMemberCount=function(t){var r,i;if(t instanceof Dt&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=O.of(this._iid).sdkState,o=t.createdAt,a=0;try{for(var l=ve(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===Bt.JOINED&&t.sender.userId!==c.userId&&(this.cachedUnreadMemberState[c.userId]||0)=t.createdAt&&a.push(l)}}),a},n.prototype.getUnreadMembers=function(t,r){var i=this;r===void 0&&(r=!1);var s=O.of(this._iid).sdkState;if(!s.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var o=t instanceof Dt?t.sender:null,a=[];return this.members.forEach(function(l){if(r||l.userId!==s.userId&&l.userId!==(o==null?void 0:o.userId)){var u=i._unreadMemberStateMap.get(l.userId);u&&u=r&&(t._typingStatus.delete(a),s=!0)}),s},n.prototype.refresh=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this._refresh()]})})},n.prototype._refresh=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new mm({channelUrl:this.url}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(vm).channel,this._update(l),t||s.dispatch(new Ve({channels:[l],context:{source:G.REFRESH_CHANNEL}})),[2,this]}})})},n.prototype.freeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.freeze.call(this)];case 1:return t.sent(),O.of(this._iid).dispatcher.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_FROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.unfreeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.unfreeze.call(this)];case 1:return t.sent(),O.of(this._iid).dispatcher.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UNFROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.updateChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return r=M(M({},Tk),t),K(function(d){return k("string",d.coverUrl,!0)&&(fr(d.coverImage)||k("string",d.coverImage,!0))&&k("boolean",d.isDistinct,!0)&&k("boolean",d.isPublic,!0)&&k("boolean",d.isDiscoverable,!0)&&k("string",d.accessCode,!0)&&k("string",d.name,!0)&&k("string",d.data,!0)&&k("string",d.customType,!0)&&We("string",d.operatorUserIds,!0)&&k("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.requestQueue,a=new xk(M({channelUrl:this.url},r)),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Ok).channel,this._update(u),s.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.invite=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(t.every(function(i){return i instanceof Ke})).throw(L.invalidParameters),[2,this.inviteWithUserIds(t.map(function(i){return i.userId}))]})})},n.prototype.inviteWithUserIds=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(We("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.requestQueue,o=r.sessionManager,a=new ek({channelUrl:this.url,userIds:t}),[4,s.send(a)];case 1:return l=c.sent(),u=l.as(tk).channel,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_INVITED,inviter:o.currentUser,invitees:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.join=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new QO({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(YO).channel).myMemberState=this.myMemberState=Bt.JOINED,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_JOINED,users:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.leave=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new XO({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(o)];case 1:return a.sent(),this.myMemberState=Bt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Ak({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(Mk).channel).myMemberState=this.myMemberState=Bt.JOINED,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_ACCEPTED_INVITE},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.declineInvitation=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new rk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.myMemberState=Bt.NONE,[2,this]}})})},n.prototype.sendUserMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype.sendUserMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){l&&o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){r.hiddenState===cr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=cr.UNHIDDEN),o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),Nn.of(r._iid).handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:return i=O.of(this._iid).dispatcher,[4,e.prototype.updateUserMessage.call(this,t,r)];case 1:return s=u.sent(),o=this._updateLastMessage(s),a=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,o=!0,a=!0),o&&(Nn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new Ve({channels:[this],context:{source:a?G.EVENT_PINNED_MESSAGE_UPDATED:G.EVENT_MESSAGE_UPDATED}}))),a&&Nn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Et({messages:[s],source:G.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendUserMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype._autoResendUserMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.sendFileMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype.sendFileMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){l&&o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.sendMultipleFilesMessage=function(t){var r=this,i=new hh,s=O.of(this._iid).dispatcher;return e.prototype.sendMultipleFilesMessage.call(this,t).onPending(function(o){i._trigger(o)}).onFailed(function(o,a){i._triggerFailed(o,a)}).onSucceeded(function(o){var a=Nn.of(r._iid);r._updateLastMessage(o),a.handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(o)}).onFileUploaded(function(o,a,l,u){i._triggerOnFileUploaded(o,a,l,u)}),i},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:return i=O.of(this._iid).dispatcher,[4,e.prototype.updateFileMessage.call(this,t,r)];case 1:return s=u.sent(),o=this._updateLastMessage(s),a=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,o=!0,a=!0),o&&(Nn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new Ve({channels:[this],context:{source:a?G.EVENT_PINNED_MESSAGE_UPDATED:G.EVENT_MESSAGE_UPDATED}}))),a&&Nn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Et({messages:[s],source:G.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendFileMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype._autoResendFileMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.deleteMessage.call(this,t)];case 1:return r.sent(),t.messageId===0&&t instanceof Dt&&O.of(this._iid).dispatcher.dispatch(new $C({reqId:t.reqId,source:G.EVENT_MESSAGE_DELETED})),[2]}})})},n.prototype.hide=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return r=M(M({},gm),t),K(function(h){return k("boolean",h.hidePreviousMessages,!0)&&k("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.sdkState,a=i.requestQueue,l=new sk(M({channelUrl:this.url,userId:o.userId},r)),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(ok).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?cr.HIDDEN_ALLOW_AUTO_UNHIDE:cr.HIDDEN_PREVENT_AUTO_UNHIDE,r.hidePreviousMessages&&this._updateUnreadCount(0,0),c&&(this.messageOffsetTimestamp=c),s.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_HIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.unhide=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Rk({channelUrl:this.url}),[4,i.send(s)];case 1:return o.sent(),this.hiddenState=cr.UNHIDDEN,r.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UNHIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.delete=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new kk({channelUrl:this.url}),[4,t.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=new G6({channelUrl:this.url}),[4,s.send(o)];case 1:return a=c.sent(),l=a.as(tS).readStatus,this._updateUnreadMemberState(r.userId,l.readAt),(this.unreadMessageCount>0||this.unreadMentionCount>0)&&(this._updateUnreadCount(0,0),Nn.of(this._iid).handlers.map(function(d){d.onChannelChanged&&d.onChannelChanged(u)})),i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_READ}})),[2]}})})},n.prototype.markAsDelivered=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new pk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},n.prototype.startTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingStarted>=i?(this._typingStarted=s,this._typingEnded=0,o=new lk({channelUrl:this.url,time:this._typingStarted}),[4,r.send(o)]):[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})},n.prototype.endTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingEnded>=i?(this._typingStarted=0,this._typingEnded=s,o=new ck({channelUrl:this.url,time:this._typingStarted}),[4,r.send(o)]):[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})},n.prototype.createScheduledUserMessage=function(t){t=M(M({},Qx),t),K(Yx(t)).throw(L.invalidParameters);var r=new Br;return this._createScheduledUserMessage(t,r),r},n.prototype.updateScheduledUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=M(M({},Hk),r),K(function(u){return cS(u)&&k("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new $k(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(hS).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},Zx),t),K(Xx(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),o=new Br;return Or(wx).then(function(){var a=r._createPendingScheduledFileMessage(t,s,i);De(function(){return y(r,void 0,void 0,function(){return g(this,function(l){return[2,o._trigger(a)]})})})}),fr(t.file)?this._uploadFileAndUpdateParams(t).then(function(){return r._createScheduledFileMessage(t,o,s,i)}):this._createScheduledFileMessage(t,o,s,i),o},n.prototype.updateScheduledFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return i=M(M({},Fk),r),K(function(l){return Xv(l)&&k("number",l.scheduledAt,!0)&&(fr(l.file)||k("string",l.fileUrl))&&k("string",l.fileName,!0)&&k("string",l.mimeType,!0)&&k("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return k("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),fr(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:a.sent(),a.label=2;case 2:return s=new jk(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,O.of(this._iid).requestQueue.send(s)];case 3:return o=a.sent(),[2,o.as(Bk).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new Gk({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,O.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.sendScheduledMessageNow=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new zk({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,O.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.getMyPushTriggerOption=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Wk({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Kk).pushTriggerOption,this.myPushTriggerOption=a,[2,a]}})})},n.prototype.setMyPushTriggerOption=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(Ge(ta,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Vk({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(qk).pushTriggerOption,this.myPushTriggerOption=u,i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.setMyCountPreference=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(Ge(ti,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Lk({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Dk).countPreference,this.myCountPreference=u,this._updateUnreadCount(this.unreadMessageCount,this.unreadMentionCount),i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.resetMyHistory=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Uk({channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Pk).messageOffsetTimestamp,this.messageOffsetTimestamp=a,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new Qk({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype.unpinMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return K(k("number",t)&&t>0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new Yk({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype._uploadFileAndUpdateParams=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return fr(t.file)?(r=O.of(this._iid).requestQueue,i=new sf({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:this._generateRequestId()}),[4,r.send(i)]):[3,2];case 1:s=f.sent(),o=s.as(of),a=o.url,l=o.fileSize,u=l===void 0?t.fileSize:l,c=o.thumbnails,d=o.requireAuth,h=d!==void 0&&d,t.fileUrl=a,t.fileSize=u,t.requireAuth=h,t._thumbnails=c,f.label=2;case 2:return[2]}})})},n.prototype.resendMessage=function(t,r){var i,s=this;if(K(t instanceof Dt&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:sm(t),a=new Br;return this._sendUserMessage(o,Yn.RESEND,t.reqId).onPending(function(d){a._trigger(d)}).onFailed(function(d,h){a._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),a._trigger(d)}),a}if(t.isFileMessage()){var l=this._validateFailedFileMessageHasFile(t,r);K(l).throw(L.invalidParameters),o=om(t,r);var u=new Br;return this._sendFileMessage(o,Yn.RESEND,t.reqId).onPending(function(d){u._trigger(d)}).onFailed(function(d,h){u._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),u._trigger(d)}),u}if(t.isMultipleFilesMessage()){o=t.messageParams;var c=new hh;return this._sendMultipleFilesMessage(o,Yn.RESEND,t.reqId).onPending(function(d){c._trigger(d)}).onFailed(function(d,h){c._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),c._trigger(d)}).onFileUploaded(function(d,h,f,p){c._triggerOnFileUploaded(d,h,f,p)}),c}},n.prototype.copyMessage=function(t,r){var i=this;if(K(t instanceof X1&&r instanceof Dt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){K(!r.poll).throw(L.notSupportedError);var s=oS(r),o=new Br;return t._sendUserMessage(s).onPending(function(u){o._trigger(u)}).onFailed(function(u,c){o._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),o._trigger(u)}),o}if(r.isFileMessage()){s=lS(r);var a=new Br;return t._sendFileMessage(s).onPending(function(u){a._trigger(u)}).onFailed(function(u,c){a._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),a._trigger(u)}),a}if(r.isMultipleFilesMessage()){if(t.isGroupChannel()){s=Cx(r);var l=new hh;return t._sendMultipleFilesMessage(s,Yn.COPY).onPending(function(u){l._trigger(u)}).onFailed(function(u,c){l._triggerFailed(u,c)}).onSucceeded(function(u){i._tryUpdateLastMessageAndCallEvents(t,u),l._trigger(u)}).onFileUploaded(function(u,c,d,h){l._triggerOnFileUploaded(u,c,d,h)}),l}throw L.channelTypeNotSupportedError}},n}(X1),tR=function(){this.onUserMuted=qe,this.onUserUnmuted=qe,this.onUserBanned=qe,this.onUserUnbanned=qe,this.onChannelChanged=qe,this.onChannelDeleted=qe,this.onChannelFrozen=qe,this.onChannelUnfrozen=qe,this.onOperatorUpdated=qe,this.onChannelMemberCountChanged=qe,this.onMetaDataCreated=qe,this.onMetaDataUpdated=qe,this.onMetaDataDeleted=qe,this.onMetaCounterCreated=qe,this.onMetaCounterUpdated=qe,this.onMetaCounterDeleted=qe,this.onMessageReceived=qe,this.onMessageUpdated=qe,this.onMessageDeleted=qe,this.onMentionReceived=qe,this.onReactionUpdated=qe,this.onThreadInfoUpdated=qe},cc,Qs={},nR=function(){function e(n){var t=n._iid,r=n.limit,i=r===void 0?100:r,s=this;this.ref=0,this._iid=t,this._limit=i;var o,a=O.of(this._iid),l=a.sdkState,u=a.dispatcher,c=a.logger,d=a.cacheContext;this._metadataKey=(o=l.userId,"sendbird:".concat(o,"@groupchannel/sync.meta"));var h=function(f){return"sendbird:".concat(f,"@groupchannel/sync")}(l.userId);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S,w,N,I,R;return g(this,function(A){switch(A.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(A.sent(),c.debug("channel background sync from",(w=this._metadata)===null||w===void 0?void 0:w.token),(N=this._metadata)===null||N===void 0?void 0:N.completed)return[3,13];A.label=2;case 2:if(A.trys.push([2,9,,12]),(p={includeEmpty:!0,order:Pt.CHRONOLOGICAL}).order!==Pt.LATEST_LAST_MESSAGE)return[3,6];A.label=3;case 3:return A.trys.push([3,5,,6]),[4,d.preference.get(zv(l.appId))];case 4:return m=A.sent(),p.includeChatNotification=!!m,[3,6];case 5:return A.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannels((R=(I=this._metadata)===null||I===void 0?void 0:I.token)!==null&&R!==void 0?R:"",p,this._limit,G.SYNC_CHANNEL_BACKGROUND)];case 7:return b=A.sent(),v=b.channels,_=b.token,f.hasNext=v.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,Pe([],Ae(v.map(function(x){return x.createdAt})),!1)),this._metadata.completed=!f.hasNext),c.debug("channel background sync progress",f),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),c.debug("channel background sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetaData()]:[3,11];case 10:A.sent(),A.label=11;case 11:throw E;case 12:return[3,14];case 13:f.hasNext=!1,f.nextToken="",A.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return Qs[n]||(Qs[n]=new e({_iid:n})),Qs[n].ref++,Qs[n]},e.clear=function(n){Qs[n]&&(Qs[n].close(),delete Qs[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new cs({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"completed",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.completed)},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata={token:n?n.token:"",range:new cs(n?n.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!n&&n.completed},t.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetaData=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n,t,r=O.of(this._iid),i=r.logger;r.sessionManager.session.hasSession&&(i.debug("channel background sync resume()"),this._sync.start((t=(n=this._metadata)===null||n===void 0?void 0:n.token)!==null&&t!==void 0?t:""))},e.prototype.pause=function(){O.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Qs[this._iid])},e}(),Ys={},rR=function(){function e(n){var t=n._iid,r=this;this.ref=0,this._iid=t;var i,s=O.of(this._iid),o=s.logger,a=s.sdkState,l=s.dispatcher,u=s.cacheContext;this._metadataKey=(i=a.userId,"sendbird:".concat(i,"@groupchannel/changelogs.meta")),this._subscribers=new Ra;var c=function(d){return"sendbird:".concat(d,"@groupchannel/changelogs")}(a.userId);this._sync=new ko(c,function(){return y(r,void 0,void 0,function(){var d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:I.sent(),o.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),I.label=2;case 2:I.trys.push([2,9,,12]),h={includeEmpty:!0},I.label=3;case 3:return I.trys.push([3,5,,6]),[4,u.preference.get(zv(a.appId))];case 4:return f=I.sent(),h.includeChatNotification=!!f,[3,6];case 5:return I.sent(),h.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannelChangeLogs((N=(w=this._metadata)===null||w===void 0?void 0:w.token)!==null&&N!==void 0?N:"",h,G.SYNC_CHANNEL_CHANGELOGS)];case 7:return p=I.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,v=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:v,token:_}),d.hasNext=v,d.nextToken=_,this._metadata&&(this._metadata.token=_),o.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return I.sent(),[3,12];case 9:return E=I.sent(),o.debug("channel changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,11];case 10:I.sent(),I.label=11;case 11:throw E;case 12:return[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof _i&&(d.stateType===st.CONNECTED?r.resume():r.pause())})}return e.of=function(n){return Ys[n]||(Ys[n]=new e({_iid:n})),Ys[n].ref++,Ys[n]},e.clear=function(n){Ys[n]&&(Ys[n].close(),delete Ys[n])},Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._sync.isRunning},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=O.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.on=function(n,t){return this._subscribers.on(n,t)},e.prototype.resume=function(){O.of(this._iid).sessionManager.session.hasSession&&this._sync.start(0)},e.prototype.pause=function(){this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Ys[this._iid])},e}(),vh=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},hy=function(e,n,t){if(e.length>0){for(var r=vh(e,n),i=0,s=e.length-1,o=Math.floor((i+s)/2);i0)s=o,o=Math.floor((i+s)/2);else{if(!(a<0))return{place:o,oldPosition:r};i=o+1,o=Math.floor((i+s)/2)}}return{place:fy(e[o],n,t)>=0?o:o+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},fy=function(e,n,t){switch(t){case Pt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?n.lastMessage.createdAt-e.lastMessage.createdAt:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case Pt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case Pt.CHANNEL_NAME_ALPHABETICAL:var r=e.name.localeCompare(n.name);return r===0?e.createdAt-n.createdAt:r;default:return 0}},iR=function(){function e(n,t){var r=t.filter,i=r===void 0?new NS:r,s=t.order,o=s===void 0?Pt.LATEST_LAST_MESSAGE:s,a=t.limit,l=a===void 0?pS:a,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat($s()),this._isDisposed=!1,this._isGetRemoteChannelsSucceeded=!0,this._includeChangesOnInitialLoad=c,this.filter=i,this.order=o,this._hasMore=!0,this._token="",this._limit=l;var h=O.of(this._iid),f=h.sdkState,p=h.cacheContext,m=h.dispatcher;p.localCacheEnabled&&(this._backgroundSync=nR.of(n),this._backgroundSync.resume()),this._changelogSync=rR.of(n),this._changelogSync.resume(),Nn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,v){var _=v.source;if(mh(_)){var E=b.filter(function(w){return d.filter.match(w,f.userId)}),S=b.filter(function(w){return!d.filter.match(w,f.userId)}).map(function(w){return w.url});E.length>0&&d._addChannelsToView(E,v),S.length>0&&d._removeChannelsFromView(S,v)}},onRemove:function(b,v){d._removeChannelsFromView(b,v)}}),O.of(this._iid).statManager.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof _i&&(b.stateType===st.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return g(this,function(v){switch(v.label){case 0:return[4,this._revokeLoadMore()];case 1:return v.sent(),[2]}})}):b.stateType===st.LOGOUT&&d.dispose())})}return Object.defineProperty(e.prototype,"hasMore",{get:function(){return!this._isDisposed&&this._hasMore},enumerable:!1,configurable:!0}),e.prototype.setGroupChannelCollectionHandler=function(n){this._handler=n},e.prototype._addChannelsToView=function(n,t,r){var i,s,o,a,l=this;r===void 0&&(r=!1);var u=[],c=[],d=[];try{for(var h=ve(n),f=h.next();!f.done;f=h.next()){var p=f.value,m=vh(this.channels,p);m>=0&&this.channels.splice(m,1);var b=hy(this.channels,p,this.order).place;if(m<0)b===this.channels.length?!r&&this._hasMore||(u.push(p),this.channels.push(p)):(u.push(p),this.channels.splice(b,0,p));else switch(t.source){case G.EVENT_CHANNEL_UPDATED:case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_CHANNEL_CHANGELOGS:case G.EVENT_MESSAGE_SENT:this.order===Pt.CHANNEL_NAME_ALPHABETICAL&&this._hasMore&&b===this.channels.length?d.push(p):(this.channels.splice(b,0,p),c.push(p));break;default:this.channels.splice(b,0,p),c.push(p)}}}catch(S){i={error:S}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.length>0)try{for(var v=ve(d),_=v.next();!_.done;_=v.next()){p=_.value;var E=vh(this.channels,p);E!==-1&&this.channels.splice(E,1)}}catch(S){o={error:S}}finally{try{_&&!_.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}mh(t.source)&&De(function(){return y(l,void 0,void 0,function(){var S,w,N;return g(this,function(I){return u.length>0&&(!((S=this._handler)===null||S===void 0)&&S.onChannelsAdded)&&this._handler.onChannelsAdded(t,u),c.length>0&&(!((w=this._handler)===null||w===void 0)&&w.onChannelsUpdated)&&this._handler.onChannelsUpdated(t,c),d.length>0&&(!((N=this._handler)===null||N===void 0)&&N.onChannelsDeleted)&&this._handler.onChannelsDeleted(t,d.map(function(R){return R.url})),[2]})})})},e.prototype._removeChannelsFromView=function(n,t){var r,i,s=this,o=[],a=function(d){var h=l.channels.findIndex(function(f){return f.url===d});h>=0&&(o.push(l.channels[h].url),l.channels.splice(h,1))},l=this;try{for(var u=ve(n),c=u.next();!c.done;c=u.next())a(c.value)}catch(d){r={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return mh(t.source)&&o.length>0&&De(function(){return y(s,void 0,void 0,function(){var d;return g(this,function(h){return!((d=this._handler)===null||d===void 0)&&d.onChannelsDeleted&&this._handler.onChannelsDeleted(t,o),[2]})})}),o},e.prototype._getLocalChannels=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Nn.of(this._iid),t=this.channels.length>0?function(i,s){var o,a,l,u;switch(s){case Pt.LATEST_LAST_MESSAGE:return(a=(o=i.lastMessage)===null||o===void 0?void 0:o.createdAt)!==null&&a!==void 0?a:i.createdAt;case Pt.CHRONOLOGICAL:return i.createdAt;case Pt.CHANNEL_NAME_ALPHABETICAL:return i.name;default:return(u=(l=i.lastMessage)===null||l===void 0?void 0:l.createdAt)!==null&&u!==void 0?u:i.createdAt}}(this.channels[this.channels.length-1],this.order):null,[4,n.getChannelsFromCache(t,this.filter,this.order,this._limit,t?this.channels[this.channels.length-1].url:void 0)];case 1:return[2,r.sent()]}})})},e.prototype._getRemoteChannels=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ne(M(M({},this.filter),{order:this.order})),this._limit)];case 1:return n=i.sent(),t=n.channels,r=n.token,this._token=r,this._hasMore=!!r,[2,t]}})})},e.prototype._revokeLoadMore=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:if(this._isDisposed)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._getRemoteChannels()];case 2:return n=t.sent(),this._isGetRemoteChannelsSucceeded=!0,this._addChannelsToView(n,{source:G.REQUEST_CHANNEL},!0),[3,4];case 3:return t.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,4];case 4:return[2]}})})},e.prototype.loadMore=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S=this;return g(this,function(w){switch(w.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return t=null,this._includeChangesOnInitialLoad&&this.channels.length===0&&this._changelogSync.isRunning?[4,new Promise(function(N){S._changelogSyncSubscriberContext=S._changelogSync.on("progress",function(I){return N(I)}).on("pause",function(){return N(null)})})]:[3,2];case 1:t=w.sent(),(n=this._changelogSyncSubscriberContext)===null||n===void 0||n.close(),w.label=2;case 2:return r=[],this._hasMore?(i=O.of(this._iid),s=i.cacheContext,o=i.connectionManager,!s.localCacheEnabled||o.isConnected&&!this._backgroundSync.completed?[3,4]:[4,Ot(function(){return y(S,void 0,void 0,function(){return g(this,function(N){switch(N.label){case 0:return[4,this._getLocalChannels()];case 1:return r=N.sent(),[2]}})})})]):[3,8];case 3:return w.sent(),this._hasMore=r.length>=this._limit,[3,7];case 4:return w.trys.push([4,6,,7]),[4,this._getRemoteChannels()];case 5:return r=w.sent(),this._isGetRemoteChannelsSucceeded=!0,[3,7];case 6:return w.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,7];case 7:this._addChannelsToView(r,{source:G.REQUEST_CHANNEL},!0),w.label=8;case 8:if(t){try{for(a=ve(t.updatedChannels),l=a.next();!l.done;l=a.next())u=l.value,(m=vh(r,u))>=0?r[m]=u:(c=hy(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(v=a.return)&&v.call(a)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=ve(t.deletedChannelUrls),f=h.next();!f.done;f=h.next())p=f.value,(m=d.indexOf(p))>=0&&(r.splice(m,1),d.splice(m,1))}catch(N){_={error:N}}finally{try{f&&!f.done&&(E=h.return)&&E.call(h)}finally{if(_)throw _.error}}}return[2,r]}})})},e.prototype.dispose=function(){var n,t,r;this._isDisposed||(this._isDisposed=!0,this.channels.length>0&&this.channels.splice(0,this.channels.length),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._changelogSyncSubscriberContext)===null||r===void 0||r.close(),Nn.of(this._iid).unsubscribeChannelEvent(this._key))},e}(),sR=function(e){function n(t){var r=this,i=t.token,s=t.limit,o=t.order,a=t.includeEmpty,l=t.membershipFilter,u=t.channelNameContainsFilter,c=t.channelUrlsFilter,d=t.customTypesFilter,h=t.customTypeStartsWithFilter,f=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,b=t.metadataValues,v=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Q.GET,r.path=ir,r.params=Ee(Ne({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:a,public_mode:ms.PUBLIC,public_membership_mode:l,name_contains:u,channel_urls:c,custom_types:d,custom_type_startswith:h,super_mode:f,metadata_order_key:p,metadata_key:m,metadata_values:b,metadata_value_startswith:v,show_frozen:_,show_metadata:E})),r}return T(n,e),n}(Y),oR=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,o=r.channels,a=r.ts;return i.token=s,o&&o.length>0&&(i.channels=o.map(function(l){return l.ts=a,new di(t,l)})),i.ts=typeof a=="number"?a:0,i}return T(n,e),n}(ae);(function(e){e.ALL="all",e.JOINED="joined"})(cc||(cc={}));var aR=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=cc.ALL,_.superChannelFilter=Ur.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=oc.CHRONOLOGICAL,_.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,_.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,_.includeMetaData=(o=r.includeMetaData)===null||o===void 0||o,_.channelUrlsFilter=(a=r.channelUrlsFilter)!==null&&a!==void 0?a:null,_.customTypesFilter=(l=r.customTypesFilter)!==null&&l!==void 0?l:null,_.customTypeStartsWithFilter=(u=r.customTypeStartsWithFilter)!==null&&u!==void 0?u:null,_.channelNameContainsFilter=(c=r.channelNameContainsFilter)!==null&&c!==void 0?c:null,_.membershipFilter=(d=r.membershipFilter)!==null&&d!==void 0?d:cc.ALL,_.superChannelFilter=(h=r.superChannelFilter)!==null&&h!==void 0?h:Ur.ALL,_.metadataKey=(f=r.metadataKey)!==null&&f!==void 0?f:null,_.metadataValues=(p=r.metadataValues)!==null&&p!==void 0?p:null,_.metadataOrderKeyFilter=(m=r.metadataOrderKeyFilter)!==null&&m!==void 0?m:null,_.metadataValueStartsWith=(b=r.metadataValueStartsWith)!==null&&b!==void 0?b:null,_.order=(v=r.order)!==null&&v!==void 0?v:oc.CHRONOLOGICAL,_}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter,!0)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter,!0)&&Ge(cc,this.membershipFilter)&&Ge(Ur,this.superChannelFilter)&&Ge(oc,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=O.of(this._iid).requestQueue,i=new sR(Ne(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(oR),a=o.channels,l=o.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,a];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),eg=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.onUserJoined=qe,t.onUserLeft=qe,t.onUserReceivedInvitation=qe,t.onUserDeclinedInvitation=qe,t.onChannelHidden=qe,t.onUnreadMemberStatusUpdated=qe,t.onUndeliveredMemberStatusUpdated=qe,t.onTypingStatusUpdated=qe,t.onPollUpdated=qe,t.onPollVoted=qe,t.onPollDeleted=qe,t.onPinnedMessageUpdated=qe,t}return T(n,e),n}(tR)),lR=function(e){function n(t){var r=this,i=t.token,s=t.limit,o=t.order,a=t.reverse,l=t.channelUrl,u=t.messageTypeFilter,c=t.scheduledStatus;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(oC),r.params=Ee(Ne({token:i,limit:s,reverse:a,channel_url:l,order:o,message_type:u,status:c})),r}return T(n,e),n}(Y),uR=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.scheduledMessages=[];var s=r.next,o=r.scheduled_messages;return i.token=s,i.scheduledMessages=o.map(function(a){return vr(t,a)}),i}return T(n,e),n}(ae),cR=function(e){function n(t,r){var i,s,o,a,l,u=this;return(u=e.call(this,t,r)||this).channelUrl=null,u.order=null,u.reverse=!1,u.scheduledStatus=null,u.messageTypeFilter=er.ALL,u.channelUrl=(i=r.channelUrl)!==null&&i!==void 0?i:null,u.order=(s=r.order)!==null&&s!==void 0?s:null,u.reverse=(o=r.reverse)!==null&&o!==void 0&&o,u.scheduledStatus=(a=r.scheduledStatus)!==null&&a!==void 0?a:null,u.messageTypeFilter=(l=r.messageTypeFilter)!==null&&l!==void 0?l:er.ALL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl,!0)&&(Ge(fm,this.order)||this.order===null)&&k("boolean",this.reverse)&&(We(uo,this.scheduledStatus)||this.scheduledStatus===null)&&Ge(er,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new lR(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(uR),o=s.scheduledMessages,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),dR=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="groupChannel",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Nn(t,{sdkState:i,cacheContext:c,dispatcher:s,sessionManager:o,requestQueue:a,logger:l})},n.prototype.createGroupChannelCollection=function(t){return t===void 0&&(t={}),new iR(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new MS(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new aR(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new cR(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){K(k("string",t)&&r instanceof eg).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){K(k("string",t)).throw(L.invalidParameters),this._manager.removeHandler(t)},n.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},n.prototype.buildGroupChannelFromSerializedData=function(t){return this._manager.buildGroupChannelFromSerializedData(t)},n.prototype.buildGroupChannelListQueryFromSerializedData=function(t){return this._manager.buildGroupChannelListQueryFromSerializedData(t)},n.prototype.buildMemberFromSerializedData=function(t){return this._manager.buildMemberFromSerializedData(t)},n.prototype.getChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]})})},n.prototype.getMyGroupChannelChangeLogsByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},hf),r),K(k("string",t)&&_m(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},hf),r),K(k("number",t)&&_m(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},IS),t),K(AS(r)).throw(L.invalidParameters),[2,this._manager.getGroupChannelCount(r)]})})},n.prototype.getUnreadItemCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getUnreadItemCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._manager.getTotalUnreadChannelCount()];case 1:return[2,t.sent()]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalUnreadMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalScheduledMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){return this._manager.getSubscribedTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){return this._manager.getSubscribedCustomTypeUnreadMessageCount(t)},n.prototype.createChannel=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},_h),t),K(pm(r)).throw(L.invalidParameters),[2,this._manager.createChannel(r)]})})},n.prototype.createDistinctChannelIfNotExist=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},_h),t),K(pm(r)).throw(L.invalidParameters),r&&(r.isDistinct=!0),[2,this.createChannel(r)]})})},n.prototype.createChannelWithUserIds=function(t,r,i,s,o,a){return r===void 0&&(r=!1),o===void 0&&(o=""),a===void 0&&(a=""),y(this,void 0,void 0,function(){var l;return g(this,function(u){return l=M(M({},_h),{invitedUserIds:t,isDistinct:r,name:i,data:o,customType:a}),typeof s=="string"?l.coverUrl=s:l.coverImage=s,[2,this.createChannel(l)]})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(We("string",t)).throw(L.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(Wv);const pf={collection:{groupChannel:{defaultLimit:20,defaultOrder:Pt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var hR=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const fR=(e,n)=>{D.useEffect(xS(e),n)},pR=(e,n)=>{D.useLayoutEffect(xS(e),n)},Mp=e=>e(),xS=e=>()=>{const n=Mp(e);return()=>{n&&(n instanceof Promise?Mp(()=>hR(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):Mp(n))}};let _R=0;function mR(){return D.useState(()=>`${_R++}`)[0]}const OS=(e,n,t)=>{const r=D.useRef(n),s=mR();r.current=n,D.useEffect(()=>{var o;const a=l=>(Object.keys(l).forEach(c=>{l[c]=(...d)=>{var h,f;return(f=(h=r.current)===null||h===void 0?void 0:h[c])===null||f===void 0?void 0:f.call(h,...d)}}),l);return(o=e==null?void 0:e.groupChannel)===null||o===void 0||o.addGroupChannelHandler(s,a(new eg)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function hn(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var vR=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="poll",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new rf(t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c})},n.prototype.create=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},U6),t),K(qC(r)).throw(L.invalidParameters),[2,this._manager.create(r)]})})},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},F6),t),K(KC(r)).throw(L.invalidParameters),[2,this._manager.get(r)]})})},n.prototype.getOption=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},P6),t),K(WC(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(Wv),gR=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},py=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),kS=function(e){this.key=e.key,this.url=e.url},RS=function(e){this.id=e.id,this.name=e.name,this.url=e.url,this.emojis=e.emojis?e.emojis.map(function(n){return new kS(n)}):[]},yR=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new RS(n)}):[]},ER={profileImage:void 0,profileUrl:void 0,nickname:void 0},_y=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:switch(n){case 1:case 2:case 3:case 4:return[3,1];case 5:return[3,2];case 6:return[3,4]}return[3,11];case 1:return t(),[3,12];case 2:return[4,e.store.clear()];case 3:return a.sent(),t(),[3,12];case 4:return a.trys.push([4,9,,10]),r=function(l){return{v2:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:_S,keyName:_x,index:[ph(Pt.LATEST_LAST_MESSAGE),ph(Pt.CHRONOLOGICAL),ph(Pt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:um,keyName:mx,index:[hs(zn.CHANNEL_LATEST),hs(zn.NEWEST_CHILD_MESSAGE)]},{collectionName:yS,keyName:Jx,index:[hs(zn.CHANNEL_LATEST),hs(zn.NEWEST_CHILD_MESSAGE)]},{collectionName:gx,keyName:yx}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:Ex,keyName:bx,index:[gR()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:vS,keyName:vx,index:[Kx()]}])];case 1:return[2,u.sent()]}})})}}}(e),i=r.v2,s=r.v3,o=r.v4,[4,i()];case 5:return a.sent(),[4,s()];case 6:return a.sent(),[4,o()];case 7:return a.sent(),[4,e.collection(um).removeIf({where:{channelType:Ze.OPEN}})];case 8:case 9:return a.sent(),[3,10];case 10:return t(),[3,12];case 11:t(),a.label=12;case 12:return[2]}})})}},bR=function(){return typeof document<"u"?document.visibilityState:"visible"},CR=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?bR:r,s=t.initialState,o=s===void 0?"visible":s,a=t.isEnabled,l=a===void 0||a,u=t.pauseCheckDelay,c=u===void 0?3e4:u,d=e.call(this)||this;return d._pauseCheckDelay=3e4,d._currentState="visible",d._getVisibilityState=i,d._pauseCheckDelay=c,d._currentState=o,d._isEnabled=l,d._boundToggleState=d._toggleState.bind(d),d}return T(n,e),Object.defineProperty(n.prototype,"currentState",{get:function(){return this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAvailable",{get:function(){return typeof window<"u"&&!!window.addEventListener&&!!window.removeEventListener},enumerable:!1,configurable:!0}),n.prototype._toggleState=function(){var t=this,r=this._getVisibilityState();r!=="hidden"?this._currentState==="hidden"&&(this._pauseDelayTimer&&(clearTimeout(this._pauseDelayTimer),this._pauseDelayTimer=void 0),this.dispatch("resume")):this._currentState!=="hidden"&&(this._pauseDelayTimer=setTimeout(function(){t._pauseDelayTimer=void 0,t.dispatch("pause")},this._pauseCheckDelay)),this._currentState=r},n.prototype.start=function(){this._isEnabled&&this.isAvailable&&(this._boundToggleState=this._toggleState.bind(this),window.addEventListener("visibilitychange",this._boundToggleState,{capture:!0}))},n.prototype.stop=function(){this._isEnabled&&this.isAvailable&&this._boundToggleState&&window.removeEventListener("visibilitychange",this._boundToggleState,{capture:!0})},n}(Ra),SR=function(){function e(n){var t=n.logger,r=n.connectionDelegate,i=r===void 0?null:r,s=this;this._onlineWorker=function(){var o;return(o=s.connectionDelegate)===null||o===void 0?void 0:o.reconnect()},this._offlineWorker=function(){var o;return(o=s.connectionDelegate)===null||o===void 0?void 0:o.disconnect()},this.unsubscribes=[],this._onlineListener=function(o){if(s.isAvailableOnWeb)return window.addEventListener("online",o),function(){return window.removeEventListener("online",o,!1)}},this._offlineListener=function(o){if(s.isAvailableOnWeb)return window.addEventListener("offline",o),function(){return window.removeEventListener("offline",o,!1)}},this.logger=t,i&&(this.connectionDelegate=i)}return Object.defineProperty(e.prototype,"isAvailableOnWeb",{get:function(){return typeof window<"u"&&!!window.addEventListener&&"ononline"in window&&"onoffline"in window&&typeof navigator<"u"&&navigator.onLine!==void 0},enumerable:!1,configurable:!0}),e.prototype.setOnlineListener=function(n){n&&typeof n=="function"&&(this._onlineListener=n)},e.prototype.setOfflineListener=function(n){n&&typeof n=="function"&&(this._offlineListener=n)},e.prototype.start=function(){this.unsubscribes=[this._onlineListener(this._onlineWorker),this._offlineListener(this._offlineWorker)]},e.prototype.stop=function(){var n=this;this.unsubscribes.forEach(function(t){try{t==null||t()}catch(r){n.logger.warn(r.message)}}),this.unsubscribes=[]},e.prototype.isOnline=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Q.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),my=function(e){function n(t){var r=t.userId,i=t.nickname,s=t.profileUrl,o=t.profileImage,a=t.preferredLanguages,l=e.call(this)||this;return l.method=Q.PUT,l.path="".concat(Xe,"/").concat(encodeURIComponent(r)),l.params=Ee(Ne({nickname:i,profile_url:s,profile_file:o,preferred_languages:a})),l}return T(n,e),n}(Y),vy=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ke(t,M({},r)),i}return T(n,e),n}(ae),TR=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,o=t.deviceManufacturer,a=t.systemPushEnabled,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=Ee({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i}T(n,e)})(ae);var wR=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,o=t.deviceManufacturer,a=t.systemPushEnabled,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=Ee({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i}T(n,e)})(ae);var NR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var IR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var AR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var MR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var xR=function(e){function n(t){var r=t.userId,i=t.type,s=t.token,o=t.ts,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/").concat(encodeURIComponent(i),"/device_tokens"),a.params={created_ts:o,token:s},a}return T(n,e),n}(Y),OR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTokens={type:r.type?In[r.type.toLowerCase()]:In.UNKNOWN,deviceTokens:r.device_tokens,hasMore:r.has_more,token:r.token},i}return T(n,e),n}(ae),kR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return T(n,e),n}(Y),RR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(ae),LR=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return T(n,e),n}(Y),DR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(ae),UR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),PR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(ae),FR=function(e){function n(t){var r=t.userId,i=t.doNotDisturbOn,s=t.startHour,o=t.startMin,a=t.endHour,l=t.endMin,u=t.timezone,c=e.call(this)||this;return c.method=Q.PUT,c.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),c.params={do_not_disturb:i,start_hour:s,start_min:o,end_hour:a,end_min:l,timezone:u},c}return T(n,e),n}(Y),HR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(ae),jR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),BR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(ae),$R=function(e){function n(t){var r=t.userId,i=t.snoozeOn,s=t.startTs,o=t.endTs,a=e.call(this)||this;return a.method=Q.PUT,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),a.params={snooze_enabled:i,snooze_start_ts:s,snooze_end_ts:o},a}return T(n,e),n}(Y),GR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(ae),zR=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ke(t,r),i}T(n,e)})(ae);var VR=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var qR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),WR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(ae),KR=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return T(n,e),n}(Y),QR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(ae),YR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),i}return T(n,e),n}(Y),ZR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(ae),XR=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return T(n,e),n}(Y),JR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(ae),eL=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return T(n,e),n}(Y),tL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.changelogs={addedUsers:r.added.map(function(s){return new Ke(t,s)}),updatedUsers:r.updated.map(function(s){return new Ke(t,s)}),deletedUserIds:r.deleted,hasMore:r.has_more,token:r.next},i}return T(n,e),n}(ae),nL=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discoveries:i.map(function(o){return{friend_discovery_key:o.friendDiscoveryKey,friend_name:o.friendName}})},s}return T(n,e),n}(Y),rL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.friendDiscoveryRequestId=r.friend_discovery_request_id,i}return T(n,e),n}(ae),iL=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var sL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Y),oL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i}return T(n,e),n}(ae),aL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var lL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return T(n,e),n}(Y),uL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.allowFriendDiscovery=r.allow_friend_discovery,i}return T(n,e),n}(ae),cL=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var _f,dL=function(e){function n(){var t=e.call(this)||this;return t.method=Q.GET,t.path=sC,t}return T(n,e),n}(Y),hL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new yR(r),i}return T(n,e),n}(ae),fL=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(sC,"/").concat(r),i}return T(n,e),n}(Y),pL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new RS(r),i}return T(n,e),n}(ae),_L=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(q4,"/").concat(r),i}return T(n,e),n}(Y),mL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new kS(r),i}return T(n,e),n}(ae),vL=function(e){function n(){var t=e.call(this)||this;return t.method=Q.GET,t.path="".concat(W4),t}return T(n,e),n}(Y),gL=function(e){function n(t,r){var i,s=this,o=r??{};return(s=e.call(this,t,r)||this).uikitConfiguration={string:JSON.stringify(o),json:o},s.updatedAt=(i=r==null?void 0:r.updated_at)!==null&&i!==void 0?i:0,s}return T(n,e),n}(ae);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(_f||(_f={}));var du,gy=function(e){function n(t){var r=t.deviceToken,i=t.pushTrackingId,s=t.messageId,o=t.allowedPushNotification,a=t.channelKey,l=t.templateKey,u=t.eventType,c=t.notificationEventDeadline,d=e.call(this)||this;return d.method=Q.POST,d.path=Q4,d.params=Ee({device_token:r,push_tracking_id:i,message_id:s,allowed_push_notification:o,channel_key:a,template_key:l,event_type:u,notification_event_deadline:c}),d}return T(n,e),n}(Y),yL=function(){function e(n,t,r){var i=this;this._storeInitialized=!1,this._iid=n,this.options=t;var s=O.of(n),o=s.sdkState,a=s.cacheContext,l=s.dispatcher,u=s.sessionManager,c=s.requestQueue,d=s.logger,h=s.userEventHandlers,f=s.appStateToggleEnabled;this._onlineDetector=new SR({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:if(m=O.of(n),b=m.sdkState,v=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,v.connect(_.session.authToken)];case 2:return w.sent(),[3,4];case 3:if(E=w.sent(),Lr(E))throw E;return d.debug("connect failed by reconnect event = ",E),[3,4];case 4:return[3,9];case 5:if(b.appState!=="foreground")return[3,9];w.label=6;case 6:return w.trys.push([6,8,,9]),[4,v.resetAndReconnect()];case 7:return w.sent(),[3,9];case 8:if(S=w.sent(),Lr(S))throw S;return d.debug("resetAndReconnect failed by reconnect event = ",S),[3,9];case 9:return l.dispatch(new py),[2]}})})},disconnect:function(){Ot(function(){return y(i,void 0,void 0,function(){return g(this,function(m){switch(m.label){case 0:return[4,O.of(n).connectionManager.disconnect()];case 1:return m.sent(),[2]}})})})}}});var p=new Mu(n,{localCacheEnabled:a.localCacheEnabled,enableAutoResend:a.localCacheConfig.enableAutoResend,dispatcher:l,sdkState:o,logger:d});r.forEach(function(m){m.init(n,{sdkState:o,cacheContext:a,dispatcher:l,sessionManager:u,requestQueue:c,logger:d,onlineDetector:i._onlineDetector}),i[m.name]=m}),this._appStateChangeDetector=new CR({isEnabled:f}),this._appStateChangeDetector.on("resume",function(){d.debug("the page resumes from freeze"),i.setForegroundState()}).on("pause",function(){d.debug("the page freezes"),i.setBackgroundState()}),l.on(function(m){var b;if(m instanceof _i)m.stateType===st.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof mt){if(m.code==="USEV"){var v=m.as(wS).event;if(v.category===Pc.FRIEND_DISCOVERED){var _=cf.getDataAsFriendDiscoveredEvent(n,v).friendDiscoveries;De(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onFriendsDiscovered&&I.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof xC){var E=O.of(i._iid).subscribedUnreadMessageCount,S=!1,w=m.ts;typeof w=="number"&&w>E.ts&&(E.all!==m.all&&(S=!0),E.all=m.all>=0?m.all:0,m.customTypes&&Object.keys(m.customTypes).forEach(function(N){E.customTypes[N]!==m.customTypes[N]&&(S=!0),E.customTypes[N]=m.customTypes[N]}),S=S&&E.ts>0,E.ts=w),S&&De(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onTotalUnreadMessageCountChanged&&I.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),I.onTotalUnreadMessageCountUpdated&&I.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof RC?(a.preference.set(i._getUserProfileCacheKey(o.userId),em.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&a.preference.set(zv(i.appId),{value:!0})):m instanceof Ul&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i.disconnect())})}return e.init=function(n){var t=n.appId,r=n.appVersion,i=n.modules,s=i===void 0?[]:i,o=n.options,a=o===void 0?new nC:o,l=n.debugMode,u=l!==void 0&&l,c=n.customApiHost,d=n.customWebSocketHost,h=n.newInstance,f=h!==void 0&&h,p=n.logLevel,m=n.localCacheEnabled,b=m!==void 0&&m,v=n.localCacheConfig,_=v===void 0?new iC:v,E=n.localCacheEncryption,S=n.useAsyncStorageStore,w=S===void 0?null:S,N=n.useMMKVStorageStore,I=N===void 0?null:N,R=n.appStateToggleEnabled,A=R===void 0||R;if(!du||f){var x="su-".concat($s()),U=E??{encrypt:function(H){return H},decrypt:function(H){return H}},q=new Wx;q.level=p??xs.WARN;var P=new Yo({encryption:U});u||(Q_()?I?P=new Vx({MMKV:I,encryption:U}):w&&(P=new zx({AsyncStorage:w,encryption:U}),q.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):P=new Gx({encryption:U})),new O(x,{appId:t,appVersion:r,options:a,apiHost:c??"https://api-".concat(t,".sendbird.com"),websocketHost:d??"wss://ws-".concat(t,".sendbird.com"),store:P,encryption:U,logger:q,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:A});var X=[new pO,new vR],z=new e(x,a,Pe(Pe([],Ae(s),!1),Ae(X),!1));return du||(du=z),z}return du},Object.defineProperty(e,"instance",{get:function(){return du},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return eC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appId",{get:function(){return O.of(this._iid).sdkState.appId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appInfo",{get:function(){var n=O.of(this._iid).appInfo;return n??null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appVersion",{get:function(){var n;return(n=O.of(this._iid).sdkState.appVersion)!==null&&n!==void 0?n:""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugMode",{get:function(){return!!O.of(this._iid).debugMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return O.of(this._iid).logger.level},set:function(n){O.of(this._iid).logger.level=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCacheEnabled",{get:function(){return O.of(this._iid).cacheContext.localCacheEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCacheConfig",{get:function(){var n=O.of(this._iid).cacheContext;return n.localCacheEnabled?n.localCacheConfig:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ekey",{get:function(){return O.of(this._iid).sessionManager.ekey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentUser",{get:function(){var n;return(n=O.of(this._iid).sessionManager.currentUser)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){var n=O.of(this._iid).connectionManager;return n.isConnected?us.OPEN:n.isConnecting?us.CONNECTING:us.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastConnectedAt",{get:function(){var n=O.of(this._iid),t=n.connectedAt;return n.connectionManager.isConnected?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fcmPushToken",{get:function(){var n;return(n=this._fcmPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apnsPushToken",{get:function(){var n;return(n=this._apnsPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),e.prototype._getNestDBVersion=function(){return 7},e.prototype._getPreferenceCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".pref")},e.prototype._getUserProfileCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".profile")},e.prototype.getMemoryStoreForDebugging=function(){var n=O.of(this._iid),t=n.debugMode,r=n.cacheContext;if(t)return r.store instanceof Yo?r.store:null;throw L.debugModeRequired},e.prototype.addExtension=function(n,t){var r=O.of(this._iid).sdkState;["sb_uikit","sb_syncmanager","device-os-platform"].indexOf(n)>-1&&r.extensions&&(r.extensions[n]=t)},e.prototype.addSendbirdExtensions=function(n,t,r){var i,s,o=O.of(this._iid),a=o.logger,l=o.sdkState,u=new RegExp(eA);if(n.length===0)return a.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."),!1;if(n.find(function(m){return!u.test(m.version)}))return a.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."),!1;if(r)try{for(var c=ve(Object.entries(r)),d=c.next();!d.done;d=c.next()){var h=Ae(d.value,2),f=h[0],p=h[1];if(/&|=/.test(f)||/&|=/.test(p))return a.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."),!1}}catch(m){i={error:m}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return l.sendbirdRuntimeEnvironment={sendbirdExtensions:n,deviceOS:t,customData:r},!0},e.prototype.setOnlineListener=function(n){this._onlineDetector.setOnlineListener(n)},e.prototype.setOfflineListener=function(n){this._onlineDetector.setOfflineListener(n)},e.prototype._safeInitializeStore=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=O.of(this._iid).cacheContext,r.label=1;case 1:return r.trys.push([1,3,,5]),[4,t.store.init(n)];case 2:return r.sent(),this._storeInitialized=!0,[3,5];case 3:return r.sent(),t.replaceStore(new Yo),[4,this._safeInitializeStore(n)];case 4:return r.sent(),[3,5];case 5:return[2]}})})},e.prototype.initializeCache=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:if(t=O.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.dispatcher,o=t.logger,r.userId&&r.userId===n)return[3,11];if(a="sendbird@".concat(r.appId,"/").concat(n,".db"),!i.localCacheEnabled)return[3,9];d.label=1;case 1:return d.trys.push([1,6,,8]),i.nestdb&&i.nestdb.state!==is.CLOSED&&i.nestdb.name===a?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new qx({name:l,version:this._getNestDBVersion(),store:i.store,config:new Yc({dbname:l,itemSizeLimit:61440})})).on("upgrade",_y(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",_y(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new SS(this._iid,{userId:n})),[3,5];case 3:return[4,this._safeInitializeStore(a)];case 4:d.sent(),d.label=5;case 5:return r.userId=n,[3,8];case 6:return c=d.sent(),o.warn("Nest DB Open Failed. ",c),i.store instanceof Yo||(i.replaceStore(new Yo),i.localCacheEnabled=!1),[4,this._safeInitializeStore(a)];case 7:throw d.sent(),r.userId=n,L.databaseError;case 8:return[3,11];case 9:return[4,this._safeInitializeStore(a)];case 10:d.sent(),r.userId=n,d.label=11;case 11:return[2]}})})},e.prototype.getCacheDataSize=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=O.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.estimateUsage()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,0]}})})},e.prototype.clearCachedData=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=O.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._storeInitialized?[4,n.preference.clear()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},e.prototype.clearCachedMessages=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=Cl.of(this._iid),r=Ia.of(this._iid),t&&r?[4,Promise.all(n.map(function(o){return y(i,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,t.removeMessagesOfChannel(o)];case 1:return a.sent(),[4,r.removeMessagesOfChannel(o)];case 2:return a.sent(),[2]}})})}))]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},e.prototype._setupPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.statManager,[4,i.preference.init(this._getPreferenceCacheKey(n),this._getNestDBVersion())];case 1:return a.sent(),[4,i.preference.get(this._getUserProfileCacheKey(n))];case 2:return(o=a.sent())&&new em(this._iid,o).apply(),[4,s.init("sendbird@".concat(r.appId,"/").concat(n,".statlog"))];case 3:return a.sent(),[2]}})})},e.prototype._ready=function(n,t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",n)&&k("string",t,!0)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.cacheContext,a=i.connectionManager,l=r.errorForOtherUser,s.userId&&s.userId!==n?l?[3,2]:[4,a.logout()]:[3,3];case 1:return c.sent(),[3,3];case 2:throw l;case 3:return c.trys.push([3,5,6,8]),[4,this.initializeCache(n)];case 4:return c.sent(),O.of(this._iid).dispatcher.dispatch(new TS),[3,8];case 5:return c.sent(),u=O.of(this._iid).logger,o.localCacheEnabled=!1,u.warn("Cache initialization failed - cache is not available."),[3,8];case 6:return[4,this._setupPreference(n)];case 7:return c.sent(),[7];case 8:return[2]}})})},e.prototype.authenticateFeed=function(n,t){var r;return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=O.of(this._iid),s=i.sessionManager,o=i.connectionManager,[4,this._ready(n,t,{errorForOtherUser:o.isConnected?L.alreadyConnectedAsAnotherUser:void 0})];case 1:return l.sent(),!((r=s.session.services)===null||r===void 0)&&r.includes(Oc.CHAT)?[3,3]:(t||s.handler||(a=new J1,this.setSessionHandler(a)),[4,s.authenticateFeed(n,t)]);case 2:l.sent(),l.label=3;case 3:return[2,this.currentUser]}})})},e.prototype.connect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._ready(n,t)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,O.of(this._iid).connectionManager.connect(t)];case 3:return r.sent(),[3,5];case 4:return this._onlineDetector.start(),this._appStateChangeDetector.start(),[7];case 5:return[2,this.currentUser]}})})},e.prototype.reconnect=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.sessionManager.session.hasSession;return i&&(this._appStateChangeDetector.start(),this._onlineDetector.start(),t.resetAndReconnect().then(function(){r.appState="foreground"}).catch(function(){})),i},e.prototype.disconnect=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),i.cancelAll(),[4,t.logout()];case 1:return s.sent(),[4,this.clearCachedData()];case 2:return s.sent(),r.appState="foreground",[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=O.of(this._iid),t=n.connectionManager,r=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),r.cancelAll(),[4,t.disconnectWebSocket(!0)];case 1:return i.sent(),[2]}})})},e.prototype.setBackgroundState=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.logger;r.appState==="foreground"&&(r.appState="background",i.debug("going background state"),t.background().catch(function(s){i.debug("setBackgroundState error = ",s)}))},e.prototype.setForegroundState=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.dispatcher,s=n.logger;r.appState==="background"&&(r.appState="foreground",s.debug("going foreground state"),t.resetAndReconnect().catch(function(o){s.debug("setForgroundState error = ",o)}),i.dispatch(new py))},e.prototype.setSessionHandler=function(n){K(n instanceof J1).throw(L.invalidParameters),O.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){K(k("string",n)&&t instanceof Nx).throw(L.invalidParameters),O.of(this._iid).userEventHandlers.set(n,t)},e.prototype.removeUserEventHandler=function(n){O.of(this._iid).userEventHandlers.delete(n)},e.prototype.removeAllUserEventHandler=function(){O.of(this._iid).userEventHandlers.clear()},e.prototype.addConnectionHandler=function(n,t){K(k("string",n)&&t instanceof gS).throw(L.invalidParameters),O.of(this._iid).connectionHandlers.set(n,t)},e.prototype.removeConnectionHandler=function(n){O.of(this._iid).connectionHandlers.delete(n)},e.prototype.removeAllConnectionHandler=function(){O.of(this._iid).connectionHandlers.clear()},e.prototype.createApplicationUserListQuery=function(n){return n===void 0&&(n={}),new Mx(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new kx(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new Dx(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new lO(this._iid,n)},e.prototype.createPollListQuery=function(n){return new QC(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new YC(this._iid,M({},n))},e.prototype.buildUserFromSerializedData=function(n){var t=fa(n);return new Ke(this._iid,Ke.payloadify(t))},e.prototype.updateCurrentUserInfo=function(n){return n===void 0&&(n={}),y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return t=M(M({},ER),n),K(function(c){return fr(c.profileImage,!0)&&k("string",c.profileUrl,!0)&&k("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new my(M({userId:i.userId},t)),[4,s.send(o)]):[3,2];case 1:return a=u.sent(),l=a.as(vy).user,this.currentUser&&(t.nickname&&(this.currentUser.nickname=l.nickname),(t.profileUrl||t.profileImage)&&(this.currentUser.plainProfileUrl=l.profileUrl)),[2,l];case 2:throw L.connectionRequired}})})},e.prototype.updateCurrentUserInfoWithPreferredLanguages=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(We("string",n)).throw(L.invalidParameters),this.currentUser?(t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new my({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return o=l.sent(),a=o.as(vy).user,this.currentUser&&(this.currentUser.preferredLanguages=a.preferredLanguages),[2,a];case 2:throw L.connectionRequired}})})},e.prototype.registerFCMPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(K(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&K(Ge(Ci,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ci.ANDROID,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),o=O.of(this._iid),a=o.sessionManager,l=o.sdkState,u=o.requestQueue,a.hasDeviceToken(In.FCM,n)?[2,Cr.SUCCESS]:(c=new wR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Ot(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return a.setDeviceToken(In.FCM,n,s),[4,a.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._fcmPushToken="",[2,Cr.SUCCESS];case 4:return h.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:if(K(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=O.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,o=new IR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,Ot(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(In.FCM,n),r.setDeviceTokenDeletedAt(a),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._fcmPushToken="",[2,Cr.SUCCESS];case 4:return u.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=O.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new MR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,Ot(function(){return y(a,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(In.FCM),t.setDeviceTokenDeletedAt(o),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.registerAPNSPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(K(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&K(Ge(Ci,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ci.IOS,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),o=O.of(this._iid),a=o.sessionManager,l=o.sdkState,u=o.requestQueue,a.hasDeviceToken(In.APNS,n)?[2,Cr.SUCCESS]:(c=new TR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Ot(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return a.setDeviceToken(In.APNS,n,s),[4,a.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._apnsPushToken="",[2,Cr.SUCCESS];case 4:return h.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:if(K(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=O.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,o=new NR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,Ot(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(In.APNS,n),r.setDeviceTokenDeletedAt(a),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._apnsPushToken="",[2,Cr.SUCCESS];case 4:return u.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=O.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new AR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,Ot(function(){return y(a,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(In.APNS),t.setDeviceTokenDeletedAt(o),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.markPushNotificationAsDelivered=function(n,t){var r;return t===void 0&&(t=!0),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:if(i=O.of(this._iid),s=i.logger,o=i.sessionManager,a=i.requestQueue,l=i.pushNotificationAckManager,s.debug("markPushNotificationAsDelivered:",n),u=_f.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,v=c.notificationEventDeadline,!f||!h.includes(nf.PUSH_ACKNOWLEDGEMENT))throw s.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(l.isAcked(d,u))return s.info("already delivered push notification:",d),[2];_=!!m,E=t&&_,S=(r=o.deviceTokens[0])===null||r===void 0?void 0:r.token,w=new gy({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:v,allowedPushNotification:E}),f&&(w.headers["Session-Key"]=f),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,a.send(w)];case 2:return I.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=I.sent(),s.debug("failed to mark push notification as delivered. push tracking id: ".concat(d,". error: ").concat(N)),N;case 4:return[2]}})})},e.prototype.markPushNotificationAsClicked=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:if(r=O.of(this._iid),i=r.logger,s=r.sessionManager,o=r.requestQueue,a=r.pushNotificationAckManager,i.debug("markPushNotificationAsClicked:",n),l=_f.CLICKED,u=a.parseData(n),c=u.pushTrackingId,d=u.sessionTopics,h=u.sessionKey,f=u.messageId,p=u.channelKey,m=u.templateKey,b=u.notificationEventDeadline,!h||!d.includes(nf.PUSH_ACKNOWLEDGEMENT))throw i.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(a.isAcked(c,l))return i.info("already clicked push notification:",c),[2];v=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new gy({deviceToken:v??"",pushTrackingId:c,eventType:l,messageId:f,channelKey:p,templateKey:m,notificationEventDeadline:b}),h&&(_.headers["Session-Key"]=h),S.label=1;case 1:return S.trys.push([1,3,,4]),[4,o.send(_)];case 2:return S.sent(),a.markAsAcked(c,l),[3,4];case 3:throw E=S.sent(),i.debug("failed to mark push notification as clicked. push tracking id: ".concat(c,". error: ").concat(E)),E;case 4:return[2]}})})},e.prototype.getChannelInvitationPreference=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new kR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,{autoAccept:s.as(RR).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new LR({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,{autoAccept:o.as(DR).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new UR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(PR).preference]}})})},e.prototype.setDoNotDisturb=function(n,t,r,i,s,o){return t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=0),s===void 0&&(s=0),o===void 0&&(o=""),y(this,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return K(k("boolean",n)&&k("number",t)&&k("number",r)&&k("number",i)&&k("number",s)&&k("string",o)).throw(L.invalidParameters),a=O.of(this._iid),l=a.sdkState,u=a.requestQueue,c=new FR({userId:l.userId,doNotDisturbOn:n,startHour:t,startMin:r,endHour:i,endMin:s,timezone:o}),[4,u.send(c)];case 1:return d=h.sent(),[2,d.as(HR).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new jR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(BR).snoozePeriod]}})})},e.prototype.setSnoozePeriod=function(n,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),y(this,void 0,void 0,function(){var i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(k("boolean",n)&&k("number",t)&&k("number",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new $R({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(GR).snoozePeriod]}})})},e.prototype.getMyPushTokensByToken=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return K(k("string",n)&&Ge(In,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=r.sessionManager,a=new xR({userId:i.userId,type:t,token:n}),[4,s.send(a)];case 1:l=m.sent(),u=l.as(OR).pushTokens;try{for(c=ve(u.deviceTokens),d=c.next();!d.done;d=c.next())h=d.value,o.setDeviceToken(u.type,h)}catch(b){f={error:b}}finally{try{d&&!d.done&&(p=c.return)&&p.call(c)}finally{if(f)throw f.error}}return[4,o.saveDeviceToken()];case 2:return m.sent(),[2,u]}})})},e.prototype.getPushTriggerOption=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new qR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(WR).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(Ge(ta,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new KR({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,o.sent().as(QR).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new YR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(ZR).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(Ge(V_,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new XR({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,o.sent().as(JR).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(n instanceof Ke||k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new zR({userId:r.userId,blockedUserId:n instanceof Ke?n.userId:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.blockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.blockUser(n)]})})},e.prototype.unblockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(n instanceof Ke||k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new VR({userId:r.userId,unblockedUserId:n instanceof Ke?n.userId:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.unblockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.unblockUser(n)]})})},e.prototype.getFriendChangeLogsByToken=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new eL({userId:r.userId,token:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(tL).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new lL({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(uL).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(k("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new cL({userId:r.userId,allowFriendDiscovery:n}),[4,i.send(s)];case 1:return o.sent(),[2,n]}})})},e.prototype.uploadFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new nL({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(rL).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriendDiscoveries([n])]})})},e.prototype.deleteFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new iL({userId:r.userId,discoveryKeys:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.addFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new sL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(oL).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriends([n])]})})},e.prototype.deleteFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new aL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.getAllEmoji=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=O.of(this._iid).requestQueue,t=new dL,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(hL).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new fL({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(pL).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new _L({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(mL).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),K(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new vL,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(gL).uikitConfiguration]}})})},e}();function EL(e,n){return!e||!n?!0:e.url!==n.url}function Aa(e){return e!=null&&"sendingStatus"in e}function mf(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return Aa(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function bL(e,n){return mf(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function yy(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function et(e){return typeof e=="boolean"}function Ka(e,n){return n.includes(e)}function CL(e){return e instanceof Set}function Ey(e){return!e||!Array.isArray(e)?!1:e.length!==0}function SL(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const TL=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function ym(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>ym(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=ym(e[t])}),n}function by(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var wL=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var t=wL(e,[]);switch(n.type){case"update_initialized":return t.initialized=n.value.status,t;case"update_refreshing":return t.refreshing=n.value.status,t;case"update_loading":return t.loading=n.value.status,t;case"update_messages":{const r=n.value.currentUserId;if(n.value.clearBeforeAction)t.messageMap=Cy(n.value.messages);else{const i=n.value.messages.filter(o=>{var a;if(mf(o,r)){const l=(a=t.messageMap[o.reqId])!==null&&a!==void 0?a:t.messageMap[o.messageId];if(mf(l,r)){const u=IL(l,o);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=Cy(i);t.messageMap=Object.assign(Object.assign({},t.messageMap),s)}return t}case"update_new_messages":{const r=n.value.currentUserId,i=n.value.messages.filter(s=>bL(s,r));return n.value.clearBeforeAction?t.newMessageMap=by(i,yy):(i.map(o=>o.messageId).forEach(o=>delete t.newMessageMap[o]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),by(i,yy))),t}case"delete_messages":case"delete_new_messages":{const r=n.type==="delete_messages"?"messageMap":"newMessageMap";return t[r]=Object.assign({},t[r]),n.value.messageIds.forEach(i=>{const s=t[r][i];s&&(Aa(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(Aa(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},Cy=e=>e.reduce((n,t)=>(Aa(t)?(n[t.reqId]=t,t.sendingStatus===ut.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),IL=(e,n)=>e.sendingStatus===ut.SUCCEEDED?n.sendingStatus===ut.SUCCEEDED:e.sendingStatus!==n.sendingStatus,AL=(e=ML)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},o]=D.useReducer(NL,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),a=(b,v,_)=>{o({type:"update_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},l=(b,v)=>{o({type:"delete_messages",value:{messageIds:b,reqIds:v}})},u=(b,v,_)=>{o({type:"update_new_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},c=(b,v)=>{o({type:"delete_new_messages",value:{messageIds:b,reqIds:v}})},d=b=>{o({type:"update_initialized",value:{status:b}})},h=b=>{o({type:"update_loading",value:{status:b}})},f=b=>{o({type:"update_refreshing",value:{status:b}})},p=Object.values(s),m=D.useMemo(()=>Array.from(new Set(Object.values(i))).sort(e),[i]);return{updateInitialized:d,updateLoading:h,updateRefreshing:f,updateMessages:a,deleteMessages:l,initialized:n,loading:t,refreshing:r,messages:m,newMessages:p,updateNewMessages:u,deleteNewMessages:c}},Sy=Math.floor(Number.MAX_SAFE_INTEGER/10);function ML(e,n){let t=0,r=0;return Aa(e)&&e.sendingStatus!=="succeeded"&&(t=Sy),Aa(n)&&n.sendingStatus!=="succeeded"&&(r=Sy),e.createdAt+t-(n.createdAt+r)}var Fi=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const xL=(e,n,t)=>{var r;const i={prevResultLimit:n.prev,nextResultLimit:n.next,startingPoint:t==null?void 0:t.startingPoint,replyType:t==null?void 0:t.replyType},s=(r=t==null?void 0:t.collectionCreator)===null||r===void 0?void 0:r.call(t,i);return s||e.createMessageCollection(Object.assign(Object.assign({},i),{filter:new vs(i)}))};function Ty(e){return e{var r,i,s;const o=D.useRef(t);o.current=t;const a=D.useRef(n);a.current=n;const l=o.current.logger,u=(r=o.current.startingPoint)!==null&&r!==void 0?r:Number.MAX_SAFE_INTEGER,c=Ty(u),d=D.useRef({prev:!1,next:!1}),h=TL(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:w,deleteMessages:N,updateInitialized:I,updateLoading:R,updateRefreshing:A}=AL(t==null?void 0:t.sortComparator),x=hn(B=>{var se,ce,ye,ie;if(!a.current||!a.current.url)return(se=l==null?void 0:l.error)===null||se===void 0?void 0:se.call(l,"[useGroupChannelMessages] channel is required");try{switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.EVENT_MESSAGE_SENT_SUCCESS:case G.SYNC_MESSAGE_FILL:case void 0:(ye=(ce=o.current).markAsRead)===null||ye===void 0||ye.call(ce,[a.current]);break}}catch(de){(ie=l==null?void 0:l.warn)===null||ie===void 0||ie.call(l,"[useGroupChannelMessages/markAsReadBySource]",de)}}),U=hn((B,se)=>{var ce,ye,ie,de,he;const me=se.filter(_e=>{var fe;return!mf(_e,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)});if(me.length>0)switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_MESSAGE_FILL:{!((ye=(ce=o.current).shouldCountNewMessages)===null||ye===void 0)&&ye.call(ce)&&S(me,!1,(ie=e.currentUser)===null||ie===void 0?void 0:ie.userId),(he=(de=o.current).onMessagesReceived)===null||he===void 0||he.call(de,me);break}}}),q=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){return new Promise(ce=>{var ye,ie;if(!a.current||!a.current.url)return(ye=l==null?void 0:l.error)===null||ye===void 0?void 0:ye.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),x(),S([],!0,(ie=e.currentUser)===null||ie===void 0?void 0:ie.userId);const de=()=>{var me,_e,fe;const{pendingMessages:be,failedMessages:$e}=(me=f.current.instance)!==null&&me!==void 0?me:{};Ey(be)&&E(be,!1,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId),Ey($e)&&E($e,!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)},he=xL(a.current,se,Object.assign(Object.assign({},o.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:he},he.setMessageCollectionHandler({onMessagesAdded:(me,_e,fe)=>{var be;x(me.source),U(me.source,fe),E(fe,!1,(be=e.currentUser)===null||be===void 0?void 0:be.userId)},onMessagesUpdated:(me,_e,fe)=>{var be,$e,le;x(me.source),U(me.source,fe),E(fe,!1,(be=e.currentUser)===null||be===void 0?void 0:be.userId),me.source===G.EVENT_MESSAGE_UPDATED&&((le=($e=o.current).onMessagesUpdated)===null||le===void 0||le.call($e,fe))},onMessagesDeleted:(me,_e,fe,be)=>{const $e=be.map(te=>te.messageId),le=be.filter(Aa).map(te=>te.reqId);N($e,le),w($e,le)},onChannelDeleted:(me,_e)=>{var fe,be;(be=(fe=o.current).onChannelDeleted)===null||be===void 0||be.call(fe,_e)},onChannelUpdated:(me,_e)=>{var fe,be;h(),(be=(fe=o.current).onChannelUpdated)===null||be===void 0||be.call(fe,_e)},onHugeGapDetected:()=>{q(Number.MAX_SAFE_INTEGER,pf.collection.message.defaultLimit)}}),he.initialize(ff.CACHE_AND_REPLACE_BY_API).onCacheResult((me,_e)=>{var fe,be,$e;me?e.isCacheEnabled&&((fe=l==null?void 0:l.error)===null||fe===void 0||fe.call(l,"[useGroupChannelMessages/onCacheResult]",me)):_e&&((be=l==null?void 0:l.debug)===null||be===void 0||be.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",_e.length),E(_e,!0,($e=e.currentUser)===null||$e===void 0?void 0:$e.userId),de(),_e.length>0&&(f.current.initialized=!0,ce()))}).onApiResult((me,_e)=>{var fe,be,$e,le,te;me?(fe=l==null?void 0:l.warn)===null||fe===void 0||fe.call(l,"[useGroupChannelMessages/onApiResult]",me):_e&&((be=l==null?void 0:l.debug)===null||be===void 0||be.call(l,"[useGroupChannelMessages/onApiResult]","message length:",_e.length),E(_e,!0,($e=e.currentUser)===null||$e===void 0?void 0:$e.userId),o.current.startingPoint||(te=(le=o.current).onMessagesReceived)===null||te===void 0||te.call(le,_e),e.isCacheEnabled&&de()),f.current.initialized=!0,f.current.apiInitialized=!0,ce()})})}));OS(e,{onUserBanned(B,se){var ce,ye,ie;B.isGroupChannel()&&!EL(B,a.current)&&(se.userId===((ce=e.currentUser)===null||ce===void 0?void 0:ce.userId)?(ie=(ye=o.current).onCurrentUserBanned)===null||ie===void 0||ie.call(ye):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Fi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(I(!1),R(!0),yield q(u,c),R(!1),I(!0))}));return()=>clearTimeout(B)},[e,(i=e.currentUser)===null||i===void 0?void 0:i.userId,(s=a.current)===null||s===void 0?void 0:s.url,o.current.replyType]),D.useEffect(()=>()=>{f.current.instance&&f.current.instance.dispose()},[]);const P=hn(()=>Fi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(A(!0),yield q(Number.MAX_SAFE_INTEGER,pf.collection.message.defaultLimit),A(!1))})),X=hn(()=>Fi(void 0,void 0,void 0,function*(){var B;const se=f.current.instance;if(se!=null&&se.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const ce=yield se.loadPrevious();E(ce,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),z=hn(()=>{const{initialized:B,instance:se}=f.current;return B&&se?se.hasPrevious:!1}),H=hn(()=>Fi(void 0,void 0,void 0,function*(){var B;const se=f.current.instance;if(se!=null&&se.hasNext&&!d.current.next)try{d.current.next=!0;const ce=yield se.loadNext();E(ce,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),Se=hn(()=>{const{initialized:B,apiInitialized:se,instance:ce}=f.current;return se&&B&&ce?ce.hasNext:!1}),V=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendUserMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),J=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendFileMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),re=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(ye=>{const ie=[];a.current.sendFileMessages(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.isFileMessage()&&de.channelUrl===a.current.url&&(E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ie.push(de)),ie.length===B.length&&ye(ie)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url?(E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie.push(he)):ie.push(null),ie.length===B.length&&ye(ie)})})})),we=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendMultipleFilesMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onFileUploaded(()=>{h()}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),Z=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce,ye;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const ie=yield a.current.updateUserMessage(B,se);return ie.channelUrl===a.current.url&&E([ie],!1,(ye=e.currentUser)===null||ye===void 0?void 0:ye.userId),ie})),oe=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce,ye;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const ie=yield a.current.updateFileMessage(B,se);return ie.channelUrl===a.current.url&&E([ie],!1,(ye=e.currentUser)===null||ye===void 0?void 0:ye.userId),ie})),ee=hn(B=>Fi(void 0,void 0,void 0,function*(){var se;if(!a.current||!a.current.url)throw(se=l==null?void 0:l.error)===null||se===void 0||se.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ce,ye)=>{let ie;B.isUserMessage()&&(ie=a.current.resendMessage(B)),B.isFileMessage()&&(ie=a.current.resendMessage(B)),B.isMultipleFilesMessage()&&(ie=a.current.resendMessage(B)),ie&&("onPending"in ie&&ie.onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId)}),"onFileUploaded"in ie&&ie.onFileUploaded(()=>{h()}),"onSucceeded"in ie&&ie.onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ce(de)}),"onFailed"in ie&&ie.onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ye(de)}))})})),ue=hn(B=>Fi(void 0,void 0,void 0,function*(){var se,ce;if(!a.current||!a.current.url)throw(se=l==null?void 0:l.error)===null||se===void 0||se.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");if(B.sendingStatus==="succeeded")B.isUserMessage()&&(yield a.current.deleteMessage(B)),B.isFileMessage()&&(yield a.current.deleteMessage(B)),B.isMultipleFilesMessage()&&(yield a.current.deleteMessage(B));else try{yield(ce=f.current.instance)===null||ce===void 0?void 0:ce.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),$=hn(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),ke=hn(B=>Fi(void 0,void 0,void 0,function*(){var se;if(e.currentUser&&a.current){const ce=Ty(B);R(!0),E([],!0,(se=e.currentUser)===null||se===void 0?void 0:se.userId),yield q(B,ce),R(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,resetNewMessages:$,refresh:P,loadPrevious:X,hasPrevious:z,loadNext:H,hasNext:Se,sendUserMessage:V,sendFileMessage:J,sendFileMessages:re,sendMultipleFilesMessage:we,updateUserMessage:Z,updateFileMessage:oe,resendMessage:ee,deleteMessage:ue,resetWithStartingPoint:ke,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},tg=e=>kL(e),kL=e=>e();function LS(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&SL(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=LS(t[r],n[r]):t[r]=n[r])}),t}const ng=()=>({common:{enableUsingDefaultUserProfile:!1},groupChannel:{channel:{enableMention:!1,enableOgtag:!0,enableReactions:!0,enableReactionsSupergroup:!1,enableTypingIndicator:!0,enableVoiceMessage:!1,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}},replyType:"quote_reply",threadReplySelectType:"thread",typingIndicatorTypes:new Set(["text"]),enableFeedback:!1,enableSuggestedReplies:!1,showSuggestedRepliesFor:"last_message_only",suggestedRepliesDirection:"vertical"},channelList:{enableMessageReceiptStatus:!1,enableTypingIndicator:!1},setting:{enableMessageSearch:!1}},openChannel:{channel:{enableOgtag:!0,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}}}}});function RL(e){return delete e.groupChannel.channel.typingIndicatorTypes,delete e.groupChannel.channel.enableFeedback,delete e.groupChannel.channel.enableSuggestedReplies,delete e.groupChannel.channel.showSuggestedRepliesFor,delete e.groupChannel.channel.suggestedRepliesDirection,e}const DS=()=>{const e=ng();return RL(e)},wy=ng(),LL=DS();var vf=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const Em={items:{},getItem(e){var n;return vf(this,void 0,void 0,function*(){return(n=Em.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return vf(this,void 0,void 0,function*(){Em.items[e]=n})}};class DL{constructor(n){this.storage=n??Em}init(n){return this.key=`sbu@${n}.uikitConfiguration`,this.get()}get safeKey(){if(!this.key)throw new Error("Please UIKitConfigManager.init() first");return this.key}update(n){return vf(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:LS(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return vf(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:LL};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function UL(e,n,t){var r,i;t.common&&et((r=t.common)===null||r===void 0?void 0:r.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=t.common.enableUsingDefaultUserProfile),n.common&&et((i=n.common)===null||i===void 0?void 0:i.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=n.common.enableUsingDefaultUserProfile)}function PL(e,n,t){FL(e,n,t),HL(e,n,t),jL(e,n,t),BL(e,n,t)}function FL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze;!((r=t.groupChannel)===null||r===void 0)&&r.channel&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.groupChannel.channel.enableOgtag),!((o=n.groupChannel)===null||o===void 0)&&o.channel&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag),!((d=t.groupChannel)===null||d===void 0)&&d.channel&&et((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channel)===null||f===void 0?void 0:f.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channel)===null||m===void 0?void 0:m.enableTypingIndicator),!((b=n.groupChannel)===null||b===void 0)&&b.channel&&et((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channel)===null||_===void 0?void 0:_.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.enableTypingIndicator),!((w=t.groupChannel)===null||w===void 0)&&w.channel&&et((I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.enableReactions)&&(e.channel.enableReactions=(A=(R=t.groupChannel)===null||R===void 0?void 0:R.channel)===null||A===void 0?void 0:A.enableReactions),!((x=n.groupChannel)===null||x===void 0)&&x.channel&&et((q=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||q===void 0?void 0:q.enableReactions)&&(e.channel.enableReactions=(X=(P=n.groupChannel)===null||P===void 0?void 0:P.channel)===null||X===void 0?void 0:X.enableReactions),!((z=t.groupChannel)===null||z===void 0)&&z.channel&&et((Se=(H=t.groupChannel)===null||H===void 0?void 0:H.channel)===null||Se===void 0?void 0:Se.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(J=(V=t.groupChannel)===null||V===void 0?void 0:V.channel)===null||J===void 0?void 0:J.enableReactionsSupergroup),!((re=n.groupChannel)===null||re===void 0)&&re.channel&&et((Z=(we=n.groupChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(oe=n.groupChannel)===null||oe===void 0?void 0:oe.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ue=t.groupChannel)===null||ue===void 0)&&ue.channel&&et((ke=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||ke===void 0?void 0:ke.enableMention)&&(e.channel.enableMention=(se=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.enableMention),!((ce=n.groupChannel)===null||ce===void 0)&&ce.channel&&et((ie=(ye=n.groupChannel)===null||ye===void 0?void 0:ye.channel)===null||ie===void 0?void 0:ie.enableMention)&&(e.channel.enableMention=(he=(de=n.groupChannel)===null||de===void 0?void 0:de.channel)===null||he===void 0?void 0:he.enableMention),!((me=t.groupChannel)===null||me===void 0)&&me.channel&&Ka((fe=(_e=t.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=($e=(be=t.groupChannel)===null||be===void 0?void 0:be.channel)===null||$e===void 0?void 0:$e.replyType),!((le=n.groupChannel)===null||le===void 0)&&le.channel&&Ka((Me=(te=n.groupChannel)===null||te===void 0?void 0:te.channel)===null||Me===void 0?void 0:Me.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(ne=(Re=n.groupChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.replyType),!((Oe=t.groupChannel)===null||Oe===void 0)&&Oe.channel&&Ka((Qe=(nt=t.groupChannel)===null||nt===void 0?void 0:nt.channel)===null||Qe===void 0?void 0:Qe.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(at=(Fe=t.groupChannel)===null||Fe===void 0?void 0:Fe.channel)===null||at===void 0?void 0:at.threadReplySelectType),!((Ft=n.groupChannel)===null||Ft===void 0)&&Ft.channel&&Ka((ln=(_t=n.groupChannel)===null||_t===void 0?void 0:_t.channel)===null||ln===void 0?void 0:ln.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Wt=(kt=n.groupChannel)===null||kt===void 0?void 0:kt.channel)===null||Wt===void 0?void 0:Wt.threadReplySelectType),!((Jt=t.groupChannel)===null||Jt===void 0)&&Jt.channel&&et((en=(Ct=t.groupChannel)===null||Ct===void 0?void 0:Ct.channel)===null||en===void 0?void 0:en.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(xn=(tn=t.groupChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.enableVoiceMessage),!((Ht=n.groupChannel)===null||Ht===void 0)&&Ht.channel&&et((un=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Pn=(Un=n.groupChannel)===null||Un===void 0?void 0:Un.channel)===null||Pn===void 0?void 0:Pn.enableVoiceMessage),!((gn=n.groupChannel)===null||gn===void 0)&&gn.channel&&CL((xt=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||xt===void 0?void 0:xt.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(nn=(On=n.groupChannel)===null||On===void 0?void 0:On.channel)===null||nn===void 0?void 0:nn.typingIndicatorTypes),!((rn=n.groupChannel)===null||rn===void 0)&&rn.channel&&et((yn=(kn=n.groupChannel)===null||kn===void 0?void 0:kn.channel)===null||yn===void 0?void 0:yn.enableFeedback)&&(e.channel.enableFeedback=(Rn=(wt=n.groupChannel)===null||wt===void 0?void 0:wt.channel)===null||Rn===void 0?void 0:Rn.enableFeedback),!((sr=n.groupChannel)===null||sr===void 0)&&sr.channel&&et((En=(cn=n.groupChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Rt=(bn=n.groupChannel)===null||bn===void 0?void 0:bn.channel)===null||Rt===void 0?void 0:Rt.enableSuggestedReplies),!((Cn=n.groupChannel)===null||Cn===void 0)&&Cn.channel&&Ka((Hn=(Kt=n.groupChannel)===null||Kt===void 0?void 0:Kt.channel)===null||Hn===void 0?void 0:Hn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(or=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.showSuggestedRepliesFor),!((Ue=n.groupChannel)===null||Ue===void 0)&&Ue.channel&&Ka((pe=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||pe===void 0?void 0:pe.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(ze=(xe=n.groupChannel)===null||xe===void 0?void 0:xe.channel)===null||ze===void 0?void 0:ze.suggestedRepliesDirection)}function HL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze,vt;!((i=(r=t.groupChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&et((a=(o=(s=t.groupChannel)===null||s===void 0?void 0:s.channel)===null||o===void 0?void 0:o.input)===null||a===void 0?void 0:a.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.groupChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.groupChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&et((m=(p=(f=n.groupChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&et((A=(R=(I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||R===void 0?void 0:R.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(q=(U=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||q===void 0?void 0:q.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(z=(X=n.groupChannel)===null||X===void 0?void 0:X.channel)===null||z===void 0?void 0:z.input)===null||H===void 0)&&H.camera&&et((re=(J=(V=(Se=n.groupChannel)===null||Se===void 0?void 0:Se.channel)===null||V===void 0?void 0:V.input)===null||J===void 0?void 0:J.camera)===null||re===void 0?void 0:re.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(oe=(Z=(we=n.groupChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.input)===null||oe===void 0?void 0:oe.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((ke=($=(ue=t.groupChannel)===null||ue===void 0?void 0:ue.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&et((ye=(ce=(se=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.input)===null||ce===void 0?void 0:ce.camera)===null||ye===void 0?void 0:ye.enableVideo)&&(e.channel.input.camera.enableVideo=(me=(he=(de=(ie=t.groupChannel)===null||ie===void 0?void 0:ie.channel)===null||de===void 0?void 0:de.input)===null||he===void 0?void 0:he.camera)===null||me===void 0?void 0:me.enableVideo),!((be=(fe=(_e=n.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.input)===null||be===void 0)&&be.camera&&et((Me=(te=(le=($e=n.groupChannel)===null||$e===void 0?void 0:$e.channel)===null||le===void 0?void 0:le.input)===null||te===void 0?void 0:te.camera)===null||Me===void 0?void 0:Me.enableVideo)&&(e.channel.input.camera.enableVideo=(nt=(Oe=(ne=(Re=n.groupChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.input)===null||Oe===void 0?void 0:Oe.camera)===null||nt===void 0?void 0:nt.enableVideo),!((at=(Fe=(Qe=t.groupChannel)===null||Qe===void 0?void 0:Qe.channel)===null||Fe===void 0?void 0:Fe.input)===null||at===void 0)&&at.gallery&&et((kt=(ln=(_t=(Ft=t.groupChannel)===null||Ft===void 0?void 0:Ft.channel)===null||_t===void 0?void 0:_t.input)===null||ln===void 0?void 0:ln.gallery)===null||kt===void 0?void 0:kt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(en=(Ct=(Jt=(Wt=t.groupChannel)===null||Wt===void 0?void 0:Wt.channel)===null||Jt===void 0?void 0:Jt.input)===null||Ct===void 0?void 0:Ct.gallery)===null||en===void 0?void 0:en.enablePhoto),!((Ht=(xn=(tn=n.groupChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.input)===null||Ht===void 0)&&Ht.gallery&&et((Pn=(Un=(un=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(xt=(Fn=(gn=n.groupChannel)===null||gn===void 0?void 0:gn.channel)===null||Fn===void 0?void 0:Fn.input)===null||xt===void 0?void 0:xt.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(rn=(nn=t.groupChannel)===null||nn===void 0?void 0:nn.channel)===null||rn===void 0?void 0:rn.input)===null||kn===void 0)&&kn.gallery&&et((sr=(Rn=(wt=(yn=t.groupChannel)===null||yn===void 0?void 0:yn.channel)===null||wt===void 0?void 0:wt.input)===null||Rn===void 0?void 0:Rn.gallery)===null||sr===void 0?void 0:sr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Rt=(bn=(En=(cn=t.groupChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Rt===void 0?void 0:Rt.enableVideo),!((Hn=(Kt=(Cn=n.groupChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Kt===void 0?void 0:Kt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Ue=(or=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.input)===null||Ue===void 0?void 0:Ue.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(ze=(xe=(pe=n.groupChannel)===null||pe===void 0?void 0:pe.channel)===null||xe===void 0?void 0:xe.input)===null||ze===void 0?void 0:ze.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function jL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S;!((r=t.groupChannel)===null||r===void 0)&&r.channelList&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channelList)===null||s===void 0?void 0:s.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=t.groupChannel.channelList.enableTypingIndicator),!((o=n.groupChannel)===null||o===void 0)&&o.channelList&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.channelList)===null||l===void 0?void 0:l.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channelList)===null||c===void 0?void 0:c.enableTypingIndicator),!((d=t.groupChannel)===null||d===void 0)&&d.channelList&&et((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channelList)===null||f===void 0?void 0:f.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channelList)===null||m===void 0?void 0:m.enableMessageReceiptStatus),!((b=n.groupChannel)===null||b===void 0)&&b.channelList&&et((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channelList)===null||_===void 0?void 0:_.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channelList)===null||S===void 0?void 0:S.enableMessageReceiptStatus)}function BL(e,n,t){var r,i,s,o,a,l,u,c;!((r=t.groupChannel)===null||r===void 0)&&r.setting&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.setting)===null||s===void 0?void 0:s.enableMessageSearch)&&(e.setting.enableMessageSearch=t.groupChannel.setting.enableMessageSearch),!((o=n.groupChannel)===null||o===void 0)&&o.setting&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.setting)===null||l===void 0?void 0:l.enableMessageSearch)&&(e.setting.enableMessageSearch=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.setting)===null||c===void 0?void 0:c.enableMessageSearch)}function $L(e,n,t){GL(e,n,t),zL(e,n,t)}function GL(e,n,t){var r,i,s,o,a,l,u,c;!((r=t.openChannel)===null||r===void 0)&&r.channel&&et((s=(i=t.openChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.openChannel.channel.enableOgtag),!((o=n.openChannel)===null||o===void 0)&&o.channel&&et((l=(a=n.openChannel)===null||a===void 0?void 0:a.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.openChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag)}function zL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze,vt;!((i=(r=t.openChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&et((a=(o=(s=t.openChannel)===null||s===void 0?void 0:s.channel)===null||o===void 0?void 0:o.input)===null||a===void 0?void 0:a.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.openChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.openChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&et((m=(p=(f=n.openChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.openChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&et((A=(R=(I=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||R===void 0?void 0:R.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(q=(U=(x=t.openChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||q===void 0?void 0:q.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(z=(X=n.openChannel)===null||X===void 0?void 0:X.channel)===null||z===void 0?void 0:z.input)===null||H===void 0)&&H.camera&&et((re=(J=(V=(Se=n.openChannel)===null||Se===void 0?void 0:Se.channel)===null||V===void 0?void 0:V.input)===null||J===void 0?void 0:J.camera)===null||re===void 0?void 0:re.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(oe=(Z=(we=n.openChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.input)===null||oe===void 0?void 0:oe.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((ke=($=(ue=t.openChannel)===null||ue===void 0?void 0:ue.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&et((ye=(ce=(se=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.input)===null||ce===void 0?void 0:ce.camera)===null||ye===void 0?void 0:ye.enableVideo)&&(e.channel.input.camera.enableVideo=(me=(he=(de=(ie=t.openChannel)===null||ie===void 0?void 0:ie.channel)===null||de===void 0?void 0:de.input)===null||he===void 0?void 0:he.camera)===null||me===void 0?void 0:me.enableVideo),!((be=(fe=(_e=n.openChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.input)===null||be===void 0)&&be.camera&&et((Me=(te=(le=($e=n.openChannel)===null||$e===void 0?void 0:$e.channel)===null||le===void 0?void 0:le.input)===null||te===void 0?void 0:te.camera)===null||Me===void 0?void 0:Me.enableVideo)&&(e.channel.input.camera.enableVideo=(nt=(Oe=(ne=(Re=n.openChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.input)===null||Oe===void 0?void 0:Oe.camera)===null||nt===void 0?void 0:nt.enableVideo),!((at=(Fe=(Qe=t.openChannel)===null||Qe===void 0?void 0:Qe.channel)===null||Fe===void 0?void 0:Fe.input)===null||at===void 0)&&at.gallery&&et((kt=(ln=(_t=(Ft=t.openChannel)===null||Ft===void 0?void 0:Ft.channel)===null||_t===void 0?void 0:_t.input)===null||ln===void 0?void 0:ln.gallery)===null||kt===void 0?void 0:kt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(en=(Ct=(Jt=(Wt=t.openChannel)===null||Wt===void 0?void 0:Wt.channel)===null||Jt===void 0?void 0:Jt.input)===null||Ct===void 0?void 0:Ct.gallery)===null||en===void 0?void 0:en.enablePhoto),!((Ht=(xn=(tn=n.openChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.input)===null||Ht===void 0)&&Ht.gallery&&et((Pn=(Un=(un=(ft=n.openChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(xt=(Fn=(gn=n.openChannel)===null||gn===void 0?void 0:gn.channel)===null||Fn===void 0?void 0:Fn.input)===null||xt===void 0?void 0:xt.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(rn=(nn=t.openChannel)===null||nn===void 0?void 0:nn.channel)===null||rn===void 0?void 0:rn.input)===null||kn===void 0)&&kn.gallery&&et((sr=(Rn=(wt=(yn=t.openChannel)===null||yn===void 0?void 0:yn.channel)===null||wt===void 0?void 0:wt.input)===null||Rn===void 0?void 0:Rn.gallery)===null||sr===void 0?void 0:sr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Rt=(bn=(En=(cn=t.openChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Rt===void 0?void 0:Rt.enableVideo),!((Hn=(Kt=(Cn=n.openChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Kt===void 0?void 0:Kt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Ue=(or=(jn=n.openChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.input)===null||Ue===void 0?void 0:Ue.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(ze=(xe=(pe=n.openChannel)===null||pe===void 0?void 0:pe.channel)===null||xe===void 0?void 0:xe.input)===null||ze===void 0?void 0:ze.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function VL(e,n){const t=ng();return UL(t.common,e,n),PL(t.groupChannel,e,n),$L(t.openChannel,e,n),t}function qL(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var WL=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};function hu(e){var n,t;return(t=(n=e.appInfo)===null||n===void 0?void 0:n.applicationAttributes)!==null&&t!==void 0?t:[]}const US=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:wy,configsWithAppAttr:()=>wy}),KL=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(DS),[s]=D.useState(()=>new DL(e)),o=D.useCallback(u=>WL(void 0,void 0,void 0,function*(){const c=yield s.init(u.appId);if(u.appInfo&&u.appInfo.uikitConfigInfo.lastUpdatedAt===c.updatedAt)i(c.configuration);else try{const d=yield u.getUIKitConfiguration();if(qL(d.json)){const h=ym(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),a=VL(t,r),l=hn(u=>({groupChannel:{channel:{get enableReactions(){return a.groupChannel.channel.enableReactions&&hu(u).includes(au.reactions)},get enableReactionsSupergroup(){return a.groupChannel.channel.enableReactionsSupergroup&&hu(u).includes(au.reactions)},get enableOgtag(){return a.groupChannel.channel.enableOgtag&&hu(u).includes(au.enable_og_tag)}},setting:{get enableMessageSearch(){return a.groupChannel.setting.enableMessageSearch&&hu(u).includes(au.message_search_v3)}}},openChannel:{channel:{get enableOgtag(){return a.openChannel.channel.enableOgtag&&hu(u).includes(au.enable_og_tag)}}}}));return It.createElement(US.Provider,{value:{initDashboardConfigs:o,configs:a,configsWithAppAttr:l}},n)},QL=()=>D.useContext(US),PS=It.createContext(null);/*! +`)},n}(Tt),jv=function(e){function n(t){var r=t.userId,i=t.authToken,s=t.services,o=t.expiringSession,a=o===void 0||o,l=e.call(this)||this;return l.path="".concat(Xe,"/").concat(r,"/session_key"),l.method=Q.POST,l.params=Ee({token:i,services:s,expiring_session:!!a}),l.requireAuth=!1,l}return T(n,e),n}(Y),Z4=function(e){function n(t){var r=t.authToken,i=t.expiringSession,s=i===void 0||i,o=t.requestId,a=o===void 0?void 0:o;return e.call(this,{code:"LOGI",payload:Ee({token:r,expiring_session:s?1:0,req_id:a}),ackRequired:!0})||this}return T(n,e),n}(wr),X4=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.key,o=r.expires_at,a=r.services;return i.key=s,i.expiresAt=o,i.services=a,i}return T(n,e),n}(ae),J4=function(e){function n(t,r,i){var s,o=this;return(o=e.call(this,t,"LOGI",i)||this).error=null,o.newKey=null,o.newKey=(s=i.new_key)!==null&&s!==void 0?s:null,o.error=i.error?new L(i):null,o}return T(n,e),n}(mt),Bv=function(e){function n(t){var r=e.call(this)||this;return r.statLog=t,r}return T(n,e),n}(Tt),cC=function(e){function n(t){var r=t.request,i=t.deferred,s=t.error,o=s===void 0?L.requestFailed:s,a=e.call(this)||this;return a.request=r,a.deferred=i,a.error=o,a}return T(n,e),n}(Tt);(function(e){e.FEATURE_LOCALCACHE="feature:local_cache",e.FEATURE_LOCALCACHE_EVENT="feature:local_cache_event",e.NOTIFICATION="noti:stats",e.WEBSOCKET_CONNECT="ws:connect",e.API_RESULT="api:result"})(yt||(yt={}));var Vu,ha,Ci,jt=function(){function e(n){var t=n.type,r=n.data,i=n.ts,s=i===void 0?Date.now():i;this.type=t,this.createdAt=s,this.data=r}return e.payloadify=function(n){return Ee({stat_type:n.type,ts:n.createdAt,data:Ee(n.data)})},e}(),Q_=function(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},J2=function(){return!(typeof navigator>"u"||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(function(e){e.CHAT="chat",e.CALLS="calls",e.DESK="desk",e.LIVE="live",e.UIKIT_CHAT="uikit-chat",e.UIKIT_LIVE="uikit-live"})(Vu||(Vu={})),function(e){e.ANDROID="android",e.IOS="ios",e.JS="js",e.UNREAL="unreal",e.UNITY="unity",e.REACT_NATIVE="react-native",e.FLUTTER="flutter"}(ha||(ha={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(Ci||(Ci={}));var eA="^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",Kh=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=Q_()?ha.REACT_NATIVE:ha.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(bo.SDK_VERSION),device_os_platform:J2()?"mobile-web":"web",os_version:bo.OS_VERSION};if(n){var i=n.sendbirdExtensions,s=n.deviceOS,o=n.customData,a=o===void 0?{}:o;s.version&&(r.os_version=s.version),s.platform&&(r.device_os_platform=s.platform),i.length>0&&(r.extension_sdk_info=i.map(function(l){var u=l.product,c=l.platform,d=l.version;return"".concat(u,"/").concat(c,"/").concat(d)}).join(",")),Object.keys(r).forEach(function(l){return delete a[l]}),Object.keys(a).length>0&&(r=M(M({},r),a))}return Object.entries(r).map(function(l){var u=Ae(l,2),c=u[0],d=u[1];return"".concat(c,"=").concat(d)}).join("&")},e.userAgentWithExtension=function(n){var t=Q_()?"reactnative":"JS",r=n.sb_syncmanager?"s".concat(n.sb_syncmanager):"",i=n.sb_uikit?"u".concat(n.sb_uikit):"",s=n["device-os-platform"]?"o".concat(n["device-os-platform"]):J2()?"omobile-web":"oweb";return"".concat(t,"/c").concat(bo.SDK_VERSION,"/").concat(r,"/").concat(i,"/").concat(s)},e}(),Tr=function(){var e=this;this.promise=new Promise(function(n,t){e.resolve=n,e.reject=function(r){t(r)}})},Qh=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return T(n,e),n}(Tt),dC=function(e){function n(t){var r=e.call(this)||this;return r.method=Q.DELETE,r.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=Ee({mesg_token:t.messageToken})),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var tA=function(e){function n(t,r,i){var s,o=this;return(o=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,o.channelType=i.channel_type,o.messageId=Number(i.msg_id),o.silent=i.silent,o.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,o.senderId=(s=i.sender_id)!==null&&s!==void 0?s:void 0,o}return T(n,e),n}(mt),nA=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=n,this._session=r,this._sdkState=i,this._dispatcher=s,this._dispatcher.on(function(c){c instanceof Y4&&u.cancel(c.requestId)}),this._logger=o,this._shouldImportFetchCompat=l}return e.prototype._createHeader=function(n,t){var r=this._sdkState,i=r.appId,s=r.appVersion,o=r.sendbirdRuntimeEnvironment,a=M(M({},n.headers),{SendBird:"JS,".concat(bo.OS_VERSION,",").concat(bo.SDK_VERSION,",").concat(i).concat(s?",".concat(s):""),"SB-User-Agent":Kh.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":Kh.sendbirdSdkUserAgentWithExtension(o)});return t||(a["Content-Type"]="application/json; charset=utf-8"),n.requireAuth&&!n.hasSessionKey&&this._session.hasSession&&(a["Session-Key"]=this._session.sessionKey),a["App-Id"]=i,this._session&&this._session.authToken&&(a["Access-Token"]=this._session.authToken),a},e.prototype._statLogApiResult=function(n,t,r){this._dispatcher.dispatch(new Bv(new jt({type:yt.API_RESULT,data:{endpoint:n.path,method:n.method,success:!r,latency:Date.now()-t,error_code:r==null?void 0:r.code,error_description:r==null?void 0:r.message}})))},e.prototype._isBodyRequired=function(n){var t=n.method;return t!==Q.GET&&(t!==Q.DELETE||n instanceof dC)},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w;return g(this,function(N){switch(N.label){case 0:t=n.path,r=n.method,i=n.uploadProgressHandler,s=this._isBodyRequired(n),o=this._sdkState.api,a="".concat(o.host).concat(t).concat(s?"":n.query),l=s?n.payload:null,u=this._createHeader(n,l instanceof FormData?l:void 0),c=new AbortController,d=c.signal,this._abortControl.set(n.requestId,c),h=Date.now(),N.label=1;case 1:return N.trys.push([1,13,,14]),i?[4,tp(()=>import("./__bundle-c839c84a-ByicuUPg.js"),[])]:[3,6];case 2:f=N.sent().xmlHttpRequest,N.label=3;case 3:return N.trys.push([3,5,,6]),[4,f(this._iid,{requestId:n.requestId,method:n.method,url:a,headers:u,data:l??void 0,uploadProgressHandler:i})];case 4:return p=N.sent(),this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,p];case 5:if(!((m=N.sent())instanceof L&&m.code===Ie.XMLHTTPREQUEST_NOT_SUPPORTED))throw m;return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),[3,6];case 6:return this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,(typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global||{fetch:null}).fetch=null),typeof AbortController<"u"?[3,8]:[4,tp(()=>import("./__bundle-2aa1a987-CMNsz-_m.js").then(I=>I._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,tp(()=>import("./__bundle-347d730c-DeB8rVlp.js").then(I=>I._),[])];case 9:N.sent(),N.label=10;case 10:return[4,fetch(a,{method:r,body:l,headers:u,signal:d})];case 11:return[4,(b=N.sent()).json()];case 12:if(v=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new ae(this._iid,v)];if(v){if((_=new L(v)).isSessionExpiredError){if(this._dispatcher.dispatch(new Ul({reason:_.code})),!(n instanceof jv))return E=new Tr,this._dispatcher.dispatch(new cC({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Ul({reason:_.code})),_}throw L.requestFailed;case 13:throw S=N.sent(),this._statLogApiResult(n,h,S),S instanceof L?(this._logger.debug("fail api request",S),S):(S==null?void 0:S.name)==="AbortError"?L.requestCanceled:(w=L.networkError,this._logger.debug("fail api request",w),w);case 14:return[2]}})})},e.prototype.cancel=function(n){this._abortControl.has(n)&&(this._abortControl.get(n).abort(),this._abortControl.delete(n)),this._dispatcher.dispatch(new Qh({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=ve(this._abortControl.values()),i=r.next();!i.done;i=r.next())i.value.abort()}catch(s){n={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}this._abortControl.clear(),this._dispatcher.dispatch(new Qh({}))},e}(),qe=function(){};function Wl(e){let n=e.length;for(;--n>=0;)e[n]=0}const $v=256,hC=286,qu=30,Wu=15,Y_=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ah=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),rA=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),e1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=new Array(576);Wl(ws);const Ku=new Array(60);Wl(Ku);const kc=new Array(512);Wl(kc);const Qu=new Array(256);Wl(Qu);const Gv=new Array(29);Wl(Gv);const Yh=new Array(qu);function np(e,n,t,r,i){this.static_tree=e,this.extra_bits=n,this.extra_base=t,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let t1,n1,r1;function rp(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Wl(Yh);const fC=e=>e<256?kc[e]:kc[256+(e>>>7)],Rc=(e,n)=>{e.pending_buf[e.pending++]=255&n,e.pending_buf[e.pending++]=n>>>8&255},zr=(e,n,t)=>{e.bi_valid>16-t?(e.bi_buf|=n<>16-e.bi_valid,e.bi_valid+=t-16):(e.bi_buf|=n<{zr(e,t[2*n],t[2*n+1])},pC=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},_C=(e,n,t)=>{const r=new Array(16);let i,s,o=0;for(i=1;i<=Wu;i++)o=o+t[i-1]<<1,r[i]=o;for(s=0;s<=n;s++){let a=e[2*s+1];a!==0&&(e[2*s]=pC(r[a]++,a))}},mC=e=>{let n;for(n=0;n{e.bi_valid>8?Rc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},i1=(e,n,t,r)=>{const i=2*n,s=2*t;return e[i]{const r=e.heap[t];let i=t<<1;for(;i<=e.heap_len&&(i{let r,i,s,o,a=0;if(e.sym_next!==0)do r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],r===0?ls(e,i,n):(s=Qu[i],ls(e,s+$v+1,n),o=Y_[s],o!==0&&(i-=Gv[s],zr(e,i,o)),r--,s=fC(r),ls(e,s,t),o=ah[s],o!==0&&(r-=Yh[s],zr(e,r,o)));while(a{const t=n.dyn_tree,r=n.stat_desc.static_tree,i=n.stat_desc.has_stree,s=n.stat_desc.elems;let o,a,l,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o>1;o>=1;o--)ip(e,t,o);l=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ip(e,t,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,t[2*l]=t[2*o]+t[2*a],e.depth[l]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,t[2*o+1]=t[2*a+1]=l,e.heap[1]=l++,ip(e,t,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((c,d)=>{const h=d.dyn_tree,f=d.max_code,p=d.stat_desc.static_tree,m=d.stat_desc.has_stree,b=d.stat_desc.extra_bits,v=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,w,N,I,R,A=0;for(N=0;N<=Wu;N++)c.bl_count[N]=0;for(h[2*c.heap[c.heap_max]+1]=0,E=c.heap_max+1;E<573;E++)S=c.heap[E],N=h[2*h[2*S+1]+1]+1,N>_&&(N=_,A++),h[2*S+1]=N,S>f||(c.bl_count[N]++,I=0,S>=v&&(I=b[S-v]),R=h[2*S],c.opt_len+=R*(N+I),m&&(c.static_len+=R*(p[2*S+1]+I)));if(A!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,A-=2}while(A>0);for(N=_;N!==0;N--)for(S=c.bl_count[N];S!==0;)w=c.heap[--E],w>f||(h[2*w+1]!==N&&(c.opt_len+=(N-h[2*w+1])*h[2*w],h[2*w+1]=N),S--)}})(e,n),_C(t,u,e.bl_count)},o1=(e,n,t)=>{let r,i,s=-1,o=n[1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),n[2*(t+1)+1]=65535,r=0;r<=t;r++)i=o,o=n[2*(r+1)+1],++a{let r,i,s=-1,o=n[1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),r=0;r<=t;r++)if(i=o,o=n[2*(r+1)+1],!(++a{zr(e,0+(r?1:0),3),vC(e),Rc(e,t),Rc(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var iA=(e,n,t,r)=>{let i,s,o=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=(a=>{let l,u=4093624447;for(l=0;l<=31;l++,u>>>=1)if(1&u&&a.dyn_ltree[2*l]!==0)return 0;if(a.dyn_ltree[18]!==0||a.dyn_ltree[20]!==0||a.dyn_ltree[26]!==0)return 1;for(l=32;l<$v;l++)if(a.dyn_ltree[2*l]!==0)return 1;return 0})(e)),sp(e,e.l_desc),sp(e,e.d_desc),o=(a=>{let l;for(o1(a,a.dyn_ltree,a.l_desc.max_code),o1(a,a.dyn_dtree,a.d_desc.max_code),sp(a,a.bl_desc),l=18;l>=3&&a.bl_tree[2*e1[l]+1]===0;l--);return a.opt_len+=3*(l+1)+5+5+4,l})(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&n!==-1?gC(e,n,t,r):e.strategy===4||s===i?(zr(e,2+(r?1:0),3),s1(e,ws,Ku)):(zr(e,4+(r?1:0),3),((a,l,u,c)=>{let d;for(zr(a,l-257,5),zr(a,u-1,5),zr(a,c-4,4),d=0;d{l1||((()=>{let n,t,r,i,s;const o=new Array(16);for(r=0,i=0;i<28;i++)for(Gv[i]=r,n=0;n<1<>=7;i(e.pending_buf[e.sym_buf+e.sym_next++]=n,e.pending_buf[e.sym_buf+e.sym_next++]=n>>8,e.pending_buf[e.sym_buf+e.sym_next++]=t,n===0?e.dyn_ltree[2*t]++:(e.matches++,n--,e.dyn_ltree[2*(Qu[t]+$v+1)]++,e.dyn_dtree[2*fC(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{zr(e,2,3),ls(e,256,ws),(n=>{n.bi_valid===16?(Rc(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=255&n.bi_buf,n.bi_buf>>=8,n.bi_valid-=8)})(e)}},Yu=(e,n,t,r)=>{let i=65535&e,s=e>>>16&65535,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+n[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16};const oA=new Uint32Array((()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;n[t]=e}return n})());var Zn=(e,n,t,r)=>{const i=oA,s=r+t;e^=-1;for(let o=r;o>>8^i[255&(e^n[o])];return~e},Ta={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},La={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:aA,_tr_stored_block:Z_,_tr_flush_block:lA,_tr_tally:Co,_tr_align:uA}=sA,{Z_NO_FLUSH:So,Z_PARTIAL_FLUSH:cA,Z_FULL_FLUSH:dA,Z_FINISH:Si,Z_BLOCK:u1,Z_OK:ar,Z_STREAM_END:c1,Z_STREAM_ERROR:ns,Z_DATA_ERROR:hA,Z_BUF_ERROR:op,Z_DEFAULT_COMPRESSION:fA,Z_FILTERED:pA,Z_HUFFMAN_ONLY:Cd,Z_RLE:_A,Z_FIXED:mA,Z_DEFAULT_STRATEGY:vA,Z_UNKNOWN:gA,Z_DEFLATED:Zh}=La,na=258,_s=262,bl=42,Wo=113,wu=666,Ko=(e,n)=>(e.msg=Ta[n],n),d1=e=>2*e-(e>4?9:0),so=e=>{let n=e.length;for(;--n>=0;)e[n]=0},yA=e=>{let n,t,r,i=e.w_size;n=e.hash_size,r=n;do t=e.head[--r],e.head[r]=t>=i?t-i:0;while(--n);n=i,r=n;do t=e.prev[--r],e.prev[r]=t>=i?t-i:0;while(--n)};let To=(e,n,t)=>(n<{const n=e.state;let t=n.pending;t>e.avail_out&&(t=e.avail_out),t!==0&&(e.output.set(n.pending_buf.subarray(n.pending_out,n.pending_out+t),e.next_out),e.next_out+=t,n.pending_out+=t,e.total_out+=t,e.avail_out-=t,n.pending-=t,n.pending===0&&(n.pending_out=0))},ni=(e,n)=>{lA(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,Jr(e.strm)},gt=(e,n)=>{e.pending_buf[e.pending++]=n},lu=(e,n)=>{e.pending_buf[e.pending++]=n>>>8&255,e.pending_buf[e.pending++]=255&n},X_=(e,n,t,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,n.set(e.input.subarray(e.next_in,e.next_in+i),t),e.state.wrap===1?e.adler=Yu(e.adler,n,i,t):e.state.wrap===2&&(e.adler=Zn(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},yC=(e,n)=>{let t,r,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-_s?e.strstart-(e.w_size-_s):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+na;let f=u[s+o-1],p=u[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do if(t=n,u[t+o]===p&&u[t+o-1]===f&&u[t]===u[s]&&u[++t]===u[s+1]){s+=2,t++;do;while(u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&u[++s]===u[++t]&&so){if(e.match_start=n,o=r,r>=a)break;f=u[s+o-1],p=u[s+o]}}while((n=d[n&c])>l&&--i!=0);return o<=e.lookahead?o:e.lookahead},dl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-_s)&&(e.window.set(e.window.subarray(n,n+n-r),0),e.match_start-=n,e.strstart-=n,e.block_start-=n,e.insert>e.strstart&&(e.insert=e.strstart),yA(e),r+=n),e.strm.avail_in===0)break;if(t=X_(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=To(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=To(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<_s&&e.strm.avail_in!==0)},EC=(e,n)=>{let t,r,i,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(t=65535,i=e.bi_valid+42>>3,e.strm.avail_outr+e.strm.avail_in&&(t=r+e.strm.avail_in),t>i&&(t=i),t>8,e.pending_buf[e.pending-2]=~t,e.pending_buf[e.pending-1]=~t>>8,Jr(e.strm),r&&(r>t&&(r=t),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,t-=r),t&&(X_(e.strm,e.strm.output,e.strm.next_out,t),e.strm.next_out+=t,e.strm.avail_out-=t,e.strm.total_out+=t)}while(o===0);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(X_(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,s=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=s||(r||n===Si)&&n!==So&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,o=n===Si&&e.strm.avail_in===0&&t===r?1:0,Z_(e,e.block_start,t,o),e.block_start+=t,Jr(e.strm)),o?3:1)},ap=(e,n)=>{let t,r;for(;;){if(e.lookahead<_s){if(dl(e),e.lookahead<_s&&n===So)return 1;if(e.lookahead===0)break}if(t=0,e.lookahead>=3&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),t!==0&&e.strstart-t<=e.w_size-_s&&(e.match_length=yC(e,t)),e.match_length>=3)if(r=Co(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!=0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=To(e,e.ins_h,e.window[e.strstart+1]);else r=Co(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(ni(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Si?(ni(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ni(e,!1),e.strm.avail_out===0)?1:2},Va=(e,n)=>{let t,r,i;for(;;){if(e.lookahead<_s){if(dl(e),e.lookahead<_s&&n===So)return 1;if(e.lookahead===0)break}if(t=0,e.lookahead>=3&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,t!==0&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Co(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=To(e,e.ins_h,e.window[e.strstart+3-1]),t=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!=0);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(ni(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=Co(e,0,e.window[e.strstart-1]),r&&ni(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Co(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,n===Si?(ni(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ni(e,!1),e.strm.avail_out===0)?1:2};function es(e,n,t,r,i){this.good_length=e,this.max_lazy=n,this.nice_length=t,this.max_chain=r,this.func=i}const Nu=[new es(0,0,0,0,EC),new es(4,4,8,4,ap),new es(4,5,16,8,ap),new es(4,6,32,32,ap),new es(4,4,16,16,Va),new es(8,16,32,32,Va),new es(8,16,128,128,Va),new es(8,32,128,256,Va),new es(32,128,258,1024,Va),new es(32,258,258,4096,Va)];function EA(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Zh,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),so(this.dyn_ltree),so(this.dyn_dtree),so(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),so(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),so(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Iu=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.status!==bl&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Wo&&n.status!==wu?1:0},bC=e=>{if(Iu(e))return Ko(e,ns);e.total_in=e.total_out=0,e.data_type=gA;const n=e.state;return n.pending=0,n.pending_out=0,n.wrap<0&&(n.wrap=-n.wrap),n.status=n.wrap===2?57:n.wrap?bl:Wo,e.adler=n.wrap===2?0:1,n.last_flush=-2,aA(n),ar},CC=e=>{const n=bC(e);var t;return n===ar&&((t=e.state).window_size=2*t.w_size,so(t.head),t.max_lazy_match=Nu[t.level].max_lazy,t.good_match=Nu[t.level].good_length,t.nice_match=Nu[t.level].nice_length,t.max_chain_length=Nu[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n},h1=(e,n,t,r,i,s)=>{if(!e)return ns;let o=1;if(n===fA&&(n=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||t!==Zh||r<8||r>15||n<0||n>9||s<0||s>mA||r===8&&o!==1)return Ko(e,ns);r===8&&(r=9);const a=new EA;return e.state=a,a.strm=e,a.status=bl,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<h1(e,n,Zh,15,8,vA),deflateInit2:h1,deflateReset:CC,deflateResetKeep:bC,deflateSetHeader:(e,n)=>Iu(e)||e.state.wrap!==2?ns:(e.state.gzhead=n,ar),deflate:(e,n)=>{if(Iu(e)||n>u1||n<0)return e?Ko(e,ns):ns;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===wu&&n!==Si)return Ko(e,e.avail_out===0?op:ns);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(Jr(e),e.avail_out===0)return t.last_flush=-1,ar}else if(e.avail_in===0&&d1(n)<=d1(r)&&n!==Si)return Ko(e,op);if(t.status===wu&&e.avail_in!==0)return Ko(e,op);if(t.status===bl&&t.wrap===0&&(t.status=Wo),t.status===bl){let i=Zh+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Cd||t.level<2?0:t.level<6?1:t.level===6?2:3,i|=s<<6,t.strstart!==0&&(i|=32),i+=31-i%31,lu(t,i),t.strstart!==0&&(lu(t,e.adler>>>16),lu(t,65535&e.adler)),e.adler=1,t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(t.status===57){if(e.adler=0,gt(t,31),gt(t,139),gt(t,8),t.gzhead)gt(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),gt(t,255&t.gzhead.time),gt(t,t.gzhead.time>>8&255),gt(t,t.gzhead.time>>16&255),gt(t,t.gzhead.time>>24&255),gt(t,t.level===9?2:t.strategy>=Cd||t.level<2?4:0),gt(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(gt(t,255&t.gzhead.extra.length),gt(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=Zn(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(gt(t,0),gt(t,0),gt(t,0),gt(t,0),gt(t,0),gt(t,t.level===9?2:t.strategy>=Cd||t.level<2?4:0),gt(t,3),t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(t.status===69){if(t.gzhead.extra){let i=t.pending,s=(65535&t.gzhead.extra.length)-t.gzindex;for(;t.pending+s>t.pending_buf_size;){let a=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=a,Jr(e),t.pending!==0)return t.last_flush=-1,ar;i=0,s-=a}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending+=s,t.gzhead.hcrc&&t.pending>i&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=73}if(t.status===73){if(t.gzhead.name){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),Jr(e),t.pending!==0)return t.last_flush=-1,ar;s=0}i=t.gzindexs&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),t.gzindex=0}t.status=91}if(t.status===91){if(t.gzhead.comment){let i,s=t.pending;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>s&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s)),Jr(e),t.pending!==0)return t.last_flush=-1,ar;s=0}i=t.gzindexs&&(e.adler=Zn(e.adler,t.pending_buf,t.pending-s,s))}t.status=103}if(t.status===103){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Jr(e),t.pending!==0))return t.last_flush=-1,ar;gt(t,255&e.adler),gt(t,e.adler>>8&255),e.adler=0}if(t.status=Wo,Jr(e),t.pending!==0)return t.last_flush=-1,ar}if(e.avail_in!==0||t.lookahead!==0||n!==So&&t.status!==wu){let i=t.level===0?EC(t,n):t.strategy===Cd?((s,o)=>{let a;for(;;){if(s.lookahead===0&&(dl(s),s.lookahead===0)){if(o===So)return 1;break}if(s.match_length=0,a=Co(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,a&&(ni(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Si?(ni(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ni(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===_A?((s,o)=>{let a,l,u,c;const d=s.window;for(;;){if(s.lookahead<=na){if(dl(s),s.lookahead<=na&&o===So)return 1;if(s.lookahead===0)break}if(s.match_length=0,s.lookahead>=3&&s.strstart>0&&(u=s.strstart-1,l=d[u],l===d[++u]&&l===d[++u]&&l===d[++u])){c=s.strstart+na;do;while(l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&l===d[++u]&&us.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=3?(a=Co(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(a=Co(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),a&&(ni(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Si?(ni(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ni(s,!1),s.strm.avail_out===0)?1:2})(t,n):Nu[t.level].func(t,n);if(i!==3&&i!==4||(t.status=wu),i===1||i===3)return e.avail_out===0&&(t.last_flush=-1),ar;if(i===2&&(n===cA?uA(t):n!==u1&&(Z_(t,0,0,!1),n===dA&&(so(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Jr(e),e.avail_out===0))return t.last_flush=-1,ar}return n!==Si?ar:t.wrap<=0?c1:(t.wrap===2?(gt(t,255&e.adler),gt(t,e.adler>>8&255),gt(t,e.adler>>16&255),gt(t,e.adler>>24&255),gt(t,255&e.total_in),gt(t,e.total_in>>8&255),gt(t,e.total_in>>16&255),gt(t,e.total_in>>24&255)):(lu(t,e.adler>>>16),lu(t,65535&e.adler)),Jr(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ar:c1)},deflateEnd:e=>{if(Iu(e))return ns;const n=e.state.status;return e.state=null,n===Wo?Ko(e,hA):ar},deflateSetDictionary:(e,n)=>{let t=n.length;if(Iu(e))return ns;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==bl||r.lookahead)return ns;if(i===1&&(e.adler=Yu(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(so(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(n.subarray(t-r.w_size,t),0),n=l,t=r.w_size}const s=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=t,e.next_in=0,e.input=n,dl(r);r.lookahead>=3;){let l=r.strstart,u=r.lookahead-2;do r.ins_h=To(r,r.ins_h,r.window[l+3-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=2,dl(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,e.input=a,e.avail_in=s,r.wrap=i,ar},deflateInfo:"pako deflate (from Nodeca project)"};const bA=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var e0={assign:function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const r in t)bA(t,r)&&(e[r]=t[r])}}return e},flattenChunks:e=>{let n=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Lc[254]=Lc[254]=1;var Dc={string2buf:e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,r,i,s,o=e.length,a=0;for(i=0;i>>6,n[s++]=128|63&t):t<65536?(n[s++]=224|t>>>12,n[s++]=128|t>>>6&63,n[s++]=128|63&t):(n[s++]=240|t>>>18,n[s++]=128|t>>>12&63,n[s++]=128|t>>>6&63,n[s++]=128|63&t);return n},buf2string:(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let r,i;const s=new Array(2*t);for(i=0,r=0;r4)s[i++]=65533,r+=a-1;else{for(o&=a===2?31:a===3?15:7;a>1&&r1?s[i++]=65533:o<65536?s[i++]=o:(o-=65536,s[i++]=55296|o>>10&1023,s[i++]=56320|1023&o)}}return((o,a)=>{if(a<65534&&o.subarray&&SC)return String.fromCharCode.apply(null,o.length===a?o:o.subarray(0,a));let l="";for(let u=0;u{(n=n||e.length)>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(192&e[t])==128;)t--;return t<0||t===0?n:t+Lc[e[t]]>n?t:n}},TC=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const wC=Object.prototype.toString,{Z_NO_FLUSH:CA,Z_SYNC_FLUSH:SA,Z_FULL_FLUSH:TA,Z_FINISH:wA,Z_OK:Xh,Z_STREAM_END:NA,Z_DEFAULT_COMPRESSION:IA,Z_DEFAULT_STRATEGY:AA,Z_DEFLATED:MA}=La;function Xu(e){this.options=e0.assign({level:IA,method:MA,chunkSize:16384,windowBits:15,memLevel:8,strategy:AA},e||{});let n=this.options;n.raw&&n.windowBits>0?n.windowBits=-n.windowBits:n.gzip&&n.windowBits>0&&n.windowBits<16&&(n.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TC,this.strm.avail_out=0;let t=Zu.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==Xh)throw new Error(Ta[t]);if(n.header&&Zu.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?Dc.string2buf(n.dictionary):wC.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=Zu.deflateSetDictionary(this.strm,r),t!==Xh)throw new Error(Ta[t]);this._dict_set=!0}}function lp(e,n){const t=new Xu(n);if(t.push(e,!0),t.err)throw t.msg||Ta[t.err];return t.result}Xu.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=n===~~n?n:n===!0?wA:CA,typeof e=="string"?t.input=Dc.string2buf(e):wC.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;)if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(s===SA||s===TA)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=Zu.deflate(t,s),i===NA)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Zu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Xh;if(t.avail_out!==0){if(s>0&&t.next_out>0)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else if(t.avail_in===0)break}else this.onData(t.output)}return!0},Xu.prototype.onData=function(e){this.chunks.push(e)},Xu.prototype.onEnd=function(e){e===Xh&&(this.result=e0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var xA={Deflate:Xu,deflate:lp,deflateRaw:function(e,n){return(n=n||{}).raw=!0,lp(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,lp(e,n)},constants:La};const Sd=16209;var OA=function(e,n){let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A;const x=e.state;t=e.next_in,R=e.input,r=t+(e.avail_in-5),i=e.next_out,A=e.output,s=i-(n-e.avail_out),o=i+(e.avail_out-257),a=x.dmax,l=x.wsize,u=x.whave,c=x.wnext,d=x.window,h=x.hold,f=x.bits,p=x.lencode,m=x.distcode,b=(1<>>24,h>>>=E,f-=E,E=_>>>16&255,E===0)A[i++]=65535&_;else{if(!(16&E)){if(64&E){if(32&E){x.mode=16191;break e}e.msg="invalid literal/length code",x.mode=Sd;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=R[t++]<>>24,h>>>=E,f-=E,E=_>>>16&255,16&E){if(w=65535&_,E&=15,fa){e.msg="invalid distance too far back",x.mode=Sd;break e}if(h>>>=E,f-=E,E=i-s,w>E){if(E=w-E,E>u&&x.sane){e.msg="invalid distance too far back",x.mode=Sd;break e}if(N=0,I=d,c===0){if(N+=l-E,E2;)A[i++]=I[N++],A[i++]=I[N++],A[i++]=I[N++],S-=3;S&&(A[i++]=I[N++],S>1&&(A[i++]=I[N++]))}else{N=i-w;do A[i++]=A[N++],A[i++]=A[N++],A[i++]=A[N++],S-=3;while(S>2);S&&(A[i++]=A[N++],S>1&&(A[i++]=A[N++]))}break}if(64&E){e.msg="invalid distance code",x.mode=Sd;break e}_=m[(65535&_)+(h&(1<>3,t-=S,f-=S<<3,h&=(1<{const l=a.bits;let u,c,d,h,f,p,m=0,b=0,v=0,_=0,E=0,S=0,w=0,N=0,I=0,R=0,A=null;const x=new Uint16Array(16),U=new Uint16Array(16);let q,P,X,z=null;for(m=0;m<=Td;m++)x[m]=0;for(b=0;b=1&&x[_]===0;_--);if(E>_&&(E=_),_===0)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(v=1;v<_&&x[v]===0;v++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&I>592)return 1;for(;;){q=m-w,o[b]+1=p?(P=z[o[b]-p],X=A[o[b]-p]):(P=96,X=0),u=1<>w)+c]=q<<24|P<<16|X;while(c!==0);for(u=1<>=1;if(u!==0?(R&=u-1,R+=u):R=0,b++,--x[m]==0){if(m===_)break;m=n[t+o[b]]}if(m>E&&(R&h)!==d){for(w===0&&(w=E),f+=v,S=m-w,N=1<852||e===2&&I>592)return 1;d=R&h,i[d]=E<<24|S<<16|f-s}}return R!==0&&(i[f+R]=m-w<<24|64<<16),a.bits=E,0};const{Z_FINISH:f1,Z_BLOCK:UA,Z_TREES:wd,Z_OK:Qo,Z_STREAM_END:PA,Z_NEED_DICT:FA,Z_STREAM_ERROR:yi,Z_DATA_ERROR:p1,Z_MEM_ERROR:_1,Z_BUF_ERROR:HA,Z_DEFLATED:m1}=La,t0=16180,Nd=16190,Es=16191,up=16192,cp=16194,Id=16199,Ad=16200,dp=16206,Qt=16209,v1=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function jA(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ra=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},NC=e=>{if(ra(e))return yi;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=1&n.wrap),n.mode=t0,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(852),n.distcode=n.distdyn=new Int32Array(592),n.sane=1,n.back=-1,Qo},IC=e=>{if(ra(e))return yi;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,NC(e)},AC=(e,n)=>{let t;if(ra(e))return yi;const r=e.state;return n<0?(t=0,n=-n):(t=5+(n>>4),n<48&&(n&=15)),n&&(n<8||n>15)?yi:(r.window!==null&&r.wbits!==n&&(r.window=null),r.wrap=t,r.wbits=n,IC(e))},g1=(e,n)=>{if(!e)return yi;const t=new jA;e.state=t,t.strm=e,t.window=null,t.mode=t0;const r=AC(e,n);return r!==Qo&&(e.state=null),r};let hp,fp,y1=!0;const BA=e=>{if(y1){hp=new Int32Array(512),fp=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(Ju(1,e.lens,0,288,hp,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Ju(2,e.lens,0,32,fp,0,e.work,{bits:5}),y1=!1}e.lencode=hp,e.lenbits=9,e.distcode=fp,e.distbits=5},E1=(e,n,t,r)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(s.window.set(n.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(n.subarray(t-r,t-r+i),s.wnext),(r-=i)?(s.window.set(n.subarray(t-r,t),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whaveg1(e,15),inflateInit2:g1,inflate:(e,n)=>{let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R=0;const A=new Uint8Array(4);let x,U;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ra(e)||!e.output||!e.input&&e.avail_in!==0)return yi;t=e.state,t.mode===Es&&(t.mode=up),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,a=e.avail_in,u=t.hold,c=t.bits,d=a,h=l,I=Qo;e:for(;;)switch(t.mode){case t0:if(t.wrap===0){t.mode=up;break}for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Zn(t.check,A,2,0),u=0,c=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",t.mode=Qt;break}if((15&u)!==m1){e.msg="unknown compression method",t.mode=Qt;break}if(u>>>=4,c-=4,N=8+(15&u),t.wbits===0&&(t.wbits=N),N>15||N>t.wbits){e.msg="invalid window size",t.mode=Qt;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0,t.mode=16182;case 16182:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,t.check=Zn(t.check,A,4,0)),u=0,c=0,t.mode=16183;case 16183:for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>8),512&t.flags&&4&t.wrap&&(A[0]=255&u,A[1]=u>>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0,t.mode=16184;case 16184:if(1024&t.flags){for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Zn(t.check,A,2,0)),u=0,c=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(f=t.length,f>a&&(f=a),f&&(t.head&&(N=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(s,s+f),N)),512&t.flags&&4&t.wrap&&(t.check=Zn(t.check,r,f,s)),a-=f,s+=f,t.length-=f),t.length))break e;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(a===0)break e;f=0;do N=r[s+f++],t.head&&N&&t.length<65536&&(t.head.name+=String.fromCharCode(N));while(N&&f>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=Es;break;case 16189:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=dp;break}for(;c<3;){if(a===0)break e;a--,u+=r[s++]<>>=1,c-=1,3&u){case 0:t.mode=16193;break;case 1:if(BA(t),t.mode=Id,n===wd){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=Qt}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(a===0)break e;a--,u+=r[s++]<>>16^65535)){e.msg="invalid stored block lengths",t.mode=Qt;break}if(t.length=65535&u,u=0,c=0,t.mode=cp,n===wd)break e;case cp:t.mode=16195;case 16195:if(f=t.length,f){if(f>a&&(f=a),f>l&&(f=l),f===0)break e;i.set(r.subarray(s,s+f),o),a-=f,s+=f,l-=f,o+=f,t.length-=f;break}t.mode=Es;break;case 16196:for(;c<14;){if(a===0)break e;a--,u+=r[s++]<>>=5,c-=5,t.ndist=1+(31&u),u>>>=5,c-=5,t.ncode=4+(15&u),u>>>=4,c-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=Qt;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[q[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,x={bits:t.lenbits},I=Ju(0,t.lens,0,19,t.lencode,0,t.work,x),t.lenbits=x.bits,I){e.msg="invalid code lengths set",t.mode=Qt;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=b,c-=b,t.lens[t.have++]=_;else{if(_===16){for(U=b+2;c>>=b,c-=b,t.have===0){e.msg="invalid bit length repeat",t.mode=Qt;break}N=t.lens[t.have-1],f=3+(3&u),u>>>=2,c-=2}else if(_===17){for(U=b+3;c>>=b,c-=b,N=0,f=3+(7&u),u>>>=3,c-=3}else{for(U=b+7;c>>=b,c-=b,N=0,f=11+(127&u),u>>>=7,c-=7}if(t.have+f>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=Qt;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===Qt)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=Qt;break}if(t.lenbits=9,x={bits:t.lenbits},I=Ju(1,t.lens,0,t.nlen,t.lencode,0,t.work,x),t.lenbits=x.bits,I){e.msg="invalid literal/lengths set",t.mode=Qt;break}if(t.distbits=6,t.distcode=t.distdyn,x={bits:t.distbits},I=Ju(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,x),t.distbits=x.bits,I){e.msg="invalid distances set",t.mode=Qt;break}if(t.mode=Id,n===wd)break e;case Id:t.mode=Ad;case Ad:if(a>=6&&l>=258){e.next_out=o,e.avail_out=l,e.next_in=s,e.avail_in=a,t.hold=u,t.bits=c,OA(e,h),o=e.next_out,i=e.output,l=e.avail_out,s=e.next_in,r=e.input,a=e.avail_in,u=t.hold,c=t.bits,t.mode===Es&&(t.back=-1);break}for(t.back=0;R=t.lencode[u&(1<>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=R>>>24,v=R>>>16&255,_=65535&R,!(E+b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,t.length=_,v===0){t.mode=16205;break}if(32&v){t.back=-1,t.mode=Es;break}if(64&v){e.msg="invalid literal/length code",t.mode=Qt;break}t.extra=15&v,t.mode=16201;case 16201:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;R=t.distcode[u&(1<>>24,v=R>>>16&255,_=65535&R,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=R>>>24,v=R>>>16&255,_=65535&R,!(E+b<=c);){if(a===0)break e;a--,u+=r[s++]<>>=E,c-=E,t.back+=E}if(u>>>=b,c-=b,t.back+=b,64&v){e.msg="invalid distance code",t.mode=Qt;break}t.offset=_,t.extra=15&v,t.mode=16203;case 16203:if(t.extra){for(U=t.extra;c>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=Qt;break}t.mode=16204;case 16204:if(l===0)break e;if(f=h-l,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=Qt;break}f>t.wnext?(f-=t.wnext,p=t.wsize-f):p=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,p=o-t.offset,f=t.length;f>l&&(f=l),l-=f,t.length-=f;do i[o++]=m[p++];while(--f);t.length===0&&(t.mode=Ad);break;case 16205:if(l===0)break e;i[o++]=t.length,l--,t.mode=Ad;break;case dp:if(t.wrap){for(;c<32;){if(a===0)break e;a--,u|=r[s++]<{if(ra(e))return yi;let n=e.state;return n.window&&(n.window=null),e.state=null,Qo},inflateGetHeader:(e,n)=>{if(ra(e))return yi;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,Qo):yi},inflateSetDictionary:(e,n)=>{const t=n.length;let r,i,s;return ra(e)?yi:(r=e.state,r.wrap!==0&&r.mode!==Nd?yi:r.mode===Nd&&(i=1,i=Yu(i,n,t,0),i!==r.check)?p1:(s=E1(e,n,t,t),s?(r.mode=16210,_1):(r.havedict=1,Qo)))},inflateInfo:"pako inflate (from Nodeca project)"},$A=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const MC=Object.prototype.toString,{Z_NO_FLUSH:GA,Z_FINISH:zA,Z_OK:ec,Z_STREAM_END:pp,Z_NEED_DICT:_p,Z_STREAM_ERROR:VA,Z_DATA_ERROR:b1,Z_MEM_ERROR:qA}=La;function tc(e){this.options=e0.assign({chunkSize:65536,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),!(n.windowBits>=0&&n.windowBits<16)||e&&e.windowBits||(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(15&n.windowBits||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TC,this.strm.avail_out=0;let t=Ms.inflateInit2(this.strm,n.windowBits);if(t!==ec)throw new Error(Ta[t]);if(this.header=new $A,Ms.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Dc.string2buf(n.dictionary):MC.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Ms.inflateSetDictionary(this.strm,n.dictionary),t!==ec)))throw new Error(Ta[t])}function mp(e,n){const t=new tc(n);if(t.push(e),t.err)throw t.msg||Ta[t.err];return t.result}tc.prototype.push=function(e,n){const t=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=n===~~n?n:n===!0?zA:GA,MC.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),s=Ms.inflate(t,o),s===_p&&i&&(s=Ms.inflateSetDictionary(t,i),s===ec?s=Ms.inflate(t,o):s===b1&&(s=_p));t.avail_in>0&&s===pp&&t.state.wrap>0&&e[t.next_in]!==0;)Ms.inflateReset(t),s=Ms.inflate(t,o);switch(s){case VA:case b1:case _p:case qA:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===pp))if(this.options.to==="string"){let l=Dc.utf8border(t.output,t.next_out),u=t.next_out-l,c=Dc.buf2string(t.output,l);t.next_out=u,t.avail_out=r-u,u&&t.output.set(t.output.subarray(l,l+u),0),this.onData(c)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(s!==ec||a!==0){if(s===pp)return s=Ms.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},tc.prototype.onData=function(e){this.chunks.push(e)},tc.prototype.onEnd=function(e){e===ec&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var WA={Inflate:tc,inflate:mp,inflateRaw:function(e,n){return(n=n||{}).raw=!0,mp(e,n)},ungzip:mp,constants:La};const{Deflate:KA,deflate:QA,deflateRaw:YA,gzip:ZA}=xA,{Inflate:XA,inflate:JA,inflateRaw:e6,ungzip:t6}=WA;var us,n6={Deflate:KA,deflate:QA,deflateRaw:YA,gzip:ZA,Inflate:XA,inflate:JA,inflateRaw:e6,ungzip:t6,constants:La},C1=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){return n=n6.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(us||(us={}));var st,r6=function(e){function n(t,r){var i=r.sdkState,s=r.dispatcher,o=r.logger,a=e.call(this)||this;return a.lastActive=0,a._iid=t,a._sdkState=i,a._dispatcher=s,a._logger=o,a}return T(n,e),Object.defineProperty(n.prototype,"isOpen",{get:function(){return this.connectionState===us.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return us.CONNECTING;case 1:return us.OPEN}return us.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ws",{get:function(){var t;return(t=this._ws)!==null&&t!==void 0?t:null},enumerable:!1,configurable:!0}),n.prototype._handleMessage=function(t){var r=this;t.split(` +`).forEach(function(i){if(i){var s=mt.createFromRawMessage(r._iid,i);if(r._logger.debug("receive websocket event",s),s.code==="LOGI")r.dispatch("message",s);else if(s.code==="PONG")r.dispatch("pong");else if(s.code==="EXPR"){if(s.payload){var o=new Ul(s.payload);o.expiresIn>=0&&r._dispatcher.dispatch(o)}}else s.code==="NOOP"||r.dispatch("message",s)}})},n.prototype.connect=function(t,r){var i=this;r===void 0&&(r=""),this._ws=new WebSocket(t,encodeURIComponent(r)),this._ws.onopen=function(){i._logger.debug("websocket open"),i.dispatch("open")},this._ws.onmessage=function(s){return y(i,void 0,void 0,function(){var o,a,l,u,c=this;return g(this,function(d){switch(d.label){case 0:return!((u=this._sdkState.websocket)===null||u===void 0)&&u.compression?s.data instanceof Blob?((o=new FileReader).readAsArrayBuffer(s.data),o.onloadend=function(){return y(c,void 0,void 0,function(){var h,f;return g(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,C1(o.result)];case 1:return h=p.sent(),this._handleMessage(h),[3,3];case 2:return f=p.sent(),this.error(f),[3,3];case 3:return[2]}})})},[3,7]):[3,1]:[3,8];case 1:if(!(s.data instanceof ArrayBuffer))return[3,6];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,C1(new Uint8Array(s.data))];case 3:return a=d.sent(),this._handleMessage(a),[3,5];case 4:return l=d.sent(),this.error(l),[3,5];case 5:return[3,7];case 6:typeof s.data=="string"&&this._handleMessage(s.data),d.label=7;case 7:return[3,9];case 8:this._handleMessage(s.data),d.label=9;case 9:return[2]}})})},this._ws.onerror=function(){i._logger.debug("websocket error"),i.dispatch("error",L.networkError)},this._ws.onclose=function(){i._logger.debug("websocket close"),i.dispatch("close")},this.lastActive=Date.now()},n.prototype.disconnect=function(){var t=this;return new Promise(function(r){t._logger.debug("websocket disconnect"),t._ws?(t._ws.onopen=qe,t._ws.onmessage=qe,t._ws.onerror=qe,t.connectionState!==us.CLOSED?(t._ws.onclose=function(){t.dispatch("close"),r()},t._ws.close(),t._ws=void 0):r()):r()})},n.prototype.send=function(t){if(!this._ws)throw L.connectionClosed;t.code!=="PING"?this.dispatch("ping-refresh"):this._logger.debug("send ping",t),this._ws.send(t.convertToMessage())},n.prototype.error=function(t){this._logger.debug("websocket error",t),this.dispatch("error",t)},n}(Ra),xC=function(e){function n(t){var r=t.all,i=t.feed,s=t.custom_types,o=t.ts,a=e.call(this)||this;return a.all=r,a.feed=i,a.customTypes=s,a.ts=o,a}return T(n,e),n}(Tt),i6=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._ackStateMap=new Map,this._sdkState=i,this._dispatcher=s,this._logger=o,this.apiClient=new nA(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this.websocketClient=new r6(n,{sdkState:i,dispatcher:s,logger:o}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new xC(c.payload.unread_cnt)),c.requestId){if(u._ackStateMap.has(c.requestId)){var d=u._ackStateMap.get(c.requestId);c.code!=="EROR"?d.resolve(c):d.reject(new L({code:c.payload.code,message:c.payload.message}))}}else u._dispatcher.dispatch(c)}).on("close",function(){u._ackStateMap.forEach(function(c){c.reject(L.connectionClosed)}),u._ackStateMap.clear()})}return e.prototype._sendApiRequest=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.apiClient.send(n)];case 1:return[2,t.sent()]}})})},e.prototype._sendWebsocketRequest=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(o){if(!this._sdkState.websocket)throw L.connectionRequired;if(t=new Tr,n.ackRequired){i=function(a,l){s._ackStateMap.has(n.requestId)&&(s._ackStateMap.delete(n.requestId),r&&(clearTimeout(r),r=null),a?(s._logger.debug("fail websocket request",n.requestId,a),t.reject(a)):(s._logger.debug("receive websocket ack",n.requestId,n),s._logger.debug("receive websocket ack",l),t.resolve(l)))};try{r=setTimeout(function(){return i(L.noAckTimeout)},this._sdkState.websocket.responseTimeout),this._ackStateMap.set(n.requestId,{resolve:function(a){return i(void 0,a)},reject:function(a){return i(a)}}),this.websocketClient.send(n)}catch(a){i(a)}}else try{this.websocketClient.send(n),t.resolve()}catch(a){t.reject(a)}return[2,t.promise]})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return n instanceof Y?[4,this._sendApiRequest(n)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return n instanceof wr?[4,this._sendWebsocketRequest(n)]:[3,4];case 4:throw L.invalidParameters}})})},e.prototype.cancel=function(n){this.apiClient.cancel(n)},e.prototype.cancelAll=function(){this.apiClient.cancelAll()},e}();(function(e){e[e.NONE=0]="NONE",e[e.INITIALIZED=1]="INITIALIZED",e[e.CONNECTING=2]="CONNECTING",e[e.CONNECTED=3]="CONNECTED",e[e.RECONNECTING=4]="RECONNECTING",e[e.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",e[e.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",e[e.LOGOUT=7]="LOGOUT"})(st||(st={}));var ia,sa,_i=function(e){function n(t){var r=t.stateType,i=e.call(this)||this;return i.stateType=r,i}return T(n,e),n}(Tt),OC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),J_=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),kC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),S1=function(){function e(n){var t,r,i,s;this.isEnabled=(t=n.enabled)!==null&&t!==void 0&&t,this.feedChannels=(r=n.feed_channels)!==null&&r!==void 0?r:{},this.templateListToken=(i=n.template_list_token)!==null&&i!==void 0?i:null,this.settingsUpdatedAt=(s=n.settings_updated_at)!==null&&s!==void 0?s:0}return e.payloadify=function(n){return Ee(Ne({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),zv=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},T1=function(){function e(n){var t;this.lastUpdatedAt=(t=n.last_updated_at)!==null&&t!==void 0?t:0}return e.payloadify=function(n){return Ee(Ne({last_updated_at:n.lastUpdatedAt}))},e}(),w1=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return Ee(Ne({template_list_token:n.token}))},e}(),Md=function(){function e(n){n===void 0&&(n={min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}),this.minStatCount=n.min_stat_count,this.minInterval=1e3*n.min_interval,this.maxStatCountPerRequest=n.max_stat_count_per_request,this.lowerThreshold=n.lower_threshold,this.requestDelayRange=1e3*n.request_delay_range}return e.payloadify=function(n){return Ee(Ne({min_stat_count:n.minStatCount,min_interval:n.minInterval/1e3,max_stat_count_per_request:n.maxStatCountPerRequest,lower_threshold:n.lowerThreshold,request_delay_range:n.requestDelayRange/1e3}))},e}(),vp=function(){function e(n){n===void 0&&(n={default:{min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}}),this.default=new Md(n.default),this.realTime=new Md(n.realtime)}return e.payloadify=function(n){return Ee(Ne({default:Md.payloadify(n.default),realtime:Md.payloadify(n.realTime)}))},e}(),N1=1048576,s6=5;(function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"})(ia||(ia={})),function(e){e[e.NONE=0]="NONE",e[e.INCLUDE_REPLY=1]="INCLUDE_REPLY",e[e.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",e[e.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL"}(sa||(sa={}));var I1=function(){function e(n){var t,r,i,s,o,a,l;n===void 0&&(n={}),this.emojiHash=n.emoji_hash||"",this.uploadSizeLimit=n.file_upload_size_limit?n.file_upload_size_limit*N1:Number.MAX_SAFE_INTEGER,this.useReaction=!!n.use_reaction,this.applicationAttributes=(t=n.application_attributes)!==null&&t!==void 0?t:[],this.premiumFeatureList=(r=n.premium_feature_list)!==null&&r!==void 0?r:[],this.deviceTokenCache=this.applicationAttributes.includes("sdk_device_token_cache"),this.enabledChannelMemberShipHistory=this.applicationAttributes.includes("channel_membership_history"),this.multipleFilesMessageFileCountLimit=(i=n.multiple_file_send_max_size)!==null&&i!==void 0?i:5,this.allowSdkStatsUpload=(s=n.allow_sdk_log_ingestion)===null||s===void 0||s,this.unreadCountThreadingPolicy=(o=n.unread_cnt_threading_policy)!==null&&o!==void 0?o:ia.NONE,this.lastMessageThreadingPolicy=(a=n.last_msg_threading_policy)!==null&&a!==void 0?a:sa.NONE,this.uikitConfigInfo=new T1((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new S1(n.notifications):null,this.messageTemplateInfo=n.message_template?new w1(n.message_template):null,this.statConfigInfo=n.log_publish_config?new vp(n.log_publish_config):new vp}return e.payloadify=function(n){return Ee(Ne({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/N1,application_attributes:n.applicationAttributes,premium_feature_list:n.premiumFeatureList,use_reaction:n.useReaction,allow_sdk_log_ingestion:n.allowSdkStatsUpload,unread_cnt_threading_policy:n.unreadCountThreadingPolicy,last_msg_threading_policy:n.lastMessageThreadingPolicy,uikit_config:n.uikitConfigInfo?T1.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?S1.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?w1.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?vp.payloadify(n.statConfigInfo):null}))},e}(),Wn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),o6=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(r,"/metadata"),s.params={metadata:i},s}return T(n,e),n}(Y),a6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return T(n,e),n}(ae),l6=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(r,"/metadata"),o.params={metadata:i,upsert:s},o}return T(n,e),n}(Y),u6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return T(n,e),n}(ae),c6=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(r,"/metadata/").concat(i),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var d6=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(r,"/metadata"),i}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var hl,Kc=function(e,n){var t=JSON.parse(JSON.stringify(e));return t._iid&&delete t._iid,n&&n(t),t},fa=function(e,n){var t=JSON.parse(JSON.stringify(e));return t},K=function(e){return{do:function(n){e||n()},throw:function(n){if(!e)throw n}}};(function(e){e.ONLINE="online",e.OFFLINE="offline",e.NON_AVAILABLE="nonavailable"})(hl||(hl={}));var Pl,Ke=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t)||this).userId=(s=(i=r.guest_id)!==null&&i!==void 0?i:r.user_id)!==null&&s!==void 0?s:"",b.nickname=(a=(o=r.nickname)!==null&&o!==void 0?o:r.name)!==null&&a!==void 0?a:"",b.plainProfileUrl=(u=(l=r.profile_url)!==null&&l!==void 0?l:r.image)!==null&&u!==void 0?u:"",b.requireAuth=(c=r.require_auth_for_profile_image)!==null&&c!==void 0&&c,b.metaData=(d=r.metadata)!==null&&d!==void 0?d:{},b.connectionStatus=hl.NON_AVAILABLE,Ge(hl,r.is_online)?b.connectionStatus=r.is_online:k("boolean",r.is_online)&&(b.connectionStatus=r.is_online?hl.ONLINE:hl.OFFLINE),b.isActive=(h=r.is_active)===null||h===void 0||h,b.lastSeenAt=(f=r.last_seen_at)!==null&&f!==void 0?f:null,b.preferredLanguages=r.preferred_languages?Pe([],Ae(r.preferred_languages),!1):null,b.friendDiscoveryKey=(p=r.friend_discovery_key)!==null&&p!==void 0?p:null,b.friendName=(m=r.friend_name)!==null&&m!==void 0?m:null,b}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{user_id:t.userId,nickname:t.nickname,profile_url:t.plainProfileUrl,require_auth_for_profile_image:t.requireAuth,metadata:t.metaData,is_online:t.connectionStatus,is_active:t.isActive,last_seen_at:t.lastSeenAt,preferred_languages:t.preferredLanguages,friend_discovery_key:t.friendDiscoveryKey,friend_name:t.friendName})))},Object.defineProperty(n.prototype,"profileUrl",{get:function(){var t=O.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainProfileUrl,"?auth=").concat(t.ekey):this.plainProfileUrl},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return Kc(this)},n.prototype._isValidMetaData=function(t){return!Array.isArray(t)&&Object.keys(t).length>0&&Object.keys(t).map(function(r){return t[r]}).every(function(r){return k("string",r)})},n.prototype._applyMetaData=function(t,r){var i=this;r===void 0&&(r=!1),Object.keys(t).forEach(function(s){r?delete i.metaData[s]:i.metaData[s]=t[s]})},n.prototype.createMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(this._isValidMetaData(t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new o6({userId:i.userId,metadata:t}),[4,s.send(o)];case 1:return a=u.sent(),l=a.as(a6).metaData,this._applyMetaData(l),[2,this.metaData]}})})},n.prototype.updateMetaData=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(this._isValidMetaData(t)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new l6({userId:s.userId,metadata:t,upsert:r}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(u6).metadata,this._applyMetaData(u),[2,this.metaData]}})})},n.prototype.deleteMetaData=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(k("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new c6({userId:i.userId,metadataKey:t}),[4,s.send(o)];case 1:return l.sent(),this._applyMetaData(((a={})[t]=!0,a),!0),[2,this.metaData]}})})},n.prototype.deleteAllMetaData=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new d6({userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.metaData={},[2]}})})},n}(Wn),RC=function(e){function n(t){var r=t.userProfile,i=e.call(this)||this;return i.userProfile=r,i}return T(n,e),n}(Tt),em=function(){function e(n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b;this._iid=n,this.appInfo=new I1(t),this.user=new Ke(n,t),this.connectedAt=(r=t.login_ts)!==null&&r!==void 0?r:0,this.firstConnectedAt=0,this.pingInterval=(i=t.ping_interval)!==null&&i!==void 0?i:15e3,this.pongTimeout=(s=t.pong_timeout)!==null&&s!==void 0?s:5e3,this.reconnectInterval=(a=(o=t.reconnect)===null||o===void 0?void 0:o.interval)!==null&&a!==void 0?a:3e3,this.reconnectMaxInterval=(u=(l=t.reconnect)===null||l===void 0?void 0:l.max_interval)!==null&&u!==void 0?u:6e4,this.reconnectRetryCount=(d=(c=t.reconnect)===null||c===void 0?void 0:c.retry_cnt)!==null&&d!==void 0?d:5,this.reconnectIntervalMultiple=(f=(h=t.reconnect)===null||h===void 0?void 0:h.mul)!==null&&f!==void 0?f:2,this.maxUnreadCountOnSuperGroup=(p=t.max_unread_cnt_on_super_group)!==null&&p!==void 0?p:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=(m=t.concurrent_call_limit)!==null&&m!==void 0?m:5,this.backOffDelay=(b=t.back_off_delay)!==null&&b!==void 0?b:100}return e.payloadify=function(n){return Ee(Ne(M(M(M({},Ke.payloadify(n.user)),I1.payloadify(n.appInfo)),{login_ts:n.connectedAt,ping_interval:n.pingInterval,pong_timeout:n.pongTimeout,reconnect:{interval:n.reconnectInterval,max_interval:n.reconnectMaxInterval,retry_cnt:n.reconnectRetryCount,mul:n.reconnectIntervalMultiple},max_unread_cnt_on_super_group:n.maxUnreadCountOnSuperGroup,profile_image_encryption:n.profileImageEncryption,concurrent_call_limit:n.concurrentCallLimit,back_off_delay:n.backOffDelay})))},e.prototype.apply=function(){var n=this.reconnectInterval,t=this.reconnectMaxInterval,r=this.reconnectIntervalMultiple,i=O.of(this._iid);i.sdkState.websocket&&(i.sdkState.websocket.pingInterval=1e3*this.pingInterval,i.sdkState.websocket.pongTimeout=1e3*this.pongTimeout,i.sdkState.websocket.reconnectMaxRetry=this.reconnectRetryCount,i.sdkState.websocket.reconnectRetryStrategy={calcTimeout:function(s){return s>0?1e3*Math.min(n*Math.pow(r,s-1),t):10}}),i.appInfo=this.appInfo,i.sessionManager.currentUser=this.user,i.connectedAt=this.connectedAt,this.firstConnectedAt||(i.firstConnectedAt=this.connectedAt),i.maxSuperGroupChannelUnreadCount=this.maxUnreadCountOnSuperGroup,i.concurrentCallLimit=this.concurrentCallLimit,i.backOffDelay=this.backOffDelay,i.dispatcher.dispatch(new RC({userProfile:this}))},e}(),LC=function(e){function n(t){var r=t.request,i=r===void 0||r,s=t.features,o=s===void 0?{}:s,a=t.options,l=a===void 0?{}:a,u=t.statConfigInfo,c=e.call(this)||this;return c.request=i,c.features=M({localCache:!0,notification:!0},o),c.options=M({ingestion:!0},l),c.statConfigInfo=u,c}return T(n,e),n}(Tt),lh=function(e){function n(t,r,i){var s,o,a,l,u=this;return(u=e.call(this,t,r,i)||this).error=null,u.services=[],u.userProfile=new em(t,i),u.deviceTokenLastDeletedAt=(s=i.device_token_last_deleted_at)!==null&&s!==void 0?s:0,u.key=(o=i.key)!==null&&o!==void 0?o:"",u.ekey=(a=i.ekey)!==null&&a!==void 0?a:"",u.error=i.error?new L(i):null,u.services=(l=i.services)!==null&&l!==void 0?l:[],u}return T(n,e),n.asError=function(t){return new n("","LOGI",M({user_id:"",error:!0},t))},n.prototype.applyTo=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return this.error?[3,4]:(r=O.of(t))?(i=r.sessionManager,s=r.dispatcher,[4,i.login(this)]):[3,2];case 1:return o.sent(),this.userProfile.apply(),s.dispatch(new LC({request:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"),features:{localCache:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"),notification:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish")},options:{ingestion:this.userProfile.appInfo.allowSdkStatsUpload},statConfigInfo:this.userProfile.appInfo.statConfigInfo})),[3,3];case 2:throw L.lostInstance;case 3:return[3,5];case 4:throw this.error;case 5:return[2]}})})},n}(mt),Da=function(){function e(){this.type=st.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnect=function(n,t){return t.error,t.autoReconnect,t.cause,y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},e.prototype.onLogout=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},e}(),De=function(e){return y(void 0,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e()];case 1:return t.sent(),[3,3];case 2:if(!((n=t.sent())instanceof L))throw n;return n.throwOutside(),[3,3];case 3:return[2]}})})},Ot=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:case 2:return n.sent(),[3,3];case 3:return[2]}})})},wo=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this)||this).type=st.LOGOUT,i.name="logout",i._wasPreviouslyConnected=(r=t.wasPreviouslyConnected)===null||r===void 0||r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r,i,s=this;return g(this,function(o){switch(o.label){case 0:return r=Date.now(),i=t.sdkState.userId,[4,t.logout()];case 1:return o.sent(),[4,t.changeState(new Vv,r)];case 2:return o.sent(),this._wasPreviouslyConnected&&De(function(){return y(s,void 0,void 0,function(){return g(this,function(a){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(Da),n0=function(e){function n(){var t=e.call(this)||this;return t.type=st.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.disconnect()];case 1:return r.sent(),[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new i0({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new ef,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new wo,r)];case 1:return i.sent(),[2]}})})},n}(Da),Jh=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=st.INTERNAL_DISCONNECTED,i.name="internaldisconnected",i._autoReconnect=!1,i._autoReconnect=r,i}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.disconnect()];case 1:return i.sent(),this._autoReconnect?[4,t.changeState(new ef,r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.onConnect=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new i0({authToken:r}),i)];case 2:return s.sent(),[2]}})})},n.prototype.onReconnect=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new ef,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new n0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new wo,r)];case 1:return i.sent(),[2]}})})},n}(Da),Or=function(e){return y(void 0,void 0,void 0,function(){return g(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},DC=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),r0=function(e,n,t){return t===void 0&&(t=new DC),y(void 0,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:r=0,i=null,s=function(c){return i=c??new Error("Halted")},o=function(){r=0},u.label=1;case 1:if(!(n===-1||r=this._stateUpdatedAt?(this._currentState=t,this._stateUpdatedAt=r,this._dispatcher.dispatch(new _i({stateType:t.type})),this._logger.debug("connection state changes to ".concat(t.name)),[4,this._currentState.run(this)]):[3,2];case 1:return i.sent(),[2,!0];case 2:return[2,!1]}})})},n.prototype._tryResolveConnectionRequest=function(){var t;return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=this._unresolvedLogi,this._websocketClient.isOpen&&r?(this._unresolvedLogi=void 0,r.error?[3,2]:[4,r.applyTo(this._iid)]):[3,3];case 1:return i.sent(),this._statLogConnection(),(t=this._pinger)===null||t===void 0||t.start(),this._connectionRequestQueue.forEach(function(s){return s.resolve()}),this._connectionRequestQueue=[],this.sdkState.appState="foreground",[3,3];case 2:this._sessionManager.session.authToken=void 0,(r.error.isSessionExpiredError||r.error.isSessionInvalidatedError)&&this._dispatcher.dispatch(new Ul({reason:r.error.code})),this._rejectConnectionRequest(r.error),i.label=3;case 3:return[2]}})})},n.prototype._rejectConnectionRequest=function(t){var r;if((r=this._pinger)===null||r===void 0||r.stop(),this.clearLoginTimer(),this._connectionRequestQueue.length>0){var i=this._connectionRequestQueue;this._connectionRequestQueue=[],i.forEach(function(s){return s.reject(t)}),this._statLogConnection(t)}},n.prototype._url=function(){var t,r=this.sdkState,i=r.appId,s=r.appVersion,o=r.userId,a=r.extensions,l=r.sendbirdRuntimeEnvironment,u=this.cacheContext.localCacheEnabled,c=this._sessionManager.session,d=(t=this.sdkState.websocket)===null||t===void 0?void 0:t.compression,h=!!(a??{}).sb_uikit,f=Kh.userAgentWithExtension(a);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(bo.OS_VERSION),"&sv=").concat(encodeURIComponent(bo.SDK_VERSION),"&ai=").concat(i).concat(s?"&av=".concat(s):"").concat(c.hasSession?"":"&user_id=".concat(encodeURIComponent(o)),"&pmce=").concat(d?1:0,"&active=1&device_token_types=").concat(encodeURIComponent(["gcm","huawei","apns"].join(",")),"&SB-User-Agent=").concat(f,"&SB-SDK-User-Agent=").concat(encodeURIComponent(Kh.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(PC))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(u?1:0,"&include_poll_details=1").concat(h?"&uikit_config=1":"")},n.prototype._statLogConnection=function(t){var r;this._dispatcher.dispatch(new Bv(new jt({type:yt.WEBSOCKET_CONNECT,data:{host_url:(r=this.sdkState.websocket)===null||r===void 0?void 0:r.host,success:!t,latency:Date.now()-this._connectingAt,error_code:t==null?void 0:t.code,error_description:t==null?void 0:t.message}})))},n.prototype.connect=function(t){var r;return t===void 0&&(t=""),y(this,void 0,void 0,function(){var i,s,o,a=this;return g(this,function(l){return this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(L.connectionCanceled)),i=this._url(),s=new Tr,this._connectionRequestQueue.push(s),this._connectionRequestQueue.length===1&&(this._connectingAt=Date.now(),this._loginTimer=setTimeout(function(){a._loginTimer=void 0,a._rejectConnectionRequest(L.loginTimeout)},(r=this.sdkState.websocket)===null||r===void 0?void 0:r.responseTimeout),o=this._sessionManager.session,t&&(o.authToken=t),o.sessionKey||o.authToken?this._websocketClient.connect(i,JSON.stringify(o.hasSession?{auth:o.sessionKey}:{token:o.authToken})):this._websocketClient.connect(i,JSON.stringify({}))),[2,s.promise]})})},n.prototype.cancelConnectForRetry=function(){this._dispatcher.dispatch(lh.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._websocketClient.disconnect()];case 1:return t.sent(),[2]}})})},n.prototype.logout=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.sdkState.userId=void 0,this._unresolvedLogi=void 0,[4,this.disconnect()];case 1:return t.sent(),[4,this._sessionManager.clear()];case 2:return t.sent(),[2]}})})},n.prototype.clearLoginTimer=function(){this._loginTimer&&(clearTimeout(this._loginTimer),this._loginTimer=void 0)},n}(Ra),FC=function(e){function n(t){var r=t.appId,i=t.userId,s=t.services,o=t.includeUIKitConfig,a=o!==void 0&&o,l=t.localCacheEnabled,u=l===void 0||l,c=t.expiringSession,d=c===void 0||c,h=e.call(this)||this;return h.path="".concat(Xe,"/").concat(i,"/login"),h.method=Q.POST,h.params=Ee({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(PC),uikit_config:a,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return T(n,e),n}(Y),m6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new lh(t,"LOGI",r),i}return T(n,e),n}(ae);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(to||(to={}));var Ut,M1,v6=[jv,FC],g6=function(){function e(n,t){var r=t.session,i=t.sdkState,s=t.dispatcher,o=t.logger,a=t.useFetchCompat,l=a!==void 0&&a,u=this;this._currentConnectionStateType=st.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new i6(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this._session=r,this._logger=o,this._dispatcher=s,this._dispatcher.on(function(c){var d,h,f,p;if(c instanceof _i){var m=c.stateType;switch(u._currentConnectionStateType=m,m){case st.CONNECTED:u._resolveLazyCallQueue();break;case st.INITIALIZED:case st.INTERNAL_DISCONNECTED:case st.EXTERNAL_DISCONNECTED:case st.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof OC)!((p=u._session.services)===null||p===void 0)&&p.includes(Oc.CHAT)||u._resolveLazyCallQueue(to.API);else if(c instanceof J_||c instanceof kC)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof cC){var b=c.request,v=c.deferred,_=c.error;try{for(var E=ve(v6),S=E.next();!S.done;S=E.next())if(b instanceof S.value)return void v.reject(_)}catch(w){d={error:w}}finally{try{S&&!S.done&&(h=E.return)&&h.call(E)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:b,deferred:v})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===st.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===st.CONNECTING||this._currentConnectionStateType===st.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case to.ALL:t=null;break;case to.WEBSOCKET:t=wr;break;case to.API:t=Y}var s=!1;return this._lazyCallQueue.forEach(function(o){!t||o.command instanceof t||(s=!0),s?i.push(o):r.push(o)}),[r,i]},e.prototype._resolveLazyCallQueue=function(n){var t=this;n===void 0&&(n=to.ALL);var r=Ae(this._classifyLazyCallQueueByScope(n),2),i=r[0],s=r[1];this._lazyCallQueue=s,i.forEach(function(o){return y(t,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:a=o.command,l=o.deferred,(u=o.timeout)&&clearTimeout(u),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.send(a)];case 2:return c=h.sent(),l.resolve(c),[3,4];case 3:return d=h.sent(),l.reject(d),[3,4];case 4:return[2]}})})})},e.prototype._rejectLazyCallQueue=function(n,t){var r=this;t===void 0&&(t=to.ALL);var i=Ae(this._classifyLazyCallQueueByScope(t),2),s=i[0],o=i[1];this._lazyCallQueue=o,s.forEach(function(a){return y(r,void 0,void 0,function(){var l,u;return g(this,function(c){return l=a.deferred,u=a.timeout,clearTimeout(u),l.reject(n),[2]})})})},e.prototype.send=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return n instanceof wr?this.isReady?(this._logger.debug("send websocket request",n),[4,this.commandRouter.send(n)]):[3,2]:[3,4];case 1:case 5:case 7:return[2,s.sent()];case 2:if(this.isLazyCallActivated)return this._logger.debug("wait websocket request",n),t=new Tr,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw this._logger.debug("fail websocket request"),L.connectionRequired;case 3:case 9:return[3,11];case 4:return n instanceof Y?this._session.hasSession?(this._logger.debug("send api request",n),[4,this.commandRouter.send(n)]):[3,6]:[3,10];case 6:return n.hasSessionKey?(this._logger.debug("send api request with tmp session key",n),[4,this.commandRouter.send(n)]):[3,8];case 8:if(this.isLazyCallActivated)return this._logger.debug("wait api request",n),t=new Tr,this._lazyCallQueue.push({command:n,deferred:t,timeout:setTimeout(function(){return i.timeout(n.requestId)},1e4)}),[2,t.promise];throw r=L.connectionRequired,this._logger.debug("fail api request",r),r;case 10:throw L.invalidCommand;case 11:return[2]}})})},e.prototype.forceSend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof wr||n instanceof Y?[4,this.commandRouter.send(n)]:[3,2];case 1:return[2,t.sent()];case 2:throw L.invalidCommand}})})},e.prototype.timeout=function(n){this._logger.debug("timeout request",n);var t=this._lazyCallQueue.findIndex(function(r){return r.command.requestId===n});t>-1&&(this._lazyCallQueue[t].deferred.reject(L.connectionRequired),this._lazyCallQueue.splice(t,1))},e.prototype.cancel=function(n){this._logger.debug("cancel api request",n),this.commandRouter.cancel(n)},e.prototype.cancelAll=function(){this._logger.debug("cancel all api requests"),this.commandRouter.cancelAll()},e}(),gp="sendbird@devicetokens",yp=function(){function e(n){var t=n.type,r=n.token,i=n.device_os,s=n.device_manufacturer,o=n.system_push_enabled;this.type=t,this.token=r,this.deviceOS=i,this.deviceManufacturer=s,this.systemPushEnabled=o}return e.payloadify=function(n){return Ee(Ne({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),Ep=new WeakMap,y6=function(e){function n(t){var r=t._iid,i=t.session,s=t.cacheContext,o=t.sdkState,a=t.dispatcher,l=t.requestQueue,u=t.logger,c=t.pushNotificationAckManager,d=e.call(this)||this;return d._currentConnectionStateType=st.INITIALIZED,d._isRefreshingAuthToken=!1,d.currentUser=null,d.session=i,d._iid=r,d._cacheContext=s,d._sdkState=o,d._dispatcher=a,d._requestQueue=l,d._logger=u,d._pushNotificationAckManager=c,d._deviceTokens=[],d._dispatcher.on(function(h){var f,p,m;if(h instanceof _i){var b=h.stateType;d._currentConnectionStateType=b}else h instanceof Ul&&d.handler&&!d.isSessionKeyRefreshing&&(!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(v){if(Lr(v)&&d._sdkState.appState==="foreground")throw v}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(v){if(Lr(v)&&d._sdkState.appState==="foreground")throw v}))))}),d}return T(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return Ep.get(this)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokens",{get:function(){return this._deviceTokens},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceTokenLastDeletedAt",{get:function(){return this._deviceTokenLastDeletedAt},enumerable:!1,configurable:!0}),n.prototype.indexOfDeviceToken=function(t,r){return this._deviceTokens.findIndex(function(i){return i.type===t&&i.token===r})},n.prototype.hasDeviceToken=function(t,r){return this.indexOfDeviceToken(t,r)>=0},n.prototype.createRefreshWebsocketCommand=function(t,r){return new Z4({authToken:t,expiringSession:!0,requestId:r})},n.prototype._refreshSessionKeyByWebSocket=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return r=this.createRefreshWebsocketCommand(t),[4,this._requestQueue.forceSend(r)];case 1:if(i=l.sent(),s=i.as(J4),o=s.newKey,a=s.error)throw a;return this.session.sessionKey=o??this.session.sessionKey,[2]}})})},n.prototype._refreshSessionKeyByApi=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return r=new jv({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,r0(function(o){return y(i,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(r)];case 1:return a=h.sent(),l=a.as(X4),u=l.key,c=l.services,this.session.sessionKey=u,this.session.services=c,[3,3];case 2:if(d=h.sent(),!this._isSessionRelatedError(d))throw d;return o(d),[3,3];case 3:return[2]}})})},3)];case 1:return s.sent(),[2]}})})},n.prototype._refreshSessionKey=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var i,s;return g(this,function(o){switch(o.label){case 0:if(this._currentConnectionStateType!==st.CONNECTED)return[3,8];o.label=1;case 1:return o.trys.push([1,3,,8]),[4,this._refreshSessionKeyByWebSocket(t)];case 2:return o.sent(),this.complete(),[2];case 3:i=o.sent(),o.label=4;case 4:return o.trys.push([4,6,,7]),[4,this._handleSessionRefreshError(i,r)];case 5:return o.sent(),[2];case 6:return o.sent(),[3,7];case 7:return[3,8];case 8:return o.trys.push([8,10,,12]),[4,this._refreshSessionKeyByApi(t)];case 9:return o.sent(),this.complete(),[3,12];case 10:return s=o.sent(),[4,this._handleSessionRefreshError(s,r)];case 11:return o.sent(),[3,12];case 12:return[2]}})})},n.prototype._receiveNewAuthToken=function(){var t,r=this,i=new Tr;if(this._isRefreshingAuthToken=!0,this.session.sessionKey=void 0,this.session.authToken=void 0,(t=this.handler)===null||t===void 0?void 0:t.onSessionTokenRequired){var s=null,o=function(){s&&(clearTimeout(s),s=null)},a=function(u){o(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.resolve(u))},l=function(u){o(),r._isRefreshingAuthToken&&(r._isRefreshingAuthToken=!1,i.reject(u))};s=setTimeout(function(){return l()},1e3*this._sdkState.sessionTokenRefreshTimeout),De(function(){return y(r,void 0,void 0,function(){var u;return g(this,function(c){return!((u=this.handler)===null||u===void 0)&&u.onSessionTokenRequired&&this.handler.onSessionTokenRequired(a,l),[2]})})})}else i.resolve(null);return i.promise},n.prototype._handleSessionRefreshError=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Ie.APPLICATION_NOT_FOUND)?(this.session.authToken=void 0,r?[4,this._receiveNewAuthToken()]:[3,6]):[3,6];case 1:return(i=s.sent())?(this.session.authToken=i,[4,this._refreshSessionKey(this.session.authToken,!1)]):[3,3];case 2:return s.sent(),this.complete(),[3,5];case 3:return[4,this.clear()];case 4:s.sent(),s.label=5;case 5:return[2];case 6:throw t}})})},n.prototype._isSessionRelatedError=function(t){return t instanceof L&&(t.isSessionExpiredError||t.isSessionInvalidatedError)},Object.defineProperty(n.prototype,"isSessionKeyRefreshing",{get:function(){return this.session.isRefreshing},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRefreshingAuthToken",{get:function(){return this._isRefreshingAuthToken},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionExpiring",{get:function(){return!!this.handler},enumerable:!1,configurable:!0}),n.prototype.authenticateFeed=function(t,r){var i;return y(this,void 0,void 0,function(){var s,o,a;return g(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new FC({appId:this._sdkState.appId,userId:t,services:[Oc.FEED],includeUIKitConfig:!!((i=this._sdkState.extensions)!==null&&i!==void 0?i:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:!r||this.isSessionExpiring}),[4,this._requestQueue.commandRouter.send(s)];case 1:return o=l.sent(),(a=o.as(m6).logi).error?[3,3]:[4,a.applyTo(this._iid)];case 2:return l.sent(),[3,4];case 3:throw a.error;case 4:return[2]}})})},n.prototype.login=function(t){var r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return i=t.key,s=t.ekey,o=t.services,a=t.userProfile,l=t.deviceTokenLastDeletedAt,u=l===void 0?0:l,this.session.sessionKey=i,this.session.services=o,Ep.set(this,s),this._deviceTokenCacheEnabled=(r=a==null?void 0:a.appInfo)===null||r===void 0?void 0:r.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(gp)]:[3,5];case 1:return!(d=h.sent())||d.lastDeletedAt0&&(this.queue=this.queue.concat(this.flushWaitQueue),this.flushWaitQueue=[])},e.prototype._isDuplicateStat=function(n){var t=this._sentLogStats.find(function(r){var i;return r.channelUrl===n.data.channel_url&&r.messageId===((i=n.data.notificationId)!==null&&i!==void 0?i:n.data.message_id)&&r.action===n.data.action});return t||this._sentLogStats.push({channelUrl:n.data.channel_url,messageId:n.data.message_id,action:n.data.action}),!!t},e.prototype._flush=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:if(t=!0,!(n.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),r=Pe([],Ae(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new E6({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=Pe([],Ae(n),!1).slice(r.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(s=o.sent())instanceof L?s.code!==Ie.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=Ut.DISABLED,[3,7];case 6:s.code===Ie.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=Ut.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},e.prototype._save=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Pe(Pe([],Ae(this.queue),!1),Ae(this.flushWaitQueue),!1),[4,this.cacheContext.preference.set(this.key,{deviceId:this.logInfo.deviceId,statLogs:n.map(function(r){return jt.payloadify(r)}),generation:this.logInfo.generation++,lastFlushedAt:this.logInfo.lastFlushedAt})];case 1:return t.sent(),[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.queue=[],this.flushWaitQueue=[],this.logInfo.generation=1,this._save(),[2]})})},e}(),Fl=function(e){function n(t){var r,i,s,o,a=t.type,l=t.data,u=t.ts,c=u===void 0?Date.now():u,d=e.call(this,{type:a,data:l,ts:c})||this;return d.date=new Date(c),d.key="".concat((r=d.date,i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),o=String(r.getDate()).padStart(2,"0"),"".concat(i).concat(s).concat(o)),"_").concat(a),d}return T(n,e),n}(jt),b6=function(e){function n(t){var r=t.deviceId,i=t.cacheContext,s=t.requestQueue;return e.call(this,{deviceId:r,cacheContext:i,requestQueue:s})||this}return T(n,e),Object.defineProperty(n.prototype,"_isSendable",{get:function(){return this.queue.length!==0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".daily")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){return new jt({type:i.stat_type,ts:i.ts,data:i.data})}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?Ut.ENABLED:Ut.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ut.DISABLED,[4,this.clear()];case 2:l.sent(),l.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:i=l.sent(),s=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),o=0,l.label=5;case 5:return o=this.statConfig.minStatCount&&this.queue.length>this.statConfig.lowerThreshold||this.logInfo.lastFlushedAt>0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.init.call(this,t+".realtime")];case 1:return r.sent(),this.queue=this.logInfo.statLogs.map(function(i){var s;return i.data=Ee(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new jt({type:i.stat_type,ts:i.ts,data:i.data})}),this._sentLogStats=this.queue.map(function(i){var s;return{channelUrl:i.data.channelUrl,messageId:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,action:i.data.action}}),[2]}})})},n.prototype.setConfig=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?Ut.ENABLED:Ut.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ut.DISABLED,[4,this.clear()];case 2:s.sent(),s.label=3;case 3:return this.isEnabled&&this._isSendable?(i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),[4,Or(i)]):[3,6];case 4:return s.sent(),[4,this._flush(this.queue)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},n.prototype.put=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.enabledState===Ut.DISABLED?[2,!0]:(r=this.enabledState===Ut.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===Ut.PENDING?[3,2]:[4,this._save()]));case 1:i.sent(),i.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this.isEnabled&&this._isSendable?[4,this._flush(r)]:[3,4]):[3,4];case 3:return[2,i.sent()];case 4:return[2,!0]}})})},n}(qv),T6=function(){function e(n){var t=n.cacheContext,r=n.requestQueue,i=n.dispatcher,s=n.logger;this._collectRequestStat=!0,this._collectFeatureLocalCacheStat=!0,this._collectionNotificationStat=!0,this._retryCount=0,this.deviceId=$s(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new b6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new C6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new S6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue})}return e.prototype._migration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return[4,this.cacheContext.preference.get(this.key)];case 1:return(n=s.sent())?(t=[],n.statLogs.forEach(function(o){o.stat_type===yt.FEATURE_LOCALCACHE&&t.push(new jt({type:o.stat_type,ts:o.ts,data:o.data}))}),[4,this.cacheContext.preference.set(this.key+".daily",{deviceId:n.deviceId,statLogs:t.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(o){o.stat_type!==yt.FEATURE_LOCALCACHE&&o.stat_type!==yt.NOTIFICATION&&(o.stat_type===yt.FEATURE_LOCALCACHE_EVENT&&(o.data=M({message_init_policy:"",starting_point:0},o.data)),r.push(new jt({type:o.stat_type,ts:o.ts,data:o.data})))}),[4,this.cacheContext.preference.set(this.key+".default",{deviceId:n.deviceId,statLogs:r.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(o){var a;o.stat_type===yt.NOTIFICATION&&(o.data=Ee(M(M({},o.data),{message_id:(a=o.data.notificationId)!==null&&a!==void 0?a:o.data.message_id,notificationId:void 0})),i.push(new jt({type:o.stat_type,ts:o.ts,data:o.data})))}),[4,this.cacheContext.preference.set(this.key+".realtime",{deviceId:n.deviceId,statLogs:i.map(function(o){return jt.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 4:return s.sent(),[4,this.cacheContext.preference.remove(this.key)];case 5:s.sent(),s.label=6;case 6:return[2]}})})},e.prototype.init=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this.key=n,[4,this._migration()];case 1:return r.sent(),[4,this._dailyStatCollector.init(this.key)];case 2:return r.sent(),[4,this._defaultStatCollector.init(this.key)];case 3:return r.sent(),[4,this._realTimeStatCollector.init(this.key)];case 4:return r.sent(),this.commandEventContext||(this.commandEventContext=this.dispatcher.on(function(i){return y(t,void 0,void 0,function(){var s,o,a,l,u,c;return g(this,function(d){return i instanceof Bv?(s=i.statLog,this.put(s)):i instanceof LC&&(o=i.request,a=i.features,l=i.options,u=i.statConfigInfo,this._retryCount=0,this._collectRequestStat=o,this._collectFeatureLocalCacheStat=a==null?void 0:a.localCache,this._collectionNotificationStat=a==null?void 0:a.notification,this._statConfig=u,this._dailyStatCollector.setConfig(this._statConfig.default,{localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._defaultStatCollector.setConfig(this._statConfig.default,{requestStat:this._collectRequestStat,localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:l.ingestion}),this._realTimeStatCollector.setConfig((c=this._statConfig.realTime)!==null&&c!==void 0?c:this._statConfig.default,{notificationStat:this._collectionNotificationStat,enabledStat:l.ingestion})),[2]})})})),[2]}})})},e.prototype.put=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=!0,n instanceof Fl?this._collectFeatureLocalCacheStat?[4,this._dailyStatCollector.put(n)]:[3,2]:[3,3];case 1:t=r.sent(),r.label=2;case 2:return[3,13];case 3:switch(n.type){case yt.API_RESULT:case yt.WEBSOCKET_CONNECT:return[3,4];case yt.FEATURE_LOCALCACHE:case yt.FEATURE_LOCALCACHE_EVENT:return[3,7];case yt.NOTIFICATION:return[3,10]}return[3,13];case 4:return this._collectRequestStat?[4,this._defaultStatCollector.put(n)]:[3,6];case 5:t=r.sent(),r.label=6;case 6:return[3,13];case 7:return this._collectFeatureLocalCacheStat?[4,this._defaultStatCollector.put(n)]:[3,9];case 8:t=r.sent(),r.label=9;case 9:return[3,13];case 10:return this._collectionNotificationStat?[4,this._realTimeStatCollector.put(n)]:[3,12];case 11:t=r.sent(),r.label=12;case 12:return[3,13];case 13:return t?this._retryCount=0:(this._retryCount++,this._retryCount>20&&(this._dailyStatCollector.enabledState=Ut.COLLECT_ONLY,this._defaultStatCollector.enabledState=Ut.COLLECT_ONLY,this._realTimeStatCollector.enabledState=Ut.COLLECT_ONLY,this.logger.debug(L.statLogUploadLimitExceededError))),[2]}})})},e.prototype.close=function(){this.commandEventContext&&(this.commandEventContext.close(),this.commandEventContext=void 0)},e}();(function(e){e.DELIVERY_RECEIPT="delivery_receipt",e.PUSH_ACKNOWLEDGEMENT="push_acknowledgement"})(tf||(tf={}));var G,w6=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._pushAckedCache={},t}return T(n,e),n.prototype.isAcked=function(t,r){var i,s="".concat(t,"_").concat(r);return(i=this._pushAckedCache[s])!==null&&i!==void 0&&i},n.prototype.markAsAcked=function(t,r){var i="".concat(t,"_").concat(r);this._pushAckedCache[i]=!0},n.prototype.clear=function(){O.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},n.prototype.parseData=function(t){var r,i,s,o,a=O.of(this._iid).logger,l=t.sendbird;if(typeof l=="string")try{l=JSON.parse(l)}catch{throw a.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError}if(!l||typeof l!="object")throw a.info("push notification payload does not contain sendbird payload in JSON format."),L.malformedDataError;var u=(r=l.push_tracking_id)!==null&&r!==void 0?r:"",c=l.notification_message_id,d=l.notification_channel_key,h=l.notification_template_key,f=l.notification_event_deadline,p=(i=l.session_key)!==null&&i!==void 0?i:{},m=(s=p==null?void 0:p.key)!==null&&s!==void 0?s:"",b=(o=p==null?void 0:p.topics)!==null&&o!==void 0?o:[];if(typeof u!="string"||u.length===0)throw a.info("push tracking id is not available"),L.malformedDataError;if(typeof c!="string"||c.length===0)throw a.info("message id is not available"),L.malformedDataError;return{pushTrackingId:u,sessionKey:m,sessionTopics:b,messageId:c,channelKey:d,templateKey:h,notificationEventDeadline:f}},n}(Wn),Fo={},O=function(){function e(n,t){var r,i,s,o,a,l,u,c,d;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!Fo[n]){Fo[n]=this;var h=(r=t.options)!==null&&r!==void 0?r:new nC,f=this.sdkState={appId:t.appId,appVersion:(i=t.appVersion)!==null&&i!==void 0?i:"",appState:"foreground",userId:void 0,extensions:{},api:{host:(s=t.apiHost)!==null&&s!==void 0?s:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:(o=t.websocketHost)!==null&&o!==void 0?o:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new DC,responseTimeout:h.websocketResponseTimeout},sessionTokenRefreshTimeout:h.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var p=this.logger=t.logger;this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map;var m=this.cacheContext=new F4({encryption:t.encryption,store:t.store,localCacheEnabled:(a=t.localCacheEnabled)!==null&&a!==void 0&&a,localCacheConfig:(l=t.localCacheConfig)!==null&&l!==void 0?l:new iC});this.debugMode=(u=t.debugMode)!==null&&u!==void 0&&u,this.maxSuperGroupChannelUnreadCount=bo.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=h.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=h.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=h.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var b=this.dispatcher=new B4,v=new j4;this.requestQueue=new g6(n,{session:v,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new w6(n),this.sessionManager=new y6({_iid:n,session:v,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new h6(n,{sdkState:f,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:b,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:(c=t.disableWebSocketCloseEventHandling)!==null&&c!==void 0&&c,logger:p}),this.statManager=new T6({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=(d=t.appStateToggleEnabled)===null||d===void 0||d}return Fo[n]}return e.of=function(n){if(Fo[n])return Fo[n];throw L.lostInstance},e.clear=function(n){Fo[n]&&delete Fo[n]},e.prototype.hasExtension=function(n){return this.sdkState.extensions&&this.sdkState.extensions[n]},e}(),Wv=function(){function e(){}return e.prototype.init=function(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,o=t.requestQueue,a=t.logger;t.onlineDetector;var l=t.cacheContext;this._iid=n,this._cacheContext=l,this._sdkState=r,this._dispatcher=i,this._sessionManager=s,this._requestQueue=o,this._logger=a},e}();(function(e){e.UNKNOWN="UNKNOWN",e.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",e.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",e.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",e.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",e.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",e.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",e.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",e.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",e.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",e.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",e.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",e.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",e.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",e.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",e.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",e.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",e.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",e.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",e.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",e.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",e.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",e.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",e.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",e.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",e.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",e.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",e.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",e.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",e.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",e.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",e.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",e.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",e.REQUEST_CHANNEL="REQUEST_CHANNEL",e.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",e.REFRESH_CHANNEL="REFRESH_CHANNEL",e.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",e.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",e.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",e.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",e.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",e.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",e.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",e.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",e.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",e.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",e.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",e.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",e.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",e.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",e.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",e.REQUEST_MESSAGE="REQUEST_MESSAGE",e.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",e.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",e.EVENT_POLL_VOTED="EVENT_POLL_VOTED",e.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",e.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",e.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",e.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",e.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",e.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",e.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",e.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",e.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",e.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",e.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED"})(G||(G={}));var Hl;M({},G);var Ns=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===G.SYNC_MESSAGE_FILL||e===G.SYNC_MESSAGE_CHANGELOGS||e===G.SYNC_POLL_CHANGELOGS},Et=function(e){function n(t){var r=t.messages,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.messages=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),Kv=function(e){function n(t){var r=t.messageIds,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.messageIds=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),jC=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.event=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),BC=function(e){function n(t){var r=t.event,i=t.source,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.event=r,a.source=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),$C=function(e){function n(t){var r=t.reqId,i=t.source,s=e.call(this)||this;return s.reqId=r,s.source=i,s}return T(n,e),n}(Tt),GC=function(e){function n(t){var r=t.polls,i=t.source,s=e.call(this)||this;return s.polls=r,s.source=i,s}return T(n,e),n}(Tt),zC=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(Tt),Qv=function(e){function n(t){var r=t.event,i=t.source,s=e.call(this)||this;return s.event=r,s.source=i,s}return T(n,e),n}(Tt);(function(e){e.OPEN="open",e.CLOSED="closed"})(Hl||(Hl={}));var N6="removed",tm=function(e){switch(e){case"open":return Hl.OPEN;case"closed":return Hl.CLOSED;default:return null}},VC=function(e){return!e||!!e.text&&k("string",e.text)},uh=function(e){function n(t,r){var i,s,o,a,l,u,c,d=this;return(d=e.call(this,t)||this).pollId=0,d.id=0,d.text=null,d.voteCount=0,d.createdBy=null,d.createdAt=0,d.updatedAt=0,d._lastVotedAt=0,d.pollId=(i=r.poll_id)!==null&&i!==void 0?i:0,d.id=(s=r.id)!==null&&s!==void 0?s:0,d.text=(o=r.text)!==null&&o!==void 0?o:null,d.voteCount=(a=r.vote_count)!==null&&a!==void 0?a:0,d.createdBy=(l=r.created_by)!==null&&l!==void 0?l:null,d.createdAt=(u=r.created_at)!==null&&u!==void 0?u:0,d.updatedAt=(c=r.updated_at)!==null&&c!==void 0?c:0,d}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},n}(Wn),Oi=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v=this;return(v=e.call(this,t)||this).id=0,v.title=null,v.createdAt=0,v.updatedAt=0,v.closeAt=-1,v.status=Hl.CLOSED,v.messageId=0,v.data=null,v.voterCount=-1,v.options=[],v.createdBy=null,v.allowUserSuggestion=!1,v.allowMultipleVotes=!1,v.votedPollOptionIds=[],v.id=(i=r.id)!==null&&i!==void 0?i:0,v.title=(s=r.title)!==null&&s!==void 0?s:null,v.createdAt=(o=r.created_at)!==null&&o!==void 0?o:0,v.updatedAt=(a=r.updated_at)!==null&&a!==void 0?a:0,v.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,v.status=(u=tm(r.status))!==null&&u!==void 0?u:Hl.CLOSED,v.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,v.data=(d=r.data)!==null&&d!==void 0?d:null,v.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,v.options=r.options?r.options.map(function(_){return new uh(v._iid,_)}):[],v.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,v.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,v.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,v.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],v}return T(n,e),n.prototype._applyPollUpdatePayload=function(t){var r,i,s,o,a,l,u,c,d=this;this.title=(r=t.title)!==null&&r!==void 0?r:this.title,this.updatedAt=(i=t.updated_at)!==null&&i!==void 0?i:this.updatedAt,this.closeAt=(s=t.close_at)!==null&&s!==void 0?s:this.closeAt,this.status=(o=tm(t.status))!==null&&o!==void 0?o:this.status,this.data=(a=t.data)!==null&&a!==void 0?a:this.data,this.voterCount=(l=t.voter_count)!==null&&l!==void 0?l:this.voterCount,t.options&&(this.options=t.options.map(function(h){return new uh(d._iid,h)}),this.votedPollOptionIds=t.options.filter(function(h){return h.vote_count>0}).map(function(h){return h.id})),this.allowUserSuggestion=(u=t.allow_user_suggestion)!==null&&u!==void 0?u:this.allowUserSuggestion,this.allowMultipleVotes=(c=t.allow_multiple_votes)!==null&&c!==void 0?c:this.allowMultipleVotes},n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(r){return uh.payloadify(r)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},n.prototype.applyPollUpdateEvent=function(t){var r=t._payload.poll;return!(!r||this.id!==r.id||r.updated_at-1){var u=r[l];o>=u._lastVotedAt&&(u.voteCount=a.vote_count,u._lastVotedAt=o)}}),s.req_id&&s.voted_option_ids&&(this.votedPollOptionIds=s.voted_option_ids),typeof s.voter_count=="number"&&(this.voterCount=s.voter_count),!0},n.prototype.serialize=function(){return Kc(this)},n}(Wn),Uo=function(){function e(n,t){var r;this.limit=20,this._isLoading=!1,this._hasNext=!0,this._token="",this._iid=n,this.limit=(r=t.limit)!==null&&r!==void 0?r:20}return Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),e.prototype._validate=function(){return k("number",this.limit)&&this.limit>0},e}(),zs=function(e){function n(t,r,i,s){var o=e.call(this,t,s)||this;return o.channelUrl=r,o.channelType=i,o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl)&&Ge(Ze,this.channelType)},n}(Uo),I6=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},A6=function(e){function n(t){var r=t.title,i=t.optionTexts,s=t.data,o=t.allowUserSuggestion,a=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Q.POST,u.path=Yi,u.params={title:r,options:i,data:s,allow_user_suggestion:o,allow_multiple_votes:a,close_at:l},u}return T(n,e),n}(Y),M6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),x6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(Yi,"/").concat(encodeURIComponent(s)),o.params={channel_url:r,channel_type:i},o}return T(n,e),n}(Y),O6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),k6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.pollOptionId,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o)),a.params={channel_url:r,channel_type:i},a}return T(n,e),n}(Y),R6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new uh(t,r),i}return T(n,e),n}(ae),L6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),a.params=Ee({change_ts:s,token:o}),a}return T(n,e),n}(Y),D6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedPolls=r.updated.map(function(s){return function(o,a){return new Oi(o,a)}(t,s)}),i.deletedPollIds=r.deleted.map(function(s){return s}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(ae),U6={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},qC=function(e){return k("string",e.title)&&(n=e.optionTexts,We("string",n)&&n.every(function(t){return t.trim()!==""}))&&VC(e.data)&&k("boolean",e.allowUserSuggestion,!0)&&k("boolean",e.allowMultipleVotes,!0)&&k("number",e.closeAt,!0);var n},P6={channelUrl:"",channelType:Ze.BASE,pollId:0,pollOptionId:0},WC=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ge(Ze,e.channelType)&&k("number",e.pollId)&&e.pollId>0&&k("number",e.pollOptionId)&&e.pollOptionId>0},F6={channelUrl:"",channelType:Ze.BASE,pollId:0},KC=function(e){return k("string",e.channelUrl)&&e.channelUrl!==""&&Ge(Ze,e.channelType)&&k("number",e.pollId)},x1={},nf=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.sessionManager,o=t.requestQueue,a=t.logger;this._iid=n,this._sdkState=r,this._sessionManager=s,this._requestQueue=o,this._dispatcher=i,this._logger=a,x1[n]=this}return e.of=function(n){return x1[n]},e.prototype.buildPollFromSerializedData=function(n){var t=fa(n);return new Oi(this._iid,Oi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(KC(n)).throw(L.invalidParameters),t=new x6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(O6).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(qC(n)).throw(L.invalidParameters),t=new A6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(M6).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return K(WC(n)).throw(L.invalidParameters),t=new k6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(R6).pollOption]}})})},e.prototype.getPollChangeLogs=function(n,t,r,i){return i===void 0&&(i=G.SYNC_POLL_CHANGELOGS),y(this,void 0,void 0,function(){var s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return s=new L6(Ne({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null})),[4,this._requestQueue.send(s)];case 1:return o=h.sent(),a=o.as(D6),l=a.updatedPolls,u=a.deletedPollIds,c=a.hasMore,d=a.nextToken,l.length>0&&this._dispatcher.dispatch(new GC({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),H6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,o=t.limit,a=e.call(this)||this;return a.method=Q.GET,a.path=Yi,a.params={channel_url:r,channel_type:i,token:s,limit:o},a}return T(n,e),n}(Y),j6=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).polls=((i=r.polls)!==null&&i!==void 0?i:[]).map(function(o){return new Oi(t,o)}),s.token=r.next,s}return T(n,e),n}(ae),QC=function(e){function n(t,r){return e.call(this,t,r.channelUrl,r.channelType,r)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new H6(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(j6),o=s.polls,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),B6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.pollOptionId,a=t.token,l=t.limit,u=e.call(this)||this;return u.method=Q.GET,u.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o),"/voters"),u.params={channel_url:r,channel_type:i,token:a,limit:l},u}return T(n,e),n}(Y),$6=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).voters=((i=r.voters)!==null&&i!==void 0?i:[]).map(function(o){return new Ke(t,o)}),s.token=r.next,s}return T(n,e),n}(ae),YC=function(e){function n(t,r){var i=e.call(this,t,r.channelUrl,r.channelType,r)||this;return i.pollId=r.pollId,i.pollOptionId=r.pollOptionId,i}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("number",this.pollId)&&k("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new B6(M(M({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as($6),o=s.voters,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),Uc,Vs=function(){function e(n,t,r){var i,s;this.width=0,this.height=0,this.realWidth=0,this.realHeight=0,this._requireAuth=!1,this._iid=n,this.plainUrl=t.url,this.width=t.width,this.height=t.height,this.realWidth=(i=t.real_width)!==null&&i!==void 0?i:t.width,this.realHeight=(s=t.real_height)!==null&&s!==void 0?s:t.height,this._requireAuth=r}return e.payloadify=function(n){return Ee(Ne(n instanceof e?{url:n.plainUrl,width:n.width,height:n.height,real_width:n.realWidth,real_height:n.realHeight}:{url:"",width:n.maxWidth,height:n.maxHeight,real_width:0,real_height:0}))},Object.defineProperty(e.prototype,"url",{get:function(){var n=O.of(this._iid).sessionManager;return this._requireAuth&&n.ekey?"".concat(this.plainUrl,"?auth=").concat(n.ekey):this.plainUrl},enumerable:!1,configurable:!0}),e}(),rf=function(e){function n(t){var r=e.call(this)||this;if(r.method=Q.POST,r.path="".concat($4),r.params=Ee({file:t.file,channel_url:t.channelUrl}),t.thumbnailSizes)for(var i=0;i0:void 0,u.lastRepliedAt=(a=r.last_replied_at)!==null&&a!==void 0?a:0,u.updatedAt=(l=r.updated_at)!==null&&l!==void 0?l:0,u}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{reply_count:t.replyCount,unread_message_count:t.unreadReplyCount,member_count:t.memberCount,most_replies:Array.isArray(t.mostRepliedUsers)?t.mostRepliedUsers.map(function(r){return Ke.payloadify(r)}):[],push_enabled:typeof t.isPushNotificationEnabled=="boolean"?t.isPushNotificationEnabled?1:0:void 0,last_replied_at:t.lastRepliedAt,updated_at:t.updatedAt})))},Object.defineProperty(n.prototype,"_isUpdateRequired",{get:function(){return this.unreadReplyCount===void 0||this.isPushNotificationEnabled===void 0},enumerable:!1,configurable:!0}),n.prototype._updateFrom=function(t){var r,i;this.unreadReplyCount=(r=t.unreadReplyCount)!==null&&r!==void 0?r:this.unreadReplyCount,this.isPushNotificationEnabled=(i=t.isPushNotificationEnabled)!==null&&i!==void 0?i:this.isPushNotificationEnabled},n}(Wn);(function(e){e.ADD="add",e.DELETE="delete"})(Uc||(Uc={}));var no,Yv=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=k("string",e.msg_id)?parseInt(e.msg_id):e.msg_id,t=e.user_id,r=e.operation?e.operation.toLowerCase():null,i=e.reaction,s=e.updated_at;n&&k("string",t)&&k("string",r)&&Ge(Uc,r)&&k("string",i)&&i&&k("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},xd=function(){function e(n){var t,r,i,s=n.key,o=(i=Pe([],Ae(n.user_ids),!1))!==null&&i!==void 0?i:[],a=n.updated_at;k("string",s)&&s&&We("string",o)&&o.length>0&&k("number",a)&&(this.key=s,this.userIds=o,this.updatedAt=a);var l={};try{for(var u=ve(this.userIds),c=u.next();!c.done;c=u.next())l[c.value]=this.updatedAt}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this._version=l}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.userIds.length===0},enumerable:!1,configurable:!0}),e.payloadify=function(n){return Ee(Ne({key:n.key,user_ids:n.userIds,updated_at:n.updatedAt}))},e.prototype.applyEvent=function(n){if(n.key===this.key&&this.updatedAt<=n.updatedAt){if(!this._version[n.userId]||this._version[n.userId]<=n.updatedAt){var t=this.userIds.indexOf(n.userId);switch(n.operation){case Uc.ADD:t<0&&this.userIds.push(n.userId);break;case Uc.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),O1=function(){function e(n){this.secureUrl=null,this.type=null,this.width=0,this.height=0,this.alt=null,this.url=n.url,n.secure_url&&(this.secureUrl=n.secure_url),n.type&&(this.type=n.type),n.width&&(this.width=n.width),n.height&&(this.height=n.height),n.alt&&(this.alt=n.alt)}return e.payloadify=function(n){var t,r;return Ee(Ne({url:n.url,secure_url:n.secureUrl,type:n.type,width:(t=n.width)!==null&&t!==void 0?t:0,height:(r=n.height)!==null&&r!==void 0?r:0,alt:n.alt}))},e}(),k1=function(){function e(n){this.title=null,this.url=null,this.description=null,this.defaultImage=null,n["og:title"]&&(this.title=n["og:title"]),n["og:url"]&&(this.url=n["og:url"]),n["og:description"]&&(this.description=n["og:description"]),n["og:image"]&&(this.defaultImage=new O1(n["og:image"]))}return e.payloadify=function(n){return Ee(Ne({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?O1.payloadify(n.defaultImage):null}))},e}(),ki=function(){function e(n){var t,r;this.volume=0,this.name=(t=n.name)!==null&&t!==void 0?t:"default",this.volume=(r=n.volume)!==null&&r!==void 0?r:1}return e.prototype.serialize=function(){return{name:this.name,volume:this.volume}},e.payloadify=function(n){return Ee(Ne({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(no||(no={}));var R1,pa=function(){function e(n){this.id=n.id,this.rating=n.rating,this.comment=n.comment}return e.parseFeedbackStatusFromPayload=function(n){return n&&n.id!==null&&n.rating!==null?"SUBMITTED":"NOT_APPLICABLE"},e.payloadify=function(n){return Ee(Ne({id:n.id,rating:n.rating,comment:n.comment}))},e}(),jl=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isBlockedByMe=!1,s.role=Ge(Ii,r.role)?r.role:Ii.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ke),pr=function(){function e(n){this.key=n.key,this.value=We("string",n.value)?Pe([],Ae(n.value),!1):[]}return e.payloadify=function(n){var t;return Ee(Ne({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),ZC=function(e){switch(e){case bt.BASE:return"";case bt.USER:return"MESG";case bt.FILE:return"FILE";case bt.ADMIN:return"ADMM"}},XC=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p=this;(p=e.call(this,t)||this).channelType=Ze.BASE,p.messageType=bt.BASE,p.mentionType=null,p.mentionedUsers=null,p.mentionedUserIds=null,p.metaArrays=[],p.extendedMessage={},p.createdAt=0,p.updatedAt=0,p.channelUrl=r.channel_url,p.channelType=Ge(Ze,r.channel_type)?r.channel_type:Ze.GROUP,r.channel&&(r.channel.channel_url&&(p.channelUrl=r.channel.channel_url),r.channel.channel_type&&(p.channelType=r.channel.channel_type)),p.data=(i=r.data)!==null&&i!==void 0?i:"",p.customType=(s=r.custom_type)!==null&&s!==void 0?s:"",p.mentionType=Ge(nr,r.mention_type)?r.mention_type:null,p.mentionedUsers=r.mentioned_users?r.mentioned_users.map(function(E){return new Ke(p._iid,E)}):null,p.mentionedUserIds=(o=r.mentioned_user_ids)!==null&&o!==void 0?o:null,p.mentionedUsers&&!p.mentionedUserIds&&(p.mentionedUserIds=p.mentionedUsers.map(function(E){return E.userId})),p.mentionedMessageTemplate=(a=r.mentioned_message_template)!==null&&a!==void 0?a:"";var m=(l=r.metaarray)!==null&&l!==void 0?l:{},b=(u=r.metaarray_key_order)!==null&&u!==void 0?u:Object.keys(m).sort(function(E,S){return E.localeCompare(S)});p.metaArrays=[];for(var v=0;v0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return this.fields.every(function(n){return n.isSubmittable})},enumerable:!1,configurable:!0}),e.prototype.getFieldAnswer=function(n){var t;return(t=this.answers)===null||t===void 0?void 0:t[n]},e.payloadify=function(n){var t;return Ee(Ne({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return JC.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),JC=function(){function e(n){this.key=n.key,this.inputType=n.input_type,this.title=n.title,this.required=n.required,this.regex=n.regex,this.placeholder=n.placeholder,this.fieldKey=n.key}return e.prototype.isValid=function(n){if(!this.regex)return!0;try{return new RegExp(this.regex).test(n)}catch{return!0}},Object.defineProperty(e.prototype,"isSubmittable",{get:function(){return!(this.temporaryAnswer!=null&&!this.isValid(this.temporaryAnswer)||this.required&&this.temporaryAnswer==null)},enumerable:!1,configurable:!0}),e.payloadify=function(n){var t;return Ee(Ne({key:(t=n.fieldKey)!==null&&t!==void 0?t:n.key,input_type:n.inputType,title:n.title,required:n.required,regex:n.regex,placeholder:n.placeholder}))},e}(),eS=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",o.channelType=(s=r.channel_type)!==null&&s!==void 0?s:Ze.GROUP,o.reader=new Ke(o._iid,r.user),o.readAt=r.ts,o}return T(n,e),n}(Wn),G6=function(e){function n(t){var r=t.channelUrl;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r}})||this}return T(n,e),n}(wr);(function(e){function n(t){var r=e.call(this)||this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.notificationIds;return r.method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=Ee(Ne({user_id:o,message_ids:a})),r}return T(n,e),n})(Y);var tS=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new eS(t,i),s}return T(n,e),n}(mt);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.readAt=r.ts,i.unreadMessageCount=r.unread_message_count,i}return T(n,e),n})(ae);var z6=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"READ",ackRequired:!0,payload:{channel_url:r,parent_message_id:i}})||this}return T(n,e),n}(wr),V6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.pushEnabled,a=e.call(this)||this;return a.method=Q.PUT,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/thread_push"),a.params={push_enabled:o},a}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var L1=function(e){function n(t){var r=e.call(this)||this;return r.method=Q.POST,r.path="".concat(ir,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=Ee({forms:t.forms}),r}return T(n,e),n}(Y),q6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.rating,a=t.comment,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks"),l.params={rating:o,comment:a},l}return T(n,e),n}(Y),W6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}return T(n,e),n}(ae),K6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.feedbackId,a=t.rating,l=t.comment,u=e.call(this)||this;return u.method=Q.PUT,u.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),u.params={rating:a,comment:l},u}return T(n,e),n}(Y),Q6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}return T(n,e),n}(ae),Y6=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.feedbackId,a=e.call(this)||this;return a.method=Q.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),a}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}T(n,e)})(ae);var uo,ri,nm=function(e){function n(t,r){var i,s,o,a,l,u=this;return(u=e.call(this,t)||this).plainUrl="",u.fileName=null,u.mimeType=null,u.fileSize=0,u.thumbnails=[],u._requireAuth=!1,u.plainUrl=(i=r.url)!==null&&i!==void 0?i:"",u.fileName=(s=r.file_name)!==null&&s!==void 0?s:null,u.mimeType=(o=r.file_type)!==null&&o!==void 0?o:null,u.fileSize=(a=r.file_size)!==null&&a!==void 0?a:0,u._requireAuth=(l=r.require_auth)!==null&&l!==void 0&&l,u.thumbnails=r.thumbnails?r.thumbnails.map(function(c){var d;return new Vs(u._iid,typeof c=="string"?{url:c,width:0,height:0}:M(M({},c),{url:((d=c.url)!==null&&d!==void 0?d:"").split("auth=")[0]}),u._requireAuth)}):[],u}return T(n,e),n.payloadify=function(t){var r;return Ee(Ne({url:t.plainUrl,file_name:t.fileName,file_type:t.mimeType,file_size:t.fileSize,thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){var s;return{url:((s=i.plainUrl)!==null&&s!==void 0?s:"").split("auth=")[0],width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),require_auth:t._requireAuth}))},Object.defineProperty(n.prototype,"url",{get:function(){var t=O.of(this._iid).sessionManager;return this._requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n}(Wn),nS=function(e){var n=e.channelUrl,t=e.channelType,r=e.parentMessage;this.channelUrl=n,this.channelType=t,this.parentMessage=r};(function(e){e.PENDING="pending",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled"})(uo||(uo={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(ri||(ri={}));var oa,dr=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p=this;return(p=e.call(this,t,r)||this).parentMessage=null,p.silent=!1,p.isOperatorMessage=!1,p.threadInfo=null,p.reactions=[],p.appleCriticalAlertOptions=null,p.scheduledInfo=null,p.suggestedReplies=null,p.myFeedback=null,p.myFeedbackStatus="NOT_APPLICABLE",p.forms=null,p._isContinuousMessages=!1,p._scheduledStatus=null,p.messageId=(s=(i=r.msg_id)!==null&&i!==void 0?i:r.message_id)!==null&&s!==void 0?s:0,p.parentMessageId=(o=typeof r.parent_message_id=="string"?parseInt(r.parent_message_id):r.parent_message_id)!==null&&o!==void 0?o:0,p.threadInfo=r.thread_info?new of(p._iid,r.thread_info):null,p.reactions=r.reactions?r.reactions.map(function(m){return new xd(m)}):[],p.ogMetaData=r.og_tag?new k1(r.og_tag):null,p.silent=(a=r.silent)!==null&&a!==void 0&&a,p.isOperatorMessage=(l=r.is_op_msg)!==null&&l!==void 0&&l,p.appleCriticalAlertOptions=r.apple_critical_alert_options?new ki(r.apple_critical_alert_options):null,typeof r.scheduled_message_id=="number"&&typeof r.scheduled_at=="number"&&r.scheduled_status&&(p.scheduledInfo={scheduledMessageId:r.scheduled_message_id,scheduledAt:r.scheduled_at},p._scheduledStatus=r.scheduled_status),p._isContinuousMessages=(u=r.is_continuous_messages)!==null&&u!==void 0&&u,p.myFeedback=!((c=r.feedback)===null||c===void 0)&&c.id?new pa(r.feedback):null,p.myFeedbackStatus=(d=r.my_feedback_status)!==null&&d!==void 0?d:pa.parseFeedbackStatusFromPayload(r.feedback),p.suggestedReplies=(f=(h=r.extended_message_payload)===null||h===void 0?void 0:h.suggested_replies)!==null&&f!==void 0?f:null,p.forms=Od.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(m){return new Od(p.messageId,m.key,m.fields.map(function(b){return new JC(b)}))}):null,p}return T(n,e),n.payloadify=function(t){var r,i;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?of.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return xd.payloadify(s)}),og_tag:t.ogMetaData?k1.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,scheduled_message_id:(r=t.scheduledInfo)===null||r===void 0?void 0:r.scheduledMessageId,scheduled_at:(i=t.scheduledInfo)===null||i===void 0?void 0:i.scheduledAt,scheduled_status:t._scheduledStatus,feedback:t.myFeedback?pa.payloadify(t.myFeedback):null,my_feedback_status:t.myFeedbackStatus,forms:t.forms?t.forms.map(function(s){return Od.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return Ee(Ne({type:ZC(t.messageType),ts:t.createdAt,user:t.sender?jl.payloadify(t.sender):null,message:t.message,file:{url:t.plainUrl,name:t.name,type:t.type,require_auth:t.requireAuth},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(r){return nm.payloadify(r)}):null}))},n.prototype.isIdentical=function(t){return this.messageId===t.messageId},n.prototype.applyThreadInfoUpdateEvent=function(t){return this.messageId===t.targetMessageId&&(t.threadInfo._isUpdateRequired&&this.threadInfo&&t.threadInfo._updateFrom(this.threadInfo),this.threadInfo=t.threadInfo,!0)},n.prototype.applyReactionEvent=function(t){if(this.messageId===t.messageId){for(var r=!1,i=0;i=r)return this.parentMessage=t,!0}return!1},n.prototype._triggerThreadInfoUpdatedEvent=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){return(t=O.of(this._iid).dispatcher).dispatch(new nS({channelType:Ze.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),[2]})})},n.prototype.markThreadAsRead=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new z6({channelUrl:this.channelUrl,messageId:this.messageId}),[4,t.send(r)];case 1:return i.sent(),this.threadInfo&&this.threadInfo.unreadReplyCount!==0?(this.threadInfo.unreadReplyCount=0,[4,this._triggerThreadInfoUpdatedEvent()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},n.prototype.setPushNotificationEnabled=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=O.of(this._iid).requestQueue,i=new V6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,pushEnabled:t}),[4,r.send(i)];case 1:return s.sent(),this.threadInfo&&this.threadInfo.isPushNotificationEnabled!==t&&(this.threadInfo.isPushNotificationEnabled=t),[2]}})})},n.prototype.submitForm=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:if(K(t.form&&t.form instanceof Od||k("string",t.formId)&&k("object",t.answers)).throw(L.invalidParameters),r=O.of(this._iid),i=r.requestQueue,s=r.sdkState,o=r.logger,!t.form)return[3,2];if(!(a=t.form).isSubmittable)throw new L({code:Ie.INVALID_PARAMETER,message:"The given form is not submittable."});if(a.isSubmitted)throw new L({code:Ie.INVALID_PARAMETER,message:"The given form is already submitted."});if(a.messageId!=this.messageId)throw new L({code:Ie.INVALID_PARAMETER,message:"This form does not belong to the message."});return l=a.fields.reduce(function(d,h){return d[h.key]=h.temporaryAnswer,d},{}),u=new L1({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:a.key,data:l}]}),[4,i.send(u)];case 1:return c.sent(),[3,4];case 2:return t.formId&&t.answers?(o.warn("The submitForm method with formId and answers is deprecated. Use submitForm({ form: Form }) instead."),u=new L1({userId:s.userId,channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,forms:[{form_key:t.formId,data:t.answers}]}),[4,i.send(u)]):[3,4];case 3:c.sent(),c.label=4;case 4:return[2]}})})},n.prototype.submitFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new q6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,rating:t.rating,comment:t.comment}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(W6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_ADDED})),[2]}})})},n.prototype.updateFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new K6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t.id,rating:t.rating,comment:t.comment}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(Q6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_UPDATED})),[2]}})})},n.prototype.deleteFeedback=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new Y6({channelUrl:this.channelUrl,channelType:this.channelType,messageId:this.messageId,feedbackId:t}),[4,i.send(o)];case 1:return a.sent(),this.myFeedback=null,this.myFeedbackStatus="NO_FEEDBACK",s.dispatch(new Et({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(XC),Dt=function(e){function n(t,r){var i,s,o,a,l=this;if((l=e.call(this,t,r)||this).reqId="",l.replyToChannel=!1,l.errorCode=0,l.sender=r.user?new jl(l._iid,r.user):r.sender_id,l.reqId=(s=(i=r.req_id)!==null&&i!==void 0?i:r.request_id)!==null&&s!==void 0?s:"",l.replyToChannel=(o=r.is_reply_to_channel)!==null&&o!==void 0&&o,r.request_state&&Ge(ut,r.request_state)&&(l.sendingStatus=r.request_state),!l.sendingStatus)if(l.messageId>0)l.sendingStatus=ut.SUCCEEDED;else if(l.scheduledInfo)switch(r.scheduled_status&&(l._scheduledStatus=r.scheduled_status),r.scheduled_status){case ri.SENT:case ri.IN_QUEUE:l.sendingStatus=ut.SUCCEEDED;break;case ri.PENDING:l.sendingStatus=ut.SCHEDULED;break;case ri.FAILED:case ri.REMOVED:l.sendingStatus=ut.FAILED;break;case ri.CANCELED:l.sendingStatus=ut.CANCELED}else l.sendingStatus=ut.PENDING;return l.errorCode=(a=r.error_code)!==null&&a!==void 0?a:0,l._messageToken=r.mesg_token,l}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{user:jl.payloadify(t.sender),req_id:t.reqId,is_reply_to_channel:t.replyToChannel,request_state:t.sendingStatus,error_code:t.errorCode,mesg_token:t._messageToken})))},Object.defineProperty(n.prototype,"isResendable",{get:function(){return(this.sendingStatus===ut.FAILED||this.sendingStatus===ut.CANCELED)&&U4(this.errorCode)},enumerable:!1,configurable:!0}),n.prototype.isIdentical=function(t){return this.messageId>0&&t.messageId>0?this.messageId===t.messageId:this.reqId===t.reqId},n}(dr),Qc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:er.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},s0=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ge(er,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)},Bl=function(e){function n(t,r){var i,s,o,a,l=this;if((l=e.call(this,t,r)||this).translations={},l.message=(i=r.message)!==null&&i!==void 0?i:"",l.messageType=bt.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=vr(t,Ee(Ne(M(M({},u),{message_id:l.parentMessageId,channel_url:l.channelUrl,channel_type:l.channelType,file:u.file,url:(o=u.file)===null||o===void 0?void 0:o.url,require_auth:(a=u.file)===null||a===void 0?void 0:a.require_auth}))))}return l}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&s0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(dr),D1=function(){function e(n){var t,r;this.detail={},this.type=(t=n.type)!==null&&t!==void 0?t:"",this.vendor=(r=n.vendor)!==null&&r!==void 0?r:"",n.detail&&k("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return Ee(Ne({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),U1=function(){function e(n){this.status=n.status,n.original_message_info&&(this.originalMessageInfo={createdAt:n.original_message_info.ts,messageId:n.original_message_info.id})}return e.payloadify=function(n){return Ee({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),Jn=function(e){function n(t,r){var i,s,o,a,l,u,c,d=this;if((d=e.call(this,t,r)||this).message="",d.messageParams=null,d.translations={},d.translationTargetLanguages=[],d.messageSurvivalSeconds=-1,d.plugins=[],d._poll=null,d.message=r.message,d.messageType=bt.USER,d.translations=(o=r.translations)!==null&&o!==void 0?o:{},d.translationTargetLanguages=(a=r.target_langs)!==null&&a!==void 0?a:[],Object.keys(d.translations).length===0&&d.translationTargetLanguages.length>0)try{for(var h=ve(d.translationTargetLanguages),f=h.next();!f.done;f=h.next()){var p=f.value;d.translations[p]=""}}catch(b){i={error:b}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.messageSurvivalSeconds=(l=r.message_survival_seconds)!==null&&l!==void 0?l:-1,d.plugins=r.plugins?r.plugins.map(function(b){return new D1(b)}):[],d._poll=r.poll?new Oi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=vr(t,Ee(Ne(M(M({},m),{created_at:m.ts,message_id:d.parentMessageId,channel_url:d.channelUrl,channel_type:d.channelType,file:m.file,url:(u=m.file)===null||u===void 0?void 0:u.url,require_auth:(c=m.file)===null||c===void 0?void 0:c.require_auth}))))}return r.review_info&&(d.messageReviewInfo=new U1(r.review_info)),d}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{message:t.message,translations:t.translations,message_survival_seconds:t.messageSurvivalSeconds,plugins:t.plugins.map(function(r){return D1.payloadify(r)}),poll:t._poll?Oi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?U1.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&s0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.prototype.applyPoll=function(t){return!(this._poll&&this._poll.id===t.id&&this._poll.updatedAt>t.updatedAt)&&(this._poll=t,!0)},Object.defineProperty(n.prototype,"poll",{get:function(){return this._poll},enumerable:!1,configurable:!0}),n}(Dt),ai=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h=this;if((h=e.call(this,t,r)||this).messageParams=null,h.fileInfoList=[],h.messageSurvivalSeconds=-1,h.messageType=bt.FILE,h.data=(o=(s=(i=r.file)===null||i===void 0?void 0:i.data)!==null&&s!==void 0?s:r.custom)!==null&&o!==void 0?o:"",h.fileInfoList=(l=(a=r.files)===null||a===void 0?void 0:a.map(function(p){return new nm(t,p)}))!==null&&l!==void 0?l:[],h.messageSurvivalSeconds=(u=r.message_survival_seconds)!==null&&u!==void 0?u:-1,r.parent_message_info){var f=r.parent_message_info;h.parentMessage=vr(t,Ee(Ne(M(M({},f),{created_at:f.ts,message_id:h.parentMessageId,channel_url:h.channelUrl,channel_type:h.channelType,file:f.file,url:(c=f.file)===null||c===void 0?void 0:c.url,require_auth:(d=f.file)===null||d===void 0?void 0:d.require_auth}))))}return h}return T(n,e),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&s0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n.payloadify=function(t){var r,i,s,o,a,l;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{file:{name:(i=(r=t.fileInfoList[0])===null||r===void 0?void 0:r.fileName)!==null&&i!==void 0?i:"",size:(o=(s=t.fileInfoList[0])===null||s===void 0?void 0:s.fileSize)!==null&&o!==void 0?o:0,type:(l=(a=t.fileInfoList[0])===null||a===void 0?void 0:a.mimeType)!==null&&l!==void 0?l:"",data:t.data},files:Array.isArray(t.fileInfoList)?t.fileInfoList.map(function(u){return nm.payloadify(u)}):null,message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},n._isMultipleFilesMessagePayload=function(t){var r=t.files;return Array.isArray(r)&&r.length>=2},n._isMultipleFilesMessageSerializedData=function(t){var r=t.fileInfoList;return Array.isArray(r)},n}(Dt);(function(e){e.SENT="SENT",e.READ="READ"})(oa||(oa={}));var wa=function(e){function n(t,r){var i,s,o=this;if((o=e.call(this,t,r)||this).notificationData=null,o.notificationId=r.notification_message_id,o.messageType=bt.ADMIN,o.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:oa.SENT,o.priority=(s=r.priority)!==null&&s!==void 0?s:q_.NORMAL,o.notificationEventDeadline=r.notification_event_deadline,o.extendedMessage.sub_type===0)try{var a=JSON.parse(o.extendedMessage.sub_data),l=a.label,u=a.tags,c=u===void 0?[]:u,d=a.template_key,h=a.template_variables;o.notificationData={label:l,tags:c,templateKey:d,templateVariables:h}}catch{}return o}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{notification_message_id:t.notificationId,message_status:t.messageStatus,priority:t.priority,notification_event_deadline:t.notificationEventDeadline})))},n.prototype.isIdentical=function(t){return this.notificationId===t.notificationId},n}(XC),P1=function(e){if(e.notificationId)return wa.payloadify(e);switch(e.messageType){case bt.USER:return Jn.payloadify(e);case bt.FILE:return e.fileInfoList?ai.payloadify(e):Zt.payloadify(e);case bt.ADMIN:return Bl.payloadify(e);default:throw L.unknown}},vr=function(e,n){if(n.notification_message_id)return new wa(e,n);switch(n.type){case"MESG":return new Jn(e,n);case"FILE":return ai._isMultipleFilesMessagePayload(n)?new ai(e,n):new Zt(e,n);case"ADMM":case"BRDM":return new Bl(e,n);default:return null}},Zt=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=bt.FILE;var E=r.file;if(_.plainUrl=((s=(i=E==null?void 0:E.url)!==null&&i!==void 0?i:r.url)!==null&&s!==void 0?s:"").split("?auth=")[0],_.name=(a=(o=E==null?void 0:E.name)!==null&&o!==void 0?o:r.name)!==null&&a!==void 0?a:"File",_.size=(u=(l=E==null?void 0:E.size)!==null&&l!==void 0?l:r.size)!==null&&u!==void 0?u:0,_.data=(d=(c=E==null?void 0:E.data)!==null&&c!==void 0?c:r.custom)!==null&&d!==void 0?d:"",_.type=E?(h=E.type)!==null&&h!==void 0?h:"":(f=r.type)!==null&&f!==void 0?f:"",_.requireAuth=(p=r.require_auth)!==null&&p!==void 0&&p,_.thumbnails=r.thumbnails?r.thumbnails.map(function(w){var N;return new Vs(_._iid,typeof w=="string"?{url:w,width:0,height:0}:M(M({},w),{url:((N=w.url)!==null&&N!==void 0?N:"").split("auth=")[0]}),_.requireAuth)}):[],_.messageSurvivalSeconds=(m=r.message_survival_seconds)!==null&&m!==void 0?m:-1,r.parent_message_info){var S=r.parent_message_info;_.parentMessage=vr(t,Ee(Ne(M(M({},S),{created_at:S.ts,message_id:_.parentMessageId,channel_url:_.channelUrl,channel_type:_.channelType,file:S.file,url:(b=S.file)===null||b===void 0?void 0:b.url,require_auth:(v=S.file)===null||v===void 0?void 0:v.require_auth}))))}return _}return T(n,e),n.payloadify=function(t){var r;return Ee(Ne(M(M({},e.payloadify.call(this,t)),{url:t.plainUrl,require_auth:t.requireAuth,file:{name:t.name,size:t.size,type:t.type,data:t.data},thumbnails:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{url:i.plainUrl,width:i.width,height:i.height,real_width:i.realWidth,real_height:i.realHeight}}),message_survival_seconds:t.messageSurvivalSeconds,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null})))},Object.defineProperty(n.prototype,"url",{get:function(){var t=O.of(this._iid).sessionManager;return this.requireAuth&&t.ekey?"".concat(this.plainUrl,"?auth=").concat(t.ekey):this.plainUrl},enumerable:!1,configurable:!0}),n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},Qc),r),K(this.messageId>0&&k("number",t)&&s0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Dt),af=function(e){function n(t,r){var i=r.file,s=r.fileUrl,o=r.fileName,a=r.fileSize,l=r.mimeType,u=r.thumbnailSizes,c=r._uploadedMetaData,d=r._thumbnails,h=e.call(this,t)||this;return h._plainUrl=s,h.file=i,h.fileName=o,h.fileSize=a,h.mimeType=l,h.thumbnailSizes=u,h._uploadedMetaData=c,h._thumbnails=d,h}return T(n,e),n.getPlainUrl=function(t){return t instanceof n?t._plainUrl:t.fileUrl},Object.defineProperty(n.prototype,"fileUrl",{get:function(){var t,r=O.of(this._iid).sessionManager;return this._plainUrl&&(!((t=this._uploadedMetaData)===null||t===void 0)&&t.requireAuth)&&r.ekey?"".concat(this._plainUrl,"?auth=").concat(r.ekey):this._plainUrl},set:function(t){this._plainUrl=t},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return{file:this.file,fileUrl:this._plainUrl,fileName:this.fileName,fileSize:this.fileSize,mimeType:this.mimeType,thumbnailSizes:this.thumbnailSizes,_thumbnails:this._thumbnails,_uploadedMetaData:this._uploadedMetaData}},n}(Wn),Z6=function(e){function n(t){var r,i,s,o,a=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?a=t.mentionedUserIds:t.mentionedUsers&&(a=t.mentionedUsers.map(function(l){return l.userId}))),e.call(this,{code:"FILE",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,files:t.files?iS(t.files):null,url:t.url,name:(r=t.fileName)!==null&&r!==void 0?r:"",type:(i=t.mimeType)!==null&&i!==void 0?i:"",size:(s=t.fileSize)!==null&&s!==void 0?s:0,custom:t.data,custom_type:t.customType,thumbnails:(o=t._thumbnails)===null||o===void 0?void 0:o.map(function(l){return Vs.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:a,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Qi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,pin_message:t.isPinnedMessage}))})||this}return T(n,e),n}(wr),X6=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(a){return a.userId}))),s.method=Q.POST,s.path="".concat(Je(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=Ee(Ne({message_type:bt.FILE,user_id:t.userId,files:t.files?iS(t.files):null,url:t.fileUrl,mention_type:t.mentionType,mentioned_user_ids:o,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,data:t.data,custom_type:t.customType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(a){return Vs.payloadify(a)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(a){return pr.payloadify(a)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return T(n,e),n}(Y),rS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"FILE",i)||this).message=i.files&&i.files.length>=2?new ai(t,i):new Zt(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),J6=function(e){function n(t,r){var i,s,o,a,l=this;(l=e.call(this,t,r)||this).message=r.files&&r.files.length>=2?new ai(t,r):new Zt(t,r);var u=O.of(t).sdkState;return l.isMentioned=Dl(l.message.mentionType,(o=(i=l.message.mentionedUserIds)!==null&&i!==void 0?i:(s=l.message.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}))!==null&&o!==void 0?o:[],u.userId),l.forceUpdateLastMessage=(a=r.force_update_last_message)!==null&&a!==void 0&&a,l}return T(n,e),n}(ae);function iS(e){return e.map(function(n){var t,r;return Ee(Ne({url:af.getPlainUrl(n),file_name:n.fileName,file_type:n.mimeType,file_size:n.fileSize,thumbnails:(t=n._thumbnails)===null||t===void 0?void 0:t.map(function(i){return Vs.payloadify(i)}),require_auth:(r=n._uploadedMetaData)===null||r===void 0?void 0:r.requireAuth}))})}var Sn;(function(e){e[e.PENDING=0]="PENDING",e[e.UPLOADING=1]="UPLOADING",e[e.UPLOADED=2]="UPLOADED",e[e.SENDING=3]="SENDING",e[e.FAILED=4]="FAILED"})(Sn||(Sn={}));var eM=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=t.onlineDetector,a=t.cacheContext,l=this;this._queueMap=new Map,this._iid=n,this._sdkState=r,this._requestQueue=s,this._cacheContext=a,this._dispatcher=i,this._dispatcher.on(function(u){u instanceof _i&&(l._connectionState=u.stateType)}),this._onlineDetector=o}return Object.defineProperty(e.prototype,"_shouldSendThroughWebSocket",{get:function(){return this._connectionState===st.CONNECTED||this._connectionState===st.CONNECTING||this._connectionState===st.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new Z6(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=o.sent(),[2,s.as(rS).message];case 2:return i=new X6(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=o.sent(),[2,s.as(J6).message]}})})},e.prototype._createSendFileMessageRequestParams=function(n,t){var r=M(M({},t.params),{channelUrl:n.url,channelType:n.channelType,reqId:t.requestId,url:""});if(t.multipleFileUploadInfo){var i=t.params;r.files=i.fileInfoList}else i=t.params,r.url=i.fileUrl,r.requireAuth=i.requireAuth;return r},e.prototype._resolveMessageQueue=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:if(!(r=this._queueMap.get(n.url)))return[3,21];if(r.isResolving)return[3,20];r.isResolving=!0,i=[],s=!0,b.label=1;case 1:b.trys.push([1,15,16,17]),o=ve(r.messageQueue),a=o.next(),b.label=2;case 2:if(a.done)return[3,14];switch(l=a.value,l.state){case Sn.PENDING:case Sn.UPLOADING:return[3,3];case Sn.UPLOADED:return[3,4];case Sn.FAILED:return[3,12]}return[3,13];case 3:return s=!1,i.push(l),[3,13];case 4:if(!s)return[3,10];b.label=5;case 5:return b.trys.push([5,8,,9]),l.state=Sn.SENDING,[4,this._sendFileMessage(n,l)];case 6:return u=b.sent(),l.deferred.resolve(u),[4,Or(100)];case 7:return b.sent(),[3,9];case 8:return c=b.sent(),l.deferred.reject(c),[3,9];case 9:return[3,11];case 10:i.push(l),b.label=11;case 11:return[3,13];case 12:return d=(t=l.error)!==null&&t!==void 0?t:L.unknown,l.deferred.reject(d.code===Ie.REQUEST_CANCELED?L.fileUploadCanceled:d),[3,13];case 13:return a=o.next(),[3,2];case 14:return[3,17];case 15:return h=b.sent(),p={error:h},[3,17];case 16:try{a&&!a.done&&(m=o.return)&&m.call(o)}finally{if(p)throw p.error}return[7];case 17:return f=r.isResolveRequestPending,r.messageQueue=i,r.isResolving=!1,r.isResolveRequestPending=!1,f?[4,this._resolveMessageQueue(n)]:[3,19];case 18:b.sent(),b.label=19;case 19:return[3,21];case 20:r.isResolveRequestPending=!0,b.label=21;case 21:return[2]}})})},e.prototype._uploadNextPendingItem=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return(r=this._queueMap.get(n.url))&&(i=r.messageQueue.find(function(p){return p.state===Sn.PENDING}))?i.multipleFileUploadInfo?(s=i.multipleFileUploadInfo,o=s.uploadIndex,a=s.uploadCount,l=s.requestHandler,h=i.params,u=h.fileInfoList[o],!fr(u.file)||!((t=u._uploadedMetaData)===null||t===void 0)&&t.isUploaded?[3,2]:[4,this._tryUploadNextItemAndUpdateItemState(n,r,i)]):[3,4]:[3,9];case 1:return f.sent(),[3,3];case 2:i.state=o=0&&n.uploadQueue.splice(r,1)},e.prototype._uploadNextFileForSingleFileItemAndUpdateParams=function(n,t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m,b;return g(this,function(v){switch(v.label){case 0:return a=new rf({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(a)];case 1:return l=v.sent(),u=l.as(sf),c=u.url,d=u.fileSize,h=d===void 0?r.fileSize:d,f=u.thumbnails,p=f===void 0?[]:f,m=u.requireAuth,b=m!==void 0&&m,r.fileName=(i=r.fileName)!==null&&i!==void 0?i:r.file.name,r.mimeType=(s=r.mimeType)!==null&&s!==void 0?s:r.file.type,r.fileSize=(o=r.fileSize)!==null&&o!==void 0?o:r.file.size,r.fileUrl=c,r.fileSize=h,r.requireAuth=b,r._thumbnails=p,[2]}})})},e.prototype._uploadNextFileForMultipleFilesItemAndUpdateParams=function(n,t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return a=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[a],u=new rf({file:l.file,channelUrl:n.url,thumbnailSizes:l.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(u)];case 1:return c=_.sent(),d=c.as(sf),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,v=b!==void 0&&b,l.fileName=(i=l.fileName)!==null&&i!==void 0?i:l.file.name,l.mimeType=(s=l.mimeType)!==null&&s!==void 0?s:l.file.type,l.fileSize=(o=l.fileSize)!==null&&o!==void 0?o:l.file.size,l.file=void 0,l.fileUrl=h,l.fileSize=p,l._thumbnails=m,l._uploadedMetaData=M(M({},l._uploadedMetaData),{requireAuth:v,isUploaded:!0}),l instanceof af||(r.fileInfoList[a]=new af(this._iid,l)),[2]}})})},e.prototype.request=function(n,t,r,i){return i===void 0&&(i={}),y(this,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){return this._queueMap.has(n.url)||(s={messageQueue:[],uploadQueue:[],isResolving:!1,isResolveRequestPending:!1},this._queueMap.set(n.url,s)),o=this._queueMap.get(n.url),a=new Tr,l={requestId:t,params:r,state:Sn.PENDING,deferred:a},function(d){return"fileInfoList"in d}(r)&&(u=M({uploadIndex:0,uploadCount:r.fileInfoList.length},i),l.multipleFileUploadInfo=u),o.messageQueue.push(l),this._uploadNextPendingItem(n),[2,a.promise]})})},e.prototype.cancel=function(n,t){var r,i,s=this._queueMap.get(n.url);if(s){var o=t?[s.messageQueue.find(function(p){return p.requestId===t})]:Pe([],Ae(s.messageQueue),!1);try{for(var a=ve(o),l=a.next();!l.done;l=a.next()){var u=l.value;if(u)switch(u.state){case Sn.PENDING:if(u.state=Sn.FAILED,u.error=L.requestCanceled,u.multipleFileUploadInfo&&!u.multipleFileUploadInfo.isCopy){var c=u.multipleFileUploadInfo,d=c.uploadIndex,h=c.requestHandler,f=u.params.fileInfoList[d];h==null||h._triggerOnFileUploaded(u.requestId,d,f,L.fileUploadCanceled)}this._resolveMessageQueue(n);break;case Sn.UPLOADING:this._requestQueue.cancel(u.requestId),this._dispatcher.dispatch(new Qh({requestId:u.requestId}))}}}catch(p){r={error:p}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}else t&&(this._requestQueue.cancel(t),this._dispatcher.dispatch(new Qh({requestId:t})))},e}(),rm,nc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:er.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Dn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},F1=function(e){return k("number",e.prevResultSize)&&k("number",e.nextResultSize)&&k("boolean",e.isInclusive)&&k("boolean",e.reverse)&&k("string",e.messageTypeFilter)&&Ge(er,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&Ge(Dn,e.replyType)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeReactions)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)&&k("boolean",e.showSubchannelMessagesOnly)},im={replyType:Dn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},H1=function(e){return Ge(Dn,e.replyType)&&k("boolean",e.includeReactions)&&k("boolean",e.includeMetaArray)&&k("boolean",e.includeParentMessageInfo)&&k("boolean",e.includeThreadInfo)},tM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.includeMetaArray,a=t.includeReactions,l=t.includeThreadInfo,u=t.includeParentMessageInfo,c=e.call(this)||this;return c.method=Q.GET,c.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s)),c.params={is_sdk:!0,with_sorted_meta_array:o,include_reactions:a,include_thread_info:l,include_parent_message_info:u,include_poll_details:!0},c}return T(n,e),n}(Y),nM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?vr(t,M({},r)):null,i}return T(n,e),n}(ae),kd=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=t.prevResultSize,l=t.nextResultSize,u=t.isInclusive,c=t.reverse,d=t.messageTypeFilter,h=t.customTypesFilter,f=t.senderUserIdsFilter,p=t.replyType,m=t.includeMetaArray,b=t.includeReactions,v=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,w=t.checkingHasNext,N=t.checkingContinuousMessages,I=e.call(this)||this;return I.method=Q.GET,I.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages"),I.params=Ee(Ne({is_sdk:!0,prev_limit:a,next_limit:l,include:u,reverse:c,message_ts:s,message_id:o,message_type:d??null,custom_types:h,sender_ids:f,include_reply_type:p,with_sorted_meta_array:m,include_reactions:b,parent_message_id:v,include_thread_info:_,include_parent_message_info:E,show_subchannel_message_only:S,include_poll_details:!0,checking_has_next:w,checking_continuous_messages:N})),I}return T(n,e),n}(Y),Rd=function(e){function n(t,r){var i=e.call(this,t,r)||this;return r.is_continuous_messages!==void 0&&(i.isContinuousMessages=r.is_continuous_messages),r.has_next!==void 0&&(i.hasNext=r.has_next),i.messages=r.messages.map(function(s){return vr(t,s)}),i}return T(n,e),n}(ae),rM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.timestamp,o=t.token,a=t.replyType,l=t.includeMetaArray,u=t.includeReactions,c=t.includeThreadInfo,d=t.includeParentMessageInfo,h=e.call(this)||this;return h.method=Q.GET,h.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/changelogs"),h.params={change_ts:s,token:o,with_sorted_meta_array:l,include_reactions:u,include_thread_info:c,include_reply_type:a,include_parent_message_info:d,include_poll_details:!0},h}return T(n,e),n}(Y),iM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return vr(t,s)}),i.deletedMessagesInfo=r.deleted.map(function(s){return{messageId:s.message_id,deletedAt:s.deleted_at}}),i.hasMore=r.has_more,i.nextToken=r.next,i}return T(n,e),n}(ae),sM=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(ir,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return T(n,e),n}(Y),oM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?vr(t,M({},r)):null,i}return T(n,e),n}(ae);(function(e){e.MUTED="muted",e.BANNED="banned"})(rm||(rm={}));var j1=function(){function e(n){var t,r,i,s;this.restrictionType=null,Ge(rm,n.restriction_type)&&(this.restrictionType=n.restriction_type),this.description=(t=n.description)!==null&&t!==void 0?t:null,this.endAt=(i=(r=n.end_at)!==null&&r!==void 0?r:n.muted_end_at)!==null&&i!==void 0?i:-1,this.remainingDuration=(s=n.remaining_duration)!==null&&s!==void 0?s:-1}return e.payloadify=function(n){return Ee(Ne({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),Ua=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new j1(r),i}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),j1.payloadify(t.restrictionInfo))))},n}(Ke);(function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).isMuted=!1,s.isMuted=(i=r.is_muted)!==null&&i!==void 0&&i,s}return T(n,e),n})(Ke);var Br=function(){function e(){this._onPending=qe,this._onFailed=qe,this._onSucceeded=qe}return e.prototype._trigger=function(n){switch(n==null?void 0:n.sendingStatus){case ut.PENDING:n.errorCode===0&&this._onPending(n);break;case ut.SCHEDULED:case ut.SUCCEEDED:this._onSucceeded(n)}},e.prototype._triggerFailed=function(n,t){switch(t==null?void 0:t.sendingStatus){case ut.FAILED:case ut.CANCELED:this._onFailed(n,t.scheduledInfo?null:t)}},e.prototype.onPending=function(n){return this._onPending=n,this},e.prototype.onFailed=function(n){return this._onFailed=n,this},e.prototype.onSucceeded=function(n){return this._onSucceeded=n,this},e}(),o0={data:void 0,customType:void 0,mentionType:nr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,parentMessageId:void 0,isReplyToChannel:!1,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0,isPinnedMessage:!1},a0=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ge(nr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&We(pr,e.metaArrays,!0)&&k("number",e.parentMessageId,!0)&&k("boolean",e.isReplyToChannel)&&Ge(Qi,e.pushNotificationDeliveryOption,!0)&&k(ki,e.appleCriticalAlertOptions,!0)&&k("boolean",e.isPinnedMessage,!0)},B1=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},sS=M(M({},o0),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function oS(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),translationTargetLanguages:Object.keys(e.translations),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var _a,sm=function(e){var n;return Ee(Ne({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,mentionedMessageTemplate:e.mentionedMessageTemplate,metaArrays:e.metaArrays,pollId:(n=e.poll)===null||n===void 0?void 0:n.id,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,message:e.message,translationTargetLanguages:Object.keys(e.translations),extendedMessagePayload:e.extendedMessagePayload}))},aS=function(e){return a0(e)&&k("string",e.message)&&We("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)&&k("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(_a||(_a={}));var ch=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},bp=function(e){return e===_a.BLOB||e===_a.FILE},$1=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},G1=M(M({},o0),{file:void 0,fileKey:void 0,fileUrl:void 0,fileName:void 0,fileType:void 0,fileSize:void 0,mimeType:void 0,thumbnailSizes:void 0,requireAuth:!1});function lS(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{fileUrl:e.plainUrl,fileName:e.name,fileSize:e.size,mimeType:e.type,mentionType:e.mentionType,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(s){return s.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(i=e.thumbnails)===null||i===void 0?void 0:i.map(function(s){return{maxWidth:s.width,maxHeight:s.height}}),requireAuth:e.requireAuth,isPinnedMessage:!1,_thumbnails:e.thumbnails}))}var rc,om=function(e,n){var t;return e.messageParams?(!e.url&&fr(n)&&(e.messageParams.file=n),e.messageParams):Ee(Ne({data:e.data,customType:e.customType,mentionType:e.mentionType,mentionedUsers:e.mentionedUsers,mentionedUserIds:e.mentionedUserIds,metaArrays:e.metaArrays,parentMessageId:e.parentMessageId,appleCriticalAlertOptions:e.appleCriticalAlertOptions,file:n,fileUrl:e.url,fileName:e.name,fileSize:e.size,mimeType:e.type,thumbnailSizes:(t=e.thumbnails)===null||t===void 0?void 0:t.map(function(r){return{maxWidth:r.width,maxHeight:r.height}})}))},z1=function(e){return a0(e)&&(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},Zv={data:void 0,customType:void 0,mentionType:nr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},Xv=function(e){return k("string",e.data,!0)&&k("string",e.customType,!0)&&Ge(nr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&k("string",e.mentionedMessageTemplate,!0)&&We(pr,e.metaArrays,!0)&&Ge(Qi,e.pushNotificationDeliveryOption,!0)&&k(ki,e.appleCriticalAlertOptions,!0)},uS=M(M({},Zv),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),cS=function(e){return Xv(e)&&k("string",e.message,!0)&&We("string",e.translationTargetLanguages,!0)&&k("number",e.pollId,!0)},aM=M({},Zv),lM=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.token,o=t.limit,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(i),"/").concat(encodeURIComponent(r),"/operators"),a.params={token:s,limit:o},a}return T(n,e),n}(Y),uM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.operators=r.operators.map(function(s){return new Ke(t,s)}),i.token=r.next,i}return T(n,e),n}(ae),cM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=O.of(this._iid).requestQueue,i=new lM(M(M({},this),{channelUrl:this.channelUrl,token:this._token})),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(uM),a=o.operators,l=o.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,a];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),dM=function(e){function n(t,r,i,s){var o,a,l,u,c,d,h,f,p,m,b=this;return(b=e.call(this,t,r,i,s)||this).reverse=!1,b.messageTypeFilter=er.ALL,b.customTypesFilter=null,b.senderUserIdsFilter=null,b.replyType=Dn.NONE,b.includeMetaArray=!1,b.includeReactions=!1,b.includeParentMessageInfo=!1,b.includeThreadInfo=!1,b.showSubchannelMessagesOnly=!1,b._edge=Number.MAX_SAFE_INTEGER,b.reverse=(o=s.reverse)!==null&&o!==void 0&&o,b.messageTypeFilter=(a=s.messageTypeFilter)!==null&&a!==void 0?a:er.ALL,b.customTypesFilter=(l=s.customTypesFilter)!==null&&l!==void 0?l:null,b.senderUserIdsFilter=(u=s.senderUserIdsFilter)!==null&&u!==void 0?u:null,b.replyType=(c=s.replyType)!==null&&c!==void 0?c:Dn.NONE,b.includeMetaArray=(d=s.includeMetaArray)!==null&&d!==void 0&&d,b.includeReactions=(h=s.includeReactions)!==null&&h!==void 0&&h,b.includeParentMessageInfo=(f=s.includeParentMessageInfo)!==null&&f!==void 0&&f,b.includeThreadInfo=(p=s.includeThreadInfo)!==null&&p!==void 0&&p,b.showSubchannelMessagesOnly=(m=s.showSubchannelMessagesOnly)!==null&&m!==void 0&&m,b}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.reverse)&&Ge(er,this.messageTypeFilter)&&Ge(Dn,this.replyType)&&We("string",this.customTypesFilter,!0)&&We("string",this.senderUserIdsFilter,!0)&&k("boolean",this.includeMetaArray)&&k("boolean",this.includeReactions)&&k("boolean",this.includeParentMessageInfo)&&k("boolean",this.includeThreadInfo)&&k("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,An.of(this._iid).getMessagesByTimestamp(this.channelUrl,this.channelType,this._edge,Ne({prevResultSize:this.limit,nextResultSize:0,isInclusive:!1,reverse:this.reverse,messageTypeFilter:this.messageTypeFilter,customTypesFilter:this.customTypesFilter,replyType:this.replyType,senderUserIdsFilter:this.senderUserIdsFilter,includeReactions:this.includeReactions,includeMetaArray:this.includeMetaArray,includeParentMessageInfo:this.includeParentMessageInfo,includeThreadInfo:this.includeThreadInfo,showSubchannelMessagesOnly:this.showSubchannelMessagesOnly}))]):[3,2]:[3,5];case 1:return t=r.sent(),this._edge=Math.min.apply(Math,Pe([Number.MAX_SAFE_INTEGER],Ae(t.map(function(i){return i.createdAt})),!1)),this._hasNext=t.length>=this.limit,this._isLoading=!1,[2,t];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),hM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.limit,a=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:o,token:a},r}return T(n,e),n}(Y),fM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.mutedUsers=[];var s=r.next,o=r.muted_list;return i.token=s,o&&o.length>0&&(i.mutedUsers=o.map(function(a){return new Ua(t,a)})),i}return T(n,e),n}(ae),pM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new hM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(fM),o=s.mutedUsers,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),_M=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.limit,a=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=Ee({limit:o,token:a}),r}return T(n,e),n}(Y),mM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.bannedUsers=[];var s=r.next,o=r.banned_list;return i.token=s,o&&o.length>0&&(i.bannedUsers=o.map(function(a){return new Ua(t,a.user)})),i}return T(n,e),n}(ae),vM=function(e){function n(t,r,i,s){return e.call(this,t,r,i,s)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new _M(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(mM),o=s.bannedUsers,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(rc||(rc={}));var gM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var yM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var EM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(o),r}return T(n,e),n}(Y),bM=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.isMuted=!1,i.startAt=0,i.endAt=0;var s=r.is_muted,o=r.start_at,a=r.end_at,l=r.remaining_duration,u=r.description;return i.isMuted=s,i.startAt=o,i.endAt=a,i.remainingDuration=l,i.description=u,i}return T(n,e),n}(ae),V1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:o,include_ts:!0},r}return T(n,e),n}(Y),q1=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,o=r.ts;return i.metadata=s,i.ts=o,i}return T(n,e),n}(ae),CM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0},r}return T(n,e),n}(Y),SM=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t,r)||this).metaData=(i=r.metadata)!==null&&i!==void 0?i:{},o.ts=(s=r.ts)!==null&&s!==void 0?s:null,o}return T(n,e),n}(ae),TM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata,a=t.upsert;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0,upsert:a!=null&&a},r}return T(n,e),n}(Y),wM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.metadata,o=r.ts;return i.metadata=s,i.ts=o,i}return T(n,e),n}(ae),NM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(mt),IM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(o),r.params={include_ts:!0},r}return T(n,e),n}(Y),AM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(ae),MM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return T(n,e),n}(Y),xM=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts;return i.ts=s,i}return T(n,e),n}(ae),W1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:o},r}return T(n,e),n}(Y),K1=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),OM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o},r}return T(n,e),n}(Y),kM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),Cp=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter,a=t.upsert,l=a!==void 0&&a,u=t.mode,c=u===void 0?"set":u;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o,upsert:l,mode:c},r}return T(n,e),n}(Y),Sp=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(ae),RM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return i.data&&(s.created=i.data.created,s.updated=i.data.updated,s.deleted=i.data.deleted),s}return T(n,e),n}(mt),LM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(o),r.params={},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var DM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var UM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.seconds,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={user_id:o,seconds:a,description:l},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var PM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),FM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var HM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),jM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId,a=t.seconds,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=Ee({user_id:o,seconds:a,description:l}),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var BM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),i.data.member_count&&(s.memberCount=i.data.member_count),i.data.joined_member_count&&(s.joinedMemberCount=i.data.joined_member_count),s}return T(n,e),n}(mt),$M=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var GM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ua(t,i.data),s}return T(n,e),n}(mt),Q1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.freezing;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:o},r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var zM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.freeze=i.data.freeze,s}return T(n,e),n}(mt),VM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(lC(s),"/").concat(encodeURIComponent(i)),r.params={report_category:o,reporting_user_id:a,report_description:l},r}return T(n,e),n}(Y),qM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.offendingUserId,u=t.description;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(K_,"/users/").concat(l),r.params={channel_url:i,channel_type:s===Ze.OPEN?"open_channels":"group_channels",report_category:o,reporting_user_id:a,report_description:u},r}return T(n,e),n}(Y),WM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.category,a=t.userId,l=t.offendingUserId,u=t.messageId,c=t.description,d=t.messageToken;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(lC(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=Ee({report_category:o,reporting_user_id:a,report_description:c,offending_user_id:l,mesg_token:d}),r}return T(n,e),n}(Y),KM=function(e){function n(t){var r=[];return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MESG",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Qi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions,silent:t.silent,reply_to_channel:t.isReplyToChannel,parent_message_id:t.parentMessageId?t.parentMessageId:null,req_id:t.reqId,poll_id:t.pollId,pin_message:t.isPinnedMessage,extended_message_payload:t.extendedMessagePayload}))})||this}return T(n,e),n}(wr),dS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new Jn(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),Y1=function(e){function n(t){var r=null;return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"MEDI",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,msg_id:t.messageId,message:t.message,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,mentioned_message_template:t.mentionedMessageTemplate,apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return T(n,e),n}(wr),am=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"MEDI",i)||this).message=new Jn(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),Z1=function(e){function n(t){var r=null;return t.mentionType===nr.USERS&&(t.mentionedUserIds?r=t.mentionedUserIds:t.mentionedUsers&&(r=t.mentionedUsers.map(function(i){return i.userId}))),e.call(this,{code:"FEDI",ackRequired:!0,payload:Ee(Ne({channel_url:t.channelUrl,msg_id:t.messageId,data:t.data,custom_type:t.customType,metaarray:t.metaArrayParams,mention_type:t.mentionType,mentioned_user_ids:r,apple_critical_alert_options:t.appleCriticalAlertOptions}))})||this}return T(n,e),n}(wr),lm=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"FEDI",i)||this).message=new Zt(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),QM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.reactionKey,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(Y),YM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Yv(r),i}return T(n,e),n}(ae),ZM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.reactionKey,a=e.call(this)||this;return a.method=Q.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(Y),XM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Yv(M({},r)),i}return T(n,e),n}(ae),JM=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=t.translationTargetLanguages,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(encodeURIComponent(s),"/translation"),a.params={target_langs:o},a}return T(n,e),n}(Y),ex=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}return T(n,e),n}(ae),tx=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(l){return l.userId})));var o=t.channelType,a=t.channelUrl;return i.method=Q.POST,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages"),i.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(l){return pr.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Y),hS=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}return T(n,e),n}(ae),nx=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(u){return u.userId})));var a=t.channelType,l=t.channelUrl;return s.method=Q.POST,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(u){return Vs.payloadify(u)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:o,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(u){return pr.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return T(n,e),n}(Y),rx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Zt(t,r),i}return T(n,e),n}(ae),ix=function(e){function n(t){var r=t.pollId,i=t.title,s=t.data,o=t.allowUserSuggestion,a=t.allowMultipleVotes,l=t.closeAt,u=e.call(this)||this;return u.method=Q.PUT,u.path="".concat(Yi,"/").concat(encodeURIComponent(r)),u.params={title:i,data:s,allow_user_suggestion:o,allow_multiple_votes:a,close_at:l},u}return T(n,e),n}(Y),sx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),ox=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Yi,"/").concat(encodeURIComponent(r)),i}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var ax=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Q.PUT,i.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/close"),i}return T(n,e),n}(Y),lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),ux=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=t.optionText,a=e.call(this)||this;return a.method=Q.POST,a.path="".concat(Yi,"/").concat(encodeURIComponent(s),"/options"),a.params={channel_url:r,channel_type:i,text:o},a}return T(n,e),n}(Y),cx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),dx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),o.params={text:s},o}return T(n,e),n}(Y),hx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new Oi(t,r),i}return T(n,e),n}(ae),fx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Yi,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var px=function(e){function n(t){var r=t.reqId,i=t.channelType,s=t.channelUrl,o=t.pollId,a=t.pollOptionIds;return e.call(this,{code:"VOTE",ackRequired:!0,payload:Ee({req_id:r,channel_type:i===Ze.OPEN?"open_channels":"group_channels",channel_url:s,poll_id:o,option_ids:a})})||this}return T(n,e),n}(wr),fS=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new I6(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(mt),pS=100,_S="GroupChannel",_x="url",mS=100,um="Message",mx="messageId",vS="NotificationMessage",vx="notificationId",gx="Poll",yx="pollId",Ex="FeedChannel",bx="url";function Cx(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ne(M(M({},e),{isReplyToChannel:!1,mentionedUserIds:(t=e.mentionedUserIds)!==null&&t!==void 0?t:(r=e.mentionedUsers)===null||r===void 0?void 0:r.map(function(i){return i.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,isPinnedMessage:!1,fileInfoList:e.fileInfoList.map(function(i){var s;return{fileUrl:i.plainUrl,fileName:i.fileName,fileSize:i.fileSize,mimeType:i.mimeType,thumbnailSizes:(s=i.thumbnails)===null||s===void 0?void 0:s.map(function(o){return{maxWidth:o.width,maxHeight:o.height}}),_thumbnails:i.thumbnails,_uploadedMetaData:{requireAuth:i._requireAuth,isUploaded:!0}}})}))}var Yn,Sx=M(M({},o0),{fileInfoList:[]}),Tx=function(e){return(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},dh=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t._onFileUploaded=qe,t}return T(n,e),n.prototype._triggerOnFileUploaded=function(t,r,i,s){this._onFileUploaded(t,r,i,s)},n.prototype.onFileUploaded=function(t){return this._onFileUploaded=t,this},n.prototype.onPending=function(t){return e.prototype.onPending.call(this,t),this},n.prototype.onFailed=function(t){return e.prototype.onFailed.call(this,t),this},n.prototype.onSucceeded=function(t){return e.prototype.onSucceeded.call(this,t),this},n}(Br),wx=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(Yn||(Yn={}));var St,X1=function(e){function n(t,r){var i,s,o,a,l,u,c=this;return(c=e.call(this,t)||this)._name="",c._createdAt=0,c.channelType=Ze.BASE,c.coverUrl="",c.customType="",c.data="",c.isFrozen=!1,c.isEphemeral=!1,c.creator=null,c._messageCollectionLastAccessedAt=0,c._url=r.channel_url,c._name=(i=r.name)!==null&&i!==void 0?i:"",c._createdAt=1e3*r.created_at,c.coverUrl=(s=r.cover_url)!==null&&s!==void 0?s:"",c.customType=(o=r.custom_type)!==null&&o!==void 0?o:"",c.data=(a=r.data)!==null&&a!==void 0?a:"",c.isFrozen=(l=r.freeze)!==null&&l!==void 0&&l,c.isEphemeral=(u=r.is_ephemeral)!==null&&u!==void 0&&u,c.creator=r.created_by?new Ke(c._iid,r.created_by):null,r.metadata&&Object.keys(r.metadata).length>0&&r.ts&&(c._cachedMetaData=new Map,Object.keys(r.metadata).forEach(function(d){c._cachedMetaData.set(d,{value:r.metadata[d],isRemoved:!1,updatedAt:r.ts})})),c}return T(n,e),Object.defineProperty(n.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"createdAt",{get:function(){return this._createdAt},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return M(M({},this),{url:this._url,name:this._name,createdAt:this._createdAt})},n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{channel_url:t.url,name:t.name,cover_url:t.coverUrl,custom_type:t.customType,data:t.data,freeze:t.isFrozen,is_ephemeral:t.isEphemeral,created_by:t.creator?Ke.payloadify(t.creator):null,created_at:t.createdAt/1e3})))},n.prototype.isGroupChannel=function(){return this.channelType===Ze.GROUP},n.prototype.isOpenChannel=function(){return this.channelType===Ze.OPEN},n.prototype.isFeedChannel=function(){return this.channelType===Ze.FEED},Object.defineProperty(n.prototype,"cachedMetaData",{get:function(){var t={};return this._cachedMetaData&&this._cachedMetaData.forEach(function(r,i){r.isRemoved||(t[i]=r.value)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"messageCollectionLastAccessedAt",{get:function(){return this._messageCollectionLastAccessedAt},enumerable:!1,configurable:!0}),n.prototype._updateMessageCollectionLastAccessedAt=function(){this._messageCollectionLastAccessedAt=Date.now()},n.prototype._update=function(t){var r=Ee(t);Object.assign(this,r)},n.prototype._upsertCachedMetaData=function(t,r){var i=this;Object.keys(t).forEach(function(s){i._cachedMetaData||(i._cachedMetaData=new Map);var o=i._cachedMetaData.get(s);(!o||o.updatedAt<=r)&&i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})})},n.prototype._updateCachedMetaData=function(t,r){var i=this;this._cachedMetaData?this._cachedMetaData.forEach(function(s,o){var a;s.updatedAt<=r&&i._cachedMetaData.set(o,{value:(a=t[o])!==null&&a!==void 0?a:s.value,isRemoved:!t[o],updatedAt:r})}):(this._cachedMetaData=new Map,Object.keys(t).forEach(function(s){i._cachedMetaData.set(s,{value:t[s],isRemoved:!1,updatedAt:r})}))},n.prototype._removeFromCachedMetaData=function(t,r){var i=this;this._cachedMetaData&&t.forEach(function(s){var o=i._cachedMetaData.get(s);o&&o.updatedAt0&&We("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new JM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(ex).message]}})})},n.prototype._createScheduledUserMessage=function(t,r){var i=this,s=O.of(this._iid).requestQueue,o=Date.now(),a=this._generateRequestId();Or(2).then(function(){var u=i._createPendingScheduledUserMessage(t,a,o);De(function(){return y(i,void 0,void 0,function(){return g(this,function(c){return[2,r._trigger(u)]})})})});var l=new tx(M({reqId:a,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(hS).message;De(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(Lr(u))throw u;Or(2).then(function(){var c=i._createPendingScheduledUserMessage(t,a,o);i._markMessageAsFailed(c,u),De(function(){return y(i,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},G1),t);return K(z1(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},Sx),t),s=O.of(this._iid);K(function(a,l){return l===void 0&&(l=s6),a0(a)&&Array.isArray(a.fileInfoList)&&a.fileInfoList.length>=2&&a.fileInfoList.length<=l&&a.fileInfoList.every(function(u){return Tx(u)})}(i,(r=s.appInfo)===null||r===void 0?void 0:r.multipleFilesMessageFileCountLimit)).throw(L.invalidParameters);var o=!!t.fileInfoList.find(function(a){var l=s.appInfo.uploadSizeLimit;return a.file instanceof Blob&&a.file.size>l||a.fileSize>l});return K(!o).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=Yn.SEND);var o=O.of(this._iid).dispatcher,a=An.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new Br;return Or(2).then(function(){var d=s._createPendingFileMessage(t,l,u);o.dispatch(new Et({messages:[d],source:r===Yn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t).then(function(h){o.dispatch(new Et({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(Lr(h))throw h;Or(2).then(function(){var f=s._createPendingFileMessage(t,l,u),p=O.of(s._iid).cacheContext,m=p.localCacheEnabled&&p.localCacheConfig.enableAutoResend&&Wh(h.code);s._markMessageAsFailed(f,h,m),o.dispatch(new Et({messages:[f],source:f.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:h.code===Ie.FILE_UPLOAD_CANCEL_FAILED?G.LOCAL_MESSAGE_CANCELED:G.EVENT_MESSAGE_SENT_FAILED})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){K(t instanceof Zt&&!!t.messageParams).throw(L.invalidParameters);var r=O.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,Yn.SEND,t.reqId).onFailed(function(i){r.debug("autoResendFileMessage failed",i)}).onSucceeded(function(i){r.debug("autoResendFileMessage success",i)})},n.prototype._sendMultipleFilesMessage=function(t,r,i){var s=this,o=O.of(this._iid).dispatcher,a=An.of(this._iid).fileMessageQueue,l=i??this._generateRequestId(),u=Date.now(),c=new dh;return Or(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);o.dispatch(new Et({messages:[d],source:r===Yn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t,{requestHandler:c,isCopy:r===Yn.COPY}).then(function(h){o.dispatch(new Et({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(f){return[2,c._trigger(h)]})})})}).catch(function(h){if(Lr(h))throw h;Or(2).then(function(){var f=s._createPendingMultipleFilesMessage(t,l,u);s._markMessageAsFailed(f,h),o.dispatch(new Et({messages:[f],source:G.EVENT_MESSAGE_SENT_FAILED})),De(function(){return y(s,void 0,void 0,function(){return g(this,function(p){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._createScheduledFileMessage=function(t,r,i,s){var o=this,a=O.of(this._iid).requestQueue,l=new nx(M(M({reqId:i,channelType:this.channelType,channelUrl:this.url},t),{fileUrl:t.fileUrl,requireAuth:t.requireAuth}));a.send(l).then(function(u){var c=u.as(rx).message;De(function(){return y(o,void 0,void 0,function(){return g(this,function(d){return[2,r._trigger(c)]})})})}).catch(function(u){if(Lr(u))throw u;Or(2).then(function(){var c=o._createPendingScheduledFileMessage(t,i,s);o._markMessageAsFailed(c,u),De(function(){return y(o,void 0,void 0,function(){return g(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;K(t.every(function(u){return z1(M(M({},G1),u))})).throw(L.invalidParameters);var s=new Br;try{for(var o=ve(t),a=o.next();!a.done;a=o.next()){var l=a.value;this.sendFileMessage(l).onPending(function(u){return s._trigger(u)}).onFailed(function(u,c){return s._triggerFailed(u,c)}).onSucceeded(function(u){return s._trigger(u)})}}catch(u){r={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s},n.prototype.resendFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){return i=this._validateFailedFileMessageHasFile(t,r),K(t instanceof Zt&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Tr,o=om(t,r),this._sendFileMessage(o,Yn.RESEND,t.reqId).onFailed(function(l){return s.reject(l)}).onSucceeded(function(l){return s.resolve(l)}),[2,s.promise]})})},n.prototype.resendMessage=function(t,r){var i,s;if(K(t instanceof Dt&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:sm(t);return this._sendUserMessage(o,Yn.RESEND,t.reqId)}if(t.isFileMessage()){var a=this._validateFailedFileMessageHasFile(t,r);return K(a).throw(L.invalidParameters),o=(s=t.messageParams)!==null&&s!==void 0?s:om(t,r),this._sendFileMessage(o,Yn.RESEND,t.reqId)}if(t.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=M(M({},aM),r),K(k("number",t)&&function(u){return Xv(u)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new Z1(M({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:i.metaArrays?{array:i.metaArrays,mode:"add",upsert:!0}:void 0},i)),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(lm).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return r=O.of(this._iid).requestQueue,i=$s(),(s=new rf({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:i})).uploadProgressHandler=t.progressHandler,t.uploadStartedHandler&&t.uploadStartedHandler(i),[4,r.send(s)];case 1:return o=c.sent(),a=o.as(sf),l=a.url,u=a.thumbnails,[2,{requestId:i,url:l,thumbnails:u}]}})})},n.prototype.cancelUploadingFileMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),An.of(this._iid).fileMessageQueue.cancel(this,t),[2,!0]})})},n.prototype.copyFileMessage=function(t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l;return g(this,function(u){return K(t instanceof n&&r instanceof Zt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),a=new Tr,l=Ne(M(M({},r),{fileUrl:r.url,fileName:r.name,fileSize:r.size,mimeType:r.type,mentionType:r.mentionType,mentionedUserIds:(i=r.mentionedUserIds)!==null&&i!==void 0?i:(s=r.mentionedUsers)===null||s===void 0?void 0:s.map(function(c){return c.userId}),pushNotificationDeliveryOption:Qi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,thumbnailSizes:(o=r.thumbnails)===null||o===void 0?void 0:o.map(function(c){return{maxWidth:c.width,maxHeight:c.height}}),requireAuth:r.requireAuth,isPinnedMessage:!1})),t._sendFileMessage(l).onSucceeded(function(c){return a.resolve(c)}).onFailed(function(c){return a.reject(c)}),[2,a.promise]})})},n.prototype.copyMessage=function(t,r){K(t instanceof n&&r instanceof Dt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){K(!i.poll).throw(L.notSupportedError);var o=oS(i);return s._sendUserMessage(o)}if(i.isFileMessage())return o=lS(i),s._sendFileMessage(o);if(r.isMultipleFilesMessage())throw L.channelTypeNotSupportedError},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return K(t instanceof dr).throw(L.invalidParameters),t.messageId>0?(r=O.of(this._iid).requestQueue,i=new dC({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Dt?t._messageToken:void 0}),[4,r.send(i)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.addReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(t instanceof dr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new QM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(YM).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(t instanceof dr&&t.messageId>0&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ZM({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(XM).reactionEvent]}})})},n.prototype._updateUserMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new Y1({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(am).message,a.dispatch(new Et({messages:[d],source:G.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype._updateFileMessageMetaArray=function(t,r,i,s){return y(this,void 0,void 0,function(){var o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new Z1({channelType:this.channelType,channelUrl:this.url,messageId:t,metaArrayParams:{array:r,mode:i,upsert:s}}),[4,l.send(u)];case 1:return c=h.sent(),d=c.as(lm).message,a.dispatch(new Et({messages:[d],source:G.EVENT_MESSAGE_UPDATED})),[2,d]}})})},n.prototype.createMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return K(t instanceof dr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new pr({key:o})}),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,i,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"add",!0)]})})},n.prototype.deleteMessageMetaArrayKeys=function(t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){return K(t instanceof dr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new pr({key:o})}),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,i,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,i,"remove",!0)]})})},n.prototype.addMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return K(t instanceof dr&&t.messageId>0&&r.every(function(s){return s instanceof pr})).throw(L.invalidParameters),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,r,"add",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"add",!0)]})})},n.prototype.removeMessageMetaArrayValues=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return K(t instanceof dr&&t.messageId>0&&r.every(function(s){return s instanceof pr})).throw(L.invalidParameters),t instanceof Zt?[2,this._updateFileMessageMetaArray(t.messageId,r,"remove",!0)]:[2,this._updateUserMessageMetaArray(t.messageId,r,"remove",!0)]})})},n.prototype.report=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(Ge(rc,t)&&k("string",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new VM({channelUrl:this.url,channelType:this.channelType,userId:s.userId,category:t,description:r}),[4,o.send(a)];case 1:return l.sent(),[2]}})})},n.prototype.reportUser=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(t instanceof Ke&&Ge(rc,r)&&k("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new qM({channelUrl:this.url,channelType:this.channelType,userId:o.userId,offendingUserId:t.userId,category:r,description:i}),[4,a.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.reportMessage=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(t instanceof Dt&&Ge(rc,r)&&k("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new WM({channelUrl:this.url,channelType:this.channelType,userId:o.userId,offendingUserId:t.sender.userId,messageId:t.messageId,category:r,description:i,messageToken:t._messageToken}),[4,a.send(l)];case 1:return u.sent(),[2]}})})},n.prototype.updatePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("number",t)&&function(l){return k("string",l.title,!0)&&VC(l.data)&&k("boolean",l.allowUserSuggestion,!0)&&k("boolean",l.allowMultipleVotes,!0)&&k("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ix(M({pollId:t},r)),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(sx).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=k("number",t),K(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ox({pollId:t}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},n.prototype.closePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=k("number",t),K(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ax({pollId:t}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(lx).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=k("number",t)&&k("string",r)&&r.trim()!=="",K(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ux({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(cx).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return s=k("number",t)&&k("number",r)&&k("string",i)&&i.trim()!=="",K(s).throw(L.invalidParameters),o=O.of(this._iid).requestQueue,a=new dx({pollId:t,pollOptionId:r,optionText:i}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(hx).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return i=k("number",t)&&k("number",r),K(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new fx({pollId:t,pollOptionId:r}),[4,s.send(o)];case 1:return a.sent(),[2]}})})},n.prototype.votePoll=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return i=k("number",t)&&We("number",r),K(i).throw(L.invalidParameters),s=O.of(this._iid),o=s.requestQueue,a=s.dispatcher,l=new px({reqId:this._generateRequestId(),channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionIds:r}),[4,o.send(l)];case 1:return u=d.sent(),c=u.as(fS).event,a.dispatch(new Qv({event:c,source:G.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("number",t)).throw(L.invalidParameters),[4,nf.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.getPollChangeLogsSinceToken=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("string",t,!0)),[4,nf.of(this._iid).getPollChangeLogs(this.url,this.channelType,t)];case 1:return[2,r.sent()]}})})},n.prototype.createPollListQuery=function(t){return t===void 0&&(t=10),new QC(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new YC(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Wn),gS=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onConnected=qe,this.onReconnectStarted=qe,this.onReconnectSucceeded=qe,this.onReconnectFailed=qe,this.onDisconnected=qe}),J1=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onSessionExpired=qe,this.onSessionTokenRequired=function(e){return e(null)},this.onSessionError=qe,this.onSessionRefreshed=qe,this.onSessionClosed=qe}),Nx=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(){this.onFriendsDiscovered=qe,this.onTotalUnreadMessageCountChanged=qe,this.onTotalUnreadMessageCountUpdated=qe}),Ix=function(e){function n(t){var r=t.limit,i=t.token,s=t.userIdsFilter,o=t.metaDataKeyFilter,a=t.metaDataValuesFilter,l=t.nicknameStartsWithFilter,u=e.call(this)||this;return u.method=Q.GET,u.path=Xe,u.params=Ee({limit:r,token:i,user_ids:s,metadatakey:o,metadatavalues_in:a,nickname_startswith:l}),u}return T(n,e),n}(Y),Ax=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),Mx=function(e){function n(t,r){var i,s,o,a=this;return(a=e.call(this,t,r)||this).userIdsFilter=null,a.metaDataKeyFilter=null,a.metaDataValuesFilter=null,a.nicknameStartsWithFilter=null,a.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,a.metaDataKeyFilter=(s=r.metaDataKeyFilter)!==null&&s!==void 0?s:null,a.metaDataValuesFilter=(o=r.metaDataValuesFilter)!==null&&o!==void 0?o:null,a.nicknameStartsWithFilter=r.nicknameStartsWithFilter||null,a}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&We("string",this.userIdsFilter,!0)&&k("string",this.metaDataKeyFilter,!0)&&We("string",this.metaDataValuesFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new Ix(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Ax),o=s.users,a=s.next,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),xx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=t.userIdsFilter,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(r,"/block"),a.params=Ee({limit:i,token:s,user_ids:o}),a}return T(n,e),n}(Y),Ox=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),kx=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).userIdsFilter=null,s.userIdsFilter=(i=r.userIdsFilter)!==null&&i!==void 0?i:null,s}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&We("string",this.userIdsFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new xx(Ne(M(M({},this),{userId:r.userId,token:this._token}))),[4,i.send(s)]):[3,2]:[3,5];case 1:return o=c.sent(),a=o.as(Ox),l=a.users,u=a.next,this._token=u,this._hasNext=!!u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),Rx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),o.params={limit:i,token:s},o}return T(n,e),n}(Y),Lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.hasMore=r.has_more,i.users=r.users.map(function(s){return new Ke(t,s)}),i.next=r.next,i}return T(n,e),n}(ae),Dx=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Rx(M(M({},this),{userId:r.userId,token:this._token})),[4,i.send(s)]):[3,2]:[3,5];case 1:return o=d.sent(),a=o.as(Lx),l=a.users,u=a.hasMore,c=a.next,this._token=c,this._hasNext=u,this._isLoading=!1,[2,l];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),Ld={},Yc=function(){function e(n){var t=n.dbname,r=n.itemSizeLimit,i=r===void 0?1048576:r,s=n.cacheLimit,o=s===void 0?256:s,a=n.blockHashBase,l=a===void 0?2:a,u=n.blockHashMultiplier,c=u===void 0?10:u,d=n.blockHashConstant,h=d===void 0?11:d,f=n.transactionApplyDelay,p=f===void 0?200:f,m=n.disableLogger,b=m!==void 0&&m;return Ld[t]||(this.itemSizeLimit=i,this.cacheLimit=o,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,Ld[t]=this),Ld[t]}return e.get=function(n){return Ld[n]},e}();(function(e){e[e.UNKNOWN_ERROR=6e7]="UNKNOWN_ERROR",e[e.STORE_NOT_DEFINED=61001e3]="STORE_NOT_DEFINED",e[e.STORE_NOT_AVAILABLE=61001001]="STORE_NOT_AVAILABLE",e[e.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING=61001002]="STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING",e[e.STORE_IS_FULL=61001003]="STORE_IS_FULL",e[e.STORE_NOT_INITIALIZED=61001004]="STORE_NOT_INITIALIZED",e[e.STORE_INVALID_KEY_TYPE=61002e3]="STORE_INVALID_KEY_TYPE",e[e.STORE_BROKEN_INTEGRITY=61002001]="STORE_BROKEN_INTEGRITY",e[e.STORE_BROKEN_BLOB=61002002]="STORE_BROKEN_BLOB",e[e.STORE_ENCRYPTION_INVALID=61002003]="STORE_ENCRYPTION_INVALID",e[e.STORE_ITEM_SIZE_LIMIT_EXCEEDED=61017e3]="STORE_ITEM_SIZE_LIMIT_EXCEEDED",e[e.STORE_READ_FAILED=61017001]="STORE_READ_FAILED",e[e.STORE_WRITE_FAILED=61017002]="STORE_WRITE_FAILED",e[e.DATABASE_SCHEMA_NOT_ON_UPGRADE=62002e3]="DATABASE_SCHEMA_NOT_ON_UPGRADE",e[e.COLLECTION_NOT_READY=63001e3]="COLLECTION_NOT_READY",e[e.COLLECTION_KEY_NOT_MATCH=63002e3]="COLLECTION_KEY_NOT_MATCH",e[e.COLLECTION_QUERY_NOT_VALID=63002001]="COLLECTION_QUERY_NOT_VALID",e[e.COLLECTION_KEY_NOT_FOUND=63004e3]="COLLECTION_KEY_NOT_FOUND",e[e.COLLECTION_KEY_NOT_GIVEN=63004001]="COLLECTION_KEY_NOT_GIVEN",e[e.COLLECTION_INSERT_DUPLICATE=63009e3]="COLLECTION_INSERT_DUPLICATE",e[e.COLLECTION_WRITE_FAILED=63017e3]="COLLECTION_WRITE_FAILED",e[e.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED=63017001]="COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED",e[e.INDEX_TABLE_IS_REQUIRED=65001e3]="INDEX_TABLE_IS_REQUIRED",e[e.INDEX_TYPE_NOT_MATCH=65002e3]="INDEX_TYPE_NOT_MATCH",e[e.COMPARE_TYPE_NOT_MATCH=69002001]="COMPARE_TYPE_NOT_MATCH",e[e.CIRCULAR_REFERENCE_FOUND=69002002]="CIRCULAR_REFERENCE_FOUND"})(St||(St={}));var aa,it=function(e){function n(t){var r=t.code,i=r===void 0?St.UNKNOWN_ERROR:r,s=t.message,o=s===void 0?"Unknown error occurred.":s,a=e.call(this,o)||this;return a.code=i,Object.setPrototypeOf(a,n.prototype),a}return T(n,e),Object.defineProperty(n,"storeNotDefined",{get:function(){return new n({code:St.STORE_NOT_DEFINED,message:"Store is not defined. Specify the store on NestDB()"})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailable",{get:function(){return new n({code:St.STORE_NOT_AVAILABLE,message:"Store is not available. Check your environment settings."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotAvailableInPrivateBrowsing",{get:function(){return new n({code:St.STORE_NOT_AVAILABLE_IN_PRIVATE_BROWSING,message:"Store is not available because it is in private browsing."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeIsFull",{get:function(){return new n({code:St.STORE_IS_FULL,message:"Store is full."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeNotInitialized",{get:function(){return new n({code:St.STORE_NOT_INITIALIZED,message:"Store is not initialized."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeKeyTypeIsInvalid",{get:function(){return new n({code:St.STORE_INVALID_KEY_TYPE,message:"Store key should be string type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenIntegrity",{get:function(){return new n({code:St.STORE_BROKEN_INTEGRITY,message:"Data should be in a store but it does not. Integrity is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeBrokenBlob",{get:function(){return new n({code:St.STORE_BROKEN_BLOB,message:"Data should be in a store but it does not. Blob data is broken."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeEncryptionInvalid",{get:function(){return new n({code:St.STORE_ENCRYPTION_INVALID,message:"Encryption algorithm has changed. All the store should reset."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeItemSizeExceeded",{get:function(){return new n({code:St.STORE_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that the store allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeReadFailed",{get:function(){return new n({code:St.STORE_READ_FAILED,message:"Failed to read from store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"storeWriteFailed",{get:function(){return new n({code:St.STORE_WRITE_FAILED,message:"Failed to write to store."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"databaseSchemaNotOnUpgrade",{get:function(){return new n({code:St.DATABASE_SCHEMA_NOT_ON_UPGRADE,message:"Committing schema is not allowed when upgrade is not running."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionNotReady",{get:function(){return new n({code:St.COLLECTION_NOT_READY,message:"Collection is not ready due to an error during initialization."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotMatch",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_MATCH,message:"keyName of collection could not change."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionQueryNotValid",{get:function(){return new n({code:St.COLLECTION_QUERY_NOT_VALID,message:"Query parameter is not a valid format."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionInsertDuplicate",{get:function(){return new n({code:St.COLLECTION_INSERT_DUPLICATE,message:"The key already exists."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotFound",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_FOUND,message:"The key is not found."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionKeyNotGiven",{get:function(){return new n({code:St.COLLECTION_KEY_NOT_GIVEN,message:"The item should contain [keyName] property."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionWriteFailed",{get:function(){return new n({code:St.COLLECTION_WRITE_FAILED,message:"Failed to write an item."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"collectionItemSizeExceeded",{get:function(){return new n({code:St.COLLECTION_ITEM_SIZE_LIMIT_EXCEEDED,message:"The size of the item exceeds the limit that a collection allows."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTableIsRequired",{get:function(){return new n({code:St.INDEX_TABLE_IS_REQUIRED,message:"Index table is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"indexTypesNotMatch",{get:function(){return new n({code:St.INDEX_TYPE_NOT_MATCH,message:"Indexed column should have primitive type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"compareTypesNotMatch",{get:function(){return new n({code:St.COMPARE_TYPE_NOT_MATCH,message:"Values to compare have different types."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularReferenceFound",{get:function(){return new n({code:St.CIRCULAR_REFERENCE_FOUND,message:"Cannot handle circular referenced object."})},enumerable:!1,configurable:!0}),n}(Error);(function(e){e.INIT="init",e.READY="ready",e.CLOSED="closed"})(aa||(aa={}));var ey,kr=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw it.circularReferenceFound;n.set(e,!0);var t=void 0;if(Array.isArray(e))t=e.map(function(i){return kr(i,n)});else if(e instanceof RegExp)t=e;else if(e instanceof Date)t=e;else for(var r in t={},e)t[r]=kr(e[r],n);return n.delete(e),t}return e},Ls=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw it.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},ty=function(e,n){for(var t=0,r=0;r>>0)%n},Dd=function(e){return new Promise(function(n){setTimeout(function(){return n()},e)})},ma=function(e,n){if(!n)return!1;if(typeof e!="function"){for(var t in e)if(["/and","&&"].includes(t)){if(e[t].some(function(l){return!ma(l,n)}))return!1}else if(["/or","||"].includes(t)){if(e[t].every(function(l){return!ma(l,n)}))return!1}else if(t==="/where"){if(!(0,e[t])(n))return!1}else{var r=t;if(typeof e[r]=="object"){var i=e[r];for(var s in i)switch(s){case"/eq":case"=":if((o=n[r])!==(a=i[s]))return!1;break;case"/neq":case"!=":if((o=n[r])===(a=i[s]))return!1;break;case"/gt":case">":var o=n[r],a=i[s];if(!(Ls(o,a)>0))return!1;break;case"/gte":case">=":if(o=n[r],a=i[s],!(Ls(o,a)>=0))return!1;break;case"/lt":case"<":if(o=n[r],a=i[s],!(Ls(o,a)<0))return!1;break;case"/lte":case"<=":if(o=n[r],a=i[s],!(Ls(o,a)<=0))return!1;break;case"/in":if(o=n[r],!(a=i[s]).includes(o))return!1;break;case"/nin":if(o=n[r],(a=i[s]).includes(o))return!1;break;case"/contain":if(o=n[r],a=i[s],!o.includes(a))return!1;break;case"/regex":if(o=n[r],!(a=i[s]).test(o))return!1;break;case"/where":if(o=n[r],!(0,i[s])(o))return!1}}else if(typeof e[r]=="function"){if(!e[r](n[r]))return!1}else if(e[r]!==n[r])return!1}return!0}return e(n)},Au=function(){},ny=function(){return Promise.resolve()},Ux=function(e){return e},ry=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(ey||(ey={}));var va,hr,rs,Px=function(){function e(n){var t=n.initialPrevValue,r=t===void 0?null:t,i=n.initialNextValue,s=i===void 0?null:i,o=n.iterator,a=n.map,l=a===void 0?Ux:a,u=n.backward,c=u===void 0?ny:u,d=n.forward,h=d===void 0?ny:d,f=n.complete,p=f===void 0?Au:f;this._prevValue=r,this._nextValue=s,this._error=null,this._map=l,this._backward=c,this._forward=h,this._iterator=o,this._complete=p}return Object.defineProperty(e.prototype,"prevValue",{get:function(){return this._map(this._prevValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextValue",{get:function(){return this._map(this._nextValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return!!this._prevValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return!!this._nextValue},enumerable:!1,configurable:!0}),e.prototype.prev=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasPrevious)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._prevValue,t=this,[4,this._backward()];case 2:return t._prevValue=i.sent()||null,this._nextValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.next=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:if(!this.hasNext)return[3,6];i.label=1;case 1:return i.trys.push([1,3,,4]),n=this._nextValue,t=this,[4,this._forward()];case 2:return t._nextValue=i.sent()||null,this._prevValue=n,[3,4];case 3:return r=i.sent(),this._error=r,[3,4];case 4:return[4,this._iterator(this)];case 5:return[2,i.sent()];case 6:this._complete(),i.label=7;case 7:return[2]}})})},e.prototype.stop=function(){this._prevValue=null,this._nextValue=null,this._complete()},e}(),cm=function(){function e(n){var t=n.condition,r=t===void 0?{}:t,i=n.backward,s=i!==void 0&&i,o=n.blockManager,a=n.indexer;this.condition=r,this.backward=s,this._blockManager=o,this._indexer=a}return e.prototype.findOptimizedStartPosition=function(){var n=this,t=["=","/eq",">",">=","/gt","/gte"],r=["=","/eq","<","<=","/lt","/lte"];if(this.backward){var i=this._indexer.origin.length-1;if(typeof this.condition!="function")for(var s in this._indexer.fields){var o=this._indexer.fields[s],a=1;if(o[0]==="-"&&(o=o.slice(1),a=-1),this.condition[o]){if(typeof this.condition[o]=="object"){var l=a>0?r:t;for(var u in this.condition[o])if(l.includes(u)){for(var c=i;c>=0;c--)if(a*Ls(this._indexer.origin[c].columnValues[s],this.condition[o][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(a*Ls(this._indexer.origin[c].columnValues[s],this.condition[o])<=0){i=c;break}}}return Math.min(i+1,this._indexer.origin.length-1)}var d=0;if(typeof this.condition!="function")for(var h=function(m){var b=f._indexer.fields[m],v=1;if(b[0]==="-"&&(b=b.slice(1),v=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((v>0?t:r).includes(E)){for(var S=d;S=0){d=S;break}}});else for(var _=d;_=0){d=_;break}}},f=this,s=0;s"u"?[3,4]:[4,fetch(r)]):[3,5];case 2:return[4,d.sent().blob()];case 3:return[2,d.sent()];case 4:for(s=[],o=atob(r.split(",")[1]),a=0;a-1){var i=this._items[r];return t===rs.PERSISTENT&&(i.state=hr.PERSISTENT),t!==rs.NO_CACHE&&this.put(i),i}return null},e.prototype.put=function(n){var t,r;if(this._limit>0){var i=this._items.map(function(d){return d.key}).indexOf(n.key);if(i>-1)sy.includes(this._items[i].state)&&sy.includes(n.state)?(this._items.splice(i,1),this._items.push(n)):(this._items[i].state=n.state,this._items[i].value=n.value);else{this._items.push(n);var s=this._items.filter(function(d){return d.state===hr.VOLATILE}),o=s.length-this._limit;if(o>0){var a=[];try{for(var l=ve(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===hr.VOLATILE&&o>0?o--:a.push(c)}}catch(d){t={error:d}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}this._items=a}}}},e.prototype.remove=function(n){var t=this._items.map(function(r){return r.key}).indexOf(n);t>-1&&this._items.splice(t,1)},e.prototype.clearByCondition=function(n){this._items=this._items.filter(function(t){return!n(t)})},e.prototype.clear=function(n){n===void 0&&(n=!1),this._items=n?[]:this._items.filter(function(t){return t.state!==hr.VOLATILE})},e}(),jx=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.store;this._requests=[],this._onCommit=new Map,this._onWrite=new Map,this._onError=new Map,this.dbname=t,this.collectionName=r,this.metadataKey=function(s,o){return"".concat(Na(s,o),"/trans.metadata")}(t,r),this.recordsetKey=function(s,o){return"".concat(Na(s,o),"/trans.recordset")}(t,r),this._store=i}return Object.defineProperty(e.prototype,"generation",{get:function(){return this._metadata?this._metadata.generation:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestCount",{get:function(){return this._requests.length},enumerable:!1,configurable:!0}),e.prototype._getReducedRecordset=function(n){return n===void 0&&(n=[]),y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,Pe([],Ae(n),!1)),[2,this._reduceRecordSet(t)]}})})},e.prototype._reduceRecordSet=function(n){for(var t=[],r={},i=n.length-1;i>=0;i--){for(var s=n[i],o=[],a=s.requests.length-1;a>=0;a--){var l=s.requests[a],u=l.data;r[u.key]||(o.unshift(l),r[u.key]=!0)}o.length>0&&(s.requests=o,t.unshift(s))}return t},e.prototype._applyRecord=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:r=Ti.get(this.dbname),i=t.generation,s=t.requests,o=null,h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this._store.setMany(s.map(function(f){return M(M({},f.data),{generation:i})}))];case 2:for(a=h.sent(),l=0;l0))return[3,4];for(t=[],r={},l=n.length-1;l>=0;l--)i=n[l],c=i.data,r[c.key]||(r[c.key]=!0,t.unshift(i));return s={generation:this.generation,requests:t},[4,this._getReducedRecordset([s])];case 1:return o=p.sent(),[4,this._store.set({key:this.recordsetKey,value:o})];case 2:return p.sent(),this._metadata.generation++,[4,this._store.set({key:this.metadataKey,value:this._metadata})];case 3:for(p.sent(),a=Ti.get(this.dbname),l=0;l0?(i=this.createBlockId(n,r),[4,t.find(this._store,i)]):[3,4];case 2:if((s=a.sent())&&(o=hh.createFromCacheItem(s),o==null?void 0:o.getItemByKey(n)))return[2,o];a.label=3;case 3:return r--,[3,1];case 4:return[2,null]}})})},e.prototype.getFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return[2,(t=r.sent())?t.getItemByKey(n):null]}})})},e.prototype.putToBlock=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return r=Yc.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Ti.get(this.dbname).find(this._store,i)];case 1:return o=l.sent(),(a=o?hh.createFromCacheItem(o):new hh({blockId:i,keyName:this.keyName,items:[],limit:s}))!=null&&a.add(t)?(this._transaction.requestWrite({key:a.blockId,value:a.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.removeFromBlock=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._findBlock(n)];case 1:return(t=r.sent())&&t.remove(n)?(this._transaction.requestWrite({key:t.blockId,value:t.serialize()}),[2,!0]):[2,!1]}})})},e.prototype.clearAllBlocks=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=hm(this.dbname,this.collectionName),[4,this._store.getAllKeys()];case 1:return t=i.sent(),r=t.filter(function(s){return s.startsWith(n)}),[4,this._store.removeMany(r)];case 2:return i.sent(),[4,this._transaction.clear()];case 3:return i.sent(),Ti.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),qa={},Ks=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.fields,o=n.transaction,a=n.store,l=this;this._origin=[],this._table=[];var u=function(c,d,h){return"".concat(Na(c,d),"/index.").concat(h)}(t,r,s.join(">"));return qa[u]||(this.dbname=t,this.collectionName=r,this.keyName=i,this.fields=s,this.indexerKey=u,this._transaction=o,this._store=a,this._transaction.on(va.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(va.ERROR,this.indexerKey,function(){return l.abort()})),qa[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in qa)delete qa[n]},e.prototype._addItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Ae(this.indexOf(r),2),s=i[0];return i[1]?!this._table[s].keys.includes(t)&&(this._table[s].keys.push(t),!0):(this._table.splice(s,0,{columnValues:r,keys:[t]}),!0)},e.prototype._removeItem=function(n){var t=n[this.keyName],r=this.getColumnValues(n),i=Ae(this.indexOf(r),2),s=i[0];if(i[1]){var o=this._table[s].keys.indexOf(t);if(o>-1)return this._table[s].keys.splice(o,1),this._table[s].keys.length===0&&this._table.splice(s,1),!0}return!1},Object.defineProperty(e.prototype,"origin",{get:function(){return this._origin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"table",{get:function(){return this._table},enumerable:!1,configurable:!0}),e.prototype.getColumnValues=function(n){var t,r,i,s,o=[];try{for(var a=ve(this.fields),l=a.next();!l.done;l=a.next()){var u=l.value;if(u[0]==="-"&&(u=u.slice(1)),i=n[u],s=void 0,s=typeof i,i!==null&&s!=="undefined"&&s!=="boolean"&&s!=="number"&&s!=="string")throw it.indexTypesNotMatch;o.push(n[u])}}catch(c){t={error:c}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},e.prototype.diff=function(n,t){for(var r in this.fields){var i=this.fields[r][0]==="-"?-1:1,s=Ls(n[r],t[r]);if(s!==0)return i*s}return 0},e.prototype.indexOf=function(n){if(this._table.length>0){for(var t=0,r=this._table.length-1;t<=r;){var i=Math.floor((t+r)/2),s=this.diff(n,this._table[i].columnValues);if(s>0)t=i+1;else{if(!(s<0))return[i,!0];r=i-1}}return[t,!1]}return[0,!1]},e.prototype.ensure=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v;return g(this,function(_){switch(_.label){case 0:return[4,(n=Ti.get(this.dbname)).find(this._store,this.indexerKey,rs.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=hm(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=ve(i),o=s.next(),_.label=4;case 4:return o.done?[3,7]:(a=o.value).startsWith(r)?[4,n.find(this._store,a,rs.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=hh.createFromCacheItem(l))try{for(b=void 0,c=ve(u.items),d=c.next();!d.done;d=c.next())h=d.value,this._addItem(h)}catch(E){b={error:E}}finally{try{d&&!d.done&&(v=c.return)&&v.call(c)}finally{if(b)throw b.error}}_.label=6;case 6:return o=s.next(),[3,4];case 7:return[3,10];case 8:return f=_.sent(),p={error:f},[3,10];case 9:try{o&&!o.done&&(m=s.return)&&m.call(s)}finally{if(p)throw p.error}return[7];case 10:return this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[3,12];case 11:this._origin=t.value,this._table=kr(this._origin),_.label=12;case 12:return qa[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return Ti.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete qa[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._addItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.removeItem=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return this._removeItem(n)&&this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this._table=[],this._transaction.requestWrite({key:this.indexerKey,value:this._table},{persistent:!0}),[2]})})},e.prototype.commit=function(){this._origin=this._table,this._table=kr(this._origin)},e.prototype.abort=function(){this._table=kr(this._origin)},e}(),lf=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},oy=function(){var e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(n==="x"?t:3&t|8).toString(16)})};(function(e){e[e.PROCESSING=0]="PROCESSING",e[e.DONE=1]="DONE"})(ic||(ic={})),function(e){e.NEWNODE="newnode",e.REMOVENODE="removenode",e.CLAIM_HOST="claimhost",e.SYNC_HOST="synchost",e.REQUEST_LOCK="requestlock",e.ACQUIRE_LOCK="acquirelock",e.RELEASE_LOCK="releaselock"}(lr||(lr={}));var Hi,wp={},Jv=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=ic.PROCESSING,this._queue=[],this._activationQueue=[],wp[n]&&!t.forceCreate||(this.nodeId=oy(),this.key=n,lf()&&(t.startAsInvisible?this.registerNode():document.visibilityState==="visible"?this.claimHost():this.registerNode(),document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&r.claimHost()}),window.addEventListener("message",function(i){var s,o,a=i.data;if(a!=null&&a.isNestDbMessage){var l=a.nodeId,u=a.requestId,c=a.key,d=a.op,h=a.data;if(l!==r.nodeId&&c===r.key)switch(d){case lr.NEWNODE:r._sendSync();break;case lr.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case lr.SYNC_HOST:if(!r.isInSync){r._activationTimeout&&clearTimeout(r._activationTimeout);var f=h,p=f.currentItemRequestId,m=f.queue,b=function(S){var w=r._queue.findIndex(function(N){return N.requestId===S.requestId});w<0&&r._requestLock({isNestDbMessage:!0,nodeId:S.nodeId,requestId:S.requestId,key:r.key,op:lr.REQUEST_LOCK,ts:S.ts})};try{for(var v=ve(m),_=v.next();!_.done;_=v.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(o=v.return)&&o.call(v)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case lr.REMOVENODE:r._queue=r._queue.filter(function(S){return S.nodeId!==a.nodeId}),r._currentItem&&r._currentItem.nodeId===a.nodeId&&(r._currentItem=void 0,r._acquire(r._queue[0]));break;case lr.REQUEST_LOCK:r._requestLock(a);break;case lr.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case lr.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(lr.REMOVENODE)})),wp[n]=this),wp[n]}return Object.defineProperty(e.prototype,"locked",{get:function(){return!!this._currentItem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isHost",{get:function(){return this._hostId===this.nodeId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInSync",{get:function(){return this._state==ic.DONE},enumerable:!1,configurable:!0}),e.prototype._send=function(n,t){var r;t===void 0&&(t={});var i={isNestDbMessage:!0,nodeId:this.nodeId,requestId:(r=t==null?void 0:t.requestId)!==null&&r!==void 0?r:oy(),key:this.key,op:n,data:t.data,ts:Date.now()};return lf()&&window.postMessage(i,"*"),i},e.prototype._acquire=function(n){n?(this._currentItem=n,this._currentItem.onAcquired&&this._currentItem.onAcquired(n.requestId)):this._currentItem=void 0},e.prototype._release=function(n){if(this._currentItem&&this._currentItem.requestId===n){var t=this._currentItem;this._currentItem=void 0,t.nodeId===this.nodeId&&this._send(lr.RELEASE_LOCK,{requestId:t.requestId});var r=this._queue.findIndex(function(i){return i.requestId===n});r>-1&&this._queue.splice(r,1),t.onReleased&&t.onReleased(n)}},e.prototype._requestLock=function(n){var t=this;return new Promise(function(r){var i={nodeId:n.nodeId,requestId:n.requestId,ts:n.ts,onAcquired:function(a){t.isHost&&t._send(lr.ACQUIRE_LOCK,{requestId:a}),r()},onReleased:function(){t._acquire(t._queue[0])}},s=!1;for(var o in t._queue)if(t._queue[o].ts>i.ts){t._queue.splice(parseInt(o),0,i),s=!0;break}s||t._queue.push(i),t._currentItem||t._acquire(t._queue[0])})},e.prototype._sendSync=function(){var n;this.isHost&&this._send(lr.SYNC_HOST,{data:{currentItemRequestId:(n=this._currentItem)===null||n===void 0?void 0:n.requestId,queue:this._queue.map(function(t){return{nodeId:t.nodeId,requestId:t.requestId,ts:t.ts}})}})},e.prototype._waitUntilSyncCompleted=function(){return y(this,void 0,void 0,function(){var n=this;return g(this,function(t){return this.isHost&&!this.isInSync?[2,new Promise(function(r){n._activationQueue.push(r)})]:[2]})})},e.prototype._waitSync=function(){var n=this;this.isInSync||(this._activationTimeout=setTimeout(function(){n._completeSync()},8))},e.prototype._completeSync=function(){this.isInSync||(this._state=ic.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(lr.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(lr.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(lr.REQUEST_LOCK),[4,this._requestLock(n)];case 2:return t.sent(),[2]}})})},e.prototype.unlock=function(){var n;!((n=this._currentItem)===null||n===void 0)&&n.requestId&&this._release(this._currentItem.requestId)},e}(),Np=function(){function e(n){var t=n.dbname,r=n.collectionName,i=n.keyName,s=n.keyHash,o=n.indexes,a=n.store,l=this;this._state=aa.INIT,this._indexers=[],this.dbname=t,this.name=r,this.keyName=i,this.indexes=Pe([[i]],Ae(o.filter(function(u){return Ks.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=a,this._mutex=new Jv(function(u,c){return"".concat(Na(u,c),".lock")}(t,r)),this._blobContainer=new Hx({dbname:t,collectionName:r,store:a}),this._transaction=new jx({dbname:t,collectionName:r,store:a})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=Tp(n,t),[4,r.get(i)];case 1:return[2,s.sent()]}})})},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return this._state===aa.READY},enumerable:!1,configurable:!0}),e.prototype.init=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l,u,c,d,h,f,p,m=this;return g(this,function(b){switch(b.label){case 0:return[4,this._mutex.lock()];case 1:b.sent(),b.label=2;case 2:return b.trys.push([2,9,,10]),n=Yc.get(this.dbname),[4,e.metadataOf(this.dbname,this.name,this._store)];case 3:return t=b.sent(),this._metadata=t||{keyName:this.keyName,blockLevel:1,blockHashBase:n.blockHashBase,blockHashMultiplier:n.blockHashMultiplier,blockHashConstant:n.blockHashConstant,indexes:this.indexes},[4,this._transaction.init()];case 4:b.sent(),this._blockManager=new Bx({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=Pe([],Ae(this.indexes),!1),i=[],s=r.map(function(v){return Ks.createKey(v)}),o=t?t.indexes.map(function(v){return Ks.createKey(v)}):[];try{for(a=ve(o),l=a.next();!l.done;l=a.next())u=l.value,s.includes(u)||i.push(Ks.parseKey(u))}catch(v){f={error:v}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,Pe([],Ae(r.map(function(v){var _=new Ks({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,Pe([],Ae(i.map(function(v){return new Ks({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:v,transaction:m._transaction,store:m._store}).drop()})),!1)),[4,Promise.all(c)];case 5:return b.sent(),[4,this._transaction.commit()];case 6:return b.sent(),s.sort().join(",")===o.sort().join(",")?[3,8]:(d=Tp(this.dbname,this.name),this._metadata.indexes=r,[4,this._store.set({key:d,value:this._metadata})]);case 7:b.sent(),b.label=8;case 8:return this._state=aa.READY,this._mutex.unlock(),[3,10];case 9:throw h=b.sent(),this._mutex.unlock(),h;case 10:return[2]}})})},e.prototype.close=function(){this._state=aa.CLOSED},e.prototype._hasPropertyOfKeyName=function(n){var t=n[this.keyName];return typeof t=="string"&&!!t},e.prototype._getIndexerBy=function(n){var t,r;n===void 0&&(n=null),n||(n=[this.keyName]);var i=Ks.createKey(n);try{for(var s=ve(this._indexers),o=s.next();!o.done;o=s.next()){var a=o.value;if(i===Ks.createKey(a.fields))return a}}catch(l){t={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}throw it.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=Tp(this.dbname,this.name),this._metadata.blockLevel++,[4,this._store.set({key:n,value:this._metadata})];case 1:return t.sent(),[2]}})})},e.prototype._requestInsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return l.sent()?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return l.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return l.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:l.sent(),l.label=5;case 5:l.trys.push([5,10,11,12]),r=ve(this._indexers),i=r.next(),l.label=6;case 6:return i.done?[3,9]:[4,i.value.addItem(n)];case 7:l.sent(),l.label=8;case 8:return i=r.next(),[3,6];case 9:return[3,12];case 10:return s=l.sent(),o={error:s},[3,12];case 11:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}return[7];case 12:return[3,14];case 13:throw it.collectionInsertDuplicate;case 14:return[2]}})})},e.prototype._requestUpsert=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=m.sent())?[3,13]:[4,this._blockManager.putToBlock(t,n)];case 2:return m.sent()?[3,5]:[4,this._upgradeBlockLevel()];case 3:return m.sent(),[4,this._blockManager.putToBlock(t,n)];case 4:m.sent(),m.label=5;case 5:m.trys.push([5,10,11,12]),i=ve(this._indexers),s=i.next(),m.label=6;case 6:return s.done?[3,9]:[4,(u=s.value).addItem(n)];case 7:m.sent(),m.label=8;case 8:return s=i.next(),[3,6];case 9:return[3,12];case 10:return o=m.sent(),d={error:o},[3,12];case 11:try{s&&!s.done&&(h=i.return)&&h.call(i)}finally{if(d)throw d.error}return[7];case 12:return[3,23];case 13:return[4,this._blockManager.putToBlock(t,n)];case 14:m.sent(),m.label=15;case 15:m.trys.push([15,21,22,23]),a=ve(this._indexers),l=a.next(),m.label=16;case 16:return l.done?[3,20]:(u=l.value).diff(u.getColumnValues(r),u.getColumnValues(n))===0?[3,19]:[4,u.removeItem(r)];case 17:return m.sent(),[4,u.addItem(n)];case 18:m.sent(),m.label=19;case 19:return l=a.next(),[3,16];case 20:return[3,23];case 21:return c=m.sent(),f={error:c},[3,23];case 22:try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}return[7];case 23:return[2]}})})},e.prototype._requestUpdate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return t=n[this.keyName],[4,this._blockManager.getFromBlock(t)];case 1:return(r=c.sent())?[4,this._blockManager.putToBlock(t,n)]:[3,11];case 2:c.sent(),c.label=3;case 3:c.trys.push([3,9,10,11]),i=ve(this._indexers),s=i.next(),c.label=4;case 4:return s.done?[3,8]:(o=s.value).diff(o.getColumnValues(r),o.getColumnValues(n))===0?[3,7]:[4,o.removeItem(r)];case 5:return c.sent(),[4,o.addItem(n)];case 6:c.sent(),c.label=7;case 7:return s=i.next(),[3,4];case 8:return[3,11];case 9:return a=c.sent(),l={error:a},[3,11];case 10:try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}return[7];case 11:return[2]}})})},e.prototype._requestRemove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return[4,this._blockManager.getFromBlock(n)];case 1:return(t=l.sent())?[4,this._blockManager.removeFromBlock(n)]:[3,10];case 2:l.sent(),l.label=3;case 3:l.trys.push([3,8,9,10]),r=ve(this._indexers),i=r.next(),l.label=4;case 4:return i.done?[3,7]:[4,i.value.removeItem(t)];case 5:l.sent(),l.label=6;case 6:return i=r.next(),[3,4];case 7:return[3,10];case 8:return s=l.sent(),o={error:s},[3,10];case 9:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}return[7];case 10:return[2]}})})},e.prototype._requestClear=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return[4,this._blockManager.clearAllBlocks()];case 1:o.sent(),o.label=2;case 2:o.trys.push([2,7,8,9]),n=ve(this._indexers),t=n.next(),o.label=3;case 3:return t.done?[3,6]:[4,t.value.clear()];case 4:o.sent(),o.label=5;case 5:return t=n.next(),[3,3];case 6:return[3,9];case 7:return r=o.sent(),i={error:r},[3,9];case 8:try{t&&!t.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}return[7];case 9:return[2]}})})},e.prototype.getByKey=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,6];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this._blockManager.getFromBlock(n)];case 3:return t=i.sent(),this._mutex.unlock(),[2,kr(t)];case 4:throw r=i.sent(),this._mutex.unlock(),r;case 5:return[3,7];case 6:throw it.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new Fx({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw it.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestInsert(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.insertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw it.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ve(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestInsert(kr(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),a={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return o=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),o;case 14:return[3,16];case 15:throw it.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestUpsert(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.upsertMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:c.sent(),c.label=2;case 2:if(c.trys.push([2,12,,14]),n.some(function(d){return!u._hasPropertyOfKeyName(d)}))throw it.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=ve(n),r=t.next(),c.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this._requestUpsert(kr(i))]);case 5:c.sent(),c.label=6;case 6:return r=t.next(),[3,4];case 7:return[3,10];case 8:return s=c.sent(),a={error:s},[3,10];case 9:try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}return[7];case 10:return[4,this._transaction.commit()];case 11:return c.sent(),this._mutex.unlock(),[2,n];case 12:return o=c.sent(),[4,this._transaction.clear()];case 13:throw c.sent(),this._mutex.unlock(),o;case 14:return[3,16];case 15:throw it.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:if(r.trys.push([2,5,,7]),!this._hasPropertyOfKeyName(n))throw it.collectionKeyNotGiven;return[4,this._requestUpdate(kr(n))];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[2,n];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.updateIf=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v=this;return g(this,function(_){switch(_.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,16];case 1:_.sent(),_.label=2;case 2:return _.trys.push([2,13,,15]),r=n.where,i=r===void 0?{}:r,s=n.index,o=s===void 0?null:s,a=n.backward,l=a!==void 0&&a,u=[],[4,new cm({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(o)}).each(function(E){return y(v,void 0,void 0,function(){var S,w;return g(this,function(N){if(E.error)throw E.stop(),E.error;if(E.hasNext){if(S=E.nextValue,ma(i,S)&&t.set){if(typeof t.set!="function")for(w in t.set)S[w]=t.set[w];else t.set(S);u.push(S)}E.next()}else E.stop();return[2]})})})];case 3:_.sent(),_.label=4;case 4:_.trys.push([4,9,10,11]),c=ve(u),d=c.next(),_.label=5;case 5:return d.done?[3,8]:(h=d.value,[4,this._requestUpdate(kr(h))]);case 6:_.sent(),_.label=7;case 7:return d=c.next(),[3,5];case 8:return[3,11];case 9:return f=_.sent(),m={error:f},[3,11];case 10:try{d&&!d.done&&(b=c.return)&&b.call(c)}finally{if(m)throw m.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return _.sent(),this._mutex.unlock(),[2,u];case 13:return p=_.sent(),[4,this._transaction.clear()];case 14:throw _.sent(),this._mutex.unlock(),p;case 15:return[3,17];case 16:throw this._transaction.clear(),it.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,5,,7]),[4,this._requestRemove(n)];case 3:return r.sent(),[4,this._transaction.commit()];case 4:return r.sent(),this._mutex.unlock(),[3,7];case 5:return t=r.sent(),[4,this._transaction.clear()];case 6:throw r.sent(),this._mutex.unlock(),t;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.removeIf=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:v.sent(),v.label=2;case 2:return v.trys.push([2,13,,14]),t=n.where,r=t===void 0?{}:t,i=n.index,s=i===void 0?null:i,o=n.backward,a=o!==void 0&&o,l=[],[4,new cm({condition:r,blockManager:this._blockManager,backward:a,indexer:this._getIndexerBy(s)}).each(function(_){return y(b,void 0,void 0,function(){var E,S;return g(this,function(w){if(_.error)throw _.stop(),_.error;return _.hasNext?(E=_.nextValue,ma(r,E)&&(S=E[this.keyName],l.push(S)),_.next()):_.stop(),[2]})})})];case 3:v.sent(),v.label=4;case 4:v.trys.push([4,9,10,11]),u=ve(l),c=u.next(),v.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:v.sent(),v.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=v.sent(),p={error:h},[3,11];case 10:try{c&&!c.done&&(m=u.return)&&m.call(u)}finally{if(p)throw p.error}return[7];case 11:return[4,this._transaction.commit()];case 12:return v.sent(),this._mutex.unlock(),[2,l];case 13:throw f=v.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),it.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,8];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this._requestClear()];case 3:return t.sent(),[4,this._transaction.commit()];case 4:return t.sent(),this._mutex.unlock(),[3,7];case 5:return n=t.sent(),[4,this._transaction.clear()];case 6:throw t.sent(),this._mutex.unlock(),n;case 7:return[3,9];case 8:throw it.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.get(n)];case 1:return[2,t.sent()]}})})},e.prototype.saveBlob=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._blobContainer.save(n,t)];case 1:return[2,r.sent()]}})})},e.prototype.removeBlob=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._blobContainer.remove(n)];case 1:return t.sent(),[2]}})})},e.prototype.removeAllBlobs=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),Ip="[NESTDB]",Pd=!0,zo=function(){function e(){}return e.off=function(){Pd=!1},e.log=function(){for(var n=[],t=0;t1?[4,Promise.all(this._generateShardPostfixArray(s==null?void 0:s.shards).map(function(c){return y(l,void 0,void 0,function(){var d,h;return g(this,function(f){switch(f.label){case 0:return c>0?(d=this._getRawKey(n,".".concat(c)),[4,this._getRaw(d)]):[3,2];case 1:if(!(h=f.sent()))throw it.storeBrokenIntegrity;return[2,h.data];case 2:return[2,i]}})})}))]:[3,4];case 3:return a=u.sent(),[3,5];case 4:a=[i],u.label=5;case 5:return o=a,[2,this.encryption.decrypt(JSON.parse(o.join("")))];case 6:return u.sent(),[2,null];case 7:return[2,null]}})})},e.prototype.set=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return t=this._shardify(n),[4,this._setRaw(t)];case 1:return r.sent(),[2,M({},n.value)]}})})},e.prototype.setMany=function(n){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,Pe([],Ae(n.map(function(s){return r._shardify(s)})),!1)))];case 1:return i.sent(),[2,n.map(function(s){return s.value})]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t,r,i,s=this;return g(this,function(o){switch(o.label){case 0:return t=this._getRawKey(n,".0"),[4,this._getRaw(t)];case 1:return(r=o.sent())?(i=r.metadata,[4,this._removeRaw(this._generateShardPostfixArray(i==null?void 0:i.shards).map(function(a){return s._getRawKey(n,".".concat(a))}))]):[3,3];case 2:return o.sent(),[2,!0];case 3:return[2,!1]}})})},e.prototype.removeMany=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return g(this,function(v){switch(v.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=v.sent())&&(b=m.metadata,t.push.apply(t,Pe([],Ae(i._generateShardPostfixArray(b==null?void 0:b.shards).map(function(_){return d._getRawKey(f,".".concat(_))})),!1))),[2]}})},i=this,h.label=1;case 1:h.trys.push([1,6,7,8]),s=ve(n),o=s.next(),h.label=2;case 2:return o.done?[3,5]:(a=o.value,[5,r(a)]);case 3:h.sent(),h.label=4;case 4:return o=s.next(),[3,2];case 5:return[3,8];case 6:return l=h.sent(),u={error:l},[3,8];case 7:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 8:return t.length>0?[4,this._removeRaw(t)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2,n]}})})},e}(),Ir={},Yo=function(e){function n(t){t===void 0&&(t={});var r,i=this;i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:4194304}))||this;var s=t.delay,o=s===void 0?1:s;return i.delay=o,i.observer={},i}return T(n,e),Object.defineProperty(n.prototype,"rawData",{get:function(){return Ir[this.dbname]},set:function(t){Ir[this.dbname]=t},enumerable:!1,configurable:!0}),n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(Ir[this.dbname])return[2,Object.keys(Ir[this.dbname])];throw it.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return Ir[this.dbname]?[4,Dd(this.delay)]:[3,2];case 1:return r.sent(),[2,Ir[this.dbname][t]?M({key:t},Ir[this.dbname][t]):null];case 2:throw it.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return Ir[this.dbname]?[4,Dd(this.delay)]:[3,2];case 1:d.sent();try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,o=s.key,a=s.data,l=s.metadata,Ir[this.dbname][o]=Object.freeze({data:a,metadata:l})}catch(h){u={error:h}}finally{try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}}return[3,3];case 2:throw it.storeNotAvailable;case 3:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return Ir[this.dbname]?[4,Dd(this.delay)]:[3,2];case 1:l.sent();try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,Ir[this.dbname][s]&&delete Ir[this.dbname][s]}catch(u){o={error:u}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[3,3];case 2:throw it.storeNotAvailable;case 3:return[2]}})})},n.prototype.observe=function(t,r,i){var s=this;this.observer[t]||(this.observer[t]={}),r.forEach(function(o){return s.observer[t][o]=i})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,Ir[this.dbname]||(Ir[this.dbname]={}),[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.set=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){if((r=this.observer[t.key])&&typeof r.set=="function"&&(i=r.set()))throw i;return[2,e.prototype.set.call(this,t)]})})},n.prototype.setMany=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){try{for(r=ve(t),i=r.next();!i.done;i=r.next())if(s=i.value,(o=this.observer[s.key])&&typeof o.set=="function"&&(a=o.set()))throw a}catch(d){l={error:d}}finally{try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}}return[2,e.prototype.setMany.call(this,t)]})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,Dd(this.delay)];case 1:return t.sent(),Ir[this.dbname]={},[2]}})})},n}(l0),ay="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Hi||(Hi={}));var is,Gx=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:104857600}))||this)._storeName=ay,i._state=Hi.UNINITIALIZED,i._openJobQueue=[],i._window=typeof window<"u"?window:void 0,i._indexedDb=i._window?i._window.indexedDB||i._window.mozIndexedDB||i._window.webkitIndexedDB||i._window.msIndexedDB:void 0,i}return T(n,e),Object.defineProperty(n.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.prototype.isTransactionInactiveError=function(t){return t instanceof Error&&t.message.includes("The transaction is inactive")},n.prototype._putToObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,o){var a=t.put(r);a.addEventListener("success",function(l){s(l.target.result)}),a.addEventListener("error",function(){o("Failed to write.")})})]})})},n.prototype._deleteFromObjectStore=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,new Promise(function(s,o){var a=t.delete(r);a.addEventListener("success",function(){return s(r)}),a.addEventListener("error",function(l){return o(l.target.error)})})]})})},n.prototype._openDatabase=function(t){var r=this;return new Promise(function(i,s){if(r._indexedDb){r._state=Hi.OPENING;var o=r._indexedDb.open(t);o.addEventListener("upgradeneeded",function(a){a.target.result.createObjectStore(ay,{keyPath:"key"})}),o.addEventListener("success",function(a){r._state=Hi.OPEN,r._database=a.target.result,r._openJobQueue.forEach(function(l){return l()}),r._openJobQueue=[],r._database.onclose=function(){r._database=void 0,r._state=Hi.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),o.addEventListener("error",function(a){r._state=Hi.UNINITIALIZED,s(a.target.error)})}else s(it.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this._database?[2,this._database.transaction(this._storeName,t).objectStore(this._storeName)]:[3,1];case 1:switch(this._state){case Hi.UNINITIALIZED:case Hi.OPEN:return[3,2];case Hi.OPENING:case Hi.CLOSED:return[3,3]}return[3,4];case 2:throw it.storeNotInitialized;case 3:return[2,new Promise(function(s){r._openJobQueue.push(function(){return s(r._getObjectStore(t))})})];case 4:return[4,this._getObjectStore(t)];case 5:return[2,i.sent()]}})})},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var o=t.getAllKeys();o.addEventListener("success",function(a){i(a.target.result)}),o.addEventListener("error",function(a){return s(a.target.error)})})];case 2:return[2,r.sent()]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._getObjectStore("readonly")];case 1:return r=i.sent(),[4,new Promise(function(s,o){var a=r.get(t);a.addEventListener("success",function(l){var u;s((u=l==null?void 0:l.target)===null||u===void 0?void 0:u.result)}),a.addEventListener("error",function(l){return o(l.target.error)})})];case 2:return[2,i.sent()]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._putToObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ve(t),o=s.next(),h.label=6;case 6:return o.done?[3,9]:(a=o.value,[4,this._putToObjectStore(r,a)]);case 7:h.sent(),h.label=8;case 8:return o=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:r=h.sent(),h.label=2;case 2:return h.trys.push([2,4,,15]),[4,Promise.all(t.map(function(f){return d._deleteFromObjectStore(r,f)}))];case 3:return h.sent(),[3,15];case 4:if(i=h.sent(),!this.isTransactionInactiveError(i))return[3,13];h.label=5;case 5:h.trys.push([5,10,11,12]),s=ve(t),o=s.next(),h.label=6;case 6:return o.done?[3,9]:(a=o.value,[4,this._deleteFromObjectStore(r,a)]);case 7:h.sent(),h.label=8;case 8:return o=s.next(),[3,6];case 9:return[3,12];case 10:return l=h.sent(),u={error:l},[3,12];case 11:try{o&&!o.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.error}return[7];case 12:return[3,14];case 13:throw i;case 14:return[3,15];case 15:return[2]}})})},n.prototype._triggerDatabaseClose=function(){this._database&&this._database.onclose&&this._database.onclose(new Event("dummy"))},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:if(!((t=typeof window<"u"?window:null)!=null&&t.indexedDB||t!=null&&t.mozIndexedDB||t!=null&&t.webkitIndexedDB||t!=null&&t.msIndexedDB))return[3,6];if(this._indexedDb=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,!this._window||!lf())return[3,4];if(!(lf()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw it.storeNotAvailableInPrivateBrowsing;return[3,3];case 1:return[4,new Promise(function(s,o){if(r._indexedDb)try{var a=r._indexedDb.open("_testMozilla");a.onerror=function(){return o(it.storeNotAvailableInPrivateBrowsing)},a.onsuccess=function(l){if(l.target.result.close(),r._indexedDb){var u=r._indexedDb.deleteDatabase("_testMozilla");u.onerror=function(){return s()},u.onsuccess=function(){return s()}}else o(it.storeNotAvailable)}}catch{o(it.storeNotAvailableInPrivateBrowsing)}else o(it.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw it.storeNotAvailable;case 5:return[3,7];case 6:throw it.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this.checkAvailability()];case 1:return r.sent(),[4,this._openDatabase(t)];case 2:return r.sent(),[4,this._resetIfEncryptionChanged()];case 3:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this._getObjectStore("readwrite")];case 1:return t=r.sent(),[4,new Promise(function(i,s){var o=t.clear();o.addEventListener("success",function(){return i()}),o.addEventListener("error",function(a){return s(a.target.error)})})];case 2:return[2,r.sent()]}})})},n}(l0),zx=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,o=s===void 0?2097152:s,a=k4(t,["AsyncStorage","itemSizeLimit"]);return(r=e.call(this,M(M({},a),{itemSizeLimit:o}))||this)._asyncStorage=i,r}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.getItem(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:r=[];try{for(i=ve(t),s=i.next();!s.done;s=i.next())o=s.value,a=o.key,o.data.length<=this.adjustedItemSizeLimit&&r.push([this._getActualKey(a),JSON.stringify(o)])}catch(d){l={error:d}}finally{try{s&&!s.done&&(u=i.return)&&u.call(i)}finally{if(l)throw l.error}}return[4,this._asyncStorage.multiSet(r)];case 1:return c.sent(),[2]}})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._asyncStorage.multiRemove(t.map(function(s){return r._getActualKey(s)}))];case 1:return i.sent(),[2]}})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._asyncStorage)throw it.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(l0),Vx=function(e){function n(t){var r,i=this;return(i=e.call(this,M(M({},t),{itemSizeLimit:(r=t.itemSizeLimit)!==null&&r!==void 0?r:6291456}))||this)._mmkv=t.MMKV,i}return T(n,e),n.prototype._isBelonging=function(t){return t.startsWith("".concat(this.dbname,"/"))},n.prototype._getActualKey=function(t){return"".concat(this.dbname,"/").concat(t)},n.prototype._getAllRawKeys=function(){return y(this,void 0,void 0,function(){var t,r=this;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getAllKeys()];case 1:return t=i.sent(),[2,t.filter(function(s){return r._isBelonging(s)}).map(function(s){return s.substring("".concat(r.dbname,"/").length)})]}})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return[4,this._mmkv.getString(this._getActualKey(t))];case 1:return[2,(r=i.sent())?JSON.parse(r):null]}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,o=s.key,s.data.length<=this.adjustedItemSizeLimit&&this._mmkv.set(this._getActualKey(o),JSON.stringify(s))}catch(c){a={error:c}}finally{try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}}return[2]})})},n.prototype._removeRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a;return g(this,function(l){try{for(r=ve(t),i=r.next();!i.done;i=r.next())s=i.value,this._mmkv.delete(this._getActualKey(s))}catch(u){o={error:u}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2]})})},n.prototype.checkAvailability=function(){return y(this,void 0,void 0,function(){return g(this,function(t){if(!this._mmkv)throw it.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.dbname=t,[4,this._resetIfEncryptionChanged()];case 1:return r.sent(),[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return[4,this.getAllKeys()];case 1:return t=r.sent(),[4,this.removeMany(t)];case 2:return r.sent(),[2]}})})},n}(l0);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(is||(is={}));var xs,qx=function(){function e(n){var t=n.name,r=n.version,i=n.store,s=n.config;this.name=t,this._version=r,this._state=is.INIT,this._config=s||new Yc({dbname:t}),this._store=i,this._event={success:Au,error:Au,storeReplaced:Au,upgrade:ry},this._collections=new Map,this._globalMutex=new Jv("".concat(this.name,".lock")),this._config.disableLogger&&zo.off(),new Ti({dbname:t,limit:this._config.cacheLimit})}return Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.estimateUsage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,t.usage()];case 1:return[2,r.sent()]}})}))];case 1:return[2,n.sent()]}var t})})},e.prototype.commitSchema=function(n){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return this._state!==is.OPENING?[3,2]:[4,Promise.all(n.map(function(i){return y(t,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return s=i.collectionName,o=i.keyName,a=i.index,l=a===void 0?[]:a,this._collections.has(s)||this._collections.set(s,new Np({dbname:this.name,collectionName:s,keyName:o,indexes:l,store:this._store})),(u=this._collections.get(s))?[4,u.init()]:[3,2];case 1:c.sent(),c.label=2;case 2:return[2]}})})}))];case 1:return r.sent(),[3,3];case 2:throw it.databaseSchemaNotOnUpgrade;case 3:return[2]}})})},e.prototype.open=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:return[4,this._globalMutex.lock()];case 1:if(a.sent(),this._state===is.OPENED)return[3,12];this._state=is.OPENING,a.label=2;case 2:return a.trys.push([2,5,,12]),[4,this._store.init(this.name)];case 3:return a.sent(),l=this.name,t="".concat(dm(l),".metadata"),r={version:0,collectionNames:[]},[4,this._store.get(t)];case 4:return i=(n=a.sent())!==null&&n!==void 0?n:r,[2,new Promise(function(u,c){var d=function(f){i.version0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.senderUserIdsFilter&&this.senderUserIdsFilter.length>0&&(!(n instanceof Dt)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof dr)switch(this.replyType){case Dn.NONE:if(n.parentMessageId>0)return!1;break;case Dn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Dt&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(zn||(zn={}));var sc,hs=function(e){switch(e){case zn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case zn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},Kx=function(){return["channelUrl","-createdAt","-notificationId"]},Qx=M(M({},sS),{scheduledAt:void 0}),Yx=function(e){return aS(e)&&k("number",e.scheduledAt,!0)},Zx=M(M({},o0),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),Xx=function(e){return a0(e)&&k("number",e.scheduledAt)&&(fr(e.file)||k("string",e.fileUrl))&&k("string",e.fileName,!0)&&k("string",e.mimeType,!0)&&k("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return k("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},yS="UnsentMessage",Jx="reqId",Fd={},Ia=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new Jv("unsendmessagecache.lock"),Fd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Fd[t]&&!r||(Fd[t]=new n(t)),Fd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(yS);if(!r)throw L.databaseError;return r},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){if(t.messageId>0)throw L.invalidParameters;var r,i=M({},t.serialize());return t instanceof Jn?(t.messageParams&&(i.messageParams=B1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},B1(r)),{scheduledAt:r.scheduledAt})))):t instanceof Zt?(t.messageParams&&(i.messageParams=$1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},$1(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof ai&&t.messageParams&&(i.messageParams=function(s){return Ee({fileInfoList:s.fileInfoList,isReplyToChannel:s.isReplyToChannel,pushNotificationDeliveryOption:s.pushNotificationDeliveryOption})}(t.messageParams)),i},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype._deserializeWithMessageCreateParams=function(t){var r,i,s;return y(this,void 0,void 0,function(){var o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return o=An.of(this._iid),a=this._deserialize(t),t.messageParams?a instanceof Jn?(u=t.messageParams,a.messageParams=o.buildUserMessageCreateParamsFromSerializedData(u,a),[3,6]):[3,1]:[3,6];case 1:return a instanceof Zt?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&bp((r=u.fileType)!==null&&r!==void 0?r:"")?(l=u,[4,this.collection.getBlob(u.fileKey)]):[3,3]:[3,4];case 2:l.file=(i=f.sent())!==null&&i!==void 0?i:void 0,f.label=3;case 3:return a.messageParams=o.buildFileMessageCreateParamsFromSerializedData(u,a),[3,6];case 4:return a instanceof ai&&(u=t.messageParams)&&u.fileInfoList?(a.messageParams=o.buildMultipleFilesMessageCreateParamsFromSerializedData(u,a),[4,Promise.all(a.messageParams.fileInfoList.map(function(p){return y(h,void 0,void 0,function(){var m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&bp((_=(v=p._uploadedMetaData)===null||v===void 0?void 0:v.fileType)!==null&&_!==void 0?_:"")?(m=p,[4,this.collection.getBlob(p._uploadedMetaData.fileKey)]):[3,2];case 1:m.file=(E=S.sent())!==null&&E!==void 0?E:void 0,S.label=2;case 2:return[2]}})})}))]):[3,6];case 5:f.sent(),f.label=6;case 6:return a.scheduledInfo&&t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams?a instanceof Jn?(c=t.scheduledInfo.scheduledMessageParams,a.scheduledInfo.scheduledMessageParams=o.buildScheduledUserMessageCreateParamsFromSerializedData(c,a),[3,10]):[3,7]:[3,10];case 7:return a instanceof Zt?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&bp(c.fileType)?(d=c,[4,this.collection.getBlob(c.fileKey)]):[3,9]:[3,10];case 8:d.file=(s=f.sent())!==null&&s!==void 0?s:void 0,f.label=9;case 9:a.scheduledInfo.scheduledMessageParams=o.buildScheduledFileMessageCreateParamsFromSerializedData(c,a),f.label=10;case 10:return[2,a]}})})},n.prototype._getFileInfoBlobKey=function(t,r){return"".concat(t,".").concat(r)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserializeWithMessageCreateParams(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.filter,s=i===void 0?new vs:i,o=t.order,a=o===void 0?zn.CHANNEL_LATEST:o,l=t.sendingStatus,u=t.backward,c=u!==void 0&&u,d=t.parentMessageId;return y(this,void 0,void 0,function(){var h,f,p,m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(h=hs(a),f={"/where":function(_){return!!(a!==zn.NEWEST_CHILD_MESSAGE||d&&_.parentMessageId!==0&&_.parentMessageId===d)&&s.match(b._deserialize(_))}},r&&(f.channelUrl=r),l&&(f.sendingStatus=l),p={where:f,index:h,backward:c},[4,this.collection.query(p)]):[3,3];case 1:return[4,v.sent().fetch({})];case 2:return m=v.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return g(this,function(E){switch(E.label){case 0:return[4,this._deserializeWithMessageCreateParams(_)];case 1:return[2,E.sent()]}})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new vs),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:zn.NEWEST_CHILD_MESSAGE,channelUrl:t.channelUrl,backward:!1,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o;return g(this,function(a){switch(a.label){case 0:return s instanceof Zt||s instanceof ai?[4,this._mutex.lock()]:[3,4];case 1:return a.sent(),[4,this.saveBlob(s)];case 2:return a.sent(),[4,this._mutex.unlock()];case 3:a.sent(),a.label=4;case 4:return o=this._serialize(s),[4,this.collection.upsertOne(o)];case 5:return a.sent(),[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o;return g(this,function(a){switch(a.label){case 0:return o=[],s.threadInfo&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:o=a.sent(),a.label=2;case 2:return o.length>0?(o.forEach(function(l){return l.applyParentMessage(s)}),[4,this.upsert(o)]):[3,4];case 3:a.sent(),a.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t}})]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.saveBlob=function(t){return y(this,void 0,void 0,function(){var r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:return t instanceof Zt?t.messageParams&&(s=t.messageParams).file&&ch(s.file)?[4,this.collection.saveBlob(s.file,t.reqId)]:[3,2]:[3,5];case 1:i=a.sent(),s.fileKey=i,s.fileType=_a.BLOB,a.label=2;case 2:return t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(r=t.scheduledInfo.scheduledMessageParams).file&&ch(r.file)?[4,this.collection.saveBlob(r.file,t.reqId)]:[3,4];case 3:i=a.sent(),r.fileKey=i,r.fileType=_a.BLOB,a.label=4;case 4:return[3,7];case 5:return t instanceof ai&&(s=t.messageParams)&&s.fileInfoList&&Array.isArray(s.fileInfoList)?[4,Promise.all(s.fileInfoList.map(function(l,u){return y(o,void 0,void 0,function(){var c;return g(this,function(d){switch(d.label){case 0:return l.file&&ch(l.file)?[4,this.collection.saveBlob(l.file,this._getFileInfoBlobKey(t.reqId,u))]:[3,2];case 1:c=d.sent(),l._uploadedMetaData||(l._uploadedMetaData={}),l._uploadedMetaData.fileKey=c,l._uploadedMetaData.fileType=_a.BLOB,d.label=2;case 2:return[2]}})})}))]:[3,7];case 6:a.sent(),a.label=7;case 7:return[2]}})})},n}(Wn),Hd={},Cl=function(e){function n(t){var r=e.call(this,t)||this;return Hd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return O.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Ia.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),Hd[t]&&!r||(Hd[t]=new n(t)),Hd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(um)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M(M({},t.serialize()),{messageId:"".concat(t.messageId)})},n.prototype._deserialize=function(t){return t=M(M({},t),{messageId:parseInt(t.messageId)}),An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey("".concat(t))]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,o=s===void 0?100:s,a=t.filter,l=a===void 0?new vs:a,u=t.order,c=u===void 0?zn.CHANNEL_LATEST:u,d=t.backward,h=d!==void 0&&d,f=t.parentMessageId,p=t.isPollOnly,m=p!==void 0&&p,b=t.exactMatch,v=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,w,N,I=this;return g(this,function(R){switch(R.label){case 0:return this.localCacheEnabled?(S=hs(c),w={where:{channelUrl:r,"/where":function(A){if(i)switch(c){case zn.CHANNEL_LATEST:if(v&&A.createdAt!==i)return!1;if(h){if(E&&A.createdAti||!E&&A.createdAt>=i)return!1;break;case zn.NEWEST_CHILD_MESSAGE:if(!f||A.parentMessageId===0||A.parentMessageId!==f)return!1}return!(m&&!A._poll)&&l.match(I._deserialize(A))}},index:S,backward:h},[4,this.collection.query(w)]):[3,3];case 1:return[4,R.sent().fetch({limit:o??void 0})];case 2:return N=R.sent(),[2,Promise.all(N.map(function(A){return y(I,void 0,void 0,function(){return g(this,function(x){return[2,this._deserialize(A)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new vs),y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this.fetch({channelUrl:t.channelUrl,token:Date.now(),limit:null,backward:!1,filter:r,order:zn.NEWEST_CHILD_MESSAGE,parentMessageId:t.messageId})];case 1:return[2,i.sent()]}})})},n.prototype.upsert=function(t){var r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:return this.localCacheEnabled?[4,this.saveBlobs(t)]:[3,13];case 1:f.sent(),f.label=2;case 2:f.trys.push([2,7,8,9]),i=ve(t),s=i.next(),f.label=3;case 3:return s.done?[3,6]:(o=s.value,!((r=o.threadInfo)===null||r===void 0)&&r._isUpdateRequired?[4,this.get(o.messageId)]:[3,5]);case 4:(a=f.sent())!=null&&a.threadInfo&&o.threadInfo._updateFrom(a.threadInfo),f.label=5;case 5:return s=i.next(),[3,3];case 6:return[3,9];case 7:return l=f.sent(),c={error:l},[3,9];case 8:try{s&&!s.done&&(d=i.return)&&d.call(i)}finally{if(c)throw c.error}return[7];case 9:return u=t.map(function(p){return h._serialize(p)}),[4,this.collection.upsertMany(u)];case 10:return f.sent(),[4,this.upsertChildMessages(t)];case 11:return f.sent(),[4,this._unsentMessageCache.upsertChildMessages(t)];case 12:f.sent(),f.label=13;case 13:return[2]}})})},n.prototype.upsertChildMessages=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o,a;return g(this,function(l){switch(l.label){case 0:return o=[],!((a=s.threadInfo)===null||a===void 0)&&a.replyCount&&s.threadInfo.replyCount>0?[4,this.getAllChildMessages(s)]:[3,2];case 1:o=l.sent(),l.label=2;case 2:return o.length>0?(o.forEach(function(u){return u.applyParentMessage(s)}),[4,this.upsert(o)]):[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}})})}))]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove("".concat(s))]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:hs(zn.CHANNEL_LATEST)})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:hs(zn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,o=this;return g(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=hs(zn.CHANNEL_LATEST),[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=o._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,a.sent()];case 2:return[2,0]}})})},n.prototype.saveBlobs=function(t){return y(this,void 0,void 0,function(){var r=this;return g(this,function(i){switch(i.label){case 0:return[4,Promise.all(t.map(function(s){return y(r,void 0,void 0,function(){var o,a;return g(this,function(l){switch(l.label){case 0:return s instanceof Zt&&s.messageParams&&(o=s.messageParams).file&&ch(o.file)?[4,this.collection.saveBlob(o.file,s.reqId)]:[3,2];case 1:a=l.sent(),o.fileKey=a,l.label=2;case 2:return[2]}})})}))];case 1:return i.sent(),[2]}})})},n.prototype._getGroupChannelPreferenceSize=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=0,[4,(i=this._cacheContext.preference).get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 1:return s=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 2:return o=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 3:return a=u.sent(),[4,i.get("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 4:return l=u.sent(),s&&(r+=JSON.stringify(s).length),o&&(r+=JSON.stringify(o).length),a&&(r+=JSON.stringify(a).length),l&&(r+=JSON.stringify(l).length),[2,r]}})})},n}(Wn),jd={},eO=function(e){function n(t){var r=e.call(this,t)||this;return jd[t]=r,r}return T(n,e),Object.defineProperty(n.prototype,"_sdkState",{get:function(){return O.of(this._iid).sdkState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),n.of=function(t,r){return r===void 0&&(r=!1),jd[t]&&!r||(jd[t]=new n(t)),jd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(vS)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t){return M({},t.serialize())},n.prototype._deserialize=function(t){return An.of(this._iid).buildMessageFromSerializedData(t)},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.getByKey(t)]:[3,2];case 1:if(r=i.sent())return[2,this._deserialize(r)];i.label=2;case 2:return[2,void 0]}})})},n.prototype.fetch=function(t){var r=t.channelUrl,i=t.token,s=t.limit,o=s===void 0?100:s,a=t.filter,l=a===void 0?new vs:a,u=t.backward,c=u!==void 0&&u,d=t.exactMatch,h=d!==void 0&&d,f=t.inclusive,p=f===void 0||f;return y(this,void 0,void 0,function(){var m,b=this;return g(this,function(v){switch(v.label){case 0:return this.localCacheEnabled?(m={where:{channelUrl:r,"/where":function(_){if(i){if(h&&_.createdAt!==i)return!1;if(c){if(p&&_.createdAti||!p&&_.createdAt>=i)return!1}return l.match(b._deserialize(_))}},index:["channelUrl","-createdAt","-notificationId"],backward:c},[4,this.collection.query(m)]):[3,3];case 1:return[4,v.sent().fetch({limit:o??void 0})];case 2:return[2,v.sent().map(function(_){return b._deserialize(_)})];case 3:return[2,[]]}})})},n.prototype.upsert=function(t){return y(this,void 0,void 0,function(){var r,i=this;return g(this,function(s){switch(s.label){case 0:return this.localCacheEnabled?(r=t.map(function(o){return i._serialize(o)}),[4,this.collection.upsertMany(r)]):[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},n.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:if(!this.localCacheEnabled)return[3,8];u.label=1;case 1:u.trys.push([1,6,7,8]),r=ve(t),i=r.next(),u.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.collection.remove(s)]);case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}})})},n.prototype.markAsReadByTimestamp=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,messageStatus:oa.SENT,createdAt:{"<":r}}},{set:{messageStatus:oa.READ}})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.markAsReadByMessageIds=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,notificationId:{"/in":r},messageStatus:oa.SENT}},{set:{messageStatus:oa.READ}})]:[3,2];case 1:return[2,i.sent().length];case 2:return[2,0]}})})},n.prototype.removeMessagesOfChannel=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:["channelUrl","-createdAt","-notificationId"]})]:[3,6];case 1:return i.sent(),[4,(r=this._cacheContext.preference).remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync"))];case 2:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/sync.meta"))];case 3:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs"))];case 4:return i.sent(),[4,r.remove("sendbird:".concat(this._sdkState.userId,"@groupchannel/").concat(t,"/message/changelogs.meta"))];case 5:i.sent(),i.label=6;case 6:return[2]}})})},n.prototype.removeUnderOffset=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:hs(zn.CHANNEL_LATEST)})]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},n.prototype.clear=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},n.prototype.countBetween=function(t,r,i){return y(this,void 0,void 0,function(){var s,o=this;return g(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=["channelUrl","-createdAt","-notificationId"],[4,this.collection.query({where:{channelUrl:t,"/where":function(l){var u=o._deserialize(l);return i.includes(u.createdAt)&&r.match(u)}},index:s}).count()]):[3,2];case 1:return[2,a.sent()];case 2:return[2,0]}})})},n}(Wn),uu={},ES=function(e){function n(t){var r=e.call(this,t)||this;return r._observers=new Map,r._dispatcherContext=r._dispatcher.on(function(i){return y(r,void 0,void 0,function(){var s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R=this;return g(this,function(A){switch(A.label){case 0:return i instanceof Et?(s=i.messages,I=i.source,c=i.isWebSocketEventComing,o=s.filter(function(x){return x instanceof dr&&x.channelType!==Ze.OPEN&&x.messageId>0}),a=s.filter(function(x){return x instanceof dr&&x.channelType!==Ze.OPEN&&x.messageId===0}),l=s.filter(function(x){return x instanceof wa}),o.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(o)];case 1:return x.sent(),[4,this._unsentMessageCache.remove(o.map(function(U){return U instanceof Dt?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return x.sent(),[2]}})})})]:[3,2]):[3,7];case 1:A.sent(),c||this._broadcastUpdateEvent(o,I),A.label=2;case 2:return a.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.upsert(a)];case 1:return x.sent(),[2]}})})})]:[3,4];case 3:A.sent(),c||this._broadcastUpdateEvent(a,I),A.label=4;case 4:return l.length>0?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return x.sent(),[2]}})})})]:[3,6];case 5:A.sent(),c||this._broadcastUpdateEvent(l,I),A.label=6;case 6:return[3,24];case 7:return i instanceof Kv?(u=i.messageIds,I=i.source,c=i.isWebSocketEventComing,d=u.filter(function(x){return typeof x=="number"}),h=u.filter(function(x){return typeof x=="string"}),[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return d.length>0?[4,this._messageCache.remove(d)]:[3,2];case 1:x.sent(),x.label=2;case 2:return h.length>0?[4,this._notificationCache.remove(h)]:[3,4];case 3:x.sent(),x.label=4;case 4:return[2]}})})})]):[3,9];case 8:return A.sent(),c||this._broadcastRemoveEvent(u,I),[3,24];case 9:return i instanceof $C?(f=i.reqId,I=i.source,[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.remove([f])];case 1:return x.sent(),[2]}})})})]):[3,11];case 10:return A.sent(),this._broadcastRemoveUnsentEvent(f,I),[3,24];case 11:return i instanceof GC?(p=i.polls,I=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(x){return x.messageId}),[4,Promise.all(m.map(function(x){return R._messageCache.get(x)}))]):[3,14]):[3,15];case 12:return(b=A.sent().filter(function(x){return x})).length>0&&p.forEach(function(x){var U=b.find(function(q){return q.messageId===x.messageId});U&&U.applyPoll(x)}),[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,x.sent()]}})})})];case 13:A.sent(),A.label=14;case 14:return this._broadcastPollChangeLogEvent(p,I),[3,24];case 15:return i instanceof zC?(v=i.event,I=i.source,[4,this._messageCache.get(v.messageId)]):[3,19];case 16:return(_=A.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(v)?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,x.sent()]}})})})]:[3,18];case 17:A.sent(),A.label=18;case 18:return this._broadcastPollUpdateEvent(v,I),[3,24];case 19:return i instanceof Qv?(E=i.event,I=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=A.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,Ot(function(){return y(R,void 0,void 0,function(){return g(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,x.sent()]}})})})]:[3,22];case 21:A.sent(),A.label=22;case 22:return this._broadcastPollVoteEvent(E,I),[3,24];case 23:i instanceof jC?(w=i.event,I=i.source,w.messageId>0&&this._broadcastReactionUpdateEvent(w,I)):i instanceof BC&&(N=i.event,I=i.source,this._broadcastThreadUpdateEvent(N,I)),A.label=24;case 24:return[2]}})})}),r}return T(n,e),Object.defineProperty(n.prototype,"_cacheContext",{get:function(){return O.of(this._iid).cacheContext},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_dispatcher",{get:function(){return O.of(this._iid).dispatcher},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_messageCache",{get:function(){return Cl.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Ia.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return eO.of(this._iid)},enumerable:!1,configurable:!0}),n.of=function(t,r){var i;return r===void 0&&(r=!1),uu[t]&&!r||(uu[t]&&((i=uu[t]._dispatcherContext)===null||i===void 0||i.close()),uu[t]=new n(t)),uu[t]},n.prototype._broadcastUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onUpdate&&l.onUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollChangeLogEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollChangeLogUpdate&&l.onPollChangeLogUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollUpdate&&l.onPollUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastPollVoteEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onPollVote&&l.onPollVote(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onRemove&&l.onRemove(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastRemoveUnsentEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onRemoveUnsent&&l.onRemoveUnsent(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastReactionUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onReactionUpdate&&l.onReactionUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype._broadcastThreadUpdateEvent=function(t,r){var i,s;try{for(var o=ve(this._observers.values()),a=o.next();!a.done;a=o.next()){var l=a.value;l.onThreadInfoUpdate&&l.onThreadInfoUpdate(t,r)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}},n.prototype.subscribe=function(t,r){this._observers.set(t,r)},n.prototype.unsubscribe=function(t){this._observers.delete(t)},n.prototype.unsubscribeAll=function(){this._observers.clear()},n}(Wn),tO=function(e){function n(t){var r=this,i=t.reverse,s=i!==void 0&&i,o=t.limit,a=o===void 0?20:o,l=t.keys,u=t.token;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(aC),r.params=Ee({token:u,limit:a,reverse:s,order:W_.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return T(n,e),n}(Y),nO=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.next,o=r.has_more,a=o!==void 0&&o,l=r.templates;return i.nextToken=s,i.hasMore=a,i.templates=l.map(function(u){return{template:JSON.stringify(u)}}),i}return T(n,e),n}(ae),rO=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(aC,"/").concat(i),r}return T(n,e),n}(Y),iO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.template=JSON.stringify(r),i}return T(n,e),n}(ae),ly={},An=function(){function e(n,t){var r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=t.onlineDetector,a=t.cacheContext;this._iid=n,this._sdkState=r,this._requestQueue=s,this._dispatcher=i,this._cacheContext=a,Cl.of(n),Ia.of(n),ES.of(n),this.fileMessageQueue=new eM(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:o,cacheContext:a}),ly[n]=this}return e.of=function(n){return ly[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=fa(n);if(t.notificationId)return new wa(this._iid,wa.payloadify(t));switch(t.messageType){case bt.USER:return new Jn(this._iid,Jn.payloadify(t));case bt.FILE:return ai._isMultipleFilesMessageSerializedData(t)?new ai(this._iid,ai.payloadify(t)):new Zt(this._iid,Zt.payloadify(t));case bt.ADMIN:return new Bl(this._iid,Bl.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return Ee(Ne({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,message:t.message,translationTargetLanguages:Object.keys(t.translations),pollId:n.pollId}))},e.prototype.buildFileMessageCreateParamsFromSerializedData=function(n,t){var r;return Ee(Ne({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,file:n.file,fileKey:n.fileKey,fileUrl:t.plainUrl,fileName:t.name,fileSize:t.size,mimeType:t.type,thumbnailSizes:(r=t.thumbnails)===null||r===void 0?void 0:r.map(function(i){return{maxWidth:i.width,maxHeight:i.height}}),fileType:n.fileType,requireAuth:t.requireAuth}))},e.prototype.buildMultipleFilesMessageCreateParamsFromSerializedData=function(n,t){var r=this;return Ee({data:t.data,customType:t.customType,mentionType:t.mentionType,mentionedUserIds:t.mentionedUserIds,mentionedUsers:t.mentionedUsers,mentionedMessageTemplate:t.mentionedMessageTemplate,metaArrays:t.metaArrays,parentMessageId:t.parentMessageId,isReplyToChannel:n.isReplyToChannel,pushNotificationDeliveryOption:n.pushNotificationDeliveryOption,appleCriticalAlertOptions:t.appleCriticalAlertOptions,reqId:t.reqId,fileInfoList:n.fileInfoList.map(function(i){return new af(r._iid,i)})})},e.prototype.buildScheduledUserMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildUserMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildScheduledFileMessageCreateParamsFromSerializedData=function(n,t){return M(M({},this.buildFileMessageCreateParamsFromSerializedData(n,t)),{scheduledAt:n.scheduledAt})},e.prototype.buildSenderFromSerializedData=function(n){var t=fa(n);return new jl(this._iid,jl.payloadify(t))},e.prototype.getMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new tM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(nM).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new sM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(oM).message]}})})},e.prototype.getMessagesByMessageId=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var o,a,l;return g(this,function(u){switch(u.label){case 0:return o=new kd(M(M({channelType:t,channelUrl:n,token:String(r)},nc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Rd).messages,this._dispatcher.dispatch(new Et({messages:l,source:s})),[2,l]}})})},e.prototype.getMessagesByTimestamp=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var o,a,l;return g(this,function(u){switch(u.label){case 0:return o=new kd(M(M({channelType:t,channelUrl:n,timestamp:r},nc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Rd).messages,this._dispatcher.dispatch(new Et({messages:l,source:s})),[2,l]}})})},e.prototype._getMessagesByTimestampForCollection=function(n,t,r,i,s,o,a){return s===void 0&&(s=G.REQUEST_MESSAGE),y(this,void 0,void 0,function(){var l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return l=new kd(M(M(M({channelType:t,channelUrl:n,timestamp:r},nc),i),{checkingHasNext:o,checkingContinuousMessages:a})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as(Rd),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new Et({messages:d,source:s})),[2,{messages:d,isContinuousMessages:h,hasNext:f}]}})})},e.prototype.getThreadedMessagesByTimestamp=function(n,t,r,i){return i===void 0&&(i=G.REQUEST_THREADED_MESSAGE),y(this,void 0,void 0,function(){var s,o,a,l;return g(this,function(u){switch(u.label){case 0:return s=new kd(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},Qc),r),{replyType:Dn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return o=u.sent(),a=o.as(Rd).messages,(l=a.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new Et({messages:l,source:i})),[2,{parentMessage:a[0],threadedMessages:l}]}})})},e.prototype.getMessageTemplatesByToken=function(n,t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=new tO(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(nO),o=s.hasMore,a=s.nextToken,l=s.templates,[2,{hasMore:o,token:a,templates:l}]}})})},e.prototype.getMessageTemplate=function(n){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=new rO({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(iO).template}]}})})},e.prototype.getMessageChangelogs=function(n,t,r,i,s){return s===void 0&&(s=G.REQUEST_MESSAGE_CHANGELOGS),y(this,void 0,void 0,function(){var o,a,l,u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return o=new rM(Ee(Ne(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},im),i)))),[4,this._requestQueue.send(o)];case 1:return a=p.sent(),l=a.as(iM),u=l.updatedMessages,c=l.deletedMessagesInfo,d=l.hasMore,h=l.nextToken,f=c.map(function(m){return m.messageId}),u.length>0&&this._dispatcher.dispatch(new Et({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new Kv({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),bS=function(e){function n(t,r){var i=e.call(this,t)||this;i.targetMessageId=0;var s=r.thread_info,o=r.parent_message_id,a=r.channel_url,l=r.channel_type;return s&&k("object",s)&&k("number",o)&&k("string",a)&&k("string",l)&&(i.threadInfo=new of(t,s),i.targetMessageId=o,i.channelUrl=a,i.channelType=l),i}return T(n,e),n}(Wn),sO={channelUrl:"",channelType:Ze.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},oO=function(e){function n(t){var r=t.channelCustomType,i=t.keyword,s=t.limit,o=t.reverse,a=t.exactMatch,l=t.channelUrl,u=t.order,c=t.messageTimestampFrom,d=t.messageTimestampTo,h=t.advancedQuery,f=t.targetFields,p=t.nextToken,m=e.call(this)||this;return m.method=Q.GET,m.path="".concat(V4,"/messages"),m.params={custom_type:r,query:i,limit:s,reverse:o,exact_match:a,channel_url:l,message_ts_from:c,message_ts_to:d,sort_field:u,advanced_query:h,target_fields:f,after:p},m}return T(n,e),n}(Y),aO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return vr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return T(n,e),n}(ae);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(sc||(sc={}));var lO=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f=this;return(f=e.call(this,t,r)||this).keyword="",f.reverse=!1,f.exactMatch=!1,f.channelUrl="",f.channelCustomType="",f.messageTimestampFrom=null,f.messageTimestampTo=null,f.order=sc.SCORE,f.advancedQuery=!1,f.targetFields=null,f._nextToken="",f.totalCount=-1,f.keyword=r.keyword,f.reverse=(i=r.reverse)!==null&&i!==void 0&&i,f.exactMatch=(s=r.exactMatch)!==null&&s!==void 0&&s,f.channelUrl=(o=r.channelUrl)!==null&&o!==void 0?o:"",f.channelCustomType=(a=r.channelCustomType)!==null&&a!==void 0?a:"",f.messageTimestampFrom=(l=r.messageTimestampFrom)!==null&&l!==void 0?l:null,f.messageTimestampTo=(u=r.messageTimestampTo)!==null&&u!==void 0?u:null,f.order=(c=r.order)!==null&&c!==void 0?c:sc.SCORE,f.advancedQuery=(d=r.advancedQuery)!==null&&d!==void 0&&d,f.targetFields=(h=r.targetFields)!==null&&h!==void 0?h:null,f}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.keyword)&&this.keyword.length>0&&k("boolean",this.reverse)&&k("boolean",this.exactMatch)&&k("string",this.channelUrl)&&k("string",this.channelCustomType)&&(k("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(k("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&Ge(sc,this.order)&&k("boolean",this.advancedQuery)&&We("string",this.targetFields,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new oO(Ne(M(M({},this),{nextToken:this._nextToken?this._nextToken:null}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=c.sent(),s=i.as(aO),o=s.messages,a=s.hasNext,l=s.nextToken,u=s.totalCount,this._nextToken=l,this._hasNext=a,this._isLoading=!1,this.totalCount=u,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),uO=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.limit,o=t.token,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),a.params=Ee(Ne({limit:s,token:o})),a}return T(n,e),n}(Y),cO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.next,i.messages=r.messages.map(function(s){return vr(t,s)}),i}return T(n,e),n}(ae),dO=function(e){function n(t,r,i,s){var o=e.call(this,t,r,i,s)||this;return o._edge="",o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new uO({channelType:this.channelType,channelUrl:this.channelUrl,token:this._edge,limit:this.limit}),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(cO),o=s.messages,a=s.token,this._edge=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),hO={channelUrl:"",scheduledMessageId:0},fO={reverse:!1,limit:20},pO=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="message",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new An(t,{sdkState:i,dispatcher:s,requestQueue:a,onlineDetector:u,cacheContext:c})},n.prototype.buildMessageFromSerializedData=function(t){return this._manager.buildMessageFromSerializedData(t)},n.prototype.buildSenderFromSerializedData=function(t){return this._manager.buildSenderFromSerializedData(t)},n.prototype.getMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return r=M(M({},sO),t),K(function(o){return k("string",o.channelUrl)&&Ge(Ze,o.channelType)&&k("number",o.messageId)&&k("boolean",o.includeReactions,!0)&&k("boolean",o.includeMetaArray,!0)&&k("boolean",o.includeParentMessageInfo,!0)&&k("boolean",o.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof dr||i instanceof wa||i===null)return[2,i];throw"Unknown message type is given."}})})},n.prototype.getScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},hO),t),K(function(s){return k("string",s.channelUrl)&&s.channelUrl!==""&&k("number",s.scheduledMessageId)&&s.scheduledMessageId>0}(r)).throw(L.invalidParameters),[2,this._manager.getScheduledMessage(r)]})})},n.prototype.getMessageTemplatesByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){return i=M(M({},fO),r),K(k("string",t,!0)&&function(o){return k("boolean",o.reverse,!0)&&k("number",o.limit,!0)&&We("string",o.keys,!0)}(i)).throw(L.invalidParameters),[2,this._manager.getMessageTemplatesByToken(t,i)]})})},n.prototype.getMessageTemplate=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(Wv),Pt,oc,fm;(function(e){e.LATEST_LAST_MESSAGE="latest_last_message",e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"})(Pt||(Pt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(oc||(oc={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(fm||(fm={}));var Pc,fh=function(e){switch(e){case Pt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case Pt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case Pt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},CS=function(e){function n(t){var r=t.message,i=e.call(this)||this;return i.message=r,i}return T(n,e),n}(Tt),uy={},Mu=function(){function e(n,t){var r=t.localCacheEnabled,i=t.enableAutoResend,s=t.dispatcher,o=t.sdkState,a=t.logger,l=this;this._iid=n,uy[n]=this,this._localCacheEnabled=r,this._enableAutoResend=i,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=s,this._logger=a,this._sdkState=o,this._localCacheEnabled&&s.on(function(u){if(u instanceof _i)switch(u.stateType){case st.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case st.INTERNAL_DISCONNECTED:case st.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return uy[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=a.sent();try{for(t=ve(n),r=t.next();!r.done;r=t.next())(i=r.value).errorCode===0&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",i.reqId),i.sendingStatus=ut.FAILED,i.errorCode=Ie.ACK_TIMEOUT,this._dispatcher.dispatch(new Et({messages:[i],source:G.LOCAL_MESSAGE_FAILED})))}catch(l){s={error:l}}finally{try{r&&!r.done&&(o=t.return)&&o.call(t)}finally{if(s)throw s.error}}return[2]}})})},e.prototype.processAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=ve(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&Wh(i.errorCode)&&(s=new Date().getTime(),o=i.createdAt+2592e5,this._enableAutoResend&&s<=o?this._autoResendQueue.map(function(c){return c.reqId}).indexOf(i.reqId)<0&&this._autoResendQueue.push(i):(this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(o).toLocaleString()),i.sendingStatus=ut.FAILED,this._dispatcher.dispatch(new Et({messages:[i],source:G.LOCAL_MESSAGE_FAILED}))))}catch(c){a={error:c}}finally{try{r&&!r.done&&(l=t.return)&&l.call(t)}finally{if(a)throw a.error}}return[2]}})})},e.prototype.completeCurrentAndProcessNextAutoResend=function(n){if(this._localCacheEnabled&&this._enableAutoResend&&(n.sendingStatus===ut.SUCCEEDED||n.sendingStatus===ut.FAILED&&!Wh(n.errorCode))){var t=this.indexOf(n);t>=0&&this._autoResendQueue.splice(t,1),t===0&&this._processNextAutoResend()}},e.prototype._fetchAllCachedPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Ia.of(this._iid),(t=new vs).replyType=Dn.ALL,[4,n.fetch({sendingStatus:ut.PENDING,backward:!0,filter:t})];case 1:return[2,r.sent()]}})})},e.prototype.indexOf=function(n){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId):-1},e.prototype._isNotInQueue=function(n){return this._autoResendQueue.map(function(t){return t.reqId}).indexOf(n.reqId)===-1},e.prototype._processNextAutoResend=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){if(this._localCacheEnabled&&this._enableAutoResend&&this._sdkState.appState==="foreground")try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),n=this._autoResendQueue[0],this._dispatcher.dispatch(new CS({message:n})),this._logger.debug("processing auto-resend for message request id: ",n.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(r){this._logger.warn("process auto-resend error: ",r),this._isProcessingAutoResend=!1}return[2]})})},e}();(function(e){e[e.USER_BLOCK=20001]="USER_BLOCK",e[e.USER_UNBLOCK=2e4]="USER_UNBLOCK",e[e.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED"})(Pc||(Pc={}));var uf=function(){function e(n){this.category=n.cat,this.data=n.data}return e.getDataAsUserBlockEvent=function(n,t){var r=t.data,i=r.blocker,s=r.blockee;return{blocker:new Ke(n,i),blockee:new Ke(n,s)}},e.getDataAsFriendDiscoveredEvent=function(n,t){var r=t.data.friend_discoveries;return{friendDiscoveries:Array.isArray(r)?r.map(function(i){return new Ke(n,i)}):[]}},e}(),SS=function(e){function n(t,r){var i=r.userId,s=e.call(this)||this;return s._iid=t,s.userId=i,s}return T(n,e),n}(Tt),TS=function(e){function n(){return e.call(this)||this}return T(n,e),n}(Tt),wS=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new uf(i),s}return T(n,e),n}(mt),_O=function(e,n){this.pollId=0,this.messageId=0,this.pollId=n.poll.id,this.messageId=n.poll.message_id,this._iid=e,this._payload=n},Yt;(function(e){e[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED"})(Yt||(Yt={}));var mO=function(){function e(n){var t;this.channelUrl=n.channel_url,this.channelType=n.channel_type,this.category=n.cat,this.data=(t=n.data)!==null&&t!==void 0?t:{},this.ts=n.ts}return Object.defineProperty(e.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===Ze.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===Ze.OPEN},enumerable:!1,configurable:!0}),e}(),Kl=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.event=new mO(i),s}return T(n,e),n}(mt),vO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data.operators,a=o===void 0?[]:o;return s.operators=a.map(function(l){return new Ke(s._iid,l)}),s}return T(n,e),n}(Kl),gO=function(e){function n(t,r){var i=e.call(this,t)||this;return i._logger=r.logger,i._sdkState=r.sdkState,i._sessionManager=r.sessionManager,i._requestQueue=r.requestQueue,i._dispatcher=r.dispatcher,i._cacheContext=r.cacheContext,i._channelType=r.channelType,i}return T(n,e),Object.defineProperty(n.prototype,"_messageBroadcast",{get:function(){return ES.of(this._iid)},enumerable:!1,configurable:!0}),n.prototype.subscribeMessageEvent=function(t,r){this._messageBroadcast.subscribe(t,r)},n.prototype.unsubscribeMessageEvent=function(t){this._messageBroadcast.unsubscribe(t)},n.prototype.getMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return y(this,void 0,void 0,function(){return g(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return[2]})})},n}(Wn),yO=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"ADMM",i)||this).message=new Bl(t,i);var c=O.of(t).sdkState;return u.isMentioned=Dl(u.message.mentionType,(a=(s=u.message.mentionedUserIds)!==null&&s!==void 0?s:(o=u.message.mentionedUsers)===null||o===void 0?void 0:o.map(function(d){return d.userId}))!==null&&a!==void 0?a:[],c.userId),u.forceUpdateLastMessage=(l=i.force_update_last_message)!==null&&l!==void 0&&l,u}return T(n,e),n}(mt),EO=function(e){function n(t,r,i){var s,o,a,l,u,c=this;(c=e.call(this,t,"AEDI",i)||this).message=new Bl(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=Hv({mentionType:(s=i.old_values)===null||s===void 0?void 0:s.mention_type,mentionedUserIds:(a=(o=i.old_values)===null||o===void 0?void 0:o.mentioned_user_ids)!==null&&a!==void 0?a:[]},Ne({mentionType:c.message.mentionType,mentionedUserIds:(l=c.message.mentionedUserIds)!==null&&l!==void 0?l:(u=c.message.mentionedUsers)===null||u===void 0?void 0:u.map(function(h){return h.userId})}),d.userId),c}return T(n,e),n}(mt),bO=function(e){function n(t,r,i){var s=e.call(this,t,"MRCT",i)||this;return s.channelUrl=i.channel_url,s.channelType=i.channel_type,s.event=new Yv(i),s}return T(n,e),n}(mt),CO=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new bS(t,i),s}return T(n,e),n}(mt),SO=function(e){function n(t,r,i){var s=e.call(this,t,"MCNT",i)||this;return s.groupChannelMemberCounts=i.group_channels.map(function(o){return{channelUrl:o.channel_url,memberCount:o.member_count,joinedMemberCount:o.joined_member_count,updatedAt:o.ts}}),s.openChannelMemberCounts=i.open_channels.map(function(o){return{channelUrl:o.channel_url,participantCount:o.participant_count,updatedAt:o.ts}}),s}return T(n,e),n}(mt),TO=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new _O(t,i),s.status=tm(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(mt),Bt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(Bt||(Bt={}));var ms,Rr,Ur,No,zi,cf,Us,Fc,ii=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.state=null,i.role=null,i.isMuted=!1,i.isBlockedByMe=!1,i.isBlockingMe=!1,i.state=Ge(Bt,r.state)?r.state:null,i.role=Ge(Ii,r.role)?r.role:null,typeof r.is_muted=="boolean"&&(i.isMuted=r.is_muted),typeof r.is_blocked_by_me=="boolean"&&(i.isBlockedByMe=r.is_blocked_by_me),typeof r.is_blocking_me=="boolean"&&(i.isBlockingMe=r.is_blocking_me),i}return T(n,e),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{state:t.state,role:t.role,is_muted:t.isMuted,is_blocked_by_me:t.isBlockedByMe,is_blocking_me:t.isBlockingMe})))},n}(Ua),wO=function(e){function n(t,r){var i,s,o=this;return(o=e.call(this,t)||this).channelUrl=(i=r.channel_url)!==null&&i!==void 0?i:"",o.channelType=(s=r.channel_type)!==null&&s!==void 0?s:Ze.GROUP,o.member=new Ke(o._iid,r.user),o.deliveryAt=r.ts,o}return T(n,e),n}(Wn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(ms||(ms={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(Rr||(Rr={})),function(e){e.ALL="all",e.SUPER="super",e.NON_SUPER="nonsuper",e.BROADCAST_ONLY="broadcast_only",e.EXCLUSIVE_ONLY="exclusive_only"}(Ur||(Ur={})),function(e){e.ALL="all",e.UNREAD_MESSAGE="unread_message"}(No||(No={})),function(e){e.ALL="all",e.UNHIDDEN="unhidden_only",e.HIDDEN="hidden_only",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(zi||(zi={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(cf||(cf={})),function(e){e.AND="AND",e.OR="OR"}(Us||(Us={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(Fc||(Fc={}));var Tn,NS=function(){function e(n){var t,r,i,s,o,a,l,u,c,d,h,f,p,m;this._searchFilter=null,this._userIdsFilter=null,this.includeEmpty=(t=n==null?void 0:n.includeEmpty)!==null&&t!==void 0&&t,this.nicknameContainsFilter=(r=n==null?void 0:n.nicknameContainsFilter)!==null&&r!==void 0?r:null,this.nicknameStartsWithFilter=(i=n==null?void 0:n.nicknameStartsWithFilter)!==null&&i!==void 0?i:null,this.nicknameExactMatchFilter=(s=n==null?void 0:n.nicknameExactMatchFilter)!==null&&s!==void 0?s:null,this.channelNameContainsFilter=(o=n==null?void 0:n.channelNameContainsFilter)!==null&&o!==void 0?o:"",this.myMemberStateFilter=(a=n==null?void 0:n.myMemberStateFilter)!==null&&a!==void 0?a:Rr.ALL,this.customTypesFilter=(l=n==null?void 0:n.customTypesFilter)!==null&&l!==void 0?l:null,this.channelUrlsFilter=(u=n==null?void 0:n.channelUrlsFilter)!==null&&u!==void 0?u:null,this.superChannelFilter=(c=n==null?void 0:n.superChannelFilter)!==null&&c!==void 0?c:Ur.ALL,this.publicChannelFilter=(d=n==null?void 0:n.publicChannelFilter)!==null&&d!==void 0?d:ms.ALL,this.customTypeStartsWithFilter=(h=n==null?void 0:n.customTypeStartsWithFilter)!==null&&h!==void 0?h:null,this.unreadChannelFilter=(f=n==null?void 0:n.unreadChannelFilter)!==null&&f!==void 0?f:No.ALL,this.hiddenChannelFilter=(p=n==null?void 0:n.hiddenChannelFilter)!==null&&p!==void 0?p:zi.UNHIDDEN,this.includeFrozen=(m=n==null?void 0:n.includeFrozen)===null||m===void 0||m,n!=null&&n.createdAfter&&(this.createdAfter=n.createdAfter),n!=null&&n.createdBefore&&(this.createdBefore=n.createdBefore)}return e.prototype._isFriend=function(n){return!(!n||!n.friendDiscoveryKey&&!n.friendName)},Object.defineProperty(e.prototype,"searchFilter",{get:function(){return this._searchFilter},enumerable:!1,configurable:!0}),e.prototype.setSearchFilter=function(n,t){Array.isArray(n)&&n.length!==0&&typeof t=="string"&&t&&(this._searchFilter={query:t,fields:n})},Object.defineProperty(e.prototype,"userIdsFilter",{get:function(){return this._userIdsFilter},enumerable:!1,configurable:!0}),e.prototype.setUserIdsFilter=function(n,t,r){r===void 0&&(r=Us.AND),this._userIdsFilter={userIds:n,includeMode:t,queryType:r}},e.prototype.clone=function(){var n,t=new e;this.searchFilter&&t.setSearchFilter(this.searchFilter.fields,(n=this.searchFilter.query)!==null&&n!==void 0?n:void 0),this.userIdsFilter&&t.setUserIdsFilter(this.userIdsFilter.userIds,this.userIdsFilter.includeMode,this.userIdsFilter.queryType);var r=JSON.parse(JSON.stringify(this));return Object.keys(r).forEach(function(i){t[i]=r[i]}),t},e.prototype.match=function(n,t){if(this._searchFilter){var r=this._searchFilter,i=r.query,s=r.fields;if(i&&s&&s.length>0&&!s.some(function(p){switch(p){case Fc.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case Fc.MEMBER_NICKNAME:return n.members.some(function(m){return m.nickname.toLowerCase().includes(i.toLowerCase())});default:return!0}}))return!1}if(this._userIdsFilter){var o=this._userIdsFilter,a=o.userIds,l=o.includeMode,u=o.queryType,c=n.members.map(function(p){return p.userId});if(l){if(a.length>0)switch(u){case Us.AND:if(a.some(function(p){return!c.includes(p)}))return!1;break;case Us.OR:if(a.every(function(p){return!c.includes(p)}))return!1}}else if(a.includes(t)||a.push(t),n.members.length>a.length||!P4(a,c))return!1}if(!this.includeEmpty&&!n.lastMessage||!this.includeFrozen&&n.isFrozen||this.customTypesFilter&&this.customTypesFilter.length>0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(n.customType)||this.customTypeStartsWithFilter&&!new RegExp("^".concat(this.customTypeStartsWithFilter)).test(n.customType)||this.channelNameContainsFilter&&!n.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase()))return!1;if(this.nicknameContainsFilter){var d=this.nicknameContainsFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().includes(d)}))return!1}if(this.nicknameStartsWithFilter){var h=this.nicknameStartsWithFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase().startsWith(h)}))return!1}if(this.nicknameExactMatchFilter){var f=this.nicknameExactMatchFilter.toLowerCase();if(!n.members.some(function(p){return p.userId!==t&&p.nickname.toLowerCase()!=f}))return!1}if(this.channelUrlsFilter&&this.channelUrlsFilter.length>0&&!this.channelUrlsFilter.includes(n.url))return!1;if(this.myMemberStateFilter)switch(this.myMemberStateFilter){case Rr.ALL:if(n.myMemberState==="none")return!1;break;case Rr.JOINED:if(n.myMemberState!=="joined")return!1;break;case Rr.INVITED:if(n.myMemberState!=="invited")return!1;break;case Rr.INVITED_BY_FRIEND:if(n.myMemberState!=="invited"||!this._isFriend(n.inviter))return!1;break;case Rr.INVITED_BY_NON_FRIEND:if(n.myMemberState!=="invited"||this._isFriend(n.inviter))return!1}if(this.hiddenChannelFilter)switch(this.hiddenChannelFilter){case zi.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case zi.HIDDEN:if(!n.isHidden)return!1;break;case zi.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case zi.HIDDEN_PREVENT_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_prevent_auto_unhide")return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===No.UNREAD_MESSAGE&&n.unreadMessageCount===0)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case ms.PUBLIC:if(!n.isPublic)return!1;break;case ms.PRIVATE:if(n.isPublic)return!1}if(this.superChannelFilter)switch(this.superChannelFilter){case Ur.SUPER:if(!n.isSuper)return!1;break;case Ur.NON_SUPER:if(n.isSuper)return!1}return!(this.createdAfter&&n.createdAtthis.createdBefore)},e}(),NO=function(e){function n(t,r){var i=r.sdkState,s=r.cacheContext,o=e.call(this,t)||this;return o._channels=new Map,o._sdkState=i,o._cacheContext=s,o}return T(n,e),Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return K(!!t).throw(L.databaseError),t.collection(_S)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),n.prototype._serialize=function(t,r){return r===void 0&&(r=0),M(M({},t.serialize()),{lastMessageUpdatedAt:t.lastMessage?t.lastMessage.createdAt:0,syncIndex:r})},n.prototype._deserialize=function(t){return Nn.of(this._iid).buildGroupChannelFromSerializedData(t)},Object.defineProperty(n.prototype,"channels",{get:function(){return Pe([],Ae(this._channels.values()),!1)},enumerable:!1,configurable:!0}),n.prototype.isCachedInMemory=function(t){return this._channels.has(t)},n.prototype.filterOffsetChanged=function(t){var r=this;return t.filter(function(i){if(r._channels.has(i.url))return r._channels.get(i.url).messageOffsetTimestamp0||h&&h===E.url)return!1;break;case Pt.CHRONOLOGICAL:if(!a&&E.createdAt>r||a&&E.createdAtr||a&&E.lastMessageUpdatedAtu._messageCollectionLastAccessedAt&&Object.assign(u,{_messageCollectionLastAccessedAt:void 0}),u.cachedMetaData&&r&&(c._updateCachedMetaData(u.cachedMetaData,r),Object.assign(u,{_cachedMetaData:void 0})),c._update(u),i.push(c)}else a._channels.set(u.url,u),i.push(u)}),!this.localCacheEnabled)return[3,2];for(s=[],o=0;o0?[4,this.upsert(s)]:[3,2];case 1:R.sent(),R.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!0)];case 1:return i.sent(),[2]}})})},n.prototype.unblock=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._setBlockStateOfAllChannels(t,r,!1)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(t,r){return r===void 0&&(r=Pe([],Ae(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=ve(r),o=s.next(),h.label=2;case 2:return o.done?[3,5]:(a=o.value,[4,this.get(a)]);case 3:(l=h.sent())!=null&&l._updateUnreadMemberState(this._sdkState.userId,t)&&(l._updateUnreadCount(0,0),i.push(l)),h.label=4;case 4:return o=s.next(),[3,2];case 5:return[3,8];case 6:return u=h.sent(),c={error:u},[3,8];case 7:try{o&&!o.done&&(d=s.return)&&d.call(s)}finally{if(c)throw c.error}return[7];case 8:return i.length>0?[4,this.upsert(i)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2]}})})},n}(Wn),ph={invitedUserIds:void 0,channelUrl:void 0,coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isSuper:void 0,isBroadcast:void 0,isExclusive:void 0,isPublic:void 0,isDiscoverable:void 0,isStrict:void 0,isEphemeral:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},pm=function(e){return We("string",e.invitedUserIds,!0)&&k("string",e.channelUrl,!0)&&k("string",e.coverUrl,!0)&&(fr(e.coverImage)||k("string",e.coverImage,!0))&&k("boolean",e.isDistinct,!0)&&k("boolean",e.isSuper,!0)&&k("boolean",e.isBroadcast,!0)&&k("boolean",e.isExclusive,!0)&&k("boolean",e.isPublic,!0)&&k("boolean",e.isStrict,!0)&&k("boolean",e.isDiscoverable,!0)&&k("boolean",e.isEphemeral,!0)&&k("string",e.accessCode,!0)&&k("string",e.name,!0)&&k("string",e.data,!0)&&k("string",e.customType,!0)&&We("string",e.operatorUserIds,!0)&&k("number",e.messageSurvivalSeconds,!0)},df={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},_m=function(e){return We("string",e.customTypes,!0)&&k("boolean",e.includeEmpty)&&k("boolean",e.includeFrozen)&&k("boolean",e.includeChatNotification)},IS={myMemberStateFilter:Rr.ALL},AS=function(e){return Ge(Rr,e.myMemberStateFilter)};(function(e){e.GROUP_CHANNEL_UNREAD_MENTION_COUNT="group_channel_unread_mention_count",e.NONSUPER_UNREAD_MENTION_COUNT="non_super_group_channel_unread_mention_count",e.SUPER_UNREAD_MENTION_COUNT="super_group_channel_unread_mention_count",e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT="group_channel_unread_message_count",e.NONSUPER_UNREAD_MESSAGE_COUNT="non_super_group_channel_unread_message_count",e.SUPER_UNREAD_MESSAGE_COUNT="super_group_channel_unread_message_count",e.GROUP_CHANNEL_INVITATION_COUNT="group_channel_invitation_count",e.NONSUPER_INVITATION_COUNT="non_super_group_channel_invitation_count",e.SUPER_INVITATION_COUNT="super_group_channel_invitation_count"})(Tn||(Tn={}));var IO={keys:[]},AO={channelCustomTypesFilter:void 0,superChannelFilter:Ur.ALL},MO=function(e){return We("string",e.channelCustomTypesFilter,!0)&&Ge(Ur,e.superChannelFilter)},xO={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:er.ALL};M({},G);var _h=function(e){return e.startsWith("EVENT_")||e===G.SYNC_CHANNEL_CHANGELOGS||e===G.REFRESH_CHANNEL},Ve=function(e){function n(t){var r=t.channels,i=t.context,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=t.ts,l=e.call(this)||this;return l.channels=r,l.context=i,l.isWebSocketEventComing=o,l.ts=a,l}return T(n,e),n}(Tt),Ss=function(e){function n(t){var r=t.channelUrls,i=t.context,s=t.isWebSocketEventComing,o=s!==void 0&&s,a=e.call(this)||this;return a.channelUrls=r,a.context=i,a.isWebSocketEventComing=o,a}return T(n,e),n}(Tt),OO=function(){function e(n){var t=n.groupChannelCache,r=n.messageCache,i=n.unsentMessageCache,s=n.dispatcher,o=this;this._observers=new Map,s.on(function(a){return y(o,void 0,void 0,function(){var l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x=this;return g(this,function(U){switch(U.label){case 0:if(!(a instanceof Ve))return[3,19];if(l=a.channels,S=a.context,w=a.isWebSocketEventComing,u=l.filter(function(q){return q instanceof di}),S.source!==G.EVENT_CHANNEL_RESET_HISTORY&&S.source!==G.EVENT_CHANNEL_HIDDEN)return[3,9];U.label=1;case 1:U.trys.push([1,6,7,8]),c=ve(u),d=c.next(),U.label=2;case 2:return d.done?[3,5]:(b=d.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 3:U.sent(),U.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return h=U.sent(),N={error:h},[3,8];case 7:try{d&&!d.done&&(I=c.return)&&I.call(c)}finally{if(N)throw N.error}return[7];case 8:return[3,17];case 9:f=t.filterOffsetChanged(u),U.label=10;case 10:U.trys.push([10,15,16,17]),p=ve(f),m=p.next(),U.label=11;case 11:return m.done?[3,14]:(b=m.value,[4,r.removeUnderOffset(b.url,b.messageOffsetTimestamp)]);case 12:U.sent(),U.label=13;case 13:return m=p.next(),[3,11];case 14:return[3,17];case 15:return v=U.sent(),R={error:v},[3,17];case 16:try{m&&!m.done&&(A=p.return)&&A.call(p)}finally{if(R)throw R.error}return[7];case 17:return[4,t.upsert(u,a.ts)];case 18:return _=U.sent(),w||this._broadcastUpdateEvent(_,S),[3,24];case 19:return a instanceof Ss?(E=a.channelUrls,S=a.context,w=a.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,Ot(function(){return y(x,void 0,void 0,function(){var q,P,X,z,H,Se;return g(this,function(V){switch(V.label){case 0:V.trys.push([0,6,7,8]),q=ve(E),P=q.next(),V.label=1;case 1:return P.done?[3,5]:(X=P.value,[4,r.removeMessagesOfChannel(X)]);case 2:return V.sent(),[4,i.removeMessagesOfChannel(X)];case 3:V.sent(),V.label=4;case 4:return P=q.next(),[3,1];case 5:return[3,8];case 6:return z=V.sent(),H={error:z},[3,8];case 7:try{P&&!P.done&&(Se=q.return)&&Se.call(q)}finally{if(H)throw H.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),w||this._broadcastRemoveEvent(E,S),[3,24];case 22:return a instanceof SS?[4,t.fetch({token:Number.MAX_SAFE_INTEGER,limit:Number.MAX_SAFE_INTEGER})]:[3,24];case 23:U.sent(),U.label=24;case 24:return[2]}})})})}return e.prototype._broadcastUpdateEvent=function(n,t){var r,i;try{for(var s=ve(this._observers.values()),o=s.next();!o.done;o=s.next()){var a=o.value;a.onUpdate&&a.onUpdate(n,t)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype._broadcastRemoveEvent=function(n,t){var r,i;try{for(var s=ve(this._observers.values()),o=s.next();!o.done;o=s.next()){var a=o.value;a.onRemove&&a.onRemove(n,t)}}catch(l){r={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.subscribe=function(n,t){this._observers.set(n,t)},e.prototype.unsubscribe=function(n){this._observers.delete(n)},e.prototype.unsubscribeAll=function(){this._observers.clear()},e}(),kO=function(e){function n(t){var r=t.userId,i=t.ts,s=t.token,o=t.filter,a=t.includeChatNotification,l=a!==void 0&&a,u=e.call(this)||this,c=M(M({},df),o),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Q.GET,u.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=Ee(Ne({show_delivery_receipt:!0,show_member:!0,show_read_receipt:!0,change_ts:i||null,token:s,custom_types:d,show_empty:h,show_frozen:f,include_chat_notification:l})),u}return T(n,e),n}(Y),RO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedChannels=r.updated.map(function(s){return new di(t,Object.assign(s,{ts:r.ts}))}),i.deletedChannelUrls=r.deleted,i.hasMore=r.has_more,i.token=r.next,i.ts=r.ts,i}return T(n,e),n}(ae),mm=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(i?G4:ir,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return T(n,e),n}(Y),vm=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),Wa={includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1,channelUrlsFilter:void 0,customTypesFilter:void 0,customTypeStartsWithFilter:void 0,nicknameContainsFilter:void 0,nicknameStartsWithFilter:void 0,nicknameExactMatchFilter:void 0,channelNameContainsFilter:void 0,myMemberStateFilter:Rr.ALL,unreadChannelFilter:No.ALL,superChannelFilter:Ur.ALL,publicChannelFilter:ms.ALL,hiddenChannelFilter:zi.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:Us.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:Pt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},LO=function(e){function n(t){var r=this,i=t.userId,s=t.token,o=t.limit,a=t.order,l=t.includeEmpty,u=t.myMemberStateFilter,c=t.superChannelFilter,d=t.publicChannelFilter,h=t.unreadChannelFilter,f=t.nicknameContainsFilter,p=t.nicknameStartsWithFilter,m=t.nicknameExactMatchFilter,b=t.channelNameContainsFilter,v=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,w=t.metadataOrderKeyFilter,N=t.metadataKey,I=t.metadataValues,R=t.metadataValueStartsWith,A=t.includeFrozen,x=t.includeMetaData,U=t.searchFilter,q=t.userIdsFilter,P=t.includeChatNotification,X=P!==void 0&&P,z=t.includeLeftChannel,H=z!==void 0&&z,Se=t.createdAfter,V=t.createdBefore;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Xe,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=Ee({token:s,limit:o,order:a??Wa.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Wa.includeEmpty,member_state_filter:u??Wa.myMemberStateFilter,super_mode:c??Wa.superChannelFilter,public_mode:d??Wa.publicChannelFilter,unread_filter:h??Wa.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:v,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:w,metadata_key:N,metadata_values:I,metadata_value_startswith:R,show_frozen:A,show_metadata:x,include_chat_notification:X,include_left_channel:H,created_after:Se,created_before:V}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),q&&q.userIds&&q.userIds.length>0&&(q.includeMode?(r.params.members_include_in=q.userIds,r.params.query_type=q.queryType.toUpperCase()):r.params.members_exactly_in=q.userIds),r}return T(n,e),n}(Y),DO=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,o=r.channels,a=r.ts;return i.token=s,o&&o.length>0&&(i.channels=o.map(function(l){return l.ts=a,new di(t,l)})),i.ts=a??0,i}return T(n,e),n}(ae),UO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.myMemberStateFilter;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:o??Rr.ALL},s}return T(n,e),n}(Y),PO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.groupChannelCount=r.group_channel_count,i}return T(n,e),n}(ae),FO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.keys;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=Ee({item_keys:o}),s}return T(n,e),n}(Y),HO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return typeof r[Tn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]=="number"&&(i.groupChannelUnreadMentionCount=r[Tn.GROUP_CHANNEL_UNREAD_MENTION_COUNT]),typeof r[Tn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]=="number"&&(i.groupChannelUnreadMessageCount=r[Tn.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]),typeof r[Tn.GROUP_CHANNEL_INVITATION_COUNT]=="number"&&(i.groupChannelInvitationCount=r[Tn.GROUP_CHANNEL_INVITATION_COUNT]),typeof r[Tn.SUPER_UNREAD_MENTION_COUNT]=="number"&&(i.superGroupChannelUnreadMentionCount=r[Tn.SUPER_UNREAD_MENTION_COUNT]),typeof r[Tn.SUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.superGroupChannelUnreadMessageCount=r[Tn.SUPER_UNREAD_MESSAGE_COUNT]),typeof r[Tn.SUPER_INVITATION_COUNT]=="number"&&(i.superGroupChannelInvitationCount=r[Tn.SUPER_INVITATION_COUNT]),typeof r[Tn.NONSUPER_UNREAD_MENTION_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMentionCount=r[Tn.NONSUPER_UNREAD_MENTION_COUNT]),typeof r[Tn.NONSUPER_UNREAD_MESSAGE_COUNT]=="number"&&(i.nonSuperGroupChannelUnreadMessageCount=r[Tn.NONSUPER_UNREAD_MESSAGE_COUNT]),typeof r[Tn.NONSUPER_INVITATION_COUNT]=="number"&&(i.nonSuperGroupChannelInvitationCount=r[Tn.NONSUPER_INVITATION_COUNT]),i}return T(n,e),n}(ae),jO=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return T(n,e),n}(Y),BO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i}return T(n,e),n}(ae),$O=function(e){function n(t){var r=t.userId,i=t.filter,s=t.includeFeedChannel,o=s!==void 0&&s,a=e.call(this)||this,l=i.channelCustomTypesFilter,u=i.superChannelFilter;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_message_count"),a.params={super_mode:u??Ur.ALL,custom_types:l,include_feed_channel:o},a}return T(n,e),n}(Y),GO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.unreadCount=r.unread_count,i.unreadFeedCount=r.unread_feed_count,i}return T(n,e),n}(ae),zO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,o=e.call(this)||this;return o.method=Q.GET,o.path="".concat(oC,"/count"),o.params={channel_url:r,status:qO(i)},s&&(o.params.message_type=s),o}return T(n,e),n}(Y),VO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.count=r.count,i}return T(n,e),n}(ae),qO=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case uo.PENDING:n.push(ri.PENDING);break;case uo.SENT:n.push(ri.IN_QUEUE),n.push(ri.SENT);break;case uo.CANCELED:n.push(ri.CANCELED);break;case uo.FAILED:n.push(ri.FAILED)}}),n},WO=function(e){function n(t){var r=this,i=t.userId,s=t.channelUrl,o=t.coverUrl,a=t.coverImage,l=t.isDistinct,u=t.isSuper,c=t.isBroadcast,d=t.isPublic,h=t.isExclusive,f=t.isDiscoverable,p=t.isStrict,m=t.isEphemeral,b=t.accessCode,v=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,w=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Q.POST,r.path=ir,r.params=Ee({user_ids:Pe([i],Ae(w??[]),!1).filter(function(I,R,A){return R===A.indexOf(I)}),channel_url:s,cover_url:o,cover_file:a,is_distinct:l,is_super:u,is_broadcast:c,is_exclusive:h,is_public:d,is_discoverable:f,strict:p,is_ephemeral:m,access_code:b,name:v,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return T(n,e),n}(Y),KO=function(e){function n(t,r){var i,s=this;return(s=e.call(this,t,r)||this).channel=new di(t,r),s.isCreated=(i=r.is_created)===null||i===void 0||i,s}return T(n,e),n}(ae),cy=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var QO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(Y),YO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),ZO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u,d=o.users,h=d===void 0?null:d;return s.memberCount=l,s.joinedMemberCount=c,s.members=Array.isArray(h)?h.map(function(f){return new ii(t,f)}):[new ii(t,i.data)],s}return T(n,e),n}(Kl),XO=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:o},r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var JO=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u;return s.memberCount=l,s.joinedMemberCount=c,s.member=new ii(s._iid,i.data),s}return T(n,e),n}(Kl),ek=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Q.POST,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return T(n,e),n}(Y),tk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),nk=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this;s.inviter=null;var o=i.data,a=o.member_count,l=a===void 0?0:a,u=o.joined_member_count,c=u===void 0?0:u,d=o.inviter,h=o.invitees,f=h===void 0?[]:h;return s.memberCount=l,s.joinedMemberCount=c,d&&Object.keys(d).length>0&&(s.inviter=new Ke(t,d)),s.invitees=f.map(function(p){return new ii(t,p)}),s}return T(n,e),n}(Kl),rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Bt.NONE,i}T(n,e)})(ae);var ik=function(e){function n(t,r,i){var s=e.call(this,t,r,i)||this,o=i.data,a=o.member_count,l=o.joined_member_count,u=o.inviter,c=o.invitee;return s.memberCount=a??0,s.joinedMemberCount=l??0,s.inviter=new Ke(t,u),s.invitee=new ii(t,c),s}return T(n,e),n}(Kl),gm={hidePreviousMessages:!1,allowAutoUnhide:!0},sk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.hidePreviousMessages,a=t.allowAutoUnhide;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:o??gm.hidePreviousMessages,allow_auto_unhide:a??gm.allowAutoUnhide},r}return T(n,e),n}(Y),ok=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(ae),ak=function(e){function n(t,r,i){var s,o,a,l=this;return(l=e.call(this,t,"SYEV",i)||this).allowAutoUnhide=null,l.hidePreviousMessages=null,l.messageOffsetTimestamp=null,i.data&&(l.allowAutoUnhide=(s=i.data.allow_auto_unhide)!==null&&s!==void 0?s:null,l.hidePreviousMessages=(o=i.data.hide_previous_messages)!==null&&o!==void 0?o:null),l.messageOffsetTimestamp=(a=i.ts_message_offset)!==null&&a!==void 0?a:null,l}return T(n,e),n}(mt),lk=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPST",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(wr),uk=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ke(t,i.data),s}return T(n,e),n}(mt),ck=function(e){function n(t){var r=t.channelUrl,i=t.time;return e.call(this,{code:"TPEN",ackRequired:!1,payload:{channel_url:r,time:i}})||this}return T(n,e),n}(wr),dk=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Ke(t,i.data),s}return T(n,e),n}(mt),hk=function(e){function n(t){var r=t.channelUrl,i=t.messageId;return e.call(this,{code:"MACK",ackRequired:!1,payload:{channel_url:r,msg_id:i}})||this}return T(n,e),n}(wr),MS=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U=this;return(U=e.call(this,t,r)||this).includeEmpty=!1,U.includeFrozen=!0,U.includeMetaData=!0,U.includeChatNotification=!1,U.channelUrlsFilter=null,U.customTypesFilter=null,U.customTypeStartsWithFilter=null,U.nicknameContainsFilter=null,U.nicknameStartsWithFilter=null,U.nicknameExactMatchFilter=null,U.channelNameContainsFilter="",U.myMemberStateFilter=Rr.ALL,U.unreadChannelFilter=No.ALL,U.superChannelFilter=Ur.ALL,U.publicChannelFilter=ms.ALL,U.hiddenChannelFilter=zi.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:Us.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=Pt.LATEST_LAST_MESSAGE,U.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,U.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,U.includeMetaData=(o=r.includeMetaData)===null||o===void 0||o,U.includeChatNotification=(a=r.includeChatNotification)!==null&&a!==void 0&&a,U.channelUrlsFilter=(l=r.channelUrlsFilter)!==null&&l!==void 0?l:null,U.customTypesFilter=(u=r.customTypesFilter)!==null&&u!==void 0?u:null,U.customTypeStartsWithFilter=(c=r.customTypeStartsWithFilter)!==null&&c!==void 0?c:"",U.nicknameContainsFilter=(d=r.nicknameContainsFilter)!==null&&d!==void 0?d:null,U.nicknameStartsWithFilter=(h=r.nicknameStartsWithFilter)!==null&&h!==void 0?h:null,U.nicknameExactMatchFilter=(f=r.nicknameExactMatchFilter)!==null&&f!==void 0?f:null,U.channelNameContainsFilter=(p=r.channelNameContainsFilter)!==null&&p!==void 0?p:"",U.myMemberStateFilter=(m=r.myMemberStateFilter)!==null&&m!==void 0?m:Rr.ALL,U.unreadChannelFilter=(b=r.unreadChannelFilter)!==null&&b!==void 0?b:No.ALL,U.superChannelFilter=(v=r.superChannelFilter)!==null&&v!==void 0?v:Ur.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:ms.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:zi.UNHIDDEN,U.searchFilter=(S=r.searchFilter)!==null&&S!==void 0?S:{fields:[],query:null},U.userIdsFilter=(w=r.userIdsFilter)!==null&&w!==void 0?w:{userIds:[],includeMode:!0,queryType:Us.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(I=r.metadataValues)!==null&&I!==void 0?I:null,U.metadataOrderKeyFilter=(R=r.metadataOrderKeyFilter)!==null&&R!==void 0?R:null,U.metadataValueStartsWith=(A=r.metadataValueStartsWith)!==null&&A!==void 0?A:null,U.order=(x=r.order)!==null&&x!==void 0?x:Pt.LATEST_LAST_MESSAGE,r.createdAfter&&(U.createdAfter=r.createdAfter),r.createdBefore&&(U.createdBefore=r.createdBefore),U}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter)&&k("string",this.nicknameContainsFilter,!0)&&k("string",this.nicknameStartsWithFilter,!0)&&k("string",this.nicknameExactMatchFilter,!0)&&Ge(Rr,this.myMemberStateFilter)&&Ge(Ur,this.superChannelFilter)&&Ge(ms,this.publicChannelFilter)&&Ge(No,this.unreadChannelFilter)&&Ge(zi,this.hiddenChannelFilter)&&We(Fc,this.searchFilter.fields)&&k("string",this.searchFilter.query,!0)&&We("string",this.userIdsFilter.userIds)&&k("boolean",this.userIdsFilter.includeMode)&&Ge(Us,this.userIdsFilter.queryType)&&Ge(Pt,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)&&Q2(this.createdAfter,!0)&&Q2(this.createdBefore,!0)},n.prototype.serialize=function(){return Kc(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ne(M({},this)),this.limit,G.REQUEST_CHANNEL,!0)]):[3,2]:[3,5];case 1:return t=s.sent(),r=t.channels,i=t.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,r];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),fk=function(e){function n(t,r,i){var s,o=this;return(o=e.call(this,t,"SYEV",i)||this).pinnedMessageIds=[],o.latestPinnedMessage=null,o.ts=0,i.data&&(o.pinnedMessageIds=(s=i.data.pinned_message_ids)!==null&&s!==void 0?s:[],o.latestPinnedMessage=i.data.latest_pinned_message?vr(t,M({},i.data.latest_pinned_message)):null),o.ts=i.ts,o}return T(n,e),n}(mt),pk=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(ir,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=Ee({userId:i}),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var Is,_k=function(e){function n(t,r,i){var s=e.call(this,t,"DLVR",i)||this;return s.channelUrl=i.channel_url,s.deliveredStateUpdate=i.updated,s}return T(n,e),n}(mt),cs=function(){function e(n){var t=n.top,r=t===void 0?Number.MAX_SAFE_INTEGER:t,i=n.bottom,s=i===void 0?0:i;this.top=r,this.bottom=s}return e.prototype.includes=function(){for(var n=this,t=[],r=0;r0&&je.onMentionReceived&&je.onMentionReceived(m,f)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=6;case 6:return[3,79];case 7:return S=t.as(tA),be=S.channelUrl,$e=S.channelType,w=S.messageId,N=S.silent,I=S.messageCreatedAt,R=S.senderId,$e!==Ze.GROUP?[3,9]:[4,this.getChannel(be,!0)];case 8:A=Ye.sent(),x=R===this._sdkState.userId,N||x||I>0&&A.myLastRead0&&A._updateUnreadCount(A.unreadMessageCount-1,0),this._dispatcher.dispatch(new Kv({messageIds:[w],source:G.EVENT_MESSAGE_DELETED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onMessageDeleted&&je.onMessageDeleted(A,w)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=9;case 9:return[3,79];case 10:return(U=t.as(tS).readStatus).channelType!==Ze.GROUP?[3,12]:(H=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:q=Ye.sent(),H&&q._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?H?(q.unreadMessageCount>0||q.unreadMentionCount>0)&&(q._updateUnreadCount(0,0),this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})):q.unreadMessageCount!==0&&q.unreadMentionCount!==0||(this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})):(this._dispatcher.dispatch(new Ve({channels:[q],context:{source:G.EVENT_CHANNEL_READ}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onUnreadMemberStatusUpdated&&je.onUnreadMemberStatusUpdated(q)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),Ye.label=12;case 12:return[3,79];case 13:return P=t.as(_k),be=P.channelUrl,X=P.deliveredStateUpdate,z=X===void 0?{}:X,H=this._groupChannelCache.isCachedInMemory(be),[4,this.getChannel(be,!0)];case 14:return Se=Ye.sent(),H&&Object.keys(z).forEach(function(W){Se._updateUndeliveredMemberState(W,z[W])}),Object.keys(z).some(function(W){return W!==lt._sdkState.userId})&&(this._dispatcher.dispatch(new Ve({channels:[Se],context:{source:G.EVENT_CHANNEL_DELIVERED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onUndeliveredMemberStatusUpdated&&je.onUndeliveredMemberStatusUpdated(Se)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),[3,79];case 15:return V=t.as(bO),be=V.channelUrl,$e=V.channelType,J=V.event,$e!==Ze.GROUP?[3,18]:[4,this.getChannel(be,!0)];case 16:return re=Ye.sent(),[4,this.getMessageFromCache(J.messageId)];case 17:(oe=Ye.sent())?oe instanceof dr&&(oe.applyReactionEvent(J),this._dispatcher.dispatch(new Et({messages:[oe],source:G.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new jC({event:J,source:G.EVENT_MESSAGE_REACTION_UPDATED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onReactionUpdated&&je.onReactionUpdated(re,J)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=18;case 18:return[3,79];case 19:return(we=t.as(CO).event).channelType!==Ze.GROUP?[3,22]:[4,this.getChannel(we.channelUrl,!0)];case 20:return Z=Ye.sent(),[4,this.getMessageFromCache(we.targetMessageId)];case 21:(oe=Ye.sent())?oe instanceof dr&&(oe.applyThreadInfoUpdateEvent(we),this._dispatcher.dispatch(new Et({messages:[oe],source:G.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new BC({event:we,source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onThreadInfoUpdated&&je.onThreadInfoUpdated(Z,we)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=22;case 22:return[3,79];case 23:ee=t.as(SO).groupChannelMemberCounts,ue=[],Ye.label=24;case 24:Ye.trys.push([24,29,30,31]),$=ve(ee),ke=$.next(),Ye.label=25;case 25:return ke.done?[3,28]:(B=ke.value,be=B.channelUrl,nn=B.memberCount,rn=B.joinedMemberCount,se=B.updatedAt,[4,this.getChannelFromCache(be)]);case 26:(ce=Ye.sent())&&ce._setLatestMemberCount(nn,rn,se)&&ue.push(ce),Ye.label=27;case 27:return ke=$.next(),[3,25];case 28:return[3,31];case 29:return ye=Ye.sent(),S0={error:ye},[3,31];case 30:try{ke&&!ke.done&&(Tg=$.return)&&Tg.call($)}finally{if(S0)throw S0.error}return[7];case 31:return ue.length>0&&(this._dispatcher.dispatch(new Ve({channels:ue,context:{source:G.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelMemberCountChanged&&je.onChannelMemberCountChanged(ue)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})})),[3,79];case 32:return ie=t.as(TO),de=ie.event,he=ie.status,be=ie.channelUrl,$e=ie.channelType,be&&$e===Ze.GROUP?[4,this.getChannel(be,!0)]:[3,34];case 33:me=Ye.sent(),this._dispatcher.dispatch(new zC({event:de,source:G.EVENT_POLL_UPDATED})),De(he===N6?function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollDeleted&&je.onPollDeleted(me,de.pollId)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}:function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollUpdated&&je.onPollUpdated(me,de)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=34;case 34:return[3,79];case 35:return _e=t.as(fS),fe=_e.event,be=_e.channelUrl,$e=_e.channelType,be&&$e===Ze.GROUP?[4,this.getChannel(be,!0)]:[3,37];case 36:le=Ye.sent(),this._dispatcher.dispatch(new Qv({event:fe,source:G.EVENT_POLL_VOTED})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onPollVoted&&je.onPollVoted(le,fe)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),Ye.label=37;case 37:return[3,79];case 38:if(!(te=t.as(Kl).event).isGroupChannelEvent)return[3,77];switch(te.category){case Yt.CHANNEL_JOIN:return[3,39];case Yt.CHANNEL_LEAVE:return[3,41];case Yt.CHANNEL_OPERATOR_UPDATE:return[3,45];case Yt.CHANNEL_INVITE:return[3,47];case Yt.CHANNEL_DECLINE_INVITE:return[3,49];case Yt.TYPING_START:case Yt.TYPING_END:return[3,51];case Yt.USER_CHANNEL_MUTE:case Yt.USER_CHANNEL_UNMUTE:return[3,53];case Yt.USER_CHANNEL_BAN:return[3,55];case Yt.USER_CHANNEL_UNBAN:return[3,59];case Yt.CHANNEL_FREEZE:case Yt.CHANNEL_UNFREEZE:return[3,61];case Yt.CHANNEL_HIDE:return[3,63];case Yt.CHANNEL_UNHIDE:return[3,65];case Yt.CHANNEL_DELETED:return[3,67];case Yt.CHANNEL_PROP_CHANGED:return[3,69];case Yt.CHANNEL_META_DATA_CHANGED:return[3,71];case Yt.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case Yt.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(te.channelUrl,!0)];case 40:return Me=Ye.sent(),Re=t.as(ZO),ne=Re.memberCount,Oe=Re.joinedMemberCount,nt=Re.members,Qe=!1,nt.forEach(function(W){Me.isExclusive||Me.isSuper||Me.isBroadcast?Qe=Qe||Me._setLatestMemberCount(ne,Oe,te.ts):(W.state=Bt.JOINED,Me.addMember(W,te.ts),lt._updateJoinedMemberCount(Me)),W.userId===lt._sdkState.userId&&(Me.myMemberState=Bt.JOINED)}),this._dispatcher.dispatch(new Ve({channels:[Me],context:{source:G.EVENT_CHANNEL_JOINED,users:nt}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){var je,Le;try{for(var Be=ve(nt),Lt=Be.next();!Lt.done;Lt=Be.next()){var ct=Lt.value;j.onUserJoined&&j.onUserJoined(Me,ct)}}catch(iw){je={error:iw}}finally{try{Lt&&!Lt.done&&(Le=Be.return)&&Le.call(Be)}finally{if(je)throw je.error}}Me.isBroadcast&&Qe&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Me])}),[2]})})}),[3,77];case 41:return(Hn=this._leftChannels.get(te.channelUrl))?(at=Hn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(te.channelUrl,!0)];case 43:at=Ye.sent(),Ye.label=44;case 44:return Fe=at,Ft=t.as(JO),nn=Ft.memberCount,rn=Ft.joinedMemberCount,_t=Ft.member,ln=!1,kt=O.of(this._iid).appInfo,Fe.isExclusive||Fe.isSuper||Fe.isBroadcast?ln=Fe._setLatestMemberCount(nn,rn,te.ts):(kt!=null&&kt.enabledChannelMemberShipHistory?((Wt=Fe.members.find(function(W){return W.userId===_t.userId}))&&(Wt.state=Bt.LEFT),Fe.memberCount=nn):Fe.removeMember(_t),this._updateJoinedMemberCount(Fe)),_t.userId===this._sdkState.userId?(Fe.myMemberState=Bt.NONE,Fe.invitedAt=0,Fe.joinedAt=0,Fe._updateUnreadCount(0,0),Fe.isPublic?this._dispatcher.dispatch(new Ve({channels:[Fe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})):(this._markAsLeave(Fe),this._dispatcher.dispatch(new Ss({channelUrls:[Fe.url],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})))):this._dispatcher.dispatch(new Ve({channels:[Fe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(Fe,_t),Fe.isBroadcast&&ln&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Fe])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(te.channelUrl,!0)];case 46:Jt=Ye.sent(),Ct=t.as(vO).operators,en=Ct.map(function(W){return W.userId});try{for(tn=ve(Jt.members),xn=tn.next();!xn.done;xn=tn.next())(Kt=xn.value).role=en.includes(Kt.userId)?Ii.OPERATOR:Ii.NONE}catch(W){T0={error:W}}finally{try{xn&&!xn.done&&(wg=tn.return)&&wg.call(tn)}finally{if(T0)throw T0.error}}return Jt.myRole=en.includes(this._sdkState.userId)?Ii.OPERATOR:Ii.NONE,this._dispatcher.dispatch(new Ve({channels:[Jt],context:{source:G.EVENT_CHANNEL_OPERATOR_UPDATED,operators:Ct}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(Jt,Ct)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(te.channelUrl,!0)];case 48:Ht=Ye.sent(),ft=t.as(nk),nn=ft.memberCount,rn=ft.joinedMemberCount,un=ft.inviter,(Un=ft.invitees).forEach(function(W){return W.state=Bt.INVITED});try{for(Pn=ve(Un),gn=Pn.next();!gn.done;gn=Pn.next())Fn=gn.value,Ht.isExclusive||Ht.isSuper||Ht.isBroadcast?Ht._setLatestMemberCount(nn,rn,te.ts):Ht.addMember(Fn,te.ts),this._sdkState.userId===Fn.userId&&(Ht.hiddenState=cr.UNHIDDEN,Ht.myMemberState!==Bt.JOINED&&(Ht.myMemberState=Bt.INVITED),Ht.invitedAt=te.ts)}catch(W){w0={error:W}}finally{try{gn&&!gn.done&&(Ng=Pn.return)&&Ng.call(Pn)}finally{if(w0)throw w0.error}}return this._dispatcher.dispatch(new Ve({channels:[Ht],context:{source:G.EVENT_CHANNEL_INVITED,inviter:un,invitees:Un}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Ht,un,Un)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(te.channelUrl,!0)];case 50:return xt=Ye.sent(),On=t.as(ik),nn=On.memberCount,rn=On.joinedMemberCount,kn=On.inviter,yn=On.invitee,xt.isExclusive||xt.isSuper||xt.isBroadcast?xt._setLatestMemberCount(nn,rn,te.ts):xt.removeMember(yn),this._sdkState.userId===yn.userId?(xt.invitedAt=0,xt.myMemberState=Bt.NONE,xt.isPublic?this._dispatcher.dispatch(new Ve({channels:[xt],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})):this._dispatcher.dispatch(new Ss({channelUrls:[xt.url],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}}))):this._dispatcher.dispatch(new Ve({channels:[xt],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(xt,kn,yn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(te.channelUrl,!0)];case 52:return wt=Ye.sent(),Rn=te.category===Yt.TYPING_START,sr=t.as(Rn?uk:dk).user,wt._updateTypingStatus(sr,Rn?te.ts:0),this._dispatcher.dispatch(new Ve({channels:[wt],context:{source:G.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(wt)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(te.channelUrl,!0)];case 54:cn=Ye.sent(),En=te.category===Yt.USER_CHANNEL_MUTE,(bn=t.as(En?PM:HM).user).userId===this._sdkState.userId&&(cn.myMutedState=En?as.MUTED:as.UNMUTED,cn._myMutedRemainingTime=bn.restrictionInfo.remainingDuration);try{for(Rt=ve(cn.members),Cn=Rt.next();!Cn.done;Cn=Rt.next())if((Kt=Cn.value).userId===bn.userId){Kt.isMuted=En;break}}catch(W){N0={error:W}}finally{try{Cn&&!Cn.done&&(Ig=Rt.return)&&Ig.call(Rt)}finally{if(N0)throw N0.error}}return this._dispatcher.dispatch(new Ve({channels:[cn],context:{source:En?G.EVENT_CHANNEL_MUTED:G.EVENT_CHANNEL_UNMUTED,user:bn}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){En?j.onUserMuted&&j.onUserMuted(cn,bn):j.onUserUnmuted&&j.onUserUnmuted(cn,bn)}),[2]})})}),[3,77];case 55:return(Hn=this._leftChannels.get(te.channelUrl))?(or=Hn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(te.channelUrl,!0)];case 57:or=Ye.sent(),Ye.label=58;case 58:return jn=or,this._markAsLeave(jn),Ue=t.as(BM).user,Ue.userId===this._sdkState.userId&&this._dispatcher.dispatch(new Ss({channelUrls:[jn.url],context:{source:G.EVENT_CHANNEL_BANNED,user:Ue}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(jn,Ue)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(te.channelUrl,!0)];case 60:return F=Ye.sent(),pe=t.as(GM).user,pe.userId===this._sdkState.userId&&this._dispatcher.dispatch(new Ss({channelUrls:[F.url],context:{source:G.EVENT_CHANNEL_UNBANNED,user:pe}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,pe)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(te.channelUrl,!0)];case 62:return xe=Ye.sent(),ze=t.as(zM).freeze,xe.isFrozen=ze,this._dispatcher.dispatch(new Ve({channels:[xe],context:{source:ze?G.EVENT_CHANNEL_FROZEN:G.EVENT_CHANNEL_UNFROZEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){ze?j.onChannelFrozen&&j.onChannelFrozen(xe):j.onChannelUnfrozen&&j.onChannelUnfrozen(xe)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(te.channelUrl,!0)];case 64:return vt=Ye.sent(),dn=t.as(ak),Kn=dn.allowAutoUnhide,Qn=dn.hidePreviousMessages,ys=dn.messageOffsetTimestamp,Kn!==null&&(vt.hiddenState=Kn?cr.HIDDEN_ALLOW_AUTO_UNHIDE:cr.HIDDEN_PREVENT_AUTO_UNHIDE),Qn!==null&&Qn&&vt._updateUnreadCount(0,0),ys!==null&&(vt.messageOffsetTimestamp=ys),this._dispatcher.dispatch(new Ve({channels:[vt],context:{source:G.EVENT_CHANNEL_HIDDEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(vt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(te.channelUrl,!0)];case 66:return(Bn=Ye.sent()).hiddenState=cr.UNHIDDEN,this._dispatcher.dispatch(new Ve({channels:[Bn],context:{source:G.EVENT_CHANNEL_UNHIDDEN}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Bn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(te.channelUrl,!0)];case 68:return Ha=Ye.sent(),this._dispatcher.dispatch(new Ss({channelUrls:[te.channelUrl],context:{source:G.EVENT_CHANNEL_DELETED}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(Ha.url,Ha.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(te.channelUrl,!0)];case 70:return ja=Ye.sent(),this._dispatcher.dispatch(new Ve({channels:[ja],context:{source:G.EVENT_CHANNEL_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(ja)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(te.channelUrl,!0)];case 72:return Xi=Ye.sent(),Xc=t.as(NM),Ba=Xc.created,$a=Xc.updated,Ga=Xc.deleted,Ba&&(Xi._upsertCachedMetaData(Ba,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_CREATED,metaData:Ba}}))),$a&&(Xi._upsertCachedMetaData($a,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_UPDATED,metaData:$a}}))),Ga&&(Xi._removeFromCachedMetaData(Ga,te.ts),this._dispatcher.dispatch(new Ve({channels:[Xi],context:{source:G.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:Ga}}))),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){Ba&&j.onMetaDataCreated&&j.onMetaDataCreated(Xi,Ba),$a&&j.onMetaDataUpdated&&j.onMetaDataUpdated(Xi,$a),Ga&&j.onMetaDataDeleted&&j.onMetaDataDeleted(Xi,Ga)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(te.channelUrl,!0)];case 74:return Po=Ye.sent(),Jc=t.as(RM),Yl=Jc.created,Zl=Jc.updated,Xl=Jc.deleted,Yl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:Yl}})),Zl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Zl}})),Xl&&this._dispatcher.dispatch(new Ve({channels:[Po],context:{source:G.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:Xl}})),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){Yl&&j.onMetaCounterCreated&&j.onMetaCounterCreated(Po,Yl),Zl&&j.onMetaCounterUpdated&&j.onMetaCounterUpdated(Po,Zl),Xl&&j.onMetaCounterDeleted&&j.onMetaCounterDeleted(Po,Xl)}),[2]})})}),[3,77];case 75:return[4,this.getChannel(te.channelUrl,!0)];case 76:return qs=Ye.sent(),ed=t.as(fk),Eg=ed.pinnedMessageIds,bg=ed.latestPinnedMessage,(Cg=ed.ts)>qs._pinnedMessagesUpdatedAt&&(qs.pinnedMessageIds=Eg,qs.lastPinnedMessage=bg,qs._pinnedMessagesUpdatedAt=Cg,this._dispatcher.dispatch(new Ve({channels:[qs],context:{source:G.EVENT_PINNED_MESSAGE_UPDATED}})),De(function(){return y(lt,void 0,void 0,function(){var W,j,je,Le,Be;return g(this,function(Lt){try{for(W=ve(this._groupChannelHandlers.values()),j=W.next();!j.done;j=W.next())(je=j.value).onChannelChanged&&je.onChannelChanged(qs)}catch(ct){Le={error:ct}}finally{try{j&&!j.done&&(Be=W.return)&&Be.call(W)}finally{if(Le)throw Le.error}}return[2]})})}),De(function(){return y(lt,void 0,void 0,function(){return g(this,function(W){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(qs)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((g0=t.as(wS).event).category){case Pc.USER_BLOCK:y0=uf.getDataAsUserBlockEvent(this._iid,g0),td=y0.blocker,nd=y0.blockee,this._groupChannelCache.block(td.userId,nd.userId);break;case Pc.USER_UNBLOCK:E0=uf.getDataAsUserBlockEvent(this._iid,g0),td=E0.blocker,nd=E0.blockee,this._groupChannelCache.unblock(td.userId,nd.userId)}return[3,79];case 79:return[3,81];case 80:if(b0=Ye.sent(),Lr(b0))throw b0;return[3,81];case 81:return[2]}})})},n.prototype._markAsLeave=function(t){var r,i=this,s=(r=this._leftChannels.get(t.url))!==null&&r!==void 0?r:{channel:t,ref:0};s.ref++,this._leftChannels.set(t.url,s),setTimeout(function(){s.ref--,s.ref===0&&i._leftChannels.delete(t.url)},1e4)},n.prototype.addHandler=function(t,r){this._groupChannelHandlers.set(t,r)},n.prototype.removeHandler=function(t){this._groupChannelHandlers.delete(t)},n.prototype.clearHandler=function(){this._groupChannelHandlers.clear()},n.prototype.subscribeChannelEvent=function(t,r){this._groupChannelBroadcast.subscribe(t,r)},n.prototype.unsubscribeChannelEvent=function(t){this._groupChannelBroadcast.unsubscribe(t)},n.prototype._updateJoinedMemberCount=function(t){t.joinedMemberCount=t.members.filter(function(r){return r.state===Bt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:K(k("string",t)).throw(L.invalidParameters),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getChannelFromCache(t)];case 2:return(i=s.sent())?[2,i]:[3,4];case 3:return s.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(t,r)];case 5:return[2,s.sent()]}})})},n.prototype.getChannelWithoutCache=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(k("string",t)).throw(L.invalidParameters),i=new mm({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),o=s.as(vm).channel,a=o.unreadMessageCount,l=o.unreadMentionCount,o.myCountPreference){case ti.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case ti.UNREAD_MENTION_COUNT_ONLY:a=0;break;case ti.OFF:a=0,l=0}return o._updateUnreadCount(a,l),[4,this.upsertChannelsToCache([o])];case 2:return[2,u.sent()[0]]}})})},n.prototype.refreshChannel=function(t,r,i){return r===void 0&&(r=!0),i===void 0&&(i=G.REFRESH_CHANNEL),y(this,void 0,void 0,function(){var s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new mm({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return o=c.sent(),(a=o.as(vm).channel).myMemberState!==Bt.NONE?[3,2]:(this._dispatcher.dispatch(new Ss({channelUrls:[a.url],context:{source:i}})),[3,4]);case 2:return[4,this.upsertChannelsToCache([a])];case 3:l=c.sent(),this._dispatcher.dispatch(new Ve({channels:l,context:{source:i}})),c.label=4;case 4:return[3,6];case 5:return(u=c.sent()).code!==Ie.NON_AUTHORIZED&&u.code!==Ie.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new Ss({channelUrls:[t],context:{source:i}})),[3,6];case 6:return[2]}})})},n.prototype.getMyGroupChannels=function(t,r,i,s,o){return s===void 0&&(s=G.REQUEST_CHANNEL),o===void 0&&(o=!1),y(this,void 0,void 0,function(){var a,l,u,c,d,h,f,p,m;return g(this,function(b){switch(b.label){case 0:return r.createdAfter&&(r.createdAfter=Math.floor(r.createdAfter/1e3)),r.createdBefore&&(r.createdBefore=Math.floor(r.createdBefore/1e3)),a=!1,o&&(l=O.of(this._iid),u=l.appInfo,(c=l.cacheContext)&&!c.localCacheEnabled&&(u!=null&&u.enabledChannelMemberShipHistory)&&(u!=null&&u.applicationAttributes.includes("left_user_view_support"))&&(a=!0)),d=new LO(M(M({},r),{userId:this._sdkState.userId,token:t,limit:i,includeLeftChannel:o&&a})),[4,this._requestQueue.send(d)];case 1:return h=b.sent(),f=h.as(DO),p=f.channels,m=f.token,this._dispatcher.dispatch(new Ve({channels:p,context:{source:s}})),[2,{channels:p,token:m}]}})})},n.prototype.getMyGroupChannelChangeLogs=function(t,r,i){return i===void 0&&(i=G.REQUEST_CHANNEL_CHANGELOGS),y(this,void 0,void 0,function(){var s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return s=M(M({},df),r),K((k("string",t)||k("number",t))&&_m(s)).throw(L.invalidParameters),o=new kO(Ne({userId:this._sdkState.userId,ts:typeof t=="number"?t:null,token:typeof t=="string"?t:null,filter:s})),[4,this._requestQueue.send(o)];case 1:return a=f.sent(),l=a.as(RO),u=l.updatedChannels,c=l.deletedChannelUrls,d=l.hasMore,h=l.ts,u.length>0&&this._dispatcher.dispatch(new Ve({channels:u,context:{source:i},ts:h})),c.length>0&&this._dispatcher.dispatch(new Ss({channelUrls:c,context:{source:i}})),[2,{updatedChannels:u,deletedChannelUrls:c,hasMore:d,token:l.token}]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r,i,s;return g(this,function(o){switch(o.label){case 0:return r=M(M({},IS),t),K(AS(r)).throw(L.invalidParameters),i=new UO({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),[2,s.as(PO).groupChannelCount]}})})},n.prototype.getUnreadItemCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_;return g(this,function(E){switch(E.label){case 0:return r=M(M({},IO),t),K(function(S){return We(Tn,S.keys)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new FO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=E.sent(),u=l.as(HO),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,v=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,Ee({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:v,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new jO({userId:r.userId}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(BO).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=M(M({},AO),t),K(MO(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new $O({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(GO).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=M(M({},xO),t),K(function(l){return k("string",l.channelUrl,!0)&&We(uo,l.scheduledStatus,!0)&&Ge(er,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new zO(r),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(VO).count]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){var t=O.of(this._iid).subscribedUnreadMessageCount;return t.all>=0?t.all:0},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){var t=0,r=O.of(this._iid).subscribedUnreadMessageCount;return Object.keys(r.customTypes).forEach(function(i){t+=r.customTypes[i]}),t},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){var r;return(r=O.of(this._iid).subscribedUnreadMessageCount.customTypes[t])!==null&&r!==void 0?r:0},n.prototype.createChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=M(M({},ph),t),K(pm(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new WO(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),o=s.as(KO).channel,[4,this.upsertChannelsToCache([o])];case 2:return a.sent(),[2,o]}})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return t=Date.now(),K(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new cy({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=ve(i),o=s.next();!o.done;o=s.next())(a=o.value)._updateUnreadMemberState(this._sdkState.userId,t),a._updateUnreadCount(0,0)}catch(d){l={error:d}}finally{try{o&&!o.done&&(u=s.return)&&u.call(s)}finally{if(l)throw l.error}}return i.length>0?[4,this.upsertChannelsToCache(i)]:[3,3];case 2:c.sent(),c.label=3;case 3:return[2]}})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return r=Date.now(),K(We("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new cy({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,o=[];try{for(a=ve(s),l=a.next();!l.done;l=a.next())u=l.value,t.includes(u.url)&&(u._updateUnreadMemberState(this._sdkState.userId,r),u._updateUnreadCount(0,0),o.push(u))}catch(f){c={error:f}}finally{try{l&&!l.done&&(d=a.return)&&d.call(a)}finally{if(c)throw c.error}}return o.length>0?[4,this.upsertChannelsToCache(o)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[2]}})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n.prototype.getMessageFromCache=function(t){var r;return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._messageCache.get(t)];case 1:return[2,(r=i.sent())!==null&&r!==void 0?r:null]}})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return g(this,function(s){switch(s.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,filter:i,exactMatch:!0})];case 1:return[2,s.sent()]}})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return o===void 0&&(o=mS),a===void 0&&(a=!0),y(this,void 0,void 0,function(){return g(this,function(l){switch(l.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:o,filter:s,backward:i==="next",inclusive:a})];case 1:return[2,l.sent()]}})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,this._messageCache.fetch({channelUrl:t,token:r,limit:s,filter:i,backward:!1,isPollOnly:!0})];case 1:return[2,o.sent()]}})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return g(this,function(o){switch(o.label){case 0:return[4,this._messageCache.countBetween(t,r,new cs({top:i,bottom:s}))];case 1:return[2,o.sent()]}})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return g(this,function(i){switch(i.label){case 0:return[4,this._unsentMessageCache.fetch({channelUrl:t,filter:r})];case 1:return[2,i.sent()]}})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(gO),Zr=function(e,n){return n instanceof Dt?e.findIndex(function(t){return t instanceof Dt&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},cu=function(e,n){return e.findIndex(function(t){return t instanceof dr?t.messageId===n:t instanceof wa?t.notificationId===n:void 0})},Ap=function(e,n){if(e.length>0){for(var t=0,r=e.length-1,i=Math.floor((t+r)/2);t0)r=i,i=Math.floor((t+r)/2);else{if(!(s<0))return i;t=i+1,i=Math.floor((t+r)/2)}}return e[i].createdAt>n.createdAt?i:i+1}return e.length};(function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.END=2]="END"})(Is||(Is={}));var hf,ko=function(e){function n(t,r,i,s){var o=e.call(this)||this;return o._state=Is.IDLE,o._retryCount=0,o._retryLimit=3,o.priority=0,o._worker=r,o}return T(n,e),Object.defineProperty(n.prototype,"isIdle",{get:function(){return this._state===Is.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===Is.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===Is.END},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),n.prototype._run=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:if(!this.isRunning)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._worker(t)];case 2:return r=s.sent(),this._retryCount=0,this.dispatch("progress",r),r.hasNext?this._run(r.nextToken):this.end(),[3,4];case 3:return i=s.sent(),this.dispatch("error",i),this._retryCount0&&(E=_.map(function(X){return X.createdAt}),!((x=this._metadata)===null||x===void 0)&&(w=x.range).intersect.apply(w,Pe([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new cs({top:Math.min.apply(Math,Pe([],Ae(E),!1)),bottom:Math.max.apply(Math,Pe([],Ae(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(v.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(P){return P.createdAt}),!((A=this._metadata)===null||A===void 0)&&(w=A.range).intersect.apply(w,Pe([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new cs({top:Math.min.apply(Math,Pe([],Ae(E),!1)),bottom:Math.max.apply(Math,Pe([],Ae(E),!1))}),previousComplete:!1}),v.hasNext=_.length>=this._limit,this._metadata&&(v.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",v),[4,this.saveMetadata()];case 4:return q.sent(),[3,7];case 5:throw S=q.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:r.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:(U=(x=d.localCacheConfig)===null||x===void 0?void 0:x.maxSize)!==null&&U!==void 0?U:0,use_local_cache:d.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[2,v]}})})}),this._connectionEventContext=h.on(function(b){b instanceof _i&&(b.stateType===st.CONNECTED?o.resume():o.pause())})}return e.of=function(n,t){return Ui[n]||(Ui[n]={}),Ui[n][t.url]||(Ui[n][t.url]=new e({_iid:n,channel:t})),Ui[n][t.url].ref++,Ui[n][t.url]},e.clear=function(n,t){Ui[n]&&Ui[n][t]&&(Ui[n][t].close(),delete Ui[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new cs({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousComplete",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.previousComplete)},enumerable:!1,configurable:!0}),e.prototype.isWrappingMessages=function(n){var t;return(t=this.range)===null||t===void 0?void 0:t.includes.apply(t,Pe([],Ae(n.map(function(r){return r.createdAt})),!1))},e.prototype.extendRange=function(n){var t;this._metadata&&(t=this._metadata.range).extends.apply(t,Pe([],Ae(n.map(function(r){return r.createdAt})),!1))},e.prototype.loadMetadata=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:t=r.sent(),this._metadata=t?{range:new cs(t.range),previousComplete:t.previousComplete}:{range:new cs({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(n){var t,r,i,s;n===void 0&&(n=Date.now());var o=O.of(this._iid),a=o.logger;o.sessionManager.session.hasSession&&(a.debug("message background sync resume()"),this._prevSyncLoopCount=0,this._metadata&&this._metadata.previousComplete||this._prevSync.start((r=(t=this._metadata)===null||t===void 0?void 0:t.range.top)!==null&&r!==void 0?r:n),this._nextSync.start((s=(i=this._metadata)===null||i===void 0?void 0:i.range.bottom)!==null&&s!==void 0?s:n))},e.prototype.pause=function(){O.of(this._iid).logger.debug("message background sync stop()"),this._prevSync.stop(),this._nextSync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Ui[this._iid][this._channel.url])},e}(),Pi={},vk=function(){function e(n){var t=n._iid,r=n.channel,i=n.includeParams,s=this;this.ref=0,this._iid=t,this._channel=r,this._includeParams=i;var o,a,l=O.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(o=c.userId,a=r.url,"sendbird:".concat(o,"@groupchannel/").concat(a,"/message/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/message/changelogs")}(c.userId,this._channel.url);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:w.sent(),u.debug("message changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),w.label=2;case 2:return w.trys.push([2,5,,8]),[4,An.of(this._iid).getMessageChangelogs(this._channel.url,this._channel.channelType,this._metadata.token,M({replyType:Dn.ALL},this._includeParams),G.SYNC_MESSAGE_CHANGELOGS)];case 3:return p=w.sent(),m=p.updatedMessages,b=p.deletedMessageIds,v=p.hasMore,_=p.token,f.hasNext=v,f.nextToken=_,(m.length>0||b.length>0)&&this._metadata&&(this._metadata.token=_),u.debug("message changelog sync progress",f),[4,this.saveMetadata()];case 4:return w.sent(),[3,8];case 5:return E=w.sent(),u.debug("message changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:w.sent(),w.label=7;case 7:throw E;case 8:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Pi[n]||(Pi[n]={}),Pi[n][t.url]||(Pi[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),Pi[n][t.url].ref++,Pi[n][t.url]},e.clear=function(n,t){Pi[n]&&Pi[n][t]&&(Pi[n][t].close(),delete Pi[n])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=O.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n=O.of(this._iid),t=n.logger;n.sessionManager.session.hasSession&&(t.debug("message changelog sync resume()"),this._sync.start(0))},e.prototype.pause=function(){O.of(this._iid).logger.debug("message changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Pi[this._iid][this._channel.url])},e}(),jo={},gk=function(){function e(n){var t=n._iid,r=n.channel,i=n.hasPollMessage,s=this;this.ref=0,this._iid=t,this._channel=r;var o,a,l=O.of(this._iid),u=l.logger,c=l.sdkState,d=l.dispatcher;this._metadataKey=(o=c.userId,a=r.url,"sendbird:".concat(o,"@groupchannel/").concat(a,"/poll/changelogs.meta"));var h=function(f,p){return"sendbird:".concat(f,"@groupchannel/").concat(p,"/poll/changelogs")}(c.userId,this._channel.url);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:return f={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return w.sent(),u.debug("poll changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),(p=!this._metadata||!this._metadata.token)?[4,i()]:[3,3];case 2:p=!w.sent(),w.label=3;case 3:if(p)return[2,{hasNext:!1,nextToken:0}];this._metadata||(m=O.of(this._iid).firstConnectedAt,this._metadata={token:m}),w.label=4;case 4:return w.trys.push([4,7,,10]),[4,nf.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=w.sent(),v=b.hasMore,_=b.token,f.hasNext=v,f.nextToken=_,this._metadata.token=_,u.debug("poll changelog sync progress",f),[4,this.saveMetadata()];case 6:return w.sent(),[3,10];case 7:return E=w.sent(),u.debug("poll changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,9];case 8:w.sent(),w.label=9;case 9:throw E;case 10:return[2,f]}})})}),this._connectionEventContext=d.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return jo[n]||(jo[n]={}),jo[n][t.url]||(jo[n][t.url]=new e({_iid:n,channel:t,hasPollMessage:r})),jo[n][t.url].ref++,jo[n][t.url]},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata=n?{token:n.token}:void 0,t.label=2;case 2:return[2]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){O.of(this._iid).logger.debug("poll changelog sync resume()"),this._sync.start(0)},e.prototype.pause=function(){O.of(this._iid).logger.debug("poll changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete jo[this._iid][this._channel.url])},e}(),yk=function(e){function n(t){var r,i,s,o,a,l,u,c,d,h,f=this;return(f=e.call(this)||this).method=Q.GET,f.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=Ee({prev_start_ts:t.prevStart,prev_end_ts:t.prevEnd,prev_cache_count:t.prevCount,next_start_ts:t.nextStart,next_end_ts:t.nextEnd,next_cache_count:t.nextCount,huge_gap_threshold:(r=t.threshold)!==null&&r!==void 0?r:null,reverse:!0,custom_types:(i=t.customTypes)!==null&&i!==void 0?i:["*"],message_type:(s=t.messageType)!==null&&s!==void 0?s:null,include_reply_type:(o=t.replyType)!==null&&o!==void 0?o:Dn.NONE,include_reactions:(a=t.includeReactions)===null||a===void 0||a,include_meta_array:(l=t.includeMetaArray)===null||l===void 0||l,include_thread_info:(u=t.includeThreadInfo)===null||u===void 0||u,include_parent_message_info:(c=t.includeParentMessageInfo)===null||c===void 0||c,with_sorted_meta_array:(d=t.includeMetaArray)===null||d===void 0||d,show_subchannel_messages_only:(h=t.showSubchannelMessagesOnly)!==null&&h!==void 0&&h,include_poll_details:!0,checking_continuous_messages:t.checkingContinuousMessages}),f}return T(n,e),n}(Y),Ek=function(e){function n(t,r){var i,s,o,a,l,u,c=this;return(c=e.call(this,t,r)||this).isHugeGap=r.is_huge_gap,c.prevMessages=((i=r.prev_messages)!==null&&i!==void 0?i:[]).map(function(d){return vr(t,d)}),c.prevHasMore=(s=r.prev_hasmore)!==null&&s!==void 0&&s,c.isContinuousPrevMessages=(o=r.is_continuous_prev_messages)!==null&&o!==void 0&&o,c.nextMessages=((a=r.next_messages)!==null&&a!==void 0?a:[]).map(function(d){return vr(t,d)}),c.nextHasmore=(l=r.next_hasmore)!==null&&l!==void 0&&l,c.isContinuousNextMessages=(u=r.is_continuous_next_messages)!==null&&u!==void 0&&u,c}return T(n,e),n}(ae),dy={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(hf||(hf={}));var ac,lc,uc,bk=function(){function e(){this._onCacheResult=qe,this._onApiResult=qe}return e.prototype._invokeResponse=function(n,t,r){var i=this;De(function(){return y(i,void 0,void 0,function(){return g(this,function(s){switch(n){case"local":this._onCacheResult(t,r);break;case"remote":this._onApiResult(t,r)}return[2]})})})},e.prototype.onCacheResult=function(n){return this._onCacheResult=n,this},e.prototype.onApiResult=function(n){return this._onApiResult=n,this},e}(),Ck=function(){function e(n,t){var r=t.filter,i=t.startingPoint,s=t.limit,o=t.prevResultLimit,a=t.nextResultLimit,l=t.channel,u=t.channelManager,c=t.disableBackgroundSync,d=c!==void 0&&c,h=this;this._messages=[],this._unsentMessages=[],this._isLoadingPrevious=!1,this._isLoadingNext=!1,this._iid=n,this._key="mc-".concat($s()),this._isDisposed=!1,this.filter=r??new vs,this._channel=l,this._syncRange=new cs({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||mS,this._prevResultLimit=o??Math.floor(this._limit/2),this._nextResultLimit=a??Math.floor(this._limit/2),this._channelManager=u,this._channelManager.subscribeChannelEvent(this._key,{onUpdate:function(v,_){var E=_.source,S=v.findIndex(function(w){return w.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(v[S]),h.channel._runIfHandleableWithGroupChannel(function(w){switch(E){case G.EVENT_CHANNEL_UPDATED:for(var N=!1,I=0;I=w.messageOffsetTimestamp){N=!0;var R=I;if(R>0){var A=h._messages.splice(0,R);h._removeMessagesFromView(A.map(function(q){return h.keyOf(q)}),G.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(q){return h.keyOf(q)}),G.EVENT_MESSAGE_OFFSET_UPDATED);break;case G.EVENT_CHANNEL_UNMUTED:var x=O.of(h._iid).sdkState,U=_.user;x.userId===U.userId&&h._clearCheckMyMutedTimer();break;case G.EVENT_CHANNEL_MUTED:x=O.of(h._iid).sdkState,U=_.user,x.userId===U.userId&&w._myMutedRemainingTime!==-1&&h._startCheckMyMutedTimer(w._myMutedRemainingTime);break;case G.EVENT_CHANNEL_LEFT:w.isPublic&&h._clearCheckMyMutedTimer()}De(function(){return y(h,void 0,void 0,function(){var q;return g(this,function(P){return _h(E)&&(!((q=this._handler)===null||q===void 0)&&q.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(v[S],E))},onRemove:function(v,_){var E=v.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),De(function(){return y(h,void 0,void 0,function(){var S;return g(this,function(w){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(v[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(v,_){var E,S,w=[],N=[];try{for(var I=ve(v),R=I.next();!R.done;R=I.next()){var A=R.value;A.channelUrl===h._channel.url&&(h.filter.match(A)?w.push(A):N.push(h.keyOf(A)))}}catch(x){E={error:x}}finally{try{R&&!R.done&&(S=I.return)&&S.call(I)}finally{if(E)throw E.error}}if(Ns(_)){if(w.length>0)switch(_){case G.LOCAL_MESSAGE_CANCELED:case G.LOCAL_MESSAGE_RESEND_STARTED:case G.EVENT_MESSAGE_SENT_FAILED:case G.EVENT_MESSAGE_SENT_SUCCESS:case G.EVENT_MESSAGE_UPDATED:case G.EVENT_MESSAGE_THREADINFO_UPDATED:case G.EVENT_MESSAGE_REACTION_UPDATED:case G.EVENT_MESSAGE_FEEDBACK_ADDED:case G.EVENT_MESSAGE_FEEDBACK_UPDATED:case G.EVENT_MESSAGE_FEEDBACK_DELETED:case G.SYNC_MESSAGE_CHANGELOGS:h._updateMessagesToView(w,_);break;case G.EVENT_MESSAGE_SENT_PENDING:h._addMessagesToView(w,_);break;case G.EVENT_MESSAGE_RECEIVED:h.hasNext||h._addMessagesToView(w,_);break;case G.SYNC_MESSAGE_FILL:h._addMessagesToView(w,_)}N.length>0&&h._removeMessagesFromView(N,_)}h._postprocessMessageUpdateEvent(v,_)},onRemove:function(v,_){h._removeMessagesFromView(v,_),h._postprocessMessageRemoveEvent(v)},onRemoveUnsent:function(v,_){h._removeUnsentMessageFromView(v,_)},onPollChangeLogUpdate:function(v,_){h._updatePollsToView(v,_)},onPollUpdate:function(v,_){h._applyPollUpdateEventToView(v,_)},onPollVote:function(v,_){h._applyPollVoteEventToView(v,_)},onReactionUpdate:function(v,_){h._applyReactionEventToView(v,_)},onThreadInfoUpdate:function(v,_){h._applyThreadInfoEventToView(v,_)}});var f=O.of(this._iid),p=f.cacheContext,m=f.dispatcher;this._channel._updateMessageCollectionLastAccessedAt(),m.dispatch(new Ve({channels:[this._channel],context:{source:G.CHANNEL_LASTACCESSEDAT_UPDATED}})),!d&&this._shouldStartBackgroundSync()&&(this._backgroundSync=mk.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=vk.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=gk.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new ko(this._key,function(v){return y(h,void 0,void 0,function(){var _,E,S,w,N,I,R;return g(this,function(A){switch(A.label){case 0:return[4,this._getRemoteMessages(v,{prevLimit:this._prevResultLimit,source:G.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=A.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(w=Math.min.apply(Math,Pe([],Ae(E.map(function(x){return x.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:E.length>=this._prevResultLimit&&this.viewTop0?(w=Math.max.apply(Math,Pe([],Ae(E.map(function(x){return x.createdAt})),!1)),this._syncRange.extends(w),S&&((N=this._backgroundSync)===null||N===void 0||N.range.extends(w)),[2,{hasNext:!(E.length>=this._nextResultLimit&&this._hasNext)||this.viewBottom>w,nextToken:this._syncRange.bottom}]):(b.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(R=(I=p.localCacheConfig)===null||I===void 0?void 0:I.maxSize)!==null&&R!==void 0?R:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(v){if(v instanceof _i)switch(v.stateType){case st.CONNECTED:Ot(function(){return y(h,void 0,void 0,function(){return g(this,function(_){return this._activate(),[2]})})});break;case st.LOGOUT:h.dispose();break;default:h._clearCheckMyMutedTimer(),h._prevFill.stop(),h._nextFill.stop()}});var b=O.of(this._iid).statManager;b.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{message:!0}}}))}return e.prototype.keyOf=function(n){return 0},Object.defineProperty(e.prototype,"changelogIncludeParams",{get:function(){return{includeReactions:!0,includeThreadInfo:!0,includeMetaArray:!0,includeParentMessageInfo:!0}},enumerable:!1,configurable:!0}),e.prototype._postprocessChannelUpdateEvent=function(n,t){},e.prototype._postprocessChannelRemoveEvent=function(n){},e.prototype._postprocessMessageUpdateEvent=function(n,t){},e.prototype._postprocessMessageRemoveEvent=function(n){},Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"succeededMessages",{get:function(){return Pe([],Ae(this._messages),!1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"failedMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ut.FAILED})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingMessages",{get:function(){return this._unsentMessages.filter(function(n){return n.sendingStatus===ut.PENDING})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return this._hasPrevious},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewTop",{get:function(){return Math.min.apply(Math,Pe(Pe([],Ae(this._messages.map(function(n){return n.createdAt})),!1),[Number.MAX_SAFE_INTEGER],!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewBottom",{get:function(){return Math.max.apply(Math,Pe(Pe([],Ae(this._messages.map(function(n){return n.createdAt})),!1),[0],!1))},enumerable:!1,configurable:!0}),e.prototype._activate=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return O.of(this._iid).logger.debug("check huge gap"),this._checkHugeGap(),[4,this._refreshChannel(G.SYNC_CHANNEL_CHANGELOGS)];case 1:return n.sent(),[2]}})})},e.prototype._replaceChannelOfCollection=function(n){this._channel.isGroupChannel()?this._channel=n:this._channel.isFeedChannel()&&(this._channel._groupChannel=n._groupChannel)},e.prototype._shouldStartBackgroundSync=function(){var n=O.of(this._iid).cacheContext;return this.channel.isGroupChannel()?n.localCacheEnabled&&!this.channel.isSuper:n.localCacheEnabled},e.prototype._setBaseMessageCollectionHandler=function(n){this._handler=n},e.prototype._filterUnderOffsetMessage=function(n){return n},e.prototype._updateChildMessagesInView=function(n){var t=[];return this._messages.forEach(function(r){r instanceof dr&&r.parentMessageId===n.messageId&&r.applyParentMessage(n)&&t.push(r)}),t},e.prototype._updatePollsToView=function(n,t){var r,i,s=this,o=[];try{for(var a=ve(n),l=a.next();!l.done;l=a.next()){var u=l.value,c=cu(this._messages,u.messageId);if(c>=0){var d=this._messages[c];d.isUserMessage()&&d.applyPoll(u),o.push(d)}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o.length>0&&Ns(t)&&De(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},o.length>0&&((p=(f=this._handler).onMessagesUpdated)===null||p===void 0||p.call(f,h,this.channel,o)),[2]})})}),o},e.prototype._applyPollUpdateEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollUpdateEvent(n)&&Ns(t)&&De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})})}},e.prototype._applyPollVoteEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollVoteEvent(n)&&Ns(t)&&De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})})}},e.prototype._applyReactionEventToView=function(n,t){var r=this,i=cu(this._messages,n.messageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&Ns(t)&&(s.applyReactionEvent(n),De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})}))}},e.prototype._applyThreadInfoEventToView=function(n,t){var r=this,i=cu(this._messages,n.targetMessageId);if(i>=0){var s=this._messages[i];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&Ns(t)&&(s.applyThreadInfoUpdateEvent(n),De(function(){return y(r,void 0,void 0,function(){var o,a,l;return g(this,function(u){return o={source:t},(l=(a=this._handler)===null||a===void 0?void 0:a.onMessagesUpdated)===null||l===void 0||l.call(a,o,this.channel,[s]),[2]})})}))}},e.prototype._removeMessagesFromView=function(n,t){var r,i,s=this,o=[],a=[],l=function(h){var f=u._messages.findIndex(function(m){return s.keyOf(m)===h});if(f>=0){var p=u._messages[f];o.push(u.keyOf(p)),a.push(p),u._messages.splice(f,1)}},u=this;try{for(var c=ve(n),d=c.next();!d.done;d=c.next())l(d.value)}catch(h){r={error:h}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return Ns(t)&&a.length>0&&De(function(){return y(s,void 0,void 0,function(){var h,f,p;return g(this,function(m){return h={source:t},(p=(f=this._handler)===null||f===void 0?void 0:f.onMessagesDeleted)===null||p===void 0||p.call(f,h,this.channel,o,a),[2]})})}),o},e.prototype._removeUnsentMessageFromView=function(n,t){var r=this._unsentMessages.findIndex(function(i){return i.reqId===n});r>=0&&this._unsentMessages.splice(r,1)},e.prototype._getLocalMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,o=s===void 0?0:s,a=t.inclusive,l=a===void 0||a;return y(this,void 0,void 0,function(){var u,c,d,h,f;return g(this,function(p){switch(p.label){case 0:return u=[],l?[4,this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url,n,this.filter)]:[3,2];case 1:u=p.sent(),p.label=2;case 2:return i>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"prev",this.filter,i,!1)]:[3,4];case 3:return d=p.sent(),[3,5];case 4:d=[],p.label=5;case 5:return c=d,o>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,n,"next",this.filter,o,!1)]:[3,7];case 6:return f=p.sent(),[3,8];case 7:f=[],p.label=8;case 8:return h=f,[2,Pe(Pe(Pe([],Ae(u),!1),Ae(c),!1),Ae(h),!1).sort(function(m,b){return b.createdAt-m.createdAt})]}})})},e.prototype._getRemoteMessages=function(n,t){var r=t.prevLimit,i=r===void 0?0:r,s=t.nextLimit,o=s===void 0?0:s,a=t.source,l=a===void 0?G.REQUEST_MESSAGE:a,u=t.reverse,c=u!==void 0&&u,d=t.checkingHasNext,h=d!==void 0&&d,f=t.checkingContinuousMessages,p=f!==void 0&&f;return y(this,void 0,void 0,function(){var m,b;return g(this,function(v){switch(v.label){case 0:return m=An.of(this._iid),i>0||o>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ne(M(M(M({},this.filter),dy),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:o})),l,h,p)]:[3,2];case 1:return b=v.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},v.label=3;case 3:return[2,b]}})})},e.prototype._checkHugeGap=function(){var n,t,r,i,s;return y(this,void 0,void 0,function(){var o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z=this;return g(this,function(H){switch(H.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=o.cacheContext,c=o.statManager,d=o.logger,this._messages.length>0?(h=this._syncRange.top,f=this.viewTop,p=this._syncRange.bottom,m=this.hasNext?this.viewBottom:Number.MAX_SAFE_INTEGER,[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,f,h)]):[3,8];case 1:return b=H.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:v=H.sent(),H.label=3;case 3:return H.trys.push([3,5,6,7]),[4,r0(function(){return y(z,void 0,void 0,function(){var Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he=this;return g(this,function(me){switch(me.label){case 0:return Se=new yk(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:v,checkingContinuousMessages:u.localCacheEnabled},this.filter),dy)),[4,l.send(Se)];case 1:return V=me.sent(),J=V.as(Ek),re=J.isHugeGap,we=J.prevMessages,Z=we===void 0?[]:we,oe=J.prevHasMore,ee=J.isContinuousPrevMessages,ue=J.nextMessages,$=ue===void 0?[]:ue,ke=J.nextHasmore,B=J.isContinuousNextMessages,re?De(function(){return y(he,void 0,void 0,function(){var _e;return g(this,function(fe){return!((_e=this._handler)===null||_e===void 0)&&_e.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(se=this.viewTop,ce=this.viewBottom,ye=Math.min.apply(Math,Pe([Number.MAX_SAFE_INTEGER,se],Ae(Z.map(function(_e){return _e.createdAt})),!1)),ie=Math.max.apply(Math,Pe([0,ce],Ae($.map(function(_e){return _e.createdAt})),!1)),a.dispatch(new Et({messages:Z,source:G.SYNC_MESSAGE_FILL})),a.dispatch(new Et({messages:$,source:G.SYNC_MESSAGE_FILL})),this._syncRange.extends(ye,ie),(ee||B)&&((de=this._backgroundSync)===null||de===void 0||de.range.extends(ye,ie)),oe&&this._prevFill.start(ye),ke&&this._nextFill.start(ie)),[2]}})})},1)];case 4:return H.sent(),[3,7];case 5:return _=H.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(t=(n=u.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[3,13];case 8:E=Date.now(),H.label=9;case 9:return H.trys.push([9,11,12,13]),[4,this._getRemoteMessages(E,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,source:G.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:u.localCacheEnabled})];case 10:if(S=H.sent(),w=S.messages,N=S.isContinuousMessages,I=S.hasNext,w.length>0){for(R=w.map(function(Se){return Se.createdAt}),A=0,x=0,U=0;U=E&&x++;this._hasPrevious=A>=this._prevResultLimit,this._hasNext=I??x>=this._nextResultLimit,(X=this._syncRange).extends.apply(X,Pe([],Ae(R),!1)),N&&((r=this._backgroundSync)===null||r===void 0||r.range.extends(this._syncRange.top,this._syncRange.bottom)),this._addMessagesToView(w,G.SYNC_MESSAGE_FILL)}else this._hasPrevious=!1,this._hasNext=!1;return[3,13];case 11:return(P=H.sent())instanceof L&&P.code===Ie.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(s=(i=u.localCacheConfig)===null||i===void 0?void 0:i.maxSize)!==null&&s!==void 0?s:0,use_local_cache:u.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 13:return[2]}})})},e.prototype._loadUnsentMessages=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=this,[4,this._channelManager.getUnsentMessagesFromCache(this._channel.url,this.filter)];case 1:return n._unsentMessages=t.sent(),[2]}})})},e.prototype._hasPollMessage=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,this._channelManager.getPollMessagesFromCache(this._channel.url,Date.now()+6e5,this.filter,1)];case 1:return n.sent().length>0?[2,!0]:[2,!1]}})})},e.prototype._refreshChannel=function(n){var t=this;Ot(function(){return y(t,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._channelManager.refreshChannel(this.channel.url,!0,n)];case 1:return r.sent(),[2]}})})})},e.prototype._startCheckMyMutedTimer=function(n){var t=this;this._clearCheckMyMutedTimer(),this._checkMyMutedStateTimer=setTimeout(function(){return y(t,void 0,void 0,function(){var r,i,s,o=this;return g(this,function(a){switch(a.label){case 0:this._checkMyMutedStateTimer=void 0,r=!0,a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,this._channel.getMyMutedInfo()];case 2:return i=a.sent(),r=!i.isMuted,[3,5];case 3:return a.sent(),r=!0,[3,5];case 4:return r&&(s=O.of(this._iid).sessionManager,this.channel._runIfHandleableWithGroupChannel(function(l){var u,c;l.myMutedState=as.UNMUTED;var d={source:G.EVENT_CHANNEL_UNMUTED,user:s.currentUser};(c=(u=o._handler)===null||u===void 0?void 0:u.onChannelUpdated)===null||c===void 0||c.call(u,d,o.channel)})),[7];case 5:return[2]}})})},n+1e3)},e.prototype._clearCheckMyMutedTimer=function(){this._checkMyMutedStateTimer&&(clearTimeout(this._checkMyMutedStateTimer),this._checkMyMutedStateTimer=void 0)},e.prototype.initialize=function(n){var t=this,r=new bk;this._messages=[],this._unsentMessages=[],this._syncRange=new cs({}),this._hasNext=!0,this._hasPrevious=!0,this._refreshChannel(G.REFRESH_CHANNEL);var i=O.of(this._iid),s=i.cacheContext,o=i.statManager;return n===hf.CACHE_AND_REPLACE_BY_API&&this._getLocalMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit}).then(function(a){return y(t,void 0,void 0,function(){var l;return g(this,function(u){switch(u.label){case 0:return l=this._filterUnderOffsetMessage(a),this._addMessagesToView(l,G.REQUEST_MESSAGE),[4,this._loadUnsentMessages()];case 1:return u.sent(),r._invokeResponse("local",null,l),[2]}})})}).catch(function(a){if(Lr(a))throw a;r._invokeResponse("local",a,null)}).finally(function(){var a=O.of(t._iid).cacheContext;t._getRemoteMessages(t._startingPoint,{prevLimit:t._prevResultLimit,nextLimit:t._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:a.localCacheEnabled}).then(function(l){var u,c,d,h,f,p,m=l.messages,b=l.isContinuousMessages,v=l.hasNext,_=t._filterUnderOffsetMessage(m),E=!0;if(t._messages.length===_.length){for(var S=t._messages.map(function(x){return t.keyOf(x)}),w=0;w<_.length;w++)if(!S.includes(t.keyOf(_[w]))){E=!1;break}}else E=!1;if(t._messages=[],_.length>0){var N=_.map(function(x){return x.createdAt}),I=0,R=0;for(w=0;wt._startingPoint&&R++}t._hasPrevious=I>=t._prevResultLimit,t._hasNext=v??R>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,Pe([],Ae(_.map(function(x){return x.createdAt})),!1)),b&&((c=t._backgroundSync)===null||c===void 0||c.range.extends(t._syncRange.top,t._syncRange.bottom)),t._addMessagesToView(_,G.REQUEST_MESSAGE)}else t._hasPrevious=!1,t._hasNext=!1;o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:E?"cache_hit":"cache_miss",max_db_size:(h=(d=a.localCacheConfig)===null||d===void 0?void 0:d.maxSize)!==null&&h!==void 0?h:0,message_init_policy:n,use_local_cache:a.localCacheEnabled,collection_id:t._key}})),o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:t.channel.url,starting_point:t._startingPoint,measured_on:"initial_load",event:"cache_fetch",max_db_size:(p=(f=a.localCacheConfig)===null||f===void 0?void 0:f.maxSize)!==null&&p!==void 0?p:0,message_init_policy:n,use_local_cache:a.localCacheEnabled,collection_id:t._key}})),r._invokeResponse("remote",null,_)}).catch(function(l){if(Lr(l))throw l;r._invokeResponse("remote",l,null)})}),o.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:s.localCacheEnabled,collection_interface:{message_init_policy:n}}})),r},e.prototype.loadPrevious=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=O.of(this._iid),s=i.cacheContext,o=i.statManager,a=i.logger,this._hasPrevious?this._isLoadingPrevious?(a.warn("Messages are already fetching."),[2,[]]):(this._isLoadingPrevious=!0,l=this.viewTop,u=[],[4,Ot(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{prevLimit:this._prevResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._prevResultLimit,o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Ot(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w=this;return g(this,function(N){switch(N.label){case 0:return p=O.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{prevLimit:this._prevResultLimit,reverse:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=N.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Pe([],Ae(u.map(function(I){return I.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(I){return Zr(w._messages,I)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:"cache_fetch",max_db_size:(S=(E=p.localCacheConfig)===null||E===void 0?void 0:E.maxSize)!==null&&S!==void 0?S:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,G.REQUEST_MESSAGE),[3,4];case 3:this._hasPrevious=u.length>=this._prevResultLimit,u.length>0&&this._addMessagesToView(u,G.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingPrevious=!1,[2,u]}})})},e.prototype.loadNext=function(){var n,t,r;return y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h=this;return g(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return i=O.of(this._iid),s=i.cacheContext,o=i.statManager,a=i.logger,this._hasNext?this._isLoadingNext?(a.warn("Messages are already fetching."),[2,[]]):(this._isLoadingNext=!0,l=this.viewBottom,u=[],[4,Ot(function(){return y(h,void 0,void 0,function(){var p;return g(this,function(m){switch(m.label){case 0:return p=this._filterUnderOffsetMessage,[4,this._getLocalMessages(l,{nextLimit:this._nextResultLimit,inclusive:!1})];case 1:return u=p.apply(this,[m.sent()]),[2]}})})})]):[2,[]];case 1:return f.sent(),c=u.length>=this._nextResultLimit,o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:s.localCacheEnabled&&c?"cache_hit":"cache_miss",max_db_size:(t=(n=s.localCacheConfig)===null||n===void 0?void 0:n.maxSize)!==null&&t!==void 0?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),c&&(!((r=this._backgroundSync)===null||r===void 0)&&r.isWrappingMessages(u))?[3,3]:(d=!1,[4,Ot(function(){return y(h,void 0,void 0,function(){var p,m,b,v,_,E,S,w,N=this;return g(this,function(I){switch(I.label){case 0:return p=O.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:p.localCacheEnabled})];case 1:return m=I.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,Pe([],Ae(u.map(function(R){return R.createdAt})),!1)),!((v=this._backgroundSync)===null||v===void 0)&&v.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(R){return Zr(N._messages,R)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&o.put(new jt({type:yt.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:"cache_fetch",max_db_size:(w=(S=p.localCacheConfig)===null||S===void 0?void 0:S.maxSize)!==null&&w!==void 0?w:0,use_local_cache:p.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(u,G.REQUEST_MESSAGE),[3,4];case 3:this._hasNext=u.length>=this._nextResultLimit,u.length>0&&this._addMessagesToView(u,G.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingNext=!1,[2,u]}})})},e.prototype.removeFailedMessage=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return[4,this._channelManager.removeFailedMessageFromCache(n)];case 1:return r.sent(),(t=this._unsentMessages.findIndex(function(i){return i.reqId===n}))>-1&&this._unsentMessages.splice(t,1),[2]}})})},e.prototype.dispose=function(){var n,t,r,i=this;if(!this._isDisposed){this._isDisposed=!0;var s=O.of(this._iid),o=s.cacheContext,a=s.dispatcher;this._messages=[],this._clearCheckMyMutedTimer(),this._channel._runIfHandleableWithGroupChannel(function(l){l.myMemberState!==Bt.NONE&&(i._channel._updateMessageCollectionLastAccessedAt(),a.dispatch(new Ve({channels:[i._channel],context:{source:G.CHANNEL_LASTACCESSEDAT_UPDATED}})))}),o.localCacheEnabled&&(this._prevFill.stop(),this._nextFill.stop()),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._pollChangelogSync)===null||r===void 0||r.close(),this._channelManager.unsubscribeChannelEvent(this._key),this._channelManager.unsubscribeMessageEvent(this._key),this._connectionEventContext&&this._connectionEventContext.close()}},e}(),Sk=function(e){function n(t,r){return e.call(this,t,M(M({},r),{channelManager:Nn.of(t)}))||this}return T(n,e),n.prototype.keyOf=function(t){return t.messageId},n.prototype.initialize=function(t){var r=this;return Ot(function(){return y(r,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})}),e.prototype.initialize.call(this,t)},n.prototype.setMessageCollectionHandler=function(t){this._setBaseMessageCollectionHandler(t)},n.prototype._activate=function(){return y(this,void 0,void 0,function(){var t=this;return g(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,Ot(function(){return y(t,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(i=s.sent()).isMuted&&i.remainingDuration!==-1&&this._startCheckMyMutedTimer(i.remainingDuration),[2]}})})})];case 2:return r.sent(),[2]}})})},n.prototype._addMessagesToView=function(t,r){var i,s,o=this,a=this._filterUnderOffsetMessage(t),l=[],u=[];try{for(var c=ve(a),d=c.next();!d.done;d=c.next()){var h=d.value;if(r===G.SYNC_MESSAGE_FILL)if(h.messageId>0){if((b=Zr(this._messages,h))<0){Zr(this._unsentMessages,h)<0&&l.push(h);var f=Ap(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Dt&&(b=Zr(this._unsentMessages,h))<0&&Zr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=Zr(this._messages,h))<0){var p=Zr(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=Ap(this._messages,h),this._messages.splice(f,0,h)}else u.push(h),this._messages[b]=h;if(h.updatedAt>0){var m=this._updateChildMessagesInView(h);u.push.apply(u,Pe([],Ae(m),!1))}}else if(h instanceof Dt){var b;(b=Zr(this._unsentMessages,h))<0?Zr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(v){i={error:v}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}Ns(r)&&De(function(){return y(o,void 0,void 0,function(){var v,_,E,S,w;return g(this,function(N){return v={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,v,this.channel,l)),u.length>0&&((w=(S=this._handler)===null||S===void 0?void 0:S.onMessagesUpdated)===null||w===void 0||w.call(S,v,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,o=this,a=[],l=[],u=[];try{for(var c=ve(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=Zr(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=Zr(this._unsentMessages,f);if(p>=0){var m=Ae(this._unsentMessages.splice(p,1),1)[0];if(this.hasNext&&m)u.push(m);else{l.push(f);var b=Ap(this._messages,f);this._messages.splice(b,0,f)}}else{var v=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,Pe([],Ae(v),!1))&&!this._hasNext)&&a.push(f)}}else f instanceof Dt&&(h=Zr(this._unsentMessages,f))>=0&&(l.push(f),this._unsentMessages[h]=f)}}catch(_){i={error:_}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return Ns(r)&&De(function(){return y(o,void 0,void 0,function(){var _,E,S,w,N;return g(this,function(I){return _={source:r},l.length>0?(S=(E=this._handler)===null||E===void 0?void 0:E.onMessagesUpdated)===null||S===void 0||S.call(E,_,this.channel,l):u.length>0?(N=(w=this._handler)===null||w===void 0?void 0:w.onMessagesDeleted)===null||N===void 0||N.call(w,_,this.channel,[],u):a.length>0&&this._addMessagesToView(a,r),[2]})})}),l},n}(Ck),Tk={coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isPublic:void 0,isDiscoverable:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},wk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.token,o=t.limit,a=t.order,l=t.mutedMemberFilter,u=t.memberStateFilter,c=t.nicknameStartsWithFilter,d=t.operatorFilter;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/members"),r.params={token:s,limit:o,order:a,muted_member_filter:l,member_state_filter:u,nickname_startswith:c,operator_filter:d,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0},r}return T(n,e),n}(Y),Nk=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.members=[];var s=r.next,o=r.members;return i.token=s,o&&o.length>0&&(i.members=o.map(function(a){return new ii(t,a)})),i}return T(n,e),n}(ae);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(ac||(ac={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(lc||(lc={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(uc||(uc={}));var Ik=function(e){function n(t,r,i){var s,o,a,l,u=this;return(u=e.call(this,t,r,Ze.GROUP,i)||this).mutedMemberFilter=ac.ALL,u.memberStateFilter=uc.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=cf.ALL,u.order=lc.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:ac.ALL,u.memberStateFilter=(o=i.memberStateFilter)!==null&&o!==void 0?o:uc.ALL,u.nicknameStartsWithFilter=(a=i.nicknameStartsWithFilter)!==null&&a!==void 0?a:null,u.order=(l=i.order)!==null&&l!==void 0?l:lc.MEMBER_NICKNAME_ALPHABETICAL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&Ge(ac,this.mutedMemberFilter)&&Ge(uc,this.memberStateFilter)&&(k("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&Ge(cf,this.operatorFilter)&&Ge(lc,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new wk(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Nk),o=s.members,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs),Ak=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(Y),Mk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Bt.JOINED,i}return T(n,e),n}(ae),xk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.isDistinct,o=t.isPublic,a=t.isDiscoverable,l=t.coverUrl,u=t.coverImage,c=t.accessCode,d=t.name,h=t.data,f=t.customType,p=t.operatorUserIds,m=t.messageSurvivalSeconds;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i)),r.params=Ee({is_distinct:s,is_public:o,is_discoverable:a,name:d,data:h,custom_type:f,cover_url:l,cover_file:u,access_code:c,operator_ids:p,message_survival_seconds:m}),r}return T(n,e),n}(Y),Ok=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i}return T(n,e),n}(ae),kk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(ir,"/").concat(encodeURIComponent(i)),r}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var Rk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.DELETE,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/hide"),r}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var Lk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),o.params={count_preference:s},o}return T(n,e),n}(Y),Dk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.countPreference=r.count_preference,i}return T(n,e),n}(ae),Uk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Q.PUT,r.path="".concat(ir,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return T(n,e),n}(Y),Pk=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.ts_message_offset;return i.messageOffsetTimestamp=s,i}return T(n,e),n}(ae),Fk=M(M({},Zv),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),Hk=M(M({},uS),{scheduledAt:void 0}),jk=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(c){return c.userId})));var a=t.channelType,l=t.channelUrl,u=t.scheduledMessageId;return s.method=Q.PUT,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:(r=t._thumbnails)===null||r===void 0?void 0:r.map(function(c){return Vs.payloadify(c)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:o,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(c){return pr.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return T(n,e),n}(Y),Bk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Zt(t,r),i}return T(n,e),n}(ae),$k=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===nr.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(u){return u.userId})));var o=t.channelType,a=t.channelUrl,l=t.scheduledMessageId;return i.method=Q.PUT,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=Ee(Ne({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:Ll.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:(r=t.metaArrays)===null||r===void 0?void 0:r.map(function(u){return pr.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?ki.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jn(t,r),i}T(n,e)})(ae);var Gk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Q.DELETE,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o)),r}return T(n,e),n}(Y),zk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Q.POST,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o),"/send_now"),r}return T(n,e),n}(Y),Vk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,o=e.call(this)||this;return o.method=Q.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),o.params={push_trigger_option:s},o}return T(n,e),n}(Y),qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(ae),Wk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y),Kk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i.enabled=r.enable,i}return T(n,e),n}(ae),Qk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Q.POST,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var Yk=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Q.DELETE,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(Y);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(ae);var ti,cr,Zk=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=vr(t,r.message),i}return T(n,e),n}(Wn),Xk=function(e){function n(t){var r=this,i=t.channelType,s=t.channelUrl,o=t.limit,a=t.token,l=t.includeReactions,u=t.includeMetaArray,c=t.includeParentMessageInfo,d=t.includeThreadInfo,h=t.includePollDetails;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=Ee({limit:o,token:a,include_reactions:l,with_sorted_meta_array:u,include_thread_info:d,include_parent_message_info:c,include_poll_details:h}),r}return T(n,e),n}(Y),Jk=function(e){function n(t,r){var i=e.call(this,t,r)||this,s=r.pinned_messages,o=r.has_more,a=r.next;return i.pinnedMessages=s.map(function(l){return new Zk(t,l)}),i.hasMore=o,i.token=a,i}return T(n,e),n}(ae),eR=function(e){function n(t,r,i,s){var o=e.call(this,t,r,i,s)||this;return o.includeMetaArray=s.includeMetaArray,o.includeReactions=s.includeReactions,o.includeParentMessageInfo=s.includeParentMessageInfo,o.includeThreadInfo=s.includeThreadInfo,o.includePollDetails=s.includePollDetails,o}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeMetaArray,!0)&&k("boolean",this.includeReactions,!0)&&k("boolean",this.includeParentMessageInfo,!0)&&k("boolean",this.includeThreadInfo,!0)&&k("boolean",this.includePollDetails,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new Xk(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(Jk),o=s.pinnedMessages,a=s.hasMore,l=s.token,this._token=l,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(zs);(function(e){e.ALL="all",e.UNREAD_MESSAGE_COUNT_ONLY="unread_message_count_only",e.UNREAD_MENTION_COUNT_ONLY="unread_mention_count_only",e.OFF="off"})(ti||(ti={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(cr||(cr={}));var di=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A=this;return(A=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,A._undeliveredMemberStateMap=new Map,A._typingStatus=new Map,A._lastMemberCountUpdated=0,A._typingStarted=0,A._typingEnded=0,A.isDistinct=!1,A.isSuper=!1,A.isBroadcast=!1,A.isExclusive=!1,A.isPublic=!1,A.isDiscoverable=!0,A.isChatNotification=!1,A.isAccessCodeRequired=!1,A.isPushEnabled=!1,A.unreadMessageCount=0,A.unreadMentionCount=0,A.totalUnreadReplyCount=0,A.members=[],A.memberCount=0,A.joinedMemberCount=0,A.hiddenState=cr.UNHIDDEN,A.lastMessage=null,A.messageOffsetTimestamp=0,A.messageSurvivalSeconds=-1,A.myMemberState=Bt.NONE,A.myRole=Ii.NONE,A.myMutedState=as.UNMUTED,A.myLastRead=0,A.myCountPreference=ti.ALL,A.myPushTriggerOption=ta.DEFAULT,A.inviter=null,A.invitedAt=0,A.joinedAt=0,A.pinnedMessageIds=[],A.lastPinnedMessage=null,A._pinnedMessagesUpdatedAt=0,A._myMutedRemainingTime=-1,A.channelType=Ze.GROUP,A.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,A.isSuper=(o=r.is_super)!==null&&o!==void 0&&o,A.isBroadcast=(a=r.is_broadcast)!==null&&a!==void 0&&a,A.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,A.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,A.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:A.isPublic,A.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,A.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,A.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=A.members).push.apply(i,Pe([],Ae(r.members.map(function(x){return new ii(A._iid,x)})),!1)),A.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,A.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,A.hiddenState=Ge(cr,r.hidden_state)?r.hidden_state:cr.UNHIDDEN,A.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,A.messageSurvivalSeconds=(v=r.message_survival_seconds)!==null&&v!==void 0?v:-1,A.lastMessage=r.last_message?vr(A._iid,M({channel_type:A.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(x){k("number",r.read_receipt[x])&&A._updateUnreadMemberState(x,r.read_receipt[x])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(x){k("number",r.delivery_receipt[x])&&A._updateUndeliveredMemberState(x,r.delivery_receipt[x])}),A.myMemberState=Ge(Bt,r.member_state)?r.member_state:Bt.NONE,A.myRole=Ge(Ii,r.my_role)?r.my_role:Ii.NONE,Ge(as,r.is_muted)?A.myMutedState=r.is_muted:k("boolean",r.is_muted)?A.myMutedState=r.is_muted?as.MUTED:as.UNMUTED:A.myMutedState=as.UNMUTED,A.myCountPreference=Ge(ti,r.count_preference)?r.count_preference:ti.ALL,A.myPushTriggerOption=Ge(ta,r.push_trigger_option)?r.push_trigger_option:ta.ALL,A.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,A.inviter=r.inviter?new Ke(A._iid,r.inviter):null,A.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,A.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,A._updateUnreadCount((w=r.unread_message_count)!==null&&w!==void 0?w:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),A.totalUnreadReplyCount=(I=r.total_unread_thread_message_count)!==null&&I!==void 0?I:0,A.pinnedMessageIds=(R=r.pinned_message_ids)!==null&&R!==void 0?R:[],A.lastPinnedMessage=r.latest_pinned_message?vr(A._iid,M({channel_type:A.channelType},r.latest_pinned_message)):null,A}return T(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==cr.UNHIDDEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTyping",{get:function(){return this._typingStatus.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUnreadMemberState",{get:function(){var t,r,i={};try{for(var s=ve(this._unreadMemberStateMap),o=s.next();!o.done;o=s.next()){var a=Ae(o.value,2),l=a[0],u=a[1];i[l]=u}}catch(c){t={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cachedUndeliveredMemberState",{get:function(){var t,r,i={};try{for(var s=ve(this._undeliveredMemberStateMap),o=s.next();!o.done;o=s.next()){var a=Ae(o.value,2),l=a[0],u=a[1];i[l]=u}}catch(c){t={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return i},enumerable:!1,configurable:!0}),n.payloadify=function(t){return Ee(Ne(M(M({},e.payloadify.call(this,t)),{is_access_code_required:t.isAccessCodeRequired,is_distinct:t.isDistinct,is_super:t.isSuper,is_broadcast:t.isBroadcast,is_exclusive:t.isExclusive,is_public:t.isPublic,is_discoverable:t.isDiscoverable,is_muted:t.myMutedState,is_push_enabled:t.isPushEnabled,unread_message_count:t.unreadMessageCount,unread_mention_count:t.unreadMentionCount,total_unread_thread_message_count:t.totalUnreadReplyCount,push_trigger_option:t.myPushTriggerOption,count_preference:t.myCountPreference,hidden_state:t.hiddenState,member_count:t.memberCount,joined_member_count:t.joinedMemberCount,member_state:t.myMemberState,my_role:t.myRole,user_last_read:t.myLastRead,ts_message_offset:t.messageOffsetTimestamp,message_survival_seconds:t.messageSurvivalSeconds,read_receipt:t.cachedUnreadMemberState,delivery_receipt:t.cachedUndeliveredMemberState,members:t.members.map(function(r){return ii.payloadify(r)}),last_message:t.lastMessage?P1(t.lastMessage):null,inviter:t.inviter?Ke.payloadify(t.inviter):null,invited_at:t.invitedAt,joined_ts:t.joinedAt,pinned_message_ids:t.pinnedMessageIds,latest_pinned_message:t.lastPinnedMessage?P1(t.lastPinnedMessage):null})))},n.prototype._shouldUpdateLastMessageWith=function(t){if(t.silent)return!1;var r=O.of(this._iid).appInfo;switch(r==null?void 0:r.lastMessageThreadingPolicy){case sa.NONE:case sa.INCLUDE_REPLY:break;case sa.EXCLUDE_REPLY:if(t.parentMessageId>0)return!1;break;case sa.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Dt&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt0)return!1;break;case ia.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Dt&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!0},n.prototype._updateLastMessage=function(t){return!!this._shouldUpdateLastMessageWith(t)&&(this.lastMessage=t,!0)},n.prototype._updateUnreadCount=function(t,r){if(typeof t=="number"&&t>=0)if(this.myCountPreference===ti.ALL||this.myCountPreference===ti.UNREAD_MESSAGE_COUNT_ONLY)if(this.isExclusive||this.isSuper||this.isBroadcast){var i=O.of(this._iid).maxSuperGroupChannelUnreadCount;this.unreadMessageCount=i&&t>=i?i:t}else this.unreadMessageCount=t;else this.unreadMessageCount=0;else this.unreadMessageCount=0;typeof r=="number"&&r>=0&&(this.myCountPreference===ti.ALL||this.myCountPreference===ti.UNREAD_MENTION_COUNT_ONLY)?this.unreadMentionCount=r:this.unreadMentionCount=0},n.prototype._updateUnreadMemberState=function(t,r){var i=this._unreadMemberStateMap.get(t);return(!i||i0?this._typingStatus.set(t.userId,{user:t,ts:r}):this._typingStatus.delete(t.userId)},n.prototype._clearTypingStatus=function(){this._typingStatus.clear(),this._typingStarted=0,this._typingEnded=0},n.prototype._setLatestMemberCount=function(t,r,i){var s=!1;return i>=this._lastMemberCountUpdated&&(this._lastMemberCountUpdated=i,s=t!==this.memberCount||r!==this.joinedMemberCount,this.memberCount=t,this.joinedMemberCount=r),s},n.prototype.isReadMessage=function(t){var r=O.of(this._iid).sdkState,i=this._unreadMemberStateMap.get(r.userId);return!!i&&i>=t.createdAt},n.prototype.serialize=function(){var t=this;return Kc(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new Sk(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new Ik(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new dO(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new eR(this._iid,this.url,this.channelType,t)},n.prototype.addMember=function(t,r){if(r===void 0&&(r=0),!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var i=this.members.findIndex(function(o){return o.userId===t.userId});if(i>-1){var s=this.members[i];s.state===Bt.JOINED&&(t.state=s.state),this.members.splice(i,1),this.memberCount--}this.members.push(t),this.memberCount++,this._updateUnreadMemberState(t.userId,r),this._updateUndeliveredMemberState(t.userId,r)}},n.prototype.removeMember=function(t){if(!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var r=t instanceof ii?t.userId:t,i=this.members.findIndex(function(s){return s.userId===r});if(i>-1)return this.members.splice(i,1),this.memberCount--,!0}return!1},n.prototype.getUnreadMemberCount=function(t){var r,i;if(t instanceof Dt&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=O.of(this._iid).sdkState,o=t.createdAt,a=0;try{for(var l=ve(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===Bt.JOINED&&t.sender.userId!==c.userId&&(this.cachedUnreadMemberState[c.userId]||0)=t.createdAt&&a.push(l)}}),a},n.prototype.getUnreadMembers=function(t,r){var i=this;r===void 0&&(r=!1);var s=O.of(this._iid).sdkState;if(!s.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var o=t instanceof Dt?t.sender:null,a=[];return this.members.forEach(function(l){if(r||l.userId!==s.userId&&l.userId!==(o==null?void 0:o.userId)){var u=i._unreadMemberStateMap.get(l.userId);u&&u=r&&(t._typingStatus.delete(a),s=!0)}),s},n.prototype.refresh=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this._refresh()]})})},n.prototype._refresh=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new mm({channelUrl:this.url}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(vm).channel,this._update(l),t||s.dispatch(new Ve({channels:[l],context:{source:G.REFRESH_CHANNEL}})),[2,this]}})})},n.prototype.freeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.freeze.call(this)];case 1:return t.sent(),O.of(this._iid).dispatcher.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_FROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.unfreeze=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,e.prototype.unfreeze.call(this)];case 1:return t.sent(),O.of(this._iid).dispatcher.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UNFROZEN},isWebSocketEventComing:!0})),[2]}})})},n.prototype.updateChannel=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return r=M(M({},Tk),t),K(function(d){return k("string",d.coverUrl,!0)&&(fr(d.coverImage)||k("string",d.coverImage,!0))&&k("boolean",d.isDistinct,!0)&&k("boolean",d.isPublic,!0)&&k("boolean",d.isDiscoverable,!0)&&k("string",d.accessCode,!0)&&k("string",d.name,!0)&&k("string",d.data,!0)&&k("string",d.customType,!0)&&We("string",d.operatorUserIds,!0)&&k("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.requestQueue,a=new xk(M({channelUrl:this.url},r)),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Ok).channel,this._update(u),s.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.invite=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(t.every(function(i){return i instanceof Ke})).throw(L.invalidParameters),[2,this.inviteWithUserIds(t.map(function(i){return i.userId}))]})})},n.prototype.inviteWithUserIds=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(We("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.requestQueue,o=r.sessionManager,a=new ek({channelUrl:this.url,userIds:t}),[4,s.send(a)];case 1:return l=c.sent(),u=l.as(tk).channel,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_INVITED,inviter:o.currentUser,invitees:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.join=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new QO({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(YO).channel).myMemberState=this.myMemberState=Bt.JOINED,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_JOINED,users:[]},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.leave=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new XO({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(o)];case 1:return a.sent(),this.myMemberState=Bt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Ak({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(Mk).channel).myMemberState=this.myMemberState=Bt.JOINED,this._update(u),i.dispatch(new Ve({channels:[u],context:{source:G.EVENT_CHANNEL_ACCEPTED_INVITE},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.declineInvitation=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new rk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.myMemberState=Bt.NONE,[2,this]}})})},n.prototype.sendUserMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype.sendUserMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){l&&o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){r.hiddenState===cr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=cr.UNHIDDEN),o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),Nn.of(r._iid).handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:return i=O.of(this._iid).dispatcher,[4,e.prototype.updateUserMessage.call(this,t,r)];case 1:return s=u.sent(),o=this._updateLastMessage(s),a=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,o=!0,a=!0),o&&(Nn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new Ve({channels:[this],context:{source:a?G.EVENT_PINNED_MESSAGE_UPDATED:G.EVENT_MESSAGE_UPDATED}}))),a&&Nn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Et({messages:[s],source:G.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendUserMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype._autoResendUserMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.sendFileMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype.sendFileMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){l&&o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.sendMultipleFilesMessage=function(t){var r=this,i=new dh,s=O.of(this._iid).dispatcher;return e.prototype.sendMultipleFilesMessage.call(this,t).onPending(function(o){i._trigger(o)}).onFailed(function(o,a){i._triggerFailed(o,a)}).onSucceeded(function(o){var a=Nn.of(r._iid);r._updateLastMessage(o),a.handlers.map(function(l){l.onChannelChanged&&l.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(o)}).onFileUploaded(function(o,a,l,u){i._triggerOnFileUploaded(o,a,l,u)}),i},n.prototype.updateFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:return i=O.of(this._iid).dispatcher,[4,e.prototype.updateFileMessage.call(this,t,r)];case 1:return s=u.sent(),o=this._updateLastMessage(s),a=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,o=!0,a=!0),o&&(Nn.of(this._iid).handlers.map(function(c){c.onChannelChanged&&c.onChannelChanged(l)}),i.dispatch(new Ve({channels:[this],context:{source:a?G.EVENT_PINNED_MESSAGE_UPDATED:G.EVENT_MESSAGE_UPDATED}}))),a&&Nn.of(this._iid).handlers.map(function(c){c.onPinnedMessageUpdated&&c.onPinnedMessageUpdated(l)}),i.dispatch(new Et({messages:[s],source:G.EVENT_MESSAGE_UPDATED})),[2,s]}})})},n.prototype._autoResendFileMessage=function(t){var r=this,i=new Br,s=O.of(this._iid).dispatcher,o=Mu.of(this._iid);return e.prototype._autoResendFileMessage.call(this,t).onPending(function(a){o.completeCurrentAndProcessNextAutoResend(a),i._trigger(a)}).onFailed(function(a,l){o.completeCurrentAndProcessNextAutoResend(l),i._triggerFailed(a,l)}).onSucceeded(function(a){var l=Nn.of(r._iid);o.completeCurrentAndProcessNextAutoResend(a),r._updateLastMessage(a),l.handlers.map(function(u){u.onChannelChanged&&u.onChannelChanged(r)}),s.dispatch(new Ve({channels:[r],context:{source:G.EVENT_MESSAGE_SENT}})),i._trigger(a)}),i},n.prototype.deleteMessage=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,e.prototype.deleteMessage.call(this,t)];case 1:return r.sent(),t.messageId===0&&t instanceof Dt&&O.of(this._iid).dispatcher.dispatch(new $C({reqId:t.reqId,source:G.EVENT_MESSAGE_DELETED})),[2]}})})},n.prototype.hide=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:return r=M(M({},gm),t),K(function(h){return k("boolean",h.hidePreviousMessages,!0)&&k("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.sdkState,a=i.requestQueue,l=new sk(M({channelUrl:this.url,userId:o.userId},r)),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(ok).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?cr.HIDDEN_ALLOW_AUTO_UNHIDE:cr.HIDDEN_PREVENT_AUTO_UNHIDE,r.hidePreviousMessages&&this._updateUnreadCount(0,0),c&&(this.messageOffsetTimestamp=c),s.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_HIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.unhide=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Rk({channelUrl:this.url}),[4,i.send(s)];case 1:return o.sent(),this.hiddenState=cr.UNHIDDEN,r.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UNHIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},n.prototype.delete=function(){return y(this,void 0,void 0,function(){var t,r;return g(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new kk({channelUrl:this.url}),[4,t.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.markAsRead=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u=this;return g(this,function(c){switch(c.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.dispatcher,s=t.requestQueue,o=new G6({channelUrl:this.url}),[4,s.send(o)];case 1:return a=c.sent(),l=a.as(tS).readStatus,this._updateUnreadMemberState(r.userId,l.readAt),(this.unreadMessageCount>0||this.unreadMentionCount>0)&&(this._updateUnreadCount(0,0),Nn.of(this._iid).handlers.map(function(d){d.onChannelChanged&&d.onChannelChanged(u)})),i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_READ}})),[2]}})})},n.prototype.markAsDelivered=function(){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new pk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},n.prototype.startTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingStarted>=i?(this._typingStarted=s,this._typingEnded=0,o=new lk({channelUrl:this.url,time:this._typingStarted}),[4,r.send(o)]):[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})},n.prototype.endTyping=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.requestQueue,i=t.typingIndicatorThrottle,(s=new Date().getTime())-this._typingEnded>=i?(this._typingStarted=0,this._typingEnded=s,o=new ck({channelUrl:this.url,time:this._typingStarted}),[4,r.send(o)]):[3,2];case 1:a.sent(),a.label=2;case 2:return[2]}})})},n.prototype.createScheduledUserMessage=function(t){t=M(M({},Qx),t),K(Yx(t)).throw(L.invalidParameters);var r=new Br;return this._createScheduledUserMessage(t,r),r},n.prototype.updateScheduledUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=M(M({},Hk),r),K(function(u){return cS(u)&&k("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new $k(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(hS).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},Zx),t),K(Xx(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),o=new Br;return Or(wx).then(function(){var a=r._createPendingScheduledFileMessage(t,s,i);De(function(){return y(r,void 0,void 0,function(){return g(this,function(l){return[2,o._trigger(a)]})})})}),fr(t.file)?this._uploadFileAndUpdateParams(t).then(function(){return r._createScheduledFileMessage(t,o,s,i)}):this._createScheduledFileMessage(t,o,s,i),o},n.prototype.updateScheduledFileMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return g(this,function(a){switch(a.label){case 0:return i=M(M({},Fk),r),K(function(l){return Xv(l)&&k("number",l.scheduledAt,!0)&&(fr(l.file)||k("string",l.fileUrl))&&k("string",l.fileName,!0)&&k("string",l.mimeType,!0)&&k("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return k("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),fr(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:a.sent(),a.label=2;case 2:return s=new jk(M({reqId:this._generateRequestId(),scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url},i)),[4,O.of(this._iid).requestQueue.send(s)];case 3:return o=a.sent(),[2,o.as(Bk).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new Gk({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,O.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.sendScheduledMessageNow=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){switch(i.label){case 0:return r=new zk({scheduledMessageId:t,channelType:this.channelType,channelUrl:this.url}),[4,O.of(this._iid).requestQueue.send(r)];case 1:return i.sent(),[2]}})})},n.prototype.getMyPushTriggerOption=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Wk({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Kk).pushTriggerOption,this.myPushTriggerOption=a,[2,a]}})})},n.prototype.setMyPushTriggerOption=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(Ge(ta,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Vk({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(qk).pushTriggerOption,this.myPushTriggerOption=u,i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.setMyCountPreference=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(Ge(ti,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Lk({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Dk).countPreference,this.myCountPreference=u,this._updateUnreadCount(this.unreadMessageCount,this.unreadMentionCount),i.dispatch(new Ve({channels:[this],context:{source:G.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,u]}})})},n.prototype.resetMyHistory=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Uk({channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Pk).messageOffsetTimestamp,this.messageOffsetTimestamp=a,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new Qk({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype.unpinMessage=function(t){return y(this,void 0,void 0,function(){var r,i;return g(this,function(s){switch(s.label){case 0:return K(k("number",t)&&t>0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new Yk({channelType:this.channelType,channelUrl:this.url,messageId:t}),[4,r.send(i)];case 1:return s.sent(),[2]}})})},n.prototype._uploadFileAndUpdateParams=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h;return g(this,function(f){switch(f.label){case 0:return fr(t.file)?(r=O.of(this._iid).requestQueue,i=new rf({file:t.file,channelUrl:this.url,thumbnailSizes:t.thumbnailSizes,requestId:this._generateRequestId()}),[4,r.send(i)]):[3,2];case 1:s=f.sent(),o=s.as(sf),a=o.url,l=o.fileSize,u=l===void 0?t.fileSize:l,c=o.thumbnails,d=o.requireAuth,h=d!==void 0&&d,t.fileUrl=a,t.fileSize=u,t.requireAuth=h,t._thumbnails=c,f.label=2;case 2:return[2]}})})},n.prototype.resendMessage=function(t,r){var i,s=this;if(K(t instanceof Dt&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:sm(t),a=new Br;return this._sendUserMessage(o,Yn.RESEND,t.reqId).onPending(function(d){a._trigger(d)}).onFailed(function(d,h){a._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),a._trigger(d)}),a}if(t.isFileMessage()){var l=this._validateFailedFileMessageHasFile(t,r);K(l).throw(L.invalidParameters),o=om(t,r);var u=new Br;return this._sendFileMessage(o,Yn.RESEND,t.reqId).onPending(function(d){u._trigger(d)}).onFailed(function(d,h){u._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),u._trigger(d)}),u}if(t.isMultipleFilesMessage()){o=t.messageParams;var c=new dh;return this._sendMultipleFilesMessage(o,Yn.RESEND,t.reqId).onPending(function(d){c._trigger(d)}).onFailed(function(d,h){c._triggerFailed(d,h)}).onSucceeded(function(d){s._tryUpdateLastMessageAndCallEvents(s,d),c._trigger(d)}).onFileUploaded(function(d,h,f,p){c._triggerOnFileUploaded(d,h,f,p)}),c}},n.prototype.copyMessage=function(t,r){var i=this;if(K(t instanceof X1&&r instanceof Dt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){K(!r.poll).throw(L.notSupportedError);var s=oS(r),o=new Br;return t._sendUserMessage(s).onPending(function(u){o._trigger(u)}).onFailed(function(u,c){o._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),o._trigger(u)}),o}if(r.isFileMessage()){s=lS(r);var a=new Br;return t._sendFileMessage(s).onPending(function(u){a._trigger(u)}).onFailed(function(u,c){a._triggerFailed(u,c)}).onSucceeded(function(u){t.isGroupChannel()&&i._tryUpdateLastMessageAndCallEvents(t,u),a._trigger(u)}),a}if(r.isMultipleFilesMessage()){if(t.isGroupChannel()){s=Cx(r);var l=new dh;return t._sendMultipleFilesMessage(s,Yn.COPY).onPending(function(u){l._trigger(u)}).onFailed(function(u,c){l._triggerFailed(u,c)}).onSucceeded(function(u){i._tryUpdateLastMessageAndCallEvents(t,u),l._trigger(u)}).onFileUploaded(function(u,c,d,h){l._triggerOnFileUploaded(u,c,d,h)}),l}throw L.channelTypeNotSupportedError}},n}(X1),tR=function(){this.onUserMuted=qe,this.onUserUnmuted=qe,this.onUserBanned=qe,this.onUserUnbanned=qe,this.onChannelChanged=qe,this.onChannelDeleted=qe,this.onChannelFrozen=qe,this.onChannelUnfrozen=qe,this.onOperatorUpdated=qe,this.onChannelMemberCountChanged=qe,this.onMetaDataCreated=qe,this.onMetaDataUpdated=qe,this.onMetaDataDeleted=qe,this.onMetaCounterCreated=qe,this.onMetaCounterUpdated=qe,this.onMetaCounterDeleted=qe,this.onMessageReceived=qe,this.onMessageUpdated=qe,this.onMessageDeleted=qe,this.onMentionReceived=qe,this.onReactionUpdated=qe,this.onThreadInfoUpdated=qe},cc,Qs={},nR=function(){function e(n){var t=n._iid,r=n.limit,i=r===void 0?100:r,s=this;this.ref=0,this._iid=t,this._limit=i;var o,a=O.of(this._iid),l=a.sdkState,u=a.dispatcher,c=a.logger,d=a.cacheContext;this._metadataKey=(o=l.userId,"sendbird:".concat(o,"@groupchannel/sync.meta"));var h=function(f){return"sendbird:".concat(f,"@groupchannel/sync")}(l.userId);this._sync=new ko(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,v,_,E,S,w,N,I,R;return g(this,function(A){switch(A.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(A.sent(),c.debug("channel background sync from",(w=this._metadata)===null||w===void 0?void 0:w.token),(N=this._metadata)===null||N===void 0?void 0:N.completed)return[3,13];A.label=2;case 2:if(A.trys.push([2,9,,12]),(p={includeEmpty:!0,order:Pt.CHRONOLOGICAL}).order!==Pt.LATEST_LAST_MESSAGE)return[3,6];A.label=3;case 3:return A.trys.push([3,5,,6]),[4,d.preference.get(zv(l.appId))];case 4:return m=A.sent(),p.includeChatNotification=!!m,[3,6];case 5:return A.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannels((R=(I=this._metadata)===null||I===void 0?void 0:I.token)!==null&&R!==void 0?R:"",p,this._limit,G.SYNC_CHANNEL_BACKGROUND)];case 7:return b=A.sent(),v=b.channels,_=b.token,f.hasNext=v.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,Pe([],Ae(v.map(function(x){return x.createdAt})),!1)),this._metadata.completed=!f.hasNext),c.debug("channel background sync progress",f),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),c.debug("channel background sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetaData()]:[3,11];case 10:A.sent(),A.label=11;case 11:throw E;case 12:return[3,14];case 13:f.hasNext=!1,f.nextToken="",A.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof _i&&(f.stateType===st.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return Qs[n]||(Qs[n]=new e({_iid:n})),Qs[n].ref++,Qs[n]},e.clear=function(n){Qs[n]&&(Qs[n].close(),delete Qs[n])},Object.defineProperty(e.prototype,"range",{get:function(){var n,t;return(t=(n=this._metadata)===null||n===void 0?void 0:n.range)!==null&&t!==void 0?t:new cs({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"completed",{get:function(){var n;return!!(!((n=this._metadata)===null||n===void 0)&&n.completed)},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,O.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:n=t.sent(),this._metadata={token:n?n.token:"",range:new cs(n?n.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!n&&n.completed},t.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetaData=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var n,t,r=O.of(this._iid),i=r.logger;r.sessionManager.session.hasSession&&(i.debug("channel background sync resume()"),this._sync.start((t=(n=this._metadata)===null||n===void 0?void 0:n.token)!==null&&t!==void 0?t:""))},e.prototype.pause=function(){O.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Qs[this._iid])},e}(),Ys={},rR=function(){function e(n){var t=n._iid,r=this;this.ref=0,this._iid=t;var i,s=O.of(this._iid),o=s.logger,a=s.sdkState,l=s.dispatcher,u=s.cacheContext;this._metadataKey=(i=a.userId,"sendbird:".concat(i,"@groupchannel/changelogs.meta")),this._subscribers=new Ra;var c=function(d){return"sendbird:".concat(d,"@groupchannel/changelogs")}(a.userId);this._sync=new ko(c,function(){return y(r,void 0,void 0,function(){var d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:I.sent(),o.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),I.label=2;case 2:I.trys.push([2,9,,12]),h={includeEmpty:!0},I.label=3;case 3:return I.trys.push([3,5,,6]),[4,u.preference.get(zv(a.appId))];case 4:return f=I.sent(),h.includeChatNotification=!!f,[3,6];case 5:return I.sent(),h.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannelChangeLogs((N=(w=this._metadata)===null||w===void 0?void 0:w.token)!==null&&N!==void 0?N:"",h,G.SYNC_CHANNEL_CHANGELOGS)];case 7:return p=I.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,v=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:v,token:_}),d.hasNext=v,d.nextToken=_,this._metadata&&(this._metadata.token=_),o.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return I.sent(),[3,12];case 9:return E=I.sent(),o.debug("channel changelog sync error",E),E instanceof L&&E.isInvalidTokenError?[4,this.clearMetadata()]:[3,11];case 10:I.sent(),I.label=11;case 11:throw E;case 12:return[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof _i&&(d.stateType===st.CONNECTED?r.resume():r.pause())})}return e.of=function(n){return Ys[n]||(Ys[n]=new e({_iid:n})),Ys[n].ref++,Ys[n]},e.clear=function(n){Ys[n]&&(Ys[n].close(),delete Ys[n])},Object.defineProperty(e.prototype,"isRunning",{get:function(){return this._sync.isRunning},enumerable:!1,configurable:!0}),e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(n=O.of(this._iid),t=n.cacheContext,r=n.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:i=s.sent(),this._metadata={token:i?i.token:r},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return this._metadata?[4,O.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return y(this,void 0,void 0,function(){return g(this,function(n){switch(n.label){case 0:return[4,O.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return n.sent(),this._metadata=void 0,[2]}})})},e.prototype.on=function(n,t){return this._subscribers.on(n,t)},e.prototype.resume=function(){O.of(this._iid).sessionManager.session.hasSession&&this._sync.start(0)},e.prototype.pause=function(){this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete Ys[this._iid])},e}(),mh=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},hy=function(e,n,t){if(e.length>0){for(var r=mh(e,n),i=0,s=e.length-1,o=Math.floor((i+s)/2);i0)s=o,o=Math.floor((i+s)/2);else{if(!(a<0))return{place:o,oldPosition:r};i=o+1,o=Math.floor((i+s)/2)}}return{place:fy(e[o],n,t)>=0?o:o+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},fy=function(e,n,t){switch(t){case Pt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?n.lastMessage.createdAt-e.lastMessage.createdAt:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case Pt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case Pt.CHANNEL_NAME_ALPHABETICAL:var r=e.name.localeCompare(n.name);return r===0?e.createdAt-n.createdAt:r;default:return 0}},iR=function(){function e(n,t){var r=t.filter,i=r===void 0?new NS:r,s=t.order,o=s===void 0?Pt.LATEST_LAST_MESSAGE:s,a=t.limit,l=a===void 0?pS:a,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat($s()),this._isDisposed=!1,this._isGetRemoteChannelsSucceeded=!0,this._includeChangesOnInitialLoad=c,this.filter=i,this.order=o,this._hasMore=!0,this._token="",this._limit=l;var h=O.of(this._iid),f=h.sdkState,p=h.cacheContext,m=h.dispatcher;p.localCacheEnabled&&(this._backgroundSync=nR.of(n),this._backgroundSync.resume()),this._changelogSync=rR.of(n),this._changelogSync.resume(),Nn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,v){var _=v.source;if(_h(_)){var E=b.filter(function(w){return d.filter.match(w,f.userId)}),S=b.filter(function(w){return!d.filter.match(w,f.userId)}).map(function(w){return w.url});E.length>0&&d._addChannelsToView(E,v),S.length>0&&d._removeChannelsFromView(S,v)}},onRemove:function(b,v){d._removeChannelsFromView(b,v)}}),O.of(this._iid).statManager.put(new Fl({type:yt.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof _i&&(b.stateType===st.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return g(this,function(v){switch(v.label){case 0:return[4,this._revokeLoadMore()];case 1:return v.sent(),[2]}})}):b.stateType===st.LOGOUT&&d.dispose())})}return Object.defineProperty(e.prototype,"hasMore",{get:function(){return!this._isDisposed&&this._hasMore},enumerable:!1,configurable:!0}),e.prototype.setGroupChannelCollectionHandler=function(n){this._handler=n},e.prototype._addChannelsToView=function(n,t,r){var i,s,o,a,l=this;r===void 0&&(r=!1);var u=[],c=[],d=[];try{for(var h=ve(n),f=h.next();!f.done;f=h.next()){var p=f.value,m=mh(this.channels,p);m>=0&&this.channels.splice(m,1);var b=hy(this.channels,p,this.order).place;if(m<0)b===this.channels.length?!r&&this._hasMore||(u.push(p),this.channels.push(p)):(u.push(p),this.channels.splice(b,0,p));else switch(t.source){case G.EVENT_CHANNEL_UPDATED:case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_CHANNEL_CHANGELOGS:case G.EVENT_MESSAGE_SENT:this.order===Pt.CHANNEL_NAME_ALPHABETICAL&&this._hasMore&&b===this.channels.length?d.push(p):(this.channels.splice(b,0,p),c.push(p));break;default:this.channels.splice(b,0,p),c.push(p)}}}catch(S){i={error:S}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(i)throw i.error}}if(d.length>0)try{for(var v=ve(d),_=v.next();!_.done;_=v.next()){p=_.value;var E=mh(this.channels,p);E!==-1&&this.channels.splice(E,1)}}catch(S){o={error:S}}finally{try{_&&!_.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}_h(t.source)&&De(function(){return y(l,void 0,void 0,function(){var S,w,N;return g(this,function(I){return u.length>0&&(!((S=this._handler)===null||S===void 0)&&S.onChannelsAdded)&&this._handler.onChannelsAdded(t,u),c.length>0&&(!((w=this._handler)===null||w===void 0)&&w.onChannelsUpdated)&&this._handler.onChannelsUpdated(t,c),d.length>0&&(!((N=this._handler)===null||N===void 0)&&N.onChannelsDeleted)&&this._handler.onChannelsDeleted(t,d.map(function(R){return R.url})),[2]})})})},e.prototype._removeChannelsFromView=function(n,t){var r,i,s=this,o=[],a=function(d){var h=l.channels.findIndex(function(f){return f.url===d});h>=0&&(o.push(l.channels[h].url),l.channels.splice(h,1))},l=this;try{for(var u=ve(n),c=u.next();!c.done;c=u.next())a(c.value)}catch(d){r={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return _h(t.source)&&o.length>0&&De(function(){return y(s,void 0,void 0,function(){var d;return g(this,function(h){return!((d=this._handler)===null||d===void 0)&&d.onChannelsDeleted&&this._handler.onChannelsDeleted(t,o),[2]})})}),o},e.prototype._getLocalChannels=function(){return y(this,void 0,void 0,function(){var n,t;return g(this,function(r){switch(r.label){case 0:return n=Nn.of(this._iid),t=this.channels.length>0?function(i,s){var o,a,l,u;switch(s){case Pt.LATEST_LAST_MESSAGE:return(a=(o=i.lastMessage)===null||o===void 0?void 0:o.createdAt)!==null&&a!==void 0?a:i.createdAt;case Pt.CHRONOLOGICAL:return i.createdAt;case Pt.CHANNEL_NAME_ALPHABETICAL:return i.name;default:return(u=(l=i.lastMessage)===null||l===void 0?void 0:l.createdAt)!==null&&u!==void 0?u:i.createdAt}}(this.channels[this.channels.length-1],this.order):null,[4,n.getChannelsFromCache(t,this.filter,this.order,this._limit,t?this.channels[this.channels.length-1].url:void 0)];case 1:return[2,r.sent()]}})})},e.prototype._getRemoteChannels=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ne(M(M({},this.filter),{order:this.order})),this._limit)];case 1:return n=i.sent(),t=n.channels,r=n.token,this._token=r,this._hasMore=!!r,[2,t]}})})},e.prototype._revokeLoadMore=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:if(this._isDisposed)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._getRemoteChannels()];case 2:return n=t.sent(),this._isGetRemoteChannelsSucceeded=!0,this._addChannelsToView(n,{source:G.REQUEST_CHANNEL},!0),[3,4];case 3:return t.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,4];case 4:return[2]}})})},e.prototype.loadMore=function(){var n;return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S=this;return g(this,function(w){switch(w.label){case 0:if(this._isDisposed)throw new L({code:Ie.COLLECTION_DISPOSED,message:"Collection has been disposed."});return t=null,this._includeChangesOnInitialLoad&&this.channels.length===0&&this._changelogSync.isRunning?[4,new Promise(function(N){S._changelogSyncSubscriberContext=S._changelogSync.on("progress",function(I){return N(I)}).on("pause",function(){return N(null)})})]:[3,2];case 1:t=w.sent(),(n=this._changelogSyncSubscriberContext)===null||n===void 0||n.close(),w.label=2;case 2:return r=[],this._hasMore?(i=O.of(this._iid),s=i.cacheContext,o=i.connectionManager,!s.localCacheEnabled||o.isConnected&&!this._backgroundSync.completed?[3,4]:[4,Ot(function(){return y(S,void 0,void 0,function(){return g(this,function(N){switch(N.label){case 0:return[4,this._getLocalChannels()];case 1:return r=N.sent(),[2]}})})})]):[3,8];case 3:return w.sent(),this._hasMore=r.length>=this._limit,[3,7];case 4:return w.trys.push([4,6,,7]),[4,this._getRemoteChannels()];case 5:return r=w.sent(),this._isGetRemoteChannelsSucceeded=!0,[3,7];case 6:return w.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,7];case 7:this._addChannelsToView(r,{source:G.REQUEST_CHANNEL},!0),w.label=8;case 8:if(t){try{for(a=ve(t.updatedChannels),l=a.next();!l.done;l=a.next())u=l.value,(m=mh(r,u))>=0?r[m]=u:(c=hy(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(v=a.return)&&v.call(a)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=ve(t.deletedChannelUrls),f=h.next();!f.done;f=h.next())p=f.value,(m=d.indexOf(p))>=0&&(r.splice(m,1),d.splice(m,1))}catch(N){_={error:N}}finally{try{f&&!f.done&&(E=h.return)&&E.call(h)}finally{if(_)throw _.error}}}return[2,r]}})})},e.prototype.dispose=function(){var n,t,r;this._isDisposed||(this._isDisposed=!0,this.channels.length>0&&this.channels.splice(0,this.channels.length),(n=this._backgroundSync)===null||n===void 0||n.close(),(t=this._changelogSync)===null||t===void 0||t.close(),(r=this._changelogSyncSubscriberContext)===null||r===void 0||r.close(),Nn.of(this._iid).unsubscribeChannelEvent(this._key))},e}(),sR=function(e){function n(t){var r=this,i=t.token,s=t.limit,o=t.order,a=t.includeEmpty,l=t.membershipFilter,u=t.channelNameContainsFilter,c=t.channelUrlsFilter,d=t.customTypesFilter,h=t.customTypeStartsWithFilter,f=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,b=t.metadataValues,v=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Q.GET,r.path=ir,r.params=Ee(Ne({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:a,public_mode:ms.PUBLIC,public_membership_mode:l,name_contains:u,channel_urls:c,custom_types:d,custom_type_startswith:h,super_mode:f,metadata_order_key:p,metadata_key:m,metadata_values:b,metadata_value_startswith:v,show_frozen:_,show_metadata:E})),r}return T(n,e),n}(Y),oR=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.channels=[];var s=r.next,o=r.channels,a=r.ts;return i.token=s,o&&o.length>0&&(i.channels=o.map(function(l){return l.ts=a,new di(t,l)})),i.ts=typeof a=="number"?a:0,i}return T(n,e),n}(ae);(function(e){e.ALL="all",e.JOINED="joined"})(cc||(cc={}));var aR=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=cc.ALL,_.superChannelFilter=Ur.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=oc.CHRONOLOGICAL,_.includeEmpty=(i=r.includeEmpty)!==null&&i!==void 0&&i,_.includeFrozen=(s=r.includeFrozen)===null||s===void 0||s,_.includeMetaData=(o=r.includeMetaData)===null||o===void 0||o,_.channelUrlsFilter=(a=r.channelUrlsFilter)!==null&&a!==void 0?a:null,_.customTypesFilter=(l=r.customTypesFilter)!==null&&l!==void 0?l:null,_.customTypeStartsWithFilter=(u=r.customTypeStartsWithFilter)!==null&&u!==void 0?u:null,_.channelNameContainsFilter=(c=r.channelNameContainsFilter)!==null&&c!==void 0?c:null,_.membershipFilter=(d=r.membershipFilter)!==null&&d!==void 0?d:cc.ALL,_.superChannelFilter=(h=r.superChannelFilter)!==null&&h!==void 0?h:Ur.ALL,_.metadataKey=(f=r.metadataKey)!==null&&f!==void 0?f:null,_.metadataValues=(p=r.metadataValues)!==null&&p!==void 0?p:null,_.metadataOrderKeyFilter=(m=r.metadataOrderKeyFilter)!==null&&m!==void 0?m:null,_.metadataValueStartsWith=(b=r.metadataValueStartsWith)!==null&&b!==void 0?b:null,_.order=(v=r.order)!==null&&v!==void 0?v:oc.CHRONOLOGICAL,_}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter,!0)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter,!0)&&Ge(cc,this.membershipFilter)&&Ge(Ur,this.superChannelFilter)&&Ge(oc,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return this._validate()?this._isLoading?[3,3]:(t=[],this._hasNext?(this._isLoading=!0,r=O.of(this._iid).requestQueue,i=new sR(Ne(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(oR),a=o.channels,l=o.token,this._token=l,this._hasNext=!!l,this._isLoading=!1,[2,a];case 2:return[2,t];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),eg=function(e){function n(t){t===void 0&&(t={});var r=e.call(this)||this;return Object.keys(t).forEach(function(i){r.hasOwnProperty(i)&&(r[i]=t[i])}),r}return T(n,e),n}(function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.onUserJoined=qe,t.onUserLeft=qe,t.onUserReceivedInvitation=qe,t.onUserDeclinedInvitation=qe,t.onChannelHidden=qe,t.onUnreadMemberStatusUpdated=qe,t.onUndeliveredMemberStatusUpdated=qe,t.onTypingStatusUpdated=qe,t.onPollUpdated=qe,t.onPollVoted=qe,t.onPollDeleted=qe,t.onPinnedMessageUpdated=qe,t}return T(n,e),n}(tR)),lR=function(e){function n(t){var r=this,i=t.token,s=t.limit,o=t.order,a=t.reverse,l=t.channelUrl,u=t.messageTypeFilter,c=t.scheduledStatus;return(r=e.call(this)||this).method=Q.GET,r.path="".concat(oC),r.params=Ee(Ne({token:i,limit:s,reverse:a,channel_url:l,order:o,message_type:u,status:c})),r}return T(n,e),n}(Y),uR=function(e){function n(t,r){var i=e.call(this,t,r)||this;i.scheduledMessages=[];var s=r.next,o=r.scheduled_messages;return i.token=s,i.scheduledMessages=o.map(function(a){return vr(t,a)}),i}return T(n,e),n}(ae),cR=function(e){function n(t,r){var i,s,o,a,l,u=this;return(u=e.call(this,t,r)||this).channelUrl=null,u.order=null,u.reverse=!1,u.scheduledStatus=null,u.messageTypeFilter=er.ALL,u.channelUrl=(i=r.channelUrl)!==null&&i!==void 0?i:null,u.order=(s=r.order)!==null&&s!==void 0?s:null,u.reverse=(o=r.reverse)!==null&&o!==void 0&&o,u.scheduledStatus=(a=r.scheduledStatus)!==null&&a!==void 0?a:null,u.messageTypeFilter=(l=r.messageTypeFilter)!==null&&l!==void 0?l:er.ALL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&k("string",this.channelUrl,!0)&&(Ge(fm,this.order)||this.order===null)&&k("boolean",this.reverse)&&(We(uo,this.scheduledStatus)||this.scheduledStatus===null)&&Ge(er,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,t=O.of(this._iid).requestQueue,r=new lR(Ne(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(uR),o=s.scheduledMessages,a=s.token,this._token=a,this._hasNext=!!a,this._isLoading=!1,[2,o];case 2:return[2,[]];case 3:throw L.queryInProgress;case 4:return[3,6];case 5:throw L.invalidParameters;case 6:return[2]}})})},n}(Uo),dR=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="groupChannel",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new Nn(t,{sdkState:i,cacheContext:c,dispatcher:s,sessionManager:o,requestQueue:a,logger:l})},n.prototype.createGroupChannelCollection=function(t){return t===void 0&&(t={}),new iR(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new MS(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new aR(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new cR(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){K(k("string",t)&&r instanceof eg).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){K(k("string",t)).throw(L.invalidParameters),this._manager.removeHandler(t)},n.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},n.prototype.buildGroupChannelFromSerializedData=function(t){return this._manager.buildGroupChannelFromSerializedData(t)},n.prototype.buildGroupChannelListQueryFromSerializedData=function(t){return this._manager.buildGroupChannelListQueryFromSerializedData(t)},n.prototype.buildMemberFromSerializedData=function(t){return this._manager.buildMemberFromSerializedData(t)},n.prototype.getChannel=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(k("string",t)).throw(L.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]})})},n.prototype.getMyGroupChannelChangeLogsByToken=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},df),r),K(k("string",t)&&_m(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i;return g(this,function(s){switch(s.label){case 0:return i=M(M({},df),r),K(k("number",t)&&_m(i)).throw(L.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,i)];case 1:return[2,s.sent()]}})})},n.prototype.getGroupChannelCount=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},IS),t),K(AS(r)).throw(L.invalidParameters),[2,this._manager.getGroupChannelCount(r)]})})},n.prototype.getUnreadItemCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getUnreadItemCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this._manager.getTotalUnreadChannelCount()];case 1:return[2,t.sent()]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalUnreadMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._manager.getTotalScheduledMessageCount(t)];case 1:return[2,r.sent()]}})})},n.prototype.getSubscribedTotalUnreadMessageCount=function(){return this._manager.getSubscribedTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount()},n.prototype.getSubscribedCustomTypeUnreadMessageCount=function(t){return this._manager.getSubscribedCustomTypeUnreadMessageCount(t)},n.prototype.createChannel=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},ph),t),K(pm(r)).throw(L.invalidParameters),[2,this._manager.createChannel(r)]})})},n.prototype.createDistinctChannelIfNotExist=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},ph),t),K(pm(r)).throw(L.invalidParameters),r&&(r.isDistinct=!0),[2,this.createChannel(r)]})})},n.prototype.createChannelWithUserIds=function(t,r,i,s,o,a){return r===void 0&&(r=!1),o===void 0&&(o=""),a===void 0&&(a=""),y(this,void 0,void 0,function(){var l;return g(this,function(u){return l=M(M({},ph),{invitedUserIds:t,isDistinct:r,name:i,data:o,customType:a}),typeof s=="string"?l.coverUrl=s:l.coverImage=s,[2,this.createChannel(l)]})})},n.prototype.markAsReadAll=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){return K(We("string",t)).throw(L.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]})})},n.prototype.markAsDelivered=function(t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return K(k("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(Wv);const ff={collection:{groupChannel:{defaultLimit:20,defaultOrder:Pt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var hR=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const fR=(e,n)=>{D.useEffect(xS(e),n)},pR=(e,n)=>{D.useLayoutEffect(xS(e),n)},Mp=e=>e(),xS=e=>()=>{const n=Mp(e);return()=>{n&&(n instanceof Promise?Mp(()=>hR(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):Mp(n))}};let _R=0;function mR(){return D.useState(()=>`${_R++}`)[0]}const OS=(e,n,t)=>{const r=D.useRef(n),s=mR();r.current=n,D.useEffect(()=>{var o;const a=l=>(Object.keys(l).forEach(c=>{l[c]=(...d)=>{var h,f;return(f=(h=r.current)===null||h===void 0?void 0:h[c])===null||f===void 0?void 0:f.call(h,...d)}}),l);return(o=e==null?void 0:e.groupChannel)===null||o===void 0||o.addGroupChannelHandler(s,a(new eg)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function hn(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var vR=function(e){function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.name="poll",t}return T(n,e),n.prototype.init=function(t,r){var i=r.sdkState,s=r.dispatcher,o=r.sessionManager,a=r.requestQueue,l=r.logger,u=r.onlineDetector,c=r.cacheContext;e.prototype.init.call(this,t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c}),this._manager=new nf(t,{sdkState:i,dispatcher:s,sessionManager:o,requestQueue:a,logger:l,onlineDetector:u,cacheContext:c})},n.prototype.create=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},U6),t),K(qC(r)).throw(L.invalidParameters),[2,this._manager.create(r)]})})},n.prototype.get=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},F6),t),K(KC(r)).throw(L.invalidParameters),[2,this._manager.get(r)]})})},n.prototype.getOption=function(t){return y(this,void 0,void 0,function(){var r;return g(this,function(i){return r=M(M({},P6),t),K(WC(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(Wv),gR=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},py=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),kS=function(e){this.key=e.key,this.url=e.url},RS=function(e){this.id=e.id,this.name=e.name,this.url=e.url,this.emojis=e.emojis?e.emojis.map(function(n){return new kS(n)}):[]},yR=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new RS(n)}):[]},ER={profileImage:void 0,profileUrl:void 0,nickname:void 0},_y=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,o;return g(this,function(a){switch(a.label){case 0:switch(n){case 1:case 2:case 3:case 4:return[3,1];case 5:return[3,2];case 6:return[3,4]}return[3,11];case 1:return t(),[3,12];case 2:return[4,e.store.clear()];case 3:return a.sent(),t(),[3,12];case 4:return a.trys.push([4,9,,10]),r=function(l){return{v2:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:_S,keyName:_x,index:[fh(Pt.LATEST_LAST_MESSAGE),fh(Pt.CHRONOLOGICAL),fh(Pt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:um,keyName:mx,index:[hs(zn.CHANNEL_LATEST),hs(zn.NEWEST_CHILD_MESSAGE)]},{collectionName:yS,keyName:Jx,index:[hs(zn.CHANNEL_LATEST),hs(zn.NEWEST_CHILD_MESSAGE)]},{collectionName:gx,keyName:yx}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:Ex,keyName:bx,index:[gR()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:vS,keyName:vx,index:[Kx()]}])];case 1:return[2,u.sent()]}})})}}}(e),i=r.v2,s=r.v3,o=r.v4,[4,i()];case 5:return a.sent(),[4,s()];case 6:return a.sent(),[4,o()];case 7:return a.sent(),[4,e.collection(um).removeIf({where:{channelType:Ze.OPEN}})];case 8:case 9:return a.sent(),[3,10];case 10:return t(),[3,12];case 11:t(),a.label=12;case 12:return[2]}})})}},bR=function(){return typeof document<"u"?document.visibilityState:"visible"},CR=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?bR:r,s=t.initialState,o=s===void 0?"visible":s,a=t.isEnabled,l=a===void 0||a,u=t.pauseCheckDelay,c=u===void 0?3e4:u,d=e.call(this)||this;return d._pauseCheckDelay=3e4,d._currentState="visible",d._getVisibilityState=i,d._pauseCheckDelay=c,d._currentState=o,d._isEnabled=l,d._boundToggleState=d._toggleState.bind(d),d}return T(n,e),Object.defineProperty(n.prototype,"currentState",{get:function(){return this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAvailable",{get:function(){return typeof window<"u"&&!!window.addEventListener&&!!window.removeEventListener},enumerable:!1,configurable:!0}),n.prototype._toggleState=function(){var t=this,r=this._getVisibilityState();r!=="hidden"?this._currentState==="hidden"&&(this._pauseDelayTimer&&(clearTimeout(this._pauseDelayTimer),this._pauseDelayTimer=void 0),this.dispatch("resume")):this._currentState!=="hidden"&&(this._pauseDelayTimer=setTimeout(function(){t._pauseDelayTimer=void 0,t.dispatch("pause")},this._pauseCheckDelay)),this._currentState=r},n.prototype.start=function(){this._isEnabled&&this.isAvailable&&(this._boundToggleState=this._toggleState.bind(this),window.addEventListener("visibilitychange",this._boundToggleState,{capture:!0}))},n.prototype.stop=function(){this._isEnabled&&this.isAvailable&&this._boundToggleState&&window.removeEventListener("visibilitychange",this._boundToggleState,{capture:!0})},n}(Ra),SR=function(){function e(n){var t=n.logger,r=n.connectionDelegate,i=r===void 0?null:r,s=this;this._onlineWorker=function(){var o;return(o=s.connectionDelegate)===null||o===void 0?void 0:o.reconnect()},this._offlineWorker=function(){var o;return(o=s.connectionDelegate)===null||o===void 0?void 0:o.disconnect()},this.unsubscribes=[],this._onlineListener=function(o){if(s.isAvailableOnWeb)return window.addEventListener("online",o),function(){return window.removeEventListener("online",o,!1)}},this._offlineListener=function(o){if(s.isAvailableOnWeb)return window.addEventListener("offline",o),function(){return window.removeEventListener("offline",o,!1)}},this.logger=t,i&&(this.connectionDelegate=i)}return Object.defineProperty(e.prototype,"isAvailableOnWeb",{get:function(){return typeof window<"u"&&!!window.addEventListener&&"ononline"in window&&"onoffline"in window&&typeof navigator<"u"&&navigator.onLine!==void 0},enumerable:!1,configurable:!0}),e.prototype.setOnlineListener=function(n){n&&typeof n=="function"&&(this._onlineListener=n)},e.prototype.setOfflineListener=function(n){n&&typeof n=="function"&&(this._offlineListener=n)},e.prototype.start=function(){this.unsubscribes=[this._onlineListener(this._onlineWorker),this._offlineListener(this._offlineWorker)]},e.prototype.stop=function(){var n=this;this.unsubscribes.forEach(function(t){try{t==null||t()}catch(r){n.logger.warn(r.message)}}),this.unsubscribes=[]},e.prototype.isOnline=function(){return y(this,void 0,void 0,function(){return g(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Q.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),my=function(e){function n(t){var r=t.userId,i=t.nickname,s=t.profileUrl,o=t.profileImage,a=t.preferredLanguages,l=e.call(this)||this;return l.method=Q.PUT,l.path="".concat(Xe,"/").concat(encodeURIComponent(r)),l.params=Ee(Ne({nickname:i,profile_url:s,profile_file:o,preferred_languages:a})),l}return T(n,e),n}(Y),vy=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ke(t,M({},r)),i}return T(n,e),n}(ae),TR=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,o=t.deviceManufacturer,a=t.systemPushEnabled,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=Ee({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i}T(n,e)})(ae);var wR=function(e){function n(t){var r=t.userId,i=t.token,s=t.deviceOS,o=t.deviceManufacturer,a=t.systemPushEnabled,l=e.call(this)||this;return l.method=Q.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=Ee({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i}T(n,e)})(ae);var NR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var IR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.token=r.token,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var AR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var MR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.type=r.type?In[r.type.toLowerCase()]:In.UNKNOWN,i.user=new Ke(t,r.user),i.lastDeletedAt=r.device_token_last_deleted_at,i}T(n,e)})(ae);var xR=function(e){function n(t){var r=t.userId,i=t.type,s=t.token,o=t.ts,a=e.call(this)||this;return a.method=Q.GET,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/").concat(encodeURIComponent(i),"/device_tokens"),a.params={created_ts:o,token:s},a}return T(n,e),n}(Y),OR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTokens={type:r.type?In[r.type.toLowerCase()]:In.UNKNOWN,deviceTokens:r.device_tokens,hasMore:r.has_more,token:r.token},i}return T(n,e),n}(ae),kR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return T(n,e),n}(Y),RR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(ae),LR=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return T(n,e),n}(Y),DR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.autoAccept=r.auto_accept,i}return T(n,e),n}(ae),UR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),PR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(ae),FR=function(e){function n(t){var r=t.userId,i=t.doNotDisturbOn,s=t.startHour,o=t.startMin,a=t.endHour,l=t.endMin,u=t.timezone,c=e.call(this)||this;return c.method=Q.PUT,c.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),c.params={do_not_disturb:i,start_hour:s,start_min:o,end_hour:a,end_min:l,timezone:u},c}return T(n,e),n}(Y),HR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.preference={doNotDisturbOn:r.do_not_disturb,startHour:r.start_hour,startMin:r.start_min,endHour:r.end_hour,endMin:r.end_min,timezone:r.timezone},i}return T(n,e),n}(ae),jR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),BR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(ae),$R=function(e){function n(t){var r=t.userId,i=t.snoozeOn,s=t.startTs,o=t.endTs,a=e.call(this)||this;return a.method=Q.PUT,a.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),a.params={snooze_enabled:i,snooze_start_ts:s,snooze_end_ts:o},a}return T(n,e),n}(Y),GR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.snoozePeriod={isSnoozeOn:r.snooze_enabled},typeof r.snooze_start_ts=="number"&&(i.snoozePeriod.startTs=r.snooze_start_ts),typeof r.snooze_end_ts=="number"&&(i.snoozePeriod.endTs=r.snooze_end_ts),i}return T(n,e),n}(ae),zR=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return T(n,e),n}(Y);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.user=new Ke(t,r),i}T(n,e)})(ae);var VR=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var qR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(Y),WR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(ae),KR=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return T(n,e),n}(Y),QR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pushTriggerOption=r.push_trigger_option,i}return T(n,e),n}(ae),YR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),i}return T(n,e),n}(Y),ZR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(ae),XR=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return T(n,e),n}(Y),JR=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.name=r.name,i}return T(n,e),n}(ae),eL=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Q.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return T(n,e),n}(Y),tL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.changelogs={addedUsers:r.added.map(function(s){return new Ke(t,s)}),updatedUsers:r.updated.map(function(s){return new Ke(t,s)}),deletedUserIds:r.deleted,hasMore:r.has_more,token:r.next},i}return T(n,e),n}(ae),nL=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discoveries:i.map(function(o){return{friend_discovery_key:o.friendDiscoveryKey,friend_name:o.friendName}})},s}return T(n,e),n}(Y),rL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.friendDiscoveryRequestId=r.friend_discovery_request_id,i}return T(n,e),n}(ae),iL=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var sL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Q.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Y),oL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.users=r.users.map(function(s){return new Ke(t,s)}),i}return T(n,e),n}(ae),aL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Q.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var lL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return T(n,e),n}(Y),uL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.allowFriendDiscovery=r.allow_friend_discovery,i}return T(n,e),n}(ae),cL=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Q.PUT,s.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return T(n,e),n}(Y);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(ae);var pf,dL=function(e){function n(){var t=e.call(this)||this;return t.method=Q.GET,t.path=sC,t}return T(n,e),n}(Y),hL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new yR(r),i}return T(n,e),n}(ae),fL=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(sC,"/").concat(r),i}return T(n,e),n}(Y),pL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new RS(r),i}return T(n,e),n}(ae),_L=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Q.GET,i.path="".concat(q4,"/").concat(r),i}return T(n,e),n}(Y),mL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new kS(r),i}return T(n,e),n}(ae),vL=function(e){function n(){var t=e.call(this)||this;return t.method=Q.GET,t.path="".concat(W4),t}return T(n,e),n}(Y),gL=function(e){function n(t,r){var i,s=this,o=r??{};return(s=e.call(this,t,r)||this).uikitConfiguration={string:JSON.stringify(o),json:o},s.updatedAt=(i=r==null?void 0:r.updated_at)!==null&&i!==void 0?i:0,s}return T(n,e),n}(ae);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(pf||(pf={}));var du,gy=function(e){function n(t){var r=t.deviceToken,i=t.pushTrackingId,s=t.messageId,o=t.allowedPushNotification,a=t.channelKey,l=t.templateKey,u=t.eventType,c=t.notificationEventDeadline,d=e.call(this)||this;return d.method=Q.POST,d.path=Q4,d.params=Ee({device_token:r,push_tracking_id:i,message_id:s,allowed_push_notification:o,channel_key:a,template_key:l,event_type:u,notification_event_deadline:c}),d}return T(n,e),n}(Y),yL=function(){function e(n,t,r){var i=this;this._storeInitialized=!1,this._iid=n,this.options=t;var s=O.of(n),o=s.sdkState,a=s.cacheContext,l=s.dispatcher,u=s.sessionManager,c=s.requestQueue,d=s.logger,h=s.userEventHandlers,f=s.appStateToggleEnabled;this._onlineDetector=new SR({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,v,_,E,S;return g(this,function(w){switch(w.label){case 0:if(m=O.of(n),b=m.sdkState,v=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,v.connect(_.session.authToken)];case 2:return w.sent(),[3,4];case 3:if(E=w.sent(),Lr(E))throw E;return d.debug("connect failed by reconnect event = ",E),[3,4];case 4:return[3,9];case 5:if(b.appState!=="foreground")return[3,9];w.label=6;case 6:return w.trys.push([6,8,,9]),[4,v.resetAndReconnect()];case 7:return w.sent(),[3,9];case 8:if(S=w.sent(),Lr(S))throw S;return d.debug("resetAndReconnect failed by reconnect event = ",S),[3,9];case 9:return l.dispatch(new py),[2]}})})},disconnect:function(){Ot(function(){return y(i,void 0,void 0,function(){return g(this,function(m){switch(m.label){case 0:return[4,O.of(n).connectionManager.disconnect()];case 1:return m.sent(),[2]}})})})}}});var p=new Mu(n,{localCacheEnabled:a.localCacheEnabled,enableAutoResend:a.localCacheConfig.enableAutoResend,dispatcher:l,sdkState:o,logger:d});r.forEach(function(m){m.init(n,{sdkState:o,cacheContext:a,dispatcher:l,sessionManager:u,requestQueue:c,logger:d,onlineDetector:i._onlineDetector}),i[m.name]=m}),this._appStateChangeDetector=new CR({isEnabled:f}),this._appStateChangeDetector.on("resume",function(){d.debug("the page resumes from freeze"),i.setForegroundState()}).on("pause",function(){d.debug("the page freezes"),i.setBackgroundState()}),l.on(function(m){var b;if(m instanceof _i)m.stateType===st.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof mt){if(m.code==="USEV"){var v=m.as(wS).event;if(v.category===Pc.FRIEND_DISCOVERED){var _=uf.getDataAsFriendDiscoveredEvent(n,v).friendDiscoveries;De(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onFriendsDiscovered&&I.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof xC){var E=O.of(i._iid).subscribedUnreadMessageCount,S=!1,w=m.ts;typeof w=="number"&&w>E.ts&&(E.all!==m.all&&(S=!0),E.all=m.all>=0?m.all:0,m.customTypes&&Object.keys(m.customTypes).forEach(function(N){E.customTypes[N]!==m.customTypes[N]&&(S=!0),E.customTypes[N]=m.customTypes[N]}),S=S&&E.ts>0,E.ts=w),S&&De(function(){return y(i,void 0,void 0,function(){return g(this,function(N){return[2,h.forEach(function(I){I.onTotalUnreadMessageCountChanged&&I.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),I.onTotalUnreadMessageCountUpdated&&I.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof RC?(a.preference.set(i._getUserProfileCacheKey(o.userId),em.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&a.preference.set(zv(i.appId),{value:!0})):m instanceof Ul&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i.disconnect())})}return e.init=function(n){var t=n.appId,r=n.appVersion,i=n.modules,s=i===void 0?[]:i,o=n.options,a=o===void 0?new nC:o,l=n.debugMode,u=l!==void 0&&l,c=n.customApiHost,d=n.customWebSocketHost,h=n.newInstance,f=h!==void 0&&h,p=n.logLevel,m=n.localCacheEnabled,b=m!==void 0&&m,v=n.localCacheConfig,_=v===void 0?new iC:v,E=n.localCacheEncryption,S=n.useAsyncStorageStore,w=S===void 0?null:S,N=n.useMMKVStorageStore,I=N===void 0?null:N,R=n.appStateToggleEnabled,A=R===void 0||R;if(!du||f){var x="su-".concat($s()),U=E??{encrypt:function(H){return H},decrypt:function(H){return H}},q=new Wx;q.level=p??xs.WARN;var P=new Yo({encryption:U});u||(Q_()?I?P=new Vx({MMKV:I,encryption:U}):w&&(P=new zx({AsyncStorage:w,encryption:U}),q.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):P=new Gx({encryption:U})),new O(x,{appId:t,appVersion:r,options:a,apiHost:c??"https://api-".concat(t,".sendbird.com"),websocketHost:d??"wss://ws-".concat(t,".sendbird.com"),store:P,encryption:U,logger:q,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:A});var X=[new pO,new vR],z=new e(x,a,Pe(Pe([],Ae(s),!1),Ae(X),!1));return du||(du=z),z}return du},Object.defineProperty(e,"instance",{get:function(){return du},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return eC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appId",{get:function(){return O.of(this._iid).sdkState.appId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appInfo",{get:function(){var n=O.of(this._iid).appInfo;return n??null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"appVersion",{get:function(){var n;return(n=O.of(this._iid).sdkState.appVersion)!==null&&n!==void 0?n:""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugMode",{get:function(){return!!O.of(this._iid).debugMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"logLevel",{get:function(){return O.of(this._iid).logger.level},set:function(n){O.of(this._iid).logger.level=n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCacheEnabled",{get:function(){return O.of(this._iid).cacheContext.localCacheEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCacheConfig",{get:function(){var n=O.of(this._iid).cacheContext;return n.localCacheEnabled?n.localCacheConfig:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ekey",{get:function(){return O.of(this._iid).sessionManager.ekey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentUser",{get:function(){var n;return(n=O.of(this._iid).sessionManager.currentUser)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){var n=O.of(this._iid).connectionManager;return n.isConnected?us.OPEN:n.isConnecting?us.CONNECTING:us.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastConnectedAt",{get:function(){var n=O.of(this._iid),t=n.connectedAt;return n.connectionManager.isConnected?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fcmPushToken",{get:function(){var n;return(n=this._fcmPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apnsPushToken",{get:function(){var n;return(n=this._apnsPushToken)!==null&&n!==void 0?n:null},enumerable:!1,configurable:!0}),e.prototype._getNestDBVersion=function(){return 7},e.prototype._getPreferenceCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".pref")},e.prototype._getUserProfileCacheKey=function(n){return"sendbird@".concat(this.appId,"/").concat(n,".profile")},e.prototype.getMemoryStoreForDebugging=function(){var n=O.of(this._iid),t=n.debugMode,r=n.cacheContext;if(t)return r.store instanceof Yo?r.store:null;throw L.debugModeRequired},e.prototype.addExtension=function(n,t){var r=O.of(this._iid).sdkState;["sb_uikit","sb_syncmanager","device-os-platform"].indexOf(n)>-1&&r.extensions&&(r.extensions[n]=t)},e.prototype.addSendbirdExtensions=function(n,t,r){var i,s,o=O.of(this._iid),a=o.logger,l=o.sdkState,u=new RegExp(eA);if(n.length===0)return a.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."),!1;if(n.find(function(m){return!u.test(m.version)}))return a.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."),!1;if(r)try{for(var c=ve(Object.entries(r)),d=c.next();!d.done;d=c.next()){var h=Ae(d.value,2),f=h[0],p=h[1];if(/&|=/.test(f)||/&|=/.test(p))return a.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."),!1}}catch(m){i={error:m}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}return l.sendbirdRuntimeEnvironment={sendbirdExtensions:n,deviceOS:t,customData:r},!0},e.prototype.setOnlineListener=function(n){this._onlineDetector.setOnlineListener(n)},e.prototype.setOfflineListener=function(n){this._onlineDetector.setOfflineListener(n)},e.prototype._safeInitializeStore=function(n){return y(this,void 0,void 0,function(){var t;return g(this,function(r){switch(r.label){case 0:t=O.of(this._iid).cacheContext,r.label=1;case 1:return r.trys.push([1,3,,5]),[4,t.store.init(n)];case 2:return r.sent(),this._storeInitialized=!0,[3,5];case 3:return r.sent(),t.replaceStore(new Yo),[4,this._safeInitializeStore(n)];case 4:return r.sent(),[3,5];case 5:return[2]}})})},e.prototype.initializeCache=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l,u,c;return g(this,function(d){switch(d.label){case 0:if(t=O.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.dispatcher,o=t.logger,r.userId&&r.userId===n)return[3,11];if(a="sendbird@".concat(r.appId,"/").concat(n,".db"),!i.localCacheEnabled)return[3,9];d.label=1;case 1:return d.trys.push([1,6,,8]),i.nestdb&&i.nestdb.state!==is.CLOSED&&i.nestdb.name===a?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new qx({name:l,version:this._getNestDBVersion(),store:i.store,config:new Yc({dbname:l,itemSizeLimit:61440})})).on("upgrade",_y(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",_y(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new SS(this._iid,{userId:n})),[3,5];case 3:return[4,this._safeInitializeStore(a)];case 4:d.sent(),d.label=5;case 5:return r.userId=n,[3,8];case 6:return c=d.sent(),o.warn("Nest DB Open Failed. ",c),i.store instanceof Yo||(i.replaceStore(new Yo),i.localCacheEnabled=!1),[4,this._safeInitializeStore(a)];case 7:throw d.sent(),r.userId=n,L.databaseError;case 8:return[3,11];case 9:return[4,this._safeInitializeStore(a)];case 10:d.sent(),r.userId=n,d.label=11;case 11:return[2]}})})},e.prototype.getCacheDataSize=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=O.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.estimateUsage()]:[3,2];case 1:return[2,t.sent()];case 2:return[2,0]}})})},e.prototype.clearCachedData=function(){return y(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return(n=O.of(this._iid).cacheContext).localCacheEnabled&&n.nestdb?[4,n.nestdb.clear()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this._storeInitialized?[4,n.preference.clear()]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},e.prototype.clearCachedMessages=function(n){return y(this,void 0,void 0,function(){var t,r,i=this;return g(this,function(s){switch(s.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=Cl.of(this._iid),r=Ia.of(this._iid),t&&r?[4,Promise.all(n.map(function(o){return y(i,void 0,void 0,function(){return g(this,function(a){switch(a.label){case 0:return[4,t.removeMessagesOfChannel(o)];case 1:return a.sent(),[4,r.removeMessagesOfChannel(o)];case 2:return a.sent(),[2]}})})}))]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},e.prototype._setupPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.cacheContext,s=t.statManager,[4,i.preference.init(this._getPreferenceCacheKey(n),this._getNestDBVersion())];case 1:return a.sent(),[4,i.preference.get(this._getUserProfileCacheKey(n))];case 2:return(o=a.sent())&&new em(this._iid,o).apply(),[4,s.init("sendbird@".concat(r.appId,"/").concat(n,".statlog"))];case 3:return a.sent(),[2]}})})},e.prototype._ready=function(n,t,r){return r===void 0&&(r={}),y(this,void 0,void 0,function(){var i,s,o,a,l,u;return g(this,function(c){switch(c.label){case 0:return K(k("string",n)&&k("string",t,!0)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.cacheContext,a=i.connectionManager,l=r.errorForOtherUser,s.userId&&s.userId!==n?l?[3,2]:[4,a.logout()]:[3,3];case 1:return c.sent(),[3,3];case 2:throw l;case 3:return c.trys.push([3,5,6,8]),[4,this.initializeCache(n)];case 4:return c.sent(),O.of(this._iid).dispatcher.dispatch(new TS),[3,8];case 5:return c.sent(),u=O.of(this._iid).logger,o.localCacheEnabled=!1,u.warn("Cache initialization failed - cache is not available."),[3,8];case 6:return[4,this._setupPreference(n)];case 7:return c.sent(),[7];case 8:return[2]}})})},e.prototype.authenticateFeed=function(n,t){var r;return y(this,void 0,void 0,function(){var i,s,o,a;return g(this,function(l){switch(l.label){case 0:return i=O.of(this._iid),s=i.sessionManager,o=i.connectionManager,[4,this._ready(n,t,{errorForOtherUser:o.isConnected?L.alreadyConnectedAsAnotherUser:void 0})];case 1:return l.sent(),!((r=s.session.services)===null||r===void 0)&&r.includes(Oc.CHAT)?[3,3]:(t||s.handler||(a=new J1,this.setSessionHandler(a)),[4,s.authenticateFeed(n,t)]);case 2:l.sent(),l.label=3;case 3:return[2,this.currentUser]}})})},e.prototype.connect=function(n,t){return y(this,void 0,void 0,function(){return g(this,function(r){switch(r.label){case 0:return[4,this._ready(n,t)];case 1:r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,O.of(this._iid).connectionManager.connect(t)];case 3:return r.sent(),[3,5];case 4:return this._onlineDetector.start(),this._appStateChangeDetector.start(),[7];case 5:return[2,this.currentUser]}})})},e.prototype.reconnect=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.sessionManager.session.hasSession;return i&&(this._appStateChangeDetector.start(),this._onlineDetector.start(),t.resetAndReconnect().then(function(){r.appState="foreground"}).catch(function(){})),i},e.prototype.disconnect=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),i.cancelAll(),[4,t.logout()];case 1:return s.sent(),[4,this.clearCachedData()];case 2:return s.sent(),r.appState="foreground",[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=O.of(this._iid),t=n.connectionManager,r=n.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),r.cancelAll(),[4,t.disconnectWebSocket(!0)];case 1:return i.sent(),[2]}})})},e.prototype.setBackgroundState=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.logger;r.appState==="foreground"&&(r.appState="background",i.debug("going background state"),t.background().catch(function(s){i.debug("setBackgroundState error = ",s)}))},e.prototype.setForegroundState=function(){var n=O.of(this._iid),t=n.connectionManager,r=n.sdkState,i=n.dispatcher,s=n.logger;r.appState==="background"&&(r.appState="foreground",s.debug("going foreground state"),t.resetAndReconnect().catch(function(o){s.debug("setForgroundState error = ",o)}),i.dispatch(new py))},e.prototype.setSessionHandler=function(n){K(n instanceof J1).throw(L.invalidParameters),O.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){K(k("string",n)&&t instanceof Nx).throw(L.invalidParameters),O.of(this._iid).userEventHandlers.set(n,t)},e.prototype.removeUserEventHandler=function(n){O.of(this._iid).userEventHandlers.delete(n)},e.prototype.removeAllUserEventHandler=function(){O.of(this._iid).userEventHandlers.clear()},e.prototype.addConnectionHandler=function(n,t){K(k("string",n)&&t instanceof gS).throw(L.invalidParameters),O.of(this._iid).connectionHandlers.set(n,t)},e.prototype.removeConnectionHandler=function(n){O.of(this._iid).connectionHandlers.delete(n)},e.prototype.removeAllConnectionHandler=function(){O.of(this._iid).connectionHandlers.clear()},e.prototype.createApplicationUserListQuery=function(n){return n===void 0&&(n={}),new Mx(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new kx(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new Dx(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new lO(this._iid,n)},e.prototype.createPollListQuery=function(n){return new QC(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new YC(this._iid,M({},n))},e.prototype.buildUserFromSerializedData=function(n){var t=fa(n);return new Ke(this._iid,Ke.payloadify(t))},e.prototype.updateCurrentUserInfo=function(n){return n===void 0&&(n={}),y(this,void 0,void 0,function(){var t,r,i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return t=M(M({},ER),n),K(function(c){return fr(c.profileImage,!0)&&k("string",c.profileUrl,!0)&&k("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new my(M({userId:i.userId},t)),[4,s.send(o)]):[3,2];case 1:return a=u.sent(),l=a.as(vy).user,this.currentUser&&(t.nickname&&(this.currentUser.nickname=l.nickname),(t.profileUrl||t.profileImage)&&(this.currentUser.plainProfileUrl=l.profileUrl)),[2,l];case 2:throw L.connectionRequired}})})},e.prototype.updateCurrentUserInfoWithPreferredLanguages=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return g(this,function(l){switch(l.label){case 0:return K(We("string",n)).throw(L.invalidParameters),this.currentUser?(t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new my({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return o=l.sent(),a=o.as(vy).user,this.currentUser&&(this.currentUser.preferredLanguages=a.preferredLanguages),[2,a];case 2:throw L.connectionRequired}})})},e.prototype.registerFCMPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(K(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&K(Ge(Ci,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ci.ANDROID,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),o=O.of(this._iid),a=o.sessionManager,l=o.sdkState,u=o.requestQueue,a.hasDeviceToken(In.FCM,n)?[2,Cr.SUCCESS]:(c=new wR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Ot(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return a.setDeviceToken(In.FCM,n,s),[4,a.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._fcmPushToken="",[2,Cr.SUCCESS];case 4:return h.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:if(K(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=O.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,o=new IR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,Ot(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(In.FCM,n),r.setDeviceTokenDeletedAt(a),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._fcmPushToken="",[2,Cr.SUCCESS];case 4:return u.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterFCMPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=O.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new MR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,Ot(function(){return y(a,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(In.FCM),t.setDeviceTokenDeletedAt(o),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.registerAPNSPushTokenForCurrentUser=function(n,t){var r,i;return y(this,void 0,void 0,function(){var s,o,a,l,u,c,d=this;return g(this,function(h){switch(h.label){case 0:if(K(k("string",n)&&k("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&K(Ge(Ci,t.deviceOS.platform,!0)&&k("string",t.deviceOS.version,!0)).throw(L.invalidParameters),!this.currentUser)return[3,6];s={deviceOS:"".concat(((r=t==null?void 0:t.deviceOS)===null||r===void 0?void 0:r.platform)||Ci.IOS,"-").concat(((i=t==null?void 0:t.deviceOS)===null||i===void 0?void 0:i.version)||"unknown"),deviceManufacturer:t==null?void 0:t.deviceManufacturer,systemPushEnabled:t==null?void 0:t.systemPushEnabled},h.label=1;case 1:return h.trys.push([1,4,,5]),o=O.of(this._iid),a=o.sessionManager,l=o.sdkState,u=o.requestQueue,a.hasDeviceToken(In.APNS,n)?[2,Cr.SUCCESS]:(c=new TR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,Ot(function(){return y(d,void 0,void 0,function(){return g(this,function(f){switch(f.label){case 0:return a.setDeviceToken(In.APNS,n,s),[4,a.saveDeviceToken()];case 1:return f.sent(),[2]}})})})];case 3:return h.sent(),this._apnsPushToken="",[2,Cr.SUCCESS];case 4:return h.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenForCurrentUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o,a,l=this;return g(this,function(u){switch(u.label){case 0:if(K(k("string",n)).throw(L.invalidParameters),!this.currentUser)return[3,6];u.label=1;case 1:return u.trys.push([1,4,,5]),t=O.of(this._iid),r=t.sessionManager,i=t.sdkState,s=t.requestQueue,o=new NR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,Ot(function(){return y(l,void 0,void 0,function(){return g(this,function(c){switch(c.label){case 0:return r.unsetDeviceToken(In.APNS,n),r.setDeviceTokenDeletedAt(a),[4,r.saveDeviceToken()];case 1:return c.sent(),[2]}})})})];case 3:return u.sent(),this._apnsPushToken="",[2,Cr.SUCCESS];case 4:return u.sent(),[2,Cr.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=n,[2,Cr.PENDING];case 7:return[2]}})})},e.prototype.unregisterAPNSPushTokenAllForCurrentUser=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o,a=this;return g(this,function(l){switch(l.label){case 0:return this.currentUser?(n=O.of(this._iid),t=n.sessionManager,r=n.sdkState,i=n.requestQueue,s=new AR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,Ot(function(){return y(a,void 0,void 0,function(){return g(this,function(u){switch(u.label){case 0:return t.unsetDeviceTokens(In.APNS),t.setDeviceTokenDeletedAt(o),[4,t.saveDeviceToken()];case 1:return u.sent(),[2]}})})})];case 2:l.sent(),l.label=3;case 3:return[2]}})})},e.prototype.markPushNotificationAsDelivered=function(n,t){var r;return t===void 0&&(t=!0),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N;return g(this,function(I){switch(I.label){case 0:if(i=O.of(this._iid),s=i.logger,o=i.sessionManager,a=i.requestQueue,l=i.pushNotificationAckManager,s.debug("markPushNotificationAsDelivered:",n),u=pf.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,v=c.notificationEventDeadline,!f||!h.includes(tf.PUSH_ACKNOWLEDGEMENT))throw s.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(l.isAcked(d,u))return s.info("already delivered push notification:",d),[2];_=!!m,E=t&&_,S=(r=o.deviceTokens[0])===null||r===void 0?void 0:r.token,w=new gy({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:v,allowedPushNotification:E}),f&&(w.headers["Session-Key"]=f),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,a.send(w)];case 2:return I.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=I.sent(),s.debug("failed to mark push notification as delivered. push tracking id: ".concat(d,". error: ").concat(N)),N;case 4:return[2]}})})},e.prototype.markPushNotificationAsClicked=function(n){var t;return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E;return g(this,function(S){switch(S.label){case 0:if(r=O.of(this._iid),i=r.logger,s=r.sessionManager,o=r.requestQueue,a=r.pushNotificationAckManager,i.debug("markPushNotificationAsClicked:",n),l=pf.CLICKED,u=a.parseData(n),c=u.pushTrackingId,d=u.sessionTopics,h=u.sessionKey,f=u.messageId,p=u.channelKey,m=u.templateKey,b=u.notificationEventDeadline,!h||!d.includes(tf.PUSH_ACKNOWLEDGEMENT))throw i.info("Can't use markPushNotificationAsDelivered() feature."),L.malformedDataError;if(a.isAcked(c,l))return i.info("already clicked push notification:",c),[2];v=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new gy({deviceToken:v??"",pushTrackingId:c,eventType:l,messageId:f,channelKey:p,templateKey:m,notificationEventDeadline:b}),h&&(_.headers["Session-Key"]=h),S.label=1;case 1:return S.trys.push([1,3,,4]),[4,o.send(_)];case 2:return S.sent(),a.markAsAcked(c,l),[3,4];case 3:throw E=S.sent(),i.debug("failed to mark push notification as clicked. push tracking id: ".concat(c,". error: ").concat(E)),E;case 4:return[2]}})})},e.prototype.getChannelInvitationPreference=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new kR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,{autoAccept:s.as(RR).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new LR({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,{autoAccept:o.as(DR).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new UR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(PR).preference]}})})},e.prototype.setDoNotDisturb=function(n,t,r,i,s,o){return t===void 0&&(t=0),r===void 0&&(r=0),i===void 0&&(i=0),s===void 0&&(s=0),o===void 0&&(o=""),y(this,void 0,void 0,function(){var a,l,u,c,d;return g(this,function(h){switch(h.label){case 0:return K(k("boolean",n)&&k("number",t)&&k("number",r)&&k("number",i)&&k("number",s)&&k("string",o)).throw(L.invalidParameters),a=O.of(this._iid),l=a.sdkState,u=a.requestQueue,c=new FR({userId:l.userId,doNotDisturbOn:n,startHour:t,startMin:r,endHour:i,endMin:s,timezone:o}),[4,u.send(c)];case 1:return d=h.sent(),[2,d.as(HR).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new jR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(BR).snoozePeriod]}})})},e.prototype.setSnoozePeriod=function(n,t,r){return t===void 0&&(t=0),r===void 0&&(r=0),y(this,void 0,void 0,function(){var i,s,o,a,l;return g(this,function(u){switch(u.label){case 0:return K(k("boolean",n)&&k("number",t)&&k("number",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new $R({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(GR).snoozePeriod]}})})},e.prototype.getMyPushTokensByToken=function(n,t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c,d,h,f,p;return g(this,function(m){switch(m.label){case 0:return K(k("string",n)&&Ge(In,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=r.sessionManager,a=new xR({userId:i.userId,type:t,token:n}),[4,s.send(a)];case 1:l=m.sent(),u=l.as(OR).pushTokens;try{for(c=ve(u.deviceTokens),d=c.next();!d.done;d=c.next())h=d.value,o.setDeviceToken(u.type,h)}catch(b){f={error:b}}finally{try{d&&!d.done&&(p=c.return)&&p.call(c)}finally{if(f)throw f.error}}return[4,o.saveDeviceToken()];case 2:return m.sent(),[2,u]}})})},e.prototype.getPushTriggerOption=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new qR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(WR).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(Ge(ta,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new KR({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,o.sent().as(QR).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new YR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(ZR).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(Ge(V_,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new XR({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,o.sent().as(JR).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(n instanceof Ke||k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new zR({userId:r.userId,blockedUserId:n instanceof Ke?n.userId:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.blockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.blockUser(n)]})})},e.prototype.unblockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(n instanceof Ke||k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new VR({userId:r.userId,unblockedUserId:n instanceof Ke?n.userId:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.unblockUserWithUserId=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.unblockUser(n)]})})},e.prototype.getFriendChangeLogsByToken=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(k("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new eL({userId:r.userId,token:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(tL).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return g(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new lL({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(uL).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(k("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new cL({userId:r.userId,allowFriendDiscovery:n}),[4,i.send(s)];case 1:return o.sent(),[2,n]}})})},e.prototype.uploadFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new nL({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(rL).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriendDiscoveries([n])]})})},e.prototype.deleteFriendDiscoveries=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new iL({userId:r.userId,discoveryKeys:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.addFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return g(this,function(a){switch(a.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new sL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(oL).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteFriends([n])]})})},e.prototype.deleteFriends=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return g(this,function(o){switch(o.label){case 0:return K(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new aL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o.sent(),[2]}})})},e.prototype.getAllEmoji=function(){return y(this,void 0,void 0,function(){var n,t,r;return g(this,function(i){switch(i.label){case 0:return n=O.of(this._iid).requestQueue,t=new dL,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(hL).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new fL({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(pL).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return g(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new _L({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(mL).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return g(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),K(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new vL,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(gL).uikitConfiguration]}})})},e}();function EL(e,n){return!e||!n?!0:e.url!==n.url}function Aa(e){return e!=null&&"sendingStatus"in e}function _f(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return Aa(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function bL(e,n){return _f(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function yy(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function et(e){return typeof e=="boolean"}function Ka(e,n){return n.includes(e)}function CL(e){return e instanceof Set}function Ey(e){return!e||!Array.isArray(e)?!1:e.length!==0}function SL(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const TL=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function ym(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>ym(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=ym(e[t])}),n}function by(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var wL=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i{var t=wL(e,[]);switch(n.type){case"update_initialized":return t.initialized=n.value.status,t;case"update_refreshing":return t.refreshing=n.value.status,t;case"update_loading":return t.loading=n.value.status,t;case"update_messages":{const r=n.value.currentUserId;if(n.value.clearBeforeAction)t.messageMap=Cy(n.value.messages);else{const i=n.value.messages.filter(o=>{var a;if(_f(o,r)){const l=(a=t.messageMap[o.reqId])!==null&&a!==void 0?a:t.messageMap[o.messageId];if(_f(l,r)){const u=IL(l,o);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=Cy(i);t.messageMap=Object.assign(Object.assign({},t.messageMap),s)}return t}case"update_new_messages":{const r=n.value.currentUserId,i=n.value.messages.filter(s=>bL(s,r));return n.value.clearBeforeAction?t.newMessageMap=by(i,yy):(i.map(o=>o.messageId).forEach(o=>delete t.newMessageMap[o]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),by(i,yy))),t}case"delete_messages":case"delete_new_messages":{const r=n.type==="delete_messages"?"messageMap":"newMessageMap";return t[r]=Object.assign({},t[r]),n.value.messageIds.forEach(i=>{const s=t[r][i];s&&(Aa(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(Aa(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},Cy=e=>e.reduce((n,t)=>(Aa(t)?(n[t.reqId]=t,t.sendingStatus===ut.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),IL=(e,n)=>e.sendingStatus===ut.SUCCEEDED?n.sendingStatus===ut.SUCCEEDED:e.sendingStatus!==n.sendingStatus,AL=(e=ML)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},o]=D.useReducer(NL,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),a=(b,v,_)=>{o({type:"update_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},l=(b,v)=>{o({type:"delete_messages",value:{messageIds:b,reqIds:v}})},u=(b,v,_)=>{o({type:"update_new_messages",value:{messages:b,clearBeforeAction:v,currentUserId:_}})},c=(b,v)=>{o({type:"delete_new_messages",value:{messageIds:b,reqIds:v}})},d=b=>{o({type:"update_initialized",value:{status:b}})},h=b=>{o({type:"update_loading",value:{status:b}})},f=b=>{o({type:"update_refreshing",value:{status:b}})},p=Object.values(s),m=D.useMemo(()=>Array.from(new Set(Object.values(i))).sort(e),[i]);return{updateInitialized:d,updateLoading:h,updateRefreshing:f,updateMessages:a,deleteMessages:l,initialized:n,loading:t,refreshing:r,messages:m,newMessages:p,updateNewMessages:u,deleteNewMessages:c}},Sy=Math.floor(Number.MAX_SAFE_INTEGER/10);function ML(e,n){let t=0,r=0;return Aa(e)&&e.sendingStatus!=="succeeded"&&(t=Sy),Aa(n)&&n.sendingStatus!=="succeeded"&&(r=Sy),e.createdAt+t-(n.createdAt+r)}var Fi=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const xL=(e,n,t)=>{var r;const i={prevResultLimit:n.prev,nextResultLimit:n.next,startingPoint:t==null?void 0:t.startingPoint,replyType:t==null?void 0:t.replyType},s=(r=t==null?void 0:t.collectionCreator)===null||r===void 0?void 0:r.call(t,i);return s||e.createMessageCollection(Object.assign(Object.assign({},i),{filter:new vs(i)}))};function Ty(e){return e{var r,i,s;const o=D.useRef(t);o.current=t;const a=D.useRef(n);a.current=n;const l=o.current.logger,u=(r=o.current.startingPoint)!==null&&r!==void 0?r:Number.MAX_SAFE_INTEGER,c=Ty(u),d=D.useRef({prev:!1,next:!1}),h=TL(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:w,deleteMessages:N,updateInitialized:I,updateLoading:R,updateRefreshing:A}=AL(t==null?void 0:t.sortComparator),x=hn(B=>{var se,ce,ye,ie;if(!a.current||!a.current.url)return(se=l==null?void 0:l.error)===null||se===void 0?void 0:se.call(l,"[useGroupChannelMessages] channel is required");try{switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.EVENT_MESSAGE_SENT_SUCCESS:case G.SYNC_MESSAGE_FILL:case void 0:(ye=(ce=o.current).markAsRead)===null||ye===void 0||ye.call(ce,[a.current]);break}}catch(de){(ie=l==null?void 0:l.warn)===null||ie===void 0||ie.call(l,"[useGroupChannelMessages/markAsReadBySource]",de)}}),U=hn((B,se)=>{var ce,ye,ie,de,he;const me=se.filter(_e=>{var fe;return!_f(_e,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)});if(me.length>0)switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_MESSAGE_FILL:{!((ye=(ce=o.current).shouldCountNewMessages)===null||ye===void 0)&&ye.call(ce)&&S(me,!1,(ie=e.currentUser)===null||ie===void 0?void 0:ie.userId),(he=(de=o.current).onMessagesReceived)===null||he===void 0||he.call(de,me);break}}}),q=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){return new Promise(ce=>{var ye,ie;if(!a.current||!a.current.url)return(ye=l==null?void 0:l.error)===null||ye===void 0?void 0:ye.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),x(),S([],!0,(ie=e.currentUser)===null||ie===void 0?void 0:ie.userId);const de=()=>{var me,_e,fe;const{pendingMessages:be,failedMessages:$e}=(me=f.current.instance)!==null&&me!==void 0?me:{};Ey(be)&&E(be,!1,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId),Ey($e)&&E($e,!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId)},he=xL(a.current,se,Object.assign(Object.assign({},o.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:he},he.setMessageCollectionHandler({onMessagesAdded:(me,_e,fe)=>{var be;x(me.source),U(me.source,fe),E(fe,!1,(be=e.currentUser)===null||be===void 0?void 0:be.userId)},onMessagesUpdated:(me,_e,fe)=>{var be,$e,le;x(me.source),U(me.source,fe),E(fe,!1,(be=e.currentUser)===null||be===void 0?void 0:be.userId),me.source===G.EVENT_MESSAGE_UPDATED&&((le=($e=o.current).onMessagesUpdated)===null||le===void 0||le.call($e,fe))},onMessagesDeleted:(me,_e,fe,be)=>{const $e=be.map(te=>te.messageId),le=be.filter(Aa).map(te=>te.reqId);N($e,le),w($e,le)},onChannelDeleted:(me,_e)=>{var fe,be;(be=(fe=o.current).onChannelDeleted)===null||be===void 0||be.call(fe,_e)},onChannelUpdated:(me,_e)=>{var fe,be;h(),(be=(fe=o.current).onChannelUpdated)===null||be===void 0||be.call(fe,_e)},onHugeGapDetected:()=>{q(Number.MAX_SAFE_INTEGER,ff.collection.message.defaultLimit)}}),he.initialize(hf.CACHE_AND_REPLACE_BY_API).onCacheResult((me,_e)=>{var fe,be,$e;me?e.isCacheEnabled&&((fe=l==null?void 0:l.error)===null||fe===void 0||fe.call(l,"[useGroupChannelMessages/onCacheResult]",me)):_e&&((be=l==null?void 0:l.debug)===null||be===void 0||be.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",_e.length),E(_e,!0,($e=e.currentUser)===null||$e===void 0?void 0:$e.userId),de(),_e.length>0&&(f.current.initialized=!0,ce()))}).onApiResult((me,_e)=>{var fe,be,$e,le,te;me?(fe=l==null?void 0:l.warn)===null||fe===void 0||fe.call(l,"[useGroupChannelMessages/onApiResult]",me):_e&&((be=l==null?void 0:l.debug)===null||be===void 0||be.call(l,"[useGroupChannelMessages/onApiResult]","message length:",_e.length),E(_e,!0,($e=e.currentUser)===null||$e===void 0?void 0:$e.userId),o.current.startingPoint||(te=(le=o.current).onMessagesReceived)===null||te===void 0||te.call(le,_e),e.isCacheEnabled&&de()),f.current.initialized=!0,f.current.apiInitialized=!0,ce()})})}));OS(e,{onUserBanned(B,se){var ce,ye,ie;B.isGroupChannel()&&!EL(B,a.current)&&(se.userId===((ce=e.currentUser)===null||ce===void 0?void 0:ce.userId)?(ie=(ye=o.current).onCurrentUserBanned)===null||ie===void 0||ie.call(ye):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Fi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(I(!1),R(!0),yield q(u,c),R(!1),I(!0))}));return()=>clearTimeout(B)},[e,(i=e.currentUser)===null||i===void 0?void 0:i.userId,(s=a.current)===null||s===void 0?void 0:s.url,o.current.replyType]),D.useEffect(()=>()=>{f.current.instance&&f.current.instance.dispose()},[]);const P=hn(()=>Fi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(A(!0),yield q(Number.MAX_SAFE_INTEGER,ff.collection.message.defaultLimit),A(!1))})),X=hn(()=>Fi(void 0,void 0,void 0,function*(){var B;const se=f.current.instance;if(se!=null&&se.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const ce=yield se.loadPrevious();E(ce,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),z=hn(()=>{const{initialized:B,instance:se}=f.current;return B&&se?se.hasPrevious:!1}),H=hn(()=>Fi(void 0,void 0,void 0,function*(){var B;const se=f.current.instance;if(se!=null&&se.hasNext&&!d.current.next)try{d.current.next=!0;const ce=yield se.loadNext();E(ce,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),Se=hn(()=>{const{initialized:B,apiInitialized:se,instance:ce}=f.current;return se&&B&&ce?ce.hasNext:!1}),V=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendUserMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),J=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendFileMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),re=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(ye=>{const ie=[];a.current.sendFileMessages(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onSucceeded(de=>{var he;de.isFileMessage()&&de.channelUrl===a.current.url&&(E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ie.push(de)),ie.length===B.length&&ye(ie)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url?(E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie.push(he)):ie.push(null),ie.length===B.length&&ye(ie)})})})),we=hn((B,se)=>{var ce;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ye,ie)=>{a.current.sendMultipleFilesMessage(B).onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),se==null||se(de)}).onFileUploaded(()=>{h()}).onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ye(de)}).onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ie(de)})})}),Z=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce,ye;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const ie=yield a.current.updateUserMessage(B,se);return ie.channelUrl===a.current.url&&E([ie],!1,(ye=e.currentUser)===null||ye===void 0?void 0:ye.userId),ie})),oe=hn((B,se)=>Fi(void 0,void 0,void 0,function*(){var ce,ye;if(!a.current||!a.current.url)throw(ce=l==null?void 0:l.error)===null||ce===void 0||ce.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const ie=yield a.current.updateFileMessage(B,se);return ie.channelUrl===a.current.url&&E([ie],!1,(ye=e.currentUser)===null||ye===void 0?void 0:ye.userId),ie})),ee=hn(B=>Fi(void 0,void 0,void 0,function*(){var se;if(!a.current||!a.current.url)throw(se=l==null?void 0:l.error)===null||se===void 0||se.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((ce,ye)=>{let ie;B.isUserMessage()&&(ie=a.current.resendMessage(B)),B.isFileMessage()&&(ie=a.current.resendMessage(B)),B.isMultipleFilesMessage()&&(ie=a.current.resendMessage(B)),ie&&("onPending"in ie&&ie.onPending(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId)}),"onFileUploaded"in ie&&ie.onFileUploaded(()=>{h()}),"onSucceeded"in ie&&ie.onSucceeded(de=>{var he;de.channelUrl===a.current.url&&E([de],!1,(he=e.currentUser)===null||he===void 0?void 0:he.userId),ce(de)}),"onFailed"in ie&&ie.onFailed((de,he)=>{var me;he&&he.channelUrl===a.current.url&&E([he],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),ye(de)}))})})),ue=hn(B=>Fi(void 0,void 0,void 0,function*(){var se,ce;if(!a.current||!a.current.url)throw(se=l==null?void 0:l.error)===null||se===void 0||se.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");if(B.sendingStatus==="succeeded")B.isUserMessage()&&(yield a.current.deleteMessage(B)),B.isFileMessage()&&(yield a.current.deleteMessage(B)),B.isMultipleFilesMessage()&&(yield a.current.deleteMessage(B));else try{yield(ce=f.current.instance)===null||ce===void 0?void 0:ce.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),$=hn(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),ke=hn(B=>Fi(void 0,void 0,void 0,function*(){var se;if(e.currentUser&&a.current){const ce=Ty(B);R(!0),E([],!0,(se=e.currentUser)===null||se===void 0?void 0:se.userId),yield q(B,ce),R(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:v,newMessages:_,resetNewMessages:$,refresh:P,loadPrevious:X,hasPrevious:z,loadNext:H,hasNext:Se,sendUserMessage:V,sendFileMessage:J,sendFileMessages:re,sendMultipleFilesMessage:we,updateUserMessage:Z,updateFileMessage:oe,resendMessage:ee,deleteMessage:ue,resetWithStartingPoint:ke,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},tg=e=>kL(e),kL=e=>e();function LS(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&SL(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=LS(t[r],n[r]):t[r]=n[r])}),t}const ng=()=>({common:{enableUsingDefaultUserProfile:!1},groupChannel:{channel:{enableMention:!1,enableOgtag:!0,enableReactions:!0,enableReactionsSupergroup:!1,enableTypingIndicator:!0,enableVoiceMessage:!1,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}},replyType:"quote_reply",threadReplySelectType:"thread",typingIndicatorTypes:new Set(["text"]),enableFeedback:!1,enableSuggestedReplies:!1,showSuggestedRepliesFor:"last_message_only",suggestedRepliesDirection:"vertical"},channelList:{enableMessageReceiptStatus:!1,enableTypingIndicator:!1},setting:{enableMessageSearch:!1}},openChannel:{channel:{enableOgtag:!0,input:{camera:{enablePhoto:!0,enableVideo:!0},enableDocument:!0,gallery:{enablePhoto:!0,enableVideo:!0}}}}});function RL(e){return delete e.groupChannel.channel.typingIndicatorTypes,delete e.groupChannel.channel.enableFeedback,delete e.groupChannel.channel.enableSuggestedReplies,delete e.groupChannel.channel.showSuggestedRepliesFor,delete e.groupChannel.channel.suggestedRepliesDirection,e}const DS=()=>{const e=ng();return RL(e)},wy=ng(),LL=DS();var mf=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};const Em={items:{},getItem(e){var n;return mf(this,void 0,void 0,function*(){return(n=Em.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return mf(this,void 0,void 0,function*(){Em.items[e]=n})}};class DL{constructor(n){this.storage=n??Em}init(n){return this.key=`sbu@${n}.uikitConfiguration`,this.get()}get safeKey(){if(!this.key)throw new Error("Please UIKitConfigManager.init() first");return this.key}update(n){return mf(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:LS(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return mf(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:LL};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function UL(e,n,t){var r,i;t.common&&et((r=t.common)===null||r===void 0?void 0:r.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=t.common.enableUsingDefaultUserProfile),n.common&&et((i=n.common)===null||i===void 0?void 0:i.enableUsingDefaultUserProfile)&&(e.enableUsingDefaultUserProfile=n.common.enableUsingDefaultUserProfile)}function PL(e,n,t){FL(e,n,t),HL(e,n,t),jL(e,n,t),BL(e,n,t)}function FL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze;!((r=t.groupChannel)===null||r===void 0)&&r.channel&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.groupChannel.channel.enableOgtag),!((o=n.groupChannel)===null||o===void 0)&&o.channel&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag),!((d=t.groupChannel)===null||d===void 0)&&d.channel&&et((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channel)===null||f===void 0?void 0:f.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channel)===null||m===void 0?void 0:m.enableTypingIndicator),!((b=n.groupChannel)===null||b===void 0)&&b.channel&&et((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channel)===null||_===void 0?void 0:_.enableTypingIndicator)&&(e.channel.enableTypingIndicator=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.enableTypingIndicator),!((w=t.groupChannel)===null||w===void 0)&&w.channel&&et((I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.enableReactions)&&(e.channel.enableReactions=(A=(R=t.groupChannel)===null||R===void 0?void 0:R.channel)===null||A===void 0?void 0:A.enableReactions),!((x=n.groupChannel)===null||x===void 0)&&x.channel&&et((q=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||q===void 0?void 0:q.enableReactions)&&(e.channel.enableReactions=(X=(P=n.groupChannel)===null||P===void 0?void 0:P.channel)===null||X===void 0?void 0:X.enableReactions),!((z=t.groupChannel)===null||z===void 0)&&z.channel&&et((Se=(H=t.groupChannel)===null||H===void 0?void 0:H.channel)===null||Se===void 0?void 0:Se.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(J=(V=t.groupChannel)===null||V===void 0?void 0:V.channel)===null||J===void 0?void 0:J.enableReactionsSupergroup),!((re=n.groupChannel)===null||re===void 0)&&re.channel&&et((Z=(we=n.groupChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(oe=n.groupChannel)===null||oe===void 0?void 0:oe.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ue=t.groupChannel)===null||ue===void 0)&&ue.channel&&et((ke=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||ke===void 0?void 0:ke.enableMention)&&(e.channel.enableMention=(se=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.enableMention),!((ce=n.groupChannel)===null||ce===void 0)&&ce.channel&&et((ie=(ye=n.groupChannel)===null||ye===void 0?void 0:ye.channel)===null||ie===void 0?void 0:ie.enableMention)&&(e.channel.enableMention=(he=(de=n.groupChannel)===null||de===void 0?void 0:de.channel)===null||he===void 0?void 0:he.enableMention),!((me=t.groupChannel)===null||me===void 0)&&me.channel&&Ka((fe=(_e=t.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=($e=(be=t.groupChannel)===null||be===void 0?void 0:be.channel)===null||$e===void 0?void 0:$e.replyType),!((le=n.groupChannel)===null||le===void 0)&&le.channel&&Ka((Me=(te=n.groupChannel)===null||te===void 0?void 0:te.channel)===null||Me===void 0?void 0:Me.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(ne=(Re=n.groupChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.replyType),!((Oe=t.groupChannel)===null||Oe===void 0)&&Oe.channel&&Ka((Qe=(nt=t.groupChannel)===null||nt===void 0?void 0:nt.channel)===null||Qe===void 0?void 0:Qe.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(at=(Fe=t.groupChannel)===null||Fe===void 0?void 0:Fe.channel)===null||at===void 0?void 0:at.threadReplySelectType),!((Ft=n.groupChannel)===null||Ft===void 0)&&Ft.channel&&Ka((ln=(_t=n.groupChannel)===null||_t===void 0?void 0:_t.channel)===null||ln===void 0?void 0:ln.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Wt=(kt=n.groupChannel)===null||kt===void 0?void 0:kt.channel)===null||Wt===void 0?void 0:Wt.threadReplySelectType),!((Jt=t.groupChannel)===null||Jt===void 0)&&Jt.channel&&et((en=(Ct=t.groupChannel)===null||Ct===void 0?void 0:Ct.channel)===null||en===void 0?void 0:en.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(xn=(tn=t.groupChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.enableVoiceMessage),!((Ht=n.groupChannel)===null||Ht===void 0)&&Ht.channel&&et((un=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Pn=(Un=n.groupChannel)===null||Un===void 0?void 0:Un.channel)===null||Pn===void 0?void 0:Pn.enableVoiceMessage),!((gn=n.groupChannel)===null||gn===void 0)&&gn.channel&&CL((xt=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||xt===void 0?void 0:xt.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(nn=(On=n.groupChannel)===null||On===void 0?void 0:On.channel)===null||nn===void 0?void 0:nn.typingIndicatorTypes),!((rn=n.groupChannel)===null||rn===void 0)&&rn.channel&&et((yn=(kn=n.groupChannel)===null||kn===void 0?void 0:kn.channel)===null||yn===void 0?void 0:yn.enableFeedback)&&(e.channel.enableFeedback=(Rn=(wt=n.groupChannel)===null||wt===void 0?void 0:wt.channel)===null||Rn===void 0?void 0:Rn.enableFeedback),!((sr=n.groupChannel)===null||sr===void 0)&&sr.channel&&et((En=(cn=n.groupChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Rt=(bn=n.groupChannel)===null||bn===void 0?void 0:bn.channel)===null||Rt===void 0?void 0:Rt.enableSuggestedReplies),!((Cn=n.groupChannel)===null||Cn===void 0)&&Cn.channel&&Ka((Hn=(Kt=n.groupChannel)===null||Kt===void 0?void 0:Kt.channel)===null||Hn===void 0?void 0:Hn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(or=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.showSuggestedRepliesFor),!((Ue=n.groupChannel)===null||Ue===void 0)&&Ue.channel&&Ka((pe=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||pe===void 0?void 0:pe.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(ze=(xe=n.groupChannel)===null||xe===void 0?void 0:xe.channel)===null||ze===void 0?void 0:ze.suggestedRepliesDirection)}function HL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze,vt;!((i=(r=t.groupChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&et((a=(o=(s=t.groupChannel)===null||s===void 0?void 0:s.channel)===null||o===void 0?void 0:o.input)===null||a===void 0?void 0:a.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.groupChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.groupChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&et((m=(p=(f=n.groupChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.groupChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&et((A=(R=(I=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||R===void 0?void 0:R.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(q=(U=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||q===void 0?void 0:q.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(z=(X=n.groupChannel)===null||X===void 0?void 0:X.channel)===null||z===void 0?void 0:z.input)===null||H===void 0)&&H.camera&&et((re=(J=(V=(Se=n.groupChannel)===null||Se===void 0?void 0:Se.channel)===null||V===void 0?void 0:V.input)===null||J===void 0?void 0:J.camera)===null||re===void 0?void 0:re.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(oe=(Z=(we=n.groupChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.input)===null||oe===void 0?void 0:oe.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((ke=($=(ue=t.groupChannel)===null||ue===void 0?void 0:ue.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&et((ye=(ce=(se=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.input)===null||ce===void 0?void 0:ce.camera)===null||ye===void 0?void 0:ye.enableVideo)&&(e.channel.input.camera.enableVideo=(me=(he=(de=(ie=t.groupChannel)===null||ie===void 0?void 0:ie.channel)===null||de===void 0?void 0:de.input)===null||he===void 0?void 0:he.camera)===null||me===void 0?void 0:me.enableVideo),!((be=(fe=(_e=n.groupChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.input)===null||be===void 0)&&be.camera&&et((Me=(te=(le=($e=n.groupChannel)===null||$e===void 0?void 0:$e.channel)===null||le===void 0?void 0:le.input)===null||te===void 0?void 0:te.camera)===null||Me===void 0?void 0:Me.enableVideo)&&(e.channel.input.camera.enableVideo=(nt=(Oe=(ne=(Re=n.groupChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.input)===null||Oe===void 0?void 0:Oe.camera)===null||nt===void 0?void 0:nt.enableVideo),!((at=(Fe=(Qe=t.groupChannel)===null||Qe===void 0?void 0:Qe.channel)===null||Fe===void 0?void 0:Fe.input)===null||at===void 0)&&at.gallery&&et((kt=(ln=(_t=(Ft=t.groupChannel)===null||Ft===void 0?void 0:Ft.channel)===null||_t===void 0?void 0:_t.input)===null||ln===void 0?void 0:ln.gallery)===null||kt===void 0?void 0:kt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(en=(Ct=(Jt=(Wt=t.groupChannel)===null||Wt===void 0?void 0:Wt.channel)===null||Jt===void 0?void 0:Jt.input)===null||Ct===void 0?void 0:Ct.gallery)===null||en===void 0?void 0:en.enablePhoto),!((Ht=(xn=(tn=n.groupChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.input)===null||Ht===void 0)&&Ht.gallery&&et((Pn=(Un=(un=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(xt=(Fn=(gn=n.groupChannel)===null||gn===void 0?void 0:gn.channel)===null||Fn===void 0?void 0:Fn.input)===null||xt===void 0?void 0:xt.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(rn=(nn=t.groupChannel)===null||nn===void 0?void 0:nn.channel)===null||rn===void 0?void 0:rn.input)===null||kn===void 0)&&kn.gallery&&et((sr=(Rn=(wt=(yn=t.groupChannel)===null||yn===void 0?void 0:yn.channel)===null||wt===void 0?void 0:wt.input)===null||Rn===void 0?void 0:Rn.gallery)===null||sr===void 0?void 0:sr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Rt=(bn=(En=(cn=t.groupChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Rt===void 0?void 0:Rt.enableVideo),!((Hn=(Kt=(Cn=n.groupChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Kt===void 0?void 0:Kt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Ue=(or=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.input)===null||Ue===void 0?void 0:Ue.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(ze=(xe=(pe=n.groupChannel)===null||pe===void 0?void 0:pe.channel)===null||xe===void 0?void 0:xe.input)===null||ze===void 0?void 0:ze.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function jL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S;!((r=t.groupChannel)===null||r===void 0)&&r.channelList&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.channelList)===null||s===void 0?void 0:s.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=t.groupChannel.channelList.enableTypingIndicator),!((o=n.groupChannel)===null||o===void 0)&&o.channelList&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.channelList)===null||l===void 0?void 0:l.enableTypingIndicator)&&(e.channelList.enableTypingIndicator=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.channelList)===null||c===void 0?void 0:c.enableTypingIndicator),!((d=t.groupChannel)===null||d===void 0)&&d.channelList&&et((f=(h=t.groupChannel)===null||h===void 0?void 0:h.channelList)===null||f===void 0?void 0:f.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(m=(p=t.groupChannel)===null||p===void 0?void 0:p.channelList)===null||m===void 0?void 0:m.enableMessageReceiptStatus),!((b=n.groupChannel)===null||b===void 0)&&b.channelList&&et((_=(v=n.groupChannel)===null||v===void 0?void 0:v.channelList)===null||_===void 0?void 0:_.enableMessageReceiptStatus)&&(e.channelList.enableMessageReceiptStatus=(S=(E=n.groupChannel)===null||E===void 0?void 0:E.channelList)===null||S===void 0?void 0:S.enableMessageReceiptStatus)}function BL(e,n,t){var r,i,s,o,a,l,u,c;!((r=t.groupChannel)===null||r===void 0)&&r.setting&&et((s=(i=t.groupChannel)===null||i===void 0?void 0:i.setting)===null||s===void 0?void 0:s.enableMessageSearch)&&(e.setting.enableMessageSearch=t.groupChannel.setting.enableMessageSearch),!((o=n.groupChannel)===null||o===void 0)&&o.setting&&et((l=(a=n.groupChannel)===null||a===void 0?void 0:a.setting)===null||l===void 0?void 0:l.enableMessageSearch)&&(e.setting.enableMessageSearch=(c=(u=n.groupChannel)===null||u===void 0?void 0:u.setting)===null||c===void 0?void 0:c.enableMessageSearch)}function $L(e,n,t){GL(e,n,t),zL(e,n,t)}function GL(e,n,t){var r,i,s,o,a,l,u,c;!((r=t.openChannel)===null||r===void 0)&&r.channel&&et((s=(i=t.openChannel)===null||i===void 0?void 0:i.channel)===null||s===void 0?void 0:s.enableOgtag)&&(e.channel.enableOgtag=t.openChannel.channel.enableOgtag),!((o=n.openChannel)===null||o===void 0)&&o.channel&&et((l=(a=n.openChannel)===null||a===void 0?void 0:a.channel)===null||l===void 0?void 0:l.enableOgtag)&&(e.channel.enableOgtag=(c=(u=n.openChannel)===null||u===void 0?void 0:u.channel)===null||c===void 0?void 0:c.enableOgtag)}function zL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,v,_,E,S,w,N,I,R,A,x,U,q,P,X,z,H,Se,V,J,re,we,Z,oe,ee,ue,$,ke,B,se,ce,ye,ie,de,he,me,_e,fe,be,$e,le,te,Me,Re,ne,Oe,nt,Qe,Fe,at,Ft,_t,ln,kt,Wt,Jt,Ct,en,tn,xn,Ht,ft,un,Un,Pn,gn,Fn,xt,On,nn,rn,kn,yn,wt,Rn,sr,cn,En,bn,Rt,Cn,Kt,Hn,jn,or,Ue,F,pe,xe,ze,vt;!((i=(r=t.openChannel)===null||r===void 0?void 0:r.channel)===null||i===void 0)&&i.input&&et((a=(o=(s=t.openChannel)===null||s===void 0?void 0:s.channel)===null||o===void 0?void 0:o.input)===null||a===void 0?void 0:a.enableDocument)&&(e.channel.input.enableDocument=(c=(u=(l=t.openChannel)===null||l===void 0?void 0:l.channel)===null||u===void 0?void 0:u.input)===null||c===void 0?void 0:c.enableDocument),!((h=(d=n.openChannel)===null||d===void 0?void 0:d.channel)===null||h===void 0)&&h.input&&et((m=(p=(f=n.openChannel)===null||f===void 0?void 0:f.channel)===null||p===void 0?void 0:p.input)===null||m===void 0?void 0:m.enableDocument)&&(e.channel.input.enableDocument=(_=(v=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||v===void 0?void 0:v.input)===null||_===void 0?void 0:_.enableDocument),!((w=(S=(E=t.openChannel)===null||E===void 0?void 0:E.channel)===null||S===void 0?void 0:S.input)===null||w===void 0)&&w.camera&&et((A=(R=(I=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||I===void 0?void 0:I.input)===null||R===void 0?void 0:R.camera)===null||A===void 0?void 0:A.enablePhoto)&&(e.channel.input.camera.enablePhoto=(P=(q=(U=(x=t.openChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||q===void 0?void 0:q.camera)===null||P===void 0?void 0:P.enablePhoto),!((H=(z=(X=n.openChannel)===null||X===void 0?void 0:X.channel)===null||z===void 0?void 0:z.input)===null||H===void 0)&&H.camera&&et((re=(J=(V=(Se=n.openChannel)===null||Se===void 0?void 0:Se.channel)===null||V===void 0?void 0:V.input)===null||J===void 0?void 0:J.camera)===null||re===void 0?void 0:re.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(oe=(Z=(we=n.openChannel)===null||we===void 0?void 0:we.channel)===null||Z===void 0?void 0:Z.input)===null||oe===void 0?void 0:oe.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((ke=($=(ue=t.openChannel)===null||ue===void 0?void 0:ue.channel)===null||$===void 0?void 0:$.input)===null||ke===void 0)&&ke.camera&&et((ye=(ce=(se=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||se===void 0?void 0:se.input)===null||ce===void 0?void 0:ce.camera)===null||ye===void 0?void 0:ye.enableVideo)&&(e.channel.input.camera.enableVideo=(me=(he=(de=(ie=t.openChannel)===null||ie===void 0?void 0:ie.channel)===null||de===void 0?void 0:de.input)===null||he===void 0?void 0:he.camera)===null||me===void 0?void 0:me.enableVideo),!((be=(fe=(_e=n.openChannel)===null||_e===void 0?void 0:_e.channel)===null||fe===void 0?void 0:fe.input)===null||be===void 0)&&be.camera&&et((Me=(te=(le=($e=n.openChannel)===null||$e===void 0?void 0:$e.channel)===null||le===void 0?void 0:le.input)===null||te===void 0?void 0:te.camera)===null||Me===void 0?void 0:Me.enableVideo)&&(e.channel.input.camera.enableVideo=(nt=(Oe=(ne=(Re=n.openChannel)===null||Re===void 0?void 0:Re.channel)===null||ne===void 0?void 0:ne.input)===null||Oe===void 0?void 0:Oe.camera)===null||nt===void 0?void 0:nt.enableVideo),!((at=(Fe=(Qe=t.openChannel)===null||Qe===void 0?void 0:Qe.channel)===null||Fe===void 0?void 0:Fe.input)===null||at===void 0)&&at.gallery&&et((kt=(ln=(_t=(Ft=t.openChannel)===null||Ft===void 0?void 0:Ft.channel)===null||_t===void 0?void 0:_t.input)===null||ln===void 0?void 0:ln.gallery)===null||kt===void 0?void 0:kt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(en=(Ct=(Jt=(Wt=t.openChannel)===null||Wt===void 0?void 0:Wt.channel)===null||Jt===void 0?void 0:Jt.input)===null||Ct===void 0?void 0:Ct.gallery)===null||en===void 0?void 0:en.enablePhoto),!((Ht=(xn=(tn=n.openChannel)===null||tn===void 0?void 0:tn.channel)===null||xn===void 0?void 0:xn.input)===null||Ht===void 0)&&Ht.gallery&&et((Pn=(Un=(un=(ft=n.openChannel)===null||ft===void 0?void 0:ft.channel)===null||un===void 0?void 0:un.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(xt=(Fn=(gn=n.openChannel)===null||gn===void 0?void 0:gn.channel)===null||Fn===void 0?void 0:Fn.input)===null||xt===void 0?void 0:xt.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(rn=(nn=t.openChannel)===null||nn===void 0?void 0:nn.channel)===null||rn===void 0?void 0:rn.input)===null||kn===void 0)&&kn.gallery&&et((sr=(Rn=(wt=(yn=t.openChannel)===null||yn===void 0?void 0:yn.channel)===null||wt===void 0?void 0:wt.input)===null||Rn===void 0?void 0:Rn.gallery)===null||sr===void 0?void 0:sr.enableVideo)&&(e.channel.input.gallery.enableVideo=(Rt=(bn=(En=(cn=t.openChannel)===null||cn===void 0?void 0:cn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Rt===void 0?void 0:Rt.enableVideo),!((Hn=(Kt=(Cn=n.openChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Kt===void 0?void 0:Kt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Ue=(or=(jn=n.openChannel)===null||jn===void 0?void 0:jn.channel)===null||or===void 0?void 0:or.input)===null||Ue===void 0?void 0:Ue.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(ze=(xe=(pe=n.openChannel)===null||pe===void 0?void 0:pe.channel)===null||xe===void 0?void 0:xe.input)===null||ze===void 0?void 0:ze.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function VL(e,n){const t=ng();return UL(t.common,e,n),PL(t.groupChannel,e,n),$L(t.openChannel,e,n),t}function qL(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var WL=function(e,n,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(d){o(d)}}function l(c){try{u(r.throw(c))}catch(d){o(d)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(e,n||[])).next())})};function hu(e){var n,t;return(t=(n=e.appInfo)===null||n===void 0?void 0:n.applicationAttributes)!==null&&t!==void 0?t:[]}const US=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:wy,configsWithAppAttr:()=>wy}),KL=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(DS),[s]=D.useState(()=>new DL(e)),o=D.useCallback(u=>WL(void 0,void 0,void 0,function*(){const c=yield s.init(u.appId);if(u.appInfo&&u.appInfo.uikitConfigInfo.lastUpdatedAt===c.updatedAt)i(c.configuration);else try{const d=yield u.getUIKitConfiguration();if(qL(d.json)){const h=ym(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),a=VL(t,r),l=hn(u=>({groupChannel:{channel:{get enableReactions(){return a.groupChannel.channel.enableReactions&&hu(u).includes(au.reactions)},get enableReactionsSupergroup(){return a.groupChannel.channel.enableReactionsSupergroup&&hu(u).includes(au.reactions)},get enableOgtag(){return a.groupChannel.channel.enableOgtag&&hu(u).includes(au.enable_og_tag)}},setting:{get enableMessageSearch(){return a.groupChannel.setting.enableMessageSearch&&hu(u).includes(au.message_search_v3)}}},openChannel:{channel:{get enableOgtag(){return a.openChannel.channel.enableOgtag&&hu(u).includes(au.enable_og_tag)}}}}));return It.createElement(US.Provider,{value:{initDashboardConfigs:o,configs:a,configsWithAppAttr:l}},n)},QL=()=>D.useContext(US),PS=It.createContext(null);/*! * css-vars-ponyfill * v2.4.9 * https://jhildenbiddle.github.io/css-vars-ponyfill/ @@ -123,7 +123,7 @@ Error generating stack: `+s.message+` * // ... * } * }); - */function Iy(e){var n={cssComments:/\/\*[\s\S]+?\*\//g,cssImports:/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g},t={rootElement:e.rootElement||document,include:e.include||'style,link[rel="stylesheet"]',exclude:e.exclude||null,filter:e.filter||null,skipDisabled:e.skipDisabled!==!1,useCSSOM:e.useCSSOM||!1,onBeforeSend:e.onBeforeSend||Function.prototype,onSuccess:e.onSuccess||Function.prototype,onError:e.onError||Function.prototype,onComplete:e.onComplete||Function.prototype},r=Array.apply(null,t.rootElement.querySelectorAll(t.include)).filter(function(u){return!YL(u,t.exclude)}),i=Array.apply(null,Array(r.length)).map(function(u){return null});function s(){var u=i.indexOf(null)===-1;if(u){i.reduce(function(d,h,f){return h===""&&d.push(f),d},[]).reverse().forEach(function(d){return[r,i].forEach(function(h){return h.splice(d,1)})});var c=i.join("");t.onComplete(c,i,r)}}function o(u,c,d,h){var f=t.onSuccess(u,d,h);u=f!==void 0&&!f?"":f||u,l(u,d,h,function(p,m){i[c]===null&&(m.forEach(function(b){return t.onError(b.xhr,d,b.url)}),!t.filter||t.filter.test(p)?i[c]=p:i[c]="",s())})}function a(u,c){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],h={};return h.rules=(u.replace(n.cssComments,"").match(n.cssImports)||[]).filter(function(f){return d.indexOf(f)===-1}),h.urls=h.rules.map(function(f){return f.replace(n.cssImports,"$1")}),h.absoluteUrls=h.urls.map(function(f){return xp(f,c)}),h.absoluteRules=h.rules.map(function(f,p){var m=h.urls[p],b=xp(h.absoluteUrls[p],c);return f.replace(m,b)}),h}function l(u,c,d,h){var f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],p=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],m=a(u,d,p);m.rules.length?Ny(m.absoluteUrls,{onBeforeSend:function(v,_,E){t.onBeforeSend(v,c,_)},onSuccess:function(v,_,E){var S=t.onSuccess(v,c,_);v=S===!1?"":S||v;var w=a(v,_,p);return w.rules.forEach(function(N,I){v=v.replace(N,w.absoluteRules[I])}),v},onError:function(v,_,E){f.push({xhr:v,url:_}),p.push(m.rules[E]),l(u,c,d,h,f,p)},onComplete:function(v){v.forEach(function(_,E){u=u.replace(m.rules[E],_)}),l(u,c,d,h,f,p)}}):h(u,f)}r.length?r.forEach(function(u,c){var d=u.getAttribute("href"),h=u.getAttribute("rel"),f=u.nodeName.toLowerCase()==="link"&&d&&h&&h.toLowerCase().indexOf("stylesheet")!==-1,p=t.skipDisabled===!1?!1:u.disabled,m=u.nodeName.toLowerCase()==="style";if(f&&!p){var b=d.indexOf("data:text/css")!==-1;if(b){var v=decodeURIComponent(d.substring(d.indexOf(",")+1));t.useCSSOM&&(v=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(v,c,u,location.href)}else Ny(d,{mimeType:"text/css",onBeforeSend:function(S,w,N){t.onBeforeSend(S,u,w)},onSuccess:function(S,w,N){var I=xp(d);o(S,c,u,I)},onError:function(S,w,N){i[c]="",t.onError(S,u,w),s()}})}else if(m&&!p){var _=u.textContent;t.useCSSOM&&(_=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(_,c,u,location.href)}else i[c]="",s()}):t.onComplete("",[])}function xp(e,n){var t=document.implementation.createHTMLDocument(""),r=t.createElement("base"),i=t.createElement("a");return t.head.appendChild(r),t.body.appendChild(i),r.href=n||document.baseURI||(document.querySelector("base")||{}).href||location.href,i.href=e,i.href}function YL(e,n){var t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;return t.call(e,n)}var FS=HS;function HS(e,n,t){e instanceof RegExp&&(e=Ay(e,t)),n instanceof RegExp&&(n=Ay(n,t));var r=jS(e,n,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+e.length,r[1]),post:t.slice(r[1]+n.length)}}function Ay(e,n){var t=n.match(e);return t?t[0]:null}HS.range=jS;function jS(e,n,t){var r,i,s,o,a,l=t.indexOf(e),u=t.indexOf(n,l+1),c=l;if(l>=0&&u>0){if(e===n)return[l,u];for(r=[],s=t.length;c>=0&&!a;)c==l?(r.push(c),l=t.indexOf(e,c+1)):r.length==1?a=[r.pop(),u]:(i=r.pop(),i=0?l:u;r.length&&(a=[s,o])}return a}function rg(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,removeComments:!1},r=$r({},t,n),i=[];function s(P){throw new Error("CSS parse error: ".concat(P))}function o(P){var X=P.exec(e);if(X)return e=e.slice(X[0].length),X}function a(){return o(/^{\s*/)}function l(){return o(/^}/)}function u(){o(/^\s*/)}function c(){if(u(),!(e[0]!=="/"||e[1]!=="*")){for(var P=2;e[P]&&(e[P]!=="*"||e[P+1]!=="/");)P++;if(!e[P])return s("end of comment is missing");var X=e.slice(2,P);return e=e.slice(P+2),{type:"comment",comment:X}}}function d(){for(var P=[],X;X=c();)P.push(X);return r.removeComments?[]:P}function h(){for(u();e[0]==="}";)s("extra closing bracket");var P=o(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);if(P){var X=P[0].trim(),z,H=/\/\*/.test(X);H&&(X=X.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,""));var Se=/["']\w*,\w*["']/.test(X);Se&&(X=X.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(J){return J.replace(/,/g,"‌")}));var V=/,/.test(X);return V?z=X.split(/\s*(?![^(]*\)),\s*/):z=[X],Se&&(z=z.map(function(J){return J.replace(/\u200C/g,",")})),z}}function f(){if(e[0]==="@")return x();o(/^([;\s]*)+/);var P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,X=o(/^(\*?[-#/*\\\w.]+(\[[0-9a-z_-]+\])?)\s*/);if(X){if(X=X[0].trim(),!o(/^:\s*/))return s("property missing ':'");var z=o(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/),H={type:"declaration",property:X.replace(P,""),value:z?z[0].replace(P,"").trim():""};return o(/^[;\s]*/),H}}function p(){if(!a())return s("missing '{'");for(var P,X=d();P=f();)X.push(P),X=X.concat(d());return l()?X:s("missing '}'")}function m(){u();for(var P=[],X;X=o(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)P.push(X[1]),o(/^,\s*/);if(P.length)return{type:"keyframe",values:P,declarations:p()}}function b(){var P=o(/^@([-\w]+)?keyframes\s*/);if(P){var X=P[1];if(P=o(/^([-\w]+)\s*/),!P)return s("@keyframes missing name");var z=P[1];if(!a())return s("@keyframes missing '{'");for(var H,Se=d();H=m();)Se.push(H),Se=Se.concat(d());return l()?{type:"keyframes",name:z,vendor:X,keyframes:Se}:s("@keyframes missing '}'")}}function v(){var P=o(/^@page */);if(P){var X=h()||[];return{type:"page",selectors:X,declarations:p()}}}function _(){var P=o(/@(top|bottom|left|right)-(left|center|right|top|middle|bottom)-?(corner)?\s*/);if(P){var X="".concat(P[1],"-").concat(P[2])+(P[3]?"-".concat(P[3]):"");return{type:"page-margin-box",name:X,declarations:p()}}}function E(){var P=o(/^@font-face\s*/);if(P)return{type:"font-face",declarations:p()}}function S(){var P=o(/^@supports *([^{]+)/);if(P)return{type:"supports",supports:P[1].trim(),rules:q()}}function w(){var P=o(/^@host\s*/);if(P)return{type:"host",rules:q()}}function N(){var P=o(/^@media([^{]+)*/);if(P)return{type:"media",media:(P[1]||"").trim(),rules:q()}}function I(){var P=o(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(P)return{type:"custom-media",name:P[1].trim(),media:P[2].trim()}}function R(){var P=o(/^@([-\w]+)?document *([^{]+)/);if(P)return{type:"document",document:P[2].trim(),vendor:P[1]?P[1].trim():null,rules:q()}}function A(){var P=o(/^@(import|charset|namespace)\s*([^;]+);/);if(P)return{type:P[1],name:P[2].trim()}}function x(){if(u(),e[0]==="@"){var P=A()||E()||N()||b()||S()||R()||I()||w()||v()||_();if(P&&!r.preserveStatic){var X=!1;if(P.declarations)X=P.declarations.some(function(H){return/var\(/.test(H.value)});else{var z=P.keyframes||P.rules||[];X=z.some(function(H){return(H.declarations||[]).some(function(Se){return/var\(/.test(Se.value)})})}return X?P:{}}return P}}function U(){if(!r.preserveStatic){var P=FS("{","}",e);if(P){var X=/:(?:root|host)(?![.:#(])/.test(P.pre)&&/--\S*\s*:/.test(P.body),z=/var\(/.test(P.body);if(!X&&!z)return e=e.slice(P.end+1),{}}}var H=h()||[],Se=r.preserveStatic?p():p().filter(function(V){var J=H.some(function(we){return/:(?:root|host)(?![.:#(])/.test(we)})&&/^--\S/.test(V.property),re=/var\(/.test(V.value);return J||re});return H.length||s("selector missing"),{type:"rule",selectors:H,declarations:Se}}function q(P){if(!P&&!a())return s("missing '{'");for(var X,z=d();e.length&&(P||e[0]!=="}")&&(X=x()||U());)X.type&&z.push(X),z=z.concat(d());return!P&&!l()?s("missing '}'"):z}return{type:"stylesheet",stylesheet:{rules:q(!0),errors:i}}}function My(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={parseHost:!1,store:{},onWarning:function(){}},r=$r({},t,n),i=new RegExp(":".concat(r.parseHost?"host":"root","$"));return typeof e=="string"&&(e=rg(e,r)),e.stylesheet.rules.forEach(function(s){s.type!=="rule"||!s.selectors.some(function(o){return i.test(o)})||s.declarations.forEach(function(o,a){var l=o.property,u=o.value;l&&l.indexOf("--")===0&&(r.store[l]=u)})}),r.store}function BS(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0,r={charset:function(o){return"@charset "+o.name+";"},comment:function(o){return o.comment.indexOf("__CSSVARSPONYFILL")===0?"/*"+o.comment+"*/":""},"custom-media":function(o){return"@custom-media "+o.name+" "+o.media+";"},declaration:function(o){return o.property+":"+o.value+";"},document:function(o){return"@"+(o.vendor||"")+"document "+o.document+"{"+i(o.rules)+"}"},"font-face":function(o){return"@font-face{"+i(o.declarations)+"}"},host:function(o){return"@host{"+i(o.rules)+"}"},import:function(o){return"@import "+o.name+";"},keyframe:function(o){return o.values.join(",")+"{"+i(o.declarations)+"}"},keyframes:function(o){return"@"+(o.vendor||"")+"keyframes "+o.name+"{"+i(o.keyframes)+"}"},media:function(o){return"@media "+o.media+"{"+i(o.rules)+"}"},namespace:function(o){return"@namespace "+o.name+";"},page:function(o){return"@page "+(o.selectors.length?o.selectors.join(", "):"")+"{"+i(o.declarations)+"}"},"page-margin-box":function(o){return"@"+o.name+"{"+i(o.declarations)+"}"},rule:function(o){var a=o.declarations;if(a.length)return o.selectors.join(",")+"{"+i(a)+"}"},supports:function(o){return"@supports "+o.supports+"{"+i(o.rules)+"}"}};function i(s){for(var o="",a=0;a1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,preserveVars:!1,variables:{},onWarning:function(){}},r=$r({},t,n);return typeof e=="string"&&(e=rg(e,r)),$S(e.stylesheet,function(i,s){for(var o=0;o1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;if(e.indexOf("var(")===-1)return e;var r=FS("(",")",e);function i(o){var a=o.split(",")[0].replace(/[\s\n\t]/g,""),l=(o.match(/(?:\s*,\s*){1}(.*)?/)||[])[1],u=Object.prototype.hasOwnProperty.call(n.variables,a)?String(n.variables[a]):void 0,c=u||(l?String(l):void 0),d=t||o;return u||n.onWarning('variable "'.concat(a,'" is undefined')),c&&c!=="undefined"&&c.length>0?xu(c,n,d):"var(".concat(d,")")}if(r)if(r.pre.slice(-3)==="var"){var s=r.body.trim().length===0;return s?(n.onWarning("var() must contain a non-whitespace string"),e):r.pre.slice(0,-3)+i(r.body)+xu(r.post,n)}else return r.pre+"(".concat(xu(r.body,n),")")+xu(r.post,n);else return e.indexOf("var(")!==-1&&n.onWarning('missing closing ")" in the value "'.concat(e,'"')),e}var c0=typeof window<"u",xy=c0&&window.CSS&&window.CSS.supports&&window.CSS.supports("(--a: 0)"),Zo={group:0,job:0},$d={rootElement:c0?document:null,shadowDOM:!1,include:"style,link[rel=stylesheet]",exclude:"",variables:{},onlyLegacy:!0,preserveStatic:!0,preserveVars:!1,silent:!1,updateDOM:!0,updateURLs:!0,watch:null,onBeforeSend:function(){},onError:function(){},onWarning:function(){},onSuccess:function(){},onComplete:function(){},onFinally:function(){}},ss={cssComments:/\/\*[\s\S]+?\*\//g,cssKeyframes:/@(?:-\w*-)?keyframes/,cssMediaQueries:/@media[^{]+\{([\s\S]+?})\s*}/g,cssUrls:/url\((?!['"]?(?:data|http|\/\/):)['"]?([^'")]*)['"]?\)/g,cssVarDeclRules:/(?::(?:root|host)(?![.:#(])[\s,]*[^{]*{\s*[^}]*})/g,cssVarDecls:/(?:[\s;]*)(-{2}\w[\w-]*)(?:\s*:\s*)([^;]*);/g,cssVarFunc:/var\(\s*--[\w-]/,cssVars:/(?:(?::(?:root|host)(?![.:#(])[\s,]*[^{]*{\s*[^;]*;*\s*)|(?:var\(\s*))(--[^:)]+)(?:\s*[:)])/},wn={dom:{},job:{},user:{}},gh=!1,si=null,Ou=0,bm=null,Cm=!1;/** + */function Iy(e){var n={cssComments:/\/\*[\s\S]+?\*\//g,cssImports:/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g},t={rootElement:e.rootElement||document,include:e.include||'style,link[rel="stylesheet"]',exclude:e.exclude||null,filter:e.filter||null,skipDisabled:e.skipDisabled!==!1,useCSSOM:e.useCSSOM||!1,onBeforeSend:e.onBeforeSend||Function.prototype,onSuccess:e.onSuccess||Function.prototype,onError:e.onError||Function.prototype,onComplete:e.onComplete||Function.prototype},r=Array.apply(null,t.rootElement.querySelectorAll(t.include)).filter(function(u){return!YL(u,t.exclude)}),i=Array.apply(null,Array(r.length)).map(function(u){return null});function s(){var u=i.indexOf(null)===-1;if(u){i.reduce(function(d,h,f){return h===""&&d.push(f),d},[]).reverse().forEach(function(d){return[r,i].forEach(function(h){return h.splice(d,1)})});var c=i.join("");t.onComplete(c,i,r)}}function o(u,c,d,h){var f=t.onSuccess(u,d,h);u=f!==void 0&&!f?"":f||u,l(u,d,h,function(p,m){i[c]===null&&(m.forEach(function(b){return t.onError(b.xhr,d,b.url)}),!t.filter||t.filter.test(p)?i[c]=p:i[c]="",s())})}function a(u,c){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],h={};return h.rules=(u.replace(n.cssComments,"").match(n.cssImports)||[]).filter(function(f){return d.indexOf(f)===-1}),h.urls=h.rules.map(function(f){return f.replace(n.cssImports,"$1")}),h.absoluteUrls=h.urls.map(function(f){return xp(f,c)}),h.absoluteRules=h.rules.map(function(f,p){var m=h.urls[p],b=xp(h.absoluteUrls[p],c);return f.replace(m,b)}),h}function l(u,c,d,h){var f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],p=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],m=a(u,d,p);m.rules.length?Ny(m.absoluteUrls,{onBeforeSend:function(v,_,E){t.onBeforeSend(v,c,_)},onSuccess:function(v,_,E){var S=t.onSuccess(v,c,_);v=S===!1?"":S||v;var w=a(v,_,p);return w.rules.forEach(function(N,I){v=v.replace(N,w.absoluteRules[I])}),v},onError:function(v,_,E){f.push({xhr:v,url:_}),p.push(m.rules[E]),l(u,c,d,h,f,p)},onComplete:function(v){v.forEach(function(_,E){u=u.replace(m.rules[E],_)}),l(u,c,d,h,f,p)}}):h(u,f)}r.length?r.forEach(function(u,c){var d=u.getAttribute("href"),h=u.getAttribute("rel"),f=u.nodeName.toLowerCase()==="link"&&d&&h&&h.toLowerCase().indexOf("stylesheet")!==-1,p=t.skipDisabled===!1?!1:u.disabled,m=u.nodeName.toLowerCase()==="style";if(f&&!p){var b=d.indexOf("data:text/css")!==-1;if(b){var v=decodeURIComponent(d.substring(d.indexOf(",")+1));t.useCSSOM&&(v=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(v,c,u,location.href)}else Ny(d,{mimeType:"text/css",onBeforeSend:function(S,w,N){t.onBeforeSend(S,u,w)},onSuccess:function(S,w,N){var I=xp(d);o(S,c,u,I)},onError:function(S,w,N){i[c]="",t.onError(S,u,w),s()}})}else if(m&&!p){var _=u.textContent;t.useCSSOM&&(_=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(_,c,u,location.href)}else i[c]="",s()}):t.onComplete("",[])}function xp(e,n){var t=document.implementation.createHTMLDocument(""),r=t.createElement("base"),i=t.createElement("a");return t.head.appendChild(r),t.body.appendChild(i),r.href=n||document.baseURI||(document.querySelector("base")||{}).href||location.href,i.href=e,i.href}function YL(e,n){var t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;return t.call(e,n)}var FS=HS;function HS(e,n,t){e instanceof RegExp&&(e=Ay(e,t)),n instanceof RegExp&&(n=Ay(n,t));var r=jS(e,n,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+e.length,r[1]),post:t.slice(r[1]+n.length)}}function Ay(e,n){var t=n.match(e);return t?t[0]:null}HS.range=jS;function jS(e,n,t){var r,i,s,o,a,l=t.indexOf(e),u=t.indexOf(n,l+1),c=l;if(l>=0&&u>0){if(e===n)return[l,u];for(r=[],s=t.length;c>=0&&!a;)c==l?(r.push(c),l=t.indexOf(e,c+1)):r.length==1?a=[r.pop(),u]:(i=r.pop(),i=0?l:u;r.length&&(a=[s,o])}return a}function rg(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,removeComments:!1},r=$r({},t,n),i=[];function s(P){throw new Error("CSS parse error: ".concat(P))}function o(P){var X=P.exec(e);if(X)return e=e.slice(X[0].length),X}function a(){return o(/^{\s*/)}function l(){return o(/^}/)}function u(){o(/^\s*/)}function c(){if(u(),!(e[0]!=="/"||e[1]!=="*")){for(var P=2;e[P]&&(e[P]!=="*"||e[P+1]!=="/");)P++;if(!e[P])return s("end of comment is missing");var X=e.slice(2,P);return e=e.slice(P+2),{type:"comment",comment:X}}}function d(){for(var P=[],X;X=c();)P.push(X);return r.removeComments?[]:P}function h(){for(u();e[0]==="}";)s("extra closing bracket");var P=o(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);if(P){var X=P[0].trim(),z,H=/\/\*/.test(X);H&&(X=X.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,""));var Se=/["']\w*,\w*["']/.test(X);Se&&(X=X.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(J){return J.replace(/,/g,"‌")}));var V=/,/.test(X);return V?z=X.split(/\s*(?![^(]*\)),\s*/):z=[X],Se&&(z=z.map(function(J){return J.replace(/\u200C/g,",")})),z}}function f(){if(e[0]==="@")return x();o(/^([;\s]*)+/);var P=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,X=o(/^(\*?[-#/*\\\w.]+(\[[0-9a-z_-]+\])?)\s*/);if(X){if(X=X[0].trim(),!o(/^:\s*/))return s("property missing ':'");var z=o(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/),H={type:"declaration",property:X.replace(P,""),value:z?z[0].replace(P,"").trim():""};return o(/^[;\s]*/),H}}function p(){if(!a())return s("missing '{'");for(var P,X=d();P=f();)X.push(P),X=X.concat(d());return l()?X:s("missing '}'")}function m(){u();for(var P=[],X;X=o(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)P.push(X[1]),o(/^,\s*/);if(P.length)return{type:"keyframe",values:P,declarations:p()}}function b(){var P=o(/^@([-\w]+)?keyframes\s*/);if(P){var X=P[1];if(P=o(/^([-\w]+)\s*/),!P)return s("@keyframes missing name");var z=P[1];if(!a())return s("@keyframes missing '{'");for(var H,Se=d();H=m();)Se.push(H),Se=Se.concat(d());return l()?{type:"keyframes",name:z,vendor:X,keyframes:Se}:s("@keyframes missing '}'")}}function v(){var P=o(/^@page */);if(P){var X=h()||[];return{type:"page",selectors:X,declarations:p()}}}function _(){var P=o(/@(top|bottom|left|right)-(left|center|right|top|middle|bottom)-?(corner)?\s*/);if(P){var X="".concat(P[1],"-").concat(P[2])+(P[3]?"-".concat(P[3]):"");return{type:"page-margin-box",name:X,declarations:p()}}}function E(){var P=o(/^@font-face\s*/);if(P)return{type:"font-face",declarations:p()}}function S(){var P=o(/^@supports *([^{]+)/);if(P)return{type:"supports",supports:P[1].trim(),rules:q()}}function w(){var P=o(/^@host\s*/);if(P)return{type:"host",rules:q()}}function N(){var P=o(/^@media([^{]+)*/);if(P)return{type:"media",media:(P[1]||"").trim(),rules:q()}}function I(){var P=o(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(P)return{type:"custom-media",name:P[1].trim(),media:P[2].trim()}}function R(){var P=o(/^@([-\w]+)?document *([^{]+)/);if(P)return{type:"document",document:P[2].trim(),vendor:P[1]?P[1].trim():null,rules:q()}}function A(){var P=o(/^@(import|charset|namespace)\s*([^;]+);/);if(P)return{type:P[1],name:P[2].trim()}}function x(){if(u(),e[0]==="@"){var P=A()||E()||N()||b()||S()||R()||I()||w()||v()||_();if(P&&!r.preserveStatic){var X=!1;if(P.declarations)X=P.declarations.some(function(H){return/var\(/.test(H.value)});else{var z=P.keyframes||P.rules||[];X=z.some(function(H){return(H.declarations||[]).some(function(Se){return/var\(/.test(Se.value)})})}return X?P:{}}return P}}function U(){if(!r.preserveStatic){var P=FS("{","}",e);if(P){var X=/:(?:root|host)(?![.:#(])/.test(P.pre)&&/--\S*\s*:/.test(P.body),z=/var\(/.test(P.body);if(!X&&!z)return e=e.slice(P.end+1),{}}}var H=h()||[],Se=r.preserveStatic?p():p().filter(function(V){var J=H.some(function(we){return/:(?:root|host)(?![.:#(])/.test(we)})&&/^--\S/.test(V.property),re=/var\(/.test(V.value);return J||re});return H.length||s("selector missing"),{type:"rule",selectors:H,declarations:Se}}function q(P){if(!P&&!a())return s("missing '{'");for(var X,z=d();e.length&&(P||e[0]!=="}")&&(X=x()||U());)X.type&&z.push(X),z=z.concat(d());return!P&&!l()?s("missing '}'"):z}return{type:"stylesheet",stylesheet:{rules:q(!0),errors:i}}}function My(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={parseHost:!1,store:{},onWarning:function(){}},r=$r({},t,n),i=new RegExp(":".concat(r.parseHost?"host":"root","$"));return typeof e=="string"&&(e=rg(e,r)),e.stylesheet.rules.forEach(function(s){s.type!=="rule"||!s.selectors.some(function(o){return i.test(o)})||s.declarations.forEach(function(o,a){var l=o.property,u=o.value;l&&l.indexOf("--")===0&&(r.store[l]=u)})}),r.store}function BS(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2?arguments[2]:void 0,r={charset:function(o){return"@charset "+o.name+";"},comment:function(o){return o.comment.indexOf("__CSSVARSPONYFILL")===0?"/*"+o.comment+"*/":""},"custom-media":function(o){return"@custom-media "+o.name+" "+o.media+";"},declaration:function(o){return o.property+":"+o.value+";"},document:function(o){return"@"+(o.vendor||"")+"document "+o.document+"{"+i(o.rules)+"}"},"font-face":function(o){return"@font-face{"+i(o.declarations)+"}"},host:function(o){return"@host{"+i(o.rules)+"}"},import:function(o){return"@import "+o.name+";"},keyframe:function(o){return o.values.join(",")+"{"+i(o.declarations)+"}"},keyframes:function(o){return"@"+(o.vendor||"")+"keyframes "+o.name+"{"+i(o.keyframes)+"}"},media:function(o){return"@media "+o.media+"{"+i(o.rules)+"}"},namespace:function(o){return"@namespace "+o.name+";"},page:function(o){return"@page "+(o.selectors.length?o.selectors.join(", "):"")+"{"+i(o.declarations)+"}"},"page-margin-box":function(o){return"@"+o.name+"{"+i(o.declarations)+"}"},rule:function(o){var a=o.declarations;if(a.length)return o.selectors.join(",")+"{"+i(a)+"}"},supports:function(o){return"@supports "+o.supports+"{"+i(o.rules)+"}"}};function i(s){for(var o="",a=0;a1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,preserveVars:!1,variables:{},onWarning:function(){}},r=$r({},t,n);return typeof e=="string"&&(e=rg(e,r)),$S(e.stylesheet,function(i,s){for(var o=0;o1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;if(e.indexOf("var(")===-1)return e;var r=FS("(",")",e);function i(o){var a=o.split(",")[0].replace(/[\s\n\t]/g,""),l=(o.match(/(?:\s*,\s*){1}(.*)?/)||[])[1],u=Object.prototype.hasOwnProperty.call(n.variables,a)?String(n.variables[a]):void 0,c=u||(l?String(l):void 0),d=t||o;return u||n.onWarning('variable "'.concat(a,'" is undefined')),c&&c!=="undefined"&&c.length>0?xu(c,n,d):"var(".concat(d,")")}if(r)if(r.pre.slice(-3)==="var"){var s=r.body.trim().length===0;return s?(n.onWarning("var() must contain a non-whitespace string"),e):r.pre.slice(0,-3)+i(r.body)+xu(r.post,n)}else return r.pre+"(".concat(xu(r.body,n),")")+xu(r.post,n);else return e.indexOf("var(")!==-1&&n.onWarning('missing closing ")" in the value "'.concat(e,'"')),e}var u0=typeof window<"u",xy=u0&&window.CSS&&window.CSS.supports&&window.CSS.supports("(--a: 0)"),Zo={group:0,job:0},Bd={rootElement:u0?document:null,shadowDOM:!1,include:"style,link[rel=stylesheet]",exclude:"",variables:{},onlyLegacy:!0,preserveStatic:!0,preserveVars:!1,silent:!1,updateDOM:!0,updateURLs:!0,watch:null,onBeforeSend:function(){},onError:function(){},onWarning:function(){},onSuccess:function(){},onComplete:function(){},onFinally:function(){}},ss={cssComments:/\/\*[\s\S]+?\*\//g,cssKeyframes:/@(?:-\w*-)?keyframes/,cssMediaQueries:/@media[^{]+\{([\s\S]+?})\s*}/g,cssUrls:/url\((?!['"]?(?:data|http|\/\/):)['"]?([^'")]*)['"]?\)/g,cssVarDeclRules:/(?::(?:root|host)(?![.:#(])[\s,]*[^{]*{\s*[^}]*})/g,cssVarDecls:/(?:[\s;]*)(-{2}\w[\w-]*)(?:\s*:\s*)([^;]*);/g,cssVarFunc:/var\(\s*--[\w-]/,cssVars:/(?:(?::(?:root|host)(?![.:#(])[\s,]*[^{]*{\s*[^;]*;*\s*)|(?:var\(\s*))(--[^:)]+)(?:\s*[:)])/},wn={dom:{},job:{},user:{}},vh=!1,si=null,Ou=0,bm=null,Cm=!1;/** * Fetches, parses, and transforms CSS custom properties from specified * - +