1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[83805],{28506:(e,t,r)=>{r.d(t,{ED:()=>a,OK:()=>l,Re:()=>p,SQ:()=>o,TL:()=>d,Vv:()=>n,Xg:()=>m,_G:()=>i,_N:()=>s,jy:()=>c,tk:()=>u});let s={emerald:"bg-success-tint text-success",blue:"bg-info-tint text-info",amber:"bg-warning-tint text-warning",red:"bg-destructive-tint text-destructive",slate:"bg-muted text-muted-foreground",violet:"bg-violet-100 text-violet-700",orange:"bg-warning-tint text-warning",gray:"bg-muted text-muted-foreground",purple:"bg-purple-100 text-purple-700"},a={OK:"emerald",ATTENTION:"amber",AT_RISK:"red",INACTIVE:"gray"},o={MERCHANDISER:"blue",SALES:"orange",SUPERVISOR:"purple",PROMOTER:"violet"},n={CARRY_IT:"violet",MATCH_PRICE:"amber",MONITOR:"slate"},i={1:"text-warning",2:"text-muted-foreground",3:"text-warning"},l={visits:"#696AC3",sales:"#FFB620"},d={OOS:"#ef4444",PLANOGRAM_MISS:"#8b5cf6",PRICE_OOR:"#f59e0b",LOW_SHARE:"#64748b"},c=["#ef4444","#8b5cf6","#f59e0b","#64748b","#0ea5e9"],u={OK:"#22c55e",ATTENTION:"#eab308",AT_RISK:"#ef4444",INACTIVE:"#9ca3af"},m={OK:"bg-success",ATTENTION:"bg-warning",AT_RISK:"bg-destructive",INACTIVE:"bg-gray-400"},p={SHELF:"bg-success-tint text-success",POP:"bg-warning-tint text-warning",COMPETITOR:"bg-destructive-tint text-destructive",OOS:"bg-destructive-tint text-destructive",STOCKOUT:"bg-destructive-tint text-destructive",PLANOGRAM:"bg-info-tint text-info",STORE_FRONT:"bg-indigo-100 text-indigo-700",GENERAL:"bg-muted text-muted-foreground"}},37685:(e,t,r)=>{function s(e){return String(e).replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function a(e,t){return null==e||""===e?"â":"boolean"==typeof e?t(e?"common.yes":"common.no"):Array.isArray(e)?e.join(", "):"object"==typeof e?JSON.stringify(e):String(e)}r.d(t,{I:()=>s,i:()=>a})},68189:(e,t,r)=>{r.r(t),r.d(t,{Button:()=>d,buttonVariants:()=>l});var s=r(95155),a=r(12115),o=r(42442),n=r(18460),i=r(86190);let l=(0,n.F)("inline-flex items-center justify-center whitespace-nowrap rounded-xl text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 specular",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 specular",outline:"border border-input bg-card hover:bg-accent hover:text-accent-foreground",outline_primary:"border border-input bg-transparent hover:bg-primary hover:text-primary-foreground text-primary border-primary",outline_destructive:"border border-input bg-destructive-tint hover:bg-destructive hover:text-destructive-foreground text-destructive border-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 specular",dark:"bg-black text-white hover:bg-black/90",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline focus-visible:ring-0",link_underline:"text-primary underline-offset-4 underline hover:bold focus-visible:ring-0",danger:"bg-destructive text-destructive-foreground hover:bg-destructive/90",danger_outlined:"border font-semibold text-lg text-destructive border-2 border-destructive rounded-xl hover:bg-destructive hover:text-destructive-foreground",icon:"text-primary hover:text-primary/90",auth:"bg-primary text-auth-white shadow-[0_6px_20px_-6px_rgba(105,106,195,.7)] hover:bg-brand-700 disabled:bg-white/[.07] disabled:text-auth-ink-8 disabled:opacity-100 disabled:shadow-none disabled:ring-1 disabled:ring-inset disabled:ring-white/[.08]",auth_outline:"border border-[rgba(157,158,233,.55)] bg-primary/10 text-brand-200 hover:bg-primary/20 disabled:opacity-100 disabled:border-white/[.08] disabled:bg-white/[.07] disabled:text-auth-ink-8",auth_social:"border border-brand-300/[.16] bg-brand-600/[.07] text-auth-ink-1 hover:bg-brand-600/[.14] disabled:opacity-100 disabled:text-auth-ink-8"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-xl px-3",md:"h-10 rounded-xl px-3 py-1.5",lg:"h-11 rounded-xl px-8",lgApp:"px-5 w-[6.6rem] text-lg h-10 rounded-xl",icon:"h-10 w-10",iconMd:"h-8 w-8",iconSm:"h-6 w-6",iconXs:"h-4 w-4","icon-md":"h-10 w-12 p-0",auth:"h-12 w-full gap-2 rounded-[10px] px-4 text-[15px] font-bold md:h-11 md:text-sm"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...n},d)=>{let c=a?o.DX:"button";return(0,s.jsx)(c,{className:(0,i.cn)(l({variant:t,size:r,className:e})),ref:d,...n})});d.displayName="Button"},83805:(e,t,r)=>{r.r(t),r.d(t,{default:()=>X});var s=r(95155),a=r(59481),o=r(57903),n=r(86765),i=r(68055),l=r(15378),d=r(47684),c=r(41229),u=r(69722),m=r.n(u);r(78390);let p=(0,c.Nq)(({children:e,...t},r)=>{let s=m().markerClusterGroup(t);return{instance:s,context:{...r,layerContainer:s}}},()=>{});var x=r(12115),g=r(98500),b=r.n(g),h=r(73321),f=r(50910);r(76170);var v=r(33024),y=r(47149),w=r(25763),N=r(41585),j=r(64118);r(90737),r(43516),r(5301);
1var C=r(9339);let S=(0,C.createServerReference)("40dfc8b4fec7aa6907b77cfb23a005fa8b104afe94",C.callServer,void 0,C.findSourceMapURL,"getStoresInViewport"),k=(0,C.createServerReference)("4057604134d422231807c2501d1672a88e77efe3d3",C.callServer,void 0,C.findSourceMapURL,"getAgentTracks");var A=r(61878),E=r(33210),I=r(41159),T=r(24538),O=r(28506);function R({filters:e,onFiltersChange:t,truncated:r,loading:a,stores:o=[],onSelectStore:n}){let i=(0,f.c)("applications.scout"),[l,d]=(0,x.useState)(!1),c=(0,x.useRef)(null),u=(0,x.useRef)(null);(0,x.useEffect)(()=>{let e=e=>{c.current?.contains(e.target)||d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let m=[{code:"SUPERMERCADOS",label:i("map.clusters.SUPERMERCADOS"),color:"bg-primary text-primary-foreground"},{code:"BODEGONES",label:i("map.clusters.BODEGONES"),color:"bg-primary-500 text-warning-foreground"},{code:"FARMACIAS",label:i("map.clusters.FARMACIAS"),color:"bg-secondary-500 text-foreground"},{code:"LICORERIAS",label:i("map.clusters.LICORERIAS"),color:"bg-warning text-warning-foreground"}],p=e?.name??"",g=!!p,b=(0,x.useMemo)(()=>{let e=p.trim().toLowerCase();return!e||e.length<2?[]:o.filter(t=>t.Name?.toLowerCase().includes(e)||t.StoreCode?.toLowerCase().includes(e)||t.Address?.toLowerCase().includes(e)).slice(0,7)},[p,o]),h=(0,x.useMemo)(()=>o.slice(0,5),[o]),v=(0,x.useCallback)(e=>{n?.(e),d(!1),u.current?.blur()},[n]),y=l&&(g?b.length>0:h.length>0),w=l&&g&&p.length>=2&&0===b.length,N=a&&l,j=r&&l,C=y||w||N||j,S=g?b:h;return(0,s.jsxs)("div",{className:"flex flex-wrap items-start gap-2",children:[(0,s.jsxs)("div",{ref:c,className:`relative transition-all duration-200 ${l?"w-[420px]":"w-72"}`,children:[(0,s.jsxs)("div",{className:`bg-card shadow-lg overflow-hidden flex items-center h-11 ${C?"rounded-2xl":"rounded-full"}`,children:[(0,s.jsx)(A.A,{size:16,className:"text-muted-foreground ml-4 shrink-0"}),(0,s.jsx)("input",{ref:u,type:"search",value:p,placeholder:i("map.search"),onChange:r=>t({...e,name:r.target.value}),onFocus:()=>d(!0),className:"flex-1 px-3 py-2 text-sm bg-transparent border-0 outline-none placeholder:text-muted-foreground"}),g&&(0,s.jsx)("button",{type:"button",onClick:()=>{t({...e,name:""}),u.current?.focus()},className:"text-muted-foreground hover:text-muted-foreground mr-3","aria-label":i("map.searchUi.clear"),children:(0,s.jsx)(E.A,{size:16})})]}),C&&(0,s.jsxs)("div",{className:"absolute top-full left-0 right-0 mt-1 bg-card rounded-2xl shadow-xl border border-border overflow-hidden",children:[!g&&S.length>0&&(0,s.jsx)("div",{className:"px-4 pt-3 pb-1",children:(0,s.jsx)("span",{className:"text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:i("map.searchUi.recentHeading")})}),y&&(0,s.jsx)("div",{className:"max-h-[340px] overflow-y-auto",children:S.map(e=>(0,s.jsxs)("button",{type:"button",onMouseDown:()=>v(e),className:"w-full text-left px-4 py-2.5 hover:bg-muted flex items-center gap-3 transition-colors",children:[(0,s.jsxs)("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0 relative",children:[(0,s.jsx)(I.A,{size:14,className:"text-muted-foreground"}),(0,s.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-white ${O.Xg[e.Status]??O.Xg.INACTIVE}`})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:e.Name}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.StoreCode," \xb7 ",e.ClusterCode]})]}),(0,s.jsx)(T.A,{size:14,className:"text-muted-foreground shrink-0"})]},e.StoreCode))}),w&&(0,s.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:i("map.searchUi.noResults")}),N&&(0,s.jsxs)("div",{className:"border-t border-border px-4 py-2.5 text-xs text-muted-foreground flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-primary/30 animate-pulse"}),i("map.loadingHint")]}),j&&(0,s.jsx)("div",{className:"border-t border-border px-4 py-2.5 text-xs text-warning bg-warning-tint",children:i("map.zoomHint")})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>t({...e,clusterCode:void 0}),className:`px-3.5 h-9 rounded-full text-xs font-semibold whitespace-nowrap transition-all duration-150 ${!e?.clusterCode?"bg-primary text-primary-foreground shadow-lg":"bg-card text-foreground shadow-md hover:bg-muted hover:shadow-lg"}`,children:i("stores.filters.all")}),m.map(r=>{let a=e?.clusterCode===r.code;return(0,s.jsx)("button",{type:"button",onClick:()=>t({...e,clusterCode:a?void 0:r.code}),className:`px-3.5 h-9 rounded-full text-xs font-semibold whitespace-nowrap transition-all duration-150 ${a?`${r.color} shadow-lg`:"bg-card text-foreground shadow-md hover:bg-muted hover:shadow-lg"}`,children:r.label},r.code)})]})]})}var L=r(22164),z=r(68189),_=r(37685);function M({store:e,onClose:t}){let r=(0,f.c)("applications.scout"),a=(0,h.useParams)(),o=a?.locale||"en";if((0,x.useEffect)(()=>
1{if(!e)return;let r=e=>{"Escape"===e.key&&t?.()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]),!e)return null;let n=O.ED[e.Status]?e.Status:"INACTIVE",i=r(`status.${n}`),l=O._N[O.ED[n]],d=(()=>{if(!e.ClusterCode)return"â";let t=`map.clusters.${e.ClusterCode}`,s=r(t);return s===t?(0,_.I)(e.ClusterCode):s})(),c=Object.entries(function(e){if(e&&"object"==typeof e)return e;if("string"==typeof e)try{let t=JSON.parse(e);return t&&"object"==typeof t?t:{}}catch{}return{}}(e.Attributes));return(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":e.Name||r("map.summary.attributes"),className:"absolute top-4 right-4 bottom-4 w-96 bg-card text-card-foreground border rounded-lg shadow-xl p-6 z-[1100] overflow-y-auto",children:[(0,s.jsx)(z.Button,{type:"button",variant:"ghost",size:"iconSm",onClick:t,className:"absolute top-3 right-3 text-muted-foreground hover:bg-transparent hover:text-foreground","aria-label":r("map.summary.close"),children:"â"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:`inline-block px-2 py-0.5 text-xs font-medium rounded-full ${l}`,children:i}),(0,s.jsx)("h2",{className:"text-xl font-semibold mt-2",children:e.Name}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e.StoreCode})]}),(0,s.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[r("map.summary.cluster"),":"]})," ",d]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[r("map.summary.address"),":"]})," ",e.Address]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[r("map.summary.phone"),":"]})," ",e.Phone]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[r("map.summary.lastVisit"),":"]})," ",e.LastVisitAt?new Date(e.LastVisitAt).toLocaleDateString():"â"]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[r("map.summary.compliance"),":"]})," ",e.ComplianceScore,"%"]})]}),e.CustomerCode&&(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsxs)(b(),{href:`/${o}/apps/sales/customer/${e.CustomerCode}`,className:"inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:[(0,s.jsx)(L.A,{className:"h-4 w-4"}),r("map.summary.viewCustomer")]})}),c.length>0&&(0,s.jsxs)("div",{className:"border-t pt-4",children:[(0,s.jsx)("h3",{className:"font-medium mb-2",children:r("map.summary.attributes")}),(0,s.jsx)("dl",{className:"space-y-1 text-sm",children:c.map(([e,t])=>(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:(0,_.I)(e)}),(0,s.jsx)("dd",{children:(0,_.i)(t,r)})]},e))})]})]})]})}let $=[10.6427,-71.6125],V=` 2.scout-pin-marker { 3 background: transparent !important; 4 border: none !important; 5} 6.scout-pin-dot { 7 position: relative; 8 width: 14px; height: 14px; border-radius: 50%; 9 border: 2.5px solid white; 10 box-shadow: 0 1px 4px rgba(0,0,0,0.3); 11 transition: transform 0.15s ease; 12} 13.scout-pin-marker:hover .scout-pin-dot { 14 transform: scale(1.25); 15} 16/* AT_RISK (red) pins pulse with an expanding/fading ring â live-incident cue. 17 Only applied to .scout-pin-dot--risk; OK/ATTENTION/INACTIVE stay static. */ 18.scout-pin-dot--risk::after { 19 content: ""; 20 position: absolute; 21 top: 50%; 22 left: 50%; 23 width: 14px; 24 height: 14px; 25 border-radius: 50%; 26 background: #ef4444; 27 transform: translate(-50%, -50%); 28 z-index: -1; 29 animation: scout-pin-pulse 1.5s ease-in-out infinite; 30} 31@keyframes scout-pin-pulse { 32 0% { 33 transform: translate(-50%, -50%) scale(1); 34 opacity: 0.6; 35 } 36 70% { 37 transform: translate(-50%, -50%) scale(2.6); 38 opacity: 0; 39 } 40 100% { 41 transform: translate(-50%, -50%) scale(2.6); 42 opacity: 0; 43 } 44} 45/* Google Maps style zoom controls */ 46.leaflet-control-zoom { 47 border: none !important; 48 box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important; 49 border-radius: 8px !important; 50 overflow: hidden; 51} 52.leaflet-control-zoom a { 53 width: 40px !important; 54 height: 40px !important; 55 line-height: 40px !important; 56 font-size: 18px !important; 57 color: #444 !important; 58 border-bottom: 1px solid #e5e7eb !important; 59} 60.leaflet-control-zoom a:last-child { 61 border-bottom: none !important; 62} 63.leaflet-control-zoom a:hover { 64 background: #f9fafb !important; 65} 66/* Marker cluster bubble polish */ 67.marker-cluster-small, 68.marker-cluster-medium, 69.marker-cluster-large { 70 background-clip: padding-box; 71 border-radius: 50%; 72} 73.marker-cluster div { 74 font-weight: 600; 75 color: #1f2937; 76} 77/* Live-tracking agent avatar marker */ 78.scout-agent-marker { 79 background: transparent !important; 80 border: none !important; 81} 82.scout-agent-avatar { 83 width: 30px; height: 30px; border-radius: 50%; 84 background: #6b7280; 85 color: white; 86 font-size: 11px; 87 font-weight: 700; 88 display: flex; 89 align-items: center; 90 justify-content: center; 91 border: 2.5px solid white; 92 box-shadow: 0 1px 5px rgba(0,0,0,0.35); 93} 94`;function D(){let e=(0,a.ko)();return(0,x.useEffect)(()=>{let t=m().control.zoom({position:"bottomright"});t.addTo(e);let r=()=>e.invalidateSize(),s=setTimeout(r,0),a=setTimeout(r,250);return window.addEventListener("resize",r),()=>{clearTimeout(s),clearTimeout(a),window.removeEventListener("resize",r),t.remove()}},[e]),null}function P({onBboxChange:e}){return(0,a.Po)({moveend:t=>{let r=t.target.getBounds();e({minLat:r.getSouth(),maxLat:r.getNorth(),minLng:r.getWest(),maxLng:r.getEast()})}}),null}let K={AT_RISK:1,ATTENTION:.65,OK:.2,INACTIVE:.1};function F({points:e,visible:t}){let r=(0,a.ko)();return(0,x.useEffect)(()=>
94{if(!t||!e?.length||"function"!=typeof m().heatLayer)return;let s=m().heatLayer(e,{radius:25,blur:15});return s.addTo(r),()=>{r.removeLayer(s)}},[r,e,t]),null}let U=["#2563eb","#ea580c","#16a34a","#9333ea","#dc2626","#ca8a04","#db2777","#0891b2"],B=e=>{let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return U[Math.abs(t)%U.length]};function G({tracks:e,visible:t}){return t&&e?.length?(0,s.jsx)(s.Fragment,{children:e.map(e=>{let t,r,a=(e.path||[]).filter(e=>"number"==typeof e.lat&&"number"==typeof e.lng).map(e=>[e.lat,e.lng]),l=e.position;return(0,s.jsxs)("div",{children:[a.length>1&&(0,s.jsx)(o.R,{positions:a,pathOptions:{color:B(e.AgentCode),weight:4,opacity:.85}}),l&&"number"==typeof l.lat&&"number"==typeof l.lng&&(0,s.jsx)(n.p,{position:[l.lat,l.lng],icon:(t=(e?.AgentName||e?.AgentCode||"").split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()).join("")||"?",r=B(e?.AgentCode||""),m().divIcon({className:"scout-agent-marker",html:`<div class="scout-agent-avatar" style="background:${r};">${t}</div>`,iconSize:[30,30],iconAnchor:[15,15]})),children:(0,s.jsxs)(i.z,{children:[(0,s.jsx)("div",{className:"text-sm font-semibold",children:e.AgentName||e.AgentC
94ode}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:e.AgentCode})]})})]},e.AgentCode)})}):null}let H={default:{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},satellite:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"© Esri"}};function W({store:e,locale:t,t:r}){let a=O.ED[e.Status]?e.Status:"INACTIVE",o=O._N[O.ED[a]],n=(()=>{if(!e.ClusterCode)return"â";let t=`map.clusters.${e.ClusterCode}`,s=r(t);return s===t?(0,_.I)(e.ClusterCode):s})();return(0,s.jsxs)("div",{className:"min-w-[200px] space-y-2",children:[(0,s.jsx)("span",{className:`inline-block px-2 py-0.5 text-[11px] font-medium rounded-full ${o}`,children:r(`status.${a}`)}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-semibold leading-tight",children:e.Name}),(0,s.jsx)("div",{className:"text-[11px] text-muted-foreground",children:e.StoreCode})]}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground space-y-0.5",children:[(0,s.jsxs)("div",{children:[r("map.summary.cluster"),": ",n]}),e.Address&&(0,s.jsxs)("div",{children:[r("map.summary.address"),": ",e.Address]}),(0,s.jsxs)("div",{children:[r("map.summary.compliance"),": ",null!=e.ComplianceScore?`${e.ComplianceScore}%`:"â"]})]}),e.CustomerCode&&(0,s.jsx)(b(),{href:`/${t}/apps/sales/customer/${e.CustomerCode}`,className:"inline-flex items-center gap-1 text-xs font-medium text-info hover:underline",children:r("map.summary.viewCustomer")})]})}function X(){let e=(0,f.c)("applications.scout"),t=(0,h.useParams)(),r=t?.locale||"en",[a,o]=(0,x.useState)({}),[c,u]=(0,x.useState)(null),[g,b]=(0,x.useState)("default"),[C,A]=(0,x.useState)(null),[E,I]=(0,x.useState)(!1),[T,L]=(0,x.useState)(!1),[z,_]=(0,x.useState)([]),{stores:U,truncated:B,loading:X,error:J,setBbox:q}=function(e={}){let[t,r]=(0,x.useState)([]),[s,a]=(0,x.useState)(!1),[o,n]=(0,x.useState)(!1),[i,l]=(0,x.useState)(!1),d=(0,x.useRef)(!1),c=e?.clusterCode??null,u=e?.status??null,m=e?.channelCode??null,p=(0,x.useCallback)(async e=>{e&&n(!0),l(!1);try{let e=await S({bbox:null,filters:{}});e?.Error?l(!0):(r(e?.Data?.Markers??[]),a(!!e?.Data?.Truncated))}catch{l(!0)}finally{e&&n(!1)}},[]);return(0,x.useEffect)(()=>{d.current||(d.current=!0,p(!0))},[p]),{stores:(0,x.useMemo)(()=>{let e=t;return c&&(e=e.filter(e=>e.ClusterCode===c)),u&&(e=e.filter(e=>e.Status===u)),m&&(e=e.filter(e=>e.ChannelCode===m)),e},[t,c,u,m]),truncated:s,loading:o,error:i,setBbox:(0,x.useCallback)(()=>{},[])}}(a),Q=!X&&!J&&0===U.length,Y=H[g]??H.default,Z=(0,x.useMemo)(()=>U.filter(e=>"number"==typeof e.Lat&&"number"==typeof e.Lng).map(e=>{let t=K[e.Status]??K.INACTIVE,r=Number(e.ComplianceScore),s=Math.min(1,t+(Number.isFinite(r)?(1-r/100)*.4:0));return[e.Lat,e.Lng,s]}),[U]);return(0,x.useEffect)(()=>{if(!T||z.length)return;let e=!0;return k({}).then(t=>{e&&t&&!t.Error&&_(t.Data||[])}).catch(()=>{}),()=>{e=!1}},[T,z.length]),(0,s.jsxs)("div",{className:"relative isolate w-full h-[calc(100vh-12rem)] rounded-lg overflow-hidden border bg-card",children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:V}}),(0,s.jsx)("div",{className:"absolute top-3 left-3 right-3 z-[800] pointer-events-none flex flex-wrap items-start gap-3",children:(0,s.jsx)("div",{className:"pointer-events-auto flex-1 min-w-[280px]",children:(0,s.jsx)(R,{filters:a,onFiltersChange:o,truncated:B,loading:X,stores:U,onSelectStore:e=>{e&&(u(e),C&&"number"==typeof e.Lat&&"number"==typeof e.Lng&&C.flyTo([e.Lat,e.Lng],16,{duration:.8}))}})})}),(0,s.jsxs)("button",{type:"button",onClick:()=>b("default"===g?"satellite":"default"),className:"absolute bottom-6 left-4 z-[800] bg-card rounded-lg shadow-lg overflow-hidden border border-border hover:shadow-xl transition-shadow group",title:e("map.layers.toggle"),"aria-label":e("map.layers.toggle"),"aria-pressed":"satellite"===g,children:[(0,s.jsx)("div",{className:"w-20 h-14 bg-cover bg-center bg-muted",style:{backgroundImage:"default"===g?"url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/10/481/308')":"url('https://tile.openstreetmap.org/10/308/481.png')"}}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-1.5 px-2 py-1.5 bg-background border-t border-border",children:[(0,s.jsx)(v.A,{size:12,className:"text-muted-foreground"}),(0,s.jsx)("span",{className:"text-[11px] font-semibold text-foreground",children:e("map.layers.base")})]})]}),(0,s.jsxs)("div",{className:"absolute bottom-28 left-4 z-[800] flex flex-col gap-2",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>I(e=>!e),"aria-pressed":E,title:e("map.layers.heatmap"),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg border text-[11px] font-semibold whitespace-nowrap transition-all duration-150 ${E?"bg-warning text-warning-foreground border-warning shadow-lg":"bg-card text-foreground border-border shadow-md hover:shadow-xl"}`,children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{children:e("map.layers.heatmap")})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>L(e=>!e),"aria-pressed":T,title:e("map.layers.tracking"),className:`flex items-center gap-1.5 px-3 py-2 rounded-lg border text-[11px] font-semibold whitespace-nowrap transition-all duration-150 ${T?"bg-success text-success-foreground border-success shadow-lg":"bg-card text-foreground border-border shadow-md hover:shadow-xl"}`,children:[(0,s.jsx)(w.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{children:e("map.layers.tracking")})]})]}),(0,s.jsxs)(l.W,{center:$,zoom:12,scrollWheelZoom:!0,zoomControl:!1,ref:A,className:"h-full w-full",children:[(0,s.jsx)(d.e,{attribution:Y.attribution,url:Y.url},g),(0,s.jsx)(D,{}),(0,s.jsx)(P,{onBboxChange:q}),(0,s.jsx)(F,{points:Z,visible:E}),(0,s.jsx)(G,{tracks:z,visible:T}),(0,s.jsx)(p,{chunkedLoading:!0,children:U.map(t=>{var a;let o;return(0,s.jsx)(n.p,{position:[t.Lat,t.Lng],icon:(a=t.Status,o=O.tk[a]||O.tk.INACTIVE,m().divIcon({className:"scout-pin-marker",html:`<div class="${"AT_RISK"===a?"scout-pin-dot scout-pin-dot--risk":"scout-pin-dot"}" style="background: ${o};"></div>`,iconSize:[14,14],iconAnchor:[7,7]})),eventHandlers:{click:()=>u(t)},children:(0,s.jsx)(i.z,{children:(0,s.jsx)(W,{store:t,locale:r,t:e})})},t.StoreCode)})})]}),c&&(0,s.jsx)(M,{store:c,onClose:()=>u(null)}),!X&&J&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[900] flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"flex max-w-xs flex-col items-center gap-2 rounded-xl border border-destructive/30 bg-card/95 px-6 py-5 text-center shadow-xl backdrop-blur-sm",children:[(0,s.jsx)(N.A,{className:"h-8 w-8 text-destructive"}),(0,s.jsx)("p",{className:"text-sm font-semibold text-foreground",children:e("map.error")})]})}),Q&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[900] flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"flex max-w-xs flex-col items-center gap-2 rounded-xl border border-border bg-card/95 px-6 py-5 text-center shadow-xl backdrop-blur-sm",children:[(0,s.jsx)(j.A,{className:"h-8 w-8 text-muted-foreground"}),(0,s.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:e("map.empty")})]})})]})}}}]);
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.