1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2831],{45990:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/management/route-health",function(){return r(10831)}])},27871:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},89934:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},23973:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},55975:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},11959:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},18742:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},82303:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},12406:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]])},76919:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]])},6479:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},95239:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]])},42540:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]])},80261:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},22972:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},17909:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(33592).Z)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},23997:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var a=r(85893),s=r(80261),n=r(94364);function i(e){let{open:t,onClose:r,onConfirm:i,title:l,message:c,confirmLabel:d="Confirm",variant:o="danger",loading:x=!1}=e;return(0,a.jsx)(n.Z,{open:t,onClose:r,title:l,size:"sm",footer:(0,a.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,a.jsx)("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",disabled:x,children:"Cancel"}),(0,a.jsx)("button",{onClick:i,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 ".concat("danger"===o?"bg-red-600 hover:bg-red-700 text-white":"bg-amber-500 hover:bg-amber-600 text-white"),disabled:x,children:x?"Processing...":d})]}),children:(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-full flex-shrink-0 ".concat("danger"===o?"bg-red-100":"bg-amber-100"),children:(0,a.jsx)(s.Z,{className:"h-5 w-5 ".concat("danger"===o?"text-red-600":"text-amber-600")})}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:c})]})})}},94364:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var a=r(85893),s=r(67294),n=r(22972);let i={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};function l(e){let{open:t,onClose:r,title:l,children:c,footer:d,size:o="lg",submitting:x}=e,m=(0,s.useId)();return((0,s.useEffect)(()=>
1{if(!t)return;let e=e=>{"Escape"!==e.key||x||r()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,r,x]),(0,s.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t)?(0,a.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":m,className:"fixed inset-0 z-50 flex items-start justify-center pt-[5vh] sm:pt-[10vh]",children:[(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50",onClick:x?void 0:r}),(0,a.jsxs)("div",{className:"relative w-full ".concat(i[o]," mx-4 bg-white dark:bg-gray-800 rounded-xl shadow-xl max-h-[85vh] flex flex-col"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[(0,a.jsx)("h2",{id:m,className:"text-lg font-semibold text-gray-900 dark:text-gray-100 font-heading",children:l}),(0,a.jsx)("button",{onClick:r,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-gray-500 dark:hover:text-gray-300 dark:hover:bg-gray-700 transition-colors","aria-label":"Close",children:(0,a.jsx)(n.Z,{className:"h-5 w-5"})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:c}),d&&(0,a.jsx)("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900 rounded-b-xl",children:d})]})]}):null}},40730:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var a=r(85893);function s(e){let{title:t,description:r,actions:s}=e;return(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 font-heading",children:t}),r&&(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:r})]}),s&&(0,a.jsx)("div",{className:"flex items-center gap-2 flex-shrink-0",children:s})]})}},89680:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var a=r(85893);let s={blue:{bg:"bg-blue-50",icon:"text-blue-600",ring:"ring-blue-100"},green:{bg:"bg-green-50",icon:"text-green-600",ring:"ring-green-100"},amber:{bg:"bg-amber-50",icon:"text-amber-600",ring:"ring-amber-100"},purple:{bg:"bg-purple-50",icon:"text-purple-600",ring:"ring-purple-100"},red:{bg:"bg-red-50",icon:"text-red-600",ring:"ring-red-100"},indigo:{bg:"bg-indigo-50",icon:"text-indigo-600",ring:"ring-indigo-100"},teal:{bg:"bg-teal-50",icon:"text-teal-600",ring:"ring-teal-100"}};function n(e){let{label:t,value:r,icon:n,trend:i,color:l="blue"}=e,c=s[l],d="function"==typeof n||"object"==typeof n&&null!==n&&"render"in n?n:null;return(0,a.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 p-5 hover:shadow-sm transition-shadow",children:(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-500",children:t}),(0,a.jsx)("p",{className:"text-2xl font-semibold text-gray-900",children:r}),i&&(0,a.jsx)("div",{className:"text-xs font-medium text-gray-500",children:i})]}),(0,a.jsx)("div",{className:"p-2.5 rounded-lg ".concat(c.bg," ring-1 ").concat(c.ring),children:d?(0,a.jsx)(d,{className:"h-5 w-5 ".concat(c.icon)}):(0,a.jsx)("span",{className:c.icon,children:n})})]})})}},18189:function(e,t,r){"use strict";r.d(t,{F:function(){return i}});var a=r(67294);function s(){let e=new Date().getHours();return e>=19||e<6?"dark":"light"}function n(e){return"auto"===e?s():e}function i(){let[e,t]=(0,a.useState)("auto"),[r,i]=(0,a.useState)("light"),l=(0,a.useCallback)(e=>{i(e),document.documentElement.classList.toggle("dark","dark"===e)},[]);return(0,a.useEffect)(()=>{let e;let r=localStorage.getItem("theme");t(e="dark"===r||"light"===r||"auto"===r?r:"auto"),l(n(e));let a=window.matchMedia("(prefers-color-scheme: dark)"),s=e=>{localStorage.getItem("theme")||l(e.matches?"dark":"light")};return a.addEventListener("change",s),()=>a.removeEventListener("change",s)},[l]),(0,a.useEffect)(()=>{if("auto"!==e)return;let t=setInterval(()=>{l(s())},6e4);return()=>clearInterval(t)},[e,l]),{theme:e,resolvedTheme:r,toggleTheme:(0,a.useCallback)(()=>{t(e=>{let t="light"===e?"dark":"dark"===e?"auto":"light";return localStorage.setItem("theme",t),l(n(t)),t})},[l])}}},10831:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return z}});var a=r(85893),s=r(84340),n=r(67294),i=r(40730),l=r(89680),c=r(23997),d=r(34539),o=r(64712),x=r(82303),m=r(17909),g=r(27871),u=r(33592);let h=(0,u.Z)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);var p=r(76919),y=r(12406),f=r(114),b=r(23973),j=r(2461);let N=(0,u.Z)("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),v=(0,u.Z)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var k=r(18742),w=r(55975),Z=r(80261),_=r(11959),S=r(89934),C=r(47782);
1let M=[{key:"rebuild_all",label:"Full Rebuild",description:"Rebuild all ~4,919 routes (takes ~15s)",icon:x.Z,variant:"danger"},{key:"refresh_model_service",label:"Model-Service",description:"Refresh 3,172 model-service routes",icon:m.Z,variant:"default"},{key:"rebuild_city_pages",label:"City Pages",description:"Rebuild 13 city landing pages",icon:g.Z,variant:"default"},{key:"rebuild_city_service",label:"City-Service",description:"Rebuild 52 city-service pages",icon:h,variant:"default"},{key:"rebuild_neighborhoods",label:"Neighborhoods",description:"Rebuild 96 neighborhood pages",icon:p.Z,variant:"default"},{key:"refresh_sitemap",label:"Sitemap Cache",description:"Refresh materialized sitemap view",icon:y.Z,variant:"default"}],E={"model-service-page":"Model-Service","city-model-page":"City-Model","city-service-page":"City-Service","city-page":"City Landing","neighborhood-page":"Neighborhood"};function L(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return"".concat(t,"m ago");let r=Math.floor(t/60);return r<24?"".concat(r,"h ago"):"".concat(Math.floor(r/24),"d ago")}function R(e){return e<1e3?"".concat(e,"ms"):"".concat((e/1e3).toFixed(1),"s")}function A(e){return new Date(e).toLocaleString("en-CA",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function T(){let[e,t]=(0,n.useState)(null),[r,s]=(0,n.useState)(!0),[x,m]=(0,n.use
1State)(null),[g,u]=(0,n.useState)(null),[h,p]=(0,n.useState)(null),[y,T]=(0,n.useState)(null),z=(0,n.useCallback)(async()=>{s(!0),m(null);try{let e=await (0,d.AC)("/api/management/route-health");if(!e.success)throw Error(e.message||"Failed to load");t(e)}catch(t){let e=t instanceof Error?t.message:"Failed to load route health data";m(e),o.Am.error(e)}finally{s(!1)}},[]);(0,n.useEffect)(()=>{z()},[z]);let q=async e=>{u(e),p(null);try{let t=await (0,d.AC)("/api/management/route-health",{method:"POST",body:JSON.stringify({action:e})});if(!t.success)throw Error(t.message);if(t.started){o.Am.info(t.message);let e=Date.now(),r=setInterval(async()=>{await z(),Date.now()-e>3e5&&clearInterval(r)},15e3);setTimeout(()=>clearInterval(r),301e3)}else o.Am.success("".concat(t.message," (").concat(R(t.duration_ms),")"));await z()}catch(t){let e=t instanceof Error?t.message:"Action failed";o.Am.error(e)}finally{u(null)}},D=e=>{"danger"===e.variant?p(e):q(e.key)};if(r&&!e)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{title:"Route Health",description:"Monitor route generation, trigger status, and data integrity."}),(0,a.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,a.jsx)(f.Z,{className:"h-8 w-8 animate-spin text-primary-600"})})]});if(x&&!e)return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{title:"Route Health",description:"Monitor route generation, trigger status, and data integrity."}),(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-gray-500",children:[(0,a.jsx)(b.Z,{className:"h-10 w-10 text-red-400 mb-3"}),(0,a.jsx)("p",{className:"text-sm",children:x}),(0,a.jsx)("button",{onClick:z,className:"mt-4 px-4 py-2 text-sm font-medium rounded-lg bg-primary-800 text-white hover:bg-primary-700 transition-colors",children:"Retry"})]})]});if(!e)return null;let I=e.routeCounts.reduce((e,t)=>e+t.total,0),F=e.routeCounts.reduce((e,t)=>e+t.active,0),P=Object.values(e.expectedCounts).reduce((e,t)=>e+t,0),O=P>0?Math.round(F/P*1e3)/10:100,H=O>=99.9,V=e.logs[0],K=V?R(V.duration_ms):"N/A";null==V||V.trigger_source;let X=V?A(V.start_time):"never",B=e.integrityChecks.filter(e=>"ok"!==e.status).length,J=e.triggers.reduce((e,t)=>(e[t.table]||(e[t.table]=[]),e[t.table].push(t),e),{});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{title:"Route Health",description:"Monitor route generation, trigger status, and data integrity.",actions:(0,a.jsxs)("button",{onClick:z,disabled:r,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 disabled:opacity-50 transition-colors",children:[(0,a.jsx)(j.Z,{className:"h-4 w-4 ".concat(r?"animate-spin":"")}),"Refresh"]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[(0,a.jsx)(l.Z,{label:"Total Routes",value:I.toLocaleString(),icon:N,color:"blue",trend:(0,a.jsxs)("span",{children:["Last refresh: ",e.stats.last_refresh?L(e.stats.last_refresh):"unknown"]})}),(0,a.jsx)(l.Z,{label:"Coverage",value:"".concat(O,"%"),icon:v,color:H?"green":"red",trend:(0,a.jsxs)("span",{children:[F.toLocaleString()," / ",P.toLocaleString()," expected"]})}),(0,a.jsx)(l.Z,{label:"Last Payload Sync",value:e.lastPricingSync?L(e.lastPricingSync):"N/A",icon:k.Z,color:e.lastPricingSync&&Date.now()-new Date(e.lastPricingSync).getTime()<864e5?"green":"amber",trend:(0,a.jsxs)("span",{children:["Rebuild: ",K," \xb7 ",X]})}),(0,a.jsx)(l.Z,{label:"Issues",value:B+e.recentErrors,icon:B+e.recentErrors===0?w.Z:Z.Z,color:B+e.recentErrors===0?"green":"red",trend:(0,a.jsxs)("span",{children:[e.recentErrors," log errors, ",B," integrity issues"]})})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[(0,a.jsx)("div",{className:"px-6 py-4 border-b border-gray-100",children:(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900 font-heading",children:"Route Type Breakdown"})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-gray-100",children:[(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Route Type"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Expected"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actual"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Active"}),(0,a.jsx)("th",{className:"text-center px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"})]})}),(0,a.jsxs)("tbody",{className:"divide-y divide-gray-50",children:[e.routeCounts.map(t=>{var r;let s=null!==(r=e.expectedCounts[t.route_type])&&void 0!==r?r:t.total,n=t.active>=s,i=s-t.active;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsxs)("td",{className:"px-6 py-3 font-medium text-gray-900",children:[E[t.route_type]||t.route_type,(0,a.jsx)("span",{className:"ml-2 text-xs text-gray-400 font-mono",children:t.route_type})]}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-700 font-mono",children:s.toLocaleStr
1ing()}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-700 font-mono",children:t.total.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-700 font-mono",children:t.active.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-center",children:n?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700",children:[(0,a.jsx)(w.Z,{className:"h-3 w-3"})," OK"]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-50 text-red-700",children:[(0,a.jsx)(_.Z,{className:"h-3 w-3"})," Missing ",i]})})]},t.route_type)}),(0,a.jsxs)("tr",{className:"bg-gray-50 font-semibold",children:[(0,a.jsx)("td",{className:"px-6 py-3 text-gray-900",children:"Total"}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-900 font-mono",children:P.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-900 font-mono",children:I.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-right text-gray-900 font-mono",children:F.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-center",children:H?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700",children:[(0,a.jsx)(w.Z,{className:"h-3 w-3"})," OK"]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-50 text-amber-700",children:[(0,a.jsx)(Z.Z,{className:"h-3 w-3"})," ",O,"%"]})})]})]})]})})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[(0,a.jsx)("div",{className:"px-6 py-4 border-b border-gray-100",children:(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900 font-heading",children:"Data Integrity"})}),(0,a.jsx)("div",{className:"p-6 grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.integrityChecks.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border ".concat("ok"===e.status?"border-green-200 bg-green-50":"warning"===e.status?"border-amber-200 bg-amber-50":"border-red-200 bg-red-50"),children:["ok"===e.status?(0,a.jsx)(w.Z,{className:"h-5 w-5 text-green-600 flex-shrink-0 mt-0.5"}):"warning"===e.status?(0,a.jsx)(Z.Z,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}):(0,a.jsx)(_.Z,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium ".concat("ok"===e.status?"text-green-800":"warning"===e.status?"text-amber-800":"text-red-800"),children:e.label}),(0,a.jsx)("p",{className:"text-xs mt-0.5 ".concat("ok"===e.status?"text-green-600":"warning"===e.status?"text-amber-600":"text-red-600"),children:e.message})]})]},e.label))})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[(0,a.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900 font-heading",children:"Rebuild History"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Last 20 route generation events"})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-gray-100",children:[(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Time"}),(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Source"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Routes"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Skipped"}),(0,a.jsx)("th",{className:"text-right px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Duration"}),(0,a.jsx)("th",{className:"text-center px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-gray-50",children:0===e.logs.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:6,className:"px-6 py-8 text-center text-gray-400",children:"No rebuild history found"})}):e.logs.map(e=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:"hover:bg-gray-50 ".concat(e.error_message?"curs
1or-pointer":""),onClick:()=>e.error_message&&T(y===e.id?null:e.id),children:[(0,a.jsxs)("td",{className:"px-6 py-3 text-gray-700 whitespace-nowrap",children:[e.error_message&&(y===e.id?(0,a.jsx)(S.Z,{className:"h-3.5 w-3.5 inline mr-1 text-gray-400"}):(0,a.jsx)(C.Z,{className:"h-3.5 w-3.5 inline mr-1 text-gray-400"})),A(e.start_time)]}),(0,a.jsx)("td",{className:"px-6 py-3",children:(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-700",children:e.trigger_source})}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-mono text-gray-700",children:e.routes_generated.toLocaleString()}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-mono text-gray-400",children:e.routes_skipped}),(0,a.jsx)("td",{className:"px-6 py-3 text-right font-mono text-gray-700",children:R(e.duration_ms)}),(0,a.jsx)("td",{className:"px-6 py-3 text-center",children:e.error_message?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-50 text-red-700",children:[(0,a.jsx)(_.Z,{className:"h-3 w-3"})," Error"]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700",children:[(0,a.jsx)(w.Z,{className:"h-3 w-3"})," OK"]})})]},e.id),y===e.id&&e.error_message&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:6,className:"px-6 py-3 bg-red-50",children:(0,a.jsx)("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:e.error_message})})},"".concat(e.id,"-error"))]}))})]})})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[(0,a.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900 font-heading",children:"Trigger Status"}),(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[e.triggers.length," triggers across ",Object.keys(J).length," tables"]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-gray-100",children:[(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Trigger"}),(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Table"}),(0,a.jsx)("th",{className:"text-center px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Enabled"}),(0,a.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Category"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-gray-50",children:e.triggers.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"px-6 py-2.5 font-mono text-xs text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"px-6 py-2.5 text-gray-700",children:e.table}),(0,a.jsx)("td",{className:"px-6 py-2.5 text-center",children:e.enabled?(0,a.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700",children:"Enabled"}):(0,a.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-50 text-red-700",children:"Disabled"})}),(0,a.jsx)("td",{className:"px-6 py-2.5",children:(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-600",children:e.type})})]},"".concat(e.table,"-").concat(e.name)))})]})})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[(0,a.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900 font-heading",children:"Manual Actions"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Trigger route generation functions manually"})]}),(0,a.jsx)("div",{className:"p-6 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:M.map(e=>{let t=e.icon,r=g===e.key,s="danger"===e.variant;return(0,a.jsxs)("button",{onClick:()=>D(e),disabled:null!==g,className:"flex items-start gap-3 p-4 rounded-lg border text-left transition-colors disabled:opacity-50 ".concat(s?"border-red-200 hover:bg-red-50 hover:border-red-300":"border-gray-200 hover:bg-gray-50 hover:border-gray-300"),children:[(0,a.jsx)("div",{className:"p-2 rounded-lg flex-shrink-0 ".concat(s?"bg-red-100":"bg-primary-50"),children:r?(0,a.jsx)(f.Z,{className:"h-5 w-5 animate-spin ".concat(s?"text-red-600":"text-primary-700")}):(0,a.jsx)(t,{className:"h-5 w-5 ".concat(s?"text-red-600":"text-primary-700")})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium ".concat(s?"text-red-900":"text-gray-900"),children:e.label}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:e.description})]})]},e.key)})})]}),(0,a.jsx)(c.Z,{open:null!==h,onClose:()=>p(null),onConfirm:()=>h&&q(h.key),title:"Confirm: ".concat((null==h?void 0:h.label)||""),message:"This will rebuild all routes from scratch. The operation takes ~15 seconds and triggers multiple database functions. Existing routes will be regenerated.",confirmLabel:"Run Full Rebuild",variant:"danger",loading:null!==g})]})}function z(){return(0,a.jsx)(s.Z,{title:"Route Health",children:(0,a.jsx)(T,{})})}}},function(e){e.O(0,[2840,6444,5622,4340,2888,9774,179],function(){return e(e.s=45990)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.