const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-B1pJ3MXI.js","./index-DtyjNqrf.js","./envs-DFlyG_dH.js","./index-EwioJBcA.css","./DeviceImage-D-FjKeE6.js","./index-Q3KOJDn9.js","./DebouncedInput-DnWGzIEH.js","./PowerSource-DgFKG_xU.js","./snakeCase-DmoQhYQA.js","./_createCompounder-CbLsIfEE.js","./index-BN7eS8uY.js","./Lqi-CoNVuBvb.js","./DisplayValue-B5Rw3jLu.js","./RawNetworkMap-Cvt65_FK.js"])))=>i.map(i=>d[i]);
import{C,r as s,W as E,b as R,a as m,s as d,E as h,G as M,I as T,j as e,F as n,J as x,B as z,K as I,i as S,_ as g}from"./index-DtyjNqrf.js";import{C as A}from"./CheckboxField-DKhAwA85.js";import{S as f}from"./SelectField-DfdnxD7O.js";import"./envs-DFlyG_dH.js";const D=s.lazy(async()=>await g(()=>import("./RawNetworkData-B1pJ3MXI.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url)),F=s.lazy(async()=>await g(()=>import("./RawNetworkMap-Cvt65_FK.js"),__vite__mapDeps([13,1,2,3,10]),import.meta.url));function q(){const o=C(),{sendMessage:u}=s.useContext(E),{t:a}=R(["network","common"]),i=m(t=>t.networkMapIsLoading),r=m(t=>t.networkMap),[l,w]=s.useState("raw"),[c,j]=s.useState(!1),[p,k]=s.useState(d.get(h,"data")),v=s.useCallback(t=>{t.target.value&&w(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&(d.set(h,t.target.value),k(t.target.value))},[]),b=s.useCallback(t=>{j(t.target.checked)},[]),_=s.useCallback(async()=>{o(M(void 0)),o(T()),await u("bridge/request/networkmap",{type:l,routes:c})},[l,c,o,u]),N=s.useMemo(()=>{if(i)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:a("loading")})]});if(r)switch(r.type){case"raw":return p==="data"?e.jsx(D,{map:r.value}):e.jsx(F,{map:r.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]})}return null},[r,i,p,a]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-2",children:[e.jsxs(f,{name:"type",label:a("type"),value:l,onChange:v,children:[e.jsx("option",{value:"raw",children:a("raw")}),e.jsx("option",{value:"graphviz",children:a("graphviz")}),e.jsx("option",{value:"plantuml",children:a("plantuml")})]}),e.jsx(A,{name:"enable_routes",label:a("enable_routes"),checked:c,onChange:b}),e.jsx(z,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:_,title:a(r?"reload":"load"),disabled:i,children:r?e.jsx(n,{icon:I}):e.jsx(n,{icon:S})}),l==="raw"&&e.jsxs(f,{name:"display_type",label:a("display_type"),value:p,onChange:y,children:[e.jsx("option",{value:"data",children:a("data")}),e.jsx("option",{value:"map",children:a("map")})]})]}),N]})}export{q as default};
