@htilabs/platform-common-models 0.80.0 → 0.82.0

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.
Files changed (42) hide show
  1. package/README.md +27 -0
  2. package/dist/{index-DvAypMJV.d.ts → index-Bh1zO_Vu.d.ts} +1 -1
  3. package/dist/{index-Bj-s0nZy.d.cts → index-XWSYon40.d.cts} +1 -1
  4. package/dist/index.cjs +365 -47
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +3 -3
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +355 -47
  9. package/dist/index.js.map +1 -1
  10. package/dist/information-scope/index.cjs +290 -2
  11. package/dist/information-scope/index.cjs.map +1 -1
  12. package/dist/information-scope/index.d.cts +84 -1
  13. package/dist/information-scope/index.d.ts +84 -1
  14. package/dist/information-scope/index.js +279 -1
  15. package/dist/information-scope/index.js.map +1 -1
  16. package/dist/models/index.d.cts +2 -2
  17. package/dist/models/index.d.ts +2 -2
  18. package/dist/schemas/index.d.cts +25 -25
  19. package/dist/schemas/index.d.ts +25 -25
  20. package/dist/services/index.cjs +290 -2
  21. package/dist/services/index.cjs.map +1 -1
  22. package/dist/services/index.d.cts +1 -1
  23. package/dist/services/index.d.ts +1 -1
  24. package/dist/services/index.js +279 -1
  25. package/dist/services/index.js.map +1 -1
  26. package/dist/sharing-ceiling/index.cjs +33 -3
  27. package/dist/sharing-ceiling/index.cjs.map +1 -1
  28. package/dist/sharing-ceiling/index.d.cts +11 -7
  29. package/dist/sharing-ceiling/index.d.ts +11 -7
  30. package/dist/sharing-ceiling/index.js +33 -3
  31. package/dist/sharing-ceiling/index.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/generated/informationScopeUiCopy.ts +263 -0
  34. package/src/services/__tests__/informationScopeUiCopy.test.ts +128 -0
  35. package/src/services/informationScope.ts +1 -0
  36. package/src/services/informationScopeUiCopy.ts +98 -0
  37. package/src/sharingCeiling/__tests__/fixtures_starterVerdicts.json +1727 -0
  38. package/src/sharingCeiling/__tests__/personContactRows.test.ts +185 -0
  39. package/src/sharingCeiling/coverage.ts +55 -6
  40. package/src/sharingCeiling/resolve.ts +31 -8
  41. package/dist/{cvcEntry-BLeRivoF.d.cts → cvcEntry-D787utvP.d.cts} +8 -8
  42. package/dist/{cvcEntry-BLeRivoF.d.ts → cvcEntry-D787utvP.d.ts} +8 -8
