1import{writable}from'svelte/store'; 2import{createClients,LabelerClient}from'./client.js'; 3 4// global labeler instance using real ATProto labeler
5exportconstlabeler=newLabelerClient(); 6 7// network of PDS clients (populated on init)
8exportletnetwork={}; 910// initialize all PDS clients
11exportasyncfunctioninitNetwork(){12network=awaitcreateClients();13}1415// get PDS by handle
16exportfunctiongetPds(handle){17returnnetwork[handle];18}1920// get PDS by DID
21exportfunctiongetPdsByDid(did){22returnObject.values(network).find((p)=>p.did===did);23}2425// event log entries
26exportconstlogs=writable([{msg:'connecting to PDS...',cls:'dim'}]);2728exportfunctionlog(msg,cls=''){29logs.update((l)=>[...l,{msg,cls}]);30}3132// trigger reactivity after mutations
33exportconsttick=writable(0);34exportfunctionrefresh(){35tick.update((n)=>n+1);36}3738// ready state
39exportconstready=writable(false);