diff --git a/assets/__bundle-2aa1a987-CRzOCkkA.js b/assets/__bundle-2aa1a987-CvKKdrEL.js similarity index 98% rename from assets/__bundle-2aa1a987-CRzOCkkA.js rename to assets/__bundle-2aa1a987-CvKKdrEL.js index 01b745205..a880615d3 100644 --- a/assets/__bundle-2aa1a987-CRzOCkkA.js +++ b/assets/__bundle-2aa1a987-CvKKdrEL.js @@ -1 +1 @@ -import{c as F}from"./index-Brn7CnTB.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-DGc6VuAm.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-uOi2Djg6.js b/assets/__bundle-347d730c-BWJ486i-.js similarity index 99% rename from assets/__bundle-347d730c-uOi2Djg6.js rename to assets/__bundle-347d730c-BWJ486i-.js index e5124980a..780b76d54 100644 --- a/assets/__bundle-347d730c-uOi2Djg6.js +++ b/assets/__bundle-347d730c-BWJ486i-.js @@ -1,2 +1,2 @@ -import{c as g}from"./index-Brn7CnTB.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-DGc6VuAm.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-f03e97a8-DwihxPbi.js b/assets/__bundle-a2788ee7-cDjobn7g.js similarity index 95% rename from assets/__bundle-f03e97a8-DwihxPbi.js rename to assets/__bundle-a2788ee7-cDjobn7g.js index e48854f85..c18a7b857 100644 --- a/assets/__bundle-f03e97a8-DwihxPbi.js +++ b/assets/__bundle-a2788ee7-cDjobn7g.js @@ -1 +1 @@ -import{j as y,v as a,R as L,x as h,M,X,z as b,J as I}from"./index-Brn7CnTB.js";var N=function(i,n){return new Promise(function(v,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),o=d.dispatcher,w=d.logger,c=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,p=n.data,x=p===void 0?"":p,l=n.uploadProgressHandler,g=!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(c,t.loaded,t.total):w.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(a.requestCanceled)},e.onerror=function(t){r(a.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!g)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);v(new L(i,t))}catch{r(a.networkError)}else try{var m=JSON.parse(e.responseText);if(m){var s=new a(m);if(s.isSessionExpiredError){if(o.dispatch(new h({reason:s.code,message:s.message})),!(e instanceof M)){var q=new X;return o.dispatch(new b({request:e,deferred:q,error:s})),q.promise}}else s.isSessionInvalidatedError&&o.dispatch(new h({reason:s.code,message:s.message}));r(s)}else r(a.requestFailed)}catch{r(a.requestFailed)}},o.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==c||(g=!0,e.abort()))}),e.send(x)}else r(a.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; +import{j as y,v as a,R as L,x as h,M,X,z as b,J as I}from"./index-DGc6VuAm.js";var N=function(i,n){return new Promise(function(v,r){if(typeof XMLHttpRequest<"u"){var d=y.of(i),o=d.dispatcher,w=d.logger,c=n.requestId,E=n.method,R=n.url,u=n.headers,f=u===void 0?{}:u,p=n.data,x=p===void 0?"":p,l=n.uploadProgressHandler,g=!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(c,t.loaded,t.total):w.debug("Progress computing failed: `Content-Length` header is not given.")}),e.onabort=function(){r(a.requestCanceled)},e.onerror=function(t){r(a.networkError)},e.onreadystatechange=function(){if(e.readyState===XMLHttpRequest.DONE&&!g)if(e.status===0||e.status>=200&&e.status<400)try{var t=JSON.parse(e.responseText);v(new L(i,t))}catch{r(a.networkError)}else try{var m=JSON.parse(e.responseText);if(m){var s=new a(m);if(s.isSessionExpiredError){if(o.dispatch(new h({reason:s.code,message:s.message})),!(e instanceof M)){var q=new X;return o.dispatch(new b({request:e,deferred:q,error:s})),q.promise}}else s.isSessionInvalidatedError&&o.dispatch(new h({reason:s.code,message:s.message}));r(s)}else r(a.requestFailed)}catch{r(a.requestFailed)}},o.on(function(t){t instanceof I&&(t.requestId&&t.requestId!==c||(g=!0,e.abort()))}),e.send(x)}else r(a.xmlHttpRequestNotSupported)})};export{N as xmlHttpRequest}; diff --git a/assets/index-Brn7CnTB.js b/assets/index-DGc6VuAm.js similarity index 57% rename from assets/index-Brn7CnTB.js rename to assets/index-DGc6VuAm.js index e91c46672..19acdcac8 100644 --- a/assets/index-Brn7CnTB.js +++ b/assets/index-DGc6VuAm.js @@ -30,27 +30,27 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var kw=D,ci=Ow;function we(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yp=Object.prototype.hasOwnProperty,Rw=/^[: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]*$/,Dv={},Uv={};function Lw(e){return Yp.call(Uv,e)?!0:Yp.call(Dv,e)?!1:Rw.test(e)?Uv[e]=!0:(Dv[e]=!0,!1)}function Dw(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 Uw(e,n,t,r){if(n===null||typeof n>"u"||Dw(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 vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vr[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];vr[n]=new Hr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vr[e]=new Hr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vr[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){vr[e]=new Hr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vr[e]=new Hr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vr[e]=new Hr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vr[e]=new Hr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vr[e]=new Hr(e,5,!1,e.toLowerCase(),null,!1,!1)});var $m=/[\-:]([a-z])/g;function Gm(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($m,Gm);vr[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($m,Gm);vr[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($m,Gm);vr[n]=new Hr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!1,!1)});vr.xlinkHref=new Hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!0,!0)});function zm(e,n,t,r){var i=vr.hasOwnProperty(n)?vr[n]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yp=Object.prototype.hasOwnProperty,Rw=/^[: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]*$/,Dv={},Uv={};function Lw(e){return Yp.call(Uv,e)?!0:Yp.call(Dv,e)?!1:Rw.test(e)?Uv[e]=!0:(Dv[e]=!0,!1)}function Dw(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 Uw(e,n,t,r){if(n===null||typeof n>"u"||Dw(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 vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vr[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];vr[n]=new Hr(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vr[e]=new Hr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vr[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){vr[e]=new Hr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vr[e]=new Hr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vr[e]=new Hr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vr[e]=new Hr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vr[e]=new Hr(e,5,!1,e.toLowerCase(),null,!1,!1)});var $m=/[\-:]([a-z])/g;function Gm(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($m,Gm);vr[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($m,Gm);vr[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($m,Gm);vr[n]=new Hr(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!1,!1)});vr.xlinkHref=new Hr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vr[e]=new Hr(e,1,!1,e.toLowerCase(),null,!0,!0)});function zm(e,n,t,r){var i=vr.hasOwnProperty(n)?vr[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{O0=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?bu(e):""}function Pw(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=k0(e.type,!1),e;case 11:return e=k0(e.type.render,!1),e;case 1:return e=k0(e.type,!0),e;default:return""}}function e_(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 el:return"Fragment";case Ja:return"Portal";case Zp:return"Profiler";case Vm:return"StrictMode";case Xp:return"Suspense";case Jp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case WE:return(e.displayName||"Context")+".Consumer";case qE:return(e._context.displayName||"Context")+".Provider";case qm:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wm:return n=e.displayName||null,n!==null?n:e_(e.type)||"Memo";case Zs:n=e._payload,e=e._init;try{return e_(e(n))}catch{}}return null}function Fw(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 e_(n);case 8:return n===Vm?"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 Ao(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 Hw(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 ad(e){e._valueTracker||(e._valueTracker=Hw(e))}function YE(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 Sh(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 t_(e,n){var t=n.checked;return ln({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Fv(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=Ao(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 ZE(e,n){n=n.checked,n!=null&&zm(e,"checked",n,!1)}function n_(e,n){ZE(e,n);var t=Ao(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")?r_(e,n.type,t):n.hasOwnProperty("defaultValue")&&r_(e,n.type,Ao(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Hv(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 r_(e,n,t){(n!=="number"||Sh(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var Cu=Array.isArray;function ml(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=ld.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function fc(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},jw=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(e){jw.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Lu[n]=Lu[e]})});function t3(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 n3(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=t3(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var Bw=ln({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 o_(e,n){if(n){if(Bw[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(we(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(we(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(we(61))}if(n.style!=null&&typeof n.style!="object")throw Error(we(62))}}function a_(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 l_=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var u_=null,gl=null,vl=null;function $v(e){if(e=Vc(e)){if(typeof u_!="function")throw Error(we(280));var n=e.stateNode;n&&(n=Df(n),u_(e.stateNode,e.type,n))}}function r3(e){gl?vl?vl.push(e):vl=[e]:gl=e}function i3(){if(gl){var e=gl,n=vl;if(vl=gl=null,$v(e),n)for(e=0;e>>=0,e===0?32:31-(Xw(e)/Jw|0)|0}var ud=64,cd=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 Ih(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 Gc(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-zi(n),e[n]=t}function rN(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),Zv=" ",Xv=!1;function T3(e,n){switch(e){case"keyup":return ON.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tl=!1;function RN(e,n){switch(e){case"compositionend":return w3(n);case"keypress":return n.which!==32?null:(Xv=!0,Zv);case"textInput":return e=n.data,e===Zv&&Xv?null:e;default:return null}}function LN(e,n){if(tl)return e==="compositionend"||!ng&&T3(e,n)?(e=C3(),Jd=Jm=so=null,tl=!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=n2(t)}}function M3(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?M3(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function x3(){for(var e=window,n=Sh();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Sh(e.document)}return n}function rg(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 GN(e){var n=x3(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&M3(t.ownerDocument.documentElement,t)){if(r!==null&&rg(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=r2(t,s);var o=r2(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,nl=null,__=null,Fu=null,m_=!1;function i2(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;m_||nl==null||nl!==Sh(r)||(r=nl,"selectionStart"in r&&rg(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&&yc(Fu,r)||(Fu=r,r=xh(__,"onSelect"),0sl||(e.current=C_[sl],C_[sl]=null,sl--)}function zt(e,n){sl++,C_[sl]=e.current,e.current=n}var Mo={},Nr=Ro(Mo),qr=Ro(!1),ya=Mo;function wl(e,n){var t=e.type.contextTypes;if(!t)return Mo;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 kh(){Kt(qr),Kt(Nr)}function d2(e,n,t){if(Nr.current!==Mo)throw Error(we(168));zt(Nr,n),zt(qr,t)}function H3(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(we(108,Fw(e)||"Unknown",i));return ln({},t,r)}function Rh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Mo,ya=Nr.current,zt(Nr,e),zt(qr,qr.current),!0}function h2(e,n,t){var r=e.stateNode;if(!r)throw Error(we(169));t?(e=H3(e,n,ya),r.__reactInternalMemoizedMergedChildContext=e,Kt(qr),Kt(Nr),zt(Nr,e)):Kt(qr),zt(qr,t)}var Ns=null,Uf=!1,q0=!1;function j3(e){Ns===null?Ns=[e]:Ns.push(e)}function tI(e){Uf=!0,j3(e)}function Lo(){if(!q0&&Ns!==null){q0=!0;var e=0,n=Mt;try{var t=Ns;for(Mt=1;e>=o,i-=o,xs=1<<32-zi(n)+i|t<k?(I=A,A=null):I=A.sibling;var x=h(g,A,E[k],S);if(x===null){A===null&&(A=I);break}e&&A&&x.alternate===null&&n(g,A),_=s(x,_,k),N===null?w=x:N.sibling=x,N=x,A=I}if(k===E.length)return t(g,A),en&&$o(g,k),w;if(A===null){for(;kk?(I=A,A=null):I=A.sibling;var U=h(g,A,x.value,S);if(U===null){A===null&&(A=I);break}e&&A&&U.alternate===null&&n(g,A),_=s(U,_,k),N===null?w=U:N.sibling=U,N=U,A=I}if(x.done)return t(g,A),en&&$o(g,k),w;if(A===null){for(;!x.done;k++,x=E.next())x=d(g,x.value,S),x!==null&&(_=s(x,_,k),N===null?w=x:N.sibling=x,N=x);return en&&$o(g,k),w}for(A=r(g,A);!x.done;k++,x=E.next())x=f(A,g,k,x.value,S),x!==null&&(e&&x.alternate!==null&&A.delete(x.key===null?k:x.key),_=s(x,_,k),N===null?w=x:N.sibling=x,N=x);return e&&A.forEach(function(z){return n(g,z)}),en&&$o(g,k),w}function b(g,_,E,S){if(typeof E=="object"&&E!==null&&E.type===el&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case od:e:{for(var w=E.key,N=_;N!==null;){if(N.key===w){if(w=E.type,w===el){if(N.tag===7){t(g,N.sibling),_=i(N,E.props.children),_.return=g,g=_;break e}}else if(N.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Zs&&_2(w)===N.type){t(g,N.sibling),_=i(N,E.props),_.ref=iu(g,N,E),_.return=g,g=_;break e}t(g,N);break}else n(g,N);N=N.sibling}E.type===el?(_=da(E.props.children,g.mode,S,E.key),_.return=g,g=_):(S=ah(E.type,E.key,E.props,null,g.mode,S),S.ref=iu(g,_,E),S.return=g,g=S)}return o(g);case Ja:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(g,_.sibling),_=i(_,E.children||[]),_.return=g,g=_;break e}else{t(g,_);break}else n(g,_);_=_.sibling}_=ep(E,g.mode,S),_.return=g,g=_}return o(g);case Zs:return N=E._init,b(g,_,N(E._payload),S)}if(Cu(E))return p(g,_,E,S);if(Jl(E))return m(g,_,E,S);gd(g,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(g,_.sibling),_=i(_,E),_.return=g,g=_):(t(g,_),_=J0(E,g.mode,S),_.return=g,g=_),o(g)):t(g,_)}return b}var Il=z3(!0),V3=z3(!1),Uh=Ro(null),Ph=null,ll=null,ag=null;function lg(){ag=ll=Ph=null}function ug(e){var n=Uh.current;Kt(Uh),e._currentValue=n}function w_(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 El(e,n){Ph=e,ag=ll=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(Vr=!0),e.firstContext=null)}function Ai(e){var n=e._currentValue;if(ag!==e)if(e={context:e,memoizedValue:n,next:null},ll===null){if(Ph===null)throw Error(we(308));ll=e,Ph.dependencies={lanes:0,firstContext:e}}else ll=ll.next=e;return n}var Jo=null;function cg(e){Jo===null?Jo=[e]:Jo.push(e)}function q3(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,cg(n)):(t.next=i.next,i.next=t),n.interleaved=t,Fs(e,r)}function Fs(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 Xs=!1;function dg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W3(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 Rs(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function _o(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,Fs(e,t)}return i=r.interleaved,i===null?(n.next=n,cg(r)):(n.next=i.next,i.next=n),r.interleaved=n,Fs(e,t)}function th(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,Ym(e,t)}}function m2(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 Fh(e,n,t,r){var i=e.updateQueue;Xs=!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=ln({},d,h);break e;case 2:Xs=!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);Ca|=o,e.lanes=o,e.memoizedState=d}}function g2(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=K0.transition;K0.transition={};try{e(!1),n()}finally{Mt=t,K0.transition=r}}function cb(){return Mi().memoizedState}function sI(e,n,t){var r=go(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},db(e))hb(n,t);else if(t=q3(e,n,t,r),t!==null){var i=Dr();Vi(t,e,r,i),fb(t,n,r)}}function oI(e,n,t){var r=go(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(db(e))hb(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,qi(a,o)){var l=n.interleaved;l===null?(i.next=i,cg(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=q3(e,n,i,r),t!==null&&(i=Dr(),Vi(t,e,r,i),fb(t,n,r))}}function db(e){var n=e.alternate;return e===an||n!==null&&n===an}function hb(e,n){Hu=jh=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function fb(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Ym(e,t)}}var Bh={readContext:Ai,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useInsertionEffect:Er,useLayoutEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useMutableSource:Er,useSyncExternalStore:Er,useId:Er,unstable_isNewReconciler:!1},aI={readContext:Ai,useCallback:function(e,n){return Ji().memoizedState=[e,n===void 0?null:n],e},useContext:Ai,useEffect:y2,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,rh(4194308,4,sb.bind(null,n,e),t)},useLayoutEffect:function(e,n){return rh(4194308,4,e,n)},useInsertionEffect:function(e,n){return rh(4,2,e,n)},useMemo:function(e,n){var t=Ji();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=Ji();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=sI.bind(null,an,e),[r.memoizedState,e]},useRef:function(e){var n=Ji();return e={current:e},n.memoizedState=e},useState:v2,useDebugValue:yg,useDeferredValue:function(e){return Ji().memoizedState=e},useTransition:function(){var e=v2(!1),n=e[0];return e=iI.bind(null,e[1]),Ji().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=an,i=Ji();if(en){if(t===void 0)throw Error(we(407));t=t()}else{if(t=n(),nr===null)throw Error(we(349));ba&30||Z3(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,y2(J3.bind(null,r,s,e),[e]),r.flags|=2048,Ic(9,X3.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=Ji(),n=nr.identifierPrefix;if(en){var t=Os,r=xs;t=(r&~(1<<32-zi(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=wc++,0")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{O0=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?bu(e):""}function Pw(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=k0(e.type,!1),e;case 11:return e=k0(e.type.render,!1),e;case 1:return e=k0(e.type,!0),e;default:return""}}function e_(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 el:return"Fragment";case Ja:return"Portal";case Zp:return"Profiler";case Vm:return"StrictMode";case Xp:return"Suspense";case Jp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case WE:return(e.displayName||"Context")+".Consumer";case qE:return(e._context.displayName||"Context")+".Provider";case qm:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wm:return n=e.displayName||null,n!==null?n:e_(e.type)||"Memo";case Xs:n=e._payload,e=e._init;try{return e_(e(n))}catch{}}return null}function Fw(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 e_(n);case 8:return n===Vm?"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 Hw(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 ad(e){e._valueTracker||(e._valueTracker=Hw(e))}function YE(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 Sh(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 t_(e,n){var t=n.checked;return ln({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Fv(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 ZE(e,n){n=n.checked,n!=null&&zm(e,"checked",n,!1)}function n_(e,n){ZE(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")?r_(e,n.type,t):n.hasOwnProperty("defaultValue")&&r_(e,n.type,Mo(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Hv(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 r_(e,n,t){(n!=="number"||Sh(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var Cu=Array.isArray;function ml(e,n,t,r){if(e=e.options,n){n={};for(var i=0;i"+n.valueOf().toString()+"",n=ld.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function fc(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},jw=["Webkit","ms","Moz","O"];Object.keys(Lu).forEach(function(e){jw.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Lu[n]=Lu[e]})});function t3(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 n3(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=t3(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,i):e[t]=i}}var Bw=ln({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 o_(e,n){if(n){if(Bw[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(we(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(we(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(we(61))}if(n.style!=null&&typeof n.style!="object")throw Error(we(62))}}function a_(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 l_=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var u_=null,gl=null,vl=null;function $v(e){if(e=Vc(e)){if(typeof u_!="function")throw Error(we(280));var n=e.stateNode;n&&(n=Df(n),u_(e.stateNode,e.type,n))}}function r3(e){gl?vl?vl.push(e):vl=[e]:gl=e}function i3(){if(gl){var e=gl,n=vl;if(vl=gl=null,$v(e),n)for(e=0;e>>=0,e===0?32:31-(Xw(e)/Jw|0)|0}var ud=64,cd=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 Ih(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 Gc(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-zi(n),e[n]=t}function rN(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),Zv=" ",Xv=!1;function T3(e,n){switch(e){case"keyup":return ON.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var tl=!1;function RN(e,n){switch(e){case"compositionend":return w3(n);case"keypress":return n.which!==32?null:(Xv=!0,Zv);case"textInput":return e=n.data,e===Zv&&Xv?null:e;default:return null}}function LN(e,n){if(tl)return e==="compositionend"||!ng&&T3(e,n)?(e=C3(),Jd=Jm=oo=null,tl=!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=n2(t)}}function M3(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?M3(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function x3(){for(var e=window,n=Sh();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Sh(e.document)}return n}function rg(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 GN(e){var n=x3(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&M3(t.ownerDocument.documentElement,t)){if(r!==null&&rg(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=r2(t,s);var o=r2(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,nl=null,__=null,Fu=null,m_=!1;function i2(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;m_||nl==null||nl!==Sh(r)||(r=nl,"selectionStart"in r&&rg(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&&yc(Fu,r)||(Fu=r,r=xh(__,"onSelect"),0sl||(e.current=C_[sl],C_[sl]=null,sl--)}function zt(e,n){sl++,C_[sl]=e.current,e.current=n}var xo={},Nr=Lo(xo),qr=Lo(!1),ya=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 kh(){Kt(qr),Kt(Nr)}function d2(e,n,t){if(Nr.current!==xo)throw Error(we(168));zt(Nr,n),zt(qr,t)}function H3(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(we(108,Fw(e)||"Unknown",i));return ln({},t,r)}function Rh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xo,ya=Nr.current,zt(Nr,e),zt(qr,qr.current),!0}function h2(e,n,t){var r=e.stateNode;if(!r)throw Error(we(169));t?(e=H3(e,n,ya),r.__reactInternalMemoizedMergedChildContext=e,Kt(qr),Kt(Nr),zt(Nr,e)):Kt(qr),zt(qr,t)}var Ns=null,Uf=!1,q0=!1;function j3(e){Ns===null?Ns=[e]:Ns.push(e)}function tI(e){Uf=!0,j3(e)}function Do(){if(!q0&&Ns!==null){q0=!0;var e=0,n=Mt;try{var t=Ns;for(Mt=1;e>=o,i-=o,Os=1<<32-zi(n)+i|t<k?(I=A,A=null):I=A.sibling;var x=h(g,A,E[k],S);if(x===null){A===null&&(A=I);break}e&&A&&x.alternate===null&&n(g,A),_=s(x,_,k),N===null?w=x:N.sibling=x,N=x,A=I}if(k===E.length)return t(g,A),en&&Go(g,k),w;if(A===null){for(;kk?(I=A,A=null):I=A.sibling;var U=h(g,A,x.value,S);if(U===null){A===null&&(A=I);break}e&&A&&U.alternate===null&&n(g,A),_=s(U,_,k),N===null?w=U:N.sibling=U,N=U,A=I}if(x.done)return t(g,A),en&&Go(g,k),w;if(A===null){for(;!x.done;k++,x=E.next())x=d(g,x.value,S),x!==null&&(_=s(x,_,k),N===null?w=x:N.sibling=x,N=x);return en&&Go(g,k),w}for(A=r(g,A);!x.done;k++,x=E.next())x=f(A,g,k,x.value,S),x!==null&&(e&&x.alternate!==null&&A.delete(x.key===null?k:x.key),_=s(x,_,k),N===null?w=x:N.sibling=x,N=x);return e&&A.forEach(function(z){return n(g,z)}),en&&Go(g,k),w}function b(g,_,E,S){if(typeof E=="object"&&E!==null&&E.type===el&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case od:e:{for(var w=E.key,N=_;N!==null;){if(N.key===w){if(w=E.type,w===el){if(N.tag===7){t(g,N.sibling),_=i(N,E.props.children),_.return=g,g=_;break e}}else if(N.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===Xs&&_2(w)===N.type){t(g,N.sibling),_=i(N,E.props),_.ref=iu(g,N,E),_.return=g,g=_;break e}t(g,N);break}else n(g,N);N=N.sibling}E.type===el?(_=ha(E.props.children,g.mode,S,E.key),_.return=g,g=_):(S=ah(E.type,E.key,E.props,null,g.mode,S),S.ref=iu(g,_,E),S.return=g,g=S)}return o(g);case Ja:e:{for(N=E.key;_!==null;){if(_.key===N)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(g,_.sibling),_=i(_,E.children||[]),_.return=g,g=_;break e}else{t(g,_);break}else n(g,_);_=_.sibling}_=ep(E,g.mode,S),_.return=g,g=_}return o(g);case Xs:return N=E._init,b(g,_,N(E._payload),S)}if(Cu(E))return p(g,_,E,S);if(Jl(E))return m(g,_,E,S);gd(g,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(g,_.sibling),_=i(_,E),_.return=g,g=_):(t(g,_),_=J0(E,g.mode,S),_.return=g,g=_),o(g)):t(g,_)}return b}var Il=z3(!0),V3=z3(!1),Uh=Lo(null),Ph=null,ll=null,ag=null;function lg(){ag=ll=Ph=null}function ug(e){var n=Uh.current;Kt(Uh),e._currentValue=n}function w_(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 El(e,n){Ph=e,ag=ll=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&n&&(Vr=!0),e.firstContext=null)}function Ai(e){var n=e._currentValue;if(ag!==e)if(e={context:e,memoizedValue:n,next:null},ll===null){if(Ph===null)throw Error(we(308));ll=e,Ph.dependencies={lanes:0,firstContext:e}}else ll=ll.next=e;return n}var ea=null;function cg(e){ea===null?ea=[e]:ea.push(e)}function q3(e,n,t,r){var i=n.interleaved;return i===null?(t.next=t,cg(n)):(t.next=i.next,i.next=t),n.interleaved=t,Hs(e,r)}function Hs(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 Js=!1;function dg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W3(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 Ls(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,Hs(e,t)}return i=r.interleaved,i===null?(n.next=n,cg(r)):(n.next=i.next,i.next=n),r.interleaved=n,Hs(e,t)}function th(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,Ym(e,t)}}function m2(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 Fh(e,n,t,r){var i=e.updateQueue;Js=!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=ln({},d,h);break e;case 2:Js=!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);Ca|=o,e.lanes=o,e.memoizedState=d}}function g2(e,n,t){if(e=n.effects,n.effects=null,e!==null)for(n=0;nt?t:4,e(!0);var r=K0.transition;K0.transition={};try{e(!1),n()}finally{Mt=t,K0.transition=r}}function cb(){return Mi().memoizedState}function sI(e,n,t){var r=vo(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},db(e))hb(n,t);else if(t=q3(e,n,t,r),t!==null){var i=Dr();Vi(t,e,r,i),fb(t,n,r)}}function oI(e,n,t){var r=vo(e),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(db(e))hb(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,qi(a,o)){var l=n.interleaved;l===null?(i.next=i,cg(n)):(i.next=l.next,l.next=i),n.interleaved=i;return}}catch{}finally{}t=q3(e,n,i,r),t!==null&&(i=Dr(),Vi(t,e,r,i),fb(t,n,r))}}function db(e){var n=e.alternate;return e===an||n!==null&&n===an}function hb(e,n){Hu=jh=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function fb(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Ym(e,t)}}var Bh={readContext:Ai,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useInsertionEffect:Er,useLayoutEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useMutableSource:Er,useSyncExternalStore:Er,useId:Er,unstable_isNewReconciler:!1},aI={readContext:Ai,useCallback:function(e,n){return Ji().memoizedState=[e,n===void 0?null:n],e},useContext:Ai,useEffect:y2,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,rh(4194308,4,sb.bind(null,n,e),t)},useLayoutEffect:function(e,n){return rh(4194308,4,e,n)},useInsertionEffect:function(e,n){return rh(4,2,e,n)},useMemo:function(e,n){var t=Ji();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=Ji();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=sI.bind(null,an,e),[r.memoizedState,e]},useRef:function(e){var n=Ji();return e={current:e},n.memoizedState=e},useState:v2,useDebugValue:yg,useDeferredValue:function(e){return Ji().memoizedState=e},useTransition:function(){var e=v2(!1),n=e[0];return e=iI.bind(null,e[1]),Ji().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=an,i=Ji();if(en){if(t===void 0)throw Error(we(407));t=t()}else{if(t=n(),nr===null)throw Error(we(349));ba&30||Z3(r,n,t)}i.memoizedState=t;var s={value:t,getSnapshot:n};return i.queue=s,y2(J3.bind(null,r,s,e),[e]),r.flags|=2048,Ic(9,X3.bind(null,r,s,t,n),void 0,null),t},useId:function(){var e=Ji(),n=nr.identifierPrefix;if(en){var t=ks,r=Os;t=(r&~(1<<32-zi(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=wc++,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[is]=n,e[Cc]=r,Sb(e,n,!1,!1),n.stateNode=e;e:{switch(o=a_(t,r),t){case"dialog":Vt("cancel",e),Vt("close",e),i=r;break;case"iframe":case"object":case"embed":Vt("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=Hh(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&&!en)return br(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=on.current,zt(on,r?t&1|2:t&1),n):(br(n),null);case 22:case 23:return wg(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?ti&1073741824&&(br(n),n.subtreeFlags&6&&(n.flags|=8192)):br(n),null;case 24:return null;case 25:return null}throw Error(we(156,n.tag))}function _I(e,n){switch(sg(n),n.tag){case 1:return Wr(n.type)&&kh(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Al(),Kt(qr),Kt(Nr),pg(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return fg(n),null;case 13:if(Kt(on),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(we(340));Nl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Kt(on),null;case 4:return Al(),null;case 10:return ug(n.type._context),null;case 22:case 23:return wg(),null;case 24:return null;default:return null}}var yd=!1,Sr=!1,mI=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function ul(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){_n(e,n,r)}else t.current=null}function L_(e,n,t){try{t()}catch(r){_n(e,n,r)}}var x2=!1;function gI(e,n){if(g_=Ah,e=x3(),rg(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(v_={focusedElem:e,selectionRange:t},Ah=!1,Fe=n;Fe!==null;)if(n=Fe,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Fe=e;else for(;Fe!==null;){n=Fe;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,g=n.stateNode,_=g.getSnapshotBeforeUpdate(n.elementType===n.type?m:ji(n.type,m),b);g.__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(we(163))}}catch(S){_n(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,Fe=e;break}Fe=n.return}return p=x2,x2=!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&&L_(n,t,s)}i=i.next}while(i!==r)}}function Hf(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 D_(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 Nb(e){var n=e.alternate;n!==null&&(e.alternate=null,Nb(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[is],delete n[Cc],delete n[b_],delete n[JN],delete n[eI])),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 Ib(e){return e.tag===5||e.tag===3||e.tag===4}function O2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ib(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 U_(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=Oh));else if(r!==4&&(e=e.child,e!==null))for(U_(e,n,t),e=e.sibling;e!==null;)U_(e,n,t),e=e.sibling}function P_(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(P_(e,n,t),e=e.sibling;e!==null;)P_(e,n,t),e=e.sibling}var cr=null,Bi=!1;function Vs(e,n,t){for(t=t.child;t!==null;)Ab(e,n,t),t=t.sibling}function Ab(e,n,t){if(ds&&typeof ds.onCommitFiberUnmount=="function")try{ds.onCommitFiberUnmount(Of,t)}catch{}switch(t.tag){case 5:Sr||ul(t,n);case 6:var r=cr,i=Bi;cr=null,Vs(e,n,t),cr=r,Bi=i,cr!==null&&(Bi?(e=cr,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):cr.removeChild(t.stateNode));break;case 18:cr!==null&&(Bi?(e=cr,t=t.stateNode,e.nodeType===8?V0(e.parentNode,t):e.nodeType===1&&V0(e,t),gc(e)):V0(cr,t.stateNode));break;case 4:r=cr,i=Bi,cr=t.stateNode.containerInfo,Bi=!0,Vs(e,n,t),cr=r,Bi=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)&&L_(t,n,o),i=i.next}while(i!==r)}Vs(e,n,t);break;case 1:if(!Sr&&(ul(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){_n(t,n,a)}Vs(e,n,t);break;case 21:Vs(e,n,t);break;case 22:t.mode&1?(Sr=(r=Sr)||t.memoizedState!==null,Vs(e,n,t),Sr=r):Vs(e,n,t);break;default:Vs(e,n,t)}}function k2(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new mI),n.forEach(function(r){var i=NI.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Li(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*yI(r/1960))-r,10e?16:e,oo===null)var r=!1;else{if(e=oo,oo=null,zh=0,pt&6)throw Error(we(331));var i=pt;for(pt|=4,Fe=e.current;Fe!==null;){var s=Fe,o=s.child;if(Fe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lMn()-Sg?ca(e,0):Cg|=t),Kr(e,n)}function Ub(e,n){n===0&&(e.mode&1?(n=cd,cd<<=1,!(cd&130023424)&&(cd=4194304)):n=1);var t=Dr();e=Fs(e,n),e!==null&&(Gc(e,n,t),Kr(e,t))}function wI(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Ub(e,t)}function NI(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(we(314))}r!==null&&r.delete(n),Ub(e,t)}var Pb;Pb=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,fI(e,n,t);Vr=!!(e.flags&131072)}else Vr=!1,en&&n.flags&1048576&&B3(n,Dh,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;ih(e,n),e=n.pendingProps;var i=wl(n,Nr.current);El(n,t),i=mg(null,n,r,e,i,t);var s=gg();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,Rh(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,dg(n),i.updater=Ff,n.stateNode=i,i._reactInternals=n,I_(n,r,e,t),n=x_(null,n,r,!0,s,t)):(n.tag=0,en&&s&&ig(n),xr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(ih(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=AI(r),e=ji(r,e),i){case 0:n=M_(null,n,r,e,t);break e;case 1:n=I2(null,n,r,e,t);break e;case 11:n=w2(null,n,r,e,t);break e;case 14:n=N2(null,n,r,ji(r.type,e),t);break e}throw Error(we(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),M_(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),I2(e,n,r,i,t);case 3:e:{if(Eb(n),e===null)throw Error(we(387));r=n.pendingProps,s=n.memoizedState,i=s.element,W3(e,n),Fh(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(we(423)),n),n=A2(e,n,r,t,i);break e}else if(r!==i){i=Ml(Error(we(424)),n),n=A2(e,n,r,t,i);break e}else for(ai=po(n.stateNode.containerInfo.firstChild),ui=n,en=!0,$i=null,t=V3(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Nl(),r===i){n=Hs(e,n,t);break e}xr(e,n,r,t)}n=n.child}return n;case 5:return K3(n),e===null&&T_(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,y_(r,i)?o=null:s!==null&&y_(r,s)&&(n.flags|=32),yb(e,n),xr(e,n,o,t),n.child;case 6:return e===null&&T_(n),null;case 13:return bb(e,n,t);case 4:return hg(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:ji(r,i),w2(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,zt(Uh,r._currentValue),r._currentValue=o,s!==null)if(qi(s.value,o)){if(s.children===i.children&&!qr.current){n=Hs(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=Rs(-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),w_(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(we(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),w_(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,El(n,t),i=Ai(i),r=r(i),n.flags|=1,xr(e,n,r,t),n.child;case 14:return r=n.type,i=ji(r,n.pendingProps),i=ji(r.type,i),N2(e,n,r,i,t);case 15:return gb(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),ih(e,n),n.tag=1,Wr(r)?(e=!0,Rh(n)):e=!1,El(n,t),pb(n,r,i),I_(n,r,i,t),x_(null,n,r,!0,e,t);case 19:return Cb(e,n,t);case 22:return vb(e,n,t)}throw Error(we(156,n.tag))};function Fb(e,n){return d3(e,n)}function II(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 wi(e,n,t,r){return new II(e,n,t,r)}function Ig(e){return e=e.prototype,!(!e||!e.isReactComponent)}function AI(e){if(typeof e=="function")return Ig(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qm)return 11;if(e===Wm)return 14}return 2}function vo(e,n){var t=e.alternate;return t===null?(t=wi(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 ah(e,n,t,r,i,s){var o=2;if(r=e,typeof e=="function")Ig(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case el:return da(t.children,i,s,n);case Vm:o=8,i|=8;break;case Zp:return e=wi(12,t,n,i|2),e.elementType=Zp,e.lanes=s,e;case Xp:return e=wi(13,t,n,i),e.elementType=Xp,e.lanes=s,e;case Jp:return e=wi(19,t,n,i),e.elementType=Jp,e.lanes=s,e;case KE:return Bf(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qE:o=10;break e;case WE:o=9;break e;case qm:o=11;break e;case Wm:o=14;break e;case Zs:o=16,r=null;break e}throw Error(we(130,e==null?e:typeof e,""))}return n=wi(o,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function da(e,n,t,r){return e=wi(7,e,r,n),e.lanes=t,e}function Bf(e,n,t,r){return e=wi(22,e,r,n),e.elementType=KE,e.lanes=t,e.stateNode={isHidden:!1},e}function J0(e,n,t){return e=wi(6,e,null,n),e.lanes=t,e}function ep(e,n,t){return n=wi(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function MI(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=L0(0),this.expirationTimes=L0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=L0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ag(e,n,t,r,i,s,o,a,l){return e=new MI(e,n,t,a,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=wi(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},dg(s),e}function xI(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($b)}catch(e){console.error(e)}}$b(),$E.exports=hi;var Wc=$E.exports;const Gb=Mf(Wc);var j2=Wc;Qp.createRoot=j2.createRoot,Qp.hydrateRoot=j2.hydrateRoot;var zb={exports:{}},xt={};/** @license React v16.13.1 +`+s.stack}return{value:e,source:n,stack:i,digest:null}}function Z0(e,n,t){return{value:e,source:null,stack:t??null,digest:n??null}}function A_(e,n){try{console.error(n.value)}catch(t){setTimeout(function(){throw t})}}var cI=typeof WeakMap=="function"?WeakMap:Map;function _b(e,n,t){t=Ls(-1,t),t.tag=3,t.payload={element:null};var r=n.value;return t.callback=function(){Gh||(Gh=!0,F_=r),A_(e,n)},t}function mb(e,n,t){t=Ls(-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(){A_(e,n)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){A_(e,n),typeof r!="function"&&(go===null?go=new Set([this]):go.add(this));var o=n.stack;this.componentDidCatch(n.value,{componentStack:o!==null?o:""})}),t}function C2(e,n,t){var r=e.pingCache;if(r===null){r=e.pingCache=new cI;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=TI.bind(null,e,n,t),n.then(e,e))}function S2(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 T2(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=Ls(-1,1),n.tag=2,mo(t,n,1))),t.lanes|=1),e)}var dI=$s.ReactCurrentOwner,Vr=!1;function xr(e,n,t,r){n.child=e===null?V3(n,null,t,r):Il(n,e.child,t,r)}function w2(e,n,t,r,i){t=t.render;var s=n.ref;return El(n,i),r=mg(e,n,t,r,s,i),t=gg(),e!==null&&!Vr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,js(e,n,i)):(en&&t&&ig(n),n.flags|=1,xr(e,n,r,i),n.child)}function N2(e,n,t,r,i){if(e===null){var s=t.type;return typeof s=="function"&&!Ig(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(n.tag=15,n.type=s,gb(e,n,s,r,i)):(e=ah(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:yc,t(o,r)&&e.ref===n.ref)return js(e,n,i)}return n.flags|=1,e=yo(s,r),e.ref=n.ref,e.return=n,n.child=e}function gb(e,n,t,r,i){if(e!==null){var s=e.memoizedProps;if(yc(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,js(e,n,i)}return M_(e,n,t,r,i)}function vb(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},zt(cl,ti),ti|=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,zt(cl,ti),ti|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,zt(cl,ti),ti|=r}else s!==null?(r=s.baseLanes|t,n.memoizedState=null):r=t,zt(cl,ti),ti|=r;return xr(e,n,i,t),n.child}function yb(e,n){var t=n.ref;(e===null&&t!==null||e!==null&&e.ref!==t)&&(n.flags|=512,n.flags|=2097152)}function M_(e,n,t,r,i){var s=Wr(t)?ya:Nr.current;return s=wl(n,s),El(n,i),t=mg(e,n,t,r,s,i),r=gg(),e!==null&&!Vr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i,js(e,n,i)):(en&&r&&ig(n),n.flags|=1,xr(e,n,t,i),n.child)}function I2(e,n,t,r,i){if(Wr(t)){var s=!0;Rh(n)}else s=!1;if(El(n,i),n.stateNode===null)ih(e,n),pb(n,t,r),I_(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=Ai(u):(u=Wr(t)?ya: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)&&b2(n,o,r,u),Js=!1;var h=n.memoizedState;o.state=h,Fh(n,r,o,i),l=n.memoizedState,a!==r||h!==l||qr.current||Js?(typeof c=="function"&&(N_(n,t,c,r),l=n.memoizedState),(a=Js||E2(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,W3(e,n),a=n.memoizedProps,u=n.type===n.elementType?a:ji(n.type,a),o.props=u,d=n.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Ai(l):(l=Wr(t)?ya: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)&&b2(n,o,r,l),Js=!1,h=n.memoizedState,o.state=h,Fh(n,r,o,i);var p=n.memoizedState;a!==d||h!==p||qr.current||Js?(typeof f=="function"&&(N_(n,t,f,r),p=n.memoizedState),(u=Js||E2(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 x_(e,n,t,r,s,i)}function x_(e,n,t,r,i,s){yb(e,n);var o=(n.flags&128)!==0;if(!r&&!o)return i&&h2(n,t,!1),js(e,n,s);r=n.stateNode,dI.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&&h2(n,t,!0),n.child}function Eb(e){var n=e.stateNode;n.pendingContext?d2(e,n.pendingContext,n.pendingContext!==n.context):n.context&&d2(e,n.context,!1),hg(e,n.containerInfo)}function A2(e,n,t,r,i){return Nl(),og(i),n.flags|=256,xr(e,n,t,r),n.child}var O_={dehydrated:null,treeContext:null,retryLane:0};function k_(e){return{baseLanes:e,cachePool:null,transitions:null}}function bb(e,n,t){var r=n.pendingProps,i=on.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),zt(on,i&1),e===null)return T_(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=Bf(o,r,0,null),e=ha(e,r,t,null),s.return=n,e.return=n,s.sibling=e,n.child=s,n.child.memoizedState=k_(t),n.memoizedState=O_,e):Eg(n,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return hI(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=ha(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?k_(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~t,n.memoizedState=O_,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 Eg(e,n){return n=Bf({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function vd(e,n,t,r){return r!==null&&og(r),Il(n,e.child,null,t),e=Eg(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function hI(e,n,t,r,i,s,o){if(t)return n.flags&256?(n.flags&=-257,r=Z0(Error(we(422))),vd(e,n,o,r)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(s=r.fallback,i=n.mode,r=Bf({mode:"visible",children:r.children},i,0,null),s=ha(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=k_(o),n.memoizedState=O_,s);if(!(n.mode&1))return vd(e,n,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(we(419)),r=Z0(s,r,void 0),vd(e,n,o,r)}if(a=(o&e.childLanes)!==0,Vr||a){if(r=nr,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,Hs(e,i),Vi(r,e,i,-1))}return Ng(),r=Z0(Error(we(421))),vd(e,n,o,r)}return i.data==="$?"?(n.flags|=128,n.child=e.child,n=wI.bind(null,e),i._reactRetry=n,null):(e=s.treeContext,ai=_o(i.nextSibling),ui=n,en=!0,$i=null,e!==null&&(Ei[bi++]=Os,Ei[bi++]=ks,Ei[bi++]=Ea,Os=e.id,ks=e.overflow,Ea=n),n=Eg(n,r.children),n.flags|=4096,n)}function M2(e,n,t){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n),w_(e.return,n,t)}function X0(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 Cb(e,n,t){var r=n.pendingProps,i=r.revealOrder,s=r.tail;if(xr(e,n,r.children,t),r=on.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&&M2(e,t,n);else if(e.tag===19)M2(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(zt(on,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&&Hh(e)===null&&(i=t),t=t.sibling;t=i,t===null?(i=n.child,n.child=null):(i=t.sibling,t.sibling=null),X0(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&&Hh(e)===null){n.child=i;break}e=i.sibling,i.sibling=t,t=i,i=e}X0(n,!0,t,null,s);break;case"together":X0(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function ih(e,n){!(n.mode&1)&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function js(e,n,t){if(e!==null&&(n.dependencies=e.dependencies),Ca|=n.lanes,!(t&n.childLanes))return null;if(e!==null&&n.child!==e.child)throw Error(we(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 fI(e,n,t){switch(n.tag){case 3:Eb(n),Nl();break;case 5:K3(n);break;case 1:Wr(n.type)&&Rh(n);break;case 4:hg(n,n.stateNode.containerInfo);break;case 10:var r=n.type._context,i=n.memoizedProps.value;zt(Uh,r._currentValue),r._currentValue=i;break;case 13:if(r=n.memoizedState,r!==null)return r.dehydrated!==null?(zt(on,on.current&1),n.flags|=128,null):t&n.child.childLanes?bb(e,n,t):(zt(on,on.current&1),e=js(e,n,t),e!==null?e.sibling:null);zt(on,on.current&1);break;case 19:if(r=(t&n.childLanes)!==0,e.flags&128){if(r)return Cb(e,n,t);n.flags|=128}if(i=n.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),zt(on,on.current),r)break;return null;case 22:case 23:return n.lanes=0,vb(e,n,t)}return js(e,n,t)}var Sb,R_,Tb,wb;Sb=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}};R_=function(){};Tb=function(e,n,t,r){var i=e.memoizedProps;if(i!==r){e=n.stateNode,ta(hs.current);var s=null;switch(t){case"input":i=t_(e,i),r=t_(e,r),s=[];break;case"select":i=ln({},i,{value:void 0}),r=ln({},r,{value:void 0}),s=[];break;case"textarea":i=i_(e,i),r=i_(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Oh)}o_(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"&&(hc.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"&&(hc.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Vt("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)}};wb=function(e,n,t,r){t!==r&&(n.flags|=4)};function su(e,n){if(!en)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 br(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 pI(e,n,t){var r=n.pendingProps;switch(sg(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return br(n),null;case 1:return Wr(n.type)&&kh(),br(n),null;case 3:return r=n.stateNode,Al(),Kt(qr),Kt(Nr),pg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(md(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&!(n.flags&256)||(n.flags|=1024,$i!==null&&(B_($i),$i=null))),R_(e,n),br(n),null;case 5:fg(n);var i=ta(Tc.current);if(t=n.type,e!==null&&n.stateNode!=null)Tb(e,n,t,r,i),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!r){if(n.stateNode===null)throw Error(we(166));return br(n),null}if(e=ta(hs.current),md(n)){r=n.stateNode,t=n.type;var s=n.memoizedProps;switch(r[is]=n,r[Cc]=s,e=(n.mode&1)!==0,t){case"dialog":Vt("cancel",r),Vt("close",r);break;case"iframe":case"object":case"embed":Vt("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[is]=n,e[Cc]=r,Sb(e,n,!1,!1),n.stateNode=e;e:{switch(o=a_(t,r),t){case"dialog":Vt("cancel",e),Vt("close",e),i=r;break;case"iframe":case"object":case"embed":Vt("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=Hh(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&&!en)return br(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=on.current,zt(on,r?t&1|2:t&1),n):(br(n),null);case 22:case 23:return wg(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?ti&1073741824&&(br(n),n.subtreeFlags&6&&(n.flags|=8192)):br(n),null;case 24:return null;case 25:return null}throw Error(we(156,n.tag))}function _I(e,n){switch(sg(n),n.tag){case 1:return Wr(n.type)&&kh(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Al(),Kt(qr),Kt(Nr),pg(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return fg(n),null;case 13:if(Kt(on),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(we(340));Nl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Kt(on),null;case 4:return Al(),null;case 10:return ug(n.type._context),null;case 22:case 23:return wg(),null;case 24:return null;default:return null}}var yd=!1,Sr=!1,mI=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function ul(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){_n(e,n,r)}else t.current=null}function L_(e,n,t){try{t()}catch(r){_n(e,n,r)}}var x2=!1;function gI(e,n){if(g_=Ah,e=x3(),rg(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(v_={focusedElem:e,selectionRange:t},Ah=!1,Fe=n;Fe!==null;)if(n=Fe,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Fe=e;else for(;Fe!==null;){n=Fe;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,g=n.stateNode,_=g.getSnapshotBeforeUpdate(n.elementType===n.type?m:ji(n.type,m),b);g.__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(we(163))}}catch(S){_n(n,n.return,S)}if(e=n.sibling,e!==null){e.return=n.return,Fe=e;break}Fe=n.return}return p=x2,x2=!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&&L_(n,t,s)}i=i.next}while(i!==r)}}function Hf(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 D_(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 Nb(e){var n=e.alternate;n!==null&&(e.alternate=null,Nb(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[is],delete n[Cc],delete n[b_],delete n[JN],delete n[eI])),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 Ib(e){return e.tag===5||e.tag===3||e.tag===4}function O2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ib(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 U_(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=Oh));else if(r!==4&&(e=e.child,e!==null))for(U_(e,n,t),e=e.sibling;e!==null;)U_(e,n,t),e=e.sibling}function P_(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(P_(e,n,t),e=e.sibling;e!==null;)P_(e,n,t),e=e.sibling}var cr=null,Bi=!1;function qs(e,n,t){for(t=t.child;t!==null;)Ab(e,n,t),t=t.sibling}function Ab(e,n,t){if(ds&&typeof ds.onCommitFiberUnmount=="function")try{ds.onCommitFiberUnmount(Of,t)}catch{}switch(t.tag){case 5:Sr||ul(t,n);case 6:var r=cr,i=Bi;cr=null,qs(e,n,t),cr=r,Bi=i,cr!==null&&(Bi?(e=cr,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):cr.removeChild(t.stateNode));break;case 18:cr!==null&&(Bi?(e=cr,t=t.stateNode,e.nodeType===8?V0(e.parentNode,t):e.nodeType===1&&V0(e,t),gc(e)):V0(cr,t.stateNode));break;case 4:r=cr,i=Bi,cr=t.stateNode.containerInfo,Bi=!0,qs(e,n,t),cr=r,Bi=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)&&L_(t,n,o),i=i.next}while(i!==r)}qs(e,n,t);break;case 1:if(!Sr&&(ul(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){_n(t,n,a)}qs(e,n,t);break;case 21:qs(e,n,t);break;case 22:t.mode&1?(Sr=(r=Sr)||t.memoizedState!==null,qs(e,n,t),Sr=r):qs(e,n,t);break;default:qs(e,n,t)}}function k2(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new mI),n.forEach(function(r){var i=NI.bind(null,e,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Li(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*yI(r/1960))-r,10e?16:e,ao===null)var r=!1;else{if(e=ao,ao=null,zh=0,pt&6)throw Error(we(331));var i=pt;for(pt|=4,Fe=e.current;Fe!==null;){var s=Fe,o=s.child;if(Fe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lMn()-Sg?da(e,0):Cg|=t),Kr(e,n)}function Ub(e,n){n===0&&(e.mode&1?(n=cd,cd<<=1,!(cd&130023424)&&(cd=4194304)):n=1);var t=Dr();e=Hs(e,n),e!==null&&(Gc(e,n,t),Kr(e,t))}function wI(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Ub(e,t)}function NI(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(we(314))}r!==null&&r.delete(n),Ub(e,t)}var Pb;Pb=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,fI(e,n,t);Vr=!!(e.flags&131072)}else Vr=!1,en&&n.flags&1048576&&B3(n,Dh,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;ih(e,n),e=n.pendingProps;var i=wl(n,Nr.current);El(n,t),i=mg(null,n,r,e,i,t);var s=gg();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,Rh(n)):s=!1,n.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,dg(n),i.updater=Ff,n.stateNode=i,i._reactInternals=n,I_(n,r,e,t),n=x_(null,n,r,!0,s,t)):(n.tag=0,en&&s&&ig(n),xr(null,n,i,t),n=n.child),n;case 16:r=n.elementType;e:{switch(ih(e,n),e=n.pendingProps,i=r._init,r=i(r._payload),n.type=r,i=n.tag=AI(r),e=ji(r,e),i){case 0:n=M_(null,n,r,e,t);break e;case 1:n=I2(null,n,r,e,t);break e;case 11:n=w2(null,n,r,e,t);break e;case 14:n=N2(null,n,r,ji(r.type,e),t);break e}throw Error(we(306,r,""))}return n;case 0:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),M_(e,n,r,i,t);case 1:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),I2(e,n,r,i,t);case 3:e:{if(Eb(n),e===null)throw Error(we(387));r=n.pendingProps,s=n.memoizedState,i=s.element,W3(e,n),Fh(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(we(423)),n),n=A2(e,n,r,t,i);break e}else if(r!==i){i=Ml(Error(we(424)),n),n=A2(e,n,r,t,i);break e}else for(ai=_o(n.stateNode.containerInfo.firstChild),ui=n,en=!0,$i=null,t=V3(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Nl(),r===i){n=js(e,n,t);break e}xr(e,n,r,t)}n=n.child}return n;case 5:return K3(n),e===null&&T_(n),r=n.type,i=n.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,y_(r,i)?o=null:s!==null&&y_(r,s)&&(n.flags|=32),yb(e,n),xr(e,n,o,t),n.child;case 6:return e===null&&T_(n),null;case 13:return bb(e,n,t);case 4:return hg(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:ji(r,i),w2(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,zt(Uh,r._currentValue),r._currentValue=o,s!==null)if(qi(s.value,o)){if(s.children===i.children&&!qr.current){n=js(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=Ls(-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),w_(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(we(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),w_(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,El(n,t),i=Ai(i),r=r(i),n.flags|=1,xr(e,n,r,t),n.child;case 14:return r=n.type,i=ji(r,n.pendingProps),i=ji(r.type,i),N2(e,n,r,i,t);case 15:return gb(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,i=n.pendingProps,i=n.elementType===r?i:ji(r,i),ih(e,n),n.tag=1,Wr(r)?(e=!0,Rh(n)):e=!1,El(n,t),pb(n,r,i),I_(n,r,i,t),x_(null,n,r,!0,e,t);case 19:return Cb(e,n,t);case 22:return vb(e,n,t)}throw Error(we(156,n.tag))};function Fb(e,n){return d3(e,n)}function II(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 wi(e,n,t,r){return new II(e,n,t,r)}function Ig(e){return e=e.prototype,!(!e||!e.isReactComponent)}function AI(e){if(typeof e=="function")return Ig(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qm)return 11;if(e===Wm)return 14}return 2}function yo(e,n){var t=e.alternate;return t===null?(t=wi(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 ah(e,n,t,r,i,s){var o=2;if(r=e,typeof e=="function")Ig(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case el:return ha(t.children,i,s,n);case Vm:o=8,i|=8;break;case Zp:return e=wi(12,t,n,i|2),e.elementType=Zp,e.lanes=s,e;case Xp:return e=wi(13,t,n,i),e.elementType=Xp,e.lanes=s,e;case Jp:return e=wi(19,t,n,i),e.elementType=Jp,e.lanes=s,e;case KE:return Bf(t,i,s,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qE:o=10;break e;case WE:o=9;break e;case qm:o=11;break e;case Wm:o=14;break e;case Xs:o=16,r=null;break e}throw Error(we(130,e==null?e:typeof e,""))}return n=wi(o,t,n,i),n.elementType=e,n.type=r,n.lanes=s,n}function ha(e,n,t,r){return e=wi(7,e,r,n),e.lanes=t,e}function Bf(e,n,t,r){return e=wi(22,e,r,n),e.elementType=KE,e.lanes=t,e.stateNode={isHidden:!1},e}function J0(e,n,t){return e=wi(6,e,null,n),e.lanes=t,e}function ep(e,n,t){return n=wi(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function MI(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=L0(0),this.expirationTimes=L0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=L0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ag(e,n,t,r,i,s,o,a,l){return e=new MI(e,n,t,a,l),n===1?(n=1,s===!0&&(n|=8)):n=0,s=wi(3,null,null,n),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},dg(s),e}function xI(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($b)}catch(e){console.error(e)}}$b(),$E.exports=hi;var Wc=$E.exports;const Gb=Mf(Wc);var j2=Wc;Qp.createRoot=j2.createRoot,Qp.hydrateRoot=j2.hydrateRoot;var zb={exports:{}},xt={};/** @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 ir=typeof Symbol=="function"&&Symbol.for,kg=ir?Symbol.for("react.element"):60103,Rg=ir?Symbol.for("react.portal"):60106,qf=ir?Symbol.for("react.fragment"):60107,Wf=ir?Symbol.for("react.strict_mode"):60108,Kf=ir?Symbol.for("react.profiler"):60114,Qf=ir?Symbol.for("react.provider"):60109,Yf=ir?Symbol.for("react.context"):60110,Lg=ir?Symbol.for("react.async_mode"):60111,Zf=ir?Symbol.for("react.concurrent_mode"):60111,Xf=ir?Symbol.for("react.forward_ref"):60112,Jf=ir?Symbol.for("react.suspense"):60113,DI=ir?Symbol.for("react.suspense_list"):60120,e0=ir?Symbol.for("react.memo"):60115,t0=ir?Symbol.for("react.lazy"):60116,UI=ir?Symbol.for("react.block"):60121,PI=ir?Symbol.for("react.fundamental"):60117,FI=ir?Symbol.for("react.responder"):60118,HI=ir?Symbol.for("react.scope"):60119;function pi(e){if(typeof e=="object"&&e!==null){var n=e.$$typeof;switch(n){case kg:switch(e=e.type,e){case Lg:case Zf:case qf:case Kf:case Wf:case Jf:return e;default:switch(e=e&&e.$$typeof,e){case Yf:case Xf:case t0:case e0:case Qf:return e;default:return n}}case Rg:return n}}}function Vb(e){return pi(e)===Zf}xt.AsyncMode=Lg;xt.ConcurrentMode=Zf;xt.ContextConsumer=Yf;xt.ContextProvider=Qf;xt.Element=kg;xt.ForwardRef=Xf;xt.Fragment=qf;xt.Lazy=t0;xt.Memo=e0;xt.Portal=Rg;xt.Profiler=Kf;xt.StrictMode=Wf;xt.Suspense=Jf;xt.isAsyncMode=function(e){return Vb(e)||pi(e)===Lg};xt.isConcurrentMode=Vb;xt.isContextConsumer=function(e){return pi(e)===Yf};xt.isContextProvider=function(e){return pi(e)===Qf};xt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===kg};xt.isForwardRef=function(e){return pi(e)===Xf};xt.isFragment=function(e){return pi(e)===qf};xt.isLazy=function(e){return pi(e)===t0};xt.isMemo=function(e){return pi(e)===e0};xt.isPortal=function(e){return pi(e)===Rg};xt.isProfiler=function(e){return pi(e)===Kf};xt.isStrictMode=function(e){return pi(e)===Wf};xt.isSuspense=function(e){return pi(e)===Jf};xt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===qf||e===Zf||e===Kf||e===Wf||e===Jf||e===DI||typeof e=="object"&&e!==null&&(e.$$typeof===t0||e.$$typeof===e0||e.$$typeof===Qf||e.$$typeof===Yf||e.$$typeof===Xf||e.$$typeof===PI||e.$$typeof===FI||e.$$typeof===HI||e.$$typeof===UI)};xt.typeOf=pi;zb.exports=xt;var Dg=zb.exports,jI=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;ume)&&(ze=(le=le.replace(" ",":")).length),0ue&&(ue=(ie=ie.trim()).charCodeAt(0)),ue){case 38:return ie.replace(g,"$1"+K.trim());case 58:return K.trim()+ie.replace(g,"$1"+K.trim());default:if(0<1*ee&&0B.charCodeAt(8))break;case 115:P=P.replace(B,"-webkit-"+B)+";"+P;break;case 207:case 102:P=P.replace(B,"-webkit-"+(102ee.charCodeAt(0)&&(ee=ee.trim()),Ce=ee,ee=[Ce],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var n4=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&&Ta(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;ame)&&(ze=(le=le.replace(" ",":")).length),0ue&&(ue=(ie=ie.trim()).charCodeAt(0)),ue){case 38:return ie.replace(g,"$1"+K.trim());case 58:return K.trim()+ie.replace(g,"$1"+K.trim());default:if(0<1*ee&&0B.charCodeAt(8))break;case 115:P=P.replace(B,"-webkit-"+B)+";"+P;break;case 207:case 102:P=P.replace(B,"-webkit-"+(102ee.charCodeAt(0)&&(ee=ee.trim()),Ce=ee,ee=[Ce],01?n-1:0),r=1;r0?" Args: "+t.join(", "):""))}var n4=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&&Ta(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),lh.set(e,n),Kh.set(n,e)},s4="style["+kl+'][data-styled-version="5.3.11"]',o4=new RegExp("^"+kl+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),a4=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=u4();return o&&r.setAttribute("nonce",o),t.insertBefore(r,s),r},c4=function(){function e(t){var r=this.element=Kb(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}(),p4=/(a)(d)/gi,K2=function(e){return String.fromCharCode(e+(e>25?39:97))};function G_(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=K2(n%52)+t;return(K2(n%52)+t).replace(p4,"$1-$2")}var dl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},Yb=function(e){return dl(5381,e)};function _4(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=dl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var g=r(d,"."+b,void 0,i);t.insertRules(i,b,g)}s.push(b)}}return s.join(" ")},e}(),v4=/^\s*\/\/.*$/gm,y4=[":","[",".","#"];function Zb(e){var n,t,r,i,s=e===void 0?yo:e,o=s.options,a=o===void 0?yo:o,l=s.plugins,u=l===void 0?Wh:l,c=new $I(a),d=[],h=function(m){function b(g){if(g)try{m(g+"}")}catch{}}return function(g,_,E,S,w,N,A,k,I,x){switch(g){case 1:if(I===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(k===0)return _+"/*|*/";break;case 3:switch(k){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,g){return b===0&&y4.indexOf(g[t.length])!==-1||g.match(i)?m:"."+n};function p(m,b,g,_){_===void 0&&(_="&");var E=m.replace(v4,""),S=b&&g?g+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(g||!b?"":b,S)}return c.use([].concat(u,[function(m,b,g){m===2&&g.length&&g[0].lastIndexOf(t)>0&&(g[0]=g[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||Ta(15),dl(m,b.name)},5381).toString():"",p}var jg=mt.createContext();jg.Consumer;var Bg=mt.createContext(),E4=(Bg.Consumer,new Qb),z_=Zb();function Xb(){return D.useContext(jg)||E4}function b4(){return D.useContext(Bg)||z_}function C4(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=Xb(),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 Zb({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){BI(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),mt.createElement(jg.Provider,{value:s},mt.createElement(Bg.Provider,{value:o},e.children))}var Jb=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=z_);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 Ta(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=z_),this.name+n.hash},e}(),S4=/([A-Z])/,T4=/([A-Z])/g,w4=/^ms-/,N4=function(e){return"-"+e.toLowerCase()};function Q2(e){return S4.test(e)?e.replace(T4,N4).replace(w4,"-ms-"):e}var Y2=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,M4=/(^-|-$)/g;function tp(e){return e.replace(A4,"-").replace(M4,"")}var eC=function(e){return G_(Yb(e)>>>0)};function Sd(e){return typeof e=="string"&&!0}var V_=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},x4=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function O4(e,n,t){var r=e[t];V_(n)&&V_(r)?tC(r,n):e[t]=n}function tC(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(x[k]=N[k]);return x}(n,["componentId"]),w=E&&E+"-"+(Sd(_)?_:tp(q2(_)));return nC(_,us({},S,{attrs:h,componentId:w}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?tC({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&e4(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var be=function(e){return function n(t,r,i){if(i===void 0&&(i=yo),!Dg.isValidElementType(r))return Ta(1,String(r));var s=function(){return t(r,i,xo.apply(void 0,arguments))};return s.withConfig=function(o){return n(t,r,us({},i,{},o))},s.attrs=function(o){return n(t,r,us({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},s}(nC,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){be[e]=be(e)});function R4(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=U4(a),a in X2)return;X2[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":D4,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 q_=function(e,n){return q_=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])},q_(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}q_(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 De(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&F4.indexOf(e)>=0},Qh=function(e){return e>0&&H4.indexOf(e)>=0},pr=function(e,n){if(n===void 0&&(n=!1),n&&Kc(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},$4=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=De([],Ae(e),!1).sort(),r=De([],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){R("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){R("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),oC={encrypt:function(e){return e},decrypt:function(e){return e}},e1=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 v(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:De([],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 v(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"})(xc||(xc={}));var Ze,Ni,ss,Ct,tr,Ll,rr,Dn,Wi,ut,t1,K_,Q_,V4=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChatServicePermission",{get:function(){var n;return!!(!((n=this.services)===null||n===void 0)&&n.includes(xc.CHAT))},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),js=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)})},n1=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=js()}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}(),La=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new n1({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new n1({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=pe(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}(),q4=function(){function e(){this._dispatcher=new La}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(){},ye=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},Ie=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=De([],Ae(e),!1),t=0;t"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},r1=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"})(Z_||(Z_={})),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"}(ao||(ao={}));var sA="^(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-]+)*))?$",Yh=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=X_()?ha.REACT_NATIVE:ha.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(Eo.SDK_VERSION),device_os_platform:r1()?"mobile-web":"web",os_version:Eo.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=X_()?"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"]):r1()?"omobile-web":"oweb";return"".concat(t,"/c").concat(Eo.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)}})},Zh=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return T(n,e),n}(Tt),pC=function(e){function n(t){var r=e.call(this)||this;return r.method=Z.DELETE,r.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=ye({mesg_token:t.messageToken})),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var oA=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}(gt),aA=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 tA&&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(Eo.OS_VERSION,",").concat(Eo.SDK_VERSION,",").concat(i).concat(s?",".concat(s):""),"SB-User-Agent":Yh.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":Yh.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 zg(new $t({type:Et.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!==Z.GET&&(t!==Z.DELETE||n instanceof pC)},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,g,_,E,S,w;return v(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,rp(()=>import("./__bundle-f03e97a8-DwihxPbi.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===Te.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,rp(()=>import("./__bundle-2aa1a987-CRzOCkkA.js").then(A=>A._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,rp(()=>import("./__bundle-347d730c-uOi2Djg6.js").then(A=>A._),[])];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(g=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new se(this._iid,g)];if(g){if((_=new L(g)).isSessionExpiredError){if(this._dispatcher.dispatch(new Ul({reason:_.code,message:_.message})),!(n instanceof Gg))return E=new Tr,this._dispatcher.dispatch(new fC({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Ul({reason:_.code,message:_.message})),_}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 Zh({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=pe(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 Zh({}))},e}(),qe=function(){};function Wl(e){let n=e.length;for(;--n>=0;)e[n]=0}const Vg=256,_C=286,Vu=30,qu=15,J_=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]),uh=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]),lA=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ss=new Array(576);Wl(Ss);const Wu=new Array(60);Wl(Wu);const Oc=new Array(512);Wl(Oc);const Ku=new Array(256);Wl(Ku);const qg=new Array(29);Wl(qg);const Xh=new Array(Vu);function ip(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 s1,o1,a1;function sp(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Wl(Xh);const mC=e=>e<256?Oc[e]:Oc[256+(e>>>7)],kc=(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])},gC=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},vC=(e,n,t)=>{const r=new Array(16);let i,s,o=0;for(i=1;i<=qu;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]=gC(r[a]++,a))}},yC=e=>{let n;for(n=0;n<_C;n++)e.dyn_ltree[2*n]=0;for(n=0;n{e.bi_valid>8?kc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},l1=(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?os(e,i,n):(s=Ku[i],os(e,s+Vg+1,n),o=J_[s],o!==0&&(i-=qg[s],zr(e,i,o)),r--,s=mC(r),os(e,s,t),o=uh[s],o!==0&&(r-=Xh[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--)op(e,t,o);l=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],op(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++,op(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,g=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,w,N,A,k,I=0;for(N=0;N<=qu;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=_,I++),h[2*S+1]=N,S>f||(c.bl_count[N]++,A=0,S>=g&&(A=b[S-g]),k=h[2*S],c.opt_len+=k*(N+A),m&&(c.static_len+=k*(p[2*S+1]+A)));if(I!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,I-=2}while(I>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),vC(t,u,e.bl_count)},c1=(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),EC(e),kc(e,t),kc(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var uA=(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{let l;for(c1(a,a.dyn_ltree,a.l_desc.max_code),c1(a,a.dyn_dtree,a.d_desc.max_code),ap(a,a.bl_desc),l=18;l>=3&&a.bl_tree[2*i1[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?bC(e,n,t,r):e.strategy===4||s===i?(zr(e,2+(r?1:0),3),u1(e,Ss,Wu)):(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{h1||((()=>{let n,t,r,i,s;const o=new Array(16);for(r=0,i=0;i<28;i++)for(qg[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*(Ku[t]+Vg+1)]++,e.dyn_dtree[2*mC(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{zr(e,2,3),os(e,256,Ss),(n=>{n.bi_valid===16?(kc(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)}},Qu=(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 dA=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 Xn=(e,n,t,r)=>{const i=dA,s=r+t;e^=-1;for(let o=r;o>>8^i[255&(e^n[o])];return~e},wa={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"},Da={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:hA,_tr_stored_block:em,_tr_flush_block:fA,_tr_tally:bo,_tr_align:pA}=cA,{Z_NO_FLUSH:Co,Z_PARTIAL_FLUSH:_A,Z_FULL_FLUSH:mA,Z_FINISH:Ci,Z_BLOCK:f1,Z_OK:lr,Z_STREAM_END:p1,Z_STREAM_ERROR:es,Z_DATA_ERROR:gA,Z_BUF_ERROR:lp,Z_DEFAULT_COMPRESSION:vA,Z_FILTERED:yA,Z_HUFFMAN_ONLY:Td,Z_RLE:EA,Z_FIXED:bA,Z_DEFAULT_STRATEGY:CA,Z_UNKNOWN:SA,Z_DEFLATED:Jh}=Da,na=258,fs=262,Cl=42,Wo=113,wu=666,Ko=(e,n)=>(e.msg=wa[n],n),_1=e=>2*e-(e>4?9:0),ro=e=>{let n=e.length;for(;--n>=0;)e[n]=0},TA=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 So=(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))},ri=(e,n)=>{fA(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,ei(e.strm)},yt=(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},tm=(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=Qu(e.adler,n,i,t):e.state.wrap===2&&(e.adler=Xn(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},CC=(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-fs?e.strstart-(e.w_size-fs):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},hl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-fs)&&(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),TA(e),r+=n),e.strm.avail_in===0)break;if(t=tm(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=So(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=So(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{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,ei(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&&(tm(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&&(tm(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===Ci)&&n!==Co&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,o=n===Ci&&e.strm.avail_in===0&&t===r?1:0,em(e,e.block_start,t,o),e.block_start+=t,ei(e.strm)),o?3:1)},up=(e,n)=>{let t,r;for(;;){if(e.lookahead=3&&(e.ins_h=So(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-fs&&(e.match_length=CC(e,t)),e.match_length>=3)if(r=bo(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=So(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=So(e,e.ins_h,e.window[e.strstart+1]);else r=bo(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(ri(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Ci?(ri(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ri(e,!1),e.strm.avail_out===0)?1:2},qa=(e,n)=>{let t,r,i;for(;;){if(e.lookahead=3&&(e.ins_h=So(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=bo(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=So(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&&(ri(e,!1),e.strm.avail_out===0))return 1}else if(e.match_available){if(r=bo(e,0,e.window[e.strstart-1]),r&&ri(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=bo(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,n===Ci?(ri(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ri(e,!1),e.strm.avail_out===0)?1:2};function Xi(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 Xi(0,0,0,0,SC),new Xi(4,4,8,4,up),new Xi(4,5,16,8,up),new Xi(4,6,32,32,up),new Xi(4,4,16,16,qa),new Xi(8,16,32,32,qa),new Xi(8,16,128,128,qa),new Xi(8,32,128,256,qa),new Xi(32,128,258,1024,qa),new Xi(32,258,258,4096,qa)];function wA(){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=Jh,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),ro(this.dyn_ltree),ro(this.dyn_dtree),ro(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),ro(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ro(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!==Cl&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Wo&&n.status!==wu?1:0},TC=e=>{if(Iu(e))return Ko(e,es);e.total_in=e.total_out=0,e.data_type=SA;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?Cl:Wo,e.adler=n.wrap===2?0:1,n.last_flush=-2,hA(n),lr},wC=e=>{const n=TC(e);var t;return n===lr&&((t=e.state).window_size=2*t.w_size,ro(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},m1=(e,n,t,r,i,s)=>{if(!e)return es;let o=1;if(n===vA&&(n=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||t!==Jh||r<8||r>15||n<0||n>9||s<0||s>bA||r===8&&o!==1)return Ko(e,es);r===8&&(r=9);const a=new wA;return e.state=a,a.strm=e,a.status=Cl,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<m1(e,n,Jh,15,8,CA),deflateInit2:m1,deflateReset:wC,deflateResetKeep:TC,deflateSetHeader:(e,n)=>Iu(e)||e.state.wrap!==2?es:(e.state.gzhead=n,lr),deflate:(e,n)=>{if(Iu(e)||n>f1||n<0)return e?Ko(e,es):es;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===wu&&n!==Ci)return Ko(e,e.avail_out===0?lp:es);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(ei(e),e.avail_out===0)return t.last_flush=-1,lr}else if(e.avail_in===0&&_1(n)<=_1(r)&&n!==Ci)return Ko(e,lp);if(t.status===wu&&e.avail_in!==0)return Ko(e,lp);if(t.status===Cl&&t.wrap===0&&(t.status=Wo),t.status===Cl){let i=Jh+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Td||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,ei(e),t.pending!==0)return t.last_flush=-1,lr}if(t.status===57){if(e.adler=0,yt(t,31),yt(t,139),yt(t,8),t.gzhead)yt(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)),yt(t,255&t.gzhead.time),yt(t,t.gzhead.time>>8&255),yt(t,t.gzhead.time>>16&255),yt(t,t.gzhead.time>>24&255),yt(t,t.level===9?2:t.strategy>=Td||t.level<2?4:0),yt(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(yt(t,255&t.gzhead.extra.length),yt(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=Xn(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(yt(t,0),yt(t,0),yt(t,0),yt(t,0),yt(t,0),yt(t,t.level===9?2:t.strategy>=Td||t.level<2?4:0),yt(t,3),t.status=Wo,ei(e),t.pending!==0)return t.last_flush=-1,lr}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=Xn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=a,ei(e),t.pending!==0)return t.last_flush=-1,lr;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=Xn(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=Xn(e.adler,t.pending_buf,t.pending-s,s)),ei(e),t.pending!==0)return t.last_flush=-1,lr;s=0}i=t.gzindexs&&(e.adler=Xn(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=Xn(e.adler,t.pending_buf,t.pending-s,s)),ei(e),t.pending!==0)return t.last_flush=-1,lr;s=0}i=t.gzindexs&&(e.adler=Xn(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&&(ei(e),t.pending!==0))return t.last_flush=-1,lr;yt(t,255&e.adler),yt(t,e.adler>>8&255),e.adler=0}if(t.status=Wo,ei(e),t.pending!==0)return t.last_flush=-1,lr}if(e.avail_in!==0||t.lookahead!==0||n!==Co&&t.status!==wu){let i=t.level===0?SC(t,n):t.strategy===Td?((s,o)=>{let a;for(;;){if(s.lookahead===0&&(hl(s),s.lookahead===0)){if(o===Co)return 1;break}if(s.match_length=0,a=bo(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,a&&(ri(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Ci?(ri(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ri(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===EA?((s,o)=>{let a,l,u,c;const d=s.window;for(;;){if(s.lookahead<=na){if(hl(s),s.lookahead<=na&&o===Co)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=bo(s,1,s.match_length-3),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(a=bo(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),a&&(ri(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Ci?(ri(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ri(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),lr;if(i===2&&(n===_A?pA(t):n!==f1&&(em(t,0,0,!1),n===mA&&(ro(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),ei(e),e.avail_out===0))return t.last_flush=-1,lr}return n!==Ci?lr:t.wrap<=0?p1:(t.wrap===2?(yt(t,255&e.adler),yt(t,e.adler>>8&255),yt(t,e.adler>>16&255),yt(t,e.adler>>24&255),yt(t,255&e.total_in),yt(t,e.total_in>>8&255),yt(t,e.total_in>>16&255),yt(t,e.total_in>>24&255)):(lu(t,e.adler>>>16),lu(t,65535&e.adler)),ei(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?lr:p1)},deflateEnd:e=>{if(Iu(e))return es;const n=e.state.status;return e.state=null,n===Wo?Ko(e,gA):lr},deflateSetDictionary:(e,n)=>{let t=n.length;if(Iu(e))return es;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Cl||r.lookahead)return es;if(i===1&&(e.adler=Qu(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(ro(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,hl(r);r.lookahead>=3;){let l=r.strstart,u=r.lookahead-2;do r.ins_h=So(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,hl(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,lr},deflateInfo:"pako deflate (from Nodeca project)"};const NA=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var n0={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)NA(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;Rc[254]=Rc[254]=1;var Lc={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&&NC)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+Rc[e[t]]>n?t:n}},IC=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 AC=Object.prototype.toString,{Z_NO_FLUSH:IA,Z_SYNC_FLUSH:AA,Z_FULL_FLUSH:MA,Z_FINISH:xA,Z_OK:ef,Z_STREAM_END:OA,Z_DEFAULT_COMPRESSION:kA,Z_DEFAULT_STRATEGY:RA,Z_DEFLATED:LA}=Da;function Zu(e){this.options=n0.assign({level:kA,method:LA,chunkSize:16384,windowBits:15,memLevel:8,strategy:RA},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 IC,this.strm.avail_out=0;let t=Yu.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==ef)throw new Error(wa[t]);if(n.header&&Yu.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?Lc.string2buf(n.dictionary):AC.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=Yu.deflateSetDictionary(this.strm,r),t!==ef)throw new Error(wa[t]);this._dict_set=!0}}function cp(e,n){const t=new Zu(n);if(t.push(e,!0),t.err)throw t.msg||wa[t.err];return t.result}Zu.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?xA:IA,typeof e=="string"?t.input=Lc.string2buf(e):AC.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===AA||s===MA)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=Yu.deflate(t,s),i===OA)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Yu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ef;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},Zu.prototype.onData=function(e){this.chunks.push(e)},Zu.prototype.onEnd=function(e){e===ef&&(this.result=n0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var DA={Deflate:Zu,deflate:cp,deflateRaw:function(e,n){return(n=n||{}).raw=!0,cp(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,cp(e,n)},constants:Da};const wd=16209;var UA=function(e,n){let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I;const x=e.state;t=e.next_in,k=e.input,r=t+(e.avail_in-5),i=e.next_out,I=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)I[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=wd;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=k[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=wd;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=wd;break e}if(N=0,A=d,c===0){if(N+=l-E,E2;)I[i++]=A[N++],I[i++]=A[N++],I[i++]=A[N++],S-=3;S&&(I[i++]=A[N++],S>1&&(I[i++]=A[N++]))}else{N=i-w;do I[i++]=I[N++],I[i++]=I[N++],I[i++]=I[N++],S-=3;while(S>2);S&&(I[i++]=I[N++],S>1&&(I[i++]=I[N++]))}break}if(64&E){e.msg="invalid distance code",x.mode=wd;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,g=0,_=0,E=0,S=0,w=0,N=0,A=0,k=0,I=null;const x=new Uint16Array(16),U=new Uint16Array(16);let z,H,W,Q=null;for(m=0;m<=Nd;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(g=1;g<_&&x[g]===0;g++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&A>592)return 1;for(;;){z=m-w,o[b]+1=p?(H=Q[o[b]-p],W=I[o[b]-p]):(H=96,W=0),u=1<>w)+c]=z<<24|H<<16|W;while(c!==0);for(u=1<>=1;if(u!==0?(k&=u-1,k+=u):k=0,b++,--x[m]==0){if(m===_)break;m=n[t+o[b]]}if(m>E&&(k&h)!==d){for(w===0&&(w=E),f+=g,S=m-w,N=1<852||e===2&&A>592)return 1;d=k&h,i[d]=E<<24|S<<16|f-s}}return k!==0&&(i[f+k]=m-w<<24|64<<16),a.bits=E,0};const{Z_FINISH:g1,Z_BLOCK:BA,Z_TREES:Id,Z_OK:Qo,Z_STREAM_END:$A,Z_NEED_DICT:GA,Z_STREAM_ERROR:yi,Z_DATA_ERROR:v1,Z_MEM_ERROR:y1,Z_BUF_ERROR:zA,Z_DEFLATED:E1}=Da,r0=16180,Ad=16190,vs=16191,dp=16192,hp=16194,Md=16199,xd=16200,fp=16206,Zt=16209,b1=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function VA(){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},MC=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=r0,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},xC=e=>{if(ra(e))return yi;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,MC(e)},OC=(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,xC(e))},C1=(e,n)=>{if(!e)return yi;const t=new VA;e.state=t,t.strm=e,t.window=null,t.mode=r0;const r=OC(e,n);return r!==Qo&&(e.state=null),r};let pp,_p,S1=!0;const qA=e=>{if(S1){pp=new Int32Array(512),_p=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(Xu(1,e.lens,0,288,pp,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Xu(2,e.lens,0,32,_p,0,e.work,{bits:5}),S1=!1}e.lencode=pp,e.lenbits=9,e.distcode=_p,e.distbits=5},T1=(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.whaveC1(e,15),inflateInit2:C1,inflate:(e,n)=>{let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k=0;const I=new Uint8Array(4);let x,U;const z=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===vs&&(t.mode=dp),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,A=Qo;e:for(;;)switch(t.mode){case r0:if(t.wrap===0){t.mode=dp;break}for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Xn(t.check,I,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=Zt;break}if((15&u)!==E1){e.msg="unknown compression method",t.mode=Zt;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=Zt;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(I[0]=255&u,I[1]=u>>>8&255,t.check=Xn(t.check,I,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,I[2]=u>>>16&255,I[3]=u>>>24&255,t.check=Xn(t.check,I,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&&(I[0]=255&u,I[1]=u>>>8&255,t.check=Xn(t.check,I,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=Xn(t.check,I,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=Xn(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=vs;break;case 16189:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=fp;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(qA(t),t.mode=Md,n===Id){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=Zt}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=Zt;break}if(t.length=65535&u,u=0,c=0,t.mode=hp,n===Id)break e;case hp: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=vs;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=Zt;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[z[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,x={bits:t.lenbits},A=Xu(0,t.lens,0,19,t.lencode,0,t.work,x),t.lenbits=x.bits,A){e.msg="invalid code lengths set",t.mode=Zt;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,g=k>>>16&255,_=65535&k,!(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=Zt;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=Zt;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===Zt)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=Zt;break}if(t.lenbits=9,x={bits:t.lenbits},A=Xu(1,t.lens,0,t.nlen,t.lencode,0,t.work,x),t.lenbits=x.bits,A){e.msg="invalid literal/lengths set",t.mode=Zt;break}if(t.distbits=6,t.distcode=t.distdyn,x={bits:t.distbits},A=Xu(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,x),t.distbits=x.bits,A){e.msg="invalid distances set",t.mode=Zt;break}if(t.mode=Md,n===Id)break e;case Md:t.mode=xd;case xd: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,UA(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===vs&&(t.back=-1);break}for(t.back=0;k=t.lencode[u&(1<>>24,g=k>>>16&255,_=65535&k,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=k>>>24,g=k>>>16&255,_=65535&k,!(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=_,g===0){t.mode=16205;break}if(32&g){t.back=-1,t.mode=vs;break}if(64&g){e.msg="invalid literal/length code",t.mode=Zt;break}t.extra=15&g,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(;k=t.distcode[u&(1<>>24,g=k>>>16&255,_=65535&k,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=k>>>24,g=k>>>16&255,_=65535&k,!(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&g){e.msg="invalid distance code",t.mode=Zt;break}t.offset=_,t.extra=15&g,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=Zt;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=Zt;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=xd);break;case 16205:if(l===0)break e;i[o++]=t.length,l--,t.mode=xd;break;case fp: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!==Ad?yi:r.mode===Ad&&(i=1,i=Qu(i,n,t,0),i!==r.check)?v1:(s=T1(e,n,t,t),s?(r.mode=16210,y1):(r.havedict=1,Qo)))},inflateInfo:"pako inflate (from Nodeca project)"},WA=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 kC=Object.prototype.toString,{Z_NO_FLUSH:KA,Z_FINISH:QA,Z_OK:Ju,Z_STREAM_END:mp,Z_NEED_DICT:gp,Z_STREAM_ERROR:YA,Z_DATA_ERROR:w1,Z_MEM_ERROR:ZA}=Da;function ec(e){this.options=n0.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 IC,this.strm.avail_out=0;let t=Is.inflateInit2(this.strm,n.windowBits);if(t!==Ju)throw new Error(wa[t]);if(this.header=new WA,Is.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Lc.string2buf(n.dictionary):kC.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Is.inflateSetDictionary(this.strm,n.dictionary),t!==Ju)))throw new Error(wa[t])}function vp(e,n){const t=new ec(n);if(t.push(e),t.err)throw t.msg||wa[t.err];return t.result}ec.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?QA:KA,kC.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=Is.inflate(t,o),s===gp&&i&&(s=Is.inflateSetDictionary(t,i),s===Ju?s=Is.inflate(t,o):s===w1&&(s=gp));t.avail_in>0&&s===mp&&t.state.wrap>0&&e[t.next_in]!==0;)Is.inflateReset(t),s=Is.inflate(t,o);switch(s){case YA:case w1:case gp:case ZA:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===mp))if(this.options.to==="string"){let l=Lc.utf8border(t.output,t.next_out),u=t.next_out-l,c=Lc.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!==Ju||a!==0){if(s===mp)return s=Is.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},ec.prototype.onData=function(e){this.chunks.push(e)},ec.prototype.onEnd=function(e){e===Ju&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var XA={Inflate:ec,inflate:vp,inflateRaw:function(e,n){return(n=n||{}).raw=!0,vp(e,n)},ungzip:vp,constants:Da};const{Deflate:JA,deflate:e6,deflateRaw:t6,gzip:n6}=DA,{Inflate:r6,inflate:i6,inflateRaw:s6,ungzip:o6}=XA;var as,a6={Deflate:JA,deflate:e6,deflateRaw:t6,gzip:n6,Inflate:r6,inflate:i6,inflateRaw:s6,ungzip:o6,constants:Da},N1=function(e){return y(void 0,void 0,void 0,function(){var n;return v(this,function(t){return n=a6.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(as||(as={}));var rt,l6=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===as.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return as.CONNECTING;case 1:return as.OPEN}return as.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=gt.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 v(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 v(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,N1(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,N1(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!==as.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}(La),RC=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),u6=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 aA(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this.websocketClient=new l6(n,{sdkState:i,dispatcher:s,logger:o}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new RC(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 v(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 v(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 v(this,function(t){switch(t.label){case 0:return n instanceof J?[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"})(rt||(rt={}));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),LC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),nm=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),DC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),I1=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 ye(Ie({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),Wg=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},A1=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 ye(Ie({last_updated_at:n.lastUpdatedAt}))},e}(),M1=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return ye(Ie({template_list_token:n.token}))},e}(),Od=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 ye(Ie({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}(),yp=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 Od(n.default),this.realTime=new Od(n.realtime)}return e.payloadify=function(n){return ye(Ie({default:Od.payloadify(n.default),realtime:Od.payloadify(n.realTime)}))},e}(),x1=1048576,c6=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 O1=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*x1: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 A1((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new I1(n.notifications):null,this.messageTemplateInfo=n.message_template?new M1(n.message_template):null,this.statConfigInfo=n.log_publish_config?new yp(n.log_publish_config):new yp}return e.payloadify=function(n){return ye(Ie({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/x1,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?A1.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?I1.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?M1.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?yp.payloadify(n.statConfigInfo):null}))},e}(),Kn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),d6=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(r,"/metadata"),s.params={metadata:i},s}return T(n,e),n}(J),h6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return T(n,e),n}(se),f6=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Xe,"/").concat(r,"/metadata"),o.params={metadata:i,upsert:s},o}return T(n,e),n}(J),p6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return T(n,e),n}(se),_6=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(r,"/metadata/").concat(i),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var m6=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(r,"/metadata"),i}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var fl,Qc=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},Y=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"})(fl||(fl={}));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=fl.NON_AVAILABLE,$e(fl,r.is_online)?b.connectionStatus=r.is_online:R("boolean",r.is_online)&&(b.connectionStatus=r.is_online?fl.ONLINE:fl.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?De([],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 ye(Ie(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 Qc(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 R("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 v(this,function(u){switch(u.label){case 0:return Y(this._isValidMetaData(t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new d6({userId:i.userId,metadata:t}),[4,s.send(o)];case 1:return a=u.sent(),l=a.as(h6).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 v(this,function(c){switch(c.label){case 0:return Y(this._isValidMetaData(t)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new f6({userId:s.userId,metadata:t,upsert:r}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(p6).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 v(this,function(l){switch(l.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new _6({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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new m6({userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.metaData={},[2]}})})},n}(Kn),UC=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),rm=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 O1(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 ye(Ie(M(M(M({},Ke.payloadify(n.user)),O1.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 UC({userProfile:this}))},e}(),PC=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),ch=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 rm(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 v(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 PC({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}(gt),Ua=function(){function e(){this.type=rt.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return v(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return v(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 v(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e.prototype.onLogout=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e}(),Re=function(e){return y(void 0,void 0,void 0,function(){var n;return v(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]}})})},kt=function(e){return y(void 0,void 0,void 0,function(){return v(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]}})})},To=function(e){function n(t){t===void 0&&(t={});var r,i=this;return(i=e.call(this)||this).type=rt.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 v(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 Kg,r)];case 2:return o.sent(),this._wasPreviouslyConnected&&Re(function(){return y(s,void 0,void 0,function(){return v(this,function(a){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(Ua),i0=function(e){function n(){var t=e.call(this)||this;return t.type=rt.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return v(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 v(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new o0({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 v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new nf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new To,r)];case 1:return i.sent(),[2]}})})},n}(Ua),tf=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=rt.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 v(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 nf,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 v(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new o0({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 v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new nf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new i0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new To,r)];case 1:return i.sent(),[2]}})})},n}(Ua),Or=function(e){return y(void 0,void 0,void 0,function(){return v(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},FC=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),s0=function(e,n,t){return t===void 0&&(t=new FC),y(void 0,void 0,void 0,function(){var r,i,s,o,a,l;return v(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 v(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,message:r.error.message})),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=Yh.userAgentWithExtension(a);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(Eo.OS_VERSION),"&sv=").concat(encodeURIComponent(Eo.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(Yh.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(jC))).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 zg(new $t({type:Et.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 v(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(ch.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return v(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 v(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}(La),BC=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=Z.POST,h.params=ye({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(jC),uikit_config:a,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return T(n,e),n}(J),b6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new ch(t,"LOGI",r),i}return T(n,e),n}(se);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(Js||(Js={}));var Ht,R1,C6=[Gg,BC],S6=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=rt.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new u6(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;if(c instanceof _i){var p=c.stateType;switch(u._currentConnectionStateType=p,p){case rt.CONNECTED:u._resolveLazyCallQueue();break;case rt.INITIALIZED:case rt.INTERNAL_DISCONNECTED:case rt.EXTERNAL_DISCONNECTED:case rt.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof LC)u._session.hasChatServicePermission||u._resolveLazyCallQueue(Js.API);else if(c instanceof nm||c instanceof DC)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof fC){var m=c.request,b=c.deferred,g=c.error;try{for(var _=pe(C6),E=_.next();!E.done;E=_.next())if(m instanceof E.value)return void b.reject(g)}catch(S){d={error:S}}finally{try{E&&!E.done&&(h=_.return)&&h.call(_)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:m,deferred:b})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===rt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===rt.CONNECTING||this._currentConnectionStateType===rt.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case Js.ALL:t=null;break;case Js.WEBSOCKET:t=wr;break;case Js.API:t=J}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=Js.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 v(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=Js.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 v(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 v(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 J?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 v(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof wr||n instanceof J?[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}(),Ep="sendbird@devicetokens",bp=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 ye(Ie({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),Cp=new WeakMap,T6=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=rt.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 if(h instanceof Ul&&d.handler&&!d.isSessionKeyRefreshing){if(d._currentConnectionStateType===rt.CONNECTING)return;!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(g){if(Lr(g)&&d._sdkState.appState==="foreground")throw g}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(g){if(Lr(g)&&d._sdkState.appState==="foreground")throw g})))}}),d}return T(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return Cp.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 nA({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 v(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(iA),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 v(this,function(s){switch(s.label){case 0:return r=new Gg({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,s0(function(o){return y(i,void 0,void 0,function(){var a,l,u,c,d;return v(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(rA),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 v(this,function(o){switch(o.label){case 0:if(this._currentConnectionStateType!==rt.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),Re(function(){return y(r,void 0,void 0,function(){var u;return v(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 v(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Te.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(),[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 v(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new BC({appId:this._sdkState.appId,userId:t,services:[xc.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(b6).logi).error?[3,4]:this.session.hasChatServicePermission?[3,3]:[4,a.applyTo(this._iid)];case 2:l.sent(),l.label=3;case 3:return[3,5];case 4:throw a.error;case 5: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 v(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,Cp.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(Ep)]:[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 v(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=De([],Ae(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new w6({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=De([],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!==Te.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=Ht.DISABLED,[3,7];case 6:s.code===Te.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=Ht.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 v(this,function(t){switch(t.label){case 0:return n=De(De([],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 $t.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 v(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}($t),N6=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 v(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 $t({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 v(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?Ht.ENABLED:Ht.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ht.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 v(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=ye(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new $t({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 v(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?Ht.ENABLED:Ht.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ht.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 v(this,function(i){switch(i.label){case 0:return this.enabledState===Ht.DISABLED?[2,!0]:(r=this.enabledState===Ht.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===Ht.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}(Qg),M6=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=js(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new N6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new I6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new A6({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 v(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===Et.FEATURE_LOCALCACHE&&t.push(new $t({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 $t.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(o){o.stat_type!==Et.FEATURE_LOCALCACHE&&o.stat_type!==Et.NOTIFICATION&&(o.stat_type===Et.FEATURE_LOCALCACHE_EVENT&&(o.data=M({message_init_policy:"",starting_point:0},o.data)),r.push(new $t({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 $t.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(o){var a;o.stat_type===Et.NOTIFICATION&&(o.data=ye(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 $t({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 $t.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 v(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 v(this,function(d){return i instanceof zg?(s=i.statLog,this.put(s)):i instanceof PC&&(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 v(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 Et.API_RESULT:case Et.WEBSOCKET_CONNECT:return[3,4];case Et.FEATURE_LOCALCACHE:case Et.FEATURE_LOCALCACHE_EVENT:return[3,7];case Et.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=Ht.COLLECT_ONLY,this._defaultStatCollector.enabledState=Ht.COLLECT_ONLY,this._realTimeStatCollector.enabledState=Ht.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"})(rf||(rf={}));var G,x6=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}(Kn),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 sC,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 FC,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 G4({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 aC});this.debugMode=(u=t.debugMode)!==null&&u!==void 0&&u,this.maxSuperGroupChannelUnreadCount=Eo.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 q4,g=new V4;this.requestQueue=new S6(n,{session:g,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new x6(n),this.sessionManager=new T6({_iid:n,session:g,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new g6(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 M6({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}(),Yg=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 Ts=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},bt=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),Zg=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),GC=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),zC=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),VC=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),qC=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),WC=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),Xg=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 O6="removed",im=function(e){switch(e){case"open":return Hl.OPEN;case"closed":return Hl.CLOSED;default:return null}},KC=function(e){return!e||!!e.text&&R("string",e.text)},dh=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 ye(Ie(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}(Kn),xi=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g=this;return(g=e.call(this,t)||this).id=0,g.title=null,g.createdAt=0,g.updatedAt=0,g.closeAt=-1,g.status=Hl.CLOSED,g.messageId=0,g.data=null,g.voterCount=-1,g.options=[],g.createdBy=null,g.allowUserSuggestion=!1,g.allowMultipleVotes=!1,g.votedPollOptionIds=[],g.id=(i=r.id)!==null&&i!==void 0?i:0,g.title=(s=r.title)!==null&&s!==void 0?s:null,g.createdAt=(o=r.created_at)!==null&&o!==void 0?o:0,g.updatedAt=(a=r.updated_at)!==null&&a!==void 0?a:0,g.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,g.status=(u=im(r.status))!==null&&u!==void 0?u:Hl.CLOSED,g.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,g.data=(d=r.data)!==null&&d!==void 0?d:null,g.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,g.options=r.options?r.options.map(function(_){return new dh(g._iid,_)}):[],g.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,g.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,g.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,g.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],g}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=im(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 dh(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 ye(Ie(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 dh.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 Qc(this)},n}(Kn),Do=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 R("number",this.limit)&&this.limit>0},e}(),$s=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)&&R("string",this.channelUrl)&&$e(Ze,this.channelType)},n}(Do),k6=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},R6=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=Z.POST,u.path=Ki,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}(J),L6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),D6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(Ki,"/").concat(encodeURIComponent(s)),o.params={channel_url:r,channel_type:i},o}return T(n,e),n}(J),U6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),P6=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=Z.GET,a.path="".concat(Ki,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o)),a.params={channel_url:r,channel_type:i},a}return T(n,e),n}(J),F6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new dh(t,r),i}return T(n,e),n}(se),H6=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=Z.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),a.params=ye({change_ts:s,token:o}),a}return T(n,e),n}(J),j6=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 xi(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}(se),B6={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},QC=function(e){return R("string",e.title)&&(n=e.optionTexts,We("string",n)&&n.every(function(t){return t.trim()!==""}))&&KC(e.data)&&R("boolean",e.allowUserSuggestion,!0)&&R("boolean",e.allowMultipleVotes,!0)&&R("number",e.closeAt,!0);var n},$6={channelUrl:"",channelType:Ze.BASE,pollId:0,pollOptionId:0},YC=function(e){return R("string",e.channelUrl)&&e.channelUrl!==""&&$e(Ze,e.channelType)&&R("number",e.pollId)&&e.pollId>0&&R("number",e.pollOptionId)&&e.pollOptionId>0},G6={channelUrl:"",channelType:Ze.BASE,pollId:0},ZC=function(e){return R("string",e.channelUrl)&&e.channelUrl!==""&&$e(Ze,e.channelType)&&R("number",e.pollId)},L1={},sf=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,L1[n]=this}return e.of=function(n){return L1[n]},e.prototype.buildPollFromSerializedData=function(n){var t=fa(n);return new xi(this._iid,xi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(ZC(n)).throw(L.invalidParameters),t=new D6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(U6).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(QC(n)).throw(L.invalidParameters),t=new R6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(L6).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(YC(n)).throw(L.invalidParameters),t=new P6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(F6).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 v(this,function(h){switch(h.label){case 0:return s=new H6(Ie({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(j6),l=a.updatedPolls,u=a.deletedPollIds,c=a.hasMore,d=a.nextToken,l.length>0&&this._dispatcher.dispatch(new qC({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),z6=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=Z.GET,a.path=Ki,a.params={channel_url:r,channel_type:i,token:s,limit:o},a}return T(n,e),n}(J),V6=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 xi(t,o)}),s.token=r.next,s}return T(n,e),n}(se),XC=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 v(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 z6(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(V6),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}($s),q6=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=Z.GET,u.path="".concat(Ki,"/").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}(J),W6=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}(se),JC=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)&&R("number",this.pollId)&&R("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 q6(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(W6),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}($s),Dc,Gs=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 ye(Ie(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}(),of=function(e){function n(t){var r=e.call(this)||this;if(r.method=Z.POST,r.path="".concat(W4),r.params=ye({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 ye(Ie(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}(Kn);(function(e){e.ADD="add",e.DELETE="delete"})(Dc||(Dc={}));var eo,Jg=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=R("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&&R("string",t)&&R("string",r)&&$e(Dc,r)&&R("string",i)&&i&&R("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},kd=function(){function e(n){var t,r,i,s=n.key,o=(i=De([],Ae(n.user_ids),!1))!==null&&i!==void 0?i:[],a=n.updated_at;R("string",s)&&s&&We("string",o)&&o.length>0&&R("number",a)&&(this.key=s,this.userIds=o,this.updatedAt=a);var l={};try{for(var u=pe(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 ye(Ie({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 Dc.ADD:t<0&&this.userIds.push(n.userId);break;case Dc.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),D1=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 ye(Ie({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}(),U1=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 D1(n["og:image"]))}return e.payloadify=function(n){return ye(Ie({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?D1.payloadify(n.defaultImage):null}))},e}(),Oi=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 ye(Ie({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(eo||(eo={}));var P1,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 ye(Ie({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=$e(Ni,r.role)?r.role:Ni.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return T(n,e),n.payloadify=function(t){return ye(Ie(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ke),_r=function(){function e(n){this.key=n.key,this.value=We("string",n.value)?De([],Ae(n.value),!1):[]}return e.payloadify=function(n){var t;return ye(Ie({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),eS=function(e){switch(e){case Ct.BASE:return"";case Ct.USER:return"MESG";case Ct.FILE:return"FILE";case Ct.ADMIN:return"ADMM"}},tS=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=Ct.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=$e(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=$e(rr,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 g=0;g0},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 ye(Ie({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return nS.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),nS=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 ye(Ie({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}(),rS=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}(Kn),K6=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=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=ye(Ie({user_id:o,message_ids:a})),r}return T(n,e),n})(J);var iS=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new rS(t,i),s}return T(n,e),n}(gt);(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})(se);var Q6=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),Y6=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=Z.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}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var F1=function(e){function n(t){var r=e.call(this)||this;return r.method=Z.POST,r.path="".concat(sr,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=ye({forms:t.forms}),r}return T(n,e),n}(J),Z6=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=Z.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}(J),X6=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}(se),J6=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=Z.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}(J),eM=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}(se),tM=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=Z.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),a}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new pa(r),i}T(n,e)})(se);var lo,ii,sm=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 Gs(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 ye(Ie({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}(Kn),sS=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"})(lo||(lo={})),function(e){e.PENDING="pending",e.IN_QUEUE="in_queue",e.SENT="sent",e.FAILED="failed",e.CANCELED="canceled",e.REMOVED="removed"}(ii||(ii={}));var oa,hr=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 lf(p._iid,r.thread_info):null,p.reactions=r.reactions?r.reactions.map(function(m){return new kd(m)}):[],p.ogMetaData=r.og_tag?new U1(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 Oi(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=Rd.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(m){return new Rd(p.messageId,m.key,m.fields.map(function(b){return new nS(b)}))}):null,p}return T(n,e),n.payloadify=function(t){var r,i;return ye(Ie(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?lf.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return kd.payloadify(s)}),og_tag:t.ogMetaData?U1.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.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 Rd.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return ye(Ie({type:eS(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 sm.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 v(this,function(r){return(t=O.of(this._iid).dispatcher).dispatch(new sS({channelType:Ze.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new bt({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 v(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new Q6({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 v(this,function(s){switch(s.label){case 0:return r=O.of(this._iid).requestQueue,i=new Y6({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 v(this,function(c){switch(c.label){case 0:if(Y(t.form&&t.form instanceof Rd||R("string",t.formId)&&R("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:Te.INVALID_PARAMETER,message:"The given form is not submittable."});if(a.isSubmitted)throw new L({code:Te.INVALID_PARAMETER,message:"The given form is already submitted."});if(a.messageId!=this.messageId)throw new L({code:Te.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 F1({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 F1({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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new Z6({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(X6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new J6({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(eM),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new bt({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 v(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new tM({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 bt({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(tS),Ft=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&&$e(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 ii.SENT:case ii.IN_QUEUE:l.sendingStatus=ut.SUCCEEDED;break;case ii.PENDING:l.sendingStatus=ut.SCHEDULED;break;case ii.FAILED:case ii.REMOVED:l.sendingStatus=ut.FAILED;break;case ii.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 ye(Ie(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)&&B4(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}(hr),Yc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:tr.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},a0=function(e){return R("number",e.prevResultSize)&&R("number",e.nextResultSize)&&R("boolean",e.isInclusive)&&R("boolean",e.reverse)&&R("string",e.messageTypeFilter)&&$e(tr,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeReactions)&&R("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=Ct.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=yr(t,ye(Ie(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 ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(hr),H1=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&&R("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return ye(Ie({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),j1=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 ye({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),er=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=Ct.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=pe(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 H1(b)}):[],d._poll=r.poll?new xi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=yr(t,ye(Ie(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 j1(r.review_info)),d}return T(n,e),n.payloadify=function(t){return ye(Ie(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 H1.payloadify(r)}),poll:t._poll?xi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?j1.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(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}(Ft),li=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=Ct.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 sm(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=yr(t,ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(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 ye(Ie(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 sm.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}(Ft);(function(e){e.SENT="SENT",e.READ="READ"})(oa||(oa={}));var Na=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=Ct.ADMIN,o.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:oa.SENT,o.priority=(s=r.priority)!==null&&s!==void 0?s:K_.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 ye(Ie(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}(tS),B1=function(e){if(e.notificationId)return Na.payloadify(e);switch(e.messageType){case Ct.USER:return er.payloadify(e);case Ct.FILE:return e.fileInfoList?li.payloadify(e):Jt.payloadify(e);case Ct.ADMIN:return Bl.payloadify(e);default:throw L.unknown}},yr=function(e,n){if(n.notification_message_id)return new Na(e,n);switch(n.type){case"MESG":return new er(e,n);case"FILE":return li._isMultipleFilesMessagePayload(n)?new li(e,n):new Jt(e,n);case"ADMM":case"BRDM":return new Bl(e,n);default:return null}},Jt=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=Ct.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 Gs(_._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=yr(t,ye(Ie(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:(g=S.file)===null||g===void 0?void 0:g.require_auth}))))}return _}return T(n,e),n.payloadify=function(t){var r;return ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Ft),uf=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}(Kn),nM=function(e){function n(t){var r,i,s,o,a=[];return t.mentionType===rr.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:ye(Ie({channel_url:t.channelUrl,files:t.files?aS(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 Gs.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:a,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Wi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.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),rM=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];return t.mentionType===rr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(a){return a.userId}))),s.method=Z.POST,s.path="".concat(Je(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=ye(Ie({message_type:Ct.FILE,user_id:t.userId,files:t.files?aS(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 Gs.payloadify(a)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(a){return _r.payloadify(a)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return T(n,e),n}(J),oS=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 li(t,i):new Jt(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}(gt),iM=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 li(t,r):new Jt(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}(se);function aS(e){return e.map(function(n){var t,r;return ye(Ie({url:uf.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 Gs.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 sM=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===rt.CONNECTED||this._connectionState===rt.CONNECTING||this._connectionState===rt.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return v(this,function(o){switch(o.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new nM(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=o.sent(),[2,s.as(oS).message];case 2:return i=new rM(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=o.sent(),[2,s.as(iM).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 v(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=pe(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===Te.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 v(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],!pr(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 v(this,function(g){switch(g.label){case 0:return a=new of({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(a)];case 1:return l=g.sent(),u=l.as(af),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,g;return v(this,function(_){switch(_.label){case 0:return a=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[a],u=new of({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(af),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,g=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:g,isUploaded:!0}),l instanceof uf||(r.fileInfoList[a]=new uf(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 v(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})]:De([],Ae(s.messageQueue),!1);try{for(var a=pe(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 Zh({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 Zh({requestId:t})))},e}(),om,tc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:tr.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Dn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},$1=function(e){return R("number",e.prevResultSize)&&R("number",e.nextResultSize)&&R("boolean",e.isInclusive)&&R("boolean",e.reverse)&&R("string",e.messageTypeFilter)&&$e(tr,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&$e(Dn,e.replyType)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeReactions)&&R("boolean",e.includeParentMessageInfo)&&R("boolean",e.includeThreadInfo)&&R("boolean",e.showSubchannelMessagesOnly)},am={replyType:Dn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},G1=function(e){return $e(Dn,e.replyType)&&R("boolean",e.includeReactions)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeParentMessageInfo)&&R("boolean",e.includeThreadInfo)},oM=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=Z.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}(J),aM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?yr(t,M({},r)):null,i}return T(n,e),n}(se),Ld=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,g=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,w=t.checkingHasNext,N=t.checkingContinuousMessages,A=e.call(this)||this;return A.method=Z.GET,A.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages"),A.params=ye(Ie({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:g,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})),A}return T(n,e),n}(J),Dd=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 yr(t,s)}),i}return T(n,e),n}(se),lM=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=Z.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}(J),uM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return yr(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}(se),cM=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(sr,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return T(n,e),n}(J),dM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?yr(t,M({},r)):null,i}return T(n,e),n}(se);(function(e){e.MUTED="muted",e.BANNED="banned"})(om||(om={}));var z1=function(){function e(n){var t,r,i,s;this.restrictionType=null,$e(om,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 ye(Ie({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),Pa=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new z1(r),i}return T(n,e),n.payloadify=function(t){return ye(Ie(M(M({},e.payloadify.call(this,t)),z1.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}(),l0={data:void 0,customType:void 0,mentionType:rr.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},u0=function(e){return R("string",e.data,!0)&&R("string",e.customType,!0)&&$e(rr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&R("string",e.mentionedMessageTemplate,!0)&&We(_r,e.metaArrays,!0)&&R("number",e.parentMessageId,!0)&&R("boolean",e.isReplyToChannel)&&$e(Wi,e.pushNotificationDeliveryOption,!0)&&R(Oi,e.appleCriticalAlertOptions,!0)&&R("boolean",e.isPinnedMessage,!0)},V1=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},lS=M(M({},l0),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function uS(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var _a,lm=function(e){var n;return ye(Ie({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}))},cS=function(e){return u0(e)&&R("string",e.message)&&We("string",e.translationTargetLanguages,!0)&&R("number",e.pollId,!0)&&R("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(_a||(_a={}));var hh=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},Sp=function(e){return e===_a.BLOB||e===_a.FILE},q1=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},W1=M(M({},l0),{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 dS(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.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 nc,um=function(e,n){var t;return e.messageParams?(!e.url&&pr(n)&&(e.messageParams.file=n),e.messageParams):ye(Ie({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}})}))},K1=function(e){return u0(e)&&(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return R("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},ev={data:void 0,customType:void 0,mentionType:rr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},tv=function(e){return R("string",e.data,!0)&&R("string",e.customType,!0)&&$e(rr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&R("string",e.mentionedMessageTemplate,!0)&&We(_r,e.metaArrays,!0)&&$e(Wi,e.pushNotificationDeliveryOption,!0)&&R(Oi,e.appleCriticalAlertOptions,!0)},hS=M(M({},ev),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),fS=function(e){return tv(e)&&R("string",e.message,!0)&&We("string",e.translationTargetLanguages,!0)&&R("number",e.pollId,!0)},hM=M({},ev),fM=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=Z.GET,a.path="".concat(Je(i),"/").concat(encodeURIComponent(r),"/operators"),a.params={token:s,limit:o},a}return T(n,e),n}(J),pM=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}(se),_M=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 v(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 fM(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(pM),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}($s),mM=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=tr.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:tr.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)&&R("boolean",this.reverse)&&$e(tr,this.messageTypeFilter)&&$e(Dn,this.replyType)&&We("string",this.customTypesFilter,!0)&&We("string",this.senderUserIdsFilter,!0)&&R("boolean",this.includeMetaArray)&&R("boolean",this.includeReactions)&&R("boolean",this.includeParentMessageInfo)&&R("boolean",this.includeThreadInfo)&&R("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return v(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,Ie({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,De([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}($s),gM=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=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:o,token:a},r}return T(n,e),n}(J),vM=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 Pa(t,a)})),i}return T(n,e),n}(se),yM=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 v(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 gM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(vM),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}($s),EM=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=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=ye({limit:o,token:a}),r}return T(n,e),n}(J),bM=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 Pa(t,a.user)})),i}return T(n,e),n}(se),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;return v(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 EM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(bM),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}($s);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(nc||(nc={}));var SM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var TM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var wM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(o),r}return T(n,e),n}(J),NM=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}(se),Q1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:o,include_ts:!0},r}return T(n,e),n}(J),Y1=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}(se),IM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0},r}return T(n,e),n}(J),AM=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}(se),MM=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=Z.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}(J),xM=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}(se),OM=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}(gt),kM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(o),r.params={include_ts:!0},r}return T(n,e),n}(J),RM=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}(se),LM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return T(n,e),n}(J),DM=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}(se),Z1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:o},r}return T(n,e),n}(J),X1=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),UM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o},r}return T(n,e),n}(J),PM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),Tp=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=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o,upsert:l,mode:c},r}return T(n,e),n}(J),wp=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),FM=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}(gt),HM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(o),r.params={},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var jM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var BM=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=Z.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}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var $M=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),GM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var zM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),VM=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=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=ye({user_id:o,seconds:a,description:l}),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var qM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(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}(gt),WM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var KM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),J1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.freezing;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:o},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var QM=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}(gt),YM=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=Z.POST,r.path="".concat(dC(s),"/").concat(encodeURIComponent(i)),r.params={report_category:o,reporting_user_id:a,report_description:l},r}return T(n,e),n}(J),ZM=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=Z.POST,r.path="".concat(Y_,"/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}(J),XM=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=Z.POST,r.path="".concat(dC(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=ye({report_category:o,reporting_user_id:a,report_description:c,offending_user_id:l,mesg_token:d}),r}return T(n,e),n}(J),JM=function(e){function n(t){var r=[];return t.mentionType===rr.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:ye(Ie({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!==Wi.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),pS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new er(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}(gt),ey=function(e){function n(t){var r=null;return t.mentionType===rr.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:ye(Ie({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?Oi.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return T(n,e),n}(wr),cm=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 er(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=$g({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:[]},Ie({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}(gt),ty=function(e){function n(t){var r=null;return t.mentionType===rr.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:ye(Ie({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),dm=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 Jt(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=$g({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:[]},Ie({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}(gt),ex=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=Z.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(J),tx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Jg(r),i}return T(n,e),n}(se),nx=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=Z.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(J),rx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Jg(M({},r)),i}return T(n,e),n}(se),ix=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=Z.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}(J),sx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}return T(n,e),n}(se),ox=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===rr.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=Z.POST,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages"),i.params=ye(Ie({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 _r.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(J),_S=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}return T(n,e),n}(se),ax=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===rr.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=Z.POST,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ie({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 Gs.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 _r.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return T(n,e),n}(J),lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jt(t,r),i}return T(n,e),n}(se),ux=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=Z.PUT,u.path="".concat(Ki,"/").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}(J),cx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),dx=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Ki,"/").concat(encodeURIComponent(r)),i}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var hx=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Z.PUT,i.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/close"),i}return T(n,e),n}(J),fx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),px=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=Z.POST,a.path="".concat(Ki,"/").concat(encodeURIComponent(s),"/options"),a.params={channel_url:r,channel_type:i,text:o},a}return T(n,e),n}(J),_x=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),mx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),o.params={text:s},o}return T(n,e),n}(J),gx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),vx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var yx=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:ye({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),mS=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new k6(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(gt),gS=100,vS="GroupChannel",Ex="url",yS=100,hm="Message",bx="messageId",ES="NotificationMessage",Cx="notificationId",Sx="Poll",Tx="pollId",wx="FeedChannel",Nx="url";function Ix(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.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 Zn,Ax=M(M({},l0),{fileInfoList:[]}),Mx=function(e){return(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},fh=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),xx=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(Zn||(Zn={}));var St,ny=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 ye(Ie(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=ye(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?{name:t.fileInfoList[0].fileName,size:t.fileInfoList[0].fileSize,type:t.fileInfoList[0].mimeType,data:t.data}:void 0})),o=new li(this._iid,s);return o.messageParams=t,o},n.prototype._validateFailedFileMessageHasFile=function(t,r){var i;return!!t.url||pr(r)||pr((i=t.messageParams)===null||i===void 0?void 0:i.file)},n.prototype._createPendingScheduledFileMessage=function(t,r,i){var s=this._createPendingFileMessage(t,r,i);return s.scheduledInfo={scheduledMessageId:0,scheduledAt:t.scheduledAt,scheduledMessageParams:t},s},n.prototype._markMessageAsFailed=function(t,r,i){i===void 0&&(i=!1),t.errorCode=r.code,r.code===Te.REQUEST_CANCELED||r.code===Te.FILE_UPLOAD_CANCEL_FAILED?t.sendingStatus=ut.CANCELED:i||(t.sendingStatus=ut.FAILED)},n.prototype.sendUserMessage=function(t){var r=M(M({},lS),t);return Y(cS(r)).throw(L.invalidParameters),this._sendUserMessage(r)},n.prototype._sendUserMessage=function(t,r,i){var s=this;r===void 0&&(r=Zn.SEND);var o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=i??this._generateRequestId(),c=Date.now(),d=new Br;return Or(2).then(function(){var h=s._createPendingUserMessage(t,u,c);a.dispatch(new bt({messages:[h],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(p){return[2,d._trigger(h)]})})});var f=new JM(M(M({},t),{channelUrl:s.url,channelType:s.channelType,reqId:u}));l.send(f).then(function(p){var m=p.as(pS).message;a.dispatch(new bt({messages:[m],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(b){return[2,d._trigger(m)]})})})}).catch(function(p){if(Lr(p))throw p;Or(2).then(function(){var m=s._createPendingUserMessage(t,u,c),b=O.of(s._iid).cacheContext,g=b.localCacheEnabled&&b.localCacheConfig.enableAutoResend&&Qh(p.code);s._markMessageAsFailed(m,p,g),a.dispatch(new bt({messages:[m],source:m.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(_){return[2,d._triggerFailed(p,m)]})})})})})}),d},n.prototype._autoResendUserMessage=function(t){return Y(t instanceof er&&!!t.messageParams).throw(L.invalidParameters),this._sendUserMessage(t.messageParams,Zn.SEND,t.reqId)},n.prototype.resendUserMessage=function(t){var r;return y(this,void 0,void 0,function(){var i,s;return v(this,function(o){return Y(t instanceof er&&!t.scheduledInfo).throw(L.invalidParameters),i=new Tr,s=(r=t.messageParams)!==null&&r!==void 0?r:lm(t),this._sendUserMessage(s,Zn.RESEND,t.reqId).onFailed(function(a){return i.reject(a)}).onSucceeded(function(a){return i.resolve(a)}),[2,i.promise]})})},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return v(this,function(l){switch(l.label){case 0:return i=M(M({},hS),r),Y(R("number",t)&&fS(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ey(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(cm).message]}})})},n.prototype.copyUserMessage=function(t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l;return v(this,function(u){return Y(t instanceof n&&r instanceof er&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),Y(!r.poll).throw(L.notSupportedError),a=new Tr,l=(i=r.messageParams)!==null&&i!==void 0?i:Ie(M(M({},r),{mentionType:r.mentionType,mentionedUserIds:(s=r.mentionedUserIds)!==null&&s!==void 0?s:(o=r.mentionedUsers)===null||o===void 0?void 0:o.map(function(c){return c.userId}),translationTargetLanguages:Object.keys(r.translations),pushNotificationDeliveryOption:Wi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1})),t._sendUserMessage(l).onSucceeded(function(c){a.resolve(c)}).onFailed(function(c){return a.reject(c)}),[2,a.promise]})})},n.prototype.translateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(t instanceof er&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ix({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(sx).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);Re(function(){return y(i,void 0,void 0,function(){return v(this,function(c){return[2,r._trigger(u)]})})})});var l=new ox(M({reqId:a,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(_S).message;Re(function(){return y(i,void 0,void 0,function(){return v(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),Re(function(){return y(i,void 0,void 0,function(){return v(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},W1),t);return Y(K1(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},Ax),t),s=O.of(this._iid);Y(function(a,l){return l===void 0&&(l=c6),u0(a)&&Array.isArray(a.fileInfoList)&&a.fileInfoList.length>=2&&a.fileInfoList.length<=l&&a.fileInfoList.every(function(u){return Mx(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 Y(!o).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=Zn.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 bt({messages:[d],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t).then(function(h){o.dispatch(new bt({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(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&&Qh(h.code);s._markMessageAsFailed(f,h,m),o.dispatch(new bt({messages:[f],source:f.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:h.code===Te.FILE_UPLOAD_CANCEL_FAILED?G.LOCAL_MESSAGE_CANCELED:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){Y(t instanceof Jt&&!!t.messageParams).throw(L.invalidParameters);var r=O.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,Zn.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 fh;return Or(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);o.dispatch(new bt({messages:[d],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t,{requestHandler:c,isCopy:r===Zn.COPY}).then(function(h){o.dispatch(new bt({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(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 bt({messages:[f],source:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(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 ax(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(lx).message;Re(function(){return y(o,void 0,void 0,function(){return v(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),Re(function(){return y(o,void 0,void 0,function(){return v(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;Y(t.every(function(u){return K1(M(M({},W1),u))})).throw(L.invalidParameters);var s=new Br;try{for(var o=pe(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 v(this,function(a){return i=this._validateFailedFileMessageHasFile(t,r),Y(t instanceof Jt&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Tr,o=um(t,r),this._sendFileMessage(o,Zn.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(Y(t instanceof Ft&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:lm(t);return this._sendUserMessage(o,Zn.RESEND,t.reqId)}if(t.isFileMessage()){var a=this._validateFailedFileMessageHasFile(t,r);return Y(a).throw(L.invalidParameters),o=(s=t.messageParams)!==null&&s!==void 0?s:um(t,r),this._sendFileMessage(o,Zn.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 v(this,function(l){switch(l.label){case 0:return i=M(M({},hM),r),Y(R("number",t)&&function(u){return tv(u)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ty(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(dm).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return v(this,function(c){switch(c.label){case 0:return r=O.of(this._iid).requestQueue,i=js(),(s=new of({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(af),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 v(this,function(r){return Y(R("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 v(this,function(u){return Y(t instanceof n&&r instanceof Jt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),a=new Tr,l=Ie(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:Wi.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){Y(t instanceof n&&r instanceof Ft&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){Y(!i.poll).throw(L.notSupportedError);var o=uS(i);return s._sendUserMessage(o)}if(i.isFileMessage())return o=dS(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 v(this,function(s){switch(s.label){case 0:return Y(t instanceof hr).throw(L.invalidParameters),t.messageId>0?(r=O.of(this._iid).requestQueue,i=new pC({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Ft?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 v(this,function(a){switch(a.label){case 0:return Y(t instanceof hr&&t.messageId>0&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ex({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(tx).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(t instanceof hr&&t.messageId>0&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new nx({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(rx).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 v(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new ey({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(cm).message,a.dispatch(new bt({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 v(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new ty({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(dm).message,a.dispatch(new bt({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 v(this,function(s){return Y(t instanceof hr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new _r({key:o})}),t instanceof Jt?[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 v(this,function(s){return Y(t instanceof hr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new _r({key:o})}),t instanceof Jt?[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 v(this,function(i){return Y(t instanceof hr&&t.messageId>0&&r.every(function(s){return s instanceof _r})).throw(L.invalidParameters),t instanceof Jt?[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 v(this,function(i){return Y(t instanceof hr&&t.messageId>0&&r.every(function(s){return s instanceof _r})).throw(L.invalidParameters),t instanceof Jt?[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 v(this,function(l){switch(l.label){case 0:return Y($e(nc,t)&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new YM({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 v(this,function(u){switch(u.label){case 0:return Y(t instanceof Ke&&$e(nc,r)&&R("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new ZM({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 v(this,function(u){switch(u.label){case 0:return Y(t instanceof Ft&&$e(nc,r)&&R("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new XM({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 v(this,function(a){switch(a.label){case 0:return Y(R("number",t)&&function(l){return R("string",l.title,!0)&&KC(l.data)&&R("boolean",l.allowUserSuggestion,!0)&&R("boolean",l.allowMultipleVotes,!0)&&R("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ux(M({pollId:t},r)),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(cx).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return v(this,function(o){switch(o.label){case 0:return r=R("number",t),Y(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new dx({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 v(this,function(a){switch(a.label){case 0:return r=R("number",t),Y(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new hx({pollId:t}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(fx).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return v(this,function(l){switch(l.label){case 0:return i=R("number",t)&&R("string",r)&&r.trim()!=="",Y(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new px({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(_x).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return v(this,function(u){switch(u.label){case 0:return s=R("number",t)&&R("number",r)&&R("string",i)&&i.trim()!=="",Y(s).throw(L.invalidParameters),o=O.of(this._iid).requestQueue,a=new mx({pollId:t,pollOptionId:r,optionText:i}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(gx).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return i=R("number",t)&&R("number",r),Y(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new vx({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 v(this,function(d){switch(d.label){case 0:return i=R("number",t)&&We("number",r),Y(i).throw(L.invalidParameters),s=O.of(this._iid),o=s.requestQueue,a=s.dispatcher,l=new yx({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(mS).event,a.dispatch(new Xg({event:c,source:G.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:return Y(R("number",t)).throw(L.invalidParameters),[4,sf.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 v(this,function(r){switch(r.label){case 0:return Y(R("string",t,!0)),[4,sf.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 XC(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new JC(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Kn),bS=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}),cf=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}),Ox=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}),kx=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=Z.GET,u.path=Xe,u.params=ye({limit:r,token:i,user_ids:s,metadatakey:o,metadatavalues_in:a,nickname_startswith:l}),u}return T(n,e),n}(J),Rx=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}(se),Lx=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)&&R("string",this.metaDataKeyFilter,!0)&&We("string",this.metaDataValuesFilter,!0)&&R("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 kx(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Rx),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}(Do),Dx=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=Z.GET,a.path="".concat(Xe,"/").concat(r,"/block"),a.params=ye({limit:i,token:s,user_ids:o}),a}return T(n,e),n}(J),Ux=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}(se),Px=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 v(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 Dx(Ie(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(Ux),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}(Do),Fx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),o.params={limit:i,token:s},o}return T(n,e),n}(J),Hx=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}(se),jx=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 v(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 Fx(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(Hx),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}(Do),Ud={},Zc=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 Ud[t]||(this.itemSizeLimit=i,this.cacheLimit=o,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,Ud[t]=this),Ud[t]}return e.get=function(n){return Ud[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,st=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 ry,kr=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw st.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},ks=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw st.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},iy=function(e,n){for(var t=0,r=0;r>>0)%n},Pd=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(!(ks(o,a)>0))return!1;break;case"/gte":case">=":if(o=n[r],a=i[s],!(ks(o,a)>=0))return!1;break;case"/lt":case"<":if(o=n[r],a=i[s],!(ks(o,a)<0))return!1;break;case"/lte":case"<=":if(o=n[r],a=i[s],!(ks(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(){},sy=function(){return Promise.resolve()},Bx=function(e){return e},oy=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(ry||(ry={}));var ga,fr,ts,$x=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?Bx:a,u=n.backward,c=u===void 0?sy:u,d=n.forward,h=d===void 0?sy: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 v(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 v(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}(),fm=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*ks(this._indexer.origin[c].columnValues[s],this.condition[o][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(a*ks(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],g=1;if(b[0]==="-"&&(b=b.slice(1),g=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((g>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===ts.PERSISTENT&&(i.state=fr.PERSISTENT),t!==ts.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)ly.includes(this._items[i].state)&&ly.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===fr.VOLATILE}),o=s.length-this._limit;if(o>0){var a=[];try{for(var l=pe(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===fr.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!==fr.VOLATILE})},e}(),Vx=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(Ia(s,o),"/trans.metadata")}(t,r),this.recordsetKey=function(s,o){return"".concat(Ia(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 v(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,De([],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 v(this,function(h){switch(h.label){case 0:r=Si.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=Si.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=ph.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 v(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 v(this,function(l){switch(l.label){case 0:return r=Zc.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Si.get(this.dbname).find(this._store,i)];case 1:return o=l.sent(),(a=o?ph.createFromCacheItem(o):new ph({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 v(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 v(this,function(i){switch(i.label){case 0:return n=_m(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(),Si.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),Wa={},qs=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(Ia(c,d),"/index.").concat(h)}(t,r,s.join(">"));return Wa[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(ga.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(ga.ERROR,this.indexerKey,function(){return l.abort()})),Wa[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in Wa)delete Wa[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=pe(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 st.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=ks(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,g;return v(this,function(_){switch(_.label){case 0:return[4,(n=Si.get(this.dbname)).find(this._store,this.indexerKey,ts.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=_m(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=pe(i),o=s.next(),_.label=4;case 4:return o.done?[3,7]:(a=o.value).startsWith(r)?[4,n.find(this._store,a,ts.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=ph.createFromCacheItem(l))try{for(b=void 0,c=pe(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&&(g=c.return)&&g.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 Wa[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return v(this,function(n){switch(n.label){case 0:return Si.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete Wa[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return v(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 v(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 v(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}(),df=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},uy=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"})(rc||(rc={})),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"}(ur||(ur={}));var Fi,Ip={},nv=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=rc.PROCESSING,this._queue=[],this._activationQueue=[],Ip[n]&&!t.forceCreate||(this.nodeId=uy(),this.key=n,df()&&(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 ur.NEWNODE:r._sendSync();break;case ur.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case ur.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:ur.REQUEST_LOCK,ts:S.ts})};try{for(var g=pe(m),_=g.next();!_.done;_=g.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case ur.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 ur.REQUEST_LOCK:r._requestLock(a);break;case ur.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case ur.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(ur.REMOVENODE)})),Ip[n]=this),Ip[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==rc.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:uy(),key:this.key,op:n,data:t.data,ts:Date.now()};return df()&&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(ur.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(ur.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(ur.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 v(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=rc.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(ur.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(ur.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return v(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(ur.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}(),Ap=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=De([[i]],Ae(o.filter(function(u){return qs.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=a,this._mutex=new nv(function(u,c){return"".concat(Ia(u,c),".lock")}(t,r)),this._blobContainer=new zx({dbname:t,collectionName:r,store:a}),this._transaction=new Vx({dbname:t,collectionName:r,store:a})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:return i=Np(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 v(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=Zc.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 qx({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=De([],Ae(this.indexes),!1),i=[],s=r.map(function(g){return qs.createKey(g)}),o=t?t.indexes.map(function(g){return qs.createKey(g)}):[];try{for(a=pe(o),l=a.next();!l.done;l=a.next())u=l.value,s.includes(u)||i.push(qs.parseKey(u))}catch(g){f={error:g}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,De([],Ae(r.map(function(g){var _=new qs({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:g,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,De([],Ae(i.map(function(g){return new qs({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:g,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=Np(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=qs.createKey(n);try{for(var s=pe(this._indexers),o=s.next();!o.done;o=s.next()){var a=o.value;if(i===qs.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 st.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return v(this,function(t){switch(t.label){case 0:return n=Np(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 v(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=pe(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 st.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 v(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=pe(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=pe(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 v(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=pe(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 v(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=pe(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 v(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=pe(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 v(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 st.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new Gx({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw st.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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 v(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 st.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=pe(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 st.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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 v(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 st.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=pe(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 st.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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,g=this;return v(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 fm({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(o)}).each(function(E){return y(g,void 0,void 0,function(){var S,w;return v(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=pe(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(),st.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 v(this,function(g){switch(g.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:g.sent(),g.label=2;case 2:return g.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 fm({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 v(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:g.sent(),g.label=4;case 4:g.trys.push([4,9,10,11]),u=pe(l),c=u.next(),g.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:g.sent(),g.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=g.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 g.sent(),this._mutex.unlock(),[2,l];case 13:throw f=g.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),st.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return v(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 st.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return v(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 v(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 v(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 v(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),Mp="[NESTDB]",Hd=!0,zo=function(){function e(){}return e.off=function(){Hd=!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 v(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 st.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 v(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 v(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,De([],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 v(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 v(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return v(this,function(g){switch(g.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=g.sent())&&(b=m.metadata,t.push.apply(t,De([],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=pe(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 v(this,function(t){if(Ir[this.dbname])return[2,Object.keys(Ir[this.dbname])];throw st.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:return Ir[this.dbname]?[4,Pd(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 st.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return v(this,function(d){switch(d.label){case 0:return Ir[this.dbname]?[4,Pd(this.delay)]:[3,2];case 1:d.sent();try{for(r=pe(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 st.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 v(this,function(l){switch(l.label){case 0:return Ir[this.dbname]?[4,Pd(this.delay)]:[3,2];case 1:l.sent();try{for(r=pe(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 st.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 v(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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 v(this,function(c){try{for(r=pe(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 v(this,function(t){switch(t.label){case 0:return[4,Pd(this.delay)];case 1:return t.sent(),Ir[this.dbname]={},[2]}})})},n}(c0),cy="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Fi||(Fi={}));var ns,Kx=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=cy,i._state=Fi.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 v(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 v(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=Fi.OPENING;var o=r._indexedDb.open(t);o.addEventListener("upgradeneeded",function(a){a.target.result.createObjectStore(cy,{keyPath:"key"})}),o.addEventListener("success",function(a){r._state=Fi.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=Fi.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),o.addEventListener("error",function(a){r._state=Fi.UNINITIALIZED,s(a.target.error)})}else s(st.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return v(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 Fi.UNINITIALIZED:case Fi.OPEN:return[3,2];case Fi.OPENING:case Fi.CLOSED:return[3,3]}return[3,4];case 2:throw st.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 v(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 v(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 v(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=pe(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 v(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=pe(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 v(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||!df())return[3,4];if(!(df()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw st.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(st.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(st.storeNotAvailable)}}catch{o(st.storeNotAvailableInPrivateBrowsing)}else o(st.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw st.storeNotAvailable;case 5:return[3,7];case 6:throw st.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0),Qx=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,o=s===void 0?2097152:s,a=P4(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 v(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 v(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 v(this,function(c){switch(c.label){case 0:r=[];try{for(i=pe(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 v(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 v(this,function(t){if(!this._asyncStorage)throw st.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0),Yx=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 v(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 v(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 v(this,function(u){try{for(r=pe(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 v(this,function(l){try{for(r=pe(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 v(this,function(t){if(!this._mmkv)throw st.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(ns||(ns={}));var As,Zx=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=ns.INIT,this._config=s||new Zc({dbname:t}),this._store=i,this._event={success:Au,error:Au,storeReplaced:Au,upgrade:oy},this._collections=new Map,this._globalMutex=new nv("".concat(this.name,".lock")),this._config.disableLogger&&zo.off(),new Si({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 v(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return v(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 v(this,function(r){switch(r.label){case 0:return this._state!==ns.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 v(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 Ap({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 st.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 v(this,function(a){switch(a.label){case 0:return[4,this._globalMutex.lock()];case 1:if(a.sent(),this._state===ns.OPENED)return[3,12];this._state=ns.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(pm(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 Ft)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof hr)switch(this.replyType){case Dn.NONE:if(n.parentMessageId>0)return!1;break;case Dn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Ft&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(Vn||(Vn={}));var ic,cs=function(e){switch(e){case Vn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case Vn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},Jx=function(){return["channelUrl","-createdAt","-notificationId"]},eO=M(M({},lS),{scheduledAt:void 0}),tO=function(e){return cS(e)&&R("number",e.scheduledAt,!0)},nO=M(M({},l0),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),rO=function(e){return u0(e)&&R("number",e.scheduledAt)&&(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return R("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},CS="UnsentMessage",iO="reqId",jd={},Aa=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new nv("unsendmessagecache.lock"),jd[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),jd[t]&&!r||(jd[t]=new n(t)),jd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(CS);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 er?(t.messageParams&&(i.messageParams=V1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},V1(r)),{scheduledAt:r.scheduledAt})))):t instanceof Jt?(t.messageParams&&(i.messageParams=q1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},q1(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof li&&t.messageParams&&(i.messageParams=function(s){return ye({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 v(this,function(f){switch(f.label){case 0:return o=An.of(this._iid),a=this._deserialize(t),t.messageParams?a instanceof er?(u=t.messageParams,a.messageParams=o.buildUserMessageCreateParamsFromSerializedData(u,a),[3,6]):[3,1]:[3,6];case 1:return a instanceof Jt?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&Sp((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 li&&(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,g,_,E;return v(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&Sp((_=(g=p._uploadedMetaData)===null||g===void 0?void 0:g.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 er?(c=t.scheduledInfo.scheduledMessageParams,a.scheduledInfo.scheduledMessageParams=o.buildScheduledUserMessageCreateParamsFromSerializedData(c,a),[3,10]):[3,7]:[3,10];case 7:return a instanceof Jt?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&Sp(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 v(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 _s:i,o=t.order,a=o===void 0?Vn.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 v(this,function(g){switch(g.label){case 0:return this.localCacheEnabled?(h=cs(a),f={"/where":function(_){return!!(a!==Vn.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,g.sent().fetch({})];case 2:return m=g.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return v(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 _s),y(this,void 0,void 0,function(){return v(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:Vn.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 v(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 v(this,function(a){switch(a.label){case 0:return s instanceof Jt||s instanceof li?[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 v(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 v(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 v(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=pe(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 v(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 v(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 v(this,function(a){switch(a.label){case 0:return t instanceof Jt?t.messageParams&&(s=t.messageParams).file&&hh(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&&hh(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 li&&(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 v(this,function(d){switch(d.label){case 0:return l.file&&hh(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}(Kn),Bd={},Sl=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}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Aa.of(this._iid)},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 Y(!!t).throw(L.databaseError),t.collection(hm)},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 v(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 _s:a,u=t.order,c=u===void 0?Vn.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,g=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,w,N,A=this;return v(this,function(k){switch(k.label){case 0:return this.localCacheEnabled?(S=cs(c),w={where:{channelUrl:r,"/where":function(I){if(i)switch(c){case Vn.CHANNEL_LATEST:if(g&&I.createdAt!==i)return!1;if(h){if(E&&I.createdAti||!E&&I.createdAt>=i)return!1;break;case Vn.NEWEST_CHILD_MESSAGE:if(!f||I.parentMessageId===0||I.parentMessageId!==f)return!1}return!(m&&!I._poll)&&l.match(A._deserialize(I))}},index:S,backward:h},[4,this.collection.query(w)]):[3,3];case 1:return[4,k.sent().fetch({limit:o??void 0})];case 2:return N=k.sent(),[2,Promise.all(N.map(function(I){return y(A,void 0,void 0,function(){return v(this,function(x){return[2,this._deserialize(I)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new _s),y(this,void 0,void 0,function(){return v(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:Vn.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 v(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=pe(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 v(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 v(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 v(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=pe(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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:cs(Vn.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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:cs(Vn.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 v(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 v(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=cs(Vn.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 v(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 v(this,function(l){switch(l.label){case 0:return s instanceof Jt&&s.messageParams&&(o=s.messageParams).file&&hh(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 v(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}(Kn),$d={},sO=function(e){function n(t){var r=e.call(this,t)||this;return $d[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),$d[t]&&!r||($d[t]=new n(t)),$d[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Y(!!t).throw(L.databaseError),t.collection(ES)},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 v(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 _s: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 v(this,function(g){switch(g.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,g.sent().fetch({limit:o??void 0})];case 2:return[2,g.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 v(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 v(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=pe(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 v(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 v(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 v(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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:cs(Vn.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 v(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 v(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}(Kn),uu={},SS=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,g,_,E,S,w,N,A,k=this;return v(this,function(I){switch(I.label){case 0:return i instanceof bt?(s=i.messages,A=i.source,c=i.isWebSocketEventComing,o=s.filter(function(x){return x instanceof hr&&x.channelType!==Ze.OPEN&&x.messageId>0}),a=s.filter(function(x){return x instanceof hr&&x.channelType!==Ze.OPEN&&x.messageId===0}),l=s.filter(function(x){return x instanceof Na}),o.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 Ft?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return x.sent(),[2]}})})})]:[3,2]):[3,7];case 1:I.sent(),c||this._broadcastUpdateEvent(o,A),I.label=2;case 2:return a.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.upsert(a)];case 1:return x.sent(),[2]}})})})]:[3,4];case 3:I.sent(),c||this._broadcastUpdateEvent(a,A),I.label=4;case 4:return l.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return x.sent(),[2]}})})})]:[3,6];case 5:I.sent(),c||this._broadcastUpdateEvent(l,A),I.label=6;case 6:return[3,24];case 7:return i instanceof Zg?(u=i.messageIds,A=i.source,c=i.isWebSocketEventComing,d=u.filter(function(x){return typeof x=="number"}),h=u.filter(function(x){return typeof x=="string"}),[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 I.sent(),c||this._broadcastRemoveEvent(u,A),[3,24];case 9:return i instanceof VC?(f=i.reqId,A=i.source,[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 I.sent(),this._broadcastRemoveUnsentEvent(f,A),[3,24];case 11:return i instanceof qC?(p=i.polls,A=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(x){return x.messageId}),[4,Promise.all(m.map(function(x){return k._messageCache.get(x)}))]):[3,14]):[3,15];case 12:return(b=I.sent().filter(function(x){return x})).length>0&&p.forEach(function(x){var U=b.find(function(z){return z.messageId===x.messageId});U&&U.applyPoll(x)}),[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,x.sent()]}})})})];case 13:I.sent(),I.label=14;case 14:return this._broadcastPollChangeLogEvent(p,A),[3,24];case 15:return i instanceof WC?(g=i.event,A=i.source,[4,this._messageCache.get(g.messageId)]):[3,19];case 16:return(_=I.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(g)?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,x.sent()]}})})})]:[3,18];case 17:I.sent(),I.label=18;case 18:return this._broadcastPollUpdateEvent(g,A),[3,24];case 19:return i instanceof Xg?(E=i.event,A=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=I.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,x.sent()]}})})})]:[3,22];case 21:I.sent(),I.label=22;case 22:return this._broadcastPollVoteEvent(E,A),[3,24];case 23:i instanceof GC?(w=i.event,A=i.source,w.messageId>0&&this._broadcastReactionUpdateEvent(w,A)):i instanceof zC&&(N=i.event,A=i.source,this._broadcastThreadUpdateEvent(N,A)),I.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 Sl.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Aa.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return sO.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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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}(Kn),oO=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=Z.GET,r.path="".concat(cC),r.params=ye({token:u,limit:a,reverse:s,order:Q_.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return T(n,e),n}(J),aO=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}(se),lO=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(cC,"/").concat(i),r}return T(n,e),n}(J),uO=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}(se),dy={},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,Sl.of(n),Aa.of(n),SS.of(n),this.fileMessageQueue=new sM(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:o,cacheContext:a}),dy[n]=this}return e.of=function(n){return dy[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=fa(n);if(t.notificationId)return new Na(this._iid,Na.payloadify(t));switch(t.messageType){case Ct.USER:return new er(this._iid,er.payloadify(t));case Ct.FILE:return li._isMultipleFilesMessageSerializedData(t)?new li(this._iid,li.payloadify(t)):new Jt(this._iid,Jt.payloadify(t));case Ct.ADMIN:return new Bl(this._iid,Bl.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return ye(Ie({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 ye(Ie({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 ye({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 uf(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 v(this,function(i){switch(i.label){case 0:return t=new oM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(aM).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return t=new cM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(dM).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 v(this,function(u){switch(u.label){case 0:return o=new Ld(M(M({channelType:t,channelUrl:n,token:String(r)},tc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Dd).messages,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return o=new Ld(M(M({channelType:t,channelUrl:n,timestamp:r},tc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Dd).messages,this._dispatcher.dispatch(new bt({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 v(this,function(p){switch(p.label){case 0:return l=new Ld(M(M(M({channelType:t,channelUrl:n,timestamp:r},tc),i),{checkingHasNext:o,checkingContinuousMessages:a})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as(Dd),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return s=new Ld(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},Yc),r),{replyType:Dn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return o=u.sent(),a=o.as(Dd).messages,(l=a.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return r=new oO(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(aO),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 v(this,function(i){switch(i.label){case 0:return t=new lO({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(uO).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 v(this,function(p){switch(p.label){case 0:return o=new lM(ye(Ie(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},am),i)))),[4,this._requestQueue.send(o)];case 1:return a=p.sent(),l=a.as(uM),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 bt({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new Zg({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),TS=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&&R("object",s)&&R("number",o)&&R("string",a)&&R("string",l)&&(i.threadInfo=new lf(t,s),i.targetMessageId=o,i.channelUrl=a,i.channelType=l),i}return T(n,e),n}(Kn),cO={channelUrl:"",channelType:Ze.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},dO=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=Z.GET,m.path="".concat(Y4,"/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}(J),hO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return yr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return T(n,e),n}(se);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(ic||(ic={}));var fO=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=ic.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:ic.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)&&R("string",this.keyword)&&this.keyword.length>0&&R("boolean",this.reverse)&&R("boolean",this.exactMatch)&&R("string",this.channelUrl)&&R("string",this.channelCustomType)&&(R("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(R("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&$e(ic,this.order)&&R("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 v(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 dO(Ie(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(hO),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}(Do),pO=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=Z.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),a.params=ye(Ie({limit:s,token:o})),a}return T(n,e),n}(J),_O=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 yr(t,s)}),i}return T(n,e),n}(se),mO=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 v(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 pO({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(_O),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}($s),gO={channelUrl:"",scheduledMessageId:0},vO={reverse:!1,limit:20},yO=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 v(this,function(s){switch(s.label){case 0:return r=M(M({},cO),t),Y(function(o){return R("string",o.channelUrl)&&$e(Ze,o.channelType)&&R("number",o.messageId)&&R("boolean",o.includeReactions,!0)&&R("boolean",o.includeMetaArray,!0)&&R("boolean",o.includeParentMessageInfo,!0)&&R("boolean",o.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof hr||i instanceof Na||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 v(this,function(i){return r=M(M({},gO),t),Y(function(s){return R("string",s.channelUrl)&&s.channelUrl!==""&&R("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 v(this,function(s){return i=M(M({},vO),r),Y(R("string",t,!0)&&function(o){return R("boolean",o.reverse,!0)&&R("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 v(this,function(r){return Y(R("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(Yg),jt,sc,mm;(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"})(jt||(jt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(sc||(sc={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(mm||(mm={}));var Uc,_h=function(e){switch(e){case jt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case jt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case jt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},wS=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),hy={},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,hy[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 rt.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case rt.INTERNAL_DISCONNECTED:case rt.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return hy[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=a.sent();try{for(t=pe(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=Te.ACK_TIMEOUT,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=pe(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&Qh(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 bt({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&&!Qh(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 v(this,function(r){switch(r.label){case 0:return n=Aa.of(this._iid),(t=new _s).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 v(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 wS({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"})(Uc||(Uc={}));var hf=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}(),NS=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),IS=function(e){function n(){return e.call(this)||this}return T(n,e),n}(Tt),AS=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new hf(i),s}return T(n,e),n}(gt),EO=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},Xt;(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"})(Xt||(Xt={}));var bO=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 bO(i),s}return T(n,e),n}(gt),CO=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),SO=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 SS.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 v(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return v(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return y(this,void 0,void 0,function(){return v(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return v(this,function(o){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return v(this,function(o){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return v(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},n}(Kn),TO=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}(gt),wO=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=$g({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:[]},Ie({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}(gt),NO=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 Jg(i),s}return T(n,e),n}(gt),IO=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new TS(t,i),s}return T(n,e),n}(gt),AO=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}(gt),MO=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new EO(t,i),s.status=im(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(gt),Gt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(Gt||(Gt={}));var ps,Rr,Ur,wo,Gi,ff,Ls,Pc,si=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=$e(Gt,r.state)?r.state:null,i.role=$e(Ni,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 ye(Ie(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}(Pa),xO=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}(Kn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(ps||(ps={})),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"}(wo||(wo={})),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"}(Gi||(Gi={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(ff||(ff={})),function(e){e.AND="AND",e.OR="OR"}(Ls||(Ls={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(Pc||(Pc={}));var Tn,MS=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:ps.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:wo.ALL,this.hiddenChannelFilter=(p=n==null?void 0:n.hiddenChannelFilter)!==null&&p!==void 0?p:Gi.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=Ls.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 Pc.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case Pc.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 Ls.AND:if(a.some(function(p){return!c.includes(p)}))return!1;break;case Ls.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||!$4(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 Gi.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case Gi.HIDDEN:if(!n.isHidden)return!1;break;case Gi.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case Gi.HIDDEN_PREVENT_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_prevent_auto_unhide")return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===wo.UNREAD_MESSAGE&&n.unreadMessageCount===0)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case ps.PUBLIC:if(!n.isPublic)return!1;break;case ps.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}(),OO=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 Y(!!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,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 De([],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)return!1;break;case jt.CHRONOLOGICAL:if(!a&&S.createdAt>r||a&&S.createdAtr||a&&S.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:k.sent(),k.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return v(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 v(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=De([],Ae(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return v(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=pe(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}(Kn),mh={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},gm=function(e){return We("string",e.invitedUserIds,!0)&&R("string",e.channelUrl,!0)&&R("string",e.coverUrl,!0)&&(pr(e.coverImage)||R("string",e.coverImage,!0))&&R("boolean",e.isDistinct,!0)&&R("boolean",e.isSuper,!0)&&R("boolean",e.isBroadcast,!0)&&R("boolean",e.isExclusive,!0)&&R("boolean",e.isPublic,!0)&&R("boolean",e.isStrict,!0)&&R("boolean",e.isDiscoverable,!0)&&R("boolean",e.isEphemeral,!0)&&R("string",e.accessCode,!0)&&R("string",e.name,!0)&&R("string",e.data,!0)&&R("string",e.customType,!0)&&We("string",e.operatorUserIds,!0)&&R("number",e.messageSurvivalSeconds,!0)},pf={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},vm=function(e){return We("string",e.customTypes,!0)&&R("boolean",e.includeEmpty)&&R("boolean",e.includeFrozen)&&R("boolean",e.includeChatNotification)},xS={myMemberStateFilter:Rr.ALL},OS=function(e){return $e(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 kO={keys:[]},RO={channelCustomTypesFilter:void 0,superChannelFilter:Ur.ALL},LO=function(e){return We("string",e.channelCustomTypesFilter,!0)&&$e(Ur,e.superChannelFilter)},DO={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:tr.ALL};M({},G);var gh=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),bs=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),UO=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,g,_,E,S,w,N,A,k,I,x=this;return v(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(z){return z 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=pe(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&&(A=c.return)&&A.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=pe(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 g=U.sent(),k={error:g},[3,17];case 16:try{m&&!m.done&&(I=p.return)&&I.call(p)}finally{if(k)throw k.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 bs?(E=a.channelUrls,S=a.context,w=a.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,kt(function(){return y(x,void 0,void 0,function(){var z,H,W,Q,$,Ne;return v(this,function(X){switch(X.label){case 0:X.trys.push([0,6,7,8]),z=pe(E),H=z.next(),X.label=1;case 1:return H.done?[3,5]:(W=H.value,[4,r.removeMessagesOfChannel(W)]);case 2:return X.sent(),[4,i.removeMessagesOfChannel(W)];case 3:X.sent(),X.label=4;case 4:return H=z.next(),[3,1];case 5:return[3,8];case 6:return Q=X.sent(),$={error:Q},[3,8];case 7:try{H&&!H.done&&(Ne=z.return)&&Ne.call(z)}finally{if($)throw $.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),w||this._broadcastRemoveEvent(E,S),[3,24];case 22:return a instanceof NS?[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=pe(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=pe(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}(),PO=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({},pf),o),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Z.GET,u.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=ye(Ie({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}(J),FO=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}(se),ym=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(i?K4:sr,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return T(n,e),n}(J),Em=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}(se),Ka={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:wo.ALL,superChannelFilter:Ur.ALL,publicChannelFilter:ps.ALL,hiddenChannelFilter:Gi.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:Ls.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:jt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},HO=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,g=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,w=t.metadataOrderKeyFilter,N=t.metadataKey,A=t.metadataValues,k=t.metadataValueStartsWith,I=t.includeFrozen,x=t.includeMetaData,U=t.searchFilter,z=t.userIdsFilter,H=t.includeChatNotification,W=H!==void 0&&H,Q=t.includeLeftChannel,$=Q!==void 0&&Q,Ne=t.createdAfter,X=t.createdBefore;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Xe,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=ye({token:s,limit:o,order:a??Ka.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Ka.includeEmpty,member_state_filter:u??Ka.myMemberStateFilter,super_mode:c??Ka.superChannelFilter,public_mode:d??Ka.publicChannelFilter,unread_filter:h??Ka.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:g,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:w,metadata_key:N,metadata_values:A,metadata_value_startswith:k,show_frozen:I,show_metadata:x,include_chat_notification:W,include_left_channel:$,created_after:Ne,created_before:X}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),z&&z.userIds&&z.userIds.length>0&&(z.includeMode?(r.params.members_include_in=z.userIds,r.params.query_type=z.queryType.toUpperCase()):r.params.members_exactly_in=z.userIds),r}return T(n,e),n}(J),jO=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}(se),BO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.myMemberStateFilter;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:o??Rr.ALL},s}return T(n,e),n}(J),$O=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}(se),GO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.keys;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=ye({item_keys:o}),s}return T(n,e),n}(J),zO=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}(se),VO=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return T(n,e),n}(J),qO=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}(se),WO=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=Z.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}(J),KO=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}(se),QO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(uC,"/count"),o.params={channel_url:r,status:ZO(i)},s&&(o.params.message_type=s),o}return T(n,e),n}(J),YO=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}(se),ZO=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case lo.PENDING:n.push(ii.PENDING);break;case lo.SENT:n.push(ii.IN_QUEUE),n.push(ii.SENT);break;case lo.CANCELED:n.push(ii.CANCELED);break;case lo.FAILED:n.push(ii.FAILED)}}),n},XO=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,g=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,w=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Z.POST,r.path=sr,r.params=ye({user_ids:De([i],Ae(w??[]),!1).filter(function(A,k,I){return k===I.indexOf(A)}),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:g,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return T(n,e),n}(J),JO=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}(se),fy=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ek=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(J),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}(se),nk=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 si(t,f)}):[new si(t,i.data)],s}return T(n,e),n}(Kl),rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:o},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);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=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 si(s._iid,i.data),s}return T(n,e),n}(Kl),sk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return T(n,e),n}(J),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}(se),ak=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 si(t,p)}),s}return T(n,e),n}(Kl),lk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Gt.NONE,i}T(n,e)})(se);var uk=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 si(t,c),s}return T(n,e),n}(Kl),bm={hidePreviousMessages:!1,allowAutoUnhide:!0},ck=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=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:o??bm.hidePreviousMessages,allow_auto_unhide:a??bm.allowAutoUnhide},r}return T(n,e),n}(J),dk=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}(se),hk=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}(gt),fk=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),pk=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}(gt),_k=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),mk=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}(gt),gk=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),kS=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,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=wo.ALL,U.superChannelFilter=Ur.ALL,U.publicChannelFilter=ps.ALL,U.hiddenChannelFilter=Gi.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:Ls.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=jt.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:wo.ALL,U.superChannelFilter=(g=r.superChannelFilter)!==null&&g!==void 0?g:Ur.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:ps.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:Gi.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:Ls.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(A=r.metadataValues)!==null&&A!==void 0?A:null,U.metadataOrderKeyFilter=(k=r.metadataOrderKeyFilter)!==null&&k!==void 0?k:null,U.metadataValueStartsWith=(I=r.metadataValueStartsWith)!==null&&I!==void 0?I:null,U.order=(x=r.order)!==null&&x!==void 0?x:jt.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)&&R("boolean",this.includeEmpty)&&R("boolean",this.includeFrozen)&&R("boolean",this.includeMetaData)&&R("string",this.channelNameContainsFilter)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&R("string",this.customTypeStartsWithFilter)&&R("string",this.nicknameContainsFilter,!0)&&R("string",this.nicknameStartsWithFilter,!0)&&R("string",this.nicknameExactMatchFilter,!0)&&$e(Rr,this.myMemberStateFilter)&&$e(Ur,this.superChannelFilter)&&$e(ps,this.publicChannelFilter)&&$e(wo,this.unreadChannelFilter)&&$e(Gi,this.hiddenChannelFilter)&&We(Pc,this.searchFilter.fields)&&R("string",this.searchFilter.query,!0)&&We("string",this.userIdsFilter.userIds)&&R("boolean",this.userIdsFilter.includeMode)&&$e(Ls,this.userIdsFilter.queryType)&&$e(jt,this.order)&&R("string",this.metadataOrderKeyFilter,!0)&&R("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&R("string",this.metadataValueStartsWith,!0)&&J2(this.createdAfter,!0)&&J2(this.createdBefore,!0)},n.prototype.serialize=function(){return Qc(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return v(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,Ie(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}(Do),vk=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?yr(t,M({},i.data.latest_pinned_message)):null),o.ts=i.ts,o}return T(n,e),n}(gt),yk=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(sr,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=ye({userId:i}),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ws,Ek=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}(gt),ls=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&&He.onMentionReceived&&He.onMentionReceived(m,f)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=6;case 6:return[3,79];case 7:return S=t.as(oA),Ee=S.channelUrl,Be=S.channelType,w=S.messageId,N=S.silent,A=S.messageCreatedAt,k=S.senderId,Be!==Ze.GROUP?[3,9]:[4,this.getChannel(Ee,!0)];case 8:I=Qe.sent(),x=k===this._sdkState.userId,N||x||A>0&&I.myLastRead0&&I._updateUnreadCount(I.unreadMessageCount-1,0),this._dispatcher.dispatch(new Zg({messageIds:[w],source:G.EVENT_MESSAGE_DELETED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onMessageDeleted&&He.onMessageDeleted(I,w)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=9;case 9:return[3,79];case 10:return(U=t.as(iS).readStatus).channelType!==Ze.GROUP?[3,12]:($=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:z=Qe.sent(),$&&z._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?$?(z.unreadMessageCount>0||z.unreadMentionCount>0)&&(z._updateUnreadCount(0,0),this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})):z.unreadMessageCount!==0&&z.unreadMentionCount!==0||(this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})):(this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onUnreadMemberStatusUpdated&&He.onUnreadMemberStatusUpdated(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),Qe.label=12;case 12:return[3,79];case 13:return H=t.as(Ek),Ee=H.channelUrl,W=H.deliveredStateUpdate,Q=W===void 0?{}:W,$=this._groupChannelCache.isCachedInMemory(Ee),[4,this.getChannel(Ee,!0)];case 14:return Ne=Qe.sent(),$&&Object.keys(Q).forEach(function(q){Ne._updateUndeliveredMemberState(q,Q[q])}),Object.keys(Q).some(function(q){return q!==lt._sdkState.userId})&&(this._dispatcher.dispatch(new Ve({channels:[Ne],context:{source:G.EVENT_CHANNEL_DELIVERED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onUndeliveredMemberStatusUpdated&&He.onUndeliveredMemberStatusUpdated(Ne)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),[3,79];case 15:return X=t.as(NO),Ee=X.channelUrl,Be=X.channelType,ae=X.event,Be!==Ze.GROUP?[3,18]:[4,this.getChannel(Ee,!0)];case 16:return ne=Qe.sent(),[4,this.getMessageFromCache(ae.messageId)];case 17:(ie=Qe.sent())?ie instanceof hr&&(ie.applyReactionEvent(ae),this._dispatcher.dispatch(new bt({messages:[ie],source:G.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new GC({event:ae,source:G.EVENT_MESSAGE_REACTION_UPDATED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onReactionUpdated&&He.onReactionUpdated(ne,ae)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=18;case 18:return[3,79];case 19:return(Ce=t.as(IO).event).channelType!==Ze.GROUP?[3,22]:[4,this.getChannel(Ce.channelUrl,!0)];case 20:return K=Qe.sent(),[4,this.getMessageFromCache(Ce.targetMessageId)];case 21:(ie=Qe.sent())?ie instanceof hr&&(ie.applyThreadInfoUpdateEvent(Ce),this._dispatcher.dispatch(new bt({messages:[ie],source:G.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new zC({event:Ce,source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onThreadInfoUpdated&&He.onThreadInfoUpdated(K,Ce)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=22;case 22:return[3,79];case 23:ee=t.as(AO).groupChannelMemberCounts,ue=[],Qe.label=24;case 24:Qe.trys.push([24,29,30,31]),P=pe(ee),xe=P.next(),Qe.label=25;case 25:return xe.done?[3,28]:(B=xe.value,Ee=B.channelUrl,rn=B.memberCount,sn=B.joinedMemberCount,te=B.updatedAt,[4,this.getChannelFromCache(Ee)]);case 26:(oe=Qe.sent())&&oe._setLatestMemberCount(rn,sn,te)&&ue.push(oe),Qe.label=27;case 27:return xe=P.next(),[3,25];case 28:return[3,31];case 29:return me=Qe.sent(),w0={error:me},[3,31];case 30:try{xe&&!xe.done&&(Av=P.return)&&Av.call(P)}finally{if(w0)throw w0.error}return[7];case 31:return ue.length>0&&(this._dispatcher.dispatch(new Ve({channels:ue,context:{source:G.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelMemberCountChanged&&He.onChannelMemberCountChanged(ue)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),[3,79];case 32:return re=t.as(MO),ce=re.event,de=re.status,Ee=re.channelUrl,Be=re.channelType,Ee&&Be===Ze.GROUP?[4,this.getChannel(Ee,!0)]:[3,34];case 33:fe=Qe.sent(),this._dispatcher.dispatch(new WC({event:ce,source:G.EVENT_POLL_UPDATED})),Re(de===O6?function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollDeleted&&He.onPollDeleted(fe,ce.pollId)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}:function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollUpdated&&He.onPollUpdated(fe,ce)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=34;case 34:return[3,79];case 35:return ve=t.as(mS),_e=ve.event,Ee=ve.channelUrl,Be=ve.channelType,Ee&&Be===Ze.GROUP?[4,this.getChannel(Ee,!0)]:[3,37];case 36:ze=Qe.sent(),this._dispatcher.dispatch(new Xg({event:_e,source:G.EVENT_POLL_VOTED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollVoted&&He.onPollVoted(ze,_e)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=37;case 37:return[3,79];case 38:if(!(V=t.as(Kl).event).isGroupChannelEvent)return[3,77];switch(V.category){case Xt.CHANNEL_JOIN:return[3,39];case Xt.CHANNEL_LEAVE:return[3,41];case Xt.CHANNEL_OPERATOR_UPDATE:return[3,45];case Xt.CHANNEL_INVITE:return[3,47];case Xt.CHANNEL_DECLINE_INVITE:return[3,49];case Xt.TYPING_START:case Xt.TYPING_END:return[3,51];case Xt.USER_CHANNEL_MUTE:case Xt.USER_CHANNEL_UNMUTE:return[3,53];case Xt.USER_CHANNEL_BAN:return[3,55];case Xt.USER_CHANNEL_UNBAN:return[3,59];case Xt.CHANNEL_FREEZE:case Xt.CHANNEL_UNFREEZE:return[3,61];case Xt.CHANNEL_HIDE:return[3,63];case Xt.CHANNEL_UNHIDE:return[3,65];case Xt.CHANNEL_DELETED:return[3,67];case Xt.CHANNEL_PROP_CHANGED:return[3,69];case Xt.CHANNEL_META_DATA_CHANGED:return[3,71];case Xt.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case Xt.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(V.channelUrl,!0)];case 40:return Se=Qe.sent(),Ue=t.as(nk),le=Ue.memberCount,Oe=Ue.joinedMemberCount,tt=Ue.members,at=!1,tt.forEach(function(q){Se.isExclusive||Se.isSuper||Se.isBroadcast?at=at||Se._setLatestMemberCount(le,Oe,V.ts):(q.state=Gt.JOINED,Se.addMember(q,V.ts),lt._updateJoinedMemberCount(Se)),q.userId===lt._sdkState.userId&&(Se.myMemberState=Gt.JOINED)}),this._dispatcher.dispatch(new Ve({channels:[Se],context:{source:G.EVENT_CHANNEL_JOINED,users:tt}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){var He,ke;try{for(var je=pe(tt),Pt=je.next();!Pt.done;Pt=je.next()){var ct=Pt.value;j.onUserJoined&&j.onUserJoined(Se,ct)}}catch(uw){He={error:uw}}finally{try{Pt&&!Pt.done&&(ke=je.return)&&ke.call(je)}finally{if(He)throw He.error}}Se.isBroadcast&&at&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Se])}),[2]})})}),[3,77];case 41:return(Hn=this._leftChannels.get(V.channelUrl))?(Ye=Hn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(V.channelUrl,!0)];case 43:Ye=Qe.sent(),Qe.label=44;case 44:return Pe=Ye,wt=t.as(ik),rn=wt.memberCount,sn=wt.joinedMemberCount,_t=wt.member,Rt=!1,Lt=O.of(this._iid).appInfo,Pe.isExclusive||Pe.isSuper||Pe.isBroadcast?Rt=Pe._setLatestMemberCount(rn,sn,V.ts):(Lt!=null&&Lt.enabledChannelMemberShipHistory?((nn=Pe.members.find(function(q){return q.userId===_t.userId}))&&(nn.state=Gt.LEFT),Pe.memberCount=rn):Pe.removeMember(_t),this._updateJoinedMemberCount(Pe)),_t.userId===this._sdkState.userId?(Pe.myMemberState=Gt.NONE,Pe.invitedAt=0,Pe.joinedAt=0,Pe._updateUnreadCount(0,0),Pe.isPublic?this._dispatcher.dispatch(new Ve({channels:[Pe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})):(this._markAsLeave(Pe),this._dispatcher.dispatch(new bs({channelUrls:[Pe.url],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})))):this._dispatcher.dispatch(new Ve({channels:[Pe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(Pe,_t),Pe.isBroadcast&&Rt&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Pe])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(V.channelUrl,!0)];case 46:Qt=Qe.sent(),un=t.as(CO).operators,Dt=un.map(function(q){return q.userId});try{for(Nt=pe(Qt.members),xn=Nt.next();!xn.done;xn=Nt.next())(Yt=xn.value).role=Dt.includes(Yt.userId)?Ni.OPERATOR:Ni.NONE}catch(q){N0={error:q}}finally{try{xn&&!xn.done&&(Mv=Nt.return)&&Mv.call(Nt)}finally{if(N0)throw N0.error}}return Qt.myRole=Dt.includes(this._sdkState.userId)?Ni.OPERATOR:Ni.NONE,this._dispatcher.dispatch(new Ve({channels:[Qt],context:{source:G.EVENT_CHANNEL_OPERATOR_UPDATED,operators:un}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(Qt,un)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(V.channelUrl,!0)];case 48:Bt=Qe.sent(),ft=t.as(ak),rn=ft.memberCount,sn=ft.joinedMemberCount,cn=ft.inviter,(Un=ft.invitees).forEach(function(q){return q.state=Gt.INVITED});try{for(Pn=pe(Un),vn=Pn.next();!vn.done;vn=Pn.next())Fn=vn.value,Bt.isExclusive||Bt.isSuper||Bt.isBroadcast?Bt._setLatestMemberCount(rn,sn,V.ts):Bt.addMember(Fn,V.ts),this._sdkState.userId===Fn.userId&&(Bt.hiddenState=dr.UNHIDDEN,Bt.myMemberState!==Gt.JOINED&&(Bt.myMemberState=Gt.INVITED),Bt.invitedAt=V.ts)}catch(q){I0={error:q}}finally{try{vn&&!vn.done&&(xv=Pn.return)&&xv.call(Pn)}finally{if(I0)throw I0.error}}return this._dispatcher.dispatch(new Ve({channels:[Bt],context:{source:G.EVENT_CHANNEL_INVITED,inviter:cn,invitees:Un}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Bt,cn,Un)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(V.channelUrl,!0)];case 50:return Ot=Qe.sent(),On=t.as(uk),rn=On.memberCount,sn=On.joinedMemberCount,kn=On.inviter,yn=On.invitee,Ot.isExclusive||Ot.isSuper||Ot.isBroadcast?Ot._setLatestMemberCount(rn,sn,V.ts):Ot.removeMember(yn),this._sdkState.userId===yn.userId?(Ot.invitedAt=0,Ot.myMemberState=Gt.NONE,Ot.isPublic?this._dispatcher.dispatch(new Ve({channels:[Ot],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})):this._dispatcher.dispatch(new bs({channelUrls:[Ot.url],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}}))):this._dispatcher.dispatch(new Ve({channels:[Ot],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(Ot,kn,yn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(V.channelUrl,!0)];case 52:return It=Qe.sent(),Rn=V.category===Xt.TYPING_START,or=t.as(Rn?pk:mk).user,It._updateTypingStatus(or,Rn?V.ts:0),this._dispatcher.dispatch(new Ve({channels:[It],context:{source:G.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(It)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(V.channelUrl,!0)];case 54:dn=Qe.sent(),En=V.category===Xt.USER_CHANNEL_MUTE,(bn=t.as(En?$M:zM).user).userId===this._sdkState.userId&&(dn.myMutedState=En?ss.MUTED:ss.UNMUTED,dn._myMutedRemainingTime=bn.restrictionInfo.remainingDuration);try{for(Ut=pe(dn.members),Cn=Ut.next();!Cn.done;Cn=Ut.next())if((Yt=Cn.value).userId===bn.userId){Yt.isMuted=En;break}}catch(q){A0={error:q}}finally{try{Cn&&!Cn.done&&(Ov=Ut.return)&&Ov.call(Ut)}finally{if(A0)throw A0.error}}return this._dispatcher.dispatch(new Ve({channels:[dn],context:{source:En?G.EVENT_CHANNEL_MUTED:G.EVENT_CHANNEL_UNMUTED,user:bn}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){En?j.onUserMuted&&j.onUserMuted(dn,bn):j.onUserUnmuted&&j.onUserUnmuted(dn,bn)}),[2]})})}),[3,77];case 55:return(Hn=this._leftChannels.get(V.channelUrl))?(ar=Hn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(V.channelUrl,!0)];case 57:ar=Qe.sent(),Qe.label=58;case 58:return jn=ar,this._markAsLeave(jn),Le=t.as(qM).user,Le.userId===this._sdkState.userId&&this._dispatcher.dispatch(new bs({channelUrls:[jn.url],context:{source:G.EVENT_CHANNEL_BANNED,user:Le}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(jn,Le)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(V.channelUrl,!0)];case 60:return F=Qe.sent(),he=t.as(KM).user,he.userId===this._sdkState.userId&&this._dispatcher.dispatch(new bs({channelUrls:[F.url],context:{source:G.EVENT_CHANNEL_UNBANNED,user:he}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,he)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(V.channelUrl,!0)];case 62:return Me=Qe.sent(),Ge=t.as(QM).freeze,Me.isFrozen=Ge,this._dispatcher.dispatch(new Ve({channels:[Me],context:{source:Ge?G.EVENT_CHANNEL_FROZEN:G.EVENT_CHANNEL_UNFROZEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){Ge?j.onChannelFrozen&&j.onChannelFrozen(Me):j.onChannelUnfrozen&&j.onChannelUnfrozen(Me)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(V.channelUrl,!0)];case 64:return vt=Qe.sent(),hn=t.as(hk),Qn=hn.allowAutoUnhide,Yn=hn.hidePreviousMessages,gs=hn.messageOffsetTimestamp,Qn!==null&&(vt.hiddenState=Qn?dr.HIDDEN_ALLOW_AUTO_UNHIDE:dr.HIDDEN_PREVENT_AUTO_UNHIDE),Yn!==null&&Yn&&vt._updateUnreadCount(0,0),gs!==null&&(vt.messageOffsetTimestamp=gs),this._dispatcher.dispatch(new Ve({channels:[vt],context:{source:G.EVENT_CHANNEL_HIDDEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(vt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(V.channelUrl,!0)];case 66:return(Bn=Qe.sent()).hiddenState=dr.UNHIDDEN,this._dispatcher.dispatch(new Ve({channels:[Bn],context:{source:G.EVENT_CHANNEL_UNHIDDEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Bn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(V.channelUrl,!0)];case 68:return ja=Qe.sent(),this._dispatcher.dispatch(new bs({channelUrls:[V.channelUrl],context:{source:G.EVENT_CHANNEL_DELETED}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(ja.url,ja.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(V.channelUrl,!0)];case 70:return Ba=Qe.sent(),this._dispatcher.dispatch(new Ve({channels:[Ba],context:{source:G.EVENT_CHANNEL_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Ba)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(V.channelUrl,!0)];case 72:return Yi=Qe.sent(),ed=t.as(OM),$a=ed.created,Ga=ed.updated,za=ed.deleted,$a&&(Yi._upsertCachedMetaData($a,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_CREATED,metaData:$a}}))),Ga&&(Yi._upsertCachedMetaData(Ga,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_UPDATED,metaData:Ga}}))),za&&(Yi._removeFromCachedMetaData(za,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:za}}))),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){$a&&j.onMetaDataCreated&&j.onMetaDataCreated(Yi,$a),Ga&&j.onMetaDataUpdated&&j.onMetaDataUpdated(Yi,Ga),za&&j.onMetaDataDeleted&&j.onMetaDataDeleted(Yi,za)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(V.channelUrl,!0)];case 74:return Po=Qe.sent(),td=t.as(FM),Yl=td.created,Zl=td.updated,Xl=td.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}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){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(V.channelUrl,!0)];case 76:return zs=Qe.sent(),nd=t.as(vk),Tv=nd.pinnedMessageIds,wv=nd.latestPinnedMessage,(Nv=nd.ts)>zs._pinnedMessagesUpdatedAt&&(zs.pinnedMessageIds=Tv,zs.lastPinnedMessage=wv,zs._pinnedMessagesUpdatedAt=Nv,this._dispatcher.dispatch(new Ve({channels:[zs],context:{source:G.EVENT_PINNED_MESSAGE_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(zs)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(zs)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((E0=t.as(AS).event).category){case Uc.USER_BLOCK:b0=hf.getDataAsUserBlockEvent(this._iid,E0),rd=b0.blocker,id=b0.blockee,this._groupChannelCache.block(rd.userId,id.userId);break;case Uc.USER_UNBLOCK:C0=hf.getDataAsUserBlockEvent(this._iid,E0),rd=C0.blocker,id=C0.blockee,this._groupChannelCache.unblock(rd.userId,id.userId)}return[3,79];case 79:return[3,81];case 80:if(S0=Qe.sent(),Lr(S0))throw S0;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===Gt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:Y(R("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 v(this,function(u){switch(u.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),i=new ym({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),o=s.as(Em).channel,a=o.unreadMessageCount,l=o.unreadMentionCount,o.myCountPreference){case ni.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case ni.UNREAD_MENTION_COUNT_ONLY:a=0;break;case ni.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 v(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new ym({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return o=c.sent(),(a=o.as(Em).channel).myMemberState!==Gt.NONE?[3,2]:(this._dispatcher.dispatch(new bs({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!==Te.NON_AUTHORIZED&&u.code!==Te.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new bs({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 v(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 HO(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(jO),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 v(this,function(f){switch(f.label){case 0:return s=M(M({},pf),r),Y((R("string",t)||R("number",t))&&vm(s)).throw(L.invalidParameters),o=new PO(Ie({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(FO),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 bs({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 v(this,function(o){switch(o.label){case 0:return r=M(M({},xS),t),Y(OS(r)).throw(L.invalidParameters),i=new BO({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),[2,s.as($O).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,g,_;return v(this,function(E){switch(E.label){case 0:return r=M(M({},kO),t),Y(function(S){return We(Tn,S.keys)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new GO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=E.sent(),u=l.as(zO),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,g=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,ye({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:g,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new VO({userId:r.userId}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(qO).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return v(this,function(u){switch(u.label){case 0:return r=M(M({},RO),t),Y(LO(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new WO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(KO).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o;return v(this,function(a){switch(a.label){case 0:return r=M(M({},DO),t),Y(function(l){return R("string",l.channelUrl,!0)&&We(lo,l.scheduledStatus,!0)&&$e(tr,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new QO(r),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(YO).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 v(this,function(a){switch(a.label){case 0:return r=M(M({},mh),t),Y(gm(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new XO(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),o=s.as(JO).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 v(this,function(c){switch(c.label){case 0:return t=Date.now(),Y(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new fy({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=pe(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 v(this,function(h){switch(h.label){case 0:return r=Date.now(),Y(We("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new fy({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,o=[];try{for(a=pe(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 v(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 v(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 v(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=yS),a===void 0&&(a=!0),y(this,void 0,void 0,function(){return v(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 v(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 v(this,function(o){switch(o.label){case 0:return[4,this._messageCache.countBetween(t,r,new ls({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 v(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 v(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(SO),Xr=function(e,n){return n instanceof Ft?e.findIndex(function(t){return t instanceof Ft&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},cu=function(e,n){return e.findIndex(function(t){return t instanceof hr?t.messageId===n:t instanceof Na?t.notificationId===n:void 0})},xp=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"})(ws||(ws={}));var _f,Oo=function(e){function n(t,r,i,s){var o=e.call(this)||this;return o._state=ws.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===ws.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===ws.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===ws.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 v(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(W){return W.createdAt}),!((x=this._metadata)===null||x===void 0)&&(w=x.range).intersect.apply(w,De([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new ls({top:Math.min.apply(Math,De([],Ae(E),!1)),bottom:Math.max.apply(Math,De([],Ae(E),!1))}),previousComplete:!1}),g.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(g.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(H){return H.createdAt}),!((I=this._metadata)===null||I===void 0)&&(w=I.range).intersect.apply(w,De([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new ls({top:Math.min.apply(Math,De([],Ae(E),!1)),bottom:Math.max.apply(Math,De([],Ae(E),!1))}),previousComplete:!1}),g.hasNext=_.length>=this._limit,this._metadata&&(g.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",g),[4,this.saveMetadata()];case 4:return z.sent(),[3,7];case 5:throw S=z.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new $t({type:Et.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,g]}})})}),this._connectionEventContext=h.on(function(b){b instanceof _i&&(b.stateType===rt.CONNECTED?o.resume():o.pause())})}return e.of=function(n,t){return Di[n]||(Di[n]={}),Di[n][t.url]||(Di[n][t.url]=new e({_iid:n,channel:t})),Di[n][t.url].ref++,Di[n][t.url]},e.clear=function(n,t){Di[n]&&Di[n][t]&&(Di[n][t].close(),delete Di[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 ls({})},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,De([],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,De([],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 v(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 ls(t.range),previousComplete:t.previousComplete}:{range:new ls({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return v(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 v(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 Di[this._iid][this._channel.url])},e}(),Ui={},Ck=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 Oo(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,g,_,E,S;return v(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,g=p.hasMore,_=p.token,f.hasNext=g,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===rt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Ui[n]||(Ui[n]={}),Ui[n][t.url]||(Ui[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),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])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(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 v(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 v(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 Ui[this._iid][this._channel.url])},e}(),jo={},Sk=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 Oo(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,g,_,E,S;return v(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,sf.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=w.sent(),g=b.hasMore,_=b.token,f.hasNext=g,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===rt.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 v(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 v(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 v(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}(),Tk=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=Z.GET,f.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=ye({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}(J),wk=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 yr(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 yr(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}(se),py={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(_f||(_f={}));var oc,ac,lc,Nk=function(){function e(){this._onCacheResult=qe,this._onApiResult=qe}return e.prototype._invokeResponse=function(n,t,r){var i=this;Re(function(){return y(i,void 0,void 0,function(){return v(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}(),Ik=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(js()),this._isDisposed=!1,this.filter=r??new _s,this._channel=l,this._syncRange=new ls({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||yS,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(g,_){var E=_.source,S=g.findIndex(function(w){return w.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(g[S]),h.channel._runIfHandleableWithGroupChannel(function(w){switch(E){case G.EVENT_CHANNEL_UPDATED:for(var N=!1,A=0;A=w.messageOffsetTimestamp){N=!0;var k=A;if(k>0){var I=h._messages.splice(0,k);h._removeMessagesFromView(I.map(function(z){return h.keyOf(z)}),G.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(z){return h.keyOf(z)}),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()}Re(function(){return y(h,void 0,void 0,function(){var z;return v(this,function(H){return gh(E)&&(!((z=this._handler)===null||z===void 0)&&z.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(g[S],E))},onRemove:function(g,_){var E=g.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),Re(function(){return y(h,void 0,void 0,function(){var S;return v(this,function(w){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(g[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(g,_){var E,S,w=[],N=[];try{for(var A=pe(g),k=A.next();!k.done;k=A.next()){var I=k.value;I.channelUrl===h._channel.url&&(h.filter.match(I)?w.push(I):N.push(h.keyOf(I)))}}catch(x){E={error:x}}finally{try{k&&!k.done&&(S=A.return)&&S.call(A)}finally{if(E)throw E.error}}if(Ts(_)){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(g,_)},onRemove:function(g,_){h._removeMessagesFromView(g,_),h._postprocessMessageRemoveEvent(g)},onRemoveUnsent:function(g,_){h._removeUnsentMessageFromView(g,_)},onPollChangeLogUpdate:function(g,_){h._updatePollsToView(g,_)},onPollUpdate:function(g,_){h._applyPollUpdateEventToView(g,_)},onPollVote:function(g,_){h._applyPollVoteEventToView(g,_)},onReactionUpdate:function(g,_){h._applyReactionEventToView(g,_)},onThreadInfoUpdate:function(g,_){h._applyThreadInfoEventToView(g,_)}});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=bk.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=Ck.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=Sk.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new Oo(this._key,function(g){return y(h,void 0,void 0,function(){var _,E,S,w,N,A,k;return v(this,function(I){switch(I.label){case 0:return[4,this._getRemoteMessages(g,{prevLimit:this._prevResultLimit,source:G.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=I.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(w=Math.min.apply(Math,De([],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,De([],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 $t({type:Et.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(k=(A=p.localCacheConfig)===null||A===void 0?void 0:A.maxSize)!==null&&k!==void 0?k:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(g){if(g instanceof _i)switch(g.stateType){case rt.CONNECTED:kt(function(){return y(h,void 0,void 0,function(){return v(this,function(_){return this._activate(),[2]})})});break;case rt.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:Et.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 De([],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,De(De([],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,De(De([],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 v(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 hr&&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=pe(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&&Ts(t)&&Re(function(){return y(s,void 0,void 0,function(){var h,f,p;return v(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)&&Ts(t)&&Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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)&&Ts(t)&&Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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())&&Ts(t)&&(s.applyReactionEvent(n),Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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())&&Ts(t)&&(s.applyThreadInfoUpdateEvent(n),Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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=pe(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 Ts(t)&&a.length>0&&Re(function(){return y(s,void 0,void 0,function(){var h,f,p;return v(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 v(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,De(De(De([],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 v(this,function(g){switch(g.label){case 0:return m=An.of(this._iid),i>0||o>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ie(M(M(M({},this.filter),py),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:o})),l,h,p)]:[3,2];case 1:return b=g.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},g.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,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q=this;return v(this,function($){switch($.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=$.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:g=$.sent(),$.label=3;case 3:return $.trys.push([3,5,6,7]),[4,s0(function(){return y(Q,void 0,void 0,function(){var Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de=this;return v(this,function(fe){switch(fe.label){case 0:return Ne=new Tk(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:g,checkingContinuousMessages:u.localCacheEnabled},this.filter),py)),[4,l.send(Ne)];case 1:return X=fe.sent(),ae=X.as(wk),ne=ae.isHugeGap,Ce=ae.prevMessages,K=Ce===void 0?[]:Ce,ie=ae.prevHasMore,ee=ae.isContinuousPrevMessages,ue=ae.nextMessages,P=ue===void 0?[]:ue,xe=ae.nextHasmore,B=ae.isContinuousNextMessages,ne?Re(function(){return y(de,void 0,void 0,function(){var ve;return v(this,function(_e){return!((ve=this._handler)===null||ve===void 0)&&ve.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(te=this.viewTop,oe=this.viewBottom,me=Math.min.apply(Math,De([Number.MAX_SAFE_INTEGER,te],Ae(K.map(function(ve){return ve.createdAt})),!1)),re=Math.max.apply(Math,De([0,oe],Ae(P.map(function(ve){return ve.createdAt})),!1)),a.dispatch(new bt({messages:K,source:G.SYNC_MESSAGE_FILL})),a.dispatch(new bt({messages:P,source:G.SYNC_MESSAGE_FILL})),this._syncRange.extends(me,re),(ee||B)&&((ce=this._backgroundSync)===null||ce===void 0||ce.range.extends(me,re)),ie&&this._prevFill.start(me),xe&&this._nextFill.start(re)),[2]}})})},1)];case 4:return $.sent(),[3,7];case 5:return _=$.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new $t({type:Et.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(),$.label=9;case 9:return $.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=$.sent(),w=S.messages,N=S.isContinuousMessages,A=S.hasNext,w.length>0){for(k=w.map(function(Ne){return Ne.createdAt}),I=0,x=0,U=0;U=E&&x++;this._hasPrevious=I>=this._prevResultLimit,this._hasNext=A??x>=this._nextResultLimit,(W=this._syncRange).extends.apply(W,De([],Ae(k),!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(H=$.sent())instanceof L&&H.code===Te.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new $t({type:Et.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 v(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 v(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;kt(function(){return y(t,void 0,void 0,function(){return v(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 v(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=ss.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 Nk;this._messages=[],this._unsentMessages=[],this._syncRange=new ls({}),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===_f.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 v(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,g=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}),A=0,k=0;for(w=0;wt._startingPoint&&k++}t._hasPrevious=A>=t._prevResultLimit,t._hasNext=g??k>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,De([],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 $t({type:Et.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 $t({type:Et.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:Et.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 v(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Te.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,kt(function(){return y(h,void 0,void 0,function(){var p;return v(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 $t({type:Et.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,kt(function(){return y(h,void 0,void 0,function(){var p,m,b,g,_,E,S,w=this;return v(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,De([],Ae(u.map(function(A){return A.createdAt})),!1)),!((g=this._backgroundSync)===null||g===void 0)&&g.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(A){return Xr(w._messages,A)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&o.put(new $t({type:Et.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 v(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Te.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,kt(function(){return y(h,void 0,void 0,function(){var p;return v(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 $t({type:Et.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,kt(function(){return y(h,void 0,void 0,function(){var p,m,b,g,_,E,S,w,N=this;return v(this,function(A){switch(A.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=A.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,De([],Ae(u.map(function(k){return k.createdAt})),!1)),!((g=this._backgroundSync)===null||g===void 0)&&g.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(k){return Xr(N._messages,k)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&o.put(new $t({type:Et.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 v(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Te.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!==Gt.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}(),Ak=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 kt(function(){return y(r,void 0,void 0,function(){var i;return v(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 v(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,kt(function(){return y(t,void 0,void 0,function(){var i;return v(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=pe(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=Xr(this._messages,h))<0){Xr(this._unsentMessages,h)<0&&l.push(h);var f=xp(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Ft&&(b=Xr(this._unsentMessages,h))<0&&Xr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=Xr(this._messages,h))<0){var p=Xr(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=xp(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,De([],Ae(m),!1))}}else if(h instanceof Ft){var b;(b=Xr(this._unsentMessages,h))<0?Xr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(g){i={error:g}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}Ts(r)&&Re(function(){return y(o,void 0,void 0,function(){var g,_,E,S,w;return v(this,function(N){return g={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,g,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,g,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,o=this,a=[],l=[],u=[];try{for(var c=pe(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=Xr(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=Xr(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=xp(this._messages,f);this._messages.splice(b,0,f)}}else{var g=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,De([],Ae(g),!1))&&!this._hasNext)&&a.push(f)}}else f instanceof Ft&&(h=Xr(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 Ts(r)&&Re(function(){return y(o,void 0,void 0,function(){var _,E,S,w,N;return v(this,function(A){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}(Ik),Mk={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},xk=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=Z.GET,r.path="".concat(sr,"/").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}(J),Ok=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 si(t,a)})),i}return T(n,e),n}(se);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(oc||(oc={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(ac||(ac={})),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"}(lc||(lc={}));var kk=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=oc.ALL,u.memberStateFilter=lc.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=ff.ALL,u.order=ac.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:oc.ALL,u.memberStateFilter=(o=i.memberStateFilter)!==null&&o!==void 0?o:lc.ALL,u.nicknameStartsWithFilter=(a=i.nicknameStartsWithFilter)!==null&&a!==void 0?a:null,u.order=(l=i.order)!==null&&l!==void 0?l:ac.MEMBER_NICKNAME_ALPHABETICAL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&$e(oc,this.mutedMemberFilter)&&$e(lc,this.memberStateFilter)&&(R("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&$e(ff,this.operatorFilter)&&$e(ac,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 xk(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Ok),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}($s),Rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(J),Lk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Gt.JOINED,i}return T(n,e),n}(se),Dk=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=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i)),r.params=ye({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}(J),Uk=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}(se),Pk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(sr,"/").concat(encodeURIComponent(i)),r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var Fk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/hide"),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var Hk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),o.params={count_preference:s},o}return T(n,e),n}(J),jk=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}(se),Bk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return T(n,e),n}(J),$k=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}(se),Gk=M(M({},ev),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),zk=M(M({},hS),{scheduledAt:void 0}),Vk=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===rr.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=Z.PUT,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=ye(Ie({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 Gs.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 _r.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return T(n,e),n}(J),qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jt(t,r),i}return T(n,e),n}(se),Wk=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===rr.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=Z.PUT,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=ye(Ie({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 _r.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}T(n,e)})(se);var Kk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Z.DELETE,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J),Qk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Z.POST,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o),"/send_now"),r}return T(n,e),n}(J),Yk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,o=e.call(this)||this;return o.method=Z.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}(J),Zk=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}(se),Xk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J),Jk=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}(se),eR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Z.POST,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var tR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Z.DELETE,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var ni,dr,nR=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=yr(t,r.message),i}return T(n,e),n}(Kn),rR=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=Z.GET,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=ye({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}(J),iR=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 nR(t,l)}),i.hasMore=o,i.token=a,i}return T(n,e),n}(se),sR=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)&&R("boolean",this.includeMetaArray,!0)&&R("boolean",this.includeReactions,!0)&&R("boolean",this.includeParentMessageInfo,!0)&&R("boolean",this.includeThreadInfo,!0)&&R("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 v(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 rR(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(iR),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}($s);(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"})(ni||(ni={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(dr||(dr={}));var di=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I=this;return(I=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,I._undeliveredMemberStateMap=new Map,I._typingStatus=new Map,I._lastMemberCountUpdated=0,I._typingStarted=0,I._typingEnded=0,I.isDistinct=!1,I.isSuper=!1,I.isBroadcast=!1,I.isExclusive=!1,I.isPublic=!1,I.isDiscoverable=!0,I.isChatNotification=!1,I.isAccessCodeRequired=!1,I.isPushEnabled=!1,I.unreadMessageCount=0,I.unreadMentionCount=0,I.totalUnreadReplyCount=0,I.members=[],I.memberCount=0,I.joinedMemberCount=0,I.hiddenState=dr.UNHIDDEN,I.lastMessage=null,I.messageOffsetTimestamp=0,I.messageSurvivalSeconds=-1,I.myMemberState=Gt.NONE,I.myRole=Ni.NONE,I.myMutedState=ss.UNMUTED,I.myLastRead=0,I.myCountPreference=ni.ALL,I.myPushTriggerOption=ta.DEFAULT,I.inviter=null,I.invitedAt=0,I.joinedAt=0,I.pinnedMessageIds=[],I.lastPinnedMessage=null,I._pinnedMessagesUpdatedAt=0,I._myMutedRemainingTime=-1,I.channelType=Ze.GROUP,I.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,I.isSuper=(o=r.is_super)!==null&&o!==void 0&&o,I.isBroadcast=(a=r.is_broadcast)!==null&&a!==void 0&&a,I.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,I.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,I.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:I.isPublic,I.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,I.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,I.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=I.members).push.apply(i,De([],Ae(r.members.map(function(x){return new si(I._iid,x)})),!1)),I.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,I.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,I.hiddenState=$e(dr,r.hidden_state)?r.hidden_state:dr.UNHIDDEN,I.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,I.messageSurvivalSeconds=(g=r.message_survival_seconds)!==null&&g!==void 0?g:-1,I.lastMessage=r.last_message?yr(I._iid,M({channel_type:I.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(x){R("number",r.read_receipt[x])&&I._updateUnreadMemberState(x,r.read_receipt[x])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(x){R("number",r.delivery_receipt[x])&&I._updateUndeliveredMemberState(x,r.delivery_receipt[x])}),I.myMemberState=$e(Gt,r.member_state)?r.member_state:Gt.NONE,I.myRole=$e(Ni,r.my_role)?r.my_role:Ni.NONE,$e(ss,r.is_muted)?I.myMutedState=r.is_muted:R("boolean",r.is_muted)?I.myMutedState=r.is_muted?ss.MUTED:ss.UNMUTED:I.myMutedState=ss.UNMUTED,I.myCountPreference=$e(ni,r.count_preference)?r.count_preference:ni.ALL,I.myPushTriggerOption=$e(ta,r.push_trigger_option)?r.push_trigger_option:ta.ALL,I.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,I.inviter=r.inviter?new Ke(I._iid,r.inviter):null,I.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,I.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,I._updateUnreadCount((w=r.unread_message_count)!==null&&w!==void 0?w:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),I.totalUnreadReplyCount=(A=r.total_unread_thread_message_count)!==null&&A!==void 0?A:0,I.pinnedMessageIds=(k=r.pinned_message_ids)!==null&&k!==void 0?k:[],I.lastPinnedMessage=r.latest_pinned_message?yr(I._iid,M({channel_type:I.channelType},r.latest_pinned_message)):null,I}return T(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==dr.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=pe(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=pe(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 ye(Ie(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 si.payloadify(r)}),last_message:t.lastMessage?B1(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?B1(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 Ft&&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 Ft&&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===ni.ALL||this.myCountPreference===ni.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===ni.ALL||this.myCountPreference===ni.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 Qc(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new Ak(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new kk(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new mO(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new sR(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===Gt.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 si?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 Ft&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=O.of(this._iid).sdkState,o=t.createdAt,a=0;try{for(var l=pe(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===Gt.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 Ft?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 v(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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new ym({channelUrl:this.url}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(Em).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 v(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 v(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 v(this,function(c){switch(c.label){case 0:return r=M(M({},Mk),t),Y(function(d){return R("string",d.coverUrl,!0)&&(pr(d.coverImage)||R("string",d.coverImage,!0))&&R("boolean",d.isDistinct,!0)&&R("boolean",d.isPublic,!0)&&R("boolean",d.isDiscoverable,!0)&&R("string",d.accessCode,!0)&&R("string",d.name,!0)&&R("string",d.data,!0)&&R("string",d.customType,!0)&&We("string",d.operatorUserIds,!0)&&R("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.requestQueue,a=new Dk(M({channelUrl:this.url},r)),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Uk).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 v(this,function(r){return Y(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 v(this,function(c){switch(c.label){case 0:return Y(We("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.requestQueue,o=r.sessionManager,a=new sk({channelUrl:this.url,userIds:t}),[4,s.send(a)];case 1:return l=c.sent(),u=l.as(ok).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 v(this,function(c){switch(c.label){case 0:return Y(R("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new ek({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(tk).channel).myMemberState=this.myMemberState=Gt.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 v(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new rk({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(o)];case 1:return a.sent(),this.myMemberState=Gt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return v(this,function(c){switch(c.label){case 0:return Y(R("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Rk({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(Lk).channel).myMemberState=this.myMemberState=Gt.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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new lk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.myMemberState=Gt.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===dr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=dr.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 v(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 bt({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 fh,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 v(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 bt({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 v(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 Ft&&O.of(this._iid).dispatcher.dispatch(new VC({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 v(this,function(d){switch(d.label){case 0:return r=M(M({},bm),t),Y(function(h){return R("boolean",h.hidePreviousMessages,!0)&&R("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.sdkState,a=i.requestQueue,l=new ck(M({channelUrl:this.url,userId:o.userId},r)),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(dk).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?dr.HIDDEN_ALLOW_AUTO_UNHIDE:dr.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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Fk({channelUrl:this.url}),[4,i.send(s)];case 1:return o.sent(),this.hiddenState=dr.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 v(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new Pk({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 v(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 K6({channelUrl:this.url}),[4,s.send(o)];case 1:return a=c.sent(),l=a.as(iS).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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yk({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 v(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 fk({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 v(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 _k({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({},eO),t),Y(tO(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 v(this,function(l){switch(l.label){case 0:return i=M(M({},zk),r),Y(function(u){return fS(u)&&R("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new Wk(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(_S).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},nO),t),Y(rO(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),o=new Br;return Or(xx).then(function(){var a=r._createPendingScheduledFileMessage(t,s,i);Re(function(){return y(r,void 0,void 0,function(){return v(this,function(l){return[2,o._trigger(a)]})})})}),pr(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 v(this,function(a){switch(a.label){case 0:return i=M(M({},Gk),r),Y(function(l){return tv(l)&&R("number",l.scheduledAt,!0)&&(pr(l.file)||R("string",l.fileUrl))&&R("string",l.fileName,!0)&&R("string",l.mimeType,!0)&&R("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return R("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),pr(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:a.sent(),a.label=2;case 2:return s=new Vk(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(qk).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=new Kk({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 v(this,function(i){switch(i.label){case 0:return r=new Qk({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 v(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Xk({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Jk).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 v(this,function(c){switch(c.label){case 0:return Y($e(ta,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Yk({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Zk).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 v(this,function(c){switch(c.label){case 0:return Y($e(ni,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Hk({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(jk).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 v(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Bk({channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as($k).messageOffsetTimestamp,this.messageOffsetTimestamp=a,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new eR({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 v(this,function(s){switch(s.label){case 0:return Y(R("number",t)&&t>0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new tR({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 v(this,function(f){switch(f.label){case 0:return pr(t.file)?(r=O.of(this._iid).requestQueue,i=new of({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(af),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(Y(t instanceof Ft&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:lm(t),a=new Br;return this._sendUserMessage(o,Zn.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);Y(l).throw(L.invalidParameters),o=um(t,r);var u=new Br;return this._sendFileMessage(o,Zn.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 fh;return this._sendMultipleFilesMessage(o,Zn.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(Y(t instanceof ny&&r instanceof Ft&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){Y(!r.poll).throw(L.notSupportedError);var s=uS(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=dS(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=Ix(r);var l=new fh;return t._sendMultipleFilesMessage(s,Zn.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}(ny),oR=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},uc,Ws={},aR=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 Oo(h,function(){return y(s,void 0,void 0,function(){var f,p,m,b,g,_,E,S,w,N,A,k;return v(this,function(I){switch(I.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(I.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];I.label=2;case 2:if(I.trys.push([2,9,,12]),(p={includeEmpty:!0,order:jt.CHRONOLOGICAL}).order!==jt.LATEST_LAST_MESSAGE)return[3,6];I.label=3;case 3:return I.trys.push([3,5,,6]),[4,d.preference.get(Wg(l.appId))];case 4:return m=I.sent(),p.includeChatNotification=!!m,[3,6];case 5:return I.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannels((k=(A=this._metadata)===null||A===void 0?void 0:A.token)!==null&&k!==void 0?k:"",p,this._limit,G.SYNC_CHANNEL_BACKGROUND)];case 7:return b=I.sent(),g=b.channels,_=b.token,f.hasNext=g.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,De([],Ae(g.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 I.sent(),[3,12];case 9:return E=I.sent(),c.debug("channel background 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[3,14];case 13:f.hasNext=!1,f.nextToken="",I.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof _i&&(f.stateType===rt.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return Ws[n]||(Ws[n]=new e({_iid:n})),Ws[n].ref++,Ws[n]},e.clear=function(n){Ws[n]&&(Ws[n].close(),delete Ws[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 ls({})},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 v(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 ls(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 v(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 v(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 Ws[this._iid])},e}(),Ks={},lR=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 La;var c=function(d){return"sendbird:".concat(d,"@groupchannel/changelogs")}(a.userId);this._sync=new Oo(c,function(){return y(r,void 0,void 0,function(){var d,h,f,p,m,b,g,_,E,S,w,N;return v(this,function(A){switch(A.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:A.sent(),o.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),A.label=2;case 2:A.trys.push([2,9,,12]),h={includeEmpty:!0},A.label=3;case 3:return A.trys.push([3,5,,6]),[4,u.preference.get(Wg(a.appId))];case 4:return f=A.sent(),h.includeChatNotification=!!f,[3,6];case 5:return A.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=A.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,g=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:g,token:_}),d.hasNext=g,d.nextToken=_,this._metadata&&(this._metadata.token=_),o.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),o.debug("channel changelog 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[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof _i&&(d.stateType===rt.CONNECTED?r.resume():r.pause())})}return e.of=function(n){return Ks[n]||(Ks[n]=new e({_iid:n})),Ks[n].ref++,Ks[n]},e.clear=function(n){Ks[n]&&(Ks[n].close(),delete Ks[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 v(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 v(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 v(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 Ks[this._iid])},e}(),vh=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},_y=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:my(e[o],n,t)>=0?o:o+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},my=function(e,n,t){switch(t){case jt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?(r=n.lastMessage.createdAt-e.lastMessage.createdAt)===0?n.createdAt-e.createdAt:r:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case jt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case jt.CHANNEL_NAME_ALPHABETICAL:var r;return(r=e.name.localeCompare(n.name))===0?e.createdAt-n.createdAt:r;default:return 0}},uR=function(){function e(n,t){var r=t.filter,i=r===void 0?new MS:r,s=t.order,o=s===void 0?jt.LATEST_LAST_MESSAGE:s,a=t.limit,l=a===void 0?gS:a,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat(js()),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=aR.of(n),this._backgroundSync.resume()),this._changelogSync=lR.of(n),this._changelogSync.resume(),Nn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,g){var _=g.source;if(gh(_)){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,g),S.length>0&&d._removeChannelsFromView(S,g)}},onRemove:function(b,g){d._removeChannelsFromView(b,g)}}),O.of(this._iid).statManager.put(new Fl({type:Et.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof _i&&(b.stateType===rt.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return v(this,function(g){switch(g.label){case 0:return[4,this._revokeLoadMore()];case 1:return g.sent(),[2]}})}):b.stateType===rt.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=pe(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=_y(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===jt.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 g=pe(d),_=g.next();!_.done;_=g.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=g.return)&&a.call(g)}finally{if(o)throw o.error}}gh(t.source)&&Re(function(){return y(l,void 0,void 0,function(){var S,w,N;return v(this,function(A){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(k){return k.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=pe(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 gh(t.source)&&o.length>0&&Re(function(){return y(s,void 0,void 0,function(){var d;return v(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 v(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 jt.LATEST_LAST_MESSAGE:return(a=(o=i.lastMessage)===null||o===void 0?void 0:o.createdAt)!==null&&a!==void 0?a:i.createdAt;case jt.CHRONOLOGICAL:return i.createdAt;case jt.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 v(this,function(i){switch(i.label){case 0:return[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ie(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 v(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,g,_,E,S=this;return v(this,function(w){switch(w.label){case 0:if(this._isDisposed)throw new L({code:Te.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(A){return N(A)}).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,kt(function(){return y(S,void 0,void 0,function(){return v(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=pe(t.updatedChannels),l=a.next();!l.done;l=a.next())u=l.value,(m=vh(r,u))>=0?r[m]=u:(c=_y(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(g=a.return)&&g.call(a)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=pe(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}(),cR=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,g=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Z.GET,r.path=sr,r.params=ye(Ie({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:a,public_mode:ps.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:g,show_frozen:_,show_metadata:E})),r}return T(n,e),n}(J),dR=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}(se);(function(e){e.ALL="all",e.JOINED="joined"})(uc||(uc={}));var hR=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=uc.ALL,_.superChannelFilter=Ur.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=sc.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:uc.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=(g=r.order)!==null&&g!==void 0?g:sc.CHRONOLOGICAL,_}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&R("boolean",this.includeEmpty)&&R("boolean",this.includeFrozen)&&R("boolean",this.includeMetaData)&&R("string",this.channelNameContainsFilter,!0)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&R("string",this.customTypeStartsWithFilter,!0)&&$e(uc,this.membershipFilter)&&$e(Ur,this.superChannelFilter)&&$e(sc,this.order)&&R("string",this.metadataOrderKeyFilter,!0)&&R("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&R("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 v(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 cR(Ie(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(dR),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}(Do),rv=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}(oR)),fR=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=Z.GET,r.path="".concat(uC),r.params=ye(Ie({token:i,limit:s,reverse:a,channel_url:l,order:o,message_type:u,status:c})),r}return T(n,e),n}(J),pR=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 yr(t,a)}),i}return T(n,e),n}(se),_R=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=tr.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:tr.ALL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&R("string",this.channelUrl,!0)&&($e(mm,this.order)||this.order===null)&&R("boolean",this.reverse)&&(We(lo,this.scheduledStatus)||this.scheduledStatus===null)&&$e(tr,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 fR(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(pR),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}(Do),mR=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 uR(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new kS(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new hR(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new _R(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){Y(R("string",t)&&r instanceof rv).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){Y(R("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 v(this,function(r){return Y(R("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return Y(R("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 v(this,function(s){switch(s.label){case 0:return i=M(M({},pf),r),Y(R("string",t)&&vm(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},pf),r),Y(R("number",t)&&vm(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 v(this,function(i){return r=M(M({},xS),t),Y(OS(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 v(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 v(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 v(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 v(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 v(this,function(i){return r=M(M({},mh),t),Y(gm(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 v(this,function(i){return r=M(M({},mh),t),Y(gm(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 v(this,function(u){return l=M(M({},mh),{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 v(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return Y(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 v(this,function(r){switch(r.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(Yg);const mf={collection:{groupChannel:{defaultLimit:20,defaultOrder:jt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var gR=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 vR=(e,n)=>{D.useEffect(RS(e),n)},yR=(e,n)=>{D.useLayoutEffect(RS(e),n)},Op=e=>e(),RS=e=>()=>{const n=Op(e);return()=>{n&&(n instanceof Promise?Op(()=>gR(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):Op(n))}};let ER=0;function bR(){return D.useState(()=>`${ER++}`)[0]}const LS=(e,n,t)=>{const r=D.useRef(n),s=bR();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 rv)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function fn(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var CR=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 sf(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 v(this,function(i){return r=M(M({},B6),t),Y(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 v(this,function(i){return r=M(M({},G6),t),Y(ZC(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 v(this,function(i){return r=M(M({},$6),t),Y(YC(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(Yg),SR=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},gy=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),DS=function(e){this.key=e.key,this.url=e.url},US=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 DS(n)}):[]},TR=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new US(n)}):[]},wR={profileImage:void 0,profileUrl:void 0,nickname:void 0},vy=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,o;return v(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 v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:vS,keyName:Ex,index:[_h(jt.LATEST_LAST_MESSAGE),_h(jt.CHRONOLOGICAL),_h(jt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:hm,keyName:bx,index:[cs(Vn.CHANNEL_LATEST),cs(Vn.NEWEST_CHILD_MESSAGE)]},{collectionName:CS,keyName:iO,index:[cs(Vn.CHANNEL_LATEST),cs(Vn.NEWEST_CHILD_MESSAGE)]},{collectionName:Sx,keyName:Tx}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:wx,keyName:Nx,index:[SR()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:ES,keyName:Cx,index:[Jx()]}])];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(hm).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]}})})}},NR=function(){return typeof document<"u"?document.visibilityState:"visible"},IR=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?NR: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}(La),AR=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 v(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Z.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),yy=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=Z.PUT,l.path="".concat(Xe,"/").concat(encodeURIComponent(r)),l.params=ye(Ie({nickname:i,profile_url:s,profile_file:o,preferred_languages:a})),l}return T(n,e),n}(J),Ey=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}(se),MR=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=Z.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=ye({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(J);(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)})(se);var xR=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=Z.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=ye({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(J);(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)})(se);var OR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(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)})(se);var kR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(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)})(se);var RR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),i}return T(n,e),n}(J);(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)})(se);var LR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return T(n,e),n}(J);(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)})(se);var DR=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=Z.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}(J),UR=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}(se),PR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return T(n,e),n}(J),FR=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}(se),HR=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return T(n,e),n}(J),jR=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}(se),BR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),$R=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}(se),GR=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=Z.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}(J),zR=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}(se),VR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),qR=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}(se),WR=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=Z.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}(J),KR=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}(se),QR=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return T(n,e),n}(J);(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)})(se);var YR=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ZR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),XR=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}(se),JR=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return T(n,e),n}(J),eL=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}(se),tL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),i}return T(n,e),n}(J),nL=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}(se),rL=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return T(n,e),n}(J),iL=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}(se),sL=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return T(n,e),n}(J),oL=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}(se),aL=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Z.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}(J),lL=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}(se),uL=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var cL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(J),dL=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}(se),hL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var fL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return T(n,e),n}(J),pL=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}(se),_L=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var gf,mL=function(e){function n(){var t=e.call(this)||this;return t.method=Z.GET,t.path=lC,t}return T(n,e),n}(J),gL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new TR(r),i}return T(n,e),n}(se),vL=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(lC,"/").concat(r),i}return T(n,e),n}(J),yL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new US(r),i}return T(n,e),n}(se),EL=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Z4,"/").concat(r),i}return T(n,e),n}(J),bL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new DS(r),i}return T(n,e),n}(se),CL=function(e){function n(){var t=e.call(this)||this;return t.method=Z.GET,t.path="".concat(X4),t}return T(n,e),n}(J),SL=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}(se);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(gf||(gf={}));var du,by=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=Z.POST,d.path=eA,d.params=ye({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}(J),TL=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 AR({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,g,_,E,S;return v(this,function(w){switch(w.label){case 0:if(m=O.of(n),b=m.sdkState,g=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,g.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,g.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 gy),[2]}})})},disconnect:function(){kt(function(){return y(i,void 0,void 0,function(){return v(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 IR({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===rt.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof gt){if(m.code==="USEV"){var g=m.as(AS).event;if(g.category===Uc.FRIEND_DISCOVERED){var _=hf.getDataAsFriendDiscoveredEvent(n,g).friendDiscoveries;Re(function(){return y(i,void 0,void 0,function(){return v(this,function(N){return[2,h.forEach(function(A){A.onFriendsDiscovered&&A.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof RC){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&&Re(function(){return y(i,void 0,void 0,function(){return v(this,function(N){return[2,h.forEach(function(A){A.onTotalUnreadMessageCountChanged&&A.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),A.onTotalUnreadMessageCountUpdated&&A.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof UC?(a.preference.set(i._getUserProfileCacheKey(o.userId),rm.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&a.preference.set(Wg(i.appId),{value:!0})):m instanceof Ul&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i._internalDisconnect(m.error))})}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 sC: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,g=n.localCacheConfig,_=g===void 0?new aC:g,E=n.localCacheEncryption,S=n.useAsyncStorageStore,w=S===void 0?null:S,N=n.useMMKVStorageStore,A=N===void 0?null:N,k=n.appStateToggleEnabled,I=k===void 0||k;if(!du||f){var x="su-".concat(js()),U=E??{encrypt:function($){return $},decrypt:function($){return $}},z=new Xx;z.level=p??As.WARN;var H=new Yo({encryption:U});u||(X_()?A?H=new Yx({MMKV:A,encryption:U}):w&&(H=new Qx({AsyncStorage:w,encryption:U}),z.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):H=new Kx({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:H,encryption:U,logger:z,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:I});var W=[new yO,new CR],Q=new e(x,a,De(De([],Ae(s),!1),Ae(W),!1));return du||(du=Q),Q}return du},Object.defineProperty(e,"instance",{get:function(){return du},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return rC},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?as.OPEN:n.isConnecting?as.CONNECTING:as.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._internalDisconnect=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.connectionManager,i=t.sdkState,s=t.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),s.cancelAll(),[4,r.logout(n)];case 1:return o.sent(),[4,this.clearCachedData()];case 2:return o.sent(),i.appState="foreground",[2]}})})},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(sA);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=pe(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 v(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 v(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!==ns.CLOSED&&i.nestdb.name===a?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new Zx({name:l,version:this._getNestDBVersion(),store:i.store,config:new Zc({dbname:l,itemSizeLimit:61440})})).on("upgrade",vy(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",vy(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new NS(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 v(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 v(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 v(this,function(s){switch(s.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=Sl.of(this._iid),r=Aa.of(this._iid),t&&r?[4,Promise.all(n.map(function(o){return y(i,void 0,void 0,function(){return v(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 v(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 rm(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 v(this,function(c){switch(c.label){case 0:return Y(R("string",n)&&R("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 IS),[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 v(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(xc.CHAT)?[3,3]:(t||s.handler||(a=new cf,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 v(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(){return v(this,function(n){switch(n.label){case 0:return[4,this._internalDisconnect()];case 1:return n.sent(),[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return v(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 gy))},e.prototype.setSessionHandler=function(n){Y(n instanceof cf).throw(L.invalidParameters),O.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){Y(R("string",n)&&t instanceof Ox).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){Y(R("string",n)&&t instanceof bS).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 Lx(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new Px(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new jx(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new fO(this._iid,n)},e.prototype.createPollListQuery=function(n){return new XC(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new JC(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 v(this,function(u){switch(u.label){case 0:return t=M(M({},wR),n),Y(function(c){return pr(c.profileImage,!0)&&R("string",c.profileUrl,!0)&&R("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new yy(M({userId:i.userId},t)),[4,s.send(o)]):[3,2];case 1:return a=u.sent(),l=a.as(Ey).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 v(this,function(l){switch(l.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),this.currentUser?(t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yy({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return o=l.sent(),a=o.as(Ey).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 v(this,function(h){switch(h.label){case 0:if(Y(R("string",n)&&R("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Y($e(ao,t.deviceOS.platform,!0)&&R("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)||ao.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 xR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,kt(function(){return y(d,void 0,void 0,function(){return v(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 v(this,function(u){switch(u.label){case 0:if(Y(R("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 kR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,kt(function(){return y(l,void 0,void 0,function(){return v(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 v(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 LR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,kt(function(){return y(a,void 0,void 0,function(){return v(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 v(this,function(h){switch(h.label){case 0:if(Y(R("string",n)&&R("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Y($e(ao,t.deviceOS.platform,!0)&&R("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)||ao.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 MR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,kt(function(){return y(d,void 0,void 0,function(){return v(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 v(this,function(u){switch(u.label){case 0:if(Y(R("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 OR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,kt(function(){return y(l,void 0,void 0,function(){return v(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 v(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 RR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,kt(function(){return y(a,void 0,void 0,function(){return v(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,g,_,E,S,w,N;return v(this,function(A){switch(A.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=gf.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,g=c.notificationEventDeadline,!f||!h.includes(rf.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 by({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:g,allowedPushNotification:E}),f&&(w.headers["Session-Key"]=f),A.label=1;case 1:return A.trys.push([1,3,,4]),[4,a.send(w)];case 2:return A.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=A.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,g,_,E;return v(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=gf.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(rf.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];g=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new by({deviceToken:g??"",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 v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new PR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,{autoAccept:s.as(FR).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(R("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new HR({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,{autoAccept:o.as(jR).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new BR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as($R).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 v(this,function(h){switch(h.label){case 0:return Y(R("boolean",n)&&R("number",t)&&R("number",r)&&R("number",i)&&R("number",s)&&R("string",o)).throw(L.invalidParameters),a=O.of(this._iid),l=a.sdkState,u=a.requestQueue,c=new GR({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(zR).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new VR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(qR).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 v(this,function(u){switch(u.label){case 0:return Y(R("boolean",n)&&R("number",t)&&R("number",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new WR({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(KR).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 v(this,function(m){switch(m.label){case 0:return Y(R("string",n)&&$e(In,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=r.sessionManager,a=new DR({userId:i.userId,type:t,token:n}),[4,s.send(a)];case 1:l=m.sent(),u=l.as(UR).pushTokens;try{for(c=pe(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 v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new ZR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(XR).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y($e(ta,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new JR({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,o.sent().as(eL).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new tL({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(nL).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y($e(W_,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new rL({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,o.sent().as(iL).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y(n instanceof Ke||R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new QR({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 v(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 v(this,function(o){switch(o.label){case 0:return Y(n instanceof Ke||R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new YR({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 v(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 v(this,function(a){switch(a.label){case 0:return Y(R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new sL({userId:r.userId,token:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(oL).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new fL({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(pL).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y(R("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new _L({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 v(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new aL({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(lL).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return v(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 v(this,function(o){switch(o.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new uL({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 v(this,function(a){switch(a.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new cL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(dL).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return v(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 v(this,function(o){switch(o.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new hL({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 v(this,function(i){switch(i.label){case 0:return n=O.of(this._iid).requestQueue,t=new mL,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(gL).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return v(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new vL({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(yL).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return v(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new EL({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(bL).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),Y(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new CL,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(SL).uikitConfiguration]}})})},e}();function wL(e,n){return!e||!n?!0:e.url!==n.url}function Ma(e){return e!=null&&"sendingStatus"in e}function vf(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return Ma(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function NL(e,n){return vf(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function Cy(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function et(e){return typeof e=="boolean"}function Qa(e,n){return n.includes(e)}function IL(e){return e instanceof Set}function Sy(e){return!e||!Array.isArray(e)?!1:e.length!==0}function AL(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const ML=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function Cm(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>Cm(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=Cm(e[t])}),n}function Ty(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var xL=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=xL(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=wy(n.value.messages);else{const i=n.value.messages.filter(o=>{var a;if(vf(o,r)){const l=(a=t.messageMap[o.reqId])!==null&&a!==void 0?a:t.messageMap[o.messageId];if(vf(l,r)){const u=kL(l,o);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=wy(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=>NL(s,r));return n.value.clearBeforeAction?t.newMessageMap=Ty(i,Cy):(i.map(o=>o.messageId).forEach(o=>delete t.newMessageMap[o]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),Ty(i,Cy))),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&&(Ma(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(Ma(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},wy=e=>e.reduce((n,t)=>(Ma(t)?(n[t.reqId]=t,t.sendingStatus===ut.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),kL=(e,n)=>e.sendingStatus===ut.SUCCEEDED?n.sendingStatus===ut.SUCCEEDED:e.sendingStatus!==n.sendingStatus,RL=(e=LL)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},o]=D.useReducer(OL,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),a=(b,g,_)=>{o({type:"update_messages",value:{messages:b,clearBeforeAction:g,currentUserId:_}})},l=(b,g)=>{o({type:"delete_messages",value:{messageIds:b,reqIds:g}})},u=(b,g,_)=>{o({type:"update_new_messages",value:{messages:b,clearBeforeAction:g,currentUserId:_}})},c=(b,g)=>{o({type:"delete_new_messages",value:{messageIds:b,reqIds:g}})},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}},Ny=Math.floor(Number.MAX_SAFE_INTEGER/10);function LL(e,n){let t=0,r=0;return Ma(e)&&e.sendingStatus!=="succeeded"&&(t=Ny),Ma(n)&&n.sendingStatus!=="succeeded"&&(r=Ny),e.createdAt+t-(n.createdAt+r)}var Pi=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 DL=(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 _s(i)}))};function Iy(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=Iy(u),d=D.useRef({prev:!1,next:!1}),h=ML(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:g,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:w,deleteMessages:N,updateInitialized:A,updateLoading:k,updateRefreshing:I}=RL(t==null?void 0:t.sortComparator),x=fn(B=>{var te,oe,me,re;if(!a.current||!a.current.url)return(te=l==null?void 0:l.error)===null||te===void 0?void 0:te.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:(me=(oe=o.current).markAsRead)===null||me===void 0||me.call(oe,[a.current]);break}}catch(ce){(re=l==null?void 0:l.warn)===null||re===void 0||re.call(l,"[useGroupChannelMessages/markAsReadBySource]",ce)}}),U=fn((B,te)=>{var oe,me,re,ce,de;const fe=te.filter(ve=>{var _e;return!vf(ve,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId)});if(fe.length>0)switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_MESSAGE_FILL:{!((me=(oe=o.current).shouldCountNewMessages)===null||me===void 0)&&me.call(oe)&&S(fe,!1,(re=e.currentUser)===null||re===void 0?void 0:re.userId),(de=(ce=o.current).onMessagesReceived)===null||de===void 0||de.call(ce,fe);break}}}),z=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){return new Promise(oe=>{var me,re;if(!a.current||!a.current.url)return(me=l==null?void 0:l.error)===null||me===void 0?void 0:me.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),x(),S([],!0,(re=e.currentUser)===null||re===void 0?void 0:re.userId);const ce=()=>{var fe,ve,_e;const{pendingMessages:Ee,failedMessages:Be}=(fe=f.current.instance)!==null&&fe!==void 0?fe:{};Sy(Ee)&&E(Ee,!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),Sy(Be)&&E(Be,!1,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId)},de=DL(a.current,te,Object.assign(Object.assign({},o.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:de},de.setMessageCollectionHandler({onMessagesAdded:(fe,ve,_e)=>{var Ee;x(fe.source),U(fe.source,_e),E(_e,!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId)},onMessagesUpdated:(fe,ve,_e)=>{var Ee,Be,ze;x(fe.source),U(fe.source,_e),E(_e,!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),fe.source===G.EVENT_MESSAGE_UPDATED&&((ze=(Be=o.current).onMessagesUpdated)===null||ze===void 0||ze.call(Be,_e))},onMessagesDeleted:(fe,ve,_e,Ee)=>{const Be=Ee.map(V=>V.messageId),ze=Ee.filter(Ma).map(V=>V.reqId);N(Be,ze),w(Be,ze)},onChannelDeleted:(fe,ve)=>{var _e,Ee;(Ee=(_e=o.current).onChannelDeleted)===null||Ee===void 0||Ee.call(_e,ve)},onChannelUpdated:(fe,ve)=>{var _e,Ee;h(),(Ee=(_e=o.current).onChannelUpdated)===null||Ee===void 0||Ee.call(_e,ve)},onHugeGapDetected:()=>{z(Number.MAX_SAFE_INTEGER,mf.collection.message.defaultLimit)}}),de.initialize(_f.CACHE_AND_REPLACE_BY_API).onCacheResult((fe,ve)=>{var _e,Ee,Be;fe?e.isCacheEnabled&&((_e=l==null?void 0:l.error)===null||_e===void 0||_e.call(l,"[useGroupChannelMessages/onCacheResult]",fe)):ve&&((Ee=l==null?void 0:l.debug)===null||Ee===void 0||Ee.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",ve.length),E(ve,!0,(Be=e.currentUser)===null||Be===void 0?void 0:Be.userId),ce(),ve.length>0&&(f.current.initialized=!0,oe()))}).onApiResult((fe,ve)=>{var _e,Ee,Be,ze,V;fe?(_e=l==null?void 0:l.warn)===null||_e===void 0||_e.call(l,"[useGroupChannelMessages/onApiResult]",fe):ve&&((Ee=l==null?void 0:l.debug)===null||Ee===void 0||Ee.call(l,"[useGroupChannelMessages/onApiResult]","message length:",ve.length),E(ve,!0,(Be=e.currentUser)===null||Be===void 0?void 0:Be.userId),o.current.startingPoint||(V=(ze=o.current).onMessagesReceived)===null||V===void 0||V.call(ze,ve),e.isCacheEnabled&&ce()),f.current.initialized=!0,f.current.apiInitialized=!0,oe()})})}));LS(e,{onUserBanned(B,te){var oe,me,re;B.isGroupChannel()&&!wL(B,a.current)&&(te.userId===((oe=e.currentUser)===null||oe===void 0?void 0:oe.userId)?(re=(me=o.current).onCurrentUserBanned)===null||re===void 0||re.call(me):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Pi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(A(!1),k(!0),yield z(u,c),k(!1),A(!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 H=fn(()=>Pi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(I(!0),yield z(Number.MAX_SAFE_INTEGER,mf.collection.message.defaultLimit),I(!1))})),W=fn(()=>Pi(void 0,void 0,void 0,function*(){var B;const te=f.current.instance;if(te!=null&&te.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const oe=yield te.loadPrevious();E(oe,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),Q=fn(()=>{const{initialized:B,instance:te}=f.current;return B&&te?te.hasPrevious:!1}),$=fn(()=>Pi(void 0,void 0,void 0,function*(){var B;const te=f.current.instance;if(te!=null&&te.hasNext&&!d.current.next)try{d.current.next=!0;const oe=yield te.loadNext();E(oe,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),Ne=fn(()=>{const{initialized:B,apiInitialized:te,instance:oe}=f.current;return te&&B&&oe?oe.hasNext:!1}),X=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendUserMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),ae=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendFileMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),ne=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(me=>{const re=[];a.current.sendFileMessages(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.isFileMessage()&&ce.channelUrl===a.current.url&&(E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),re.push(ce)),re.length===B.length&&me(re)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url?(E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re.push(de)):re.push(null),re.length===B.length&&me(re)})})})),Ce=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendMultipleFilesMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onFileUploaded(()=>{h()}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),K=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe,me;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const re=yield a.current.updateUserMessage(B,te);return re.channelUrl===a.current.url&&E([re],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),re})),ie=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe,me;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const re=yield a.current.updateFileMessage(B,te);return re.channelUrl===a.current.url&&E([re],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),re})),ee=fn(B=>Pi(void 0,void 0,void 0,function*(){var te;if(!a.current||!a.current.url)throw(te=l==null?void 0:l.error)===null||te===void 0||te.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((oe,me)=>{let re;B.isUserMessage()&&(re=a.current.resendMessage(B)),B.isFileMessage()&&(re=a.current.resendMessage(B)),B.isMultipleFilesMessage()&&(re=a.current.resendMessage(B)),re&&("onPending"in re&&re.onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId)}),"onFileUploaded"in re&&re.onFileUploaded(()=>{h()}),"onSucceeded"in re&&re.onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),oe(ce)}),"onFailed"in re&&re.onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),me(ce)}))})})),ue=fn(B=>Pi(void 0,void 0,void 0,function*(){var te,oe;if(!a.current||!a.current.url)throw(te=l==null?void 0:l.error)===null||te===void 0||te.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(oe=f.current.instance)===null||oe===void 0?void 0:oe.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),P=fn(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),xe=fn(B=>Pi(void 0,void 0,void 0,function*(){var te;if(e.currentUser&&a.current){const oe=Iy(B);k(!0),E([],!0,(te=e.currentUser)===null||te===void 0?void 0:te.userId),yield z(B,oe),k(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:g,newMessages:_,resetNewMessages:P,refresh:H,loadPrevious:W,hasPrevious:Q,loadNext:$,hasNext:Ne,sendUserMessage:X,sendFileMessage:ae,sendFileMessages:ne,sendMultipleFilesMessage:Ce,updateUserMessage:K,updateFileMessage:ie,resendMessage:ee,deleteMessage:ue,resetWithStartingPoint:xe,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},iv=e=>PL(e),PL=e=>e();function PS(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&AL(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=PS(t[r],n[r]):t[r]=n[r])}),t}const sv=()=>({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 FL(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 FS=()=>{const e=sv();return FL(e)},Ay=sv(),HL=FS();var yf=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 Sm={items:{},getItem(e){var n;return yf(this,void 0,void 0,function*(){return(n=Sm.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return yf(this,void 0,void 0,function*(){Sm.items[e]=n})}};class jL{constructor(n){this.storage=n??Sm}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 yf(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:PS(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return yf(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:HL};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function BL(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 $L(e,n,t){GL(e,n,t),zL(e,n,t),VL(e,n,t),qL(e,n,t)}function GL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge;!((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((_=(g=n.groupChannel)===null||g===void 0?void 0:g.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((A=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.enableReactions)&&(e.channel.enableReactions=(I=(k=t.groupChannel)===null||k===void 0?void 0:k.channel)===null||I===void 0?void 0:I.enableReactions),!((x=n.groupChannel)===null||x===void 0)&&x.channel&&et((z=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||z===void 0?void 0:z.enableReactions)&&(e.channel.enableReactions=(W=(H=n.groupChannel)===null||H===void 0?void 0:H.channel)===null||W===void 0?void 0:W.enableReactions),!((Q=t.groupChannel)===null||Q===void 0)&&Q.channel&&et((Ne=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||Ne===void 0?void 0:Ne.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ae=(X=t.groupChannel)===null||X===void 0?void 0:X.channel)===null||ae===void 0?void 0:ae.enableReactionsSupergroup),!((ne=n.groupChannel)===null||ne===void 0)&&ne.channel&&et((K=(Ce=n.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(ie=n.groupChannel)===null||ie===void 0?void 0:ie.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ue=t.groupChannel)===null||ue===void 0)&&ue.channel&&et((xe=(P=t.groupChannel)===null||P===void 0?void 0:P.channel)===null||xe===void 0?void 0:xe.enableMention)&&(e.channel.enableMention=(te=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.enableMention),!((oe=n.groupChannel)===null||oe===void 0)&&oe.channel&&et((re=(me=n.groupChannel)===null||me===void 0?void 0:me.channel)===null||re===void 0?void 0:re.enableMention)&&(e.channel.enableMention=(de=(ce=n.groupChannel)===null||ce===void 0?void 0:ce.channel)===null||de===void 0?void 0:de.enableMention),!((fe=t.groupChannel)===null||fe===void 0)&&fe.channel&&Qa((_e=(ve=t.groupChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(Be=(Ee=t.groupChannel)===null||Ee===void 0?void 0:Ee.channel)===null||Be===void 0?void 0:Be.replyType),!((ze=n.groupChannel)===null||ze===void 0)&&ze.channel&&Qa((Se=(V=n.groupChannel)===null||V===void 0?void 0:V.channel)===null||Se===void 0?void 0:Se.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(le=(Ue=n.groupChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.replyType),!((Oe=t.groupChannel)===null||Oe===void 0)&&Oe.channel&&Qa((at=(tt=t.groupChannel)===null||tt===void 0?void 0:tt.channel)===null||at===void 0?void 0:at.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Ye=(Pe=t.groupChannel)===null||Pe===void 0?void 0:Pe.channel)===null||Ye===void 0?void 0:Ye.threadReplySelectType),!((wt=n.groupChannel)===null||wt===void 0)&&wt.channel&&Qa((Rt=(_t=n.groupChannel)===null||_t===void 0?void 0:_t.channel)===null||Rt===void 0?void 0:Rt.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(nn=(Lt=n.groupChannel)===null||Lt===void 0?void 0:Lt.channel)===null||nn===void 0?void 0:nn.threadReplySelectType),!((Qt=t.groupChannel)===null||Qt===void 0)&&Qt.channel&&et((Dt=(un=t.groupChannel)===null||un===void 0?void 0:un.channel)===null||Dt===void 0?void 0:Dt.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(xn=(Nt=t.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.enableVoiceMessage),!((Bt=n.groupChannel)===null||Bt===void 0)&&Bt.channel&&et((cn=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Pn=(Un=n.groupChannel)===null||Un===void 0?void 0:Un.channel)===null||Pn===void 0?void 0:Pn.enableVoiceMessage),!((vn=n.groupChannel)===null||vn===void 0)&&vn.channel&&IL((Ot=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||Ot===void 0?void 0:Ot.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(rn=(On=n.groupChannel)===null||On===void 0?void 0:On.channel)===null||rn===void 0?void 0:rn.typingIndicatorTypes),!((sn=n.groupChannel)===null||sn===void 0)&&sn.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=(It=n.groupChannel)===null||It===void 0?void 0:It.channel)===null||Rn===void 0?void 0:Rn.enableFeedback),!((or=n.groupChannel)===null||or===void 0)&&or.channel&&et((En=(dn=n.groupChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Ut=(bn=n.groupChannel)===null||bn===void 0?void 0:bn.channel)===null||Ut===void 0?void 0:Ut.enableSuggestedReplies),!((Cn=n.groupChannel)===null||Cn===void 0)&&Cn.channel&&Qa((Hn=(Yt=n.groupChannel)===null||Yt===void 0?void 0:Yt.channel)===null||Hn===void 0?void 0:Hn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(ar=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.showSuggestedRepliesFor),!((Le=n.groupChannel)===null||Le===void 0)&&Le.channel&&Qa((he=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||he===void 0?void 0:he.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(Ge=(Me=n.groupChannel)===null||Me===void 0?void 0:Me.channel)===null||Ge===void 0?void 0:Ge.suggestedRepliesDirection)}function zL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge,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=(_=(g=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||g===void 0?void 0:g.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((I=(k=(A=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.input)===null||k===void 0?void 0:k.camera)===null||I===void 0?void 0:I.enablePhoto)&&(e.channel.input.camera.enablePhoto=(H=(z=(U=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||z===void 0?void 0:z.camera)===null||H===void 0?void 0:H.enablePhoto),!(($=(Q=(W=n.groupChannel)===null||W===void 0?void 0:W.channel)===null||Q===void 0?void 0:Q.input)===null||$===void 0)&&$.camera&&et((ne=(ae=(X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||ae===void 0?void 0:ae.camera)===null||ne===void 0?void 0:ne.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(ie=(K=(Ce=n.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.input)===null||ie===void 0?void 0:ie.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((xe=(P=(ue=t.groupChannel)===null||ue===void 0?void 0:ue.channel)===null||P===void 0?void 0:P.input)===null||xe===void 0)&&xe.camera&&et((me=(oe=(te=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.input)===null||oe===void 0?void 0:oe.camera)===null||me===void 0?void 0:me.enableVideo)&&(e.channel.input.camera.enableVideo=(fe=(de=(ce=(re=t.groupChannel)===null||re===void 0?void 0:re.channel)===null||ce===void 0?void 0:ce.input)===null||de===void 0?void 0:de.camera)===null||fe===void 0?void 0:fe.enableVideo),!((Ee=(_e=(ve=n.groupChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.input)===null||Ee===void 0)&&Ee.camera&&et((Se=(V=(ze=(Be=n.groupChannel)===null||Be===void 0?void 0:Be.channel)===null||ze===void 0?void 0:ze.input)===null||V===void 0?void 0:V.camera)===null||Se===void 0?void 0:Se.enableVideo)&&(e.channel.input.camera.enableVideo=(tt=(Oe=(le=(Ue=n.groupChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.input)===null||Oe===void 0?void 0:Oe.camera)===null||tt===void 0?void 0:tt.enableVideo),!((Ye=(Pe=(at=t.groupChannel)===null||at===void 0?void 0:at.channel)===null||Pe===void 0?void 0:Pe.input)===null||Ye===void 0)&&Ye.gallery&&et((Lt=(Rt=(_t=(wt=t.groupChannel)===null||wt===void 0?void 0:wt.channel)===null||_t===void 0?void 0:_t.input)===null||Rt===void 0?void 0:Rt.gallery)===null||Lt===void 0?void 0:Lt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Dt=(un=(Qt=(nn=t.groupChannel)===null||nn===void 0?void 0:nn.channel)===null||Qt===void 0?void 0:Qt.input)===null||un===void 0?void 0:un.gallery)===null||Dt===void 0?void 0:Dt.enablePhoto),!((Bt=(xn=(Nt=n.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.input)===null||Bt===void 0)&&Bt.gallery&&et((Pn=(Un=(cn=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(Ot=(Fn=(vn=n.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Fn===void 0?void 0:Fn.input)===null||Ot===void 0?void 0:Ot.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(sn=(rn=t.groupChannel)===null||rn===void 0?void 0:rn.channel)===null||sn===void 0?void 0:sn.input)===null||kn===void 0)&&kn.gallery&&et((or=(Rn=(It=(yn=t.groupChannel)===null||yn===void 0?void 0:yn.channel)===null||It===void 0?void 0:It.input)===null||Rn===void 0?void 0:Rn.gallery)===null||or===void 0?void 0:or.enableVideo)&&(e.channel.input.gallery.enableVideo=(Ut=(bn=(En=(dn=t.groupChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Ut===void 0?void 0:Ut.enableVideo),!((Hn=(Yt=(Cn=n.groupChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Yt===void 0?void 0:Yt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Le=(ar=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.input)===null||Le===void 0?void 0:Le.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(Ge=(Me=(he=n.groupChannel)===null||he===void 0?void 0:he.channel)===null||Me===void 0?void 0:Me.input)===null||Ge===void 0?void 0:Ge.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function VL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,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((_=(g=n.groupChannel)===null||g===void 0?void 0:g.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 qL(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 WL(e,n,t){KL(e,n,t),QL(e,n,t)}function KL(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 QL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge,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=(_=(g=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||g===void 0?void 0:g.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((I=(k=(A=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.input)===null||k===void 0?void 0:k.camera)===null||I===void 0?void 0:I.enablePhoto)&&(e.channel.input.camera.enablePhoto=(H=(z=(U=(x=t.openChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||z===void 0?void 0:z.camera)===null||H===void 0?void 0:H.enablePhoto),!(($=(Q=(W=n.openChannel)===null||W===void 0?void 0:W.channel)===null||Q===void 0?void 0:Q.input)===null||$===void 0)&&$.camera&&et((ne=(ae=(X=(Ne=n.openChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||ae===void 0?void 0:ae.camera)===null||ne===void 0?void 0:ne.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(ie=(K=(Ce=n.openChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.input)===null||ie===void 0?void 0:ie.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((xe=(P=(ue=t.openChannel)===null||ue===void 0?void 0:ue.channel)===null||P===void 0?void 0:P.input)===null||xe===void 0)&&xe.camera&&et((me=(oe=(te=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.input)===null||oe===void 0?void 0:oe.camera)===null||me===void 0?void 0:me.enableVideo)&&(e.channel.input.camera.enableVideo=(fe=(de=(ce=(re=t.openChannel)===null||re===void 0?void 0:re.channel)===null||ce===void 0?void 0:ce.input)===null||de===void 0?void 0:de.camera)===null||fe===void 0?void 0:fe.enableVideo),!((Ee=(_e=(ve=n.openChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.input)===null||Ee===void 0)&&Ee.camera&&et((Se=(V=(ze=(Be=n.openChannel)===null||Be===void 0?void 0:Be.channel)===null||ze===void 0?void 0:ze.input)===null||V===void 0?void 0:V.camera)===null||Se===void 0?void 0:Se.enableVideo)&&(e.channel.input.camera.enableVideo=(tt=(Oe=(le=(Ue=n.openChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.input)===null||Oe===void 0?void 0:Oe.camera)===null||tt===void 0?void 0:tt.enableVideo),!((Ye=(Pe=(at=t.openChannel)===null||at===void 0?void 0:at.channel)===null||Pe===void 0?void 0:Pe.input)===null||Ye===void 0)&&Ye.gallery&&et((Lt=(Rt=(_t=(wt=t.openChannel)===null||wt===void 0?void 0:wt.channel)===null||_t===void 0?void 0:_t.input)===null||Rt===void 0?void 0:Rt.gallery)===null||Lt===void 0?void 0:Lt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Dt=(un=(Qt=(nn=t.openChannel)===null||nn===void 0?void 0:nn.channel)===null||Qt===void 0?void 0:Qt.input)===null||un===void 0?void 0:un.gallery)===null||Dt===void 0?void 0:Dt.enablePhoto),!((Bt=(xn=(Nt=n.openChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.input)===null||Bt===void 0)&&Bt.gallery&&et((Pn=(Un=(cn=(ft=n.openChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(Ot=(Fn=(vn=n.openChannel)===null||vn===void 0?void 0:vn.channel)===null||Fn===void 0?void 0:Fn.input)===null||Ot===void 0?void 0:Ot.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(sn=(rn=t.openChannel)===null||rn===void 0?void 0:rn.channel)===null||sn===void 0?void 0:sn.input)===null||kn===void 0)&&kn.gallery&&et((or=(Rn=(It=(yn=t.openChannel)===null||yn===void 0?void 0:yn.channel)===null||It===void 0?void 0:It.input)===null||Rn===void 0?void 0:Rn.gallery)===null||or===void 0?void 0:or.enableVideo)&&(e.channel.input.gallery.enableVideo=(Ut=(bn=(En=(dn=t.openChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Ut===void 0?void 0:Ut.enableVideo),!((Hn=(Yt=(Cn=n.openChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Yt===void 0?void 0:Yt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Le=(ar=(jn=n.openChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.input)===null||Le===void 0?void 0:Le.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(Ge=(Me=(he=n.openChannel)===null||he===void 0?void 0:he.channel)===null||Me===void 0?void 0:Me.input)===null||Ge===void 0?void 0:Ge.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function YL(e,n){const t=sv();return BL(t.common,e,n),$L(t.groupChannel,e,n),WL(t.openChannel,e,n),t}function ZL(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var XL=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 HS=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:Ay,configsWithAppAttr:()=>Ay}),JL=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(FS),[s]=D.useState(()=>new jL(e)),o=D.useCallback(u=>XL(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(ZL(d.json)){const h=Cm(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),a=YL(t,r),l=fn(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 mt.createElement(HS.Provider,{value:{initDashboardConfigs:o,configs:a,configsWithAppAttr:l}},n)},e5=()=>D.useContext(HS),jS=mt.createContext(null);/*! +`),r=[],i=0,s=t.length;i=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=u4();return o&&r.setAttribute("nonce",o),t.insertBefore(r,s),r},c4=function(){function e(t){var r=this.element=Kb(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}(),p4=/(a)(d)/gi,K2=function(e){return String.fromCharCode(e+(e>25?39:97))};function G_(e){var n,t="";for(n=Math.abs(e);n>52;n=n/52|0)t=K2(n%52)+t;return(K2(n%52)+t).replace(p4,"$1-$2")}var dl=function(e,n){for(var t=n.length;t;)e=33*e^n.charCodeAt(--t);return e},Yb=function(e){return dl(5381,e)};function _4(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=dl(this.baseHash,r.hash),d="",h=0;h>>0);if(!t.hasNameForId(i,b)){var g=r(d,"."+b,void 0,i);t.insertRules(i,b,g)}s.push(b)}}return s.join(" ")},e}(),v4=/^\s*\/\/.*$/gm,y4=[":","[",".","#"];function Zb(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?Wh:l,c=new $I(a),d=[],h=function(m){function b(g){if(g)try{m(g+"}")}catch{}}return function(g,_,E,S,w,N,A,k,I,x){switch(g){case 1:if(I===0&&_.charCodeAt(0)===64)return m(_+";"),"";break;case 2:if(k===0)return _+"/*|*/";break;case 3:switch(k){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,g){return b===0&&y4.indexOf(g[t.length])!==-1||g.match(i)?m:"."+n};function p(m,b,g,_){_===void 0&&(_="&");var E=m.replace(v4,""),S=b&&g?g+" "+b+" { "+E+" }":E;return n=_,t=b,r=new RegExp("\\"+t+"\\b","g"),i=new RegExp("(\\"+t+"\\b){2,}"),c(g||!b?"":b,S)}return c.use([].concat(u,[function(m,b,g){m===2&&g.length&&g[0].lastIndexOf(t)>0&&(g[0]=g[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||Ta(15),dl(m,b.name)},5381).toString():"",p}var jg=mt.createContext();jg.Consumer;var Bg=mt.createContext(),E4=(Bg.Consumer,new Qb),z_=Zb();function Xb(){return D.useContext(jg)||E4}function b4(){return D.useContext(Bg)||z_}function C4(e){var n=D.useState(e.stylisPlugins),t=n[0],r=n[1],i=Xb(),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 Zb({options:{prefix:!e.disableVendorPrefixes},plugins:t})},[e.disableVendorPrefixes,t]);return D.useEffect(function(){BI(t,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),mt.createElement(jg.Provider,{value:s},mt.createElement(Bg.Provider,{value:o},e.children))}var Jb=function(){function e(n,t){var r=this;this.inject=function(i,s){s===void 0&&(s=z_);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 Ta(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=z_),this.name+n.hash},e}(),S4=/([A-Z])/,T4=/([A-Z])/g,w4=/^ms-/,N4=function(e){return"-"+e.toLowerCase()};function Q2(e){return S4.test(e)?e.replace(T4,N4).replace(w4,"-ms-"):e}var Y2=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,M4=/(^-|-$)/g;function tp(e){return e.replace(A4,"-").replace(M4,"")}var eC=function(e){return G_(Yb(e)>>>0)};function Sd(e){return typeof e=="string"&&!0}var V_=function(e){return typeof e=="function"||typeof e=="object"&&e!==null&&!Array.isArray(e)},x4=function(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"};function O4(e,n,t){var r=e[t];V_(n)&&V_(r)?tC(r,n):e[t]=n}function tC(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r=0||(x[k]=N[k]);return x}(n,["componentId"]),w=E&&E+"-"+(Sd(_)?_:tp(q2(_)));return nC(_,us({},S,{attrs:h,componentId:w}),t)},Object.defineProperty(p,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(_){this._foldedDefaultProps=r?tC({},e.defaultProps,_):_}}),Object.defineProperty(p,"toString",{value:function(){return"."+p.styledComponentId}}),i&&e4(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),p}var be=function(e){return function n(t,r,i){if(i===void 0&&(i=Eo),!Dg.isValidElementType(r))return Ta(1,String(r));var s=function(){return t(r,i,Oo.apply(void 0,arguments))};return s.withConfig=function(o){return n(t,r,us({},i,{},o))},s.attrs=function(o){return n(t,r,us({},i,{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},s}(nC,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){be[e]=be(e)});function R4(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=U4(a),a in X2)return;X2[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":D4,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 q_=function(e,n){return q_=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])},q_(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}q_(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 De(e,n,t){if(arguments.length===2)for(var r,i=0,s=n.length;i0&&F4.indexOf(e)>=0},Qh=function(e){return e>0&&H4.indexOf(e)>=0},pr=function(e,n){if(n===void 0&&(n=!1),n&&Kc(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},$4=function(e,n){if(e===n)return!0;if(e==null||n==null||e.length!==n.length)return!1;for(var t=De([],Ae(e),!1).sort(),r=De([],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){R("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){R("number",n)&&(n<60?n=60:n>1800&&(n=1800),this._sessionTokenRefreshTimeout=n)},enumerable:!1,configurable:!0}),e}(),oC={encrypt:function(e){return e},decrypt:function(e){return e}},e1=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 v(this,function(n){switch(n.label){case 0:return[4,this._store.set({key:this._keysAddress,value:De([],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 v(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"})(xc||(xc={}));var Ze,Ni,ss,Ct,tr,Ll,rr,Dn,Wi,ut,t1,K_,Q_,V4=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChatServicePermission",{get:function(){var n;return!!(!((n=this.services)===null||n===void 0)&&n.includes(xc.CHAT))},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),Bs=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)})},n1=function(){function e(n){var t=n.container;this._container={},this._container=t,this.key=Bs()}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}(),La=function(){function e(){this._container={}}return e.prototype.on=function(n,t){return new n1({container:this._container}).on(n,t)},e.prototype.once=function(n,t){return new n1({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=pe(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}(),q4=function(){function e(){this._dispatcher=new La}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(){},ye=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},Ie=function(e){if(e!=null){if(typeof e=="object"){if(Array.isArray(e)){for(var n=De([],Ae(e),!1),t=0;t"u"&&typeof navigator<"u"&&navigator.product=="ReactNative"},r1=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"})(Z_||(Z_={})),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"}(fa||(fa={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(lo||(lo={}));var sA="^(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-]+)*))?$",Yh=function(){function e(){}return e.sendbirdSdkUserAgentWithExtension=function(n){var t=X_()?fa.REACT_NATIVE:fa.JS,r={main_sdk_info:"chat/".concat(t,"/").concat(bo.SDK_VERSION),device_os_platform:r1()?"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=X_()?"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"]):r1()?"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)}})},Zh=function(e){function n(t){var r=e.call(this)||this;return r.requestId=t.requestId,r}return T(n,e),n}(Tt),pC=function(e){function n(t){var r=e.call(this)||this;return r.method=Z.DELETE,r.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(r.params=ye({mesg_token:t.messageToken})),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var oA=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}(gt),aA=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 tA&&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":Yh.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":Yh.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 zg(new $t({type:Et.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!==Z.GET&&(t!==Z.DELETE||n instanceof pC)},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,g,_,E,S,w;return v(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,rp(()=>import("./__bundle-a2788ee7-cDjobn7g.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===Te.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,rp(()=>import("./__bundle-2aa1a987-CvKKdrEL.js").then(A=>A._),[])];case 7:N.sent(),N.label=8;case 8:return typeof fetch=="function"?[3,10]:[4,rp(()=>import("./__bundle-347d730c-BWJ486i-.js").then(A=>A._),[])];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(g=N.sent(),b.ok||b.redirected)return this._logger.debug("receive api response",n.requestId),this._statLogApiResult(n,h),[2,new se(this._iid,g)];if(g){if((_=new L(g)).isSessionExpiredError){if(this._dispatcher.dispatch(new Ul({reason:_.code,message:_.message})),!(n instanceof Gg))return E=new Tr,this._dispatcher.dispatch(new fC({request:n,deferred:E,error:_})),[2,E.promise];throw _}throw _.isSessionInvalidatedError&&this._dispatcher.dispatch(new Ul({reason:_.code,message:_.message})),_}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 Zh({requestId:n}))},e.prototype.cancelAll=function(){var n,t;try{for(var r=pe(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 Zh({}))},e}(),qe=function(){};function Wl(e){let n=e.length;for(;--n>=0;)e[n]=0}const Vg=256,_C=286,Vu=30,qu=15,J_=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]),uh=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]),lA=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ss=new Array(576);Wl(Ss);const Wu=new Array(60);Wl(Wu);const Oc=new Array(512);Wl(Oc);const Ku=new Array(256);Wl(Ku);const qg=new Array(29);Wl(qg);const Xh=new Array(Vu);function ip(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 s1,o1,a1;function sp(e,n){this.dyn_tree=e,this.max_code=0,this.stat_desc=n}Wl(Xh);const mC=e=>e<256?Oc[e]:Oc[256+(e>>>7)],kc=(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])},gC=(e,n)=>{let t=0;do t|=1&e,e>>>=1,t<<=1;while(--n>0);return t>>>1},vC=(e,n,t)=>{const r=new Array(16);let i,s,o=0;for(i=1;i<=qu;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]=gC(r[a]++,a))}},yC=e=>{let n;for(n=0;n<_C;n++)e.dyn_ltree[2*n]=0;for(n=0;n{e.bi_valid>8?kc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},l1=(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?os(e,i,n):(s=Ku[i],os(e,s+Vg+1,n),o=J_[s],o!==0&&(i-=qg[s],zr(e,i,o)),r--,s=mC(r),os(e,s,t),o=uh[s],o!==0&&(r-=Xh[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--)op(e,t,o);l=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],op(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++,op(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,g=d.stat_desc.extra_base,_=d.stat_desc.max_length;let E,S,w,N,A,k,I=0;for(N=0;N<=qu;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=_,I++),h[2*S+1]=N,S>f||(c.bl_count[N]++,A=0,S>=g&&(A=b[S-g]),k=h[2*S],c.opt_len+=k*(N+A),m&&(c.static_len+=k*(p[2*S+1]+A)));if(I!==0){do{for(N=_-1;c.bl_count[N]===0;)N--;c.bl_count[N]--,c.bl_count[N+1]+=2,c.bl_count[_]--,I-=2}while(I>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),vC(t,u,e.bl_count)},c1=(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),EC(e),kc(e,t),kc(e,~t),t&&e.pending_buf.set(e.window.subarray(n,n+t),e.pending),e.pending+=t};var uA=(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{let l;for(c1(a,a.dyn_ltree,a.l_desc.max_code),c1(a,a.dyn_dtree,a.d_desc.max_code),ap(a,a.bl_desc),l=18;l>=3&&a.bl_tree[2*i1[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?bC(e,n,t,r):e.strategy===4||s===i?(zr(e,2+(r?1:0),3),u1(e,Ss,Wu)):(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{h1||((()=>{let n,t,r,i,s;const o=new Array(16);for(r=0,i=0;i<28;i++)for(qg[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*(Ku[t]+Vg+1)]++,e.dyn_dtree[2*mC(n)]++),e.sym_next===e.sym_end),_tr_align:e=>{zr(e,2,3),os(e,256,Ss),(n=>{n.bi_valid===16?(kc(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)}},Qu=(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 dA=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 Xn=(e,n,t,r)=>{const i=dA,s=r+t;e^=-1;for(let o=r;o>>8^i[255&(e^n[o])];return~e},wa={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"},Da={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:hA,_tr_stored_block:em,_tr_flush_block:fA,_tr_tally:Co,_tr_align:pA}=cA,{Z_NO_FLUSH:So,Z_PARTIAL_FLUSH:_A,Z_FULL_FLUSH:mA,Z_FINISH:Ci,Z_BLOCK:f1,Z_OK:lr,Z_STREAM_END:p1,Z_STREAM_ERROR:es,Z_DATA_ERROR:gA,Z_BUF_ERROR:lp,Z_DEFAULT_COMPRESSION:vA,Z_FILTERED:yA,Z_HUFFMAN_ONLY:Td,Z_RLE:EA,Z_FIXED:bA,Z_DEFAULT_STRATEGY:CA,Z_UNKNOWN:SA,Z_DEFLATED:Jh}=Da,ra=258,fs=262,Cl=42,Ko=113,wu=666,Qo=(e,n)=>(e.msg=wa[n],n),_1=e=>2*e-(e>4?9:0),io=e=>{let n=e.length;for(;--n>=0;)e[n]=0},TA=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))},ri=(e,n)=>{fA(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,n),e.block_start=e.strstart,ei(e.strm)},yt=(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},tm=(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=Qu(e.adler,n,i,t):e.state.wrap===2&&(e.adler=Xn(e.adler,n,i,t)),e.next_in+=i,e.total_in+=i,i)},CC=(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-fs?e.strstart-(e.w_size-fs):0,u=e.window,c=e.w_mask,d=e.prev,h=e.strstart+ra;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},hl=e=>{const n=e.w_size;let t,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-fs)&&(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),TA(e),r+=n),e.strm.avail_in===0)break;if(t=tm(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{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,ei(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&&(tm(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&&(tm(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===Ci)&&n!==So&&e.strm.avail_in===0&&r<=i)&&(t=r>i?i:r,o=n===Ci&&e.strm.avail_in===0&&t===r?1:0,em(e,e.block_start,t,o),e.block_start+=t,ei(e.strm)),o?3:1)},up=(e,n)=>{let t,r;for(;;){if(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-fs&&(e.match_length=CC(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&&(ri(e,!1),e.strm.avail_out===0))return 1}return e.insert=e.strstart<2?e.strstart:2,n===Ci?(ri(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ri(e,!1),e.strm.avail_out===0)?1:2},qa=(e,n)=>{let t,r,i;for(;;){if(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&&(ri(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&&ri(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===Ci?(ri(e,!0),e.strm.avail_out===0?3:4):e.sym_next&&(ri(e,!1),e.strm.avail_out===0)?1:2};function Xi(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 Xi(0,0,0,0,SC),new Xi(4,4,8,4,up),new Xi(4,5,16,8,up),new Xi(4,6,32,32,up),new Xi(4,4,16,16,qa),new Xi(8,16,32,32,qa),new Xi(8,16,128,128,qa),new Xi(8,32,128,256,qa),new Xi(32,128,258,1024,qa),new Xi(32,258,258,4096,qa)];function wA(){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=Jh,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),io(this.dyn_ltree),io(this.dyn_dtree),io(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),io(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),io(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!==Cl&&n.status!==57&&n.status!==69&&n.status!==73&&n.status!==91&&n.status!==103&&n.status!==Ko&&n.status!==wu?1:0},TC=e=>{if(Iu(e))return Qo(e,es);e.total_in=e.total_out=0,e.data_type=SA;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?Cl:Ko,e.adler=n.wrap===2?0:1,n.last_flush=-2,hA(n),lr},wC=e=>{const n=TC(e);var t;return n===lr&&((t=e.state).window_size=2*t.w_size,io(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},m1=(e,n,t,r,i,s)=>{if(!e)return es;let o=1;if(n===vA&&(n=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>9||t!==Jh||r<8||r>15||n<0||n>9||s<0||s>bA||r===8&&o!==1)return Qo(e,es);r===8&&(r=9);const a=new wA;return e.state=a,a.strm=e,a.status=Cl,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<m1(e,n,Jh,15,8,CA),deflateInit2:m1,deflateReset:wC,deflateResetKeep:TC,deflateSetHeader:(e,n)=>Iu(e)||e.state.wrap!==2?es:(e.state.gzhead=n,lr),deflate:(e,n)=>{if(Iu(e)||n>f1||n<0)return e?Qo(e,es):es;const t=e.state;if(!e.output||e.avail_in!==0&&!e.input||t.status===wu&&n!==Ci)return Qo(e,e.avail_out===0?lp:es);const r=t.last_flush;if(t.last_flush=n,t.pending!==0){if(ei(e),e.avail_out===0)return t.last_flush=-1,lr}else if(e.avail_in===0&&_1(n)<=_1(r)&&n!==Ci)return Qo(e,lp);if(t.status===wu&&e.avail_in!==0)return Qo(e,lp);if(t.status===Cl&&t.wrap===0&&(t.status=Ko),t.status===Cl){let i=Jh+(t.w_bits-8<<4)<<8,s=-1;if(s=t.strategy>=Td||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=Ko,ei(e),t.pending!==0)return t.last_flush=-1,lr}if(t.status===57){if(e.adler=0,yt(t,31),yt(t,139),yt(t,8),t.gzhead)yt(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)),yt(t,255&t.gzhead.time),yt(t,t.gzhead.time>>8&255),yt(t,t.gzhead.time>>16&255),yt(t,t.gzhead.time>>24&255),yt(t,t.level===9?2:t.strategy>=Td||t.level<2?4:0),yt(t,255&t.gzhead.os),t.gzhead.extra&&t.gzhead.extra.length&&(yt(t,255&t.gzhead.extra.length),yt(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(e.adler=Xn(e.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=69;else if(yt(t,0),yt(t,0),yt(t,0),yt(t,0),yt(t,0),yt(t,t.level===9?2:t.strategy>=Td||t.level<2?4:0),yt(t,3),t.status=Ko,ei(e),t.pending!==0)return t.last_flush=-1,lr}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=Xn(e.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=a,ei(e),t.pending!==0)return t.last_flush=-1,lr;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=Xn(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=Xn(e.adler,t.pending_buf,t.pending-s,s)),ei(e),t.pending!==0)return t.last_flush=-1,lr;s=0}i=t.gzindexs&&(e.adler=Xn(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=Xn(e.adler,t.pending_buf,t.pending-s,s)),ei(e),t.pending!==0)return t.last_flush=-1,lr;s=0}i=t.gzindexs&&(e.adler=Xn(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&&(ei(e),t.pending!==0))return t.last_flush=-1,lr;yt(t,255&e.adler),yt(t,e.adler>>8&255),e.adler=0}if(t.status=Ko,ei(e),t.pending!==0)return t.last_flush=-1,lr}if(e.avail_in!==0||t.lookahead!==0||n!==So&&t.status!==wu){let i=t.level===0?SC(t,n):t.strategy===Td?((s,o)=>{let a;for(;;){if(s.lookahead===0&&(hl(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&&(ri(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Ci?(ri(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ri(s,!1),s.strm.avail_out===0)?1:2})(t,n):t.strategy===EA?((s,o)=>{let a,l,u,c;const d=s.window;for(;;){if(s.lookahead<=ra){if(hl(s),s.lookahead<=ra&&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+ra;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&&(ri(s,!1),s.strm.avail_out===0))return 1}return s.insert=0,o===Ci?(ri(s,!0),s.strm.avail_out===0?3:4):s.sym_next&&(ri(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),lr;if(i===2&&(n===_A?pA(t):n!==f1&&(em(t,0,0,!1),n===mA&&(io(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),ei(e),e.avail_out===0))return t.last_flush=-1,lr}return n!==Ci?lr:t.wrap<=0?p1:(t.wrap===2?(yt(t,255&e.adler),yt(t,e.adler>>8&255),yt(t,e.adler>>16&255),yt(t,e.adler>>24&255),yt(t,255&e.total_in),yt(t,e.total_in>>8&255),yt(t,e.total_in>>16&255),yt(t,e.total_in>>24&255)):(lu(t,e.adler>>>16),lu(t,65535&e.adler)),ei(e),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?lr:p1)},deflateEnd:e=>{if(Iu(e))return es;const n=e.state.status;return e.state=null,n===Ko?Qo(e,gA):lr},deflateSetDictionary:(e,n)=>{let t=n.length;if(Iu(e))return es;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Cl||r.lookahead)return es;if(i===1&&(e.adler=Qu(e.adler,n,t,0)),r.wrap=0,t>=r.w_size){i===0&&(io(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,hl(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,hl(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,lr},deflateInfo:"pako deflate (from Nodeca project)"};const NA=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var n0={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)NA(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;Rc[254]=Rc[254]=1;var Lc={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&&NC)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+Rc[e[t]]>n?t:n}},IC=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 AC=Object.prototype.toString,{Z_NO_FLUSH:IA,Z_SYNC_FLUSH:AA,Z_FULL_FLUSH:MA,Z_FINISH:xA,Z_OK:ef,Z_STREAM_END:OA,Z_DEFAULT_COMPRESSION:kA,Z_DEFAULT_STRATEGY:RA,Z_DEFLATED:LA}=Da;function Zu(e){this.options=n0.assign({level:kA,method:LA,chunkSize:16384,windowBits:15,memLevel:8,strategy:RA},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 IC,this.strm.avail_out=0;let t=Yu.deflateInit2(this.strm,n.level,n.method,n.windowBits,n.memLevel,n.strategy);if(t!==ef)throw new Error(wa[t]);if(n.header&&Yu.deflateSetHeader(this.strm,n.header),n.dictionary){let r;if(r=typeof n.dictionary=="string"?Lc.string2buf(n.dictionary):AC.call(n.dictionary)==="[object ArrayBuffer]"?new Uint8Array(n.dictionary):n.dictionary,t=Yu.deflateSetDictionary(this.strm,r),t!==ef)throw new Error(wa[t]);this._dict_set=!0}}function cp(e,n){const t=new Zu(n);if(t.push(e,!0),t.err)throw t.msg||wa[t.err];return t.result}Zu.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?xA:IA,typeof e=="string"?t.input=Lc.string2buf(e):AC.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===AA||s===MA)&&t.avail_out<=6)this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;else{if(i=Yu.deflate(t,s),i===OA)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Yu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ef;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},Zu.prototype.onData=function(e){this.chunks.push(e)},Zu.prototype.onEnd=function(e){e===ef&&(this.result=n0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var DA={Deflate:Zu,deflate:cp,deflateRaw:function(e,n){return(n=n||{}).raw=!0,cp(e,n)},gzip:function(e,n){return(n=n||{}).gzip=!0,cp(e,n)},constants:Da};const wd=16209;var UA=function(e,n){let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I;const x=e.state;t=e.next_in,k=e.input,r=t+(e.avail_in-5),i=e.next_out,I=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)I[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=wd;break e}_=p[(65535&_)+(h&(1<>>=E,f-=E),f<15&&(h+=k[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=wd;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=wd;break e}if(N=0,A=d,c===0){if(N+=l-E,E2;)I[i++]=A[N++],I[i++]=A[N++],I[i++]=A[N++],S-=3;S&&(I[i++]=A[N++],S>1&&(I[i++]=A[N++]))}else{N=i-w;do I[i++]=I[N++],I[i++]=I[N++],I[i++]=I[N++],S-=3;while(S>2);S&&(I[i++]=I[N++],S>1&&(I[i++]=I[N++]))}break}if(64&E){e.msg="invalid distance code",x.mode=wd;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,g=0,_=0,E=0,S=0,w=0,N=0,A=0,k=0,I=null;const x=new Uint16Array(16),U=new Uint16Array(16);let z,H,W,Q=null;for(m=0;m<=Nd;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(g=1;g<_&&x[g]===0;g++);for(E0&&(e===0||_!==1))return-1;for(U[1]=0,m=1;m852||e===2&&A>592)return 1;for(;;){z=m-w,o[b]+1=p?(H=Q[o[b]-p],W=I[o[b]-p]):(H=96,W=0),u=1<>w)+c]=z<<24|H<<16|W;while(c!==0);for(u=1<>=1;if(u!==0?(k&=u-1,k+=u):k=0,b++,--x[m]==0){if(m===_)break;m=n[t+o[b]]}if(m>E&&(k&h)!==d){for(w===0&&(w=E),f+=g,S=m-w,N=1<852||e===2&&A>592)return 1;d=k&h,i[d]=E<<24|S<<16|f-s}}return k!==0&&(i[f+k]=m-w<<24|64<<16),a.bits=E,0};const{Z_FINISH:g1,Z_BLOCK:BA,Z_TREES:Id,Z_OK:Yo,Z_STREAM_END:$A,Z_NEED_DICT:GA,Z_STREAM_ERROR:yi,Z_DATA_ERROR:v1,Z_MEM_ERROR:y1,Z_BUF_ERROR:zA,Z_DEFLATED:E1}=Da,r0=16180,Ad=16190,vs=16191,dp=16192,hp=16194,Md=16199,xd=16200,fp=16206,Zt=16209,b1=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function VA(){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 ia=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode16211?1:0},MC=e=>{if(ia(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=r0,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,Yo},xC=e=>{if(ia(e))return yi;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,MC(e)},OC=(e,n)=>{let t;if(ia(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,xC(e))},C1=(e,n)=>{if(!e)return yi;const t=new VA;e.state=t,t.strm=e,t.window=null,t.mode=r0;const r=OC(e,n);return r!==Yo&&(e.state=null),r};let pp,_p,S1=!0;const qA=e=>{if(S1){pp=new Int32Array(512),_p=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(Xu(1,e.lens,0,288,pp,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;Xu(2,e.lens,0,32,_p,0,e.work,{bits:5}),S1=!1}e.lencode=pp,e.lenbits=9,e.distcode=_p,e.distbits=5},T1=(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.whaveC1(e,15),inflateInit2:C1,inflate:(e,n)=>{let t,r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k=0;const I=new Uint8Array(4);let x,U;const z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ia(e)||!e.output||!e.input&&e.avail_in!==0)return yi;t=e.state,t.mode===vs&&(t.mode=dp),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,A=Yo;e:for(;;)switch(t.mode){case r0:if(t.wrap===0){t.mode=dp;break}for(;c<16;){if(a===0)break e;a--,u+=r[s++]<>>8&255,t.check=Xn(t.check,I,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=Zt;break}if((15&u)!==E1){e.msg="unknown compression method",t.mode=Zt;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=Zt;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(I[0]=255&u,I[1]=u>>>8&255,t.check=Xn(t.check,I,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,I[2]=u>>>16&255,I[3]=u>>>24&255,t.check=Xn(t.check,I,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&&(I[0]=255&u,I[1]=u>>>8&255,t.check=Xn(t.check,I,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=Xn(t.check,I,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=Xn(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=vs;break;case 16189:for(;c<32;){if(a===0)break e;a--,u+=r[s++]<>>=7&c,c-=7&c,t.mode=fp;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(qA(t),t.mode=Md,n===Id){u>>>=2,c-=2;break e}break;case 2:t.mode=16196;break;case 3:e.msg="invalid block type",t.mode=Zt}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=Zt;break}if(t.length=65535&u,u=0,c=0,t.mode=hp,n===Id)break e;case hp: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=vs;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=Zt;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,c-=3}for(;t.have<19;)t.lens[z[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,x={bits:t.lenbits},A=Xu(0,t.lens,0,19,t.lencode,0,t.work,x),t.lenbits=x.bits,A){e.msg="invalid code lengths set",t.mode=Zt;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,g=k>>>16&255,_=65535&k,!(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=Zt;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=Zt;break}for(;f--;)t.lens[t.have++]=N}}if(t.mode===Zt)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=Zt;break}if(t.lenbits=9,x={bits:t.lenbits},A=Xu(1,t.lens,0,t.nlen,t.lencode,0,t.work,x),t.lenbits=x.bits,A){e.msg="invalid literal/lengths set",t.mode=Zt;break}if(t.distbits=6,t.distcode=t.distdyn,x={bits:t.distbits},A=Xu(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,x),t.distbits=x.bits,A){e.msg="invalid distances set",t.mode=Zt;break}if(t.mode=Md,n===Id)break e;case Md:t.mode=xd;case xd: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,UA(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===vs&&(t.back=-1);break}for(t.back=0;k=t.lencode[u&(1<>>24,g=k>>>16&255,_=65535&k,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=k>>>24,g=k>>>16&255,_=65535&k,!(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=_,g===0){t.mode=16205;break}if(32&g){t.back=-1,t.mode=vs;break}if(64&g){e.msg="invalid literal/length code",t.mode=Zt;break}t.extra=15&g,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(;k=t.distcode[u&(1<>>24,g=k>>>16&255,_=65535&k,!(b<=c);){if(a===0)break e;a--,u+=r[s++]<>E)],b=k>>>24,g=k>>>16&255,_=65535&k,!(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&g){e.msg="invalid distance code",t.mode=Zt;break}t.offset=_,t.extra=15&g,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=Zt;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=Zt;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=xd);break;case 16205:if(l===0)break e;i[o++]=t.length,l--,t.mode=xd;break;case fp:if(t.wrap){for(;c<32;){if(a===0)break e;a--,u|=r[s++]<{if(ia(e))return yi;let n=e.state;return n.window&&(n.window=null),e.state=null,Yo},inflateGetHeader:(e,n)=>{if(ia(e))return yi;const t=e.state;return 2&t.wrap?(t.head=n,n.done=!1,Yo):yi},inflateSetDictionary:(e,n)=>{const t=n.length;let r,i,s;return ia(e)?yi:(r=e.state,r.wrap!==0&&r.mode!==Ad?yi:r.mode===Ad&&(i=1,i=Qu(i,n,t,0),i!==r.check)?v1:(s=T1(e,n,t,t),s?(r.mode=16210,y1):(r.havedict=1,Yo)))},inflateInfo:"pako inflate (from Nodeca project)"},WA=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 kC=Object.prototype.toString,{Z_NO_FLUSH:KA,Z_FINISH:QA,Z_OK:Ju,Z_STREAM_END:mp,Z_NEED_DICT:gp,Z_STREAM_ERROR:YA,Z_DATA_ERROR:w1,Z_MEM_ERROR:ZA}=Da;function ec(e){this.options=n0.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 IC,this.strm.avail_out=0;let t=Is.inflateInit2(this.strm,n.windowBits);if(t!==Ju)throw new Error(wa[t]);if(this.header=new WA,Is.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=Lc.string2buf(n.dictionary):kC.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Is.inflateSetDictionary(this.strm,n.dictionary),t!==Ju)))throw new Error(wa[t])}function vp(e,n){const t=new ec(n);if(t.push(e),t.err)throw t.msg||wa[t.err];return t.result}ec.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?QA:KA,kC.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=Is.inflate(t,o),s===gp&&i&&(s=Is.inflateSetDictionary(t,i),s===Ju?s=Is.inflate(t,o):s===w1&&(s=gp));t.avail_in>0&&s===mp&&t.state.wrap>0&&e[t.next_in]!==0;)Is.inflateReset(t),s=Is.inflate(t,o);switch(s){case YA:case w1:case gp:case ZA:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===mp))if(this.options.to==="string"){let l=Lc.utf8border(t.output,t.next_out),u=t.next_out-l,c=Lc.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!==Ju||a!==0){if(s===mp)return s=Is.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},ec.prototype.onData=function(e){this.chunks.push(e)},ec.prototype.onEnd=function(e){e===Ju&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n0.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var XA={Inflate:ec,inflate:vp,inflateRaw:function(e,n){return(n=n||{}).raw=!0,vp(e,n)},ungzip:vp,constants:Da};const{Deflate:JA,deflate:e6,deflateRaw:t6,gzip:n6}=DA,{Inflate:r6,inflate:i6,inflateRaw:s6,ungzip:o6}=XA;var as,a6={Deflate:JA,deflate:e6,deflateRaw:t6,gzip:n6,Inflate:r6,inflate:i6,inflateRaw:s6,ungzip:o6,constants:Da},N1=function(e){return y(void 0,void 0,void 0,function(){var n;return v(this,function(t){return n=a6.ungzip(e),[2,String.fromCharCode.apply(null,n)]})})};(function(e){e.CONNECTING="CONNECTING",e.OPEN="OPEN",e.CLOSED="CLOSED"})(as||(as={}));var rt,l6=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===as.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return as.CONNECTING;case 1:return as.OPEN}return as.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=gt.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 v(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 v(this,function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),[4,N1(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,N1(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!==as.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}(La),RC=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),u6=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 aA(n,{session:r,sdkState:i,dispatcher:s,logger:o,useFetchCompat:l}),this.websocketClient=new l6(n,{sdkState:i,dispatcher:s,logger:o}),this.websocketClient.on("message",function(c){if(c.payload.unread_cnt&&u._dispatcher.dispatch(new RC(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 v(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 v(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 v(this,function(t){switch(t.label){case 0:return n instanceof J?[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"})(rt||(rt={}));var sa,oa,_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),LC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),nm=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),DC=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),I1=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 ye(Ie({enabled:n.isEnabled,feed_channels:n.feedChannels,template_list_token:n.templateListToken,settings_updated_at:n.settingsUpdatedAt}))},e}(),Wg=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},A1=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 ye(Ie({last_updated_at:n.lastUpdatedAt}))},e}(),M1=function(){function e(n){var t;this.token=(t=n.template_list_token)!==null&&t!==void 0?t:""}return e.payloadify=function(n){return ye(Ie({template_list_token:n.token}))},e}(),Od=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 ye(Ie({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}(),yp=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 Od(n.default),this.realTime=new Od(n.realtime)}return e.payloadify=function(n){return ye(Ie({default:Od.payloadify(n.default),realtime:Od.payloadify(n.realTime)}))},e}(),x1=1048576,c6=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"})(sa||(sa={})),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"}(oa||(oa={}));var O1=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*x1: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:sa.NONE,this.lastMessageThreadingPolicy=(a=n.last_msg_threading_policy)!==null&&a!==void 0?a:oa.NONE,this.uikitConfigInfo=new A1((l=n.uikit_config)!==null&&l!==void 0?l:{}),this.notificationInfo=n.notifications?new I1(n.notifications):null,this.messageTemplateInfo=n.message_template?new M1(n.message_template):null,this.statConfigInfo=n.log_publish_config?new yp(n.log_publish_config):new yp}return e.payloadify=function(n){return ye(Ie({emoji_hash:n.emojiHash,file_upload_size_limit:n.uploadSizeLimit/x1,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?A1.payloadify(n.uikitConfigInfo):null,notifications:n.notificationInfo?I1.payloadify(n.notificationInfo):null,message_template:n.messageTemplateInfo?M1.payloadify(n.messageTemplateInfo):null,log_publish_config:n.statConfigInfo?yp.payloadify(n.statConfigInfo):null}))},e}(),Kn=function(){function e(n){this._iid="",this._iid=n}return e.payloadify=function(n){return{}},e}(),d6=function(e){function n(t){var r=t.userId,i=t.metadata,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(r,"/metadata"),s.params={metadata:i},s}return T(n,e),n}(J),h6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaData=r,i}return T(n,e),n}(se),f6=function(e){function n(t){var r=t.userId,i=t.metadata,s=t.upsert,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Xe,"/").concat(r,"/metadata"),o.params={metadata:i,upsert:s},o}return T(n,e),n}(J),p6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metadata=r,i}return T(n,e),n}(se),_6=function(e){function n(t){var r=t.userId,i=t.metadataKey,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(r,"/metadata/").concat(i),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var m6=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(r,"/metadata"),i}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var fl,Qc=function(e,n){var t=JSON.parse(JSON.stringify(e));return t._iid&&delete t._iid,n&&n(t),t},pa=function(e,n){var t=JSON.parse(JSON.stringify(e));return t},Y=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"})(fl||(fl={}));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=fl.NON_AVAILABLE,$e(fl,r.is_online)?b.connectionStatus=r.is_online:R("boolean",r.is_online)&&(b.connectionStatus=r.is_online?fl.ONLINE:fl.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?De([],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 ye(Ie(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 Qc(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 R("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 v(this,function(u){switch(u.label){case 0:return Y(this._isValidMetaData(t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new d6({userId:i.userId,metadata:t}),[4,s.send(o)];case 1:return a=u.sent(),l=a.as(h6).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 v(this,function(c){switch(c.label){case 0:return Y(this._isValidMetaData(t)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new f6({userId:s.userId,metadata:t,upsert:r}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(p6).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 v(this,function(l){switch(l.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new _6({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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new m6({userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.metaData={},[2]}})})},n}(Kn),UC=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),rm=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 O1(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 ye(Ie(M(M(M({},Ke.payloadify(n.user)),O1.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 UC({userProfile:this}))},e}(),PC=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),ch=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 rm(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 v(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 PC({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}(gt),Ua=function(){function e(){this.type=rt.NONE,this.name="none"}return e.prototype.run=function(n){return y(this,void 0,void 0,function(){return v(this,function(t){return[2]})})},e.prototype.onConnect=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e.prototype.onReconnect=function(n,t){return t.resetReconnectCount,y(this,void 0,void 0,function(){return v(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 v(this,function(r){return[2]})})},e.prototype.onDisconnectWebSocket=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e.prototype.onLogout=function(n,t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},e}(),Re=function(e){return y(void 0,void 0,void 0,function(){var n;return v(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]}})})},kt=function(e){return y(void 0,void 0,void 0,function(){return v(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=rt.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 v(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 Kg,r)];case 2:return o.sent(),this._wasPreviouslyConnected&&Re(function(){return y(s,void 0,void 0,function(){return v(this,function(a){return t.connectionHandlers.forEach(function(l){l.onDisconnected&&l.onDisconnected(i)}),[2]})})}),[2]}})})},n}(Ua),i0=function(e){function n(){var t=e.call(this)||this;return t.type=rt.EXTERNAL_DISCONNECTED,t.name="externaldisconnected",t}return T(n,e),n.prototype.run=function(t){return y(this,void 0,void 0,function(){return v(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 v(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new o0({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 v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new nf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return v(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}(Ua),tf=function(e){function n(t){var r=t.autoReconnect,i=e.call(this)||this;return i.type=rt.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 v(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 nf,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 v(this,function(s){switch(s.label){case 0:return i=Date.now(),[4,t.disconnect()];case 1:return s.sent(),[4,t.changeState(new o0({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 v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new nf,r)];case 1:return i.sent(),[2]}})})},n.prototype.onDisconnectWebSocket=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=Date.now(),[4,t.changeState(new i0,r)];case 1:return i.sent(),[2]}})})},n.prototype.onLogout=function(t){return y(this,void 0,void 0,function(){var r;return v(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}(Ua),Or=function(e){return y(void 0,void 0,void 0,function(){return v(this,function(n){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},FC=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),s0=function(e,n,t){return t===void 0&&(t=new FC),y(void 0,void 0,void 0,function(){var r,i,s,o,a,l;return v(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 v(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,message:r.error.message})),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=Yh.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(Yh.sendbirdSdkUserAgentWithExtension(l)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(jC))).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 zg(new $t({type:Et.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 v(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(ch.asError(L.connectionRenew))},n.prototype.disconnect=function(){return y(this,void 0,void 0,function(){return v(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 v(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}(La),BC=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=Z.POST,h.params=ye({expiring_session:!!d,services:s,include_logi:!0,include_extra_data:String(jC),uikit_config:a,use_local_cache:u,app_id:r}),h.requireAuth=!1,h}return T(n,e),n}(J),b6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.logi=new ch(t,"LOGI",r),i}return T(n,e),n}(se);(function(e){e[e.ALL=0]="ALL",e[e.WEBSOCKET=1]="WEBSOCKET",e[e.API=2]="API"})(eo||(eo={}));var Ht,R1,C6=[Gg,BC],S6=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=rt.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new u6(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;if(c instanceof _i){var p=c.stateType;switch(u._currentConnectionStateType=p,p){case rt.CONNECTED:u._resolveLazyCallQueue();break;case rt.INITIALIZED:case rt.INTERNAL_DISCONNECTED:case rt.EXTERNAL_DISCONNECTED:case rt.LOGOUT:u._rejectLazyCallQueue(!((f=u._session)===null||f===void 0)&&f.hasSession?L.connectionClosed:L.connectionRequired)}}else if(c instanceof LC)u._session.hasChatServicePermission||u._resolveLazyCallQueue(eo.API);else if(c instanceof nm||c instanceof DC)u._rejectLazyCallQueue(L.connectionClosed);else if(c instanceof fC){var m=c.request,b=c.deferred,g=c.error;try{for(var _=pe(C6),E=_.next();!E.done;E=_.next())if(m instanceof E.value)return void b.reject(g)}catch(S){d={error:S}}finally{try{E&&!E.done&&(h=_.return)&&h.call(_)}finally{if(d)throw d.error}}u._lazyCallQueue.push({command:m,deferred:b})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===rt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===rt.CONNECTING||this._currentConnectionStateType===rt.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(n){var t,r=[],i=[];switch(n){case eo.ALL:t=null;break;case eo.WEBSOCKET:t=wr;break;case eo.API:t=J}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=eo.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 v(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=eo.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 v(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 v(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 J?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 v(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",n),n instanceof wr||n instanceof J?[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}(),Ep="sendbird@devicetokens",bp=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 ye(Ie({type:n.type,token:n.token,device_os:n.deviceOS,device_manufacturer:n.deviceManufacturer,system_push_enabled:n.systemPushEnabled}))},e}(),Cp=new WeakMap,T6=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=rt.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 if(h instanceof Ul&&d.handler&&!d.isSessionKeyRefreshing){if(d._currentConnectionStateType===rt.CONNECTING)return;!((f=h.error)===null||f===void 0)&&f.isSessionInvalidatedError?d.close():(!((p=h.error)===null||p===void 0)&&p.isSessionTokenExpiredError&&d.refreshAuthToken().catch(function(g){if(Lr(g)&&d._sdkState.appState==="foreground")throw g}),!((m=h.error)===null||m===void 0)&&m.isSessionKeyExpiredError&&(d._logger.debug("session expired"),d.handler.onSessionExpired&&d.handler.onSessionExpired(),d.refreshSessionKey().catch(function(g){if(Lr(g)&&d._sdkState.appState==="foreground")throw g})))}}),d}return T(n,e),Object.defineProperty(n.prototype,"ekey",{get:function(){return Cp.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 nA({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 v(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(iA),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 v(this,function(s){switch(s.label){case 0:return r=new Gg({userId:this._sdkState.userId,authToken:t,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,s0(function(o){return y(i,void 0,void 0,function(){var a,l,u,c,d;return v(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(rA),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 v(this,function(o){switch(o.label){case 0:if(this._currentConnectionStateType!==rt.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),Re(function(){return y(r,void 0,void 0,function(){var u;return v(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 v(this,function(s){switch(s.label){case 0:return t instanceof L&&(t.isSessionTokenExpiredError||t.code===Te.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(),[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 v(this,function(l){switch(l.label){case 0:return this.session.authToken=r,s=new BC({appId:this._sdkState.appId,userId:t,services:[xc.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(b6).logi).error?[3,4]:this.session.hasChatServicePermission?[3,3]:[4,a.applyTo(this._iid)];case 2:l.sent(),l.label=3;case 3:return[3,5];case 4:throw a.error;case 5: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 v(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,Cp.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(Ep)]:[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 v(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=De([],Ae(n),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new w6({deviceId:this.deviceId,statLogs:r}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=De([],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!==Te.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=Ht.DISABLED,[3,7];case 6:s.code===Te.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=Ht.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 v(this,function(t){switch(t.label){case 0:return n=De(De([],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 $t.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 v(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}($t),N6=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 v(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 $t({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 v(this,function(l){switch(l.label){case 0:return this.statConfig=t,this.statConfig.minInterval=864e5,this._mergeQueue(),r.localCacheStat?(this.enabledState=r.enabledStat?Ht.ENABLED:Ht.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ht.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 v(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=ye(M(M({},i.data),{message_id:(s=i.data.notificationId)!==null&&s!==void 0?s:i.data.message_id,notificationId:void 0})),new $t({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 v(this,function(s){switch(s.label){case 0:return this.statConfig=t,this._mergeQueue(),r.notificationStat?(this.enabledState=r.enabledStat?Ht.ENABLED:Ht.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=Ht.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 v(this,function(i){switch(i.label){case 0:return this.enabledState===Ht.DISABLED?[2,!0]:(r=this.enabledState===Ht.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(t)?[2,!0]:(r.push(t),this.enabledState===Ht.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}(Qg),M6=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=Bs(),this.cacheContext=t,this.requestQueue=r,this.dispatcher=i,this.logger=s,this._dailyStatCollector=new N6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new I6({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._realTimeStatCollector=new A6({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 v(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===Et.FEATURE_LOCALCACHE&&t.push(new $t({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 $t.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})]):[3,6];case 2:return s.sent(),r=[],n.statLogs.forEach(function(o){o.stat_type!==Et.FEATURE_LOCALCACHE&&o.stat_type!==Et.NOTIFICATION&&(o.stat_type===Et.FEATURE_LOCALCACHE_EVENT&&(o.data=M({message_init_policy:"",starting_point:0},o.data)),r.push(new $t({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 $t.payloadify(o)}),generation:n.generation,lastFlushedAt:n.lastFlushedAt})];case 3:return s.sent(),i=[],n.statLogs.forEach(function(o){var a;o.stat_type===Et.NOTIFICATION&&(o.data=ye(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 $t({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 $t.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 v(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 v(this,function(d){return i instanceof zg?(s=i.statLog,this.put(s)):i instanceof PC&&(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 v(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 Et.API_RESULT:case Et.WEBSOCKET_CONNECT:return[3,4];case Et.FEATURE_LOCALCACHE:case Et.FEATURE_LOCALCACHE_EVENT:return[3,7];case Et.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=Ht.COLLECT_ONLY,this._defaultStatCollector.enabledState=Ht.COLLECT_ONLY,this._realTimeStatCollector.enabledState=Ht.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"})(rf||(rf={}));var G,x6=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}(Kn),Ho={},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,!Ho[n]){Ho[n]=this;var h=(r=t.options)!==null&&r!==void 0?r:new sC,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 FC,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 G4({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 aC});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 q4,g=new V4;this.requestQueue=new S6(n,{session:g,sdkState:f,dispatcher:b,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new x6(n),this.sessionManager=new T6({_iid:n,session:g,cacheContext:m,sdkState:f,dispatcher:b,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new g6(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 M6({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=(d=t.appStateToggleEnabled)===null||d===void 0||d}return Ho[n]}return e.of=function(n){if(Ho[n])return Ho[n];throw L.lostInstance},e.clear=function(n){Ho[n]&&delete Ho[n]},e.prototype.hasExtension=function(n){return this.sdkState.extensions&&this.sdkState.extensions[n]},e}(),Yg=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 Ts=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},bt=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),Zg=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),GC=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),zC=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),VC=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),qC=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),WC=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),Xg=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 O6="removed",im=function(e){switch(e){case"open":return Hl.OPEN;case"closed":return Hl.CLOSED;default:return null}},KC=function(e){return!e||!!e.text&&R("string",e.text)},dh=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 ye(Ie(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}(Kn),xi=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g=this;return(g=e.call(this,t)||this).id=0,g.title=null,g.createdAt=0,g.updatedAt=0,g.closeAt=-1,g.status=Hl.CLOSED,g.messageId=0,g.data=null,g.voterCount=-1,g.options=[],g.createdBy=null,g.allowUserSuggestion=!1,g.allowMultipleVotes=!1,g.votedPollOptionIds=[],g.id=(i=r.id)!==null&&i!==void 0?i:0,g.title=(s=r.title)!==null&&s!==void 0?s:null,g.createdAt=(o=r.created_at)!==null&&o!==void 0?o:0,g.updatedAt=(a=r.updated_at)!==null&&a!==void 0?a:0,g.closeAt=(l=r.close_at)!==null&&l!==void 0?l:-1,g.status=(u=im(r.status))!==null&&u!==void 0?u:Hl.CLOSED,g.messageId=(c=r.message_id)!==null&&c!==void 0?c:0,g.data=(d=r.data)!==null&&d!==void 0?d:null,g.voterCount=(h=r.voter_count)!==null&&h!==void 0?h:-1,g.options=r.options?r.options.map(function(_){return new dh(g._iid,_)}):[],g.createdBy=(f=r.created_by)!==null&&f!==void 0?f:null,g.allowUserSuggestion=(p=r.allow_user_suggestion)!==null&&p!==void 0&&p,g.allowMultipleVotes=(m=r.allow_multiple_votes)!==null&&m!==void 0&&m,g.votedPollOptionIds=(b=r.voted_option_ids)!==null&&b!==void 0?b:[],g}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=im(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 dh(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 ye(Ie(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 dh.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 Qc(this)},n}(Kn),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 R("number",this.limit)&&this.limit>0},e}(),Gs=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)&&R("string",this.channelUrl)&&$e(Ze,this.channelType)},n}(Uo),k6=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},R6=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=Z.POST,u.path=Ki,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}(J),L6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),D6=function(e){function n(t){var r=t.channelUrl,i=t.channelType,s=t.pollId,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(Ki,"/").concat(encodeURIComponent(s)),o.params={channel_url:r,channel_type:i},o}return T(n,e),n}(J),U6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),P6=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=Z.GET,a.path="".concat(Ki,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(o)),a.params={channel_url:r,channel_type:i},a}return T(n,e),n}(J),F6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.pollOption=new dh(t,r),i}return T(n,e),n}(se),H6=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=Z.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/polls/changelogs"),a.params=ye({change_ts:s,token:o}),a}return T(n,e),n}(J),j6=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 xi(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}(se),B6={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},QC=function(e){return R("string",e.title)&&(n=e.optionTexts,We("string",n)&&n.every(function(t){return t.trim()!==""}))&&KC(e.data)&&R("boolean",e.allowUserSuggestion,!0)&&R("boolean",e.allowMultipleVotes,!0)&&R("number",e.closeAt,!0);var n},$6={channelUrl:"",channelType:Ze.BASE,pollId:0,pollOptionId:0},YC=function(e){return R("string",e.channelUrl)&&e.channelUrl!==""&&$e(Ze,e.channelType)&&R("number",e.pollId)&&e.pollId>0&&R("number",e.pollOptionId)&&e.pollOptionId>0},G6={channelUrl:"",channelType:Ze.BASE,pollId:0},ZC=function(e){return R("string",e.channelUrl)&&e.channelUrl!==""&&$e(Ze,e.channelType)&&R("number",e.pollId)},L1={},sf=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,L1[n]=this}return e.of=function(n){return L1[n]},e.prototype.buildPollFromSerializedData=function(n){var t=pa(n);return new xi(this._iid,xi.payloadify(t))},e.prototype.get=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(ZC(n)).throw(L.invalidParameters),t=new D6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(U6).poll]}})})},e.prototype.create=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(QC(n)).throw(L.invalidParameters),t=new R6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(L6).poll]}})})},e.prototype.getOption=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return Y(YC(n)).throw(L.invalidParameters),t=new P6(M({},n)),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(F6).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 v(this,function(h){switch(h.label){case 0:return s=new H6(Ie({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(j6),l=a.updatedPolls,u=a.deletedPollIds,c=a.hasMore,d=a.nextToken,l.length>0&&this._dispatcher.dispatch(new qC({polls:l,source:i})),[2,{updatedPolls:l,deletedPollIds:u,hasMore:c,token:d}]}})})},e}(),z6=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=Z.GET,a.path=Ki,a.params={channel_url:r,channel_type:i,token:s,limit:o},a}return T(n,e),n}(J),V6=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 xi(t,o)}),s.token=r.next,s}return T(n,e),n}(se),XC=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 v(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 z6(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(V6),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}(Gs),q6=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=Z.GET,u.path="".concat(Ki,"/").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}(J),W6=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}(se),JC=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)&&R("number",this.pollId)&&R("number",this.pollOptionId)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 q6(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(W6),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}(Gs),Dc,zs=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 ye(Ie(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}(),of=function(e){function n(t){var r=e.call(this)||this;if(r.method=Z.POST,r.path="".concat(W4),r.params=ye({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 ye(Ie(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}(Kn);(function(e){e.ADD="add",e.DELETE="delete"})(Dc||(Dc={}));var to,Jg=function(e){this.messageId=0,this.operation=null,this.updatedAt=0;var n=R("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&&R("string",t)&&R("string",r)&&$e(Dc,r)&&R("string",i)&&i&&R("number",s)&&(this.messageId=n,this.userId=t,this.key=i,this.operation=r,this.updatedAt=s)},kd=function(){function e(n){var t,r,i,s=n.key,o=(i=De([],Ae(n.user_ids),!1))!==null&&i!==void 0?i:[],a=n.updated_at;R("string",s)&&s&&We("string",o)&&o.length>0&&R("number",a)&&(this.key=s,this.userIds=o,this.updatedAt=a);var l={};try{for(var u=pe(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 ye(Ie({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 Dc.ADD:t<0&&this.userIds.push(n.userId);break;case Dc.DELETE:t>=0&&this.userIds.splice(t,1)}this._version[n.userId]=n.updatedAt}this.updatedAt=Math.max(this.updatedAt,n.updatedAt)}},e}(),D1=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 ye(Ie({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}(),U1=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 D1(n["og:image"]))}return e.payloadify=function(n){return ye(Ie({"og:title":n.title,"og:url":n.url,"og:description":n.description,"og:image":n.defaultImage?D1.payloadify(n.defaultImage):null}))},e}(),Oi=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 ye(Ie({name:n.name,volume:n.volume}))},e}();(function(e){e.GOOD="good",e.BAD="bad"})(to||(to={}));var P1,Ms=function(){function e(n){this.id=n.id,this.rating=n.rating,this.comment=n.comment}return e._getStatus=function(n){return n?"id"in n?"SUBMITTED":"NO_FEEDBACK":"NOT_APPLICABLE"},e._isSubmitted=function(n){return e._getStatus(n)==="SUBMITTED"},e._getPayloadByStatus=function(n){return n==="NO_FEEDBACK"?{}:null},e.payloadify=function(n){return ye(Ie({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=$e(Ni,r.role)?r.role:Ni.NONE,s.isBlockedByMe=(i=r.is_blocked_by_me)!==null&&i!==void 0&&i,s}return T(n,e),n.payloadify=function(t){return ye(Ie(M(M({},e.payloadify.call(this,t)),{role:t.role,is_blocked_by_me:t.isBlockedByMe})))},n}(Ke),_r=function(){function e(n){this.key=n.key,this.value=We("string",n.value)?De([],Ae(n.value),!1):[]}return e.payloadify=function(n){var t;return ye(Ie({key:n.key,value:(t=n.value)!==null&&t!==void 0?t:[]}))},e}(),eS=function(e){switch(e){case Ct.BASE:return"";case Ct.USER:return"MESG";case Ct.FILE:return"FILE";case Ct.ADMIN:return"ADMM"}},tS=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=Ct.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=$e(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=$e(rr,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 g=0;g0},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 ye(Ie({key:(t=n.formKey)!==null&&t!==void 0?t:n.key,fields:n.fields.map(function(r){return nS.payloadify(r)})}))},e.isFormPayload=function(n){var t;return!!(!((t=n==null?void 0:n.forms)===null||t===void 0)&&t[0])},e}(),nS=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 ye(Ie({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}(),rS=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}(Kn),K6=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=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/messages/mark_as_read"),r.params=ye(Ie({user_id:o,message_ids:a})),r}return T(n,e),n})(J);var iS=function(e){function n(t,r,i){var s=e.call(this,t,"READ",i)||this;return s.readStatus=new rS(t,i),s}return T(n,e),n}(gt);(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})(se);var Q6=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),Y6=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=Z.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}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var F1=function(e){function n(t){var r=e.call(this)||this;return r.method=Z.POST,r.path="".concat(sr,"/").concat(encodeURIComponent(t.channelUrl),"/messages/").concat(t.messageId,"/submit_forms"),r.params=ye({forms:t.forms}),r}return T(n,e),n}(J),Z6=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=Z.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}(J),X6=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Ms(r),i}return T(n,e),n}(se),J6=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=Z.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}(J),eM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Ms(r),i}return T(n,e),n}(se),tM=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=Z.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/feedbacks/").concat(o),a}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.feedback=new Ms(r),i}T(n,e)})(se);var uo,ii,sm=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 zs(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 ye(Ie({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}(Kn),sS=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"}(ii||(ii={}));var aa,hr=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h=this;return(h=e.call(this,t,r)||this).parentMessage=null,h.silent=!1,h.isOperatorMessage=!1,h.threadInfo=null,h.reactions=[],h.appleCriticalAlertOptions=null,h.scheduledInfo=null,h.suggestedReplies=null,h.myFeedback=null,h.myFeedbackStatus="NOT_APPLICABLE",h.forms=null,h._isContinuousMessages=!1,h._scheduledStatus=null,h.messageId=(s=(i=r.msg_id)!==null&&i!==void 0?i:r.message_id)!==null&&s!==void 0?s:0,h.parentMessageId=(o=typeof r.parent_message_id=="string"?parseInt(r.parent_message_id):r.parent_message_id)!==null&&o!==void 0?o:0,h.threadInfo=r.thread_info?new lf(h._iid,r.thread_info):null,h.reactions=r.reactions?r.reactions.map(function(f){return new kd(f)}):[],h.ogMetaData=r.og_tag?new U1(r.og_tag):null,h.silent=(a=r.silent)!==null&&a!==void 0&&a,h.isOperatorMessage=(l=r.is_op_msg)!==null&&l!==void 0&&l,h.appleCriticalAlertOptions=r.apple_critical_alert_options?new Oi(r.apple_critical_alert_options):null,typeof r.scheduled_message_id=="number"&&typeof r.scheduled_at=="number"&&r.scheduled_status&&(h.scheduledInfo={scheduledMessageId:r.scheduled_message_id,scheduledAt:r.scheduled_at},h._scheduledStatus=r.scheduled_status),h._isContinuousMessages=(u=r.is_continuous_messages)!==null&&u!==void 0&&u,h.myFeedback=Ms._isSubmitted(r.feedback)?new Ms(r.feedback):null,h.myFeedbackStatus=Ms._getStatus(r.feedback),h.suggestedReplies=(d=(c=r.extended_message_payload)===null||c===void 0?void 0:c.suggested_replies)!==null&&d!==void 0?d:null,h.forms=Rd.isFormPayload(r.extended_message_payload)?r.extended_message_payload.forms.map(function(f){return new Rd(h.messageId,f.key,f.fields.map(function(p){return new nS(p)}))}):null,h}return T(n,e),n.payloadify=function(t){var r,i;return ye(Ie(M(M({},e.payloadify.call(this,t)),{message_id:t.messageId,parent_message_id:t.parentMessageId,thread_info:t.threadInfo?lf.payloadify(t.threadInfo):null,reactions:t.reactions.map(function(s){return kd.payloadify(s)}),og_tag:t.ogMetaData?U1.payloadify(t.ogMetaData):null,silent:t.silent,is_op_msg:t.isOperatorMessage,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.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?Ms.payloadify(t.myFeedback):Ms._getPayloadByStatus(t.myFeedbackStatus),forms:t.forms?t.forms.map(function(s){return Rd.payloadify(s)}):null})))},n._getParentMessageInfoPayload=function(t){return ye(Ie({type:eS(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 sm.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 v(this,function(r){return(t=O.of(this._iid).dispatcher).dispatch(new sS({channelType:Ze.GROUP,channelUrl:this.channelUrl,parentMessage:this})),t.dispatch(new bt({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 v(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new Q6({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 v(this,function(s){switch(s.label){case 0:return r=O.of(this._iid).requestQueue,i=new Y6({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 v(this,function(c){switch(c.label){case 0:if(Y(t.form&&t.form instanceof Rd||R("string",t.formId)&&R("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:Te.INVALID_PARAMETER,message:"The given form is not submittable."});if(a.isSubmitted)throw new L({code:Te.INVALID_PARAMETER,message:"The given form is already submitted."});if(a.messageId!=this.messageId)throw new L({code:Te.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 F1({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 F1({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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new Z6({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(X6),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new J6({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(eM),this.myFeedback=l.feedback,this.myFeedbackStatus="SUBMITTED",s.dispatch(new bt({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 v(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new tM({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 bt({messages:[this],source:G.EVENT_MESSAGE_FEEDBACK_DELETED})),[2]}})})},n}(tS),Ft=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&&$e(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 ii.SENT:case ii.IN_QUEUE:l.sendingStatus=ut.SUCCEEDED;break;case ii.PENDING:l.sendingStatus=ut.SCHEDULED;break;case ii.FAILED:case ii.REMOVED:l.sendingStatus=ut.FAILED;break;case ii.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 ye(Ie(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)&&B4(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}(hr),Yc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:tr.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1},a0=function(e){return R("number",e.prevResultSize)&&R("number",e.nextResultSize)&&R("boolean",e.isInclusive)&&R("boolean",e.reverse)&&R("string",e.messageTypeFilter)&&$e(tr,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeReactions)&&R("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=Ct.ADMIN,l.translations=(s=r.translations)!==null&&s!==void 0?s:{},r.parent_message_info){var u=r.parent_message_info;l.parentMessage=yr(t,ye(Ie(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 ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(hr),H1=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&&R("object",n.detail)&&!Array.isArray(n.detail)&&(this.detail=n.detail)}return e.payloadify=function(n){return ye(Ie({type:n.type,vendor:n.vendor,detail:n.detail}))},e}(),j1=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 ye({status:n.status,original_message_info:n.originalMessageInfo?{id:n.originalMessageInfo.messageId,ts:n.originalMessageInfo.createdAt}:void 0})},e}(),er=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=Ct.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=pe(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 H1(b)}):[],d._poll=r.poll?new xi(d._iid,r.poll):null,r.parent_message_info){var m=r.parent_message_info;d.parentMessage=yr(t,ye(Ie(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 j1(r.review_info)),d}return T(n,e),n.payloadify=function(t){return ye(Ie(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 H1.payloadify(r)}),poll:t._poll?xi.payloadify(t._poll):null,parent_message_info:t.parentMessage?e._getParentMessageInfoPayload.call(this,t.parentMessage):null,review_info:t.messageReviewInfo?j1.payloadify(t.messageReviewInfo):void 0})))},n.prototype.getThreadedMessagesByTimestamp=function(t,r){return y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(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}(Ft),li=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=Ct.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 sm(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=yr(t,ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(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 ye(Ie(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 sm.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}(Ft);(function(e){e.SENT="SENT",e.READ="READ"})(aa||(aa={}));var Na=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=Ct.ADMIN,o.messageStatus=(i=r.message_status)!==null&&i!==void 0?i:aa.SENT,o.priority=(s=r.priority)!==null&&s!==void 0?s:K_.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 ye(Ie(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}(tS),B1=function(e){if(e.notificationId)return Na.payloadify(e);switch(e.messageType){case Ct.USER:return er.payloadify(e);case Ct.FILE:return e.fileInfoList?li.payloadify(e):Jt.payloadify(e);case Ct.ADMIN:return Bl.payloadify(e);default:throw L.unknown}},yr=function(e,n){if(n.notification_message_id)return new Na(e,n);switch(n.type){case"MESG":return new er(e,n);case"FILE":return li._isMultipleFilesMessagePayload(n)?new li(e,n):new Jt(e,n);case"ADMM":case"BRDM":return new Bl(e,n);default:return null}},Jt=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_=this;(_=e.call(this,t,r)||this).messageParams=null,_.plainUrl="",_.requireAuth=!1,_.thumbnails=[],_.messageSurvivalSeconds=-1,_.messageType=Ct.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 zs(_._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=yr(t,ye(Ie(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:(g=S.file)===null||g===void 0?void 0:g.require_auth}))))}return _}return T(n,e),n.payloadify=function(t){var r;return ye(Ie(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},Yc),r),Y(this.messageId>0&&R("number",t)&&a0(i)).throw(L.invalidParameters),[4,An.of(this._iid).getThreadedMessagesByTimestamp(this,t,i)];case 1:return[2,s.sent()]}})})},n}(Ft),uf=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}(Kn),nM=function(e){function n(t){var r,i,s,o,a=[];return t.mentionType===rr.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:ye(Ie({channel_url:t.channelUrl,files:t.files?aS(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 zs.payloadify(l)}),require_auth:t.requireAuth,metaarray:t.metaArrays,mention_type:t.mentionType,mentioned_user_ids:a,push_option:t.pushNotificationDeliveryOption&&t.pushNotificationDeliveryOption!==Wi.DEFAULT?t.pushNotificationDeliveryOption:void 0,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.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),rM=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];return t.mentionType===rr.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(a){return a.userId}))),s.method=Z.POST,s.path="".concat(Je(t.channelType),"/").concat(encodeURIComponent(t.channelUrl),"/messages"),s.params=ye(Ie({message_type:Ct.FILE,user_id:t.userId,files:t.files?aS(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 zs.payloadify(a)}),require_auth:t.requireAuth,sorted_metaarray:(i=t.metaArrays)===null||i===void 0?void 0:i.map(function(a){return _r.payloadify(a)}),push_option:t.pushNotificationDeliveryOption,parent_message_id:t.parentMessageId?t.parentMessageId:null,apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,reply_to_channel:t.isReplyToChannel,req_id:t.reqId,pin_message:t.isPinnedMessage})),s}return T(n,e),n}(J),oS=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 li(t,i):new Jt(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}(gt),iM=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 li(t,r):new Jt(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}(se);function aS(e){return e.map(function(n){var t,r;return ye(Ie({url:uf.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 zs.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 sM=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===rt.CONNECTED||this._connectionState===rt.CONNECTING||this._connectionState===rt.RECONNECTING},enumerable:!1,configurable:!0}),e.prototype._sendFileMessage=function(n,t){return y(this,void 0,void 0,function(){var r,i,s;return v(this,function(o){switch(o.label){case 0:return r=this._createSendFileMessageRequestParams(n,t),this._shouldSendThroughWebSocket?(i=new nM(r),[4,this._requestQueue.send(i)]):[3,2];case 1:return s=o.sent(),[2,s.as(oS).message];case 2:return i=new rM(M(M({},r),{userId:this._sdkState.userId})),[4,this._requestQueue.send(i)];case 3:return s=o.sent(),[2,s.as(iM).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 v(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=pe(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===Te.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 v(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],!pr(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 v(this,function(g){switch(g.label){case 0:return a=new of({file:r.file,channelUrl:n.url,thumbnailSizes:r.thumbnailSizes,requestId:t.requestId}),[4,this._requestQueue.send(a)];case 1:return l=g.sent(),u=l.as(af),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,g;return v(this,function(_){switch(_.label){case 0:return a=t.multipleFileUploadInfo.uploadIndex,l=r.fileInfoList[a],u=new of({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(af),h=d.url,f=d.fileSize,p=f===void 0?l.fileSize:f,m=d.thumbnails,b=d.requireAuth,g=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:g,isUploaded:!0}),l instanceof uf||(r.fileInfoList[a]=new uf(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 v(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})]:De([],Ae(s.messageQueue),!1);try{for(var a=pe(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 Zh({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 Zh({requestId:t})))},e}(),om,tc={prevResultSize:0,nextResultSize:0,isInclusive:!1,reverse:!1,messageTypeFilter:tr.ALL,customTypesFilter:void 0,senderUserIdsFilter:void 0,replyType:Dn.NONE,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1,showSubchannelMessagesOnly:!1},$1=function(e){return R("number",e.prevResultSize)&&R("number",e.nextResultSize)&&R("boolean",e.isInclusive)&&R("boolean",e.reverse)&&R("string",e.messageTypeFilter)&&$e(tr,e.messageTypeFilter)&&We("string",e.customTypesFilter,!0)&&We("string",e.senderUserIdsFilter,!0)&&$e(Dn,e.replyType)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeReactions)&&R("boolean",e.includeParentMessageInfo)&&R("boolean",e.includeThreadInfo)&&R("boolean",e.showSubchannelMessagesOnly)},am={replyType:Dn.NONE,includeReactions:!1,includeThreadInfo:!1,includeMetaArray:!1,includeParentMessageInfo:!1},G1=function(e){return $e(Dn,e.replyType)&&R("boolean",e.includeReactions)&&R("boolean",e.includeMetaArray)&&R("boolean",e.includeParentMessageInfo)&&R("boolean",e.includeThreadInfo)},oM=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=Z.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}(J),aM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?yr(t,M({},r)):null,i}return T(n,e),n}(se),Ld=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,g=t.parentMessageId,_=t.includeThreadInfo,E=t.includeParentMessageInfo,S=t.showSubchannelMessagesOnly,w=t.checkingHasNext,N=t.checkingContinuousMessages,A=e.call(this)||this;return A.method=Z.GET,A.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages"),A.params=ye(Ie({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:g,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})),A}return T(n,e),n}(J),Dd=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 yr(t,s)}),i}return T(n,e),n}(se),lM=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=Z.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}(J),uM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.updatedMessages=r.updated.map(function(s){return yr(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}(se),cM=function(e){function n(t){var r=t.channelUrl,i=t.scheduledMessageId,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(sr,"/").concat(encodeURIComponent(r),"/scheduled_messages/").concat(encodeURIComponent(i)),s.params={},s}return T(n,e),n}(J),dM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=r?yr(t,M({},r)):null,i}return T(n,e),n}(se);(function(e){e.MUTED="muted",e.BANNED="banned"})(om||(om={}));var z1=function(){function e(n){var t,r,i,s;this.restrictionType=null,$e(om,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 ye(Ie({restriction_type:n.restrictionType,description:n.description,end_at:n.endAt,remaining_duration:n.remainingDuration}))},e}(),Pa=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.restrictionInfo=new z1(r),i}return T(n,e),n.payloadify=function(t){return ye(Ie(M(M({},e.payloadify.call(this,t)),z1.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}(),l0={data:void 0,customType:void 0,mentionType:rr.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},u0=function(e){return R("string",e.data,!0)&&R("string",e.customType,!0)&&$e(rr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&R("string",e.mentionedMessageTemplate,!0)&&We(_r,e.metaArrays,!0)&&R("number",e.parentMessageId,!0)&&R("boolean",e.isReplyToChannel)&&$e(Wi,e.pushNotificationDeliveryOption,!0)&&R(Oi,e.appleCriticalAlertOptions,!0)&&R("boolean",e.isPinnedMessage,!0)},V1=function(e){return{isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption,pollId:e.pollId}},lS=M(M({},l0),{message:"",translationTargetLanguages:void 0,pollId:void 0,extendedMessagePayload:void 0});function uS(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1}))}var _a,lm=function(e){var n;return ye(Ie({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}))},cS=function(e){return u0(e)&&R("string",e.message)&&We("string",e.translationTargetLanguages,!0)&&R("number",e.pollId,!0)&&R("object",e.extendedMessagePayload,!0)};(function(e){e.FILE="file",e.BLOB="blob",e.BLOB_LIKE_OBJECT="blobLikeObject",e.URL="url"})(_a||(_a={}));var hh=function(e){return typeof window<"u"&&"Blob"in window&&typeof Blob<"u"&&e instanceof Blob},Sp=function(e){return e===_a.BLOB||e===_a.FILE},q1=function(e){return{file:e.file,fileKey:e.fileKey,fileType:e.fileType,isReplyToChannel:e.isReplyToChannel,pushNotificationDeliveryOption:e.pushNotificationDeliveryOption}},W1=M(M({},l0),{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 dS(e){var n,t,r,i;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.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 nc,um=function(e,n){var t;return e.messageParams?(!e.url&&pr(n)&&(e.messageParams.file=n),e.messageParams):ye(Ie({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}})}))},K1=function(e){return u0(e)&&(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return R("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},ev={data:void 0,customType:void 0,mentionType:rr.USERS,mentionedUserIds:void 0,mentionedUsers:void 0,mentionedMessageTemplate:void 0,metaArrays:void 0,pushNotificationDeliveryOption:void 0,appleCriticalAlertOptions:void 0},tv=function(e){return R("string",e.data,!0)&&R("string",e.customType,!0)&&$e(rr,e.mentionType)&&We("string",e.mentionedUserIds,!0)&&We(Ke,e.mentionedUsers,!0)&&R("string",e.mentionedMessageTemplate,!0)&&We(_r,e.metaArrays,!0)&&$e(Wi,e.pushNotificationDeliveryOption,!0)&&R(Oi,e.appleCriticalAlertOptions,!0)},hS=M(M({},ev),{message:void 0,translationTargetLanguages:void 0,pollId:void 0}),fS=function(e){return tv(e)&&R("string",e.message,!0)&&We("string",e.translationTargetLanguages,!0)&&R("number",e.pollId,!0)},hM=M({},ev),fM=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=Z.GET,a.path="".concat(Je(i),"/").concat(encodeURIComponent(r),"/operators"),a.params={token:s,limit:o},a}return T(n,e),n}(J),pM=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}(se),_M=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 v(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 fM(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(pM),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}(Gs),mM=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=tr.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:tr.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)&&R("boolean",this.reverse)&&$e(tr,this.messageTypeFilter)&&$e(Dn,this.replyType)&&We("string",this.customTypesFilter,!0)&&We("string",this.senderUserIdsFilter,!0)&&R("boolean",this.includeMetaArray)&&R("boolean",this.includeReactions)&&R("boolean",this.includeParentMessageInfo)&&R("boolean",this.includeThreadInfo)&&R("boolean",this.showSubchannelMessagesOnly)},n.prototype.load=function(){return y(this,void 0,void 0,function(){var t;return v(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,Ie({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,De([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}(Gs),gM=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=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute"),r.params={limit:o,token:a},r}return T(n,e),n}(J),vM=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 Pa(t,a)})),i}return T(n,e),n}(se),yM=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 v(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 gM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(vM),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}(Gs),EM=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=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=ye({limit:o,token:a}),r}return T(n,e),n}(J),bM=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 Pa(t,a.user)})),i}return T(n,e),n}(se),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;return v(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 EM(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(bM),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}(Gs);(function(e){e.SPAM="spam",e.HARASSING="harassing",e.SUSPICIOUS="suspicious",e.INAPPROPRIATE="inappropriate"})(nc||(nc={}));var SM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var TM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.operatorUserIds;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/operators"),r.params={operator_ids:o},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var wM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(o),r}return T(n,e),n}(J),NM=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}(se),Q1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={keys:o,include_ts:!0},r}return T(n,e),n}(J),Y1=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}(se),IM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metadata;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={metadata:o,include_ts:!0},r}return T(n,e),n}(J),AM=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}(se),MM=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=Z.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}(J),xM=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}(se),OM=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}(gt),kM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata/").concat(o),r.params={include_ts:!0},r}return T(n,e),n}(J),RM=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}(se),LM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metadata"),r.params={include_ts:!0},r}return T(n,e),n}(J),DM=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}(se),Z1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.keys;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={keys:o},r}return T(n,e),n}(J),X1=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),UM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.metaCounter;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o},r}return T(n,e),n}(J),PM=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),Tp=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=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={metacounter:o,upsert:l,mode:c},r}return T(n,e),n}(J),wp=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.metaCounter=r,i}return T(n,e),n}(se),FM=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}(gt),HM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.key;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter/").concat(o),r.params={},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var jM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/metacounter"),r.params={},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var BM=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=Z.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}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var $M=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),GM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/mute/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var zM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),VM=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=Z.POST,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban"),r.params=ye({user_id:o,seconds:a,description:l}),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var qM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(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}(gt),WM=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.userId;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/ban/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var KM=function(e){function n(t,r,i){var s=e.call(this,t,"SYEV",i)||this;return s.user=new Pa(t,i.data),s}return T(n,e),n}(gt),J1=function(e){function n(t){var r=this,i=t.channelUrl,s=t.channelType,o=t.freezing;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(Je(s),"/").concat(encodeURIComponent(i),"/freeze"),r.params={freeze:o},r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var QM=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}(gt),YM=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=Z.POST,r.path="".concat(dC(s),"/").concat(encodeURIComponent(i)),r.params={report_category:o,reporting_user_id:a,report_description:l},r}return T(n,e),n}(J),ZM=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=Z.POST,r.path="".concat(Y_,"/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}(J),XM=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=Z.POST,r.path="".concat(dC(s),"/").concat(encodeURIComponent(i),"/messages/").concat(u),r.params=ye({report_category:o,reporting_user_id:a,report_description:c,offending_user_id:l,mesg_token:d}),r}return T(n,e),n}(J),JM=function(e){function n(t){var r=[];return t.mentionType===rr.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:ye(Ie({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!==Wi.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),pS=function(e){function n(t,r,i){var s,o,a,l,u=this;(u=e.call(this,t,"MESG",i)||this).message=new er(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}(gt),ey=function(e){function n(t){var r=null;return t.mentionType===rr.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:ye(Ie({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?Oi.payloadify(t.appleCriticalAlertOptions):null,poll_id:t.pollId}))})||this}return T(n,e),n}(wr),cm=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 er(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=$g({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:[]},Ie({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}(gt),ty=function(e){function n(t){var r=null;return t.mentionType===rr.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:ye(Ie({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),dm=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 Jt(t,i);var d=O.of(t).sdkState;return c.mentionCountChange=$g({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:[]},Ie({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}(gt),ex=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=Z.POST,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(J),tx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Jg(r),i}return T(n,e),n}(se),nx=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=Z.DELETE,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/reactions"),a.params={reaction:o},a}return T(n,e),n}(J),rx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.reactionEvent=new Jg(M({},r)),i}return T(n,e),n}(se),ix=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=Z.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}(J),sx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}return T(n,e),n}(se),ox=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===rr.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=Z.POST,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages"),i.params=ye(Ie({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 _r.payloadify(l)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(J),_S=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}return T(n,e),n}(se),ax=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===rr.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=Z.POST,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages"),s.params=Ie({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 zs.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 _r.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption}),s}return T(n,e),n}(J),lx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jt(t,r),i}return T(n,e),n}(se),ux=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=Z.PUT,u.path="".concat(Ki,"/").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}(J),cx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),dx=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Ki,"/").concat(encodeURIComponent(r)),i}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var hx=function(e){function n(t){var r=t.pollId,i=e.call(this)||this;return i.method=Z.PUT,i.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/close"),i}return T(n,e),n}(J),fx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),px=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=Z.POST,a.path="".concat(Ki,"/").concat(encodeURIComponent(s),"/options"),a.params={channel_url:r,channel_type:i,text:o},a}return T(n,e),n}(J),_x=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),mx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=t.optionText,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),o.params={text:s},o}return T(n,e),n}(J),gx=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.poll=new xi(t,r),i}return T(n,e),n}(se),vx=function(e){function n(t){var r=t.pollId,i=t.pollOptionId,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Ki,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var yx=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:ye({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),mS=function(e){function n(t,r,i){var s=e.call(this,t,"VOTE",i)||this;return s.event=new k6(i),s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(gt),gS=100,vS="GroupChannel",Ex="url",yS=100,hm="Message",bx="messageId",ES="NotificationMessage",Cx="notificationId",Sx="Poll",Tx="pollId",wx="FeedChannel",Nx="url";function Ix(e){var n,t,r;return(n=e.messageParams)!==null&&n!==void 0?n:Ie(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:Wi.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 Zn,Ax=M(M({},l0),{fileInfoList:[]}),Mx=function(e){return(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===void 0||Array.isArray(e.thumbnailSizes)&&e.thumbnailSizes.every(function(n){return n.maxWidth>0&&n.maxHeight>0}))},fh=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),xx=2;(function(e){e.SEND="send",e.RESEND="resend",e.COPY="copy"})(Zn||(Zn={}));var St,ny=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 ye(Ie(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=ye(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,s=!1;return this._cachedMetaData?this._cachedMetaData.forEach(function(o,a){var l;o.updatedAt<=r&&(i._cachedMetaData.set(a,{value:(l=t[a])!==null&&l!==void 0?l:o.value,isRemoved:!t[a],updatedAt:r}),s=!0)}):(this._cachedMetaData=new Map,Object.keys(t).forEach(function(o){i._cachedMetaData.set(o,{value:t[o],isRemoved:!1,updatedAt:r})}),s=!0),{isUpdated:s}},n.prototype._removeFromCachedMetaData=function(t,r){var i=this;this._cachedMetaData&&t.forEach(function(s){var o=i._cachedMetaData.get(s);o&&o.updatedAt0?{name:t.fileInfoList[0].fileName,size:t.fileInfoList[0].fileSize,type:t.fileInfoList[0].mimeType,data:t.data}:void 0})),o=new li(this._iid,s);return o.messageParams=t,o},n.prototype._validateFailedFileMessageHasFile=function(t,r){var i;return!!t.url||pr(r)||pr((i=t.messageParams)===null||i===void 0?void 0:i.file)},n.prototype._createPendingScheduledFileMessage=function(t,r,i){var s=this._createPendingFileMessage(t,r,i);return s.scheduledInfo={scheduledMessageId:0,scheduledAt:t.scheduledAt,scheduledMessageParams:t},s},n.prototype._markMessageAsFailed=function(t,r,i){i===void 0&&(i=!1),t.errorCode=r.code,r.code===Te.REQUEST_CANCELED||r.code===Te.FILE_UPLOAD_CANCEL_FAILED?t.sendingStatus=ut.CANCELED:i||(t.sendingStatus=ut.FAILED)},n.prototype.sendUserMessage=function(t){var r=M(M({},lS),t);return Y(cS(r)).throw(L.invalidParameters),this._sendUserMessage(r)},n.prototype._sendUserMessage=function(t,r,i){var s=this;r===void 0&&(r=Zn.SEND);var o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=i??this._generateRequestId(),c=Date.now(),d=new Br;return Or(2).then(function(){var h=s._createPendingUserMessage(t,u,c);a.dispatch(new bt({messages:[h],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(p){return[2,d._trigger(h)]})})});var f=new JM(M(M({},t),{channelUrl:s.url,channelType:s.channelType,reqId:u}));l.send(f).then(function(p){var m=p.as(pS).message;a.dispatch(new bt({messages:[m],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(b){return[2,d._trigger(m)]})})})}).catch(function(p){if(Lr(p))throw p;Or(2).then(function(){var m=s._createPendingUserMessage(t,u,c),b=O.of(s._iid).cacheContext,g=b.localCacheEnabled&&b.localCacheConfig.enableAutoResend&&Qh(p.code);s._markMessageAsFailed(m,p,g),a.dispatch(new bt({messages:[m],source:m.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(_){return[2,d._triggerFailed(p,m)]})})})})})}),d},n.prototype._autoResendUserMessage=function(t){return Y(t instanceof er&&!!t.messageParams).throw(L.invalidParameters),this._sendUserMessage(t.messageParams,Zn.SEND,t.reqId)},n.prototype.resendUserMessage=function(t){var r;return y(this,void 0,void 0,function(){var i,s;return v(this,function(o){return Y(t instanceof er&&!t.scheduledInfo).throw(L.invalidParameters),i=new Tr,s=(r=t.messageParams)!==null&&r!==void 0?r:lm(t),this._sendUserMessage(s,Zn.RESEND,t.reqId).onFailed(function(a){return i.reject(a)}).onSucceeded(function(a){return i.resolve(a)}),[2,i.promise]})})},n.prototype.updateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return v(this,function(l){switch(l.label){case 0:return i=M(M({},hS),r),Y(R("number",t)&&fS(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ey(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(cm).message]}})})},n.prototype.copyUserMessage=function(t,r){var i,s,o;return y(this,void 0,void 0,function(){var a,l;return v(this,function(u){return Y(t instanceof n&&r instanceof er&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),Y(!r.poll).throw(L.notSupportedError),a=new Tr,l=(i=r.messageParams)!==null&&i!==void 0?i:Ie(M(M({},r),{mentionType:r.mentionType,mentionedUserIds:(s=r.mentionedUserIds)!==null&&s!==void 0?s:(o=r.mentionedUsers)===null||o===void 0?void 0:o.map(function(c){return c.userId}),translationTargetLanguages:Object.keys(r.translations),pushNotificationDeliveryOption:Wi.DEFAULT,parentMessageId:null,isReplyToChannel:!1,isPinnedMessage:!1})),t._sendUserMessage(l).onSucceeded(function(c){a.resolve(c)}).onFailed(function(c){return a.reject(c)}),[2,a.promise]})})},n.prototype.translateUserMessage=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(t instanceof er&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ix({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,translationTargetLanguages:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(sx).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);Re(function(){return y(i,void 0,void 0,function(){return v(this,function(c){return[2,r._trigger(u)]})})})});var l=new ox(M({reqId:a,channelType:this.channelType,channelUrl:this.url},t));s.send(l).then(function(u){var c=u.as(_S).message;Re(function(){return y(i,void 0,void 0,function(){return v(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),Re(function(){return y(i,void 0,void 0,function(){return v(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessage=function(t){var r=M(M({},W1),t);return Y(K1(r)).throw(L.invalidParameters),this._sendFileMessage(r)},n.prototype.sendMultipleFilesMessage=function(t){var r,i=M(M({},Ax),t),s=O.of(this._iid);Y(function(a,l){return l===void 0&&(l=c6),u0(a)&&Array.isArray(a.fileInfoList)&&a.fileInfoList.length>=2&&a.fileInfoList.length<=l&&a.fileInfoList.every(function(u){return Mx(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 Y(!o).throw(L.fileSizeLimitExceededError),this._sendMultipleFilesMessage(i)},n.prototype._sendFileMessage=function(t,r,i){var s=this;r===void 0&&(r=Zn.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 bt({messages:[d],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t).then(function(h){o.dispatch(new bt({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(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&&Qh(h.code);s._markMessageAsFailed(f,h,m),o.dispatch(new bt({messages:[f],source:f.sendingStatus===ut.PENDING?G.REQUEST_RESEND_MESSAGE:h.code===Te.FILE_UPLOAD_CANCEL_FAILED?G.LOCAL_MESSAGE_CANCELED:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(b){return[2,c._triggerFailed(h,f)]})})})})})}),c},n.prototype._autoResendFileMessage=function(t){Y(t instanceof Jt&&!!t.messageParams).throw(L.invalidParameters);var r=O.of(this._iid).logger;return r.debug("autoResendFileMessage pending",t),this._sendFileMessage(t.messageParams,Zn.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 fh;return Or(2).then(function(){var d=s._createPendingMultipleFilesMessage(t,l,u);o.dispatch(new bt({messages:[d],source:r===Zn.RESEND?G.LOCAL_MESSAGE_RESEND_STARTED:G.EVENT_MESSAGE_SENT_PENDING})),Re(function(){return y(s,void 0,void 0,function(){return v(this,function(h){return[2,c._trigger(d)]})})}),a.request(s,l,t,{requestHandler:c,isCopy:r===Zn.COPY}).then(function(h){o.dispatch(new bt({messages:[h],source:G.EVENT_MESSAGE_SENT_SUCCESS})),Re(function(){return y(s,void 0,void 0,function(){return v(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 bt({messages:[f],source:G.EVENT_MESSAGE_SENT_FAILED})),Re(function(){return y(s,void 0,void 0,function(){return v(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 ax(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(lx).message;Re(function(){return y(o,void 0,void 0,function(){return v(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),Re(function(){return y(o,void 0,void 0,function(){return v(this,function(d){return[2,r._triggerFailed(u,c)]})})})})})},n.prototype.sendFileMessages=function(t){var r,i;Y(t.every(function(u){return K1(M(M({},W1),u))})).throw(L.invalidParameters);var s=new Br;try{for(var o=pe(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 v(this,function(a){return i=this._validateFailedFileMessageHasFile(t,r),Y(t instanceof Jt&&i&&!t.scheduledInfo).throw(L.invalidParameters),s=new Tr,o=um(t,r),this._sendFileMessage(o,Zn.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(Y(t instanceof Ft&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:lm(t);return this._sendUserMessage(o,Zn.RESEND,t.reqId)}if(t.isFileMessage()){var a=this._validateFailedFileMessageHasFile(t,r);return Y(a).throw(L.invalidParameters),o=(s=t.messageParams)!==null&&s!==void 0?s:um(t,r),this._sendFileMessage(o,Zn.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 v(this,function(l){switch(l.label){case 0:return i=M(M({},hM),r),Y(R("number",t)&&function(u){return tv(u)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new ty(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(dm).message]}})})},n.prototype.uploadFile=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return v(this,function(c){switch(c.label){case 0:return r=O.of(this._iid).requestQueue,i=Bs(),(s=new of({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(af),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 v(this,function(r){return Y(R("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 v(this,function(u){return Y(t instanceof n&&r instanceof Jt&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),a=new Tr,l=Ie(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:Wi.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){Y(t instanceof n&&r instanceof Ft&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters);var i=r,s=t;if(i.isUserMessage()){Y(!i.poll).throw(L.notSupportedError);var o=uS(i);return s._sendUserMessage(o)}if(i.isFileMessage())return o=dS(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 v(this,function(s){switch(s.label){case 0:return Y(t instanceof hr).throw(L.invalidParameters),t.messageId>0?(r=O.of(this._iid).requestQueue,i=new pC({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,messageToken:t instanceof Ft?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 v(this,function(a){switch(a.label){case 0:return Y(t instanceof hr&&t.messageId>0&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ex({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(tx).reactionEvent]}})})},n.prototype.deleteReaction=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(t instanceof hr&&t.messageId>0&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new nx({channelType:this.channelType,channelUrl:this.url,messageId:t.messageId,reactionKey:r}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(rx).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 v(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new ey({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(cm).message,a.dispatch(new bt({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 v(this,function(h){switch(h.label){case 0:return o=O.of(this._iid),a=o.dispatcher,l=o.requestQueue,u=new ty({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(dm).message,a.dispatch(new bt({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 v(this,function(s){return Y(t instanceof hr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new _r({key:o})}),t instanceof Jt?[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 v(this,function(s){return Y(t instanceof hr&&t.messageId>0&&We("string",r)).throw(L.invalidParameters),i=r.map(function(o){return new _r({key:o})}),t instanceof Jt?[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 v(this,function(i){return Y(t instanceof hr&&t.messageId>0&&r.every(function(s){return s instanceof _r})).throw(L.invalidParameters),t instanceof Jt?[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 v(this,function(i){return Y(t instanceof hr&&t.messageId>0&&r.every(function(s){return s instanceof _r})).throw(L.invalidParameters),t instanceof Jt?[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 v(this,function(l){switch(l.label){case 0:return Y($e(nc,t)&&R("string",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new YM({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 v(this,function(u){switch(u.label){case 0:return Y(t instanceof Ke&&$e(nc,r)&&R("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new ZM({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 v(this,function(u){switch(u.label){case 0:return Y(t instanceof Ft&&$e(nc,r)&&R("string",i)).throw(L.invalidParameters),s=O.of(this._iid),o=s.sdkState,a=s.requestQueue,l=new XM({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 v(this,function(a){switch(a.label){case 0:return Y(R("number",t)&&function(l){return R("string",l.title,!0)&&KC(l.data)&&R("boolean",l.allowUserSuggestion,!0)&&R("boolean",l.allowMultipleVotes,!0)&&R("number",l.closeAt,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new ux(M({pollId:t},r)),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(cx).poll]}})})},n.prototype.deletePoll=function(t){return y(this,void 0,void 0,function(){var r,i,s;return v(this,function(o){switch(o.label){case 0:return r=R("number",t),Y(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new dx({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 v(this,function(a){switch(a.label){case 0:return r=R("number",t),Y(r).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new hx({pollId:t}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(fx).poll]}})})},n.prototype.addPollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o,a;return v(this,function(l){switch(l.label){case 0:return i=R("number",t)&&R("string",r)&&r.trim()!=="",Y(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new px({channelUrl:this.url,channelType:this.channelType,pollId:t,optionText:r}),[4,s.send(o)];case 1:return a=l.sent(),[2,a.as(_x).poll]}})})},n.prototype.updatePollOption=function(t,r,i){return y(this,void 0,void 0,function(){var s,o,a,l;return v(this,function(u){switch(u.label){case 0:return s=R("number",t)&&R("number",r)&&R("string",i)&&i.trim()!=="",Y(s).throw(L.invalidParameters),o=O.of(this._iid).requestQueue,a=new mx({pollId:t,pollOptionId:r,optionText:i}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(gx).poll]}})})},n.prototype.deletePollOption=function(t,r){return y(this,void 0,void 0,function(){var i,s,o;return v(this,function(a){switch(a.label){case 0:return i=R("number",t)&&R("number",r),Y(i).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new vx({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 v(this,function(d){switch(d.label){case 0:return i=R("number",t)&&We("number",r),Y(i).throw(L.invalidParameters),s=O.of(this._iid),o=s.requestQueue,a=s.dispatcher,l=new yx({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(mS).event,a.dispatch(new Xg({event:c,source:G.EVENT_POLL_VOTED})),[2,c]}})})},n.prototype.getPollChangeLogsSinceTimestamp=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:return Y(R("number",t)).throw(L.invalidParameters),[4,sf.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 v(this,function(r){switch(r.label){case 0:return Y(R("string",t,!0)),[4,sf.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 XC(this._iid,{channelUrl:this.url,channelType:this.channelType,limit:t})},n.prototype.createPollVoterListQuery=function(t,r,i){return i===void 0&&(i=20),new JC(this._iid,{channelUrl:this.url,channelType:this.channelType,pollId:t,pollOptionId:r,limit:i})},n}(Kn),bS=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}),cf=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}),Ox=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}),kx=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=Z.GET,u.path=Xe,u.params=ye({limit:r,token:i,user_ids:s,metadatakey:o,metadatavalues_in:a,nickname_startswith:l}),u}return T(n,e),n}(J),Rx=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}(se),Lx=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)&&R("string",this.metaDataKeyFilter,!0)&&We("string",this.metaDataValuesFilter,!0)&&R("string",this.nicknameStartsWithFilter,!0)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 kx(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Rx),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),Dx=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=Z.GET,a.path="".concat(Xe,"/").concat(r,"/block"),a.params=ye({limit:i,token:s,user_ids:o}),a}return T(n,e),n}(J),Ux=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}(se),Px=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 v(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 Dx(Ie(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(Ux),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),Fx=function(e){function n(t){var r=t.userId,i=t.limit,s=t.token,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),o.params={limit:i,token:s},o}return T(n,e),n}(J),Hx=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}(se),jx=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 v(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 Fx(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(Hx),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),Ud={},Zc=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 Ud[t]||(this.itemSizeLimit=i,this.cacheLimit=o,this.blockHashBase=l,this.blockHashMultiplier=c,this.blockHashConstant=h,this.transactionApplyDelay=p,this.disableLogger=b,Ud[t]=this),Ud[t]}return e.get=function(n){return Ud[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 la,st=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"})(la||(la={}));var ry,kr=function(e,n){if(n===void 0&&(n=new WeakMap),typeof e=="object"&&e!==null){if(n.has(e))throw st.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},Rs=function(e,n){if(n==null)return 1;if(e==null)return-1;if(typeof e!=typeof n)throw st.compareTypesNotMatch;var t=0;switch(typeof e){case"boolean":case"number":t=e-n;break;case"string":t=e.localeCompare(n)}return t},iy=function(e,n){for(var t=0,r=0;r>>0)%n},Pd=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(!(Rs(o,a)>0))return!1;break;case"/gte":case">=":if(o=n[r],a=i[s],!(Rs(o,a)>=0))return!1;break;case"/lt":case"<":if(o=n[r],a=i[s],!(Rs(o,a)<0))return!1;break;case"/lte":case"<=":if(o=n[r],a=i[s],!(Rs(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(){},sy=function(){return Promise.resolve()},Bx=function(e){return e},oy=function(e,n){n()};(function(e){e[e.FORWARD=0]="FORWARD",e[e.BACKWARD=1]="BACKWARD"})(ry||(ry={}));var ga,fr,ts,$x=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?Bx:a,u=n.backward,c=u===void 0?sy:u,d=n.forward,h=d===void 0?sy: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 v(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 v(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}(),fm=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*Rs(this._indexer.origin[c].columnValues[s],this.condition[o][u])<=0){i=c;break}}}else for(c=i;c>=0;c--)if(a*Rs(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],g=1;if(b[0]==="-"&&(b=b.slice(1),g=-1),f.condition[b]){if(typeof f.condition[b]=="object")Object.keys(f.condition[b]).forEach(function(E){if((g>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===ts.PERSISTENT&&(i.state=fr.PERSISTENT),t!==ts.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)ly.includes(this._items[i].state)&&ly.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===fr.VOLATILE}),o=s.length-this._limit;if(o>0){var a=[];try{for(var l=pe(this._items),u=l.next();!u.done;u=l.next()){var c=u.value;c.state===fr.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!==fr.VOLATILE})},e}(),Vx=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(Ia(s,o),"/trans.metadata")}(t,r),this.recordsetKey=function(s,o){return"".concat(Ia(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 v(this,function(r){switch(r.label){case 0:return[4,this._store.get(this.recordsetKey)];case 1:return(t=r.sent()||[]).push.apply(t,De([],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 v(this,function(h){switch(h.label){case 0:r=Si.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=Si.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=ph.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 v(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 v(this,function(l){switch(l.label){case 0:return r=Zc.get(this.dbname),i=this.createBlockId(n),s=Math.floor(this._store.itemSizeLimit/r.itemSizeLimit),[4,Si.get(this.dbname).find(this._store,i)];case 1:return o=l.sent(),(a=o?ph.createFromCacheItem(o):new ph({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 v(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 v(this,function(i){switch(i.label){case 0:return n=_m(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(),Si.get(this.dbname).clearByCondition(function(s){return s.key.startsWith(n)}),[2]}})})},e}(),Wa={},Ws=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(Ia(c,d),"/index.").concat(h)}(t,r,s.join(">"));return Wa[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(ga.COMMIT,this.indexerKey,function(){return l.commit()}),this._transaction.on(ga.ERROR,this.indexerKey,function(){return l.abort()})),Wa[u]}return e.createKey=function(n){return n.join(">")},e.parseKey=function(n){return n.split(">")},e.clearIndexerMap=function(){for(var n in Wa)delete Wa[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=pe(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 st.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=Rs(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,g;return v(this,function(_){switch(_.label){case 0:return[4,(n=Si.get(this.dbname)).find(this._store,this.indexerKey,ts.PERSISTENT)];case 1:return(t=_.sent())?[3,11]:(r=_m(this.dbname,this.collectionName),[4,this._store.getAllKeys()]);case 2:i=_.sent(),_.label=3;case 3:_.trys.push([3,8,9,10]),s=pe(i),o=s.next(),_.label=4;case 4:return o.done?[3,7]:(a=o.value).startsWith(r)?[4,n.find(this._store,a,ts.NO_CACHE)]:[3,6];case 5:if(l=_.sent(),u=ph.createFromCacheItem(l))try{for(b=void 0,c=pe(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&&(g=c.return)&&g.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 Wa[this.indexerKey]=this,[2]}})})},e.prototype.drop=function(){return y(this,void 0,void 0,function(){return v(this,function(n){switch(n.label){case 0:return Si.get(this.dbname).remove(this.indexerKey),[4,this._store.remove(this.indexerKey)];case 1:return n.sent(),delete Wa[this.indexerKey],[2]}})})},e.prototype.addItem=function(n){return y(this,void 0,void 0,function(){return v(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 v(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 v(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}(),df=function(){return typeof document<"u"&&typeof navigator<"u"&&navigator.product!=="ReactNative"},uy=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"})(rc||(rc={})),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"}(ur||(ur={}));var Fi,Ip={},nv=function(){function e(n,t){t===void 0&&(t={});var r=this;return this._state=rc.PROCESSING,this._queue=[],this._activationQueue=[],Ip[n]&&!t.forceCreate||(this.nodeId=uy(),this.key=n,df()&&(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 ur.NEWNODE:r._sendSync();break;case ur.CLAIM_HOST:r._sendSync(),r._hostId=l;break;case ur.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:ur.REQUEST_LOCK,ts:S.ts})};try{for(var g=pe(m),_=g.next();!_.done;_=g.next())b(_.value)}catch(S){s={error:S}}finally{try{_&&!_.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}r._currentItem=r._queue.find(function(S){return S.requestId===p}),r._completeSync()}break;case ur.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 ur.REQUEST_LOCK:r._requestLock(a);break;case ur.ACQUIRE_LOCK:var E=r._queue.find(function(S){return S.requestId===u});r._acquire(E);break;case ur.RELEASE_LOCK:r._release(u)}}}),window.addEventListener("beforeunload",function(){r._send(ur.REMOVENODE)})),Ip[n]=this),Ip[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==rc.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:uy(),key:this.key,op:n,data:t.data,ts:Date.now()};return df()&&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(ur.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(ur.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(ur.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 v(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=rc.DONE,this._activationQueue.forEach(function(n){return n()}),this._activationQueue=[])},e.prototype.registerNode=function(){this._send(ur.NEWNODE),this._waitSync()},e.prototype.claimHost=function(){this._hostId=this.nodeId,this._send(ur.CLAIM_HOST),this._waitSync()},e.prototype.lock=function(){return y(this,void 0,void 0,function(){var n;return v(this,function(t){switch(t.label){case 0:return[4,this._waitUntilSyncCompleted()];case 1:return t.sent(),n=this._send(ur.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}(),Ap=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=la.INIT,this._indexers=[],this.dbname=t,this.name=r,this.keyName=i,this.indexes=De([[i]],Ae(o.filter(function(u){return Ws.createKey(u)!==l.keyName})),!1),this._keyHash=s,this._store=a,this._mutex=new nv(function(u,c){return"".concat(Ia(u,c),".lock")}(t,r)),this._blobContainer=new zx({dbname:t,collectionName:r,store:a}),this._transaction=new Vx({dbname:t,collectionName:r,store:a})}return e.metadataOf=function(n,t,r){return y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:return i=Np(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===la.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 v(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=Zc.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 qx({dbname:this.dbname,collectionName:this.name,hashFunction:this._keyHash,metadata:this._metadata,transaction:this._transaction,store:this._store}),r=De([],Ae(this.indexes),!1),i=[],s=r.map(function(g){return Ws.createKey(g)}),o=t?t.indexes.map(function(g){return Ws.createKey(g)}):[];try{for(a=pe(o),l=a.next();!l.done;l=a.next())u=l.value,s.includes(u)||i.push(Ws.parseKey(u))}catch(g){f={error:g}}finally{try{l&&!l.done&&(p=a.return)&&p.call(a)}finally{if(f)throw f.error}}return(c=[]).push.apply(c,De([],Ae(r.map(function(g){var _=new Ws({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:g,transaction:m._transaction,store:m._store});return m._indexers.push(_),_.ensure()})),!1)),c.push.apply(c,De([],Ae(i.map(function(g){return new Ws({dbname:m.dbname,collectionName:m.name,keyName:m.keyName,fields:g,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=Np(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=la.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=la.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=Ws.createKey(n);try{for(var s=pe(this._indexers),o=s.next();!o.done;o=s.next()){var a=o.value;if(i===Ws.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 st.indexTableIsRequired},e.prototype._upgradeBlockLevel=function(){return y(this,void 0,void 0,function(){var n;return v(this,function(t){switch(t.label){case 0:return n=Np(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 v(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=pe(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 st.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 v(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=pe(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=pe(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 v(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=pe(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 v(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=pe(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 v(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=pe(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 v(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 st.collectionNotReady;case 7:return[2]}})})},e.prototype.query=function(n){if(n===void 0&&(n={}),this.isReady)return new Gx({condition:n.where,mutex:this._mutex,blockManager:this._blockManager,indexer:this._getIndexerBy(n.index),backward:!!n.backward});throw st.collectionNotReady},e.prototype.insertOne=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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 v(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 st.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=pe(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 st.collectionNotReady;case 16:return[2]}})})},e.prototype.upsertOne=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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 v(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 st.collectionKeyNotGiven;c.label=3;case 3:c.trys.push([3,8,9,10]),t=pe(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 st.collectionNotReady;case 16:return[2]}})})},e.prototype.update=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 st.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,g=this;return v(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 fm({condition:i,blockManager:this._blockManager,backward:l,indexer:this._getIndexerBy(o)}).each(function(E){return y(g,void 0,void 0,function(){var S,w;return v(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=pe(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(),st.collectionNotReady;case 17:return[2]}})})},e.prototype.remove=function(n){return y(this,void 0,void 0,function(){var t;return v(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 st.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 v(this,function(g){switch(g.label){case 0:return this.isReady?[4,this._mutex.lock()]:[3,15];case 1:g.sent(),g.label=2;case 2:return g.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 fm({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 v(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:g.sent(),g.label=4;case 4:g.trys.push([4,9,10,11]),u=pe(l),c=u.next(),g.label=5;case 5:return c.done?[3,8]:(d=c.value,[4,this._requestRemove(d)]);case 6:g.sent(),g.label=7;case 7:return c=u.next(),[3,5];case 8:return[3,11];case 9:return h=g.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 g.sent(),this._mutex.unlock(),[2,l];case 13:throw f=g.sent(),this._mutex.unlock(),f;case 14:return[3,16];case 15:throw this._transaction.clear(),st.collectionNotReady;case 16:return[2]}})})},e.prototype.clear=function(){return y(this,void 0,void 0,function(){var n;return v(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 st.collectionNotReady;case 9:return[2]}})})},e.prototype.getBlob=function(n){return y(this,void 0,void 0,function(){return v(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 v(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 v(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 v(this,function(n){switch(n.label){case 0:return[4,this._blobContainer.clear()];case 1:return n.sent(),[2]}})})},e}(),Mp="[NESTDB]",Hd=!0,Vo=function(){function e(){}return e.off=function(){Hd=!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 v(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 st.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 v(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 v(this,function(i){switch(i.label){case 0:return t=[],[4,this._setRaw(t.concat.apply(t,De([],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 v(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 v(this,function(h){switch(h.label){case 0:t=[],r=function(f){var p,m,b;return v(this,function(g){switch(g.label){case 0:return p=i._getRawKey(f,".0"),[4,i._getRaw(p)];case 1:return(m=g.sent())&&(b=m.metadata,t.push.apply(t,De([],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=pe(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={},Zo=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 v(this,function(t){if(Ir[this.dbname])return[2,Object.keys(Ir[this.dbname])];throw st.storeNotAvailable})})},n.prototype._getRaw=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:return Ir[this.dbname]?[4,Pd(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 st.storeNotAvailable}})})},n.prototype._setRaw=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u,c;return v(this,function(d){switch(d.label){case 0:return Ir[this.dbname]?[4,Pd(this.delay)]:[3,2];case 1:d.sent();try{for(r=pe(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 st.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 v(this,function(l){switch(l.label){case 0:return Ir[this.dbname]?[4,Pd(this.delay)]:[3,2];case 1:l.sent();try{for(r=pe(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 st.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 v(this,function(t){return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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 v(this,function(c){try{for(r=pe(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 v(this,function(t){switch(t.label){case 0:return[4,Pd(this.delay)];case 1:return t.sent(),Ir[this.dbname]={},[2]}})})},n}(c0),cy="NestDBStore";(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.OPENING=1]="OPENING",e[e.OPEN=2]="OPEN",e[e.CLOSED=3]="CLOSED"})(Fi||(Fi={}));var ns,Kx=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=cy,i._state=Fi.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 v(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 v(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=Fi.OPENING;var o=r._indexedDb.open(t);o.addEventListener("upgradeneeded",function(a){a.target.result.createObjectStore(cy,{keyPath:"key"})}),o.addEventListener("success",function(a){r._state=Fi.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=Fi.OPENING,setTimeout(function(){r._openDatabase(t)},5)},i(r._database)}),o.addEventListener("error",function(a){r._state=Fi.UNINITIALIZED,s(a.target.error)})}else s(st.storeNotAvailable)})},n.prototype._getObjectStore=function(t){return y(this,void 0,void 0,function(){var r=this;return v(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 Fi.UNINITIALIZED:case Fi.OPEN:return[3,2];case Fi.OPENING:case Fi.CLOSED:return[3,3]}return[3,4];case 2:throw st.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 v(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 v(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 v(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=pe(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 v(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=pe(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 v(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||!df())return[3,4];if(!(df()&&navigator.userAgent&&navigator.userAgent.includes("Edge/")))return[3,1];if(!this._window.indexedDB&&(t.PointerEvent||t.MSPointerEvent))throw st.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(st.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(st.storeNotAvailable)}}catch{o(st.storeNotAvailableInPrivateBrowsing)}else o(st.storeNotAvailable)})];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:throw st.storeNotAvailable;case 5:return[3,7];case 6:throw st.storeNotAvailable;case 7:return[2]}})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0),Qx=function(e){function n(t){var r=this,i=t.AsyncStorage,s=t.itemSizeLimit,o=s===void 0?2097152:s,a=P4(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 v(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 v(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 v(this,function(c){switch(c.label){case 0:r=[];try{for(i=pe(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 v(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 v(this,function(t){if(!this._asyncStorage)throw st.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0),Yx=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 v(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 v(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 v(this,function(u){try{for(r=pe(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 v(this,function(l){try{for(r=pe(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 v(this,function(t){if(!this._mmkv)throw st.storeNotAvailable;return[2]})})},n.prototype.init=function(t){return y(this,void 0,void 0,function(){return v(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 v(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}(c0);(function(e){e.INIT="INIT",e.OPENING="OPENING",e.OPENED="OPENED",e.CLOSED="CLOSED"})(ns||(ns={}));var As,Zx=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=ns.INIT,this._config=s||new Zc({dbname:t}),this._store=i,this._event={success:Au,error:Au,storeReplaced:Au,upgrade:oy},this._collections=new Map,this._globalMutex=new nv("".concat(this.name,".lock")),this._config.disableLogger&&Vo.off(),new Si({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 v(this,function(n){switch(n.label){case 0:return[4,(t=this._store,y(void 0,void 0,void 0,function(){return v(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 v(this,function(r){switch(r.label){case 0:return this._state!==ns.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 v(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 Ap({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 st.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 v(this,function(a){switch(a.label){case 0:return[4,this._globalMutex.lock()];case 1:if(a.sent(),this._state===ns.OPENED)return[3,12];this._state=ns.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(pm(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 Ft)||!this.senderUserIdsFilter.includes(n.sender.userId)))return!1;if(n instanceof hr)switch(this.replyType){case Dn.NONE:if(n.parentMessageId>0)return!1;break;case Dn.ONLY_REPLY_TO_CHANNEL:if(n instanceof Ft&&n.parentMessageId>0&&!n.replyToChannel)return!1}return!0},e}();(function(e){e.CHANNEL_LATEST="channel_latest",e.NEWEST_CHILD_MESSAGE="newest_child_message"})(Vn||(Vn={}));var ic,cs=function(e){switch(e){case Vn.CHANNEL_LATEST:return["channelUrl","-createdAt","-messageId"];case Vn.NEWEST_CHILD_MESSAGE:return["channelUrl","-parentMessageId","-createdAt","-messageId"]}},Jx=function(){return["channelUrl","-createdAt","-notificationId"]},eO=M(M({},lS),{scheduledAt:void 0}),tO=function(e){return cS(e)&&R("number",e.scheduledAt,!0)},nO=M(M({},l0),{scheduledAt:0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),rO=function(e){return u0(e)&&R("number",e.scheduledAt)&&(pr(e.file)||R("string",e.fileUrl))&&R("string",e.fileName,!0)&&R("string",e.mimeType,!0)&&R("number",e.fileSize,!0)&&(e.thumbnailSizes===null||e.thumbnailSizes===void 0||e.thumbnailSizes.every(function(n){return R("object",n)&&n.maxWidth>0&&n.maxHeight>0}))},CS="UnsentMessage",iO="reqId",jd={},Aa=function(e){function n(t){var r=e.call(this,t)||this;return r._mutex=new nv("unsendmessagecache.lock"),jd[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),jd[t]&&!r||(jd[t]=new n(t)),jd[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb,r=t==null?void 0:t.collection(CS);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 er?(t.messageParams&&(i.messageParams=V1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=(r=t.scheduledInfo.scheduledMessageParams,M(M({},V1(r)),{scheduledAt:r.scheduledAt})))):t instanceof Jt?(t.messageParams&&(i.messageParams=q1(t.messageParams)),t.scheduledInfo&&t.scheduledInfo.scheduledMessageParams&&(i.scheduledInfo.scheduledMessageParams=function(s){return M(M({},q1(s)),{scheduledAt:s.scheduledAt})}(t.scheduledInfo.scheduledMessageParams))):t instanceof li&&t.messageParams&&(i.messageParams=function(s){return ye({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 v(this,function(f){switch(f.label){case 0:return o=An.of(this._iid),a=this._deserialize(t),t.messageParams?a instanceof er?(u=t.messageParams,a.messageParams=o.buildUserMessageCreateParamsFromSerializedData(u,a),[3,6]):[3,1]:[3,6];case 1:return a instanceof Jt?(u=t.messageParams).fileKey&&typeof u.fileKey=="string"&&Sp((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 li&&(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,g,_,E;return v(this,function(S){switch(S.label){case 0:return typeof((b=p._uploadedMetaData)===null||b===void 0?void 0:b.fileKey)=="string"&&Sp((_=(g=p._uploadedMetaData)===null||g===void 0?void 0:g.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 er?(c=t.scheduledInfo.scheduledMessageParams,a.scheduledInfo.scheduledMessageParams=o.buildScheduledUserMessageCreateParamsFromSerializedData(c,a),[3,10]):[3,7]:[3,10];case 7:return a instanceof Jt?(c=t.scheduledInfo.scheduledMessageParams).fileKey&&typeof c.fileKey=="string"&&typeof c.fileType=="string"&&Sp(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 v(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 _s:i,o=t.order,a=o===void 0?Vn.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 v(this,function(g){switch(g.label){case 0:return this.localCacheEnabled?(h=cs(a),f={"/where":function(_){return!!(a!==Vn.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,g.sent().fetch({})];case 2:return m=g.sent(),[2,Promise.all(m.map(function(_){return y(b,void 0,void 0,function(){return v(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 _s),y(this,void 0,void 0,function(){return v(this,function(i){switch(i.label){case 0:return[4,this.fetch({filter:r,order:Vn.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 v(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 v(this,function(a){switch(a.label){case 0:return s instanceof Jt||s instanceof li?[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 v(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 v(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 v(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=pe(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 v(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 v(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 v(this,function(a){switch(a.label){case 0:return t instanceof Jt?t.messageParams&&(s=t.messageParams).file&&hh(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&&hh(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 li&&(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 v(this,function(d){switch(d.label){case 0:return l.file&&hh(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}(Kn),Bd={},Sl=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}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Aa.of(this._iid)},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 Y(!!t).throw(L.databaseError),t.collection(hm)},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 v(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 _s:a,u=t.order,c=u===void 0?Vn.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,g=b!==void 0&&b,_=t.inclusive,E=_===void 0||_;return y(this,void 0,void 0,function(){var S,w,N,A=this;return v(this,function(k){switch(k.label){case 0:return this.localCacheEnabled?(S=cs(c),w={where:{channelUrl:r,"/where":function(I){if(i)switch(c){case Vn.CHANNEL_LATEST:if(g&&I.createdAt!==i)return!1;if(h){if(E&&I.createdAti||!E&&I.createdAt>=i)return!1;break;case Vn.NEWEST_CHILD_MESSAGE:if(!f||I.parentMessageId===0||I.parentMessageId!==f)return!1}return!(m&&!I._poll)&&l.match(A._deserialize(I))}},index:S,backward:h},[4,this.collection.query(w)]):[3,3];case 1:return[4,k.sent().fetch({limit:o??void 0})];case 2:return N=k.sent(),[2,Promise.all(N.map(function(I){return y(A,void 0,void 0,function(){return v(this,function(x){return[2,this._deserialize(I)]})})}))];case 3:return[2,[]]}})})},n.prototype.getAllChildMessages=function(t,r){return r===void 0&&(r=new _s),y(this,void 0,void 0,function(){return v(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:Vn.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 v(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=pe(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 v(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 v(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 v(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=pe(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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t},index:cs(Vn.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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:cs(Vn.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 v(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 v(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(s=cs(Vn.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 v(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 v(this,function(l){switch(l.label){case 0:return s instanceof Jt&&s.messageParams&&(o=s.messageParams).file&&hh(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 v(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}(Kn),$d={},sO=function(e){function n(t){var r=e.call(this,t)||this;return $d[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),$d[t]&&!r||($d[t]=new n(t)),$d[t]},Object.defineProperty(n.prototype,"collection",{get:function(){var t=this._cacheContext.nestdb;return Y(!!t).throw(L.databaseError),t.collection(ES)},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 v(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 _s: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 v(this,function(g){switch(g.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,g.sent().fetch({limit:o??void 0})];case 2:return[2,g.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 v(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 v(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=pe(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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,messageStatus:aa.SENT,createdAt:{"<":r}}},{set:{messageStatus:aa.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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.updateIf({where:{channelUrl:t,notificationId:{"/in":r},messageStatus:aa.SENT}},{set:{messageStatus:aa.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 v(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 v(this,function(i){switch(i.label){case 0:return this.localCacheEnabled?[4,this.collection.removeIf({where:{channelUrl:t,createdAt:{"<":r}},index:cs(Vn.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 v(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 v(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}(Kn),uu={},SS=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,g,_,E,S,w,N,A,k=this;return v(this,function(I){switch(I.label){case 0:return i instanceof bt?(s=i.messages,A=i.source,c=i.isWebSocketEventComing,o=s.filter(function(x){return x instanceof hr&&x.channelType!==Ze.OPEN&&x.messageId>0}),a=s.filter(function(x){return x instanceof hr&&x.channelType!==Ze.OPEN&&x.messageId===0}),l=s.filter(function(x){return x instanceof Na}),o.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 Ft?U.reqId:null}).filter(function(U){return U!==null}))];case 2:return x.sent(),[2]}})})})]:[3,2]):[3,7];case 1:I.sent(),c||this._broadcastUpdateEvent(o,A),I.label=2;case 2:return a.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._unsentMessageCache.upsert(a)];case 1:return x.sent(),[2]}})})})]:[3,4];case 3:I.sent(),c||this._broadcastUpdateEvent(a,A),I.label=4;case 4:return l.length>0?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._notificationCache.upsert(l)];case 1:return x.sent(),[2]}})})})]:[3,6];case 5:I.sent(),c||this._broadcastUpdateEvent(l,A),I.label=6;case 6:return[3,24];case 7:return i instanceof Zg?(u=i.messageIds,A=i.source,c=i.isWebSocketEventComing,d=u.filter(function(x){return typeof x=="number"}),h=u.filter(function(x){return typeof x=="string"}),[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 I.sent(),c||this._broadcastRemoveEvent(u,A),[3,24];case 9:return i instanceof VC?(f=i.reqId,A=i.source,[4,kt(function(){return y(k,void 0,void 0,function(){return v(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 I.sent(),this._broadcastRemoveUnsentEvent(f,A),[3,24];case 11:return i instanceof qC?(p=i.polls,A=i.source,this._cacheContext.localCacheEnabled?(m=p.map(function(x){return x.messageId}),[4,Promise.all(m.map(function(x){return k._messageCache.get(x)}))]):[3,14]):[3,15];case 12:return(b=I.sent().filter(function(x){return x})).length>0&&p.forEach(function(x){var U=b.find(function(z){return z.messageId===x.messageId});U&&U.applyPoll(x)}),[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert(b)];case 1:return[2,x.sent()]}})})})];case 13:I.sent(),I.label=14;case 14:return this._broadcastPollChangeLogEvent(p,A),[3,24];case 15:return i instanceof WC?(g=i.event,A=i.source,[4,this._messageCache.get(g.messageId)]):[3,19];case 16:return(_=I.sent())&&_.isUserMessage()&&_.poll&&_.poll.applyPollUpdateEvent(g)?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([_])];case 1:return[2,x.sent()]}})})})]:[3,18];case 17:I.sent(),I.label=18;case 18:return this._broadcastPollUpdateEvent(g,A),[3,24];case 19:return i instanceof Xg?(E=i.event,A=i.source,[4,this._messageCache.get(E.messageId)]):[3,23];case 20:return(S=I.sent())&&S.isUserMessage()&&S.poll&&S.poll.applyPollVoteEvent(E)?[4,kt(function(){return y(k,void 0,void 0,function(){return v(this,function(x){switch(x.label){case 0:return[4,this._messageCache.upsert([S])];case 1:return[2,x.sent()]}})})})]:[3,22];case 21:I.sent(),I.label=22;case 22:return this._broadcastPollVoteEvent(E,A),[3,24];case 23:i instanceof GC?(w=i.event,A=i.source,w.messageId>0&&this._broadcastReactionUpdateEvent(w,A)):i instanceof zC&&(N=i.event,A=i.source,this._broadcastThreadUpdateEvent(N,A)),I.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 Sl.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_unsentMessageCache",{get:function(){return Aa.of(this._iid)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"_notificationCache",{get:function(){return sO.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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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=pe(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}(Kn),oO=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=Z.GET,r.path="".concat(cC),r.params=ye({token:u,limit:a,reverse:s,order:Q_.UPDATED_AT,show_ui_template:!0,show_color_variables:!0,keys:l}),r}return T(n,e),n}(J),aO=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}(se),lO=function(e){function n(t){var r=this,i=t.key;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(cC,"/").concat(i),r}return T(n,e),n}(J),uO=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}(se),dy={},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,Sl.of(n),Aa.of(n),SS.of(n),this.fileMessageQueue=new sM(n,{sdkState:r,dispatcher:i,requestQueue:s,onlineDetector:o,cacheContext:a}),dy[n]=this}return e.of=function(n){return dy[n]},e.prototype.buildMessageFromSerializedData=function(n){var t=pa(n);if(t.notificationId)return new Na(this._iid,Na.payloadify(t));switch(t.messageType){case Ct.USER:return new er(this._iid,er.payloadify(t));case Ct.FILE:return li._isMultipleFilesMessageSerializedData(t)?new li(this._iid,li.payloadify(t)):new Jt(this._iid,Jt.payloadify(t));case Ct.ADMIN:return new Bl(this._iid,Bl.payloadify(t))}throw L.invalidParameters},e.prototype.buildUserMessageCreateParamsFromSerializedData=function(n,t){return ye(Ie({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 ye(Ie({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 ye({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 uf(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=pa(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 v(this,function(i){switch(i.label){case 0:return t=new oM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(aM).message]}})})},e.prototype.getScheduledMessage=function(n){return y(this,void 0,void 0,function(){var t,r;return v(this,function(i){switch(i.label){case 0:return t=new cM(n),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,r.as(dM).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 v(this,function(u){switch(u.label){case 0:return o=new Ld(M(M({channelType:t,channelUrl:n,token:String(r)},tc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Dd).messages,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return o=new Ld(M(M({channelType:t,channelUrl:n,timestamp:r},tc),i)),[4,this._requestQueue.send(o)];case 1:return a=u.sent(),l=a.as(Dd).messages,this._dispatcher.dispatch(new bt({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 v(this,function(p){switch(p.label){case 0:return l=new Ld(M(M(M({channelType:t,channelUrl:n,timestamp:r},tc),i),{checkingHasNext:o,checkingContinuousMessages:a})),[4,this._requestQueue.send(l)];case 1:return u=p.sent(),c=u.as(Dd),d=c.messages,h=c.isContinuousMessages,f=c.hasNext,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return s=new Ld(M(M(M({channelUrl:n.channelUrl,channelType:n.channelType,timestamp:t},Yc),r),{replyType:Dn.ALL,parentMessageId:n.messageId,includeThreadInfo:!0})),[4,this._requestQueue.send(s)];case 1:return o=u.sent(),a=o.as(Dd).messages,(l=a.slice(1)).forEach(function(c){c.parentMessage=n}),this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return r=new oO(M({token:n},t)),[4,this._requestQueue.send(r)];case 1:return i=u.sent(),s=i.as(aO),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 v(this,function(i){switch(i.label){case 0:return t=new lO({key:n}),[4,this._requestQueue.send(t)];case 1:return r=i.sent(),[2,{template:r.as(uO).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 v(this,function(p){switch(p.label){case 0:return o=new lM(ye(Ie(M(M({channelType:t,channelUrl:n,timestamp:typeof r=="number"?r:null,token:typeof r=="string"?r:null},am),i)))),[4,this._requestQueue.send(o)];case 1:return a=p.sent(),l=a.as(uM),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 bt({messages:u,source:s})),f.length>0&&this._dispatcher.dispatch(new Zg({messageIds:f,source:s})),[2,{updatedMessages:u,deletedMessageIds:f,hasMore:d,token:h}]}})})},e}(),TS=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&&R("object",s)&&R("number",o)&&R("string",a)&&R("string",l)&&(i.threadInfo=new lf(t,s),i.targetMessageId=o,i.channelUrl=a,i.channelType=l),i}return T(n,e),n}(Kn),cO={channelUrl:"",channelType:Ze.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},dO=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=Z.GET,m.path="".concat(Y4,"/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}(J),hO=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.messages=r.results.map(function(s){return yr(t,s)}),i.hasNext=r.has_next,i.nextToken=r.end_cursor,i.totalCount=r.total_count,i}return T(n,e),n}(se);(function(e){e.SCORE="score",e.TIMESTAMP="ts"})(ic||(ic={}));var fO=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=ic.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:ic.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)&&R("string",this.keyword)&&this.keyword.length>0&&R("boolean",this.reverse)&&R("boolean",this.exactMatch)&&R("string",this.channelUrl)&&R("string",this.channelCustomType)&&(R("number",this.messageTimestampFrom)||this.messageTimestampFrom===null)&&(R("number",this.messageTimestampTo)||this.messageTimestampTo===null)&&$e(ic,this.order)&&R("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 v(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 dO(Ie(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(hO),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),pO=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=Z.GET,a.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/parent_thread_message"),a.params=ye(Ie({limit:s,token:o})),a}return T(n,e),n}(J),_O=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 yr(t,s)}),i}return T(n,e),n}(se),mO=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 v(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 pO({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(_O),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}(Gs),gO={channelUrl:"",scheduledMessageId:0},vO={reverse:!1,limit:20},yO=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 v(this,function(s){switch(s.label){case 0:return r=M(M({},cO),t),Y(function(o){return R("string",o.channelUrl)&&$e(Ze,o.channelType)&&R("number",o.messageId)&&R("boolean",o.includeReactions,!0)&&R("boolean",o.includeMetaArray,!0)&&R("boolean",o.includeParentMessageInfo,!0)&&R("boolean",o.includeThreadInfo,!0)}(r)).throw(L.invalidParameters),[4,this._manager.getMessage(r)];case 1:if((i=s.sent())instanceof hr||i instanceof Na||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 v(this,function(i){return r=M(M({},gO),t),Y(function(s){return R("string",s.channelUrl)&&s.channelUrl!==""&&R("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 v(this,function(s){return i=M(M({},vO),r),Y(R("string",t,!0)&&function(o){return R("boolean",o.reverse,!0)&&R("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 v(this,function(r){return Y(R("string",t)).throw(L.invalidParameters),[2,this._manager.getMessageTemplate(t)]})})},n}(Yg),jt,sc,mm;(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"})(jt||(jt={})),function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(sc||(sc={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(mm||(mm={}));var Uc,_h=function(e){switch(e){case jt.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case jt.CHRONOLOGICAL:return["-createdAt","syncIndex"];case jt.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},wS=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),hy={},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,hy[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 rt.CONNECTED:l._isProcessingAutoResend||l.processAutoResendRegisteredPendingMessages().then(function(){return l._processNextAutoResend()});break;case rt.INTERNAL_DISCONNECTED:case rt.EXTERNAL_DISCONNECTED:l._isProcessingAutoResend=!1}})}return e.of=function(n){return hy[n]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return this._enableAutoResend?[4,this._fetchAllCachedPendingMessages()]:[2];case 1:n=a.sent();try{for(t=pe(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=Te.ACK_TIMEOUT,this._dispatcher.dispatch(new bt({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 v(this,function(u){switch(u.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:n=u.sent();try{for(t=pe(n),r=t.next();!r.done;r=t.next())i=r.value,this._enableAutoResend&&i.errorCode&&Qh(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 bt({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&&!Qh(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 v(this,function(r){switch(r.label){case 0:return n=Aa.of(this._iid),(t=new _s).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 v(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 wS({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"})(Uc||(Uc={}));var hf=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}(),NS=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),IS=function(e){function n(){return e.call(this)||this}return T(n,e),n}(Tt),AS=function(e){function n(t,r,i){var s=e.call(this,t,"USEV",i)||this;return s.event=new hf(i),s}return T(n,e),n}(gt),EO=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},Xt;(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"})(Xt||(Xt={}));var bO=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 bO(i),s}return T(n,e),n}(gt),CO=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),SO=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 SS.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 v(this,function(r){return[2,null]})})},n.prototype.getExactlyMatchingMessagesForTokenFromCache=function(t,r,i){return y(this,void 0,void 0,function(){return v(this,function(s){return[2,[]]})})},n.prototype.getMessagesFromCache=function(t,r,i,s,o,a){return y(this,void 0,void 0,function(){return v(this,function(l){return[2,[]]})})},n.prototype.getPollMessagesFromCache=function(t,r,i,s){return y(this,void 0,void 0,function(){return v(this,function(o){return[2,[]]})})},n.prototype.getCachedMessageCountBetween=function(t,r,i,s){return y(this,void 0,void 0,function(){return v(this,function(o){return[2,0]})})},n.prototype.getUnsentMessagesFromCache=function(t,r){return y(this,void 0,void 0,function(){return v(this,function(i){return[2,[]]})})},n.prototype.removeFailedMessageFromCache=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return[2]})})},n}(Kn),TO=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}(gt),wO=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=$g({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:[]},Ie({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}(gt),NO=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 Jg(i),s}return T(n,e),n}(gt),IO=function(e){function n(t,r,i){var s=e.call(this,t,"MTHD",i)||this;return s.event=new TS(t,i),s}return T(n,e),n}(gt),AO=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}(gt),MO=function(e){function n(t,r,i){var s=e.call(this,t,"PEDI",i)||this;return s.event=new EO(t,i),s.status=im(i.poll.status)||i.poll.status,s.channelUrl=i.channel_url,s.channelType=i.channel_type,s}return T(n,e),n}(gt),Gt;(function(e){e.NONE="none",e.JOINED="joined",e.INVITED="invited",e.LEFT="left"})(Gt||(Gt={}));var ps,Rr,Ur,No,Gi,ff,Ds,Pc,si=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=$e(Gt,r.state)?r.state:null,i.role=$e(Ni,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 ye(Ie(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}(Pa),xO=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}(Kn);(function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"})(ps||(ps={})),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"}(Gi||(Gi={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(ff||(ff={})),function(e){e.AND="AND",e.OR="OR"}(Ds||(Ds={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(Pc||(Pc={}));var Tn,MS=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:ps.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:Gi.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=Ds.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 Pc.CHANNEL_NAME:return n.name.toLowerCase().includes(i.toLowerCase());case Pc.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 Ds.AND:if(a.some(function(p){return!c.includes(p)}))return!1;break;case Ds.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||!$4(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 Gi.UNHIDDEN:if(n.isHidden||n.hiddenState!=="unhidden")return!1;break;case Gi.HIDDEN:if(!n.isHidden)return!1;break;case Gi.HIDDEN_ALLOW_AUTO_UNHIDE:if(!n.isHidden||n.hiddenState!=="hidden_allow_auto_unhide")return!1;break;case Gi.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 ps.PUBLIC:if(!n.isPublic)return!1;break;case ps.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}(),OO=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 Y(!!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,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 De([],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)return!1;break;case jt.CHRONOLOGICAL:if(!a&&S.createdAt>r||a&&S.createdAtr||a&&S.lastMessageUpdatedAtu._messageCollectionLastAccessedAt&&Object.assign(u,{_messageCollectionLastAccessedAt:void 0}),u.cachedMetaData&&r&&(c._updateCachedMetaData(u.cachedMetaData,r).isUpdated||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:k.sent(),k.label=2;case 2:return[2]}})})},n.prototype.block=function(t,r){return y(this,void 0,void 0,function(){return v(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 v(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=De([],Ae(this._channels.keys()),!1)),y(this,void 0,void 0,function(){var i,s,o,a,l,u,c,d;return v(this,function(h){switch(h.label){case 0:i=[],h.label=1;case 1:h.trys.push([1,6,7,8]),s=pe(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}(Kn),mh={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},gm=function(e){return We("string",e.invitedUserIds,!0)&&R("string",e.channelUrl,!0)&&R("string",e.coverUrl,!0)&&(pr(e.coverImage)||R("string",e.coverImage,!0))&&R("boolean",e.isDistinct,!0)&&R("boolean",e.isSuper,!0)&&R("boolean",e.isBroadcast,!0)&&R("boolean",e.isExclusive,!0)&&R("boolean",e.isPublic,!0)&&R("boolean",e.isStrict,!0)&&R("boolean",e.isDiscoverable,!0)&&R("boolean",e.isEphemeral,!0)&&R("string",e.accessCode,!0)&&R("string",e.name,!0)&&R("string",e.data,!0)&&R("string",e.customType,!0)&&We("string",e.operatorUserIds,!0)&&R("number",e.messageSurvivalSeconds,!0)},pf={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeChatNotification:!1},vm=function(e){return We("string",e.customTypes,!0)&&R("boolean",e.includeEmpty)&&R("boolean",e.includeFrozen)&&R("boolean",e.includeChatNotification)},xS={myMemberStateFilter:Rr.ALL},OS=function(e){return $e(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 kO={keys:[]},RO={channelCustomTypesFilter:void 0,superChannelFilter:Ur.ALL},LO=function(e){return We("string",e.channelCustomTypesFilter,!0)&&$e(Ur,e.superChannelFilter)},DO={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:tr.ALL};M({},G);var gh=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),bs=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),UO=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,g,_,E,S,w,N,A,k,I,x=this;return v(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(z){return z 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=pe(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&&(A=c.return)&&A.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=pe(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 g=U.sent(),k={error:g},[3,17];case 16:try{m&&!m.done&&(I=p.return)&&I.call(p)}finally{if(k)throw k.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 bs?(E=a.channelUrls,S=a.context,w=a.isWebSocketEventComing,[4,t.remove(E)]):[3,22];case 20:return U.sent(),[4,kt(function(){return y(x,void 0,void 0,function(){var z,H,W,Q,$,Ne;return v(this,function(X){switch(X.label){case 0:X.trys.push([0,6,7,8]),z=pe(E),H=z.next(),X.label=1;case 1:return H.done?[3,5]:(W=H.value,[4,r.removeMessagesOfChannel(W)]);case 2:return X.sent(),[4,i.removeMessagesOfChannel(W)];case 3:X.sent(),X.label=4;case 4:return H=z.next(),[3,1];case 5:return[3,8];case 6:return Q=X.sent(),$={error:Q},[3,8];case 7:try{H&&!H.done&&(Ne=z.return)&&Ne.call(z)}finally{if($)throw $.error}return[7];case 8:return[2]}})})})];case 21:return U.sent(),w||this._broadcastRemoveEvent(E,S),[3,24];case 22:return a instanceof NS?[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=pe(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=pe(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}(),PO=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({},pf),o),d=c.customTypes,h=c.includeEmpty,f=c.includeFrozen;return u.method=Z.GET,u.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/my_group_channels/changelogs"),u.params=ye(Ie({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}(J),FO=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}(se),ym=function(e){function n(t){var r=t.channelUrl,i=t.isInternalCall,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(i?K4:sr,"/").concat(encodeURIComponent(r)),s.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0},s}return T(n,e),n}(J),Em=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}(se),Ka={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:ps.ALL,hiddenChannelFilter:Gi.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:Ds.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:jt.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},HO=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,g=t.channelUrlsFilter,_=t.customTypesFilter,E=t.customTypeStartsWithFilter,S=t.hiddenChannelFilter,w=t.metadataOrderKeyFilter,N=t.metadataKey,A=t.metadataValues,k=t.metadataValueStartsWith,I=t.includeFrozen,x=t.includeMetaData,U=t.searchFilter,z=t.userIdsFilter,H=t.includeChatNotification,W=H!==void 0&&H,Q=t.includeLeftChannel,$=Q!==void 0&&Q,Ne=t.createdAfter,X=t.createdBefore;return(r=e.call(this)||this).method=Z.GET,r.path="".concat(Xe,"/").concat(encodeURIComponent(i),"/my_group_channels"),r.params=ye({token:s,limit:o,order:a??Ka.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:l??Ka.includeEmpty,member_state_filter:u??Ka.myMemberStateFilter,super_mode:c??Ka.superChannelFilter,public_mode:d??Ka.publicChannelFilter,unread_filter:h??Ka.unreadChannelFilter,members_nickname_contains:f,members_nickname_startswith:p,members_nickname:m,name_contains:b,channel_urls:g,custom_types:_,custom_type_startswith:E,hidden_mode:S,metadata_order_key:w,metadata_key:N,metadata_values:A,metadata_value_startswith:k,show_frozen:I,show_metadata:x,include_chat_notification:W,include_left_channel:$,created_after:Ne,created_before:X}),U&&U.query&&U.fields&&(r.params.search_query=U.query,r.params.search_fields=U.fields),z&&z.userIds&&z.userIds.length>0&&(z.includeMode?(r.params.members_include_in=z.userIds,r.params.query_type=z.queryType.toUpperCase()):r.params.members_exactly_in=z.userIds),r}return T(n,e),n}(J),jO=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}(se),BO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.myMemberStateFilter;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/group_channel_count"),s.params={state:o??Rr.ALL},s}return T(n,e),n}(J),$O=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}(se),GO=function(e){function n(t){var r=t.userId,i=t.filter,s=e.call(this)||this,o=i.keys;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_item_count"),s.params=ye({item_keys:o}),s}return T(n,e),n}(J),zO=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}(se),VO=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/unread_channel_count"),i}return T(n,e),n}(J),qO=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}(se),WO=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=Z.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}(J),KO=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}(se),QO=function(e){function n(t){var r=t.channelUrl,i=t.scheduledStatus,s=t.messageTypeFilter,o=e.call(this)||this;return o.method=Z.GET,o.path="".concat(uC,"/count"),o.params={channel_url:r,status:ZO(i)},s&&(o.params.message_type=s),o}return T(n,e),n}(J),YO=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}(se),ZO=function(e){if(!e)return[];var n=[];return e.forEach(function(t){switch(t){case uo.PENDING:n.push(ii.PENDING);break;case uo.SENT:n.push(ii.IN_QUEUE),n.push(ii.SENT);break;case uo.CANCELED:n.push(ii.CANCELED);break;case uo.FAILED:n.push(ii.FAILED)}}),n},XO=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,g=t.name,_=t.data,E=t.customType,S=t.messageSurvivalSeconds,w=t.invitedUserIds,N=t.operatorUserIds;return(r=e.call(this)||this).method=Z.POST,r.path=sr,r.params=ye({user_ids:De([i],Ae(w??[]),!1).filter(function(A,k,I){return k===I.indexOf(A)}),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:g,data:_,custom_type:E,operator_ids:N,message_survival_seconds:S}),r}return T(n,e),n}(J),JO=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}(se),fy=function(e){function n(t){var r=t.userId,i=t.channelUrls,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/mark_as_read_all"),s.params={channel_urls:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ek=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/join"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(J),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}(se),nk=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 si(t,f)}):[new si(t,i.data)],s}return T(n,e),n}(Kl),rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.shouldRemoveOperatorStatus;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/leave"),r.params={user_id:s,should_remove_operator_status:o},r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);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=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 si(s._iid,i.data),s}return T(n,e),n}(Kl),sk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userIds;return(r=e.call(this)||this).method=Z.POST,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/invite"),r.params={user_ids:s},r}return T(n,e),n}(J),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}(se),ak=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 si(t,p)}),s}return T(n,e),n}(Kl),lk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/decline"),r.params={user_id:s},r}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Gt.NONE,i}T(n,e)})(se);var uk=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 si(t,c),s}return T(n,e),n}(Kl),bm={hidePreviousMessages:!1,allowAutoUnhide:!0},ck=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=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/hide"),r.params={user_id:s,hide_previous_messages:o??bm.hidePreviousMessages,allow_auto_unhide:a??bm.allowAutoUnhide},r}return T(n,e),n}(J),dk=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}(se),hk=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}(gt),fk=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),pk=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}(gt),_k=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),mk=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}(gt),gk=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),kS=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,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=ps.ALL,U.hiddenChannelFilter=Gi.UNHIDDEN,U.searchFilter={fields:[],query:null},U.userIdsFilter={userIds:[],includeMode:!0,queryType:Ds.AND},U.metadataKey=null,U.metadataValues=null,U.metadataOrderKeyFilter=null,U.metadataValueStartsWith=null,U.order=jt.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=(g=r.superChannelFilter)!==null&&g!==void 0?g:Ur.ALL,U.publicChannelFilter=(_=r.publicChannelFilter)!==null&&_!==void 0?_:ps.ALL,U.hiddenChannelFilter=(E=r.hiddenChannelFilter)!==null&&E!==void 0?E:Gi.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:Ds.AND},U.metadataKey=(N=r.metadataKey)!==null&&N!==void 0?N:null,U.metadataValues=(A=r.metadataValues)!==null&&A!==void 0?A:null,U.metadataOrderKeyFilter=(k=r.metadataOrderKeyFilter)!==null&&k!==void 0?k:null,U.metadataValueStartsWith=(I=r.metadataValueStartsWith)!==null&&I!==void 0?I:null,U.order=(x=r.order)!==null&&x!==void 0?x:jt.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)&&R("boolean",this.includeEmpty)&&R("boolean",this.includeFrozen)&&R("boolean",this.includeMetaData)&&R("string",this.channelNameContainsFilter)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&R("string",this.customTypeStartsWithFilter)&&R("string",this.nicknameContainsFilter,!0)&&R("string",this.nicknameStartsWithFilter,!0)&&R("string",this.nicknameExactMatchFilter,!0)&&$e(Rr,this.myMemberStateFilter)&&$e(Ur,this.superChannelFilter)&&$e(ps,this.publicChannelFilter)&&$e(No,this.unreadChannelFilter)&&$e(Gi,this.hiddenChannelFilter)&&We(Pc,this.searchFilter.fields)&&R("string",this.searchFilter.query,!0)&&We("string",this.userIdsFilter.userIds)&&R("boolean",this.userIdsFilter.includeMode)&&$e(Ds,this.userIdsFilter.queryType)&&$e(jt,this.order)&&R("string",this.metadataOrderKeyFilter,!0)&&R("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&R("string",this.metadataValueStartsWith,!0)&&J2(this.createdAfter,!0)&&J2(this.createdBefore,!0)},n.prototype.serialize=function(){return Qc(this)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i;return v(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,Ie(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),vk=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?yr(t,M({},i.data.latest_pinned_message)):null),o.ts=i.ts,o}return T(n,e),n}(gt),yk=function(e){function n(t){var r=t.channelUrl,i=t.userId,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(sr,"/").concat(encodeURIComponent(r),"/messages/mark_as_delivered"),s.params=ye({userId:i}),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ws,Ek=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}(gt),ls=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&&He.onMentionReceived&&He.onMentionReceived(m,f)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=6;case 6:return[3,79];case 7:return S=t.as(oA),Ee=S.channelUrl,Be=S.channelType,w=S.messageId,N=S.silent,A=S.messageCreatedAt,k=S.senderId,Be!==Ze.GROUP?[3,9]:[4,this.getChannel(Ee,!0)];case 8:I=Qe.sent(),x=k===this._sdkState.userId,N||x||A>0&&I.myLastRead0&&I._updateUnreadCount(I.unreadMessageCount-1,0),this._dispatcher.dispatch(new Zg({messageIds:[w],source:G.EVENT_MESSAGE_DELETED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onMessageDeleted&&He.onMessageDeleted(I,w)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=9;case 9:return[3,79];case 10:return(U=t.as(iS).readStatus).channelType!==Ze.GROUP?[3,12]:($=this._groupChannelCache.isCachedInMemory(U.channelUrl),[4,this.getChannel(U.channelUrl,!0)]);case 11:z=Qe.sent(),$&&z._updateUnreadMemberState(U.reader.userId,U.readAt),U.reader.userId===this._sdkState.userId?$?(z.unreadMessageCount>0||z.unreadMentionCount>0)&&(z._updateUnreadCount(0,0),this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})):z.unreadMessageCount!==0&&z.unreadMentionCount!==0||(this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})):(this._dispatcher.dispatch(new Ve({channels:[z],context:{source:G.EVENT_CHANNEL_READ}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onUnreadMemberStatusUpdated&&He.onUnreadMemberStatusUpdated(z)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),Qe.label=12;case 12:return[3,79];case 13:return H=t.as(Ek),Ee=H.channelUrl,W=H.deliveredStateUpdate,Q=W===void 0?{}:W,$=this._groupChannelCache.isCachedInMemory(Ee),[4,this.getChannel(Ee,!0)];case 14:return Ne=Qe.sent(),$&&Object.keys(Q).forEach(function(q){Ne._updateUndeliveredMemberState(q,Q[q])}),Object.keys(Q).some(function(q){return q!==lt._sdkState.userId})&&(this._dispatcher.dispatch(new Ve({channels:[Ne],context:{source:G.EVENT_CHANNEL_DELIVERED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onUndeliveredMemberStatusUpdated&&He.onUndeliveredMemberStatusUpdated(Ne)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),[3,79];case 15:return X=t.as(NO),Ee=X.channelUrl,Be=X.channelType,ae=X.event,Be!==Ze.GROUP?[3,18]:[4,this.getChannel(Ee,!0)];case 16:return ne=Qe.sent(),[4,this.getMessageFromCache(ae.messageId)];case 17:(ie=Qe.sent())?ie instanceof hr&&(ie.applyReactionEvent(ae),this._dispatcher.dispatch(new bt({messages:[ie],source:G.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new GC({event:ae,source:G.EVENT_MESSAGE_REACTION_UPDATED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onReactionUpdated&&He.onReactionUpdated(ne,ae)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=18;case 18:return[3,79];case 19:return(Ce=t.as(IO).event).channelType!==Ze.GROUP?[3,22]:[4,this.getChannel(Ce.channelUrl,!0)];case 20:return K=Qe.sent(),[4,this.getMessageFromCache(Ce.targetMessageId)];case 21:(ie=Qe.sent())?ie instanceof hr&&(ie.applyThreadInfoUpdateEvent(Ce),this._dispatcher.dispatch(new bt({messages:[ie],source:G.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new zC({event:Ce,source:G.EVENT_MESSAGE_THREADINFO_UPDATED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onThreadInfoUpdated&&He.onThreadInfoUpdated(K,Ce)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=22;case 22:return[3,79];case 23:ee=t.as(AO).groupChannelMemberCounts,ue=[],Qe.label=24;case 24:Qe.trys.push([24,29,30,31]),P=pe(ee),xe=P.next(),Qe.label=25;case 25:return xe.done?[3,28]:(B=xe.value,Ee=B.channelUrl,rn=B.memberCount,sn=B.joinedMemberCount,te=B.updatedAt,[4,this.getChannelFromCache(Ee)]);case 26:(oe=Qe.sent())&&oe._setLatestMemberCount(rn,sn,te)&&ue.push(oe),Qe.label=27;case 27:return xe=P.next(),[3,25];case 28:return[3,31];case 29:return me=Qe.sent(),w0={error:me},[3,31];case 30:try{xe&&!xe.done&&(Av=P.return)&&Av.call(P)}finally{if(w0)throw w0.error}return[7];case 31:return ue.length>0&&(this._dispatcher.dispatch(new Ve({channels:ue,context:{source:G.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelMemberCountChanged&&He.onChannelMemberCountChanged(ue)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})})),[3,79];case 32:return re=t.as(MO),ce=re.event,de=re.status,Ee=re.channelUrl,Be=re.channelType,Ee&&Be===Ze.GROUP?[4,this.getChannel(Ee,!0)]:[3,34];case 33:fe=Qe.sent(),this._dispatcher.dispatch(new WC({event:ce,source:G.EVENT_POLL_UPDATED})),Re(de===O6?function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollDeleted&&He.onPollDeleted(fe,ce.pollId)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}:function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollUpdated&&He.onPollUpdated(fe,ce)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=34;case 34:return[3,79];case 35:return ve=t.as(mS),_e=ve.event,Ee=ve.channelUrl,Be=ve.channelType,Ee&&Be===Ze.GROUP?[4,this.getChannel(Ee,!0)]:[3,37];case 36:ze=Qe.sent(),this._dispatcher.dispatch(new Xg({event:_e,source:G.EVENT_POLL_VOTED})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onPollVoted&&He.onPollVoted(ze,_e)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Qe.label=37;case 37:return[3,79];case 38:if(!(V=t.as(Kl).event).isGroupChannelEvent)return[3,77];switch(V.category){case Xt.CHANNEL_JOIN:return[3,39];case Xt.CHANNEL_LEAVE:return[3,41];case Xt.CHANNEL_OPERATOR_UPDATE:return[3,45];case Xt.CHANNEL_INVITE:return[3,47];case Xt.CHANNEL_DECLINE_INVITE:return[3,49];case Xt.TYPING_START:case Xt.TYPING_END:return[3,51];case Xt.USER_CHANNEL_MUTE:case Xt.USER_CHANNEL_UNMUTE:return[3,53];case Xt.USER_CHANNEL_BAN:return[3,55];case Xt.USER_CHANNEL_UNBAN:return[3,59];case Xt.CHANNEL_FREEZE:case Xt.CHANNEL_UNFREEZE:return[3,61];case Xt.CHANNEL_HIDE:return[3,63];case Xt.CHANNEL_UNHIDE:return[3,65];case Xt.CHANNEL_DELETED:return[3,67];case Xt.CHANNEL_PROP_CHANGED:return[3,69];case Xt.CHANNEL_META_DATA_CHANGED:return[3,71];case Xt.CHANNEL_META_COUNTERS_CHANGED:return[3,73];case Xt.PINNED_MESSAGE_CHANGED:return[3,75]}return[3,77];case 39:return[4,this.getChannel(V.channelUrl,!0)];case 40:return Se=Qe.sent(),Ue=t.as(nk),le=Ue.memberCount,Oe=Ue.joinedMemberCount,tt=Ue.members,at=!1,tt.forEach(function(q){Se.isExclusive||Se.isSuper||Se.isBroadcast?at=at||Se._setLatestMemberCount(le,Oe,V.ts):(q.state=Gt.JOINED,Se.addMember(q,V.ts),lt._updateJoinedMemberCount(Se)),q.userId===lt._sdkState.userId&&(Se.myMemberState=Gt.JOINED)}),this._dispatcher.dispatch(new Ve({channels:[Se],context:{source:G.EVENT_CHANNEL_JOINED,users:tt}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){var He,ke;try{for(var je=pe(tt),Pt=je.next();!Pt.done;Pt=je.next()){var ct=Pt.value;j.onUserJoined&&j.onUserJoined(Se,ct)}}catch(uw){He={error:uw}}finally{try{Pt&&!Pt.done&&(ke=je.return)&&ke.call(je)}finally{if(He)throw He.error}}Se.isBroadcast&&at&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Se])}),[2]})})}),[3,77];case 41:return(Hn=this._leftChannels.get(V.channelUrl))?(Ye=Hn.channel,[3,44]):[3,42];case 42:return[4,this.getChannel(V.channelUrl,!0)];case 43:Ye=Qe.sent(),Qe.label=44;case 44:return Pe=Ye,wt=t.as(ik),rn=wt.memberCount,sn=wt.joinedMemberCount,_t=wt.member,Rt=!1,Lt=O.of(this._iid).appInfo,Pe.isExclusive||Pe.isSuper||Pe.isBroadcast?Rt=Pe._setLatestMemberCount(rn,sn,V.ts):(Lt!=null&&Lt.enabledChannelMemberShipHistory?((nn=Pe.members.find(function(q){return q.userId===_t.userId}))&&(nn.state=Gt.LEFT),Pe.memberCount=rn):Pe.removeMember(_t),this._updateJoinedMemberCount(Pe)),_t.userId===this._sdkState.userId?(Pe.myMemberState=Gt.NONE,Pe.invitedAt=0,Pe.joinedAt=0,Pe._updateUnreadCount(0,0),Pe.isPublic?this._dispatcher.dispatch(new Ve({channels:[Pe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})):(this._markAsLeave(Pe),this._dispatcher.dispatch(new bs({channelUrls:[Pe.url],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})))):this._dispatcher.dispatch(new Ve({channels:[Pe],context:{source:G.EVENT_CHANNEL_LEFT,user:_t}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserLeft&&j.onUserLeft(Pe,_t),Pe.isBroadcast&&Rt&&j.onChannelMemberCountChanged&&j.onChannelMemberCountChanged([Pe])}),[2]})})}),[3,77];case 45:return[4,this.getChannel(V.channelUrl,!0)];case 46:Qt=Qe.sent(),un=t.as(CO).operators,Dt=un.map(function(q){return q.userId});try{for(Nt=pe(Qt.members),xn=Nt.next();!xn.done;xn=Nt.next())(Yt=xn.value).role=Dt.includes(Yt.userId)?Ni.OPERATOR:Ni.NONE}catch(q){N0={error:q}}finally{try{xn&&!xn.done&&(Mv=Nt.return)&&Mv.call(Nt)}finally{if(N0)throw N0.error}}return Qt.myRole=Dt.includes(this._sdkState.userId)?Ni.OPERATOR:Ni.NONE,this._dispatcher.dispatch(new Ve({channels:[Qt],context:{source:G.EVENT_CHANNEL_OPERATOR_UPDATED,operators:un}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onOperatorUpdated&&j.onOperatorUpdated(Qt,un)}),[2]})})}),[3,77];case 47:return[4,this.getChannel(V.channelUrl,!0)];case 48:Bt=Qe.sent(),ft=t.as(ak),rn=ft.memberCount,sn=ft.joinedMemberCount,cn=ft.inviter,(Un=ft.invitees).forEach(function(q){return q.state=Gt.INVITED});try{for(Pn=pe(Un),vn=Pn.next();!vn.done;vn=Pn.next())Fn=vn.value,Bt.isExclusive||Bt.isSuper||Bt.isBroadcast?Bt._setLatestMemberCount(rn,sn,V.ts):Bt.addMember(Fn,V.ts),this._sdkState.userId===Fn.userId&&(Bt.hiddenState=dr.UNHIDDEN,Bt.myMemberState!==Gt.JOINED&&(Bt.myMemberState=Gt.INVITED),Bt.invitedAt=V.ts)}catch(q){I0={error:q}}finally{try{vn&&!vn.done&&(xv=Pn.return)&&xv.call(Pn)}finally{if(I0)throw I0.error}}return this._dispatcher.dispatch(new Ve({channels:[Bt],context:{source:G.EVENT_CHANNEL_INVITED,inviter:cn,invitees:Un}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserReceivedInvitation&&j.onUserReceivedInvitation(Bt,cn,Un)}),[2]})})}),[3,77];case 49:return[4,this.getChannel(V.channelUrl,!0)];case 50:return Ot=Qe.sent(),On=t.as(uk),rn=On.memberCount,sn=On.joinedMemberCount,kn=On.inviter,yn=On.invitee,Ot.isExclusive||Ot.isSuper||Ot.isBroadcast?Ot._setLatestMemberCount(rn,sn,V.ts):Ot.removeMember(yn),this._sdkState.userId===yn.userId?(Ot.invitedAt=0,Ot.myMemberState=Gt.NONE,Ot.isPublic?this._dispatcher.dispatch(new Ve({channels:[Ot],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})):this._dispatcher.dispatch(new bs({channelUrls:[Ot.url],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}}))):this._dispatcher.dispatch(new Ve({channels:[Ot],context:{source:G.EVENT_CHANNEL_DECLINED_INVITE,inviter:kn,invitee:yn}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserDeclinedInvitation&&j.onUserDeclinedInvitation(Ot,kn,yn)}),[2]})})}),[3,77];case 51:return[4,this.getChannel(V.channelUrl,!0)];case 52:return It=Qe.sent(),Rn=V.category===Xt.TYPING_START,or=t.as(Rn?pk:mk).user,It._updateTypingStatus(or,Rn?V.ts:0),this._dispatcher.dispatch(new Ve({channels:[It],context:{source:G.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onTypingStatusUpdated&&j.onTypingStatusUpdated(It)}),[2]})})}),[3,77];case 53:return[4,this.getChannel(V.channelUrl,!0)];case 54:dn=Qe.sent(),En=V.category===Xt.USER_CHANNEL_MUTE,(bn=t.as(En?$M:zM).user).userId===this._sdkState.userId&&(dn.myMutedState=En?ss.MUTED:ss.UNMUTED,dn._myMutedRemainingTime=bn.restrictionInfo.remainingDuration);try{for(Ut=pe(dn.members),Cn=Ut.next();!Cn.done;Cn=Ut.next())if((Yt=Cn.value).userId===bn.userId){Yt.isMuted=En;break}}catch(q){A0={error:q}}finally{try{Cn&&!Cn.done&&(Ov=Ut.return)&&Ov.call(Ut)}finally{if(A0)throw A0.error}}return this._dispatcher.dispatch(new Ve({channels:[dn],context:{source:En?G.EVENT_CHANNEL_MUTED:G.EVENT_CHANNEL_UNMUTED,user:bn}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){En?j.onUserMuted&&j.onUserMuted(dn,bn):j.onUserUnmuted&&j.onUserUnmuted(dn,bn)}),[2]})})}),[3,77];case 55:return(Hn=this._leftChannels.get(V.channelUrl))?(ar=Hn.channel,[3,58]):[3,56];case 56:return[4,this.getChannel(V.channelUrl,!0)];case 57:ar=Qe.sent(),Qe.label=58;case 58:return jn=ar,this._markAsLeave(jn),Le=t.as(qM).user,Le.userId===this._sdkState.userId&&this._dispatcher.dispatch(new bs({channelUrls:[jn.url],context:{source:G.EVENT_CHANNEL_BANNED,user:Le}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserBanned&&j.onUserBanned(jn,Le)}),[2]})})}),[3,77];case 59:return[4,this.getChannel(V.channelUrl,!0)];case 60:return F=Qe.sent(),he=t.as(KM).user,he.userId===this._sdkState.userId&&this._dispatcher.dispatch(new bs({channelUrls:[F.url],context:{source:G.EVENT_CHANNEL_UNBANNED,user:he}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onUserUnbanned&&j.onUserUnbanned(F,he)}),[2]})})}),[3,77];case 61:return[4,this.getChannel(V.channelUrl,!0)];case 62:return Me=Qe.sent(),Ge=t.as(QM).freeze,Me.isFrozen=Ge,this._dispatcher.dispatch(new Ve({channels:[Me],context:{source:Ge?G.EVENT_CHANNEL_FROZEN:G.EVENT_CHANNEL_UNFROZEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){Ge?j.onChannelFrozen&&j.onChannelFrozen(Me):j.onChannelUnfrozen&&j.onChannelUnfrozen(Me)}),[2]})})}),[3,77];case 63:return[4,this.getChannel(V.channelUrl,!0)];case 64:return vt=Qe.sent(),hn=t.as(hk),Qn=hn.allowAutoUnhide,Yn=hn.hidePreviousMessages,gs=hn.messageOffsetTimestamp,Qn!==null&&(vt.hiddenState=Qn?dr.HIDDEN_ALLOW_AUTO_UNHIDE:dr.HIDDEN_PREVENT_AUTO_UNHIDE),Yn!==null&&Yn&&vt._updateUnreadCount(0,0),gs!==null&&(vt.messageOffsetTimestamp=gs),this._dispatcher.dispatch(new Ve({channels:[vt],context:{source:G.EVENT_CHANNEL_HIDDEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelHidden&&j.onChannelHidden(vt)}),[2]})})}),[3,77];case 65:return[4,this.getChannel(V.channelUrl,!0)];case 66:return(Bn=Qe.sent()).hiddenState=dr.UNHIDDEN,this._dispatcher.dispatch(new Ve({channels:[Bn],context:{source:G.EVENT_CHANNEL_UNHIDDEN}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Bn)}),[2]})})}),[3,77];case 67:return[4,this.getChannel(V.channelUrl,!0)];case 68:return ja=Qe.sent(),this._dispatcher.dispatch(new bs({channelUrls:[V.channelUrl],context:{source:G.EVENT_CHANNEL_DELETED}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelDeleted&&j.onChannelDeleted(ja.url,ja.channelType)}),[2]})})}),[3,77];case 69:return[4,this.getChannelWithoutCache(V.channelUrl,!0)];case 70:return Ba=Qe.sent(),this._dispatcher.dispatch(new Ve({channels:[Ba],context:{source:G.EVENT_CHANNEL_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onChannelChanged&&j.onChannelChanged(Ba)}),[2]})})}),[3,77];case 71:return[4,this.getChannel(V.channelUrl,!0)];case 72:return Yi=Qe.sent(),ed=t.as(OM),$a=ed.created,Ga=ed.updated,za=ed.deleted,$a&&(Yi._upsertCachedMetaData($a,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_CREATED,metaData:$a}}))),Ga&&(Yi._upsertCachedMetaData(Ga,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_UPDATED,metaData:Ga}}))),za&&(Yi._removeFromCachedMetaData(za,V.ts),this._dispatcher.dispatch(new Ve({channels:[Yi],context:{source:G.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:za}}))),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){$a&&j.onMetaDataCreated&&j.onMetaDataCreated(Yi,$a),Ga&&j.onMetaDataUpdated&&j.onMetaDataUpdated(Yi,Ga),za&&j.onMetaDataDeleted&&j.onMetaDataDeleted(Yi,za)}),[2]})})}),[3,77];case 73:return[4,this.getChannel(V.channelUrl,!0)];case 74:return Fo=Qe.sent(),td=t.as(FM),Yl=td.created,Zl=td.updated,Xl=td.deleted,Yl&&this._dispatcher.dispatch(new Ve({channels:[Fo],context:{source:G.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:Yl}})),Zl&&this._dispatcher.dispatch(new Ve({channels:[Fo],context:{source:G.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Zl}})),Xl&&this._dispatcher.dispatch(new Ve({channels:[Fo],context:{source:G.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:Xl}})),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){Yl&&j.onMetaCounterCreated&&j.onMetaCounterCreated(Fo,Yl),Zl&&j.onMetaCounterUpdated&&j.onMetaCounterUpdated(Fo,Zl),Xl&&j.onMetaCounterDeleted&&j.onMetaCounterDeleted(Fo,Xl)}),[2]})})}),[3,77];case 75:return[4,this.getChannel(V.channelUrl,!0)];case 76:return Vs=Qe.sent(),nd=t.as(vk),Tv=nd.pinnedMessageIds,wv=nd.latestPinnedMessage,(Nv=nd.ts)>Vs._pinnedMessagesUpdatedAt&&(Vs.pinnedMessageIds=Tv,Vs.lastPinnedMessage=wv,Vs._pinnedMessagesUpdatedAt=Nv,this._dispatcher.dispatch(new Ve({channels:[Vs],context:{source:G.EVENT_PINNED_MESSAGE_UPDATED}})),Re(function(){return y(lt,void 0,void 0,function(){var q,j,He,ke,je;return v(this,function(Pt){try{for(q=pe(this._groupChannelHandlers.values()),j=q.next();!j.done;j=q.next())(He=j.value).onChannelChanged&&He.onChannelChanged(Vs)}catch(ct){ke={error:ct}}finally{try{j&&!j.done&&(je=q.return)&&je.call(q)}finally{if(ke)throw ke.error}}return[2]})})}),Re(function(){return y(lt,void 0,void 0,function(){return v(this,function(q){return this._groupChannelHandlers.forEach(function(j){j.onPinnedMessageUpdated&&j.onPinnedMessageUpdated(Vs)}),[2]})})})),[3,77];case 77:return[3,79];case 78:switch((E0=t.as(AS).event).category){case Uc.USER_BLOCK:b0=hf.getDataAsUserBlockEvent(this._iid,E0),rd=b0.blocker,id=b0.blockee,this._groupChannelCache.block(rd.userId,id.userId);break;case Uc.USER_UNBLOCK:C0=hf.getDataAsUserBlockEvent(this._iid,E0),rd=C0.blocker,id=C0.blockee,this._groupChannelCache.unblock(rd.userId,id.userId)}return[3,79];case 79:return[3,81];case 80:if(S0=Qe.sent(),Lr(S0))throw S0;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===Gt.JOINED}).length},n.prototype.getChannel=function(t,r){return r===void 0&&(r=!1),y(this,void 0,void 0,function(){var i;return v(this,function(s){switch(s.label){case 0:Y(R("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 v(this,function(u){switch(u.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),i=new ym({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(i)];case 1:switch(s=u.sent(),o=s.as(Em).channel,a=o.unreadMessageCount,l=o.unreadMentionCount,o.myCountPreference){case ni.UNREAD_MESSAGE_COUNT_ONLY:l=0;break;case ni.UNREAD_MENTION_COUNT_ONLY:a=0;break;case ni.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 v(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),s=new ym({channelUrl:t,isInternalCall:r}),[4,this._requestQueue.send(s)];case 1:return o=c.sent(),(a=o.as(Em).channel).myMemberState!==Gt.NONE?[3,2]:(this._dispatcher.dispatch(new bs({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!==Te.NON_AUTHORIZED&&u.code!==Te.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new bs({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 v(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 HO(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(jO),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 v(this,function(f){switch(f.label){case 0:return s=M(M({},pf),r),Y((R("string",t)||R("number",t))&&vm(s)).throw(L.invalidParameters),o=new PO(Ie({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(FO),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 bs({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 v(this,function(o){switch(o.label){case 0:return r=M(M({},xS),t),Y(OS(r)).throw(L.invalidParameters),i=new BO({userId:this._sdkState.userId,filter:r}),[4,this._requestQueue.send(i)];case 1:return s=o.sent(),[2,s.as($O).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,g,_;return v(this,function(E){switch(E.label){case 0:return r=M(M({},kO),t),Y(function(S){return We(Tn,S.keys)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new GO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=E.sent(),u=l.as(zO),c=u.groupChannelUnreadMentionCount,d=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,f=u.superGroupChannelUnreadMentionCount,p=u.superGroupChannelUnreadMessageCount,m=u.superGroupChannelInvitationCount,b=u.nonSuperGroupChannelUnreadMentionCount,g=u.nonSuperGroupChannelUnreadMessageCount,_=u.nonSuperGroupChannelInvitationCount,[2,ye({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:d,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:f,superGroupChannelUnreadMessageCount:p,superGroupChannelInvitationCount:m,nonSuperGroupChannelUnreadMentionCount:b,nonSuperGroupChannelUnreadMessageCount:g,nonSuperGroupChannelInvitationCount:_})]}})})},n.prototype.getTotalUnreadChannelCount=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new VO({userId:r.userId}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(qO).unreadCount]}})})},n.prototype.getTotalUnreadMessageCount=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l;return v(this,function(u){switch(u.label){case 0:return r=M(M({},RO),t),Y(LO(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new WO({userId:s.userId,filter:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(KO).unreadCount]}})})},n.prototype.getTotalScheduledMessageCount=function(t){return t===void 0&&(t={}),y(this,void 0,void 0,function(){var r,i,s,o;return v(this,function(a){switch(a.label){case 0:return r=M(M({},DO),t),Y(function(l){return R("string",l.channelUrl,!0)&&We(uo,l.scheduledStatus,!0)&&$e(tr,l.messageTypeFilter)}(r)).throw(L.invalidParameters),i=O.of(this._iid).requestQueue,s=new QO(r),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(YO).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 v(this,function(a){switch(a.label){case 0:return r=M(M({},mh),t),Y(gm(r)).throw(L.invalidParameters),r.isPublic||(r.accessCode=void 0),i=new XO(M({userId:this._sdkState.userId},r)),[4,this._requestQueue.send(i)];case 1:return s=a.sent(),o=s.as(JO).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 v(this,function(c){switch(c.label){case 0:return t=Date.now(),Y(t-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,r=new fy({userId:this._sdkState.userId}),[4,this._requestQueue.send(r)];case 1:c.sent(),i=this._groupChannelCache.channels;try{for(s=pe(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 v(this,function(h){switch(h.label){case 0:return r=Date.now(),Y(We("string",t)&&r-this._markAsReadAllLastSentAt>=1e3).throw(L.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=r,i=new fy({userId:this._sdkState.userId,channelUrls:t}),[4,this._requestQueue.send(i)];case 1:h.sent(),s=this._groupChannelCache.channels,o=[];try{for(a=pe(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 v(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 v(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 v(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=yS),a===void 0&&(a=!0),y(this,void 0,void 0,function(){return v(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 v(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 v(this,function(o){switch(o.label){case 0:return[4,this._messageCache.countBetween(t,r,new ls({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 v(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 v(this,function(r){switch(r.label){case 0:return[4,this._unsentMessageCache.remove([t])];case 1:return r.sent(),[2]}})})},n}(SO),Xr=function(e,n){return n instanceof Ft?e.findIndex(function(t){return t instanceof Ft&&n.isIdentical(t)}):e.findIndex(function(t){return t.isIdentical(n)})},cu=function(e,n){return e.findIndex(function(t){return t instanceof hr?t.messageId===n:t instanceof Na?t.notificationId===n:void 0})},xp=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"})(ws||(ws={}));var _f,ko=function(e){function n(t,r,i,s){var o=e.call(this)||this;return o._state=ws.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===ws.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isRunning",{get:function(){return this._state===ws.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isDone",{get:function(){return this._state===ws.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 v(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(W){return W.createdAt}),!((x=this._metadata)===null||x===void 0)&&(w=x.range).intersect.apply(w,De([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new ls({top:Math.min.apply(Math,De([],Ae(E),!1)),bottom:Math.max.apply(Math,De([],Ae(E),!1))}),previousComplete:!1}),g.hasNext=_.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(g.nextToken=this._metadata.range.top,this._metadata.previousComplete=_.length0&&(E=_.map(function(H){return H.createdAt}),!((I=this._metadata)===null||I===void 0)&&(w=I.range).intersect.apply(w,De([],Ae(E),!1))?this.extendRange(_):this._metadata={range:new ls({top:Math.min.apply(Math,De([],Ae(E),!1)),bottom:Math.max.apply(Math,De([],Ae(E),!1))}),previousComplete:!1}),g.hasNext=_.length>=this._limit,this._metadata&&(g.nextToken=this._metadata.range.bottom),f.debug("message background next sync progress",g),[4,this.saveMetadata()];case 4:return z.sent(),[3,7];case 5:throw S=z.sent(),f.debug("message background next sync error",S),S;case 6:return p.put(new $t({type:Et.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,g]}})})}),this._connectionEventContext=h.on(function(b){b instanceof _i&&(b.stateType===rt.CONNECTED?o.resume():o.pause())})}return e.of=function(n,t){return Di[n]||(Di[n]={}),Di[n][t.url]||(Di[n][t.url]=new e({_iid:n,channel:t})),Di[n][t.url].ref++,Di[n][t.url]},e.clear=function(n,t){Di[n]&&Di[n][t]&&(Di[n][t].close(),delete Di[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 ls({})},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,De([],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,De([],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 v(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 ls(t.range),previousComplete:t.previousComplete}:{range:new ls({}),previousComplete:!1},r.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return y(this,void 0,void 0,function(){return v(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 v(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 Di[this._iid][this._channel.url])},e}(),Ui={},Ck=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,g,_,E,S;return v(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,g=p.hasMore,_=p.token,f.hasNext=g,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===rt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Ui[n]||(Ui[n]={}),Ui[n][t.url]||(Ui[n][t.url]=new e({_iid:n,channel:t,includeParams:r})),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])},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(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 v(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 v(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 Ui[this._iid][this._channel.url])},e}(),Bo={},Sk=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,g,_,E,S;return v(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,sf.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return b=w.sent(),g=b.hasMore,_=b.token,f.hasNext=g,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===rt.CONNECTED?s.resume():s.pause())})}return e.of=function(n,t,r){return Bo[n]||(Bo[n]={}),Bo[n][t.url]||(Bo[n][t.url]=new e({_iid:n,channel:t,hasPollMessage:r})),Bo[n][t.url].ref++,Bo[n][t.url]},e.prototype.loadMetadata=function(){return y(this,void 0,void 0,function(){var n;return v(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 v(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 v(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 Bo[this._iid][this._channel.url])},e}(),Tk=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=Z.GET,f.path="".concat(Je(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),f.params=ye({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}(J),wk=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 yr(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 yr(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}(se),py={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};(function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"})(_f||(_f={}));var oc,ac,lc,Nk=function(){function e(){this._onCacheResult=qe,this._onApiResult=qe}return e.prototype._invokeResponse=function(n,t,r){var i=this;Re(function(){return y(i,void 0,void 0,function(){return v(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}(),Ik=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(Bs()),this._isDisposed=!1,this.filter=r??new _s,this._channel=l,this._syncRange=new ls({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint=typeof i=="number"&&Number.isFinite(i)?i:Number.MAX_SAFE_INTEGER,this._limit=s||yS,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(g,_){var E=_.source,S=g.findIndex(function(w){return w.isIdentical(h.channel)});S>=0&&(h._replaceChannelOfCollection(g[S]),h.channel._runIfHandleableWithGroupChannel(function(w){switch(E){case G.EVENT_CHANNEL_UPDATED:for(var N=!1,A=0;A=w.messageOffsetTimestamp){N=!0;var k=A;if(k>0){var I=h._messages.splice(0,k);h._removeMessagesFromView(I.map(function(z){return h.keyOf(z)}),G.EVENT_MESSAGE_OFFSET_UPDATED)}break}!N&&h._messages.length>0&&h._removeMessagesFromView(h._messages.map(function(z){return h.keyOf(z)}),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()}Re(function(){return y(h,void 0,void 0,function(){var z;return v(this,function(H){return gh(E)&&(!((z=this._handler)===null||z===void 0)&&z.onChannelUpdated)&&this._handler.onChannelUpdated(_,this.channel),[2]})})})}),h._postprocessChannelUpdateEvent(g[S],E))},onRemove:function(g,_){var E=g.indexOf(h.channel.url);E>=0&&(h._clearCheckMyMutedTimer(),Re(function(){return y(h,void 0,void 0,function(){var S;return v(this,function(w){return!((S=this._handler)===null||S===void 0)&&S.onChannelDeleted&&this._handler.onChannelDeleted(_,this.channel.url),[2]})})}),h._postprocessChannelRemoveEvent(g[E]))}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(g,_){var E,S,w=[],N=[];try{for(var A=pe(g),k=A.next();!k.done;k=A.next()){var I=k.value;I.channelUrl===h._channel.url&&(h.filter.match(I)?w.push(I):N.push(h.keyOf(I)))}}catch(x){E={error:x}}finally{try{k&&!k.done&&(S=A.return)&&S.call(A)}finally{if(E)throw E.error}}if(Ts(_)){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(g,_)},onRemove:function(g,_){h._removeMessagesFromView(g,_),h._postprocessMessageRemoveEvent(g)},onRemoveUnsent:function(g,_){h._removeUnsentMessageFromView(g,_)},onPollChangeLogUpdate:function(g,_){h._updatePollsToView(g,_)},onPollUpdate:function(g,_){h._applyPollUpdateEventToView(g,_)},onPollVote:function(g,_){h._applyPollVoteEventToView(g,_)},onReactionUpdate:function(g,_){h._applyReactionEventToView(g,_)},onThreadInfoUpdate:function(g,_){h._applyThreadInfoEventToView(g,_)}});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=bk.of(this._iid,this._channel),this._backgroundSync.resume(this._startingPoint)),this._changelogSync=Ck.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=Sk.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new ko(this._key,function(g){return y(h,void 0,void 0,function(){var _,E,S,w,N,A,k;return v(this,function(I){switch(I.label){case 0:return[4,this._getRemoteMessages(g,{prevLimit:this._prevResultLimit,source:G.SYNC_MESSAGE_FILL,checkingContinuousMessages:p.localCacheEnabled})];case 1:return _=I.sent(),E=_.messages,S=_.isContinuousMessages,E.length>0?(w=Math.min.apply(Math,De([],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,De([],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 $t({type:Et.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:(k=(A=p.localCacheConfig)===null||A===void 0?void 0:A.maxSize)!==null&&k!==void 0?k:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})}),this._connectionEventContext=m.on(function(g){if(g instanceof _i)switch(g.stateType){case rt.CONNECTED:kt(function(){return y(h,void 0,void 0,function(){return v(this,function(_){return this._activate(),[2]})})});break;case rt.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:Et.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 De([],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,De(De([],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,De(De([],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 v(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 hr&&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=pe(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&&Ts(t)&&Re(function(){return y(s,void 0,void 0,function(){var h,f,p;return v(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)&&Ts(t)&&Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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)&&Ts(t)&&Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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())&&Ts(t)&&(s.applyReactionEvent(n),Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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())&&Ts(t)&&(s.applyThreadInfoUpdateEvent(n),Re(function(){return y(r,void 0,void 0,function(){var o,a,l;return v(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=pe(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 Ts(t)&&a.length>0&&Re(function(){return y(s,void 0,void 0,function(){var h,f,p;return v(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 v(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,De(De(De([],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 v(this,function(g){switch(g.label){case 0:return m=An.of(this._iid),i>0||o>0?[4,m._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,n,Ie(M(M(M({},this.filter),py),{isInclusive:!0,reverse:c,prevResultSize:i,nextResultSize:o})),l,h,p)]:[3,2];case 1:return b=g.sent(),[3,3];case 2:b={messages:[],isContinuousMessages:!1},g.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,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q=this;return v(this,function($){switch($.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=$.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,p,m)];case 2:g=$.sent(),$.label=3;case 3:return $.trys.push([3,5,6,7]),[4,s0(function(){return y(Q,void 0,void 0,function(){var Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de=this;return v(this,function(fe){switch(fe.label){case 0:return Ne=new Tk(M(M({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:h,prevCount:b,nextStart:p,nextEnd:m,nextCount:g,checkingContinuousMessages:u.localCacheEnabled},this.filter),py)),[4,l.send(Ne)];case 1:return X=fe.sent(),ae=X.as(wk),ne=ae.isHugeGap,Ce=ae.prevMessages,K=Ce===void 0?[]:Ce,ie=ae.prevHasMore,ee=ae.isContinuousPrevMessages,ue=ae.nextMessages,P=ue===void 0?[]:ue,xe=ae.nextHasmore,B=ae.isContinuousNextMessages,ne?Re(function(){return y(de,void 0,void 0,function(){var ve;return v(this,function(_e){return!((ve=this._handler)===null||ve===void 0)&&ve.onHugeGapDetected&&this._handler.onHugeGapDetected(),[2]})})}):(te=this.viewTop,oe=this.viewBottom,me=Math.min.apply(Math,De([Number.MAX_SAFE_INTEGER,te],Ae(K.map(function(ve){return ve.createdAt})),!1)),re=Math.max.apply(Math,De([0,oe],Ae(P.map(function(ve){return ve.createdAt})),!1)),a.dispatch(new bt({messages:K,source:G.SYNC_MESSAGE_FILL})),a.dispatch(new bt({messages:P,source:G.SYNC_MESSAGE_FILL})),this._syncRange.extends(me,re),(ee||B)&&((ce=this._backgroundSync)===null||ce===void 0||ce.range.extends(me,re)),ie&&this._prevFill.start(me),xe&&this._nextFill.start(re)),[2]}})})},1)];case 4:return $.sent(),[3,7];case 5:return _=$.sent(),d.debug("Failed HugeGap Check ",_),[3,7];case 6:return c.put(new $t({type:Et.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(),$.label=9;case 9:return $.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=$.sent(),w=S.messages,N=S.isContinuousMessages,A=S.hasNext,w.length>0){for(k=w.map(function(Ne){return Ne.createdAt}),I=0,x=0,U=0;U=E&&x++;this._hasPrevious=I>=this._prevResultLimit,this._hasNext=A??x>=this._nextResultLimit,(W=this._syncRange).extends.apply(W,De([],Ae(k),!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(H=$.sent())instanceof L&&H.code===Te.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return c.put(new $t({type:Et.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 v(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 v(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;kt(function(){return y(t,void 0,void 0,function(){return v(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 v(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=ss.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 Nk;this._messages=[],this._unsentMessages=[],this._syncRange=new ls({}),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===_f.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 v(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,g=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}),A=0,k=0;for(w=0;wt._startingPoint&&k++}t._hasPrevious=A>=t._prevResultLimit,t._hasNext=g??k>=t._nextResultLimit,(u=t._syncRange).extends.apply(u,De([],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 $t({type:Et.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 $t({type:Et.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:Et.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 v(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Te.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,kt(function(){return y(h,void 0,void 0,function(){var p;return v(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 $t({type:Et.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,kt(function(){return y(h,void 0,void 0,function(){var p,m,b,g,_,E,S,w=this;return v(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,De([],Ae(u.map(function(A){return A.createdAt})),!1)),!((g=this._backgroundSync)===null||g===void 0)&&g.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.top))),u=u.filter(function(A){return Xr(w._messages,A)<0}),this._hasPrevious=u.length>=this._prevResultLimit,d&&o.put(new $t({type:Et.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 v(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new L({code:Te.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,kt(function(){return y(h,void 0,void 0,function(){var p;return v(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 $t({type:Et.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,kt(function(){return y(h,void 0,void 0,function(){var p,m,b,g,_,E,S,w,N=this;return v(this,function(A){switch(A.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=A.sent(),(u=this._filterUnderOffsetMessage(m.messages)).length>0&&((b=this._syncRange).extends.apply(b,De([],Ae(u.map(function(k){return k.createdAt})),!1)),!((g=this._backgroundSync)===null||g===void 0)&&g.range.overlap(this._syncRange)&&m.isContinuousMessages&&(d=!0,(_=this._backgroundSync)===null||_===void 0||_.range.extends(this._syncRange.bottom))),u=u.filter(function(k){return Xr(N._messages,k)<0}),this._hasNext=(E=m.hasNext)!==null&&E!==void 0?E:u.length>=this._nextResultLimit,d&&o.put(new $t({type:Et.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 v(this,function(r){switch(r.label){case 0:if(this._isDisposed)throw new L({code:Te.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!==Gt.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}(),Ak=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 kt(function(){return y(r,void 0,void 0,function(){var i;return v(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 v(this,function(r){switch(r.label){case 0:return[4,e.prototype._activate.call(this)];case 1:return r.sent(),[4,kt(function(){return y(t,void 0,void 0,function(){var i;return v(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=pe(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=Xr(this._messages,h))<0){Xr(this._unsentMessages,h)<0&&l.push(h);var f=xp(this._messages,h);this._messages.splice(f,0,h)}}else h instanceof Ft&&(b=Xr(this._unsentMessages,h))<0&&Xr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h));else if(h.messageId>0){if((b=Xr(this._messages,h))<0){var p=Xr(this._unsentMessages,h);p<0?l.push(h):(this._unsentMessages.splice(p,1),u.push(h)),f=xp(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,De([],Ae(m),!1))}}else if(h instanceof Ft){var b;(b=Xr(this._unsentMessages,h))<0?Xr(this._messages,h)<0&&(this._unsentMessages.push(h),l.push(h)):(u.push(h),this._unsentMessages[b]=h)}}}catch(g){i={error:g}}finally{try{d&&!d.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}Ts(r)&&Re(function(){return y(o,void 0,void 0,function(){var g,_,E,S,w;return v(this,function(N){return g={source:r},l.length>0&&((E=(_=this._handler)===null||_===void 0?void 0:_.onMessagesAdded)===null||E===void 0||E.call(_,g,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,g,this.channel,u)),[2]})})})},n.prototype._updateMessagesToView=function(t,r){var i,s,o=this,a=[],l=[],u=[];try{for(var c=pe(t),d=c.next();!d.done;d=c.next()){var h,f=d.value;if(f.messageId>0)if((h=Xr(this._messages,f))>=0)l.push(f),this._messages[h]=f;else{var p=Xr(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=xp(this._messages,f);this._messages.splice(b,0,f)}}else{var g=this._messages.map(function(_){return _.createdAt});(f.createdAtMath.max.apply(Math,De([],Ae(g),!1))&&!this._hasNext)&&a.push(f)}}else f instanceof Ft&&(h=Xr(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 Ts(r)&&Re(function(){return y(o,void 0,void 0,function(){var _,E,S,w,N;return v(this,function(A){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}(Ik),Mk={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},xk=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=Z.GET,r.path="".concat(sr,"/").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}(J),Ok=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 si(t,a)})),i}return T(n,e),n}(se);(function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"})(oc||(oc={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(ac||(ac={})),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"}(lc||(lc={}));var kk=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=oc.ALL,u.memberStateFilter=lc.ALL,u.nicknameStartsWithFilter=null,u.operatorFilter=ff.ALL,u.order=ac.MEMBER_NICKNAME_ALPHABETICAL,u.mutedMemberFilter=(s=i.mutedMemberFilter)!==null&&s!==void 0?s:oc.ALL,u.memberStateFilter=(o=i.memberStateFilter)!==null&&o!==void 0?o:lc.ALL,u.nicknameStartsWithFilter=(a=i.nicknameStartsWithFilter)!==null&&a!==void 0?a:null,u.order=(l=i.order)!==null&&l!==void 0?l:ac.MEMBER_NICKNAME_ALPHABETICAL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&$e(oc,this.mutedMemberFilter)&&$e(lc,this.memberStateFilter)&&(R("string",this.nicknameStartsWithFilter)||this.nicknameStartsWithFilter===null)&&$e(ff,this.operatorFilter)&&$e(ac,this.order)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 xk(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(Ok),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}(Gs),Rk=function(e){function n(t){var r=this,i=t.channelUrl,s=t.userId,o=t.accessCode;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/accept"),r.params={user_id:s,access_code:o},r}return T(n,e),n}(J),Lk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.channel=new di(t,r),i.channel.myMemberState=Gt.JOINED,i}return T(n,e),n}(se),Dk=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=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i)),r.params=ye({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}(J),Uk=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}(se),Pk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(sr,"/").concat(encodeURIComponent(i)),r}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var Fk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.DELETE,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/hide"),r}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var Hk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.countPreference,o=e.call(this)||this;return o.method=Z.PUT,o.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/count_preference/").concat(encodeURIComponent(i)),o.params={count_preference:s},o}return T(n,e),n}(J),jk=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}(se),Bk=function(e){function n(t){var r=this,i=t.channelUrl;return(r=e.call(this)||this).method=Z.PUT,r.path="".concat(sr,"/").concat(encodeURIComponent(i),"/reset_user_history"),r}return T(n,e),n}(J),$k=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}(se),Gk=M(M({},ev),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),zk=M(M({},hS),{scheduledAt:void 0}),Vk=function(e){function n(t){var r,i,s=this;s=e.call(this)||this;var o=[];t.mentionType===rr.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=Z.PUT,s.path="".concat(Je(a),"/").concat(encodeURIComponent(l),"/scheduled_messages/").concat(encodeURIComponent(u)),s.params=ye(Ie({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 zs.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 _r.payloadify(c)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return T(n,e),n}(J),qk=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new Jt(t,r),i}return T(n,e),n}(se),Wk=function(e){function n(t){var r,i=this;i=e.call(this)||this;var s=[];t.mentionType===rr.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=Z.PUT,i.path="".concat(Je(o),"/").concat(encodeURIComponent(a),"/scheduled_messages/").concat(encodeURIComponent(l)),i.params=ye(Ie({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 _r.payloadify(u)}),apple_critical_alert_options:t.appleCriticalAlertOptions?Oi.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),i}return T(n,e),n}(J);(function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.message=new er(t,r),i}T(n,e)})(se);var Kk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Z.DELETE,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o)),r}return T(n,e),n}(J),Qk=function(e){function n(t){var r=e.call(this)||this,i=t.channelType,s=t.channelUrl,o=t.scheduledMessageId;return r.method=Z.POST,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(o),"/send_now"),r}return T(n,e),n}(J),Yk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=t.pushTriggerOption,o=e.call(this)||this;return o.method=Z.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}(J),Zk=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}(se),Xk=function(e){function n(t){var r=t.userId,i=t.channelUrl,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J),Jk=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}(se),eR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Z.POST,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var tR=function(e){function n(t){var r=t.channelType,i=t.channelUrl,s=t.messageId,o=e.call(this)||this;return o.method=Z.DELETE,o.path="".concat(Je(r),"/").concat(encodeURIComponent(i),"/messages/").concat(s,"/pin"),o}return T(n,e),n}(J);(function(e){function n(t,r){return e.call(this,t,r)||this}T(n,e)})(se);var ni,dr,nR=function(e){function n(t,r){var i=e.call(this,t)||this;return i.message=null,i.message=yr(t,r.message),i}return T(n,e),n}(Kn),rR=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=Z.GET,r.path="".concat(Je(i),"/").concat(encodeURIComponent(s),"/pinned_messages"),r.params=ye({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}(J),iR=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 nR(t,l)}),i.hasMore=o,i.token=a,i}return T(n,e),n}(se),sR=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)&&R("boolean",this.includeMetaArray,!0)&&R("boolean",this.includeReactions,!0)&&R("boolean",this.includeParentMessageInfo,!0)&&R("boolean",this.includeThreadInfo,!0)&&R("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 v(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 rR(M(M({},this),{token:this._token})),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=u.sent(),s=i.as(iR),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}(Gs);(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"})(ni||(ni={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(dr||(dr={}));var di=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I=this;return(I=e.call(this,t,r)||this)._unreadMemberStateMap=new Map,I._undeliveredMemberStateMap=new Map,I._typingStatus=new Map,I._lastMemberCountUpdated=0,I._typingStarted=0,I._typingEnded=0,I.isDistinct=!1,I.isSuper=!1,I.isBroadcast=!1,I.isExclusive=!1,I.isPublic=!1,I.isDiscoverable=!0,I.isChatNotification=!1,I.isAccessCodeRequired=!1,I.isPushEnabled=!1,I.unreadMessageCount=0,I.unreadMentionCount=0,I.totalUnreadReplyCount=0,I.members=[],I.memberCount=0,I.joinedMemberCount=0,I.hiddenState=dr.UNHIDDEN,I.lastMessage=null,I.messageOffsetTimestamp=0,I.messageSurvivalSeconds=-1,I.myMemberState=Gt.NONE,I.myRole=Ni.NONE,I.myMutedState=ss.UNMUTED,I.myLastRead=0,I.myCountPreference=ni.ALL,I.myPushTriggerOption=na.DEFAULT,I.inviter=null,I.invitedAt=0,I.joinedAt=0,I.pinnedMessageIds=[],I.lastPinnedMessage=null,I._pinnedMessagesUpdatedAt=0,I._myMutedRemainingTime=-1,I.channelType=Ze.GROUP,I.isDistinct=(s=r.is_distinct)!==null&&s!==void 0&&s,I.isSuper=(o=r.is_super)!==null&&o!==void 0&&o,I.isBroadcast=(a=r.is_broadcast)!==null&&a!==void 0&&a,I.isExclusive=(l=r.is_exclusive)!==null&&l!==void 0&&l,I.isPublic=(u=r.is_public)!==null&&u!==void 0&&u,I.isDiscoverable=(c=r.is_discoverable)!==null&&c!==void 0?c:I.isPublic,I.isChatNotification=(d=r.is_chat_notification)!==null&&d!==void 0&&d,I.isAccessCodeRequired=(h=r.is_access_code_required)!==null&&h!==void 0&&h,I.isPushEnabled=(f=r.is_push_enabled)!==null&&f!==void 0&&f,Array.isArray(r.members)&&(i=I.members).push.apply(i,De([],Ae(r.members.map(function(x){return new si(I._iid,x)})),!1)),I.memberCount=(p=r.member_count)!==null&&p!==void 0?p:0,I.joinedMemberCount=(m=r.joined_member_count)!==null&&m!==void 0?m:0,I.hiddenState=$e(dr,r.hidden_state)?r.hidden_state:dr.UNHIDDEN,I.messageOffsetTimestamp=(b=r.ts_message_offset)!==null&&b!==void 0?b:0,I.messageSurvivalSeconds=(g=r.message_survival_seconds)!==null&&g!==void 0?g:-1,I.lastMessage=r.last_message?yr(I._iid,M({channel_type:I.channelType},r.last_message)):null,r.read_receipt&&Object.keys(r.read_receipt).forEach(function(x){R("number",r.read_receipt[x])&&I._updateUnreadMemberState(x,r.read_receipt[x])}),r.delivery_receipt&&Object.keys(r.delivery_receipt).forEach(function(x){R("number",r.delivery_receipt[x])&&I._updateUndeliveredMemberState(x,r.delivery_receipt[x])}),I.myMemberState=$e(Gt,r.member_state)?r.member_state:Gt.NONE,I.myRole=$e(Ni,r.my_role)?r.my_role:Ni.NONE,$e(ss,r.is_muted)?I.myMutedState=r.is_muted:R("boolean",r.is_muted)?I.myMutedState=r.is_muted?ss.MUTED:ss.UNMUTED:I.myMutedState=ss.UNMUTED,I.myCountPreference=$e(ni,r.count_preference)?r.count_preference:ni.ALL,I.myPushTriggerOption=$e(na,r.push_trigger_option)?r.push_trigger_option:na.ALL,I.myLastRead=(_=r.user_last_read)!==null&&_!==void 0?_:0,I.inviter=r.inviter?new Ke(I._iid,r.inviter):null,I.invitedAt=(E=r.invited_at)!==null&&E!==void 0?E:0,I.joinedAt=(S=r.joined_ts)!==null&&S!==void 0?S:0,I._updateUnreadCount((w=r.unread_message_count)!==null&&w!==void 0?w:0,(N=r.unread_mention_count)!==null&&N!==void 0?N:0),I.totalUnreadReplyCount=(A=r.total_unread_thread_message_count)!==null&&A!==void 0?A:0,I.pinnedMessageIds=(k=r.pinned_message_ids)!==null&&k!==void 0?k:[],I.lastPinnedMessage=r.latest_pinned_message?yr(I._iid,M({channel_type:I.channelType},r.latest_pinned_message)):null,I}return T(n,e),Object.defineProperty(n.prototype,"isHidden",{get:function(){return this.hiddenState!==dr.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=pe(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=pe(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 ye(Ie(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 si.payloadify(r)}),last_message:t.lastMessage?B1(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?B1(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 oa.NONE:case oa.INCLUDE_REPLY:break;case oa.EXCLUDE_REPLY:if(t.parentMessageId>0)return!1;break;case oa.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ft&&t.parentMessageId>0&&!t.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt0)return!1;break;case sa.INCLUDE_REPLY_TO_CHANNEL:if(t instanceof Ft&&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===ni.ALL||this.myCountPreference===ni.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===ni.ALL||this.myCountPreference===ni.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 Qc(this,function(r){r.cachedUnreadMemberState=t.cachedUnreadMemberState,r.cachedUndeliveredMemberState=t.cachedUndeliveredMemberState})},n.prototype.createMessageCollection=function(t){return t===void 0&&(t={}),new Ak(this._iid,M(M({},t),{channel:this}))},n.prototype.createMemberListQuery=function(t){return t===void 0&&(t={}),new kk(this._iid,this.url,t)},n.prototype.createThreadedParentMessageListQuery=function(t){return t===void 0&&(t={}),new mO(this._iid,this.url,this.channelType,t)},n.prototype.createPinnedMessageListQuery=function(t){return t===void 0&&(t={}),new sR(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===Gt.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 si?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 Ft&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=O.of(this._iid).sdkState,o=t.createdAt,a=0;try{for(var l=pe(this.members),u=l.next();!u.done;u=l.next()){var c=u.value;s.userId!==c.userId&&c.state===Gt.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 Ft?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 v(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 v(this,function(u){switch(u.label){case 0:return r=O.of(this._iid),i=r.requestQueue,s=r.dispatcher,o=new ym({channelUrl:this.url}),[4,i.send(o)];case 1:return a=u.sent(),l=a.as(Em).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 v(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 v(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 v(this,function(c){switch(c.label){case 0:return r=M(M({},Mk),t),Y(function(d){return R("string",d.coverUrl,!0)&&(pr(d.coverImage)||R("string",d.coverImage,!0))&&R("boolean",d.isDistinct,!0)&&R("boolean",d.isPublic,!0)&&R("boolean",d.isDiscoverable,!0)&&R("string",d.accessCode,!0)&&R("string",d.name,!0)&&R("string",d.data,!0)&&R("string",d.customType,!0)&&We("string",d.operatorUserIds,!0)&&R("number",d.messageSurvivalSeconds,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.requestQueue,a=new Dk(M({channelUrl:this.url},r)),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Uk).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 v(this,function(r){return Y(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 v(this,function(c){switch(c.label){case 0:return Y(We("string",t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.requestQueue,o=r.sessionManager,a=new sk({channelUrl:this.url,userIds:t}),[4,s.send(a)];case 1:return l=c.sent(),u=l.as(ok).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 v(this,function(c){switch(c.label){case 0:return Y(R("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new ek({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(tk).channel).myMemberState=this.myMemberState=Gt.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 v(this,function(a){switch(a.label){case 0:return r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new rk({channelUrl:this.url,userId:i.userId,shouldRemoveOperatorStatus:t}),[4,s.send(o)];case 1:return a.sent(),this.myMemberState=Gt.NONE,[2]}})})},n.prototype.acceptInvitation=function(t){return y(this,void 0,void 0,function(){var r,i,s,o,a,l,u;return v(this,function(c){switch(c.label){case 0:return Y(R("string",t,!0)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Rk({channelUrl:this.url,userId:s.userId,accessCode:t}),[4,o.send(a)];case 1:return l=c.sent(),(u=l.as(Lk).channel).myMemberState=this.myMemberState=Gt.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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new lk({channelUrl:this.url,userId:r.userId}),[4,i.send(s)];case 1:return o.sent(),this.myMemberState=Gt.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===dr.HIDDEN_ALLOW_AUTO_UNHIDE&&(r.hiddenState=dr.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 v(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 bt({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 fh,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 v(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 bt({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 v(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 Ft&&O.of(this._iid).dispatcher.dispatch(new VC({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 v(this,function(d){switch(d.label){case 0:return r=M(M({},bm),t),Y(function(h){return R("boolean",h.hidePreviousMessages,!0)&&R("boolean",h.allowAutoUnhide,!0)}(r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.dispatcher,o=i.sdkState,a=i.requestQueue,l=new ck(M({channelUrl:this.url,userId:o.userId},r)),[4,a.send(l)];case 1:return u=d.sent(),c=u.as(dk).messageOffsetTimestamp,this.hiddenState=r.allowAutoUnhide?dr.HIDDEN_ALLOW_AUTO_UNHIDE:dr.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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Fk({channelUrl:this.url}),[4,i.send(s)];case 1:return o.sent(),this.hiddenState=dr.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 v(this,function(i){switch(i.label){case 0:return t=O.of(this._iid).requestQueue,r=new Pk({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 v(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 K6({channelUrl:this.url}),[4,s.send(o)];case 1:return a=c.sent(),l=a.as(iS).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 v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yk({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 v(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 fk({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 v(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 _k({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({},eO),t),Y(tO(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 v(this,function(l){switch(l.label){case 0:return i=M(M({},zk),r),Y(function(u){return fS(u)&&R("number",u.scheduledAt,!0)}(i)).throw(L.invalidParameters),s=O.of(this._iid).requestQueue,o=new Wk(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(_S).message]}})})},n.prototype.createScheduledFileMessage=function(t){var r=this;t=M(M({},nO),t),Y(rO(t)).throw(L.invalidParameters);var i=Date.now(),s=this._generateRequestId(),o=new Br;return Or(xx).then(function(){var a=r._createPendingScheduledFileMessage(t,s,i);Re(function(){return y(r,void 0,void 0,function(){return v(this,function(l){return[2,o._trigger(a)]})})})}),pr(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 v(this,function(a){switch(a.label){case 0:return i=M(M({},Gk),r),Y(function(l){return tv(l)&&R("number",l.scheduledAt,!0)&&(pr(l.file)||R("string",l.fileUrl))&&R("string",l.fileName,!0)&&R("string",l.mimeType,!0)&&R("number",l.fileSize,!0)&&(l.thumbnailSizes===null||l.thumbnailSizes===void 0||l.thumbnailSizes.every(function(u){return R("object",u)&&u.maxWidth>0&&u.maxHeight>0}))}(i)).throw(L.invalidParameters),pr(i.file)?[4,this._uploadFileAndUpdateParams(i)]:[3,2];case 1:a.sent(),a.label=2;case 2:return s=new Vk(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(qk).message]}})})},n.prototype.cancelScheduledMessage=function(t){return y(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:return r=new Kk({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 v(this,function(i){switch(i.label){case 0:return r=new Qk({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 v(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new Xk({userId:r.userId,channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as(Jk).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 v(this,function(c){switch(c.label){case 0:return Y($e(na,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Yk({userId:s.userId,channelUrl:this.url,pushTriggerOption:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(Zk).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 v(this,function(c){switch(c.label){case 0:return Y($e(ni,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.dispatcher,s=r.sdkState,o=r.requestQueue,a=new Hk({channelUrl:this.url,userId:s.userId,countPreference:t}),[4,o.send(a)];case 1:return l=c.sent(),u=l.as(jk).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 v(this,function(l){switch(l.label){case 0:return t=O.of(this._iid),r=t.dispatcher,i=t.requestQueue,s=new Bk({channelUrl:this.url}),[4,i.send(s)];case 1:return o=l.sent(),a=o.as($k).messageOffsetTimestamp,this.messageOffsetTimestamp=a,this.lastMessage&&this.lastMessage.createdAt0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new eR({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 v(this,function(s){switch(s.label){case 0:return Y(R("number",t)&&t>0).throw(L.invalidParameters),r=O.of(this._iid).requestQueue,i=new tR({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 v(this,function(f){switch(f.label){case 0:return pr(t.file)?(r=O.of(this._iid).requestQueue,i=new of({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(af),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(Y(t instanceof Ft&&!t.scheduledInfo&&t.isResendable).throw(L.invalidParameters),t.isUserMessage()){var o=(i=t.messageParams)!==null&&i!==void 0?i:lm(t),a=new Br;return this._sendUserMessage(o,Zn.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);Y(l).throw(L.invalidParameters),o=um(t,r);var u=new Br;return this._sendFileMessage(o,Zn.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 fh;return this._sendMultipleFilesMessage(o,Zn.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(Y(t instanceof ny&&r instanceof Ft&&r.sendingStatus===ut.SUCCEEDED&&this.url===r.channelUrl&&!r.scheduledInfo).throw(L.invalidParameters),r.isUserMessage()){Y(!r.poll).throw(L.notSupportedError);var s=uS(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=dS(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=Ix(r);var l=new fh;return t._sendMultipleFilesMessage(s,Zn.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}(ny),oR=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},uc,Ks={},aR=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,g,_,E,S,w,N,A,k;return v(this,function(I){switch(I.label){case 0:return f={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(I.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];I.label=2;case 2:if(I.trys.push([2,9,,12]),(p={includeEmpty:!0,order:jt.CHRONOLOGICAL}).order!==jt.LATEST_LAST_MESSAGE)return[3,6];I.label=3;case 3:return I.trys.push([3,5,,6]),[4,d.preference.get(Wg(l.appId))];case 4:return m=I.sent(),p.includeChatNotification=!!m,[3,6];case 5:return I.sent(),p.includeChatNotification=!1,[3,6];case 6:return[4,Nn.of(this._iid).getMyGroupChannels((k=(A=this._metadata)===null||A===void 0?void 0:A.token)!==null&&k!==void 0?k:"",p,this._limit,G.SYNC_CHANNEL_BACKGROUND)];case 7:return b=I.sent(),g=b.channels,_=b.token,f.hasNext=g.length>=this._limit&&!!_,f.nextToken=_,this._metadata&&(this._metadata.token=_,(S=this._metadata.range).extends.apply(S,De([],Ae(g.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 I.sent(),[3,12];case 9:return E=I.sent(),c.debug("channel background 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[3,14];case 13:f.hasNext=!1,f.nextToken="",I.label=14;case 14:return[2,f]}})})}),this._connectionEventContext=u.on(function(f){f instanceof _i&&(f.stateType===rt.CONNECTED?s.resume():s.pause())})}return e.of=function(n){return Ks[n]||(Ks[n]=new e({_iid:n})),Ks[n].ref++,Ks[n]},e.clear=function(n){Ks[n]&&(Ks[n].close(),delete Ks[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 ls({})},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 v(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 ls(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 v(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 v(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 Ks[this._iid])},e}(),Qs={},lR=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 La;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,g,_,E,S,w,N;return v(this,function(A){switch(A.label){case 0:return d={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:A.sent(),o.debug("channel changelog sync from",(S=this._metadata)===null||S===void 0?void 0:S.token),A.label=2;case 2:A.trys.push([2,9,,12]),h={includeEmpty:!0},A.label=3;case 3:return A.trys.push([3,5,,6]),[4,u.preference.get(Wg(a.appId))];case 4:return f=A.sent(),h.includeChatNotification=!!f,[3,6];case 5:return A.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=A.sent(),m=p.updatedChannels,b=p.deletedChannelUrls,g=p.hasMore,_=p.token,this._subscribers.dispatch("progress",{updatedChannels:m,deletedChannelUrls:b,hasMore:g,token:_}),d.hasNext=g,d.nextToken=_,this._metadata&&(this._metadata.token=_),o.debug("channel changelog sync progress",d),[4,this.saveMetadata()];case 8:return A.sent(),[3,12];case 9:return E=A.sent(),o.debug("channel changelog 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[2,d]}})})}),this._sync.on("stop",function(){r._subscribers.dispatch("pause")}),this._connectionEventContext=l.on(function(d){d instanceof _i&&(d.stateType===rt.CONNECTED?r.resume():r.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,"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 v(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 v(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 v(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 Qs[this._iid])},e}(),vh=function(e,n){return e.findIndex(function(t){return t.isIdentical(n)})},_y=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:my(e[o],n,t)>=0?o:o+1,oldPosition:r}}return{place:e.length,oldPosition:-1}},my=function(e,n,t){switch(t){case jt.LATEST_LAST_MESSAGE:return e.lastMessage&&n.lastMessage?(r=n.lastMessage.createdAt-e.lastMessage.createdAt)===0?n.createdAt-e.createdAt:r:e.lastMessage?-1:n.lastMessage?1:n.createdAt-e.createdAt;case jt.CHRONOLOGICAL:return n.createdAt-e.createdAt;case jt.CHANNEL_NAME_ALPHABETICAL:var r;return(r=e.name.localeCompare(n.name))===0?e.createdAt-n.createdAt:r;default:return 0}},uR=function(){function e(n,t){var r=t.filter,i=r===void 0?new MS:r,s=t.order,o=s===void 0?jt.LATEST_LAST_MESSAGE:s,a=t.limit,l=a===void 0?gS:a,u=t.includeChangesOnInitialLoad,c=u!==void 0&&u,d=this;this.channels=[],this._iid=n,this._key="gcc-".concat(Bs()),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=aR.of(n),this._backgroundSync.resume()),this._changelogSync=lR.of(n),this._changelogSync.resume(),Nn.of(this._iid).subscribeChannelEvent(this._key,{onUpdate:function(b,g){var _=g.source;if(gh(_)){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,g),S.length>0&&d._removeChannelsFromView(S,g)}},onRemove:function(b,g){d._removeChannelsFromView(b,g)}}),O.of(this._iid).statManager.put(new Fl({type:Et.FEATURE_LOCALCACHE,data:{use_local_cache:p.localCacheEnabled,collection_interface:{group_channel:!0}}})),m.on(function(b){b instanceof _i&&(b.stateType===rt.CONNECTED?d._isGetRemoteChannelsSucceeded||y(d,void 0,void 0,function(){return v(this,function(g){switch(g.label){case 0:return[4,this._revokeLoadMore()];case 1:return g.sent(),[2]}})}):b.stateType===rt.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=pe(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=_y(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===jt.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 g=pe(d),_=g.next();!_.done;_=g.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=g.return)&&a.call(g)}finally{if(o)throw o.error}}gh(t.source)&&Re(function(){return y(l,void 0,void 0,function(){var S,w,N;return v(this,function(A){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(k){return k.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=pe(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 gh(t.source)&&o.length>0&&Re(function(){return y(s,void 0,void 0,function(){var d;return v(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 v(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 jt.LATEST_LAST_MESSAGE:return(a=(o=i.lastMessage)===null||o===void 0?void 0:o.createdAt)!==null&&a!==void 0?a:i.createdAt;case jt.CHRONOLOGICAL:return i.createdAt;case jt.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 v(this,function(i){switch(i.label){case 0:return[4,Nn.of(this._iid).getMyGroupChannels(this._token,Ie(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 v(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,g,_,E,S=this;return v(this,function(w){switch(w.label){case 0:if(this._isDisposed)throw new L({code:Te.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(A){return N(A)}).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,kt(function(){return y(S,void 0,void 0,function(){return v(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=pe(t.updatedChannels),l=a.next();!l.done;l=a.next())u=l.value,(m=vh(r,u))>=0?r[m]=u:(c=_y(r,u,this.order).place,r.splice(c,0,u))}catch(N){b={error:N}}finally{try{l&&!l.done&&(g=a.return)&&g.call(a)}finally{if(b)throw b.error}}d=r.map(function(N){return N.url});try{for(h=pe(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}(),cR=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,g=t.metadataValueStartsWith,_=t.includeFrozen,E=t.includeMetaData;return(r=e.call(this)||this).method=Z.GET,r.path=sr,r.params=ye(Ie({token:i,limit:s,order:o,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:a,public_mode:ps.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:g,show_frozen:_,show_metadata:E})),r}return T(n,e),n}(J),dR=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}(se);(function(e){e.ALL="all",e.JOINED="joined"})(uc||(uc={}));var hR=function(e){function n(t,r){var i,s,o,a,l,u,c,d,h,f,p,m,b,g,_=this;return(_=e.call(this,t,r)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=uc.ALL,_.superChannelFilter=Ur.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=sc.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:uc.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=(g=r.order)!==null&&g!==void 0?g:sc.CHRONOLOGICAL,_}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&R("boolean",this.includeEmpty)&&R("boolean",this.includeFrozen)&&R("boolean",this.includeMetaData)&&R("string",this.channelNameContainsFilter,!0)&&We("string",this.channelUrlsFilter,!0)&&We("string",this.customTypesFilter,!0)&&R("string",this.customTypeStartsWithFilter,!0)&&$e(uc,this.membershipFilter)&&$e(Ur,this.superChannelFilter)&&$e(sc,this.order)&&R("string",this.metadataOrderKeyFilter,!0)&&R("string",this.metadataKey,!0)&&We("string",this.metadataValues,!0)&&R("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 v(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 cR(Ie(M(M({},this),{token:this._token}))),[4,r.send(i)]):[3,2]):[3,5];case 1:return s=u.sent(),o=s.as(dR),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),rv=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}(oR)),fR=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=Z.GET,r.path="".concat(uC),r.params=ye(Ie({token:i,limit:s,reverse:a,channel_url:l,order:o,message_type:u,status:c})),r}return T(n,e),n}(J),pR=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 yr(t,a)}),i}return T(n,e),n}(se),_R=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=tr.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:tr.ALL,u}return T(n,e),n.prototype._validate=function(){return e.prototype._validate.call(this)&&R("string",this.channelUrl,!0)&&($e(mm,this.order)||this.order===null)&&R("boolean",this.reverse)&&(We(uo,this.scheduledStatus)||this.scheduledStatus===null)&&$e(tr,this.messageTypeFilter)},n.prototype.next=function(){return y(this,void 0,void 0,function(){var t,r,i,s,o,a;return v(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 fR(Ie(M(M({},this),{token:this._token}))),[4,t.send(r)]):[3,2]:[3,5];case 1:return i=l.sent(),s=i.as(pR),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),mR=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 uR(this._iid,t)},n.prototype.createMyGroupChannelListQuery=function(t){return t===void 0&&(t={}),new kS(this._iid,t)},n.prototype.createPublicGroupChannelListQuery=function(t){return t===void 0&&(t={}),new hR(this._iid,t)},n.prototype.createScheduledMessageListQuery=function(t){return t===void 0&&(t={}),new _R(this._iid,t)},n.prototype.addGroupChannelHandler=function(t,r){Y(R("string",t)&&r instanceof rv).throw(L.invalidParameters),this._manager.addHandler(t,r)},n.prototype.removeGroupChannelHandler=function(t){Y(R("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 v(this,function(r){return Y(R("string",t)).throw(L.invalidParameters),[2,this._manager.getChannel(t)]})})},n.prototype.getChannelWithoutCache=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return Y(R("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 v(this,function(s){switch(s.label){case 0:return i=M(M({},pf),r),Y(R("string",t)&&vm(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 v(this,function(s){switch(s.label){case 0:return i=M(M({},pf),r),Y(R("number",t)&&vm(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 v(this,function(i){return r=M(M({},xS),t),Y(OS(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 v(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 v(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 v(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 v(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 v(this,function(i){return r=M(M({},mh),t),Y(gm(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 v(this,function(i){return r=M(M({},mh),t),Y(gm(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 v(this,function(u){return l=M(M({},mh),{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 v(this,function(t){return this._manager.markAsReadAll(),[2]})})},n.prototype.markAsReadWithChannelUrls=function(t){return y(this,void 0,void 0,function(){return v(this,function(r){return Y(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 v(this,function(r){switch(r.label){case 0:return Y(R("string",t)).throw(L.invalidParameters),[4,this.getChannel(t)];case 1:return[4,r.sent().markAsDelivered()];case 2:return r.sent(),[2]}})})},n}(Yg);const mf={collection:{groupChannel:{defaultLimit:20,defaultOrder:jt.LATEST_LAST_MESSAGE,defaultIncludeEmpty:!1},message:{defaultLimit:{next:25,prev:25},searchLimit:{next:10,prev:10}}}};var gR=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 vR=(e,n)=>{D.useEffect(RS(e),n)},yR=(e,n)=>{D.useLayoutEffect(RS(e),n)},Op=e=>e(),RS=e=>()=>{const n=Op(e);return()=>{n&&(n instanceof Promise?Op(()=>gR(void 0,void 0,void 0,function*(){const t=yield n;t&&t()})):Op(n))}};let ER=0;function bR(){return D.useState(()=>`${ER++}`)[0]}const LS=(e,n,t)=>{const r=D.useRef(n),s=bR();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 rv)),()=>{var l;(l=e==null?void 0:e.groupChannel)===null||l===void 0||l.removeGroupChannelHandler(s)}},[e==null?void 0:e.groupChannel,s])};function fn(e){const n=D.useRef(e);return n.current=e,D.useCallback((...t)=>n.current(...t),[n])}var CR=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 sf(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 v(this,function(i){return r=M(M({},B6),t),Y(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 v(this,function(i){return r=M(M({},G6),t),Y(ZC(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 v(this,function(i){return r=M(M({},$6),t),Y(YC(r)).throw(L.invalidParameters),[2,this._manager.getOption(r)]})})},n.prototype.buildPollFromSerializedData=function(t){return this._manager.buildPollFromSerializedData(t)},n}(Yg),SR=function(e){return["-lastMessageUpdatedAt","-createdAt","syncIndex"]},gy=function(e){function n(){return e!==null&&e.apply(this,arguments)||this}return T(n,e),n}(Tt),DS=function(e){this.key=e.key,this.url=e.url},US=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 DS(n)}):[]},TR=function(e){this.emojiHash=e.emoji_hash||"",this.emojiCategories=e.emoji_categories?e.emoji_categories.map(function(n){return new US(n)}):[]},wR={profileImage:void 0,profileUrl:void 0,nickname:void 0},vy=function(e){return function(n,t){return y(void 0,void 0,void 0,function(){var r,i,s,o;return v(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 v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:vS,keyName:Ex,index:[_h(jt.LATEST_LAST_MESSAGE),_h(jt.CHRONOLOGICAL),_h(jt.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:hm,keyName:bx,index:[cs(Vn.CHANNEL_LATEST),cs(Vn.NEWEST_CHILD_MESSAGE)]},{collectionName:CS,keyName:iO,index:[cs(Vn.CHANNEL_LATEST),cs(Vn.NEWEST_CHILD_MESSAGE)]},{collectionName:Sx,keyName:Tx}])];case 1:return[2,u.sent()]}})})},v3:function(){return y(void 0,void 0,void 0,function(){return v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:wx,keyName:Nx,index:[SR()]}])];case 1:return[2,u.sent()]}})})},v4:function(){return y(void 0,void 0,void 0,function(){return v(this,function(u){switch(u.label){case 0:return[4,l.commitSchema([{collectionName:ES,keyName:Cx,index:[Jx()]}])];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(hm).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]}})})}},NR=function(){return typeof document<"u"?document.visibilityState:"visible"},IR=function(e){function n(t){var r=t.getVisibilityState,i=r===void 0?NR: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}(La),AR=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 v(this,function(n){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(t){fetch("https://www.google.com",{method:Z.GET,mode:"no-cors"}).then(function(){return t(!0)}).catch(function(){return t(!1)})})]})})},e}(),yy=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=Z.PUT,l.path="".concat(Xe,"/").concat(encodeURIComponent(r)),l.params=ye(Ie({nickname:i,profile_url:s,profile_file:o,preferred_languages:a})),l}return T(n,e),n}(J),Ey=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}(se),MR=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=Z.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),l.params=ye({apns_device_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(J);(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)})(se);var xR=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=Z.POST,l.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),l.params=ye({gcm_reg_token:i,always_push:!0,device_os:s,device_manufacturer:o,system_push_enabled:a}),l}return T(n,e),n}(J);(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)})(se);var OR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(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)})(se);var kR=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(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)})(se);var RR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/apns"),i}return T(n,e),n}(J);(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)})(se);var LR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.DELETE,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/gcm"),i}return T(n,e),n}(J);(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)})(se);var DR=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=Z.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}(J),UR=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}(se),PR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),i}return T(n,e),n}(J),FR=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}(se),HR=function(e){function n(t){var r=t.userId,i=t.willAutoAccept,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/channel_invitation_preference"),s.params={auto_accept:i},s}return T(n,e),n}(J),jR=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}(se),BR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),$R=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}(se),GR=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=Z.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}(J),zR=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}(se),VR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),qR=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}(se),WR=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=Z.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}(J),KR=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}(se),QR=function(e){function n(t){var r=t.userId,i=t.blockedUserId,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block"),s.params={target_id:i},s}return T(n,e),n}(J);(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)})(se);var YR=function(e){function n(t){var r=t.userId,i=t.unblockedUserId,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/block/").concat(encodeURIComponent(i)),s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var ZR=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),i}return T(n,e),n}(J),XR=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}(se),JR=function(e){function n(t){var r=t.userId,i=t.pushTriggerOption,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push_preference"),s.params={push_trigger_option:i},s}return T(n,e),n}(J),eL=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}(se),tL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),i}return T(n,e),n}(J),nL=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}(se),rL=function(e){function n(t){var r=t.userId,i=t.templateName,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/push/template"),s.params={name:i},s}return T(n,e),n}(J),iL=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}(se),sL=function(e){function n(t){var r=t.userId,i=t.token,s=e.call(this)||this;return s.method=Z.GET,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends/changelogs"),s.params={token:i},s}return T(n,e),n}(J),oL=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}(se),aL=function(e){function n(t){var r=t.userId,i=t.discoveries,s=e.call(this)||this;return s.method=Z.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}(J),lL=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}(se),uL=function(e){function n(t){var r=t.userId,i=t.discoveryKeys,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friend_discoveries"),s.params={friend_discovery_keys:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var cL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Z.POST,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(J),dL=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}(se),hL=function(e){function n(t){var r=t.userId,i=t.userIds,s=e.call(this)||this;return s.method=Z.DELETE,s.path="".concat(Xe,"/").concat(encodeURIComponent(r),"/friends"),s.params={user_ids:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var fL=function(e){function n(t){var r=t.userId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),i.params={},i}return T(n,e),n}(J),pL=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}(se),_L=function(e){function n(t){var r=t.userId,i=t.allowFriendDiscovery,s=e.call(this)||this;return s.method=Z.PUT,s.path="".concat(Xe,"/").concat(r,"/allow_friend_discovery"),s.params={allow_friend_discovery:i},s}return T(n,e),n}(J);(function(e){function n(){return e!==null&&e.apply(this,arguments)||this}T(n,e)})(se);var gf,mL=function(e){function n(){var t=e.call(this)||this;return t.method=Z.GET,t.path=lC,t}return T(n,e),n}(J),gL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiContainer=new TR(r),i}return T(n,e),n}(se),vL=function(e){function n(t){var r=t.categoryId,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(lC,"/").concat(r),i}return T(n,e),n}(J),yL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emojiCategory=new US(r),i}return T(n,e),n}(se),EL=function(e){function n(t){var r=t.key,i=e.call(this)||this;return i.method=Z.GET,i.path="".concat(Z4,"/").concat(r),i}return T(n,e),n}(J),bL=function(e){function n(t,r){var i=e.call(this,t,r)||this;return i.emoji=new DS(r),i}return T(n,e),n}(se),CL=function(e){function n(){var t=e.call(this)||this;return t.method=Z.GET,t.path="".concat(X4),t}return T(n,e),n}(J),SL=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}(se);(function(e){e.DELIVERED="DELIVERED",e.CLICKED="CLICKED"})(gf||(gf={}));var du,by=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=Z.POST,d.path=eA,d.params=ye({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}(J),TL=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 AR({logger:d,connectionDelegate:{reconnect:function(){return y(i,void 0,void 0,function(){var m,b,g,_,E,S;return v(this,function(w){switch(w.label){case 0:if(m=O.of(n),b=m.sdkState,g=m.connectionManager,(_=m.sessionManager).session.hasSession)return[3,5];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,g.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,g.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 gy),[2]}})})},disconnect:function(){kt(function(){return y(i,void 0,void 0,function(){return v(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 IR({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===rt.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(m instanceof gt){if(m.code==="USEV"){var g=m.as(AS).event;if(g.category===Uc.FRIEND_DISCOVERED){var _=hf.getDataAsFriendDiscoveredEvent(n,g).friendDiscoveries;Re(function(){return y(i,void 0,void 0,function(){return v(this,function(N){return[2,h.forEach(function(A){A.onFriendsDiscovered&&A.onFriendsDiscovered(_)})]})})})}}}else if(m instanceof RC){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&&Re(function(){return y(i,void 0,void 0,function(){return v(this,function(N){return[2,h.forEach(function(A){A.onTotalUnreadMessageCountChanged&&A.onTotalUnreadMessageCountChanged({groupChannelCount:E.all,feedChannelCount:E.feed,customTypeUnreadCount:E.customTypes}),A.onTotalUnreadMessageCountUpdated&&A.onTotalUnreadMessageCountUpdated(E.all,E.customTypes)})]})})})}else m instanceof UC?(a.preference.set(i._getUserProfileCacheKey(o.userId),rm.payloadify(m.userProfile)),!((b=m.userProfile.appInfo.notificationInfo)===null||b===void 0)&&b.isEnabled&&a.preference.set(Wg(i.appId),{value:!0})):m instanceof Ul&&m.error&&m.error.isSessionInvalidatedError&&(d.debug("session revoked."),i._internalDisconnect(m.error))})}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 sC: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,g=n.localCacheConfig,_=g===void 0?new aC:g,E=n.localCacheEncryption,S=n.useAsyncStorageStore,w=S===void 0?null:S,N=n.useMMKVStorageStore,A=N===void 0?null:N,k=n.appStateToggleEnabled,I=k===void 0||k;if(!du||f){var x="su-".concat(Bs()),U=E??{encrypt:function($){return $},decrypt:function($){return $}},z=new Xx;z.level=p??As.WARN;var H=new Zo({encryption:U});u||(X_()?A?H=new Yx({MMKV:A,encryption:U}):w&&(H=new Qx({AsyncStorage:w,encryption:U}),z.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):H=new Kx({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:H,encryption:U,logger:z,localCacheEnabled:b,localCacheConfig:_,debugMode:u,appStateToggleEnabled:I});var W=[new yO,new CR],Q=new e(x,a,De(De([],Ae(s),!1),Ae(W),!1));return du||(du=Q),Q}return du},Object.defineProperty(e,"instance",{get:function(){return du},enumerable:!1,configurable:!0}),Object.defineProperty(e,"version",{get:function(){return rC},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?as.OPEN:n.isConnecting?as.CONNECTING:as.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._internalDisconnect=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return t=O.of(this._iid),r=t.connectionManager,i=t.sdkState,s=t.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),s.cancelAll(),[4,r.logout(n)];case 1:return o.sent(),[4,this.clearCachedData()];case 2:return o.sent(),i.appState="foreground",[2]}})})},e.prototype.getMemoryStoreForDebugging=function(){var n=O.of(this._iid),t=n.debugMode,r=n.cacheContext;if(t)return r.store instanceof Zo?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(sA);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=pe(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 v(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 Zo),[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 v(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!==ns.CLOSED&&i.nestdb.name===a?[3,3]:(l="sendbird@".concat(r.appId,"/").concat(n,".db"),(u=i.nestdb=new Zx({name:l,version:this._getNestDBVersion(),store:i.store,config:new Zc({dbname:l,itemSizeLimit:61440})})).on("upgrade",vy(u)),u.on("storeReplaced",function(h){i.replaceStore(h),i.localCacheEnabled=!1,u.on("upgrade",vy(u))}),[4,u.open()]);case 2:return d.sent(),this._storeInitialized=!0,s.dispatch(new NS(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 Zo||(i.replaceStore(new Zo),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 v(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 v(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 v(this,function(s){switch(s.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=Sl.of(this._iid),r=Aa.of(this._iid),t&&r?[4,Promise.all(n.map(function(o){return y(i,void 0,void 0,function(){return v(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 v(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 rm(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 v(this,function(c){switch(c.label){case 0:return Y(R("string",n)&&R("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 IS),[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 v(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(xc.CHAT)?[3,3]:(t||s.handler||(a=new cf,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 v(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(){return v(this,function(n){switch(n.label){case 0:return[4,this._internalDisconnect()];case 1:return n.sent(),[2]}})})},e.prototype.disconnectWebSocket=function(){return y(this,void 0,void 0,function(){var n,t,r;return v(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 gy))},e.prototype.setSessionHandler=function(n){Y(n instanceof cf).throw(L.invalidParameters),O.of(this._iid).sessionManager.handler=n},e.prototype.addUserEventHandler=function(n,t){Y(R("string",n)&&t instanceof Ox).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){Y(R("string",n)&&t instanceof bS).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 Lx(this._iid,n)},e.prototype.createBlockedUserListQuery=function(n){return n===void 0&&(n={}),new Px(this._iid,n)},e.prototype.createFriendListQuery=function(n){return n===void 0&&(n={}),new jx(this._iid,n)},e.prototype.createMessageSearchQuery=function(n){return new fO(this._iid,n)},e.prototype.createPollListQuery=function(n){return new XC(this._iid,M({},n))},e.prototype.createPollVoterListQuery=function(n){return new JC(this._iid,M({},n))},e.prototype.buildUserFromSerializedData=function(n){var t=pa(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 v(this,function(u){switch(u.label){case 0:return t=M(M({},wR),n),Y(function(c){return pr(c.profileImage,!0)&&R("string",c.profileUrl,!0)&&R("string",c.nickname,!0)}(t)).throw(L.invalidParameters),this.currentUser?(r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=new yy(M({userId:i.userId},t)),[4,s.send(o)]):[3,2];case 1:return a=u.sent(),l=a.as(Ey).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 v(this,function(l){switch(l.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),this.currentUser?(t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new yy({userId:r.userId,preferredLanguages:n}),[4,i.send(s)]):[3,2];case 1:return o=l.sent(),a=o.as(Ey).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 v(this,function(h){switch(h.label){case 0:if(Y(R("string",n)&&R("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Y($e(lo,t.deviceOS.platform,!0)&&R("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)||lo.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 xR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,kt(function(){return y(d,void 0,void 0,function(){return v(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 v(this,function(u){switch(u.label){case 0:if(Y(R("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 kR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,kt(function(){return y(l,void 0,void 0,function(){return v(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 v(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 LR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,kt(function(){return y(a,void 0,void 0,function(){return v(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 v(this,function(h){switch(h.label){case 0:if(Y(R("string",n)&&R("string",t==null?void 0:t.deviceManufacturer,!0)).throw(L.invalidParameters),t!=null&&t.deviceOS&&Y($e(lo,t.deviceOS.platform,!0)&&R("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)||lo.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 MR({userId:l.userId,token:n,deviceOS:s.deviceOS,deviceManufacturer:s.deviceManufacturer,systemPushEnabled:s.systemPushEnabled}),[4,u.send(c)]);case 2:return h.sent(),[4,kt(function(){return y(d,void 0,void 0,function(){return v(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 v(this,function(u){switch(u.label){case 0:if(Y(R("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 OR({userId:i.userId,token:n}),[4,s.send(o)];case 2:return a=u.sent().lastDeletedAt,[4,kt(function(){return y(l,void 0,void 0,function(){return v(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 v(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 RR({userId:r.userId}),[4,i.send(s)]):[3,3];case 1:return o=l.sent().lastDeletedAt,[4,kt(function(){return y(a,void 0,void 0,function(){return v(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,g,_,E,S,w,N;return v(this,function(A){switch(A.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=gf.DELIVERED,c=l.parseData(n),d=c.pushTrackingId,h=c.sessionTopics,f=c.sessionKey,p=c.messageId,m=c.channelKey,b=c.templateKey,g=c.notificationEventDeadline,!f||!h.includes(rf.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 by({deviceToken:S??"",pushTrackingId:d,eventType:u,messageId:p,channelKey:m,templateKey:b,notificationEventDeadline:g,allowedPushNotification:E}),f&&(w.headers["Session-Key"]=f),A.label=1;case 1:return A.trys.push([1,3,,4]),[4,a.send(w)];case 2:return A.sent(),l.markAsAcked(d,u),[3,4];case 3:throw N=A.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,g,_,E;return v(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=gf.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(rf.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];g=(t=s.deviceTokens[0])===null||t===void 0?void 0:t.token,_=new by({deviceToken:g??"",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 v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new PR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,{autoAccept:s.as(FR).autoAccept}]}})})},e.prototype.setChannelInvitationPreference=function(n){return y(this,void 0,void 0,function(){var t,r,i,s,o;return v(this,function(a){switch(a.label){case 0:return Y(R("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new HR({userId:r.userId,willAutoAccept:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,{autoAccept:o.as(jR).autoAccept}]}})})},e.prototype.getDoNotDisturb=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new BR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as($R).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 v(this,function(h){switch(h.label){case 0:return Y(R("boolean",n)&&R("number",t)&&R("number",r)&&R("number",i)&&R("number",s)&&R("string",o)).throw(L.invalidParameters),a=O.of(this._iid),l=a.sdkState,u=a.requestQueue,c=new GR({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(zR).preference]}})})},e.prototype.getSnoozePeriod=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new VR({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(qR).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 v(this,function(u){switch(u.label){case 0:return Y(R("boolean",n)&&R("number",t)&&R("number",r)).throw(L.invalidParameters),i=O.of(this._iid),s=i.sdkState,o=i.requestQueue,a=new WR({userId:s.userId,snoozeOn:n,startTs:t,endTs:r}),[4,o.send(a)];case 1:return l=u.sent(),[2,l.as(KR).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 v(this,function(m){switch(m.label){case 0:return Y(R("string",n)&&$e(In,t)).throw(L.invalidParameters),r=O.of(this._iid),i=r.sdkState,s=r.requestQueue,o=r.sessionManager,a=new DR({userId:i.userId,type:t,token:n}),[4,s.send(a)];case 1:l=m.sent(),u=l.as(UR).pushTokens;try{for(c=pe(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 v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new ZR({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(XR).pushTriggerOption]}})})},e.prototype.setPushTriggerOption=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y($e(na,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new JR({userId:r.userId,pushTriggerOption:n}),[4,i.send(s)];case 1:return[2,o.sent().as(eL).pushTriggerOption]}})})},e.prototype.getPushTemplate=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new tL({userId:t.userId}),[4,r.send(i)];case 1:return[2,s.sent().as(nL).name]}})})},e.prototype.setPushTemplate=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y($e(W_,n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new rL({userId:r.userId,templateName:n}),[4,i.send(s)];case 1:return[2,o.sent().as(iL).name]}})})},e.prototype.blockUser=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y(n instanceof Ke||R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new QR({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 v(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 v(this,function(o){switch(o.label){case 0:return Y(n instanceof Ke||R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new YR({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 v(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 v(this,function(a){switch(a.label){case 0:return Y(R("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new sL({userId:r.userId,token:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(oL).changelogs]}})})},e.prototype.getAllowFriendDiscovery=function(){return y(this,void 0,void 0,function(){var n,t,r,i,s;return v(this,function(o){switch(o.label){case 0:return n=O.of(this._iid),t=n.sdkState,r=n.requestQueue,i=new fL({userId:t.userId}),[4,r.send(i)];case 1:return s=o.sent(),[2,s.as(pL).allowFriendDiscovery]}})})},e.prototype.setAllowFriendDiscovery=function(n){return y(this,void 0,void 0,function(){var t,r,i,s;return v(this,function(o){switch(o.label){case 0:return Y(R("boolean",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new _L({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 v(this,function(a){switch(a.label){case 0:return t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new aL({userId:r.userId,discoveries:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(lL).friendDiscoveryRequestId]}})})},e.prototype.deleteFriendDiscovery=function(n){return y(this,void 0,void 0,function(){return v(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 v(this,function(o){switch(o.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new uL({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 v(this,function(a){switch(a.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new cL({userId:r.userId,userIds:n}),[4,i.send(s)];case 1:return o=a.sent(),[2,o.as(dL).users]}})})},e.prototype.deleteFriend=function(n){return y(this,void 0,void 0,function(){return v(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 v(this,function(o){switch(o.label){case 0:return Y(We("string",n)).throw(L.invalidParameters),t=O.of(this._iid),r=t.sdkState,i=t.requestQueue,s=new hL({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 v(this,function(i){switch(i.label){case 0:return n=O.of(this._iid).requestQueue,t=new mL,[4,n.send(t)];case 1:return r=i.sent(),[2,r.as(gL).emojiContainer]}})})},e.prototype.getEmojiCategory=function(n){return y(this,void 0,void 0,function(){var t,r,i;return v(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new vL({categoryId:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(yL).emojiCategory]}})})},e.prototype.getEmoji=function(n){return y(this,void 0,void 0,function(){var t,r,i;return v(this,function(s){switch(s.label){case 0:return t=O.of(this._iid).requestQueue,r=new EL({key:n}),[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(bL).emoji]}})})},e.prototype.getUIKitConfiguration=function(){return y(this,void 0,void 0,function(){var n,t,r,i;return v(this,function(s){switch(s.label){case 0:return n=O.of(this._iid),Y(n.hasExtension("sb_uikit")).throw(L.notSupportedError),t=n.requestQueue,r=new CL,[4,t.send(r)];case 1:return i=s.sent(),[2,i.as(SL).uikitConfiguration]}})})},e}();function wL(e,n){return!e||!n?!0:e.url!==n.url}function Ma(e){return e!=null&&"sendingStatus"in e}function vf(e,n="##__USER_ID_IS_NOT_PROVIDED__##"){var t;return Ma(e)?((t=e.sender)===null||t===void 0?void 0:t.userId)===n:!1}function NL(e,n){return vf(e,n)||e.isAdminMessage()?!1:e.updatedAt===0}function Cy(e){return"sendingStatus"in e?e.sendingStatus==="succeeded"?String(e.messageId):e.reqId:String(e.messageId)}function et(e){return typeof e=="boolean"}function Qa(e,n){return n.includes(e)}function IL(e){return e instanceof Set}function Sy(e){return!e||!Array.isArray(e)?!1:e.length!==0}function AL(e,n){return Object.prototype.toString.call(e)===Object.prototype.toString.call(n)}const ML=()=>{const[,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])};function Cm(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(t=>Cm(t));const n={};return Object.keys(e).forEach(t=>{const r=t.replace(/_\w/g,i=>i[1].toUpperCase());n[r]=Cm(e[t])}),n}function Ty(e,n){return e.reduce((t,r)=>{const i=n(r);return t[i]=r,t},{})}var xL=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=xL(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=wy(n.value.messages);else{const i=n.value.messages.filter(o=>{var a;if(vf(o,r)){const l=(a=t.messageMap[o.reqId])!==null&&a!==void 0?a:t.messageMap[o.messageId];if(vf(l,r)){const u=kL(l,o);return u&&(delete t.messageMap[l.reqId],delete t.messageMap[l.messageId]),u}}return!0}),s=wy(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=>NL(s,r));return n.value.clearBeforeAction?t.newMessageMap=Ty(i,Cy):(i.map(o=>o.messageId).forEach(o=>delete t.newMessageMap[o]),t.newMessageMap=Object.assign(Object.assign({},t.newMessageMap),Ty(i,Cy))),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&&(Ma(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),n.value.reqIds.forEach(i=>{const s=t[r][i];s&&(Ma(s)&&delete t[r][s.reqId],delete t[r][s.messageId])}),t}}},wy=e=>e.reduce((n,t)=>(Ma(t)?(n[t.reqId]=t,t.sendingStatus===ut.SUCCEEDED&&(n[t.messageId]=t)):n[t.messageId]=t,n),{}),kL=(e,n)=>e.sendingStatus===ut.SUCCEEDED?n.sendingStatus===ut.SUCCEEDED:e.sendingStatus!==n.sendingStatus,RL=(e=LL)=>{const[{initialized:n,loading:t,refreshing:r,messageMap:i,newMessageMap:s},o]=D.useReducer(OL,{initialized:!1,loading:!0,refreshing:!1,messageMap:{},newMessageMap:{}}),a=(b,g,_)=>{o({type:"update_messages",value:{messages:b,clearBeforeAction:g,currentUserId:_}})},l=(b,g)=>{o({type:"delete_messages",value:{messageIds:b,reqIds:g}})},u=(b,g,_)=>{o({type:"update_new_messages",value:{messages:b,clearBeforeAction:g,currentUserId:_}})},c=(b,g)=>{o({type:"delete_new_messages",value:{messageIds:b,reqIds:g}})},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}},Ny=Math.floor(Number.MAX_SAFE_INTEGER/10);function LL(e,n){let t=0,r=0;return Ma(e)&&e.sendingStatus!=="succeeded"&&(t=Ny),Ma(n)&&n.sendingStatus!=="succeeded"&&(r=Ny),e.createdAt+t-(n.createdAt+r)}var Pi=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 DL=(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 _s(i)}))};function Iy(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=Iy(u),d=D.useRef({prev:!1,next:!1}),h=ML(),f=D.useRef({initialized:!1,apiInitialized:!1,instance:null}),{initialized:p,loading:m,refreshing:b,messages:g,newMessages:_,updateMessages:E,updateNewMessages:S,deleteNewMessages:w,deleteMessages:N,updateInitialized:A,updateLoading:k,updateRefreshing:I}=RL(t==null?void 0:t.sortComparator),x=fn(B=>{var te,oe,me,re;if(!a.current||!a.current.url)return(te=l==null?void 0:l.error)===null||te===void 0?void 0:te.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:(me=(oe=o.current).markAsRead)===null||me===void 0||me.call(oe,[a.current]);break}}catch(ce){(re=l==null?void 0:l.warn)===null||re===void 0||re.call(l,"[useGroupChannelMessages/markAsReadBySource]",ce)}}),U=fn((B,te)=>{var oe,me,re,ce,de;const fe=te.filter(ve=>{var _e;return!vf(ve,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId)});if(fe.length>0)switch(B){case G.EVENT_MESSAGE_RECEIVED:case G.SYNC_MESSAGE_FILL:{!((me=(oe=o.current).shouldCountNewMessages)===null||me===void 0)&&me.call(oe)&&S(fe,!1,(re=e.currentUser)===null||re===void 0?void 0:re.userId),(de=(ce=o.current).onMessagesReceived)===null||de===void 0||de.call(ce,fe);break}}}),z=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){return new Promise(oe=>{var me,re;if(!a.current||!a.current.url)return(me=l==null?void 0:l.error)===null||me===void 0?void 0:me.call(l,"[useGroupChannelMessages] channel is required");f.current.instance&&f.current.instance.dispose(),x(),S([],!0,(re=e.currentUser)===null||re===void 0?void 0:re.userId);const ce=()=>{var fe,ve,_e;const{pendingMessages:Ee,failedMessages:Be}=(fe=f.current.instance)!==null&&fe!==void 0?fe:{};Sy(Ee)&&E(Ee,!1,(ve=e.currentUser)===null||ve===void 0?void 0:ve.userId),Sy(Be)&&E(Be,!1,(_e=e.currentUser)===null||_e===void 0?void 0:_e.userId)},de=DL(a.current,te,Object.assign(Object.assign({},o.current),{startingPoint:B}));f.current={apiInitialized:!1,initialized:!1,instance:de},de.setMessageCollectionHandler({onMessagesAdded:(fe,ve,_e)=>{var Ee;x(fe.source),U(fe.source,_e),E(_e,!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId)},onMessagesUpdated:(fe,ve,_e)=>{var Ee,Be,ze;x(fe.source),U(fe.source,_e),E(_e,!1,(Ee=e.currentUser)===null||Ee===void 0?void 0:Ee.userId),fe.source===G.EVENT_MESSAGE_UPDATED&&((ze=(Be=o.current).onMessagesUpdated)===null||ze===void 0||ze.call(Be,_e))},onMessagesDeleted:(fe,ve,_e,Ee)=>{const Be=Ee.map(V=>V.messageId),ze=Ee.filter(Ma).map(V=>V.reqId);N(Be,ze),w(Be,ze)},onChannelDeleted:(fe,ve)=>{var _e,Ee;(Ee=(_e=o.current).onChannelDeleted)===null||Ee===void 0||Ee.call(_e,ve)},onChannelUpdated:(fe,ve)=>{var _e,Ee;h(),(Ee=(_e=o.current).onChannelUpdated)===null||Ee===void 0||Ee.call(_e,ve)},onHugeGapDetected:()=>{z(Number.MAX_SAFE_INTEGER,mf.collection.message.defaultLimit)}}),de.initialize(_f.CACHE_AND_REPLACE_BY_API).onCacheResult((fe,ve)=>{var _e,Ee,Be;fe?e.isCacheEnabled&&((_e=l==null?void 0:l.error)===null||_e===void 0||_e.call(l,"[useGroupChannelMessages/onCacheResult]",fe)):ve&&((Ee=l==null?void 0:l.debug)===null||Ee===void 0||Ee.call(l,"[useGroupChannelMessages/onCacheResult]","message length:",ve.length),E(ve,!0,(Be=e.currentUser)===null||Be===void 0?void 0:Be.userId),ce(),ve.length>0&&(f.current.initialized=!0,oe()))}).onApiResult((fe,ve)=>{var _e,Ee,Be,ze,V;fe?(_e=l==null?void 0:l.warn)===null||_e===void 0||_e.call(l,"[useGroupChannelMessages/onApiResult]",fe):ve&&((Ee=l==null?void 0:l.debug)===null||Ee===void 0||Ee.call(l,"[useGroupChannelMessages/onApiResult]","message length:",ve.length),E(ve,!0,(Be=e.currentUser)===null||Be===void 0?void 0:Be.userId),o.current.startingPoint||(V=(ze=o.current).onMessagesReceived)===null||V===void 0||V.call(ze,ve),e.isCacheEnabled&&ce()),f.current.initialized=!0,f.current.apiInitialized=!0,oe()})})}));LS(e,{onUserBanned(B,te){var oe,me,re;B.isGroupChannel()&&!wL(B,a.current)&&(te.userId===((oe=e.currentUser)===null||oe===void 0?void 0:oe.userId)?(re=(me=o.current).onCurrentUserBanned)===null||re===void 0||re.call(me):h())}}),D.useLayoutEffect(()=>{const B=setTimeout(()=>Pi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(A(!1),k(!0),yield z(u,c),k(!1),A(!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 H=fn(()=>Pi(void 0,void 0,void 0,function*(){e.currentUser&&a.current&&(I(!0),yield z(Number.MAX_SAFE_INTEGER,mf.collection.message.defaultLimit),I(!1))})),W=fn(()=>Pi(void 0,void 0,void 0,function*(){var B;const te=f.current.instance;if(te!=null&&te.hasPrevious&&!d.current.prev)try{d.current.prev=!0;const oe=yield te.loadPrevious();E(oe,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.prev=!1}})),Q=fn(()=>{const{initialized:B,instance:te}=f.current;return B&&te?te.hasPrevious:!1}),$=fn(()=>Pi(void 0,void 0,void 0,function*(){var B;const te=f.current.instance;if(te!=null&&te.hasNext&&!d.current.next)try{d.current.next=!0;const oe=yield te.loadNext();E(oe,!1,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}catch{}finally{d.current.next=!1}})),Ne=fn(()=>{const{initialized:B,apiInitialized:te,instance:oe}=f.current;return te&&B&&oe?oe.hasNext:!1}),X=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendUserMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),ae=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendFileMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),ne=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise(me=>{const re=[];a.current.sendFileMessages(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onSucceeded(ce=>{var de;ce.isFileMessage()&&ce.channelUrl===a.current.url&&(E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),re.push(ce)),re.length===B.length&&me(re)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url?(E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re.push(de)):re.push(null),re.length===B.length&&me(re)})})})),Ce=fn((B,te)=>{var oe;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((me,re)=>{a.current.sendMultipleFilesMessage(B).onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),te==null||te(ce)}).onFileUploaded(()=>{h()}).onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),me(ce)}).onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),re(ce)})})}),K=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe,me;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const re=yield a.current.updateUserMessage(B,te);return re.channelUrl===a.current.url&&E([re],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),re})),ie=fn((B,te)=>Pi(void 0,void 0,void 0,function*(){var oe,me;if(!a.current||!a.current.url)throw(oe=l==null?void 0:l.error)===null||oe===void 0||oe.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");const re=yield a.current.updateFileMessage(B,te);return re.channelUrl===a.current.url&&E([re],!1,(me=e.currentUser)===null||me===void 0?void 0:me.userId),re})),ee=fn(B=>Pi(void 0,void 0,void 0,function*(){var te;if(!a.current||!a.current.url)throw(te=l==null?void 0:l.error)===null||te===void 0||te.call(l,"[useGroupChannelMessages] channel is required"),new Error("Channel is required");return new Promise((oe,me)=>{let re;B.isUserMessage()&&(re=a.current.resendMessage(B)),B.isFileMessage()&&(re=a.current.resendMessage(B)),B.isMultipleFilesMessage()&&(re=a.current.resendMessage(B)),re&&("onPending"in re&&re.onPending(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId)}),"onFileUploaded"in re&&re.onFileUploaded(()=>{h()}),"onSucceeded"in re&&re.onSucceeded(ce=>{var de;ce.channelUrl===a.current.url&&E([ce],!1,(de=e.currentUser)===null||de===void 0?void 0:de.userId),oe(ce)}),"onFailed"in re&&re.onFailed((ce,de)=>{var fe;de&&de.channelUrl===a.current.url&&E([de],!1,(fe=e.currentUser)===null||fe===void 0?void 0:fe.userId),me(ce)}))})})),ue=fn(B=>Pi(void 0,void 0,void 0,function*(){var te,oe;if(!a.current||!a.current.url)throw(te=l==null?void 0:l.error)===null||te===void 0||te.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(oe=f.current.instance)===null||oe===void 0?void 0:oe.removeFailedMessage(B.reqId)}finally{N([B.messageId],[B.reqId])}})),P=fn(()=>{var B;S([],!0,(B=e.currentUser)===null||B===void 0?void 0:B.userId)}),xe=fn(B=>Pi(void 0,void 0,void 0,function*(){var te;if(e.currentUser&&a.current){const oe=Iy(B);k(!0),E([],!0,(te=e.currentUser)===null||te===void 0?void 0:te.userId),yield z(B,oe),k(!1)}}));return{initialized:p,loading:m,refreshing:b,messages:g,newMessages:_,resetNewMessages:P,refresh:H,loadPrevious:W,hasPrevious:Q,loadNext:$,hasNext:Ne,sendUserMessage:X,sendFileMessage:ae,sendFileMessages:ne,sendMultipleFilesMessage:Ce,updateUserMessage:K,updateFileMessage:ie,resendMessage:ee,deleteMessage:ue,resetWithStartingPoint:xe,_dangerous_reducer_updateMessages:E,_dangerous_reducer_deleteMessages:N}},iv=e=>PL(e),PL=e=>e();function PS(e,n){const t=Object.assign({},e);return Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&AL(t[r],n[r])&&(typeof n[r]=="object"&&!Array.isArray(n[r])?t[r]=PS(t[r],n[r]):t[r]=n[r])}),t}const sv=()=>({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 FL(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 FS=()=>{const e=sv();return FL(e)},Ay=sv(),HL=FS();var yf=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 Sm={items:{},getItem(e){var n;return yf(this,void 0,void 0,function*(){return(n=Sm.items[e])!==null&&n!==void 0?n:null})},setItem(e,n){return yf(this,void 0,void 0,function*(){Sm.items[e]=n})}};class jL{constructor(n){this.storage=n??Sm}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 yf(this,void 0,void 0,function*(){const t=yield this.get(),r={updatedAt:n.updatedAt,configuration:PS(t.configuration,n.configuration)};return yield this.storage.setItem(this.safeKey,JSON.stringify(r)),r})}get(){return yf(this,void 0,void 0,function*(){const n={updatedAt:0,configuration:HL};try{const t=yield this.storage.getItem(this.safeKey);return t?JSON.parse(t):n}catch{return n}})}}function BL(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 $L(e,n,t){GL(e,n,t),zL(e,n,t),VL(e,n,t),qL(e,n,t)}function GL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge;!((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((_=(g=n.groupChannel)===null||g===void 0?void 0:g.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((A=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.enableReactions)&&(e.channel.enableReactions=(I=(k=t.groupChannel)===null||k===void 0?void 0:k.channel)===null||I===void 0?void 0:I.enableReactions),!((x=n.groupChannel)===null||x===void 0)&&x.channel&&et((z=(U=n.groupChannel)===null||U===void 0?void 0:U.channel)===null||z===void 0?void 0:z.enableReactions)&&(e.channel.enableReactions=(W=(H=n.groupChannel)===null||H===void 0?void 0:H.channel)===null||W===void 0?void 0:W.enableReactions),!((Q=t.groupChannel)===null||Q===void 0)&&Q.channel&&et((Ne=($=t.groupChannel)===null||$===void 0?void 0:$.channel)===null||Ne===void 0?void 0:Ne.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ae=(X=t.groupChannel)===null||X===void 0?void 0:X.channel)===null||ae===void 0?void 0:ae.enableReactionsSupergroup),!((ne=n.groupChannel)===null||ne===void 0)&&ne.channel&&et((K=(Ce=n.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.enableReactionsSupergroup)&&(e.channel.enableReactionsSupergroup=(ee=(ie=n.groupChannel)===null||ie===void 0?void 0:ie.channel)===null||ee===void 0?void 0:ee.enableReactionsSupergroup),!((ue=t.groupChannel)===null||ue===void 0)&&ue.channel&&et((xe=(P=t.groupChannel)===null||P===void 0?void 0:P.channel)===null||xe===void 0?void 0:xe.enableMention)&&(e.channel.enableMention=(te=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.enableMention),!((oe=n.groupChannel)===null||oe===void 0)&&oe.channel&&et((re=(me=n.groupChannel)===null||me===void 0?void 0:me.channel)===null||re===void 0?void 0:re.enableMention)&&(e.channel.enableMention=(de=(ce=n.groupChannel)===null||ce===void 0?void 0:ce.channel)===null||de===void 0?void 0:de.enableMention),!((fe=t.groupChannel)===null||fe===void 0)&&fe.channel&&Qa((_e=(ve=t.groupChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(Be=(Ee=t.groupChannel)===null||Ee===void 0?void 0:Ee.channel)===null||Be===void 0?void 0:Be.replyType),!((ze=n.groupChannel)===null||ze===void 0)&&ze.channel&&Qa((Se=(V=n.groupChannel)===null||V===void 0?void 0:V.channel)===null||Se===void 0?void 0:Se.replyType,["none","quote_reply","thread"])&&(e.channel.replyType=(le=(Ue=n.groupChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.replyType),!((Oe=t.groupChannel)===null||Oe===void 0)&&Oe.channel&&Qa((at=(tt=t.groupChannel)===null||tt===void 0?void 0:tt.channel)===null||at===void 0?void 0:at.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(Ye=(Pe=t.groupChannel)===null||Pe===void 0?void 0:Pe.channel)===null||Ye===void 0?void 0:Ye.threadReplySelectType),!((wt=n.groupChannel)===null||wt===void 0)&&wt.channel&&Qa((Rt=(_t=n.groupChannel)===null||_t===void 0?void 0:_t.channel)===null||Rt===void 0?void 0:Rt.threadReplySelectType,["thread","parent"])&&(e.channel.threadReplySelectType=(nn=(Lt=n.groupChannel)===null||Lt===void 0?void 0:Lt.channel)===null||nn===void 0?void 0:nn.threadReplySelectType),!((Qt=t.groupChannel)===null||Qt===void 0)&&Qt.channel&&et((Dt=(un=t.groupChannel)===null||un===void 0?void 0:un.channel)===null||Dt===void 0?void 0:Dt.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(xn=(Nt=t.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.enableVoiceMessage),!((Bt=n.groupChannel)===null||Bt===void 0)&&Bt.channel&&et((cn=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.enableVoiceMessage)&&(e.channel.enableVoiceMessage=(Pn=(Un=n.groupChannel)===null||Un===void 0?void 0:Un.channel)===null||Pn===void 0?void 0:Pn.enableVoiceMessage),!((vn=n.groupChannel)===null||vn===void 0)&&vn.channel&&IL((Ot=(Fn=n.groupChannel)===null||Fn===void 0?void 0:Fn.channel)===null||Ot===void 0?void 0:Ot.typingIndicatorTypes)&&(e.channel.typingIndicatorTypes=(rn=(On=n.groupChannel)===null||On===void 0?void 0:On.channel)===null||rn===void 0?void 0:rn.typingIndicatorTypes),!((sn=n.groupChannel)===null||sn===void 0)&&sn.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=(It=n.groupChannel)===null||It===void 0?void 0:It.channel)===null||Rn===void 0?void 0:Rn.enableFeedback),!((or=n.groupChannel)===null||or===void 0)&&or.channel&&et((En=(dn=n.groupChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.enableSuggestedReplies)&&(e.channel.enableSuggestedReplies=(Ut=(bn=n.groupChannel)===null||bn===void 0?void 0:bn.channel)===null||Ut===void 0?void 0:Ut.enableSuggestedReplies),!((Cn=n.groupChannel)===null||Cn===void 0)&&Cn.channel&&Qa((Hn=(Yt=n.groupChannel)===null||Yt===void 0?void 0:Yt.channel)===null||Hn===void 0?void 0:Hn.showSuggestedRepliesFor,["all_messages","last_message_only"])&&(e.channel.showSuggestedRepliesFor=(ar=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.showSuggestedRepliesFor),!((Le=n.groupChannel)===null||Le===void 0)&&Le.channel&&Qa((he=(F=n.groupChannel)===null||F===void 0?void 0:F.channel)===null||he===void 0?void 0:he.suggestedRepliesDirection,["vertical","horizontal"])&&(e.channel.suggestedRepliesDirection=(Ge=(Me=n.groupChannel)===null||Me===void 0?void 0:Me.channel)===null||Ge===void 0?void 0:Ge.suggestedRepliesDirection)}function zL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge,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=(_=(g=(b=n.groupChannel)===null||b===void 0?void 0:b.channel)===null||g===void 0?void 0:g.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((I=(k=(A=(N=t.groupChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.input)===null||k===void 0?void 0:k.camera)===null||I===void 0?void 0:I.enablePhoto)&&(e.channel.input.camera.enablePhoto=(H=(z=(U=(x=t.groupChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||z===void 0?void 0:z.camera)===null||H===void 0?void 0:H.enablePhoto),!(($=(Q=(W=n.groupChannel)===null||W===void 0?void 0:W.channel)===null||Q===void 0?void 0:Q.input)===null||$===void 0)&&$.camera&&et((ne=(ae=(X=(Ne=n.groupChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||ae===void 0?void 0:ae.camera)===null||ne===void 0?void 0:ne.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(ie=(K=(Ce=n.groupChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.input)===null||ie===void 0?void 0:ie.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((xe=(P=(ue=t.groupChannel)===null||ue===void 0?void 0:ue.channel)===null||P===void 0?void 0:P.input)===null||xe===void 0)&&xe.camera&&et((me=(oe=(te=(B=t.groupChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.input)===null||oe===void 0?void 0:oe.camera)===null||me===void 0?void 0:me.enableVideo)&&(e.channel.input.camera.enableVideo=(fe=(de=(ce=(re=t.groupChannel)===null||re===void 0?void 0:re.channel)===null||ce===void 0?void 0:ce.input)===null||de===void 0?void 0:de.camera)===null||fe===void 0?void 0:fe.enableVideo),!((Ee=(_e=(ve=n.groupChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.input)===null||Ee===void 0)&&Ee.camera&&et((Se=(V=(ze=(Be=n.groupChannel)===null||Be===void 0?void 0:Be.channel)===null||ze===void 0?void 0:ze.input)===null||V===void 0?void 0:V.camera)===null||Se===void 0?void 0:Se.enableVideo)&&(e.channel.input.camera.enableVideo=(tt=(Oe=(le=(Ue=n.groupChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.input)===null||Oe===void 0?void 0:Oe.camera)===null||tt===void 0?void 0:tt.enableVideo),!((Ye=(Pe=(at=t.groupChannel)===null||at===void 0?void 0:at.channel)===null||Pe===void 0?void 0:Pe.input)===null||Ye===void 0)&&Ye.gallery&&et((Lt=(Rt=(_t=(wt=t.groupChannel)===null||wt===void 0?void 0:wt.channel)===null||_t===void 0?void 0:_t.input)===null||Rt===void 0?void 0:Rt.gallery)===null||Lt===void 0?void 0:Lt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Dt=(un=(Qt=(nn=t.groupChannel)===null||nn===void 0?void 0:nn.channel)===null||Qt===void 0?void 0:Qt.input)===null||un===void 0?void 0:un.gallery)===null||Dt===void 0?void 0:Dt.enablePhoto),!((Bt=(xn=(Nt=n.groupChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.input)===null||Bt===void 0)&&Bt.gallery&&et((Pn=(Un=(cn=(ft=n.groupChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(Ot=(Fn=(vn=n.groupChannel)===null||vn===void 0?void 0:vn.channel)===null||Fn===void 0?void 0:Fn.input)===null||Ot===void 0?void 0:Ot.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(sn=(rn=t.groupChannel)===null||rn===void 0?void 0:rn.channel)===null||sn===void 0?void 0:sn.input)===null||kn===void 0)&&kn.gallery&&et((or=(Rn=(It=(yn=t.groupChannel)===null||yn===void 0?void 0:yn.channel)===null||It===void 0?void 0:It.input)===null||Rn===void 0?void 0:Rn.gallery)===null||or===void 0?void 0:or.enableVideo)&&(e.channel.input.gallery.enableVideo=(Ut=(bn=(En=(dn=t.groupChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Ut===void 0?void 0:Ut.enableVideo),!((Hn=(Yt=(Cn=n.groupChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Yt===void 0?void 0:Yt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Le=(ar=(jn=n.groupChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.input)===null||Le===void 0?void 0:Le.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(Ge=(Me=(he=n.groupChannel)===null||he===void 0?void 0:he.channel)===null||Me===void 0?void 0:Me.input)===null||Ge===void 0?void 0:Ge.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function VL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,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((_=(g=n.groupChannel)===null||g===void 0?void 0:g.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 qL(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 WL(e,n,t){KL(e,n,t),QL(e,n,t)}function KL(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 QL(e,n,t){var r,i,s,o,a,l,u,c,d,h,f,p,m,b,g,_,E,S,w,N,A,k,I,x,U,z,H,W,Q,$,Ne,X,ae,ne,Ce,K,ie,ee,ue,P,xe,B,te,oe,me,re,ce,de,fe,ve,_e,Ee,Be,ze,V,Se,Ue,le,Oe,tt,at,Pe,Ye,wt,_t,Rt,Lt,nn,Qt,un,Dt,Nt,xn,Bt,ft,cn,Un,Pn,vn,Fn,Ot,On,rn,sn,kn,yn,It,Rn,or,dn,En,bn,Ut,Cn,Yt,Hn,jn,ar,Le,F,he,Me,Ge,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=(_=(g=(b=n.openChannel)===null||b===void 0?void 0:b.channel)===null||g===void 0?void 0:g.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((I=(k=(A=(N=t.openChannel)===null||N===void 0?void 0:N.channel)===null||A===void 0?void 0:A.input)===null||k===void 0?void 0:k.camera)===null||I===void 0?void 0:I.enablePhoto)&&(e.channel.input.camera.enablePhoto=(H=(z=(U=(x=t.openChannel)===null||x===void 0?void 0:x.channel)===null||U===void 0?void 0:U.input)===null||z===void 0?void 0:z.camera)===null||H===void 0?void 0:H.enablePhoto),!(($=(Q=(W=n.openChannel)===null||W===void 0?void 0:W.channel)===null||Q===void 0?void 0:Q.input)===null||$===void 0)&&$.camera&&et((ne=(ae=(X=(Ne=n.openChannel)===null||Ne===void 0?void 0:Ne.channel)===null||X===void 0?void 0:X.input)===null||ae===void 0?void 0:ae.camera)===null||ne===void 0?void 0:ne.enablePhoto)&&(e.channel.input.camera.enablePhoto=(ee=(ie=(K=(Ce=n.openChannel)===null||Ce===void 0?void 0:Ce.channel)===null||K===void 0?void 0:K.input)===null||ie===void 0?void 0:ie.camera)===null||ee===void 0?void 0:ee.enablePhoto),!((xe=(P=(ue=t.openChannel)===null||ue===void 0?void 0:ue.channel)===null||P===void 0?void 0:P.input)===null||xe===void 0)&&xe.camera&&et((me=(oe=(te=(B=t.openChannel)===null||B===void 0?void 0:B.channel)===null||te===void 0?void 0:te.input)===null||oe===void 0?void 0:oe.camera)===null||me===void 0?void 0:me.enableVideo)&&(e.channel.input.camera.enableVideo=(fe=(de=(ce=(re=t.openChannel)===null||re===void 0?void 0:re.channel)===null||ce===void 0?void 0:ce.input)===null||de===void 0?void 0:de.camera)===null||fe===void 0?void 0:fe.enableVideo),!((Ee=(_e=(ve=n.openChannel)===null||ve===void 0?void 0:ve.channel)===null||_e===void 0?void 0:_e.input)===null||Ee===void 0)&&Ee.camera&&et((Se=(V=(ze=(Be=n.openChannel)===null||Be===void 0?void 0:Be.channel)===null||ze===void 0?void 0:ze.input)===null||V===void 0?void 0:V.camera)===null||Se===void 0?void 0:Se.enableVideo)&&(e.channel.input.camera.enableVideo=(tt=(Oe=(le=(Ue=n.openChannel)===null||Ue===void 0?void 0:Ue.channel)===null||le===void 0?void 0:le.input)===null||Oe===void 0?void 0:Oe.camera)===null||tt===void 0?void 0:tt.enableVideo),!((Ye=(Pe=(at=t.openChannel)===null||at===void 0?void 0:at.channel)===null||Pe===void 0?void 0:Pe.input)===null||Ye===void 0)&&Ye.gallery&&et((Lt=(Rt=(_t=(wt=t.openChannel)===null||wt===void 0?void 0:wt.channel)===null||_t===void 0?void 0:_t.input)===null||Rt===void 0?void 0:Rt.gallery)===null||Lt===void 0?void 0:Lt.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(Dt=(un=(Qt=(nn=t.openChannel)===null||nn===void 0?void 0:nn.channel)===null||Qt===void 0?void 0:Qt.input)===null||un===void 0?void 0:un.gallery)===null||Dt===void 0?void 0:Dt.enablePhoto),!((Bt=(xn=(Nt=n.openChannel)===null||Nt===void 0?void 0:Nt.channel)===null||xn===void 0?void 0:xn.input)===null||Bt===void 0)&&Bt.gallery&&et((Pn=(Un=(cn=(ft=n.openChannel)===null||ft===void 0?void 0:ft.channel)===null||cn===void 0?void 0:cn.input)===null||Un===void 0?void 0:Un.gallery)===null||Pn===void 0?void 0:Pn.enablePhoto)&&(e.channel.input.gallery.enablePhoto=(On=(Ot=(Fn=(vn=n.openChannel)===null||vn===void 0?void 0:vn.channel)===null||Fn===void 0?void 0:Fn.input)===null||Ot===void 0?void 0:Ot.gallery)===null||On===void 0?void 0:On.enablePhoto),!((kn=(sn=(rn=t.openChannel)===null||rn===void 0?void 0:rn.channel)===null||sn===void 0?void 0:sn.input)===null||kn===void 0)&&kn.gallery&&et((or=(Rn=(It=(yn=t.openChannel)===null||yn===void 0?void 0:yn.channel)===null||It===void 0?void 0:It.input)===null||Rn===void 0?void 0:Rn.gallery)===null||or===void 0?void 0:or.enableVideo)&&(e.channel.input.gallery.enableVideo=(Ut=(bn=(En=(dn=t.openChannel)===null||dn===void 0?void 0:dn.channel)===null||En===void 0?void 0:En.input)===null||bn===void 0?void 0:bn.gallery)===null||Ut===void 0?void 0:Ut.enableVideo),!((Hn=(Yt=(Cn=n.openChannel)===null||Cn===void 0?void 0:Cn.channel)===null||Yt===void 0?void 0:Yt.input)===null||Hn===void 0)&&Hn.gallery&&et((F=(Le=(ar=(jn=n.openChannel)===null||jn===void 0?void 0:jn.channel)===null||ar===void 0?void 0:ar.input)===null||Le===void 0?void 0:Le.gallery)===null||F===void 0?void 0:F.enableVideo)&&(e.channel.input.gallery.enableVideo=(vt=(Ge=(Me=(he=n.openChannel)===null||he===void 0?void 0:he.channel)===null||Me===void 0?void 0:Me.input)===null||Ge===void 0?void 0:Ge.gallery)===null||vt===void 0?void 0:vt.enableVideo)}function YL(e,n){const t=sv();return BL(t.common,e,n),$L(t.groupChannel,e,n),WL(t.openChannel,e,n),t}function ZL(e){return typeof e=="object"&&"configuration"in e&&"updated_at"in e}var XL=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 HS=D.createContext({initDashboardConfigs:()=>Promise.resolve(),configs:Ay,configsWithAppAttr:()=>Ay}),JL=({storage:e,children:n,localConfigs:t={}})=>{const[r,i]=D.useState(FS),[s]=D.useState(()=>new jL(e)),o=D.useCallback(u=>XL(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(ZL(d.json)){const h=Cm(d.json),f=yield s.update(h);i(f.configuration)}}catch{i(c.configuration)}}),[s]),a=YL(t,r),l=fn(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 mt.createElement(HS.Provider,{value:{initDashboardConfigs:o,configs:a,configsWithAppAttr:l}},n)},e5=()=>D.useContext(HS),jS=mt.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 xy(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!t5(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 kp(f,c)}),h.absoluteRules=h.rules.map(function(f,p){var m=h.urls[p],b=kp(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?My(m.absoluteUrls,{onBeforeSend:function(g,_,E){t.onBeforeSend(g,c,_)},onSuccess:function(g,_,E){var S=t.onSuccess(g,c,_);g=S===!1?"":S||g;var w=a(g,_,p);return w.rules.forEach(function(N,A){g=g.replace(N,w.absoluteRules[A])}),g},onError:function(g,_,E){f.push({xhr:g,url:_}),p.push(m.rules[E]),l(u,c,d,h,f,p)},onComplete:function(g){g.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 g=decodeURIComponent(d.substring(d.indexOf(",")+1));t.useCSSOM&&(g=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(g,c,u,location.href)}else My(d,{mimeType:"text/css",onBeforeSend:function(S,w,N){t.onBeforeSend(S,u,w)},onSuccess:function(S,w,N){var A=kp(d);o(S,c,u,A)},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 kp(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 t5(e,n){var t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;return t.call(e,n)}var BS=$S;function $S(e,n,t){e instanceof RegExp&&(e=Oy(e,t)),n instanceof RegExp&&(n=Oy(n,t));var r=GS(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 Oy(e,n){var t=n.match(e);return t?t[0]:null}$S.range=GS;function GS(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 ov(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,removeComments:!1},r=$r({},t,n),i=[];function s(H){throw new Error("CSS parse error: ".concat(H))}function o(H){var W=H.exec(e);if(W)return e=e.slice(W[0].length),W}function a(){return o(/^{\s*/)}function l(){return o(/^}/)}function u(){o(/^\s*/)}function c(){if(u(),!(e[0]!=="/"||e[1]!=="*")){for(var H=2;e[H]&&(e[H]!=="*"||e[H+1]!=="/");)H++;if(!e[H])return s("end of comment is missing");var W=e.slice(2,H);return e=e.slice(H+2),{type:"comment",comment:W}}}function d(){for(var H=[],W;W=c();)H.push(W);return r.removeComments?[]:H}function h(){for(u();e[0]==="}";)s("extra closing bracket");var H=o(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);if(H){var W=H[0].trim(),Q,$=/\/\*/.test(W);$&&(W=W.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,""));var Ne=/["']\w*,\w*["']/.test(W);Ne&&(W=W.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(ae){return ae.replace(/,/g,"‌")}));var X=/,/.test(W);return X?Q=W.split(/\s*(?![^(]*\)),\s*/):Q=[W],Ne&&(Q=Q.map(function(ae){return ae.replace(/\u200C/g,",")})),Q}}function f(){if(e[0]==="@")return x();o(/^([;\s]*)+/);var H=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,W=o(/^(\*?[-#/*\\\w.]+(\[[0-9a-z_-]+\])?)\s*/);if(W){if(W=W[0].trim(),!o(/^:\s*/))return s("property missing ':'");var Q=o(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/),$={type:"declaration",property:W.replace(H,""),value:Q?Q[0].replace(H,"").trim():""};return o(/^[;\s]*/),$}}function p(){if(!a())return s("missing '{'");for(var H,W=d();H=f();)W.push(H),W=W.concat(d());return l()?W:s("missing '}'")}function m(){u();for(var H=[],W;W=o(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)H.push(W[1]),o(/^,\s*/);if(H.length)return{type:"keyframe",values:H,declarations:p()}}function b(){var H=o(/^@([-\w]+)?keyframes\s*/);if(H){var W=H[1];if(H=o(/^([-\w]+)\s*/),!H)return s("@keyframes missing name");var Q=H[1];if(!a())return s("@keyframes missing '{'");for(var $,Ne=d();$=m();)Ne.push($),Ne=Ne.concat(d());return l()?{type:"keyframes",name:Q,vendor:W,keyframes:Ne}:s("@keyframes missing '}'")}}function g(){var H=o(/^@page */);if(H){var W=h()||[];return{type:"page",selectors:W,declarations:p()}}}function _(){var H=o(/@(top|bottom|left|right)-(left|center|right|top|middle|bottom)-?(corner)?\s*/);if(H){var W="".concat(H[1],"-").concat(H[2])+(H[3]?"-".concat(H[3]):"");return{type:"page-margin-box",name:W,declarations:p()}}}function E(){var H=o(/^@font-face\s*/);if(H)return{type:"font-face",declarations:p()}}function S(){var H=o(/^@supports *([^{]+)/);if(H)return{type:"supports",supports:H[1].trim(),rules:z()}}function w(){var H=o(/^@host\s*/);if(H)return{type:"host",rules:z()}}function N(){var H=o(/^@media([^{]+)*/);if(H)return{type:"media",media:(H[1]||"").trim(),rules:z()}}function A(){var H=o(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(H)return{type:"custom-media",name:H[1].trim(),media:H[2].trim()}}function k(){var H=o(/^@([-\w]+)?document *([^{]+)/);if(H)return{type:"document",document:H[2].trim(),vendor:H[1]?H[1].trim():null,rules:z()}}function I(){var H=o(/^@(import|charset|namespace)\s*([^;]+);/);if(H)return{type:H[1],name:H[2].trim()}}function x(){if(u(),e[0]==="@"){var H=I()||E()||N()||b()||S()||k()||A()||w()||g()||_();if(H&&!r.preserveStatic){var W=!1;if(H.declarations)W=H.declarations.some(function($){return/var\(/.test($.value)});else{var Q=H.keyframes||H.rules||[];W=Q.some(function($){return($.declarations||[]).some(function(Ne){return/var\(/.test(Ne.value)})})}return W?H:{}}return H}}function U(){if(!r.preserveStatic){var H=BS("{","}",e);if(H){var W=/:(?:root|host)(?![.:#(])/.test(H.pre)&&/--\S*\s*:/.test(H.body),Q=/var\(/.test(H.body);if(!W&&!Q)return e=e.slice(H.end+1),{}}}var $=h()||[],Ne=r.preserveStatic?p():p().filter(function(X){var ae=$.some(function(Ce){return/:(?:root|host)(?![.:#(])/.test(Ce)})&&/^--\S/.test(X.property),ne=/var\(/.test(X.value);return ae||ne});return $.length||s("selector missing"),{type:"rule",selectors:$,declarations:Ne}}function z(H){if(!H&&!a())return s("missing '{'");for(var W,Q=d();e.length&&(H||e[0]!=="}")&&(W=x()||U());)W.type&&Q.push(W),Q=Q.concat(d());return!H&&!l()?s("missing '}'"):Q}return{type:"stylesheet",stylesheet:{rules:z(!0),errors:i}}}function ky(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=ov(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 zS(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=ov(e,r)),VS(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=BS("(",")",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 d0=typeof window<"u",Ry=d0&&window.CSS&&window.CSS.supports&&window.CSS.supports("(--a: 0)"),Zo={group:0,job:0},Gd={rootElement:d0?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(){}},rs={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:{}},yh=!1,oi=null,Ou=0,Tm=null,wm=!1;/** + */function xy(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!t5(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 kp(f,c)}),h.absoluteRules=h.rules.map(function(f,p){var m=h.urls[p],b=kp(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?My(m.absoluteUrls,{onBeforeSend:function(g,_,E){t.onBeforeSend(g,c,_)},onSuccess:function(g,_,E){var S=t.onSuccess(g,c,_);g=S===!1?"":S||g;var w=a(g,_,p);return w.rules.forEach(function(N,A){g=g.replace(N,w.absoluteRules[A])}),g},onError:function(g,_,E){f.push({xhr:g,url:_}),p.push(m.rules[E]),l(u,c,d,h,f,p)},onComplete:function(g){g.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 g=decodeURIComponent(d.substring(d.indexOf(",")+1));t.useCSSOM&&(g=Array.apply(null,u.sheet.cssRules).map(function(E){return E.cssText}).join("")),o(g,c,u,location.href)}else My(d,{mimeType:"text/css",onBeforeSend:function(S,w,N){t.onBeforeSend(S,u,w)},onSuccess:function(S,w,N){var A=kp(d);o(S,c,u,A)},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 kp(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 t5(e,n){var t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;return t.call(e,n)}var BS=$S;function $S(e,n,t){e instanceof RegExp&&(e=Oy(e,t)),n instanceof RegExp&&(n=Oy(n,t));var r=GS(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 Oy(e,n){var t=n.match(e);return t?t[0]:null}$S.range=GS;function GS(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 ov(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={preserveStatic:!0,removeComments:!1},r=$r({},t,n),i=[];function s(H){throw new Error("CSS parse error: ".concat(H))}function o(H){var W=H.exec(e);if(W)return e=e.slice(W[0].length),W}function a(){return o(/^{\s*/)}function l(){return o(/^}/)}function u(){o(/^\s*/)}function c(){if(u(),!(e[0]!=="/"||e[1]!=="*")){for(var H=2;e[H]&&(e[H]!=="*"||e[H+1]!=="/");)H++;if(!e[H])return s("end of comment is missing");var W=e.slice(2,H);return e=e.slice(H+2),{type:"comment",comment:W}}}function d(){for(var H=[],W;W=c();)H.push(W);return r.removeComments?[]:H}function h(){for(u();e[0]==="}";)s("extra closing bracket");var H=o(/^(("(?:\\"|[^"])*"|'(?:\\'|[^'])*'|[^{])+)/);if(H){var W=H[0].trim(),Q,$=/\/\*/.test(W);$&&(W=W.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,""));var Ne=/["']\w*,\w*["']/.test(W);Ne&&(W=W.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(ae){return ae.replace(/,/g,"‌")}));var X=/,/.test(W);return X?Q=W.split(/\s*(?![^(]*\)),\s*/):Q=[W],Ne&&(Q=Q.map(function(ae){return ae.replace(/\u200C/g,",")})),Q}}function f(){if(e[0]==="@")return x();o(/^([;\s]*)+/);var H=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,W=o(/^(\*?[-#/*\\\w.]+(\[[0-9a-z_-]+\])?)\s*/);if(W){if(W=W[0].trim(),!o(/^:\s*/))return s("property missing ':'");var Q=o(/^((?:\/\*.*?\*\/|'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((\s*'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)]*?)\s*\)|[^};])+)/),$={type:"declaration",property:W.replace(H,""),value:Q?Q[0].replace(H,"").trim():""};return o(/^[;\s]*/),$}}function p(){if(!a())return s("missing '{'");for(var H,W=d();H=f();)W.push(H),W=W.concat(d());return l()?W:s("missing '}'")}function m(){u();for(var H=[],W;W=o(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)H.push(W[1]),o(/^,\s*/);if(H.length)return{type:"keyframe",values:H,declarations:p()}}function b(){var H=o(/^@([-\w]+)?keyframes\s*/);if(H){var W=H[1];if(H=o(/^([-\w]+)\s*/),!H)return s("@keyframes missing name");var Q=H[1];if(!a())return s("@keyframes missing '{'");for(var $,Ne=d();$=m();)Ne.push($),Ne=Ne.concat(d());return l()?{type:"keyframes",name:Q,vendor:W,keyframes:Ne}:s("@keyframes missing '}'")}}function g(){var H=o(/^@page */);if(H){var W=h()||[];return{type:"page",selectors:W,declarations:p()}}}function _(){var H=o(/@(top|bottom|left|right)-(left|center|right|top|middle|bottom)-?(corner)?\s*/);if(H){var W="".concat(H[1],"-").concat(H[2])+(H[3]?"-".concat(H[3]):"");return{type:"page-margin-box",name:W,declarations:p()}}}function E(){var H=o(/^@font-face\s*/);if(H)return{type:"font-face",declarations:p()}}function S(){var H=o(/^@supports *([^{]+)/);if(H)return{type:"supports",supports:H[1].trim(),rules:z()}}function w(){var H=o(/^@host\s*/);if(H)return{type:"host",rules:z()}}function N(){var H=o(/^@media([^{]+)*/);if(H)return{type:"media",media:(H[1]||"").trim(),rules:z()}}function A(){var H=o(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(H)return{type:"custom-media",name:H[1].trim(),media:H[2].trim()}}function k(){var H=o(/^@([-\w]+)?document *([^{]+)/);if(H)return{type:"document",document:H[2].trim(),vendor:H[1]?H[1].trim():null,rules:z()}}function I(){var H=o(/^@(import|charset|namespace)\s*([^;]+);/);if(H)return{type:H[1],name:H[2].trim()}}function x(){if(u(),e[0]==="@"){var H=I()||E()||N()||b()||S()||k()||A()||w()||g()||_();if(H&&!r.preserveStatic){var W=!1;if(H.declarations)W=H.declarations.some(function($){return/var\(/.test($.value)});else{var Q=H.keyframes||H.rules||[];W=Q.some(function($){return($.declarations||[]).some(function(Ne){return/var\(/.test(Ne.value)})})}return W?H:{}}return H}}function U(){if(!r.preserveStatic){var H=BS("{","}",e);if(H){var W=/:(?:root|host)(?![.:#(])/.test(H.pre)&&/--\S*\s*:/.test(H.body),Q=/var\(/.test(H.body);if(!W&&!Q)return e=e.slice(H.end+1),{}}}var $=h()||[],Ne=r.preserveStatic?p():p().filter(function(X){var ae=$.some(function(Ce){return/:(?:root|host)(?![.:#(])/.test(Ce)})&&/^--\S/.test(X.property),ne=/var\(/.test(X.value);return ae||ne});return $.length||s("selector missing"),{type:"rule",selectors:$,declarations:Ne}}function z(H){if(!H&&!a())return s("missing '{'");for(var W,Q=d();e.length&&(H||e[0]!=="}")&&(W=x()||U());)W.type&&Q.push(W),Q=Q.concat(d());return!H&&!l()?s("missing '}'"):Q}return{type:"stylesheet",stylesheet:{rules:z(!0),errors:i}}}function ky(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=ov(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 zS(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=ov(e,r)),VS(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=BS("(",")",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 d0=typeof window<"u",Ry=d0&&window.CSS&&window.CSS.supports&&window.CSS.supports("(--a: 0)"),Xo={group:0,job:0},Gd={rootElement:d0?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(){}},rs={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:{}},yh=!1,oi=null,Ou=0,Tm=null,wm=!1;/** * Fetches, parses, and transforms CSS custom properties from specified * - +