eyecite-ts 0.13.2 → 0.13.4
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/annotate/index.d.cts +1 -1
- package/dist/annotate/index.d.mts +1 -1
- package/dist/{citation-BaRqFZnV.d.cts → citation-CxwyZdtS.d.mts} +17 -4
- package/dist/citation-CxwyZdtS.d.mts.map +1 -0
- package/dist/{citation-CVm_rp15.d.mts → citation-dDdIyQC7.d.cts} +17 -4
- package/dist/citation-dDdIyQC7.d.cts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{types-BgmSZol5.d.cts → types-CP716G3l.d.mts} +2 -2
- package/dist/{types-BgmSZol5.d.cts.map → types-CP716G3l.d.mts.map} +1 -1
- package/dist/{types-DQzZmylJ.d.mts → types-zNmSR99E.d.cts} +2 -2
- package/dist/{types-DQzZmylJ.d.mts.map → types-zNmSR99E.d.cts.map} +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/package.json +1 -1
- package/dist/citation-BaRqFZnV.d.cts.map +0 -1
- package/dist/citation-CVm_rp15.d.mts.map +0 -1
|
@@ -281,9 +281,11 @@ interface Warning {
|
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Introductory signal word classification for citation support level.
|
|
284
|
-
* Based on Bluebook signal categories (Rule 1.2).
|
|
284
|
+
* Based on Bluebook signal categories (Rule 1.2). The `, e.g.` combined
|
|
285
|
+
* forms (Rule 1.3) carry distinct meaning ("one of many illustrative
|
|
286
|
+
* authorities") and are tracked separately from the bare signals.
|
|
285
287
|
*/
|
|
286
|
-
type CitationSignal = "see" | "see also" | "see generally" | "cf" | "but see" | "but cf" | "compare" | "accord" | "contra";
|
|
288
|
+
type CitationSignal = "see" | "see also" | "see generally" | "cf" | "but see" | "but cf" | "compare" | "accord" | "contra" | "e.g." | "see, e.g." | "see also, e.g." | "but see, e.g." | "cf., e.g." | "but cf., e.g.";
|
|
287
289
|
/**
|
|
288
290
|
* Base fields shared by all citation types.
|
|
289
291
|
*/
|
|
@@ -360,8 +362,13 @@ interface Parenthetical {
|
|
|
360
362
|
/**
|
|
361
363
|
* Normalized subsequent history signal classification.
|
|
362
364
|
* Maps variant spellings (aff'd, affirmed) to canonical forms.
|
|
365
|
+
*
|
|
366
|
+
* Texas Greenbook writ/petition history forms (placed inside the court-and-year
|
|
367
|
+
* parenthetical, per Tex. R. App. P. 47.7) are tracked with their own categories
|
|
368
|
+
* so downstream consumers can distinguish them from federal-style subsequent
|
|
369
|
+
* history. See #229.
|
|
363
370
|
*/
|
|
364
|
-
type HistorySignal = "affirmed" | "reversed" | "cert_denied" | "cert_granted" | "overruled" | "vacated" | "remanded" | "modified" | "abrogated" | "superseded" | "disapproved" | "questioned" | "distinguished" | "withdrawn" | "reinstated";
|
|
371
|
+
type HistorySignal = "affirmed" | "reversed" | "cert_denied" | "cert_granted" | "overruled" | "vacated" | "remanded" | "modified" | "abrogated" | "superseded" | "disapproved" | "questioned" | "distinguished" | "withdrawn" | "reinstated" | "writ_refused" | "writ_dismissed" | "writ_denied" | "writ_granted" | "no_writ" | "pet_refused" | "pet_denied" | "pet_dismissed" | "pet_granted" | "pet_filed" | "no_pet" | "review_denied" | "review_granted" | "opinion_vacated" | "disapproved_other_grounds";
|
|
365
372
|
/**
|
|
366
373
|
* A single subsequent history entry from a case citation.
|
|
367
374
|
*
|
|
@@ -609,6 +616,12 @@ interface NeutralCitation extends CitationBase {
|
|
|
609
616
|
court: string;
|
|
610
617
|
/** Document number */
|
|
611
618
|
documentNumber: string;
|
|
619
|
+
/**
|
|
620
|
+
* True when the citation has an Illinois Rule 23 `-U` suffix (or analogous
|
|
621
|
+
* unpublished marker). The suffix is consumed and stripped from
|
|
622
|
+
* `documentNumber`. Absent or `false` for published decisions. (#230)
|
|
623
|
+
*/
|
|
624
|
+
unpublished?: boolean;
|
|
612
625
|
/** Pincite page (numeric portion, without "*" for star-pagination). */
|
|
613
626
|
pincite?: number;
|
|
614
627
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
@@ -837,4 +850,4 @@ type CitationOfType<T extends CitationType> = Extract<Citation, {
|
|
|
837
850
|
type ExtractorMap = { [K in FullCitationType]: CitationOfType<K> };
|
|
838
851
|
//#endregion
|
|
839
852
|
export { ConstitutionalComponentSpans as A, PinciteInfo as B, ShortFormCitationType as C, SupraCitation as D, SubsequentHistoryEntry as E, StatuteComponentSpans as F, StatutesAtLargeComponentSpans as I, Span as L, JournalComponentSpans as M, NeutralComponentSpans as N, Warning as O, PublicLawComponentSpans as P, TransformationMap as R, ShortFormCitation as S, StatutesAtLargeCitation as T, parsePincite as V, NeutralCitation as _, CitationType as a, PublicLawCitation as b, DocketCitation as c, FullCaseCitation as d, FullCitation as f, JournalCitation as g, IdCitation as h, CitationSignal as i, FederalRegisterComponentSpans as j, CaseComponentSpans as k, ExtractorMap as l, HistorySignal as m, CitationBase as n, ConstitutionalCitation as o, FullCitationType as p, CitationOfType as r, CourtInference as s, Citation as t, FederalRegisterCitation as u, Parenthetical as v, StatuteCitation as w, ShortFormCaseCitation as x, ParentheticalType as y, spanFromGroupIndex as z };
|
|
840
|
-
//# sourceMappingURL=citation-
|
|
853
|
+
//# sourceMappingURL=citation-CxwyZdtS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-CxwyZdtS.d.mts","names":[],"sources":["../src/extract/pincite.ts","../src/clean/segmentMap.ts","../src/types/span.ts","../src/types/componentSpans.ts","../src/types/citation.ts"],"mappings":"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"}
|
|
@@ -281,9 +281,11 @@ interface Warning {
|
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Introductory signal word classification for citation support level.
|
|
284
|
-
* Based on Bluebook signal categories (Rule 1.2).
|
|
284
|
+
* Based on Bluebook signal categories (Rule 1.2). The `, e.g.` combined
|
|
285
|
+
* forms (Rule 1.3) carry distinct meaning ("one of many illustrative
|
|
286
|
+
* authorities") and are tracked separately from the bare signals.
|
|
285
287
|
*/
|
|
286
|
-
type CitationSignal = "see" | "see also" | "see generally" | "cf" | "but see" | "but cf" | "compare" | "accord" | "contra";
|
|
288
|
+
type CitationSignal = "see" | "see also" | "see generally" | "cf" | "but see" | "but cf" | "compare" | "accord" | "contra" | "e.g." | "see, e.g." | "see also, e.g." | "but see, e.g." | "cf., e.g." | "but cf., e.g.";
|
|
287
289
|
/**
|
|
288
290
|
* Base fields shared by all citation types.
|
|
289
291
|
*/
|
|
@@ -360,8 +362,13 @@ interface Parenthetical {
|
|
|
360
362
|
/**
|
|
361
363
|
* Normalized subsequent history signal classification.
|
|
362
364
|
* Maps variant spellings (aff'd, affirmed) to canonical forms.
|
|
365
|
+
*
|
|
366
|
+
* Texas Greenbook writ/petition history forms (placed inside the court-and-year
|
|
367
|
+
* parenthetical, per Tex. R. App. P. 47.7) are tracked with their own categories
|
|
368
|
+
* so downstream consumers can distinguish them from federal-style subsequent
|
|
369
|
+
* history. See #229.
|
|
363
370
|
*/
|
|
364
|
-
type HistorySignal = "affirmed" | "reversed" | "cert_denied" | "cert_granted" | "overruled" | "vacated" | "remanded" | "modified" | "abrogated" | "superseded" | "disapproved" | "questioned" | "distinguished" | "withdrawn" | "reinstated";
|
|
371
|
+
type HistorySignal = "affirmed" | "reversed" | "cert_denied" | "cert_granted" | "overruled" | "vacated" | "remanded" | "modified" | "abrogated" | "superseded" | "disapproved" | "questioned" | "distinguished" | "withdrawn" | "reinstated" | "writ_refused" | "writ_dismissed" | "writ_denied" | "writ_granted" | "no_writ" | "pet_refused" | "pet_denied" | "pet_dismissed" | "pet_granted" | "pet_filed" | "no_pet" | "review_denied" | "review_granted" | "opinion_vacated" | "disapproved_other_grounds";
|
|
365
372
|
/**
|
|
366
373
|
* A single subsequent history entry from a case citation.
|
|
367
374
|
*
|
|
@@ -609,6 +616,12 @@ interface NeutralCitation extends CitationBase {
|
|
|
609
616
|
court: string;
|
|
610
617
|
/** Document number */
|
|
611
618
|
documentNumber: string;
|
|
619
|
+
/**
|
|
620
|
+
* True when the citation has an Illinois Rule 23 `-U` suffix (or analogous
|
|
621
|
+
* unpublished marker). The suffix is consumed and stripped from
|
|
622
|
+
* `documentNumber`. Absent or `false` for published decisions. (#230)
|
|
623
|
+
*/
|
|
624
|
+
unpublished?: boolean;
|
|
612
625
|
/** Pincite page (numeric portion, without "*" for star-pagination). */
|
|
613
626
|
pincite?: number;
|
|
614
627
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
@@ -837,4 +850,4 @@ type CitationOfType<T extends CitationType> = Extract<Citation, {
|
|
|
837
850
|
type ExtractorMap = { [K in FullCitationType]: CitationOfType<K> };
|
|
838
851
|
//#endregion
|
|
839
852
|
export { ConstitutionalComponentSpans as A, PinciteInfo as B, ShortFormCitationType as C, SupraCitation as D, SubsequentHistoryEntry as E, StatuteComponentSpans as F, StatutesAtLargeComponentSpans as I, Span as L, JournalComponentSpans as M, NeutralComponentSpans as N, Warning as O, PublicLawComponentSpans as P, TransformationMap as R, ShortFormCitation as S, StatutesAtLargeCitation as T, parsePincite as V, NeutralCitation as _, CitationType as a, PublicLawCitation as b, DocketCitation as c, FullCaseCitation as d, FullCitation as f, JournalCitation as g, IdCitation as h, CitationSignal as i, FederalRegisterComponentSpans as j, CaseComponentSpans as k, ExtractorMap as l, HistorySignal as m, CitationBase as n, ConstitutionalCitation as o, FullCitationType as p, CitationOfType as r, CourtInference as s, Citation as t, FederalRegisterCitation as u, Parenthetical as v, StatuteCitation as w, ShortFormCaseCitation as x, ParentheticalType as y, spanFromGroupIndex as z };
|
|
840
|
-
//# sourceMappingURL=citation-
|
|
853
|
+
//# sourceMappingURL=citation-dDdIyQC7.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-dDdIyQC7.d.cts","names":[],"sources":["../src/extract/pincite.ts","../src/clean/segmentMap.ts","../src/types/span.ts","../src/types/componentSpans.ts","../src/types/citation.ts"],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./knownCodes-D_EXxDqq.cjs`);function t(e){return e.type===`case`||e.type===`docket`||e.type===`statute`||e.type===`journal`||e.type===`neutral`||e.type===`publicLaw`||e.type===`federalRegister`||e.type===`statutesAtLarge`||e.type===`constitutional`}function n(e){return e.type===`id`||e.type===`supra`||e.type===`shortFormCase`}function r(e){return e.type===`case`}function i(e,t){return e.type===t}function a(e){throw Error(`Unexpected value: ${e}`)}function o(e,t,n){let r=e+t[0],i=e+t[1],{originalStart:a,originalEnd:o}=s({cleanStart:r,cleanEnd:i},n);return{cleanStart:r,cleanEnd:i,originalStart:a,originalEnd:o}}function s(e,t){return t.cleanToOriginalSegments?{originalStart:t.cleanToOriginalSegments.lookup(e.cleanStart),originalEnd:t.cleanToOriginalSegments.lookup(e.cleanEnd)}:{originalStart:t.cleanToOriginal.get(e.cleanStart)??e.cleanStart,originalEnd:t.cleanToOriginal.get(e.cleanEnd)??e.cleanEnd}}function c(e){return e.replace(/<[^>]+>/g,``)}function l(e){return e.replace(/(\w)-\s*[\n\r]+\s*(\w)/g,`$1$2`)}function u(e){return e.replace(/[\t\n\r\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,` `)}function d(e){return e.replace(/ {2,}/g,` `)}function f(e){return e.normalize(`NFKC`)}function p(e){return e.replace(/[\u201C\u201D]/g,`"`).replace(/[\u2018\u2019]/g,`'`)}function m(e){return e.replace(/[\u2014\u2015]/g,`---`).replace(/[\u2010\u2012\u2013]/g,`-`)}function h(e){return e.replace(/§/gi,`§`).replace(/¶/gi,`¶`).replace(/&/gi,`&`).replace(/ /gi,` `).replace(/</gi,`<`).replace(/>/gi,`>`).replace(/"/gi,`"`).replace(/'/gi,`'`).replace(/&#(\d+);/g,(e,t)=>{let n=Number.parseInt(t,10);return Number.isNaN(n)?e:String.fromCharCode(n)}).replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isNaN(n)?e:String.fromCharCode(n)})}function g(e){let t=e;return t=t.replace(/\bU\.\s+S\./g,`U.S.`),t=t.replace(/\bS\.\s+Ct\./g,`S.Ct.`),t=t.replace(/\bL\.\s+Ed\./g,`L.Ed.`),t=t.replace(/\bF\.\s+Supp\./g,`F.Supp.`),t=t.replace(/\bF\.\s+(\d+[a-z]+)/g,`F.$1`),t=t.replace(/([A-Za-z])\.\s+(\d+[a-z]+)/g,`$1.$2`),t}function _(e){return e.replace(/[\u2032\u2035]/g,`'`).replace(/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,``)}var v=class e{segments;constructor(e){this.segments=e}static identity(t){return new e([{cleanPos:0,origPos:0,len:t+1}])}static fromMap(t){if(t.size===0)return new e([]);let n=[...t.entries()].sort((e,t)=>e[0]-t[0]),r=[],i=n[0][0],a=n[0][1],o=1;for(let e=1;e<n.length;e++){let[t,s]=n[e],c=i+o,l=a+o;t===c&&s===l?o++:(r.push({cleanPos:i,origPos:a,len:o}),i=t,a=s,o=1)}return r.push({cleanPos:i,origPos:a,len:o}),new e(r)}lookup(e){let t=this.segments;if(t.length===0)return e;let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>>1,a=t[i];if(e<a.cleanPos)r=i-1;else if(e>=a.cleanPos+a.len)n=i+1;else return a.origPos+(e-a.cleanPos)}let i=t[t.length-1];return i.origPos+(e-i.cleanPos)}};function y(e,t=[c,h,l,u,d,f,m,p,_,g]){let n=e,r=new Map,i=new Map;for(let t=0;t<=e.length;t++)r.set(t,t),i.set(t,t);for(let e of t){let t=n,a=e(n);if(t!==a){let{newCleanToOriginal:e,newOriginalToClean:o}=b(t,a,r,i);r=e,i=o,n=a}}let a={cleanToOriginal:r,originalToClean:i,cleanToOriginalSegments:v.fromMap(r)};return{cleaned:n,transformationMap:a,warnings:[]}}function b(e,t,n,r){let i=new Map,a=new Map,o=0,s=0;for(;o<=e.length||s<=t.length;){if(o>=e.length&&s>=t.length){let e=n.get(o)??o;i.set(s,e),a.set(e,s);break}if(o>=e.length){let e=n.get(o)??o;i.set(s,e),s++;continue}if(s>=t.length){let e=n.get(o)??o;a.set(e,s),o++;continue}if(e[o]===t[s]){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++}else{if(e.length-o===t.length-s){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++;continue}let r=!1,c=Math.max(40,Math.abs(e.length-t.length)+10),l=-1,u=-1;for(let n=1;n<=c;n++){if(l<0&&o+n<e.length&&e[o+n]===t[s]){let r=!0;for(let i=1;i<3;i++){let a=o+n+i,c=s+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(l=n)}if(u<0&&s+n<t.length&&e[o]===t[s+n]){let r=!0;for(let i=1;i<3;i++){let a=o+i,c=s+n+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(u=n)}if(l>=0&&u>=0)break}if(l>=0&&(u<0||l<=u)){for(let e=0;e<l;e++){let t=n.get(o+e)??o+e;a.set(t,s)}o+=l,r=!0}else if(u>=0){let e=n.get(o)??o;for(let t=0;t<u;t++)i.set(s+t,e);s+=u,r=!0}if(r)continue;let d=n.get(o)??o;i.set(s,d),a.set(d,s),o++,s++}}return{newCleanToOriginal:i,newOriginalToClean:a}}var x=class{parent;rank;constructor(e){this.parent=Array.from({length:e},(e,t)=>t),this.rank=Array(e).fill(0)}find(e){let t=e;for(;this.parent[t]!==t;)this.parent[t]=this.parent[this.parent[t]],t=this.parent[t];return t}union(e,t){let n=this.find(e),r=this.find(t);if(n!==r){if(n>r){let e=n;n=r,r=e}this.parent[r]=n,this.rank[n]===this.rank[r]&&this.rank[n]++}}connected(e,t){return this.find(e)===this.find(t)}components(){let e=new Map;for(let t=0;t<this.parent.length;t++){let n=this.find(t),r=e.get(n);r||(r=[],e.set(n,r)),r.push(t)}return e}};function S(e,t,n){let r=/\blabel\s*=\s*["'](\d+)["']/.exec(e);if(r)return Number.parseInt(r[1],10);let i=/\bid\s*=\s*["'](?:fn|footnote)(\d+)["']/.exec(e);if(i)return Number.parseInt(i[1],10);let a=t.replace(/<[^>]*>/g,``),o=/^\s*(\d+)[.\s):]/.exec(a);return o?Number.parseInt(o[1],10):n+1}function C(e,t,n){let r=RegExp(`<${t}\\b[^>]*>`,`gi`),i=RegExp(`</${t}\\s*>`,`gi`);r.lastIndex=n,i.lastIndex=n;let a=1;for(;a>0;){let t=r.exec(e),n=i.exec(e);if(!n)return null;if(t&&t.index<n.index)a++,i.lastIndex=t.index+t[0].length;else{if(a--,a===0)return{contentEnd:n.index,tagEnd:n.index+n[0].length};r.lastIndex=n.index+n[0].length}}return null}function w(e){let t=[],n,r=RegExp(`<(footnote|fn)\\b[^>]*>|<(div|aside|section|p|span)\\b[^>]*(?:class\\s*=\\s*["'][^"']*\\bfootnote\\b[^"']*["']|id\\s*=\\s*["'](?:fn|footnote)\\d*["'])[^>]*>`,`gi`);for(;(n=r.exec(e))!==null;){let i=n[0],a=n.index+i.length,o=C(e,n[1]||n[2],a);if(!o)continue;let s=S(i,e.slice(a,o.contentEnd),t.length);t.push({start:a,end:o.contentEnd,footnoteNumber:s}),r.lastIndex=o.tagEnd}return t.sort((e,t)=>e.start-t.start)}const T=/^\s*[-_]{5,}\s*$/m;function E(e){let t=T.exec(e);if(!t)return[];let n=t.index+t[0].length,r=e.slice(n),i=RegExp(`^\\s*(?:FN\\s*(\\d+)[.\\s:)]|\\[(\\d+)\\]\\s|n\\.\\s*(\\d+)\\s|(\\d+)\\.\\s)`,`gm`),a=[],o;for(;(o=i.exec(r))!==null;){let e=o[1]||o[2]||o[3]||o[4];e&&a.push({index:o.index+n,footnoteNumber:Number.parseInt(e,10)})}if(a.length===0)return[];let s=[];for(let t=0;t<a.length;t++){let n=a[t].index,r=t+1<a.length?a[t+1].index:e.length;s.push({start:n,end:r,footnoteNumber:a[t].footnoteNumber})}return s}const D=/<[^>]+>/;function O(e){if(D.test(e)){let t=w(e);if(t.length>0)return t}return E(e)}function k(e,t,n,r=20){for(let i=1;i<=r;i++){let r=n===`forward`?e+i:e-i,a=t.get(r);if(a!==void 0)return a}}function A(e,t){return e.length===0?[]:e.map(e=>({start:t.originalToClean.get(e.start)??k(e.start,t.originalToClean,`forward`)??e.start,end:t.originalToClean.get(e.end)??k(e.end,t.originalToClean,`backward`)??e.end,footnoteNumber:e.footnoteNumber}))}function j(e,t){if(t.length!==0)for(let n of e){let e=n.span.cleanStart,r=0,i=t.length-1;for(;r<=i;){let a=r+i>>>1,o=t[a];if(e<o.start)i=a-1;else if(e>=o.end)r=a+1;else{n.inFootnote=!0,n.footnoteNumber=o.footnoteNumber;break}}}}const M={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function N(e){let t=M[e.toLowerCase().replace(/\.$/,``)];if(t===void 0)throw Error(`Invalid month name: ${e}`);return t}function P(e){let{year:t,month:n,day:r}=e;return n!==void 0&&r!==void 0?`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`:n===void 0?String(t):`${t}-${String(n).padStart(2,`0`)}`}function F(e){let t=e.match(/\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)\.?\s+(\d{1,2}),?\s+(\d{4})\b/i);if(t){let e=N(t[1]),n=Number.parseInt(t[2],10),r={year:Number.parseInt(t[3],10),month:e,day:n};return{iso:P(r),parsed:r}}let n=e.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i);if(n){let e=N(n[1]),t=Number.parseInt(n[2],10),r={year:Number.parseInt(n[3],10),month:e,day:t};return{iso:P(r),parsed:r}}let r=e.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10),n={year:Number.parseInt(r[3],10),month:e,day:t};return{iso:P(n),parsed:n}}let i=e.match(/\b(\d{4})\b/);if(i){let e={year:Number.parseInt(i[1],10)};return{iso:P(e),parsed:e}}}function I(e){return{level:e,jurisdiction:`federal`,confidence:1}}function L(e,t){return{level:e,jurisdiction:`state`,state:t,confidence:1}}function R(e){return{level:e,jurisdiction:`state`,confidence:.7}}const z=new Map([[`U.S.`,I(`supreme`)],[`S.Ct.`,I(`supreme`)],[`L.Ed.`,I(`supreme`)],[`L.Ed.2d`,I(`supreme`)],[`S. Ct.`,I(`supreme`)],[`L. Ed.`,I(`supreme`)],[`L. Ed. 2d`,I(`supreme`)],[`U. S.`,I(`supreme`)],[`L.Ed. 2d`,I(`supreme`)],[`L. Ed.2d`,I(`supreme`)],[`F.`,I(`appellate`)],[`F.2d`,I(`appellate`)],[`F.3d`,I(`appellate`)],[`F.4th`,I(`appellate`)],[`F. App'x`,I(`appellate`)],[`F.Supp.`,I(`trial`)],[`F.Supp.2d`,I(`trial`)],[`F.Supp.3d`,I(`trial`)],[`F.Supp.4th`,I(`trial`)],[`F. Supp.`,I(`trial`)],[`F. Supp. 2d`,I(`trial`)],[`F. Supp. 3d`,I(`trial`)],[`F. Supp. 4th`,I(`trial`)],[`F.R.D.`,I(`trial`)],[`B.R.`,I(`trial`)],[`Cal.`,L(`supreme`,`CA`)],[`Cal.2d`,L(`supreme`,`CA`)],[`Cal.3d`,L(`supreme`,`CA`)],[`Cal.4th`,L(`supreme`,`CA`)],[`Cal.5th`,L(`supreme`,`CA`)],[`Cal.App.`,L(`appellate`,`CA`)],[`Cal.App.2d`,L(`appellate`,`CA`)],[`Cal.App.3d`,L(`appellate`,`CA`)],[`Cal.App.4th`,L(`appellate`,`CA`)],[`Cal.App.5th`,L(`appellate`,`CA`)],[`Cal.Rptr.`,L(`unknown`,`CA`)],[`Cal.Rptr.2d`,L(`unknown`,`CA`)],[`Cal.Rptr.3d`,L(`unknown`,`CA`)],[`N.Y.`,L(`supreme`,`NY`)],[`N.Y.2d`,L(`supreme`,`NY`)],[`N.Y.3d`,L(`supreme`,`NY`)],[`A.D.`,L(`appellate`,`NY`)],[`A.D.2d`,L(`appellate`,`NY`)],[`A.D.3d`,L(`appellate`,`NY`)],[`Misc.`,L(`trial`,`NY`)],[`Misc.2d`,L(`trial`,`NY`)],[`Misc.3d`,L(`trial`,`NY`)],[`N.Y.S.`,L(`unknown`,`NY`)],[`N.Y.S.2d`,L(`unknown`,`NY`)],[`N.Y.S.3d`,L(`unknown`,`NY`)],[`Ill.`,L(`supreme`,`IL`)],[`Ill.2d`,L(`supreme`,`IL`)],[`Ill.App.`,L(`appellate`,`IL`)],[`Ill.App.2d`,L(`appellate`,`IL`)],[`Ill.App.3d`,L(`appellate`,`IL`)],[`Ill.Dec.`,L(`unknown`,`IL`)],[`Ohio St.`,L(`supreme`,`OH`)],[`Ohio St.2d`,L(`supreme`,`OH`)],[`Ohio St.3d`,L(`supreme`,`OH`)],[`Ohio App.3d`,L(`appellate`,`OH`)],[`Pa.`,L(`supreme`,`PA`)],[`Pa. Super.`,L(`appellate`,`PA`)],[`Tex.`,L(`supreme`,`TX`)],[`Fla.`,L(`supreme`,`FL`)],[`Mass.`,L(`supreme`,`MA`)],[`Mass. App. Ct.`,L(`appellate`,`MA`)],[`A.`,R(`unknown`)],[`A.2d`,R(`unknown`)],[`A.3d`,R(`unknown`)],[`S.E.`,R(`unknown`)],[`S.E.2d`,R(`unknown`)],[`S.E.3d`,R(`unknown`)],[`S.W.`,R(`unknown`)],[`S.W.2d`,R(`unknown`)],[`S.W.3d`,R(`unknown`)],[`N.E.`,R(`unknown`)],[`N.E.2d`,R(`unknown`)],[`N.E.3d`,R(`unknown`)],[`N.W.`,R(`unknown`)],[`N.W.2d`,R(`unknown`)],[`N.W.3d`,R(`unknown`)],[`So.`,R(`unknown`)],[`So.2d`,R(`unknown`)],[`So.3d`,R(`unknown`)],[`P.`,R(`unknown`)],[`P.2d`,R(`unknown`)],[`P.3d`,R(`unknown`)]]);function ee(e){return z.get(e)}const B=/^(?:at\s+)?(\*?)(\d+)(?:[-–—]\*?(\d+))?\s*(?:(?:nn?|note)\s*\.?\s*(\d+)(?:[-–—](\d+))?)?$/i;function V(e){let t=e.trim();if(!t)return null;let n=B.exec(t);if(!n)return null;let r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=Number.parseInt(i,10),l,u=!1;if(a){u=!0;let e=Number.parseInt(a,10);if(a.length<i.length){let e=i.slice(0,i.length-a.length);l=Number.parseInt(e+a,10)}else l=e}let d=o?Number.parseInt(o,10):void 0,f=s?Number.parseInt(s,10):void 0,p={page:c,isRange:u,raw:t};return l!==void 0&&(p.endPage=l),d!==void 0&&(p.footnote=d),f!==void 0&&(p.footnoteEnd=f),r===`*`&&(p.starPage=!0),p}function H(e){if(!e||!e.trim())return;let t=e.trim();return t=t.replace(/\.\s+(?=[A-Za-z])/g,`.`),/[A-Za-z]$/.test(t)&&(/\./.test(t)||/^\d+\w*\s+[A-Z]/i.test(t))&&(t+=`.`),t}const U=new Set([`see`,`see also`,`see generally`,`cf`,`but see`,`but cf`,`compare`,`accord`,`contra`]),W=(()=>{let e=[...U].sort((e,t)=>t.length-e.length).map(e=>e.replace(/\s+/g,`\\s+`).replace(/\./g,`\\.`));return RegExp(`^(${e.join(`|`)})\\s+`,`i`)})();function te(e){let t=Number.parseInt(e,10);return String(t)===e?t:e}const G=/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\.?/,ne=new Date().getFullYear(),re=new Set(`F.,F.2d,F.3d,F.4th,U.S.,S. Ct.,L. Ed.,L. Ed. 2d,P.,P.2d,P.3d,A.,A.2d,A.3d,N.E.,N.E.2d,N.E.3d,N.W.,N.W.2d,S.E.,S.E.2d,S.W.,S.W.2d,S.W.3d,So.,So. 2d,So. 3d,F. Supp.,F. Supp. 2d,F. Supp. 3d,F. Supp. 4th,F. App'x`.split(`,`)),ie=/^(\d+(?:-\d+)?)\s+([A-Za-z0-9.\s']+)\s+(?:\((\d+)\s+([A-Z][A-Za-z.]+)\)\s+)?(\d+|_{3,}|-{3,})/d,ae=/^[_-]{3,}$/,oe=/,\s*(?:at\s+)?(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,se=/\(([^)]+)\)/,ce=/^(?:,\s*(?:at\s+)?\*?\d+(?:-\d+)?)*(?:\s+(?:n|note)\s*\.?\s*\d+)?\s*\(([^)]+)\)/,le=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,K=/\d\.\s+/g,ue=/[\s,]/,q=/^(?:,\s*(?:at\s+)?\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:n|note)\s*\.?\s*\d+)?)+/,J=[[/^aff'?d\s+on\s+other\s+grounds\b/i,`affirmed`],[/^affirmed\s+on\s+other\s+grounds\b/i,`affirmed`],[/^aff'?d\b/i,`affirmed`],[/^affirmed\b/i,`affirmed`],[/^rev'?d\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\s+on\s+other\s+grounds\b/i,`reversed`],[/^reversed\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\b/i,`reversed`],[/^reversed\b/i,`reversed`],[/^certiorari\s+denied\b/i,`cert_denied`],[/^cert\.\s*den(ied|\.)(?=[\s,;(]|$)/i,`cert_denied`],[/^certiorari\s+granted\b/i,`cert_granted`],[/^cert\.\s*granted\b/i,`cert_granted`],[/^overruled\s+by\b/i,`overruled`],[/^overruled\s+in\b/i,`overruled`],[/^overruling\b/i,`overruled`],[/^overruled\b/i,`overruled`],[/^vacated\s+by\b/i,`vacated`],[/^vacated\b/i,`vacated`],[/^remanded\s+for\s+reconsideration\b/i,`remanded`],[/^remanded\b/i,`remanded`],[/^modified\s+by\b/i,`modified`],[/^modified\b/i,`modified`],[/^abrogated\s+by\b/i,`abrogated`],[/^abrogated\s+in\b/i,`abrogated`],[/^abrogated\b/i,`abrogated`],[/^superseded\s+by\b/i,`superseded`],[/^superseded\b/i,`superseded`],[/^disapproved\s+of\b/i,`disapproved`],[/^disapproved\b/i,`disapproved`],[/^questioned\s+by\b/i,`questioned`],[/^questioned\b/i,`questioned`],[/^distinguished\s+by\b/i,`distinguished`],[/^distinguished\b/i,`distinguished`],[/^withdrawn\b/i,`withdrawn`],[/^reinstated\b/i,`reinstated`]];function de(e){for(let[t,n]of J){let r=t.exec(e);if(r)return{signal:n,matchLength:r[0].length}}}const fe=new Set([`holding`,`finding`,`stating`,`noting`,`explaining`,`quoting`,`citing`,`discussing`,`describing`,`recognizing`,`applying`,`rejecting`,`adopting`,`requiring`]);function pe(e){return fe.has(e)}const me=/^([a-z]+)\b/i,he=/([A-Z][A-Za-z0-9\s.,'&()/-]+?)\s+v(?:s)?\.?\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/,ge=/\b(In\s+the\s+Matter\s+of|In re|Ex parte|Matter of|Estate of|State ex rel\.|United States ex rel\.|Application of|Petition of)\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/i,_e=new Set([`of`,`the`,`and`,`for`,`on`,`by`,`a`,`an`,`to`,`at`,`as`,`de`,`la`,`el`,`del`,`von`,`van`,`ex`,`rel`,`et`,`al`,`d`,`or`]),ve=/\b(?:d\/?b\/?a|a\/?k\/?a|f\/?k\/?a|n\/?k\/?a)\b/i;function Y(e){let t=e.split(/\s+/);for(let e of t){if(!e||e===`&`)continue;let t=e.toLowerCase().replace(/[.,']+$/,``);if(!_e.has(t)&&!/^[A-Z]/.test(e)&&!/^\d/.test(e))return!1}return!0}const ye=new Set([`this`,`that`,`these`,`those`,`here`,`there`,`such`,`its`,`his`,`her`,`their`,`our`]);function be(e){let t=e.replace(/\s*\d{1,2}\/\d{1,2}\/\d{4}\s*$/,``).trim();return t=t.replace(/\s*\d{4}\s*$/,``).trim(),t=t.replace(/\s*,?\s*\d{1,2}\s*,?\s*$/,``).trim(),t=t.replace(RegExp(`\\s*${G.source}\\s*$`,`i`),``).trim(),t=t.replace(/,\s*$/,``).trim(),t&&/[A-Za-z]/.test(t)?t:void 0}const xe=new Set(`acad.acct.accts.admin.adm.advert.advoc.aff.affs.afr.agric.all.alt.am.ann.app.arb.assoc.assocs.atl.auth.auto.ave.bankr.behav.bd.bor.brit.broad.bhd.bros.bldg.bull.bus.can.cap.cas.cath.ctr.ctrs.cent.chem.child.chron.coal.coll.com.comm.compar.comp.comput.condo.conf.cong.consol.const.constr.cont.coop.corp.corps.corr.cosm.couns.cntys.cnty.crim.def.delinq.det.dev.dig.dir.disc.disp.distrib.dist.div.econ.educ.elec.emp.eng.enter.ent.equal.equip.est.eur.exam.exch.exec.expl.exp.fac.fam.fams.fed.fid.fin.found.gen.glob.grp.guar.hist.hosp.hous.hum.immigr.imp.inc.indem.indep.indus.info.inj.inst.ins.intell.intel.int.inv.invs.jurid.just.juv.lab.law.liab.ltd.loc.mach.mag.maint.mgmt.mgt.mfr.mfrs.mfg.mar.mkt.mktg.matrim.mech.med.merch.metro.min.misc.mod.mortg.mun.mut.nat.negl.negot.nw.no.nos.off.org.orgs.pac.pat.pers.pharm.phil.plan.pol.prac.pres.priv.prob.proc.prod.pro.prop.psych.pub.rec.reg.regul.rehab.rel.rels.rep.reprod.rsch.rsrv.resol.res.resp.rest.ret.rd.sav.sch.schs.sci.sec.serv.servs.sess.soc.solic.spec.stat.subcomm.sur.surv.sys.tchr.tech.telecomm.tel.temp.twp.transcon.transp.treas.tr.trs.tpk.unemplmt.unif.univ.urb.util.veh.vehs.vill.voc.whse.whol.litig.n.s.e.w.m.ne.se.sw.is.mt.ft.pt.rt.st.blvd.sq.hwy.pkwy.hts.v.vs.ct.cir.supp.cl.jud.super.sup.magis.mil.terr.ala.ariz.ark.cal.colo.conn.del.fla.ga.haw.ida.ill.ind.kan.ky.la.me.md.mass.mich.minn.miss.mo.mont.neb.nev.okla.or.pa.tenn.tex.vt.va.wash.wis.wyo.mr.mrs.ms.dr.jr.sr.prof.rev.hon.sgt.capt.col.lt.ed.op.ad.dep.ass.ry.co.cmty.cty.envtl.gend.par.prot.ref.sol.adver.admr.admx.assn.commcn.commn.commr.contl.dept.empr.empt.engg.engr.entmt.envt.examr.exr.exx.fedn.govt.intl.invr.meml.natl.profl.pship.publg.publn.regl.secy.sholder.socy.tp.taxn.enft.rts.atty.attys.petr.respt.commrs.hldgs.hldg.props.prods.ents.invests.scis.emps.sols.corrs.telecomms.examrs.cmtys.colls.cts.amends.civ.enf.advis.utils.lic.bur.insp.conserv.retire.discipl.supers.edn.coun.stds.procs.quals.boro.commw.adv.comn.irrig.reclam.rptr.vet.trib.adj.vol.pty.poly.stud.libr.refin.socio.laby.naty.wkly.appx.comr.comrs.reins`.split(`.`));function Se(e,t){let n=t;for(;n>0&&/[-A-Za-z.']/.test(e[n-1]);)n--;let r=e.substring(n,t);if(!r)return!1;let i=r.replace(/['.]/g,``).toLowerCase();return!!(xe.has(i)||i.length===1&&/[a-z]/i.test(i)||/\.[A-Za-z]/.test(r))}const Ce=/\bId\.\s+/g,we=/\(\s*(?:quoting|citing|cited\s+in|quoted\s+in|accord|discussing|noting|explaining|describing|recognizing|applying|rejecting|adopting|requiring|overruling|overruled\s+by|abrogated\s+by)(?:,\s*e\.g\.,?)?\s+/gi,Te=/[.)]\s+(?=[A-Z])/g;function Ee(e,t,n=150,r){let i=Math.max(0,t-n),a=e.substring(i,t),o=i,s=-1,c;if(r?.originalText&&r.transformationMap){let{originalText:e,transformationMap:n}=r,a=n.cleanToOriginal.get(i)??i,o=n.cleanToOriginal.get(t)??t;if(o>a){let r=e.substring(a,o),c=/\n[ \t\r]*\n/g,l;for(;(l=c.exec(r))!==null;){let e=a+l.index+l[0].length,r;for(let t=0;t<10&&(r=n.originalToClean.get(e+t),r===void 0);t++);if(r!==void 0&&r>=i&&r<=t){let e=r-i;e>s&&(s=e)}}}}for(K.lastIndex=0;(c=K.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(Ce.lastIndex=0;(c=Ce.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(we.lastIndex=0;(c=we.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(Te.lastIndex=0;(c=Te.exec(a))!==null;){if(a[c.index]===`.`&&Se(a,c.index))continue;let e=c.index+c[0].length;e>s&&(s=e)}s!==-1&&(a=a.substring(s),o=i+s);let l=he.exec(a);if(l&&!l[0].includes(`;`)){let e=l[1].trim(),t=0;if(!Y(e)){let n=e.split(/\s+/),r=n[0]??``,i=r.toLowerCase().replace(/[.,']+$/,``);if(!(/^[A-Z]/.test(r)&&!_e.has(i)&&!ye.has(i)&&ve.test(e))&&!W.exec(e))for(let r=1;r<n.length;r++){let i=n.slice(r).join(` `);if(/^[A-Z]/.test(i)&&Y(i)){t=n.slice(0,r).join(` `).length+1,e=i;break}}}let n=l[0].match(/\bv(?:s)?\.\s/g),r=l[2].trim();if(n&&n.length>=2){let e=l[2].indexOf(`,`);e!==-1&&(r=l[2].substring(0,e).trim())}return{caseName:`${e} v. ${r}`,nameStart:o+l.index+t}}let u=ge.exec(a);if(u&&!u[0].includes(`;`))return{caseName:`${u[1]} ${u[2].trim()}`,nameStart:o+u.index};let d=a.replace(/,\s*$/,``),f=d.length-d.trimStart().length,p=d.substring(f),m=0,h=W.exec(p);h&&(m=h[0].length,p=p.substring(m));let g=p.trim();if(g.length>0&&Y(g)){let e=(g.split(/\s+/)[0]??``).toLowerCase().replace(/[.,']+$/,``);if(!ye.has(e)&&!g.includes(`;`))return{caseName:g,nameStart:o+f+m}}}function De(e,t,n=500){let r=[],i=[],a=t,o=Math.min(e.length,t+n),s,c=e.substring(a,o),l=q.exec(c);for(l&&(a+=l[0].length);a<o;){for(;a<o&&ue.test(e[a]);)a++;if(a>=o||e[a]!==`(`){let t=e.substring(a,o),n=de(t);if(n){s={text:t.substring(0,n.matchLength).replace(/\s+$/,``),normalized:n.signal,start:a,end:a+n.matchLength},a+=n.matchLength;continue}break}let t=a,n=0,c=a+1;for(;a<o;){let o=e[a];if(o===`(`)n++;else if(o===`)`&&(n--,n===0)){a++;let n=e.substring(c,a-1).trim();n.length>0&&(r.push({text:n,start:t,end:a}),s&&=(i.push({signal:s,nextParenIndex:r.length-1}),void 0));break}a++}if(n>0)break}return s&&i.push({signal:s,nextParenIndex:-1}),{parens:r,signals:i}}function X(e){let t={},n=F(e);n&&(t.date=n,t.year=n.parsed.year);let r=be(e);if(r){t.court=r;let n=e.indexOf(r);n!==-1&&(t.courtStart=n,t.courtEnd=n+r.length)}if(t.year){let n=String(t.year),r=e.lastIndexOf(n);r!==-1&&(t.yearStart=r,t.yearEnd=r+n.length)}return/\ben banc\b/i.test(e)?t.disposition=`en banc`:/\bper curiam\b/i.test(e)&&(t.disposition=`per curiam`),t}function Oe(e){let t=me.exec(e);if(t){let n=t[1].toLowerCase();if(pe(n))return{kind:`explanatory`,text:e,type:n}}let n=X(e);return n.year||n.date||n.disposition?{kind:`metadata`,...n}:{kind:`explanatory`,text:e,type:`other`}}function Z(e){let t=e;t=t.replace(/\bet\s+al\.?/gi,``),t=t.replace(/\s+d\/b\/a\b.*/gi,``),t=t.replace(/\s+aka\b.*/gi,``);let n=``;for(;n!==t;)n=t,t=t.replace(/,?\s*(Inc|LLC|Corp|Ltd|Co|LLP|LP|P\.C)\.?$/gi,``);return t=t.replace(/^(The|A|An)\s+/i,``),t=t.replace(/\s+/g,` `),t.trim().toLowerCase()}function ke(e){let t;for(let t of[`In the Matter of`,`In re`,`Ex parte`,`Matter of`,`State ex rel.`,`United States ex rel.`,`Application of`,`Petition of`,`Estate of`]){let n=RegExp(`^(${t})\\s+(.+)$`,`i`).exec(e);if(n){let t=n[1],r=n[2];if(/\s+v\.?\s+/i.test(r)){let t=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(t){let e=t[1].trim(),n=t[2].trim();return{plaintiff:e,plaintiffNormalized:Z(e),defendant:n,defendantNormalized:Z(n)}}}else return{plaintiff:e,plaintiffNormalized:Z(r),proceduralPrefix:t}}}let n=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(n){let e=n[1].trim(),r=n[2].trim(),i=e.match(W)??e.match(/^(Also|In(?!\s+re\b))\s+/i);if(i){let n=i[1].toLowerCase().replace(/\.$/,``);U.has(n)&&(t=n),e=e.substring(i[0].length).trim()}return{plaintiff:e||n[1].trim(),plaintiffNormalized:Z(e||n[1].trim()),defendant:r,defendantNormalized:Z(r),signal:t}}return{}}function Ae(t,n,r,i){let{text:a,span:c}=t,l=ie.exec(a);if(!l)throw Error(`Failed to parse case citation: ${a}`);let u=te(l[1]),d=l[2].trim(),f=l[3]?Number.parseInt(l[3],10):void 0,p=l[4]||void 0,m=l[5],h=ae.test(m),g=h?void 0:Number.parseInt(m,10),_=h?!0:void 0,v=oe.exec(a),y=v?V(v[1])??void 0:void 0,b=y?.page,x={};if(l.indices){if(l.indices[1]&&(x.volume=o(c.cleanStart,l.indices[1],n)),l.indices[2]){let[e,t]=l.indices[2],r=a.substring(e,t),i=r.length-r.trimStart().length,s=r.length-r.trimEnd().length;x.reporter=o(c.cleanStart,[e+i,t-s],n)}l.indices[5]&&(x.page=o(c.cleanStart,l.indices[5],n))}v?.indices?.[1]&&(x.pincite=o(c.cleanStart,v.indices[1],n));let S,C,w,T,E,D,O,k,A=se.exec(a);if(A&&!f&&(O=A[1],k=X(O),S=k.year,C=k.court,w=k.date,T=k.disposition),r&&!O){let e=r.substring(c.cleanEnd),t=ce.exec(e);if(t&&(O=t[1],k=X(O),S=k.year,C=k.court,w=k.date,T=k.disposition),b===void 0){let t=le.exec(e);t&&(y||=V(t[1])??void 0,b=y?.page,t.indices?.[1]&&(x.pincite=o(c.cleanEnd,t.indices[1],n)))}}let j,M,N;if(r){N=De(r,c.cleanEnd),M=N.parens;let e=O?M.slice(1):M;for(let t of e){let e=Oe(t.text);if(e.kind===`metadata`)e.court&&(!C||C===T)&&(C=e.court),e.year&&!S&&(S=e.year,w=e.date),e.disposition&&!T&&(T=e.disposition);else{j??=[];let r=s({cleanStart:t.start,cleanEnd:t.end},n);j.push({text:e.text,type:e.type,span:{cleanStart:t.start,cleanEnd:t.end,originalStart:r.originalStart,originalEnd:r.originalEnd}})}}}if(M&&M.length>0&&(C||S)){let e=O?M[0]:void 0;if(e){let t=s({cleanStart:e.start,cleanEnd:e.end},n);if(x.metadataParenthetical={cleanStart:e.start,cleanEnd:e.end,originalStart:t.originalStart,originalEnd:t.originalEnd},k){let t=e.start+1;if(k.courtStart!==void 0){let e=t+k.courtStart,r=t+k.courtEnd,i=s({cleanStart:e,cleanEnd:r},n);x.court={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}if(k.yearStart!==void 0){let e=t+k.yearStart,r=t+k.yearEnd,i=s({cleanStart:e,cleanEnd:r},n);x.year={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}}let P;if(r&&N&&N.signals.length>0)for(let e=0;e<N.signals.length;e++){let{signal:t}=N.signals[e];P??=[];let{originalStart:r,originalEnd:i}=s({cleanStart:t.start,cleanEnd:t.end},n);P.push({signal:t.normalized,rawSignal:t.text,signalSpan:{cleanStart:t.start,cleanEnd:t.end,originalStart:r,originalEnd:i},order:e})}let F=ee(d);!C&&F?.level===`supreme`&&F?.jurisdiction===`federal`&&(C=`scotus`);let I;if(r&&(I=Ee(r,c.cleanStart,void 0,{originalText:i,transformationMap:n}),I)){E=I.caseName;let e=M&&M.length>0?M[M.length-1].end:c.cleanEnd,t=I.nameStart,r=e;D={cleanStart:t,cleanEnd:r,originalStart:n.cleanToOriginal.get(t)??t,originalEnd:n.cleanToOriginal.get(r)??r};let i=I.nameStart,a=i+E.length,o=s({cleanStart:i,cleanEnd:a},n);x.caseName={cleanStart:i,cleanEnd:a,originalStart:o.originalStart,originalEnd:o.originalEnd}}let L,R,z,B,U,G;if(E){let e=ke(E);if(L=e.plaintiff,R=e.plaintiffNormalized,z=e.defendant,B=e.defendantNormalized,U=e.proceduralPrefix,G=e.signal,L&&z){let e=`${L} v. ${z}`;if(e!==E&&D&&r){E=e;let t=r.substring(D.cleanStart,c.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let e=t.substring(0,i.index).lastIndexOf(L);if(e!==-1){let t=D.cleanStart+e,r=n.cleanToOriginal.get(t)??t;D={...D,cleanStart:t,originalStart:r}}}if(I){let e=D.cleanStart,t=e+E.length,r=s({cleanStart:e,cleanEnd:t},n);x.caseName={cleanStart:e,cleanEnd:t,originalStart:r.originalStart,originalEnd:r.originalEnd}}}}if(L&&I&&r){let e=D?.cleanStart??I.nameStart,t=r.substring(e,c.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let r=t.substring(0,i.index).lastIndexOf(L);if(r!==-1){let t=e+r,i=t+L.length,a=s({cleanStart:t,cleanEnd:i},n);x.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}if(z){let r=i.index+i[0].length,a=t.substring(r).indexOf(z);if(a!==-1){let t=e+r+a,i=t+z.length,o=s({cleanStart:t,cleanEnd:i},n);x.defendant={cleanStart:t,cleanEnd:i,originalStart:o.originalStart,originalEnd:o.originalEnd}}}}else{let r=t.indexOf(L);if(r!==-1){let t=e+r,i=t+L.length,a=s({cleanStart:t,cleanEnd:i},n);x.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}}}if(G&&D&&r&&I){let e=r.substring(I.nameStart,c.cleanStart),t=W.exec(e);if(t){let e=I.nameStart,r=e+t[1].length,i=s({cleanStart:e,cleanEnd:r},n);x.signal={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}let{originalStart:K,originalEnd:ue}=s(c,n),q=.2,J=e.s()?.byAbbreviation.get(d.toLowerCase());return(J&&J.length>0||re.has(d))&&(q+=.3),S!==void 0&&S<=ne&&(q+=.2),E&&(q+=.15),C&&(q+=.1),q=Math.round(Math.min(q,1)*100)/100,_&&(q=Math.max(q,.5)),{type:`case`,text:a,span:{cleanStart:c.cleanStart,cleanEnd:c.cleanEnd,originalStart:K,originalEnd:ue},confidence:q,matchedText:a,processTimeMs:0,patternsChecked:1,volume:u,reporter:d,page:g,nominativeVolume:f,nominativeReporter:p,pincite:b,pinciteInfo:y,court:C,normalizedCourt:H(C),year:S,hasBlankPage:_,date:w,fullSpan:D,caseName:E,disposition:T,parentheticals:j,subsequentHistoryEntries:P,plaintiff:L,plaintiffNormalized:R,defendant:z,defendantNormalized:B,proceduralPrefix:U,inferredCourt:F,signal:G,spans:x}}const Q=`${String.raw`(?:art(?:icle)?\.?|amend(?:ment)?\.?|amdt\.?)\s+([IVX]+|\d+)`}${String.raw`(?:[,;]\s*§\s*([\w-]+))?`}${String.raw`(?:[,;]\s*cl\.?\s*(\d+))?`}`,je=new RegExp(Q,`id`),Me=[{id:`us-constitution`,regex:new RegExp(String.raw`\b(?:United\s+States\s+Constitution|U\.?\s*S\.?\s+Const\.?),?\s+${Q}`,`gi`),description:`U.S. Constitution citations (e.g., "U.S. Const. art. III, § 2", "U.S. Const. amend. XIV")`,type:`constitutional`},{id:`state-constitution`,regex:new RegExp(String.raw`\b(?:Ala|Alaska|Ariz|Ark|Cal(?:if)?|Colo|Conn|Del|Fla|Ga|Haw|Idaho|Ill|Ind|Iowa|Kan|Ky|La|Me|Md|Mass|Mich|Minn|Miss|Mo|Mont|Neb|Nev|N\.?\s*H|N\.?\s*J|N\.?\s*M|N\.?\s*Y|N\.?\s*C|N\.?\s*D|Ohio|Okla|Or(?:e)?|Pa|R\.?\s*I|S\.?\s*C|S\.?\s*D|Tenn|Tex|Utah|Vt|W\.?\s*Va|Va|Wash|Wis|Wyo)\.?\s+Const\.?,?\s+${Q}`,`gi`),description:`State constitution citations (e.g., "Cal. Const. art. I, § 7", "N.Y. Const. art. VI, § 20")`,type:`constitutional`},{id:`bare-constitution`,regex:new RegExp(String.raw`(?<!\.\s)(?<![A-Z]\s)\bConst\.?,?\s+${Q}`,`g`),description:`Bare constitutional citations without jurisdiction prefix (e.g., "Const. art. I, § 8, cl. 3")`,type:`constitutional`},{id:`bare-article`,regex:new RegExp(String.raw`(?<!Const\.?,?\s)\bArt\.?\s+[IVX]+[,;]\s*§\s*[\w-]+(?:[,;]\s*cl\.?\s*\d+)?`,`g`),description:`Bare article references without "Const." prefix (e.g., "Art. I, §8, cl. 3")`,type:`constitutional`}],Ne={I:1,II:2,III:3,IV:4,V:5,VI:6,VII:7,VIII:8,IX:9,X:10,XI:11,XII:12,XIII:13,XIV:14,XV:15,XVI:16,XVII:17,XVIII:18,XIX:19,XX:20,XXI:21,XXII:22,XXIII:23,XXIV:24,XXV:25,XXVI:26,XXVII:27};function Pe(e){let t=e.toUpperCase();if(t in Ne)return Ne[t];let n=Number.parseInt(e,10);return Number.isNaN(n)?void 0:n}const Fe={ala:`AL`,alaska:`AK`,ariz:`AZ`,ark:`AR`,cal:`CA`,calif:`CA`,colo:`CO`,conn:`CT`,del:`DE`,fla:`FL`,ga:`GA`,haw:`HI`,idaho:`ID`,ill:`IL`,ind:`IN`,iowa:`IA`,kan:`KS`,ky:`KY`,la:`LA`,me:`ME`,md:`MD`,mass:`MA`,mich:`MI`,minn:`MN`,miss:`MS`,mo:`MO`,mont:`MT`,neb:`NE`,nev:`NV`,"n.h":`NH`,"n.j":`NJ`,"n.m":`NM`,"n.y":`NY`,"n.c":`NC`,"n.d":`ND`,ohio:`OH`,okla:`OK`,or:`OR`,ore:`OR`,pa:`PA`,"r.i":`RI`,"s.c":`SC`,"s.d":`SD`,tenn:`TN`,tex:`TX`,utah:`UT`,vt:`VT`,va:`VA`,wash:`WA`,"w.va":`WV`,wis:`WI`,wyo:`WY`},Ie=/amend|amdt/i,Le=/^([A-Za-z]+(?:\.\s*[A-Za-z]+)?(?:\.\s*[A-Za-z]+)?)\.?\s+Const/i;function Re(e){let t=Le.exec(e);if(!t)return;let n=t[1].replace(/\s+/g,``).replace(/\.$/g,``).toLowerCase();if(n in Fe)return Fe[n]}function ze(e,t){let{text:n,span:r}=e,i=je.exec(n),a,c,l,u;if(i){let e=Pe(i[1]);Ie.test(i[0])?c=e:a=e,l=i[2]||void 0,u=i[3]?Number.parseInt(i[3],10):void 0}let d;switch(e.patternId){case`us-constitution`:d=`US`;break;case`state-constitution`:d=Re(n);break;default:d=void 0;break}let{originalStart:f,originalEnd:p}=s(r,t),m;m=e.patternId===`bare-article`?.5:e.patternId===`bare-constitution`?.7:l?.95:.9;let h=n.endsWith(`.`)?n.slice(0,-1):n,g={};if(d===`US`){let e=n.indexOf(`U.S.`);e!==-1&&(g.jurisdiction=o(r.cleanStart,[e,e+4],t))}else if(d&&e.patternId===`state-constitution`){let e=Le.exec(n);if(e){let n=e[1].length+1;g.jurisdiction=o(r.cleanStart,[0,n],t)}}return i?.indices&&(Ie.test(i[0])?i.indices[1]&&(g.amendment=o(r.cleanStart,i.indices[1],t)):i.indices[1]&&(g.article=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.section=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&(g.clause=o(r.cleanStart,i.indices[3],t))),{type:`constitutional`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:f,originalEnd:p},confidence:m,matchedText:h,processTimeMs:0,patternsChecked:1,jurisdiction:d,article:a,amendment:c,section:l,clause:u,spans:g}}function Be(e,t,n,r){let{text:i,span:a}=e,o=/\bNo\.\s+([\d]+(?:-[\w\d]+)*)\s+\(([^)]+)\)/.exec(i);if(!o)return;let c=o[1],l=o[2],u=Ee(n,a.cleanStart,void 0,{originalText:r,transformationMap:t});if(!u)return;let d=ke(u.caseName),f=d.plaintiff&&d.defendant,p=!!d.proceduralPrefix;if(!f&&!p)return;let m=X(l),{originalStart:h,originalEnd:g}=s(a,t),_=u.nameStart;if(d.plaintiff&&d.defendant){let e=n.substring(_,a.cleanStart),t=/\s+v\.?\s+/i.exec(e);if(t){let n=e.substring(0,t.index).lastIndexOf(d.plaintiff);n!==-1&&(_+=n)}}let v=a.cleanEnd,y=t.cleanToOriginal.get(_)??_,b=t.cleanToOriginal.get(v)??v;return{type:`docket`,text:i,matchedText:i,span:{cleanStart:a.cleanStart,cleanEnd:a.cleanEnd,originalStart:h,originalEnd:g},confidence:.7,processTimeMs:0,patternsChecked:1,docketNumber:c,caseName:d.plaintiff&&d.defendant?`${d.plaintiff} v. ${d.defendant}`:u.caseName,plaintiff:d.plaintiff,defendant:d.defendant,plaintiffNormalized:d.plaintiffNormalized,defendantNormalized:d.defendantNormalized,proceduralPrefix:d.proceduralPrefix,court:m.court,normalizedCourt:H(m.court),year:m.year,date:m.date,fullSpan:{cleanStart:_,cleanEnd:v,originalStart:y,originalEnd:b}}}function Ve(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Federal Register citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`federalRegister`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}function He(e,t,n){let{text:r,span:i}=e,a=/^(\d+(?:-\d+)?)\s+([A-Za-z.\s]+?)\s+(\d+)/d.exec(r);if(!a)throw Error(`Failed to parse journal citation: ${r}`);let c=a[1],l=/^\d+$/.test(c)?Number.parseInt(c,10):c,u=a[2].trim(),d=Number.parseInt(a[3],10),f,p;n===void 0?(f=r.slice(a[0].length),p=i.cleanStart+a[0].length):(f=n.slice(i.cleanEnd,i.cleanEnd+30),p=i.cleanEnd);let m=n?n.slice(i.cleanStart,i.cleanEnd+30):r,h=/^,\s*(\d+)/d.exec(f),g=h?Number.parseInt(h[1],10):void 0,_=/\((?:.*?\s)?(\d{4})\)/d.exec(m),v=_?Number.parseInt(_[1],10):void 0,y;a.indices&&(y={volume:o(i.cleanStart,a.indices[1],t),journal:o(i.cleanStart,a.indices[2],t),page:o(i.cleanStart,a.indices[3],t)},h?.indices?.[1]&&(y.pincite=o(p,h.indices[1],t)),_?.indices?.[1]&&(y.year=o(i.cleanStart,_.indices[1],t)));let{originalStart:b,originalEnd:x}=s(i,t);return{type:`journal`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:b,originalEnd:x},confidence:.6,matchedText:r,processTimeMs:0,patternsChecked:1,volume:l,journal:u,abbreviation:u,page:d,pincite:g,year:v,spans:y}}const Ue=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d;function We(e,t,n){let{text:r,span:i}=e,a=/^(\d{4})\s+(.+?)\s+(\d+)$/d.exec(r);if(!a)throw Error(`Failed to parse neutral citation: ${r}`);let c=Number.parseInt(a[1],10),l=a[2],u=a[3],d;a.indices&&(d={year:o(i.cleanStart,a.indices[1],t),court:o(i.cleanStart,a.indices[2],t),documentNumber:o(i.cleanStart,a.indices[3],t)});let f,p;if(n){let e=n.substring(i.cleanEnd),r=Ue.exec(e);r&&(p=V(r[1])??void 0,f=p?.page,r.indices?.[1]&&(d||={},d.pincite=o(i.cleanEnd,r.indices[1],t)))}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`neutral`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:1,matchedText:r,processTimeMs:0,patternsChecked:1,year:c,court:l,documentNumber:u,pincite:f,pinciteInfo:p,spans:d}}function Ge(e,t){let{text:n,span:r}=e,i=/Pub\.\s?L\.(?:\s?No\.)?\s?(\d+)-(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse public law citation: ${n}`);let a=Number.parseInt(i[1],10),c=Number.parseInt(i[2],10),l;i.indices&&(l={congress:o(r.cleanStart,i.indices[1],t),lawNumber:o(r.cleanStart,i.indices[2],t)});let{originalStart:u,originalEnd:d}=s(r,t);return{type:`publicLaw`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,congress:a,lawNumber:c,spans:l}}function Ke(e,t,n){let{text:r,span:i}=e,a=/([Ii])(?:d|bid)(\.)(,?)\s*(?:at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(r);if(!a)throw Error(`Failed to parse Id. citation: ${r}`);let c=a[1],l=a[3]===`,`,u=a[4]?V(a[4])??void 0:void 0,d=u?.page,f;a[4]&&a.indices?.[4]&&(f={pincite:o(i.cleanStart,a.indices[4],t)});let p=1;if(c===`i`&&(p=.85),l&&(p=Math.min(p,.9)),n&&i.cleanStart>0){let e=n.slice(Math.max(0,i.cleanStart-20),i.cleanStart).trimEnd();e.length>0&&(e[e.length-1],/[.;)\]—:]$/.test(e)||(p=Math.min(p,.4)))}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`id`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:p,matchedText:r,processTimeMs:0,patternsChecked:1,pincite:d,pinciteInfo:u,spans:f}}function qe(e,t){let{text:n,span:r}=e,i=/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n),a=i||/supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?|\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n);if(!a)throw Error(`Failed to parse supra citation: ${n}`);let c,l,u,d;if(i)c=i[1],l=i[3]?V(i[3])??void 0:void 0,u=.9,i[3]&&(d=3);else{c=void 0;let e=a[2],t=a[3],n=e??t;l=n?V(n)??void 0:void 0,u=.8,e?d=2:t&&(d=3)}let f=l?.page,p;d!==void 0&&a.indices?.[d]&&(p={pincite:o(r.cleanStart,a.indices[d],t)});let{originalStart:m,originalEnd:h}=s(r,t);return{type:`supra`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:m,originalEnd:h},confidence:u,matchedText:n,processTimeMs:0,patternsChecked:1,partyName:c,pincite:f,pinciteInfo:l,spans:p}}function Je(e,t){let{text:n,span:r}=e,i=/(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d.exec(n);if(!i)throw Error(`Failed to parse short-form case citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=i[2].trim(),u=V(i[3])??void 0,d=u?.page,f;i.indices?.[3]&&(f={pincite:o(r.cleanStart,i.indices[3],t)});let{originalStart:p,originalEnd:m}=s(r,t),h=.4;return re.has(l)&&(h+=.3),{type:`shortFormCase`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:h,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,reporter:l,pincite:d,pinciteInfo:u,spans:f}}const Ye=/^([^(]+?)\s*((?:\([^)]*\))*)$/,Xe=/\s*et\s+seq\.?\s*$/i;function $(e){let t=e.replace(Xe,``),n=t!==e,r=t.trim(),i=Ye.exec(r),a=i?.[2];return i!==null&&a?{section:i[1].trim(),subsection:a,hasEtSeq:n}:{section:r,hasEtSeq:n}}const Ze=/^(?:(\d+)\s+)?(.+?)\s*§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)$/d;function Qe(t,n){let{text:r,span:i}=t,a=Ze.exec(r),c,l,u;a?(c=a[1]?Number.parseInt(a[1],10):void 0,l=a[2].trim(),u=a[3]):(l=r,u=``);let d=e.n(l),f=d?.jurisdiction,p=l,{section:m,subsection:h,hasEtSeq:g}=$(u),{originalStart:_,originalEnd:v}=s(i,n),y;if(a?.indices&&(y={},a.indices[1]&&(y.title=o(i.cleanStart,a.indices[1],n)),a.indices[2]&&(y.code=o(i.cleanStart,a.indices[2],n)),a.indices[3]&&m)){let e=a.indices[3][0],t=m.replace(/[.,;:]\s*$/,``).length;if(y.section=o(i.cleanStart,[e,e+t],n),h){let t=e+m.length;y.subsection=o(i.cleanStart,[t,t+h.length],n)}}let b=r.includes(`§`),x;return x=d&&b?.95:d?.85:b?.6:.4,c!==void 0&&(x+=.05),h&&(x+=.05),x=Math.min(x,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:_,originalEnd:v},confidence:x,matchedText:r,processTimeMs:0,patternsChecked:1,title:c,code:p,section:m,subsection:h,pincite:h,jurisdiction:f,hasEtSeq:g||void 0,spans:y}}const $e=/^(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/(.+)$/d;function et(e,t){let{text:n,span:r}=e,i=$e.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=n,l=``);let{section:u,subsection:d,hasEtSeq:f}=$(l),{originalStart:p,originalEnd:m}=s(r,t),h=u.replace(/[.,;:]\s*$/,``).length,g;if(i?.indices&&(g={},i.indices[1]&&(g.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0];if(g.section=o(r.cleanStart,[e,e+h],t),d){let n=e+u.length;g.subsection=o(r.cleanStart,[n,n+d.length],t)}}let _=i?.95:.3;return d&&(_+=.05),_=Math.min(_,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:_,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:i?`IL`:void 0,hasEtSeq:f||void 0,spans:g}}const tt=/^(\d+)\s+(\S+(?:\.\S+)*)\s*§§?\s*(.+)$/d,nt=/^(\d+)\s+(\S+(?:\.\S+)*)\s+(?:Part|pt\.)\s+(.+)$/d;function rt(e,t){let{text:n,span:r}=e,i=tt.exec(n)??nt.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=e.patternId===`cfr`?`C.F.R.`:`U.S.C.`,l=n,a=void 0);let{section:u,subsection:d,hasEtSeq:f}=$(l),{originalStart:p,originalEnd:m}=s(r,t),h;if(i?.indices&&(h={},i.indices[1]&&(h.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(h.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0],n=u.replace(/[.,;:]\s*$/,``).length;if(h.section=o(r.cleanStart,[e,e+n],t),d){let n=e+u.length;h.subsection=o(r.cleanStart,[n,n+d.length],t)}}let g=.95;return a!==void 0&&(g+=.05),d&&(g+=.05),g=Math.min(g,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:g,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:`US`,hasEtSeq:f||void 0,spans:h}}const it=/^(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|Va\.?|Ala(?:bama)?\.?)\s+(.*?)\s*§§?\s*(.+)$/ds,at=/^(.*?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*(.+)$/d,ot={"n.y.":`NY`,"n.y":`NY`,ny:`NY`,"cal.":`CA`,cal:`CA`,"california.":`CA`,california:`CA`,"tex.":`TX`,tex:`TX`,"texas.":`TX`,texas:`TX`,"md.":`MD`,md:`MD`,"va.":`VA`,va:`VA`,"ala.":`AL`,ala:`AL`,"alabama.":`AL`,alabama:`AL`};function st(e){return ot[e.toLowerCase().replace(/\s+/g,``)]}function ct(e){return e.replace(/^\s*Code\s+Ann\.\s*,\s*/i,``).replace(/^\s*Code\s*,\s*/i,``).replace(/\s+Code\s*$/i,``).replace(/\s+Ann\.?\s*$/i,``).replace(/,\s*$/,``).trim()}function lt(t,n){let{text:r,span:i}=t,a,c,l,u=null,d=null;if(t.patternId===`mass-chapter`)u=at.exec(r),u?(a=`MA`,c=u[2],l=u[3]):(c=r,l=``);else if(d=it.exec(r),d){a=st(d[1]);let t=d[2],n=ct(t);c=a&&e.r(a,n)?n:t.trim(),l=d[3]}else c=r,l=``;let{section:f,subsection:p,hasEtSeq:m}=$(l),{originalStart:h,originalEnd:g}=s(i,n),_=f.replace(/[.,;:]\s*$/,``).length,v;if(u?.indices){if(v={},u.indices[2]&&(v.code=o(i.cleanStart,u.indices[2],n)),u.indices[3]&&f){let e=u.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}}else if(d?.indices&&(v={},d.indices[2]&&(v.code=o(i.cleanStart,d.indices[2],n)),d.indices[3]&&f)){let e=d.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}let y=a?.95:.5;return p&&(y+=.05),y=Math.min(y,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:h,originalEnd:g},confidence:y,matchedText:r,processTimeMs:0,patternsChecked:1,code:c,section:f,subsection:p,pincite:p,jurisdiction:a,hasEtSeq:m||void 0,spans:v}}const ut=/[Ss]ection\s+(\d+[A-Za-z0-9-]*)((?:\([^)]*\))*)\s+of\s+title\s+(\d+)/d;function dt(e,t){let{text:n,span:r}=e,i=ut.exec(n),a,c,l;i?(a=i[1],c=i[2]||void 0,l=Number.parseInt(i[3],10)):a=n;let{originalStart:u,originalEnd:d}=s(r,t),f;i?.indices&&(f={},i.indices[1]&&(f.section=o(r.cleanStart,i.indices[1],t)),i.indices[3]&&(f.title=o(r.cleanStart,i.indices[3],t)),i.indices[2]&&c&&(f.subsection=o(r.cleanStart,i.indices[2],t)));let p=.85;return l!==void 0&&(p+=.05),c&&(p+=.05),p=Math.min(p,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:p,matchedText:n,processTimeMs:0,patternsChecked:1,title:l,code:`U.S.C.`,section:a,subsection:c,pincite:c,jurisdiction:`US`,spans:f}}function ft(e,t){let{text:n,span:r}=e,i=/^(?:(\d+)\s+)?([A-Za-z.\s]+?)\s*§+\s*(\d+[A-Za-z0-9-]*)/.exec(n);if(!i){let{originalStart:e,originalEnd:i}=s(r,t);return{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:e,originalEnd:i},confidence:.3,matchedText:n,processTimeMs:0,patternsChecked:1,code:n,section:``}}let a=i[1]?Number.parseInt(i[1],10):void 0,o=i[2].trim(),c=i[3],{originalStart:l,originalEnd:u}=s(r,t),d=.5;return[`U.S.C.`,`C.F.R.`,`Cal. Civ. Code`,`Cal. Penal Code`,`N.Y. Civ. Prac. L. & R.`,`Tex. Civ. Prac. & Rem. Code`].some(e=>o.includes(e))&&(d+=.3),d=Math.min(d,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:l,originalEnd:u},confidence:d,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:o,section:c}}function pt(e,t){switch(e.patternId){case`usc`:case`cfr`:return rt(e,t);case`prose`:return dt(e,t);case`abbreviated-code`:return Qe(e,t);case`named-code`:case`mass-chapter`:return lt(e,t);case`chapter-act`:return et(e,t);default:return ft(e,t)}}function mt(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Statutes at Large citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`statutesAtLarge`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}const ht=[{id:`federal-reporter`,regex:/\b(\d+(?:-\d+)?)\s+(F\.|F\.2d|F\.3d|F\.4th|F\.\s?Supp\.|F\.\s?Supp\.\s?2d|F\.\s?Supp\.\s?3d|F\.\s?Supp\.\s?4th|F\.\s?App'x)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`Federal Reporter (F., F.2d, F.3d, F.4th, F.Supp., F.App'x, etc.)`,type:`case`},{id:`supreme-court`,regex:/\b(\d+(?:-\d+)?)\s+(U\.\s?S\.|S\.\s?Ct\.|L\.\s?Ed\.(?:\s?2d)?)\s+(?:\(\d+\s+[A-Z][A-Za-z.]+\)\s+)?(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`U.S. Supreme Court reporters (with optional nominative reporter parenthetical)`,type:`case`},{id:`state-reporter`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?! L\.[JQR\s])(?!\s+vs?\.\s)[A-Za-z.\d\s])+?)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`State reporters (broad pattern allowing multi-word reporters, excludes journal patterns with " L.J/Q/Rev" and phantom matches across a case-name separator " v. "/" vs. ", validated against reporters-db in Phase 3)`,type:`case`}],gt=[{id:`docket-paren-court-year`,regex:/\bNo\.\s+([\d]+(?:-[\w\d]+)*)\s+\(([^)]+\s(\d{4}))\)/g,description:`Docket-number citation: "Party v. Party, No. <docket> (<court> <year>)"`,type:`docket`}],_t=[{id:`law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?!\s+vs?\.\s)(?!\s+at\s+\d)[A-Za-z.\s])+)\s+(\d+)\b/g,description:`Law review citations (e.g., "120 Harv. L. Rev. 500"), validated against journals-db in Phase 3. Negative lookaheads exclude " v. "/" vs. " (so a party-name run isn't mis-captured as a journal) and " at <digit>" (so a short-form pincite like "554 U.S. at 621" isn't mis-captured as a journal).`,type:`journal`}],vt=[{id:`state-vendor-neutral`,regex:/\b(\d{4})\s+([A-Z]{2}(?:\s+App\.?)?)\s+(\d+)\b/g,description:`State vendor-neutral citations (e.g., "2007 UT 49", "2017 WI 17", "2013 IL 112116")`,type:`neutral`},{id:`westlaw`,regex:/\b(\d{4})\s+WL\s+(\d+)\b/g,description:`WestLaw citations (e.g., "2021 WL 123456")`,type:`neutral`},{id:`lexis`,regex:/\b(\d{4})\s+U\.S\.(?:\s+(?:App|Dist)\.)?\s+LEXIS\s+(\d+)\b/g,description:`LexisNexis citations (e.g., "2021 U.S. LEXIS 5000", "2021 U.S. App. LEXIS 12345", "2021 U.S. Dist. LEXIS 67890")`,type:`neutral`},{id:`public-law`,regex:/\bPub\.\s?L\.(?:\s?No\.)?\s?(\d+-\d+)\b/g,description:`Public Law citations (e.g., "Pub. L. No. 117-58" or "Pub. L. 116-283")`,type:`publicLaw`},{id:`federal-register`,regex:/\b(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)\b/g,description:`Federal Register citations (e.g., "86 Fed. Reg. 12345")`,type:`federalRegister`},{id:`statutes-at-large`,regex:/\b(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)\b/g,description:`Statutes at Large citations (e.g., "124 Stat. 119")`,type:`statutesAtLarge`},{id:`compact-law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.]+L\.(?:Rev|J|Q)\.)\s+(\d+)\b/g,description:`Compact law review citations without spaces (e.g., "93 Harv.L.Rev. 752")`,type:`journal`}],yt=[{id:`id`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]d\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Id. citations (e.g., "Id." or "Id. at 253")`,type:`case`},{id:`ibid`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]bid\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Ibid. citations (e.g., "Ibid." or "Ibid. at 125")`,type:`case`},{id:`supra`,regex:/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Supra citations (e.g., "Smith, supra" or "Smith, supra, at 460")`,type:`case`},{id:`supra`,regex:/(?:^|(?<=\s)|(?<=[;.]))supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?|\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?|\s+(?:§+|Part|p\.)\s*\S+)/g,description:`Standalone supra (e.g., "supra note 12" or "supra at 15")`,type:`case`},{id:`shortFormCase`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?\b/g,description:`Short-form case citations (e.g., "500 F.2d at 125")`,type:`case`}],bt=[{id:`usc`,regex:/\b(\d+)\s+(?:U\.S\.C\.?|USC)\s*§§?\s*(\d+[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`U.S. Code citations with optional subsections and et seq. (e.g., "42 U.S.C. § 1983(a)(1) et seq.")`,type:`statute`},{id:`cfr`,regex:/\b(\d+)\s+C\.?F\.?R\.?\s*(?:(?:Part|pt\.)\s+|§§?\s*)(\d+(?:\.\d+)?[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Code of Federal Regulations with Part or §, subsections, et seq. (e.g., "12 C.F.R. Part 226", "40 C.F.R. § 122.26(b)(14)")`,type:`statute`},{id:`prose`,regex:/\b[Ss]ection\s+(\d+[A-Za-z0-9-]*(?:\([^)]*\))*)\s+of\s+title\s+(\d+)\b/g,description:`Prose-form federal citations (e.g., "section 1983 of title 42"). Note: MD-style "section X of the Y Article" deferred to PR 3.`,type:`statute`},{id:`named-code`,regex:/\b(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|(?<!W\.?\s?)Va\.?|Ala(?:bama)?\.?)\s+((?:[A-Za-z.&',\s]+?))\s*§§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Named-code state citations (NY, CA, TX, MD, VA, AL) with jurisdiction prefix + code name + §`,type:`statute`},{id:`mass-chapter`,regex:/\b(Mass\.?\s*Gen\.?\s*Laws|M\.?G\.?L\.?A?\.?|A\.?L\.?M\.?|G\.?\s*L\.?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*([\w./-]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Massachusetts chapter-based citations (e.g., "Mass. Gen. Laws ch. 93A, § 2")`,type:`statute`},{id:`chapter-act`,regex:/\b(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/([^\s(]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Illinois Compiled Statutes chapter-act citations (e.g., "735 ILCS 5/2-1001")`,type:`statute`},{id:`abbreviated-code`,regex:e.a(),description:`Abbreviated state code citations for all US jurisdictions`,type:`statute`}];function xt(e,t=[...ht,...bt,..._t,...vt,...yt]){let n=[];for(let r of t)try{let t=e.matchAll(r.regex);for(let e of t)n.push({text:e[0],span:{cleanStart:e.index,cleanEnd:e.index+e[0].length},type:r.type,patternId:r.id})}catch(e){console.warn(`Pattern ${r.id} threw error, skipping:`,e instanceof Error?e.message:String(e))}return n.sort((e,t)=>e.span.cleanStart-t.span.cleanStart),n}var St=class{root=null;nextOrder=0;distanceFn;constructor(e){this.distanceFn=e}insert(e){let t={key:e,insertionOrder:this.nextOrder++,children:new Map};if(this.root===null){this.root=t;return}let n=this.root;for(;;){let r=this.distanceFn(e,n.key);if(r===0)return;let i=n.children.get(r);if(i)n=i;else{n.children.set(r,t);return}}}query(e,t){if(this.root===null)return[];let n=[],r=[this.root],i;for(;i=r.pop();){let a=this.distanceFn(e,i.key);a<=t&&n.push({key:i.key,distance:a,insertionOrder:i.insertionOrder});let o=a-t,s=a+t;for(let[e,t]of i.children)e>=o&&e<=s&&r.push(t)}return n.sort((e,t)=>e.distance-t.distance||e.insertionOrder-t.insertionOrder),n}};function Ct(e,t,n=1/0){if(e.length===0)return Math.min(t.length,n+1);if(t.length===0)return Math.min(e.length,n+1);let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e,a=r.length,o=Array.from({length:a+1},(e,t)=>t),s=Array(a+1);for(let e=1;e<=i.length;e++){s[0]=e;let t=e;for(let n=1;n<=a;n++)i[e-1]===r[n-1]?s[n]=o[n-1]:s[n]=1+Math.min(o[n],s[n-1],o[n-1]),s[n]<t&&(t=s[n]);if(t>n)return n+1;let c=o;o=s,s=c}return o[a]}function wt(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<=t?n=i+1:r=i}return n}function Tt(e,t,n=/\n\n+/g){let r=new Map,i=[0],a;for(;(a=n.exec(e))!==null;)i.push(a.index+a[0].length);i.push(e.length);for(let e=0;e<t.length;e++){let n=t[e].span.originalStart;r.set(e,wt(i,n)-1)}return r}function Et(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r].span.cleanStart,a=0,o=0,s=t.length-1;for(;o<=s;){let e=o+s>>>1,n=t[e];if(i<n.start)s=e-1;else if(i>=n.end)o=e+1;else{a=n.footnoteNumber;break}}n.set(r,a)}return n}function Dt(e,t,n,r,i=!1){if(r===`none`)return!0;let a=n.get(e),o=n.get(t);return!!(a===void 0||o===void 0||a===o||r===`footnote`&&i&&a===0)}function Ot(e){if(e.type===`case`||e.type===`docket`)return e.fullSpan}var kt=class{citations;text;options;context;partyNameTree;constructor(e,t,n={}){this.citations=e,this.text=t,this.options={scopeStrategy:n.scopeStrategy??`none`,autoDetectParagraphs:n.autoDetectParagraphs??!0,paragraphBoundaryPattern:n.paragraphBoundaryPattern??/\n\n+/g,fuzzyPartyMatching:n.fuzzyPartyMatching??!0,partyMatchThreshold:n.partyMatchThreshold??.8,reportUnresolved:n.reportUnresolved??!0,footnoteMap:n.footnoteMap},this.partyNameTree=new St(Ct),this.context={citationIndex:0,allCitations:e,lastResolvedIndex:void 0,fullCitationHistory:new Map,paragraphMap:new Map},this.options.autoDetectParagraphs&&(this.context.paragraphMap=Tt(t,e,this.options.paragraphBoundaryPattern)),this.options.scopeStrategy===`footnote`&&this.options.footnoteMap&&(this.context.paragraphMap=Et(e,this.options.footnoteMap))}resolve(){let e=[];for(let n=0;n<this.citations.length;n++){this.context.citationIndex=n;let r=this.citations[n],i;switch(r.type){case`id`:i=this.resolveId(r);break;case`supra`:i=this.resolveSupra(r);break;case`shortFormCase`:i=this.resolveShortFormCase(r);break;default:t(r)&&(e.some(e=>{let t=Ot(e);return t?t.cleanStart<=r.span.cleanStart&&t.cleanEnd>=r.span.cleanEnd:!1})||(this.context.lastResolvedIndex=n),this.trackFullCitation(r,n));break}i?.resolvedTo!==void 0&&(this.context.lastResolvedIndex=i.resolvedTo),e.push({...r,resolution:i})}return e}resolveId(e){let t=this.context.citationIndex,n=this.context.lastResolvedIndex;return n===void 0?this.createFailureResult(`No preceding citation found`):this.isWithinScope(n,t)?{resolvedTo:n,confidence:1}:this.createFailureResult(`Antecedent citation outside scope boundary`)}resolveSupra(e){if(!e.partyName)return;let t=this.context.citationIndex,n=this.normalizePartyName(e.partyName),r=n.length,i=this.options.partyMatchThreshold,a=r===0?0:Math.ceil(r*(1-i)/i),o=this.partyNameTree.query(n,a);o.sort((e,t)=>e.insertionOrder-t.insertionOrder);let s;for(let e of o){let n=this.context.fullCitationHistory.get(e.key);if(n===void 0||!this.isWithinScope(n,t,!0))continue;let i=Math.max(r,e.key.length),a=i===0?1:1-e.distance/i;(!s||a>s.similarity)&&(s={index:n,similarity:a})}if(!s)return this.createFailureResult(`No full citation found in scope`);if(s.similarity<this.options.partyMatchThreshold)return this.createFailureResult(`Party name similarity ${s.similarity.toFixed(2)} below threshold ${this.options.partyMatchThreshold}`);let c=[];return s.similarity<1&&c.push(`Fuzzy match: similarity ${s.similarity.toFixed(2)}`),{resolvedTo:s.index,confidence:s.similarity,warnings:c.length>0?c:void 0}}resolveShortFormCase(e){let t=this.context.citationIndex;for(let n=t-1;n>=0;n--){let r=this.citations[n];if(r.type===`case`&&r.volume===e.volume&&this.normalizeReporter(r.reporter)===this.normalizeReporter(e.reporter))return this.isWithinScope(n,t,!0)?{resolvedTo:n,confidence:.95}:this.createFailureResult(`Matching citation outside scope boundary`)}return this.createFailureResult(`No matching full case citation found`)}trackFullCitation(e,t){if(e.type===`case`&&(e.defendantNormalized&&(this.context.fullCitationHistory.set(e.defendantNormalized,t),this.partyNameTree.insert(e.defendantNormalized)),e.plaintiffNormalized&&(this.context.fullCitationHistory.set(e.plaintiffNormalized,t),this.partyNameTree.insert(e.plaintiffNormalized)),!e.plaintiffNormalized&&!e.defendantNormalized)){let n=this.extractPartyName(e);if(n){let e=this.normalizePartyName(n);this.context.fullCitationHistory.set(e,t),this.partyNameTree.insert(e)}}}extractPartyName(e){let t=e.span.originalStart,n=Math.max(0,t-100),r=this.text.substring(n,t),i=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*)\s+v\.?\s+[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*,\s*$/);if(i)return this.stripSignalWords(i[1].trim());let a=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*),\s*$/);if(a)return this.stripSignalWords(a[1].trim())}stripSignalWords(e){let t=e.replace(/^(?:In(?!\s+re\b)|See(?:\s+[Aa]lso)?|Compare|But(?:\s+[Ss]ee)?|Cf\.?|Also)\s+/i,``).trim();return t.length>0?t:e}normalizePartyName(e){return e.toLowerCase().replace(/\s+/g,` `).trim()}normalizeReporter(e){return e.toLowerCase().replace(/\s+/g,``).replace(/\./g,``)}isWithinScope(e,t,n=!1){return Dt(e,t,this.context.paragraphMap,this.options.scopeStrategy,n)}createFailureResult(e){if(this.options.reportUnresolved)return{resolvedTo:void 0,failureReason:e,confidence:0}}};function At(e,t,n){return new kt(e,t,n).resolve()}function jt(e,t=``){let n=new Map;if(e.length===0||t===``)return n;let r=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(a.type!==`case`||r.has(i))continue;let o=[];for(let n=i+1;n<e.length;n++){let s=e[n];if(s.type!==`case`)break;let c=(n===i+1?a:e[n-1]).span.cleanEnd,l=s.span.cleanStart;if(l-c>20)break;let u=t.substring(c,l);if(!u.includes(`,`))break;let d=u.indexOf(`,`);if(u.length-d-1>5||t.substring(a.span.cleanEnd,s.span.cleanEnd).includes(`)`)||!Mt(t,s.span.cleanEnd))break;o.push(n),r.add(n)}o.length>0&&n.set(i,o)}return n}function Mt(e,t){let n=e.substring(t,t+200),r=n.indexOf(`(`);if(r===-1)return!1;let i=0;for(let e=r;e<n.length;e++)if(n[e]===`(`)i++;else if(n[e]===`)`&&(i--,i===0))return!0;return!1}const Nt=Pt();function Pt(){return[{regex:/^see\s+generally\b/i,signal:`see generally`},{regex:/^see\s+also\b/i,signal:`see also`},{regex:/^but\s+see\b/i,signal:`but see`},{regex:/^but\s+cf\.?(?=\s|$)/i,signal:`but cf`},{regex:/^compare\b/i,signal:`compare`},{regex:/^accord\b/i,signal:`accord`},{regex:/^contra\b/i,signal:`contra`},{regex:/^see\b/i,signal:`see`},{regex:/^cf\.?(?=\s|$)/i,signal:`cf`}].map(({regex:e,signal:t})=>({regex:e,endRegex:RegExp(`${e.source.replace(/^\^/,`(?<![a-z])`)}\\s*$`,e.flags),signal:t}))}function Ft(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanEnd:e.span.cleanEnd}function It(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanStart:e.span.cleanStart}function Lt(e,t){e.signal=t}function Rt(e){let t=e.trimStart();for(let{regex:e,signal:n}of Nt){let r=e.exec(t);if(r)return{signal:n,length:r[0].length}}}function zt(e){let t=e.indexOf(`;`);if(t===-1||e.substring(0,t).trim()!==``)return{valid:!1};let n=e.substring(t+1).trim();if(n===``)return{valid:!0};let r=Rt(n);return r&&n.substring(r.length).trim()===``?{valid:!0,signal:r.signal}:{valid:!1}}function Bt(e,t){if(e.length<2)return;let n=[],r=[];for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(o.type===`case`&&o.subsequentHistoryOf){r.length>=2&&n.push(r),r=[];continue}if(a.type===`case`&&a.subsequentHistoryOf)continue;let s=Ft(a),c=It(o);if(c<=s){r.length>=2&&n.push(r),r=[];continue}let l=zt(t.substring(s,c));l.valid?(r.length===0&&r.push(i),r.push(i+1),l.signal&&!o.signal&&Lt(o,l.signal)):(r.length>=2&&n.push(r),r=[])}r.length>=2&&n.push(r);for(let t=0;t<n.length;t++){let r=n[t];if(r.length<2)continue;let i=`sc-${t}`;for(let t=0;t<r.length;t++){let n=e[r[t]];n.stringCitationGroupId=i,n.stringCitationIndex=t,n.stringCitationGroupSize=r.length}}for(let r of n){if(r.length<2)continue;let n=e[r[0]];if(n.signal)continue;let i=Math.max(0,It(n)-60),a=t.substring(i,It(n)).trim();for(let{endRegex:e,signal:t}of Nt)if(e.test(a)){Lt(n,t);break}}}function Vt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.signal&&r.stringCitationGroupId)continue;let i=n>0?Ft(e[n-1]):0,a=r.span.cleanStart;if(a<=i)continue;let o=t.substring(i,a),s=[];for(let{signal:e}of Nt){let t=e.replace(/\./g,`\\.`).replace(/\s+/g,`\\s+`),n=RegExp(`(?<![a-zA-Z])(${t})(?![a-zA-Z])`,`gi`),r;for(;(r=n.exec(o))!==null;)s.push({signal:e,start:r.index,end:r.index+r[0].length})}if(s.length===0)continue;s.sort((e,t)=>{let n=t.end-e.end;return n===0?t.end-t.start-(e.end-e.start):n});let c=s[0];for(let e of s)e.start<=c.start&&e.end>=c.end&&(c=e);Lt(r,c.signal)}}const Ht=1750,Ut=.1,Wt=new Set([`i.c.j.`,`u.n.t.s.`,`i.l.m.`,`i.l.r.`,`p.c.i.j.`,`a.c.`,`w.l.r.`,`all e.r.`,`q.b.`,`k.b.`,`ch.`,`co. rep.`,`e.c.r.`,`e.h.r.r.`,`c.m.l.r.`,`edw.`]);function Gt(e){if(e.type===`case`||e.type===`shortFormCase`)return e.reporter;if(e.type===`journal`)return e.abbreviation}function Kt(e){switch(e.type){case`case`:return e.year;case`journal`:return e.year;case`federalRegister`:return e.year;case`statutesAtLarge`:return e.year;default:return}}const qt=new Set([`court`,`rule`,`section`,`chapter`,`article`,`part`,`title`,`paragraph`,`clause`,`amendment`,`dismissed`,`granted`,`denied`,`filed`,`argued`]);function Jt(e){return!!(e.toLowerCase().split(/\s+/).some(e=>qt.has(e))||!e.includes(`.`)&&e.length>12)}const Yt=new Set(`the.a.an.in.on.at.but.and.for.by.to.with.from.as.if.so.nor.yet.not.no.then.when.where.who.what.how.that.this.these.those.he.she.it.they.we.his.her.its.their.our.was.were.is.are.has.had.been.being.did.does.do.may.shall.will.would.could.should.held.said.found.made.took.gave.see.also.january.february.march.april.june.july.august.september.october.november.december`.split(`.`)),Xt=2e3,Zt=/^\d{1,2}-\d{4,}$/;function Qt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e;return typeof t.volume==`number`?t.volume>Xt:!1}function $t(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e,n=String(t.volume);return Zt.test(n)}function en(t){if(t.type!==`case`&&t.type!==`shortFormCase`)return!1;let n=t,r=typeof n.volume==`number`?n.volume:Number.parseInt(String(n.volume),10);if(Number.isNaN(r)||r<1||r>20)return!1;let i=n.reporter;if(!i)return!1;let a=e.s();return a?(a.byAbbreviation.get(i.toLowerCase())??[]).length===0:i.includes(`.`)?!1:i.toLowerCase().split(/\s+/).some(e=>Yt.has(e))}function tn(e){let t=Gt(e);if(t&&Wt.has(t.toLowerCase().trim())||t&&(e.type===`case`||e.type===`shortFormCase`)&&Jt(t)||Qt(e)||$t(e)||en(e))return!0;let n=Kt(e);return n!==void 0&&n<Ht}function nn(e){let t=[],n=Gt(e);if(n){let r=n.toLowerCase().trim();Wt.has(r)&&t.push(`Reporter "${n}" is a known non-US source`),(e.type===`case`||e.type===`shortFormCase`)&&Jt(n)&&t.push(`Reporter "${n}" contains prose words or is implausibly long`)}if(Qt(e)){let n=e;t.push(`Volume ${n.volume} exceeds maximum plausible volume (${Xt}) — likely a zip code or other number`)}if($t(e)){let n=e;t.push(`Hyphenated volume "${n.volume}" matches docket number pattern — likely a case number, not a citation volume`)}if(en(e)){let n=e;t.push(`Small volume (${n.volume}) with unrecognized reporter "${n.reporter}" — likely a paragraph or footnote marker`)}let r=Kt(e);return r!==void 0&&r<Ht&&t.push(`Year ${r} predates US legal reporting (threshold: ${Ht})`),t}function rn(e,t){if(t)return e.filter(e=>!tn(e));for(let t of e){if(t.confidence===Ut&&t.warnings?.length)continue;let e=nn(t);if(e.length>0){t.confidence=Ut;let n=e.map(e=>({level:`warning`,message:e,position:{start:t.span.originalStart,end:t.span.originalEnd}}));t.warnings=[...t.warnings||[],...n]}}return e}const an=/^(\S+)\s+(.+)\s+(\d+)$/;function on(e,t){let n=performance.now(),{cleaned:r,transformationMap:i,warnings:a}=y(e,t?.cleaners),o;if(t?.detectFootnotes){let t=O(e);t.length>0&&(o=A(t,i))}let s=t?.patterns||[...vt,...gt,...yt,...ht,...Me,...bt,..._t],c=xt(r,s),l=new Map;for(let e=0;e<s.length;e++){let t=s[e].id;l.has(t)||l.set(t,e)}let u=e=>l.get(e.patternId)??1/0,d=[...c].sort((e,t)=>e.span.cleanStart-t.span.cleanStart||t.span.cleanEnd-e.span.cleanEnd||u(e)-u(t)),f=[];for(let e of d){let t=!1;for(let n of f)if(n.span.cleanStart<=e.span.cleanStart&&n.span.cleanEnd>=e.span.cleanEnd&&!(u(n)>u(e))&&(n.span.cleanStart<e.span.cleanStart||n.span.cleanEnd>e.span.cleanEnd||u(n)<u(e))){t=!0;break}t||f.push(e)}let p=jt(f,r),m=new Map;for(let[e,t]of p.entries())for(let n of t)m.set(n,e);let h=[];for(let t=0;t<f.length;t++){let o=f[t],s;switch(o.type){case`case`:s=o.patternId===`id`||o.patternId===`ibid`?Ke(o,i,r):o.patternId===`supra`?qe(o,i):o.patternId===`shortFormCase`?Je(o,i):Ae(o,i,r,e);break;case`docket`:{let t=Be(o,i,r,e);if(!t)continue;s=t;break}case`statute`:s=pt(o,i);break;case`journal`:s=He(o,i,r);break;case`neutral`:s=We(o,i,r);break;case`publicLaw`:s=Ge(o,i);break;case`federalRegister`:s=Ve(o,i);break;case`statutesAtLarge`:s=mt(o,i);break;case`constitutional`:s=ze(o,i);break;default:continue}if(a.length>0&&(s.warnings=[...s.warnings||[],...a]),s.processTimeMs=performance.now()-n,s.type===`case`){let e=p.has(t),n=m.has(t);if(e||n){let r=f[n?m.get(t)??t:t],i=an.exec(r.text);if(i){let[,n,r,a]=i;if(s.groupId=`${n}-${r.replace(/\s+/g,`.`)}-${a}`,e){let e=p.get(t)??[];s.parallelCitations=e.map(e=>{let t=f[e],n=an.exec(t.text);if(n){let[,e,t,r]=n;return{volume:/^\d+$/.test(e)?Number.parseInt(e,10):e,reporter:t,page:Number.parseInt(r,10)}}return{volume:0,reporter:``,page:0}})}}}}h.push(s)}cn(h),ln(h),Bt(h,r),Vt(h,r);let g=rn(h,t?.filterFalsePositives??!1);return o&&j(g,o),t?.resolve?At(g,e,o?{...t.resolutionOptions,footnoteMap:o}:t.resolutionOptions):g}async function sn(e,t){return on(e,t)}function cn(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!==`case`||!r.subsequentHistoryEntries)continue;let i=r.subsequentHistoryEntries,a=0;for(let r=n+1;r<e.length&&a<i.length;r++){let o=e[r];if(o.type!==`case`)continue;let s=i[a].signalSpan.cleanEnd;o.span.cleanStart>=s&&(t.push({parentIdx:n,childIdx:r,signal:i[a].signal}),a++)}}if(t.length===0)return;let n=new x(e.length);for(let e of t)n.union(e.parentIdx,e.childIdx);let r=new Map;for(let e of t)r.set(e.childIdx,e.signal);for(let[t,i]of n.components()){if(i.length===1)continue;let n=e[t];if(n.type!==`case`)continue;let a=[...n.subsequentHistoryEntries??[]];for(let n of i){if(n===t)continue;let i=e[n];if(i.type!==`case`)continue;let o=r.get(n);if(o&&(i.subsequentHistoryOf={index:t,signal:o},i.subsequentHistoryEntries)){for(let e of i.subsequentHistoryEntries)a.push({...e,order:a.length});i.subsequentHistoryEntries=void 0}}n.subsequentHistoryEntries=a}}function ln(e){for(let t of e){if(t.type!==`case`||!t.subsequentHistoryOf)continue;let n=e[t.subsequentHistoryOf.index];!n||n.type!==`case`||n.caseName&&(t.caseName=n.caseName,t.plaintiff=n.plaintiff,t.defendant=n.defendant,t.plaintiffNormalized=n.plaintiffNormalized,t.defendantNormalized=n.defendantNormalized,t.proceduralPrefix=n.proceduralPrefix,t.spans&&(t.spans.caseName=void 0,t.spans.plaintiff=void 0,t.spans.defendant=void 0),t.fullSpan&&={cleanStart:t.span.cleanStart,cleanEnd:t.fullSpan.cleanEnd,originalStart:t.span.originalStart,originalEnd:t.fullSpan.originalEnd})}}exports.DocumentResolver=kt,exports.applyFalsePositiveFilters=rn,exports.assertUnreachable=a,exports.cleanText=y,exports.detectFootnotes=O,exports.extractCase=Ae,exports.extractCitations=on,exports.extractCitationsAsync=sn,exports.extractConstitutional=ze,exports.extractFederalRegister=Ve,exports.extractJournal=He,exports.extractNeutral=We,exports.extractPublicLaw=Ge,exports.extractStatute=pt,exports.extractStatutesAtLarge=mt,exports.isCaseCitation=r,exports.isCitationType=i,exports.isFullCitation=t,exports.isShortFormCitation=n,exports.normalizeCourt=H,exports.parsePincite=V,exports.resolveCitations=At,exports.spanFromGroupIndex=o,exports.tokenize=xt;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./knownCodes-D_EXxDqq.cjs`);function t(e){return e.type===`case`||e.type===`docket`||e.type===`statute`||e.type===`journal`||e.type===`neutral`||e.type===`publicLaw`||e.type===`federalRegister`||e.type===`statutesAtLarge`||e.type===`constitutional`}function n(e){return e.type===`id`||e.type===`supra`||e.type===`shortFormCase`}function r(e){return e.type===`case`}function i(e,t){return e.type===t}function a(e){throw Error(`Unexpected value: ${e}`)}function o(e,t,n){let r=e+t[0],i=e+t[1],{originalStart:a,originalEnd:o}=s({cleanStart:r,cleanEnd:i},n);return{cleanStart:r,cleanEnd:i,originalStart:a,originalEnd:o}}function s(e,t){return t.cleanToOriginalSegments?{originalStart:t.cleanToOriginalSegments.lookup(e.cleanStart),originalEnd:t.cleanToOriginalSegments.lookup(e.cleanEnd)}:{originalStart:t.cleanToOriginal.get(e.cleanStart)??e.cleanStart,originalEnd:t.cleanToOriginal.get(e.cleanEnd)??e.cleanEnd}}function c(e){return e.replace(/<[^>]+>/g,``)}function l(e){return e.replace(/(\w)-\s*[\n\r]+\s*(\w)/g,`$1$2`)}function u(e){return e.replace(/[\t\n\r\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,` `)}function d(e){return e.replace(/ {2,}/g,` `)}function f(e){return e.normalize(`NFKC`)}function p(e){return e.replace(/[\u201C\u201D]/g,`"`).replace(/[\u2018\u2019]/g,`'`)}function m(e){return e.replace(/[\u2014\u2015]/g,`---`).replace(/[\u2010\u2012\u2013]/g,`-`)}function h(e){return e.replace(/§/gi,`§`).replace(/¶/gi,`¶`).replace(/&/gi,`&`).replace(/ /gi,` `).replace(/</gi,`<`).replace(/>/gi,`>`).replace(/"/gi,`"`).replace(/'/gi,`'`).replace(/&#(\d+);/g,(e,t)=>{let n=Number.parseInt(t,10);return Number.isNaN(n)?e:String.fromCharCode(n)}).replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isNaN(n)?e:String.fromCharCode(n)})}function g(e){let t=e;return t=t.replace(/\bU\.\s+S\./g,`U.S.`),t=t.replace(/\bS\.\s+Ct\./g,`S.Ct.`),t=t.replace(/\bL\.\s+Ed\./g,`L.Ed.`),t=t.replace(/\bF\.\s+Supp\./g,`F.Supp.`),t=t.replace(/\bF\.\s+(\d+[a-z]+)/g,`F.$1`),t=t.replace(/([A-Za-z])\.\s+(\d+[a-z]+)/g,`$1.$2`),t}function _(e){return e.replace(/[\u2032\u2035]/g,`'`).replace(/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,``)}var v=class e{segments;constructor(e){this.segments=e}static identity(t){return new e([{cleanPos:0,origPos:0,len:t+1}])}static fromMap(t){if(t.size===0)return new e([]);let n=[...t.entries()].sort((e,t)=>e[0]-t[0]),r=[],i=n[0][0],a=n[0][1],o=1;for(let e=1;e<n.length;e++){let[t,s]=n[e],c=i+o,l=a+o;t===c&&s===l?o++:(r.push({cleanPos:i,origPos:a,len:o}),i=t,a=s,o=1)}return r.push({cleanPos:i,origPos:a,len:o}),new e(r)}lookup(e){let t=this.segments;if(t.length===0)return e;let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>>1,a=t[i];if(e<a.cleanPos)r=i-1;else if(e>=a.cleanPos+a.len)n=i+1;else return a.origPos+(e-a.cleanPos)}let i=t[t.length-1];return i.origPos+(e-i.cleanPos)}};function y(e,t=[c,h,l,u,d,f,m,p,_,g]){let n=e,r=new Map,i=new Map;for(let t=0;t<=e.length;t++)r.set(t,t),i.set(t,t);for(let e of t){let t=n,a=e(n);if(t!==a){let{newCleanToOriginal:e,newOriginalToClean:o}=b(t,a,r,i);r=e,i=o,n=a}}let a={cleanToOriginal:r,originalToClean:i,cleanToOriginalSegments:v.fromMap(r)};return{cleaned:n,transformationMap:a,warnings:[]}}function b(e,t,n,r){let i=new Map,a=new Map,o=0,s=0;for(;o<=e.length||s<=t.length;){if(o>=e.length&&s>=t.length){let e=n.get(o)??o;i.set(s,e),a.set(e,s);break}if(o>=e.length){let e=n.get(o)??o;i.set(s,e),s++;continue}if(s>=t.length){let e=n.get(o)??o;a.set(e,s),o++;continue}if(e[o]===t[s]){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++}else{if(e.length-o===t.length-s){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++;continue}let r=!1,c=Math.max(40,Math.abs(e.length-t.length)+10),l=-1,u=-1;for(let n=1;n<=c;n++){if(l<0&&o+n<e.length&&e[o+n]===t[s]){let r=!0;for(let i=1;i<3;i++){let a=o+n+i,c=s+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(l=n)}if(u<0&&s+n<t.length&&e[o]===t[s+n]){let r=!0;for(let i=1;i<3;i++){let a=o+i,c=s+n+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(u=n)}if(l>=0&&u>=0)break}if(l>=0&&(u<0||l<=u)){for(let e=0;e<l;e++){let t=n.get(o+e)??o+e;a.set(t,s)}o+=l,r=!0}else if(u>=0){let e=n.get(o)??o;for(let t=0;t<u;t++)i.set(s+t,e);s+=u,r=!0}if(r)continue;let d=n.get(o)??o;i.set(s,d),a.set(d,s),o++,s++}}return{newCleanToOriginal:i,newOriginalToClean:a}}var x=class{parent;rank;constructor(e){this.parent=Array.from({length:e},(e,t)=>t),this.rank=Array(e).fill(0)}find(e){let t=e;for(;this.parent[t]!==t;)this.parent[t]=this.parent[this.parent[t]],t=this.parent[t];return t}union(e,t){let n=this.find(e),r=this.find(t);if(n!==r){if(n>r){let e=n;n=r,r=e}this.parent[r]=n,this.rank[n]===this.rank[r]&&this.rank[n]++}}connected(e,t){return this.find(e)===this.find(t)}components(){let e=new Map;for(let t=0;t<this.parent.length;t++){let n=this.find(t),r=e.get(n);r||(r=[],e.set(n,r)),r.push(t)}return e}};function S(e,t,n){let r=/\blabel\s*=\s*["'](\d+)["']/.exec(e);if(r)return Number.parseInt(r[1],10);let i=/\bid\s*=\s*["'](?:fn|footnote)(\d+)["']/.exec(e);if(i)return Number.parseInt(i[1],10);let a=t.replace(/<[^>]*>/g,``),o=/^\s*(\d+)[.\s):]/.exec(a);return o?Number.parseInt(o[1],10):n+1}function C(e,t,n){let r=RegExp(`<${t}\\b[^>]*>`,`gi`),i=RegExp(`</${t}\\s*>`,`gi`);r.lastIndex=n,i.lastIndex=n;let a=1;for(;a>0;){let t=r.exec(e),n=i.exec(e);if(!n)return null;if(t&&t.index<n.index)a++,i.lastIndex=t.index+t[0].length;else{if(a--,a===0)return{contentEnd:n.index,tagEnd:n.index+n[0].length};r.lastIndex=n.index+n[0].length}}return null}function w(e){let t=[],n,r=RegExp(`<(footnote|fn)\\b[^>]*>|<(div|aside|section|p|span)\\b[^>]*(?:class\\s*=\\s*["'][^"']*\\bfootnote\\b[^"']*["']|id\\s*=\\s*["'](?:fn|footnote)\\d*["'])[^>]*>`,`gi`);for(;(n=r.exec(e))!==null;){let i=n[0],a=n.index+i.length,o=C(e,n[1]||n[2],a);if(!o)continue;let s=S(i,e.slice(a,o.contentEnd),t.length);t.push({start:a,end:o.contentEnd,footnoteNumber:s}),r.lastIndex=o.tagEnd}return t.sort((e,t)=>e.start-t.start)}const T=/^\s*[-_]{5,}\s*$/m;function E(e){let t=T.exec(e);if(!t)return[];let n=t.index+t[0].length,r=e.slice(n),i=RegExp(`^\\s*(?:FN\\s*(\\d+)[.\\s:)]|\\[(\\d+)\\]\\s|n\\.\\s*(\\d+)\\s|(\\d+)\\.\\s)`,`gm`),a=[],o;for(;(o=i.exec(r))!==null;){let e=o[1]||o[2]||o[3]||o[4];e&&a.push({index:o.index+n,footnoteNumber:Number.parseInt(e,10)})}if(a.length===0)return[];let s=[];for(let t=0;t<a.length;t++){let n=a[t].index,r=t+1<a.length?a[t+1].index:e.length;s.push({start:n,end:r,footnoteNumber:a[t].footnoteNumber})}return s}const D=/<[^>]+>/;function O(e){if(D.test(e)){let t=w(e);if(t.length>0)return t}return E(e)}function k(e,t,n,r=20){for(let i=1;i<=r;i++){let r=n===`forward`?e+i:e-i,a=t.get(r);if(a!==void 0)return a}}function A(e,t){return e.length===0?[]:e.map(e=>({start:t.originalToClean.get(e.start)??k(e.start,t.originalToClean,`forward`)??e.start,end:t.originalToClean.get(e.end)??k(e.end,t.originalToClean,`backward`)??e.end,footnoteNumber:e.footnoteNumber}))}function j(e,t){if(t.length!==0)for(let n of e){let e=n.span.cleanStart,r=0,i=t.length-1;for(;r<=i;){let a=r+i>>>1,o=t[a];if(e<o.start)i=a-1;else if(e>=o.end)r=a+1;else{n.inFootnote=!0,n.footnoteNumber=o.footnoteNumber;break}}}}const M={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function N(e){let t=M[e.toLowerCase().replace(/\.$/,``)];if(t===void 0)throw Error(`Invalid month name: ${e}`);return t}function P(e){let{year:t,month:n,day:r}=e;return n!==void 0&&r!==void 0?`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`:n===void 0?String(t):`${t}-${String(n).padStart(2,`0`)}`}function F(e){let t=e.match(/\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)\.?\s+(\d{1,2}),?\s+(\d{4})\b/i);if(t){let e=N(t[1]),n=Number.parseInt(t[2],10),r={year:Number.parseInt(t[3],10),month:e,day:n};return{iso:P(r),parsed:r}}let n=e.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i);if(n){let e=N(n[1]),t=Number.parseInt(n[2],10),r={year:Number.parseInt(n[3],10),month:e,day:t};return{iso:P(r),parsed:r}}let r=e.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10),n={year:Number.parseInt(r[3],10),month:e,day:t};return{iso:P(n),parsed:n}}let i=e.match(/\b(\d{4})\b/);if(i){let e={year:Number.parseInt(i[1],10)};return{iso:P(e),parsed:e}}}function I(e){return{level:e,jurisdiction:`federal`,confidence:1}}function L(e,t){return{level:e,jurisdiction:`state`,state:t,confidence:1}}function R(e){return{level:e,jurisdiction:`state`,confidence:.7}}const z=new Map([[`U.S.`,I(`supreme`)],[`S.Ct.`,I(`supreme`)],[`L.Ed.`,I(`supreme`)],[`L.Ed.2d`,I(`supreme`)],[`S. Ct.`,I(`supreme`)],[`L. Ed.`,I(`supreme`)],[`L. Ed. 2d`,I(`supreme`)],[`U. S.`,I(`supreme`)],[`L.Ed. 2d`,I(`supreme`)],[`L. Ed.2d`,I(`supreme`)],[`F.`,I(`appellate`)],[`F.2d`,I(`appellate`)],[`F.3d`,I(`appellate`)],[`F.4th`,I(`appellate`)],[`F. App'x`,I(`appellate`)],[`F.Supp.`,I(`trial`)],[`F.Supp.2d`,I(`trial`)],[`F.Supp.3d`,I(`trial`)],[`F.Supp.4th`,I(`trial`)],[`F. Supp.`,I(`trial`)],[`F. Supp. 2d`,I(`trial`)],[`F. Supp. 3d`,I(`trial`)],[`F. Supp. 4th`,I(`trial`)],[`F.R.D.`,I(`trial`)],[`B.R.`,I(`trial`)],[`Cal.`,L(`supreme`,`CA`)],[`Cal.2d`,L(`supreme`,`CA`)],[`Cal.3d`,L(`supreme`,`CA`)],[`Cal.4th`,L(`supreme`,`CA`)],[`Cal.5th`,L(`supreme`,`CA`)],[`Cal.App.`,L(`appellate`,`CA`)],[`Cal.App.2d`,L(`appellate`,`CA`)],[`Cal.App.3d`,L(`appellate`,`CA`)],[`Cal.App.4th`,L(`appellate`,`CA`)],[`Cal.App.5th`,L(`appellate`,`CA`)],[`Cal.Rptr.`,L(`unknown`,`CA`)],[`Cal.Rptr.2d`,L(`unknown`,`CA`)],[`Cal.Rptr.3d`,L(`unknown`,`CA`)],[`N.Y.`,L(`supreme`,`NY`)],[`N.Y.2d`,L(`supreme`,`NY`)],[`N.Y.3d`,L(`supreme`,`NY`)],[`A.D.`,L(`appellate`,`NY`)],[`A.D.2d`,L(`appellate`,`NY`)],[`A.D.3d`,L(`appellate`,`NY`)],[`Misc.`,L(`trial`,`NY`)],[`Misc.2d`,L(`trial`,`NY`)],[`Misc.3d`,L(`trial`,`NY`)],[`N.Y.S.`,L(`unknown`,`NY`)],[`N.Y.S.2d`,L(`unknown`,`NY`)],[`N.Y.S.3d`,L(`unknown`,`NY`)],[`Ill.`,L(`supreme`,`IL`)],[`Ill.2d`,L(`supreme`,`IL`)],[`Ill.App.`,L(`appellate`,`IL`)],[`Ill.App.2d`,L(`appellate`,`IL`)],[`Ill.App.3d`,L(`appellate`,`IL`)],[`Ill.Dec.`,L(`unknown`,`IL`)],[`Ohio St.`,L(`supreme`,`OH`)],[`Ohio St.2d`,L(`supreme`,`OH`)],[`Ohio St.3d`,L(`supreme`,`OH`)],[`Ohio App.3d`,L(`appellate`,`OH`)],[`Pa.`,L(`supreme`,`PA`)],[`Pa. Super.`,L(`appellate`,`PA`)],[`Tex.`,L(`supreme`,`TX`)],[`Fla.`,L(`supreme`,`FL`)],[`Mass.`,L(`supreme`,`MA`)],[`Mass. App. Ct.`,L(`appellate`,`MA`)],[`A.`,R(`unknown`)],[`A.2d`,R(`unknown`)],[`A.3d`,R(`unknown`)],[`S.E.`,R(`unknown`)],[`S.E.2d`,R(`unknown`)],[`S.E.3d`,R(`unknown`)],[`S.W.`,R(`unknown`)],[`S.W.2d`,R(`unknown`)],[`S.W.3d`,R(`unknown`)],[`N.E.`,R(`unknown`)],[`N.E.2d`,R(`unknown`)],[`N.E.3d`,R(`unknown`)],[`N.W.`,R(`unknown`)],[`N.W.2d`,R(`unknown`)],[`N.W.3d`,R(`unknown`)],[`So.`,R(`unknown`)],[`So.2d`,R(`unknown`)],[`So.3d`,R(`unknown`)],[`P.`,R(`unknown`)],[`P.2d`,R(`unknown`)],[`P.3d`,R(`unknown`)]]);function ee(e){return z.get(e)}const B=/^(?:at\s+)?(\*?)(\d+)(?:[-–—]\*?(\d+))?\s*(?:(?:nn?|note)\s*\.?\s*(\d+)(?:[-–—](\d+))?)?$/i;function V(e){let t=e.trim();if(!t)return null;let n=B.exec(t);if(!n)return null;let r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=Number.parseInt(i,10),l,u=!1;if(a){u=!0;let e=Number.parseInt(a,10);if(a.length<i.length){let e=i.slice(0,i.length-a.length);l=Number.parseInt(e+a,10)}else l=e}let d=o?Number.parseInt(o,10):void 0,f=s?Number.parseInt(s,10):void 0,p={page:c,isRange:u,raw:t};return l!==void 0&&(p.endPage=l),d!==void 0&&(p.footnote=d),f!==void 0&&(p.footnoteEnd=f),r===`*`&&(p.starPage=!0),p}function H(e){if(!e||!e.trim())return;let t=e.trim();return t=t.replace(/\.\s+(?=[A-Za-z])/g,`.`),/[A-Za-z]$/.test(t)&&(/\./.test(t)||/^\d+\w*\s+[A-Z]/i.test(t))&&(t+=`.`),t}const U=new Set([`see`,`see also`,`see generally`,`cf`,`but see`,`but cf`,`compare`,`accord`,`contra`,`e.g.`,`see, e.g.`,`see also, e.g.`,`but see, e.g.`,`cf., e.g.`,`but cf., e.g.`]),W=(()=>{let e=[...U].sort((e,t)=>t.length-e.length).map(e=>e.replace(/\s+/g,`\\s+`).replace(/\./g,`\\.`));return RegExp(`^(${e.join(`|`)}),?\\s+`,`i`)})();function te(e){let t=Number.parseInt(e,10);return String(t)===e?t:e}const G=/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\.?/,ne=new Date().getFullYear(),re=new Set(`F.,F.2d,F.3d,F.4th,F.5th,F.6th,F.7th,U.S.,S. Ct.,L. Ed.,L. Ed. 2d,L. Ed. 3d,P.,P.2d,P.3d,P.4th,A.,A.2d,A.3d,A.4th,N.E.,N.E.2d,N.E.3d,N.E.4th,N.W.,N.W.2d,N.W.3d,S.E.,S.E.2d,S.E.3d,S.W.,S.W.2d,S.W.3d,S.W.4th,So.,So. 2d,So. 3d,So. 4th,F. Supp.,F. Supp. 2d,F. Supp. 3d,F. Supp. 4th,F. Supp. 5th,F. Supp. 6th,F. App'x`.split(`,`)),ie=/^(\d+(?:-\d+)?)\s+([A-Za-z0-9.\s'&]+)\s+(?:\((\d+)\s+([A-Z][A-Za-z.]+)\)\s+)?(\d+|_{3,}|-{3,})/d,ae=/^[_-]{3,}$/,oe=/,\s*(?:at\s+)?(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,se=/\(([^)]+)\)/,ce=/^(?:,\s*(?:at\s+)?\*?\d+(?:-\d+)?)*(?:\s+(?:n|note)\s*\.?\s*\d+)?\s*\(([^)]+)\)/,le=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,K=/\d\.\s+/g,ue=/[\s,]/,q=/^(?:,\s*(?:at\s+)?\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:n|note)\s*\.?\s*\d+)?)+/,J=[[/^aff'?d\s+on\s+other\s+grounds\b/i,`affirmed`],[/^affirmed\s+on\s+other\s+grounds\b/i,`affirmed`],[/^aff'?d\b/i,`affirmed`],[/^affirmed\b/i,`affirmed`],[/^rev'?d\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\s+on\s+other\s+grounds\b/i,`reversed`],[/^reversed\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\b/i,`reversed`],[/^reversed\b/i,`reversed`],[/^certiorari\s+denied\b/i,`cert_denied`],[/^cert\.\s*den(ied|\.)(?=[\s,;(]|$)/i,`cert_denied`],[/^certiorari\s+granted\b/i,`cert_granted`],[/^cert\.\s*granted\b/i,`cert_granted`],[/^overruled\s+by\b/i,`overruled`],[/^overruled\s+in\b/i,`overruled`],[/^overruling\b/i,`overruled`],[/^overruled\b/i,`overruled`],[/^vacated\s+by\b/i,`vacated`],[/^vacated\b/i,`vacated`],[/^remanded\s+for\s+reconsideration\b/i,`remanded`],[/^remanded\b/i,`remanded`],[/^modified\s+by\b/i,`modified`],[/^modified\b/i,`modified`],[/^abrogated\s+by\b/i,`abrogated`],[/^abrogated\s+in\b/i,`abrogated`],[/^abrogated\b/i,`abrogated`],[/^superseded\s+by\b/i,`superseded`],[/^superseded\b/i,`superseded`],[/^disapproved\s+on\s+other\s+grounds\b/i,`disapproved_other_grounds`],[/^disapproved\s+of\b/i,`disapproved`],[/^disapproved\b/i,`disapproved`],[/^questioned\s+by\b/i,`questioned`],[/^questioned\b/i,`questioned`],[/^distinguished\s+by\b/i,`distinguished`],[/^distinguished\b/i,`distinguished`],[/^withdrawn\b/i,`withdrawn`],[/^reinstated\b/i,`reinstated`],[/^writ\s+ref'?d\s+n\.r\.e\./i,`writ_refused`],[/^writ\s+ref'?d\s+w\.m\.j\./i,`writ_refused`],[/^writ\s+ref'?d\b/i,`writ_refused`],[/^writ\s+dism'?d\s+w\.o\.j\./i,`writ_dismissed`],[/^writ\s+dism'?d\b/i,`writ_dismissed`],[/^writ\s+denied\b/i,`writ_denied`],[/^writ\s+granted\b/i,`writ_granted`],[/^no\s+writ\b/i,`no_writ`],[/^pet\.\s+ref'?d\b/i,`pet_refused`],[/^pet\.\s+denied\b/i,`pet_denied`],[/^pet\.\s+dism'?d\b/i,`pet_dismissed`],[/^pet\.\s+granted\b/i,`pet_granted`],[/^pet\.\s+filed\b/i,`pet_filed`],[/^no\s+pet\.\s+h\./i,`no_pet`],[/^no\s+pet\./i,`no_pet`],[/^review\s+den(?:ied|\.)/i,`review_denied`],[/^review\s+granted\b/i,`review_granted`],[/^opinion\s+vacated\b/i,`opinion_vacated`]];function de(e){for(let[t,n]of J){let r=t.exec(e);if(r)return{signal:n,matchLength:r[0].length}}}const fe=new Set([`holding`,`finding`,`stating`,`noting`,`explaining`,`quoting`,`citing`,`discussing`,`describing`,`recognizing`,`applying`,`rejecting`,`adopting`,`requiring`]);function pe(e){return fe.has(e)}const me=/^([a-z]+)\b/i,he=/([A-Z][A-Za-z0-9\s.,'&()/-]+?)\s+v(?:s)?\.?\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/,ge=/\b(In\s+the\s+Matter\s+of\s+the\s+Liquidation\s+of|In\s+the\s+Matter\s+of\s+the\s+Rehabilitation\s+of|In\s+the\s+Matter\s+of\s+the\s+Receivership\s+of|In\s+the\s+Matter\s+of\s+the\s+Extradition\s+of|In\s+the\s+Matter\s+of\s+the\s+Application\s+of|In\s+the\s+Matter\s+of\s+the\s+Welfare\s+of|In\s+the\s+Matter\s+of|In\s+re\s+Petition\s+for\s+Naturalization\s+of|In\s+re\s+Termination\s+of\s+Parental\s+Rights\s+as\s+to|In\s+re\s+Termination\s+of\s+Parental\s+Rights\s+to|In\s+re\s+Termination\s+of\s+Parental\s+Rights\s+of|In\s+re\s+Marriage\s+of|In\s+re\s+Liquidation\s+of|In\s+re\s+Rehabilitation\s+of|In\s+re\s+Receivership\s+of|In\s+re\s+Naturalization\s+of|In\s+re\s+Extradition\s+of|In\s+re\s+Application\s+of|In\s+re\s+Welfare\s+of|In\s+re\s+Dependency\s+of|In\s+re\s+Paternity\s+of|In\s+re\s+Parentage\s+of|In\s+the\s+Interest\s+of|Matter\s+of\s+Liquidation\s+of|Matter\s+of\s+Rehabilitation\s+of|Commonwealth\s+of\s+Puerto\s+Rico\s+ex\s+rel\.|Government\s+of\s+the\s+Virgin\s+Islands\s+ex\s+rel\.|Commonwealth\s+ex\s+rel\.|Petition\s+for\s+Naturalization\s+of|People\s+ex\s+rel\.|District\s+of\s+Columbia\s+ex\s+rel\.|Care\s+and\s+Protection\s+of|Succession\s+of|In re|Ex parte|Matter of|Estate of|State ex rel\.|United States ex rel\.|Application of|On Petition of|Petition of|Adoption of|Conservatorship of|Guardianship of)\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/i,_e=new Set([`of`,`the`,`and`,`for`,`on`,`by`,`a`,`an`,`to`,`at`,`as`,`de`,`la`,`el`,`del`,`von`,`van`,`ex`,`rel`,`et`,`al`,`d`,`or`]),ve=/\b(?:d\/?b\/?a|a\/?k\/?a|f\/?k\/?a|n\/?k\/?a)\b/i;function Y(e){let t=e.split(/\s+/);for(let e of t){if(!e||e===`&`)continue;let t=e.toLowerCase().replace(/[.,']+$/,``);if(!_e.has(t)&&!/^[A-Z]/.test(e)&&!/^\d/.test(e))return!1}return!0}const ye=new Set([`this`,`that`,`these`,`those`,`here`,`there`,`such`,`its`,`his`,`her`,`their`,`our`]);function be(e){let t=e.replace(/\s*\d{1,2}\/\d{1,2}\/\d{4}\s*$/,``).trim();return t=t.replace(/\s*\d{4}\s*$/,``).trim(),t=t.replace(/\s*,?\s*\d{1,2}\s*,?\s*$/,``).trim(),t=t.replace(RegExp(`\\s*${G.source}\\s*$`,`i`),``).trim(),t=t.replace(/,\s*$/,``).trim(),t&&/[A-Za-z]/.test(t)?t:void 0}const xe=new Set(`acad.acct.accts.admin.adm.advert.advoc.aff.affs.afr.agric.all.alt.am.ann.app.arb.assoc.assocs.atl.auth.auto.ave.bankr.behav.bd.bor.brit.broad.bhd.bros.bldg.bull.bus.can.cap.cas.cath.ctr.ctrs.cent.chem.child.chron.coal.coll.com.comm.compar.comp.comput.condo.conf.cong.consol.const.constr.cont.coop.corp.corps.corr.cosm.couns.cntys.cnty.crim.def.delinq.det.dev.dig.dir.disc.disp.distrib.dist.div.econ.educ.elec.emp.eng.enter.ent.equal.equip.est.eur.exam.exch.exec.expl.exp.fac.fam.fams.fed.fid.fin.found.gen.glob.grp.guar.hist.hosp.hous.hum.immigr.imp.inc.indem.indep.indus.info.inj.inst.ins.intell.intel.int.inv.invs.jurid.just.juv.lab.law.liab.ltd.loc.mach.mag.maint.mgmt.mgt.mfr.mfrs.mfg.mar.mkt.mktg.matrim.mech.med.merch.metro.min.misc.mod.mortg.mun.mut.nat.negl.negot.nw.no.nos.off.org.orgs.pac.pat.pers.pharm.phil.plan.pol.prac.pres.priv.prob.proc.prod.pro.prop.psych.pub.rec.reg.regul.rehab.rel.rels.rep.reprod.rsch.rsrv.resol.res.resp.rest.ret.rd.sav.sch.schs.sci.sec.serv.servs.sess.soc.solic.spec.stat.subcomm.sur.surv.sys.tchr.tech.telecomm.tel.temp.twp.transcon.transp.treas.tr.trs.tpk.unemplmt.unif.univ.urb.util.veh.vehs.vill.voc.whse.whol.litig.n.s.e.w.m.ne.se.sw.is.mt.ft.pt.rt.st.blvd.sq.hwy.pkwy.hts.v.vs.ct.cir.supp.cl.jud.super.sup.magis.mil.terr.ala.ariz.ark.cal.colo.conn.del.fla.ga.haw.ida.ill.ind.kan.ky.la.me.md.mass.mich.minn.miss.mo.mont.neb.nev.okla.or.pa.tenn.tex.vt.va.wash.wis.wyo.mr.mrs.ms.dr.jr.sr.prof.rev.hon.sgt.capt.col.lt.ed.op.ad.dep.ass.ry.co.cmty.cty.envtl.gend.par.prot.ref.sol.adver.admr.admx.assn.commcn.commn.commr.contl.dept.empr.empt.engg.engr.entmt.envt.examr.exr.exx.fedn.govt.intl.invr.meml.natl.profl.pship.publg.publn.regl.secy.sholder.socy.tp.taxn.enft.rts.atty.attys.petr.respt.commrs.hldgs.hldg.props.prods.ents.invests.scis.emps.sols.corrs.telecomms.examrs.cmtys.colls.cts.amends.civ.enf.advis.utils.lic.bur.insp.conserv.retire.discipl.supers.edn.coun.stds.procs.quals.boro.commw.adv.comn.irrig.reclam.rptr.vet.trib.adj.vol.pty.poly.stud.libr.refin.socio.laby.naty.wkly.appx.comr.comrs.reins`.split(`.`));function Se(e,t){let n=t;for(;n>0&&/[-A-Za-z.']/.test(e[n-1]);)n--;let r=e.substring(n,t);if(!r)return!1;let i=r.replace(/['.]/g,``).toLowerCase();return!!(xe.has(i)||i.length===1&&/[a-z]/i.test(i)||/\.[A-Za-z]/.test(r))}const Ce=/\bId\.\s+/g,we=/\(\s*(?:quoting|citing|cited\s+in|quoted\s+in|accord|discussing|noting|explaining|describing|recognizing|applying|rejecting|adopting|requiring|overruling|overruled\s+by|abrogated\s+by)(?:,\s*e\.g\.,?)?\s+/gi,Te=/[.)]\s+(?=[A-Z])/g;function Ee(e,t,n=150,r){let i=Math.max(0,t-n),a=e.substring(i,t),o=i,s=-1,c;if(r?.originalText&&r.transformationMap){let{originalText:e,transformationMap:n}=r,a=n.cleanToOriginal.get(i)??i,o=n.cleanToOriginal.get(t)??t;if(o>a){let r=e.substring(a,o),c=/\n[ \t\r]*\n/g,l;for(;(l=c.exec(r))!==null;){let e=a+l.index+l[0].length,r;for(let t=0;t<10&&(r=n.originalToClean.get(e+t),r===void 0);t++);if(r!==void 0&&r>=i&&r<=t){let e=r-i;e>s&&(s=e)}}}}for(K.lastIndex=0;(c=K.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(Ce.lastIndex=0;(c=Ce.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(we.lastIndex=0;(c=we.exec(a))!==null;){let e=c.index+c[0].length;e>s&&(s=e)}for(Te.lastIndex=0;(c=Te.exec(a))!==null;){if(a[c.index]===`.`&&Se(a,c.index))continue;let e=c.index+c[0].length;e>s&&(s=e)}s!==-1&&(a=a.substring(s),o=i+s);let l=he.exec(a);if(l&&!l[0].includes(`;`)){let e=l[1].trim(),t=0;if(!Y(e)){let n=e.split(/\s+/),r=n[0]??``,i=r.toLowerCase().replace(/[.,']+$/,``);if(!(/^[A-Z]/.test(r)&&!_e.has(i)&&!ye.has(i)&&ve.test(e))&&!W.exec(e))for(let r=1;r<n.length;r++){let i=n.slice(r).join(` `);if(/^[A-Z]/.test(i)&&Y(i)){t=n.slice(0,r).join(` `).length+1,e=i;break}}}let n=l[0].match(/\bv(?:s)?\.\s/g),r=l[2].trim();if(n&&n.length>=2){let e=l[2].indexOf(`,`);e!==-1&&(r=l[2].substring(0,e).trim())}return{caseName:`${e} v. ${r}`,nameStart:o+l.index+t}}let u=ge.exec(a);if(u&&!u[0].includes(`;`))return{caseName:`${u[1]} ${u[2].trim()}`,nameStart:o+u.index};let d=a.replace(/,\s*$/,``),f=d.length-d.trimStart().length,p=d.substring(f),m=0,h=W.exec(p);h&&(m=h[0].length,p=p.substring(m));let g=p.trim();if(g.length>0&&Y(g)){let e=(g.split(/\s+/)[0]??``).toLowerCase().replace(/[.,']+$/,``);if(!ye.has(e)&&!g.includes(`;`))return{caseName:g,nameStart:o+f+m}}}function De(e,t,n=500){let r=[],i=[],a=t,o=Math.min(e.length,t+n),s,c=e.substring(a,o),l=q.exec(c);for(l&&(a+=l[0].length);a<o;){for(;a<o&&ue.test(e[a]);)a++;if(a>=o||e[a]!==`(`){let t=e.substring(a,o),n=de(t);if(n){s&&i.push({signal:s,nextParenIndex:-1}),s={text:t.substring(0,n.matchLength).replace(/\s+$/,``),normalized:n.signal,start:a,end:a+n.matchLength},a+=n.matchLength;continue}break}let t=a,n=0,c=a+1;for(;a<o;){let o=e[a];if(o===`(`)n++;else if(o===`)`&&(n--,n===0)){a++;let n=e.substring(c,a-1).trim();n.length>0&&(r.push({text:n,start:t,end:a}),s&&=(i.push({signal:s,nextParenIndex:r.length-1}),void 0));break}a++}if(n>0)break}return s&&i.push({signal:s,nextParenIndex:-1}),{parens:r,signals:i}}function X(e){let t={},n=F(e);n&&(t.date=n,t.year=n.parsed.year);let r=e;if(t.year){let n=String(t.year),i=e.lastIndexOf(n);if(i!==-1){let a=i+n.length,o=e.substring(a),s=/^\s*,\s*(.+?)\s*$/.exec(o);if(s){let n=s[1],i=de(n);if(i){let o=n.substring(0,i.matchLength),s=e.indexOf(o,a);t.internalHistory={signal:i.signal,rawSignal:o,start:s===-1?a:s,end:(s===-1?a:s)+o.length},r=e.substring(0,a)}}}}let i=be(r);if(i){t.court=i;let n=e.indexOf(i);n!==-1&&(t.courtStart=n,t.courtEnd=n+i.length)}if(t.year){let n=String(t.year),r=e.lastIndexOf(n);r!==-1&&(t.yearStart=r,t.yearEnd=r+n.length)}return/\ben banc\b/i.test(e)?t.disposition=`en banc`:/\bper curiam\b/i.test(e)&&(t.disposition=`per curiam`),t}function Oe(e){let t=me.exec(e);if(t){let n=t[1].toLowerCase();if(pe(n))return{kind:`explanatory`,text:e,type:n}}let n=X(e);return n.year||n.date||n.disposition?{kind:`metadata`,...n}:{kind:`explanatory`,text:e,type:`other`}}function Z(e){let t=e;t=t.replace(/\bet\s+al\.?/gi,``),t=t.replace(/\s+(?:d\/b\/a|[fna]\/k\/a)\b.*/gi,``),t=t.replace(/\s+aka\b.*/gi,``);let n=``;for(;n!==t;)n=t,t=t.replace(/,?\s*(Inc|LLC|Corp|Ltd|Co|LLP|LP|P\.C)\.?$/gi,``);return t=t.replace(/^(The|A|An)\s+/i,``),t=t.replace(/\s+/g,` `),t.trim().toLowerCase()}function ke(e){let t;for(let t of`In the Matter of the Liquidation of,In the Matter of the Rehabilitation of,In the Matter of the Receivership of,In the Matter of the Extradition of,In the Matter of the Application of,In the Matter of the Welfare of,In the Matter of,In re Petition for Naturalization of,In re Termination of Parental Rights as to,In re Termination of Parental Rights to,In re Termination of Parental Rights of,In re Marriage of,In re Liquidation of,In re Rehabilitation of,In re Receivership of,In re Naturalization of,In re Extradition of,In re Application of,In re Welfare of,In re Dependency of,In re Paternity of,In re Parentage of,In the Interest of,In re,Ex parte,Matter of Liquidation of,Matter of Rehabilitation of,Matter of,Commonwealth of Puerto Rico ex rel.,Government of the Virgin Islands ex rel.,Commonwealth ex rel.,State ex rel.,United States ex rel.,People ex rel.,District of Columbia ex rel.,Petition for Naturalization of,Application of,On Petition of,Petition of,Adoption of,Conservatorship of,Guardianship of,Estate of,Care and Protection of,Succession of`.split(`,`)){let n=RegExp(`^(${t})\\s+(.+)$`,`i`).exec(e);if(n){let t=n[1],r=n[2];if(/\s+v\.?\s+/i.test(r)){let t=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(t){let e=t[1].trim(),n=t[2].trim();return{plaintiff:e,plaintiffNormalized:Z(e),defendant:n,defendantNormalized:Z(n)}}}else return{plaintiff:e,plaintiffNormalized:Z(r),proceduralPrefix:t}}}let n=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(n){let e=n[1].trim(),r=n[2].trim(),i=e.match(W)??e.match(/^(Also|In(?!\s+re\b))\s+/i);if(i){let n=i[1].toLowerCase();if(U.has(n))t=n;else{let e=n.replace(/\.$/,``);U.has(e)&&(t=e)}e=e.substring(i[0].length).trim()}return{plaintiff:e||n[1].trim(),plaintiffNormalized:Z(e||n[1].trim()),defendant:r,defendantNormalized:Z(r),signal:t}}return{}}function Ae(t,n,r,i){let{text:a,span:c}=t,l=ie.exec(a);if(!l)throw Error(`Failed to parse case citation: ${a}`);let u=te(l[1]),d=l[2].trim(),f=l[3]?Number.parseInt(l[3],10):void 0,p=l[4]||void 0,m=l[5],h=ae.test(m),g=h?void 0:Number.parseInt(m,10),_=h?!0:void 0,v=oe.exec(a),y=v?V(v[1])??void 0:void 0,b=y?.page,x={};if(l.indices){if(l.indices[1]&&(x.volume=o(c.cleanStart,l.indices[1],n)),l.indices[2]){let[e,t]=l.indices[2],r=a.substring(e,t),i=r.length-r.trimStart().length,s=r.length-r.trimEnd().length;x.reporter=o(c.cleanStart,[e+i,t-s],n)}l.indices[5]&&(x.page=o(c.cleanStart,l.indices[5],n))}v?.indices?.[1]&&(x.pincite=o(c.cleanStart,v.indices[1],n));let S,C,w,T,E,D,O,k,A=se.exec(a);if(A&&!f&&(O=A[1],k=X(O),S=k.year,C=k.court,w=k.date,T=k.disposition),r&&!O){let e=r.substring(c.cleanEnd),t=ce.exec(e);if(t&&(O=t[1],k=X(O),S=k.year,C=k.court,w=k.date,T=k.disposition),b===void 0){let t=le.exec(e);t&&(y||=V(t[1])??void 0,b=y?.page,t.indices?.[1]&&(x.pincite=o(c.cleanEnd,t.indices[1],n)))}}let j,M,N;if(r){N=De(r,c.cleanEnd),M=N.parens;let e=O?M.slice(1):M;for(let t of e){let e=Oe(t.text);if(e.kind===`metadata`)e.court&&(!C||C===T)&&(C=e.court),e.year&&!S&&(S=e.year,w=e.date),e.disposition&&!T&&(T=e.disposition);else{j??=[];let r=s({cleanStart:t.start,cleanEnd:t.end},n);j.push({text:e.text,type:e.type,span:{cleanStart:t.start,cleanEnd:t.end,originalStart:r.originalStart,originalEnd:r.originalEnd}})}}}if(M&&M.length>0&&(C||S)){let e=O?M[0]:void 0;if(e){let t=s({cleanStart:e.start,cleanEnd:e.end},n);if(x.metadataParenthetical={cleanStart:e.start,cleanEnd:e.end,originalStart:t.originalStart,originalEnd:t.originalEnd},k){let t=e.start+1;if(k.courtStart!==void 0){let e=t+k.courtStart,r=t+k.courtEnd,i=s({cleanStart:e,cleanEnd:r},n);x.court={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}if(k.yearStart!==void 0){let e=t+k.yearStart,r=t+k.yearEnd,i=s({cleanStart:e,cleanEnd:r},n);x.year={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}}let P;if(r&&k?.internalHistory&&M&&M.length>0){let e=O?M[0]:void 0;if(e){let t=e.start+1,r=k.internalHistory,i=t+r.start,a=t+r.end,{originalStart:o,originalEnd:c}=s({cleanStart:i,cleanEnd:a},n);P??=[],P.push({signal:r.signal,rawSignal:r.rawSignal,signalSpan:{cleanStart:i,cleanEnd:a,originalStart:o,originalEnd:c},order:0})}}if(r&&N&&N.signals.length>0)for(let e=0;e<N.signals.length;e++){let{signal:t}=N.signals[e];P??=[];let{originalStart:r,originalEnd:i}=s({cleanStart:t.start,cleanEnd:t.end},n);P.push({signal:t.normalized,rawSignal:t.text,signalSpan:{cleanStart:t.start,cleanEnd:t.end,originalStart:r,originalEnd:i},order:P.length})}let F=ee(d);!C&&F?.level===`supreme`&&F?.jurisdiction===`federal`&&(C=`scotus`);let I;if(r&&(I=Ee(r,c.cleanStart,void 0,{originalText:i,transformationMap:n}),I)){E=I.caseName;let e=M&&M.length>0?M[M.length-1].end:c.cleanEnd,t=I.nameStart,r=e;D={cleanStart:t,cleanEnd:r,originalStart:n.cleanToOriginal.get(t)??t,originalEnd:n.cleanToOriginal.get(r)??r};let i=I.nameStart,a=i+E.length,o=s({cleanStart:i,cleanEnd:a},n);x.caseName={cleanStart:i,cleanEnd:a,originalStart:o.originalStart,originalEnd:o.originalEnd}}let L,R,z,B,U,G;if(E){let e=ke(E);if(L=e.plaintiff,R=e.plaintiffNormalized,z=e.defendant,B=e.defendantNormalized,U=e.proceduralPrefix,G=e.signal,L&&z){let e=`${L} v. ${z}`;if(e!==E&&D&&r){E=e;let t=r.substring(D.cleanStart,c.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let e=t.substring(0,i.index).lastIndexOf(L);if(e!==-1){let t=D.cleanStart+e,r=n.cleanToOriginal.get(t)??t;D={...D,cleanStart:t,originalStart:r}}}if(I){let e=D.cleanStart,t=e+E.length,r=s({cleanStart:e,cleanEnd:t},n);x.caseName={cleanStart:e,cleanEnd:t,originalStart:r.originalStart,originalEnd:r.originalEnd}}}}if(L&&I&&r){let e=D?.cleanStart??I.nameStart,t=r.substring(e,c.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let r=t.substring(0,i.index).lastIndexOf(L);if(r!==-1){let t=e+r,i=t+L.length,a=s({cleanStart:t,cleanEnd:i},n);x.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}if(z){let r=i.index+i[0].length,a=t.substring(r).indexOf(z);if(a!==-1){let t=e+r+a,i=t+z.length,o=s({cleanStart:t,cleanEnd:i},n);x.defendant={cleanStart:t,cleanEnd:i,originalStart:o.originalStart,originalEnd:o.originalEnd}}}}else{let r=t.indexOf(L);if(r!==-1){let t=e+r,i=t+L.length,a=s({cleanStart:t,cleanEnd:i},n);x.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}}}if(G&&D&&r&&I){let e=r.substring(I.nameStart,c.cleanStart),t=W.exec(e);if(t){let e=I.nameStart,r=e+t[1].length,i=s({cleanStart:e,cleanEnd:r},n);x.signal={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}let{originalStart:K,originalEnd:ue}=s(c,n),q=.2,J=e.s()?.byAbbreviation.get(d.toLowerCase());return(J&&J.length>0||re.has(d))&&(q+=.3),S!==void 0&&S<=ne&&(q+=.2),E&&(q+=.15),C&&(q+=.1),q=Math.round(Math.min(q,1)*100)/100,_&&(q=Math.max(q,.5)),{type:`case`,text:a,span:{cleanStart:c.cleanStart,cleanEnd:c.cleanEnd,originalStart:K,originalEnd:ue},confidence:q,matchedText:a,processTimeMs:0,patternsChecked:1,volume:u,reporter:d,page:g,nominativeVolume:f,nominativeReporter:p,pincite:b,pinciteInfo:y,court:C,normalizedCourt:H(C),year:S,hasBlankPage:_,date:w,fullSpan:D,caseName:E,disposition:T,parentheticals:j,subsequentHistoryEntries:P,plaintiff:L,plaintiffNormalized:R,defendant:z,defendantNormalized:B,proceduralPrefix:U,inferredCourt:F,signal:G,spans:x}}const Q=`${String.raw`(?:art(?:icle)?\.?|amend(?:ment)?\.?|amdt\.?)\s+([IVX]+|\d+)`}${String.raw`(?:[,;]\s*§\s*([\w-]+))?`}${String.raw`(?:[,;]\s*cl\.?\s*(\d+))?`}`,je=new RegExp(Q,`id`),Me=[{id:`us-constitution`,regex:new RegExp(String.raw`\b(?:United\s+States\s+Constitution|U\.?\s*S\.?\s+Const\.?),?\s+${Q}`,`gi`),description:`U.S. Constitution citations (e.g., "U.S. Const. art. III, § 2", "U.S. Const. amend. XIV")`,type:`constitutional`},{id:`state-constitution`,regex:new RegExp(String.raw`\b(?:Ala|Alaska|Ariz|Ark|Cal(?:if)?|Colo|Conn|Del|Fla|Ga|Haw|Idaho|Ill|Ind|Iowa|Kan|Ky|La|Me|Md|Mass|Mich|Minn|Miss|Mo|Mont|Neb|Nev|N\.?\s*H|N\.?\s*J|N\.?\s*M|N\.?\s*Y|N\.?\s*C|N\.?\s*D|Ohio|Okla|Or(?:e)?|Pa|R\.?\s*I|S\.?\s*C|S\.?\s*D|Tenn|Tex|Utah|Vt|W\.?\s*Va|Va|Wash|Wis|Wyo)\.?\s+Const\.?,?\s+${Q}`,`gi`),description:`State constitution citations (e.g., "Cal. Const. art. I, § 7", "N.Y. Const. art. VI, § 20")`,type:`constitutional`},{id:`bare-constitution`,regex:new RegExp(String.raw`(?<!\.\s)(?<![A-Z]\s)\bConst\.?,?\s+${Q}`,`g`),description:`Bare constitutional citations without jurisdiction prefix (e.g., "Const. art. I, § 8, cl. 3")`,type:`constitutional`},{id:`bare-article`,regex:new RegExp(String.raw`(?<!Const\.?,?\s)\bArt\.?\s+[IVX]+[,;]\s*§\s*[\w-]+(?:[,;]\s*cl\.?\s*\d+)?`,`g`),description:`Bare article references without "Const." prefix (e.g., "Art. I, §8, cl. 3")`,type:`constitutional`}],Ne={I:1,II:2,III:3,IV:4,V:5,VI:6,VII:7,VIII:8,IX:9,X:10,XI:11,XII:12,XIII:13,XIV:14,XV:15,XVI:16,XVII:17,XVIII:18,XIX:19,XX:20,XXI:21,XXII:22,XXIII:23,XXIV:24,XXV:25,XXVI:26,XXVII:27};function Pe(e){let t=e.toUpperCase();if(t in Ne)return Ne[t];let n=Number.parseInt(e,10);return Number.isNaN(n)?void 0:n}const Fe={ala:`AL`,alaska:`AK`,ariz:`AZ`,ark:`AR`,cal:`CA`,calif:`CA`,colo:`CO`,conn:`CT`,del:`DE`,fla:`FL`,ga:`GA`,haw:`HI`,idaho:`ID`,ill:`IL`,ind:`IN`,iowa:`IA`,kan:`KS`,ky:`KY`,la:`LA`,me:`ME`,md:`MD`,mass:`MA`,mich:`MI`,minn:`MN`,miss:`MS`,mo:`MO`,mont:`MT`,neb:`NE`,nev:`NV`,"n.h":`NH`,"n.j":`NJ`,"n.m":`NM`,"n.y":`NY`,"n.c":`NC`,"n.d":`ND`,ohio:`OH`,okla:`OK`,or:`OR`,ore:`OR`,pa:`PA`,"r.i":`RI`,"s.c":`SC`,"s.d":`SD`,tenn:`TN`,tex:`TX`,utah:`UT`,vt:`VT`,va:`VA`,wash:`WA`,"w.va":`WV`,wis:`WI`,wyo:`WY`},Ie=/amend|amdt/i,Le=/^([A-Za-z]+(?:\.\s*[A-Za-z]+)?(?:\.\s*[A-Za-z]+)?)\.?\s+Const/i;function Re(e){let t=Le.exec(e);if(!t)return;let n=t[1].replace(/\s+/g,``).replace(/\.$/g,``).toLowerCase();if(n in Fe)return Fe[n]}function ze(e,t){let{text:n,span:r}=e,i=je.exec(n),a,c,l,u;if(i){let e=Pe(i[1]);Ie.test(i[0])?c=e:a=e,l=i[2]||void 0,u=i[3]?Number.parseInt(i[3],10):void 0}let d;switch(e.patternId){case`us-constitution`:d=`US`;break;case`state-constitution`:d=Re(n);break;default:d=void 0;break}let{originalStart:f,originalEnd:p}=s(r,t),m;m=e.patternId===`bare-article`?.5:e.patternId===`bare-constitution`?.7:l?.95:.9;let h=n.endsWith(`.`)?n.slice(0,-1):n,g={};if(d===`US`){let e=n.indexOf(`U.S.`);e!==-1&&(g.jurisdiction=o(r.cleanStart,[e,e+4],t))}else if(d&&e.patternId===`state-constitution`){let e=Le.exec(n);if(e){let n=e[1].length+1;g.jurisdiction=o(r.cleanStart,[0,n],t)}}return i?.indices&&(Ie.test(i[0])?i.indices[1]&&(g.amendment=o(r.cleanStart,i.indices[1],t)):i.indices[1]&&(g.article=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.section=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&(g.clause=o(r.cleanStart,i.indices[3],t))),{type:`constitutional`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:f,originalEnd:p},confidence:m,matchedText:h,processTimeMs:0,patternsChecked:1,jurisdiction:d,article:a,amendment:c,section:l,clause:u,spans:g}}function Be(e,t,n,r){let{text:i,span:a}=e,o=/\bNo\.\s+([\d]+(?:-[\w\d]+)*)\s+\(([^)]+)\)/.exec(i);if(!o)return;let c=o[1],l=o[2],u=Ee(n,a.cleanStart,void 0,{originalText:r,transformationMap:t});if(!u)return;let d=ke(u.caseName),f=d.plaintiff&&d.defendant,p=!!d.proceduralPrefix;if(!f&&!p)return;let m=X(l),{originalStart:h,originalEnd:g}=s(a,t),_=u.nameStart;if(d.plaintiff&&d.defendant){let e=n.substring(_,a.cleanStart),t=/\s+v\.?\s+/i.exec(e);if(t){let n=e.substring(0,t.index).lastIndexOf(d.plaintiff);n!==-1&&(_+=n)}}let v=a.cleanEnd,y=t.cleanToOriginal.get(_)??_,b=t.cleanToOriginal.get(v)??v;return{type:`docket`,text:i,matchedText:i,span:{cleanStart:a.cleanStart,cleanEnd:a.cleanEnd,originalStart:h,originalEnd:g},confidence:.7,processTimeMs:0,patternsChecked:1,docketNumber:c,caseName:d.plaintiff&&d.defendant?`${d.plaintiff} v. ${d.defendant}`:u.caseName,plaintiff:d.plaintiff,defendant:d.defendant,plaintiffNormalized:d.plaintiffNormalized,defendantNormalized:d.defendantNormalized,proceduralPrefix:d.proceduralPrefix,court:m.court,normalizedCourt:H(m.court),year:m.year,date:m.date,fullSpan:{cleanStart:_,cleanEnd:v,originalStart:y,originalEnd:b}}}function Ve(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Federal Register citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`federalRegister`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}function He(e,t,n){let{text:r,span:i}=e,a=/^(\d+(?:-\d+)?)\s+([A-Za-z.\s]+?)\s+(\d+)/d.exec(r);if(!a)throw Error(`Failed to parse journal citation: ${r}`);let c=a[1],l=/^\d+$/.test(c)?Number.parseInt(c,10):c,u=a[2].trim(),d=Number.parseInt(a[3],10),f,p;n===void 0?(f=r.slice(a[0].length),p=i.cleanStart+a[0].length):(f=n.slice(i.cleanEnd,i.cleanEnd+30),p=i.cleanEnd);let m=n?n.slice(i.cleanStart,i.cleanEnd+30):r,h=/^,\s*(\d+)/d.exec(f),g=h?Number.parseInt(h[1],10):void 0,_=/\((?:.*?\s)?(\d{4})\)/d.exec(m),v=_?Number.parseInt(_[1],10):void 0,y;a.indices&&(y={volume:o(i.cleanStart,a.indices[1],t),journal:o(i.cleanStart,a.indices[2],t),page:o(i.cleanStart,a.indices[3],t)},h?.indices?.[1]&&(y.pincite=o(p,h.indices[1],t)),_?.indices?.[1]&&(y.year=o(i.cleanStart,_.indices[1],t)));let{originalStart:b,originalEnd:x}=s(i,t);return{type:`journal`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:b,originalEnd:x},confidence:.6,matchedText:r,processTimeMs:0,patternsChecked:1,volume:l,journal:u,abbreviation:u,page:d,pincite:g,year:v,spans:y}}const Ue=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d;function We(e,t,n){let{text:r,span:i}=e,a,c,l,u=!1,d,f=/^(\d{4})-([A-Z]+)-(\d+)-([A-Z]+)$/d.exec(r);if(f){if(a=Number.parseInt(f[1],10),c=`${f[2]}-${f[4]}`,l=f[3],f.indices){let e=f.indices[2],n=f.indices[4],r=[e[0],n[1]];d={year:o(i.cleanStart,f.indices[1],t),court:o(i.cleanStart,r,t),documentNumber:o(i.cleanStart,f.indices[3],t)}}}else{let e=/^(\d{4})[-\s]+(.+?)[-\s]+(\d+)(-U)?$/d.exec(r);if(!e)throw Error(`Failed to parse neutral citation: ${r}`);a=Number.parseInt(e[1],10),c=e[2],l=e[3],e[4]===`-U`&&(u=!0),e.indices&&(d={year:o(i.cleanStart,e.indices[1],t),court:o(i.cleanStart,e.indices[2],t),documentNumber:o(i.cleanStart,e.indices[3],t)})}let p,m;if(n){let e=n.substring(i.cleanEnd),r=Ue.exec(e);r&&(m=V(r[1])??void 0,p=m?.page,r.indices?.[1]&&(d||={},d.pincite=o(i.cleanEnd,r.indices[1],t)))}let{originalStart:h,originalEnd:g}=s(i,t);return{type:`neutral`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:h,originalEnd:g},confidence:1,matchedText:r,processTimeMs:0,patternsChecked:1,year:a,court:c,documentNumber:l,...u?{unpublished:!0}:{},pincite:p,pinciteInfo:m,spans:d}}function Ge(e,t){let{text:n,span:r}=e,i=/Pub\.\s?L\.(?:\s?No\.)?\s?(\d+)-(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse public law citation: ${n}`);let a=Number.parseInt(i[1],10),c=Number.parseInt(i[2],10),l;i.indices&&(l={congress:o(r.cleanStart,i.indices[1],t),lawNumber:o(r.cleanStart,i.indices[2],t)});let{originalStart:u,originalEnd:d}=s(r,t);return{type:`publicLaw`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,congress:a,lawNumber:c,spans:l}}function Ke(e,t,n){let{text:r,span:i}=e,a=/([Ii])(?:d|bid)(\.)(,?)\s*(?:at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(r);if(!a)throw Error(`Failed to parse Id. citation: ${r}`);let c=a[1],l=a[3]===`,`,u=a[4]?V(a[4])??void 0:void 0,d=u?.page,f;a[4]&&a.indices?.[4]&&(f={pincite:o(i.cleanStart,a.indices[4],t)});let p=1;if(c===`i`&&(p=.85),l&&(p=Math.min(p,.9)),n&&i.cleanStart>0){let e=n.slice(Math.max(0,i.cleanStart-20),i.cleanStart).trimEnd();e.length>0&&(e[e.length-1],/[.;)\]—:]$/.test(e)||(p=Math.min(p,.4)))}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`id`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:p,matchedText:r,processTimeMs:0,patternsChecked:1,pincite:d,pinciteInfo:u,spans:f}}function qe(e,t){let{text:n,span:r}=e,i=/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n),a=i||/supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?|\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n);if(!a)throw Error(`Failed to parse supra citation: ${n}`);let c,l,u,d;if(i)c=i[1],l=i[3]?V(i[3])??void 0:void 0,u=.9,i[3]&&(d=3);else{c=void 0;let e=a[2],t=a[3],n=e??t;l=n?V(n)??void 0:void 0,u=.8,e?d=2:t&&(d=3)}let f=l?.page,p;d!==void 0&&a.indices?.[d]&&(p={pincite:o(r.cleanStart,a.indices[d],t)});let{originalStart:m,originalEnd:h}=s(r,t);return{type:`supra`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:m,originalEnd:h},confidence:u,matchedText:n,processTimeMs:0,patternsChecked:1,partyName:c,pincite:f,pinciteInfo:l,spans:p}}function Je(e,t){let{text:n,span:r}=e,i=/(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d.exec(n);if(!i)throw Error(`Failed to parse short-form case citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=i[2].trim(),u=V(i[3])??void 0,d=u?.page,f;i.indices?.[3]&&(f={pincite:o(r.cleanStart,i.indices[3],t)});let{originalStart:p,originalEnd:m}=s(r,t),h=.4;return re.has(l)&&(h+=.3),{type:`shortFormCase`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:h,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,reporter:l,pincite:d,pinciteInfo:u,spans:f}}const Ye=/^([^(]+?)\s*((?:\([^)]*\))*)$/,Xe=/\s*et\s+seq\.?\s*$/i;function $(e){let t=e.replace(Xe,``),n=t!==e,r=t.trim(),i=Ye.exec(r),a=i?.[2];return i!==null&&a?{section:i[1].trim(),subsection:a,hasEtSeq:n}:{section:r,hasEtSeq:n}}const Ze=/^(?:(\d+)\s+)?(.+?)\s*§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)$/d;function Qe(t,n){let{text:r,span:i}=t,a=Ze.exec(r),c,l,u;a?(c=a[1]?Number.parseInt(a[1],10):void 0,l=a[2].trim(),u=a[3]):(l=r,u=``);let d=e.n(l),f=d?.jurisdiction,p=l,{section:m,subsection:h,hasEtSeq:g}=$(u),{originalStart:_,originalEnd:v}=s(i,n),y;if(a?.indices&&(y={},a.indices[1]&&(y.title=o(i.cleanStart,a.indices[1],n)),a.indices[2]&&(y.code=o(i.cleanStart,a.indices[2],n)),a.indices[3]&&m)){let e=a.indices[3][0],t=m.replace(/[.,;:]\s*$/,``).length;if(y.section=o(i.cleanStart,[e,e+t],n),h){let t=e+m.length;y.subsection=o(i.cleanStart,[t,t+h.length],n)}}let b=r.includes(`§`),x;return x=d&&b?.95:d?.85:b?.6:.4,c!==void 0&&(x+=.05),h&&(x+=.05),x=Math.min(x,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:_,originalEnd:v},confidence:x,matchedText:r,processTimeMs:0,patternsChecked:1,title:c,code:p,section:m,subsection:h,pincite:h,jurisdiction:f,hasEtSeq:g||void 0,spans:y}}const $e=/^(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/(.+)$/d;function et(e,t){let{text:n,span:r}=e,i=$e.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=n,l=``);let{section:u,subsection:d,hasEtSeq:f}=$(l),{originalStart:p,originalEnd:m}=s(r,t),h=u.replace(/[.,;:]\s*$/,``).length,g;if(i?.indices&&(g={},i.indices[1]&&(g.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0];if(g.section=o(r.cleanStart,[e,e+h],t),d){let n=e+u.length;g.subsection=o(r.cleanStart,[n,n+d.length],t)}}let _=i?.95:.3;return d&&(_+=.05),_=Math.min(_,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:_,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:i?`IL`:void 0,hasEtSeq:f||void 0,spans:g}}const tt=/^(\d+)\s+(\S+(?:\.\S+)*)\s*§§?\s*(.+)$/d,nt=/^(\d+)\s+(\S+(?:\.\S+)*)\s+(?:Part|pt\.)\s+(.+)$/d;function rt(e,t){let{text:n,span:r}=e,i=tt.exec(n)??nt.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=e.patternId===`cfr`?`C.F.R.`:`U.S.C.`,l=n,a=void 0);let{section:u,subsection:d,hasEtSeq:f}=$(l),{originalStart:p,originalEnd:m}=s(r,t),h;if(i?.indices&&(h={},i.indices[1]&&(h.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(h.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0],n=u.replace(/[.,;:]\s*$/,``).length;if(h.section=o(r.cleanStart,[e,e+n],t),d){let n=e+u.length;h.subsection=o(r.cleanStart,[n,n+d.length],t)}}let g=.95;return a!==void 0&&(g+=.05),d&&(g+=.05),g=Math.min(g,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:g,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:`US`,hasEtSeq:f||void 0,spans:h}}const it=/^(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|Va\.?|Ala(?:bama)?\.?)\s+(.*?)\s*§§?\s*(.+)$/ds,at=/^(.*?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*(.+)$/d,ot={"n.y.":`NY`,"n.y":`NY`,ny:`NY`,"cal.":`CA`,cal:`CA`,"california.":`CA`,california:`CA`,"tex.":`TX`,tex:`TX`,"texas.":`TX`,texas:`TX`,"md.":`MD`,md:`MD`,"va.":`VA`,va:`VA`,"ala.":`AL`,ala:`AL`,"alabama.":`AL`,alabama:`AL`};function st(e){return ot[e.toLowerCase().replace(/\s+/g,``)]}function ct(e){return e.replace(/^\s*Code\s+Ann\.\s*,\s*/i,``).replace(/^\s*Code\s*,\s*/i,``).replace(/\s+Code\s*$/i,``).replace(/\s+Ann\.?\s*$/i,``).replace(/,\s*$/,``).trim()}function lt(t,n){let{text:r,span:i}=t,a,c,l,u=null,d=null;if(t.patternId===`mass-chapter`)u=at.exec(r),u?(a=`MA`,c=u[2],l=u[3]):(c=r,l=``);else if(d=it.exec(r),d){a=st(d[1]);let t=d[2],n=ct(t);c=a&&e.r(a,n)?n:t.trim(),l=d[3]}else c=r,l=``;let{section:f,subsection:p,hasEtSeq:m}=$(l),{originalStart:h,originalEnd:g}=s(i,n),_=f.replace(/[.,;:]\s*$/,``).length,v;if(u?.indices){if(v={},u.indices[2]&&(v.code=o(i.cleanStart,u.indices[2],n)),u.indices[3]&&f){let e=u.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}}else if(d?.indices&&(v={},d.indices[2]&&(v.code=o(i.cleanStart,d.indices[2],n)),d.indices[3]&&f)){let e=d.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}let y=a?.95:.5;return p&&(y+=.05),y=Math.min(y,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:h,originalEnd:g},confidence:y,matchedText:r,processTimeMs:0,patternsChecked:1,code:c,section:f,subsection:p,pincite:p,jurisdiction:a,hasEtSeq:m||void 0,spans:v}}const ut=/[Ss]ection\s+(\d+[A-Za-z0-9-]*)((?:\([^)]*\))*)\s+of\s+title\s+(\d+)/d;function dt(e,t){let{text:n,span:r}=e,i=ut.exec(n),a,c,l;i?(a=i[1],c=i[2]||void 0,l=Number.parseInt(i[3],10)):a=n;let{originalStart:u,originalEnd:d}=s(r,t),f;i?.indices&&(f={},i.indices[1]&&(f.section=o(r.cleanStart,i.indices[1],t)),i.indices[3]&&(f.title=o(r.cleanStart,i.indices[3],t)),i.indices[2]&&c&&(f.subsection=o(r.cleanStart,i.indices[2],t)));let p=.85;return l!==void 0&&(p+=.05),c&&(p+=.05),p=Math.min(p,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:p,matchedText:n,processTimeMs:0,patternsChecked:1,title:l,code:`U.S.C.`,section:a,subsection:c,pincite:c,jurisdiction:`US`,spans:f}}function ft(e,t){let{text:n,span:r}=e,i=/^(?:(\d+)\s+)?([A-Za-z.\s]+?)\s*§+\s*(\d+[A-Za-z0-9-]*)/.exec(n);if(!i){let{originalStart:e,originalEnd:i}=s(r,t);return{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:e,originalEnd:i},confidence:.3,matchedText:n,processTimeMs:0,patternsChecked:1,code:n,section:``}}let a=i[1]?Number.parseInt(i[1],10):void 0,o=i[2].trim(),c=i[3],{originalStart:l,originalEnd:u}=s(r,t),d=.5;return[`U.S.C.`,`C.F.R.`,`Cal. Civ. Code`,`Cal. Penal Code`,`N.Y. Civ. Prac. L. & R.`,`Tex. Civ. Prac. & Rem. Code`].some(e=>o.includes(e))&&(d+=.3),d=Math.min(d,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:l,originalEnd:u},confidence:d,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:o,section:c}}function pt(e,t){switch(e.patternId){case`usc`:case`cfr`:return rt(e,t);case`prose`:return dt(e,t);case`abbreviated-code`:return Qe(e,t);case`named-code`:case`mass-chapter`:return lt(e,t);case`chapter-act`:return et(e,t);default:return ft(e,t)}}function mt(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Statutes at Large citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`statutesAtLarge`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}const ht=[{id:`federal-reporter`,regex:/\b(\d+(?:-\d+)?)\s+(F\.\s?Supp\.(?:\s?(?:\d+(?:st|nd|rd|th)|2d|3d))?|F\.\s?App'x|F\.(?:\d+(?:st|nd|rd|th)|2d|3d)?)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`Federal Reporter (F., F.2d, F.3d, F.Nth, F.Supp., F.App'x, etc.)`,type:`case`},{id:`supreme-court`,regex:/\b(\d+(?:-\d+)?)\s+(U\.\s?S\.|S\.\s?Ct\.|L\.\s?Ed\.(?:\s?(?:\d+(?:st|nd|rd|th)|2d|3d))?)\s+(?:\(\d+\s+[A-Z][A-Za-z.]+\)\s+)?(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`U.S. Supreme Court reporters (with optional nominative reporter parenthetical)`,type:`case`},{id:`state-reporter`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?! L\.[JQR\s])(?!\s+vs?\.\s)[A-Za-z.\d\s&'])+?)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`State reporters (broad pattern allowing multi-word reporters with & and ', excludes journal patterns with " L.J/Q/Rev" and phantom matches across a case-name separator " v. "/" vs. ", validated against reporters-db in Phase 3)`,type:`case`}],gt=[{id:`docket-paren-court-year`,regex:/\bNo\.\s+([\d]+(?:-[\w\d]+)*)\s+\(([^)]+\s(\d{4}))\)/g,description:`Docket-number citation: "Party v. Party, No. <docket> (<court> <year>)"`,type:`docket`}],_t=[{id:`law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?!\s+vs?\.\s)(?!\s+at\s+\d)[A-Za-z.\s])+)\s+(\d+)\b/g,description:`Law review citations (e.g., "120 Harv. L. Rev. 500"), validated against journals-db in Phase 3. Negative lookaheads exclude " v. "/" vs. " (so a party-name run isn't mis-captured as a journal) and " at <digit>" (so a short-form pincite like "554 U.S. at 621" isn't mis-captured as a journal).`,type:`journal`}],vt=[{id:`state-vendor-neutral-hyphenated-ms`,regex:/\b(\d{4})-([A-Z]+)-(\d+)-([A-Z]+)\b/g,description:`Mississippi 4-segment vendor-neutral (e.g., "2010-CT-01234-SCT", "2015-CA-00567-COA")`,type:`neutral`},{id:`state-vendor-neutral-hyphenated`,regex:/\b(\d{4})-([A-Z][A-Za-z]+)-(\d+)\b/g,description:`Hyphenated vendor-neutral (e.g., "2010-NMSC-007", "2024-Ohio-764", "2020-NCSC-118")`,type:`neutral`},{id:`state-vendor-neutral`,regex:/\b(\d{4})\s+(IL\s+App\s+\(\d+(?:st|nd|rd|th|d)\)|OK\s+(?:CIV\s+APP|CR|AG)|[A-Z]{2}(?:\s+App\.?)?)\s+(\d+(?:-U)?)\b/g,description:`State vendor-neutral citations (e.g., "2007 UT 49", "2017 WI 17", "2013 IL 112116", "2011 IL App (1st) 101234", "2020 OK CIV APP 67", "2020 IL App (2d) 190123-U")`,type:`neutral`},{id:`westlaw`,regex:/\b(\d{4})\s+WL\s+(\d+)\b/g,description:`WestLaw citations (e.g., "2021 WL 123456")`,type:`neutral`},{id:`lexis`,regex:/\b(\d{4})\s+[A-Z][A-Za-z.\s]+?\s+LEXIS\s+(\d+)\b/g,description:`LexisNexis citations (federal: "2021 U.S. LEXIS 5000", "2021 U.S. App. LEXIS 12345"; state: "2020 Cal. LEXIS 1000", "2020 Tex. App. LEXIS 5000")`,type:`neutral`},{id:`public-law`,regex:/\bPub\.\s?L\.(?:\s?No\.)?\s?(\d+-\d+)\b/g,description:`Public Law citations (e.g., "Pub. L. No. 117-58" or "Pub. L. 116-283")`,type:`publicLaw`},{id:`federal-register`,regex:/\b(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)\b/g,description:`Federal Register citations (e.g., "86 Fed. Reg. 12345")`,type:`federalRegister`},{id:`statutes-at-large`,regex:/\b(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)\b/g,description:`Statutes at Large citations (e.g., "124 Stat. 119")`,type:`statutesAtLarge`},{id:`compact-law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.]+L\.(?:Rev|J|Q)\.)\s+(\d+)\b/g,description:`Compact law review citations without spaces (e.g., "93 Harv.L.Rev. 752")`,type:`journal`}],yt=[{id:`id`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]d\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Id. citations (e.g., "Id." or "Id. at 253")`,type:`case`},{id:`ibid`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]bid\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Ibid. citations (e.g., "Ibid." or "Ibid. at 125")`,type:`case`},{id:`supra`,regex:/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Supra citations (e.g., "Smith, supra" or "Smith, supra, at 460")`,type:`case`},{id:`supra`,regex:/(?:^|(?<=\s)|(?<=[;.]))supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?|\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?|\s+(?:§+|Part|p\.)\s*\S+)/g,description:`Standalone supra (e.g., "supra note 12" or "supra at 15")`,type:`case`},{id:`shortFormCase`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?\b/g,description:`Short-form case citations (e.g., "500 F.2d at 125")`,type:`case`}],bt=[{id:`usc`,regex:/\b(\d+)\s+(?:U\.S\.C\.?|USC)\s*§§?\s*(\d+[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`U.S. Code citations with optional subsections and et seq. (e.g., "42 U.S.C. § 1983(a)(1) et seq.")`,type:`statute`},{id:`cfr`,regex:/\b(\d+)\s+C\.?F\.?R\.?\s*(?:(?:Part|pt\.)\s+|§§?\s*)(\d+(?:\.\d+)?[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Code of Federal Regulations with Part or §, subsections, et seq. (e.g., "12 C.F.R. Part 226", "40 C.F.R. § 122.26(b)(14)")`,type:`statute`},{id:`prose`,regex:/\b[Ss]ection\s+(\d+[A-Za-z0-9-]*(?:\([^)]*\))*)\s+of\s+title\s+(\d+)\b/g,description:`Prose-form federal citations (e.g., "section 1983 of title 42"). Note: MD-style "section X of the Y Article" deferred to PR 3.`,type:`statute`},{id:`named-code`,regex:/\b(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|(?<!W\.?\s?)Va\.?|Ala(?:bama)?\.?)\s+((?:[A-Za-z.&',\s]+?))\s*§§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Named-code state citations (NY, CA, TX, MD, VA, AL) with jurisdiction prefix + code name + §`,type:`statute`},{id:`mass-chapter`,regex:/\b(Mass\.?\s*Gen\.?\s*Laws|M\.?G\.?L\.?A?\.?|A\.?L\.?M\.?|G\.?\s*L\.?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*([\w./-]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Massachusetts chapter-based citations (e.g., "Mass. Gen. Laws ch. 93A, § 2")`,type:`statute`},{id:`chapter-act`,regex:/\b(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/([^\s(]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Illinois Compiled Statutes chapter-act citations (e.g., "735 ILCS 5/2-1001")`,type:`statute`},{id:`abbreviated-code`,regex:e.a(),description:`Abbreviated state code citations for all US jurisdictions`,type:`statute`}];function xt(e,t=[...ht,...bt,..._t,...vt,...yt]){let n=[];for(let r of t)try{let t=e.matchAll(r.regex);for(let e of t)n.push({text:e[0],span:{cleanStart:e.index,cleanEnd:e.index+e[0].length},type:r.type,patternId:r.id})}catch(e){console.warn(`Pattern ${r.id} threw error, skipping:`,e instanceof Error?e.message:String(e))}return n.sort((e,t)=>e.span.cleanStart-t.span.cleanStart),n}var St=class{root=null;nextOrder=0;distanceFn;constructor(e){this.distanceFn=e}insert(e){let t={key:e,insertionOrder:this.nextOrder++,children:new Map};if(this.root===null){this.root=t;return}let n=this.root;for(;;){let r=this.distanceFn(e,n.key);if(r===0)return;let i=n.children.get(r);if(i)n=i;else{n.children.set(r,t);return}}}query(e,t){if(this.root===null)return[];let n=[],r=[this.root],i;for(;i=r.pop();){let a=this.distanceFn(e,i.key);a<=t&&n.push({key:i.key,distance:a,insertionOrder:i.insertionOrder});let o=a-t,s=a+t;for(let[e,t]of i.children)e>=o&&e<=s&&r.push(t)}return n.sort((e,t)=>e.distance-t.distance||e.insertionOrder-t.insertionOrder),n}};function Ct(e,t,n=1/0){if(e.length===0)return Math.min(t.length,n+1);if(t.length===0)return Math.min(e.length,n+1);let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e,a=r.length,o=Array.from({length:a+1},(e,t)=>t),s=Array(a+1);for(let e=1;e<=i.length;e++){s[0]=e;let t=e;for(let n=1;n<=a;n++)i[e-1]===r[n-1]?s[n]=o[n-1]:s[n]=1+Math.min(o[n],s[n-1],o[n-1]),s[n]<t&&(t=s[n]);if(t>n)return n+1;let c=o;o=s,s=c}return o[a]}function wt(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<=t?n=i+1:r=i}return n}function Tt(e,t,n=/\n\n+/g){let r=new Map,i=[0],a;for(;(a=n.exec(e))!==null;)i.push(a.index+a[0].length);i.push(e.length);for(let e=0;e<t.length;e++){let n=t[e].span.originalStart;r.set(e,wt(i,n)-1)}return r}function Et(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r].span.cleanStart,a=0,o=0,s=t.length-1;for(;o<=s;){let e=o+s>>>1,n=t[e];if(i<n.start)s=e-1;else if(i>=n.end)o=e+1;else{a=n.footnoteNumber;break}}n.set(r,a)}return n}function Dt(e,t,n,r,i=!1){if(r===`none`)return!0;let a=n.get(e),o=n.get(t);return!!(a===void 0||o===void 0||a===o||r===`footnote`&&i&&a===0)}function Ot(e){if(e.type===`case`||e.type===`docket`)return e.fullSpan}var kt=class{citations;text;options;context;partyNameTree;constructor(e,t,n={}){this.citations=e,this.text=t,this.options={scopeStrategy:n.scopeStrategy??`none`,autoDetectParagraphs:n.autoDetectParagraphs??!0,paragraphBoundaryPattern:n.paragraphBoundaryPattern??/\n\n+/g,fuzzyPartyMatching:n.fuzzyPartyMatching??!0,partyMatchThreshold:n.partyMatchThreshold??.8,reportUnresolved:n.reportUnresolved??!0,footnoteMap:n.footnoteMap},this.partyNameTree=new St(Ct),this.context={citationIndex:0,allCitations:e,lastResolvedIndex:void 0,fullCitationHistory:new Map,paragraphMap:new Map},this.options.autoDetectParagraphs&&(this.context.paragraphMap=Tt(t,e,this.options.paragraphBoundaryPattern)),this.options.scopeStrategy===`footnote`&&this.options.footnoteMap&&(this.context.paragraphMap=Et(e,this.options.footnoteMap))}resolve(){let e=[];for(let n=0;n<this.citations.length;n++){this.context.citationIndex=n;let r=this.citations[n],i;switch(r.type){case`id`:i=this.resolveId(r);break;case`supra`:i=this.resolveSupra(r);break;case`shortFormCase`:i=this.resolveShortFormCase(r);break;default:t(r)&&(e.some(e=>{let t=Ot(e);return t?t.cleanStart<=r.span.cleanStart&&t.cleanEnd>=r.span.cleanEnd:!1})||(this.context.lastResolvedIndex=n),this.trackFullCitation(r,n));break}i?.resolvedTo!==void 0&&(this.context.lastResolvedIndex=i.resolvedTo),e.push({...r,resolution:i})}return e}resolveId(e){let t=this.context.citationIndex,n=this.context.lastResolvedIndex;return n===void 0?this.createFailureResult(`No preceding citation found`):this.isWithinScope(n,t)?{resolvedTo:n,confidence:1}:this.createFailureResult(`Antecedent citation outside scope boundary`)}resolveSupra(e){if(!e.partyName)return;let t=this.context.citationIndex,n=this.normalizePartyName(e.partyName),r=n.length,i=this.options.partyMatchThreshold,a=r===0?0:Math.ceil(r*(1-i)/i),o=this.partyNameTree.query(n,a);o.sort((e,t)=>e.insertionOrder-t.insertionOrder);let s;for(let e of o){let n=this.context.fullCitationHistory.get(e.key);if(n===void 0||!this.isWithinScope(n,t,!0))continue;let i=Math.max(r,e.key.length),a=i===0?1:1-e.distance/i;(!s||a>s.similarity)&&(s={index:n,similarity:a})}if(!s)return this.createFailureResult(`No full citation found in scope`);if(s.similarity<this.options.partyMatchThreshold)return this.createFailureResult(`Party name similarity ${s.similarity.toFixed(2)} below threshold ${this.options.partyMatchThreshold}`);let c=[];return s.similarity<1&&c.push(`Fuzzy match: similarity ${s.similarity.toFixed(2)}`),{resolvedTo:s.index,confidence:s.similarity,warnings:c.length>0?c:void 0}}resolveShortFormCase(e){let t=this.context.citationIndex;for(let n=t-1;n>=0;n--){let r=this.citations[n];if(r.type===`case`&&r.volume===e.volume&&this.normalizeReporter(r.reporter)===this.normalizeReporter(e.reporter))return this.isWithinScope(n,t,!0)?{resolvedTo:n,confidence:.95}:this.createFailureResult(`Matching citation outside scope boundary`)}return this.createFailureResult(`No matching full case citation found`)}trackFullCitation(e,t){if(e.type===`case`&&(e.defendantNormalized&&(this.context.fullCitationHistory.set(e.defendantNormalized,t),this.partyNameTree.insert(e.defendantNormalized)),e.plaintiffNormalized&&(this.context.fullCitationHistory.set(e.plaintiffNormalized,t),this.partyNameTree.insert(e.plaintiffNormalized)),!e.plaintiffNormalized&&!e.defendantNormalized)){let n=this.extractPartyName(e);if(n){let e=this.normalizePartyName(n);this.context.fullCitationHistory.set(e,t),this.partyNameTree.insert(e)}}}extractPartyName(e){let t=e.span.originalStart,n=Math.max(0,t-100),r=this.text.substring(n,t),i=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*)\s+v\.?\s+[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*,\s*$/);if(i)return this.stripSignalWords(i[1].trim());let a=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*),\s*$/);if(a)return this.stripSignalWords(a[1].trim())}stripSignalWords(e){let t=e.replace(/^(?:In(?!\s+re\b)|See(?:\s+[Aa]lso)?|Compare|But(?:\s+[Ss]ee)?|Cf\.?|Also)\s+/i,``).trim();return t.length>0?t:e}normalizePartyName(e){return e.toLowerCase().replace(/\s+/g,` `).trim()}normalizeReporter(e){return e.toLowerCase().replace(/\s+/g,``).replace(/\./g,``)}isWithinScope(e,t,n=!1){return Dt(e,t,this.context.paragraphMap,this.options.scopeStrategy,n)}createFailureResult(e){if(this.options.reportUnresolved)return{resolvedTo:void 0,failureReason:e,confidence:0}}};function At(e,t,n){return new kt(e,t,n).resolve()}function jt(e,t=``){let n=new Map;if(e.length===0||t===``)return n;let r=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(a.type!==`case`||r.has(i))continue;let o=[];for(let n=i+1;n<e.length;n++){let s=e[n];if(s.type!==`case`)break;let c=(n===i+1?a:e[n-1]).span.cleanEnd,l=s.span.cleanStart;if(l-c>20)break;let u=t.substring(c,l);if(!u.includes(`,`))break;let d=u.indexOf(`,`);if(u.length-d-1>5||t.substring(a.span.cleanEnd,s.span.cleanEnd).includes(`)`)||!Mt(t,s.span.cleanEnd))break;o.push(n),r.add(n)}o.length>0&&n.set(i,o)}return n}function Mt(e,t){let n=e.substring(t,t+200),r=n.indexOf(`(`);if(r===-1)return!1;let i=0;for(let e=r;e<n.length;e++)if(n[e]===`(`)i++;else if(n[e]===`)`&&(i--,i===0))return!0;return!1}const Nt=Pt();function Pt(){return[{regex:/^but\s+cf\.,\s+e\.g\.,?(?=\s|$)/i,signal:`but cf., e.g.`},{regex:/^see\s+also,\s+e\.g\.,?(?=\s|$)/i,signal:`see also, e.g.`},{regex:/^but\s+see,\s+e\.g\.,?(?=\s|$)/i,signal:`but see, e.g.`},{regex:/^cf\.,\s+e\.g\.,?(?=\s|$)/i,signal:`cf., e.g.`},{regex:/^see,\s+e\.g\.,?(?=\s|$)/i,signal:`see, e.g.`},{regex:/^see\s+generally\b/i,signal:`see generally`},{regex:/^see\s+also\b/i,signal:`see also`},{regex:/^but\s+see\b/i,signal:`but see`},{regex:/^but\s+cf\.?(?=\s|$)/i,signal:`but cf`},{regex:/^compare\b/i,signal:`compare`},{regex:/^accord\b/i,signal:`accord`},{regex:/^contra\b/i,signal:`contra`},{regex:/^see\b/i,signal:`see`},{regex:/^cf\.?(?=\s|$)/i,signal:`cf`},{regex:/^e\.g\.,?(?=\s|$)/i,signal:`e.g.`}].map(({regex:e,signal:t})=>({regex:e,endRegex:RegExp(`${e.source.replace(/^\^/,`(?<![a-z])`)}\\s*$`,e.flags),signal:t}))}function Ft(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanEnd:e.span.cleanEnd}function It(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanStart:e.span.cleanStart}function Lt(e,t){e.signal=t}function Rt(e){let t=e.trimStart();for(let{regex:e,signal:n}of Nt){let r=e.exec(t);if(r)return{signal:n,length:r[0].length}}}function zt(e){let t=e.indexOf(`;`);if(t===-1||e.substring(0,t).trim()!==``)return{valid:!1};let n=e.substring(t+1).trim();if(n===``)return{valid:!0};let r=Rt(n);return r&&n.substring(r.length).trim()===``?{valid:!0,signal:r.signal}:{valid:!1}}function Bt(e,t){if(e.length<2)return;let n=[],r=[];for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(o.type===`case`&&o.subsequentHistoryOf){r.length>=2&&n.push(r),r=[];continue}if(a.type===`case`&&a.subsequentHistoryOf)continue;let s=Ft(a),c=It(o);if(c<=s){r.length>=2&&n.push(r),r=[];continue}let l=zt(t.substring(s,c));l.valid?(r.length===0&&r.push(i),r.push(i+1),l.signal&&!o.signal&&Lt(o,l.signal)):(r.length>=2&&n.push(r),r=[])}r.length>=2&&n.push(r);for(let t=0;t<n.length;t++){let r=n[t];if(r.length<2)continue;let i=`sc-${t}`;for(let t=0;t<r.length;t++){let n=e[r[t]];n.stringCitationGroupId=i,n.stringCitationIndex=t,n.stringCitationGroupSize=r.length}}for(let r of n){if(r.length<2)continue;let n=e[r[0]];if(n.signal)continue;let i=Math.max(0,It(n)-60),a=t.substring(i,It(n)).trim();for(let{endRegex:e,signal:t}of Nt)if(e.test(a)){Lt(n,t);break}}}function Vt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.signal&&r.stringCitationGroupId)continue;let i=n>0?Ft(e[n-1]):0,a=r.span.cleanStart;if(a<=i)continue;let o=t.substring(i,a),s=[];for(let{signal:e}of Nt){let t=e.replace(/\./g,`\\.`).replace(/\s+/g,`\\s+`),n=RegExp(`(?<![a-zA-Z])(${t})(?![a-zA-Z])`,`gi`),r;for(;(r=n.exec(o))!==null;)s.push({signal:e,start:r.index,end:r.index+r[0].length})}if(s.length===0)continue;s.sort((e,t)=>{let n=t.end-e.end;return n===0?t.end-t.start-(e.end-e.start):n});let c=s[0];for(let e of s)e.start<=c.start&&e.end>=c.end&&(c=e);Lt(r,c.signal)}}const Ht=1750,Ut=.1,Wt=new Set([`i.c.j.`,`u.n.t.s.`,`i.l.m.`,`i.l.r.`,`p.c.i.j.`,`a.c.`,`w.l.r.`,`all e.r.`,`q.b.`,`k.b.`,`ch.`,`co. rep.`,`e.c.r.`,`e.h.r.r.`,`c.m.l.r.`,`edw.`]);function Gt(e){if(e.type===`case`||e.type===`shortFormCase`)return e.reporter;if(e.type===`journal`)return e.abbreviation}function Kt(e){switch(e.type){case`case`:return e.year;case`journal`:return e.year;case`federalRegister`:return e.year;case`statutesAtLarge`:return e.year;default:return}}const qt=new Set([`court`,`rule`,`section`,`chapter`,`article`,`part`,`title`,`paragraph`,`clause`,`amendment`,`dismissed`,`granted`,`denied`,`filed`,`argued`]);function Jt(e){return!!(e.toLowerCase().split(/\s+/).some(e=>qt.has(e))||!e.includes(`.`)&&e.length>12)}const Yt=new Set(`the.a.an.in.on.at.but.and.for.by.to.with.from.as.if.so.nor.yet.not.no.then.when.where.who.what.how.that.this.these.those.he.she.it.they.we.his.her.its.their.our.was.were.is.are.has.had.been.being.did.does.do.may.shall.will.would.could.should.held.said.found.made.took.gave.see.also.january.february.march.april.june.july.august.september.october.november.december`.split(`.`)),Xt=2e3,Zt=/^\d{1,2}-\d{4,}$/;function Qt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e;return typeof t.volume==`number`?t.volume>Xt:!1}function $t(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e,n=String(t.volume);return Zt.test(n)}function en(t){if(t.type!==`case`&&t.type!==`shortFormCase`)return!1;let n=t,r=typeof n.volume==`number`?n.volume:Number.parseInt(String(n.volume),10);if(Number.isNaN(r)||r<1||r>20)return!1;let i=n.reporter;if(!i)return!1;let a=e.s();return a?(a.byAbbreviation.get(i.toLowerCase())??[]).length===0:i.includes(`.`)?!1:i.toLowerCase().split(/\s+/).some(e=>Yt.has(e))}function tn(e){let t=Gt(e);if(t&&Wt.has(t.toLowerCase().trim())||t&&(e.type===`case`||e.type===`shortFormCase`)&&Jt(t)||Qt(e)||$t(e)||en(e))return!0;let n=Kt(e);return n!==void 0&&n<Ht}function nn(e){let t=[],n=Gt(e);if(n){let r=n.toLowerCase().trim();Wt.has(r)&&t.push(`Reporter "${n}" is a known non-US source`),(e.type===`case`||e.type===`shortFormCase`)&&Jt(n)&&t.push(`Reporter "${n}" contains prose words or is implausibly long`)}if(Qt(e)){let n=e;t.push(`Volume ${n.volume} exceeds maximum plausible volume (${Xt}) — likely a zip code or other number`)}if($t(e)){let n=e;t.push(`Hyphenated volume "${n.volume}" matches docket number pattern — likely a case number, not a citation volume`)}if(en(e)){let n=e;t.push(`Small volume (${n.volume}) with unrecognized reporter "${n.reporter}" — likely a paragraph or footnote marker`)}let r=Kt(e);return r!==void 0&&r<Ht&&t.push(`Year ${r} predates US legal reporting (threshold: ${Ht})`),t}function rn(e,t){if(t)return e.filter(e=>!tn(e));for(let t of e){if(t.confidence===Ut&&t.warnings?.length)continue;let e=nn(t);if(e.length>0){t.confidence=Ut;let n=e.map(e=>({level:`warning`,message:e,position:{start:t.span.originalStart,end:t.span.originalEnd}}));t.warnings=[...t.warnings||[],...n]}}return e}const an=/^(\S+)\s+(.+)\s+(\d+)$/;function on(e,t){let n=performance.now(),{cleaned:r,transformationMap:i,warnings:a}=y(e,t?.cleaners),o;if(t?.detectFootnotes){let t=O(e);t.length>0&&(o=A(t,i))}let s=t?.patterns||[...vt,...gt,...yt,...ht,...Me,...bt,..._t],c=xt(r,s),l=new Map;for(let e=0;e<s.length;e++){let t=s[e].id;l.has(t)||l.set(t,e)}let u=e=>l.get(e.patternId)??1/0,d=[...c].sort((e,t)=>e.span.cleanStart-t.span.cleanStart||t.span.cleanEnd-e.span.cleanEnd||u(e)-u(t)),f=[];for(let e of d){let t=!1;for(let n of f)if(n.span.cleanStart<=e.span.cleanStart&&n.span.cleanEnd>=e.span.cleanEnd&&!(u(n)>u(e))&&(n.span.cleanStart<e.span.cleanStart||n.span.cleanEnd>e.span.cleanEnd||u(n)<u(e))){t=!0;break}t||f.push(e)}let p=jt(f,r),m=new Map;for(let[e,t]of p.entries())for(let n of t)m.set(n,e);let h=[];for(let t=0;t<f.length;t++){let o=f[t],s;switch(o.type){case`case`:s=o.patternId===`id`||o.patternId===`ibid`?Ke(o,i,r):o.patternId===`supra`?qe(o,i):o.patternId===`shortFormCase`?Je(o,i):Ae(o,i,r,e);break;case`docket`:{let t=Be(o,i,r,e);if(!t)continue;s=t;break}case`statute`:s=pt(o,i);break;case`journal`:s=He(o,i,r);break;case`neutral`:s=We(o,i,r);break;case`publicLaw`:s=Ge(o,i);break;case`federalRegister`:s=Ve(o,i);break;case`statutesAtLarge`:s=mt(o,i);break;case`constitutional`:s=ze(o,i);break;default:continue}if(a.length>0&&(s.warnings=[...s.warnings||[],...a]),s.processTimeMs=performance.now()-n,s.type===`case`){let e=p.has(t),n=m.has(t);if(e||n){let r=f[n?m.get(t)??t:t],i=an.exec(r.text);if(i){let[,n,r,a]=i;if(s.groupId=`${n}-${r.replace(/\s+/g,`.`)}-${a}`,e){let e=p.get(t)??[];s.parallelCitations=e.map(e=>{let t=f[e],n=an.exec(t.text);if(n){let[,e,t,r]=n;return{volume:/^\d+$/.test(e)?Number.parseInt(e,10):e,reporter:t,page:Number.parseInt(r,10)}}return{volume:0,reporter:``,page:0}})}}}}h.push(s)}cn(h),ln(h),Bt(h,r),Vt(h,r);let g=rn(h,t?.filterFalsePositives??!1);return o&&j(g,o),t?.resolve?At(g,e,o?{...t.resolutionOptions,footnoteMap:o}:t.resolutionOptions):g}async function sn(e,t){return on(e,t)}function cn(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!==`case`||!r.subsequentHistoryEntries)continue;let i=r.subsequentHistoryEntries,a=0;for(let r=n+1;r<e.length&&a<i.length;r++){let o=e[r];if(o.type!==`case`)continue;let s=i[a].signalSpan.cleanEnd;o.span.cleanStart>=s&&(t.push({parentIdx:n,childIdx:r,signal:i[a].signal}),a++)}}if(t.length===0)return;let n=new x(e.length);for(let e of t)n.union(e.parentIdx,e.childIdx);let r=new Map;for(let e of t)r.set(e.childIdx,e.signal);for(let[t,i]of n.components()){if(i.length===1)continue;let n=e[t];if(n.type!==`case`)continue;let a=[...n.subsequentHistoryEntries??[]];for(let n of i){if(n===t)continue;let i=e[n];if(i.type!==`case`)continue;let o=r.get(n);if(o&&(i.subsequentHistoryOf={index:t,signal:o},i.subsequentHistoryEntries)){for(let e of i.subsequentHistoryEntries)a.push({...e,order:a.length});i.subsequentHistoryEntries=void 0}}n.subsequentHistoryEntries=a}}function ln(e){for(let t of e){if(t.type!==`case`||!t.subsequentHistoryOf)continue;let n=e[t.subsequentHistoryOf.index];!n||n.type!==`case`||n.caseName&&(t.caseName=n.caseName,t.plaintiff=n.plaintiff,t.defendant=n.defendant,t.plaintiffNormalized=n.plaintiffNormalized,t.defendantNormalized=n.defendantNormalized,t.proceduralPrefix=n.proceduralPrefix,t.spans&&(t.spans.caseName=void 0,t.spans.plaintiff=void 0,t.spans.defendant=void 0),t.fullSpan&&={cleanStart:t.span.cleanStart,cleanEnd:t.fullSpan.cleanEnd,originalStart:t.span.originalStart,originalEnd:t.fullSpan.originalEnd})}}exports.DocumentResolver=kt,exports.applyFalsePositiveFilters=rn,exports.assertUnreachable=a,exports.cleanText=y,exports.detectFootnotes=O,exports.extractCase=Ae,exports.extractCitations=on,exports.extractCitationsAsync=sn,exports.extractConstitutional=ze,exports.extractFederalRegister=Ve,exports.extractJournal=He,exports.extractNeutral=We,exports.extractPublicLaw=Ge,exports.extractStatute=pt,exports.extractStatutesAtLarge=mt,exports.isCaseCitation=r,exports.isCitationType=i,exports.isFullCitation=t,exports.isShortFormCitation=n,exports.normalizeCourt=H,exports.parsePincite=V,exports.resolveCitations=At,exports.spanFromGroupIndex=o,exports.tokenize=xt;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|