const routes = { extraordinaryTemporary: { title: "O-1A Extraordinary Ability", summary: "Best for a high-achieving founder, researcher, engineer, artist, or operator who can prove sustained acclaim.", score: 92, steps: ["Collect acclaim evidence", "Map facts to O-1 criteria", "Draft petition letter and expert letters"] }, extraordinaryGreen: { title: "EB-1A or EB-2 NIW", summary: "Best when the client has strong accomplishments and wants a permanent path without relying only on an employer sponsor.", score: 88, steps: ["Run EB-1A vs NIW matrix", "Build national importance narrative", "Prepare recommendation letter prompts"] }, companyTemporary: { title: "H-1B / TN / E-3 / H-1B1", summary: "Best when an employer can sponsor a defined specialty role and the applicant has matching credentials.", score: 84, steps: ["Validate role and credentials", "Collect employer documents", "Prepare LCA and petition data"] }, managerTemporary: { title: "L-1A / L-1B", summary: "Best for multinational transfers involving executives, managers, or specialized knowledge employees.", score: 86, steps: ["Confirm qualifying relationship", "Map foreign and U.S. duties", "Collect org charts and payroll evidence"] }, investmentTemporary: { title: "E-2 Treaty Investor", summary: "Best for founders or investors from treaty countries who have made or are making a substantial U.S. investment.", score: 82, steps: ["Confirm treaty nationality", "Organize investment evidence", "Draft business and source-of-funds story"] }, aos: { title: "Adjustment of Status Bundle", summary: "Best when the applicant is ready to file I-485 with related work authorization and travel documents.", score: 79, steps: ["Confirm priority date and eligibility", "Collect civil documents", "Prepare I-485, I-765, and I-131 data"] }, renewal: { title: "Extension, Amendment, or Change of Employer", summary: "Best when the existing immigration category is still viable but facts have changed or status needs to continue.", score: 81, steps: ["Compare current approval to new facts", "Identify material changes", "Refresh employer and status evidence"] } }; const form = document.querySelector("#intakeForm"); const routeTitle = document.querySelector("#routeTitle"); const routeSummary = document.querySelector("#routeSummary"); const fitMeter = document.querySelector("#fitMeter"); const fitScore = document.querySelector("#fitScore"); const nextSteps = document.querySelector("#nextSteps"); const packetButton = document.querySelector("#generatePacket"); function formValue(name) { return new FormData(form).get(name); } function pickRoute() { const strength = formValue("strength"); const goal = formValue("goal"); if (goal === "aos") return routes.aos; if (goal === "renewal") return routes.renewal; if (strength === "extraordinary" && goal === "green") return routes.extraordinaryGreen; if (strength === "extraordinary") return routes.extraordinaryTemporary; if (strength === "manager") return routes.managerTemporary; if (strength === "investment") return routes.investmentTemporary; return routes.companyTemporary; } function renderRoute() { const route = pickRoute(); routeTitle.textContent = route.title; routeSummary.textContent = route.summary; fitScore.textContent = `${route.score}%`; fitMeter.style.width = `${route.score}%`; nextSteps.innerHTML = route.steps.map((step) => `
Selected document
${detail.body}
${detail.output}