@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.js CHANGED
@@ -8849,13 +8849,13 @@ function createCodebookReader(file, sot, codes) {
8849
8849
  const pickerLabels = sot.pickerLabels ?? {};
8850
8850
  const options = /* @__PURE__ */ new Map();
8851
8851
  for (const [name, offered] of Object.entries(pickers)) {
8852
- const own4 = pickerLabels[name] ?? {};
8852
+ const own5 = pickerLabels[name] ?? {};
8853
8853
  options.set(
8854
8854
  name,
8855
8855
  offered.map((c) => {
8856
8856
  const v = byCode.get(c);
8857
8857
  if (!v) throw new Error(`${file}: picker ${name} offers ${c}, not a code`);
8858
- return { code: v.code, label: own4[c] ?? v.label };
8858
+ return { code: v.code, label: own5[c] ?? v.label };
8859
8859
  })
8860
8860
  );
8861
8861
  }
@@ -8869,8 +8869,8 @@ function createCodebookReader(file, sot, codes) {
8869
8869
  byCode: (code) => byCode.get(code) ?? null,
8870
8870
  entry: (code) => entryByCode.get(code) ?? null,
8871
8871
  label: (code, picker) => {
8872
- const own4 = picker === void 0 ? void 0 : pickerLabels[picker]?.[code];
8873
- return own4 ?? byCode.get(code)?.label ?? code;
8872
+ const own5 = picker === void 0 ? void 0 : pickerLabels[picker]?.[code];
8873
+ return own5 ?? byCode.get(code)?.label ?? code;
8874
8874
  },
8875
8875
  normalize: (stored) => {
8876
8876
  if (typeof stored !== "string") return null;
@@ -25722,6 +25722,274 @@ function scopeMigrationsFromSot(sot) {
25722
25722
  });
25723
25723
  }
25724
25724
 
25725
+ // src/generated/informationScopeUiCopy.ts
25726
+ var INFORMATION_SCOPE_UI_COPY_SOURCE = {
25727
+ "order": {
25728
+ "repo": "htilabstech/prototype",
25729
+ "file": "data/cvcs/core_information_scope.yaml",
25730
+ "sha": "395bb7aa"
25731
+ },
25732
+ "words": {
25733
+ "repo": "htilabstech/platform-prototype",
25734
+ "file": "src/data.js",
25735
+ "sha": "c324f715",
25736
+ "line": 33875
25737
+ }
25738
+ };
25739
+ var INFORMATION_SCOPE_CATEGORY_ORDER = [
25740
+ "system",
25741
+ "notes",
25742
+ "identifying",
25743
+ "contact",
25744
+ "health_accommodation",
25745
+ "immigration_legal_status",
25746
+ "risk",
25747
+ "services",
25748
+ "instruments",
25749
+ "relationships_household",
25750
+ "offenders__identifying",
25751
+ "offenders__contact",
25752
+ "offenders__health_accommodation",
25753
+ "offenders__immigration_legal_status",
25754
+ "offenders__risk",
25755
+ "offenders__services",
25756
+ "offenders__instruments",
25757
+ "offenders__relationships_household",
25758
+ "family__identifying",
25759
+ "family__contact",
25760
+ "family__health_accommodation",
25761
+ "family__immigration_legal_status",
25762
+ "family__risk",
25763
+ "family__services",
25764
+ "family__instruments",
25765
+ "family__relationships_household",
25766
+ "others__identifying",
25767
+ "others__contact",
25768
+ "others__health_accommodation",
25769
+ "others__immigration_legal_status",
25770
+ "others__risk",
25771
+ "others__services",
25772
+ "others__instruments",
25773
+ "others__relationships_household",
25774
+ "network_associations",
25775
+ "commercial_activity",
25776
+ "investigative_work_product",
25777
+ "object_identifiers"
25778
+ ];
25779
+ var INFORMATION_SCOPE_CATEGORY_SUB = {
25780
+ "system": "Session timestamps, source info \u2014 always shared",
25781
+ "notes": "The session summary, and notes written in a session or on the case",
25782
+ "identifying": "Names, DOB, addresses, identifiers, demographics",
25783
+ "contact": "How to reach the person safely: contact info + safety preferences, the Priorities & Safety triage",
25784
+ "health_accommodation": "Health status, accommodation needs",
25785
+ "immigration_legal_status": "Immigration status, immigration applications",
25786
+ "risk": "Indicators, screening outcomes, per-instrument assessment responses, determinations, system involvement \u2014 the people who caused harm are their own branch",
25787
+ "services": "Contact history with this agency, service records, service plans + goals \u2014 three tiers of sensitivity",
25788
+ "instruments": "Initial Screen, intake screens, assessments, Findings \u2014 a Summary & outcome row and a Full questions, narratives & notes row per instrument",
25789
+ "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",
25790
+ "offenders__identifying": "People who caused harm \u2014 the person's own record, grouped by kind (identifying information)",
25791
+ "offenders__contact": "People who caused harm \u2014 the person's own record, grouped by kind (contact & safety)",
25792
+ "offenders__health_accommodation": "People who caused harm \u2014 the person's own record, grouped by kind (health & accommodation)",
25793
+ "offenders__immigration_legal_status": "People who caused harm \u2014 the person's own record, grouped by kind (immigration & legal status)",
25794
+ "offenders__risk": "People who caused harm \u2014 the person's own record, grouped by kind (risk-related)",
25795
+ "offenders__services": "People who caused harm \u2014 the person's own record, grouped by kind (services & case history)",
25796
+ "offenders__instruments": "People who caused harm \u2014 the person's own record, grouped by kind (screens & assessments)",
25797
+ "offenders__relationships_household": "People who caused harm \u2014 the person's own record, grouped by kind (relationships & household)",
25798
+ "family__identifying": "Eligible family members \u2014 the person's own record, grouped by kind (identifying information)",
25799
+ "family__contact": "Eligible family members \u2014 the person's own record, grouped by kind (contact & safety)",
25800
+ "family__health_accommodation": "Eligible family members \u2014 the person's own record, grouped by kind (health & accommodation)",
25801
+ "family__immigration_legal_status": "Eligible family members \u2014 the person's own record, grouped by kind (immigration & legal status)",
25802
+ "family__risk": "Eligible family members \u2014 the person's own record, grouped by kind (risk-related)",
25803
+ "family__services": "Eligible family members \u2014 the person's own record, grouped by kind (services & case history)",
25804
+ "family__instruments": "Eligible family members \u2014 the person's own record, grouped by kind (screens & assessments)",
25805
+ "family__relationships_household": "Eligible family members \u2014 the person's own record, grouped by kind (relationships & household)",
25806
+ "others__identifying": "Other people on the case \u2014 the person's own record, grouped by kind (identifying information)",
25807
+ "others__contact": "Other people on the case \u2014 the person's own record, grouped by kind (contact & safety)",
25808
+ "others__health_accommodation": "Other people on the case \u2014 the person's own record, grouped by kind (health & accommodation)",
25809
+ "others__immigration_legal_status": "Other people on the case \u2014 the person's own record, grouped by kind (immigration & legal status)",
25810
+ "others__risk": "Other people on the case \u2014 the person's own record, grouped by kind (risk-related)",
25811
+ "others__services": "Other people on the case \u2014 the person's own record, grouped by kind (services & case history)",
25812
+ "others__instruments": "Other people on the case \u2014 the person's own record, grouped by kind (screens & assessments)",
25813
+ "others__relationships_household": "Other people on the case \u2014 the person's own record, grouped by kind (relationships & household)",
25814
+ "network_associations": "Personas, network membership, relationships, criminal-org links",
25815
+ "commercial_activity": "Ads, listings, posting activity, pricing, business fronts",
25816
+ "investigative_work_product": "Analyst determinations, dispositions, case briefs",
25817
+ "object_identifiers": "Phone numbers, vehicle identifiers, image hashes, account handles"
25818
+ };
25819
+ var INFORMATION_SCOPE_ROW_ORDER = {
25820
+ "system": [
25821
+ "system_info"
25822
+ ],
25823
+ "notes": [
25824
+ "session_summary",
25825
+ "case_notes"
25826
+ ],
25827
+ "identifying": [
25828
+ "names",
25829
+ "dob",
25830
+ "addresses",
25831
+ "additional_ids",
25832
+ "demographics",
25833
+ "identifying__other"
25834
+ ],
25835
+ "contact": [
25836
+ "contact_info",
25837
+ "safe_locations",
25838
+ "priorities_safety",
25839
+ "encounter_location"
25840
+ ],
25841
+ "health_accommodation": [
25842
+ "health_status",
25843
+ "accommodation_needs"
25844
+ ],
25845
+ "immigration_legal_status": [
25846
+ "immigration_status",
25847
+ "immigration_applications"
25848
+ ],
25849
+ "risk": [
25850
+ "screen_indicators",
25851
+ "victimization",
25852
+ "system_involvement",
25853
+ "derived_risk_signals"
25854
+ ],
25855
+ "services": [
25856
+ "contact_history",
25857
+ "service_history",
25858
+ "plans_goals"
25859
+ ],
25860
+ "instruments": [
25861
+ "summary_initial_screen",
25862
+ "summary_mental_health_screen",
25863
+ "summary_behavioral_health_intake",
25864
+ "summary_trauma_and_coping_screen",
25865
+ "summary_ae_intake",
25866
+ "summary_ida",
25867
+ "summary_lap",
25868
+ "summary_danger_assessment",
25869
+ "summary_stalking_assessment",
25870
+ "summary_injury_and_strangulation",
25871
+ "summary_hope_scale",
25872
+ "summary_needs_assessment",
25873
+ "summary_tra",
25874
+ "summary_findings",
25875
+ "full_initial_screen",
25876
+ "full_mental_health_screen",
25877
+ "full_behavioral_health_intake",
25878
+ "full_trauma_and_coping_screen",
25879
+ "full_ae_intake",
25880
+ "full_ida",
25881
+ "full_lap",
25882
+ "full_danger_assessment",
25883
+ "full_stalking_assessment",
25884
+ "full_injury_and_strangulation",
25885
+ "full_hope_scale",
25886
+ "full_needs_assessment",
25887
+ "full_tra",
25888
+ "full_findings"
25889
+ ],
25890
+ "relationships_household": [],
25891
+ "offenders__identifying": [],
25892
+ "offenders__contact": [
25893
+ "offenders__safe_locations"
25894
+ ],
25895
+ "offenders__health_accommodation": [],
25896
+ "offenders__immigration_legal_status": [],
25897
+ "offenders__risk": [],
25898
+ "offenders__services": [],
25899
+ "offenders__instruments": [
25900
+ "offenders__instrument_summary",
25901
+ "offenders__instrument_full"
25902
+ ],
25903
+ "offenders__relationships_household": [],
25904
+ "family__identifying": [],
25905
+ "family__contact": [
25906
+ "family__safe_locations"
25907
+ ],
25908
+ "family__health_accommodation": [],
25909
+ "family__immigration_legal_status": [],
25910
+ "family__risk": [],
25911
+ "family__services": [],
25912
+ "family__instruments": [
25913
+ "family__instrument_summary",
25914
+ "family__instrument_full"
25915
+ ],
25916
+ "family__relationships_household": [],
25917
+ "others__identifying": [],
25918
+ "others__contact": [
25919
+ "others__safe_locations"
25920
+ ],
25921
+ "others__health_accommodation": [],
25922
+ "others__immigration_legal_status": [],
25923
+ "others__risk": [],
25924
+ "others__services": [],
25925
+ "others__instruments": [
25926
+ "others__instrument_summary",
25927
+ "others__instrument_full"
25928
+ ],
25929
+ "others__relationships_household": [],
25930
+ "network_associations": [
25931
+ "network_membership",
25932
+ "persona_links"
25933
+ ],
25934
+ "commercial_activity": [
25935
+ "ad_content",
25936
+ "commercial_patterns"
25937
+ ],
25938
+ "investigative_work_product": [
25939
+ "case_determinations",
25940
+ "case_lifecycle",
25941
+ "case_attachments"
25942
+ ],
25943
+ "object_identifiers": [
25944
+ "phone_identifiers",
25945
+ "object_identity_attributes"
25946
+ ]
25947
+ };
25948
+ var INFORMATION_SCOPE_ROW_HINT = {
25949
+ "system_info": "Always included",
25950
+ "names": "All logged name entries",
25951
+ "additional_ids": "Other IDs entered separately",
25952
+ "identifying__other": "Living situation \xB7 work & income \xB7 education \xB7 languages \xB7 citizenship \xB7 physical description \xB7 vehicle",
25953
+ "safe_locations": "Shelter placements + confidential program addresses",
25954
+ "encounter_location": "The session's meetup / incident location \u2014 not the survivor's own addresses (CVC-191 reasons Meet / contact + Incident)",
25955
+ "immigration_status": "Visa type + birth country + relevant flags",
25956
+ "commercial_patterns": "Pricing, schedule, venues",
25957
+ "case_attachments": "Content-dependent \u2014 attachment handling flags govern",
25958
+ "object_identity_attributes": "Names, trade names, ages"
25959
+ };
25960
+
25961
+ // src/services/informationScopeUiCopy.ts
25962
+ var own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
25963
+ function toKey(codeOrKey) {
25964
+ return codeOrKey.replace(/\./g, "__");
25965
+ }
25966
+ function toCode(key) {
25967
+ return key.replace(/__/g, ".");
25968
+ }
25969
+ function scopeCategorySub(category) {
25970
+ const k = toKey(category);
25971
+ return own(INFORMATION_SCOPE_CATEGORY_SUB, k) ? INFORMATION_SCOPE_CATEGORY_SUB[k] : void 0;
25972
+ }
25973
+ function scopeRowHint(row) {
25974
+ const k = toKey(row);
25975
+ return own(INFORMATION_SCOPE_ROW_HINT, k) ? INFORMATION_SCOPE_ROW_HINT[k] : void 0;
25976
+ }
25977
+ function scopeRowDisplayOrder(category) {
25978
+ const k = toKey(category);
25979
+ return own(INFORMATION_SCOPE_ROW_ORDER, k) ? INFORMATION_SCOPE_ROW_ORDER[k].map(toCode) : [];
25980
+ }
25981
+ function sortScopeRows(category, rows) {
25982
+ const k = toKey(category);
25983
+ const order = own(INFORMATION_SCOPE_ROW_ORDER, k) ? INFORMATION_SCOPE_ROW_ORDER[k] : [];
25984
+ const rank = new Map(order.map((r, i) => [r, i]));
25985
+ 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);
25986
+ }
25987
+ function sortScopeCategories(categories) {
25988
+ const rank = new Map(INFORMATION_SCOPE_CATEGORY_ORDER.map((c, i) => [c, i]));
25989
+ const n = INFORMATION_SCOPE_CATEGORY_ORDER.length;
25990
+ 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);
25991
+ }
25992
+
25725
25993
  // src/age/ageFromDob.ts
