PageSourceSearch

https://xana.net/app/_next/static/chunks/1180.949312bbf8564cb9.js

js xana.net collected 2026-09-24 10:37:24 UTC 17,550 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1180],{61180:function(e,t,n){let r;n.d(t,{RedundantAdaptiveBroadcastChannel:function(){return eK}});var o={};n.r(o),n.d(o,{TRANSACTION_SETTINGS:function(){return M},averageResponseTime:function(){return J},canBeUsed:function(){return R},cleanOldMessages:function(){return D},close:function(){return A},commitIndexedDBTransaction:function(){return L},create:function(){return x},createDatabase:function(){return P},getAllMessages:function(){return B},getIdb:function(){return E},getMessagesHigherThan:function(){return N},getOldMessages:function(){return Z},microSeconds:function(){return k},onMessage:function(){return j},postMessage:function(){return $},removeMessagesById:function(){return T},type:function(){return S},writeMessage:function(){return I}});var s={};n.r(s),n.d(s,{addStorageEventListener:function(){return V},averageResponseTime:function(){return Y},canBeUsed:function(){return G},close:function(){return Q},create:function(){return H},getLocalStorage:function(){return F},microSeconds:function(){return z},onMessage:function(){return X},postMessage:function(){return W},removeStorageEventListener:function(){return q},storageKey:function(){return K},type:function(){return U}});var i={};n.r(i),n.d(i,{averageResponseTime:function(){return ea},canBeUsed:function(){return ei},close:function(){return er},create:function(){return en},microSeconds:function(){return ee},onMessage:function(){return es},postMessage:function(){return eo},type:function(){return et}});var a={};n.r(a),n.d(a,{averageResponseTime:function(){return eE},canBeUsed:function(){return ek},close:function(){return eM},create:function(){return eC},getSocketInstance:function(){return eb},microSeconds:function(){return em},onMessage:function(){return eS},postMessage:function(){return ew},removeStorageEventListener:function(){return ey},setupSocketConnection:function(){return e_},storageKey:function(){return ev},type:function(){return ef}});var c={};n.r(c),n.d(c,{SIMULATE_DELAY_TIME:function(){return eB},averageResponseTime:function(){return eO},canBeUsed:function(){return ex},close:function(){return eT},create:function(){return eN},microSeconds:function(){return eL},onMessage:function(){return eD},postMessage:function(){return eZ},type:function(){return eP}});var u=n(1413),l=n(4942),d=n(2043),h=n.n(d);Promise.resolve(!1),Promise.resolve(!0);let m=Promise.resolve();function f(e,t){return e||(e=0),new Promise(n=>{setTimeout(()=>n(t),e)})}function g(){return Math.random().toString(36).substring(2)}let p=0;function v(){let e=1e3*Date.now();return e<=p&&(e=p+1),p=e,e}let w=h().getLogger("broadcast-channel");w.setLevel("error");class b{ttl;map=new Map;_to=!1;constructor(e){this.ttl=e}has(e){return this.map.has(e)}add(e){this.map.set(e,_()),this._to||(this._to=!0,setTimeout(()=>{this._to=!1,function(e){let t=_()-e.ttl,n=e.map[Symbol.iterator]();for(;;){let r=n.next().value;if(!r)return;let o=r[0];if(!(r[1]<t))return;e.map.delete(o)}}(this)},0))}clear(){this.map.clear()}}function _(){return Date.now()}function y(e={}){let t=JSON.parse(JSON.stringify(e));return void 0===t.webWorkerSupport&&(t.webWorkerSupport=!0),t.idb||(t.idb={}),t.idb.ttl||(t.idb.ttl=45e3),t.idb.fallbackInterval||(t.idb.fallbackInterval=150),e.idb&&"function"==typeof e.idb.onclose&&(t.idb.onclose=e.idb.onclose),t.localstorage||(t.localstorage={}),t.localstorage.removeTimeout||(t.localstorage.removeTimeout=6e4),t.server||(t.server={}),t.server.api_url||(t.server.api_url="https://api.web3auth.io/session-service/v2"),t.server.socket_url||(t.server.socket_url="https://session.web3auth.io"),t.server.removeTimeout||(t.server.removeTimeout=3e5),e.methods&&(t.methods=e.methods),t}let k=v,C="messages",M={durability:"relaxed"},S="idb";function E(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){let e=window;if(void 0!==e.mozIndexedDB)return e.mozIndexedDB;if(void 0!==e.webkitIndexedDB)return e.webkitIndexedDB;if(void 0!==e.msIndexedDB)return e.msIndexedDB}return!1}function L(e){e.commit&&e.commit()}function P(e){let t=E();if(!t)return Promise.reject(Error("IndexedDB not available"));let n=t.open("pubkey.broadcast-channel-0-"+e);return n.onupgradeneeded=e=>{e.target.result.createObjectStore(C,{keyPath:"id",autoIncrement:!0})},new Promise((e,t)=>
1{n.onerror=e=>t(e),n.onsuccess=()=>{e(n.result)}})}function I(e,t,n){let r={uuid:t,time:Date.now(),data:n},o=e.transaction([C],"readwrite",M);return new Promise((e,t)=>{o.oncomplete=()=>e(),o.onerror=e=>t(e),o.objectStore(C).add(r),L(o)})}function B(e){let t=e.transaction(C,"readonly",M),n=t.objectStore(C),r=[];return new Promise(e=>{n.openCursor().onsuccess=n=>{let o=n.target.result;o?(r.push(o.value),o.continue()):(L(t),e(r))}})}function N(e,t){let n=e.transaction(C,"readonly",M),r=n.objectStore(C),o=[],s=IDBKeyRange.bound(t+1,1/0);if(r.getAll){let e=r.getAll(s);return new Promise((t,n)=>{e.onerror=e=>n(e),e.onsuccess=function(e){t(e.target.result)}})}return new Promise((e,i)=>{let a=function(){try{return s=IDBKeyRange.bound(t+1,1/0),r.openCursor(s)}catch{return r.openCursor()}}();a.onerror=e=>i(e),a.onsuccess=r=>{let s=r.target.result;s?s.value.id<t+1?s.continue(t+1):(o.push(s.value),s.continue()):(L(n),e(o))}})}function T(e,t){let n=e.transaction([C],"readwrite",M).objectStore(C);return Promise.all(t.map(e=>{let t=n.delete(e);return new Promise(e=>{t.onsuccess=()=>e()})}))}function Z(e,t){let n=Date.now()-t,r=e.transaction(C,"readonly",M),o=r.objectStore(C),s=[];return new Promise(e=>{o.openCursor().onsuccess=t=>{let o=t.target.result;if(o){let t=o.value;t.time<n?(s.push(t),o.continue()):(L(r),e(s))}else e(s)}})}function D(e,t){return Z(e,t).then(t=>T(e,t.map(e=>e.id)))}function x(e,t){return t=y(t),P(e).then(n=>{let r={closed:!1,lastCursorId:0,channelName:e,options:t,uuid:g(),eMIs:new b(2*t.idb.ttl),writeBlockPromise:m,messagesCallback:null,readQueuePromises:[],db:n,time:v()};return n.onclose=function(){r.closed=!0,t.idb.onclose&&t.idb.onclose()},function e(t){t.closed||O(t).then(()=>f(t.options.idb.fallbackInterval)).then(()=>e(t)).catch(e=>{throw e})}(r),r})}function O(e){return e.closed||!e.messagesCallback?m:N(e.db,e.lastCursorId).then(t=>(t.filter(e=>!!e).map(t=>(t.id>e.lastCursorId&&(e.lastCursorId=t.id),t)).filter(t=>!(t.uuid===e.uuid||e.eMIs.has(t.id))&&!(t.data.time<e.messagesCallbackTime)).sort((e,t)=>e.time-t.time).forEach(t=>{e.messagesCallback&&(e.eMIs.add(t.id),e.messagesCallback(t.data))}),m))}function A(e){e.closed=!0,e.db.close()}function $(e,t){return e.writeBlockPromise=e.writeBlockPromise.then(()=>I(e.db,e.uuid,t)).then(()=>(0===Math.floor(11*Math.random()+0)&&D(e.db,e.options.idb.ttl),m)),e.writeBlockPromise}function j(e,t,n){e.messagesCallbackTime=n,e.messagesCallback=t,O(e)}function R(){return!!E()}function J(e){return 2*e.idb.fallbackInterval}let z=v,U="localstorage";function F(){let e=null;if("undefined"==typeof window)return null;try{e=window.localStorage,e=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return e}function K(e){return"pubkey.broadcastChannel-"+e}function W(e,t){return new Promise((n,r)=>{f().then(()=>{var r;let o=K(e.channelName),s=JSON.stringify({token:g(),time:Date.now(),data:t,uuid:e.uuid});null===(r=F())||void 0===r||r.setItem(o,s);let i=document.createEvent("StorageEvent");i.initStorageEvent("storage",!0,!0,o,null,s,"",null),window.dispatchEvent(i),n()}).catch(r)})}function V(e,t){let n=K(e),r=e=>{e.key===n&&e.newValue&&t(JSON.parse(e.newValue))};return window.addEventListener("storage",r),r}function q(e){window.removeEventListener("storage",e)}function G(){let e=F();if(!e)return!1;try{let t="__broadcastchannel_check";e.setItem(t,"works"),e.removeItem(t)}catch{return!1}return!0}function H(e,t){let n=y(t);if(!G())throw Error("BroadcastChannel: localstorage cannot be used");let r=g(),o=new b(n.localstorage.removeTimeout),s={channelName:e,uuid:r,time:v(),eMIs:o};return s.listener=V(e,e=>{!(!s.messagesCallback||e.uuid===r||!e.token||o.has(e.token))&&(e.data.time&&e.data.time<(s.messagesCallbackTime||0)||(o.add(e.token),s.messagesCallback(e.data)))}),s}function Q(e){e.listener&&q(e.listener)}function X(e,t,n){e.messagesCallbackTime=n,e.messagesCallback=t}function Y(){let e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?240:120}let ee=v,et="native";function en(e){let t={time:v(),messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return t.bc.onmessage=e=>{t.messagesCallback&&t.messagesCallback(e.data)},t}function er(e){e.bc.close(),e.subFns=[]}function eo(e,t){try{return e.bc.postMessage(t),m}catch(e){return Promise.reject(e)}}function es(e,t){e.messagesCallback=t}function ei(){if("undefined"==typeof window)return!1;if("function"==typeof BroadcastChannel){if(BroadcastChannel._pubkey)throw Error("BroadcastChannel: Do n
1ot overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}return!1}function ea(){return 150}var ec=n(82925),eu=n(40142),el=n(52497),ed=n(67642),eh=n(48764).Buffer;let em=v,ef="server",eg=null,ep=new Set;function ev(e){return"pubkey.broadcastChannel-"+e}function ew(e,t){return new Promise((n,r)=>{f().then(async()=>{let o=ev(e.channelName),s=(0,eu.w)(eh.from(o,"utf8")),i=await (0,el.q6)(s.toString("hex"),{token:g(),time:Date.now(),data:t,uuid:e.uuid}),a={allowedOrigin:e.server.allowed_origin,sameIpCheck:!0,key:(0,ec.rc)(s).toString("hex"),data:i,signature:(await (0,ec.Xx)(s,(0,eu.w)(eh.from(i,"utf8")))).toString("hex")};return e.timeout&&(a.timeout=e.timeout),fetch(`${e.server.api_url}/channel/set`,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json; charset=utf-8"}}).then(n).catch(r)}).catch(r)})}function eb(e){if(eg)return eg;let t=(0,ed.io)(e,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return t.on("connect_error",e=>{t.io.opts.transports=["polling","websocket"],w.error("connect error",e)}),t.on("connect",async()=>{let{engine:e}=t.io;w.debug("initially connected to",e.transport.name),e.once("upgrade",()=>{w.debug("upgraded",e.transport.name)}),e.once("close",e=>{w.debug("connection closed",e)})}),t.on("error",e=>{w.error("socket errored",e),t.disconnect()}),eg=t,t}function e_(e,t,n){let r=eb(e),o=ev(t.channelName),s=(0,eu.w)(eh.from(o,"utf8")),i=(0,ec.rc)(s).toString("hex");r.connected?r.emit("v2:check_auth_status",i,{sameIpCheck:!0,allowedOrigin:t.server.allowed_origin}):r.once("connect",()=>{w.debug("connected with socket"),r.emit("v2:check_auth_status",i,{sameIpCheck:!0,allowedOrigin:t.server.allowed_origin})});let a=()=>{r.once("connect",async()=>{ep.has(t.channelName)&&r.emit("v2:check_auth_status",i,{sameIpCheck:!0,allowedOrigin:t.server.allowed_origin})})},c=()=>{if(!r||!ep.has(t.channelName)){document.removeEventListener("visibilitychange",c);return}r.connected||"visible"!==document.visibilityState||a()},u=async e=>{try{let t=await (0,el.ow)(s.toString("hex"),e);w.info(t),n(t)}catch(e){w.error(e)}};return r.on("disconnect",()=>{w.debug("socket disconnected"),ep.has(t.channelName)&&(w.error("socket disconnected unexpectedly, reconnecting socket"),a())}),r.on(`${i}_success`,u),"undefined"!=typeof document&&document.addEventListener("visibilitychange",c),r}function ey(){eg&&eg.disconnect()}function ek(){return!0}function eC(e,t){t=y(t);let n={channelName:e,uuid:g(),eMIs:new b(t.server.removeTimeout),server:{api_url:t.server.api_url,socket_url:t.server.socket_url,allowed_origin:t.server.allowed_origin},time:v()};return t.server.timeout&&(n.timeout=t.server.timeout),e_(t.server.socket_url,n,e=>{n.messagesCallback&&e.uuid!==n.uuid&&(!e.token||n.eMIs.has(e.token)||(n.eMIs.add(e.token),n.messagesCallback(e.data)))}),ep.add(e),n}function eM(e){ep.delete(e.channelName)}function eS(e,t,n){e.messagesCallbackTime=n,e.messagesCallback=t}function eE(){return 500}let eL=v,eP="simulate",eI=new Set,eB=5;function eN(e){let t={time:v(),name:e,messagesCallback:null};return eI.add(t),t}function eT(e){eI.delete(e)}function eZ(e,t){return new Promise(n=>{setTimeout(()=>{Array.from(eI).forEach(n=>{n.name===e.name&&n!==e&&n.messagesCallback&&n.time<t.time&&n.messagesCallback(t)}),n()},eB)})}function eD(e,t){e.messagesCallback=t}function ex(){return!0}function eO(){return eB}let eA=[i,o,s,a],e$=new Set,ej=0;class eR{constructor(e,t){(0,l.Z)(this,"id",void 0),(0,l.Z)(this,"name",void 0),(0,l.Z)(this,"options",void 0),(0,l.Z)(this,"method",void 0),(0,l.Z)(this,"closed",void 0),(0,l.Z)(this,"_addEL",void 0),(0,l.Z)(this,"_prepP",void 0),(0,l.Z)(this,"_state",void 0),(0,l.Z)(this,"_uMP",void 0),(0,l.Z)(this,"_iL",void 0),(0,l.Z)(this,"_onML",void 0),(0,l.Z)(this,"_befC",void 0),this.id=ej++,e$.add(this),this.name=e,r&&(t=r),this.options=y(t||{}),this.method=function(e){let t=[].concat(e.methods||[],eA).filter(Boolean);if(e.type){if("simulate"===e.type)return c;let n=t.find(t=>t.type===e.type);if(n)return n;throw Error(`method-type ${e.type} not found`)}
1e.webWorkerSupport||(t=t.filter(e=>"idb"!==e.type));let n=t.find(t=>t.canBeUsed(e));if(n)return n;throw Error(`No useable method found in ${JSON.stringify(eA.map(e=>e.type))}`)}(this.options),this.closed=!1,this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,function(e){let t=e.method.create(e.name,e.options);(t&&"function"==typeof t.then?0:1)?e._state=t:(e._prepP=t,t.then(t=>(e._state=t,t)).catch(e=>{throw e}))}(this)}get type(){return this.method.type}get isClosed(){return this.closed}set onmessage(e){let t={time:this.method.microSeconds(),fn:e};eF(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,eU(this,"message",t)):this._onML=null}postMessage(e){if(this.closed)throw Error(`BroadcastChannel.postMessage(): Cannot post message after channel has closed ${JSON.stringify(e)}`);return eJ(this,"message",e)}postInternal(e){return eJ(this,"internal",e)}addEventListener(e,t){eU(this,e,{time:this.method.microSeconds(),fn:t})}removeEventListener(e,t){let n=this._addEL[e].find(e=>e.fn===t);eF(this,e,n)}close(){if(this.closed)return Promise.resolve();e$.delete(this),this.closed=!0;let e=this._prepP?this._prepP:m;return this._onML=null,this._addEL.message=[],e.then(()=>Promise.all(Array.from(this._uMP))).then(()=>Promise.all(this._befC.map(e=>e()))).then(()=>this.method.close?this.method.close(this._state):m)}}function eJ(e,t,n){let r={time:e.method.microSeconds(),type:t,data:n};return(e._prepP?e._prepP:m).then(()=>{let t=e.method.postMessage(e._state,r);return e._uMP.add(t),t.catch(()=>{}).then(()=>e._uMP.delete(t)),t})}function ez(e){return e._addEL.message.length>0||e._addEL.internal.length>0}function eU(e,t,n){e._addEL[t].push(n),function(e){if(!e._iL&&ez(e)){let t=t=>{e._addEL[t.type].forEach(n=>{t.time>=n.time?n.fn(t.data):"server"===e.method.type&&n.fn(t.data)})},n=e.method.microSeconds();e._prepP?e._prepP.then(()=>(e._iL=!0,e.method.onMessage(e._state,t,n),!0)).catch(e=>{throw e}):(e._iL=!0,e.method.onMessage(e._state,t,n))}}(e)}function eF(e,t,n){n&&(e._addEL[t]=e._addEL[t].filter(e=>e!==n),function(e){if(e._iL&&!ez(e)){e._iL=!1;let t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}(e))}(0,l.Z)(eR,"_pubkey",!0);class eK{constructor(e,t={}){(0,l.Z)(this,"name",void 0),(0,l.Z)(this,"options",void 0),(0,l.Z)(this,"closed",void 0),(0,l.Z)(this,"onML",void 0),(0,l.Z)(this,"methodPriority",void 0),(0,l.Z)(this,"channels",void 0),(0,l.Z)(this,"listeners",void 0),(0,l.Z)(this,"processedNonces",void 0),(0,l.Z)(this,"nonce",void 0),this.name=e,this.options=t,this.closed=!1,this.onML=null,this.methodPriority=[et,U,ef],this.channels=new Map,this.listeners=new Set,this.processedNonces=new Set,this.nonce=0,this.initChannels()}set onmessage(e){this.removeEventListener("message",this.onML),e&&"function"==typeof e?(this.onML=e,this.addEventListener("message",e)):this.onML=null}initChannels(){if(this.options.type===eP&&(this.methodPriority=[eP]),this.methodPriority.forEach(e=>{try{let t=new eR(this.name,(0,u.Z)((0,u.Z)({},this.options),{},{type:e}));this.channels.set(e,t),w.debug(`Succeeded to initialize ${e} method in channel ${this.name}`),t.onmessage=e=>this.handleMessage(e)}catch(t){w.warn(`Failed to initialize ${e} method in channel ${this.name}: ${t instanceof Error?t.message:String(t)}`)}}),0===this.channels.size)throw Error("Failed to initialize any communication method")}allChannels(){return Array.from(this.channels.keys())}hasChannel(e){return this.channels.has(e)}handleMessage(e){if(e&&e.nonce&&!this.processedNonces.has(e.nonce)){if(this.processedNonces.add(e.nonce),this.processedNonces.size>1e3){let e=Array.from(this.processedNonces).sort()[0];this.processedNonces.delete(e)}this.listeners.forEach(t=>{t(e.message)})}}async postMessage(e){if(this.closed)throw Error(`AdaptiveBroadcastChannel.postMessage(): Cannot post message after channel has closed ${JSON.stringify(e)}`);let t={nonce:this.generateNonce(),message:e},n=Array.from(this.channels.entries()).map(([e,n])=>n.postMessage(t).catch(t=>{throw w.warn(`Failed to send via ${e}: ${t.message}`),t}));if(!(await Promise.allSettled(n)).some(e=>"fulfilled"===e.status))throw Error("Failed to send message through any method");return e}generateNonce(){return`${Date.now()}-${this.nonce++}`}addEventListener(e,t){this.listeners.add(t)}removeEventListener(e,t){this.listeners.delete(t)}async close(){if(this.closed)return;this.onML=null;let e=[];for(let t of this.channels.values())e.push(t.close());await Promise.all(e),this.channels.clear(),this.listeners.clear(),this.closed=!0}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.