@nice2dev/ui-iot 1.0.27 β†’ 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +27 -1
  2. package/dist/index.mjs +2462 -750
  3. package/package.json +4 -3
package/dist/index.cjs CHANGED
@@ -1 +1,27 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),I=[{type:"device-list",label:"Device List",icon:"πŸ“‹"},{type:"device-status",label:"Device Status",icon:"🟒"},{type:"telemetry-chart",label:"Telemetry Chart",icon:"πŸ“ˆ"},{type:"gauge",label:"Gauge",icon:"⏱️"},{type:"map",label:"Device Map",icon:"πŸ—ΊοΈ"},{type:"alarms",label:"Alarms",icon:"🚨"},{type:"control-panel",label:"Control Panel",icon:"πŸŽ›οΈ"},{type:"topology",label:"Network Topology",icon:"πŸ”—"},{type:"kpi",label:"KPI Card",icon:"🎯"},{type:"camera-feed",label:"Camera Feed",icon:"πŸ“Ή"}];function R({devices:s=[],widgets:i=[],alarms:a=[],onDeviceSelect:t,onWidgetChange:c,onCommand:n,onAlarmAcknowledge:l,fetchTelemetry:d,className:C=""}){const[u,k]=o.useState(i),[x,v]=o.useState(null),[m,b]=o.useState("dashboard"),[p,N]=o.useState(!1),[j,w]=o.useState(""),h=o.useCallback(r=>{k(_=>{const g=r(_);return c==null||c(g),g})},[c]),y=o.useCallback(r=>{var g;const _={id:crypto.randomUUID(),type:r,title:((g=I.find(M=>M.type===r))==null?void 0:g.label)||r,position:{x:0,y:O(u),width:4,height:3},config:{}};h(M=>[...M,_])},[u,h]),D=o.useCallback(r=>{v(r),t==null||t(r)},[t]),f=o.useCallback(r=>{l==null||l(r)},[l]),B=s.filter(r=>!j||r.name.toLowerCase().includes(j.toLowerCase())||r.type.toLowerCase().includes(j.toLowerCase())),S=a.filter(r=>!r.cleared),P=S.filter(r=>r.severity==="critical"||r.severity==="high");return e.jsxs("div",{className:`nice-iot-dashboard ${C}`,children:[e.jsxs("header",{className:"nice-iot-dashboard__header",children:[e.jsx("h1",{children:"IoT Dashboard"}),e.jsxs("div",{className:"nice-iot-dashboard__stats",children:[e.jsxs("span",{className:"nice-iot-dashboard__stat",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"πŸ“±"}),s.length," Devices"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--online",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"🟒"}),s.filter(r=>r.status==="online").length," Online"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--offline",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"⚫"}),s.filter(r=>r.status==="offline").length," Offline"]}),P.length>0&&e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"🚨"}),P.length," Alarms"]})]}),e.jsxs("nav",{className:"nice-iot-dashboard__nav",children:[e.jsx("button",{className:m==="dashboard"?"active":"",onClick:()=>b("dashboard"),children:"Dashboard"}),e.jsx("button",{className:m==="devices"?"active":"",onClick:()=>b("devices"),children:"Devices"}),e.jsxs("button",{className:m==="alarms"?"active":"",onClick:()=>b("alarms"),children:["Alarms ",S.length>0&&`(${S.length})`]})]}),e.jsx("div",{className:"nice-iot-dashboard__actions",children:m==="dashboard"&&e.jsx("button",{onClick:()=>N(!p),children:p?"βœ“ Done":"✏️ Edit"})})]}),m==="dashboard"&&e.jsxs("div",{className:"nice-iot-dashboard__main",children:[p&&e.jsxs("aside",{className:"nice-iot-dashboard__palette",children:[e.jsx("h4",{children:"Add Widget"}),I.map(r=>e.jsxs("button",{className:"nice-iot-dashboard__palette-item",onClick:()=>y(r.type),children:[e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.label})]},r.type))]}),e.jsxs("div",{className:"nice-iot-dashboard__grid",children:[u.map(r=>e.jsx(q,{widget:r,devices:s,alarms:a,isEditing:p,onCommand:n,onDelete:()=>h(_=>_.filter(g=>g.id!==r.id))},r.id)),u.length===0&&e.jsx("div",{className:"nice-iot-dashboard__empty",children:p?"Add widgets from the palette":"No widgets configured. Click Edit to add widgets."})]})]}),m==="devices"&&e.jsxs("div",{className:"nice-iot-dashboard__devices",children:[e.jsx("div",{className:"nice-iot-dashboard__devices-toolbar",children:e.jsx("input",{type:"search",placeholder:"Search devices...",value:j,onChange:r=>w(r.target.value)})}),e.jsx("div",{className:"nice-iot-dashboard__device-grid",children:B.map(r=>e.jsx(Q,{device:r,isSelected:(x==null?void 0:x.id)===r.id,onSelect:()=>D(r)},r.id))}),x&&e.jsx(W,{device:x,onCommand:n,onClose:()=>v(null)})]}),m==="alarms"&&e.jsx("div",{className:"nice-iot-dashboard__alarms",children:e.jsxs("table",{className:"nice-iot-dashboard__alarm-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Message"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"nice-iot-dashboard__no-alarms",children:"No active alarms"})}):S.map(r=>{const _=s.find(g=>g.id===r.deviceId);return e.jsxs("tr",{className:`nice-iot-dashboard__alarm-row nice-iot-dashboard__alarm-row--${r.severity}`,children:[e.jsx("td",{children:e.jsx("span",{className:`nice-iot-dashboard__severity nice-iot-dashboard__severity--${r.severity}`,children:r.severity})}),e.jsx("td",{children:(_==null?void 0:_.name)||r.deviceId}),e.jsx("td",{children:r.message}),e.jsx("td",{children:r.timestamp.toLocaleString()}),e.jsx("td",{children:r.acknowledged?"Acknowledged":"Active"}),e.jsx("td",{children:!r.acknowledged&&e.jsx("button",{onClick:()=>f(r.id),children:"Acknowledge"})})]},r.id)})})]})})]})}function O(s){return s.length===0?0:Math.max(...s.map(i=>i.position.y+i.position.height))}function T(s){switch(s){case"online":return"var(--nice-success, #28a745)";case"offline":return"var(--nice-text-secondary, #6c757d)";case"warning":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"maintenance":return"var(--nice-info, #17a2b8)";default:return"var(--nice-text-secondary, #6c757d)"}}function q({widget:s,devices:i,alarms:a,isEditing:t,onCommand:c,onDelete:n}){const l=I.find(d=>d.type===s.type);return e.jsxs("div",{className:`nice-iot-dashboard__widget nice-iot-dashboard__widget--${s.type}`,style:{gridColumn:`span ${s.position.width}`,gridRow:`span ${s.position.height}`},children:[e.jsxs("div",{className:"nice-iot-dashboard__widget-header",children:[e.jsx("span",{className:"nice-iot-dashboard__widget-icon",children:l==null?void 0:l.icon}),e.jsx("span",{className:"nice-iot-dashboard__widget-title",children:s.title}),t&&e.jsx("button",{className:"nice-iot-dashboard__widget-delete",onClick:n,children:"Γ—"})]}),e.jsx("div",{className:"nice-iot-dashboard__widget-content",children:e.jsx(G,{widget:s,devices:i,alarms:a,onCommand:c})})]})}function G({widget:s,devices:i,alarms:a,onCommand:t}){switch(s.type){case"device-list":return e.jsx("div",{className:"nice-iot-dashboard__device-list",children:i.slice(0,10).map(c=>e.jsxs("div",{className:"nice-iot-dashboard__device-list-item",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:T(c.status)}}),e.jsx("span",{children:c.name}),e.jsx("span",{className:"nice-iot-dashboard__device-type",children:c.type})]},c.id))});case"device-status":return e.jsx("div",{className:"nice-iot-dashboard__status-grid",children:["online","offline","warning","error"].map(c=>{const n=i.filter(l=>l.status===c).length;return e.jsxs("div",{className:"nice-iot-dashboard__status-card",children:[e.jsx("span",{className:"nice-iot-dashboard__status-indicator",style:{background:T(c)}}),e.jsx("span",{className:"nice-iot-dashboard__status-count",children:n}),e.jsx("span",{className:"nice-iot-dashboard__status-label",children:c})]},c)})});case"telemetry-chart":return e.jsxs("div",{className:"nice-iot-dashboard__chart-placeholder",children:[e.jsx("span",{children:"πŸ“ˆ"}),e.jsx("span",{children:"Telemetry Chart"}),e.jsx("small",{children:"Configure device and capability"})]});case"gauge":return e.jsx("div",{className:"nice-iot-dashboard__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:"63 126"}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"14",fontWeight:"bold",children:"50%"})]})});case"map":return e.jsxs("div",{className:"nice-iot-dashboard__map-placeholder",children:[e.jsx("span",{children:"πŸ—ΊοΈ"}),e.jsx("span",{children:"Device Map"}),e.jsxs("small",{children:[i.filter(c=>c.location).length," devices with location"]})]});case"alarms":{const c=a.filter(n=>!n.cleared).slice(0,5);return e.jsx("div",{className:"nice-iot-dashboard__alarm-list",children:c.length===0?e.jsx("div",{className:"nice-iot-dashboard__alarm-empty",children:"No active alarms"}):c.map(n=>e.jsxs("div",{className:`nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${n.severity}`,children:[e.jsx("span",{className:"nice-iot-dashboard__alarm-severity",children:n.severity}),e.jsx("span",{className:"nice-iot-dashboard__alarm-message",children:n.message})]},n.id))})}case"control-panel":return e.jsxs("div",{className:"nice-iot-dashboard__control-placeholder",children:[e.jsx("span",{children:"πŸŽ›οΈ"}),e.jsx("span",{children:"Control Panel"}),e.jsx("small",{children:"Configure device controls"})]});case"kpi":return e.jsxs("div",{className:"nice-iot-dashboard__kpi",children:[e.jsx("div",{className:"nice-iot-dashboard__kpi-value",children:i.length}),e.jsx("div",{className:"nice-iot-dashboard__kpi-label",children:"Total Devices"})]});default:return e.jsx("div",{className:"nice-iot-dashboard__widget-placeholder",children:s.type})}}function Q({device:s,isSelected:i,onSelect:a}){return e.jsxs("div",{className:`nice-iot-dashboard__device-card ${i?"nice-iot-dashboard__device-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-iot-dashboard__device-card-header",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:T(s.status)}}),e.jsx("span",{className:"nice-iot-dashboard__device-name",children:s.name})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-card-body",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-info",children:[e.jsxs("span",{children:["Type: ",s.type]}),e.jsxs("span",{children:["Protocol: ",s.protocol]})]}),s.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__device-lastseen",children:["Last seen: ",s.lastSeen.toLocaleString()]}),e.jsxs("div",{className:"nice-iot-dashboard__device-capabilities",children:[s.capabilities.slice(0,3).map(t=>e.jsx("span",{className:"nice-iot-dashboard__capability-badge",children:t.name},t.id)),s.capabilities.length>3&&e.jsxs("span",{className:"nice-iot-dashboard__capability-more",children:["+",s.capabilities.length-3]})]})]})]})}function W({device:s,onCommand:i,onClose:a}){return e.jsxs("aside",{className:"nice-iot-dashboard__device-detail",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-detail-header",children:[e.jsx("h3",{children:s.name}),e.jsx("button",{onClick:a,children:"Γ—"})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-iot-dashboard__status-badge",style:{background:T(s.status)},children:s.status})]}),s.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Last Seen:"}),e.jsx("span",{children:s.lastSeen.toLocaleString()})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connection"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Protocol:"}),e.jsx("span",{children:s.protocol})]}),s.connectionInfo.host&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Host:"}),e.jsxs("span",{children:[s.connectionInfo.host,":",s.connectionInfo.port]})]})]}),s.metadata&&e.jsxs("section",{children:[e.jsx("h4",{children:"Metadata"}),s.metadata.manufacturer&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Manufacturer:"}),e.jsx("span",{children:s.metadata.manufacturer})]}),s.metadata.model&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Model:"}),e.jsx("span",{children:s.metadata.model})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Capabilities"}),e.jsx("div",{className:"nice-iot-dashboard__capabilities-list",children:s.capabilities.map(t=>e.jsxs("div",{className:"nice-iot-dashboard__capability-item",children:[e.jsx("span",{className:"nice-iot-dashboard__capability-name",children:t.name}),e.jsx("span",{className:"nice-iot-dashboard__capability-type",children:t.type}),t.writable&&i&&e.jsx("button",{className:"nice-iot-dashboard__capability-control",onClick:()=>i(s.id,t.id,!0),children:"Control"})]},t.id))})]})]})]})}const V=[{name:"MQTT Broker",image:"eclipse-mosquitto:latest"},{name:"Node-RED",image:"nodered/node-red:latest"},{name:"InfluxDB",image:"influxdb:latest"},{name:"Grafana",image:"grafana/grafana:latest"},{name:"Telegraf",image:"telegraf:latest"},{name:"Protocol Adapter",image:"nice2dev/protocol-adapter:latest"}];function H({nodes:s=[],modules:i=[],onNodeSelect:a,onModuleDeploy:t,onModuleAction:c,onNodeSync:n,className:l=""}){const[d,C]=o.useState(null),[u,k]=o.useState("nodes"),[x,v]=o.useState(!1),[m,b]=o.useState({name:"",image:"",status:"pending"}),p=o.useCallback(h=>{C(h),a==null||a(h)},[a]),N=o.useCallback(async()=>{!d||!m.name||!m.image||(await(t==null?void 0:t(d.id,m)),v(!1),b({name:"",image:"",status:"pending"}))},[d,m,t]),j=o.useCallback(async(h,y)=>{d&&await(c==null?void 0:c(d.id,h,y))},[d,c]),w=o.useCallback(async()=>{d&&await(n==null?void 0:n(d.id))},[d,n]);return e.jsxs("div",{className:`nice-edge-manager ${l}`,children:[e.jsxs("header",{className:"nice-edge-manager__header",children:[e.jsx("h1",{children:"Edge Manager"}),e.jsxs("nav",{className:"nice-edge-manager__nav",children:[e.jsxs("button",{className:u==="nodes"?"active":"",onClick:()=>k("nodes"),children:["Nodes (",s.length,")"]}),e.jsx("button",{className:u==="modules"?"active":"",onClick:()=>k("modules"),children:"Modules"})]})]}),e.jsxs("div",{className:"nice-edge-manager__main",children:[u==="nodes"&&e.jsx("div",{className:"nice-edge-manager__nodes",children:e.jsxs("div",{className:"nice-edge-manager__node-grid",children:[s.map(h=>e.jsx(Y,{node:h,isSelected:(d==null?void 0:d.id)===h.id,onSelect:()=>p(h)},h.id)),s.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No edge nodes configured"})]})}),u==="modules"&&d&&e.jsxs("div",{className:"nice-edge-manager__modules",children:[e.jsxs("div",{className:"nice-edge-manager__modules-header",children:[e.jsxs("h3",{children:["Modules on ",d.name]}),e.jsx("button",{className:"nice-edge-manager__deploy-btn",onClick:()=>v(!0),children:"+ Deploy Module"})]}),e.jsxs("div",{className:"nice-edge-manager__module-grid",children:[d.deployedModules.map(h=>e.jsx(z,{module:h,onAction:y=>j(h.id,y)},h.id)),d.deployedModules.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No modules deployed on this node"})]})]}),u==="modules"&&!d&&e.jsx("div",{className:"nice-edge-manager__no-selection",children:"Select a node from the Nodes tab to manage modules"}),d&&e.jsx(J,{node:d,onSync:w,onClose:()=>C(null)})]}),x&&e.jsx(X,{config:m,templates:V,onChange:b,onDeploy:N,onClose:()=>v(!1)})]})}function F(s){switch(s){case"running":return"var(--nice-success, #28a745)";case"stopped":return"var(--nice-text-secondary, #6c757d)";case"updating":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"unreachable":return"var(--nice-text-secondary, #868e96)";default:return"var(--nice-text-secondary, #6c757d)"}}function U(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:s<1024*1024*1024?`${(s/1024/1024).toFixed(1)} MB`:`${(s/1024/1024/1024).toFixed(2)} GB`}function K(s){const i=Math.floor(s/86400),a=Math.floor(s%86400/3600),t=Math.floor(s%3600/60);return i>0?`${i}d ${a}h`:a>0?`${a}h ${t}m`:`${t}m`}function Y({node:s,isSelected:i,onSelect:a}){return e.jsxs("div",{className:`nice-edge-manager__node-card ${i?"nice-edge-manager__node-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-edge-manager__node-header",children:[e.jsx("span",{className:"nice-edge-manager__node-status",style:{background:F(s.status)}}),e.jsx("span",{className:"nice-edge-manager__node-name",children:s.name}),e.jsx("span",{className:"nice-edge-manager__node-type",children:s.type})]}),e.jsxs("div",{className:"nice-edge-manager__node-body",children:[e.jsxs("div",{className:"nice-edge-manager__node-info",children:[e.jsxs("span",{children:["πŸ–₯️ ",s.hardware.cpu]}),e.jsxs("span",{children:["πŸ’Ύ ",(s.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsx("div",{className:"nice-edge-manager__node-metrics",children:s.metrics&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${s.metrics.cpuUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[s.metrics.cpuUsage.toFixed(0),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"MEM"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${s.metrics.memoryUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[s.metrics.memoryUsage.toFixed(0),"%"]})]})]})}),e.jsxs("div",{className:"nice-edge-manager__node-modules",children:[s.deployedModules.length," modules deployed"]})]})]})}function z({module:s,onAction:i}){const a={running:"var(--nice-success, #28a745)",stopped:"var(--nice-text-secondary, #6c757d)",error:"var(--nice-danger, #dc3545)",pending:"var(--nice-warning, #ffc107)"};return e.jsxs("div",{className:"nice-edge-manager__module-card",children:[e.jsxs("div",{className:"nice-edge-manager__module-header",children:[e.jsx("span",{className:"nice-edge-manager__module-status",style:{background:a[s.status]||"var(--nice-text-secondary, #6c757d)"}}),e.jsx("span",{className:"nice-edge-manager__module-name",children:s.name}),e.jsxs("span",{className:"nice-edge-manager__module-version",children:["v",s.version]})]}),e.jsxs("div",{className:"nice-edge-manager__module-body",children:[e.jsx("div",{className:"nice-edge-manager__module-image",children:s.image}),s.resources&&e.jsxs("div",{className:"nice-edge-manager__module-resources",children:[s.resources.cpuLimit&&e.jsxs("span",{children:["CPU: ",s.resources.cpuLimit]}),s.resources.memoryLimitMB&&e.jsxs("span",{children:["RAM: ",s.resources.memoryLimitMB," MB"]})]}),s.ports&&s.ports.length>0&&e.jsxs("div",{className:"nice-edge-manager__module-ports",children:["Ports: ",s.ports.map(t=>`${t.host}:${t.container}`).join(", ")]})]}),e.jsxs("div",{className:"nice-edge-manager__module-actions",children:[s.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>i("stop"),children:"Stop"}),e.jsx("button",{onClick:()=>i("restart"),children:"Restart"})]}),s.status==="stopped"&&e.jsx("button",{onClick:()=>i("start"),children:"Start"}),e.jsx("button",{className:"nice-edge-manager__module-remove",onClick:()=>i("remove"),children:"Remove"})]})]})}function J({node:s,onSync:i,onClose:a}){return e.jsxs("aside",{className:"nice-edge-manager__detail",children:[e.jsxs("div",{className:"nice-edge-manager__detail-header",children:[e.jsx("h3",{children:s.name}),e.jsxs("div",{className:"nice-edge-manager__detail-actions",children:[e.jsx("button",{onClick:i,children:"πŸ”„ Sync"}),e.jsx("button",{onClick:a,children:"Γ—"})]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-edge-manager__status-badge",style:{background:F(s.status)},children:s.status})]}),s.metrics&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Uptime:"}),e.jsx("span",{children:K(s.metrics.uptime)})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Hardware"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"CPU:"}),e.jsxs("span",{children:[s.hardware.cpu," (",s.hardware.cores," cores)"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Memory:"}),e.jsxs("span",{children:[(s.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Storage:"}),e.jsxs("span",{children:[(s.hardware.storageMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Architecture:"}),e.jsx("span",{children:s.hardware.architecture})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Software"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"OS:"}),e.jsxs("span",{children:[s.software.os," ",s.software.osVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Runtime:"}),e.jsxs("span",{children:[s.software.runtime," ",s.software.runtimeVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Agent:"}),e.jsxs("span",{children:[s.software.agent," v",s.software.agentVersion]})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connectivity"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Cloud:"}),e.jsx("span",{children:s.connectivity.cloudConnected?"βœ“ Connected":"βœ— Disconnected"})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Network:"}),e.jsx("span",{children:s.connectivity.localNetwork})]}),s.connectivity.publicIP&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Public IP:"}),e.jsx("span",{children:s.connectivity.publicIP})]}),s.connectivity.lastSync&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Last Sync:"}),e.jsx("span",{children:s.connectivity.lastSync.toLocaleString()})]})]}),s.metrics&&e.jsxs("section",{children:[e.jsx("h4",{children:"Resource Usage"}),e.jsxs("div",{className:"nice-edge-manager__resource-chart",children:[e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${s.metrics.cpuUsage}%`}})}),e.jsxs("span",{children:[s.metrics.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Memory"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${s.metrics.memoryUsage}%`}})}),e.jsxs("span",{children:[s.metrics.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Disk"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${s.metrics.diskUsage}%`}})}),e.jsxs("span",{children:[s.metrics.diskUsage.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"nice-edge-manager__network-stats",children:[e.jsxs("span",{children:["↓ ",U(s.metrics.networkIn)]}),e.jsxs("span",{children:["↑ ",U(s.metrics.networkOut)]})]})]})]})]})}function X({config:s,templates:i,onChange:a,onDeploy:t,onClose:c}){return e.jsx("div",{className:"nice-edge-manager__dialog-overlay",children:e.jsxs("div",{className:"nice-edge-manager__dialog",children:[e.jsxs("div",{className:"nice-edge-manager__dialog-header",children:[e.jsx("h3",{children:"Deploy Module"}),e.jsx("button",{onClick:c,children:"Γ—"})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-content",children:[e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Template (optional)"}),e.jsxs("select",{value:"",onChange:n=>{const l=i.find(d=>d.image===n.target.value);l&&a({...s,name:l.name,image:l.image})},children:[e.jsx("option",{value:"",children:"Select a template..."}),i.map(n=>e.jsx("option",{value:n.image,children:n.name},n.image))]})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Module Name"}),e.jsx("input",{type:"text",value:s.name||"",onChange:n=>a({...s,name:n.target.value}),placeholder:"e.g., my-module"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Container Image"}),e.jsx("input",{type:"text",value:s.image||"",onChange:n=>a({...s,image:n.target.value}),placeholder:"e.g., nginx:latest"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Version"}),e.jsx("input",{type:"text",value:s.version||"1.0.0",onChange:n=>a({...s,version:n.target.value})})]})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-footer",children:[e.jsx("button",{onClick:c,children:"Cancel"}),e.jsx("button",{className:"nice-edge-manager__deploy-confirm",onClick:t,children:"Deploy"})]})]})})}const A={broker:"localhost",port:1883,clientId:`nice2dev-${Date.now()}`,useTLS:!1,keepAlive:60,cleanSession:!0,topics:[]},L={host:"localhost",port:5683,useDTLS:!1,resources:[]},$={type:"tcp",host:"localhost",port:502,slaveId:1,timeout:1e3,registers:[]},E={endpointUrl:"opc.tcp://localhost:4840",securityMode:"None",authentication:"anonymous",applicationName:"Nice2Dev IoT Client",nodes:[]};function Z({protocol:s="mqtt",config:i,onSave:a,onTest:t,className:c=""}){const[n,l]=o.useState(s),[d,C]=o.useState((i==null?void 0:i.type)==="mqtt"?{...A,...i.config}:A),[u,k]=o.useState((i==null?void 0:i.type)==="coap"?{...L,...i.config}:L),[x,v]=o.useState((i==null?void 0:i.type)==="modbus"?{...$,...i.config}:$),[m,b]=o.useState((i==null?void 0:i.type)==="opcua"?{...E,...i.config}:E),[p,N]=o.useState(null),[j,w]=o.useState(!1),h=o.useCallback(()=>{switch(n){case"mqtt":return d;case"coap":return u;case"modbus-tcp":case"modbus-rtu":return x;case"opcua":return m;default:return d}},[n,d,u,x,m]),y=o.useCallback(()=>{a==null||a(h())},[h,a]),D=o.useCallback(async()=>{if(t){w(!0),N(null);try{const f=await t(h());N(f)}catch(f){N({success:!1,message:String(f)})}finally{w(!1)}}},[h,t]);return e.jsxs("div",{className:`nice-protocol-config ${c}`,children:[e.jsxs("header",{className:"nice-protocol-config__header",children:[e.jsx("h2",{children:"Protocol Configuration"}),e.jsxs("div",{className:"nice-protocol-config__protocol-selector",children:[e.jsx("label",{children:"Protocol:"}),e.jsxs("select",{value:n,onChange:f=>l(f.target.value),children:[e.jsx("option",{value:"mqtt",children:"MQTT"}),e.jsx("option",{value:"coap",children:"CoAP"}),e.jsx("option",{value:"modbus-tcp",children:"Modbus TCP"}),e.jsx("option",{value:"modbus-rtu",children:"Modbus RTU"}),e.jsx("option",{value:"opcua",children:"OPC-UA"})]})]})]}),e.jsxs("div",{className:"nice-protocol-config__content",children:[n==="mqtt"&&e.jsx(ee,{config:d,onChange:C}),n==="coap"&&e.jsx(se,{config:u,onChange:k}),(n==="modbus-tcp"||n==="modbus-rtu")&&e.jsx(ae,{config:x,type:n==="modbus-rtu"?"rtu":"tcp",onChange:v}),n==="opcua"&&e.jsx(ie,{config:m,onChange:b})]}),p&&e.jsxs("div",{className:`nice-protocol-config__test-result nice-protocol-config__test-result--${p.success?"success":"error"}`,children:[p.success?"βœ“":"βœ—"," ",p.message]}),e.jsxs("footer",{className:"nice-protocol-config__footer",children:[e.jsx("button",{className:"nice-protocol-config__test-btn",onClick:D,disabled:j||!t,children:j?"Testing...":"πŸ”Œ Test Connection"}),e.jsx("button",{className:"nice-protocol-config__save-btn",onClick:y,children:"πŸ’Ύ Save"})]})]})}function ee({config:s,onChange:i}){return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:"MQTT Configuration"}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Broker"}),e.jsx("input",{type:"text",value:s.broker,onChange:a=>i({...s,broker:a.target.value}),placeholder:"localhost"})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Port"}),e.jsx("input",{type:"number",value:s.port,onChange:a=>i({...s,port:parseInt(a.target.value,10)||1883})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Client ID"}),e.jsx("input",{type:"text",value:s.clientId,onChange:a=>i({...s,clientId:a.target.value})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:s.useTLS,onChange:a=>i({...s,useTLS:a.target.checked})}),"Use TLS"]})}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Username"}),e.jsx("input",{type:"text",value:s.username||"",onChange:a=>i({...s,username:a.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Password"}),e.jsx("input",{type:"password",value:s.password||"",onChange:a=>i({...s,password:a.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Keep Alive (seconds)"}),e.jsx("input",{type:"number",value:s.keepAlive,onChange:a=>i({...s,keepAlive:parseInt(a.target.value,10)||60})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:s.cleanSession,onChange:a=>i({...s,cleanSession:a.target.checked})}),"Clean Session"]})})]}),e.jsx("h4",{children:"Topics"}),e.jsxs("div",{className:"nice-protocol-config__topics",children:[s.topics.map((a,t)=>e.jsxs("div",{className:"nice-protocol-config__topic-row",children:[e.jsx("input",{type:"text",value:a.pattern,onChange:c=>{const n=[...s.topics];n[t]={...n[t],pattern:c.target.value},i({...s,topics:n})},placeholder:"e.g., sensors/+/data"}),e.jsxs("select",{value:a.qos,onChange:c=>{const n=[...s.topics];n[t]={...n[t],qos:parseInt(c.target.value,10)},i({...s,topics:n})},children:[e.jsx("option",{value:0,children:"QoS 0"}),e.jsx("option",{value:1,children:"QoS 1"}),e.jsx("option",{value:2,children:"QoS 2"})]}),e.jsxs("select",{value:a.direction,onChange:c=>{const n=[...s.topics];n[t]={...n[t],direction:c.target.value},i({...s,topics:n})},children:[e.jsx("option",{value:"subscribe",children:"Subscribe"}),e.jsx("option",{value:"publish",children:"Publish"}),e.jsx("option",{value:"both",children:"Both"})]}),e.jsx("button",{onClick:()=>{const c=s.topics.filter((n,l)=>l!==t);i({...s,topics:c})},children:"Γ—"})]},t)),e.jsx("button",{onClick:()=>{i({...s,topics:[...s.topics,{pattern:"",qos:0,direction:"subscribe",payloadFormat:"json"}]})},children:"+ Add Topic"})]})]})}function se({config:s,onChange:i}){return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:"CoAP Configuration"}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Host"}),e.jsx("input",{type:"text",value:s.host,onChange:a=>i({...s,host:a.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Port"}),e.jsx("input",{type:"number",value:s.port,onChange:a=>i({...s,port:parseInt(a.target.value,10)||5683})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:s.useDTLS,onChange:a=>i({...s,useDTLS:a.target.checked})}),"Use DTLS"]})}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:s.observe||!1,onChange:a=>i({...s,observe:a.target.checked})}),"Enable Observe"]})})]}),e.jsx("h4",{children:"Resources"}),e.jsxs("div",{className:"nice-protocol-config__resources",children:[s.resources.map((a,t)=>e.jsxs("div",{className:"nice-protocol-config__resource-row",children:[e.jsx("input",{type:"text",value:a.path,onChange:c=>{const n=[...s.resources];n[t]={...n[t],path:c.target.value},i({...s,resources:n})},placeholder:"/sensors/temperature"}),e.jsx("button",{onClick:()=>{const c=s.resources.filter((n,l)=>l!==t);i({...s,resources:c})},children:"Γ—"})]},t)),e.jsx("button",{onClick:()=>{i({...s,resources:[...s.resources,{path:"",methods:["GET"],mediaType:"application/json",observable:!1}]})},children:"+ Add Resource"})]})]})}function ae({config:s,type:i,onChange:a}){return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsxs("h3",{children:["Modbus ",i.toUpperCase()," Configuration"]}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[i==="tcp"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Host"}),e.jsx("input",{type:"text",value:s.host||"",onChange:t=>a({...s,host:t.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Port"}),e.jsx("input",{type:"number",value:s.port||502,onChange:t=>a({...s,port:parseInt(t.target.value,10)||502})})]})]}),i==="rtu"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Serial Port"}),e.jsx("input",{type:"text",value:s.serialPort||"",onChange:t=>a({...s,serialPort:t.target.value}),placeholder:"COM1 or /dev/ttyUSB0"})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Baud Rate"}),e.jsxs("select",{value:s.baudRate||9600,onChange:t=>a({...s,baudRate:parseInt(t.target.value,10)}),children:[e.jsx("option",{value:9600,children:"9600"}),e.jsx("option",{value:19200,children:"19200"}),e.jsx("option",{value:38400,children:"38400"}),e.jsx("option",{value:57600,children:"57600"}),e.jsx("option",{value:115200,children:"115200"})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Parity"}),e.jsxs("select",{value:s.parity||"none",onChange:t=>a({...s,parity:t.target.value}),children:[e.jsx("option",{value:"none",children:"None"}),e.jsx("option",{value:"even",children:"Even"}),e.jsx("option",{value:"odd",children:"Odd"})]})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Slave ID"}),e.jsx("input",{type:"number",value:s.slaveId,onChange:t=>a({...s,slaveId:parseInt(t.target.value,10)||1}),min:1,max:247})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Timeout (ms)"}),e.jsx("input",{type:"number",value:s.timeout,onChange:t=>a({...s,timeout:parseInt(t.target.value,10)||1e3})})]})]}),e.jsx("h4",{children:"Registers"}),e.jsxs("table",{className:"nice-protocol-config__registers-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"Address"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Data Type"}),e.jsx("th",{children:"R/W"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:s.registers.map((t,c)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("input",{type:"text",value:t.name,onChange:n=>{const l=[...s.registers];l[c]={...l[c],name:n.target.value},a({...s,registers:l})}})}),e.jsx("td",{children:e.jsx("input",{type:"number",value:t.address,onChange:n=>{const l=[...s.registers];l[c]={...l[c],address:parseInt(n.target.value,10)||0},a({...s,registers:l})}})}),e.jsx("td",{children:e.jsxs("select",{value:t.type,onChange:n=>{const l=[...s.registers];l[c]={...l[c],type:n.target.value},a({...s,registers:l})},children:[e.jsx("option",{value:"coil",children:"Coil"}),e.jsx("option",{value:"discrete",children:"Discrete"}),e.jsx("option",{value:"holding",children:"Holding"}),e.jsx("option",{value:"input",children:"Input"})]})}),e.jsx("td",{children:e.jsxs("select",{value:t.dataType,onChange:n=>{const l=[...s.registers];l[c]={...l[c],dataType:n.target.value},a({...s,registers:l})},children:[e.jsx("option",{value:"bool",children:"Bool"}),e.jsx("option",{value:"int16",children:"Int16"}),e.jsx("option",{value:"uint16",children:"UInt16"}),e.jsx("option",{value:"int32",children:"Int32"}),e.jsx("option",{value:"uint32",children:"UInt32"}),e.jsx("option",{value:"float32",children:"Float32"})]})}),e.jsxs("td",{children:[e.jsx("input",{type:"checkbox",checked:t.readable,onChange:n=>{const l=[...s.registers];l[c]={...l[c],readable:n.target.checked},a({...s,registers:l})},title:"Readable"}),e.jsx("input",{type:"checkbox",checked:t.writable,onChange:n=>{const l=[...s.registers];l[c]={...l[c],writable:n.target.checked},a({...s,registers:l})},title:"Writable"})]}),e.jsx("td",{children:e.jsx("button",{onClick:()=>{const n=s.registers.filter((l,d)=>d!==c);a({...s,registers:n})},children:"Γ—"})})]},c))})]}),e.jsx("button",{onClick:()=>{a({...s,registers:[...s.registers,{name:"",address:0,type:"holding",dataType:"uint16",readable:!0,writable:!1}]})},children:"+ Add Register"})]})}function ie({config:s,onChange:i}){return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:"OPC-UA Configuration"}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field nice-protocol-config__field--full",children:[e.jsx("label",{children:"Endpoint URL"}),e.jsx("input",{type:"text",value:s.endpointUrl,onChange:a=>i({...s,endpointUrl:a.target.value}),placeholder:"opc.tcp://localhost:4840"})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Security Mode"}),e.jsxs("select",{value:s.securityMode,onChange:a=>i({...s,securityMode:a.target.value}),children:[e.jsx("option",{value:"None",children:"None"}),e.jsx("option",{value:"Sign",children:"Sign"}),e.jsx("option",{value:"SignAndEncrypt",children:"Sign and Encrypt"})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Authentication"}),e.jsxs("select",{value:s.authentication,onChange:a=>i({...s,authentication:a.target.value}),children:[e.jsx("option",{value:"anonymous",children:"Anonymous"}),e.jsx("option",{value:"username",children:"Username/Password"}),e.jsx("option",{value:"certificate",children:"Certificate"})]})]}),s.authentication==="username"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Username"}),e.jsx("input",{type:"text",value:s.username||"",onChange:a=>i({...s,username:a.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Password"}),e.jsx("input",{type:"password",value:s.password||"",onChange:a=>i({...s,password:a.target.value})})]})]}),e.jsxs("div",{className:"nice-protocol-config__field nice-protocol-config__field--full",children:[e.jsx("label",{children:"Application Name"}),e.jsx("input",{type:"text",value:s.applicationName,onChange:a=>i({...s,applicationName:a.target.value})})]})]}),e.jsx("h4",{children:"Nodes"}),e.jsxs("div",{className:"nice-protocol-config__nodes",children:[s.nodes.map((a,t)=>e.jsxs("div",{className:"nice-protocol-config__node-row",children:[e.jsx("input",{type:"text",value:a.nodeId,onChange:c=>{const n=[...s.nodes];n[t]={...n[t],nodeId:c.target.value},i({...s,nodes:n})},placeholder:"ns=2;s=Temperature"}),e.jsx("input",{type:"text",value:a.displayName,onChange:c=>{const n=[...s.nodes];n[t]={...n[t],displayName:c.target.value},i({...s,nodes:n})},placeholder:"Display Name"}),e.jsx("button",{onClick:()=>{const c=s.nodes.filter((n,l)=>l!==t);i({...s,nodes:c})},children:"Γ—"})]},t)),e.jsx("button",{onClick:()=>{i({...s,nodes:[...s.nodes,{nodeId:"",displayName:"",dataType:"Double",read:!0}]})},children:"+ Add Node"})]})]})}exports.NiceEdgeManager=H;exports.NiceIoTDashboard=R;exports.NiceProtocolConfig=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),U=[{type:"device-list",label:"Device List",icon:"πŸ“‹"},{type:"device-status",label:"Device Status",icon:"🟒"},{type:"telemetry-chart",label:"Telemetry Chart",icon:"πŸ“ˆ"},{type:"gauge",label:"Gauge",icon:"⏱️"},{type:"map",label:"Device Map",icon:"πŸ—ΊοΈ"},{type:"alarms",label:"Alarms",icon:"🚨"},{type:"control-panel",label:"Control Panel",icon:"πŸŽ›οΈ"},{type:"topology",label:"Network Topology",icon:"πŸ”—"},{type:"kpi",label:"KPI Card",icon:"🎯"},{type:"camera-feed",label:"Camera Feed",icon:"πŸ“Ή"}];function Z({devices:r=[],widgets:s=[],alarms:a=[],onDeviceSelect:i,onWidgetChange:c,onCommand:n,onAlarmAcknowledge:o,fetchTelemetry:d,className:b=""}){const[m,v]=f.useState(s),[x,u]=f.useState(null),[h,g]=f.useState("dashboard"),[N,k]=f.useState(!1),[j,T]=f.useState(""),y=f.useCallback(l=>{v(w=>{const C=l(w);return c==null||c(C),C})},[c]),_=f.useCallback(l=>{var C;const w={id:crypto.randomUUID(),type:l,title:((C=U.find(E=>E.type===l))==null?void 0:C.label)||l,position:{x:0,y:ee(m),width:4,height:3},config:{}};y(E=>[...E,w])},[m,y]),R=f.useCallback(l=>{u(l),i==null||i(l)},[i]),I=f.useCallback(l=>{o==null||o(l)},[o]),S=r.filter(l=>!j||l.name.toLowerCase().includes(j.toLowerCase())||l.type.toLowerCase().includes(j.toLowerCase())),P=a.filter(l=>!l.cleared),L=P.filter(l=>l.severity==="critical"||l.severity==="high");return e.jsxs("div",{className:`nice-iot-dashboard ${b}`,children:[e.jsxs("header",{className:"nice-iot-dashboard__header",children:[e.jsx("h1",{children:"IoT Dashboard"}),e.jsxs("div",{className:"nice-iot-dashboard__stats",children:[e.jsxs("span",{className:"nice-iot-dashboard__stat",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"πŸ“±"}),r.length," Devices"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--online",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"🟒"}),r.filter(l=>l.status==="online").length," Online"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--offline",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"⚫"}),r.filter(l=>l.status==="offline").length," Offline"]}),L.length>0&&e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"🚨"}),L.length," Alarms"]})]}),e.jsxs("nav",{className:"nice-iot-dashboard__nav",children:[e.jsx("button",{className:h==="dashboard"?"active":"",onClick:()=>g("dashboard"),children:"Dashboard"}),e.jsx("button",{className:h==="devices"?"active":"",onClick:()=>g("devices"),children:"Devices"}),e.jsxs("button",{className:h==="alarms"?"active":"",onClick:()=>g("alarms"),children:["Alarms ",P.length>0&&`(${P.length})`]})]}),e.jsx("div",{className:"nice-iot-dashboard__actions",children:h==="dashboard"&&e.jsx("button",{onClick:()=>k(!N),children:N?"βœ“ Done":"✏️ Edit"})})]}),h==="dashboard"&&e.jsxs("div",{className:"nice-iot-dashboard__main",children:[N&&e.jsxs("aside",{className:"nice-iot-dashboard__palette",children:[e.jsx("h4",{children:"Add Widget"}),U.map(l=>e.jsxs("button",{className:"nice-iot-dashboard__palette-item",onClick:()=>_(l.type),children:[e.jsx("span",{children:l.icon}),e.jsx("span",{children:l.label})]},l.type))]}),e.jsxs("div",{className:"nice-iot-dashboard__grid",children:[m.map(l=>e.jsx(re,{widget:l,devices:r,alarms:a,isEditing:N,onCommand:n,onDelete:()=>y(w=>w.filter(C=>C.id!==l.id))},l.id)),m.length===0&&e.jsx("div",{className:"nice-iot-dashboard__empty",children:N?"Add widgets from the palette":"No widgets configured. Click Edit to add widgets."})]})]}),h==="devices"&&e.jsxs("div",{className:"nice-iot-dashboard__devices",children:[e.jsx("div",{className:"nice-iot-dashboard__devices-toolbar",children:e.jsx("input",{type:"search",placeholder:"Search devices...",value:j,onChange:l=>T(l.target.value)})}),e.jsx("div",{className:"nice-iot-dashboard__device-grid",children:S.map(l=>e.jsx(se,{device:l,isSelected:(x==null?void 0:x.id)===l.id,onSelect:()=>R(l)},l.id))}),x&&e.jsx(ie,{device:x,onCommand:n,onClose:()=>u(null)})]}),h==="alarms"&&e.jsx("div",{className:"nice-iot-dashboard__alarms",children:e.jsxs("table",{className:"nice-iot-dashboard__alarm-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Message"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:P.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"nice-iot-dashboard__no-alarms",children:"No active alarms"})}):P.map(l=>{const w=r.find(C=>C.id===l.deviceId);return e.jsxs("tr",{className:`nice-iot-dashboard__alarm-row nice-iot-dashboard__alarm-row--${l.severity}`,children:[e.jsx("td",{children:e.jsx("span",{className:`nice-iot-dashboard__severity nice-iot-dashboard__severity--${l.severity}`,children:l.severity})}),e.jsx("td",{children:(w==null?void 0:w.name)||l.deviceId}),e.jsx("td",{children:l.message}),e.jsx("td",{children:l.timestamp.toLocaleString()}),e.jsx("td",{children:l.acknowledged?"Acknowledged":"Active"}),e.jsx("td",{children:!l.acknowledged&&e.jsx("button",{onClick:()=>I(l.id),children:"Acknowledge"})})]},l.id)})})]})})]})}function ee(r){return r.length===0?0:Math.max(...r.map(s=>s.position.y+s.position.height))}function D(r){switch(r){case"online":return"var(--nice-success, #28a745)";case"offline":return"var(--nice-text-secondary, #6c757d)";case"warning":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"maintenance":return"var(--nice-info, #17a2b8)";default:return"var(--nice-text-secondary, #6c757d)"}}function re({widget:r,devices:s,alarms:a,isEditing:i,onCommand:c,onDelete:n}){const o=U.find(d=>d.type===r.type);return e.jsxs("div",{className:`nice-iot-dashboard__widget nice-iot-dashboard__widget--${r.type}`,style:{gridColumn:`span ${r.position.width}`,gridRow:`span ${r.position.height}`},children:[e.jsxs("div",{className:"nice-iot-dashboard__widget-header",children:[e.jsx("span",{className:"nice-iot-dashboard__widget-icon",children:o==null?void 0:o.icon}),e.jsx("span",{className:"nice-iot-dashboard__widget-title",children:r.title}),i&&e.jsx("button",{className:"nice-iot-dashboard__widget-delete",onClick:n,children:"Γ—"})]}),e.jsx("div",{className:"nice-iot-dashboard__widget-content",children:e.jsx(ae,{widget:r,devices:s,alarms:a,onCommand:c})})]})}function ae({widget:r,devices:s,alarms:a,onCommand:i}){switch(r.type){case"device-list":return e.jsx("div",{className:"nice-iot-dashboard__device-list",children:s.slice(0,10).map(c=>e.jsxs("div",{className:"nice-iot-dashboard__device-list-item",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(c.status)}}),e.jsx("span",{children:c.name}),e.jsx("span",{className:"nice-iot-dashboard__device-type",children:c.type})]},c.id))});case"device-status":return e.jsx("div",{className:"nice-iot-dashboard__status-grid",children:["online","offline","warning","error"].map(c=>{const n=s.filter(o=>o.status===c).length;return e.jsxs("div",{className:"nice-iot-dashboard__status-card",children:[e.jsx("span",{className:"nice-iot-dashboard__status-indicator",style:{background:D(c)}}),e.jsx("span",{className:"nice-iot-dashboard__status-count",children:n}),e.jsx("span",{className:"nice-iot-dashboard__status-label",children:c})]},c)})});case"telemetry-chart":return e.jsxs("div",{className:"nice-iot-dashboard__chart-placeholder",children:[e.jsx("span",{children:"πŸ“ˆ"}),e.jsx("span",{children:"Telemetry Chart"}),e.jsx("small",{children:"Configure device and capability"})]});case"gauge":return e.jsx("div",{className:"nice-iot-dashboard__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:"63 126"}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"14",fontWeight:"bold",children:"50%"})]})});case"map":return e.jsxs("div",{className:"nice-iot-dashboard__map-placeholder",children:[e.jsx("span",{children:"πŸ—ΊοΈ"}),e.jsx("span",{children:"Device Map"}),e.jsxs("small",{children:[s.filter(c=>c.location).length," devices with location"]})]});case"alarms":{const c=a.filter(n=>!n.cleared).slice(0,5);return e.jsx("div",{className:"nice-iot-dashboard__alarm-list",children:c.length===0?e.jsx("div",{className:"nice-iot-dashboard__alarm-empty",children:"No active alarms"}):c.map(n=>e.jsxs("div",{className:`nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${n.severity}`,children:[e.jsx("span",{className:"nice-iot-dashboard__alarm-severity",children:n.severity}),e.jsx("span",{className:"nice-iot-dashboard__alarm-message",children:n.message})]},n.id))})}case"control-panel":return e.jsxs("div",{className:"nice-iot-dashboard__control-placeholder",children:[e.jsx("span",{children:"πŸŽ›οΈ"}),e.jsx("span",{children:"Control Panel"}),e.jsx("small",{children:"Configure device controls"})]});case"kpi":return e.jsxs("div",{className:"nice-iot-dashboard__kpi",children:[e.jsx("div",{className:"nice-iot-dashboard__kpi-value",children:s.length}),e.jsx("div",{className:"nice-iot-dashboard__kpi-label",children:"Total Devices"})]});default:return e.jsx("div",{className:"nice-iot-dashboard__widget-placeholder",children:r.type})}}function se({device:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-iot-dashboard__device-card ${s?"nice-iot-dashboard__device-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-iot-dashboard__device-card-header",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(r.status)}}),e.jsx("span",{className:"nice-iot-dashboard__device-name",children:r.name})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-card-body",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-info",children:[e.jsxs("span",{children:["Type: ",r.type]}),e.jsxs("span",{children:["Protocol: ",r.protocol]})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__device-lastseen",children:["Last seen: ",r.lastSeen.toLocaleString()]}),e.jsxs("div",{className:"nice-iot-dashboard__device-capabilities",children:[r.capabilities.slice(0,3).map(i=>e.jsx("span",{className:"nice-iot-dashboard__capability-badge",children:i.name},i.id)),r.capabilities.length>3&&e.jsxs("span",{className:"nice-iot-dashboard__capability-more",children:["+",r.capabilities.length-3]})]})]})]})}function ie({device:r,onCommand:s,onClose:a}){return e.jsxs("aside",{className:"nice-iot-dashboard__device-detail",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-detail-header",children:[e.jsx("h3",{children:r.name}),e.jsx("button",{onClick:a,children:"Γ—"})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-iot-dashboard__status-badge",style:{background:D(r.status)},children:r.status})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Last Seen:"}),e.jsx("span",{children:r.lastSeen.toLocaleString()})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connection"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Protocol:"}),e.jsx("span",{children:r.protocol})]}),r.connectionInfo.host&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Host:"}),e.jsxs("span",{children:[r.connectionInfo.host,":",r.connectionInfo.port]})]})]}),r.metadata&&e.jsxs("section",{children:[e.jsx("h4",{children:"Metadata"}),r.metadata.manufacturer&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Manufacturer:"}),e.jsx("span",{children:r.metadata.manufacturer})]}),r.metadata.model&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Model:"}),e.jsx("span",{children:r.metadata.model})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Capabilities"}),e.jsx("div",{className:"nice-iot-dashboard__capabilities-list",children:r.capabilities.map(i=>e.jsxs("div",{className:"nice-iot-dashboard__capability-item",children:[e.jsx("span",{className:"nice-iot-dashboard__capability-name",children:i.name}),e.jsx("span",{className:"nice-iot-dashboard__capability-type",children:i.type}),i.writable&&s&&e.jsx("button",{className:"nice-iot-dashboard__capability-control",onClick:()=>s(r.id,i.id,!0),children:"Control"})]},i.id))})]})]})]})}const ce=[{name:"MQTT Broker",image:"eclipse-mosquitto:latest"},{name:"Node-RED",image:"nodered/node-red:latest"},{name:"InfluxDB",image:"influxdb:latest"},{name:"Grafana",image:"grafana/grafana:latest"},{name:"Telegraf",image:"telegraf:latest"},{name:"Protocol Adapter",image:"nice2dev/protocol-adapter:latest"}];function ne({nodes:r=[],modules:s=[],onNodeSelect:a,onModuleDeploy:i,onModuleAction:c,onNodeSync:n,className:o=""}){const[d,b]=f.useState(null),[m,v]=f.useState("nodes"),[x,u]=f.useState(!1),[h,g]=f.useState({name:"",image:"",status:"pending"}),N=f.useCallback(y=>{b(y),a==null||a(y)},[a]),k=f.useCallback(async()=>{!d||!h.name||!h.image||(await(i==null?void 0:i(d.id,h)),u(!1),g({name:"",image:"",status:"pending"}))},[d,h,i]),j=f.useCallback(async(y,_)=>{d&&await(c==null?void 0:c(d.id,y,_))},[d,c]),T=f.useCallback(async()=>{d&&await(n==null?void 0:n(d.id))},[d,n]);return e.jsxs("div",{className:`nice-edge-manager ${o}`,children:[e.jsxs("header",{className:"nice-edge-manager__header",children:[e.jsx("h1",{children:"Edge Manager"}),e.jsxs("nav",{className:"nice-edge-manager__nav",children:[e.jsxs("button",{className:m==="nodes"?"active":"",onClick:()=>v("nodes"),children:["Nodes (",r.length,")"]}),e.jsx("button",{className:m==="modules"?"active":"",onClick:()=>v("modules"),children:"Modules"})]})]}),e.jsxs("div",{className:"nice-edge-manager__main",children:[m==="nodes"&&e.jsx("div",{className:"nice-edge-manager__nodes",children:e.jsxs("div",{className:"nice-edge-manager__node-grid",children:[r.map(y=>e.jsx(te,{node:y,isSelected:(d==null?void 0:d.id)===y.id,onSelect:()=>N(y)},y.id)),r.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No edge nodes configured"})]})}),m==="modules"&&d&&e.jsxs("div",{className:"nice-edge-manager__modules",children:[e.jsxs("div",{className:"nice-edge-manager__modules-header",children:[e.jsxs("h3",{children:["Modules on ",d.name]}),e.jsx("button",{className:"nice-edge-manager__deploy-btn",onClick:()=>u(!0),children:"+ Deploy Module"})]}),e.jsxs("div",{className:"nice-edge-manager__module-grid",children:[d.deployedModules.map(y=>e.jsx(de,{module:y,onAction:_=>j(y.id,_)},y.id)),d.deployedModules.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No modules deployed on this node"})]})]}),m==="modules"&&!d&&e.jsx("div",{className:"nice-edge-manager__no-selection",children:"Select a node from the Nodes tab to manage modules"}),d&&e.jsx(le,{node:d,onSync:T,onClose:()=>b(null)})]}),x&&e.jsx(fe,{config:h,templates:ce,onChange:g,onDeploy:k,onClose:()=>u(!1)})]})}function W(r){switch(r){case"running":return"var(--nice-success, #28a745)";case"stopped":return"var(--nice-text-secondary, #6c757d)";case"updating":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"unreachable":return"var(--nice-text-secondary, #868e96)";default:return"var(--nice-text-secondary, #6c757d)"}}function $(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:r<1024*1024*1024?`${(r/1024/1024).toFixed(1)} MB`:`${(r/1024/1024/1024).toFixed(2)} GB`}function oe(r){const s=Math.floor(r/86400),a=Math.floor(r%86400/3600),i=Math.floor(r%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function te({node:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-edge-manager__node-card ${s?"nice-edge-manager__node-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-edge-manager__node-header",children:[e.jsx("span",{className:"nice-edge-manager__node-status",style:{background:W(r.status)}}),e.jsx("span",{className:"nice-edge-manager__node-name",children:r.name}),e.jsx("span",{className:"nice-edge-manager__node-type",children:r.type})]}),e.jsxs("div",{className:"nice-edge-manager__node-body",children:[e.jsxs("div",{className:"nice-edge-manager__node-info",children:[e.jsxs("span",{children:["πŸ–₯️ ",r.hardware.cpu]}),e.jsxs("span",{children:["πŸ’Ύ ",(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsx("div",{className:"nice-edge-manager__node-metrics",children:r.metrics&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.cpuUsage.toFixed(0),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"MEM"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.memoryUsage.toFixed(0),"%"]})]})]})}),e.jsxs("div",{className:"nice-edge-manager__node-modules",children:[r.deployedModules.length," modules deployed"]})]})]})}function de({module:r,onAction:s}){const a={running:"var(--nice-success, #28a745)",stopped:"var(--nice-text-secondary, #6c757d)",error:"var(--nice-danger, #dc3545)",pending:"var(--nice-warning, #ffc107)"};return e.jsxs("div",{className:"nice-edge-manager__module-card",children:[e.jsxs("div",{className:"nice-edge-manager__module-header",children:[e.jsx("span",{className:"nice-edge-manager__module-status",style:{background:a[r.status]||"var(--nice-text-secondary, #6c757d)"}}),e.jsx("span",{className:"nice-edge-manager__module-name",children:r.name}),e.jsxs("span",{className:"nice-edge-manager__module-version",children:["v",r.version]})]}),e.jsxs("div",{className:"nice-edge-manager__module-body",children:[e.jsx("div",{className:"nice-edge-manager__module-image",children:r.image}),r.resources&&e.jsxs("div",{className:"nice-edge-manager__module-resources",children:[r.resources.cpuLimit&&e.jsxs("span",{children:["CPU: ",r.resources.cpuLimit]}),r.resources.memoryLimitMB&&e.jsxs("span",{children:["RAM: ",r.resources.memoryLimitMB," MB"]})]}),r.ports&&r.ports.length>0&&e.jsxs("div",{className:"nice-edge-manager__module-ports",children:["Ports: ",r.ports.map(i=>`${i.host}:${i.container}`).join(", ")]})]}),e.jsxs("div",{className:"nice-edge-manager__module-actions",children:[r.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>s("stop"),children:"Stop"}),e.jsx("button",{onClick:()=>s("restart"),children:"Restart"})]}),r.status==="stopped"&&e.jsx("button",{onClick:()=>s("start"),children:"Start"}),e.jsx("button",{className:"nice-edge-manager__module-remove",onClick:()=>s("remove"),children:"Remove"})]})]})}function le({node:r,onSync:s,onClose:a}){return e.jsxs("aside",{className:"nice-edge-manager__detail",children:[e.jsxs("div",{className:"nice-edge-manager__detail-header",children:[e.jsx("h3",{children:r.name}),e.jsxs("div",{className:"nice-edge-manager__detail-actions",children:[e.jsx("button",{onClick:s,children:"πŸ”„ Sync"}),e.jsx("button",{onClick:a,children:"Γ—"})]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-edge-manager__status-badge",style:{background:W(r.status)},children:r.status})]}),r.metrics&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Uptime:"}),e.jsx("span",{children:oe(r.metrics.uptime)})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Hardware"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"CPU:"}),e.jsxs("span",{children:[r.hardware.cpu," (",r.hardware.cores," cores)"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Memory:"}),e.jsxs("span",{children:[(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Storage:"}),e.jsxs("span",{children:[(r.hardware.storageMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Architecture:"}),e.jsx("span",{children:r.hardware.architecture})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Software"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"OS:"}),e.jsxs("span",{children:[r.software.os," ",r.software.osVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Runtime:"}),e.jsxs("span",{children:[r.software.runtime," ",r.software.runtimeVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Agent:"}),e.jsxs("span",{children:[r.software.agent," v",r.software.agentVersion]})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connectivity"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Cloud:"}),e.jsx("span",{children:r.connectivity.cloudConnected?"βœ“ Connected":"βœ— Disconnected"})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Network:"}),e.jsx("span",{children:r.connectivity.localNetwork})]}),r.connectivity.publicIP&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Public IP:"}),e.jsx("span",{children:r.connectivity.publicIP})]}),r.connectivity.lastSync&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Last Sync:"}),e.jsx("span",{children:r.connectivity.lastSync.toLocaleString()})]})]}),r.metrics&&e.jsxs("section",{children:[e.jsx("h4",{children:"Resource Usage"}),e.jsxs("div",{className:"nice-edge-manager__resource-chart",children:[e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{children:[r.metrics.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Memory"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{children:[r.metrics.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Disk"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.diskUsage}%`}})}),e.jsxs("span",{children:[r.metrics.diskUsage.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"nice-edge-manager__network-stats",children:[e.jsxs("span",{children:["↓ ",$(r.metrics.networkIn)]}),e.jsxs("span",{children:["↑ ",$(r.metrics.networkOut)]})]})]})]})]})}function fe({config:r,templates:s,onChange:a,onDeploy:i,onClose:c}){return e.jsx("div",{className:"nice-edge-manager__dialog-overlay",children:e.jsxs("div",{className:"nice-edge-manager__dialog",children:[e.jsxs("div",{className:"nice-edge-manager__dialog-header",children:[e.jsx("h3",{children:"Deploy Module"}),e.jsx("button",{onClick:c,children:"Γ—"})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-content",children:[e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Template (optional)"}),e.jsxs("select",{value:"",onChange:n=>{const o=s.find(d=>d.image===n.target.value);o&&a({...r,name:o.name,image:o.image})},children:[e.jsx("option",{value:"",children:"Select a template..."}),s.map(n=>e.jsx("option",{value:n.image,children:n.name},n.image))]})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Module Name"}),e.jsx("input",{type:"text",value:r.name||"",onChange:n=>a({...r,name:n.target.value}),placeholder:"e.g., my-module"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Container Image"}),e.jsx("input",{type:"text",value:r.image||"",onChange:n=>a({...r,image:n.target.value}),placeholder:"e.g., nginx:latest"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Version"}),e.jsx("input",{type:"text",value:r.version||"1.0.0",onChange:n=>a({...r,version:n.target.value})})]})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-footer",children:[e.jsx("button",{onClick:c,children:"Cancel"}),e.jsx("button",{className:"nice-edge-manager__deploy-confirm",onClick:i,children:"Deploy"})]})]})})}const me=(r,s)=>s,pe=f.createContext(me);function M(){return{t:f.useContext(pe)}}f.createContext({dir:"ltr",isRTL:!1,flip:r=>r,value:r=>r.ltr});f.createContext(null);f.createContext(null);const ye={radius:"md",shadow:"md",fill:"solid",buttonStyle:"flat",inputStyle:"bordered",cardStyle:"elevated",badgeStyle:"solid",tabStyle:"underline",toggleStyle:"default",tooltipStyle:"dark",modalStyle:"default",tableStyle:"default",menuStyle:"default",animation:"normal",density:"normal"};f.createContext({displayStyle:"default",variantConfig:ye,setDisplayStyle:()=>{}});f.createContext({});f.createContext({direction:"ltr",isRTL:!1,flip:r=>r,flipStyle:(r,s)=>({[r]:s})});f.createContext({permissions:{},getAccessMode:()=>"full"});f.createContext(null);const he=process.env.NODE_ENV==="development";let G={enabled:he,slowRenderThreshold:16};const V=[],A=new Map,Q=new Map;function ue(){V.length=0,A.clear(),Q.clear()}function be(r){const s=G.slowRenderThreshold;return V.filter(a=>a.actualDuration>s)}function H(r){return r<1?`${(r*1e3).toFixed(0)}ΞΌs`:r<1e3?`${r.toFixed(2)}ms`:`${(r/1e3).toFixed(2)}s`}function ge(){const r=Array.from(A.values()),s=be(),a=r.reduce((n,o)=>n+o.renderCount,0),i=r.length>0?r.reduce((n,o)=>n+o.avgRenderTime,0)/r.length:0,c=Array.from(Q.values());return{stats:r,slowRenders:s,totalRenders:a,avgRenderTime:i,marks:c}}function xe(){const r=ge();console.group("%c[Nice2Dev Performance Report]","color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"),console.log(`Total renders: ${r.totalRenders}`),console.log(`Average render time: ${H(r.avgRenderTime)}`),console.log(`Slow renders: ${r.slowRenders.length}`),console.group("Component Stats"),console.table(r.stats.sort((s,a)=>a.totalRenderTime-s.totalRenderTime).map(s=>({Name:s.componentName,Renders:s.renderCount,"Avg Time":H(s.avgRenderTime),"Max Time":H(s.maxRenderTime),"Total Time":H(s.totalRenderTime),"Slow Renders":s.slowRenderCount}))),console.groupEnd(),r.slowRenders.length>0&&(console.group("Slow Renders (last 10)"),console.table(r.slowRenders.slice(-10).map(s=>({Component:s.componentName,Phase:s.phase,Duration:H(s.actualDuration),Time:new Date(s.timestamp).toLocaleTimeString()}))),console.groupEnd()),r.marks.length>0&&(console.group("Custom Marks"),console.table(r.marks.filter(s=>s.duration).map(s=>({Name:s.name,Duration:H(s.duration)}))),console.groupEnd()),console.groupEnd()}const ve=f.memo(({position:r="bottom-right",defaultCollapsed:s=!0})=>{const[a,i]=f.useState(s),[c,n]=f.useState([]),[o,d]=f.useState({used:0,total:0});if(f.useEffect(()=>{const m=()=>{const x=Array.from(A.values());n(x.sort((h,g)=>g.totalRenderTime-h.totalRenderTime).slice(0,10));const u=window.performance;u.memory&&d({used:u.memory.usedJSHeapSize/1024/1024,total:u.memory.totalJSHeapSize/1024/1024})};m();const v=setInterval(m,2e3);return()=>clearInterval(v)},[]),!G.enabled)return null;const b={position:"fixed",zIndex:99999,...r.includes("top")?{top:8}:{bottom:8},...r.includes("left")?{left:8}:{right:8}};return e.jsxs("div",{style:{...b,background:"var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",color:"var(--bg-primary, #fff)",borderRadius:8,fontSize:11,fontFamily:"Monaco, Consolas, monospace",padding:a?"4px 8px":8,maxWidth:a?"auto":300,maxHeight:a?"auto":400,overflow:"auto"},children:[e.jsxs("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:8},onClick:()=>i(m=>!m),children:[e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:"●"}),e.jsx("span",{children:"Profiler"}),o.used>0&&e.jsxs("span",{style:{color:o.used>100?"var(--color-warning, #f59e0b)":"var(--text-muted, #64748b)"},children:[o.used.toFixed(0),"MB"]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.5},children:a?"β–Ό":"β–²"})]}),!a&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{borderBottom:"1px solid var(--border-color, #333)",paddingBottom:4,marginBottom:8},children:e.jsx("strong",{children:"Top Components"})}),c.map(m=>e.jsxs("div",{style:{marginBottom:4,display:"flex",gap:8},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:m.componentName}),e.jsx("span",{style:{color:m.avgRenderTime>16?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"},children:H(m.avgRenderTime)}),e.jsxs("span",{style:{color:"var(--text-muted, #64748b)",minWidth:30,textAlign:"right"},children:["x",m.renderCount]})]},m.componentName)),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[e.jsx("button",{onClick:xe,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Print Report"}),e.jsx("button",{onClick:ue,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Clear"})]})]})]})});ve.displayName="ProfilerOverlay";process.env.NODE_ENV;f.createContext(null);f.createContext({enabled:!0,active:!1,run:()=>{}});const F="nice-tutorial-button-styles";if(typeof document<"u"&&!document.getElementById(F)){const r=document.createElement("style");r.id=F,r.textContent=`
2
+ .nice-tutorial-button {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ border: 1px solid var(--nice-border, #cbd5e1);
7
+ background: var(--nice-bg, #fff);
8
+ color: var(--nice-text-secondary, #475569);
9
+ border-radius: var(--nice-radius-full, 9999px);
10
+ cursor: help;
11
+ font-weight: 700;
12
+ line-height: 1;
13
+ padding: 0;
14
+ transition: background var(--nice-transition, 200ms ease), color var(--nice-transition, 200ms ease), border-color var(--nice-transition, 200ms ease);
15
+ }
16
+ .nice-tutorial-button:hover {
17
+ background: var(--nice-primary, #2563eb);
18
+ border-color: var(--nice-primary, #2563eb);
19
+ color: var(--nice-text-inverse, #fff);
20
+ }
21
+ .nice-tutorial-button:focus-visible {
22
+ outline: none;
23
+ box-shadow: 0 0 0 2px var(--nice-bg, #fff), 0 0 0 4px var(--nice-primary, #2563eb);
24
+ }
25
+ .nice-tutorial-button--sm { width: 16px; height: 16px; font-size: 11px; }
26
+ .nice-tutorial-button--md { width: 20px; height: 20px; font-size: 12px; }
27
+ `,document.head.appendChild(r)}f.createContext(null);f.createContext(null);f.createContext(null);const J={space1:"4px",space2:"8px",space3:"12px",space4:"16px",space5:"20px",space6:"24px",space8:"32px"},K={fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSizeXs:"0.75rem",fontSizeSm:"0.8125rem",fontSizeMd:"0.875rem",fontSizeLg:"1rem",fontSizeXl:"1.125rem",fontWeightNormal:400,fontWeightMedium:500,fontWeightSemibold:600,fontWeightBold:700,lineHeight:1.5},X={fast:"120ms ease",normal:"200ms ease",slow:"300ms ease"},Y=r=>({color:r,radiusSm:"4px",radiusMd:"6px",radiusLg:"8px",radiusXl:"12px",radiusFull:"9999px"}),je={sm:"0 1px 2px rgba(0,0,0,0.05)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",lg:"0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",xl:"0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"},_e={sm:"0 1px 2px rgba(0,0,0,0.3)",md:"0 4px 6px -1px rgba(0,0,0,0.4)",lg:"0 10px 15px -3px rgba(0,0,0,0.4)",xl:"0 20px 25px -5px rgba(0,0,0,0.4)"};function t(r,s,a,i,c){return{name:r,darkMode:"light",colors:{...s,surface:s.surface??a.primary,surfaceHover:s.surfaceHover??a.secondary},backgrounds:{...a,elevated:a.elevated??a.primary,inset:a.inset??a.tertiary,canvas:a.canvas??a.primary},text:{...i,inverse:i.inverse??"#ffffff"},borders:Y(c),shadows:je,spacing:J,typography:K,transitions:X}}function p(r,s,a,i,c){return{name:r,darkMode:"dark",colors:{...s,surface:s.surface??a.secondary,surfaceHover:s.surfaceHover??a.tertiary},backgrounds:{...a,elevated:a.elevated??a.secondary,inset:a.inset??a.primary,canvas:a.canvas??a.primary},text:{...i,inverse:i.inverse??"#0f172a"},borders:Y(c),shadows:_e,spacing:J,typography:K,transitions:X}}t("Slate",{primary:"#64748b",primaryHover:"#475569",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#1e293b",secondary:"#475569",muted:"#94a3b8"},"#cbd5e1");t("Zinc",{primary:"#71717a",primaryHover:"#52525b",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fafafa",secondary:"#f4f4f5",tertiary:"#e4e4e7",hover:"#e4e4e7"},{primary:"#18181b",secondary:"#3f3f46",muted:"#a1a1aa"},"#d4d4d8");t("Stone",{primary:"#78716c",primaryHover:"#57534e",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#1c1917",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");t("Cool Gray",{primary:"#6b7280",primaryHover:"#4b5563",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#d1d5db");t("Warm Gray",{primary:"#7c7568",primaryHover:"#5c564c",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf9f7",secondary:"#f5f4f0",tertiary:"#e8e6e1",hover:"#e8e6e1"},{primary:"#1f1d19",secondary:"#4a463d",muted:"#a09888"},"#d4d0c8");t("Silver",{primary:"#94a3b8",primaryHover:"#64748b",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#38bdf8"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#334155",secondary:"#64748b",muted:"#94a3b8"},"#cbd5e1");t("Charcoal",{primary:"#374151",primaryHover:"#1f2937",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f9fafb",secondary:"#f3f4f6",tertiary:"#e5e7eb",hover:"#e5e7eb"},{primary:"#111827",secondary:"#374151",muted:"#6b7280"},"#d1d5db");t("Ivory",{primary:"#92876d",primaryHover:"#7a6f55",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffef7",secondary:"#faf6eb",tertiary:"#f0ead6",hover:"#f0ead6"},{primary:"#2b2517",secondary:"#5c5340",muted:"#9c9280"},"#ddd8c4");t("Rose",{primary:"#e11d48",primaryHover:"#be123c",success:"#16a34a",warning:"#ea580c",error:"#dc2626",info:"#0891b2"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f43f5e"},"#fda4af");t("Emerald",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#34d399"},"#6ee7b7");t("Amber",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0284c7"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#f59e0b"},"#fcd34d");t("Violet",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#2e1065",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");t("Teal",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");t("Indigo",{primary:"#4f46e5",primaryHover:"#4338ca",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#eef2ff",secondary:"#e0e7ff",tertiary:"#c7d2fe",hover:"#e0e7ff"},{primary:"#1e1b4b",secondary:"#312e81",muted:"#818cf8"},"#a5b4fc");t("Cyan",{primary:"#0891b2",primaryHover:"#0e7490",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#0284c7"},{primary:"#ecfeff",secondary:"#cffafe",tertiary:"#a5f3fc",hover:"#cffafe"},{primary:"#164e63",secondary:"#155e75",muted:"#22d3ee"},"#67e8f9");t("Lime",{primary:"#65a30d",primaryHover:"#4d7c0f",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f7fee7",secondary:"#ecfccb",tertiary:"#d9f99d",hover:"#ecfccb"},{primary:"#1a2e05",secondary:"#365314",muted:"#84cc16"},"#bef264");t("Pink",{primary:"#db2777",primaryHover:"#be185d",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#500724",secondary:"#831843",muted:"#f472b6"},"#f9a8d4");t("Orange",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#7c2d12",muted:"#fb923c"},"#fdba74");t("Fuchsia",{primary:"#c026d3",primaryHover:"#a21caf",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf4ff",secondary:"#fae8ff",tertiary:"#f5d0fe",hover:"#fae8ff"},{primary:"#4a044e",secondary:"#701a75",muted:"#d946ef"},"#e879f9");t("Sky",{primary:"#0284c7",primaryHover:"#0369a1",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#075985",muted:"#38bdf8"},"#7dd3fc");t("Ruby",{primary:"#be123c",primaryHover:"#9f1239",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#fb7185"},"#fda4af");t("Coral",{primary:"#f97316",primaryHover:"#ea580c",success:"#10b981",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#fb923c"},"#fdba74");p("Midnight",{primary:"#818cf8",primaryHover:"#6366f1",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#020617",secondary:"#0f172a",tertiary:"#1e293b",hover:"#1e293b"},{primary:"#f1f5f9",secondary:"#94a3b8",muted:"#475569"},"#1e293b");p("Obsidian",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#facc15",error:"#fb7185",info:"#38bdf8"},{primary:"#09090b",secondary:"#18181b",tertiary:"#27272a",hover:"#27272a"},{primary:"#fafafa",secondary:"#a1a1aa",muted:"#52525b"},"#3f3f46");p("Eclipse",{primary:"#c084fc",primaryHover:"#a855f7",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#67e8f9"},{primary:"#0c0a1d",secondary:"#1a1533",tertiary:"#2a2248",hover:"#2a2248"},{primary:"#f5f3ff",secondary:"#a78bfa",muted:"#6d5eac"},"#3b3266");p("Onyx",{primary:"#60a5fa",primaryHover:"#3b82f6",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#000000",secondary:"#0a0a0a",tertiary:"#171717",hover:"#171717"},{primary:"#ffffff",secondary:"#a3a3a3",muted:"#525252"},"#262626");p("Carbon",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#67e8f9"},{primary:"#161616",secondary:"#262626",tertiary:"#393939",hover:"#393939"},{primary:"#f4f4f4",secondary:"#c6c6c6",muted:"#6f6f6f"},"#525252");p("Cosmos",{primary:"#6366f1",primaryHover:"#4f46e5",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#030712",secondary:"#111827",tertiary:"#1f2937",hover:"#1f2937"},{primary:"#e5e7eb",secondary:"#9ca3af",muted:"#4b5563"},"#374151");p("Nebula",{primary:"#e879f9",primaryHover:"#d946ef",success:"#4ade80",warning:"#fbbf24",error:"#fb7185",info:"#67e8f9"},{primary:"#0d0117",secondary:"#1a0533",tertiary:"#2d0a52",hover:"#2d0a52"},{primary:"#fae8ff",secondary:"#d8b4fe",muted:"#7c3aed"},"#581c87");p("Abyss",{primary:"#22d3ee",primaryHover:"#06b6d4",success:"#34d399",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#001219",secondary:"#002a3a",tertiary:"#003e54",hover:"#003e54"},{primary:"#e0f2fe",secondary:"#7dd3fc",muted:"#0369a1"},"#075985");p("Shadow",{primary:"#a3a3a3",primaryHover:"#737373",success:"#4ade80",warning:"#facc15",error:"#f87171",info:"#38bdf8"},{primary:"#171717",secondary:"#1f1f1f",tertiary:"#2a2a2a",hover:"#2a2a2a"},{primary:"#e5e5e5",secondary:"#a3a3a3",muted:"#525252"},"#404040");p("Emerald Dark",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fbbf24",error:"#f87171",info:"#22d3ee"},{primary:"#022c22",secondary:"#064e3b",tertiary:"#065f46",hover:"#065f46"},{primary:"#ecfdf5",secondary:"#6ee7b7",muted:"#047857"},"#047857");t("Forest",{primary:"#166534",primaryHover:"#14532d",success:"#22c55e",warning:"#ca8a04",error:"#dc2626",info:"#0891b2"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");t("Ocean",{primary:"#0369a1",primaryHover:"#075985",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#38bdf8"},"#7dd3fc");t("Desert",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#422006",secondary:"#713f12",muted:"#ca8a04"},"#fde047");t("Sunset",{primary:"#ea580c",primaryHover:"#c2410c",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#431407",secondary:"#9a3412",muted:"#f97316"},"#fdba74");t("Aurora",{primary:"#0d9488",primaryHover:"#0f766e",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdfa",secondary:"#ccfbf1",tertiary:"#99f6e4",hover:"#ccfbf1"},{primary:"#134e4a",secondary:"#115e59",muted:"#2dd4bf"},"#5eead4");t("Lavender",{primary:"#7e22ce",primaryHover:"#6b21a8",success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#3b0764",secondary:"#581c87",muted:"#a855f7"},"#d8b4fe");t("Autumn",{primary:"#c2410c",primaryHover:"#9a3412",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#7f1d1d",muted:"#f87171"},"#fca5a5");t("Spring",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#06b6d4"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#14532d",secondary:"#166534",muted:"#4ade80"},"#86efac");t("Arctic",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");t("Tropical",{primary:"#0d9488",primaryHover:"#0f766e",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");t("Pastel Rose",{primary:"#f472b6",primaryHover:"#ec4899",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#f9a8d4");t("Pastel Sky",{primary:"#38bdf8",primaryHover:"#0ea5e9",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#075985",secondary:"#0369a1",muted:"#7dd3fc"},"#bae6fd");t("Pastel Mint",{primary:"#34d399",primaryHover:"#10b981",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#ecfdf5",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#065f46",secondary:"#047857",muted:"#6ee7b7"},"#a7f3d0");t("Pastel Peach",{primary:"#fb923c",primaryHover:"#f97316",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fff7ed",secondary:"#ffedd5",tertiary:"#fed7aa",hover:"#ffedd5"},{primary:"#7c2d12",secondary:"#9a3412",muted:"#fdba74"},"#fed7aa");t("Pastel Lavender",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f5f3ff",secondary:"#ede9fe",tertiary:"#ddd6fe",hover:"#ede9fe"},{primary:"#4c1d95",secondary:"#5b21b6",muted:"#c4b5fd"},"#ddd6fe");t("Pastel Lemon",{primary:"#facc15",primaryHover:"#eab308",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fefce8",secondary:"#fef9c3",tertiary:"#fef08a",hover:"#fef9c3"},{primary:"#713f12",secondary:"#854d0e",muted:"#fde047"},"#fef08a");t("Pastel Sage",{primary:"#86efac",primaryHover:"#4ade80",success:"#22c55e",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#166534",secondary:"#15803d",muted:"#86efac"},"#bbf7d0");t("Pastel Coral",{primary:"#fb7185",primaryHover:"#f43f5e",success:"#4ade80",warning:"#fcd34d",error:"#ef4444",info:"#67e8f9"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#881337",secondary:"#9f1239",muted:"#fda4af"},"#fecdd3");t("Banking",{primary:"#1e3a5f",primaryHover:"#152c4a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#334155",muted:"#94a3b8"},"#cbd5e1");t("Healthcare",{primary:"#0891b2",primaryHover:"#0e7490",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#f0fdfa",secondary:"#e0f7fa",tertiary:"#b2ebf2",hover:"#e0f7fa"},{primary:"#134e4a",secondary:"#1a6b6a",muted:"#80cbc4"},"#b2dfdb");t("Legal",{primary:"#1e293b",primaryHover:"#0f172a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0284c7"},{primary:"#fafaf9",secondary:"#f5f5f4",tertiary:"#e7e5e4",hover:"#e7e5e4"},{primary:"#0f172a",secondary:"#44403c",muted:"#a8a29e"},"#d6d3d1");t("Tech Startup",{primary:"#7c3aed",primaryHover:"#6d28d9",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#faf5ff",secondary:"#f3e8ff",tertiary:"#e9d5ff",hover:"#f3e8ff"},{primary:"#1e1b4b",secondary:"#4c1d95",muted:"#a78bfa"},"#c4b5fd");t("Enterprise",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#60a5fa"},"#93c5fd");t("Government",{primary:"#1d4ed8",primaryHover:"#1e40af",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#f8fafc",secondary:"#f1f5f9",tertiary:"#e2e8f0",hover:"#e2e8f0"},{primary:"#0f172a",secondary:"#1e293b",muted:"#64748b"},"#cbd5e1");t("Education",{primary:"#059669",primaryHover:"#047857",success:"#16a34a",warning:"#f59e0b",error:"#ef4444",info:"#0891b2"},{primary:"#f0fdf9",secondary:"#d1fae5",tertiary:"#a7f3d0",hover:"#d1fae5"},{primary:"#064e3b",secondary:"#065f46",muted:"#6ee7b7"},"#a7f3d0");t("Real Estate",{primary:"#92400e",primaryHover:"#78350f",success:"#059669",warning:"#b45309",error:"#dc2626",info:"#0891b2"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#422006",secondary:"#713f12",muted:"#d97706"},"#fcd34d");t("Nord",{primary:"#5e81ac",primaryHover:"#4c6b90",success:"#a3be8c",warning:"#ebcb8b",error:"#bf616a",info:"#88c0d0"},{primary:"#eceff4",secondary:"#e5e9f0",tertiary:"#d8dee9",hover:"#d8dee9"},{primary:"#2e3440",secondary:"#3b4252",muted:"#4c566a"},"#d8dee9");p("Dracula",{primary:"#bd93f9",primaryHover:"#9d79d9",success:"#50fa7b",warning:"#f1fa8c",error:"#ff5555",info:"#8be9fd"},{primary:"#282a36",secondary:"#343746",tertiary:"#44475a",hover:"#44475a"},{primary:"#f8f8f2",secondary:"#c0c0c0",muted:"#6272a4"},"#44475a");t("Solarized Light",{primary:"#268bd2",primaryHover:"#1a6da0",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#fdf6e3",secondary:"#eee8d5",tertiary:"#e0dbc7",hover:"#eee8d5"},{primary:"#073642",secondary:"#586e75",muted:"#93a1a1"},"#eee8d5");p("Solarized Dark",{primary:"#268bd2",primaryHover:"#3d98db",success:"#859900",warning:"#b58900",error:"#dc322f",info:"#2aa198"},{primary:"#002b36",secondary:"#073642",tertiary:"#0a4858",hover:"#073642"},{primary:"#eee8d5",secondary:"#93a1a1",muted:"#586e75"},"#073642");p("Monokai",{primary:"#66d9ef",primaryHover:"#45c0d6",success:"#a6e22e",warning:"#e6db74",error:"#f92672",info:"#66d9ef"},{primary:"#272822",secondary:"#34352e",tertiary:"#3e3d32",hover:"#3e3d32"},{primary:"#f8f8f2",secondary:"#cfcfc2",muted:"#75715e"},"#3e3d32");p("One Dark",{primary:"#61afef",primaryHover:"#4b9ee0",success:"#98c379",warning:"#e5c07b",error:"#e06c75",info:"#56b6c2"},{primary:"#282c34",secondary:"#2c313a",tertiary:"#353b45",hover:"#353b45"},{primary:"#abb2bf",secondary:"#828997",muted:"#545862"},"#3e4452");p("Synthwave",{primary:"#ff7edb",primaryHover:"#e660c2",success:"#72f1b8",warning:"#fede5d",error:"#fe4450",info:"#36f9f6"},{primary:"#241b2f",secondary:"#2d2140",tertiary:"#362a50",hover:"#362a50"},{primary:"#f0e4fc",secondary:"#b4a0cc",muted:"#6c5c84"},"#4a3866");t("Vaporwave",{primary:"#ff71ce",primaryHover:"#e655b5",success:"#78dcca",warning:"#ffb86c",error:"#ff5555",info:"#76e8fc"},{primary:"#fce4f7",secondary:"#e8d0f4",tertiary:"#d4bcf0",hover:"#e8d0f4"},{primary:"#4a1a4e",secondary:"#7b3f7d",muted:"#c080c0"},"#d8a8e8");p("Terminal Green",{primary:"#00ff41",primaryHover:"#00cc34",success:"#00ff41",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0a0a0a",secondary:"#0d1a0d",tertiary:"#1a2e1a",hover:"#1a2e1a"},{primary:"#00ff41",secondary:"#00cc33",muted:"#008822"},"#003300");t("Sepia",{primary:"#8b6914",primaryHover:"#704f10",success:"#6b8e23",warning:"#cd853f",error:"#b22222",info:"#5f9ea0"},{primary:"#faf0e6",secondary:"#f5e6d3",tertiary:"#eddcc7",hover:"#f5e6d3"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#d7ccc8");t("Vintage",{primary:"#8d6e63",primaryHover:"#6d4c41",success:"#66bb6a",warning:"#ffb300",error:"#e53935",info:"#29b6f6"},{primary:"#efebe9",secondary:"#d7ccc8",tertiary:"#bcaaa4",hover:"#d7ccc8"},{primary:"#3e2723",secondary:"#5d4037",muted:"#a1887f"},"#bcaaa4");p("Cyberpunk",{primary:"#00f0ff",primaryHover:"#00c8d4",success:"#39ff14",warning:"#ffff00",error:"#ff003c",info:"#bf00ff"},{primary:"#0a0e17",secondary:"#131824",tertiary:"#1c2333",hover:"#1c2333"},{primary:"#e0fbfc",secondary:"#80d4dd",muted:"#3a6b72"},"#1c3a44");p("Neon",{primary:"#ff00ff",primaryHover:"#cc00cc",success:"#00ff00",warning:"#ffff00",error:"#ff0000",info:"#00ffff"},{primary:"#0d0d0d",secondary:"#1a1a1a",tertiary:"#262626",hover:"#262626"},{primary:"#ffffff",secondary:"#cccccc",muted:"#666666"},"#333333");p("Retrowave",{primary:"#f77fbe",primaryHover:"#e462a3",success:"#72f1b8",warning:"#ffe261",error:"#ff4444",info:"#79e8fb"},{primary:"#1b0a2e",secondary:"#261440",tertiary:"#321e52",hover:"#321e52"},{primary:"#ffe6f7",secondary:"#c9a0c9",muted:"#6b4c7a"},"#4a2d66");t("Christmas",{primary:"#c41e3a",primaryHover:"#a01830",success:"#228b22",warning:"#ffd700",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");p("Halloween",{primary:"#ff6600",primaryHover:"#e05500",success:"#4ade80",warning:"#fbbf24",error:"#ff0000",info:"#9333ea"},{primary:"#1a0a00",secondary:"#2d1500",tertiary:"#402000",hover:"#402000"},{primary:"#ffedd5",secondary:"#fdba74",muted:"#9a5c28"},"#5c3400");t("Valentine",{primary:"#e11d48",primaryHover:"#be123c",success:"#10b981",warning:"#f59e0b",error:"#dc2626",info:"#ec4899"},{primary:"#fff1f2",secondary:"#ffe4e6",tertiary:"#fecdd3",hover:"#ffe4e6"},{primary:"#4c0519",secondary:"#881337",muted:"#f9a8d4"},"#fda4af");t("Easter",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#4ade80",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#fef9ff",secondary:"#f3e8ff",tertiary:"#e8d5ff",hover:"#f3e8ff"},{primary:"#581c87",secondary:"#6d28d9",muted:"#c4b5fd"},"#ddd6fe");t("Summer Beach",{primary:"#0ea5e9",primaryHover:"#0284c7",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#0c4a6e",secondary:"#0369a1",muted:"#7dd3fc"},"#fcd34d");t("Winter Frost",{primary:"#3b82f6",primaryHover:"#2563eb",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#f0f9ff",secondary:"#e0f2fe",tertiary:"#bae6fd",hover:"#e0f2fe"},{primary:"#1e3a5f",secondary:"#1e40af",muted:"#93c5fd"},"#bfdbfe");t("Cherry Blossom",{primary:"#ec4899",primaryHover:"#db2777",success:"#10b981",warning:"#f59e0b",error:"#ef4444",info:"#06b6d4"},{primary:"#fdf2f8",secondary:"#fce7f3",tertiary:"#fbcfe8",hover:"#fce7f3"},{primary:"#831843",secondary:"#9d174d",muted:"#f9a8d4"},"#fbcfe8");t("Harvest",{primary:"#b45309",primaryHover:"#92400e",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#78350f",muted:"#d97706"},"#fcd34d");t("Japanese Zen",{primary:"#6b7280",primaryHover:"#4b5563",success:"#6b8e23",warning:"#d4a017",error:"#c0392b",info:"#5f9ea0"},{primary:"#faf9f6",secondary:"#f0ece3",tertiary:"#e6e0d4",hover:"#f0ece3"},{primary:"#2c2c2c",secondary:"#5c5c5c",muted:"#a0998a"},"#d5cec0");t("Moroccan",{primary:"#c2410c",primaryHover:"#9a3412",success:"#15803d",warning:"#ca8a04",error:"#b91c1c",info:"#0e7490"},{primary:"#fffbf0",secondary:"#fef3e0",tertiary:"#fde6c4",hover:"#fef3e0"},{primary:"#3a1a00",secondary:"#7c2d12",muted:"#d97706"},"#f5d0a0");t("Scandinavian",{primary:"#4b5563",primaryHover:"#374151",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",hover:"#f3f4f6"},{primary:"#111827",secondary:"#374151",muted:"#9ca3af"},"#e5e7eb");t("Mediterranean",{primary:"#1e40af",primaryHover:"#1e3a8a",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#eff6ff",secondary:"#dbeafe",tertiary:"#bfdbfe",hover:"#dbeafe"},{primary:"#1e3a5f",secondary:"#2563eb",muted:"#93c5fd"},"#bfdbfe");t("Chinese New Year",{primary:"#dc2626",primaryHover:"#b91c1c",success:"#16a34a",warning:"#d4a017",error:"#ef4444",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fee2e2",tertiary:"#fecaca",hover:"#fee2e2"},{primary:"#450a0a",secondary:"#991b1b",muted:"#f87171"},"#fca5a5");t("Indian Festive",{primary:"#d97706",primaryHover:"#b45309",success:"#16a34a",warning:"#ca8a04",error:"#dc2626",info:"#7c3aed"},{primary:"#fffbeb",secondary:"#fef3c7",tertiary:"#fde68a",hover:"#fef3c7"},{primary:"#451a03",secondary:"#92400e",muted:"#f59e0b"},"#fcd34d");t("Brazilian Carnival",{primary:"#16a34a",primaryHover:"#15803d",success:"#22c55e",warning:"#facc15",error:"#ef4444",info:"#0ea5e9"},{primary:"#f0fdf4",secondary:"#dcfce7",tertiary:"#bbf7d0",hover:"#dcfce7"},{primary:"#052e16",secondary:"#166534",muted:"#4ade80"},"#86efac");t("African Earth",{primary:"#92400e",primaryHover:"#78350f",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf5f0",secondary:"#f0e6d6",tertiary:"#e6d5bb",hover:"#f0e6d6"},{primary:"#2b1a0e",secondary:"#5c3d1e",muted:"#a08060"},"#d4b896");p("High Contrast Dark",{primary:"#ffff00",primaryHover:"#cccc00",success:"#00ff00",warning:"#ff8c00",error:"#ff0000",info:"#00ffff"},{primary:"#000000",secondary:"#1a1a1a",tertiary:"#333333",hover:"#333333"},{primary:"#ffffff",secondary:"#ffffff",muted:"#cccccc"},"#ffffff");t("Monochrome",{primary:"#404040",primaryHover:"#262626",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#fafafa",secondary:"#f0f0f0",tertiary:"#e0e0e0",hover:"#e0e0e0"},{primary:"#1a1a1a",secondary:"#404040",muted:"#808080"},"#c0c0c0");t("Enhanced Contrast",{primary:"#0050b3",primaryHover:"#003d8c",success:"#006400",warning:"#cc7000",error:"#cc0000",info:"#006680"},{primary:"#ffffff",secondary:"#f5f5f5",tertiary:"#ebebeb",hover:"#ebebeb"},{primary:"#000000",secondary:"#1a1a1a",muted:"#595959"},"#8c8c8c");t("Minimalist",{primary:"#18181b",primaryHover:"#27272a",success:"#22c55e",warning:"#eab308",error:"#ef4444",info:"#3b82f6"},{primary:"#ffffff",secondary:"#fafafa",tertiary:"#f5f5f5",hover:"#f5f5f5"},{primary:"#0a0a0a",secondary:"#404040",muted:"#a3a3a3"},"#e5e5e5");p("Warm Dark",{primary:"#f59e0b",primaryHover:"#d97706",success:"#10b981",warning:"#fbbf24",error:"#f87171",info:"#38bdf8"},{primary:"#1c1917",secondary:"#292524",tertiary:"#44403c",hover:"#44403c"},{primary:"#fafaf9",secondary:"#d6d3d1",muted:"#78716c"},"#57534e");p("Soft Dark",{primary:"#a78bfa",primaryHover:"#8b5cf6",success:"#34d399",warning:"#fcd34d",error:"#fb7185",info:"#67e8f9"},{primary:"#1e1e2e",secondary:"#262637",tertiary:"#313147",hover:"#313147"},{primary:"#e8e8f0",secondary:"#a0a0b8",muted:"#5c5c74"},"#3e3e58");t("Coffee",{primary:"#6f4e37",primaryHover:"#5c3d28",success:"#4d7c0f",warning:"#a16207",error:"#b91c1c",info:"#0e7490"},{primary:"#faf6f1",secondary:"#f0e8dc",tertiary:"#e6d8c6",hover:"#f0e8dc"},{primary:"#2c1a0e",secondary:"#5c3d28",muted:"#a08868"},"#d4c4a8");t("Wine",{primary:"#7f1d1d",primaryHover:"#641717",success:"#059669",warning:"#d97706",error:"#dc2626",info:"#0891b2"},{primary:"#fef2f2",secondary:"#fde8e8",tertiary:"#f8d0d0",hover:"#fde8e8"},{primary:"#3b0a0a",secondary:"#7f1d1d",muted:"#dc6868"},"#e8a0a0");f.createContext(null);f.createContext(null);const B={broker:"localhost",port:1883,clientId:`nice2dev-${Date.now()}`,useTLS:!1,keepAlive:60,cleanSession:!0,topics:[]},O={host:"localhost",port:5683,useDTLS:!1,resources:[]},q={type:"tcp",host:"localhost",port:502,slaveId:1,timeout:1e3,registers:[]},z={endpointUrl:"opc.tcp://localhost:4840",securityMode:"None",authentication:"anonymous",applicationName:"Nice2Dev IoT Client",nodes:[]};function Ne({protocol:r="mqtt",config:s,onSave:a,onTest:i,className:c=""}){const{t:n}=M(),[o,d]=f.useState(r),[b,m]=f.useState((s==null?void 0:s.type)==="mqtt"?{...B,...s.config}:B),[v,x]=f.useState((s==null?void 0:s.type)==="coap"?{...O,...s.config}:O),[u,h]=f.useState((s==null?void 0:s.type)==="modbus"?{...q,...s.config}:q),[g,N]=f.useState((s==null?void 0:s.type)==="opcua"?{...z,...s.config}:z),[k,j]=f.useState(null),[T,y]=f.useState(!1),_=f.useCallback(()=>{switch(o){case"mqtt":return b;case"coap":return v;case"modbus-tcp":case"modbus-rtu":return u;case"opcua":return g;default:return b}},[o,b,v,u,g]),R=f.useCallback(()=>{a==null||a(_())},[_,a]),I=f.useCallback(async()=>{if(i){y(!0),j(null);try{const S=await i(_());j(S)}catch(S){j({success:!1,message:String(S)})}finally{y(!1)}}},[_,i]);return e.jsxs("div",{className:`nice-protocol-config ${c}`,children:[e.jsxs("header",{className:"nice-protocol-config__header",children:[e.jsx("h2",{children:n("protocolConfig.title","Protocol Configuration")}),e.jsxs("div",{className:"nice-protocol-config__protocol-selector",children:[e.jsx("label",{children:"Protocol:"}),e.jsxs("select",{value:o,onChange:S=>d(S.target.value),children:[e.jsx("option",{value:"mqtt",children:n("protocolConfig.mqtt","MQTT")}),e.jsx("option",{value:"coap",children:n("protocolConfig.coap","CoAP")}),e.jsx("option",{value:"modbus-tcp",children:n("protocolConfig.modbusTcp","Modbus TCP")}),e.jsx("option",{value:"modbus-rtu",children:n("protocolConfig.modbusRtu","Modbus RTU")}),e.jsx("option",{value:"opcua",children:n("protocolConfig.opcUa","OPC-UA")})]})]})]}),e.jsxs("div",{className:"nice-protocol-config__content",children:[o==="mqtt"&&e.jsx(we,{config:b,onChange:m}),o==="coap"&&e.jsx(Ce,{config:v,onChange:x}),(o==="modbus-tcp"||o==="modbus-rtu")&&e.jsx(ke,{config:u,type:o==="modbus-rtu"?"rtu":"tcp",onChange:h}),o==="opcua"&&e.jsx(Se,{config:g,onChange:N})]}),k&&e.jsxs("div",{className:`nice-protocol-config__test-result nice-protocol-config__test-result--${k.success?"success":"error"}`,children:[k.success?"βœ“":"βœ—"," ",k.message]}),e.jsxs("footer",{className:"nice-protocol-config__footer",children:[e.jsx("button",{className:"nice-protocol-config__test-btn",onClick:I,disabled:T||!i,children:T?"Testing...":"πŸ”Œ Test Connection"}),e.jsx("button",{className:"nice-protocol-config__save-btn",onClick:R,children:"πŸ’Ύ Save"})]})]})}function we({config:r,onChange:s}){const{t:a}=M();return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:a("protocolConfig.mqttConfiguration","MQTT Configuration")}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.broker","Broker")}),e.jsx("input",{type:"text",value:r.broker,onChange:i=>s({...r,broker:i.target.value}),placeholder:"localhost"})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.port","Port")}),e.jsx("input",{type:"number",value:r.port,onChange:i=>s({...r,port:parseInt(i.target.value,10)||1883})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.clientId","Client ID")}),e.jsx("input",{type:"text",value:r.clientId,onChange:i=>s({...r,clientId:i.target.value})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.useTLS,onChange:i=>s({...r,useTLS:i.target.checked})}),a("protocolConfig.useTls","Use TLS")]})}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.username","Username")}),e.jsx("input",{type:"text",value:r.username||"",onChange:i=>s({...r,username:i.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.password","Password")}),e.jsx("input",{type:"password",value:r.password||"",onChange:i=>s({...r,password:i.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Keep Alive (seconds)"}),e.jsx("input",{type:"number",value:r.keepAlive,onChange:i=>s({...r,keepAlive:parseInt(i.target.value,10)||60})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.cleanSession,onChange:i=>s({...r,cleanSession:i.target.checked})}),a("protocolConfig.cleanSession","Clean Session")]})})]}),e.jsx("h4",{children:a("protocolConfig.topics","Topics")}),e.jsxs("div",{className:"nice-protocol-config__topics",children:[r.topics.map((i,c)=>e.jsxs("div",{className:"nice-protocol-config__topic-row",children:[e.jsx("input",{type:"text",value:i.pattern,onChange:n=>{const o=[...r.topics];o[c]={...o[c],pattern:n.target.value},s({...r,topics:o})},placeholder:a("protocolConfig.topicPatternPlaceholder","e.g., sensors/+/data")}),e.jsxs("select",{value:i.qos,onChange:n=>{const o=[...r.topics];o[c]={...o[c],qos:parseInt(n.target.value,10)},s({...r,topics:o})},children:[e.jsx("option",{value:0,children:a("protocolConfig.qos0","QoS 0")}),e.jsx("option",{value:1,children:a("protocolConfig.qos1","QoS 1")}),e.jsx("option",{value:2,children:a("protocolConfig.qos2","QoS 2")})]}),e.jsxs("select",{value:i.direction,onChange:n=>{const o=[...r.topics];o[c]={...o[c],direction:n.target.value},s({...r,topics:o})},children:[e.jsx("option",{value:"subscribe",children:a("protocolConfig.subscribe","Subscribe")}),e.jsx("option",{value:"publish",children:a("protocolConfig.publish","Publish")}),e.jsx("option",{value:"both",children:a("protocolConfig.both","Both")})]}),e.jsx("button",{onClick:()=>{const n=r.topics.filter((o,d)=>d!==c);s({...r,topics:n})},children:"Γ—"})]},c)),e.jsx("button",{onClick:()=>{s({...r,topics:[...r.topics,{pattern:"",qos:0,direction:"subscribe",payloadFormat:"json"}]})},children:"+ Add Topic"})]})]})}function Ce({config:r,onChange:s}){const{t:a}=M();return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:a("protocolConfig.coapConfiguration","CoAP Configuration")}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.host","Host")}),e.jsx("input",{type:"text",value:r.host,onChange:i=>s({...r,host:i.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.port","Port")}),e.jsx("input",{type:"number",value:r.port,onChange:i=>s({...r,port:parseInt(i.target.value,10)||5683})})]}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.useDTLS,onChange:i=>s({...r,useDTLS:i.target.checked})}),a("protocolConfig.useDtls","Use DTLS")]})}),e.jsx("div",{className:"nice-protocol-config__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:r.observe||!1,onChange:i=>s({...r,observe:i.target.checked})}),a("protocolConfig.enableObserve","Enable Observe")]})})]}),e.jsx("h4",{children:a("protocolConfig.resources","Resources")}),e.jsxs("div",{className:"nice-protocol-config__resources",children:[r.resources.map((i,c)=>e.jsxs("div",{className:"nice-protocol-config__resource-row",children:[e.jsx("input",{type:"text",value:i.path,onChange:n=>{const o=[...r.resources];o[c]={...o[c],path:n.target.value},s({...r,resources:o})},placeholder:"/sensors/temperature"}),e.jsx("button",{onClick:()=>{const n=r.resources.filter((o,d)=>d!==c);s({...r,resources:n})},children:"Γ—"})]},c)),e.jsx("button",{onClick:()=>{s({...r,resources:[...r.resources,{path:"",methods:["GET"],mediaType:"application/json",observable:!1}]})},children:"+ Add Resource"})]})]})}function ke({config:r,type:s,onChange:a}){const{t:i}=M();return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsxs("h3",{children:["Modbus ",s.toUpperCase()," Configuration"]}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[s==="tcp"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.host","Host")}),e.jsx("input",{type:"text",value:r.host||"",onChange:c=>a({...r,host:c.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.port","Port")}),e.jsx("input",{type:"number",value:r.port||502,onChange:c=>a({...r,port:parseInt(c.target.value,10)||502})})]})]}),s==="rtu"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.serialPort","Serial Port")}),e.jsx("input",{type:"text",value:r.serialPort||"",onChange:c=>a({...r,serialPort:c.target.value}),placeholder:i("protocolConfig.serialPortPlaceholder","COM1 or /dev/ttyUSB0")})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.baudRate","Baud Rate")}),e.jsxs("select",{value:r.baudRate||9600,onChange:c=>a({...r,baudRate:parseInt(c.target.value,10)}),children:[e.jsx("option",{value:9600,children:"9600"}),e.jsx("option",{value:19200,children:"19200"}),e.jsx("option",{value:38400,children:"38400"}),e.jsx("option",{value:57600,children:"57600"}),e.jsx("option",{value:115200,children:"115200"})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.parity","Parity")}),e.jsxs("select",{value:r.parity||"none",onChange:c=>a({...r,parity:c.target.value}),children:[e.jsx("option",{value:"none",children:i("protocolConfig.none","None")}),e.jsx("option",{value:"even",children:i("protocolConfig.even","Even")}),e.jsx("option",{value:"odd",children:"Odd"})]})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:i("protocolConfig.slaveId","Slave ID")}),e.jsx("input",{type:"number",value:r.slaveId,onChange:c=>a({...r,slaveId:parseInt(c.target.value,10)||1}),min:1,max:247})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:"Timeout (ms)"}),e.jsx("input",{type:"number",value:r.timeout,onChange:c=>a({...r,timeout:parseInt(c.target.value,10)||1e3})})]})]}),e.jsx("h4",{children:i("protocolConfig.registers","Registers")}),e.jsxs("table",{className:"nice-protocol-config__registers-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:i("protocolConfig.name","Name")}),e.jsx("th",{children:i("protocolConfig.address","Address")}),e.jsx("th",{children:i("protocolConfig.type","Type")}),e.jsx("th",{children:i("protocolConfig.dataType","Data Type")}),e.jsx("th",{children:"R/W"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.registers.map((c,n)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("input",{type:"text",value:c.name,onChange:o=>{const d=[...r.registers];d[n]={...d[n],name:o.target.value},a({...r,registers:d})}})}),e.jsx("td",{children:e.jsx("input",{type:"number",value:c.address,onChange:o=>{const d=[...r.registers];d[n]={...d[n],address:parseInt(o.target.value,10)||0},a({...r,registers:d})}})}),e.jsx("td",{children:e.jsxs("select",{value:c.type,onChange:o=>{const d=[...r.registers];d[n]={...d[n],type:o.target.value},a({...r,registers:d})},children:[e.jsx("option",{value:"coil",children:i("protocolConfig.coil","Coil")}),e.jsx("option",{value:"discrete",children:i("protocolConfig.discrete","Discrete")}),e.jsx("option",{value:"holding",children:i("protocolConfig.holding","Holding")}),e.jsx("option",{value:"input",children:i("protocolConfig.input","Input")})]})}),e.jsx("td",{children:e.jsxs("select",{value:c.dataType,onChange:o=>{const d=[...r.registers];d[n]={...d[n],dataType:o.target.value},a({...r,registers:d})},children:[e.jsx("option",{value:"bool",children:i("protocolConfig.bool","Bool")}),e.jsx("option",{value:"int16",children:i("protocolConfig.int16","Int16")}),e.jsx("option",{value:"uint16",children:i("protocolConfig.uint16","UInt16")}),e.jsx("option",{value:"int32",children:i("protocolConfig.int32","Int32")}),e.jsx("option",{value:"uint32",children:i("protocolConfig.uint32","UInt32")}),e.jsx("option",{value:"float32",children:i("protocolConfig.float32","Float32")})]})}),e.jsxs("td",{children:[e.jsx("input",{type:"checkbox",checked:c.readable,onChange:o=>{const d=[...r.registers];d[n]={...d[n],readable:o.target.checked},a({...r,registers:d})},title:i("protocolConfig.readable","Readable")}),e.jsx("input",{type:"checkbox",checked:c.writable,onChange:o=>{const d=[...r.registers];d[n]={...d[n],writable:o.target.checked},a({...r,registers:d})},title:i("protocolConfig.writable","Writable")})]}),e.jsx("td",{children:e.jsx("button",{onClick:()=>{const o=r.registers.filter((d,b)=>b!==n);a({...r,registers:o})},children:"Γ—"})})]},n))})]}),e.jsx("button",{onClick:()=>{a({...r,registers:[...r.registers,{name:"",address:0,type:"holding",dataType:"uint16",readable:!0,writable:!1}]})},children:"+ Add Register"})]})}function Se({config:r,onChange:s}){const{t:a}=M();return e.jsxs("div",{className:"nice-protocol-config__section",children:[e.jsx("h3",{children:a("protocolConfig.opcUaConfiguration","OPC-UA Configuration")}),e.jsxs("div",{className:"nice-protocol-config__grid",children:[e.jsxs("div",{className:"nice-protocol-config__field nice-protocol-config__field--full",children:[e.jsx("label",{children:a("protocolConfig.endpointUrl","Endpoint URL")}),e.jsx("input",{type:"text",value:r.endpointUrl,onChange:i=>s({...r,endpointUrl:i.target.value}),placeholder:a("protocolConfig.endpointUrlPlaceholder","opc.tcp://localhost:4840")})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.securityMode","Security Mode")}),e.jsxs("select",{value:r.securityMode,onChange:i=>s({...r,securityMode:i.target.value}),children:[e.jsx("option",{value:"None",children:a("protocolConfig.securityNone","None")}),e.jsx("option",{value:"Sign",children:a("protocolConfig.sign","Sign")}),e.jsx("option",{value:"SignAndEncrypt",children:a("protocolConfig.signAndEncrypt","Sign and Encrypt")})]})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.authentication","Authentication")}),e.jsxs("select",{value:r.authentication,onChange:i=>s({...r,authentication:i.target.value}),children:[e.jsx("option",{value:"anonymous",children:a("protocolConfig.anonymous","Anonymous")}),e.jsx("option",{value:"username",children:"Username/Password"}),e.jsx("option",{value:"certificate",children:a("protocolConfig.certificate","Certificate")})]})]}),r.authentication==="username"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.username","Username")}),e.jsx("input",{type:"text",value:r.username||"",onChange:i=>s({...r,username:i.target.value})})]}),e.jsxs("div",{className:"nice-protocol-config__field",children:[e.jsx("label",{children:a("protocolConfig.password","Password")}),e.jsx("input",{type:"password",value:r.password||"",onChange:i=>s({...r,password:i.target.value})})]})]}),e.jsxs("div",{className:"nice-protocol-config__field nice-protocol-config__field--full",children:[e.jsx("label",{children:a("protocolConfig.applicationName","Application Name")}),e.jsx("input",{type:"text",value:r.applicationName,onChange:i=>s({...r,applicationName:i.target.value})})]})]}),e.jsx("h4",{children:a("protocolConfig.nodes","Nodes")}),e.jsxs("div",{className:"nice-protocol-config__nodes",children:[r.nodes.map((i,c)=>e.jsxs("div",{className:"nice-protocol-config__node-row",children:[e.jsx("input",{type:"text",value:i.nodeId,onChange:n=>{const o=[...r.nodes];o[c]={...o[c],nodeId:n.target.value},s({...r,nodes:o})},placeholder:a("protocolConfig.nodeIdPlaceholder","ns=2;s=Temperature")}),e.jsx("input",{type:"text",value:i.displayName,onChange:n=>{const o=[...r.nodes];o[c]={...o[c],displayName:n.target.value},s({...r,nodes:o})},placeholder:a("protocolConfig.displayNamePlaceholder","Display Name")}),e.jsx("button",{onClick:()=>{const n=r.nodes.filter((o,d)=>d!==c);s({...r,nodes:n})},children:"Γ—"})]},c)),e.jsx("button",{onClick:()=>{s({...r,nodes:[...r.nodes,{nodeId:"",displayName:"",dataType:"Double",read:!0}]})},children:"+ Add Node"})]})]})}exports.NiceEdgeManager=ne;exports.NiceIoTDashboard=Z;exports.NiceProtocolConfig=Ne;