const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-CE5gHR2h.js","./index-DjbVAZHL.js","./envs-CRUy-_iG.js","./index-DeQqyExs.css","./useSearch-BqnvTMUj.js","./DeviceImage-Bsu1Hk6P.js","./index-BzinHeAr.js","./defineProperty-CegpTSss.js","./DebouncedInput-BTa39xKg.js","./PowerSource-DwoxK9gS.js","./snakeCase-Dg4N4ThO.js","./_createCompounder-CI5okWsL.js","./isObjectLike-DlSfHoCn.js","./index-Bs7zcW7e.js","./Lqi-_D0pWzA-.js","./index-RfvTmd0Z.js","./DisplayValue-e_yVQGok.js","./RawNetworkMap-4TnGjjkb.js","./merge-oq9vjEdc.js","./isObject--vsEa_js.js","./extends-CF3RwP-h.js"])))=>i.map(i=>d[i]);
import{dD as E,dE as M,dj as T,dq as l,dm as a,R,J as L,a as z,S as F,a0 as A,dG as D,dB as p,dF as h,dy as x,P as f,dx as I,o as d,aJ as g,B as P,cF as O,b3 as B,aa as w}from"./index-DjbVAZHL.js";import{C as q}from"./CheckboxField-h2bgaDmU.js";import{S as j}from"./SelectField-XDAy-a1R.js";import"./envs-CRUy-_iG.js";const G=l.lazy(async()=>await w(()=>import("./RawNetworkData-CE5gHR2h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)),V=l.lazy(async()=>await w(()=>import("./RawNetworkMap-4TnGjjkb.js"),__vite__mapDeps([17,1,2,3,18,12,19,20,6,13]),import.meta.url)),Y=l.memo(({sourceIdx:s})=>{const{t}=D(["network","common"]),r=p(h(e=>e.networkMapIsLoading[s])),n=p(h(e=>e.networkMap[s])),i=p(e=>e.setNetworkMap),o=p(e=>e.setNetworkMapIsLoading),[c,v]=l.useState("raw"),[m,k]=l.useState(!1),[u,y]=l.useState(x.get(f,"data")),N=l.useCallback(e=>{e.target.value&&v(e.target.value)},[]),_=l.useCallback(e=>{e.target.value&&(x.set(f,e.target.value),y(e.target.value))},[]),b=l.useCallback(e=>{k(e.target.checked)},[]),C=l.useCallback(async()=>{i(s,void 0),o(s),await I(s,"bridge/request/networkmap",{type:c,routes:m})},[s,c,m,i,o]),S=l.useMemo(()=>{if(r)return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:a.jsx("span",{className:"loading loading-infinity loading-xl"})}),a.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:t(e=>e.loading,{ns:"common"})})]});if(n)switch(n.type){case"raw":return u==="data"?a.jsx(G,{sourceIdx:s,map:n.value}):a.jsx(V,{sourceIdx:s,map:n.value});case"graphviz":return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[a.jsx(d,{icon:g,size:"2xl"}),t(e=>e.copy_paste_on),a.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),a.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),a.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:n.value})]});case"plantuml":return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[a.jsx(d,{icon:g,size:"2xl"}),t(e=>e.copy_paste_on),a.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),a.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),a.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:n.value})]})}return a.jsxs("div",{className:"flex flex-col justify-center items-center gap-2",children:[a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_type)}),a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_routes)}),a.jsx("p",{className:"max-w-prose",children:t(e=>e.begin_info_display)})]})},[s,n,r,u,t]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-row flex-wrap justify-center gap-3 mb-2",children:[a.jsxs(j,{name:"type",label:t(e=>e.type),value:c,onChange:N,children:[a.jsx("option",{value:"raw",children:t(e=>e.raw)}),a.jsx("option",{value:"graphviz",children:t(e=>e.graphviz)}),a.jsx("option",{value:"plantuml",children:t(e=>e.plantuml)})]}),a.jsx(q,{name:"enable_routes",label:t(e=>e.enable_routes),checked:m,onChange:b}),a.jsx("fieldset",{className:"fieldset self-end",children:a.jsxs(P,{className:"btn btn-outline btn-primary ms-3 me-6",onClick:C,title:t(n?e=>e.reload:e=>e.load),disabled:r,children:[n?a.jsx(d,{icon:O}):a.jsx(d,{icon:B}),t(n?e=>e.reload:e=>e.load)]})}),c==="raw"&&a.jsxs(j,{name:"display_type",label:t(e=>e.display_type),value:u,onChange:_,children:[a.jsx("option",{value:"data",children:t(e=>e.data)}),a.jsx("option",{value:"map",children:t(e=>e.map)})]})]}),S]})}),J=({isActive:s})=>s?"menu-active":void 0;function H(){const s=E(),{sourceIdx:t}=M(),[r,n]=T(t);return l.useEffect(()=>{(!t||!n)&&s("/network/0",{replace:!0})},[t,n,s]),a.jsxs(a.Fragment,{children:[a.jsx(R,{children:L&&a.jsx("div",{className:"menu menu-horizontal flex-1",children:z.map((i,o)=>a.jsx("li",{children:a.jsx(F,{to:`/network/${o}`,className:J,children:a.jsx(A,{idx:o,alwaysShowName:!0})})},i))})}),a.jsx(Y,{sourceIdx:r},t)]})}export{H as default};
