6 lines
172 KiB
JavaScript
6 lines
172 KiB
JavaScript
|
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function s(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=s(i);fetch(i.href,o)}})();function ns(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const se={},yt=[],We=()=>{},hn=()=>!1,Sl=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Tl=e=>e.startsWith("onUpdate:"),ve=Object.assign,is=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},Pi=Object.prototype.hasOwnProperty,Q=(e,t)=>Pi.call(e,t),D=Array.isArray,ct=e=>tl(e)==="[object Map]",lt=e=>tl(e)==="[object Set]",Ps=e=>tl(e)==="[object Date]",V=e=>typeof e=="function",ce=e=>typeof e=="string",Ze=e=>typeof e=="symbol",te=e=>e!==null&&typeof e=="object",mn=e=>(te(e)||V(e))&&V(e.then)&&V(e.catch),bn=Object.prototype.toString,tl=e=>bn.call(e),Oi=e=>tl(e).slice(8,-1),vn=e=>tl(e)==="[object Object]",os=e=>ce(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ft=ns(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),$l=e=>{const t=Object.create(null);return(s=>t[s]||(t[s]=e(s)))},qi=/-\w/g,Ee=$l(e=>e.replace(qi,t=>t.slice(1).toUpperCase())),Ei=/\B([A-Z])/g,wt=$l(e=>e.replace(Ei,"-$1").toLowerCase()),gn=$l(e=>e.charAt(0).toUpperCase()+e.slice(1)),Nl=$l(e=>e?`on${gn(e)}`:""),Be=(e,t)=>!Object.is(e,t),dl=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},yn=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},_n=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Os;const Ml=()=>Os||(Os=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ft(e){if(D(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],i=ce(n)?Hi(n):ft(n);if(i)for(const o in i)t[o]=i[o]}return t}else if(ce(e)||te(e))return e}const Ri=/;(?![^(]*\))/g,Di=/:([^]+)/,Ni=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Hi(e){const t={};return e.replace(Ni,s=>s.startsWith("/*")?"":s).split(Ri).forEach(s=>{if(s){const n=s.split(Di);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ze(e){let t="";if(ce(e))t=e;else if(D(e))for(let s=0;s<e.length;s++){const n=ze(e[s]);n&&(t+=n+" ")}else if(te(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const Li="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Fi=ns(Li);function xn(e){return!!e||e===""}function Vi(e,t,s){if(e.length!==t.length)return!1;let n=!0;for(let i=0;n&&i<e.length;i++)n=st(e[i],t[i],s);return n}function qs(e,t,s){if(e.size!==t.size)return!1;const n=Array.from(t),i=new Uint8Array(n.length);for(const o of e){let a=-1;for(let r=0;r<n.length;r++)if(!i[r]&&st(o,n[r],s)){a=r;break}if(a<0)return!1;i[a]=1}return!0}function Ui(e,t,s){let n=ct(e),i=ct(t);if(n||i||(n=lt(e),i=lt(t),n||i))return n&&i?qs(e,t,s):!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const r in e){const c=e.hasOwnProperty(r),f=t.hasOwnProperty(r);if(c&&!f||!c&&f||!st(e[r],t[r],s))return!1}return String(e)===String(t)}function Es(e,t,s,n){s||(s=[new Map,new Map]);const[i,o]=s;if(i.has(e)||o.has(t))return i.get(e)===t&&o.get(t)===e;i.set(e,t),o.set(t,e);const a=n(e,t,s);return i.delete(e),o.delete(t),a}function st(e,t,s){if(e===t)return!0;let n=Ps(e),i=Ps(t);return n||i?n&&i?e.getTime()===t.getTime():!1:(n=Ze(e),i=Ze(t),n||i?e===t:(n=D(e),i=D(t),n||i?n&&i?Es(e,t,s,Vi):!1:(n=te(e),i=te(t),n||i?!n||!i?!1:Es(e,t,s,Ui):String(e)===String(t))))}func
|
||
|
|
`+((o.device.networkHosts||[])[0]||"IP 待填写"),detail:[o.device.name,o.device.deviceType,t(o.device.siteId)||"位置待登记",(o.device.networkHosts||[]).join(" / ")||"IP 待填写",{lan:"局域网",tailscale:"Tailscale",public:"公网"}[o.device.networkAccess]||"接入待确认"].join(`
|
||
|
|
`),x:Math.max(0,o.depth||0)*280,y:a*105,itemStyle:{color:o.device.source==="camera"?"#e1ebfb":"#dceddf",borderColor:o.device.source==="camera"?"#648bcc":"#468b73",borderWidth:1},label:{color:"#213f48"}})),i=e.flatMap(o=>{const a=s.get(o.device.uplinkId);return a&&a.depth+1===o.depth?[{source:a.device.id,target:o.device.id}]:[]});return ji(n,i)}function yr(e=[],t="赵府"){return ji([{id:"platform",name:t,x:0,y:0,symbolSize:[160,65],itemStyle:{color:"#286d5d"},label:{color:"#fff"}},...e.map((s,n)=>({id:"home:"+s.id,targetId:s.id,name:s.name,caption:s.name+`
|
||
|
|
`+Cl(s.deviceCount)+" 台设备",detail:[s.name,{home:"家庭",office:"办公",factory:"工厂"}[s.kind||"home"]||"场所",[s.province,s.city,s.district].filter(Boolean).join(" · "),Cl(s.deviceCount)+" 台已授权设备"].filter(Boolean).join(`
|
||
|
|
`),x:300,y:(n-(e.length-1)/2)*120,itemStyle:{color:"#e3efe8",borderColor:"#8ebaa6",borderWidth:1},label:{color:"#213f48"}}))],e.map(s=>({source:"platform",target:"home:"+s.id})))}const _r="modulepreload",xr=function(e){return"/ui/"+e},pn={},wr=function(t,s,n){let i=Promise.resolve();if(s&&s.length>0){let f=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};var a=f;document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),c=r?.nonce||r?.getAttribute("nonce");i=f(s.map(p=>{if(p=xr(p),p in pn)return;pn[p]=!0;const m=p.endsWith(".css"),w=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${w}`))return;const k=document.createElement("link");if(k.rel=m?"stylesheet":_r,m||(k.as="script"),k.crossOrigin="",k.href=p,c&&k.setAttribute("nonce",c),document.head.appendChild(k),m)return new Promise((W,q)=>{k.addEventListener("load",W),k.addEventListener("error",()=>q(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(r){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=r,window.dispatchEvent(c),!c.defaultPrevented)throw r}return i.then(r=>{for(const c of r||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},kr={class:"local-chart-wrap"},Cr=["aria-label"],Sr={key:0,class:"small text-secondary px-3",role:"status"},At={__name:"LocalChart",props:{option:{type:Object,required:!0},label:String,active:{type:Boolean,default:!0},height:{type:Number,default:260}},emits:["select"],setup(e,{emit:t}){const s=e,n=t,i=fe(null),o=fe(!1);let a,r,c,f,p=!0,m=!1,w="",k="";function W(){a?.dispose(),a=null,w="",k=""}function q(){!f&&p&&(f=requestAnimationFrame(()=>{f=null,ae()}))}async function ae(){if(!p||!i.value||!s.active){W();return}const Z=Math.floor(i.value.clientWidth),U=Math.floor(i.value.clientHeight);if(!Z||!U)return;if(!a){if(m)return;m=!0;try{const P=await wr(()=>import("./charts-runtime-Q8qiYCVP.js"),[]);if(!p||!s.active||!i.value)return;a=P.init(i.value,null,{renderer:"canvas",devicePixelRatio:Math.min(window.devicePixelRatio||1,2)}),a.on("click",J=>{J.data?.targetId&&n("select",J.data.targetId)}),o.value=!1}catch(P){o.value=!0,console.error("Local chart unavailable",P);return}finally{m=!1}}const z=getComputedStyle(document.documentElement),O=z.getPropertyValue("--ink").trim()||"#253b46",ne=z.getPropertyValue("--ui-muted").trim()||"#627485",L=z.getPropertyValue("--ui-line").trim()||"#e3e9ef",x=JSON.stringify(s.option)+O+ne+L;if(x!==w){const P={...s.option,animation:!1,backgroundColor:"transparent",textStyle:{color:O,fontFamily:"system-ui, Microsoft YaHei, sans-serif"},aria:{enabled:!0,description:s.label},tooltip:{trigger:"item",renderMode:"richText",confine:!0,...s.option.tooltip}};for(const J of["xAxis","yAxis"])P[J]&&(P[J]={...P[J],axisLabel:{color:ne,...P[J].axisLabel},splitLine:{lineStyle:{color:L}}});P.series=(P.series||[]).map(J=>({...J,label:{color:O,...J.label}})),a.setOption(P,{notMerge:!0,lazyUpdate:!1}),w=x}const A=Z+":"+U;A!==k&&(a.resize({width:Z,height:U}),k=A)}return dt(()=>[s.option,s.active],q,{deep:!0,flush:"post"}),ys(()=>{r=new ResizeObserver(q),r.observe(i.value),c=new MutationObserver(q),c.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-density"]}),q()}),Xn(()=>{p=!1,cancelAnimationFrame(f),r?.disconnect(),c?.disconnect(),W()}),(Z,U)=>(C(),j("div",kr,[l("div",{ref_key:"host",ref:i,class:"local-chart",role:"img","aria-label":e.label,style:ft({height:e.height+"px"})},null,12,Cr),o.value?(C(),j("p",Sr,"图表暂未加载,可查看下方数据。")):B("",!0)]))}},Tr={class:"col-12 col-xl-4"},$r={class:"dashboard-welcome h-100"},Mr={class:"dashboard-totals"},jr={class:"insight-scope"},Ir={class:"col-12 d-md-none"},Ar=["aria-expanded"],Pr={class:"col-12 col-md-5 col-xl-3 dashboard-chart-column"},Or={class:"chart-card h-100"},qr={class:"chart-heading"},Er={class:"badge"},Rr={key:1,class:"chart-empty"},Dr={class:"chart-legend"},Nr={class:"col-12 col-md-7 col-xl-5 dashboard-chart-column"},Hr={class:"chart-card h
|