/* eslint-disable */ /* © 2026 K2B NETWORK SOLUTIONS LLC. All rights reserved. Proprietary and confidential. Unauthorized copying, distribution, or use of this file, via any medium, is strictly prohibited. Original work product. */ // K2B Network Solutions — VIN Decode (K2BVIN). // Slate-blue F&I Pro skin; row-oriented. Every field of the vehicle is an input the person can edit. // A VIN typed, pasted or handed over by another screen is decoded by OUR server (window.DMS.vin / VinLookup.jsx.txt): // MarketCheck first (a saved answer of any age before a paid call), then NHTSA (the free government decoder), then what the VIN // itself says - and the screen always says which one answered. The decode fills only fields that are still blank or that an // earlier decode filled; what a person typed is never overwritten (Undo puts the filled values back). // F5 decode · F2 recent decodes on this station · F8 NHTSA recalls · F4 window sticker · F6 spec sheet (both print the EDITED // vehicle) · F3 build the next stock number the way Stock-In does · Send to Stock-In · Send to Trade Appraisal / Trade-In Request · ESC. // Names here start with vd / Vd (every .jsx.txt shares ONE global scope). const VD_KEYS = { year: "year", make: "make", model: "model", trim: "trim", body: "body", engine: "engine", cylinders: "cylinders", displacement: "displacement", transmission: "transmission", drive: "drivetrain", fuel: "fuel", gvwr: "gvwr", color: "exteriorColor" }; const VD_LABEL = { year: "Year", make: "Make", model: "Model", trim: "Trim", body: "Body", engine: "Engine", cylinders: "Cylinders", displacement: "Displacement", transmission: "Trans", drive: "Drive", fuel: "Fuel", gvwr: "GVWR", color: "Color", miles: "Miles", stock: "Stock #" }; const VD_EMPTY = () => ({ year: "", make: "", model: "", trim: "", body: "", engine: "", cylinders: "", displacement: "", transmission: "", drive: "", fuel: "", gvwr: "", color: "", miles: "", stock: "", type: "U" }); const vdS = (x) => (x == null ? "" : String(x)); const vdEsc = (s) => vdS(s).replace(/&/g, "&").replace(//g, ">"); const vdVinApi = () => (window.DMS && window.DMS.vin) || window.jbVin || null; const vdWhen = (iso) => { if (!iso) return ""; const d = new Date(iso); return isNaN(d.getTime()) ? "" : d.toLocaleString("en-US", { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }); }; const vdYearLetter = (vin) => { const api = vdVinApi(); const c = vdS(vin)[9] || ""; if (!c) return ""; const i = "ABCDEFGHJKLMNPRSTVWXY123456789".indexOf(c); if (i < 0) return c; return c + "=" + ((/\d/.test(vdS(vin)[6] || "") ? 1980 : 2010) + i); }; // Next stock number the way Stock-In builds one (U-#### used / T-#### new), never one that is already in inventory. const vdNextStock = (type, year) => { const yy = String(parseInt(year, 10) || new Date().getFullYear()).slice(-2); const taken = new Set(((window.DMS && window.DMS.inventory) ? (window.DMS.inventory() || []) : []).map(u => String(u.stock || "").toUpperCase())); for (let i = 0; i < 50; i++) { const n = Math.floor(1000 + Math.random() * 8999); const s = `${type === "N" ? "T" : "U"}${yy}-${n}`; if (!taken.has(s)) return s; } return `${type === "N" ? "T" : "U"}${yy}-${Date.now() % 9000 + 1000}`; }; const vdPrint = (title, bodyHtml) => { if (window.k2bPrint) { window.k2bPrint(bodyHtml, { title }); return true; } let w = null; try { w = window.open("", "_blank", "width=900,height=1100"); } catch (e) { w = null; } if (!w) return false; w.document.write(`${vdEsc(title)}${bodyHtml}