zigbee2mqtt-windfront
Version:
[](https://npmjs.org/package/zigbee2mqtt-windfront) [](https://github.com/Nerivec/zigbee2mqtt-windf
3 lines (2 loc) • 5 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-CO29F09S.js","./index-C9teBVht.js","./envs-CSqIi4cL.js","./index-B0IjLmAW.css","./useSearch-DWt9mTiA.js","./DeviceImage-DGFxocTf.js","./index-BdHs_BcQ.js","./DebouncedInput-CB_1_bR4.js","./PowerSource-DDICmrah.js","./snakeCase-DMy2ZOvg.js","./_createCompounder-JFMc-LTw.js","./isArray-atDF8gHr.js","./index-Bs7zcW7e.js","./Lqi-BUi3mqI9.js","./index-Dm1jDR4v.js","./DisplayValue-CmowE72l.js","./RawNetworkMap-COMKS7ES.js","./merge-qpjScXxg.js","./isObject--vsEa_js.js"])))=>i.map(i=>d[i]);
import{u as M,h as T,i as E,r as n,j as a,N as R,M as L,A as z,l as A,S as F,b as I,a as p,k as h,s as x,J as f,c as D,F as m,K as g,C as O,O as P,p as K,_ as w}from"./index-C9teBVht.js";import{C as V}from"./CheckboxField-ZdCJFDzF.js";import{S as j}from"./SelectField-Cjwi2kGD.js";import"./envs-CSqIi4cL.js";const Y=n.lazy(async()=>await w(()=>import("./RawNetworkData-CO29F09S.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url)),q=n.lazy(async()=>await w(()=>import("./RawNetworkMap-COMKS7ES.js"),__vite__mapDeps([16,1,2,3,17,11,18,6,12]),import.meta.url)),B=n.memo(({sourceIdx:s})=>{const{t}=I(["network","common"]),r=p(h(e=>e.networkMapIsLoading[s])),l=p(h(e=>e.networkMap[s])),i=p(e=>e.setNetworkMap),o=p(e=>e.setNetworkMapIsLoading),[c,v]=n.useState("raw"),[d,k]=n.useState(!1),[u,N]=n.useState(x.get(f,"data")),_=n.useCallback(e=>{e.target.value&&v(e.target.value)},[]),y=n.useCallback(e=>{e.target.value&&(x.set(f,e.target.value),N(e.target.value))},[]),b=n.useCallback(e=>{k(e.target.checked)},[]),C=n.useCallback(async()=>{i(s,void 0),o(s),await D(s,"bridge/request/networkmap",{type:c,routes:d})},[s,c,d,i,o]),S=n.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(l)switch(l.type){case"raw":return u==="data"?a.jsx(Y,{sourceIdx:s,map:l.value}):a.jsx(q,{sourceIdx:s,map:l.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(m,{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:l.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(m,{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:l.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,l,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:_,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(V,{name:"enable_routes",label:t(e=>e.enable_routes),checked:d,onChange:b}),a.jsx("fieldset",{className:"fieldset self-end",children:a.jsxs(O,{className:"btn btn-outline btn-primary ms-3 me-6",onClick:C,title:t(l?e=>e.reload:e=>e.load),disabled:r,children:[l?a.jsx(m,{icon:P}):a.jsx(m,{icon:K}),t(l?e=>e.reload:e=>e.load)]})}),c==="raw"&&a.jsxs(j,{name:"display_type",label:t(e=>e.display_type),value:u,onChange:y,children:[a.jsx("option",{value:"data",children:t(e=>e.data)}),a.jsx("option",{value:"map",children:t(e=>e.map)})]})]}),S]})}),G=({isActive:s})=>s?"menu-active":void 0;function H(){const s=M(),{sourceIdx:t}=T(),[r,l]=E(t);return n.useEffect(()=>{(!t||!l)&&s("/network/0",{replace:!0})},[t,l,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(A,{to:`/network/${o}`,className:G,children:a.jsx(F,{idx:o,alwaysShowName:!0})})},i))})}),a.jsx(B,{sourceIdx:r},t)]})}export{H as default};