/* eslint-disable */
/* Question data for all three flows */

const Q_GATE = {
  id: "gate",
  kicker: "Question 01 / The gate",
  title: "What brings you in today?",
  sub: "One quick question. Whatever you say next decides what we ask — and what you might win.",
  multi: false,
  options: [
    { id: "personal", label: "Personal banking", hint: "Money, cards, mortgage, the usual" },
    { id: "business", label: "My business", hint: "Loans, payroll, business accounts" },
    { id: "both",     label: "Both — I do both with you already", hint: "Personal customer who also runs a business" },
    { id: "just",     label: "Just stopped in", hint: "Waiting, browsing, here for the water" },
  ],
};

/* ============ BUSINESS FLOW ============ */
const BIZ = [
  {
    id: "biz_role",
    kicker: "Business · 01 of 10",
    title: "First — your role at the business?",
    sub: "We use this to route you to the right banker, not for marketing.",
    options: [
      { id: "owner",    label: "Owner" },
      { id: "co",       label: "Co-owner" },
      { id: "founder",  label: "Founder" },
      { id: "cfo",      label: "CFO / Finance lead" },
      { id: "ops",      label: "Operations" },
      { id: "help",     label: "I help run it" },
    ],
  },
  {
    id: "biz_industry",
    kicker: "Business · 02 of 10",
    title: "What kind of business?",
    options: [
      { id: "food",   label: "Food, drink, hospitality" },
      { id: "retail", label: "Retail / e-commerce" },
      { id: "pro",    label: "Professional services" },
      { id: "trades", label: "Construction & trades" },
      { id: "health", label: "Healthcare / wellness" },
      { id: "tech",   label: "Tech / software" },
      { id: "creator",label: "Creator / media / agency" },
      { id: "real",   label: "Real estate" },
      { id: "mfg",    label: "Manufacturing" },
      { id: "transp", label: "Transportation / logistics" },
      { id: "edu",    label: "Education / nonprofit" },
      { id: "other",  label: "Something else" },
    ],
  },
  {
    id: "biz_age",
    kicker: "Business · 03 of 10",
    title: "How long have you been in business?",
    options: [
      { id: "pre",   label: "Pre-revenue / starting up" },
      { id: "lt1",   label: "Less than a year" },
      { id: "1to3",  label: "1 to 3 years" },
      { id: "3to10", label: "3 to 10 years" },
      { id: "10plus",label: "10+ years" },
    ],
  },
  {
    id: "biz_rev",
    kicker: "Business · 04 of 10",
    title: "Annual revenue, ballpark?",
    sub: "Banker uses this to size accounts and pre-qualify lending — skip if you'd rather not say.",
    disclaimer: "Educational pre-qualification only. Not a credit decision. Subject to Chase underwriting standards. ECOA/Reg B adverse-action requirements only attach to actual credit applications.",
    disclaimerLabel: "Reg B / educational only",
    options: [
      { id: "u100",   label: "Under $100K" },
      { id: "100_500",label: "$100K – $500K" },
      { id: "500_2",  label: "$500K – $2M" },
      { id: "2_10",   label: "$2M – $10M" },
      { id: "10plus", label: "$10M+" },
      { id: "skip",   label: "I'd rather skip" },
    ],
  },
  {
    id: "biz_intent",
    kicker: "Business · 05 of 10",
    title: "Why are you here today?",
    sub: "The honest reason. We can pull the right banker off the floor in real time.",
    options: [
      { id: "open",   label: "Open a business account" },
      { id: "loan",   label: "Loan or line of credit" },
      { id: "switch", label: "Switching from another bank" },
      { id: "talk",   label: "Talk to a banker about something" },
      { id: "exist",  label: "Help with an account I already have" },
      { id: "explore",label: "Just exploring" },
    ],
  },
  {
    id: "biz_capital",
    kicker: "Business · 06 of 10",
    title: "Capital you might need in the next 12 months?",
    sub: "Multi-select. Pick anything that applies.",
    disclaimer: "Tells the banker what to prepare. Pre-qual ranges shown later are illustrative. Real Chase lending decisions go through underwriting and disclosure flow.",
    disclaimerLabel: "Educational pre-qualification only",
    multi: true,
    options: [
      { id: "wc",     label: "Working capital" },
      { id: "equip",  label: "Equipment financing" },
      { id: "real",   label: "Real estate / commercial property" },
      { id: "sba",    label: "SBA-backed loan" },
      { id: "bridge", label: "Bridge / short-term cash" },
      { id: "expand", label: "Expansion to new locations" },
      { id: "growth", label: "Growth — hiring, marketing" },
      { id: "none",   label: "None right now" },
    ],
  },
  {
    id: "biz_bank",
    kicker: "Business · 07 of 10",
    title: "Where do you bank for the business today?",
    options: [
      { id: "big1",   label: "Bank of America" },
      { id: "big2",   label: "Wells Fargo" },
      { id: "big3",   label: "Another big bank" },
      { id: "local",  label: "Local / community bank" },
      { id: "cu",     label: "Credit union" },
      { id: "online", label: "Online-only (Mercury, Brex, Novo…)" },
      { id: "personal",label: "Honestly? My personal account" },
      { id: "us",     label: "I bank with Chase for business" },
    ],
  },
  /* Q08 — Chase business customers: surface what they're NOT using yet (upsell) */
  {
    id: "biz_chase_gap",
    kicker: "Business · 08 of 10",
    title: "What do you already use Chase for on the business side?",
    sub: "Multi-select. Whatever's missing, we'll show you what's possible.",
    multi: true,
    onlyIf: (a) => a.biz_bank === "us",
    options: [
      { id: "checking", label: "Business checking" },
      { id: "card",     label: "Chase Ink card" },
      { id: "lending",  label: "Lending or line of credit" },
      { id: "merchant", label: "Chase Payment Solutions℠" },
      { id: "payroll",  label: "Payroll integration" },
      { id: "wealth",   label: "Wealth / treasury" },
    ],
  },
  /* Q08 — Non-Chase business customers: positive framing — what would win them over */
  {
    id: "biz_switch",
    kicker: "Business · 08 of 10",
    title: "What matters most to your business in a bank?",
    sub: "Pick up to two. Banker leads with these.",
    multi: true,
    max: 2,
    onlyIf: (a) => a.biz_bank && a.biz_bank !== "us",
    options: [
      { id: "lending",  label: "Faster lending decisions" },
      { id: "credit",   label: "Higher credit limits" },
      { id: "advisor",  label: "A real banker who picks up" },
      { id: "rates",    label: "Better processing rates" },
      { id: "tech",     label: "Modern app + integrations" },
      { id: "smb",      label: "Treats small business seriously" },
    ],
  },
  {
    id: "biz_payments",
    kicker: "Business · 09 of 10",
    title: "Take card payments?",
    sub: "If you're not on Chase Payment Solutions, we usually beat your current processing rate — that's why we ask.",
    options: [
      { id: "none",   label: "Not yet — cash & invoices only" },
      { id: "square", label: "Square" },
      { id: "stripe", label: "Stripe" },
      { id: "toast",  label: "Toast" },
      { id: "clover", label: "Clover" },
      { id: "shop",   label: "Shopify Payments" },
      { id: "ours",   label: "Already on Chase Payment Solutions" },
      { id: "paypal", label: "PayPal" },
      { id: "other",  label: "Something else" },
    ],
  },
  /* Q10 is dynamic — built at runtime from biz_capital */
];

