import{s as D,n as y,d as f,z as $,A as E,i as S,k as u,l as I,B as b,a as P,C as z,b as A,c as p,h as x,g as O,e as d,o as B,D as L,p as T,f as N,q as k,j as q,t as w}from"./Cl1o3nVP.js";import{S as j,i as V,d as M,t as F,a as G,m as H,c as J,b as K}from"./nb9JOxVX.js";import{b as Q}from"./B7v8dEzq.js";function R(c){let e,t,a,r="mainnet",n,h="devnet",s,_="testnet",o,l="custom",i,g;return{c(){e=d("div"),t=d("select"),a=d("option"),a.textContent=r,n=d("option"),n.textContent=h,s=d("option"),s.textContent=_,o=d("option"),o.textContent=l,this.h()},l(m){e=p(m,"DIV",{style:!0});var v=x(e);t=p(v,"SELECT",{"nets-choices":!0,class:!0});var C=x(t);a=p(C,"OPTION",{"data-svelte-h":!0}),O(a)!=="svelte-1sx3bry"&&(a.textContent=r),n=p(C,"OPTION",{"data-svelte-h":!0}),O(n)!=="svelte-3ac022"&&(n.textContent=h),s=p(C,"OPTION",{"data-svelte-h":!0}),O(s)!=="svelte-14n6jr0"&&(s.textContent=_),o=p(C,"OPTION",{"data-svelte-h":!0}),O(o)!=="svelte-28xsy2"&&(o.textContent=l),C.forEach(f),v.forEach(f),this.h()},h(){a.__value="mainnet",b(a,a.__value),n.__value="devnet",b(n,n.__value),s.__value="testnet",b(s,s.__value),o.__value="custom",b(o,o.__value),P(t,"nets-choices",""),P(t,"class","select"),c[0]===void 0&&z(()=>c[3].call(t)),A(e,"max-width","200px")},m(m,v){S(m,e,v),u(e,t),u(t,a),u(t,n),u(t,s),u(t,o),E(t,c[0],!0),i||(g=[I(t,"change",c[3]),I(t,"change",c[1])],i=!0)},p(m,[v]){v&1&&E(t,m[0])},i:y,o:y,d(m){m&&f(e),i=!1,$(g)}}}function U(c,e,t){let{on_change:a}=e;const r={mainnet:{name:"mainnet",path:"https://api.mainnet.aptoslabs.com/v1"},testnet:{name:"testnet",path:"https://api.testnet.aptoslabs.com/v1"},devnet:{name:"devnet",path:"https://api.devnet.aptoslabs.com/v1"},custom:{name:"custom",path:""}};let{net_name:n="mainnet"}=e;const h=async _=>{console.log("net_name",n);const o=r[n];if(n==="custom"){a({net:o});return}const{enhanced:l}=await Q({net_path:o.path}),{chain_id:i}=l;a({net:o,chain_id:i})};B(()=>{h()});function s(){n=L(this),t(0,n)}return c.$$set=_=>{"on_change"in _&&t(2,a=_.on_change),"net_name"in _&&t(0,n=_.net_name)},[n,h,a,s]}class W extends j{constructor(e){super(),V(this,e,U,R,D,{on_change:2,net_name:0})}}function X(c){let e,t,a,r,n,h,s,_,o;return t=new W({props:{on_change:c[2]}}),{c(){e=d("div"),K(t.$$.fragment),a=q(),r=d("p"),n=w(c[0]),h=q(),s=d("p"),_=w(c[1])},l(l){e=p(l,"DIV",{});var i=x(e);J(t.$$.fragment,i),a=N(i),r=p(i,"P",{});var g=x(r);n=k(g,c[0]),g.forEach(f),h=N(i),s=p(i,"P",{});var m=x(s);_=k(m,c[1]),m.forEach(f),i.forEach(f)},m(l,i){S(l,e,i),H(t,e,null),u(e,a),u(e,r),u(r,n),u(e,h),u(e,s),u(s,_),o=!0},p(l,[i]){(!o||i&1)&&T(n,l[0]),(!o||i&2)&&T(_,l[1])},i(l){o||(G(t.$$.fragment,l),o=!0)},o(l){F(t.$$.fragment,l),o=!1},d(l){l&&f(e),M(t)}}}function Y(c,e,t){let a="",r="";return[a,r,({net:h,chain_id:s})=>{console.log("on_change",{net:h,_chain_id:s}),t(0,a=h.path),t(1,r=s)}]}class nt extends j{constructor(e){super(),V(this,e,Y,X,D,{})}}export{nt as default};
//# sourceMappingURL=BsPNxL8h.js.map