package/dist/index.cjs CHANGED
@@ -362,10 +362,15 @@ __export(src_exports, {
362
362
  INCIDENT_PARTICIPATION_ROLE_LABELS: () => INCIDENT_PARTICIPATION_ROLE_LABELS,
363
363
  INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY: () => INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY,
364
364
  INCIDENT_PARTICIPATION_ROLE_VALUES: () => INCIDENT_PARTICIPATION_ROLE_VALUES,
365
+ INFORMATION_SCOPE_CATEGORY_ORDER: () => INFORMATION_SCOPE_CATEGORY_ORDER,
366
+ INFORMATION_SCOPE_CATEGORY_SUB: () => INFORMATION_SCOPE_CATEGORY_SUB,
365
367
  INFORMATION_SCOPE_FIELD_HOME_ROWS: () => INFORMATION_SCOPE_FIELD_HOME_ROWS,
366
368
  INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE: () => INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE,
367
369
  INFORMATION_SCOPE_READABLE_VERSIONS: () => INFORMATION_SCOPE_READABLE_VERSIONS,
370
+ INFORMATION_SCOPE_ROW_HINT: () => INFORMATION_SCOPE_ROW_HINT,
371
+ INFORMATION_SCOPE_ROW_ORDER: () => INFORMATION_SCOPE_ROW_ORDER,
368
372
  INFORMATION_SCOPE_SYSTEM_INFO: () => INFORMATION_SCOPE_SYSTEM_INFO,
373
+ INFORMATION_SCOPE_UI_COPY_SOURCE: () => INFORMATION_SCOPE_UI_COPY_SOURCE,
369
374
  INFORMATION_SCOPE_VERSION: () => INFORMATION_SCOPE_VERSION,
370
375
  INTERACTION_TYPES: () => INTERACTION_TYPES,
371
376
  INTERACTION_TYPE_LABELS: () => INTERACTION_TYPE_LABELS,
@@ -969,9 +974,12 @@ __export(src_exports, {
969
974
  rowsOutsideCeiling: () => rowsOutsideCeiling,
970
975
  rowsOverCeiling: () => rowsOverCeiling,
971
976
  rsvpResponseSot: () => rsvpResponse_v1_0_0_default,
977
+ scopeCategorySub: () => scopeCategorySub,
972
978
  scopeListCovers: () => scopeListCovers,
973
979
  scopeListStrictlyCovers: () => scopeListStrictlyCovers,
974
980
  scopeMigrationsFromSot: () => scopeMigrationsFromSot,
981
+ scopeRowDisplayOrder: () => scopeRowDisplayOrder,
982
+ scopeRowHint: () => scopeRowHint,
975
983
  scopeRowWithinCeiling: () => scopeRowWithinCeiling,
976
984
  scopeRowsFromSot: () => scopeRowsFromSot,
977
985
  scoringConditionSchema: () => scoringConditionSchema,
@@ -1028,6 +1036,8 @@ __export(src_exports, {
1028
1036
  smtSignificanceFlagsSot: () => smtSignificanceFlags_v1_0_0_default,
1029
1037
  smtTypeSot: () => smtType_v1_0_0_default,
1030
1038
  sortRelationshipsByPriority: () => sortRelationshipsByPriority,
1039
+ sortScopeCategories: () => sortScopeCategories,
1040
+ sortScopeRows: () => sortScopeRows,
1031
1041
  sourceCategorySot: () => sourceCategory_v1_1_0_default,
1032
1042
  sourceInstrumentSot: () => sourceInstrument_v1_1_0_default,
1033
1043
  sourceSubtypeSot: () => sourceSubtype_v1_2_0_default,
@@ -9920,13 +9930,13 @@ function createCodebookReader(file, sot, codes) {
9920
9930
  const pickerLabels = sot.pickerLabels ?? {};
9921
9931
  const options = /* @__PURE__ */ new Map();
9922
9932
  for (const [name, offered] of Object.entries(pickers)) {
9923
- const own4 = pickerLabels[name] ?? {};
9933
+ const own5 = pickerLabels[name] ?? {};
9924
9934
  options.set(
9925
9935
  name,
9926
9936
  offered.map((c) => {
9927
9937
  const v = byCode.get(c);
9928
9938
  if (!v) throw new Error(`${file}: picker ${name} offers ${c}, not a code`);
9929
- return { code: v.code, label: own4[c] ?? v.label };
9939
+ return { code: v.code, label: own5[c] ?? v.label };
9930
9940
  })
9931
9941
  );
9932
9942
  }
@@ -9940,8 +9950,8 @@ function createCodebookReader(file, sot, codes) {
9940
9950
  byCode: (code) => byCode.get(code) ?? null,
9941
9951
  entry: (code) => entryByCode.get(code) ?? null,
9942
9952
  label: (code, picker) => {
9943
- const own4 = picker === void 0 ? void 0 : pickerLabels[picker]?.[code];
9944
- return own4 ?? byCode.get(code)?.label ?? code;
9953
+ const own5 = picker === void 0 ? void 0 : pickerLabels[picker]?.[code];
9954
+ return own5 ?? byCode.get(code)?.label ?? code;
9945
9955
  },
9946
9956
  normalize: (stored) => {
9947
9957
  if (typeof stored !== "string") return null;
@@ -26793,6 +26803,274 @@ function scopeMigrationsFromSot(sot) {
26793
26803
  });
26794
26804
  }
26795
26805
 
26806
+ // src/generated/informationScopeUiCopy.ts
26807
+ var INFORMATION_SCOPE_UI_COPY_SOURCE = {
26808
+ "order": {
26809
+ "repo": "htilabstech/prototype",
26810
+ "file": "data/cvcs/core_information_scope.yaml",
26811
+ "sha": "395bb7aa"
26812
+ },
26813
+ "words": {
26814
+ "repo": "htilabstech/platform-prototype",
26815
+ "file": "src/data.js",
26816
+ "sha": "c324f715",
26817
+ "line": 33875
26818
+ }
26819
+ };
26820
+ var INFORMATION_SCOPE_CATEGORY_ORDER = [
26821
+ "system",
26822
+ "notes",
26823
+ "identifying",
26824
+ "contact",
26825
+ "health_accommodation",
26826
+ "immigration_legal_status",
26827
+ "risk",
26828
+ "services",
26829
+ "instruments",
26830
+ "relationships_household",
26831
+ "offenders__identifying",
26832
+ "offenders__contact",
26833
+ "offenders__health_accommodation",
26834
+ "offenders__immigration_legal_status",
26835
+ "offenders__risk",
26836
+ "offenders__services",
26837
+ "offenders__instruments",
26838
+ "offenders__relationships_household",
26839
+ "family__identifying",
26840
+ "family__contact",
26841
+ "family__health_accommodation",
26842
+ "family__immigration_legal_status",
26843
+ "family__risk",
26844
+ "family__services",
26845
+ "family__instruments",
26846
+ "family__relationships_household",
26847
+ "others__identifying",
26848
+ "others__contact",
26849
+ "others__health_accommodation",
26850
+ "others__immigration_legal_status",
26851
+ "others__risk",
26852
+ "others__services",
26853
+ "others__instruments",
26854
+ "others__relationships_household",
26855
+ "network_associations",
26856
+ "commercial_activity",
26857
+ "investigative_work_product",
26858
+ "object_identifiers"
26859
+ ];
26860
+ var INFORMATION_SCOPE_CATEGORY_SUB = {
26861
+ "system": "Session timestamps, source info \u2014 always shared",
26862
+ "notes": "The session summary, and notes written in a session or on the case",
26863
+ "identifying": "Names, DOB, addresses, identifiers, demographics",
26864
+ "contact": "How to reach the person safely: contact info + safety preferences, the Priorities & Safety triage",
26865
+ "health_accommodation": "Health status, accommodation needs",
26866
+ "immigration_legal_status": "Immigration status, immigration applications",
26867
+ "risk": "Indicators, screening outcomes, per-instrument assessment responses, determinations, system involvement \u2014 the people who caused harm are their own branch",
26868
+ "services": "Contact history with this agency, service records, service plans + goals \u2014 three tiers of sensitivity",
26869
+ "instruments": "Initial Screen, intake screens, assessments, Findings \u2014 a Summary & outcome row and a Full questions, narratives & notes row per instrument",
26870
+ "relationships_household": "The client's account of the people around them \u2014 each relationship record, the household roster, pets; each entry names the other person as name + kind and carries nothing else about them",
26871
+ "offenders__identifying": "People who caused harm \u2014 the person's own record, grouped by kind (identifying information)",
26872
+ "offenders__contact": "People who caused harm \u2014 the person's own record, grouped by kind (contact & safety)",
26873
+ "offenders__health_accommodation": "People who caused harm \u2014 the person's own record, grouped by kind (health & accommodation)",
26874
+ "offenders__immigration_legal_status": "People who caused harm \u2014 the person's own record, grouped by kind (immigration & legal status)",
26875
+ "offenders__risk": "People who caused harm \u2014 the person's own record, grouped by kind (risk-related)",
26876
+ "offenders__services": "People who caused harm \u2014 the person's own record, grouped by kind (services & case history)",
26877
+ "offenders__instruments": "People who caused harm \u2014 the person's own record, grouped by kind (screens & assessments)",
26878
+ "offenders__relationships_household": "People who caused harm \u2014 the person's own record, grouped by kind (relationships & household)",
26879
+ "family__identifying": "Eligible family members \u2014 the person's own record, grouped by kind (identifying information)",
26880
+ "family__contact": "Eligible family members \u2014 the person's own record, grouped by kind (contact & safety)",
26881
+ "family__health_accommodation": "Eligible family members \u2014 the person's own record, grouped by kind (health & accommodation)",
26882
+ "family__immigration_legal_status": "Eligible family members \u2014 the person's own record, grouped by kind (immigration & legal status)",
26883
+ "family__risk": "Eligible family members \u2014 the person's own record, grouped by kind (risk-related)",
26884
+ "family__services": "Eligible family members \u2014 the person's own record, grouped by kind (services & case history)",
26885
+ "family__instruments": "Eligible family members \u2014 the person's own record, grouped by kind (screens & assessments)",
26886
+ "family__relationships_household": "Eligible family members \u2014 the person's own record, grouped by kind (relationships & household)",
26887
+ "others__identifying": "Other people on the case \u2014 the person's own record, grouped by kind (identifying information)",
26888
+ "others__contact": "Other people on the case \u2014 the person's own record, grouped by kind (contact & safety)",
26889
+ "others__health_accommodation": "Other people on the case \u2014 the person's own record, grouped by kind (health & accommodation)",
26890
+ "others__immigration_legal_status": "Other people on the case \u2014 the person's own record, grouped by kind (immigration & legal status)",
26891
+ "others__risk": "Other people on the case \u2014 the person's own record, grouped by kind (risk-related)",
26892
+ "others__services": "Other people on the case \u2014 the person's own record, grouped by kind (services & case history)",
26893
+ "others__instruments": "Other people on the case \u2014 the person's own record, grouped by kind (screens & assessments)",
26894
+ "others__relationships_household": "Other people on the case \u2014 the person's own record, grouped by kind (relationships & household)",
26895
+ "network_associations": "Personas, network membership, relationships, criminal-org links",
26896
+ "commercial_activity": "Ads, listings, posting activity, pricing, business fronts",
26897
+ "investigative_work_product": "Analyst determinations, dispositions, case briefs",
26898
+ "object_identifiers": "Phone numbers, vehicle identifiers, image hashes, account handles"
26899
+ };
26900
+ var INFORMATION_SCOPE_ROW_ORDER = {
26901
+ "system": [
26902
+ "system_info"
26903
+ ],
26904
+ "notes": [
26905
+ "session_summary",
26906
+ "case_notes"
26907
+ ],
26908
+ "identifying": [
26909
+ "names",
26910
+ "dob",
26911
+ "addresses",
26912
+ "additional_ids",
26913
+ "demographics",
26914
+ "identifying__other"
26915
+ ],
26916
+ "contact": [
26917
+ "contact_info",
26918
+ "safe_locations",
26919
+ "priorities_safety",
26920
+ "encounter_location"
26921
+ ],
26922
+ "health_accommodation": [
26923
+ "health_status",
26924
+ "accommodation_needs"
26925
+ ],
26926
+ "immigration_legal_status": [
26927
+ "immigration_status",
26928
+ "immigration_applications"
26929
+ ],
26930
+ "risk": [
26931
+ "screen_indicators",
26932
+ "victimization",
26933
+ "system_involvement",
26934
+ "derived_risk_signals"
26935
+ ],
26936
+ "services": [
26937
+ "contact_history",
26938
+ "service_history",
26939
+ "plans_goals"
26940
+ ],
26941
+ "instruments": [
26942
+ "summary_initial_screen",
26943
+ "summary_mental_health_screen",
26944
+ "summary_behavioral_health_intake",
26945
+ "summary_trauma_and_coping_screen",
26946
+ "summary_ae_intake",
26947
+ "summary_ida",
26948
+ "summary_lap",
26949
+ "summary_danger_assessment",
26950
+ "summary_stalking_assessment",
26951
+ "summary_injury_and_strangulation",
26952
+ "summary_hope_scale",
26953
+ "summary_needs_assessment",
26954
+ "summary_tra",
26955
+ "summary_findings",
26956
+ "full_initial_screen",
26957
+ "full_mental_health_screen",
26958
+ "full_behavioral_health_intake",
26959
+ "full_trauma_and_coping_screen",
26960
+ "full_ae_intake",
26961
+ "full_ida",
26962
+ "full_lap",
26963
+ "full_danger_assessment",
26964
+ "full_stalking_assessment",
26965
+ "full_injury_and_strangulation",
26966
+ "full_hope_scale",
26967
+ "full_needs_assessment",
26968
+ "full_tra",
26969
+ "full_findings"
26970
+ ],
26971
+ "relationships_household": [],
26972
+ "offenders__identifying": [],
26973
+ "offenders__contact": [
26974
+ "offenders__safe_locations"
26975
+ ],
26976
+ "offenders__health_accommodation": [],
26977
+ "offenders__immigration_legal_status": [],
26978
+ "offenders__risk": [],
26979
+ "offenders__services": [],
26980
+ "offenders__instruments": [
26981
+ "offenders__instrument_summary",
26982
+ "offenders__instrument_full"
26983
+ ],
26984
+ "offenders__relationships_household": [],
26985
+ "family__identifying": [],
26986
+ "family__contact": [
26987
+ "family__safe_locations"
26988
+ ],
26989
+ "family__health_accommodation": [],
26990
+ "family__immigration_legal_status": [],
26991
+ "family__risk": [],
26992
+ "family__services": [],
26993
+ "family__instruments": [
26994
+ "family__instrument_summary",
26995
+ "family__instrument_full"
26996
+ ],
26997
+ "family__relationships_household": [],
26998
+ "others__identifying": [],
26999
+ "others__contact": [
27000
+ "others__safe_locations"
27001
+ ],
27002
+ "others__health_accommodation": [],
27003
+ "others__immigration_legal_status": [],
27004
+ "others__risk": [],
27005
+ "others__services": [],
27006
+ "others__instruments": [
27007
+ "others__instrument_summary",
27008
+ "others__instrument_full"
27009
+ ],
27010
+ "others__relationships_household": [],
27011
+ "network_associations": [
27012
+ "network_membership",
27013
+ "persona_links"
27014
+ ],
27015
+ "commercial_activity": [
27016
+ "ad_content",
27017
+ "commercial_patterns"
27018
+ ],
27019
+ "investigative_work_product": [
27020
+ "case_determinations",
27021
+ "case_lifecycle",
27022
+ "case_attachments"
27023
+ ],
27024
+ "object_identifiers": [
27025
+ "phone_identifiers",
27026
+ "object_identity_attributes"
27027
+ ]
27028
+ };
27029
+ var INFORMATION_SCOPE_ROW_HINT = {
27030
+ "system_info": "Always included",
27031
+ "names": "All logged name entries",
27032
+ "additional_ids": "Other IDs entered separately",
27033
+ "identifying__other": "Living situation \xB7 work & income \xB7 education \xB7 languages \xB7 citizenship \xB7 physical description \xB7 vehicle",
27034
+ "safe_locations": "Shelter placements + confidential program addresses",
27035
+ "encounter_location": "The session's meetup / incident location \u2014 not the survivor's own addresses (CVC-191 reasons Meet / contact + Incident)",
27036
+ "immigration_status": "Visa type + birth country + relevant flags",
27037
+ "commercial_patterns": "Pricing, schedule, venues",
27038
+ "case_attachments": "Content-dependent \u2014 attachment handling flags govern",
27039
+ "object_identity_attributes": "Names, trade names, ages"
27040
+ };
27041
+
27042
+ // src/services/informationScopeUiCopy.ts
27043
+ var own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
27044
+ function toKey(codeOrKey) {
27045
+ return codeOrKey.replace(/\./g, "__");
27046
+ }
27047
+ function toCode(key) {
27048
+ return key.replace(/__/g, ".");
27049
+ }
27050
+ function scopeCategorySub(category) {
27051
+ const k = toKey(category);
27052
+ return own(INFORMATION_SCOPE_CATEGORY_SUB, k) ? INFORMATION_SCOPE_CATEGORY_SUB[k] : void 0;
27053
+ }
27054
+ function scopeRowHint(row) {
27055
+ const k = toKey(row);
27056
+ return own(INFORMATION_SCOPE_ROW_HINT, k) ? INFORMATION_SCOPE_ROW_HINT[k] : void 0;
27057
+ }
27058
+ function scopeRowDisplayOrder(category) {
27059
+ const k = toKey(category);
27060
+ return own(INFORMATION_SCOPE_ROW_ORDER, k) ? INFORMATION_SCOPE_ROW_ORDER[k].map(toCode) : [];
27061
+ }
27062
+ function sortScopeRows(category, rows) {
27063
+ const k = toKey(category);
27064
+ const order = own(INFORMATION_SCOPE_ROW_ORDER, k) ? INFORMATION_SCOPE_ROW_ORDER[k] : [];
27065
+ const rank = new Map(order.map((r, i) => [r, i]));
27066
+ return rows.map((r, i) => ({ r, i, at: rank.get(toKey(r)) ?? order.length })).sort((a, b) => a.at - b.at || a.i - b.i).map((x) => x.r);
27067
+ }
27068
+ function sortScopeCategories(categories) {
27069
+ const rank = new Map(INFORMATION_SCOPE_CATEGORY_ORDER.map((c, i) => [c, i]));
27070
+ const n = INFORMATION_SCOPE_CATEGORY_ORDER.length;
27071
+ return categories.map((c, i) => ({ c, i, at: rank.get(toKey(c)) ?? n })).sort((a, b) => a.at - b.at || a.i - b.i).map((x) => x.c);
27072
+ }
27073
+
26796
27074
  // src/age/ageFromDob.ts
26797
27075
  var DOB_MIN_YEAR = 1850;
26798
27076
  function toNullableNumber(v) {
@@ -26994,12 +27272,12 @@ function readContainer(v) {
26994
27272
  if (v === void 0 || v === null) return ABSENT;
26995
27273
  return isPlainObject(v) ? { kind: "map", map: v } : MALFORMED;
26996
27274
  }
26997
- function own(map, key) {
27275
+ function own2(map, key) {
26998
27276
  return Object.hasOwn(map, key) ? map[key] : void 0;
26999
27277
  }
27000
27278
  var STATES = new Set(Object.values(PERMISSION_STATE));
27001
27279
  function readState(map, code) {
27002
- const v = own(map, code);
27280
+ const v = own2(map, code);
27003
27281
  if (v === void 0 || v === null) return void 0;
27004
27282
  if (v === DEFAULT_BOUND_STATE.NA) return PERMISSION_STATE.NEVER;
27005
27283
  return typeof v === "string" && STATES.has(v) ? v : "malformed";
@@ -27010,12 +27288,12 @@ function tier1State(roleFunctions, code) {
27010
27288
  return listed === "malformed" ? PERMISSION_STATE.NEVER : listed;
27011
27289
  }
27012
27290
  function tier1IsNotApplicable(roleFunctions, code) {
27013
- return roleFunctions.kind === "map" && own(roleFunctions.map, code) === DEFAULT_BOUND_STATE.NA;
27291
+ return roleFunctions.kind === "map" && own2(roleFunctions.map, code) === DEFAULT_BOUND_STATE.NA;
27014
27292
  }
27015
27293
  function catalogRowCode(row) {
27016
27294
  if (!isPlainObject(row)) return null;
27017
- const code = own(row, "code");
27018
- const retired = own(row, "retired");
27295
+ const code = own2(row, "code");
27296
+ const retired = own2(row, "retired");
27019
27297
  if (typeof code !== "string") return null;
27020
27298
  if (retired !== void 0 && retired !== false) return null;
27021
27299
  return code;
@@ -27043,19 +27321,19 @@ function compileTeamGate(teamPolicy) {
27043
27321
  return { restrictsAll: true, flat: void 0, byRole, malformedRoles };
27044
27322
  }
27045
27323
  let restrictsAll = false;
27046
- const functions = readContainer(own(policy.map, "functions"));
27324
+ const functions = readContainer(own2(policy.map, "functions"));
27047
27325
  if (functions.kind === "malformed") restrictsAll = true;
27048
- const roles = own(policy.map, "roles");
27326
+ const roles = own2(policy.map, "roles");
27049
27327
  if (roles !== void 0 && roles !== null) {
27050
27328
  if (!Array.isArray(roles)) restrictsAll = true;
27051
27329
  else {
27052
27330
  for (const entry of roles) {
27053
- const roleCode = isPlainObject(entry) ? own(entry, "roleCode") : void 0;
27331
+ const roleCode = isPlainObject(entry) ? own2(entry, "roleCode") : void 0;
27054
27332
  if (!isPlainObject(entry) || typeof roleCode !== "string") {
27055
27333
  restrictsAll = true;
27056
27334
  continue;
27057
27335
  }
27058
- const overrides = readContainer(own(entry, "overrides"));
27336
+ const overrides = readContainer(own2(entry, "overrides"));
27059
27337
  if (overrides.kind === "malformed") malformedRoles.add(roleCode);
27060
27338
  else if (overrides.kind === "map") {
27061
27339
  const list3 = byRole.get(roleCode) ?? [];
@@ -27080,13 +27358,13 @@ function teamRestricts(gate, roleCode, code) {
27080
27358
  function resolveEffectiveFunctions(input) {
27081
27359
  const raw = input;
27082
27360
  if (!isPlainObject(raw)) return [];
27083
- const roleRows = own(raw, "roles");
27084
- const catalog = own(raw, "functions");
27085
- const assigned = own(raw, "assignedRoleCodes");
27361
+ const roleRows = own2(raw, "roles");
27362
+ const catalog = own2(raw, "functions");
27363
+ const assigned = own2(raw, "assignedRoleCodes");
27086
27364
  if (!Array.isArray(roleRows) || !Array.isArray(catalog) || !Array.isArray(assigned)) return [];
27087
27365
  const rolesByCode = /* @__PURE__ */ new Map();
27088
27366
  for (const r of roleRows) {
27089
- const code = isPlainObject(r) ? own(r, "code") : void 0;
27367
+ const code = isPlainObject(r) ? own2(r, "code") : void 0;
27090
27368
  if (isPlainObject(r) && typeof code === "string") rolesByCode.set(code, r);
27091
27369
  }
27092
27370
  const heldCodes = [...new Set(assigned)].filter(
@@ -27103,9 +27381,9 @@ function resolveEffectiveFunctions(input) {
27103
27381
  const granted = /* @__PURE__ */ new Set();
27104
27382
  for (const roleCode of heldCodes) {
27105
27383
  const role = rolesByCode.get(roleCode);
27106
- const roleFunctions = readContainer(own(role, "functions"));
27384
+ const roleFunctions = readContainer(own2(role, "functions"));
27107
27385
  if (roleFunctions.kind === "malformed") continue;
27108
- const agency = agencyAll.kind === "map" ? readContainer(own(agencyAll.map, roleCode)) : agencyAll;
27386
+ const agency = agencyAll.kind === "map" ? readContainer(own2(agencyAll.map, roleCode)) : agencyAll;
27109
27387
  for (const fn of vocabulary) {
27110
27388
  if (granted.has(fn)) continue;
27111
27389
  if (roleVerdict(roleFunctions, agency, team, roleCode, fn) === "granted") granted.add(fn);
@@ -27148,9 +27426,9 @@ var REFUSAL_ORDER = [
27148
27426
  function explainFunctionRefusal(input, functionCode) {
27149
27427
  const raw = input;
27150
27428
  if (!isPlainObject(raw)) return "not_evaluable";
27151
- const roleRows = own(raw, "roles");
27152
- const catalog = own(raw, "functions");
27153
- const assigned = own(raw, "assignedRoleCodes");
27429
+ const roleRows = own2(raw, "roles");
27430
+ const catalog = own2(raw, "functions");
27431
+ const assigned = own2(raw, "assignedRoleCodes");
27154
27432
  if (!Array.isArray(roleRows) || !Array.isArray(catalog) || !Array.isArray(assigned)) {
27155
27433
  return "not_evaluable";
27156
27434
  }
@@ -27166,7 +27444,7 @@ function explainFunctionRefusal(input, functionCode) {
27166
27444
  if (heldCodes.length === 0) return "no_roles";
27167
27445
  const rolesByCode = /* @__PURE__ */ new Map();
27168
27446
  for (const r of roleRows) {
27169
- const code = isPlainObject(r) ? own(r, "code") : void 0;
27447
+ const code = isPlainObject(r) ? own2(r, "code") : void 0;
27170
27448
  if (isPlainObject(r) && typeof code === "string") rolesByCode.set(code, r);
27171
27449
  }
27172
27450
  const agencyAll = readContainer(input.agencyOverrides);
@@ -27174,9 +27452,9 @@ function explainFunctionRefusal(input, functionCode) {
27174
27452
  let best = REFUSAL_ORDER.length - 1;
27175
27453
  for (const roleCode of heldCodes) {
27176
27454
  const role = rolesByCode.get(roleCode);
27177
- const roleFunctions = role === void 0 ? ABSENT : readContainer(own(role, "functions"));
27455
+ const roleFunctions = role === void 0 ? ABSENT : readContainer(own2(role, "functions"));
27178
27456
  if (roleFunctions.kind === "malformed") continue;
27179
- const agency = agencyAll.kind === "map" ? readContainer(own(agencyAll.map, roleCode)) : agencyAll;
27457
+ const agency = agencyAll.kind === "map" ? readContainer(own2(agencyAll.map, roleCode)) : agencyAll;
27180
27458
  const verdict = roleVerdict(roleFunctions, agency, team, roleCode, functionCode);
27181
27459
  const at = REFUSAL_ORDER.indexOf(verdict);
27182
27460
  if (at < best) best = at;
@@ -28265,7 +28543,7 @@ var HTI_SHARE_PLATFORM_STARTER_SOURCE = SHARING_PLATFORM_STARTER_SOURCE;
28265
28543
  // src/sharingCeiling/chain.ts
28266
28544
  var SHARING_CEILING_DEFAULT_ROW_KEY = "__default__";
28267
28545
  var SHARING_CEILING_EXTERNAL_ROW_KEY = "__external__";
28268
- var own2 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
28546
+ var own3 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
28269
28547
  var isStringList = (v) => Array.isArray(v) && v.every((c) => typeof c === "string");
28270
28548
  function sharingCeilingCellList(cell) {
28271
28549
  if (cell.scopeVersion === SHARING_CEILING_SCOPE_VERSION && isStringList(cell.informationScope)) {
@@ -28300,10 +28578,10 @@ function rungList(value) {
28300
28578
  return isStringList(value) ? [...value] : [];
28301
28579
  }
28302
28580
  function isSharingPurposeDisabled(purpose, purposeOverrides, purposeEnabled) {
28303
- const override = own2(purposeOverrides, purpose);
28581
+ const override = own3(purposeOverrides, purpose);
28304
28582
  if (override === false) return true;
28305
- const callerRow = own2(purposeEnabled, purpose);
28306
- const enabled = typeof callerRow === "boolean" ? callerRow : own2(HTI_SHARE_PLATFORM_PURPOSE_ENABLED, purpose);
28583
+ const callerRow = own3(purposeEnabled, purpose);
28584
+ const enabled = typeof callerRow === "boolean" ? callerRow : own3(HTI_SHARE_PLATFORM_PURPOSE_ENABLED, purpose);
28307
28585
  return enabled === false && override !== true;
28308
28586
  }
28309
28587
  function sharingCeilingRowKey(recipient) {
@@ -28333,10 +28611,10 @@ function effectiveCeiling(rowKey, purpose, inputs) {
28333
28611
  }
28334
28612
  const edits = inputs.edits;
28335
28613
  const rungs = [
28336
- ["partner_rule", own2(own2(edits, rowKey), purpose)],
28337
- ["seeded_partner_rule", own2(own2(starter.counterpartyOverrides, rowKey), purpose)],
28338
- ["account_default", own2(own2(edits, SHARING_CEILING_DEFAULT_ROW_KEY), purpose)],
28339
- ["platform_default", own2(starter.scopeByPurpose, purpose)]
28614
+ ["partner_rule", own3(own3(edits, rowKey), purpose)],
28615
+ ["seeded_partner_rule", own3(own3(starter.counterpartyOverrides, rowKey), purpose)],
28616
+ ["account_default", own3(own3(edits, SHARING_CEILING_DEFAULT_ROW_KEY), purpose)],
28617
+ ["platform_default", own3(starter.scopeByPurpose, purpose)]
28340
28618
  ];
28341
28619
  for (const [rung, value] of rungs) {
28342
28620
  const allowed = rungList(value);
@@ -28374,10 +28652,11 @@ function treeFacts(scope) {
28374
28652
  const coverageChildren = memoize(
28375
28653
  (code) => Object.freeze(scope.childrenOf(code).filter(isCoverageRow))
28376
28654
  );
28655
+ const kindHomed = kindHomedRows(scope);
28377
28656
  const hasOwnContent = memoize((code) => {
28378
28657
  const row = scope.row(code);
28379
28658
  if (row === void 0) return false;
28380
- const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || row.kindRow !== void 0 && INFORMATION_SCOPE_FIELD_HOME_ROWS.has(row.kindRow);
28659
+ const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || kindHomed.has(code);
28381
28660
  if (!homed) return false;
28382
28661
  return !scope.childrenOf(code).some((c) => scope.row(c)?.rowType === "category_rest" && isLive(c));
28383
28662
  });
@@ -28392,6 +28671,28 @@ function treeFacts(scope) {
28392
28671
  factsCache.set(scope, facts);
28393
28672
  return facts;
28394
28673
  }
28674
+ function kindHomedRows(scope) {
28675
+ const perKind = /* @__PURE__ */ new Map();
28676
+ const kinds = /* @__PURE__ */ new Map();
28677
+ for (const r of scope.rows) {
28678
+ if (r.status === "retired" || r.kindBranch === null) continue;
28679
+ if (r.rowType === "person_type") kinds.set(r.kindBranch, r.scopeCode);
28680
+ else if (r.kindRow !== void 0) perKind.set(`${r.kindBranch}\0${r.kindRow}`, r.scopeCode);
28681
+ }
28682
+ const out = /* @__PURE__ */ new Set();
28683
+ for (const home of INFORMATION_SCOPE_FIELD_HOME_ROWS) {
28684
+ const row = scope.row(home);
28685
+ if (row === void 0 || row.specialDataType === "criminal_intelligence") continue;
28686
+ const chain = scope.ancestorsOf(home);
28687
+ if (scope.row(chain[chain.length - 1])?.rowType !== "branch") continue;
28688
+ for (const [kind, root] of kinds) {
28689
+ if (chain.includes(root)) continue;
28690
+ const hit = chain.map((c) => perKind.get(`${kind}\0${c}`)).find((c) => c !== void 0);
28691
+ if (hit !== void 0) out.add(hit);
28692
+ }
28693
+ }
28694
+ return out;
28695
+ }
28395
28696
  function asCeilingSet(allowed) {
28396
28697
  if (allowed === null) return null;
28397
28698
  if (allowed instanceof Set) return allowed;
@@ -28416,6 +28717,7 @@ function ceilingCoverage(scope, allowed) {
28416
28717
  let out;
28417
28718
  if (!facts.isLive(code)) out = false;
28418
28719
  else if (set === null) out = true;
28720
+ else if (facts.underFloor(code)) out = set.has(code);
28419
28721
  else if (scope.ancestorsOf(code).some((c) => set.has(c))) out = true;
28420
28722
  else if (facts.hasOwnContent(code)) out = false;
28421
28723
  else {
@@ -28513,6 +28815,10 @@ function maskSelectionToCeiling(scope, selection, allowed) {
28513
28815
  for (const child of scope.childrenOf(code)) if (!sel.includes(child)) sel.push(child);
28514
28816
  }
28515
28817
  for (const code of outside) sel = subtractRow(scope, sel, code);
28818
+ if (asCeilingSet(allowed) !== null) {
28819
+ const within = ceilingCoverage(scope, allowed);
28820
+ sel = sel.filter((c) => !facts.underFloor(c) || within(c));
28821
+ }
28516
28822
  return withSystemInfo(sel.filter((c) => facts.isLive(c)));
28517
28823
  }
28518
28824
  function isPermittedByCeiling(scope, ceiling, code) {
@@ -28584,7 +28890,7 @@ var SHARE_LEVEL_LABEL = Object.freeze({
28584
28890
  platform_starter: "Platform default",
28585
28891
  inside_starter: "the platform's default for sharing inside your account"
28586
28892
  });
28587
- var own3 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
28893
+ var own4 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
28588
28894
  var isStringList2 = (v) => Array.isArray(v) && v.every((c) => typeof c === "string");
28589
28895
  var versionOf = (v) => {
28590
28896
  const n = typeof v === "number" ? v : parseInt(String(v), 10);
@@ -28680,7 +28986,7 @@ function derivePlatformDefault(scope, purpose, seedList, options = {}) {
28680
28986
  else if (req.has(g)) state = "always";
28681
28987
  else if (scope.row(g)?.shareableDefault === false) state = "never";
28682
28988
  else state = scopeListCovers(scope, seed, g) ? "default_on" : "default_off";
28683
- const bound = own3(options.bounds, g);
28989
+ const bound = own4(options.bounds, g);
28684
28990
  if (g !== systemCode && (bound === "always" || bound === "default_on" || bound === "default_off" || bound === "never"))
28685
28991
  state = bound;
28686
28992
  states[g] = state;
@@ -28774,10 +29080,10 @@ var HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE = Object.freeze({
28774
29080
  });
28775
29081
  function platformDefaultFor(scope, purpose, options = {}) {
28776
29082
  const starter = options.starter ?? HTI_SHARE_PLATFORM_STARTER;
28777
- const seed = own3(starter.scopeByPurpose, purpose);
29083
+ const seed = own4(starter.scopeByPurpose, purpose);
28778
29084
  if (!isStringList2(seed)) return null;
28779
29085
  return derivePlatformDefault(scope, purpose, seed, {
28780
- required: own3(HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE, purpose) ?? [],
29086
+ required: own4(HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE, purpose) ?? [],
28781
29087
  bounds: options.bounds ?? null,
28782
29088
  version: options.version ?? 1,
28783
29089
  edited: options.edited === true
@@ -28787,14 +29093,15 @@ function shareRowCeiling(resolution, scope) {
28787
29093
  if (!resolution.allowed) return [];
28788
29094
  const out = [];
28789
29095
  for (const g of resolution.allowedCategories) {
28790
- const e = own3(resolution.scope, g);
29096
+ const e = own4(resolution.scope, g);
28791
29097
  if (e === void 0) continue;
28792
29098
  const withheld = /* @__PURE__ */ new Set([
28793
29099
  ...e.excludedItems,
28794
29100
  ...e.teamExcludedItems,
28795
29101
  ...e.floorItems
28796
29102
  ]);
28797
- if (withheld.size === 0) {
29103
+ const onlyFloorWithheld = [...withheld].every((r) => e.floorItems.includes(r));
29104
+ if (withheld.size === 0 || onlyFloorWithheld && hasOwnScopeContent(scope, g)) {
28798
29105
  out.push(g);
28799
29106
  continue;
28800
29107
  }
@@ -28875,13 +29182,13 @@ function resolveShare(input) {
28875
29182
  rulePath: `sharingPurposePolicies[${p.id}] v${v} (policy \u201C${name}\u201D \u2014 ${SHARE_LEVEL_LABEL[level2]})`
28876
29183
  };
28877
29184
  };
28878
- const cell = (map, key) => own3(own3(map, key), purpose);
29185
+ const cell = (map, key) => own4(own4(map, key), purpose);
28879
29186
  let gov = null;
28880
29187
  const purposeKnown = pd !== null;
28881
29188
  const teamRowId = purposeKnown && teamId !== null && recipient.kind !== "external" && typeof input.teamRowId === "string" && input.teamRowId !== "" ? input.teamRowId : null;
28882
29189
  if (teamRowId !== null) gov = hit(cell(att.teamRows, teamRowId), "team_row");
28883
29190
  if (gov === null && inside && purposeKnown) {
28884
- gov = hit(own3(att.internalDefaults, purpose), "account_internal");
29191
+ gov = hit(own4(att.internalDefaults, purpose), "account_internal");
28885
29192
  if (gov === null && pd !== null) {
28886
29193
  const starter = {
28887
29194
  id: `pol-inside-starter-${purpose}`,
@@ -28926,7 +29233,7 @@ function resolveShare(input) {
28926
29233
  };
28927
29234
  }
28928
29235
  if (gov === null)
28929
- gov = hit(own3(att.agencyDefaults, purpose), "agency_default");
29236
+ gov = hit(own4(att.agencyDefaults, purpose), "agency_default");
28930
29237
  if (gov === null && pd !== null) {
28931
29238
  const starter = {
28932
29239
  id: `pol-starter-${purpose}`,
@@ -29145,7 +29452,7 @@ function resolveShare(input) {
29145
29452
  "Outside the payload for this purpose"
29146
29453
  );
29147
29454
  }
29148
- const govRows = polScopeBinds ? own3(govItems, g) : void 0;
29455
+ const govRows = polScopeBinds ? own4(govItems, g) : void 0;
29149
29456
  if (allowed && !req && isStringList2(govRows)) {
29150
29457
  const keep = new Set(govRows);
29151
29458
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -29154,7 +29461,7 @@ function resolveShare(input) {
29154
29461
  `Outside what the \u201C${govName}\u201D policy allows for this purpose`
29155
29462
  );
29156
29463
  }
29157
- const defRows = defaultItems === null ? void 0 : own3(defaultItems.rows, g);
29464
+ const defRows = defaultItems === null ? void 0 : own4(defaultItems.rows, g);
29158
29465
  if (allowed && !req && isStringList2(defRows)) {
29159
29466
  const keep = new Set(defRows);
29160
29467
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -29175,7 +29482,7 @@ function resolveShare(input) {
29175
29482
  for (const r of outside((x) => scopeListCovers(scope, tcScope, g, x)))
29176
29483
  outRows.add(r);
29177
29484
  }
29178
- const tcRows = own3(tcItems, g);
29485
+ const tcRows = own4(tcItems, g);
29179
29486
  if (isStringList2(tcRows)) {
29180
29487
  const keep = new Set(tcRows);
29181
29488
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -29186,7 +29493,8 @@ function resolveShare(input) {
29186
29493
  teamExcludedItems.push(r);
29187
29494
  if (teamExcludedItems.length > 0) teamExcludedReason = why;
29188
29495
  }
29189
- if (allowed && (!req || platformRequired !== null) && leaves.length > 0) {
29496
+ const floorOnlyOwnContent = leaves.length > 0 && leaves.every((r) => floorItems.includes(r)) && hasOwnScopeContent(scope, g);
29497
+ if (allowed && (!req || platformRequired !== null) && leaves.length > 0 && !floorOnlyOwnContent) {
29190
29498
  const gone = new Set(
29191
29499
  [...floorItems, ...excludedItems, ...teamExcludedItems].filter(
29192
29500
  (r) => leaves.includes(r)
@@ -77220,10 +77528,15 @@ var CVC_197_VALUES = selectableCodes(
77220
77528
  INCIDENT_PARTICIPATION_ROLE_LABELS,
77221
77529
  INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY,
77222
77530
  INCIDENT_PARTICIPATION_ROLE_VALUES,
77531
+ INFORMATION_SCOPE_CATEGORY_ORDER,
77532
+ INFORMATION_SCOPE_CATEGORY_SUB,
77223
77533
  INFORMATION_SCOPE_FIELD_HOME_ROWS,
77224
77534
  INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE,
77225
77535
  INFORMATION_SCOPE_READABLE_VERSIONS,
77536
+ INFORMATION_SCOPE_ROW_HINT,
77537
+ INFORMATION_SCOPE_ROW_ORDER,
77226
77538
  INFORMATION_SCOPE_SYSTEM_INFO,
77539
+ INFORMATION_SCOPE_UI_COPY_SOURCE,
77227
77540
  INFORMATION_SCOPE_VERSION,
77228
77541
  INTERACTION_TYPES,
77229
77542
  INTERACTION_TYPE_LABELS,
@@ -77827,9 +78140,12 @@ var CVC_197_VALUES = selectableCodes(
77827
78140
  rowsOutsideCeiling,
77828
78141
  rowsOverCeiling,
77829
78142
  rsvpResponseSot,
78143
+ scopeCategorySub,
77830
78144
  scopeListCovers,
77831
78145
  scopeListStrictlyCovers,
77832
78146
  scopeMigrationsFromSot,
78147
+ scopeRowDisplayOrder,
78148
+ scopeRowHint,
77833
78149
  scopeRowWithinCeiling,
77834
78150
  scopeRowsFromSot,
77835
78151
  scoringConditionSchema,
@@ -77886,6 +78202,8 @@ var CVC_197_VALUES = selectableCodes(
77886
78202
  smtSignificanceFlagsSot,
77887
78203
  smtTypeSot,
77888
78204
  sortRelationshipsByPriority,
78205
+ sortScopeCategories,
78206
+ sortScopeRows,
77889
78207
  sourceCategorySot,
77890
78208
  sourceInstrumentSot,
77891
78209
  sourceSubtypeSot,