1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9057,5090],{75090:function(e,t,l){l.d(t,{kZ:function(){return getSyncedNow},oR:function(){return getKioskRelayStatus}});var n=l(67294),o=l(9473),s=l(11163),r=l(22052);let a="ws://localhost:8585",i={ws:null,timer:null,refs:0,url:a,identity:null,lastSentIdentity:null,peers:null,lastSentPeers:null,dispatch:null,refreshTimeout:null,clockOffsetMs:0,lastHeartbeatAt:0,heartbeat:null,identityAckAt:0,peersAck:null,peersAckAt:0,lastCloudMessageAt:0,lastCloudAction:""},getSyncedNow=()=>Date.now()-i.lastHeartbeatAt<1e4?Date.now()+i.clockOffsetMs:Date.now(),getKioskRelayStatus=()=>({url:i.url,connected:!!(i.ws&&i.ws.readyState===WebSocket.OPEN),identitySent:!!i.lastSentIdentity,identityAcked:i.identityAckAt>0,peersConfigured:i.peers||[],peersSent:!!i.lastSentPeers,peersAck:i.peersAck,heartbeat:i.heartbeat,heartbeatFresh:Date.now()-i.lastHeartbeatAt<1e4,clockOffsetMs:i.clockOffsetMs,syncedNow:getSyncedNow(),lastCloudAction:i.lastCloudAction,lastCloudMessageAt:i.lastCloudMessageAt});window.kioskRelayStatus=getKioskRelayStatus;let sendIdentity=()=>{let{ws:e,identity:t}=i;if(!e||e.readyState!==WebSocket.OPEN||!t)return;let l=JSON.stringify(t);l!==i.lastSentIdentity&&(e.send(l),i.lastSentIdentity=l,console.log("[KioskRelay] SET_IDENTITY sent",{...t.terminal,token:t.token?"present":"missing"}))},sendPeers=()=>{let{ws:e,peers:t}=i;if(!e||e.readyState!==WebSocket.OPEN||!t||0===t.length)return;let l=JSON.stringify({type:"SET_HEARTBEAT_PEERS",peers:t});l!==i.lastSentPeers&&(e.send(l),i.lastSentPeers=l,console.log("[KioskRelay] SET_HEARTBEAT_PEERS sent",t))},handleCloudMessage=e=>{let t=e.object;if("string"==typeof t)try{t=JSON.parse(t)}catch(e){}switch((e.action||"").toUpperCase()){case"REFRESH":if(i.refreshTimeout)return;i.refreshTimeout=setTimeout(()=>window.location.reload(),500+2500*Math.random());break;case"UPDATEMENUITEMLOCATION":(null==t?void 0:t.menuItemId)&&i.dispatch&&i.dispatch({type:"UPDATE_MENU_ITEM_LOCATIONS",menuItemLocations:[{...t,menuItemId:t.menuItemId.toLowerCase()}]})}},connect=()=>{if(0!==i.refs&&(!i.ws||i.ws.readyState!==WebSocket.OPEN&&i.ws.readyState!==WebSocket.CONNECTING))try{let e=new WebSocket(i.url);i.ws=e,e.onopen=()=>{i.lastSentIdentity=null,i.lastSentPeers=null,sendIdentity(),sendPeers()},e.onmessage=e=>{var t,l;let n;try{n=JSON.parse(e.data)}catch(e){return}if((null==n?void 0:n.type)==="CLOUD_MESSAGE"){i.lastCloudMessageAt=Date.now(),i.lastCloudAction=n.action||"",handleCloudMessage(n);return}if((null==n?void 0:n.type)==="HEARTBEAT"){"number"==typeof n.epochMs&&"number"==typeof n.localMs&&(i.clockOffsetMs=n.epochMs-n.localMs,i.lastHeartbeatAt=Date.now());let e=i.heartbeat;e&&e.role===n.role&&e.leaderId===n.leaderId||console.log("[KioskRelay] heartbeat: ".concat(n.role||"?"," (node ").concat(n.nodeId||"?",", leader ").concat(n.leaderId||"?",", offset ").concat(null!==(t=n.offsetMs)&&void 0!==t?t:0,"ms)")),i.heartbeat=n;return}if((null==n?void 0:n.type)==="IDENTITY_ACK"){i.identityAckAt=Date.now();return}if((null==n?void 0:n.type)==="HEARTBEAT_PEERS_ACK"){i.peersAck=n,i.peersAckAt=Date.now(),console.log("[KioskRelay] HEARTBEAT_PEERS_ACK count=".concat(null!==(l=n.count)&&void 0!==l?l:"?"));return}},e.onclose=()=>{i.ws===e&&(i.ws=null)},e.onerror=()=>{try{e.close()}catch(e){}}}catch(e){}};t.ZP=(e,t)=>
1{var l,u;let d=(0,o.v9)(e=>e.usersList.kanvas,r.Z),c=(0,o.v9)(e=>e.usersList.editor,r.Z),y=(0,o.v9)(e=>e.usersList.guestToken,r.Z),f=(0,o.v9)(e=>e.usersList.userData,r.Z),v=(0,o.v9)(e=>e.usersList.locationValues,r.Z),m=(0,o.v9)(e=>e.usersList.selectedConcept,r.Z),S=(0,o.I0)(),I=(0,s.useRouter)(),queryString=e=>"string"==typeof e&&e.trim()?e.trim():void 0,getParam=e=>{var t;let l=queryString(null==I?void 0:null===(t=I.query)||void 0===t?void 0:t[e]);if(l)return l;try{return queryString(new URLSearchParams(window.location.search).get(e)||void 0)}catch(e){return}},A=getParam("terminalId"),p=getParam("terminalName"),E=queryString(e),h=(e=>{if("string"!=typeof e||!e)return!1;try{let t=new URL(e);return("ws:"===t.protocol||"wss:"===t.protocol)&&["localhost","127.0.0.1","[::1]","::1"].includes(t.hostname)}catch(e){return!1}})(E)?E:a,w=(0,n.useMemo)(()=>{let e=Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.trim()&&"0.0.0.0"!==e.trim()).map(e=>e.trim()):[];if(e.length>0)return e;let l=getParam("heartbeatPeers");return l?l.split(",").map(e=>e.trim()).filter(e=>e&&"0.0.0.0"!==e):[]},[Array.isArray(t)?t.join(","):"",null==I?void 0:null===(l=I.query)||void 0===l?void 0:l.heartbeatPeers]),k=!(null==c?void 0:c.boolean),g=(0,n.useMemo)(()=>{var e;let t=(null==v?void 0:v.clientId)||(null==d?void 0:d.clientId),l=null==v?void 0:v.locationId,n=null==f?void 0:f.userId;return y||t||l||A||n?{type:"SET_IDENTITY",token:y||void 0,locationName:(null==v?void 0:v.locationName)||void 0,terminal:{terminalId:A||void 0,clientId:t||void 0,locationId:l||void 0,userId:n||void 0,terminalName:p||(null==d?void 0:null===(e=d.website)||void 0===e?void 0:e.name)||void 0,conceptId:(null==m?void 0:m.conceptId)||void 0}}:null},[y,null==v?void 0:v.clientId,null==v?void 0:v.locationId,null==v?void 0:v.locationName,null==d?void 0:d.clientId,null==d?void 0:null===(u=d.website)||void 0===u?void 0:u.name,null==f?void 0:f.userId,A,p,null==m?void 0:m.conceptId]);(0,n.useEffect)(()=>{if(k)return i.dispatch=S,i.url=h,i.refs+=1,connect(),i.timer||(i.timer=setInterval(connect,5e3)),()=>{if(i.refs-=1,i.refs<=0){if(i.refs=0,clearInterval(i.timer),i.timer=null,clearTimeout(i.refreshTimeout),i.refreshTimeout=null,i.ws){try{i.ws.close()}catch(e){}i.ws=null}i.lastSentIdentity=null}}},[k,h]);let T=g?JSON.stringify(g):null;(0,n.useEffect)(()=>{k&&(i.identity=g,sendIdentity())},[k,T]);let N=w.join(",");(0,n.useEffect)(()=>{k&&0!==w.length&&(i.peers=w,sendPeers())},[k,N])}}}]);
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.