/* Adaptive Q10 logic */
function buildBizQ10(capital) {
  const has = (k) => capital && capital.includes(k);
  if (has("equip") || has("real")) return {
    id: "biz_q10_timeline",
    kicker: "Business · 10 of 10",
    title: "Timeline on that?",
    sub: "Equipment or property — when are you thinking?",
    options: [
      { id: "3mo",   label: "Next 3 months" },
      { id: "12mo",  label: "Within 12 months" },
      { id: "2yr",   label: "1–2 years out" },
      { id: "ns",    label: "Not sure yet" },
    ],
  };
  if (has("wc") || has("bridge")) return {
    id: "biz_q10_use",
    kicker: "Business · 10 of 10",
    title: "What would the cash mostly cover?",
    options: [
      { id: "inv",  label: "Inventory" },
      { id: "pay",  label: "Payroll" },
      { id: "seas", label: "Seasonal swings" },
      { id: "ar",   label: "Receivables gap" },
      { id: "other",label: "Something else" },
    ],
  };
  if (has("expand") || has("growth")) return {
    id: "biz_q10_growth",
    kicker: "Business · 10 of 10",
    title: "How fast are you growing?",
    options: [
      { id: "13",   label: "1–3 hires planned" },
      { id: "510",  label: "5–10 hires planned" },
      { id: "10p",  label: "10+ hires" },
      { id: "loc",  label: "Opening new locations" },
    ],
  };
  return {
    id: "biz_q10_future",
    kicker: "Business · 10 of 10",
    title: "What's the next big thing on your radar?",
    sub: "Honest answer — banker can help line things up.",
    options: [
      { id: "hire",   label: "Hiring more people" },
      { id: "tech",   label: "Better tools or systems" },
      { id: "save",   label: "Building a cash cushion" },
      { id: "grow",   label: "New product or service line" },
      { id: "succ",   label: "Succession or selling someday" },
      { id: "no",     label: "Honestly, just keeping it steady" },
    ],
  };
}

