@empoweredvote/ev-ui 0.8.13 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4262,6 +4262,17 @@ function qualifyLocalTitle(baseTitle, pol) {
4262
4262
  prefix = prefix.replace(/\s+County$/, "");
4263
4263
  return `${prefix} ${baseTitle}`;
4264
4264
  }
4265
+ function deriveSeatSubtitle(pol, cleanTitle) {
4266
+ const dt = pol.district_type || "";
4267
+ if (!dt.startsWith("LOCAL") && dt !== "COUNTY") return null;
4268
+ const t = cleanTitle || "";
4269
+ if (/\bat[- ]large\b/i.test(t)) return "At-Large";
4270
+ let m = t.match(/\bward\s+(\d+)/i);
4271
+ if (m) return `Ward ${m[1]}`;
4272
+ m = t.match(/\bdistrict\s+(\d+)/i);
4273
+ if (m) return `District ${m[1]}`;
4274
+ return null;
4275
+ }
4265
4276
  function buildTitleAndSubtitle(pol) {
4266
4277
  const cleanTitle = stripRetain(pol.office_title);
4267
4278
  const cleanChamber = stripRetain(pol.chamber_name);
@@ -4282,6 +4293,8 @@ function buildTitleAndSubtitle(pol) {
4282
4293
  if (dashIdx > 0) return normalizeDistrictSubtitle(cleanTitle.slice(dashIdx + 3));
4283
4294
  if (pol.district_type === "NATIONAL_JUDICIAL")
4284
4295
  return cleanChamber || null;
4296
+ const seatFromTitle = deriveSeatSubtitle(pol, cleanTitle);
4297
+ if (seatFromTitle) return seatFromTitle;
4285
4298
  if (pol.district_id && /^[1-9]\d*$/.test(pol.district_id))
4286
4299
  return `District ${pol.district_id}`;
4287
4300
  if (pol.district_id === "0" && !/(_EXEC)$/.test(pol.district_type))