@dra2020/dra-types 1.8.130 → 1.8.132

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/dra-types.js CHANGED
@@ -107,8 +107,27 @@ exports.BucketMap = {
107
107
 
108
108
 
109
109
  Object.defineProperty(exports, "__esModule", ({ value: true }));
110
- exports.BinGold = exports.BinOrange = exports.BinBrown = exports.BinOrangeRed = exports.BinRed = exports.computeDistrictColors = exports.ToExtendedColor = exports.allGroups16Colors = exports.colorsFromStopsPartisan = exports.colorsFromStops = exports.PaletteNames = exports.ColorFromRGBPcts = exports.AggregatePartisanColorStr = exports.AggregatePartisanColor = exports.AggregateEthnicColor = exports.ToEthnicColorStr = exports.ToPartisanShiftColor = exports.ToPartisanDistrictColor = exports.ToPartisanColorStr = exports.ToAllEthnicColor = exports.ethnicBackgroundColor = exports.makeStops = exports.DefaultPaletteDefaults = exports.EthnicFewStops = exports.PartisanPrecinctStops = exports.PartisanDistrictStops = exports.ColorByGreatD = exports.ColorByGoodD = exports.ColorByFairD = exports.ColorByEven = exports.ColorByFairR = exports.ColorByGoodR = exports.ColorByGreatR = exports.EthnicTextColor = exports.ColorByBlackAsian = exports.ColorByAsianHispanic = exports.ColorByAsianWhite = exports.ColorByHispanicBlack = exports.ColorByBlackWhite = exports.ColorByHispanicWhite = exports.ColorByMix = exports.ColorByMostlyNative = exports.ColorByMostlyAsian = exports.ColorByMostlyHispanic = exports.ColorByMostlyBlack = exports.ColorByMostlyWhite = exports.ColorBySolidAsian = exports.ColorBySolidHispanic = exports.ColorBySolidBlack = exports.ColorBySolidWhite = void 0;
111
- exports.colororderToColorindex = exports.colorflagToColorindex = exports.ColorFlags = exports.colorindexToRGB = exports.MaxFields = exports.FieldCountToColors = exports.BinColorLookup = exports.BinEthnicOther = exports.BinEthnicHispanic = exports.BinEthnicAsian = exports.BinEthnicBlack = exports.BinEthnicWhite = exports.BinBlack = exports.BinDeepPink = exports.BinMagenta = exports.BinDarkViolet = exports.BinBlueViolet = exports.BinBlue = exports.BinLightBlue = exports.BinCyan = exports.BinMediumSpringGreen = exports.BinLime = exports.BinChartreuse = exports.BinGreenish = exports.BinYellow = void 0;
110
+ exports.BinEthnicAsian = exports.BinEthnicBlack = exports.BinEthnicWhite = exports.BinBlack = exports.BinDeepPink = exports.BinMagenta = exports.BinDarkViolet = exports.BinBlueViolet = exports.BinBlue = exports.BinLightBlue = exports.BinCyan = exports.BinMediumSpringGreen = exports.BinLime = exports.BinChartreuse = exports.BinGreenish = exports.BinYellow = exports.BinGold = exports.BinOrange = exports.BinBrown = exports.BinOrangeRed = exports.BinRed = exports.PaletteNames = exports.DefaultPaletteDefaults = exports.EthnicFewStops = exports.PartisanPrecinctStops = exports.PartisanDistrictStops = exports.ColorByGreatD = exports.ColorByGoodD = exports.ColorByFairD = exports.ColorByEven = exports.ColorByFairR = exports.ColorByGoodR = exports.ColorByGreatR = exports.EthnicTextColor = exports.ColorByBlackAsian = exports.ColorByAsianHispanic = exports.ColorByAsianWhite = exports.ColorByHispanicBlack = exports.ColorByBlackWhite = exports.ColorByHispanicWhite = exports.ColorByMix = exports.ColorByMostlyNative = exports.ColorByMostlyAsian = exports.ColorByMostlyHispanic = exports.ColorByMostlyBlack = exports.ColorByMostlyWhite = exports.ColorBySolidAsian = exports.ColorBySolidHispanic = exports.ColorBySolidBlack = exports.ColorBySolidWhite = void 0;
111
+ exports.ColorFlags = exports.MaxFields = exports.FieldCountToColors = exports.BinColorLookup = exports.BinEthnicOther = exports.BinEthnicHispanic = void 0;
112
+ exports.makeStops = makeStops;
113
+ exports.ethnicBackgroundColor = ethnicBackgroundColor;
114
+ exports.ToAllEthnicColor = ToAllEthnicColor;
115
+ exports.ToPartisanColorStr = ToPartisanColorStr;
116
+ exports.ToPartisanDistrictColor = ToPartisanDistrictColor;
117
+ exports.ToPartisanShiftColor = ToPartisanShiftColor;
118
+ exports.ToEthnicColorStr = ToEthnicColorStr;
119
+ exports.AggregateEthnicColor = AggregateEthnicColor;
120
+ exports.AggregatePartisanColor = AggregatePartisanColor;
121
+ exports.AggregatePartisanColorStr = AggregatePartisanColorStr;
122
+ exports.ColorFromRGBPcts = ColorFromRGBPcts;
123
+ exports.colorsFromStops = colorsFromStops;
124
+ exports.colorsFromStopsPartisan = colorsFromStopsPartisan;
125
+ exports.allGroups16Colors = allGroups16Colors;
126
+ exports.ToExtendedColor = ToExtendedColor;
127
+ exports.computeDistrictColors = computeDistrictColors;
128
+ exports.colorindexToRGB = colorindexToRGB;
129
+ exports.colorflagToColorindex = colorflagToColorindex;
130
+ exports.colororderToColorindex = colororderToColorindex;
112
131
  // App libraries
113
132
  const PF = __webpack_require__(/*! ./packedfields */ "./lib/packedfields.ts");
114
133
  const datasets_1 = __webpack_require__(/*! ./datasets */ "./lib/datasets.ts");
@@ -233,7 +252,6 @@ function makeStops(stops, colors) {
233
252
  result.push({ stop: stops[i], color: colors[i] });
234
253
  return result;
235
254
  }
236
- exports.makeStops = makeStops;
237
255
  function partisanStops(stops, pd) {
238
256
  const palette = pd['partisanScale'];
239
257
  return makeStops(stops, colorsFromStopsPartisan(palette, 'partisanScale', stops));
@@ -255,7 +273,6 @@ function ethnicBackgroundColor(index, pd) {
255
273
  return colors[index];
256
274
  return '#ffffff';
257
275
  }
258
- exports.ethnicBackgroundColor = ethnicBackgroundColor;
259
276
  function ToAllEthnicColor(agg, dc, pd) {
260
277
  var _a;
261
278
  // Use VAP/CVAP if it exists
@@ -264,15 +281,12 @@ function ToAllEthnicColor(agg, dc, pd) {
264
281
  const builtin = ((_a = dc.dsMeta[did]) === null || _a === void 0 ? void 0 : _a.builtin) || dataset;
265
282
  return AggregateEthnicColor(PF.ToGetter(agg, dc, did, dataset), pd, builtin.endsWith('NH'));
266
283
  }
267
- exports.ToAllEthnicColor = ToAllEthnicColor;
268
284
  function ToPartisanColorStr(agg, dc, pd) {
269
285
  return ToPartisanColor(agg, dc, partisanStops(exports.PartisanPrecinctStops, pd));
270
286
  }
271
- exports.ToPartisanColorStr = ToPartisanColorStr;
272
287
  function ToPartisanDistrictColor(agg, dc, pd) {
273
288
  return ToPartisanColor(agg, dc, partisanDistrictStops(exports.PartisanDistrictStops, pd));
274
289
  }
275
- exports.ToPartisanDistrictColor = ToPartisanDistrictColor;
276
290
  function ToPartisanColor(agg, dc, stops) {
277
291
  const did = PF.toDatasetID(dc.primeEDS);
278
292
  if (dc.primeEDS === PF.DS_PVI2020) {
@@ -308,7 +322,6 @@ function ToPartisanShiftColor(agg, dc, datasets, pd, isDistrict) {
308
322
  // console.log('Shift (r, d, color): (' + rep + ', ' + dem + ', ' + color + ')');
309
323
  return color;
310
324
  }
311
- exports.ToPartisanShiftColor = ToPartisanShiftColor;
312
325
  function ToEthnicColorStr(agg, dc, pd, detail) {
313
326
  var _a;
314
327
  let ethnic = 'Wh';
@@ -366,7 +379,6 @@ function ToEthnicColorStr(agg, dc, pd, detail) {
366
379
  const pct = bInvert ? 1 - (num / den) : num / den;
367
380
  return baseclient_1.Util.execGradient(ethnicStops(exports.EthnicFewStops, pd), pct);
368
381
  }
369
- exports.ToEthnicColorStr = ToEthnicColorStr;
370
382
  // All Groups Mosaic
371
383
  function AggregateEthnicColor(getter, pd, nhAlone) {
372
384
  // Dataset should have 'Tot' field
@@ -422,7 +434,6 @@ function AggregateEthnicColor(getter, pd, nhAlone) {
422
434
  return exports.ColorByBlackAsian;
423
435
  return exports.ColorByMix;
424
436
  }
425
- exports.AggregateEthnicColor = AggregateEthnicColor;
426
437
  // This is used only for 2016_BG analytics, seemingly only for values, not colors (dave 12/9/21)
427
438
  function AggregatePartisanColor(getter) {
428
439
  // Dataset should have 'Tot' field
@@ -452,7 +463,6 @@ function AggregatePartisanColor(getter) {
452
463
  return exports.ColorByFairD;
453
464
  return exports.ColorByEven;
454
465
  }
455
- exports.AggregatePartisanColor = AggregatePartisanColor;
456
466
  function AggregatePartisanColorStr(getter, stops) {
457
467
  // Dataset should have 'Tot' field
458
468
  let totField = 'Tot';
@@ -471,7 +481,6 @@ function AggregatePartisanColorStr(getter, stops) {
471
481
  //console.log('Agg (r, d, color): (' + pctR + ', ' + pctD + ', ' + color + ')');
472
482
  return color;
473
483
  }
474
- exports.AggregatePartisanColorStr = AggregatePartisanColorStr;
475
484
  // This is the new gradient code
476
485
  function ColorFromRGBPcts(pctRed, pctGreen, pctBlue, stops) {
477
486
  let pctTot = pctRed + pctBlue;
@@ -480,7 +489,6 @@ function ColorFromRGBPcts(pctRed, pctGreen, pctBlue, stops) {
480
489
  pctBlue /= pctTot;
481
490
  return baseclient_1.Util.execGradient(stops, pctBlue);
482
491
  }
483
- exports.ColorFromRGBPcts = ColorFromRGBPcts;
484
492
  // Currently supported palettes
485
493
  exports.PaletteNames = ['jet_r', 'turbo_r', 'inferno_r', 'viridis_r', 'magma_r', 'plasma_r', 'Greys', 'bone_r',
486
494
  'draclassic', 'demographicsclassic', 'partisanclassic', 'allgroupsclassic', 'partisandistrictsclassic'];
@@ -498,7 +506,6 @@ function colorsFromStops(palette, stops, classicColors) {
498
506
  }
499
507
  return colors;
500
508
  }
501
- exports.colorsFromStops = colorsFromStops;
502
509
  function colorsFromStopsPartisan(palette, colorUse, stops) {
503
510
  if (palette === 'partisanclassic')
504
511
  return baseclient_1.Colors.PartisanPrecinctClassicColors;
@@ -516,7 +523,6 @@ function colorsFromStopsPartisan(palette, colorUse, stops) {
516
523
  }
517
524
  return colors;
518
525
  }
519
- exports.colorsFromStopsPartisan = colorsFromStopsPartisan;
520
526
  function allGroups16Colors(palette, colors) {
521
527
  let modColors = [];
522
528
  //if (palette === 'allgroupsclassic') // Only support classic for now
@@ -578,7 +584,6 @@ function allGroups16Colors(palette, colors) {
578
584
  }*/
579
585
  return modColors;
580
586
  }
581
- exports.allGroups16Colors = allGroups16Colors;
582
587
  function safeNumber(n) { n = Number(n); return typeof n !== 'number' || isNaN(n) ? 0 : n; }
583
588
  function safeStops(s) {
584
589
  if (!s)
@@ -630,7 +635,6 @@ function ToExtendedColor(agg, dc, colorBy) {
630
635
  return baseclient_1.Util.execGradient(makeStops(exports.EthnicFewStops, baseclient_1.Colors.EthnicFewClassicColors), num / den);
631
636
  }
632
637
  }
633
- exports.ToExtendedColor = ToExtendedColor;
634
638
  function computeDistrictColors(params) {
635
639
  let dcNew = [];
636
640
  for (let i = 0; i < params.aggregates.length; i++) {
@@ -675,7 +679,6 @@ function computeDistrictColors(params) {
675
679
  }
676
680
  return dcNew;
677
681
  }
678
- exports.computeDistrictColors = computeDistrictColors;
679
682
  ;
680
683
  exports.BinRed = 0;
681
684
  exports.BinOrangeRed = 1;
@@ -746,17 +749,14 @@ exports.MaxFields = 16;
746
749
  function colorindexToRGB(colorindex) {
747
750
  return exports.BinColorLookup[colorindex] || exports.BinColorLookup[exports.BinBrown];
748
751
  }
749
- exports.colorindexToRGB = colorindexToRGB;
750
752
  exports.ColorFlags = 'abcdefghijklmnopqrstuvwxyz';
751
753
  function colorflagToColorindex(nfields, colorflag) {
752
754
  let i = exports.ColorFlags.indexOf(colorflag);
753
755
  return i >= 0 && nfields > 0 && nfields <= exports.MaxFields ? exports.FieldCountToColors[nfields][i] : exports.BinBrown;
754
756
  }
755
- exports.colorflagToColorindex = colorflagToColorindex;
756
757
  function colororderToColorindex(nfields, order) {
757
758
  return order >= 0 && nfields > 0 && nfields <= exports.MaxFields ? exports.FieldCountToColors[nfields][order] : exports.BinBrown;
758
759
  }
759
- exports.colororderToColorindex = colororderToColorindex;
760
760
 
761
761
 
762
762
  /***/ }),
@@ -769,7 +769,20 @@ exports.colororderToColorindex = colororderToColorindex;
769
769
 
770
770
 
771
771
  Object.defineProperty(exports, "__esModule", ({ value: true }));
772
- exports.StateNameMap = exports.StateCodesOrdered = exports.isValidStateNameForUrl = exports.geoidToState = exports.StateCodeToStateId = exports.StateIdToStateCode = exports.blockmapToVTDmapCustom = exports.blockmapToVTDmap = exports.blockmapToState = exports.csvLine = exports.parseCSVLine = exports.canonicalDistrictIDOrdering = exports.canonicalDistrictIDGapFill = exports.canonicalDistrictIDFromNumber = exports.canonicalNumericFromDistrictID = exports.canonicalSortingDistrictID = exports.canonicalDistrictID = void 0;
772
+ exports.StateNameMap = exports.StateCodesOrdered = exports.StateCodeToStateId = exports.StateIdToStateCode = void 0;
773
+ exports.canonicalDistrictID = canonicalDistrictID;
774
+ exports.canonicalSortingDistrictID = canonicalSortingDistrictID;
775
+ exports.canonicalNumericFromDistrictID = canonicalNumericFromDistrictID;
776
+ exports.canonicalDistrictIDFromNumber = canonicalDistrictIDFromNumber;
777
+ exports.canonicalDistrictIDGapFill = canonicalDistrictIDGapFill;
778
+ exports.canonicalDistrictIDOrdering = canonicalDistrictIDOrdering;
779
+ exports.parseCSVLine = parseCSVLine;
780
+ exports.csvLine = csvLine;
781
+ exports.blockmapToState = blockmapToState;
782
+ exports.blockmapToVTDmap = blockmapToVTDmap;
783
+ exports.blockmapToVTDmapCustom = blockmapToVTDmapCustom;
784
+ exports.geoidToState = geoidToState;
785
+ exports.isValidStateNameForUrl = isValidStateNameForUrl;
773
786
  // Public libraries
774
787
  const baseclient_1 = __webpack_require__(/*! @dra2020/baseclient */ "@dra2020/baseclient");
775
788
  let reNumeric = /^(\D*)(\d*)(\D*)$/;
@@ -785,7 +798,6 @@ function canonicalDistrictID(districtID) {
785
798
  }
786
799
  return districtID;
787
800
  }
788
- exports.canonicalDistrictID = canonicalDistrictID;
789
801
  function reverseSubMapping(mbm, n) {
790
802
  let rev = {};
791
803
  mbm.forEach(blockid => {
@@ -824,7 +836,6 @@ function canonicalSortingDistrictID(districtID) {
824
836
  }
825
837
  return districtID;
826
838
  }
827
- exports.canonicalSortingDistrictID = canonicalSortingDistrictID;
828
839
  // Return numeric part of districtID (or -1 if there is none)
829
840
  function canonicalNumericFromDistrictID(districtID) {
830
841
  let a = reNumeric.exec(districtID);
@@ -835,7 +846,6 @@ function canonicalNumericFromDistrictID(districtID) {
835
846
  }
836
847
  return -1;
837
848
  }
838
- exports.canonicalNumericFromDistrictID = canonicalNumericFromDistrictID;
839
849
  function canonicalDistrictIDFromNumber(districtID, n) {
840
850
  let a = reNumeric.exec(districtID);
841
851
  if (a && a.length == 4) {
@@ -846,7 +856,6 @@ function canonicalDistrictIDFromNumber(districtID, n) {
846
856
  districtID = String(n);
847
857
  return districtID;
848
858
  }
849
- exports.canonicalDistrictIDFromNumber = canonicalDistrictIDFromNumber;
850
859
  // If purely numeric districtIDs and we are missing some number of IDs less than
851
860
  function canonicalDistrictIDGapFill(keys) {
852
861
  if (keys == null || keys.length == 0)
@@ -867,7 +876,6 @@ function canonicalDistrictIDGapFill(keys) {
867
876
  }
868
877
  return keys;
869
878
  }
870
- exports.canonicalDistrictIDGapFill = canonicalDistrictIDGapFill;
871
879
  function canonicalDistrictIDOrdering(order) {
872
880
  let keys = Object.keys(order);
873
881
  let i;
@@ -888,7 +896,6 @@ function canonicalDistrictIDOrdering(order) {
888
896
  delete order['ZZ'];
889
897
  return order;
890
898
  }
891
- exports.canonicalDistrictIDOrdering = canonicalDistrictIDOrdering;
892
899
  let reArray = [
893
900
  // comma-delimited
894
901
  /^(\d\d[^\s,']*)[\s]*,[\s]*([^\s']+)[\s]*$/,
@@ -931,7 +938,6 @@ function parseCSVLine(line) {
931
938
  }
932
939
  return null;
933
940
  }
934
- exports.parseCSVLine = parseCSVLine;
935
941
  function csvLine(coder, line) {
936
942
  if (!coder || !line)
937
943
  return null;
@@ -943,18 +949,15 @@ function csvLine(coder, line) {
943
949
  return null;
944
950
  return { geoid: parse.fields[0], districtID: parse.fields[1] };
945
951
  }
946
- exports.csvLine = csvLine;
947
952
  function blockmapToState(blockMap) {
948
953
  for (var id in blockMap)
949
954
  if (blockMap.hasOwnProperty(id))
950
955
  return geoidToState(id);
951
956
  return null;
952
957
  }
953
- exports.blockmapToState = blockmapToState;
954
958
  function blockmapToVTDmap(blockMap, mbm, altBlocks) {
955
959
  return blockmapToVTDmapCustom(blockMap, mbm, mbm, altBlocks);
956
960
  }
957
- exports.blockmapToVTDmap = blockmapToVTDmap;
958
961
  // blockToVTD:
959
962
  // Take BlockMapping (simple map of GEOID to districtID) and a per-state map of block-level GEOID to VTD
960
963
  // and return the output mapping of VTD to districtID, as well a data structure that describes any VTD's
@@ -1113,7 +1116,6 @@ function blockmapToVTDmapCustom(blockMap, inMbm, outMbm, altBlocks) {
1113
1116
  res.outOrder = canonicalDistrictIDOrdering(res.outOrder);
1114
1117
  return res;
1115
1118
  }
1116
- exports.blockmapToVTDmapCustom = blockmapToVTDmapCustom;
1117
1119
  exports.StateIdToStateCode = {
1118
1120
  '01': 'AL',
1119
1121
  '02': 'AK',
@@ -1229,7 +1231,6 @@ function geoidToState(geoid) {
1229
1231
  return null;
1230
1232
  return exports.StateIdToStateCode[a[1]];
1231
1233
  }
1232
- exports.geoidToState = geoidToState;
1233
1234
  const ValidStateNamesForUrl = {
1234
1235
  'alabama': true,
1235
1236
  'alaska': true,
@@ -1287,7 +1288,6 @@ const ValidStateNamesForUrl = {
1287
1288
  function isValidStateNameForUrl(s) {
1288
1289
  return (typeof s === 'string' && s in ValidStateNamesForUrl);
1289
1290
  }
1290
- exports.isValidStateNameForUrl = isValidStateNameForUrl;
1291
1291
  // StateCodes in state name alphabetically order
1292
1292
  exports.StateCodesOrdered = [
1293
1293
  "AL",
@@ -1409,15 +1409,17 @@ exports.StateNameMap = {
1409
1409
 
1410
1410
 
1411
1411
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1412
- exports.datasetRestrict = exports.isColorBy = exports.parseColorBy = exports.formColorBy = exports.sortFields = void 0;
1412
+ exports.sortFields = sortFields;
1413
+ exports.formColorBy = formColorBy;
1414
+ exports.parseColorBy = parseColorBy;
1415
+ exports.isColorBy = isColorBy;
1416
+ exports.datasetRestrict = datasetRestrict;
1413
1417
  function sortFields(f1, f2) {
1414
1418
  return (f1.order || 0) - (f2.order || 0);
1415
1419
  }
1416
- exports.sortFields = sortFields;
1417
1420
  function formColorBy(datasetid, field) {
1418
1421
  return `${datasetid}:${field}`;
1419
1422
  }
1420
- exports.formColorBy = formColorBy;
1421
1423
  function parseColorBy(colorby) {
1422
1424
  if (colorby) {
1423
1425
  let a = colorby.split(':');
@@ -1426,12 +1428,10 @@ function parseColorBy(colorby) {
1426
1428
  }
1427
1429
  return { datasetid: '', field: '' };
1428
1430
  }
1429
- exports.parseColorBy = parseColorBy;
1430
1431
  function isColorBy(colorby) {
1431
1432
  let { datasetid, field } = parseColorBy(colorby);
1432
1433
  return !!datasetid && !!field;
1433
1434
  }
1434
- exports.isColorBy = isColorBy;
1435
1435
  ;
1436
1436
  ;
1437
1437
  function datasetRestrict(ds) {
@@ -1439,7 +1439,6 @@ function datasetRestrict(ds) {
1439
1439
  return ds.meta[ds.id].restrict;
1440
1440
  return null;
1441
1441
  }
1442
- exports.datasetRestrict = datasetRestrict;
1443
1442
 
1444
1443
 
1445
1444
  /***/ }),
@@ -1464,7 +1463,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1464
1463
 
1465
1464
 
1466
1465
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1467
- exports.adminGroup = exports.hideGroup = exports.GROUP_ADMIN = exports.GROUP_BLOCKED = exports.GROUP_REMOVED = exports.GROUP_SEEN = exports.GROUP_VERIFIED = exports.GROUP_OWNER = void 0;
1466
+ exports.GROUP_ADMIN = exports.GROUP_BLOCKED = exports.GROUP_REMOVED = exports.GROUP_SEEN = exports.GROUP_VERIFIED = exports.GROUP_OWNER = void 0;
1467
+ exports.hideGroup = hideGroup;
1468
+ exports.adminGroup = adminGroup;
1468
1469
  exports.GROUP_OWNER = 1;
1469
1470
  exports.GROUP_VERIFIED = 2;
1470
1471
  exports.GROUP_SEEN = 4;
@@ -1474,11 +1475,9 @@ exports.GROUP_ADMIN = 32;
1474
1475
  function hideGroup(flags) {
1475
1476
  return (flags & (exports.GROUP_REMOVED | exports.GROUP_BLOCKED)) != 0;
1476
1477
  }
1477
- exports.hideGroup = hideGroup;
1478
1478
  function adminGroup(flags) {
1479
1479
  return (flags & (exports.GROUP_ADMIN | exports.GROUP_OWNER)) != 0;
1480
1480
  }
1481
- exports.adminGroup = adminGroup;
1482
1481
 
1483
1482
 
1484
1483
  /***/ }),
@@ -1491,7 +1490,8 @@ exports.adminGroup = adminGroup;
1491
1490
 
1492
1491
 
1493
1492
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1494
- exports.collectionToLandmarks = exports.landmarksToCollection = void 0;
1493
+ exports.landmarksToCollection = landmarksToCollection;
1494
+ exports.collectionToLandmarks = collectionToLandmarks;
1495
1495
  const baseclient_1 = __webpack_require__(/*! @dra2020/baseclient */ "@dra2020/baseclient");
1496
1496
  function landmarksToCollection(landmarks) {
1497
1497
  if (landmarks == null)
@@ -1514,7 +1514,6 @@ function landmarksToCollection(landmarks) {
1514
1514
  });
1515
1515
  return col;
1516
1516
  }
1517
- exports.landmarksToCollection = landmarksToCollection;
1518
1517
  function collectionToLandmarks(col) {
1519
1518
  let landmarks = {};
1520
1519
  if (col && col.features)
@@ -1534,7 +1533,6 @@ function collectionToLandmarks(col) {
1534
1533
  });
1535
1534
  return landmarks;
1536
1535
  }
1537
- exports.collectionToLandmarks = collectionToLandmarks;
1538
1536
 
1539
1537
 
1540
1538
  /***/ }),
@@ -1559,7 +1557,42 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1559
1557
 
1560
1558
 
1561
1559
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1562
- exports.pvi2020Str = exports.calcRaw2020Pvi = exports.pviStr = exports.calcRawPvi = exports.calcShift = exports.ToGetterPvi20 = exports.ToGetterPvi16 = exports.ToGetter = exports.fieldGetterNotLoaded = exports.findPackedField = exports.getPackedField = exports.diffPackedFields = exports.decrementPackedFields = exports.aggregateCount = exports.aggregatePackedFields = exports.packedCopy = exports.zeroPackedCopy = exports.zeroPackedFields = exports.retrievePackedIndex = exports.retrievePackedFields = exports.pushedExtPackedFields = exports.featurePushedExtPackedFields = exports.featurePushExtPackedFields = exports.toDatasetID = exports.isExtDataset = exports.setPackedFields = exports.hasPackedFields = exports.clearPackedFields = exports.computeOnePackedFields = exports.computePackedFields = exports.initPackedFields = exports.computeMetaIndex = exports.getDatasetField = exports.sortedFieldList = exports.fGet = exports.DS_PRES2016 = exports.DS_PRES2020 = exports.DS_PVI2016 = exports.PVI2020_Title = exports.DS_PVI2020 = exports.DATASET_TYPE_OTHER = exports.DATASET_TYPE_PVI = exports.DATASET_TYPE_ELECTION = exports.DATASET_TYPE_DEMOGRAPHIC = exports.AGG_pvi = exports.AGG_pres2016 = exports.AGG_pres2008 = exports.AGG_DEMOGRAPHIC18 = exports.AGG_DEMOGRAPHIC = void 0;
1560
+ exports.DS_PRES2016 = exports.DS_PRES2020 = exports.DS_PVI2016 = exports.PVI2020_Title = exports.DS_PVI2020 = exports.DATASET_TYPE_OTHER = exports.DATASET_TYPE_PVI = exports.DATASET_TYPE_ELECTION = exports.DATASET_TYPE_DEMOGRAPHIC = exports.AGG_pvi = exports.AGG_pres2016 = exports.AGG_pres2008 = exports.AGG_DEMOGRAPHIC18 = exports.AGG_DEMOGRAPHIC = void 0;
1561
+ exports.fGet = fGet;
1562
+ exports.sortedFieldList = sortedFieldList;
1563
+ exports.getDatasetField = getDatasetField;
1564
+ exports.computeMetaIndex = computeMetaIndex;
1565
+ exports.initPackedFields = initPackedFields;
1566
+ exports.computePackedFields = computePackedFields;
1567
+ exports.computeOnePackedFields = computeOnePackedFields;
1568
+ exports.clearPackedFields = clearPackedFields;
1569
+ exports.hasPackedFields = hasPackedFields;
1570
+ exports.setPackedFields = setPackedFields;
1571
+ exports.isExtDataset = isExtDataset;
1572
+ exports.toDatasetID = toDatasetID;
1573
+ exports.featurePushExtPackedFields = featurePushExtPackedFields;
1574
+ exports.featurePushedExtPackedFields = featurePushedExtPackedFields;
1575
+ exports.pushedExtPackedFields = pushedExtPackedFields;
1576
+ exports.retrievePackedFields = retrievePackedFields;
1577
+ exports.retrievePackedIndex = retrievePackedIndex;
1578
+ exports.zeroPackedFields = zeroPackedFields;
1579
+ exports.zeroPackedCopy = zeroPackedCopy;
1580
+ exports.packedCopy = packedCopy;
1581
+ exports.aggregatePackedFields = aggregatePackedFields;
1582
+ exports.aggregateCount = aggregateCount;
1583
+ exports.decrementPackedFields = decrementPackedFields;
1584
+ exports.diffPackedFields = diffPackedFields;
1585
+ exports.getPackedField = getPackedField;
1586
+ exports.findPackedField = findPackedField;
1587
+ exports.fieldGetterNotLoaded = fieldGetterNotLoaded;
1588
+ exports.ToGetter = ToGetter;
1589
+ exports.ToGetterPvi16 = ToGetterPvi16;
1590
+ exports.ToGetterPvi20 = ToGetterPvi20;
1591
+ exports.calcShift = calcShift;
1592
+ exports.calcRawPvi = calcRawPvi;
1593
+ exports.pviStr = pviStr;
1594
+ exports.calcRaw2020Pvi = calcRaw2020Pvi;
1595
+ exports.pvi2020Str = pvi2020Str;
1563
1596
  const baseclient_1 = __webpack_require__(/*! @dra2020/baseclient */ "@dra2020/baseclient");
1564
1597
  exports.AGG_DEMOGRAPHIC = 'demographic';
1565
1598
  exports.AGG_DEMOGRAPHIC18 = 'demographic18';
@@ -1578,7 +1611,6 @@ exports.DS_PRES2016 = 'E16GPR';
1578
1611
  function fGet(f, p) {
1579
1612
  return fGetW(f, null, p);
1580
1613
  }
1581
- exports.fGet = fGet;
1582
1614
  // Note f is a direct GeoJSON feature
1583
1615
  // Called when building packedFields; after that f.properties.datasets is deleted, so then it's only useful for non-dataset properties.
1584
1616
  function fGetW(f, datasetKey, p) {
@@ -1600,14 +1632,12 @@ function sortedFieldList(ds) {
1600
1632
  let kv = keys.map(k => { return { k, v: ds.fields[k] }; }).sort((a, b) => { return (a.v.order || 0) - (b.v.order || 0); });
1601
1633
  return kv.map(kv => kv.k);
1602
1634
  }
1603
- exports.sortedFieldList = sortedFieldList;
1604
1635
  function getDatasetField(f, dataset, field) {
1605
1636
  let pf = retrievePackedFields(f);
1606
1637
  let dxGroup = retrievePackedIndex(f);
1607
1638
  let did = toDatasetID(dataset);
1608
1639
  return getPackedField(dxGroup, pf, did, dataset, field);
1609
1640
  }
1610
- exports.getDatasetField = getDatasetField;
1611
1641
  function computeMetaIndex(datasetid, meta) {
1612
1642
  if (meta == null)
1613
1643
  return null;
@@ -1625,7 +1655,6 @@ function computeMetaIndex(datasetid, meta) {
1625
1655
  index.getDatasetField = getDatasetField;
1626
1656
  return index;
1627
1657
  }
1628
- exports.computeMetaIndex = computeMetaIndex;
1629
1658
  let nAlloc = 0;
1630
1659
  function allocPackedFieldsArray(length) {
1631
1660
  let ab = new ArrayBuffer(8 * length);
@@ -1641,7 +1670,6 @@ function initPackedFields(f) {
1641
1670
  f.properties.packedFields = {};
1642
1671
  f.properties.getDatasetField = getDatasetField;
1643
1672
  }
1644
- exports.initPackedFields = initPackedFields;
1645
1673
  function computePackedFields(f, index) {
1646
1674
  if (f.properties.packedFields)
1647
1675
  return f.properties.packedFields;
@@ -1663,7 +1691,6 @@ function computePackedFields(f, index) {
1663
1691
  delete f.properties.datasets;
1664
1692
  return f.properties.packedFields;
1665
1693
  }
1666
- exports.computePackedFields = computePackedFields;
1667
1694
  function computeOnePackedFields(f, index, did, datasetKey) {
1668
1695
  let af = allocPackedFieldsArray(index.length);
1669
1696
  af[0] = 0; // count of number of aggregates
@@ -1681,17 +1708,14 @@ function computeOnePackedFields(f, index, did, datasetKey) {
1681
1708
  f.properties.getDatasetField = index.getDatasetField;
1682
1709
  return f.properties.packedFields;
1683
1710
  }
1684
- exports.computeOnePackedFields = computeOnePackedFields;
1685
1711
  function clearPackedFields(f) {
1686
1712
  delete f.properties.packedIndex;
1687
1713
  delete f.properties.packedFields;
1688
1714
  delete f.properties.getDatasetField;
1689
1715
  }
1690
- exports.clearPackedFields = clearPackedFields;
1691
1716
  function hasPackedFields(f) {
1692
1717
  return f.properties.packedFields !== undefined;
1693
1718
  }
1694
- exports.hasPackedFields = hasPackedFields;
1695
1719
  function setPackedFields(f, pf, fIndex) {
1696
1720
  if (f.properties.packedFields !== undefined)
1697
1721
  throw 'Packed fields already set';
@@ -1699,16 +1723,13 @@ function setPackedFields(f, pf, fIndex) {
1699
1723
  f.properties.packedFields = pf;
1700
1724
  f.properties.getDatasetField = fIndex.properties.getDatasetField;
1701
1725
  }
1702
- exports.setPackedFields = setPackedFields;
1703
1726
  const reExtDataset = /^.*\.ds$/;
1704
1727
  function isExtDataset(did) {
1705
1728
  return did && reExtDataset.test(did);
1706
1729
  }
1707
- exports.isExtDataset = isExtDataset;
1708
1730
  function toDatasetID(datasetKey) {
1709
1731
  return isExtDataset(datasetKey) ? datasetKey : '';
1710
1732
  }
1711
- exports.toDatasetID = toDatasetID;
1712
1733
  function featurePushExtPackedFields(f, datasetid, index, data, card) {
1713
1734
  var _a;
1714
1735
  let blocks = ((_a = f === null || f === void 0 ? void 0 : f.properties) === null || _a === void 0 ? void 0 : _a.blocks) || (card.has(f.properties.id) ? [f.properties.id] : null);
@@ -1735,7 +1756,6 @@ function featurePushExtPackedFields(f, datasetid, index, data, card) {
1735
1756
  f.properties.packedFields[datasetid] = pfa;
1736
1757
  f.properties.packedIndex[datasetid] = index;
1737
1758
  }
1738
- exports.featurePushExtPackedFields = featurePushExtPackedFields;
1739
1759
  function featurePushedExtPackedFields(f, datasetid, card) {
1740
1760
  var _a;
1741
1761
  if (!f)
@@ -1748,7 +1768,6 @@ function featurePushedExtPackedFields(f, datasetid, card) {
1748
1768
  return true;
1749
1769
  return !!f.properties.packedFields[datasetid];
1750
1770
  }
1751
- exports.featurePushedExtPackedFields = featurePushedExtPackedFields;
1752
1771
  function pushedExtPackedFields(pf, datasetids) {
1753
1772
  if (pf && datasetids)
1754
1773
  for (let i = 0; i < datasetids.length; i++)
@@ -1756,19 +1775,16 @@ function pushedExtPackedFields(pf, datasetids) {
1756
1775
  return false;
1757
1776
  return !!pf;
1758
1777
  }
1759
- exports.pushedExtPackedFields = pushedExtPackedFields;
1760
1778
  function retrievePackedFields(f) {
1761
1779
  if (f.properties.packedFields === undefined)
1762
1780
  throw 'Feature should have pre-computed packed fields';
1763
1781
  return f.properties.packedFields;
1764
1782
  }
1765
- exports.retrievePackedFields = retrievePackedFields;
1766
1783
  function retrievePackedIndex(f) {
1767
1784
  if (f.properties.packedIndex === undefined)
1768
1785
  throw 'Feature should have pre-computed packed index';
1769
1786
  return f.properties.packedIndex;
1770
1787
  }
1771
- exports.retrievePackedIndex = retrievePackedIndex;
1772
1788
  // The first entry in the PackedFields aggregate is the count of items aggregated.
1773
1789
  // Treat a null instance as just a single entry with no aggregates.
1774
1790
  let abZero = new ArrayBuffer(8);
@@ -1787,7 +1803,6 @@ function zeroPackedFields(index) {
1787
1803
  });
1788
1804
  return pf;
1789
1805
  }
1790
- exports.zeroPackedFields = zeroPackedFields;
1791
1806
  function zeroPackedCopy(pf) {
1792
1807
  if (pf == null)
1793
1808
  return pfZero;
@@ -1800,7 +1815,6 @@ function zeroPackedCopy(pf) {
1800
1815
  });
1801
1816
  return copy;
1802
1817
  }
1803
- exports.zeroPackedCopy = zeroPackedCopy;
1804
1818
  function packedCopy(pf) {
1805
1819
  if (pf == null)
1806
1820
  return null;
@@ -1814,7 +1828,6 @@ function packedCopy(pf) {
1814
1828
  });
1815
1829
  return copy;
1816
1830
  }
1817
- exports.packedCopy = packedCopy;
1818
1831
  function aggregatePackedFields(agg, pf) {
1819
1832
  if (agg == null || pf == null)
1820
1833
  return agg;
@@ -1839,7 +1852,6 @@ function aggregatePackedFields(agg, pf) {
1839
1852
  });
1840
1853
  return agg;
1841
1854
  }
1842
- exports.aggregatePackedFields = aggregatePackedFields;
1843
1855
  function aggregateCount(agg) {
1844
1856
  // If we have multiple packedfieldarrays, all of them track the aggregate in zero spot.
1845
1857
  // So we just pick the one that happens to be come up first.
@@ -1848,7 +1860,6 @@ function aggregateCount(agg) {
1848
1860
  let pfa = baseclient_1.Util.nthProperty(agg);
1849
1861
  return pfa ? pfa[0] : 0;
1850
1862
  }
1851
- exports.aggregateCount = aggregateCount;
1852
1863
  function decrementPackedFields(agg, pf) {
1853
1864
  if (agg == null || pf == null)
1854
1865
  return agg;
@@ -1864,7 +1875,6 @@ function decrementPackedFields(agg, pf) {
1864
1875
  });
1865
1876
  return agg;
1866
1877
  }
1867
- exports.decrementPackedFields = decrementPackedFields;
1868
1878
  function diffPackedFields(main, parts) {
1869
1879
  main = packedCopy(retrievePackedFields(main));
1870
1880
  if (main == null || parts == null || parts.length == 0)
@@ -1873,25 +1883,20 @@ function diffPackedFields(main, parts) {
1873
1883
  parts.forEach((pf) => decrementPackedFields(main, pf));
1874
1884
  return main;
1875
1885
  }
1876
- exports.diffPackedFields = diffPackedFields;
1877
1886
  function getPackedField(index, pf, datasetid, dataset, field) {
1878
1887
  if (!index || !pf || !index[datasetid] || !pf[datasetid])
1879
1888
  return 0;
1880
1889
  let fields = index[datasetid].fields[dataset];
1881
1890
  return fields ? (fields[field] !== undefined ? pf[datasetid][fields[field]] : 0) : 0;
1882
1891
  }
1883
- exports.getPackedField = getPackedField;
1884
1892
  function findPackedField(index, pf, datasetid, dataset, field) {
1885
1893
  let fields = index[datasetid].fields[dataset];
1886
1894
  return fields ? (fields[field] !== undefined ? fields[field] : -1) : -1;
1887
1895
  }
1888
- exports.findPackedField = findPackedField;
1889
1896
  function fieldGetterNotLoaded(f) { return undefined; }
1890
- exports.fieldGetterNotLoaded = fieldGetterNotLoaded;
1891
1897
  function ToGetter(agg, dc, datasetid, datasetKey) {
1892
1898
  return (field) => { return getPackedField(dc.dsIndex, agg, datasetid, datasetKey, field); };
1893
1899
  }
1894
- exports.ToGetter = ToGetter;
1895
1900
  function ToGetterPvi16(agg, dc, datasetKey) {
1896
1901
  return (field) => {
1897
1902
  if (field === 'R')
@@ -1904,7 +1909,6 @@ function ToGetterPvi16(agg, dc, datasetKey) {
1904
1909
  return 0;
1905
1910
  };
1906
1911
  }
1907
- exports.ToGetterPvi16 = ToGetterPvi16;
1908
1912
  function ToGetterPvi20(agg, dc) {
1909
1913
  return (field) => {
1910
1914
  if (field === 'R')
@@ -1917,7 +1921,6 @@ function ToGetterPvi20(agg, dc) {
1917
1921
  return 0;
1918
1922
  };
1919
1923
  }
1920
- exports.ToGetterPvi20 = ToGetterPvi20;
1921
1924
  function calcShift(agg, dc, datasetOld, datasetNew) {
1922
1925
  const didOld = toDatasetID(datasetOld);
1923
1926
  const didNew = toDatasetID(datasetNew);
@@ -1949,7 +1952,6 @@ function calcShift(agg, dc, datasetOld, datasetNew) {
1949
1952
  const shift = Math.max(Math.min((pctDemNew - pctDemOld) - (pctRepNew - pctRepOld), 1.0), -1.0);
1950
1953
  return shift;
1951
1954
  }
1952
- exports.calcShift = calcShift;
1953
1955
  function calcRawPvi(getter) {
1954
1956
  // ((((sum(d_2016) / (sum(d_2016) + sum(r_2016))) * 100) + ((sum(d_2012) / (sum(d_2012) + sum(r_2012))) * 100)) / 2) - 51.54
1955
1957
  // Fields hard coded
@@ -1959,13 +1961,11 @@ function calcRawPvi(getter) {
1959
1961
  let pct2016 = total2016 != 0 ? (getter('D16') / total2016) * 100 : 0;
1960
1962
  return (pct2012 + pct2016) / ((total2012 != 0 && total2016 != 0) ? 2 : 1);
1961
1963
  }
1962
- exports.calcRawPvi = calcRawPvi;
1963
1964
  function pviStr(getter) {
1964
1965
  const pviRaw = calcRawPvi(getter);
1965
1966
  const pvi = baseclient_1.Util.precisionRound(pviRaw != 0 ? pviRaw - 51.54 : 0, 2);
1966
1967
  return pvi >= 0 ? 'D+' + pvi : 'R+' + (-pvi);
1967
1968
  }
1968
- exports.pviStr = pviStr;
1969
1969
  function calcRaw2020Pvi(getter16, getter20) {
1970
1970
  let total2016 = getter16('D') + getter16('R');
1971
1971
  let total2020 = getter20('D') + getter20('R');
@@ -1973,13 +1973,11 @@ function calcRaw2020Pvi(getter16, getter20) {
1973
1973
  let pct2020 = total2020 != 0 ? (getter20('D') / total2020) * 100 : 0;
1974
1974
  return (pct2020 + pct2016) / ((total2020 != 0 && total2016 != 0) ? 2 : 1);
1975
1975
  }
1976
- exports.calcRaw2020Pvi = calcRaw2020Pvi;
1977
1976
  function pvi2020Str(getter16, getter20) {
1978
1977
  const pviRaw = calcRaw2020Pvi(getter16, getter20);
1979
1978
  const pvi = baseclient_1.Util.precisionRound(pviRaw != 0 ? pviRaw - 51.54 : 0, 2);
1980
1979
  return pvi >= 0 ? 'D+' + pvi : 'R+' + (-pvi);
1981
1980
  }
1982
- exports.pvi2020Str = pvi2020Str;
1983
1981
 
1984
1982
 
1985
1983
  /***/ }),
@@ -2004,7 +2002,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
2004
2002
 
2005
2003
 
2006
2004
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2007
- exports.reverseTractMapping = exports.reverseBlockgroupMapping = exports.reverseSubMapping = exports.reverseBlockMapping = void 0;
2005
+ exports.reverseBlockMapping = reverseBlockMapping;
2006
+ exports.reverseSubMapping = reverseSubMapping;
2007
+ exports.reverseBlockgroupMapping = reverseBlockgroupMapping;
2008
+ exports.reverseTractMapping = reverseTractMapping;
2008
2009
  function reverseBlockMapping(bm) {
2009
2010
  let rev = {};
2010
2011
  if (bm)
@@ -2017,7 +2018,6 @@ function reverseBlockMapping(bm) {
2017
2018
  Object.values(rev).forEach((a) => a.sort());
2018
2019
  return rev;
2019
2020
  }
2020
- exports.reverseBlockMapping = reverseBlockMapping;
2021
2021
  function reverseSubMapping(bm, n) {
2022
2022
  let rev = {};
2023
2023
  if (bm)
@@ -2029,15 +2029,12 @@ function reverseSubMapping(bm, n) {
2029
2029
  });
2030
2030
  return rev;
2031
2031
  }
2032
- exports.reverseSubMapping = reverseSubMapping;
2033
2032
  function reverseBlockgroupMapping(bm) {
2034
2033
  return reverseSubMapping(bm, 12);
2035
2034
  }
2036
- exports.reverseBlockgroupMapping = reverseBlockgroupMapping;
2037
2035
  function reverseTractMapping(bm) {
2038
2036
  return reverseSubMapping(bm, 11);
2039
2037
  }
2040
- exports.reverseTractMapping = reverseTractMapping;
2041
2038
 
2042
2039
 
2043
2040
  /***/ }),
@@ -2370,7 +2367,7 @@ exports.Schemas = {
2370
2367
 
2371
2368
 
2372
2369
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2373
- exports.splitToGeoFeature = void 0;
2370
+ exports.splitToGeoFeature = splitToGeoFeature;
2374
2371
  const baseclient_1 = __webpack_require__(/*! @dra2020/baseclient */ "@dra2020/baseclient");
2375
2372
  const DT = __webpack_require__(/*! ./vfeature */ "./lib/vfeature.ts");
2376
2373
  const PF = __webpack_require__(/*! ./packedfields */ "./lib/packedfields.ts");
@@ -2419,7 +2416,6 @@ function splitToGeoFeature(split, topoPrecinct, mbm) {
2419
2416
  f.properties.mbmstamp = mbm.stamp;
2420
2417
  return f;
2421
2418
  }
2422
- exports.splitToGeoFeature = splitToGeoFeature;
2423
2419
 
2424
2420
 
2425
2421
  /***/ }),
@@ -2432,7 +2428,12 @@ exports.splitToGeoFeature = splitToGeoFeature;
2432
2428
 
2433
2429
 
2434
2430
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2435
- exports.inferPlanType = exports.getStateYearTotalPop = exports.getPlanDistrictCount = exports.hasOneLegislativePlanBothHouses = exports.hasPlanType = exports.StatePlanInfoMap = void 0;
2431
+ exports.StatePlanInfoMap = void 0;
2432
+ exports.hasPlanType = hasPlanType;
2433
+ exports.hasOneLegislativePlanBothHouses = hasOneLegislativePlanBothHouses;
2434
+ exports.getPlanDistrictCount = getPlanDistrictCount;
2435
+ exports.getStateYearTotalPop = getStateYearTotalPop;
2436
+ exports.inferPlanType = inferPlanType;
2436
2437
  exports.StatePlanInfoMap = {
2437
2438
  "AL": { "2010_VD": { population: 4779736, congress: { nDistricts: 7 }, upper: { nDistricts: 35 }, lower: { nDistricts: 105 } }, "2020_VD": { population: 0, congress: { nDistricts: 7 }, upper: { nDistricts: 35 }, lower: { nDistricts: 105 } } },
2438
2439
  "AK": { "2010_VD": { population: 710231, congress: { nDistricts: 1 }, upper: { nDistricts: 20 }, lower: { nDistricts: 40 } }, "2020_VD": { population: 0, congress: { nDistricts: 1 }, upper: { nDistricts: 20 }, lower: { nDistricts: 40 } } },
@@ -2501,11 +2502,9 @@ function hasPlanType(stateCode, planType, is2020) {
2501
2502
  return false;
2502
2503
  return true;
2503
2504
  }
2504
- exports.hasPlanType = hasPlanType;
2505
2505
  function hasOneLegislativePlanBothHouses(stateCode) {
2506
2506
  return stateCode === 'AZ' || stateCode === 'ID' || stateCode === 'NJ' || stateCode === 'WA';
2507
2507
  }
2508
- exports.hasOneLegislativePlanBothHouses = hasOneLegislativePlanBothHouses;
2509
2508
  function getPlanDistrictCount(stateCode, planType, datasource) {
2510
2509
  if (planType === 'coi')
2511
2510
  return 1;
@@ -2516,7 +2515,6 @@ function getPlanDistrictCount(stateCode, planType, datasource) {
2516
2515
  const stateYearInfo = exports.StatePlanInfoMap[stateCode][datasource];
2517
2516
  return stateYearInfo && stateYearInfo[planType] ? stateYearInfo[planType]['nDistricts'] : 0;
2518
2517
  }
2519
- exports.getPlanDistrictCount = getPlanDistrictCount;
2520
2518
  // TODO: This is not currently used (3/2/21). 2020_VD population numbers are not set; update them when apportionment happens
2521
2519
  function getStateYearTotalPop(stateCode, datasource) {
2522
2520
  if (datasource === '2016_BG')
@@ -2526,7 +2524,6 @@ function getStateYearTotalPop(stateCode, datasource) {
2526
2524
  const stateYearInfo = exports.StatePlanInfoMap[stateCode][datasource];
2527
2525
  return stateYearInfo ? stateYearInfo['population'] : 0;
2528
2526
  }
2529
- exports.getStateYearTotalPop = getStateYearTotalPop;
2530
2527
  function inferPlanType(stateCode, datasource, nDistricts, flex) {
2531
2528
  // Intended for datasource === '2020_VD'
2532
2529
  const congressCount = getPlanDistrictCount(stateCode, 'congress', datasource);
@@ -2537,7 +2534,6 @@ function inferPlanType(stateCode, datasource, nDistricts, flex) {
2537
2534
  (nDistricts == lowerCount) ? 'lower' :
2538
2535
  'other');
2539
2536
  }
2540
- exports.inferPlanType = inferPlanType;
2541
2537
 
2542
2538
 
2543
2539
  /***/ }),
@@ -2560,7 +2556,17 @@ exports.inferPlanType = inferPlanType;
2560
2556
  // Rate - we want to track the rate of some activity over some time period
2561
2557
  //
2562
2558
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2563
- exports.statIndexAccum = exports.statRateAccum = exports.statValueAccum = exports.statRecordMerge = exports.statEntryIndexRollover = exports.statEntryIndexMerge = exports.statRateRollover = exports.OneDay = exports.OneHour = exports.OneMinute = exports.statRateIncr = exports.statValueRecord = exports.statExpiryTime = exports.ValTypeRate = exports.ValTypeAvg = exports.ValTypeSum = void 0;
2559
+ exports.OneDay = exports.OneHour = exports.OneMinute = exports.ValTypeRate = exports.ValTypeAvg = exports.ValTypeSum = void 0;
2560
+ exports.statExpiryTime = statExpiryTime;
2561
+ exports.statValueRecord = statValueRecord;
2562
+ exports.statRateIncr = statRateIncr;
2563
+ exports.statRateRollover = statRateRollover;
2564
+ exports.statEntryIndexMerge = statEntryIndexMerge;
2565
+ exports.statEntryIndexRollover = statEntryIndexRollover;
2566
+ exports.statRecordMerge = statRecordMerge;
2567
+ exports.statValueAccum = statValueAccum;
2568
+ exports.statRateAccum = statRateAccum;
2569
+ exports.statIndexAccum = statIndexAccum;
2564
2570
  exports.ValTypeSum = 0;
2565
2571
  exports.ValTypeAvg = 1;
2566
2572
  exports.ValTypeRate = 2;
@@ -2570,7 +2576,6 @@ function statExpiryTime() {
2570
2576
  time.setTime(time.getTime() + ExpiryAge);
2571
2577
  return time.toJSON();
2572
2578
  }
2573
- exports.statExpiryTime = statExpiryTime;
2574
2579
  // Aggregate running value. This applies both in memory (logging multiple times before
2575
2580
  // saving to database) as well as aggregating into an instance structure in the DB.
2576
2581
  function statValueRecord(sv, cur, valType) {
@@ -2584,7 +2589,6 @@ function statValueRecord(sv, cur, valType) {
2584
2589
  sv.valType = valType;
2585
2590
  return sv;
2586
2591
  }
2587
- exports.statValueRecord = statValueRecord;
2588
2592
  function statRateIncr(sr, incr = 1) {
2589
2593
  if (sr == null)
2590
2594
  sr = {};
@@ -2594,7 +2598,6 @@ function statRateIncr(sr, incr = 1) {
2594
2598
  sr.thisDay = sr.thisDay === undefined ? incr : sr.thisDay + incr;
2595
2599
  return sr;
2596
2600
  }
2597
- exports.statRateIncr = statRateIncr;
2598
2601
  exports.OneMinute = 1000 * 60;
2599
2602
  exports.OneHour = exports.OneMinute * 60;
2600
2603
  exports.OneDay = exports.OneHour * 24;
@@ -2612,7 +2615,6 @@ function statRateRollover(sr, period) {
2612
2615
  sr.thisDay = 0;
2613
2616
  }
2614
2617
  }
2615
- exports.statRateRollover = statRateRollover;
2616
2618
  function statEntryIndexMerge(accum, si) {
2617
2619
  if (accum == null)
2618
2620
  accum = {};
@@ -2631,7 +2633,6 @@ function statEntryIndexMerge(accum, si) {
2631
2633
  });
2632
2634
  return accum;
2633
2635
  }
2634
- exports.statEntryIndexMerge = statEntryIndexMerge;
2635
2636
  function statEntryIndexRollover(si, period) {
2636
2637
  Object.keys(si).forEach((p) => {
2637
2638
  let se = si[p];
@@ -2639,7 +2640,6 @@ function statEntryIndexRollover(si, period) {
2639
2640
  statRateRollover(se, period);
2640
2641
  });
2641
2642
  }
2642
- exports.statEntryIndexRollover = statEntryIndexRollover;
2643
2643
  function statRecordMerge(accum, si) {
2644
2644
  if (accum == null)
2645
2645
  accum = { id: si.id, production: si.production, time: si.time, expires: si.expires, index: {} };
@@ -2648,7 +2648,6 @@ function statRecordMerge(accum, si) {
2648
2648
  statEntryIndexMerge(accum.index, si.index);
2649
2649
  return accum;
2650
2650
  }
2651
- exports.statRecordMerge = statRecordMerge;
2652
2651
  // Accumulate a set of values together (e.g. from multiple running instances)
2653
2652
  // for reporting current state.
2654
2653
  //
@@ -2672,7 +2671,6 @@ function statValueAccum(accum, sv) {
2672
2671
  }
2673
2672
  return accum;
2674
2673
  }
2675
- exports.statValueAccum = statValueAccum;
2676
2674
  function statRateAccum(accum, sr) {
2677
2675
  if (accum == null) {
2678
2676
  accum = {};
@@ -2686,7 +2684,6 @@ function statRateAccum(accum, sr) {
2686
2684
  accum.lastDay = accum.lastDay === undefined ? sr.lastDay : (accum.lastDay + (sr.lastDay === undefined ? 0 : sr.lastDay));
2687
2685
  return accum;
2688
2686
  }
2689
- exports.statRateAccum = statRateAccum;
2690
2687
  function statIndexAccum(accum, si) {
2691
2688
  if (accum == null)
2692
2689
  accum = {};
@@ -2699,7 +2696,6 @@ function statIndexAccum(accum, si) {
2699
2696
  });
2700
2697
  return accum;
2701
2698
  }
2702
- exports.statIndexAccum = statIndexAccum;
2703
2699
 
2704
2700
 
2705
2701
  /***/ }),
@@ -2712,7 +2708,21 @@ exports.statIndexAccum = statIndexAccum;
2712
2708
 
2713
2709
 
2714
2710
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2715
- exports.cacheKeysToChunkHash = exports.splitToPrefix = exports.splitToChunkKey = exports.cacheKeyToSplit = exports.splitToCacheKey = exports.isVfeature = exports.vgeoidToHash = exports.vgeoidToSplit = exports.vgeoidToChunk = exports.splitCommitted = exports.splitToVgeoid = exports.vgeoidToGeoid = exports.vhash = exports.isCfeature = exports.chash = void 0;
2711
+ exports.chash = chash;
2712
+ exports.isCfeature = isCfeature;
2713
+ exports.vhash = vhash;
2714
+ exports.vgeoidToGeoid = vgeoidToGeoid;
2715
+ exports.splitToVgeoid = splitToVgeoid;
2716
+ exports.splitCommitted = splitCommitted;
2717
+ exports.vgeoidToChunk = vgeoidToChunk;
2718
+ exports.vgeoidToSplit = vgeoidToSplit;
2719
+ exports.vgeoidToHash = vgeoidToHash;
2720
+ exports.isVfeature = isVfeature;
2721
+ exports.splitToCacheKey = splitToCacheKey;
2722
+ exports.cacheKeyToSplit = cacheKeyToSplit;
2723
+ exports.splitToChunkKey = splitToChunkKey;
2724
+ exports.splitToPrefix = splitToPrefix;
2725
+ exports.cacheKeysToChunkHash = cacheKeysToChunkHash;
2716
2726
  // Public libraries
2717
2727
  const Hash = __webpack_require__(/*! object-hash */ "object-hash");
2718
2728
  // Canonical hashing of custom precinct
@@ -2720,13 +2730,11 @@ function chash(o) {
2720
2730
  return Hash(o, { respectType: false, unorderedArrays: true, unorderedObjects: true,
2721
2731
  excludeKeys: (k) => (k === 'id') });
2722
2732
  }
2723
- exports.chash = chash;
2724
2733
  // Is custom feature - 5 digit county id + 'cust' + hash
2725
2734
  let reC = /^\d\d\d\d\dcust.*$/;
2726
2735
  function isCfeature(id) {
2727
2736
  return id && reC.test(id);
2728
2737
  }
2729
- exports.isCfeature = isCfeature;
2730
2738
  // Canonical hashing of splitblock data
2731
2739
  function vhash(o) {
2732
2740
  return Hash(o, { respectType: false,
@@ -2736,7 +2744,6 @@ function vhash(o) {
2736
2744
  excludeKeys: (k) => (k === 'id' || k === 'chunk' || k === 'chunkList' || k === 'chunkKey')
2737
2745
  });
2738
2746
  }
2739
- exports.vhash = vhash;
2740
2747
  // old style "vfeature_[geoid]_[numericchunk]_[id]"
2741
2748
  // new style "B_[geoid]_bitset"
2742
2749
  function vgeoidToGeoid(vgeoid) {
@@ -2750,7 +2757,6 @@ function vgeoidToGeoid(vgeoid) {
2750
2757
  }
2751
2758
  return a[1];
2752
2759
  }
2753
- exports.vgeoidToGeoid = vgeoidToGeoid;
2754
2760
  function splitToVgeoid(s) {
2755
2761
  // Newstyle
2756
2762
  if (s.bitset)
@@ -2762,11 +2768,9 @@ function splitToVgeoid(s) {
2762
2768
  s.chunk = '0';
2763
2769
  return `vfeature_${s.geoid}_${s.chunk}_${s.id}`;
2764
2770
  }
2765
- exports.splitToVgeoid = splitToVgeoid;
2766
2771
  function splitCommitted(s) {
2767
2772
  return !!s.id || !!s.bitset;
2768
2773
  }
2769
- exports.splitCommitted = splitCommitted;
2770
2774
  function vgeoidToChunk(vgeoid) {
2771
2775
  // vgeoid is string of form: "vfeature_[geoid]_[chunkid]_[hash]"
2772
2776
  // the contents are chunked into a file of form "vfeature_chunk_[chunkid]"
@@ -2779,7 +2783,6 @@ function vgeoidToChunk(vgeoid) {
2779
2783
  vgeoid = null;
2780
2784
  return vgeoid;
2781
2785
  }
2782
- exports.vgeoidToChunk = vgeoidToChunk;
2783
2786
  function vgeoidToSplit(state, datasource, vgeoid) {
2784
2787
  let reNew = /^B_([^_]*)_(.*)$/;
2785
2788
  let reOld = /^vfeature_([^_]*)_([^_*])_(.*)$/;
@@ -2791,7 +2794,6 @@ function vgeoidToSplit(state, datasource, vgeoid) {
2791
2794
  return { state: state, datasource: datasource, geoid: a[1], id: a[3], chunk: a[2], blocks: null };
2792
2795
  return null;
2793
2796
  }
2794
- exports.vgeoidToSplit = vgeoidToSplit;
2795
2797
  function vgeoidToHash(vgeoid) {
2796
2798
  // vgeoid is string of form: "vfeature_[geoid]_[chunkid]_[hash]"
2797
2799
  let re = /^vfeature_([^_]*)_([^_*])_(.*)$/;
@@ -2802,11 +2804,9 @@ function vgeoidToHash(vgeoid) {
2802
2804
  vgeoid = null;
2803
2805
  return vgeoid;
2804
2806
  }
2805
- exports.vgeoidToHash = vgeoidToHash;
2806
2807
  function isVfeature(geoid) {
2807
2808
  return geoid.indexOf('B') === 0 || geoid.indexOf('vfeature') === 0;
2808
2809
  }
2809
- exports.isVfeature = isVfeature;
2810
2810
  function splitToCacheKey(s) {
2811
2811
  if (s.bitset)
2812
2812
  return null;
@@ -2816,7 +2816,6 @@ function splitToCacheKey(s) {
2816
2816
  s.chunk = "0";
2817
2817
  return `_${s.state}_${s.datasource}_vfeature_${s.geoid}_${s.chunk}_${s.id}.geojson`;
2818
2818
  }
2819
- exports.splitToCacheKey = splitToCacheKey;
2820
2819
  function cacheKeyToSplit(s) {
2821
2820
  let re = /^_(..)_(.*)_vfeature_([^_]+)_([^_]+)_([^_]+).geojson$/;
2822
2821
  let a = re.exec(s);
@@ -2825,13 +2824,11 @@ function cacheKeyToSplit(s) {
2825
2824
  // 0: whole string, 1: statecode, 2: datasource, 3: geoid, 4: chunk, 5: id hash
2826
2825
  return { id: a[5], state: a[1], datasource: a[2], geoid: a[3], chunk: a[4], blocks: null };
2827
2826
  }
2828
- exports.cacheKeyToSplit = cacheKeyToSplit;
2829
2827
  function splitToChunkKey(s) {
2830
2828
  if (s.chunk === undefined)
2831
2829
  s.chunk = "0";
2832
2830
  return `_${s.state}_${s.datasource}_vfeature_chunk_${s.chunk}.geojson`;
2833
2831
  }
2834
- exports.splitToChunkKey = splitToChunkKey;
2835
2832
  function splitToPrefix(s) {
2836
2833
  if (s.blocks === undefined) {
2837
2834
  let re = /_([^_]*)_(.*)_vfeature.*\.geojson$/;
@@ -2842,11 +2839,9 @@ function splitToPrefix(s) {
2842
2839
  }
2843
2840
  return `_${s.state}_${s.datasource}`;
2844
2841
  }
2845
- exports.splitToPrefix = splitToPrefix;
2846
2842
  function cacheKeysToChunkHash(keys) {
2847
2843
  return vhash(keys);
2848
2844
  }
2849
- exports.cacheKeysToChunkHash = cacheKeysToChunkHash;
2850
2845
 
2851
2846
 
2852
2847
  /***/ }),
@@ -2911,7 +2906,7 @@ module.exports = require("object-hash");
2911
2906
  /******/
2912
2907
  /************************************************************************/
2913
2908
  var __webpack_exports__ = {};
2914
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
2909
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
2915
2910
  (() => {
2916
2911
  var exports = __webpack_exports__;
2917
2912
  /*!********************!*\