/* ============ PERSONAL FLOW ============ */
const PERS = [
  {
    id: "p_intent",
    kicker: "Personal · 01 of 07",
    title: "What kind of move are you thinking about?",
    options: [
      { id: "new",    label: "Opening a new account or card" },
      { id: "manage", label: "Getting more from what I have" },
      { id: "switch", label: "Switching from another bank" },
      { id: "look",   label: "Just exploring my options" },
    ],
  },
  {
    id: "p_bank",
    kicker: "Personal · 02 of 07",
    title: "Where do you bank today?",
    options: [
      { id: "big_boa",  label: "Bank of America" },
      { id: "big_wf",   label: "Wells Fargo" },
      { id: "big_citi", label: "Citi" },
      { id: "big_other",label: "Another big bank" },
      { id: "cu",     label: "Credit union" },
      { id: "local",  label: "Local / community bank" },
      { id: "online", label: "Online-only (Chime, Ally, SoFi…)" },
      { id: "us",     label: "I'm already with Chase" },
      { id: "none",   label: "Don't really bank anywhere" },
    ],
  },
  /* Q3 — only shown to non-Chase customers. Adaptive framing based on Q1 intent. */
  {
    id: "p_switch",
    kicker: "Personal · 03 of 07",
    title: "What matters most to you in a bank?",
    sub: "Pick up to two — banker leads with these.",
    multi: true,
    max: 2,
    onlyIf: (a) => a.p_bank && a.p_bank !== "us",
    options: [
      { id: "travel",  label: "Stronger travel rewards" },
      { id: "cash",    label: "Better everyday cashback" },
      { id: "fees",    label: "Lower fees, no overdraft surprises" },
      { id: "app",     label: "Best-in-class app + alerts" },
      { id: "invest",  label: "Investing in the same place I bank" },
      { id: "branch",  label: "Branches and bankers nearby" },
    ],
  },
  /* Q3-alt — Chase customers get asked what they want MORE of (positive). */
  {
    id: "p_chase_use",
    kicker: "Personal · 03 of 07",
    title: "What do you use Chase for today?",
    sub: "Pick all that apply — helps us spot what you're missing.",
    multi: true,
    onlyIf: (a) => a.p_bank === "us",
    options: [
      { id: "checking", label: "Checking / debit" },
      { id: "savings",  label: "Savings" },
      { id: "card",     label: "A Chase credit card" },
      { id: "mortgage", label: "Mortgage / home equity" },
      { id: "auto",     label: "Auto loan" },
      { id: "invest",   label: "J.P. Morgan investing" },
      { id: "biz",      label: "Business banking" },
    ],
  },
  {
    id: "p_travel",
    kicker: "Personal · 04 of 07",
    title: "How often do you travel?",
    sub: "We're matching you to the right Sapphire or Freedom card.",
    options: [
      { id: "intl",  label: "Multiple international trips a year" },
      { id: "13",    label: "1–3 trips a year" },
      { id: "dom",   label: "Mostly domestic / road trips" },
      { id: "rare",  label: "Rarely — not a traveler" },
      { id: "goal",  label: "It's a goal — not yet" },
    ],
  },
  {
    id: "p_move",
    kicker: "Personal · 05 of 07",
    title: "Anything big in the next 12 months?",
    sub: "Multi-select. We'll line up Chase products that help.",
    multi: true,
    options: [
      { id: "home",   label: "Buy a home" },
      { id: "refi",   label: "Refinance" },
      { id: "car",    label: "Buy a car" },
      { id: "invest", label: "Start investing seriously" },
      { id: "debt",   label: "Consolidate or pay off debt" },
      { id: "save",   label: "Save toward a goal" },
      { id: "trip",   label: "A big trip" },
      { id: "biz",    label: "Start a business or side hustle" },
      { id: "none",   label: "Nothing planned" },
    ],
  },
  {
    id: "p_side",
    kicker: "Personal · 06 of 07",
    title: "Earn any money outside your W-2?",
    sub: "If you do, Chase Ink + Business Banking can put cash back on those expenses — that's why we ask.",
    options: [
      { id: "free",     label: "Freelance or consulting" },
      { id: "rental",   label: "Rental property" },
      { id: "etsy",     label: "Etsy / e-commerce / reselling" },
      { id: "creator",  label: "Content / creator income" },
      { id: "rei",      label: "Real estate investing" },
      { id: "biz",      label: "Already running my own business" },
      { id: "no",       label: "No, just my day job" },
    ],
  },
  {
    id: "p_stage",
    kicker: "Personal · 07 of 07",
    title: "Where are you in life, roughly?",
    options: [
      { id: "first",  label: "Building credit / first card" },
      { id: "work",   label: "Working & building wealth" },
      { id: "fam",    label: "Family, mortgage, kids" },
      { id: "ahead",  label: "Looking ahead to retirement" },
      { id: "ret",    label: "Already retired" },
    ],
  },
];

