(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[556],{3592:function(e){function t(e){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=function(){return[]},t.resolve=t,t.id=3592,e.exports=t},42480:function(){},75992:function(){},78110:function(){},55024:function(){},49354:function(e,t,n){"use strict";n.d(t,{cn:function(){return s}});var r=n(44839),i=n(96164);function s(){for(var e=arguments.length,t=Array(e),n=0;n{e.find(e=>e.chain===n.chain&&e.address===n.address)||(await (0,o.N1)(t,n.synthientIdSignature)?e.push(n):d.error("Could not verify identity for ".concat(t," on chain ").concat(n.chain," with address ").concat(n.address)))})),e}async getNetworkTotalTokens(){return(await this.db.peers.toArray()).reduce((e,t)=>e+t.totalTokens,0)}async getLastPeers(e,t){return this.db.peers.where("lastSeen").aboveOrEqual(e).limit(t).toArray()}async getPeerCount(e){return e?this.db.peers.where("lastSeen").aboveOrEqual(e).count():this.db.peers.count()}async processPackets(e){let t=e.map(e=>e.synthientId),n=(await this.db.peers.bulkGet(t)).filter(e=>!!e),r=!1,i=await Promise.all(Array.from(new Set(t)).map(async t=>{let i=e.filter(e=>e.synthientId===t).sort((e,t)=>{var n,r;return((null===(n=t.receivedTime)||void 0===n?void 0:n.getTime())||0)-((null===(r=e.receivedTime)||void 0===r?void 0:r.getTime())||0)}),s=n.find(e=>e.synthientId===t);s||(r=!0);let o=i.filter(e=>"peerConnectedChain"===e.packet.type).flatMap(e=>e.packet.identities),a=i.map(e=>"peerStatusUpdate"===e.packet.type&&("completed_inference"===e.packet.status||"boot"===e.packet.status)?e.packet.totalTokens:0).concat([(null==s?void 0:s.totalTokens)||0]).filter(e=>!isNaN(e)&&e>0),c=a.length>0?Math.max(...a):0,d=s||{synthientId:t,seenOn:[],totalTokens:c,lastSeen:i[0].receivedTime||new Date,chainIds:[]};return d.seenOn=Array.from(new Set([...d.seenOn,...i.map(e=>e.deliveredThrough).filter(e=>!!e)])),d.chainIds=await this.updateChainIdentities(d.chainIds,t,o),d}));await this.db.peers.bulkPut(i);let s=e.filter(e=>"knownPeers"===e.packet.type);return s.length>0&&this.loadKnownPeerPackets(s),r}async loadKnownPeerPackets(e){let t=e.flatMap(e=>e.packet.peerList.map(e=>e.synthientId)),n=(await this.db.peers.bulkGet(t)).filter(e=>!!e),r={},i={};e.forEach(e=>{e.packet.peerList.forEach(t=>{i[t.synthientId]&&i[t.synthientId].latestUpdate>=new Date(e.packet.createdAt)||(i[t.synthientId]={peer:{totalTokens:t.totalTokens,synthientId:t.synthientId,seenOn:t.seenOn,lastSeen:new Date(t.lastSeen),chainIds:t.identities||[]},latestUpdate:new Date(e.packet.createdAt)})})}),await Promise.all(Object.values(i).map(async e=>{let{peer:t}=e,i=n.find(e=>e.synthientId===t.synthientId)||r[t.synthientId]||{synthientId:t.synthientId,seenOn:t.seenOn,lastSeen:new Date(t.lastSeen),chainIds:[]};i.seenOn=Array.from(new Set([...i.seenOn,...t.seenOn])),i.chainIds=await this.updateChainIdentities(i.chainIds,t.synthientId,t.chainIds),i.lastSeen=i.lastSeen&&new Date(Math.max(i.lastSeen.getTime(),new Date(t.lastSeen).getTime())||new Date(t.lastSeen)),d.debug("UpdatedPeer totalTokens: ".concat(t.totalTokens," ").concat(i.totalTokens));let s=[t.totalTokens,i.totalTokens].filter(e=>!isNaN(e)&&e>0);i.totalTokens=s.length>0?Math.max(...s):0,r[t.synthientId]=i})),await this.db.peers.bulkPut(Object.values(r))}async getPeer(e){return this.db.peers.get(e)}async getAllPeers(){return this.db.peers.toArray()}async deletePeer(e){await this.db.peers.delete(e)}constructor(e={}){this.db=new l(e)}}var h=n(22170),p=n.n(h),g=n(13201),f=n(89028);let m=(0,c.hu)("PacketDB",c.$5.databases.packetDB);i.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;ne.synthientId===this.clientInfo.synthientId)&&(m.debug("Received inferenceRevealRequest for own synthientId"),this.emit("newInferenceRevealRequest",e))}async transmitPacket(e){let t={synthientId:this.clientInfo.synthientId,signature:"",packet:e};t.signature=(0,o.K4)(this.clientInfo.synthientPrivKey,e),await this.db.packets.add({...t,receivedTime:new Date}),this.emitNewPacketEvents(t),m.debug("Transmitting packet ".concat(t.packet.type),t),await this.sendPacketOverP2P(t)}async getAllPackets(){return await this.db.packets.toArray()}fixEmbeddingArraysInPackets(e){"inferenceReveal"===e.packet.type?(e.packet.embedding=Object.values(e.packet.embedding),e.packet.bEmbedding=Object.values(e.packet.bEmbedding)):"inferenceRevealRejected"===e.packet.type&&("computed_bembedding_fails_threshold"===e.packet.rejectReason.type&&(e.packet.rejectReason.computedBEmbedding=Object.values(e.packet.rejectReason.computedBEmbedding)),e.packet.rejectReason.revealedBEmbedding=Object.values(e.packet.rejectReason.revealedBEmbedding))}async getPacket(e,t){return await this.db.packets.get({synthientId:e,signature:t})}verifyAndDedupeReceivedPacketQueue(e){let t=e.filter(e=>{let t=(0,o.yj)(e.synthientId,e.signature,e.packet);return t||m.debug("Invalid signature on packet, dropping packet from ".concat(e.synthientId),e),t}),n={};return t.forEach(e=>{let t=e.synthientId+e.signature;n[t]||(n[t]=e)}),Object.values(n)}async transmitPeerList(){let e=new Date(Date.now()-432e5),t=await this.peerDB.getLastPeers(e,200);if(Math.random()({synthientId:e.synthientId,identities:e.chainIds,totalTokens:!isNaN(e.totalTokens)&&e.totalTokens||0,lastSeen:e.lastSeen&&(0,g.MQ)(e.lastSeen),seenOn:e.seenOn})),createdAt:(0,g.MQ)(new Date)};m.debug("Transmitting peer list with ".concat(Object.values(e).length),e),await this.transmitPacket(e)}}emitPeerHeart(e){this.emit("peerHeart",e)}receivePacket(e){m.trace("Queued received packet: ",e),this.receivedPacketQueue.push(e),this.processReceivedPacketQueue(),this.receivedPacketQueue.length>=y.maxReceivedPacketQueueSize&&this.processReceivedPacketQueue.flush()}async printPackets(){await this.db.packets.toArray()}async dropOldPackets(e){let t=new Date(Date.now()-e);await this.db.packets.where("receivedTime").below(t).delete(),m.debug("Dropped packets older than ".concat(e,"ms"))}async clearPackets(){await this.db.packets.clear(),m.debug("Cleared all packets from the database.")}constructor(e,t,n={}){super(),this.clientInfo=e,this.sendPacketOverP2P=t,this.receivedPacketQueue=[],this.cleanUpOldPackets=p()(async()=>{m.debug("Cleaning up old packets."),await this.db.packets.orderBy("receivedTime").reverse().offset(y.maxPacketDBSize+50).delete()},5e3),this.processReceivedPacketQueue=p()(async()=>{let e=this.receivedPacketQueue;this.receivedPacketQueue=[];let t=this.verifyAndDedupeReceivedPacketQueue(e),n=await this.db.packets.where("[synthientId+signature]").anyOf(t.map(e=>[e.synthientId,e.signature])).toArray(),i=t.filter(e=>!n.some(t=>t.synthientId===e.synthientId&&t.signature===e.signature)).map(e=>(this.fixEmbeddingArraysInPackets(e),e));try{await this.db.packets.bulkPut(i).catch(r.ZP.BulkError,function(e){m.error("".concat(e.failures.length," packets were added successfully, but some others could not be. Check console for errors"),e)})}catch(e){m.error("Different error adding packets to the database",e)}let s=!!i.some(e=>"peerStatusUpdate"===e.packet.type&&"boot"===e.packet.status);this.peerDB.processPackets(i).then(e=>{(e||s)&&this.transmitPeerList()}),i.forEach(e=>this.emitNewPacketEvents(e)),i.filter(e=>"peerHeart"===e.packet.type).slice(0,y.peerHeartLimit).forEach(e=>this.emitPeerHeart(e)),setTimeout(()=>this.cleanUpOldPackets(),0)},y.receivePacketQueueDebounceMs,{trailing:!0}),this.db=new k(n),this.peerDB=new u,this.clientInfo=e,this.sendPacketOverP2P=t}}},18951:function(e,t,n){"use strict";let r;n.d(t,{K6:function(){return u},il:function(){return l}});var i=n(3682),s=n(69893),o=n(78967),a=n(13201),c=n(89028);s.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]&&arguments[1];if(r)return r;if(!t&&localStorage.getItem(d)&&e)try{let t=localStorage.getItem(d),n=await (0,i.ow)(t,e);n.synthientId||console.log("Could not properly decrypt with this password"),r=n}catch(e){throw console.error("Could not decrypt saved identity",e),e}else{let t=function(){let e=s.P6.randomPrivateKey(),t=s.$3(e);return{synthientId:s.UG.bytesToHex(t),synthientPrivKey:s.UG.bytesToHex(e),chainIds:[],deviceInfo:(0,a.dz)()}}();await l(t,e),r=t}return r}},12683:function(e,t,n){"use strict";n.d(t,{t:function(){return c}});var r=n(2105),i=n(33987),s=n(28580),o=n(62052);let a=(0,o.hu)("P2P: NKN",o.$5.p2pNetworks.nkn);class c extends i.l{async waitForReady(){return this.loadingPromise.promise}async broadcastPacket(e){if(this.nknClient){a.debug("Sending message",e);try{return await this.nknClient.publish(this.nknTopic,JSON.stringify(e),{txPool:!0}),!0}catch(e){a.error("Error sending message",e),this.transmissionErrorCount++,this.transmissionErrorCount>this.p2pNKNSettings.maxSendErrorsBeforeRestart&&this.errorHandlers.forEach(t=>t(e,!0))}}return!1}listenForPacket(e){return this.packetReceivedCallbacks.push(e),()=>{this.packetReceivedCallbacks=this.packetReceivedCallbacks.filter(t=>t!==e)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async gracefulShutdown(){this.renewalIntervalId&&clearInterval(this.renewalIntervalId),await this.nknClient.close()}constructor(e,t,n){super(e,t),this.p2pNKNSettings=n,this.loadingPromise=new s.C,this.transmissionErrorCount=0,this.packetReceivedCallbacks=[],this.errorHandlers=[],this.nknTopic=t.nknTopic;let i=new r.Wallet({password:t.nknWalletPassword});this.nknClient=new r.MultiClient({identifier:e,seed:i.getSeed()}),a.debug("NKN client created with id ".concat(e)),this.nknClient.onMessage(e=>{let{src:t,payload:n}=e,r=JSON.parse(n);r.receivedTime=new Date,r.deliveredThrough="nkn",this.packetReceivedCallbacks.forEach(e=>{e(r,{nknAddress:t})})}),this.nknClient.onConnect(e=>{let{addr:t}=e;a.debug("Connected"),this.loadingPromise.resolve(!0)}),this.nknClient.onConnectFailed(()=>{a.debug("Connection failed"),this.loadingPromise.resolve(!1),this.errorHandlers.forEach(e=>{e(Error("Connection failed"),!0)})}),i.subscribe(this.nknTopic,1e3,this.synthientId,"").then(e=>{a.debug("Subscribed to events in tx ".concat(e)),this.renewalIntervalId=setInterval(async()=>{await i.subscribe(this.nknTopic,1e3,this.synthientId,"").then(e=>{a.debug("Renewed subscription in tx ".concat(e))})},198e5)})}}},30701:function(e,t,n){"use strict";function r(e){return i.PEWPEW.topic=e.topic,i.NKN.topic=e.topic,i.TRYSTERO.appId=e.topic,i.TRYSTERO.topic=e.topic+"T",i.NKN.maxSendErrorsBeforeRestart=e.maxTransmissionErrorsBeforeRestart,i.TRYSTERO.maxTransmissionErrorsBeforeRestart=e.maxTransmissionErrorsBeforeRestart,i}n.d(t,{e:function(){return r}});let i={PEWPEW:{topic:"rakis0",bootFixedDelayMs:1e3,bootstrapPeers:["https://gun-manhattan.herokuapp.com/gun","https://peer.wallie.io/gun","https://plankton-app-6qfp3.ondigitalocean.app/"]},NKN:{maxSendErrorsBeforeRestart:5,topic:"rakis0"},TRYSTERO:{maxTransmissionErrorsBeforeRestart:5,appId:"rakis",topic:"rakis0",relayRedundancy:4,rtcConfig:{iceServers:[{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:a.relay.metered.ca:80",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:80?transport=tcp",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:443",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"},{urls:"turn:a.relay.metered.ca:443?transport=tcp",username:"fd396a3275680a085c4d66cd",credential:"hFQmauZyx0Mv0bCK"}]}}}},33987:function(e,t,n){"use strict";n.d(t,{l:function(){return r}});class r{constructor(e,t){this.synthientId=e,this.options=t}}},37678:function(e,t,n){"use strict";n.d(t,{p:function(){return d}});var r=n(24364),i=n.n(r),s=n(33987),o=n(28580),a=n(62052);let c=(0,a.hu)("P2P: PewPewDB",a.$5.p2pNetworks.pewpewdb);class d extends s.l{async waitForReady(){return await this.loadingPromise.promise,!0}async broadcastPacket(e){let t={...e,packet:JSON.stringify(e.packet)};return c.debug("Transmitting packet with gun",t),new Promise(e=>{this.gun.get(this.gunTopic).put(t,t=>t.err?(c.error("Error sending gun message: ",t.err),e(!1)):e(!0))})}listenForPacket(e){let t=this.packetHandlerIdCouinter++;return this.packetHandlerIds.push(t),this.gun.get(this.gunTopic).on((n,r,i,s)=>{if(!this.packetHandlerIds.includes(t)){s.off();return}c.debug("Received packet",n),e({...n,receivedTime:new Date,deliveredThrough:"gun",packet:JSON.parse(n.packet)},{})}),()=>{this.packetHandlerIds=this.packetHandlerIds.filter(e=>e!==t)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}gracefulShutdown(){}constructor(e,t){super(e,t),this.packetHandlerIds=[],this.packetHandlerIdCouinter=0,this.loadingPromise=new o.C,this.errorHandlers=[],this.gunTopic=t.gunTopic,this.gun=i()({peers:t.gunPeers,localStorage:!1}),setTimeout(()=>{this.loadingPromise.resolve()},t.startupDelayMs)}}},31406:function(e,t,n){"use strict";n.d(t,{f:function(){return c}});var r=n(18210),i=n(97481),s=n(33987),o=n(28580),a=n(62052);class c extends s.l{async waitForReady(){return this.loadingPromise.promise}async broadcastPacket(e){if(this.trysteroRoom)try{let[t]=this.trysteroRoom.makeAction(this.options.trysteroTopic);return t(e),!0}catch(e){this.transmissionErrorCount++,this.logger.error("Error sending message",e),this.errorHandlers.forEach(t=>t(e,this.transmissionErrorCount>this.trysteroP2PSettings.maxTransmissionErrorsBeforeRestart))}return!1}listenForPacket(e){return this.packetReceivedCallbacks.push(e),()=>{this.packetReceivedCallbacks=this.packetReceivedCallbacks.filter(t=>t!==e)}}registerErrorHandler(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async gracefulShutdown(){this.trysteroRoom.leave()}constructor(e,t,n){super(e,t),this.trysteroP2PSettings=n,this.loadingPromise=new o.C,this.transmissionErrorCount=0,this.packetReceivedCallbacks=[],this.errorHandlers=[],this.logger=(0,a.hu)("P2P: ".concat(t.trysteroType," (trystero)"),a.$5.p2pNetworks[t.trysteroType]);try{this.trysteroRoom="nostr"===this.options.trysteroType?(0,i.Ls)({appId:this.options.trysteroAppId,relayRedundancy:this.options.relayRedundancy,rtcConfig:this.options.rtcConfig},this.options.trysteroTopic):(0,r.Ls)({appId:this.options.trysteroAppId,relayRedundancy:this.options.relayRedundancy,rtcConfig:this.options.rtcConfig},this.options.trysteroTopic),this.logger.debug("Trystero client created",this.trysteroRoom);let[,e]=this.trysteroRoom.makeAction(this.options.trysteroTopic);e((e,t)=>{let n={...e,receivedTime:new Date,deliveredThrough:this.options.trysteroType};this.packetReceivedCallbacks.forEach(e=>{e(n,{peerId:t})})}),this.loadingPromise.resolve(!0)}catch(e){throw this.logger.error("Error setting up Trystero",e),this.loadingPromise.resolve(!1),this.errorHandlers.forEach(t=>t(e,!0)),e}}}},89028:function(e,t,n){"use strict";n.d(t,{ri:function(){return s},wK:function(){return u},zQ:function(){return o}});let r="rakisSettings",i=null;function s(){let e={};try{window.localStorage&&window.localStorage&&window.localStorage.getItem(r)&&(i=e=JSON.parse(window.localStorage.getItem(r)))}catch(t){console.error("Error loading settings from localStorage, loading saved settings if we have them",i),i&&(console.log("Using last loaded settings - ",i),e=i)}return e.packetDBSettings={...c,...e.packetDBSettings},e.p2pSettings={...d,...e.p2pSettings},e.chainConnectionSettings={...l,...e.chainConnectionSettings},e.loggerSettings={...h,...e.loggerSettings},e.theDomainSettings={...p,...e.theDomainSettings},e.quorumSettings={...g,...e.quorumSettings},e.llmEngineSettings={...f,...e.llmEngineSettings},e.workerSettings={...a,...e.workerSettings},e}function o(e){{let t={};try{t=JSON.parse(window.localStorage.getItem(r))}catch(e){console.error("Error parsing existing settings",e)}window.localStorage.setItem(r,JSON.stringify({...t,...e}))}}let a={initialLLMWorkers:[{modelName:"gemma-2b-it-q4f16_1",count:2}],initialEmbeddingWorkers:[{modelName:"nomic-ai/nomic-embed-text-v1.5",count:1}]},c={maxReceivedPacketQueueSize:100,receivePacketQueueDebounceMs:100,peerHeartLimit:20,peerCommunicationCount:40,maxPacketDBSize:5e3},d={topic:"rakis1",maxTransmissionErrorsBeforeRestart:5},l={dAppName:"Rakis",url:"https://rakis.ai"},u="encSynthientId",h={maxLogsInMemory:1e3,loggersToSkipForInMemoryLog:["P2P: NKN","P2P: PewPewDB","P2P: nostr (trystero)","P2P: torrent (trystero)","PacketDB"],newLogEventDebounceMs:150},p={enabledP2PNetworks:["nostr","gun","torrent","nkn"],waitForP2PBootupMs:5e3,inferencePollingIntervalMs:5e3,inferenceRequestQueueDebounceMs:1e3,embeddingsQueueDebounceMs:100,requestSimilarityTimeWindowMs:2e3},g={quorumRevealRequestIssueTimeoutMs:1e4,quorumRevealTimeoutMs:2e4,quorumConsensusWindowMs:3e4,bEmbeddingThreshold:0},f={engineLogLimit:2e3,debounceLoadingProgressEventMs:50}},28580:function(e,t,n){"use strict";n.d(t,{C:function(){return r}});class r{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}},62052:function(e,t,n){"use strict";n.d(t,{$5:function(){return a},HQ:function(){return d},hu:function(){return l}});var r=n(36393),i=n(22170),s=n.n(i);let o=(0,n(89028).ri)().loggerSettings,a={llmEngine:{main:"background: #f0f8ff; color: #1e90ff; font-weight: bold;",worker:"background: #f0f8ff; color: #87cefa;"},embeddingEngine:{main:"background: #f0fff0; color: #2e8b57; font-weight: bold;",worker:"background: #f0fff0; color: #90ee90;"},theDomain:"background: #fff0f5; color: #ff69b4; font-weight: bold;",consensusCore:"background: #f5f5f5; color: #4682b4; font-weight: bold;",databases:{inferenceDB:"background: #f5f5f5; color: #a9a9a9;",packetDB:"background: #f5f5f5; color: #708090;",peerDB:"background: #f5f5f5; color: #778899;",quorumDB:"background: #f5f5f5; color: #696969;"},p2pNetworks:{nkn:"background: #fffacd; color: #ffa500;",torrent:"background: #fffacd; color: #ff8c00;",pewpewdb:"background: #fffacd; color: #ff7f50;",nostr:"background: #fffacd; color: #ff6347;"}},c=0;class d extends r.Z{static getInstance(){return d.instance||(d.instance=new d),d.instance}static addLog(e,t,n){d.getInstance().logs.push({at:new Date,logger:e,type:t,id:c++,message:n}),d.getInstance().logs=d.getInstance().logs.slice(-o.maxLogsInMemory).sort((e,t)=>t.at.getTime()-e.at.getTime()),d.getInstance().emitNewLogs()}constructor(){super(),this.logs=[],this.emitNewLogs=s()(()=>{this.emit("newLog")},o.newLogEventDebounceMs)}}function l(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!n&&window&&(window.blockedLogLevels=localStorage.getItem("blockedLogLevels")||[],window.blockedLoggers=localStorage.getItem("blockedLoggers")||[]),{trace:function(r){for(var i,s,o,a,c=arguments.length,d=Array(c>1?c-1:0),l=1;l1?l-1:0),h=1;h1?l-1:0),h=1;h1?l-1:0),h=1;h1?l-1:0),h=1;he.toString(16).padStart(2,"0")).join("")}async function u(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("")}function h(e,t,n){let r=JSON.stringify(n),s=new Uint8Array(new TextEncoder().encode(r));return i.T(t,s,e)}function p(e,t){let n=JSON.stringify(t),r=new Uint8Array(new TextEncoder().encode(n)),s=i.Xx(r,e);return i.UG.bytesToHex(s)}async function g(e,t){console.time("Encrypting info for storage");let n=new TextEncoder,i=n.encode(t),s=crypto.getRandomValues(new Uint8Array(16)),o=crypto.getRandomValues(new Uint8Array(12)),a=await crypto.subtle.importKey("raw",i,{name:"PBKDF2"},!1,["deriveKey"]),c=await crypto.subtle.deriveKey({name:"PBKDF2",salt:s,iterations:1e5,hash:"SHA-256"},a,{name:"AES-GCM",length:256},!1,["encrypt"]),d=n.encode(JSON.stringify(e)),l=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},c,d),u=r.Buffer.from(l).toString("base64"),h=r.Buffer.from(o).toString("hex"),p=r.Buffer.from(s).toString("hex");return console.timeEnd("Encrypting info for storage"),"".concat(u,".").concat(h,".").concat(p)}async function f(e,t){console.time("Decrypting info from storage");let[n,i,s]=e.split("."),o=r.Buffer.from(n,"base64"),a=r.Buffer.from(i,"hex"),c=r.Buffer.from(s,"hex"),d=new TextEncoder().encode(t),l=await crypto.subtle.importKey("raw",d,{name:"PBKDF2"},!1,["deriveKey"]),u=await crypto.subtle.deriveKey({name:"PBKDF2",salt:c,iterations:1e5,hash:"SHA-256"},l,{name:"AES-GCM",length:256},!1,["decrypt"]),h=await crypto.subtle.decrypt({name:"AES-GCM",iv:a},u,o),p=new TextDecoder().decode(h);return console.timeEnd("Decrypting info from storage"),JSON.parse(p)}i.UG.sha512Sync=function(){for(var e=arguments.length,t=Array(e),n=0;n0?"-":"+").concat(r,":").concat(i)}function i(){return"undefined"==typeof navigator||"undefined"==typeof screen?"not-client":window.disableAnalytics?"disabled-analytics":Object.values({userAgent:navigator.userAgent,browserVersion:navigator.appVersion,platform:navigator.platform,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height,colorDepth:screen.colorDepth,timezoneOffset:new Date().getTimezoneOffset(),cpuCores:navigator.hardwareConcurrency,touchSupport:"ontouchstart"in window}).map(e=>"".concat(e)).join("#")}async function s(e){return new Promise(t=>{setTimeout(()=>t("timeout"),e)})}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r