1import{a1 as r}from"./vendor-vue-DO5-hTFl.js";const l=r(null),e={mamontId:null,pollTimer:null,visibilityHandler:null,channelName:null};function a(n){l.value=n,typeof window<"u"&&window.dispatchEvent(new CustomEvent("lk:balance-update",{detail:{balance:n}}))}async function u(){try{const n=await fetch("/api/predict/me/balance",{headers:{Accept:"application/json"},credentials:"same-origin"});if(!n.ok)return null;const i=await n.json();return typeof i.balance=="number"?i.balance:null}catch{return null}}async function c(){const n=await u();n!==null&&n!==l.value&&a(n)}async function f(){await c()}function m(n){if(typeof n!="number"||!Number.isFinite(n)||n===0)return;const i=l.value;if(i===null)return;const t=Math.max(0,i+n);a(t)}function v(n,i){if(e.mamontId===n){i!==l.value&&a(i);return}if(d(),e.mamontId=n,e.channelName=`mamont.${n}`,a(i),typeof window<"u"&&window.Echo)try{window.Echo.private(e.channelName).listen(".balance.updated",t=>{const o=t?.balance;typeof o=="number"&&a(o)})}catch{}typeof window<"u"&&(e.pollTimer=window.setInterval(()=>{c()},3e4),e.visibilityHandler=()=>{document.visibilityState==="visible"&&c()},document.addEventListener("visibilitychange",e.visibilityHandler))}function d(){if(typeof window<"u"){if(e.channelName&&window.Echo)try{window.Echo.private(e.channelName).stopListening(".balance.updated"),window.Echo.leave(e.channelName)}catch{}e.pollTimer!==null&&(window.clearInterval(e.pollTimer),e.pollTimer=null),e.visibilityHandler!==null&&(document.removeEventListener("visibilitychange",e.visibilityHandler),e.visibilityHandler=null)}e.mamontId=null,e.channelName=null,l.value=null}export{m as a,v as c,d,l,f as r};
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.