@streamlayer/react 1.8.5 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/useStreamLayerApp2.js +2 -2
- package/lib/dist/cjs/masters.js +2 -2
- package/lib/dist/es/masters.js +607 -607
- package/lib/es/useStreamLayerApp2.js +13 -13
- package/package.json +13 -13
package/lib/dist/cjs/masters.js
CHANGED
|
@@ -195,7 +195,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
195
195
|
--header-offset: 76px;
|
|
196
196
|
`}`;const Eq="m1ojpy2l",PC=({children:n,style:a})=>w.jsx("div",{className:"StreamLayerSDKTheme",children:w.jsx("div",{className:Eq,style:a,children:n})}),_q=({sdk:n,className:a,scrollStore:o,appNode:l,scrollNode:c,responsiveStore:p})=>{const[,f]=sU(n);return w.jsx(Cz,{className:a,scrollNode:c,appNode:l,scrollStore:o,feature:f,responsiveStore:p,sdk:n})},Iq=({sdk:n,className:a,appNode:o,responsiveStore:l})=>{const c=Ut(n.featuresList.getStore());return c?Array.from(c,p=>{const f=n.getFeature(p);return f?w.jsx(Ez,{className:a,appNode:o,feature:f,responsiveStore:l,sdk:n},p):null}):null},Nq=({sdk:n,overlays:a,children:o})=>{const l=Q.useRef(null),c=Q.useRef(null),[p]=Sq(l),[f,y]=qA(l,p),{sdkEnabled:b,sdkReady:C,activeOverlay:_,activateAndLoadOverlay:N,activateEventWithId:L,deactivate:R,isLogged:P}=kq(n);S5(l,{enabled:b,event:"click",listener:iU}),S5(f,{enabled:b,event:"scrollend",listener:lU,useDomNode:!0}),S5(f,{enabled:b,event:"click",listener:uU,useDomNode:!0});const V=Q.useMemo(()=>({sdk:n}),[n]);return Q.useEffect(()=>{Promise.resolve().then(()=>require("./gamification-feature.js"))},[]),w.jsx(dC.Provider,{value:V,children:w.jsxs(nA,{ref:l,children:[b&&w.jsx(zz,{ref:c,sdkReady:C,activeOverlay:_,className:Gh,setActiveOverlay:F=>N("",F),scrollToTop:()=>{var F;return(F=f.current)==null?void 0:F.scrollTo(0,0)},responsiveStore:p}),w.jsxs(aA,{className:"sl-hide-on-modal",ref:f,"data-nav":b.toString(),children:[C&&w.jsx(bq,{sdk:n,scrollNode:f,headerNode:c,appNode:l,scrollStore:y,responsiveStore:p}),w.jsx("div",{style:!b||_===Qi?{}:{display:"none"},children:o&&o({activateEventWithId:L,deactivate:R})}),a&&_===Fz&&a[_],C&&_===Tu&&w.jsx(_q,{scrollStore:y,responsiveStore:p,scrollNode:f,appNode:l,className:Gh,sdk:n}),C&&w.jsx(Iq,{responsiveStore:p,appNode:l,className:Gh,sdk:n})]}),b&&!P&&w.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:"You are not logged in."})]})})},Rq=x("div")({name:"PointsContainer",class:"psiob9b",propsAsIs:!1}),Lq=x("div")({name:"PointsIcon",class:"p1gqe4lh",propsAsIs:!1}),Oq=()=>wt,Aq=x(Oq())({name:"PointsSvg",class:"p15syg2y",propsAsIs:!0}),xq=x("div")({name:"PointsBody",class:"p12n4f2h",propsAsIs:!1}),Pq=x("div")({name:"PointsTitle",class:"poqmx89",propsAsIs:!1}),Mq=x("div")({name:"PointsValue",class:"prj9b3v",propsAsIs:!1}),Dq=({points:n,onClick:a})=>w.jsxs(Rq,{className:Gh,onClick:a,children:[w.jsx(Lq,{children:w.jsx(Aq,{name:"icon-trophy"})}),w.jsxs(xq,{children:[w.jsx(Pq,{children:"Total points"}),w.jsx(Mq,{children:w.jsx(_6,{value:n})})]})]}),Uq=({gamification:n})=>{const a=n.userSummary.$store,[o,l]=Q.useState(0);return Q.useEffect(()=>{const c=a.subscribe(p=>{var f;(f=p==null?void 0:p.summary)!=null&&f.points&&l(p.summary.points)});return()=>{c()}},[a]),w.jsx(Dq,{points:o,onClick:()=>{n.status.get()===Zc.Suspended&&n.openFeature()}})},Fq=({sdk:n})=>{if(!Ut(n.featuresList.getStore()))return null;const a=n.getFeature(yt.GAMES);return a?w.jsx(Uq,{gamification:a}):null},Vq=Q.createContext({sdk:null,topNavigation:!1}),jq=()=>Q.useContext(Vq);Q.lazy(()=>Promise.resolve().then(()=>require("./gamification-feature2.js")));let k9=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((a,o)=>(o&=63,o<36?a+=o.toString(36):o<62?a+=(o-26).toString(36).toUpperCase():o>62?a+="-":a+="_",a),"");var st;(function(n){n[n.Canceled=1]="Canceled",n[n.Unknown=2]="Unknown",n[n.InvalidArgument=3]="InvalidArgument",n[n.DeadlineExceeded=4]="DeadlineExceeded",n[n.NotFound=5]="NotFound",n[n.AlreadyExists=6]="AlreadyExists",n[n.PermissionDenied=7]="PermissionDenied",n[n.ResourceExhausted=8]="ResourceExhausted",n[n.FailedPrecondition=9]="FailedPrecondition",n[n.Aborted=10]="Aborted",n[n.OutOfRange=11]="OutOfRange",n[n.Unimplemented=12]="Unimplemented",n[n.Internal=13]="Internal",n[n.Unavailable=14]="Unavailable",n[n.DataLoss=15]="DataLoss",n[n.Unauthenticated=16]="Unauthenticated"})(st||(st={}));function Lk(n){const a=st[n];return typeof a!="string"?n.toString():a[0].toLowerCase()+a.substring(1).replace(/[A-Z]/g,o=>"_"+o.toLowerCase())}class zt extends Error{constructor(a,o=st.Unknown,l,c,p){super(Bq(a,o)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=a,this.code=o,this.metadata=new Headers(l??{}),this.details=c??[],this.cause=p}static from(a,o=st.Unknown){return a instanceof zt?a:a instanceof Error?a.name=="AbortError"?new zt(a.message,st.Canceled):new zt(a.message,o,void 0,void 0,a):new zt(String(a),o,void 0,void 0,a)}static[Symbol.hasInstance](a){return a instanceof Error?Object.getPrototypeOf(a)===zt.prototype?!0:a.name==="ConnectError"&&"code"in a&&typeof a.code=="number"&&"metadata"in a&&"details"in a&&Array.isArray(a.details)&&"rawMessage"in a&&typeof a.rawMessage=="string"&&"cause"in a:!1}findDetails(a){const o="typeName"in a?{findMessage:c=>c===a.typeName?a:void 0}:a,l=[];for(const c of this.details){if("getType"in c){o.findMessage(c.getType().typeName)&&l.push(c);continue}const p=o.findMessage(c.type);if(p)try{l.push(p.fromBinary(c.value))}catch{}}return l}}function Bq(n,a){return n.length?`[${Lk(a)}] ${n}`:`[${Lk(a)}]`}function $q(n,a,o){try{const l=G9.dec(n);return a?a.fromBinary(l,o):l}catch(l){throw zt.from(l,st.DataLoss)}}function zq(n,a){const o={};for(const[l,c]of Object.entries(n.methods)){const p=a(Object.assign(Object.assign({},c),{localName:l,service:n}));p!=null&&(o[l]=p)}return o}const Ok=1;function Ak(n){let a,o=new Uint8Array(0);function l(c){const p=new Uint8Array(o.length+c.length);p.set(o),p.set(c,o.length),o=p}return new ReadableStream({start(){a=n.getReader()},async pull(c){let p;for(;;){if(p===void 0&&o.byteLength>=5){let b=0;for(let C=1;C<5;C++)b=(b<<8)+o[C];p={flags:o[0],length:b}}if(p!==void 0&&o.byteLength>=p.length+5)break;const y=await a.read();if(y.done)break;l(y.value)}if(p===void 0){if(o.byteLength==0){c.close();return}c.error(new zt("premature end of stream",st.DataLoss));return}const f=o.subarray(5,5+p.length);o=o.subarray(5+p.length),c.enqueue({flags:p.flags,data:f})}})}function xk(n,a){const o=new Uint8Array(a.length+5);o.set(a,5);const l=new DataView(o.buffer,o.byteOffset,o.byteLength);return l.setUint8(0,n),l.setUint32(1,a.length),o}var Hq=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=n[Symbol.asyncIterator],o;return a?a.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o);function l(p){o[p]=n[p]&&function(f){return new Promise(function(y,b){f=n[p](f),c(y,b,f.done,f.value)})}}function c(p,f,y,b){Promise.resolve(b).then(function(C){p({value:C,done:y})},f)}},u2=function(n){return this instanceof u2?(this.v=n,this):new u2(n)},Gq=function(n,a,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l=o.apply(n,a||[]),c,p=[];return c={},y("next"),y("throw"),y("return",f),c[Symbol.asyncIterator]=function(){return this},c;function f(R){return function(P){return Promise.resolve(P).then(R,N)}}function y(R,P){l[R]&&(c[R]=function(V){return new Promise(function(F,j){p.push([R,V,F,j])>1||b(R,V)})},P&&(c[R]=P(c[R])))}function b(R,P){try{C(l[R](P))}catch(V){L(p[0][3],V)}}function C(R){R.value instanceof u2?Promise.resolve(R.value.v).then(_,N):L(p[0][2],R)}function _(R){b("next",R)}function N(R){b("throw",R)}function L(R,P){R(P),p.shift(),p.length&&b(p[0][0],p[0][1])}},qq=function(n){var a,o;return a={},l("next"),l("throw",function(c){throw c}),l("return"),a[Symbol.iterator]=function(){return this},a;function l(c,p){a[c]=n[c]?function(f){return(o=!o)?{value:u2(n[c](f)),done:!1}:p?p(f):f}:p}};function Wq(n){return Gq(this,arguments,function*(){yield u2(yield*qq(Hq(n)))})}var MC=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=n[Symbol.asyncIterator],o;return a?a.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o);function l(p){o[p]=n[p]&&function(f){return new Promise(function(y,b){f=n[p](f),c(y,b,f.done,f.value)})}}function c(p,f,y,b){Promise.resolve(b).then(function(C){p({value:C,done:y})},f)}},vm=function(n){return this instanceof vm?(this.v=n,this):new vm(n)},Qq=function(n){var a,o;return a={},l("next"),l("throw",function(c){throw c}),l("return"),a[Symbol.iterator]=function(){return this},a;function l(c,p){a[c]=n[c]?function(f){return(o=!o)?{value:vm(n[c](f)),done:!1}:p?p(f):f}:p}},Yq=function(n,a,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l=o.apply(n,a||[]),c,p=[];return c={},y("next"),y("throw"),y("return",f),c[Symbol.asyncIterator]=function(){return this},c;function f(R){return function(P){return Promise.resolve(P).then(R,N)}}function y(R,P){l[R]&&(c[R]=function(V){return new Promise(function(F,j){p.push([R,V,F,j])>1||b(R,V)})},P&&(c[R]=P(c[R])))}function b(R,P){try{C(l[R](P))}catch(V){L(p[0][3],V)}}function C(R){R.value instanceof vm?Promise.resolve(R.value.v).then(_,N):L(p[0][2],R)}function _(R){b("next",R)}function N(R){b("throw",R)}function L(R,P){R(P),p.shift(),p.length&&b(p[0][0],p[0][1])}};function Pk(n,a){return zq(n,o=>{switch(o.kind){case je.Unary:return Kq(a,n,o);case je.ServerStreaming:return Zq(a,n,o);case je.ClientStreaming:return Xq(a,n,o);case je.BiDiStreaming:return Jq(a,n,o);default:return null}})}function Kq(n,a,o){return async function(l,c){var p,f;const y=await n.unary(a,o,c==null?void 0:c.signal,c==null?void 0:c.timeoutMs,c==null?void 0:c.headers,l,c==null?void 0:c.contextValues);return(p=c==null?void 0:c.onHeader)===null||p===void 0||p.call(c,y.header),(f=c==null?void 0:c.onTrailer)===null||f===void 0||f.call(c,y.trailer),y.message}}function Zq(n,a,o){return function(l,c){return DC(n.stream(a,o,c==null?void 0:c.signal,c==null?void 0:c.timeoutMs,c==null?void 0:c.headers,Wq([l]),c==null?void 0:c.contextValues),c)}}function Xq(n,a,o){return async function(l,c){var p,f,y,b,C,_;const N=await n.stream(a,o,c==null?void 0:c.signal,c==null?void 0:c.timeoutMs,c==null?void 0:c.headers,l,c==null?void 0:c.contextValues);(C=c==null?void 0:c.onHeader)===null||C===void 0||C.call(c,N.header);let L,R=0;try{for(var P=!0,V=MC(N.message),F;F=await V.next(),p=F.done,!p;P=!0)b=F.value,P=!1,L=b,R++}catch(j){f={error:j}}finally{try{!P&&!p&&(y=V.return)&&await y.call(V)}finally{if(f)throw f.error}}if(!L)throw new zt("protocol error: missing response message",st.Unimplemented);if(R>1)throw new zt("protocol error: received extra messages for client streaming method",st.Unimplemented);return(_=c==null?void 0:c.onTrailer)===null||_===void 0||_.call(c,N.trailer),L}}function Jq(n,a,o){return function(l,c){return DC(n.stream(a,o,c==null?void 0:c.signal,c==null?void 0:c.timeoutMs,c==null?void 0:c.headers,l,c==null?void 0:c.contextValues),c)}}function DC(n,a){const o=function(){return Yq(this,arguments,function*(){var l,c;const p=yield vm(n);(l=a==null?void 0:a.onHeader)===null||l===void 0||l.call(a,p.header),yield vm(yield*Qq(MC(p.message))),(c=a==null?void 0:a.onTrailer)===null||c===void 0||c.call(a,p.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>o.next()})}}function eW(...n){const a=new AbortController,o=n.filter(c=>c!==void 0).concat(a.signal);for(const c of o){if(c.aborted){l.apply(c);break}c.addEventListener("abort",l)}function l(){a.signal.aborted||a.abort(UC(this));for(const c of o)c.removeEventListener("abort",l)}return a}function tW(n){const a=new AbortController,o=()=>{a.abort(new zt("the operation timed out",st.DeadlineExceeded))};let l;return n!==void 0&&(n<=0?o():l=setTimeout(o,n)),{signal:a.signal,cleanup:()=>clearTimeout(l)}}function UC(n){if(!n.aborted)return;if(n.reason!==void 0)return n.reason;const a=new Error("This operation was aborted");return a.name="AbortError",a}function S9(){return{get(n){return n.id in this?this[n.id]:n.defaultValue},set(n,a){return this[n.id]=a,this},delete(n){return delete this[n.id],this}}}function u6(n,a){return{id:Symbol(a==null?void 0:a.description),defaultValue:n}}const A5=128;function Mk(n){const a=new Headers,o=new TextDecoder().decode(n).split(`\r
|
|
197
197
|
`);for(const l of o){if(l==="")continue;const c=l.indexOf(":");if(c>0){const p=l.substring(0,c).trim(),f=l.substring(c+1).trim();a.append(p,f)}}return a}const nW="Content-Type",aW="Grpc-Timeout",Tm="Grpc-Status",FC="Grpc-Message",rW="Grpc-Status-Details-Bin",oW="X-User-Agent",sW="X-Grpc-Web",iW="application/grpc-web+proto",lW="application/grpc-web+json";class tl extends m2{constructor(a){super(),this.code=0,this.message="",this.details=[],k.util.initPartial(a,this)}static fromBinary(a,o){return new tl().fromBinary(a,o)}static fromJson(a,o){return new tl().fromJson(a,o)}static fromJsonString(a,o){return new tl().fromJsonString(a,o)}static equals(a,o){return k.util.equals(tl,a,o)}}tl.runtime=k;tl.typeName="google.rpc.Status";tl.fields=k.util.newFieldList(()=>[{no:1,name:"code",kind:"scalar",T:5},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"details",kind:"message",T:Js,repeated:!0}]);const uW="0";function VC(n){var a;const o=n.get(rW);if(o!=null){const c=$q(o,tl);if(c.code==0)return;const p=new zt(c.message,c.code,n);return p.details=c.details.map(f=>({type:f.typeUrl.substring(f.typeUrl.lastIndexOf("/")+1),value:f.value})),p}const l=n.get(Tm);if(l!=null){if(l===uW)return;const c=parseInt(l,10);return c in st?new zt(decodeURIComponent((a=n.get(FC))!==null&&a!==void 0?a:""),c,n):new zt(`invalid grpc-status: ${l}`,st.Internal,n)}}function Dk(n,a,o){const l=typeof a=="string"?a:a.typeName,c=typeof o=="string"?o:o.name;return n.toString().replace(/\/?$/,`/${l}/${c}`)}function jC(n,a){return a instanceof n?a:new n(a)}function cW(n,a){function o(l){return l.done===!0?l:{done:l.done,value:jC(n,l.value)}}return{[Symbol.asyncIterator](){const l=a[Symbol.asyncIterator](),c={next:()=>l.next().then(o)};return l.throw!==void 0&&(c.throw=p=>l.throw(p).then(o)),l.return!==void 0&&(c.return=p=>l.return(p).then(o)),c}}}function BC(n,a){var o;return(o=a==null?void 0:a.concat().reverse().reduce((l,c)=>c(l),n))!==null&&o!==void 0?o:n}function dW(n){var a;const o=Object.assign({},n);return(a=o.ignoreUnknownFields)!==null&&a!==void 0||(o.ignoreUnknownFields=!0),o}function Uk(n,a,o,l){const c=a?Fk(n.I,l):Vk(n.I,o);return{parse:(a?Fk(n.O,l):Vk(n.O,o)).parse,serialize:c.serialize}}function Fk(n,a){return{parse(o){try{return n.fromBinary(o,a)}catch(l){const c=l instanceof Error?l.message:String(l);throw new zt(`parse binary: ${c}`,st.Internal)}},serialize(o){try{return o.toBinary(a)}catch(l){const c=l instanceof Error?l.message:String(l);throw new zt(`serialize binary: ${c}`,st.Internal)}}}}function Vk(n,a){var o,l;const c=(o=a==null?void 0:a.textEncoder)!==null&&o!==void 0?o:new TextEncoder,p=(l=a==null?void 0:a.textDecoder)!==null&&l!==void 0?l:new TextDecoder,f=dW(a);return{parse(y){try{const b=p.decode(y);return n.fromJsonString(b,f)}catch(b){throw zt.from(b,st.InvalidArgument)}},serialize(y){try{const b=y.toJsonString(f);return c.encode(b)}catch(b){throw zt.from(b,st.Internal)}}}}function mW(n){const a=BC(n.next,n.interceptors),[o,l,c]=$C(n),p=Object.assign(Object.assign({},n.req),{message:jC(n.req.method.I,n.req.message),signal:o});return a(p).then(f=>(c(),f),l)}function fW(n){const a=BC(n.next,n.interceptors),[o,l,c]=$C(n),p=Object.assign(Object.assign({},n.req),{message:cW(n.req.method.I,n.req.message),signal:o});let f=!1;return o.addEventListener("abort",function(){var y,b;const C=n.req.message[Symbol.asyncIterator]();f||(y=C.throw)===null||y===void 0||y.call(C,this.reason).catch(()=>{}),(b=C.return)===null||b===void 0||b.call(C).catch(()=>{})}),a(p).then(y=>Object.assign(Object.assign({},y),{message:{[Symbol.asyncIterator](){const b=y.message[Symbol.asyncIterator]();return{next(){return b.next().then(C=>(C.done==!0&&(f=!0,c()),C),l)}}}}}),l)}function $C(n){const{signal:a,cleanup:o}=tW(n.timeoutMs),l=eW(n.signal,a);return[l.signal,function(p){const f=zt.from(a.aborted?UC(a):p);return l.abort(f),o(),Promise.reject(f)},function(){o(),l.abort()}]}function pW(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}}function jk(n,a){const o=VC(n);if(o)throw a.forEach((l,c)=>{o.metadata.append(c,l)}),o;if(!a.has(Tm)&&!n.has(Tm))throw new zt("protocol error: missing status",st.Internal)}function Bk(n,a,o,l){const c=new Headers(o??{});return c.set(nW,n?iW:lW),c.set(sW,"1"),c.set(oW,"connect-es/1.5.0"),a!==void 0&&c.set(aW,`${a}m`),c}function hW(n){switch(n){case 400:return st.Internal;case 401:return st.Unauthenticated;case 403:return st.PermissionDenied;case 404:return st.Unimplemented;case 429:return st.Unavailable;case 502:return st.Unavailable;case 503:return st.Unavailable;case 504:return st.Unavailable;default:return st.Unknown}}function $k(n,a){var o;if(n>=200&&n<300)return{foundStatus:a.has(Tm),headerError:VC(a)};throw new zt(decodeURIComponent((o=a.get(FC))!==null&&o!==void 0?o:`HTTP ${n}`),hW(n),a)}var Qc=function(n){return this instanceof Qc?(this.v=n,this):new Qc(n)},gW=function(n,a,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l=o.apply(n,a||[]),c,p=[];return c={},y("next"),y("throw"),y("return",f),c[Symbol.asyncIterator]=function(){return this},c;function f(R){return function(P){return Promise.resolve(P).then(R,N)}}function y(R,P){l[R]&&(c[R]=function(V){return new Promise(function(F,j){p.push([R,V,F,j])>1||b(R,V)})},P&&(c[R]=P(c[R])))}function b(R,P){try{C(l[R](P))}catch(V){L(p[0][3],V)}}function C(R){R.value instanceof Qc?Promise.resolve(R.value.v).then(_,N):L(p[0][2],R)}function _(R){b("next",R)}function N(R){b("throw",R)}function L(R,P){R(P),p.shift(),p.length&&b(p[0][0],p[0][1])}};function zk(n){var a;pW();const o=(a=n.useBinaryFormat)!==null&&a!==void 0?a:!0;return{async unary(l,c,p,f,y,b,C){var _;const{serialize:N,parse:L}=Uk(c,o,n.jsonOptions,n.binaryOptions);return f=f===void 0?n.defaultTimeoutMs:f<=0?void 0:f,await mW({interceptors:n.interceptors,signal:p,timeoutMs:f,req:{stream:!1,service:l,method:c,url:Dk(n.baseUrl,l,c),init:{method:"POST",credentials:(_=n.credentials)!==null&&_!==void 0?_:"same-origin",redirect:"error",mode:"cors"},header:Bk(o,f,y),contextValues:C??S9(),message:b},next:async R=>{var P;const F=await((P=n.fetch)!==null&&P!==void 0?P:globalThis.fetch)(R.url,Object.assign(Object.assign({},R.init),{headers:R.header,signal:R.signal,body:xk(0,N(R.message))})),{headerError:j}=$k(F.status,F.headers);if(!F.body)throw j!==void 0?j:"missing response body";const q=Ak(F.body).getReader();let Y,J;for(;;){const ne=await q.read();if(ne.done)break;const{flags:ue,data:oe}=ne.value;if((ue&Ok)===Ok)throw new zt("protocol error: received unsupported compressed output",st.Internal);if(ue===A5){if(Y!==void 0)throw"extra trailer";Y=Mk(oe);continue}if(J!==void 0)throw new zt("extra message",st.Unimplemented);J=L(oe)}if(Y===void 0)throw j!==void 0?j:new zt("missing trailer",F.headers.has(Tm)?st.Unimplemented:st.Unknown);if(jk(Y,F.headers),J===void 0)throw new zt("missing message",Y.has(Tm)?st.Unimplemented:st.Unknown);return{stream:!1,service:l,method:c,header:F.headers,message:J,trailer:Y}}})},async stream(l,c,p,f,y,b,C){var _;const{serialize:N,parse:L}=Uk(c,o,n.jsonOptions,n.binaryOptions);function R(V,F,j,q,Y,J){return gW(this,arguments,function*(){const ue=Ak(V).getReader();if(F){if(!(yield Qc(ue.read())).done)throw"extra data for trailers-only";return yield Qc(void 0)}let oe=!1;for(;;){const Le=yield Qc(ue.read());if(Le.done)break;const{flags:Ee,data:et}=Le.value;if((Ee&A5)===A5){if(oe)throw"extra trailer";oe=!0;const Be=Mk(et);jk(Be,q),Be.forEach((qe,Ie)=>j.set(Ie,qe));continue}if(oe)throw"extra message";yield yield Qc(L(et))}if("throwIfAborted"in J&&J.throwIfAborted(),!oe)throw Y||"missing trailer"})}async function P(V){if(c.kind!=je.ServerStreaming)throw"The fetch API does not support streaming request bodies";const F=await V[Symbol.asyncIterator]().next();if(F.done==!0)throw"missing request message";return xk(0,N(F.value))}return f=f===void 0?n.defaultTimeoutMs:f<=0?void 0:f,fW({interceptors:n.interceptors,signal:p,timeoutMs:f,req:{stream:!0,service:l,method:c,url:Dk(n.baseUrl,l,c),init:{method:"POST",credentials:(_=n.credentials)!==null&&_!==void 0?_:"same-origin",redirect:"error",mode:"cors"},header:Bk(o,f,y),contextValues:C??S9(),message:b},next:async V=>{var F;const q=await((F=n.fetch)!==null&&F!==void 0?F:globalThis.fetch)(V.url,Object.assign(Object.assign({},V.init),{headers:V.header,signal:V.signal,body:await P(V.message)})),{foundStatus:Y,headerError:J}=$k(q.status,q.headers);if(!q.body)throw J??"missing response body";const ne=new Headers;return Object.assign(Object.assign({},V),{header:q.headers,trailer:ne,message:R(q.body,Y,ne,q.headers,J,V.signal)})}})}}}let yW=()=>({emit(n,...a){let o=this.events[n]||[];for(let l=0,c=o.length;l<c;l++)o[l](...a)},events:{},on(n,a){var o;return(o=this.events[n])!=null&&o.push(a)||(this.events[n]=[a]),()=>{var l;this.events[n]=(l=this.events[n])==null?void 0:l.filter(c=>a!==c)}}});const Hk=({cache:n=new Map,fetcher:a,...o}={})=>{const l=yW();let c=!0;Yk("visibilitychange",()=>{c=!document.hidden,c&&l.emit(qk)}),Yk("online",()=>l.emit(Wk));const p=new Map,f=new Map,y=new Map;let b={};const C=async([j,q],Y,J,ne)=>{var ue;if(!c)return;const oe=Ie=>{Y.key===j&&(Y.set(Ie),l.emit(x5,j,Ie,!0))},Le=()=>{oe({...Y.value,...Zk,promise:y.get(j)})},{dedupeTime:Ee=4e3,fetcher:et}={...J,...b},Be=Kk();if(y.has(j)){Y.value.loading||Le();return}if(!ne){const Ie=n.get(j);Ie&&Y.value.data!==Ie&&oe({data:Ie,...vu});const Ze=f.get(j);if(Ze&&Ze+Ee>Be)return}const qe=VO();try{const Ie=et(...q);f.set(j,Be),y.set(j,Ie),Le();const Ze=await Ie;n.set(j,Ze),oe({data:Ze,...vu}),f.set(j,Kk())}catch(Ie){(ue=J.onError)==null||ue.call(J,Ie),oe({data:Y.value.data,error:Ie,...vu})}finally{qe(),y.delete(j)}},_=(j,{fetcher:q=a,...Y}={})=>{const J=n9({...vu}),ne={...o,...Y,fetcher:q};J._=zC,J.invalidate=()=>{const{key:Ze}=J;Ze&&R(Ze)},J.mutate=Ze=>{const{key:mt}=J;mt&&P(mt,Ze)};let ue,oe,Le,Ee,et,Be=[];zO(J,()=>{const Ze=!ue;[et,ue]=vW(j),Ee=et.subscribe(Se=>{if(Se){const[ct,z]=Se;J.key=ct,C([ct,z],J,ne),oe=ct,Le=z}else J.key=oe=Le=void 0,J.set({...vu})});const mt=et.get();mt&&([oe,Le]=mt,Ze&&qe());const{refetchInterval:Rt=0,refetchOnFocus:Wn,refetchOnReconnect:be}=ne,Pe=()=>{oe&&C([oe,Le],J,ne)};Rt>0&&p.set(j,setInterval(Pe,Rt)),Wn&&Be.push(l.on(qk,Pe)),be&&Be.push(l.on(Wk,Pe)),Be.push(l.on(Qk,Se=>{oe&&P5(oe,Se)&&C([oe,Le],J,ne,!0)}),l.on(x5,(Se,ct,z)=>{oe&&P5(oe,Se)&&J.value!==ct&&J.value.data!==ct&&J.set(z?ct:{data:ct,...vu})}))});const qe=()=>{oe&&Le&&C([oe,Le],J,ne)},Ie=J.listen;return J.listen=Ze=>{const mt=Ie(Ze);return Ze(J.value),qe(),mt},HO(J,()=>{J.value={...vu},ue==null||ue(),Be.forEach(Ze=>Ze()),Be=[],Ee==null||Ee(),clearInterval(p.get(j))}),J},N=j=>{n.delete(j),f.delete(j)},L=(j,q)=>{for(const Y of n.keys())P5(Y,j)&&q(Y)},R=j=>{L(j,N),l.emit(Qk,j)},P=(j,q)=>{L(j,Y=>{q===void 0?N(Y):n.set(Y,q)}),l.emit(x5,j,q)};function V(j){const q=async J=>{var ne;const ue=b.fetcher??j,oe=[];try{Y.set({error:void 0,data:void 0,mutate:q,...Zk});const Le=await ue({data:J,invalidate:Ee=>{oe.push(Ee)},getCacheUpdater:(Ee,et=!0)=>[Be=>{P(Ee,Be),et&&oe.push(Ee)},n.get(Ee)]});return Y.setKey("data",Le),Le}catch(Le){(ne=o==null?void 0:o.onError)==null||ne.call(o,Le),Y.setKey("error",Le)}finally{Y.setKey("loading",!1),oe.forEach(R)}},Y=n9({mutate:q,...vu});return Y.mutate=q,Y}return[_,V,{__unsafeOverruleSettings:j=>{console.warn("You should only use __unsafeOverruleSettings in test environment"),b=j},invalidateKeys:R,mutateCache:P}]};function Gk(n){return typeof n=="string"||typeof n=="number"||n===!0}const vW=n=>{if(Gk(n))return[ku([""+n,[n]]),()=>{}];let a=ku(null),o=[];const l=()=>{o.some(p=>p==null||p===!1)?a.set(null):a.set([o.join(""),o])},c=[];for(let p=0;p<n.length;p++){const f=n[p];Gk(f)?o.push(f):c.push(f.subscribe(y=>{o[p]=TW(f)?f.value&&"data"in f.value?f.key:null:y,l()}))}return l(),[a,()=>c.forEach(p=>p())]};function TW(n){return n._===zC}const qk=1,Wk=2,Qk=3,x5=4,Yk=(n,a)=>{typeof window>"u"||addEventListener(n,a)},P5=(n,a)=>Array.isArray(a)?a.includes(n):typeof a=="function"?a(n):n===a,Kk=()=>new Date().getTime(),zC=Symbol(),Zk={loading:!0},vu={loading:!1};window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));var Xk;(function(n){n.Init="init",n.Ready="ready",n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected",n.Failed="failed",n.Reconnect="reconnect",n.Reconnecting="reconnecting"})(Xk||(Xk={}));st.Unknown,st.Internal,st.DeadlineExceeded,st.ResourceExhausted,st.FailedPrecondition,st.Unavailable,st.DataLoss;d2("grpc:retry");u6(10,{description:"Number of attempts to retry"}),u6(3e4,{description:"Max delay between retries in milliseconds"});const HC=k.makeEnum("streamlayer.sports.EventStatus",[{no:0,name:"EVENT_STATUS_UNSET",localName:"UNSET"},{no:1,name:"EVENT_STATUS_PREGAME",localName:"PREGAME"},{no:2,name:"EVENT_STATUS_ACTIVE",localName:"ACTIVE"},{no:3,name:"EVENT_STATUS_BREAK",localName:"BREAK"},{no:4,name:"EVENT_STATUS_OVERTIME",localName:"OVERTIME"},{no:5,name:"EVENT_STATUS_SHOOTOUTS",localName:"SHOOTOUTS"},{no:6,name:"EVENT_STATUS_POSTGAME",localName:"POSTGAME"},{no:7,name:"EVENT_STATUS_CANCELLED",localName:"CANCELLED"}]),GC=k.makeEnum("streamlayer.sports.EventEndless",[{no:0,name:"EVENT_ENDLESS_UNSET",localName:"UNSET"},{no:1,name:"EVENT_ENDLESS_ENABLED",localName:"ENABLED"},{no:2,name:"EVENT_ENDLESS_DISABLED",localName:"DISABLED"}]),I6=k.makeMessageType("streamlayer.sports.Pagination",()=>[{no:1,name:"page",kind:"scalar",T:5},{no:2,name:"page_size",kind:"scalar",T:5}]),qC=k.makeMessageType("streamlayer.sports.Sort",()=>[{no:1,name:"field",kind:"scalar",T:9},{no:2,name:"order",kind:"scalar",T:9}]),N6=k.makeMessageType("streamlayer.sports.Meta",()=>[{no:1,name:"count",kind:"scalar",T:5},{no:2,name:"page",kind:"scalar",T:5},{no:3,name:"page_size",kind:"scalar",T:5}]),WC=k.makeMessageType("streamlayer.sports.Venue",()=>[{no:1,name:"city",kind:"scalar",T:9},{no:2,name:"country",kind:"scalar",T:9},{no:3,name:"stadium",kind:"scalar",T:9}]),R6=k.makeMessageType("streamlayer.sports.EventTime",()=>[{no:1,name:"clock",kind:"scalar",T:9},{no:2,name:"period",kind:"scalar",T:5}]),bW=k.makeMessageType("streamlayer.sports.EventPeriod",()=>[{no:1,name:"number",kind:"scalar",T:5},{no:2,name:"score_home",kind:"scalar",T:5},{no:3,name:"score_away",kind:"scalar",T:5}]),Eu=k.makeMessageType("streamlayer.sports.TeamRecord",()=>[{no:1,name:"wins",kind:"scalar",T:5},{no:2,name:"losses",kind:"scalar",T:5}]),_u=k.makeMessageType("streamlayer.sports.EventTeam",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"colors",kind:"scalar",T:9,repeated:!0},{no:6,name:"is_winner",kind:"scalar",T:8}]),kW=k.makeMessageType("streamlayer.sports.EventCustomFields",()=>[{no:1,name:"preview",kind:"scalar",T:9},{no:2,name:"stream",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"event_ids",kind:"scalar",T:9,repeated:!0},{no:6,name:"subtitle",kind:"scalar",T:9},{no:7,name:"promotitle",kind:"scalar",T:9},{no:8,name:"slate",kind:"scalar",T:9},{no:9,name:"horizontal_preview",kind:"scalar",T:9},{no:10,name:"small_logo",kind:"scalar",T:9},{no:11,name:"description",kind:"scalar",T:9}]),SW=k.makeMessageType("streamlayer.sports.EventProgram",()=>[{no:1,name:"id",kind:"scalar",T:9,opt:!0},{no:2,name:"title",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:9},{no:4,name:"end_time",kind:"scalar",T:9},{no:5,name:"thumbnail_url",kind:"scalar",T:9},{no:6,name:"square_thumbnail_url",kind:"scalar",T:9}]),wW=k.makeMessageType("streamlayer.sports.EventData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"sport",kind:"scalar",T:9},{no:3,name:"league",kind:"scalar",T:9},{no:4,name:"scheduled",kind:"scalar",T:9},{no:5,name:"home",kind:"message",T:_u},{no:6,name:"away",kind:"message",T:_u},{no:7,name:"status",kind:"enum",T:k.getEnumType(HC)},{no:8,name:"custom_fields",kind:"message",T:kW},{no:9,name:"start_time",kind:"scalar",T:9},{no:10,name:"end_time",kind:"scalar",T:9},{no:11,name:"venue",kind:"message",T:WC},{no:12,name:"schedule",kind:"message",T:SW,repeated:!0},{no:13,name:"endless",kind:"enum",T:k.getEnumType(GC)},{no:14,name:"provider_id",kind:"scalar",T:9}]),nd=k.makeMessageType("streamlayer.sports.EventSummary",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"scheduled",kind:"scalar",T:9},{no:3,name:"score_home",kind:"scalar",T:5},{no:4,name:"score_away",kind:"scalar",T:5},{no:5,name:"venue",kind:"message",T:WC},{no:6,name:"event_time",kind:"message",T:R6},{no:7,name:"home_team",kind:"message",T:_u},{no:8,name:"away_team",kind:"message",T:_u},{no:9,name:"status",kind:"enum",T:k.getEnumType(HC)},{no:10,name:"periods",kind:"message",T:bW,repeated:!0},{no:11,name:"league",kind:"scalar",T:9},{no:12,name:"start_time",kind:"scalar",T:9},{no:13,name:"end_time",kind:"scalar",T:9},{no:14,name:"name",kind:"scalar",T:9},{no:15,name:"logo",kind:"scalar",T:9},{no:16,name:"stream",kind:"scalar",T:9}]),CW=k.makeEnum("streamlayer.sports.baseball.PitcherStatus",[{no:0,name:"PITCHER_STATUS_UNSET",localName:"UNSET"},{no:1,name:"PITCHER_STATUS_WIN",localName:"WIN"},{no:2,name:"PITCHER_STATUS_LOSS",localName:"LOSS"}]),EW=k.makeEnum("streamlayer.sports.baseball.BaseballBase",[{no:0,name:"BASEBALL_BASE_UNSET",localName:"UNSET"},{no:1,name:"BASEBALL_BASE_FIRST",localName:"FIRST"},{no:2,name:"BASEBALL_BASE_SECOND",localName:"SECOND"},{no:3,name:"BASEBALL_BASE_THIRD",localName:"THIRD"}]),Jk=k.makeMessageType("streamlayer.sports.baseball.PitcherSummary",()=>[{no:1,name:"statistics",kind:"message",T:QC},{no:2,name:"status",kind:"enum",T:k.getEnumType(CW)},{no:3,name:"win_rate",kind:"scalar",T:5},{no:4,name:"loss_rate",kind:"scalar",T:5}]),_W=k.makeMessageType("streamlayer.sports.baseball.Runner",()=>[{no:1,name:"player_name",kind:"scalar",T:9},{no:2,name:"jersey_number",kind:"scalar",T:9}]),IW=k.makeMessageType("streamlayer.sports.baseball.RunnerOnBase",()=>[{no:1,name:"base_number",kind:"enum",T:k.getEnumType(EW)},{no:2,name:"player",kind:"message",T:_W}]),NW=k.makeMessageType("streamlayer.sports.baseball.Hitting",()=>[{no:1,name:"player_name",kind:"scalar",T:9},{no:2,name:"hits_per_bat",kind:"scalar",T:9},{no:3,name:"runs",kind:"scalar",T:9},{no:4,name:"run_batted_in",kind:"scalar",T:9},{no:5,name:"walks",kind:"scalar",T:9},{no:6,name:"batting_average",kind:"scalar",T:9}]),RW=k.makeMessageType("streamlayer.sports.baseball.Batting",()=>[{no:1,name:"player_name",kind:"scalar",T:9},{no:2,name:"at_bat",kind:"scalar",T:9},{no:3,name:"runs",kind:"scalar",T:9},{no:4,name:"hits",kind:"scalar",T:9},{no:5,name:"batting_average",kind:"scalar",T:9}]),QC=k.makeMessageType("streamlayer.sports.baseball.Pitching",()=>[{no:1,name:"player_name",kind:"scalar",T:9},{no:2,name:"innings_pitched",kind:"scalar",T:9},{no:3,name:"hits_by_pitch",kind:"scalar",T:9},{no:4,name:"earned_runs",kind:"scalar",T:9},{no:5,name:"walks",kind:"scalar",T:9},{no:6,name:"strikeouts",kind:"scalar",T:9}]),eS=k.makeMessageType("streamlayer.sports.baseball.BaseballTeamSummary",()=>[{no:1,name:"hitting",kind:"message",T:NW,repeated:!0},{no:2,name:"batting",kind:"message",T:RW,repeated:!0},{no:3,name:"pitching",kind:"message",T:QC,repeated:!0}]),LW=k.makeMessageType("streamlayer.sports.baseball.BaseballSummary",()=>[{no:1,name:"home_pitcher",kind:"message",T:Jk},{no:2,name:"away_pitcher",kind:"message",T:Jk},{no:3,name:"home_statistics",kind:"message",T:eS},{no:4,name:"away_statistics",kind:"message",T:eS}]),OW=k.makeMessageType("streamlayer.sports.baseball.BaseballPlayByPlayStatistics",()=>[{no:1,name:"team",kind:"message",T:_u},{no:2,name:"inning",kind:"scalar",T:9},{no:3,name:"play_text",kind:"scalar",T:9},{no:4,name:"detail",kind:"message",T:AW,repeated:!0},{no:5,name:"runs",kind:"scalar",T:5},{no:6,name:"hits",kind:"scalar",T:5},{no:7,name:"errors",kind:"scalar",T:5}]),AW=k.makeMessageType("streamlayer.sports.baseball.BaseballPlayByPlayStatistics.BaseballPlayByPlayDetailStatistics",()=>[{no:1,name:"score_home",kind:"scalar",T:5},{no:2,name:"score_away",kind:"scalar",T:5},{no:3,name:"play_text",kind:"scalar",T:9},{no:4,name:"scoring",kind:"scalar",T:8},{no:7,name:"play_id",kind:"scalar",T:5}],{localName:"BaseballPlayByPlayStatistics_BaseballPlayByPlayDetailStatistics"}),xW=k.makeMessageType("streamlayer.sports.baseball.EventScore",()=>[{no:1,name:"outs",kind:"scalar",T:5},{no:2,name:"inning",kind:"scalar",T:5},{no:3,name:"inning_division",kind:"scalar",T:9},{no:4,name:"is_delayed",kind:"scalar",T:8},{no:5,name:"reason_for_delay",kind:"scalar",T:9},{no:6,name:"runners_on_base",kind:"message",T:IW,repeated:!0},{no:7,name:"taken_bases",kind:"scalar",T:5},{no:8,name:"home_team_record",kind:"message",T:Eu},{no:9,name:"away_team_record",kind:"message",T:Eu}]),PW=k.makeMessageType("streamlayer.sports.baseball.PlayByPlay",()=>[{no:1,name:"statistics",kind:"message",T:OW,repeated:!0}]),MW=k.makeMessageType("streamlayer.sports.baseball.EventSummary",()=>[{no:1,name:"statistics",kind:"message",T:LW}]),DW=k.makeMessageType("streamlayer.sports.baseball.TeamStanding",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"colors",kind:"scalar",T:9,repeated:!0},{no:6,name:"wins",kind:"scalar",T:5},{no:7,name:"losses",kind:"scalar",T:5},{no:8,name:"pct",kind:"scalar",T:1},{no:9,name:"games_behind",kind:"scalar",T:5},{no:10,name:"streak",kind:"message",T:UW},{no:11,name:"rank",kind:"message",T:FW},{no:12,name:"division",kind:"scalar",T:9},{no:13,name:"conference",kind:"scalar",T:9}]),UW=k.makeMessageType("streamlayer.sports.baseball.TeamStanding.Streak",()=>[{no:1,name:"losses",kind:"scalar",T:5},{no:2,name:"wins",kind:"scalar",T:5}],{localName:"TeamStanding_Streak"}),FW=k.makeMessageType("streamlayer.sports.baseball.TeamStanding.Rank",()=>[{no:1,name:"division",kind:"scalar",T:5},{no:2,name:"conference",kind:"scalar",T:5}],{localName:"TeamStanding_Rank"}),VW=k.makeMessageType("streamlayer.sports.baseball.Standings",()=>[{no:1,name:"standings",kind:"message",T:DW,repeated:!0}]),jW=k.makeEnum("streamlayer.sports.basketball.BasketballPerformerCategory",[{no:0,name:"BASKETBALL_PERFORMER_CATEGORY_UNSET",localName:"UNSET"},{no:1,name:"BASKETBALL_PERFORMER_CATEGORY_POINTS",localName:"POINTS"},{no:2,name:"BASKETBALL_PERFORMER_CATEGORY_REBOUNDS",localName:"REBOUNDS"},{no:3,name:"BASKETBALL_PERFORMER_CATEGORY_ASSISTS",localName:"ASSISTS"}]),BW=k.makeMessageType("streamlayer.sports.basketball.EventScore",()=>[{no:8,name:"home_team_record",kind:"message",T:Eu},{no:9,name:"away_team_record",kind:"message",T:Eu}]),tS=k.makeMessageType("streamlayer.sports.basketball.BasketballTeamSummary",()=>[{no:1,name:"field_goal_percentage",kind:"scalar",T:1},{no:2,name:"three_pts_percentage",kind:"scalar",T:1},{no:3,name:"free_throw_percentage",kind:"scalar",T:1},{no:4,name:"assists",kind:"scalar",T:5},{no:5,name:"rebounds",kind:"scalar",T:5}]),nS=k.makeMessageType("streamlayer.sports.basketball.BasketballPerformer",()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"photo",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:9}]),$W=k.makeMessageType("streamlayer.sports.basketball.BasketballPerformers",()=>[{no:1,name:"category",kind:"enum",T:k.getEnumType(jW)},{no:2,name:"home_player",kind:"message",T:nS},{no:3,name:"away_player",kind:"message",T:nS}]),zW=k.makeMessageType("streamlayer.sports.basketball.BasketballSummary",()=>[{no:1,name:"home_statistics",kind:"message",T:tS},{no:2,name:"away_statistics",kind:"message",T:tS}]),HW=k.makeMessageType("streamlayer.sports.basketball.EventSummary",()=>[{no:1,name:"statistics",kind:"message",T:zW},{no:2,name:"top_performers",kind:"message",T:$W,repeated:!0},{no:3,name:"last_games",kind:"message",T:YC}]),GW=k.makeMessageType("streamlayer.sports.basketball.BasketballPlayByPlayStatistics",()=>[{no:1,name:"team",kind:"message",T:_u},{no:2,name:"event_time",kind:"message",T:R6},{no:3,name:"score_home",kind:"scalar",T:5},{no:4,name:"score_away",kind:"scalar",T:5},{no:5,name:"play_text",kind:"scalar",T:9},{no:6,name:"scoring",kind:"scalar",T:8},{no:7,name:"play_id",kind:"scalar",T:5}]),qW=k.makeMessageType("streamlayer.sports.basketball.PlayByPlay",()=>[{no:1,name:"statistics",kind:"message",T:GW,repeated:!0}]),aS=k.makeMessageType("streamlayer.sports.basketball.PlayerScores",()=>[{no:1,name:"jersey",kind:"scalar",T:5},{no:2,name:"full_name",kind:"scalar",T:9},{no:3,name:"points",kind:"scalar",T:5},{no:4,name:"assists",kind:"scalar",T:5},{no:5,name:"rebounds",kind:"scalar",T:5},{no:6,name:"minutes",kind:"scalar",T:1},{no:7,name:"starter",kind:"scalar",T:8}]),WW=k.makeMessageType("streamlayer.sports.basketball.Boxscore",()=>[{no:1,name:"home_players",kind:"message",T:aS,repeated:!0},{no:2,name:"away_players",kind:"message",T:aS,repeated:!0}]),QW=k.makeMessageType("streamlayer.sports.basketball.TeamStanding",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"colors",kind:"scalar",T:9,repeated:!0},{no:6,name:"wins",kind:"scalar",T:5},{no:7,name:"losses",kind:"scalar",T:5},{no:8,name:"pct",kind:"scalar",T:1},{no:9,name:"games_behind",kind:"scalar",T:5},{no:10,name:"streak",kind:"message",T:YW},{no:11,name:"rank",kind:"message",T:KW},{no:12,name:"division",kind:"scalar",T:9},{no:13,name:"conference",kind:"scalar",T:9}]),YW=k.makeMessageType("streamlayer.sports.basketball.TeamStanding.Streak",()=>[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"length",kind:"scalar",T:5}],{localName:"TeamStanding_Streak"}),KW=k.makeMessageType("streamlayer.sports.basketball.TeamStanding.Rank",()=>[{no:1,name:"division",kind:"scalar",T:5},{no:2,name:"conference",kind:"scalar",T:5}],{localName:"TeamStanding_Rank"}),ZW=k.makeMessageType("streamlayer.sports.basketball.Standings",()=>[{no:1,name:"standings",kind:"message",T:QW,repeated:!0}]),rS=k.makeMessageType("streamlayer.sports.basketball.BasketballMatchPlayer",()=>[{no:1,name:"first_name",kind:"scalar",T:9},{no:2,name:"last_name",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"photo",kind:"scalar",T:9},{no:5,name:"position",kind:"scalar",T:9},{no:6,name:"jersey",kind:"scalar",T:5}]),oS=k.makeMessageType("streamlayer.sports.basketball.BasketballMatchLineup",()=>[{no:3,name:"start_players",kind:"message",T:rS,repeated:!0},{no:4,name:"substitutes",kind:"message",T:rS,repeated:!0}]),XW=k.makeMessageType("streamlayer.sports.basketball.BasketballMatchLineups",()=>[{no:1,name:"home_team",kind:"message",T:oS},{no:2,name:"away_team",kind:"message",T:oS}]),M5=k.makeMessageType("streamlayer.sports.basketball.BasketballLastGame",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"attributes",kind:"message",T:JW}]),JW=k.makeMessageType("streamlayer.sports.basketball.BasketballLastGame.BasketballLastGameAttributes",()=>[{no:1,name:"league",kind:"scalar",T:9},{no:2,name:"home_team",kind:"scalar",T:9},{no:3,name:"away_team",kind:"scalar",T:9},{no:5,name:"home_score",kind:"scalar",T:5},{no:6,name:"away_score",kind:"scalar",T:5},{no:7,name:"date",kind:"scalar",T:9}],{localName:"BasketballLastGame_BasketballLastGameAttributes"}),YC=k.makeMessageType("streamlayer.sports.basketball.BasketballLastGames",()=>[{no:1,name:"home",kind:"message",T:M5,repeated:!0},{no:2,name:"away",kind:"message",T:M5,repeated:!0},{no:3,name:"head_to_head",kind:"message",T:M5,repeated:!0}]),eQ=k.makeEnum("streamlayer.sports.hockey.HockeyPerformerCategory",[{no:0,name:"HOCKEY_PERFORMER_CATEGORY_UNSET",localName:"UNSET"},{no:1,name:"HOCKEY_PERFORMER_CATEGORY_GOALS",localName:"GOALS"},{no:2,name:"HOCKEY_PERFORMER_CATEGORY_SHOTS",localName:"SHOTS"},{no:3,name:"HOCKEY_PERFORMER_CATEGORY_HITS",localName:"HITS"},{no:4,name:"HOCKEY_PERFORMER_CATEGORY_SAVES",localName:"SAVES"}]),KC=k.makeEnum("streamlayer.sports.hockey.HockeyPlayerPosition",[{no:0,name:"HOCKEY_PLAYER_POSITION_UNSET",localName:"UNSET"},{no:1,name:"HOCKEY_PLAYER_POSITION_CENTER",localName:"CENTER"},{no:2,name:"HOCKEY_PLAYER_POSITION_LEFT_WIND",localName:"LEFT_WIND"},{no:3,name:"HOCKEY_PLAYER_POSITION_RIGHT_WING",localName:"RIGHT_WING"},{no:4,name:"HOCKEY_PLAYER_POSITION_DEFENSE",localName:"DEFENSE"},{no:5,name:"HOCKEY_PLAYER_POSITION_GOALTENDER",localName:"GOALTENDER"}]),tQ=k.makeMessageType("streamlayer.sports.hockey.EventScore",()=>[{no:8,name:"home_team_record",kind:"message",T:Eu},{no:9,name:"away_team_record",kind:"message",T:Eu}]),sS=k.makeMessageType("streamlayer.sports.hockey.HockeyPerformer",()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"photo",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5}]),nQ=k.makeMessageType("streamlayer.sports.hockey.HockeyPerformers",()=>[{no:1,name:"category",kind:"enum",T:k.getEnumType(eQ)},{no:2,name:"home_player",kind:"message",T:sS,repeated:!0},{no:3,name:"away_player",kind:"message",T:sS,repeated:!0}]),iS=k.makeMessageType("streamlayer.sports.hockey.HockeyTeamSummary",()=>[{no:1,name:"shots_on_goal",kind:"scalar",T:5},{no:2,name:"faceoff",kind:"scalar",T:1},{no:3,name:"powerplay",kind:"scalar",T:5},{no:4,name:"penalty_minutes",kind:"scalar",T:5},{no:5,name:"hits",kind:"scalar",T:5},{no:6,name:"blocks",kind:"scalar",T:5},{no:7,name:"giveaways",kind:"scalar",T:5},{no:8,name:"takeaways",kind:"scalar",T:5}]),aQ=k.makeMessageType("streamlayer.sports.hockey.HockeySummary",()=>[{no:1,name:"home_statistics",kind:"message",T:iS},{no:2,name:"away_statistics",kind:"message",T:iS}]),rQ=k.makeMessageType("streamlayer.sports.hockey.EventSummary",()=>[{no:1,name:"statistics",kind:"message",T:aQ},{no:2,name:"top_performers",kind:"message",T:nQ,repeated:!0}]),oQ=k.makeMessageType("streamlayer.sports.hockey.HockeyPlayByPlayStatistics",()=>[{no:1,name:"team",kind:"message",T:_u},{no:2,name:"event_time",kind:"message",T:R6},{no:3,name:"score_home",kind:"scalar",T:5},{no:4,name:"score_away",kind:"scalar",T:5},{no:5,name:"play_text",kind:"scalar",T:9},{no:6,name:"scoring",kind:"scalar",T:8},{no:7,name:"play_id",kind:"scalar",T:5}]),sQ=k.makeMessageType("streamlayer.sports.hockey.PlayByPlay",()=>[{no:1,name:"statistics",kind:"message",T:oQ,repeated:!0}]),D5=k.makeMessageType("streamlayer.sports.hockey.PlayerScore",()=>[{no:1,name:"jersey",kind:"scalar",T:5},{no:2,name:"full_name",kind:"scalar",T:9},{no:3,name:"goals",kind:"scalar",T:5},{no:4,name:"assists",kind:"scalar",T:5},{no:5,name:"shots",kind:"scalar",T:5},{no:6,name:"penalty_minutes",kind:"scalar",T:1},{no:7,name:"minutes",kind:"scalar",T:9},{no:8,name:"position",kind:"enum",T:k.getEnumType(KC)}]),lS=k.makeMessageType("streamlayer.sports.hockey.GoaltenderScore",()=>[{no:1,name:"jersey",kind:"scalar",T:5},{no:2,name:"full_name",kind:"scalar",T:9},{no:3,name:"shots_againts",kind:"scalar",T:5},{no:4,name:"goals_againts",kind:"scalar",T:5},{no:5,name:"saves",kind:"scalar",T:5},{no:6,name:"saves_pct",kind:"scalar",T:5},{no:7,name:"minutes",kind:"scalar",T:9},{no:8,name:"position",kind:"enum",T:k.getEnumType(KC)}]),uS=k.makeMessageType("streamlayer.sports.hockey.PlayerScores",()=>[{no:1,name:"skaters",kind:"message",T:D5,repeated:!0},{no:2,name:"goaltender",kind:"message",T:lS},{no:3,name:"forwards",kind:"message",T:D5,repeated:!0},{no:4,name:"defensemen",kind:"message",T:D5,repeated:!0},{no:5,name:"goaltenders",kind:"message",T:lS,repeated:!0}]),iQ=k.makeMessageType("streamlayer.sports.hockey.Boxscore",()=>[{no:1,name:"home_players",kind:"message",T:uS},{no:2,name:"away_players",kind:"message",T:uS}]),lQ=k.makeMessageType("streamlayer.sports.hockey.TeamStanding",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"colors",kind:"scalar",T:9,repeated:!0},{no:6,name:"wins",kind:"scalar",T:5},{no:7,name:"losses",kind:"scalar",T:5},{no:8,name:"pct",kind:"scalar",T:1},{no:9,name:"games_behind",kind:"scalar",T:5},{no:10,name:"streak",kind:"message",T:uQ},{no:11,name:"rank",kind:"message",T:cQ},{no:12,name:"division",kind:"scalar",T:9},{no:13,name:"conference",kind:"scalar",T:9}]),uQ=k.makeMessageType("streamlayer.sports.hockey.TeamStanding.Streak",()=>[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"length",kind:"scalar",T:5}],{localName:"TeamStanding_Streak"}),cQ=k.makeMessageType("streamlayer.sports.hockey.TeamStanding.Rank",()=>[{no:1,name:"division",kind:"scalar",T:5},{no:2,name:"conference",kind:"scalar",T:5}],{localName:"TeamStanding_Rank"}),dQ=k.makeMessageType("streamlayer.sports.hockey.Standings",()=>[{no:1,name:"standings",kind:"message",T:lQ,repeated:!0}]),mQ=k.makeEnum("streamlayer.sports.soccer.SoccerPerformerCategory",[{no:0,name:"SOCCER_PERFORMER_CATEGORY_UNSET",localName:"UNSET"},{no:1,name:"SOCCER_PERFORMER_CATEGORY_ATTACK",localName:"ATTACK"},{no:2,name:"SOCCER_PERFORMER_CATEGORY_MIDFIELD",localName:"MIDFIELD"},{no:3,name:"SOCCER_PERFORMER_CATEGORY_DEFENSE",localName:"DEFENSE"}]),fQ=k.makeEnum("streamlayer.sports.soccer.SoccerMatchActivityType",[{no:0,name:"SOCCER_MATCH_ACTIVITY_UNSET"},{no:1,name:"SOCCER_MATCH_ACTIVITY_GOAL"},{no:2,name:"SOCCER_MATCH_ACTIVITY_YELLOW_CARD"},{no:3,name:"SOCCER_MATCH_ACTIVITY_RED_CARD"},{no:4,name:"SOCCER_MATCH_ACTIVITY_SUBSTITUTION"},{no:5,name:"SOCCER_MATCH_ACTIVITY_HALF_TIME"},{no:6,name:"SOCCER_MATCH_ACTIVITY_FULL_TIME"}]),pQ=k.makeMessageType("streamlayer.sports.soccer.EventScore",()=>[{no:8,name:"home_team_record",kind:"message",T:Eu},{no:9,name:"away_team_record",kind:"message",T:Eu}]),fy=k.makeMessageType("streamlayer.sports.soccer.SoccerPerformer",()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"photo",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5}]),hQ=k.makeMessageType("streamlayer.sports.soccer.SoccerAttackPerfomer",()=>[{no:1,name:"perfomer",kind:"message",T:fy},{no:2,name:"attack_stats",kind:"message",T:CQ}]),gQ=k.makeMessageType("streamlayer.sports.soccer.SoccerMidfieldPerformer",()=>[{no:1,name:"perfomer",kind:"message",T:fy},{no:2,name:"midfield_stats",kind:"message",T:EQ}]),yQ=k.makeMessageType("streamlayer.sports.soccer.SoccerDefensePerfomer",()=>[{no:1,name:"perfomer",kind:"message",T:fy},{no:2,name:"defense_stats",kind:"message",T:_Q}]),vQ=k.makeMessageType("streamlayer.sports.soccer.SoccerPerformers",()=>[{no:1,name:"category",kind:"enum",T:k.getEnumType(mQ)},{no:2,name:"attack_performer",kind:"message",T:hQ},{no:3,name:"midfield_performer",kind:"message",T:gQ},{no:4,name:"defense_performer",kind:"message",T:yQ}]),TQ=k.makeMessageType("streamlayer.sports.soccer.SoccerTeamTopMatchStats",()=>[{no:1,name:"possession",kind:"scalar",T:1},{no:2,name:"shots",kind:"scalar",T:5},{no:3,name:"shots_on_target",kind:"scalar",T:5},{no:4,name:"passes",kind:"scalar",T:5},{no:5,name:"offsides",kind:"scalar",T:5},{no:6,name:"yellow_cards",kind:"scalar",T:5},{no:7,name:"corner_kicks",kind:"scalar",T:5},{no:8,name:"free_kicks",kind:"scalar",T:5},{no:9,name:"red_cards",kind:"scalar",T:5}]),bQ=k.makeMessageType("streamlayer.sports.soccer.SoccerTeamAttackingStats",()=>[{no:1,name:"possession",kind:"scalar",T:1},{no:2,name:"passing_accuracy",kind:"scalar",T:1},{no:3,name:"chances_created",kind:"scalar",T:5},{no:4,name:"successful_crosses",kind:"scalar",T:1}]),kQ=k.makeMessageType("streamlayer.sports.soccer.SoccerTeamDefenseStats",()=>[{no:1,name:"tackles_made",kind:"scalar",T:5},{no:2,name:"interceptions",kind:"scalar",T:5},{no:3,name:"blocked_shots",kind:"scalar",T:5},{no:4,name:"clearances",kind:"scalar",T:5},{no:5,name:"duels_won",kind:"scalar",T:5}]),cS=k.makeMessageType("streamlayer.sports.soccer.SoccerTeamSummary",()=>[{no:1,name:"top_match_stats",kind:"message",T:TQ},{no:2,name:"attacking_stats",kind:"message",T:bQ},{no:3,name:"defense_stats",kind:"message",T:kQ}]),SQ=k.makeMessageType("streamlayer.sports.soccer.SoccerSummary",()=>[{no:1,name:"home_statistics",kind:"message",T:cS},{no:2,name:"away_statistics",kind:"message",T:cS},{no:3,name:"perfomers",kind:"message",T:vQ}]),wQ=k.makeMessageType("streamlayer.sports.soccer.EventSummary",()=>[{no:1,name:"statistics",kind:"message",T:SQ},{no:2,name:"last_games",kind:"message",T:ZC}]),CQ=k.makeMessageType("streamlayer.sports.soccer.SoccerPlayerAttackingStats",()=>[{no:1,name:"goals",kind:"scalar",T:5},{no:2,name:"assists",kind:"scalar",T:5},{no:3,name:"shots",kind:"scalar",T:5},{no:4,name:"shots_on_goal",kind:"scalar",T:5},{no:5,name:"penalty_kick_goals",kind:"scalar",T:5}]),EQ=k.makeMessageType("streamlayer.sports.soccer.SoccerPlayerMidfieldStats",()=>[{no:1,name:"goals",kind:"scalar",T:5},{no:2,name:"assists",kind:"scalar",T:5},{no:3,name:"key_passes",kind:"scalar",T:5},{no:4,name:"crosses",kind:"scalar",T:5},{no:5,name:"corners",kind:"scalar",T:5}]),_Q=k.makeMessageType("streamlayer.sports.soccer.SoccerPlayerDefenseStats",()=>[{no:1,name:"goals",kind:"scalar",T:5},{no:2,name:"assists",kind:"scalar",T:5},{no:3,name:"tackles_made",kind:"scalar",T:5},{no:4,name:"interceptions",kind:"scalar",T:5},{no:5,name:"blocked_shots",kind:"scalar",T:5}]),IQ=k.makeMessageType("streamlayer.sports.soccer.SoccerMatchFormationMatrixPlayer",()=>[{no:1,name:"jersey_number",kind:"scalar",T:5},{no:2,name:"player_name",kind:"scalar",T:9},{no:3,name:"photo",kind:"scalar",T:9}]),NQ=k.makeMessageType("streamlayer.sports.soccer.SoccerMatchFormationMatrix",()=>[{no:1,name:"row_players",kind:"message",T:IQ,repeated:!0}]),dS=k.makeMessageType("streamlayer.sports.soccer.SoccerMatchPlayer",()=>[{no:1,name:"first_name",kind:"scalar",T:9},{no:2,name:"last_name",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"photo",kind:"scalar",T:9},{no:5,name:"position",kind:"scalar",T:9},{no:6,name:"jersey",kind:"scalar",T:5}]),mS=k.makeMessageType("streamlayer.sports.soccer.SoccerMatchLineup",()=>[{no:1,name:"formation_string",kind:"scalar",T:9},{no:2,name:"formation_matrix",kind:"message",T:NQ,repeated:!0},{no:3,name:"start_players",kind:"message",T:dS,repeated:!0},{no:4,name:"substitutes",kind:"message",T:dS,repeated:!0}]),RQ=k.makeMessageType("streamlayer.sports.soccer.SoccerMatchLineups",()=>[{no:1,name:"home_team",kind:"message",T:mS},{no:2,name:"away_team",kind:"message",T:mS}]),LQ=k.makeMessageType("streamlayer.sports.soccer.SoccerPlayByPlayStatistics",()=>[{no:1,name:"team",kind:"message",T:_u},{no:2,name:"event_time",kind:"message",T:R6},{no:3,name:"score_home",kind:"scalar",T:5},{no:4,name:"score_away",kind:"scalar",T:5},{no:5,name:"play_text",kind:"scalar",T:9},{no:6,name:"scoring",kind:"scalar",T:8},{no:7,name:"play_id",kind:"scalar",T:5},{no:8,name:"type",kind:"enum",T:k.getEnumType(fQ)}]),OQ=k.makeMessageType("streamlayer.sports.soccer.PlayByPlay",()=>[{no:1,name:"statistics",kind:"message",T:LQ,repeated:!0}]),AQ=k.makeMessageType("streamlayer.sports.soccer.TeamStanding",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:4,name:"logo",kind:"scalar",T:9},{no:5,name:"colors",kind:"scalar",T:9,repeated:!0},{no:6,name:"wins",kind:"scalar",T:5},{no:7,name:"losses",kind:"scalar",T:5},{no:8,name:"draws",kind:"scalar",T:5},{no:9,name:"games_behind",kind:"scalar",T:5},{no:12,name:"division",kind:"scalar",T:9},{no:13,name:"points",kind:"scalar",T:5},{no:14,name:"position",kind:"scalar",T:5},{no:15,name:"total_goals",kind:"scalar",T:5},{no:16,name:"total_goals_received",kind:"scalar",T:5}]),xQ=k.makeMessageType("streamlayer.sports.soccer.Standings",()=>[{no:1,name:"standings",kind:"message",T:AQ,repeated:!0}]),U5=k.makeMessageType("streamlayer.sports.soccer.SoccerLastGame",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"attributes",kind:"message",T:PQ}]),PQ=k.makeMessageType("streamlayer.sports.soccer.SoccerLastGame.SoccerLastGameAttributes",()=>[{no:1,name:"league",kind:"scalar",T:9},{no:2,name:"home_team",kind:"scalar",T:9},{no:3,name:"away_team",kind:"scalar",T:9},{no:5,name:"home_score",kind:"scalar",T:5},{no:6,name:"away_score",kind:"scalar",T:5},{no:7,name:"date",kind:"scalar",T:9}],{localName:"SoccerLastGame_SoccerLastGameAttributes"}),ZC=k.makeMessageType("streamlayer.sports.soccer.SoccerLastGames",()=>[{no:1,name:"home",kind:"message",T:U5,repeated:!0},{no:2,name:"away",kind:"message",T:U5,repeated:!0},{no:3,name:"head_to_head",kind:"message",T:U5,repeated:!0}]),ad=k.makeEnum("streamlayer.sports.events.EventType",[{no:0,name:"EVENT_TYPE_UNSET",localName:"UNSET"},{no:1,name:"EVENT_TYPE_BASEBALL",localName:"BASEBALL"},{no:2,name:"EVENT_TYPE_BASKETBALL",localName:"BASKETBALL"},{no:3,name:"EVENT_TYPE_HOCKEY",localName:"HOCKEY"},{no:4,name:"EVENT_TYPE_SOCCER",localName:"SOCCER"},{no:5,name:"EVENT_TYPE_GOLF",localName:"GOLF"}]),MQ=k.makeMessageType("streamlayer.sports.events.ScheduleAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"baseball",kind:"message",T:xW,oneof:"sport"},{no:3,name:"basketball",kind:"message",T:BW,oneof:"sport"},{no:4,name:"hockey",kind:"message",T:tQ,oneof:"sport"},{no:5,name:"soccer",kind:"message",T:pQ,oneof:"sport"}]),DQ=k.makeMessageType("streamlayer.sports.events.ScheduleResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:MQ}]),UQ=k.makeMessageType("streamlayer.sports.events.ListResponseAttributes",()=>[{no:1,name:"common",kind:"message",T:wW}]),XC=k.makeMessageType("streamlayer.sports.events.ListResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"attributes",kind:"message",T:UQ}]),FQ=k.makeMessageType("streamlayer.sports.events.ListRequest",()=>[{no:1,name:"filter",kind:"message",T:VQ},{no:2,name:"pagination",kind:"message",T:I6},{no:3,name:"sort",kind:"message",T:qC},{no:4,name:"ids",kind:"scalar",T:4,repeated:!0},{no:5,name:"organization_id",kind:"scalar",T:9}]),VQ=k.makeMessageType("streamlayer.sports.events.ListRequest.Filter",()=>[{no:1,name:"date",kind:"scalar",T:9},{no:2,name:"league",kind:"scalar",T:9},{no:3,name:"start_date_time",kind:"scalar",T:9},{no:4,name:"end_date_time",kind:"scalar",T:9},{no:5,name:"sport",kind:"scalar",T:9},{no:6,name:"name",kind:"scalar",T:9},{no:7,name:"endless",kind:"enum",T:k.getEnumType(GC)}],{localName:"ListRequest_Filter"}),jQ=k.makeMessageType("streamlayer.sports.events.DemoListRequest",()=>[{no:1,name:"filter",kind:"message",T:BQ},{no:2,name:"pagination",kind:"message",T:I6},{no:3,name:"sort",kind:"message",T:qC}]),BQ=k.makeMessageType("streamlayer.sports.events.DemoListRequest.Filter",()=>[{no:1,name:"date",kind:"scalar",T:9},{no:2,name:"league",kind:"scalar",T:9}],{localName:"DemoListRequest_Filter"}),$Q=k.makeMessageType("streamlayer.sports.events.DemoListResponse",()=>[{no:1,name:"meta",kind:"message",T:N6},{no:2,name:"data",kind:"message",T:XC,repeated:!0}]),zQ=k.makeMessageType("streamlayer.sports.events.ListResponse",()=>[{no:1,name:"meta",kind:"message",T:N6},{no:2,name:"data",kind:"message",T:XC,repeated:!0}]),fS=k.makeMessageType("streamlayer.sports.events.SummaryRequest",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"organization_id",kind:"scalar",T:9}]),pS=k.makeMessageType("streamlayer.sports.events.SummaryResponse",()=>[{no:1,name:"data",kind:"message",T:HQ}]),HQ=k.makeMessageType("streamlayer.sports.events.SummaryResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:GQ}],{localName:"SummaryResponse_ResponseData"}),GQ=k.makeMessageType("streamlayer.sports.events.SummaryResponse.ResponseData.SummaryResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"baseball",kind:"message",T:MW,oneof:"sports"},{no:3,name:"basketball",kind:"message",T:HW,oneof:"sports"},{no:4,name:"hockey",kind:"message",T:rQ,oneof:"sports"},{no:5,name:"soccer",kind:"message",T:wQ,oneof:"sports"}],{localName:"SummaryResponse_ResponseData_SummaryResponseAttributes"}),qQ=k.makeMessageType("streamlayer.sports.events.AdminSummaryRequest",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"organization_id",kind:"scalar",T:9}]),WQ=k.makeMessageType("streamlayer.sports.events.AdminSummaryResponse",()=>[{no:1,name:"data",kind:"message",T:QQ}]),QQ=k.makeMessageType("streamlayer.sports.events.AdminSummaryResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"attributes",kind:"message",T:YQ}],{localName:"AdminSummaryResponse_ResponseData"}),YQ=k.makeMessageType("streamlayer.sports.events.AdminSummaryResponse.ResponseData.SummaryResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"provider_id",kind:"scalar",T:9}],{localName:"AdminSummaryResponse_ResponseData_SummaryResponseAttributes"}),KQ=k.makeMessageType("streamlayer.sports.events.PlayByPlayRequest",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"pagination",kind:"message",T:I6},{no:3,name:"order",kind:"scalar",T:9}]),ZQ=k.makeMessageType("streamlayer.sports.events.PlayByPlayResponse",()=>[{no:1,name:"data",kind:"message",T:XQ},{no:2,name:"meta",kind:"message",T:N6}]),XQ=k.makeMessageType("streamlayer.sports.events.PlayByPlayResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:JQ}],{localName:"PlayByPlayResponse_ResponseData"}),JQ=k.makeMessageType("streamlayer.sports.events.PlayByPlayResponse.ResponseData.PlayByPlayResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"baseball",kind:"message",T:PW,oneof:"sports"},{no:3,name:"basketball",kind:"message",T:qW,oneof:"sports"},{no:4,name:"hockey",kind:"message",T:sQ,oneof:"sports"},{no:5,name:"soccer",kind:"message",T:OQ,oneof:"sports"}],{localName:"PlayByPlayResponse_ResponseData_PlayByPlayResponseAttributes"}),eY=k.makeMessageType("streamlayer.sports.events.ScheduleRequest",()=>[{no:1,name:"filter",kind:"message",T:tY},{no:2,name:"pagination",kind:"message",T:I6}]),tY=k.makeMessageType("streamlayer.sports.events.ScheduleRequest.Filter",()=>[{no:1,name:"date",kind:"scalar",T:9},{no:2,name:"league",kind:"scalar",T:9}],{localName:"ScheduleRequest_Filter"}),nY=k.makeMessageType("streamlayer.sports.events.ScheduleResponse",()=>[{no:1,name:"data",kind:"message",T:DQ,repeated:!0},{no:2,name:"meta",kind:"message",T:N6}]),aY=k.makeMessageType("streamlayer.sports.events.ScheduleDatesRequest",()=>[{no:1,name:"filter",kind:"message",T:rY}]),rY=k.makeMessageType("streamlayer.sports.events.ScheduleDatesRequest.Filter",()=>[{no:2,name:"league",kind:"scalar",T:9}],{localName:"ScheduleDatesRequest_Filter"}),oY=k.makeMessageType("streamlayer.sports.events.ScheduleDatesResponse",()=>[{no:1,name:"data",kind:"scalar",T:9,repeated:!0}]),sY=k.makeMessageType("streamlayer.sports.events.BoxscoreRequest",()=>[{no:1,name:"id",kind:"scalar",T:4}]),iY=k.makeMessageType("streamlayer.sports.events.BoxscoreResponse",()=>[{no:1,name:"data",kind:"message",T:lY}]),lY=k.makeMessageType("streamlayer.sports.events.BoxscoreResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:uY}],{localName:"BoxscoreResponse_ResponseData"}),uY=k.makeMessageType("streamlayer.sports.events.BoxscoreResponse.ResponseData.BoxscoreResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"basketball",kind:"message",T:WW,oneof:"sports"},{no:3,name:"hockey",kind:"message",T:iQ,oneof:"sports"}],{localName:"BoxscoreResponse_ResponseData_BoxscoreResponseAttributes"}),cY=k.makeMessageType("streamlayer.sports.events.StandingsRequest",()=>[{no:1,name:"league",kind:"scalar",T:9}]),dY=k.makeMessageType("streamlayer.sports.events.StandingsResponse",()=>[{no:1,name:"data",kind:"message",T:mY}]),mY=k.makeMessageType("streamlayer.sports.events.StandingsResponse.ResponseData",()=>[{no:1,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:2,name:"attributes",kind:"message",T:fY}],{localName:"StandingsResponse_ResponseData"}),fY=k.makeMessageType("streamlayer.sports.events.StandingsResponse.ResponseData.StandingsResponseAttributes",()=>[{no:2,name:"basketball",kind:"message",T:ZW,oneof:"sports"},{no:3,name:"hockey",kind:"message",T:dQ,oneof:"sports"},{no:4,name:"baseball",kind:"message",T:VW,oneof:"sports"},{no:5,name:"soccer",kind:"message",T:xQ,oneof:"sports"}],{localName:"StandingsResponse_ResponseData_StandingsResponseAttributes"}),pY=k.makeMessageType("streamlayer.sports.events.LineupRequest",()=>[{no:1,name:"id",kind:"scalar",T:4}]),hY=k.makeMessageType("streamlayer.sports.events.LineupResponse",()=>[{no:1,name:"data",kind:"message",T:gY}]),gY=k.makeMessageType("streamlayer.sports.events.LineupResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:yY}],{localName:"LineupResponse_ResponseData"}),yY=k.makeMessageType("streamlayer.sports.events.LineupResponse.ResponseData.LineupResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"soccer",kind:"message",T:RQ,oneof:"sports"},{no:3,name:"basketball",kind:"message",T:XW,oneof:"sports"}],{localName:"LineupResponse_ResponseData_LineupResponseAttributes"}),vY=k.makeMessageType("streamlayer.sports.events.LastGamesRequest",()=>[{no:1,name:"id",kind:"scalar",T:4}]),TY=k.makeMessageType("streamlayer.sports.events.LastGamesResponse",()=>[{no:1,name:"data",kind:"message",T:bY}]),bY=k.makeMessageType("streamlayer.sports.events.LastGamesResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4},{no:2,name:"type",kind:"enum",T:k.getEnumType(ad)},{no:3,name:"attributes",kind:"message",T:kY}],{localName:"LastGamesResponse_ResponseData"}),kY=k.makeMessageType("streamlayer.sports.events.LastGamesResponse.ResponseData.LastGamesResponseAttributes",()=>[{no:1,name:"summary",kind:"message",T:nd},{no:2,name:"soccer",kind:"message",T:ZC,oneof:"sports"},{no:3,name:"basketball",kind:"message",T:YC,oneof:"sports"}],{localName:"LastGamesResponse_ResponseData_LastGamesResponseAttributes"}),SY=k.makeMessageType("streamlayer.sports.events.RetrieveEventIdRequest",()=>[{no:1,name:"id",kind:"scalar",T:9}]),wY=k.makeMessageType("streamlayer.sports.events.RetrieveEventIdResponse",()=>[{no:1,name:"data",kind:"message",T:CY}]),CY=k.makeMessageType("streamlayer.sports.events.RetrieveEventIdResponse.RetrieveEventIdResponseData",()=>[{no:1,name:"id",kind:"scalar",T:4}],{localName:"RetrieveEventIdResponse_RetrieveEventIdResponseData"}),JC={typeName:"streamlayer.sports.events.Events",methods:{list:{name:"List",I:FQ,O:zQ,kind:je.Unary},demoList:{name:"DemoList",I:jQ,O:$Q,kind:je.Unary},summary:{name:"Summary",I:fS,O:pS,kind:je.Unary},adminSummary:{name:"AdminSummary",I:qQ,O:WQ,kind:je.Unary},boxscore:{name:"Boxscore",I:sY,O:iY,kind:je.Unary},standings:{name:"Standings",I:cY,O:dY,kind:je.Unary},playByPlay:{name:"PlayByPlay",I:KQ,O:ZQ,kind:je.Unary},schedule:{name:"Schedule",I:eY,O:nY,kind:je.Unary},scheduleDates:{name:"ScheduleDates",I:aY,O:oY,kind:je.Unary},lineup:{name:"Lineup",I:pY,O:hY,kind:je.Unary},retrieveEventId:{name:"RetrieveEventId",I:SY,O:wY,kind:je.Unary},lastGames:{name:"LastGames",I:vY,O:TY,kind:je.Unary},summarySubscription:{name:"SummarySubscription",I:fS,O:pS,kind:je.ServerStreaming}}},EY=k.makeEnum("streamlayer.sdkSettings.client.VisibleStatus",[{no:0,name:"VISIBLE_STATUS_UNSET",localName:"UNSET"},{no:1,name:"VISIBLE_STATUS_INCOGNITO",localName:"INCOGNITO"},{no:2,name:"VISIBLE_STATUS_VISIBLE",localName:"VISIBLE"}]),_Y=k.makeEnum("streamlayer.sdkSettings.client.MessagesNotify",[{no:0,name:"MESSAGES_NOTIFY_UNSET",localName:"UNSET"},{no:1,name:"MESSAGES_NOTIFY_DISALLOW",localName:"DISALLOW"},{no:2,name:"MESSAGES_NOTIFY_ALLOW",localName:"ALLOW"}]),IY=k.makeEnum("streamlayer.sdkSettings.client.FriendsNotify",[{no:0,name:"FRIENDS_NOTIFY_UNSET",localName:"UNSET"},{no:1,name:"FRIENDS_NOTIFY_DISALLOW",localName:"DISALLOW"},{no:2,name:"FRIENDS_NOTIFY_ALLOW",localName:"ALLOW"}]),NY=k.makeEnum("streamlayer.sdkSettings.client.TwitterNotify",[{no:0,name:"TWITTER_NOTIFY_UNSET",localName:"UNSET"},{no:1,name:"TWITTER_NOTIFY_DISALLOW",localName:"DISALLOW"},{no:2,name:"TWITTER_NOTIFY_ALLOW",localName:"ALLOW"}]),RY=k.makeEnum("streamlayer.sdkSettings.client.CallsSound",[{no:0,name:"CALLS_SOUND_UNSET",localName:"UNSET"},{no:1,name:"CALLS_SOUND_DISALLOW",localName:"DISALLOW"},{no:2,name:"CALLS_SOUND_ALLOW",localName:"ALLOW"}]),LY=k.makeEnum("streamlayer.sdkSettings.client.MessagesSound",[{no:0,name:"MESSAGES_SOUND_UNSET",localName:"UNSET"},{no:1,name:"MESSAGES_SOUND_DISALLOW",localName:"DISALLOW"},{no:2,name:"MESSAGES_SOUND_ALLOW",localName:"ALLOW"}]),OY=k.makeEnum("streamlayer.sdkSettings.client.FriendsSound",[{no:0,name:"FRIENDS_SOUND_UNSET",localName:"UNSET"},{no:1,name:"FRIENDS_SOUND_DISALLOW",localName:"DISALLOW"},{no:2,name:"FRIENDS_SOUND_ALLOW",localName:"ALLOW"}]),AY=k.makeEnum("streamlayer.sdkSettings.client.TwitterSound",[{no:0,name:"TWITTER_SOUND_UNSET",localName:"UNSET"},{no:1,name:"TWITTER_SOUND_DISALLOW",localName:"DISALLOW"},{no:2,name:"TWITTER_SOUND_ALLOW",localName:"ALLOW"}]),eE=k.makeEnum("streamlayer.sdkSettings.client.SettingsAllow",[{no:0,name:"SETTINGS_ALLOW_UNSET",localName:"UNSET"},{no:1,name:"SETTINGS_ALLOW_DISALLOW",localName:"DISALLOW"},{no:2,name:"SETTINGS_ALLOW_ALLOW",localName:"ALLOW"}]),xY=k.makeEnum("streamlayer.sdkSettings.client.ManagedGroupType",[{no:0,name:"MANAGED_GROUP_TYPE_UNSET",localName:"UNSET"},{no:1,name:"MANAGED_GROUP_TYPE_CHAT",localName:"CHAT"},{no:2,name:"MANAGED_GROUP_TYPE_WP",localName:"WP"}]),PY=k.makeEnum("streamlayer.sdkSettings.client.GroupType",[{no:0,name:"GROUP_TYPE_UNSET",localName:"UNSET"},{no:1,name:"GROUP_TYPE_CHAT",localName:"CHAT"},{no:2,name:"GROUP_TYPE_WP",localName:"WP"}]),MY=k.makeMessageType("streamlayer.sdkSettings.client.NotifySettings",()=>[{no:1,name:"allow",kind:"enum",T:k.getEnumType(eE)}]),DY=k.makeMessageType("streamlayer.sdkSettings.client.SoundSettings",()=>[{no:1,name:"allow",kind:"enum",T:k.getEnumType(eE)}]),F5=k.makeMessageType("streamlayer.sdkSettings.client.ClientSettingsNotifications",()=>[{no:1,name:"notify",kind:"message",T:MY},{no:2,name:"sound",kind:"message",T:DY}]),py=k.makeMessageType("streamlayer.sdkSettings.client.ClientSettings",()=>[{no:1,name:"visible_status",kind:"enum",T:k.getEnumType(EY)},{no:2,name:"messages_notify",kind:"enum",T:k.getEnumType(_Y)},{no:3,name:"friends_notify",kind:"enum",T:k.getEnumType(IY)},{no:4,name:"calls_sound",kind:"enum",T:k.getEnumType(RY)},{no:5,name:"messages_sound",kind:"enum",T:k.getEnumType(LY)},{no:6,name:"friends_sound",kind:"enum",T:k.getEnumType(OY)},{no:7,name:"twitter_notify",kind:"enum",T:k.getEnumType(NY)},{no:8,name:"twitter_sound",kind:"enum",T:k.getEnumType(AY)},{no:9,name:"gamification",kind:"message",T:F5},{no:10,name:"watch_party_invitation",kind:"message",T:F5},{no:11,name:"twitter_question",kind:"message",T:F5}]),UY=k.makeMessageType("streamlayer.sdkSettings.client.GetRequest",[]),FY=k.makeMessageType("streamlayer.sdkSettings.client.GetResponse",()=>[{no:1,name:"data",kind:"message",T:VY}]),VY=k.makeMessageType("streamlayer.sdkSettings.client.GetResponse.GetResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:py}],{localName:"GetResponse_GetResponseData"}),jY=k.makeMessageType("streamlayer.sdkSettings.client.UpdateRequest",()=>[{no:2,name:"settings",kind:"message",T:py}]),BY=k.makeMessageType("streamlayer.sdkSettings.client.UpdateResponse",()=>[{no:1,name:"data",kind:"message",T:$Y}]),$Y=k.makeMessageType("streamlayer.sdkSettings.client.UpdateResponse.UpdateResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:py}],{localName:"UpdateResponse_UpdateResponseData"}),zY=k.makeMessageType("streamlayer.sdkSettings.client.GetStreamRequest",()=>[{no:1,name:"id",kind:"scalar",T:9}]),HY=k.makeMessageType("streamlayer.sdkSettings.client.GetStreamResponse",()=>[{no:1,name:"data",kind:"message",T:GY}]),GY=k.makeMessageType("streamlayer.sdkSettings.client.GetStreamResponse.GetResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:Zw}],{localName:"GetStreamResponse_GetResponseData"}),qY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationRequest",[]),WY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationResponse",()=>[{no:1,name:"data",kind:"message",T:QY}]),QY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationResponse.GetResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:Xw}],{localName:"GetOrganizationResponse_GetResponseData"}),YY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationAdvertisingRequest",()=>[{no:1,name:"event_id",kind:"scalar",T:9,opt:!0}]),KY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationAdvertisingResponse",()=>[{no:1,name:"data",kind:"message",T:ZY}]),ZY=k.makeMessageType("streamlayer.sdkSettings.client.GetOrganizationAdvertisingResponse.GetOrganizationAdvertisingResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:oU}],{localName:"GetOrganizationAdvertisingResponse_GetOrganizationAdvertisingResponseData"}),XY=k.makeMessageType("streamlayer.sdkSettings.client.ManagedGroup",()=>[{no:1,name:"group_id",kind:"scalar",T:9},{no:2,name:"fantasy_group_id",kind:"scalar",T:9},{no:3,name:"group_type",kind:"enum",T:k.getEnumType(xY)}]),JY=k.makeMessageType("streamlayer.sdkSettings.client.DeepLinkData",()=>[{no:1,name:"group_id",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:9},{no:3,name:"gamification",kind:"scalar",T:8},{no:4,name:"managed_group",kind:"message",T:XY},{no:5,name:"external_event_id",kind:"scalar",T:9},{no:6,name:"external_group_id",kind:"scalar",T:9},{no:7,name:"group_type",kind:"enum",T:k.getEnumType(PY)}]),eK=k.makeMessageType("streamlayer.sdkSettings.client.GenerateDeepLinkRequest",()=>[{no:1,name:"data",kind:"message",T:JY}]),tK=k.makeMessageType("streamlayer.sdkSettings.client.DeepLink",()=>[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"link_id",kind:"scalar",T:9}]),nK=k.makeMessageType("streamlayer.sdkSettings.client.GenerateDeepLinkResponse",()=>[{no:1,name:"data",kind:"message",T:aK}]),aK=k.makeMessageType("streamlayer.sdkSettings.client.GenerateDeepLinkResponse.GenerateDeepLinkResponseData",()=>[{no:1,name:"attributes",kind:"message",T:tK}],{localName:"GenerateDeepLinkResponse_GenerateDeepLinkResponseData"}),rK=k.makeMessageType("streamlayer.sdkSettings.client.StreamSubscriptionRequest",()=>[{no:1,name:"id",kind:"scalar",T:9}]),oK=k.makeMessageType("streamlayer.sdkSettings.client.OrganizationSubscriptionRequest",[]),sK=k.makeMessageType("streamlayer.sdkSettings.client.StreamSubscriptionResponse",()=>[{no:1,name:"data",kind:"message",T:iK}]),iK=k.makeMessageType("streamlayer.sdkSettings.client.StreamSubscriptionResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:Zw}],{localName:"StreamSubscriptionResponse_ResponseData"}),lK=k.makeMessageType("streamlayer.sdkSettings.client.OrganizationSubscriptionResponse",()=>[{no:1,name:"data",kind:"message",T:uK}]),uK=k.makeMessageType("streamlayer.sdkSettings.client.OrganizationSubscriptionResponse.ResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:Xw}],{localName:"OrganizationSubscriptionResponse_ResponseData"}),f2={typeName:"streamlayer.sdkSettings.client.Client",methods:{get:{name:"Get",I:UY,O:FY,kind:je.Unary},update:{name:"Update",I:jY,O:BY,kind:je.Unary},getStream:{name:"GetStream",I:zY,O:HY,kind:je.Unary},getOrganization:{name:"GetOrganization",I:qY,O:WY,kind:je.Unary},getOrganizationAdvertising:{name:"GetOrganizationAdvertising",I:YY,O:KY,kind:je.Unary},generateDeepLink:{name:"GenerateDeepLink",I:eK,O:nK,kind:je.Unary},streamSubscription:{name:"StreamSubscription",I:rK,O:sK,kind:je.ServerStreaming},organizationSubscription:{name:"OrganizationSubscription",I:oK,O:lK,kind:je.ServerStreaming}}},cK=k.makeMessageType("streamlayer.users.PublicChatUser",()=>[{no:1,name:"name",kind:"scalar",T:9}]),dK=k.makeMessageType("streamlayer.users.UserAttributes",()=>[{no:1,name:"username",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"alias",kind:"scalar",T:9},{no:5,name:"avatar",kind:"scalar",T:9},{no:6,name:"public_chat",kind:"message",T:cK},{no:7,name:"public_name",kind:"scalar",T:9}]),hy=k.makeMessageType("streamlayer.users.User",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:dK}]),mK=k.makeMessageType("streamlayer.users.LoginRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"password",kind:"scalar",T:9}]),fK=k.makeMessageType("streamlayer.users.AuthResponse",()=>[{no:1,name:"meta",kind:"message",T:pK},{no:2,name:"data",kind:"message",T:hy}]),pK=k.makeMessageType("streamlayer.users.AuthResponse.AuthResponseMetadata",()=>[{no:1,name:"jwt",kind:"scalar",T:9},{no:3,name:"getstream",kind:"scalar",T:9}],{localName:"AuthResponse_AuthResponseMetadata"}),hK=k.makeMessageType("streamlayer.users.RegisterRequest",()=>[{no:1,name:"id",kind:"scalar",T:9}]),gK=k.makeMessageType("streamlayer.users.Referral",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"watching_game",kind:"scalar",T:9}]),yK=k.makeMessageType("streamlayer.users.RegisterResponse",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"requires_activation",kind:"scalar",T:8},{no:3,name:"referral",kind:"message",T:gK}]),vK=k.makeMessageType("streamlayer.users.RequestPasswordRequest",()=>[{no:1,name:"id",kind:"scalar",T:9}]),TK=k.makeMessageType("streamlayer.users.RequestPasswordResponse",()=>[{no:1,name:"requested",kind:"scalar",T:8},{no:2,name:"uid",kind:"scalar",T:9}]),bK=k.makeMessageType("streamlayer.users.MeRequest",[]),kK=k.makeMessageType("streamlayer.users.MeResponse",()=>[{no:1,name:"data",kind:"message",T:hy}]),SK=k.makeMessageType("streamlayer.users.UpdateMetadataRequest",()=>[{no:1,name:"set_name",kind:"scalar",T:9,oneof:"name"},{no:2,name:"del_name",kind:"scalar",T:9,oneof:"name"}]),wK=k.makeMessageType("streamlayer.users.UpdateAvatarRequest",()=>[{no:1,name:"username",kind:"scalar",T:9},{no:2,name:"set_avatar",kind:"scalar",T:9,oneof:"avatar"},{no:3,name:"del_avatar",kind:"scalar",T:9,oneof:"avatar"}]),CK=k.makeMessageType("streamlayer.users.UpdateAvatarResponse",[]),EK=k.makeMessageType("streamlayer.users.UpdatePublicChatNameRequest",()=>[{no:1,name:"username",kind:"scalar",T:9},{no:2,name:"set_name",kind:"scalar",T:9,oneof:"name"},{no:3,name:"del_name",kind:"scalar",T:9,oneof:"name"}]),_K=k.makeMessageType("streamlayer.users.UpdatePublicChatNameResponse",[]),IK=k.makeMessageType("streamlayer.users.UpdatePublicNameRequest",()=>[{no:1,name:"username",kind:"scalar",T:9},{no:2,name:"set_name",kind:"scalar",T:9,oneof:"name"},{no:3,name:"del_name",kind:"scalar",T:9,oneof:"name"}]),NK=k.makeMessageType("streamlayer.users.UpdatePublicNameResponse",[]),RK=k.makeMessageType("streamlayer.users.UpdateMetadataResponse",[]),LK=k.makeMessageType("streamlayer.users.InviteRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"referral",kind:"message",T:OK}]),OK=k.makeMessageType("streamlayer.users.InviteRequest.InviteReferral",()=>[{no:1,name:"watching_game",kind:"scalar",T:9}],{localName:"InviteRequest_InviteReferral"}),AK=k.makeMessageType("streamlayer.users.InviteResponse",[]),xK=k.makeMessageType("streamlayer.users.BypassAuthRequest",()=>[{no:1,name:"user_key",kind:"scalar",T:9},{no:2,name:"schema",kind:"scalar",T:9},{no:3,name:"init",kind:"scalar",T:8},{no:4,name:"inviter_key",kind:"scalar",T:9,opt:!0}]),PK=k.makeMessageType("streamlayer.users.BypassAuthResponse",()=>[{no:1,name:"meta",kind:"message",T:MK},{no:2,name:"data",kind:"message",T:hy,opt:!0}]),MK=k.makeMessageType("streamlayer.users.BypassAuthResponse.AuthResponseMetadata",()=>[{no:1,name:"jwt",kind:"scalar",T:9,opt:!0},{no:3,name:"token",kind:"scalar",T:9,opt:!0},{no:4,name:"getstream",kind:"scalar",T:9},{no:5,name:"inviter_key",kind:"scalar",T:9,opt:!0}],{localName:"BypassAuthResponse_AuthResponseMetadata"}),DK=k.makeMessageType("streamlayer.users.GetFriendsRequest",()=>[{no:1,name:"last_created_at",kind:"scalar",T:9,opt:!0},{no:2,name:"limit",kind:"scalar",T:5,opt:!0}]),UK=k.makeMessageType("streamlayer.users.GetFriendsResponse",()=>[{no:1,name:"data",kind:"message",T:VK,repeated:!0},{no:2,name:"metadata",kind:"message",T:FK}]),FK=k.makeMessageType("streamlayer.users.GetFriendsResponse.ResponseMeta",()=>[{no:1,name:"last_created_at",kind:"scalar",T:9}],{localName:"GetFriendsResponse_ResponseMeta"}),VK=k.makeMessageType("streamlayer.users.GetFriendsResponse.FriendData",()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"tinode_id",kind:"scalar",T:9},{no:3,name:"sl_id",kind:"scalar",T:9}],{localName:"GetFriendsResponse_FriendData"}),gy={typeName:"streamlayer.users.Users",methods:{login:{name:"Login",I:mK,O:fK,kind:je.Unary},register:{name:"Register",I:hK,O:yK,kind:je.Unary},requestPassword:{name:"RequestPassword",I:vK,O:TK,kind:je.Unary},me:{name:"Me",I:bK,O:kK,kind:je.Unary},invite:{name:"Invite",I:LK,O:AK,kind:je.Unary},bypassAuth:{name:"BypassAuth",I:xK,O:PK,kind:je.Unary},updateMetadata:{name:"UpdateMetadata",I:SK,O:RK,kind:je.Unary},updateAvatar:{name:"UpdateAvatar",I:wK,O:CK,kind:je.Unary},updatePublicChatName:{name:"UpdatePublicChatName",I:EK,O:_K,kind:je.Unary},updatePublicName:{name:"UpdatePublicName",I:IK,O:NK,kind:je.Unary},getFriends:{name:"GetFriends",I:DK,O:UK,kind:je.Unary}}};var Gi;(function(n){n.SCHEMA="schema",n.EXTERNAL_TOKEN="eToken",n.TOKEN="token"})(Gi||(Gi={}));class jK extends Gz{constructor(){super("user");D(this,"setSchema",o=>{this.write(Gi.SCHEMA,o)});D(this,"getSchema",()=>this.read(Gi.SCHEMA));D(this,"setToken",o=>{this.write(Gi.TOKEN,o)});D(this,"getToken",()=>this.read(Gi.TOKEN));D(this,"setExternalToken",o=>{this.write(Gi.EXTERNAL_TOKEN,o)});D(this,"getExternalToken",()=>this.read(Gi.EXTERNAL_TOKEN));D(this,"removeToken",()=>{this.remove(Gi.TOKEN)})}}var hS;(function(n){n.DISABLED="disabled",n.INITIALIZATION="initialization",n.READY="ready",n.FAILED="failed",n.SUSPENDED="suspended"})(hS||(hS={}));const Oo={typeName:"streamlayer.interactive.feed.Feed",methods:{get:{name:"Get",I:sD,O:iD,kind:je.Unary},subscription:{name:"Subscription",I:dM,O:mM,kind:je.ServerStreaming},votingSubscription:{name:"VotingSubscription",I:pM,O:hM,kind:je.ServerStreaming},questionSubscription:{name:"QuestionSubscription",I:vM,O:TM,kind:je.ServerStreaming},questionByUser:{name:"QuestionByUser",I:SM,O:wM,kind:je.Unary},syncQuestion:{name:"SyncQuestion",I:EM,O:IM,kind:je.Unary},getQuestion:{name:"GetQuestion",I:RM,O:LM,kind:je.Unary},questionDetail:{name:"QuestionDetail",I:AM,O:xM,kind:je.Unary},submitAnswer:{name:"SubmitAnswer",I:MM,O:UM,kind:je.Unary},submitInplay:{name:"SubmitInplay",I:VM,O:BM,kind:je.Unary},skipQuestion:{name:"SkipQuestion",I:$M,O:HM,kind:je.Unary},pickHistory:{name:"PickHistory",I:qM,O:WM,kind:je.Unary},insightHistory:{name:"InsightHistory",I:KM,O:JM,kind:je.Unary},tweetHistory:{name:"TweetHistory",I:tD,O:nD,kind:je.Unary},promotionHistory:{name:"PromotionHistory",I:uD,O:cD,kind:je.Unary},list:{name:"List",I:fD,O:hD,kind:je.Unary},item:{name:"Item",I:yD,O:vD,kind:je.Unary},feedSubscription:{name:"FeedSubscription",I:TD,O:bD,kind:je.ServerStreaming}}},BK=k.makeEnum("streamlayer.interactive.leaderboard.LeaderboardType",[{no:0,name:"LEADERBOARD_TYPE_UNSET",localName:"UNSET"},{no:1,name:"LEADERBOARD_TYPE_TOURNAMENT",localName:"TOURNAMENT"},{no:2,name:"LEADERBOARD_TYPE_EVENT",localName:"EVENT"}]),tE=k.makeMessageType("streamlayer.interactive.leaderboard.LeaderboardData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:k.getEnumType(BK)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"event_ids",kind:"scalar",T:3,repeated:!0},{no:5,name:"leaderboards",kind:"message",T:tE,repeated:!0},{no:6,name:"created_at",kind:"scalar",T:3}]),yy=k.makeMessageType("streamlayer.interactive.leaderboard.LeaderboardItem",()=>[{no:1,name:"streak",kind:"scalar",T:5},{no:2,name:"correct",kind:"scalar",T:5},{no:3,name:"incorrect",kind:"scalar",T:5},{no:4,name:"points",kind:"scalar",T:5},{no:5,name:"rank",kind:"scalar",T:5},{no:6,name:"name",kind:"scalar",T:9},{no:7,name:"avatar",kind:"scalar",T:9},{no:8,name:"user_id",kind:"scalar",T:9},{no:9,name:"recent_correct",kind:"scalar",T:5},{no:10,name:"streak_loss",kind:"scalar",T:5},{no:11,name:"friends_rank",kind:"scalar",T:5},{no:12,name:"in_top",kind:"scalar",T:5}]),$K=k.makeMessageType("streamlayer.interactive.leaderboard.LeaderboardSummaryItem",()=>[{no:1,name:"summary",kind:"message",T:yy},{no:2,name:"percentage",kind:"message",T:zK}]),zK=k.makeMessageType("streamlayer.interactive.leaderboard.LeaderboardSummaryItem.SummaryPercentage",()=>[{no:1,name:"correct",kind:"scalar",T:5},{no:2,name:"average",kind:"scalar",T:5}],{localName:"LeaderboardSummaryItem_SummaryPercentage"}),HK=k.makeMessageType("streamlayer.interactive.leaderboard.ListRequest",()=>[{no:1,name:"pagination",kind:"message",T:w6},{no:2,name:"users_ids",kind:"scalar",T:9,repeated:!0},{no:3,name:"event_id",kind:"scalar",T:4},{no:4,name:"leaderboard_id",kind:"scalar",T:9}]),GK=k.makeMessageType("streamlayer.interactive.leaderboard.ListResponse",()=>[{no:1,name:"data",kind:"message",T:qK,repeated:!0},{no:2,name:"meta",kind:"message",T:WK}]),qK=k.makeMessageType("streamlayer.interactive.leaderboard.ListResponse.ListResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:yy}],{localName:"ListResponse_ListResponseData"}),WK=k.makeMessageType("streamlayer.interactive.leaderboard.ListResponse.ListResponseMeta",()=>[{no:1,name:"count",kind:"scalar",T:5},{no:2,name:"page",kind:"scalar",T:5},{no:3,name:"page_size",kind:"scalar",T:5}],{localName:"ListResponse_ListResponseMeta"}),QK=k.makeMessageType("streamlayer.interactive.leaderboard.SummaryRequest",()=>[{no:1,name:"event_id",kind:"scalar",T:4},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"leaderboard_id",kind:"scalar",T:9},{no:4,name:"users_ids",kind:"scalar",T:9,repeated:!0}]),YK=k.makeMessageType("streamlayer.interactive.leaderboard.SummaryResponse",()=>[{no:1,name:"data",kind:"message",T:KK}]),KK=k.makeMessageType("streamlayer.interactive.leaderboard.SummaryResponse.SummaryResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:$K}],{localName:"SummaryResponse_SummaryResponseData"}),ZK=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardsRequest",()=>[{no:1,name:"organization_id",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:9}]),XK=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardsResponse",()=>[{no:2,name:"data",kind:"message",T:JK}]),JK=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardsResponse.EventLeaderboardsResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:tE}],{localName:"EventLeaderboardsResponse_EventLeaderboardsResponseData"}),eZ=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"organization_id",kind:"scalar",T:9},{no:3,name:"pagination",kind:"message",T:w6},{no:4,name:"sort",kind:"message",T:sM}]),tZ=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardResponse",()=>[{no:1,name:"data",kind:"message",T:nZ,repeated:!0},{no:2,name:"meta",kind:"message",T:aZ}]),nZ=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardResponse.ListResponseData",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"attributes",kind:"message",T:yy}],{localName:"EventLeaderboardResponse_ListResponseData"}),aZ=k.makeMessageType("streamlayer.interactive.leaderboard.EventLeaderboardResponse.ListResponseMeta",()=>[{no:1,name:"count",kind:"scalar",T:5},{no:2,name:"page",kind:"scalar",T:5},{no:3,name:"page_size",kind:"scalar",T:5}],{localName:"EventLeaderboardResponse_ListResponseMeta"}),nE={typeName:"streamlayer.interactive.leaderboard.Leaderboard",methods:{list:{name:"List",I:HK,O:GK,kind:je.Unary},summary:{name:"Summary",I:QK,O:YK,kind:je.Unary},eventLeaderboards:{name:"EventLeaderboards",I:ZK,O:XK,kind:je.Unary},eventLeaderboard:{name:"EventLeaderboard",I:eZ,O:tZ,kind:je.Unary}}};var gS;(function(n){n.SHOWED="showed"})(gS||(gS={}));var yS;(function(n){n.ALLOWED="allowed",n.DISALLOWED="disallowed"})(yS||(yS={}));var vS;(function(n){n.UNKNOWN="unknown",n.ALREADY_VOTED="already_voted"})(vS||(vS={}));var TS;(function(n){n.ONBOARDING="onboarding",n.ONBOARDING_IO="onboarding_io"})(TS||(TS={}));d2("deep_link");d2("bypass");new jK;d2("video_player");ye.FACTOID+"",ye.POLL+"",ye.TRIVIA+"",ye.PREDICTION+"",ye.TWEET+"";const rZ=k.makeMessageType("streamlayer.shortLinks.GenerateRequest",()=>[{no:1,name:"web",kind:"scalar",T:9},{no:2,name:"mobile",kind:"scalar",T:9}]),oZ=k.makeMessageType("streamlayer.shortLinks.GenerateResponse",()=>[{no:1,name:"data",kind:"message",T:sZ}]),sZ=k.makeMessageType("streamlayer.shortLinks.GenerateResponse.GenerateResponseData",()=>[{no:1,name:"link",kind:"scalar",T:9}],{localName:"GenerateResponse_GenerateResponseData"}),iZ={typeName:"streamlayer.shortLinks.LinksClient",methods:{generate:{name:"Generate",I:rZ,O:oZ,kind:je.Unary}}};var bS;(function(n){n.Unset="unset",n.Required="required",n.Optional="optional",n.Completed="completed",n.Disabled="disabled",n.Unavailable="unavailable"})(bS||(bS={}));ye.POLL,ye.PREDICTION,ye.TRIVIA;const lZ={[yt.GAMES]:!0},aE=x("div")({name:"Navigation",class:"n6tbwuy",propsAsIs:!1}),uZ=()=>OC,kS=x(uZ())({name:"NavigationItems",class:"n1up4z7v",propsAsIs:!0}),cZ=()=>wt,dZ=x(cZ())({name:"ButtonIcon",class:"b11wpe79",propsAsIs:!0}),mZ=x("div")({name:"Container",class:"calnblm",propsAsIs:!1}),fZ=x("div")({name:"Title",class:"t1438p52",propsAsIs:!1}),pZ=x("div")({name:"CloseIconWrap",class:"c17srj38",propsAsIs:!1}),hZ=()=>wt,gZ=x(hZ())({name:"CloseIcon",class:"clqia8k",propsAsIs:!0}),yZ=()=>wt,vZ=x(yZ())({name:"DashboardIcon",class:"df5w958",propsAsIs:!0}),TZ="h12x6aiv";Q.forwardRef(({sdk:n,className:a},o)=>{const l=()=>{n.closeFeature()};return w.jsxs(aE,{className:Su(a,TZ),children:[w.jsxs(mZ,{children:[w.jsxs(fZ,{children:[w.jsx(vZ,{name:"dashboard"}),"Dashboard"]}),w.jsx(pZ,{onClick:l,children:w.jsx(gZ,{name:"icon-cross"})})]}),w.jsx("div",{ref:o})]})});Q.forwardRef(({sdk:n,className:a},o)=>{const l=Ut(n.sdkStore.organizationSettings),c=Ut(n.sdkStore.streamSettings),p=Ut(n.getActiveFeature()),f=Q.useMemo(()=>{const b=(c==null?void 0:c.data)||(l==null?void 0:l.data);return b!=null&&b.overlays?b.overlays:[]},[l,c]),y=Q.useMemo(()=>[...f.filter(({enableSdkButton:b,type:C})=>C===yt.GAMES||b).map(b=>({id:b.type,onClick:()=>n.openFeature(b.type),disabled:!(b.type in lZ),label:b.name,icon:w.jsx("img",{src:b.icon,alt:""}),position:b.position*10}))].sort((b,C)=>b.position-C.position),[f,n]);return w.jsxs(aE,{className:a,children:[y.length!==0&&w.jsx(kS,{children:[w.jsx(sm,{id:"Channels",onClick:()=>n.closeFeature(),label:"Channels",active:p===0},"Channels"),...y.map(b=>b.id===yt.GAMES?w.jsx(sm,{...b,active:b.id===p,label:"StreamLayer +",id:"featuredGroups",icon:w.jsx(dZ,{name:"icon-btn-feature-groups","data-selected":b.id===p})},b.id):w.jsx(sm,{...b,icon:void 0,active:b.id===p},b.id))]}),!y.length&&w.jsx(kS,{children:[w.jsx(sm,{id:"empty",label:"No Features...",active:!1,disabled:!0},"empty")]}),w.jsx("div",{ref:o})]})});const w9=k.makeEnum("streamlayer.analytics.v1.interactions.InteractionActionType",[{no:0,name:"INTERACTION_ACTION_TYPE_UNSET",localName:"UNSET"},{no:1,name:"INTERACTION_ACTION_TYPE_TAP",localName:"TAP"},{no:2,name:"INTERACTION_ACTION_TYPE_CALL",localName:"CALL"},{no:3,name:"INTERACTION_ACTION_TYPE_MESSAGE",localName:"MESSAGE"},{no:4,name:"INTERACTION_ACTION_TYPE_SCROLL",localName:"SCROLL"}]),Ys=k.makeEnum("streamlayer.analytics.v1.notifications.NotificationKind",[{no:0,name:"NOTIFICATION_KIND_UNSET",localName:"UNSET"},{no:1,name:"NOTIFICATION_KIND_MESSAGE",localName:"MESSAGE"},{no:2,name:"NOTIFICATION_KIND_CALL",localName:"CALL"},{no:3,name:"NOTIFICATION_KIND_TWITTER",localName:"TWITTER"},{no:4,name:"NOTIFICATION_KIND_WAVE",localName:"WAVE"},{no:5,name:"NOTIFICATION_KIND_INPLAY",localName:"INPLAY"},{no:6,name:"NOTIFICATION_KIND_GROUP_CALL",localName:"GROUP_CALL"},{no:7,name:"NOTIFICATION_KIND_MISSED_CALL",localName:"MISSED_CALL"},{no:8,name:"NOTIFICATION_KIND_MISSED_GROUP_CALL",localName:"MISSED_GROUP_CALL"},{no:9,name:"NOTIFICATION_KIND_WATCH_PARTY",localName:"WATCH_PARTY"},{no:10,name:"NOTIFICATION_KIND_POLLS",localName:"POLLS"}]),C9=k.makeEnum("streamlayer.analytics.v1.notifications.NotificationType",[{no:0,name:"NOTIFICATION_TYPE_UNSET",localName:"UNSET"},{no:1,name:"NOTIFICATION_TYPE_IN_APP",localName:"IN_APP"},{no:2,name:"NOTIFICATION_TYPE_PUSH",localName:"PUSH"}]),bZ=k.makeEnum("streamlayer.analytics.v1.permissions.PermissionType",[{no:0,name:"PERMISSION_TYPE_UNSET",localName:"UNSET"},{no:1,name:"PERMISSION_TYPE_ADDRESS_BOOK",localName:"ADDRESS_BOOK"},{no:2,name:"PERMISSION_TYPE_CALLING",localName:"CALLING"},{no:3,name:"PERMISSION_TYPE_CAMERA",localName:"CAMERA"}]),kZ=k.makeEnum("streamlayer.analytics.v1.waves.WaveCategory",[{no:0,name:"WAVE_CATEGORY_UNSET",localName:"UNSET"},{no:1,name:"WAVE_CATEGORY_WATCHING",localName:"WATCHING"},{no:2,name:"WAVE_CATEGORY_MESSAGING",localName:"MESSAGING"},{no:3,name:"WAVE_CATEGORY_VOICING",localName:"VOICING"}]),SS=k.makeMessageType("streamlayer.analytics.v2.streaming.SendResponse",()=>[{no:1,name:"result",kind:"enum",T:k.getEnumType(lP)}]),SZ=k.makeMessageType("streamlayer.analytics.v2.streaming.SendExtra",[]),vr=k.makeMessageType("streamlayer.analytics.v2.streaming.CommonData",()=>[{no:1,name:"event_id",kind:"scalar",T:4,opt:!0},{no:2,name:"category",kind:"enum",T:k.getEnumType(Ua),opt:!0},{no:3,name:"kind",kind:"enum",T:k.getEnumType(ka),opt:!0},{no:4,name:"screen_orientation",kind:"enum",T:k.getEnumType(c9),opt:!0},{no:5,name:"session_id",kind:"scalar",T:9,opt:!0},{no:6,name:"overlay_session_id",kind:"scalar",T:9,opt:!0},{no:7,name:"topic_id",kind:"scalar",T:9,opt:!0},{no:8,name:"topic_type",kind:"enum",T:k.getEnumType(ia),opt:!0},{no:9,name:"parent_topic_id",kind:"scalar",T:9,opt:!0},{no:10,name:"parent_topic_type",kind:"enum",T:k.getEnumType(ia),opt:!0},{no:11,name:"participants_count",kind:"scalar",T:13,opt:!0},{no:12,name:"route_map",kind:"scalar",T:9,opt:!0},{no:13,name:"track_timestamp",kind:"scalar",T:4,opt:!0},{no:14,name:"topic_sub_type",kind:"enum",T:k.getEnumType(Qs),opt:!0},{no:15,name:"country",kind:"scalar",T:9,opt:!0}]),wZ=k.makeMessageType("streamlayer.analytics.v2.streaming.SendAuthenticationsMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),CZ=k.makeMessageType("streamlayer.analytics.v2.streaming.SendCallsMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),EZ=k.makeMessageType("streamlayer.analytics.v2.streaming.SendConversationsMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),_Z=k.makeMessageType("streamlayer.analytics.v2.streaming.SendInteractionsMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"action_type",kind:"enum",T:k.getEnumType(w9)}]),IZ=k.makeMessageType("streamlayer.analytics.v2.streaming.EventOpenedMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),NZ=k.makeMessageType("streamlayer.analytics.v2.streaming.SendInvitationsMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"category",kind:"enum",T:k.getEnumType(m9)},{no:3,name:"from",kind:"enum",T:k.getEnumType(l2)}]),RZ=k.makeMessageType("streamlayer.analytics.v2.streaming.LaunchButtonMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),LZ=k.makeMessageType("streamlayer.analytics.v2.streaming.NotificationMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"notification_kind",kind:"enum",T:k.getEnumType(Ys)},{no:3,name:"notification_type",kind:"enum",T:k.getEnumType(C9)}]),OZ=k.makeMessageType("streamlayer.analytics.v2.streaming.PermissionMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"permission",kind:"enum",T:k.getEnumType(bZ)}]),AZ=k.makeMessageType("streamlayer.analytics.v2.streaming.ButtonInitializedMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),xZ=k.makeMessageType("streamlayer.analytics.v2.streaming.WavesMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"category",kind:"enum",T:k.getEnumType(kZ)}]),PZ=k.makeMessageType("streamlayer.analytics.v2.streaming.HeartbeatMessage",()=>[{no:1,name:"common",kind:"message",T:vr}]),MZ=k.makeMessageType("streamlayer.analytics.v2.streaming.GamesMessage",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"poll_opened_from",kind:"enum",T:k.getEnumType(Io)}]),DZ=k.makeMessageType("streamlayer.analytics.v2.streaming.Login",()=>[{no:1,name:"common",kind:"message",T:vr},{no:2,name:"token",kind:"scalar",T:9}]),UZ=k.makeMessageType("streamlayer.analytics.v2.streaming.Logout",()=>[{no:1,name:"common",kind:"message",T:vr}]),wS=k.makeMessageType("streamlayer.analytics.v2.streaming.SendRequest",()=>[{no:1,name:"auth",kind:"message",T:wZ,oneof:"message"},{no:2,name:"call",kind:"message",T:CZ,oneof:"message"},{no:3,name:"conversations",kind:"message",T:EZ,oneof:"message"},{no:4,name:"interactions",kind:"message",T:_Z,oneof:"message"},{no:5,name:"event_opened",kind:"message",T:IZ,oneof:"message"},{no:6,name:"invitation",kind:"message",T:NZ,oneof:"message"},{no:7,name:"launch_button",kind:"message",T:RZ,oneof:"message"},{no:8,name:"notification",kind:"message",T:LZ,oneof:"message"},{no:9,name:"permission",kind:"message",T:OZ,oneof:"message"},{no:10,name:"button_init",kind:"message",T:AZ,oneof:"message"},{no:11,name:"waves",kind:"message",T:xZ,oneof:"message"},{no:12,name:"heartbeat",kind:"message",T:PZ,oneof:"message"},{no:13,name:"games",kind:"message",T:MZ,oneof:"message"},{no:14,name:"login",kind:"message",T:DZ,oneof:"message"},{no:15,name:"logout",kind:"message",T:UZ,oneof:"message"},{no:100,name:"extra",kind:"message",T:SZ}]),rE={typeName:"streamlayer.analytics.v2.streaming.AnalyticsService",methods:{send:{name:"Send",I:wS,O:SS,kind:je.ClientStreaming},unary:{name:"Unary",I:wS,O:SS,kind:je.Unary}}};function FZ(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var oE={exports:{}},Vn=oE.exports={},Ks,Zs;function E9(){throw new Error("setTimeout has not been defined")}function _9(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ks=setTimeout:Ks=E9}catch{Ks=E9}try{typeof clearTimeout=="function"?Zs=clearTimeout:Zs=_9}catch{Zs=_9}})();function sE(n){if(Ks===setTimeout)return setTimeout(n,0);if((Ks===E9||!Ks)&&setTimeout)return Ks=setTimeout,setTimeout(n,0);try{return Ks(n,0)}catch{try{return Ks.call(null,n,0)}catch{return Ks.call(this,n,0)}}}function VZ(n){if(Zs===clearTimeout)return clearTimeout(n);if((Zs===_9||!Zs)&&clearTimeout)return Zs=clearTimeout,clearTimeout(n);try{return Zs(n)}catch{try{return Zs.call(null,n)}catch{return Zs.call(this,n)}}}var nl=[],pm=!1,Yc,Wh=-1;function jZ(){!pm||!Yc||(pm=!1,Yc.length?nl=Yc.concat(nl):Wh=-1,nl.length&&iE())}function iE(){if(!pm){var n=sE(jZ);pm=!0;for(var a=nl.length;a;){for(Yc=nl,nl=[];++Wh<a;)Yc&&Yc[Wh].run();Wh=-1,a=nl.length}Yc=null,pm=!1,VZ(n)}}Vn.nextTick=function(n){var a=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)a[o-1]=arguments[o];nl.push(new lE(n,a)),nl.length===1&&!pm&&sE(iE)};function lE(n,a){this.fun=n,this.array=a}lE.prototype.run=function(){this.fun.apply(null,this.array)};Vn.title="browser";Vn.browser=!0;Vn.env={};Vn.argv=[];Vn.version="";Vn.versions={};function sl(){}Vn.on=sl;Vn.addListener=sl;Vn.once=sl;Vn.off=sl;Vn.removeListener=sl;Vn.removeAllListeners=sl;Vn.emit=sl;Vn.prependListener=sl;Vn.prependOnceListener=sl;Vn.listeners=function(n){return[]};Vn.binding=function(n){throw new Error("process.binding is not supported")};Vn.cwd=function(){return"/"};Vn.chdir=function(n){throw new Error("process.chdir is not supported")};Vn.umask=function(){return 0};var BZ=oE.exports;const St=FZ(BZ),$Z=mw({level:"trace",enabled:typeof window<"u"&&!!window.localStorage.getItem("SL_DEBUG"),browser:{write:n=>{console.log(n)}}}),il=(n,a)=>$Z.child({name:n},a);class zZ extends Event{constructor(o,l){super(o);D(this,"slEventBus");this.slEventBus=l}}const HZ=il("event-bus");class GZ{constructor(a="sl-event-bus"){D(this,"name");D(this,"listeners");D(this,"emit",(a,o)=>{const l=new zZ(this.name,{...o,type:a});HZ.debug(l,"Emitting event"),window.dispatchEvent(l)});D(this,"destroy",()=>{this.listeners.forEach(a=>{window.removeEventListener(this.name,a),this.listeners.delete(a)}),this.listeners.clear()});this.name=a,this.listeners=new Set}listen(a){return window.addEventListener(this.name,a),this.listeners.add(a),()=>{this.off(a)}}off(a){window.removeEventListener(this.name,a),this.listeners.delete(a)}}class qZ{}window.slStore=Object.create(null);class L6{constructor(a,o){D(this,"store");D(this,"name");this.store=a,this.name=o}getStore(){return this.store}}const WZ=n=>{const a=Object.keys(n);return qO(a.map(o=>n[o].getStore()),(...o)=>Object.fromEntries(a.map((l,c)=>[l,o[c]])))};class Xc extends L6{constructor(){super(...arguments);D(this,"getValues",()=>this.getStore().get());D(this,"getValue",o=>this.getStore().get()[o]);D(this,"setValue",(o,l)=>this.getStore().setKey(o,l));D(this,"subscribe",(...o)=>this.getStore().subscribe(...o));D(this,"unsubscribe",()=>this.getStore().off())}}const Ro=n=>n9(n);var Yi;(function(n){n.ORGANIZATION="ORGANIZATION",n.STREAM="STREAM"})(Yi||(Yi={}));const QZ={[yt.BETTING]:"betting",[yt.GAMES]:"games",[yt.PUBLIC_CHAT]:"publicChat",[yt.TWITTER]:"twitter"};var a2;(function(n){n.Ready="ready",n.Suspended="suspended"})(a2||(a2={}));class uE{constructor({settings:a,...o},l){D(this,"status");D(this,"source");D(this,"config");D(this,"settings");D(this,"listeners",new Set);D(this,"settingsKey");D(this,"enable",()=>{this.status.set(a2.Ready)});D(this,"disable",()=>{this.status.set(a2.Suspended)});D(this,"setFeatureConfig",({settings:a,...o})=>{var c;let l;for(l in o)this.config.setValue(l,o[l]);if(((c=a==null?void 0:a.overlaySettings)==null?void 0:c.case)!==void 0&&(a==null?void 0:a.overlaySettings.case)===this.settingsKey){const p=a.overlaySettings.value;if(p!==void 0){let f;for(f in p)p[f]!==0&&p[f]!==""&&this.settings.setValue(f,p[f])}}});D(this,"update",(a,o)=>{this.source===Yi.STREAM&&o===Yi.ORGANIZATION||(this.setFeatureConfig(a),this.source=o)});this.settingsKey=QZ[o.type],this.status=ku(a2.Suspended),this.config=new Xc(Ro(o),`feature:config:${this.settingsKey}`),this.settingsKey!==void 0&&(a==null?void 0:a.overlaySettings.case)===this.settingsKey?this.settings=new Xc(Ro(a.overlaySettings.value),`feature:settings:${this.settingsKey}`):this.settings=new Xc(Ro({}),`feature:settings:${this.settingsKey}`),this.source=l}get featureConfig(){return this.config.getStore()}get featureSettings(){return this.settings.getStore()}registerEventListener(a){this.listeners.add(a)}fireEvent(a){for(const o of this.listeners.values())try{o.onEvent(a)}catch(l){console.error(l)}}}class Lo extends L6{constructor(){super(...arguments);D(this,"getValue",()=>this.getStore().get());D(this,"setValue",o=>this.getStore().set(o));D(this,"subscribe",o=>this.getStore().subscribe(o));D(this,"unsubscribe",()=>this.getStore().off())}getValues(){throw new Error("not implemented")}listen(o){return this.getStore().listen(o)}get(){return this.getStore().get()}}const Sa=n=>ku(n);class ei extends L6{constructor(o,l,c){super(o,`api:${l}`);D(this,"atomStore");D(this,"getAtomStore",()=>this.atomStore);D(this,"getValue",async()=>{const o=this.getStore();if(o.value===void 0)throw new Error("no store");return await o.value.promise,o.get().data});D(this,"getValues",()=>this.getStore().get());D(this,"setValue",o=>this.getStore().set({loading:!1,data:o==null?void 0:o.data}));D(this,"subscribe",o=>this.getStore().subscribe(o));D(this,"unsubscribe",()=>{throw new Error("not implemented")});D(this,"invalidate",()=>{this.store.invalidate()});D(this,"listen",o=>this.getStore().listen(o));D(this,"key",()=>this.getStore().key);D(this,"off",()=>this.getStore().off());this.atomStore=ku(),c&&o.subscribe(p=>{const f=this.atomStore.get(),y=c(p,f);f!==y&&this.atomStore.set(y)})}get(){throw new Error("not implemented")}}const Va=new GZ;async function*YZ(n,a){for await(const o of a){n.response.message=o,n.received_at=Date.now(),n.id=cE++;const l={type:"__GRPC_DEVTOOLS_EXTENSION__",data:n};window.postMessage(l),yield o}}let cE=0;const KZ=()=>n=>async a=>{const o={id:cE++,name:a.url,stream:a.stream,sent_at:Date.now(),request:{header:Object.fromEntries(a.header.entries()),message:a.message},response:{}};window.postMessage({type:"__GRPC_DEVTOOLS_EXTENSION__",data:o});try{const l=await n(a);if(o.received_at=Date.now(),o.response.header=Object.fromEntries(l.header.entries()),o.response.trailer=Object.fromEntries(l.trailer.entries()),a.stream){const c={type:"__GRPC_DEVTOOLS_EXTENSION__",data:{...o,stream:!1}};return window.postMessage(c),{...l,message:YZ(o,l.message)}}else{o.response.message=l.message,o.latency=o.received_at-o.sent_at;const c={type:"__GRPC_DEVTOOLS_EXTENSION__",data:o};window.postMessage(c)}return l}catch(l){o.received_at=Date.now(),o.response.trailer={"grpc-status":l.code,"grpc-message":l.rawMessage},o.response.message=l.rawMessage,o.latency=o.received_at-o.sent_at;const c={type:"__GRPC_DEVTOOLS_EXTENSION__",data:o};throw window.postMessage(c),l}};window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));function dE(n){return n instanceof DOMException&&(n.code===22||n.code===1014||n.name==="QuotaExceededError"||n.name==="NS_ERROR_DOM_QUOTA_REACHED")}class _m{constructor(a="main",o=window.localStorage){D(this,"delimiter",":");D(this,"prefix");D(this,"storage");D(this,"clear",()=>{for(const a in window.localStorage)a.startsWith(this.prefix)&&this.storage.removeItem(a)});D(this,"generateKey",a=>`${this.prefix}${this.delimiter}${a.join(this.delimiter)}`);D(this,"write",(...a)=>{const o=a.pop()||"",l=this.generateKey(a);try{this.storage.setItem(l,o)}catch(c){dE(c)&&this.storage===window.sessionStorage&&(window.sessionStorage.removeItem("slstreamlogs"),this.storage.setItem(l,o))}});D(this,"read",(...a)=>{const o=this.storage.getItem(this.generateKey(a));return o===null?void 0:o});D(this,"remove",(...a)=>{this.storage.removeItem(this.generateKey(a))});this.prefix=`sl-sdk${this.delimiter}${a}`,this.storage=o}}var us;(function(n){n.Init="init",n.Ready="ready",n.Connecting="connecting",n.Connected="connected",n.Disconnected="disconnected",n.Failed="failed",n.Reconnect="reconnect",n.Reconnecting="reconnecting"})(us||(us={}));class ZZ{constructor(a,o,l,c){D(this,"params");D(this,"streamCancel");D(this,"method");D(this,"options");D(this,"headers");D(this,"listeners");D(this,"state");D(this,"store");D(this,"paramsListener");D(this,"reconnectTimeout");D(this,"attempt",0);D(this,"updateState",a=>{this.state.setValue("status",a),this.state.setValue("ts",new Date),this.addStateLog(`status => ${a}`)});D(this,"addStateLog",a=>{const o=this.state.getStore().get().log,l=`${this.options.name} ${new Date().toISOString()}: ${a}`;if(o.push(l),this.state.setValue("log",o),localStorage.getItem("SL_DEBUG"))try{window.sessionStorage.setItem("slstreamlogs",window.sessionStorage.getItem("slstreamlogs")+`
|
|
198
|
-
`+l)}catch(c){dE(c)&&window.sessionStorage.removeItem("slstreamlogs"),window.sessionStorage.setItem("slstreamlogs",l)}});D(this,"addListener",(a,o)=>this.listeners.has(a)?(this.addStateLog(`listener '${a}' not added, already exists`),()=>{}):(this.listeners.set(a,o),this.addStateLog(`listener '${a}' added`),()=>this.removeListener(a)));D(this,"removeListener",a=>{this.listeners.delete(a),this.addStateLog(`listener '${a}' removed`)});D(this,"connect",()=>{this.updateState(us.Connecting),this.streamCancel&&(this.addStateLog("disconnect prev connection"),this.streamCancel.abort(),this.streamCancel=void 0);const a="get"in this.params&&typeof this.params.get=="function"?this.params.get():this.params;(async()=>{this.streamCancel=new AbortController;try{const o={headers:this.headers.getValues(),signal:this.streamCancel.signal},l=this.method(a,o);for await(const c of l)this.attempt=0,this.onData(c)}catch(o){o instanceof zt&&o.code!=st.Canceled&&this.onStreamError(o)}})(),this.updateState(us.Connected)});D(this,"disconnect",()=>{var a;this.streamCancel&&this.streamCancel.abort(),this.listeners.clear(),(a=this.paramsListener)==null||a.call(this),clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.updateState(us.Disconnected)});D(this,"reconnect",()=>{if(this.reconnectTimeout)this.addStateLog("already reconnecting");else if(this.attempt<this.options.reconnectMaxAttempts){this.updateState(us.Reconnect);const a=Math.min(this.options.reconnectMaxDelay,Math.pow(2,this.attempt)*this.options.reconnectDelay),o=Math.round(a*(1+Math.random())/2);this.reconnectTimeout=setTimeout(()=>{this.attempt++,this.updateState(us.Reconnecting),this.addStateLog(`reconnect attempt ${this.attempt} after ${o}ms`),this.connect(),this.reconnectTimeout=void 0},o)}else this.addStateLog("max reconnect attempts reached"),this.disconnect()});D(this,"getStore",()=>{var a;return(a=this.store)==null?void 0:a.getStore()});D(this,"onData",a=>{try{this.addStateLog(`received data => ${JSON.stringify(a)}`),this.store&&this.store.setValue(a);for(const[,o]of this.listeners)o(a);this.addStateLog(`data routed to ${this.listeners.size} listeners`)}catch(o){this.addStateLog(`error process data => ${o}`)}});D(this,"onStreamError",a=>{if(this.addStateLog(`error => ${a?JSON.stringify(a):"undefined"}}`),a!==void 0){if(a instanceof zt&&a.code!==st.Canceled){this.updateState(us.Failed),this.state.setValue("error",a),this.reconnect();return}this.disconnect()}});const p={status:us.Init,ts:new Date,log:[]};this.state=new Xc(Ro(p),`subscription:${c.name}:state`),this.options={...c,reconnectDelay:c.reconnectDelay??1e3,reconnectMaxDelay:c.reconnectMaxDelay??3e4,reconnectMaxAttempts:c.reconnectMaxAttempts??10,withStore:c.withStore??!1},this.headers=a,this.listeners=new Map,this.params=l,this.method=o,c.withStore&&(this.store=new Lo(Sa(null),`subscription:${c.name}:store`)),"subscribe"in l&&typeof l.subscribe=="function"&&(this.paramsListener=l.subscribe(f=>{this.state.getValue("status")===us.Connected&&(this.addStateLog(`params updated, reconnect => ${JSON.stringify(f)}`),this.reconnect())})),this.updateState(us.Ready)}}const XZ=new Set([st.Unknown,st.Internal,st.DeadlineExceeded,st.ResourceExhausted,st.FailedPrecondition,st.Unavailable,st.DataLoss]),CS=il("grpc:retry"),JZ=n=>async a=>{const o=a.contextValues.get(I9.retryAttempts),l=300,c=a.contextValues.get(I9.retryDelay);if(a.stream||o===0)return n(a);CS.trace({url:a.url,attempts:o,maxDelay:c},"retry options");for(let p=0;;p++)try{return await n(a)}catch(f){CS.trace({attempt:p,error:f},"retry attempt");const y=zt.from(f);if(p>=o||!(y instanceof zt)||!XZ.has(y.code))throw f;const b=Math.min(c,Math.pow(2,p)*l),C=Math.round(b*(1+Math.random())/2);await new Promise(_=>setTimeout(_,C))}},I9={retryAttempts:u6(10,{description:"Number of attempts to retry"}),retryDelay:u6(3e4,{description:"Max delay between retries in milliseconds"})},eX=()=>{const n=localStorage.getItem("sl-device-id");if(n)return n;const a=k9();return localStorage.setItem("sl-device-id",a),a},tX=()=>{var n;return((n=navigator.userAgentData)==null?void 0:n.platform)||navigator.platform};class ES{constructor(a,o){D(this,"toJsonOptions",{emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1});D(this,"transport");D(this,"streamTransport");D(this,"nanoquery");D(this,"host");D(this,"$headers");D(this,"interceptors",[]);D(this,"clients");D(this,"streamClients");D(this,"subscriptions");D(this,"opts");D(this,"addSubscription",(a,o,l)=>{const c=this.subscriptions.get(o);if(c)return c;const p=new ZZ(this.$headers,a,o,l);return this.subscriptions.set(o,p),p});D(this,"removeSubscription",a=>{a.disconnect(),this.subscriptions.delete(a.params)});D(this,"disconnect",()=>{var c,p;for(const[f,y]of this.subscriptions)y.disconnect(),this.subscriptions.delete(f);this.clients.clear(),this.streamClients.clear(),this.subscriptions.clear();const[a,o,l]=Hk({dedupeTime:(c=this.opts)==null?void 0:c.dedupeTime,refetchInterval:(p=this.opts)==null?void 0:p.refetchInterval});this.nanoquery={createFetcherStore:a,createMutatorStore:o,utils:l}});D(this,"registerInterceptor",a=>{this.interceptors.push(a)});D(this,"removeInterceptor",a=>{this.interceptors=this.interceptors.filter(o=>o!==a)});D(this,"getClient",a=>{const o=a.typeName;if(this.clients.has(o))return this.clients.get(o);const l=Pk(a,this.transport);return this.clients.set(o,l),l});D(this,"getStreamClient",a=>{const o=`stream-${a.typeName}`;if(this.clients.has(o))return this.clients.get(o);const l=Pk(a,this.streamTransport);return this.clients.set(o,l),l});D(this,"createPromiseClient",(a,{params:o=[],method:l})=>{const c=this.getClient(a),p=a.methods[l].name,f=[a.typeName,p.charAt(0).toLowerCase()+p.slice(1),...Array.isArray(o)?o:[o]],y=[a.typeName,p.charAt(0).toLowerCase()+p.slice(1)];return{client:c,createRequestOptions:b=>{const C=S9();for(const _ in b){const N=I9[_];C.set(N,b[_])}return C},queryKey:f,queryKeyStr:y.join("")}});D(this,"createStreamClient",a=>({client:this.getStreamClient(a)}));D(this,"setSdkKey",a=>{this.$headers.setValue("sdk",a)});D(this,"setAuth",(a,o)=>{this.$headers.setValue("authorization",a),this.$headers.setValue("sl-user-id",o)});D(this,"setHeader",(a,o)=>this.$headers.setValue(a,o));D(this,"getHeader",a=>this.$headers.getValue(a));D(this,"getHeaders",()=>this.$headers.getValues());D(this,"initInterceptors",()=>{var o;if(this.interceptors.length!==0)return;const a=l=>c=>{const p=this.$headers.getValues();for(const f in p)c.header.set(f,p[f]);return l(c)};this.interceptors.push(a),this.interceptors.push(KZ()),(o=this.opts)!=null&&o.retryable&&this.interceptors.push(JZ)});this.host=a,this.opts=o,this.$headers=new Xc(Ro({"sl-device-id":eX(),"sl-device-os":tX()}),"transport:headers"),this.initInterceptors(),this.clients=new Map,this.streamClients=new Map,this.subscriptions=new Map;const[l,c,p]=Hk({dedupeTime:o==null?void 0:o.dedupeTime,refetchInterval:o==null?void 0:o.refetchInterval});this.nanoquery={createFetcherStore:l,createMutatorStore:c,utils:p},this.transport=zk({baseUrl:a,defaultTimeoutMs:1e4,interceptors:this.interceptors}),this.streamTransport=zk({baseUrl:a,interceptors:this.interceptors})}}const nX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(JC,{method:"retrieveEventId",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;if(!f||typeof f!="string")return"";try{return((y=(await o.retrieveEventId({id:f})).data)==null?void 0:y.id)||""}catch{return""}}})},aX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getStream",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return f?(y=(await o.getStream({id:f})).data)==null?void 0:y.attributes:void 0}})},rX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(JC,{method:"summary",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return f?(y=(await o.summary({id:f})).data)==null?void 0:y.attributes:void 0}})},oX=(n,a)=>{const{queryKey:o,client:l}=a.createPromiseClient(gy,{method:"me",params:[n]});return a.nanoquery.createFetcherStore(o,{fetcher:async()=>{const{data:c}=await l.me({});return{data:c}}})},sX=n=>{const{client:a,createRequestOptions:o}=n.createPromiseClient(gy,{method:"bypassAuth"}),l=o({retryAttempts:0});return({userKey:c,schema:p,init:f,inviterKey:y})=>a.bypassAuth({userKey:c,schema:p,init:f,inviterKey:y},{contextValues:l})},iX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"get",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{var c;return(c=(await o.get({})).data)==null?void 0:c.attributes}})},lX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getOrganization",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{const c=await o.getOrganization({});return c.data?{...c.data.attributes,id:c.data.id}:void 0}})},uX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getOrganizationAdvertising",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{var c;return(c=(await o.getOrganizationAdvertising({})).data)==null?void 0:c.attributes}})},cX=(n,a,o)=>{n.transport=new ES(a.host,{dedupeTime:1e3*60*5,refetchInterval:1e3*60*5,retryable:!0}),n.analyticsTransport=new ES(a.analyticsHost),n.sdk.host=n.transport.host,n.transport.setSdkKey(a.sdkKey),n.transport.setHeader("sl-sdk-version",a.version||"-"),n.transport.$headers.subscribe(l=>{n.analyticsTransport.$headers.getStore().set(l)}),n.sdk.onMount({name:"transport"},()=>()=>{n.transport.disconnect(),n.analyticsTransport.disconnect()}),o()};var qi;(function(n){n.SCHEMA="schema",n.EXTERNAL_TOKEN="eToken",n.TOKEN="token"})(qi||(qi={}));class im extends _m{constructor(){super("user");D(this,"setSchema",o=>{this.write(qi.SCHEMA,o)});D(this,"getSchema",()=>this.read(qi.SCHEMA));D(this,"setToken",o=>{this.write(qi.TOKEN,o)});D(this,"getToken",()=>this.read(qi.TOKEN));D(this,"setExternalToken",o=>{this.write(qi.EXTERNAL_TOKEN,o)});D(this,"getExternalToken",()=>this.read(qi.EXTERNAL_TOKEN));D(this,"removeToken",()=>{this.remove(qi.TOKEN)})}}var Ki;(function(n){n.DISABLED="disabled",n.INITIALIZATION="initialization",n.READY="ready",n.FAILED="failed",n.SUSPENDED="suspended"})(Ki||(Ki={}));const dX=n=>{const a=new im,o=new Lo(Sa(a.getExternalToken()),"userKey"),l=new Lo(Sa(a.getToken()),"userToken"),c=new ei(oX(l.getStore(),n),"user",({data:f,error:y,loading:b},C)=>{var _;if(!y)return(_=f==null?void 0:f.data)!=null&&_.id?f.data.id:b===!1?void 0:C}),p=new ei(iX(l.getStore(),n),"userSettings");return{userKey:o,userToken:l,user:c,userSettings:p}},mX=n=>{const a=new Lo(Sa(void 0),"providerStreamId"),o=new ei(nX(a.getStore(),n),"slStreamId",p=>p==null?void 0:p.data),l=new ei(aX(o.getAtomStore(),n),"streamSettings"),c=new ei(rX(o.getAtomStore(),n),"streamSettings");return o.getAtomStore().listen(p=>{(p===""||p===void 0)&&(l.getStore().mutate(void 0),c.getStore().mutate(void 0))}),{providerStreamId:a,slStreamId:o,streamSettings:l,streamSummary:c}},fX=n=>{const a=new Lo(Sa(void 0),"enabled"),o=new Lo(Sa(Ki.DISABLED),"status"),l=new ei(lX(a.getStore(),n),"organizationSettings",y=>{var b;return(b=y==null?void 0:y.data)==null?void 0:b.id}),c=new ei(uX(l.getAtomStore(),n),"organizationAdvertising"),p=dX(n),f=mX(n);return{enabled:a,status:o,providerStreamId:f.providerStreamId,slStreamId:f.slStreamId,streamSettings:f.streamSettings,streamSummary:f.streamSummary,user:p.user,userKey:p.userKey,userToken:p.userToken,userSettings:p.userSettings,organizationSettings:l,organizationAdvertising:c}};class pX extends L6{constructor(o){const l=fX(o),c=WZ(l);super(c,"core");D(this,"stores");D(this,"subscribe",o=>{let l;for(l in this.stores){const c=o[l];l in o&&c!==void 0&&this.stores[l].subscribe(o[l])}});D(this,"unsubscribe",()=>this.getStore().off());this.stores=l}getValue(){throw new Error("Not implemented")}getValues(){return this.stores}setValue(){throw new Error("Not implemented")}}const hX=(n,a,o)=>{n.store=new pX(n.transport),n.stores=n.store.getValues(),n.sdk.enabled=n.stores.enabled.getStore(),n.sdk.status=n.stores.status.getStore(),n.sdk.sdkStore=Object.fromEntries(Object.entries(n.stores).map(([l,c])=>[l,c.getStore()])),n.sdk.organizationStore=()=>n.stores.organizationSettings.getStore(),n.sdk.streamStore=()=>n.stores.streamSettings.getStore(),n.sdk.streamSummary=()=>n.stores.streamSummary.getStore(),n.storeUnsubscribe=()=>{n.store.unsubscribe()},o()},gX=n=>{const{client:a}=n.createPromiseClient(nE,{method:"list"});return o=>a.list(o)},mE=n=>{const{client:a}=n.createPromiseClient(nE,{method:"summary"});return o=>a.summary(o)},yX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(gy,{method:"getFriends",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{if(!f)return[];try{return(await o.getFriends({})).data}catch{return[]}}})},vX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"get",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return(y=(await o.get({eventId:f})).data)==null?void 0:y.attributes},refetchInterval:0,dedupeTime:1e3*60*60})},TX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"syncQuestion",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var b,C,_,N;if(!f)return;const y=await o.syncQuestion({filter:{eventId:f}});if(((_=(C=(b=y.data)==null?void 0:b.attributes)==null?void 0:C.question)==null?void 0:_.type)!==ye.PROMOTION)return(N=y.data)==null?void 0:N.attributes},dedupeTime:1e3*60*10,refetchInterval:0})},bX=async(n,a)=>{const{client:o}=a.createPromiseClient(Oo,{method:"item",params:[n]});return(await o.item({id:n})).data},kX=(n,a)=>{const{client:o}=a.createStreamClient(Oo),l=ku({eventId:n.get()||"",feedId:""});return n.subscribe((c="")=>{l.set({eventId:c,feedId:""})}),a.addSubscription(o.subscription,l,{name:"feedSubscription"})},SX=(n,a)=>{const{client:o}=a.createStreamClient(Oo);return a.addSubscription(o.questionSubscription,{questionId:n},{name:"questionSubscription"})},wX=async(n,a)=>{var l,c;const{client:o}=a.createPromiseClient(Oo,{method:"questionByUser",params:[n]});return(c=(l=(await o.questionByUser({questionId:n})).data)==null?void 0:l.attributes)==null?void 0:c.question},N9=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"questionByUser",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y,b;return(b=(y=(await o.questionByUser({questionId:f})).data)==null?void 0:y.attributes)==null?void 0:b.question},dedupeTime:1e3*60*5})},fE=async(n,a)=>{var b;if(!n)return;const{client:o}=a.createPromiseClient(Oo,{method:"getQuestion",params:[n]}),l=await o.getQuestion({id:n});if(!((b=l.data)!=null&&b.attributes))return;const{options:c,notification:p,...f}=l.data.attributes,y=(c==null?void 0:c.options.case)==="promotion"?c==null?void 0:c.options.value:void 0;return{id:f.id,question:f,promotion:y,notification:p}},CX=(n,a,o)=>{const{client:l,queryKey:c}=o.createPromiseClient(Oo,{method:"list",params:[n,a]});return o.nanoquery.createFetcherStore(c,{fetcher:async(p,f,y,b)=>y?(await l.list({eventId:y,filter:{types:b===Jc.ALLOWED?[]:[ye.FACTOID,ye.PROMOTION,ye.TWEET],statuses:[yn.ACTIVE,yn.RESOLVED]}})).data:[],dedupeTime:0,refetchInterval:0})},EX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"list",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var b;if(!f)return;const y=(b=(await o.list({eventId:f,filter:{types:[ye.PROMOTION],statuses:[yn.ACTIVE]},pagination:{page:0,pageSize:1}})).data)==null?void 0:b[0];if(y.type==="promotion")return fE(y.id,a)},dedupeTime:0,refetchInterval:0})},_X=(n,a,o)=>{const l=pb([a,o],()=>{var C,_;const f=a.get();if(!f)return;const y=(C=o.get().data)==null?void 0:C.find(N=>N.id===(f==null?void 0:f.questionId)),b=(_=f==null?void 0:f.question)==null?void 0:_.openedFrom;return y?(y.openedFrom=b,y):f.question}),c=pb(l,f=>f&&f.type==="question"?f.id:void 0),p=N9(c,n);return{$store:l,$extendedStore:p,updateExtendedQuestion:f=>{const y=p.get().data,b=(C,_)=>{if(!C||!_)return C||_||[];const N=[];for(let L=0;L<C.length;L++)N.push({...C[L],..._[L],correct:C[L].correct,youVoted:C[L].youVoted,pointsEarned:C[L].pointsEarned});return N};p.mutate({...f,options:y==null?void 0:y.options,subject:y==null?void 0:y.subject,appearance:y==null?void 0:y.appearance,answers:b(y==null?void 0:y.answers,f==null?void 0:f.answers)})}}};var c6;(function(n){n.SHOWED="showed"})(c6||(c6={}));class IX extends _m{constructor(){super("advertisement");D(this,"setShowed",o=>{this.write(c6.SHOWED,o,"true")});D(this,"isViewed",o=>this.read(c6.SHOWED,o))}}const NX=n=>{var f,y,b,C,_;const a=(y=(f=n.data)==null?void 0:f.attributes)==null?void 0:y.question;if((((_=(C=(b=n.data)==null?void 0:b.attributes)==null?void 0:C.feedItem)==null?void 0:_.type)==="promotion"?n.data.attributes.feedItem:void 0)===void 0||!a)return;const{options:o,notification:l,...c}=a,p=(o==null?void 0:o.options.case)==="promotion"?o.options.value:void 0;return{id:c.id,question:c,notification:l,promotion:p}},Mh=n=>n.startsWith("http://")||n.startsWith("https://")?new URL(n).toString():n,RX=({gamOptions:n,gamBaseUrl:a})=>{const o=`${a}?`,l=[];for(const c in n){const p=c.replace(/([a-zA-Z])(?=[A-Z])/g,"$1_").toLowerCase(),f=n[c];if(f)if(typeof f=="string")l.push(`${p}=${Mh(f)}`);else if(Array.isArray(f))l.push(`${p}=${f.map(Mh).join(",")}`);else{const y=Object.entries(f).map(([b,C])=>Array.isArray(C)?`${b}=${C.map(Mh).join(",")}`:typeof C=="string"?`${b}=${Mh(C)}`:`${b}=${C}`).join("&").replaceAll("=","%3D").replaceAll("&","%26").replaceAll(",","%2C");l.push(`${p}=${y}`)}}return o+l.join("&")},LX=(n,a,o)=>{let l=!1;const c=o.transport,p=il("advertisement"),f=new IX,y=Ro({}),b=EX(n,c),C=()=>{var F,j,q;y.setKey("hasNotification",!1);const R=y.get(),P=(F=R.data)==null?void 0:F.question.id,V=(q=(j=R.data)==null?void 0:j.promotion)==null?void 0:q.type;P&&Va.emit("advertisement",{action:"notification-opened",payload:{id:P,type:V}})},_=()=>{var j,q,Y,J;const R=y.get(),P=(j=R.data)==null?void 0:j.question.id,V=(Y=(q=R.data)==null?void 0:q.promotion)==null?void 0:Y.type,F=(J=y.get())==null?void 0:J.isOpened;P&&!F&&(p.debug({id:P},"markAsViewed: %o"),f.setShowed(P),y.setKey("isOpened",!0),Va.emit("advertisement",{action:"opened",payload:{id:P,type:V}}))},N=(R,P)=>{var V;P?y.set({loading:!1,error:void 0,data:P,hasNotification:((V=P==null?void 0:P.notification)==null?void 0:V.enabled)===d9.NOTIFICATION_ENABLED,close:()=>L(P.question.id),isViewed:!!f.isViewed(P.question.id)}):(y.setKey("loading",!0),fE(R,c).then(F=>{var j;return y.set({loading:!1,error:void 0,data:F,hasNotification:((j=F==null?void 0:F.notification)==null?void 0:j.enabled)===d9.NOTIFICATION_ENABLED,close:()=>L(F==null?void 0:F.question.id),isViewed:F&&!!f.isViewed(F.question.id)})}).catch(F=>y.set({loading:!1,error:F,data:void 0})))};y.subscribe((R,P)=>{var V,F,j,q,Y,J,ne;if(((F=(V=R.data)==null?void 0:V.promotion)==null?void 0:F.type)===Eo.EXTERNAL_AD&&!(R!=null&&R.externalAd)&&((j=R.data.promotion.adCampaigns)!=null&&j.gamOptions)&&((q=R.data.promotion.adCampaigns)!=null&&q.gamBaseUrl)){const ue=RX(R.data.promotion.adCampaigns);y.setKey("externalAd",{type:"gam",url:ue})}(Y=R.data)!=null&&Y.promotion&&!R.isOpened&&Va.emit("advertisement",{action:"received",payload:{id:R.data.question.id,type:R.data.promotion.type,hasNotification:!!R.hasNotification,isViewed:!!f.isViewed(R.data.question.id)},skipAnalytics:R.data.question.id===((J=P==null?void 0:P.data)==null?void 0:J.question.id)}),!(R!=null&&R.data)&&(P!=null&&P.data)&&Va.emit("advertisement",{action:"closed",payload:{id:P.data.question.id,type:(ne=P.data.promotion)==null?void 0:ne.type,hasNotification:!!P.hasNotification,isViewed:!!f.isViewed(P.data.question.id)}})});const L=R=>{var P,V;(!R||((V=(P=y.get())==null?void 0:P.data)==null?void 0:V.question.id)===R)&&y.set({})};return{connect:()=>{l||(l=!0,b.subscribe((R,P)=>{R.data&&(!(P!=null&&P.data)||R.data.id!==P.data.id)&&N(R.data.question.id,R.data)}),a.addListener("promotion",R=>{const P=NX(R);if(P){if(P.question.status===yn.RESOLVED){L(P.question.id),p.debug({promotion:P},"resolved: %o");return}if(P.question.status===yn.ACTIVE){p.debug({promotion:P},"active: %o"),N(P.question.id,P);return}p.debug({promotion:P},"skip: %o")}}))},hide:L,show:N,open:C,markAsViewed:_,$store:y}};var Jc;(function(n){n.ALLOWED="allowed",n.DISALLOWED="disallowed"})(Jc||(Jc={}));class OX{constructor(a){D(this,"slStreamId");D(this,"organizationId");D(this,"userId");D(this,"interactiveAllowed");D(this,"openedQuestionId");D(this,"openedQuestion");D(this,"activeQuestionId");D(this,"feedList");D(this,"moderationId");D(this,"moderation");D(this,"feedSubscription");D(this,"questionSubscription");D(this,"advertisement");D(this,"notifications");D(this,"log");D(this,"transport");D(this,"cancels",new Set);D(this,"getCurrentSessionId",a=>{const o=a.eventId||this.slStreamId.get()||"",l=a.userId||this.userId.get()||"",c=a.organizationId||this.organizationId.get()||"",p=a.entity||"",f=a.prefix||"";return[c,o,l,f,p].join(":")});D(this,"disconnect",()=>{var a;(a=this.feedSubscription)==null||a.disconnect(),this.questionSubscription!==void 0&&(this.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0)});D(this,"openQuestion",(a,o)=>{this.openedQuestionId.set({questionId:a,question:o}),this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:a}))});D(this,"closeQuestion",a=>{this.openedQuestionId.set(void 0),a&&this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:a}))});this.transport=a.transport,this.log=il("gamification-background"),this.slStreamId=a.stores.slStreamId.getAtomStore(),this.organizationId=a.stores.organizationSettings.getAtomStore(),this.userId=a.stores.user.getAtomStore(),this.moderationId=new Lo(Sa(void 0),"moderationId").getStore(),this.interactiveAllowed=new Lo(Sa(Jc.DISALLOWED),"interactiveAllowed").getStore(),this.openedQuestionId=new Lo(Sa(void 0),"openedQuestionId").getStore(),this.notifications=a.notifications,this.moderation=new ei(vX(this.slStreamId,a.transport),"gamification:moderation"),this.feedList=new ei(CX(this.slStreamId,this.interactiveAllowed,a.transport),"gamification:feedList"),this.activeQuestionId=TX(this.slStreamId,a.transport),this.openedQuestion=_X(a.transport,this.openedQuestionId,this.feedList.getStore()),this.cancels.add(this.openedQuestionId.listen(o=>{this.log.debug({item:o},"received question"),o!=null&&o.questionId?(this.questionSubscription=SX(o.questionId,a.transport),this.questionSubscription.addListener("feed-subscription-opened-question",l=>{var c,p;this.openedQuestion.updateExtendedQuestion((p=(c=l.data)==null?void 0:c.attributes)==null?void 0:p.question)}),this.questionSubscription.connect()):(this.log.info("cleanup on close question"),this.questionSubscription!==void 0&&(a.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0))})),this.feedSubscription=kX(this.slStreamId,a.transport),this.cancels.add(this.feedSubscription.addListener("feed-subscription-active-question",o=>{var p,f,y,b;const l=(f=(p=this.activeQuestionId.get().data)==null?void 0:p.question)==null?void 0:f.id,c=(b=(y=o.data)==null?void 0:y.attributes)==null?void 0:b.question;if(!(!c||c.type===ye.PROMOTION)){if(c.status===yn.RESOLVED){l===c.id&&this.activeQuestionId.mutate(void 0);return}window.requestAnimationFrame(()=>{var C;this.activeQuestionId.mutate((C=o.data)==null?void 0:C.attributes)})}})),this.cancels.add(this.feedSubscription.addListener("moderation update",o=>{window.requestAnimationFrame(()=>{var l,c,p,f;((c=(l=o.data)==null?void 0:l.attributes)==null?void 0:c.question)===void 0&&((f=(p=o.data)==null?void 0:p.attributes)!=null&&f.moderation)&&this.moderation.invalidate()})})),this.cancels.add(this.activeQuestionId.subscribe((o,l)=>{var c,p,f,y,b,C,_;(c=o.data)!=null&&c.feedItem&&((f=(p=o.data)==null?void 0:p.feedItem)==null?void 0:f.id)!==((b=(y=l==null?void 0:l.data)==null?void 0:y.feedItem)==null?void 0:b.id)&&a.onQuestionActivate({stage:"activate",id:o.data.feedItem.id,isViewed:!!this.notifications.isViewed(this.getCurrentSessionId({prefix:"notification",entity:o.data.feedItem.id})),hasNotification:!0,type:o.data.feedItem.type}),!((C=o.data)!=null&&C.feedItem)&&((_=l==null?void 0:l.data)!=null&&_.feedItem)&&a.onQuestionActivate({stage:"deactivate",id:l.data.feedItem.id,isViewed:!!this.notifications.isViewed(this.getCurrentSessionId({prefix:"notification",entity:l.data.feedItem.id})),hasNotification:!0,type:l.data.feedItem.type})})),this.feedSubscription.connect(),this.cancels.add(this.interactiveAllowed.listen(()=>{window.requestAnimationFrame(()=>{this.activeQuestionId.invalidate()})})),a.sdk.onMount({name:"gamification-background"},()=>()=>{this.activeQuestionId.off();for(const o of this.cancels)o(),this.cancels.delete(o)}),this.advertisement=LX(this.slStreamId,this.feedSubscription,a)}}class AX{constructor(a){D(this,"notificationsList");D(this,"store");D(this,"timeouts");D(this,"waitingQueue");D(this,"activeQueue");D(this,"options");D(this,"logger");D(this,"addToQueue",a=>{var c;if(this.store.has(a.id)){this.logger.debug({notification:a},"skip existed notification: %o");return}const o=a.close,l=a.action;if(this.store.set(a.id,{...a,close:(...p)=>{o&&o(...p),this.closeNotification(a.id)},action:(...p)=>{l&&l(...p),this.closeNotification(a.id,{animateHiding:!1})}}),this.waitingQueue.add(a.id),this.activeQueue.size===this.options.concurrency){const[p]=this.activeQueue;if(((c=this.store.get(p))==null?void 0:c.persistent)!==!0)this.closeNotification(p);else{const[f]=this.waitingQueue;this.waitingQueue.size>1&&this.closeNotification(f),this.tickWaitingQueue()}}else this.tickWaitingQueue()});D(this,"tickWaitingQueue",()=>{if(this.activeQueue.size<this.options.concurrency){const[a]=this.waitingQueue;if(!a)return;this.activeQueue.add(a),this.waitingQueue.delete(a),this.logger.debug({job:a},"waiting queue tick"),this.tickActiveQueue(a)}else this.logger.debug({queueSize:this.activeQueue.size,concurrency:this.options.concurrency},"waiting queue tick skipped")});D(this,"tickActiveQueue",a=>{if(!a)return;const o=this.store.get(a);if(!o){this.logger.debug({notificationId:a},"active queue tick skipped, notification not exist");return}Va.emit("notification",{action:"received",payload:{questionId:o.data.questionId,questionType:o.data.questionType}});const l=setTimeout(()=>{const c=a,p=new Map(this.notificationsList.get());p.set(o.id,o),this.notificationsList.set(p);const f=setTimeout(()=>{this.logger.debug({notificationId:c,delay:o.autoHideDuration||5e3},"notification hiding by autoHideDuration"),this.closeNotification(c)},o.autoHideDuration||5e3);this.timeouts.set(c,f),this.logger.debug({notificationId:c,queue:[...p.values()]},"notification displayed")},o.delay||0);this.timeouts.set(a,l),this.logger.debug({notificationId:a},"active queue tick completed"),this.tickWaitingQueue()});D(this,"closeNotification",(a,{animateHiding:o=!0}={})=>{const l=new Map(this.notificationsList.get()),c=l.get(a);if(c){c.hiding=!(this.waitingQueue.size>=this.options.concurrency)&&o,this.notificationsList.set(l);const p=setTimeout(()=>{const f=new Map(this.notificationsList.get());f.delete(a),this.notificationsList.set(f);const y=this.timeouts.get(a);y!==void 0&&(clearTimeout(y),this.timeouts.delete(a)),this.logger.debug({notificationId:a},"notification hidden"),c.hiding&&Va.emit("notification",{action:"closed",payload:{questionId:c.data.questionId,questionType:c.data.questionType}})},this.options.animationDelay||0);this.timeouts.set(a,p)}return this.store.delete(a),this.activeQueue.delete(a),this.waitingQueue.delete(a),this.tickWaitingQueue(),this.logger.debug({notificationId:a},"notification hiding"),c});D(this,"drain",()=>{this.store.clear(),this.timeouts.clear(),this.waitingQueue.clear(),this.activeQueue.clear(),this.notificationsList.off(),this.notificationsList.set(new Map)});this.options=a,this.logger=il("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notificationsList=Sa(new Map)}}var d6;(function(n){n.OPENED="opened"})(d6||(d6={}));class xX extends _m{constructor(){super("notification");D(this,"setOpened",o=>{this.write(d6.OPENED,o,"true")});D(this,"isOpened",o=>this.read(d6.OPENED,o));D(this,"clearNotification",()=>{this.clear()})}}var bu;(function(n){n[n.ONBOARDING=1]="ONBOARDING",n[n.QUESTION=2]="QUESTION",n[n.QUESTION_RESOLVED=3]="QUESTION_RESOLVED"})(bu||(bu={}));class PX{constructor(a={}){D(this,"queue");D(this,"storage");D(this,"isViewed",a=>this.storage.isOpened(a));D(this,"add",a=>{if(!this.isViewed(a.id)){if(a.data&&a.emitEvent){const o=a.action;a.action=(...l)=>{o&&o(...l),Va.emit("notification",{action:"opened",payload:{questionId:a.data.questionId,questionType:a.data.questionType}})}}this.queue.addToQueue(a)}});D(this,"close",(a,{markAsViewed:o=!0,animateHiding:l}={})=>{this.queue.closeNotification(a,{animateHiding:l}),o&&this.markAsViewed(a)});D(this,"getActiveNotification",()=>{const a=this.queue.notificationsList.get();if(!(a!=null&&a.size))return null;for(const o of a.values())if(o.type===bu.ONBOARDING)return o;return a.values().next().value});D(this,"getQueueStore",()=>this.queue.notificationsList);D(this,"markAsViewed",a=>{this.storage.setOpened(a)});this.storage=new xX,this.queue=new AX({concurrency:1,animationDelay:1600,...a})}}const MX=(n,a,o)=>{n.notifications=new PX(void 0),n.addNotification=n.notifications.add,n.sdk.getNotificationsStore=()=>n.notifications.getQueueStore(),n.sdk.getActiveNotification=()=>n.notifications.getActiveNotification(),n.sdk.onMount({name:"notifications"},()=>()=>{n.notifications.queue.drain()}),o()};var c2;(function(n){n.UNKNOWN="unknown",n.ALREADY_VOTED="already_voted"})(c2||(c2={}));const DX=async(n,a)=>{var p;const{client:o,createRequestOptions:l}=n.createPromiseClient(Oo,{method:"submitAnswer"}),c=l({retryAttempts:0});try{return await o.submitAnswer({data:a},{contextValues:c})}catch(f){throw((p=zt.from(f))==null?void 0:p.code)===st.AlreadyExists?new Error(c2.ALREADY_VOTED):new Error(c2.UNKNOWN)}},UX=(n,a)=>{const{client:o,createRequestOptions:l}=n.createPromiseClient(Oo,{method:"submitInplay"}),c=l({retryAttempts:0});return o.submitInplay({data:{eventId:+a}},{contextValues:c})};var lm;(function(n){n.ONBOARDING="onboarding",n.ONBOARDING_IO="onboarding_io"})(lm||(lm={}));class FX extends _m{constructor(){super("gamification-session",window.sessionStorage);D(this,"writeValue",(o,l)=>{this.write(...o,l)});D(this,"readValue",o=>this.read(...o))}}class pE extends _m{constructor(){super("gamification");D(this,"sessionStorage");D(this,"saveOnboardingStatus",({userId:o,eventId:l,organizationId:c},p)=>{this.write(lm.ONBOARDING,c,o,l,p)});D(this,"getOnboardingStatus",({userId:o,eventId:l,organizationId:c})=>this.read(lm.ONBOARDING,c,o,l));D(this,"setOnboardingInstantOpen",({userId:o,eventId:l,organizationId:c})=>{this.sessionStorage.writeValue([lm.ONBOARDING_IO,c,o,l],"1")});D(this,"getOnboardingInstantOpen",({userId:o,eventId:l,organizationId:c})=>this.sessionStorage.readValue([lm.ONBOARDING_IO,c,o,l]));this.sessionStorage=new FX}}const VX={pageSize:10},jX=(n,a,o,l,c)=>{let p=0;const f=Sa({pageSize:VX.pageSize,page:0}),y=Ro({data:[],key:Date.now(),hasMore:!0,loading:void 0,error:void 0}),b=gX(n),C=async()=>{var P;const L=a.get(),R=((P=l.getStore().get().data)==null?void 0:P.map(V=>V.slId))||[];if(L&&(R!=null&&R.length)){const V=o.get();V&&R.push(V),y.setKey("loading",!0),y.setKey("data",[]);const F=await b({eventId:L,usersIds:R});y.set({data:F.data.map((j,q)=>({...j.attributes,friendsRank:q+1})),hasMore:!1,key:Date.now(),loading:!1}),F.meta&&(p=Math.round(F.meta.count/F.meta.pageSize))}},_=()=>{C()},N=L=>{const R=f.get(),P=L||R.page+1;P<=p&&f.set({...R,page:P})};return T6(y,()=>{const L=a.listen(C),R=l.listen(C);return()=>{L(),R()}}),{$store:y,fetchMore:N,invalidate:_}};class BX extends _m{constructor(){super("deep-link-context",window.sessionStorage);D(this,"get",this.read);D(this,"set",this.write);D(this,"del",this.remove)}}const _S="sldl",O6="sldl_uid",hE="sldl_eid",gE="sldl_e_eid",$X=new Set([O6,hE,gE]),IS=n=>{const a={},o={};for(const[l,c]of n)$X.has(l)?a[l]=c:o[l]=c;return{result:a,remain:o}},zX=({hash:n,search:a})=>{if(n&&n.includes(_S)){const o=new URLSearchParams(n.substr(1));return{hash:IS(o)}}if(a&&a.includes(_S)){const o=new URLSearchParams(a);return{search:IS(o)}}return null},NS=il("deep_link"),Xs={debug:(...n)=>{NS.debug(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)},trace:(...n)=>{NS.trace(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)}},HX=(n,a)=>{const{hash:o,search:l}=window.location;if(Xs.debug({hash:o,search:l},"get deep link data from"),o||l){const c=zX({hash:o,search:l});if(Xs.debug(c,"parse deep link result"),c){const{hash:p,search:f}=c,{result:y,remain:b}=p||f;if(Object.keys(y).length!==0){n.setValue("data",y);const C=Object.keys(b).length!==0;if(p){let _="";C&&(_=`#${new URLSearchParams(b).toString()}`,Xs.debug({updatedHash:_},"update hash")),window.history.replaceState(null,"",window.location.pathname+window.location.search+_)}if(f){let _="";C&&(_=`?${new URLSearchParams(b).toString()}`,Xs.debug({updatedSearch:_},"update search")),window.history.replaceState(null,"",window.location.pathname+_+window.location.hash)}a(y)}}}n.setValue("parsed",!0)},GX=(n,a,o)=>{const l=new BX,c=l.get("sl-deep-link-store");let p={};if(c)try{p=JSON.parse(c)}catch(y){Xs.debug(y)}n.deepLink={$store:new Xc(Ro(p),"deep-link-context"),getDeepLinkData:()=>{const{data:y,used:b}=n.deepLink.$store.getValues();return{data:y,used:b}},deepLinkUsed:y=>{Xs.debug(`logged in with inviterId: ${y}`),n.deepLink.$store.setValue("used",!0)},onDeepLinkHandlers:new Set},n.sdk.getInviter=()=>{const{data:y,used:b}=n.deepLink.getDeepLinkData();return b?y==null?void 0:y[O6]:void 0},n.sdk.inviteDisplayed=()=>{n.deepLink.$store.getStore().set({}),n.deepLink.$store.getStore().off(),l.del("sl-deep-link-store")},n.deepLink.$store.subscribe(y=>l.set("sl-deep-link-store",JSON.stringify(y))),n.sdk.addDeepLinkHandler=y=>{localStorage.getItem("SL_DEBUG")&&Xs.trace("adding deep link handler"),n.deepLink.onDeepLinkHandlers.add(y)},a.onDeepLinkHandled&&n.sdk.addDeepLinkHandler(a.onDeepLinkHandled),n.sdk.removeDeepLinkHandler=y=>{Xs.trace("removing deep link handler"),n.deepLink.onDeepLinkHandlers.delete(y)};const f=y=>{n.deepLink.$store.setValue("handled",!0),Xs.trace({size:n.deepLink.onDeepLinkHandlers.size},"deep link handled, call callbacks");for(const b of n.deepLink.onDeepLinkHandlers)try{Xs.trace("called handler"),b(y)}catch(C){console.error(C)}};HX(n.deepLink.$store,f),o()},qX=il("bypass");class WX extends qZ{constructor(o,l,c){super();D(this,"$coreStore");D(this,"deepLink");D(this,"transport");D(this,"bypassLogin");D(this,"me",async()=>{var o;return this.$coreStore.getValues().user.invalidate(),(o=await this.$coreStore.getValues().user.getValue())==null?void 0:o.data});D(this,"login",async(o,l)=>{var _,N,L;this.$coreStore.getValues().userKey.setValue(l);const{used:c,data:p}=this.deepLink.getDeepLinkData(),f=c?"":p==null?void 0:p[O6];qX.debug({inviterKey:f},"login with inviterKey");const y=await this.bypassLogin({schema:o,userKey:l,inviterKey:f,init:!1}),b=(_=y.meta)==null?void 0:_.jwt,C=(N=y.data)==null?void 0:N.id;if(!b||!C)throw new Error("internal: token missing");return(L=y.meta)!=null&&L.inviterKey&&this.deepLink.deepLinkUsed(y.meta.inviterKey),this.$coreStore.getValues().user.getStore().mutate({data:y.data}),this.saveUser(b,C),b});D(this,"isAuthenticated",()=>this.me());D(this,"logout",()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),new im().clear()});D(this,"softLogout",()=>{const o=new im;this.transport.setAuth("",""),o.setToken(""),this.reLogin()});D(this,"reLogin",()=>{const o=new im,l=o.getToken(),c=o.getExternalToken();if(this.$coreStore.getValues().userKey.setValue(c),l)return this.saveUser(l,""),this.me().then(p=>{if(p!=null&&p.id){const f=p.id;this.saveUser(l,f)}});if(c&&!l){const p=o.getSchema();p&&c&&this.login(p,c).catch(()=>{this.logout()})}});D(this,"saveUser",(o,l)=>{this.transport.setAuth(o,l),this.$coreStore.getValues().userToken.setValue(o),new im().setToken(o)});D(this,"connect",()=>{this.transport.registerInterceptor(o=>async l=>{try{return await o(l)}catch(c){throw c.code&&(c.code===7||c.code===16)&&this.transport.getHeader("authorization")&&this.softLogout(),c}})});this.$coreStore=o,this.deepLink=c,this.transport=l,this.bypassLogin=sX(this.transport),this.connect()}}const Zf=new im,QX=(n,a,o)=>{n.auth=new WX(n.store,n.transport,n.deepLink),n.stores.status.listen(l=>{l===Ki.READY&&n.auth.reLogin()}),n.sdk.userId=n.stores.user.getAtomStore,n.sdk.authorizationBypass=async(l,c)=>{if(!(Zf.getSchema()===l&&Zf.getExternalToken()===c&&n.transport.getHeader("authorization")))try{await n.auth.login(l,c),Zf.setSchema(l),Zf.setExternalToken(c)}catch{n.sdk.logout()}},n.sdk.logout=()=>{n.auth.logout(),Zf.clear()},n.sdk.getUserStore=()=>n.stores.user.getStore(),n.sdk.isUserAuthorized=()=>n.auth.isAuthenticated(),o()},RS=il("video_player"),Dh={debug:(...n)=>{RS.debug(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)},trace:(...n)=>{RS.trace(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)}},YX=(n,a,o)=>{n.videoPlayer={controllers:new Set},n.sdk.addVideoPlayerController=l=>{Dh.trace("adding video player controller"),n.videoPlayer.controllers.add(l)},a.videoPlayerController&&n.sdk.addVideoPlayerController(a.videoPlayerController),n.sdk.removeVideoPlayerController=l=>{Dh.trace("removing video player controller"),n.videoPlayer.controllers.delete(l)},n.sdk.controlVideoPlayer=l=>{Dh.trace("controlling video player");for(const c of n.videoPlayer.controllers){Dh.trace("calling video player controller");try{c(l)}catch(p){console.error(p)}}},o()},KX={[ye.FACTOID]:"insight",[ye.POLL]:"poll",[ye.TRIVIA]:"trivia",[ye.PREDICTION]:"prediction",[ye.TWEET]:"tweet"},ZX=(n,a,o)=>{n.sdk.uiState=Ro({}),n.ui={enableAppNotification:function(){n.sdk.uiState.setKey("appNotification",!0)},disableAppNotification:function(){n.sdk.uiState.get().app||n.sdk.uiState.setKey("appNotification",!1)},enableApp:function(){n.sdk.uiState.set({app:!0,appNotification:!0})},disableApp:function(){n.sdk.uiState.set({...n.sdk.uiState.get(),appNotification:!1,app:!1})}},a.onContentActivate&&(n.ui.onContentActivate=a.onContentActivate);const l=c=>{n.ui.onContentActivate&&n.ui.onContentActivate({...c,type:"advertisement"})};n.onQuestionActivate=({questionType:c,...p})=>{if(n.ui.onContentActivate){const f=p.type||c&&KX[c]||"question";n.ui.onContentActivate({...p,type:f})}},n.sdk.onMount({name:"ui"},()=>{const c=y=>{var b,C;if(((b=y.slEventBus)==null?void 0:b.type)==="notification")switch(y.slEventBus.action){case"received":n.ui.enableAppNotification();break;case"closed":n.ui.disableAppNotification();break}if(((C=y.slEventBus)==null?void 0:C.type)==="advertisement"&&a.withAd){const _=y.slEventBus,{hasNotification:N,id:L,isViewed:R,type:P}=_.payload;switch(_.action){case"notification-opened":n.sdk.uiState.set({promotionExternalAd:P===Eo.EXTERNAL_AD,promotionBanner:!0,promotionNotification:!1,promotionOverlay:!0,promotionSidebar:!0});break;case"received":if(n.sdk.closeFeature(),l({stage:"activate",id:L,hasNotification:N,isViewed:R}),!a.withAdNotification){n.sdk.uiState.set({promotionBanner:!0,promotionOverlay:!0,promotionSidebar:!0,promotionExternalAd:P===Eo.EXTERNAL_AD});break}N?n.sdk.uiState.set({promotionNotification:!0}):n.sdk.uiState.set({promotionBanner:!0,promotionOverlay:!0,promotionSidebar:!0,promotionExternalAd:P===Eo.EXTERNAL_AD});break;case"closed":console.log("closed",_.payload),n.sdk.uiState.set({...n.sdk.uiState.get(),promotionNotification:!1,promotionBanner:!1,promotionOverlay:!1,promotionExternalAd:!1,promotionSidebar:!1}),l({stage:"deactivate",id:L,hasNotification:N,isViewed:R});break}}},p=Va.listen(c),f=n.activeFeature.subscribe(y=>{y?n.ui.enableApp():n.ui.disableApp()});return()=>{p(),f()}}),o()},XX=(n,a,o)=>{const l={onMountedFired:!1},c=new Map,p=new Map;n.sdk=Object.create(null),n.sdk.withAuth=!1,n.sdk.onMount=({name:f,clear:y},b)=>{var C,_;if(c.has(f)){const N=p.get(f);N&&N(),c.delete(f),p.delete(f)}c.set(f,{cb:b,clear:y}),((_=(C=n==null?void 0:n.stores)==null?void 0:C.enabled)==null?void 0:_.get())==="on"&&p.set(f,b())},n.ready=()=>{n.stores.enabled.subscribe(f=>{f==="on"&&l.onMountedFired===!1&&(c.forEach(({cb:y},b)=>p.set(b,y())),l.onMountedFired=!0),f!=="on"&&l.onMountedFired===!0&&(p.forEach(y=>y()),p.clear(),c.forEach(({clear:y},b)=>y&&c.delete(b)),l.onMountedFired=!1)})},n.sdk.initializeApp=async f=>{if(n.contextConfig=f,n.stores.enabled.get()==="on")return{enabled:!0};n.storeSubscribe(),n.stores.enabled.setValue("on"),n.stores.status.setValue(Ki.INITIALIZATION);try{const y=await n.stores.organizationSettings.getValue();return y?(n.stores.status.setValue(Ki.READY),{enabled:!!y}):(n.stores.status.setValue(Ki.FAILED),{err:"failed"})}catch(y){return n.stores.enabled.setValue(),n.stores.status.setValue(Ki.FAILED),{err:`${y}`}}},n.sdk.disableApp=()=>{n.stores.enabled.get()==="on"&&(n.stores.enabled.setValue(),n.stores.status.setValue(Ki.DISABLED),n.stores.slStreamId.setValue(),n.stores.providerStreamId.setValue(),n.sdk.closeFeature(!0),n.storeUnsubscribe(),n.transport.disconnect())},n.sdk.createEventSession=f=>{n.stores.providerStreamId.setValue(f)},o()},JX=(n,a)=>{const{client:o,queryKey:l}=n.createPromiseClient(f2,{method:"generateDeepLink",params:a});return n.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f,y)=>{var b;if(!f)return{};try{return(b=(await o.generateDeepLink({data:{gamification:!0,externalEventId:y,eventId:f}})).data)==null?void 0:b.attributes}catch{return}},dedupeTime:1e3*60*60*24,refetchInterval:0})},eJ=(n,{web:a,mobile:o})=>{const{client:l}=n.createPromiseClient(iZ,{method:"generate"});return l.generate({web:a,mobile:o})},LS=(n,a)=>{const o=new URLSearchParams(n);for(const[l,c]of Object.entries(a))o.append(l,c);return o.toString()},tJ=(n,a,o,l)=>{const c=Ro({});return T6(c,()=>JX(n,[a,o]).subscribe(async({data:p,error:f,loading:y})=>{var R;const b=f?"https://masters.com":p==null?void 0:p.url,C=l.get()||"",_=a.get()||"",N=o.get()||"",L={[O6]:C,[hE]:_,[gE]:N};if(!y&&b){c.setKey("loading",!0);let P=window.location.search,V=window.location.hash;P&&V||V?P=`?${LS(P,L)}`:V=`#${LS("",L)}`;const F=window.location.origin+window.location.pathname+P+V;try{const j=await eJ(n,{web:F,mobile:b});c.set({data:(R=j.data)==null?void 0:R.link,loading:!1})}catch{c.set({loading:!1,error:"Failed to generate short link",data:void 0})}}else c.setKey("loading",!0)})),{$store:c,fetch}};var sa;(function(n){n.Unset="unset",n.Required="required",n.Optional="optional",n.Completed="completed",n.Disabled="disabled",n.Unavailable="unavailable"})(sa||(sa={}));const nJ=(n,a,o,l)=>{const{inplayGame:c}=n.featureSettings.get(),p=a.getCurrentSessionId({prefix:"onboarding"});c&&o.add({type:bu.ONBOARDING,id:p,action:n.openFeature,close:()=>{n.onboardingProcessed.set(!0)},persistent:!0,autoHideDuration:1e6,data:{questionId:"onboarding",questionType:ye.UNSET,onboarding:{...c,instantOpen:!l.getOnboardingInstantOpen({userId:a.userId.get()||"",organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""})}}})},Uh=(n,a,o,l,c,p)=>{var f,y,b;try{const C=a.userId.get();if(!C)return;if(c.getOnboardingStatus({userId:C,organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""})===sa.Completed){n.set(sa.Completed);for(const P of p)P();return}const _=(f=a.moderation.getStore().value)==null?void 0:f.data,N=o.featureSettings.get().inplayGame;if(_===void 0||N===void 0)return;const L=(y=_==null?void 0:_.options)==null?void 0:y.onboardingEnabled,R=(b=N==null?void 0:N.titleCard)==null?void 0:b.optIn;L?R?n.set(sa.Required):n.set(sa.Optional):(R?n.set(sa.Unavailable):n.set(sa.Disabled),l.close(a.getCurrentSessionId({prefix:"onboarding"}),{markAsViewed:!1}))}catch(C){console.error(C)}},aJ=(n,a,o,l)=>{let c=!1;const p=new pE,f=Sa(sa.Unset);f.subscribe(b=>{b!==sa.Unset&&(b===sa.Optional||b===sa.Required?c===!1&&(nJ(n,a,l,p),c=!0):n.onboardingProcessed.set(!0),b===sa.Completed&&a.activeQuestionId.invalidate(),p.setOnboardingInstantOpen({userId:a.userId.get()||"",organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""}))});const y=[];return Uh(f,a,n,l,p,y),f.get()!==sa.Completed&&(y.push(a.userId.listen(b=>{b&&Uh(f,a,n,l,p,y)})),y.push(a.moderation.listen(b=>{b.data&&Uh(f,a,n,l,p,y)})),y.push(n.featureSettings.listen(b=>{b&&Uh(f,a,n,l,p,y)}))),{$store:f,submitInplay:async()=>{const b=a.slStreamId.get();if(b){await UX(o,b),f.set(sa.Completed),p.saveOnboardingStatus({organizationId:a.organizationId.get()||"",userId:a.userId.get()||"",eventId:b},sa.Completed),Va.emit("poll",{action:"onboardingPassed",payload:{}}),n.openFeature();const C=a.getCurrentSessionId({prefix:"onboarding"});l.close(C)}}}},rJ=(n,a,o,l)=>{const c=Ro(void 0),p=mE(l),f=async()=>{var R,P;const b=n.get(),C=a.get(),_=(R=o.getStore().get().data)==null?void 0:R.map(V=>V.slId);if(!_)return;const N={eventId:b,userId:C,usersIds:[..._,C]},L=await p(N);c.set((P=L.data)==null?void 0:P.attributes)},y=()=>{f()};return T6(c,()=>{const b=n.listen(f),C=o.listen(f),_=a.listen(f);return()=>{b(),C(),_()}}),{$store:c,invalidate:y}},oJ=async(n,a,o,l,c)=>{var _,N,L;const p=mE(c),f=n.get(),y=a.get(),b=((_=o.getStore().get().data)==null?void 0:_.map(R=>R.slId))||[],C={eventId:f,userId:l,usersIds:[...b,y]};return(L=(N=(await p(C)).data)==null?void 0:N.attributes)==null?void 0:L.summary},sJ=new Set([ye.POLL,ye.PREDICTION,ye.TRIVIA]);class iJ extends uE{constructor(o,l,c){super(o,l);D(this,"userSummary");D(this,"feedList");D(this,"friends");D(this,"leaderboardId");D(this,"leaderboardList");D(this,"deepLink");D(this,"onboardingStatus");D(this,"openedQuestion");D(this,"currentUserId");D(this,"openedUser");D(this,"closeFeature");D(this,"openFeature");D(this,"feedSubscription");D(this,"activeQuestionId");D(this,"openedQuestionId");D(this,"advertisement");D(this,"onboardingProcessed");D(this,"notifications");D(this,"transport");D(this,"background");D(this,"storage");D(this,"submitAnswerTimeout");D(this,"cancels",new Set);D(this,"onQuestionActivate");D(this,"checkInteractiveFlag",()=>{var y,b,C,_,N;const o=this.onboardingStatus.$store.get(),l=(C=(b=(y=this.background.moderation.getStore().value)==null?void 0:y.data)==null?void 0:b.options)==null?void 0:C.onboardingEnabled,c=(N=(_=this.settings.getValues().inplayGame)==null?void 0:_.titleCard)==null?void 0:N.optIn,p=o===sa.Completed,f=!l||p||c!==!0;this.background.interactiveAllowed.set(f?Jc.ALLOWED:Jc.DISALLOWED)});D(this,"connect",()=>{this.onboardingProcessed.subscribe(o=>{o&&this.advertisement.connect()}),this.cancels.add(this.background.feedSubscription.addListener("feed-subscription-prediction-close",async o=>{var C,_,N,L,R,P,V,F,j,q,Y;if(!this.isInteractiveAllowed)return;const l=(_=(C=o.data)==null?void 0:C.attributes)==null?void 0:_.question,c=(L=(N=o.data)==null?void 0:N.attributes)==null?void 0:L.feedItem;if(!l||!(c!=null&&c.attributes))return;const{status:p,type:f,id:y,answers:b}=l;if(p===yn.RESOLVED&&f===ye.PREDICTION){const J=this.background.getCurrentSessionId({prefix:`notification-id:${y}`}),ne=[...this.feedList.getValues().data||[]],ue=ne.findIndex(mt=>mt.id===y),oe=ne[ue];let Le=(V=(P=(R=oe==null?void 0:oe.attributes)==null?void 0:R.attributes)==null?void 0:P.value)==null?void 0:V.answerId;const Ee=N9(y,this.transport),et=Ee.subscribe(()=>{});await Ee.get().promise;let Be=Ee.get().data;Be||(Be=await wX(y,this.transport)),et(),window.requestAnimationFrame(()=>{Ee.invalidate()}),Le||(Le=(F=Be==null?void 0:Be.answers.find(({youVoted:mt})=>mt))==null?void 0:F.id);const qe=b.find(({correct:mt})=>mt),Ie=Le?b.find(({id:mt})=>mt===Le):void 0,Ze=!!(Ie!=null&&Ie.correct);if(oe&&((q=(j=ne[ue])==null?void 0:j.attributes)==null?void 0:q.attributes.case)==="question"){try{ne[ue].attributes.attributes.value.answerId=Le,ne[ue].attributes.attributes.value.openForVoting=!1,Le&&(ne[ue].attributes.attributes.value.status=Ze?el.WON:el.LOST)}catch{}this.feedList.getStore().mutate(ne)}if(!Ie||!qe)return;((Y=this.openedQuestionId.get())==null?void 0:Y.questionId)!==l.id&&this.notifications.add({type:bu.QUESTION_RESOLVED,action:()=>this.openQuestion(l.id,c),close:()=>this.closeQuestion(y),autoHideDuration:Ze?15e3:12e3,id:J,emitEvent:!1,data:{questionId:y,questionType:ye.PREDICTION,question:{title:Ze?`Congratulations! You answered correctly! You won ${qe.points} pts!`:`Better luck next time! Correct: ${qe==null?void 0:qe.text}!`,votedAnswer:{title:Ie==null?void 0:Ie.text,points:Ie==null?void 0:Ie.points},correctAnswerTitle:qe==null?void 0:qe.text,correct:!!Ze,predictionResult:p===yn.RESOLVED,questionTitle:l==null?void 0:l.subject}}}),this.userSummary.invalidate()}})),this.cancels.add(this.background.feedSubscription.addListener("feed-subscription-questions-list",o=>{var f,y,b,C,_;const l=[...((f=this.feedList.getStore().value)==null?void 0:f.data)||[]],c=(b=(y=o.data)==null?void 0:y.attributes)==null?void 0:b.feedItem,p=l.findIndex(N=>N.id===(c==null?void 0:c.id));if(c!=null&&c.attributes&&c.attributes.attributes.case!=="promotion"&&!(c.attributes.status!==yn.ACTIVE&&c.attributes.status!==yn.RESOLVED)){if(p!==-1)if(c.attributes.attributes.case==="question"&&((C=l[p].attributes)==null?void 0:C.attributes.case)==="question"){const N=l[p];N.attributes&&(l[p]={...l[p],attributes:{...N.attributes,attributes:{...N.attributes.attributes,value:{...N.attributes.attributes.value,...c.attributes.attributes.value,answerId:N.attributes.attributes.value.answerId,status:N.attributes.attributes.value.status,openForVoting:N.attributes.attributes.value.openForVoting}}}})}else{const N=l[p];N.attributes&&c.attributes&&(l[p]={...l[p],attributes:{...N.attributes,attributes:{...N.attributes.attributes,value:{...N.attributes.attributes.value,...c.attributes.attributes.value}}}})}p===-1&&(l.unshift(c),Va.emit("poll",{action:"received",payload:{questionId:c.id,questionType:(_=c.attributes)==null?void 0:_.type}})),this.feedList.getStore().mutate(l)}}))});D(this,"disconnect",()=>{this.background.feedSubscription.removeListener("feed-subscription-prediction-close"),this.background.feedSubscription.removeListener("feed-subscription-questions-list")});D(this,"submitAnswer",async(o,l)=>{const c=N9(o,this.transport),p=c.subscribe(()=>{}),f={...c.get().data||{}},y=()=>{var L;const b=this.feedList.getValues().data;if(!b)return;const C=b.findIndex(R=>R.id===o),_=b[C],N=((L=_==null?void 0:_.attributes)==null?void 0:L.attributes.case)==="question"&&_.attributes.attributes.value;if(N){Va.emit("poll",{action:"voted",payload:{questionId:o,questionType:N.questionType}});const R=c.get().data;if(p(),R){const P=R.answers.find(q=>q.correct===!0),V=R.answers.findIndex(q=>q.id===l),F=R.answers[V],j=R.answers.every(({percentageDecimal:q},Y)=>q===(f==null?void 0:f.answers[Y].percentageDecimal));b[C].attributes.attributes.value.answerId=l,b[C].attributes.attributes.value.openForVoting=!1,b[C].attributes.attributes.value.text=(F==null?void 0:F.text)||"",P&&(b[C].attributes.attributes.value.status=P.id===l?el.WON:el.LOST),this.feedList.getStore().mutate([...b]),R.answers[V].correct=(P==null?void 0:P.id)===l,R.answers[V].youVoted=!0,j&&R.answers.forEach(q=>{q.percentageDecimal=0}),(P==null?void 0:P.id)===l&&(R.answers[V].pointsEarned=R.status===yn.RESOLVED?0:P.points),c.mutate({...R})}this.submitAnswerTimeout&&clearTimeout(this.submitAnswerTimeout),this.submitAnswerTimeout=setTimeout(()=>{this.userSummary.invalidate()},1e3)}};try{await DX(this.transport,{questionId:o,answerId:l}),y()}catch(b){if(b.message===c2.ALREADY_VOTED){this.userSummary.invalidate();const C=c.subscribe(()=>{});c.invalidate(),C()}throw b}});D(this,"openQuestion",(o,l)=>{var p,f,y,b;if(!o)return()=>{};this.notifications.close(this.background.getCurrentSessionId({prefix:"notification",entity:o}),{animateHiding:!1});let c=(p=l==null?void 0:l.attributes)==null?void 0:p.type;return c||(c=(b=(y=(((f=this.feedList.getStore().value)==null?void 0:f.data)||[]).find(C=>C.id===o))==null?void 0:y.attributes)==null?void 0:b.type),Va.emit("poll",{action:"opened",payload:{questionId:o,questionType:c,questionOpenedFrom:l==null?void 0:l.openedFrom}}),this.background.openQuestion(o,l)});D(this,"getFeedItem",o=>bX(o,this.transport));D(this,"isOpenedQuestion",o=>!!this.notifications.isViewed(o));D(this,"closeQuestion",o=>(o&&this.onQuestionActivate({stage:"deactivate",id:o,isViewed:!!this.notifications.isViewed(this.background.getCurrentSessionId({prefix:"notification",entity:o}))}),this.background.closeQuestion(o)));D(this,"openUser",async o=>{var p,f;const l=(p=this.leaderboardList.$store.get().data)==null?void 0:p.find(y=>y.userId===o);if(!l){this.openedUser.set(l);return}if(l.summaryLoaded){this.openedUser.set(l);return}const c={...l};try{const y=await oJ(this.background.slStreamId,this.background.userId,this.friends,o,this.transport);(y==null?void 0:y.inTop)!==void 0&&(this.leaderboardList.$store.setKey("data",(f=this.leaderboardList.$store.get().data)==null?void 0:f.map(b=>(b.userId===o&&(b.inTop=y.inTop),b))),c.inTop=y.inTop)}catch(y){console.error(y)}this.openedUser.set(c)});D(this,"closeUser",()=>{this.openedUser.set(void 0)});D(this,"showInApp",o=>{var c,p,f,y,b,C,_,N,L,R,P,V,F,j;const l=this.onboardingStatus.$store.get();if(o&&o.data&&l&&l!==sa.Unset&&((c=o.data.question)==null?void 0:c.id)!==void 0&&o.data.question.notification!==void 0&&((f=(p=o.data.question)==null?void 0:p.bypassNotifications)==null?void 0:f.inAppSilence)!==Fw.ON&&o.data.question.status===yn.ACTIVE&&!o.data.question.marketClosed){if(sJ.has(o.data.question.type))this.isInteractiveAllowed&&this.notifications.add({type:bu.QUESTION,action:()=>{var q,Y,J;return this.openQuestion((Y=(q=o.data)==null?void 0:q.question)==null?void 0:Y.id,(J=o.data)==null?void 0:J.feedItem)},close:()=>{var q,Y;return this.closeQuestion((Y=(q=o.data)==null?void 0:q.question)==null?void 0:Y.id)},autoHideDuration:1e3*60,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),emitEvent:!0,data:{questionId:o.data.question.id,questionType:o.data.question.type,question:{title:o.data.question.notification.title}}});else if(o.data.question.type===ye.FACTOID){const q=(y=o.data.question.options)==null?void 0:y.options.value,Y={heading:o.data.question.notification.title,body:o.data.question.notification.body,imageMode:q==null?void 0:q.imageMode,image:q==null?void 0:q.image,video:{id:((b=q==null?void 0:q.video)==null?void 0:b.id)||"",url:((C=q==null?void 0:q.video)==null?void 0:C.url)||"",thumbnailUrl:((_=q==null?void 0:q.video)==null?void 0:_.thumbnailUrl)||""},webLink:{label:"",url:""}};this.notifications.add({type:bu.QUESTION,action:()=>{var J,ne,ue;return this.openQuestion((ne=(J=o==null?void 0:o.data)==null?void 0:J.question)==null?void 0:ne.id,(ue=o==null?void 0:o.data)==null?void 0:ue.feedItem)},close:()=>{var J,ne;return this.closeQuestion((ne=(J=o==null?void 0:o.data)==null?void 0:J.question)==null?void 0:ne.id)},autoHideDuration:1e3*120,emitEvent:!0,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),data:{questionId:o.data.question.id,questionType:o.data.question.type,insight:Y}})}else if(o.data.question.type===ye.TWEET){const q=(N=o.data.question.options)==null?void 0:N.options.value,Y={title:(L=o.data.question.notification)==null?void 0:L.title,body:(R=o.data.question.notification)==null?void 0:R.body,image:(P=o.data.question.notification)==null?void 0:P.image,account:((V=q==null?void 0:q.tweetMeta)==null?void 0:V.account)||"",accountVerified:!!((F=q==null?void 0:q.tweetMeta)!=null&&F.accountVerified),tweet:(j=q==null?void 0:q.tweetMeta)==null?void 0:j.tweet,tweetId:o.data.question.id};this.notifications.add({type:bu.QUESTION,action:()=>{var J,ne,ue;return this.openQuestion((ne=(J=o.data)==null?void 0:J.question)==null?void 0:ne.id,(ue=o.data)==null?void 0:ue.feedItem)},close:()=>{var J,ne;return this.closeQuestion((ne=(J=o.data)==null?void 0:J.question)==null?void 0:ne.id)},autoHideDuration:1e3*120,emitEvent:!0,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),data:{questionId:o.data.question.id,questionType:o.data.question.type,tweet:Y}})}}});this.background=new OX(c),this.advertisement=this.background.advertisement,this.onQuestionActivate=c.onQuestionActivate,this.feedSubscription=this.background.feedSubscription,this.activeQuestionId=this.background.activeQuestionId,this.openedQuestionId=this.background.openedQuestionId,this.storage=new pE,this.feedList=this.background.feedList,this.friends=new ei(yX(this.background.userId,c.transport),"gamification:friends"),this.currentUserId=this.background.userId,this.openedUser=Sa(void 0),this.onboardingProcessed=Sa(!c.sdk.withAuth),this.leaderboardId=new Lo(Sa(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=aJ(this,this.background,c.transport,c.notifications),this.notifications=c.notifications,this.transport=c.transport,this.closeFeature=(p=!0)=>c.sdk.closeFeature(p),this.openFeature=()=>c.sdk.openFeature(yt.GAMES),this.openedQuestion=this.background.openedQuestion,this.deepLink=tJ(this.transport,this.background.slStreamId,c.stores.providerStreamId.getStore(),this.background.userId),this.userSummary=rJ(this.background.slStreamId,this.background.userId,this.friends,this.transport),this.leaderboardList=jX(this.transport,this.background.slStreamId,this.background.userId,this.friends),this.connect(),this.cancels.add(this.userSummary.$store.listen((p,f)=>{f!=null&&f.summary&&(p!=null&&p.summary)&&this.leaderboardList.invalidate()})),this.cancels.add(this.onboardingStatus.$store.listen(this.checkInteractiveFlag)),this.cancels.add(this.background.moderation.getStore().listen(this.checkInteractiveFlag)),this.cancels.add(this.settings.subscribe(this.checkInteractiveFlag)),this.cancels.add(this.onboardingStatus.$store.listen((p,f)=>{(f===void 0||p!==sa.Unset)&&this.background.activeQuestionId.invalidate()})),this.background.activeQuestionId.listen(this.showInApp),c.sdk.onMount({name:"gamification",clear:!0},()=>()=>{for(const p of this.cancels)p(),this.cancels.delete(p)})}get isInteractiveAllowed(){return this.background.interactiveAllowed.get()===Jc.ALLOWED}}const lJ={[yt.GAMES]:!0};class uJ extends uE{constructor(a,o){super(a,o)}}const cJ=(n,a,o)=>n.type===yt.GAMES?new iJ(n,a,o):new uJ(n,a),dJ=(n,a,o)=>{n.features=new Map,n.sdk.featuresList=new Lo(Sa(new Set),"features-list"),n.activeFeature=new Lo(Sa(yt.UNSET),"activeFeature"),n.sdk.getFeatures=()=>n.features,n.sdk.getFeature=l=>n.features.get(l),n.sdk.getActiveFeature=()=>n.activeFeature.getStore(),n.sdk.openFeature=l=>{n.activeFeature.setValue(l)},n.sdk.closeFeature=(l=!1)=>{const c=n.activeFeature.getValue();if(n.activeFeature.setValue(yt.UNSET),l&&c){n.features.delete(c);const p=n.sdk.featuresList.getValue();p&&p.delete(c),n.sdk.featuresList.setValue(p)}},n.initFeature=(l,c=Yi.ORGANIZATION)=>{if(l.type in lJ&&!n.features.has(l.type)){const p=cJ(l,c,n);n.features.set(l.type,p);let f=n.sdk.featuresList.getValue();f?f.add(l.type):f=new Set([l.type]),n.sdk.featuresList.setValue(new Set(f))}},n.updateFeature=(l,c)=>{var p;(p=n.features.get(l.type))==null||p.update(l,c)},n.destroyFeature=l=>{n.features.delete(l.type);const c=n.sdk.featuresList.getValue();c&&c.delete(l.type),n.sdk.featuresList.setValue(new Set(c))},n.reinitializeFeatures=async()=>{const l=await n.stores.organizationSettings.getValue();n.features.clear(),n.sdk.featuresList.setValue(new Set);for(const c of(l==null?void 0:l.overlays)||[])n.initFeature(c,Yi.ORGANIZATION)},n.stores.providerStreamId.listen(l=>{l||n.reinitializeFeatures()}),n.storeSubscribe=()=>{const l=(p,f)=>{var y;if(f!=null&&f.overlays&&!((y=n.contextConfig)!=null&&y.skipOrganizationSettings&&p===Yi.ORGANIZATION))for(const b of f.overlays)b.sdkEnable===!0&&(n.features.has(b.type)?n.updateFeature(b,p):n.initFeature(b,p))},c={organizationSettings:p=>{if(p.data)try{l(Yi.ORGANIZATION,p.data)}catch(f){console.log(f)}},streamSettings:p=>{if(p.data)try{l(Yi.STREAM,p.data)}catch(f){console.log(f)}}};n.store.subscribe(c)},o()};class mJ{constructor(a){D(this,"analytics");D(this,"accepted",()=>{this.analytics.write("invitation",{common:{...this.analytics.commonStore.getValues(),kind:ka.INVITATION_ACCEPTED},category:m9.GAMES,from:l2.UNSET})});D(this,"sent",({from:a})=>{this.analytics.write("invitation",{common:{...this.analytics.commonStore.getValues(),kind:ka.INVITATION_SENT},category:m9.GAMES,from:a||l2.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="invitation")switch(l.slEventBus.action){case"sent":this.sent(l.slEventBus.payload);break}};return Va.listen(o)})}}class fJ{constructor(a){D(this,"analytics");D(this,"tap",()=>{this.analytics.write("interactions",{common:{...this.analytics.commonStore.getValues(),kind:ka.INTERACTIONS},actionType:w9.TAP})});D(this,"scroll",()=>{this.analytics.write("interactions",{common:{...this.analytics.commonStore.getValues(),kind:ka.INTERACTIONS},actionType:w9.SCROLL})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="interactions")switch(l.slEventBus.action){case"tap":this.tap();break;case"scroll":this.scroll();break}};return Va.listen(o)})}}const pJ={[Eo.UNSET]:Qs.UNSET,[Eo.INGAME_IAB21]:Qs.PROMOTION_INGAME_IAB21,[Eo.INGAME_IAB11_LBAR]:Qs.PROMOTION_INGAME_IAB11_LBAR,[Eo.INGAME_IAB11]:Qs.PROMOTION_INGAME_IAB11,[Eo.INGAME_IAB21_LBAR]:Qs.PROMOTION_INGAME_IAB21_LBAR,[Eo.INGAME_IAB61]:Qs.PROMOTION_INGAME_IAB61,[Eo.EXTERNAL_AD]:Qs.PROMOTION_GAM};class hJ{constructor(a){D(this,"analytics");D(this,"received",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_RECEIVED,topicId:a,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"opened",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_OPENED,topicId:a,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"videoPlay",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_VIDEO_PLAYED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"buttonSelect",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_BUTTON_NAVIGATED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"bannerSelect",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_BANNER_NAVIGATED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c,p;if(!((c=l.slEventBus)!=null&&c.skipAnalytics)&&((p=l.slEventBus)==null?void 0:p.type)==="advertisement"){const f=l.slEventBus.payload.type?pJ[l.slEventBus.payload.type]:Qs.UNSET;switch(l.slEventBus.action){case"videoPlay":this.videoPlay(l.slEventBus.payload,{topicSubType:f});break;case"buttonSelect":this.buttonSelect(l.slEventBus.payload,{topicSubType:f});break;case"bannerSelect":this.bannerSelect(l.slEventBus.payload,{topicSubType:f});break;case"received":this.received(l.slEventBus.payload,{topicSubType:f});break;case"opened":this.opened(l.slEventBus.payload,{topicSubType:f});break}}};return Va.listen(o)})}}const r2={[ye.UNSET]:ia.UNSET,[ye.FACTOID]:ia.POLLS_INSIGHT,[ye.POLL]:ia.POLLS_POLL,[ye.PREDICTION]:ia.POLLS_PREDICTION,[ye.PROMOTION]:ia.POLLS_PROMOTION,[ye.TRIVIA]:ia.POLLS_TRIVIA,[ye.TWEET]:ia.POLLS_TWITTER};ye.UNSET+"",Ys.UNSET,ye.FACTOID+"",Ys.POLLS,ye.POLL+"",Ys.POLLS,ye.PREDICTION+"",Ys.POLLS,ye.PROMOTION+"",Ys.POLLS,ye.TRIVIA+"",Ys.POLLS,ye.TWEET+"",Ys.POLLS;const gJ={[yt.UNSET]:Ua.UNSET,[yt.INPLAY]:Ua.INPLAY,[yt.MESSAGING]:Ua.MESSAGING,[yt.STATISTICS]:Ua.STATS,[yt.BETTING]:Ua.BETTING,[yt.TWITTER]:Ua.TWITTER,[yt.MERCHANDISE]:Ua.MERCHANDISE,[yt.CONTESTS]:Ua.CONTESTS,[yt.VOICE_CHAT]:Ua.CALLING,[yt.TICKETS]:Ua.TICKETS,[yt.WHOIS_WATCHING]:Ua.WHOISWATCHING,[yt.PROFILE]:Ua.PROFILE,[yt.GAMES]:Ua.POLLS,[yt.GOLF_STATISTICS]:Ua.STATS,[yt.HIGHLIGHTS]:Ua.HIGHLIGHTS,[yt.PUBLIC_CHAT]:Ua.PUBLIC_CHAT};class yJ{constructor(a){D(this,"analytics");D(this,"received",({questionId:a,questionType:o})=>{this.analytics.write("notification",{common:{...this.analytics.commonStore.getValues(),kind:ka.NOTIFICATION_RECEIVED,topicId:a,topicType:o?r2[o]:ia.UNSET},notificationKind:Ys.POLLS,notificationType:C9.IN_APP})});D(this,"opened",({questionId:a,questionType:o})=>{this.analytics.write("notification",{common:{...this.analytics.commonStore.getValues(),kind:ka.NOTIFICATION_OPENED,topicId:a,topicType:o?r2[o]:ia.UNSET},notificationKind:Ys.POLLS,notificationType:C9.IN_APP})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="notification")switch(l.slEventBus.action){case"rendered":this.received(l.slEventBus.payload);break;case"opened":this.opened(l.slEventBus.payload);break}};return Va.listen(o)})}}class vJ{constructor(a){D(this,"analytics");D(this,"received",({questionId:a,questionType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_RECEIVED,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:Io.UNSET})});D(this,"opened",({questionId:a,questionType:o,questionOpenedFrom:l})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_OPENED,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:l==="list"?Io.PICK_HISTORY:Io.IN_APP})});D(this,"voted",({questionId:a,questionType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_VOTE,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:Io.UNSET})});D(this,"onboardingPassed",()=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.GAMES_JOINED},pollOpenedFrom:Io.UNSET})});D(this,"navigated",()=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_NAVIGATED},pollOpenedFrom:Io.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="poll")switch(l.slEventBus.action){case"voted":this.voted(l.slEventBus.payload);break;case"navigated":this.navigated();break;case"onboardingPassed":this.onboardingPassed();break;case"received":this.received(l.slEventBus.payload);break;case"opened":this.opened(l.slEventBus.payload);break}};return Va.listen(o)})}}const TJ=({transport:n,$commonStore:a})=>{let o;const l=Sa(!1),c=5e3,{client:p,queryKey:f}=n.createPromiseClient(rE,{method:"send",params:[l]}),y=n.nanoquery.createFetcherStore(f,{fetcher:async()=>{const N=a.getStore().get();try{await p.unary({message:{case:"heartbeat",value:{common:{...N,kind:ka.SESSION_HEARTBEAT}}}})}catch(L){Zi.error(L,"send heartbeat failed")}return Date.now()},refetchInterval:c}),b=()=>{Zi.debug("mounted heartbeat"),o=y.subscribe(()=>{})},C=()=>{Zi.debug("enabled heartbeat"),l.set(!0),y.lc===0&&b()},_=()=>{Zi.debug("disabled heartbeat"),l.set(!1)};return{enable:C,disable:_,mount:b,unmount:()=>{Zi.debug("unmounted heartbeat"),y.off(),o==null||o(),o=void 0,_()}}},Zi=il("analytics");class bJ{constructor(a){D(this,"commonStore");D(this,"notifications");D(this,"polls");D(this,"invitation");D(this,"interactions");D(this,"advertisement");D(this,"heartbeat");D(this,"analyticsClient");D(this,"listeners");D(this,"listenersCancels");D(this,"connected",!1);D(this,"connect",()=>{this.writeCommon("sessionId",k9()),this.heartbeat.enable(),this.listeners.forEach(a=>this.listenersCancels.add(a())),this.connected=!0,Zi.debug("analytics connected")});D(this,"disconnect",()=>{this.writeCommon("sessionId",""),this.writeCommon("overlaySessionId",""),this.heartbeat.unmount(),this.listenersCancels.forEach(a=>a()),this.connected=!1,Zi.debug("analytics disconnected")});D(this,"write",(a,o)=>{o&&this.analyticsClient.unary({message:{case:a,value:o}}).then(()=>{Zi.trace("send analytics success",a,o)}).catch(l=>{Zi.error(l,"send analytics failed")})});D(this,"writeCommon",(a,o)=>{this.commonStore.setValue(a,o)});D(this,"onConnect",a=>{this.listeners.add(a),this.connected&&this.listenersCancels.add(a())});D(this,"connectToSDK",a=>{this.onConnect(()=>a.stores.slStreamId.getAtomStore().subscribe(o=>{this.writeCommon("eventId",o)})),this.onConnect(()=>a.sdk.getActiveFeature().subscribe(o=>{o&&this.writeCommon("category",gJ[o]),o!==yt.UNSET?this.writeCommon("overlaySessionId",k9()):this.writeCommon("overlaySessionId","")})),this.onConnect(()=>{const o=window.matchMedia("(orientation: portrait)"),l=c=>{this.writeCommon("screenOrientation",c.matches?c9.PORTRAIT:c9.LANDSCAPE)};return o.addEventListener("change",l),()=>{o.removeEventListener("change",l)}}),this.onConnect(()=>a.deepLink.$store.subscribe(o=>{o!=null&&o.handled&&this.invitation.accepted()}))});this.listeners=new Set,this.listenersCancels=new Set,this.commonStore=new Xc(Ro({}),"common-analytics"),this.connectToSDK(a),this.heartbeat=TJ({transport:a.analyticsTransport,$commonStore:this.commonStore}),this.notifications=new yJ(this),this.polls=new vJ(this),this.invitation=new mJ(this),this.interactions=new fJ(this),this.advertisement=new hJ(this);const{client:o}=a.analyticsTransport.createPromiseClient(rE,{method:"send"});this.analyticsClient=o}}const kJ=(n,a,o)=>{n.analytics=new bJ(n),n.sdk.onMount({name:"analytics"},()=>(n.analytics.connect(),()=>{n.analytics.disconnect()})),o()};var vy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof g9<"u"?g9:typeof self<"u"?self:{};function SJ(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ty={exports:{}},by={exports:{}};function wJ(n){var a=new n,o=a;function l(){var p=a;return p.next?a=p.next:(a=new n,o=a),p.next=null,p}function c(p){o.next=p,o=p}return{get:l,release:c}}var CJ=wJ,EJ=CJ;function yE(n,a,o){if(typeof n=="function"&&(o=a,a=n,n=null),!(o>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var l=EJ(_J),c=null,p=null,f=0,y=null,b={push:V,drain:_o,saturated:_o,pause:_,paused:!1,get concurrency(){return o},set concurrency(ne){if(!(ne>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(o=ne,!b.paused)for(;c&&f<o;)f++,j()},running:C,resume:R,idle:P,length:N,getQueue:L,unshift:F,empty:_o,kill:q,killAndDrain:Y,error:J};return b;function C(){return f}function _(){b.paused=!0}function N(){for(var ne=c,ue=0;ne;)ne=ne.next,ue++;return ue}function L(){for(var ne=c,ue=[];ne;)ue.push(ne.value),ne=ne.next;return ue}function R(){if(b.paused){if(b.paused=!1,c===null){f++,j();return}for(;c&&f<o;)f++,j()}}function P(){return f===0&&b.length()===0}function V(ne,ue){var oe=l.get();oe.context=n,oe.release=j,oe.value=ne,oe.callback=ue||_o,oe.errorHandler=y,f>=o||b.paused?p?(p.next=oe,p=oe):(c=oe,p=oe,b.saturated()):(f++,a.call(n,oe.value,oe.worked))}function F(ne,ue){var oe=l.get();oe.context=n,oe.release=j,oe.value=ne,oe.callback=ue||_o,oe.errorHandler=y,f>=o||b.paused?c?(oe.next=c,c=oe):(c=oe,p=oe,b.saturated()):(f++,a.call(n,oe.value,oe.worked))}function j(ne){ne&&l.release(ne);var ue=c;ue&&f<=o?b.paused?f--:(p===c&&(p=null),c=ue.next,ue.next=null,a.call(n,ue.value,ue.worked),p===null&&b.empty()):--f===0&&b.drain()}function q(){c=null,p=null,b.drain=_o}function Y(){c=null,p=null,b.drain(),b.drain=_o}function J(ne){y=ne}}function _o(){}function _J(){this.value=null,this.callback=_o,this.next=null,this.release=_o,this.context=null,this.errorHandler=null;var n=this;this.worked=function(a,o){var l=n.callback,c=n.errorHandler,p=n.value;n.value=null,n.callback=_o,n.errorHandler&&c(a,p),l.call(n.context,a,o),n.release(n)}}function IJ(n,a,o){typeof n=="function"&&(o=a,a=n,n=null);function l(_,N){a.call(this,_).then(function(L){N(null,L)},N)}var c=yE(n,l,o),p=c.push,f=c.unshift;return c.push=y,c.unshift=b,c.drained=C,c;function y(_){var N=new Promise(function(L,R){p(_,function(P,V){if(P){R(P);return}L(V)})});return N.catch(_o),N}function b(_){var N=new Promise(function(L,R){f(_,function(P,V){if(P){R(P);return}L(V)})});return N.catch(_o),N}function C(){if(c.idle())return new Promise(function(L){L()});var _=c.drain,N=new Promise(function(L){c.drain=function(){_(),L()}});return N}}by.exports=yE;by.exports.promise=IJ;var vE=by.exports,ky={exports:{}},hm=typeof Reflect=="object"?Reflect:null,OS=hm&&typeof hm.apply=="function"?hm.apply:function(n,a,o){return Function.prototype.apply.call(n,a,o)},Qh;hm&&typeof hm.ownKeys=="function"?Qh=hm.ownKeys:Object.getOwnPropertySymbols?Qh=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Qh=function(n){return Object.getOwnPropertyNames(n)};function NJ(n){console&&console.warn&&console.warn(n)}var TE=Number.isNaN||function(n){return n!==n};function Qt(){Qt.init.call(this)}ky.exports=Qt;ky.exports.once=AJ;Qt.EventEmitter=Qt;Qt.prototype._events=void 0;Qt.prototype._eventsCount=0;Qt.prototype._maxListeners=void 0;var AS=10;function A6(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(Qt,"defaultMaxListeners",{enumerable:!0,get:function(){return AS},set:function(n){if(typeof n!="number"||n<0||TE(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");AS=n}});Qt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Qt.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||TE(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function bE(n){return n._maxListeners===void 0?Qt.defaultMaxListeners:n._maxListeners}Qt.prototype.getMaxListeners=function(){return bE(this)};Qt.prototype.emit=function(n){for(var a=[],o=1;o<arguments.length;o++)a.push(arguments[o]);var l=n==="error",c=this._events;if(c!==void 0)l=l&&c.error===void 0;else if(!l)return!1;if(l){var p;if(a.length>0&&(p=a[0]),p instanceof Error)throw p;var f=new Error("Unhandled error."+(p?" ("+p.message+")":""));throw f.context=p,f}var y=c[n];if(y===void 0)return!1;if(typeof y=="function")OS(y,this,a);else for(var b=y.length,C=EE(y,b),o=0;o<b;++o)OS(C[o],this,a);return!0};function kE(n,a,o,l){var c,p,f;if(A6(o),p=n._events,p===void 0?(p=n._events=Object.create(null),n._eventsCount=0):(p.newListener!==void 0&&(n.emit("newListener",a,o.listener?o.listener:o),p=n._events),f=p[a]),f===void 0)f=p[a]=o,++n._eventsCount;else if(typeof f=="function"?f=p[a]=l?[o,f]:[f,o]:l?f.unshift(o):f.push(o),c=bE(n),c>0&&f.length>c&&!f.warned){f.warned=!0;var y=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");y.name="MaxListenersExceededWarning",y.emitter=n,y.type=a,y.count=f.length,NJ(y)}return n}Qt.prototype.addListener=function(n,a){return kE(this,n,a,!1)};Qt.prototype.on=Qt.prototype.addListener;Qt.prototype.prependListener=function(n,a){return kE(this,n,a,!0)};function RJ(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function SE(n,a,o){var l={fired:!1,wrapFn:void 0,target:n,type:a,listener:o},c=RJ.bind(l);return c.listener=o,l.wrapFn=c,c}Qt.prototype.once=function(n,a){return A6(a),this.on(n,SE(this,n,a)),this};Qt.prototype.prependOnceListener=function(n,a){return A6(a),this.prependListener(n,SE(this,n,a)),this};Qt.prototype.removeListener=function(n,a){var o,l,c,p,f;if(A6(a),l=this._events,l===void 0)return this;if(o=l[n],o===void 0)return this;if(o===a||o.listener===a)--this._eventsCount===0?this._events=Object.create(null):(delete l[n],l.removeListener&&this.emit("removeListener",n,o.listener||a));else if(typeof o!="function"){for(c=-1,p=o.length-1;p>=0;p--)if(o[p]===a||o[p].listener===a){f=o[p].listener,c=p;break}if(c<0)return this;c===0?o.shift():LJ(o,c),o.length===1&&(l[n]=o[0]),l.removeListener!==void 0&&this.emit("removeListener",n,f||a)}return this};Qt.prototype.off=Qt.prototype.removeListener;Qt.prototype.removeAllListeners=function(n){var a,o,l;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[n]),this;if(arguments.length===0){var c=Object.keys(o),p;for(l=0;l<c.length;++l)p=c[l],p!=="removeListener"&&this.removeAllListeners(p);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(a=o[n],typeof a=="function")this.removeListener(n,a);else if(a!==void 0)for(l=a.length-1;l>=0;l--)this.removeListener(n,a[l]);return this};function wE(n,a,o){var l=n._events;if(l===void 0)return[];var c=l[a];return c===void 0?[]:typeof c=="function"?o?[c.listener||c]:[c]:o?OJ(c):EE(c,c.length)}Qt.prototype.listeners=function(n){return wE(this,n,!0)};Qt.prototype.rawListeners=function(n){return wE(this,n,!1)};Qt.listenerCount=function(n,a){return typeof n.listenerCount=="function"?n.listenerCount(a):CE.call(n,a)};Qt.prototype.listenerCount=CE;function CE(n){var a=this._events;if(a!==void 0){var o=a[n];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}Qt.prototype.eventNames=function(){return this._eventsCount>0?Qh(this._events):[]};function EE(n,a){for(var o=new Array(a),l=0;l<a;++l)o[l]=n[l];return o}function LJ(n,a){for(;a+1<n.length;a++)n[a]=n[a+1];n.pop()}function OJ(n){for(var a=new Array(n.length),o=0;o<a.length;++o)a[o]=n[o].listener||n[o];return a}function AJ(n,a){return new Promise(function(o,l){function c(f){n.removeListener(a,p),l(f)}function p(){typeof n.removeListener=="function"&&n.removeListener("error",c),o([].slice.call(arguments))}_E(n,a,p,{once:!0}),a!=="error"&&xJ(n,c,{once:!0})})}function xJ(n,a,o){typeof n.on=="function"&&_E(n,"error",a,o)}function _E(n,a,o,l){if(typeof n.on=="function")l.once?n.once(a,o):n.on(a,o);else if(typeof n.addEventListener=="function")n.addEventListener(a,function c(p){l.once&&n.removeEventListener(a,c),o(p)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var IE=ky.exports,x6={},NE={},RE=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},a=Symbol("test"),o=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var l=42;n[a]=l;for(a in n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var c=Object.getOwnPropertySymbols(n);if(c.length!==1||c[0]!==a||!Object.prototype.propertyIsEnumerable.call(n,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(n,a);if(p.value!==l||p.enumerable!==!0)return!1}return!0},PJ=RE,P6=function(){return PJ()&&!!Symbol.toStringTag},MJ=Error,DJ=EvalError,UJ=RangeError,FJ=ReferenceError,LE=SyntaxError,M6=TypeError,VJ=URIError,xS=typeof Symbol<"u"&&Symbol,jJ=RE,BJ=function(){return typeof xS!="function"||typeof Symbol!="function"||typeof xS("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:jJ()},V5={__proto__:null,foo:{}},$J=Object,zJ=function(){return{__proto__:V5}.foo===V5.foo&&!(V5 instanceof $J)},HJ="Function.prototype.bind called on incompatible ",GJ=Object.prototype.toString,qJ=Math.max,WJ="[object Function]",PS=function(n,a){for(var o=[],l=0;l<n.length;l+=1)o[l]=n[l];for(var c=0;c<a.length;c+=1)o[c+n.length]=a[c];return o},QJ=function(n,a){for(var o=[],l=a,c=0;l<n.length;l+=1,c+=1)o[c]=n[l];return o},YJ=function(n,a){for(var o="",l=0;l<n.length;l+=1)o+=n[l],l+1<n.length&&(o+=a);return o},KJ=function(n){var a=this;if(typeof a!="function"||GJ.apply(a)!==WJ)throw new TypeError(HJ+a);for(var o=QJ(arguments,1),l,c=function(){if(this instanceof l){var C=a.apply(this,PS(o,arguments));return Object(C)===C?C:this}return a.apply(n,PS(o,arguments))},p=qJ(0,a.length-o.length),f=[],y=0;y<p;y++)f[y]="$"+y;if(l=Function("binder","return function ("+YJ(f,",")+"){ return binder.apply(this,arguments); }")(c),a.prototype){var b=function(){};b.prototype=a.prototype,l.prototype=new b,b.prototype=null}return l},ZJ=KJ,Sy=Function.prototype.bind||ZJ,XJ=Function.prototype.call,JJ=Object.prototype.hasOwnProperty,eee=Sy,tee=eee.call(XJ,JJ),Ot,nee=MJ,aee=DJ,ree=UJ,oee=FJ,bm=LE,gm=M6,see=VJ,OE=Function,j5=function(n){try{return OE('"use strict"; return ('+n+").constructor;")()}catch{}},ed=Object.getOwnPropertyDescriptor;if(ed)try{ed({},"")}catch{ed=null}var B5=function(){throw new gm},iee=ed?function(){try{return arguments.callee,B5}catch{try{return ed(arguments,"callee").get}catch{return B5}}}():B5,am=BJ(),lee=zJ(),Ta=Object.getPrototypeOf||(lee?function(n){return n.__proto__}:null),om={},uee=typeof Uint8Array>"u"||!Ta?Ot:Ta(Uint8Array),td={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ot:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ot:ArrayBuffer,"%ArrayIteratorPrototype%":am&&Ta?Ta([][Symbol.iterator]()):Ot,"%AsyncFromSyncIteratorPrototype%":Ot,"%AsyncFunction%":om,"%AsyncGenerator%":om,"%AsyncGeneratorFunction%":om,"%AsyncIteratorPrototype%":om,"%Atomics%":typeof Atomics>"u"?Ot:Atomics,"%BigInt%":typeof BigInt>"u"?Ot:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ot:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ot:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ot:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":nee,"%eval%":eval,"%EvalError%":aee,"%Float32Array%":typeof Float32Array>"u"?Ot:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ot:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ot:FinalizationRegistry,"%Function%":OE,"%GeneratorFunction%":om,"%Int8Array%":typeof Int8Array>"u"?Ot:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ot:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ot:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":am&&Ta?Ta(Ta([][Symbol.iterator]())):Ot,"%JSON%":typeof JSON=="object"?JSON:Ot,"%Map%":typeof Map>"u"?Ot:Map,"%MapIteratorPrototype%":typeof Map>"u"||!am||!Ta?Ot:Ta(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ot:Promise,"%Proxy%":typeof Proxy>"u"?Ot:Proxy,"%RangeError%":ree,"%ReferenceError%":oee,"%Reflect%":typeof Reflect>"u"?Ot:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ot:Set,"%SetIteratorPrototype%":typeof Set>"u"||!am||!Ta?Ot:Ta(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ot:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":am&&Ta?Ta(""[Symbol.iterator]()):Ot,"%Symbol%":am?Symbol:Ot,"%SyntaxError%":bm,"%ThrowTypeError%":iee,"%TypedArray%":uee,"%TypeError%":gm,"%Uint8Array%":typeof Uint8Array>"u"?Ot:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ot:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ot:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ot:Uint32Array,"%URIError%":see,"%WeakMap%":typeof WeakMap>"u"?Ot:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ot:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ot:WeakSet};if(Ta)try{null.error}catch(n){var cee=Ta(Ta(n));td["%Error.prototype%"]=cee}var dee=function n(a){var o;if(a==="%AsyncFunction%")o=j5("async function () {}");else if(a==="%GeneratorFunction%")o=j5("function* () {}");else if(a==="%AsyncGeneratorFunction%")o=j5("async function* () {}");else if(a==="%AsyncGenerator%"){var l=n("%AsyncGeneratorFunction%");l&&(o=l.prototype)}else if(a==="%AsyncIteratorPrototype%"){var c=n("%AsyncGenerator%");c&&Ta&&(o=Ta(c.prototype))}return td[a]=o,o},MS={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},p2=Sy,m6=tee,mee=p2.call(Function.call,Array.prototype.concat),fee=p2.call(Function.apply,Array.prototype.splice),DS=p2.call(Function.call,String.prototype.replace),f6=p2.call(Function.call,String.prototype.slice),pee=p2.call(Function.call,RegExp.prototype.exec),hee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gee=/\\(\\)?/g,yee=function(n){var a=f6(n,0,1),o=f6(n,-1);if(a==="%"&&o!=="%")throw new bm("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&a!=="%")throw new bm("invalid intrinsic syntax, expected opening `%`");var l=[];return DS(n,hee,function(c,p,f,y){l[l.length]=f?DS(y,gee,"$1"):p||c}),l},vee=function(n,a){var o=n,l;if(m6(MS,o)&&(l=MS[o],o="%"+l[0]+"%"),m6(td,o)){var c=td[o];if(c===om&&(c=dee(o)),typeof c>"u"&&!a)throw new gm("intrinsic "+n+" exists, but is not available. Please file an issue!");return{alias:l,name:o,value:c}}throw new bm("intrinsic "+n+" does not exist!")},h2=function(n,a){if(typeof n!="string"||n.length===0)throw new gm("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof a!="boolean")throw new gm('"allowMissing" argument must be a boolean');if(pee(/^%?[^%]*%?$/,n)===null)throw new bm("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=yee(n),l=o.length>0?o[0]:"",c=vee("%"+l+"%",a),p=c.name,f=c.value,y=!1,b=c.alias;b&&(l=b[0],fee(o,mee([0,1],b)));for(var C=1,_=!0;C<o.length;C+=1){var N=o[C],L=f6(N,0,1),R=f6(N,-1);if((L==='"'||L==="'"||L==="`"||R==='"'||R==="'"||R==="`")&&L!==R)throw new bm("property names with quotes must have matching quotes");if((N==="constructor"||!_)&&(y=!0),l+="."+N,p="%"+l+"%",m6(td,p))f=td[p];else if(f!=null){if(!(N in f)){if(!a)throw new gm("base intrinsic for "+n+" exists, but the property is not available.");return}if(ed&&C+1>=o.length){var P=ed(f,N);_=!!P,_&&"get"in P&&!("originalValue"in P.get)?f=P.get:f=f[N]}else _=m6(f,N),f=f[N];_&&!y&&(td[p]=f)}}return f},AE={exports:{}},$5,US;function wy(){if(US)return $5;US=1;var n=h2,a=n("%Object.defineProperty%",!0)||!1;if(a)try{a({},"a",{value:1})}catch{a=!1}return $5=a,$5}var Tee=h2,Yh=Tee("%Object.getOwnPropertyDescriptor%",!0);if(Yh)try{Yh([],"length")}catch{Yh=null}var D6=Yh,FS=wy(),bee=LE,rm=M6,VS=D6,kee=function(n,a,o){if(!n||typeof n!="object"&&typeof n!="function")throw new rm("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new rm("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new rm("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new rm("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new rm("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new rm("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,y=!!VS&&VS(n,a);if(FS)FS(n,a,{configurable:p===null&&y?y.configurable:!p,enumerable:l===null&&y?y.enumerable:!l,value:o,writable:c===null&&y?y.writable:!c});else if(f||!l&&!c&&!p)n[a]=o;else throw new bee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},R9=wy(),xE=function(){return!!R9};xE.hasArrayLengthDefineBug=function(){if(!R9)return null;try{return R9([],"length",{value:1}).length!==1}catch{return!0}};var See=xE,wee=h2,jS=kee,Cee=See(),BS=D6,$S=M6,Eee=wee("%Math.floor%"),_ee=function(n,a){if(typeof n!="function")throw new $S("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||Eee(a)!==a)throw new $S("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],l=!0,c=!0;if("length"in n&&BS){var p=BS(n,"length");p&&!p.configurable&&(l=!1),p&&!p.writable&&(c=!1)}return(l||c||!o)&&(Cee?jS(n,"length",a,!0,!0):jS(n,"length",a)),n};(function(n){var a=Sy,o=h2,l=_ee,c=M6,p=o("%Function.prototype.apply%"),f=o("%Function.prototype.call%"),y=o("%Reflect.apply%",!0)||a.call(f,p),b=wy(),C=o("%Math.max%");n.exports=function(N){if(typeof N!="function")throw new c("a function is required");var L=y(a,f,arguments);return l(L,1+C(0,N.length-(arguments.length-1)),!0)};var _=function(){return y(a,p,arguments)};b?b(n.exports,"apply",{value:_}):n.exports.apply=_})(AE);var Cy=AE.exports,PE=h2,ME=Cy,Iee=ME(PE("String.prototype.indexOf")),Ey=function(n,a){var o=PE(n,!!a);return typeof o=="function"&&Iee(n,".prototype.")>-1?ME(o):o},Nee=P6(),Ree=Ey,L9=Ree("Object.prototype.toString"),U6=function(n){return Nee&&n&&typeof n=="object"&&Symbol.toStringTag in n?!1:L9(n)==="[object Arguments]"},DE=function(n){return U6(n)?!0:n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&L9(n)!=="[object Array]"&&L9(n.callee)==="[object Function]"},Lee=function(){return U6(arguments)}();U6.isLegacyArguments=DE;var Oee=Lee?U6:DE,Aee=Object.prototype.toString,xee=Function.prototype.toString,Pee=/^\s*(?:function)?\*/,UE=P6(),z5=Object.getPrototypeOf,Mee=function(){if(!UE)return!1;try{return Function("return function*() {}")()}catch{}},H5,Dee=function(n){if(typeof n!="function")return!1;if(Pee.test(xee.call(n)))return!0;if(!UE){var a=Aee.call(n);return a==="[object GeneratorFunction]"}if(!z5)return!1;if(typeof H5>"u"){var o=Mee();H5=o?z5(o):!1}return z5(n)===H5},FE=Function.prototype.toString,um=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,O9,Kh;if(typeof um=="function"&&typeof Object.defineProperty=="function")try{O9=Object.defineProperty({},"length",{get:function(){throw Kh}}),Kh={},um(function(){throw 42},null,O9)}catch(n){n!==Kh&&(um=null)}else um=null;var Uee=/^\s*class\b/,A9=function(n){try{var a=FE.call(n);return Uee.test(a)}catch{return!1}},G5=function(n){try{return A9(n)?!1:(FE.call(n),!0)}catch{return!1}},Zh=Object.prototype.toString,Fee="[object Object]",Vee="[object Function]",jee="[object GeneratorFunction]",Bee="[object HTMLAllCollection]",$ee="[object HTML document.all class]",zee="[object HTMLCollection]",Hee=typeof Symbol=="function"&&!!Symbol.toStringTag,Gee=!(0 in[,]),x9=function(){return!1};if(typeof document=="object"){var qee=document.all;Zh.call(qee)===Zh.call(document.all)&&(x9=function(n){if((Gee||!n)&&(typeof n>"u"||typeof n=="object"))try{var a=Zh.call(n);return(a===Bee||a===$ee||a===zee||a===Fee)&&n("")==null}catch{}return!1})}var Wee=um?function(n){if(x9(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;try{um(n,null,O9)}catch(a){if(a!==Kh)return!1}return!A9(n)&&G5(n)}:function(n){if(x9(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;if(Hee)return G5(n);if(A9(n))return!1;var a=Zh.call(n);return a!==Vee&&a!==jee&&!/^\[object HTML/.test(a)?!1:G5(n)},Qee=Wee,Yee=Object.prototype.toString,VE=Object.prototype.hasOwnProperty,Kee=function(n,a,o){for(var l=0,c=n.length;l<c;l++)VE.call(n,l)&&(o==null?a(n[l],l,n):a.call(o,n[l],l,n))},Zee=function(n,a,o){for(var l=0,c=n.length;l<c;l++)o==null?a(n.charAt(l),l,n):a.call(o,n.charAt(l),l,n)},Xee=function(n,a,o){for(var l in n)VE.call(n,l)&&(o==null?a(n[l],l,n):a.call(o,n[l],l,n))},Jee=function(n,a,o){if(!Qee(a))throw new TypeError("iterator must be a function");var l;arguments.length>=3&&(l=o),Yee.call(n)==="[object Array]"?Kee(n,a,l):typeof n=="string"?Zee(n,a,l):Xee(n,a,l)},jE=Jee,ete=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],q5=ete,tte=typeof globalThis>"u"?vy:globalThis,BE=function(){for(var n=[],a=0;a<q5.length;a++)typeof tte[q5[a]]=="function"&&(n[n.length]=q5[a]);return n},p6=jE,nte=BE,zS=Cy,_y=Ey,Xh=D6,ate=_y("Object.prototype.toString"),$E=P6(),HS=typeof globalThis>"u"?vy:globalThis,P9=nte(),Iy=_y("String.prototype.slice"),W5=Object.getPrototypeOf,rte=_y("Array.prototype.indexOf",!0)||function(n,a){for(var o=0;o<n.length;o+=1)if(n[o]===a)return o;return-1},h6={__proto__:null};$E&&Xh&&W5?p6(P9,function(n){var a=new HS[n];if(Symbol.toStringTag in a){var o=W5(a),l=Xh(o,Symbol.toStringTag);if(!l){var c=W5(o);l=Xh(c,Symbol.toStringTag)}h6["$"+n]=zS(l.get)}}):p6(P9,function(n){var a=new HS[n],o=a.slice||a.set;o&&(h6["$"+n]=zS(o))});var ote=function(n){var a=!1;return p6(h6,function(o,l){if(!a)try{"$"+o(n)===l&&(a=Iy(l,1))}catch{}}),a},ste=function(n){var a=!1;return p6(h6,function(o,l){if(!a)try{o(n),a=Iy(l,1)}catch{}}),a},ite=function(n){if(!n||typeof n!="object")return!1;if(!$E){var a=Iy(ate(n),8,-1);return rte(P9,a)>-1?a:a!=="Object"?!1:ste(n)}return Xh?ote(n):null},g6=jE,lte=BE,GS=Cy,Ny=Ey,Jh=D6,ute=Ny("Object.prototype.toString"),zE=P6(),qS=typeof globalThis>"u"?vy:globalThis,M9=lte(),Ry=Ny("String.prototype.slice"),Q5=Object.getPrototypeOf,cte=Ny("Array.prototype.indexOf",!0)||function(n,a){for(var o=0;o<n.length;o+=1)if(n[o]===a)return o;return-1},y6={__proto__:null};zE&&Jh&&Q5?g6(M9,function(n){var a=new qS[n];if(Symbol.toStringTag in a){var o=Q5(a),l=Jh(o,Symbol.toStringTag);if(!l){var c=Q5(o);l=Jh(c,Symbol.toStringTag)}y6["$"+n]=GS(l.get)}}):g6(M9,function(n){var a=new qS[n],o=a.slice||a.set;o&&(y6["$"+n]=GS(o))});var dte=function(n){var a=!1;return g6(y6,function(o,l){if(!a)try{"$"+o(n)===l&&(a=Ry(l,1))}catch{}}),a},mte=function(n){var a=!1;return g6(y6,function(o,l){if(!a)try{o(n),a=Ry(l,1)}catch{}}),a},fte=function(n){if(!n||typeof n!="object")return!1;if(!zE){var a=Ry(ute(n),8,-1);return cte(M9,a)>-1?a:a!=="Object"?!1:mte(n)}return Jh?dte(n):null},pte=fte,hte=function(n){return!!pte(n)};(function(n){var a=Oee,o=Dee,l=ite,c=hte;function p(de){return de.call.bind(de)}var f=typeof BigInt<"u",y=typeof Symbol<"u",b=p(Object.prototype.toString),C=p(Number.prototype.valueOf),_=p(String.prototype.valueOf),N=p(Boolean.prototype.valueOf);if(f)var L=p(BigInt.prototype.valueOf);if(y)var R=p(Symbol.prototype.valueOf);function P(de,Ao){if(typeof de!="object")return!1;try{return Ao(de),!0}catch{return!1}}n.isArgumentsObject=a,n.isGeneratorFunction=o,n.isTypedArray=c;function V(de){return typeof Promise<"u"&&de instanceof Promise||de!==null&&typeof de=="object"&&typeof de.then=="function"&&typeof de.catch=="function"}n.isPromise=V;function F(de){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(de):c(de)||se(de)}n.isArrayBufferView=F;function j(de){return l(de)==="Uint8Array"}n.isUint8Array=j;function q(de){return l(de)==="Uint8ClampedArray"}n.isUint8ClampedArray=q;function Y(de){return l(de)==="Uint16Array"}n.isUint16Array=Y;function J(de){return l(de)==="Uint32Array"}n.isUint32Array=J;function ne(de){return l(de)==="Int8Array"}n.isInt8Array=ne;function ue(de){return l(de)==="Int16Array"}n.isInt16Array=ue;function oe(de){return l(de)==="Int32Array"}n.isInt32Array=oe;function Le(de){return l(de)==="Float32Array"}n.isFloat32Array=Le;function Ee(de){return l(de)==="Float64Array"}n.isFloat64Array=Ee;function et(de){return l(de)==="BigInt64Array"}n.isBigInt64Array=et;function Be(de){return l(de)==="BigUint64Array"}n.isBigUint64Array=Be;function qe(de){return b(de)==="[object Map]"}qe.working=typeof Map<"u"&&qe(new Map);function Ie(de){return typeof Map>"u"?!1:qe.working?qe(de):de instanceof Map}n.isMap=Ie;function Ze(de){return b(de)==="[object Set]"}Ze.working=typeof Set<"u"&&Ze(new Set);function mt(de){return typeof Set>"u"?!1:Ze.working?Ze(de):de instanceof Set}n.isSet=mt;function Rt(de){return b(de)==="[object WeakMap]"}Rt.working=typeof WeakMap<"u"&&Rt(new WeakMap);function Wn(de){return typeof WeakMap>"u"?!1:Rt.working?Rt(de):de instanceof WeakMap}n.isWeakMap=Wn;function be(de){return b(de)==="[object WeakSet]"}be.working=typeof WeakSet<"u"&&be(new WeakSet);function Pe(de){return be(de)}n.isWeakSet=Pe;function Se(de){return b(de)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function ct(de){return typeof ArrayBuffer>"u"?!1:Se.working?Se(de):de instanceof ArrayBuffer}n.isArrayBuffer=ct;function z(de){return b(de)==="[object DataView]"}z.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&z(new DataView(new ArrayBuffer(1),0,1));function se(de){return typeof DataView>"u"?!1:z.working?z(de):de instanceof DataView}n.isDataView=se;var me=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function We(de){return b(de)==="[object SharedArrayBuffer]"}function gt(de){return typeof me>"u"?!1:(typeof We.working>"u"&&(We.working=We(new me)),We.working?We(de):de instanceof me)}n.isSharedArrayBuffer=gt;function it(de){return b(de)==="[object AsyncFunction]"}n.isAsyncFunction=it;function tt(de){return b(de)==="[object Map Iterator]"}n.isMapIterator=tt;function lt(de){return b(de)==="[object Set Iterator]"}n.isSetIterator=lt;function _t(de){return b(de)==="[object Generator]"}n.isGeneratorObject=_t;function Yt(de){return b(de)==="[object WebAssembly.Module]"}n.isWebAssemblyCompiledModule=Yt;function In(de){return P(de,C)}n.isNumberObject=In;function Gt(de){return P(de,_)}n.isStringObject=Gt;function nn(de){return P(de,N)}n.isBooleanObject=nn;function Nt(de){return f&&P(de,L)}n.isBigIntObject=Nt;function sn(de){return y&&P(de,R)}n.isSymbolObject=sn;function Nn(de){return In(de)||Gt(de)||nn(de)||Nt(de)||sn(de)}n.isBoxedPrimitive=Nn;function Gr(de){return typeof Uint8Array<"u"&&(ct(de)||gt(de))}n.isAnyArrayBuffer=Gr,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(de){Object.defineProperty(n,de,{enumerable:!1,value:function(){throw new Error(de+" is not supported in userland")}})})})(NE);var gte=function(n){return n&&typeof n=="object"&&typeof n.copy=="function"&&typeof n.fill=="function"&&typeof n.readUInt8=="function"},D9={exports:{}};typeof Object.create=="function"?D9.exports=function(n,a){a&&(n.super_=a,n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:D9.exports=function(n,a){if(a){n.super_=a;var o=function(){};o.prototype=a.prototype,n.prototype=new o,n.prototype.constructor=n}};var yte=D9.exports;(function(n){var a=Object.getOwnPropertyDescriptors||function(z){for(var se=Object.keys(z),me={},We=0;We<se.length;We++)me[se[We]]=Object.getOwnPropertyDescriptor(z,se[We]);return me},o=/%[sdj%]/g;n.format=function(z){if(!ne(z)){for(var se=[],me=0;me<arguments.length;me++)se.push(f(arguments[me]));return se.join(" ")}for(var me=1,We=arguments,gt=We.length,it=String(z).replace(o,function(_t){if(_t==="%%")return"%";if(me>=gt)return _t;switch(_t){case"%s":return String(We[me++]);case"%d":return Number(We[me++]);case"%j":try{return JSON.stringify(We[me++])}catch{return"[Circular]"}default:return _t}}),tt=We[me];me<gt;tt=We[++me])q(tt)||!Ee(tt)?it+=" "+tt:it+=" "+f(tt);return it},n.deprecate=function(z,se){if(typeof St<"u"&&St.noDeprecation===!0)return z;if(typeof St>"u")return function(){return n.deprecate(z,se).apply(this,arguments)};var me=!1;function We(){if(!me){if(St.throwDeprecation)throw new Error(se);St.traceDeprecation?console.trace(se):console.error(se),me=!0}return z.apply(this,arguments)}return We};var l={},c=/^$/;if(St.env.NODE_DEBUG){var p=St.env.NODE_DEBUG;p=p.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+p+"$","i")}n.debuglog=function(z){if(z=z.toUpperCase(),!l[z])if(c.test(z)){var se=St.pid;l[z]=function(){var me=n.format.apply(n,arguments);console.error("%s %d: %s",z,se,me)}}else l[z]=function(){};return l[z]};function f(z,se){var me={seen:[],stylize:b};return arguments.length>=3&&(me.depth=arguments[2]),arguments.length>=4&&(me.colors=arguments[3]),j(se)?me.showHidden=se:se&&n._extend(me,se),oe(me.showHidden)&&(me.showHidden=!1),oe(me.depth)&&(me.depth=2),oe(me.colors)&&(me.colors=!1),oe(me.customInspect)&&(me.customInspect=!0),me.colors&&(me.stylize=y),_(me,z,me.depth)}n.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function y(z,se){var me=f.styles[se];return me?"\x1B["+f.colors[me][0]+"m"+z+"\x1B["+f.colors[me][1]+"m":z}function b(z,se){return z}function C(z){var se={};return z.forEach(function(me,We){se[me]=!0}),se}function _(z,se,me){if(z.customInspect&&se&&qe(se.inspect)&&se.inspect!==n.inspect&&!(se.constructor&&se.constructor.prototype===se)){var We=se.inspect(me,z);return ne(We)||(We=_(z,We,me)),We}var gt=N(z,se);if(gt)return gt;var it=Object.keys(se),tt=C(it);if(z.showHidden&&(it=Object.getOwnPropertyNames(se)),Be(se)&&(it.indexOf("message")>=0||it.indexOf("description")>=0))return L(se);if(it.length===0){if(qe(se)){var lt=se.name?": "+se.name:"";return z.stylize("[Function"+lt+"]","special")}if(Le(se))return z.stylize(RegExp.prototype.toString.call(se),"regexp");if(et(se))return z.stylize(Date.prototype.toString.call(se),"date");if(Be(se))return L(se)}var _t="",Yt=!1,In=["{","}"];if(F(se)&&(Yt=!0,In=["[","]"]),qe(se)){var Gt=se.name?": "+se.name:"";_t=" [Function"+Gt+"]"}if(Le(se)&&(_t=" "+RegExp.prototype.toString.call(se)),et(se)&&(_t=" "+Date.prototype.toUTCString.call(se)),Be(se)&&(_t=" "+L(se)),it.length===0&&(!Yt||se.length==0))return In[0]+_t+In[1];if(me<0)return Le(se)?z.stylize(RegExp.prototype.toString.call(se),"regexp"):z.stylize("[Object]","special");z.seen.push(se);var nn;return Yt?nn=R(z,se,me,tt,it):nn=it.map(function(Nt){return P(z,se,me,tt,Nt,Yt)}),z.seen.pop(),V(nn,_t,In)}function N(z,se){if(oe(se))return z.stylize("undefined","undefined");if(ne(se)){var me="'"+JSON.stringify(se).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return z.stylize(me,"string")}if(J(se))return z.stylize(""+se,"number");if(j(se))return z.stylize(""+se,"boolean");if(q(se))return z.stylize("null","null")}function L(z){return"["+Error.prototype.toString.call(z)+"]"}function R(z,se,me,We,gt){for(var it=[],tt=0,lt=se.length;tt<lt;++tt)be(se,String(tt))?it.push(P(z,se,me,We,String(tt),!0)):it.push("");return gt.forEach(function(_t){_t.match(/^\d+$/)||it.push(P(z,se,me,We,_t,!0))}),it}function P(z,se,me,We,gt,it){var tt,lt,_t;if(_t=Object.getOwnPropertyDescriptor(se,gt)||{value:se[gt]},_t.get?_t.set?lt=z.stylize("[Getter/Setter]","special"):lt=z.stylize("[Getter]","special"):_t.set&&(lt=z.stylize("[Setter]","special")),be(We,gt)||(tt="["+gt+"]"),lt||(z.seen.indexOf(_t.value)<0?(q(me)?lt=_(z,_t.value,null):lt=_(z,_t.value,me-1),lt.indexOf(`
|
|
198
|
+
`+l)}catch(c){dE(c)&&window.sessionStorage.removeItem("slstreamlogs"),window.sessionStorage.setItem("slstreamlogs",l)}});D(this,"addListener",(a,o)=>this.listeners.has(a)?(this.addStateLog(`listener '${a}' not added, already exists`),()=>{}):(this.listeners.set(a,o),this.addStateLog(`listener '${a}' added`),()=>this.removeListener(a)));D(this,"removeListener",a=>{this.listeners.delete(a),this.addStateLog(`listener '${a}' removed`)});D(this,"connect",()=>{this.updateState(us.Connecting),this.streamCancel&&(this.addStateLog("disconnect prev connection"),this.streamCancel.abort(),this.streamCancel=void 0);const a="get"in this.params&&typeof this.params.get=="function"?this.params.get():this.params;(async()=>{this.streamCancel=new AbortController;try{const o={headers:this.headers.getValues(),signal:this.streamCancel.signal},l=this.method(a,o);for await(const c of l)this.attempt=0,this.onData(c)}catch(o){o instanceof zt&&o.code!=st.Canceled&&this.onStreamError(o)}})(),this.updateState(us.Connected)});D(this,"disconnect",()=>{var a;this.streamCancel&&this.streamCancel.abort(),this.listeners.clear(),(a=this.paramsListener)==null||a.call(this),clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.updateState(us.Disconnected)});D(this,"reconnect",()=>{if(this.reconnectTimeout)this.addStateLog("already reconnecting");else if(this.attempt<this.options.reconnectMaxAttempts){this.updateState(us.Reconnect);const a=Math.min(this.options.reconnectMaxDelay,Math.pow(2,this.attempt)*this.options.reconnectDelay),o=Math.round(a*(1+Math.random())/2);this.reconnectTimeout=setTimeout(()=>{this.attempt++,this.updateState(us.Reconnecting),this.addStateLog(`reconnect attempt ${this.attempt} after ${o}ms`),this.connect(),this.reconnectTimeout=void 0},o)}else this.addStateLog("max reconnect attempts reached"),this.disconnect()});D(this,"getStore",()=>{var a;return(a=this.store)==null?void 0:a.getStore()});D(this,"onData",a=>{try{this.addStateLog(`received data => ${JSON.stringify(a)}`),this.store&&this.store.setValue(a);for(const[,o]of this.listeners)o(a);this.addStateLog(`data routed to ${this.listeners.size} listeners`)}catch(o){this.addStateLog(`error process data => ${o}`)}});D(this,"onStreamError",a=>{if(this.addStateLog(`error => ${a?JSON.stringify(a):"undefined"}}`),a!==void 0){if(a instanceof zt&&a.code!==st.Canceled){this.updateState(us.Failed),this.state.setValue("error",a),this.reconnect();return}this.disconnect()}});const p={status:us.Init,ts:new Date,log:[]};this.state=new Xc(Ro(p),`subscription:${c.name}:state`),this.options={...c,reconnectDelay:c.reconnectDelay??1e3,reconnectMaxDelay:c.reconnectMaxDelay??3e4,reconnectMaxAttempts:c.reconnectMaxAttempts??10,withStore:c.withStore??!1},this.headers=a,this.listeners=new Map,this.params=l,this.method=o,c.withStore&&(this.store=new Lo(Sa(null),`subscription:${c.name}:store`)),"subscribe"in l&&typeof l.subscribe=="function"&&(this.paramsListener=l.subscribe(f=>{this.state.getValue("status")===us.Connected&&(this.addStateLog(`params updated, reconnect => ${JSON.stringify(f)}`),this.reconnect())})),this.updateState(us.Ready)}}const XZ=new Set([st.Unknown,st.Internal,st.DeadlineExceeded,st.ResourceExhausted,st.FailedPrecondition,st.Unavailable,st.DataLoss]),CS=il("grpc:retry"),JZ=n=>async a=>{const o=a.contextValues.get(I9.retryAttempts),l=300,c=a.contextValues.get(I9.retryDelay);if(a.stream||o===0)return n(a);CS.trace({url:a.url,attempts:o,maxDelay:c},"retry options");for(let p=0;;p++)try{return await n(a)}catch(f){CS.trace({attempt:p,error:f},"retry attempt");const y=zt.from(f);if(p>=o||!(y instanceof zt)||!XZ.has(y.code))throw f;const b=Math.min(c,Math.pow(2,p)*l),C=Math.round(b*(1+Math.random())/2);await new Promise(_=>setTimeout(_,C))}},I9={retryAttempts:u6(10,{description:"Number of attempts to retry"}),retryDelay:u6(3e4,{description:"Max delay between retries in milliseconds"})},eX=()=>{const n=localStorage.getItem("sl-device-id");if(n)return n;const a=k9();return localStorage.setItem("sl-device-id",a),a},tX=()=>{var n;return((n=navigator.userAgentData)==null?void 0:n.platform)||navigator.platform};class ES{constructor(a,o){D(this,"toJsonOptions",{emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1});D(this,"transport");D(this,"streamTransport");D(this,"nanoquery");D(this,"host");D(this,"$headers");D(this,"interceptors",[]);D(this,"clients");D(this,"streamClients");D(this,"subscriptions");D(this,"opts");D(this,"addSubscription",(a,o,l)=>{const c=this.subscriptions.get(o);if(c)return c;const p=new ZZ(this.$headers,a,o,l);return this.subscriptions.set(o,p),p});D(this,"removeSubscription",a=>{a.disconnect(),this.subscriptions.delete(a.params)});D(this,"disconnect",()=>{var c,p;for(const[f,y]of this.subscriptions)y.disconnect(),this.subscriptions.delete(f);this.clients.clear(),this.streamClients.clear(),this.subscriptions.clear();const[a,o,l]=Hk({dedupeTime:(c=this.opts)==null?void 0:c.dedupeTime,refetchInterval:(p=this.opts)==null?void 0:p.refetchInterval});this.nanoquery={createFetcherStore:a,createMutatorStore:o,utils:l}});D(this,"registerInterceptor",a=>{this.interceptors.push(a)});D(this,"removeInterceptor",a=>{this.interceptors=this.interceptors.filter(o=>o!==a)});D(this,"getClient",a=>{const o=a.typeName;if(this.clients.has(o))return this.clients.get(o);const l=Pk(a,this.transport);return this.clients.set(o,l),l});D(this,"getStreamClient",a=>{const o=`stream-${a.typeName}`;if(this.clients.has(o))return this.clients.get(o);const l=Pk(a,this.streamTransport);return this.clients.set(o,l),l});D(this,"createPromiseClient",(a,{params:o=[],method:l})=>{const c=this.getClient(a),p=a.methods[l].name,f=[a.typeName,p.charAt(0).toLowerCase()+p.slice(1),...Array.isArray(o)?o:[o]],y=[a.typeName,p.charAt(0).toLowerCase()+p.slice(1)];return{client:c,createRequestOptions:b=>{const C=S9();for(const _ in b){const N=I9[_];C.set(N,b[_])}return C},queryKey:f,queryKeyStr:y.join("")}});D(this,"createStreamClient",a=>({client:this.getStreamClient(a)}));D(this,"setSdkKey",a=>{this.$headers.setValue("sdk",a)});D(this,"setAuth",(a,o)=>{this.$headers.setValue("authorization",a),this.$headers.setValue("sl-user-id",o)});D(this,"setHeader",(a,o)=>this.$headers.setValue(a,o));D(this,"getHeader",a=>this.$headers.getValue(a));D(this,"getHeaders",()=>this.$headers.getValues());D(this,"initInterceptors",()=>{var o;if(this.interceptors.length!==0)return;const a=l=>c=>{const p=this.$headers.getValues();for(const f in p)c.header.set(f,p[f]);return l(c)};this.interceptors.push(a),this.interceptors.push(KZ()),(o=this.opts)!=null&&o.retryable&&this.interceptors.push(JZ)});this.host=a,this.opts=o,this.$headers=new Xc(Ro({"sl-device-id":eX(),"sl-device-os":tX()}),"transport:headers"),this.initInterceptors(),this.clients=new Map,this.streamClients=new Map,this.subscriptions=new Map;const[l,c,p]=Hk({dedupeTime:o==null?void 0:o.dedupeTime,refetchInterval:o==null?void 0:o.refetchInterval});this.nanoquery={createFetcherStore:l,createMutatorStore:c,utils:p},this.transport=zk({baseUrl:a,defaultTimeoutMs:1e4,interceptors:this.interceptors}),this.streamTransport=zk({baseUrl:a,interceptors:this.interceptors})}}const nX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(JC,{method:"retrieveEventId",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;if(!f||typeof f!="string")return"";try{return((y=(await o.retrieveEventId({id:f})).data)==null?void 0:y.id)||""}catch{return""}}})},aX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getStream",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return f?(y=(await o.getStream({id:f})).data)==null?void 0:y.attributes:void 0}})},rX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(JC,{method:"summary",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return f?(y=(await o.summary({id:f})).data)==null?void 0:y.attributes:void 0}})},oX=(n,a)=>{const{queryKey:o,client:l}=a.createPromiseClient(gy,{method:"me",params:[n]});return a.nanoquery.createFetcherStore(o,{fetcher:async()=>{const{data:c}=await l.me({});return{data:c}}})},sX=n=>{const{client:a,createRequestOptions:o}=n.createPromiseClient(gy,{method:"bypassAuth"}),l=o({retryAttempts:0});return({userKey:c,schema:p,init:f,inviterKey:y})=>a.bypassAuth({userKey:c,schema:p,init:f,inviterKey:y},{contextValues:l})},iX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"get",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{var c;return(c=(await o.get({})).data)==null?void 0:c.attributes}})},lX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getOrganization",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{const c=await o.getOrganization({});return c.data?{...c.data.attributes,id:c.data.id}:void 0}})},uX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(f2,{method:"getOrganizationAdvertising",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async()=>{var c;return(c=(await o.getOrganizationAdvertising({})).data)==null?void 0:c.attributes}})},cX=(n,a,o)=>{n.transport=new ES(a.host,{dedupeTime:1e3*60*5,refetchInterval:1e3*60*5,retryable:!0}),n.analyticsTransport=new ES(a.analyticsHost),n.sdk.host=n.transport.host,n.transport.setSdkKey(a.sdkKey),n.transport.setHeader("sl-sdk-version",a.version||"-"),n.transport.$headers.subscribe(l=>{n.analyticsTransport.$headers.getStore().set(l)}),n.sdk.onMount({name:"transport"},()=>()=>{n.transport.disconnect(),n.analyticsTransport.disconnect()}),o()};var qi;(function(n){n.SCHEMA="schema",n.EXTERNAL_TOKEN="eToken",n.TOKEN="token"})(qi||(qi={}));class im extends _m{constructor(){super("user");D(this,"setSchema",o=>{this.write(qi.SCHEMA,o)});D(this,"getSchema",()=>this.read(qi.SCHEMA));D(this,"setToken",o=>{this.write(qi.TOKEN,o)});D(this,"getToken",()=>this.read(qi.TOKEN));D(this,"setExternalToken",o=>{this.write(qi.EXTERNAL_TOKEN,o)});D(this,"getExternalToken",()=>this.read(qi.EXTERNAL_TOKEN));D(this,"removeToken",()=>{this.remove(qi.TOKEN)})}}var Ki;(function(n){n.DISABLED="disabled",n.INITIALIZATION="initialization",n.READY="ready",n.FAILED="failed",n.SUSPENDED="suspended"})(Ki||(Ki={}));const dX=n=>{const a=new im,o=new Lo(Sa(a.getExternalToken()),"userKey"),l=new Lo(Sa(a.getToken()),"userToken"),c=new ei(oX(l.getStore(),n),"user",({data:f,error:y,loading:b},C)=>{var _;if(!y)return(_=f==null?void 0:f.data)!=null&&_.id?f.data.id:b===!1?void 0:C}),p=new ei(iX(l.getStore(),n),"userSettings");return{userKey:o,userToken:l,user:c,userSettings:p}},mX=n=>{const a=new Lo(Sa(void 0),"providerStreamId"),o=new ei(nX(a.getStore(),n),"slStreamId",p=>p==null?void 0:p.data),l=new ei(aX(o.getAtomStore(),n),"streamSettings"),c=new ei(rX(o.getAtomStore(),n),"streamSettings");return o.getAtomStore().listen(p=>{(p===""||p===void 0)&&(l.getStore().mutate(void 0),c.getStore().mutate(void 0))}),{providerStreamId:a,slStreamId:o,streamSettings:l,streamSummary:c}},fX=n=>{const a=new Lo(Sa(void 0),"enabled"),o=new Lo(Sa(Ki.DISABLED),"status"),l=new ei(lX(a.getStore(),n),"organizationSettings",y=>{var b;return(b=y==null?void 0:y.data)==null?void 0:b.id}),c=new ei(uX(l.getAtomStore(),n),"organizationAdvertising"),p=dX(n),f=mX(n);return{enabled:a,status:o,providerStreamId:f.providerStreamId,slStreamId:f.slStreamId,streamSettings:f.streamSettings,streamSummary:f.streamSummary,user:p.user,userKey:p.userKey,userToken:p.userToken,userSettings:p.userSettings,organizationSettings:l,organizationAdvertising:c}};class pX extends L6{constructor(o){const l=fX(o),c=WZ(l);super(c,"core");D(this,"stores");D(this,"subscribe",o=>{let l;for(l in this.stores){const c=o[l];l in o&&c!==void 0&&this.stores[l].subscribe(o[l])}});D(this,"unsubscribe",()=>this.getStore().off());this.stores=l}getValue(){throw new Error("Not implemented")}getValues(){return this.stores}setValue(){throw new Error("Not implemented")}}const hX=(n,a,o)=>{n.store=new pX(n.transport),n.stores=n.store.getValues(),n.sdk.enabled=n.stores.enabled.getStore(),n.sdk.status=n.stores.status.getStore(),n.sdk.sdkStore=Object.fromEntries(Object.entries(n.stores).map(([l,c])=>[l,c.getStore()])),n.sdk.organizationStore=()=>n.stores.organizationSettings.getStore(),n.sdk.streamStore=()=>n.stores.streamSettings.getStore(),n.sdk.streamSummary=()=>n.stores.streamSummary.getStore(),n.storeUnsubscribe=()=>{n.store.unsubscribe()},o()},gX=n=>{const{client:a}=n.createPromiseClient(nE,{method:"list"});return o=>a.list(o)},mE=n=>{const{client:a}=n.createPromiseClient(nE,{method:"summary"});return o=>a.summary(o)},yX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(gy,{method:"getFriends",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{if(!f)return[];try{return(await o.getFriends({})).data}catch{return[]}}})},vX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"get",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y;return(y=(await o.get({eventId:f})).data)==null?void 0:y.attributes},refetchInterval:0,dedupeTime:1e3*60*60})},TX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"syncQuestion",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var b,C,_,N;if(!f)return;const y=await o.syncQuestion({filter:{eventId:f}});if(((_=(C=(b=y.data)==null?void 0:b.attributes)==null?void 0:C.question)==null?void 0:_.type)!==ye.PROMOTION)return(N=y.data)==null?void 0:N.attributes},dedupeTime:1e3*60*10,refetchInterval:0})},bX=async(n,a)=>{const{client:o}=a.createPromiseClient(Oo,{method:"item",params:[n]});return(await o.item({id:n})).data},kX=(n,a)=>{const{client:o}=a.createStreamClient(Oo),l=ku({eventId:n.get()||"",feedId:""});return n.subscribe((c="")=>{l.set({eventId:c,feedId:""})}),a.addSubscription(o.subscription,l,{name:"feedSubscription"})},SX=(n,a)=>{const{client:o}=a.createStreamClient(Oo);return a.addSubscription(o.questionSubscription,{questionId:n},{name:"questionSubscription"})},wX=async(n,a)=>{var l,c;const{client:o}=a.createPromiseClient(Oo,{method:"questionByUser",params:[n]});return(c=(l=(await o.questionByUser({questionId:n})).data)==null?void 0:l.attributes)==null?void 0:c.question},N9=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"questionByUser",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var y,b;return(b=(y=(await o.questionByUser({questionId:f})).data)==null?void 0:y.attributes)==null?void 0:b.question},dedupeTime:1e3*60*5})},fE=async(n,a)=>{var b;if(!n)return;const{client:o}=a.createPromiseClient(Oo,{method:"getQuestion",params:[n]}),l=await o.getQuestion({id:n});if(!((b=l.data)!=null&&b.attributes))return;const{options:c,notification:p,...f}=l.data.attributes,y=(c==null?void 0:c.options.case)==="promotion"?c==null?void 0:c.options.value:void 0;return{id:f.id,question:f,promotion:y,notification:p}},CX=(n,a,o)=>{const{client:l,queryKey:c}=o.createPromiseClient(Oo,{method:"list",params:[n,a]});return o.nanoquery.createFetcherStore(c,{fetcher:async(p,f,y,b)=>y?(await l.list({eventId:y,filter:{types:b===Jc.ALLOWED?[]:[ye.FACTOID,ye.PROMOTION,ye.TWEET],statuses:[yn.ACTIVE,yn.RESOLVED]}})).data:[],dedupeTime:0,refetchInterval:0})},EX=(n,a)=>{const{client:o,queryKey:l}=a.createPromiseClient(Oo,{method:"list",params:[n]});return a.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f)=>{var b;if(!f)return;const y=(b=(await o.list({eventId:f,filter:{types:[ye.PROMOTION],statuses:[yn.ACTIVE]},pagination:{page:0,pageSize:1}})).data)==null?void 0:b[0];if(y.type==="promotion")return fE(y.id,a)},dedupeTime:0,refetchInterval:0})},_X=(n,a,o)=>{const l=pb([a,o],()=>{var C,_;const f=a.get();if(!f)return;const y=(C=o.get().data)==null?void 0:C.find(N=>N.id===(f==null?void 0:f.questionId)),b=(_=f==null?void 0:f.question)==null?void 0:_.openedFrom;return y?(y.openedFrom=b,y):f.question}),c=pb(l,f=>f&&f.type==="question"?f.id:void 0),p=N9(c,n);return{$store:l,$extendedStore:p,updateExtendedQuestion:f=>{const y=p.get().data,b=(C,_)=>{if(!C||!_)return C||_||[];const N=[];for(let L=0;L<C.length;L++)N.push({...C[L],..._[L],correct:C[L].correct,youVoted:C[L].youVoted,pointsEarned:C[L].pointsEarned});return N};p.mutate({...f,options:y==null?void 0:y.options,subject:y==null?void 0:y.subject,appearance:y==null?void 0:y.appearance,answers:b(y==null?void 0:y.answers,f==null?void 0:f.answers)})}}};var c6;(function(n){n.SHOWED="showed"})(c6||(c6={}));class IX extends _m{constructor(){super("advertisement");D(this,"setShowed",o=>{this.write(c6.SHOWED,o,"true")});D(this,"isViewed",o=>this.read(c6.SHOWED,o))}}const NX=n=>{var f,y,b,C,_;const a=(y=(f=n.data)==null?void 0:f.attributes)==null?void 0:y.question;if((((_=(C=(b=n.data)==null?void 0:b.attributes)==null?void 0:C.feedItem)==null?void 0:_.type)==="promotion"?n.data.attributes.feedItem:void 0)===void 0||!a)return;const{options:o,notification:l,...c}=a,p=(o==null?void 0:o.options.case)==="promotion"?o.options.value:void 0;return{id:c.id,question:c,notification:l,promotion:p}},Mh=n=>n.startsWith("http://")||n.startsWith("https://")?new URL(n).toString():n,RX=({gamOptions:n,gamBaseUrl:a})=>{const o=`${a}?`,l=[];for(const c in n){const p=c.replace(/([a-zA-Z])(?=[A-Z])/g,"$1_").toLowerCase(),f=n[c];if(f)if(typeof f=="string")l.push(`${p}=${Mh(f)}`);else if(Array.isArray(f))l.push(`${p}=${f.map(Mh).join(",")}`);else{const y=Object.entries(f).map(([b,C])=>Array.isArray(C)?`${b}=${C.map(Mh).join(",")}`:typeof C=="string"?`${b}=${Mh(C)}`:`${b}=${C}`).join("&").replaceAll("=","%3D").replaceAll("&","%26").replaceAll(",","%2C");l.push(`${p}=${y}`)}}return o+l.join("&")},LX=(n,a,o)=>{let l=!1;const c=o.transport,p=il("advertisement"),f=new IX,y=Ro({}),b=EX(n,c),C=()=>{var F,j,q;y.setKey("hasNotification",!1);const R=y.get(),P=(F=R.data)==null?void 0:F.question.id,V=(q=(j=R.data)==null?void 0:j.promotion)==null?void 0:q.type;P&&Va.emit("advertisement",{action:"notification-opened",payload:{id:P,type:V}})},_=()=>{var j,q,Y,J;const R=y.get(),P=(j=R.data)==null?void 0:j.question.id,V=(Y=(q=R.data)==null?void 0:q.promotion)==null?void 0:Y.type,F=(J=y.get())==null?void 0:J.isOpened;P&&!F&&(p.debug({id:P},"markAsViewed: %o"),f.setShowed(P),y.setKey("isOpened",!0),Va.emit("advertisement",{action:"opened",payload:{id:P,type:V}}))},N=(R,P)=>{var V;P?y.set({loading:!1,error:void 0,data:P,hasNotification:((V=P==null?void 0:P.notification)==null?void 0:V.enabled)===d9.NOTIFICATION_ENABLED,close:()=>L(P.question.id),isViewed:!!f.isViewed(P.question.id)}):(y.setKey("loading",!0),fE(R,c).then(F=>{var j;return y.set({loading:!1,error:void 0,data:F,hasNotification:((j=F==null?void 0:F.notification)==null?void 0:j.enabled)===d9.NOTIFICATION_ENABLED,close:()=>L(F==null?void 0:F.question.id),isViewed:F&&!!f.isViewed(F.question.id)})}).catch(F=>y.set({loading:!1,error:F,data:void 0})))};y.subscribe((R,P)=>{var V,F,j,q,Y,J,ne;if(((F=(V=R.data)==null?void 0:V.promotion)==null?void 0:F.type)===Eo.EXTERNAL_AD&&!(R!=null&&R.externalAd)&&((j=R.data.promotion.adCampaigns)!=null&&j.gamOptions)&&((q=R.data.promotion.adCampaigns)!=null&&q.gamBaseUrl)){const ue=RX(R.data.promotion.adCampaigns);y.setKey("externalAd",{type:"gam",url:ue})}(Y=R.data)!=null&&Y.promotion&&!R.isOpened&&Va.emit("advertisement",{action:"received",payload:{id:R.data.question.id,type:R.data.promotion.type,hasNotification:!!R.hasNotification,isViewed:!!f.isViewed(R.data.question.id)},skipAnalytics:R.data.question.id===((J=P==null?void 0:P.data)==null?void 0:J.question.id)}),!(R!=null&&R.data)&&(P!=null&&P.data)&&Va.emit("advertisement",{action:"closed",payload:{id:P.data.question.id,type:(ne=P.data.promotion)==null?void 0:ne.type,hasNotification:!!P.hasNotification,isViewed:!!f.isViewed(P.data.question.id)}})});const L=R=>{var P,V;(!R||((V=(P=y.get())==null?void 0:P.data)==null?void 0:V.question.id)===R)&&y.set({})};return{connect:()=>{l||(l=!0,b.subscribe((R,P)=>{R.data&&(!(P!=null&&P.data)||R.data.id!==P.data.id)&&N(R.data.question.id,R.data)}),a.addListener("promotion",R=>{const P=NX(R);if(P){if(P.question.status===yn.RESOLVED){L(P.question.id),p.debug({promotion:P},"resolved: %o");return}if(P.question.status===yn.ACTIVE){p.debug({promotion:P},"active: %o"),N(P.question.id,P);return}p.debug({promotion:P},"skip: %o")}}))},hide:L,show:N,open:C,markAsViewed:_,$store:y}};var Jc;(function(n){n.ALLOWED="allowed",n.DISALLOWED="disallowed"})(Jc||(Jc={}));class OX{constructor(a){D(this,"slStreamId");D(this,"organizationId");D(this,"userId");D(this,"interactiveAllowed");D(this,"openedQuestionId");D(this,"openedQuestion");D(this,"activeQuestionId");D(this,"feedList");D(this,"moderationId");D(this,"moderation");D(this,"feedSubscription");D(this,"questionSubscription");D(this,"advertisement");D(this,"notifications");D(this,"log");D(this,"transport");D(this,"cancels",new Set);D(this,"getCurrentSessionId",a=>{const o=a.eventId||this.slStreamId.get()||"",l=a.userId||this.userId.get()||"",c=a.organizationId||this.organizationId.get()||"",p=a.entity||"",f=a.prefix||"";return[c,o,l,f,p].join(":")});D(this,"disconnect",()=>{var a;(a=this.feedSubscription)==null||a.disconnect(),this.questionSubscription!==void 0&&(this.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0)});D(this,"openQuestion",(a,o)=>{this.openedQuestionId.set({questionId:a,question:o}),this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:a}))});D(this,"closeQuestion",a=>{this.openedQuestionId.set(void 0),a&&this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:a}))});this.transport=a.transport,this.log=il("gamification-background"),this.slStreamId=a.stores.slStreamId.getAtomStore(),this.organizationId=a.stores.organizationSettings.getAtomStore(),this.userId=a.stores.user.getAtomStore(),this.moderationId=new Lo(Sa(void 0),"moderationId").getStore(),this.interactiveAllowed=new Lo(Sa(Jc.DISALLOWED),"interactiveAllowed").getStore(),this.openedQuestionId=new Lo(Sa(void 0),"openedQuestionId").getStore(),this.notifications=a.notifications,this.moderation=new ei(vX(this.slStreamId,a.transport),"gamification:moderation"),this.feedList=new ei(CX(this.slStreamId,this.interactiveAllowed,a.transport),"gamification:feedList"),this.activeQuestionId=TX(this.slStreamId,a.transport),this.openedQuestion=_X(a.transport,this.openedQuestionId,this.feedList.getStore()),this.cancels.add(this.openedQuestionId.listen(o=>{this.log.debug({item:o},"received question"),o!=null&&o.questionId?(this.questionSubscription=SX(o.questionId,a.transport),this.questionSubscription.addListener("feed-subscription-opened-question",l=>{var c,p;this.openedQuestion.updateExtendedQuestion((p=(c=l.data)==null?void 0:c.attributes)==null?void 0:p.question)}),this.questionSubscription.connect()):(this.log.info("cleanup on close question"),this.questionSubscription!==void 0&&(a.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0))})),this.feedSubscription=kX(this.slStreamId,a.transport),this.cancels.add(this.feedSubscription.addListener("feed-subscription-active-question",o=>{var p,f,y,b;const l=(f=(p=this.activeQuestionId.get().data)==null?void 0:p.question)==null?void 0:f.id,c=(b=(y=o.data)==null?void 0:y.attributes)==null?void 0:b.question;if(!(!c||c.type===ye.PROMOTION)){if(c.status===yn.RESOLVED){l===c.id&&this.activeQuestionId.mutate(void 0);return}window.requestAnimationFrame(()=>{var C;this.activeQuestionId.mutate((C=o.data)==null?void 0:C.attributes)})}})),this.cancels.add(this.feedSubscription.addListener("moderation update",o=>{window.requestAnimationFrame(()=>{var l,c,p,f;((c=(l=o.data)==null?void 0:l.attributes)==null?void 0:c.question)===void 0&&((f=(p=o.data)==null?void 0:p.attributes)!=null&&f.moderation)&&this.moderation.invalidate()})})),this.cancels.add(this.activeQuestionId.subscribe((o,l)=>{var c,p,f,y,b,C,_;(c=o.data)!=null&&c.feedItem&&((f=(p=o.data)==null?void 0:p.feedItem)==null?void 0:f.id)!==((b=(y=l==null?void 0:l.data)==null?void 0:y.feedItem)==null?void 0:b.id)&&a.onQuestionActivate({stage:"activate",id:o.data.feedItem.id,isViewed:!!this.notifications.isViewed(this.getCurrentSessionId({prefix:"notification",entity:o.data.feedItem.id})),hasNotification:!0,type:o.data.feedItem.type}),!((C=o.data)!=null&&C.feedItem)&&((_=l==null?void 0:l.data)!=null&&_.feedItem)&&a.onQuestionActivate({stage:"deactivate",id:l.data.feedItem.id,isViewed:!!this.notifications.isViewed(this.getCurrentSessionId({prefix:"notification",entity:l.data.feedItem.id})),hasNotification:!0,type:l.data.feedItem.type})})),this.feedSubscription.connect(),this.cancels.add(this.interactiveAllowed.listen(()=>{window.requestAnimationFrame(()=>{this.activeQuestionId.invalidate()})})),a.sdk.onMount({name:"gamification-background"},()=>()=>{this.activeQuestionId.off();for(const o of this.cancels)o(),this.cancels.delete(o)}),this.advertisement=LX(this.slStreamId,this.feedSubscription,a)}}class AX{constructor(a){D(this,"notificationsList");D(this,"store");D(this,"timeouts");D(this,"waitingQueue");D(this,"activeQueue");D(this,"options");D(this,"logger");D(this,"addToQueue",a=>{var c;if(this.store.has(a.id)){this.logger.debug({notification:a},"skip existed notification: %o");return}const o=a.close,l=a.action;if(this.store.set(a.id,{...a,close:(...p)=>{o&&o(...p),this.closeNotification(a.id)},action:(...p)=>{l&&l(...p),this.closeNotification(a.id,{animateHiding:!1})}}),this.waitingQueue.add(a.id),this.activeQueue.size===this.options.concurrency){const[p]=this.activeQueue;if(((c=this.store.get(p))==null?void 0:c.persistent)!==!0)this.closeNotification(p);else{const[f]=this.waitingQueue;this.waitingQueue.size>1&&this.closeNotification(f),this.tickWaitingQueue()}}else this.tickWaitingQueue()});D(this,"tickWaitingQueue",()=>{if(this.activeQueue.size<this.options.concurrency){const[a]=this.waitingQueue;if(!a)return;this.activeQueue.add(a),this.waitingQueue.delete(a),this.logger.debug({job:a},"waiting queue tick"),this.tickActiveQueue(a)}else this.logger.debug({queueSize:this.activeQueue.size,concurrency:this.options.concurrency},"waiting queue tick skipped")});D(this,"tickActiveQueue",a=>{if(!a)return;const o=this.store.get(a);if(!o){this.logger.debug({notificationId:a},"active queue tick skipped, notification not exist");return}Va.emit("notification",{action:"received",payload:{questionId:o.data.questionId,questionType:o.data.questionType}});const l=setTimeout(()=>{const c=a,p=new Map(this.notificationsList.get());p.set(o.id,o),this.notificationsList.set(p);const f=setTimeout(()=>{this.logger.debug({notificationId:c,delay:o.autoHideDuration||5e3},"notification hiding by autoHideDuration"),this.closeNotification(c)},o.autoHideDuration||5e3);this.timeouts.set(c,f),this.logger.debug({notificationId:c,queue:[...p.values()]},"notification displayed")},o.delay||0);this.timeouts.set(a,l),this.logger.debug({notificationId:a},"active queue tick completed"),this.tickWaitingQueue()});D(this,"closeNotification",(a,{animateHiding:o=!0}={})=>{const l=new Map(this.notificationsList.get()),c=l.get(a);if(c){c.hiding=!(this.waitingQueue.size>=this.options.concurrency)&&o,this.notificationsList.set(l);const p=setTimeout(()=>{const f=new Map(this.notificationsList.get());f.delete(a),this.notificationsList.set(f);const y=this.timeouts.get(a);y!==void 0&&(clearTimeout(y),this.timeouts.delete(a)),this.logger.debug({notificationId:a},"notification hidden"),c.hiding&&Va.emit("notification",{action:"closed",payload:{questionId:c.data.questionId,questionType:c.data.questionType}})},this.options.animationDelay||0);this.timeouts.set(a,p)}return this.store.delete(a),this.activeQueue.delete(a),this.waitingQueue.delete(a),this.tickWaitingQueue(),this.logger.debug({notificationId:a},"notification hiding"),c});D(this,"drain",()=>{this.store.clear(),this.timeouts.clear(),this.waitingQueue.clear(),this.activeQueue.clear(),this.notificationsList.off(),this.notificationsList.set(new Map)});this.options=a,this.logger=il("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notificationsList=Sa(new Map)}}var d6;(function(n){n.OPENED="opened"})(d6||(d6={}));class xX extends _m{constructor(){super("notification");D(this,"setOpened",o=>{this.write(d6.OPENED,o,"true")});D(this,"isOpened",o=>this.read(d6.OPENED,o));D(this,"clearNotification",()=>{this.clear()})}}var bu;(function(n){n[n.ONBOARDING=1]="ONBOARDING",n[n.QUESTION=2]="QUESTION",n[n.QUESTION_RESOLVED=3]="QUESTION_RESOLVED"})(bu||(bu={}));class PX{constructor(a={}){D(this,"queue");D(this,"storage");D(this,"isViewed",a=>this.storage.isOpened(a));D(this,"add",a=>{if(!this.isViewed(a.id)){if(a.data&&a.emitEvent){const o=a.action;a.action=(...l)=>{o&&o(...l),Va.emit("notification",{action:"opened",payload:{questionId:a.data.questionId,questionType:a.data.questionType}})}}this.queue.addToQueue(a)}});D(this,"close",(a,{markAsViewed:o=!0,animateHiding:l}={})=>{this.queue.closeNotification(a,{animateHiding:l}),o&&this.markAsViewed(a)});D(this,"getActiveNotification",()=>{const a=this.queue.notificationsList.get();if(!(a!=null&&a.size))return null;for(const o of a.values())if(o.type===bu.ONBOARDING)return o;return a.values().next().value});D(this,"getQueueStore",()=>this.queue.notificationsList);D(this,"markAsViewed",a=>{this.storage.setOpened(a)});this.storage=new xX,this.queue=new AX({concurrency:1,animationDelay:1600,...a})}}const MX=(n,a,o)=>{n.notifications=new PX(void 0),n.addNotification=n.notifications.add,n.sdk.getNotificationsStore=()=>n.notifications.getQueueStore(),n.sdk.getActiveNotification=()=>n.notifications.getActiveNotification(),n.sdk.onMount({name:"notifications"},()=>()=>{n.notifications.queue.drain()}),o()};var c2;(function(n){n.UNKNOWN="unknown",n.ALREADY_VOTED="already_voted"})(c2||(c2={}));const DX=async(n,a)=>{var p;const{client:o,createRequestOptions:l}=n.createPromiseClient(Oo,{method:"submitAnswer"}),c=l({retryAttempts:0});try{return await o.submitAnswer({data:a},{contextValues:c})}catch(f){throw((p=zt.from(f))==null?void 0:p.code)===st.AlreadyExists?new Error(c2.ALREADY_VOTED):new Error(c2.UNKNOWN)}},UX=(n,a)=>{const{client:o,createRequestOptions:l}=n.createPromiseClient(Oo,{method:"submitInplay"}),c=l({retryAttempts:0});return o.submitInplay({data:{eventId:+a}},{contextValues:c})};var lm;(function(n){n.ONBOARDING="onboarding",n.ONBOARDING_IO="onboarding_io"})(lm||(lm={}));class FX extends _m{constructor(){super("gamification-session",window.sessionStorage);D(this,"writeValue",(o,l)=>{this.write(...o,l)});D(this,"readValue",o=>this.read(...o))}}class pE extends _m{constructor(){super("gamification");D(this,"sessionStorage");D(this,"saveOnboardingStatus",({userId:o,eventId:l,organizationId:c},p)=>{this.write(lm.ONBOARDING,c,o,l,p)});D(this,"getOnboardingStatus",({userId:o,eventId:l,organizationId:c})=>this.read(lm.ONBOARDING,c,o,l));D(this,"setOnboardingInstantOpen",({userId:o,eventId:l,organizationId:c})=>{this.sessionStorage.writeValue([lm.ONBOARDING_IO,c,o,l],"1")});D(this,"getOnboardingInstantOpen",({userId:o,eventId:l,organizationId:c})=>this.sessionStorage.readValue([lm.ONBOARDING_IO,c,o,l]));this.sessionStorage=new FX}}const VX={pageSize:10},jX=(n,a,o,l,c)=>{let p=0;const f=Sa({pageSize:VX.pageSize,page:0}),y=Ro({data:[],key:Date.now(),hasMore:!0,loading:void 0,error:void 0}),b=gX(n),C=async()=>{var P;const L=a.get(),R=((P=l.getStore().get().data)==null?void 0:P.map(V=>V.slId))||[];if(L&&(R!=null&&R.length)){const V=o.get();V&&R.push(V),y.setKey("loading",!0),y.setKey("data",[]);const F=await b({eventId:L,usersIds:R});y.set({data:F.data.map((j,q)=>({...j.attributes,friendsRank:q+1})),hasMore:!1,key:Date.now(),loading:!1}),F.meta&&(p=Math.round(F.meta.count/F.meta.pageSize))}},_=()=>{C()},N=L=>{const R=f.get(),P=L||R.page+1;P<=p&&f.set({...R,page:P})};return T6(y,()=>{const L=a.listen(C),R=l.listen(C);return()=>{L(),R()}}),{$store:y,fetchMore:N,invalidate:_}};class BX extends _m{constructor(){super("deep-link-context",window.sessionStorage);D(this,"get",this.read);D(this,"set",this.write);D(this,"del",this.remove)}}const _S="sldl",O6="sldl_uid",hE="sldl_eid",gE="sldl_e_eid",$X=new Set([O6,hE,gE]),IS=n=>{const a={},o={};for(const[l,c]of n)$X.has(l)?a[l]=c:o[l]=c;return{result:a,remain:o}},zX=({hash:n,search:a})=>{if(n&&n.includes(_S)){const o=new URLSearchParams(n.substr(1));return{hash:IS(o)}}if(a&&a.includes(_S)){const o=new URLSearchParams(a);return{search:IS(o)}}return null},NS=il("deep_link"),Xs={debug:(...n)=>{NS.debug(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)},trace:(...n)=>{NS.trace(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)}},HX=(n,a)=>{const{hash:o,search:l}=window.location;if(Xs.debug({hash:o,search:l},"get deep link data from"),o||l){const c=zX({hash:o,search:l});if(Xs.debug(c,"parse deep link result"),c){const{hash:p,search:f}=c,{result:y,remain:b}=p||f;if(Object.keys(y).length!==0){n.setValue("data",y);const C=Object.keys(b).length!==0;if(p){let _="";C&&(_=`#${new URLSearchParams(b).toString()}`,Xs.debug({updatedHash:_},"update hash")),window.history.replaceState(null,"",window.location.pathname+window.location.search+_)}if(f){let _="";C&&(_=`?${new URLSearchParams(b).toString()}`,Xs.debug({updatedSearch:_},"update search")),window.history.replaceState(null,"",window.location.pathname+_+window.location.hash)}a(y)}}}n.setValue("parsed",!0)},GX=(n,a,o)=>{const l=new BX,c=l.get("sl-deep-link-store");let p={};if(c)try{p=JSON.parse(c)}catch(y){Xs.debug(y)}n.deepLink={$store:new Xc(Ro(p),"deep-link-context"),getDeepLinkData:()=>{const{data:y,used:b}=n.deepLink.$store.getValues();return{data:y,used:b}},deepLinkUsed:y=>{Xs.debug(`logged in with inviterId: ${y}`),n.deepLink.$store.setValue("used",!0)},onDeepLinkHandlers:new Set},n.sdk.getInviter=()=>{const{data:y,used:b}=n.deepLink.getDeepLinkData();return b?y==null?void 0:y[O6]:void 0},n.sdk.inviteDisplayed=()=>{n.deepLink.$store.getStore().set({}),n.deepLink.$store.getStore().off(),l.del("sl-deep-link-store")},n.deepLink.$store.subscribe(y=>l.set("sl-deep-link-store",JSON.stringify(y))),n.sdk.addDeepLinkHandler=y=>{localStorage.getItem("SL_DEBUG")&&Xs.trace("adding deep link handler"),n.deepLink.onDeepLinkHandlers.add(y)},a.onDeepLinkHandled&&n.sdk.addDeepLinkHandler(a.onDeepLinkHandled),n.sdk.removeDeepLinkHandler=y=>{Xs.trace("removing deep link handler"),n.deepLink.onDeepLinkHandlers.delete(y)};const f=y=>{n.deepLink.$store.setValue("handled",!0),Xs.trace({size:n.deepLink.onDeepLinkHandlers.size},"deep link handled, call callbacks");for(const b of n.deepLink.onDeepLinkHandlers)try{Xs.trace("called handler"),b(y)}catch(C){console.error(C)}};HX(n.deepLink.$store,f),o()},qX=il("bypass");class WX extends qZ{constructor(o,l,c){super();D(this,"$coreStore");D(this,"deepLink");D(this,"transport");D(this,"bypassLogin");D(this,"me",async()=>{var o;return this.$coreStore.getValues().user.invalidate(),(o=await this.$coreStore.getValues().user.getValue())==null?void 0:o.data});D(this,"login",async(o,l)=>{var _,N,L;this.$coreStore.getValues().userKey.setValue(l);const{used:c,data:p}=this.deepLink.getDeepLinkData(),f=c?"":p==null?void 0:p[O6];qX.debug({inviterKey:f},"login with inviterKey");const y=await this.bypassLogin({schema:o,userKey:l,inviterKey:f,init:!1}),b=(_=y.meta)==null?void 0:_.jwt,C=(N=y.data)==null?void 0:N.id;if(!b||!C)throw new Error("internal: token missing");return(L=y.meta)!=null&&L.inviterKey&&this.deepLink.deepLinkUsed(y.meta.inviterKey),this.$coreStore.getValues().user.getStore().mutate({data:y.data}),this.saveUser(b,C),b});D(this,"isAuthenticated",()=>this.me());D(this,"logout",()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),new im().clear()});D(this,"softLogout",()=>{const o=new im;this.transport.setAuth("",""),o.setToken(""),this.reLogin()});D(this,"reLogin",()=>{const o=new im,l=o.getToken(),c=o.getExternalToken();if(this.$coreStore.getValues().userKey.setValue(c),l)return this.saveUser(l,""),this.me().then(p=>{if(p!=null&&p.id){const f=p.id;this.saveUser(l,f)}});if(c&&!l){const p=o.getSchema();p&&c&&this.login(p,c).catch(()=>{this.logout()})}});D(this,"saveUser",(o,l)=>{this.transport.setAuth(o,l),this.$coreStore.getValues().userToken.setValue(o),new im().setToken(o)});D(this,"connect",()=>{this.transport.registerInterceptor(o=>async l=>{try{return await o(l)}catch(c){throw c.code&&(c.code===7||c.code===16)&&this.transport.getHeader("authorization")&&this.softLogout(),c}})});this.$coreStore=o,this.deepLink=c,this.transport=l,this.bypassLogin=sX(this.transport),this.connect()}}const Zf=new im,QX=(n,a,o)=>{n.auth=new WX(n.store,n.transport,n.deepLink),n.stores.status.listen(l=>{l===Ki.READY&&n.auth.reLogin()}),n.sdk.userId=n.stores.user.getAtomStore,n.sdk.authorizationBypass=async(l,c)=>{if(!(Zf.getSchema()===l&&Zf.getExternalToken()===c&&n.transport.getHeader("authorization")))try{await n.auth.login(l,c),Zf.setSchema(l),Zf.setExternalToken(c)}catch{n.sdk.logout()}},n.sdk.logout=()=>{n.auth.logout(),Zf.clear()},n.sdk.getUserStore=()=>n.stores.user.getStore(),n.sdk.isUserAuthorized=()=>n.auth.isAuthenticated(),o()},RS=il("video_player"),Dh={debug:(...n)=>{RS.debug(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)},trace:(...n)=>{RS.trace(...n),localStorage.getItem("SL_DEBUG")&&console.log(...n)}},YX=(n,a,o)=>{n.videoPlayer={controllers:new Set},n.sdk.addVideoPlayerController=l=>{Dh.trace("adding video player controller"),n.videoPlayer.controllers.add(l)},a.videoPlayerController&&n.sdk.addVideoPlayerController(a.videoPlayerController),n.sdk.removeVideoPlayerController=l=>{Dh.trace("removing video player controller"),n.videoPlayer.controllers.delete(l)},n.sdk.controlVideoPlayer=l=>{Dh.trace("controlling video player");for(const c of n.videoPlayer.controllers){Dh.trace("calling video player controller");try{c(l)}catch(p){console.error(p)}}},o()},KX={[ye.FACTOID]:"insight",[ye.POLL]:"poll",[ye.TRIVIA]:"trivia",[ye.PREDICTION]:"prediction",[ye.TWEET]:"tweet"},ZX=(n,a,o)=>{n.sdk.uiState=Ro({}),n.ui={enableAppNotification:function(){n.sdk.uiState.setKey("appNotification",!0)},disableAppNotification:function(){n.sdk.uiState.get().app||n.sdk.uiState.setKey("appNotification",!1)},enableApp:function(){n.sdk.uiState.set({app:!0,appNotification:!0})},disableApp:function(){n.sdk.uiState.set({...n.sdk.uiState.get(),appNotification:!1,app:!1})}},a.onContentActivate&&(n.ui.onContentActivate=a.onContentActivate);const l=c=>{n.ui.onContentActivate&&n.ui.onContentActivate({...c,type:"advertisement"})};n.onQuestionActivate=({questionType:c,...p})=>{if(n.ui.onContentActivate){const f=p.type||c&&KX[c]||"question";n.ui.onContentActivate({...p,type:f})}},n.sdk.onMount({name:"ui"},()=>{const c=y=>{var b,C;if(((b=y.slEventBus)==null?void 0:b.type)==="notification")switch(y.slEventBus.action){case"received":n.ui.enableAppNotification();break;case"closed":n.ui.disableAppNotification();break}if(((C=y.slEventBus)==null?void 0:C.type)==="advertisement"&&a.withAd){const _=y.slEventBus,{hasNotification:N,id:L,isViewed:R,type:P}=_.payload;switch(_.action){case"notification-opened":n.sdk.uiState.set({promotionExternalAd:P===Eo.EXTERNAL_AD,promotionBanner:!0,promotionNotification:!1,promotionOverlay:!0,promotionSidebar:!0});break;case"received":if(n.sdk.closeFeature(),l({stage:"activate",id:L,hasNotification:N,isViewed:R}),!a.withAdNotification){n.sdk.uiState.set({promotionBanner:!0,promotionOverlay:!0,promotionSidebar:!0,promotionExternalAd:P===Eo.EXTERNAL_AD});break}N?n.sdk.uiState.set({promotionNotification:!0}):n.sdk.uiState.set({promotionBanner:!0,promotionOverlay:!0,promotionSidebar:!0,promotionExternalAd:P===Eo.EXTERNAL_AD});break;case"closed":console.log("closed",_.payload),n.sdk.uiState.set({...n.sdk.uiState.get(),promotionNotification:!1,promotionBanner:!1,promotionOverlay:!1,promotionExternalAd:!1,promotionSidebar:!1}),l({stage:"deactivate",id:L,hasNotification:N,isViewed:R});break}}},p=Va.listen(c),f=n.activeFeature.subscribe(y=>{y?n.ui.enableApp():n.ui.disableApp()});return()=>{p(),f()}}),o()},XX=(n,a,o)=>{const l={onMountedFired:!1},c=new Map,p=new Map;n.sdk=Object.create(null),n.sdk.withAuth=!1,n.sdk.onMount=({name:f,clear:y},b)=>{var C,_;if(c.has(f)){const N=p.get(f);N&&N(),c.delete(f),p.delete(f)}c.set(f,{cb:b,clear:y}),((_=(C=n==null?void 0:n.stores)==null?void 0:C.enabled)==null?void 0:_.get())==="on"&&p.set(f,b())},n.ready=()=>{n.stores.enabled.subscribe(f=>{f==="on"&&l.onMountedFired===!1&&(c.forEach(({cb:y},b)=>p.set(b,y())),l.onMountedFired=!0),f!=="on"&&l.onMountedFired===!0&&(p.forEach(y=>y()),p.clear(),c.forEach(({clear:y},b)=>y&&c.delete(b)),l.onMountedFired=!1)})},n.sdk.initializeApp=async f=>{if(n.contextConfig=f,n.stores.enabled.get()==="on")return{enabled:!0};n.storeSubscribe(),n.stores.enabled.setValue("on"),n.stores.status.setValue(Ki.INITIALIZATION);try{const y=await n.stores.organizationSettings.getValue();return y?(n.stores.status.setValue(Ki.READY),{enabled:!!y}):(n.stores.status.setValue(Ki.FAILED),{err:"failed"})}catch(y){return n.stores.enabled.setValue(),n.stores.status.setValue(Ki.FAILED),{err:`${y}`}}},n.sdk.disableApp=()=>{n.stores.enabled.get()==="on"&&(n.stores.enabled.setValue(),n.stores.status.setValue(Ki.DISABLED),n.stores.slStreamId.setValue(),n.stores.providerStreamId.setValue(),n.sdk.closeFeature(!0),n.storeUnsubscribe(),n.transport.disconnect())},n.sdk.createEventSession=f=>{n.stores.providerStreamId.setValue(f)},o()},JX=(n,a)=>{const{client:o,queryKey:l}=n.createPromiseClient(f2,{method:"generateDeepLink",params:a});return n.nanoquery.createFetcherStore(l,{fetcher:async(c,p,f,y)=>{var b;if(!f)return{};try{return(b=(await o.generateDeepLink({data:{gamification:!0,externalEventId:y,eventId:f}})).data)==null?void 0:b.attributes}catch{return}},dedupeTime:1e3*60*60*24,refetchInterval:0})},eJ=(n,{web:a,mobile:o})=>{const{client:l}=n.createPromiseClient(iZ,{method:"generate"});return l.generate({web:a,mobile:o})},LS=(n,a)=>{const o=new URLSearchParams(n);for(const[l,c]of Object.entries(a))o.append(l,c);return o.toString()},tJ=(n,a,o,l)=>{const c=Ro({});return T6(c,()=>JX(n,[a,o]).subscribe(async({data:p,loading:f})=>{var L;const y=p===void 0&&f===!1?"https://streamlayer.io":p==null?void 0:p.url,b=l.get()||"",C=a.get()||"",_=o.get()||"",N={[O6]:b,[hE]:C,[gE]:_};if(!f&&y){c.setKey("loading",!0);let R=window.location.search,P=window.location.hash;R&&P||P?R=`?${LS(R,N)}`:P=`#${LS("",N)}`;const V=window.location.origin+window.location.pathname+R+P;try{const F=await eJ(n,{web:V,mobile:y});c.set({data:(L=F.data)==null?void 0:L.link,loading:!1})}catch{c.set({loading:!1,error:"Failed to generate short link",data:void 0})}}else c.setKey("loading",!0)})),{$store:c,fetch}};var sa;(function(n){n.Unset="unset",n.Required="required",n.Optional="optional",n.Completed="completed",n.Disabled="disabled",n.Unavailable="unavailable"})(sa||(sa={}));const nJ=(n,a,o,l)=>{const{inplayGame:c}=n.featureSettings.get(),p=a.getCurrentSessionId({prefix:"onboarding"});c&&o.add({type:bu.ONBOARDING,id:p,action:n.openFeature,close:()=>{n.onboardingProcessed.set(!0)},persistent:!0,autoHideDuration:1e6,data:{questionId:"onboarding",questionType:ye.UNSET,onboarding:{...c,instantOpen:!l.getOnboardingInstantOpen({userId:a.userId.get()||"",organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""})}}})},Uh=(n,a,o,l,c,p)=>{var f,y,b;try{const C=a.userId.get();if(!C)return;if(c.getOnboardingStatus({userId:C,organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""})===sa.Completed){n.set(sa.Completed);for(const P of p)P();return}const _=(f=a.moderation.getStore().value)==null?void 0:f.data,N=o.featureSettings.get().inplayGame;if(_===void 0||N===void 0)return;const L=(y=_==null?void 0:_.options)==null?void 0:y.onboardingEnabled,R=(b=N==null?void 0:N.titleCard)==null?void 0:b.optIn;L?R?n.set(sa.Required):n.set(sa.Optional):(R?n.set(sa.Unavailable):n.set(sa.Disabled),l.close(a.getCurrentSessionId({prefix:"onboarding"}),{markAsViewed:!1}))}catch(C){console.error(C)}},aJ=(n,a,o,l)=>{let c=!1;const p=new pE,f=Sa(sa.Unset);f.subscribe(b=>{b!==sa.Unset&&(b===sa.Optional||b===sa.Required?c===!1&&(nJ(n,a,l,p),c=!0):n.onboardingProcessed.set(!0),b===sa.Completed&&a.activeQuestionId.invalidate(),p.setOnboardingInstantOpen({userId:a.userId.get()||"",organizationId:a.organizationId.get()||"",eventId:a.slStreamId.get()||""}))});const y=[];return Uh(f,a,n,l,p,y),f.get()!==sa.Completed&&(y.push(a.userId.listen(b=>{b&&Uh(f,a,n,l,p,y)})),y.push(a.moderation.listen(b=>{b.data&&Uh(f,a,n,l,p,y)})),y.push(n.featureSettings.listen(b=>{b&&Uh(f,a,n,l,p,y)}))),{$store:f,submitInplay:async()=>{const b=a.slStreamId.get();if(b){await UX(o,b),f.set(sa.Completed),p.saveOnboardingStatus({organizationId:a.organizationId.get()||"",userId:a.userId.get()||"",eventId:b},sa.Completed),Va.emit("poll",{action:"onboardingPassed",payload:{}}),n.openFeature();const C=a.getCurrentSessionId({prefix:"onboarding"});l.close(C)}}}},rJ=(n,a,o,l)=>{const c=Ro(void 0),p=mE(l),f=async()=>{var R,P;const b=n.get(),C=a.get(),_=(R=o.getStore().get().data)==null?void 0:R.map(V=>V.slId);if(!_)return;const N={eventId:b,userId:C,usersIds:[..._,C]},L=await p(N);c.set((P=L.data)==null?void 0:P.attributes)},y=()=>{f()};return T6(c,()=>{const b=n.listen(f),C=o.listen(f),_=a.listen(f);return()=>{b(),C(),_()}}),{$store:c,invalidate:y}},oJ=async(n,a,o,l,c)=>{var _,N,L;const p=mE(c),f=n.get(),y=a.get(),b=((_=o.getStore().get().data)==null?void 0:_.map(R=>R.slId))||[],C={eventId:f,userId:l,usersIds:[...b,y]};return(L=(N=(await p(C)).data)==null?void 0:N.attributes)==null?void 0:L.summary},sJ=new Set([ye.POLL,ye.PREDICTION,ye.TRIVIA]);class iJ extends uE{constructor(o,l,c){super(o,l);D(this,"userSummary");D(this,"feedList");D(this,"friends");D(this,"leaderboardId");D(this,"leaderboardList");D(this,"deepLink");D(this,"onboardingStatus");D(this,"openedQuestion");D(this,"currentUserId");D(this,"openedUser");D(this,"closeFeature");D(this,"openFeature");D(this,"feedSubscription");D(this,"activeQuestionId");D(this,"openedQuestionId");D(this,"advertisement");D(this,"onboardingProcessed");D(this,"notifications");D(this,"transport");D(this,"background");D(this,"storage");D(this,"submitAnswerTimeout");D(this,"cancels",new Set);D(this,"onQuestionActivate");D(this,"checkInteractiveFlag",()=>{var y,b,C,_,N;const o=this.onboardingStatus.$store.get(),l=(C=(b=(y=this.background.moderation.getStore().value)==null?void 0:y.data)==null?void 0:b.options)==null?void 0:C.onboardingEnabled,c=(N=(_=this.settings.getValues().inplayGame)==null?void 0:_.titleCard)==null?void 0:N.optIn,p=o===sa.Completed,f=!l||p||c!==!0;this.background.interactiveAllowed.set(f?Jc.ALLOWED:Jc.DISALLOWED)});D(this,"connect",()=>{this.onboardingProcessed.subscribe(o=>{o&&this.advertisement.connect()}),this.cancels.add(this.background.feedSubscription.addListener("feed-subscription-prediction-close",async o=>{var C,_,N,L,R,P,V,F,j,q,Y;if(!this.isInteractiveAllowed)return;const l=(_=(C=o.data)==null?void 0:C.attributes)==null?void 0:_.question,c=(L=(N=o.data)==null?void 0:N.attributes)==null?void 0:L.feedItem;if(!l||!(c!=null&&c.attributes))return;const{status:p,type:f,id:y,answers:b}=l;if(p===yn.RESOLVED&&f===ye.PREDICTION){const J=this.background.getCurrentSessionId({prefix:`notification-id:${y}`}),ne=[...this.feedList.getValues().data||[]],ue=ne.findIndex(mt=>mt.id===y),oe=ne[ue];let Le=(V=(P=(R=oe==null?void 0:oe.attributes)==null?void 0:R.attributes)==null?void 0:P.value)==null?void 0:V.answerId;const Ee=N9(y,this.transport),et=Ee.subscribe(()=>{});await Ee.get().promise;let Be=Ee.get().data;Be||(Be=await wX(y,this.transport)),et(),window.requestAnimationFrame(()=>{Ee.invalidate()}),Le||(Le=(F=Be==null?void 0:Be.answers.find(({youVoted:mt})=>mt))==null?void 0:F.id);const qe=b.find(({correct:mt})=>mt),Ie=Le?b.find(({id:mt})=>mt===Le):void 0,Ze=!!(Ie!=null&&Ie.correct);if(oe&&((q=(j=ne[ue])==null?void 0:j.attributes)==null?void 0:q.attributes.case)==="question"){try{ne[ue].attributes.attributes.value.answerId=Le,ne[ue].attributes.attributes.value.openForVoting=!1,Le&&(ne[ue].attributes.attributes.value.status=Ze?el.WON:el.LOST)}catch{}this.feedList.getStore().mutate(ne)}if(!Ie||!qe)return;((Y=this.openedQuestionId.get())==null?void 0:Y.questionId)!==l.id&&this.notifications.add({type:bu.QUESTION_RESOLVED,action:()=>this.openQuestion(l.id,c),close:()=>this.closeQuestion(y),autoHideDuration:Ze?15e3:12e3,id:J,emitEvent:!1,data:{questionId:y,questionType:ye.PREDICTION,question:{title:Ze?`Congratulations! You answered correctly! You won ${qe.points} pts!`:`Better luck next time! Correct: ${qe==null?void 0:qe.text}!`,votedAnswer:{title:Ie==null?void 0:Ie.text,points:Ie==null?void 0:Ie.points},correctAnswerTitle:qe==null?void 0:qe.text,correct:!!Ze,predictionResult:p===yn.RESOLVED,questionTitle:l==null?void 0:l.subject}}}),this.userSummary.invalidate()}})),this.cancels.add(this.background.feedSubscription.addListener("feed-subscription-questions-list",o=>{var f,y,b,C,_;const l=[...((f=this.feedList.getStore().value)==null?void 0:f.data)||[]],c=(b=(y=o.data)==null?void 0:y.attributes)==null?void 0:b.feedItem,p=l.findIndex(N=>N.id===(c==null?void 0:c.id));if(c!=null&&c.attributes&&c.attributes.attributes.case!=="promotion"&&!(c.attributes.status!==yn.ACTIVE&&c.attributes.status!==yn.RESOLVED)){if(p!==-1)if(c.attributes.attributes.case==="question"&&((C=l[p].attributes)==null?void 0:C.attributes.case)==="question"){const N=l[p];N.attributes&&(l[p]={...l[p],attributes:{...N.attributes,attributes:{...N.attributes.attributes,value:{...N.attributes.attributes.value,...c.attributes.attributes.value,answerId:N.attributes.attributes.value.answerId,status:N.attributes.attributes.value.status,openForVoting:N.attributes.attributes.value.openForVoting}}}})}else{const N=l[p];N.attributes&&c.attributes&&(l[p]={...l[p],attributes:{...N.attributes,attributes:{...N.attributes.attributes,value:{...N.attributes.attributes.value,...c.attributes.attributes.value}}}})}p===-1&&(l.unshift(c),Va.emit("poll",{action:"received",payload:{questionId:c.id,questionType:(_=c.attributes)==null?void 0:_.type}})),this.feedList.getStore().mutate(l)}}))});D(this,"disconnect",()=>{this.background.feedSubscription.removeListener("feed-subscription-prediction-close"),this.background.feedSubscription.removeListener("feed-subscription-questions-list")});D(this,"submitAnswer",async(o,l)=>{const c=N9(o,this.transport),p=c.subscribe(()=>{}),f={...c.get().data||{}},y=()=>{var L;const b=this.feedList.getValues().data;if(!b)return;const C=b.findIndex(R=>R.id===o),_=b[C],N=((L=_==null?void 0:_.attributes)==null?void 0:L.attributes.case)==="question"&&_.attributes.attributes.value;if(N){Va.emit("poll",{action:"voted",payload:{questionId:o,questionType:N.questionType}});const R=c.get().data;if(p(),R){const P=R.answers.find(q=>q.correct===!0),V=R.answers.findIndex(q=>q.id===l),F=R.answers[V],j=R.answers.every(({percentageDecimal:q},Y)=>q===(f==null?void 0:f.answers[Y].percentageDecimal));b[C].attributes.attributes.value.answerId=l,b[C].attributes.attributes.value.openForVoting=!1,b[C].attributes.attributes.value.text=(F==null?void 0:F.text)||"",P&&(b[C].attributes.attributes.value.status=P.id===l?el.WON:el.LOST),this.feedList.getStore().mutate([...b]),R.answers[V].correct=(P==null?void 0:P.id)===l,R.answers[V].youVoted=!0,j&&R.answers.forEach(q=>{q.percentageDecimal=0}),(P==null?void 0:P.id)===l&&(R.answers[V].pointsEarned=R.status===yn.RESOLVED?0:P.points),c.mutate({...R})}this.submitAnswerTimeout&&clearTimeout(this.submitAnswerTimeout),this.submitAnswerTimeout=setTimeout(()=>{this.userSummary.invalidate()},1e3)}};try{await DX(this.transport,{questionId:o,answerId:l}),y()}catch(b){if(b.message===c2.ALREADY_VOTED){this.userSummary.invalidate();const C=c.subscribe(()=>{});c.invalidate(),C()}throw b}});D(this,"openQuestion",(o,l)=>{var p,f,y,b;if(!o)return()=>{};this.notifications.close(this.background.getCurrentSessionId({prefix:"notification",entity:o}),{animateHiding:!1});let c=(p=l==null?void 0:l.attributes)==null?void 0:p.type;return c||(c=(b=(y=(((f=this.feedList.getStore().value)==null?void 0:f.data)||[]).find(C=>C.id===o))==null?void 0:y.attributes)==null?void 0:b.type),Va.emit("poll",{action:"opened",payload:{questionId:o,questionType:c,questionOpenedFrom:l==null?void 0:l.openedFrom}}),this.background.openQuestion(o,l)});D(this,"getFeedItem",o=>bX(o,this.transport));D(this,"isOpenedQuestion",o=>!!this.notifications.isViewed(o));D(this,"closeQuestion",o=>(o&&this.onQuestionActivate({stage:"deactivate",id:o,isViewed:!!this.notifications.isViewed(this.background.getCurrentSessionId({prefix:"notification",entity:o}))}),this.background.closeQuestion(o)));D(this,"openUser",async o=>{var p,f;const l=(p=this.leaderboardList.$store.get().data)==null?void 0:p.find(y=>y.userId===o);if(!l){this.openedUser.set(l);return}if(l.summaryLoaded){this.openedUser.set(l);return}const c={...l};try{const y=await oJ(this.background.slStreamId,this.background.userId,this.friends,o,this.transport);(y==null?void 0:y.inTop)!==void 0&&(this.leaderboardList.$store.setKey("data",(f=this.leaderboardList.$store.get().data)==null?void 0:f.map(b=>(b.userId===o&&(b.inTop=y.inTop),b))),c.inTop=y.inTop)}catch(y){console.error(y)}this.openedUser.set(c)});D(this,"closeUser",()=>{this.openedUser.set(void 0)});D(this,"showInApp",o=>{var c,p,f,y,b,C,_,N,L,R,P,V,F,j;const l=this.onboardingStatus.$store.get();if(o&&o.data&&l&&l!==sa.Unset&&((c=o.data.question)==null?void 0:c.id)!==void 0&&o.data.question.notification!==void 0&&((f=(p=o.data.question)==null?void 0:p.bypassNotifications)==null?void 0:f.inAppSilence)!==Fw.ON&&o.data.question.status===yn.ACTIVE&&!o.data.question.marketClosed){if(sJ.has(o.data.question.type))this.isInteractiveAllowed&&this.notifications.add({type:bu.QUESTION,action:()=>{var q,Y,J;return this.openQuestion((Y=(q=o.data)==null?void 0:q.question)==null?void 0:Y.id,(J=o.data)==null?void 0:J.feedItem)},close:()=>{var q,Y;return this.closeQuestion((Y=(q=o.data)==null?void 0:q.question)==null?void 0:Y.id)},autoHideDuration:1e3*60,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),emitEvent:!0,data:{questionId:o.data.question.id,questionType:o.data.question.type,question:{title:o.data.question.notification.title}}});else if(o.data.question.type===ye.FACTOID){const q=(y=o.data.question.options)==null?void 0:y.options.value,Y={heading:o.data.question.notification.title,body:o.data.question.notification.body,imageMode:q==null?void 0:q.imageMode,image:q==null?void 0:q.image,video:{id:((b=q==null?void 0:q.video)==null?void 0:b.id)||"",url:((C=q==null?void 0:q.video)==null?void 0:C.url)||"",thumbnailUrl:((_=q==null?void 0:q.video)==null?void 0:_.thumbnailUrl)||""},webLink:{label:"",url:""}};this.notifications.add({type:bu.QUESTION,action:()=>{var J,ne,ue;return this.openQuestion((ne=(J=o==null?void 0:o.data)==null?void 0:J.question)==null?void 0:ne.id,(ue=o==null?void 0:o.data)==null?void 0:ue.feedItem)},close:()=>{var J,ne;return this.closeQuestion((ne=(J=o==null?void 0:o.data)==null?void 0:J.question)==null?void 0:ne.id)},autoHideDuration:1e3*120,emitEvent:!0,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),data:{questionId:o.data.question.id,questionType:o.data.question.type,insight:Y}})}else if(o.data.question.type===ye.TWEET){const q=(N=o.data.question.options)==null?void 0:N.options.value,Y={title:(L=o.data.question.notification)==null?void 0:L.title,body:(R=o.data.question.notification)==null?void 0:R.body,image:(P=o.data.question.notification)==null?void 0:P.image,account:((V=q==null?void 0:q.tweetMeta)==null?void 0:V.account)||"",accountVerified:!!((F=q==null?void 0:q.tweetMeta)!=null&&F.accountVerified),tweet:(j=q==null?void 0:q.tweetMeta)==null?void 0:j.tweet,tweetId:o.data.question.id};this.notifications.add({type:bu.QUESTION,action:()=>{var J,ne,ue;return this.openQuestion((ne=(J=o.data)==null?void 0:J.question)==null?void 0:ne.id,(ue=o.data)==null?void 0:ue.feedItem)},close:()=>{var J,ne;return this.closeQuestion((ne=(J=o.data)==null?void 0:J.question)==null?void 0:ne.id)},autoHideDuration:1e3*120,emitEvent:!0,id:this.background.getCurrentSessionId({prefix:"notification",entity:o.data.question.id}),data:{questionId:o.data.question.id,questionType:o.data.question.type,tweet:Y}})}}});this.background=new OX(c),this.advertisement=this.background.advertisement,this.onQuestionActivate=c.onQuestionActivate,this.feedSubscription=this.background.feedSubscription,this.activeQuestionId=this.background.activeQuestionId,this.openedQuestionId=this.background.openedQuestionId,this.storage=new pE,this.feedList=this.background.feedList,this.friends=new ei(yX(this.background.userId,c.transport),"gamification:friends"),this.currentUserId=this.background.userId,this.openedUser=Sa(void 0),this.onboardingProcessed=Sa(!c.sdk.withAuth),this.leaderboardId=new Lo(Sa(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=aJ(this,this.background,c.transport,c.notifications),this.notifications=c.notifications,this.transport=c.transport,this.closeFeature=(p=!0)=>c.sdk.closeFeature(p),this.openFeature=()=>c.sdk.openFeature(yt.GAMES),this.openedQuestion=this.background.openedQuestion,this.deepLink=tJ(this.transport,this.background.slStreamId,c.stores.providerStreamId.getStore(),this.background.userId),this.userSummary=rJ(this.background.slStreamId,this.background.userId,this.friends,this.transport),this.leaderboardList=jX(this.transport,this.background.slStreamId,this.background.userId,this.friends),this.connect(),this.cancels.add(this.userSummary.$store.listen((p,f)=>{f!=null&&f.summary&&(p!=null&&p.summary)&&this.leaderboardList.invalidate()})),this.cancels.add(this.onboardingStatus.$store.listen(this.checkInteractiveFlag)),this.cancels.add(this.background.moderation.getStore().listen(this.checkInteractiveFlag)),this.cancels.add(this.settings.subscribe(this.checkInteractiveFlag)),this.cancels.add(this.onboardingStatus.$store.listen((p,f)=>{(f===void 0||p!==sa.Unset)&&this.background.activeQuestionId.invalidate()})),this.background.activeQuestionId.listen(this.showInApp),c.sdk.onMount({name:"gamification",clear:!0},()=>()=>{for(const p of this.cancels)p(),this.cancels.delete(p)})}get isInteractiveAllowed(){return this.background.interactiveAllowed.get()===Jc.ALLOWED}}const lJ={[yt.GAMES]:!0};class uJ extends uE{constructor(a,o){super(a,o)}}const cJ=(n,a,o)=>n.type===yt.GAMES?new iJ(n,a,o):new uJ(n,a),dJ=(n,a,o)=>{n.features=new Map,n.sdk.featuresList=new Lo(Sa(new Set),"features-list"),n.activeFeature=new Lo(Sa(yt.UNSET),"activeFeature"),n.sdk.getFeatures=()=>n.features,n.sdk.getFeature=l=>n.features.get(l),n.sdk.getActiveFeature=()=>n.activeFeature.getStore(),n.sdk.openFeature=l=>{n.activeFeature.setValue(l)},n.sdk.closeFeature=(l=!1)=>{const c=n.activeFeature.getValue();if(n.activeFeature.setValue(yt.UNSET),l&&c){n.features.delete(c);const p=n.sdk.featuresList.getValue();p&&p.delete(c),n.sdk.featuresList.setValue(p)}},n.initFeature=(l,c=Yi.ORGANIZATION)=>{if(l.type in lJ&&!n.features.has(l.type)){const p=cJ(l,c,n);n.features.set(l.type,p);let f=n.sdk.featuresList.getValue();f?f.add(l.type):f=new Set([l.type]),n.sdk.featuresList.setValue(new Set(f))}},n.updateFeature=(l,c)=>{var p;(p=n.features.get(l.type))==null||p.update(l,c)},n.destroyFeature=l=>{n.features.delete(l.type);const c=n.sdk.featuresList.getValue();c&&c.delete(l.type),n.sdk.featuresList.setValue(new Set(c))},n.reinitializeFeatures=async()=>{const l=await n.stores.organizationSettings.getValue();n.features.clear(),n.sdk.featuresList.setValue(new Set);for(const c of(l==null?void 0:l.overlays)||[])n.initFeature(c,Yi.ORGANIZATION)},n.stores.providerStreamId.listen(l=>{l||n.reinitializeFeatures()}),n.storeSubscribe=()=>{const l=(p,f)=>{var y;if(f!=null&&f.overlays&&!((y=n.contextConfig)!=null&&y.skipOrganizationSettings&&p===Yi.ORGANIZATION))for(const b of f.overlays)b.sdkEnable===!0&&(n.features.has(b.type)?n.updateFeature(b,p):n.initFeature(b,p))},c={organizationSettings:p=>{if(p.data)try{l(Yi.ORGANIZATION,p.data)}catch(f){console.log(f)}},streamSettings:p=>{if(p.data)try{l(Yi.STREAM,p.data)}catch(f){console.log(f)}}};n.store.subscribe(c)},o()};class mJ{constructor(a){D(this,"analytics");D(this,"accepted",()=>{this.analytics.write("invitation",{common:{...this.analytics.commonStore.getValues(),kind:ka.INVITATION_ACCEPTED},category:m9.GAMES,from:l2.UNSET})});D(this,"sent",({from:a})=>{this.analytics.write("invitation",{common:{...this.analytics.commonStore.getValues(),kind:ka.INVITATION_SENT},category:m9.GAMES,from:a||l2.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="invitation")switch(l.slEventBus.action){case"sent":this.sent(l.slEventBus.payload);break}};return Va.listen(o)})}}class fJ{constructor(a){D(this,"analytics");D(this,"tap",()=>{this.analytics.write("interactions",{common:{...this.analytics.commonStore.getValues(),kind:ka.INTERACTIONS},actionType:w9.TAP})});D(this,"scroll",()=>{this.analytics.write("interactions",{common:{...this.analytics.commonStore.getValues(),kind:ka.INTERACTIONS},actionType:w9.SCROLL})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="interactions")switch(l.slEventBus.action){case"tap":this.tap();break;case"scroll":this.scroll();break}};return Va.listen(o)})}}const pJ={[Eo.UNSET]:Qs.UNSET,[Eo.INGAME_IAB21]:Qs.PROMOTION_INGAME_IAB21,[Eo.INGAME_IAB11_LBAR]:Qs.PROMOTION_INGAME_IAB11_LBAR,[Eo.INGAME_IAB11]:Qs.PROMOTION_INGAME_IAB11,[Eo.INGAME_IAB21_LBAR]:Qs.PROMOTION_INGAME_IAB21_LBAR,[Eo.INGAME_IAB61]:Qs.PROMOTION_INGAME_IAB61,[Eo.EXTERNAL_AD]:Qs.PROMOTION_GAM};class hJ{constructor(a){D(this,"analytics");D(this,"received",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_RECEIVED,topicId:a,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"opened",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_OPENED,topicId:a,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"videoPlay",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_VIDEO_PLAYED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"buttonSelect",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_BUTTON_NAVIGATED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});D(this,"bannerSelect",({id:a},{topicSubType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),topicId:a,kind:ka.AD_BANNER_NAVIGATED,topicType:ia.POLLS_PROMOTION,topicSubType:o},pollOpenedFrom:Io.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c,p;if(!((c=l.slEventBus)!=null&&c.skipAnalytics)&&((p=l.slEventBus)==null?void 0:p.type)==="advertisement"){const f=l.slEventBus.payload.type?pJ[l.slEventBus.payload.type]:Qs.UNSET;switch(l.slEventBus.action){case"videoPlay":this.videoPlay(l.slEventBus.payload,{topicSubType:f});break;case"buttonSelect":this.buttonSelect(l.slEventBus.payload,{topicSubType:f});break;case"bannerSelect":this.bannerSelect(l.slEventBus.payload,{topicSubType:f});break;case"received":this.received(l.slEventBus.payload,{topicSubType:f});break;case"opened":this.opened(l.slEventBus.payload,{topicSubType:f});break}}};return Va.listen(o)})}}const r2={[ye.UNSET]:ia.UNSET,[ye.FACTOID]:ia.POLLS_INSIGHT,[ye.POLL]:ia.POLLS_POLL,[ye.PREDICTION]:ia.POLLS_PREDICTION,[ye.PROMOTION]:ia.POLLS_PROMOTION,[ye.TRIVIA]:ia.POLLS_TRIVIA,[ye.TWEET]:ia.POLLS_TWITTER};ye.UNSET+"",Ys.UNSET,ye.FACTOID+"",Ys.POLLS,ye.POLL+"",Ys.POLLS,ye.PREDICTION+"",Ys.POLLS,ye.PROMOTION+"",Ys.POLLS,ye.TRIVIA+"",Ys.POLLS,ye.TWEET+"",Ys.POLLS;const gJ={[yt.UNSET]:Ua.UNSET,[yt.INPLAY]:Ua.INPLAY,[yt.MESSAGING]:Ua.MESSAGING,[yt.STATISTICS]:Ua.STATS,[yt.BETTING]:Ua.BETTING,[yt.TWITTER]:Ua.TWITTER,[yt.MERCHANDISE]:Ua.MERCHANDISE,[yt.CONTESTS]:Ua.CONTESTS,[yt.VOICE_CHAT]:Ua.CALLING,[yt.TICKETS]:Ua.TICKETS,[yt.WHOIS_WATCHING]:Ua.WHOISWATCHING,[yt.PROFILE]:Ua.PROFILE,[yt.GAMES]:Ua.POLLS,[yt.GOLF_STATISTICS]:Ua.STATS,[yt.HIGHLIGHTS]:Ua.HIGHLIGHTS,[yt.PUBLIC_CHAT]:Ua.PUBLIC_CHAT};class yJ{constructor(a){D(this,"analytics");D(this,"received",({questionId:a,questionType:o})=>{this.analytics.write("notification",{common:{...this.analytics.commonStore.getValues(),kind:ka.NOTIFICATION_RECEIVED,topicId:a,topicType:o?r2[o]:ia.UNSET},notificationKind:Ys.POLLS,notificationType:C9.IN_APP})});D(this,"opened",({questionId:a,questionType:o})=>{this.analytics.write("notification",{common:{...this.analytics.commonStore.getValues(),kind:ka.NOTIFICATION_OPENED,topicId:a,topicType:o?r2[o]:ia.UNSET},notificationKind:Ys.POLLS,notificationType:C9.IN_APP})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="notification")switch(l.slEventBus.action){case"rendered":this.received(l.slEventBus.payload);break;case"opened":this.opened(l.slEventBus.payload);break}};return Va.listen(o)})}}class vJ{constructor(a){D(this,"analytics");D(this,"received",({questionId:a,questionType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_RECEIVED,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:Io.UNSET})});D(this,"opened",({questionId:a,questionType:o,questionOpenedFrom:l})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_OPENED,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:l==="list"?Io.PICK_HISTORY:Io.IN_APP})});D(this,"voted",({questionId:a,questionType:o})=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_VOTE,topicId:a,topicType:o?r2[o]:ia.UNSET},pollOpenedFrom:Io.UNSET})});D(this,"onboardingPassed",()=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.GAMES_JOINED},pollOpenedFrom:Io.UNSET})});D(this,"navigated",()=>{this.analytics.write("games",{common:{...this.analytics.commonStore.getValues(),kind:ka.POLLS_NAVIGATED},pollOpenedFrom:Io.UNSET})});this.analytics=a,this.analytics.onConnect(()=>{const o=l=>{var c;if(((c=l.slEventBus)==null?void 0:c.type)==="poll")switch(l.slEventBus.action){case"voted":this.voted(l.slEventBus.payload);break;case"navigated":this.navigated();break;case"onboardingPassed":this.onboardingPassed();break;case"received":this.received(l.slEventBus.payload);break;case"opened":this.opened(l.slEventBus.payload);break}};return Va.listen(o)})}}const TJ=({transport:n,$commonStore:a})=>{let o;const l=Sa(!1),c=5e3,{client:p,queryKey:f}=n.createPromiseClient(rE,{method:"send",params:[l]}),y=n.nanoquery.createFetcherStore(f,{fetcher:async()=>{const N=a.getStore().get();try{await p.unary({message:{case:"heartbeat",value:{common:{...N,kind:ka.SESSION_HEARTBEAT}}}})}catch(L){Zi.error(L,"send heartbeat failed")}return Date.now()},refetchInterval:c}),b=()=>{Zi.debug("mounted heartbeat"),o=y.subscribe(()=>{})},C=()=>{Zi.debug("enabled heartbeat"),l.set(!0),y.lc===0&&b()},_=()=>{Zi.debug("disabled heartbeat"),l.set(!1)};return{enable:C,disable:_,mount:b,unmount:()=>{Zi.debug("unmounted heartbeat"),y.off(),o==null||o(),o=void 0,_()}}},Zi=il("analytics");class bJ{constructor(a){D(this,"commonStore");D(this,"notifications");D(this,"polls");D(this,"invitation");D(this,"interactions");D(this,"advertisement");D(this,"heartbeat");D(this,"analyticsClient");D(this,"listeners");D(this,"listenersCancels");D(this,"connected",!1);D(this,"connect",()=>{this.writeCommon("sessionId",k9()),this.heartbeat.enable(),this.listeners.forEach(a=>this.listenersCancels.add(a())),this.connected=!0,Zi.debug("analytics connected")});D(this,"disconnect",()=>{this.writeCommon("sessionId",""),this.writeCommon("overlaySessionId",""),this.heartbeat.unmount(),this.listenersCancels.forEach(a=>a()),this.connected=!1,Zi.debug("analytics disconnected")});D(this,"write",(a,o)=>{o&&this.analyticsClient.unary({message:{case:a,value:o}}).then(()=>{Zi.trace("send analytics success",a,o)}).catch(l=>{Zi.error(l,"send analytics failed")})});D(this,"writeCommon",(a,o)=>{this.commonStore.setValue(a,o)});D(this,"onConnect",a=>{this.listeners.add(a),this.connected&&this.listenersCancels.add(a())});D(this,"connectToSDK",a=>{this.onConnect(()=>a.stores.slStreamId.getAtomStore().subscribe(o=>{this.writeCommon("eventId",o)})),this.onConnect(()=>a.sdk.getActiveFeature().subscribe(o=>{o&&this.writeCommon("category",gJ[o]),o!==yt.UNSET?this.writeCommon("overlaySessionId",k9()):this.writeCommon("overlaySessionId","")})),this.onConnect(()=>{const o=window.matchMedia("(orientation: portrait)"),l=c=>{this.writeCommon("screenOrientation",c.matches?c9.PORTRAIT:c9.LANDSCAPE)};return o.addEventListener("change",l),()=>{o.removeEventListener("change",l)}}),this.onConnect(()=>a.deepLink.$store.subscribe(o=>{o!=null&&o.handled&&this.invitation.accepted()}))});this.listeners=new Set,this.listenersCancels=new Set,this.commonStore=new Xc(Ro({}),"common-analytics"),this.connectToSDK(a),this.heartbeat=TJ({transport:a.analyticsTransport,$commonStore:this.commonStore}),this.notifications=new yJ(this),this.polls=new vJ(this),this.invitation=new mJ(this),this.interactions=new fJ(this),this.advertisement=new hJ(this);const{client:o}=a.analyticsTransport.createPromiseClient(rE,{method:"send"});this.analyticsClient=o}}const kJ=(n,a,o)=>{n.analytics=new bJ(n),n.sdk.onMount({name:"analytics"},()=>(n.analytics.connect(),()=>{n.analytics.disconnect()})),o()};var vy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof g9<"u"?g9:typeof self<"u"?self:{};function SJ(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ty={exports:{}},by={exports:{}};function wJ(n){var a=new n,o=a;function l(){var p=a;return p.next?a=p.next:(a=new n,o=a),p.next=null,p}function c(p){o.next=p,o=p}return{get:l,release:c}}var CJ=wJ,EJ=CJ;function yE(n,a,o){if(typeof n=="function"&&(o=a,a=n,n=null),!(o>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var l=EJ(_J),c=null,p=null,f=0,y=null,b={push:V,drain:_o,saturated:_o,pause:_,paused:!1,get concurrency(){return o},set concurrency(ne){if(!(ne>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(o=ne,!b.paused)for(;c&&f<o;)f++,j()},running:C,resume:R,idle:P,length:N,getQueue:L,unshift:F,empty:_o,kill:q,killAndDrain:Y,error:J};return b;function C(){return f}function _(){b.paused=!0}function N(){for(var ne=c,ue=0;ne;)ne=ne.next,ue++;return ue}function L(){for(var ne=c,ue=[];ne;)ue.push(ne.value),ne=ne.next;return ue}function R(){if(b.paused){if(b.paused=!1,c===null){f++,j();return}for(;c&&f<o;)f++,j()}}function P(){return f===0&&b.length()===0}function V(ne,ue){var oe=l.get();oe.context=n,oe.release=j,oe.value=ne,oe.callback=ue||_o,oe.errorHandler=y,f>=o||b.paused?p?(p.next=oe,p=oe):(c=oe,p=oe,b.saturated()):(f++,a.call(n,oe.value,oe.worked))}function F(ne,ue){var oe=l.get();oe.context=n,oe.release=j,oe.value=ne,oe.callback=ue||_o,oe.errorHandler=y,f>=o||b.paused?c?(oe.next=c,c=oe):(c=oe,p=oe,b.saturated()):(f++,a.call(n,oe.value,oe.worked))}function j(ne){ne&&l.release(ne);var ue=c;ue&&f<=o?b.paused?f--:(p===c&&(p=null),c=ue.next,ue.next=null,a.call(n,ue.value,ue.worked),p===null&&b.empty()):--f===0&&b.drain()}function q(){c=null,p=null,b.drain=_o}function Y(){c=null,p=null,b.drain(),b.drain=_o}function J(ne){y=ne}}function _o(){}function _J(){this.value=null,this.callback=_o,this.next=null,this.release=_o,this.context=null,this.errorHandler=null;var n=this;this.worked=function(a,o){var l=n.callback,c=n.errorHandler,p=n.value;n.value=null,n.callback=_o,n.errorHandler&&c(a,p),l.call(n.context,a,o),n.release(n)}}function IJ(n,a,o){typeof n=="function"&&(o=a,a=n,n=null);function l(_,N){a.call(this,_).then(function(L){N(null,L)},N)}var c=yE(n,l,o),p=c.push,f=c.unshift;return c.push=y,c.unshift=b,c.drained=C,c;function y(_){var N=new Promise(function(L,R){p(_,function(P,V){if(P){R(P);return}L(V)})});return N.catch(_o),N}function b(_){var N=new Promise(function(L,R){f(_,function(P,V){if(P){R(P);return}L(V)})});return N.catch(_o),N}function C(){if(c.idle())return new Promise(function(L){L()});var _=c.drain,N=new Promise(function(L){c.drain=function(){_(),L()}});return N}}by.exports=yE;by.exports.promise=IJ;var vE=by.exports,ky={exports:{}},hm=typeof Reflect=="object"?Reflect:null,OS=hm&&typeof hm.apply=="function"?hm.apply:function(n,a,o){return Function.prototype.apply.call(n,a,o)},Qh;hm&&typeof hm.ownKeys=="function"?Qh=hm.ownKeys:Object.getOwnPropertySymbols?Qh=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Qh=function(n){return Object.getOwnPropertyNames(n)};function NJ(n){console&&console.warn&&console.warn(n)}var TE=Number.isNaN||function(n){return n!==n};function Qt(){Qt.init.call(this)}ky.exports=Qt;ky.exports.once=AJ;Qt.EventEmitter=Qt;Qt.prototype._events=void 0;Qt.prototype._eventsCount=0;Qt.prototype._maxListeners=void 0;var AS=10;function A6(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(Qt,"defaultMaxListeners",{enumerable:!0,get:function(){return AS},set:function(n){if(typeof n!="number"||n<0||TE(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");AS=n}});Qt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Qt.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||TE(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function bE(n){return n._maxListeners===void 0?Qt.defaultMaxListeners:n._maxListeners}Qt.prototype.getMaxListeners=function(){return bE(this)};Qt.prototype.emit=function(n){for(var a=[],o=1;o<arguments.length;o++)a.push(arguments[o]);var l=n==="error",c=this._events;if(c!==void 0)l=l&&c.error===void 0;else if(!l)return!1;if(l){var p;if(a.length>0&&(p=a[0]),p instanceof Error)throw p;var f=new Error("Unhandled error."+(p?" ("+p.message+")":""));throw f.context=p,f}var y=c[n];if(y===void 0)return!1;if(typeof y=="function")OS(y,this,a);else for(var b=y.length,C=EE(y,b),o=0;o<b;++o)OS(C[o],this,a);return!0};function kE(n,a,o,l){var c,p,f;if(A6(o),p=n._events,p===void 0?(p=n._events=Object.create(null),n._eventsCount=0):(p.newListener!==void 0&&(n.emit("newListener",a,o.listener?o.listener:o),p=n._events),f=p[a]),f===void 0)f=p[a]=o,++n._eventsCount;else if(typeof f=="function"?f=p[a]=l?[o,f]:[f,o]:l?f.unshift(o):f.push(o),c=bE(n),c>0&&f.length>c&&!f.warned){f.warned=!0;var y=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");y.name="MaxListenersExceededWarning",y.emitter=n,y.type=a,y.count=f.length,NJ(y)}return n}Qt.prototype.addListener=function(n,a){return kE(this,n,a,!1)};Qt.prototype.on=Qt.prototype.addListener;Qt.prototype.prependListener=function(n,a){return kE(this,n,a,!0)};function RJ(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function SE(n,a,o){var l={fired:!1,wrapFn:void 0,target:n,type:a,listener:o},c=RJ.bind(l);return c.listener=o,l.wrapFn=c,c}Qt.prototype.once=function(n,a){return A6(a),this.on(n,SE(this,n,a)),this};Qt.prototype.prependOnceListener=function(n,a){return A6(a),this.prependListener(n,SE(this,n,a)),this};Qt.prototype.removeListener=function(n,a){var o,l,c,p,f;if(A6(a),l=this._events,l===void 0)return this;if(o=l[n],o===void 0)return this;if(o===a||o.listener===a)--this._eventsCount===0?this._events=Object.create(null):(delete l[n],l.removeListener&&this.emit("removeListener",n,o.listener||a));else if(typeof o!="function"){for(c=-1,p=o.length-1;p>=0;p--)if(o[p]===a||o[p].listener===a){f=o[p].listener,c=p;break}if(c<0)return this;c===0?o.shift():LJ(o,c),o.length===1&&(l[n]=o[0]),l.removeListener!==void 0&&this.emit("removeListener",n,f||a)}return this};Qt.prototype.off=Qt.prototype.removeListener;Qt.prototype.removeAllListeners=function(n){var a,o,l;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[n]),this;if(arguments.length===0){var c=Object.keys(o),p;for(l=0;l<c.length;++l)p=c[l],p!=="removeListener"&&this.removeAllListeners(p);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(a=o[n],typeof a=="function")this.removeListener(n,a);else if(a!==void 0)for(l=a.length-1;l>=0;l--)this.removeListener(n,a[l]);return this};function wE(n,a,o){var l=n._events;if(l===void 0)return[];var c=l[a];return c===void 0?[]:typeof c=="function"?o?[c.listener||c]:[c]:o?OJ(c):EE(c,c.length)}Qt.prototype.listeners=function(n){return wE(this,n,!0)};Qt.prototype.rawListeners=function(n){return wE(this,n,!1)};Qt.listenerCount=function(n,a){return typeof n.listenerCount=="function"?n.listenerCount(a):CE.call(n,a)};Qt.prototype.listenerCount=CE;function CE(n){var a=this._events;if(a!==void 0){var o=a[n];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}Qt.prototype.eventNames=function(){return this._eventsCount>0?Qh(this._events):[]};function EE(n,a){for(var o=new Array(a),l=0;l<a;++l)o[l]=n[l];return o}function LJ(n,a){for(;a+1<n.length;a++)n[a]=n[a+1];n.pop()}function OJ(n){for(var a=new Array(n.length),o=0;o<a.length;++o)a[o]=n[o].listener||n[o];return a}function AJ(n,a){return new Promise(function(o,l){function c(f){n.removeListener(a,p),l(f)}function p(){typeof n.removeListener=="function"&&n.removeListener("error",c),o([].slice.call(arguments))}_E(n,a,p,{once:!0}),a!=="error"&&xJ(n,c,{once:!0})})}function xJ(n,a,o){typeof n.on=="function"&&_E(n,"error",a,o)}function _E(n,a,o,l){if(typeof n.on=="function")l.once?n.once(a,o):n.on(a,o);else if(typeof n.addEventListener=="function")n.addEventListener(a,function c(p){l.once&&n.removeEventListener(a,c),o(p)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var IE=ky.exports,x6={},NE={},RE=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},a=Symbol("test"),o=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var l=42;n[a]=l;for(a in n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var c=Object.getOwnPropertySymbols(n);if(c.length!==1||c[0]!==a||!Object.prototype.propertyIsEnumerable.call(n,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(n,a);if(p.value!==l||p.enumerable!==!0)return!1}return!0},PJ=RE,P6=function(){return PJ()&&!!Symbol.toStringTag},MJ=Error,DJ=EvalError,UJ=RangeError,FJ=ReferenceError,LE=SyntaxError,M6=TypeError,VJ=URIError,xS=typeof Symbol<"u"&&Symbol,jJ=RE,BJ=function(){return typeof xS!="function"||typeof Symbol!="function"||typeof xS("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:jJ()},V5={__proto__:null,foo:{}},$J=Object,zJ=function(){return{__proto__:V5}.foo===V5.foo&&!(V5 instanceof $J)},HJ="Function.prototype.bind called on incompatible ",GJ=Object.prototype.toString,qJ=Math.max,WJ="[object Function]",PS=function(n,a){for(var o=[],l=0;l<n.length;l+=1)o[l]=n[l];for(var c=0;c<a.length;c+=1)o[c+n.length]=a[c];return o},QJ=function(n,a){for(var o=[],l=a,c=0;l<n.length;l+=1,c+=1)o[c]=n[l];return o},YJ=function(n,a){for(var o="",l=0;l<n.length;l+=1)o+=n[l],l+1<n.length&&(o+=a);return o},KJ=function(n){var a=this;if(typeof a!="function"||GJ.apply(a)!==WJ)throw new TypeError(HJ+a);for(var o=QJ(arguments,1),l,c=function(){if(this instanceof l){var C=a.apply(this,PS(o,arguments));return Object(C)===C?C:this}return a.apply(n,PS(o,arguments))},p=qJ(0,a.length-o.length),f=[],y=0;y<p;y++)f[y]="$"+y;if(l=Function("binder","return function ("+YJ(f,",")+"){ return binder.apply(this,arguments); }")(c),a.prototype){var b=function(){};b.prototype=a.prototype,l.prototype=new b,b.prototype=null}return l},ZJ=KJ,Sy=Function.prototype.bind||ZJ,XJ=Function.prototype.call,JJ=Object.prototype.hasOwnProperty,eee=Sy,tee=eee.call(XJ,JJ),Ot,nee=MJ,aee=DJ,ree=UJ,oee=FJ,bm=LE,gm=M6,see=VJ,OE=Function,j5=function(n){try{return OE('"use strict"; return ('+n+").constructor;")()}catch{}},ed=Object.getOwnPropertyDescriptor;if(ed)try{ed({},"")}catch{ed=null}var B5=function(){throw new gm},iee=ed?function(){try{return arguments.callee,B5}catch{try{return ed(arguments,"callee").get}catch{return B5}}}():B5,am=BJ(),lee=zJ(),Ta=Object.getPrototypeOf||(lee?function(n){return n.__proto__}:null),om={},uee=typeof Uint8Array>"u"||!Ta?Ot:Ta(Uint8Array),td={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ot:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ot:ArrayBuffer,"%ArrayIteratorPrototype%":am&&Ta?Ta([][Symbol.iterator]()):Ot,"%AsyncFromSyncIteratorPrototype%":Ot,"%AsyncFunction%":om,"%AsyncGenerator%":om,"%AsyncGeneratorFunction%":om,"%AsyncIteratorPrototype%":om,"%Atomics%":typeof Atomics>"u"?Ot:Atomics,"%BigInt%":typeof BigInt>"u"?Ot:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ot:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ot:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ot:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":nee,"%eval%":eval,"%EvalError%":aee,"%Float32Array%":typeof Float32Array>"u"?Ot:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ot:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ot:FinalizationRegistry,"%Function%":OE,"%GeneratorFunction%":om,"%Int8Array%":typeof Int8Array>"u"?Ot:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ot:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ot:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":am&&Ta?Ta(Ta([][Symbol.iterator]())):Ot,"%JSON%":typeof JSON=="object"?JSON:Ot,"%Map%":typeof Map>"u"?Ot:Map,"%MapIteratorPrototype%":typeof Map>"u"||!am||!Ta?Ot:Ta(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ot:Promise,"%Proxy%":typeof Proxy>"u"?Ot:Proxy,"%RangeError%":ree,"%ReferenceError%":oee,"%Reflect%":typeof Reflect>"u"?Ot:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ot:Set,"%SetIteratorPrototype%":typeof Set>"u"||!am||!Ta?Ot:Ta(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ot:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":am&&Ta?Ta(""[Symbol.iterator]()):Ot,"%Symbol%":am?Symbol:Ot,"%SyntaxError%":bm,"%ThrowTypeError%":iee,"%TypedArray%":uee,"%TypeError%":gm,"%Uint8Array%":typeof Uint8Array>"u"?Ot:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ot:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ot:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ot:Uint32Array,"%URIError%":see,"%WeakMap%":typeof WeakMap>"u"?Ot:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ot:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ot:WeakSet};if(Ta)try{null.error}catch(n){var cee=Ta(Ta(n));td["%Error.prototype%"]=cee}var dee=function n(a){var o;if(a==="%AsyncFunction%")o=j5("async function () {}");else if(a==="%GeneratorFunction%")o=j5("function* () {}");else if(a==="%AsyncGeneratorFunction%")o=j5("async function* () {}");else if(a==="%AsyncGenerator%"){var l=n("%AsyncGeneratorFunction%");l&&(o=l.prototype)}else if(a==="%AsyncIteratorPrototype%"){var c=n("%AsyncGenerator%");c&&Ta&&(o=Ta(c.prototype))}return td[a]=o,o},MS={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},p2=Sy,m6=tee,mee=p2.call(Function.call,Array.prototype.concat),fee=p2.call(Function.apply,Array.prototype.splice),DS=p2.call(Function.call,String.prototype.replace),f6=p2.call(Function.call,String.prototype.slice),pee=p2.call(Function.call,RegExp.prototype.exec),hee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,gee=/\\(\\)?/g,yee=function(n){var a=f6(n,0,1),o=f6(n,-1);if(a==="%"&&o!=="%")throw new bm("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&a!=="%")throw new bm("invalid intrinsic syntax, expected opening `%`");var l=[];return DS(n,hee,function(c,p,f,y){l[l.length]=f?DS(y,gee,"$1"):p||c}),l},vee=function(n,a){var o=n,l;if(m6(MS,o)&&(l=MS[o],o="%"+l[0]+"%"),m6(td,o)){var c=td[o];if(c===om&&(c=dee(o)),typeof c>"u"&&!a)throw new gm("intrinsic "+n+" exists, but is not available. Please file an issue!");return{alias:l,name:o,value:c}}throw new bm("intrinsic "+n+" does not exist!")},h2=function(n,a){if(typeof n!="string"||n.length===0)throw new gm("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof a!="boolean")throw new gm('"allowMissing" argument must be a boolean');if(pee(/^%?[^%]*%?$/,n)===null)throw new bm("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=yee(n),l=o.length>0?o[0]:"",c=vee("%"+l+"%",a),p=c.name,f=c.value,y=!1,b=c.alias;b&&(l=b[0],fee(o,mee([0,1],b)));for(var C=1,_=!0;C<o.length;C+=1){var N=o[C],L=f6(N,0,1),R=f6(N,-1);if((L==='"'||L==="'"||L==="`"||R==='"'||R==="'"||R==="`")&&L!==R)throw new bm("property names with quotes must have matching quotes");if((N==="constructor"||!_)&&(y=!0),l+="."+N,p="%"+l+"%",m6(td,p))f=td[p];else if(f!=null){if(!(N in f)){if(!a)throw new gm("base intrinsic for "+n+" exists, but the property is not available.");return}if(ed&&C+1>=o.length){var P=ed(f,N);_=!!P,_&&"get"in P&&!("originalValue"in P.get)?f=P.get:f=f[N]}else _=m6(f,N),f=f[N];_&&!y&&(td[p]=f)}}return f},AE={exports:{}},$5,US;function wy(){if(US)return $5;US=1;var n=h2,a=n("%Object.defineProperty%",!0)||!1;if(a)try{a({},"a",{value:1})}catch{a=!1}return $5=a,$5}var Tee=h2,Yh=Tee("%Object.getOwnPropertyDescriptor%",!0);if(Yh)try{Yh([],"length")}catch{Yh=null}var D6=Yh,FS=wy(),bee=LE,rm=M6,VS=D6,kee=function(n,a,o){if(!n||typeof n!="object"&&typeof n!="function")throw new rm("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new rm("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new rm("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new rm("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new rm("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new rm("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,y=!!VS&&VS(n,a);if(FS)FS(n,a,{configurable:p===null&&y?y.configurable:!p,enumerable:l===null&&y?y.enumerable:!l,value:o,writable:c===null&&y?y.writable:!c});else if(f||!l&&!c&&!p)n[a]=o;else throw new bee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},R9=wy(),xE=function(){return!!R9};xE.hasArrayLengthDefineBug=function(){if(!R9)return null;try{return R9([],"length",{value:1}).length!==1}catch{return!0}};var See=xE,wee=h2,jS=kee,Cee=See(),BS=D6,$S=M6,Eee=wee("%Math.floor%"),_ee=function(n,a){if(typeof n!="function")throw new $S("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||Eee(a)!==a)throw new $S("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],l=!0,c=!0;if("length"in n&&BS){var p=BS(n,"length");p&&!p.configurable&&(l=!1),p&&!p.writable&&(c=!1)}return(l||c||!o)&&(Cee?jS(n,"length",a,!0,!0):jS(n,"length",a)),n};(function(n){var a=Sy,o=h2,l=_ee,c=M6,p=o("%Function.prototype.apply%"),f=o("%Function.prototype.call%"),y=o("%Reflect.apply%",!0)||a.call(f,p),b=wy(),C=o("%Math.max%");n.exports=function(N){if(typeof N!="function")throw new c("a function is required");var L=y(a,f,arguments);return l(L,1+C(0,N.length-(arguments.length-1)),!0)};var _=function(){return y(a,p,arguments)};b?b(n.exports,"apply",{value:_}):n.exports.apply=_})(AE);var Cy=AE.exports,PE=h2,ME=Cy,Iee=ME(PE("String.prototype.indexOf")),Ey=function(n,a){var o=PE(n,!!a);return typeof o=="function"&&Iee(n,".prototype.")>-1?ME(o):o},Nee=P6(),Ree=Ey,L9=Ree("Object.prototype.toString"),U6=function(n){return Nee&&n&&typeof n=="object"&&Symbol.toStringTag in n?!1:L9(n)==="[object Arguments]"},DE=function(n){return U6(n)?!0:n!==null&&typeof n=="object"&&typeof n.length=="number"&&n.length>=0&&L9(n)!=="[object Array]"&&L9(n.callee)==="[object Function]"},Lee=function(){return U6(arguments)}();U6.isLegacyArguments=DE;var Oee=Lee?U6:DE,Aee=Object.prototype.toString,xee=Function.prototype.toString,Pee=/^\s*(?:function)?\*/,UE=P6(),z5=Object.getPrototypeOf,Mee=function(){if(!UE)return!1;try{return Function("return function*() {}")()}catch{}},H5,Dee=function(n){if(typeof n!="function")return!1;if(Pee.test(xee.call(n)))return!0;if(!UE){var a=Aee.call(n);return a==="[object GeneratorFunction]"}if(!z5)return!1;if(typeof H5>"u"){var o=Mee();H5=o?z5(o):!1}return z5(n)===H5},FE=Function.prototype.toString,um=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,O9,Kh;if(typeof um=="function"&&typeof Object.defineProperty=="function")try{O9=Object.defineProperty({},"length",{get:function(){throw Kh}}),Kh={},um(function(){throw 42},null,O9)}catch(n){n!==Kh&&(um=null)}else um=null;var Uee=/^\s*class\b/,A9=function(n){try{var a=FE.call(n);return Uee.test(a)}catch{return!1}},G5=function(n){try{return A9(n)?!1:(FE.call(n),!0)}catch{return!1}},Zh=Object.prototype.toString,Fee="[object Object]",Vee="[object Function]",jee="[object GeneratorFunction]",Bee="[object HTMLAllCollection]",$ee="[object HTML document.all class]",zee="[object HTMLCollection]",Hee=typeof Symbol=="function"&&!!Symbol.toStringTag,Gee=!(0 in[,]),x9=function(){return!1};if(typeof document=="object"){var qee=document.all;Zh.call(qee)===Zh.call(document.all)&&(x9=function(n){if((Gee||!n)&&(typeof n>"u"||typeof n=="object"))try{var a=Zh.call(n);return(a===Bee||a===$ee||a===zee||a===Fee)&&n("")==null}catch{}return!1})}var Wee=um?function(n){if(x9(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;try{um(n,null,O9)}catch(a){if(a!==Kh)return!1}return!A9(n)&&G5(n)}:function(n){if(x9(n))return!0;if(!n||typeof n!="function"&&typeof n!="object")return!1;if(Hee)return G5(n);if(A9(n))return!1;var a=Zh.call(n);return a!==Vee&&a!==jee&&!/^\[object HTML/.test(a)?!1:G5(n)},Qee=Wee,Yee=Object.prototype.toString,VE=Object.prototype.hasOwnProperty,Kee=function(n,a,o){for(var l=0,c=n.length;l<c;l++)VE.call(n,l)&&(o==null?a(n[l],l,n):a.call(o,n[l],l,n))},Zee=function(n,a,o){for(var l=0,c=n.length;l<c;l++)o==null?a(n.charAt(l),l,n):a.call(o,n.charAt(l),l,n)},Xee=function(n,a,o){for(var l in n)VE.call(n,l)&&(o==null?a(n[l],l,n):a.call(o,n[l],l,n))},Jee=function(n,a,o){if(!Qee(a))throw new TypeError("iterator must be a function");var l;arguments.length>=3&&(l=o),Yee.call(n)==="[object Array]"?Kee(n,a,l):typeof n=="string"?Zee(n,a,l):Xee(n,a,l)},jE=Jee,ete=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],q5=ete,tte=typeof globalThis>"u"?vy:globalThis,BE=function(){for(var n=[],a=0;a<q5.length;a++)typeof tte[q5[a]]=="function"&&(n[n.length]=q5[a]);return n},p6=jE,nte=BE,zS=Cy,_y=Ey,Xh=D6,ate=_y("Object.prototype.toString"),$E=P6(),HS=typeof globalThis>"u"?vy:globalThis,P9=nte(),Iy=_y("String.prototype.slice"),W5=Object.getPrototypeOf,rte=_y("Array.prototype.indexOf",!0)||function(n,a){for(var o=0;o<n.length;o+=1)if(n[o]===a)return o;return-1},h6={__proto__:null};$E&&Xh&&W5?p6(P9,function(n){var a=new HS[n];if(Symbol.toStringTag in a){var o=W5(a),l=Xh(o,Symbol.toStringTag);if(!l){var c=W5(o);l=Xh(c,Symbol.toStringTag)}h6["$"+n]=zS(l.get)}}):p6(P9,function(n){var a=new HS[n],o=a.slice||a.set;o&&(h6["$"+n]=zS(o))});var ote=function(n){var a=!1;return p6(h6,function(o,l){if(!a)try{"$"+o(n)===l&&(a=Iy(l,1))}catch{}}),a},ste=function(n){var a=!1;return p6(h6,function(o,l){if(!a)try{o(n),a=Iy(l,1)}catch{}}),a},ite=function(n){if(!n||typeof n!="object")return!1;if(!$E){var a=Iy(ate(n),8,-1);return rte(P9,a)>-1?a:a!=="Object"?!1:ste(n)}return Xh?ote(n):null},g6=jE,lte=BE,GS=Cy,Ny=Ey,Jh=D6,ute=Ny("Object.prototype.toString"),zE=P6(),qS=typeof globalThis>"u"?vy:globalThis,M9=lte(),Ry=Ny("String.prototype.slice"),Q5=Object.getPrototypeOf,cte=Ny("Array.prototype.indexOf",!0)||function(n,a){for(var o=0;o<n.length;o+=1)if(n[o]===a)return o;return-1},y6={__proto__:null};zE&&Jh&&Q5?g6(M9,function(n){var a=new qS[n];if(Symbol.toStringTag in a){var o=Q5(a),l=Jh(o,Symbol.toStringTag);if(!l){var c=Q5(o);l=Jh(c,Symbol.toStringTag)}y6["$"+n]=GS(l.get)}}):g6(M9,function(n){var a=new qS[n],o=a.slice||a.set;o&&(y6["$"+n]=GS(o))});var dte=function(n){var a=!1;return g6(y6,function(o,l){if(!a)try{"$"+o(n)===l&&(a=Ry(l,1))}catch{}}),a},mte=function(n){var a=!1;return g6(y6,function(o,l){if(!a)try{o(n),a=Ry(l,1)}catch{}}),a},fte=function(n){if(!n||typeof n!="object")return!1;if(!zE){var a=Ry(ute(n),8,-1);return cte(M9,a)>-1?a:a!=="Object"?!1:mte(n)}return Jh?dte(n):null},pte=fte,hte=function(n){return!!pte(n)};(function(n){var a=Oee,o=Dee,l=ite,c=hte;function p(de){return de.call.bind(de)}var f=typeof BigInt<"u",y=typeof Symbol<"u",b=p(Object.prototype.toString),C=p(Number.prototype.valueOf),_=p(String.prototype.valueOf),N=p(Boolean.prototype.valueOf);if(f)var L=p(BigInt.prototype.valueOf);if(y)var R=p(Symbol.prototype.valueOf);function P(de,Ao){if(typeof de!="object")return!1;try{return Ao(de),!0}catch{return!1}}n.isArgumentsObject=a,n.isGeneratorFunction=o,n.isTypedArray=c;function V(de){return typeof Promise<"u"&&de instanceof Promise||de!==null&&typeof de=="object"&&typeof de.then=="function"&&typeof de.catch=="function"}n.isPromise=V;function F(de){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(de):c(de)||se(de)}n.isArrayBufferView=F;function j(de){return l(de)==="Uint8Array"}n.isUint8Array=j;function q(de){return l(de)==="Uint8ClampedArray"}n.isUint8ClampedArray=q;function Y(de){return l(de)==="Uint16Array"}n.isUint16Array=Y;function J(de){return l(de)==="Uint32Array"}n.isUint32Array=J;function ne(de){return l(de)==="Int8Array"}n.isInt8Array=ne;function ue(de){return l(de)==="Int16Array"}n.isInt16Array=ue;function oe(de){return l(de)==="Int32Array"}n.isInt32Array=oe;function Le(de){return l(de)==="Float32Array"}n.isFloat32Array=Le;function Ee(de){return l(de)==="Float64Array"}n.isFloat64Array=Ee;function et(de){return l(de)==="BigInt64Array"}n.isBigInt64Array=et;function Be(de){return l(de)==="BigUint64Array"}n.isBigUint64Array=Be;function qe(de){return b(de)==="[object Map]"}qe.working=typeof Map<"u"&&qe(new Map);function Ie(de){return typeof Map>"u"?!1:qe.working?qe(de):de instanceof Map}n.isMap=Ie;function Ze(de){return b(de)==="[object Set]"}Ze.working=typeof Set<"u"&&Ze(new Set);function mt(de){return typeof Set>"u"?!1:Ze.working?Ze(de):de instanceof Set}n.isSet=mt;function Rt(de){return b(de)==="[object WeakMap]"}Rt.working=typeof WeakMap<"u"&&Rt(new WeakMap);function Wn(de){return typeof WeakMap>"u"?!1:Rt.working?Rt(de):de instanceof WeakMap}n.isWeakMap=Wn;function be(de){return b(de)==="[object WeakSet]"}be.working=typeof WeakSet<"u"&&be(new WeakSet);function Pe(de){return be(de)}n.isWeakSet=Pe;function Se(de){return b(de)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function ct(de){return typeof ArrayBuffer>"u"?!1:Se.working?Se(de):de instanceof ArrayBuffer}n.isArrayBuffer=ct;function z(de){return b(de)==="[object DataView]"}z.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&z(new DataView(new ArrayBuffer(1),0,1));function se(de){return typeof DataView>"u"?!1:z.working?z(de):de instanceof DataView}n.isDataView=se;var me=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function We(de){return b(de)==="[object SharedArrayBuffer]"}function gt(de){return typeof me>"u"?!1:(typeof We.working>"u"&&(We.working=We(new me)),We.working?We(de):de instanceof me)}n.isSharedArrayBuffer=gt;function it(de){return b(de)==="[object AsyncFunction]"}n.isAsyncFunction=it;function tt(de){return b(de)==="[object Map Iterator]"}n.isMapIterator=tt;function lt(de){return b(de)==="[object Set Iterator]"}n.isSetIterator=lt;function _t(de){return b(de)==="[object Generator]"}n.isGeneratorObject=_t;function Yt(de){return b(de)==="[object WebAssembly.Module]"}n.isWebAssemblyCompiledModule=Yt;function In(de){return P(de,C)}n.isNumberObject=In;function Gt(de){return P(de,_)}n.isStringObject=Gt;function nn(de){return P(de,N)}n.isBooleanObject=nn;function Nt(de){return f&&P(de,L)}n.isBigIntObject=Nt;function sn(de){return y&&P(de,R)}n.isSymbolObject=sn;function Nn(de){return In(de)||Gt(de)||nn(de)||Nt(de)||sn(de)}n.isBoxedPrimitive=Nn;function Gr(de){return typeof Uint8Array<"u"&&(ct(de)||gt(de))}n.isAnyArrayBuffer=Gr,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(de){Object.defineProperty(n,de,{enumerable:!1,value:function(){throw new Error(de+" is not supported in userland")}})})})(NE);var gte=function(n){return n&&typeof n=="object"&&typeof n.copy=="function"&&typeof n.fill=="function"&&typeof n.readUInt8=="function"},D9={exports:{}};typeof Object.create=="function"?D9.exports=function(n,a){a&&(n.super_=a,n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:D9.exports=function(n,a){if(a){n.super_=a;var o=function(){};o.prototype=a.prototype,n.prototype=new o,n.prototype.constructor=n}};var yte=D9.exports;(function(n){var a=Object.getOwnPropertyDescriptors||function(z){for(var se=Object.keys(z),me={},We=0;We<se.length;We++)me[se[We]]=Object.getOwnPropertyDescriptor(z,se[We]);return me},o=/%[sdj%]/g;n.format=function(z){if(!ne(z)){for(var se=[],me=0;me<arguments.length;me++)se.push(f(arguments[me]));return se.join(" ")}for(var me=1,We=arguments,gt=We.length,it=String(z).replace(o,function(_t){if(_t==="%%")return"%";if(me>=gt)return _t;switch(_t){case"%s":return String(We[me++]);case"%d":return Number(We[me++]);case"%j":try{return JSON.stringify(We[me++])}catch{return"[Circular]"}default:return _t}}),tt=We[me];me<gt;tt=We[++me])q(tt)||!Ee(tt)?it+=" "+tt:it+=" "+f(tt);return it},n.deprecate=function(z,se){if(typeof St<"u"&&St.noDeprecation===!0)return z;if(typeof St>"u")return function(){return n.deprecate(z,se).apply(this,arguments)};var me=!1;function We(){if(!me){if(St.throwDeprecation)throw new Error(se);St.traceDeprecation?console.trace(se):console.error(se),me=!0}return z.apply(this,arguments)}return We};var l={},c=/^$/;if(St.env.NODE_DEBUG){var p=St.env.NODE_DEBUG;p=p.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+p+"$","i")}n.debuglog=function(z){if(z=z.toUpperCase(),!l[z])if(c.test(z)){var se=St.pid;l[z]=function(){var me=n.format.apply(n,arguments);console.error("%s %d: %s",z,se,me)}}else l[z]=function(){};return l[z]};function f(z,se){var me={seen:[],stylize:b};return arguments.length>=3&&(me.depth=arguments[2]),arguments.length>=4&&(me.colors=arguments[3]),j(se)?me.showHidden=se:se&&n._extend(me,se),oe(me.showHidden)&&(me.showHidden=!1),oe(me.depth)&&(me.depth=2),oe(me.colors)&&(me.colors=!1),oe(me.customInspect)&&(me.customInspect=!0),me.colors&&(me.stylize=y),_(me,z,me.depth)}n.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function y(z,se){var me=f.styles[se];return me?"\x1B["+f.colors[me][0]+"m"+z+"\x1B["+f.colors[me][1]+"m":z}function b(z,se){return z}function C(z){var se={};return z.forEach(function(me,We){se[me]=!0}),se}function _(z,se,me){if(z.customInspect&&se&&qe(se.inspect)&&se.inspect!==n.inspect&&!(se.constructor&&se.constructor.prototype===se)){var We=se.inspect(me,z);return ne(We)||(We=_(z,We,me)),We}var gt=N(z,se);if(gt)return gt;var it=Object.keys(se),tt=C(it);if(z.showHidden&&(it=Object.getOwnPropertyNames(se)),Be(se)&&(it.indexOf("message")>=0||it.indexOf("description")>=0))return L(se);if(it.length===0){if(qe(se)){var lt=se.name?": "+se.name:"";return z.stylize("[Function"+lt+"]","special")}if(Le(se))return z.stylize(RegExp.prototype.toString.call(se),"regexp");if(et(se))return z.stylize(Date.prototype.toString.call(se),"date");if(Be(se))return L(se)}var _t="",Yt=!1,In=["{","}"];if(F(se)&&(Yt=!0,In=["[","]"]),qe(se)){var Gt=se.name?": "+se.name:"";_t=" [Function"+Gt+"]"}if(Le(se)&&(_t=" "+RegExp.prototype.toString.call(se)),et(se)&&(_t=" "+Date.prototype.toUTCString.call(se)),Be(se)&&(_t=" "+L(se)),it.length===0&&(!Yt||se.length==0))return In[0]+_t+In[1];if(me<0)return Le(se)?z.stylize(RegExp.prototype.toString.call(se),"regexp"):z.stylize("[Object]","special");z.seen.push(se);var nn;return Yt?nn=R(z,se,me,tt,it):nn=it.map(function(Nt){return P(z,se,me,tt,Nt,Yt)}),z.seen.pop(),V(nn,_t,In)}function N(z,se){if(oe(se))return z.stylize("undefined","undefined");if(ne(se)){var me="'"+JSON.stringify(se).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return z.stylize(me,"string")}if(J(se))return z.stylize(""+se,"number");if(j(se))return z.stylize(""+se,"boolean");if(q(se))return z.stylize("null","null")}function L(z){return"["+Error.prototype.toString.call(z)+"]"}function R(z,se,me,We,gt){for(var it=[],tt=0,lt=se.length;tt<lt;++tt)be(se,String(tt))?it.push(P(z,se,me,We,String(tt),!0)):it.push("");return gt.forEach(function(_t){_t.match(/^\d+$/)||it.push(P(z,se,me,We,_t,!0))}),it}function P(z,se,me,We,gt,it){var tt,lt,_t;if(_t=Object.getOwnPropertyDescriptor(se,gt)||{value:se[gt]},_t.get?_t.set?lt=z.stylize("[Getter/Setter]","special"):lt=z.stylize("[Getter]","special"):_t.set&&(lt=z.stylize("[Setter]","special")),be(We,gt)||(tt="["+gt+"]"),lt||(z.seen.indexOf(_t.value)<0?(q(me)?lt=_(z,_t.value,null):lt=_(z,_t.value,me-1),lt.indexOf(`
|
|
199
199
|
`)>-1&&(it?lt=lt.split(`
|
|
200
200
|
`).map(function(Yt){return" "+Yt}).join(`
|
|
201
201
|
`).slice(2):lt=`
|
|
@@ -208,4 +208,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
208
208
|
`),y=`
|
|
209
209
|
`+o+(p.length?c("│"):" ")+" ";return o+f.join(y)+`
|
|
210
210
|
`+p.map(function(b,C){var _=C===p.length-1,N=b.nodes&&b.nodes.length,L=o+(_?" ":c("│"))+" ";return o+c(_?"└":"├")+c("─")+c(N?"┬":"─")+" "+n(b,L,l).slice(o.length+2)}).join("")};const bte=Tte,WS=Symbol("avvio.TimeTree.untrackNode"),K5=Symbol("avvio.TimeTree.trackNode"),QS=Symbol("avvio.TimeTree.getParent"),YS=Symbol("avvio.TimeTree.getNode"),KS=Symbol("avvio.TimeTree.addNode");let kte=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[K5](n){this.tableId.set(n.id,n),this.tableLabel.has(n.label)?this.tableLabel.get(n.label).push(n):this.tableLabel.set(n.label,[n])}[WS](n){this.tableId.delete(n.id);const a=this.tableLabel.get(n.label);if(a.id){this.tableLabel.delete(n.label);return}a.pop(),a.length===0&&this.tableLabel.delete(n.label)}[QS](n){if(n===null)return this.root;const a=this.tableLabel.get(n);return a.id?a:a[a.length-1]}[YS](n){return this.tableId.get(n)}[KS](n,a,o){if(n===null)return this.root={id:"root",label:a,start:o,nodes:[]},this[K5](this.root),this.root.id;const l=this[QS](n),c=`${a}-${Math.random()}`,p={id:c,parent:n,start:o,label:a,nodes:[]};return l.nodes.push(p),this[K5](p),c}start(n,a,o=Date.now()){return this[KS](n,a,o)}stop(n,a=Date.now()){const o=this[YS](n);o&&(o.stop=a,o.diff=o.stop-o.start||0,this[WS](o))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const n=o=>(o.label=`${o.label} ${o.diff} ms`,o.nodes.length>0&&(o.nodes=o.nodes.map(l=>n(l))),o),a=n(this.toJSON());return bte(a)}};var Ste=kte,Ly={exports:{}},U9={exports:{}},Z5,ZS;function wte(){if(ZS)return Z5;ZS=1;var n=1e3,a=n*60,o=a*60,l=o*24,c=l*7,p=l*365.25;Z5=function(_,N){N=N||{};var L=typeof _;if(L==="string"&&_.length>0)return f(_);if(L==="number"&&isFinite(_))return N.long?b(_):y(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function f(_){if(_=String(_),!(_.length>100)){var N=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(N){var L=parseFloat(N[1]),R=(N[2]||"ms").toLowerCase();switch(R){case"years":case"year":case"yrs":case"yr":case"y":return L*p;case"weeks":case"week":case"w":return L*c;case"days":case"day":case"d":return L*l;case"hours":case"hour":case"hrs":case"hr":case"h":return L*o;case"minutes":case"minute":case"mins":case"min":case"m":return L*a;case"seconds":case"second":case"secs":case"sec":case"s":return L*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return L;default:return}}}}function y(_){var N=Math.abs(_);return N>=l?Math.round(_/l)+"d":N>=o?Math.round(_/o)+"h":N>=a?Math.round(_/a)+"m":N>=n?Math.round(_/n)+"s":_+"ms"}function b(_){var N=Math.abs(_);return N>=l?C(_,N,l,"day"):N>=o?C(_,N,o,"hour"):N>=a?C(_,N,a,"minute"):N>=n?C(_,N,n,"second"):_+" ms"}function C(_,N,L,R){var P=N>=L*1.5;return Math.round(_/L)+" "+R+(P?"s":"")}return Z5}function Cte(n){o.debug=o,o.default=o,o.coerce=b,o.disable=p,o.enable=c,o.enabled=f,o.humanize=wte(),o.destroy=C,Object.keys(n).forEach(_=>{o[_]=n[_]}),o.names=[],o.skips=[],o.formatters={};function a(_){let N=0;for(let L=0;L<_.length;L++)N=(N<<5)-N+_.charCodeAt(L),N|=0;return o.colors[Math.abs(N)%o.colors.length]}o.selectColor=a;function o(_){let N,L=null,R,P;function V(...F){if(!V.enabled)return;const j=V,q=Number(new Date),Y=q-(N||q);j.diff=Y,j.prev=N,j.curr=q,N=q,F[0]=o.coerce(F[0]),typeof F[0]!="string"&&F.unshift("%O");let J=0;F[0]=F[0].replace(/%([a-zA-Z%])/g,(ne,ue)=>{if(ne==="%%")return"%";J++;const oe=o.formatters[ue];if(typeof oe=="function"){const Le=F[J];ne=oe.call(j,Le),F.splice(J,1),J--}return ne}),o.formatArgs.call(j,F),(j.log||o.log).apply(j,F)}return V.namespace=_,V.useColors=o.useColors(),V.color=o.selectColor(_),V.extend=l,V.destroy=o.destroy,Object.defineProperty(V,"enabled",{enumerable:!0,configurable:!1,get:()=>L!==null?L:(R!==o.namespaces&&(R=o.namespaces,P=o.enabled(_)),P),set:F=>{L=F}}),typeof o.init=="function"&&o.init(V),V}function l(_,N){const L=o(this.namespace+(typeof N>"u"?":":N)+_);return L.log=this.log,L}function c(_){o.save(_),o.namespaces=_,o.names=[],o.skips=[];let N;const L=(typeof _=="string"?_:"").split(/[\s,]+/),R=L.length;for(N=0;N<R;N++)L[N]&&(_=L[N].replace(/\*/g,".*?"),_[0]==="-"?o.skips.push(new RegExp("^"+_.slice(1)+"$")):o.names.push(new RegExp("^"+_+"$")))}function p(){const _=[...o.names.map(y),...o.skips.map(y).map(N=>"-"+N)].join(",");return o.enable(""),_}function f(_){if(_[_.length-1]==="*")return!0;let N,L;for(N=0,L=o.skips.length;N<L;N++)if(o.skips[N].test(_))return!1;for(N=0,L=o.names.length;N<L;N++)if(o.names[N].test(_))return!0;return!1}function y(_){return _.toString().substring(2,_.toString().length-2).replace(/\.\*\?$/,"*")}function b(_){return _ instanceof Error?_.stack||_.message:_}function C(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return o.enable(o.load()),o}var Ete=Cte;(function(n,a){a.formatArgs=l,a.save=c,a.load=p,a.useColors=o,a.storage=f(),a.destroy=(()=>{let b=!1;return()=>{b||(b=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function o(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(b){if(b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const C="color: "+this.color;b.splice(1,0,C,"color: inherit");let _=0,N=0;b[0].replace(/%[a-zA-Z%]/g,L=>{L!=="%%"&&(_++,L==="%c"&&(N=_))}),b.splice(N,0,C)}a.log=console.debug||console.log||(()=>{});function c(b){try{b?a.storage.setItem("debug",b):a.storage.removeItem("debug")}catch{}}function p(){let b;try{b=a.storage.getItem("debug")}catch{}return!b&&typeof St<"u"&&"env"in St&&(b=St.env.DEBUG),b}function f(){try{return localStorage}catch{}}n.exports=Ete(a);const{formatters:y}=n.exports;y.j=function(b){try{return JSON.stringify(b)}catch(C){return"[UnexpectedJSONParseError]: "+C.message}}})(U9,U9.exports);var GE=U9.exports;const _te=vE,Ite=IE.EventEmitter,Nte=x6.inherits,Fa=GE("avvio"),{AVV_ERR_READY_TIMEOUT:Rte}=HE,X5=Symbol.for("plugin-meta");function Lte(n,a){return n[X5]&&n[X5].name?n[X5].name:typeof a<"u"&&typeof a!="function"&&a.name?a.name:n.name?n.name:n.toString().split(`
|
|
211
|
-
`).slice(0,2).map(o=>o.trim()).join(" -- ")}function Ote(){const n={};return n.promise=new Promise((a,o)=>{n.resolve=a,n.reject=o}),n}function Im(n,a,o,l,c){this.started=!1,this.func=a,this.opts=o,this.onFinish=null,this.parent=n,this.timeout=c===void 0?n._timeout:c,this.name=Lte(a,o),this.isAfter=l,this.q=_te(n,Ate,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Nte(Im,Ite);Im.prototype.exec=function(n,a){const o=this.func;let l=!1;const c=this.name;if(this.parent._error&&!this.isAfter){Fa("skipping loading of plugin as parent errored and it is not an after",c),St.nextTick(a);return}if(this.isAfter)this.server=n;else try{this.server=this.parent.override(n,o,this.opts)}catch(b){return Fa("override errored",c),a(b)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,Fa("exec",c);let p;const f=b=>{if(l){Fa("loading complete",c);return}this._error=b,Fa(b?"exec errored":"exec completed",c),l=!0,p&&clearTimeout(p),a(b)};this.timeout>0&&(Fa("setting up timeout",c,this.timeout),p=setTimeout(function(){Fa("timed out",c),p=null;const b=new Rte(c);b.fn=o,f(b)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const y=o(this.server,this.opts,f);y&&typeof y.then=="function"&&(Fa("exec: resolving promise",c),y.then(()=>St.nextTick(f),b=>St.nextTick(f,b)))};Im.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const n=()=>{this.server.after((o,l)=>{this._error=o,this.q.pause(),o?(Fa("rejecting promise",this.name,o),this._promise.reject(o)):(Fa("resolving promise",this.name),this._promise.resolve()),this._promise=null,St.nextTick(l,o)}),this.q.resume()};let a;return this._promise?a=Promise.resolve():(this._promise=Ote(),a=this._promise.promise,this.server?n():this.on("start",n)),a};Im.prototype.enqueue=function(n,a){Fa("enqueue",this.name,n.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(n,a)};Im.prototype.finish=function(n,a){Fa("finish",this.name,n);const o=()=>{this.loaded||(Fa("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,a(n))};if(n){this._promise&&(this._promise.reject(n),this._promise=null),o();return}const l=()=>{if(Fa("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const c=()=>{Fa("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(c,c),this._promise=null}else o();else Fa("delayed",this.name),this.q.drain=()=>{Fa("drain",this.name),this.q.drain=xte,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function Ate(n,a){const o=this;St.nextTick(Oy.bind(o),n,a)}function Oy(n,a){if(typeof n.func.then=="function"){n.func.then(l=>{typeof l.default=="function"&&(l=l.default),n.func=l,Oy.call(this,n,a)},a);return}const o=this._current[0];this._current.unshift(n),n.exec(o&&o.server||this._server,l=>{n.finish(l,c=>{this._current.shift(),a(c)})})}function xte(){}Ly.exports=Im;Ly.exports.loadPlugin=Oy;var Pte=Ly.exports;const XS=vE,Mte=IE.EventEmitter,Dte=x6.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:J5,AVV_ERR_CALLBACK_NOT_FN:o2,AVV_ERR_PLUGIN_NOT_VALID:Ute,AVV_ERR_ROOT_PLG_BOOTED:Fte,AVV_ERR_READY_TIMEOUT:Vte}=HE,jte=Ste,F9=Pte,km=GE("avvio"),v6=Symbol("kAvvio"),e9=Symbol("kThenifyDoNotWrap");function Bte(n,a,o){const l=a.expose||{},c=l.use||"use",p=l.after||"after",f=l.ready||"ready",y=l.onClose||"onClose",b=l.close||"close";if(n[c])throw new J5(c);if(n[p])throw new J5(p);if(n[f])throw new J5(f);n[c]=function(C,_){return o.use(C,_),this},Object.defineProperty(n,"then",{get:qE.bind(o)}),n[v6]=!0,n[p]=function(C){return typeof C!="function"?o._loadRegistered():(o.after(t9(C,this)),this)},n[f]=function(C){if(C&&typeof C!="function")throw new o2(f,typeof C);return o.ready(C?t9(C,this):void 0)},n[y]=function(C){if(typeof C!="function")throw new o2(y,typeof C);return o.onClose(qte(C,this)),this},n[b]=function(C){if(C&&typeof C!="function")throw new o2(b,typeof C);return C?(o.close(t9(C,this)),this):o.close()}}function wa(n,a,o){if(typeof n=="function"&&arguments.length===1&&(o=n,a={},n=null),typeof a=="function"&&(o=a,a={}),a=a||{},!(this instanceof wa)){const l=new wa(n,a,o);return n&&Bte(n,a,l),l}a.autostart!==!1&&(a.autostart=!0),n=n||this,this._timeout=Number(a.timeout)||0,this._server=n,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),o&&this.once("start",o),this.started=!1,this.booted=!1,this.pluginTree=new jte,this._readyQ=XS(this,WE,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=JS},this._closeQ=XS(this,Gte,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=JS},this._doStart=null,this._root=new F9(this,$te.bind(this),a,!1,0),this._root.once("start",(l,c,p)=>{const f=this.pluginTree.start(null,c,p);this._root.once("loaded",(y,b,C)=>{this.pluginTree.stop(f,C)})}),F9.loadPlugin.call(this,this._root,l=>{km("root plugin ready");try{this.emit("preReady"),this._root=null}catch(c){l=l||this._error||c}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function $te(n,a,o){this._doStart=o,a.autostart&&this.start()}Dte(wa,Mte);wa.prototype.start=function(){return this.started=!0,St.nextTick(this._doStart),this};wa.prototype.override=function(n,a,o){return n};function zte(n){if(n&&typeof n=="object"&&typeof n.default=="function"&&(n=n.default),!(n&&(typeof n=="function"||typeof n.then=="function")))throw new Ute(typeof n);return n}wa.prototype[v6]=!0;wa.prototype.use=function(n,a){return this._lastUsed=this._addPlugin(n,a,!1),this};wa.prototype._loadRegistered=function(){const n=this._current[0];return!this.started&&!this.booted&&St.nextTick(()=>this._root.q.resume()),n?n.loadedSoFar():Promise.resolve()};Object.defineProperty(wa.prototype,"then",{get:qE});wa.prototype._addPlugin=function(n,a,o){if(n=zte(n),a=a||{},this.booted)throw new Fte;const l=this._current[0],c=new F9(this,n,a,o);if(c.once("start",(p,f,y)=>{const b=this.pluginTree.start(l.name,f,y);c.once("loaded",(C,_,N)=>{this.pluginTree.stop(b,N)})}),l.loaded)throw new Error(c.name,l.name);return l.enqueue(c,p=>{p&&(this._error=p)}),c};wa.prototype.after=function(n){if(!n)return this._loadRegistered();this._addPlugin(a.bind(this),{},!0);function a(o,l,c){WE.call(this,n,c)}return this};wa.prototype.onClose=function(n){if(typeof n!="function")throw new Error("not a function");n[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(n,a.bind(this));function a(o){o&&(this._error=o)}return this};wa.prototype.close=function(n){let a;if(n){if(typeof n!="function")throw new o2("close",typeof n)}else a=new Promise(function(o,l){n=function(c){if(c)return l(c);o()}});return this.ready(()=>{this._error=null,this._closeQ.push(n),St.nextTick(this._closeQ.resume.bind(this._closeQ))}),a};wa.prototype.ready=function(n){if(n){if(typeof n!="function")throw new o2("ready",typeof n);this._readyQ.push(n),queueMicrotask(this.start.bind(this));return}return new Promise((a,o)=>{this._readyQ.push(c),this.start();const l=this._current[0].server;function c(p,f,y){p?o(p):a(l),St.nextTick(y)}})};wa.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};wa.prototype.toJSON=function(){return this.pluginTree.toJSON()};function JS(){}function qE(){if(this.booted){km("thenify returning null because we are already booted");return}if(this[e9]){this[e9]=!1;return}return km("thenify"),(n,a)=>this._loadRegistered().then(()=>(this[e9]=!0,n(this._server)),a)}function WE(n,a){const o=this._server,l=this._error;let c;if(this._error=null,n.length===0)this._error=l,c=n(),c&&!c[v6]&&typeof c.then=="function"?c.then(()=>St.nextTick(a),p=>St.nextTick(a,p)):St.nextTick(a);else if(n.length===1)c=n(l),c&&!c[v6]&&typeof c.then=="function"?c.then(()=>St.nextTick(a),p=>St.nextTick(a,p)):St.nextTick(a);else if(this._timeout===0){const p=f=>{this._error=f,a(this._error)};n.length===2?n(l,p):n(l,o,p)}else Hte.call(this,n,l,o,a)}function Hte(n,a,o,l){const c=n.name;km("setting up ready timeout",c,this._timeout);let p=setTimeout(()=>{km("timed out",c),p=null;const y=new Vte(c);y.fn=n,this._error=y,l(y)},this._timeout);n.length===2?n(a,f.bind(this)):n(a,o,f.bind(this));function f(y){p&&(clearTimeout(p),this._error=y,l(this._error))}}function Gte(n,a){const o=this._server,l=n[this._isOnCloseHandlerKey];if(n.length===0||n.length===1){let c;l?c=n(o):c=n(this._error),c&&typeof c.then=="function"?(km("resolving close/onClose promise"),c.then(()=>St.nextTick(a),p=>St.nextTick(a,p))):St.nextTick(a)}else n.length===2?n(l?o:this._error,a):l?n(o,a):n(this._error,o,a)}function qte(n,a){return o.bind(a);function o(l,c){let p;n.length===0?(p=n(),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n.length===1?(p=n(this),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n(this,c)}}function t9(n,a){return o.bind(a);function o(l,c){let p;n?n.length===0?(p=n(),p&&p.then?p.then(function(){St.nextTick(c,l)},c):St.nextTick(c,l)):n.length===1?(p=n(l),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n.length===2?n(l,c):n(l,this,c):St.nextTick(c)}}Ty.exports=wa;Ty.exports.express=function(n){return wa(n,{expose:{use:"load"}})};var Wte=Ty.exports;const Qte=SJ(Wte);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const n=["webkit","moz","ms","o"];for(const a of n)window.requestAnimationFrame=window.requestAnimationFrame||window[`${a}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${a}CancelAnimationFrame`]||window[`${a}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let a=0;const o=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const c=o?window.performance.now():new Date().getTime(),p=Math.max(0,16-(c-a)),f=window.setTimeout(function(){l(c+p)},p);return a=c+p,f},window.cancelAnimationFrame=clearTimeout}})();function Yte(n,a=!0,o=!0,l){const c=a?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",p=a?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",f=Qte(Object.create({}),{autostart:!1});return f.use(XX),f.use(GX,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),f.use(YX,{videoPlayerController:l==null?void 0:l.videoPlayerController}),f.use(ZX,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),f.use(cX,{sdkKey:n,host:c,analyticsHost:p,version:l==null?void 0:l.version}),f.use(hX),f.use(QX),f.use(dJ),f.use(MX),f.use(kJ),f.after((y,b,C)=>{if(y)throw y;b.ready(),C()}),o&&f.after(async(y,b,C)=>{if(y)throw y;await b.sdk.initializeApp(),C()}),f.onClose(()=>{console.log("close")}),f}const Kte=({sdkKey:n,plugins:a,production:o,autoEnable:l,onDeepLinkHandled:c,videoPlayerController:p,onContentActivate:f,withAdNotification:y,withAd:b})=>{const[C,_]=Q.useState(null);return Q.useEffect(()=>{let N=!1;if(!n)return console.error("streamlayer sdk key should be provided"),_(R=>(R!==null&&typeof R.disableApp=="function"&&R.disableApp(),null)),()=>{N=!0};const L=Yte(n,o,l,{version:"1.8.5",onDeepLinkHandled:c,videoPlayerController:p,onContentActivate:f,withAdNotification:y,withAd:b});if(a)for(const R of a)L.use(R);return L.ready().then(R=>{N||(_(R.sdk),typeof window<"u")}).catch(R=>console.log(R)),()=>{N=!0,L.close(function(R){if(R)throw R})}},[n,o]),C},Zte=({event:n})=>{const a=Ay(),o=ene();return Q.useEffect(()=>(a&&(n&&(a.createEventSession(n),o&&(o.current=n)),!n&&(o!=null&&o.current)&&(a.createEventSession(""),o.current="")),()=>{a&&a.disableApp()}),[n,o,a]),null};var QE=(n=>(n[n.UNSET=0]="UNSET",n[n.CONNECTED=1]="CONNECTED",n[n.READY=2]="READY",n))(QE||{});const Xte={status:0,sdk:null},F6=Q.createContext(Xte),Jte=({sdkKey:n,theme:a,plugins:o,children:l,event:c,production:p=!0,autoEnable:f=!0,withAdNotification:y,withAd:b=!0,onDeepLinkHandled:C,videoPlayerController:_,onContentActivate:N})=>{const L=Kte({sdkKey:n,plugins:o,production:p,autoEnable:f,onDeepLinkHandled:C,videoPlayerController:_,onContentActivate:N,withAdNotification:y,withAd:b}),R=Q.useRef(""),P=Q.useMemo(()=>L?{sdk:L,status:2,event:R,theme:a}:{status:1,sdk:null,event:R,theme:a},[L]);return Q.useEffect(()=>()=>{C&&(L==null||L.removeDeepLinkHandler(C)),_&&(L==null||L.removeVideoPlayerController(_))},[L]),Q.useEffect(()=>{localStorage.getItem("SL_DEBUG")&&console.log("StreamLayerProvider mounted with props:",{sdkKey:!!n,onDeepLinkHandled:!!C,videoPlayerController:!!_})},[n,C,_]),w.jsxs(F6.Provider,{value:P,children:[c!==void 0&&w.jsx(Zte,{event:c}),l]})},Ay=()=>{const{sdk:n}=Q.useContext(F6);return n},ene=()=>{const{event:n}=Q.useContext(F6);return n},tne=({sdkKey:n,plugins:a,children:o,onDeepLinkHandled:l,videoPlayerController:c,production:p=!0})=>w.jsx(Jte,{sdkKey:n,plugins:a,production:p,autoEnable:!1,onDeepLinkHandled:l,videoPlayerController:c,children:o}),nne=({children:n,overlays:a})=>{const{sdk:o,status:l}=Q.useContext(F6);return l===QE.UNSET?(console.error("Wrap app in `StreamLayerProvider`"),n({})):o?w.jsx("div",{className:"StreamLayerSDK",children:w.jsx(PC,{style:{height:"100%"},children:w.jsx(Nq,{sdk:o,overlays:a,children:n})})}):n({})};class ane extends Q.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a,o){console.error(a,o.componentStack)}render(){return this.state.hasError?this.props.children({}):w.jsx(nne,{...this.props})}}const rne=({token:n,schema:a})=>{const o=Ay();return Q.useEffect(()=>{n&&a&&o&&o.authorizationBypass(a,n),o&&(o.withAuth=!0)},[n,a,o]),null},one=()=>{const n=Ay();return n?w.jsx("div",{className:"StreamLayerSDK",children:w.jsx(PC,{children:w.jsx(Fq,{sdk:n})})}):null};exports.C=la;exports.C$1=CC;exports.C$2=HV;exports.M=dy;exports.MastersStreamLayerProvider=tne;exports.MastersStreamLayerSDKReact=ane;exports.O=ay;exports.S=NC;exports.S$1=qV;exports.StreamLayerLogin=rne;exports.StreamLayerSDKPoints=one;exports.T=cy;exports.b=wC;exports.cx_default=Su;exports.d=WV;exports.k=LC;exports.l=$V;exports.m=n2;exports.m$1=BV;exports.n=oy;exports.p=jq;exports.styled_default=x;exports.useStore=Ut;exports.z=kz;
|
|
211
|
+
`).slice(0,2).map(o=>o.trim()).join(" -- ")}function Ote(){const n={};return n.promise=new Promise((a,o)=>{n.resolve=a,n.reject=o}),n}function Im(n,a,o,l,c){this.started=!1,this.func=a,this.opts=o,this.onFinish=null,this.parent=n,this.timeout=c===void 0?n._timeout:c,this.name=Lte(a,o),this.isAfter=l,this.q=_te(n,Ate,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Nte(Im,Ite);Im.prototype.exec=function(n,a){const o=this.func;let l=!1;const c=this.name;if(this.parent._error&&!this.isAfter){Fa("skipping loading of plugin as parent errored and it is not an after",c),St.nextTick(a);return}if(this.isAfter)this.server=n;else try{this.server=this.parent.override(n,o,this.opts)}catch(b){return Fa("override errored",c),a(b)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,Fa("exec",c);let p;const f=b=>{if(l){Fa("loading complete",c);return}this._error=b,Fa(b?"exec errored":"exec completed",c),l=!0,p&&clearTimeout(p),a(b)};this.timeout>0&&(Fa("setting up timeout",c,this.timeout),p=setTimeout(function(){Fa("timed out",c),p=null;const b=new Rte(c);b.fn=o,f(b)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const y=o(this.server,this.opts,f);y&&typeof y.then=="function"&&(Fa("exec: resolving promise",c),y.then(()=>St.nextTick(f),b=>St.nextTick(f,b)))};Im.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const n=()=>{this.server.after((o,l)=>{this._error=o,this.q.pause(),o?(Fa("rejecting promise",this.name,o),this._promise.reject(o)):(Fa("resolving promise",this.name),this._promise.resolve()),this._promise=null,St.nextTick(l,o)}),this.q.resume()};let a;return this._promise?a=Promise.resolve():(this._promise=Ote(),a=this._promise.promise,this.server?n():this.on("start",n)),a};Im.prototype.enqueue=function(n,a){Fa("enqueue",this.name,n.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(n,a)};Im.prototype.finish=function(n,a){Fa("finish",this.name,n);const o=()=>{this.loaded||(Fa("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,a(n))};if(n){this._promise&&(this._promise.reject(n),this._promise=null),o();return}const l=()=>{if(Fa("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const c=()=>{Fa("wrap"),queueMicrotask(l)};this._promise.resolve(),this._promise.promise.then(c,c),this._promise=null}else o();else Fa("delayed",this.name),this.q.drain=()=>{Fa("drain",this.name),this.q.drain=xte,queueMicrotask(l)}};queueMicrotask(l),this.q.resume()};function Ate(n,a){const o=this;St.nextTick(Oy.bind(o),n,a)}function Oy(n,a){if(typeof n.func.then=="function"){n.func.then(l=>{typeof l.default=="function"&&(l=l.default),n.func=l,Oy.call(this,n,a)},a);return}const o=this._current[0];this._current.unshift(n),n.exec(o&&o.server||this._server,l=>{n.finish(l,c=>{this._current.shift(),a(c)})})}function xte(){}Ly.exports=Im;Ly.exports.loadPlugin=Oy;var Pte=Ly.exports;const XS=vE,Mte=IE.EventEmitter,Dte=x6.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:J5,AVV_ERR_CALLBACK_NOT_FN:o2,AVV_ERR_PLUGIN_NOT_VALID:Ute,AVV_ERR_ROOT_PLG_BOOTED:Fte,AVV_ERR_READY_TIMEOUT:Vte}=HE,jte=Ste,F9=Pte,km=GE("avvio"),v6=Symbol("kAvvio"),e9=Symbol("kThenifyDoNotWrap");function Bte(n,a,o){const l=a.expose||{},c=l.use||"use",p=l.after||"after",f=l.ready||"ready",y=l.onClose||"onClose",b=l.close||"close";if(n[c])throw new J5(c);if(n[p])throw new J5(p);if(n[f])throw new J5(f);n[c]=function(C,_){return o.use(C,_),this},Object.defineProperty(n,"then",{get:qE.bind(o)}),n[v6]=!0,n[p]=function(C){return typeof C!="function"?o._loadRegistered():(o.after(t9(C,this)),this)},n[f]=function(C){if(C&&typeof C!="function")throw new o2(f,typeof C);return o.ready(C?t9(C,this):void 0)},n[y]=function(C){if(typeof C!="function")throw new o2(y,typeof C);return o.onClose(qte(C,this)),this},n[b]=function(C){if(C&&typeof C!="function")throw new o2(b,typeof C);return C?(o.close(t9(C,this)),this):o.close()}}function wa(n,a,o){if(typeof n=="function"&&arguments.length===1&&(o=n,a={},n=null),typeof a=="function"&&(o=a,a={}),a=a||{},!(this instanceof wa)){const l=new wa(n,a,o);return n&&Bte(n,a,l),l}a.autostart!==!1&&(a.autostart=!0),n=n||this,this._timeout=Number(a.timeout)||0,this._server=n,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),o&&this.once("start",o),this.started=!1,this.booted=!1,this.pluginTree=new jte,this._readyQ=XS(this,WE,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=JS},this._closeQ=XS(this,Gte,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=JS},this._doStart=null,this._root=new F9(this,$te.bind(this),a,!1,0),this._root.once("start",(l,c,p)=>{const f=this.pluginTree.start(null,c,p);this._root.once("loaded",(y,b,C)=>{this.pluginTree.stop(f,C)})}),F9.loadPlugin.call(this,this._root,l=>{km("root plugin ready");try{this.emit("preReady"),this._root=null}catch(c){l=l||this._error||c}if(l){if(this._error=l,this._readyQ.length()===0)throw l}else this.booted=!0;this._readyQ.resume()})}function $te(n,a,o){this._doStart=o,a.autostart&&this.start()}Dte(wa,Mte);wa.prototype.start=function(){return this.started=!0,St.nextTick(this._doStart),this};wa.prototype.override=function(n,a,o){return n};function zte(n){if(n&&typeof n=="object"&&typeof n.default=="function"&&(n=n.default),!(n&&(typeof n=="function"||typeof n.then=="function")))throw new Ute(typeof n);return n}wa.prototype[v6]=!0;wa.prototype.use=function(n,a){return this._lastUsed=this._addPlugin(n,a,!1),this};wa.prototype._loadRegistered=function(){const n=this._current[0];return!this.started&&!this.booted&&St.nextTick(()=>this._root.q.resume()),n?n.loadedSoFar():Promise.resolve()};Object.defineProperty(wa.prototype,"then",{get:qE});wa.prototype._addPlugin=function(n,a,o){if(n=zte(n),a=a||{},this.booted)throw new Fte;const l=this._current[0],c=new F9(this,n,a,o);if(c.once("start",(p,f,y)=>{const b=this.pluginTree.start(l.name,f,y);c.once("loaded",(C,_,N)=>{this.pluginTree.stop(b,N)})}),l.loaded)throw new Error(c.name,l.name);return l.enqueue(c,p=>{p&&(this._error=p)}),c};wa.prototype.after=function(n){if(!n)return this._loadRegistered();this._addPlugin(a.bind(this),{},!0);function a(o,l,c){WE.call(this,n,c)}return this};wa.prototype.onClose=function(n){if(typeof n!="function")throw new Error("not a function");n[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(n,a.bind(this));function a(o){o&&(this._error=o)}return this};wa.prototype.close=function(n){let a;if(n){if(typeof n!="function")throw new o2("close",typeof n)}else a=new Promise(function(o,l){n=function(c){if(c)return l(c);o()}});return this.ready(()=>{this._error=null,this._closeQ.push(n),St.nextTick(this._closeQ.resume.bind(this._closeQ))}),a};wa.prototype.ready=function(n){if(n){if(typeof n!="function")throw new o2("ready",typeof n);this._readyQ.push(n),queueMicrotask(this.start.bind(this));return}return new Promise((a,o)=>{this._readyQ.push(c),this.start();const l=this._current[0].server;function c(p,f,y){p?o(p):a(l),St.nextTick(y)}})};wa.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};wa.prototype.toJSON=function(){return this.pluginTree.toJSON()};function JS(){}function qE(){if(this.booted){km("thenify returning null because we are already booted");return}if(this[e9]){this[e9]=!1;return}return km("thenify"),(n,a)=>this._loadRegistered().then(()=>(this[e9]=!0,n(this._server)),a)}function WE(n,a){const o=this._server,l=this._error;let c;if(this._error=null,n.length===0)this._error=l,c=n(),c&&!c[v6]&&typeof c.then=="function"?c.then(()=>St.nextTick(a),p=>St.nextTick(a,p)):St.nextTick(a);else if(n.length===1)c=n(l),c&&!c[v6]&&typeof c.then=="function"?c.then(()=>St.nextTick(a),p=>St.nextTick(a,p)):St.nextTick(a);else if(this._timeout===0){const p=f=>{this._error=f,a(this._error)};n.length===2?n(l,p):n(l,o,p)}else Hte.call(this,n,l,o,a)}function Hte(n,a,o,l){const c=n.name;km("setting up ready timeout",c,this._timeout);let p=setTimeout(()=>{km("timed out",c),p=null;const y=new Vte(c);y.fn=n,this._error=y,l(y)},this._timeout);n.length===2?n(a,f.bind(this)):n(a,o,f.bind(this));function f(y){p&&(clearTimeout(p),this._error=y,l(this._error))}}function Gte(n,a){const o=this._server,l=n[this._isOnCloseHandlerKey];if(n.length===0||n.length===1){let c;l?c=n(o):c=n(this._error),c&&typeof c.then=="function"?(km("resolving close/onClose promise"),c.then(()=>St.nextTick(a),p=>St.nextTick(a,p))):St.nextTick(a)}else n.length===2?n(l?o:this._error,a):l?n(o,a):n(this._error,o,a)}function qte(n,a){return o.bind(a);function o(l,c){let p;n.length===0?(p=n(),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n.length===1?(p=n(this),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n(this,c)}}function t9(n,a){return o.bind(a);function o(l,c){let p;n?n.length===0?(p=n(),p&&p.then?p.then(function(){St.nextTick(c,l)},c):St.nextTick(c,l)):n.length===1?(p=n(l),p&&p.then?p.then(function(){St.nextTick(c)},c):St.nextTick(c)):n.length===2?n(l,c):n(l,this,c):St.nextTick(c)}}Ty.exports=wa;Ty.exports.express=function(n){return wa(n,{expose:{use:"load"}})};var Wte=Ty.exports;const Qte=SJ(Wte);(function(){if(window.requestAnimationFrame&&window.cancelAnimationFrame)return;const n=["webkit","moz","ms","o"];for(const a of n)window.requestAnimationFrame=window.requestAnimationFrame||window[`${a}RequestAnimationFrame`],window.cancelAnimationFrame=window.cancelAnimationFrame||window[`${a}CancelAnimationFrame`]||window[`${a}CancelRequestAnimationFrame`];if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){let a=0;const o=!!(window.performance&&window.performance.now);window.requestAnimationFrame=function(l){const c=o?window.performance.now():new Date().getTime(),p=Math.max(0,16-(c-a)),f=window.setTimeout(function(){l(c+p)},p);return a=c+p,f},window.cancelAnimationFrame=clearTimeout}})();function Yte(n,a=!0,o=!0,l){const c=a?"https://grpc-sdk.streamlayer.io:443":"https://grpc-sdk.next.streamlayer.io:443",p=a?"https://grpc.streamlayer.io:443":"https://grpc.next.streamlayer.io:443",f=Qte(Object.create({}),{autostart:!1});return f.use(XX),f.use(GX,{onDeepLinkHandled:l==null?void 0:l.onDeepLinkHandled}),f.use(YX,{videoPlayerController:l==null?void 0:l.videoPlayerController}),f.use(ZX,{onContentActivate:l==null?void 0:l.onContentActivate,withAd:l==null?void 0:l.withAd,withAdNotification:l==null?void 0:l.withAdNotification}),f.use(cX,{sdkKey:n,host:c,analyticsHost:p,version:l==null?void 0:l.version}),f.use(hX),f.use(QX),f.use(dJ),f.use(MX),f.use(kJ),f.after((y,b,C)=>{if(y)throw y;b.ready(),C()}),o&&f.after(async(y,b,C)=>{if(y)throw y;await b.sdk.initializeApp(),C()}),f.onClose(()=>{console.log("close")}),f}const Kte=({sdkKey:n,plugins:a,production:o,autoEnable:l,onDeepLinkHandled:c,videoPlayerController:p,onContentActivate:f,withAdNotification:y,withAd:b})=>{const[C,_]=Q.useState(null);return Q.useEffect(()=>{let N=!1;if(!n)return console.error("streamlayer sdk key should be provided"),_(R=>(R!==null&&typeof R.disableApp=="function"&&R.disableApp(),null)),()=>{N=!0};const L=Yte(n,o,l,{version:"1.8.6",onDeepLinkHandled:c,videoPlayerController:p,onContentActivate:f,withAdNotification:y,withAd:b});if(a)for(const R of a)L.use(R);return L.ready().then(R=>{N||(_(R.sdk),typeof window<"u")}).catch(R=>console.log(R)),()=>{N=!0,L.close(function(R){if(R)throw R})}},[n,o]),C},Zte=({event:n})=>{const a=Ay(),o=ene();return Q.useEffect(()=>(a&&(n&&(a.createEventSession(n),o&&(o.current=n)),!n&&(o!=null&&o.current)&&(a.createEventSession(""),o.current="")),()=>{a&&a.disableApp()}),[n,o,a]),null};var QE=(n=>(n[n.UNSET=0]="UNSET",n[n.CONNECTED=1]="CONNECTED",n[n.READY=2]="READY",n))(QE||{});const Xte={status:0,sdk:null},F6=Q.createContext(Xte),Jte=({sdkKey:n,theme:a,plugins:o,children:l,event:c,production:p=!0,autoEnable:f=!0,withAdNotification:y,withAd:b=!0,onDeepLinkHandled:C,videoPlayerController:_,onContentActivate:N})=>{const L=Kte({sdkKey:n,plugins:o,production:p,autoEnable:f,onDeepLinkHandled:C,videoPlayerController:_,onContentActivate:N,withAdNotification:y,withAd:b}),R=Q.useRef(""),P=Q.useMemo(()=>L?{sdk:L,status:2,event:R,theme:a}:{status:1,sdk:null,event:R,theme:a},[L]);return Q.useEffect(()=>()=>{C&&(L==null||L.removeDeepLinkHandler(C)),_&&(L==null||L.removeVideoPlayerController(_))},[L]),Q.useEffect(()=>{localStorage.getItem("SL_DEBUG")&&console.log("StreamLayerProvider mounted with props:",{sdkKey:!!n,onDeepLinkHandled:!!C,videoPlayerController:!!_})},[n,C,_]),w.jsxs(F6.Provider,{value:P,children:[c!==void 0&&w.jsx(Zte,{event:c}),l]})},Ay=()=>{const{sdk:n}=Q.useContext(F6);return n},ene=()=>{const{event:n}=Q.useContext(F6);return n},tne=({sdkKey:n,plugins:a,children:o,onDeepLinkHandled:l,videoPlayerController:c,production:p=!0})=>w.jsx(Jte,{sdkKey:n,plugins:a,production:p,autoEnable:!1,onDeepLinkHandled:l,videoPlayerController:c,children:o}),nne=({children:n,overlays:a})=>{const{sdk:o,status:l}=Q.useContext(F6);return l===QE.UNSET?(console.error("Wrap app in `StreamLayerProvider`"),n({})):o?w.jsx("div",{className:"StreamLayerSDK",children:w.jsx(PC,{style:{height:"100%"},children:w.jsx(Nq,{sdk:o,overlays:a,children:n})})}):n({})};class ane extends Q.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a,o){console.error(a,o.componentStack)}render(){return this.state.hasError?this.props.children({}):w.jsx(nne,{...this.props})}}const rne=({token:n,schema:a})=>{const o=Ay();return Q.useEffect(()=>{n&&a&&o&&o.authorizationBypass(a,n),o&&(o.withAuth=!0)},[n,a,o]),null},one=()=>{const n=Ay();return n?w.jsx("div",{className:"StreamLayerSDK",children:w.jsx(PC,{children:w.jsx(Fq,{sdk:n})})}):null};exports.C=la;exports.C$1=CC;exports.C$2=HV;exports.M=dy;exports.MastersStreamLayerProvider=tne;exports.MastersStreamLayerSDKReact=ane;exports.O=ay;exports.S=NC;exports.S$1=qV;exports.StreamLayerLogin=rne;exports.StreamLayerSDKPoints=one;exports.T=cy;exports.b=wC;exports.cx_default=Su;exports.d=WV;exports.k=LC;exports.l=$V;exports.m=n2;exports.m$1=BV;exports.n=oy;exports.p=jq;exports.styled_default=x;exports.useStore=Ut;exports.z=kz;
|