import{i as w,_ as k,a as I,p as T,t as $,l as v,e as K}from"./parse.E7PnpR0O.js";import{i as x,a as O,g as A}from"./_Uint8Array.z7pli0Iv.js";import{_ as E,a as C}from"./_isIndex.B0qwFrvp.js";import{l as D}from"./index.BfGYMDwM.js";import{r as F}from"./Ledger_Info.API.JyzJYuRQ.js";var M=x,N=w,R=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/;function U(t,e){if(M(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||N(t)?!0:q.test(t)||!R.test(t)||e!=null&&t in Object(e)}var Y=U,B=k;function G(t){return t==null?"":B(t)}var H=G,J=x,L=Y,Q=I,W=H;function X(t,e){return J(t)?t:L(t,e)?[t]:Q(W(t))}var Z=X,z=w,V=1/0;function j(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-V?"-0":e}var tt=j,et=E,rt=Z,nt=C,b=O,ot=tt;function st(t,e,r,i){if(!b(t))return t;e=rt(e,t);for(var a=-1,p=e.length,d=p-1,_=t;_!=null&&++a<p;){var s=ot(e[a]),n=r;if(s==="__proto__"||s==="constructor"||s==="prototype")return t;if(a!=d){var o=_[s];n=i?i(o,s,_):void 0,n===void 0&&(n=b(o)?o:nt(e[a+1])?[]:{})}et(_,s,n),_=_[s]}return t}var it=st,at=it;function _t(t,e,r){return t==null?t:at(t,e,r)}var ct=_t;const lt=A(ct),ft=({freight:t})=>{let e={},r=[],i=0;return e=((n,o)=>{const u={get(l,f,g){try{return new Proxy(l[f],u)}catch{return Reflect.get(l,f,g)}},set(l,f,g,y){const P=l[f],S=Reflect.set(l,f,g,y);return S&&P!==g&&o(),S}};return new Proxy(n,u)})(t,()=>{i+=1;for(let n=0;n<r.length;n++)r[n]({freight:e})}),{monitor:n=>(r.push(n),{stop(){for(let o=0;o<r.length;o++)if(r[o]===n){r.splice(o,1);return}console.error("Stopping monitoring was not possible.")}}),monitors:r,enhance:(n,o)=>{lt(e,n,o)},freight:e,retrieve_change_count:()=>i,stop:()=>{r=[],e.__proto__=Object.prototype,e={},t={}}}};let h=0;const gt=()=>D({wait:2e3,wait_for_response:"yes",action:async()=>{const t=pt(),e=t.net_path;if((typeof e=="string"&&e.length>=1)!==!0){console.info(`There's not a "net path" for the ledger loop.`);return}h+=1;const i=h;try{const{enhanced:a}=await F({net_path:e});h==i&&(t.net_connected="yes")}catch{t.net_connected="no"}}});let m;const c={},St=()=>{let t="https://api.mainnet.aptoslabs.com/v1",e="mainnet",r="business";typeof localStorage.net_name=="string"&&(e=localStorage.net_name),typeof localStorage.net_path=="string"&&(t=localStorage.net_path),typeof localStorage.mode=="string"&&(r=localStorage.mode),c[1]=ft({freight:{mode:r,origin_address:"http://localhost:22000",net_path:t,net_name:e,net_connected:"no",layout:{leaf_styles:T({margin:"0 auto","max-width":"64rem",width:"100%"})},aptos:new $(new v({fullnode:t,network:K.CUSTOM}))}}),console.log(c[1].freight),m=gt(),m.play()},pt=()=>c[1].freight,bt=()=>{m.stop(),delete c[1]},wt=()=>c[1],xt=t=>c[1].monitor(({freight:e})=>{console.info("Versies Truck_Monitor",{freight:e}),t(e)});export{Z as _,tt as a,pt as b,wt as c,ft as d,bt as g,St as l,xt as m};
//# sourceMappingURL=Trucks.CNbPi8d_.js.map