25726
25994
  var DOB_MIN_YEAR = 1850;
25727
25995
  function toNullableNumber(v) {
@@ -25923,12 +26191,12 @@ function readContainer(v) {
25923
26191
  if (v === void 0 || v === null) return ABSENT;
25924
26192
  return isPlainObject(v) ? { kind: "map", map: v } : MALFORMED;
25925
26193
  }
25926
- function own(map, key) {
26194
+ function own2(map, key) {
25927
26195
  return Object.hasOwn(map, key) ? map[key] : void 0;
25928
26196
  }
25929
26197
  var STATES = new Set(Object.values(PERMISSION_STATE));
25930
26198
  function readState(map, code) {
25931
- const v = own(map, code);
26199
+ const v = own2(map, code);
25932
26200
  if (v === void 0 || v === null) return void 0;
25933
26201
  if (v === DEFAULT_BOUND_STATE.NA) return PERMISSION_STATE.NEVER;
25934
26202
  return typeof v === "string" && STATES.has(v) ? v : "malformed";
@@ -25939,12 +26207,12 @@ function tier1State(roleFunctions, code) {
25939
26207
  return listed === "malformed" ? PERMISSION_STATE.NEVER : listed;
25940
26208
  }
25941
26209
  function tier1IsNotApplicable(roleFunctions, code) {
25942
- return roleFunctions.kind === "map" && own(roleFunctions.map, code) === DEFAULT_BOUND_STATE.NA;
26210
+ return roleFunctions.kind === "map" && own2(roleFunctions.map, code) === DEFAULT_BOUND_STATE.NA;
25943
26211
  }
25944
26212
  function catalogRowCode(row) {
25945
26213
  if (!isPlainObject(row)) return null;
25946
- const code = own(row, "code");
25947
- const retired = own(row, "retired");
26214
+ const code = own2(row, "code");
26215
+ const retired = own2(row, "retired");
25948
26216
  if (typeof code !== "string") return null;
25949
26217
  if (retired !== void 0 && retired !== false) return null;
25950
26218
  return code;
@@ -25972,19 +26240,19 @@ function compileTeamGate(teamPolicy) {
25972
26240
  return { restrictsAll: true, flat: void 0, byRole, malformedRoles };
25973
26241
  }
25974
26242
  let restrictsAll = false;
25975
- const functions = readContainer(own(policy.map, "functions"));
26243
+ const functions = readContainer(own2(policy.map, "functions"));
25976
26244
  if (functions.kind === "malformed") restrictsAll = true;
25977
- const roles = own(policy.map, "roles");
26245
+ const roles = own2(policy.map, "roles");
25978
26246
  if (roles !== void 0 && roles !== null) {
25979
26247
  if (!Array.isArray(roles)) restrictsAll = true;
25980
26248
  else {
25981
26249
  for (const entry of roles) {
25982
- const roleCode = isPlainObject(entry) ? own(entry, "roleCode") : void 0;
26250
+ const roleCode = isPlainObject(entry) ? own2(entry, "roleCode") : void 0;
25983
26251
  if (!isPlainObject(entry) || typeof roleCode !== "string") {
25984
26252
  restrictsAll = true;
25985
26253
  continue;
25986
26254
  }
25987
- const overrides = readContainer(own(entry, "overrides"));
26255
+ const overrides = readContainer(own2(entry, "overrides"));
25988
26256
  if (overrides.kind === "malformed") malformedRoles.add(roleCode);
25989
26257
  else if (overrides.kind === "map") {
25990
26258
  const list3 = byRole.get(roleCode) ?? [];
@@ -26009,13 +26277,13 @@ function teamRestricts(gate, roleCode, code) {
26009
26277
  function resolveEffectiveFunctions(input) {
26010
26278
  const raw = input;
26011
26279
  if (!isPlainObject(raw)) return [];
26012
- const roleRows = own(raw, "roles");
26013
- const catalog = own(raw, "functions");
26014
- const assigned = own(raw, "assignedRoleCodes");
26280
+ const roleRows = own2(raw, "roles");
26281
+ const catalog = own2(raw, "functions");
26282
+ const assigned = own2(raw, "assignedRoleCodes");
26015
26283
  if (!Array.isArray(roleRows) || !Array.isArray(catalog) || !Array.isArray(assigned)) return [];
26016
26284
  const rolesByCode = /* @__PURE__ */ new Map();
26017
26285
  for (const r of roleRows) {
26018
- const code = isPlainObject(r) ? own(r, "code") : void 0;
26286
+ const code = isPlainObject(r) ? own2(r, "code") : void 0;
26019
26287
  if (isPlainObject(r) && typeof code === "string") rolesByCode.set(code, r);
26020
26288
  }
26021
26289
  const heldCodes = [...new Set(assigned)].filter(
@@ -26032,9 +26300,9 @@ function resolveEffectiveFunctions(input) {
26032
26300
  const granted = /* @__PURE__ */ new Set();
26033
26301
  for (const roleCode of heldCodes) {
26034
26302
  const role = rolesByCode.get(roleCode);
26035
- const roleFunctions = readContainer(own(role, "functions"));
26303
+ const roleFunctions = readContainer(own2(role, "functions"));
26036
26304
  if (roleFunctions.kind === "malformed") continue;
26037
- const agency = agencyAll.kind === "map" ? readContainer(own(agencyAll.map, roleCode)) : agencyAll;
26305
+ const agency = agencyAll.kind === "map" ? readContainer(own2(agencyAll.map, roleCode)) : agencyAll;
26038
26306
  for (const fn of vocabulary) {
26039
26307
  if (granted.has(fn)) continue;
26040
26308
  if (roleVerdict(roleFunctions, agency, team, roleCode, fn) === "granted") granted.add(fn);
@@ -26077,9 +26345,9 @@ var REFUSAL_ORDER = [
26077
26345
  function explainFunctionRefusal(input, functionCode) {
26078
26346
  const raw = input;
26079
26347
  if (!isPlainObject(raw)) return "not_evaluable";
26080
- const roleRows = own(raw, "roles");
26081
- const catalog = own(raw, "functions");
26082
- const assigned = own(raw, "assignedRoleCodes");
26348
+ const roleRows = own2(raw, "roles");
26349
+ const catalog = own2(raw, "functions");
26350
+ const assigned = own2(raw, "assignedRoleCodes");
26083
26351
  if (!Array.isArray(roleRows) || !Array.isArray(catalog) || !Array.isArray(assigned)) {
26084
26352
  return "not_evaluable";
26085
26353
  }
@@ -26095,7 +26363,7 @@ function explainFunctionRefusal(input, functionCode) {
26095
26363
  if (heldCodes.length === 0) return "no_roles";
26096
26364
  const rolesByCode = /* @__PURE__ */ new Map();
26097
26365
  for (const r of roleRows) {
26098
- const code = isPlainObject(r) ? own(r, "code") : void 0;
26366
+ const code = isPlainObject(r) ? own2(r, "code") : void 0;
26099
26367
  if (isPlainObject(r) && typeof code === "string") rolesByCode.set(code, r);
26100
26368
  }
26101
26369
  const agencyAll = readContainer(input.agencyOverrides);
@@ -26103,9 +26371,9 @@ function explainFunctionRefusal(input, functionCode) {
26103
26371
  let best = REFUSAL_ORDER.length - 1;
26104
26372
  for (const roleCode of heldCodes) {
26105
26373
  const role = rolesByCode.get(roleCode);
26106
- const roleFunctions = role === void 0 ? ABSENT : readContainer(own(role, "functions"));
26374
+ const roleFunctions = role === void 0 ? ABSENT : readContainer(own2(role, "functions"));
26107
26375
  if (roleFunctions.kind === "malformed") continue;
26108
- const agency = agencyAll.kind === "map" ? readContainer(own(agencyAll.map, roleCode)) : agencyAll;
26376
+ const agency = agencyAll.kind === "map" ? readContainer(own2(agencyAll.map, roleCode)) : agencyAll;
26109
26377
  const verdict = roleVerdict(roleFunctions, agency, team, roleCode, functionCode);
26110
26378
  const at = REFUSAL_ORDER.indexOf(verdict);
26111
26379
  if (at < best) best = at;
@@ -27194,7 +27462,7 @@ var HTI_SHARE_PLATFORM_STARTER_SOURCE = SHARING_PLATFORM_STARTER_SOURCE;
27194
27462
  // src/sharingCeiling/chain.ts
27195
27463
  var SHARING_CEILING_DEFAULT_ROW_KEY = "__default__";
27196
27464
  var SHARING_CEILING_EXTERNAL_ROW_KEY = "__external__";
27197
- var own2 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
27465
+ var own3 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
27198
27466
  var isStringList = (v) => Array.isArray(v) && v.every((c) => typeof c === "string");
27199
27467
  function sharingCeilingCellList(cell) {
27200
27468
  if (cell.scopeVersion === SHARING_CEILING_SCOPE_VERSION && isStringList(cell.informationScope)) {
@@ -27229,10 +27497,10 @@ function rungList(value) {
27229
27497
  return isStringList(value) ? [...value] : [];
27230
27498
  }
27231
27499
  function isSharingPurposeDisabled(purpose, purposeOverrides, purposeEnabled) {
27232
- const override = own2(purposeOverrides, purpose);
27500
+ const override = own3(purposeOverrides, purpose);
27233
27501
  if (override === false) return true;
27234
- const callerRow = own2(purposeEnabled, purpose);
27235
- const enabled = typeof callerRow === "boolean" ? callerRow : own2(HTI_SHARE_PLATFORM_PURPOSE_ENABLED, purpose);
27502
+ const callerRow = own3(purposeEnabled, purpose);
27503
+ const enabled = typeof callerRow === "boolean" ? callerRow : own3(HTI_SHARE_PLATFORM_PURPOSE_ENABLED, purpose);
27236
27504
  return enabled === false && override !== true;
27237
27505
  }
27238
27506
  function sharingCeilingRowKey(recipient) {
@@ -27262,10 +27530,10 @@ function effectiveCeiling(rowKey, purpose, inputs) {
27262
27530
  }
27263
27531
  const edits = inputs.edits;
27264
27532
  const rungs = [
27265
- ["partner_rule", own2(own2(edits, rowKey), purpose)],
27266
- ["seeded_partner_rule", own2(own2(starter.counterpartyOverrides, rowKey), purpose)],
27267
- ["account_default", own2(own2(edits, SHARING_CEILING_DEFAULT_ROW_KEY), purpose)],
27268
- ["platform_default", own2(starter.scopeByPurpose, purpose)]
27533
+ ["partner_rule", own3(own3(edits, rowKey), purpose)],
27534
+ ["seeded_partner_rule", own3(own3(starter.counterpartyOverrides, rowKey), purpose)],
27535
+ ["account_default", own3(own3(edits, SHARING_CEILING_DEFAULT_ROW_KEY), purpose)],
27536
+ ["platform_default", own3(starter.scopeByPurpose, purpose)]
27269
27537
  ];
27270
27538
  for (const [rung, value] of rungs) {
27271
27539
  const allowed = rungList(value);
@@ -27303,10 +27571,11 @@ function treeFacts(scope) {
27303
27571
  const coverageChildren = memoize(
27304
27572
  (code) => Object.freeze(scope.childrenOf(code).filter(isCoverageRow))
27305
27573
  );
27574
+ const kindHomed = kindHomedRows(scope);
27306
27575
  const hasOwnContent = memoize((code) => {
27307
27576
  const row = scope.row(code);
27308
27577
  if (row === void 0) return false;
27309
- const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || row.kindRow !== void 0 && INFORMATION_SCOPE_FIELD_HOME_ROWS.has(row.kindRow);
27578
+ const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || kindHomed.has(code);
27310
27579
  if (!homed) return false;
27311
27580
  return !scope.childrenOf(code).some((c) => scope.row(c)?.rowType === "category_rest" && isLive(c));
27312
27581
  });
@@ -27321,6 +27590,28 @@ function treeFacts(scope) {
27321
27590
  factsCache.set(scope, facts);
27322
27591
  return facts;
27323
27592
  }
27593
+ function kindHomedRows(scope) {
27594
+ const perKind = /* @__PURE__ */ new Map();
27595
+ const kinds = /* @__PURE__ */ new Map();
27596
+ for (const r of scope.rows) {
27597
+ if (r.status === "retired" || r.kindBranch === null) continue;
27598
+ if (r.rowType === "person_type") kinds.set(r.kindBranch, r.scopeCode);
27599
+ else if (r.kindRow !== void 0) perKind.set(`${r.kindBranch}\0${r.kindRow}`, r.scopeCode);
27600
+ }
27601
+ const out = /* @__PURE__ */ new Set();
27602
+ for (const home of INFORMATION_SCOPE_FIELD_HOME_ROWS) {
27603
+ const row = scope.row(home);
27604
+ if (row === void 0 || row.specialDataType === "criminal_intelligence") continue;
27605
+ const chain = scope.ancestorsOf(home);
27606
+ if (scope.row(chain[chain.length - 1])?.rowType !== "branch") continue;
27607
+ for (const [kind, root] of kinds) {
27608
+ if (chain.includes(root)) continue;
27609
+ const hit = chain.map((c) => perKind.get(`${kind}\0${c}`)).find((c) => c !== void 0);
27610
+ if (hit !== void 0) out.add(hit);
27611
+ }
27612
+ }
27613
+ return out;
27614
+ }
27324
27615
  function asCeilingSet(allowed) {
27325
27616
  if (allowed === null) return null;
27326
27617
  if (allowed instanceof Set) return allowed;
@@ -27345,6 +27636,7 @@ function ceilingCoverage(scope, allowed) {
27345
27636
  let out;
27346
27637
  if (!facts.isLive(code)) out = false;
27347
27638
  else if (set === null) out = true;
27639
+ else if (facts.underFloor(code)) out = set.has(code);
27348
27640
  else if (scope.ancestorsOf(code).some((c) => set.has(c))) out = true;
27349
27641
  else if (facts.hasOwnContent(code)) out = false;
27350
27642
  else {
@@ -27442,6 +27734,10 @@ function maskSelectionToCeiling(scope, selection, allowed) {
27442
27734
  for (const child of scope.childrenOf(code)) if (!sel.includes(child)) sel.push(child);
27443
27735
  }
27444
27736
  for (const code of outside) sel = subtractRow(scope, sel, code);
27737
+ if (asCeilingSet(allowed) !== null) {
27738
+ const within = ceilingCoverage(scope, allowed);
27739
+ sel = sel.filter((c) => !facts.underFloor(c) || within(c));
27740
+ }
27445
27741
  return withSystemInfo(sel.filter((c) => facts.isLive(c)));
27446
27742
  }
27447
27743
  function isPermittedByCeiling(scope, ceiling, code) {
@@ -27513,7 +27809,7 @@ var SHARE_LEVEL_LABEL = Object.freeze({
27513
27809
  platform_starter: "Platform default",
27514
27810
  inside_starter: "the platform's default for sharing inside your account"
27515
27811
  });
27516
- var own3 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
27812
+ var own4 = (record, key) => record !== null && typeof record === "object" && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : void 0;
27517
27813
  var isStringList2 = (v) => Array.isArray(v) && v.every((c) => typeof c === "string");
27518
27814
  var versionOf = (v) => {
27519
27815
  const n = typeof v === "number" ? v : parseInt(String(v), 10);
@@ -27609,7 +27905,7 @@ function derivePlatformDefault(scope, purpose, seedList, options = {}) {
27609
27905
  else if (req.has(g)) state = "always";
27610
27906
  else if (scope.row(g)?.shareableDefault === false) state = "never";
27611
27907
  else state = scopeListCovers(scope, seed, g) ? "default_on" : "default_off";
27612
- const bound = own3(options.bounds, g);
27908
+ const bound = own4(options.bounds, g);
27613
27909
  if (g !== systemCode && (bound === "always" || bound === "default_on" || bound === "default_off" || bound === "never"))
27614
27910
  state = bound;
27615
27911
  states[g] = state;
@@ -27703,10 +27999,10 @@ var HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE = Object.freeze({
27703
27999
  });
27704
28000
  function platformDefaultFor(scope, purpose, options = {}) {
27705
28001
  const starter = options.starter ?? HTI_SHARE_PLATFORM_STARTER;
27706
- const seed = own3(starter.scopeByPurpose, purpose);
28002
+ const seed = own4(starter.scopeByPurpose, purpose);
27707
28003
  if (!isStringList2(seed)) return null;
27708
28004
  return derivePlatformDefault(scope, purpose, seed, {
27709
- required: own3(HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE, purpose) ?? [],
28005
+ required: own4(HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE, purpose) ?? [],
27710
28006
  bounds: options.bounds ?? null,
27711
28007
  version: options.version ?? 1,
27712
28008
  edited: options.edited === true
@@ -27716,14 +28012,15 @@ function shareRowCeiling(resolution, scope) {
27716
28012
  if (!resolution.allowed) return [];
27717
28013
  const out = [];
27718
28014
  for (const g of resolution.allowedCategories) {
27719
- const e = own3(resolution.scope, g);
28015
+ const e = own4(resolution.scope, g);
27720
28016
  if (e === void 0) continue;
27721
28017
  const withheld = /* @__PURE__ */ new Set([
27722
28018
  ...e.excludedItems,
27723
28019
  ...e.teamExcludedItems,
27724
28020
  ...e.floorItems
27725
28021
  ]);
27726
- if (withheld.size === 0) {
28022
+ const onlyFloorWithheld = [...withheld].every((r) => e.floorItems.includes(r));
28023
+ if (withheld.size === 0 || onlyFloorWithheld && hasOwnScopeContent(scope, g)) {
27727
28024
  out.push(g);
27728
28025
  continue;
27729
28026
  }
@@ -27804,13 +28101,13 @@ function resolveShare(input) {
27804
28101
  rulePath: `sharingPurposePolicies[${p.id}] v${v} (policy \u201C${name}\u201D \u2014 ${SHARE_LEVEL_LABEL[level2]})`
27805
28102
  };
27806
28103
  };
27807
- const cell = (map, key) => own3(own3(map, key), purpose);
28104
+ const cell = (map, key) => own4(own4(map, key), purpose);
27808
28105
  let gov = null;
27809
28106
  const purposeKnown = pd !== null;
27810
28107
  const teamRowId = purposeKnown && teamId !== null && recipient.kind !== "external" && typeof input.teamRowId === "string" && input.teamRowId !== "" ? input.teamRowId : null;
27811
28108
  if (teamRowId !== null) gov = hit(cell(att.teamRows, teamRowId), "team_row");
27812
28109
  if (gov === null && inside && purposeKnown) {
27813
- gov = hit(own3(att.internalDefaults, purpose), "account_internal");
28110
+ gov = hit(own4(att.internalDefaults, purpose), "account_internal");
27814
28111
  if (gov === null && pd !== null) {
27815
28112
  const starter = {
27816
28113
  id: `pol-inside-starter-${purpose}`,
@@ -27855,7 +28152,7 @@ function resolveShare(input) {
27855
28152
  };
27856
28153
  }
27857
28154
  if (gov === null)
27858
- gov = hit(own3(att.agencyDefaults, purpose), "agency_default");
28155
+ gov = hit(own4(att.agencyDefaults, purpose), "agency_default");
27859
28156
  if (gov === null && pd !== null) {
27860
28157
  const starter = {
27861
28158
  id: `pol-starter-${purpose}`,
@@ -28074,7 +28371,7 @@ function resolveShare(input) {
28074
28371
  "Outside the payload for this purpose"
28075
28372
  );
28076
28373
  }
28077
- const govRows = polScopeBinds ? own3(govItems, g) : void 0;
28374
+ const govRows = polScopeBinds ? own4(govItems, g) : void 0;
28078
28375
  if (allowed && !req && isStringList2(govRows)) {
28079
28376
  const keep = new Set(govRows);
28080
28377
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -28083,7 +28380,7 @@ function resolveShare(input) {
28083
28380
  `Outside what the \u201C${govName}\u201D policy allows for this purpose`
28084
28381
  );
28085
28382
  }
28086
- const defRows = defaultItems === null ? void 0 : own3(defaultItems.rows, g);
28383
+ const defRows = defaultItems === null ? void 0 : own4(defaultItems.rows, g);
28087
28384
  if (allowed && !req && isStringList2(defRows)) {
28088
28385
  const keep = new Set(defRows);
28089
28386
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -28104,7 +28401,7 @@ function resolveShare(input) {
28104
28401
  for (const r of outside((x) => scopeListCovers(scope, tcScope, g, x)))
28105
28402
  outRows.add(r);
28106
28403
  }
28107
- const tcRows = own3(tcItems, g);
28404
+ const tcRows = own4(tcItems, g);
28108
28405
  if (isStringList2(tcRows)) {
28109
28406
  const keep = new Set(tcRows);
28110
28407
  const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
@@ -28115,7 +28412,8 @@ function resolveShare(input) {
28115
28412
  teamExcludedItems.push(r);
28116
28413
  if (teamExcludedItems.length > 0) teamExcludedReason = why;
28117
28414
  }
28118
- if (allowed && (!req || platformRequired !== null) && leaves.length > 0) {
28415
+ const floorOnlyOwnContent = leaves.length > 0 && leaves.every((r) => floorItems.includes(r)) && hasOwnScopeContent(scope, g);
28416
+ if (allowed && (!req || platformRequired !== null) && leaves.length > 0 && !floorOnlyOwnContent) {
28119
28417
  const gone = new Set(
28120
28418
  [...floorItems, ...excludedItems, ...teamExcludedItems].filter(
28121
28419
  (r) => leaves.includes(r)
@@ -76148,10 +76446,15 @@ export {
76148
76446
  INCIDENT_PARTICIPATION_ROLE_LABELS,
76149
76447
  INCIDENT_PARTICIPATION_ROLE_SUPERSEDED_BY,
76150
76448
  INCIDENT_PARTICIPATION_ROLE_VALUES,
76449
+ INFORMATION_SCOPE_CATEGORY_ORDER,
76450
+ INFORMATION_SCOPE_CATEGORY_SUB,
76151
76451
  INFORMATION_SCOPE_FIELD_HOME_ROWS,
76152
76452
  INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE,
76153
76453
  INFORMATION_SCOPE_READABLE_VERSIONS,
76454
+ INFORMATION_SCOPE_ROW_HINT,
76455
+ INFORMATION_SCOPE_ROW_ORDER,
76154
76456
  INFORMATION_SCOPE_SYSTEM_INFO,
76457
+ INFORMATION_SCOPE_UI_COPY_SOURCE,
76155
76458
  INFORMATION_SCOPE_VERSION,
76156
76459
  INTERACTION_TYPES,
76157
76460
  INTERACTION_TYPE_LABELS,
@@ -76755,9 +77058,12 @@ export {
76755
77058
  rowsOutsideCeiling,
76756
77059
  rowsOverCeiling,
76757
77060
  rsvpResponse_v1_0_0_default as rsvpResponseSot,
77061
+ scopeCategorySub,
76758
77062
  scopeListCovers,
76759
77063
  scopeListStrictlyCovers,
76760
77064
  scopeMigrationsFromSot,
77065
+ scopeRowDisplayOrder,
77066
+ scopeRowHint,
76761
77067
  scopeRowWithinCeiling,
76762
77068
  scopeRowsFromSot,
76763
77069
  scoringConditionSchema,
@@ -76814,6 +77120,8 @@ export {
76814
77120
  smtSignificanceFlags_v1_0_0_default as smtSignificanceFlagsSot,
76815
77121
  smtType_v1_0_0_default as smtTypeSot,
76816
77122
  sortRelationshipsByPriority,
77123
+ sortScopeCategories,
77124
+ sortScopeRows,
76817
77125
  sourceCategory_v1_1_0_default as sourceCategorySot,
76818
77126
  sourceInstrument_v1_1_0_default as sourceInstrumentSot,
76819
77127
  sourceSubtype_v1_2_0_default as sourceSubtypeSot,