1import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js"; 2import { p as require_react } from "./vendor-charts-D81iZKCV.js"; 3import { g as require_compiler_runtime, t as require_jsx_runtime } from "./vendor-react-HZz3WA9p.js"; 4import { r as T } from "./button-BWyXpawe.js"; 5import { t as BizIcon } from "./biz-icon-BHlHk8WD.js"; 6import { i as AdvancedMarker } from "./vendor-maps-1lAD1rp9.js"; 7var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 8var import_react = /* @__PURE__ */ __toESM(require_react()); 9var useMapEvent = (map, eventName, handler) => { 10 const $ = (0, import_compiler_runtime$1.c)(5); 11 let t0; 12 let t1; 13 if ($[0] !== eventName || $[1] !== handler || $[2] !== map) { 14 t0 = () => { 15 if (!map) return; 16 const listener = map.addListener(eventName, handler); 17 return () => listener.remove(); 18 }; 19 t1 = [ 20 map, 21 eventName, 22 handler 23 ]; 24 $[0] = eventName; 25 $[1] = handler; 26 $[2] = map; 27 $[3] = t0; 28 $[4] = t1; 29 } else { 30 t0 = $[3]; 31 t1 = $[4]; 32 } 33 (0, import_react.useEffect)(t0, t1); 34}; 35var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime()); 36var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime()); 37var gateIconVariants = T({ 38 base: "", 39 variants: { 40 type: { 41 entrance: "", 42 exit: "" 43 }, 44 variant: { 45 full: "h-[47px]", 46 compact: "" 47 }, 48 size: { 49 sm: "h-[33px] w-[26px]", 50 md: "h-10 w-8" 51 } 52 }, 53 compoundVariants: [ 54 { 55 type: "entrance", 56 variant: "full", 57 className: "w-[131px]" 58 }, 59 { 60 type: "exit", 61 variant: "full", 62 className: "w-[94px]" 63 }, 64 { 65 type: "entrance", 66 variant: "compact", 67 className: "text-[#0ABC4E]" 68 }, 69 { 70 type: "exit", 71 variant: "compact", 72 className: "text-[#005EE9]" 73 } 74 ], 75 defaultVariants: { 76 type: "entrance", 77 variant: "full" 78 } 79}); 80var gateTextVariants = T({ 81 base: "absolute w-full font-semibold text-primary-foreground", 82 variants: { 83 variant: { 84 full: "pl-10.5 text-sm", 85 compact: "" 86 }, 87 size: { 88 sm: "top-0.5 text-base text-center", 89 md: "top-1/2 -translate-y-4.5 text-lg text-center" 90 } 91 }, 92 compoundVariants: [{ 93 variant: "full", 94 className: "top-1.5" 95 }], 96 defaultVariants: { variant: "full" } 97}); 98var Gate = (t0) => { 99 const $ = (0, import_compiler_runtime.c)(25); 100 let number; 101 let props; 102 let t1; 103 let t2; 104 let t3; 105 if ($[0] !== t0) { 106 ({number, type: t1, variant: t2, size: t3, ...props} = t0); 107 $[0] = t0; 108 $[1] = number; 109 $[2] = props; 110 $[3] = t1; 111 $[4] = t2; 112 $[5] = t3; 113 } else { 114 number = $[1]; 115 props = $[2]; 116 t1 = $[3]; 117 t2 = $[4]; 118 t3 = $[5]; 119 } 120 const type = t1 === void 0 ? "entrance" : t1; 121 const variant = t2 === void 0 ? "full" : t2; 122 const size = t3 === void 0 ? "md" : t3; 123 const isCompact = variant === "compact"; 124 let iconName; 125 if (isCompact) iconName = "map-gate-compact"; 126 else iconName = type === "entrance" ? "map-gate-entrance-full" : "map-gate-exit-full"; 127 const label = type === "entrance" ? "Entrance" : "Exit"; 128 const t4 = iconName; 129 const t5 = isCompact ? size : void 0; 130 let t6; 131 if ($[6] !== t5 || $[7] !== type || $[8] !== variant) { 132 t6 = gateIconVariants({ 133 type, 134 variant, 135 size: t5 136 }); 137 $[6] = t5; 138 $[7] = type; 139 $[8] = variant; 140 $[9] = t6; 141 } else t6 = $[9]; 142 let t7; 143 if ($[10] !== iconName || $[11] !== t6) { 144 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 145 name: t4, 146 className: t6 147 }); 148 $[10] = iconName; 149 $[11] = t6; 150 $[12] = t7; 151 } else t7 = $[12]; 152 const t8 = isCompact ? size : void 0; 153 let t9; 154 if ($[13] !== t8 || $[14] !== variant) { 155 t9 = gateTextVariants({ 156 variant, 157 size: t8 158 }); 159 $[13] = t8; 160 $[14] = variant; 161 $[15] = t9; 162 } else t9 = $[15]; 163 const t10 = isCompact ? number : `${label} ${number}`; 164 let t11; 165 if ($[16] !== t10 || $[17] !== t9) { 166 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 167 className: t9, 168 children: t10 169 }); 170 $[16] = t10; 171 $[17] = t9; 172 $[18] = t11; 173 } else t11 = $[18]; 174 let t12; 175 if ($[19] !== t11 || $[20] !== t7) { 176 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 177 className: "relative flex overflow-hidden", 178 children: [t7, t11] 179 }); 180 $[19] = t11; 181 $[20] = t7; 182 $[21] = t12; 183 } else t12 = $[21]; 184 let t13; 185 if ($[22] !== props || $[23] !== t12) { 186 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdvancedMarker, { 187 ...props, 188 children: t12 189 }); 190 $[22] = props; 191 $[23] = t12; 192 $[24] = t13; 193 } else t13 = $[24]; 194 return t13; 195}; 196var DECODING_TABLE = [ 197 62, 198 -1, 199 -1, 200 52, 201 53, 202 54, 203 55, 204 56, 205 57, 206 58, 207 59, 208 60, 209 61, 210 -1, 211 -1, 212 -1, 213 -1, 214 -1, 215 -1, 216 -1, 217 0, 218 1, 219 2, 220 3, 221 4, 222 5, 223 6, 224 7, 225 8, 226 9, 227 10, 228 11, 229 12, 230 13, 231 14, 232 15, 233 16, 234 17, 235 18, 236 19, 237 20, 238 21, 239 22, 240 23, 241 24, 242 25, 243 -1, 244 -1, 245 -1, 246 -1, 247 63, 248 -1, 249 26, 250 27, 251 28, 252 29, 253 30,
254 31, 255 32, 256 33, 257 34, 258 35, 259 36, 260 37, 261 38, 262 39, 263 40, 264 41, 265 42, 266 43, 267 44, 268 45, 269 46, 270 47, 271 48, 272 49, 273 50, 274 51 275]; 276var FORMAT_VERSION = 1; 277var Num = typeof BigInt !== "undefined" ? BigInt : Number; 278function decode(encoded) { 279 const decoder = decodeUnsignedValues(encoded); 280 const header = decodeHeader(decoder[0], decoder[1]); 281 const factorDegree = 10 ** header.precision; 282 const factorZ = 10 ** header.thirdDimPrecision; 283 const { thirdDim } = header; 284 let lastLat = 0; 285 let lastLng = 0; 286 let lastZ = 0; 287 const res = []; 288 let i = 2; 289 for (; i < decoder.length;) { 290 const deltaLat = toSigned(decoder[i]) / factorDegree; 291 const deltaLng = toSigned(decoder[i + 1]) / factorDegree; 292 lastLat += deltaLat; 293 lastLng += deltaLng; 294 if (thirdDim) { 295 const deltaZ = toSigned(decoder[i + 2]) / factorZ; 296 lastZ += deltaZ; 297 res.push([ 298 lastLat, 299 lastLng, 300 lastZ 301 ]); 302 i += 3; 303 } else { 304 res.push([lastLat, lastLng]); 305 i += 2; 306 } 307 } 308 if (i !== decoder.length) throw new Error("Invalid encoding. Premature ending reached"); 309 return { 310 ...header, 311 polyline: res 312 }; 313} 314function decodeChar(char) { 315 const charCode = char.charCodeAt(0); 316 return DECODING_TABLE[charCode - 45]; 317} 318function decodeUnsignedValues(encoded) { 319 let result = Num(0); 320 let shift = Num(0); 321 const resList = []; 322 encoded.split("").forEach((char) => { 323 const value = Num(decodeChar(char)); 324 result |= (value & Num(31)) << shift; 325 if ((value & Num(32)) === Num(0)) { 326 resList.push(result); 327 result = Num(0); 328 shift = Num(0); 329 } else shift += Num(5); 330 }); 331 if (shift > 0) throw new Error("Invalid encoding"); 332 return resList; 333} 334function decodeHeader(version, encodedHeader) { 335 if (+version.toString() !== FORMAT_VERSION) throw new Error("Invalid format version"); 336 const headerNumber = +encodedHeader.toString(); 337 const precision = headerNumber & 15; 338 const thirdDim = headerNumber >> 4 & 7; 339 const thirdDimPrecision = headerNumber >> 7 & 15; 340 return { 341 precision, 342 thirdDim, 343 thirdDimPrecision 344 }; 345} 346function toSigned(val) { 347 let res = val; 348 if (res & Num(1)) res = ~res; 349 res >>= Num(1); 350 return +res.toString(); 351} 352const parseAndDecodePath = (pathStr) => { 353 try { 354 const parsed = JSON.parse(pathStr); 355 if (Array.isArray(parsed) && parsed.length > 0) { 356 const polyline = parsed[0]?.polyline; 357 if (polyline) { 358 const decoded = decode(polyline); 359 if (decoded?.polyline?.length) return decoded.polyline.map((p) => { 360 return { 361 lat: p[0], 362 lng: p[1] 363 }; 364 }); 365 } 366 } 367 } catch (e) { 368 console.error("Error parsing path:", e); 369 } 370 return null; 371}; 372var CHEVRON_UP_PATH = "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"; 373var DASH_PATH = "M 0,-1 0,1"; 374const getRouteStyle = (type) => { 375 let strokeColor = ""; 376 let borderColor = ""; 377 switch (type) { 378 case "entrance": 379 case "entrance-offgrid": 380 strokeColor = "#26E344"; 381 borderColor = "#00AE26"; 382 break; 383 case "exit": 384 case "exit-offgrid": 385 strokeColor = "#00EEFD"; 386 borderColor = "#2F00E9"; 387 break; 388 case "route": 389 default: 390 strokeColor = "rgba(192, 112, 220, 0.75)"; 391 borderColor = "rgba(119, 5, 233, 0.85)"; 392 break; 393 } 394 if (type === "entrance-offgrid" || type === "exit-offgrid") return { 395 strokeColor, 396 strokeOpacity: 0, 397 strokeWeight: 4, 398 zIndex: 99, 399 clickable: false, 400 icons: [{ 401 icon: { 402 path: DASH_PATH, 403 strokeColor, 404 strokeOpacity: 1, 405 strokeWeight: 4, 406 scale: 3 407 }, 408 offset: "0", 409 repeat: "16px" 410 }] 411 }; 412 return { 413 strokeColor, 414 clickable: false, 415 strokeWeight: 6, 416 strokeOpacity: 1, 417 zIndex: 100, 418 icons: [{ 419 icon: { 420 path: CHEVRON_UP_PATH, 421 anchor: new google.maps.Point(12, 12), 422 scale: .5, 423 strokeColor: "#FFFFFF", 424 fillColor: "#FFFFFF", 425 fillOpacity: 1, 426 strokeWeight: 1, 427 rotation: type === "entrance" ? 180 : 0 428 }, 429 offset: "0", 430 repeat: "26px" 431 }], 432 border: { 433 strokeColor: borderColor, 434 strokeWeight: 10, 435 strokeOpacity: 1 436 } 437 }; 438}; 439export { useMapEvent as i, parseAndDecodePath as n, Gate as r, getRouteStyle as t };
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.