/* ============ JUST-HERE FLOW ============ */
const JUST = [
  {
    id: "j_customer",
    kicker: "Just here · 01 of 04",
    title: "Are you a Chase customer?",
    options: [
      { id: "pers",   label: "Yes — personal" },
      { id: "biz",    label: "Yes — business" },
      { id: "card",   label: "I have a Chase card but don't bank here" },
      { id: "no",     label: "No, I bank elsewhere" },
      { id: "neither",label: "Not really anywhere" },
    ],
  },
  /* Q02 — Chase customers: positive framing — what would they want next */
  {
    id: "j_chase_more",
    kicker: "Just here · 02 of 04",
    title: "What would you love Chase to help with next?",
    sub: "Pick one — banker can show you in 5 minutes.",
    onlyIf: (a) => a.j_customer === "pers" || a.j_customer === "biz" || a.j_customer === "card",
    options: [
      { id: "card",     label: "Find me a better card" },
      { id: "rewards",  label: "Get more from my rewards" },
      { id: "invest",   label: "Start investing" },
      { id: "home",     label: "Talk about a mortgage" },
      { id: "biz",      label: "Set up a business account" },
      { id: "nothing",  label: "Honestly — I'm good" },
    ],
  },
  /* Q02 — Non-Chase: positive framing — what would win them over */
  {
    id: "j_switch",
    kicker: "Just here · 02 of 04",
    title: "If something caught your eye at Chase, what would it be?",
    sub: "No pressure — just helps us know what to mention.",
    onlyIf: (a) => a.j_customer === "no" || a.j_customer === "neither",
    options: [
      { id: "rewards", label: "Stronger rewards" },
      { id: "travel",  label: "Travel benefits" },
      { id: "fees",    label: "No surprise fees" },
      { id: "app",     label: "An app that just works" },
      { id: "human",   label: "A real banker I can reach" },
      { id: "branch",  label: "Branches near me" },
      { id: "nothing", label: "Honestly — nothing right now" },
    ],
  },
  {
    id: "j_market",
    kicker: "Just here · 03 of 04",
    title: "In the market for anything this year?",
    sub: "Multi-select. We'll line up specific Chase products.",
    multi: true,
    options: [
      { id: "card",   label: "New credit card" },
      { id: "home",   label: "Buy or refi a home" },
      { id: "car",    label: "Buy a car" },
      { id: "invest", label: "Start investing" },
      { id: "biz",    label: "Start a side hustle / business" },
      { id: "switch", label: "Switching banks" },
      { id: "water",  label: "Honestly just here for the water" },
    ],
  },
  /* Q4 is the email capture screen — handled separately */
];

window.QUESTIONS = { Q_GATE, BIZ, PERS, JUST, buildBizQ10 };
